├── include └── gotopp │ ├── configwin.h │ ├── pile.h │ ├── wlib.h │ ├── global.h │ ├── hachage.h │ ├── machine.h │ ├── mutex.h │ ├── symbole.h │ ├── gppmodule.h │ ├── programme.h │ ├── tableaux.h │ ├── type │ ├── bebe.h │ ├── type.h │ ├── chaine.h │ ├── expreg.h │ ├── hachval.h │ ├── objetc.h │ ├── tabval.h │ ├── valeur.h │ └── reference.h │ ├── icompilateur.h │ ├── instruction.h │ ├── appelfonction.h │ ├── config.h.in │ ├── version.h │ ├── erreur.h │ └── base.h ├── exemples ├── simple │ ├── test.txt │ ├── hello.gpp │ ├── markov.gpp │ ├── tache2.gpp │ ├── texte.gpp │ ├── entrenom.gpp │ ├── fichier.gpp │ ├── premier.gpp │ ├── varargs.gpp │ ├── exemblebib.gpt │ ├── repertoire.gpp │ └── gotomultiple.gpp ├── maths │ ├── pi.gpp │ └── pi3.gpp ├── jeux │ ├── nombre.gpp │ ├── snake.gpp │ ├── aventure.gpp │ └── devineunnombre.gpp ├── outils │ ├── cal.gpp │ ├── ftp.gpp │ ├── telnet.gpp │ ├── adresse.dat │ ├── adresse.gpp │ ├── monProxy.gpp │ └── sendmail.gpp ├── tests │ ├── base.gpp │ └── exemple.gpp ├── divers │ ├── marche.gpp │ ├── chainelib.gpp │ ├── marche2.gpp │ └── tresrapide.gpp ├── modules │ ├── client.gpp │ ├── serveur.gpp │ ├── troisde.gpp │ └── tortueivre.gpp └── bomberniac │ ├── RIDMI.html │ ├── present.gpp │ ├── bomberclient.gpp │ ├── bomberserveur.gpp │ ├── intro.baf │ ├── plan.bnp │ ├── tennis.bnp │ └── ldv.bnp ├── boehmgc ├── include │ ├── gc_inline.h │ ├── leak_detector.h │ ├── private │ │ ├── pthread_stop_world.h │ │ ├── darwin_stop_world.h │ │ ├── solaris_threads.h │ │ ├── darwin_semaphore.h │ │ ├── specific.h │ │ ├── pthread_support.h │ │ ├── cord_pos.h │ │ └── dbg_mlc.h │ ├── javaxfc.h │ ├── gc_amiga_redirects.h │ ├── ec.h │ ├── gc_backptr.h │ ├── gc_pthread_redirects.h │ ├── gc_local_alloc.h │ ├── gc_inl.h │ ├── gc_config_macros.h │ ├── gc_typed.h │ └── gc_gcj.h ├── src │ ├── gc_cpp.cpp │ ├── gcname.c │ ├── add_gc_prefix.c │ ├── if_mach.c │ ├── if_not_there.c │ ├── version.h │ ├── real_malloc.c │ ├── threadlibs.c │ ├── gc_cpp.cc │ ├── gc_dlopen.c │ ├── setjmp_t.c │ ├── MacOS.c │ ├── obj_map.c │ ├── specific.c │ ├── pcr_interface.c │ ├── solaris_pthreads.c │ └── checksums.c └── CMakeLists.txt ├── modules ├── CMakeLists.txt ├── tortue │ ├── tortue.cpp │ └── CMakeLists.txt ├── hachetml │ ├── hachetml.cpp │ └── mkhachetml ├── troisde │ ├── troisde.cpp │ └── mktest └── chaussettes │ ├── chaussettes.cpp │ └── CMakeLists.txt ├── doc ├── gpp.1 ├── asm.pl ├── creerdoc.pl ├── src │ ├── ass.txt │ ├── intro.txt │ ├── grammaire.txt │ ├── motsclefs.txt │ ├── technique.txt │ ├── variables.txt │ ├── operateurs.txt │ └── utilisation.txt └── style.css ├── LISEZMOI.html ├── vs ├── Goto++.sln ├── Backup │ └── Goto++.sln ├── GOTO++ │ └── Goto++.vcproj ├── tortue │ ├── tortue.vcproj │ └── tortue.vcxproj.filters ├── BomberNIAC │ └── BomberNIAC.vdproj ├── InstGOTO++ │ └── InstGOTO++.vdproj ├── chaussettes │ ├── chaussettes.vcproj │ └── chaussettes.vcxproj.filters ├── ModuleInterp │ └── ModuleInterp.vdproj ├── BoehmGC │ └── ReadMe.txt ├── troisde │ ├── troisde.vcxproj.filters │ ├── troisde.vcproj │ └── troisde.vcxproj ├── hachetml │ ├── hachetml.vcxproj.filters │ ├── hachetml.vcproj │ └── hachetml.vcxproj ├── GotoPP.Test │ └── GotoPP.Test.vcxproj.filters ├── Aide │ ├── Aide.vcxproj.filters │ ├── Aide.vcproj │ └── Aide.vcxproj └── Interpreteur │ ├── Interpreteur.vcxproj.filters │ ├── Interpreteur.vcxproj │ └── Interpreteur.vcproj ├── src ├── commun │ ├── classe.h │ ├── instr.h │ ├── chaine.cpp │ ├── expreg.cpp │ ├── outils.cpp │ ├── tabval.cpp │ ├── valeur.cpp │ ├── hachval.cpp │ ├── programme.cpp │ ├── sauveur.cpp │ ├── regmagic.h │ ├── erreur.cpp │ ├── mutex.cpp │ ├── wlib.cpp │ ├── sauveur.h │ └── symbole.cpp ├── machine │ ├── pile.cpp │ ├── machine.cpp │ ├── modules.cpp │ └── interpreteur.cpp ├── compilateur │ ├── bloc.h │ ├── compriv.h │ ├── instrconstr.h │ ├── optimiser.cpp │ ├── compilateur.cpp │ ├── compilateur2.cpp │ └── instrconstr.cpp ├── type │ └── type.cpp └── CMakeLists.txt ├── ressources ├── RCa03580 ├── gpp.aps ├── gpp.rc ├── gotopp.ico ├── srcgpp.ico ├── banniere.jpg └── resource.h ├── interpreteur ├── princ │ ├── gpp.h │ ├── gpp.cpp │ └── desass.cpp ├── interne │ ├── defbib.h │ ├── divers.cpp │ ├── hasard.cpp │ ├── maths.cpp │ ├── chaines.cpp │ ├── console.cpp │ ├── systeme.cpp │ └── tableaux.cpp └── CMakeLists.txt ├── README.md ├── test └── gotopp │ ├── main.cpp │ └── integrationtest.h ├── .gitignore ├── LISEZMOI.md └── CMakeLists.txt /include/gotopp/configwin.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /exemples/simple/test.txt: -------------------------------------------------------------------------------- 1 | Schloup 2 | 128blob 3 | -------------------------------------------------------------------------------- /boehmgc/include/gc_inline.h: -------------------------------------------------------------------------------- 1 | # include "gc_inl.h" 2 | -------------------------------------------------------------------------------- /modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SUBDIRS(chaussettes tortue) -------------------------------------------------------------------------------- /doc/gpp.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/gpp.1 -------------------------------------------------------------------------------- /doc/asm.pl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/asm.pl -------------------------------------------------------------------------------- /LISEZMOI.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/LISEZMOI.html -------------------------------------------------------------------------------- /vs/Goto++.sln: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/Goto++.sln -------------------------------------------------------------------------------- /doc/creerdoc.pl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/creerdoc.pl -------------------------------------------------------------------------------- /doc/src/ass.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/ass.txt -------------------------------------------------------------------------------- /src/commun/classe.h: -------------------------------------------------------------------------------- 1 | #ifndef _CLASSE_H 2 | #define _CLASSE_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /doc/src/intro.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/intro.txt -------------------------------------------------------------------------------- /ressources/RCa03580: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/ressources/RCa03580 -------------------------------------------------------------------------------- /ressources/gpp.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/ressources/gpp.aps -------------------------------------------------------------------------------- /ressources/gpp.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/ressources/gpp.rc -------------------------------------------------------------------------------- /src/commun/instr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/instr.h -------------------------------------------------------------------------------- /doc/src/grammaire.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/grammaire.txt -------------------------------------------------------------------------------- /doc/src/motsclefs.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/motsclefs.txt -------------------------------------------------------------------------------- /doc/src/technique.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/technique.txt -------------------------------------------------------------------------------- /doc/src/variables.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/variables.txt -------------------------------------------------------------------------------- /exemples/maths/pi.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/maths/pi.gpp -------------------------------------------------------------------------------- /include/gotopp/pile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/pile.h -------------------------------------------------------------------------------- /include/gotopp/wlib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/wlib.h -------------------------------------------------------------------------------- /ressources/gotopp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/ressources/gotopp.ico -------------------------------------------------------------------------------- /ressources/srcgpp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/ressources/srcgpp.ico -------------------------------------------------------------------------------- /src/commun/chaine.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/chaine.cpp -------------------------------------------------------------------------------- /src/commun/expreg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/expreg.cpp -------------------------------------------------------------------------------- /src/commun/outils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/outils.cpp -------------------------------------------------------------------------------- /src/commun/tabval.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/tabval.cpp -------------------------------------------------------------------------------- /src/commun/valeur.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/valeur.cpp -------------------------------------------------------------------------------- /src/machine/pile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/machine/pile.cpp -------------------------------------------------------------------------------- /vs/Backup/Goto++.sln: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/Backup/Goto++.sln -------------------------------------------------------------------------------- /doc/src/operateurs.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/operateurs.txt -------------------------------------------------------------------------------- /doc/src/utilisation.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/doc/src/utilisation.txt -------------------------------------------------------------------------------- /exemples/jeux/nombre.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/jeux/nombre.gpp -------------------------------------------------------------------------------- /exemples/jeux/snake.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/jeux/snake.gpp -------------------------------------------------------------------------------- /exemples/maths/pi3.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/maths/pi3.gpp -------------------------------------------------------------------------------- /exemples/outils/cal.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/cal.gpp -------------------------------------------------------------------------------- /exemples/outils/ftp.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/ftp.gpp -------------------------------------------------------------------------------- /exemples/tests/base.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/tests/base.gpp -------------------------------------------------------------------------------- /include/gotopp/global.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/global.h -------------------------------------------------------------------------------- /include/gotopp/hachage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/hachage.h -------------------------------------------------------------------------------- /include/gotopp/machine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/machine.h -------------------------------------------------------------------------------- /include/gotopp/mutex.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/mutex.h -------------------------------------------------------------------------------- /include/gotopp/symbole.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/symbole.h -------------------------------------------------------------------------------- /interpreteur/princ/gpp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/princ/gpp.h -------------------------------------------------------------------------------- /ressources/banniere.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/ressources/banniere.jpg -------------------------------------------------------------------------------- /src/commun/hachval.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/hachval.cpp -------------------------------------------------------------------------------- /src/commun/programme.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/programme.cpp -------------------------------------------------------------------------------- /src/commun/sauveur.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/commun/sauveur.cpp -------------------------------------------------------------------------------- /src/compilateur/bloc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/compilateur/bloc.h -------------------------------------------------------------------------------- /src/machine/machine.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/machine/machine.cpp -------------------------------------------------------------------------------- /src/machine/modules.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/machine/modules.cpp -------------------------------------------------------------------------------- /vs/GOTO++/Goto++.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/GOTO++/Goto++.vcproj -------------------------------------------------------------------------------- /vs/tortue/tortue.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/tortue/tortue.vcproj -------------------------------------------------------------------------------- /exemples/divers/marche.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/divers/marche.gpp -------------------------------------------------------------------------------- /exemples/jeux/aventure.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/jeux/aventure.gpp -------------------------------------------------------------------------------- /exemples/outils/telnet.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/telnet.gpp -------------------------------------------------------------------------------- /exemples/simple/hello.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/hello.gpp -------------------------------------------------------------------------------- /exemples/simple/markov.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/markov.gpp -------------------------------------------------------------------------------- /exemples/simple/tache2.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/tache2.gpp -------------------------------------------------------------------------------- /exemples/simple/texte.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/texte.gpp -------------------------------------------------------------------------------- /exemples/tests/exemple.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/tests/exemple.gpp -------------------------------------------------------------------------------- /include/gotopp/gppmodule.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/gppmodule.h -------------------------------------------------------------------------------- /include/gotopp/programme.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/programme.h -------------------------------------------------------------------------------- /include/gotopp/tableaux.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/tableaux.h -------------------------------------------------------------------------------- /include/gotopp/type/bebe.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/bebe.h -------------------------------------------------------------------------------- /include/gotopp/type/type.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/type.h -------------------------------------------------------------------------------- /interpreteur/princ/gpp.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/princ/gpp.cpp -------------------------------------------------------------------------------- /modules/tortue/tortue.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/modules/tortue/tortue.cpp -------------------------------------------------------------------------------- /src/compilateur/compriv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/compilateur/compriv.h -------------------------------------------------------------------------------- /boehmgc/src/gc_cpp.cpp: -------------------------------------------------------------------------------- 1 | // Visual C++ seems to prefer a .cpp extension to .cc 2 | #include "gc_cpp.cc" 3 | -------------------------------------------------------------------------------- /exemples/divers/chainelib.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/divers/chainelib.gpp -------------------------------------------------------------------------------- /exemples/divers/marche2.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/divers/marche2.gpp -------------------------------------------------------------------------------- /exemples/modules/client.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/modules/client.gpp -------------------------------------------------------------------------------- /exemples/modules/serveur.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/modules/serveur.gpp -------------------------------------------------------------------------------- /exemples/modules/troisde.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/modules/troisde.gpp -------------------------------------------------------------------------------- /exemples/outils/adresse.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/adresse.dat -------------------------------------------------------------------------------- /exemples/outils/adresse.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/adresse.gpp -------------------------------------------------------------------------------- /exemples/outils/monProxy.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/monProxy.gpp -------------------------------------------------------------------------------- /exemples/outils/sendmail.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/outils/sendmail.gpp -------------------------------------------------------------------------------- /exemples/simple/entrenom.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/entrenom.gpp -------------------------------------------------------------------------------- /exemples/simple/fichier.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/fichier.gpp -------------------------------------------------------------------------------- /exemples/simple/premier.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/premier.gpp -------------------------------------------------------------------------------- /exemples/simple/varargs.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/varargs.gpp -------------------------------------------------------------------------------- /include/gotopp/icompilateur.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/icompilateur.h -------------------------------------------------------------------------------- /include/gotopp/instruction.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/instruction.h -------------------------------------------------------------------------------- /include/gotopp/type/chaine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/chaine.h -------------------------------------------------------------------------------- /include/gotopp/type/expreg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/expreg.h -------------------------------------------------------------------------------- /include/gotopp/type/hachval.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/hachval.h -------------------------------------------------------------------------------- /include/gotopp/type/objetc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/objetc.h -------------------------------------------------------------------------------- /include/gotopp/type/tabval.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/tabval.h -------------------------------------------------------------------------------- /include/gotopp/type/valeur.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/valeur.h -------------------------------------------------------------------------------- /interpreteur/interne/defbib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/defbib.h -------------------------------------------------------------------------------- /interpreteur/princ/desass.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/princ/desass.cpp -------------------------------------------------------------------------------- /modules/hachetml/hachetml.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/modules/hachetml/hachetml.cpp -------------------------------------------------------------------------------- /modules/troisde/troisde.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/modules/troisde/troisde.cpp -------------------------------------------------------------------------------- /src/compilateur/instrconstr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/compilateur/instrconstr.h -------------------------------------------------------------------------------- /src/compilateur/optimiser.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/compilateur/optimiser.cpp -------------------------------------------------------------------------------- /src/machine/interpreteur.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/machine/interpreteur.cpp -------------------------------------------------------------------------------- /exemples/bomberniac/RIDMI.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/bomberniac/RIDMI.html -------------------------------------------------------------------------------- /exemples/bomberniac/present.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/bomberniac/present.gpp -------------------------------------------------------------------------------- /exemples/divers/tresrapide.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/divers/tresrapide.gpp -------------------------------------------------------------------------------- /exemples/modules/tortueivre.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/modules/tortueivre.gpp -------------------------------------------------------------------------------- /exemples/simple/exemblebib.gpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/exemblebib.gpt -------------------------------------------------------------------------------- /exemples/simple/repertoire.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/repertoire.gpp -------------------------------------------------------------------------------- /include/gotopp/appelfonction.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/appelfonction.h -------------------------------------------------------------------------------- /include/gotopp/type/reference.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/include/gotopp/type/reference.h -------------------------------------------------------------------------------- /interpreteur/interne/divers.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/divers.cpp -------------------------------------------------------------------------------- /interpreteur/interne/hasard.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/hasard.cpp -------------------------------------------------------------------------------- /interpreteur/interne/maths.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/maths.cpp -------------------------------------------------------------------------------- /modules/hachetml/mkhachetml: -------------------------------------------------------------------------------- 1 | g++ -O -shared -o ../../lib/hachetml.so hachetml.cpp ../include/rienmodule.cpp 2 | -------------------------------------------------------------------------------- /src/compilateur/compilateur.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/compilateur/compilateur.cpp -------------------------------------------------------------------------------- /vs/BomberNIAC/BomberNIAC.vdproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/BomberNIAC/BomberNIAC.vdproj -------------------------------------------------------------------------------- /vs/InstGOTO++/InstGOTO++.vdproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/InstGOTO++/InstGOTO++.vdproj -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gotopp 2 | A compiler for GOTO++, the best language in the universe. 3 | 4 | See http://gotopp.org 5 | -------------------------------------------------------------------------------- /exemples/jeux/devineunnombre.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/jeux/devineunnombre.gpp -------------------------------------------------------------------------------- /exemples/simple/gotomultiple.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/simple/gotomultiple.gpp -------------------------------------------------------------------------------- /interpreteur/interne/chaines.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/chaines.cpp -------------------------------------------------------------------------------- /interpreteur/interne/console.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/console.cpp -------------------------------------------------------------------------------- /interpreteur/interne/systeme.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/systeme.cpp -------------------------------------------------------------------------------- /interpreteur/interne/tableaux.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/interpreteur/interne/tableaux.cpp -------------------------------------------------------------------------------- /src/compilateur/compilateur2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/src/compilateur/compilateur2.cpp -------------------------------------------------------------------------------- /vs/chaussettes/chaussettes.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/chaussettes/chaussettes.vcproj -------------------------------------------------------------------------------- /exemples/bomberniac/bomberclient.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/bomberniac/bomberclient.gpp -------------------------------------------------------------------------------- /modules/chaussettes/chaussettes.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/modules/chaussettes/chaussettes.cpp -------------------------------------------------------------------------------- /vs/ModuleInterp/ModuleInterp.vdproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/vs/ModuleInterp/ModuleInterp.vdproj -------------------------------------------------------------------------------- /exemples/bomberniac/bomberserveur.gpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidoine/gotopp/HEAD/exemples/bomberniac/bomberserveur.gpp -------------------------------------------------------------------------------- /modules/chaussettes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(chaussettes SHARED chaussettes.cpp) 2 | INSTALL_TARGETS(/lib/gpp/ RUNTIME_DIRECTORY /lib/gpp chaussettes chaussettes) -------------------------------------------------------------------------------- /test/gotopp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "integrationtest.h" 2 | 3 | void wmain() 4 | { 5 | GotoPPTest::IntegrationTest integrationTest; 6 | integrationTest.Run(); 7 | } -------------------------------------------------------------------------------- /modules/troisde/mktest: -------------------------------------------------------------------------------- 1 | g++ -I/home/vulcain/sidoine/include -L/usr/X11R6/lib -lGL -lGLU -lglut -g -shared -o ../../lib/troisde.so troisde.cpp ../include/rienmodule.cpp 2 | -------------------------------------------------------------------------------- /include/gotopp/config.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine HAVE_WPRINTF @HAVE_WPRINTF@ 2 | #define DLL_PREFIX "@CMAKE_SHARED_LIBRARY_PREFIX@" 3 | #define DLL_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@" 4 | 5 | -------------------------------------------------------------------------------- /src/commun/regmagic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The first byte of the regexp internal "program" is actually this magic 3 | * number; the start node begins in the second byte. 4 | */ 5 | #define MAGIC 0123 6 | -------------------------------------------------------------------------------- /include/gotopp/version.h: -------------------------------------------------------------------------------- 1 | #ifndef _VERSION_H 2 | #define _VERSION_H 3 | 4 | namespace GotoPP 5 | { 6 | const float Version=0.30f; 7 | const carac NomVersion[]=_T("Procrastination"); 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/type/type.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace GotoPP 5 | { 6 | bool CType::EstFonction() 7 | { 8 | return (l>=1 && t[l-1]==symboleFonctionGPP); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | AUX_SOURCE_DIRECTORY(commun COMMUN) 2 | AUX_SOURCE_DIRECTORY(compilateur COMPILATEUR) 3 | AUX_SOURCE_DIRECTORY(machine MACHINE) 4 | AUX_SOURCE_DIRECTORY(type TYPE) 5 | ADD_LIBRARY(gpp ${COMPILATEUR} ${COMMUN} ${MACHINE} ${TYPE}) 6 | 7 | -------------------------------------------------------------------------------- /boehmgc/include/leak_detector.h: -------------------------------------------------------------------------------- 1 | #define GC_DEBUG 2 | #include "gc.h" 3 | #define malloc(n) GC_MALLOC(n) 4 | #define calloc(m,n) GC_MALLOC((m)*(n)) 5 | #define free(p) GC_FREE(p) 6 | #define realloc(p,n) GC_REALLOC((p),(n)) 7 | #define CHECK_LEAKS() GC_gcollect() 8 | -------------------------------------------------------------------------------- /interpreteur/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | AUX_SOURCE_DIRECTORY(princ PRINC) 2 | AUX_SOURCE_DIRECTORY(interne INTERNE) 3 | LINK_DIRECTORIES(${GOTOPLUSPLUS_BINARY_DIR}/src}) 4 | ADD_EXECUTABLE(gotopp ${PRINC} ${INTERNE}) 5 | 6 | TARGET_LINK_LIBRARIES(gotopp ${GPP_LINK_LIBRARIES} ${CURL_LIBS} gpp boehmgc) 7 | INSTALL_TARGETS(/bin gotopp gotopp) 8 | -------------------------------------------------------------------------------- /boehmgc/src/gcname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "version.h" 3 | 4 | int main() 5 | { 6 | if (GC_ALPHA_VERSION == GC_NOT_ALPHA) { 7 | printf("gc%d.%d", GC_VERSION_MAJOR, GC_VERSION_MINOR); 8 | } else { 9 | printf("gc%d.%dalpha%d", GC_VERSION_MAJOR, 10 | GC_VERSION_MINOR, GC_ALPHA_VERSION); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /boehmgc/include/private/pthread_stop_world.h: -------------------------------------------------------------------------------- 1 | #ifndef GC_PTHREAD_STOP_WORLD_H 2 | #define GC_PTHREAD_STOP_WORLD_H 3 | 4 | struct thread_stop_info { 5 | word last_stop_count; /* GC_last_stop_count value when thread */ 6 | /* last successfully handled a suspend */ 7 | /* signal. */ 8 | ptr_t stack_ptr; /* Valid only when stopped. */ 9 | }; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /exemples/bomberniac/intro.baf: -------------------------------------------------------------------------------- 1 | 45 2 | \|/ 3 | .-*- 4 | / /|\ 5 | _L_ B O M B E R - N I A C 6 | ," ". 7 | (\ / O O \ /) G O T O + + 8 | \| _ |/ 9 | \ (_) / 10 | _/.___,\_ 11 | (_/ \_) 12 | -------------------------------------------------------------------------------- /src/compilateur/instrconstr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "instrconstr.h" 3 | #include 4 | 5 | void GotoPP::InstrConstr::Reinit() 6 | { 7 | if (c) 8 | free(c); 9 | c=NULL; 10 | t=a=0; 11 | i=NULL; 12 | } 13 | 14 | GotoPP::BoutCode * GotoPP::InstrConstr::CreerBoutCode() 15 | { 16 | BoutCode *ret=new BoutCode; 17 | ret->i=c; 18 | ret->depart=c; 19 | ret->fin=c+t; 20 | c=NULL; 21 | return ret; 22 | } 23 | -------------------------------------------------------------------------------- /boehmgc/src/add_gc_prefix.c: -------------------------------------------------------------------------------- 1 | # include 2 | # include "version.h" 3 | 4 | int main(argc, argv, envp) 5 | int argc; 6 | char ** argv; 7 | char ** envp; 8 | { 9 | int i; 10 | 11 | for (i = 1; i < argc; i++) { 12 | if (GC_ALPHA_VERSION == GC_NOT_ALPHA) { 13 | printf("gc%d.%d/%s ", GC_VERSION_MAJOR, GC_VERSION_MINOR, argv[i]); 14 | } else { 15 | printf("gc%d.%dalpha%d/%s ", GC_VERSION_MAJOR, 16 | GC_VERSION_MINOR, GC_ALPHA_VERSION, argv[i]); 17 | } 18 | } 19 | return(0); 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | Thumbs.db 30 | bin 31 | *.suo 32 | Debug 33 | *.vcxproj.user 34 | *.*sdf 35 | *.ncrunchsolution 36 | *.ncrunchsolution.user 37 | *.crunchsolution.cache 38 | *.ipch 39 | -------------------------------------------------------------------------------- /ressources/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by gpp.rc 4 | // 5 | #define IDI_ICON1 105 6 | #define IDI_ICON2 106 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 107 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /boehmgc/include/private/darwin_stop_world.h: -------------------------------------------------------------------------------- 1 | #ifndef GC_DARWIN_STOP_WORLD_H 2 | #define GC_DARWIN_STOP_WORLD_H 3 | 4 | #if !defined(GC_DARWIN_THREADS) 5 | #error darwin_stop_world.h included without GC_DARWIN_THREADS defined 6 | #endif 7 | 8 | #include 9 | #include 10 | 11 | struct thread_stop_info { 12 | mach_port_t mach_thread; 13 | }; 14 | 15 | struct GC_mach_thread { 16 | thread_act_t thread; 17 | int already_suspended; 18 | }; 19 | 20 | void GC_darwin_register_mach_handler_thread(mach_port_t thread); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /include/gotopp/erreur.h: -------------------------------------------------------------------------------- 1 | #ifndef _ERREUR_H 2 | #define _ERREUR_H 3 | 4 | namespace GotoPP 5 | { 6 | class CErreur 7 | { 8 | carac* texte; 9 | public: 10 | CErreur(carac *Format,...); 11 | ~CErreur(); 12 | carac *Texte() 13 | { 14 | if (texte) 15 | return &texte[1]; 16 | else 17 | return _T(""); 18 | } 19 | carac & Compteur() 20 | { 21 | return texte[0]; 22 | } 23 | CErreur(const CErreur& e) 24 | { 25 | texte=e.texte; 26 | Compteur()++; 27 | } 28 | void operator=(CErreur &e) 29 | { 30 | texte=e.texte; 31 | Compteur()++; 32 | } 33 | }; 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /exemples/bomberniac/plan.bnp: -------------------------------------------------------------------------------- 1 | plan 2 | ##################### 3 | #1 ............... 3# 4 | # #.#...#...#...#.# # 5 | #..#.#..##.##..#.#..# 6 | #...................# 7 | #.##.#..#...#..#.##.# 8 | #....##.#...#.##....# 9 | ######..#...#..###### 10 | #..#...##...##...#..# 11 | #...................# 12 | #.##.#.#.###.#.#.##.# 13 | #...................# 14 | #..#...##...##...#..# 15 | ######..#...#..###### 16 | #....##.#...#.##....# 17 | #.##.#..#...#..#.##.# 18 | #...................# 19 | #..#.#..##.##..#.#..# 20 | # #.#...#...#...#.# # 21 | #4 ............... 2# 22 | ##################### 23 | fin 24 | ndefbombes=2 25 | lflammesmin=3 26 | lflammesmax=15 27 | -------------------------------------------------------------------------------- /exemples/bomberniac/tennis.bnp: -------------------------------------------------------------------------------- 1 | plan 2 | ##################### 3 | #.........#.........# 4 | #.1 .#.#...#.#. 3.# 5 | #. .....#..... .# 6 | #.....#.#.#.#.#. .# 7 | #.........#.........# 8 | #.#.#.#.#.#.#.#.#.#.# 9 | #.........#.........# 10 | #.#.#.#.#.#.#.#.#.#.# 11 | #.........#.........# 12 | ##.###############.## 13 | #.........#.........# 14 | #.#.#.#.#.#.#.#.#.#.# 15 | #.........#.........# 16 | #.#.#.#.#.#.#.#.#.#.# 17 | #.........#.........# 18 | #. .#.#.#.#.#. .# 19 | #. .....#..... .# 20 | #.4 .#.#...#.#. 2.# 21 | #.........#.........# 22 | ##################### 23 | fin 24 | chancesbonus=1 2 2 5 0 10 25 | ratiomurs=20 26 | peutlancer=1 27 | -------------------------------------------------------------------------------- /src/commun/erreur.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | GotoPP::CErreur::CErreur(carac * Format,...) 9 | { 10 | va_list Args; 11 | va_start( Args, Format); 12 | #ifdef _WIN32 13 | size_t l=czvcprintf(Format,Args); 14 | texte=new carac[l+2]; 15 | czvprintf(Texte(),l+1,Format,Args); 16 | #else 17 | texte=new carac[128]; 18 | czvnprintf(Texte(),127,Format,Args); 19 | #endif 20 | va_end(Args); 21 | Compteur()=1; 22 | } 23 | 24 | 25 | 26 | GotoPP::CErreur::~CErreur() 27 | { 28 | if (texte) 29 | { 30 | ASSERT(Compteur()>0); 31 | Compteur()--; 32 | if (Compteur()==0) 33 | delete[] texte; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /exemples/bomberniac/ldv.bnp: -------------------------------------------------------------------------------- 1 | plan 2 | ################# 3 | #2 . . 4# 4 | # # # # 5 | # # # # 6 | #.##### ####.## 7 | # # # # 8 | # # # . # # 9 | # # . # # # 10 | # # #####.# 11 | ###.### . # 12 | # # # # 13 | # # ####.## 14 | ##.#### . # 15 | # ## # # # 16 | # # . ####### 17 | # # #. .# 18 | ####.## . ###.# 19 | # # . ....# 20 | # # #.....# 21 | # # ####### 22 | #.###.# # # 23 | # # . # 24 | ###.### ####### 25 | #.....# # # 26 | #.....# . # # 27 | ####### # # 28 | #. . .# ####### 29 | #1 # . 3# 30 | # . # # 31 | ################# 32 | fin 33 | chancesbonus=10 10 10 10 1 1 34 | ratiomurs=0 35 | -------------------------------------------------------------------------------- /boehmgc/include/javaxfc.h: -------------------------------------------------------------------------------- 1 | # ifndef GC_H 2 | # include "gc.h" 3 | # endif 4 | 5 | /* 6 | * Invoke all remaining finalizers that haven't yet been run. 7 | * This is needed for strict compliance with the Java standard, 8 | * which can make the runtime guarantee that all finalizers are run. 9 | * This is problematic for several reasons: 10 | * 1) It means that finalizers, and all methods calle by them, 11 | * must be prepared to deal with objects that have been finalized in 12 | * spite of the fact that they are still referenced by statically 13 | * allocated pointer variables. 14 | * 1) It may mean that we get stuck in an infinite loop running 15 | * finalizers which create new finalizable objects, though that's 16 | * probably unlikely. 17 | * Thus this is not recommended for general use. 18 | */ 19 | void GC_finalize_all(); 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/gotopp/integrationtest.h: -------------------------------------------------------------------------------- 1 | #ifndef GOTOPPTEST_INTEGRATIONTEST_H 2 | #define GOTOPPTEST_INTEGRATIONTEST_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace GotoPPTest 10 | { 11 | class IntegrationTest 12 | { 13 | public: 14 | void Addition() 15 | { 16 | GotoPP::Init(); 17 | GotoPP::Programme * program = new GotoPP::Programme(); 18 | std::unique_ptr code(program->compilateur->Compiler(L"}*(1) + *(1){ @+")); 19 | 20 | GotoPP::CInterpreteur * interpreteur = new GotoPP::CInterpreteur(program); 21 | interpreteur->Executer(code->depart); 22 | GotoPP::valeur val; 23 | interpreteur->Depiler2(val); 24 | assert(val.Entier() == 2); 25 | } 26 | 27 | void Run() 28 | { 29 | Addition(); 30 | } 31 | }; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /boehmgc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SRCCOMMON src/allchblk.c src/alloc.c src/blacklst.c src/dbg_mlc.c src/dyn_load.c src/finalize.c 2 | src/gc_cpp.cpp src/headers.c src/mach_dep.c src/malloc.c src/mallocx.c src/mark.c src/mark_rts.c 3 | src/misc.c src/new_hblk.c src/obj_map.c src/os_dep.c src/ptr_chck.c src/reclaim.c 4 | src/stubborn.c src/typd_mlc.c) 5 | 6 | IF(WIN32) 7 | 8 | SET(SRC ${SRCCOMMON} src/win32_threads.c) 9 | ADD_DEFINITIONS(-DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL 10 | -DGC_WIN32_THREADS -D__STDC__ -DGC_OPERATOR_NEW_ARRAY) 11 | ELSE(WIN32) 12 | 13 | IF(HAVE_LIBPTHREAD) 14 | SET(SRC ${SRCCOMMON} src/pthread_support.c src/pthread_stop_world.c) 15 | ADD_DEFINITIONS(-DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL 16 | -DGC_LINUX_THREADS -D_REENTRANT -DGC_OPERATOR_NEW_ARRAY) 17 | ENDIF(HAVE_LIBPTHREAD) 18 | 19 | ENDIF(WIN32) 20 | 21 | 22 | ADD_LIBRARY(boehmgc ${SRC}) -------------------------------------------------------------------------------- /boehmgc/src/if_mach.c: -------------------------------------------------------------------------------- 1 | /* Conditionally execute a command based on machine and OS from gcconfig.h */ 2 | 3 | # include "private/gcconfig.h" 4 | # include 5 | # include 6 | # include 7 | 8 | int main(argc, argv, envp) 9 | int argc; 10 | char ** argv; 11 | char ** envp; 12 | { 13 | if (argc < 4) goto Usage; 14 | if (strcmp(MACH_TYPE, argv[1]) != 0) return(0); 15 | if (strcmp(OS_TYPE, "") != 0 && strcmp(argv[2], "") != 0 16 | && strcmp(OS_TYPE, argv[2]) != 0) return(0); 17 | fprintf(stderr, "^^^^Starting command^^^^\n"); 18 | fflush(stdout); 19 | execvp(argv[3], argv+3); 20 | perror("Couldn't execute"); 21 | 22 | Usage: 23 | fprintf(stderr, "Usage: %s mach_type os_type command\n", argv[0]); 24 | fprintf(stderr, "Currently mach_type = %s, os_type = %s\n", 25 | MACH_TYPE, OS_TYPE); 26 | return(1); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /modules/tortue/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FIND_LIBRARY(X11_LIB_PATH NAMES X11 X11.dll PATHS /usr/X11R6/lib 2 | /usr/local/lib 3 | /usr/openwin/lib 4 | /usr/lib) 5 | FIND_PATH(X11_INCLUDE_PATH X11/Xlib.h /usr/X11R6/include 6 | /usr/local/include 7 | /usr/include/X11 8 | /usr/openwin/include 9 | /usr/openwin/share/include 10 | /opt/graphics/OpenGL/include 11 | /usr/include 12 | ) 13 | 14 | IF(X11_LIB_PATH) 15 | IF(X11_INCLUDE_PATH) 16 | MESSAGE(STATUS "X11 found\n") 17 | SET(X11_FOUND 1) 18 | ENDIF(X11_INCLUDE_PATH) 19 | ENDIF(X11_LIB_PATH) 20 | 21 | IF (X11_FOUND) 22 | ADD_LIBRARY(tortue SHARED tortue.cpp) 23 | TARGET_LINK_LIBRARIES(tortue ${X11_LIB_PATH}) 24 | INCLUDE_DIRECTORIES(${X11_INCLUDE_PATH}) 25 | INSTALL_TARGETS(/lib/gpp/ RUNTIME_DIRECTORY /lib/gpp tortue tortue) 26 | ELSE(X11_FOUND) 27 | IF(WIN32) 28 | ADD_LIBRARY(tortue SHARED tortue.cpp) 29 | INSTALL_TARGETS(/lib/gpp/ RUNTIME_DIRECTORY /lib/gpp tortue tortue) 30 | ENDIF(WIN32) 31 | ENDIF(X11_FOUND) -------------------------------------------------------------------------------- /vs/BoehmGC/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : BoehmGC Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this BoehmGC library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | BoehmGC.vcproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | Other notes: 18 | 19 | AppWizard uses "TODO:" comments to indicate parts of the source code you 20 | should add to or customize. 21 | 22 | ///////////////////////////////////////////////////////////////////////////// 23 | -------------------------------------------------------------------------------- /vs/troisde/troisde.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1dfdc847-f07a-4fde-9302-5b9f35986d24} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {69dcd0e6-5909-4d72-8144-fc5e026ff070} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {617ab866-cd31-4175-9d61-b98636c0ac8b} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /vs/hachetml/hachetml.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {43e50f4d-4ed7-4dca-be17-e52f4f5a231b} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {34580c97-dc63-4cdd-9079-945ba7fc06ad} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {f0a73291-754d-4ae7-bf67-1a8a3f3ab2d4} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /boehmgc/src/if_not_there.c: -------------------------------------------------------------------------------- 1 | /* Conditionally execute a command based if the file argv[1] doesn't exist */ 2 | /* Except for execvp, we stick to ANSI C. */ 3 | # include "private/gcconfig.h" 4 | # include 5 | # include 6 | # include 7 | #ifdef __DJGPP__ 8 | #include 9 | #endif /* __DJGPP__ */ 10 | 11 | int main(argc, argv, envp) 12 | int argc; 13 | char ** argv; 14 | char ** envp; 15 | { 16 | FILE * f; 17 | #ifdef __DJGPP__ 18 | DIR * d; 19 | #endif /* __DJGPP__ */ 20 | if (argc < 3) goto Usage; 21 | if ((f = fopen(argv[1], "rb")) != 0 22 | || (f = fopen(argv[1], "r")) != 0) { 23 | fclose(f); 24 | return(0); 25 | } 26 | #ifdef __DJGPP__ 27 | if ((d = opendir(argv[1])) != 0) { 28 | closedir(d); 29 | return(0); 30 | } 31 | #endif 32 | printf("^^^^Starting command^^^^\n"); 33 | fflush(stdout); 34 | execvp(argv[2], argv+2); 35 | exit(1); 36 | 37 | Usage: 38 | fprintf(stderr, "Usage: %s file_name command\n", argv[0]); 39 | return(1); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /LISEZMOI.md: -------------------------------------------------------------------------------- 1 | # Les sources du GOTO++ 2 | 3 | Voilà, vous avez téléchargé les sources de cette petite merveille. 4 | 5 | # Installation 6 | 7 | Pour le compiler, utiliser [CMake](https://cmake.org/).
8 | Sous Unix, créez un dossier quelconque, genre `plop`, puis `cd plop`, `cmake` .., `make` et `make install`. 9 | 10 | # Licence 11 | 12 | Hum, ce programme est distribué sous la GPL (voir le fichier LICENCE.txt pour en avoir un exemplaire en anglais). L'auteur c'est moi, Sidoine de Wispelaere.
13 | En gros, vous n'avez pas le droit de distribuer le GOTO++ avec une application qui n'est pas en source libre. Si vous y tenez, il faut me contacter pour avoir l'autorisation. 14 | 15 | # Divers 16 | 17 | Vous pouvez m'écrire à [gotopp@sidoine.net](mailto:gotopp@sidoine.net).
18 | Aux dernières nouvelles, le site officiel se trouve à l'adresse http://gotopp.org 19 | 20 | # Auteurs 21 | 22 | L'auteur est Sidoine de Wispelaere.
23 | Ont contribué aux spécifications du GOTO++ : Alexandre Béraud, Tout et Jésus NIAC.
24 | Ont eu l'aimabilité de me faire part de bugs : S L. -------------------------------------------------------------------------------- /vs/tortue/tortue.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {0bee0473-e677-4e74-b2ef-5a3689423724} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {7bf66954-1a0a-4e1c-bb11-2c4cc8be2cdc} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {04f0a4dc-020d-4a90-8214-83ff224a9f45} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Fichiers sources 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /boehmgc/src/version.h: -------------------------------------------------------------------------------- 1 | /* The version here should match that in configure/configure.in */ 2 | /* Eventually this one may become unnecessary. For now we need */ 3 | /* it to keep the old-style build process working. */ 4 | #define GC_TMP_VERSION_MAJOR 6 5 | #define GC_TMP_VERSION_MINOR 6 6 | #define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA 7 | 8 | #ifndef GC_NOT_ALPHA 9 | # define GC_NOT_ALPHA 0xff 10 | #endif 11 | 12 | #if defined(GC_VERSION_MAJOR) 13 | # if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR || \ 14 | GC_TMP_VERSION_MINOR != GC_VERSION_MINOR || \ 15 | defined(GC_ALPHA_VERSION) != (GC_TMP_ALPHA_VERSION != GC_NOT_ALPHA) || \ 16 | defined(GC_ALPHA_VERSION) && GC_TMP_ALPHA_VERSION != GC_ALPHA_VERSION 17 | # error Inconsistent version info. Check README, version.h, and configure.in. 18 | # endif 19 | #else 20 | # define GC_VERSION_MAJOR GC_TMP_VERSION_MAJOR 21 | # define GC_VERSION_MINOR GC_TMP_VERSION_MINOR 22 | # define GC_ALPHA_VERSION GC_TMP_ALPHA_VERSION 23 | #endif 24 | 25 | 26 | #ifndef GC_NO_VERSION_VAR 27 | 28 | unsigned GC_version = ((GC_VERSION_MAJOR << 16) | (GC_VERSION_MINOR << 8) | GC_TMP_ALPHA_VERSION); 29 | 30 | #endif /* GC_NO_VERSION_VAR */ 31 | -------------------------------------------------------------------------------- /boehmgc/src/real_malloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers 3 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. 4 | * 5 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 6 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 7 | * 8 | * Permission is hereby granted to use or copy this program 9 | * for any purpose, provided the above notices are retained on all copies. 10 | * Permission to modify the code and to distribute modified code is granted, 11 | * provided the above notices are retained, and a notice that the code was 12 | * modified is included with the above copyright notice. 13 | */ 14 | /* Boehm, May 19, 1994 2:04 pm PDT */ 15 | 16 | 17 | # ifdef PCR 18 | /* 19 | * This definition should go in its own file that includes no other 20 | * header files. Otherwise, we risk not getting the underlying system 21 | * malloc. 22 | */ 23 | # define PCR_NO_RENAME 24 | # include 25 | 26 | # ifdef __STDC__ 27 | char * real_malloc(size_t size) 28 | # else 29 | char * real_malloc() 30 | int size; 31 | # endif 32 | { 33 | return((char *)malloc(size)); 34 | } 35 | #endif /* PCR */ 36 | 37 | -------------------------------------------------------------------------------- /vs/GotoPP.Test/GotoPP.Test.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | -------------------------------------------------------------------------------- /vs/chaussettes/chaussettes.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {fdca15af-08e7-4656-9ff4-e006c22e7413} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {f695f2bd-ce97-40f0-8981-bdeb0e4ec94f} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {4a53c0ba-756d-45f1-beb3-048963295172} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Fichiers sources 20 | 21 | 22 | 23 | 24 | Fichiers d%27en-tête 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /boehmgc/include/gc_amiga_redirects.h: -------------------------------------------------------------------------------- 1 | #ifndef GC_AMIGA_REDIRECTS_H 2 | 3 | # define GC_AMIGA_REDIRECTS_H 4 | 5 | # if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) ) 6 | extern void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes); 7 | # define GC_realloc(a,b) GC_amiga_realloc(a,b) 8 | extern void GC_amiga_set_toany(void (*func)(void)); 9 | extern int GC_amiga_free_space_divisor_inc; 10 | extern void *(*GC_amiga_allocwrapper_do) \ 11 | (size_t size,void *(*AllocFunction)(size_t size2)); 12 | # define GC_malloc(a) \ 13 | (*GC_amiga_allocwrapper_do)(a,GC_malloc) 14 | # define GC_malloc_atomic(a) \ 15 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic) 16 | # define GC_malloc_uncollectable(a) \ 17 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_uncollectable) 18 | # define GC_malloc_stubborn(a) \ 19 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_stubborn) 20 | # define GC_malloc_atomic_uncollectable(a) \ 21 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_uncollectable) 22 | # define GC_malloc_ignore_off_page(a) \ 23 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_ignore_off_page) 24 | # define GC_malloc_atomic_ignore_off_page(a) \ 25 | (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_ignore_off_page) 26 | # endif /* _AMIGA && !GC_AMIGA_MAKINGLIB */ 27 | 28 | #endif /* GC_AMIGA_REDIRECTS_H */ 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/commun/mutex.cpp: -------------------------------------------------------------------------------- 1 | #ifdef _WIN32 2 | #include 3 | #else 4 | #include 5 | #endif 6 | #include 7 | 8 | using namespace GotoPP; 9 | 10 | Mutex::Mutex() 11 | { 12 | #ifdef _WIN32 13 | *(HANDLE*)_data=CreateMutex(NULL,FALSE,NULL); 14 | #else 15 | pthread_mutex_init((pthread_mutex_t*)_data,NULL); 16 | #endif 17 | } 18 | 19 | Mutex::~Mutex() 20 | { 21 | #ifdef _WIN32 22 | CloseHandle(*(HANDLE*)_data); 23 | #else 24 | pthread_mutex_destroy((pthread_mutex_t*)_data); 25 | #endif 26 | } 27 | 28 | void Mutex::Liberer() 29 | { 30 | #ifdef _WIN32 31 | ReleaseMutex(*(HANDLE*)_data); 32 | #else 33 | pthread_mutex_unlock((pthread_mutex_t*)_data); 34 | #endif 35 | } 36 | 37 | void Mutex::Prendre() 38 | { 39 | #ifdef _WIN32 40 | WaitForSingleObject(*(HANDLE*)_data,INFINITE); 41 | #else 42 | pthread_mutex_lock((pthread_mutex_t*)_data); 43 | #endif 44 | } 45 | 46 | /* 47 | typedef void* MUTEX; 48 | #define PRENDREMUTEX WaitForSingleObject(Mutex,INFINITE) 49 | #define LIBERERMUTEX ReleaseMutex(Mutex) 50 | #define PRENDREINTMUTEX WaitForSingleObject(Int->Mutex,INFINITE) 51 | #define LIBERERINTMUTEX ReleaseMutex(Int->Mutex) 52 | 53 | typedef pthread_mutex_t MUTEX; 54 | #define PRENDREMUTEX pthread_mutex_lock(&Mutex) 55 | #define LIBERERMUTEX pthread_mutex_unlock(&Mutex) 56 | #define PRENDREINTMUTEX pthread_mutex_lock(&Int->Mutex) 57 | #define LIBERERINTMUTEX pthread_mutex_unlock(&Int->Mutex) 58 | #endif*/ 59 | -------------------------------------------------------------------------------- /src/commun/wlib.cpp: -------------------------------------------------------------------------------- 1 | #ifdef _UNICODE 2 | #ifndef _WIN32 3 | #include 4 | 5 | char * allocmbs(const wchar_t * str, size_t len) 6 | { 7 | const wchar_t *pstr=str; 8 | size_t l=wcsrtombs(0,&pstr,len,0); 9 | char * ret=new char[l+1]; 10 | pstr=str; 11 | wcsrtombs(ret,&pstr,len,0); 12 | ret[l]=0; 13 | return ret; 14 | } 15 | 16 | wchar_t * allocws(const char * str, size_t len) 17 | { 18 | const char *pstr=str; 19 | size_t l=mbsrtowcs(0,&pstr,len,0); 20 | wchar_t * ret=new wchar_t[l+1]; 21 | pstr=str; 22 | mbsrtowcs(ret,&pstr,len,0); 23 | ret[l]=0; 24 | return ret; 25 | } 26 | 27 | FILE * _wfopen(const wchar_t * file, const wchar_t * mode) 28 | { 29 | char * _file=allocmbs(file,wcslen(file)); 30 | char * _mode=allocmbs(mode,wcslen(mode)); 31 | FILE * ret=fopen(_file,_mode); 32 | delete[]_file; 33 | delete[]_mode; 34 | return ret; 35 | } 36 | 37 | FILE * _wpopen(const wchar_t * file, const wchar_t * mode) 38 | { 39 | char * _file=allocmbs(file,wcslen(file)); 40 | char * _mode=allocmbs(mode,wcslen(mode)); 41 | FILE * ret=popen(_file,_mode); 42 | delete[]_file; 43 | delete[]_mode; 44 | return ret; 45 | } 46 | 47 | int main(int argc, char **argv) 48 | { 49 | typedef wchar_t* pwchar_t; 50 | wchar_t** _argv=new pwchar_t[argc]; 51 | for (int a=0; a 4 | 5 | int main() 6 | { 7 | # if defined(GC_USE_LD_WRAP) 8 | printf("-Wl,--wrap -Wl,dlopen " 9 | "-Wl,--wrap -Wl,pthread_create -Wl,--wrap -Wl,pthread_join " 10 | "-Wl,--wrap -Wl,pthread_detach " 11 | "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n"); 12 | # endif 13 | # if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \ 14 | || defined(GC_SOLARIS_PTHREADS) \ 15 | || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) 16 | printf("-lpthread\n"); 17 | # endif 18 | # if defined(GC_FREEBSD_THREADS) 19 | # if (__FREEBSD_version >= 500000) 20 | printf("-lpthread\n"); 21 | # else 22 | printf("-pthread\n"); 23 | # endif 24 | # endif 25 | # if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) 26 | printf("-lpthread -lrt\n"); 27 | # endif 28 | # if defined(GC_SOLARIS_THREADS) && !defined(GC_SOLARIS_PTHREADS) 29 | printf("-lthread -ldl\n"); 30 | # endif 31 | # if defined(GC_WIN32_THREADS) && defined(CYGWIN32) 32 | printf("-lpthread\n"); 33 | # endif 34 | # if defined(GC_OSF1_THREADS) 35 | printf("-pthread -lrt"); /* DOB: must be -pthread, not -lpthread */ 36 | # endif 37 | /* You need GCC 3.0.3 to build this one! */ 38 | /* DG/UX native gcc doesnt know what "-pthread" is */ 39 | # if defined(GC_DGUX386_THREADS) 40 | printf("-ldl -pthread\n"); 41 | # endif 42 | return 0; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/commun/sauveur.h: -------------------------------------------------------------------------------- 1 | #ifndef _SAUVEUR_H 2 | #define _SAUVEUR_H 3 | 4 | namespace GotoPP 5 | { 6 | class regexp; 7 | } 8 | 9 | namespace GotoPP 10 | { 11 | struct bebe; 12 | class SPointeur 13 | { 14 | public: 15 | type Type; 16 | union 17 | { 18 | chaineval * c; 19 | tableauval * t; 20 | hachageval * h; 21 | GotoPP::regexp * er; 22 | valeur * b; 23 | void * p; 24 | }; 25 | union 26 | { 27 | chaineval * c; 28 | tableauval * t; 29 | hachageval * h; 30 | GotoPP::regexp * er; 31 | valeur * b; 32 | void * p; 33 | } ici; 34 | SPointeur() 35 | { 36 | ici.b=0; 37 | Type=0; 38 | } 39 | void Sauver(FILE *F); 40 | void Charger(FILE *F); 41 | }; 42 | 43 | class CPointeur:public Tableau 44 | { 45 | public: 46 | bool Nouveau(void * Pointeur, type Type) 47 | { 48 | for (index_t p=0; pp==Pointeur) 51 | return false; 52 | } 53 | Etendre(new SPointeur()); 54 | Dernier()->Type=Type; 55 | Dernier()->p=Pointeur; 56 | return true; 57 | } 58 | bool Nouveau(void * &Pointeur, type Type, size_t Taille) 59 | { 60 | for (index_t p=0; pp==Pointeur) 63 | { 64 | Pointeur=t[p]->ici.p; 65 | return false; 66 | } 67 | } 68 | Etendre(new SPointeur()); 69 | Dernier()->Type=Type; 70 | Dernier()->p=Pointeur; 71 | Dernier()->ici.p=Pointeur=malloc(Taille); 72 | return true; 73 | } 74 | }; 75 | GPP_GLOBAL CPointeur Pointeur; 76 | void InitSauveur(); 77 | } 78 | #endif 79 | -------------------------------------------------------------------------------- /doc/style.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | font-size : 10pt; 4 | font-family : "Tahoma",sans-serif; 5 | color : #000000; 6 | margin:1cm; 7 | } 8 | td 9 | { 10 | font-size : 10pt; 11 | font-family : "Tahoma",sans-serif; 12 | color : #000000; 13 | background-color : #E0E0E0; 14 | border-width:2pt; 15 | } 16 | 17 | tr 18 | { 19 | font-size : 10pt; 20 | font-family : "Tahoma",sans-serif; 21 | color : #000000; 22 | border-width:2pt; 23 | } 24 | 25 | p 26 | { 27 | margin-left : 1cm; 28 | text-align :justify; 29 | } 30 | h1 31 | { 32 | font-size : 16pt; 33 | } 34 | h2 35 | { 36 | font-size : 14pt; 37 | } 38 | h3 39 | { 40 | font-size : 12pt; 41 | } 42 | h4 43 | { 44 | font-size : 10pt; 45 | font-weight : bold; 46 | } 47 | pre.syntaxe 48 | { 49 | background : #D0D0D0; 50 | font-size : 9pt; 51 | font-weight : bold; 52 | border : 0.2cm solid #D0D0D0; 53 | } 54 | pre.exemple 55 | { 56 | } 57 | dt 58 | { 59 | font-style:italic; 60 | } 61 | .chaine 62 | { 63 | color : #008000; 64 | } 65 | .nombre 66 | { 67 | color:Blue; 68 | } 69 | .carac 70 | { 71 | color:Red; 72 | } 73 | .etiquette 74 | { 75 | color:Maroon; 76 | } 77 | .syntaxe 78 | { 79 | font-weight:bold; 80 | } 81 | body.menu 82 | { 83 | margin:0pt; 84 | } 85 | ul 86 | { 87 | margin-left:15pt; 88 | padding-left:0pt; 89 | } 90 | .fonction 91 | { 92 | font-weight : bold; 93 | color : #FF0000; 94 | } 95 | .commentaire 96 | { 97 | color : #808000; 98 | font-style :italic; 99 | } 100 | a 101 | { 102 | text-decoration:none; 103 | } 104 | a:visited 105 | { 106 | color : brown; 107 | } -------------------------------------------------------------------------------- /boehmgc/include/private/solaris_threads.h: -------------------------------------------------------------------------------- 1 | #ifdef GC_SOLARIS_THREADS 2 | 3 | /* The set of all known threads. We intercept thread creation and */ 4 | /* joins. We never actually create detached threads. We allocate all */ 5 | /* new thread stacks ourselves. These allow us to maintain this */ 6 | /* data structure. */ 7 | /* Protected by GC_thr_lock. */ 8 | /* Some of this should be declared volatile, but that's incosnsistent */ 9 | /* with some library routine declarations. In particular, the */ 10 | /* definition of cond_t doesn't mention volatile! */ 11 | typedef struct GC_Thread_Rep { 12 | struct GC_Thread_Rep * next; 13 | thread_t id; 14 | word flags; 15 | # define FINISHED 1 /* Thread has exited. */ 16 | # define DETACHED 2 /* Thread is intended to be detached. */ 17 | # define CLIENT_OWNS_STACK 4 18 | /* Stack was supplied by client. */ 19 | # define SUSPNDED 8 /* Currently suspended. */ 20 | /* SUSPENDED is used insystem header. */ 21 | ptr_t stack; 22 | size_t stack_size; 23 | cond_t join_cv; 24 | void * status; 25 | } * GC_thread; 26 | extern GC_thread GC_new_thread(thread_t id); 27 | 28 | extern GC_bool GC_thr_initialized; 29 | extern volatile GC_thread GC_threads[]; 30 | extern size_t GC_min_stack_sz; 31 | extern size_t GC_page_sz; 32 | extern void GC_thr_init(void); 33 | extern ptr_t GC_stack_alloc(size_t * stack_size); 34 | extern void GC_stack_free(ptr_t stack, size_t size); 35 | 36 | # endif /* GC_SOLARIS_THREADS */ 37 | 38 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 1.4) 2 | PROJECT(GOTOPLUSPLUS) 3 | 4 | OPTION(USE_UNICODE "Use UNICODE" ON) 5 | 6 | INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) 7 | INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) 8 | 9 | CHECK_SYMBOL_EXISTS(wprintf wchar.h HAVE_WPRINTF) 10 | CHECK_SYMBOL_EXISTS(dlopen dlfcn.h HAVE_DLOPEN) 11 | 12 | ADD_DEFINITIONS(-finput-charset=ISO-8859-1) 13 | 14 | IF(HAVE_WPRINTF AND USE_UNICODE) 15 | ADD_DEFINITIONS(-D_UNICODE) 16 | ENDIF(HAVE_WPRINTF AND USE_UNICODE) 17 | 18 | SET(CURL_LIBS "") 19 | 20 | MACRO(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) 21 | CHECK_LIBRARY_EXISTS("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "" 22 | ${VARIABLE}) 23 | IF(${VARIABLE}) 24 | SET(CURL_LIBS ${CURL_LIBS} ${LIBRARY}) 25 | ENDIF(${VARIABLE}) 26 | ENDMACRO(CHECK_LIBRARY_EXISTS_CONCAT) 27 | 28 | CHECK_LIBRARY_EXISTS_CONCAT(dl dlopen HAVE_LIBDL) 29 | CHECK_LIBRARY_EXISTS_CONCAT(ncurses printw HAVE_LIBNCURSES) 30 | CHECK_LIBRARY_EXISTS_CONCAT(pthread pthread_create HAVE_LIBPTHREAD) 31 | 32 | CONFIGURE_FILE(${GOTOPLUSPLUS_SOURCE_DIR}/include/gotopp/config.h.in 33 | ${GOTOPLUSPLUS_BINARY_DIR}/config.h) 34 | INCLUDE_DIRECTORIES(${GOTOPLUSPLUS_BINARY_DIR}) 35 | 36 | IF(CMAKE_CXX_COMPILER MATCHES cl) 37 | IF(NOT CMAKE_CXX_COMPILER MATCHES clang) 38 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t") 39 | ENDIF(NOT CMAKE_CXX_COMPILER MATCHES clang) 40 | ENDIF(CMAKE_CXX_COMPILER MATCHES cl) 41 | 42 | INCLUDE_DIRECTORIES(${GOTOPLUSPLUS_SOURCE_DIR}/boehmgc/include) 43 | INCLUDE_DIRECTORIES(${GOTOPLUSPLUS_SOURCE_DIR}/include) 44 | 45 | IF(UNIX) 46 | INSTALL_FILES(/man/man1/ ${GOTOPLUSPLUS_SOURCE_DIR}/doc/gpp.1 "") 47 | ENDIF(UNIX) 48 | 49 | SUBDIRS(boehmgc src interpreteur modules) -------------------------------------------------------------------------------- /src/commun/symbole.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace GotoPP 6 | { 7 | Symbole::Symbole(const carac * _nom, size_t lNom, Symbole * _parent, Type _type):parent(_parent),type(_type), 8 | attributs(0) 9 | { 10 | if (lNom>TMAXIDENTIFIEUR) 11 | lNom=TMAXIDENTIFIEUR; 12 | memcpy(nom,_nom,lNom*sizeof(carac)); 13 | nom[lNom]=0; 14 | if (parent) 15 | { 16 | programme=parent->programme; 17 | suivant=parent->fils; 18 | parent->fils=this; 19 | } 20 | else 21 | { 22 | programme=0; 23 | suivant=0; 24 | } 25 | fils=0; 26 | if (EstClasse()) 27 | attributs=Symbole::filsthis; 28 | if (programme) 29 | programme->symbole.Etendre(this); 30 | } 31 | 32 | ISymbole * Symbole::NouvelleMethodeC(voidf Fonc, const carac * nom) 33 | { 34 | CType T(symboleValeur); 35 | T.Empiler(symboleDebutParams); 36 | T.Empiler(symboleValeur); 37 | T.Empiler(symboleEtc); 38 | T.Empiler(symboleMethodeC); 39 | 40 | Symbole * symb=new Symbole(nom,this,Symbole::MethodeC); 41 | symb->typeDepart=symb->TypeAc=T; 42 | symb->attributs|=Symbole::constante; 43 | symb->Valeur.Type=TYPE_FONCTIONC_THIS; 44 | symb->Valeur.v.fonctionC=Fonc; 45 | return symb; 46 | } 47 | 48 | ISymbole * Symbole::NouvelleFonctionC(voidf fonc, const carac * nom) 49 | { 50 | CType T(symboleValeur); 51 | T.Empiler(symboleDebutParams); 52 | T.Empiler(symboleValeur); 53 | T.Empiler(symboleEtc); 54 | T.Empiler(symboleFonctionC); 55 | 56 | Symbole * symb=new Symbole(nom,this,Symbole::FonctionC); 57 | symb->typeDepart=symb->TypeAc=T; 58 | symb->attributs|=Symbole::constante; 59 | symb->Valeur.v.fonctionC=fonc; 60 | symb->Valeur.Type=TYPE_FONCTIONC; 61 | return symb; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vs/Aide/Aide.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {c696ef89-559f-4c1e-a631-1bb84662e80c} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {8b1bbfc6-be67-45cd-bd51-04112a5d73e1} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {fa7edfc8-9f4e-463d-a749-64d24ebd0aa0} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /boehmgc/include/private/darwin_semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef GC_DARWIN_SEMAPHORE_H 2 | #define GC_DARWIN_SEMAPHORE_H 3 | 4 | #if !defined(GC_DARWIN_THREADS) 5 | #error darwin_semaphore.h included with GC_DARWIN_THREADS not defined 6 | #endif 7 | 8 | /* 9 | This is a very simple semaphore implementation for darwin. It 10 | is implemented in terms of pthreads calls so it isn't async signal 11 | safe. This isn't a problem because signals aren't used to 12 | suspend threads on darwin. 13 | */ 14 | 15 | typedef struct { 16 | pthread_mutex_t mutex; 17 | pthread_cond_t cond; 18 | int value; 19 | } sem_t; 20 | 21 | static int sem_init(sem_t *sem, int pshared, int value) { 22 | int ret; 23 | if(pshared) 24 | GC_abort("sem_init with pshared set"); 25 | sem->value = value; 26 | 27 | ret = pthread_mutex_init(&sem->mutex,NULL); 28 | if(ret < 0) return -1; 29 | ret = pthread_cond_init(&sem->cond,NULL); 30 | if(ret < 0) return -1; 31 | return 0; 32 | } 33 | 34 | static int sem_post(sem_t *sem) { 35 | if(pthread_mutex_lock(&sem->mutex) < 0) 36 | return -1; 37 | sem->value++; 38 | if(pthread_cond_signal(&sem->cond) < 0) { 39 | pthread_mutex_unlock(&sem->mutex); 40 | return -1; 41 | } 42 | if(pthread_mutex_unlock(&sem->mutex) < 0) 43 | return -1; 44 | return 0; 45 | } 46 | 47 | static int sem_wait(sem_t *sem) { 48 | if(pthread_mutex_lock(&sem->mutex) < 0) 49 | return -1; 50 | while(sem->value == 0) { 51 | pthread_cond_wait(&sem->cond,&sem->mutex); 52 | } 53 | sem->value--; 54 | if(pthread_mutex_unlock(&sem->mutex) < 0) 55 | return -1; 56 | return 0; 57 | } 58 | 59 | static int sem_destroy(sem_t *sem) { 60 | int ret; 61 | ret = pthread_cond_destroy(&sem->cond); 62 | if(ret < 0) return -1; 63 | ret = pthread_mutex_destroy(&sem->mutex); 64 | if(ret < 0) return -1; 65 | return 0; 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /boehmgc/src/gc_cpp.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | Copyright (c) 1994 by Xerox Corporation. All rights reserved. 3 | 4 | THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | 7 | Last modified on Sat Nov 19 19:31:14 PST 1994 by ellis 8 | on Sat Jun 8 15:10:00 PST 1994 by boehm 9 | 10 | Permission is hereby granted to copy this code for any purpose, 11 | provided the above notices are retained on all copies. 12 | 13 | This implementation module for gc_c++.h provides an implementation of 14 | the global operators "new" and "delete" that calls the Boehm 15 | allocator. All objects allocated by this implementation will be 16 | non-collectable but part of the root set of the collector. 17 | 18 | You should ensure (using implementation-dependent techniques) that the 19 | linker finds this module before the library that defines the default 20 | built-in "new" and "delete". 21 | 22 | Authors: John R. Ellis and Jesse Hull 23 | 24 | **************************************************************************/ 25 | /* Boehm, December 20, 1994 7:26 pm PST */ 26 | 27 | #include "gc_cpp.h" 28 | 29 | void* operator new( size_t size ) { 30 | return GC_MALLOC_UNCOLLECTABLE( size );} 31 | 32 | void operator delete( void* obj ) { 33 | GC_FREE( obj );} 34 | 35 | #ifdef GC_OPERATOR_NEW_ARRAY 36 | 37 | void* operator new[]( size_t size ) { 38 | return GC_MALLOC_UNCOLLECTABLE( size );} 39 | 40 | void operator delete[]( void* obj ) { 41 | GC_FREE( obj );} 42 | 43 | #endif /* GC_OPERATOR_NEW_ARRAY */ 44 | 45 | #ifdef _MSC_VER 46 | 47 | // This new operator is used by VC++ in case of Debug builds ! 48 | void* operator new( size_t size, 49 | int ,//nBlockUse, 50 | const char * szFileName, 51 | int nLine ) 52 | { 53 | #ifndef GC_DEBUG 54 | return GC_malloc_uncollectable( size ); 55 | #else 56 | return GC_debug_malloc_uncollectable(size, szFileName, nLine); 57 | #endif 58 | } 59 | 60 | #endif /* _MSC_VER */ 61 | 62 | -------------------------------------------------------------------------------- /boehmgc/include/ec.h: -------------------------------------------------------------------------------- 1 | # ifndef EC_H 2 | # define EC_H 3 | 4 | # ifndef CORD_H 5 | # include "cord.h" 6 | # endif 7 | 8 | /* Extensible cords are strings that may be destructively appended to. */ 9 | /* They allow fast construction of cords from characters that are */ 10 | /* being read from a stream. */ 11 | /* 12 | * A client might look like: 13 | * 14 | * { 15 | * CORD_ec x; 16 | * CORD result; 17 | * char c; 18 | * FILE *f; 19 | * 20 | * ... 21 | * CORD_ec_init(x); 22 | * while(...) { 23 | * c = getc(f); 24 | * ... 25 | * CORD_ec_append(x, c); 26 | * } 27 | * result = CORD_balance(CORD_ec_to_cord(x)); 28 | * 29 | * If a C string is desired as the final result, the call to CORD_balance 30 | * may be replaced by a call to CORD_to_char_star. 31 | */ 32 | 33 | # ifndef CORD_BUFSZ 34 | # define CORD_BUFSZ 128 35 | # endif 36 | 37 | typedef struct CORD_ec_struct { 38 | CORD ec_cord; 39 | char * ec_bufptr; 40 | char ec_buf[CORD_BUFSZ+1]; 41 | } CORD_ec[1]; 42 | 43 | /* This structure represents the concatenation of ec_cord with */ 44 | /* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */ 45 | 46 | /* Flush the buffer part of the extended chord into ec_cord. */ 47 | /* Note that this is almost the only real function, and it is */ 48 | /* implemented in 6 lines in cordxtra.c */ 49 | void CORD_ec_flush_buf(CORD_ec x); 50 | 51 | /* Convert an extensible cord to a cord. */ 52 | # define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord) 53 | 54 | /* Initialize an extensible cord. */ 55 | # define CORD_ec_init(x) ((x)[0].ec_cord = 0, (x)[0].ec_bufptr = (x)[0].ec_buf) 56 | 57 | /* Append a character to an extensible cord. */ 58 | # define CORD_ec_append(x, c) \ 59 | { \ 60 | if ((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ) { \ 61 | CORD_ec_flush_buf(x); \ 62 | } \ 63 | *((x)[0].ec_bufptr)++ = (c); \ 64 | } 65 | 66 | /* Append a cord to an extensible cord. Structure remains shared with */ 67 | /* original. */ 68 | void CORD_ec_append_cord(CORD_ec x, CORD s); 69 | 70 | # endif /* EC_H */ 71 | -------------------------------------------------------------------------------- /boehmgc/include/gc_backptr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a simple API to implement pointer back tracing, i.e. 3 | * to answer questions such as "who is pointing to this" or 4 | * "why is this object being retained by the collector" 5 | * 6 | * This API assumes that we have an ANSI C compiler. 7 | * 8 | * Most of these calls yield useful information on only after 9 | * a garbage collection. Usually the client will first force 10 | * a full collection and then gather information, preferably 11 | * before much intervening allocation. 12 | * 13 | * The implementation of the interface is only about 99.9999% 14 | * correct. It is intended to be good enough for profiling, 15 | * but is not intended to be used with production code. 16 | * 17 | * Results are likely to be much more useful if all allocation is 18 | * accomplished through the debugging allocators. 19 | * 20 | * The implementation idea is due to A. Demers. 21 | */ 22 | 23 | #ifndef GC_BACKPTR_H 24 | #define GC_BACKPTR_H 25 | /* Store information about the object referencing dest in *base_p */ 26 | /* and *offset_p. */ 27 | /* If multiple objects or roots point to dest, the one reported */ 28 | /* will be the last on used by the garbage collector to trace the */ 29 | /* object. */ 30 | /* source is root ==> *base_p = address, *offset_p = 0 */ 31 | /* source is heap object ==> *base_p != 0, *offset_p = offset */ 32 | /* Returns 1 on success, 0 if source couldn't be determined. */ 33 | /* Dest can be any address within a heap object. */ 34 | typedef enum { GC_UNREFERENCED, /* No reference info available. */ 35 | GC_NO_SPACE, /* Dest not allocated with debug alloc */ 36 | GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p */ 37 | GC_REFD_FROM_REG, /* Referenced from a register, i.e. */ 38 | /* a root without an address. */ 39 | GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */ 40 | GC_FINALIZER_REFD /* Finalizable and hence accessible. */ 41 | } GC_ref_kind; 42 | 43 | GC_ref_kind GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p); 44 | 45 | /* Generate a random heap address. */ 46 | /* The resulting address is in the heap, but */ 47 | /* not necessarily inside a valid object. */ 48 | void * GC_generate_random_heap_address(void); 49 | 50 | /* Generate a random address inside a valid marked heap object. */ 51 | void * GC_generate_random_valid_address(void); 52 | 53 | /* Force a garbage collection and generate a backtrace from a */ 54 | /* random heap address. */ 55 | /* This uses the GC logging mechanism (GC_printf) to produce */ 56 | /* output. It can often be called from a debugger. The */ 57 | /* source in dbg_mlc.c also serves as a sample client. */ 58 | void GC_generate_random_backtrace(void); 59 | 60 | /* Print a backtrace from a specific address. Used by the */ 61 | /* above. The client should call GC_gcollect() immediately */ 62 | /* before invocation. */ 63 | void GC_print_backtrace(void *); 64 | 65 | #endif /* GC_BACKPTR_H */ 66 | -------------------------------------------------------------------------------- /vs/Aide/Aide.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 38 | 39 | 46 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | 71 | 72 | 75 | 76 | 79 | 80 | 83 | 84 | 87 | 88 | 91 | 92 | 95 | 96 | 99 | 100 | 101 | 105 | 106 | 110 | 111 | 114 | 115 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /boehmgc/include/gc_pthread_redirects.h: -------------------------------------------------------------------------------- 1 | /* Our pthread support normally needs to intercept a number of thread */ 2 | /* calls. We arrange to do that here, if appropriate. */ 3 | 4 | #ifndef GC_PTHREAD_REDIRECTS_H 5 | 6 | #define GC_PTHREAD_REDIRECTS_H 7 | 8 | #if defined(GC_SOLARIS_THREADS) 9 | /* We need to intercept calls to many of the threads primitives, so */ 10 | /* that we can locate thread stacks and stop the world. */ 11 | /* Note also that the collector cannot see thread specific data. */ 12 | /* Thread specific data should generally consist of pointers to */ 13 | /* uncollectable objects (allocated with GC_malloc_uncollectable, */ 14 | /* not the system malloc), which are deallocated using the destructor */ 15 | /* facility in thr_keycreate. Alternatively, keep a redundant pointer */ 16 | /* to thread specific data on the thread stack. */ 17 | # include 18 | int GC_thr_create(void *stack_base, size_t stack_size, 19 | void *(*start_routine)(void *), void *arg, long flags, 20 | thread_t *new_thread); 21 | int GC_thr_join(thread_t wait_for, thread_t *departed, void **status); 22 | int GC_thr_suspend(thread_t target_thread); 23 | int GC_thr_continue(thread_t target_thread); 24 | void * GC_dlopen(const char *path, int mode); 25 | # define thr_create GC_thr_create 26 | # define thr_join GC_thr_join 27 | # define thr_suspend GC_thr_suspend 28 | # define thr_continue GC_thr_continue 29 | #endif /* GC_SOLARIS_THREADS */ 30 | 31 | #if defined(GC_SOLARIS_PTHREADS) 32 | # include 33 | # include 34 | extern int GC_pthread_create(pthread_t *new_thread, 35 | const pthread_attr_t *attr, 36 | void * (*thread_execp)(void *), void *arg); 37 | extern int GC_pthread_join(pthread_t wait_for, void **status); 38 | # define pthread_join GC_pthread_join 39 | # define pthread_create GC_pthread_create 40 | #endif 41 | 42 | #if defined(GC_SOLARIS_PTHREADS) || defined(GC_SOLARIS_THREADS) 43 | # define dlopen GC_dlopen 44 | #endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */ 45 | 46 | 47 | #if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS) && !defined(GC_SOLARIS_PTHREADS) 48 | /* We treat these similarly. */ 49 | # include 50 | # include 51 | 52 | int GC_pthread_create(pthread_t *new_thread, 53 | const pthread_attr_t *attr, 54 | void *(*start_routine)(void *), void *arg); 55 | #ifndef GC_DARWIN_THREADS 56 | int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset); 57 | #endif 58 | int GC_pthread_join(pthread_t thread, void **retval); 59 | int GC_pthread_detach(pthread_t thread); 60 | 61 | #if defined(GC_OSF1_THREADS) \ 62 | && defined(_PTHREAD_USE_MANGLED_NAMES_) && !defined(_PTHREAD_USE_PTDNAM_) 63 | /* Unless the compiler supports #pragma extern_prefix, the Tru64 UNIX 64 | redefines some POSIX thread functions to use mangled names. 65 | If so, undef them before redefining. */ 66 | # undef pthread_create 67 | # undef pthread_join 68 | # undef pthread_detach 69 | #endif 70 | 71 | # define pthread_create GC_pthread_create 72 | # define pthread_join GC_pthread_join 73 | # define pthread_detach GC_pthread_detach 74 | 75 | #ifndef GC_DARWIN_THREADS 76 | # define pthread_sigmask GC_pthread_sigmask 77 | # define dlopen GC_dlopen 78 | #endif 79 | 80 | #endif /* GC_xxxxx_THREADS */ 81 | 82 | #endif /* GC_PTHREAD_REDIRECTS_H */ 83 | -------------------------------------------------------------------------------- /boehmgc/include/gc_local_alloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | 14 | /* 15 | * Interface for thread local allocation. Memory obtained 16 | * this way can be used by all threads, as though it were obtained 17 | * from an allocator like GC_malloc. The difference is that GC_local_malloc 18 | * counts the number of allocations of a given size from the current thread, 19 | * and uses GC_malloc_many to perform the allocations once a threashold 20 | * is exceeded. Thus far less synchronization may be needed. 21 | * Allocation of known large objects should not use this interface. 22 | * This interface is designed primarily for fast allocation of small 23 | * objects on multiprocessors, e.g. for a JVM running on an MP server. 24 | * 25 | * If this file is included with GC_GCJ_SUPPORT defined, GCJ-style 26 | * bitmap allocation primitives will also be included. 27 | * 28 | * If this file is included with GC_REDIRECT_TO_LOCAL defined, then 29 | * GC_MALLOC, GC_MALLOC_ATOMIC, and possibly GC_GCJ_MALLOC will 30 | * be redefined to use the thread local allocatoor. 31 | * 32 | * The interface is available only if the collector is built with 33 | * -DTHREAD_LOCAL_ALLOC, which is currently supported only on Linux. 34 | * 35 | * The debugging allocators use standard, not thread-local allocation. 36 | * 37 | * These routines normally require an explicit call to GC_init(), though 38 | * that may be done from a constructor function. 39 | */ 40 | 41 | #ifndef GC_LOCAL_ALLOC_H 42 | #define GC_LOCAL_ALLOC_H 43 | 44 | #ifndef _GC_H 45 | # include "gc.h" 46 | #endif 47 | 48 | #if defined(GC_GCJ_SUPPORT) && !defined(GC_GCJ_H) 49 | # include "gc_gcj.h" 50 | #endif 51 | 52 | /* We assume ANSI C for this interface. */ 53 | 54 | GC_PTR GC_local_malloc(size_t bytes); 55 | 56 | GC_PTR GC_local_malloc_atomic(size_t bytes); 57 | 58 | #if defined(GC_GCJ_SUPPORT) 59 | GC_PTR GC_local_gcj_malloc(size_t bytes, 60 | void * ptr_to_struct_containing_descr); 61 | #endif 62 | 63 | # ifdef GC_DEBUG 64 | /* We don't really use local allocation in this case. */ 65 | # define GC_LOCAL_MALLOC(s) GC_debug_malloc(s,GC_EXTRAS) 66 | # define GC_LOCAL_MALLOC_ATOMIC(s) GC_debug_malloc_atomic(s,GC_EXTRAS) 67 | # ifdef GC_GCJ_SUPPORT 68 | # define GC_LOCAL_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) 69 | # endif 70 | # else 71 | # define GC_LOCAL_MALLOC(s) GC_local_malloc(s) 72 | # define GC_LOCAL_MALLOC_ATOMIC(s) GC_local_malloc_atomic(s) 73 | # ifdef GC_GCJ_SUPPORT 74 | # define GC_LOCAL_GCJ_MALLOC(s,d) GC_local_gcj_malloc(s,d) 75 | # endif 76 | # endif 77 | 78 | # ifdef GC_REDIRECT_TO_LOCAL 79 | # undef GC_MALLOC 80 | # define GC_MALLOC(s) GC_LOCAL_MALLOC(s) 81 | # undef GC_MALLOC_ATOMIC 82 | # define GC_MALLOC_ATOMIC(s) GC_LOCAL_MALLOC_ATOMIC(s) 83 | # ifdef GC_GCJ_SUPPORT 84 | # undef GC_GCJ_MALLOC 85 | # define GC_GCJ_MALLOC(s,d) GC_LOCAL_GCJ_MALLOC(s,d) 86 | # endif 87 | # endif 88 | 89 | #endif /* GC_LOCAL_ALLOC_H */ 90 | -------------------------------------------------------------------------------- /boehmgc/src/gc_dlopen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. 3 | * Copyright (c) 1997 by Silicon Graphics. All rights reserved. 4 | * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. 5 | * 6 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 7 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 8 | * 9 | * Permission is hereby granted to use or copy this program 10 | * for any purpose, provided the above notices are retained on all copies. 11 | * Permission to modify the code and to distribute modified code is granted, 12 | * provided the above notices are retained, and a notice that the code was 13 | * modified is included with the above copyright notice. 14 | * 15 | * Original author: Bill Janssen 16 | * Heavily modified by Hans Boehm and others 17 | */ 18 | 19 | /* 20 | * This used to be in dyn_load.c. It was extracted into a separate file 21 | * to avoid having to link against libdl.{a,so} if the client doesn't call 22 | * dlopen. Of course this fails if the collector is in a dynamic 23 | * library. -HB 24 | */ 25 | 26 | #include "private/gc_priv.h" 27 | 28 | # if (defined(GC_PTHREADS) && !defined(GC_DARWIN_THREADS)) \ 29 | || defined(GC_SOLARIS_THREADS) 30 | 31 | # if defined(dlopen) && !defined(GC_USE_LD_WRAP) 32 | /* To support various threads pkgs, gc.h interposes on dlopen by */ 33 | /* defining "dlopen" to be "GC_dlopen", which is implemented below. */ 34 | /* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */ 35 | /* real system dlopen() in their implementation. We first remove */ 36 | /* gc.h's dlopen definition and restore it later, after GC_dlopen(). */ 37 | # undef dlopen 38 | # endif 39 | 40 | /* Make sure we're not in the middle of a collection, and make */ 41 | /* sure we don't start any. Returns previous value of GC_dont_gc. */ 42 | /* This is invoked prior to a dlopen call to avoid synchronization */ 43 | /* issues. We can't just acquire the allocation lock, since startup */ 44 | /* code in dlopen may try to allocate. */ 45 | /* This solution risks heap growth in the presence of many dlopen */ 46 | /* calls in either a multithreaded environment, or if the library */ 47 | /* initialization code allocates substantial amounts of GC'ed memory. */ 48 | /* But I don't know of a better solution. */ 49 | static void disable_gc_for_dlopen() 50 | { 51 | LOCK(); 52 | while (GC_incremental && GC_collection_in_progress()) { 53 | GC_collect_a_little_inner(1000); 54 | } 55 | ++GC_dont_gc; 56 | UNLOCK(); 57 | } 58 | 59 | /* Redefine dlopen to guarantee mutual exclusion with */ 60 | /* GC_register_dynamic_libraries. */ 61 | /* Should probably happen for other operating systems, too. */ 62 | 63 | #include 64 | 65 | #ifdef GC_USE_LD_WRAP 66 | void * __wrap_dlopen(const char *path, int mode) 67 | #else 68 | void * GC_dlopen(path, mode) 69 | GC_CONST char * path; 70 | int mode; 71 | #endif 72 | { 73 | void * result; 74 | 75 | # ifndef USE_PROC_FOR_LIBRARIES 76 | disable_gc_for_dlopen(); 77 | # endif 78 | # ifdef GC_USE_LD_WRAP 79 | result = (void *)__real_dlopen(path, mode); 80 | # else 81 | result = dlopen(path, mode); 82 | # endif 83 | # ifndef USE_PROC_FOR_LIBRARIES 84 | GC_enable(); /* undoes disable_gc_for_dlopen */ 85 | # endif 86 | return(result); 87 | } 88 | # endif /* GC_PTHREADS || GC_SOLARIS_THREADS ... */ 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /vs/Interpreteur/Interpreteur.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93882ca5-3d98-49c4-bc05-4d48ef11e267} 10 | 11 | 12 | {3a50b1a3-48ee-40c1-98da-9656398bda2c} 13 | 14 | 15 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 16 | h;hpp;hxx;hm;inl;inc;xsd 17 | 18 | 19 | {b90cbb89-9bb5-4f24-b788-557bbf3fb1cd} 20 | 21 | 22 | {8c8b168c-e0e3-4c68-bd9a-c7f6f15ec3e9} 23 | 24 | 25 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 26 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx 27 | 28 | 29 | {3bd86f63-d151-4c62-97da-a54a5d3f62b4} 30 | 31 | 32 | 33 | 34 | Source Files\gpp 35 | 36 | 37 | Source Files\gpp 38 | 39 | 40 | Source Files\interne 41 | 42 | 43 | Source Files\interne 44 | 45 | 46 | Source Files\interne 47 | 48 | 49 | Source Files\interne 50 | 51 | 52 | Source Files\interne 53 | 54 | 55 | Source Files\interne 56 | 57 | 58 | Source Files\interne 59 | 60 | 61 | Source Files\interne 62 | 63 | 64 | 65 | 66 | Header Files\gpp 67 | 68 | 69 | Header Files\interne 70 | 71 | 72 | 73 | 74 | Resource Files 75 | 76 | 77 | Resource Files 78 | 79 | 80 | 81 | 82 | Exemples 83 | 84 | 85 | Exemples 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /include/gotopp/base.h: -------------------------------------------------------------------------------- 1 | #ifndef _BASE_H 2 | #define _BASE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #ifndef _WIN32 10 | #include 11 | #include 12 | #ifdef _UNICODE 13 | #include "wlib.h" 14 | #endif 15 | #else 16 | #include "configwin.h" 17 | #endif 18 | #include 19 | #include 20 | 21 | #include "gppmodule.h" 22 | 23 | namespace GotoPP 24 | { 25 | typedef unsigned char byte; 26 | typedef unsigned long dword; 27 | typedef unsigned char uchar; 28 | typedef unsigned int uint; 29 | typedef int id; 30 | 31 | 32 | class IInterpreteur; 33 | 34 | const int TMAXIDENTIFIEUR=63; 35 | 36 | #ifdef DEFINITIONS 37 | #define GPP_GLOBAL 38 | #else 39 | #define GPP_GLOBAL extern 40 | #endif 41 | 42 | #ifdef _WIN32 43 | # define ADRESSEFONC(x) x 44 | #else 45 | # define ADRESSEFONC(x) &x 46 | #endif 47 | 48 | #ifdef _WIN32 49 | #define TACHE uintptr_t 50 | #else 51 | #define TACHE pthread_t 52 | #endif 53 | 54 | 55 | #ifdef _UNICODE 56 | typedef wchar_t ucarac; 57 | #define TXT(x) L##x 58 | #define czcpy wcscpy 59 | #define czlen wcslen 60 | #define czncmp wcsncmp 61 | #define czcmp wcscmp 62 | #define czgetenv _wgetenv 63 | #define czvcprintf _vscwprintf 64 | 65 | #ifdef _WIN32 66 | # define czncpy wcsncpy_s 67 | # define czvprintf vswprintf_s 68 | # define czvnprintf vswnprintf_s 69 | #else 70 | # define czvprintf vswprintf 71 | # define czvnprintf vswprintf 72 | # define czncpy wcsncpy 73 | #endif 74 | #define czscspn wcscspn 75 | #define czschr wcschr 76 | #define putcarac putwchar 77 | #ifdef _WIN32 78 | #define cznprintf swprintf_s 79 | #else 80 | #define cznprintf swprintf 81 | #endif 82 | #define czcat wcscat 83 | #define czfopen _wfopen 84 | #define czfputws fputws 85 | #define czfputs(x,F) fprintf(F,"%S",x) 86 | #define oputcz(x) fputws(x,stdout) 87 | #define fputcz fputws 88 | #define czpopen _wpopen 89 | #define czoprintf wprintf 90 | #define czmain wmain 91 | #define czout wcout 92 | #define czin wcin 93 | #define czerr wcerr 94 | #define czstr wcsstr 95 | #define cztostr wcstombs 96 | #define cztowcs wcsncpy 97 | #define strtocz mbstowcs 98 | #ifdef _WIN32 99 | #define cztoi _wtoi 100 | #define cztof _wtof 101 | #else 102 | #define cztoi(x) wcstoul(x,0,10) 103 | #define cztof(x) wcstod(x,0) 104 | #endif 105 | #else 106 | typedef unsigned char ucarac; 107 | #define TXT(x) x 108 | #define czcpy strcpy 109 | #define czlen strlen 110 | #define czncpy strncpy 111 | #define czncmp strncmp 112 | #define czcmp strcmp 113 | #define czgetenv getenv 114 | #define czvcprintf _vscprintf 115 | #define czvprintf vsprintf 116 | #define czvnprintf vsnprintf 117 | #define czscspn strcspn 118 | #define czschr strchr 119 | #define putcarac putchar 120 | #ifdef _WIN32 121 | #define cznprintf _snprintf_s 122 | #else 123 | #define cznprintf snprintf 124 | #endif 125 | #define czcat strcat 126 | #define czfopen fopen 127 | #define czfputws(x,F) fprintf(F,"%S",x) 128 | #define czfputs(x,F) fputs(x,F) 129 | #define oputcz(x) puts(x,stdout) 130 | #define fputcz fputs 131 | #ifdef _WIN32 132 | #define czpopen _popen 133 | #else 134 | #define czpopen popen 135 | #endif 136 | #define czoprintf printf 137 | #define czmain main 138 | #define czout cout 139 | #define czin cin 140 | #define czerr cerr 141 | #define czstr strstr 142 | #define cztostr strncpy 143 | #define cztowcs mbstowcs 144 | #define strtocz strncpy 145 | #define cztoi atoi 146 | #define cztof atof 147 | #endif 148 | 149 | typedef void FnAfficherErreur(const GotoPP::carac * texte, const GotoPP::carac * fichier, 150 | int ligne, bool execution); 151 | extern FnAfficherErreur * AfficherErreur; 152 | } 153 | 154 | #ifdef _DEBUG 155 | #define ASSERT(x) assert(x) 156 | #else 157 | #define ASSERT(x) 158 | #endif 159 | 160 | #include "tableaux.h" 161 | #include "type/valeur.h" 162 | #include "symbole.h" 163 | #endif 164 | -------------------------------------------------------------------------------- /vs/Aide/Aide.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {4C1FB9E1-0A28-449F-ADDF-5AB5BA24F567} 15 | Aide 16 | MakeFileProj 17 | 18 | 19 | 20 | Makefile 21 | v140 22 | 23 | 24 | Makefile 25 | v140 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | <_ProjectFileVersion>14.0.22823.1 41 | 42 | 43 | Debug\ 44 | Debug\ 45 | cd ..\..\doc 46 | perl creerdoc.pl 47 | 48 | 49 | gotopp.chm 50 | 51 | 52 | Release\ 53 | Release\ 54 | cd ..\..\doc\ 55 | creerdoc.pl $(ProjectDir) 56 | asm.pl $(ProjectDir) 57 | cd $(ProjectDir) 58 | "E:\Program Files\HTML Help Workshop\hhc.exe" chm\Langage.hhp 59 | 60 | 61 | ..\..\doc\gotopp.chm 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /boehmgc/src/setjmp_t.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | 14 | /* Check whether setjmp actually saves registers in jmp_buf. */ 15 | /* If it doesn't, the generic mark_regs code won't work. */ 16 | /* Compilers vary as to whether they will put x in a */ 17 | /* (callee-save) register without -O. The code is */ 18 | /* contrived such that any decent compiler should put x in */ 19 | /* a callee-save register with -O. Thus it is is */ 20 | /* recommended that this be run optimized. (If the machine */ 21 | /* has no callee-save registers, then the generic code is */ 22 | /* safe, but this will not be noticed by this piece of */ 23 | /* code.) This test appears to be far from perfect. */ 24 | #include 25 | #include 26 | #include 27 | #include "private/gcconfig.h" 28 | 29 | #ifdef OS2 30 | /* GETPAGESIZE() is set to getpagesize() by default, but that */ 31 | /* doesn't really exist, and the collector doesn't need it. */ 32 | #define INCL_DOSFILEMGR 33 | #define INCL_DOSMISC 34 | #define INCL_DOSERRORS 35 | #include 36 | 37 | int 38 | getpagesize() 39 | { 40 | ULONG result[1]; 41 | 42 | if (DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE, 43 | (void *)result, sizeof(ULONG)) != NO_ERROR) { 44 | fprintf(stderr, "DosQuerySysInfo failed\n"); 45 | result[0] = 4096; 46 | } 47 | return((int)(result[0])); 48 | } 49 | #endif 50 | 51 | struct {char a_a; char * a_b;} a; 52 | 53 | int * nested_sp() 54 | { 55 | int dummy; 56 | 57 | return(&dummy); 58 | } 59 | 60 | main() 61 | { 62 | int dummy; 63 | long ps = GETPAGESIZE(); 64 | jmp_buf b; 65 | register int x = (int)strlen("a"); /* 1, slightly disguised */ 66 | static int y = 0; 67 | 68 | printf("This appears to be a %s running %s\n", MACH_TYPE, OS_TYPE); 69 | if (nested_sp() < &dummy) { 70 | printf("Stack appears to grow down, which is the default.\n"); 71 | printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", 72 | ((unsigned long)(&dummy) + ps) & ~(ps-1)); 73 | } else { 74 | printf("Stack appears to grow up.\n"); 75 | printf("Define STACK_GROWS_UP in gc_private.h\n"); 76 | printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", 77 | ((unsigned long)(&dummy) + ps) & ~(ps-1)); 78 | } 79 | printf("Note that this may vary between machines of ostensibly\n"); 80 | printf("the same architecture (e.g. Sun 3/50s and 3/80s).\n"); 81 | printf("On many machines the value is not fixed.\n"); 82 | printf("A good guess for ALIGNMENT on this machine is %ld.\n", 83 | (unsigned long)(&(a.a_b))-(unsigned long)(&a)); 84 | 85 | /* Encourage the compiler to keep x in a callee-save register */ 86 | x = 2*x-1; 87 | printf(""); 88 | x = 2*x-1; 89 | setjmp(b); 90 | if (y == 1) { 91 | if (x == 2) { 92 | printf("Generic mark_regs code probably wont work\n"); 93 | # if defined(SPARC) || defined(RS6000) || defined(VAX) || defined(MIPS) || defined(M68K) || defined(I386) || defined(NS32K) || defined(RT) 94 | printf("Assembly code supplied\n"); 95 | # else 96 | printf("Need assembly code\n"); 97 | # endif 98 | } else if (x == 1) { 99 | printf("Generic mark_regs code may work\n"); 100 | } else { 101 | printf("Very strange setjmp implementation\n"); 102 | } 103 | } 104 | y++; 105 | x = 2; 106 | if (y == 1) longjmp(b,1); 107 | return(0); 108 | } 109 | 110 | int g(x) 111 | int x; 112 | { 113 | return(x); 114 | } 115 | -------------------------------------------------------------------------------- /boehmgc/include/private/specific.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a reimplementation of a subset of the pthread_getspecific/setspecific 3 | * interface. This appears to outperform the standard linuxthreads one 4 | * by a significant margin. 5 | * The major restriction is that each thread may only make a single 6 | * pthread_setspecific call on a single key. (The current data structure 7 | * doesn't really require that. The restriction should be easily removable.) 8 | * We don't currently support the destruction functions, though that 9 | * could be done. 10 | * We also currently assume that only one pthread_setspecific call 11 | * can be executed at a time, though that assumption would be easy to remove 12 | * by adding a lock. 13 | */ 14 | 15 | #include 16 | 17 | /* Called during key creation or setspecific. */ 18 | /* For the GC we already hold lock. */ 19 | /* Currently allocated objects leak on thread exit. */ 20 | /* That's hard to fix, but OK if we allocate garbage */ 21 | /* collected memory. */ 22 | #define MALLOC_CLEAR(n) GC_INTERNAL_MALLOC(n, NORMAL) 23 | #define PREFIXED(name) GC_##name 24 | 25 | #define TS_CACHE_SIZE 1024 26 | #define CACHE_HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_CACHE_SIZE - 1)) 27 | #define TS_HASH_SIZE 1024 28 | #define HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_HASH_SIZE - 1)) 29 | 30 | /* An entry describing a thread-specific value for a given thread. */ 31 | /* All such accessible structures preserve the invariant that if either */ 32 | /* thread is a valid pthread id or qtid is a valid "quick tread id" */ 33 | /* for a thread, then value holds the corresponding thread specific */ 34 | /* value. This invariant must be preserved at ALL times, since */ 35 | /* asynchronous reads are allowed. */ 36 | typedef struct thread_specific_entry { 37 | unsigned long qtid; /* quick thread id, only for cache */ 38 | void * value; 39 | struct thread_specific_entry *next; 40 | pthread_t thread; 41 | } tse; 42 | 43 | 44 | /* We represent each thread-specific datum as two tables. The first is */ 45 | /* a cache, indexed by a "quick thread identifier". The "quick" thread */ 46 | /* identifier is an easy to compute value, which is guaranteed to */ 47 | /* determine the thread, though a thread may correspond to more than */ 48 | /* one value. We typically use the address of a page in the stack. */ 49 | /* The second is a hash table, indexed by pthread_self(). It is used */ 50 | /* only as a backup. */ 51 | 52 | /* Return the "quick thread id". Default version. Assumes page size, */ 53 | /* or at least thread stack separation, is at least 4K. */ 54 | /* Must be defined so that it never returns 0. (Page 0 can't really */ 55 | /* be part of any stack, since that would make 0 a valid stack pointer.)*/ 56 | static __inline__ unsigned long quick_thread_id() { 57 | int dummy; 58 | return (unsigned long)(&dummy) >> 12; 59 | } 60 | 61 | #define INVALID_QTID ((unsigned long)0) 62 | #define INVALID_THREADID ((pthread_t)0) 63 | 64 | typedef struct thread_specific_data { 65 | tse * volatile cache[TS_CACHE_SIZE]; 66 | /* A faster index to the hash table */ 67 | tse * hash[TS_HASH_SIZE]; 68 | pthread_mutex_t lock; 69 | } tsd; 70 | 71 | typedef tsd * PREFIXED(key_t); 72 | 73 | extern int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)); 74 | 75 | extern int PREFIXED(setspecific) (tsd * key, void * value); 76 | 77 | extern void PREFIXED(remove_specific) (tsd * key); 78 | 79 | /* An internal version of getspecific that assumes a cache miss. */ 80 | void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid, 81 | tse * volatile * cache_entry); 82 | 83 | static __inline__ void * PREFIXED(getspecific) (tsd * key) { 84 | long qtid = quick_thread_id(); 85 | unsigned hash_val = CACHE_HASH(qtid); 86 | tse * volatile * entry_ptr = key -> cache + hash_val; 87 | tse * entry = *entry_ptr; /* Must be loaded only once. */ 88 | if (EXPECT(entry -> qtid == qtid, 1)) { 89 | GC_ASSERT(entry -> thread == pthread_self()); 90 | return entry -> value; 91 | } 92 | return PREFIXED(slow_getspecific) (key, qtid, entry_ptr); 93 | } 94 | 95 | 96 | -------------------------------------------------------------------------------- /boehmgc/include/private/pthread_support.h: -------------------------------------------------------------------------------- 1 | #ifndef GC_PTHREAD_SUPPORT_H 2 | #define GC_PTHREAD_SUPPORT_H 3 | 4 | # include "private/gc_priv.h" 5 | 6 | # if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \ 7 | && !defined(GC_WIN32_THREADS) 8 | 9 | #if defined(GC_DARWIN_THREADS) 10 | # include "private/darwin_stop_world.h" 11 | #else 12 | # include "private/pthread_stop_world.h" 13 | #endif 14 | 15 | /* We use the allocation lock to protect thread-related data structures. */ 16 | 17 | /* The set of all known threads. We intercept thread creation and */ 18 | /* joins. */ 19 | /* Protected by allocation/GC lock. */ 20 | /* Some of this should be declared volatile, but that's inconsistent */ 21 | /* with some library routine declarations. */ 22 | typedef struct GC_Thread_Rep { 23 | struct GC_Thread_Rep * next; /* More recently allocated threads */ 24 | /* with a given pthread id come */ 25 | /* first. (All but the first are */ 26 | /* guaranteed to be dead, but we may */ 27 | /* not yet have registered the join.) */ 28 | pthread_t id; 29 | /* Extra bookkeeping information the stopping code uses */ 30 | struct thread_stop_info stop_info; 31 | 32 | short flags; 33 | # define FINISHED 1 /* Thread has exited. */ 34 | # define DETACHED 2 /* Thread is intended to be detached. */ 35 | # define MAIN_THREAD 4 /* True for the original thread only. */ 36 | short thread_blocked; /* Protected by GC lock. */ 37 | /* Treated as a boolean value. If set, */ 38 | /* thread will acquire GC lock before */ 39 | /* doing any pointer manipulations, and */ 40 | /* has set its sp value. Thus it does */ 41 | /* not need to be sent a signal to stop */ 42 | /* it. */ 43 | ptr_t stack_end; /* Cold end of the stack. */ 44 | # ifdef IA64 45 | ptr_t backing_store_end; 46 | ptr_t backing_store_ptr; 47 | # endif 48 | void * status; /* The value returned from the thread. */ 49 | /* Used only to avoid premature */ 50 | /* reclamation of any data it might */ 51 | /* reference. */ 52 | # ifdef THREAD_LOCAL_ALLOC 53 | # if CPP_WORDSZ == 64 && defined(ALIGN_DOUBLE) 54 | # define GRANULARITY 16 55 | # define NFREELISTS 49 56 | # else 57 | # define GRANULARITY 8 58 | # define NFREELISTS 65 59 | # endif 60 | /* The ith free list corresponds to size i*GRANULARITY */ 61 | # define INDEX_FROM_BYTES(n) ((ADD_SLOP(n) + GRANULARITY - 1)/GRANULARITY) 62 | # define BYTES_FROM_INDEX(i) ((i) * GRANULARITY - EXTRA_BYTES) 63 | # define SMALL_ENOUGH(bytes) (ADD_SLOP(bytes) <= \ 64 | (NFREELISTS-1)*GRANULARITY) 65 | ptr_t ptrfree_freelists[NFREELISTS]; 66 | ptr_t normal_freelists[NFREELISTS]; 67 | # ifdef GC_GCJ_SUPPORT 68 | ptr_t gcj_freelists[NFREELISTS]; 69 | # endif 70 | /* Free lists contain either a pointer or a small count */ 71 | /* reflecting the number of granules allocated at that */ 72 | /* size. */ 73 | /* 0 ==> thread-local allocation in use, free list */ 74 | /* empty. */ 75 | /* > 0, <= DIRECT_GRANULES ==> Using global allocation, */ 76 | /* too few objects of this size have been */ 77 | /* allocated by this thread. */ 78 | /* >= HBLKSIZE => pointer to nonempty free list. */ 79 | /* > DIRECT_GRANULES, < HBLKSIZE ==> transition to */ 80 | /* local alloc, equivalent to 0. */ 81 | # define DIRECT_GRANULES (HBLKSIZE/GRANULARITY) 82 | /* Don't use local free lists for up to this much */ 83 | /* allocation. */ 84 | # endif 85 | } * GC_thread; 86 | 87 | # define THREAD_TABLE_SZ 128 /* Must be power of 2 */ 88 | extern volatile GC_thread GC_threads[THREAD_TABLE_SZ]; 89 | 90 | extern GC_bool GC_thr_initialized; 91 | 92 | GC_thread GC_lookup_thread(pthread_t id); 93 | 94 | void GC_stop_init(); 95 | 96 | extern GC_bool GC_in_thread_creation; 97 | /* We may currently be in thread creation or destruction. */ 98 | /* Only set to TRUE while allocation lock is held. */ 99 | /* When set, it is OK to run GC from unknown thread. */ 100 | 101 | #endif /* GC_PTHREADS && !GC_SOLARIS_THREADS.... etc */ 102 | #endif /* GC_PTHREAD_SUPPORT_H */ 103 | -------------------------------------------------------------------------------- /boehmgc/include/gc_inl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers 3 | * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. 4 | * 5 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 6 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 7 | * 8 | * Permission is hereby granted to use or copy this program 9 | * for any purpose, provided the above notices are retained on all copies. 10 | * Permission to modify the code and to distribute modified code is granted, 11 | * provided the above notices are retained, and a notice that the code was 12 | * modified is included with the above copyright notice. 13 | */ 14 | /* Boehm, October 3, 1995 2:07 pm PDT */ 15 | 16 | # ifndef GC_PRIVATE_H 17 | # include "private/gc_priv.h" 18 | # endif 19 | 20 | /* USE OF THIS FILE IS NOT RECOMMENDED unless GC_all_interior_pointers */ 21 | /* is always set, or the collector has been built with */ 22 | /* -DDONT_ADD_BYTE_AT_END, or the specified size includes a pointerfree */ 23 | /* word at the end. In the standard collector configuration, */ 24 | /* the final word of each object may not be scanned. */ 25 | /* This iinterface is most useful for compilers that generate C. */ 26 | /* Manual use is hereby discouraged. */ 27 | 28 | /* Allocate n words (NOT BYTES). X is made to point to the result. */ 29 | /* It is assumed that n < MAXOBJSZ, and */ 30 | /* that n > 0. On machines requiring double word alignment of some */ 31 | /* data, we also assume that n is 1 or even. */ 32 | /* If the collector is built with -DUSE_MARK_BYTES or -DPARALLEL_MARK, */ 33 | /* the n = 1 case is also disallowed. */ 34 | /* Effectively this means that portable code should make sure n is even.*/ 35 | /* This bypasses the */ 36 | /* MERGE_SIZES mechanism. In order to minimize the number of distinct */ 37 | /* free lists that are maintained, the caller should ensure that a */ 38 | /* small number of distinct values of n are used. (The MERGE_SIZES */ 39 | /* mechanism normally does this by ensuring that only the leading three */ 40 | /* bits of n may be nonzero. See misc.c for details.) We really */ 41 | /* recommend this only in cases in which n is a constant, and no */ 42 | /* locking is required. */ 43 | /* In that case it may allow the compiler to perform substantial */ 44 | /* additional optimizations. */ 45 | # define GC_MALLOC_WORDS(result,n) \ 46 | { \ 47 | register ptr_t op; \ 48 | register ptr_t *opp; \ 49 | DCL_LOCK_STATE; \ 50 | \ 51 | opp = &(GC_objfreelist[n]); \ 52 | FASTLOCK(); \ 53 | if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) { \ 54 | FASTUNLOCK(); \ 55 | (result) = GC_generic_malloc_words_small((n), NORMAL); \ 56 | } else { \ 57 | *opp = obj_link(op); \ 58 | obj_link(op) = 0; \ 59 | GC_words_allocd += (n); \ 60 | FASTUNLOCK(); \ 61 | (result) = (GC_PTR) op; \ 62 | } \ 63 | } 64 | 65 | 66 | /* The same for atomic objects: */ 67 | # define GC_MALLOC_ATOMIC_WORDS(result,n) \ 68 | { \ 69 | register ptr_t op; \ 70 | register ptr_t *opp; \ 71 | DCL_LOCK_STATE; \ 72 | \ 73 | opp = &(GC_aobjfreelist[n]); \ 74 | FASTLOCK(); \ 75 | if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) { \ 76 | FASTUNLOCK(); \ 77 | (result) = GC_generic_malloc_words_small((n), PTRFREE); \ 78 | } else { \ 79 | *opp = obj_link(op); \ 80 | obj_link(op) = 0; \ 81 | GC_words_allocd += (n); \ 82 | FASTUNLOCK(); \ 83 | (result) = (GC_PTR) op; \ 84 | } \ 85 | } 86 | 87 | /* And once more for two word initialized objects: */ 88 | # define GC_CONS(result, first, second) \ 89 | { \ 90 | register ptr_t op; \ 91 | register ptr_t *opp; \ 92 | DCL_LOCK_STATE; \ 93 | \ 94 | opp = &(GC_objfreelist[2]); \ 95 | FASTLOCK(); \ 96 | if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) { \ 97 | FASTUNLOCK(); \ 98 | op = GC_generic_malloc_words_small(2, NORMAL); \ 99 | } else { \ 100 | *opp = obj_link(op); \ 101 | GC_words_allocd += 2; \ 102 | FASTUNLOCK(); \ 103 | } \ 104 | ((word *)op)[0] = (word)(first); \ 105 | ((word *)op)[1] = (word)(second); \ 106 | (result) = (GC_PTR) op; \ 107 | } 108 | -------------------------------------------------------------------------------- /boehmgc/include/private/cord_pos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | /* Boehm, May 19, 1994 2:23 pm PDT */ 14 | # ifndef CORD_POSITION_H 15 | 16 | /* The representation of CORD_position. This is private to the */ 17 | /* implementation, but the size is known to clients. Also */ 18 | /* the implementation of some exported macros relies on it. */ 19 | /* Don't use anything defined here and not in cord.h. */ 20 | 21 | # define MAX_DEPTH 48 22 | /* The maximum depth of a balanced cord + 1. */ 23 | /* We don't let cords get deeper than MAX_DEPTH. */ 24 | 25 | struct CORD_pe { 26 | CORD pe_cord; 27 | size_t pe_start_pos; 28 | }; 29 | 30 | /* A structure describing an entry on the path from the root */ 31 | /* to current position. */ 32 | typedef struct CORD_Pos { 33 | size_t cur_pos; 34 | int path_len; 35 | # define CORD_POS_INVALID (0x55555555) 36 | /* path_len == INVALID <==> position invalid */ 37 | const char *cur_leaf; /* Current leaf, if it is a string. */ 38 | /* If the current leaf is a function, */ 39 | /* then this may point to function_buf */ 40 | /* containing the next few characters. */ 41 | /* Always points to a valid string */ 42 | /* containing the current character */ 43 | /* unless cur_end is 0. */ 44 | size_t cur_start; /* Start position of cur_leaf */ 45 | size_t cur_end; /* Ending position of cur_leaf */ 46 | /* 0 if cur_leaf is invalid. */ 47 | struct CORD_pe path[MAX_DEPTH + 1]; 48 | /* path[path_len] is the leaf corresponding to cur_pos */ 49 | /* path[0].pe_cord is the cord we point to. */ 50 | # define FUNCTION_BUF_SZ 8 51 | char function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */ 52 | /* from function node. */ 53 | } CORD_pos[1]; 54 | 55 | /* Extract the cord from a position: */ 56 | CORD CORD_pos_to_cord(CORD_pos p); 57 | 58 | /* Extract the current index from a position: */ 59 | size_t CORD_pos_to_index(CORD_pos p); 60 | 61 | /* Fetch the character located at the given position: */ 62 | char CORD_pos_fetch(CORD_pos p); 63 | 64 | /* Initialize the position to refer to the give cord and index. */ 65 | /* Note that this is the most expensive function on positions: */ 66 | void CORD_set_pos(CORD_pos p, CORD x, size_t i); 67 | 68 | /* Advance the position to the next character. */ 69 | /* P must be initialized and valid. */ 70 | /* Invalidates p if past end: */ 71 | void CORD_next(CORD_pos p); 72 | 73 | /* Move the position to the preceding character. */ 74 | /* P must be initialized and valid. */ 75 | /* Invalidates p if past beginning: */ 76 | void CORD_prev(CORD_pos p); 77 | 78 | /* Is the position valid, i.e. inside the cord? */ 79 | int CORD_pos_valid(CORD_pos p); 80 | 81 | char CORD__pos_fetch(CORD_pos); 82 | void CORD__next(CORD_pos); 83 | void CORD__prev(CORD_pos); 84 | 85 | #define CORD_pos_fetch(p) \ 86 | (((p)[0].cur_end != 0)? \ 87 | (p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \ 88 | : CORD__pos_fetch(p)) 89 | 90 | #define CORD_next(p) \ 91 | (((p)[0].cur_pos + 1 < (p)[0].cur_end)? \ 92 | (p)[0].cur_pos++ \ 93 | : (CORD__next(p), 0)) 94 | 95 | #define CORD_prev(p) \ 96 | (((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start)? \ 97 | (p)[0].cur_pos-- \ 98 | : (CORD__prev(p), 0)) 99 | 100 | #define CORD_pos_to_index(p) ((p)[0].cur_pos) 101 | 102 | #define CORD_pos_to_cord(p) ((p)[0].path[0].pe_cord) 103 | 104 | #define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID) 105 | 106 | /* Some grubby stuff for performance-critical friends: */ 107 | #define CORD_pos_chars_left(p) ((long)((p)[0].cur_end) - (long)((p)[0].cur_pos)) 108 | /* Number of characters in cache. <= 0 ==> none */ 109 | 110 | #define CORD_pos_advance(p,n) ((p)[0].cur_pos += (n) - 1, CORD_next(p)) 111 | /* Advance position by n characters */ 112 | /* 0 < n < CORD_pos_chars_left(p) */ 113 | 114 | #define CORD_pos_cur_char_addr(p) \ 115 | (p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start) 116 | /* address of current character in cache. */ 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /boehmgc/src/MacOS.c: -------------------------------------------------------------------------------- 1 | /* 2 | MacOS.c 3 | 4 | Some routines for the Macintosh OS port of the Hans-J. Boehm, Alan J. Demers 5 | garbage collector. 6 | 7 | 8 | 9 | 11/22/94 pcb StripAddress the temporary memory handle for 24-bit mode. 10 | 11/30/94 pcb Tracking all memory usage so we can deallocate it all at once. 11 | 02/10/96 pcb Added routine to perform a final collection when 12 | unloading shared library. 13 | 14 | by Patrick C. Beard. 15 | */ 16 | /* Boehm, February 15, 1996 2:55 pm PST */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "gc.h" 26 | #include "gc_priv.h" 27 | 28 | // use 'CODE' resource 0 to get exact location of the beginning of global space. 29 | 30 | typedef struct { 31 | unsigned long aboveA5; 32 | unsigned long belowA5; 33 | unsigned long JTSize; 34 | unsigned long JTOffset; 35 | } *CodeZeroPtr, **CodeZeroHandle; 36 | 37 | void* GC_MacGetDataStart() 38 | { 39 | CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0); 40 | if (code0) { 41 | long belowA5Size = (**code0).belowA5; 42 | ReleaseResource((Handle)code0); 43 | return (LMGetCurrentA5() - belowA5Size); 44 | } 45 | fprintf(stderr, "Couldn't load the jump table."); 46 | exit(-1); 47 | return 0; 48 | } 49 | 50 | /* track the use of temporary memory so it can be freed all at once. */ 51 | 52 | typedef struct TemporaryMemoryBlock TemporaryMemoryBlock, **TemporaryMemoryHandle; 53 | 54 | struct TemporaryMemoryBlock { 55 | TemporaryMemoryHandle nextBlock; 56 | char data[]; 57 | }; 58 | 59 | static TemporaryMemoryHandle theTemporaryMemory = NULL; 60 | static Boolean firstTime = true; 61 | 62 | void GC_MacFreeTemporaryMemory(void); 63 | 64 | Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory) 65 | { 66 | static Boolean firstTime = true; 67 | OSErr result; 68 | TemporaryMemoryHandle tempMemBlock; 69 | Ptr tempPtr = nil; 70 | 71 | tempMemBlock = (TemporaryMemoryHandle)TempNewHandle(size + sizeof(TemporaryMemoryBlock), &result); 72 | if (tempMemBlock && result == noErr) { 73 | HLockHi((Handle)tempMemBlock); 74 | tempPtr = (**tempMemBlock).data; 75 | if (clearMemory) memset(tempPtr, 0, size); 76 | tempPtr = StripAddress(tempPtr); 77 | 78 | // keep track of the allocated blocks. 79 | (**tempMemBlock).nextBlock = theTemporaryMemory; 80 | theTemporaryMemory = tempMemBlock; 81 | } 82 | 83 | # if !defined(SHARED_LIBRARY_BUILD) 84 | // install an exit routine to clean up the memory used at the end. 85 | if (firstTime) { 86 | atexit(&GC_MacFreeTemporaryMemory); 87 | firstTime = false; 88 | } 89 | # endif 90 | 91 | return tempPtr; 92 | } 93 | 94 | extern word GC_fo_entries; 95 | 96 | static void perform_final_collection() 97 | { 98 | unsigned i; 99 | word last_fo_entries = 0; 100 | 101 | /* adjust the stack bottom, because CFM calls us from another stack 102 | location. */ 103 | GC_stackbottom = (ptr_t)&i; 104 | 105 | /* try to collect and finalize everything in sight */ 106 | for (i = 0; i < 2 || GC_fo_entries < last_fo_entries; i++) { 107 | last_fo_entries = GC_fo_entries; 108 | GC_gcollect(); 109 | } 110 | } 111 | 112 | 113 | void GC_MacFreeTemporaryMemory() 114 | { 115 | # if defined(SHARED_LIBRARY_BUILD) 116 | /* if possible, collect all memory, and invoke all finalizers. */ 117 | perform_final_collection(); 118 | # endif 119 | 120 | if (theTemporaryMemory != NULL) { 121 | long totalMemoryUsed = 0; 122 | TemporaryMemoryHandle tempMemBlock = theTemporaryMemory; 123 | while (tempMemBlock != NULL) { 124 | TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock; 125 | totalMemoryUsed += GetHandleSize((Handle)tempMemBlock); 126 | DisposeHandle((Handle)tempMemBlock); 127 | tempMemBlock = nextBlock; 128 | } 129 | theTemporaryMemory = NULL; 130 | 131 | # if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD) 132 | fprintf(stdout, "[total memory used: %ld bytes.]\n", 133 | totalMemoryUsed); 134 | fprintf(stdout, "[total collections: %ld.]\n", GC_gc_no); 135 | # endif 136 | } 137 | } 138 | 139 | #if __option(far_data) 140 | 141 | void* GC_MacGetDataEnd() 142 | { 143 | CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0); 144 | if (code0) { 145 | long aboveA5Size = (**code0).aboveA5; 146 | ReleaseResource((Handle)code0); 147 | return (LMGetCurrentA5() + aboveA5Size); 148 | } 149 | fprintf(stderr, "Couldn't load the jump table."); 150 | exit(-1); 151 | return 0; 152 | } 153 | 154 | #endif /* __option(far_data) */ 155 | -------------------------------------------------------------------------------- /boehmgc/include/gc_config_macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This should never be included directly. It is included only from gc.h. 3 | * We separate it only to make gc.h more suitable as documentation. 4 | * 5 | * Some tests for old macros. These violate our namespace rules and will 6 | * disappear shortly. Use the GC_ names. 7 | */ 8 | #if defined(SOLARIS_THREADS) || defined(_SOLARIS_THREADS) 9 | # define GC_SOLARIS_THREADS 10 | #endif 11 | #if defined(_SOLARIS_PTHREADS) 12 | # define GC_SOLARIS_PTHREADS 13 | #endif 14 | #if defined(IRIX_THREADS) 15 | # define GC_IRIX_THREADS 16 | #endif 17 | #if defined(DGUX_THREADS) 18 | # if !defined(GC_DGUX386_THREADS) 19 | # define GC_DGUX386_THREADS 20 | # endif 21 | #endif 22 | #if defined(AIX_THREADS) 23 | # define GC_AIX_THREADS 24 | #endif 25 | #if defined(HPUX_THREADS) 26 | # define GC_HPUX_THREADS 27 | #endif 28 | #if defined(OSF1_THREADS) 29 | # define GC_OSF1_THREADS 30 | #endif 31 | #if defined(LINUX_THREADS) 32 | # define GC_LINUX_THREADS 33 | #endif 34 | #if defined(WIN32_THREADS) 35 | # define GC_WIN32_THREADS 36 | #endif 37 | #if defined(USE_LD_WRAP) 38 | # define GC_USE_LD_WRAP 39 | #endif 40 | 41 | #if !defined(_REENTRANT) && (defined(GC_SOLARIS_THREADS) \ 42 | || defined(GC_SOLARIS_PTHREADS) \ 43 | || defined(GC_HPUX_THREADS) \ 44 | || defined(GC_AIX_THREADS) \ 45 | || defined(GC_LINUX_THREADS)) 46 | # define _REENTRANT 47 | /* Better late than never. This fails if system headers that */ 48 | /* depend on this were previously included. */ 49 | #endif 50 | 51 | #if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE) 52 | # define _POSIX4A_DRAFT10_SOURCE 1 53 | #endif 54 | 55 | # if defined(GC_SOLARIS_PTHREADS) || defined(GC_FREEBSD_THREADS) || \ 56 | defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \ 57 | defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \ 58 | defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \ 59 | defined(GC_AIX_THREADS) || \ 60 | (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) 61 | # define GC_PTHREADS 62 | # endif 63 | 64 | #if defined(GC_THREADS) && !defined(GC_PTHREADS) 65 | # if defined(__linux__) 66 | # define GC_LINUX_THREADS 67 | # define GC_PTHREADS 68 | # endif 69 | # if !defined(LINUX) && (defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \ 70 | || defined(hppa) || defined(__HPPA)) 71 | # define GC_HPUX_THREADS 72 | # define GC_PTHREADS 73 | # endif 74 | # if !defined(__linux__) && (defined(__alpha) || defined(__alpha__)) 75 | # define GC_OSF1_THREADS 76 | # define GC_PTHREADS 77 | # endif 78 | # if defined(__mips) && !defined(__linux__) 79 | # define GC_IRIX_THREADS 80 | # define GC_PTHREADS 81 | # endif 82 | # if defined(__sparc) && !defined(__linux__) 83 | # define GC_SOLARIS_PTHREADS 84 | # define GC_PTHREADS 85 | # endif 86 | # if defined(__APPLE__) && defined(__MACH__) && defined(__ppc__) 87 | # define GC_DARWIN_THREADS 88 | # define GC_PTHREADS 89 | # endif 90 | # if !defined(GC_PTHREADS) && defined(__FreeBSD__) 91 | # define GC_FREEBSD_THREADS 92 | # define GC_PTHREADS 93 | # endif 94 | # if defined(DGUX) && (defined(i386) || defined(__i386__)) 95 | # define GC_DGUX386_THREADS 96 | # define GC_PTHREADS 97 | # endif 98 | # if defined(_AIX) 99 | # define GC_AIX_THREADS 100 | # define GC_PTHREADS 101 | # endif 102 | #endif /* GC_THREADS */ 103 | 104 | #if defined(GC_THREADS) && !defined(GC_PTHREADS) && \ 105 | (defined(_WIN32) || defined(_MSC_VER) || defined(__CYGWIN__) \ 106 | || defined(__MINGW32__) || defined(__BORLANDC__) \ 107 | || defined(_WIN32_WCE)) 108 | # define GC_WIN32_THREADS 109 | #endif 110 | 111 | #if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS) 112 | # define GC_SOLARIS_THREADS 113 | #endif 114 | 115 | # define __GC 116 | # ifndef _WIN32_WCE 117 | # include 118 | # else /* ! _WIN32_WCE */ 119 | /* Yet more kluges for WinCE */ 120 | # include /* size_t is defined here */ 121 | typedef long ptrdiff_t; /* ptrdiff_t is not defined */ 122 | # endif 123 | 124 | #if defined(_DLL) && !defined(GC_NOT_DLL) && !defined(GC_DLL) 125 | # define GC_DLL 126 | #endif 127 | 128 | #if defined(__MINGW32__) && defined(GC_DLL) 129 | # ifdef GC_BUILD 130 | # define GC_API __declspec(dllexport) 131 | # else 132 | # define GC_API __declspec(dllimport) 133 | # endif 134 | #endif 135 | 136 | #if (defined(__DMC__) || defined(_MSC_VER)) && defined(GC_DLL) 137 | # ifdef GC_BUILD 138 | # define GC_API extern __declspec(dllexport) 139 | # else 140 | # define GC_API __declspec(dllimport) 141 | # endif 142 | #endif 143 | 144 | #if defined(__WATCOMC__) && defined(GC_DLL) 145 | # ifdef GC_BUILD 146 | # define GC_API extern __declspec(dllexport) 147 | # else 148 | # define GC_API extern __declspec(dllimport) 149 | # endif 150 | #endif 151 | 152 | #ifndef GC_API 153 | #define GC_API extern 154 | #endif 155 | 156 | -------------------------------------------------------------------------------- /boehmgc/include/gc_typed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers 3 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. 4 | * Copyright 1996 Silicon Graphics. All rights reserved. 5 | * 6 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 7 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 8 | * 9 | * Permission is hereby granted to use or copy this program 10 | * for any purpose, provided the above notices are retained on all copies. 11 | * Permission to modify the code and to distribute modified code is granted, 12 | * provided the above notices are retained, and a notice that the code was 13 | * modified is included with the above copyright notice. 14 | */ 15 | /* 16 | * Some simple primitives for allocation with explicit type information. 17 | * Facilities for dynamic type inference may be added later. 18 | * Should be used only for extremely performance critical applications, 19 | * or if conservative collector leakage is otherwise a problem (unlikely). 20 | * Note that this is implemented completely separately from the rest 21 | * of the collector, and is not linked in unless referenced. 22 | * This does not currently support GC_DEBUG in any interesting way. 23 | */ 24 | /* Boehm, May 19, 1994 2:13 pm PDT */ 25 | 26 | #ifndef _GC_TYPED_H 27 | # define _GC_TYPED_H 28 | # ifndef _GC_H 29 | # include "gc.h" 30 | # endif 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | typedef GC_word * GC_bitmap; 36 | /* The least significant bit of the first word is one if */ 37 | /* the first word in the object may be a pointer. */ 38 | 39 | # define GC_WORDSZ (8*sizeof(GC_word)) 40 | # define GC_get_bit(bm, index) \ 41 | (((bm)[index/GC_WORDSZ] >> (index%GC_WORDSZ)) & 1) 42 | # define GC_set_bit(bm, index) \ 43 | (bm)[index/GC_WORDSZ] |= ((GC_word)1 << (index%GC_WORDSZ)) 44 | # define GC_WORD_OFFSET(t, f) (offsetof(t,f)/sizeof(GC_word)) 45 | # define GC_WORD_LEN(t) (sizeof(t)/ sizeof(GC_word)) 46 | # define GC_BITMAP_SIZE(t) ((GC_WORD_LEN(t) + GC_WORDSZ-1)/GC_WORDSZ) 47 | 48 | typedef GC_word GC_descr; 49 | 50 | GC_API GC_descr GC_make_descriptor GC_PROTO((GC_bitmap bm, size_t len)); 51 | /* Return a type descriptor for the object whose layout */ 52 | /* is described by the argument. */ 53 | /* The least significant bit of the first word is one */ 54 | /* if the first word in the object may be a pointer. */ 55 | /* The second argument specifies the number of */ 56 | /* meaningful bits in the bitmap. The actual object */ 57 | /* may be larger (but not smaller). Any additional */ 58 | /* words in the object are assumed not to contain */ 59 | /* pointers. */ 60 | /* Returns a conservative approximation in the */ 61 | /* (unlikely) case of insufficient memory to build */ 62 | /* the descriptor. Calls to GC_make_descriptor */ 63 | /* may consume some amount of a finite resource. This */ 64 | /* is intended to be called once per type, not once */ 65 | /* per allocation. */ 66 | 67 | /* It is possible to generate a descriptor for a C type T with */ 68 | /* word aligned pointer fields f1, f2, ... as follows: */ 69 | /* */ 70 | /* GC_descr T_descr; */ 71 | /* GC_word T_bitmap[GC_BITMAP_SIZE(T)] = {0}; */ 72 | /* GC_set_bit(T_bitmap, GC_WORD_OFFSET(T,f1)); */ 73 | /* GC_set_bit(T_bitmap, GC_WORD_OFFSET(T,f2)); */ 74 | /* ... */ 75 | /* T_descr = GC_make_descriptor(T_bitmap, GC_WORD_LEN(T)); */ 76 | 77 | GC_API GC_PTR GC_malloc_explicitly_typed 78 | GC_PROTO((size_t size_in_bytes, GC_descr d)); 79 | /* Allocate an object whose layout is described by d. */ 80 | /* The resulting object MAY NOT BE PASSED TO REALLOC. */ 81 | /* The returned object is cleared. */ 82 | 83 | GC_API GC_PTR GC_malloc_explicitly_typed_ignore_off_page 84 | GC_PROTO((size_t size_in_bytes, GC_descr d)); 85 | 86 | GC_API GC_PTR GC_calloc_explicitly_typed 87 | GC_PROTO((size_t nelements, 88 | size_t element_size_in_bytes, 89 | GC_descr d)); 90 | /* Allocate an array of nelements elements, each of the */ 91 | /* given size, and with the given descriptor. */ 92 | /* The elemnt size must be a multiple of the byte */ 93 | /* alignment required for pointers. E.g. on a 32-bit */ 94 | /* machine with 16-bit aligned pointers, size_in_bytes */ 95 | /* must be a multiple of 2. */ 96 | /* Returned object is cleared. */ 97 | 98 | #ifdef GC_DEBUG 99 | # define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) GC_MALLOC(bytes) 100 | # define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes) 101 | #else 102 | # define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) \ 103 | GC_malloc_explicitly_typed(bytes, d) 104 | # define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) \ 105 | GC_calloc_explicitly_typed(n, bytes, d) 106 | #endif /* !GC_DEBUG */ 107 | 108 | #ifdef __cplusplus 109 | } /* matches extern "C" */ 110 | #endif 111 | 112 | #endif /* _GC_TYPED_H */ 113 | 114 | -------------------------------------------------------------------------------- /vs/troisde/troisde.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 105 | 108 | 111 | 114 | 117 | 120 | 134 | 137 | 140 | 143 | 154 | 157 | 160 | 163 | 166 | 169 | 172 | 175 | 178 | 179 | 180 | 181 | 182 | 183 | 187 | 190 | 191 | 192 | 196 | 197 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /vs/hachetml/hachetml.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 25 | 28 | 31 | 34 | 37 | 40 | 53 | 56 | 59 | 62 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 105 | 108 | 111 | 114 | 117 | 120 | 135 | 138 | 141 | 144 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 176 | 179 | 180 | 181 | 182 | 183 | 184 | 188 | 191 | 192 | 193 | 197 | 198 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /boehmgc/include/gc_gcj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers 3 | * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. 4 | * Copyright 1996-1999 by Silicon Graphics. All rights reserved. 5 | * Copyright 1999 by Hewlett-Packard Company. All rights reserved. 6 | * 7 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 8 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 9 | * 10 | * Permission is hereby granted to use or copy this program 11 | * for any purpose, provided the above notices are retained on all copies. 12 | * Permission to modify the code and to distribute modified code is granted, 13 | * provided the above notices are retained, and a notice that the code was 14 | * modified is included with the above copyright notice. 15 | */ 16 | 17 | /* This file assumes the collector has been compiled with GC_GCJ_SUPPORT */ 18 | /* and that an ANSI C compiler is available. */ 19 | 20 | /* 21 | * We allocate objects whose first word contains a pointer to a struct 22 | * describing the object type. This struct contains a garbage collector mark 23 | * descriptor at offset MARK_DESCR_OFFSET. Alternatively, the objects 24 | * may be marked by the mark procedure passed to GC_init_gcj_malloc. 25 | */ 26 | 27 | #ifndef GC_GCJ_H 28 | 29 | #define GC_GCJ_H 30 | 31 | #ifndef MARK_DESCR_OFFSET 32 | # define MARK_DESCR_OFFSET sizeof(word) 33 | #endif 34 | /* Gcj keeps GC descriptor as second word of vtable. This */ 35 | /* probably needs to be adjusted for other clients. */ 36 | /* We currently assume that this offset is such that: */ 37 | /* - all objects of this kind are large enough to have */ 38 | /* a value at that offset, and */ 39 | /* - it is not zero. */ 40 | /* These assumptions allow objects on the free list to be */ 41 | /* marked normally. */ 42 | 43 | #ifndef _GC_H 44 | # include "gc.h" 45 | #endif 46 | 47 | /* The following allocators signal an out of memory condition with */ 48 | /* return GC_oom_fn(bytes); */ 49 | 50 | /* The following function must be called before the gcj allocators */ 51 | /* can be invoked. */ 52 | /* mp_index and mp are the index and mark_proc (see gc_mark.h) */ 53 | /* respectively for the allocated objects. Mark_proc will be */ 54 | /* used to build the descriptor for objects allocated through the */ 55 | /* debugging interface. The mark_proc will be invoked on all such */ 56 | /* objects with an "environment" value of 1. The client may choose */ 57 | /* to use the same mark_proc for some of its generated mark descriptors.*/ 58 | /* In that case, it should use a different "environment" value to */ 59 | /* detect the presence or absence of the debug header. */ 60 | /* Mp is really of type mark_proc, as defined in gc_mark.h. We don't */ 61 | /* want to include that here for namespace pollution reasons. */ 62 | extern void GC_init_gcj_malloc(int mp_index, void * /* really mark_proc */mp); 63 | 64 | /* Allocate an object, clear it, and store the pointer to the */ 65 | /* type structure (vtable in gcj). */ 66 | /* This adds a byte at the end of the object if GC_malloc would.*/ 67 | extern void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr); 68 | /* The debug versions allocate such that the specified mark_proc */ 69 | /* is always invoked. */ 70 | extern void * GC_debug_gcj_malloc(size_t lb, 71 | void * ptr_to_struct_containing_descr, 72 | GC_EXTRA_PARAMS); 73 | 74 | /* Similar to the above, but the size is in words, and we don't */ 75 | /* adjust it. The size is assumed to be such that it can be */ 76 | /* allocated as a small object. */ 77 | /* Unless it is known that the collector is not configured */ 78 | /* with USE_MARK_BYTES and unless it is known that the object */ 79 | /* has weak alignment requirements, lw must be even. */ 80 | extern void * GC_gcj_fast_malloc(size_t lw, 81 | void * ptr_to_struct_containing_descr); 82 | extern void * GC_debug_gcj_fast_malloc(size_t lw, 83 | void * ptr_to_struct_containing_descr, 84 | GC_EXTRA_PARAMS); 85 | 86 | /* Similar to GC_gcj_malloc, but assumes that a pointer to near the */ 87 | /* beginning of the resulting object is always maintained. */ 88 | extern void * GC_gcj_malloc_ignore_off_page(size_t lb, 89 | void * ptr_to_struct_containing_descr); 90 | 91 | /* The kind numbers of normal and debug gcj objects. */ 92 | /* Useful only for debug support, we hope. */ 93 | extern int GC_gcj_kind; 94 | 95 | extern int GC_gcj_debug_kind; 96 | 97 | # if defined(GC_LOCAL_ALLOC_H) && defined(GC_REDIRECT_TO_LOCAL) 98 | --> gc_local_alloc.h should be included after this. Otherwise 99 | --> we undo the redirection. 100 | # endif 101 | 102 | # ifdef GC_DEBUG 103 | # define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) 104 | # define GC_GCJ_FAST_MALLOC(s,d) GC_debug_gcj_fast_malloc(s,d,GC_EXTRAS) 105 | # define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) 106 | # else 107 | # define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d) 108 | # define GC_GCJ_FAST_MALLOC(s,d) GC_gcj_fast_malloc(s,d) 109 | # define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) \ 110 | GC_gcj_malloc_ignore_off_page(s,d) 111 | # endif 112 | 113 | #endif /* GC_GCJ_H */ 114 | -------------------------------------------------------------------------------- /boehmgc/src/obj_map.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers 3 | * Copyright (c) 1991, 1992 by Xerox Corporation. All rights reserved. 4 | * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. 5 | * 6 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 7 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 8 | * 9 | * Permission is hereby granted to use or copy this program 10 | * for any purpose, provided the above notices are retained on all copies. 11 | * Permission to modify the code and to distribute modified code is granted, 12 | * provided the above notices are retained, and a notice that the code was 13 | * modified is included with the above copyright notice. 14 | */ 15 | 16 | /* Routines for maintaining maps describing heap block 17 | * layouts for various object sizes. Allows fast pointer validity checks 18 | * and fast location of object start locations on machines (such as SPARC) 19 | * with slow division. 20 | */ 21 | 22 | # include "private/gc_priv.h" 23 | 24 | map_entry_type * GC_invalid_map = 0; 25 | 26 | /* Invalidate the object map associated with a block. Free blocks */ 27 | /* are identified by invalid maps. */ 28 | void GC_invalidate_map(hhdr) 29 | hdr *hhdr; 30 | { 31 | register int displ; 32 | 33 | if (GC_invalid_map == 0) { 34 | GC_invalid_map = (map_entry_type *)GC_scratch_alloc(MAP_SIZE); 35 | if (GC_invalid_map == 0) { 36 | GC_err_printf0( 37 | "Cant initialize GC_invalid_map: insufficient memory\n"); 38 | EXIT(); 39 | } 40 | for (displ = 0; displ < HBLKSIZE; displ++) { 41 | MAP_ENTRY(GC_invalid_map, displ) = OBJ_INVALID; 42 | } 43 | } 44 | hhdr -> hb_map = GC_invalid_map; 45 | } 46 | 47 | /* Consider pointers that are offset bytes displaced from the beginning */ 48 | /* of an object to be valid. */ 49 | 50 | # if defined(__STDC__) || defined(__cplusplus) 51 | void GC_register_displacement(GC_word offset) 52 | # else 53 | void GC_register_displacement(offset) 54 | GC_word offset; 55 | # endif 56 | { 57 | DCL_LOCK_STATE; 58 | 59 | DISABLE_SIGNALS(); 60 | LOCK(); 61 | GC_register_displacement_inner(offset); 62 | UNLOCK(); 63 | ENABLE_SIGNALS(); 64 | } 65 | 66 | void GC_register_displacement_inner(offset) 67 | word offset; 68 | { 69 | register unsigned i; 70 | word map_entry = BYTES_TO_WORDS(offset); 71 | 72 | if (offset >= VALID_OFFSET_SZ) { 73 | ABORT("Bad argument to GC_register_displacement"); 74 | } 75 | if (map_entry > MAX_OFFSET) map_entry = OFFSET_TOO_BIG; 76 | if (!GC_valid_offsets[offset]) { 77 | GC_valid_offsets[offset] = TRUE; 78 | GC_modws_valid_offsets[offset % sizeof(word)] = TRUE; 79 | if (!GC_all_interior_pointers) { 80 | for (i = 0; i <= MAXOBJSZ; i++) { 81 | if (GC_obj_map[i] != 0) { 82 | if (i == 0) { 83 | GC_obj_map[i][offset] = (map_entry_type)map_entry; 84 | } else { 85 | register unsigned j; 86 | register unsigned lb = WORDS_TO_BYTES(i); 87 | 88 | if (offset < lb) { 89 | for (j = offset; j < HBLKSIZE; j += lb) { 90 | GC_obj_map[i][j] = (map_entry_type)map_entry; 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | } 98 | } 99 | 100 | 101 | /* Add a heap block map for objects of size sz to obj_map. */ 102 | /* Return FALSE on failure. */ 103 | GC_bool GC_add_map_entry(sz) 104 | word sz; 105 | { 106 | register unsigned obj_start; 107 | register unsigned displ; 108 | register map_entry_type * new_map; 109 | word map_entry; 110 | 111 | if (sz > MAXOBJSZ) sz = 0; 112 | if (GC_obj_map[sz] != 0) { 113 | return(TRUE); 114 | } 115 | new_map = (map_entry_type *)GC_scratch_alloc(MAP_SIZE); 116 | if (new_map == 0) return(FALSE); 117 | # ifdef PRINTSTATS 118 | GC_printf1("Adding block map for size %lu\n", (unsigned long)sz); 119 | # endif 120 | for (displ = 0; displ < HBLKSIZE; displ++) { 121 | MAP_ENTRY(new_map,displ) = OBJ_INVALID; 122 | } 123 | if (sz == 0) { 124 | for(displ = 0; displ <= HBLKSIZE; displ++) { 125 | if (OFFSET_VALID(displ)) { 126 | map_entry = BYTES_TO_WORDS(displ); 127 | if (map_entry > MAX_OFFSET) map_entry = OFFSET_TOO_BIG; 128 | MAP_ENTRY(new_map,displ) = (map_entry_type)map_entry; 129 | } 130 | } 131 | } else { 132 | for (obj_start = 0; 133 | obj_start + WORDS_TO_BYTES(sz) <= HBLKSIZE; 134 | obj_start += WORDS_TO_BYTES(sz)) { 135 | for (displ = 0; displ < WORDS_TO_BYTES(sz); displ++) { 136 | if (OFFSET_VALID(displ)) { 137 | map_entry = BYTES_TO_WORDS(displ); 138 | if (map_entry > MAX_OFFSET) map_entry = OFFSET_TOO_BIG; 139 | MAP_ENTRY(new_map, obj_start + displ) = 140 | (map_entry_type)map_entry; 141 | } 142 | } 143 | } 144 | } 145 | GC_obj_map[sz] = new_map; 146 | return(TRUE); 147 | } 148 | -------------------------------------------------------------------------------- /boehmgc/src/specific.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | 14 | #include "private/gc_priv.h" /* For GC_compare_and_exchange, GC_memory_barrier */ 15 | 16 | #if defined(GC_LINUX_THREADS) 17 | 18 | #include "private/specific.h" 19 | 20 | static tse invalid_tse = {INVALID_QTID, 0, 0, INVALID_THREADID}; 21 | /* A thread-specific data entry which will never */ 22 | /* appear valid to a reader. Used to fill in empty */ 23 | /* cache entries to avoid a check for 0. */ 24 | 25 | int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)) { 26 | int i; 27 | tsd * result = (tsd *)MALLOC_CLEAR(sizeof (tsd)); 28 | 29 | /* A quick alignment check, since we need atomic stores */ 30 | GC_ASSERT((unsigned long)(&invalid_tse.next) % sizeof(tse *) == 0); 31 | if (0 == result) return ENOMEM; 32 | pthread_mutex_init(&(result -> lock), NULL); 33 | for (i = 0; i < TS_CACHE_SIZE; ++i) { 34 | result -> cache[i] = &invalid_tse; 35 | } 36 | # ifdef GC_ASSERTIONS 37 | for (i = 0; i < TS_HASH_SIZE; ++i) { 38 | GC_ASSERT(result -> hash[i] == 0); 39 | } 40 | # endif 41 | *key_ptr = result; 42 | return 0; 43 | } 44 | 45 | int PREFIXED(setspecific) (tsd * key, void * value) { 46 | pthread_t self = pthread_self(); 47 | int hash_val = HASH(self); 48 | volatile tse * entry = (volatile tse *)MALLOC_CLEAR(sizeof (tse)); 49 | 50 | GC_ASSERT(self != INVALID_THREADID); 51 | if (0 == entry) return ENOMEM; 52 | pthread_mutex_lock(&(key -> lock)); 53 | /* Could easily check for an existing entry here. */ 54 | entry -> next = key -> hash[hash_val]; 55 | entry -> thread = self; 56 | entry -> value = value; 57 | GC_ASSERT(entry -> qtid == INVALID_QTID); 58 | /* There can only be one writer at a time, but this needs to be */ 59 | /* atomic with respect to concurrent readers. */ 60 | *(volatile tse **)(key -> hash + hash_val) = entry; 61 | pthread_mutex_unlock(&(key -> lock)); 62 | return 0; 63 | } 64 | 65 | /* Remove thread-specific data for this thread. Should be called on */ 66 | /* thread exit. */ 67 | void PREFIXED(remove_specific) (tsd * key) { 68 | pthread_t self = pthread_self(); 69 | unsigned hash_val = HASH(self); 70 | tse *entry; 71 | tse **link = key -> hash + hash_val; 72 | 73 | pthread_mutex_lock(&(key -> lock)); 74 | entry = *link; 75 | while (entry != NULL && entry -> thread != self) { 76 | link = &(entry -> next); 77 | entry = *link; 78 | } 79 | /* Invalidate qtid field, since qtids may be reused, and a later */ 80 | /* cache lookup could otherwise find this entry. */ 81 | entry -> qtid = INVALID_QTID; 82 | if (entry != NULL) { 83 | *link = entry -> next; 84 | /* Atomic! concurrent accesses still work. */ 85 | /* They must, since readers don't lock. */ 86 | /* We shouldn't need a volatile access here, */ 87 | /* since both this and the preceding write */ 88 | /* should become visible no later than */ 89 | /* the pthread_mutex_unlock() call. */ 90 | } 91 | /* If we wanted to deallocate the entry, we'd first have to clear */ 92 | /* any cache entries pointing to it. That probably requires */ 93 | /* additional synchronization, since we can't prevent a concurrent */ 94 | /* cache lookup, which should still be examining deallocated memory.*/ 95 | /* This can only happen if the concurrent access is from another */ 96 | /* thread, and hence has missed the cache, but still... */ 97 | 98 | /* With GC, we're done, since the pointers from the cache will */ 99 | /* be overwritten, all local pointers to the entries will be */ 100 | /* dropped, and the entry will then be reclaimed. */ 101 | pthread_mutex_unlock(&(key -> lock)); 102 | } 103 | 104 | /* Note that even the slow path doesn't lock. */ 105 | void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid, 106 | tse * volatile * cache_ptr) { 107 | pthread_t self = pthread_self(); 108 | unsigned hash_val = HASH(self); 109 | tse *entry = key -> hash[hash_val]; 110 | 111 | GC_ASSERT(qtid != INVALID_QTID); 112 | while (entry != NULL && entry -> thread != self) { 113 | entry = entry -> next; 114 | } 115 | if (entry == NULL) return NULL; 116 | /* Set cache_entry. */ 117 | entry -> qtid = qtid; 118 | /* It's safe to do this asynchronously. Either value */ 119 | /* is safe, though may produce spurious misses. */ 120 | /* We're replacing one qtid with another one for the */ 121 | /* same thread. */ 122 | *cache_ptr = entry; 123 | /* Again this is safe since pointer assignments are */ 124 | /* presumed atomic, and either pointer is valid. */ 125 | return entry -> value; 126 | } 127 | 128 | #endif /* GC_LINUX_THREADS */ 129 | -------------------------------------------------------------------------------- /vs/troisde/troisde.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {48EA9BD8-85C0-4D69-9E6D-57BB8FA20403} 15 | Win32Proj 16 | 17 | 18 | 19 | DynamicLibrary 20 | v140 21 | MultiByte 22 | 23 | 24 | DynamicLibrary 25 | v140 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>14.0.22823.1 42 | 43 | 44 | Debug\ 45 | Debug\ 46 | true 47 | 48 | 49 | Release\ 50 | Release\ 51 | false 52 | 53 | 54 | 55 | Disabled 56 | WIN32;_DEBUG;_WINDOWS;_USRDLL;TROISDE_EXPORTS;%(PreprocessorDefinitions) 57 | true 58 | EnableFastChecks 59 | MultiThreadedDebug 60 | 61 | Level3 62 | EditAndContinue 63 | 64 | 65 | Glu32.lib;Opengl32.lib;glut32.lib;%(AdditionalDependencies) 66 | ../../lib/troisde.dll 67 | true 68 | $(OutDir)troisde.pdb 69 | Windows 70 | $(OutDir)troisde.lib 71 | MachineX86 72 | 73 | 74 | 75 | 76 | MaxSpeed 77 | OnlyExplicitInline 78 | true 79 | WIN32;NDEBUG;_WINDOWS;_USRDLL;TROISDE_EXPORTS;%(PreprocessorDefinitions) 80 | true 81 | MultiThreaded 82 | true 83 | 84 | Level3 85 | ProgramDatabase 86 | 87 | 88 | ../distrwin/lib/troisde.dll 89 | true 90 | Windows 91 | true 92 | true 93 | $(OutDir)troisde.lib 94 | MachineX86 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /boehmgc/src/pcr_interface.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | # include "private/gc_priv.h" 14 | 15 | # ifdef PCR 16 | /* 17 | * Note that POSIX PCR requires an ANSI C compiler. Hence we are allowed 18 | * to make the same assumption here. 19 | * We wrap all of the allocator functions to avoid questions of 20 | * compatibility between the prototyped and nonprototyped versions of the f 21 | */ 22 | # include "config/PCR_StdTypes.h" 23 | # include "mm/PCR_MM.h" 24 | # include 25 | 26 | # define MY_MAGIC 17L 27 | # define MY_DEBUGMAGIC 42L 28 | 29 | void * GC_AllocProc(size_t size, PCR_Bool ptrFree, PCR_Bool clear ) 30 | { 31 | if (ptrFree) { 32 | void * result = (void *)GC_malloc_atomic(size); 33 | if (clear && result != 0) BZERO(result, size); 34 | return(result); 35 | } else { 36 | return((void *)GC_malloc(size)); 37 | } 38 | } 39 | 40 | void * GC_DebugAllocProc(size_t size, PCR_Bool ptrFree, PCR_Bool clear ) 41 | { 42 | if (ptrFree) { 43 | void * result = (void *)GC_debug_malloc_atomic(size, __FILE__, 44 | __LINE__); 45 | if (clear && result != 0) BZERO(result, size); 46 | return(result); 47 | } else { 48 | return((void *)GC_debug_malloc(size, __FILE__, __LINE__)); 49 | } 50 | } 51 | 52 | # define GC_ReallocProc GC_realloc 53 | void * GC_DebugReallocProc(void * old_object, size_t new_size_in_bytes) 54 | { 55 | return(GC_debug_realloc(old_object, new_size_in_bytes, __FILE__, __LINE__)); 56 | } 57 | 58 | # define GC_FreeProc GC_free 59 | # define GC_DebugFreeProc GC_debug_free 60 | 61 | typedef struct { 62 | PCR_ERes (*ed_proc)(void *p, size_t size, PCR_Any data); 63 | GC_bool ed_pointerfree; 64 | PCR_ERes ed_fail_code; 65 | PCR_Any ed_client_data; 66 | } enumerate_data; 67 | 68 | void GC_enumerate_block(h, ed) 69 | register struct hblk *h; 70 | enumerate_data * ed; 71 | { 72 | register hdr * hhdr; 73 | register int sz; 74 | word *p; 75 | word * lim; 76 | 77 | hhdr = HDR(h); 78 | sz = hhdr -> hb_sz; 79 | if (sz >= 0 && ed -> ed_pointerfree 80 | || sz <= 0 && !(ed -> ed_pointerfree)) return; 81 | if (sz < 0) sz = -sz; 82 | lim = (word *)(h+1) - sz; 83 | p = (word *)h; 84 | do { 85 | if (PCR_ERes_IsErr(ed -> ed_fail_code)) return; 86 | ed -> ed_fail_code = 87 | (*(ed -> ed_proc))(p, WORDS_TO_BYTES(sz), ed -> ed_client_data); 88 | p+= sz; 89 | } while (p <= lim); 90 | } 91 | 92 | struct PCR_MM_ProcsRep * GC_old_allocator = 0; 93 | 94 | PCR_ERes GC_EnumerateProc( 95 | PCR_Bool ptrFree, 96 | PCR_ERes (*proc)(void *p, size_t size, PCR_Any data), 97 | PCR_Any data 98 | ) 99 | { 100 | enumerate_data ed; 101 | 102 | ed.ed_proc = proc; 103 | ed.ed_pointerfree = ptrFree; 104 | ed.ed_fail_code = PCR_ERes_okay; 105 | ed.ed_client_data = data; 106 | GC_apply_to_all_blocks(GC_enumerate_block, &ed); 107 | if (ed.ed_fail_code != PCR_ERes_okay) { 108 | return(ed.ed_fail_code); 109 | } else { 110 | /* Also enumerate objects allocated by my predecessors */ 111 | return((*(GC_old_allocator->mmp_enumerate))(ptrFree, proc, data)); 112 | } 113 | } 114 | 115 | void GC_DummyFreeProc(void *p) {} 116 | 117 | void GC_DummyShutdownProc(void) {} 118 | 119 | struct PCR_MM_ProcsRep GC_Rep = { 120 | MY_MAGIC, 121 | GC_AllocProc, 122 | GC_ReallocProc, 123 | GC_DummyFreeProc, /* mmp_free */ 124 | GC_FreeProc, /* mmp_unsafeFree */ 125 | GC_EnumerateProc, 126 | GC_DummyShutdownProc /* mmp_shutdown */ 127 | }; 128 | 129 | struct PCR_MM_ProcsRep GC_DebugRep = { 130 | MY_DEBUGMAGIC, 131 | GC_DebugAllocProc, 132 | GC_DebugReallocProc, 133 | GC_DummyFreeProc, /* mmp_free */ 134 | GC_DebugFreeProc, /* mmp_unsafeFree */ 135 | GC_EnumerateProc, 136 | GC_DummyShutdownProc /* mmp_shutdown */ 137 | }; 138 | 139 | GC_bool GC_use_debug = 0; 140 | 141 | void GC_pcr_install() 142 | { 143 | PCR_MM_Install((GC_use_debug? &GC_DebugRep : &GC_Rep), &GC_old_allocator); 144 | } 145 | 146 | PCR_ERes 147 | PCR_GC_Setup(void) 148 | { 149 | return PCR_ERes_okay; 150 | } 151 | 152 | PCR_ERes 153 | PCR_GC_Run(void) 154 | { 155 | 156 | if( !PCR_Base_TestPCRArg("-nogc") ) { 157 | GC_quiet = ( PCR_Base_TestPCRArg("-gctrace") ? 0 : 1 ); 158 | GC_use_debug = (GC_bool)PCR_Base_TestPCRArg("-debug_alloc"); 159 | GC_init(); 160 | if( !PCR_Base_TestPCRArg("-nogc_incremental") ) { 161 | /* 162 | * awful hack to test whether VD is implemented ... 163 | */ 164 | if( PCR_VD_Start( 0, NIL, 0) != PCR_ERes_FromErr(ENOSYS) ) { 165 | GC_enable_incremental(); 166 | } 167 | } 168 | } 169 | return PCR_ERes_okay; 170 | } 171 | 172 | void GC_push_thread_structures(void) 173 | { 174 | /* PCR doesn't work unless static roots are pushed. Can't get here. */ 175 | ABORT("In GC_push_thread_structures()"); 176 | } 177 | 178 | # endif 179 | -------------------------------------------------------------------------------- /vs/hachetml/hachetml.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {D642DF84-2186-4F68-8C4D-45B4E821336B} 15 | Win32Proj 16 | 17 | 18 | 19 | DynamicLibrary 20 | v140 21 | MultiByte 22 | 23 | 24 | DynamicLibrary 25 | v140 26 | Unicode 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | <_ProjectFileVersion>14.0.22823.1 42 | 43 | 44 | Debug\ 45 | Debug\ 46 | true 47 | 48 | 49 | Release\ 50 | Release\ 51 | false 52 | 53 | 54 | 55 | Disabled 56 | ../../;%(AdditionalIncludeDirectories) 57 | WIN32;_DEBUG;_WINDOWS;_USRDLL;HACHETML_EXPORTS;%(PreprocessorDefinitions) 58 | true 59 | EnableFastChecks 60 | MultiThreadedDebug 61 | 62 | Level3 63 | EditAndContinue 64 | 65 | 66 | ../../lib/hachetml.dll 67 | true 68 | $(OutDir)hachetml.pdb 69 | Windows 70 | $(OutDir)hachetml.lib 71 | MachineX86 72 | 73 | 74 | 75 | 76 | MaxSpeed 77 | OnlyExplicitInline 78 | true 79 | ../../;%(AdditionalIncludeDirectories) 80 | WIN32;NDEBUG;_WINDOWS;_USRDLL;HACHETML_EXPORTS;%(PreprocessorDefinitions) 81 | true 82 | MultiThreaded 83 | true 84 | 85 | Level3 86 | ProgramDatabase 87 | 88 | 89 | ../Goto++/distrwin/lib/hachetml.dll 90 | true 91 | Windows 92 | true 93 | true 94 | $(OutDir)hachetml.lib 95 | MachineX86 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /boehmgc/src/solaris_pthreads.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | /* 14 | * Support code for Solaris threads. Provides functionality we wish Sun 15 | * had provided. Relies on some information we probably shouldn't rely on. 16 | * Modified by Peter C. for Solaris Posix Threads. 17 | */ 18 | 19 | # include "private/gc_priv.h" 20 | 21 | # if defined(GC_SOLARIS_PTHREADS) 22 | # include 23 | # include 24 | # include 25 | # include 26 | # include 27 | # include 28 | # include 29 | # include 30 | # include 31 | # include 32 | # include 33 | # include 34 | # include 35 | # define _CLASSIC_XOPEN_TYPES 36 | # include 37 | # include 38 | # include "private/solaris_threads.h" 39 | # include 40 | 41 | #undef pthread_join 42 | #undef pthread_create 43 | 44 | pthread_cond_t GC_prom_join_cv; /* Broadcast when any thread terminates */ 45 | pthread_cond_t GC_create_cv; /* Signalled when a new undetached */ 46 | /* thread starts. */ 47 | 48 | extern GC_bool GC_multithreaded; 49 | 50 | /* We use the allocation lock to protect thread-related data structures. */ 51 | 52 | /* We stop the world using /proc primitives. This makes some */ 53 | /* minimal assumptions about the threads implementation. */ 54 | /* We don't play by the rules, since the rules make this */ 55 | /* impossible (as of Solaris 2.3). Also note that as of */ 56 | /* Solaris 2.3 the various thread and lwp suspension */ 57 | /* primitives failed to stop threads by the time the request */ 58 | /* is completed. */ 59 | 60 | 61 | 62 | int GC_pthread_join(pthread_t wait_for, void **status) 63 | { 64 | return GC_thr_join((thread_t)wait_for, NULL, status); 65 | } 66 | 67 | 68 | int 69 | GC_pthread_create(pthread_t *new_thread, 70 | const pthread_attr_t *attr_in, 71 | void * (*thread_execp)(void *), void *arg) 72 | { 73 | int result; 74 | GC_thread t; 75 | pthread_t my_new_thread; 76 | pthread_attr_t attr; 77 | word my_flags = 0; 78 | int flag; 79 | void * stack = 0; 80 | size_t stack_size = 0; 81 | int n; 82 | struct sched_param schedparam; 83 | 84 | (void)pthread_attr_init(&attr); 85 | if (attr_in != 0) { 86 | (void)pthread_attr_getstacksize(attr_in, &stack_size); 87 | (void)pthread_attr_getstackaddr(attr_in, &stack); 88 | } 89 | 90 | LOCK(); 91 | if (!GC_is_initialized) { 92 | GC_init_inner(); 93 | } 94 | GC_multithreaded++; 95 | 96 | if (stack == 0) { 97 | if (stack_size == 0) 98 | stack_size = 1048576; 99 | /* ^-- 1 MB (this was GC_min_stack_sz, but that 100 | * violates the pthread_create documentation which 101 | * says the default value if none is supplied is 102 | * 1MB) */ 103 | else 104 | stack_size += thr_min_stack(); 105 | 106 | stack = (void *)GC_stack_alloc(&stack_size); 107 | if (stack == 0) { 108 | GC_multithreaded--; 109 | UNLOCK(); 110 | errno = ENOMEM; 111 | return -1; 112 | } 113 | } else { 114 | my_flags |= CLIENT_OWNS_STACK; 115 | } 116 | (void)pthread_attr_setstacksize(&attr, stack_size); 117 | (void)pthread_attr_setstackaddr(&attr, stack); 118 | if (attr_in != 0) { 119 | (void)pthread_attr_getscope(attr_in, &n); 120 | (void)pthread_attr_setscope(&attr, n); 121 | (void)pthread_attr_getschedparam(attr_in, &schedparam); 122 | (void)pthread_attr_setschedparam(&attr, &schedparam); 123 | (void)pthread_attr_getschedpolicy(attr_in, &n); 124 | (void)pthread_attr_setschedpolicy(&attr, n); 125 | (void)pthread_attr_getinheritsched(attr_in, &n); 126 | (void)pthread_attr_setinheritsched(&attr, n); 127 | 128 | (void)pthread_attr_getdetachstate(attr_in, &flag); 129 | if (flag == PTHREAD_CREATE_DETACHED) { 130 | my_flags |= DETACHED; 131 | } 132 | (void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); 133 | } 134 | /* 135 | * thr_create can call malloc(), which if redirected will 136 | * attempt to acquire the allocation lock. 137 | * Unlock here to prevent deadlock. 138 | */ 139 | 140 | 141 | #if 0 142 | #ifdef I386 143 | UNLOCK(); 144 | #endif 145 | #endif 146 | result = 147 | pthread_create(&my_new_thread, &attr, thread_execp, arg); 148 | #if 0 149 | #ifdef I386 150 | LOCK(); 151 | #endif 152 | #endif 153 | if (result == 0) { 154 | t = GC_new_thread(my_new_thread); 155 | t -> flags = my_flags; 156 | if (!(my_flags & DETACHED)) cond_init(&(t->join_cv), USYNC_THREAD, 0); 157 | t -> stack = stack; 158 | t -> stack_size = stack_size; 159 | if (new_thread != 0) *new_thread = my_new_thread; 160 | pthread_cond_signal(&GC_create_cv); 161 | } else { 162 | if (!(my_flags & CLIENT_OWNS_STACK)) { 163 | GC_stack_free(stack, stack_size); 164 | } 165 | GC_multithreaded--; 166 | } 167 | UNLOCK(); 168 | pthread_attr_destroy(&attr); 169 | return(result); 170 | } 171 | 172 | # else 173 | 174 | #ifndef LINT 175 | int GC_no_sunOS_pthreads; 176 | #endif 177 | 178 | # endif /* GC_SOLARIS_PTHREADS */ 179 | 180 | -------------------------------------------------------------------------------- /boehmgc/src/checksums.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1992-1994 by Xerox Corporation. All rights reserved. 3 | * 4 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 5 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 6 | * 7 | * Permission is hereby granted to use or copy this program 8 | * for any purpose, provided the above notices are retained on all copies. 9 | * Permission to modify the code and to distribute modified code is granted, 10 | * provided the above notices are retained, and a notice that the code was 11 | * modified is included with the above copyright notice. 12 | */ 13 | /* Boehm, March 29, 1995 12:51 pm PST */ 14 | # ifdef CHECKSUMS 15 | 16 | # include "private/gc_priv.h" 17 | 18 | /* This is debugging code intended to verify the results of dirty bit */ 19 | /* computations. Works only in a single threaded environment. */ 20 | /* We assume that stubborn objects are changed only when they are */ 21 | /* enabled for writing. (Certain kinds of writing are actually */ 22 | /* safe under other conditions.) */ 23 | # define NSUMS 10000 24 | 25 | # define OFFSET 0x10000 26 | 27 | typedef struct { 28 | GC_bool new_valid; 29 | word old_sum; 30 | word new_sum; 31 | struct hblk * block; /* Block to which this refers + OFFSET */ 32 | /* to hide it from collector. */ 33 | } page_entry; 34 | 35 | page_entry GC_sums [NSUMS]; 36 | 37 | word GC_checksum(h) 38 | struct hblk *h; 39 | { 40 | register word *p = (word *)h; 41 | register word *lim = (word *)(h+1); 42 | register word result = 0; 43 | 44 | while (p < lim) { 45 | result += *p++; 46 | } 47 | return(result | 0x80000000 /* doesn't look like pointer */); 48 | } 49 | 50 | # ifdef STUBBORN_ALLOC 51 | /* Check whether a stubborn object from the given block appears on */ 52 | /* the appropriate free list. */ 53 | GC_bool GC_on_free_list(h) 54 | struct hblk *h; 55 | { 56 | register hdr * hhdr = HDR(h); 57 | register int sz = hhdr -> hb_sz; 58 | ptr_t p; 59 | 60 | if (sz > MAXOBJSZ) return(FALSE); 61 | for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) { 62 | if (HBLKPTR(p) == h) return(TRUE); 63 | } 64 | return(FALSE); 65 | } 66 | # endif 67 | 68 | int GC_n_dirty_errors; 69 | int GC_n_changed_errors; 70 | int GC_n_clean; 71 | int GC_n_dirty; 72 | 73 | void GC_update_check_page(h, index) 74 | struct hblk *h; 75 | int index; 76 | { 77 | page_entry *pe = GC_sums + index; 78 | register hdr * hhdr = HDR(h); 79 | struct hblk *b; 80 | 81 | if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed"); 82 | pe -> old_sum = pe -> new_sum; 83 | pe -> new_sum = GC_checksum(h); 84 | # if !defined(MSWIN32) && !defined(MSWINCE) 85 | if (pe -> new_sum != 0x80000000 && !GC_page_was_ever_dirty(h)) { 86 | GC_printf1("GC_page_was_ever_dirty(0x%lx) is wrong\n", 87 | (unsigned long)h); 88 | } 89 | # endif 90 | if (GC_page_was_dirty(h)) { 91 | GC_n_dirty++; 92 | } else { 93 | GC_n_clean++; 94 | } 95 | b = h; 96 | while (IS_FORWARDING_ADDR_OR_NIL(hhdr) && hhdr != 0) { 97 | b -= (word)hhdr; 98 | hhdr = HDR(b); 99 | } 100 | if (pe -> new_valid 101 | && hhdr != 0 && hhdr -> hb_descr != 0 /* may contain pointers */ 102 | && pe -> old_sum != pe -> new_sum) { 103 | if (!GC_page_was_dirty(h) || !GC_page_was_ever_dirty(h)) { 104 | /* Set breakpoint here */GC_n_dirty_errors++; 105 | } 106 | # ifdef STUBBORN_ALLOC 107 | if ( hhdr -> hb_map != GC_invalid_map 108 | && hhdr -> hb_obj_kind == STUBBORN 109 | && !GC_page_was_changed(h) 110 | && !GC_on_free_list(h)) { 111 | /* if GC_on_free_list(h) then reclaim may have touched it */ 112 | /* without any allocations taking place. */ 113 | /* Set breakpoint here */GC_n_changed_errors++; 114 | } 115 | # endif 116 | } 117 | pe -> new_valid = TRUE; 118 | pe -> block = h + OFFSET; 119 | } 120 | 121 | word GC_bytes_in_used_blocks; 122 | 123 | void GC_add_block(h, dummy) 124 | struct hblk *h; 125 | word dummy; 126 | { 127 | register hdr * hhdr = HDR(h); 128 | register bytes = WORDS_TO_BYTES(hhdr -> hb_sz); 129 | 130 | bytes += HBLKSIZE-1; 131 | bytes &= ~(HBLKSIZE-1); 132 | GC_bytes_in_used_blocks += bytes; 133 | } 134 | 135 | void GC_check_blocks() 136 | { 137 | word bytes_in_free_blocks = GC_large_free_bytes; 138 | 139 | GC_bytes_in_used_blocks = 0; 140 | GC_apply_to_all_blocks(GC_add_block, (word)0); 141 | GC_printf2("GC_bytes_in_used_blocks = %ld, bytes_in_free_blocks = %ld ", 142 | GC_bytes_in_used_blocks, bytes_in_free_blocks); 143 | GC_printf1("GC_heapsize = %ld\n", GC_heapsize); 144 | if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) { 145 | GC_printf0("LOST SOME BLOCKS!!\n"); 146 | } 147 | } 148 | 149 | /* Should be called immediately after GC_read_dirty and GC_read_changed. */ 150 | void GC_check_dirty() 151 | { 152 | register int index; 153 | register unsigned i; 154 | register struct hblk *h; 155 | register ptr_t start; 156 | 157 | GC_check_blocks(); 158 | 159 | GC_n_dirty_errors = 0; 160 | GC_n_changed_errors = 0; 161 | GC_n_clean = 0; 162 | GC_n_dirty = 0; 163 | 164 | index = 0; 165 | for (i = 0; i < GC_n_heap_sects; i++) { 166 | start = GC_heap_sects[i].hs_start; 167 | for (h = (struct hblk *)start; 168 | h < (struct hblk *)(start + GC_heap_sects[i].hs_bytes); 169 | h++) { 170 | GC_update_check_page(h, index); 171 | index++; 172 | if (index >= NSUMS) goto out; 173 | } 174 | } 175 | out: 176 | GC_printf2("Checked %lu clean and %lu dirty pages\n", 177 | (unsigned long) GC_n_clean, (unsigned long) GC_n_dirty); 178 | if (GC_n_dirty_errors > 0) { 179 | GC_printf1("Found %lu dirty bit errors\n", 180 | (unsigned long)GC_n_dirty_errors); 181 | } 182 | if (GC_n_changed_errors > 0) { 183 | GC_printf1("Found %lu changed bit errors\n", 184 | (unsigned long)GC_n_changed_errors); 185 | GC_printf0("These may be benign (provoked by nonpointer changes)\n"); 186 | # ifdef THREADS 187 | GC_printf0( 188 | "Also expect 1 per thread currently allocating a stubborn obj.\n"); 189 | # endif 190 | } 191 | } 192 | 193 | # else 194 | 195 | extern int GC_quiet; 196 | /* ANSI C doesn't allow translation units to be empty. */ 197 | /* So we guarantee this one is nonempty. */ 198 | 199 | # endif /* CHECKSUMS */ 200 | -------------------------------------------------------------------------------- /boehmgc/include/private/dbg_mlc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers 3 | * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. 4 | * Copyright (c) 1997 by Silicon Graphics. All rights reserved. 5 | * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved. 6 | * 7 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED 8 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 9 | * 10 | * Permission is hereby granted to use or copy this program 11 | * for any purpose, provided the above notices are retained on all copies. 12 | * Permission to modify the code and to distribute modified code is granted, 13 | * provided the above notices are retained, and a notice that the code was 14 | * modified is included with the above copyright notice. 15 | */ 16 | 17 | /* 18 | * This is mostly an internal header file. Typical clients should 19 | * not use it. Clients that define their own object kinds with 20 | * debugging allocators will probably want to include this, however. 21 | * No attempt is made to keep the namespace clean. This should not be 22 | * included from header files that are frequently included by clients. 23 | */ 24 | 25 | #ifndef _DBG_MLC_H 26 | 27 | #define _DBG_MLC_H 28 | 29 | # define I_HIDE_POINTERS 30 | # include "gc_priv.h" 31 | # ifdef KEEP_BACK_PTRS 32 | # include "gc_backptr.h" 33 | # endif 34 | 35 | #ifndef HIDE_POINTER 36 | /* Gc.h was previously included, and hence the I_HIDE_POINTERS */ 37 | /* definition had no effect. Repeat the gc.h definitions here to */ 38 | /* get them anyway. */ 39 | typedef GC_word GC_hidden_pointer; 40 | # define HIDE_POINTER(p) (~(GC_hidden_pointer)(p)) 41 | # define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p))) 42 | #endif /* HIDE_POINTER */ 43 | 44 | # define START_FLAG ((word)0xfedcedcb) 45 | # define END_FLAG ((word)0xbcdecdef) 46 | /* Stored both one past the end of user object, and one before */ 47 | /* the end of the object as seen by the allocator. */ 48 | 49 | # if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) \ 50 | || defined(MAKE_BACK_GRAPH) 51 | /* Pointer "source"s that aren't real locations. */ 52 | /* Used in oh_back_ptr fields and as "source" */ 53 | /* argument to some marking functions. */ 54 | # define NOT_MARKED (ptr_t)(0) 55 | # define MARKED_FOR_FINALIZATION (ptr_t)(2) 56 | /* Object was marked because it is finalizable. */ 57 | # define MARKED_FROM_REGISTER (ptr_t)(4) 58 | /* Object was marked from a rgister. Hence the */ 59 | /* source of the reference doesn't have an address. */ 60 | # endif /* KEEP_BACK_PTRS || PRINT_BLACK_LIST */ 61 | 62 | /* Object header */ 63 | typedef struct { 64 | # if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) 65 | /* We potentially keep two different kinds of back */ 66 | /* pointers. KEEP_BACK_PTRS stores a single back */ 67 | /* pointer in each reachable object to allow reporting */ 68 | /* of why an object was retained. MAKE_BACK_GRAPH */ 69 | /* builds a graph containing the inverse of all */ 70 | /* "points-to" edges including those involving */ 71 | /* objects that have just become unreachable. This */ 72 | /* allows detection of growing chains of unreachable */ 73 | /* objects. It may be possible to eventually combine */ 74 | /* both, but for now we keep them separate. Both */ 75 | /* kinds of back pointers are hidden using the */ 76 | /* following macros. In both cases, the plain version */ 77 | /* is constrained to have an least significant bit of 1,*/ 78 | /* to allow it to be distinguished from a free list */ 79 | /* link. This means the plain version must have an */ 80 | /* lsb of 0. */ 81 | /* Note that blocks dropped by black-listing will */ 82 | /* also have the lsb clear once debugging has */ 83 | /* started. */ 84 | /* We're careful never to overwrite a value with lsb 0. */ 85 | # if ALIGNMENT == 1 86 | /* Fudge back pointer to be even. */ 87 | # define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p)) 88 | # else 89 | # define HIDE_BACK_PTR(p) HIDE_POINTER(p) 90 | # endif 91 | 92 | # ifdef KEEP_BACK_PTRS 93 | GC_hidden_pointer oh_back_ptr; 94 | # endif 95 | # ifdef MAKE_BACK_GRAPH 96 | GC_hidden_pointer oh_bg_ptr; 97 | # endif 98 | # if defined(ALIGN_DOUBLE) && \ 99 | (defined(KEEP_BACK_PTRS) != defined(MAKE_BACK_GRAPH)) 100 | word oh_dummy; 101 | # endif 102 | # endif 103 | GC_CONST char * oh_string; /* object descriptor string */ 104 | word oh_int; /* object descriptor integers */ 105 | # ifdef NEED_CALLINFO 106 | struct callinfo oh_ci[NFRAMES]; 107 | # endif 108 | # ifndef SHORT_DBG_HDRS 109 | word oh_sz; /* Original malloc arg. */ 110 | word oh_sf; /* start flag */ 111 | # endif /* SHORT_DBG_HDRS */ 112 | } oh; 113 | /* The size of the above structure is assumed not to dealign things, */ 114 | /* and to be a multiple of the word length. */ 115 | 116 | #ifdef SHORT_DBG_HDRS 117 | # define DEBUG_BYTES (sizeof (oh)) 118 | # define UNCOLLECTABLE_DEBUG_BYTES DEBUG_BYTES 119 | #else 120 | /* Add space for END_FLAG, but use any extra space that was already */ 121 | /* added to catch off-the-end pointers. */ 122 | /* For uncollectable objects, the extra byte is not added. */ 123 | # define UNCOLLECTABLE_DEBUG_BYTES (sizeof (oh) + sizeof (word)) 124 | # define DEBUG_BYTES (UNCOLLECTABLE_DEBUG_BYTES - EXTRA_BYTES) 125 | #endif 126 | 127 | /* Round bytes to words without adding extra byte at end. */ 128 | #define SIMPLE_ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1) 129 | 130 | /* ADD_CALL_CHAIN stores a (partial) call chain into an object */ 131 | /* header. It may be called with or without the allocation */ 132 | /* lock. */ 133 | /* PRINT_CALL_CHAIN prints the call chain stored in an object */ 134 | /* to stderr. It requires that we do not hold the lock. */ 135 | #ifdef SAVE_CALL_CHAIN 136 | # define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci) 137 | # define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci) 138 | #else 139 | # ifdef GC_ADD_CALLER 140 | # define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra) 141 | # define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci) 142 | # else 143 | # define ADD_CALL_CHAIN(base, ra) 144 | # define PRINT_CALL_CHAIN(base) 145 | # endif 146 | #endif 147 | 148 | # ifdef GC_ADD_CALLER 149 | # define OPT_RA ra, 150 | # else 151 | # define OPT_RA 152 | # endif 153 | 154 | 155 | /* Check whether object with base pointer p has debugging info */ 156 | /* p is assumed to point to a legitimate object in our part */ 157 | /* of the heap. */ 158 | #ifdef SHORT_DBG_HDRS 159 | # define GC_has_other_debug_info(p) TRUE 160 | #else 161 | GC_bool GC_has_other_debug_info(/* p */); 162 | #endif 163 | 164 | #if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) 165 | # define GC_HAS_DEBUG_INFO(p) \ 166 | ((*((word *)p) & 1) && GC_has_other_debug_info(p)) 167 | #else 168 | # define GC_HAS_DEBUG_INFO(p) GC_has_other_debug_info(p) 169 | #endif 170 | 171 | /* Store debugging info into p. Return displaced pointer. */ 172 | /* Assumes we don't hold allocation lock. */ 173 | ptr_t GC_store_debug_info(/* p, sz, string, integer */); 174 | 175 | #endif /* _DBG_MLC_H */ 176 | -------------------------------------------------------------------------------- /vs/Interpreteur/Interpreteur.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {A1B92AF1-5422-495D-BA05-B50D1A093A35} 15 | Win32Proj 16 | 8.1 17 | 18 | 19 | 20 | Application 21 | v140 22 | Unicode 23 | 24 | 25 | Application 26 | v140 27 | Unicode 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>14.0.22823.1 43 | 44 | 45 | ..\..\bin\ 46 | Debug\ 47 | true 48 | gotopp 49 | 50 | 51 | Release\ 52 | Release\ 53 | false 54 | 55 | 56 | 57 | Disabled 58 | ../../include;../../boehmgc/include;%(AdditionalIncludeDirectories) 59 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;GC_OPERATOR_NEW_ARRAY;%(PreprocessorDefinitions) 60 | true 61 | EnableFastChecks 62 | MultiThreadedDebug 63 | true 64 | 65 | Level3 66 | EditAndContinue 67 | 68 | 69 | ../Goto++/Debug/GOTO++.lib;%(AdditionalDependencies) 70 | ../../bin/gotopp.exe 71 | true 72 | $(OutDir)Interpreteur.pdb 73 | Console 74 | MachineX86 75 | 76 | 77 | 78 | 79 | ../../include;../../boehmgc/include;%(AdditionalIncludeDirectories) 80 | WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;GC_OPERATOR_NEW_ARRAY;%(PreprocessorDefinitions) 81 | MultiThreaded 82 | true 83 | true 84 | 85 | Level3 86 | ProgramDatabase 87 | 88 | 89 | LinkVerboseLib 90 | ../../gpp-win32-i386/bin/gotopp.exe 91 | true 92 | Console 93 | true 94 | true 95 | 96 | MachineX86 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | {11ab3e98-23f3-4f12-8b69-b9b837fd51f7} 129 | false 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /vs/Interpreteur/Interpreteur.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 97 | 98 | 106 | 109 | 112 | 115 | 118 | 121 | 133 | 136 | 139 | 142 | 154 | 157 | 160 | 163 | 166 | 169 | 172 | 175 | 178 | 179 | 180 | 181 | 182 | 183 | 188 | 191 | 194 | 195 | 198 | 199 | 200 | 203 | 206 | 207 | 210 | 211 | 214 | 215 | 218 | 219 | 222 | 223 | 226 | 227 | 230 | 231 | 234 | 235 | 236 | 237 | 242 | 245 | 248 | 249 | 250 | 253 | 256 | 257 | 258 | 259 | 264 | 267 | 268 | 271 | 272 | 275 | 276 | 277 | 280 | 283 | 284 | 287 | 288 | 289 | 292 | 293 | 294 | 295 | 296 | 297 | --------------------------------------------------------------------------------