From 66a7e3d37c0303997a6b1a3b7ec263dfb8c07748 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 15 Sep 2009 23:22:22 +0200 Subject: [PATCH] added tools and web dirs --- .bzrignore | 0 Nimrod.geany | 0 boot.nim | 4 +- cogapp.py | 0 config/my_nimrod.cfg | 0 config/nimdoc.cfg | 0 config/nimrod.cfg | 8 +- configure | 0 copying.txt | 0 data/advopt.txt | 1 + data/ast.yml | 35 +- data/basicopt.txt | 1 + data/ccomps.txt | 0 data/keywords.txt | 4 +- data/magic.yml | 5 +- data/messages.yml | 22 +- data/pas_keyw.yml | 0 data/readme.txt | 0 diff/empty.txt | 0 doc/abstypes.txt | 8 +- doc/astspec.txt | 0 doc/docs.txt | 0 doc/endb.txt | 0 doc/filelist.txt | 0 doc/grammar.txt | 4 +- doc/intern.txt | 129 +- doc/lib.txt | 2 +- doc/manual.txt | 363 ++- doc/mytest.cfg | 0 doc/nimdoc.css | 0 doc/nimrodc.txt | 65 +- doc/overview.txt | 0 doc/readme.txt | 0 doc/regexprs.txt | 0 doc/rst.txt | 0 doc/steps.txt | 24 - doc/theindex.txt | 1200 ++++---- doc/tut1.txt | 0 doc/tut2.txt | 46 +- dos2unix.py | 0 examples/hallo.nim | 0 examples/htmlrefs.nim | 0 examples/htmltitle.nim | 0 examples/keyval.nim | 0 examples/luaex.nim | 0 examples/maximum.nim | 2 +- examples/myfile.txt | 0 examples/pythonex.nim | 0 examples/readme.txt | 0 examples/statcsv.nim | 0 examples/tclex.nim | 0 gcccpuopt.sh | 0 gpl.html | 0 ide/config.nim | 0 ide/main.nim | 0 ide/nimide.glade | 0 ide/nimide.gladep | 0 ide/nimide.nim | 0 install.txt | 7 +- koch.py | 33 +- lib/copying.txt | 0 lib/cycle.h | 0 lib/ecmas/dom.nim | 0 lib/impure/dialogs.nim | 0 lib/impure/web.nim | 0 lib/impure/zipfiles.nim | 0 lib/lgpl.txt | 0 lib/nimbase.h | 0 lib/posix/posix.nim | 0 lib/pure/cgi.nim | 0 lib/pure/complex.nim | 0 lib/pure/dynlib.nim | 0 lib/pure/hashes.nim | 0 lib/pure/lexbase.nim | 0 lib/pure/macros.nim | 104 +- lib/pure/math.nim | 10 +- lib/pure/md5.nim | 0 lib/pure/os.nim | 16 +- lib/pure/osproc.nim | 0 lib/pure/parsecfg.nim | 0 lib/pure/parsecsv.nim | 0 lib/pure/parseopt.nim | 0 lib/pure/parsesql.nim | 1 + lib/pure/parsexml.nim | 0 lib/pure/regexprs.nim | 2 +- lib/pure/streams.nim | 4 +- lib/pure/strtabs.nim | 0 lib/pure/strutils.nim | 73 +- lib/pure/terminal.nim | 0 lib/pure/times.nim | 6 +- lib/pure/unicode.nim | 0 lib/pure/xmlgen.nim | 0 lib/system.nim | 93 +- lib/system/alloc.nim | 0 lib/system/ansi_c.nim | 0 lib/system/arithm.nim | 0 lib/system/assign.nim | 2 +- lib/system/cellsets.nim | 0 lib/system/cntbits.nim | 10 +- lib/system/debugger.nim | 6 +- lib/system/dyncalls.nim | 0 lib/system/ecmasys.nim | 0 lib/system/excpt.nim | 0 lib/system/gc.nim | 6 +- lib/system/hti.nim | 51 +- lib/system/mm.nim | 0 lib/system/profiler.nim | 0 lib/system/repr.nim | 2 +- lib/system/sets.nim | 84 +- lib/system/sysio.nim | 14 +- lib/system/sysstr.nim | 0 lib/ucmaps/8859-1.txt | 0 lib/ucmaps/8859-10.txt | 0 lib/ucmaps/8859-13.txt | 0 lib/ucmaps/8859-14.txt | 0 lib/ucmaps/8859-15.txt | 0 lib/ucmaps/8859-2.txt | 0 lib/ucmaps/8859-3.txt | 0 lib/ucmaps/8859-4.txt | 0 lib/ucmaps/8859-5.txt | 0 lib/ucmaps/8859-6.txt | 0 lib/ucmaps/8859-7.txt | 0 lib/ucmaps/8859-8.txt | 0 lib/ucmaps/8859-9.txt | 0 lib/ucmaps/cp1250.txt | 0 lib/ucmaps/cp1251.txt | 0 lib/ucmaps/cp1252.txt | 0 lib/ucmaps/cp1253.txt | 0 lib/ucmaps/cp1254.txt | 0 lib/ucmaps/cp1255.txt | 0 lib/ucmaps/cp1256.txt | 0 lib/ucmaps/cp1257.txt | 0 lib/ucmaps/cp1258.txt | 0 lib/ucmaps/cp437.txt | 0 lib/ucmaps/cp737.txt | 0 lib/ucmaps/cp775.txt | 0 lib/ucmaps/cp850.txt | 0 lib/ucmaps/cp852.txt | 0 lib/ucmaps/cp855.txt | 0 lib/ucmaps/cp856.txt | 0 lib/ucmaps/cp857.txt | 0 lib/ucmaps/cp860.txt | 0 lib/ucmaps/cp861.txt | 0 lib/ucmaps/cp862.txt | 0 lib/ucmaps/cp863.txt | 0 lib/ucmaps/cp864.txt | 0 lib/ucmaps/cp865.txt | 0 lib/ucmaps/cp866.txt | 0 lib/ucmaps/cp869.txt | 0 lib/ucmaps/cp874.txt | 0 lib/ucmaps/cp932.txt | 0 lib/windows/mmsystem.nim | 33 +- lib/windows/nb30.nim | 0 lib/windows/ole2.nim | 0 lib/windows/shellapi.nim | 0 lib/windows/shfolder.nim | 0 lib/windows/windows.nim | 0 lib/windows/winlean.nim | 0 lib/wrappers/cairo/cairo.nim | 0 lib/wrappers/cairo/cairoft.nim | 0 lib/wrappers/cairo/cairowin32.nim | 0 lib/wrappers/cairo/cairoxlib.nim | 0 lib/wrappers/gtk/atk.nim | 0 lib/wrappers/gtk/gdk2.nim | 0 lib/wrappers/gtk/gdk2pixbuf.nim | 0 lib/wrappers/gtk/gdkglext.nim | 0 lib/wrappers/gtk/glib2.nim | 0 lib/wrappers/gtk/gtk2.nim | 0 lib/wrappers/gtk/gtkglext.nim | 0 lib/wrappers/gtk/gtkhtml.nim | 0 lib/wrappers/gtk/libglade2.nim | 0 lib/wrappers/gtk/pango.nim | 0 lib/wrappers/gtk/pangoutils.nim | 0 lib/wrappers/libcurl.nim | 0 lib/wrappers/lua/lauxlib.nim | 0 lib/wrappers/lua/lua.nim | 0 lib/wrappers/lua/lualib.nim | 0 lib/wrappers/mysql.nim | 0 lib/wrappers/odbcsql.nim | 0 lib/wrappers/opengl/gl.nim | 0 lib/wrappers/opengl/gl.pp | 1548 ---------- lib/wrappers/opengl/glext.nim | 0 lib/wrappers/opengl/glext.pp | 3857 ------------------------ lib/wrappers/opengl/glu.nim | 0 lib/wrappers/opengl/glu.pp | 368 --- lib/wrappers/opengl/glut.nim | 0 lib/wrappers/opengl/glut.pp | 436 --- lib/wrappers/opengl/glx.nim | 0 lib/wrappers/opengl/glx.pp | 156 - lib/wrappers/opengl/wingl.nim | 0 lib/wrappers/opengl/wingl.pp | 313 -- lib/wrappers/pcre/pcre.nim | 0 lib/wrappers/pcre/pcre_all.c | 0 lib/wrappers/postgres.nim | 0 lib/wrappers/python.nim | 0 lib/wrappers/sdl/sdl.nim | 0 lib/wrappers/sdl/sdl_gfx.nim | 0 lib/wrappers/sdl/sdl_image.nim | 0 lib/wrappers/sdl/sdl_mixer.nim | 0 lib/wrappers/sdl/sdl_mixer_nosmpeg.nim | 0 lib/wrappers/sdl/sdl_net.nim | 0 lib/wrappers/sdl/sdl_ttf.nim | 0 lib/wrappers/sdl/sdlutils.pas | 0 lib/wrappers/sdl/smpeg.nim | 0 lib/wrappers/sqlite3.nim | 0 lib/wrappers/tcl.nim | 0 lib/wrappers/x11/cursorfont.nim | 0 lib/wrappers/x11/keysym.nim | 0 lib/wrappers/x11/x.nim | 0 lib/wrappers/x11/xatom.nim | 0 lib/wrappers/x11/xcms.nim | 0 lib/wrappers/x11/xf86dga.nim | 0 lib/wrappers/x11/xf86vmode.nim | 0 lib/wrappers/x11/xi.nim | 0 lib/wrappers/x11/xinerama.nim | 0 lib/wrappers/x11/xkb.nim | 0 lib/wrappers/x11/xkblib.nim | 0 lib/wrappers/x11/xlib.nim | 0 lib/wrappers/x11/xrandr.nim | 0 lib/wrappers/x11/xrender.nim | 0 lib/wrappers/x11/xresource.nim | 0 lib/wrappers/x11/xshm.nim | 0 lib/wrappers/x11/xutil.nim | 0 lib/wrappers/x11/xv.nim | 0 lib/wrappers/x11/xvlib.nim | 0 lib/wrappers/zip/libzip.nim | 0 lib/wrappers/zip/libzip_all.c | 0 lib/wrappers/zip/zlib.nim | 0 lib/wrappers/zip/zzip.nim | 0 makefile | 0 nim/ast.pas | 174 +- nim/astalgo.pas | 37 +- nim/bitsets.pas | 0 nim/ccgexprs.pas | 49 +- nim/ccgstmts.pas | 82 +- nim/ccgtypes.pas | 4 +- nim/ccgutils.pas | 2 +- nim/cgen.pas | 121 +- nim/charsets.pas | 0 nim/commands.pas | 10 +- nim/condsyms.pas | 0 nim/config.inc | 0 nim/crc.pas | 0 nim/depends.pas | 0 nim/docgen.pas | 560 ++-- nim/ecmasgen.pas | 21 +- nim/evals.pas | 6 +- nim/extccomp.pas | 5 +- nim/hashtest.pas | 0 nim/highlite.pas | 7 +- nim/idents.pas | 0 nim/importer.pas | 0 nim/interact.pas | 0 nim/lexbase.pas | 0 nim/lists.pas | 0 nim/llstream.pas | 0 nim/llvmdyn.pas | 2 +- nim/llvmstat.pas | 0 nim/lookups.pas | 18 +- nim/magicsys.pas | 2 +- nim/main.pas | 6 + nim/msgs.pas | 789 ++--- nim/nhashes.pas | 0 nim/nimconf.pas | 2 +- nim/nimrod.pas | 0 nim/nimsets.pas | 0 nim/nmath.pas | 0 nim/nos.pas | 4 +- nim/nstrtabs.pas | 0 nim/nsystem.pas | 7 + nim/ntime.pas | 0 nim/nversion.pas | 6 +- nim/options.pas | 8 +- nim/osproc.pas | 0 nim/parsecfg.pas | 0 nim/parseopt.pas | 0 nim/paslex.pas | 0 nim/pasparse.pas | 4 +- nim/passaux.pas | 0 nim/passes.pas | 0 nim/platform.pas | 0 nim/pnimsyn.pas | 86 +- nim/pragmas.pas | 122 +- nim/procfind.pas | 10 +- nim/ptmplsyn.pas | 0 nim/readme.txt | 0 nim/rnimsyn.pas | 38 +- nim/rodread.pas | 8 +- nim/rodwrite.pas | 0 nim/ropes.pas | 0 nim/rst.pas | 15 +- nim/scanner.pas | 33 +- nim/sem.pas | 60 +- nim/semdata.pas | 34 +- nim/semexprs.pas | 254 +- nim/semfold.pas | 2 +- nim/seminst.pas | 375 ++- nim/semstmts.pas | 344 +-- nim/semtempl.pas | 109 +- nim/semtypes.pas | 180 +- nim/sigmatch.pas | 125 +- nim/strutils.pas | 10 +- nim/syntaxes.pas | 0 nim/tigen.pas | 0 nim/transf.pas | 47 +- nim/transtmp.pas | 2 +- nim/trees.pas | 13 +- nim/treetab.pas | 0 nim/types.pas | 144 +- nim/wordrecg.pas | 31 +- obj/empty.txt | 0 pycompab.py | 2 +- readme.txt | 0 rod/nimrod.cfg | 0 rod/nimrod.dot | 0 rod/nimrod.ini | 1 + rod/readme.txt | 0 tests/cairotest.nim | 0 tests/cgitest.nim | 0 tests/csvtest.csv | 0 tests/curltest.nim | 0 tests/data.csv | 0 tests/ecmas.html | 2 +- tests/ecmas.nim | 0 tests/gcbench.nim | 0 tests/gctest.nim | 0 tests/gtk/ex1.nim | 0 tests/gtk/ex2.nim | 0 tests/gtk/ex3.nim | 0 tests/gtk/ex4.nim | 0 tests/gtk/ex5.nim | 0 tests/gtk/ex6.nim | 0 tests/gtk/ex7.nim | 0 tests/gtk/ex8.nim | 0 tests/gtk/ex9.nim | 0 tests/hallo.nim | 0 tests/jsontest.json | 0 tests/mambsym1.nim | 0 tests/mambsym2.nim | 0 tests/mambsys1.nim | 0 tests/mambsys2.nim | 0 tests/md5.nim | 249 -- tests/minit.nim | 0 tests/mnamspc1.nim | 0 tests/mnamspc2.nim | 0 tests/mopaque.nim | 0 tests/mrecmod.nim | 0 tests/mrecmod2.nim | 0 tests/mvarious.nim | 0 tests/readme.txt | 0 tests/rectest.nim | 0 tests/scantest.nim | 0 tests/sdltest.nim | 0 tests/stckovfl.nim | 0 tests/sunset.tmpl | 0 tests/tack.nim | 0 tests/tambsym.nim | 0 tests/tambsym2.nim | 0 tests/tambsym3.nim | 0 tests/tambsys.nim | 0 tests/tarray.nim | 0 tests/tarray2.nim | 0 tests/tarrindx.nim | 0 tests/tassert.nim | 0 tests/tassign.nim | 0 tests/tbintree.nim | 74 +- tests/tblock1.nim | 0 tests/tcasestm.nim | 0 tests/tclosure.nim | 0 tests/tcmdline.nim | 0 tests/tconstr1.nim | 0 tests/tconstr2.nim | 0 tests/tcopy.nim | 0 tests/tcurrncy.nim | 2 +- tests/tdialogs.nim | 0 tests/techo.nim | 0 tests/tendian.nim | 0 tests/tenum.nim | 0 tests/tester.nim | 57 +- tests/tformat.nim | 0 tests/tforwty.nim | 0 tests/tforwty2.nim | 0 tests/tgtk.nim | 0 tests/thallo.nim | 0 tests/tident.nim | 0 tests/tillrec.nim | 0 tests/tinit.nim | 0 tests/tinout.nim | 0 tests/tints.nim | 0 tests/tinvwhen.nim | 0 tests/tio.nim | 0 tests/tisopr.nim | 0 tests/titer.nim | 0 tests/titer2.nim | 0 tests/titer3.nim | 12 +- tests/tlastmod.nim | 0 tests/tlibs.nim | 0 tests/tloops.nim | 0 tests/tlowhigh.nim | 0 tests/tmath.nim | 0 tests/tnamspc.nim | 0 tests/tnestif.nim | 0 tests/tnew.nim | 0 tests/tnewsets.nim | 0 tests/tnewuns.nim | 0 tests/tnoop.nim | 0 tests/tnot.nim | 2 +- tests/tobject2.nim | 0 tests/tobjects.nim | 0 tests/toop1.nim | 0 tests/topaque.nim | 0 tests/topena1.nim | 0 tests/topenlen.nim | 0 tests/toptions.nim | 0 tests/tos.nim | 0 tests/toverflw.nim | 0 tests/toverl.nim | 0 tests/toverlop.nim | 0 tests/toverwr.nim | 0 tests/tovfint.nim | 0 tests/tparedef.nim | 0 tests/tparscfg.nim | 0 tests/tparsopt.nim | 0 tests/tpos.nim | 0 tests/tposix.nim | 0 tests/tprep.nim | 0 tests/tprintf.nim | 0 tests/tprocvar.nim | 0 tests/tpush.nim | 0 tests/tquit.nim | 0 tests/tradix.nim | 0 tests/trawstr.nim | 0 tests/treadln.nim | 0 tests/trecmod.nim | 0 tests/trecmod2.nim | 0 tests/trectype.nim | 0 tests/trefs.nim | 0 tests/tregex.nim | 0 tests/treguse.nim | 0 tests/trepr.nim | 0 tests/tseq2.nim | 0 tests/tseqcon.nim | 0 tests/tsets.nim | 0 tests/tsimmeth.nim | 0 tests/tsimtych.nim | 0 tests/tsizeof.nim | 0 tests/tstatret.nim | 0 tests/tstmtexp.nim | 0 tests/tstrace.nim | 0 tests/tstrange.nim | 0 tests/tstrdesc.nim | 0 tests/tstrdist.nim | 0 tests/tstreams.nim | 0 tests/tstrset.nim | 0 tests/tstrtabs.nim | 0 tests/tstrutil.nim | 0 tests/ttempl.nim | 0 tests/ttempl2.nim | 0 tests/ttempl3.nim | 7 +- tests/ttime.nim | 0 tests/tvardecl.nim | 0 tests/tvarious.nim | 0 tests/tvarnums.nim | 0 tests/twalker.nim | 0 tests/typalias.nim | 0 tests/typredef.nim | 0 tests/wingui.nim | 0 tests/x11test.nim | 0 tests/xmltest.html | 0 tools/build.tmpl | 97 + tools/deinstall.tmpl | 62 + tools/inno.tmpl | 0 tools/install.tmpl | 0 tools/niminst.nim | 39 +- tools/nimweb.nim | 9 +- tools/sunset.tmpl | 0 tools/trimcc.nim | 28 + unix2dos.py | 0 web/community.txt | 6 + web/documentation.txt | 1 + web/download.txt | 17 + web/index.txt | 127 + web/links.txt | 0 web/news.txt | 368 +++ web/nimrod.ini | 41 + web/question.txt | 107 + web/snippets/snippet1.nim | 4 + web/ticker.txt | 31 + whiteutils.py | 0 489 files changed, 4593 insertions(+), 9878 deletions(-) mode change 100644 => 100755 .bzrignore mode change 100644 => 100755 Nimrod.geany mode change 100644 => 100755 boot.nim mode change 100644 => 100755 cogapp.py mode change 100644 => 100755 config/my_nimrod.cfg mode change 100644 => 100755 config/nimdoc.cfg mode change 100644 => 100755 config/nimrod.cfg mode change 100644 => 100755 configure mode change 100644 => 100755 copying.txt mode change 100644 => 100755 data/advopt.txt mode change 100644 => 100755 data/ast.yml mode change 100644 => 100755 data/basicopt.txt mode change 100644 => 100755 data/ccomps.txt mode change 100644 => 100755 data/keywords.txt mode change 100644 => 100755 data/magic.yml mode change 100644 => 100755 data/messages.yml mode change 100644 => 100755 data/pas_keyw.yml mode change 100644 => 100755 data/readme.txt mode change 100644 => 100755 diff/empty.txt mode change 100644 => 100755 doc/abstypes.txt mode change 100644 => 100755 doc/astspec.txt mode change 100644 => 100755 doc/docs.txt mode change 100644 => 100755 doc/endb.txt mode change 100644 => 100755 doc/filelist.txt mode change 100644 => 100755 doc/grammar.txt mode change 100644 => 100755 doc/intern.txt mode change 100644 => 100755 doc/lib.txt mode change 100644 => 100755 doc/manual.txt mode change 100644 => 100755 doc/mytest.cfg mode change 100644 => 100755 doc/nimdoc.css mode change 100644 => 100755 doc/nimrodc.txt mode change 100644 => 100755 doc/overview.txt mode change 100644 => 100755 doc/readme.txt mode change 100644 => 100755 doc/regexprs.txt mode change 100644 => 100755 doc/rst.txt delete mode 100644 doc/steps.txt mode change 100644 => 100755 doc/theindex.txt mode change 100644 => 100755 doc/tut1.txt mode change 100644 => 100755 doc/tut2.txt mode change 100644 => 100755 dos2unix.py mode change 100644 => 100755 examples/hallo.nim mode change 100644 => 100755 examples/htmlrefs.nim mode change 100644 => 100755 examples/htmltitle.nim mode change 100644 => 100755 examples/keyval.nim mode change 100644 => 100755 examples/luaex.nim mode change 100644 => 100755 examples/maximum.nim mode change 100644 => 100755 examples/myfile.txt mode change 100644 => 100755 examples/pythonex.nim mode change 100644 => 100755 examples/readme.txt mode change 100644 => 100755 examples/statcsv.nim mode change 100644 => 100755 examples/tclex.nim mode change 100644 => 100755 gcccpuopt.sh mode change 100644 => 100755 gpl.html mode change 100644 => 100755 ide/config.nim mode change 100644 => 100755 ide/main.nim mode change 100644 => 100755 ide/nimide.glade mode change 100644 => 100755 ide/nimide.gladep mode change 100644 => 100755 ide/nimide.nim mode change 100644 => 100755 install.txt mode change 100644 => 100755 koch.py mode change 100644 => 100755 lib/copying.txt mode change 100644 => 100755 lib/cycle.h mode change 100644 => 100755 lib/ecmas/dom.nim mode change 100644 => 100755 lib/impure/dialogs.nim mode change 100644 => 100755 lib/impure/web.nim mode change 100644 => 100755 lib/impure/zipfiles.nim mode change 100644 => 100755 lib/lgpl.txt mode change 100644 => 100755 lib/nimbase.h mode change 100644 => 100755 lib/posix/posix.nim mode change 100644 => 100755 lib/pure/cgi.nim mode change 100644 => 100755 lib/pure/complex.nim mode change 100644 => 100755 lib/pure/dynlib.nim mode change 100644 => 100755 lib/pure/hashes.nim mode change 100644 => 100755 lib/pure/lexbase.nim mode change 100644 => 100755 lib/pure/macros.nim mode change 100644 => 100755 lib/pure/math.nim mode change 100644 => 100755 lib/pure/md5.nim mode change 100644 => 100755 lib/pure/os.nim mode change 100644 => 100755 lib/pure/osproc.nim mode change 100644 => 100755 lib/pure/parsecfg.nim mode change 100644 => 100755 lib/pure/parsecsv.nim mode change 100644 => 100755 lib/pure/parseopt.nim mode change 100644 => 100755 lib/pure/parsesql.nim mode change 100644 => 100755 lib/pure/parsexml.nim mode change 100644 => 100755 lib/pure/regexprs.nim mode change 100644 => 100755 lib/pure/streams.nim mode change 100644 => 100755 lib/pure/strtabs.nim mode change 100644 => 100755 lib/pure/strutils.nim mode change 100644 => 100755 lib/pure/terminal.nim mode change 100644 => 100755 lib/pure/times.nim mode change 100644 => 100755 lib/pure/unicode.nim mode change 100644 => 100755 lib/pure/xmlgen.nim mode change 100644 => 100755 lib/system.nim mode change 100644 => 100755 lib/system/alloc.nim mode change 100644 => 100755 lib/system/ansi_c.nim mode change 100644 => 100755 lib/system/arithm.nim mode change 100644 => 100755 lib/system/assign.nim mode change 100644 => 100755 lib/system/cellsets.nim mode change 100644 => 100755 lib/system/cntbits.nim mode change 100644 => 100755 lib/system/debugger.nim mode change 100644 => 100755 lib/system/dyncalls.nim mode change 100644 => 100755 lib/system/ecmasys.nim mode change 100644 => 100755 lib/system/excpt.nim mode change 100644 => 100755 lib/system/gc.nim mode change 100644 => 100755 lib/system/hti.nim mode change 100644 => 100755 lib/system/mm.nim mode change 100644 => 100755 lib/system/profiler.nim mode change 100644 => 100755 lib/system/repr.nim mode change 100644 => 100755 lib/system/sets.nim mode change 100644 => 100755 lib/system/sysio.nim mode change 100644 => 100755 lib/system/sysstr.nim mode change 100644 => 100755 lib/ucmaps/8859-1.txt mode change 100644 => 100755 lib/ucmaps/8859-10.txt mode change 100644 => 100755 lib/ucmaps/8859-13.txt mode change 100644 => 100755 lib/ucmaps/8859-14.txt mode change 100644 => 100755 lib/ucmaps/8859-15.txt mode change 100644 => 100755 lib/ucmaps/8859-2.txt mode change 100644 => 100755 lib/ucmaps/8859-3.txt mode change 100644 => 100755 lib/ucmaps/8859-4.txt mode change 100644 => 100755 lib/ucmaps/8859-5.txt mode change 100644 => 100755 lib/ucmaps/8859-6.txt mode change 100644 => 100755 lib/ucmaps/8859-7.txt mode change 100644 => 100755 lib/ucmaps/8859-8.txt mode change 100644 => 100755 lib/ucmaps/8859-9.txt mode change 100644 => 100755 lib/ucmaps/cp1250.txt mode change 100644 => 100755 lib/ucmaps/cp1251.txt mode change 100644 => 100755 lib/ucmaps/cp1252.txt mode change 100644 => 100755 lib/ucmaps/cp1253.txt mode change 100644 => 100755 lib/ucmaps/cp1254.txt mode change 100644 => 100755 lib/ucmaps/cp1255.txt mode change 100644 => 100755 lib/ucmaps/cp1256.txt mode change 100644 => 100755 lib/ucmaps/cp1257.txt mode change 100644 => 100755 lib/ucmaps/cp1258.txt mode change 100644 => 100755 lib/ucmaps/cp437.txt mode change 100644 => 100755 lib/ucmaps/cp737.txt mode change 100644 => 100755 lib/ucmaps/cp775.txt mode change 100644 => 100755 lib/ucmaps/cp850.txt mode change 100644 => 100755 lib/ucmaps/cp852.txt mode change 100644 => 100755 lib/ucmaps/cp855.txt mode change 100644 => 100755 lib/ucmaps/cp856.txt mode change 100644 => 100755 lib/ucmaps/cp857.txt mode change 100644 => 100755 lib/ucmaps/cp860.txt mode change 100644 => 100755 lib/ucmaps/cp861.txt mode change 100644 => 100755 lib/ucmaps/cp862.txt mode change 100644 => 100755 lib/ucmaps/cp863.txt mode change 100644 => 100755 lib/ucmaps/cp864.txt mode change 100644 => 100755 lib/ucmaps/cp865.txt mode change 100644 => 100755 lib/ucmaps/cp866.txt mode change 100644 => 100755 lib/ucmaps/cp869.txt mode change 100644 => 100755 lib/ucmaps/cp874.txt mode change 100644 => 100755 lib/ucmaps/cp932.txt mode change 100644 => 100755 lib/windows/mmsystem.nim mode change 100644 => 100755 lib/windows/nb30.nim mode change 100644 => 100755 lib/windows/ole2.nim mode change 100644 => 100755 lib/windows/shellapi.nim mode change 100644 => 100755 lib/windows/shfolder.nim mode change 100644 => 100755 lib/windows/windows.nim mode change 100644 => 100755 lib/windows/winlean.nim mode change 100644 => 100755 lib/wrappers/cairo/cairo.nim mode change 100644 => 100755 lib/wrappers/cairo/cairoft.nim mode change 100644 => 100755 lib/wrappers/cairo/cairowin32.nim mode change 100644 => 100755 lib/wrappers/cairo/cairoxlib.nim mode change 100644 => 100755 lib/wrappers/gtk/atk.nim mode change 100644 => 100755 lib/wrappers/gtk/gdk2.nim mode change 100644 => 100755 lib/wrappers/gtk/gdk2pixbuf.nim mode change 100644 => 100755 lib/wrappers/gtk/gdkglext.nim mode change 100644 => 100755 lib/wrappers/gtk/glib2.nim mode change 100644 => 100755 lib/wrappers/gtk/gtk2.nim mode change 100644 => 100755 lib/wrappers/gtk/gtkglext.nim mode change 100644 => 100755 lib/wrappers/gtk/gtkhtml.nim mode change 100644 => 100755 lib/wrappers/gtk/libglade2.nim mode change 100644 => 100755 lib/wrappers/gtk/pango.nim mode change 100644 => 100755 lib/wrappers/gtk/pangoutils.nim mode change 100644 => 100755 lib/wrappers/libcurl.nim mode change 100644 => 100755 lib/wrappers/lua/lauxlib.nim mode change 100644 => 100755 lib/wrappers/lua/lua.nim mode change 100644 => 100755 lib/wrappers/lua/lualib.nim mode change 100644 => 100755 lib/wrappers/mysql.nim mode change 100644 => 100755 lib/wrappers/odbcsql.nim mode change 100644 => 100755 lib/wrappers/opengl/gl.nim delete mode 100644 lib/wrappers/opengl/gl.pp mode change 100644 => 100755 lib/wrappers/opengl/glext.nim delete mode 100644 lib/wrappers/opengl/glext.pp mode change 100644 => 100755 lib/wrappers/opengl/glu.nim delete mode 100644 lib/wrappers/opengl/glu.pp mode change 100644 => 100755 lib/wrappers/opengl/glut.nim delete mode 100644 lib/wrappers/opengl/glut.pp mode change 100644 => 100755 lib/wrappers/opengl/glx.nim delete mode 100644 lib/wrappers/opengl/glx.pp mode change 100644 => 100755 lib/wrappers/opengl/wingl.nim delete mode 100644 lib/wrappers/opengl/wingl.pp mode change 100644 => 100755 lib/wrappers/pcre/pcre.nim mode change 100644 => 100755 lib/wrappers/pcre/pcre_all.c mode change 100644 => 100755 lib/wrappers/postgres.nim mode change 100644 => 100755 lib/wrappers/python.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl_gfx.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl_image.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl_mixer.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl_mixer_nosmpeg.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl_net.nim mode change 100644 => 100755 lib/wrappers/sdl/sdl_ttf.nim mode change 100644 => 100755 lib/wrappers/sdl/sdlutils.pas mode change 100644 => 100755 lib/wrappers/sdl/smpeg.nim mode change 100644 => 100755 lib/wrappers/sqlite3.nim mode change 100644 => 100755 lib/wrappers/tcl.nim mode change 100644 => 100755 lib/wrappers/x11/cursorfont.nim mode change 100644 => 100755 lib/wrappers/x11/keysym.nim mode change 100644 => 100755 lib/wrappers/x11/x.nim mode change 100644 => 100755 lib/wrappers/x11/xatom.nim mode change 100644 => 100755 lib/wrappers/x11/xcms.nim mode change 100644 => 100755 lib/wrappers/x11/xf86dga.nim mode change 100644 => 100755 lib/wrappers/x11/xf86vmode.nim mode change 100644 => 100755 lib/wrappers/x11/xi.nim mode change 100644 => 100755 lib/wrappers/x11/xinerama.nim mode change 100644 => 100755 lib/wrappers/x11/xkb.nim mode change 100644 => 100755 lib/wrappers/x11/xkblib.nim mode change 100644 => 100755 lib/wrappers/x11/xlib.nim mode change 100644 => 100755 lib/wrappers/x11/xrandr.nim mode change 100644 => 100755 lib/wrappers/x11/xrender.nim mode change 100644 => 100755 lib/wrappers/x11/xresource.nim mode change 100644 => 100755 lib/wrappers/x11/xshm.nim mode change 100644 => 100755 lib/wrappers/x11/xutil.nim mode change 100644 => 100755 lib/wrappers/x11/xv.nim mode change 100644 => 100755 lib/wrappers/x11/xvlib.nim mode change 100644 => 100755 lib/wrappers/zip/libzip.nim mode change 100644 => 100755 lib/wrappers/zip/libzip_all.c mode change 100644 => 100755 lib/wrappers/zip/zlib.nim mode change 100644 => 100755 lib/wrappers/zip/zzip.nim mode change 100644 => 100755 makefile mode change 100644 => 100755 nim/ast.pas mode change 100644 => 100755 nim/astalgo.pas mode change 100644 => 100755 nim/bitsets.pas mode change 100644 => 100755 nim/ccgexprs.pas mode change 100644 => 100755 nim/ccgstmts.pas mode change 100644 => 100755 nim/ccgtypes.pas mode change 100644 => 100755 nim/ccgutils.pas mode change 100644 => 100755 nim/cgen.pas mode change 100644 => 100755 nim/charsets.pas mode change 100644 => 100755 nim/commands.pas mode change 100644 => 100755 nim/condsyms.pas mode change 100644 => 100755 nim/config.inc mode change 100644 => 100755 nim/crc.pas mode change 100644 => 100755 nim/depends.pas mode change 100644 => 100755 nim/docgen.pas mode change 100644 => 100755 nim/ecmasgen.pas mode change 100644 => 100755 nim/evals.pas mode change 100644 => 100755 nim/extccomp.pas mode change 100644 => 100755 nim/hashtest.pas mode change 100644 => 100755 nim/highlite.pas mode change 100644 => 100755 nim/idents.pas mode change 100644 => 100755 nim/importer.pas mode change 100644 => 100755 nim/interact.pas mode change 100644 => 100755 nim/lexbase.pas mode change 100644 => 100755 nim/lists.pas mode change 100644 => 100755 nim/llstream.pas mode change 100644 => 100755 nim/llvmdyn.pas mode change 100644 => 100755 nim/llvmstat.pas mode change 100644 => 100755 nim/lookups.pas mode change 100644 => 100755 nim/magicsys.pas mode change 100644 => 100755 nim/main.pas mode change 100644 => 100755 nim/msgs.pas mode change 100644 => 100755 nim/nhashes.pas mode change 100644 => 100755 nim/nimconf.pas mode change 100644 => 100755 nim/nimrod.pas mode change 100644 => 100755 nim/nimsets.pas mode change 100644 => 100755 nim/nmath.pas mode change 100644 => 100755 nim/nos.pas mode change 100644 => 100755 nim/nstrtabs.pas mode change 100644 => 100755 nim/nsystem.pas mode change 100644 => 100755 nim/ntime.pas mode change 100644 => 100755 nim/nversion.pas mode change 100644 => 100755 nim/options.pas mode change 100644 => 100755 nim/osproc.pas mode change 100644 => 100755 nim/parsecfg.pas mode change 100644 => 100755 nim/parseopt.pas mode change 100644 => 100755 nim/paslex.pas mode change 100644 => 100755 nim/pasparse.pas mode change 100644 => 100755 nim/passaux.pas mode change 100644 => 100755 nim/passes.pas mode change 100644 => 100755 nim/platform.pas mode change 100644 => 100755 nim/pnimsyn.pas mode change 100644 => 100755 nim/pragmas.pas mode change 100644 => 100755 nim/procfind.pas mode change 100644 => 100755 nim/ptmplsyn.pas mode change 100644 => 100755 nim/readme.txt mode change 100644 => 100755 nim/rnimsyn.pas mode change 100644 => 100755 nim/rodread.pas mode change 100644 => 100755 nim/rodwrite.pas mode change 100644 => 100755 nim/ropes.pas mode change 100644 => 100755 nim/rst.pas mode change 100644 => 100755 nim/scanner.pas mode change 100644 => 100755 nim/sem.pas mode change 100644 => 100755 nim/semdata.pas mode change 100644 => 100755 nim/semexprs.pas mode change 100644 => 100755 nim/semfold.pas mode change 100644 => 100755 nim/seminst.pas mode change 100644 => 100755 nim/semstmts.pas mode change 100644 => 100755 nim/semtempl.pas mode change 100644 => 100755 nim/semtypes.pas mode change 100644 => 100755 nim/sigmatch.pas mode change 100644 => 100755 nim/strutils.pas mode change 100644 => 100755 nim/syntaxes.pas mode change 100644 => 100755 nim/tigen.pas mode change 100644 => 100755 nim/transf.pas mode change 100644 => 100755 nim/transtmp.pas mode change 100644 => 100755 nim/trees.pas mode change 100644 => 100755 nim/treetab.pas mode change 100644 => 100755 nim/types.pas mode change 100644 => 100755 nim/wordrecg.pas mode change 100644 => 100755 obj/empty.txt mode change 100644 => 100755 pycompab.py mode change 100644 => 100755 readme.txt mode change 100644 => 100755 rod/nimrod.cfg mode change 100644 => 100755 rod/nimrod.dot mode change 100644 => 100755 rod/nimrod.ini mode change 100644 => 100755 rod/readme.txt mode change 100644 => 100755 tests/cairotest.nim mode change 100644 => 100755 tests/cgitest.nim mode change 100644 => 100755 tests/csvtest.csv mode change 100644 => 100755 tests/curltest.nim mode change 100644 => 100755 tests/data.csv mode change 100644 => 100755 tests/ecmas.html mode change 100644 => 100755 tests/ecmas.nim mode change 100644 => 100755 tests/gcbench.nim mode change 100644 => 100755 tests/gctest.nim mode change 100644 => 100755 tests/gtk/ex1.nim mode change 100644 => 100755 tests/gtk/ex2.nim mode change 100644 => 100755 tests/gtk/ex3.nim mode change 100644 => 100755 tests/gtk/ex4.nim mode change 100644 => 100755 tests/gtk/ex5.nim mode change 100644 => 100755 tests/gtk/ex6.nim mode change 100644 => 100755 tests/gtk/ex7.nim mode change 100644 => 100755 tests/gtk/ex8.nim mode change 100644 => 100755 tests/gtk/ex9.nim mode change 100644 => 100755 tests/hallo.nim mode change 100644 => 100755 tests/jsontest.json mode change 100644 => 100755 tests/mambsym1.nim mode change 100644 => 100755 tests/mambsym2.nim mode change 100644 => 100755 tests/mambsys1.nim mode change 100644 => 100755 tests/mambsys2.nim delete mode 100644 tests/md5.nim mode change 100644 => 100755 tests/minit.nim mode change 100644 => 100755 tests/mnamspc1.nim mode change 100644 => 100755 tests/mnamspc2.nim mode change 100644 => 100755 tests/mopaque.nim mode change 100644 => 100755 tests/mrecmod.nim mode change 100644 => 100755 tests/mrecmod2.nim mode change 100644 => 100755 tests/mvarious.nim mode change 100644 => 100755 tests/readme.txt mode change 100644 => 100755 tests/rectest.nim mode change 100644 => 100755 tests/scantest.nim mode change 100644 => 100755 tests/sdltest.nim mode change 100644 => 100755 tests/stckovfl.nim mode change 100644 => 100755 tests/sunset.tmpl mode change 100644 => 100755 tests/tack.nim mode change 100644 => 100755 tests/tambsym.nim mode change 100644 => 100755 tests/tambsym2.nim mode change 100644 => 100755 tests/tambsym3.nim mode change 100644 => 100755 tests/tambsys.nim mode change 100644 => 100755 tests/tarray.nim mode change 100644 => 100755 tests/tarray2.nim mode change 100644 => 100755 tests/tarrindx.nim mode change 100644 => 100755 tests/tassert.nim mode change 100644 => 100755 tests/tassign.nim mode change 100644 => 100755 tests/tbintree.nim mode change 100644 => 100755 tests/tblock1.nim mode change 100644 => 100755 tests/tcasestm.nim mode change 100644 => 100755 tests/tclosure.nim mode change 100644 => 100755 tests/tcmdline.nim mode change 100644 => 100755 tests/tconstr1.nim mode change 100644 => 100755 tests/tconstr2.nim mode change 100644 => 100755 tests/tcopy.nim mode change 100644 => 100755 tests/tcurrncy.nim mode change 100644 => 100755 tests/tdialogs.nim mode change 100644 => 100755 tests/techo.nim mode change 100644 => 100755 tests/tendian.nim mode change 100644 => 100755 tests/tenum.nim mode change 100644 => 100755 tests/tester.nim mode change 100644 => 100755 tests/tformat.nim mode change 100644 => 100755 tests/tforwty.nim mode change 100644 => 100755 tests/tforwty2.nim mode change 100644 => 100755 tests/tgtk.nim mode change 100644 => 100755 tests/thallo.nim mode change 100644 => 100755 tests/tident.nim mode change 100644 => 100755 tests/tillrec.nim mode change 100644 => 100755 tests/tinit.nim mode change 100644 => 100755 tests/tinout.nim mode change 100644 => 100755 tests/tints.nim mode change 100644 => 100755 tests/tinvwhen.nim mode change 100644 => 100755 tests/tio.nim mode change 100644 => 100755 tests/tisopr.nim mode change 100644 => 100755 tests/titer.nim mode change 100644 => 100755 tests/titer2.nim mode change 100644 => 100755 tests/titer3.nim mode change 100644 => 100755 tests/tlastmod.nim mode change 100644 => 100755 tests/tlibs.nim mode change 100644 => 100755 tests/tloops.nim mode change 100644 => 100755 tests/tlowhigh.nim mode change 100644 => 100755 tests/tmath.nim mode change 100644 => 100755 tests/tnamspc.nim mode change 100644 => 100755 tests/tnestif.nim mode change 100644 => 100755 tests/tnew.nim mode change 100644 => 100755 tests/tnewsets.nim mode change 100644 => 100755 tests/tnewuns.nim mode change 100644 => 100755 tests/tnoop.nim mode change 100644 => 100755 tests/tnot.nim mode change 100644 => 100755 tests/tobject2.nim mode change 100644 => 100755 tests/tobjects.nim mode change 100644 => 100755 tests/toop1.nim mode change 100644 => 100755 tests/topaque.nim mode change 100644 => 100755 tests/topena1.nim mode change 100644 => 100755 tests/topenlen.nim mode change 100644 => 100755 tests/toptions.nim mode change 100644 => 100755 tests/tos.nim mode change 100644 => 100755 tests/toverflw.nim mode change 100644 => 100755 tests/toverl.nim mode change 100644 => 100755 tests/toverlop.nim mode change 100644 => 100755 tests/toverwr.nim mode change 100644 => 100755 tests/tovfint.nim mode change 100644 => 100755 tests/tparedef.nim mode change 100644 => 100755 tests/tparscfg.nim mode change 100644 => 100755 tests/tparsopt.nim mode change 100644 => 100755 tests/tpos.nim mode change 100644 => 100755 tests/tposix.nim mode change 100644 => 100755 tests/tprep.nim mode change 100644 => 100755 tests/tprintf.nim mode change 100644 => 100755 tests/tprocvar.nim mode change 100644 => 100755 tests/tpush.nim mode change 100644 => 100755 tests/tquit.nim mode change 100644 => 100755 tests/tradix.nim mode change 100644 => 100755 tests/trawstr.nim mode change 100644 => 100755 tests/treadln.nim mode change 100644 => 100755 tests/trecmod.nim mode change 100644 => 100755 tests/trecmod2.nim mode change 100644 => 100755 tests/trectype.nim mode change 100644 => 100755 tests/trefs.nim mode change 100644 => 100755 tests/tregex.nim mode change 100644 => 100755 tests/treguse.nim mode change 100644 => 100755 tests/trepr.nim mode change 100644 => 100755 tests/tseq2.nim mode change 100644 => 100755 tests/tseqcon.nim mode change 100644 => 100755 tests/tsets.nim mode change 100644 => 100755 tests/tsimmeth.nim mode change 100644 => 100755 tests/tsimtych.nim mode change 100644 => 100755 tests/tsizeof.nim mode change 100644 => 100755 tests/tstatret.nim mode change 100644 => 100755 tests/tstmtexp.nim mode change 100644 => 100755 tests/tstrace.nim mode change 100644 => 100755 tests/tstrange.nim mode change 100644 => 100755 tests/tstrdesc.nim mode change 100644 => 100755 tests/tstrdist.nim mode change 100644 => 100755 tests/tstreams.nim mode change 100644 => 100755 tests/tstrset.nim mode change 100644 => 100755 tests/tstrtabs.nim mode change 100644 => 100755 tests/tstrutil.nim mode change 100644 => 100755 tests/ttempl.nim mode change 100644 => 100755 tests/ttempl2.nim mode change 100644 => 100755 tests/ttempl3.nim mode change 100644 => 100755 tests/ttime.nim mode change 100644 => 100755 tests/tvardecl.nim mode change 100644 => 100755 tests/tvarious.nim mode change 100644 => 100755 tests/tvarnums.nim mode change 100644 => 100755 tests/twalker.nim mode change 100644 => 100755 tests/typalias.nim mode change 100644 => 100755 tests/typredef.nim mode change 100644 => 100755 tests/wingui.nim mode change 100644 => 100755 tests/x11test.nim mode change 100644 => 100755 tests/xmltest.html create mode 100755 tools/build.tmpl create mode 100755 tools/deinstall.tmpl mode change 100644 => 100755 tools/inno.tmpl mode change 100644 => 100755 tools/install.tmpl mode change 100644 => 100755 tools/niminst.nim mode change 100644 => 100755 tools/nimweb.nim mode change 100644 => 100755 tools/sunset.tmpl create mode 100755 tools/trimcc.nim mode change 100644 => 100755 unix2dos.py create mode 100755 web/community.txt create mode 100755 web/documentation.txt create mode 100755 web/download.txt create mode 100755 web/index.txt create mode 100755 web/links.txt create mode 100755 web/news.txt create mode 100755 web/nimrod.ini create mode 100755 web/question.txt create mode 100755 web/snippets/snippet1.nim create mode 100755 web/ticker.txt mode change 100644 => 100755 whiteutils.py diff --git a/.bzrignore b/.bzrignore old mode 100644 new mode 100755 diff --git a/Nimrod.geany b/Nimrod.geany old mode 100644 new mode 100755 diff --git a/boot.nim b/boot.nim old mode 100644 new mode 100755 index b7e2b221f..b7f3f4ed9 --- a/boot.nim +++ b/boot.nim @@ -27,9 +27,9 @@ proc exec(cmd: string) = proc writePlatdefC = var f: TFile - if openFile(f, "build/platdef.c", fmWrite): + if open(f, "build/platdef.c", fmWrite): write(f, PlatdefcTmpl % [system.hostOS, system.hostCPU]) - closeFile(f) + close(f) else: quit("Cannot write 'build/platdef.c'\n") diff --git a/cogapp.py b/cogapp.py old mode 100644 new mode 100755 diff --git a/config/my_nimrod.cfg b/config/my_nimrod.cfg old mode 100644 new mode 100755 diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg old mode 100644 new mode 100755 diff --git a/config/nimrod.cfg b/config/nimrod.cfg old mode 100644 new mode 100755 index 8ff1b1d86..6f6f89bc8 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -24,21 +24,23 @@ path="$lib/windows" path="$lib/posix" path="$lib/ecmas" -@if release: +@if release or quick: obj_checks:off field_checks:off range_checks:off bound_checks:off overflow_checks:off assertions:off - stacktrace:off debugger:off line_dir:off - opt:speed dead_code_elim:on @end +@if release: + opt:speed +@end + # additional options always passed to the compiler: --verbosity: "1" diff --git a/configure b/configure old mode 100644 new mode 100755 diff --git a/copying.txt b/copying.txt old mode 100644 new mode 100755 diff --git a/data/advopt.txt b/data/advopt.txt old mode 100644 new mode 100755 index 4cdbc5d0f..72e8ffb7c --- a/data/advopt.txt +++ b/data/advopt.txt @@ -14,6 +14,7 @@ Advanced options: --lib:PATH set the system library path -c, --compile_only compile only; do not assemble or link --no_linking compile but do not link + --no_main do not generate a main procedure --gen_script generate a compile script (in the 'nimcache' subdirectory named 'compile_$project$scriptext') --os:SYMBOL set the target operating system (cross-compilation) diff --git a/data/ast.yml b/data/ast.yml old mode 100644 new mode 100755 index cedc039a0..5281c9085 --- a/data/ast.yml +++ b/data/ast.yml @@ -57,11 +57,12 @@ 'TypeKind': [ # order is important! # Don't forget to change hti.nim if you make a change here 'tyNone', 'tyBool', 'tyChar', - 'tyEmpty', 'tyArrayConstr', 'tyNil', - 'tyGeneric', - 'tyGenericInst', # instantiated generic type - 'tyGenericParam', - 'tyAbstract', # abstract type + 'tyEmpty', 'tyArrayConstr', 'tyNil', 'tyExpr', 'tyStmt', 'tyTypeDesc', + 'tyGenericInvokation', # ``T[a, b]`` for types to invoke + 'tyGenericBody', # ``T[a, b, body]`` last parameter is the body + 'tyGenericInst', # ``T[a, b, realInstance]`` instantiated generic type + 'tyGenericParam', # ``a`` in the example + 'tyDistinct', 'tyEnum', 'tyOrdinal', 'tyArray', @@ -123,8 +124,9 @@ # for transforming ``s.len`` to ``len(s)`` 'nkCommand', # a call like ``p 2, 4`` without parenthesis 'nkCall', # a call like p(x, y) or an operation like +(a, b) - 'nkGenericCall', # a call with given type parameters - 'nkExplicitTypeListCall', # a call with given explicit typelist + 'nkCallStrLit', # a call with a string literal + # x"abc" has two sons: nkIdent, nkRStrLit + # x"""abc""" has two sons: nkIdent, nkTripleStrLit 'nkExprEqExpr', # a named parameter with equals: ''expr = expr'' 'nkExprColonExpr', # a named parameter with colon: ''expr: expr'' 'nkIdentDefs', # a definition like `a, b: typeDesc = expr` @@ -174,7 +176,6 @@ 'nkAsgn', # a = b 'nkFastAsgn', # internal node for a fast ``a = b`` (no string copy) - 'nkDefaultTypeParam', # `ident = typeDesc` in generic parameters 'nkGenericParams', # generic parameters 'nkFormalParams', # formal parameters 'nkOfInherit', # inherited from symbol @@ -215,7 +216,6 @@ 'nkStmtList', # a list of statements 'nkImportStmt', # an import statement 'nkFromStmt', # a from * import statement - 'nkImportAs', # an `import xyx as abc` section 'nkIncludeStmt', # an include statement 'nkCommentStmt', # a comment statement 'nkStmtListExpr', # a statement list followed by an expr; this is used @@ -225,20 +225,18 @@ # temporary scope 'nkStmtListType', # a statement list ending in a type; for macros 'nkBlockType', # a statement block ending in a type; for macros - 'nkVm', # indicates a virtual instruction; integer field is - # used for the concrete opcode - + # types as syntactic trees: 'nkTypeOfExpr', 'nkObjectTy', 'nkTupleTy', - 'nkRecList', # list of record/object parts - 'nkRecCase', # case section of record/object - 'nkRecWhen', # when section of record/object + 'nkRecList', # list of object parts + 'nkRecCase', # case section of object + 'nkRecWhen', # when section of object 'nkRefTy', 'nkPtrTy', 'nkVarTy', - 'nkAbstractTy', # abstract type + 'nkDistinctTy', # distinct type 'nkProcTy', 'nkEnumTy', 'nkEnumFieldDef', # `ident = expr` in an enumeration @@ -248,12 +246,13 @@ 'SymKind': [ # the different symbols (start with the prefix sk); # order is important for the documentation generator! - 'skUnknownSym', # unknown symbol: used for parsing assembler blocks + 'skUnknown', # unknown symbol: used for parsing assembler blocks + # and first phase symbol lookup in generics 'skConditional', # symbol for the preprocessor (may become obsolete) 'skDynLib', # symbol represents a dynamic library; this is used # internally; it does not exist in Nimrod code 'skParam', # a parameter - 'skTypeParam', # a type parameter; example: proc x[T]() <- `T` + 'skGenericParam', # a generic parameter; eq in ``proc x[eq=`==`]()`` 'skTemp', # a temporary variable (introduced by compiler) 'skType', # a type 'skConst', # a constant diff --git a/data/basicopt.txt b/data/basicopt.txt old mode 100644 new mode 100755 index 9ba29c265..c716f7641 --- a/data/basicopt.txt +++ b/data/basicopt.txt @@ -5,6 +5,7 @@ Command:: compile_to_c, cc compile project with C code generator doc generate the documentation for inputfile rst2html converts a reStructuredText file to HTML + rst2tex converts a reStructuredText file to TeX Arguments: arguments are passed to the program being run (if --run option is selected) Options: diff --git a/data/ccomps.txt b/data/ccomps.txt old mode 100644 new mode 100755 diff --git a/data/keywords.txt b/data/keywords.txt old mode 100644 new mode 100755 index 5d20e8aeb..0ea2e1663 --- a/data/keywords.txt +++ b/data/keywords.txt @@ -1,7 +1,7 @@ -abstract addr and as asm +addr and as asm bind block break case cast const continue converter -discard div +discard distinct div elif else end enum except finally for from generic if implies import in include is isnot iterator diff --git a/data/magic.yml b/data/magic.yml old mode 100644 new mode 100755 index d0aeb378f..2be41d11e --- a/data/magic.yml +++ b/data/magic.yml @@ -3,6 +3,7 @@ [ 'None', 'Defined', +'DefinedInScope', 'Low', 'High', 'SizeOf', @@ -17,7 +18,6 @@ 'New', 'NewFinalize', 'NewSeq', -'RegisterFinalizer', 'LengthOpenArray', 'LengthStr', 'LengthArray', @@ -203,6 +203,9 @@ 'EmptySet', 'IntSetBaseType', 'Nil', +'Expr', +'Stmt', +'TypeDesc', # magic constants: 'IsMainModule', diff --git a/data/messages.yml b/data/messages.yml old mode 100644 new mode 100755 index 83f591e0f..44e05dca9 --- a/data/messages.yml +++ b/data/messages.yml @@ -31,15 +31,14 @@ {'errOperatorExpected': "operator expected, but found '$1'"}, {'errTokenExpected': "'$1' expected"}, {'errStringAfterIncludeExpected': "string after 'include' expected"}, -{'errRecursiveInclude': "recursive include file: '$1'"}, +{'errRecursiveDependencyX': "recursive dependency: '$1'"}, {'errOnOrOffExpected': "'on' or 'off' expected"}, {'errNoneSpeedOrSizeExpected': "'none', 'speed' or 'size' expected"}, {'errInvalidPragma': 'invalid pragma'}, {'errUnknownPragma': "unknown pragma: '$1'"}, -{'errUnknownDirective': "unknown directive: '$1'"}, -{'errInvalidDirective': 'invalid directive'}, +{'errInvalidDirectiveX': "invalid directive: '$1'"}, {'errAtPopWithoutPush': "'pop' without a 'push' pragma"}, -{'errEmptyAsm': 'empty asm statement makes no sense'}, +{'errEmptyAsm': 'empty asm statement'}, {'errInvalidIndentation': 'invalid indentation'}, {'errExceptionExpected': 'exception expected'}, {'errExceptionAlreadyHandled': 'exception already handled'}, @@ -93,9 +92,6 @@ {'errCannotEvalXBecauseIncompletelyDefined': "cannot evalutate '$1' because type is not defined completely"}, {'errChrExpectsRange0_255': "'chr' expects an int in the range 0..255"}, -{'errStaticAssertFailed': "'staticAssert' failed: condition is false"}, -{'errStaticAssertCannotBeEval': - "argument to 'staticAssert' cannot be evaluated at compile time"}, {'errDotRequiresRecordOrObjectType': "'.' requires a record or object type"}, {'errUndeclaredFieldX': "undeclared field: '$1'"}, {'errNilAccess': 'attempt to access a nil address'}, @@ -155,7 +151,7 @@ {'errButExpected': 'but expected one of: '}, {'errButExpectedX': "but expected '$1'"}, {'errAmbiguousCallXYZ': 'ambiguous call; both $1 and $2 match for: $3'}, -{'errWrongNumberOfTypeParams': 'wrong number of type parameters'}, +{'errWrongNumberOfArguments': 'wrong number of arguments'}, {'errInlineProcHasNoAddress': 'an inline proc has no address'}, {'errXCannotBeInParamDecl': '$1 cannot be declared in parameter declaration'}, {'errPragmaOnlyInHeaderOfProc': @@ -198,16 +194,14 @@ {'errNamedExprNotAllowed': 'named expression not allowed here'}, {'errXExpectsOneTypeParam': "'$1' expects one type parameter"}, {'errArrayExpectsTwoTypeParams': 'array expects two type parameters'}, -{'errInvalidVisibilityX': "invalid invisibility: '$1'"}, +{'errInvalidVisibilityX': "invalid visibility: '$1'"}, {'errInitHereNotAllowed': 'initialization not allowed here'}, {'errXCannotBeAssignedTo': "'$1' cannot be assigned to"}, {'errIteratorNotAllowed': "iterators can only be defined at the module's top level"}, -{'errIteratorNeedsImplementation': 'iterator needs an implementation'}, -{'errIteratorNeedsReturnType': 'iterator needs a return type'}, +{'errXNeedsReturnType': '$1 needs a return type'}, {'errInvalidCommandX': "invalid command: '$1'"}, {'errXOnlyAtModuleScope': "'$1' is only allowed at top level"}, -{'errTypeXNeedsImplementation': "type '$1' needs an implementation"}, {'errTemplateInstantiationTooNested': 'template instantiation too nested'}, {'errInstantiationFrom': 'instantiation from here'}, {'errInvalidIndexValueForTuple': 'invalid index value for tuple subscript'}, @@ -230,12 +224,12 @@ {'errInvalidConversionFromTypeX': "invalid conversion from type '$1'"}, {'errAssertionFailed': "assertion failed"}, {'errCannotGenerateCodeForX': "cannot generate code for '$1'"}, -{'errXNeedsReturnType': "converter needs return type"}, -{'errXRequiresOneArgument': "converter requires one parameter"}, +{'errXRequiresOneArgument': "$1 requires one parameter"}, {'errUnhandledExceptionX': "unhandled exception: $1"}, {'errCyclicTree': "macro returned a cyclic abstract syntax tree"}, {'errXisNoMacroOrTemplate': "'$1' is no macro or template"}, {'errXhasSideEffects': "'$1' can have side effects"}, +{'errIteratorExpected': "iterator within for loop context expected"}, # user error message: {'errUser': '$1'}, diff --git a/data/pas_keyw.yml b/data/pas_keyw.yml old mode 100644 new mode 100755 diff --git a/data/readme.txt b/data/readme.txt old mode 100644 new mode 100755 diff --git a/diff/empty.txt b/diff/empty.txt old mode 100644 new mode 100755 diff --git a/doc/abstypes.txt b/doc/abstypes.txt old mode 100644 new mode 100755 index 00a42639c..44c3bb0c9 --- a/doc/abstypes.txt +++ b/doc/abstypes.txt @@ -91,7 +91,7 @@ we define our own ``+`` for dollars: result = TDollar(int(x) + int(y)) It does not make sense to multiply a dollar with a dollar, but with a -unit-less number; and the same holds for division: +number without unit; and the same holds for division: .. code-block:: proc `*` (x: TDollar, y: int): TDollar = @@ -121,7 +121,7 @@ But it seems we still have to repeat all this boilerplate code for the ``TEuro`` currency. Fortunately, Nimrod has a template mechanism: .. code-block:: nimrod - template Additive(typ: typeExpr): stmt = + template Additive(typ: typeDesc): stmt = proc `+` *(x, y: typ): typ {.borrow.} proc `-` *(x, y: typ): typ {.borrow.} @@ -129,13 +129,13 @@ the ``TEuro`` currency. Fortunately, Nimrod has a template mechanism: proc `+` *(x: typ): typ {.borrow.} proc `-` *(x: typ): typ {.borrow.} - template Multiplicative(typ, base: typeExpr): stmt = + template Multiplicative(typ, base: typeDesc): stmt = proc `*` *(x: typ, y: base): typ {.borrow.} proc `*` *(x: base, y: typ): typ {.borrow.} proc `div` *(x: typ, y: base): typ {.borrow.} proc `mod` *(x: typ, y: base): typ {.borrow.} - template Comparable(typ: typeExpr): stmt = + template Comparable(typ: typeDesc): stmt = proc `<` * (x, y: typ): bool {.borrow.} proc `<=` * (x, y: typ): bool {.borrow.} proc `==` * (x, y: typ): bool {.borrow.} diff --git a/doc/astspec.txt b/doc/astspec.txt old mode 100644 new mode 100755 diff --git a/doc/docs.txt b/doc/docs.txt old mode 100644 new mode 100755 diff --git a/doc/endb.txt b/doc/endb.txt old mode 100644 new mode 100755 diff --git a/doc/filelist.txt b/doc/filelist.txt old mode 100644 new mode 100755 diff --git a/doc/grammar.txt b/doc/grammar.txt old mode 100644 new mode 100755 index 8c3966387..2fcb68236 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -135,10 +135,10 @@ fromStmt ::= 'from' filename 'import' symbol (comma symbol)* pragma ::= '{.' optInd (colonExpr [comma])* [SAD] ('.}' | '}') -param ::= symbol (comma symbol)* ':' typeDesc +param ::= symbol (comma symbol)* (':' typeDesc ['=' expr] | '=' expr) paramList ::= ['(' [param (comma param)*] [SAD] ')'] [':' typeDesc] -genericParam ::= symbol [':' typeDesc] +genericParam ::= symbol [':' typeDesc] ['=' expr] genericParams ::= '[' genericParam (comma genericParam)* [SAD] ']' procDecl ::= 'proc' symbol ['*'] [genericParams] paramList [pragma] diff --git a/doc/intern.txt b/doc/intern.txt old mode 100644 new mode 100755 index 646cb9d9c..1deeb4c4e --- a/doc/intern.txt +++ b/doc/intern.txt @@ -17,7 +17,7 @@ The Nimrod project's directory structure is: ============ ============================================== Path Purpose ============ ============================================== -``bin`` binary files go into here +``bin`` generated binary files ``build`` generated C code for the installation ``nim`` Pascal sources of the Nimrod compiler; this should be modified, not the Nimrod version in @@ -26,16 +26,16 @@ Path Purpose automatically generated from the Pascal version ``data`` data files that are used for generating source - code go into here + code ``doc`` the documentation lives here; it is a bunch of reStructuredText files ``dist`` additional packages for the distribution -``config`` configuration files for Nimrod go into here +``config`` configuration files for Nimrod ``lib`` the Nimrod library lives here; ``rod`` depends on it! ``web`` website of Nimrod; generated by ``koch.py`` from the ``*.txt`` and ``*.tmpl`` files -``obj`` generated ``*.obj`` files go into here +``obj`` generated ``*.obj`` files ============ ============================================== @@ -72,6 +72,18 @@ the same:: ./boot [-d:release] +Coding Guidelines +================= + +* Use CamelCase, not underscored_identifiers. +* Indent with two spaces. +* Max line length is 80 characters. +* Provide spaces around binary operators if that enhances readability. +* Use a space after a colon, but not before it. +* Start types with a capital ``T``, unless they are pointers which start with + ``P``. + + Pascal annotations ================== There are some annotations that the Pascal sources use so that they can @@ -153,9 +165,9 @@ Complex assignments for any type that needs one. However, this would make the code bigger and the RTTI is likely already there for the GC. -We already knew the type information as a graph in the compiler. +We already know the type information as a graph in the compiler. Thus we need to serialize this graph as RTTI for C code generation. -Look at the file ``lib/hti.nim`` for more information. +Look at the file ``lib/system/hti.nim`` for more information. The Garbage Collector @@ -243,11 +255,8 @@ Consider this example: # r is on the stack setRef(r.left) # here we should update the refcounts! -Though it would be possible to produce code updating the refcounts (if -necessary) before and after the call to ``setRef``, it is a complex task to -do so in the code generator. So we don't and instead decide at runtime -whether the reference is on the stack or not. The generated code looks -roughly like this: +We have to decide at runtime whether the reference is on the stack or not. +The generated code looks roughly like this: .. code-block:: C void setref(TNode** ref) { @@ -260,13 +269,7 @@ roughly like this: Note that for systems with a continous stack (which most systems have) the check whether the ref is on the stack is very cheap (only two -comparisons). Another advantage of this scheme is that the code produced is -smaller. - - -The algorithm in pseudo-code ----------------------------- -To be written. +comparisons). The compiler's architecture @@ -332,3 +335,93 @@ underlying C compiler already does all the hard work for us. The problem is the common runtime library, especially the memory manager. Note that Borland's Delphi had exactly the same problem. The workaround is to not link the GC with the Dll and provide an extra runtime dll that needs to be initialized. + + +Code generation for closures +============================ + +Example code: + +.. code-block:: nimrod + proc add(x: int): proc (y: int): int {.closure.} = + return lambda (y: int): int = + return x + y + + var add2 = add(2) + echo add2(5) #OUT 7 + +This should produce roughly this code: + +.. code-block:: nimrod + type + PClosure = ref object + fn: proc (x: int, c: PClosure): int + x: int # data + + proc wasLambda(y: int, c: PClosure): int = + return y + c.x + + proc add(x: int): PClosure = + var c: PClosure + new(c) + c.x = x + c.fn = wasLambda + + var add2 = add(2) + echo add2.fn(5, add2) + + +Beware of nesting: + +.. code-block:: nimrod + proc add(x: int): proc (y: int): proc (z: int): int {.closure.} {.closure.} = + return lamba (y: int): proc (z: int): int {.closure.} = + return lambda (z: int): int = + return x + y + z + + var add24 = add(2)(4) + echo add24(5) #OUT 11 + +This should produce roughly this code: + +.. code-block:: nimrod + type + PClosure1 = ref object + fn: proc (x: int, c: PClosure1): int + x: int # data + + PClosure2 = ref object + fn: proc (x: int, c: PClosure2): int + y: int + c1: PClosure1 + + + proc innerLambda(z: int, c2: PClosure2): int = + return c2.c1.x + c2.y + z + + proc outerLambda1(y: int, c1: PClosure1): PClosure2 = + new(result) + result.c1 = c1 + result.y = y + result.fn = innerLambda + + proc add(x: int): PClosure1 = + new(result) + result.x = x + result.fn = outerLambda + + var tmp = add(2) + var tmp2 = tmp.fn(4, tmp) + var add24 = tmp2.fn(4, tmp2) + echo add24(5) + + +Accumulator +----------- + +.. code-block:: nimrod + proc GetAccumulator(start: int): proc (): int {.closure} = + var i = start + return lambda: int = + inc i + return i diff --git a/doc/lib.txt b/doc/lib.txt old mode 100644 new mode 100755 index ec861b4c1..6850ab515 --- a/doc/lib.txt +++ b/doc/lib.txt @@ -134,7 +134,7 @@ Impure libraries Wrappers ======== -Note that the generated HTML for some of these wrappers is so huge, that it is +The generated HTML for some of these wrappers is so huge, that it is not contained in the distribution. You can then find them on the website. * `posix `_ diff --git a/doc/manual.txt b/doc/manual.txt old mode 100644 new mode 100755 index 1c7eb01b7..e02bc1397 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -8,6 +8,10 @@ Nimrod Manual .. contents:: + "Complexity" seems to be a lot like "energy": you can transfer it from the end + user to one/some of the other players, but the total amount seems to remain + pretty much constant for a given task. -- Ran + About this document =================== @@ -171,10 +175,10 @@ preferred. Another advantage is that it frees the programmer from remembering the exact spelling of an identifier. -Literal strings +String literals --------------- -`Literal strings`:idx: can be delimited by matching double quotes, and can +`String literals`:idx: can be delimited by matching double quotes, and can contain the following `escape sequences`:idx:\ : ================== =================================================== @@ -202,12 +206,21 @@ contain the following `escape sequences`:idx:\ : Strings in Nimrod may contain any 8-bit value, except embedded zeros. -Literal strings can also be delimited by three double squotes + +Triple quoted string literals +----------------------------- + +String literals can also be delimited by three double quotes ``"""`` ... ``"""``. Literals in this form may run for several lines, may contain ``"`` and do not interpret any escape sequences. For convenience, when the opening ``"""`` is immediately followed by a newline, the newline is not included in the string. + + +Raw string literals +------------------- + There are also `raw string literals` that are preceded with the letter ``r`` (or ``R``) and are delimited by matching double quotes (just like ordinary string literals) and do not interpret the escape sequences. This is especially @@ -218,7 +231,22 @@ convenient for regular expressions or Windows paths: var f = openFile(r"C:\texts\text.txt") # a raw string, so ``\t`` is no tab -Literal characters +Generalized raw string literals +------------------------------- + +The construct ``identifier"string literal"`` (without whitespace between the +identifier and the opening quotation mark) is a +`generalized raw string literal`:idx:. It is a shortcut for the construct +``identifier(r"string literal")``, so it denotes a procedure call with a +raw string literal as its only argument. Generalized raw string literals +are especially convenient for embedding mini languages directly into Nimrod +(for example regular expressions). + +The construct ``identifier"""string literal"""`` exists too. It is a shortcut +for ``identifier("""string literal""")``. + + +Character literals ------------------ Character literals are enclosed in single quotes ``''`` and can contain the @@ -501,7 +529,7 @@ designed for this. Another reason is that Nimrod can support ``array[char, int]`` or ``set[char]`` efficiently as many algorithms rely on this feature. The `TRune` type is used for Unicode characters, it can represent any Unicode -character. ``TRune`` is declared the ``unicode`` module. +character. ``TRune`` is declared in the ``unicode`` module. @@ -548,7 +576,7 @@ Subrange types ~~~~~~~~~~~~~~ A `subrange`:idx: type is a range of values from an ordinal type (the base type). To define a subrange type, one must specify it's limiting values: the -highest and lowest value of the type: +lowest and highest value of the type: .. code-block:: nimrod type @@ -764,7 +792,7 @@ basetype can only be an ordinal type. The reason is that sets are implemented as high performance bit vectors. Sets can be constructed via the set constructor: ``{}`` is the empty set. The -empty set is type combatible with any special set type. The constructor +empty set is type compatible with any special set type. The constructor can also be used to include elements (and ranges of elements) in the set: .. code-block:: nimrod @@ -903,9 +931,8 @@ each other: `closure`:idx: indicates that the procedure expects a context, a closure that needs - to be passed to the procedure. The implementation is the - same as ``cdecl``, but with a hidden pointer parameter (the - *closure*). The hidden parameter is always the last one. + to be passed to the procedure. The calling convention ``nimcall`` is + compatible to ``closure``. `syscall`:idx: The syscall convention is the same as ``__syscall`` in C. It is used for @@ -915,11 +942,108 @@ each other: The generated C code will not have any explicit calling convention and thus use the C compiler's default calling convention. This is needed because Nimrod's default calling convention for procedures is ``fastcall`` to - improve speed. This is unlikely to be needed by the user. + improve speed. Most calling conventions exist only for the Windows 32-bit platform. +Distinct type +~~~~~~~~~~~~~ + +A distinct type is new type derived from a `base type`:idx: that is +incompatible with its base type. In particular, it is an essential property +of a distinct type that it **does not** imply a subtype relation between it +and its base type. Explict type conversions from a distinct type to its +base type and vice versa are allowed. + +A distinct type can be used to model different physical `units`:idx: with a +numerical base type, for example. The following example models currencies. + +Different currencies should not be mixed in monetary calculations. Distinct +types are a perfect tool to model different currencies: + +.. code-block:: nimrod + type + TDollar = distinct int + TEuro = distinct int + + var + d: TDollar + e: TEuro + + echo d + 12 + # Error: cannot add a number with no unit and a ``TDollar`` + +Unfortunetaly, ``d + 12.TDollar`` is not allowed either, +because ``+`` is defined for ``int`` (among others), not for ``TDollar``. So +a ``+`` for dollars needs to be defined: + +.. code-block:: + proc `+` (x, y: TDollar): TDollar = + result = TDollar(int(x) + int(y)) + +It does not make sense to multiply a dollar with a dollar, but with a +number without unit; and the same holds for division: + +.. code-block:: + proc `*` (x: TDollar, y: int): TDollar = + result = TDollar(int(x) * y) + + proc `*` (x: int, y: TDollar): TDollar = + result = TDollar(x * int(y)) + + proc `div` ... + +This quickly gets tedious. The implementations are trivial and the compiler +should not generate all this code only to optimize it away later - after all +``+`` for dollars should produce the same binary code as ``+`` for ints. +The pragma ``borrow`` has been designed to solve this problem; in principle +it generates the above trivial implementations: + +.. code-block:: nimrod + proc `*` (x: TDollar, y: int): TDollar {.borrow.} + proc `*` (x: int, y: TDollar): TDollar {.borrow.} + proc `div` (x: TDollar, y: int): TDollar {.borrow.} + +The ``borrow`` pragma makes the compiler use the same implementation as +the proc that deals with the distinct type's base type, so no code is +generated. + +But it seems all this boilerplate code needs to be repeated for the ``TEuro`` +currency. This can be solved with templates_. + +.. code-block:: nimrod + template Additive(typ: typeDesc): stmt = + proc `+` *(x, y: typ): typ {.borrow.} + proc `-` *(x, y: typ): typ {.borrow.} + + # unary operators: + proc `+` *(x: typ): typ {.borrow.} + proc `-` *(x: typ): typ {.borrow.} + + template Multiplicative(typ, base: typeDesc): stmt = + proc `*` *(x: typ, y: base): typ {.borrow.} + proc `*` *(x: base, y: typ): typ {.borrow.} + proc `div` *(x: typ, y: base): typ {.borrow.} + proc `mod` *(x: typ, y: base): typ {.borrow.} + + template Comparable(typ: typeDesc): stmt = + proc `<` * (x, y: typ): bool {.borrow.} + proc `<=` * (x, y: typ): bool {.borrow.} + proc `==` * (x, y: typ): bool {.borrow.} + + template DefineCurrency(typ, base: expr): stmt = + type + typ* = distinct base + Additive(typ) + Multiplicative(typ, base) + Comparable(typ) + + DefineCurrency(TDollar, int) + DefineCurrency(TEuro, int) + + + Type relations -------------- @@ -956,7 +1080,7 @@ algorithm determines type equality: for i in 0..a.tupleLen-1: if not typeEqualsAux(a[i], b[i], s): return false result = true - of object, enum, abstract: + of object, enum, distinct: result = a == b of proc: result = typeEqualsAux(a.parameterTuple, b.parameterTuple, s) and @@ -973,7 +1097,7 @@ auxiliary set ``s`` to detect this case. Subtype relation ~~~~~~~~~~~~~~~~ -If object ``b`` inherits from ``a``, ``b`` is a subtype of ``a``. This subtype +If object ``a`` inherits from ``b``, ``a`` is a subtype of ``b``. This subtype relation is extended to the types ``var``, ``ref``, ``ptr``: .. code-block:: nimrod @@ -987,27 +1111,70 @@ relation is extended to the types ``var``, ``ref``, ``ptr``: of var, ref, ptr: result = isSubtype(a.baseType, b.baseType) -XXX nil is a special value! +.. XXX nil is a special value! Convertible relation ~~~~~~~~~~~~~~~~~~~~ -A type ``a`` is convertible to type ``b`` iff the following algorithm returns -true: +A type ``a`` is **implicitely** convertible to type ``b`` iff the following +algorithm returns true: .. code-block:: nimrod - proc isConvertible(a, b: PType): bool = - if a.kind == b.kind: - case a.kind - of proc: + # XXX range types? + proc isImplicitelyConvertible(a, b: PType): bool = + case a.kind + of proc: + if b.kind == proc: var x = a.parameterTuple var y = b.parameterTuple if x.tupleLen == y.tupleLen: for i in 0.. x.tupleLen-1: if not isSubtype(x[i], y[i]): return false result = isSubType(b.resultType, a.resultType) + of int8: result = b.kind in {int16, int32, int64, int} + of int16: result = b.kind in {int32, int64, int} + of int32: result = b.kind in {int64, int} + of float: result = b.kind in {float32, float64} + of float32: result = b.kind in {float64, float} + of float64: result = b.kind in {float32, float} + of seq: + result = b.kind == openArray and typeEquals(a.baseType, b.baseType) + of array: + result = b.kind == openArray and typeEquals(a.baseType, b.baseType) + if a.baseType == char and a.indexType.rangeA == 0: + result = b.kind = cstring + of cstring, ptr: + result = b.kind == pointer + of string: + result = b.kind == cstring + +A type ``a`` is **explicitely** convertible to type ``b`` iff the following +algorithm returns true: + +.. code-block:: nimrod + proc isIntegralType(t: PType): bool = + result = isOrdinal(t) or t.kind in {float, float32, float64} + + proc isExplicitelyConvertible(a, b: PType): bool = + if isImplicitelyConvertible(a, b): return true + if isIntegralType(a) and isIntegralType(b): return true + if isSubtype(a, b) or isSubtype(b, a): return true + if a.kind == distinct and typeEquals(a.baseType, b): return true + if b.kind == distinct and typeEquals(b.baseType, a): return true + return false + + +Assignment compability +~~~~~~~~~~~~~~~~~~~~~~ + +An expression ``b`` can be assigned to an expression ``a`` iff ``a`` is an +`l-value` and ``isImplicitelyConvertible(b.typ, a.typ)`` holds. +Overloading resolution +~~~~~~~~~~~~~~~~~~~~~~ + +To be written. Statements and expressions @@ -1095,7 +1262,7 @@ Type default value ============================ ============================================== any integer type 0 any float 0.0 -char '\0' +char '\\0' bool false ref or pointer type nil procedural type nil @@ -1192,8 +1359,8 @@ a static error is given. This holds only for expressions of ordinal types. If the expression is not of an ordinal type, and no ``else`` part is given, control just passes after the ``case`` statement. -To suppress the static error in the ordinal case the programmer needs -to write an ``else`` part with a ``nil`` statement. +To suppress the static error in the ordinal case an ``else`` part with a ``nil`` +statement can be used. When statement @@ -1271,7 +1438,7 @@ Example: # and tries to add them var f: TFile - if openFile(f, "numbers.txt"): + if open(f, "numbers.txt"): try: var a = readLine(f) var b = readLine(f) @@ -1285,7 +1452,7 @@ Example: except: echo("Unknown exception!") finally: - closeFile(f) + close(f) The statements after the `try`:idx: are executed in sequential order unless an exception ``e`` is raised. If the exception type of ``e`` matches any @@ -1417,7 +1584,7 @@ Example: The `while`:idx: statement is executed until the ``expr`` evaluates to false. Endless loops are no error. ``while`` statements open an `implicit block`, -so that they can be leaved with a ``break`` statement. +so that they can be left with a ``break`` statement. Continue statement @@ -1562,8 +1729,9 @@ type `var`). return intToStr(x) Operators with one parameter are prefix operators, operators with two -parameters are infix operators. There is no way to declare postfix -operators: All postfix operators are built-in and handled by the +parameters are infix operators. (However, the parser distinguishes these from +the operators position within an expression.) There is no way to declare +postfix operators: All postfix operators are built-in and handled by the grammar explicitely. Any operator can be called like an ordinary proc with the '`opr`' @@ -1622,18 +1790,13 @@ return values. This can be done in a cleaner way by returning a tuple: assert t.res == 1 assert t.remainder = 3 -Even more elegant is to use `tuple unpacking` to access the tuple's fields: +Even more elegant is to use `tuple unpacking`:idx: to access the tuple's fields: .. code-block:: nimrod var (x, y) = divmod(8, 5) # tuple unpacking assert x == 1 assert y == 3 -Unfortunately, this form of tuple unpacking is not yet implemented. - -.. - XXX remove this as soon as tuple unpacking is implemented - Iterators and the for statement @@ -1655,7 +1818,7 @@ Syntax:: The `for`:idx: statement is an abstract mechanism to iterate over the elements of a container. It relies on an `iterator`:idx: to do so. Like ``while`` statements, ``for`` statements open an `implicit block`:idx:, so that they -can be leaved with a ``break`` statement. The ``for`` loop declares +can be left with a ``break`` statement. The ``for`` loop declares iteration variables (``x`` in the example) - their scope reaches until the end of the loop body. The iteration variables' types are inferred by the return type of the iterator. @@ -1737,8 +1900,6 @@ possible within a single ``type`` section. Generics ~~~~~~~~ -`Version 0.7.10: Generic types like in the example do not work.`:red: - Example: .. code-block:: nimrod @@ -1778,11 +1939,9 @@ Example: # inorder traversal of a binary tree # recursive iterators are not yet implemented, so this does not work in # the current compiler! - if root.le != nil: - yield inorder(root.le) + if root.le != nil: yield inorder(root.le) yield root.data - if root.ri != nil: - yield inorder(root.ri) + if root.ri != nil: yield inorder(root.ri) var root: PBinaryTree[string] # instantiate a PBinaryTree with the type string @@ -1799,12 +1958,11 @@ introduce type parameters or to instantiate a generic proc, iterator or type. Templates ~~~~~~~~~ -A `template`:idx: is a simple form of a macro. It operates on parse trees and is -processed in the semantic pass of the compiler. So they integrate well with the -rest of the language and share none of C's preprocessor macros flaws. However, -they may lead to code that is harder to understand and maintain. So one ought -to use them sparingly. The usage of ordinary procs, iterators or generics is -preferred to the usage of templates. +A `template`:idx: is a simple form of a macro: It is a simple substitution +mechanism that operates on Nimrod's abstract syntax trees. It is processed in +the semantic pass of the compiler. + +The syntax to *invoke* a template is the same as calling a procedure. Example: @@ -1815,20 +1973,86 @@ Example: assert(5 != 6) # the compiler rewrites that to: assert(not (5 == 6)) +The ``!=``, ``>``, ``>=``, ``in``, ``notin``, ``isnot`` operators are in fact +templates: + +| ``a > b`` is transformed into ``b < a``. +| ``a in b`` is transformed into ``contains(b, a)``. +| ``notin`` and ``isnot`` have the obvious meanings. + +The "types" of templates can be the symbols ``expr`` (stands for *expression*), +``stmt`` (stands for *statement*) or ``typedesc`` (stands for *type +description*). These are no real types, they just help the compiler parsing. +Real types can be used too; this implies that expressions are expected. +However, for parameter type checking the arguments are semantically checked +before being passed to the template. Other arguments are not semantically +checked before being passed to the template. + +The template body does not open a new scope. To open a new scope a ``block`` +statement can be used: + +.. code-block:: nimrod + template declareInScope(x: expr, t: typeDesc): stmt = + var x: t + + template declareInNewScope(x: expr, t: typeDesc): stmt = + # open a new scope: + block: + var x: t + + declareInScope(a, int) + a = 42 # works, `a` is known here + + declareInNewScope(b, int) + b = 42 # does not work, `b` is unknown + + +If there is a ``stmt`` parameter it should be the last in the template +declaration, because statements are passed to a template via a +special ``:`` syntax: + +.. code-block:: nimrod + + template withFile(f, fn, mode: expr, actions: stmt): stmt = + block: + var f: TFile + if open(f, fn, mode): + try: + actions + finally: + close(f) + else: + quit("cannot open: " & fn) + + withFile(txt, "ttempl3.txt", fmWrite): + txt.writeln("line 1") + txt.writeln("line 2") + +In the example the two ``writeln`` statements are bound to the ``actions`` +parameter. + + +**Style note**: For code readability, it is the best idea to use the least +powerful programming construct that still suffices. So the "check list" is: + +(1) Use an ordinary proc/iterator, if possible. +(2) Else: Use a generic proc/iterator, if possible. +(3) Else: Use a template, if possible. +(4) Else: Use a macro. + Macros ------ `Macros`:idx: are the most powerful feature of Nimrod. They can be used -to implement `domain specific languages`:idx:. But they may lead to code -that is harder to understand and maintain. So one ought to use them sparingly. +to implement `domain specific languages`:idx:. While macros enable advanced compile-time code tranformations, they cannot change Nimrod's syntax. However, this is no real restriction because Nimrod's syntax is flexible enough anyway. To write macros, one needs to know how the Nimrod concrete syntax is converted -to an abstract syntax tree. (Unfortunately the AST is not yet documented.) +to an abstract syntax tree. There are two ways to invoke a macro: (1) invoking a macro like a procedure call (`expression macros`) @@ -1847,7 +2071,7 @@ variable number of arguments: import macros macro debug(n: expr): stmt = - # `n` is a Nimrod AST that contains the whole macro expression + # `n` is a Nimrod AST that contains the whole macro invokation # this macro returns a list of statements: result = newNimNode(nnkStmtList, n) # iterate over any argument that is passed to this macro: @@ -1948,6 +2172,7 @@ This is best illustrated by an example: main() +.. code-block:: nimrod # Module B import A # A is not parsed here! Only the already known symbols # of A are imported. @@ -1981,7 +2206,7 @@ Tuple or object scope The field identifiers inside a tuple or object definition are valid in the following places: -* To the end of the tuple/object definition +* To the end of the tuple/object definition. * Field designators of a variable of the given tuple/object type. * In all descendent types of the object type. @@ -2000,9 +2225,11 @@ iterator in which case the overloading resolution takes place: # Module A var x*: string +.. code-block:: nimrod # Module B var x*: int +.. code-block:: nimrod # Module C import A, B write(stdout, x) # error: x is ambiguous @@ -2035,26 +2262,22 @@ processed on the fly during semantic checking. Pragmas are enclosed in the special ``{.`` and ``.}`` curly brackets. -define pragma -------------- -The `define`:idx: pragma defines a conditional symbol. This symbol may only be -used in other pragmas and in the ``defined`` expression and not in ordinary -Nimrod source code. The conditional symbols go into a special symbol table. -The compiler defines the target processor and the target operating -system as conditional symbols. - -Warning: The ``define`` pragma is deprecated as it conflicts with separate -compilation! One should use boolean constants as a replacement - this is -cleaner anyway. +noSideEffect pragma +------------------- +The `noSideEffect`:idx: pragma is used to mark a proc/iterator to have no side +effects. This means that the proc/iterator only changes locations that are +reachable from its parameters and the return value only depends on the +arguments. If none of its parameters have the type ``var T`` +or ``ref T`` or ``ptr T`` this means no locations are modified. It is a static +error to mark a proc/iterator to have no side effect if the compiler cannot +verify this. -undef pragma ------------- -The `undef`:idx: pragma the counterpart to the define pragma. It undefines a -conditional symbol. - -Warning: The ``undef`` pragma is deprecated as it conflicts with separate -compilation! +compileTime pragma +------------------ +The `compileTime`:idx: pragma is used to mark a proc to be used at compile +time only. No code will be generated for it. Compile time procs are useful +as helpers for macros. error pragma diff --git a/doc/mytest.cfg b/doc/mytest.cfg old mode 100644 new mode 100755 diff --git a/doc/nimdoc.css b/doc/nimdoc.css old mode 100644 new mode 100755 diff --git a/doc/nimrodc.txt b/doc/nimrodc.txt old mode 100644 new mode 100755 index f4949ada2..9e59ab9a4 --- a/doc/nimrodc.txt +++ b/doc/nimrodc.txt @@ -107,8 +107,8 @@ non-optional argument has to be the name of the dynamic library: proc gtk_image_new(): PGtkWidget {.cdecl, dynlib: "libgtk-x11-2.0.so", importc.} In general, importing a dynamic library does not require any special linker -options or linking with import libraries. This also -implies that no *devel* packages need to be installed. +options or linking with import libraries. This also implies that no *devel* +packages need to be installed. No_decl Pragma @@ -279,9 +279,7 @@ However, sometimes one has to optimize. Do it in the following order: 4. try to find a better algorithm 5. do low-level optimizations -This section can only help you with the last item. Note that rewriting parts -of your program in C is *never* necessary to speed up your program, because -everything that can be done in C can be done in Nimrod. +This section can only help you with the last item. Optimizing string handling @@ -308,31 +306,32 @@ if several different string constants are used. This is likely to be more efficient than any hand-coded scheme. -The ECMAScript code generator -============================= - -Note: As of version 0.7.0 the ECMAScript code generator is not maintained any -longer. Help if you are interested. - -Note: I use the term `ECMAScript`:idx: here instead of `JavaScript`:idx:, since -it is the proper term. - -The ECMAScript code generator is experimental! - -Nimrod targets ECMAScript 1.5 which is supported by any widely used browser. -Since ECMAScript does not have a portable means to include another module, -Nimrod just generates a long ``.js`` file. - -Features or modules that the ECMAScript platform does not support are not -available. This includes: - -* manual memory management (``alloc``, etc.) -* casting and other unsafe operations (``cast`` operator, ``zeroMem``, etc.) -* file management (``openfile``, etc.) -* most modules of the Standard library -* proper 64 bit integer arithmetic -* proper unsigned integer arithmetic - -However, the modules `strutils`:idx:, `math`:idx:, and `times`:idx: are -available! To access the DOM, use the `dom`:idx: module that is only available -for the ECMAScript platform. +.. + The ECMAScript code generator + ============================= + + Note: As of version 0.7.0 the ECMAScript code generator is not maintained any + longer. Help if you are interested. + + Note: I use the term `ECMAScript`:idx: here instead of `JavaScript`:idx:, + since it is the proper term. + + The ECMAScript code generator is experimental! + + Nimrod targets ECMAScript 1.5 which is supported by any widely used browser. + Since ECMAScript does not have a portable means to include another module, + Nimrod just generates a long ``.js`` file. + + Features or modules that the ECMAScript platform does not support are not + available. This includes: + + * manual memory management (``alloc``, etc.) + * casting and other unsafe operations (``cast`` operator, ``zeroMem``, etc.) + * file management + * most modules of the Standard library + * proper 64 bit integer arithmetic + * proper unsigned integer arithmetic + + However, the modules `strutils`:idx:, `math`:idx:, and `times`:idx: are + available! To access the DOM, use the `dom`:idx: module that is only + available for the ECMAScript platform. diff --git a/doc/overview.txt b/doc/overview.txt old mode 100644 new mode 100755 diff --git a/doc/readme.txt b/doc/readme.txt old mode 100644 new mode 100755 diff --git a/doc/regexprs.txt b/doc/regexprs.txt old mode 100644 new mode 100755 diff --git a/doc/rst.txt b/doc/rst.txt old mode 100644 new mode 100755 diff --git a/doc/steps.txt b/doc/steps.txt deleted file mode 100644 index 89339377b..000000000 --- a/doc/steps.txt +++ /dev/null @@ -1,24 +0,0 @@ -============================== -First steps after installation -============================== - -This document explains how to *use* the Nimrod compiler. -Open your favourite text editor and type (or download it -`here `_): - -.. code-block:: nimrod - :file: ../tests/hallo.nim - -Save this file as ``hallo.nim`` somewhere (I refer to the location as -``$yourloc``). Now open a console and call the Nimrod compiler:: - - nimrod compile --run $yourloc/hallo - -The ``--run`` switch tells Nimrod that it should run the generated -executable after successful compilation. If things don't work, -check if Nimrod's ``bin`` directory is in your path environment -variable. On Windows the directory ``dist\llvm-gcc4.2\bin`` may -also be required in your path. - -Note that Nimrod produced a standalone native executable in -``$yourloc`` that you can run without the Nimrod compiler. diff --git a/doc/theindex.txt b/doc/theindex.txt old mode 100644 new mode 100755 index 81bcf9c67..dee6ecd8c --- a/doc/theindex.txt +++ b/doc/theindex.txt @@ -7,23 +7,23 @@ Index `!`:idx: - `macros.html#115 `_ + `macros.html#113 `_ `!=`:idx: - `system.html#355 `_ + `system.html#346 `_ `$`:idx: - * `system.html#426 `_ - * `system.html#427 `_ - * `system.html#428 `_ - * `system.html#429 `_ - * `system.html#430 `_ - * `system.html#431 `_ - * `system.html#432 `_ - * `system.html#433 `_ + * `system.html#417 `_ + * `system.html#418 `_ + * `system.html#419 `_ + * `system.html#420 `_ + * `system.html#421 `_ + * `system.html#422 `_ + * `system.html#423 `_ + * `system.html#424 `_ * `times.html#109 `_ * `times.html#110 `_ - * `macros.html#116 `_ + * `macros.html#114 `_ `%`:idx: * `strutils.html#111 `_ @@ -31,162 +31,136 @@ Index * `strtabs.html#112 `_ `%%`:idx: - * `system.html#300 `_ - * `system.html#301 `_ - * `system.html#302 `_ - * `system.html#303 `_ - * `system.html#304 `_ - - `&`:idx: - * `system.html#366 `_ - * `system.html#367 `_ - * `system.html#368 `_ - * `system.html#369 `_ - * `system.html#457 `_ - * `system.html#458 `_ - * `system.html#459 `_ - * `system.html#460 `_ - - `*`:idx: - * `system.html#208 `_ - * `system.html#209 `_ - * `system.html#210 `_ - * `system.html#211 `_ - * `system.html#212 `_ - * `system.html#319 `_ - * `system.html#327 `_ - * `complex.html#107 `_ - - `*%`:idx: - * `system.html#290 `_ * `system.html#291 `_ * `system.html#292 `_ * `system.html#293 `_ * `system.html#294 `_ + * `system.html#295 `_ - `+`:idx: - * `system.html#183 `_ - * `system.html#184 `_ - * `system.html#185 `_ - * `system.html#186 `_ - * `system.html#187 `_ - * `system.html#198 `_ - * `system.html#199 `_ - * `system.html#200 `_ - * `system.html#201 `_ - * `system.html#202 `_ - * `system.html#315 `_ - * `system.html#317 `_ - * `system.html#328 `_ - * `complex.html#103 `_ + `&`:idx: + * `system.html#357 `_ + * `system.html#358 `_ + * `system.html#359 `_ + * `system.html#360 `_ + * `system.html#460 `_ + * `system.html#461 `_ + * `system.html#462 `_ + * `system.html#463 `_ - `+%`:idx: - * `system.html#280 `_ + `*`:idx: + * `system.html#211 `_ + * `system.html#212 `_ + * `system.html#213 `_ + * `system.html#214 `_ + * `system.html#215 `_ + * `system.html#310 `_ + * `system.html#318 `_ + * `complex.html#107 `_ + + `*%`:idx: * `system.html#281 `_ * `system.html#282 `_ * `system.html#283 `_ * `system.html#284 `_ + * `system.html#285 `_ - `-`:idx: + `+`:idx: + * `system.html#186 `_ + * `system.html#187 `_ * `system.html#188 `_ * `system.html#189 `_ * `system.html#190 `_ - * `system.html#191 `_ - * `system.html#192 `_ + * `system.html#201 `_ + * `system.html#202 `_ * `system.html#203 `_ * `system.html#204 `_ * `system.html#205 `_ + * `system.html#306 `_ + * `system.html#308 `_ + * `system.html#319 `_ + * `complex.html#103 `_ + + `+%`:idx: + * `system.html#271 `_ + * `system.html#272 `_ + * `system.html#273 `_ + * `system.html#274 `_ + * `system.html#275 `_ + + `-`:idx: + * `system.html#191 `_ + * `system.html#192 `_ + * `system.html#193 `_ + * `system.html#194 `_ + * `system.html#195 `_ * `system.html#206 `_ * `system.html#207 `_ - * `system.html#316 `_ - * `system.html#318 `_ - * `system.html#329 `_ + * `system.html#208 `_ + * `system.html#209 `_ + * `system.html#210 `_ + * `system.html#307 `_ + * `system.html#309 `_ + * `system.html#320 `_ * `complex.html#104 `_ * `complex.html#105 `_ * `times.html#113 `_ `-%`:idx: - * `system.html#285 `_ - * `system.html#286 `_ - * `system.html#287 `_ - * `system.html#288 `_ - * `system.html#289 `_ + * `system.html#276 `_ + * `system.html#277 `_ + * `system.html#278 `_ + * `system.html#279 `_ + * `system.html#280 `_ `-+-`:idx: - `system.html#330 `_ + `system.html#321 `_ `/`:idx: - * `system.html#320 `_ + * `system.html#311 `_ * `os.html#124 `_ * `complex.html#106 `_ `/%`:idx: - * `system.html#295 `_ - * `system.html#296 `_ - * `system.html#297 `_ - * `system.html#298 `_ - * `system.html#299 `_ + * `system.html#286 `_ + * `system.html#287 `_ + * `system.html#288 `_ + * `system.html#289 `_ + * `system.html#290 `_ `/../`:idx: `os.html#127 `_ `<`:idx: - * `system.html#258 `_ - * `system.html#259 `_ - * `system.html#260 `_ * `system.html#261 `_ * `system.html#262 `_ - * `system.html#323 `_ - * `system.html#347 `_ - * `system.html#348 `_ - * `system.html#349 `_ - * `system.html#350 `_ - * `system.html#351 `_ - * `system.html#352 `_ - * `system.html#353 `_ - * `system.html#354 `_ - * `times.html#114 `_ - - `<%`:idx: - * `system.html#310 `_ - * `system.html#311 `_ - * `system.html#312 `_ - * `system.html#313 `_ + * `system.html#263 `_ + * `system.html#264 `_ + * `system.html#265 `_ * `system.html#314 `_ - - `<=`:idx: - `times.html#115 `_ - - `<=`:idx: - * `system.html#253 `_ - * `system.html#254 `_ - * `system.html#255 `_ - * `system.html#256 `_ - * `system.html#257 `_ - * `system.html#322 `_ + * `system.html#338 `_ + * `system.html#339 `_ * `system.html#340 `_ * `system.html#341 `_ * `system.html#342 `_ * `system.html#343 `_ * `system.html#344 `_ * `system.html#345 `_ - * `system.html#346 `_ + * `times.html#114 `_ - `<=%`:idx: + `<%`:idx: + * `system.html#301 `_ + * `system.html#302 `_ + * `system.html#303 `_ + * `system.html#304 `_ * `system.html#305 `_ - * `system.html#306 `_ - * `system.html#307 `_ - * `system.html#308 `_ - * `system.html#309 `_ - `==`:idx: - * `md5.html#107 `_ - * `system.html#248 `_ - * `system.html#249 `_ - * `system.html#250 `_ - * `system.html#251 `_ - * `system.html#252 `_ - * `system.html#321 `_ + `<=`:idx: + * `system.html#256 `_ + * `system.html#257 `_ + * `system.html#258 `_ + * `system.html#259 `_ + * `system.html#260 `_ + * `system.html#313 `_ * `system.html#331 `_ * `system.html#332 `_ * `system.html#333 `_ @@ -194,32 +168,58 @@ Index * `system.html#335 `_ * `system.html#336 `_ * `system.html#337 `_ - * `system.html#338 `_ - * `system.html#339 `_ - * `system.html#462 `_ + + `<=`:idx: + `times.html#115 `_ + + `<=%`:idx: + * `system.html#296 `_ + * `system.html#297 `_ + * `system.html#298 `_ + * `system.html#299 `_ + * `system.html#300 `_ + + `==`:idx: + * `md5.html#107 `_ + * `system.html#251 `_ + * `system.html#252 `_ + * `system.html#253 `_ + * `system.html#254 `_ + * `system.html#255 `_ + * `system.html#312 `_ + * `system.html#322 `_ + * `system.html#323 `_ + * `system.html#324 `_ + * `system.html#325 `_ + * `system.html#326 `_ + * `system.html#327 `_ + * `system.html#328 `_ + * `system.html#329 `_ + * `system.html#330 `_ + * `system.html#464 `_ * `complex.html#102 `_ - * `macros.html#117 `_ + * `macros.html#115 `_ `=~`:idx: - `regexprs.html#108 `_ + `regexprs.html#110 `_ `>`:idx: - `system.html#357 `_ + `system.html#348 `_ `>%`:idx: - `system.html#425 `_ + `system.html#416 `_ `>=`:idx: - `system.html#356 `_ + `system.html#347 `_ `>=%`:idx: - `system.html#424 `_ + `system.html#415 `_ `@`:idx: - `system.html#365 `_ + `system.html#356 `_ `[]`:idx: - `macros.html#113 `_ + `macros.html#111 `_ `[]`:idx: `strtabs.html#107 `_ @@ -228,7 +228,7 @@ Index `strtabs.html#106 `_ `[]=`:idx: - `macros.html#114 `_ + `macros.html#112 `_ `[ESC]`:idx: `manual.html#134 `_ @@ -237,12 +237,12 @@ Index `xmlgen.html#107 `_ `abs`:idx: - * `system.html#263 `_ - * `system.html#264 `_ - * `system.html#265 `_ * `system.html#266 `_ * `system.html#267 `_ - * `system.html#324 `_ + * `system.html#268 `_ + * `system.html#269 `_ + * `system.html#270 `_ + * `system.html#315 `_ * `complex.html#108 `_ `acronym`:idx: @@ -252,13 +252,13 @@ Index `nimrodc.html#113 `_ `add`:idx: - * `system.html#370 `_ - * `system.html#371 `_ - * `system.html#372 `_ - * `system.html#373 `_ - * `system.html#374 `_ - * `macros.html#119 `_ - * `macros.html#120 `_ + * `system.html#361 `_ + * `system.html#362 `_ + * `system.html#363 `_ + * `system.html#364 `_ + * `system.html#365 `_ + * `macros.html#117 `_ + * `macros.html#118 `_ `addf`:idx: `strutils.html#113 `_ @@ -269,25 +269,25 @@ Index * `zipfiles.html#107 `_ `addQuitProc`:idx: - `system.html#408 `_ + `system.html#399 `_ `address`:idx: `xmlgen.html#109 `_ `addSep`:idx: - `strutils.html#151 `_ + `strutils.html#154 `_ `alert`:idx: `manual.html#131 `_ `allCharsInSet`:idx: - `strutils.html#152 `_ + `strutils.html#155 `_ `alloc`:idx: - `system.html#417 `_ + `system.html#408 `_ `alloc0`:idx: - `system.html#418 `_ + `system.html#409 `_ `ALLOC_MAX_BLOCK_TO_DROP`:idx: `mysql.html#317 `_ @@ -299,12 +299,12 @@ Index `os.html#104 `_ `and`:idx: - * `system.html#117 `_ - * `system.html#233 `_ - * `system.html#234 `_ - * `system.html#235 `_ + * `system.html#120 `_ * `system.html#236 `_ * `system.html#237 `_ + * `system.html#238 `_ + * `system.html#239 `_ + * `system.html#240 `_ `apostrophe`:idx: `manual.html#129 `_ @@ -332,19 +332,19 @@ Index `array`:idx: * `tut1.html#117 `_ - * `system.html#125 `_ + * `system.html#128 `_ `array properties`:idx: `tut2.html#105 `_ `Arrays`:idx: - `manual.html#152 `_ + `manual.html#153 `_ `assembler`:idx: - `manual.html#196 `_ + `manual.html#199 `_ `assert`:idx: - `system.html#422 `_ + `system.html#413 `_ `AST`:idx: `macros.html#101 `_ @@ -359,14 +359,15 @@ Index `mysql.html#133 `_ `Automatic type conversion`:idx: - * `manual.html#144 `_ + * `manual.html#145 `_ * `tut1.html#111 `_ `b`:idx: `xmlgen.html#111 `_ `backslash`:idx: - `manual.html#127 `_ + * `manual.html#127 `_ + * `regexprs.html#101 `_ `backspace`:idx: `manual.html#132 `_ @@ -374,14 +375,17 @@ Index `base`:idx: `xmlgen.html#112 `_ + `base type`:idx: + `manual.html#174 `_ + `big`:idx: `xmlgen.html#113 `_ `BiggestFloat`:idx: - `system.html#378 `_ + `system.html#369 `_ `BiggestInt`:idx: - `system.html#377 `_ + `system.html#368 `_ `BINARY_FLAG`:idx: `mysql.html#131 `_ @@ -396,7 +400,7 @@ Index `mysql.html#128 `_ `block`:idx: - `manual.html#192 `_ + `manual.html#195 `_ `blockquote`:idx: `xmlgen.html#114 `_ @@ -408,14 +412,14 @@ Index `system.html#109 `_ `boolean`:idx: - * `manual.html#146 `_ + * `manual.html#147 `_ * `tut1.html#107 `_ `br`:idx: `xmlgen.html#116 `_ `break`:idx: - `manual.html#193 `_ + `manual.html#196 `_ `breakpoint`:idx: `endb.html#103 `_ @@ -424,10 +428,10 @@ Index `xmlgen.html#117 `_ `Byte`:idx: - `system.html#129 `_ + `system.html#132 `_ `calling conventions`:idx: - `manual.html#163 `_ + `manual.html#164 `_ `capitalize`:idx: `strutils.html#119 `_ @@ -436,25 +440,25 @@ Index `xmlgen.html#118 `_ `card`:idx: - `system.html#171 `_ + `system.html#174 `_ `carriage return`:idx: `manual.html#122 `_ `case`:idx: - `manual.html#181 `_ + `manual.html#184 `_ `cchar`:idx: - `system.html#379 `_ + `system.html#370 `_ `cdecl`:idx: - `manual.html#165 `_ + `manual.html#166 `_ `cdouble`:idx: - `system.html#386 `_ + `system.html#377 `_ `cfloat`:idx: - `system.html#385 `_ + `system.html#376 `_ `cgiError`:idx: `cgi.html#106 `_ @@ -466,7 +470,7 @@ Index `system.html#110 `_ `character type`:idx: - `manual.html#147 `_ + `manual.html#148 `_ `character with decimal value d`:idx: `manual.html#130 `_ @@ -496,10 +500,10 @@ Index `mysql.html#273 `_ `chr`:idx: - `system.html#173 `_ + `system.html#176 `_ `cint`:idx: - `system.html#382 `_ + `system.html#373 `_ `cite`:idx: `xmlgen.html#119 `_ @@ -574,13 +578,13 @@ Index `mysql.html#169 `_ `clong`:idx: - `system.html#383 `_ + `system.html#374 `_ `clongdouble`:idx: - `system.html#387 `_ + `system.html#378 `_ `clonglong`:idx: - `system.html#384 `_ + `system.html#375 `_ `close`:idx: * `lexbase.html#105 `_ @@ -589,21 +593,24 @@ Index * `parsecsv.html#109 `_ * `zipfiles.html#103 `_ + `Close`:idx: + `system.html#498 `_ + `CloseFile`:idx: - `system.html#493 `_ + `system.html#497 `_ `closure`:idx: - `manual.html#170 `_ + `manual.html#171 `_ `cmp`:idx: - * `system.html#363 `_ - * `system.html#364 `_ + * `system.html#354 `_ + * `system.html#355 `_ `cmpIgnoreCase`:idx: - `strutils.html#137 `_ + `strutils.html#140 `_ `cmpIgnoreStyle`:idx: - `strutils.html#138 `_ + `strutils.html#141 `_ `cmpPaths`:idx: `os.html#136 `_ @@ -638,48 +645,51 @@ Index `mysql.html#266 `_ `CompileDate`:idx: - `system.html#395 `_ + `system.html#386 `_ `CompileTime`:idx: - `system.html#396 `_ + `system.html#387 `_ + + `compileTime`:idx: + `manual.html#227 `_ `complex statements`:idx: - `manual.html#175 `_ + `manual.html#178 `_ `const`:idx: - `manual.html#179 `_ + `manual.html#182 `_ `constant expressions`:idx: `manual.html#108 `_ `Constants`:idx: - * `manual.html#139 `_ + * `manual.html#140 `_ * `tut1.html#104 `_ `contains`:idx: - * `system.html#358 `_ - * `strutils.html#139 `_ - * `strutils.html#140 `_ - * `strutils.html#141 `_ + * `system.html#349 `_ + * `strutils.html#142 `_ + * `strutils.html#143 `_ + * `strutils.html#144 `_ `continue`:idx: - `manual.html#195 `_ + `manual.html#198 `_ `copy`:idx: - * `system.html#409 `_ - * `system.html#410 `_ + * `system.html#400 `_ + * `system.html#401 `_ `copyFile`:idx: `os.html#139 `_ `copyMem`:idx: - `system.html#414 `_ + `system.html#405 `_ `copyNimNode`:idx: - `macros.html#136 `_ + `macros.html#134 `_ `copyNimTree`:idx: - `macros.html#137 `_ + `macros.html#135 `_ `coreAttr`:idx: `xmlgen.html#103 `_ @@ -690,17 +700,17 @@ Index `cosh`:idx: `math.html#127 `_ - `countBits`:idx: + `countBits32`:idx: `math.html#109 `_ `countdown`:idx: - `system.html#443 `_ + `system.html#434 `_ `countup`:idx: - `system.html#444 `_ + `system.html#435 `_ `cpuEndian`:idx: - `system.html#401 `_ + `system.html#392 `_ `createDir`:idx: * `os.html#151 `_ @@ -710,16 +720,16 @@ Index `mysql.html#269 `_ `cschar`:idx: - `system.html#380 `_ + `system.html#371 `_ `cshort`:idx: - `system.html#381 `_ + `system.html#372 `_ `cstring`:idx: `system.html#112 `_ `cstringArray`:idx: - `system.html#388 `_ + `system.html#379 `_ `CSV`:idx: `parsecsv.html#101 `_ @@ -1091,10 +1101,10 @@ Index `terminal.html#104 `_ `dangling else problem`:idx: - `manual.html#176 `_ + `manual.html#179 `_ `dbgLineHook`:idx: - `system.html#439 `_ + `system.html#430 `_ `dd`:idx: `xmlgen.html#123 `_ @@ -1103,29 +1113,30 @@ Index `nimrodc.html#114 `_ `dealloc`:idx: - `system.html#420 `_ + `system.html#411 `_ `debugger`:idx: `nimrodc.html#110 `_ `dec`:idx: - `system.html#162 `_ + `system.html#165 `_ `decodeData`:idx: `cgi.html#107 `_ - `define`:idx: - `manual.html#222 `_ - `defined`:idx: - `system.html#115 `_ + `system.html#118 `_ `del`:idx: * `xmlgen.html#124 `_ - * `macros.html#121 `_ + * `macros.html#119 `_ + + `delete`:idx: + `strutils.html#161 `_ `deleteStr`:idx: - `strutils.html#129 `_ + * `strutils.html#129 `_ + * `strutils.html#162 `_ `dfn`:idx: `xmlgen.html#125 `_ @@ -1137,25 +1148,21 @@ Index `os.html#103 `_ `discard`:idx: - `manual.html#177 `_ + `manual.html#180 `_ `div`:idx: - * `system.html#213 `_ - * `system.html#214 `_ - * `system.html#215 `_ * `system.html#216 `_ * `system.html#217 `_ + * `system.html#218 `_ + * `system.html#219 `_ + * `system.html#220 `_ * `xmlgen.html#126 `_ `dl`:idx: `xmlgen.html#127 `_ - `dom`:idx: - `nimrodc.html#120 `_ - `domain specific languages`:idx: - * `manual.html#211 `_ - * `tut2.html#111 `_ + `manual.html#215 `_ `dt`:idx: `xmlgen.html#128 `_ @@ -1173,67 +1180,64 @@ Index `math.html#102 `_ `EAccessViolation`:idx: - `system.html#145 `_ + `system.html#148 `_ `each`:idx: - `system.html#465 `_ + `system.html#467 `_ `EArithmetic`:idx: - `system.html#142 `_ + `system.html#145 `_ `EAssertionFailed`:idx: - `system.html#146 `_ + `system.html#149 `_ `EAsynch`:idx: - `system.html#135 `_ + `system.html#138 `_ `E_Base`:idx: - `system.html#134 `_ + `system.html#137 `_ `ECgi`:idx: `cgi.html#104 `_ `echo`:idx: - `system.html#480 `_ - - `ECMAScript`:idx: - `nimrodc.html#115 `_ + `system.html#482 `_ `EControlC`:idx: - `system.html#147 `_ + `system.html#150 `_ `editDistance`:idx: - `strutils.html#159 `_ + `strutils.html#168 `_ `EDivByZero`:idx: - `system.html#143 `_ + `system.html#146 `_ `EInvalidCsv`:idx: `parsecsv.html#105 `_ `EInvalidField`:idx: - `system.html#151 `_ + `system.html#154 `_ `EInvalidIndex`:idx: - `system.html#150 `_ + `system.html#153 `_ `EInvalidLibrary`:idx: - `system.html#140 `_ + `system.html#143 `_ `EInvalidObjectAssignment`:idx: - `system.html#155 `_ + `system.html#158 `_ `EInvalidObjectConversion`:idx: - `system.html#156 `_ + `system.html#159 `_ `EInvalidRegEx`:idx: - `regexprs.html#101 `_ + `regexprs.html#103 `_ `EInvalidValue`:idx: - `system.html#148 `_ + `system.html#151 `_ `EIO`:idx: - `system.html#138 `_ + `system.html#141 `_ `elementName`:idx: `parsexml.html#111 `_ @@ -1248,15 +1252,15 @@ Index `endb.html#102 `_ `EndOfFile`:idx: - * `system.html#494 `_ + * `system.html#499 `_ * `lexbase.html#101 `_ `endsWith`:idx: - `strutils.html#150 `_ + `strutils.html#153 `_ `ENoExceptionToReraise`:idx: - * `manual.html#184 `_ - * `system.html#154 `_ + * `manual.html#187 `_ + * `system.html#157 `_ `entityName`:idx: `parsexml.html#112 `_ @@ -1268,7 +1272,7 @@ Index `tut1.html#113 `_ `Enumeration`:idx: - `manual.html#148 `_ + `manual.html#149 `_ `enum_field_types`:idx: `mysql.html#202 `_ @@ -1289,21 +1293,21 @@ Index `mysql.html#383 `_ `EOS`:idx: - `system.html#139 `_ + `system.html#142 `_ `EOutOfMemory`:idx: - `system.html#149 `_ + `system.html#152 `_ `EOutOfRange`:idx: - * `manual.html#145 `_ + * `manual.html#146 `_ * `tut1.html#112 `_ - * `system.html#152 `_ + * `system.html#155 `_ `EOverflow`:idx: - `system.html#144 `_ + `system.html#147 `_ `equalMem`:idx: - `system.html#416 `_ + `system.html#407 `_ `EraseLine`:idx: `terminal.html#108 `_ @@ -1312,12 +1316,12 @@ Index `terminal.html#109 `_ `ERessourceExhausted`:idx: - `system.html#141 `_ + `system.html#144 `_ `error`:idx: - * `manual.html#221 `_ - * `manual.html#224 `_ - * `macros.html#138 `_ + * `manual.html#225 `_ + * `manual.html#228 `_ + * `macros.html#136 `_ `errorMsg`:idx: `parsexml.html#120 `_ @@ -1333,34 +1337,34 @@ Index `escape`:idx: * `manual.html#133 `_ - * `strutils.html#156 `_ + * `strutils.html#165 `_ `escape sequences`:idx: `manual.html#120 `_ `EStackOverflow`:idx: - `system.html#153 `_ + `system.html#156 `_ `ESynch`:idx: - `system.html#136 `_ + `system.html#139 `_ `ESystem`:idx: - `system.html#137 `_ + `system.html#140 `_ `eventAttr`:idx: `xmlgen.html#104 `_ `except`:idx: - `manual.html#187 `_ + `manual.html#190 `_ `exception handlers`:idx: - `manual.html#186 `_ + `manual.html#189 `_ `exceptions`:idx: `tut2.html#106 `_ `excl`:idx: - `system.html#170 `_ + `system.html#173 `_ `exclFilePermissions`:idx: `os.html#157 `_ @@ -1394,22 +1398,22 @@ Index `os.html#130 `_ `expectKind`:idx: - `macros.html#147 `_ + `macros.html#145 `_ `expectLen`:idx: - `macros.html#149 `_ + `macros.html#147 `_ `expectMinLen`:idx: - `macros.html#148 `_ + `macros.html#146 `_ `exportc`:idx: `nimrodc.html#102 `_ `expr`:idx: - `macros.html#111 `_ + `system.html#115 `_ `expression macros`:idx: - `tut2.html#112 `_ + `tut2.html#110 `_ `extractDir`:idx: `os.html#128 `_ @@ -1430,10 +1434,10 @@ Index `math.html#106 `_ `fastcall`:idx: - `manual.html#168 `_ + `manual.html#169 `_ `fatal`:idx: - `manual.html#225 `_ + `manual.html#229 `_ `fieldset`:idx: `xmlgen.html#130 `_ @@ -1523,7 +1527,7 @@ Index `mysql.html#218 `_ `fileHandle`:idx: - `system.html#518 `_ + `system.html#523 `_ `fileNewer`:idx: `os.html#119 `_ @@ -1538,15 +1542,15 @@ Index `os.html#106 `_ `finally`:idx: - `manual.html#188 `_ + `manual.html#191 `_ `find`:idx: - * `system.html#463 `_ + * `system.html#465 `_ * `strutils.html#124 `_ * `strutils.html#125 `_ * `strutils.html#126 `_ - * `regexprs.html#106 `_ - * `regexprs.html#107 `_ + * `regexprs.html#108 `_ + * `regexprs.html#109 `_ `findChars`:idx: `strutils.html#123 `_ @@ -1565,16 +1569,16 @@ Index `system.html#108 `_ `floatVal`:idx: - `macros.html#124 `_ + `macros.html#122 `_ `floatVal=`:idx: - `macros.html#130 `_ + `macros.html#128 `_ `FlushFile`:idx: - `system.html#496 `_ + `system.html#501 `_ `for`:idx: - * `manual.html#203 `_ + * `manual.html#207 `_ * `tut1.html#105 `_ `form`:idx: @@ -1584,54 +1588,60 @@ Index `manual.html#124 `_ `forward`:idx: - `manual.html#200 `_ + `manual.html#203 `_ `frexp`:idx: `math.html#120 `_ `functional`:idx: - * `manual.html#162 `_ + * `manual.html#163 `_ * `tut1.html#124 `_ `FUNCTIONPOINT`:idx: `libcurl.html#265 `_ `funtions`:idx: - `manual.html#198 `_ + `manual.html#201 `_ `GC_disable`:idx: - `system.html#466 `_ - - `GC_disableMarkAndSweep`:idx: - `system.html#472 `_ - - `GC_enable`:idx: - `system.html#467 `_ - - `GC_enableMarkAndSweep`:idx: - `system.html#471 `_ - - `GC_fullCollect`:idx: `system.html#468 `_ - `GC_getStatistics`:idx: + `GC_disableMarkAndSweep`:idx: + `system.html#474 `_ + + `GC_enable`:idx: + `system.html#469 `_ + + `GC_enableMarkAndSweep`:idx: `system.html#473 `_ - `GC_ref`:idx: - * `system.html#474 `_ - * `system.html#475 `_ - * `system.html#476 `_ - - `GC_setStrategy`:idx: + `GC_fullCollect`:idx: `system.html#470 `_ - `GC_unref`:idx: + `GC_getStatistics`:idx: + `system.html#475 `_ + + `GC_ref`:idx: + * `system.html#476 `_ * `system.html#477 `_ * `system.html#478 `_ + + `GC_setStrategy`:idx: + `system.html#472 `_ + + `GC_unref`:idx: * `system.html#479 `_ + * `system.html#480 `_ + * `system.html#481 `_ + + `generalized raw string literal`:idx: + `manual.html#136 `_ + + `generic character types`:idx: + `regexprs.html#102 `_ `Generics`:idx: - * `manual.html#207 `_ + * `manual.html#211 `_ * `tut2.html#108 `_ `getApplicationDir`:idx: @@ -1666,7 +1676,7 @@ Index `os.html#120 `_ `getCurrentExceptionMsg`:idx: - `system.html#435 `_ + `system.html#426 `_ `getCurrentLine`:idx: `lexbase.html#106 `_ @@ -1688,13 +1698,13 @@ Index `os.html#154 `_ `getFilePos`:idx: - `system.html#516 `_ + `system.html#521 `_ `getFileSize`:idx: - `system.html#508 `_ + `system.html#513 `_ `getFreeMem`:idx: - `system.html#441 `_ + `system.html#432 `_ `getGatewayInterface`:idx: `cgi.html#113 `_ @@ -1749,7 +1759,7 @@ Index `md5.html#106 `_ `getOccupiedMem`:idx: - `system.html#440 `_ + `system.html#431 `_ `getopt`:idx: `parseopt.html#106 `_ @@ -1764,7 +1774,7 @@ Index `cgi.html#125 `_ `getRefcount`:idx: - `system.html#434 `_ + `system.html#425 `_ `getRemoteAddr`:idx: `cgi.html#126 `_ @@ -1833,7 +1843,7 @@ Index `times.html#105 `_ `getTotalMem`:idx: - `system.html#442 `_ + `system.html#433 `_ `get_tty_password`:idx: `mysql.html#282 `_ @@ -1897,32 +1907,32 @@ Index `nimrodc.html#105 `_ `high`:idx: - `system.html#122 `_ + `system.html#125 `_ `hint`:idx: - * `manual.html#219 `_ - * `manual.html#227 `_ - * `macros.html#140 `_ + * `manual.html#223 `_ + * `manual.html#231 `_ + * `macros.html#138 `_ `hostCPU`:idx: - `system.html#403 `_ + `system.html#394 `_ `HOSTNAME_LENGTH`:idx: `mysql.html#111 `_ `hostOS`:idx: - `system.html#402 `_ + `system.html#393 `_ `hr`:idx: `xmlgen.html#140 `_ - `html`:idx: - `xmlgen.html#139 `_ - `HTML`:idx: * `parsexml.html#102 `_ * `xmlgen.html#102 `_ + `html`:idx: + `xmlgen.html#139 `_ + `HTTPPOST_BUFFER`:idx: `libcurl.html#266 `_ @@ -1948,10 +1958,10 @@ Index `xmlgen.html#141 `_ `ident`:idx: - `macros.html#126 `_ + `macros.html#124 `_ `ident=`:idx: - `macros.html#132 `_ + `macros.html#130 `_ `IdentChars`:idx: `strutils.html#105 `_ @@ -1966,29 +1976,29 @@ Index `strutils.html#106 `_ `if`:idx: - `manual.html#180 `_ + `manual.html#183 `_ `img`:idx: `xmlgen.html#142 `_ `implicit block`:idx: - `manual.html#205 `_ + `manual.html#209 `_ `import`:idx: - * `manual.html#215 `_ + * `manual.html#219 `_ * `tut1.html#128 `_ `importc`:idx: `nimrodc.html#101 `_ `in`:idx: - `system.html#359 `_ + `system.html#350 `_ `inc`:idx: - `system.html#161 `_ + `system.html#164 `_ `incl`:idx: - `system.html#169 `_ + `system.html#172 `_ `inclFilePermissions`:idx: `os.html#156 `_ @@ -2000,17 +2010,17 @@ Index `manual.html#113 `_ `inf`:idx: - `system.html#436 `_ + `system.html#427 `_ `information hiding`:idx: - * `manual.html#213 `_ + * `manual.html#217 `_ * `tut1.html#126 `_ `init`:idx: `parseopt.html#103 `_ `inline`:idx: - `manual.html#167 `_ + `manual.html#168 `_ `input`:idx: `xmlgen.html#143 `_ @@ -2040,16 +2050,16 @@ Index `mysql.html#306 `_ `intToStr`:idx: - `strutils.html#143 `_ + `strutils.html#146 `_ `intVal`:idx: - `macros.html#123 `_ + `macros.html#121 `_ `intVal=`:idx: - `macros.html#129 `_ + `macros.html#127 `_ `is`:idx: - `system.html#361 `_ + `system.html#352 `_ `isAlpha`:idx: `unicode.html#111 `_ @@ -2061,18 +2071,18 @@ Index `unicode.html#109 `_ `isMainModule`:idx: - `system.html#394 `_ + `system.html#385 `_ `isNil`:idx: - * `system.html#451 `_ - * `system.html#452 `_ - * `system.html#453 `_ * `system.html#454 `_ * `system.html#455 `_ * `system.html#456 `_ + * `system.html#457 `_ + * `system.html#458 `_ + * `system.html#459 `_ `is_not`:idx: - `system.html#362 `_ + `system.html#353 `_ `IS_NOT_NULL`:idx: `mysql.html#303 `_ @@ -2102,21 +2112,22 @@ Index `mysql.html#255 `_ `items`:idx: - * `system.html#445 `_ - * `system.html#446 `_ - * `system.html#447 `_ * `system.html#448 `_ * `system.html#449 `_ * `system.html#450 `_ + * `system.html#451 `_ + * `system.html#452 `_ + * `system.html#453 `_ `iterator`:idx: - `manual.html#204 `_ + `manual.html#208 `_ `iterOverEnvironment`:idx: `os.html#146 `_ - `JavaScript`:idx: - `nimrodc.html#116 `_ + `join`:idx: + * `strutils.html#157 `_ + * `strutils.html#158 `_ `JoinPath`:idx: * `os.html#122 `_ @@ -2130,7 +2141,7 @@ Index `kind`:idx: * `parsexml.html#110 `_ - * `macros.html#122 `_ + * `macros.html#120 `_ `l-values`:idx: `manual.html#107 `_ @@ -2142,13 +2153,13 @@ Index `xmlgen.html#147 `_ `len`:idx: - * `system.html#164 `_ - * `system.html#165 `_ - * `system.html#166 `_ * `system.html#167 `_ * `system.html#168 `_ + * `system.html#169 `_ + * `system.html#170 `_ + * `system.html#171 `_ * `strtabs.html#109 `_ - * `macros.html#118 `_ + * `macros.html#116 `_ `Letters`:idx: `strutils.html#103 `_ @@ -2178,7 +2189,7 @@ Index `nimrodc.html#107 `_ `lines`:idx: - `system.html#517 `_ + `system.html#522 `_ `line_trace`:idx: `nimrodc.html#109 `_ @@ -2186,9 +2197,6 @@ Index `link`:idx: `xmlgen.html#149 `_ - `Literal strings`:idx: - `manual.html#119 `_ - `ln`:idx: `math.html#116 `_ @@ -2217,11 +2225,10 @@ Index `math.html#118 `_ `low`:idx: - `system.html#123 `_ + `system.html#126 `_ `Macros`:idx: - * `manual.html#210 `_ - * `tut2.html#110 `_ + `manual.html#214 `_ `make_password_from_salt`:idx: `mysql.html#281 `_ @@ -2254,23 +2261,20 @@ Index `xmlgen.html#150 `_ `match`:idx: - * `regexprs.html#103 `_ - * `regexprs.html#104 `_ + * `regexprs.html#105 `_ + * `regexprs.html#106 `_ `matchLen`:idx: - `regexprs.html#105 `_ - - `math`:idx: - `nimrodc.html#118 `_ + `regexprs.html#107 `_ `max`:idx: - * `system.html#274 `_ - * `system.html#275 `_ - * `system.html#276 `_ - * `system.html#277 `_ - * `system.html#278 `_ - * `system.html#279 `_ - * `system.html#326 `_ + * `system.html#317 `_ + * `system.html#442 `_ + * `system.html#443 `_ + * `system.html#444 `_ + * `system.html#445 `_ + * `system.html#446 `_ + * `system.html#447 `_ `MAX_BIGINT_WIDTH`:idx: `mysql.html#194 `_ @@ -2297,7 +2301,7 @@ Index `mysql.html#191 `_ `MaxSubpatterns`:idx: - `regexprs.html#102 `_ + `regexprs.html#104 `_ `MAX_TINYINT_WIDTH`:idx: `mysql.html#190 `_ @@ -2330,36 +2334,36 @@ Index `tut2.html#104 `_ `methods`:idx: - `manual.html#197 `_ + `manual.html#200 `_ `min`:idx: - * `system.html#268 `_ - * `system.html#269 `_ - * `system.html#270 `_ - * `system.html#271 `_ - * `system.html#272 `_ - * `system.html#273 `_ - * `system.html#325 `_ + * `system.html#316 `_ + * `system.html#436 `_ + * `system.html#437 `_ + * `system.html#438 `_ + * `system.html#439 `_ + * `system.html#440 `_ + * `system.html#441 `_ `mod`:idx: - * `system.html#218 `_ - * `system.html#219 `_ - * `system.html#220 `_ * `system.html#221 `_ * `system.html#222 `_ + * `system.html#223 `_ + * `system.html#224 `_ + * `system.html#225 `_ `modify_defaults_file`:idx: `mysql.html#284 `_ `module`:idx: - * `manual.html#212 `_ + * `manual.html#216 `_ * `tut1.html#125 `_ `moveFile`:idx: `os.html#140 `_ `moveMem`:idx: - `system.html#415 `_ + `system.html#406 `_ `MULTIPLE_KEY_FLAG`:idx: `mysql.html#127 `_ @@ -2879,16 +2883,16 @@ Index `mysql.html#110 `_ `nan`:idx: - `system.html#438 `_ + `system.html#429 `_ `Natural`:idx: - `system.html#130 `_ + `system.html#133 `_ `neginf`:idx: - `system.html#437 `_ + `system.html#428 `_ `nestList`:idx: - `macros.html#152 `_ + `macros.html#150 `_ `NET`:idx: `mysql.html#199 `_ @@ -2930,26 +2934,26 @@ Index `mysql.html#187 `_ `new`:idx: - * `system.html#120 `_ - * `system.html#121 `_ + * `system.html#123 `_ + * `system.html#124 `_ `newCall`:idx: - * `macros.html#150 `_ - * `macros.html#151 `_ + * `macros.html#148 `_ + * `macros.html#149 `_ `newFileStream`:idx: * `streams.html#120 `_ * `streams.html#121 `_ `newFloatLitNode`:idx: - `macros.html#143 `_ + `macros.html#141 `_ `newIdentNode`:idx: - * `macros.html#144 `_ - * `macros.html#145 `_ + * `macros.html#142 `_ + * `macros.html#143 `_ `newIntLitNode`:idx: - `macros.html#142 `_ + `macros.html#140 `_ `newline`:idx: `manual.html#121 `_ @@ -2958,13 +2962,13 @@ Index `lexbase.html#102 `_ `newNimNode`:idx: - `macros.html#135 `_ + `macros.html#133 `_ `newSeq`:idx: - `system.html#163 `_ + `system.html#166 `_ `newString`:idx: - `system.html#412 `_ + `system.html#403 `_ `newStringStream`:idx: `streams.html#117 `_ @@ -2974,7 +2978,7 @@ Index * `strtabs.html#105 `_ `newStrLitNode`:idx: - `macros.html#141 `_ + `macros.html#139 `_ `next`:idx: * `parseopt.html#104 `_ @@ -2985,25 +2989,25 @@ Index `math.html#108 `_ `nimcall`:idx: - `manual.html#169 `_ + `manual.html#170 `_ `NimrodMajor`:idx: - `system.html#398 `_ + `system.html#389 `_ `NimrodMinor`:idx: - `system.html#399 `_ + `system.html#390 `_ `NimrodPatch`:idx: - `system.html#400 `_ + `system.html#391 `_ `NimrodVersion`:idx: - `system.html#397 `_ + `system.html#388 `_ `nl`:idx: `strutils.html#108 `_ `noconv`:idx: - `manual.html#172 `_ + `manual.html#173 `_ `no_decl`:idx: `nimrodc.html#104 `_ @@ -3017,16 +3021,19 @@ Index `noscript`:idx: `xmlgen.html#152 `_ + `noSideEffect`:idx: + `manual.html#226 `_ + `not`:idx: - * `system.html#116 `_ - * `system.html#193 `_ - * `system.html#194 `_ - * `system.html#195 `_ + * `system.html#119 `_ * `system.html#196 `_ * `system.html#197 `_ + * `system.html#198 `_ + * `system.html#199 `_ + * `system.html#200 `_ `not_in`:idx: - `system.html#360 `_ + `system.html#351 `_ `NOT_NULL_FLAG`:idx: `mysql.html#124 `_ @@ -3035,13 +3042,13 @@ Index `mysql.html#289 `_ `Numerical constants`:idx: - `manual.html#136 `_ + `manual.html#137 `_ `NUM_FLAG`:idx: `mysql.html#137 `_ `object`:idx: - * `manual.html#155 `_ + * `manual.html#156 `_ * `xmlgen.html#153 `_ `octet2hex`:idx: @@ -3053,6 +3060,10 @@ Index `ONLY_KILL_QUERY`:idx: `mysql.html#189 `_ + `Open`:idx: + * `system.html#495 `_ + * `system.html#496 `_ + `open`:idx: * `lexbase.html#104 `_ * `parsecfg.html#104 `_ @@ -3062,17 +3073,17 @@ Index `openarray`:idx: * `tut1.html#119 `_ - * `system.html#126 `_ + * `system.html#129 `_ `OpenFile`:idx: - * `system.html#491 `_ - * `system.html#492 `_ + * `system.html#493 `_ + * `system.html#494 `_ `operator`:idx: - `manual.html#138 `_ + `manual.html#139 `_ `Operators`:idx: - `manual.html#202 `_ + `manual.html#205 `_ `optgroup`:idx: `xmlgen.html#155 `_ @@ -3081,24 +3092,24 @@ Index `xmlgen.html#156 `_ `or`:idx: - * `system.html#118 `_ - * `system.html#238 `_ - * `system.html#239 `_ - * `system.html#240 `_ + * `system.html#121 `_ * `system.html#241 `_ * `system.html#242 `_ + * `system.html#243 `_ + * `system.html#244 `_ + * `system.html#245 `_ `ord`:idx: - `system.html#172 `_ - - `Ordinal`:idx: - `system.html#114 `_ + `system.html#175 `_ `ordinal`:idx: `tut1.html#114 `_ + `Ordinal`:idx: + `system.html#114 `_ + `Ordinal types`:idx: - `manual.html#141 `_ + `manual.html#142 `_ `OSError`:idx: `os.html#112 `_ @@ -3131,16 +3142,16 @@ Index `os.html#126 `_ `ParseBiggestInt`:idx: - `strutils.html#145 `_ + `strutils.html#148 `_ `parseCmdLine`:idx: `os.html#152 `_ `ParseFloat`:idx: - `strutils.html#146 `_ + `strutils.html#149 `_ `ParseInt`:idx: - `strutils.html#144 `_ + `strutils.html#147 `_ `PART_KEY_FLAG`:idx: `mysql.html#138 `_ @@ -3272,10 +3283,10 @@ Index `streams.html#118 `_ `PFloat32`:idx: - `system.html#390 `_ + `system.html#381 `_ `PFloat64`:idx: - `system.html#391 `_ + `system.html#382 `_ `Pgptr`:idx: `mysql.html#104 `_ @@ -3287,10 +3298,10 @@ Index `parsexml.html#115 `_ `PInt32`:idx: - `system.html#393 `_ + `system.html#384 `_ `PInt64`:idx: - `system.html#392 `_ + `system.html#383 `_ `PIRest`:idx: `parsexml.html#116 `_ @@ -3365,20 +3376,20 @@ Index `macros.html#108 `_ `PObject`:idx: - `system.html#133 `_ + `system.html#136 `_ `pointer`:idx: `system.html#113 `_ `pointers`:idx: - * `manual.html#158 `_ + * `manual.html#159 `_ * `tut1.html#120 `_ `pop`:idx: - `system.html#464 `_ + `system.html#466 `_ `Positive`:idx: - `system.html#131 `_ + `system.html#134 `_ `pow`:idx: `math.html#132 `_ @@ -3411,17 +3422,17 @@ Index `xmlgen.html#159 `_ `pred`:idx: - `system.html#160 `_ + `system.html#163 `_ `PRI_KEY_FLAG`:idx: `mysql.html#125 `_ `procedural type`:idx: - * `manual.html#161 `_ + * `manual.html#162 `_ * `tut1.html#123 `_ `procedures`:idx: - `manual.html#199 `_ + `manual.html#202 `_ `processedRows`:idx: `parsecsv.html#107 `_ @@ -3517,7 +3528,7 @@ Index `math.html#134 `_ `push/pop`:idx: - `manual.html#228 `_ + `manual.html#232 `_ `putEnv`:idx: `os.html#145 `_ @@ -3532,20 +3543,20 @@ Index `xmlgen.html#160 `_ `quit`:idx: - * `system.html#483 `_ - * `system.html#484 `_ + * `system.html#485 `_ + * `system.html#486 `_ `QuitFailure`:idx: - `system.html#482 `_ + `system.html#484 `_ `QuitSuccess`:idx: - `system.html#481 `_ + `system.html#483 `_ `quotation mark`:idx: `manual.html#128 `_ `quoteIfContainsWhite`:idx: - `strutils.html#153 `_ + `strutils.html#156 `_ `random`:idx: `math.html#113 `_ @@ -3560,32 +3571,32 @@ Index `mysql.html#254 `_ `range`:idx: - `system.html#124 `_ + `system.html#127 `_ `re-raised`:idx: - `manual.html#183 `_ + `manual.html#186 `_ `readBool`:idx: `streams.html#106 `_ `readBuffer`:idx: - `system.html#511 `_ + `system.html#516 `_ `ReadBytes`:idx: - `system.html#509 `_ + `system.html#514 `_ `readChar`:idx: - * `system.html#495 `_ + * `system.html#500 `_ * `streams.html#105 `_ `ReadChars`:idx: - `system.html#510 `_ + `system.html#515 `_ `readData`:idx: `cgi.html#108 `_ `readFile`:idx: - `system.html#497 `_ + `system.html#502 `_ `readFloat32`:idx: `streams.html#111 `_ @@ -3606,7 +3617,7 @@ Index `streams.html#107 `_ `readLine`:idx: - * `system.html#505 `_ + * `system.html#510 `_ * `streams.html#114 `_ `readRow`:idx: @@ -3616,19 +3627,19 @@ Index `streams.html#113 `_ `realloc`:idx: - `system.html#419 `_ + `system.html#410 `_ `reBinary`:idx: - `regexprs.html#113 `_ + `regexprs.html#115 `_ `Recursive module dependancies`:idx: - `manual.html#216 `_ + `manual.html#220 `_ `reEmail`:idx: - `regexprs.html#116 `_ + `regexprs.html#118 `_ `reFloat`:idx: - `regexprs.html#115 `_ + `regexprs.html#117 `_ `REFRESH_DES_KEY_FILE`:idx: `mysql.html#154 `_ @@ -3676,13 +3687,13 @@ Index `nimrodc.html#112 `_ `reHex`:idx: - `regexprs.html#112 `_ + `regexprs.html#114 `_ `reIdentifier`:idx: - `regexprs.html#109 `_ + `regexprs.html#111 `_ `reInteger`:idx: - `regexprs.html#111 `_ + `regexprs.html#113 `_ `removeDir`:idx: `os.html#150 `_ @@ -3691,36 +3702,40 @@ Index `os.html#141 `_ `reNatural`:idx: - `regexprs.html#110 `_ + `regexprs.html#112 `_ `reOctal`:idx: - `regexprs.html#114 `_ + `regexprs.html#116 `_ `repeatChar`:idx: - `strutils.html#148 `_ + `strutils.html#151 `_ + + `replace`:idx: + * `strutils.html#159 `_ + * `strutils.html#160 `_ `replaceStr`:idx: * `strutils.html#127 `_ * `strutils.html#128 `_ `repr`:idx: - `system.html#375 `_ + `system.html#366 `_ `ResetAttributes`:idx: `terminal.html#110 `_ `result`:idx: - * `manual.html#190 `_ - * `manual.html#201 `_ + * `manual.html#193 `_ + * `manual.html#204 `_ `resume`:idx: `osproc.html#107 `_ `return`:idx: - `manual.html#189 `_ + `manual.html#192 `_ `reURL`:idx: - `regexprs.html#117 `_ + `regexprs.html#119 `_ `round`:idx: `math.html#121 `_ @@ -3741,7 +3756,7 @@ Index `manual.html#112 `_ `safecall`:idx: - `manual.html#166 `_ + `manual.html#167 `_ `sameFile`:idx: `os.html#137 `_ @@ -3754,7 +3769,7 @@ Index `scope`:idx: * `manual.html#106 `_ - * `manual.html#217 `_ + * `manual.html#221 `_ `scramble`:idx: `mysql.html#278 `_ @@ -3784,17 +3799,14 @@ Index `xmlgen.html#163 `_ `separate compilation`:idx: - * `manual.html#214 `_ + * `manual.html#218 `_ * `tut1.html#127 `_ `seq`:idx: - `system.html#127 `_ - - `seqToPtr`:idx: - `system.html#461 `_ + `system.html#130 `_ `Sequences`:idx: - * `manual.html#153 `_ + * `manual.html#154 `_ * `tut1.html#118 `_ `SERVER_MORE_RESULTS_EXISTS`:idx: @@ -3831,10 +3843,10 @@ Index `mysql.html#113 `_ `set`:idx: - `system.html#128 `_ + `system.html#131 `_ `set type`:idx: - * `manual.html#157 `_ + * `manual.html#158 `_ * `tut1.html#116 `_ `setBackgroundColor`:idx: @@ -3856,7 +3868,7 @@ Index `os.html#155 `_ `setFilePos`:idx: - `system.html#515 `_ + `system.html#520 `_ `SET_FLAG`:idx: `mysql.html#135 `_ @@ -3865,34 +3877,34 @@ Index `terminal.html#115 `_ `setLen`:idx: - * `system.html#411 `_ - * `system.html#421 `_ + * `system.html#402 `_ + * `system.html#412 `_ `setTestData`:idx: `cgi.html#142 `_ `shl`:idx: + * `system.html#231 `_ + * `system.html#232 `_ + * `system.html#233 `_ + * `system.html#234 `_ + * `system.html#235 `_ + + `shr`:idx: + * `system.html#226 `_ + * `system.html#227 `_ * `system.html#228 `_ * `system.html#229 `_ * `system.html#230 `_ - * `system.html#231 `_ - * `system.html#232 `_ - - `shr`:idx: - * `system.html#223 `_ - * `system.html#224 `_ - * `system.html#225 `_ - * `system.html#226 `_ - * `system.html#227 `_ `simple statements`:idx: - `manual.html#174 `_ + `manual.html#177 `_ `sinh`:idx: `math.html#129 `_ `sizeof`:idx: - `system.html#158 `_ + `system.html#161 `_ `small`:idx: `xmlgen.html#164 `_ @@ -3906,12 +3918,15 @@ Index `split`:idx: * `strutils.html#131 `_ * `strutils.html#132 `_ + * `strutils.html#138 `_ + * `strutils.html#139 `_ `SplitFilename`:idx: `os.html#131 `_ `splitLines`:idx: - `strutils.html#133 `_ + * `strutils.html#133 `_ + * `strutils.html#137 `_ `splitLinesSeq`:idx: `strutils.html#134 `_ @@ -4436,13 +4451,13 @@ Index * `osproc.html#116 `_ `startsWith`:idx: - `strutils.html#149 `_ + `strutils.html#152 `_ `statement macros`:idx: - `tut2.html#113 `_ + `tut2.html#111 `_ `Statements`:idx: - `manual.html#173 `_ + `manual.html#176 `_ `static error`:idx: `manual.html#109 `_ @@ -4451,16 +4466,16 @@ Index `manual.html#103 `_ `stdcall`:idx: - `manual.html#164 `_ + `manual.html#165 `_ `stderr`:idx: - `system.html#490 `_ + `system.html#492 `_ `stdin`:idx: - `system.html#488 `_ + `system.html#490 `_ `stdout`:idx: - `system.html#489 `_ + `system.html#491 `_ `st_dynamic_array`:idx: `mysql.html#339 `_ @@ -4469,7 +4484,7 @@ Index `mysql.html#324 `_ `stmt`:idx: - `macros.html#112 `_ + `system.html#116 `_ `st_mysql`:idx: `mysql.html#356 `_ @@ -4508,12 +4523,15 @@ Index `mysql.html#198 `_ `string`:idx: - * `manual.html#150 `_ + * `manual.html#151 `_ * `system.html#111 `_ `string interpolation`:idx: `strutils.html#110 `_ + `String literals`:idx: + `manual.html#119 `_ + `strip`:idx: `strutils.html#114 `_ @@ -4524,16 +4542,13 @@ Index `strutils.html#107 `_ `structured type`:idx: - `manual.html#151 `_ - - `strutils`:idx: - `nimrodc.html#117 `_ + `manual.html#152 `_ `strVal`:idx: - `macros.html#128 `_ + `macros.html#126 `_ `strVal=`:idx: - `macros.html#134 `_ + `macros.html#132 `_ `st_udf_args`:idx: `mysql.html#258 `_ @@ -4554,14 +4569,14 @@ Index `xmlgen.html#168 `_ `subrange`:idx: - * `manual.html#149 `_ + * `manual.html#150 `_ * `tut1.html#115 `_ `substitution`:idx: `strutils.html#109 `_ `succ`:idx: - `system.html#159 `_ + `system.html#162 `_ `sum`:idx: `math.html#110 `_ @@ -4573,19 +4588,19 @@ Index `osproc.html#106 `_ `swap`:idx: - `system.html#423 `_ + `system.html#414 `_ `symbol`:idx: - `macros.html#125 `_ + `macros.html#123 `_ `symbol=`:idx: - `macros.html#131 `_ + `macros.html#129 `_ `syscall`:idx: - `manual.html#171 `_ + `manual.html#172 `_ `system`:idx: - `manual.html#218 `_ + `manual.html#222 `_ `table`:idx: `xmlgen.html#170 `_ @@ -4594,7 +4609,7 @@ Index `manual.html#125 `_ `TAddress`:idx: - `system.html#376 `_ + `system.html#367 `_ `tan`:idx: `math.html#130 `_ @@ -4804,10 +4819,10 @@ Index `xmlgen.html#172 `_ `template`:idx: - `manual.html#209 `_ + `manual.html#213 `_ `TEndian`:idx: - `system.html#389 `_ + `system.html#380 `_ `terminate`:idx: `osproc.html#108 `_ @@ -4816,13 +4831,13 @@ Index `xmlgen.html#173 `_ `TFile`:idx: - `system.html#485 `_ - - `TFileHandle`:idx: `system.html#487 `_ + `TFileHandle`:idx: + `system.html#489 `_ + `TFileMode`:idx: - `system.html#486 `_ + `system.html#488 `_ `TFilePermission`:idx: `os.html#153 `_ @@ -4843,7 +4858,7 @@ Index `strtabs.html#111 `_ `TGC_Strategy`:idx: - `system.html#469 `_ + `system.html#471 `_ `th`:idx: `xmlgen.html#175 `_ @@ -4857,9 +4872,6 @@ Index `TimeInfoToTime`:idx: `times.html#108 `_ - `times`:idx: - `nimrodc.html#119 `_ - `TIMESTAMP_FLAG`:idx: `mysql.html#134 `_ @@ -4888,25 +4900,25 @@ Index `macros.html#105 `_ `toBiggestFloat`:idx: - `system.html#405 `_ + `system.html#396 `_ `toBiggestInt`:idx: - `system.html#407 `_ + `system.html#398 `_ `toBin`:idx: - `strutils.html#155 `_ + `strutils.html#164 `_ `TObject`:idx: - `system.html#132 `_ + `system.html#135 `_ `toFloat`:idx: - `system.html#404 `_ + `system.html#395 `_ `toHex`:idx: - `strutils.html#142 `_ + `strutils.html#145 `_ `toInt`:idx: - `system.html#406 `_ + `system.html#397 `_ `toLower`:idx: * `strutils.html#115 `_ @@ -4914,7 +4926,7 @@ Index * `unicode.html#106 `_ `toOct`:idx: - `strutils.html#154 `_ + `strutils.html#163 `_ `toOctal`:idx: `strutils.html#130 `_ @@ -4923,22 +4935,22 @@ Index `parseopt.html#102 `_ `toString`:idx: - `strutils.html#147 `_ + `strutils.html#150 `_ `toStrLit`:idx: - `macros.html#146 `_ + `macros.html#144 `_ `toTitle`:idx: `unicode.html#108 `_ `toU16`:idx: - `system.html#181 `_ + `system.html#184 `_ `toU32`:idx: - `system.html#182 `_ + `system.html#185 `_ `toU8`:idx: - `system.html#180 `_ + `system.html#183 `_ `toUpper`:idx: * `strutils.html#117 `_ @@ -4958,14 +4970,14 @@ Index `xmlgen.html#178 `_ `traced`:idx: - * `manual.html#159 `_ + * `manual.html#160 `_ * `tut1.html#121 `_ `TRequestMethod`:idx: `cgi.html#105 `_ `TResult`:idx: - `system.html#157 `_ + `system.html#160 `_ `TRune`:idx: `unicode.html#101 `_ @@ -4977,7 +4989,7 @@ Index `math.html#133 `_ `try`:idx: - * `manual.html#185 `_ + * `manual.html#188 `_ * `tut2.html#107 `_ `Tsqlite3_callback`:idx: @@ -5017,7 +5029,10 @@ Index `times.html#104 `_ `tuple`:idx: - `manual.html#154 `_ + `manual.html#155 `_ + + `tuple unpacking`:idx: + `manual.html#206 `_ `TWeekDay`:idx: `times.html#102 `_ @@ -5035,15 +5050,15 @@ Index `parsexml.html#106 `_ `typ`:idx: - `macros.html#127 `_ + `macros.html#125 `_ `typ=`:idx: - `macros.html#133 `_ + `macros.html#131 `_ `type`:idx: * `manual.html#102 `_ - * `manual.html#140 `_ - * `manual.html#206 `_ + * `manual.html#141 `_ + * `manual.html#210 `_ `type casts`:idx: `tut2.html#101 `_ @@ -5052,11 +5067,14 @@ Index `tut2.html#102 `_ `type parameters`:idx: - * `manual.html#208 `_ + * `manual.html#212 `_ * `tut2.html#109 `_ `type suffix`:idx: - `manual.html#137 `_ + `manual.html#138 `_ + + `typeDesc`:idx: + `system.html#117 `_ `TZipArchive`:idx: `zipfiles.html#101 `_ @@ -5073,15 +5091,15 @@ Index `unchecked runtime error`:idx: `manual.html#111 `_ - `undef`:idx: - `manual.html#223 `_ - `UNIQUE_FLAG`:idx: `mysql.html#140 `_ `UNIQUE_KEY_FLAG`:idx: `mysql.html#126 `_ + `units`:idx: + `manual.html#175 `_ + `unixTimeToWinTime`:idx: `times.html#117 `_ @@ -5089,18 +5107,18 @@ Index `os.html#113 `_ `unsigned integer`:idx: - * `manual.html#142 `_ + * `manual.html#143 `_ * `tut1.html#108 `_ `unsigned operations`:idx: - * `manual.html#143 `_ + * `manual.html#144 `_ * `tut1.html#109 `_ `UNSIGNED_FLAG`:idx: `mysql.html#129 `_ `untraced`:idx: - * `manual.html#160 `_ + * `manual.html#161 `_ * `tut1.html#122 `_ `URLdecode`:idx: @@ -5125,13 +5143,13 @@ Index `cgi.html#109 `_ `validEmailAddress`:idx: - `strutils.html#157 `_ + `strutils.html#166 `_ `validIdentifier`:idx: - `strutils.html#158 `_ + `strutils.html#167 `_ `Var`:idx: - `manual.html#178 `_ + `manual.html#181 `_ `var`:idx: `xmlgen.html#181 `_ @@ -5144,11 +5162,11 @@ Index * `math.html#135 `_ `variant`:idx: - * `manual.html#156 `_ + * `manual.html#157 `_ * `tut2.html#103 `_ `verbose`:idx: - `regexprs.html#118 `_ + `regexprs.html#120 `_ `vertical tabulator`:idx: `manual.html#126 `_ @@ -5167,16 +5185,16 @@ Index * `zipfiles.html#110 `_ `warning`:idx: - * `manual.html#220 `_ - * `manual.html#226 `_ - * `macros.html#139 `_ + * `manual.html#224 `_ + * `manual.html#230 `_ + * `macros.html#137 `_ `when`:idx: - * `manual.html#182 `_ + * `manual.html#185 `_ * `tut1.html#106 `_ `while`:idx: - `manual.html#194 `_ + `manual.html#197 `_ `Whitespace`:idx: `strutils.html#102 `_ @@ -5185,31 +5203,31 @@ Index `times.html#118 `_ `write`:idx: - * `system.html#498 `_ - * `system.html#499 `_ - * `system.html#500 `_ - * `system.html#501 `_ - * `system.html#502 `_ * `system.html#503 `_ * `system.html#504 `_ + * `system.html#505 `_ + * `system.html#506 `_ + * `system.html#507 `_ + * `system.html#508 `_ + * `system.html#509 `_ * `streams.html#103 `_ * `streams.html#104 `_ `writeBuffer`:idx: - `system.html#514 `_ + `system.html#519 `_ `writeBytes`:idx: - `system.html#512 `_ + `system.html#517 `_ `writeChars`:idx: - `system.html#513 `_ + `system.html#518 `_ `writeContentType`:idx: `cgi.html#143 `_ `writeln`:idx: - * `system.html#506 `_ - * `system.html#507 `_ + * `system.html#511 `_ + * `system.html#512 `_ `WriteStyled`:idx: `terminal.html#112 `_ @@ -5225,28 +5243,28 @@ Index `cgi.html#103 `_ `xor`:idx: - * `system.html#119 `_ - * `system.html#243 `_ - * `system.html#244 `_ - * `system.html#245 `_ + * `system.html#122 `_ * `system.html#246 `_ * `system.html#247 `_ + * `system.html#248 `_ + * `system.html#249 `_ + * `system.html#250 `_ `yield`:idx: - `manual.html#191 `_ + `manual.html#194 `_ `ze`:idx: - * `system.html#174 `_ - * `system.html#175 `_ - - `ze64`:idx: - * `system.html#176 `_ * `system.html#177 `_ * `system.html#178 `_ + + `ze64`:idx: * `system.html#179 `_ + * `system.html#180 `_ + * `system.html#181 `_ + * `system.html#182 `_ `ZEROFILL_FLAG`:idx: `mysql.html#130 `_ `zeroMem`:idx: - `system.html#413 `_ \ No newline at end of file + `system.html#404 `_ \ No newline at end of file diff --git a/doc/tut1.txt b/doc/tut1.txt old mode 100644 new mode 100755 diff --git a/doc/tut2.txt b/doc/tut2.txt old mode 100644 new mode 100755 index df6cc1b51..cc67c3400 --- a/doc/tut2.txt +++ b/doc/tut2.txt @@ -311,11 +311,10 @@ class provides a constructor, etc. c.draw() The code uses a ``draw`` procedure that is bound statically, but inside it -the dynamic dispatch happens with the help of the ``fdraw`` field. This is -slightly more inconvienent than in traditional OOP-languages, but has the -advantage of being much more flexible (and somewhat faster). The above approach -also allows some form *monkey patching* by modifying the ``fdraw`` field. - +the dynamic dispatch happens with the help of the ``fdraw`` field. Even though +this solution has its advantages compared to traditional OOP-languages, it is +a **preliminary** solution. Multimethods are a planned language feature that +provide a more flexible and efficient mechanism. Exceptions @@ -323,15 +322,13 @@ Exceptions In Nimrod `exceptions`:idx: are objects. By convention, exception types are prefixed with an 'E', not 'T'. The ``system`` module defines an exception -hierarchy that you should stick to. Reusing an existing exception type is -often better than defining a new exception type: It avoids a proliferation of -types. +hierarchy that you might want to stick to. Exceptions should be allocated on the heap because their lifetime is unknown. A convention is that exceptions should be raised in *exceptional* cases: -For example, if a file cannot be opened, this should not raise an exception -since this is quite common (the file may have been deleted). +For example, if a file cannot be opened, this should not raise an +exception since this is quite common (the file may not exist). Raise statement @@ -359,7 +356,7 @@ The `try`:idx: statement handles exceptions: # and tries to add them var f: TFile - if openFile(f, "numbers.txt"): + if open(f, "numbers.txt"): try: var a = readLine(f) var b = readLine(f) @@ -375,7 +372,7 @@ The `try`:idx: statement handles exceptions: # reraise the unknown exception: raise finally: - closeFile(f) + close(f) The statements after the ``try`` are executed unless an exception is raised. Then the appropriate ``except`` part is executed. @@ -396,8 +393,6 @@ is not executed (if an exception occurs). Generics ======== -`Version 0.7.10: Complex generic types like in the example do not work.`:red: - `Generics`:idx: are Nimrod's means to parametrize procs, iterators or types with `type parameters`:idx:. They are most useful for efficient type safe containers: @@ -448,7 +443,7 @@ containers: while stack.len > 0: var n = stack.pop() while n != nil: - yield n + yield n.data add(stack, n.ri) # push right subtree onto the stack n = n.le # and follow the left pointer @@ -472,8 +467,7 @@ Templates Templates are a simple substitution mechanism that operates on Nimrod's abstract syntax trees. Templates are processed in the semantic pass of the compiler. They integrate well with the rest of the language and share none -of C's preprocessor macros flaws. However, they may lead to code that is harder -to understand and maintain. So one should use them sparingly. +of C's preprocessor macros flaws. To *invoke* a template, call it like a procedure. @@ -488,7 +482,8 @@ Example: The ``!=``, ``>``, ``>=``, ``in``, ``notin``, ``isnot`` operators are in fact templates: This has the benefit that if you overload the ``==`` operator, -the ``!=`` operator is available automatically and does the right thing. +the ``!=`` operator is available automatically and does the right thing. (Except +for IEEE floating point numbers - NaN breaks basic boolean logic.) ``a > b`` is transformed into ``b < a``. ``a in b`` is transformed into ``contains(b, a)``. @@ -513,7 +508,7 @@ This code has a shortcoming: If ``debug`` is set to false someday, the quite expensive ``$`` and ``&`` operations are still performed! (The argument evaluation for procedures is said to be *eager*). -Turning the ``log`` proc into a template solves this problem in an elegant way: +Turning the ``log`` proc into a template solves this problem: .. code-block:: nimrod const @@ -530,7 +525,7 @@ Turning the ``log`` proc into a template solves this problem in an elegant way: The "types" of templates can be the symbols ``expr`` (stands for *expression*), ``stmt`` (stands for *statement*) or ``typedesc`` (stands for *type description*). These are no real types, they just help the compiler parsing. -In later versions, real types will be supported too. +However, real types are supported too. The template body does not open a new scope. To open a new scope use a ``block`` statement: @@ -557,7 +552,8 @@ via a special ``:`` syntax: .. code-block:: nimrod - template withFile(f, filename, mode: expr, actions: stmt): stmt = + template withFile(f: expr, filename: string, mode: TFileMode, + actions: stmt): stmt = block: var fn = filename var f: TFile @@ -583,11 +579,6 @@ once. Macros ====== -If the template mechanism scares you, you will be pleased to hear that -templates are not really necessary: Macros can do anything that templates can -do and much more. Macros are harder to write than templates and even harder -to get right :-). Now that you have been warned, lets see what a macro *is*. - Macros enable advanced compile-time code tranformations, but they cannot change Nimrod's syntax. However, this is no real restriction because Nimrod's syntax is flexible enough anyway. @@ -598,7 +589,8 @@ to an abstract syntax tree (AST). The AST is documented in the There are two ways to invoke a macro: (1) invoking a macro like a procedure call (`expression macros`:idx:) -(2) invoking a macro with the special ``macrostmt`` syntax (`statement macros`:idx:) +(2) invoking a macro with the special ``macrostmt`` + syntax (`statement macros`:idx:) Expression Macros diff --git a/dos2unix.py b/dos2unix.py old mode 100644 new mode 100755 diff --git a/examples/hallo.nim b/examples/hallo.nim old mode 100644 new mode 100755 diff --git a/examples/htmlrefs.nim b/examples/htmlrefs.nim old mode 100644 new mode 100755 diff --git a/examples/htmltitle.nim b/examples/htmltitle.nim old mode 100644 new mode 100755 diff --git a/examples/keyval.nim b/examples/keyval.nim old mode 100644 new mode 100755 diff --git a/examples/luaex.nim b/examples/luaex.nim old mode 100644 new mode 100755 diff --git a/examples/maximum.nim b/examples/maximum.nim old mode 100644 new mode 100755 index 5e4a9cc5e..1e26ee1a7 --- a/examples/maximum.nim +++ b/examples/maximum.nim @@ -3,4 +3,4 @@ import strutils echo "Give a list of numbers (separated by spaces): " -stdin.readLine.splitSeq.each(parseInt).max.`$`.echo(" is the maximum!") +stdin.readLine.split.each(parseInt).max.`$`.echo(" is the maximum!") diff --git a/examples/myfile.txt b/examples/myfile.txt old mode 100644 new mode 100755 diff --git a/examples/pythonex.nim b/examples/pythonex.nim old mode 100644 new mode 100755 diff --git a/examples/readme.txt b/examples/readme.txt old mode 100644 new mode 100755 diff --git a/examples/statcsv.nim b/examples/statcsv.nim old mode 100644 new mode 100755 diff --git a/examples/tclex.nim b/examples/tclex.nim old mode 100644 new mode 100755 diff --git a/gcccpuopt.sh b/gcccpuopt.sh old mode 100644 new mode 100755 diff --git a/gpl.html b/gpl.html old mode 100644 new mode 100755 diff --git a/ide/config.nim b/ide/config.nim old mode 100644 new mode 100755 diff --git a/ide/main.nim b/ide/main.nim old mode 100644 new mode 100755 diff --git a/ide/nimide.glade b/ide/nimide.glade old mode 100644 new mode 100755 diff --git a/ide/nimide.gladep b/ide/nimide.gladep old mode 100644 new mode 100755 diff --git a/ide/nimide.nim b/ide/nimide.nim old mode 100644 new mode 100755 diff --git a/install.txt b/install.txt old mode 100644 new mode 100755 index d06236e24..b8b2fefb5 --- a/install.txt +++ b/install.txt @@ -5,9 +5,6 @@ Installation Installation on Linux/UNIX -------------------------- -Note: - A C compiler is required - knowledge of C is not! - The GNU C Compiler is fully supported, other compilers may work. The C compiler should be in your ``$PATH`` (most likely the case). Note that some few Linux distributions do not ship with a GCC compiler preinstalled - then you have to @@ -31,8 +28,8 @@ manually. An alternative is to create a symbolic link in ``/usr/bin``:: [sudo] ln -s $your_install_dir/bin/nimrod /usr/bin/nimrod From version 0.7.10 onwards ``install.sh`` and ``deinstall.sh`` scripts are -provided for distributing the files over the UNIX hierarchy. However, this -makes updating your Nimrod installation more cumbersome. +provided for distributing the files over the UNIX hierarchy. However, +updating your Nimrod installation is more cumbersome then. Installation on the Macintosh diff --git a/koch.py b/koch.py old mode 100644 new mode 100755 index 593ee4984..6430e4a6e --- a/koch.py +++ b/koch.py @@ -12,16 +12,17 @@ from pycompab import * # --------------------- constants ---------------------------------------- -NIMROD_VERSION = '0.7.10' +NIMROD_VERSION = '0.8.1' # This string contains Nimrod's version. It is the only place # where the version needs to be updated. The rest is done by # the build process automatically. It is replaced **everywhere**! # Format is: Major.Minor.Patch # Major part: plan is to use number 1 for the first version that is stable; # higher versions may be incompatible with previous versions -# Minor part: incremented if new features are added (but is completely -# backwards-compatible) -# Patch level: is increased for every patch +# Minor part: incremented if new features are added; unfortunately often +# not backwards-compatible +# Patch level: is increased for every patch; should be completely +# backwards-compatible EXPLAIN = true force = false @@ -209,14 +210,15 @@ def Glob(pattern): # needed because glob.glob() is buggy on Windows 95: global _baseDir (head, tail) = os.path.split(Path(pattern)) result = [] - try: - os.chdir(os.path.join(_baseDir, head)) + if os.path.exists(head): try: - for f in glob.glob(tail): result.append(os.path.join(head, f)) - except OSError: - result = [] - finally: - os.chdir(_baseDir) + os.chdir(os.path.join(_baseDir, head)) + try: + for f in glob.glob(tail): result.append(os.path.join(head, f)) + except OSError: + result = [] + finally: + os.chdir(_baseDir) return result def FilenameNoExt(f): @@ -384,10 +386,10 @@ Possible Commands: boot [options] bootstraps with given command line options rodsrc generates Nimrod version from Pascal version web generates the website - profile profile the Nimrod compiler - csource [options] build the C sources for installation - zip build the installation ZIP package - inno build the Inno Setup installer + profile profiles the Nimrod compiler + csource [options] builds the C sources for installation + zip builds the installation ZIP package + inno builds the Inno Setup installer """, NIMROD_VERSION + ' ' * (44-len(NIMROD_VERSION)), sys.version) def main(args): @@ -634,7 +636,6 @@ def getOSandProcessor(): return (host, processor) def writePlatdefC(nimrodpath): - import os host, processor = getOSandProcessor() f = open(os.path.join(nimrodpath, "build/platdef.c"), "w+") f.write(Subs('/* Generated by koch.py */\n' diff --git a/lib/copying.txt b/lib/copying.txt old mode 100644 new mode 100755 diff --git a/lib/cycle.h b/lib/cycle.h old mode 100644 new mode 100755 diff --git a/lib/ecmas/dom.nim b/lib/ecmas/dom.nim old mode 100644 new mode 100755 diff --git a/lib/impure/dialogs.nim b/lib/impure/dialogs.nim old mode 100644 new mode 100755 diff --git a/lib/impure/web.nim b/lib/impure/web.nim old mode 100644 new mode 100755 diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim old mode 100644 new mode 100755 diff --git a/lib/lgpl.txt b/lib/lgpl.txt old mode 100644 new mode 100755 diff --git a/lib/nimbase.h b/lib/nimbase.h old mode 100644 new mode 100755 diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim old mode 100644 new mode 100755 diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim old mode 100644 new mode 100755 diff --git a/lib/pure/complex.nim b/lib/pure/complex.nim old mode 100644 new mode 100755 diff --git a/lib/pure/dynlib.nim b/lib/pure/dynlib.nim old mode 100644 new mode 100755 diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim old mode 100644 new mode 100755 diff --git a/lib/pure/lexbase.nim b/lib/pure/lexbase.nim old mode 100644 new mode 100755 diff --git a/lib/pure/macros.nim b/lib/pure/macros.nim old mode 100644 new mode 100755 index 644a785cf..5568e0da5 --- a/lib/pure/macros.nim +++ b/lib/pure/macros.nim @@ -8,10 +8,10 @@ # -## This module contains the interface to the compiler's abstract syntax +## This module contains the interface to the compiler's abstract syntax ## tree (`AST`:idx:). Macros operate on this tree. - -## .. include:: ../doc/astspec.txt + +## .. include:: ../doc/astspec.txt #[[[cog #def toEnum(name, elems): @@ -39,38 +39,38 @@ type nnkInt16Lit, nnkInt32Lit, nnkInt64Lit, nnkFloatLit, nnkFloat32Lit, nnkFloat64Lit, nnkStrLit, nnkRStrLit, nnkTripleStrLit, nnkMetaNode, nnkNilLit, nnkDotCall, - nnkCommand, nnkCall, nnkGenericCall, nnkExplicitTypeListCall, - nnkExprEqExpr, nnkExprColonExpr, nnkIdentDefs, nnkVarTuple, - nnkInfix, nnkPrefix, nnkPostfix, nnkPar, - nnkCurly, nnkBracket, nnkBracketExpr, nnkPragmaExpr, - nnkRange, nnkDotExpr, nnkCheckedFieldExpr, nnkDerefExpr, - nnkIfExpr, nnkElifExpr, nnkElseExpr, nnkLambda, - nnkAccQuoted, nnkTableConstr, nnkQualified, nnkBind, - nnkSymChoice, nnkHiddenStdConv, nnkHiddenSubConv, nnkHiddenCallConv, - nnkConv, nnkCast, nnkAddr, nnkHiddenAddr, - nnkHiddenDeref, nnkObjDownConv, nnkObjUpConv, nnkChckRangeF, - nnkChckRange64, nnkChckRange, nnkStringToCString, nnkCStringToString, - nnkPassAsOpenArray, nnkAsgn, nnkFastAsgn, nnkDefaultTypeParam, - nnkGenericParams, nnkFormalParams, nnkOfInherit, nnkModule, - nnkProcDef, nnkConverterDef, nnkMacroDef, nnkTemplateDef, - nnkIteratorDef, nnkOfBranch, nnkElifBranch, nnkExceptBranch, - nnkElse, nnkMacroStmt, nnkAsmStmt, nnkPragma, - nnkIfStmt, nnkWhenStmt, nnkForStmt, nnkWhileStmt, - nnkCaseStmt, nnkVarSection, nnkConstSection, nnkConstDef, - nnkTypeSection, nnkTypeDef, nnkYieldStmt, nnkTryStmt, - nnkFinally, nnkRaiseStmt, nnkReturnStmt, nnkBreakStmt, - nnkContinueStmt, nnkBlockStmt, nnkDiscardStmt, nnkStmtList, - nnkImportStmt, nnkFromStmt, nnkImportAs, nnkIncludeStmt, - nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, - nnkBlockType, nnkVm, nnkTypeOfExpr, nnkObjectTy, + nnkCommand, nnkCall, nnkCallStrLit, nnkExprEqExpr, + nnkExprColonExpr, nnkIdentDefs, nnkVarTuple, nnkInfix, + nnkPrefix, nnkPostfix, nnkPar, nnkCurly, + nnkBracket, nnkBracketExpr, nnkPragmaExpr, nnkRange, + nnkDotExpr, nnkCheckedFieldExpr, nnkDerefExpr, nnkIfExpr, + nnkElifExpr, nnkElseExpr, nnkLambda, nnkAccQuoted, + nnkTableConstr, nnkQualified, nnkBind, nnkSymChoice, + nnkHiddenStdConv, nnkHiddenSubConv, nnkHiddenCallConv, nnkConv, + nnkCast, nnkAddr, nnkHiddenAddr, nnkHiddenDeref, + nnkObjDownConv, nnkObjUpConv, nnkChckRangeF, nnkChckRange64, + nnkChckRange, nnkStringToCString, nnkCStringToString, nnkPassAsOpenArray, + nnkAsgn, nnkFastAsgn, nnkGenericParams, nnkFormalParams, + nnkOfInherit, nnkModule, nnkProcDef, nnkConverterDef, + nnkMacroDef, nnkTemplateDef, nnkIteratorDef, nnkOfBranch, + nnkElifBranch, nnkExceptBranch, nnkElse, nnkMacroStmt, + nnkAsmStmt, nnkPragma, nnkIfStmt, nnkWhenStmt, + nnkForStmt, nnkWhileStmt, nnkCaseStmt, nnkVarSection, + nnkConstSection, nnkConstDef, nnkTypeSection, nnkTypeDef, + nnkYieldStmt, nnkTryStmt, nnkFinally, nnkRaiseStmt, + nnkReturnStmt, nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, + nnkDiscardStmt, nnkStmtList, nnkImportStmt, nnkFromStmt, + nnkIncludeStmt, nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr, + nnkStmtListType, nnkBlockType, nnkTypeOfExpr, nnkObjectTy, nnkTupleTy, nnkRecList, nnkRecCase, nnkRecWhen, - nnkRefTy, nnkPtrTy, nnkVarTy, nnkAbstractTy, + nnkRefTy, nnkPtrTy, nnkVarTy, nnkDistinctTy, nnkProcTy, nnkEnumTy, nnkEnumFieldDef, nnkReturnToken TNimNodeKinds* = set[TNimrodNodeKind] TNimrodTypeKind* = enum ntyNone, ntyBool, ntyChar, ntyEmpty, - ntyArrayConstr, ntyNil, ntyGeneric, ntyGenericInst, - ntyGenericParam, ntyAbstract, ntyEnum, ntyOrdinal, + ntyArrayConstr, ntyNil, ntyExpr, ntyStmt, + ntyTypeDesc, ntyGenericInvokation, ntyGenericBody, ntyGenericInst, + ntyGenericParam, ntyDistinct, ntyEnum, ntyOrdinal, ntyArray, ntyObject, ntyTuple, ntySet, ntyRange, ntyPtr, ntyRef, ntyVar, ntySequence, ntyProc, ntyPointer, ntyOpenArray, @@ -79,8 +79,8 @@ type ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128 TNimTypeKinds* = set[TNimrodTypeKind] TNimrodSymKind* = enum - nskUnknownSym, nskConditional, nskDynLib, nskParam, - nskTypeParam, nskTemp, nskType, nskConst, + nskUnknown, nskConditional, nskDynLib, nskParam, + nskGenericParam, nskTemp, nskType, nskConst, nskVar, nskProc, nskIterator, nskConverter, nskMacro, nskTemplate, nskField, nskEnumField, nskForVar, nskModule, nskLabel, nskStub @@ -91,7 +91,6 @@ type TNimrodIdent = object of TObject ## represents a Nimrod identifier in the AST - TNimrodNode {.final.} = object # hidden TNimrodSymbol {.final.} = object # hidden TNimrodType {.final.} = object # hidden @@ -103,12 +102,9 @@ type ## represents a Nimrod *symbol* in the compiler; a *symbol* is a looked-up ## *ident*. - PNimrodNode* {.compilerproc.} = ref TNimrodNode + PNimrodNode* = expr ## represents a Nimrod AST node. Macros operate on this type. - expr* = PNimrodNode - stmt* = PNimrodNode - # Nodes should be reference counted to make the `copy` operation very fast! # However, this is difficult to achieve: modify(n[0][1]) should propagate to # its father. How to do this without back references? @@ -119,7 +115,7 @@ proc `[]`* (n: PNimrodNode, i: int): PNimrodNode {.magic: "NChild".} proc `[]=`* (n: PNimrodNode, i: int, child: PNimrodNode) {.magic: "NSetChild".} ## set `n`'s `i`'th child to `child`. -proc `!` *(s: string): TNimrodIdent {.magic: "StrToIdent".} +proc `!` *(s: string): TNimrodIdent {.magic: "StrToIdent".} ## constructs an identifier from the string `s` proc `$`*(i: TNimrodIdent): string {.magic: "IdentToStr".} @@ -159,8 +155,8 @@ proc `typ=`*(n: PNimrodNode, typ: PNimrodType) {.magic: "NSetType".} proc `strVal=`*(n: PNimrodNode, val: string) {.magic: "NSetStrVal".} proc newNimNode*(kind: TNimrodNodeKind, - n: PNimrodNode=nil): PNimrodNode {.magic: "NNewNimNode".} - + n: PNimrodNode=nil): PNimrodNode {.magic: "NNewNimNode".} + proc copyNimNode*(n: PNimrodNode): PNimrodNode {.magic: "NCopyNimNode".} proc copyNimTree*(n: PNimrodNode): PNimrodNode {.magic: "NCopyNimTree".} @@ -192,11 +188,11 @@ proc newIdentNode*(i: TNimrodIdent): PNimrodNode {.compileTime.} = ## creates an identifier node from `i` result = newNimNode(nnkIdent) result.ident = i - + proc newIdentNode*(i: string): PNimrodNode {.compileTime.} = ## creates an identifier node from `i` result = newNimNode(nnkIdent) - result.ident = !i + result.ident = !i proc toStrLit*(n: PNimrodNode): PNimrodNode {.compileTime.} = ## converts the AST `n` to the concrete Nimrod code and wraps that @@ -227,7 +223,7 @@ proc newCall*(theProc: TNimrodIdent, ## the arguments ``args[0..]``. result = newNimNode(nnkCall) result.add(newIdentNode(theProc)) - result.add(args) + result.add(args) proc newCall*(theProc: string, args: openArray[PNimrodNode]): PNimrodNode {.compileTime.} = @@ -236,14 +232,14 @@ proc newCall*(theProc: string, result = newNimNode(nnkCall) result.add(newIdentNode(theProc)) result.add(args) - -proc nestList*(theProc: TNimrodIdent, - x: PNimrodNode): PNimrodNode {.compileTime.} = - ## nests the list `x` into a tree of call expressions: - ## ``[a, b, c]`` is transformed into ``theProc(a, theProc(c, d))`` - var L = x.len - result = newCall(theProc, x[L-2], x[L-1]) - var a = result - for i in countdown(L-3, 0): - a = newCall(theProc, x[i], copyNimTree(a)) - + +proc nestList*(theProc: TNimrodIdent, + x: PNimrodNode): PNimrodNode {.compileTime.} = + ## nests the list `x` into a tree of call expressions: + ## ``[a, b, c]`` is transformed into ``theProc(a, theProc(c, d))`` + var L = x.len + result = newCall(theProc, x[L-2], x[L-1]) + var a = result + for i in countdown(L-3, 0): + a = newCall(theProc, x[i], copyNimTree(a)) + diff --git a/lib/pure/math.nim b/lib/pure/math.nim old mode 100644 new mode 100755 index a3e57e403..bca45894c --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -83,10 +83,12 @@ proc nextPowerOfTwo*(x: int): int = result = result or (result shr 1) Inc(result) -proc countBits*(n: int32): int {.noSideEffect.} +proc countBits32*(n: int32): int {.noSideEffect.} = ## counts the set bits in `n`. - -include "system/cntbits" + var v = n + v = v -% ((v shr 1'i32) and 0x55555555'i32) + v = (v and 0x33333333'i32) +% ((v shr 2'i32) and 0x33333333'i32) + result = ((v +% (v shr 4'i32) and 0xF0F0F0F'i32) *% 0x1010101'i32) shr 24'i32 proc sum*[T](x: openarray[T]): T {.noSideEffect.} = ## computes the sum of the elements in `x`. diff --git a/lib/pure/md5.nim b/lib/pure/md5.nim old mode 100644 new mode 100755 diff --git a/lib/pure/os.nim b/lib/pure/os.nim old mode 100644 new mode 100755 index a0e5565e8..4173cfcce --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -58,10 +58,6 @@ when defined(Nimdoc): # only for proper documentation: ## The character used by the operating system to separate pathname ## components, for example, '/' for POSIX or ':' for the classic ## Macintosh. - ## - ## Note that knowing this is not sufficient to be able to parse or - ## concatenate pathnames -- use `splitPath` and `joinPath` instead -- - ## but it is occasionally useful. AltSep* = '/' ## An alternative character used by the operating system to separate @@ -80,10 +76,10 @@ when defined(Nimdoc): # only for proper documentation: ExeExt* = "" ## The file extension of native executables. For example: - ## "" on UNIX, "exe" on Windows. + ## "" for POSIX, "exe" on Windows. ScriptExt* = "" - ## The file extension of a script file. For example: "" on UNIX, + ## The file extension of a script file. For example: "" for POSIX, ## "bat" on Windows. elif defined(macos): @@ -111,7 +107,7 @@ elif defined(macos): # In full paths the first name (e g HD above) is the name of a mounted # volume. # These names are not unique, because, for instance, two diskettes with the - # same names could be inserted. This means that paths on MacOS is not + # same names could be inserted. This means that paths on MacOS are not # waterproof. In case of equal names the first volume found will do. # Two colons "::" are the relative path to the parent. Three is to the # grandparent etc. @@ -551,7 +547,7 @@ proc sameFile*(path1, path2: string): bool = proc sameFileContent*(path1, path2: string): bool = ## Returns True if both pathname arguments refer to files with identical - ## content. Content is compared byte for byte. + ## binary content. const bufSize = 8192 # 8K buffer var @@ -712,7 +708,7 @@ proc putEnv*(key, val: string) = OSError() iterator iterOverEnvironment*(): tuple[key, value: string] = - ## Iterate over all environments varialbes. In the first component of the + ## Iterate over all environments variables. In the first component of the ## tuple is the name of the current variable stored, in the second its value. getEnvVarsC() for i in 0..high(environment): @@ -760,7 +756,7 @@ iterator walkDir*(dir: string): tuple[kind: TPathComponent, path: string] = ## walks over the directory `dir` and yields for each directory or file in ## `dir`. The component type and full path for each item is returned. ## Walking is not recursive. - ## Example: Assuming this directory structure:: + ## Example: This directory structure:: ## dirA / dirB / fileB1.txt ## / dirC ## / fileA1.txt diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim old mode 100644 new mode 100755 diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim old mode 100644 new mode 100755 diff --git a/lib/pure/parsecsv.nim b/lib/pure/parsecsv.nim old mode 100644 new mode 100755 diff --git a/lib/pure/parseopt.nim b/lib/pure/parseopt.nim old mode 100644 new mode 100755 diff --git a/lib/pure/parsesql.nim b/lib/pure/parsesql.nim old mode 100644 new mode 100755 index 112e79a09..0e7453ae7 --- a/lib/pure/parsesql.nim +++ b/lib/pure/parsesql.nim @@ -571,6 +571,7 @@ proc getTok(p: var TSqlParser) = proc sqlError(p: TSqlParser, msg: string) = var e: ref EInvalidSql + new(e) e.msg = errorStr(p, msg) raise e diff --git a/lib/pure/parsexml.nim b/lib/pure/parsexml.nim old mode 100644 new mode 100755 diff --git a/lib/pure/regexprs.nim b/lib/pure/regexprs.nim old mode 100644 new mode 100755 index 69b35d7f0..3a6ca72ae --- a/lib/pure/regexprs.nim +++ b/lib/pure/regexprs.nim @@ -54,10 +54,10 @@ proc find*(s, pattern: string, matches: var openarray[string], ## returns ``true`` if ``pattern`` occurs in ``s`` and the captured ## substrings in the array ``matches``. If it does not match, nothing ## is written into ``matches``. + proc find*(s, pattern: string, start: int = 0): bool ## returns ``true`` if ``pattern`` occurs in ``s``. - proc rawCompile(pattern: string, flags: cint): PPcre = var msg: CString diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim old mode 100644 new mode 100755 index 0f4d4f771..337be31d1 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -42,7 +42,7 @@ proc write*(s: PStream, x: string) = s.writeData(s, cstring(x), x.len) proc read[T](s: PStream, result: var T) = - ## generic write procedure. Reads `result` from the stream `s`. + ## generic read procedure. Reads `result` from the stream `s`. if s.readData(s, addr(result), sizeof(T)) != sizeof(T): raise newEIO("cannot read from stream") diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim old mode 100644 new mode 100755 diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim old mode 100644 new mode 100755 index 3a9a8d0b3..0aab16214 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -27,7 +27,7 @@ template newException(exceptn, message: expr): expr = type - TCharSet* = set[char] # for compability for Nim + TCharSet* = set[char] # for compability with Nim const Whitespace* = {' ', '\t', '\v', '\r', '\l', '\f'} @@ -45,9 +45,9 @@ const IdentStartChars* = {'a'..'z', 'A'..'Z', '_'} ## the set of characters an identifier can start with - strStart* = 0 # this is only for bootstraping - # XXX: remove this someday - nl* = "\n" # this is only for bootstraping XXX: remove this somehow + strStart* = 0 ## this is only for bootstraping + ## XXX: remove this someday + nl* = "\n" ## this is only for bootstraping XXX: remove this somehow proc `%` *(formatstr: string, a: openarray[string]): string {.noSideEffect.} ## The `substitution`:idx: operator performs string substitutions in @@ -64,8 +64,13 @@ proc `%` *(formatstr: string, a: openarray[string]): string {.noSideEffect.} ## .. code-block:: nimrod ## "The cat eats fish." ## - ## The substitution variables (the thing after the ``$``) - ## are enumerated from 1 to 9. + ## The substitution variables (the thing after the ``$``) are enumerated + ## from 1 to ``a.len``. + ## The notation ``$#`` can be used to refer to the next substitution variable: + ## + ## .. code-block:: nimrod + ## "$# eats $#." % ["The cat", "fish"] + ## ## Substitution variables can also be words (that is ## ``[A-Za-z_]+[A-Za-z0-9_]*``) in which case the arguments in `a` with even ## indices are keys and with odd indices are the corresponding values. @@ -267,19 +272,43 @@ iterator splitLines*(s: string): string = else: break # was '\0' first = last -proc splitLinesSeq*(s: string): seq[string] {.noSideEffect.} = - ## The same as `split`, but is a proc that returns a sequence of substrings. +template iterToProc(iter: expr): stmt = result = @[] - for line in splitLines(s): add(result, line) + for x in iter: add(result, x) + +proc splitLinesSeq*(s: string): seq[string] {.noSideEffect, deprecated.} = + ## The same as `splitLines`, but is a proc that returns a sequence + ## of substrings. + ## **Deprecated since version 0.8.0**: Use `splitLines` instead. + iterToProc(splitLines(s)) proc splitSeq*(s: string, seps: set[char] = Whitespace): seq[string] {. - noSideEffect.} + noSideEffect, deprecated.} = ## The same as `split`, but is a proc that returns a sequence of substrings. + ## **Deprecated since version 0.8.0**: Use `split` instead. + iterToProc(split(s, seps)) -proc splitSeq*(s: string, sep: char): seq[string] {.noSideEffect.} = +proc splitSeq*(s: string, sep: char): seq[string] {.noSideEffect, + deprecated.} = ## The same as `split`, but is a proc that returns a sequence of substrings. - result = @[] - for sub in split(s, sep): add(result, sub) + ## **Deprecated since version 0.8.0**: Use `split` instead. + iterToProc(split(s, sep)) + +proc splitLines*(s: string): seq[string] {.noSideEffect.} = + ## The same as the `splitLines` iterator, but is a proc that returns a + ## sequence of substrings. + iterToProc(splitLines(s)) + +proc split*(s: string, seps: set[char] = Whitespace): seq[string] {. + noSideEffect.} = + ## The same as the `split` iterator, but is a proc that returns a + ## sequence of substrings. + iterToProc(split(s, seps)) + +proc split*(s: string, sep: char): seq[string] {.noSideEffect.} = + ## The same as the `split` iterator, but is a proc that returns a sequence + ## of substrings. + iterToProc(split(s, sep)) proc cmpIgnoreCase*(a, b: string): int {.noSideEffect.} ## Compares two strings in a case insensitive manner. Returns: @@ -308,7 +337,7 @@ proc contains*(s: string, chars: set[char]): bool {.noSideEffect.} proc toHex*(x: BiggestInt, len: int): string {.noSideEffect.} ## Converts `x` to its hexadecimal representation. The resulting string ## will be exactly `len` characters long. No prefix like ``0x`` - ## is generated. `x` is treated as unsigned value. + ## is generated. `x` is treated as an unsigned value. proc intToStr*(x: int, minchars: int = 1): string ## Converts `x` to its decimal representation. The resulting string @@ -367,7 +396,7 @@ proc addSep*(dest: var string, sep = ", ", startLen = 0) {.noSideEffect, proc allCharsInSet*(s: string, theSet: TCharSet): bool = ## returns true iff each character of `s` is in the set `theSet`. for c in items(s): - if not (c in theSet): return false + if c notin theSet: return false return true proc quoteIfContainsWhite*(s: string): string = @@ -397,12 +426,12 @@ proc endsWith(s, suffix: string): bool = when false: proc abbrev(s: string, possibilities: openarray[string]): int = ## returns the index of the first item in `possibilities` if not - ## ambigious; -1 if no item has been found; -2 if multiple items + ## ambiguous; -1 if no item has been found; -2 if multiple items ## match. result = -1 # none found for i in 0..possibilities.len-1: if possibilities[i].startsWith(s): - if result >= 0: return -2 # ambigious + if result >= 0: return -2 # ambiguous result = i proc repeatChar(count: int, c: Char = ' '): string = @@ -509,12 +538,6 @@ proc cmpIgnoreStyle(a, b: string): int = {.pop.} -# ---------- splitting ----------------------------------------------------- - -proc splitSeq(s: string, seps: set[char]): seq[string] = - result = @[] - for sub in split(s, seps): add result, sub - # --------------------------------------------------------------------------- proc join*(a: openArray[string], sep: string): string = @@ -732,7 +755,7 @@ proc rawParseInt(s: string, index: var int): BiggestInt = # one more valid negative than prositive integer. Thus we perform the # computation as a negative number and then change the sign at the end. var - i: int = index # a local i is more efficient than accessing a var parameter + i = index # a local i is more efficient than accessing a var parameter sign: BiggestInt = -1 if s[i] == '+': inc(i) @@ -758,7 +781,7 @@ proc rawParseInt(s: string, index: var int): BiggestInt = proc parseInt(s: string): int = var - index: int = 0 + index = 0 res = rawParseInt(s, index) if index == -1: raise newException(EInvalidValue, "invalid integer: " & s) diff --git a/lib/pure/terminal.nim b/lib/pure/terminal.nim old mode 100644 new mode 100755 diff --git a/lib/pure/times.nim b/lib/pure/times.nim old mode 100644 new mode 100755 index 793b55ead..8c21b6027 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -25,13 +25,13 @@ type when defined(posix): type - TTime* = abstract int ## abstract type that represents a time + TTime* = distinct int ## distinct type that represents a time elif defined(windows): when defined(vcc): # newest version of Visual C++ defines time_t to be of 64 bits - type TTime* = abstract int64 + type TTime* = distinct int64 else: - type TTime* = abstract int32 + type TTime* = distinct int32 elif defined(ECMAScript): type TTime* {.final.} = object diff --git a/lib/pure/unicode.nim b/lib/pure/unicode.nim old mode 100644 new mode 100755 diff --git a/lib/pure/xmlgen.nim b/lib/pure/xmlgen.nim old mode 100644 new mode 100755 diff --git a/lib/system.nim b/lib/system.nim old mode 100644 new mode 100755 index 236a8f8cc..51e5752f2 --- a/lib/system.nim +++ b/lib/system.nim @@ -42,8 +42,12 @@ type type `nil` {.magic: "Nil".} + expr* {.magic: Expr.} ## meta type to denote an expression (for templates) + stmt* {.magic: Stmt.} ## meta type to denote a statement (for templates) + typeDesc* {.magic: TypeDesc.} ## meta type to denote + ## a type description (for templates) -proc defined*[T] (x: T): bool {.magic: "Defined", noSideEffect.} +proc defined*[T](x: T): bool {.magic: "Defined", noSideEffect.} ## Special comile-time procedure that checks whether `x` is ## defined. `x` has to be an identifier or a qualified identifier. ## This can be used to check whether a library provides a certain @@ -54,6 +58,12 @@ proc defined*[T] (x: T): bool {.magic: "Defined", noSideEffect.} ## # provide our own toUpper proc here, because strutils is ## # missing it. +proc definedInScope*[T](x: T, scope=0): bool {. + magic: "DefinedInScope", noSideEffect.} + ## Special comile-time procedure that checks whether `x` is + ## defined in the scope `scope`. `x` has to be an identifier. + ## 0 means the current scope, 1 means the scope above the current scope, etc. + # these require compiler magic: proc `not` *(x: bool): bool {.magic: "Not", noSideEffect.} ## Boolean not; returns true iff ``x == false``. @@ -434,30 +444,6 @@ proc abs*(x: int64): int64 {.magic: "AbsI64", noSideEffect.} ## is -MININT for its type), an overflow exception is thrown (if overflow ## checking is turned on). -proc min*(x, y: int): int {.magic: "MinI", noSideEffect.} -proc min*(x, y: int8): int8 {.magic: "MinI", noSideEffect.} -proc min*(x, y: int16): int16 {.magic: "MinI", noSideEffect.} -proc min*(x, y: int32): int32 {.magic: "MinI", noSideEffect.} -proc min*(x, y: int64): int64 {.magic: "MinI64", noSideEffect.} - ## The minimum value of two integers. - -proc min*[T](x: openarray[T]): T = - ## The minimum value of an openarray. - result = x[0] - for i in 1..high(x): result = min(result, x[i]) - -proc max*(x, y: int): int {.magic: "MaxI", noSideEffect.} -proc max*(x, y: int8): int8 {.magic: "MaxI", noSideEffect.} -proc max*(x, y: int16): int16 {.magic: "MaxI", noSideEffect.} -proc max*(x, y: int32): int32 {.magic: "MaxI", noSideEffect.} -proc max*(x, y: int64): int64 {.magic: "MaxI64", noSideEffect.} - ## The maximum value of two integers. - -proc max*[T](x: openarray[T]): T = - ## The maximum value of an openarray. - result = x[0] - for i in 1..high(x): result = max(result, x[i]) - proc `+%` *(x, y: int): int {.magic: "AddU", noSideEffect.} proc `+%` *(x, y: int8): int8 {.magic: "AddU", noSideEffect.} proc `+%` *(x, y: int16): int16 {.magic: "AddU", noSideEffect.} @@ -613,7 +599,7 @@ template `not_in` * (x, y: expr): expr = not contains(y, x) proc `is` *[T, S](x: T, y: S): bool {.magic: "Is", noSideEffect.} template `is_not` *(x, y: expr): expr = not (x is y) -proc cmp*[T](x, y: T): int = +proc cmp*[T, S: typeDesc](x: T, y: S): int = ## Generic compare proc. Returns a value < 0 iff x < y, a value > 0 iff x > y ## and 0 iff x == y. This is useful for writing generic algorithms without ## performance loss. This generic implementation uses the `==` and `<` @@ -999,6 +985,32 @@ iterator countup*[T](a, b: T, step = 1): T {.inline.} = # we cannot use ``for x in a..b: `` here, because that is not # known in the System module + +proc min*(x, y: int): int {.magic: "MinI", noSideEffect.} +proc min*(x, y: int8): int8 {.magic: "MinI", noSideEffect.} +proc min*(x, y: int16): int16 {.magic: "MinI", noSideEffect.} +proc min*(x, y: int32): int32 {.magic: "MinI", noSideEffect.} +proc min*(x, y: int64): int64 {.magic: "MinI64", noSideEffect.} + ## The minimum value of two integers. + +proc min*[T](x: openarray[T]): T = + ## The minimum value of an openarray. + result = x[0] + for i in 1..high(x): result = min(result, x[i]) + +proc max*(x, y: int): int {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int8): int8 {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int16): int16 {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int32): int32 {.magic: "MaxI", noSideEffect.} +proc max*(x, y: int64): int64 {.magic: "MaxI64", noSideEffect.} + ## The maximum value of two integers. + +proc max*[T](x: openarray[T]): T = + ## The maximum value of an openarray. + result = x[0] + for i in 1..high(x): result = max(result, x[i]) + + iterator items*[T](a: openarray[T]): T {.inline.} = ## iterates over each item of `a`. var i = 0 @@ -1009,9 +1021,11 @@ iterator items*[T](a: openarray[T]): T {.inline.} = iterator items*[IX, T](a: array[IX, T]): T {.inline.} = ## iterates over each item of `a`. var i = low(IX) - while i <= high(IX): - yield a[i] - inc(i) + if i <= high(IX): + while true: + yield a[i] + if i >= high(IX): break + inc(i) iterator items*[T](a: seq[T]): T {.inline.} = ## iterates over each item of `a`. @@ -1032,9 +1046,11 @@ iterator items*[T](a: set[T]): T {.inline.} = ## elements that are really in the set (and not over the ones the set is ## able to hold). var i = low(T) - while i <= high(T): - if i in a: yield i - inc(i) + if i <= high(T): + while true: + if i in a: yield i + if i >= high(T): break + inc(i) iterator items*(a: cstring): char {.inline.} = ## iterates over each item of `a`. @@ -1082,14 +1098,13 @@ proc `&` *[T](x, y: T): seq[T] {.noSideEffect.} = when not defined(NimrodVM): when not defined(ECMAScript): - # XXX make this local procs - proc seqToPtr*[T](x: seq[T]): pointer {.inline, nosideeffect.} = + proc seqToPtr[T](x: seq[T]): pointer {.inline, nosideeffect.} = result = cast[pointer](x) else: - proc seqToPtr*[T](x: seq[T]): pointer {.pure, nosideeffect.} = + proc seqToPtr[T](x: seq[T]): pointer {.pure, nosideeffect.} = asm """return `x`""" - proc `==` *[T](x, y: seq[T]): bool {.noSideEffect.} = + proc `==` *[T: typeDesc](x, y: seq[T]): bool {.noSideEffect.} = ## Generic equals operator for sequences: relies on a equals operator for ## the element type `T`. if seqToPtr(x) == seqToPtr(y): @@ -1101,10 +1116,9 @@ when not defined(NimrodVM): if x[i] != y[i]: return false result = true -proc find*[T, S](a: T, item: S): int {.inline.} = +proc find*[T, S: typeDesc](a: T, item: S): int {.inline.}= ## Returns the first index of `item` in `a` or -1 if not found. This requires - ## appropriate `==` and `items` procs to work. - result = 0 + ## appropriate `items` and `==` procs to work. for i in items(a): if i == item: return inc(result) @@ -1437,6 +1451,7 @@ when not defined(EcmaScript) and not defined(NimrodVM): include "system/arithm" {.pop.} # stack trace include "system/dyncalls" + include "system/sets" const GenericSeqSize = (2 * sizeof(int)) diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim old mode 100644 new mode 100755 diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim old mode 100644 new mode 100755 diff --git a/lib/system/arithm.nim b/lib/system/arithm.nim old mode 100644 new mode 100755 diff --git a/lib/system/assign.nim b/lib/system/assign.nim old mode 100644 new mode 100755 index 3d4bf4d61..44d2e5c64 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/lib/system/cellsets.nim b/lib/system/cellsets.nim old mode 100644 new mode 100755 diff --git a/lib/system/cntbits.nim b/lib/system/cntbits.nim old mode 100644 new mode 100755 index a975f38ae..281b96dd0 --- a/lib/system/cntbits.nim +++ b/lib/system/cntbits.nim @@ -8,13 +8,5 @@ # -proc population16(a: int): int {.inline.} = - var x = a - x = ((x and 0xAAAA) shr 1) + (x and 0x5555) - x = ((x and 0xCCCC) shr 2) + (x and 0x3333) - x = ((x and 0xF0F0) shr 4) + (x and 0x0F0F) - x = ((x and 0xFF00) shr 8) + (x and 0x00FF) - return x -proc countBits(n: int32): int = - result = population16(n and 0xffff'i32) + population16(n shr 16'i32) + diff --git a/lib/system/debugger.nim b/lib/system/debugger.nim old mode 100644 new mode 100755 index 1139503cb..01d8bd8a2 --- a/lib/system/debugger.nim +++ b/lib/system/debugger.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2008 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -11,9 +11,9 @@ # with the application. We should not use dynamic memory here as that # would interfere with the GC and trigger ON/OFF errors if the # user program corrupts memory. Unfortunately, for dispaying -# variables we use the system.repr() proc which uses Nimrod +# variables we use the ``system.repr()`` proc which uses Nimrod # strings and thus allocates memory from the heap. Pity, but -# I do not want to implement repr() twice. We also cannot deactivate +# I do not want to implement ``repr()`` twice. We also cannot deactivate # the GC here as that might run out of memory too quickly... type diff --git a/lib/system/dyncalls.nim b/lib/system/dyncalls.nim old mode 100644 new mode 100755 diff --git a/lib/system/ecmasys.nim b/lib/system/ecmasys.nim old mode 100644 new mode 100755 diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim old mode 100644 new mode 100755 diff --git a/lib/system/gc.nim b/lib/system/gc.nim old mode 100644 new mode 100755 index f91b8843e..da8f75768 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -468,10 +468,10 @@ proc collectCycles(gch: var TGcHeap) = Init(gch.cycleRoots) proc gcMark(p: pointer) {.inline.} = - # the addresses are not as objects on the stack, so turn them to objects: + # the addresses are not as cells on the stack, so turn them to cells: var cell = usrToCell(p) var c = cast[TAddress](cell) - if c >% PageSize: + if c >% PageSize and (c and (MemAlign-1)) == 0: # fast check: does it look like a cell? if isAllocatedPtr(allocator, cell): # mark the cell: @@ -585,7 +585,7 @@ proc CollectZCT(gch: var TGcHeap) = # it has not been removed yet from the ZCT. This is because # ``incref`` does not bother to remove the cell from the ZCT # as this might be too slow. - # In any case, it should be removed from the ZCT. But not + # In any case, it should be removed from the ZCT. But not # freed. **KEEP THIS IN MIND WHEN MAKING THIS INCREMENTAL!** if canBeCycleRoot(c): excl(gch.cycleRoots, c) when logGC: writeCell("zct dealloc cell", c) diff --git a/lib/system/hti.nim b/lib/system/hti.nim old mode 100644 new mode 100755 index dd74bfa3f..3343000ae --- a/lib/system/hti.nim +++ b/lib/system/hti.nim @@ -8,38 +8,31 @@ # type # This should be he same as ast.TTypeKind - # some enum fields are not used at runtime + # many enum fields are not used at runtime TNimKind = enum - tyNone, # 0 - tyBool, # 1 - tyChar, # 2 - tyEmpty, # 3 - tyArrayConstr, # 4 - tyNil, # 5 - tyGeneric, # 6 - tyGenericInst, # 7 - tyGenericParam, # 8 - tyAbstract, # 9 - tyEnum, # 10 - tyOrdinal, # 11 - tyArray, # 12 - tyObject, # 13 - tyTuple, # 14 - tySet, # 15 - tyRange, # 16 - tyPtr, # 17 - tyRef, # 18 - tyVar, # 19 - tySequence, # 20 - tyProc, # 21 - tyPointer, # 22 - tyOpenArray, # 23 - tyString, # 24 - tyCString, # 25 - tyForward, # 26 + tyNone, tyBool, tyChar, + tyEmpty, tyArrayConstr, tyNil, tyExpr, tyStmt, tyTypeDesc, + tyGenericInvokation, # ``T[a, b]`` for types to invoke + tyGenericBody, # ``T[a, b, body]`` last parameter is the body + tyGenericInst, # ``T[a, b, realInstance]`` instantiated generic type + tyGenericParam, # ``a`` in the example + tyDistinct, # distinct type + tyEnum, + tyOrdinal, + tyArray, + tyObject, + tyTuple, + tySet, + tyRange, + tyPtr, tyRef, + tyVar, + tySequence, + tyProc, + tyPointer, tyOpenArray, + tyString, tyCString, tyForward, tyInt, tyInt8, tyInt16, tyInt32, tyInt64, tyFloat, tyFloat32, tyFloat64, tyFloat128, - tyPureObject # 36: signals that object has no `n_type` field + tyPureObject # signals that object has no `n_type` field TNimNodeKind = enum nkNone, nkSlot, nkList, nkCase TNimNode {.compilerproc, final.} = object diff --git a/lib/system/mm.nim b/lib/system/mm.nim old mode 100644 new mode 100755 diff --git a/lib/system/profiler.nim b/lib/system/profiler.nim old mode 100644 new mode 100755 diff --git a/lib/system/repr.nim b/lib/system/repr.nim old mode 100644 new mode 100755 index 765d66be0..e340f1d7c --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/lib/system/sets.nim b/lib/system/sets.nim old mode 100644 new mode 100755 index 651cc534b..f9f3eb32b --- a/lib/system/sets.nim +++ b/lib/system/sets.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2006 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -10,79 +10,19 @@ # set handling type - TMyByte = int8 - TNimSet = array [0..4*2048-1, TMyByte] + TNimSet = array [0..4*2048-1, int8] -# implementation: +proc countBits32(n: int32): int {.compilerproc.} = + var v = n + v = v -% ((v shr 1'i32) and 0x55555555'i32) + v = (v and 0x33333333'i32) +% ((v shr 2'i32) and 0x33333333'i32) + result = ((v +% (v shr 4'i32) and 0xF0F0F0F'i32) *% 0x1010101'i32) shr 24'i32 -proc countBits(n: int32): int {.exportc: "countBits".} -# We use a prototype here, not in "cntbits.nim", because that is included -# in math.nim too. So when linking with math.nim it'd give a duplicated -# symbol error which we avoid by renaming here. +proc countBits64(n: int64): int {.compilerproc.} = + result = countBits32(toU32(n and 0xffff'i64)) + + countBits32(toU32(n shr 16'i64)) -include "system/cntbits" - -proc unionSets(res: var TNimSet, a, b: TNimSet, len: int) {. - compilerproc, inline.} = - for i in countup(0, len-1): res[i] = a[i] or b[i] - -proc diffSets(res: var TNimSet, a, b: TNimSet, len: int) {. - compilerproc, inline.} = - for i in countup(0, len-1): res[i] = a[i] and not b[i] - -proc intersectSets(res: var TNimSet, a, b: TNimSet, len: int) {. - compilerproc, inline.} = - for i in countup(0, len-1): res[i] = a[i] and b[i] - -proc symdiffSets(res: var TNimSet, a, b: TNimSet, len: int) {. - compilerproc, inline.} = - for i in countup(0, len-1): res[i] = a[i] xor b[i] - -proc containsSets(a, b: TNimSet, len: int): bool {.compilerproc, inline.} = - # s1 <= s2 ? - for i in countup(0, len-1): - if (a[i] and not b[i]) != 0'i8: return false - return true - -proc containsSubsets(a, b: TNimSet, len: int): bool {.compilerproc, inline.} = - # s1 < s2 ? - result = false # assume they are equal - for i in countup(0, len-1): - if (a[i]) and not b[i]) != 0'i32: return false - if a[i] != b[i]: result = true # they are not equal - -proc equalSets(a, b: TNimSet, len: int): bool {.compilerproc, inline.} = - for i in countup(0, len-1): - if a[i] != b[i]: return false - return true - -proc cardSet(s: TNimSet, len: int): int {.compilerproc, inline.} = +proc cardSet(s: TNimSet, len: int): int {.compilerproc.} = result = 0 for i in countup(0, len-1): - inc(result, countBits(ze(s[i]))) - -const - WORD_SIZE = sizeof(TMyByte)*8 - -proc inSet(s: TNimSet, elem: int): bool {.compilerproc, inline.} = - return (s[elem /% WORD_SIZE] and (1 shl (elem %% WORD_SIZE))) != 0 - -proc inclSets(s: var TNimSet, e: int) {.compilerproc, inline.} = - s[e /% WORD_SIZE] = s[e /% WORD_SIZE] or toU8(1 shl (e %% WORD_SIZE)) - -proc inclRange(s: var TNimSet, first, last: int) {.compilerproc.} = - # not very fast, but it is seldom used - for i in countup(first, last): inclSets(s, i) - -proc smallInclRange(s: var int, first, last: int) {.compilerproc.} = - # not very fast, but it is seldom used - for i in countup(first, last): - s = s or (1 shl (i %% sizeof(int)*8)) - -proc exclSets(s: var TNimSet, e: int) {.compilerproc, inline.} = - s[e /% WORD_SIZE] = s[e /% WORD_SIZE] and - not toU8(1 shl (e %% WORD_SIZE)) - -proc smallContainsSubsets(a, b: int): bool {.compilerProc, inline.} = - # not used by new code generator - return ((a and not b) != 0) and (a != b) + inc(result, countBits32(int32(ze(s[i])))) diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim old mode 100644 new mode 100755 index c9db48d51..8b6d0e285 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -18,7 +18,7 @@ proc fputs(c: cstring, f: TFile) {.importc: "fputs", noDecl.} proc fgets(c: cstring, n: int, f: TFile): cstring {.importc: "fgets", noDecl.} -proc fgetc(stream: TFile): int {.importc: "fgetc", nodecl.} +proc fgetc(stream: TFile): cint {.importc: "fgetc", nodecl.} proc ungetc(c: cint, f: TFile) {.importc: "ungetc", nodecl.} proc putc(c: Char, stream: TFile) {.importc: "putc", nodecl.} proc fprintf(f: TFile, frmt: CString) {.importc: "fprintf", nodecl, varargs.} @@ -36,11 +36,9 @@ var proc rawReadLine(f: TFile, result: var string) = # of course this could be optimized a bit; but IO is slow anyway... # and it was difficult to get this CORRECT with Ansi C's methods - var - c: cint setLen(result, 0) # reuse the buffer! while True: - c = fgetc(f) + var c = fgetc(f) if c < 0'i32: break # EOF if c == 10'i32: break # LF if c == 13'i32: # CR @@ -68,6 +66,8 @@ proc write(f: TFile, c: Char) = putc(c, f) proc write(f: TFile, a: openArray[string]) = for x in items(a): write(f, x) +#{.error: "for debugging.".} + proc readFile(filename: string): string = var f: TFile try: @@ -85,11 +85,9 @@ proc readFile(filename: string): string = proc EndOfFile(f: TFile): bool = # do not blame me; blame the ANSI C standard this is so brain-damaged - var - c: int - c = fgetc(f) + var c = fgetc(f) ungetc(c, f) - return c == -1 + return c == -1'i32 proc writeln[Ty](f: TFile, x: Ty) = write(f, x) diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-1.txt b/lib/ucmaps/8859-1.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-10.txt b/lib/ucmaps/8859-10.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-13.txt b/lib/ucmaps/8859-13.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-14.txt b/lib/ucmaps/8859-14.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-15.txt b/lib/ucmaps/8859-15.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-2.txt b/lib/ucmaps/8859-2.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-3.txt b/lib/ucmaps/8859-3.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-4.txt b/lib/ucmaps/8859-4.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-5.txt b/lib/ucmaps/8859-5.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-6.txt b/lib/ucmaps/8859-6.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-7.txt b/lib/ucmaps/8859-7.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-8.txt b/lib/ucmaps/8859-8.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/8859-9.txt b/lib/ucmaps/8859-9.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1250.txt b/lib/ucmaps/cp1250.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1251.txt b/lib/ucmaps/cp1251.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1252.txt b/lib/ucmaps/cp1252.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1253.txt b/lib/ucmaps/cp1253.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1254.txt b/lib/ucmaps/cp1254.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1255.txt b/lib/ucmaps/cp1255.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1256.txt b/lib/ucmaps/cp1256.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1257.txt b/lib/ucmaps/cp1257.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp1258.txt b/lib/ucmaps/cp1258.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp437.txt b/lib/ucmaps/cp437.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp737.txt b/lib/ucmaps/cp737.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp775.txt b/lib/ucmaps/cp775.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp850.txt b/lib/ucmaps/cp850.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp852.txt b/lib/ucmaps/cp852.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp855.txt b/lib/ucmaps/cp855.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp856.txt b/lib/ucmaps/cp856.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp857.txt b/lib/ucmaps/cp857.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp860.txt b/lib/ucmaps/cp860.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp861.txt b/lib/ucmaps/cp861.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp862.txt b/lib/ucmaps/cp862.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp863.txt b/lib/ucmaps/cp863.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp864.txt b/lib/ucmaps/cp864.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp865.txt b/lib/ucmaps/cp865.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp866.txt b/lib/ucmaps/cp866.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp869.txt b/lib/ucmaps/cp869.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp874.txt b/lib/ucmaps/cp874.txt old mode 100644 new mode 100755 diff --git a/lib/ucmaps/cp932.txt b/lib/ucmaps/cp932.txt old mode 100644 new mode 100755 diff --git a/lib/windows/mmsystem.nim b/lib/windows/mmsystem.nim old mode 100644 new mode 100755 index a44e4dfca..07d0cb538 --- a/lib/windows/mmsystem.nim +++ b/lib/windows/mmsystem.nim @@ -2605,52 +2605,49 @@ proc PlaySound*(x1: cstring, x2: HMODULE, x3: DWORD): BOOL{.stdcall, # implementation proc MEVT_EVENTTYPE(x: int8): int8 = - result = (x shr 24) And 0x000000FF + result = toU8(x shr 24) proc MEVT_EVENTPARM(x: DWORD): DWORD = result = x And 0x00FFFFFF -type - TFourBytes = array[0..3, int8] - proc MCI_MSF_MINUTE(msf: int32): int8 = - result = msf and 0xff + result = toU8(msf and 0xff) proc MCI_TMSF_TRACK(tmsf: int32): int8 = - result = tmsf and 0xff + result = toU8(tmsf and 0xff) proc MCI_HMS_HOUR(h: int32): int8 = - result = h and 0xff + result = toU8(h and 0xff) proc MCI_MSF_SECOND(msf: int32): int8 = - result = msf shr 8 and 0xff + result = toU8(msf shr 8) proc MCI_TMSF_MINUTE(tmsf: int32): int8 = - result = tmsf shr 8 and 0xff + result = toU8(tmsf shr 8) proc MCI_HMS_MINUTE(h: int32): int8 = - result = h shr 8 and 0xff + result = toU8(h shr 8) proc MCI_MSF_FRAME(msf: int32): int8 = - result = msf shr 16 and 0xff + result = toU8(msf shr 16) proc MCI_TMSF_SECOND(tmsf: int32): int8 = - result = tmsf shr 16 and 0xff + result = toU8(tmsf shr 16) proc MCI_HMS_SECOND(h: int32): int8 = - result = h shr 16 and 0xff + result = toU8(h shr 16) proc MCI_MAKE_MSF(m, s, f: int8): int32 = - result = m or s shl 8 or f shl 16 + result = toU32(ze(m) or ze(s) shl 8 or ze(f) shl 16) proc MCI_MAKE_HMS(h, m, s: int8): int32 = - result = h or m shl 8 or s shl 16 + result = toU32(ze(h) or ze(m) shl 8 or ze(s) shl 16) proc MCI_TMSF_FRAME(tmsf: int32): int8 = - result = tmsf shr 24 and 0xff + result = toU8(tmsf shr 24) proc mci_Make_TMSF(t, m, s, f: int8): int32 = - result = t or m shl 8 or s shl 16 or f shl 24 + result = ze(t) or ze(m) shl 8 or ze(s) shl 16 or ze(f) shl 24 proc DIBINDEX(n: int32): int32 = - result = n Or 0x000010FF shl 16 + result = n Or 0x000010FF'i32 shl 16'i32 diff --git a/lib/windows/nb30.nim b/lib/windows/nb30.nim old mode 100644 new mode 100755 diff --git a/lib/windows/ole2.nim b/lib/windows/ole2.nim old mode 100644 new mode 100755 diff --git a/lib/windows/shellapi.nim b/lib/windows/shellapi.nim old mode 100644 new mode 100755 diff --git a/lib/windows/shfolder.nim b/lib/windows/shfolder.nim old mode 100644 new mode 100755 diff --git a/lib/windows/windows.nim b/lib/windows/windows.nim old mode 100644 new mode 100755 diff --git a/lib/windows/winlean.nim b/lib/windows/winlean.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/cairo/cairo.nim b/lib/wrappers/cairo/cairo.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/cairo/cairoft.nim b/lib/wrappers/cairo/cairoft.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/cairo/cairowin32.nim b/lib/wrappers/cairo/cairowin32.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/cairo/cairoxlib.nim b/lib/wrappers/cairo/cairoxlib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/atk.nim b/lib/wrappers/gtk/atk.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/gdk2.nim b/lib/wrappers/gtk/gdk2.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/gdk2pixbuf.nim b/lib/wrappers/gtk/gdk2pixbuf.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/gdkglext.nim b/lib/wrappers/gtk/gdkglext.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/glib2.nim b/lib/wrappers/gtk/glib2.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/gtk2.nim b/lib/wrappers/gtk/gtk2.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/gtkglext.nim b/lib/wrappers/gtk/gtkglext.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/gtkhtml.nim b/lib/wrappers/gtk/gtkhtml.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/libglade2.nim b/lib/wrappers/gtk/libglade2.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/pango.nim b/lib/wrappers/gtk/pango.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/gtk/pangoutils.nim b/lib/wrappers/gtk/pangoutils.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/libcurl.nim b/lib/wrappers/libcurl.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/lua/lauxlib.nim b/lib/wrappers/lua/lauxlib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/lua/lua.nim b/lib/wrappers/lua/lua.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/lua/lualib.nim b/lib/wrappers/lua/lualib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/mysql.nim b/lib/wrappers/mysql.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/odbcsql.nim b/lib/wrappers/odbcsql.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/gl.nim b/lib/wrappers/opengl/gl.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/gl.pp b/lib/wrappers/opengl/gl.pp deleted file mode 100644 index f6e0ddc39..000000000 --- a/lib/wrappers/opengl/gl.pp +++ /dev/null @@ -1,1548 +0,0 @@ -{ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} - -(*++ BUILD Version: 0004 // Increment this if a change has global effects - -Copyright (c) 1985-96, Microsoft Corporation - -Module Name: - - gl.h - -Abstract: - - Procedure declarations, constant definitions and macros for the OpenGL - component. - ---*) - -{* -** Copyright 1996 Silicon Graphics, Inc. -** All Rights Reserved. -** -** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; -** the contents of this file may not be disclosed to third parties, copied or -** duplicated in any form, in whole or in part, without the prior written -** permission of Silicon Graphics, Inc. -** -** RESTRICTED RIGHTS LEGEND: -** Use, duplication or disclosure by the Government is subject to restrictions -** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data -** and Computer Software clause at DFARS 252.227-7013, and/or in similar or -** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - -** rights reserved under the Copyright Laws of the United States. -*} - -{******************************************************************************} -{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } -{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } -{******************************************************************************} -(* -{$MODE Delphi} -{$MACRO ON} -{$IFDEF Windows} - {$DEFINE extdecl := stdcall} -{$ELSE} - {$DEFINE extdecl := cdecl} - {$IFDEF MorphOS} - {$INLINE ON} - {$DEFINE GL_UNIT} - {$ELSE} - {$LINKLIB c} - {$ENDIF} -{$ENDIF} *) - -unit GL; - -interface - -const - dllname = 'opengl32.dll'; - dylibname = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib'; - posixname = 'libGL.so.1'; - -type - GLenum = Cardinal; PGLenum = ^GLenum; - GLboolean = Byte; PGLboolean = ^GLboolean; - GLbitfield = Cardinal; PGLbitfield = ^GLbitfield; - GLbyte = ShortInt; PGLbyte = ^GLbyte; - GLshort = SmallInt; PGLshort = ^GLshort; - GLint = Integer; PGLint = ^GLint; - GLsizei = Integer; PGLsizei = ^GLsizei; - GLubyte = Byte; PGLubyte = ^GLubyte; - GLushort = Word; PGLushort = ^GLushort; - GLuint = Cardinal; PGLuint = ^GLuint; - GLfloat = Single; PGLfloat = ^GLfloat; - GLclampf = Single; PGLclampf = ^GLclampf; - GLdouble = Double; PGLdouble = ^GLdouble; - GLclampd = Double; PGLclampd = ^GLclampd; -{ GLvoid = void; } PGLvoid = Pointer; - PPGLvoid = ^PGLvoid; - - TGLenum = GLenum; - TGLboolean = GLboolean; - TGLbitfield = GLbitfield; - TGLbyte = GLbyte; - TGLshort = GLshort; - TGLint = GLint; - TGLsizei = GLsizei; - TGLubyte = GLubyte; - TGLushort = GLushort; - TGLuint = GLuint; - TGLfloat = GLfloat; - TGLclampf = GLclampf; - TGLdouble = GLdouble; - TGLclampd = GLclampd; - -{******************************************************************************} - -const - // Version - GL_VERSION_1_1 = 1; - - // AccumOp - GL_ACCUM = $0100; - GL_LOAD = $0101; - GL_RETURN = $0102; - GL_MULT = $0103; - GL_ADD = $0104; - - // AlphaFunction - GL_NEVER = $0200; - GL_LESS = $0201; - GL_EQUAL = $0202; - GL_LEQUAL = $0203; - GL_GREATER = $0204; - GL_NOTEQUAL = $0205; - GL_GEQUAL = $0206; - GL_ALWAYS = $0207; - - // AttribMask - GL_CURRENT_BIT = $00000001; - GL_POINT_BIT = $00000002; - GL_LINE_BIT = $00000004; - GL_POLYGON_BIT = $00000008; - GL_POLYGON_STIPPLE_BIT = $00000010; - GL_PIXEL_MODE_BIT = $00000020; - GL_LIGHTING_BIT = $00000040; - GL_FOG_BIT = $00000080; - GL_DEPTH_BUFFER_BIT = $00000100; - GL_ACCUM_BUFFER_BIT = $00000200; - GL_STENCIL_BUFFER_BIT = $00000400; - GL_VIEWPORT_BIT = $00000800; - GL_TRANSFORM_BIT = $00001000; - GL_ENABLE_BIT = $00002000; - GL_COLOR_BUFFER_BIT = $00004000; - GL_HINT_BIT = $00008000; - GL_EVAL_BIT = $00010000; - GL_LIST_BIT = $00020000; - GL_TEXTURE_BIT = $00040000; - GL_SCISSOR_BIT = $00080000; - GL_ALL_ATTRIB_BITS = $000FFFFF; - - // BeginMode - GL_POINTS = $0000; - GL_LINES = $0001; - GL_LINE_LOOP = $0002; - GL_LINE_STRIP = $0003; - GL_TRIANGLES = $0004; - GL_TRIANGLE_STRIP = $0005; - GL_TRIANGLE_FAN = $0006; - GL_QUADS = $0007; - GL_QUAD_STRIP = $0008; - GL_POLYGON = $0009; - - // BlendingFactorDest - GL_ZERO = 0; - GL_ONE = 1; - GL_SRC_COLOR = $0300; - GL_ONE_MINUS_SRC_COLOR = $0301; - GL_SRC_ALPHA = $0302; - GL_ONE_MINUS_SRC_ALPHA = $0303; - GL_DST_ALPHA = $0304; - GL_ONE_MINUS_DST_ALPHA = $0305; - - // BlendingFactorSrc - // GL_ZERO - // GL_ONE - GL_DST_COLOR = $0306; - GL_ONE_MINUS_DST_COLOR = $0307; - GL_SRC_ALPHA_SATURATE = $0308; - // GL_SRC_ALPHA - // GL_ONE_MINUS_SRC_ALPHA - // GL_DST_ALPHA - // GL_ONE_MINUS_DST_ALPHA - - // Boolean - GL_TRUE = 1; - GL_FALSE = 0; - - // ClearBufferMask - // GL_COLOR_BUFFER_BIT - // GL_ACCUM_BUFFER_BIT - // GL_STENCIL_BUFFER_BIT - // GL_DEPTH_BUFFER_BIT - - // ClientArrayType - // GL_VERTEX_ARRAY - // GL_NORMAL_ARRAY - // GL_COLOR_ARRAY - // GL_INDEX_ARRAY - // GL_TEXTURE_COORD_ARRAY - // GL_EDGE_FLAG_ARRAY - - // ClipPlaneName - GL_CLIP_PLANE0 = $3000; - GL_CLIP_PLANE1 = $3001; - GL_CLIP_PLANE2 = $3002; - GL_CLIP_PLANE3 = $3003; - GL_CLIP_PLANE4 = $3004; - GL_CLIP_PLANE5 = $3005; - - // ColorMaterialFace - // GL_FRONT - // GL_BACK - // GL_FRONT_AND_BACK - - // ColorMaterialParameter - // GL_AMBIENT - // GL_DIFFUSE - // GL_SPECULAR - // GL_EMISSION - // GL_AMBIENT_AND_DIFFUSE - - // ColorPointerType - // GL_BYTE - // GL_UNSIGNED_BYTE - // GL_SHORT - // GL_UNSIGNED_SHORT - // GL_INT - // GL_UNSIGNED_INT - // GL_FLOAT - // GL_DOUBLE - - // CullFaceMode - // GL_FRONT - // GL_BACK - // GL_FRONT_AND_BACK - - // DataType - GL_BYTE = $1400; - GL_UNSIGNED_BYTE = $1401; - GL_SHORT = $1402; - GL_UNSIGNED_SHORT = $1403; - GL_INT = $1404; - GL_UNSIGNED_INT = $1405; - GL_FLOAT = $1406; - GL_2_BYTES = $1407; - GL_3_BYTES = $1408; - GL_4_BYTES = $1409; - GL_DOUBLE = $140A; - - // DepthFunction - // GL_NEVER - // GL_LESS - // GL_EQUAL - // GL_LEQUAL - // GL_GREATER - // GL_NOTEQUAL - // GL_GEQUAL - // GL_ALWAYS - - // DrawBufferMode - GL_NONE = 0; - GL_FRONT_LEFT = $0400; - GL_FRONT_RIGHT = $0401; - GL_BACK_LEFT = $0402; - GL_BACK_RIGHT = $0403; - GL_FRONT = $0404; - GL_BACK = $0405; - GL_LEFT = $0406; - GL_RIGHT = $0407; - GL_FRONT_AND_BACK = $0408; - GL_AUX0 = $0409; - GL_AUX1 = $040A; - GL_AUX2 = $040B; - GL_AUX3 = $040C; - - // Enable - // GL_FOG - // GL_LIGHTING - // GL_TEXTURE_1D - // GL_TEXTURE_2D - // GL_LINE_STIPPLE - // GL_POLYGON_STIPPLE - // GL_CULL_FACE - // GL_ALPHA_TEST - // GL_BLEND - // GL_INDEX_LOGIC_OP - // GL_COLOR_LOGIC_OP - // GL_DITHER - // GL_STENCIL_TEST - // GL_DEPTH_TEST - // GL_CLIP_PLANE0 - // GL_CLIP_PLANE1 - // GL_CLIP_PLANE2 - // GL_CLIP_PLANE3 - // GL_CLIP_PLANE4 - // GL_CLIP_PLANE5 - // GL_LIGHT0 - // GL_LIGHT1 - // GL_LIGHT2 - // GL_LIGHT3 - // GL_LIGHT4 - // GL_LIGHT5 - // GL_LIGHT6 - // GL_LIGHT7 - // GL_TEXTURE_GEN_S - // GL_TEXTURE_GEN_T - // GL_TEXTURE_GEN_R - // GL_TEXTURE_GEN_Q - // GL_MAP1_VERTEX_3 - // GL_MAP1_VERTEX_4 - // GL_MAP1_COLOR_4 - // GL_MAP1_INDEX - // GL_MAP1_NORMAL - // GL_MAP1_TEXTURE_COORD_1 - // GL_MAP1_TEXTURE_COORD_2 - // GL_MAP1_TEXTURE_COORD_3 - // GL_MAP1_TEXTURE_COORD_4 - // GL_MAP2_VERTEX_3 - // GL_MAP2_VERTEX_4 - // GL_MAP2_COLOR_4 - // GL_MAP2_INDEX - // GL_MAP2_NORMAL - // GL_MAP2_TEXTURE_COORD_1 - // GL_MAP2_TEXTURE_COORD_2 - // GL_MAP2_TEXTURE_COORD_3 - // GL_MAP2_TEXTURE_COORD_4 - // GL_POINT_SMOOTH - // GL_LINE_SMOOTH - // GL_POLYGON_SMOOTH - // GL_SCISSOR_TEST - // GL_COLOR_MATERIAL - // GL_NORMALIZE - // GL_AUTO_NORMAL - // GL_VERTEX_ARRAY - // GL_NORMAL_ARRAY - // GL_COLOR_ARRAY - // GL_INDEX_ARRAY - // GL_TEXTURE_COORD_ARRAY - // GL_EDGE_FLAG_ARRAY - // GL_POLYGON_OFFSET_POINT - // GL_POLYGON_OFFSET_LINE - // GL_POLYGON_OFFSET_FILL - - // ErrorCode - GL_NO_ERROR = 0; - GL_INVALID_ENUM = $0500; - GL_INVALID_VALUE = $0501; - GL_INVALID_OPERATION = $0502; - GL_STACK_OVERFLOW = $0503; - GL_STACK_UNDERFLOW = $0504; - GL_OUT_OF_MEMORY = $0505; - - // FeedBackMode - GL_2D = $0600; - GL_3D = $0601; - GL_3D_COLOR = $0602; - GL_3D_COLOR_TEXTURE = $0603; - GL_4D_COLOR_TEXTURE = $0604; - - // FeedBackToken - GL_PASS_THROUGH_TOKEN = $0700; - GL_POINT_TOKEN = $0701; - GL_LINE_TOKEN = $0702; - GL_POLYGON_TOKEN = $0703; - GL_BITMAP_TOKEN = $0704; - GL_DRAW_PIXEL_TOKEN = $0705; - GL_COPY_PIXEL_TOKEN = $0706; - GL_LINE_RESET_TOKEN = $0707; - - // FogMode - // GL_LINEAR - GL_EXP = $0800; - GL_EXP2 = $0801; - - // FogParameter - // GL_FOG_COLOR - // GL_FOG_DENSITY - // GL_FOG_END - // GL_FOG_INDEX - // GL_FOG_MODE - // GL_FOG_START - - // FrontFaceDirection - GL_CW = $0900; - GL_CCW = $0901; - - // GetMapTarget - GL_COEFF = $0A00; - GL_ORDER = $0A01; - GL_DOMAIN = $0A02; - - // GetPixelMap - // GL_PIXEL_MAP_I_TO_I - // GL_PIXEL_MAP_S_TO_S - // GL_PIXEL_MAP_I_TO_R - // GL_PIXEL_MAP_I_TO_G - // GL_PIXEL_MAP_I_TO_B - // GL_PIXEL_MAP_I_TO_A - // GL_PIXEL_MAP_R_TO_R - // GL_PIXEL_MAP_G_TO_G - // GL_PIXEL_MAP_B_TO_B - // GL_PIXEL_MAP_A_TO_A - - // GetPointerTarget - // GL_VERTEX_ARRAY_POINTER - // GL_NORMAL_ARRAY_POINTER - // GL_COLOR_ARRAY_POINTER - // GL_INDEX_ARRAY_POINTER - // GL_TEXTURE_COORD_ARRAY_POINTER - // GL_EDGE_FLAG_ARRAY_POINTER - - // GetTarget - GL_CURRENT_COLOR = $0B00; - GL_CURRENT_INDEX = $0B01; - GL_CURRENT_NORMAL = $0B02; - GL_CURRENT_TEXTURE_COORDS = $0B03; - GL_CURRENT_RASTER_COLOR = $0B04; - GL_CURRENT_RASTER_INDEX = $0B05; - GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06; - GL_CURRENT_RASTER_POSITION = $0B07; - GL_CURRENT_RASTER_POSITION_VALID = $0B08; - GL_CURRENT_RASTER_DISTANCE = $0B09; - GL_POINT_SMOOTH = $0B10; - GL_POINT_SIZE = $0B11; - GL_POINT_SIZE_RANGE = $0B12; - GL_POINT_SIZE_GRANULARITY = $0B13; - GL_LINE_SMOOTH = $0B20; - GL_LINE_WIDTH = $0B21; - GL_LINE_WIDTH_RANGE = $0B22; - GL_LINE_WIDTH_GRANULARITY = $0B23; - GL_LINE_STIPPLE = $0B24; - GL_LINE_STIPPLE_PATTERN = $0B25; - GL_LINE_STIPPLE_REPEAT = $0B26; - GL_LIST_MODE = $0B30; - GL_MAX_LIST_NESTING = $0B31; - GL_LIST_BASE = $0B32; - GL_LIST_INDEX = $0B33; - GL_POLYGON_MODE = $0B40; - GL_POLYGON_SMOOTH = $0B41; - GL_POLYGON_STIPPLE = $0B42; - GL_EDGE_FLAG = $0B43; - GL_CULL_FACE = $0B44; - GL_CULL_FACE_MODE = $0B45; - GL_FRONT_FACE = $0B46; - GL_LIGHTING = $0B50; - GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51; - GL_LIGHT_MODEL_TWO_SIDE = $0B52; - GL_LIGHT_MODEL_AMBIENT = $0B53; - GL_SHADE_MODEL = $0B54; - GL_COLOR_MATERIAL_FACE = $0B55; - GL_COLOR_MATERIAL_PARAMETER = $0B56; - GL_COLOR_MATERIAL = $0B57; - GL_FOG = $0B60; - GL_FOG_INDEX = $0B61; - GL_FOG_DENSITY = $0B62; - GL_FOG_START = $0B63; - GL_FOG_END = $0B64; - GL_FOG_MODE = $0B65; - GL_FOG_COLOR = $0B66; - GL_DEPTH_RANGE = $0B70; - GL_DEPTH_TEST = $0B71; - GL_DEPTH_WRITEMASK = $0B72; - GL_DEPTH_CLEAR_VALUE = $0B73; - GL_DEPTH_FUNC = $0B74; - GL_ACCUM_CLEAR_VALUE = $0B80; - GL_STENCIL_TEST = $0B90; - GL_STENCIL_CLEAR_VALUE = $0B91; - GL_STENCIL_FUNC = $0B92; - GL_STENCIL_VALUE_MASK = $0B93; - GL_STENCIL_FAIL = $0B94; - GL_STENCIL_PASS_DEPTH_FAIL = $0B95; - GL_STENCIL_PASS_DEPTH_PASS = $0B96; - GL_STENCIL_REF = $0B97; - GL_STENCIL_WRITEMASK = $0B98; - GL_MATRIX_MODE = $0BA0; - GL_NORMALIZE = $0BA1; - GL_VIEWPORT = $0BA2; - GL_MODELVIEW_STACK_DEPTH = $0BA3; - GL_PROJECTION_STACK_DEPTH = $0BA4; - GL_TEXTURE_STACK_DEPTH = $0BA5; - GL_MODELVIEW_MATRIX = $0BA6; - GL_PROJECTION_MATRIX = $0BA7; - GL_TEXTURE_MATRIX = $0BA8; - GL_ATTRIB_STACK_DEPTH = $0BB0; - GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1; - GL_ALPHA_TEST = $0BC0; - GL_ALPHA_TEST_FUNC = $0BC1; - GL_ALPHA_TEST_REF = $0BC2; - GL_DITHER = $0BD0; - GL_BLEND_DST = $0BE0; - GL_BLEND_SRC = $0BE1; - GL_BLEND = $0BE2; - GL_LOGIC_OP_MODE = $0BF0; - GL_INDEX_LOGIC_OP = $0BF1; - GL_COLOR_LOGIC_OP = $0BF2; - GL_AUX_BUFFERS = $0C00; - GL_DRAW_BUFFER = $0C01; - GL_READ_BUFFER = $0C02; - GL_SCISSOR_BOX = $0C10; - GL_SCISSOR_TEST = $0C11; - GL_INDEX_CLEAR_VALUE = $0C20; - GL_INDEX_WRITEMASK = $0C21; - GL_COLOR_CLEAR_VALUE = $0C22; - GL_COLOR_WRITEMASK = $0C23; - GL_INDEX_MODE = $0C30; - GL_RGBA_MODE = $0C31; - GL_DOUBLEBUFFER = $0C32; - GL_STEREO = $0C33; - GL_RENDER_MODE = $0C40; - GL_PERSPECTIVE_CORRECTION_HINT = $0C50; - GL_POINT_SMOOTH_HINT = $0C51; - GL_LINE_SMOOTH_HINT = $0C52; - GL_POLYGON_SMOOTH_HINT = $0C53; - GL_FOG_HINT = $0C54; - GL_TEXTURE_GEN_S = $0C60; - GL_TEXTURE_GEN_T = $0C61; - GL_TEXTURE_GEN_R = $0C62; - GL_TEXTURE_GEN_Q = $0C63; - GL_PIXEL_MAP_I_TO_I = $0C70; - GL_PIXEL_MAP_S_TO_S = $0C71; - GL_PIXEL_MAP_I_TO_R = $0C72; - GL_PIXEL_MAP_I_TO_G = $0C73; - GL_PIXEL_MAP_I_TO_B = $0C74; - GL_PIXEL_MAP_I_TO_A = $0C75; - GL_PIXEL_MAP_R_TO_R = $0C76; - GL_PIXEL_MAP_G_TO_G = $0C77; - GL_PIXEL_MAP_B_TO_B = $0C78; - GL_PIXEL_MAP_A_TO_A = $0C79; - GL_PIXEL_MAP_I_TO_I_SIZE = $0CB0; - GL_PIXEL_MAP_S_TO_S_SIZE = $0CB1; - GL_PIXEL_MAP_I_TO_R_SIZE = $0CB2; - GL_PIXEL_MAP_I_TO_G_SIZE = $0CB3; - GL_PIXEL_MAP_I_TO_B_SIZE = $0CB4; - GL_PIXEL_MAP_I_TO_A_SIZE = $0CB5; - GL_PIXEL_MAP_R_TO_R_SIZE = $0CB6; - GL_PIXEL_MAP_G_TO_G_SIZE = $0CB7; - GL_PIXEL_MAP_B_TO_B_SIZE = $0CB8; - GL_PIXEL_MAP_A_TO_A_SIZE = $0CB9; - GL_UNPACK_SWAP_BYTES = $0CF0; - GL_UNPACK_LSB_FIRST = $0CF1; - GL_UNPACK_ROW_LENGTH = $0CF2; - GL_UNPACK_SKIP_ROWS = $0CF3; - GL_UNPACK_SKIP_PIXELS = $0CF4; - GL_UNPACK_ALIGNMENT = $0CF5; - GL_PACK_SWAP_BYTES = $0D00; - GL_PACK_LSB_FIRST = $0D01; - GL_PACK_ROW_LENGTH = $0D02; - GL_PACK_SKIP_ROWS = $0D03; - GL_PACK_SKIP_PIXELS = $0D04; - GL_PACK_ALIGNMENT = $0D05; - GL_MAP_COLOR = $0D10; - GL_MAP_STENCIL = $0D11; - GL_INDEX_SHIFT = $0D12; - GL_INDEX_OFFSET = $0D13; - GL_RED_SCALE = $0D14; - GL_RED_BIAS = $0D15; - GL_ZOOM_X = $0D16; - GL_ZOOM_Y = $0D17; - GL_GREEN_SCALE = $0D18; - GL_GREEN_BIAS = $0D19; - GL_BLUE_SCALE = $0D1A; - GL_BLUE_BIAS = $0D1B; - GL_ALPHA_SCALE = $0D1C; - GL_ALPHA_BIAS = $0D1D; - GL_DEPTH_SCALE = $0D1E; - GL_DEPTH_BIAS = $0D1F; - GL_MAX_EVAL_ORDER = $0D30; - GL_MAX_LIGHTS = $0D31; - GL_MAX_CLIP_PLANES = $0D32; - GL_MAX_TEXTURE_SIZE = $0D33; - GL_MAX_PIXEL_MAP_TABLE = $0D34; - GL_MAX_ATTRIB_STACK_DEPTH = $0D35; - GL_MAX_MODELVIEW_STACK_DEPTH = $0D36; - GL_MAX_NAME_STACK_DEPTH = $0D37; - GL_MAX_PROJECTION_STACK_DEPTH = $0D38; - GL_MAX_TEXTURE_STACK_DEPTH = $0D39; - GL_MAX_VIEWPORT_DIMS = $0D3A; - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = $0D3B; - GL_SUBPIXEL_BITS = $0D50; - GL_INDEX_BITS = $0D51; - GL_RED_BITS = $0D52; - GL_GREEN_BITS = $0D53; - GL_BLUE_BITS = $0D54; - GL_ALPHA_BITS = $0D55; - GL_DEPTH_BITS = $0D56; - GL_STENCIL_BITS = $0D57; - GL_ACCUM_RED_BITS = $0D58; - GL_ACCUM_GREEN_BITS = $0D59; - GL_ACCUM_BLUE_BITS = $0D5A; - GL_ACCUM_ALPHA_BITS = $0D5B; - GL_NAME_STACK_DEPTH = $0D70; - GL_AUTO_NORMAL = $0D80; - GL_MAP1_COLOR_4 = $0D90; - GL_MAP1_INDEX = $0D91; - GL_MAP1_NORMAL = $0D92; - GL_MAP1_TEXTURE_COORD_1 = $0D93; - GL_MAP1_TEXTURE_COORD_2 = $0D94; - GL_MAP1_TEXTURE_COORD_3 = $0D95; - GL_MAP1_TEXTURE_COORD_4 = $0D96; - GL_MAP1_VERTEX_3 = $0D97; - GL_MAP1_VERTEX_4 = $0D98; - GL_MAP2_COLOR_4 = $0DB0; - GL_MAP2_INDEX = $0DB1; - GL_MAP2_NORMAL = $0DB2; - GL_MAP2_TEXTURE_COORD_1 = $0DB3; - GL_MAP2_TEXTURE_COORD_2 = $0DB4; - GL_MAP2_TEXTURE_COORD_3 = $0DB5; - GL_MAP2_TEXTURE_COORD_4 = $0DB6; - GL_MAP2_VERTEX_3 = $0DB7; - GL_MAP2_VERTEX_4 = $0DB8; - GL_MAP1_GRID_DOMAIN = $0DD0; - GL_MAP1_GRID_SEGMENTS = $0DD1; - GL_MAP2_GRID_DOMAIN = $0DD2; - GL_MAP2_GRID_SEGMENTS = $0DD3; - GL_TEXTURE_1D = $0DE0; - GL_TEXTURE_2D = $0DE1; - GL_FEEDBACK_BUFFER_POINTER = $0DF0; - GL_FEEDBACK_BUFFER_SIZE = $0DF1; - GL_FEEDBACK_BUFFER_TYPE = $0DF2; - GL_SELECTION_BUFFER_POINTER = $0DF3; - GL_SELECTION_BUFFER_SIZE = $0DF4; - // GL_TEXTURE_BINDING_1D - // GL_TEXTURE_BINDING_2D - // GL_VERTEX_ARRAY - // GL_NORMAL_ARRAY - // GL_COLOR_ARRAY - // GL_INDEX_ARRAY - // GL_TEXTURE_COORD_ARRAY - // GL_EDGE_FLAG_ARRAY - // GL_VERTEX_ARRAY_SIZE - // GL_VERTEX_ARRAY_TYPE - // GL_VERTEX_ARRAY_STRIDE - // GL_NORMAL_ARRAY_TYPE - // GL_NORMAL_ARRAY_STRIDE - // GL_COLOR_ARRAY_SIZE - // GL_COLOR_ARRAY_TYPE - // GL_COLOR_ARRAY_STRIDE - // GL_INDEX_ARRAY_TYPE - // GL_INDEX_ARRAY_STRIDE - // GL_TEXTURE_COORD_ARRAY_SIZE - // GL_TEXTURE_COORD_ARRAY_TYPE - // GL_TEXTURE_COORD_ARRAY_STRIDE - // GL_EDGE_FLAG_ARRAY_STRIDE - // GL_POLYGON_OFFSET_FACTOR - // GL_POLYGON_OFFSET_UNITS - - // GetTextureParameter - // GL_TEXTURE_MAG_FILTER - // GL_TEXTURE_MIN_FILTER - // GL_TEXTURE_WRAP_S - // GL_TEXTURE_WRAP_T - GL_TEXTURE_WIDTH = $1000; - GL_TEXTURE_HEIGHT = $1001; - GL_TEXTURE_INTERNAL_FORMAT = $1003; - GL_TEXTURE_BORDER_COLOR = $1004; - GL_TEXTURE_BORDER = $1005; - // GL_TEXTURE_RED_SIZE - // GL_TEXTURE_GREEN_SIZE - // GL_TEXTURE_BLUE_SIZE - // GL_TEXTURE_ALPHA_SIZE - // GL_TEXTURE_LUMINANCE_SIZE - // GL_TEXTURE_INTENSITY_SIZE - // GL_TEXTURE_PRIORITY - // GL_TEXTURE_RESIDENT - - // HintMode - GL_DONT_CARE = $1100; - GL_FASTEST = $1101; - GL_NICEST = $1102; - - // HintTarget - // GL_PERSPECTIVE_CORRECTION_HINT - // GL_POINT_SMOOTH_HINT - // GL_LINE_SMOOTH_HINT - // GL_POLYGON_SMOOTH_HINT - // GL_FOG_HINT - - // IndexPointerType - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // LightModelParameter - // GL_LIGHT_MODEL_AMBIENT - // GL_LIGHT_MODEL_LOCAL_VIEWER - // GL_LIGHT_MODEL_TWO_SIDE - - // LightName - GL_LIGHT0 = $4000; - GL_LIGHT1 = $4001; - GL_LIGHT2 = $4002; - GL_LIGHT3 = $4003; - GL_LIGHT4 = $4004; - GL_LIGHT5 = $4005; - GL_LIGHT6 = $4006; - GL_LIGHT7 = $4007; - - // LightParameter - GL_AMBIENT = $1200; - GL_DIFFUSE = $1201; - GL_SPECULAR = $1202; - GL_POSITION = $1203; - GL_SPOT_DIRECTION = $1204; - GL_SPOT_EXPONENT = $1205; - GL_SPOT_CUTOFF = $1206; - GL_CONSTANT_ATTENUATION = $1207; - GL_LINEAR_ATTENUATION = $1208; - GL_QUADRATIC_ATTENUATION = $1209; - - // InterleavedArrays - // GL_V2F - // GL_V3F - // GL_C4UB_V2F - // GL_C4UB_V3F - // GL_C3F_V3F - // GL_N3F_V3F - // GL_C4F_N3F_V3F - // GL_T2F_V3F - // GL_T4F_V4F - // GL_T2F_C4UB_V3F - // GL_T2F_C3F_V3F - // GL_T2F_N3F_V3F - // GL_T2F_C4F_N3F_V3F - // GL_T4F_C4F_N3F_V4F - - // ListMode - GL_COMPILE = $1300; - GL_COMPILE_AND_EXECUTE = $1301; - - // ListNameType - // GL_BYTE - // GL_UNSIGNED_BYTE - // GL_SHORT - // GL_UNSIGNED_SHORT - // GL_INT - // GL_UNSIGNED_INT - // GL_FLOAT - // GL_2_BYTES - // GL_3_BYTES - // GL_4_BYTES - - // LogicOp - GL_CLEAR = $1500; - GL_AND = $1501; - GL_AND_REVERSE = $1502; - GL_COPY = $1503; - GL_AND_INVERTED = $1504; - GL_NOOP = $1505; - GL_XOR = $1506; - GL_OR = $1507; - GL_NOR = $1508; - GL_EQUIV = $1509; - GL_INVERT = $150A; - GL_OR_REVERSE = $150B; - GL_COPY_INVERTED = $150C; - GL_OR_INVERTED = $150D; - GL_NAND = $150E; - GL_SET = $150F; - - // MapTarget - // GL_MAP1_COLOR_4 - // GL_MAP1_INDEX - // GL_MAP1_NORMAL - // GL_MAP1_TEXTURE_COORD_1 - // GL_MAP1_TEXTURE_COORD_2 - // GL_MAP1_TEXTURE_COORD_3 - // GL_MAP1_TEXTURE_COORD_4 - // GL_MAP1_VERTEX_3 - // GL_MAP1_VERTEX_4 - // GL_MAP2_COLOR_4 - // GL_MAP2_INDEX - // GL_MAP2_NORMAL - // GL_MAP2_TEXTURE_COORD_1 - // GL_MAP2_TEXTURE_COORD_2 - // GL_MAP2_TEXTURE_COORD_3 - // GL_MAP2_TEXTURE_COORD_4 - // GL_MAP2_VERTEX_3 - // GL_MAP2_VERTEX_4 - - // MaterialFace - // GL_FRONT - // GL_BACK - // GL_FRONT_AND_BACK - - // MaterialParameter - GL_EMISSION = $1600; - GL_SHININESS = $1601; - GL_AMBIENT_AND_DIFFUSE = $1602; - GL_COLOR_INDEXES = $1603; - // GL_AMBIENT - // GL_DIFFUSE - // GL_SPECULAR - - // MatrixMode - GL_MODELVIEW = $1700; - GL_PROJECTION = $1701; - GL_TEXTURE = $1702; - - // MeshMode1 - // GL_POINT - // GL_LINE - - // MeshMode2 - // GL_POINT - // GL_LINE - // GL_FILL - - // NormalPointerType - // GL_BYTE - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // PixelCopyType - GL_COLOR = $1800; - GL_DEPTH = $1801; - GL_STENCIL = $1802; - - // PixelFormat - GL_COLOR_INDEX = $1900; - GL_STENCIL_INDEX = $1901; - GL_DEPTH_COMPONENT = $1902; - GL_RED = $1903; - GL_GREEN = $1904; - GL_BLUE = $1905; - GL_ALPHA = $1906; - GL_RGB = $1907; - GL_RGBA = $1908; - GL_LUMINANCE = $1909; - GL_LUMINANCE_ALPHA = $190A; - - // PixelMap - // GL_PIXEL_MAP_I_TO_I - // GL_PIXEL_MAP_S_TO_S - // GL_PIXEL_MAP_I_TO_R - // GL_PIXEL_MAP_I_TO_G - // GL_PIXEL_MAP_I_TO_B - // GL_PIXEL_MAP_I_TO_A - // GL_PIXEL_MAP_R_TO_R - // GL_PIXEL_MAP_G_TO_G - // GL_PIXEL_MAP_B_TO_B - // GL_PIXEL_MAP_A_TO_A - - // PixelStore - // GL_UNPACK_SWAP_BYTES - // GL_UNPACK_LSB_FIRST - // GL_UNPACK_ROW_LENGTH - // GL_UNPACK_SKIP_ROWS - // GL_UNPACK_SKIP_PIXELS - // GL_UNPACK_ALIGNMENT - // GL_PACK_SWAP_BYTES - // GL_PACK_LSB_FIRST - // GL_PACK_ROW_LENGTH - // GL_PACK_SKIP_ROWS - // GL_PACK_SKIP_PIXELS - // GL_PACK_ALIGNMENT - - // PixelTransfer - // GL_MAP_COLOR - // GL_MAP_STENCIL - // GL_INDEX_SHIFT - // GL_INDEX_OFFSET - // GL_RED_SCALE - // GL_RED_BIAS - // GL_GREEN_SCALE - // GL_GREEN_BIAS - // GL_BLUE_SCALE - // GL_BLUE_BIAS - // GL_ALPHA_SCALE - // GL_ALPHA_BIAS - // GL_DEPTH_SCALE - // GL_DEPTH_BIAS - - // PixelType - GL_BITMAP = $1A00; - // GL_BYTE - // GL_UNSIGNED_BYTE - // GL_SHORT - // GL_UNSIGNED_SHORT - // GL_INT - // GL_UNSIGNED_INT - // GL_FLOAT - - // PolygonMode - GL_POINT = $1B00; - GL_LINE = $1B01; - GL_FILL = $1B02; - - // ReadBufferMode - // GL_FRONT_LEFT - // GL_FRONT_RIGHT - // GL_BACK_LEFT - // GL_BACK_RIGHT - // GL_FRONT - // GL_BACK - // GL_LEFT - // GL_RIGHT - // GL_AUX0 - // GL_AUX1 - // GL_AUX2 - // GL_AUX3 - - // RenderingMode - GL_RENDER = $1C00; - GL_FEEDBACK = $1C01; - GL_SELECT = $1C02; - - // ShadingModel - GL_FLAT = $1D00; - GL_SMOOTH = $1D01; - - // StencilFunction - // GL_NEVER - // GL_LESS - // GL_EQUAL - // GL_LEQUAL - // GL_GREATER - // GL_NOTEQUAL - // GL_GEQUAL - // GL_ALWAYS - - // StencilOp - // GL_ZERO - GL_KEEP = $1E00; - GL_REPLACE = $1E01; - GL_INCR = $1E02; - GL_DECR = $1E03; - // GL_INVERT - - // StringName - GL_VENDOR = $1F00; - GL_RENDERER = $1F01; - GL_VERSION = $1F02; - GL_EXTENSIONS = $1F03; - - // TextureCoordName - GL_S = $2000; - GL_T = $2001; - GL_R = $2002; - GL_Q = $2003; - - // TexCoordPointerType - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // TextureEnvMode - GL_MODULATE = $2100; - GL_DECAL = $2101; - // GL_BLEND - // GL_REPLACE - - // TextureEnvParameter - GL_TEXTURE_ENV_MODE = $2200; - GL_TEXTURE_ENV_COLOR = $2201; - - // TextureEnvTarget - GL_TEXTURE_ENV = $2300; - - // TextureGenMode - GL_EYE_LINEAR = $2400; - GL_OBJECT_LINEAR = $2401; - GL_SPHERE_MAP = $2402; - - // TextureGenParameter - GL_TEXTURE_GEN_MODE = $2500; - GL_OBJECT_PLANE = $2501; - GL_EYE_PLANE = $2502; - - // TextureMagFilter - GL_NEAREST = $2600; - GL_LINEAR = $2601; - - // TextureMinFilter - // GL_NEAREST - // GL_LINEAR - GL_NEAREST_MIPMAP_NEAREST = $2700; - GL_LINEAR_MIPMAP_NEAREST = $2701; - GL_NEAREST_MIPMAP_LINEAR = $2702; - GL_LINEAR_MIPMAP_LINEAR = $2703; - - // TextureParameterName - GL_TEXTURE_MAG_FILTER = $2800; - GL_TEXTURE_MIN_FILTER = $2801; - GL_TEXTURE_WRAP_S = $2802; - GL_TEXTURE_WRAP_T = $2803; - // GL_TEXTURE_BORDER_COLOR - // GL_TEXTURE_PRIORITY - - // TextureTarget - // GL_TEXTURE_1D - // GL_TEXTURE_2D - // GL_PROXY_TEXTURE_1D - // GL_PROXY_TEXTURE_2D - - // TextureWrapMode - GL_CLAMP = $2900; - GL_REPEAT = $2901; - - // VertexPointerType - // GL_SHORT - // GL_INT - // GL_FLOAT - // GL_DOUBLE - - // ClientAttribMask - GL_CLIENT_PIXEL_STORE_BIT = $00000001; - GL_CLIENT_VERTEX_ARRAY_BIT = $00000002; - GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF; - - // polygon_offset - GL_POLYGON_OFFSET_FACTOR = $8038; - GL_POLYGON_OFFSET_UNITS = $2A00; - GL_POLYGON_OFFSET_POINT = $2A01; - GL_POLYGON_OFFSET_LINE = $2A02; - GL_POLYGON_OFFSET_FILL = $8037; - - // texture - GL_ALPHA4 = $803B; - GL_ALPHA8 = $803C; - GL_ALPHA12 = $803D; - GL_ALPHA16 = $803E; - GL_LUMINANCE4 = $803F; - GL_LUMINANCE8 = $8040; - GL_LUMINANCE12 = $8041; - GL_LUMINANCE16 = $8042; - GL_LUMINANCE4_ALPHA4 = $8043; - GL_LUMINANCE6_ALPHA2 = $8044; - GL_LUMINANCE8_ALPHA8 = $8045; - GL_LUMINANCE12_ALPHA4 = $8046; - GL_LUMINANCE12_ALPHA12 = $8047; - GL_LUMINANCE16_ALPHA16 = $8048; - GL_INTENSITY = $8049; - GL_INTENSITY4 = $804A; - GL_INTENSITY8 = $804B; - GL_INTENSITY12 = $804C; - GL_INTENSITY16 = $804D; - GL_R3_G3_B2 = $2A10; - GL_RGB4 = $804F; - GL_RGB5 = $8050; - GL_RGB8 = $8051; - GL_RGB10 = $8052; - GL_RGB12 = $8053; - GL_RGB16 = $8054; - GL_RGBA2 = $8055; - GL_RGBA4 = $8056; - GL_RGB5_A1 = $8057; - GL_RGBA8 = $8058; - GL_RGB10_A2 = $8059; - GL_RGBA12 = $805A; - GL_RGBA16 = $805B; - GL_TEXTURE_RED_SIZE = $805C; - GL_TEXTURE_GREEN_SIZE = $805D; - GL_TEXTURE_BLUE_SIZE = $805E; - GL_TEXTURE_ALPHA_SIZE = $805F; - GL_TEXTURE_LUMINANCE_SIZE = $8060; - GL_TEXTURE_INTENSITY_SIZE = $8061; - GL_PROXY_TEXTURE_1D = $8063; - GL_PROXY_TEXTURE_2D = $8064; - - // texture_object - GL_TEXTURE_PRIORITY = $8066; - GL_TEXTURE_RESIDENT = $8067; - GL_TEXTURE_BINDING_1D = $8068; - GL_TEXTURE_BINDING_2D = $8069; - - // vertex_array - GL_VERTEX_ARRAY = $8074; - GL_NORMAL_ARRAY = $8075; - GL_COLOR_ARRAY = $8076; - GL_INDEX_ARRAY = $8077; - GL_TEXTURE_COORD_ARRAY = $8078; - GL_EDGE_FLAG_ARRAY = $8079; - GL_VERTEX_ARRAY_SIZE = $807A; - GL_VERTEX_ARRAY_TYPE = $807B; - GL_VERTEX_ARRAY_STRIDE = $807C; - GL_NORMAL_ARRAY_TYPE = $807E; - GL_NORMAL_ARRAY_STRIDE = $807F; - GL_COLOR_ARRAY_SIZE = $8081; - GL_COLOR_ARRAY_TYPE = $8082; - GL_COLOR_ARRAY_STRIDE = $8083; - GL_INDEX_ARRAY_TYPE = $8085; - GL_INDEX_ARRAY_STRIDE = $8086; - GL_TEXTURE_COORD_ARRAY_SIZE = $8088; - GL_TEXTURE_COORD_ARRAY_TYPE = $8089; - GL_TEXTURE_COORD_ARRAY_STRIDE = $808A; - GL_EDGE_FLAG_ARRAY_STRIDE = $808C; - GL_VERTEX_ARRAY_POINTER = $808E; - GL_NORMAL_ARRAY_POINTER = $808F; - GL_COLOR_ARRAY_POINTER = $8090; - GL_INDEX_ARRAY_POINTER = $8091; - GL_TEXTURE_COORD_ARRAY_POINTER = $8092; - GL_EDGE_FLAG_ARRAY_POINTER = $8093; - GL_V2F = $2A20; - GL_V3F = $2A21; - GL_C4UB_V2F = $2A22; - GL_C4UB_V3F = $2A23; - GL_C3F_V3F = $2A24; - GL_N3F_V3F = $2A25; - GL_C4F_N3F_V3F = $2A26; - GL_T2F_V3F = $2A27; - GL_T4F_V4F = $2A28; - GL_T2F_C4UB_V3F = $2A29; - GL_T2F_C3F_V3F = $2A2A; - GL_T2F_N3F_V3F = $2A2B; - GL_T2F_C4F_N3F_V3F = $2A2C; - GL_T4F_C4F_N3F_V4F = $2A2D; - - // Extensions - GL_EXT_vertex_array = 1; - GL_WIN_swap_hint = 1; - GL_EXT_bgra = 1; - GL_EXT_paletted_texture = 1; - - // EXT_vertex_array - GL_VERTEX_ARRAY_EXT = $8074; - GL_NORMAL_ARRAY_EXT = $8075; - GL_COLOR_ARRAY_EXT = $8076; - GL_INDEX_ARRAY_EXT = $8077; - GL_TEXTURE_COORD_ARRAY_EXT = $8078; - GL_EDGE_FLAG_ARRAY_EXT = $8079; - GL_VERTEX_ARRAY_SIZE_EXT = $807A; - GL_VERTEX_ARRAY_TYPE_EXT = $807B; - GL_VERTEX_ARRAY_STRIDE_EXT = $807C; - GL_VERTEX_ARRAY_COUNT_EXT = $807D; - GL_NORMAL_ARRAY_TYPE_EXT = $807E; - GL_NORMAL_ARRAY_STRIDE_EXT = $807F; - GL_NORMAL_ARRAY_COUNT_EXT = $8080; - GL_COLOR_ARRAY_SIZE_EXT = $8081; - GL_COLOR_ARRAY_TYPE_EXT = $8082; - GL_COLOR_ARRAY_STRIDE_EXT = $8083; - GL_COLOR_ARRAY_COUNT_EXT = $8084; - GL_INDEX_ARRAY_TYPE_EXT = $8085; - GL_INDEX_ARRAY_STRIDE_EXT = $8086; - GL_INDEX_ARRAY_COUNT_EXT = $8087; - GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; - GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; - GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; - GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; - GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; - GL_VERTEX_ARRAY_POINTER_EXT = $808E; - GL_NORMAL_ARRAY_POINTER_EXT = $808F; - GL_COLOR_ARRAY_POINTER_EXT = $8090; - GL_INDEX_ARRAY_POINTER_EXT = $8091; - GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; - GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; - GL_DOUBLE_EXT = GL_DOUBLE; - - // EXT_bgra - GL_BGR_EXT = $80E0; - GL_BGRA_EXT = $80E1; - - // EXT_paletted_texture - - // These must match the GL_COLOR_TABLE_*_SGI enumerants - GL_COLOR_TABLE_FORMAT_EXT = $80D8; - GL_COLOR_TABLE_WIDTH_EXT = $80D9; - GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; - GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; - GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; - - GL_COLOR_INDEX1_EXT = $80E2; - GL_COLOR_INDEX2_EXT = $80E3; - GL_COLOR_INDEX4_EXT = $80E4; - GL_COLOR_INDEX8_EXT = $80E5; - GL_COLOR_INDEX12_EXT = $80E6; - GL_COLOR_INDEX16_EXT = $80E7; - - // For compatibility with OpenGL v1.0 - GL_LOGIC_OP = GL_INDEX_LOGIC_OP; - GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT; - -{******************************************************************************} - -procedure glAccum(op: GLenum; value: GLfloat); external dllname; -procedure glAlphaFunc(func: GLenum; ref: GLclampf); external dllname; -function glAreTexturesResident (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; external dllname; -procedure glArrayElement(i: GLint); external dllname; -procedure glBegin(mode: GLenum); external dllname; -procedure glBindTexture(target: GLenum; texture: GLuint); external dllname; -procedure glBitmap (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); external dllname; -procedure glBlendFunc(sfactor, dfactor: GLenum); external dllname; -procedure glCallList(list: GLuint); external dllname; -procedure glCallLists(n: GLsizei; atype: GLenum; const lists: Pointer); external dllname; -procedure glClear(mask: GLbitfield); external dllname; -procedure glClearAccum(red, green, blue, alpha: GLfloat); external dllname; -procedure glClearColor(red, green, blue, alpha: GLclampf); external dllname; -procedure glClearDepth(depth: GLclampd); external dllname; -procedure glClearIndex(c: GLfloat); external dllname; -procedure glClearStencil(s: GLint); external dllname; -procedure glClipPlane(plane: GLenum; const equation: PGLdouble); external dllname; -procedure glColor3b(red, green, blue: GLbyte); external dllname; -procedure glColor3bv(const v: PGLbyte); external dllname; -procedure glColor3d(red, green, blue: GLdouble); external dllname; -procedure glColor3dv(const v: PGLdouble); external dllname; -procedure glColor3f(red, green, blue: GLfloat); external dllname; -procedure glColor3fv(const v: PGLfloat); external dllname; -procedure glColor3i(red, green, blue: GLint); external dllname; -procedure glColor3iv(const v: PGLint); external dllname; -procedure glColor3s(red, green, blue: GLshort); external dllname; -procedure glColor3sv(const v: PGLshort); external dllname; -procedure glColor3ub(red, green, blue: GLubyte); external dllname; -procedure glColor3ubv(const v: PGLubyte); external dllname; -procedure glColor3ui(red, green, blue: GLuint); external dllname; -procedure glColor3uiv(const v: PGLuint); external dllname; -procedure glColor3us(red, green, blue: GLushort); external dllname; -procedure glColor3usv(const v: PGLushort); external dllname; -procedure glColor4b(red, green, blue, alpha: GLbyte); external dllname; -procedure glColor4bv(const v: PGLbyte); external dllname; -procedure glColor4d(red, green, blue, alpha: GLdouble); external dllname; -procedure glColor4dv(const v: PGLdouble); external dllname; -procedure glColor4f(red, green, blue, alpha: GLfloat); external dllname; -procedure glColor4fv(const v: PGLfloat); external dllname; -procedure glColor4i(red, green, blue, alpha: GLint); external dllname; -procedure glColor4iv(const v: PGLint); external dllname; -procedure glColor4s(red, green, blue, alpha: GLshort); external dllname; -procedure glColor4sv(const v: PGLshort); external dllname; -procedure glColor4ub(red, green, blue, alpha: GLubyte); external dllname; -procedure glColor4ubv(const v: PGLubyte); external dllname; -procedure glColor4ui(red, green, blue, alpha: GLuint); external dllname; -procedure glColor4uiv(const v: PGLuint); external dllname; -procedure glColor4us(red, green, blue, alpha: GLushort); external dllname; -procedure glColor4usv(const v: PGLushort); external dllname; -procedure glColorMask(red, green, blue, alpha: GLboolean); external dllname; -procedure glColorMaterial(face, mode: GLenum); external dllname; -procedure glColorPointer(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); external dllname; -procedure glCopyPixels(x, y: GLint; width, height: GLsizei; atype: GLenum); external dllname; -procedure glCopyTexImage1D (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); external dllname; -procedure glCopyTexImage2D(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); external dllname; -procedure glCopyTexSubImage1D(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); external dllname; -procedure glCopyTexSubImage2D(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); external dllname; -procedure glCullFace(mode: GLenum); external dllname; -procedure glDeleteLists(list: GLuint; range: GLsizei); external dllname; -procedure glDeleteTextures(n: GLsizei; const textures: PGLuint); external dllname; -procedure glDepthFunc(func: GLenum); external dllname; -procedure glDepthMask(flag: GLboolean); external dllname; -procedure glDepthRange(zNear, zFar: GLclampd); external dllname; -procedure glDisable(cap: GLenum); external dllname; -procedure glDisableClientState(aarray: GLenum); external dllname; -procedure glDrawArrays(mode: GLenum; first: GLint; count: GLsizei); external dllname; -procedure glDrawBuffer(mode: GLenum); external dllname; -procedure glDrawElements(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); external dllname; -procedure glDrawPixels(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); external dllname; -procedure glEdgeFlag(flag: GLboolean); external dllname; -procedure glEdgeFlagPointer(stride: GLsizei; const pointer: Pointer); external dllname; -procedure glEdgeFlagv(const flag: PGLboolean); external dllname; -procedure glEnable(cap: GLenum); external dllname; -procedure glEnableClientState(aarray: GLenum); external dllname; -procedure glEnd; external dllname; -procedure glEndList; external dllname; -procedure glEvalCoord1d(u: GLdouble); external dllname; -procedure glEvalCoord1dv(const u: PGLdouble); external dllname; -procedure glEvalCoord1f(u: GLfloat); external dllname; -procedure glEvalCoord1fv(const u: PGLfloat); external dllname; -procedure glEvalCoord2d(u, v: GLdouble); external dllname; -procedure glEvalCoord2dv(const u: PGLdouble); external dllname; -procedure glEvalCoord2f(u, v: GLfloat); external dllname; -procedure glEvalCoord2fv(const u: PGLfloat); external dllname; -procedure glEvalMesh1(mode: GLenum; i1, i2: GLint); external dllname; -procedure glEvalMesh2(mode: GLenum; i1, i2, j1, j2: GLint); external dllname; -procedure glEvalPoint1(i: GLint); external dllname; -procedure glEvalPoint2(i, j: GLint); external dllname; -procedure glFeedbackBuffer(size: GLsizei; atype: GLenum; buffer: PGLfloat); external dllname; -procedure glFinish; external dllname; -procedure glFlush; external dllname; -procedure glFogf(pname: GLenum; param: GLfloat); external dllname; -procedure glFogfv(pname: GLenum; const params: PGLfloat); external dllname; -procedure glFogi(pname: GLenum; param: GLint); external dllname; -procedure glFogiv(pname: GLenum; const params: PGLint); external dllname; -procedure glFrontFace(mode: GLenum); external dllname; -procedure glFrustum(left, right, bottom, top, zNear, zFar: GLdouble); external dllname; -function glGenLists(range: GLsizei): GLuint; external dllname; -procedure glGenTextures(n: GLsizei; textures: PGLuint); external dllname; -procedure glGetBooleanv(pname: GLenum; params: PGLboolean); external dllname; -procedure glGetClipPlane(plane: GLenum; equation: PGLdouble); external dllname; -procedure glGetDoublev(pname: GLenum; params: PGLdouble); external dllname; -function glGetError: GLenum; external dllname; -procedure glGetFloatv(pname: GLenum; params: PGLfloat); external dllname; -procedure glGetIntegerv(pname: GLenum; params: PGLint); external dllname; -procedure glGetLightfv(light, pname: GLenum; params: PGLfloat); external dllname; -procedure glGetLightiv(light, pname: GLenum; params: PGLint); external dllname; -procedure glGetMapdv(target, query: GLenum; v: PGLdouble); external dllname; -procedure glGetMapfv(target, query: GLenum; v: PGLfloat); external dllname; -procedure glGetMapiv(target, query: GLenum; v: PGLint); external dllname; -procedure glGetMaterialfv(face, pname: GLenum; params: PGLfloat); external dllname; -procedure glGetMaterialiv(face, pname: GLenum; params: PGLint); external dllname; -procedure glGetPixelMapfv(map: GLenum; values: PGLfloat); external dllname; -procedure glGetPixelMapuiv(map: GLenum; values: PGLuint); external dllname; -procedure glGetPixelMapusv(map: GLenum; values: PGLushort); external dllname; -procedure glGetPointerv(pname: GLenum; params: Pointer); external dllname; -procedure glGetPolygonStipple(mask: PGLubyte); external dllname; -function glGetString(name: GLenum): PChar; external dllname; -procedure glGetTexEnvfv(target, pname: GLenum; params: PGLfloat); external dllname; -procedure glGetTexEnviv(target, pname: GLenum; params: PGLint); external dllname; -procedure glGetTexGendv(coord, pname: GLenum; params: PGLdouble); external dllname; -procedure glGetTexGenfv(coord, pname: GLenum; params: PGLfloat); external dllname; -procedure glGetTexGeniv(coord, pname: GLenum; params: PGLint); external dllname; -procedure glGetTexImage(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); external dllname; -procedure glGetTexLevelParameterfv(target: GLenum; level: GLint; pname: GLenum; params: Pointer); external dllname; -procedure glGetTexLevelParameteriv(target: GLenum; level: GLint; pname: GLenum; params: PGLint); external dllname; -procedure glGetTexParameterfv(target, pname: GLenum; params: PGLfloat); external dllname; -procedure glGetTexParameteriv(target, pname: GLenum; params: PGLint); external dllname; -procedure glHint(target, mode: GLenum); external dllname; -procedure glIndexMask(mask: GLuint); external dllname; -procedure glIndexPointer(atype: GLenum; stride: GLsizei; const pointer: Pointer); external dllname; -procedure glIndexd(c: GLdouble); external dllname; -procedure glIndexdv(const c: PGLdouble); external dllname; -procedure glIndexf(c: GLfloat); external dllname; -procedure glIndexfv(const c: PGLfloat); external dllname; -procedure glIndexi(c: GLint); external dllname; -procedure glIndexiv(const c: PGLint); external dllname; -procedure glIndexs(c: GLshort); external dllname; -procedure glIndexsv(const c: PGLshort); external dllname; -procedure glIndexub(c: GLubyte); external dllname; -procedure glIndexubv(const c: PGLubyte); external dllname; -procedure glInitNames; external dllname; -procedure glInterleavedArrays(format: GLenum; stride: GLsizei; const pointer: Pointer); external dllname; -function glIsEnabled(cap: GLenum): GLboolean; external dllname; -function glIsList(list: GLuint): GLboolean; external dllname; -function glIsTexture(texture: GLuint): GLboolean; external dllname; -procedure glLightModelf(pname: GLenum; param: GLfloat); external dllname; -procedure glLightModelfv(pname: GLenum; const params: PGLfloat); external dllname; -procedure glLightModeli(pname: GLenum; param: GLint); external dllname; -procedure glLightModeliv(pname: GLenum; const params: PGLint); external dllname; -procedure glLightf(light, pname: GLenum; param: GLfloat); external dllname; -procedure glLightfv(light, pname: GLenum; const params: PGLfloat); external dllname; -procedure glLighti(light, pname: GLenum; param: GLint); external dllname; -procedure glLightiv(light, pname: GLenum; const params: PGLint); external dllname; -procedure glLineStipple(factor: GLint; pattern: GLushort); external dllname; -procedure glLineWidth(width: GLfloat); external dllname; -procedure glListBase(base: GLuint); external dllname; -procedure glLoadIdentity; external dllname; -procedure glLoadMatrixd(const m: PGLdouble); external dllname; -procedure glLoadMatrixf(const m: PGLfloat); external dllname; -procedure glLoadName(name: GLuint); external dllname; -procedure glLogicOp(opcode: GLenum); external dllname; -procedure glMap1d(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); external dllname; -procedure glMap1f(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); external dllname; -procedure glMap2d(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); external dllname; -procedure glMap2f(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); external dllname; -procedure glMapGrid1d(un: GLint; u1, u2: GLdouble); external dllname; -procedure glMapGrid1f(un: GLint; u1, u2: GLfloat); external dllname; -procedure glMapGrid2d(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); external dllname; -procedure glMapGrid2f(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); external dllname; -procedure glMaterialf(face, pname: GLenum; param: GLfloat); external dllname; -procedure glMaterialfv(face, pname: GLenum; const params: PGLfloat); external dllname; -procedure glMateriali(face, pname: GLenum; param: GLint); external dllname; -procedure glMaterialiv(face, pname: GLenum; const params: PGLint); external dllname; -procedure glMatrixMode(mode: GLenum); external dllname; -procedure glMultMatrixd(const m: PGLdouble); external dllname; -procedure glMultMatrixf(const m: PGLfloat); external dllname; -procedure glNewList(list: GLuint; mode: GLenum); external dllname; -procedure glNormal3b(nx, ny, nz: GLbyte); external dllname; -procedure glNormal3bv(const v: PGLbyte); external dllname; -procedure glNormal3d(nx, ny, nz: GLdouble); external dllname; -procedure glNormal3dv(const v: PGLdouble); external dllname; -procedure glNormal3f(nx, ny, nz: GLfloat); external dllname; -procedure glNormal3fv(const v: PGLfloat); external dllname; -procedure glNormal3i(nx, ny, nz: GLint); external dllname; -procedure glNormal3iv(const v: PGLint); external dllname; -procedure glNormal3s(nx, ny, nz: GLshort); external dllname; -procedure glNormal3sv(const v: PGLshort); external dllname; -procedure glNormalPointer(atype: GLenum; stride: GLsizei; const pointer: Pointer); external dllname; -procedure glOrtho(left, right, bottom, top, zNear, zFar: GLdouble); external dllname; -procedure glPassThrough(token: GLfloat); external dllname; -procedure glPixelMapfv(map: GLenum; mapsize: GLsizei; const values: PGLfloat); external dllname; -procedure glPixelMapuiv(map: GLenum; mapsize: GLsizei; const values: PGLuint); external dllname; -procedure glPixelMapusv(map: GLenum; mapsize: GLsizei; const values: PGLushort); external dllname; -procedure glPixelStoref(pname: GLenum; param: GLfloat); external dllname; -procedure glPixelStorei(pname: GLenum; param: GLint); external dllname; -procedure glPixelTransferf(pname: GLenum; param: GLfloat); external dllname; -procedure glPixelTransferi(pname: GLenum; param: GLint); external dllname; -procedure glPixelZoom(xfactor, yfactor: GLfloat); external dllname; -procedure glPointSize(size: GLfloat); external dllname; -procedure glPolygonMode(face, mode: GLenum); external dllname; -procedure glPolygonOffset(factor, units: GLfloat); external dllname; -procedure glPolygonStipple(const mask: PGLubyte); external dllname; -procedure glPopAttrib; external dllname; -procedure glPopClientAttrib; external dllname; -procedure glPopMatrix; external dllname; -procedure glPopName; external dllname; -procedure glPrioritizeTextures(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); external dllname; -procedure glPushAttrib(mask: GLbitfield); external dllname; -procedure glPushClientAttrib(mask: GLbitfield); external dllname; -procedure glPushMatrix; external dllname; -procedure glPushName(name: GLuint); external dllname; -procedure glRasterPos2d(x, y: GLdouble); external dllname; -procedure glRasterPos2dv(const v: PGLdouble); external dllname; -procedure glRasterPos2f(x, y: GLfloat); external dllname; -procedure glRasterPos2fv(const v: PGLfloat); external dllname; -procedure glRasterPos2i(x, y: GLint); external dllname; -procedure glRasterPos2iv(const v: PGLint); external dllname; -procedure glRasterPos2s(x, y: GLshort); external dllname; -procedure glRasterPos2sv(const v: PGLshort); external dllname; -procedure glRasterPos3d(x, y, z: GLdouble); external dllname; -procedure glRasterPos3dv(const v: PGLdouble); external dllname; -procedure glRasterPos3f(x, y, z: GLfloat); external dllname; -procedure glRasterPos3fv(const v: PGLfloat); external dllname; -procedure glRasterPos3i(x, y, z: GLint); external dllname; -procedure glRasterPos3iv(const v: PGLint); external dllname; -procedure glRasterPos3s(x, y, z: GLshort); external dllname; -procedure glRasterPos3sv(const v: PGLshort); external dllname; -procedure glRasterPos4d(x, y, z, w: GLdouble); external dllname; -procedure glRasterPos4dv(const v: PGLdouble); external dllname; -procedure glRasterPos4f(x, y, z, w: GLfloat); external dllname; -procedure glRasterPos4fv(const v: PGLfloat); external dllname; -procedure glRasterPos4i(x, y, z, w: GLint); external dllname; -procedure glRasterPos4iv(const v: PGLint); external dllname; -procedure glRasterPos4s(x, y, z, w: GLshort); external dllname; -procedure glRasterPos4sv(const v: PGLshort); external dllname; -procedure glReadBuffer(mode: GLenum); external dllname; -procedure glReadPixels(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); external dllname; -procedure glRectd(x1, y1, x2, y2: GLdouble); external dllname; -procedure glRectdv(const v1: PGLdouble; const v2: PGLdouble); external dllname; -procedure glRectf(x1, y1, x2, y2: GLfloat); external dllname; -procedure glRectfv(const v1: PGLfloat; const v2: PGLfloat); external dllname; -procedure glRecti(x1, y1, x2, y2: GLint); external dllname; -procedure glRectiv(const v1: PGLint; const v2: PGLint); external dllname; -procedure glRects(x1, y1, x2, y2: GLshort); external dllname; -procedure glRectsv(const v1: PGLshort; const v2: PGLshort); external dllname; -function glRenderMode(mode: GLint): GLint; external dllname; -procedure glRotated(angle, x, y, z: GLdouble); external dllname; -procedure glRotatef(angle, x, y, z: GLfloat); external dllname; -procedure glScaled(x, y, z: GLdouble); external dllname; -procedure glScalef(x, y, z: GLfloat); external dllname; -procedure glScissor(x, y: GLint; width, height: GLsizei); external dllname; -procedure glSelectBuffer(size: GLsizei; buffer: PGLuint); external dllname; -procedure glShadeModel(mode: GLenum); external dllname; -procedure glStencilFunc(func: GLenum; ref: GLint; mask: GLuint); external dllname; -procedure glStencilMask(mask: GLuint); external dllname; -procedure glStencilOp(fail, zfail, zpass: GLenum); external dllname; -procedure glTexCoord1d(s: GLdouble); external dllname; -procedure glTexCoord1dv(const v: PGLdouble); external dllname; -procedure glTexCoord1f(s: GLfloat); external dllname; -procedure glTexCoord1fv(const v: PGLfloat); external dllname; -procedure glTexCoord1i(s: GLint); external dllname; -procedure glTexCoord1iv(const v: PGLint); external dllname; -procedure glTexCoord1s(s: GLshort); external dllname; -procedure glTexCoord1sv(const v: PGLshort); external dllname; -procedure glTexCoord2d(s, t: GLdouble); external dllname; -procedure glTexCoord2dv(const v: PGLdouble); external dllname; -procedure glTexCoord2f(s, t: GLfloat); external dllname; -procedure glTexCoord2fv(const v: PGLfloat); external dllname; -procedure glTexCoord2i(s, t: GLint); external dllname; -procedure glTexCoord2iv(const v: PGLint); external dllname; -procedure glTexCoord2s(s, t: GLshort); external dllname; -procedure glTexCoord2sv(const v: PGLshort); external dllname; -procedure glTexCoord3d(s, t, r: GLdouble); external dllname; -procedure glTexCoord3dv(const v: PGLdouble); external dllname; -procedure glTexCoord3f(s, t, r: GLfloat); external dllname; -procedure glTexCoord3fv(const v: PGLfloat); external dllname; -procedure glTexCoord3i(s, t, r: GLint); external dllname; -procedure glTexCoord3iv(const v: PGLint); external dllname; -procedure glTexCoord3s(s, t, r: GLshort); external dllname; -procedure glTexCoord3sv(const v: PGLshort); external dllname; -procedure glTexCoord4d(s, t, r, q: GLdouble); external dllname; -procedure glTexCoord4dv(const v: PGLdouble); external dllname; -procedure glTexCoord4f(s, t, r, q: GLfloat); external dllname; -procedure glTexCoord4fv(const v: PGLfloat); external dllname; -procedure glTexCoord4i(s, t, r, q: GLint); external dllname; -procedure glTexCoord4iv(const v: PGLint); external dllname; -procedure glTexCoord4s(s, t, r, q: GLshort); external dllname; -procedure glTexCoord4sv(const v: PGLshort); external dllname; -procedure glTexCoordPointer(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); external dllname; -procedure glTexEnvf(target: GLenum; pname: GLenum; param: GLfloat); external dllname; -procedure glTexEnvfv(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; -procedure glTexEnvi(target: GLenum; pname: GLenum; param: GLint); external dllname; -procedure glTexEnviv(target: GLenum; pname: GLenum; const params: PGLint); external dllname; -procedure glTexGend(coord: GLenum; pname: GLenum; param: GLdouble); external dllname; -procedure glTexGendv(coord: GLenum; pname: GLenum; const params: PGLdouble); external dllname; -procedure glTexGenf(coord: GLenum; pname: GLenum; param: GLfloat); external dllname; -procedure glTexGenfv(coord: GLenum; pname: GLenum; const params: PGLfloat); external dllname; -procedure glTexGeni(coord: GLenum; pname: GLenum; param: GLint); external dllname; -procedure glTexGeniv(coord: GLenum; pname: GLenum; const params: PGLint); external dllname; -procedure glTexImage1D(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); external dllname; -procedure glTexImage2D(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); external dllname; -procedure glTexParameterf(target: GLenum; pname: GLenum; param: GLfloat); external dllname; -procedure glTexParameterfv(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; -procedure glTexParameteri(target: GLenum; pname: GLenum; param: GLint); external dllname; -procedure glTexParameteriv(target: GLenum; pname: GLenum; const params: PGLint); external dllname; -procedure glTexSubImage1D(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); external dllname; -procedure glTexSubImage2D(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); external dllname; -procedure glTranslated(x, y, z: GLdouble); external dllname; -procedure glTranslatef(x, y, z: GLfloat); external dllname; -procedure glVertex2d(x, y: GLdouble); external dllname; -procedure glVertex2dv(const v: PGLdouble); external dllname; -procedure glVertex2f(x, y: GLfloat); external dllname; -procedure glVertex2fv(const v: PGLfloat); external dllname; -procedure glVertex2i(x, y: GLint); external dllname; -procedure glVertex2iv(const v: PGLint); external dllname; -procedure glVertex2s(x, y: GLshort); external dllname; -procedure glVertex2sv(const v: PGLshort); external dllname; -procedure glVertex3d(x, y, z: GLdouble); external dllname; -procedure glVertex3dv(const v: PGLdouble); external dllname; -procedure glVertex3f(x, y, z: GLfloat); external dllname; -procedure glVertex3fv(const v: PGLfloat); external dllname; -procedure glVertex3i(x, y, z: GLint); external dllname; -procedure glVertex3iv(const v: PGLint); external dllname; -procedure glVertex3s(x, y, z: GLshort); external dllname; -procedure glVertex3sv(const v: PGLshort); external dllname; -procedure glVertex4d(x, y, z, w: GLdouble); external dllname; -procedure glVertex4dv(const v: PGLdouble); external dllname; -procedure glVertex4f(x, y, z, w: GLfloat); external dllname; -procedure glVertex4fv(const v: PGLfloat); external dllname; -procedure glVertex4i(x, y, z, w: GLint); external dllname; -procedure glVertex4iv(const v: PGLint); external dllname; -procedure glVertex4s(x, y, z, w: GLshort); external dllname; -procedure glVertex4sv(const v: PGLshort); external dllname; -procedure glVertexPointer(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); external dllname; -procedure glViewport(x, y: GLint; width, height: GLsizei); external dllname; - -type - // EXT_vertex_array - PFNGLARRAYELEMENTEXTPROC = procedure(i: GLint); - PFNGLDRAWARRAYSEXTPROC = procedure(mode: GLenum; first: GLint; count: GLsizei); - PFNGLVERTEXPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; - stride, count: GLsizei; const pointer: Pointer); - PFNGLNORMALPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); - PFNGLCOLORPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); - PFNGLINDEXPOINTEREXTPROC = procedure(atype: GLenum; stride, count: GLsizei; - const pointer: Pointer); - PFNGLTEXCOORDPOINTEREXTPROC = procedure(size: GLint; atype: GLenum; - stride, count: GLsizei; const pointer: Pointer); - PFNGLEDGEFLAGPOINTEREXTPROC = procedure(stride, count: GLsizei; - const pointer: PGLboolean); - PFNGLGETPOINTERVEXTPROC = procedure(pname: GLenum; params: Pointer); - PFNGLARRAYELEMENTARRAYEXTPROC = procedure(mode: GLenum; count: GLsizei; - const pi: Pointer); - // WIN_swap_hint - PFNGLADDSWAPHINTRECTWINPROC = procedure(x, y: GLint; width, height: GLsizei); - - // EXT_paletted_texture - PFNGLCOLORTABLEEXTPROC = procedure(target, internalFormat: GLenum; width: GLsizei; - format, atype: GLenum; const data: Pointer); - PFNGLCOLORSUBTABLEEXTPROC = procedure(target: GLenum; start, count: GLsizei; - format, atype: GLenum; const data: Pointer); - PFNGLGETCOLORTABLEEXTPROC = procedure(target, format, atype: GLenum; data: Pointer); - PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = procedure(target, pname: GLenum; params: PGLint); - PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = procedure(target, pname: GLenum; params: PGLfloat); - -implementation - -end. diff --git a/lib/wrappers/opengl/glext.nim b/lib/wrappers/opengl/glext.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/glext.pp b/lib/wrappers/opengl/glext.pp deleted file mode 100644 index 4c9fc2119..000000000 --- a/lib/wrappers/opengl/glext.pp +++ /dev/null @@ -1,3857 +0,0 @@ -{ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} -(* -{$MACRO ON} -{$MODE Delphi} -{$IFDEF Windows} - {$DEFINE extdecl:=stdcall } -{$ELSE} - {$DEFINE extdecl:=cdecl } -{$ENDIF} *) - -unit GLext; - -(************************************************** - * OpenGL extension loading library * - * Generated by MetaGLext, written by Tom Nuydens * - * (tom@delphi3d.net -- http://www.delphi3d.net * - **************************************************) - -//*** Generated on 10/11/2002 - -interface - -uses - GL; - -// Test if the given extension name is present in the given extension string. -function glext_ExtensionSupported(const extension: String; const searchIn: String): Boolean; - -// Load the extension with the given name. -function glext_LoadExtension(ext: String): Boolean; - -type - GLcharARB = Char; - TGLcharARB = GLcharARB; - PGLcharARB = ^GLcharARB; - - GLhandleARB = Cardinal; - TGLhandleARB = GLhandleARB; - PGLhandleARB = ^GLhandleARB; - - GLintptr = Integer; - TGLintptr = GLintptr; - PGLintptr = ^GLintptr; - - GLsizeiptr = Integer; - TGLsizeiptr = GLsizeiptr; - PGLsizeiptr = ^GLsizeiptr; - - GLchar = Char; - TGLchar = GLchar; - PGLchar = Pchar; - -//***** GL_version_1_2 *****// -const - GL_UNSIGNED_BYTE_3_3_2 = $8032; - GL_UNSIGNED_SHORT_4_4_4_4 = $8033; - GL_UNSIGNED_SHORT_5_5_5_1 = $8034; - GL_UNSIGNED_INT_8_8_8_8 = $8035; - GL_UNSIGNED_INT_10_10_10_2 = $8036; - GL_RESCALE_NORMAL = $803A; - GL_UNSIGNED_BYTE_2_3_3_REV = $8362; - GL_UNSIGNED_SHORT_5_6_5 = $8363; - GL_UNSIGNED_SHORT_5_6_5_REV = $8364; - GL_UNSIGNED_SHORT_4_4_4_4_REV = $8365; - GL_UNSIGNED_SHORT_1_5_5_5_REV = $8366; - GL_UNSIGNED_INT_8_8_8_8_REV = $8367; - GL_UNSIGNED_INT_2_10_10_10_REV = $8368; - GL_BGR = $80E0; - GL_BGRA = $80E1; - GL_MAX_ELEMENTS_VERTICES = $80E8; - GL_MAX_ELEMENTS_INDICES = $80E9; - GL_CLAMP_TO_EDGE = $812F; - GL_TEXTURE_MIN_LOD = $813A; - GL_TEXTURE_MAX_LOD = $813B; - GL_TEXTURE_BASE_LEVEL = $813C; - GL_TEXTURE_MAX_LEVEL = $813D; - GL_LIGHT_MODEL_COLOR_CONTROL = $81F8; - GL_SINGLE_COLOR = $81F9; - GL_SEPARATE_SPECULAR_COLOR = $81FA; - GL_SMOOTH_POINT_SIZE_RANGE = $0B12; - GL_SMOOTH_POINT_SIZE_GRANULARITY = $0B13; - GL_SMOOTH_LINE_WIDTH_RANGE = $0B22; - GL_SMOOTH_LINE_WIDTH_GRANULARITY = $0B23; - GL_ALIASED_POINT_SIZE_RANGE = $846D; - GL_ALIASED_LINE_WIDTH_RANGE = $846E; - GL_PACK_SKIP_IMAGES = $806B; - GL_PACK_IMAGE_HEIGHT = $806C; - GL_UNPACK_SKIP_IMAGES = $806D; - GL_UNPACK_IMAGE_HEIGHT = $806E; - GL_TEXTURE_3D = $806F; - GL_PROXY_TEXTURE_3D = $8070; - GL_TEXTURE_DEPTH = $8071; - GL_TEXTURE_WRAP_R = $8072; - GL_MAX_3D_TEXTURE_SIZE = $8073; - - procedure glBlendColor(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); external dllname; - procedure glBlendEquation(mode: GLenum); external dllname; - procedure glDrawRangeElements(mode: GLenum; start: GLuint; theend: GLuint; count: GLsizei; thetype: GLenum; const indices: PGLvoid); external dllname; - procedure glColorTable(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; thetype: GLenum; const table: PGLvoid); external dllname; - procedure glColorTableParameterfv(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; - procedure glColorTableParameteriv(target: GLenum; pname: GLenum; const params: PGLint); external dllname; - procedure glCopyColorTable(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); external dllname; - procedure glGetColorTable(target: GLenum; format: GLenum; thetype: GLenum; table: PGLvoid); external dllname; - procedure glGetColorTableParameterfv(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetColorTableParameteriv(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glColorSubTable(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; thetype: GLenum; const data: PGLvoid); external dllname; - procedure glCopyColorSubTable(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); external dllname; - procedure glConvolutionFilter1D(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; thetype: GLenum; const image: PGLvoid); external dllname; - procedure glConvolutionFilter2D(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; thetype: GLenum; const image: PGLvoid); external dllname; - procedure glConvolutionParameterf(target: GLenum; pname: GLenum; params: GLfloat); external dllname; - procedure glConvolutionParameterfv(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; - procedure glConvolutionParameteri(target: GLenum; pname: GLenum; params: GLint); external dllname; - procedure glConvolutionParameteriv(target: GLenum; pname: GLenum; const params: PGLint); external dllname; - procedure glCopyConvolutionFilter1D(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); external dllname; - procedure glCopyConvolutionFilter2D(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); external dllname; - procedure glGetConvolutionFilter(target: GLenum; format: GLenum; thetype: GLenum; image: PGLvoid); external dllname; - procedure glGetConvolutionParameterfv(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetConvolutionParameteriv(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetSeparableFilter(target: GLenum; format: GLenum; thetype: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); external dllname; - procedure glSeparableFilter2D(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; thetype: GLenum; const row: PGLvoid; const column: PGLvoid); external dllname; - procedure glGetHistogram(target: GLenum; reset: GLboolean; format: GLenum; thetype: GLenum; values: PGLvoid); external dllname; - procedure glGetHistogramParameterfv(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetHistogramParameteriv(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetMinmax(target: GLenum; reset: GLboolean; format: GLenum; thetype: GLenum; values: PGLvoid); external dllname; - procedure glGetMinmaxParameterfv(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetMinmaxParameteriv(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glHistogram(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); external dllname; - procedure glMinmax(target: GLenum; internalformat: GLenum; sink: GLboolean); external dllname; - procedure glResetHistogram(target: GLenum); external dllname; - procedure glResetMinmax(target: GLenum); external dllname; - procedure glTexImage3D(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; thetype: GLenum; const pixels: PGLvoid); external dllname; - procedure glTexSubImage3D(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; thetype: GLenum; const pixels: PGLvoid); external dllname; - procedure glCopyTexSubImage3D(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; x: GLint; y: GLint; width: GLsizei; height: GLsizei); external dllname; - - -//***** GL_ARB_imaging *****// -const - GL_CONSTANT_COLOR = $8001; - GL_ONE_MINUS_CONSTANT_COLOR = $8002; - GL_CONSTANT_ALPHA = $8003; - GL_ONE_MINUS_CONSTANT_ALPHA = $8004; - GL_BLEND_COLOR = $8005; - GL_FUNC_ADD = $8006; - GL_MIN = $8007; - GL_MAX = $8008; - GL_BLEND_EQUATION = $8009; - GL_FUNC_SUBTRACT = $800A; - GL_FUNC_REVERSE_SUBTRACT = $800B; - GL_CONVOLUTION_1D = $8010; - GL_CONVOLUTION_2D = $8011; - GL_SEPARABLE_2D = $8012; - GL_CONVOLUTION_BORDER_MODE = $8013; - GL_CONVOLUTION_FILTER_SCALE = $8014; - GL_CONVOLUTION_FILTER_BIAS = $8015; - GL_REDUCE = $8016; - GL_CONVOLUTION_FORMAT = $8017; - GL_CONVOLUTION_WIDTH = $8018; - GL_CONVOLUTION_HEIGHT = $8019; - GL_MAX_CONVOLUTION_WIDTH = $801A; - GL_MAX_CONVOLUTION_HEIGHT = $801B; - GL_POST_CONVOLUTION_RED_SCALE = $801C; - GL_POST_CONVOLUTION_GREEN_SCALE = $801D; - GL_POST_CONVOLUTION_BLUE_SCALE = $801E; - GL_POST_CONVOLUTION_ALPHA_SCALE = $801F; - GL_POST_CONVOLUTION_RED_BIAS = $8020; - GL_POST_CONVOLUTION_GREEN_BIAS = $8021; - GL_POST_CONVOLUTION_BLUE_BIAS = $8022; - GL_POST_CONVOLUTION_ALPHA_BIAS = $8023; - GL_HISTOGRAM = $8024; - GL_PROXY_HISTOGRAM = $8025; - GL_HISTOGRAM_WIDTH = $8026; - GL_HISTOGRAM_FORMAT = $8027; - GL_HISTOGRAM_RED_SIZE = $8028; - GL_HISTOGRAM_GREEN_SIZE = $8029; - GL_HISTOGRAM_BLUE_SIZE = $802A; - GL_HISTOGRAM_ALPHA_SIZE = $802B; - GL_HISTOGRAM_LUMINANCE_SIZE = $802C; - GL_HISTOGRAM_SINK = $802D; - GL_MINMAX = $802E; - GL_MINMAX_FORMAT = $802F; - GL_MINMAX_SINK = $8030; - GL_TABLE_TOO_LARGE = $8031; - GL_COLOR_MATRIX = $80B1; - GL_COLOR_MATRIX_STACK_DEPTH = $80B2; - GL_MAX_COLOR_MATRIX_STACK_DEPTH = $80B3; - GL_POST_COLOR_MATRIX_RED_SCALE = $80B4; - GL_POST_COLOR_MATRIX_GREEN_SCALE = $80B5; - GL_POST_COLOR_MATRIX_BLUE_SCALE = $80B6; - GL_POST_COLOR_MATRIX_ALPHA_SCALE = $80B7; - GL_POST_COLOR_MATRIX_RED_BIAS = $80B8; - GL_POST_COLOR_MATRIX_GREEN_BIAS = $80B9; - GL_POST_COLOR_MATRIX_BLUE_BIAS = $80BA; - GL_POST_COLOR_MATIX_ALPHA_BIAS = $80BB; - GL_COLOR_TABLE = $80D0; - GL_POST_CONVOLUTION_COLOR_TABLE = $80D1; - GL_POST_COLOR_MATRIX_COLOR_TABLE = $80D2; - GL_PROXY_COLOR_TABLE = $80D3; - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = $80D4; - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = $80D5; - GL_COLOR_TABLE_SCALE = $80D6; - GL_COLOR_TABLE_BIAS = $80D7; - GL_COLOR_TABLE_FORMAT = $80D8; - GL_COLOR_TABLE_WIDTH = $80D9; - GL_COLOR_TABLE_RED_SIZE = $80DA; - GL_COLOR_TABLE_GREEN_SIZE = $80DB; - GL_COLOR_TABLE_BLUE_SIZE = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE = $80DF; - GL_IGNORE_BORDER = $8150; - GL_CONSTANT_BORDER = $8151; - GL_WRAP_BORDER = $8152; - GL_REPLICATE_BORDER = $8153; - GL_CONVOLUTION_BORDER_COLOR = $8154; - -function Load_GL_ARB_imaging: Boolean; - -//***** GL_version_1_3 *****// -const - GL_TEXTURE0 = $84C0; - GL_TEXTURE1 = $84C1; - GL_TEXTURE2 = $84C2; - GL_TEXTURE3 = $84C3; - GL_TEXTURE4 = $84C4; - GL_TEXTURE5 = $84C5; - GL_TEXTURE6 = $84C6; - GL_TEXTURE7 = $84C7; - GL_TEXTURE8 = $84C8; - GL_TEXTURE9 = $84C9; - GL_TEXTURE10 = $84CA; - GL_TEXTURE11 = $84CB; - GL_TEXTURE12 = $84CC; - GL_TEXTURE13 = $84CD; - GL_TEXTURE14 = $84CE; - GL_TEXTURE15 = $84CF; - GL_TEXTURE16 = $84D0; - GL_TEXTURE17 = $84D1; - GL_TEXTURE18 = $84D2; - GL_TEXTURE19 = $84D3; - GL_TEXTURE20 = $84D4; - GL_TEXTURE21 = $84D5; - GL_TEXTURE22 = $84D6; - GL_TEXTURE23 = $84D7; - GL_TEXTURE24 = $84D8; - GL_TEXTURE25 = $84D9; - GL_TEXTURE26 = $84DA; - GL_TEXTURE27 = $84DB; - GL_TEXTURE28 = $84DC; - GL_TEXTURE29 = $84DD; - GL_TEXTURE30 = $84DE; - GL_TEXTURE31 = $84DF; - GL_ACTIVE_TEXTURE = $84E0; - GL_CLIENT_ACTIVE_TEXTURE = $84E1; - GL_MAX_TEXTURE_UNITS = $84E2; - GL_TRANSPOSE_MODELVIEW_MATRIX = $84E3; - GL_TRANSPOSE_PROJECTION_MATRIX = $84E4; - GL_TRANSPOSE_TEXTURE_MATRIX = $84E5; - GL_TRANSPOSE_COLOR_MATRIX = $84E6; - GL_MULTISAMPLE = $809D; - GL_SAMPLE_ALPHA_TO_COVERAGE = $809E; - GL_SAMPLE_ALPHA_TO_ONE = $809F; - GL_SAMPLE_COVERAGE = $80A0; - GL_SAMPLE_BUFFERS = $80A8; - GL_SAMPLES = $80A9; - GL_SAMPLE_COVERAGE_VALUE = $80AA; - GL_SAMPLE_COVERAGE_INVERT = $80AB; - GL_MULTISAMPLE_BIT = $20000000; - GL_NORMAL_MAP = $8511; - GL_REFLECTION_MAP = $8512; - GL_TEXTURE_CUBE_MAP = $8513; - GL_TEXTURE_BINDING_CUBE_MAP = $8514; - GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515; - GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516; - GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518; - GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A; - GL_PROXY_TEXTURE_CUBE_MAP = $851B; - GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C; - GL_COMPRESSED_ALPHA = $84E9; - GL_COMPRESSED_LUMINANCE = $84EA; - GL_COMPRESSED_LUMINANCE_ALPHA = $84EB; - GL_COMPRESSED_INTENSITY = $84EC; - GL_COMPRESSED_RGB = $84ED; - GL_COMPRESSED_RGBA = $84EE; - GL_TEXTURE_COMPRESSION_HINT = $84EF; - GL_TEXTURE_COMPRESSED_IMAGE_SIZE = $86A0; - GL_TEXTURE_COMPRESSED = $86A1; - GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2; - GL_COMPRESSED_TEXTURE_FORMATS = $86A3; - GL_CLAMP_TO_BORDER = $812D; - GL_CLAMP_TO_BORDER_SGIS = $812D; - GL_COMBINE = $8570; - GL_COMBINE_RGB = $8571; - GL_COMBINE_ALPHA = $8572; - GL_SOURCE0_RGB = $8580; - GL_SOURCE1_RGB = $8581; - GL_SOURCE2_RGB = $8582; - GL_SOURCE0_ALPHA = $8588; - GL_SOURCE1_ALPHA = $8589; - GL_SOURCE2_ALPHA = $858A; - GL_OPERAND0_RGB = $8590; - GL_OPERAND1_RGB = $8591; - GL_OPERAND2_RGB = $8592; - GL_OPERAND0_ALPHA = $8598; - GL_OPERAND1_ALPHA = $8599; - GL_OPERAND2_ALPHA = $859A; - GL_RGB_SCALE = $8573; - GL_ADD_SIGNED = $8574; - GL_INTERPOLATE = $8575; - GL_SUBTRACT = $84E7; - GL_CONSTANT = $8576; - GL_PRIMARY_COLOR = $8577; - GL_PREVIOUS = $8578; - GL_DOT3_RGB = $86AE; - GL_DOT3_RGBA = $86AF; - - procedure glActiveTexture(texture: GLenum); external dllname; - procedure glClientActiveTexture(texture: GLenum); external dllname; - procedure glMultiTexCoord1d(target: GLenum; s: GLdouble); external dllname; - procedure glMultiTexCoord1dv(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord1f(target: GLenum; s: GLfloat); external dllname; - procedure glMultiTexCoord1fv(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord1i(target: GLenum; s: GLint); external dllname; - procedure glMultiTexCoord1iv(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord1s(target: GLenum; s: GLshort); external dllname; - procedure glMultiTexCoord1sv(target: GLenum; const v: PGLshort); external dllname; - procedure glMultiTexCoord2d(target: GLenum; s: GLdouble; t: GLdouble); external dllname; - procedure glMultiTexCoord2dv(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord2f(target: GLenum; s: GLfloat; t: GLfloat); external dllname; - procedure glMultiTexCoord2fv(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord2i(target: GLenum; s: GLint; t: GLint); external dllname; - procedure glMultiTexCoord2iv(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord2s(target: GLenum; s: GLshort; t: GLshort); external dllname; - procedure glMultiTexCoord2sv(target: GLenum; const v: PGLshort); external dllname; - procedure glMultiTexCoord3d(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); external dllname; - procedure glMultiTexCoord3dv(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord3f(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); external dllname; - procedure glMultiTexCoord3fv(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord3i(target: GLenum; s: GLint; t: GLint; r: GLint); external dllname; - procedure glMultiTexCoord3iv(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord3s(target: GLenum; s: GLshort; t: GLshort; r: GLshort); external dllname; - procedure glMultiTexCoord3sv(target: GLenum; const v: PGLshort); external dllname; - procedure glMultiTexCoord4d(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); external dllname; - procedure glMultiTexCoord4dv(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord4f(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); external dllname; - procedure glMultiTexCoord4fv(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord4i(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); external dllname; - procedure glMultiTexCoord4iv(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord4s(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); external dllname; - procedure glMultiTexCoord4sv(target: GLenum; const v: PGLshort); external dllname; - procedure glLoadTransposeMatrixf(const m: PGLfloat); external dllname; - procedure glLoadTransposeMatrixd(const m: PGLdouble); external dllname; - procedure glMultTransposeMatrixf(const m: PGLfloat); external dllname; - procedure glMultTransposeMatrixd(const m: PGLdouble); external dllname; - procedure glSampleCoverage(value: GLclampf; invert: GLboolean); external dllname; - procedure glCompressedTexImage3D(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexImage2D(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexImage1D(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexSubImage3D(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexSubImage2D(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexSubImage1D(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glGetCompressedTexImage(target: GLenum; level: GLint; img: PGLvoid); external dllname; - -function Load_GL_version_1_3: Boolean; - -//***** GL_ARB_multitexture *****// -const - GL_TEXTURE0_ARB = $84C0; - GL_TEXTURE1_ARB = $84C1; - GL_TEXTURE2_ARB = $84C2; - GL_TEXTURE3_ARB = $84C3; - GL_TEXTURE4_ARB = $84C4; - GL_TEXTURE5_ARB = $84C5; - GL_TEXTURE6_ARB = $84C6; - GL_TEXTURE7_ARB = $84C7; - GL_TEXTURE8_ARB = $84C8; - GL_TEXTURE9_ARB = $84C9; - GL_TEXTURE10_ARB = $84CA; - GL_TEXTURE11_ARB = $84CB; - GL_TEXTURE12_ARB = $84CC; - GL_TEXTURE13_ARB = $84CD; - GL_TEXTURE14_ARB = $84CE; - GL_TEXTURE15_ARB = $84CF; - GL_TEXTURE16_ARB = $84D0; - GL_TEXTURE17_ARB = $84D1; - GL_TEXTURE18_ARB = $84D2; - GL_TEXTURE19_ARB = $84D3; - GL_TEXTURE20_ARB = $84D4; - GL_TEXTURE21_ARB = $84D5; - GL_TEXTURE22_ARB = $84D6; - GL_TEXTURE23_ARB = $84D7; - GL_TEXTURE24_ARB = $84D8; - GL_TEXTURE25_ARB = $84D9; - GL_TEXTURE26_ARB = $84DA; - GL_TEXTURE27_ARB = $84DB; - GL_TEXTURE28_ARB = $84DC; - GL_TEXTURE29_ARB = $84DD; - GL_TEXTURE30_ARB = $84DE; - GL_TEXTURE31_ARB = $84DF; - GL_ACTIVE_TEXTURE_ARB = $84E0; - GL_CLIENT_ACTIVE_TEXTURE_ARB = $84E1; - GL_MAX_TEXTURE_UNITS_ARB = $84E2; - - procedure glActiveTextureARB(texture: GLenum); external dllname; - procedure glClientActiveTextureARB(texture: GLenum); external dllname; - procedure glMultiTexCoord1dARB(target: GLenum; s: GLdouble); external dllname; - procedure glMultiTexCoord1dvARB(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord1fARB(target: GLenum; s: GLfloat); external dllname; - procedure glMultiTexCoord1fvARB(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord1iARB(target: GLenum; s: GLint); external dllname; - procedure glMultiTexCoord1ivARB(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord1sARB(target: GLenum; s: GLshort); external dllname; - procedure glMultiTexCoord1svARB(target: GLenum; const v: PGLshort); external dllname; - procedure glMultiTexCoord2dARB(target: GLenum; s: GLdouble; t: GLdouble); external dllname; - procedure glMultiTexCoord2dvARB(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord2fARB(target: GLenum; s: GLfloat; t: GLfloat); external dllname; - procedure glMultiTexCoord2fvARB(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord2iARB(target: GLenum; s: GLint; t: GLint); external dllname; - procedure glMultiTexCoord2ivARB(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord2sARB(target: GLenum; s: GLshort; t: GLshort); external dllname; - procedure glMultiTexCoord2svARB(target: GLenum; const v: PGLshort); external dllname; - procedure glMultiTexCoord3dARB(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble); external dllname; - procedure glMultiTexCoord3dvARB(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord3fARB(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); external dllname; - procedure glMultiTexCoord3fvARB(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord3iARB(target: GLenum; s: GLint; t: GLint; r: GLint); external dllname; - procedure glMultiTexCoord3ivARB(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord3sARB(target: GLenum; s: GLshort; t: GLshort; r: GLshort); external dllname; - procedure glMultiTexCoord3svARB(target: GLenum; const v: PGLshort); external dllname; - procedure glMultiTexCoord4dARB(target: GLenum; s: GLdouble; t: GLdouble; r: GLdouble; q: GLdouble); external dllname; - procedure glMultiTexCoord4dvARB(target: GLenum; const v: PGLdouble); external dllname; - procedure glMultiTexCoord4fARB(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat; q: GLfloat); external dllname; - procedure glMultiTexCoord4fvARB(target: GLenum; const v: PGLfloat); external dllname; - procedure glMultiTexCoord4iARB(target: GLenum; s: GLint; t: GLint; r: GLint; q: GLint); external dllname; - procedure glMultiTexCoord4ivARB(target: GLenum; const v: PGLint); external dllname; - procedure glMultiTexCoord4sARB(target: GLenum; s: GLshort; t: GLshort; r: GLshort; q: GLshort); external dllname; - procedure glMultiTexCoord4svARB(target: GLenum; const v: PGLshort); external dllname; - -function Load_GL_ARB_multitexture: Boolean; - -//***** GL_ARB_transpose_matrix *****// -const - GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = $84E3; - GL_TRANSPOSE_PROJECTION_MATRIX_ARB = $84E4; - GL_TRANSPOSE_TEXTURE_MATRIX_ARB = $84E5; - GL_TRANSPOSE_COLOR_MATRIX_ARB = $84E6; - - procedure glLoadTransposeMatrixfARB(m: PGLfloat); external dllname; - procedure glLoadTransposeMatrixdARB(m: PGLdouble); external dllname; - procedure glMultTransposeMatrixfARB(m: PGLfloat); external dllname; - procedure glMultTransposeMatrixdARB(m: PGLdouble); external dllname; - -function Load_GL_ARB_transpose_matrix: Boolean; - -//***** GL_ARB_multisample *****// -const - WGL_SAMPLE_BUFFERS_ARB = $2041; - WGL_SAMPLES_ARB = $2042; - GL_MULTISAMPLE_ARB = $809D; - GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = $809E; - GL_SAMPLE_ALPHA_TO_ONE_ARB = $809F; - GL_SAMPLE_COVERAGE_ARB = $80A0; - GL_MULTISAMPLE_BIT_ARB = $20000000; - GL_SAMPLE_BUFFERS_ARB = $80A8; - GL_SAMPLES_ARB = $80A9; - GL_SAMPLE_COVERAGE_VALUE_ARB = $80AA; - GL_SAMPLE_COVERAGE_INVERT_ARB = $80AB; - -procedure glSampleCoverageARB(value: GLclampf; invert: GLboolean); external dllname; - -function Load_GL_ARB_multisample: Boolean; - -//***** GL_ARB_texture_env_add *****// - -function Load_GL_ARB_texture_env_add: Boolean; - - -//***** GL_ARB_texture_cube_map *****// -const - GL_NORMAL_MAP_ARB = $8511; - GL_REFLECTION_MAP_ARB = $8512; - GL_TEXTURE_CUBE_MAP_ARB = $8513; - GL_TEXTURE_BINDING_CUBE_MAP_ARB = $8514; - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $8515; - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $8516; - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $8517; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $8518; - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $8519; - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $851A; - GL_PROXY_TEXTURE_CUBE_MAP_ARB = $851B; - GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = $851C; - -function Load_GL_ARB_texture_cube_map: Boolean; - -//***** GL_ARB_depth_texture *****// -const - GL_DEPTH_COMPONENT16_ARB = $81A5; - GL_DEPTH_COMPONENT24_ARB = $81A6; - GL_DEPTH_COMPONENT32_ARB = $81A7; - GL_TEXTURE_DEPTH_SIZE_ARB = $884A; - GL_DEPTH_TEXTURE_MODE_ARB = $884B; - -function Load_GL_ARB_depth_texture: Boolean; - -//***** GL_ARB_point_parameters *****// -const - GL_POINT_SIZE_MIN_ARB = $8126; - GL_POINT_SIZE_MAX_ARB = $8127; - GL_POINT_FADE_THRESHOLD_SIZE_ARB = $8128; - GL_POINT_DISTANCE_ATTENUATION_ARB = $8129; - - procedure glPointParameterfARB(pname: GLenum; param: GLfloat); external dllname; - procedure glPointParameterfvARB(pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_ARB_point_parameters: Boolean; - -//***** GL_ARB_shadow *****// -const - GL_TEXTURE_COMPARE_MODE_ARB = $884C; - GL_TEXTURE_COMPARE_FUNC_ARB = $884D; - GL_COMPARE_R_TO_TEXTURE_ARB = $884E; - -function Load_GL_ARB_shadow: Boolean; - -//***** GL_ARB_shadow_ambient *****// -const - GL_TEXTURE_COMPARE_FAIL_VALUE_ARB = $80BF; - -function Load_GL_ARB_shadow_ambient: Boolean; - -//***** GL_ARB_texture_border_clamp *****// -const - GL_CLAMP_TO_BORDER_ARB = $812D; - -function Load_GL_ARB_texture_border_clamp: Boolean; - -//***** GL_ARB_texture_compression *****// -const - GL_COMPRESSED_ALPHA_ARB = $84E9; - GL_COMPRESSED_LUMINANCE_ARB = $84EA; - GL_COMPRESSED_LUMINANCE_ALPHA_ARB = $84EB; - GL_COMPRESSED_INTENSITY_ARB = $84EC; - GL_COMPRESSED_RGB_ARB = $84ED; - GL_COMPRESSED_RGBA_ARB = $84EE; - GL_TEXTURE_COMPRESSION_HINT_ARB = $84EF; - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = $86A0; - GL_TEXTURE_COMPRESSED_ARB = $86A1; - GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = $86A2; - GL_COMPRESSED_TEXTURE_FORMATS_ARB = $86A3; - - procedure glCompressedTexImage3DARB(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexImage2DARB(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexImage1DARB(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; border: GLint; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexSubImage3DARB(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexSubImage2DARB(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glCompressedTexSubImage1DARB(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; imageSize: GLsizei; const data: PGLvoid); external dllname; - procedure glGetCompressedTexImageARB(target: GLenum; lod: GLint; img: PGLvoid); external dllname; - -function Load_GL_ARB_texture_compression: Boolean; - -//***** GL_ARB_texture_env_combine *****// -const - GL_COMBINE_ARB = $8570; - GL_COMBINE_RGB_ARB = $8571; - GL_COMBINE_ALPHA_ARB = $8572; - GL_SOURCE0_RGB_ARB = $8580; - GL_SOURCE1_RGB_ARB = $8581; - GL_SOURCE2_RGB_ARB = $8582; - GL_SOURCE0_ALPHA_ARB = $8588; - GL_SOURCE1_ALPHA_ARB = $8589; - GL_SOURCE2_ALPHA_ARB = $858A; - GL_OPERAND0_RGB_ARB = $8590; - GL_OPERAND1_RGB_ARB = $8591; - GL_OPERAND2_RGB_ARB = $8592; - GL_OPERAND0_ALPHA_ARB = $8598; - GL_OPERAND1_ALPHA_ARB = $8599; - GL_OPERAND2_ALPHA_ARB = $859A; - GL_RGB_SCALE_ARB = $8573; - GL_ADD_SIGNED_ARB = $8574; - GL_INTERPOLATE_ARB = $8575; - GL_SUBTRACT_ARB = $84E7; - GL_CONSTANT_ARB = $8576; - GL_PRIMARY_COLOR_ARB = $8577; - GL_PREVIOUS_ARB = $8578; - -function Load_GL_ARB_texture_env_combine: Boolean; - -//***** GL_ARB_texture_env_crossbar *****// - -function Load_GL_ARB_texture_env_crossbar: Boolean; - -//***** GL_ARB_texture_env_dot3 *****// -const - GL_DOT3_RGB_ARB = $86AE; - GL_DOT3_RGBA_ARB = $86AF; - -function Load_GL_ARB_texture_env_dot3: Boolean; - -//***** GL_ARB_texture_mirrored_repeat *****// -const - GL_MIRRORED_REPEAT_ARB = $8370; - -function Load_GL_ARB_texture_mirrored_repeat: Boolean; - -//***** GL_ARB_vertex_blend *****// -const - GL_MAX_VERTEX_UNITS_ARB = $86A4; - GL_ACTIVE_VERTEX_UNITS_ARB = $86A5; - GL_WEIGHT_SUM_UNITY_ARB = $86A6; - GL_VERTEX_BLEND_ARB = $86A7; - GL_MODELVIEW0_ARB = $1700; - GL_MODELVIEW1_ARB = $850A; - GL_MODELVIEW2_ARB = $8722; - GL_MODELVIEW3_ARB = $8723; - GL_MODELVIEW4_ARB = $8724; - GL_MODELVIEW5_ARB = $8725; - GL_MODELVIEW6_ARB = $8726; - GL_MODELVIEW7_ARB = $8727; - GL_MODELVIEW8_ARB = $8728; - GL_MODELVIEW9_ARB = $8729; - GL_MODELVIEW10_ARB = $872A; - GL_MODELVIEW11_ARB = $872B; - GL_MODELVIEW12_ARB = $872C; - GL_MODELVIEW13_ARB = $872D; - GL_MODELVIEW14_ARB = $872E; - GL_MODELVIEW15_ARB = $872F; - GL_MODELVIEW16_ARB = $8730; - GL_MODELVIEW17_ARB = $8731; - GL_MODELVIEW18_ARB = $8732; - GL_MODELVIEW19_ARB = $8733; - GL_MODELVIEW20_ARB = $8734; - GL_MODELVIEW21_ARB = $8735; - GL_MODELVIEW22_ARB = $8736; - GL_MODELVIEW23_ARB = $8737; - GL_MODELVIEW24_ARB = $8738; - GL_MODELVIEW25_ARB = $8739; - GL_MODELVIEW26_ARB = $873A; - GL_MODELVIEW27_ARB = $873B; - GL_MODELVIEW28_ARB = $873C; - GL_MODELVIEW29_ARB = $873D; - GL_MODELVIEW30_ARB = $873E; - GL_MODELVIEW31_ARB = $873F; - GL_CURRENT_WEIGHT_ARB = $86A8; - GL_WEIGHT_ARRAY_TYPE_ARB = $86A9; - GL_WEIGHT_ARRAY_STRIDE_ARB = $86AA; - GL_WEIGHT_ARRAY_SIZE_ARB = $86AB; - GL_WEIGHT_ARRAY_POINTER_ARB = $86AC; - GL_WEIGHT_ARRAY_ARB = $86AD; - - procedure glWeightbvARB(size: GLint; weights: PGLbyte); external dllname; - procedure glWeightsvARB(size: GLint; weights: PGLshort); external dllname; - procedure glWeightivARB(size: GLint; weights: PGLint); external dllname; - procedure glWeightfvARB(size: GLint; weights: PGLfloat); external dllname; - procedure glWeightdvARB(size: GLint; weights: PGLdouble); external dllname; - procedure glWeightvARB(size: GLint; weights: PGLdouble); external dllname; - procedure glWeightubvARB(size: GLint; weights: PGLubyte); external dllname; - procedure glWeightusvARB(size: GLint; weights: PGLushort); external dllname; - procedure glWeightuivARB(size: GLint; weights: PGLuint); external dllname; - procedure glWeightPointerARB(size: GLint; thetype: GLenum; stride: GLsizei; pointer: PGLvoid); external dllname; - procedure glVertexBlendARB(count: GLint); external dllname; - -function Load_GL_ARB_vertex_blend: Boolean; - -//***** GL_ARB_vertex_program *****// -const - GL_VERTEX_PROGRAM_ARB = $8620; - GL_VERTEX_PROGRAM_POINT_SIZE_ARB = $8642; - GL_VERTEX_PROGRAM_TWO_SIDE_ARB = $8643; - GL_COLOR_SUM_ARB = $8458; - GL_PROGRAM_FORMAT_ASCII_ARB = $8875; - GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = $8622; - GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = $8623; - GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = $8624; - GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = $8625; - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = $886A; - GL_CURRENT_VERTEX_ATTRIB_ARB = $8626; - GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = $8645; - GL_PROGRAM_LENGTH_ARB = $8627; - GL_PROGRAM_FORMAT_ARB = $8876; - GL_PROGRAM_BINDING_ARB = $8677; - GL_PROGRAM_INSTRUCTIONS_ARB = $88A0; - GL_MAX_PROGRAM_INSTRUCTIONS_ARB = $88A1; - GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A2; - GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = $88A3; - GL_PROGRAM_TEMPORARIES_ARB = $88A4; - GL_MAX_PROGRAM_TEMPORARIES_ARB = $88A5; - GL_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A6; - GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = $88A7; - GL_PROGRAM_PARAMETERS_ARB = $88A8; - GL_MAX_PROGRAM_PARAMETERS_ARB = $88A9; - GL_PROGRAM_NATIVE_PARAMETERS_ARB = $88AA; - GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB = $88AB; - GL_PROGRAM_ATTRIBS_ARB = $88AC; - GL_MAX_PROGRAM_ATTRIBS_ARB = $88AD; - GL_PROGRAM_NATIVE_ATTRIBS_ARB = $88AE; - GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB = $88AF; - GL_PROGRAM_ADDRESS_REGISTERS_ARB = $88B0; - GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = $88B1; - GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B2; - GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = $88B3; - GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB = $88B4; - GL_MAX_PROGRAM_ENV_PARAMETERS_ARB = $88B5; - GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB = $88B6; - GL_PROGRAM_STRING_ARB = $8628; - GL_PROGRAM_ERROR_POSITION_ARB = $864B; - GL_CURRENT_MATRIX_ARB = $8641; - GL_TRANSPOSE_CURRENT_MATRIX_ARB = $88B7; - GL_CURRENT_MATRIX_STACK_DEPTH_ARB = $8640; - GL_MAX_VERTEX_ATTRIBS_ARB = $8869; - GL_MAX_PROGRAM_MATRICES_ARB = $862F; - GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = $862E; - GL_PROGRAM_ERROR_STRING_ARB = $8874; - GL_MATRIX0_ARB = $88C0; - GL_MATRIX1_ARB = $88C1; - GL_MATRIX2_ARB = $88C2; - GL_MATRIX3_ARB = $88C3; - GL_MATRIX4_ARB = $88C4; - GL_MATRIX5_ARB = $88C5; - GL_MATRIX6_ARB = $88C6; - GL_MATRIX7_ARB = $88C7; - GL_MATRIX8_ARB = $88C8; - GL_MATRIX9_ARB = $88C9; - GL_MATRIX10_ARB = $88CA; - GL_MATRIX11_ARB = $88CB; - GL_MATRIX12_ARB = $88CC; - GL_MATRIX13_ARB = $88CD; - GL_MATRIX14_ARB = $88CE; - GL_MATRIX15_ARB = $88CF; - GL_MATRIX16_ARB = $88D0; - GL_MATRIX17_ARB = $88D1; - GL_MATRIX18_ARB = $88D2; - GL_MATRIX19_ARB = $88D3; - GL_MATRIX20_ARB = $88D4; - GL_MATRIX21_ARB = $88D5; - GL_MATRIX22_ARB = $88D6; - GL_MATRIX23_ARB = $88D7; - GL_MATRIX24_ARB = $88D8; - GL_MATRIX25_ARB = $88D9; - GL_MATRIX26_ARB = $88DA; - GL_MATRIX27_ARB = $88DB; - GL_MATRIX28_ARB = $88DC; - GL_MATRIX29_ARB = $88DD; - GL_MATRIX30_ARB = $88DE; - GL_MATRIX31_ARB = $88DF; - - procedure glVertexAttrib1sARB(index: GLuint; x: GLshort); external dllname; - procedure glVertexAttrib1fARB(index: GLuint; x: GLfloat); external dllname; - procedure glVertexAttrib1dARB(index: GLuint; x: GLdouble); external dllname; - procedure glVertexAttrib2sARB(index: GLuint; x: GLshort; y: GLshort); external dllname; - procedure glVertexAttrib2fARB(index: GLuint; x: GLfloat; y: GLfloat); external dllname; - procedure glVertexAttrib2dARB(index: GLuint; x: GLdouble; y: GLdouble); external dllname; - procedure glVertexAttrib3sARB(index: GLuint; x: GLshort; y: GLshort; z: GLshort); external dllname; - procedure glVertexAttrib3fARB(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glVertexAttrib3dARB(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); external dllname; - procedure glVertexAttrib4sARB(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); external dllname; - procedure glVertexAttrib4fARB(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glVertexAttrib4dARB(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glVertexAttrib4NubARB(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); external dllname; - procedure glVertexAttrib1svARB(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib1fvARB(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib1dvARB(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib2svARB(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib2fvARB(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib2dvARB(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib3svARB(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib3fvARB(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib3dvARB(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib4bvARB(index: GLuint; const v: PGLbyte); external dllname; - procedure glVertexAttrib4svARB(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib4ivARB(index: GLuint; const v: PGLint); external dllname; - procedure glVertexAttrib4ubvARB(index: GLuint; const v: PGLubyte); external dllname; - procedure glVertexAttrib4usvARB(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttrib4uivARB(index: GLuint; const v: PGLuint); external dllname; - procedure glVertexAttrib4fvARB(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib4dvARB(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib4NbvARB(index: GLuint; const v: PGLbyte); external dllname; - procedure glVertexAttrib4NsvARB(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib4NivARB(index: GLuint; const v: PGLint); external dllname; - procedure glVertexAttrib4NubvARB(index: GLuint; const v: PGLubyte); external dllname; - procedure glVertexAttrib4NusvARB(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttrib4NuivARB(index: GLuint; const v: PGLuint); external dllname; - procedure glVertexAttribPointerARB(index: GLuint; size: GLint; thetype: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); external dllname; - procedure glEnableVertexAttribArrayARB(index: GLuint); external dllname; - procedure glDisableVertexAttribArrayARB(index: GLuint); external dllname; - procedure glProgramStringARB(target: GLenum; format: GLenum; len: GLsizei; const str: PGLvoid); external dllname; - procedure glBindProgramARB(target: GLenum; theProgram: GLuint); external dllname; - procedure glDeleteProgramsARB(n: GLsizei; const programs: PGLuint); external dllname; - procedure glGenProgramsARB(n: GLsizei; programs: PGLuint); external dllname; - procedure glProgramEnvParameter4dARB(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glProgramEnvParameter4dvARB(target: GLenum; index: GLuint; const params: PGLdouble); external dllname; - procedure glProgramEnvParameter4fARB(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glProgramEnvParameter4fvARB(target: GLenum; index: GLuint; const params: PGLfloat); external dllname; - procedure glProgramLocalParameter4dARB(target: GLenum; index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glProgramLocalParameter4dvARB(target: GLenum; index: GLuint; const params: PGLdouble); external dllname; - procedure glProgramLocalParameter4fARB(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glProgramLocalParameter4fvARB(target: GLenum; index: GLuint; const params: PGLfloat); external dllname; - procedure glGetProgramEnvParameterdvARB(target: GLenum; index: GLuint; params: PGLdouble); external dllname; - procedure glGetProgramEnvParameterfvARB(target: GLenum; index: GLuint; params: PGLfloat); external dllname; - procedure glGetProgramLocalParameterdvARB(target: GLenum; index: GLuint; params: PGLdouble); external dllname; - procedure glGetProgramLocalParameterfvARB(target: GLenum; index: GLuint; params: PGLfloat); external dllname; - procedure glGetProgramivARB(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetProgramStringARB(target: GLenum; pname: GLenum; str: PGLvoid); external dllname; - procedure glGetVertexAttribdvARB(index: GLuint; pname: GLenum; params: PGLdouble); external dllname; - procedure glGetVertexAttribfvARB(index: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetVertexAttribivARB(index: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetVertexAttribPointervARB(index: GLuint; pname: GLenum; pointer: PGLvoid); external dllname; - function glIsProgramARB(theProgram: GLuint): GLboolean; external dllname; - -function Load_GL_ARB_vertex_program: Boolean; - -//***** GL_ARB_window_pos *****// - - procedure glWindowPos2dARB(x: GLdouble; y: GLdouble); external dllname; - procedure glWindowPos2fARB(x: GLfloat; y: GLfloat); external dllname; - procedure glWindowPos2iARB(x: GLint; y: GLint); external dllname; - procedure glWindowPos2sARB(x: GLshort; y: GLshort); external dllname; - procedure glWindowPos2dvARB(const p: PGLdouble); external dllname; - procedure glWindowPos2fvARB(const p: PGLfloat); external dllname; - procedure glWindowPos2ivARB(const p: PGLint); external dllname; - procedure glWindowPos2svARB(const p: PGLshort); external dllname; - procedure glWindowPos3dARB(x: GLdouble; y: GLdouble; z: GLdouble); external dllname; - procedure glWindowPos3fARB(x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glWindowPos3iARB(x: GLint; y: GLint; z: GLint); external dllname; - procedure glWindowPos3sARB(x: GLshort; y: GLshort; z: GLshort); external dllname; - procedure glWindowPos3dvARB(const p: PGLdouble); external dllname; - procedure glWindowPos3fvARB(const p: PGLfloat); external dllname; - procedure glWindowPos3ivARB(const p: PGLint); external dllname; - procedure glWindowPos3svARB(const p: PGLshort); external dllname; - -function Load_GL_ARB_window_pos: Boolean; - -//***** GL_EXT_422_pixels *****// -const - GL_422_EXT = $80CC; - GL_422_REV_EXT = $80CD; - GL_422_AVERAGE_EXT = $80CE; - GL_422_REV_AVERAGE_EXT = $80CF; - -function Load_GL_EXT_422_pixels: Boolean; - -//***** GL_EXT_abgr *****// -const - GL_ABGR_EXT = $8000; - -function Load_GL_EXT_abgr: Boolean; - -//***** GL_EXT_bgra *****// -const - GL_BGR_EXT = $80E0; - GL_BGRA_EXT = $80E1; - -function Load_GL_EXT_bgra: Boolean; - -//***** GL_EXT_blend_color *****// -const - GL_CONSTANT_COLOR_EXT = $8001; - GL_ONE_MINUS_CONSTANT_COLOR_EXT = $8002; - GL_CONSTANT_ALPHA_EXT = $8003; - GL_ONE_MINUS_CONSTANT_ALPHA_EXT = $8004; - GL_BLEND_COLOR_EXT = $8005; - - procedure glBlendColorEXT(red: GLclampf; green: GLclampf; blue: GLclampf; alpha: GLclampf); external dllname; - -function Load_GL_EXT_blend_color: Boolean; - -//***** GL_EXT_blend_func_separate *****// -const - GL_BLEND_DST_RGB_EXT = $80C8; - GL_BLEND_SRC_RGB_EXT = $80C9; - GL_BLEND_DST_ALPHA_EXT = $80CA; - GL_BLEND_SRC_ALPHA_EXT = $80CB; - -procedure glBlendFuncSeparateEXT(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); external dllname; - -function Load_GL_EXT_blend_func_separate: Boolean; - -//***** GL_EXT_blend_logic_op *****// - -function Load_GL_EXT_blend_logic_op: Boolean; - -//***** GL_EXT_blend_minmax *****// -const - GL_FUNC_ADD_EXT = $8006; - GL_MIN_EXT = $8007; - GL_MAX_EXT = $8008; - GL_BLEND_EQUATION_EXT = $8009; - - procedure glBlendEquationEXT(mode: GLenum); external dllname; - -function Load_GL_EXT_blend_minmax: Boolean; - -//***** GL_EXT_blend_subtract *****// -const - GL_FUNC_SUBTRACT_EXT = $800A; - GL_FUNC_REVERSE_SUBTRACT_EXT = $800B; - -function Load_GL_EXT_blend_subtract: Boolean; - -//***** GL_EXT_clip_volume_hint *****// -const - GL_CLIP_VOLUME_CLIPPING_HINT_EXT = $80F0; - -function Load_GL_EXT_clip_volume_hint: Boolean; - -//***** GL_EXT_color_subtable *****// - - procedure glColorSubTableEXT(target: GLenum; start: GLsizei; count: GLsizei; format: GLenum; thetype: GLenum; const data: PGLvoid); external dllname; - procedure glCopyColorSubTableEXT(target: GLenum; start: GLsizei; x: GLint; y: GLint; width: GLsizei); external dllname; - -function Load_GL_EXT_color_subtable: Boolean; - -//***** GL_EXT_compiled_vertex_array *****// -const - GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = $81A8; - GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = $81A9; - - procedure glLockArraysEXT(first: GLint; count: GLsizei); external dllname; - procedure glUnlockArraysEXT(); external dllname; - -function Load_GL_EXT_compiled_vertex_array: Boolean; - -//***** GL_EXT_convolution *****// -const - GL_CONVOLUTION_1D_EXT = $8010; - GL_CONVOLUTION_2D_EXT = $8011; - GL_SEPARABLE_2D_EXT = $8012; - GL_CONVOLUTION_BORDER_MODE_EXT = $8013; - GL_CONVOLUTION_FILTER_SCALE_EXT = $8014; - GL_CONVOLUTION_FILTER_BIAS_EXT = $8015; - GL_REDUCE_EXT = $8016; - GL_CONVOLUTION_FORMAT_EXT = $8017; - GL_CONVOLUTION_WIDTH_EXT = $8018; - GL_CONVOLUTION_HEIGHT_EXT = $8019; - GL_MAX_CONVOLUTION_WIDTH_EXT = $801A; - GL_MAX_CONVOLUTION_HEIGHT_EXT = $801B; - GL_POST_CONVOLUTION_RED_SCALE_EXT = $801C; - GL_POST_CONVOLUTION_GREEN_SCALE_EXT = $801D; - GL_POST_CONVOLUTION_BLUE_SCALE_EXT = $801E; - GL_POST_CONVOLUTION_ALPHA_SCALE_EXT = $801F; - GL_POST_CONVOLUTION_RED_BIAS_EXT = $8020; - GL_POST_CONVOLUTION_GREEN_BIAS_EXT = $8021; - GL_POST_CONVOLUTION_BLUE_BIAS_EXT = $8022; - GL_POST_CONVOLUTION_ALPHA_BIAS_EXT = $8023; - - procedure glConvolutionFilter1DEXT(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; thetype: GLenum; const image: PGLvoid); external dllname; - procedure glConvolutionFilter2DEXT(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; thetype: GLenum; const image: PGLvoid); external dllname; - procedure glCopyConvolutionFilter1DEXT(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); external dllname; - procedure glCopyConvolutionFilter2DEXT(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei; height: GLsizei); external dllname; - procedure glGetConvolutionFilterEXT(target: GLenum; format: GLenum; thetype: GLenum; image: PGLvoid); external dllname; - procedure glSeparableFilter2DEXT(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei; format: GLenum; thetype: GLenum; const row: PGLvoid; const column: PGLvoid); external dllname; - procedure glGetSeparableFilterEXT(target: GLenum; format: GLenum; thetype: GLenum; row: PGLvoid; column: PGLvoid; span: PGLvoid); external dllname; - procedure glConvolutionParameteriEXT(target: GLenum; pname: GLenum; param: GLint); external dllname; - procedure glConvolutionParameterivEXT(target: GLenum; pname: GLenum; const params: PGLint); external dllname; - procedure glConvolutionParameterfEXT(target: GLenum; pname: GLenum; param: GLfloat); external dllname; - procedure glConvolutionParameterfvEXT(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; - procedure glGetConvolutionParameterivEXT(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetConvolutionParameterfvEXT(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_EXT_convolution: Boolean; - -//***** GL_EXT_fog_coord *****// -const - GL_FOG_COORDINATE_SOURCE_EXT = $8450; - GL_FOG_COORDINATE_EXT = $8451; - GL_FRAGMENT_DEPTH_EXT = $8452; - GL_CURRENT_FOG_COORDINATE_EXT = $8453; - GL_FOG_COORDINATE_ARRAY_TYPE_EXT = $8454; - GL_FOG_COORDINATE_ARRAY_STRIDE_EXT = $8455; - GL_FOG_COORDINATE_ARRAY_POINTER_EXT = $8456; - GL_FOG_COORDINATE_ARRAY_EXT = $8457; - - procedure glFogCoordfEXfloat(coord: GLfloat); external dllname; - procedure glFogCoorddEXdouble(coord: GLdouble); external dllname; - procedure glFogCoordfvEXfloat(coord: GLfloat); external dllname; - procedure glFogCoorddvEXdouble(coord: GLdouble); external dllname; - procedure glFogCoordPointerEXT(thetype: GLenum; stride: GLsizei; pointer: PGLvoid); external dllname; - -function Load_GL_EXT_fog_coord: Boolean; - -//***** GL_EXT_histogram *****// -const - GL_HISTOGRAM_EXT = $8024; - GL_PROXY_HISTOGRAM_EXT = $8025; - GL_HISTOGRAM_WIDTH_EXT = $8026; - GL_HISTOGRAM_FORMAT_EXT = $8027; - GL_HISTOGRAM_RED_SIZE_EXT = $8028; - GL_HISTOGRAM_GREEN_SIZE_EXT = $8029; - GL_HISTOGRAM_BLUE_SIZE_EXT = $802A; - GL_HISTOGRAM_ALPHA_SIZE_EXT = $802B; - GL_HISTOGRAM_LUMINANCE_SIZE_EXT = $802C; - GL_HISTOGRAM_SINK_EXT = $802D; - GL_MINMAX_EXT = $802E; - GL_MINMAX_FORMAT_EXT = $802F; - GL_MINMAX_SINK_EXT = $8030; - - procedure glHistogramEXT(target: GLenum; width: GLsizei; internalformat: GLenum; sink: GLboolean); external dllname; - procedure glResetHistogramEXT(target: GLenum); external dllname; - procedure glGetHistogramEXT(target: GLenum; reset: GLboolean; format: GLenum; thetype: GLenum; values: PGLvoid); external dllname; - procedure glGetHistogramParameterivEXT(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetHistogramParameterfvEXT(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glMinmaxEXT(target: GLenum; internalformat: GLenum; sink: GLboolean); external dllname; - procedure glResetMinmaxEXT(target: GLenum); external dllname; - procedure glGetMinmaxEXT(target: GLenum; reset: GLboolean; format: GLenum; thetype: GLenum; values: PGLvoid); external dllname; - procedure glGetMinmaxParameterivEXT(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetMinmaxParameterfvEXT(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_EXT_histogram: Boolean; - -//***** GL_EXT_multi_draw_arrays *****// - - procedure glMultiDrawArraysEXT(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); external dllname; - procedure glMultiDrawElementsEXT(mode: GLenum; count: PGLsizei; thetype: GLenum; const indices: PGLvoid; primcount: GLsizei); external dllname; - -function Load_GL_EXT_multi_draw_arrays: Boolean; - -//***** GL_EXT_packed_pixels *****// -const - GL_UNSIGNED_BYTE_3_3_2_EXT = $8032; - GL_UNSIGNED_SHORT_4_4_4_4_EXT = $8033; - GL_UNSIGNED_SHORT_5_5_5_1_EXT = $8034; - GL_UNSIGNED_INT_8_8_8_8_EXT = $8035; - GL_UNSIGNED_INT_10_10_10_2_EXT = $8036; - -function Load_GL_EXT_packed_pixels: Boolean; - -//***** GL_EXT_paletted_texture *****// -const - GL_COLOR_INDEX1_EXT = $80E2; - GL_COLOR_INDEX2_EXT = $80E3; - GL_COLOR_INDEX4_EXT = $80E4; - GL_COLOR_INDEX8_EXT = $80E5; - GL_COLOR_INDEX12_EXT = $80E6; - GL_COLOR_INDEX16_EXT = $80E7; - GL_COLOR_TABLE_FORMAT_EXT = $80D8; - GL_COLOR_TABLE_WIDTH_EXT = $80D9; - GL_COLOR_TABLE_RED_SIZE_EXT = $80DA; - GL_COLOR_TABLE_GREEN_SIZE_EXT = $80DB; - GL_COLOR_TABLE_BLUE_SIZE_EXT = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE_EXT = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE_EXT = $80DF; - GL_TEXTURE_INDEX_SIZE_EXT = $80ED; - GL_TEXTURE_1D = $0DE0; - GL_TEXTURE_2D = $0DE1; - GL_TEXTURE_3D_EXT = $806F; - // GL_TEXTURE_CUBE_MAP_ARB { already defined } - GL_PROXY_TEXTURE_1D = $8063; - GL_PROXY_TEXTURE_2D = $8064; - GL_PROXY_TEXTURE_3D_EXT = $8070; - // GL_PROXY_TEXTURE_CUBE_MAP_ARB { already defined } - // GL_TEXTURE_1D { already defined } - // GL_TEXTURE_2D { already defined } - // GL_TEXTURE_3D_EXT { already defined } - // GL_TEXTURE_CUBE_MAP_ARB { already defined } - - procedure glColorTableEXT(target: GLenum; internalFormat: GLenum; width: GLsizei; format: GLenum; thetype: GLenum; const data: PGLvoid); external dllname; - // glColorSubTableEXT { already defined } - procedure glGetColorTableEXT(target: GLenum; format: GLenum; thetype: GLenum; data: PGLvoid); external dllname; - procedure glGetColorTableParameterivEXT(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetColorTableParameterfvEXT(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_EXT_paletted_texture: Boolean; - -//***** GL_EXT_point_parameters *****// -const - GL_POINT_SIZE_MIN_EXT = $8126; - GL_POINT_SIZE_MAX_EXT = $8127; - GL_POINT_FADE_THRESHOLD_SIZE_EXT = $8128; - GL_DISTANCE_ATTENUATION_EXT = $8129; - - - procedure glPointParameterfEXT(pname: GLenum; param: GLfloat); external dllname; - procedure glPointParameterfvEXT(pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_EXT_point_parameters: Boolean; - -//***** GL_EXT_polygon_offset *****// -const - GL_POLYGON_OFFSET_EXT = $8037; - GL_POLYGON_OFFSET_FACTOR_EXT = $8038; - GL_POLYGON_OFFSET_BIAS_EXT = $8039; - procedure glPolygonOffsetEXT(factor: GLfloat; bias: GLfloat); external dllname; - -function Load_GL_EXT_polygon_offset: Boolean; - -//***** GL_EXT_secondary_color *****// -const - GL_COLOR_SUM_EXT = $8458; - GL_CURRENT_SECONDARY_COLOR_EXT = $8459; - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT = $845A; - GL_SECONDARY_COLOR_ARRAY_TYPE_EXT = $845B; - GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = $845C; - GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = $845D; - GL_SECONDARY_COLOR_ARRAY_EXT = $845E; - procedure glSecondaryColor3bEXT(components: GLbyte); external dllname; - procedure glSecondaryColor3sEXT(components: GLshort); external dllname; - procedure glSecondaryColor3iEXT(components: GLint); external dllname; - procedure glSecondaryColor3fEXT(components: GLfloat); external dllname; - procedure glSecondaryColor3dEXT(components: GLdouble); external dllname; - procedure glSecondaryColor3ubEXT(components: GLubyte); external dllname; - procedure glSecondaryColor3usEXT(components: GLushort); external dllname; - procedure glSecondaryColor3uiEXT(components: GLuint); external dllname; - procedure glSecondaryColor3bvEXT(components: GLbyte); external dllname; - procedure glSecondaryColor3svEXT(components: GLshort); external dllname; - procedure glSecondaryColor3ivEXT(components: GLint); external dllname; - procedure glSecondaryColor3fvEXT(components: GLfloat); external dllname; - procedure glSecondaryColor3dvEXT(components: GLdouble); external dllname; - procedure glSecondaryColor3ubvEXT(components: GLubyte); external dllname; - procedure glSecondaryColor3usvEXT(components: GLushort); external dllname; - procedure glSecondaryColor3uivEXT(components: GLuint); external dllname; - procedure glSecondaryColorPointerEXT(size: GLint; thetype: GLenum; stride: GLsizei; pointer: PGLvoid); external dllname; - -function Load_GL_EXT_secondary_color: Boolean; - -//***** GL_EXT_separate_specular_color *****// -const - GL_LIGHT_MODEL_COLOR_CONTROL_EXT = $81F8; - GL_SINGLE_COLOR_EXT = $81F9; - GL_SEPARATE_SPECULAR_COLOR_EXT = $81FA; - -function Load_GL_EXT_separate_specular_color: Boolean; - -//***** GL_EXT_shadow_funcs *****// - -function Load_GL_EXT_shadow_funcs: Boolean; - -//***** GL_EXT_shared_texture_palette *****// -const - GL_SHARED_TEXTURE_PALETTE_EXT = $81FB; - -function Load_GL_EXT_shared_texture_palette: Boolean; - -//***** GL_EXT_stencil_two_side *****// -const - GL_STENCIL_TEST_TWO_SIDE_EXT = $8910; - GL_ACTIVE_STENCIL_FACE_EXT = $8911; - - procedure glActiveStencilFaceEXT(face: GLenum); external dllname; - -function Load_GL_EXT_stencil_two_side: Boolean; - -//***** GL_EXT_stencil_wrap *****// -const - GL_INCR_WRAP_EXT = $8507; - GL_DECR_WRAP_EXT = $8508; - -function Load_GL_EXT_stencil_wrap: Boolean; - -//***** GL_EXT_subtexture *****// - - procedure glTexSubImage1DEXT(target: GLenum; level: GLint; xoffset: GLint; width: GLsizei; format: GLenum; thetype: GLenum; const pixels: PGLvoid); external dllname; - procedure glTexSubImage2DEXT(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; width: GLsizei; height: GLsizei; format: GLenum; thetype: GLenum; const pixels: PGLvoid); external dllname; - procedure glTexSubImage3DEXT(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; thetype: GLenum; const pixels: PGLvoid); external dllname; - -function Load_GL_EXT_subtexture: Boolean; - -//***** GL_EXT_texture3D *****// -const - GL_PACK_SKIP_IMAGES_EXT = $806B; - GL_PACK_IMAGE_HEIGHT_EXT = $806C; - GL_UNPACK_SKIP_IMAGES_EXT = $806D; - GL_UNPACK_IMAGE_HEIGHT_EXT = $806E; - // GL_TEXTURE_3D_EXT { already defined } - // GL_PROXY_TEXTURE_3D_EXT { already defined } - GL_TEXTURE_DEPTH_EXT = $8071; - GL_TEXTURE_WRAP_R_EXT = $8072; - GL_MAX_3D_TEXTURE_SIZE_EXT = $8073; - - procedure glTexImage3DEXT(target: GLenum; level: GLint; internalformat: GLenum; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; thetype: GLenum; const pixels: PGLvoid); external dllname; - -function Load_GL_EXT_texture3D: Boolean; - -//***** GL_EXT_texture_compression_s3tc *****// -const - GL_COMPRESSED_RGB_S3TC_DXT1_EXT = $83F0; - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = $83F1; - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = $83F2; - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = $83F3; - -function Load_GL_EXT_texture_compression_s3tc: Boolean; - -//***** GL_EXT_texture_env_add *****// - -function Load_GL_EXT_texture_env_add: Boolean; - -//***** GL_EXT_texture_env_combine *****// -const - GL_COMBINE_EXT = $8570; - GL_COMBINE_RGB_EXT = $8571; - GL_COMBINE_ALPHA_EXT = $8572; - GL_SOURCE0_RGB_EXT = $8580; - GL_SOURCE1_RGB_EXT = $8581; - GL_SOURCE2_RGB_EXT = $8582; - GL_SOURCE0_ALPHA_EXT = $8588; - GL_SOURCE1_ALPHA_EXT = $8589; - GL_SOURCE2_ALPHA_EXT = $858A; - GL_OPERAND0_RGB_EXT = $8590; - GL_OPERAND1_RGB_EXT = $8591; - GL_OPERAND2_RGB_EXT = $8592; - GL_OPERAND0_ALPHA_EXT = $8598; - GL_OPERAND1_ALPHA_EXT = $8599; - GL_OPERAND2_ALPHA_EXT = $859A; - GL_RGB_SCALE_EXT = $8573; - GL_ADD_SIGNED_EXT = $8574; - GL_INTERPOLATE_EXT = $8575; - GL_CONSTANT_EXT = $8576; - GL_PRIMARY_COLOR_EXT = $8577; - GL_PREVIOUS_EXT = $8578; - -function Load_GL_EXT_texture_env_combine: Boolean; - -//***** GL_EXT_texture_env_dot3 *****// -const - GL_DOT3_RGB_EXT = $8740; - GL_DOT3_RGBA_EXT = $8741; - -function Load_GL_EXT_texture_env_dot3: Boolean; - -//***** GL_EXT_texture_filter_anisotropic *****// -const - GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE; - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF; - -function Load_GL_EXT_texture_filter_anisotropic: Boolean; - -//***** GL_EXT_texture_lod_bias *****// -const - GL_TEXTURE_FILTER_CONTROL_EXT = $8500; - GL_TEXTURE_LOD_BIAS_EXT = $8501; - GL_MAX_TEXTURE_LOD_BIAS_EXT = $84FD; - -function Load_GL_EXT_texture_lod_bias: Boolean; - -//***** GL_EXT_texture_object *****// -const - GL_TEXTURE_PRIORITY_EXT = $8066; - GL_TEXTURE_RESIDENT_EXT = $8067; - GL_TEXTURE_1D_BINDING_EXT = $8068; - GL_TEXTURE_2D_BINDING_EXT = $8069; - GL_TEXTURE_3D_BINDING_EXT = $806A; - - procedure glGenTexturesEXT(n: GLsizei; textures: PGLuint); external dllname; - procedure glDeleteTexturesEXT(n: GLsizei; const textures: PGLuint); external dllname; - procedure glBindTextureEXT(target: GLenum; texture: GLuint); external dllname; - procedure glPrioritizeTexturesEXT(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); external dllname; - function glAreTexturesResidentEXT(n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; external dllname; - function glIsTextureEXT(texture: GLuint): GLboolean; external dllname; - -function Load_GL_EXT_texture_object: Boolean; - -//***** GL_EXT_vertex_array *****// -const - GL_VERTEX_ARRAY_EXT = $8074; - GL_NORMAL_ARRAY_EXT = $8075; - GL_COLOR_ARRAY_EXT = $8076; - GL_INDEX_ARRAY_EXT = $8077; - GL_TEXTURE_COORD_ARRAY_EXT = $8078; - GL_EDGE_FLAG_ARRAY_EXT = $8079; - GL_DOUBLE_EXT = $140A; - GL_VERTEX_ARRAY_SIZE_EXT = $807A; - GL_VERTEX_ARRAY_TYPE_EXT = $807B; - GL_VERTEX_ARRAY_STRIDE_EXT = $807C; - GL_VERTEX_ARRAY_COUNT_EXT = $807D; - GL_NORMAL_ARRAY_TYPE_EXT = $807E; - GL_NORMAL_ARRAY_STRIDE_EXT = $807F; - GL_NORMAL_ARRAY_COUNT_EXT = $8080; - GL_COLOR_ARRAY_SIZE_EXT = $8081; - GL_COLOR_ARRAY_TYPE_EXT = $8082; - GL_COLOR_ARRAY_STRIDE_EXT = $8083; - GL_COLOR_ARRAY_COUNT_EXT = $8084; - GL_INDEX_ARRAY_TYPE_EXT = $8085; - GL_INDEX_ARRAY_STRIDE_EXT = $8086; - GL_INDEX_ARRAY_COUNT_EXT = $8087; - GL_TEXTURE_COORD_ARRAY_SIZE_EXT = $8088; - GL_TEXTURE_COORD_ARRAY_TYPE_EXT = $8089; - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = $808A; - GL_TEXTURE_COORD_ARRAY_COUNT_EXT = $808B; - GL_EDGE_FLAG_ARRAY_STRIDE_EXT = $808C; - GL_EDGE_FLAG_ARRAY_COUNT_EXT = $808D; - GL_VERTEX_ARRAY_POINTER_EXT = $808E; - GL_NORMAL_ARRAY_POINTER_EXT = $808F; - GL_COLOR_ARRAY_POINTER_EXT = $8090; - GL_INDEX_ARRAY_POINTER_EXT = $8091; - GL_TEXTURE_COORD_ARRAY_POINTER_EXT = $8092; - GL_EDGE_FLAG_ARRAY_POINTER_EXT = $8093; - - procedure glArrayElementEXT(i: GLint); external dllname; - procedure glDrawArraysEXT(mode: GLenum; first: GLint; count: GLsizei); external dllname; - procedure glVertexPointerEXT(size: GLint; thetype: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); external dllname; - procedure glNormalPointerEXT(thetype: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); external dllname; - procedure glColorPointerEXT(size: GLint; thetype: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); external dllname; - procedure glIndexPointerEXT(thetype: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); external dllname; - procedure glTexCoordPointerEXT(size: GLint; thetype: GLenum; stride: GLsizei; count: GLsizei; const pointer: PGLvoid); external dllname; - procedure glEdgeFlagPointerEXT(stride: GLsizei; count: GLsizei; const pointer: PGLboolean); external dllname; - procedure glGetPointervEXT(pname: GLenum; params: PGLvoid); external dllname; - -function Load_GL_EXT_vertex_array: Boolean; - -//***** GL_EXT_vertex_shader *****// -const - GL_VERTEX_SHADER_EXT = $8780; - GL_VARIANT_VALUE_EXT = $87E4; - GL_VARIANT_DATATYPE_EXT = $87E5; - GL_VARIANT_ARRAY_STRIDE_EXT = $87E6; - GL_VARIANT_ARRAY_TYPE_EXT = $87E7; - GL_VARIANT_ARRAY_EXT = $87E8; - GL_VARIANT_ARRAY_POINTER_EXT = $87E9; - GL_INVARIANT_VALUE_EXT = $87EA; - GL_INVARIANT_DATATYPE_EXT = $87EB; - GL_LOCAL_CONSTANT_VALUE_EXT = $87EC; - GL_LOCAL_CONSTANT_DATATYPE_EXT = $87ED; - GL_OP_INDEX_EXT = $8782; - GL_OP_NEGATE_EXT = $8783; - GL_OP_DOT3_EXT = $8784; - GL_OP_DOT4_EXT = $8785; - GL_OP_MUL_EXT = $8786; - GL_OP_ADD_EXT = $8787; - GL_OP_MADD_EXT = $8788; - GL_OP_FRAC_EXT = $8789; - GL_OP_MAX_EXT = $878A; - GL_OP_MIN_EXT = $878B; - GL_OP_SET_GE_EXT = $878C; - GL_OP_SET_LT_EXT = $878D; - GL_OP_CLAMP_EXT = $878E; - GL_OP_FLOOR_EXT = $878F; - GL_OP_ROUND_EXT = $8790; - GL_OP_EXP_BASE_2_EXT = $8791; - GL_OP_LOG_BASE_2_EXT = $8792; - GL_OP_POWER_EXT = $8793; - GL_OP_RECIP_EXT = $8794; - GL_OP_RECIP_SQRT_EXT = $8795; - GL_OP_SUB_EXT = $8796; - GL_OP_CROSS_PRODUCT_EXT = $8797; - GL_OP_MULTIPLY_MATRIX_EXT = $8798; - GL_OP_MOV_EXT = $8799; - GL_OUTPUT_VERTEX_EXT = $879A; - GL_OUTPUT_COLOR0_EXT = $879B; - GL_OUTPUT_COLOR1_EXT = $879C; - GL_OUTPUT_TEXTURE_COORD0_EXT = $879D; - GL_OUTPUT_TEXTURE_COORD1_EXT = $879E; - GL_OUTPUT_TEXTURE_COORD2_EXT = $879F; - GL_OUTPUT_TEXTURE_COORD3_EXT = $87A0; - GL_OUTPUT_TEXTURE_COORD4_EXT = $87A1; - GL_OUTPUT_TEXTURE_COORD5_EXT = $87A2; - GL_OUTPUT_TEXTURE_COORD6_EXT = $87A3; - GL_OUTPUT_TEXTURE_COORD7_EXT = $87A4; - GL_OUTPUT_TEXTURE_COORD8_EXT = $87A5; - GL_OUTPUT_TEXTURE_COORD9_EXT = $87A6; - GL_OUTPUT_TEXTURE_COORD10_EXT = $87A7; - GL_OUTPUT_TEXTURE_COORD11_EXT = $87A8; - GL_OUTPUT_TEXTURE_COORD12_EXT = $87A9; - GL_OUTPUT_TEXTURE_COORD13_EXT = $87AA; - GL_OUTPUT_TEXTURE_COORD14_EXT = $87AB; - GL_OUTPUT_TEXTURE_COORD15_EXT = $87AC; - GL_OUTPUT_TEXTURE_COORD16_EXT = $87AD; - GL_OUTPUT_TEXTURE_COORD17_EXT = $87AE; - GL_OUTPUT_TEXTURE_COORD18_EXT = $87AF; - GL_OUTPUT_TEXTURE_COORD19_EXT = $87B0; - GL_OUTPUT_TEXTURE_COORD20_EXT = $87B1; - GL_OUTPUT_TEXTURE_COORD21_EXT = $87B2; - GL_OUTPUT_TEXTURE_COORD22_EXT = $87B3; - GL_OUTPUT_TEXTURE_COORD23_EXT = $87B4; - GL_OUTPUT_TEXTURE_COORD24_EXT = $87B5; - GL_OUTPUT_TEXTURE_COORD25_EXT = $87B6; - GL_OUTPUT_TEXTURE_COORD26_EXT = $87B7; - GL_OUTPUT_TEXTURE_COORD27_EXT = $87B8; - GL_OUTPUT_TEXTURE_COORD28_EXT = $87B9; - GL_OUTPUT_TEXTURE_COORD29_EXT = $87BA; - GL_OUTPUT_TEXTURE_COORD30_EXT = $87BB; - GL_OUTPUT_TEXTURE_COORD31_EXT = $87BC; - GL_OUTPUT_FOG_EXT = $87BD; - GL_SCALAR_EXT = $87BE; - GL_VECTOR_EXT = $87BF; - GL_MATRIX_EXT = $87C0; - GL_VARIANT_EXT = $87C1; - GL_INVARIANT_EXT = $87C2; - GL_LOCAL_CONSTANT_EXT = $87C3; - GL_LOCAL_EXT = $87C4; - GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = $87C5; - GL_MAX_VERTEX_SHADER_VARIANTS_EXT = $87C6; - GL_MAX_VERTEX_SHADER_INVARIANTS_EXT = $87C7; - GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87C8; - GL_MAX_VERTEX_SHADER_LOCALS_EXT = $87C9; - GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CA; - GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = $87CB; - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87CC; - GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = $87CD; - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = $87CE; - GL_VERTEX_SHADER_INSTRUCTIONS_EXT = $87CF; - GL_VERTEX_SHADER_VARIANTS_EXT = $87D0; - GL_VERTEX_SHADER_INVARIANTS_EXT = $87D1; - GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = $87D2; - GL_VERTEX_SHADER_LOCALS_EXT = $87D3; - GL_VERTEX_SHADER_BINDING_EXT = $8781; - GL_VERTEX_SHADER_OPTIMIZED_EXT = $87D4; - GL_X_EXT = $87D5; - GL_Y_EXT = $87D6; - GL_Z_EXT = $87D7; - GL_W_EXT = $87D8; - GL_NEGATIVE_X_EXT = $87D9; - GL_NEGATIVE_Y_EXT = $87DA; - GL_NEGATIVE_Z_EXT = $87DB; - GL_NEGATIVE_W_EXT = $87DC; - GL_ZERO_EXT = $87DD; - GL_ONE_EXT = $87DE; - GL_NEGATIVE_ONE_EXT = $87DF; - GL_NORMALIZED_RANGE_EXT = $87E0; - GL_FULL_RANGE_EXT = $87E1; - GL_CURRENT_VERTEX_EXT = $87E2; - GL_MVP_MATRIX_EXT = $87E3; - - procedure glBeginVertexShaderEXT(); external dllname; - procedure glEndVertexShaderEXT(); external dllname; - procedure glBindVertexShaderEXT(id: GLuint); external dllname; - function glGenVertexShadersEXT(range: GLuint): GLuint; external dllname; - procedure glDeleteVertexShaderEXT(id: GLuint); external dllname; - procedure glShaderOp1EXT(op: GLenum; res: GLuint; arg1: GLuint); external dllname; - procedure glShaderOp2EXT(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint); external dllname; - procedure glShaderOp3EXT(op: GLenum; res: GLuint; arg1: GLuint; arg2: GLuint; arg3: GLuint); external dllname; - procedure glSwizzleEXT(res: GLuint; theIn: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); external dllname; - procedure glWriteMaskEXT(res: GLuint; theIn: GLuint; outX: GLenum; outY: GLenum; outZ: GLenum; outW: GLenum); external dllname; - procedure glInsertComponentEXT(res: GLuint; src: GLuint; num: GLuint); external dllname; - procedure glExtractComponentEXT(res: GLuint; src: GLuint; num: GLuint); external dllname; - function glGenSymbolsEXT(datatype: GLenum; storagetype: GLenum; range: GLenum; components: GLuint): GLuint; external dllname; - procedure glSetInvariantEXT(id: GLuint; thetype: GLenum; addr: PGLvoid); external dllname; - procedure glSetLocalConstantEXT(id: GLuint; thetype: GLenum; addr: PGLvoid); external dllname; - procedure glVariantbvEXT(id: GLuint; addr: PGLbyte); external dllname; - procedure glVariantsvEXT(id: GLuint; addr: PGLshort); external dllname; - procedure glVariantivEXT(id: GLuint; addr: PGLint); external dllname; - procedure glVariantfvEXT(id: GLuint; addr: PGLfloat); external dllname; - procedure glVariantdvEXT(id: GLuint; addr: PGLdouble); external dllname; - procedure glVariantubvEXT(id: GLuint; addr: PGLubyte); external dllname; - procedure glVariantusvEXT(id: GLuint; addr: PGLushort); external dllname; - procedure glVariantuivEXT(id: GLuint; addr: PGLuint); external dllname; - procedure glVariantPointerEXT(id: GLuint; thetype: GLenum; stride: GLuint; addr: PGLvoid); external dllname; - procedure glEnableVariantClientStateEXT(id: GLuint); external dllname; - procedure glDisableVariantClientStateEXT(id: GLuint); external dllname; - function glBindLightParameterEXT(light: GLenum; value: GLenum): GLuint; external dllname; - function glBindMaterialParameterEXT(face: GLenum; value: GLenum): GLuint; external dllname; - function glBindTexGenParameterEXT(theunit: GLenum; coord: GLenum; value: GLenum): GLuint; external dllname; - function glBindTextureUnitParameterEXT(theunit: GLenum; value: GLenum): GLuint; external dllname; - function glBindParameterEXT(value: GLenum): GLuint; external dllname; - function glIsVariantEnabledEXT(id: GLuint; cap: GLenum): GLboolean; external dllname; - procedure glGetVariantBooleanvEXT(id: GLuint; value: GLenum; data: PGLboolean); external dllname; - procedure glGetVariantIntegervEXT(id: GLuint; value: GLenum; data: PGLint); external dllname; - procedure glGetVariantFloatvEXT(id: GLuint; value: GLenum; data: PGLfloat); external dllname; - procedure glGetVariantPointervEXT(id: GLuint; value: GLenum; data: PGLvoid); external dllname; - procedure glGetInvariantBooleanvEXT(id: GLuint; value: GLenum; data: PGLboolean); external dllname; - procedure glGetInvariantIntegervEXT(id: GLuint; value: GLenum; data: PGLint); external dllname; - procedure glGetInvariantFloatvEXT(id: GLuint; value: GLenum; data: PGLfloat); external dllname; - procedure glGetLocalConstantBooleanvEXT(id: GLuint; value: GLenum; data: PGLboolean); external dllname; - procedure glGetLocalConstantIntegervEXT(id: GLuint; value: GLenum; data: PGLint); external dllname; - procedure glGetLocalConstantFloatvEXT(id: GLuint; value: GLenum; data: PGLfloat); external dllname; - -function Load_GL_EXT_vertex_shader: Boolean; - -//***** GL_EXT_vertex_weighting *****// -const - GL_VERTEX_WEIGHTING_EXT = $8509; - GL_MODELVIEW0_EXT = $1700; - GL_MODELVIEW1_EXT = $850A; - GL_MODELVIEW0_MATRIX_EXT = $0BA6; - GL_MODELVIEW1_MATRIX_EXT = $8506; - GL_CURRENT_VERTEX_WEIGHT_EXT = $850B; - GL_VERTEX_WEIGHT_ARRAY_EXT = $850C; - GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT = $850D; - GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT = $850E; - GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = $850F; - GL_MODELVIEW0_STACK_DEPTH_EXT = $0BA3; - GL_MODELVIEW1_STACK_DEPTH_EXT = $8502; - GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = $8510; - - procedure glVertexWeightfEXT(weight: GLfloat); external dllname; - procedure glVertexWeightfvEXT(weight: PGLfloat); external dllname; - procedure glVertexWeightPointerEXT(size: GLint; thetype: GLenum; stride: GLsizei; pointer: PGLvoid); external dllname; - -function Load_GL_EXT_vertex_weighting: Boolean; - -//***** GL_HP_occlusion_test *****// -const - GL_OCCLUSION_TEST_HP = $8165; - GL_OCCLUSION_TEST_RESULT_HP = $8166; - -function Load_GL_HP_occlusion_test: Boolean; - -//***** GL_NV_blend_square *****// - -function Load_GL_NV_blend_square: Boolean; - -//***** GL_NV_copy_depth_to_color *****// -const - GL_DEPTH_STENCIL_TO_RGBA_NV = $886E; - GL_DEPTH_STENCIL_TO_BGRA_NV = $886F; - -function Load_GL_NV_copy_depth_to_color: Boolean; - -//***** GL_NV_depth_clamp *****// -const - GL_DEPTH_CLAMP_NV = $864F; - -function Load_GL_NV_depth_clamp: Boolean; - -//***** GL_NV_evaluators *****// -const - GL_EVAL_2D_NV = $86C0; - GL_EVAL_TRIANGULAR_2D_NV = $86C1; - GL_MAP_TESSELLATION_NV = $86C2; - GL_MAP_ATTRIB_U_ORDER_NV = $86C3; - GL_MAP_ATTRIB_V_ORDER_NV = $86C4; - GL_EVAL_FRACTIONAL_TESSELLATION_NV = $86C5; - GL_EVAL_VERTEX_ATTRIB0_NV = $86C6; - GL_EVAL_VERTEX_ATTRIB1_NV = $86C7; - GL_EVAL_VERTEX_ATTRIB2_NV = $86C8; - GL_EVAL_VERTEX_ATTRIB3_NV = $86C9; - GL_EVAL_VERTEX_ATTRIB4_NV = $86CA; - GL_EVAL_VERTEX_ATTRIB5_NV = $86CB; - GL_EVAL_VERTEX_ATTRIB6_NV = $86CC; - GL_EVAL_VERTEX_ATTRIB7_NV = $86CD; - GL_EVAL_VERTEX_ATTRIB8_NV = $86CE; - GL_EVAL_VERTEX_ATTRIB9_NV = $86CF; - GL_EVAL_VERTEX_ATTRIB10_NV = $86D0; - GL_EVAL_VERTEX_ATTRIB11_NV = $86D1; - GL_EVAL_VERTEX_ATTRIB12_NV = $86D2; - GL_EVAL_VERTEX_ATTRIB13_NV = $86D3; - GL_EVAL_VERTEX_ATTRIB14_NV = $86D4; - GL_EVAL_VERTEX_ATTRIB15_NV = $86D5; - GL_MAX_MAP_TESSELLATION_NV = $86D6; - GL_MAX_RATIONAL_EVAL_ORDER_NV = $86D7; - - procedure glMapControlPointsNV(target: GLenum; index: GLuint; thetype: GLenum; ustride: GLsizei; vstride: GLsizei; uorder: GLint; vorder: GLint; thepacked: GLboolean; const points: PGLvoid); external dllname; - procedure glMapParameterivNV(target: GLenum; pname: GLenum; const params: PGLint); external dllname; - procedure glMapParameterfvNV(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; - procedure glGetMapControlPointsNV(target: GLenum; index: GLuint; thetype: GLenum; ustride: GLsizei; vstride: GLsizei; thepacked: GLboolean; points: PGLvoid); external dllname; - procedure glGetMapParameterivNV(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetMapParameterfvNV(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetMapAttribParameterivNV(target: GLenum; index: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetMapAttribParameterfvNV(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glEvalMapsNV(target: GLenum; mode: GLenum); external dllname; - -function Load_GL_NV_evaluators: Boolean; - -//***** GL_NV_fence *****// -const - GL_ALL_COMPLETED_NV = $84F2; - GL_FENCE_STATUS_NV = $84F3; - GL_FENCE_CONDITION_NV = $84F4; - - procedure glGenFencesNV(n: GLsizei; fences: PGLuint); external dllname; - procedure glDeleteFencesNV(n: GLsizei; const fences: PGLuint); external dllname; - procedure glSetFenceNV(fence: GLuint; condition: GLenum); external dllname; - function glTestFenceNV(fence: GLuint): GLboolean; external dllname; - procedure glFinishFenceNV(fence: GLuint); external dllname; - function glIsFenceNV(fence: GLuint): GLboolean; external dllname; - procedure glGetFenceivNV(fence: GLuint; pname: GLenum; params: PGLint); external dllname; - -function Load_GL_NV_fence: Boolean; - -//***** GL_NV_fog_distance *****// -const - GL_FOG_DISTANCE_MODE_NV = $855A; - GL_EYE_RADIAL_NV = $855B; - GL_EYE_PLANE_ABSOLUTE_NV = $855C; - -function Load_GL_NV_fog_distance: Boolean; - -//***** GL_NV_light_max_exponent *****// -const - GL_MAX_SHININESS_NV = $8504; - GL_MAX_SPOT_EXPONENT_NV = $8505; - -function Load_GL_NV_light_max_exponent: Boolean; - -//***** GL_NV_multisample_filter_hint *****// -const - GL_MULTISAMPLE_FILTER_HINT_NV = $8534; - -function Load_GL_NV_multisample_filter_hint: Boolean; - -//***** GL_NV_occlusion_query *****// - // GL_OCCLUSION_TEST_HP { already defined } - // GL_OCCLUSION_TEST_RESULT_HP { already defined } -const - GL_PIXEL_COUNTER_BITS_NV = $8864; - GL_CURRENT_OCCLUSION_QUERY_ID_NV = $8865; - GL_PIXEL_COUNT_NV = $8866; - GL_PIXEL_COUNT_AVAILABLE_NV = $8867; - - procedure glGenOcclusionQueriesNV(n: GLsizei; ids: PGLuint); external dllname; - procedure glDeleteOcclusionQueriesNV(n: GLsizei; const ids: PGLuint); external dllname; - function glIsOcclusionQueryNV(id: GLuint): GLboolean; external dllname; - procedure glBeginOcclusionQueryNV(id: GLuint); external dllname; - procedure glEndOcclusionQueryNV(); external dllname; - procedure glGetOcclusionQueryivNV(id: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetOcclusionQueryuivNV(id: GLuint; pname: GLenum; params: PGLuint); external dllname; - -function Load_GL_NV_occlusion_query: Boolean; - -//***** GL_NV_packed_depth_stencil *****// -const - GL_DEPTH_STENCIL_NV = $84F9; - GL_UNSIGNED_INT_24_8_NV = $84FA; - -function Load_GL_NV_packed_depth_stencil: Boolean; - -//***** GL_NV_point_sprite *****// -const - GL_POINT_SPRITE_NV = $8861; - GL_COORD_REPLACE_NV = $8862; - GL_POINT_SPRITE_R_MODE_NV = $8863; - - procedure glPointParameteriNV(pname: GLenum; param: GLint); external dllname; - procedure glPointParameterivNV(pname: GLenum; const params: PGLint); external dllname; - -function Load_GL_NV_point_sprite: Boolean; - -//***** GL_NV_register_combiners *****// -const - GL_REGISTER_COMBINERS_NV = $8522; - GL_COMBINER0_NV = $8550; - GL_COMBINER1_NV = $8551; - GL_COMBINER2_NV = $8552; - GL_COMBINER3_NV = $8553; - GL_COMBINER4_NV = $8554; - GL_COMBINER5_NV = $8555; - GL_COMBINER6_NV = $8556; - GL_COMBINER7_NV = $8557; - GL_VARIABLE_A_NV = $8523; - GL_VARIABLE_B_NV = $8524; - GL_VARIABLE_C_NV = $8525; - GL_VARIABLE_D_NV = $8526; - GL_VARIABLE_E_NV = $8527; - GL_VARIABLE_F_NV = $8528; - GL_VARIABLE_G_NV = $8529; - GL_CONSTANT_COLOR0_NV = $852A; - GL_CONSTANT_COLOR1_NV = $852B; - GL_PRIMARY_COLOR_NV = $852C; - GL_SECONDARY_COLOR_NV = $852D; - GL_SPARE0_NV = $852E; - GL_SPARE1_NV = $852F; - GL_UNSIGNED_IDENTITY_NV = $8536; - GL_UNSIGNED_INVERT_NV = $8537; - GL_EXPAND_NORMAL_NV = $8538; - GL_EXPAND_NEGATE_NV = $8539; - GL_HALF_BIAS_NORMAL_NV = $853A; - GL_HALF_BIAS_NEGATE_NV = $853B; - GL_SIGNED_IDENTITY_NV = $853C; - GL_SIGNED_NEGATE_NV = $853D; - GL_E_TIMES_F_NV = $8531; - GL_SPARE0_PLUS_SECONDARY_COLOR_NV = $8532; - GL_SCALE_BY_TWO_NV = $853E; - GL_SCALE_BY_FOUR_NV = $853F; - GL_SCALE_BY_ONE_HALF_NV = $8540; - GL_BIAS_BY_NEGATIVE_ONE_HALF_NV = $8541; - GL_DISCARD_NV = $8530; - GL_COMBINER_INPUT_NV = $8542; - GL_COMBINER_MAPPING_NV = $8543; - GL_COMBINER_COMPONENT_USAGE_NV = $8544; - GL_COMBINER_AB_DOT_PRODUCT_NV = $8545; - GL_COMBINER_CD_DOT_PRODUCT_NV = $8546; - GL_COMBINER_MUX_SUM_NV = $8547; - GL_COMBINER_SCALE_NV = $8548; - GL_COMBINER_BIAS_NV = $8549; - GL_COMBINER_AB_OUTPUT_NV = $854A; - GL_COMBINER_CD_OUTPUT_NV = $854B; - GL_COMBINER_SUM_OUTPUT_NV = $854C; - GL_NUM_GENERAL_COMBINERS_NV = $854E; - GL_COLOR_SUM_CLAMP_NV = $854F; - GL_MAX_GENERAL_COMBINERS_NV = $854D; - - procedure glCombinerParameterfvNV(pname: GLenum; const params: PGLfloat); external dllname; - procedure glCombinerParameterivNV(pname: GLenum; const params: PGLint); external dllname; - procedure glCombinerParameterfNV(pname: GLenum; param: GLfloat); external dllname; - procedure glCombinerParameteriNV(pname: GLenum; param: GLint); external dllname; - procedure glCombinerInputNV(stage: GLenum; portion: GLenum; variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); external dllname; - procedure glCombinerOutputNV(stage: GLenum; portion: GLenum; abOutput: GLenum; cdOutput: GLenum; sumOutput: GLenum; scale: GLenum; bias: GLenum; abDotProduct: GLboolean; cdDotProduct: GLboolean; muxSum: GLboolean); external dllname; - procedure glFinalCombinerInputNV(variable: GLenum; input: GLenum; mapping: GLenum; componentUsage: GLenum); external dllname; - procedure glGetCombinerInputParameterfvNV(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetCombinerInputParameterivNV(stage: GLenum; portion: GLenum; variable: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetCombinerOutputParameterfvNV(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetCombinerOutputParameterivNV(stage: GLenum; portion: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetFinalCombinerInputParameterfvNV(variable: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetFinalCombinerInputParameterivNV(variable: GLenum; pname: GLenum; params: PGLint); external dllname; - -function Load_GL_NV_register_combiners: Boolean; - -//***** GL_NV_register_combiners2 *****// -const - GL_PER_STAGE_CONSTANTS_NV = $8535; - - procedure glCombinerStageParameterfvNV(stage: GLenum; pname: GLenum; const params: PGLfloat); external dllname; - procedure glGetCombinerStageParameterfvNV(stage: GLenum; pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_NV_register_combiners2: Boolean; - -//***** GL_NV_texgen_emboss *****// -const - GL_EMBOSS_MAP_NV = $855F; - GL_EMBOSS_LIGHT_NV = $855D; - GL_EMBOSS_CONSTANT_NV = $855E; - -function Load_GL_NV_texgen_emboss: Boolean; - -//***** GL_NV_texgen_reflection *****// -const - GL_NORMAL_MAP_NV = $8511; - GL_REFLECTION_MAP_NV = $8512; - -function Load_GL_NV_texgen_reflection: Boolean; - -//***** GL_NV_texture_compression_vtc *****// - // GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT { already defined } - -function Load_GL_NV_texture_compression_vtc: Boolean; - -//***** GL_NV_texture_env_combine4 *****// -const - GL_COMBINE4_NV = $8503; - GL_SOURCE3_RGB_NV = $8583; - GL_SOURCE3_ALPHA_NV = $858B; - GL_OPERAND3_RGB_NV = $8593; - GL_OPERAND3_ALPHA_NV = $859B; - -function Load_GL_NV_texture_env_combine4: Boolean; - -//***** GL_NV_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_NV = $84F5; - GL_TEXTURE_BINDING_RECTANGLE_NV = $84F6; - GL_PROXY_TEXTURE_RECTANGLE_NV = $84F7; - GL_MAX_RECTANGLE_TEXTURE_SIZE_NV = $84F8; - -function Load_GL_NV_texture_rectangle: Boolean; - -//***** GL_NV_texture_shader *****// -const - GL_TEXTURE_SHADER_NV = $86DE; - GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = $86D9; - GL_SHADER_OPERATION_NV = $86DF; - GL_CULL_MODES_NV = $86E0; - GL_OFFSET_TEXTURE_MATRIX_NV = $86E1; - GL_OFFSET_TEXTURE_SCALE_NV = $86E2; - GL_OFFSET_TEXTURE_BIAS_NV = $86E3; - GL_PREVIOUS_TEXTURE_INPUT_NV = $86E4; - GL_CONST_EYE_NV = $86E5; - GL_SHADER_CONSISTENT_NV = $86DD; - GL_PASS_THROUGH_NV = $86E6; - GL_CULL_FRAGMENT_NV = $86E7; - GL_OFFSET_TEXTURE_2D_NV = $86E8; - GL_OFFSET_TEXTURE_RECTANGLE_NV = $864C; - GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV = $864D; - GL_DEPENDENT_AR_TEXTURE_2D_NV = $86E9; - GL_DEPENDENT_GB_TEXTURE_2D_NV = $86EA; - GL_DOT_PRODUCT_NV = $86EC; - GL_DOT_PRODUCT_DEPTH_REPLACE_NV = $86ED; - GL_DOT_PRODUCT_TEXTURE_2D_NV = $86EE; - GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV = $864E; - GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = $86F0; - GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = $86F1; - GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV = $86F2; - GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = $86F3; - GL_HILO_NV = $86F4; - GL_DSDT_NV = $86F5; - GL_DSDT_MAG_NV = $86F6; - GL_DSDT_MAG_VIB_NV = $86F7; - GL_UNSIGNED_INT_S8_S8_8_8_NV = $86DA; - GL_UNSIGNED_INT_8_8_S8_S8_REV_NV = $86DB; - GL_SIGNED_RGBA_NV = $86FB; - GL_SIGNED_RGBA8_NV = $86FC; - GL_SIGNED_RGB_NV = $86FE; - GL_SIGNED_RGB8_NV = $86FF; - GL_SIGNED_LUMINANCE_NV = $8701; - GL_SIGNED_LUMINANCE8_NV = $8702; - GL_SIGNED_LUMINANCE_ALPHA_NV = $8703; - GL_SIGNED_LUMINANCE8_ALPHA8_NV = $8704; - GL_SIGNED_ALPHA_NV = $8705; - GL_SIGNED_ALPHA8_NV = $8706; - GL_SIGNED_INTENSITY_NV = $8707; - GL_SIGNED_INTENSITY8_NV = $8708; - GL_SIGNED_RGB_UNSIGNED_ALPHA_NV = $870C; - GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV = $870D; - GL_HILO16_NV = $86F8; - GL_SIGNED_HILO_NV = $86F9; - GL_SIGNED_HILO16_NV = $86FA; - GL_DSDT8_NV = $8709; - GL_DSDT8_MAG8_NV = $870A; - GL_DSDT_MAG_INTENSITY_NV = $86DC; - GL_DSDT8_MAG8_INTENSITY8_NV = $870B; - GL_HI_SCALE_NV = $870E; - GL_LO_SCALE_NV = $870F; - GL_DS_SCALE_NV = $8710; - GL_DT_SCALE_NV = $8711; - GL_MAGNITUDE_SCALE_NV = $8712; - GL_VIBRANCE_SCALE_NV = $8713; - GL_HI_BIAS_NV = $8714; - GL_LO_BIAS_NV = $8715; - GL_DS_BIAS_NV = $8716; - GL_DT_BIAS_NV = $8717; - GL_MAGNITUDE_BIAS_NV = $8718; - GL_VIBRANCE_BIAS_NV = $8719; - GL_TEXTURE_BORDER_VALUES_NV = $871A; - GL_TEXTURE_HI_SIZE_NV = $871B; - GL_TEXTURE_LO_SIZE_NV = $871C; - GL_TEXTURE_DS_SIZE_NV = $871D; - GL_TEXTURE_DT_SIZE_NV = $871E; - GL_TEXTURE_MAG_SIZE_NV = $871F; - -function Load_GL_NV_texture_shader: Boolean; - -//***** GL_NV_texture_shader2 *****// -const - GL_DOT_PRODUCT_TEXTURE_3D_NV = $86EF; - // GL_HILO_NV { already defined } - // GL_DSDT_NV { already defined } - // GL_DSDT_MAG_NV { already defined } - // GL_DSDT_MAG_VIB_NV { already defined } - // GL_UNSIGNED_INT_S8_S8_8_8_NV { already defined } - // GL_UNSIGNED_INT_8_8_S8_S8_REV_NV { already defined } - // GL_SIGNED_RGBA_NV { already defined } - // GL_SIGNED_RGBA8_NV { already defined } - // GL_SIGNED_RGB_NV { already defined } - // GL_SIGNED_RGB8_NV { already defined } - // GL_SIGNED_LUMINANCE_NV { already defined } - // GL_SIGNED_LUMINANCE8_NV { already defined } - // GL_SIGNED_LUMINANCE_ALPHA_NV { already defined } - // GL_SIGNED_LUMINANCE8_ALPHA8_NV { already defined } - // GL_SIGNED_ALPHA_NV { already defined } - // GL_SIGNED_ALPHA8_NV { already defined } - // GL_SIGNED_INTENSITY_NV { already defined } - // GL_SIGNED_INTENSITY8_NV { already defined } - // GL_SIGNED_RGB_UNSIGNED_ALPHA_NV { already defined } - // GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV { already defined } - // GL_HILO16_NV { already defined } - // GL_SIGNED_HILO_NV { already defined } - // GL_SIGNED_HILO16_NV { already defined } - // GL_DSDT8_NV { already defined } - // GL_DSDT8_MAG8_NV { already defined } - // GL_DSDT_MAG_INTENSITY_NV { already defined } - // GL_DSDT8_MAG8_INTENSITY8_NV { already defined } - -function Load_GL_NV_texture_shader2: Boolean; - -//***** GL_NV_texture_shader3 *****// -const - GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV = $8850; - GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = $8851; - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8852; - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = $8853; - GL_OFFSET_HILO_TEXTURE_2D_NV = $8854; - GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV = $8855; - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = $8856; - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = $8857; - GL_DEPENDENT_HILO_TEXTURE_2D_NV = $8858; - GL_DEPENDENT_RGB_TEXTURE_3D_NV = $8859; - GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = $885A; - GL_DOT_PRODUCT_PASS_THROUGH_NV = $885B; - GL_DOT_PRODUCT_TEXTURE_1D_NV = $885C; - GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = $885D; - GL_HILO8_NV = $885E; - GL_SIGNED_HILO8_NV = $885F; - GL_FORCE_BLUE_TO_ONE_NV = $8860; - -function Load_GL_NV_texture_shader3: Boolean; - -//***** GL_NV_vertex_array_range *****// -const - GL_VERTEX_ARRAY_RANGE_NV = $851D; - GL_VERTEX_ARRAY_RANGE_LENGTH_NV = $851E; - GL_VERTEX_ARRAY_RANGE_VALID_NV = $851F; - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = $8520; - GL_VERTEX_ARRAY_RANGE_POINTER_NV = $8521; - - procedure glVertexArrayRangeNV(length: GLsizei; pointer: PGLvoid); external dllname; - procedure glFlushVertexArrayRangeNV(); external dllname; - - -function Load_GL_NV_vertex_array_range: Boolean; - -//***** GL_NV_vertex_array_range2 *****// -const - GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = $8533; - -function Load_GL_NV_vertex_array_range2: Boolean; - -//***** GL_NV_vertex_program *****// -const - GL_VERTEX_PROGRAM_NV = $8620; - GL_VERTEX_PROGRAM_POINT_SIZE_NV = $8642; - GL_VERTEX_PROGRAM_TWO_SIDE_NV = $8643; - GL_VERTEX_STATE_PROGRAM_NV = $8621; - GL_ATTRIB_ARRAY_SIZE_NV = $8623; - GL_ATTRIB_ARRAY_STRIDE_NV = $8624; - GL_ATTRIB_ARRAY_TYPE_NV = $8625; - GL_CURRENT_ATTRIB_NV = $8626; - GL_PROGRAM_PARAMETER_NV = $8644; - GL_ATTRIB_ARRAY_POINTER_NV = $8645; - GL_PROGRAM_TARGET_NV = $8646; - GL_PROGRAM_LENGTH_NV = $8627; - GL_PROGRAM_RESIDENT_NV = $8647; - GL_PROGRAM_STRING_NV = $8628; - GL_TRACK_MATRIX_NV = $8648; - GL_TRACK_MATRIX_TRANSFORM_NV = $8649; - GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = $862E; - GL_MAX_TRACK_MATRICES_NV = $862F; - GL_CURRENT_MATRIX_STACK_DEPTH_NV = $8640; - GL_CURRENT_MATRIX_NV = $8641; - GL_VERTEX_PROGRAM_BINDING_NV = $864A; - GL_PROGRAM_ERROR_POSITION_NV = $864B; - GL_MODELVIEW_PROJECTION_NV = $8629; - GL_MATRIX0_NV = $8630; - GL_MATRIX1_NV = $8631; - GL_MATRIX2_NV = $8632; - GL_MATRIX3_NV = $8633; - GL_MATRIX4_NV = $8634; - GL_MATRIX5_NV = $8635; - GL_MATRIX6_NV = $8636; - GL_MATRIX7_NV = $8637; - GL_IDENTITY_NV = $862A; - GL_INVERSE_NV = $862B; - GL_TRANSPOSE_NV = $862C; - GL_INVERSE_TRANSPOSE_NV = $862D; - GL_VERTEX_ATTRIB_ARRAY0_NV = $8650; - GL_VERTEX_ATTRIB_ARRAY1_NV = $8651; - GL_VERTEX_ATTRIB_ARRAY2_NV = $8652; - GL_VERTEX_ATTRIB_ARRAY3_NV = $8653; - GL_VERTEX_ATTRIB_ARRAY4_NV = $8654; - GL_VERTEX_ATTRIB_ARRAY5_NV = $8655; - GL_VERTEX_ATTRIB_ARRAY6_NV = $8656; - GL_VERTEX_ATTRIB_ARRAY7_NV = $8657; - GL_VERTEX_ATTRIB_ARRAY8_NV = $8658; - GL_VERTEX_ATTRIB_ARRAY9_NV = $8659; - GL_VERTEX_ATTRIB_ARRAY10_NV = $865A; - GL_VERTEX_ATTRIB_ARRAY11_NV = $865B; - GL_VERTEX_ATTRIB_ARRAY12_NV = $865C; - GL_VERTEX_ATTRIB_ARRAY13_NV = $865D; - GL_VERTEX_ATTRIB_ARRAY14_NV = $865E; - GL_VERTEX_ATTRIB_ARRAY15_NV = $865F; - GL_MAP1_VERTEX_ATTRIB0_4_NV = $8660; - GL_MAP1_VERTEX_ATTRIB1_4_NV = $8661; - GL_MAP1_VERTEX_ATTRIB2_4_NV = $8662; - GL_MAP1_VERTEX_ATTRIB3_4_NV = $8663; - GL_MAP1_VERTEX_ATTRIB4_4_NV = $8664; - GL_MAP1_VERTEX_ATTRIB5_4_NV = $8665; - GL_MAP1_VERTEX_ATTRIB6_4_NV = $8666; - GL_MAP1_VERTEX_ATTRIB7_4_NV = $8667; - GL_MAP1_VERTEX_ATTRIB8_4_NV = $8668; - GL_MAP1_VERTEX_ATTRIB9_4_NV = $8669; - GL_MAP1_VERTEX_ATTRIB10_4_NV = $866A; - GL_MAP1_VERTEX_ATTRIB11_4_NV = $866B; - GL_MAP1_VERTEX_ATTRIB12_4_NV = $866C; - GL_MAP1_VERTEX_ATTRIB13_4_NV = $866D; - GL_MAP1_VERTEX_ATTRIB14_4_NV = $866E; - GL_MAP1_VERTEX_ATTRIB15_4_NV = $866F; - GL_MAP2_VERTEX_ATTRIB0_4_NV = $8670; - GL_MAP2_VERTEX_ATTRIB1_4_NV = $8671; - GL_MAP2_VERTEX_ATTRIB2_4_NV = $8672; - GL_MAP2_VERTEX_ATTRIB3_4_NV = $8673; - GL_MAP2_VERTEX_ATTRIB4_4_NV = $8674; - GL_MAP2_VERTEX_ATTRIB5_4_NV = $8675; - GL_MAP2_VERTEX_ATTRIB6_4_NV = $8676; - GL_MAP2_VERTEX_ATTRIB7_4_NV = $8677; - GL_MAP2_VERTEX_ATTRIB8_4_NV = $8678; - GL_MAP2_VERTEX_ATTRIB9_4_NV = $8679; - GL_MAP2_VERTEX_ATTRIB10_4_NV = $867A; - GL_MAP2_VERTEX_ATTRIB11_4_NV = $867B; - GL_MAP2_VERTEX_ATTRIB12_4_NV = $867C; - GL_MAP2_VERTEX_ATTRIB13_4_NV = $867D; - GL_MAP2_VERTEX_ATTRIB14_4_NV = $867E; - GL_MAP2_VERTEX_ATTRIB15_4_NV = $867F; - - procedure glBindProgramNV(target: GLenum; id: GLuint); external dllname; - procedure glDeleteProgramsNV(n: GLsizei; const ids: PGLuint); external dllname; - procedure glExecuteProgramNV(target: GLenum; id: GLuint; const params: PGLfloat); external dllname; - procedure glGenProgramsNV(n: GLsizei; ids: PGLuint); external dllname; - function glAreProgramsResidentNV(n: GLsizei; const ids: PGLuint; residences: PGLboolean): GLboolean; external dllname; - procedure glRequestResidentProgramsNV(n: GLsizei; ids: PGLuint); external dllname; - procedure glGetProgramParameterfvNV(target: GLenum; index: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetProgramParameterdvNV(target: GLenum; index: GLuint; pname: GLenum; params: PGLdouble); external dllname; - procedure glGetProgramivNV(id: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetProgramStringNV(id: GLuint; pname: GLenum; theProgram: PGLubyte); external dllname; - procedure glGetTrackMatrixivNV(target: GLenum; address: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetVertexAttribdvNV(index: GLuint; pname: GLenum; params: PGLdouble); external dllname; - procedure glGetVertexAttribfvNV(index: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetVertexAttribivNV(index: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetVertexAttribPointervNV(index: GLuint; pname: GLenum; pointer: PGLvoid); external dllname; - function glIsProgramNV(id: GLuint): GLboolean; external dllname; - procedure glLoadProgramNV(target: GLenum; id: GLuint; len: GLsizei; const theProgram: PGLubyte); external dllname; - procedure glProgramParameter4fNV(target: GLenum; index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glProgramParameter4fvNV(target: GLenum; index: GLuint; const params: PGLfloat); external dllname; - procedure glProgramParameters4dvNV(target: GLenum; index: GLuint; num: GLuint; const params: PGLdouble); external dllname; - procedure glProgramParameters4fvNV(target: GLenum; index: GLuint; num: GLuint; const params: PGLfloat); external dllname; - procedure glTrackMatrixNV(target: GLenum; address: GLuint; matrix: GLenum; transform: GLenum); external dllname; - procedure glVertexAttribPointerNV(index: GLuint; size: GLint; thetype: GLenum; stride: GLsizei; const pointer: PGLvoid); external dllname; - procedure glVertexAttrib1sNV(index: GLuint; x: GLshort); external dllname; - procedure glVertexAttrib1fNV(index: GLuint; x: GLfloat); external dllname; - procedure glVertexAttrib1dNV(index: GLuint; x: GLdouble); external dllname; - procedure glVertexAttrib2sNV(index: GLuint; x: GLshort; y: GLshort); external dllname; - procedure glVertexAttrib2fNV(index: GLuint; x: GLfloat; y: GLfloat); external dllname; - procedure glVertexAttrib2dNV(index: GLuint; x: GLdouble; y: GLdouble); external dllname; - procedure glVertexAttrib3sNV(index: GLuint; x: GLshort; y: GLshort; z: GLshort); external dllname; - procedure glVertexAttrib3fNV(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glVertexAttrib3dNV(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); external dllname; - procedure glVertexAttrib4sNV(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); external dllname; - procedure glVertexAttrib4fNV(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glVertexAttrib4dNV(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glVertexAttrib4ubNV(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); external dllname; - procedure glVertexAttrib1svNV(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib1fvNV(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib1dvNV(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib2svNV(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib2fvNV(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib2dvNV(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib3svNV(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib3fvNV(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib3dvNV(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib4svNV(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib4fvNV(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib4dvNV(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib4ubvNV(index: GLuint; const v: PGLubyte); external dllname; - procedure glVertexAttribs1svNV(index: GLuint; n: GLsizei; const v: PGLshort); external dllname; - procedure glVertexAttribs1fvNV(index: GLuint; n: GLsizei; const v: PGLfloat); external dllname; - procedure glVertexAttribs1dvNV(index: GLuint; n: GLsizei; const v: PGLdouble); external dllname; - procedure glVertexAttribs2svNV(index: GLuint; n: GLsizei; const v: PGLshort); external dllname; - procedure glVertexAttribs2fvNV(index: GLuint; n: GLsizei; const v: PGLfloat); external dllname; - procedure glVertexAttribs2dvNV(index: GLuint; n: GLsizei; const v: PGLdouble); external dllname; - procedure glVertexAttribs3svNV(index: GLuint; n: GLsizei; const v: PGLshort); external dllname; - procedure glVertexAttribs3fvNV(index: GLuint; n: GLsizei; const v: PGLfloat); external dllname; - procedure glVertexAttribs3dvNV(index: GLuint; n: GLsizei; const v: PGLdouble); external dllname; - procedure glVertexAttribs4svNV(index: GLuint; n: GLsizei; const v: PGLshort); external dllname; - procedure glVertexAttribs4fvNV(index: GLuint; n: GLsizei; const v: PGLfloat); external dllname; - procedure glVertexAttribs4dvNV(index: GLuint; n: GLsizei; const v: PGLdouble); external dllname; - procedure glVertexAttribs4ubvNV(index: GLuint; n: GLsizei; const v: PGLubyte); external dllname; - -function Load_GL_NV_vertex_program: Boolean; - -//***** GL_NV_vertex_program1_1 *****// - -function Load_GL_NV_vertex_program1_1: Boolean; - -//***** GL_ATI_element_array *****// -const - GL_ELEMENT_ARRAY_ATI = $8768; - GL_ELEMENT_ARRAY_TYPE_ATI = $8769; - GL_ELEMENT_ARRAY_POINTER_ATI = $876A; - - procedure glElementPointerATI(thetype: GLenum; const pointer: PGLvoid); external dllname; - procedure glDrawElementArrayATI(mode: GLenum; count: GLsizei); external dllname; - procedure glDrawRangeElementArrayATI(mode: GLenum; start: GLuint; theend: GLuint; count: GLsizei); external dllname; - -function Load_GL_ATI_element_array: Boolean; - -//***** GL_ATI_envmap_bumpmap *****// -const - GL_BUMP_ROT_MATRIX_ATI = $8775; - GL_BUMP_ROT_MATRIX_SIZE_ATI = $8776; - GL_BUMP_NUM_TEX_UNITS_ATI = $8777; - GL_BUMP_TEX_UNITS_ATI = $8778; - GL_DUDV_ATI = $8779; - GL_DU8DV8_ATI = $877A; - GL_BUMP_ENVMAP_ATI = $877B; - GL_BUMP_TARGET_ATI = $877C; - - procedure glTexBumpParameterivATI(pname: GLenum; param: PGLint); external dllname; - procedure glTexBumpParameterfvATI(pname: GLenum; param: PGLfloat); external dllname; - procedure glGetTexBumpParameterivATI(pname: GLenum; param: PGLint); external dllname; - procedure glGetTexBumpParameterfvATI(pname: GLenum; param: PGLfloat); external dllname; - -function Load_GL_ATI_envmap_bumpmap: Boolean; - -//***** GL_ATI_fragment_shader *****// -const - GL_FRAGMENT_SHADER_ATI = $8920; - GL_REG_0_ATI = $8921; - GL_REG_1_ATI = $8922; - GL_REG_2_ATI = $8923; - GL_REG_3_ATI = $8924; - GL_REG_4_ATI = $8925; - GL_REG_5_ATI = $8926; - GL_CON_0_ATI = $8941; - GL_CON_1_ATI = $8942; - GL_CON_2_ATI = $8943; - GL_CON_3_ATI = $8944; - GL_CON_4_ATI = $8945; - GL_CON_5_ATI = $8946; - GL_CON_6_ATI = $8947; - GL_CON_7_ATI = $8948; - GL_MOV_ATI = $8961; - GL_ADD_ATI = $8963; - GL_MUL_ATI = $8964; - GL_SUB_ATI = $8965; - GL_DOT3_ATI = $8966; - GL_DOT4_ATI = $8967; - GL_MAD_ATI = $8968; - GL_LERP_ATI = $8969; - GL_CND_ATI = $896A; - GL_CND0_ATI = $896B; - GL_DOT2_ADD_ATI = $896C; - GL_SECONDARY_INTERPOLATOR_ATI = $896D; - GL_SWIZZLE_STR_ATI = $8976; - GL_SWIZZLE_STQ_ATI = $8977; - GL_SWIZZLE_STR_DR_ATI = $8978; - GL_SWIZZLE_STQ_DQ_ATI = $8979; - GL_RED_BIT_ATI = $0001; - GL_GREEN_BIT_ATI = $0002; - GL_BLUE_BIT_ATI = $0004; - GL_2X_BIT_ATI = $0001; - GL_4X_BIT_ATI = $0002; - GL_8X_BIT_ATI = $0004; - GL_HALF_BIT_ATI = $0008; - GL_QUARTER_BIT_ATI = $0010; - GL_EIGHTH_BIT_ATI = $0020; - GL_SATURATE_BIT_ATI = $0040; - // GL_2X_BIT_ATI { already defined } - GL_COMP_BIT_ATI = $0002; - GL_NEGATE_BIT_ATI = $0004; - GL_BIAS_BIT_ATI = $0008; - - function glGenFragmentShadersATI(range: GLuint): GLuint; external dllname; - procedure glBindFragmentShaderATI(id: GLuint); external dllname; - procedure glDeleteFragmentShaderATI(id: GLuint); external dllname; - procedure glBeginFragmentShaderATI(); external dllname; - procedure glEndFragmentShaderATI(); external dllname; - procedure glPassTexCoordATI(dst: GLuint; coord: GLuint; swizzle: GLenum); external dllname; - procedure glSampleMapATI(dst: GLuint; interp: GLuint; swizzle: GLenum); external dllname; - procedure glColorFragmentOp1ATI(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); external dllname; - procedure glColorFragmentOp2ATI(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); external dllname; - procedure glColorFragmentOp3ATI(op: GLenum; dst: GLuint; dstMask: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); external dllname; - procedure glAlphaFragmentOp1ATI(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint); external dllname; - procedure glAlphaFragmentOp2ATI(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint); external dllname; - procedure glAlphaFragmentOp3ATI(op: GLenum; dst: GLuint; dstMod: GLuint; arg1: GLuint; arg1Rep: GLuint; arg1Mod: GLuint; arg2: GLuint; arg2Rep: GLuint; arg2Mod: GLuint; arg3: GLuint; arg3Rep: GLuint; arg3Mod: GLuint); external dllname; - procedure glSetFragmentShaderConstantATI(dst: GLuint; const value: PGLfloat); external dllname; - -function Load_GL_ATI_fragment_shader: Boolean; - -//***** GL_ATI_pn_triangles *****// -const - GL_PN_TRIANGLES_ATI = $87F0; - GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F1; - GL_PN_TRIANGLES_POINT_MODE_ATI = $87F2; - GL_PN_TRIANGLES_NORMAL_MODE_ATI = $87F3; - GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI = $87F4; - GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI = $87F5; - GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = $87F6; - GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = $87F7; - GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = $87F8; - - procedure glPNTrianglesiATI(pname: GLenum; param: GLint); external dllname; - procedure glPNTrianglesfATI(pname: GLenum; param: GLfloat); external dllname; - -function Load_GL_ATI_pn_triangles: Boolean; - -//***** GL_ATI_texture_mirror_once *****// -const - GL_MIRROR_CLAMP_ATI = $8742; - GL_MIRROR_CLAMP_TO_EDGE_ATI = $8743; - -function Load_GL_ATI_texture_mirror_once: Boolean; - -//***** GL_ATI_vertex_array_object *****// -const - GL_STATIC_ATI = $8760; - GL_DYNAMIC_ATI = $8761; - GL_PRESERVE_ATI = $8762; - GL_DISCARD_ATI = $8763; - GL_OBJECT_BUFFER_SIZE_ATI = $8764; - GL_OBJECT_BUFFER_USAGE_ATI = $8765; - GL_ARRAY_OBJECT_BUFFER_ATI = $8766; - GL_ARRAY_OBJECT_OFFSET_ATI = $8767; - - function glNewObjectBufferATI(size: GLsizei; const pointer: PGLvoid; usage: GLenum): GLuint; external dllname; - function glIsObjectBufferATI(buffer: GLuint): GLboolean; external dllname; - procedure glUpdateObjectBufferATI(buffer: GLuint; offset: GLuint; size: GLsizei; const pointer: PGLvoid; preserve: GLenum); external dllname; - procedure glGetObjectBufferfvATI(buffer: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetObjectBufferivATI(buffer: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glDeleteObjectBufferATI(buffer: GLuint); external dllname; - procedure glArrayObjectATI(thearray: GLenum; size: GLint; thetype: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); external dllname; - procedure glGetArrayObjectfvATI(thearray: GLenum; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetArrayObjectivATI(thearray: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glVariantArrayObjectATI(id: GLuint; thetype: GLenum; stride: GLsizei; buffer: GLuint; offset: GLuint); external dllname; - procedure glGetVariantArrayObjectfvATI(id: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetVariantArrayObjectivATI(id: GLuint; pname: GLenum; params: PGLint); external dllname; - -function Load_GL_ATI_vertex_array_object: Boolean; - -//***** GL_ATI_vertex_streams *****// -const - GL_MAX_VERTEX_STREAMS_ATI = $876B; - GL_VERTEX_STREAM0_ATI = $876C; - GL_VERTEX_STREAM1_ATI = $876D; - GL_VERTEX_STREAM2_ATI = $876E; - GL_VERTEX_STREAM3_ATI = $876F; - GL_VERTEX_STREAM4_ATI = $8770; - GL_VERTEX_STREAM5_ATI = $8771; - GL_VERTEX_STREAM6_ATI = $8772; - GL_VERTEX_STREAM7_ATI = $8773; - GL_VERTEX_SOURCE_ATI = $8774; - - procedure glVertexStream1s(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream1i(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream1f(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream1d(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream1sv(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream1iv(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream1fv(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream1dv(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream2s(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream2i(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream2f(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream2d(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream2sv(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream2iv(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream2fv(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream2dv(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream3s(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream3i(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream3f(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream3d(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream3sv(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream3iv(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream3fv(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream3dv(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream4s(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream4i(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream4f(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream4d(stream: GLenum; coords: GLdouble); external dllname; - procedure glVertexStream4sv(stream: GLenum; coords: GLshort); external dllname; - procedure glVertexStream4iv(stream: GLenum; coords: GLint); external dllname; - procedure glVertexStream4fv(stream: GLenum; coords: GLfloat); external dllname; - procedure glVertexStream4dv(stream: GLenum; coords: GLdouble); external dllname; - procedure glNormalStream3b(stream: GLenum; coords: GLbyte); external dllname; - procedure glNormalStream3s(stream: GLenum; coords: GLshort); external dllname; - procedure glNormalStream3i(stream: GLenum; coords: GLint); external dllname; - procedure glNormalStream3f(stream: GLenum; coords: GLfloat); external dllname; - procedure glNormalStream3d(stream: GLenum; coords: GLdouble); external dllname; - procedure glNormalStream3bv(stream: GLenum; coords: GLbyte); external dllname; - procedure glNormalStream3sv(stream: GLenum; coords: GLshort); external dllname; - procedure glNormalStream3iv(stream: GLenum; coords: GLint); external dllname; - procedure glNormalStream3fv(stream: GLenum; coords: GLfloat); external dllname; - procedure glNormalStream3dv(stream: GLenum; coords: GLdouble); external dllname; - procedure glClientActiveVertexStream(stream: GLenum); external dllname; - procedure glVertexBlendEnvi(pname: GLenum; param: GLint); external dllname; - procedure glVertexBlendEnvf(pname: GLenum; param: GLfloat); external dllname; - -function Load_GL_ATI_vertex_streams: Boolean; - -//***** GL_3DFX_texture_compression_FXT1 *****// -const - GL_COMPRESSED_RGB_FXT1_3DFX = $86B0; - GL_COMPRESSED_RGBA_FXT1_3DFX = $86B1; - -function Load_GL_3DFX_texture_compression_FXT1: Boolean; - -//***** GL_IBM_cull_vertex *****// -const - GL_CULL_VERTEX_IBM = $1928A; - -function Load_GL_IBM_cull_vertex: Boolean; - -//***** GL_IBM_multimode_draw_arrays *****// - - procedure glMultiModeDrawArraysIBM(mode: PGLenum; first: PGLint; count: PGLsizei; primcount: GLsizei; modestride: GLint); external dllname; - procedure glMultiModeDrawElementsIBM(mode: PGLenum; count: PGLsizei; thetype: GLenum; const indices: PGLvoid; primcount: GLsizei; modestride: GLint); external dllname; - -function Load_GL_IBM_multimode_draw_arrays: Boolean; - -//***** GL_IBM_raster_pos_clip *****// -const - GL_RASTER_POSITION_UNCLIPPED_IBM = $19262; - -function Load_GL_IBM_raster_pos_clip: Boolean; - -//***** GL_IBM_texture_mirrored_repeat *****// -const - GL_MIRRORED_REPEAT_IBM = $8370; - -function Load_GL_IBM_texture_mirrored_repeat: Boolean; - -//***** GL_IBM_vertex_array_lists *****// -const - GL_VERTEX_ARRAY_LIST_IBM = $1929E; - GL_NORMAL_ARRAY_LIST_IBM = $1929F; - GL_COLOR_ARRAY_LIST_IBM = $192A0; - GL_INDEX_ARRAY_LIST_IBM = $192A1; - GL_TEXTURE_COORD_ARRAY_LIST_IBM = $192A2; - GL_EDGE_FLAG_ARRAY_LIST_IBM = $192A3; - GL_FOG_COORDINATE_ARRAY_LIST_IBM = $192A4; - GL_SECONDARY_COLOR_ARRAY_LIST_IBM = $192A5; - GL_VERTEX_ARRAY_LIST_STRIDE_IBM = $192A8; - GL_NORMAL_ARRAY_LIST_STRIDE_IBM = $192A9; - GL_COLOR_ARRAY_LIST_STRIDE_IBM = $192AA; - GL_INDEX_ARRAY_LIST_STRIDE_IBM = $192AB; - GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = $192AC; - GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = $192AD; - GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = $192AE; - GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = $192AF; - - procedure glColorPointerListIBM(size: GLint; thetype: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); external dllname; - procedure glSecondaryColorPointerListIBM(size: GLint; thetype: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); external dllname; - procedure glEdgeFlagPointerListIBM(stride: GLint; const pointer: PGLboolean; ptrstride: GLint); external dllname; - procedure glFogCoordPointerListIBM(thetype: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); external dllname; - procedure glNormalPointerListIBM(thetype: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); external dllname; - procedure glTexCoordPointerListIBM(size: GLint; thetype: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); external dllname; - procedure glVertexPointerListIBM(size: GLint; thetype: GLenum; stride: GLint; const pointer: PGLvoid; ptrstride: GLint); external dllname; - -function Load_GL_IBM_vertex_array_lists: Boolean; - -//***** GL_MESA_resize_buffers *****// - procedure glResizeBuffersMESA(); external dllname; - -function Load_GL_MESA_resize_buffers: Boolean; - -//***** GL_MESA_window_pos *****// - - procedure glWindowPos2dMESA(x: GLdouble; y: GLdouble); external dllname; - procedure glWindowPos2fMESA(x: GLfloat; y: GLfloat); external dllname; - procedure glWindowPos2iMESA(x: GLint; y: GLint); external dllname; - procedure glWindowPos2sMESA(x: GLshort; y: GLshort); external dllname; - procedure glWindowPos2ivMESA(const p: PGLint); external dllname; - procedure glWindowPos2svMESA(const p: PGLshort); external dllname; - procedure glWindowPos2fvMESA(const p: PGLfloat); external dllname; - procedure glWindowPos2dvMESA(const p: PGLdouble); external dllname; - procedure glWindowPos3iMESA(x: GLint; y: GLint; z: GLint); external dllname; - procedure glWindowPos3sMESA(x: GLshort; y: GLshort; z: GLshort); external dllname; - procedure glWindowPos3fMESA(x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glWindowPos3dMESA(x: GLdouble; y: GLdouble; z: GLdouble); external dllname; - procedure glWindowPos3ivMESA(const p: PGLint); external dllname; - procedure glWindowPos3svMESA(const p: PGLshort); external dllname; - procedure glWindowPos3fvMESA(const p: PGLfloat); external dllname; - procedure glWindowPos3dvMESA(const p: PGLdouble); external dllname; - procedure glWindowPos4iMESA(x: GLint; y: GLint; z: GLint; w: GLint); external dllname; - procedure glWindowPos4sMESA(x: GLshort; y: GLshort; z: GLshort; w: GLshort); external dllname; - procedure glWindowPos4fMESA(x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glWindowPos4dMESA(x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glWindowPos4ivMESA(const p: PGLint); external dllname; - procedure glWindowPos4svMESA(const p: PGLshort); external dllname; - procedure glWindowPos4fvMESA(const p: PGLfloat); external dllname; - procedure glWindowPos4dvMESA(const p: PGLdouble); external dllname; - -function Load_GL_MESA_window_pos: Boolean; - -//***** GL_OML_interlace *****// -const - GL_INTERLACE_OML = $8980; - GL_INTERLACE_READ_OML = $8981; - -function Load_GL_OML_interlace: Boolean; - -//***** GL_OML_resample *****// -const - GL_PACK_RESAMPLE_OML = $8984; - GL_UNPACK_RESAMPLE_OML = $8985; - GL_RESAMPLE_REPLICATE_OML = $8986; - GL_RESAMPLE_ZERO_FILL_OML = $8987; - GL_RESAMPLE_AVERAGE_OML = $8988; - GL_RESAMPLE_DECIMATE_OML = $8989; - // GL_RESAMPLE_AVERAGE_OML { already defined } - -function Load_GL_OML_resample: Boolean; - -//***** GL_OML_subsample *****// -const - GL_FORMAT_SUBSAMPLE_24_24_OML = $8982; - GL_FORMAT_SUBSAMPLE_244_244_OML = $8983; - -function Load_GL_OML_subsample: Boolean; - -//***** GL_SGIS_generate_mipmap *****// -const - GL_GENERATE_MIPMAP_SGIS = $8191; - GL_GENERATE_MIPMAP_HINT_SGIS = $8192; - -function Load_GL_SGIS_generate_mipmap: Boolean; - -//***** GL_SGIS_multisample *****// -const - GLX_SAMPLE_BUFFERS_SGIS = $186A0; - GLX_SAMPLES_SGIS = $186A1; - GL_MULTISAMPLE_SGIS = $809D; - GL_SAMPLE_ALPHA_TO_MASK_SGIS = $809E; - GL_SAMPLE_ALPHA_TO_ONE_SGIS = $809F; - GL_SAMPLE_MASK_SGIS = $80A0; - GL_MULTISAMPLE_BIT_EXT = $20000000; - GL_1PASS_SGIS = $80A1; - GL_2PASS_0_SGIS = $80A2; - GL_2PASS_1_SGIS = $80A3; - GL_4PASS_0_SGIS = $80A4; - GL_4PASS_1_SGIS = $80A5; - GL_4PASS_2_SGIS = $80A6; - GL_4PASS_3_SGIS = $80A7; - GL_SAMPLE_BUFFERS_SGIS = $80A8; - GL_SAMPLES_SGIS = $80A9; - GL_SAMPLE_MASK_VALUE_SGIS = $80AA; - GL_SAMPLE_MASK_INVERT_SGIS = $80AB; - GL_SAMPLE_PATTERN_SGIS = $80AC; - procedure glSampleMaskSGIS(value: GLclampf; invert: GLboolean); external dllname; - procedure glSamplePatternSGIS(pattern: GLenum); external dllname; - -function Load_GL_SGIS_multisample: Boolean; - -//***** GL_SGIS_pixel_texture *****// -const - GL_PIXEL_TEXTURE_SGIS = $8353; - GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS = $8354; - GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = $8355; - GL_PIXEL_GROUP_COLOR_SGIS = $8356; - procedure glPixelTexGenParameteriSGIS(pname: GLenum; param: GLint); external dllname; - procedure glPixelTexGenParameterfSGIS(pname: GLenum; param: GLfloat); external dllname; - procedure glGetPixelTexGenParameterivSGIS(pname: GLenum; params: GLint); external dllname; - procedure glGetPixelTexGenParameterfvSGIS(pname: GLenum; params: GLfloat); external dllname; - -function Load_GL_SGIS_pixel_texture: Boolean; - -//***** GL_SGIS_texture_border_clamp *****// - // GL_CLAMP_TO_BORDER_SGIS { already defined } - -function Load_GL_SGIS_texture_border_clamp: Boolean; - -//***** GL_SGIS_texture_color_mask *****// -const - GL_TEXTURE_COLOR_WRITEMASK_SGIS = $81EF; - - procedure glTextureColorMaskSGIS(r: GLboolean; g: GLboolean; b: GLboolean; a: GLboolean); external dllname; - -function Load_GL_SGIS_texture_color_mask: Boolean; - -//***** GL_SGIS_texture_edge_clamp *****// -const - GL_CLAMP_TO_EDGE_SGIS = $812F; - -function Load_GL_SGIS_texture_edge_clamp: Boolean; - -//***** GL_SGIS_texture_lod *****// -const - GL_TEXTURE_MIN_LOD_SGIS = $813A; - GL_TEXTURE_MAX_LOD_SGIS = $813B; - GL_TEXTURE_BASE_LEVEL_SGIS = $813C; - GL_TEXTURE_MAX_LEVEL_SGIS = $813D; - -function Load_GL_SGIS_texture_lod: Boolean; - -//***** GL_SGIS_depth_texture *****// -const - GL_DEPTH_COMPONENT16_SGIX = $81A5; - GL_DEPTH_COMPONENT24_SGIX = $81A6; - GL_DEPTH_COMPONENT32_SGIX = $81A7; - -function Load_GL_SGIS_depth_texture: Boolean; - -//***** GL_SGIX_fog_offset *****// -const - GL_FOG_OFFSET_SGIX = $8198; - GL_FOG_OFFSET_VALUE_SGIX = $8199; - -function Load_GL_SGIX_fog_offset: Boolean; - -//***** GL_SGIX_interlace *****// -const - GL_INTERLACE_SGIX = $8094; - -function Load_GL_SGIX_interlace: Boolean; - -//***** GL_SGIX_shadow_ambient *****// -const - GL_SHADOW_AMBIENT_SGIX = $80BF; - -function Load_GL_SGIX_shadow_ambient: Boolean; - -//***** GL_SGI_color_matrix *****// -const - GL_COLOR_MATRIX_SGI = $80B1; - GL_COLOR_MATRIX_STACK_DEPTH_SGI = $80B2; - GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI = $80B3; - GL_POST_COLOR_MATRIX_RED_SCALE_SGI = $80B4; - GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI = $80B5; - GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI = $80B6; - GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI = $80B7; - GL_POST_COLOR_MATRIX_RED_BIAS_SGI = $80B8; - GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI = $80B9; - GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI = $80BA; - GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI = $80BB; - -function Load_GL_SGI_color_matrix: Boolean; - -//***** GL_SGI_color_table *****// -const - GL_COLOR_TABLE_SGI = $80D0; - GL_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D1; - GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D2; - GL_PROXY_COLOR_TABLE_SGI = $80D3; - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = $80D4; - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = $80D5; - GL_COLOR_TABLE_SCALE_SGI = $80D6; - GL_COLOR_TABLE_BIAS_SGI = $80D7; - GL_COLOR_TABLE_FORMAT_SGI = $80D8; - GL_COLOR_TABLE_WIDTH_SGI = $80D9; - GL_COLOR_TABLE_RED_SIZE_SGI = $80DA; - GL_COLOR_TABLE_GREEN_SIZE_SGI = $80DB; - GL_COLOR_TABLE_BLUE_SIZE_SGI = $80DC; - GL_COLOR_TABLE_ALPHA_SIZE_SGI = $80DD; - GL_COLOR_TABLE_LUMINANCE_SIZE_SGI = $80DE; - GL_COLOR_TABLE_INTENSITY_SIZE_SGI = $80DF; - - procedure glColorTableSGI(target: GLenum; internalformat: GLenum; width: GLsizei; format: GLenum; thetype: GLenum; const table: PGLvoid); external dllname; - procedure glCopyColorTableSGI(target: GLenum; internalformat: GLenum; x: GLint; y: GLint; width: GLsizei); external dllname; - procedure glColorTableParameterivSGI(target: GLenum; pname: GLenum; const params: PGLint); external dllname; - procedure glColorTableParameterfvSGI(target: GLenum; pname: GLenum; const params: PGLfloat); external dllname; - procedure glGetColorTableSGI(target: GLenum; format: GLenum; thetype: GLenum; table: PGLvoid); external dllname; - procedure glGetColorTableParameterivSGI(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetColorTableParameterfvSGI(target: GLenum; pname: GLenum; params: PGLfloat); external dllname; - -function Load_GL_SGI_color_table: Boolean; - -//***** GL_SGI_texture_color_table *****// -const - GL_TEXTURE_COLOR_TABLE_SGI = $80BC; - GL_PROXY_TEXTURE_COLOR_TABLE_SGI = $80BD; - -function Load_GL_SGI_texture_color_table: Boolean; - -//***** GL_SUN_vertex *****// - - procedure glColor4ubVertex2fSUN(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat); external dllname; - procedure glColor4ubVertex2fvSUN(const c: PGLubyte; const v: PGLfloat); external dllname; - procedure glColor4ubVertex3fSUN(r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glColor4ubVertex3fvSUN(const c: PGLubyte; const v: PGLfloat); external dllname; - procedure glColor3fVertex3fSUN(r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glColor3fVertex3fvSUN(const c: PGLfloat; const v: PGLfloat); external dllname; - procedure glNormal3fVertex3fSUN(nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glNormal3fVertex3fvSUN(const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glColor4fNormal3fVertex3fSUN(r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glColor4fNormal3fVertex3fvSUN(const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glTexCoord2fVertex3fSUN(s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glTexCoord2fVertex3fvSUN(const tc: PGLfloat; const v: PGLfloat); external dllname; - procedure glTexCoord4fVertex4fSUN(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glTexCoord4fVertex4fvSUN(const tc: PGLfloat; const v: PGLfloat); external dllname; - procedure glTexCoord2fColor4ubVertex3fSUN(s: GLfloat; t: GLfloat; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glTexCoord2fColor4ubVertex3fvSUN(const tc: PGLfloat; const c: PGLubyte; const v: PGLfloat); external dllname; - procedure glTexCoord2fColor3fVertex3fSUN(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glTexCoord2fColor3fVertex3fvSUN(const tc: PGLfloat; const c: PGLfloat; const v: PGLfloat); external dllname; - procedure glTexCoord2fNormal3fVertex3fSUN(s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glTexCoord2fNormal3fVertex3fvSUN(const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glTexCoord2fColor4fNormal3fVertex3fSUN(s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glTexCoord2fColor4fNormal3fVertex3fvSUN(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glTexCoord4fColor4fNormal3fVertex4fSUN(s: GLfloat; t: GLfloat; p: GLfloat; q: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glTexCoord4fColor4fNormal3fVertex4fvSUN(const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiVertex3fSUN(rc: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiVertex3fvSUN(const rc: PGLuint; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiColor4ubVertex3fSUN(rc: GLuint; r: GLubyte; g: GLubyte; b: GLubyte; a: GLubyte; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiColor4ubVertex3fvSUN(const rc: PGLuint; const c: PGLubyte; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiColor3fVertex3fSUN(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiColor3fVertex3fvSUN(const rc: PGLuint; const c: PGLfloat; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiNormal3fVertex3fSUN(rc: GLuint; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiNormal3fVertex3fvSUN(const rc: PGLuint; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiColor4fNormal3fVertex3fSUN(rc: GLuint; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiColor4fNormal3fVertex3fvSUN(const rc: PGLuint; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiTexCoord2fVertex3fSUN(rc: GLuint; s: GLfloat; t: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiTexCoord2fVertex3fvSUN(const rc: PGLuint; const tc: PGLfloat; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN(rc: GLuint; s: GLfloat; t: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN(const rc: PGLuint; const tc: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - procedure glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN(rc: GLuint; s: GLfloat; t: GLfloat; r: GLfloat; g: GLfloat; b: GLfloat; a: GLfloat; nx: GLfloat; ny: GLfloat; nz: GLfloat; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN(const rc: PGLuint; const tc: PGLfloat; const c: PGLfloat; const n: PGLfloat; const v: PGLfloat); external dllname; - -function Load_GL_SUN_vertex: Boolean; - -//***** GL_ARB_fragment_program *****// -const - GL_FRAGMENT_PROGRAM_ARB = $8804; - // GL_PROGRAM_FORMAT_ASCII_ARB { already defined } - // GL_PROGRAM_LENGTH_ARB { already defined } - // GL_PROGRAM_FORMAT_ARB { already defined } - // GL_PROGRAM_BINDING_ARB { already defined } - // GL_PROGRAM_INSTRUCTIONS_ARB { already defined } - // GL_MAX_PROGRAM_INSTRUCTIONS_ARB { already defined } - // GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB { already defined } - // GL_PROGRAM_TEMPORARIES_ARB { already defined } - // GL_MAX_PROGRAM_TEMPORARIES_ARB { already defined } - // GL_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB { already defined } - // GL_PROGRAM_PARAMETERS_ARB { already defined } - // GL_MAX_PROGRAM_PARAMETERS_ARB { already defined } - // GL_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB { already defined } - // GL_PROGRAM_ATTRIBS_ARB { already defined } - // GL_MAX_PROGRAM_ATTRIBS_ARB { already defined } - // GL_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } - // GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB { already defined } - // GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB { already defined } - // GL_MAX_PROGRAM_ENV_PARAMETERS_ARB { already defined } - // GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB { already defined } - GL_PROGRAM_ALU_INSTRUCTIONS_ARB = $8805; - GL_PROGRAM_TEX_INSTRUCTIONS_ARB = $8806; - GL_PROGRAM_TEX_INDIRECTIONS_ARB = $8807; - GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $8808; - GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $8809; - GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $880A; - GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = $880B; - GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = $880C; - GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = $880D; - GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = $880E; - GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = $880F; - GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = $8810; - // GL_PROGRAM_STRING_ARB { already defined } - // GL_PROGRAM_ERROR_POSITION_ARB { already defined } - // GL_CURRENT_MATRIX_ARB { already defined } - // GL_TRANSPOSE_CURRENT_MATRIX_ARB { already defined } - // GL_CURRENT_MATRIX_STACK_DEPTH_ARB { already defined } - // GL_MAX_PROGRAM_MATRICES_ARB { already defined } - // GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB { already defined } - GL_MAX_TEXTURE_COORDS_ARB = $8871; - GL_MAX_TEXTURE_IMAGE_UNITS_ARB = $8872; - // GL_PROGRAM_ERROR_STRING_ARB { already defined } - // GL_MATRIX0_ARB { already defined } - // GL_MATRIX1_ARB { already defined } - // GL_MATRIX2_ARB { already defined } - // GL_MATRIX3_ARB { already defined } - // GL_MATRIX4_ARB { already defined } - // GL_MATRIX5_ARB { already defined } - // GL_MATRIX6_ARB { already defined } - // GL_MATRIX7_ARB { already defined } - // GL_MATRIX8_ARB { already defined } - // GL_MATRIX9_ARB { already defined } - // GL_MATRIX10_ARB { already defined } - // GL_MATRIX11_ARB { already defined } - // GL_MATRIX12_ARB { already defined } - // GL_MATRIX13_ARB { already defined } - // GL_MATRIX14_ARB { already defined } - // GL_MATRIX15_ARB { already defined } - // GL_MATRIX16_ARB { already defined } - // GL_MATRIX17_ARB { already defined } - // GL_MATRIX18_ARB { already defined } - // GL_MATRIX19_ARB { already defined } - // GL_MATRIX20_ARB { already defined } - // GL_MATRIX21_ARB { already defined } - // GL_MATRIX22_ARB { already defined } - // GL_MATRIX23_ARB { already defined } - // GL_MATRIX24_ARB { already defined } - // GL_MATRIX25_ARB { already defined } - // GL_MATRIX26_ARB { already defined } - // GL_MATRIX27_ARB { already defined } - // GL_MATRIX28_ARB { already defined } - // GL_MATRIX29_ARB { already defined } - // GL_MATRIX30_ARB { already defined } - // GL_MATRIX31_ARB { already defined } - // glProgramStringARB { already defined } - // glBindProgramARB { already defined } - // glDeleteProgramsARB { already defined } - // glGenProgramsARB { already defined } - // glProgramEnvParameter4dARB { already defined } - // glProgramEnvParameter4dvARB { already defined } - // glProgramEnvParameter4fARB { already defined } - // glProgramEnvParameter4fvARB { already defined } - // glProgramLocalParameter4dARB { already defined } - // glProgramLocalParameter4dvARB { already defined } - // glProgramLocalParameter4fARB { already defined } - // glProgramLocalParameter4fvARB { already defined } - // glGetProgramEnvParameterdvARB { already defined } - // glGetProgramEnvParameterfvARB { already defined } - // glGetProgramLocalParameterdvARB { already defined } - // glGetProgramLocalParameterfvARB { already defined } - // glGetProgramivARB { already defined } - // glGetProgramStringARB { already defined } - // glIsProgramARB { already defined } - -function Load_GL_ARB_fragment_program: Boolean; - -{***** GL_ATI_text_fragment_shader *****} -const - GL_TEXT_FRAGMENT_SHADER_ATI = $8200; - -{***** GL_ARB_vertex_buffer_object *****} -const - GL_BUFFER_SIZE_ARB = $8764; - GL_BUFFER_USAGE_ARB = $8765; - GL_ARRAY_BUFFER_ARB = $8892; - GL_ELEMENT_ARRAY_BUFFER_ARB = $8893; - GL_ARRAY_BUFFER_BINDING_ARB = $8894; - GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = $8895; - GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = $8896; - GL_NORMAL_ARRAY_BUFFER_BINDING_ARB = $8897; - GL_COLOR_ARRAY_BUFFER_BINDING_ARB = $8898; - GL_INDEX_ARRAY_BUFFER_BINDING_ARB = $8899; - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = $889A; - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = $889B; - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = $889C; - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = $889D; - GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = $889E; - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = $889F; - GL_READ_ONLY_ARB = $88B8; - GL_WRITE_ONLY_ARB = $88B9; - GL_READ_WRITE_ARB = $88BA; - GL_BUFFER_ACCESS_ARB = $88BB; - GL_BUFFER_MAPPED_ARB = $88BC; - GL_BUFFER_MAP_POINTER_ARB = $88BD; - GL_STREAM_DRAW_ARB = $88E0; - GL_STREAM_READ_ARB = $88E1; - GL_STREAM_COPY_ARB = $88E2; - GL_STATIC_DRAW_ARB = $88E4; - GL_STATIC_READ_ARB = $88E5; - GL_STATIC_COPY_ARB = $88E6; - GL_DYNAMIC_DRAW_ARB = $88E8; - GL_DYNAMIC_READ_ARB = $88E9; - GL_DYNAMIC_COPY_ARB = $88EA; - - - procedure glBindBufferARB(target : GLenum; buffer: GLuint); external dllname; - procedure glDeleteBuffersARB(n : GLsizei; buffers : PGLuint); external dllname; - procedure glGenBuffersARB(n : GLsizei; buffers : PGLuint); external dllname; - function glIsBufferARB (buffer : GLuint) :GLboolean; external dllname; - procedure glBufferDataARB(target : GLenum; size:GLsizei; data:PGLvoid;usage: GLenum); external dllname; - procedure glBufferSubDataARB(target : GLenum; offset :GLint; size : GLsizei; data: PGLvoid); external dllname; - procedure glGetBufferSubDataARB(target : GLenum; offset :GLint; size : GLsizei; data: PGLvoid); external dllname; - function glMapBufferARB (target :GLenum; access: GLenum) : PGLvoid; external dllname; - function glUnmapBufferARB (target :GLenum) :GLboolean; external dllname; - procedure glGetBufferParameterivARB(target:GLenum; pname:GLenum; params:PGLint); external dllname; - procedure glGetBufferPointervARB(target: GLenum; pname:GLenum; params: PPGLvoid); external dllname; - function Load_GL_ARB_vertex_buffer_object: boolean; - -function Load_GL_ATI_text_fragment_shader: Boolean; - -//***** GL_APPLE_client_storage *****// -const - GL_UNPACK_CLIENT_STORAGE_APPLE = $85B2; - -function Load_GL_APPLE_client_storage: Boolean; - -//***** GL_APPLE_element_array *****// -const - GL_ELEMENT_ARRAY_APPLE = $8768; - GL_ELEMENT_ARRAY_TYPE_APPLE = $8769; - GL_ELEMENT_ARRAY_POINTER_APPLE = $876A; - procedure glElementPointerAPPLE(thetype: GLenum; const pointer: PGLvoid); external dllname; - procedure glDrawElementArrayAPPLE(mode: GLenum; first: GLint; count: GLsizei); external dllname; - procedure glDrawRangeElementArrayAPPLE(mode: GLenum; start: GLuint; theend: GLuint; first: GLint; count: GLsizei); external dllname; - procedure glMultiDrawElementArrayAPPLE(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); external dllname; - procedure glMultiDrawRangeElementArrayAPPLE(mode: GLenum; start: GLuint; theend: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); external dllname; - -function Load_GL_APPLE_element_array: Boolean; - -//***** GL_APPLE_fence *****// -const - GL_DRAW_PIXELS_APPLE = $8A0A; - GL_FENCE_APPLE = $8A0B; - - procedure glGenFencesAPPLE(n: GLsizei; fences: PGLuint); external dllname; - procedure glDeleteFencesAPPLE(n: GLsizei; const fences: PGLuint); external dllname; - procedure glSetFenceAPPLE(fence: GLuint); external dllname; - function glIsFenceAPPLE(fence: GLuint): GLboolean; external dllname; - function glTestFenceAPPLE(fence: GLuint): GLboolean; external dllname; - procedure glFinishFenceAPPLE(fence: GLuint); external dllname; - function glTestObjectAPPLE(theobject: GLenum; name: GLuint): GLboolean; external dllname; - procedure glFinishObjectAPPLE(theobject: GLenum; name: GLint); external dllname; - -function Load_GL_APPLE_fence: Boolean; - -//***** GL_APPLE_vertex_array_object *****// -const - GL_VERTEX_ARRAY_BINDING_APPLE = $85B5; - procedure glBindVertexArrayAPPLE(thearray: GLuint); external dllname; - procedure glDeleteVertexArraysAPPLE(n: GLsizei; const arrays: PGLuint); external dllname; - procedure glGenVertexArraysAPPLE(n: GLsizei; const arrays: PGLuint); external dllname; - function glIsVertexArrayAPPLE(thearray: GLuint): GLboolean; external dllname; - -function Load_GL_APPLE_vertex_array_object: Boolean; - -//***** GL_APPLE_vertex_array_range *****// -const - GL_VERTEX_ARRAY_RANGE_APPLE = $851D; - GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE = $851E; - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE = $8520; - GL_VERTEX_ARRAY_RANGE_POINTER_APPLE = $8521; - GL_VERTEX_ARRAY_STORAGE_HINT_APPLE = $851F; - GL_STORAGE_CACHED_APPLE = $85BE; - GL_STORAGE_SHARED_APPLE = $85BF; - - procedure glVertexArrayRangeAPPLE(length: GLsizei; pointer: PGLvoid); external dllname; - procedure glFlushVertexArrayRangeAPPLE(length: GLsizei; pointer: PGLvoid); external dllname; - procedure glVertexArrayParameteriAPPLE(pname: GLenum; param: GLint); external dllname; - -function Load_GL_APPLE_vertex_array_range: Boolean; - -//***** GL_ARB_matrix_palette *****// -const - GL_MATRIX_PALETTE_ARB = $8840; - GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = $8841; - GL_MAX_PALETTE_MATRICES_ARB = $8842; - GL_CURRENT_PALETTE_MATRIX_ARB = $8843; - GL_MATRIX_INDEX_ARRAY_ARB = $8844; - GL_CURRENT_MATRIX_INDEX_ARB = $8845; - GL_MATRIX_INDEX_ARRAY_SIZE_ARB = $8846; - GL_MATRIX_INDEX_ARRAY_TYPE_ARB = $8847; - GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = $8848; - GL_MATRIX_INDEX_ARRAY_POINTER_ARB = $8849; - - procedure glCurrentPaletteMatrixARB(index: GLint); external dllname; - procedure glMatrixIndexubvARB(size: GLint; indices: PGLubyte); external dllname; - procedure glMatrixIndexusvARB(size: GLint; indices: PGLushort); external dllname; - procedure glMatrixIndexuivARB(size: GLint; indices: PGLuint); external dllname; - procedure glMatrixIndexPointerARB(size: GLint; thetype: GLenum; stride: GLsizei; pointer: PGLvoid); external dllname; - -function Load_GL_ARB_matrix_palette: Boolean; - -//***** GL_NV_element_array *****// -const - GL_ELEMENT_ARRAY_TYPE_NV = $8769; - GL_ELEMENT_ARRAY_POINTER_NV = $876A; - - procedure glElementPointerNV(thetype: GLenum; const pointer: PGLvoid); external dllname; - procedure glDrawElementArrayNV(mode: GLenum; first: GLint; count: GLsizei); external dllname; - procedure glDrawRangeElementArrayNV(mode: GLenum; start: GLuint; theend: GLuint; first: GLint; count: GLsizei); external dllname; - procedure glMultiDrawElementArrayNV(mode: GLenum; const first: PGLint; const count: PGLsizei; primcount: GLsizei); external dllname; - procedure glMultiDrawRangeElementArrayNV(mode: GLenum; start: GLuint; theend: GLuint; const first: PGLint; const count: PGLsizei; primcount: GLsizei); external dllname; - -function Load_GL_NV_element_array: Boolean; - -//***** GL_NV_float_buffer *****// -const - GL_FLOAT_R_NV = $8880; - GL_FLOAT_RG_NV = $8881; - GL_FLOAT_RGB_NV = $8882; - GL_FLOAT_RGBA_NV = $8883; - GL_FLOAT_R16_NV = $8884; - GL_FLOAT_R32_NV = $8885; - GL_FLOAT_RG16_NV = $8886; - GL_FLOAT_RG32_NV = $8887; - GL_FLOAT_RGB16_NV = $8888; - GL_FLOAT_RGB32_NV = $8889; - GL_FLOAT_RGBA16_NV = $888A; - GL_FLOAT_RGBA32_NV = $888B; - GL_TEXTURE_FLOAT_COMPONENTS_NV = $888C; - GL_FLOAT_CLEAR_COLOR_VALUE_NV = $888D; - GL_FLOAT_RGBA_MODE_NV = $888E; - -function Load_GL_NV_float_buffer: Boolean; - -//***** GL_NV_fragment_program *****// -const - GL_FRAGMENT_PROGRAM_NV = $8870; - GL_MAX_TEXTURE_COORDS_NV = $8871; - GL_MAX_TEXTURE_IMAGE_UNITS_NV = $8872; - GL_FRAGMENT_PROGRAM_BINDING_NV = $8873; - GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = $8868; - GL_PROGRAM_ERROR_STRING_NV = $8874; - - procedure glProgramNamedParameter4fNV(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glProgramNamedParameter4dNV(id: GLuint; len: GLsizei; const name: PGLubyte; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glGetProgramNamedParameterfvNV(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLfloat); external dllname; - procedure glGetProgramNamedParameterdvNV(id: GLuint; len: GLsizei; const name: PGLubyte; params: PGLdouble); external dllname; - // glProgramLocalParameter4dARB { already defined } - // glProgramLocalParameter4dvARB { already defined } - // glProgramLocalParameter4fARB { already defined } - // glProgramLocalParameter4fvARB { already defined } - // glGetProgramLocalParameterdvARB { already defined } - // glGetProgramLocalParameterfvARB { already defined } - -function Load_GL_NV_fragment_program: Boolean; - -//***** GL_NV_primitive_restart *****// -const - GL_PRIMITIVE_RESTART_NV = $8558; - GL_PRIMITIVE_RESTART_INDEX_NV = $8559; - - procedure glPrimitiveRestartNV(); external dllname; - procedure glPrimitiveRestartIndexNV(index: GLuint); external dllname; - -function Load_GL_NV_primitive_restart: Boolean; - -//***** GL_NV_vertex_program2 *****// - -function Load_GL_NV_vertex_program2: Boolean; - - -//***** GL_NV_pixel_data_range *****// -const - GL_WRITE_PIXEL_DATA_RANGE_NV = $8878; - GL_READ_PIXEL_DATA_RANGE_NV = $8879; - GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV = $887A; - GL_READ_PIXEL_DATA_RANGE_LENGTH_NV = $887B; - GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = $887C; - GL_READ_PIXEL_DATA_RANGE_POINTER_NV = $887D; - - procedure glPixelDataRangeNV(target: GLenum; length: GLsizei; pointer: PGLvoid); external dllname; - procedure glFlushPixelDataRangeNV(target: GLenum); external dllname; - // wglAllocateMemoryNV { already defined } - // wglFreeMemoryNV { already defined } - -function Load_GL_NV_pixel_data_range: Boolean; - -//***** GL_EXT_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_EXT = $84F5; - GL_TEXTURE_BINDING_RECTANGLE_EXT = $84F6; - GL_PROXY_TEXTURE_RECTANGLE_EXT = $84F7; - GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT = $84F8; - -function Load_GL_EXT_texture_rectangle: Boolean; - -//***** GL_S3_s3tc *****// -const - GL_RGB_S3TC = $83A0; - GL_RGB4_S3TC = $83A1; - GL_RGBA_S3TC = $83A2; - GL_RGBA4_S3TC = $83A3; - -function Load_GL_S3_s3tc: Boolean; - -//***** GL_ATI_draw_buffers *****// -const - GL_MAX_DRAW_BUFFERS_ATI = $8824; - GL_DRAW_BUFFER0_ATI = $8825; - GL_DRAW_BUFFER1_ATI = $8826; - GL_DRAW_BUFFER2_ATI = $8827; - GL_DRAW_BUFFER3_ATI = $8828; - GL_DRAW_BUFFER4_ATI = $8829; - GL_DRAW_BUFFER5_ATI = $882A; - GL_DRAW_BUFFER6_ATI = $882B; - GL_DRAW_BUFFER7_ATI = $882C; - GL_DRAW_BUFFER8_ATI = $882D; - GL_DRAW_BUFFER9_ATI = $882E; - GL_DRAW_BUFFER10_ATI = $882F; - GL_DRAW_BUFFER11_ATI = $8830; - GL_DRAW_BUFFER12_ATI = $8831; - GL_DRAW_BUFFER13_ATI = $8832; - GL_DRAW_BUFFER14_ATI = $8833; - GL_DRAW_BUFFER15_ATI = $8834; - - procedure glDrawBuffersATI(n: GLsizei; const bufs: PGLenum); external dllname; - -function Load_GL_ATI_draw_buffers: Boolean; - - -//***** GL_ATI_texture_env_combine3 *****// -const - GL_MODULATE_ADD_ATI = $8744; - GL_MODULATE_SIGNED_ADD_ATI = $8745; - GL_MODULATE_SUBTRACT_ATI = $8746; - -function Load_GL_ATI_texture_env_combine3: Boolean; - -//***** GL_ATI_texture_float *****// -const - GL_RGBA_FLOAT32_ATI = $8814; - GL_RGB_FLOAT32_ATI = $8815; - GL_ALPHA_FLOAT32_ATI = $8816; - GL_INTENSITY_FLOAT32_ATI = $8817; - GL_LUMINANCE_FLOAT32_ATI = $8818; - GL_LUMINANCE_ALPHA_FLOAT32_ATI = $8819; - GL_RGBA_FLOAT16_ATI = $881A; - GL_RGB_FLOAT16_ATI = $881B; - GL_ALPHA_FLOAT16_ATI = $881C; - GL_INTENSITY_FLOAT16_ATI = $881D; - GL_LUMINANCE_FLOAT16_ATI = $881E; - GL_LUMINANCE_ALPHA_FLOAT16_ATI = $881F; - -function Load_GL_ATI_texture_float: Boolean; - -//***** GL_NV_texture_expand_normal *****// -const - GL_TEXTURE_UNSIGNED_REMAP_MODE_NV = $888F; - -function Load_GL_NV_texture_expand_normal: Boolean; - -//***** GL_NV_half_float *****// -const - GL_HALF_FLOAT_NV = $140B; - - procedure glVertex2hNV(x: GLushort; y: GLushort); external dllname; - procedure glVertex2hvNV(const v: PGLushort); external dllname; - procedure glVertex3hNV(x: GLushort; y: GLushort; z: GLushort); external dllname; - procedure glVertex3hvNV(const v: PGLushort); external dllname; - procedure glVertex4hNV(x: GLushort; y: GLushort; z: GLushort; w: GLushort); external dllname; - procedure glVertex4hvNV(const v: PGLushort); external dllname; - procedure glNormal3hNV(nx: GLushort; ny: GLushort; nz: GLushort); external dllname; - procedure glNormal3hvNV(const v: PGLushort); external dllname; - procedure glColor3hNV(red: GLushort; green: GLushort; blue: GLushort); external dllname; - procedure glColor3hvNV(const v: PGLushort); external dllname; - procedure glColor4hNV(red: GLushort; green: GLushort; blue: GLushort; alpha: GLushort); external dllname; - procedure glColor4hvNV(const v: PGLushort); external dllname; - procedure glTexCoord1hNV(s: GLushort); external dllname; - procedure glTexCoord1hvNV(const v: PGLushort); external dllname; - procedure glTexCoord2hNV(s: GLushort; t: GLushort); external dllname; - procedure glTexCoord2hvNV(const v: PGLushort); external dllname; - procedure glTexCoord3hNV(s: GLushort; t: GLushort; r: GLushort); external dllname; - procedure glTexCoord3hvNV(const v: PGLushort); external dllname; - procedure glTexCoord4hNV(s: GLushort; t: GLushort; r: GLushort; q: GLushort); external dllname; - procedure glTexCoord4hvNV(const v: PGLushort); external dllname; - procedure glMultiTexCoord1hNV(target: GLenum; s: GLushort); external dllname; - procedure glMultiTexCoord1hvNV(target: GLenum; const v: PGLushort); external dllname; - procedure glMultiTexCoord2hNV(target: GLenum; s: GLushort; t: GLushort); external dllname; - procedure glMultiTexCoord2hvNV(target: GLenum; const v: PGLushort); external dllname; - procedure glMultiTexCoord3hNV(target: GLenum; s: GLushort; t: GLushort; r: GLushort); external dllname; - procedure glMultiTexCoord3hvNV(target: GLenum; const v: PGLushort); external dllname; - procedure glMultiTexCoord4hNV(target: GLenum; s: GLushort; t: GLushort; r: GLushort; q: GLushort); external dllname; - procedure glMultiTexCoord4hvNV(target: GLenum; const v: PGLushort); external dllname; - procedure glFogCoordhNV(fog: GLushort); external dllname; - procedure glFogCoordhvNV(const fog: PGLushort); external dllname; - procedure glSecondaryColor3hNV(red: GLushort; green: GLushort; blue: GLushort); external dllname; - procedure glSecondaryColor3hvNV(const v: PGLushort); external dllname; - procedure glVertexWeighthNV(weight: GLushort); external dllname; - procedure glVertexWeighthvNV(const weight: PGLushort); external dllname; - procedure glVertexAttrib1hNV(index: GLuint; x: GLushort); external dllname; - procedure glVertexAttrib1hvNV(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttrib2hNV(index: GLuint; x: GLushort; y: GLushort); external dllname; - procedure glVertexAttrib2hvNV(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttrib3hNV(index: GLuint; x: GLushort; y: GLushort; z: GLushort); external dllname; - procedure glVertexAttrib3hvNV(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttrib4hNV(index: GLuint; x: GLushort; y: GLushort; z: GLushort; w: GLushort); external dllname; - procedure glVertexAttrib4hvNV(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttribs1hvNV(index: GLuint; n: GLsizei; const v: PGLushort); external dllname; - procedure glVertexAttribs2hvNV(index: GLuint; n: GLsizei; const v: PGLushort); external dllname; - procedure glVertexAttribs3hvNV(index: GLuint; n: GLsizei; const v: PGLushort); external dllname; - procedure glVertexAttribs4hvNV(index: GLuint; n: GLsizei; const v: PGLushort); external dllname; - -function Load_GL_NV_half_float: Boolean; - -//***** GL_ATI_map_object_buffer *****// - - function glMapObjectBufferATI(buffer: GLuint): PGLvoid; external dllname; - procedure glUnmapObjectBufferATI(buffer: GLuint); external dllname; - -function Load_GL_ATI_map_object_buffer: Boolean; - -//***** GL_ATI_separate_stencil *****// -const - GL_KEEP = $1E00; - GL_ZERO = $0000; - GL_REPLACE = $1E01; - GL_INCR = $1E02; - GL_DECR = $1E03; - GL_INVERT = $150A; - GL_NEVER = $0200; - GL_LESS = $0201; - GL_LEQUAL = $0203; - GL_GREATER = $0204; - GL_GEQUAL = $0206; - GL_EQUAL = $0202; - GL_NOTEQUAL = $0205; - GL_ALWAYS = $0207; - GL_FRONT = $0404; - GL_BACK = $0405; - GL_FRONT_AND_BACK = $0408; - GL_STENCIL_BACK_FUNC_ATI = $8800; - GL_STENCIL_BACK_FAIL_ATI = $8801; - GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = $8802; - GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = $8803; - - procedure glStencilOpSeparateATI(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); external dllname; - procedure glStencilFuncSeparateATI(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); external dllname; - -function Load_GL_ATI_separate_stencil: Boolean; - -//***** GL_ATI_vertex_attrib_array_object *****// - - procedure glVertexAttribArrayObjectATI(index: GLuint; size: GLint; thetype: GLenum; normalized: GLboolean; stride: GLsizei; buffer: GLuint; offset: GLuint); external dllname; - procedure glGetVertexAttribArrayObjectfvATI(index: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetVertexAttribArrayObjectivATI(index: GLuint; pname: GLenum; params: PGLint); external dllname; - -function Load_GL_ATI_vertex_attrib_array_object: Boolean; - -//***** GL_ARB_occlusion_query *****// -const - GL_SAMPLES_PASSED_ARB = $8914; - GL_QUERY_COUNTER_BITS_ARB = $8864; - GL_CURRENT_QUERY_ARB = $8865; - GL_QUERY_RESULT_ARB = $8866; - GL_QUERY_RESULT_AVAILABLE_ARB = $8867; - - procedure glGenQueriesARB(n: GLsizei; ids: PGLuint); external dllname; - procedure glDeleteQueriesARB(n: GLsizei; const ids: PGLuint); external dllname; - function glIsQueryARB(id: GLuint): GLboolean; external dllname; - procedure glBeginQueryARB(target: GLenum; id: GLuint); external dllname; - procedure glEndQueryARB(target: GLenum); external dllname; - procedure glGetQueryivARB(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetQueryObjectivARB(id: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetQueryObjectuivARB(id: GLuint; pname: GLenum; params: PGLuint); external dllname; - -function Load_GL_ARB_occlusion_query: Boolean; - -//***** GL_ARB_shader_objects *****// -const - GL_PROGRAM_OBJECT_ARB = $8B40; - GL_OBJECT_TYPE_ARB = $8B4E; - GL_OBJECT_SUBTYPE_ARB = $8B4F; - GL_OBJECT_DELETE_STATUS_ARB = $8B80; - GL_OBJECT_COMPILE_STATUS_ARB = $8B81; - GL_OBJECT_LINK_STATUS_ARB = $8B82; - GL_OBJECT_VALIDATE_STATUS_ARB = $8B83; - GL_OBJECT_INFO_LOG_LENGTH_ARB = $8B84; - GL_OBJECT_ATTACHED_OBJECTS_ARB = $8B85; - GL_OBJECT_ACTIVE_UNIFORMS_ARB = $8B86; - GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = $8B87; - GL_OBJECT_SHADER_SOURCE_LENGTH_ARB = $8B88; - GL_SHADER_OBJECT_ARB = $8B48; - GL_FLOAT = $1406; - GL_FLOAT_VEC2_ARB = $8B50; - GL_FLOAT_VEC3_ARB = $8B51; - GL_FLOAT_VEC4_ARB = $8B52; - GL_INT = $1404; - GL_INT_VEC2_ARB = $8B53; - GL_INT_VEC3_ARB = $8B54; - GL_INT_VEC4_ARB = $8B55; - GL_BOOL_ARB = $8B56; - GL_BOOL_VEC2_ARB = $8B57; - GL_BOOL_VEC3_ARB = $8B58; - GL_BOOL_VEC4_ARB = $8B59; - GL_FLOAT_MAT2_ARB = $8B5A; - GL_FLOAT_MAT3_ARB = $8B5B; - GL_FLOAT_MAT4_ARB = $8B5C; - - procedure glDeleteObjectARB(obj: GLhandleARB); external dllname; - function glGetHandleARB(pname: GLenum): GLhandleARB; external dllname; - procedure glDetachObjectARB(containerObj: GLhandleARB; attachedObj: GLhandleARB); external dllname; - function glCreateShaderObjectARB(shaderType: GLenum): GLhandleARB; external dllname; - procedure glShaderSourceARB(shaderObj: GLhandleARB; count: GLsizei; const str: PGLvoid; const length: PGLint); external dllname; - procedure glCompileShaderARB(shaderObj: GLhandleARB); external dllname; - function glCreateProgramObjectARB(): GLhandleARB; external dllname; - procedure glAttachObjectARB(containerObj: GLhandleARB; obj: GLhandleARB); external dllname; - procedure glLinkProgramARB(programObj: GLhandleARB); external dllname; - procedure glUseProgramObjectARB(programObj: GLhandleARB); external dllname; - procedure glValidateProgramARB(programObj: GLhandleARB); external dllname; - procedure glUniform1fARB(location: GLint; v0: GLfloat); external dllname; - procedure glUniform2fARB(location: GLint; v0: GLfloat; v1: GLfloat); external dllname; - procedure glUniform3fARB(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); external dllname; - procedure glUniform4fARB(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); external dllname; - procedure glUniform1iARB(location: GLint; v0: GLint); external dllname; - procedure glUniform2iARB(location: GLint; v0: GLint; v1: GLint); external dllname; - procedure glUniform3iARB(location: GLint; v0: GLint; v1: GLint; v2: GLint); external dllname; - procedure glUniform4iARB(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); external dllname; - procedure glUniform1fvARB(location: GLint; count: GLsizei; value: PGLfloat); external dllname; - procedure glUniform2fvARB(location: GLint; count: GLsizei; value: PGLfloat); external dllname; - procedure glUniform3fvARB(location: GLint; count: GLsizei; value: PGLfloat); external dllname; - procedure glUniform4fvARB(location: GLint; count: GLsizei; value: PGLfloat); external dllname; - procedure glUniform1ivARB(location: GLint; count: GLsizei; value: PGLint); external dllname; - procedure glUniform2ivARB(location: GLint; count: GLsizei; value: PGLint); external dllname; - procedure glUniform3ivARB(location: GLint; count: GLsizei; value: PGLint); external dllname; - procedure glUniform4ivARB(location: GLint; count: GLsizei; value: PGLint); external dllname; - procedure glUniformMatrix2fvARB(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); external dllname; - procedure glUniformMatrix3fvARB(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); external dllname; - procedure glUniformMatrix4fvARB(location: GLint; count: GLsizei; transpose: GLboolean; value: PGLfloat); external dllname; - procedure glGetObjectParameterfvARB(obj: GLhandleARB; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetObjectParameterivARB(obj: GLhandleARB; pname: GLenum; params: PGLint); external dllname; - procedure glGetInfoLogARB(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; infoLog: PGLcharARB); external dllname; - procedure glGetAttachedObjectsARB(containerObj: GLhandleARB; maxCount: GLsizei; count: PGLsizei; obj: PGLhandleARB); external dllname; - function glGetUniformLocationARB(programObj: GLhandleARB; const name: PGLcharARB): GLint; external dllname; - procedure glGetActiveUniformARB(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; thetype: PGLenum; name: PGLcharARB); external dllname; - procedure glGetUniformfvARB(programObj: GLhandleARB; location: GLint; params: PGLfloat); external dllname; - procedure glGetUniformivARB(programObj: GLhandleARB; location: GLint; params: PGLint); external dllname; - procedure glGetShaderSourceARB(obj: GLhandleARB; maxLength: GLsizei; length: PGLsizei; source: PGLcharARB); external dllname; - -function Load_GL_ARB_shader_objects: Boolean; - -//***** GL_ARB_vertex_shader *****// -const - GL_VERTEX_SHADER_ARB = $8B31; - GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = $8B4A; - GL_MAX_VARYING_FLOATS_ARB = $8B4B; - // GL_MAX_VERTEX_ATTRIBS_ARB { already defined } - // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = $8B4C; - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = $8B4D; - // GL_MAX_TEXTURE_COORDS_ARB { already defined } - // GL_VERTEX_PROGRAM_POINT_SIZE_ARB { already defined } - // GL_VERTEX_PROGRAM_TWO_SIDE_ARB { already defined } - // GL_OBJECT_TYPE_ARB { already defined } - // GL_OBJECT_SUBTYPE_ARB { already defined } - GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = $8B89; - GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = $8B8A; - // GL_SHADER_OBJECT_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB { already defined } - // GL_CURRENT_VERTEX_ATTRIB_ARB { already defined } - // GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB { already defined } - // GL_FLOAT { already defined } - // GL_FLOAT_VEC2_ARB { already defined } - // GL_FLOAT_VEC3_ARB { already defined } - // GL_FLOAT_VEC4_ARB { already defined } - // GL_FLOAT_MAT2_ARB { already defined } - // GL_FLOAT_MAT3_ARB { already defined } - // GL_FLOAT_MAT4_ARB { already defined } - // glVertexAttrib1fARB { already defined } - // glVertexAttrib1sARB { already defined } - // glVertexAttrib1dARB { already defined } - // glVertexAttrib2fARB { already defined } - // glVertexAttrib2sARB { already defined } - // glVertexAttrib2dARB { already defined } - // glVertexAttrib3fARB { already defined } - // glVertexAttrib3sARB { already defined } - // glVertexAttrib3dARB { already defined } - // glVertexAttrib4fARB { already defined } - // glVertexAttrib4sARB { already defined } - // glVertexAttrib4dARB { already defined } - // glVertexAttrib4NubARB { already defined } - // glVertexAttrib1fvARB { already defined } - // glVertexAttrib1svARB { already defined } - // glVertexAttrib1dvARB { already defined } - // glVertexAttrib2fvARB { already defined } - // glVertexAttrib2svARB { already defined } - // glVertexAttrib2dvARB { already defined } - // glVertexAttrib3fvARB { already defined } - // glVertexAttrib3svARB { already defined } - // glVertexAttrib3dvARB { already defined } - // glVertexAttrib4fvARB { already defined } - // glVertexAttrib4svARB { already defined } - // glVertexAttrib4dvARB { already defined } - // glVertexAttrib4ivARB { already defined } - // glVertexAttrib4bvARB { already defined } - // glVertexAttrib4ubvARB { already defined } - // glVertexAttrib4usvARB { already defined } - // glVertexAttrib4uivARB { already defined } - // glVertexAttrib4NbvARB { already defined } - // glVertexAttrib4NsvARB { already defined } - // glVertexAttrib4NivARB { already defined } - // glVertexAttrib4NubvARB { already defined } - // glVertexAttrib4NusvARB { already defined } - // glVertexAttrib4NuivARB { already defined } - // glVertexAttribPointerARB { already defined } - // glEnableVertexAttribArrayARB { already defined } - // glDisableVertexAttribArrayARB { already defined } - - procedure glBindAttribLocationARB(programObj: GLhandleARB; index: GLuint; const name: PGLcharARB); external dllname; - procedure glGetActiveAttribARB(programObj: GLhandleARB; index: GLuint; maxLength: GLsizei; length: PGLsizei; size: PGLint; thetype: PGLenum; name: PGLcharARB); external dllname; - function glGetAttribLocationARB(programObj: GLhandleARB; const name: PGLcharARB): GLint; external dllname; - // glGetVertexAttribdvARB { already defined } - // glGetVertexAttribfvARB { already defined } - // glGetVertexAttribivARB { already defined } - // glGetVertexAttribPointervARB { already defined } - -function Load_GL_ARB_vertex_shader: Boolean; - -//***** GL_ARB_fragment_shader *****// -const - GL_FRAGMENT_SHADER_ARB = $8B30; - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = $8B49; - // GL_MAX_TEXTURE_COORDS_ARB { already defined } - // GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } - // GL_OBJECT_TYPE_ARB { already defined } - // GL_OBJECT_SUBTYPE_ARB { already defined } - // GL_SHADER_OBJECT_ARB { already defined } - -function Load_GL_ARB_fragment_shader: Boolean; - -//***** GL_ARB_shading_language_100 *****// - -function Load_GL_ARB_shading_language_100: Boolean; - -//***** GL_ARB_texture_non_power_of_two *****// - -function Load_GL_ARB_texture_non_power_of_two: Boolean; - -//***** GL_ARB_point_sprite *****// -const - GL_POINT_SPRITE_ARB = $8861; - GL_COORD_REPLACE_ARB = $8862; - -function Load_GL_ARB_point_sprite: Boolean; - -//***** GL_EXT_depth_bounds_test *****// -const - GL_DEPTH_BOUNDS_TEST_EXT = $8890; - GL_DEPTH_BOUNDS_EXT = $8891; - - procedure glDepthBoundsEXT(zmin: GLclampd; zmax: GLclampd); external dllname; - -function Load_GL_EXT_depth_bounds_test: Boolean; - -//***** GL_EXT_texture_mirror_clamp *****// -const - GL_MIRROR_CLAMP_EXT = $8742; - GL_MIRROR_CLAMP_TO_EDGE_EXT = $8743; - GL_MIRROR_CLAMP_TO_BORDER_EXT = $8912; - -function Load_GL_EXT_texture_mirror_clamp: Boolean; - -//***** GL_EXT_blend_equation_separate *****// -const - GL_BLEND_EQUATION_RGB_EXT = $8009; - GL_BLEND_EQUATION_ALPHA_EXT = $883D; - - procedure glBlendEquationSeparateEXT(modeRGB: GLenum; modeAlpha: GLenum); external dllname; - -function Load_GL_EXT_blend_equation_separate: Boolean; - -//***** GL_MESA_pack_invert *****// -const - GL_PACK_INVERT_MESA = $8758; - -function Load_GL_MESA_pack_invert: Boolean; - -//***** GL_MESA_ycbcr_texture *****// -const - GL_YCBCR_MESA = $8757; - GL_UNSIGNED_SHORT_8_8_MESA = $85BA; - GL_UNSIGNED_SHORT_8_8_REV_MESA = $85BB; - -function Load_GL_MESA_ycbcr_texture: Boolean; - -//***** GL_ARB_fragment_program_shadow *****// - -function Load_GL_ARB_fragment_program_shadow: Boolean; - -//***** GL_NV_fragment_program_option *****// - -function Load_GL_NV_fragment_program_option: Boolean; - -//***** GL_EXT_pixel_buffer_object *****// -const - GL_PIXEL_PACK_BUFFER_EXT = $88EB; - GL_PIXEL_UNPACK_BUFFER_EXT = $88EC; - GL_PIXEL_PACK_BUFFER_BINDING_EXT = $88ED; - GL_PIXEL_UNPACK_BUFFER_BINDING_EXT = $88EF; - -function Load_GL_EXT_pixel_buffer_object: Boolean; - -//***** GL_NV_fragment_program2 *****// -const - GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = $88F4; - GL_MAX_PROGRAM_CALL_DEPTH_NV = $88F5; - GL_MAX_PROGRAM_IF_DEPTH_NV = $88F6; - GL_MAX_PROGRAM_LOOP_DEPTH_NV = $88F7; - GL_MAX_PROGRAM_LOOP_COUNT_NV = $88F8; - -function Load_GL_NV_fragment_program2: Boolean; - -//***** GL_NV_vertex_program2_option *****// - // GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV { already defined } - // GL_MAX_PROGRAM_CALL_DEPTH_NV { already defined } - -function Load_GL_NV_vertex_program2_option: Boolean; - -//***** GL_NV_vertex_program3 *****// - // GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB { already defined } - -function Load_GL_NV_vertex_program3: Boolean; - -//***** GL_ARB_draw_buffers *****// -const - GL_MAX_DRAW_BUFFERS_ARB = $8824; - GL_DRAW_BUFFER0_ARB = $8825; - GL_DRAW_BUFFER1_ARB = $8826; - GL_DRAW_BUFFER2_ARB = $8827; - GL_DRAW_BUFFER3_ARB = $8828; - GL_DRAW_BUFFER4_ARB = $8829; - GL_DRAW_BUFFER5_ARB = $882A; - GL_DRAW_BUFFER6_ARB = $882B; - GL_DRAW_BUFFER7_ARB = $882C; - GL_DRAW_BUFFER8_ARB = $882D; - GL_DRAW_BUFFER9_ARB = $882E; - GL_DRAW_BUFFER10_ARB = $882F; - GL_DRAW_BUFFER11_ARB = $8830; - GL_DRAW_BUFFER12_ARB = $8831; - GL_DRAW_BUFFER13_ARB = $8832; - GL_DRAW_BUFFER14_ARB = $8833; - GL_DRAW_BUFFER15_ARB = $8834; - - procedure glDrawBuffersARB(n: GLsizei; const bufs: PGLenum); external dllname; - -function Load_GL_ARB_draw_buffers: Boolean; - -//***** GL_ARB_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_ARB = $84F5; - GL_TEXTURE_BINDING_RECTANGLE_ARB = $84F6; - GL_PROXY_TEXTURE_RECTANGLE_ARB = $84F7; - GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = $84F8; - -function Load_GL_ARB_texture_rectangle: Boolean; - -//***** GL_ARB_color_buffer_float *****// -const - GL_RGBA_FLOAT_MODE_ARB = $8820; - GL_CLAMP_VERTEX_COLOR_ARB = $891A; - GL_CLAMP_FRAGMENT_COLOR_ARB = $891B; - GL_CLAMP_READ_COLOR_ARB = $891C; - GL_FIXED_ONLY_ARB = $891D; - WGL_TYPE_RGBA_FLOAT_ARB = $21A0; - - procedure glClampColorARB(target: GLenum; clamp: GLenum); external dllname; - -function Load_GL_ARB_color_buffer_float: Boolean; - -//***** GL_ARB_half_float_pixel *****// -const - GL_HALF_FLOAT_ARB = $140B; - -function Load_GL_ARB_half_float_pixel: Boolean; - -//***** GL_ARB_texture_float *****// -const - GL_TEXTURE_RED_TYPE_ARB = $8C10; - GL_TEXTURE_GREEN_TYPE_ARB = $8C11; - GL_TEXTURE_BLUE_TYPE_ARB = $8C12; - GL_TEXTURE_ALPHA_TYPE_ARB = $8C13; - GL_TEXTURE_LUMINANCE_TYPE_ARB = $8C14; - GL_TEXTURE_INTENSITY_TYPE_ARB = $8C15; - GL_TEXTURE_DEPTH_TYPE_ARB = $8C16; - GL_UNSIGNED_NORMALIZED_ARB = $8C17; - GL_RGBA32F_ARB = $8814; - GL_RGB32F_ARB = $8815; - GL_ALPHA32F_ARB = $8816; - GL_INTENSITY32F_ARB = $8817; - GL_LUMINANCE32F_ARB = $8818; - GL_LUMINANCE_ALPHA32F_ARB = $8819; - GL_RGBA16F_ARB = $881A; - GL_RGB16F_ARB = $881B; - GL_ALPHA16F_ARB = $881C; - GL_INTENSITY16F_ARB = $881D; - GL_LUMINANCE16F_ARB = $881E; - GL_LUMINANCE_ALPHA16F_ARB = $881F; - -function Load_GL_ARB_texture_float: Boolean; - -//***** GL_EXT_texture_compression_dxt1 *****// - // GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } - // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } - -function Load_GL_EXT_texture_compression_dxt1: Boolean; - -//***** GL_ARB_pixel_buffer_object *****// -const - GL_PIXEL_PACK_BUFFER_ARB = $88EB; - GL_PIXEL_UNPACK_BUFFER_ARB = $88EC; - GL_PIXEL_PACK_BUFFER_BINDING_ARB = $88ED; - GL_PIXEL_UNPACK_BUFFER_BINDING_ARB = $88EF; - -function Load_GL_ARB_pixel_buffer_object: Boolean; - -//***** GL_EXT_framebuffer_object *****// -const - GL_FRAMEBUFFER_EXT = $8D40; - GL_RENDERBUFFER_EXT = $8D41; - GL_STENCIL_INDEX_EXT = $8D45; - GL_STENCIL_INDEX1_EXT = $8D46; - GL_STENCIL_INDEX4_EXT = $8D47; - GL_STENCIL_INDEX8_EXT = $8D48; - GL_STENCIL_INDEX16_EXT = $8D49; - GL_RENDERBUFFER_WIDTH_EXT = $8D42; - GL_RENDERBUFFER_HEIGHT_EXT = $8D43; - GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = $8D44; - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = $8CD0; - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = $8CD1; - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = $8CD2; - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = $8CD3; - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = $8CD4; - GL_COLOR_ATTACHMENT0_EXT = $8CE0; - GL_COLOR_ATTACHMENT1_EXT = $8CE1; - GL_COLOR_ATTACHMENT2_EXT = $8CE2; - GL_COLOR_ATTACHMENT3_EXT = $8CE3; - GL_COLOR_ATTACHMENT4_EXT = $8CE4; - GL_COLOR_ATTACHMENT5_EXT = $8CE5; - GL_COLOR_ATTACHMENT6_EXT = $8CE6; - GL_COLOR_ATTACHMENT7_EXT = $8CE7; - GL_COLOR_ATTACHMENT8_EXT = $8CE8; - GL_COLOR_ATTACHMENT9_EXT = $8CE9; - GL_COLOR_ATTACHMENT10_EXT = $8CEA; - GL_COLOR_ATTACHMENT11_EXT = $8CEB; - GL_COLOR_ATTACHMENT12_EXT = $8CEC; - GL_COLOR_ATTACHMENT13_EXT = $8CED; - GL_COLOR_ATTACHMENT14_EXT = $8CEE; - GL_COLOR_ATTACHMENT15_EXT = $8CEF; - GL_DEPTH_ATTACHMENT_EXT = $8D00; - GL_STENCIL_ATTACHMENT_EXT = $8D20; - GL_FRAMEBUFFER_COMPLETE_EXT = $8CD5; - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = $8CD6; - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = $8CD7; - GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT = $8CD8; - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = $8CD9; - GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = $8CDA; - GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = $8CDB; - GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = $8CDC; - GL_FRAMEBUFFER_UNSUPPORTED_EXT = $8CDD; - GL_FRAMEBUFFER_STATUS_ERROR_EXT = $8CDE; - GL_FRAMEBUFFER_BINDING_EXT = $8CA6; - GL_RENDERBUFFER_BINDING_EXT = $8CA7; - GL_MAX_COLOR_ATTACHMENTS_EXT = $8CDF; - GL_MAX_RENDERBUFFER_SIZE_EXT = $84E8; - GL_INVALID_FRAMEBUFFER_OPERATION_EXT = $0506; - - function glIsRenderbufferEXT(renderbuffer: GLuint): GLboolean; external dllname; - procedure glBindRenderbufferEXT(target: GLenum; renderbuffer: GLuint); external dllname; - procedure glDeleteRenderbuffersEXT(n: GLsizei; const renderbuffers: PGLuint); external dllname; - procedure glGenRenderbuffersEXT(n: GLsizei; renderbuffers: PGLuint); external dllname; - procedure glRenderbufferStorageEXT(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei); external dllname; - procedure glGetRenderbufferParameterivEXT(target: GLenum; pname: GLenum; params: PGLint); external dllname; - function glIsFramebufferEXT(framebuffer: GLuint): GLboolean; external dllname; - procedure glBindFramebufferEXT(target: GLenum; framebuffer: GLuint); external dllname; - procedure glDeleteFramebuffersEXT(n: GLsizei; const framebuffers: PGLuint); external dllname; - procedure glGenFramebuffersEXT(n: GLsizei; framebuffers: PGLuint); external dllname; - function glCheckFramebufferStatusEXT(target: GLenum): GLenum; external dllname; - procedure glFramebufferTexture1DEXT(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint); external dllname; - procedure glFramebufferTexture2DEXT(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint); external dllname; - procedure glFramebufferTexture3DEXT(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint; zoffset: GLint); external dllname; - procedure glFramebufferRenderbufferEXT(target: GLenum; attachment: GLenum; renderbuffertarget: GLenum; renderbuffer: GLuint); external dllname; - procedure glGetFramebufferAttachmentParameterivEXT(target: GLenum; attachment: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGenerateMipmapEXT(target: GLenum); external dllname; - -function Load_GL_EXT_framebuffer_object: Boolean; - -//***** GL_version_1_4 *****// -const - GL_BLEND_DST_RGB = $80C8; - GL_BLEND_SRC_RGB = $80C9; - GL_BLEND_DST_ALPHA = $80CA; - GL_BLEND_SRC_ALPHA = $80CB; - GL_POINT_SIZE_MIN = $8126; - GL_POINT_SIZE_MAX = $8127; - GL_POINT_FADE_THRESHOLD_SIZE = $8128; - GL_POINT_DISTANCE_ATTENUATION = $8129; - GL_GENERATE_MIPMAP = $8191; - GL_GENERATE_MIPMAP_HINT = $8192; - GL_DEPTH_COMPONENT16 = $81A5; - GL_DEPTH_COMPONENT24 = $81A6; - GL_DEPTH_COMPONENT32 = $81A7; - GL_MIRRORED_REPEAT = $8370; - GL_FOG_COORDINATE_SOURCE = $8450; - GL_FOG_COORDINATE = $8451; - GL_FRAGMENT_DEPTH = $8452; - GL_CURRENT_FOG_COORDINATE = $8453; - GL_FOG_COORDINATE_ARRAY_TYPE = $8454; - GL_FOG_COORDINATE_ARRAY_STRIDE = $8455; - GL_FOG_COORDINATE_ARRAY_POINTER = $8456; - GL_FOG_COORDINATE_ARRAY = $8457; - GL_COLOR_SUM = $8458; - GL_CURRENT_SECONDARY_COLOR = $8459; - GL_SECONDARY_COLOR_ARRAY_SIZE = $845A; - GL_SECONDARY_COLOR_ARRAY_TYPE = $845B; - GL_SECONDARY_COLOR_ARRAY_STRIDE = $845C; - GL_SECONDARY_COLOR_ARRAY_POINTER = $845D; - GL_SECONDARY_COLOR_ARRAY = $845E; - GL_MAX_TEXTURE_LOD_BIAS = $84FD; - GL_TEXTURE_FILTER_CONTROL = $8500; - GL_TEXTURE_LOD_BIAS = $8501; - GL_INCR_WRAP = $8507; - GL_DECR_WRAP = $8508; - GL_TEXTURE_DEPTH_SIZE = $884A; - GL_DEPTH_TEXTURE_MODE = $884B; - GL_TEXTURE_COMPARE_MODE = $884C; - GL_TEXTURE_COMPARE_FUNC = $884D; - GL_COMPARE_R_TO_TEXTURE = $884E; - - procedure glBlendFuncSeparate(sfactorRGB: GLenum; dfactorRGB: GLenum; sfactorAlpha: GLenum; dfactorAlpha: GLenum); external dllname; - procedure glFogCoordf(coord: GLfloat); external dllname; - procedure glFogCoordfv(const coord: PGLfloat); external dllname; - procedure glFogCoordd(coord: GLdouble); external dllname; - procedure glFogCoorddv(const coord: PGLdouble); external dllname; - procedure glFogCoordPointer(thetype: GLenum; stride: GLsizei; const pointer: PGLvoid); external dllname; - procedure glMultiDrawArrays(mode: GLenum; first: PGLint; count: PGLsizei; primcount: GLsizei); external dllname; - procedure glMultiDrawElements(mode: GLenum; const count: PGLsizei; thetype: GLenum; const indices: PGLvoid; primcount: GLsizei); external dllname; - procedure glPointParameterf(pname: GLenum; param: GLfloat); external dllname; - procedure glPointParameterfv(pname: GLenum; const params: PGLfloat); external dllname; - procedure glPointParameteri(pname: GLenum; param: GLint); external dllname; - procedure glPointParameteriv(pname: GLenum; const params: PGLint); external dllname; - procedure glSecondaryColor3b(red: GLbyte; green: GLbyte; blue: GLbyte); external dllname; - procedure glSecondaryColor3bv(const v: PGLbyte); external dllname; - procedure glSecondaryColor3d(red: GLdouble; green: GLdouble; blue: GLdouble); external dllname; - procedure glSecondaryColor3dv(const v: PGLdouble); external dllname; - procedure glSecondaryColor3f(red: GLfloat; green: GLfloat; blue: GLfloat); external dllname; - procedure glSecondaryColor3fv(const v: PGLfloat); external dllname; - procedure glSecondaryColor3i(red: GLint; green: GLint; blue: GLint); external dllname; - procedure glSecondaryColor3iv(const v: PGLint); external dllname; - procedure glSecondaryColor3s(red: GLshort; green: GLshort; blue: GLshort); external dllname; - procedure glSecondaryColor3sv(const v: PGLshort); external dllname; - procedure glSecondaryColor3ub(red: GLubyte; green: GLubyte; blue: GLubyte); external dllname; - procedure glSecondaryColor3ubv(const v: PGLubyte); external dllname; - procedure glSecondaryColor3ui(red: GLuint; green: GLuint; blue: GLuint); external dllname; - procedure glSecondaryColor3uiv(const v: PGLuint); external dllname; - procedure glSecondaryColor3us(red: GLushort; green: GLushort; blue: GLushort); external dllname; - procedure glSecondaryColor3usv(const v: PGLushort); external dllname; - procedure glSecondaryColorPointer(size: GLint; thetype: GLenum; stride: GLsizei; const pointer: PGLvoid); external dllname; - procedure glWindowPos2d(x: GLdouble; y: GLdouble); external dllname; - procedure glWindowPos2dv(const v: PGLdouble); external dllname; - procedure glWindowPos2f(x: GLfloat; y: GLfloat); external dllname; - procedure glWindowPos2fv(const v: PGLfloat); external dllname; - procedure glWindowPos2i(x: GLint; y: GLint); external dllname; - procedure glWindowPos2iv(const v: PGLint); external dllname; - procedure glWindowPos2s(x: GLshort; y: GLshort); external dllname; - procedure glWindowPos2sv(const v: PGLshort); external dllname; - procedure glWindowPos3d(x: GLdouble; y: GLdouble; z: GLdouble); external dllname; - procedure glWindowPos3dv(const v: PGLdouble); external dllname; - procedure glWindowPos3f(x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glWindowPos3fv(const v: PGLfloat); external dllname; - procedure glWindowPos3i(x: GLint; y: GLint; z: GLint); external dllname; - procedure glWindowPos3iv(const v: PGLint); external dllname; - procedure glWindowPos3s(x: GLshort; y: GLshort; z: GLshort); external dllname; - procedure glWindowPos3sv(const v: PGLshort); external dllname; - -function Load_GL_version_1_4: Boolean; - -//***** GL_version_1_5 *****// -const - GL_BUFFER_SIZE = $8764; - GL_BUFFER_USAGE = $8765; - GL_QUERY_COUNTER_BITS = $8864; - GL_CURRENT_QUERY = $8865; - GL_QUERY_RESULT = $8866; - GL_QUERY_RESULT_AVAILABLE = $8867; - GL_ARRAY_BUFFER = $8892; - GL_ELEMENT_ARRAY_BUFFER = $8893; - GL_ARRAY_BUFFER_BINDING = $8894; - GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895; - GL_VERTEX_ARRAY_BUFFER_BINDING = $8896; - GL_NORMAL_ARRAY_BUFFER_BINDING = $8897; - GL_COLOR_ARRAY_BUFFER_BINDING = $8898; - GL_INDEX_ARRAY_BUFFER_BINDING = $8899; - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = $889A; - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = $889B; - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = $889C; - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = $889D; - GL_WEIGHT_ARRAY_BUFFER_BINDING = $889E; - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F; - GL_READ_ONLY = $88B8; - GL_WRITE_ONLY = $88B9; - GL_READ_WRITE = $88BA; - GL_BUFFER_ACCESS = $88BB; - GL_BUFFER_MAPPED = $88BC; - GL_BUFFER_MAP_POINTER = $88BD; - GL_STREAM_DRAW = $88E0; - GL_STREAM_READ = $88E1; - GL_STREAM_COPY = $88E2; - GL_STATIC_DRAW = $88E4; - GL_STATIC_READ = $88E5; - GL_STATIC_COPY = $88E6; - GL_DYNAMIC_DRAW = $88E8; - GL_DYNAMIC_READ = $88E9; - GL_DYNAMIC_COPY = $88EA; - GL_SAMPLES_PASSED = $8914; - GL_FOG_COORD_SRC = $8450; - GL_FOG_COORD = $8451; - GL_CURRENT_FOG_COORD = $8453; - GL_FOG_COORD_ARRAY_TYPE = $8454; - GL_FOG_COORD_ARRAY_STRIDE = $8455; - GL_FOG_COORD_ARRAY_POINTER = $8456; - GL_FOG_COORD_ARRAY = $8457; - GL_FOG_COORD_ARRAY_BUFFER_BINDING = $889D; - GL_SRC0_RGB = $8580; - GL_SRC1_RGB = $8581; - GL_SRC2_RGB = $8582; - GL_SRC0_ALPHA = $8588; - GL_SRC1_ALPHA = $8589; - GL_SRC2_ALPHA = $858A; - - procedure glGenQueries(n: GLsizei; ids: PGLuint); external dllname; - procedure glDeleteQueries(n: GLsizei; const ids: PGLuint); external dllname; - function glIsQuery(id: GLuint): GLboolean; external dllname; - procedure glBeginQuery(target: GLenum; id: GLuint); external dllname; - procedure glEndQuery(target: GLenum); external dllname; - procedure glGetQueryiv(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetQueryObjectiv(id: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetQueryObjectuiv(id: GLuint; pname: GLenum; params: PGLuint); external dllname; - procedure glBindBuffer(target: GLenum; buffer: GLuint); external dllname; - procedure glDeleteBuffers(n: GLsizei; const buffers: PGLuint); external dllname; - procedure glGenBuffers(n: GLsizei; buffers: PGLuint); external dllname; - function glIsBuffer(buffer: GLuint): GLboolean; external dllname; - procedure glBufferData(target: GLenum; size: GLsizeiptr; const data: PGLvoid; usage: GLenum); external dllname; - procedure glBufferSubData(target: GLenum; offset: GLintptr; size: GLsizeiptr; const data: PGLvoid); external dllname; - procedure glGetBufferSubData(target: GLenum; offset: GLintptr; size: GLsizeiptr; data: PGLvoid); external dllname; - function glMapBuffer(target: GLenum; access: GLenum): PGLvoid; external dllname; - function glUnmapBuffer(target: GLenum): GLboolean; external dllname; - procedure glGetBufferParameteriv(target: GLenum; pname: GLenum; params: PGLint); external dllname; - procedure glGetBufferPointerv(target: GLenum; pname: GLenum; params: PGLvoid); external dllname; - -function Load_GL_version_1_5: Boolean; - -//***** GL_version_2_0 *****// -const - GL_BLEND_EQUATION_RGB = $8009; - GL_VERTEX_ATTRIB_ARRAY_ENABLED = $8622; - GL_VERTEX_ATTRIB_ARRAY_SIZE = $8623; - GL_VERTEX_ATTRIB_ARRAY_STRIDE = $8624; - GL_VERTEX_ATTRIB_ARRAY_TYPE = $8625; - GL_CURRENT_VERTEX_ATTRIB = $8626; - GL_VERTEX_PROGRAM_POINT_SIZE = $8642; - GL_VERTEX_PROGRAM_TWO_SIDE = $8643; - GL_VERTEX_ATTRIB_ARRAY_POINTER = $8645; - GL_STENCIL_BACK_FUNC = $8800; - GL_STENCIL_BACK_FAIL = $8801; - GL_STENCIL_BACK_PASS_DEPTH_FAIL = $8802; - GL_STENCIL_BACK_PASS_DEPTH_PASS = $8803; - GL_MAX_DRAW_BUFFERS = $8824; - GL_DRAW_BUFFER0 = $8825; - GL_DRAW_BUFFER1 = $8826; - GL_DRAW_BUFFER2 = $8827; - GL_DRAW_BUFFER3 = $8828; - GL_DRAW_BUFFER4 = $8829; - GL_DRAW_BUFFER5 = $882A; - GL_DRAW_BUFFER6 = $882B; - GL_DRAW_BUFFER7 = $882C; - GL_DRAW_BUFFER8 = $882D; - GL_DRAW_BUFFER9 = $882E; - GL_DRAW_BUFFER10 = $882F; - GL_DRAW_BUFFER11 = $8830; - GL_DRAW_BUFFER12 = $8831; - GL_DRAW_BUFFER13 = $8832; - GL_DRAW_BUFFER14 = $8833; - GL_DRAW_BUFFER15 = $8834; - GL_BLEND_EQUATION_ALPHA = $883D; - GL_POINT_SPRITE = $8861; - GL_COORD_REPLACE = $8862; - GL_MAX_VERTEX_ATTRIBS = $8869; - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A; - GL_MAX_TEXTURE_COORDS = $8871; - GL_MAX_TEXTURE_IMAGE_UNITS = $8872; - GL_FRAGMENT_SHADER = $8B30; - GL_VERTEX_SHADER = $8B31; - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = $8B49; - GL_MAX_VERTEX_UNIFORM_COMPONENTS = $8B4A; - GL_MAX_VARYING_FLOATS = $8B4B; - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C; - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D; - GL_SHADER_TYPE = $8B4F; - GL_FLOAT_VEC2 = $8B50; - GL_FLOAT_VEC3 = $8B51; - GL_FLOAT_VEC4 = $8B52; - GL_INT_VEC2 = $8B53; - GL_INT_VEC3 = $8B54; - GL_INT_VEC4 = $8B55; - GL_BOOL = $8B56; - GL_BOOL_VEC2 = $8B57; - GL_BOOL_VEC3 = $8B58; - GL_BOOL_VEC4 = $8B59; - GL_FLOAT_MAT2 = $8B5A; - GL_FLOAT_MAT3 = $8B5B; - GL_FLOAT_MAT4 = $8B5C; - GL_SAMPLER_1D = $8B5D; - GL_SAMPLER_2D = $8B5E; - GL_SAMPLER_3D = $8B5F; - GL_SAMPLER_CUBE = $8B60; - GL_SAMPLER_1D_SHADOW = $8B61; - GL_SAMPLER_2D_SHADOW = $8B62; - GL_DELETE_STATUS = $8B80; - GL_COMPILE_STATUS = $8B81; - GL_LINK_STATUS = $8B82; - GL_VALIDATE_STATUS = $8B83; - GL_INFO_LOG_LENGTH = $8B84; - GL_ATTACHED_SHADERS = $8B85; - GL_ACTIVE_UNIFORMS = $8B86; - GL_ACTIVE_UNIFORM_MAX_LENGTH = $8B87; - GL_SHADER_SOURCE_LENGTH = $8B88; - GL_ACTIVE_ATTRIBUTES = $8B89; - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = $8B8A; - GL_FRAGMENT_SHADER_DERIVATIVE_HINT = $8B8B; - GL_SHADING_LANGUAGE_VERSION = $8B8C; - GL_CURRENT_PROGRAM = $8B8D; - GL_POINT_SPRITE_COORD_ORIGIN = $8CA0; - GL_LOWER_LEFT = $8CA1; - GL_UPPER_LEFT = $8CA2; - GL_STENCIL_BACK_REF = $8CA3; - GL_STENCIL_BACK_VALUE_MASK = $8CA4; - GL_STENCIL_BACK_WRITEMASK = $8CA5; - - procedure glBlendEquationSeparate(modeRGB: GLenum; modeAlpha: GLenum); external dllname; - procedure glDrawBuffers(n: GLsizei; const bufs: PGLenum); external dllname; - procedure glStencilOpSeparate(face: GLenum; sfail: GLenum; dpfail: GLenum; dppass: GLenum); external dllname; - procedure glStencilFuncSeparate(frontfunc: GLenum; backfunc: GLenum; ref: GLint; mask: GLuint); external dllname; - procedure glStencilMaskSeparate(face: GLenum; mask: GLuint); external dllname; - procedure glAttachShader(theProgram: GLuint; shader: GLuint); external dllname; - procedure glBindAttribLocation(theProgram: GLuint; index: GLuint; const name: PGLchar); external dllname; - procedure glCompileShader(shader: GLuint); external dllname; - function glCreateProgram(): GLuint; external dllname; - function glCreateShader(thetype: GLenum): GLuint; external dllname; - procedure glDeleteProgram(theProgram: GLuint); external dllname; - procedure glDeleteShader(shader: GLuint); external dllname; - procedure glDetachShader(theProgram: GLuint; shader: GLuint); external dllname; - procedure glDisableVertexAttribArray(index: GLuint); external dllname; - procedure glEnableVertexAttribArray(index: GLuint); external dllname; - procedure glGetActiveAttrib(theProgram: GLuint; index: GLuint; bufSize: GLsizei; length: PGLsizei; size: PGLint; thetype: PGLenum; name: PGLchar); external dllname; - procedure glGetActiveUniform(theProgram: GLuint; index: GLuint; bufSize: GLsizei; length: PGLsizei; size: PGLint; thetype: PGLenum; name: PGLchar); external dllname; - procedure glGetAttachedShaders(theProgram: GLuint; maxCount: GLsizei; count: PGLsizei; obj: PGLuint); external dllname; - function glGetAttribLocation(theProgram: GLuint; const name: PGLchar): GLint; external dllname; - procedure glGetProgramiv(theProgram: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetProgramInfoLog(theProgram: GLuint; bufSize: GLsizei; length: PGLsizei; infoLog: PGLchar); external dllname; - procedure glGetShaderiv(shader: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetShaderInfoLog(shader: GLuint; bufSize: GLsizei; length: PGLsizei; infoLog: PGLchar); external dllname; - procedure glGetShaderSource(shader: GLuint; bufSize: GLsizei; length: PGLsizei; source: PGLchar); external dllname; - function glGetUniformLocation(theProgram: GLuint; const name: PGLchar): GLint; external dllname; - procedure glGetUniformfv(theProgram: GLuint; location: GLint; params: PGLfloat); external dllname; - procedure glGetUniformiv(theProgram: GLuint; location: GLint; params: PGLint); external dllname; - procedure glGetVertexAttribdv(index: GLuint; pname: GLenum; params: PGLdouble); external dllname; - procedure glGetVertexAttribfv(index: GLuint; pname: GLenum; params: PGLfloat); external dllname; - procedure glGetVertexAttribiv(index: GLuint; pname: GLenum; params: PGLint); external dllname; - procedure glGetVertexAttribPointerv(index: GLuint; pname: GLenum; pointer: PGLvoid); external dllname; - function glIsProgram(theProgram: GLuint): GLboolean; external dllname; - function glIsShader(shader: GLuint): GLboolean; external dllname; - procedure glLinkProgram(theProgram: GLuint); external dllname; - procedure glShaderSource(shader: GLuint; count: GLsizei; const str: PGLchar; const length: PGLint); external dllname; - procedure glUseProgram(theProgram: GLuint); external dllname; - procedure glUniform1f(location: GLint; v0: GLfloat); external dllname; - procedure glUniform2f(location: GLint; v0: GLfloat; v1: GLfloat); external dllname; - procedure glUniform3f(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat); external dllname; - procedure glUniform4f(location: GLint; v0: GLfloat; v1: GLfloat; v2: GLfloat; v3: GLfloat); external dllname; - procedure glUniform1i(location: GLint; v0: GLint); external dllname; - procedure glUniform2i(location: GLint; v0: GLint; v1: GLint); external dllname; - procedure glUniform3i(location: GLint; v0: GLint; v1: GLint; v2: GLint); external dllname; - procedure glUniform4i(location: GLint; v0: GLint; v1: GLint; v2: GLint; v3: GLint); external dllname; - procedure glUniform1fv(location: GLint; count: GLsizei; const value: PGLfloat); external dllname; - procedure glUniform2fv(location: GLint; count: GLsizei; const value: PGLfloat); external dllname; - procedure glUniform3fv(location: GLint; count: GLsizei; const value: PGLfloat); external dllname; - procedure glUniform4fv(location: GLint; count: GLsizei; const value: PGLfloat); external dllname; - procedure glUniform1iv(location: GLint; count: GLsizei; const value: PGLint); external dllname; - procedure glUniform2iv(location: GLint; count: GLsizei; const value: PGLint); external dllname; - procedure glUniform3iv(location: GLint; count: GLsizei; const value: PGLint); external dllname; - procedure glUniform4iv(location: GLint; count: GLsizei; const value: PGLint); external dllname; - procedure glUniformMatrix2fv(location: GLint; count: GLsizei; transpose: GLboolean; const value: PGLfloat); external dllname; - procedure glUniformMatrix3fv(location: GLint; count: GLsizei; transpose: GLboolean; const value: PGLfloat); external dllname; - procedure glUniformMatrix4fv(location: GLint; count: GLsizei; transpose: GLboolean; const value: PGLfloat); external dllname; - procedure glValidateProgram(theProgram: GLuint); external dllname; - procedure glVertexAttrib1d(index: GLuint; x: GLdouble); external dllname; - procedure glVertexAttrib1dv(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib1f(index: GLuint; x: GLfloat); external dllname; - procedure glVertexAttrib1fv(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib1s(index: GLuint; x: GLshort); external dllname; - procedure glVertexAttrib1sv(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib2d(index: GLuint; x: GLdouble; y: GLdouble); external dllname; - procedure glVertexAttrib2dv(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib2f(index: GLuint; x: GLfloat; y: GLfloat); external dllname; - procedure glVertexAttrib2fv(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib2s(index: GLuint; x: GLshort; y: GLshort); external dllname; - procedure glVertexAttrib2sv(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib3d(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble); external dllname; - procedure glVertexAttrib3dv(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib3f(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat); external dllname; - procedure glVertexAttrib3fv(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib3s(index: GLuint; x: GLshort; y: GLshort; z: GLshort); external dllname; - procedure glVertexAttrib3sv(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib4Nbv(index: GLuint; const v: PGLbyte); external dllname; - procedure glVertexAttrib4Niv(index: GLuint; const v: PGLint); external dllname; - procedure glVertexAttrib4Nsv(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib4Nub(index: GLuint; x: GLubyte; y: GLubyte; z: GLubyte; w: GLubyte); external dllname; - procedure glVertexAttrib4Nubv(index: GLuint; const v: PGLubyte); external dllname; - procedure glVertexAttrib4Nuiv(index: GLuint; const v: PGLuint); external dllname; - procedure glVertexAttrib4Nusv(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttrib4bv(index: GLuint; const v: PGLbyte); external dllname; - procedure glVertexAttrib4d(index: GLuint; x: GLdouble; y: GLdouble; z: GLdouble; w: GLdouble); external dllname; - procedure glVertexAttrib4dv(index: GLuint; const v: PGLdouble); external dllname; - procedure glVertexAttrib4f(index: GLuint; x: GLfloat; y: GLfloat; z: GLfloat; w: GLfloat); external dllname; - procedure glVertexAttrib4fv(index: GLuint; const v: PGLfloat); external dllname; - procedure glVertexAttrib4iv(index: GLuint; const v: PGLint); external dllname; - procedure glVertexAttrib4s(index: GLuint; x: GLshort; y: GLshort; z: GLshort; w: GLshort); external dllname; - procedure glVertexAttrib4sv(index: GLuint; const v: PGLshort); external dllname; - procedure glVertexAttrib4ubv(index: GLuint; const v: PGLubyte); external dllname; - procedure glVertexAttrib4uiv(index: GLuint; const v: PGLuint); external dllname; - procedure glVertexAttrib4usv(index: GLuint; const v: PGLushort); external dllname; - procedure glVertexAttribPointer(index: GLuint; size: GLint; thetype: GLenum; normalized: GLboolean; stride: GLsizei; const pointer: PGLvoid); external dllname; - - -implementation -end. diff --git a/lib/wrappers/opengl/glu.nim b/lib/wrappers/opengl/glu.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/glu.pp b/lib/wrappers/opengl/glu.pp deleted file mode 100644 index 1594085ed..000000000 --- a/lib/wrappers/opengl/glu.pp +++ /dev/null @@ -1,368 +0,0 @@ -{ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} - -{*++ BUILD Version: 0004 // Increment this if a change has global effects - -Copyright (c) 1985-95, Microsoft Corporation - -Module Name: - - glu.h - -Abstract: - - Procedure declarations, constant definitions and macros for the OpenGL - Utility Library. - ---*} - -{* -** Copyright 1991-1993, Silicon Graphics, Inc. -** All Rights Reserved. -** -** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; -** the contents of this file may not be disclosed to third parties, copied or -** duplicated in any form, in whole or in part, without the prior written -** permission of Silicon Graphics, Inc. -** -** RESTRICTED RIGHTS LEGEND: -** Use, duplication or disclosure by the Government is subject to restrictions -** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data -** and Computer Software clause at DFARS 252.227-7013, and/or in similar or -** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - -** rights reserved under the Copyright Laws of the United States. -*} - -{* -** Return the error string associated with a particular error code. -** This will return 0 for an invalid error code. -** -** The generic function prototype that can be compiled for ANSI or Unicode -** is defined as follows: -** -** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode); -*} - -{******************************************************************************} -{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } -{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } -{******************************************************************************} - -unit GLu; - -interface - -uses - GL; - -const - dllname = 'glu32.dll'; - dylibname = '/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib'; - libname = 'libGLU.so.1'; - -type - TViewPortArray = array [0..3] of GLint; - T16dArray = array [0..15] of GLdouble; - TCallBack = procedure; - T3dArray = array [0..2] of GLdouble; - T4pArray = array [0..3] of Pointer; - T4fArray = array [0..3] of GLfloat; - PPointer = ^Pointer; - -type - GLUnurbs = record end; PGLUnurbs = ^GLUnurbs; - GLUquadric = record end; PGLUquadric = ^GLUquadric; - GLUtesselator = record end; PGLUtesselator = ^GLUtesselator; - - // backwards compatibility: - GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs; - GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric; - GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator; - GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator; - - TGLUnurbs = GLUnurbs; - TGLUquadric = GLUquadric; - TGLUtesselator = GLUtesselator; - - TGLUnurbsObj = GLUnurbsObj; - TGLUquadricObj = GLUquadricObj; - TGLUtesselatorObj = GLUtesselatorObj; - TGLUtriangulatorObj = GLUtriangulatorObj; - - - function gluErrorString(errCode: GLenum): PChar; external dllname; - function gluErrorUnicodeStringEXT(errCode: GLenum): PWideChar; external dllname; - function gluGetString(name: GLenum): PChar; external dllname; - procedure gluOrtho2D(left,right, bottom, top: GLdouble); external dllname; - procedure gluPerspective(fovy, aspect, zNear, zFar: GLdouble); external dllname; - procedure gluPickMatrix(x, y, width, height: GLdouble; var viewport: TViewPortArray); external dllname; - procedure gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble); external dllname; - function gluProject(objx, objy, objz: GLdouble; var modelMatrix, projMatrix: T16dArray; var viewport: TViewPortArray; winx, winy, winz: PGLdouble): Integer; external dllname; - function gluUnProject(winx, winy, winz: GLdouble; var modelMatrix, projMatrix: T16dArray; var viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; external dllname; - function gluScaleImage(format: GLenum; widthin, heightin: GLint; typein: GLenum; const datain: Pointer; widthout, heightout: GLint; typeout: GLenum; dataout: Pointer): Integer; external dllname; - function gluBuild1DMipmaps(target: GLenum; components, width: GLint; format, atype: GLenum; const data: Pointer): Integer; external dllname; - function gluBuild2DMipmaps(target: GLenum; components, width, height: GLint; format, atype: GLenum; const data: Pointer): Integer; external dllname; - - - function gluNewQuadric: PGLUquadric; external dllname; - procedure gluDeleteQuadric(state: PGLUquadric); external dllname; - procedure gluQuadricNormals(quadObject: PGLUquadric; normals: GLenum); external dllname; - procedure gluQuadricTexture(quadObject: PGLUquadric; textureCoords: GLboolean); external dllname; - procedure gluQuadricOrientation(quadObject: PGLUquadric; orientation: GLenum); external dllname; - procedure gluQuadricDrawStyle(quadObject: PGLUquadric; drawStyle: GLenum); external dllname; - procedure gluCylinder(qobj: PGLUquadric; baseRadius, topRadius, height: GLdouble; slices, stacks: GLint); external dllname; - procedure gluDisk(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint); external dllname; - procedure gluPartialDisk(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint; startAngle, sweepAngle: GLdouble); external dllname; - procedure gluSphere(qobj: PGLuquadric; radius: GLdouble; slices, stacks: GLint); external dllname; - procedure gluQuadricCallback(qobj: PGLUquadric; which: GLenum; fn: TCallBack); external dllname; - function gluNewTess: PGLUtesselator; external dllname; - procedure gluDeleteTess(tess: PGLUtesselator); external dllname; - procedure gluTessBeginPolygon(tess: PGLUtesselator; polygon_data: Pointer); external dllname; - procedure gluTessBeginContour(tess: PGLUtesselator); external dllname; - procedure gluTessVertex(tess: PGLUtesselator; var coords: T3dArray; data: Pointer); external dllname; - procedure gluTessEndContour(tess: PGLUtesselator); external dllname; - procedure gluTessEndPolygon(tess: PGLUtesselator); external dllname; - procedure gluTessProperty(tess: PGLUtesselator; which: GLenum; value: GLdouble); external dllname; - procedure gluTessNormal(tess: PGLUtesselator; x, y, z: GLdouble); external dllname; - procedure gluTessCallback(tess: PGLUtesselator; which: GLenum;fn: TCallBack); external dllname; - procedure gluGetTessProperty(tess: PGLUtesselator; which: GLenum; value: PGLdouble); external dllname; - function gluNewNurbsRenderer: PGLUnurbs; external dllname; - procedure gluDeleteNurbsRenderer(nobj: PGLUnurbs); external dllname; - procedure gluBeginSurface(nobj: PGLUnurbs); external dllname; - procedure gluBeginCurve(nobj: PGLUnurbs); external dllname; - procedure gluEndCurve(nobj: PGLUnurbs); external dllname; - procedure gluEndSurface(nobj: PGLUnurbs); external dllname; - procedure gluBeginTrim(nobj: PGLUnurbs); external dllname; - procedure gluEndTrim(nobj: PGLUnurbs); external dllname; - procedure gluPwlCurve(nobj: PGLUnurbs; count: GLint; aarray: PGLfloat; stride: GLint; atype: GLenum); external dllname; - procedure gluNurbsCurve(nobj: PGLUnurbs; nknots: GLint; knot: PGLfloat; stride: GLint; ctlarray: PGLfloat; order: GLint; atype: GLenum); external dllname; - procedure gluNurbsSurface(nobj: PGLUnurbs; sknot_count: GLint; sknot: PGLfloat; tknot_count: GLint; tknot: PGLfloat; s_stride, t_stride: GLint; ctlarray: PGLfloat; sorder, torder: GLint; atype: GLenum); external dllname; - procedure gluLoadSamplingMatrices(nobj: PGLUnurbs; var modelMatrix, projMatrix: T16dArray; var viewport: TViewPortArray); external dllname; - procedure gluNurbsProperty(nobj: PGLUnurbs; aproperty: GLenum; value: GLfloat); external dllname; - procedure gluGetNurbsProperty(nobj: PGLUnurbs; aproperty: GLenum; value: PGLfloat); external dllname; - procedure gluNurbsCallback(nobj: PGLUnurbs; which: GLenum; fn: TCallBack); external dllname; - -(**** Callback function prototypes ****) - -type - // gluQuadricCallback - GLUquadricErrorProc = procedure(p: GLenum); - - // gluTessCallback - GLUtessBeginProc = procedure(p: GLenum); - GLUtessEdgeFlagProc = procedure(p: GLboolean); - GLUtessVertexProc = procedure(p: Pointer); - GLUtessEndProc = procedure; - GLUtessErrorProc = procedure(p: GLenum); - GLUtessCombineProc = procedure(var p1: T3dArray; p2: T4pArray; p3: T4fArray; p4: PPointer); - GLUtessBeginDataProc = procedure(p1: GLenum; p2: Pointer); - GLUtessEdgeFlagDataProc = procedure(p1: GLboolean; p2: Pointer); - GLUtessVertexDataProc = procedure(p1, p2: Pointer); - GLUtessEndDataProc = procedure(p: Pointer); - GLUtessErrorDataProc = procedure(p1: GLenum; p2: Pointer); - GLUtessCombineDataProc = procedure(var p1: T3dArray; var p2: T4pArray; var p3: T4fArray; - p4: PPointer; p5: Pointer); - - // gluNurbsCallback - GLUnurbsErrorProc = procedure(p: GLenum); - - -//*** Generic constants ****/ - -const - // Version - GLU_VERSION_1_1 = 1; - GLU_VERSION_1_2 = 1; - - // Errors: (return value 0 = no error) - GLU_INVALID_ENUM = 100900; - GLU_INVALID_VALUE = 100901; - GLU_OUT_OF_MEMORY = 100902; - GLU_INCOMPATIBLE_GL_VERSION = 100903; - - // StringName - GLU_VERSION = 100800; - GLU_EXTENSIONS = 100801; - - // Boolean - GLU_TRUE = GL_TRUE; - GLU_FALSE = GL_FALSE; - - - //*** Quadric constants ****/ - - // QuadricNormal - GLU_SMOOTH = 100000; - GLU_FLAT = 100001; - GLU_NONE = 100002; - - // QuadricDrawStyle - GLU_POINT = 100010; - GLU_LINE = 100011; - GLU_FILL = 100012; - GLU_SILHOUETTE = 100013; - - // QuadricOrientation - GLU_OUTSIDE = 100020; - GLU_INSIDE = 100021; - - // Callback types: - // GLU_ERROR = 100103; - - - //*** Tesselation constants ****/ - - GLU_TESS_MAX_COORD = 1.0e150; - - // TessProperty - GLU_TESS_WINDING_RULE = 100140; - GLU_TESS_BOUNDARY_ONLY = 100141; - GLU_TESS_TOLERANCE = 100142; - - // TessWinding - GLU_TESS_WINDING_ODD = 100130; - GLU_TESS_WINDING_NONZERO = 100131; - GLU_TESS_WINDING_POSITIVE = 100132; - GLU_TESS_WINDING_NEGATIVE = 100133; - GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; - - // TessCallback - GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type) - GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data) - GLU_TESS_END = 100102; // void (CALLBACK*)(void) - GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno) - GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge) - GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3], - void *data[4], - GLfloat weight[4], - void **dataOut) } - GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type, - void *polygon_data) } - GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data, - void *polygon_data) } - GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data) - GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno, - void *polygon_data) } - GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge, - void *polygon_data) } - GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3], - void *data[4], - GLfloat weight[4], - void **dataOut, - void *polygon_data) } - - // TessError - GLU_TESS_ERROR1 = 100151; - GLU_TESS_ERROR2 = 100152; - GLU_TESS_ERROR3 = 100153; - GLU_TESS_ERROR4 = 100154; - GLU_TESS_ERROR5 = 100155; - GLU_TESS_ERROR6 = 100156; - GLU_TESS_ERROR7 = 100157; - GLU_TESS_ERROR8 = 100158; - - GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; - GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; - GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; - GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; - GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; - GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; - - //*** NURBS constants ****/ - - // NurbsProperty - GLU_AUTO_LOAD_MATRIX = 100200; - GLU_CULLING = 100201; - GLU_SAMPLING_TOLERANCE = 100203; - GLU_DISPLAY_MODE = 100204; - GLU_PARAMETRIC_TOLERANCE = 100202; - GLU_SAMPLING_METHOD = 100205; - GLU_U_STEP = 100206; - GLU_V_STEP = 100207; - - // NurbsSampling - GLU_PATH_LENGTH = 100215; - GLU_PARAMETRIC_ERROR = 100216; - GLU_DOMAIN_DISTANCE = 100217; - - - // NurbsTrim - GLU_MAP1_TRIM_2 = 100210; - GLU_MAP1_TRIM_3 = 100211; - - // NurbsDisplay - // GLU_FILL = 100012; - GLU_OUTLINE_POLYGON = 100240; - GLU_OUTLINE_PATCH = 100241; - - // NurbsCallback - // GLU_ERROR = 100103; - - // NurbsErrors - GLU_NURBS_ERROR1 = 100251; - GLU_NURBS_ERROR2 = 100252; - GLU_NURBS_ERROR3 = 100253; - GLU_NURBS_ERROR4 = 100254; - GLU_NURBS_ERROR5 = 100255; - GLU_NURBS_ERROR6 = 100256; - GLU_NURBS_ERROR7 = 100257; - GLU_NURBS_ERROR8 = 100258; - GLU_NURBS_ERROR9 = 100259; - GLU_NURBS_ERROR10 = 100260; - GLU_NURBS_ERROR11 = 100261; - GLU_NURBS_ERROR12 = 100262; - GLU_NURBS_ERROR13 = 100263; - GLU_NURBS_ERROR14 = 100264; - GLU_NURBS_ERROR15 = 100265; - GLU_NURBS_ERROR16 = 100266; - GLU_NURBS_ERROR17 = 100267; - GLU_NURBS_ERROR18 = 100268; - GLU_NURBS_ERROR19 = 100269; - GLU_NURBS_ERROR20 = 100270; - GLU_NURBS_ERROR21 = 100271; - GLU_NURBS_ERROR22 = 100272; - GLU_NURBS_ERROR23 = 100273; - GLU_NURBS_ERROR24 = 100274; - GLU_NURBS_ERROR25 = 100275; - GLU_NURBS_ERROR26 = 100276; - GLU_NURBS_ERROR27 = 100277; - GLU_NURBS_ERROR28 = 100278; - GLU_NURBS_ERROR29 = 100279; - GLU_NURBS_ERROR30 = 100280; - GLU_NURBS_ERROR31 = 100281; - GLU_NURBS_ERROR32 = 100282; - GLU_NURBS_ERROR33 = 100283; - GLU_NURBS_ERROR34 = 100284; - GLU_NURBS_ERROR35 = 100285; - GLU_NURBS_ERROR36 = 100286; - GLU_NURBS_ERROR37 = 100287; - -//*** Backwards compatibility for old tesselator ****/ - - - procedure gluBeginPolygon(tess: PGLUtesselator); external dllname; - procedure gluNextContour(tess: PGLUtesselator; atype: GLenum); external dllname; - procedure gluEndPolygon(tess: PGLUtesselator); external dllname; - -const - // Contours types -- obsolete! - GLU_CW = 100120; - GLU_CCW = 100121; - GLU_INTERIOR = 100122; - GLU_EXTERIOR = 100123; - GLU_UNKNOWN = 100124; - - // Names without "TESS_" prefix - GLU_BEGIN = GLU_TESS_BEGIN; - GLU_VERTEX = GLU_TESS_VERTEX; - GLU_END = GLU_TESS_END; - GLU_ERROR = GLU_TESS_ERROR; - GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; - -implementation - -end. diff --git a/lib/wrappers/opengl/glut.nim b/lib/wrappers/opengl/glut.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/glut.pp b/lib/wrappers/opengl/glut.pp deleted file mode 100644 index 3a6e7d9fc..000000000 --- a/lib/wrappers/opengl/glut.pp +++ /dev/null @@ -1,436 +0,0 @@ -{ - - Adaption of the delphi3d.net OpenGL units to FreePascal - Sebastian Guenther (sg@freepascal.org) in 2002 - These units are free to use -} - -unit Glut; - -// Copyright (c) Mark J. Kilgard, 1994, 1995, 1996. */ - -(* This program is freely distributable without licensing fees and is - provided without guarantee or warrantee expressed or implied. This - program is -not- in the public domain. *) - -{******************************************************************************} -{ Converted to Delphi by Tom Nuydens (tom@delphi3d.net) } -{ Contributions by Igor Karpov (glygrik@hotbox.ru) } -{ For the latest updates, visit Delphi3D: http://www.delphi3d.net } -{******************************************************************************} - -interface - -uses - GL; - -const - dllname = 'glut32.dll'; - dynlibname = '/System/Library/Frameworks/GLUT.framework/GLUT'; - libname = 'libglut.so.3'; - -type - PInteger = ^Integer; - PPChar = ^PChar; - TGlutVoidCallback = procedure; cdecl; - TGlut1IntCallback = procedure(value: Integer); cdecl; - TGlut2IntCallback = procedure(v1, v2: Integer); cdecl; - TGlut3IntCallback = procedure(v1, v2, v3: Integer); cdecl; - TGlut4IntCallback = procedure(v1, v2, v3, v4: Integer); cdecl; - TGlut1Char2IntCallback = procedure(c: Byte; v1, v2: Integer); cdecl; - TGlut1UInt3IntCallback = procedure(u: Cardinal; v1, v2, v3: Integer); cdecl; - -const - GLUT_API_VERSION = 3; - GLUT_XLIB_IMPLEMENTATION = 12; - // Display mode bit masks. - GLUT_RGB = 0; - GLUT_RGBA = GLUT_RGB; - GLUT_INDEX = 1; - GLUT_SINGLE = 0; - GLUT_DOUBLE = 2; - GLUT_ACCUM = 4; - GLUT_ALPHA = 8; - GLUT_DEPTH = 16; - GLUT_STENCIL = 32; - GLUT_MULTISAMPLE = 128; - GLUT_STEREO = 256; - GLUT_LUMINANCE = 512; - - // Mouse buttons. - GLUT_LEFT_BUTTON = 0; - GLUT_MIDDLE_BUTTON = 1; - GLUT_RIGHT_BUTTON = 2; - - // Mouse button state. - GLUT_DOWN = 0; - GLUT_UP = 1; - - // function keys - GLUT_KEY_F1 = 1; - GLUT_KEY_F2 = 2; - GLUT_KEY_F3 = 3; - GLUT_KEY_F4 = 4; - GLUT_KEY_F5 = 5; - GLUT_KEY_F6 = 6; - GLUT_KEY_F7 = 7; - GLUT_KEY_F8 = 8; - GLUT_KEY_F9 = 9; - GLUT_KEY_F10 = 10; - GLUT_KEY_F11 = 11; - GLUT_KEY_F12 = 12; - // directional keys - GLUT_KEY_LEFT = 100; - GLUT_KEY_UP = 101; - GLUT_KEY_RIGHT = 102; - GLUT_KEY_DOWN = 103; - GLUT_KEY_PAGE_UP = 104; - GLUT_KEY_PAGE_DOWN = 105; - GLUT_KEY_HOME = 106; - GLUT_KEY_END = 107; - GLUT_KEY_INSERT = 108; - - // Entry/exit state. - GLUT_LEFT = 0; - GLUT_ENTERED = 1; - - // Menu usage state. - GLUT_MENU_NOT_IN_USE = 0; - GLUT_MENU_IN_USE = 1; - - // Visibility state. - GLUT_NOT_VISIBLE = 0; - GLUT_VISIBLE = 1; - - // Window status state. - GLUT_HIDDEN = 0; - GLUT_FULLY_RETAINED = 1; - GLUT_PARTIALLY_RETAINED = 2; - GLUT_FULLY_COVERED = 3; - - // Color index component selection values. - GLUT_RED = 0; - GLUT_GREEN = 1; - GLUT_BLUE = 2; - - // Layers for use. - GLUT_NORMAL = 0; - GLUT_OVERLAY = 1; - -{$ifdef Windows} -const - // Stroke font constants (use these in GLUT program). - GLUT_STROKE_ROMAN = Pointer(0); - GLUT_STROKE_MONO_ROMAN = Pointer(1); - - // Bitmap font constants (use these in GLUT program). - GLUT_BITMAP_9_BY_15 = Pointer(2); - GLUT_BITMAP_8_BY_13 = Pointer(3); - GLUT_BITMAP_TIMES_ROMAN_10 = Pointer(4); - GLUT_BITMAP_TIMES_ROMAN_24 = Pointer(5); - GLUT_BITMAP_HELVETICA_10 = Pointer(6); - GLUT_BITMAP_HELVETICA_12 = Pointer(7); - GLUT_BITMAP_HELVETICA_18 = Pointer(8); -{$else Windows} -var - // Stroke font constants (use these in GLUT program). - GLUT_STROKE_ROMAN : Pointer; - GLUT_STROKE_MONO_ROMAN : Pointer; - - // Bitmap font constants (use these in GLUT program). - GLUT_BITMAP_9_BY_15 : Pointer; - GLUT_BITMAP_8_BY_13 : Pointer; - GLUT_BITMAP_TIMES_ROMAN_10 : Pointer; - GLUT_BITMAP_TIMES_ROMAN_24 : Pointer; - GLUT_BITMAP_HELVETICA_10 : Pointer; - GLUT_BITMAP_HELVETICA_12 : Pointer; - GLUT_BITMAP_HELVETICA_18 : Pointer; -{$endif Windows} -const - // glutGet parameters. - GLUT_WINDOW_X = 100; - GLUT_WINDOW_Y = 101; - GLUT_WINDOW_WIDTH = 102; - GLUT_WINDOW_HEIGHT = 103; - GLUT_WINDOW_BUFFER_SIZE = 104; - GLUT_WINDOW_STENCIL_SIZE = 105; - GLUT_WINDOW_DEPTH_SIZE = 106; - GLUT_WINDOW_RED_SIZE = 107; - GLUT_WINDOW_GREEN_SIZE = 108; - GLUT_WINDOW_BLUE_SIZE = 109; - GLUT_WINDOW_ALPHA_SIZE = 110; - GLUT_WINDOW_ACCUM_RED_SIZE = 111; - GLUT_WINDOW_ACCUM_GREEN_SIZE = 112; - GLUT_WINDOW_ACCUM_BLUE_SIZE = 113; - GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114; - GLUT_WINDOW_DOUBLEBUFFER = 115; - GLUT_WINDOW_RGBA = 116; - GLUT_WINDOW_PARENT = 117; - GLUT_WINDOW_NUM_CHILDREN = 118; - GLUT_WINDOW_COLORMAP_SIZE = 119; - GLUT_WINDOW_NUM_SAMPLES = 120; - GLUT_WINDOW_STEREO = 121; - GLUT_WINDOW_CURSOR = 122; - GLUT_SCREEN_WIDTH = 200; - GLUT_SCREEN_HEIGHT = 201; - GLUT_SCREEN_WIDTH_MM = 202; - GLUT_SCREEN_HEIGHT_MM = 203; - GLUT_MENU_NUM_ITEMS = 300; - GLUT_DISPLAY_MODE_POSSIBLE = 400; - GLUT_INIT_WINDOW_X = 500; - GLUT_INIT_WINDOW_Y = 501; - GLUT_INIT_WINDOW_WIDTH = 502; - GLUT_INIT_WINDOW_HEIGHT = 503; - GLUT_INIT_DISPLAY_MODE = 504; - GLUT_ELAPSED_TIME = 700; - GLUT_WINDOW_FORMAT_ID = 123; - - // glutDeviceGet parameters. - GLUT_HAS_KEYBOARD = 600; - GLUT_HAS_MOUSE = 601; - GLUT_HAS_SPACEBALL = 602; - GLUT_HAS_DIAL_AND_BUTTON_BOX = 603; - GLUT_HAS_TABLET = 604; - GLUT_NUM_MOUSE_BUTTONS = 605; - GLUT_NUM_SPACEBALL_BUTTONS = 606; - GLUT_NUM_BUTTON_BOX_BUTTONS = 607; - GLUT_NUM_DIALS = 608; - GLUT_NUM_TABLET_BUTTONS = 609; - GLUT_DEVICE_IGNORE_KEY_REPEAT = 610; - GLUT_DEVICE_KEY_REPEAT = 611; - GLUT_HAS_JOYSTICK = 612; - GLUT_OWNS_JOYSTICK = 613; - GLUT_JOYSTICK_BUTTONS = 614; - GLUT_JOYSTICK_AXES = 615; - GLUT_JOYSTICK_POLL_RATE = 616; - - - // glutLayerGet parameters. - GLUT_OVERLAY_POSSIBLE = 800; - GLUT_LAYER_IN_USE = 801; - GLUT_HAS_OVERLAY = 802; - GLUT_TRANSPARENT_INDEX = 803; - GLUT_NORMAL_DAMAGED = 804; - GLUT_OVERLAY_DAMAGED = 805; - - // glutVideoResizeGet parameters. - GLUT_VIDEO_RESIZE_POSSIBLE = 900; - GLUT_VIDEO_RESIZE_IN_USE = 901; - GLUT_VIDEO_RESIZE_X_DELTA = 902; - GLUT_VIDEO_RESIZE_Y_DELTA = 903; - GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904; - GLUT_VIDEO_RESIZE_HEIGHT_DELTA = 905; - GLUT_VIDEO_RESIZE_X = 906; - GLUT_VIDEO_RESIZE_Y = 907; - GLUT_VIDEO_RESIZE_WIDTH = 908; - GLUT_VIDEO_RESIZE_HEIGHT = 909; - - // glutGetModifiers return mask. - GLUT_ACTIVE_SHIFT = 1; - GLUT_ACTIVE_CTRL = 2; - GLUT_ACTIVE_ALT = 4; - - // glutSetCursor parameters. - // Basic arrows. - GLUT_CURSOR_RIGHT_ARROW = 0; - GLUT_CURSOR_LEFT_ARROW = 1; - // Symbolic cursor shapes. - GLUT_CURSOR_INFO = 2; - GLUT_CURSOR_DESTROY = 3; - GLUT_CURSOR_HELP = 4; - GLUT_CURSOR_CYCLE = 5; - GLUT_CURSOR_SPRAY = 6; - GLUT_CURSOR_WAIT = 7; - GLUT_CURSOR_TEXT = 8; - GLUT_CURSOR_CROSSHAIR = 9; - // Directional cursors. - GLUT_CURSOR_UP_DOWN = 10; - GLUT_CURSOR_LEFT_RIGHT = 11; - // Sizing cursors. - GLUT_CURSOR_TOP_SIDE = 12; - GLUT_CURSOR_BOTTOM_SIDE = 13; - GLUT_CURSOR_LEFT_SIDE = 14; - GLUT_CURSOR_RIGHT_SIDE = 15; - GLUT_CURSOR_TOP_LEFT_CORNER = 16; - GLUT_CURSOR_TOP_RIGHT_CORNER = 17; - GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18; - GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19; - // Inherit from parent window. - GLUT_CURSOR_INHERIT = 100; - // Blank cursor. - GLUT_CURSOR_NONE = 101; - // Fullscreen crosshair (if available). - GLUT_CURSOR_FULL_CROSSHAIR = 102; - - // GLUT device control sub-API. - // glutSetKeyRepeat modes. - GLUT_KEY_REPEAT_OFF = 0; - GLUT_KEY_REPEAT_ON = 1; - GLUT_KEY_REPEAT_DEFAULT = 2; - -// Joystick button masks. - GLUT_JOYSTICK_BUTTON_A = 1; - GLUT_JOYSTICK_BUTTON_B = 2; - GLUT_JOYSTICK_BUTTON_C = 4; - GLUT_JOYSTICK_BUTTON_D = 8; - - // GLUT game mode sub-API. - // glutGameModeGet. - GLUT_GAME_MODE_ACTIVE = 0; - GLUT_GAME_MODE_POSSIBLE = 1; - GLUT_GAME_MODE_WIDTH = 2; - GLUT_GAME_MODE_HEIGHT = 3; - GLUT_GAME_MODE_PIXEL_DEPTH = 4; - GLUT_GAME_MODE_REFRESH_RATE = 5; - GLUT_GAME_MODE_DISPLAY_CHANGED = 6; - - -// GLUT initialization sub-API. - procedure glutInit(argcp: PInteger; argv: PPChar); external dllname; - procedure glutInitDisplayMode(mode: Word); external dllname; - procedure glutInitDisplayString(const str: PChar); external dllname; - procedure glutInitWindowPosition(x, y: Integer); external dllname; - procedure glutInitWindowSize(width, height: Integer); external dllname; - procedure glutMainLoop; external dllname; - -// GLUT window sub-API. - function glutCreateWindow(const title: PChar): Integer; external dllname; - function glutCreateSubWindow(win, x, y, width, height: Integer): Integer; external dllname; - procedure glutDestroyWindow(win: Integer); external dllname; - procedure glutPostRedisplay; external dllname; - procedure glutPostWindowRedisplay(win: Integer); external dllname; - procedure glutSwapBuffers; external dllname; - function glutGetWindow: Integer; external dllname; - procedure glutSetWindow(win: Integer); external dllname; - procedure glutSetWindowTitle(const title: PChar); external dllname; - procedure glutSetIconTitle(const title: PChar); external dllname; - procedure glutPositionWindow(x, y: Integer); external dllname; - procedure glutReshapeWindow(width, height: Integer); external dllname; - procedure glutPopWindow; external dllname; - procedure glutPushWindow; external dllname; - procedure glutIconifyWindow; external dllname; - procedure glutShowWindow; external dllname; - procedure glutHideWindow; external dllname; - procedure glutFullScreen; external dllname; - procedure glutSetCursor(cursor: Integer); external dllname; - procedure glutWarpPointer(x, y: Integer); external dllname; - -// GLUT overlay sub-API. - procedure glutEstablishOverlay; external dllname; - procedure glutRemoveOverlay; external dllname; - procedure glutUseLayer(layer: GLenum); external dllname; - procedure glutPostOverlayRedisplay; external dllname; - procedure glutPostWindowOverlayRedisplay(win: Integer); external dllname; - procedure glutShowOverlay; external dllname; - procedure glutHideOverlay; external dllname; - -// GLUT menu sub-API. - function glutCreateMenu(callback: TGlut1IntCallback): Integer; external dllname; - procedure glutDestroyMenu(menu: Integer); external dllname; - function glutGetMenu: Integer; external dllname; - procedure glutSetMenu(menu: Integer); external dllname; - procedure glutAddMenuEntry(const caption: PChar; value: Integer); external dllname; - procedure glutAddSubMenu(const caption: PChar; submenu: Integer); external dllname; - procedure glutChangeToMenuEntry(item: Integer; const caption: PChar; value: Integer); external dllname; - procedure glutChangeToSubMenu(item: Integer; const caption: PChar; submenu: Integer); external dllname; - procedure glutRemoveMenuItem(item: Integer); external dllname; - procedure glutAttachMenu(button: Integer); external dllname; - procedure glutDetachMenu(button: Integer); external dllname; - -// GLUT window callback sub-API. - procedure glutDisplayFunc(f: TGlutVoidCallback); external dllname; - procedure glutReshapeFunc(f: TGlut2IntCallback); external dllname; - procedure glutKeyboardFunc(f: TGlut1Char2IntCallback); external dllname; - procedure glutMouseFunc(f: TGlut4IntCallback); external dllname; - procedure glutMotionFunc(f: TGlut2IntCallback); external dllname; - procedure glutPassiveMotionFunc(f: TGlut2IntCallback); external dllname; - procedure glutEntryFunc(f: TGlut1IntCallback); external dllname; - procedure glutVisibilityFunc(f: TGlut1IntCallback); external dllname; - procedure glutIdleFunc(f: TGlutVoidCallback); external dllname; - procedure glutTimerFunc(millis: Word; f: TGlut1IntCallback; value: Integer); external dllname; - procedure glutMenuStateFunc(f: TGlut1IntCallback); external dllname; - procedure glutSpecialFunc(f: TGlut3IntCallback); external dllname; - procedure glutSpaceballMotionFunc(f: TGlut3IntCallback); external dllname; - procedure glutSpaceballRotateFunc(f: TGlut3IntCallback); external dllname; - procedure glutSpaceballButtonFunc(f: TGlut2IntCallback); external dllname; - procedure glutButtonBoxFunc(f: TGlut2IntCallback); external dllname; - procedure glutDialsFunc(f: TGlut2IntCallback); external dllname; - procedure glutTabletMotionFunc(f: TGlut2IntCallback); external dllname; - procedure glutTabletButtonFunc(f: TGlut4IntCallback); external dllname; - procedure glutMenuStatusFunc(f: TGlut3IntCallback); external dllname; - procedure glutOverlayDisplayFunc(f:TGlutVoidCallback); external dllname; - procedure glutWindowStatusFunc(f: TGlut1IntCallback); external dllname; - procedure glutKeyboardUpFunc(f: TGlut1Char2IntCallback); external dllname; - procedure glutSpecialUpFunc(f: TGlut3IntCallback); external dllname; - procedure glutJoystickFunc(f: TGlut1UInt3IntCallback; pollInterval: Integer); external dllname; - -// GLUT color index sub-API. - procedure glutSetColor(cell: Integer; red, green, blue: GLfloat); external dllname; - function glutGetColor(ndx, component: Integer): GLfloat; external dllname; - procedure glutCopyColormap(win: Integer); external dllname; - -// GLUT state retrieval sub-API. - function glutGet(t: GLenum): Integer; external dllname; - function glutDeviceGet(t: GLenum): Integer; external dllname; - -// GLUT extension support sub-API - function glutExtensionSupported(const name: PChar): Integer; external dllname; - function glutGetModifiers: Integer; external dllname; - function glutLayerGet(t: GLenum): Integer; external dllname; - -// GLUT font sub-API - procedure glutBitmapCharacter(font : pointer; character: Integer); external dllname; - function glutBitmapWidth(font : pointer; character: Integer): Integer; external dllname; - procedure glutStrokeCharacter(font : pointer; character: Integer); external dllname; - function glutStrokeWidth(font : pointer; character: Integer): Integer; external dllname; - function glutBitmapLength(font: pointer; const str: PChar): Integer; external dllname; - function glutStrokeLength(font: pointer; const str: PChar): Integer; external dllname; - -// GLUT pre-built models sub-API - procedure glutWireSphere(radius: GLdouble; slices, stacks: GLint); external dllname; - procedure glutSolidSphere(radius: GLdouble; slices, stacks: GLint); external dllname; - procedure glutWireCone(base, height: GLdouble; slices, stacks: GLint); external dllname; - procedure glutSolidCone(base, height: GLdouble; slices, stacks: GLint); external dllname; - procedure glutWireCube(size: GLdouble); external dllname; - procedure glutSolidCube(size: GLdouble); external dllname; - procedure glutWireTorus(innerRadius, outerRadius: GLdouble; sides, rings: GLint); external dllname; - procedure glutSolidTorus(innerRadius, outerRadius: GLdouble; sides, rings: GLint); external dllname; - procedure glutWireDodecahedron; external dllname; - procedure glutSolidDodecahedron; external dllname; - procedure glutWireTeapot(size: GLdouble); external dllname; - procedure glutSolidTeapot(size: GLdouble); external dllname; - procedure glutWireOctahedron; external dllname; - procedure glutSolidOctahedron; external dllname; - procedure glutWireTetrahedron; external dllname; - procedure glutSolidTetrahedron; external dllname; - procedure glutWireIcosahedron; external dllname; - procedure glutSolidIcosahedron; external dllname; - -// GLUT video resize sub-API. - function glutVideoResizeGet(param: GLenum): Integer; external dllname; - procedure glutSetupVideoResizing; external dllname; - procedure glutStopVideoResizing; external dllname; - procedure glutVideoResize(x, y, width, height: Integer); external dllname; - procedure glutVideoPan(x, y, width, height: Integer); external dllname; - -// GLUT debugging sub-API. - procedure glutReportErrors; external dllname; - -// GLUT device control sub-API. - - procedure glutIgnoreKeyRepeat(ignore: Integer); external dllname; - procedure glutSetKeyRepeat(repeatMode: Integer); external dllname; - procedure glutForceJoystickFunc; external dllname; - -// GLUT game mode sub-API. - - //example glutGameModeString('1280x1024:32@75'); - procedure glutGameModeString (const AString : PChar); external dllname; - function glutEnterGameMode : integer; external dllname; - procedure glutLeaveGameMode; external dllname; - function glutGameModeGet (mode : GLenum) : integer; external dllname; - - -implementation - -end. diff --git a/lib/wrappers/opengl/glx.nim b/lib/wrappers/opengl/glx.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/glx.pp b/lib/wrappers/opengl/glx.pp deleted file mode 100644 index 2b8c1eed7..000000000 --- a/lib/wrappers/opengl/glx.pp +++ /dev/null @@ -1,156 +0,0 @@ -{ - - Translation of the Mesa GLX headers for FreePascal - Copyright (C) 1999 Sebastian Guenther - - - Mesa 3-D graphics library - Version: 3.0 - Copyright (C) 1995-1998 Brian Paul - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -} - -unit GLX; - -interface - -{$IFDEF Unix} - uses - X, XLib, XUtil, gl; - {$DEFINE HasGLX} // Activate GLX stuff -{$ELSE} - {$MESSAGE Unsupported platform.} -{$ENDIF} - -{$IFNDEF HasGLX} - {$MESSAGE GLX not present on this platform.} -{$ENDIF} - -const - dylibname = '/usr/X11R6/lib/libGL.dylib'; - -// ======================================================= -// GLX consts, types and functions -// ======================================================= - -// Tokens for glXChooseVisual and glXGetConfig: -const - GLX_USE_GL = 1; - GLX_BUFFER_SIZE = 2; - GLX_LEVEL = 3; - GLX_RGBA = 4; - GLX_DOUBLEBUFFER = 5; - GLX_STEREO = 6; - GLX_AUX_BUFFERS = 7; - GLX_RED_SIZE = 8; - GLX_GREEN_SIZE = 9; - GLX_BLUE_SIZE = 10; - GLX_ALPHA_SIZE = 11; - GLX_DEPTH_SIZE = 12; - GLX_STENCIL_SIZE = 13; - GLX_ACCUM_RED_SIZE = 14; - GLX_ACCUM_GREEN_SIZE = 15; - GLX_ACCUM_BLUE_SIZE = 16; - GLX_ACCUM_ALPHA_SIZE = 17; - - // GLX_EXT_visual_info extension - GLX_X_VISUAL_TYPE_EXT = $22; - GLX_TRANSPARENT_TYPE_EXT = $23; - GLX_TRANSPARENT_INDEX_VALUE_EXT = $24; - GLX_TRANSPARENT_RED_VALUE_EXT = $25; - GLX_TRANSPARENT_GREEN_VALUE_EXT = $26; - GLX_TRANSPARENT_BLUE_VALUE_EXT = $27; - GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28; - - - // Error codes returned by glXGetConfig: - GLX_BAD_SCREEN = 1; - GLX_BAD_ATTRIBUTE = 2; - GLX_NO_EXTENSION = 3; - GLX_BAD_VISUAL = 4; - GLX_BAD_CONTEXT = 5; - GLX_BAD_VALUE = 6; - GLX_BAD_ENUM = 7; - - // GLX 1.1 and later: - GLX_VENDOR = 1; - GLX_VERSION = 2; - GLX_EXTENSIONS = 3; - - // GLX_visual_info extension - GLX_TRUE_COLOR_EXT = $8002; - GLX_DIRECT_COLOR_EXT = $8003; - GLX_PSEUDO_COLOR_EXT = $8004; - GLX_STATIC_COLOR_EXT = $8005; - GLX_GRAY_SCALE_EXT = $8006; - GLX_STATIC_GRAY_EXT = $8007; - GLX_NONE_EXT = $8000; - GLX_TRANSPARENT_RGB_EXT = $8008; - GLX_TRANSPARENT_INDEX_EXT = $8009; - -type - // From XLib: - XPixmap = TXID; - XFont = TXID; - XColormap = TXID; - - GLXContext = Pointer; - GLXPixmap = TXID; - GLXDrawable = TXID; - GLXContextID = TXID; - - TXPixmap = XPixmap; - TXFont = XFont; - TXColormap = XColormap; - - TGLXContext = GLXContext; - TGLXPixmap = GLXPixmap; - TGLXDrawable = GLXDrawable; - TGLXContextID = GLXContextID; - -function glXChooseVisual(dpy: PDisplay; screen: Integer; attribList: PInteger): PXVisualInfo; cdecl; external dllname; -function glXCreateContext(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl; external dllname; -procedure glXDestroyContext(dpy: PDisplay; ctx: GLXContext); cdecl; external dllname; -function glXMakeCurrent(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl; external dllname; -procedure glXCopyContext(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl; external dllname; -procedure glXSwapBuffers(dpy: PDisplay; drawable: GLXDrawable); cdecl; external dllname; -function glXCreateGLXPixmap(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl; external dllname; -procedure glXDestroyGLXPixmap(dpy: PDisplay; pixmap: GLXPixmap); cdecl; external dllname; -function glXQueryExtension(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl; external dllname; -function glXQueryVersion(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl; external dllname; -function glXIsDirect(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl; external dllname; -function glXGetConfig(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl; external dllname; -function glXGetCurrentContext: GLXContext; cdecl; external dllname; -function glXGetCurrentDrawable: GLXDrawable; cdecl; external dllname; -procedure glXWaitGL; cdecl; external dllname; -procedure glXWaitX; cdecl; external dllname; -procedure glXUseXFont(font: XFont; first, count, list: Integer); cdecl; external dllname; - -// GLX 1.1 and later -function glXQueryExtensionsString(dpy: PDisplay; screen: Integer): PChar; cdecl; external dllname; -function glXQueryServerString(dpy: PDisplay; screen, name: Integer): PChar; cdecl; external dllname; -function glXGetClientString(dpy: PDisplay; name: Integer): PChar; cdecl; external dllname; - -// Mesa GLX Extensions -function glXCreateGLXPixmapMESA(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl; external dllname; -function glXReleaseBufferMESA(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl; external dllname; -procedure glXCopySubBufferMESA(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl; external dllname; -function glXGetVideoSyncSGI(var counter: LongWord): Integer; cdecl; external dllname; -function glXWaitVideoSyncSGI(divisor, remainder: Integer; var count: LongWord): Integer; cdecl; external dllname; - -implementation - -end. diff --git a/lib/wrappers/opengl/wingl.nim b/lib/wrappers/opengl/wingl.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/opengl/wingl.pp b/lib/wrappers/opengl/wingl.pp deleted file mode 100644 index 70be6674e..000000000 --- a/lib/wrappers/opengl/wingl.pp +++ /dev/null @@ -1,313 +0,0 @@ -unit wingl; - -interface - -uses gl; - -function wglGetExtensionsStringARB(hdc: HDC): Pchar; external dllname; - -function Load_WGL_ARB_extensions_string: Boolean; external dllname; - -const - WGL_FRONT_COLOR_BUFFER_BIT_ARB = $0001; - WGL_BACK_COLOR_BUFFER_BIT_ARB = $0002; - WGL_DEPTH_BUFFER_BIT_ARB = $0004; - WGL_STENCIL_BUFFER_BIT_ARB = $0008; - -function WinChoosePixelFormat(DC: HDC; p2: PPixelFormatDescriptor): Integer; external dllname; external 'gdi32' name 'ChoosePixelFormat'; - -function wglCreateBufferRegionARB(hDC: HDC; iLayerPlane: TGLint; uType: TGLuint): THandle; external dllname; -procedure wglDeleteBufferRegionARB(hRegion: THandle); external dllname; -function wglSaveBufferRegionARB(hRegion: THandle; x: TGLint; y: TGLint; width: TGLint; height: TGLint): BOOL; external dllname; -function wglRestoreBufferRegionARB(hRegion: THandle; x: TGLint; y: TGLint; width: TGLint; height: TGLint; xSrc: TGLint; ySrc: TGLint): BOOL; external dllname; - - function wglAllocateMemoryNV(size: TGLsizei; readFrequency: TGLfloat; writeFrequency: TGLfloat; priority: TGLfloat): PGLvoid; external dllname; - procedure wglFreeMemoryNV(pointer: PGLvoid); external dllname; - -const - WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = $0001; - WGL_IMAGE_BUFFER_LOCK_I3D = $0002; - - function wglCreateImageBufferI3D(hDC: HDC; dwSize: DWORD; uFlags: UINT): PGLvoid; external dllname; - function wglDestroyImageBufferI3D(hDC: HDC; pAddress: PGLvoid): BOOL; external dllname; - function wglAssociateImageBufferEventsI3D(hdc: HDC; pEvent: PHandle; pAddress: PGLvoid; pSize: PDWORD; count: UINT): BOOL; external dllname; - function wglReleaseImageBufferEventsI3D(hdc: HDC; pAddress: PGLvoid; count: UINT): BOOL; external dllname; - - function wglEnableFrameLockI3D(): BOOL; external dllname; - function wglDisableFrameLockI3D(): BOOL; external dllname; - function wglIsEnabledFrameLockI3D(pFlag: PBOOL): BOOL; external dllname; - function wglQueryFrameLockMasterI3D(pFlag: PBOOL): BOOL; external dllname; - - function wglGetFrameUsageI3D(pUsage: PGLfloat): BOOL; external dllname; - function wglBeginFrameTrackingI3D(): BOOL; external dllname; - function wglEndFrameTrackingI3D(): BOOL; external dllname; - function wglQueryFrameTrackingI3D(pFrameCount: PDWORD; pMissedFrames: PDWORD; pLastMissedUsage: PGLfloat): BOOL; external dllname; - -const - WGL_NUMBER_PIXEL_FORMATS_ARB = $2000; - WGL_DRAW_TO_WINDOW_ARB = $2001; - WGL_DRAW_TO_BITMAP_ARB = $2002; - WGL_ACCELERATION_ARB = $2003; - WGL_NEED_PALETTE_ARB = $2004; - WGL_NEED_SYSTEM_PALETTE_ARB = $2005; - WGL_SWAP_LAYER_BUFFERS_ARB = $2006; - WGL_SWAP_METHOD_ARB = $2007; - WGL_NUMBER_OVERLAYS_ARB = $2008; - WGL_NUMBER_UNDERLAYS_ARB = $2009; - WGL_TRANSPARENT_ARB = $200A; - WGL_TRANSPARENT_RED_VALUE_ARB = $2037; - WGL_TRANSPARENT_GREEN_VALUE_ARB = $2038; - WGL_TRANSPARENT_BLUE_VALUE_ARB = $2039; - WGL_TRANSPARENT_ALPHA_VALUE_ARB = $203A; - WGL_TRANSPARENT_INDEX_VALUE_ARB = $203B; - WGL_SHARE_DEPTH_ARB = $200C; - WGL_SHARE_STENCIL_ARB = $200D; - WGL_SHARE_ACCUM_ARB = $200E; - WGL_SUPPORT_GDI_ARB = $200F; - WGL_SUPPORT_OPENGL_ARB = $2010; - WGL_DOUBLE_BUFFER_ARB = $2011; - WGL_STEREO_ARB = $2012; - WGL_PIXEL_TYPE_ARB = $2013; - WGL_COLOR_BITS_ARB = $2014; - WGL_RED_BITS_ARB = $2015; - WGL_RED_SHIFT_ARB = $2016; - WGL_GREEN_BITS_ARB = $2017; - WGL_GREEN_SHIFT_ARB = $2018; - WGL_BLUE_BITS_ARB = $2019; - WGL_BLUE_SHIFT_ARB = $201A; - WGL_ALPHA_BITS_ARB = $201B; - WGL_ALPHA_SHIFT_ARB = $201C; - WGL_ACCUM_BITS_ARB = $201D; - WGL_ACCUM_RED_BITS_ARB = $201E; - WGL_ACCUM_GREEN_BITS_ARB = $201F; - WGL_ACCUM_BLUE_BITS_ARB = $2020; - WGL_ACCUM_ALPHA_BITS_ARB = $2021; - WGL_DEPTH_BITS_ARB = $2022; - WGL_STENCIL_BITS_ARB = $2023; - WGL_AUX_BUFFERS_ARB = $2024; - WGL_NO_ACCELERATION_ARB = $2025; - WGL_GENERIC_ACCELERATION_ARB = $2026; - WGL_FULL_ACCELERATION_ARB = $2027; - WGL_SWAP_EXCHANGE_ARB = $2028; - WGL_SWAP_COPY_ARB = $2029; - WGL_SWAP_UNDEFINED_ARB = $202A; - WGL_TYPE_RGBA_ARB = $202B; - WGL_TYPE_COLORINDEX_ARB = $202C; - - function wglGetPixelFormatAttribivARB(hdc: HDC; iPixelFormat: TGLint; iLayerPlane: TGLint; nAttributes: TGLuint; const piAttributes: PGLint; piValues: PGLint): BOOL; external dllname; - function wglGetPixelFormatAttribfvARB(hdc: HDC; iPixelFormat: TGLint; iLayerPlane: TGLint; nAttributes: TGLuint; const piAttributes: PGLint; pfValues: PGLfloat): BOOL; external dllname; - function wglChoosePixelFormatARB(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: TGLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; external dllname; - - -const - WGL_ERROR_INVALID_PIXEL_TYPE_ARB = $2043; - WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = $2054; - - function wglMakeContextCurrentARB(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; external dllname; - function wglGetCurrentReadDCARB(): HDC; external dllname; - -function Load_WGL_ARB_make_current_read: Boolean; - -const - WGL_DRAW_TO_PBUFFER_ARB = $202D; - // WGL_DRAW_TO_PBUFFER_ARB { already defined } - WGL_MAX_PBUFFER_PIXELS_ARB = $202E; - WGL_MAX_PBUFFER_WIDTH_ARB = $202F; - WGL_MAX_PBUFFER_HEIGHT_ARB = $2030; - WGL_PBUFFER_LARGEST_ARB = $2033; - WGL_PBUFFER_WIDTH_ARB = $2034; - WGL_PBUFFER_HEIGHT_ARB = $2035; - WGL_PBUFFER_LOST_ARB = $2036; - - function wglCreatePbufferARB(hDC: HDC; iPixelFormat: TGLint; iWidth: TGLint; iHeight: TGLint; const piAttribList: PGLint): THandle; external dllname; - function wglGetPbufferDCARB(hPbuffer: THandle): HDC; external dllname; - function wglReleasePbufferDCARB(hPbuffer: THandle; hDC: HDC): TGLint; external dllname; - function wglDestroyPbufferARB(hPbuffer: THandle): BOOL; external dllname; - function wglQueryPbufferARB(hPbuffer: THandle; iAttribute: TGLint; piValue: PGLint): BOOL; external dllname; - - - function wglSwapIntervalEXT(interval: TGLint): BOOL; external dllname; - function wglGetSwapIntervalEXT(): TGLint; external dllname; - -const - WGL_BIND_TO_TEXTURE_RGB_ARB = $2070; - WGL_BIND_TO_TEXTURE_RGBA_ARB = $2071; - WGL_TEXTURE_FORMAT_ARB = $2072; - WGL_TEXTURE_TARGET_ARB = $2073; - WGL_MIPMAP_TEXTURE_ARB = $2074; - WGL_TEXTURE_RGB_ARB = $2075; - WGL_TEXTURE_RGBA_ARB = $2076; - WGL_NO_TEXTURE_ARB = $2077; - WGL_TEXTURE_CUBE_MAP_ARB = $2078; - WGL_TEXTURE_1D_ARB = $2079; - WGL_TEXTURE_2D_ARB = $207A; - // WGL_NO_TEXTURE_ARB { already defined } - WGL_MIPMAP_LEVEL_ARB = $207B; - WGL_CUBE_MAP_FACE_ARB = $207C; - WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = $207D; - WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = $207E; - WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = $207F; - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = $2080; - WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = $2081; - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = $2082; - WGL_FRONT_LEFT_ARB = $2083; - WGL_FRONT_RIGHT_ARB = $2084; - WGL_BACK_LEFT_ARB = $2085; - WGL_BACK_RIGHT_ARB = $2086; - WGL_AUX0_ARB = $2087; - WGL_AUX1_ARB = $2088; - WGL_AUX2_ARB = $2089; - WGL_AUX3_ARB = $208A; - WGL_AUX4_ARB = $208B; - WGL_AUX5_ARB = $208C; - WGL_AUX6_ARB = $208D; - WGL_AUX7_ARB = $208E; - WGL_AUX8_ARB = $208F; - WGL_AUX9_ARB = $2090; - - function wglBindTexImageARB(hPbuffer: THandle; iBuffer: TGLint): BOOL; external dllname; - function wglReleaseTexImageARB(hPbuffer: THandle; iBuffer: TGLint): BOOL; external dllname; - function wglSetPbufferAttribARB(hPbuffer: THandle; const piAttribList: PGLint): BOOL; external dllname; - - - function wglGetExtensionsStringEXT(): Pchar; external dllname; - - function wglMakeContextCurrentEXT(hDrawDC: HDC; hReadDC: HDC; hglrc: HGLRC): BOOL; external dllname; - function wglGetCurrentReadDCEXT(): HDC; external dllname; - -const - WGL_DRAW_TO_PBUFFER_EXT = $202D; - WGL_MAX_PBUFFER_PIXELS_EXT = $202E; - WGL_MAX_PBUFFER_WIDTH_EXT = $202F; - WGL_MAX_PBUFFER_HEIGHT_EXT = $2030; - WGL_OPTIMAL_PBUFFER_WIDTH_EXT = $2031; - WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = $2032; - WGL_PBUFFER_LARGEST_EXT = $2033; - WGL_PBUFFER_WIDTH_EXT = $2034; - WGL_PBUFFER_HEIGHT_EXT = $2035; - - function wglCreatePbufferEXT(hDC: HDC; iPixelFormat: TGLint; iWidth: TGLint; iHeight: TGLint; const piAttribList: PGLint): THandle; external dllname; - function wglGetPbufferDCEXT(hPbuffer: THandle): HDC; external dllname; - function wglReleasePbufferDCEXT(hPbuffer: THandle; hDC: HDC): TGLint; external dllname; - function wglDestroyPbufferEXT(hPbuffer: THandle): BOOL; external dllname; - function wglQueryPbufferEXT(hPbuffer: THandle; iAttribute: TGLint; piValue: PGLint): BOOL; external dllname; - -const - WGL_NUMBER_PIXEL_FORMATS_EXT = $2000; - WGL_DRAW_TO_WINDOW_EXT = $2001; - WGL_DRAW_TO_BITMAP_EXT = $2002; - WGL_ACCELERATION_EXT = $2003; - WGL_NEED_PALETTE_EXT = $2004; - WGL_NEED_SYSTEM_PALETTE_EXT = $2005; - WGL_SWAP_LAYER_BUFFERS_EXT = $2006; - WGL_SWAP_METHOD_EXT = $2007; - WGL_NUMBER_OVERLAYS_EXT = $2008; - WGL_NUMBER_UNDERLAYS_EXT = $2009; - WGL_TRANSPARENT_EXT = $200A; - WGL_TRANSPARENT_VALUE_EXT = $200B; - WGL_SHARE_DEPTH_EXT = $200C; - WGL_SHARE_STENCIL_EXT = $200D; - WGL_SHARE_ACCUM_EXT = $200E; - WGL_SUPPORT_GDI_EXT = $200F; - WGL_SUPPORT_OPENGL_EXT = $2010; - WGL_DOUBLE_BUFFER_EXT = $2011; - WGL_STEREO_EXT = $2012; - WGL_PIXEL_TYPE_EXT = $2013; - WGL_COLOR_BITS_EXT = $2014; - WGL_RED_BITS_EXT = $2015; - WGL_RED_SHIFT_EXT = $2016; - WGL_GREEN_BITS_EXT = $2017; - WGL_GREEN_SHIFT_EXT = $2018; - WGL_BLUE_BITS_EXT = $2019; - WGL_BLUE_SHIFT_EXT = $201A; - WGL_ALPHA_BITS_EXT = $201B; - WGL_ALPHA_SHIFT_EXT = $201C; - WGL_ACCUM_BITS_EXT = $201D; - WGL_ACCUM_RED_BITS_EXT = $201E; - WGL_ACCUM_GREEN_BITS_EXT = $201F; - WGL_ACCUM_BLUE_BITS_EXT = $2020; - WGL_ACCUM_ALPHA_BITS_EXT = $2021; - WGL_DEPTH_BITS_EXT = $2022; - WGL_STENCIL_BITS_EXT = $2023; - WGL_AUX_BUFFERS_EXT = $2024; - WGL_NO_ACCELERATION_EXT = $2025; - WGL_GENERIC_ACCELERATION_EXT = $2026; - WGL_FULL_ACCELERATION_EXT = $2027; - WGL_SWAP_EXCHANGE_EXT = $2028; - WGL_SWAP_COPY_EXT = $2029; - WGL_SWAP_UNDEFINED_EXT = $202A; - WGL_TYPE_RGBA_EXT = $202B; - WGL_TYPE_COLORINDEX_EXT = $202C; - - function wglGetPixelFormatAttribivEXT(hdc: HDC; iPixelFormat: TGLint; iLayerPlane: TGLint; nAttributes: TGLuint; piAttributes: PGLint; piValues: PGLint): BOOL; external dllname; - function wglGetPixelFormatAttribfvEXT(hdc: HDC; iPixelFormat: TGLint; iLayerPlane: TGLint; nAttributes: TGLuint; piAttributes: PGLint; pfValues: PGLfloat): BOOL; external dllname; - function wglChoosePixelFormatEXT(hdc: HDC; const piAttribIList: PGLint; const pfAttribFList: PGLfloat; nMaxFormats: TGLuint; piFormats: PGLint; nNumFormats: PGLuint): BOOL; external dllname; - - -const - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = $2050; - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = $2051; - WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = $2052; - WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = $2053; - - function wglGetDigitalVideoParametersI3D(hDC: HDC; iAttribute: TGLint; piValue: PGLint): BOOL; external dllname; - function wglSetDigitalVideoParametersI3D(hDC: HDC; iAttribute: TGLint; const piValue: PGLint): BOOL; external dllname; - - -const - WGL_GAMMA_TABLE_SIZE_I3D = $204E; - WGL_GAMMA_EXCLUDE_DESKTOP_I3D = $204F; - - function wglGetGammaTableParametersI3D(hDC: HDC; iAttribute: TGLint; piValue: PGLint): BOOL; external dllname; - function wglSetGammaTableParametersI3D(hDC: HDC; iAttribute: TGLint; const piValue: PGLint): BOOL; external dllname; - function wglGetGammaTableI3D(hDC: HDC; iEntries: TGLint; puRed: PGLUSHORT; puGreen: PGLUSHORT; puBlue: PGLUSHORT): BOOL; external dllname; - function wglSetGammaTableI3D(hDC: HDC; iEntries: TGLint; const puRed: PGLUSHORT; const puGreen: PGLUSHORT; const puBlue: PGLUSHORT): BOOL; external dllname; - -const - WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = $2044; - WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D = $2045; - WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D = $2046; - WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D = $2047; - WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = $2048; - WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = $2049; - WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = $204A; - WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = $204B; - WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = $204C; - - WGL_FLOAT_COMPONENTS_NV = $20B0; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = $20B1; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = $20B2; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = $20B3; - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = $20B4; - WGL_TEXTURE_FLOAT_R_NV = $20B5; - WGL_TEXTURE_FLOAT_RG_NV = $20B6; - WGL_TEXTURE_FLOAT_RGB_NV = $20B7; - WGL_TEXTURE_FLOAT_RGBA_NV = $20B8; - - function wglEnableGenlockI3D(hDC: HDC): BOOL; external dllname; - function wglDisableGenlockI3D(hDC: HDC): BOOL; external dllname; - function wglIsEnabledGenlockI3D(hDC: HDC; pFlag: PBOOL): BOOL; external dllname; - function wglGenlockSourceI3D(hDC: HDC; uSource: TGLuint): BOOL; external dllname; - function wglGetGenlockSourceI3D(hDC: HDC; uSource: PGLUINT): BOOL; external dllname; - function wglGenlockSourceEdgeI3D(hDC: HDC; uEdge: TGLuint): BOOL; external dllname; - function wglGetGenlockSourceEdgeI3D(hDC: HDC; uEdge: PGLUINT): BOOL; external dllname; - function wglGenlockSampleRateI3D(hDC: HDC; uRate: TGLuint): BOOL; external dllname; - function wglGetGenlockSampleRateI3D(hDC: HDC; uRate: PGLUINT): BOOL; external dllname; - function wglGenlockSourceDelayI3D(hDC: HDC; uDelay: TGLuint): BOOL; external dllname; - function wglGetGenlockSourceDelayI3D(hDC: HDC; uDelay: PGLUINT): BOOL; external dllname; - function wglQueryGenlockMaxSourceDelayI3D(hDC: HDC; uMaxLineDelay: PGLUINT; uMaxPixelDelay: PGLUINT): BOOL; external dllname; - -const - WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = $20A0; - WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = $20A1; - WGL_TEXTURE_RECTANGLE_NV = $20A2; - - -const - WGL_RGBA_FLOAT_MODE_ATI = $8820; - WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = $8835; - WGL_TYPE_RGBA_FLOAT_ATI = $21A0; - -implementation - -end. diff --git a/lib/wrappers/pcre/pcre.nim b/lib/wrappers/pcre/pcre.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/pcre/pcre_all.c b/lib/wrappers/pcre/pcre_all.c old mode 100644 new mode 100755 diff --git a/lib/wrappers/postgres.nim b/lib/wrappers/postgres.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/python.nim b/lib/wrappers/python.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl.nim b/lib/wrappers/sdl/sdl.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl_gfx.nim b/lib/wrappers/sdl/sdl_gfx.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl_image.nim b/lib/wrappers/sdl/sdl_image.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl_mixer.nim b/lib/wrappers/sdl/sdl_mixer.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl_net.nim b/lib/wrappers/sdl/sdl_net.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdl_ttf.nim b/lib/wrappers/sdl/sdl_ttf.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/sdlutils.pas b/lib/wrappers/sdl/sdlutils.pas old mode 100644 new mode 100755 diff --git a/lib/wrappers/sdl/smpeg.nim b/lib/wrappers/sdl/smpeg.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/sqlite3.nim b/lib/wrappers/sqlite3.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/tcl.nim b/lib/wrappers/tcl.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/cursorfont.nim b/lib/wrappers/x11/cursorfont.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/keysym.nim b/lib/wrappers/x11/keysym.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/x.nim b/lib/wrappers/x11/x.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xatom.nim b/lib/wrappers/x11/xatom.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xcms.nim b/lib/wrappers/x11/xcms.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xf86dga.nim b/lib/wrappers/x11/xf86dga.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xf86vmode.nim b/lib/wrappers/x11/xf86vmode.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xi.nim b/lib/wrappers/x11/xi.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xinerama.nim b/lib/wrappers/x11/xinerama.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xkb.nim b/lib/wrappers/x11/xkb.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xkblib.nim b/lib/wrappers/x11/xkblib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xlib.nim b/lib/wrappers/x11/xlib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xrandr.nim b/lib/wrappers/x11/xrandr.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xrender.nim b/lib/wrappers/x11/xrender.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xresource.nim b/lib/wrappers/x11/xresource.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xshm.nim b/lib/wrappers/x11/xshm.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xutil.nim b/lib/wrappers/x11/xutil.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xv.nim b/lib/wrappers/x11/xv.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/x11/xvlib.nim b/lib/wrappers/x11/xvlib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/zip/libzip.nim b/lib/wrappers/zip/libzip.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/zip/libzip_all.c b/lib/wrappers/zip/libzip_all.c old mode 100644 new mode 100755 diff --git a/lib/wrappers/zip/zlib.nim b/lib/wrappers/zip/zlib.nim old mode 100644 new mode 100755 diff --git a/lib/wrappers/zip/zzip.nim b/lib/wrappers/zip/zzip.nim old mode 100644 new mode 100755 diff --git a/makefile b/makefile old mode 100644 new mode 100755 diff --git a/nim/ast.pas b/nim/ast.pas old mode 100644 new mode 100755 index 4836a860e..aec165585 --- a/nim/ast.pas +++ b/nim/ast.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -72,32 +72,31 @@ type nkInt16Lit, nkInt32Lit, nkInt64Lit, nkFloatLit, nkFloat32Lit, nkFloat64Lit, nkStrLit, nkRStrLit, nkTripleStrLit, nkMetaNode, nkNilLit, nkDotCall, - nkCommand, nkCall, nkGenericCall, nkExplicitTypeListCall, - nkExprEqExpr, nkExprColonExpr, nkIdentDefs, nkVarTuple, - nkInfix, nkPrefix, nkPostfix, nkPar, - nkCurly, nkBracket, nkBracketExpr, nkPragmaExpr, - nkRange, nkDotExpr, nkCheckedFieldExpr, nkDerefExpr, - nkIfExpr, nkElifExpr, nkElseExpr, nkLambda, - nkAccQuoted, nkTableConstr, nkQualified, nkBind, - nkSymChoice, nkHiddenStdConv, nkHiddenSubConv, nkHiddenCallConv, - nkConv, nkCast, nkAddr, nkHiddenAddr, - nkHiddenDeref, nkObjDownConv, nkObjUpConv, nkChckRangeF, - nkChckRange64, nkChckRange, nkStringToCString, nkCStringToString, - nkPassAsOpenArray, nkAsgn, nkFastAsgn, nkDefaultTypeParam, - nkGenericParams, nkFormalParams, nkOfInherit, nkModule, - nkProcDef, nkConverterDef, nkMacroDef, nkTemplateDef, - nkIteratorDef, nkOfBranch, nkElifBranch, nkExceptBranch, - nkElse, nkMacroStmt, nkAsmStmt, nkPragma, - nkIfStmt, nkWhenStmt, nkForStmt, nkWhileStmt, - nkCaseStmt, nkVarSection, nkConstSection, nkConstDef, - nkTypeSection, nkTypeDef, nkYieldStmt, nkTryStmt, - nkFinally, nkRaiseStmt, nkReturnStmt, nkBreakStmt, - nkContinueStmt, nkBlockStmt, nkDiscardStmt, nkStmtList, - nkImportStmt, nkFromStmt, nkImportAs, nkIncludeStmt, - nkCommentStmt, nkStmtListExpr, nkBlockExpr, nkStmtListType, - nkBlockType, nkVm, nkTypeOfExpr, nkObjectTy, + nkCommand, nkCall, nkCallStrLit, nkExprEqExpr, + nkExprColonExpr, nkIdentDefs, nkVarTuple, nkInfix, + nkPrefix, nkPostfix, nkPar, nkCurly, + nkBracket, nkBracketExpr, nkPragmaExpr, nkRange, + nkDotExpr, nkCheckedFieldExpr, nkDerefExpr, nkIfExpr, + nkElifExpr, nkElseExpr, nkLambda, nkAccQuoted, + nkTableConstr, nkQualified, nkBind, nkSymChoice, + nkHiddenStdConv, nkHiddenSubConv, nkHiddenCallConv, nkConv, + nkCast, nkAddr, nkHiddenAddr, nkHiddenDeref, + nkObjDownConv, nkObjUpConv, nkChckRangeF, nkChckRange64, + nkChckRange, nkStringToCString, nkCStringToString, nkPassAsOpenArray, + nkAsgn, nkFastAsgn, nkGenericParams, nkFormalParams, + nkOfInherit, nkModule, nkProcDef, nkConverterDef, + nkMacroDef, nkTemplateDef, nkIteratorDef, nkOfBranch, + nkElifBranch, nkExceptBranch, nkElse, nkMacroStmt, + nkAsmStmt, nkPragma, nkIfStmt, nkWhenStmt, + nkForStmt, nkWhileStmt, nkCaseStmt, nkVarSection, + nkConstSection, nkConstDef, nkTypeSection, nkTypeDef, + nkYieldStmt, nkTryStmt, nkFinally, nkRaiseStmt, + nkReturnStmt, nkBreakStmt, nkContinueStmt, nkBlockStmt, + nkDiscardStmt, nkStmtList, nkImportStmt, nkFromStmt, + nkIncludeStmt, nkCommentStmt, nkStmtListExpr, nkBlockExpr, + nkStmtListType, nkBlockType, nkTypeOfExpr, nkObjectTy, nkTupleTy, nkRecList, nkRecCase, nkRecWhen, - nkRefTy, nkPtrTy, nkVarTy, nkAbstractTy, + nkRefTy, nkPtrTy, nkVarTy, nkDistinctTy, nkProcTy, nkEnumTy, nkEnumFieldDef, nkReturnToken); TNodeKinds = set of TNodeKind; const @@ -107,32 +106,31 @@ const 'nkInt16Lit', 'nkInt32Lit', 'nkInt64Lit', 'nkFloatLit', 'nkFloat32Lit', 'nkFloat64Lit', 'nkStrLit', 'nkRStrLit', 'nkTripleStrLit', 'nkMetaNode', 'nkNilLit', 'nkDotCall', - 'nkCommand', 'nkCall', 'nkGenericCall', 'nkExplicitTypeListCall', - 'nkExprEqExpr', 'nkExprColonExpr', 'nkIdentDefs', 'nkVarTuple', - 'nkInfix', 'nkPrefix', 'nkPostfix', 'nkPar', - 'nkCurly', 'nkBracket', 'nkBracketExpr', 'nkPragmaExpr', - 'nkRange', 'nkDotExpr', 'nkCheckedFieldExpr', 'nkDerefExpr', - 'nkIfExpr', 'nkElifExpr', 'nkElseExpr', 'nkLambda', - 'nkAccQuoted', 'nkTableConstr', 'nkQualified', 'nkBind', - 'nkSymChoice', 'nkHiddenStdConv', 'nkHiddenSubConv', 'nkHiddenCallConv', - 'nkConv', 'nkCast', 'nkAddr', 'nkHiddenAddr', - 'nkHiddenDeref', 'nkObjDownConv', 'nkObjUpConv', 'nkChckRangeF', - 'nkChckRange64', 'nkChckRange', 'nkStringToCString', 'nkCStringToString', - 'nkPassAsOpenArray', 'nkAsgn', 'nkFastAsgn', 'nkDefaultTypeParam', - 'nkGenericParams', 'nkFormalParams', 'nkOfInherit', 'nkModule', - 'nkProcDef', 'nkConverterDef', 'nkMacroDef', 'nkTemplateDef', - 'nkIteratorDef', 'nkOfBranch', 'nkElifBranch', 'nkExceptBranch', - 'nkElse', 'nkMacroStmt', 'nkAsmStmt', 'nkPragma', - 'nkIfStmt', 'nkWhenStmt', 'nkForStmt', 'nkWhileStmt', - 'nkCaseStmt', 'nkVarSection', 'nkConstSection', 'nkConstDef', - 'nkTypeSection', 'nkTypeDef', 'nkYieldStmt', 'nkTryStmt', - 'nkFinally', 'nkRaiseStmt', 'nkReturnStmt', 'nkBreakStmt', - 'nkContinueStmt', 'nkBlockStmt', 'nkDiscardStmt', 'nkStmtList', - 'nkImportStmt', 'nkFromStmt', 'nkImportAs', 'nkIncludeStmt', - 'nkCommentStmt', 'nkStmtListExpr', 'nkBlockExpr', 'nkStmtListType', - 'nkBlockType', 'nkVm', 'nkTypeOfExpr', 'nkObjectTy', + 'nkCommand', 'nkCall', 'nkCallStrLit', 'nkExprEqExpr', + 'nkExprColonExpr', 'nkIdentDefs', 'nkVarTuple', 'nkInfix', + 'nkPrefix', 'nkPostfix', 'nkPar', 'nkCurly', + 'nkBracket', 'nkBracketExpr', 'nkPragmaExpr', 'nkRange', + 'nkDotExpr', 'nkCheckedFieldExpr', 'nkDerefExpr', 'nkIfExpr', + 'nkElifExpr', 'nkElseExpr', 'nkLambda', 'nkAccQuoted', + 'nkTableConstr', 'nkQualified', 'nkBind', 'nkSymChoice', + 'nkHiddenStdConv', 'nkHiddenSubConv', 'nkHiddenCallConv', 'nkConv', + 'nkCast', 'nkAddr', 'nkHiddenAddr', 'nkHiddenDeref', + 'nkObjDownConv', 'nkObjUpConv', 'nkChckRangeF', 'nkChckRange64', + 'nkChckRange', 'nkStringToCString', 'nkCStringToString', 'nkPassAsOpenArray', + 'nkAsgn', 'nkFastAsgn', 'nkGenericParams', 'nkFormalParams', + 'nkOfInherit', 'nkModule', 'nkProcDef', 'nkConverterDef', + 'nkMacroDef', 'nkTemplateDef', 'nkIteratorDef', 'nkOfBranch', + 'nkElifBranch', 'nkExceptBranch', 'nkElse', 'nkMacroStmt', + 'nkAsmStmt', 'nkPragma', 'nkIfStmt', 'nkWhenStmt', + 'nkForStmt', 'nkWhileStmt', 'nkCaseStmt', 'nkVarSection', + 'nkConstSection', 'nkConstDef', 'nkTypeSection', 'nkTypeDef', + 'nkYieldStmt', 'nkTryStmt', 'nkFinally', 'nkRaiseStmt', + 'nkReturnStmt', 'nkBreakStmt', 'nkContinueStmt', 'nkBlockStmt', + 'nkDiscardStmt', 'nkStmtList', 'nkImportStmt', 'nkFromStmt', + 'nkIncludeStmt', 'nkCommentStmt', 'nkStmtListExpr', 'nkBlockExpr', + 'nkStmtListType', 'nkBlockType', 'nkTypeOfExpr', 'nkObjectTy', 'nkTupleTy', 'nkRecList', 'nkRecCase', 'nkRecWhen', - 'nkRefTy', 'nkPtrTy', 'nkVarTy', 'nkAbstractTy', + 'nkRefTy', 'nkPtrTy', 'nkVarTy', 'nkDistinctTy', 'nkProcTy', 'nkEnumTy', 'nkEnumFieldDef', 'nkReturnToken'); type TSymFlag = ( @@ -158,8 +156,9 @@ const type TTypeKind = ( tyNone, tyBool, tyChar, tyEmpty, - tyArrayConstr, tyNil, tyGeneric, tyGenericInst, - tyGenericParam, tyAbstract, tyEnum, tyOrdinal, + tyArrayConstr, tyNil, tyExpr, tyStmt, + tyTypeDesc, tyGenericInvokation, tyGenericBody, tyGenericInst, + tyGenericParam, tyDistinct, tyEnum, tyOrdinal, tyArray, tyObject, tyTuple, tySet, tyRange, tyPtr, tyRef, tyVar, tySequence, tyProc, tyPointer, tyOpenArray, @@ -170,8 +169,9 @@ type const TypeKindToStr: array [TTypeKind] of string = ( 'tyNone', 'tyBool', 'tyChar', 'tyEmpty', - 'tyArrayConstr', 'tyNil', 'tyGeneric', 'tyGenericInst', - 'tyGenericParam', 'tyAbstract', 'tyEnum', 'tyOrdinal', + 'tyArrayConstr', 'tyNil', 'tyExpr', 'tyStmt', + 'tyTypeDesc', 'tyGenericInvokation', 'tyGenericBody', 'tyGenericInst', + 'tyGenericParam', 'tyDistinct', 'tyEnum', 'tyOrdinal', 'tyArray', 'tyObject', 'tyTuple', 'tySet', 'tyRange', 'tyPtr', 'tyRef', 'tyVar', 'tySequence', 'tyProc', 'tyPointer', 'tyOpenArray', @@ -198,16 +198,16 @@ const 'tfEnumHasWholes'); type TSymKind = ( - skUnknownSym, skConditional, skDynLib, skParam, - skTypeParam, skTemp, skType, skConst, + skUnknown, skConditional, skDynLib, skParam, + skGenericParam, skTemp, skType, skConst, skVar, skProc, skIterator, skConverter, skMacro, skTemplate, skField, skEnumField, skForVar, skModule, skLabel, skStub); TSymKinds = set of TSymKind; const SymKindToStr: array [TSymKind] of string = ( - 'skUnknownSym', 'skConditional', 'skDynLib', 'skParam', - 'skTypeParam', 'skTemp', 'skType', 'skConst', + 'skUnknown', 'skConditional', 'skDynLib', 'skParam', + 'skGenericParam', 'skTemp', 'skType', 'skConst', 'skVar', 'skProc', 'skIterator', 'skConverter', 'skMacro', 'skTemplate', 'skField', 'skEnumField', 'skForVar', 'skModule', 'skLabel', 'skStub'); @@ -253,14 +253,15 @@ type mNewString, mArray, mOpenArray, mRange, mSet, mSeq, mOrdinal, mInt, mInt8, mInt16, mInt32, mInt64, mFloat, mFloat32, mFloat64, mBool, mChar, mString, - mCstring, mPointer, mEmptySet, mIntSetBaseType, mNil, mIsMainModule, - mCompileDate, mCompileTime, mNimrodVersion, mNimrodMajor, mNimrodMinor, mNimrodPatch, - mCpuEndian, mHostOS, mHostCPU, mNaN, mInf, mNegInf, - mNLen, mNChild, mNSetChild, mNAdd, mNAddMultiple, mNDel, - mNKind, mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, - mNStrVal, mNSetIntVal, mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, - mNSetStrVal, mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mIdentToStr, - mEqIdent, mNHint, mNWarning, mNError + mCstring, mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, + mStmt, mTypeDesc, mIsMainModule, mCompileDate, mCompileTime, mNimrodVersion, + mNimrodMajor, mNimrodMinor, mNimrodPatch, mCpuEndian, mHostOS, mHostCPU, + mNaN, mInf, mNegInf, mNLen, mNChild, mNSetChild, + mNAdd, mNAddMultiple, mNDel, mNKind, mNIntVal, mNFloatVal, + mNSymbol, mNIdent, mNGetType, mNStrVal, mNSetIntVal, mNSetFloatVal, + mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, mNNewNimNode, mNCopyNimNode, + mNCopyNimTree, mStrToIdent, mIdentToStr, mEqIdent, mNHint, mNWarning, + mNError //[[[end]]] ); @@ -418,7 +419,6 @@ type loc: TLoc; end; - // these are not part of the syntax tree, but nevertherless inherit from TNode TPair = record key, val: PObject; end; @@ -512,19 +512,24 @@ const // "MagicToStr" array: 'NewString', 'Array', 'OpenArray', 'Range', 'Set', 'Seq', 'Ordinal', 'Int', 'Int8', 'Int16', 'Int32', 'Int64', 'Float', 'Float32', 'Float64', 'Bool', 'Char', 'String', - 'Cstring', 'Pointer', 'EmptySet', 'IntSetBaseType', 'Nil', 'IsMainModule', - 'CompileDate', 'CompileTime', 'NimrodVersion', 'NimrodMajor', 'NimrodMinor', 'NimrodPatch', - 'CpuEndian', 'HostOS', 'HostCPU', 'NaN', 'Inf', 'NegInf', - 'NLen', 'NChild', 'NSetChild', 'NAdd', 'NAddMultiple', 'NDel', - 'NKind', 'NIntVal', 'NFloatVal', 'NSymbol', 'NIdent', 'NGetType', - 'NStrVal', 'NSetIntVal', 'NSetFloatVal', 'NSetSymbol', 'NSetIdent', 'NSetType', - 'NSetStrVal', 'NNewNimNode', 'NCopyNimNode', 'NCopyNimTree', 'StrToIdent', 'IdentToStr', - 'EqIdent', 'NHint', 'NWarning', 'NError' + 'Cstring', 'Pointer', 'EmptySet', 'IntSetBaseType', 'Nil', 'Expr', + 'Stmt', 'TypeDesc', 'IsMainModule', 'CompileDate', 'CompileTime', 'NimrodVersion', + 'NimrodMajor', 'NimrodMinor', 'NimrodPatch', 'CpuEndian', 'HostOS', 'HostCPU', + 'NaN', 'Inf', 'NegInf', 'NLen', 'NChild', 'NSetChild', + 'NAdd', 'NAddMultiple', 'NDel', 'NKind', 'NIntVal', 'NFloatVal', + 'NSymbol', 'NIdent', 'NGetType', 'NStrVal', 'NSetIntVal', 'NSetFloatVal', + 'NSetSymbol', 'NSetIdent', 'NSetType', 'NSetStrVal', 'NNewNimNode', 'NCopyNimNode', + 'NCopyNimTree', 'StrToIdent', 'IdentToStr', 'EqIdent', 'NHint', 'NWarning', + 'NError' //[[[end]]] ); const - GenericTypes: TTypeKinds = {@set}[tyGeneric, tyGenericParam]; + GenericTypes: TTypeKinds = {@set}[ + tyGenericInvokation, + tyGenericBody, + tyGenericParam + ]; StructuralEquivTypes: TTypeKinds = {@set}[ tyArrayConstr, tyNil, tyTuple, @@ -669,6 +674,7 @@ type function IntSetContains(const s: TIntSet; key: int): bool; procedure IntSetIncl(var s: TIntSet; key: int); +procedure IntSetExcl(var s: TIntSet; key: int); procedure IntSetInit(var s: TIntSet); function IntSetContainsOrIncl(var s: TIntSet; key: int): bool; @@ -1069,6 +1075,7 @@ begin {@emit if isNil(father.sons) then father.sons := @[]; } {@emit add(father.sons, son); } + assert((father.kind <> tyGenericInvokation) or (son.kind <> tyGenericInst)); end; function sonsLen(n: PNode): int; @@ -1371,6 +1378,19 @@ begin or shlu(1, u and IntMask); end; +procedure IntSetExcl(var s: TIntSet; key: int); +var + u: TBitScalar; + t: PTrunk; +begin + t := IntSetGet(s, shru(key, TrunkShift)); + if t <> nil then begin + u := key and TrunkMask; + t.bits[shru(u, IntShift)] := t.bits[shru(u, IntShift)] + and not shlu(1, u and IntMask); + end +end; + function IntSetContainsOrIncl(var s: TIntSet; key: int): bool; var u: TBitScalar; diff --git a/nim/astalgo.pas b/nim/astalgo.pas old mode 100644 new mode 100755 index e5475ddd1..7c1f3ec0b --- a/nim/astalgo.pas +++ b/nim/astalgo.pas @@ -419,6 +419,8 @@ end; function typeToYamlAux(n: PType; var marker: TIntSet; indent: int; maxRecDepth: int): PRope; +var + i: int; begin if n = nil then result := toRope('null') @@ -427,6 +429,18 @@ begin toRope(typeKindToStr[n.kind]), toRope(strutils.toHex({@cast}TAddress(n), sizeof(n)*2))]) else begin + if sonsLen(n) > 0 then begin + result := toRope('['+''); + for i := 0 to sonsLen(n)-1 do begin + if i > 0 then app(result, ','+''); + appf(result, '$n$1$2', + [spaces(indent+4), + typeToYamlAux(n.sons[i], marker, indent + 4, maxRecDepth-1)]); + end; + appf(result, '$n$1]', [spaces(indent+2)]); + end + else + result := toRope('null'); result := ropeConstr(indent, [ toRope('kind'), makeYamlString(typeKindToStr[n.kind]), toRope('sym'), symToYamlAux(n.sym, marker, indent+2, maxRecDepth-1), @@ -434,7 +448,8 @@ begin toRope('flags'), typeFlagsToStr(n.flags), toRope('callconv'), makeYamlString(CallingConvToStr[n.callConv]), toRope('size'), toRope(n.size), - toRope('align'), toRope(n.align) + toRope('align'), toRope(n.align), + toRope('sons'), result ]); end end; @@ -525,14 +540,20 @@ begin result := toRope('null') else begin result := toRope(typeKindToStr[n.kind]); - app(result, '('+''); - for i := 0 to sonsLen(n)-1 do begin - if i > 0 then app(result, ', '); - if n.sons[i] = nil then app(result, 'null') - else app(result, debugType(n.sons[i])); - // app(result, typeKindToStr[n.sons[i].kind]); + if n.sym <> nil then begin + app(result, ' '+''); + app(result, n.sym.name.s); end; - app(result, ')'+''); + if (n.kind <> tyString) and (sonsLen(n) > 0) then begin + app(result, '('+''); + for i := 0 to sonsLen(n)-1 do begin + if i > 0 then app(result, ', '); + if n.sons[i] = nil then app(result, 'null') + else app(result, debugType(n.sons[i])); + // app(result, typeKindToStr[n.sons[i].kind]); + end; + app(result, ')'+''); + end end end; diff --git a/nim/bitsets.pas b/nim/bitsets.pas old mode 100644 new mode 100755 diff --git a/nim/ccgexprs.pas b/nim/ccgexprs.pas old mode 100644 new mode 100755 index 212017d14..97a24caeb --- a/nim/ccgexprs.pas +++ b/nim/ccgexprs.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -213,8 +213,7 @@ end; function rdLoc(const a: TLoc): PRope; // 'read' location (deref if indirect) begin result := a.r; - if lfIndirect in a.flags then - result := ropef('(*$1 /*rdLoc*/)', [result]) + if lfIndirect in a.flags then result := ropef('(*$1)', [result]) end; function addrLoc(const a: TLoc): PRope; @@ -760,7 +759,8 @@ begin f := e.sons[1].sym; field := nil; while ty <> nil do begin - assert(ty.kind in [tyTuple, tyObject]); + if not (ty.kind in [tyTuple, tyObject]) then + InternalError(e.info, 'genRecordField'); field := lookupInRecord(ty.n, f.name); if field <> nil then break; if gCmd <> cmdCompileToCpp then app(r, '.Sup'); @@ -1643,8 +1643,8 @@ begin case op of mIncl: binaryStmtInExcl(p, e, d, '$1[$2/8] |=(1<<($2%8));$n'); mExcl: binaryStmtInExcl(p, e, d, '$1[$2/8] &= ~(1<<($2%8));$n'); - mCard: unaryExprChar(p, e, d, 'countBitsVar', - 'countBitsVar($1, ' + ToString(size) + ')'); + mCard: unaryExprChar(p, e, d, 'cardSet', + 'cardSet($1, ' + ToString(size) + ')'); mLtSet, mLeSet: begin getTemp(p, getSysType(tyInt), i); // our counter initLocExpr(p, e.sons[1], a); @@ -1847,7 +1847,6 @@ end; procedure genMagicExpr(p: BProc; e: PNode; var d: TLoc; op: TMagic); var - a: TLoc; line, filen: PRope; begin case op of @@ -1870,6 +1869,22 @@ begin else binaryExpr(p, e, d, 'addInt', 'addInt($1, $2)') end; + mInc: begin + if not (optOverflowCheck in p.Options) then + binaryStmt(p, e, d, '', '$1 += $2;$n') + else if skipTypes(e.sons[1].typ, abstractVar).kind = tyInt64 then + binaryStmt(p, e, d, 'addInt64', '$1 = addInt64($1, $2);$n') + else + binaryStmt(p, e, d, 'addInt', '$1 = addInt($1, $2);$n') + end; + ast.mDec: begin + if not (optOverflowCheck in p.Options) then + binaryStmt(p, e, d, '', '$1 -= $2;$n') + else if skipTypes(e.sons[1].typ, abstractVar).kind = tyInt64 then + binaryStmt(p, e, d, 'subInt64', '$1 = subInt64($1, $2);$n') + else + binaryStmt(p, e, d, 'subInt', '$1 = subInt($1, $2);$n') + end; mConStrStr: genStrConcat(p, e, d); mAppendStrCh: binaryStmt(p, e, d, 'addChar', '$1 = addChar($1, $2);$n'); mAppendStrStr: genStrAppend(p, e, d); @@ -1907,22 +1922,6 @@ begin mOrd: genOrd(p, e, d); mLengthArray, mHigh, mLengthStr, mLengthSeq, mLengthOpenArray: genArrayLen(p, e, d, op); - mInc: begin - if not (optOverflowCheck in p.Options) then - binaryStmt(p, e, d, '', '$1 += $2;$n') - else if skipTypes(e.sons[1].typ, abstractVar).kind = tyInt64 then - binaryStmt(p, e, d, 'addInt64', '$1 = addInt64($1, $2);$n') - else - binaryStmt(p, e, d, 'addInt', '$1 = addInt($1, $2);$n') - end; - ast.mDec: begin - if not (optOverflowCheck in p.Options) then - binaryStmt(p, e, d, '', '$1 -= $2;$n') - else if skipTypes(e.sons[1].typ, abstractVar).kind = tyInt64 then - binaryStmt(p, e, d, 'subInt64', '$1 = subInt64($1, $2);$n') - else - binaryStmt(p, e, d, 'subInt', '$1 = subInt($1, $2);$n') - end; mGCref: unaryStmt(p, e, d, 'nimGCref', 'nimGCref($1);$n'); mGCunref: unaryStmt(p, e, d, 'nimGCunref', 'nimGCunref($1);$n'); mSetLengthStr: genSetLengthStr(p, e, d); @@ -2203,7 +2202,8 @@ begin nkFloatLit..nkFloat64Lit, nkNilLit, nkCharLit: begin putIntoDest(p, d, e.typ, genLiteral(p, e)); end; - nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand: begin + nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand, + nkCallStrLit: begin if (e.sons[0].kind = nkSym) and (e.sons[0].sym.magic <> mNone) then genMagicExpr(p, e, d, e.sons[0].sym.magic) @@ -2279,7 +2279,6 @@ end; function genConstExpr(p: BProc; n: PNode): PRope; var - trans: PNode; cs: TBitSet; d: TLoc; begin diff --git a/nim/ccgstmts.pas b/nim/ccgstmts.pas old mode 100644 new mode 100755 index 90e5c1c77..03d6edb01 --- a/nim/ccgstmts.pas +++ b/nim/ccgstmts.pas @@ -94,6 +94,42 @@ begin end end; +procedure genVarTuple(p: BProc; n: PNode); +var + i, L: int; + v: PSym; + tup, field: TLoc; + t: PType; +begin + if n.kind <> nkVarTuple then InternalError(n.info, 'genVarTuple'); + L := sonsLen(n); + genLineDir(p, n); + initLocExpr(p, n.sons[L-1], tup); + t := tup.t; + for i := 0 to L-3 do begin + v := n.sons[i].sym; + if sfGlobal in v.flags then + assignGlobalVar(p, v) + else begin + assignLocalVar(p, v); + initVariable(p, v) + end; + // generate assignment: + initLoc(field, locExpr, t.sons[i], tup.s); + if t.n = nil then begin + field.r := ropef('$1.Field$2', [rdLoc(tup), toRope(i)]); + end + else begin + if (t.n.sons[i].kind <> nkSym) then + InternalError(n.info, 'genVarTuple'); + field.r := ropef('$1.$2', [rdLoc(tup), + mangleRecFieldName(t.n.sons[i].sym, t)]); + end; + putLocIntoDest(p, v.loc, field); + genObjectInit(p, v.typ, v.loc, true); + end +end; + procedure genVarStmt(p: BProc; n: PNode); var i: int; @@ -103,22 +139,25 @@ begin for i := 0 to sonsLen(n)-1 do begin a := n.sons[i]; if a.kind = nkCommentStmt then continue; - assert(a.kind = nkIdentDefs); - assert(a.sons[0].kind = nkSym); - v := a.sons[0].sym; - if sfGlobal in v.flags then - assignGlobalVar(p, v) - else begin - assignLocalVar(p, v); - initVariable(p, v) // XXX: this is not required if a.sons[2] != nil, - // unless it is a GC'ed pointer - end; - // generate assignment: - if a.sons[2] <> nil then begin - genLineDir(p, a); - expr(p, a.sons[2], v.loc); - end; - genObjectInit(p, v.typ, v.loc, true); // correct position + if a.kind = nkIdentDefs then begin + assert(a.sons[0].kind = nkSym); + v := a.sons[0].sym; + if sfGlobal in v.flags then + assignGlobalVar(p, v) + else begin + assignLocalVar(p, v); + initVariable(p, v) // XXX: this is not required if a.sons[2] != nil, + // unless it is a GC'ed pointer + end; + // generate assignment: + if a.sons[2] <> nil then begin + genLineDir(p, a); + expr(p, a.sons[2], v.loc); + end; + genObjectInit(p, v.typ, v.loc, true); // correct position + end + else + genVarTuple(p, a); end end; @@ -294,7 +333,7 @@ begin else begin r := sym.loc.r; if r = nil then begin // if no name has already been given, - // it doesn't matter much: + // it doesn't matter much: r := mangleName(sym); sym.loc.r := r; // but be consequent! end; @@ -561,7 +600,7 @@ procedure genOrdinalCase(p: BProc; t: PNode); // we generate an ordinary if statement and rely on the C compiler // to produce good code. var - canGenerateSwitch: bool; + canGenerateSwitch, hasDefault: bool; i, j, len: int; a: TLoc; v: PNode; @@ -578,6 +617,7 @@ begin if canGenerateSwitch then begin initLocExpr(p, t.sons[0], a); appf(p.s[cpsStmts], 'switch ($1) {$n', [rdCharLoc(a)]); + hasDefault := false; for i := 1 to sonsLen(t)-1 do begin if t.sons[i].kind = nkOfBranch then begin len := sonsLen(t.sons[i]); @@ -604,9 +644,12 @@ begin else begin // else part of case statement: app(p.s[cpsStmts], 'default:' + tnl); genStmts(p, t.sons[i].sons[0]); + hasDefault := true; end; app(p.s[cpsStmts], 'break;' + tnl); end; + if (hasAssume in CC[ccompiler].props) and not hasDefault then + app(p.s[cpsStmts], 'default: __assume(0);' + tnl); app(p.s[cpsStmts], '}' + tnl); end else @@ -902,7 +945,8 @@ begin nkCaseStmt: genCaseStmt(p, t); nkReturnStmt: genReturnStmt(p, t); nkBreakStmt: genBreakStmt(p, t); - nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand: begin + nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand, + nkCallStrLit: begin genLineDir(p, t); initLocExpr(p, t, a); end; diff --git a/nim/ccgtypes.pas b/nim/ccgtypes.pas old mode 100644 new mode 100755 index f9b3a36c1..8c17514ff --- a/nim/ccgtypes.pas +++ b/nim/ccgtypes.pas @@ -116,7 +116,7 @@ begin end; tyOpenArray, tyArrayConstr, tyArray: result := ctArray; tyObject, tyTuple: result := ctStruct; - tyGeneric, tyGenericInst, tyGenericParam, tyAbstract, tyOrdinal: + tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal: result := mapType(lastSon(typ)); tyEnum: begin if firstOrd(typ) < 0 then @@ -664,7 +664,7 @@ begin end end end; - tyGenericInst, tyAbstract, tyOrdinal: + tyGenericInst, tyDistinct, tyOrdinal: result := getTypeDescAux(m, lastSon(t), check); else begin InternalError('getTypeDescAux(' + typeKindToStr[t.kind] + ')'); diff --git a/nim/ccgutils.pas b/nim/ccgutils.pas old mode 100644 new mode 100755 index de5cac13c..da6b8774f --- a/nim/ccgutils.pas +++ b/nim/ccgutils.pas @@ -56,7 +56,7 @@ begin result := key; end end; - tyGenericInst, tyAbstract, tyOrdinal: + tyGenericInst, tyDistinct, tyOrdinal: result := GetUniqueType(lastSon(key)); tyProc: begin end; else begin diff --git a/nim/cgen.pas b/nim/cgen.pas old mode 100644 new mode 100755 index fdae6feb6..04c19d444 --- a/nim/cgen.pas +++ b/nim/cgen.pas @@ -463,7 +463,7 @@ begin if (le >= strStart) and (ri > le) then begin prefix := ncopy(s, strStart, le-1); suffix := ncopy(s, ri+1); - temp := splitSeq(ncopy(s, le+1, ri-1), {@set}['|']); + temp := split(ncopy(s, le+1, ri-1), {@set}['|']); for i := 0 to high(temp) do libCandidates(prefix +{&} temp[i] +{&} suffix, dest); end @@ -850,7 +850,7 @@ begin '; Generated by the Nimrod Compiler v$1$n' + '; (c) 2009 Andreas Rumpf$n' + '; Compiled for: $2, $3, $4$n' + - '; Command for C compiler:$n $5$n', + '; Command for LLVM compiler:$n $5$n', [toRope(versionAsString), toRope(platform.OS[targetOS].name), toRope(platform.CPU[targetCPU].name), toRope(extccomp.CC[extccomp.ccompiler].name), @@ -884,84 +884,119 @@ const ' call void systemInit()$n' + '$1' + '$2'; - PosixMain = + PosixNimMain = 'int cmdCount;$n' + 'char** cmdLine;$n' + 'char** gEnv;$n' + + 'N_CDECL(void, NimMain)(void) {$n' + + ' int dummy[8];$n' +{&} + CommonMainBody +{&} + '}$n'; + PosixCMain = 'int main(int argc, char** args, char** env) {$n' + - ' int dummy[8];$n' + ' cmdLine = args;$n' + ' cmdCount = argc;$n' + - ' gEnv = env;$n' +{&} - CommonMainBody +{&} + ' gEnv = env;$n' + + ' NimMain();$n' + ' return 0;$n' + '}$n'; - PosixMainLLVM = + PosixNimMainLLVM = '@cmdCount = linkonce i32$n' + '@cmdLine = linkonce i8**$n' + '@gEnv = linkonce i8**$n' + + 'define void @NimMain(void) {$n' + + ' %dummy = alloca [8 x %NI]$n' +{&} + CommonMainBodyLLVM +{&} + '}$n'; + PosixCMainLLVM = 'define i32 @main(i32 %argc, i8** %args, i8** %env) {$n' + - ' %dummy = alloca [8 x %NI]$n' + ' store i8** %args, i8*** @cmdLine$n' + ' store i32 %argc, i32* @cmdCount$n' + - ' store i8** %env, i8*** @gEnv$n' +{&} - CommonMainBodyLLVM +{&} + ' store i8** %env, i8*** @gEnv$n' + + ' call void @NimMain()$n' + ' ret i32 0$n' + + '}$n'; + WinNimMain = + 'N_CDECL(void, NimMain)(void) {$n' + + ' int dummy[8];$n' +{&} + CommonMainBody +{&} '}$n'; - WinMain = + WinCMain = 'N_STDCALL(int, WinMain)(HINSTANCE hCurInstance, $n' + ' HINSTANCE hPrevInstance, $n' + ' LPSTR lpCmdLine, int nCmdShow) {$n' + - ' int dummy[8];$n' +{&} - CommonMainBody +{&} + ' NimMain();$n' + ' return 0;$n' + '}$n'; - WinMainLLVM = + WinNimMainLLVM = + 'define void @NimMain(void) {$n' + + ' %dummy = alloca [8 x %NI]$n' +{&} + CommonMainBodyLLVM +{&} + '}$n'; + WinCMainLLVM = 'define stdcall i32 @WinMain(i32 %hCurInstance, $n' + ' i32 %hPrevInstance, $n' + ' i8* %lpCmdLine, i32 %nCmdShow) {$n' + - ' %dummy = alloca [8 x %NI]$n' +{&} - CommonMainBodyLLVM +{&} + ' call void @NimMain()$n' + ' ret i32 0$n' + '}$n'; - WinDllMain = + WinNimDllMain = WinNimMain; + WinCDllMain = 'BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, $n' + ' LPVOID lpvReserved) {$n' + - ' int dummy[8];$n' +{&} - CommonMainBody +{&} + ' NimMain();$n' + ' return 1;$n' + '}$n'; - WinDllMainLLVM = + WinNimDllMainLLVM = WinNimMainLLVM; + WinCDllMainLLVM = 'define stdcall i32 @DllMain(i32 %hinstDLL, i32 %fwdreason, $n' + ' i8* %lpvReserved) {$n' + - ' %dummy = alloca [8 x %NI]$n' +{&} - CommonMainBodyLLVM +{&} + ' call void @NimMain()$n' + ' ret i32 1$n' + '}$n'; var - frmt: TFormatStr; + nimMain, otherMain: TFormatStr; begin useMagic(m, 'setStackBottom'); if (platform.targetOS = osWindows) and (gGlobalOptions * [optGenGuiApp, optGenDynLib] <> []) then begin - if optGenGuiApp in gGlobalOptions then - if gCmd = cmdCompileToLLVM then frmt := WinMainLLVM else frmt := WinMain - else - if gCmd = cmdCompileToLLVM then - frmt := WinDllMainLLVM - else - frmt := WinDllMain; + if optGenGuiApp in gGlobalOptions then begin + if gCmd = cmdCompileToLLVM then begin + nimMain := WinNimMainLLVM; + otherMain := WinCMainLLVM + end + else begin + nimMain := WinNimMain; + otherMain := WinCMain; + end + end + else begin + if gCmd = cmdCompileToLLVM then begin + nimMain := WinNimDllMainLLVM; + otherMain := WinCDllMainLLVM; + end + else begin + nimMain := WinNimDllMain; + otherMain := WinCDllMain; + end + end; {@discard} lists.IncludeStr(m.headerFiles, '') end - else - if gCmd = cmdCompileToLLVM then - frmt := PosixMainLLVM - else - frmt := PosixMain; - if gBreakpoints <> nil then - useMagic(m, 'dbgRegisterBreakpoint'); + else begin + if gCmd = cmdCompileToLLVM then begin + nimMain := PosixNimMainLLVM; + otherMain := PosixCMainLLVM; + end + else begin + nimMain := PosixNimMain; + otherMain := PosixCMain; + end + end; + if gBreakpoints <> nil then useMagic(m, 'dbgRegisterBreakpoint'); inc(m.labels); - appf(m.s[cfsProcs], frmt, [gBreakpoints, mainModInit, toRope(m.labels)]) + appf(m.s[cfsProcs], nimMain, [gBreakpoints, mainModInit, toRope(m.labels)]); + if not (optNoMain in gGlobalOptions) then + appf(m.s[cfsProcs], otherMain, []); end; function getInitName(m: PSym): PRope; @@ -1101,13 +1136,6 @@ begin //MessageOut('cgen.myOpenCached has been called ' + filename); cfile := changeFileExt(completeCFilePath(filename), cExt); cfilenoext := changeFileExt(cfile, ''); - (* - objFile := toObjFile(cfilenoext); - if ExistsFile(objFile) and nos.FileNewer(objFile, cfile) then begin - end - else begin - addFileToCompile(cfilenoext); // is to compile - end; *) addFileToLink(cfilenoext); registerModuleToMain(module); // XXX: this cannot be right here, initalization has to be appended during @@ -1208,11 +1236,12 @@ begin finishModule(gPendingModules[i]); for i := 0 to high(gPendingModules) do writeModule(gPendingModules[i]); setLength(gPendingModules, 0); - writeMapping(gMapping); end; if not (optDeadCodeElim in gGlobalOptions) and not (sfDeadCodeElim in m.module.flags) then writeModule(m); + if sfMainModule in m.module.flags then + writeMapping(gMapping); end; function cgenPass(): TPass; diff --git a/nim/charsets.pas b/nim/charsets.pas old mode 100644 new mode 100755 diff --git a/nim/commands.pas b/nim/commands.pas old mode 100644 new mode 100755 index df6ab9da7..b281552c9 --- a/nim/commands.pas +++ b/nim/commands.pas @@ -63,6 +63,7 @@ const +{&} ' compile_to_c, cc compile project with C code generator' +{&} nl +{&} ' doc generate the documentation for inputfile' +{&} nl +{&} ' rst2html converts a reStructuredText file to HTML' +{&} nl ++{&} ' rst2tex converts a reStructuredText file to TeX' +{&} nl +{&} 'Arguments:' +{&} nl +{&} ' arguments are passed to the program being run (if --run option is selected)' +{&} nl +{&} 'Options:' +{&} nl @@ -112,6 +113,7 @@ const +{&} ' --lib:PATH set the system library path' +{&} nl +{&} ' -c, --compile_only compile only; do not assemble or link' +{&} nl +{&} ' --no_linking compile but do not link' +{&} nl ++{&} ' --no_main do not generate a main procedure' +{&} nl +{&} ' --gen_script generate a compile script (in the ''nimcache''' +{&} nl +{&} ' subdirectory named ''compile_$project$scriptext'')' +{&} nl +{&} ' --os:SYMBOL set the target operating system (cross-compilation)' +{&} nl @@ -360,6 +362,10 @@ begin wNoLinking: begin expectNoArg(switch, arg, pass, info); include(gGlobalOptions, optNoLinking); + end; + wNoMain: begin + expectNoArg(switch, arg, pass, info); + include(gGlobalOptions, optNoMain); end; wForceBuild, wF: begin expectNoArg(switch, arg, pass, info); @@ -555,10 +561,6 @@ begin expectArg(switch, arg, pass, info); setCC(arg) end; - wMaxErr: begin - expectArg(switch, arg, pass, info); - gErrorMax := parseInt(arg); - end; else if strutils.find(switch, '.') >= strStart then options.setConfigVar(switch, arg) else diff --git a/nim/condsyms.pas b/nim/condsyms.pas old mode 100644 new mode 100755 diff --git a/nim/config.inc b/nim/config.inc old mode 100644 new mode 100755 diff --git a/nim/crc.pas b/nim/crc.pas old mode 100644 new mode 100755 diff --git a/nim/depends.pas b/nim/depends.pas old mode 100644 new mode 100755 diff --git a/nim/docgen.pas b/nim/docgen.pas old mode 100644 new mode 100755 index a72f64908..39a9069c7 --- a/nim/docgen.pas +++ b/nim/docgen.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -24,6 +24,7 @@ uses procedure CommandDoc(const filename: string); procedure CommandRst2Html(const filename: string); +procedure CommandRst2TeX(const filename: string); implementation @@ -33,7 +34,7 @@ type refname, header: PRope; end; TSections = array [TSymKind] of PRope; - TMetaEnum = (metaNone, metaTitle, metaSubtitle); + TMetaEnum = (metaNone, metaTitle, metaSubtitle, metaAuthor, metaVersion); TDocumentor = record // contains a module's documentation filename: string; // filename of the source file; without extension basedir: string; // base directory (where to put the documentation) @@ -51,6 +52,9 @@ type end; PDoc = ^TDocumentor; +var + splitter: string = ''; + function findIndexNode(n: PRstNode): PRstNode; var i: int; @@ -213,6 +217,8 @@ begin end end; +// -------------------- dispatcher ------------------------------------------- + procedure addXmlChar(var dest: string; c: Char); begin case c of @@ -224,6 +230,43 @@ begin end end; +procedure addRtfChar(var dest: string; c: Char); +begin + case c of + '{': add(dest, '\{'); + '}': add(dest, '\}'); + '\': add(dest, '\\'); + else addChar(dest, c) + end +end; + +procedure addTexChar(var dest: string; c: Char); +begin + case c of + '_': add(dest, '\_'); + '{': add(dest, '\symbol{123}'); + '}': add(dest, '\symbol{125}'); + '[': add(dest, '\symbol{91}'); + ']': add(dest, '\symbol{93}'); + '\': add(dest, '\symbol{92}'); + '$': add(dest, '\$'); + '&': add(dest, '\&'); + '#': add(dest, '\#'); + '%': add(dest, '\%'); + '~': add(dest, '\symbol{126}'); + '@': add(dest, '\symbol{64}'); + '^': add(dest, '\symbol{94}'); + '`': add(dest, '\symbol{96}'); + else addChar(dest, c) + end +end; + +procedure escChar(var dest: string; c: Char); +begin + if gCmd <> cmdRst2Tex then addXmlChar(dest, c) + else addTexChar(dest, c); +end; + function nextSplitPoint(const s: string; start: int): int; begin result := start; @@ -241,9 +284,7 @@ begin dec(result); // last valid index end; -function toXml(const s: string; splitAfter: int = -1): string; -const - splitter = ''; +function esc(const s: string; splitAfter: int = -1): string; var i, j, k, partLen: int; begin @@ -257,26 +298,52 @@ begin partLen := 0; add(result, splitter); end; - for i := j to k do addXmlChar(result, s[i]); + for i := j to k do escChar(result, s[i]); inc(partLen, k - j + 1); j := k+1; end; end else begin - for i := strStart to length(s)+strStart-1 do addXmlChar(result, s[i]) + for i := strStart to length(s)+strStart-1 do escChar(result, s[i]) end end; -function renderRstToHtml(d: PDoc; n: PRstNode): PRope; forward; +function disp(const xml, tex: string): string; +begin + if gCmd <> cmdRst2Tex then + result := xml + else + result := tex +end; -function renderAux(d: PDoc; n: PRstNode; const outer: string = '$1'; - const inner: string = '$1'): PRope; +function dispF(const xml, tex: string; const args: array of PRope): PRope; +begin + if gCmd <> cmdRst2Tex then + result := ropef(xml, args) + else + result := ropef(tex, args) +end; + +procedure dispA(var dest: PRope; const xml, tex: string; + const args: array of PRope); +begin + if gCmd <> cmdRst2Tex then + appf(dest, xml, args) + else + appf(dest, tex, args) +end; + +// --------------------------------------------------------------------------- + +function renderRstToOut(d: PDoc; n: PRstNode): PRope; forward; + +function renderAux(d: PDoc; n: PRstNode; const outer: string = '$1'): PRope; var i: int; begin result := nil; for i := 0 to rsonsLen(n)-1 do - appf(result, inner, [renderRstToHtml(d, n.sons[i])]); + app(result, renderRstToOut(d, n.sons[i])); result := ropef(outer, [result]); end; @@ -286,7 +353,8 @@ var begin if d.theIndex = nil then exit; h := newRstNode(rnHyperlink); - a := newRstNode(rnLeaf, d.indexValFilename +{&} '#' +{&} toString(id)); + a := newRstNode(rnLeaf, d.indexValFilename +{&} disp('#'+'', '') + +{&} toString(id)); addSon(h, a); addSon(h, a); a := newRstNode(rnIdx); @@ -299,9 +367,11 @@ var a, h: PRstNode; begin inc(d.id); - result := ropef('$2', [toRope(d.id), renderAux(d, n)]); + result := dispF('$2', + '$2\label{$1}', [toRope(d.id), renderAux(d, n)]); h := newRstNode(rnHyperlink); - a := newRstNode(rnLeaf, d.indexValFilename +{&} '#' +{&} toString(d.id)); + a := newRstNode(rnLeaf, d.indexValFilename +{&} disp('#'+'', '') + +{&} toString(d.id)); addSon(h, a); addSon(h, a); setIndexPair(d.theIndex, n, h); @@ -312,10 +382,9 @@ var dummyHasToc: bool; begin if (n.comment <> snil) and startsWith(n.comment, '##') then - result := renderRstToHtml(d, rstParse(n.comment, true, - toFilename(n.info), - toLineNumber(n.info), toColumn(n.info), - dummyHasToc)) + result := renderRstToOut(d, rstParse(n.comment, true, toFilename(n.info), + toLineNumber(n.info), + toColumn(n.info), dummyHasToc)) else result := nil; end; @@ -359,9 +428,11 @@ begin case n.kind of nkPostfix: result := getName(n.sons[1], splitAfter); nkPragmaExpr: result := getName(n.sons[0], splitAfter); - nkSym: result := toXML(n.sym.name.s, splitAfter); - nkIdent: result := toXML(n.ident.s, splitAfter); - nkAccQuoted: result := '`' +{&} getName(n.sons[0], splitAfter) +{&} '`'; + nkSym: result := esc(n.sym.name.s, splitAfter); + nkIdent: result := esc(n.ident.s, splitAfter); + nkAccQuoted: + result := esc('`'+'') +{&} getName(n.sons[0], splitAfter) +{&} + esc('`'+''); else begin internalError(n.info, 'getName()'); result := '' @@ -407,39 +478,47 @@ begin case kind of tkEof: break; tkComment: - appf(result, '$1', - [toRope(toXml(literal))]); + dispA(result, '$1', + '\spanComment{$1}', + [toRope(esc(literal))]); tokKeywordLow..tokKeywordHigh: - appf(result, '$1', + dispA(result, '$1', + '\spanKeyword{$1}', [toRope(literal)]); tkOpr, tkHat: - appf(result, '$1', - [toRope(toXml(literal))]); + dispA(result, '$1', + '\spanOperator{$1}', + [toRope(esc(literal))]); tkStrLit..tkTripleStrLit: - appf(result, '$1', - [toRope(toXml(literal))]); + dispA(result, '$1', + '\spanStringLit{$1}', + [toRope(esc(literal))]); tkCharLit: - appf(result, '$1', - [toRope(toXml(literal))]); + dispA(result, '$1', + '\spanCharLit{$1}', + [toRope(esc(literal))]); tkIntLit..tkInt64Lit: - appf(result, '$1', - [toRope(literal)]); + dispA(result, '$1', + '\spanDecNumber{$1}', + [toRope(esc(literal))]); tkFloatLit..tkFloat64Lit: - appf(result, '$1', - [toRope(literal)]); + dispA(result, '$1', + '\spanFloatNumber{$1}', + [toRope(esc(literal))]); tkSymbol: - appf(result, '$1', - [toRope(literal)]); - tkInd, tkSad, tkDed, tkSpaces: - app(result, literal); - //appf(result, '$1', - // [toRope(literal)]); + dispA(result, '$1', + '\spanIdentifier{$1}', + [toRope(esc(literal))]); + tkInd, tkSad, tkDed, tkSpaces: begin + app(result, literal) + end; tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, tkCurlyRi, tkBracketDotLe, tkBracketDotRi, tkCurlyDotLe, tkCurlyDotRi, tkParDotLe, tkParDotRi, tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot, tkAccent: - appf(result, '$1', - [toRope(literal)]); + dispA(result, '$1', + '\spanOther{$1}', + [toRope(esc(literal))]); else InternalError(n.info, 'docgen.genThing(' + toktypeToStr[kind] + ')'); end end; @@ -460,7 +539,7 @@ var begin result := nil; for i := 0 to rsonsLen(n)-1 do - app(result, renderRstToHtml(d, n.sons[i])); + app(result, renderRstToOut(d, n.sons[i])); refname := toRope(rstnodeToRefname(n)); if d.hasToc then begin len := length(d.tocPart); @@ -468,13 +547,17 @@ begin d.tocPart[len].refname := refname; d.tocPart[len].n := n; d.tocPart[len].header := result; - result := ropef('$3'+ - '', - [toRope(n.level), d.tocPart[len].refname, result]); + result := dispF( + '$3', + '\rsth$4{$3}\label{$2}$n', + [toRope(n.level), d.tocPart[len].refname, result, + toRope(chr(n.level-1+ord('A'))+'')]); end else - result := ropef('$3', - [toRope(n.level), refname, result]); + result := dispF('$3', + '\rsth$4{$3}\label{$2}$n', + [toRope(n.level), refname, result, + toRope(chr(n.level-1+ord('A'))+'')]); end; function renderOverline(d: PDoc; n: PRstNode): PRope; @@ -484,13 +567,15 @@ var begin t := nil; for i := 0 to rsonsLen(n)-1 do - app(t, renderRstToHtml(d, n.sons[i])); + app(t, renderRstToOut(d, n.sons[i])); result := nil; if d.meta[metaTitle] = nil then d.meta[metaTitle] := t else if d.meta[metaSubtitle] = nil then d.meta[metaSubtitle] := t else - result := ropef('
$3
', - [toRope(n.level), toRope(rstnodeToRefname(n)), t]); + result := dispF('
$3
', + '\rstov$4{$3}\label{$2}$n', + [toRope(n.level), toRope(rstnodeToRefname(n)), t, + toRope(chr(n.level-1+ord('A'))+'')]); end; function renderRstToRst(d: PDoc; n: PRstNode): PRope; forward; @@ -645,8 +730,10 @@ end; function renderTocEntry(d: PDoc; const e: TTocEntry): PRope; begin - result := ropef('
  • $2' + - '
  • $n', [e.refname, e.header]); + result := dispF( + '
  • $2
  • $n', + '\item\label{$1_toc} $2\ref{$1}$n', + [e.refname, e.header]); end; function renderTocEntries(d: PDoc; var j: int; lvl: int): PRope; @@ -666,7 +753,8 @@ begin break end; if lvl > 1 then - result := ropef('
      $1
    ', [result]); + result := dispF('
      $1
    ', + '\begin{enumerate}$1\end{enumerate}', [result]); end; function fieldAux(const s: string): PRope; @@ -676,21 +764,28 @@ end; function renderImage(d: PDoc; n: PRstNode): PRope; var - s: string; + s, scale: string; + options: PRope; begin - result := ropef(' '' then appf(result, ' height="$1"', [fieldAux(s)]); - s := getFieldValue(n, 'width'); - if s <> '' then appf(result, ' width="$1"', [fieldAux(s)]); + options := nil; s := getFieldValue(n, 'scale'); - if s <> '' then appf(result, ' scale="$1"', [fieldAux(s)]); + if s <> '' then dispA(options, ' scale="$1"', ' scale=$1', [fieldAux(scale)]); + + s := getFieldValue(n, 'height'); + if s <> '' then dispA(options, ' height="$1"', ' height=$1', [fieldAux(s)]); + + s := getFieldValue(n, 'width'); + if s <> '' then dispA(options, ' width="$1"', ' width=$1', [fieldAux(s)]); + s := getFieldValue(n, 'alt'); - if s <> '' then appf(result, ' alt="$1"', [fieldAux(s)]); + if s <> '' then dispA(options, ' alt="$1"', '', [fieldAux(s)]); s := getFieldValue(n, 'align'); - if s <> '' then appf(result, ' align="$1"', [fieldAux(s)]); - app(result, ' />'); - if rsonsLen(n) >= 3 then app(result, renderRstToHtml(d, n.sons[2])) + if s <> '' then dispA(options, ' align="$1"', '', [fieldAux(s)]); + + if options <> nil then options := dispF('$1', '[$1]', [options]); + result := dispF('', + '\includegraphics$2{$1}', [toRope(getArgument(n)), options]); + if rsonsLen(n) >= 3 then app(result, renderRstToOut(d, n.sons[2])) end; function renderCodeBlock(d: PDoc; n: PRstNode): PRope; @@ -709,7 +804,7 @@ begin else lang := getSourceLanguage(langstr); if lang = langNone then begin rawMessage(warnLanguageXNotSupported, langstr); - result := ropef('
    $1
    ', [toRope(m.text)]) + result := toRope(m.text) end else begin initGeneralTokenizer(g, m.text); @@ -717,164 +812,220 @@ begin getNextToken(g, lang); case g.kind of gtEof: break; - gtNone, gtWhitespace: + gtNone, gtWhitespace: begin app(result, ncopy(m.text, g.start+strStart, - g.len+g.start-1+strStart)); + g.len+g.start-1+strStart)) + end else - appf(result, '$1', - [toRope(toXml(ncopy(m.text, g.start+strStart, - g.len+g.start-1+strStart))), - toRope(tokenClassToStr[g.kind])]); + dispA(result, + '$1', + '\span$2{$1}', + [toRope(esc(ncopy(m.text, g.start+strStart, + g.len+g.start-1+strStart))), + toRope(tokenClassToStr[g.kind])]); end; end; deinitGeneralTokenizer(g); - if result <> nil then result := ropef('
    $1
    ', [result]); - end + end; + if result <> nil then + result := dispF('
    $1
    ', '\begin{rstpre}$n$1$n\end{rstpre}$n', + [result]) end; function renderContainer(d: PDoc; n: PRstNode): PRope; var arg: PRope; begin - result := renderRstToHtml(d, n.sons[2]); + result := renderRstToOut(d, n.sons[2]); arg := toRope(strip(getArgument(n))); - if arg = nil then result := ropef('
    $1
    ', [result]) - else result := ropef('
    $2
    ', [arg, result]) + if arg = nil then result := dispF('
    $1
    ', '$1', [result]) + else result := dispF('
    $2
    ', '$2', [arg, result]) end; -function renderRstToHtml(d: PDoc; n: PRstNode): PRope; +function texColumns(n: PRstNode): string; var - outer, inner: string; + i: int; +begin + result := ''; + for i := 1 to rsonsLen(n) do add(result, '|X'); +end; + +function renderField(d: PDoc; n: PRstNode): PRope; +var + fieldname: string; + fieldval: PRope; + b: bool; +begin + b := false; + if gCmd = cmdRst2Tex then begin + fieldname := addNodes(n.sons[0]); + fieldval := toRope(esc(strip(addNodes(n.sons[1])))); + if cmpIgnoreStyle(fieldname, 'author') = 0 then begin + if d.meta[metaAuthor] = nil then begin + d.meta[metaAuthor] := fieldval; + b := true + end + end + else if cmpIgnoreStyle(fieldName, 'version') = 0 then begin + if d.meta[metaVersion] = nil then begin + d.meta[metaVersion] := fieldval; + b := true + end + end + end; + if b then result := nil + else result := renderAux(d, n, disp('$1$n', '$1')); +end; + +function renderRstToOut(d: PDoc; n: PRstNode): PRope; +var + i: int; begin if n = nil then begin result := nil; exit end; - outer := '$1'; - inner := '$1'; case n.kind of - rnInner: begin end; - rnHeadline: begin - result := renderHeadline(d, n); exit; - end; - rnOverline: begin - result := renderOverline(d, n); - exit; - end; - rnTransition: outer := '
    '+nl; - rnParagraph: outer := '

    $1

    '+nl; - rnBulletList: outer := '
      $1
    '+nl; - rnBulletItem, rnEnumItem: outer := '
  • $1
  • '+nl; - rnEnumList: outer := '
      $1
    '+nl; - rnDefList: outer := '
    $1
    '+nl; - rnDefItem: begin end; - rnDefName: outer := '
    $1
    '+nl; - rnDefBody: outer := '
    $1
    '+nl; - rnFieldList: - outer := '' + - '' + - '' + - '$1' + - '
    '; - rnField: outer := '$1$n'; - rnFieldName: outer := '$1:'; - rnFieldBody: outer := '$1'; - rnIndex: begin - result := renderRstToHtml(d, n.sons[2]); - exit + rnInner: result := renderAux(d, n); + rnHeadline: result := renderHeadline(d, n); + rnOverline: result := renderOverline(d, n); + rnTransition: + result := renderAux(d, n, disp('
    '+nl, '\hrule'+nl)); + rnParagraph: + result := renderAux(d, n, disp('

    $1

    '+nl, '$1$n$n')); + rnBulletList: + result := renderAux(d, n, disp('
      $1
    '+nl, + '\begin{itemize}$1\end{itemize}'+nl)); + rnBulletItem, rnEnumItem: + result := renderAux(d, n, disp('
  • $1
  • '+nl, '\item $1'+nl)); + rnEnumList: + result := renderAux(d, n, disp('
      $1
    '+nl, + '\begin{enumerate}$1\end{enumerate}'+nl)); + rnDefList: + result := renderAux(d, n, disp('
    $1
    '+nl, + '\begin{description}$1\end{description}'+nl)); + rnDefItem: + result := renderAux(d, n); + rnDefName: + result := renderAux(d, n, disp('
    $1
    '+nl, '\item[$1] ')); + rnDefBody: + result := renderAux(d, n, disp('
    $1
    '+nl, '$1'+nl)); + rnFieldList: begin + result := nil; + for i := 0 to rsonsLen(n)-1 do app(result, renderRstToOut(d, n.sons[i])); + if result <> nil then + result := dispf('' + + '' + + '' + + '$1' + + '
    ', + '\begin{description}$1\end{description}'+nl, [result]); end; + rnField: result := renderField(d, n); + rnFieldName: + result := renderAux(d, n, disp( + '$1:', '\item[$1:]')); + rnFieldBody: + result := renderAux(d, n, disp('$1', ' $1$n')); + rnIndex: + result := renderRstToOut(d, n.sons[2]); rnOptionList: - outer := '$1
    '; + result := renderAux(d, n, disp('$1
    ', + '\begin{description}$n$1\end{description}'+nl)); rnOptionListItem: - outer := '$1$n'; - rnOptionGroup: outer := '$1'; - rnDescription: outer := '$1$n'; + result := renderAux(d, n, disp('$1$n', '$1')); + rnOptionGroup: + result := renderAux(d, n, disp('$1', '\item[$1]')); + rnDescription: + result := renderAux(d, n, disp('$1$n', ' $1$n')); rnOption, rnOptionString, - rnOptionArgument: InternalError('renderRstToHtml'); + rnOptionArgument: InternalError('renderRstToOut'); - rnLiteralBlock: outer := '
    $1
    '+nl; - rnQuotedLiteralBlock: InternalError('renderRstToHtml'); + rnLiteralBlock: + result := renderAux(d, n, disp('
    $1
    $n', + '\begin{rstpre}$n$1$n\end{rstpre}$n')); + rnQuotedLiteralBlock: InternalError('renderRstToOut'); - rnLineBlock: outer := '

    $1

    '; - rnLineBlockItem: outer := '$1
    '; + rnLineBlock: result := renderAux(d, n, disp('

    $1

    ', '$1$n$n')); + rnLineBlockItem: result := renderAux(d, n, disp('$1
    ', '$1\\$n')); - rnBlockQuote: outer := '

    $1

    $n'; + rnBlockQuote: + result := renderAux(d, n, disp('

    $1

    $n', + '\begin{quote}$1\end{quote}$n')); - rnTable, rnGridTable: - outer := '$1
    '; - rnTableRow: outer := '$1$n'; - rnTableDataCell: outer := '$1'; - rnTableHeaderCell: outer := '$1'; - - rnLabel: InternalError('renderRstToHtml'); // used for footnotes and other - rnFootnote: InternalError('renderRstToHtml'); // a footnote - - rnCitation: InternalError('renderRstToHtml'); // similar to footnote - rnRef: begin - result := ropef('$1', - [renderAux(d, n), toRope(rstnodeToRefname(n))]); - exit + rnTable, rnGridTable: begin + result := renderAux(d, n, + disp('$1
    ', + '\begin{table}\begin{rsttab}{' +{&} + texColumns(n) +{&} + '|}$n\hline$n$1\end{rsttab}\end{table}')); end; + rnTableRow: begin + if rsonsLen(n) >= 1 then begin + result := renderRstToOut(d, n.sons[0]); + for i := 1 to rsonsLen(n)-1 do + dispa(result, '$1', ' & $1', [renderRstToOut(d, n.sons[i])]); + result := dispf('$1$n', '$1\\$n\hline$n', [result]); + end + else + result := nil; + end; + rnTableDataCell: result := renderAux(d, n, disp('$1', '$1')); + rnTableHeaderCell: + result := renderAux(d, n, disp('$1', '\textbf{$1}')); + + rnLabel: InternalError('renderRstToOut'); // used for footnotes and other + rnFootnote: InternalError('renderRstToOut'); // a footnote + + rnCitation: InternalError('renderRstToOut'); // similar to footnote + rnRef: + result := dispF('$1', + '$1\ref{$2}', + [renderAux(d, n), toRope(rstnodeToRefname(n))]); rnStandaloneHyperlink: - outer := '$1'; - rnHyperlink: begin - result := ropef('$1', - [renderRstToHtml(d, n.sons[0]), - renderRstToHtml(d, n.sons[1])]); - exit - end; - rnDirArg, rnRaw: begin end; - rnImage, rnFigure: begin - result := renderImage(d, n); - exit - end; - rnCodeBlock: begin - result := renderCodeBlock(d, n); - exit - end; - rnContainer: begin - result := renderContainer(d, n); - exit - end; - rnSubstitutionReferences, rnSubstitutionDef: outer := '|$1|'; - rnDirective: outer := ''; + result := renderAux(d, n, disp( + '$1', + '\href{$1}{$1}')); + rnHyperlink: + result := dispF('$1', + '\href{$2}{$1}', + [renderRstToOut(d, n.sons[0]), + renderRstToOut(d, n.sons[1])]); + rnDirArg, rnRaw: result := renderAux(d, n); + rnImage, rnFigure: result := renderImage(d, n); + rnCodeBlock: result := renderCodeBlock(d, n); + rnContainer: result := renderContainer(d, n); + rnSubstitutionReferences, rnSubstitutionDef: + result := renderAux(d, n, disp('|$1|', '|$1|')); + rnDirective: result := renderAux(d, n, ''); // Inline markup: - rnGeneralRole: begin - result := ropef('$1', - [renderRstToHtml(d, n.sons[0]), - renderRstToHtml(d, n.sons[1])]); - exit - end; - rnSub: outer := '$1'; - rnSup: outer := '$1'; - rnEmphasis: outer := '$1'; - rnStrongEmphasis: outer := '$1'; - rnInterpretedText: outer := '$1'; + rnGeneralRole: + result := dispF('$1', + '\span$2{$1}', + [renderRstToOut(d, n.sons[0]), + renderRstToOut(d, n.sons[1])]); + rnSub: result := renderAux(d, n, disp('$1', '\rstsub{$1}')); + rnSup: result := renderAux(d, n, disp('$1', '\rstsup{$1}')); + rnEmphasis: result := renderAux(d, n, disp('$1', '\emph{$1}')); + rnStrongEmphasis: + result := renderAux(d, n, disp('$1', '\textbf{$1}')); + rnInterpretedText: + result := renderAux(d, n, disp('$1', '\emph{$1}')); rnIdx: begin if d.theIndex = nil then - outer := '$1' - else begin - result := renderIndexTerm(d, n); exit - end + result := renderAux(d, n, disp('$1', '\emph{$1}')) + else + result := renderIndexTerm(d, n); end; rnInlineLiteral: - outer := '' - +{&} '$1'; - rnLeaf: begin - result := toRope(toXml(n.text)); - exit - end; - rnContents: begin - d.hasToc := true; - exit; - end; - rnTitle: begin - d.meta[metaTitle] := renderRstToHtml(d, n.sons[0]); - exit - end; - else InternalError('renderRstToHtml'); - end; - result := renderAux(d, n, outer, inner); + result := renderAux(d, n, disp( + '$1', + '\texttt{$1}')); + rnLeaf: result := toRope(esc(n.text)); + rnContents: d.hasToc := true; + rnTitle: d.meta[metaTitle] := renderRstToOut(d, n.sons[0]); + else InternalError('renderRstToOut'); + end end; procedure generateDoc(d: PDoc; n: PNode); @@ -929,7 +1080,7 @@ begin [toRope(ord(kind)), title, toRope(ord(kind)+50), d.toc[kind]]); end; -function genHtmlFile(d: PDoc): PRope; +function genOutFile(d: PDoc): PRope; var code, toc, title, content: PRope; bodyname: string; @@ -947,8 +1098,7 @@ begin end; if toc <> nil then toc := ropeFormatNamedVars(getConfigVar('doc.toc'), ['content'], [toc]); - for i := low(TSymKind) to high(TSymKind) do - app(code, d.section[i]); + for i := low(TSymKind) to high(TSymKind) do app(code, d.section[i]); if d.meta[metaTitle] <> nil then title := d.meta[metaTitle] else @@ -962,9 +1112,10 @@ begin [title, toc, d.modDesc, toRope(getDateStr()), toRope(getClockStr()), code]); if not (optCompileOnly in gGlobalOptions) then code := ropeFormatNamedVars(getConfigVar('doc.file'), - ['title', 'tableofcontents', 'moduledesc', 'date', 'time', 'content'], - [title, toc, d.modDesc, - toRope(getDateStr()), toRope(getClockStr()), content]) + ['title', 'tableofcontents', 'moduledesc', 'date', 'time', + 'content', 'author', 'version'], + [title, toc, d.modDesc, toRope(getDateStr()), toRope(getClockStr()), + content, d.meta[metaAuthor], d.meta[metaVersion]]) else code := content; result := code; @@ -989,11 +1140,11 @@ begin initIndexFile(d); d.hasToc := true; generateDoc(d, ast); - writeRope(genHtmlFile(d), getOutFile(filename, HtmlExt)); + writeRope(genOutFile(d), getOutFile(filename, HtmlExt)); generateIndex(d); end; -procedure CommandRst2Html(const filename: string); +procedure CommandRstAux(const filename, outExt: string); var filen: string; d: PDoc; @@ -1004,10 +1155,21 @@ begin d := newDocumentor(filen); initIndexFile(d); rst := rstParse(readFile(filen), false, filen, 0, 1, d.hasToc); - d.modDesc := renderRstToHtml(d, rst); - code := genHtmlFile(d); - writeRope(code, getOutFile(filename, HtmlExt)); + d.modDesc := renderRstToOut(d, rst); + code := genOutFile(d); + writeRope(code, getOutFile(filename, outExt)); generateIndex(d); end; +procedure CommandRst2Html(const filename: string); +begin + CommandRstAux(filename, HtmlExt); +end; + +procedure CommandRst2TeX(const filename: string); +begin + splitter := '\-'; + CommandRstAux(filename, TexExt); +end; + end. diff --git a/nim/ecmasgen.pas b/nim/ecmasgen.pas old mode 100644 new mode 100755 index 9ffa550ae..73faa4ddb --- a/nim/ecmasgen.pas +++ b/nim/ecmasgen.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -108,10 +108,13 @@ const tyOpenArray, tySet, tyVar, tyRef, tyPtr]; function mapType(typ: PType): TEcmasTypeKind; +var + t: PType; begin - case skipTypes(typ, abstractInst).kind of + t := skipTypes(typ, abstractInst); + case t.kind of tyVar, tyRef, tyPtr: begin - if typ.sons[0].kind in mappedToObject then + if skipTypes(t.sons[0], abstractInst).kind in mappedToObject then result := etyObject else result := etyBaseIndex @@ -120,7 +123,7 @@ begin // treat a tyPointer like a typed pointer to an array of bytes result := etyInt; end; - tyRange, tyAbstract, tyOrdinal: result := mapType(typ.sons[0]); + tyRange, tyDistinct, tyOrdinal: result := mapType(t.sons[0]); tyInt..tyInt64, tyEnum, tyChar: result := etyInt; tyBool: result := etyBool; @@ -133,7 +136,8 @@ begin tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray: result := etyObject; tyNil: result := etyNull; - tyGenericInst, tyGenericParam, tyGeneric, tyNone, tyForward, tyEmpty: + tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvokation, + tyNone, tyForward, tyEmpty, tyExpr, tyStmt, tyTypeDesc: result := etyNone; tyProc: result := etyProc; tyCString: result := etyString; @@ -299,7 +303,7 @@ begin result := ropef('NTI$1', [toRope(t.id)]); if IntSetContainsOrIncl(p.globals.TypeInfoGenerated, t.id) then exit; case t.kind of - tyAbstract: result := genTypeInfo(p, typ.sons[0]); + tyDistinct: result := genTypeInfo(p, typ.sons[0]); tyPointer, tyProc, tyBool, tyChar, tyCString, tyString, tyInt..tyFloat128: begin s := ropef( @@ -889,7 +893,8 @@ const nkFloatLit..nkFloat64Lit, nkCurly, nkPar, nkStringToCString, nkCStringToString, - nkCall, nkCommand, nkHiddenCallConv]; + nkCall, nkCommand, nkHiddenCallConv, + nkCallStrLit]; function needsNoCopy(y: PNode): bool; begin @@ -1772,7 +1777,7 @@ begin end; nkBlockExpr: genBlock(p, n, r); nkIfExpr: genIfExpr(p, n, r); - nkCall, nkHiddenCallConv, nkCommand: begin + nkCall, nkHiddenCallConv, nkCommand, nkCallStrLit: begin if (n.sons[0].kind = nkSym) and (n.sons[0].sym.magic <> mNone) then genMagic(p, n, r) else diff --git a/nim/evals.pas b/nim/evals.pas old mode 100644 new mode 100755 index d522dfaf0..b88fa3304 --- a/nim/evals.pas +++ b/nim/evals.pas @@ -278,11 +278,13 @@ begin case t.kind of tyBool, tyChar, tyInt..tyInt64: result := newNodeIT(nkIntLit, info, t); tyFloat..tyFloat128: result := newNodeIt(nkFloatLit, info, t); - tyVar, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString: + tyVar, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString, tyExpr, + tyStmt, tyTypeDesc: result := newNodeIT(nkNilLit, info, t); tyObject: begin result := newNodeIT(nkPar, info, t); internalError(info, 'init to implement'); + // XXX end; tyArray, tyArrayConstr: begin result := newNodeIT(nkBracket, info, t); @@ -1283,7 +1285,7 @@ begin nkType..pred(nkNilLit): result := copyNode(n); nkNilLit: result := n; // end of atoms - nkCall, nkHiddenCallConv, nkMacroStmt, nkCommand: + nkCall, nkHiddenCallConv, nkMacroStmt, nkCommand, nkCallStrLit: result := evalMagicOrCall(c, n); nkCurly, nkBracket, nkRange: begin a := copyNode(n); diff --git a/nim/extccomp.pas b/nim/extccomp.pas old mode 100644 new mode 100755 index a3e4ff367..9e7c7e4cc --- a/nim/extccomp.pas +++ b/nim/extccomp.pas @@ -27,7 +27,8 @@ type TInfoCCProp = ( // properties of the C compiler: hasSwitchRange, // CC allows ranges in switch statements (GNU C extension) hasComputedGoto, // CC has computed goto (GNU C extension) - hasCpp // CC is/contains a C++ compiler + hasCpp, // CC is/contains a C++ compiler + hasAssume // CC has __assume (Visual C extension) ); TInfoCCProps = set of TInfoCCProp; TInfoCC = record{@tuple} @@ -167,7 +168,7 @@ const debug: ' /GZ /Zi '; pic: ''; asmStmtFrmt: '__asm{$n$1$n}$n'; - props: {@set}[hasCpp]; + props: {@set}[hasCpp, hasAssume]; ), ( name: 'tcc'; diff --git a/nim/hashtest.pas b/nim/hashtest.pas old mode 100644 new mode 100755 diff --git a/nim/highlite.pas b/nim/highlite.pas old mode 100644 new mode 100755 index 1867268d3..ec5374663 --- a/nim/highlite.pas +++ b/nim/highlite.pas @@ -134,14 +134,19 @@ end; procedure initGeneralTokenizer(var g: TGeneralTokenizer; const buf: string); +var + pos: int; begin {@ignore} fillChar(g, sizeof(g), 0); {@emit} g.buf := PChar(buf); g.kind := low(TTokenClass); g.start := 0; g.len := 0; - g.pos := 0; g.state := low(TTokenClass); + pos := 0; + // skip initial whitespace: + while g.buf[pos] in [' ', #9..#13] do inc(pos); + g.pos := pos; end; procedure deinitGeneralTokenizer(var g: TGeneralTokenizer); diff --git a/nim/idents.pas b/nim/idents.pas old mode 100644 new mode 100755 diff --git a/nim/importer.pas b/nim/importer.pas old mode 100644 new mode 100755 diff --git a/nim/interact.pas b/nim/interact.pas old mode 100644 new mode 100755 diff --git a/nim/lexbase.pas b/nim/lexbase.pas old mode 100644 new mode 100755 diff --git a/nim/lists.pas b/nim/lists.pas old mode 100644 new mode 100755 diff --git a/nim/llstream.pas b/nim/llstream.pas old mode 100644 new mode 100755 diff --git a/nim/llvmdyn.pas b/nim/llvmdyn.pas old mode 100644 new mode 100755 index 34839a1c8..e039939e5 --- a/nim/llvmdyn.pas +++ b/nim/llvmdyn.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. diff --git a/nim/llvmstat.pas b/nim/llvmstat.pas old mode 100644 new mode 100755 diff --git a/nim/lookups.pas b/nim/lookups.pas old mode 100644 new mode 100755 index d106ef302..5caceaf46 --- a/nim/lookups.pas +++ b/nim/lookups.pas @@ -72,7 +72,7 @@ begin liMessage(s.info, errImplOfXexpected, getSymRepr(s)) else if ([sfUsed, sfInInterface] * s.flags = []) and (optHints in s.options) then // BUGFIX: check options in s! - if not (s.kind in [skForVar, skParam]) then + if not (s.kind in [skForVar, skParam, skUnknown]) then liMessage(s.info, hintXDeclaredButNotUsed, getSymRepr(s)); s := NextIter(it, tab.stack[tab.tos-1]); end; @@ -103,7 +103,7 @@ begin if not (fn.kind in OverloadableSyms) then InternalError(fn.info, 'addOverloadableSymAt'); check := StrTableGet(c.tab.stack[at], fn.name); - if (check <> nil) and (check.Kind <> fn.kind) then + if (check <> nil) and not (check.Kind in OverloadableSyms) then liMessage(fn.info, errAttemptToRedefine, fn.Name.s); SymTabAddAt(c.tab, fn, at); end; @@ -136,17 +136,16 @@ function lookUp(c: PContext; n: PNode): PSym; begin case n.kind of nkAccQuoted: result := lookup(c, n.sons[0]); - nkSym: begin + nkSym: begin (* result := SymtabGet(c.Tab, n.sym.name); if result = nil then - liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s); - //include(result.flags, sfUsed); + liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s); *) + result := n.sym; end; nkIdent: begin result := SymtabGet(c.Tab, n.ident); if result = nil then liMessage(n.info, errUndeclaredIdentifier, n.ident.s); - //include(result.flags, sfUsed); end else InternalError(n.info, 'lookUp'); end; @@ -169,12 +168,13 @@ begin and IntSetContains(c.AmbiguousSymbols, result.id) then liMessage(n.info, errUseQualifier, n.ident.s) end; - nkSym: begin + nkSym: begin (* result := SymtabGet(c.Tab, n.sym.name); if result = nil then liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s) - else if ambiguousCheck - and IntSetContains(c.AmbiguousSymbols, result.id) then + else *) + result := n.sym; + if ambiguousCheck and IntSetContains(c.AmbiguousSymbols, result.id) then liMessage(n.info, errUseQualifier, n.sym.name.s) end; nkDotExpr, nkQualified: begin diff --git a/nim/magicsys.pas b/nim/magicsys.pas old mode 100644 new mode 100755 index db801d5f2..d9dde8871 --- a/nim/magicsys.pas +++ b/nim/magicsys.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. diff --git a/nim/main.pas b/nim/main.pas old mode 100644 new mode 100755 index b1c58c2b9..1bb2ce586 --- a/nim/main.pas +++ b/nim/main.pas @@ -375,6 +375,12 @@ begin wantFile(filename); CommandRst2Html(filename); end; + wRst2tex: begin + gCmd := cmdRst2tex; + LoadSpecialConfig(DocTexConfig); + wantFile(filename); + CommandRst2TeX(filename); + end; wPas: begin gCmd := cmdPas; wantFile(filename); diff --git a/nim/msgs.pas b/nim/msgs.pas old mode 100644 new mode 100755 index 0f47695af..9d421a5bf --- a/nim/msgs.pas +++ b/nim/msgs.pas @@ -1,54 +1,54 @@ -// -// -// The Nimrod Compiler -// (c) Copyright 2009 Andreas Rumpf -// -// See the file "copying.txt", included in this -// distribution, for details about the copyright. -// -unit msgs; - -interface - -{$include 'config.inc'} - -uses - nsystem, options, strutils, nos; - -//[[[cog -//from string import replace -//enum = "type\n TMsgKind = (\n" -//msgs = "const\n MsgKindToStr: array [TMsgKind] of string = (\n" -//warns = "const\n WarningsToStr: array [0..%d] of string = (\n" -//hints = "const\n HintsToStr: array [0..%d] of string = (\n" -//w = 0 # counts the warnings -//h = 0 # counts the hints -// -//for elem in eval(open('data/messages.yml').read()): -// for key, val in elem.items(): -// enum = enum + ' %s,\n' % key -// v = replace(val, "'", "''") -// if key[0:4] == 'warn': -// msgs = msgs + " '%s [%s]',\n" % (v, key[4:]) -// warns = warns + " '%s',\n" % key[4:] -// w = w + 1 -// elif key[0:4] == 'hint': -// msgs = msgs + " '%s [%s]',\n" % (v, key[4:]) -// hints = hints + " '%s',\n" % key[4:] -// h = h + 1 -// else: -// msgs = msgs + " '%s',\n" % v -// -//enum = enum[:-2] + ');\n\n' -//msgs = msgs[:-2] + '\n );\n' -//warns = (warns[:-2] + '\n );\n') % (w-1) -//hints = (hints[:-2] + '\n );\n') % (h-1) -// -//cog.out(enum) -//cog.out(msgs) -//cog.out(warns) -//cog.out(hints) -//]]] +// +// +// The Nimrod Compiler +// (c) Copyright 2009 Andreas Rumpf +// +// See the file "copying.txt", included in this +// distribution, for details about the copyright. +// +unit msgs; + +interface + +{$include 'config.inc'} + +uses + nsystem, options, strutils, nos; + +//[[[cog +//from string import replace +//enum = "type\n TMsgKind = (\n" +//msgs = "const\n MsgKindToStr: array [TMsgKind] of string = (\n" +//warns = "const\n WarningsToStr: array [0..%d] of string = (\n" +//hints = "const\n HintsToStr: array [0..%d] of string = (\n" +//w = 0 # counts the warnings +//h = 0 # counts the hints +// +//for elem in eval(open('data/messages.yml').read()): +// for key, val in elem.items(): +// enum = enum + ' %s,\n' % key +// v = replace(val, "'", "''") +// if key[0:4] == 'warn': +// msgs = msgs + " '%s [%s]',\n" % (v, key[4:]) +// warns = warns + " '%s',\n" % key[4:] +// w = w + 1 +// elif key[0:4] == 'hint': +// msgs = msgs + " '%s [%s]',\n" % (v, key[4:]) +// hints = hints + " '%s',\n" % key[4:] +// h = h + 1 +// else: +// msgs = msgs + " '%s',\n" % v +// +//enum = enum[:-2] + ');\n\n' +//msgs = msgs[:-2] + '\n );\n' +//warns = (warns[:-2] + '\n );\n') % (w-1) +//hints = (hints[:-2] + '\n );\n') % (h-1) +// +//cog.out(enum) +//cog.out(msgs) +//cog.out(warns) +//cog.out(hints) +//]]] type TMsgKind = ( errUnknown, @@ -74,13 +74,12 @@ type errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected, - errRecursiveInclude, + errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected, errInvalidPragma, errUnknownPragma, - errUnknownDirective, - errInvalidDirective, + errInvalidDirectiveX, errAtPopWithoutPush, errEmptyAsm, errInvalidIndentation, @@ -128,8 +127,6 @@ type errOverOrUnderflow, errCannotEvalXBecauseIncompletelyDefined, errChrExpectsRange0_255, - errStaticAssertFailed, - errStaticAssertCannotBeEval, errDotRequiresRecordOrObjectType, errUndeclaredFieldX, errNilAccess, @@ -184,7 +181,7 @@ type errButExpected, errButExpectedX, errAmbiguousCallXYZ, - errWrongNumberOfTypeParams, + errWrongNumberOfArguments, errInlineProcHasNoAddress, errXCannotBeInParamDecl, errPragmaOnlyInHeaderOfProc, @@ -230,11 +227,9 @@ type errInitHereNotAllowed, errXCannotBeAssignedTo, errIteratorNotAllowed, - errIteratorNeedsImplementation, - errIteratorNeedsReturnType, + errXNeedsReturnType, errInvalidCommandX, errXOnlyAtModuleScope, - errTypeXNeedsImplementation, errTemplateInstantiationTooNested, errInstantiationFrom, errInvalidIndexValueForTuple, @@ -257,12 +252,12 @@ type errInvalidConversionFromTypeX, errAssertionFailed, errCannotGenerateCodeForX, - errXNeedsReturnType, errXRequiresOneArgument, errUnhandledExceptionX, errCyclicTree, errXisNoMacroOrTemplate, errXhasSideEffects, + errIteratorExpected, errUser, warnCannotOpenFile, warnOctalEscape, @@ -317,15 +312,14 @@ const 'operator expected, but found ''$1''', '''$1'' expected', 'string after ''include'' expected', - 'recursive include file: ''$1''', + 'recursive dependency: ''$1''', '''on'' or ''off'' expected', '''none'', ''speed'' or ''size'' expected', 'invalid pragma', 'unknown pragma: ''$1''', - 'unknown directive: ''$1''', - 'invalid directive', + 'invalid directive: ''$1''', '''pop'' without a ''push'' pragma', - 'empty asm statement makes no sense', + 'empty asm statement', 'invalid indentation', 'exception expected', 'exception already handled', @@ -371,8 +365,6 @@ const 'over- or underflow', 'cannot evalutate ''$1'' because type is not defined completely', '''chr'' expects an int in the range 0..255', - '''staticAssert'' failed: condition is false', - 'argument to ''staticAssert'' cannot be evaluated at compile time', '''.'' requires a record or object type', 'undeclared field: ''$1''', 'attempt to access a nil address', @@ -427,7 +419,7 @@ const 'but expected one of: ', 'but expected ''$1''', 'ambiguous call; both $1 and $2 match for: $3', - 'wrong number of type parameters', + 'wrong number of arguments', 'an inline proc has no address', '$1 cannot be declared in parameter declaration', 'pragmas are only in the header of a proc allowed', @@ -469,15 +461,13 @@ const 'named expression not allowed here', '''$1'' expects one type parameter', 'array expects two type parameters', - 'invalid invisibility: ''$1''', + 'invalid visibility: ''$1''', 'initialization not allowed here', '''$1'' cannot be assigned to', 'iterators can only be defined at the module''s top level', - 'iterator needs an implementation', - 'iterator needs a return type', + '$1 needs a return type', 'invalid command: ''$1''', '''$1'' is only allowed at top level', - 'type ''$1'' needs an implementation', 'template instantiation too nested', 'instantiation from here', 'invalid index value for tuple subscript', @@ -500,12 +490,12 @@ const 'invalid conversion from type ''$1''', 'assertion failed', 'cannot generate code for ''$1''', - 'converter needs return type', - 'converter requires one parameter', + '$1 requires one parameter', 'unhandled exception: $1', 'macro returned a cyclic abstract syntax tree', '''$1'' is no macro or template', '''$1'' can have side effects', + 'iterator within for loop context expected', '$1', 'cannot open ''$1'' [CannotOpenFile]', 'octal escape sequences do not exist; leading zero is ignored [OctalEscape]', @@ -568,322 +558,335 @@ const 'Conf', 'User' ); -//[[[end]]] - -const - fatalMin = errUnknown; - fatalMax = errInternal; - errMin = errUnknown; - errMax = errUser; - warnMin = warnCannotOpenFile; - warnMax = pred(hintSuccess); - hintMin = hintSuccess; - hintMax = high(TMsgKind); - -type - TNoteKind = warnMin..hintMax; - // "notes" are warnings or hints - TNoteKinds = set of TNoteKind; - - TLineInfo = record - // This is designed to be as small as possible, because it is used - // in syntax nodes. We safe space here by using two int16 and an int32 - // on 64 bit and on 32 bit systems this is only 8 bytes. - line, col: int16; - fileIndex: int32; - end; - -function UnknownLineInfo(): TLineInfo; - -var - gNotes: TNoteKinds = [low(TNoteKind)..high(TNoteKind)]; - gErrorCounter: int = 0; // counts the number of errors - gHintCounter: int = 0; - gWarnCounter: int = 0; - gErrorMax: int = 1; // stop after gErrorMax errors - -const // this format is understood by many text editors: it is the same that - // Borland and Freepascal use - PosErrorFormat = '$1($2, $3) Error: $4'; - PosWarningFormat = '$1($2, $3) Warning: $4'; - PosHintFormat = '$1($2, $3) Hint: $4'; - - RawErrorFormat = 'Error: $1'; - RawWarningFormat = 'Warning: $1'; - RawHintFormat = 'Hint: $1'; - -procedure MessageOut(const s: string); - -procedure rawMessage(const msg: TMsgKind; const arg: string = ''); overload; -procedure rawMessage(const msg: TMsgKind; const args: array of string); overload; - -procedure liMessage(const info: TLineInfo; const msg: TMsgKind; - const arg: string = ''); - -procedure InternalError(const info: TLineInfo; const errMsg: string); - overload; -procedure InternalError(const errMsg: string); overload; - -function newLineInfo(const filename: string; line, col: int): TLineInfo; - -function ToFilename(const info: TLineInfo): string; -function toColumn(const info: TLineInfo): int; -function ToLinenumber(const info: TLineInfo): int; - -function MsgKindToString(kind: TMsgKind): string; - -// checkpoints are used for debugging: -function checkpoint(const info: TLineInfo; const filename: string; - line: int): boolean; - -procedure addCheckpoint(const info: TLineInfo); overload; -procedure addCheckpoint(const filename: string; line: int); overload; -function inCheckpoint(const current: TLineInfo): boolean; -// prints the line information if in checkpoint - -procedure pushInfoContext(const info: TLineInfo); -procedure popInfoContext; - -implementation - -function UnknownLineInfo(): TLineInfo; -begin - result.line := int16(-1); - result.col := int16(-1); - result.fileIndex := -1; -end; - -{@ignore} -var - filenames: array of string; - msgContext: array of TLineInfo; -{@emit -var - filenames: array of string = @[]; - msgContext: array of TLineInfo = @[]; -} - -procedure pushInfoContext(const info: TLineInfo); -var - len: int; -begin - len := length(msgContext); - setLength(msgContext, len+1); - msgContext[len] := info; -end; - -procedure popInfoContext; -begin - setLength(msgContext, length(msgContext)-1); -end; - -function includeFilename(const f: string): int; -var - i: int; -begin - for i := high(filenames) downto low(filenames) do - if filenames[i] = f then begin - result := i; exit - end; - // not found, so add it: - result := length(filenames); - setLength(filenames, result+1); - filenames[result] := f; -end; - -function checkpoint(const info: TLineInfo; const filename: string; - line: int): boolean; -begin - result := (int(info.line) = line) and ( - ChangeFileExt(extractFilename(filenames[info.fileIndex]), '') = filename); -end; - - -{@ignore} -var - checkPoints: array of TLineInfo; -{@emit -var - checkPoints: array of TLineInfo = @[]; -} - -procedure addCheckpoint(const info: TLineInfo); overload; -var - len: int; -begin - len := length(checkPoints); - setLength(checkPoints, len+1); - checkPoints[len] := info; -end; - -procedure addCheckpoint(const filename: string; line: int); overload; -begin - addCheckpoint(newLineInfo(filename, line, -1)); -end; - -function newLineInfo(const filename: string; line, col: int): TLineInfo; -begin - result.fileIndex := includeFilename(filename); - result.line := int16(line); - result.col := int16(col); -end; - -function ToFilename(const info: TLineInfo): string; -begin - if info.fileIndex = -1 then result := '???' - else result := filenames[info.fileIndex] -end; - -function ToLinenumber(const info: TLineInfo): int; -begin - result := info.line -end; - -function toColumn(const info: TLineInfo): int; -begin - result := info.col -end; - -procedure MessageOut(const s: string); -begin // change only this proc to put it elsewhere - Writeln(output, s); -end; - -function coordToStr(const coord: int): string; -begin - if coord = -1 then result := '???' - else result := toString(coord) -end; - -function MsgKindToString(kind: TMsgKind): string; -begin // later versions may provide translated error messages - result := msgKindToStr[kind]; -end; - -function getMessageStr(msg: TMsgKind; const arg: string): string; -begin - result := format(msgKindToString(msg), [arg]); -end; - -function inCheckpoint(const current: TLineInfo): boolean; -var - i: int; -begin - result := false; - if not (optCheckpoints in gOptions) then exit; // ignore all checkpoints - for i := 0 to high(checkPoints) do begin - if (current.line = checkPoints[i].line) and - (current.fileIndex = (checkPoints[i].fileIndex)) then begin - MessageOut(Format('$1($2, $3) Checkpoint: ', [toFilename(current), - coordToStr(current.line), - coordToStr(current.col)])); - result := true; - exit - end - end -end; - -procedure handleError(const msg: TMsgKind); -begin - if msg = errInternal then assert(false); // we want a stack trace here - if (msg >= fatalMin) and (msg <= fatalMax) then begin - if gVerbosity >= 3 then assert(false); - halt(1) - end; - if (msg >= errMin) and (msg <= errMax) then begin - inc(gErrorCounter); - if gErrorCounter >= gErrorMax then begin - if gVerbosity >= 3 then assert(false); - halt(1) // one error stops the compiler - end - end -end; - -procedure writeContext; -var - i: int; -begin - for i := 0 to length(msgContext)-1 do begin - MessageOut(Format(posErrorFormat, [toFilename(msgContext[i]), - coordToStr(msgContext[i].line), - coordToStr(msgContext[i].col), - getMessageStr(errInstantiationFrom, '')])); - end; -end; - -procedure rawMessage(const msg: TMsgKind; const args: array of string); -var - frmt: string; -begin - case msg of - errMin..errMax: begin - writeContext(); - frmt := rawErrorFormat; - end; - warnMin..warnMax: begin - if not (optWarns in gOptions) then exit; - if not (msg in gNotes) then exit; - frmt := rawWarningFormat; - inc(gWarnCounter); - end; - hintMin..hintMax: begin - if not (optHints in gOptions) then exit; - if not (msg in gNotes) then exit; - frmt := rawHintFormat; - inc(gHintCounter); - end; - else assert(false) // cannot happen - end; - MessageOut(Format(frmt, format(msgKindToString(msg), args))); - handleError(msg); -end; - -procedure rawMessage(const msg: TMsgKind; const arg: string = ''); -begin - rawMessage(msg, [arg]); -end; - -procedure liMessage(const info: TLineInfo; const msg: TMsgKind; - const arg: string = ''); -var - frmt: string; -begin - case msg of - errMin..errMax: begin - writeContext(); - frmt := posErrorFormat; - end; - warnMin..warnMax: begin - if not (optWarns in gOptions) then exit; - if not (msg in gNotes) then exit; - frmt := posWarningFormat; - inc(gWarnCounter); - end; - hintMin..hintMax: begin - if not (optHints in gOptions) then exit; - if not (msg in gNotes) then exit; - frmt := posHintFormat; - inc(gHintCounter); - end; - else assert(false) // cannot happen - end; - MessageOut(Format(frmt, [toFilename(info), - coordToStr(info.line), - coordToStr(info.col), - getMessageStr(msg, arg)])); - handleError(msg); -end; - -procedure InternalError(const info: TLineInfo; const errMsg: string); -begin - writeContext(); - liMessage(info, errInternal, errMsg); -end; - -procedure InternalError(const errMsg: string); overload; -begin - writeContext(); - rawMessage(errInternal, errMsg); -end; - -end. +//[[[end]]] + +const + fatalMin = errUnknown; + fatalMax = errInternal; + errMin = errUnknown; + errMax = errUser; + warnMin = warnCannotOpenFile; + warnMax = pred(hintSuccess); + hintMin = hintSuccess; + hintMax = high(TMsgKind); + +type + TNoteKind = warnMin..hintMax; + // "notes" are warnings or hints + TNoteKinds = set of TNoteKind; + + TLineInfo = record + // This is designed to be as small as possible, because it is used + // in syntax nodes. We safe space here by using two int16 and an int32 + // on 64 bit and on 32 bit systems this is only 8 bytes. + line, col: int16; + fileIndex: int32; + end; + +function UnknownLineInfo(): TLineInfo; + +var + gNotes: TNoteKinds = [low(TNoteKind)..high(TNoteKind)]; + gErrorCounter: int = 0; // counts the number of errors + gHintCounter: int = 0; + gWarnCounter: int = 0; + gErrorMax: int = 1; // stop after gErrorMax errors + +const // this format is understood by many text editors: it is the same that + // Borland and Freepascal use + PosErrorFormat = '$1($2, $3) Error: $4'; + PosWarningFormat = '$1($2, $3) Warning: $4'; + PosHintFormat = '$1($2, $3) Hint: $4'; + + RawErrorFormat = 'Error: $1'; + RawWarningFormat = 'Warning: $1'; + RawHintFormat = 'Hint: $1'; + +procedure MessageOut(const s: string); + +procedure rawMessage(const msg: TMsgKind; const arg: string = ''); overload; +procedure rawMessage(const msg: TMsgKind; const args: array of string); overload; + +procedure liMessage(const info: TLineInfo; const msg: TMsgKind; + const arg: string = ''); + +procedure InternalError(const info: TLineInfo; const errMsg: string); + overload; +procedure InternalError(const errMsg: string); overload; + +function newLineInfo(const filename: string; line, col: int): TLineInfo; + +function ToFilename(const info: TLineInfo): string; +function toColumn(const info: TLineInfo): int; +function ToLinenumber(const info: TLineInfo): int; + +function MsgKindToString(kind: TMsgKind): string; + +// checkpoints are used for debugging: +function checkpoint(const info: TLineInfo; const filename: string; + line: int): boolean; + +procedure addCheckpoint(const info: TLineInfo); overload; +procedure addCheckpoint(const filename: string; line: int); overload; +function inCheckpoint(const current: TLineInfo): boolean; +// prints the line information if in checkpoint + +procedure pushInfoContext(const info: TLineInfo); +procedure popInfoContext; + +function includeFilename(const f: string): int; + + +implementation + +function UnknownLineInfo(): TLineInfo; +begin + result.line := int16(-1); + result.col := int16(-1); + result.fileIndex := -1; +end; + +{@ignore} +var + filenames: array of string; + msgContext: array of TLineInfo; +{@emit +var + filenames: array of string = @[]; + msgContext: array of TLineInfo = @[]; +} + +procedure pushInfoContext(const info: TLineInfo); +var + len: int; +begin + len := length(msgContext); + setLength(msgContext, len+1); + msgContext[len] := info; +end; + +procedure popInfoContext; +begin + setLength(msgContext, length(msgContext)-1); +end; + +function includeFilename(const f: string): int; +var + i: int; +begin + for i := high(filenames) downto low(filenames) do + if filenames[i] = f then begin + result := i; exit + end; + // not found, so add it: + result := length(filenames); + setLength(filenames, result+1); + filenames[result] := f; +end; + +function checkpoint(const info: TLineInfo; const filename: string; + line: int): boolean; +begin + result := (int(info.line) = line) and ( + ChangeFileExt(extractFilename(filenames[info.fileIndex]), '') = filename); +end; + + +{@ignore} +var + checkPoints: array of TLineInfo; +{@emit +var + checkPoints: array of TLineInfo = @[]; +} + +procedure addCheckpoint(const info: TLineInfo); overload; +var + len: int; +begin + len := length(checkPoints); + setLength(checkPoints, len+1); + checkPoints[len] := info; +end; + +procedure addCheckpoint(const filename: string; line: int); overload; +begin + addCheckpoint(newLineInfo(filename, line, -1)); +end; + +function newLineInfo(const filename: string; line, col: int): TLineInfo; +begin + result.fileIndex := includeFilename(filename); + result.line := int16(line); + result.col := int16(col); +end; + +function ToFilename(const info: TLineInfo): string; +begin + if info.fileIndex = -1 then result := '???' + else result := filenames[info.fileIndex] +end; + +function ToLinenumber(const info: TLineInfo): int; +begin + result := info.line +end; + +function toColumn(const info: TLineInfo): int; +begin + result := info.col +end; + +procedure MessageOut(const s: string); +begin // change only this proc to put it elsewhere + Writeln(output, s); +end; + +function coordToStr(const coord: int): string; +begin + if coord = -1 then result := '???' + else result := toString(coord) +end; + +function MsgKindToString(kind: TMsgKind): string; +begin // later versions may provide translated error messages + result := msgKindToStr[kind]; +end; + +function getMessageStr(msg: TMsgKind; const arg: string): string; +begin + result := format(msgKindToString(msg), [arg]); +end; + +function inCheckpoint(const current: TLineInfo): boolean; +var + i: int; +begin + result := false; + if not (optCheckpoints in gOptions) then exit; // ignore all checkpoints + for i := 0 to high(checkPoints) do begin + if (current.line = checkPoints[i].line) and + (current.fileIndex = (checkPoints[i].fileIndex)) then begin + MessageOut(Format('$1($2, $3) Checkpoint: ', [toFilename(current), + coordToStr(current.line), + coordToStr(current.col)])); + result := true; + exit + end + end +end; + +procedure handleError(const msg: TMsgKind); +begin + if msg = errInternal then assert(false); // we want a stack trace here + if (msg >= fatalMin) and (msg <= fatalMax) then begin + if gVerbosity >= 3 then assert(false); + halt(1) + end; + if (msg >= errMin) and (msg <= errMax) then begin + inc(gErrorCounter); + if gErrorCounter >= gErrorMax then begin + if gVerbosity >= 3 then assert(false); + halt(1) // one error stops the compiler + end + end +end; + +function sameLineInfo(const a, b: TLineInfo): bool; +begin + result := (a.line = b.line) and (a.fileIndex = b.fileIndex); +end; + +procedure writeContext(const lastinfo: TLineInfo); +var + i: int; + info: TLineInfo; +begin + info := lastInfo; + for i := 0 to length(msgContext)-1 do begin + if not sameLineInfo(msgContext[i], lastInfo) + and not sameLineInfo(msgContext[i], info) then + MessageOut(Format(posErrorFormat, [toFilename(msgContext[i]), + coordToStr(msgContext[i].line), + coordToStr(msgContext[i].col), + getMessageStr(errInstantiationFrom, '')])); + info := msgContext[i]; + end; +end; + +procedure rawMessage(const msg: TMsgKind; const args: array of string); +var + frmt: string; +begin + case msg of + errMin..errMax: begin + writeContext(unknownLineInfo()); + frmt := rawErrorFormat; + end; + warnMin..warnMax: begin + if not (optWarns in gOptions) then exit; + if not (msg in gNotes) then exit; + frmt := rawWarningFormat; + inc(gWarnCounter); + end; + hintMin..hintMax: begin + if not (optHints in gOptions) then exit; + if not (msg in gNotes) then exit; + frmt := rawHintFormat; + inc(gHintCounter); + end; + else assert(false) // cannot happen + end; + MessageOut(Format(frmt, format(msgKindToString(msg), args))); + handleError(msg); +end; + +procedure rawMessage(const msg: TMsgKind; const arg: string = ''); +begin + rawMessage(msg, [arg]); +end; + +procedure liMessage(const info: TLineInfo; const msg: TMsgKind; + const arg: string = ''); +var + frmt: string; +begin + case msg of + errMin..errMax: begin + writeContext(info); + frmt := posErrorFormat; + end; + warnMin..warnMax: begin + if not (optWarns in gOptions) then exit; + if not (msg in gNotes) then exit; + frmt := posWarningFormat; + inc(gWarnCounter); + end; + hintMin..hintMax: begin + if not (optHints in gOptions) then exit; + if not (msg in gNotes) then exit; + frmt := posHintFormat; + inc(gHintCounter); + end; + else assert(false) // cannot happen + end; + MessageOut(Format(frmt, [toFilename(info), + coordToStr(info.line), + coordToStr(info.col), + getMessageStr(msg, arg)])); + handleError(msg); +end; + +procedure InternalError(const info: TLineInfo; const errMsg: string); +begin + writeContext(info); + liMessage(info, errInternal, errMsg); +end; + +procedure InternalError(const errMsg: string); overload; +begin + writeContext(UnknownLineInfo()); + rawMessage(errInternal, errMsg); +end; + +end. diff --git a/nim/nhashes.pas b/nim/nhashes.pas old mode 100644 new mode 100755 diff --git a/nim/nimconf.pas b/nim/nimconf.pas old mode 100644 new mode 100755 index 842446ae9..69c6f7618 --- a/nim/nimconf.pas +++ b/nim/nimconf.pas @@ -218,7 +218,7 @@ begin ppGetTok(L, tok) end else - lexMessage(L, errUnknownDirective, tokToStr(tok)) + lexMessage(L, errInvalidDirectiveX, tokToStr(tok)) end end; diff --git a/nim/nimrod.pas b/nim/nimrod.pas old mode 100644 new mode 100755 diff --git a/nim/nimsets.pas b/nim/nimsets.pas old mode 100644 new mode 100755 diff --git a/nim/nmath.pas b/nim/nmath.pas old mode 100644 new mode 100755 diff --git a/nim/nos.pas b/nim/nos.pas old mode 100644 new mode 100755 index 4926c99b0..2edb0864e --- a/nim/nos.pas +++ b/nim/nos.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -220,7 +220,7 @@ begin if (length(result) > 0) and (result[1] <> '/') then begin // not an absolute path? // iterate over any path in the $PATH environment variable - paths := splitSeq(getEnv('PATH'), [':']); + paths := split(getEnv('PATH'), [':']); for p := 0 to high(paths) do begin tail := joinPath(paths[p], result); if ExistsFile(tail) then begin result := tail; exit end diff --git a/nim/nstrtabs.pas b/nim/nstrtabs.pas old mode 100644 new mode 100755 diff --git a/nim/nsystem.pas b/nim/nsystem.pas old mode 100644 new mode 100755 index 51ca05605..49d17b172 --- a/nim/nsystem.pas +++ b/nim/nsystem.pas @@ -217,8 +217,15 @@ procedure nimWrite(var f: tBinaryFile; const str: string); overload; procedure add(var x: string; const y: string); // Pascal version of string appending. Terminating zero is ignored. +function isNil(s: string): bool; + implementation +function isNil(s: string): bool; +begin + result := s = ''; +end; + {@ignore} procedure add(var x: string; const y: string); // Pascal version of string appending. Terminating zero is ignored. diff --git a/nim/ntime.pas b/nim/ntime.pas old mode 100644 new mode 100755 diff --git a/nim/nversion.pas b/nim/nversion.pas old mode 100644 new mode 100755 index e15f88068..add85acd1 --- a/nim/nversion.pas +++ b/nim/nversion.pas @@ -31,10 +31,10 @@ const //cog.outl('VersionMinor = %s;' % ver[1]) //cog.outl('VersionPatch = %s;' % ver[2]) //]]] - VersionAsString = '0.7.10'; + VersionAsString = '0.8.0'; VersionMajor = 0; - VersionMinor = 7; - VersionPatch = 10; + VersionMinor = 8; + VersionPatch = 0; //[[[[end]]]] implementation diff --git a/nim/options.pas b/nim/options.pas old mode 100644 new mode 100755 index f84d8458c..d210f3b44 --- a/nim/options.pas +++ b/nim/options.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -46,7 +46,8 @@ type optRun, // run the compiled project optSymbolFiles, // use symbol files for speeding up compilation optSkipConfigFile, // skip the general config file - optSkipProjConfigFile // skip the project's config file + optSkipProjConfigFile, // skip the project's config file + optNoMain // do not generate a "main" proc ); TGlobalOptions = set of TGlobalOption; @@ -68,6 +69,7 @@ type cmdScan, // scan a single file (for debugging) cmdDebugTrans, // debug a transformation pass cmdRst2html, // convert a reStructuredText file to HTML + cmdRst2tex, // convert a reStructuredText file to TeX cmdInteractive // start interactive session ); TStringSeq = array of string; @@ -107,9 +109,11 @@ const NimExt = 'nim'; RodExt = 'rod'; HtmlExt = 'html'; + TexExt = 'tex'; IniExt = 'ini'; TmplExt = 'tmpl'; DocConfig = 'nimdoc.cfg'; + DocTexConfig = 'nimdoc.tex.cfg'; function completeGeneratedFilePath(const f: string; createSubDir: bool = true): string; diff --git a/nim/osproc.pas b/nim/osproc.pas old mode 100644 new mode 100755 diff --git a/nim/parsecfg.pas b/nim/parsecfg.pas old mode 100644 new mode 100755 diff --git a/nim/parseopt.pas b/nim/parseopt.pas old mode 100644 new mode 100755 diff --git a/nim/paslex.pas b/nim/paslex.pas old mode 100644 new mode 100755 diff --git a/nim/pasparse.pas b/nim/pasparse.pas old mode 100644 new mode 100755 index 73280aeca..8a73feca5 --- a/nim/pasparse.pas +++ b/nim/pasparse.pas @@ -293,7 +293,7 @@ begin addSon(result, a.sons[1]); end else begin - parMessage(p, errInvalidDirective); + parMessage(p, errInvalidDirectiveX, pasTokToStr(p.tok)); result := a end end @@ -334,7 +334,7 @@ begin getTok(p); eat(p, pxCurlyDirRi); end else begin - parMessage(p, errUnknownDirective, pasTokToStr(p.tok)); + parMessage(p, errInvalidDirectiveX, pasTokToStr(p.tok)); while true do begin getTok(p); if (p.tok.xkind = pxCurlyDirRi) or (p.tok.xkind = pxEof) then break; diff --git a/nim/passaux.pas b/nim/passaux.pas old mode 100644 new mode 100755 diff --git a/nim/passes.pas b/nim/passes.pas old mode 100644 new mode 100755 diff --git a/nim/platform.pas b/nim/platform.pas old mode 100644 new mode 100755 diff --git a/nim/pnimsyn.pas b/nim/pnimsyn.pas old mode 100644 new mode 100755 index 2ca411770..dae7de539 --- a/nim/pnimsyn.pas +++ b/nim/pnimsyn.pas @@ -612,6 +612,18 @@ begin result := newStrNodeP(nkTripleStrLit, p.tok.literal, p); getTok(p); end; + tkCallRStrLit: begin + result := newNodeP(nkCallStrLit, p); + addSon(result, newIdentNodeP(p.tok.ident, p)); + addSon(result, newStrNodeP(nkRStrLit, p.tok.literal, p)); + getTok(p); + end; + tkCallTripleStrLit: begin + result := newNodeP(nkCallStrLit, p); + addSon(result, newIdentNodeP(p.tok.ident, p)); + addSon(result, newStrNodeP(nkTripleStrLit, p.tok.literal, p)); + getTok(p); + end; tkCharLit: begin result := newIntNodeP(nkCharLit, ord(p.tok.literal[strStart]), p); getTok(p); @@ -885,8 +897,8 @@ begin while true do begin case p.tok.tokType of tkEof, tkSad, tkDed: break; - tkSymbol, tkAccent: a := parseSymbol(p); - tkRStrLit: begin + tkSymbol, tkAccent: a := parseSymbol(p); + tkRStrLit: begin a := newStrNodeP(nkRStrLit, p.tok.literal, p); getTok(p) end; @@ -901,16 +913,7 @@ begin else begin parMessage(p, errIdentifierExpected, tokToStr(p.tok)); break - end; - end; - //optInd(p, a); - if p.tok.tokType = tkAs then begin - getTok(p); - optInd(p, a); - b := a; - a := newNodeP(nkImportAs, p); - addSon(a, b); - addSon(a, parseSymbol(p)); + end end; addSon(result, a); if p.tok.tokType <> tkComma then break; @@ -1227,24 +1230,31 @@ begin result := a end; -function parseIdentColonEquals(var p: TParser; withPragma: bool): PNode; +type + TDeclaredIdentFlag = ( + withPragma, // identifier may have pragma + withBothOptional // both ':' and '=' parts are optional + ); + TDeclaredIdentFlags = set of TDeclaredIdentFlag; + +function parseIdentColonEquals(var p: TParser; + flags: TDeclaredIdentFlags): PNode; var a: PNode; begin result := newNodeP(nkIdentDefs, p); while true do begin case p.tok.tokType of - tkColon, tkEof, tkSad, tkDed, tkParRi, tkEquals: break; - else begin - if withPragma then + tkSymbol, tkAccent: begin + if withPragma in flags then a := identWithPragma(p) else a := parseSymbol(p); if a = nil then exit; - end + end; + else break; end; addSon(result, a); - //optInd(p, a); if p.tok.tokType <> tkComma then break; getTok(p); optInd(p, a) @@ -1255,7 +1265,7 @@ begin end else begin addSon(result, nil); - if p.tok.tokType <> tkEquals then + if (p.tok.tokType <> tkEquals) and not (withBothOptional in flags) then parMessage(p, errColonOrEqualsExpected, tokToStr(p.tok)) end; if p.tok.tokType = tkEquals then begin @@ -1277,7 +1287,7 @@ begin optInd(p, result); while true do begin case p.tok.tokType of - tkSymbol, tkAccent: a := parseIdentColonEquals(p, false); + tkSymbol, tkAccent: a := parseIdentColonEquals(p, {@set}[]); tkParRi: break; else begin parMessage(p, errTokenExpected, ')'+''); break; end; end; @@ -1335,7 +1345,7 @@ begin eat(p, tkBracketLe); optInd(p, result); while (p.tok.tokType = tkSymbol) or (p.tok.tokType = tkAccent) do begin - a := parseIdentColonEquals(p, false); + a := parseIdentColonEquals(p, {@set}[]); addSon(result, a); if p.tok.tokType <> tkComma then break; getTok(p); @@ -1360,23 +1370,6 @@ begin end end; -function parseGenericParam(var p: TParser): PNode; -var - a: PNode; -begin - a := parseSymbol(p); - optInd(p, a); - if p.tok.tokType = tkEquals then begin - result := newNodeP(nkDefaultTypeParam, p); - getTok(p); - optInd(p, a); - addSon(result, a); - addSon(result, parseTypeDesc(p)); - end - else - result := a -end; - function parseGenericParamList(var p: TParser): PNode; var a: PNode; @@ -1385,7 +1378,7 @@ begin getTok(p); optInd(p, result); while (p.tok.tokType = tkSymbol) or (p.tok.tokType = tkAccent) do begin - a := parseGenericParam(p); + a := parseIdentColonEquals(p, {@set}[withBothOptional]); addSon(result, a); if p.tok.tokType <> tkComma then break; getTok(p); @@ -1479,7 +1472,10 @@ begin end; popInd(p.lex^); end; - tkSymbol, tkAccent: addSon(result, defparser(p)); + tkSymbol, tkAccent, tkParLe: begin + // tkParLe is allowed for ``var (x, y) = ...`` tuple parsing + addSon(result, defparser(p)); + end else parMessage(p, errIdentifierExpected, tokToStr(p.tok)); end end; @@ -1627,7 +1623,7 @@ begin tkWhen: result := parseRecordWhen(p); tkCase: result := parseRecordCase(p); tkSymbol, tkAccent: begin - result := parseIdentColonEquals(p, true); + result := parseIdentColonEquals(p, {@set}[withPragma]); skipComment(p, result); end; tkNil: begin @@ -1660,9 +1656,9 @@ begin addSon(result, parseRecordPart(p)); end; -function parseAbstract(var p: TParser): PNode; +function parseDistinct(var p: TParser): PNode; begin - result := newNodeP(nkAbstractTy, p); + result := newNodeP(nkDistinctTy, p); getTok(p); optInd(p, result); addSon(result, parseTypeDesc(p)); @@ -1681,7 +1677,7 @@ begin case p.tok.tokType of tkObject: a := parseRecordOrObject(p, nkObjectTy); tkEnum: a := parseEnum(p); - tkAbstract: a := parseAbstract(p); + tkDistinct: a := parseDistinct(p); else a := parseTypeDesc(p); end; addSon(result, a); @@ -1718,7 +1714,7 @@ begin if p.tok.tokType = tkParLe then result := parseVarTuple(p) else - result := parseIdentColonEquals(p, true); + result := parseIdentColonEquals(p, {@set}[withPragma]); indAndComment(p, result); // special extension! end; diff --git a/nim/pragmas.pas b/nim/pragmas.pas old mode 100644 new mode 100755 index f81cdd6e2..5ec706f19 --- a/nim/pragmas.pas +++ b/nim/pragmas.pas @@ -19,16 +19,45 @@ uses rnimsyn, wordrecg, ropes, options, strutils, lists, extccomp, nmath, magicsys; -procedure pragmaProc(c: PContext; s: PSym; n: PNode); -procedure pragmaMacro(c: PContext; s: PSym; n: PNode); -procedure pragmaIterator(c: PContext; s: PSym; n: PNode); -procedure pragmaStmt(c: PContext; s: PSym; n: PNode); -procedure pragmaLambda(c: PContext; s: PSym; n: PNode); -procedure pragmaType(c: PContext; s: PSym; n: PNode); -procedure pragmaField(c: PContext; s: PSym; n: PNode); -procedure pragmaVar(c: PContext; s: PSym; n: PNode); -procedure pragmaConst(c: PContext; s: PSym; n: PNode); -procedure pragmaProcType(c: PContext; s: PSym; n: PNode); +const + FirstCallConv = wNimcall; + LastCallConv = wNoconv; + +const + procPragmas = {@set}[FirstCallConv..LastCallConv, + wImportc, wExportc, wNodecl, wMagic, wNosideEffect, wSideEffect, + wNoreturn, wDynLib, wHeader, wCompilerProc, wPure, + wCppMethod, wDeprecated, wVarargs, wCompileTime, wMerge, + wBorrow]; + converterPragmas = procPragmas; + macroPragmas = {@set}[FirstCallConv..LastCallConv, + wImportc, wExportc, wNodecl, wMagic, wNosideEffect, + wCompilerProc, wDeprecated, wTypeCheck]; + iteratorPragmas = {@set}[FirstCallConv..LastCallConv, + wNosideEffect, wSideEffect, + wImportc, wExportc, wNodecl, wMagic, wDeprecated, wBorrow]; + stmtPragmas = {@set}[wChecks, wObjChecks, wFieldChecks, wRangechecks, + wBoundchecks, wOverflowchecks, wNilchecks, wAssertions, wWarnings, + wHints, wLinedir, wStacktrace, wLinetrace, wOptimization, + wHint, wWarning, wError, wFatal, wDefine, wUndef, + wCompile, wLink, wLinkSys, wPure, + wPush, wPop, wBreakpoint, wCheckpoint, + wPassL, wPassC, wDeadCodeElim]; + lambdaPragmas = {@set}[FirstCallConv..LastCallConv, + wImportc, wExportc, wNodecl, wNosideEffect, wSideEffect, + wNoreturn, wDynLib, wHeader, wPure, wDeprecated]; + typePragmas = {@set}[wImportc, wExportc, wDeprecated, wMagic, wAcyclic, + wNodecl, wPure, wHeader, wCompilerProc, wFinal]; + fieldPragmas = {@set}[wImportc, wExportc, wDeprecated]; + varPragmas = {@set}[wImportc, wExportc, wVolatile, wRegister, wThreadVar, + wNodecl, wMagic, wHeader, wDeprecated, wCompilerProc, + wDynLib]; + constPragmas = {@set}[wImportc, wExportc, wHeader, wDeprecated, + wMagic, wNodecl]; + procTypePragmas = [FirstCallConv..LastCallConv, wVarargs, wNosideEffect]; + +procedure pragma(c: PContext; sym: PSym; n: PNode; + const validPragmas: TSpecialWords); function pragmaAsm(c: PContext; n: PNode): char; @@ -66,9 +95,6 @@ begin end; const - FirstCallConv = wNimcall; - LastCallConv = wNoconv; - FirstPragmaWord = wMagic; LastPragmaWord = wNoconv; @@ -598,74 +624,4 @@ begin end end; -procedure pragmaProc(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wImportc, wExportc, wNodecl, wMagic, wNosideEffect, wSideEffect, - wNoreturn, wDynLib, wHeader, wCompilerProc, wPure, - wCppMethod, wDeprecated, wVarargs, wCompileTime, wMerge, - wBorrow]); -end; - -procedure pragmaMacro(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wImportc, wExportc, wNodecl, wMagic, wNosideEffect, - wCompilerProc, wDeprecated, wTypeCheck]); -end; - -procedure pragmaIterator(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wNosideEffect, wSideEffect, - wImportc, wExportc, wNodecl, wMagic, wDeprecated, wBorrow]); -end; - -procedure pragmaStmt(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[wChecks, wObjChecks, wFieldChecks, wRangechecks, - wBoundchecks, wOverflowchecks, wNilchecks, wAssertions, wWarnings, - wHints, wLinedir, wStacktrace, wLinetrace, wOptimization, - wHint, wWarning, wError, wFatal, wDefine, wUndef, - wCompile, wLink, wLinkSys, wPure, - wPush, wPop, wBreakpoint, wCheckpoint, - wPassL, wPassC, wDeadCodeElim]); -end; - -procedure pragmaLambda(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, - wImportc, wExportc, wNodecl, wNosideEffect, wSideEffect, - wNoreturn, wDynLib, wHeader, wPure, wDeprecated]); -end; - -procedure pragmaType(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[wImportc, wExportc, wDeprecated, wMagic, wAcyclic, - wNodecl, wPure, wHeader, wCompilerProc, wFinal]); -end; - -procedure pragmaField(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[wImportc, wExportc, wDeprecated]); -end; - -procedure pragmaVar(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[wImportc, wExportc, wVolatile, wRegister, wThreadVar, - wNodecl, wMagic, wHeader, wDeprecated, wCompilerProc, - wDynLib]); -end; - -procedure pragmaConst(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, {@set}[wImportc, wExportc, wHeader, wDeprecated, - wMagic, wNodecl]); -end; - -procedure pragmaProcType(c: PContext; s: PSym; n: PNode); -begin - pragma(c, s, n, [FirstCallConv..LastCallConv, wVarargs]); -end; - end. diff --git a/nim/procfind.pas b/nim/procfind.pas old mode 100644 new mode 100755 index c8792586a..e93820ab3 --- a/nim/procfind.pas +++ b/nim/procfind.pas @@ -16,7 +16,7 @@ interface {$include 'config.inc'} uses - nsystem, ast, astalgo, msgs, semdata, types; + nsystem, ast, astalgo, msgs, semdata, types, trees; function SearchForProc(c: PContext; fn: PSym; tos: int): PSym; // Searchs for the fn in the symbol table. If the parameter lists are exactly @@ -45,7 +45,9 @@ begin InternalError(procB.info, 'equalGenericParams'); a := procA.sons[i].sym; b := procB.sons[i].sym; - if (a.name.id <> b.name.id) or not sameType(a.typ, b.typ) then exit; + if (a.name.id <> b.name.id) or not sameTypeOrNil(a.typ, b.typ) then exit; + if (a.ast <> nil) and (b.ast <> nil) then + if not ExprStructuralEquivalent(a.ast, b.ast) then exit; end; result := true end; @@ -85,10 +87,10 @@ begin m := a.sons[i].sym; n := b.sons[i].sym; assert((m.kind = skParam) and (n.kind = skParam)); - if not equalOrAbstractOf(m.typ, n.typ) then exit; + if not equalOrDistinctOf(m.typ, n.typ) then exit; end; // return type: - if not equalOrAbstractOf(a.sons[0].typ, b.sons[0].typ) then exit; + if not equalOrDistinctOf(a.sons[0].typ, b.sons[0].typ) then exit; result := true end end; diff --git a/nim/ptmplsyn.pas b/nim/ptmplsyn.pas old mode 100644 new mode 100755 diff --git a/nim/readme.txt b/nim/readme.txt old mode 100644 new mode 100755 diff --git a/nim/rnimsyn.pas b/nim/rnimsyn.pas old mode 100644 new mode 100755 index 0ed3cfcd7..b3271a3bb --- a/nim/rnimsyn.pas +++ b/nim/rnimsyn.pas @@ -188,10 +188,8 @@ var i: int; begin result := '"' + ''; - for i := strStart to length(s)+strStart-1 do begin - result := result +{&} toNimChar(s[i]); - end; - result := result + '"'; + for i := strStart to length(s)+strStart-1 do add(result, toNimChar(s[i])); + addChar(result, '"'); end; procedure putComment(var g: TSrcGen; s: string); @@ -496,7 +494,7 @@ begin nkAddr: result := lsub(n.sons[0])+length('addr()'); nkHiddenAddr, nkHiddenDeref: result := lsub(n.sons[0]); nkCommand: result := lsub(n.sons[0])+lcomma(n, 1)+1; - nkExprEqExpr, nkDefaultTypeParam, nkAsgn, nkFastAsgn: result := lsons(n)+3; + nkExprEqExpr, nkAsgn, nkFastAsgn: result := lsons(n)+3; nkPar, nkCurly, nkBracket: result := lcomma(n)+2; nkSymChoice: result := lsons(n) + length('()') + sonsLen(n)-1; nkTupleTy: result := lcomma(n)+length('tuple[]'); @@ -528,10 +526,10 @@ begin nkInfix: result := lsons(n) + 2; nkPrefix: result := lsons(n) + 1; nkPostfix: result := lsons(n); + nkCallStrLit: result := lsons(n); nkPragmaExpr: result := lsub(n.sons[0])+lcomma(n, 1); nkRange: result := lsons(n) + 2; nkDerefExpr: result := lsub(n.sons[0])+2; - nkImportAs: result := lsons(n) + length('_as_'); nkAccQuoted: result := lsub(n.sons[0]) + 2; nkIfExpr: result := lsub(n.sons[0].sons[0])+lsub(n.sons[0].sons[1]) @@ -544,7 +542,7 @@ begin nkRefTy: result := lsub(n.sons[0])+length('ref_'); nkPtrTy: result := lsub(n.sons[0])+length('ptr_'); nkVarTy: result := lsub(n.sons[0])+length('var_'); - nkAbstractTy: result := lsub(n.sons[0])+length('abstract_'); + nkDistinctTy: result := lsub(n.sons[0])+length('Distinct_'); nkTypeDef: result := lsons(n)+3; nkOfInherit: result := lsub(n.sons[0])+length('of_'); nkProcTy: result := lsons(n)+length('proc_'); @@ -612,11 +610,6 @@ begin gsub(g, n, c); end; -function one(b: bool): int; -begin - if b then result := 1 else result := 0 -end; - function hasCom(n: PNode): bool; var i: int; @@ -649,7 +642,7 @@ var begin for i := start to sonsLen(n)+theEnd do begin c := i < sonsLen(n)+theEnd; - sublen := lsub(n.sons[i])+one(c); + sublen := lsub(n.sons[i])+ord(c); if not fits(g, sublen) and (ind+sublen < maxLineLen) then optNL(g, ind); gsub(g, n.sons[i]); if c then begin @@ -959,6 +952,13 @@ begin gcomma(g, n, 1); put(g, tkParRi, ')'+''); end; + nkCallStrLit: begin + gsub(g, n.sons[0]); + if n.sons[1].kind = nkRStrLit then + put(g, tkRStrLit, '"' + n.sons[1].strVal + '"') + else + gsub(g, n.sons[0]); + end; nkHiddenStdConv, nkHiddenSubConv, nkHiddenCallConv: begin gsub(g, n.sons[0]); end; @@ -992,7 +992,7 @@ begin put(g, tkSpaces, space); gcomma(g, n, 1); end; - nkExprEqExpr, nkDefaultTypeParam, nkAsgn, nkFastAsgn: begin + nkExprEqExpr, nkAsgn, nkFastAsgn: begin gsub(g, n.sons[0]); put(g, tkSpaces, Space); putWithSpace(g, tkEquals, '='+''); @@ -1121,12 +1121,6 @@ begin // unfortunately this requires a space, because ^. would be // only one operator end; - nkImportAs: begin - gsub(g, n.sons[0]); - put(g, tkSpaces, Space); - putWithSpace(g, tkAs, 'as'); - gsub(g, n.sons[1]); - end; nkAccQuoted: begin put(g, tkAccent, '`'+''); gsub(g, n.sons[0]); @@ -1167,8 +1161,8 @@ begin putWithSpace(g, tkVar, 'var'); gsub(g, n.sons[0]); end; - nkAbstractTy: begin - putWithSpace(g, tkAbstract, 'abstract'); + nkDistinctTy: begin + putWithSpace(g, tkDistinct, 'distinct'); gsub(g, n.sons[0]); end; nkTypeDef: begin diff --git a/nim/rodread.pas b/nim/rodread.pas old mode 100644 new mode 100755 index a34153ccf..dc3630a45 --- a/nim/rodread.pas +++ b/nim/rodread.pas @@ -172,7 +172,7 @@ begin res := ''; for i := strStart to length(s)+strStart-1 do begin case s[i] of - '0'..'9', 'a'..'z', 'A'..'Z', '_': + 'a'..'z', 'A'..'Z', '0'..'9', '_': addChar(res, s[i]); else res := res +{&} '\' +{&} toHex(ord(s[i]), 2) @@ -535,7 +535,7 @@ var begin i := r.pos; sign := -1; - assert(r.s[i] in ['0'..'9', 'a'..'z', 'A'..'Z', '-', #128..#255]); + assert(r.s[i] in ['a'..'z', 'A'..'Z', '0'..'9', '-', #128..#255]); if r.s[i] = '-' then begin inc(i); sign := 1 @@ -562,7 +562,7 @@ var begin i := r.pos; sign := -1; - assert(r.s[i] in ['0'..'9', 'a'..'z', 'A'..'Z', '-', #128..#255]); + assert(r.s[i] in ['a'..'z', 'A'..'Z', '0'..'9', '-', #128..#255]); if r.s[i] = '-' then begin inc(i); sign := 1 @@ -606,7 +606,7 @@ begin hexChar(r.s[i-1], xi); addChar(result, chr(xi)); end; - 'a'..'z', '0'..'9', 'A'..'Z', '_': begin + 'a'..'z', 'A'..'Z', '0'..'9', '_': begin addChar(result, r.s[i]); inc(i); end diff --git a/nim/rodwrite.pas b/nim/rodwrite.pas old mode 100644 new mode 100755 diff --git a/nim/ropes.pas b/nim/ropes.pas old mode 100644 new mode 100755 diff --git a/nim/rst.pas b/nim/rst.pas old mode 100644 new mode 100755 index d2afc7e33..d5cde5c7e --- a/nim/rst.pas +++ b/nim/rst.pas @@ -142,6 +142,8 @@ procedure addSon(father, son: PRstNode); function rstnodeToRefname(n: PRstNode): string; +function addNodes(n: PRstNode): string; + function getFieldValue(n: PRstNode; const fieldname: string): string; function getArgument(n: PRstNode): string; @@ -1834,7 +1836,6 @@ begin rnDirective: a := parseDotDot(p); rnEnumList: a := parseEnumList(p); rnLeaf: begin - //writeln(ord(p.tok[p.idx].kind), ' ', p.tok[p.idx].symbol); rstMessage(p, errNewSectionExpected); end; rnParagraph: begin end; @@ -1856,14 +1857,9 @@ begin end; addSonIfNotNil(result, a); end; - //if (result.kind in [rnBulletItem]) and if (sonKind(result, 0) = rnParagraph) and (sonKind(result, 1) <> rnParagraph) then result.sons[0].kind := rnInner; - (* - if (result.kind <> rnInner) and (rsonsLen(result) = 1) - and (result.sons[0].kind = rnParagraph) then - result.sons[0].kind := rnInner; *) end; function parseSectionWrapper(var p: TRstParser): PRstNode; @@ -1921,7 +1917,6 @@ begin if (assigned(contentParser)) and (p.tok[p.idx].kind = tkIndent) and (p.tok[p.idx].ival > currInd(p)) then begin pushInd(p, p.tok[p.idx].ival); - //while p.tok[p.idx].kind = tkIndent do inc(p.idx); content := contentParser(p); popInd(p); addSon(result, content) @@ -2085,7 +2080,7 @@ begin dkRaw: result := dirRaw(p); dkCodeblock: result := dirCodeBlock(p); dkIndex: result := dirIndex(p); - else rstMessage(p, errUnknownDirective, d); + else rstMessage(p, errInvalidDirectiveX, d); end; popInd(p); end @@ -2112,7 +2107,7 @@ begin b := dirImage(p); end else - rstMessage(p, errUnknownDirective, p.tok[p.idx].symbol); + rstMessage(p, errInvalidDirectiveX, p.tok[p.idx].symbol); setSub(p, addNodes(a), b); end else if match(p, p.idx, ' [') then begin @@ -2172,6 +2167,8 @@ function rstParse(const text: string; // the text to be parsed var p: TRstParser; begin + if isNil(text) then + rawMessage(errCannotOpenFile, filename); initParser(p, newSharedState()); p.filename := filename; p.line := line; diff --git a/nim/scanner.pas b/nim/scanner.pas old mode 100644 new mode 100755 index edc9ca24a..ffe1741f5 --- a/nim/scanner.pas +++ b/nim/scanner.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -52,10 +52,10 @@ type // i = i + 1 //cog.out(idents) //]]] - tkAbstract, tkAddr, tkAnd, tkAs, - tkAsm, tkBind, tkBlock, tkBreak, - tkCase, tkCast, tkConst, tkContinue, - tkConverter, tkDiscard, tkDiv, tkElif, + tkAddr, tkAnd, tkAs, tkAsm, + tkBind, tkBlock, tkBreak, tkCase, + tkCast, tkConst, tkContinue, tkConverter, + tkDiscard, tkDistinct, tkDiv, tkElif, tkElse, tkEnd, tkEnum, tkExcept, tkFinally, tkFor, tkFrom, tkGeneric, tkIf, tkImplies, tkImport, tkIn, @@ -71,8 +71,8 @@ type //[[[end]]] tkIntLit, tkInt8Lit, tkInt16Lit, tkInt32Lit, tkInt64Lit, tkFloatLit, tkFloat32Lit, tkFloat64Lit, - tkStrLit, tkRStrLit, tkTripleStrLit, tkCharLit, - tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, tkCurlyRi, + tkStrLit, tkRStrLit, tkTripleStrLit, tkCallRStrLit, tkCallTripleStrLit, + tkCharLit, tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, tkCurlyRi, tkBracketDotLe, tkBracketDotRi, // [. and .] tkCurlyDotLe, tkCurlyDotRi, // {. and .} tkParDotLe, tkParDotRi, // (. and .) @@ -96,10 +96,10 @@ const //[[[cog //cog.out(strings) //]]] - 'abstract', 'addr', 'and', 'as', - 'asm', 'bind', 'block', 'break', - 'case', 'cast', 'const', 'continue', - 'converter', 'discard', 'div', 'elif', + 'addr', 'and', 'as', 'asm', + 'bind', 'block', 'break', 'case', + 'cast', 'const', 'continue', 'converter', + 'discard', 'distinct', 'div', 'elif', 'else', 'end', 'enum', 'except', 'finally', 'for', 'from', 'generic', 'if', 'implies', 'import', 'in', @@ -115,7 +115,9 @@ const //[[[end]]] 'tkIntLit', 'tkInt8Lit', 'tkInt16Lit', 'tkInt32Lit', 'tkInt64Lit', 'tkFloatLit', 'tkFloat32Lit', 'tkFloat64Lit', - 'tkStrLit', 'tkRStrLit', 'tkTripleStrLit', 'tkCharLit', + 'tkStrLit', 'tkRStrLit', 'tkTripleStrLit', + 'tkCallRStrLit', 'tkCallTripleStrLit', + 'tkCharLit', '('+'', ')'+'', '['+'', ']'+'', '{'+'', '}'+'', '[.', '.]', '{.', '.}', '(.', '.)', ','+'', ';'+'', ':'+'', '='+'', '.'+'', '..', '^'+'', 'tkOpr', @@ -764,7 +766,12 @@ begin (tok.ident.id > ord(tokKeywordHigh)-ord(tkSymbol)) then tok.tokType := tkSymbol else - tok.tokType := TTokType(tok.ident.id+ord(tkSymbol)) + tok.tokType := TTokType(tok.ident.id+ord(tkSymbol)); + if buf[pos] = '"' then begin + getString(L, tok, true); + if tok.tokType = tkRStrLit then tok.tokType := tkCallRStrLit + else tok.tokType := tkCallTripleStrLit + end end; procedure getOperator(var L: TLexer; var tok: TToken); diff --git a/nim/sem.pas b/nim/sem.pas old mode 100644 new mode 100755 index 1fd141f5a..029ba869f --- a/nim/sem.pas +++ b/nim/sem.pas @@ -15,7 +15,7 @@ interface {$include 'config.inc'} uses - sysutils, nsystem, charsets, strutils, + sysutils, nsystem, charsets, strutils, nhashes, lists, options, scanner, ast, astalgo, trees, treetab, wordrecg, ropes, msgs, nos, condsyms, idents, rnimsyn, types, platform, nmath, magicsys, pnimsyn, nversion, nimsets, @@ -29,8 +29,6 @@ function semPass(): TPass; implementation -function semp(c: PContext; n: PNode): PNode; forward; - function considerAcc(n: PNode): PIdent; var x: PNode; @@ -47,6 +45,11 @@ begin end end; +function isTopLevel(c: PContext): bool; +begin + result := c.tab.tos <= 2 +end; + function newSymS(const kind: TSymKind; n: PNode; c: PContext): PSym; begin result := newSym(kind, considerAcc(n), getCurrOwner()); @@ -62,27 +65,32 @@ function semIdentWithPragma(c: PContext; kind: TSymKind; function semStmtScope(c: PContext; n: PNode): PNode; forward; type - TExprFlag = (efAllowType, efLValue); + TExprFlag = (efAllowType, efLValue, efWantIterator); TExprFlags = set of TExprFlag; function semExpr(c: PContext; n: PNode; flags: TExprFlags = {@set}[]): PNode; forward; function semExprWithType(c: PContext; n: PNode; flags: TExprFlags = {@set}[]): PNode; forward; +function fitNode(c: PContext; formal: PType; arg: PNode): PNode; forward; function semLambda(c: PContext; n: PNode): PNode; forward; function semTypeNode(c: PContext; n: PNode; prev: PType): PType; forward; function semStmt(c: PContext; n: PNode): PNode; forward; +procedure semParamList(c: PContext; n, genericParams: PNode; s: PSym); forward; +procedure addParams(c: PContext; n: PNode); forward; +procedure addResult(c: PContext; t: PType; const info: TLineInfo); forward; +procedure addResultNode(c: PContext; n: PNode); forward; + +function instGenericContainer(c: PContext; n: PNode; header: PType): PType; forward; function semConstExpr(c: PContext; n: PNode): PNode; -var - e: PNode; begin - e := semExprWithType(c, n); - if e = nil then begin + result := semExprWithType(c, n); + if result = nil then begin liMessage(n.info, errConstExprExpected); - result := nil; exit + exit end; - result := getConstExpr(c.module, e); + result := getConstExpr(c.module, result); if result = nil then liMessage(n.info, errConstExprExpected); end; @@ -105,24 +113,19 @@ begin end end; -function semAfterMacroCall(c: PContext; n, p: PNode): PNode; +function semAfterMacroCall(c: PContext; n: PNode; s: PSym): PNode; begin result := n; - if (p = nil) or (p.kind <> nkIdent) then - liMessage(n.info, errInvalidParamKindX, renderTree(p)) - else begin - case p.ident.id of - ord(wExpr): result := semExprWithType(c, result); - ord(wStmt): result := semStmt(c, result); - ord(wTypeDesc): - result.typ := semTypeNode(c, result, nil); - else - liMessage(p.info, errInvalidParamKindX, p.ident.s) - end + case s.typ.sons[0].kind of + tyExpr: result := semExprWithType(c, result); + tyStmt: result := semStmt(c, result); + tyTypeDesc: result.typ := semTypeNode(c, result, nil); + else liMessage(s.info, errInvalidParamKindX, typeToString(s.typ.sons[0])) end end; -function semMacroExpr(c: PContext; n: PNode; sym: PSym): PNode; +function semMacroExpr(c: PContext; n: PNode; sym: PSym; + semCheck: bool = true): PNode; var p: PEvalContext; s: PStackFrame; @@ -139,9 +142,8 @@ begin result := s.params[0]; popStackFrame(p); if cyclicTree(result) then liMessage(n.info, errCyclicTree); - result := semAfterMacroCall(c, result, sym.ast.sons[paramsPos].sons[0]); - // now, that was easy ... - // and we get more flexibility than in any other programming language + if semCheck then + result := semAfterMacroCall(c, result, sym); end; {$include 'semtempl.pas'} @@ -164,13 +166,9 @@ end; {$include 'semtypes.pas'} {$include 'semexprs.pas'} +{$include 'semgnrc.pas'} {$include 'semstmts.pas'} -function semp(c: PContext; n: PNode): PNode; -begin - result := semStmt(c, n); -end; - procedure addCodeForGenerics(c: PContext; n: PNode); var i: int; diff --git a/nim/semdata.pas b/nim/semdata.pas old mode 100644 new mode 100755 index acaffd3bf..37934f3d6 --- a/nim/semdata.pas +++ b/nim/semdata.pas @@ -42,24 +42,29 @@ type PContext = ^TContext; TContext = object(TPassContext) // a context represents a module - module: PSym; // the module sym belonging to the context - filename: string; // the module's filename - tab: TSymTab; // each module has its own symbol table - AmbiguousSymbols: TIntSet; // contains ids of all ambiguous symbols (cannot - // store this info in the syms themselves!) - generics: PNode; // a list of the things to compile; list of - // nkExprEqExpr nodes which contain the generic - // symbol and the instantiated symbol - converters: TSymSeq; // sequence of converters + module: PSym; // the module sym belonging to the context + p: PProcCon; // procedure context + InstCounter: int; // to prevent endless instantiations + generics: PNode; // a list of the things to compile; list of + // nkExprEqExpr nodes which contain the + // generic symbol and the instantiated symbol + lastGenericIdx: int; // used for the generics stack + tab: TSymTab; // each module has its own symbol table + AmbiguousSymbols: TIntSet; // ids of all ambiguous symbols (cannot + // store this info in the syms themselves!) + converters: TSymSeq; // sequence of converters optionStack: TLinkedList; - libs: TLinkedList; // all libs used by this module - p: PProcCon; // procedure context - fromCache: bool; // is the module read from a cache? - lastGenericIdx: int; // used for the generics stack + libs: TLinkedList; // all libs used by this module + fromCache: bool; // is the module read from a cache? semConstExpr: function (c: PContext; n: PNode): PNode; // for the pragmas module + includedFiles: TIntSet; // used to detect recursive include files + filename: string; // the module's filename end; +var + gInstTypes: TIdTable; // map PType to PType + function newContext(module: PSym; const nimfile: string): PContext; function newProcCon(owner: PSym): PProcCon; @@ -164,6 +169,7 @@ begin result.generics := newNode(nkStmtList); {@emit result.converters := @[];} result.filename := nimfile; + IntSetInit(result.includedFiles); end; procedure addConverter(c: PContext; conv: PSym); @@ -255,4 +261,6 @@ begin if (n = nil) or (sonsLen(n) < len) then illFormedAst(n); end; +initialization + initIdTable(gInstTypes); end. diff --git a/nim/semexprs.pas b/nim/semexprs.pas old mode 100644 new mode 100755 index de37295b7..2fd0d6843 --- a/nim/semexprs.pas +++ b/nim/semexprs.pas @@ -10,6 +10,17 @@ // this module does the semantic checking for expressions +function semTemplateExpr(c: PContext; n: PNode; s: PSym; + semCheck: bool = true): PNode; +begin + include(s.flags, sfUsed); + pushInfoContext(n.info); + result := evalTemplate(c, n, s); + if semCheck then + result := semAfterMacroCall(c, result, s); + popInfoContext(); +end; + function semDotExpr(c: PContext; n: PNode; flags: TExprFlags = {@set}[]): PNode; forward; @@ -79,8 +90,8 @@ begin // we use d, s here to speed up that operation a bit: case cmpTypes(d, s) of isNone, isGeneric: begin - if not equalOrAbstractOf(castDest, src) and - not equalOrAbstractOf(src, castDest) then + if not equalOrDistinctOf(castDest, src) and + not equalOrDistinctOf(src, castDest) then liMessage(info, errGenerated, format(MsgKindToString(errIllegalConvFromXtoY), [typeToString(src), typeToString(castDest)])); @@ -457,15 +468,21 @@ begin n.sons[i] := analyseIfAddressTaken(c, n.sons[i]); end; -function semDirectCallAnalyseEffects(c: PContext; n: PNode): PNode; +function semDirectCallAnalyseEffects(c: PContext; n: PNode; + flags: TExprFlags): PNode; var callee: PSym; begin - result := semDirectCall(c, n); + if not (efWantIterator in flags) then + result := semDirectCall(c, n, {@set}[skProc, skConverter]) + else + result := semDirectCall(c, n, {@set}[skIterator]); if result <> nil then begin if result.sons[0].kind <> nkSym then InternalError('semDirectCallAnalyseEffects'); callee := result.sons[0].sym; + if (callee.kind = skIterator) and (callee.id = c.p.owner.id) then + liMessage(n.info, errRecursiveDependencyX, callee.name.s); if not (sfNoSideEffect in callee.flags) then if (sfForward in callee.flags) or ([sfImportc, sfSideEffect] * callee.flags <> []) then @@ -473,12 +490,13 @@ begin end end; -function semIndirectOp(c: PContext; n: PNode): PNode; +function semIndirectOp(c: PContext; n: PNode; flags: TExprFlags): PNode; var m: TCandidate; msg: string; i: int; prc: PNode; + t: PType; begin result := nil; prc := n.sons[0]; @@ -496,13 +514,12 @@ begin end end; else n.sons[0] := semExpr(c, n.sons[0]); - end; - if n.sons[0].typ = nil then - liMessage(n.sons[0].info, errExprXHasNoType, - renderTree(n.sons[0], {@set}[renderNoComments])); + end; semOpAux(c, n); - if (n.sons[0].typ <> nil) and (n.sons[0].typ.kind = tyProc) then begin - initCandidate(m, n.sons[0].typ); + if (n.sons[0].typ <> nil) then t := skipTypes(n.sons[0].typ, abstractInst) + else t := nil; + if (t <> nil) and (t.kind = tyProc) then begin + initCandidate(m, t); matches(c, n, m); if m.state <> csMatch then begin msg := msgKindToString(errTypeMismatch); @@ -519,7 +536,8 @@ begin result := m.call; // we assume that a procedure that calls something indirectly // has side-effects: - include(c.p.owner.flags, sfSideEffect); + if not (tfNoSideEffect in t.flags) then + include(c.p.owner.flags, sfSideEffect); end else begin result := overloadedCallOpr(c, n); @@ -527,7 +545,7 @@ begin // the old ``prc`` (which is likely an nkIdent) has to be restored: if result = nil then begin n.sons[0] := prc; - result := semDirectCallAnalyseEffects(c, n); + result := semDirectCallAnalyseEffects(c, n, flags); end; if result = nil then liMessage(n.info, errExprXCannotBeCalled, @@ -537,11 +555,11 @@ begin analyseIfAddressTakenInCall(c, result); end; -function semDirectOp(c: PContext; n: PNode): PNode; +function semDirectOp(c: PContext; n: PNode; flags: TExprFlags): PNode; begin // this seems to be a hotspot in the compiler! semOpAux(c, n); - result := semDirectCallAnalyseEffects(c, n); + result := semDirectCallAnalyseEffects(c, n, flags); if result = nil then begin result := overloadedCallOpr(c, n); if result = nil then @@ -624,18 +642,19 @@ begin n.sons[0].info := n.info; end; -function semMagic(c: PContext; n: PNode; s: PSym): PNode; +function semMagic(c: PContext; n: PNode; s: PSym; flags: TExprFlags): PNode; // this is a hotspot in the compiler! begin result := n; case s.magic of // magics that need special treatment mDefined: result := semDefined(c, setMs(n, s)); + mDefinedInScope: result := semDefinedInScope(c, setMs(n, s)); mLow: result := semLowHigh(c, setMs(n, s), mLow); mHigh: result := semLowHigh(c, setMs(n, s), mHigh); mSizeOf: result := semSizeof(c, setMs(n, s)); mIs: result := semIs(c, setMs(n, s)); mEcho: result := semEcho(c, setMs(n, s)); - else result := semDirectOp(c, n); + else result := semDirectOp(c, n, flags); end; end; @@ -644,67 +663,6 @@ begin if sfDeprecated in s.flags then liMessage(n.info, warnDeprecated, s.name.s); end; -function semSym(c: PContext; n: PNode; s: PSym; flags: TExprFlags): PNode; -begin - if (s.kind = skType) and not (efAllowType in flags) then - liMessage(n.info, errATypeHasNoValue); - case s.kind of - skProc, skIterator, skConverter: begin - if (s.magic <> mNone) then - liMessage(n.info, errInvalidContextForBuiltinX, s.name.s); - result := symChoice(c, n, s); - end; - skConst: begin - (* - Consider:: - const x = [] - proc p(a: openarray[int], i: int) - proc q(a: openarray[char], c: char) - p(x, 0) - q(x, '\0') - - It is clear that ``[]`` means two totally different things. Thus, we - copy `x`'s AST into each context, so that the type fixup phase can - deal with two different ``[]``. - *) - include(s.flags, sfUsed); - if s.typ.kind in ConstAbstractTypes then begin - result := copyTree(s.ast); - result.info := n.info; - result.typ := s.typ; - end - else begin - result := newSymNode(s); - result.info := n.info; - end - end; - skMacro: begin - include(s.flags, sfUsed); - result := semMacroExpr(c, n, s); - end; - skTemplate: begin - include(s.flags, sfUsed); - // Templates and macros can be invoked without ``()`` - pushInfoContext(n.info); - result := evalTemplate(c, n, s); - popInfoContext(); - end; - skVar: begin - include(s.flags, sfUsed); - // if a proc accesses a global variable, it is not side effect free - if sfGlobal in s.flags then include(c.p.owner.flags, sfSideEffect); - result := newSymNode(s); - result.info := n.info; - end; - else begin - include(s.flags, sfUsed); - result := newSymNode(s); - result.info := n.info; - end - end; - checkDeprecated(n, s); -end; - function isTypeExpr(n: PNode): bool; begin case n.kind of @@ -797,12 +755,12 @@ var t: PType; a: PNode; begin - t := n.typ; + t := skipTypes(n.typ, {@set}[tyGenericInst]); result := n; if t.kind = tyVar then begin result := newNodeIT(nkHiddenDeref, n.info, t.sons[0]); addSon(result, n); - t := t.sons[0]; + t := skipTypes(t.sons[0], {@set}[tyGenericInst]); end; if t.kind in [tyPtr, tyRef] then begin a := result; @@ -830,7 +788,7 @@ begin // look up if the identifier belongs to the enum: while (ty <> nil) do begin f := getSymFromList(ty.n, i); - if f <> nil then breaK; + if f <> nil then break; ty := ty.sons[0]; // enum inheritance end; if f <> nil then begin @@ -891,7 +849,7 @@ begin // --> replace("", ...) f := SymTabGet(c.tab, i); //if (f <> nil) and (f.kind = skStub) then loadStub(f); - // XXX ``loadStub`` is not correct here as we don't care for ``f`` really + // ``loadStub`` is not correct here as we don't care for ``f`` really if (f <> nil) then begin // BUGFIX: do not check for (f.kind in [skProc, skIterator]) here result := newNodeI(nkDotCall, n.info); @@ -1168,24 +1126,13 @@ begin Dec(c.p.nestedBlockCounter); end; -function semDotExpr(c: PContext; n: PNode; flags: TExprFlags): PNode; -var - s: PSym; -begin - s := qualifiedLookup(c, n, true); // check for ambiguity - if s <> nil then - result := semSym(c, n, s, flags) - else - // this is a test comment; please don't touch it - result := semFieldAccess(c, n, flags); -end; - function isCallExpr(n: PNode): bool; begin - result := n.kind in [nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand]; + result := n.kind in [nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, + nkCallStrLit]; end; -function semMacroStmt(c: PContext; n: PNode): PNode; +function semMacroStmt(c: PContext; n: PNode; semCheck: bool = true): PNode; var s: PSym; a: PNode; @@ -1200,9 +1147,8 @@ begin if (s <> nil) then begin checkDeprecated(n, s); case s.kind of - skMacro: result := semMacroExpr(c, n, s); + skMacro: result := semMacroExpr(c, n, s, semCheck); skTemplate: begin - include(s.flags, sfUsed); // transform // nkMacroStmt(nkCall(a...), stmt, b...) // to @@ -1213,11 +1159,8 @@ begin for i := 1 to sonsLen(n.sons[0])-1 do addSon(result, n.sons[0].sons[i]); end; - for i := 1 to sonsLen(n)-1 do - addSon(result, n.sons[i]); - pushInfoContext(n.info); - result := evalTemplate(c, result, s); - popInfoContext(); + for i := 1 to sonsLen(n)-1 do addSon(result, n.sons[i]); + result := semTemplateExpr(c, result, s, semCheck); end; else liMessage(n.info, errXisNoMacroOrTemplate, s.name.s); @@ -1228,9 +1171,78 @@ begin renderTree(a, {@set}[renderNoComments])); end; +function semSym(c: PContext; n: PNode; s: PSym; flags: TExprFlags): PNode; +begin + if (s.kind = skType) and not (efAllowType in flags) then + liMessage(n.info, errATypeHasNoValue); + case s.kind of + skProc, skIterator, skConverter: begin + if (s.magic <> mNone) then + liMessage(n.info, errInvalidContextForBuiltinX, s.name.s); + result := symChoice(c, n, s); + end; + skConst: begin + (* + Consider:: + const x = [] + proc p(a: openarray[int]) + proc q(a: openarray[char]) + p(x) + q(x) + + It is clear that ``[]`` means two totally different things. Thus, we + copy `x`'s AST into each context, so that the type fixup phase can + deal with two different ``[]``. + *) + include(s.flags, sfUsed); + if s.typ.kind in ConstAbstractTypes then begin + result := copyTree(s.ast); + result.info := n.info; + result.typ := s.typ; + end + else begin + result := newSymNode(s); + result.info := n.info; + end + end; + skMacro: result := semMacroExpr(c, n, s); + skTemplate: result := semTemplateExpr(c, n, s); + skVar: begin + include(s.flags, sfUsed); + // if a proc accesses a global variable, it is not side effect free + if sfGlobal in s.flags then include(c.p.owner.flags, sfSideEffect); + result := newSymNode(s); + result.info := n.info; + end; + skGenericParam: begin + if s.ast = nil then InternalError(n.info, 'no default for'); + result := semExpr(c, s.ast); + end + else begin + include(s.flags, sfUsed); + result := newSymNode(s); + result.info := n.info; + end + end; + checkDeprecated(n, s); +end; + +function semDotExpr(c: PContext; n: PNode; flags: TExprFlags): PNode; +var + s: PSym; +begin + s := qualifiedLookup(c, n, true); // check for ambiguity + if s <> nil then + result := semSym(c, n, s, flags) + else + // this is a test comment; please don't touch it + result := semFieldAccess(c, n, flags); +end; + function semExpr(c: PContext; n: PNode; flags: TExprFlags = {@set}[]): PNode; var s: PSym; + t: PType; begin result := n; if n = nil then exit; @@ -1242,13 +1254,16 @@ begin result := semSym(c, n, s, flags); end; nkSym: begin - s := n.sym; + (*s := n.sym; include(s.flags, sfUsed); if (s.kind = skType) and not (efAllowType in flags) then liMessage(n.info, errATypeHasNoValue); if (s.magic <> mNone) and (s.kind in [skProc, skIterator, skConverter]) then - liMessage(n.info, errInvalidContextForBuiltinX, s.name.s); + liMessage(n.info, errInvalidContextForBuiltinX, s.name.s); *) + // because of the changed symbol binding, this does not mean that we + // don't have to check the symbol for semantics here again! + result := semSym(c, n, n.sym, flags); end; nkEmpty, nkNone: begin end; nkNilLit: result.typ := getSysType(tyNil); @@ -1276,7 +1291,7 @@ begin end; end; nkBind: result := semExpr(c, n.sons[0], flags); - nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand: begin + nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: begin // check if it is an expression macro: checkMinSonsLen(n, 1); s := qualifiedLookup(c, n.sons[0], false); @@ -1284,26 +1299,28 @@ begin checkDeprecated(n, s); case s.kind of skMacro: result := semMacroExpr(c, n, s); - skTemplate: begin - include(s.flags, sfUsed); - pushInfoContext(n.info); - result := evalTemplate(c, n, s); - popInfoContext(); - end; + skTemplate: result := semTemplateExpr(c, n, s); skType: begin include(s.flags, sfUsed); if n.kind <> nkCall then liMessage(n.info, errXisNotCallable, s.name.s); + // XXX does this check make any sense? result := semConv(c, n, s); end; skProc, skConverter, skIterator: begin - if s.magic = mNone then result := semDirectOp(c, n) - else result := semMagic(c, n, s); + if s.magic = mNone then result := semDirectOp(c, n, flags) + else result := semMagic(c, n, s, flags); end; - else result := semIndirectOp(c, n) + else begin + //liMessage(n.info, warnUser, renderTree(n)); + result := semIndirectOp(c, n, flags) + end end end - else result := semIndirectOp(c, n); + else if n.sons[0].kind = nkSymChoice then + result := semDirectOp(c, n, flags) + else + result := semIndirectOp(c, n, flags); end; nkMacroStmt: begin result := semMacroStmt(c, n); @@ -1341,8 +1358,9 @@ begin checkSonsLen(n, 1); n.sons[0] := semExprWithType(c, n.sons[0]); result := n; - case skipTypes(n.sons[0].typ, {@set}[tyGenericInst, tyVar]).kind of - tyRef, tyPtr: n.typ := n.sons[0].typ.sons[0]; + t := skipTypes(n.sons[0].typ, {@set}[tyGenericInst, tyVar]); + case t.kind of + tyRef, tyPtr: n.typ := t.sons[0]; else liMessage(n.sons[0].info, errCircumNeedsPointer); end; result := n; diff --git a/nim/semfold.pas b/nim/semfold.pas old mode 100644 new mode 100755 index 556dabe9b..acca84c71 --- a/nim/semfold.pas +++ b/nim/semfold.pas @@ -417,7 +417,7 @@ begin end; nkCharLit..nkNilLit: result := copyNode(n); nkIfExpr: result := getConstIfExpr(module, n); - nkCall, nkCommand: begin + nkCall, nkCommand, nkCallStrLit: begin if (n.sons[0].kind <> nkSym) then exit; s := n.sons[0].sym; if (s.kind <> skProc) then exit; diff --git a/nim/seminst.pas b/nim/seminst.pas old mode 100644 new mode 100755 index a49d8478e..6a6f272de --- a/nim/seminst.pas +++ b/nim/seminst.pas @@ -1,7 +1,7 @@ // // // The Nimrod Compiler -// (c) Copyright 2008 Andreas Rumpf +// (c) Copyright 2009 Andreas Rumpf // // See the file "copying.txt", included in this // distribution, for details about the copyright. @@ -10,24 +10,38 @@ // This module does the instantiation of generic procs and types. function generateInstance(c: PContext; fn: PSym; const pt: TIdTable; - const instantiator: TLineInfo): PSym; forward; + const info: TLineInfo): PSym; forward; // generates an instantiated proc -type - TInstantiateClosure = object(NObject) - typeMap: TIdTable; // map PType to PType - symMap: TIdTable; // map PSym to PSym - fn: PSym; - module: PSym; - //newOwner: PSym; - instantiator: TLineInfo; - end; - PInstantiateClosure = ^TInstantiateClosure; - PInstClosure = PInstantiateClosure; -function instantiateTree(c: PInstantiateClosure; t: PNode): PNode; forward; -function instantiateSym(c: PInstantiateClosure; sym: PSym): PSym; forward; -function instantiateType(c: PInstantiateClosure; typ: PType): PType; forward; +function searchInstTypes(const tab: TIdTable; key: PType): PType; +var + t: PType; + h: THash; + j: int; + match: bool; +begin // returns nil if we need to declare this type + result := PType(IdTableGet(tab, key)); + if (result = nil) and (tab.counter > 0) then begin + // we have to do a slow linear search because types may need + // to be compared by their structure: + for h := 0 to high(tab.data) do begin + t := PType(tab.data[h].key); + if t <> nil then begin + if key.containerId = t.containerID then begin + match := true; + for j := 0 to sonsLen(t) - 1 do begin + // XXX sameType is not really correct for nested generics? + if not sameType(t.sons[j], key.sons[j]) then begin + match := false; break + end + end; + if match then begin result := PType(tab.data[h].val); exit end; + end + end + end + end +end; function containsGenericTypeIter(t: PType; closure: PObject): bool; begin @@ -39,73 +53,7 @@ begin result := iterOverType(t, containsGenericTypeIter, nil); end; -function instTypeNode(c: PInstantiateClosure; n: PNode): PNode; -var - i: int; -begin - result := nil; - if n <> nil then begin - result := copyNode(n); - result.typ := instantiateType(c, n.typ); - case n.kind of - nkNone..nkNilLit: begin // a leaf - end; - else begin - for i := 0 to sonsLen(n)-1 do - addSon(result, instTypeNode(c, n.sons[i])); - end - end - end -end; - -procedure genericToConcreteTypeKind(t: PType); -var - body: PNode; -begin - if (t.kind = tyGeneric) and (t.sym <> nil) then begin - body := t.sym.ast.sons[2]; - case body.kind of - nkObjectTy: t.kind := tyObject; - nkTupleTy: t.kind := tyTuple; - nkRefTy: t.kind := tyRef; - nkPtrTy: t.kind := tyPtr; - nkVarTy: t.kind := tyVar; - nkProcTy: t.kind := tyProc; - else InternalError('genericToConcreteTypeKind'); - end - end -end; - -function instantiateType(c: PInstantiateClosure; typ: PType): PType; -var - i: int; -begin - if typ = nil then begin result := nil; exit end; - result := PType(idTableGet(c.typeMap, typ)); - if result <> nil then exit; - //if typ.kind = tyOpenArray then - // liMessage(c.instantiator, warnUser, 'instantiating type for: openarray'); - if containsGenericType(typ) then begin - result := copyType(typ, typ.owner, false); - idTablePut(c.typeMap, typ, result); // to avoid cycles - for i := 0 to sonsLen(result)-1 do - result.sons[i] := instantiateType(c, result.sons[i]); - if result.n <> nil then - result.n := instTypeNode(c, result.n); - genericToConcreteTypeKind(result); - end - else - result := typ; - if result.Kind in GenericTypes then begin - liMessage(c.instantiator, errCannotInstantiateX, - TypeToString(typ, preferName)); - end - else if result.kind = tyVar then begin - if result.sons[0].kind = tyVar then - liMessage(c.instantiator, errVarVarTypeNotAllowed); - end; -end; - +(* function instantiateSym(c: PInstantiateClosure; sym: PSym): PSym; begin if sym = nil then begin result := nil; exit end; // BUGFIX @@ -128,56 +76,31 @@ begin result := sym // do not copy t! end end; +*) -function instantiateTree(c: PInstantiateClosure; t: PNode): PNode; -var - len, i: int; -begin - if t = nil then begin result := nil; exit end; - result := copyNode(t); - if result.typ <> nil then result.typ := instantiateType(c, result.typ); - case t.kind of - nkNone..pred(nkSym), succ(nkSym)..nkNilLit: begin end; - nkSym: begin - if result.sym <> nil then result.sym := instantiateSym(c, result.sym); - end - else begin - len := sonsLen(t); - if len > 0 then begin - newSons(result, len); - for i := 0 to len-1 do - result.sons[i] := instantiateTree(c, t.sons[i]); - end - end - end -end; - -procedure instantiateGenericParamList(c: PContext; n: PNode; - const pt: TIdTable); +procedure instantiateGenericParamList(c: PContext; n: PNode; const pt: TIdTable); var i: int; s, q: PSym; t: PType; + a: PNode; begin if (n.kind <> nkGenericParams) then - InternalError(n.info, 'instantiateGenericParamList'); + InternalError(n.info, 'instantiateGenericParamList; no generic params'); for i := 0 to sonsLen(n)-1 do begin - if n.sons[i].kind = nkDefaultTypeParam then begin - internalError(n.sons[i].info, - 'instantiateGenericParamList() to implement'); - // XXX - end; - if (n.sons[i].kind <> nkSym) then - InternalError(n.info, 'instantiateGenericParamList'); - q := n.sons[i].sym; + a := n.sons[i]; + if a.kind <> nkSym then + InternalError(a.info, 'instantiateGenericParamList; no symbol'); + q := a.sym; + if not (q.typ.kind in [tyTypeDesc, tyGenericParam]) then continue; s := newSym(skType, q.name, getCurrOwner()); t := PType(IdTableGet(pt, q.typ)); - if t = nil then - liMessage(n.sons[i].info, errCannotInstantiateX, s.name.s); - if (t.kind = tyGenericParam) then - InternalError(n.info, 'instantiateGenericParamList'); + if t = nil then liMessage(a.info, errCannotInstantiateX, s.name.s); + if (t.kind = tyGenericParam) then begin + InternalError(a.info, 'instantiateGenericParamList: ' + q.name.s); + end; s.typ := t; - addDecl(c, s); + addDecl(c, s) end end; @@ -212,25 +135,24 @@ begin addSon(c.generics, n); end; -procedure semParamList(c: PContext; n: PNode; s: PSym); forward; -procedure addParams(c: PContext; n: PNode); forward; -procedure addResult(c: PContext; t: PType; const info: TLineInfo); forward; -procedure addResultNode(c: PContext; n: PNode); forward; - function generateInstance(c: PContext; fn: PSym; const pt: TIdTable; - const instantiator: TLineInfo): PSym; + const info: TLineInfo): PSym; // generates an instantiated proc var - oldPrc: PSym; + oldPrc, oldMod: PSym; oldP: PProcCon; n: PNode; begin + if c.InstCounter > 1000 then InternalError(fn.ast.info, 'nesting too deep'); + inc(c.InstCounter); oldP := c.p; // restore later + // NOTE: for access of private fields within generics from a different module + // and other identifiers we fake the current module temporarily! + oldMod := c.module; + c.module := getModule(fn); result := copySym(fn, false); include(result.flags, sfFromGeneric); - //include(fn.flags, sfFromGeneric); result.owner := getCurrOwner().owner; - //idTablePut(c.mapping, fn, result); n := copyTree(fn.ast); result.ast := n; pushOwner(result); @@ -238,13 +160,13 @@ begin if (n.sons[genericParamsPos] = nil) then InternalError(n.info, 'generateInstance'); n.sons[namePos] := newSymNode(result); - pushInfoContext(instantiator); + pushInfoContext(info); instantiateGenericParamList(c, n.sons[genericParamsPos], pt); n.sons[genericParamsPos] := nil; // semantic checking for the parameters: if n.sons[paramsPos] <> nil then begin - semParamList(c, n.sons[ParamsPos], result); + semParamList(c, n.sons[ParamsPos], nil, result); addParams(c, result.typ.n); end else begin @@ -256,6 +178,7 @@ begin oldPrc := GenericCacheGet(c, fn, result); if oldPrc = nil then begin // add it here, so that recursive generic procs are possible: + GenericCacheAdd(c, fn, result); addDecl(c, result); if n.sons[codePos] <> nil then begin c.p := newProcCon(result); @@ -264,8 +187,7 @@ begin addResultNode(c, n); end; n.sons[codePos] := semStmtScope(c, n.sons[codePos]); - end; - GenericCacheAdd(c, fn, result); + end end else result := oldPrc; @@ -273,37 +195,168 @@ begin closeScope(c.tab); // close scope for parameters popOwner(); c.p := oldP; // restore + c.module := oldMod; + dec(c.InstCounter); +end; + +procedure checkConstructedType(const info: TLineInfo; t: PType); +begin + if (tfAcyclic in t.flags) + and (skipTypes(t, abstractInst).kind <> tyObject) then + liMessage(info, errInvalidPragmaX, 'acyclic'); + if computeSize(t) < 0 then + liMessage(info, errIllegalRecursionInTypeX, typeToString(t)); + if (t.kind = tyVar) and (t.sons[0].kind = tyVar) then + liMessage(info, errVarVarTypeNotAllowed); +end; + +type + TReplTypeVars = record + c: PContext; + typeMap: TIdTable; // map PType to PType + symMap: TIdTable; // map PSym to PSym + info: TLineInfo; + end; + +function ReplaceTypeVarsT(var cl: TReplTypeVars; t: PType): PType; forward; +function ReplaceTypeVarsS(var cl: TReplTypeVars; s: PSym): PSym; forward; + +function ReplaceTypeVarsN(var cl: TReplTypeVars; n: PNode): PNode; +var + i, Len: int; +begin + result := nil; + if n <> nil then begin + result := copyNode(n); + result.typ := ReplaceTypeVarsT(cl, n.typ); + case n.kind of + nkNone..pred(nkSym), succ(nkSym)..nkNilLit: begin end; + nkSym: begin + result.sym := ReplaceTypeVarsS(cl, n.sym); + end; + else begin + len := sonsLen(n); + if len > 0 then begin + newSons(result, len); + for i := 0 to len-1 do + result.sons[i] := ReplaceTypeVarsN(cl, n.sons[i]); + end + end + end + end +end; + +function ReplaceTypeVarsS(var cl: TReplTypeVars; s: PSym): PSym; +begin + if s = nil then begin result := nil; exit end; + result := PSym(idTableGet(cl.symMap, s)); + if (result = nil) then begin + result := copySym(s, false); + include(result.flags, sfFromGeneric); + idTablePut(cl.symMap, s, result); + result.typ := ReplaceTypeVarsT(cl, s.typ); + result.owner := s.owner; + result.ast := ReplaceTypeVarsN(cl, s.ast); + end +end; + +function lookupTypeVar(cl: TReplTypeVars; t: PType): PType; +begin + result := PType(idTableGet(cl.typeMap, t)); + if result = nil then + liMessage(t.sym.info, errCannotInstantiateX, typeToString(t)) + else if result.kind = tyGenericParam then + InternalError(cl.info, 'substitution with generic parameter'); +end; + +function ReplaceTypeVarsT(var cl: TReplTypeVars; t: PType): PType; +var + i: int; + body, newbody, x, header: PType; +begin + result := t; + if t = nil then exit; + case t.kind of + tyGenericParam: begin + result := lookupTypeVar(cl, t); + end; + tyGenericInvokation: begin + body := t.sons[0]; + if body.kind <> tyGenericBody then + InternalError(cl.info, 'no generic body'); + header := nil; + for i := 1 to sonsLen(t)-1 do begin + if t.sons[i].kind = tyGenericParam then begin + x := lookupTypeVar(cl, t.sons[i]); + if header = nil then header := copyType(t, t.owner, false); + header.sons[i] := x; + end + else + x := t.sons[i]; + idTablePut(cl.typeMap, body.sons[i-1], x); + end; + // cycle detection: + if header = nil then header := t; + result := searchInstTypes(gInstTypes, header); + if result <> nil then exit; + + result := newType(tyGenericInst, t.sons[0].owner); + for i := 0 to sonsLen(t)-1 do begin + // if one of the params is not concrete, we cannot do anything + // but we already raised an error! + addSon(result, header.sons[i]); + end; + // add these before recursive calls: + idTablePut(gInstTypes, header, result); + + newbody := ReplaceTypeVarsT(cl, lastSon(body)); + newbody.n := ReplaceTypeVarsN(cl, lastSon(body).n); + addSon(result, newbody); + //writeln(output, ropeToStr(Typetoyaml(newbody))); + checkConstructedType(cl.info, newbody); + end; + tyGenericBody: begin + InternalError(cl.info, 'ReplaceTypeVarsT: tyGenericBody'); + result := ReplaceTypeVarsT(cl, lastSon(t)); + end + else begin + if containsGenericType(t) then begin + result := copyType(t, t.owner, false); + for i := 0 to sonsLen(result)-1 do + result.sons[i] := ReplaceTypeVarsT(cl, result.sons[i]); + result.n := ReplaceTypeVarsN(cl, result.n); + if result.Kind in GenericTypes then + liMessage(cl.info, errCannotInstantiateX, TypeToString(t, preferName)); + //writeln(output, ropeToStr(Typetoyaml(result))); + //checkConstructedType(cl.info, result); + end + end + end +end; + +function instGenericContainer(c: PContext; n: PNode; header: PType): PType; +var + cl: TReplTypeVars; +begin + InitIdTable(cl.symMap); + InitIdTable(cl.typeMap); + cl.info := n.info; + cl.c := c; + result := ReplaceTypeVarsT(cl, header); end; function generateTypeInstance(p: PContext; const pt: TIdTable; - const instantiator: TLineInfo; t: PType): PType; + arg: PNode; t: PType): PType; var - c: PInstantiateClosure; + cl: TReplTypeVars; begin - new(c); -{@ignore} - fillChar(c^, sizeof(c^), 0); -{@emit} - copyIdTable(c.typeMap, pt); - InitIdTable(c.symMap); - c.fn := nil; - c.instantiator := instantiator; - c.module := p.module; - result := instantiateType(c, t); -end; - -function newInstantiateClosure(p: PContext; - const instantiator: TLineInfo): PInstantiateClosure; -begin - new(result); -{@ignore} - fillChar(result^, sizeof(result^), 0); -{@emit} - InitIdTable(result.typeMap); - InitIdTable(result.symMap); - result.fn := nil; - result.instantiator := instantiator; - result.module := p.module; + InitIdTable(cl.symMap); + copyIdTable(cl.typeMap, pt); + cl.info := arg.info; + cl.c := p; + pushInfoContext(arg.info); + result := ReplaceTypeVarsT(cl, t); + popInfoContext(); end; function partialSpecialization(c: PContext; n: PNode; s: PSym): PNode; diff --git a/nim/semstmts.pas b/nim/semstmts.pas old mode 100644 new mode 100755 index 686ff775d..efbee6da8 --- a/nim/semstmts.pas +++ b/nim/semstmts.pas @@ -9,11 +9,6 @@ // this module does the semantic checking of statements -function isTopLevel(c: PContext): bool; -begin - result := c.tab.tos <= 2 -end; - function semWhen(c: PContext; n: PNode): PNode; var i: int; @@ -71,7 +66,7 @@ begin end; else illFormedAst(n) end - end; + end end; function semDiscard(c: PContext; n: PNode): PNode; @@ -90,19 +85,19 @@ begin result := n; checkSonsLen(n, 1); if n.sons[0] <> nil then begin - if n.sons[0].kind = nkIdent then begin - // lookup the symbol: - s := lookUp(c, n.sons[0]); - if (s.kind = skLabel) and (s.owner.id = c.p.owner.id) then begin - x := newSymNode(s); - x.info := n.info; - include(s.flags, sfUsed); - n.sons[0] := x - end - else - liMessage(n.info, errInvalidControlFlowX, s.name.s) + case n.sons[0].kind of + nkIdent: s := lookUp(c, n.sons[0]); + nkSym: s := n.sons[0].sym; + else illFormedAst(n) + end; + if (s.kind = skLabel) and (s.owner.id = c.p.owner.id) then begin + x := newSymNode(s); + x.info := n.info; + include(s.flags, sfUsed); + n.sons[0] := x end - else illFormedAst(n) + else + liMessage(n.info, errInvalidControlFlowX, s.name.s) end else if (c.p.nestedLoopCounter <= 0) and (c.p.nestedBlockCounter <= 0) then liMessage(n.info, errInvalidControlFlowX, @@ -257,7 +252,7 @@ begin addSon(result, newIdentNode(getIdent(id.s+'='), n.info)); addSon(result, semExpr(c, a.sons[0])); addSon(result, semExpr(c, n.sons[1])); - result := semDirectCallAnalyseEffects(c, result); + result := semDirectCallAnalyseEffects(c, result, {@set}[]); if result <> nil then begin fixAbstractType(c, result); analyseIfAddressTakenInCall(c, result); @@ -277,7 +272,7 @@ begin addSonIfNotNil(result, semExpr(c, a.sons[1].sons[0])); addSonIfNotNil(result, semExpr(c, a.sons[1].sons[1])); addSon(result, semExpr(c, n.sons[1])); - result := semDirectCallAnalyseEffects(c, result); + result := semDirectCallAnalyseEffects(c, result, {@set}[]); if result <> nil then begin fixAbstractType(c, result); analyseIfAddressTakenInCall(c, result); @@ -289,7 +284,7 @@ begin addSon(result, semExpr(c, a.sons[0])); addSon(result, semExpr(c, a.sons[1])); addSon(result, semExpr(c, n.sons[1])); - result := semDirectCallAnalyseEffects(c, result); + result := semDirectCallAnalyseEffects(c, result, {@set}[]); if result <> nil then begin fixAbstractType(c, result); analyseIfAddressTakenInCall(c, result); @@ -355,8 +350,7 @@ var begin result := n; checkSonsLen(n, 1); - if (c.p.owner = nil) or (c.p.owner.kind <> skIterator) - or (c.p.nestedLoopCounter <= 0) then + if (c.p.owner = nil) or (c.p.owner.kind <> skIterator) then liMessage(n.info, errYieldNotAllowedHere); if (n.sons[0] <> nil) then begin n.sons[0] := SemExprWithType(c, n.sons[0]); @@ -409,13 +403,20 @@ begin end else def := nil; - if not typeAllowed(typ, skVar) then + if not typeAllowed(typ, skVar) then begin + //debug(typ); liMessage(a.info, errXisNoType, typeToString(typ)); + end; tup := skipTypes(typ, {@set}[tyGenericInst]); if a.kind = nkVarTuple then begin if tup.kind <> tyTuple then liMessage(a.info, errXExpected, 'tuple'); if len-2 <> sonsLen(tup) then liMessage(a.info, errWrongNumberOfVariables); + b := newNodeI(nkVarTuple, a.info); + newSons(b, len); + b.sons[len-2] := nil; // no type desc + b.sons[len-1] := def; + addSon(result, b); end; for j := 0 to len-3 do begin if (c.p.owner.kind = skModule) then begin @@ -424,16 +425,21 @@ begin end else v := semIdentWithPragma(c, skVar, a.sons[j], {@set}[]); - if a.kind <> nkVarTuple then v.typ := typ - else v.typ := tup.sons[j]; if v.flags * [sfStar, sfMinus] <> {@set}[] then include(v.flags, sfInInterface); addInterfaceDecl(c, v); - b := newNodeI(nkIdentDefs, a.info); - addSon(b, newSymNode(v)); - addSon(b, nil); // no type description - addSon(b, copyTree(def)); - addSon(result, b); + if a.kind <> nkVarTuple then begin + v.typ := typ; + b := newNodeI(nkIdentDefs, a.info); + addSon(b, newSymNode(v)); + addSon(b, nil); // no type description + addSon(b, copyTree(def)); + addSon(result, b); + end + else begin + v.typ := tup.sons[j]; + b.sons[j] := newSymNode(v); + end end end end; @@ -485,9 +491,9 @@ end; function semFor(c: PContext; n: PNode): PNode; var i, len: int; - v: PSym; + v, countup: PSym; iter: PType; - countupNode, m: PNode; + countupNode, call: PNode; begin result := n; checkMinSonsLen(n, 3); @@ -496,22 +502,22 @@ begin if n.sons[len-2].kind = nkRange then begin checkSonsLen(n.sons[len-2], 2); // convert ``in 3..5`` to ``in countup(3, 5)`` - // YYY: if the programmer overrides system.countup in a local scope - // this leads to wrong code. This is extremely hard to fix! But it may - // not even be a bug, but a feature... - countupNode := newNodeI(nkCall, n.sons[len-2].info); + countupNode := newNodeI(nkCall, n.sons[len-2].info); + countUp := StrTableGet(magicsys.systemModule.Tab, getIdent('countup')); + if (countUp = nil) then + liMessage(countupNode.info, errSystemNeeds, 'countup'); newSons(countupNode, 3); - countupNode.sons[0] := newNodeI(nkQualified, n.sons[len-2].info); - newSons(countupNode.sons[0], 2); - m := newIdentNode(getIdent('system'), n.sons[len-2].info); - countupNode.sons[0].sons[0] := m; - m := newIdentNode(getIdent('countup'), n.sons[len-2].info); - countupNode.sons[0].sons[1] := m; + countupnode.sons[0] := newSymNode(countup); countupNode.sons[1] := n.sons[len-2].sons[0]; countupNode.sons[2] := n.sons[len-2].sons[1]; + n.sons[len-2] := countupNode; end; - n.sons[len-2] := semExprWithType(c, n.sons[len-2]); + n.sons[len-2] := semExprWithType(c, n.sons[len-2], {@set}[efWantIterator]); + call := n.sons[len-2]; + if (call.kind <> nkCall) or (call.sons[0].kind <> nkSym) + or (call.sons[0].sym.kind <> skIterator) then + liMessage(n.sons[len-2].info, errIteratorExpected); iter := skipTypes(n.sons[len-2].typ, {@set}[tyGenericInst]); if iter.kind <> tyTuple then begin if len <> 3 then liMessage(n.info, errWrongNumberOfVariables); @@ -521,8 +527,7 @@ begin addDecl(c, v); end else begin - if len-2 <> sonsLen(iter) then - liMessage(n.info, errWrongNumberOfVariables); + if len-2 <> sonsLen(iter) then liMessage(n.info, errWrongNumberOfVariables); for i := 0 to len-3 do begin v := newSymS(skForVar, n.sons[i], c); v.typ := iter.sons[i]; @@ -585,66 +590,57 @@ begin end; end; -procedure semGenericParamList(c: PContext; n: PNode; father: PType = nil); +function semGenericParamList(c: PContext; n: PNode; father: PType = nil): PNode; var - i: int; + i, j, L: int; s: PSym; + a, def: PNode; + typ: PType; begin + result := copyNode(n); if n.kind <> nkGenericParams then InternalError(n.info, 'semGenericParamList'); for i := 0 to sonsLen(n)-1 do begin - if n.sons[i].kind = nkDefaultTypeParam then begin - internalError(n.sons[i].info, 'semGenericParamList() to implement'); - // XXX - end - else begin - s := newSymS(skTypeParam, n.sons[i], c); - s.typ := newTypeS(tyGenericParam, c); + a := n.sons[i]; + if a.kind <> nkIdentDefs then illFormedAst(n); + L := sonsLen(a); + def := a.sons[L-1]; + if a.sons[L-2] <> nil then + typ := semTypeNode(c, a.sons[L-2], nil) + else if def <> nil then + typ := newTypeS(tyExpr, c) + else + typ := nil; + for j := 0 to L-3 do begin + if (typ = nil) or (typ.kind = tyTypeDesc) then begin + s := newSymS(skType, a.sons[j], c); + s.typ := newTypeS(tyGenericParam, c) + end + else begin + s := newSymS(skGenericParam, a.sons[j], c); + s.typ := typ + end; + s.ast := def; s.typ.sym := s; - end; - if father <> nil then addSon(father, s.typ); - s.position := i; - n.sons[i] := newSymNode(s); - addDecl(c, s); + if father <> nil then addSon(father, s.typ); + s.position := i; + addSon(result, newSymNode(s)); + addDecl(c, s); + end end end; procedure addGenericParamListToScope(c: PContext; n: PNode); var i: int; - s: PSym; + a: PNode; begin if n.kind <> nkGenericParams then InternalError(n.info, 'addGenericParamListToScope'); for i := 0 to sonsLen(n)-1 do begin - if n.sons[i].kind <> nkSym then - InternalError(n.sons[i].info, 'addGenericParamListToScope'); - s := n.sons[i].sym; - addDecl(c, s); - end -end; - -function resolveGenericParams(c: PContext; n: PNode; - withinBind: bool = false): PNode; -var - i: int; - s: PSym; -begin - if n = nil then begin result := nil; exit end; - case n.kind of - nkIdent: begin - if not withinBind then - result := n - else - result := symChoice(c, n, lookup(c, n)) - end; - nkSym..nkNilLit: result := n; - nkBind: result := resolveGenericParams(c, n.sons[0], true); - else begin - result := n; - for i := 0 to sonsLen(n)-1 do - result.sons[i] := resolveGenericParams(c, n.sons[i], withinBind); - end + a := n.sons[i]; + if a.kind <> nkSym then internalError(a.info, 'addGenericParamListToScope'); + addDecl(c, a.sym) end end; @@ -652,7 +648,7 @@ function SemTypeSection(c: PContext; n: PNode): PNode; var i: int; s: PSym; - t: PType; + t, body: PType; a: PNode; begin result := n; @@ -674,7 +670,8 @@ begin s.typ := newTypeS(tyForward, c); s.typ.sym := s; // process pragmas: - if a.sons[0].kind = nkPragmaExpr then pragmaType(c, s, a.sons[0].sons[1]); + if a.sons[0].kind = nkPragmaExpr then + pragma(c, s, a.sons[0].sons[1], typePragmas); // add it here, so that recursive types are possible: addInterfaceDecl(c, s); a.sons[0] := newSymNode(s); @@ -689,23 +686,24 @@ begin if (a.sons[0].kind <> nkSym) then IllFormedAst(a); s := a.sons[0].sym; if (s.magic = mNone) and (a.sons[2] = nil) then - liMessage(a.info, errTypeXNeedsImplementation, s.name.s); + liMessage(a.info, errImplOfXexpected, s.name.s); if s.magic <> mNone then processMagicType(c, s); if a.sons[1] <> nil then begin - // we have a generic type declaration here, so we don't process the - // type's body: + // We have a generic type declaration here. In generic types, + // symbol lookup needs to be done here. openScope(c.tab); pushOwner(s); - s.typ.kind := tyGeneric; - semGenericParamList(c, a.sons[1], s.typ); - addSon(s.typ, nil); - // process the type body for symbol lookup of generic params - // we can use the same algorithm as for template parameters: - a.sons[2] := resolveTemplateParams(c, a.sons[2], false); - s.ast := a; + s.typ.kind := tyGenericBody; if s.typ.containerID <> 0 then InternalError(a.info, 'semTypeSection: containerID'); s.typ.containerID := getID(); + a.sons[1] := semGenericParamList(c, a.sons[1], s.typ); + addSon(s.typ, nil); // to be filled out later + s.ast := a; + body := semTypeNode(c, a.sons[2], nil); + if body <> nil then body.sym := s; + s.typ.sons[sonsLen(s.typ)-1] := body; + //debug(s.typ); popOwner(); closeScope(c.tab); end @@ -718,8 +716,6 @@ begin s.typ := t; s.ast := a; popOwner(); - if (tfAcyclic in t.flags) and (t.kind <> tyObject) then - liMessage(s.info, errInvalidPragmaX, 'acyclic'); end; end; // unfortunately we need another pass over the section for checking of @@ -741,15 +737,14 @@ begin s.typ.id := t.id; // same id end end; - if computeSize(s.typ) < 0 then - liMessage(s.info, errIllegalRecursionInTypeX, s.name.s); + checkConstructedType(s.info, s.typ); end end end; -procedure semParamList(c: PContext; n: PNode; s: PSym); +procedure semParamList(c: PContext; n, genericParams: PNode; s: PSym); begin - s.typ := semProcTypeNode(c, n, nil); + s.typ := semProcTypeNode(c, n, genericParams, nil); end; procedure addParams(c: PContext; n: PNode); @@ -780,62 +775,6 @@ begin liMessage(s.info, errXhasSideEffects, s.name.s); end; -function semIterator(c: PContext; n: PNode): PNode; -var - s: PSym; - oldP: PProcCon; -begin - result := n; - checkSonsLen(n, codePos+1); - if c.p.owner.kind <> skModule then - liMessage(n.info, errIteratorNotAllowed); - oldP := c.p; // restore later - s := semIdentVis(c, skIterator, n.sons[0], {@set}[sfStar]); - n.sons[namePos] := newSymNode(s); - include(s.flags, sfGlobal); - if sfStar in s.flags then include(s.flags, sfInInterface); - s.ast := n; - pushOwner(s); - if n.sons[genericParamsPos] <> nil then begin - // we have a generic type declaration here, so we don't process the - // type's body: - openScope(c.tab); - semGenericParamList(c, n.sons[genericParamsPos]); - end; - // process parameters: - if n.sons[paramsPos] <> nil then - semParamList(c, n.sons[ParamsPos], s) - else - liMessage(n.info, errIteratorNeedsReturnType); - s.typ.callConv := lastOptionEntry(c).defaultCC; - if n.sons[pragmasPos] <> nil then - pragmaIterator(c, s, n.sons[pragmasPos]); - s.options := gOptions; - if n.sons[codePos] <> nil then begin - if sfBorrow in s.flags then - liMessage(n.info, errImplOfXNotAllowed, s.name.s); - if n.sons[genericParamsPos] = nil then begin - c.p := newProcCon(s); - openScope(c.tab); - addParams(c, s.typ.n); - n.sons[codePos] := semStmtScope(c, n.sons[codePos]); - end - else begin - n.sons[codePos] := resolveGenericParams(c, n.sons[codePos]); - end - end - else if (sfBorrow in s.flags) then - semBorrow(c, n, s) - else - liMessage(n.info, errIteratorNeedsImplementation); - closeScope(c.tab); - popOwner(); - c.p := oldP; - // add it here, so that recursive iterators are impossible: - addInterfaceOverloadableSymAt(c, s, c.tab.tos-1); - //writeln(renderTree(n.sons[codePos], {@set}[renderIds])); -end; - procedure addResult(c: PContext; t: PType; const info: TLineInfo); var s: PSym; @@ -872,10 +811,10 @@ begin pushOwner(s); openScope(c.tab); - if (n.sons[genericParamsPos] <> nil) then InternalError(n.info, 'semLambda'); + if (n.sons[genericParamsPos] <> nil) then illFormedAst(n); // process parameters: if n.sons[paramsPos] <> nil then begin - semParamList(c, n.sons[ParamsPos], s); + semParamList(c, n.sons[ParamsPos], nil, s); addParams(c, s.typ.n); end else begin @@ -886,7 +825,7 @@ begin // we are in a nested proc: s.typ.callConv := ccClosure; if n.sons[pragmasPos] <> nil then - pragmaLambda(c, s, n.sons[pragmasPos]); + pragma(c, s, n.sons[pragmasPos], lambdaPragmas); s.options := gOptions; if n.sons[codePos] <> nil then begin @@ -905,10 +844,12 @@ begin result.typ := s.typ; end; -function semProcAux(c: PContext; n: PNode; kind: TSymKind): PNode; +function semProcAux(c: PContext; n: PNode; kind: TSymKind; + const validPragmas: TSpecialWords): PNode; var s, proto: PSym; oldP: PProcCon; + gp: PNode; begin result := n; checkSonsLen(n, codePos+1); @@ -925,11 +866,16 @@ begin pushOwner(s); openScope(c.tab); - if n.sons[genericParamsPos] <> nil then - semGenericParamList(c, n.sons[genericParamsPos]); + if n.sons[genericParamsPos] <> nil then begin + n.sons[genericParamsPos] := semGenericParamList(c, n.sons[genericParamsPos]); + gp := n.sons[genericParamsPos] + end + else + gp := newNodeI(nkGenericParams, n.info); // process parameters: if n.sons[paramsPos] <> nil then begin - semParamList(c, n.sons[ParamsPos], s); + semParamList(c, n.sons[ParamsPos], gp, s); + if sonsLen(gp) > 0 then n.sons[genericParamsPos] := gp; addParams(c, s.typ.n); end else begin @@ -951,8 +897,7 @@ begin else addDeclAt(c, s, c.tab.tos-2); if n.sons[pragmasPos] <> nil then - if kind = skMacro then pragmaMacro(c, s, n.sons[pragmasPos]) - else pragmaProc(c, s, n.sons[pragmasPos]); + pragma(c, s, n.sons[pragmasPos], validPragmas) end else begin if n.sons[pragmasPos] <> nil then @@ -981,15 +926,19 @@ begin if n.sons[codePos] <> nil then begin if [sfImportc, sfBorrow] * s.flags <> [] then liMessage(n.sons[codePos].info, errImplOfXNotAllowed, s.name.s); - if n.sons[genericParamsPos] = nil then begin + if (n.sons[genericParamsPos] = nil) then begin c.p := newProcCon(s); - addResult(c, s.typ.sons[0], n.info); + if (s.typ.sons[0] <> nil) and (kind <> skIterator) then + addResult(c, s.typ.sons[0], n.info); n.sons[codePos] := semStmtScope(c, n.sons[codePos]); - addResultNode(c, n); + if (s.typ.sons[0] <> nil) and (kind <> skIterator) then + addResultNode(c, n); end else begin - n.sons[codePos] := resolveGenericParams(c, n.sons[codePos]); - end; + if (s.typ.sons[0] <> nil) and (kind <> skIterator) then + addDecl(c, newSym(skUnknown, getIdent('result'), nil)); + n.sons[codePos] := semGenericStmtScope(c, n.sons[codePos]); + end end else begin if proto <> nil then @@ -1004,9 +953,21 @@ begin c.p := oldP; // restore end; +function semIterator(c: PContext; n: PNode): PNode; +var + t: PType; + s: PSym; +begin + result := semProcAux(c, n, skIterator, iteratorPragmas); + s := result.sons[namePos].sym; + t := s.typ; + if t.sons[0] = nil then liMessage(n.info, errXNeedsReturnType, 'iterator'); + if n.sons[codePos] = nil then liMessage(n.info, errImplOfXexpected, s.name.s); +end; + function semProc(c: PContext; n: PNode): PNode; begin - result := semProcAux(c, n, skProc); + result := semProcAux(c, n, skProc, procPragmas); end; function semConverterDef(c: PContext; n: PNode): PNode; @@ -1017,13 +978,11 @@ begin checkSonsLen(n, codePos+1); if n.sons[genericParamsPos] <> nil then liMessage(n.info, errNoGenericParamsAllowedForX, 'converter'); - result := semProcAux(c, n, skConverter); + result := semProcAux(c, n, skConverter, converterPragmas); s := result.sons[namePos].sym; t := s.typ; - if t.sons[0] = nil then - liMessage(n.info, errXNeedsReturnType, 'converter'); - if sonsLen(t) <> 2 then - liMessage(n.info, errXRequiresOneArgument, 'converter'); + if t.sons[0] = nil then liMessage(n.info, errXNeedsReturnType, 'converter'); + if sonsLen(t) <> 2 then liMessage(n.info, errXRequiresOneArgument, 'converter'); addConverter(c, s); end; @@ -1035,18 +994,17 @@ begin checkSonsLen(n, codePos+1); if n.sons[genericParamsPos] <> nil then liMessage(n.info, errNoGenericParamsAllowedForX, 'macro'); - result := semProcAux(c, n, skMacro); + result := semProcAux(c, n, skMacro, macroPragmas); s := result.sons[namePos].sym; t := s.typ; - if t.sons[0] = nil then - liMessage(n.info, errXNeedsReturnType, 'macro'); - if sonsLen(t) <> 2 then - liMessage(n.info, errXRequiresOneArgument, 'macro'); + if t.sons[0] = nil then liMessage(n.info, errXNeedsReturnType, 'macro'); + if sonsLen(t) <> 2 then liMessage(n.info, errXRequiresOneArgument, 'macro'); + if n.sons[codePos] = nil then liMessage(n.info, errImplOfXexpected, s.name.s); end; function evalInclude(c: PContext; n: PNode): PNode; var - i: int; + i, fileIndex: int; x: PNode; f, name, ext: string; begin @@ -1054,6 +1012,9 @@ begin addSon(result, n); // the rodwriter needs include information! for i := 0 to sonsLen(n)-1 do begin f := getModuleFile(n.sons[i]); + fileIndex := includeFilename(f); + if IntSetContainsOrIncl(c.includedFiles, fileIndex) then + liMessage(n.info, errRecursiveDependencyX, f); SplitFilename(f, name, ext); if cmpIgnoreCase(ext, '.'+TmplExt) = 0 then x := gIncludeTmplFile(f) @@ -1061,6 +1022,7 @@ begin x := gIncludeFile(f); x := semStmt(c, x); addSon(result, x); + IntSetExcl(c.includedFiles, fileIndex); end; end; @@ -1083,7 +1045,7 @@ begin if nfSem in n.flags then exit; case n.kind of nkAsgn: result := semAsgn(c, n); - nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkMacroStmt: + nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkMacroStmt, nkCallStrLit: result := semCommand(c, n); nkEmpty, nkCommentStmt, nkNilLit: begin end; nkBlockStmt: result := semBlock(c, n); @@ -1115,7 +1077,7 @@ begin nkReturnStmt: result := semReturn(c, n); nkAsmStmt: result := semAsm(c, n); nkYieldStmt: result := semYield(c, n); - nkPragma: pragmaStmt(c, c.p.owner, n); + nkPragma: pragma(c, c.p.owner, n, stmtPragmas); nkIteratorDef: result := semIterator(c, n); nkProcDef: result := semProc(c, n); nkConverterDef: result := semConverterDef(c, n); diff --git a/nim/semtempl.pas b/nim/semtempl.pas old mode 100644 new mode 100755 index b8107095f..f4173d9ff --- a/nim/semtempl.pas +++ b/nim/semtempl.pas @@ -46,16 +46,17 @@ begin end end; -function evalTemplateAux(c: PContext; templ, actual: PNode; - sym: PSym): PNode; +function evalTemplateAux(c: PContext; templ, actual: PNode; sym: PSym): PNode; var i: int; + p: PSym; begin if templ = nil then begin result := nil; exit end; case templ.kind of nkSym: begin - if (templ.sym.kind = skParam) and (templ.sym.owner.id = sym.id) then - result := copyTree(actual.sons[templ.sym.position+1]) // BUGFIX: +1 + p := templ.sym; + if (p.kind = skParam) and (p.owner.id = sym.id) then + result := copyTree(actual.sons[p.position]) else result := copyNode(templ) end; @@ -74,19 +75,45 @@ var evalTemplateCounter: int = 0; // to prevend endless recursion in templates // instantation +function evalTemplateArgs(c: PContext; n: PNode; s: PSym): PNode; +var + f, a, i: int; + arg: PNode; +begin + f := sonsLen(s.typ); + // if the template has zero arguments, it can be called without ``()`` + // `n` is then a nkSym or something similar + case n.kind of + nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: + a := sonsLen(n); + else a := 0 + end; + if a > f then liMessage(n.info, errWrongNumberOfArguments); + result := copyNode(n); + for i := 1 to f-1 do begin + if i < a then + arg := n.sons[i] + else + arg := copyTree(s.ast.sons[paramsPos].sons[i-1].sym.ast); + if arg = nil then liMessage(n.info, errWrongNumberOfArguments); + if not (s.typ.sons[i].kind in [tyTypeDesc, tyStmt, tyExpr]) then begin + // concrete type means semantic checking for argument: + arg := fitNode(c, s.typ.sons[i], semExprWithType(c, arg)); + end; + addSon(result, arg); + end +end; + function evalTemplate(c: PContext; n: PNode; sym: PSym): PNode; var - r: PNode; + args: PNode; begin inc(evalTemplateCounter); if evalTemplateCounter > 100 then liMessage(n.info, errTemplateInstantiationTooNested); // replace each param by the corresponding node: - r := sym.ast.sons[paramsPos].sons[0]; - if (r.kind <> nkIdent) then InternalError(r.info, 'evalTemplate'); - result := evalTemplateAux(c, sym.ast.sons[codePos], n, sym); - if r.ident.id = ord(wExpr) then result := semExpr(c, result) - else result := semStmt(c, result); + args := evalTemplateArgs(c, n, sym); + result := evalTemplateAux(c, sym.ast.sons[codePos], args, sym); dec(evalTemplateCounter); end; @@ -108,19 +135,19 @@ begin include(s.flags, sfUsed); end else begin - // semantic checking requires a type; ``fitNode`` deal with it + // semantic checking requires a type; ``fitNode`` deals with it // appropriately result := newNodeIT(nkSymChoice, n.info, newTypeS(tyNone, c)); a := initOverloadIter(o, c, n); while a <> nil do begin addSon(result, newSymNode(a)); a := nextOverloadIter(o, c, n); - end + end; + //liMessage(n.info, warnUser, s.name.s + ' is here symchoice'); end end; -function resolveTemplateParams(c: PContext; n: PNode; - withinBind: bool): PNode; +function resolveTemplateParams(c: PContext; n: PNode; withinBind: bool): PNode; var i: int; s: PSym; @@ -153,20 +180,6 @@ begin end end; -function semTemplateParamKind(c: PContext; n, p: PNode): PNode; -begin - if (p = nil) or (p.kind <> nkIdent) then - liMessage(n.info, errInvalidParamKindX, renderTree(p)) - else begin - case p.ident.id of - ord(wExpr), ord(wStmt), ord(wTypeDesc): begin end; - else - liMessage(p.info, errInvalidParamKindX, p.ident.s) - end - end; - result := p; -end; - function transformToExpr(n: PNode): PNode; var i, realStmt: int; @@ -197,9 +210,7 @@ end; function semTemplateDef(c: PContext; n: PNode): PNode; var - s, param: PSym; - i, j, len, counter: int; - params, p, paramKind: PNode; + s: PSym; begin if c.p.owner.kind = skModule then begin s := semIdentVis(c, skTemplate, n.sons[0], {@set}[sfStar]); @@ -211,23 +222,6 @@ begin // check parameter list: pushOwner(s); openScope(c.tab); - params := n.sons[paramsPos]; - counter := 0; - for i := 1 to sonsLen(params)-1 do begin - p := params.sons[i]; - len := sonsLen(p); - paramKind := semTemplateParamKind(c, p, p.sons[len-2]); - if (p.sons[len-1] <> nil) then - liMessage(p.sons[len-1].info, errDefaultArgumentInvalid); - for j := 0 to len-3 do begin - param := newSymS(skParam, p.sons[j], c); - param.position := counter; - param.ast := paramKind; - inc(counter); - addDecl(c, param) - end; - end; - params.sons[0] := semTemplateParamKind(c, params, params.sons[0]); n.sons[namePos] := newSymNode(s); // check that no pragmas exist: @@ -236,9 +230,26 @@ begin // check that no generic parameters exist: if n.sons[genericParamsPos] <> nil then liMessage(n.info, errNoGenericParamsAllowedForX, 'template'); + if (n.sons[paramsPos] = nil) then begin + // use ``stmt`` as implicit result type + s.typ := newTypeS(tyProc, c); + s.typ.n := newNodeI(nkFormalParams, n.info); + addSon(s.typ, newTypeS(tyStmt, c)); + addSon(s.typ.n, newNodeIT(nkType, n.info, s.typ.sons[0])); + end + else begin + semParamList(c, n.sons[ParamsPos], nil, s); + if n.sons[paramsPos].sons[0] = nil then begin + // use ``stmt`` as implicit result type + s.typ.sons[0] := newTypeS(tyStmt, c); + s.typ.n.sons[0] := newNodeIT(nkType, n.info, s.typ.sons[0]); + end + end; + addParams(c, s.typ.n); + // resolve parameters: n.sons[codePos] := resolveTemplateParams(c, n.sons[codePos], false); - if params.sons[0].ident.id = ord(wExpr) then + if not (s.typ.sons[0].kind in [tyStmt, tyTypeDesc]) then n.sons[codePos] := transformToExpr(n.sons[codePos]); // only parameters are resolved, no type checking is performed diff --git a/nim/semtypes.pas b/nim/semtypes.pas old mode 100644 new mode 100755 index c968d4b72..934196de4 --- a/nim/semtypes.pas +++ b/nim/semtypes.pas @@ -140,13 +140,13 @@ begin liMessage(n.info, errXExpectsOneTypeParam, 'var'); end; -function semAbstract(c: PContext; n: PNode; prev: PType): PType; +function semDistinct(c: PContext; n: PNode; prev: PType): PType; begin - result := newOrPrevType(tyAbstract, prev, c); + result := newOrPrevType(tyDistinct, prev, c); if sonsLen(n) = 1 then addSon(result, semTypeNode(c, n.sons[0], nil)) else - liMessage(n.info, errXExpectsOneTypeParam, 'abstract'); + liMessage(n.info, errXExpectsOneTypeParam, 'distinct'); end; function semRangeAux(c: PContext; n: PNode; prev: PType): PType; @@ -233,8 +233,7 @@ begin result := qualifiedLookup(c, n, true); if (result <> nil) then begin include(result.flags, sfUsed); - if not (result.kind in [skTypeParam, skType]) then - liMessage(n.info, errTypeExpected); + if result.kind <> skType then liMessage(n.info, errTypeExpected); end else liMessage(n.info, errIdentifierExpected); @@ -275,87 +274,36 @@ begin end end end; -(* -function instGenericAux(c: PContext; templ, actual: PNode; - sym: PSym): PNode; -var - i: int; -begin - if templ = nil then begin result := nil; exit end; - case templ.kind of - nkSym: begin - if (templ.sym.kind = skTypeParam) then - //and (templ.sym.owner.id = sym.id) then - result := copyTree(actual.sons[templ.sym.position+1]) - else - result := copyNode(templ) - end; - nkNone..nkIdent, nkType..nkNilLit: // atom - result := copyNode(templ); - else begin - result := copyNode(templ); - newSons(result, sonsLen(templ)); - for i := 0 to sonsLen(templ)-1 do - result.sons[i] := instGenericAux(c, templ.sons[i], actual, sym); - end - end -end; *) function semGeneric(c: PContext; n: PNode; s: PSym; prev: PType): PType; var i: int; elem: PType; - inst: PNode; - cl: PInstantiateClosure; + isConcrete: bool; begin - if (s.typ = nil) or (s.typ.kind <> tyGeneric) then + if (s.typ = nil) or (s.typ.kind <> tyGenericBody) then liMessage(n.info, errCannotInstantiateX, s.name.s); - result := newOrPrevType(tyGenericInst, prev, c); // new ID... - result.containerID := s.typ.containerID; // ... but the same containerID - result.sym := s; + result := newOrPrevType(tyGenericInvokation, prev, c); if (s.typ.containerID = 0) then InternalError(n.info, 'semtypes.semGeneric'); - cl := newInstantiateClosure(c, n.info); - // check the number of supplied arguments suffices: - if sonsLen(n) <> sonsLen(s.typ) then begin - //MessageOut('n: ' +{&} toString(sonsLen(n)) +{&} ' s: ' - // +{&} toString(sonsLen(s.typ))); - liMessage(n.info, errWrongNumberOfTypeParams); - end; - // a generic type should be instantiated with itself: - // idTablePut(cl.typeMap, s.typ, result); + if sonsLen(n) <> sonsLen(s.typ) then + liMessage(n.info, errWrongNumberOfArguments); + addSon(result, s.typ); + isConcrete := true; // iterate over arguments: for i := 1 to sonsLen(n)-1 do begin elem := semTypeNode(c, n.sons[i], nil); - if elem.kind = tyGenericParam then - result.kind := tyGeneric // prevend type from instantiation - else - idTablePut(cl.typeMap, s.typ.sons[i-1], elem); + if elem.kind = tyGenericParam then isConcrete := false; addSon(result, elem); end; - if s.ast <> nil then begin - if (result.kind = tyGenericInst) then begin - // inst := instGenericAux(c, s.ast.sons[2], n, s); - internalError(n.info, 'Generic containers not implemented'); - // XXX: implementation does not work this way - // we need to do the following: - // traverse and copy the type and replace any tyGenericParam type - // does checking of instantiated type for us: - elem := instantiateType(cl, s.typ); //semTypeNode(c, inst, nil); - elem.id := result.containerID; - addSon(result, elem); - end - else - addSon(result, nil); + if isConcrete then begin + if s.ast = nil then liMessage(n.info, errCannotInstantiateX, s.name.s); + result := instGenericContainer(c, n, result); end - else - liMessage(n.info, errCannotInstantiateX, s.name.s); - (*if computeSize(result) < 0 then - liMessage(s.info, errIllegalRecursionInTypeX, s.name.s);*) end; function semIdentVis(c: PContext; kind: TSymKind; n: PNode; const allowed: TSymFlags): PSym; -// identifier with visability +// identifier with visibility var v: PIdent; begin @@ -388,9 +336,9 @@ begin skType: begin // process pragmas later, because result.typ has not been set yet end; - skField: pragmaField(c, result, n.sons[1]); - skVar: pragmaVar(c, result, n.sons[1]); - skConst: pragmaConst(c, result, n.sons[1]); + skField: pragma(c, result, n.sons[1], fieldPragmas); + skVar: pragma(c, result, n.sons[1], varPragmas); + skConst: pragma(c, result, n.sons[1], constPragmas); else begin end end end @@ -546,8 +494,7 @@ begin for i := 0 to sonsLen(n)-1 do begin semRecordNodeAux(c, n.sons[i], check, pos, a, rectype); end; - if a <> father then - addSon(father, a); + if a <> father then addSon(father, a); end; nkIdentDefs: begin checkMinSonsLen(n, 3); @@ -644,10 +591,8 @@ begin end else base := nil; - if n.kind = nkObjectTy then - result := newOrPrevType(tyObject, prev, c) - else - InternalError(n.info, 'semObjectNode'); + if n.kind <> nkObjectTy then InternalError(n.info, 'semObjectNode'); + result := newOrPrevType(tyObject, prev, c); addSon(result, base); result.n := newNodeI(nkRecList, n.info); semRecordNodeAux(c, n.sons[2], check, pos, result.n, result.sym); @@ -655,26 +600,75 @@ begin liMessage(n.sons[1].info, errInheritanceOnlyWithNonFinalObjects); end; -function semProcTypeNode(c: PContext; n: PNode; prev: PType): PType; +function addTypeVarsOfGenericBody(c: PContext; t: PType; genericParams: PNode; + var cl: TIntSet): PType; +var + i, L: int; + s: PSym; +begin + result := t; + if (t = nil) then exit; + if IntSetContainsOrIncl(cl, t.id) then exit; + case t.kind of + tyGenericBody: begin + result := newTypeS(tyGenericInvokation, c); + addSon(result, t); + for i := 0 to sonsLen(t)-2 do begin + if t.sons[i].kind <> tyGenericParam then + InternalError('addTypeVarsOfGenericBody'); + s := copySym(t.sons[i].sym); + s.position := sonsLen(genericParams); + addDecl(c, s); + addSon(genericParams, newSymNode(s)); + addSon(result, t.sons[i]); + end; + end; + tyGenericInst: begin + L := sonsLen(t)-1; + t.sons[L] := addTypeVarsOfGenericBody(c, t.sons[L], genericParams, cl); + end; + tyGenericInvokation: begin + for i := 1 to sonsLen(t)-1 do + t.sons[i] := addTypeVarsOfGenericBody(c, t.sons[i], genericParams, cl); + end + else begin + for i := 0 to sonsLen(t)-1 do + t.sons[i] := addTypeVarsOfGenericBody(c, t.sons[i], genericParams, cl); + end + end +end; + +function paramType(c: PContext; n, genericParams: PNode; + var cl: TIntSet): PType; +begin + result := semTypeNode(c, n, nil); + if (genericParams <> nil) and (sonsLen(genericParams) = 0) then + result := addTypeVarsOfGenericBody(c, result, genericParams, cl); +end; + +function semProcTypeNode(c: PContext; n, genericParams: PNode; + prev: PType): PType; var i, j, len, counter: int; a, def, res: PNode; typ: PType; arg: PSym; - check: TIntSet; + check, cl: TIntSet; begin checkMinSonsLen(n, 1); result := newOrPrevType(tyProc, prev, c); result.callConv := lastOptionEntry(c).defaultCC; result.n := newNodeI(nkFormalParams, n.info); + if (genericParams <> nil) and (sonsLen(genericParams) = 0) then + IntSetInit(cl); if n.sons[0] = nil then begin addSon(result, nil); // return type addSon(result.n, newNodeI(nkType, n.info)); // BUGFIX: nkType must exist! + // XXX but it does not, if n.sons[paramsPos] == nil? end else begin - addSon(result, semTypeNode(c, n.sons[0], nil)); // return type + addSon(result, nil); res := newNodeI(nkType, n.info); - res.typ := result.sons[0]; addSon(result.n, res); end; IntSetInit(check); @@ -685,7 +679,7 @@ begin checkMinSonsLen(a, 3); len := sonsLen(a); if a.sons[len-2] <> nil then - typ := semTypeNode(c, a.sons[len-2], nil) + typ := paramType(c, a.sons[len-2], genericParams, cl) else typ := nil; if a.sons[len-1] <> nil then begin @@ -712,6 +706,11 @@ begin addSon(result.n, newSymNode(arg)); addSon(result, typ); end + end; + // NOTE: semantic checking of the result type needs to be done here! + if n.sons[0] <> nil then begin + result.sons[0] := paramType(c, n.sons[0], genericParams, cl); + res.typ := result.sons[0]; end end; @@ -751,6 +750,7 @@ end; function semTypeNode(c: PContext; n: PNode; prev: PType): PType; var s: PSym; + t: PType; begin result := nil; if n = nil then exit; @@ -784,11 +784,12 @@ begin end end; nkSym: begin - if (n.sym.kind in [skTypeParam, skType]) and (n.sym.typ <> nil) then begin + if (n.sym.kind = skType) and (n.sym.typ <> nil) then begin + t := n.sym.typ; if prev = nil then - result := n.sym.typ + result := t else begin - assignType(prev, s.typ); + assignType(prev, t); result := prev; end; include(n.sym.flags, sfUsed); // BUGFIX @@ -801,14 +802,14 @@ begin nkRefTy: result := semAnyRef(c, n, tyRef, 'ref', prev); nkPtrTy: result := semAnyRef(c, n, tyPtr, 'ptr', prev); nkVarTy: result := semVarType(c, n, prev); - nkAbstractTy: result := semAbstract(c, n, prev); + nkDistinctTy: result := semDistinct(c, n, prev); nkProcTy: begin checkSonsLen(n, 2); - result := semProcTypeNode(c, n.sons[0], prev); + result := semProcTypeNode(c, n.sons[0], nil, prev); // dummy symbol for `pragma`: s := newSymS(skProc, newIdentNode(getIdent('dummy'), n.info), c); s.typ := result; - pragmaProcType(c, s, n.sons[1]); + pragma(c, s, n.sons[1], procTypePragmas); end; nkEnumTy: result := semEnum(c, n, prev); nkType: result := n.typ; @@ -859,6 +860,9 @@ begin exit end; mNil: setMagicType(m, tyNil, ptrSize); + mExpr: setMagicType(m, tyExpr, 0); + mStmt: setMagicType(m, tyStmt, 0); + mTypeDesc: setMagicType(m, tyTypeDesc, 0); mArray, mOpenArray, mRange, mSet, mSeq, mOrdinal: exit; else liMessage(m.info, errTypeExpected); end; diff --git a/nim/sigmatch.pas b/nim/sigmatch.pas old mode 100644 new mode 100755 index ccd05d413..aa53a741c --- a/nim/sigmatch.pas +++ b/nim/sigmatch.pas @@ -43,7 +43,7 @@ begin c.call := nil; c.baseTypeMatch := false; initIdTable(c.bindings); - assert(c.callee <> nil); + //assert(c.callee <> nil); end; procedure copyCandidate(var a: TCandidate; const b: TCandidate); @@ -117,7 +117,7 @@ end; function typeRel(var mapping: TIdTable; f, a: PType): TTypeRelation; overload; forward; -function concreteType(t: PType): PType; +function concreteType(const mapping: TIdTable; t: PType): PType; begin case t.kind of tyArrayConstr: begin // make it an array @@ -126,6 +126,14 @@ begin addSon(result, t.sons[1]); // XXX: semantic checking for the type? end; tyNil: result := nil; // what should it be? + tyGenericParam: begin + result := t; + while true do begin + result := PType(idTableGet(mapping, t)); + if result = nil then InternalError('lookup failed'); + if result.kind <> tyGenericParam then break + end + end; else result := t // Note: empty is valid here end end; @@ -218,8 +226,9 @@ begin // is a subtype of f? result := isNone; assert(f <> nil); assert(a <> nil); - if (a.kind = tyGenericInst) and - (skipTypes(f, {@set}[tyVar]).kind <> tyGeneric) then begin + if (a.kind = tyGenericInst) and not + (skipTypes(f, {@set}[tyVar]).kind in [tyGenericBody, tyGenericInvokation]) + then begin result := typeRel(mapping, f, lastSon(a)); exit end; @@ -348,8 +357,8 @@ begin // is a subtype of f? else if isObjectSubtype(a, f) then result := isSubtype end end; - tyAbstract: begin - if (a.kind = tyAbstract) and (a.id = f.id) then result := isEqual; + tyDistinct: begin + if (a.kind = tyDistinct) and (a.id = f.id) then result := isEqual; end; tySet: begin if a.kind = tySet then begin @@ -415,6 +424,8 @@ begin // is a subtype of f? result := isNone end else if a.sons[0] <> nil then + result := isNone; + if (tfNoSideEffect in f.flags) and not (tfNoSideEffect in a.flags) then result := isNone end end @@ -458,12 +469,11 @@ begin // is a subtype of f? end; tyGenericInst: begin result := typeRel(mapping, lastSon(f), a); - end; - tyGeneric: begin + end; (* + tyGenericBody: begin x := PType(idTableGet(mapping, f)); if x = nil then begin assert(f.containerID <> 0); - assert(lastSon(f) = nil); if (a.kind = tyGenericInst) and (f.containerID = a.containerID) and (sonsLen(a) = sonsLen(f)) then begin for i := 0 to sonsLen(f)-2 do begin @@ -476,22 +486,64 @@ begin // is a subtype of f? else begin result := typeRel(mapping, x, a) // check if it fits end + end; *) + tyGenericBody: begin + result := typeRel(mapping, lastSon(f), a); + end; + tyGenericInvokation: begin + assert(f.sons[0].kind = tyGenericBody); + if a.kind = tyGenericInvokation then begin + InternalError('typeRel: tyGenericInvokation -> tyGenericInvokation'); + end; + if (a.kind = tyGenericInst) then begin + if (f.sons[0].containerID = a.sons[0].containerID) + and (sonsLen(a)-1 = sonsLen(f)) then begin + assert(a.sons[0].kind = tyGenericBody); + for i := 1 to sonsLen(f)-1 do begin + if a.sons[i].kind = tyGenericParam then begin + InternalError('wrong instantiated type!'); + end; + if typeRel(mapping, f.sons[i], a.sons[i]) < isGeneric then exit; + end; + result := isGeneric; + end (* + else begin + MessageOut('came here: ' + toString(sonsLen(f)) + ' ' + + toString(sonsLen(a)) + ' '+ + toString(f.sons[0].containerID) + ' '+ + toString(a.sons[0].containerID)); + end *) + end + else begin + result := typeRel(mapping, f.sons[0], a); + if result <> isNone then begin + // we steal the generic parameters from the tyGenericBody: + for i := 1 to sonsLen(f)-1 do begin + x := PType(idTableGet(mapping, f.sons[0].sons[i-1])); + if (x = nil) or (x.kind = tyGenericParam) then + InternalError('wrong instantiated type!'); + idTablePut(mapping, f.sons[i], x); + end + end + end end; tyGenericParam: begin x := PType(idTableGet(mapping, f)); if x = nil then begin if sonsLen(f) = 0 then begin // no constraints - concrete := concreteType(a); + concrete := concreteType(mapping, a); if concrete <> nil then begin + //MessageOut('putting: ' + f.sym.name.s); idTablePut(mapping, f, concrete); result := isGeneric end; end else begin + InternalError(f.sym.info, 'has constraints: ' + f.sym.name.s); // check constraints: for i := 0 to sonsLen(f)-1 do begin if typeRel(mapping, f.sons[i], a) >= isSubtype then begin - concrete := concreteType(a); + concrete := concreteType(mapping, a); if concrete <> nil then begin idTablePut(mapping, f, concrete); result := isGeneric @@ -503,10 +555,20 @@ begin // is a subtype of f? end else if a.kind = tyEmpty then result := isGeneric - else begin - result := typeRel(mapping, x, a); // check if it fits - end - end + else if x.kind = tyGenericParam then + result := isGeneric + else + result := typeRel(mapping, x, a) // check if it fits + end; + tyExpr, tyStmt, tyTypeDesc: begin + if a.kind = f.kind then result := isEqual + else + case a.kind of + tyExpr, tyStmt, tyTypeDesc: result := isGeneric; + tyNil: result := isSubtype; + else begin end + end + end; else internalError('typeRel(' +{&} typeKindToStr[f.kind] +{&} ')'); end end; @@ -524,7 +586,7 @@ function getInstantiatedType(c: PContext; arg: PNode; const m: TCandidate; begin result := PType(idTableGet(m.bindings, f)); if result = nil then begin - result := generateTypeInstance(c, m.bindings, arg.info, f); + result := generateTypeInstance(c, m.bindings, arg, f); end; if result = nil then InternalError(arg.info, 'getInstantiatedType'); end; @@ -630,8 +692,9 @@ var x, y, z: TCandidate; r: TTypeRelation; begin - if (arg = nil) or (arg.kind <> nkSymChoice) then + if (arg = nil) or (arg.kind <> nkSymChoice) then begin result := ParamTypesMatchAux(c, m, f, a, arg) + end else begin // CAUTION: The order depends on the used hashing scheme. Thus it is // incorrect to simply use the first fitting match. However, to implement @@ -645,16 +708,19 @@ begin z.calleeSym := m.calleeSym; best := -1; for i := 0 to sonsLen(arg)-1 do begin - copyCandidate(z, m); - r := typeRel(z.bindings, f, arg.sons[i].typ); - if r <> isNone then begin - case x.state of - csEmpty, csNoMatch: begin x := z; best := i; x.state := csMatch; end; - csMatch: begin - cmp := cmpCandidates(x, z); - if cmp < 0 then begin best := i; x := z end // z is better than x - else if cmp = 0 then y := z // z is as good as x - else begin end // z is worse than x + // iterators are not first class yet, so ignore them + if arg.sons[i].sym.kind in {@set}[skProc, skConverter] then begin + copyCandidate(z, m); + r := typeRel(z.bindings, f, arg.sons[i].typ); + if r <> isNone then begin + case x.state of + csEmpty, csNoMatch: begin x := z; best := i; x.state := csMatch; end; + csMatch: begin + cmp := cmpCandidates(x, z); + if cmp < 0 then begin best := i; x := z end // z is better than x + else if cmp = 0 then y := z // z is as good as x + else begin end // z is worse than x + end end end end @@ -818,13 +884,14 @@ begin end end; -function semDirectCall(c: PContext; n: PNode): PNode; +function semDirectCall(c: PContext; n: PNode; filter: TSymKinds): PNode; var sym: PSym; o: TOverloadIter; x, y, z: TCandidate; cmp: int; begin + //liMessage(n.info, warnUser, renderTree(n)); sym := initOverloadIter(o, c, n.sons[0]); result := nil; if sym = nil then exit; @@ -833,7 +900,7 @@ begin initCandidate(y, sym.typ); y.calleeSym := sym; while sym <> nil do begin - if sym.kind in [skProc, skIterator, skConverter] then begin + if sym.kind in filter then begin initCandidate(z, sym.typ); z.calleeSym := sym; matches(c, n, z); diff --git a/nim/strutils.pas b/nim/strutils.pas old mode 100644 new mode 100755 index f34379fcb..be20b52b2 --- a/nim/strutils.pas +++ b/nim/strutils.pas @@ -66,7 +66,7 @@ function repeatChar(count: int; c: Char = ' '): string; type TStringSeq = array of string; TCharSet = set of Char; -function splitSeq(const s: string; const seps: TCharSet): TStringSeq; +function split(const s: string; const seps: TCharSet): TStringSeq; function startsWith(const s, prefix: string): bool; function endsWith(const s, postfix: string): bool; @@ -78,9 +78,15 @@ function strip(const s: string; const chars: TCharSet = WhiteSpace): string; function allCharsInSet(const s: string; const theSet: TCharSet): bool; function quoteIfContainsWhite(const s: string): string; +procedure addSep(var dest: string; sep: string = ', '); implementation +procedure addSep(var dest: string; sep: string = ', '); +begin + if length(dest) > 0 then add(dest, sep) +end; + function quoteIfContainsWhite(const s: string): string; begin if ((find(s, ' ') >= strStart) @@ -148,7 +154,7 @@ begin end end; -function splitSeq(const s: string; const seps: TCharSet): TStringSeq; +function split(const s: string; const seps: TCharSet): TStringSeq; var first, last, len: int; begin diff --git a/nim/syntaxes.pas b/nim/syntaxes.pas old mode 100644 new mode 100755 diff --git a/nim/tigen.pas b/nim/tigen.pas old mode 100644 new mode 100755 diff --git a/nim/transf.pas b/nim/transf.pas old mode 100644 new mode 100755 index 3e3b2a611..79f65b754 --- a/nim/transf.pas +++ b/nim/transf.pas @@ -124,7 +124,7 @@ Should be transformed into:: return a[i] block L1: inc(c.i) -More efficient, but not implementable: +More efficient, but not implementable:: type TItemsClosure = record @@ -288,7 +288,7 @@ end; function inlineIter(c: PTransf; n: PNode): PNode; var - i: int; + i, j, L: int; it: PNode; newVar: PSym; begin @@ -304,16 +304,33 @@ begin for i := 0 to sonsLen(result)-1 do begin it := result.sons[i]; if it.kind = nkCommentStmt then continue; - if (it.kind <> nkIdentDefs) or (it.sons[0].kind <> nkSym) then - InternalError(it.info, 'inlineIter'); - newVar := copySym(it.sons[0].sym); - include(newVar.flags, sfFromGeneric); - // fixes a strange bug for rodgen: - //include(it.sons[0].sym.flags, sfFromGeneric); - newVar.owner := getCurrOwner(c); - IdNodeTablePut(c.transCon.mapping, it.sons[0].sym, newSymNode(newVar)); - it.sons[0] := newSymNode(newVar); - it.sons[2] := transform(c, it.sons[2]); + if it.kind = nkIdentDefs then begin + if (it.sons[0].kind <> nkSym) then + InternalError(it.info, 'inlineIter'); + newVar := copySym(it.sons[0].sym); + include(newVar.flags, sfFromGeneric); + // fixes a strange bug for rodgen: + //include(it.sons[0].sym.flags, sfFromGeneric); + newVar.owner := getCurrOwner(c); + IdNodeTablePut(c.transCon.mapping, it.sons[0].sym, newSymNode(newVar)); + it.sons[0] := newSymNode(newVar); + it.sons[2] := transform(c, it.sons[2]); + end + else begin + if it.kind <> nkVarTuple then + InternalError(it.info, 'inlineIter: not nkVarTuple'); + L := sonsLen(it); + for j := 0 to L-3 do begin + newVar := copySym(it.sons[j].sym); + include(newVar.flags, sfFromGeneric); + newVar.owner := getCurrOwner(c); + IdNodeTablePut(c.transCon.mapping, it.sons[j].sym, + newSymNode(newVar)); + it.sons[j] := newSymNode(newVar); + end; + assert(it.sons[L-2] = nil); + it.sons[L-1] := transform(c, it.sons[L-1]); + end end end else begin @@ -758,7 +775,8 @@ function getMergeOp(n: PNode): PSym; begin result := nil; case n.kind of - nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix: begin + nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix, + nkCallStrLit: begin if (n.sons[0].Kind = nkSym) and (n.sons[0].sym.kind = skProc) and (sfMerge in n.sons[0].sym.flags) then result := n.sons[0].sym; @@ -873,7 +891,8 @@ begin n.sons[0] := transform(c, n.sons[0]); n.sons[1] := transformContinue(c, n.sons[1]); end; - nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix: + nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix, + nkCallStrLit: result := transformCall(c, result); nkAddr, nkHiddenAddr: result := transformAddrDeref(c, n, nkDerefExpr, nkHiddenDeref); diff --git a/nim/transtmp.pas b/nim/transtmp.pas old mode 100644 new mode 100755 index 77ba157f3..15a07f5a2 --- a/nim/transtmp.pas +++ b/nim/transtmp.pas @@ -140,7 +140,7 @@ begin addSon(father, newAsgnStmt(dest, src)); end end; - nkCall, nkCommand: begin + nkCall, nkCommand, nkCallStrLit: begin end; diff --git a/nim/trees.pas b/nim/trees.pas old mode 100644 new mode 100755 index 4df85f6bb..0e0c04a22 --- a/nim/trees.pas +++ b/nim/trees.pas @@ -144,21 +144,19 @@ end; function getOpSym(op: PNode): PSym; begin - if not (op.kind in [nkCall, nkGenericCall, nkHiddenCallConv, nkCommand]) then + if not (op.kind in [nkCall, nkHiddenCallConv, nkCommand, nkCallStrLit]) then result := nil else begin if (sonsLen(op) <= 0) then InternalError(op.info, 'getOpSym'); - case op.sons[0].Kind of - nkSym, nkQualified: result := op.sons[0].sym; - else result := nil - end + if op.sons[0].Kind = nkSym then result := op.sons[0].sym + else result := nil end end; function getMagic(op: PNode): TMagic; begin case op.kind of - nkCall, nkHiddenCallConv, nkCommand: begin + nkCall, nkHiddenCallConv, nkCommand, nkCallStrLit: begin case op.sons[0].Kind of nkSym: begin result := op.sons[0].sym.magic; @@ -166,9 +164,6 @@ begin else result := mNone end end; - nkExplicitTypeListCall, nkGenericCall: begin - result := getMagic(op.sons[sonsLen(op)-1]); - end; else result := mNone end diff --git a/nim/treetab.pas b/nim/treetab.pas old mode 100644 new mode 100755 diff --git a/nim/types.pas b/nim/types.pas old mode 100644 new mode 100755 index d2aee2413..a881b2f11 --- a/nim/types.pas +++ b/nim/types.pas @@ -48,7 +48,7 @@ function mutateType(t: PType; iter: TTypeMutator; closure: PObject): PType; function SameType(x, y: PType): Boolean; function SameTypeOrNil(a, b: PType): Boolean; -function equalOrAbstractOf(x, y: PType): bool; +function equalOrDistinctOf(x, y: PType): bool; type TParamsEquality = (paramsNotEqual, // parameters are not equal @@ -66,11 +66,11 @@ function isOrdinalType(t: PType): Boolean; function enumHasWholes(t: PType): Boolean; const - abstractPtrs = {@set}[tyVar, tyPtr, tyRef, tyGenericInst, tyAbstract, tyOrdinal]; - abstractVar = {@set}[tyVar, tyGenericInst, tyAbstract, tyOrdinal]; - abstractRange = {@set}[tyGenericInst, tyRange, tyAbstract, tyOrdinal]; - abstractVarRange = {@set}[tyGenericInst, tyRange, tyVar, tyAbstract, tyOrdinal]; - abstractInst = {@set}[tyGenericInst, tyAbstract, tyOrdinal]; + abstractPtrs = {@set}[tyVar, tyPtr, tyRef, tyGenericInst, tyDistinct, tyOrdinal]; + abstractVar = {@set}[tyVar, tyGenericInst, tyDistinct, tyOrdinal]; + abstractRange = {@set}[tyGenericInst, tyRange, tyDistinct, tyOrdinal]; + abstractVarRange = {@set}[tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal]; + abstractInst = {@set}[tyGenericInst, tyDistinct, tyOrdinal]; function skipTypes(t: PType; kinds: TTypeKinds): PType; @@ -202,7 +202,7 @@ function elemType(t: PType): PType; begin assert(t <> nil); case t.kind of - tyGenericInst, tyAbstract: result := elemType(lastSon(t)); + tyGenericInst, tyDistinct: result := elemType(lastSon(t)); tyArray, tyArrayConstr: result := t.sons[1]; else result := t.sons[0]; end; @@ -317,12 +317,17 @@ begin result := iter(t, closure); if result then exit; if not IntSetContainsOrIncl(marker, t.id) then begin - for i := 0 to sonsLen(t)-1 do begin - result := iterOverTypeAux(marker, t.sons[i], iter, closure); - if result then exit; - end; - if t.n <> nil then - result := iterOverNode(marker, t.n, iter, closure) + case t.kind of + tyGenericInst, tyGenericBody: + result := iterOverTypeAux(marker, lastSon(t), iter, closure); + else begin + for i := 0 to sonsLen(t)-1 do begin + result := iterOverTypeAux(marker, t.sons[i], iter, closure); + if result then exit; + end; + if t.n <> nil then result := iterOverNode(marker, t.n, iter, closure) + end + end end end; @@ -388,7 +393,7 @@ begin if not result then result := searchTypeNodeForAux(t.n, predicate, marker); end; - tyGenericInst, tyAbstract: + tyGenericInst, tyDistinct: result := searchTypeForAux(lastSon(t), predicate, marker); tyArray, tyArrayConstr, tySet, tyTuple: begin for i := 0 to sonsLen(t)-1 do begin @@ -421,7 +426,7 @@ end; function isObjectWithTypeFieldPredicate(t: PType): bool; begin result := (t.kind = tyObject) and (t.sons[0] = nil) - and not (sfPure in t.sym.flags) + and not ((t.sym <> nil) and (sfPure in t.sym.flags)) and not (tfFinal in t.flags); end; @@ -447,7 +452,7 @@ begin if result = frNone then if isObjectWithTypeFieldPredicate(t) then result := frHeader end; - tyGenericInst, tyAbstract: + tyGenericInst, tyDistinct: result := analyseObjectWithTypeFieldAux(lastSon(t), marker); tyArray, tyArrayConstr, tyTuple: begin for i := 0 to sonsLen(t)-1 do begin @@ -491,7 +496,7 @@ begin result := searchTypeFor(typ, isHiddenPointer); end; -function canFormAcycleAux(var marker: TIntSet; t: PType; +function canFormAcycleAux(var marker: TIntSet; typ: PType; startId: int): bool; forward; function canFormAcycleNode(var marker: TIntSet; n: PNode; startId: int): bool; @@ -514,14 +519,17 @@ begin end end; -function canFormAcycleAux(var marker: TIntSet; t: PType; startId: int): bool; +function canFormAcycleAux(var marker: TIntSet; typ: PType; startId: int): bool; var i: int; + t: PType; begin result := false; - if t = nil then exit; + if typ = nil then exit; + if tfAcyclic in typ.flags then exit; + t := skipTypes(typ, abstractInst); if tfAcyclic in t.flags then exit; - case skipTypes(t, abstractInst).kind of + case t.kind of tyTuple, tyObject, tyRef, tySequence, tyArray, tyArrayConstr, tyOpenArray: begin if not IntSetContainsOrIncl(marker, t.id) then begin @@ -606,8 +614,10 @@ end; function TypeToString(typ: PType; prefer: TPreferedDesc = preferName): string; const typeToStr: array [TTypeKind] of string = ( - 'None', 'bool', 'Char', 'empty', 'Array Constructor [$1]', 'nil', - 'Generic', 'GenericInst', 'GenericParam', 'abstract $1', + 'None', 'bool', 'Char', 'empty', 'Array Constructor [$1]', 'nil', 'expr', + 'stmt', 'typeDesc', + 'GenericInvokation', + 'GenericBody', 'GenericInst', 'GenericParam', 'distinct $1', 'enum', 'ordinal[$1]', 'array[$1, $2]', 'object', 'tuple', 'set[$1]', 'range[$1]', 'ptr ', 'ref ', 'var ', 'seq[$1]', 'proc', 'pointer', @@ -618,6 +628,7 @@ const var t: PType; i: int; + prag: string; begin t := typ; result := ''; @@ -637,6 +648,14 @@ begin result := 'array[' +{&} typeToString(t.sons[0]) +{&} ', ' +{&} typeToString(t.sons[1]) +{&} ']' end; + tyGenericInvokation, tyGenericBody: begin + result := typeToString(t.sons[0]) + '['; + for i := 1 to sonsLen(t)-1 do begin + if i > 1 then add(result, ', '); + add(result, typeToString(t.sons[i])); + end; + addChar(result, ']'); + end; tyArrayConstr: result := 'Array constructor[' +{&} rangeToStr(t.sons[0].n) +{&} ', ' +{&} typeToString(t.sons[1]) +{&} ']'; @@ -644,7 +663,7 @@ begin tyOrdinal: result := 'ordinal[' +{&} typeToString(t.sons[0]) +{&} ']'; tySet: result := 'set[' +{&} typeToString(t.sons[0]) +{&} ']'; tyOpenArray: result := 'openarray[' +{&} typeToString(t.sons[0]) +{&} ']'; - tyAbstract: result := 'abstract ' +{&} typeToString(t.sons[0], preferName); + tyDistinct: result := 'distinct ' +{&} typeToString(t.sons[0], preferName); tyTuple: begin // we iterate over t.sons here, because t.n may be nil result := 'tuple['; @@ -679,8 +698,13 @@ begin addChar(result, ')'); if t.sons[0] <> nil then add(result, ': ' +{&} TypeToString(t.sons[0])); - if t.callConv <> ccDefault then - add(result, '{.' +{&} CallingConvToStr[t.callConv] +{&} '.}'); + if t.callConv <> ccDefault then prag := CallingConvToStr[t.callConv] + else prag := ''; + if tfNoSideEffect in t.flags then begin + addSep(prag); + add(prag, 'noSideEffect') + end; + if length(prag) <> 0 then add(result, '{.' +{&} prag +{&} '.}'); end; else begin result := typeToStr[t.kind] @@ -730,7 +754,7 @@ begin result := t.n.sons[0].sym.position; end; end; - tyGenericInst, tyAbstract: result := firstOrd(lastSon(t)); + tyGenericInst, tyDistinct: result := firstOrd(lastSon(t)); else begin InternalError('invalid kind for first(' +{&} typeKindToStr[t.kind] +{&} ')'); @@ -766,7 +790,7 @@ begin assert(t.n.sons[sonsLen(t.n)-1].kind = nkSym); result := t.n.sons[sonsLen(t.n)-1].sym.position; end; - tyGenericInst, tyAbstract: result := firstOrd(lastSon(t)); + tyGenericInst, tyDistinct: result := firstOrd(lastSon(t)); else begin InternalError('invalid kind for last(' +{&} typeKindToStr[t.kind] +{&} ')'); @@ -779,7 +803,7 @@ function lengthOrd(t: PType): biggestInt; begin case t.kind of tyInt64, tyInt32, tyInt: result := lastOrd(t); - tyAbstract: result := lengthOrd(t.sons[0]); + tyDistinct: result := lengthOrd(t.sons[0]); else result := lastOrd(t) - firstOrd(t) + 1; end end; @@ -868,7 +892,7 @@ begin SameLiteral(a.sons[1], b.sons[1]) end; -function sameTuple(a, b: PType; AbstractOf: bool): boolean; +function sameTuple(a, b: PType; DistinctOf: bool): boolean; // two tuples are equivalent iff the names, types and positions are the same; // however, both types may not have any field names (t.n may be nil) which // complicates the matter a bit. @@ -879,8 +903,8 @@ begin if sonsLen(a) = sonsLen(b) then begin result := true; for i := 0 to sonsLen(a)-1 do begin - if AbstractOf then - result := equalOrAbstractOf(a.sons[i], b.sons[i]) + if DistinctOf then + result := equalOrDistinctOf(a.sons[i], b.sons[i]) else result := SameType(a.sons[i], b.sons[i]); if not result then exit @@ -914,15 +938,15 @@ begin if a.kind <> b.kind then begin result := false; exit end; case a.Kind of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, - tyInt..tyFloat128: + tyInt..tyFloat128, tyExpr, tyStmt, tyTypeDesc: result := true; - tyEnum, tyForward, tyObject, tyAbstract: + tyEnum, tyForward, tyObject, tyDistinct: result := (a.id = b.id); tyTuple: result := sameTuple(a, b, false); tyGenericInst: result := sameType(lastSon(a), lastSon(b)); - tyGenericParam, tyGeneric, tySequence, tyOrdinal, + tyGenericParam, tyGenericInvokation, tyGenericBody, tySequence, tyOrdinal, tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr, tyArray, tyProc: begin if sonsLen(a) = sonsLen(b) then begin @@ -946,7 +970,7 @@ begin end end; -function equalOrAbstractOf(x, y: PType): bool; +function equalOrDistinctOf(x, y: PType): bool; var i: int; a, b: PType; @@ -958,26 +982,26 @@ begin assert(a <> nil); assert(b <> nil); if a.kind <> b.kind then begin - if a.kind = tyAbstract then a := a.sons[0]; + if a.kind = tyDistinct then a := a.sons[0]; if a.kind <> b.kind then begin result := false; exit end end; case a.Kind of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, - tyInt..tyFloat128: + tyInt..tyFloat128, tyExpr, tyStmt, tyTypeDesc: result := true; - tyEnum, tyForward, tyObject, tyAbstract: + tyEnum, tyForward, tyObject, tyDistinct: result := (a.id = b.id); tyTuple: result := sameTuple(a, b, true); tyGenericInst: - result := equalOrAbstractOf(lastSon(a), lastSon(b)); - tyGenericParam, tyGeneric, tySequence, tyOrdinal, + result := equalOrDistinctOf(lastSon(a), lastSon(b)); + tyGenericParam, tyGenericInvokation, tyGenericBody, tySequence, tyOrdinal, tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr, tyArray, tyProc: begin if sonsLen(a) = sonsLen(b) then begin result := true; for i := 0 to sonsLen(a)-1 do begin - result := equalOrAbstractOf(a.sons[i], b.sons[i]); + result := equalOrDistinctOf(a.sons[i], b.sons[i]); if not result then exit end; if result and (a.kind = tyProc) then @@ -987,7 +1011,7 @@ begin result := false; end; tyRange: begin - result := equalOrAbstractOf(a.sons[0], b.sons[0]) + result := equalOrDistinctOf(a.sons[0], b.sons[0]) and SameValue(a.n.sons[0], b.n.sons[0]) and SameValue(a.n.sons[1], b.n.sons[1]) end; @@ -995,7 +1019,7 @@ begin end end; -function typeAllowedAux(var marker: TIntSet; t: PType; +function typeAllowedAux(var marker: TIntSet; typ: PType; kind: TSymKind): bool; forward; function typeAllowedNode(var marker: TIntSet; n: PNode; kind: TSymKind): bool; @@ -1005,6 +1029,7 @@ begin result := true; if n <> nil then begin result := typeAllowedAux(marker, n.typ, kind); + if not result then debug(n.typ); if result then case n.kind of nkNone..nkNilLit: begin end; @@ -1018,24 +1043,27 @@ begin end end; -function typeAllowedAux(var marker: TIntSet; t: PType; kind: TSymKind): bool; +function typeAllowedAux(var marker: TIntSet; typ: PType; kind: TSymKind): bool; var i: int; + t, t2: PType; begin assert(kind in [skVar, skConst, skParam]); result := true; - if t = nil then exit; + if typ = nil then exit; // if we have already checked the type, return true, because we stop the // evaluation if something is wrong: - if IntSetContainsOrIncl(marker, t.id) then exit; - case skipTypes(t, abstractInst).kind of + if IntSetContainsOrIncl(marker, typ.id) then exit; + t := skipTypes(typ, abstractInst); + case t.kind of tyVar: begin - case skipTypes(t.sons[0], abstractInst).kind of + t2 := skipTypes(t.sons[0], abstractInst); + case t2.kind of tyVar: result := false; // ``var var`` is always an invalid type: tyOpenArray: result := (kind = skParam) and - typeAllowedAux(marker, t.sons[0], kind); + typeAllowedAux(marker, t2, kind); else result := (kind <> skConst) and - typeAllowedAux(marker, t.sons[0], kind); + typeAllowedAux(marker, t2, kind); end end; tyProc: begin @@ -1046,12 +1074,16 @@ begin if t.sons[0] <> nil then result := typeAllowedAux(marker, t.sons[0], skVar) end; - tyGeneric, tyGenericParam, tyForward, tyNone: result := false; + tyExpr, tyStmt, tyTypeDesc: result := true; + tyGenericBody, tyGenericParam, tyForward, tyNone, tyGenericInvokation: begin + result := false; + //InternalError('shit found'); + end; tyEmpty, tyNil: result := kind = skConst; tyString, tyBool, tyChar, tyEnum, tyInt..tyFloat128, tyCString, tyPointer: result := true; tyOrdinal: result := kind = skParam; - tyGenericInst, tyAbstract: + tyGenericInst, tyDistinct: result := typeAllowedAux(marker, lastSon(t), kind); tyRange: result := skipTypes(t.sons[0], abstractInst).kind in @@ -1074,8 +1106,8 @@ begin result := typeAllowedAux(marker, t.sons[i], skVar); if not result then exit end; - if t.n <> nil then result := typeAllowedNode(marker, t.n, skVar) - end + if t.n <> nil then result := typeAllowedNode(marker, t.n, skVar); + end; end end; @@ -1221,7 +1253,7 @@ begin if result < 0 then exit; maxAlign := a end - else if typ.kind = tyObject then begin + else if isObjectWithTypeFieldPredicate(typ) then begin result := intSize; maxAlign := result; end else begin @@ -1233,7 +1265,7 @@ begin if a < maxAlign then a := maxAlign; result := align(result, a); end; - tyGenericInst, tyAbstract: begin + tyGenericInst, tyDistinct, tyGenericBody: begin result := computeSizeAux(lastSon(typ), a); end; else begin diff --git a/nim/wordrecg.pas b/nim/wordrecg.pas old mode 100644 new mode 100755 index 1f4513ed5..9bf3de256 --- a/nim/wordrecg.pas +++ b/nim/wordrecg.pas @@ -39,10 +39,10 @@ type // i = i + 1 //cog.out(idents) //]]] - wAbstract, wAddr, wAnd, wAs, - wAsm, wBind, wBlock, wBreak, - wCase, wCast, wConst, wContinue, - wConverter, wDiscard, wDiv, wElif, + wAddr, wAnd, wAs, wAsm, + wBind, wBlock, wBreak, wCase, + wCast, wConst, wContinue, wConverter, + wDiscard, wDistinct, wDiv, wElif, wElse, wEnd, wEnum, wExcept, wFinally, wFor, wFrom, wGeneric, wIf, wImplies, wImport, wIn, @@ -81,13 +81,13 @@ type wBorrow, wRun, wR, wVerbosity, wV, wHelp, wH, wSymbolFiles, wFieldChecks, wX, wVersion, wAdvanced, wSkipcfg, wSkipProjCfg, wCc, wGenscript, wCheckPoint, wCheckPoints, - wMaxErr, wExpr, wStmt, wTypeDesc, - wSubsChar, wAstCache, wAcyclic, wIndex, + wNoMain, + wSubsChar, wAcyclic, wIndex, // commands: wCompileToC, wCompileToCpp, wCompileToEcmaScript, wCompileToLLVM, wPretty, wDoc, wPas, wGenDepend, wListDef, wCheck, wParse, wScan, wBoot, wLazy, - wRst2html, wI, + wRst2html, wRst2tex, wI, // special for the preprocessor of configuration files: wWrite, wPutEnv, wPrependEnv, wAppendEnv, // additional Pascal keywords: @@ -107,16 +107,15 @@ type const oprLow = ord(wColon); oprHigh = ord(wHat); - specialWords: array [low(TSpecialWord)..high(TSpecialWord)] - of string = ('', + specialWords: array [low(TSpecialWord)..high(TSpecialWord)] of string = ('', // keywords: //[[[cog //cog.out(strings) //]]] - 'abstract', 'addr', 'and', 'as', - 'asm', 'bind', 'block', 'break', - 'case', 'cast', 'const', 'continue', - 'converter', 'discard', 'div', 'elif', + 'addr', 'and', 'as', 'asm', + 'bind', 'block', 'break', 'case', + 'cast', 'const', 'continue', 'converter', + 'discard', 'distinct', 'div', 'elif', 'else', 'end', 'enum', 'except', 'finally', 'for', 'from', 'generic', 'if', 'implies', 'import', 'in', @@ -155,12 +154,12 @@ const 'borrow', 'run', 'r'+'', 'verbosity', 'v'+'', 'help', 'h'+'', 'symbolfiles', 'fieldchecks', 'x'+'', 'version', 'advanced', 'skipcfg', 'skipprojcfg', 'cc', 'genscript', 'checkpoint', 'checkpoints', - 'maxerr', 'expr', 'stmt', 'typedesc', - 'subschar', 'astcache', 'acyclic', 'index', + 'nomain', + 'subschar', 'acyclic', 'index', // commands: 'compiletoc', 'compiletocpp', 'compiletoecmascript', 'compiletollvm', 'pretty', 'doc', 'pas', 'gendepend', 'listdef', 'check', 'parse', - 'scan', 'boot', 'lazy', 'rst2html', 'i'+'', + 'scan', 'boot', 'lazy', 'rst2html', 'rst2tex', 'i'+'', // special for the preprocessor of configuration files: 'write', 'putenv', 'prependenv', 'appendenv', diff --git a/obj/empty.txt b/obj/empty.txt old mode 100644 new mode 100755 diff --git a/pycompab.py b/pycompab.py old mode 100644 new mode 100755 index c6752bee3..17422f20d --- a/pycompab.py +++ b/pycompab.py @@ -9,7 +9,7 @@ import sys python3 = sys.version[0] >= "3" -python26 = sys.version[:3] == "2.6" +python26 = sys.version[0] == "2" and sys.version[2] >= "6" true, false = 0==0, 0==1 diff --git a/readme.txt b/readme.txt old mode 100644 new mode 100755 diff --git a/rod/nimrod.cfg b/rod/nimrod.cfg old mode 100644 new mode 100755 diff --git a/rod/nimrod.dot b/rod/nimrod.dot old mode 100644 new mode 100755 diff --git a/rod/nimrod.ini b/rod/nimrod.ini old mode 100644 new mode 100755 index eaf3aafb2..6ae5f0156 --- a/rod/nimrod.ini +++ b/rod/nimrod.ini @@ -22,6 +22,7 @@ License: "copying.txt" [Config] Files: "config/nimdoc.cfg" Files: "config/nimrod.cfg" +Files: "config/nimdoc.tex.cfg" [Documentation] Files: "doc/*.txt" diff --git a/rod/readme.txt b/rod/readme.txt old mode 100644 new mode 100755 diff --git a/tests/cairotest.nim b/tests/cairotest.nim old mode 100644 new mode 100755 diff --git a/tests/cgitest.nim b/tests/cgitest.nim old mode 100644 new mode 100755 diff --git a/tests/csvtest.csv b/tests/csvtest.csv old mode 100644 new mode 100755 diff --git a/tests/curltest.nim b/tests/curltest.nim old mode 100644 new mode 100755 diff --git a/tests/data.csv b/tests/data.csv old mode 100644 new mode 100755 diff --git a/tests/ecmas.html b/tests/ecmas.html old mode 100644 new mode 100755 index 25eb93dc3..1cb56e72a --- a/tests/ecmas.html +++ b/tests/ecmas.html @@ -9,7 +9,7 @@ - +
    diff --git a/tests/ecmas.nim b/tests/ecmas.nim old mode 100644 new mode 100755 diff --git a/tests/gcbench.nim b/tests/gcbench.nim old mode 100644 new mode 100755 diff --git a/tests/gctest.nim b/tests/gctest.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex1.nim b/tests/gtk/ex1.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex2.nim b/tests/gtk/ex2.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex3.nim b/tests/gtk/ex3.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex4.nim b/tests/gtk/ex4.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex5.nim b/tests/gtk/ex5.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex6.nim b/tests/gtk/ex6.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex7.nim b/tests/gtk/ex7.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex8.nim b/tests/gtk/ex8.nim old mode 100644 new mode 100755 diff --git a/tests/gtk/ex9.nim b/tests/gtk/ex9.nim old mode 100644 new mode 100755 diff --git a/tests/hallo.nim b/tests/hallo.nim old mode 100644 new mode 100755 diff --git a/tests/jsontest.json b/tests/jsontest.json old mode 100644 new mode 100755 diff --git a/tests/mambsym1.nim b/tests/mambsym1.nim old mode 100644 new mode 100755 diff --git a/tests/mambsym2.nim b/tests/mambsym2.nim old mode 100644 new mode 100755 diff --git a/tests/mambsys1.nim b/tests/mambsys1.nim old mode 100644 new mode 100755 diff --git a/tests/mambsys2.nim b/tests/mambsys2.nim old mode 100644 new mode 100755 diff --git a/tests/md5.nim b/tests/md5.nim deleted file mode 100644 index 003014043..000000000 --- a/tests/md5.nim +++ /dev/null @@ -1,249 +0,0 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2009 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## Module for computing MD5 checksums. - -type - MD5State = array[0..3, int32] - MD5Block = array[0..15, int32] - MD5CBits = array[0..7, int8] - MD5Digest* = array[0..15, int8] - MD5Buffer = array[0..63, int8] - MD5Context* {.final.} = object - State: MD5State - Count: array[0..1, int32] - Buffer: MD5Buffer - -const - padding: cstring = "\x80\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0\0\0\0\0" & - "\0\0\0\0" - -proc F(x, y, z: int32): int32 {.inline.} = - Result = (x and y) or ((not x) and z) - -proc G(x, y, z: int32): int32 {.inline.} = - Result = (x and z) or (y and (not z)) - -proc H(x, y, z: int32): int32 {.inline.} = - Result = x xor y xor z - -proc I(x, y, z: int32): int32 {.inline.} = - Result = y xor (x or (not z)) - -proc rot(x: var int32, n: int8) {.inline.} = - x = toU32(x shl ze(n)) or (x shr toU32(32 -% ze(n))) - -proc FF(a: var int32, b, c, d, x: int32, s: int8, ac: int32) = - a = a +% F(b, c, d) +% x +% ac - rot(a, s) - a = a +% b - -proc GG(a: var int32, b, c, d, x: int32, s: int8, ac: int32) = - a = a +% G(b, c, d) +% x +% ac - rot(a, s) - a = a +% b - -proc HH(a: var int32, b, c, d, x: int32, s: int8, ac: int32) = - a = a +% H(b, c, d) +% x +% ac - rot(a, s) - a = a +% b - -proc II(a: var int32, b, c, d, x: int32, s: int8, ac: int32) = - a = a +% I(b, c, d) +% x +% ac - rot(a, s) - a = a +% b - -proc encode(dest: var MD5Block, src: cstring) = - var j = 0 - for i in 0..high(dest): - dest[i] = toU32(ord(src[j]) or - ord(src[j+1]) shl 8 or - ord(src[j+2]) shl 16 or - ord(src[j+3]) shl 24) - inc(j, 4) - -proc decode(dest: var openarray[int8], src: openarray[int32]) = - var i = 0 - for j in 0..high(src): - dest[i] = toU8(src[j] and 0xff'i32) - dest[i+1] = toU8(src[j] shr 8'i32 and 0xff'i32) - dest[i+2] = toU8(src[j] shr 16'i32 and 0xff'i32) - dest[i+3] = toU8(src[j] shr 24'i32 and 0xff'i32) - inc(i, 4) - -proc transform(Buffer: pointer, State: var MD5State) = - var - myBlock: MD5Block - encode(myBlock, cast[cstring](buffer)) - var a = State[0] - var b = State[1] - var c = State[2] - var d = State[3] - FF(a, b, c, d, myBlock[0], 7'i8, 0xD76AA478'i32) - FF(d, a, b, c, myBlock[1], 12'i8, 0xE8C7B756'i32) - FF(c, d, a, b, myBlock[2], 17'i8, 0x242070DB'i32) - FF(b, c, d, a, myBlock[3], 22'i8, 0xC1BDCEEE'i32) - FF(a, b, c, d, myBlock[4], 7'i8, 0xF57C0FAF'i32) - FF(d, a, b, c, myBlock[5], 12'i8, 0x4787C62A'i32) - FF(c, d, a, b, myBlock[6], 17'i8, 0xA8304613'i32) - FF(b, c, d, a, myBlock[7], 22'i8, 0xFD469501'i32) - FF(a, b, c, d, myBlock[8], 7'i8, 0x698098D8'i32) - FF(d, a, b, c, myBlock[9], 12'i8, 0x8B44F7AF'i32) - FF(c, d, a, b, myBlock[10], 17'i8, 0xFFFF5BB1'i32) - FF(b, c, d, a, myBlock[11], 22'i8, 0x895CD7BE'i32) - FF(a, b, c, d, myBlock[12], 7'i8, 0x6B901122'i32) - FF(d, a, b, c, myBlock[13], 12'i8, 0xFD987193'i32) - FF(c, d, a, b, myBlock[14], 17'i8, 0xA679438E'i32) - FF(b, c, d, a, myBlock[15], 22'i8, 0x49B40821'i32) - GG(a, b, c, d, myBlock[1], 5'i8, 0xF61E2562'i32) - GG(d, a, b, c, myBlock[6], 9'i8, 0xC040B340'i32) - GG(c, d, a, b, myBlock[11], 14'i8, 0x265E5A51'i32) - GG(b, c, d, a, myBlock[0], 20'i8, 0xE9B6C7AA'i32) - GG(a, b, c, d, myBlock[5], 5'i8, 0xD62F105D'i32) - GG(d, a, b, c, myBlock[10], 9'i8, 0x02441453'i32) - GG(c, d, a, b, myBlock[15], 14'i8, 0xD8A1E681'i32) - GG(b, c, d, a, myBlock[4], 20'i8, 0xE7D3FBC8'i32) - GG(a, b, c, d, myBlock[9], 5'i8, 0x21E1CDE6'i32) - GG(d, a, b, c, myBlock[14], 9'i8, 0xC33707D6'i32) - GG(c, d, a, b, myBlock[3], 14'i8, 0xF4D50D87'i32) - GG(b, c, d, a, myBlock[8], 20'i8, 0x455A14ED'i32) - GG(a, b, c, d, myBlock[13], 5'i8, 0xA9E3E905'i32) - GG(d, a, b, c, myBlock[2], 9'i8, 0xFCEFA3F8'i32) - GG(c, d, a, b, myBlock[7], 14'i8, 0x676F02D9'i32) - GG(b, c, d, a, myBlock[12], 20'i8, 0x8D2A4C8A'i32) - HH(a, b, c, d, myBlock[5], 4'i8, 0xFFFA3942'i32) - HH(d, a, b, c, myBlock[8], 11'i8, 0x8771F681'i32) - HH(c, d, a, b, myBlock[11], 16'i8, 0x6D9D6122'i32) - HH(b, c, d, a, myBlock[14], 23'i8, 0xFDE5380C'i32) - HH(a, b, c, d, myBlock[1], 4'i8, 0xA4BEEA44'i32) - HH(d, a, b, c, myBlock[4], 11'i8, 0x4BDECFA9'i32) - HH(c, d, a, b, myBlock[7], 16'i8, 0xF6BB4B60'i32) - HH(b, c, d, a, myBlock[10], 23'i8, 0xBEBFBC70'i32) - HH(a, b, c, d, myBlock[13], 4'i8, 0x289B7EC6'i32) - HH(d, a, b, c, myBlock[0], 11'i8, 0xEAA127FA'i32) - HH(c, d, a, b, myBlock[3], 16'i8, 0xD4EF3085'i32) - HH(b, c, d, a, myBlock[6], 23'i8, 0x04881D05'i32) - HH(a, b, c, d, myBlock[9], 4'i8, 0xD9D4D039'i32) - HH(d, a, b, c, myBlock[12], 11'i8, 0xE6DB99E5'i32) - HH(c, d, a, b, myBlock[15], 16'i8, 0x1FA27CF8'i32) - HH(b, c, d, a, myBlock[2], 23'i8, 0xC4AC5665'i32) - II(a, b, c, d, myBlock[0], 6'i8, 0xF4292244'i32) - II(d, a, b, c, myBlock[7], 10'i8, 0x432AFF97'i32) - II(c, d, a, b, myBlock[14], 15'i8, 0xAB9423A7'i32) - II(b, c, d, a, myBlock[5], 21'i8, 0xFC93A039'i32) - II(a, b, c, d, myBlock[12], 6'i8, 0x655B59C3'i32) - II(d, a, b, c, myBlock[3], 10'i8, 0x8F0CCC92'i32) - II(c, d, a, b, myBlock[10], 15'i8, 0xFFEFF47D'i32) - II(b, c, d, a, myBlock[1], 21'i8, 0x85845DD1'i32) - II(a, b, c, d, myBlock[8], 6'i8, 0x6FA87E4F'i32) - II(d, a, b, c, myBlock[15], 10'i8, 0xFE2CE6E0'i32) - II(c, d, a, b, myBlock[6], 15'i8, 0xA3014314'i32) - II(b, c, d, a, myBlock[13], 21'i8, 0x4E0811A1'i32) - II(a, b, c, d, myBlock[4], 6'i8, 0xF7537E82'i32) - II(d, a, b, c, myBlock[11], 10'i8, 0xBD3AF235'i32) - II(c, d, a, b, myBlock[2], 15'i8, 0x2AD7D2BB'i32) - II(b, c, d, a, myBlock[9], 21'i8, 0xEB86D391'i32) - State[0] = State[0] +% a - State[1] = State[1] +% b - State[2] = State[2] +% c - State[3] = State[3] +% d - -proc MD5Init*(c: var MD5Context) = - ## initializes a MD5Context - c.State[0] = 0x67452301'i32 - c.State[1] = 0xEFCDAB89'i32 - c.State[2] = 0x98BADCFE'i32 - c.State[3] = 0x10325476'i32 - c.Count[0] = 0'i32 - c.Count[1] = 0'i32 - ZeroMem(addr(c.Buffer), SizeOf(MD5Buffer)) - -proc MD5Update*(c: var MD5Context, input: cstring, len: int) = - ## updates the MD5Context with the `input` data of length `len` - var input = input - var Index = (c.Count[0] shr 3) and 0x3F - c.Count[0] = c.count[0] +% toU32(len shl 3) - if c.Count[0] < (len shl 3): c.Count[1] = c.count[1] +% 1'i32 - c.Count[1] = c.count[1] +% toU32(len shr 29) - var PartLen = 64 - Index - if len >= PartLen: - CopyMem(addr(c.Buffer[Index]), Input, PartLen) - transform(addr(c.Buffer), c.State) - var i = PartLen - while i + 63 < len: - Transform(addr(Input[I]), c.State) - inc(i, 64) - CopyMem(addr(c.Buffer[0]), addr(Input[i]), len-i) - else: - CopyMem(addr(c.Buffer[Index]), addr(Input[0]), len) - -proc MD5Final*(c: var MD5Context, digest: var MD5Digest) = - ## finishes the MD5Context and stores the result in `digest` - var - Bits: MD5CBits - PadLen: int - decode(bits, c.Count) - var Index = (c.Count[0] shr 3) and 0x3F - if Index < 56: PadLen = 56 - Index - else: PadLen = 120 - Index - MD5Update(c, padding, PadLen) - MD5Update(c, cast[cstring](addr(Bits)), 8) - decode(digest, c.State) - ZeroMem(addr(c), SizeOf(MD5Context)) - -proc toMD5*(s: string): MD5Digest = - ## computes the MD5Digest value for a string `s` - var c: MD5Context - MD5Init(c) - MD5Update(c, cstring(s), len(s)) - MD5Final(c, result) - -proc `$`*(D: MD5Digest): string = - ## converts a MD5Digest value into its string representation - const digits = "0123456789abcdef" - result = "" - for i in 0..15: - add(result, Digits[(D[I] shr 4) and 0xF]) - add(result, Digits[D[I] and 0xF]) - -proc myMD5*(s: string): string = - var - c: MD5Context - d: MD5Digest - MD5Init(c) - MD5Update(c, cstring(s), len(s)) - MD5Final(c, d) - result = $d - -proc `==`*(D1, D2: MD5Digest): bool = - ## checks if two MD5Digest values are identical - for i in 0..15: - if D1[i] != D2[i]: return false - return true - -var x = myMD5("Franz jagt im komplett verwahrlosten Taxi quer durch Bayern") -assert(x == "a3cca2b2aa1e3b5b3b5aad99a8529074") - -md5("Frank jagt im komplett verwahrlosten Taxi quer durch Bayern") = -7e716d0e702df0505fc72e2b89467910 - -Der Hash einer Zeichenfolge der Länge Null ist: - -md5("") = d41d8cd98f00b204e9800998ecf8427e - - -echo x - diff --git a/tests/minit.nim b/tests/minit.nim old mode 100644 new mode 100755 diff --git a/tests/mnamspc1.nim b/tests/mnamspc1.nim old mode 100644 new mode 100755 diff --git a/tests/mnamspc2.nim b/tests/mnamspc2.nim old mode 100644 new mode 100755 diff --git a/tests/mopaque.nim b/tests/mopaque.nim old mode 100644 new mode 100755 diff --git a/tests/mrecmod.nim b/tests/mrecmod.nim old mode 100644 new mode 100755 diff --git a/tests/mrecmod2.nim b/tests/mrecmod2.nim old mode 100644 new mode 100755 diff --git a/tests/mvarious.nim b/tests/mvarious.nim old mode 100644 new mode 100755 diff --git a/tests/readme.txt b/tests/readme.txt old mode 100644 new mode 100755 diff --git a/tests/rectest.nim b/tests/rectest.nim old mode 100644 new mode 100755 diff --git a/tests/scantest.nim b/tests/scantest.nim old mode 100644 new mode 100755 diff --git a/tests/sdltest.nim b/tests/sdltest.nim old mode 100644 new mode 100755 diff --git a/tests/stckovfl.nim b/tests/stckovfl.nim old mode 100644 new mode 100755 diff --git a/tests/sunset.tmpl b/tests/sunset.tmpl old mode 100644 new mode 100755 diff --git a/tests/tack.nim b/tests/tack.nim old mode 100644 new mode 100755 diff --git a/tests/tambsym.nim b/tests/tambsym.nim old mode 100644 new mode 100755 diff --git a/tests/tambsym2.nim b/tests/tambsym2.nim old mode 100644 new mode 100755 diff --git a/tests/tambsym3.nim b/tests/tambsym3.nim old mode 100644 new mode 100755 diff --git a/tests/tambsys.nim b/tests/tambsys.nim old mode 100644 new mode 100755 diff --git a/tests/tarray.nim b/tests/tarray.nim old mode 100644 new mode 100755 diff --git a/tests/tarray2.nim b/tests/tarray2.nim old mode 100644 new mode 100755 diff --git a/tests/tarrindx.nim b/tests/tarrindx.nim old mode 100644 new mode 100755 diff --git a/tests/tassert.nim b/tests/tassert.nim old mode 100644 new mode 100755 diff --git a/tests/tassign.nim b/tests/tassign.nim old mode 100644 new mode 100755 diff --git a/tests/tbintree.nim b/tests/tbintree.nim old mode 100644 new mode 100755 index e0373355f..89126eaa5 --- a/tests/tbintree.nim +++ b/tests/tbintree.nim @@ -3,23 +3,23 @@ type # with generic param ``T`` le, ri: ref TBinaryTree[T] # left and right subtrees; may be nil data: T # the data stored in a node - PBinaryTree*[T] = ref TBinaryTree[T] # type that is exported + PBinaryTree*[A] = ref TBinaryTree[A] # type that is exported proc newNode*[T](data: T): PBinaryTree[T] = # constructor for a node new(result) - result.dat = data + result.data = data -proc add*[T](root: var PBinaryTree[T], n: PBinaryTree[T]) = +proc add*[Ty](root: var PBinaryTree[Ty], n: PBinaryTree[Ty]) = # insert a node into the tree if root == nil: root = n else: var it = root while it != nil: - # compare the data items; uses the generic ``cmd`` proc that works for + # compare the data items; uses the generic ``cmp`` proc that works for # any type that has a ``==`` and ``<`` operator - var c = cmp(it.data, n.data) + var c = cmp(n.data, it.data) if c < 0: if it.le == nil: it.le = n @@ -31,29 +31,71 @@ proc add*[T](root: var PBinaryTree[T], n: PBinaryTree[T]) = return it = it.ri -proc add*[T](root: var PBinaryTree[T], data: T) = +proc add*[Ty](root: var PBinaryTree[Ty], data: Ty) = # convenience proc: add(root, newNode(data)) +proc find*[Ty2](b: PBinaryTree[Ty2], data: Ty2): bool = + # for testing this needs to be recursive, so that the + # instantiated type is checked for proper tyGenericInst envelopes + if b == nil: + result = false + else: + var c = cmp(data, b.data) + if c < 0: result = find(b.le, data) + elif c > 0: result = find(b.ri, data) + else: result = true + iterator preorder*[T](root: PBinaryTree[T]): T = # Preorder traversal of a binary tree. # Since recursive iterators are not yet implemented, # this uses an explicit stack: var stack: seq[PBinaryTree[T]] = @[root] while stack.len > 0: - var n = stack[stack.len-1] - setLen(stack, stack.len-1) # pop `n` of the stack + var n = stack.pop() while n != nil: - yield n + yield n.data add(stack, n.ri) # push right subtree onto the stack n = n.le # and follow the left pointer -var - root: PBinaryTree[string] # instantiate a PBinaryTree with the type string -add(root, newNode("hallo")) # instantiates generic procs ``newNode`` and ``add`` -#add(root, "world") # instantiates the second ``add`` proc -#for str in preorder(root): -# stdout.writeln(str) +iterator items*[T](root: PBinaryTree[T]): T = + ## Inorder traversal of the binary tree. + var stack: seq[PBinaryTree[T]] = @[] + var n = root + while true: + while n != nil: + add(stack, n) + n = n.le + if stack.len > 0: + n = stack.pop() + yield n.data + n = n.ri + if stack.len == 0 and n == nil: break -#OUT halloworld +proc debug[T](a: PBinaryTree[T]) = + if a != nil: + debug(a.le) + echo a.data + debug(a.ri) +when isMainModule: + var + root: PBinaryTree[string] + x = newNode("hallo") + add(root, x) + add(root, "world") + if find(root, "world"): + for str in items(root): + stdout.write(str) + else: + stdout.writeln("BUG") + + var + r2: PBinaryTree[int] + add(r2, newNode(110)) + add(r2, 223) + add(r2, 99) + for y in items(r2): + stdout.write(y) + +#OUT halloworld99110223 diff --git a/tests/tblock1.nim b/tests/tblock1.nim old mode 100644 new mode 100755 diff --git a/tests/tcasestm.nim b/tests/tcasestm.nim old mode 100644 new mode 100755 diff --git a/tests/tclosure.nim b/tests/tclosure.nim old mode 100644 new mode 100755 diff --git a/tests/tcmdline.nim b/tests/tcmdline.nim old mode 100644 new mode 100755 diff --git a/tests/tconstr1.nim b/tests/tconstr1.nim old mode 100644 new mode 100755 diff --git a/tests/tconstr2.nim b/tests/tconstr2.nim old mode 100644 new mode 100755 diff --git a/tests/tcopy.nim b/tests/tcopy.nim old mode 100644 new mode 100755 diff --git a/tests/tcurrncy.nim b/tests/tcurrncy.nim old mode 100644 new mode 100755 index 1d353abd6..fa08d620b --- a/tests/tcurrncy.nim +++ b/tests/tcurrncy.nim @@ -19,7 +19,7 @@ template Comparable(typ: typeDesc): stmt = template DefineCurrency(typ, base: expr): stmt = type - typ* = abstract base + typ* = distinct base Additive(typ) Multiplicative(typ, base) Comparable(typ) diff --git a/tests/tdialogs.nim b/tests/tdialogs.nim old mode 100644 new mode 100755 diff --git a/tests/techo.nim b/tests/techo.nim old mode 100644 new mode 100755 diff --git a/tests/tendian.nim b/tests/tendian.nim old mode 100644 new mode 100755 diff --git a/tests/tenum.nim b/tests/tenum.nim old mode 100644 new mode 100755 diff --git a/tests/tester.nim b/tests/tester.nim old mode 100644 new mode 100755 index fc75754d5..03125bd4f --- a/tests/tester.nim +++ b/tests/tester.nim @@ -1,7 +1,7 @@ # # # Nimrod Tester -# (c) Copyright 2008 Andreas Rumpf +# (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -74,28 +74,30 @@ proc callCompiler(filename, options: string): TSpec = var p = startProcess(command=c[0], args=a, options={poStdErrToStdOut, poUseShell}) var outp = p.outputStream + var s = "" while running(p) or not outp.atEnd(outp): - var s = outp.readLine() - var matches: array [0..3, string] - result.outp = "" - result.puremsg = "" - result.file = "" - result.err = true - if match(s, r"(.*)\((\d+), \d+\) Error\: (.*)", matches): - result.file = matches[1] - result.line = parseInt(matches[2]) - result.outp = matches[0] - result.puremsg = matches[3] - break - elif match(s, r"Error\: (.*)", matches): - result.puremsg = matches[1] - result.outp = matches[0] - result.line = 1 - break - elif match(s, r"Hint\: operation successful", matches): - result.outp = matches[0] - result.err = false - break + var x = outp.readLine() + if match(x, r"(.*)\((\d+), \d+\) Error\: (.*)") or + match(x, r"Error\: (.*)") or + match(x, r"Hint\: operation successful"): + # `s` should contain the last error message + s = x + result.outp = "" + result.puremsg = "" + result.file = "" + result.err = true + if s =~ r"(.*)\((\d+), \d+\) Error\: (.*)": + result.file = matches[1] + result.line = parseInt(matches[2]) + result.outp = matches[0] + result.puremsg = matches[3] + elif s =~ r"Error\: (.*)": + result.puremsg = matches[1] + result.outp = matches[0] + result.line = 1 + elif s =~ r"Hint\: operation successful": + result.outp = matches[0] + result.err = false proc cmpResults(filename: string, spec, comp: TSpec): bool = # short filename for messages (better readability): @@ -151,7 +153,16 @@ proc main(options: string) = var comp = callCompiler(filename, options) if cmpResults(filename, spec, comp): inc(passed) inc(total) - Echo("[Tester] $1/$2 tests passed\n" % [$passed, $total]) + # ensure that the examples at least compile + for filename in os.walkFiles("examples/*.nim"): + if executeShellCommand(cmdTemplate % + ["filename", filename, "options", options]) == 0: + inc(passed) + else: + var shortfile = os.extractFilename(filename) + Echo("[Tester] Example '$#' -- FAILED" % shortfile) + inc(total) + Echo("[Tester] $#/$# tests passed\n" % [$passed, $total]) var options = "" diff --git a/tests/tformat.nim b/tests/tformat.nim old mode 100644 new mode 100755 diff --git a/tests/tforwty.nim b/tests/tforwty.nim old mode 100644 new mode 100755 diff --git a/tests/tforwty2.nim b/tests/tforwty2.nim old mode 100644 new mode 100755 diff --git a/tests/tgtk.nim b/tests/tgtk.nim old mode 100644 new mode 100755 diff --git a/tests/thallo.nim b/tests/thallo.nim old mode 100644 new mode 100755 diff --git a/tests/tident.nim b/tests/tident.nim old mode 100644 new mode 100755 diff --git a/tests/tillrec.nim b/tests/tillrec.nim old mode 100644 new mode 100755 diff --git a/tests/tinit.nim b/tests/tinit.nim old mode 100644 new mode 100755 diff --git a/tests/tinout.nim b/tests/tinout.nim old mode 100644 new mode 100755 diff --git a/tests/tints.nim b/tests/tints.nim old mode 100644 new mode 100755 diff --git a/tests/tinvwhen.nim b/tests/tinvwhen.nim old mode 100644 new mode 100755 diff --git a/tests/tio.nim b/tests/tio.nim old mode 100644 new mode 100755 diff --git a/tests/tisopr.nim b/tests/tisopr.nim old mode 100644 new mode 100755 diff --git a/tests/titer.nim b/tests/titer.nim old mode 100644 new mode 100755 diff --git a/tests/titer2.nim b/tests/titer2.nim old mode 100644 new mode 100755 diff --git a/tests/titer3.nim b/tests/titer3.nim old mode 100644 new mode 100755 index b42113241..d0e121445 --- a/tests/titer3.nim +++ b/tests/titer3.nim @@ -1,7 +1,17 @@ + +iterator count1_3: int = + yield 1 + yield 2 + yield 3 + +for x in count1_3(): + write(stdout, $x) + # yield inside an iterator, but not in a loop: iterator iter1(a: openArray[int]): int = - yield a[0] #ERROR_MSG 'yield' only allowed in a loop of an iterator + yield a[0] var x = [[1, 2, 3], [4, 5, 6]] for y in iter1(x[0]): write(stdout, $y) +#OUT 1231 \ No newline at end of file diff --git a/tests/tlastmod.nim b/tests/tlastmod.nim old mode 100644 new mode 100755 diff --git a/tests/tlibs.nim b/tests/tlibs.nim old mode 100644 new mode 100755 diff --git a/tests/tloops.nim b/tests/tloops.nim old mode 100644 new mode 100755 diff --git a/tests/tlowhigh.nim b/tests/tlowhigh.nim old mode 100644 new mode 100755 diff --git a/tests/tmath.nim b/tests/tmath.nim old mode 100644 new mode 100755 diff --git a/tests/tnamspc.nim b/tests/tnamspc.nim old mode 100644 new mode 100755 diff --git a/tests/tnestif.nim b/tests/tnestif.nim old mode 100644 new mode 100755 diff --git a/tests/tnew.nim b/tests/tnew.nim old mode 100644 new mode 100755 diff --git a/tests/tnewsets.nim b/tests/tnewsets.nim old mode 100644 new mode 100755 diff --git a/tests/tnewuns.nim b/tests/tnewuns.nim old mode 100644 new mode 100755 diff --git a/tests/tnoop.nim b/tests/tnoop.nim old mode 100644 new mode 100755 diff --git a/tests/tnot.nim b/tests/tnot.nim old mode 100644 new mode 100755 index f5046849d..cda551654 --- a/tests/tnot.nim +++ b/tests/tnot.nim @@ -6,7 +6,7 @@ proc nodeOfDegree(x: Int): bool = proc main = for j in 0..2: for i in 0..10: - if not nodeOfDegree(1) >= 0: #ERROR + if not nodeOfDegree(1) >= 0: #ERROR_MSG type mismatch Echo "Yes" else: Echo "No" diff --git a/tests/tobject2.nim b/tests/tobject2.nim old mode 100644 new mode 100755 diff --git a/tests/tobjects.nim b/tests/tobjects.nim old mode 100644 new mode 100755 diff --git a/tests/toop1.nim b/tests/toop1.nim old mode 100644 new mode 100755 diff --git a/tests/topaque.nim b/tests/topaque.nim old mode 100644 new mode 100755 diff --git a/tests/topena1.nim b/tests/topena1.nim old mode 100644 new mode 100755 diff --git a/tests/topenlen.nim b/tests/topenlen.nim old mode 100644 new mode 100755 diff --git a/tests/toptions.nim b/tests/toptions.nim old mode 100644 new mode 100755 diff --git a/tests/tos.nim b/tests/tos.nim old mode 100644 new mode 100755 diff --git a/tests/toverflw.nim b/tests/toverflw.nim old mode 100644 new mode 100755 diff --git a/tests/toverl.nim b/tests/toverl.nim old mode 100644 new mode 100755 diff --git a/tests/toverlop.nim b/tests/toverlop.nim old mode 100644 new mode 100755 diff --git a/tests/toverwr.nim b/tests/toverwr.nim old mode 100644 new mode 100755 diff --git a/tests/tovfint.nim b/tests/tovfint.nim old mode 100644 new mode 100755 diff --git a/tests/tparedef.nim b/tests/tparedef.nim old mode 100644 new mode 100755 diff --git a/tests/tparscfg.nim b/tests/tparscfg.nim old mode 100644 new mode 100755 diff --git a/tests/tparsopt.nim b/tests/tparsopt.nim old mode 100644 new mode 100755 diff --git a/tests/tpos.nim b/tests/tpos.nim old mode 100644 new mode 100755 diff --git a/tests/tposix.nim b/tests/tposix.nim old mode 100644 new mode 100755 diff --git a/tests/tprep.nim b/tests/tprep.nim old mode 100644 new mode 100755 diff --git a/tests/tprintf.nim b/tests/tprintf.nim old mode 100644 new mode 100755 diff --git a/tests/tprocvar.nim b/tests/tprocvar.nim old mode 100644 new mode 100755 diff --git a/tests/tpush.nim b/tests/tpush.nim old mode 100644 new mode 100755 diff --git a/tests/tquit.nim b/tests/tquit.nim old mode 100644 new mode 100755 diff --git a/tests/tradix.nim b/tests/tradix.nim old mode 100644 new mode 100755 diff --git a/tests/trawstr.nim b/tests/trawstr.nim old mode 100644 new mode 100755 diff --git a/tests/treadln.nim b/tests/treadln.nim old mode 100644 new mode 100755 diff --git a/tests/trecmod.nim b/tests/trecmod.nim old mode 100644 new mode 100755 diff --git a/tests/trecmod2.nim b/tests/trecmod2.nim old mode 100644 new mode 100755 diff --git a/tests/trectype.nim b/tests/trectype.nim old mode 100644 new mode 100755 diff --git a/tests/trefs.nim b/tests/trefs.nim old mode 100644 new mode 100755 diff --git a/tests/tregex.nim b/tests/tregex.nim old mode 100644 new mode 100755 diff --git a/tests/treguse.nim b/tests/treguse.nim old mode 100644 new mode 100755 diff --git a/tests/trepr.nim b/tests/trepr.nim old mode 100644 new mode 100755 diff --git a/tests/tseq2.nim b/tests/tseq2.nim old mode 100644 new mode 100755 diff --git a/tests/tseqcon.nim b/tests/tseqcon.nim old mode 100644 new mode 100755 diff --git a/tests/tsets.nim b/tests/tsets.nim old mode 100644 new mode 100755 diff --git a/tests/tsimmeth.nim b/tests/tsimmeth.nim old mode 100644 new mode 100755 diff --git a/tests/tsimtych.nim b/tests/tsimtych.nim old mode 100644 new mode 100755 diff --git a/tests/tsizeof.nim b/tests/tsizeof.nim old mode 100644 new mode 100755 diff --git a/tests/tstatret.nim b/tests/tstatret.nim old mode 100644 new mode 100755 diff --git a/tests/tstmtexp.nim b/tests/tstmtexp.nim old mode 100644 new mode 100755 diff --git a/tests/tstrace.nim b/tests/tstrace.nim old mode 100644 new mode 100755 diff --git a/tests/tstrange.nim b/tests/tstrange.nim old mode 100644 new mode 100755 diff --git a/tests/tstrdesc.nim b/tests/tstrdesc.nim old mode 100644 new mode 100755 diff --git a/tests/tstrdist.nim b/tests/tstrdist.nim old mode 100644 new mode 100755 diff --git a/tests/tstreams.nim b/tests/tstreams.nim old mode 100644 new mode 100755 diff --git a/tests/tstrset.nim b/tests/tstrset.nim old mode 100644 new mode 100755 diff --git a/tests/tstrtabs.nim b/tests/tstrtabs.nim old mode 100644 new mode 100755 diff --git a/tests/tstrutil.nim b/tests/tstrutil.nim old mode 100644 new mode 100755 diff --git a/tests/ttempl.nim b/tests/ttempl.nim old mode 100644 new mode 100755 diff --git a/tests/ttempl2.nim b/tests/ttempl2.nim old mode 100644 new mode 100755 diff --git a/tests/ttempl3.nim b/tests/ttempl3.nim old mode 100644 new mode 100755 index 39262497c..0c8fa9a94 --- a/tests/ttempl3.nim +++ b/tests/ttempl3.nim @@ -1,12 +1,13 @@ -template withOpenFile(f, filename, mode: expr, actions: stmt): stmt = +template withOpenFile(f: expr, filename: string, mode: TFileMode, + actions: stmt): stmt = block: var f: TFile - if openFile(f, filename, mode): + if open(f, filename, mode): try: actions finally: - closeFile(f) + close(f) else: quit("cannot open for writing: " & filename) diff --git a/tests/ttime.nim b/tests/ttime.nim old mode 100644 new mode 100755 diff --git a/tests/tvardecl.nim b/tests/tvardecl.nim old mode 100644 new mode 100755 diff --git a/tests/tvarious.nim b/tests/tvarious.nim old mode 100644 new mode 100755 diff --git a/tests/tvarnums.nim b/tests/tvarnums.nim old mode 100644 new mode 100755 diff --git a/tests/twalker.nim b/tests/twalker.nim old mode 100644 new mode 100755 diff --git a/tests/typalias.nim b/tests/typalias.nim old mode 100644 new mode 100755 diff --git a/tests/typredef.nim b/tests/typredef.nim old mode 100644 new mode 100755 diff --git a/tests/wingui.nim b/tests/wingui.nim old mode 100644 new mode 100755 diff --git a/tests/x11test.nim b/tests/x11test.nim old mode 100644 new mode 100755 diff --git a/tests/xmltest.html b/tests/xmltest.html old mode 100644 new mode 100755 diff --git a/tools/build.tmpl b/tools/build.tmpl new file mode 100755 index 000000000..3ac9252a3 --- /dev/null +++ b/tools/build.tmpl @@ -0,0 +1,97 @@ +#subsChar ? +#proc GenerateBuildScript(c: TConfigData): string = +# result = "#! /bin/sh\n# Generated by niminst\n" +CC="gcc" +LINKER="gcc" +COMP_FLAGS="-w -O3 -fno-strict-aliasing" +LINK_FLAGS="" +# add(result, "# platform detection\n") +ucpu=`uname -m` +uos=`uname` + +# add(result, "# convert to lower case:\n") +upcu=`echo $ucpu | tr "[:upper:]" "[:lower:]"` +uos=`echo $uos | tr "[:upper:]" "[:lower:]"` + +case $uos in + *linux* ) + myos="linux" + LINK_FLAGS="$LINK_FLAGS -ldl -lm" + ;; + *freebsd* ) + myos="freebsd" + LINK_FLAGS="$LINK_FLAGS -lm" + ;; + *openbsd* ) + myos="openbsd" + LINK_FLAGS="$LINK_FLAGS -lm" + ;; + *netbsd* ) + myos="netbsd" + LINK_FLAGS="$LINK_FLAGS -lm" + ;; + *darwin* ) + myos="macosx" + LINK_FLAGS="$LINK_FLAGS -ldl -lm" + ;; + *aix* ) + myos="aix" + LINK_FLAGS="$LINK_FLAGS -ldl -lm" + ;; + *solaris* | *sun* ) + myos="solaris" + LINK_FLAGS="$LINK_FLAGS -ldl -lm" + ;; + *) + echo "Error: unknown operating system: $uos" + exit 1 + ;; +esac + +case $ucpu in + *i386* | *i486* | *i586* | *i686* ) + mycpu="i386" ;; + *amd*64* | *x86-64* | *x86_64* ) + mycpu="amd64" ;; + *sparc*|*sun* ) + mycpu="sparc" ;; + *power* ) + mycpu="powerpc" ;; + *mips* ) + mycpu="mips" ;; + *) + echo "Error: unknown processor: $ucpu" + exit 1 + ;; +esac + +# add(result, "# write ``build/platdef.c`` file\n") +cat >build/platdef.c < (treated like '/opt')" + exit 1 + ;; + "/usr/bin") + bindir=/usr/bin + configdir=/etc + libdir=/usr/lib/?proj + docdir=/usr/share/?proj/doc + datadir=/usr/share/?proj/data + ;; + "/usr/local/bin") + bindir=/usr/local/bin + configdir=/etc + libdir=/usr/local/lib/?proj + docdir=/usr/local/share/?proj/doc + datadir=/usr/local/share/?proj/data + ;; + *) + bindir="$1/?proj/bin" + configdir="$1/?proj/config" + libdir="$1/?proj/lib" + docdir="$1/?proj/doc" + datadir="$1/?proj/data" + ;; + esac + echo "removing files..." + +#for f in items(c.cat[fcUnixBin]): + rm -f $bindir/?f.skipRoot +#end for +#for f in items(c.cat[fcConfig]): + rm -f $configdir/?f.skipRoot +#end for + rm -rf $docdir + rm -rf $datadir + rm -rf $libdir + + echo "deinstallation successful" +else + echo "?c.name deinstallation script" + echo "Usage: [sudo] sh deinstall.sh DIR" + echo "Where DIR may be:" + echo " /usr/bin" + echo " /usr/local/bin" + echo " /opt" + echo " (treated like '/opt')" + exit 1 +fi diff --git a/tools/inno.tmpl b/tools/inno.tmpl old mode 100644 new mode 100755 diff --git a/tools/install.tmpl b/tools/install.tmpl old mode 100644 new mode 100755 diff --git a/tools/niminst.nim b/tools/niminst.nim old mode 100644 new mode 100755 index fc7421b7c..13024b68f --- a/tools/niminst.nim +++ b/tools/niminst.nim @@ -96,7 +96,7 @@ include "deinstall.tmpl" # ------------------------- configuration file ------------------------------- const - Version = "0.6" + Version = "0.7" Usage = "niminst - Nimrod Installation Generator Version " & version & """ (c) 2009 Andreas Rumpf @@ -175,7 +175,7 @@ proc pathFlags(p: var TCfgParser, k, v: string, proc filesOnly(p: var TCfgParser, k, v: string, dest: var seq[string]) = case normalize(k) - of "files": addFiles(dest, splitSeq(v, {';'})) + of "files": addFiles(dest, split(v, {';'})) else: quit(errorStr(p, "unknown variable: " & k)) proc yesno(p: var TCfgParser, v: string): bool = @@ -208,9 +208,9 @@ proc parseIniFile(c: var TConfigData) = case normalize(k.key) of "name": c.name = v of "version": c.version = v - of "os": c.oses = splitSeq(v, {';'}) - of "cpu": c.cpus = splitSeq(v, {';'}) - of "authors": c.authors = splitSeq(v, {';'}) + of "os": c.oses = split(v, {';'}) + of "cpu": c.cpus = split(v, {';'}) + of "authors": c.authors = split(v, {';'}) of "description": c.description = v of "app": case normalize(v) @@ -228,13 +228,13 @@ proc parseIniFile(c: var TConfigData) = of "other": filesOnly(p, k.key, v, c.cat[fcOther]) of "windows": case normalize(k.key) - of "files": addFiles(c.cat[fcWindows], splitSeq(v, {';'})) - of "binpath": c.binPaths = splitSeq(v, {';'}) + of "files": addFiles(c.cat[fcWindows], split(v, {';'})) + of "binpath": c.binPaths = split(v, {';'}) of "innosetup": c.innoSetupFlag = yesno(p, v) else: quit(errorStr(p, "unknown variable: " & k.key)) of "unix": case normalize(k.key) - of "files": addFiles(c.cat[fcUnix], splitSeq(v, {';'})) + of "files": addFiles(c.cat[fcUnix], split(v, {';'})) of "installscript": c.installScript = yesno(p, v) of "uninstallscript": c.uninstallScript = yesno(p, v) else: quit(errorStr(p, "unknown variable: " & k.key)) @@ -279,10 +279,12 @@ proc readCFiles(c: var TConfigData, osA, cpuA: int) = proc buildDir(os, cpu: int): string = return "build" / ($os & "_" & $cpu) -proc writeFile(filename, content: string) = +proc writeFile(filename, content, newline: string) = var f: TFile if open(f, filename, fmWrite): - writeln(f, content) + for x in splitLines(content): + write(f, x) + write(f, newline) close(f) else: quit("Cannot open for writing: " & filename) @@ -299,7 +301,7 @@ proc srcdist(c: var TConfigData) = " --os:$# --cpu:$# $# $#") % [c.oses[osA-1], c.cpus[cpuA-1], c.nimrodArgs, changeFileExt(c.infile, "nim")] - echo("Executing: " & cmd) + echo(cmd) if executeShellCommand(cmd) != 0: quit("Error: call to nimrod compiler failed") readCFiles(c, osA, cpuA) @@ -322,19 +324,23 @@ proc srcdist(c: var TConfigData) = # file is identical, so delete duplicate: RemoveFile(dup) c.cfiles[osA][cpuA][i] = orig - writeFile(buildShFile, GenerateBuildScript(c)) + writeFile(buildShFile, GenerateBuildScript(c), "\10") + if c.installScript: + writeFile(installShFile, GenerateInstallScript(c), "\10") + if c.uninstallScript: + writeFile(deinstallShFile, GenerateDeinstallScript(c), "\10") # --------------------- generate inno setup ----------------------------------- proc setupDist(c: var TConfigData) = var scrpt = GenerateInnoSetup(c) var n = "build" / "install_$#_$#.iss" % [toLower(c.name), c.version] - writeFile(n, scrpt) + writeFile(n, scrpt, "\13\10") when defined(windows): if c.innoSetup.path.len == 0: c.innoSetup.path = "iscc.exe" var outcmd = if c.outdir.len == 0: "build" else: c.outdir var cmd = "$# $# /O$# $#" % [c.innoSetup.path, c.innoSetup.flags, outcmd, n] - Echo("Executing: " & cmd) + Echo(cmd) if executeShellCommand(cmd) == 0: removeFile(n) else: @@ -343,11 +349,6 @@ proc setupDist(c: var TConfigData) = # ------------------ generate ZIP file --------------------------------------- when haveZipLib: proc zipDist(c: var TConfigData) = - if c.installScript: - writeFile(installShFile, GenerateInstallScript(c)) - if c.uninstallScript: - writeFile(deinstallShFile, GenerateDeinstallScript(c)) - var proj = toLower(c.name) var n = "$#_$#.zip" % [proj, c.version] if c.outdir.len == 0: n = "build" / n diff --git a/tools/nimweb.nim b/tools/nimweb.nim old mode 100644 new mode 100755 index 8feec2913..5ba5799f9 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -1,6 +1,6 @@ # # -# The Nimrod Website Generator +# Nimrod Website Generator # (c) Copyright 2009 Andreas Rumpf # # See the file "copying.txt", included in this @@ -131,9 +131,9 @@ proc parseIniFile(c: var TConfigData) = of "ticker": c.ticker = v of "documentation": case normalize(k.key) - of "doc": addFiles(c.doc, "doc", ".txt", splitSeq(v, {';'})) - of "srcdoc": addFiles(c.srcdoc, "lib", ".nim", splitSeq(v, {';'})) - of "webdoc": addFiles(c.webdoc, "lib", ".nim", splitSeq(v, {';'})) + of "doc": addFiles(c.doc, "doc", ".txt", split(v, {';'})) + of "srcdoc": addFiles(c.srcdoc, "lib", ".nim", split(v, {';'})) + of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'})) else: quit(errorStr(p, "unknown variable: " & k.key)) else: nil @@ -159,6 +159,7 @@ proc buildDoc(c: var TConfigData, destPath: string) = Exec("nimrod rst2html $# -o:$# --index=$#/theindex $#" % [c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"), destpath, d]) + Exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d]) for d in items(c.srcdoc): Exec("nimrod doc $# -o:$# --index=$#/theindex $#" % [c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"), diff --git a/tools/sunset.tmpl b/tools/sunset.tmpl old mode 100644 new mode 100755 diff --git a/tools/trimcc.nim b/tools/trimcc.nim new file mode 100755 index 000000000..f946256c9 --- /dev/null +++ b/tools/trimcc.nim @@ -0,0 +1,28 @@ +# Trim C compiler installation to a minimum + +import strutils, os + +proc newName(f: string): string = + return extractDir(f) / "trim_" & extractFilename(f) + +proc walker(dir: string) = + for kind, path in walkDir(dir): + case kind + of pcFile: + moveFile(newName(path), path) + # test if installation still works: + if executeShellCommand(r"nimrod c --force_build tests\tlastmod") == 0: + echo "Optional: ", path + removeFile(newName(path)) + else: + echo "Required: ", path + # copy back: + moveFile(path, newName(path)) + of pcDirectory: + walker(path) + else: nil + +if paramCount() == 1: + walker(paramStr(1)) +else: + echo "Usage: trimcc c_compiler_directory" diff --git a/unix2dos.py b/unix2dos.py old mode 100644 new mode 100755 diff --git a/web/community.txt b/web/community.txt new file mode 100755 index 000000000..2cf85ce70 --- /dev/null +++ b/web/community.txt @@ -0,0 +1,6 @@ +Discuss Nimrod in our `forum `_. + +Visit our project page at Launchpad: https://launchpad.net/nimrod. + +Bug reports: https://bugs.launchpad.net/nimrod. + diff --git a/web/documentation.txt b/web/documentation.txt new file mode 100755 index 000000000..da0313c32 --- /dev/null +++ b/web/documentation.txt @@ -0,0 +1 @@ +.. include:: ../doc/docs.txt diff --git a/web/download.txt b/web/download.txt new file mode 100755 index 000000000..c1a70bd63 --- /dev/null +++ b/web/download.txt @@ -0,0 +1,17 @@ + There are two major products that come out of Berkeley: LSD and UNIX. + We don't believe this to be a coincidence. -- Jeremy S. Anderson. + +Here you can download the latest version of the Nimrod Compiler. +Please choose your platform: +* source-based installation: ``_ +* installer for Windows XP/Vista (i386): ``_ + (includes GCC and everything else you need) + +The source-based installation has been tested on these systems: +* Linux: i386, AMD64 +* Mac OS X: i386 + +Other UNIX-based operating systems may work. An older version was tested on +FreeBSD (i386). + +.. include:: ../install.txt diff --git a/web/index.txt b/web/index.txt new file mode 100755 index 000000000..5bc48801d --- /dev/null +++ b/web/index.txt @@ -0,0 +1,127 @@ +==== +Home +==== + + The most important thing in the programming language is the name. A language + will not succeed without a good name. I have recently invented a very good + name and now I am looking for a suitable language. + -- D. E. Knuth + + +**This page is about the Nimrod programming language, which combines Lisp's +power with Python's readability and C's performance.** + +Welcome to Nimrod +----------------- + +.. container:: snippet + *Nimrod looks like this:* + + .. code-block:: nimrod + # Filter key=value pairs + import regexprs + + for x in lines("myfile.txt"): + if x =~ r"(\w+)=(.*)": + echo "Key: ", matches[1], + " Value: ", matches[2] + +**Nimrod** is a new statically typed, imperative +programming language, that supports procedural, object oriented, functional +and generic programming styles while remaining simple and efficient. +A special feature that Nimrod inherited from Lisp is that Nimrod's abstract +syntax tree (*AST*) is part of the specification - this allows a powerful +macro system which allows domain specific languages. + +Nimrod is a compiled, garbage-collected systems programming language +which has an excellent productivity/performance ratio. Nimrod's design +focuses on the 3E: efficiency, expressiveness, elegance (in the order of +priority). + + +Nimrod is efficient +=================== + +* Native code generation (currently via compilation to C), not dependant on a + virtual machine: **Nimrod produces small executables without dependencies + for easy redistribution.** +* A fast non-recursive incremental and generational garbage collector that + should be well suited for soft real-time systems (like games). +* System programming features: Ability to manage your own memory and access the + hardware directly. Pointers to garbage collected memory are distinguished + from pointers to manually managed memory. +* Zero-overhead iterators. +* Cross-module inlining. +* Compile time evaluation of user-defined functions. +* Whole program dead code elimination: Only *used functions* are included in + the executable. +* Value-based datatypes: For instance, objects and arrays can be allocated on + the stack. + + +Nimrod is expressive +==================== + +* Built-in high level datatypes: strings, sets, sequences, etc. +* Modern type system with local type inference, tuples, variants, + generics, etc. +* User-defineable operators; code with new operators is often easier to read + than code which overloads built-in operators. In the code snippet, the + ``=~`` operator is defined in the ``regexprs`` module. +* Macros can modify the abstract syntax tree at compile time. + + +Nimrod is elegant +================= + +* Macros cannot change Nimrod's syntax because there is no need for it. + Nimrod's syntax is flexible enough. +* Yet Nimrod can be parsed with an LL(1) parser. +* Statements are grouped by indentation but can span multiple lines. + Indentation must not contain tabulators so **the compiler always sees + the code the same way as you do**. +* Nimrod is a simple language that leads to simple programs. However, + the language is not crippled in the name of simplicity. + + +Nimrod plays nice with others +============================= + +* The Nimrod Compiler runs on Windows, Linux, BSD and Mac OS X. + Porting to other platforms is easy. +* **There are bindings to GTK2, the Windows API, the POSIX API, OpenGL, SDL, + Cario, Python, Lua, TCL, X11, libzip, PRCE, ODBC, libcurl, mySQL and SQLite.** + New bindings are easily generated in a semi-automatic way. +* A Pascal to Nimrod conversion utility: A large subset of Object Pascal + can be translated to Nimrod automatically! +* Nimrod's documentation syntax is a subset of the wonderfully readable plaintext + markup syntax + `reStructuredText `_. + **The documentation generator is very flexible; this website has been generated + with it!** + + + +Roadmap to 1.0 +============== + +Version 0.8.4 + * general expressions as generic parameters + * multimethods + +Version 0.9.0 + * closures and anonymous procs + * provide an API for object serialization + +Version 1.0.0 + * stress testing with a better test suite + * fix symbol files to make the compiler incremental + + +Planned features beyond 1.0 +=========================== + +* Threading with a transactional memory modell (the type system may be + enhanced to support extensive compile-time checks for this) +* Recursive iterators/coroutines +* Other code generators: LLVM, EcmaScript diff --git a/web/links.txt b/web/links.txt new file mode 100755 index 000000000..e69de29bb diff --git a/web/news.txt b/web/news.txt new file mode 100755 index 000000000..0896023dc --- /dev/null +++ b/web/news.txt @@ -0,0 +1,368 @@ +==== +News +==== + + +2009-09-12 Date Version 0.8.0 released +====================================== + +Bugfixes +-------- +- fixed a small bug that caused the compiler to not report unused + overloaded symbols +- fixed a small bug concerning symbol overloading +- fixed a typo: it's "ambiguous", not "ambigious" ;-) +- the compiler now detects recursive include files +- ``system.card`` should work again +- ``items`` for ``set[char]`` and ``array[char, T]`` should work now + + +Additions +--------- + +- implemented generic types and two phase symbol lookup in generic routines +- template parameters can now be real types +- implemented generalized raw string literals: ``ident"abc"`` is a shortcut for + ``ident(r"abc")`` +- in overloading resolution iterators are separated from procs; iterators now + can have the same name+signature as procs +- symbol lookup in templates can be affected by the new ``bind`` keyword +- the compiler now accepts a ``--no_main`` switch for better link + interoperability with other compiled languages +- implemented tuple unpacking in ``var`` sections +- the code generator emits ``default: __assume(0);`` for Visual C++ + (for optimization) +- the compiler now checks if a proc has side effects; procs that are declared + to have no side effects are rejected if the compiler cannot verify this +- the format operator ``strutils.%`` now supports ``$#`` for automatic argument + counting +- implemented ``strutils.join`` + + +Changes affecting backwards compability +--------------------------------------- + +- two phase symbol lookup is performed in generic routines +- ``bind`` is now a reserved word; ``exception`` is no reserved word anymore +- abstract types have been renamed to distinct types; thus + ``distinct`` is now a reserved word; ``abstract`` is no reserved word anymore +- ``system.openFile`` deprecated: use ``system.open`` instead +- ``system.closeFile`` deprecated: use ``system.close`` instead +- ``strutils.replaceStr`` deprecated: use ``strutils.replace`` instead +- ``strutils.deleteStr`` deprecated: use ``strutils.delete`` instead +- ``strutils.splitSeq`` deprecated: use ``strutils.split`` instead +- ``strutils.splitLinesSeq`` deprecated: use ``strutils.splitLines`` instead +- ``strutils.parseFloat`` does not accept an additional ``start`` parameter + anymore + + +Documentation +------------- + +- the manual has been improved + + + +2009-06-08 Version 0.7.10 released +================================== + +Nimrod version 0.7.10 has been released! Get it `here <./download.html>`_. + +Bugfixes +-------- + +- fixed bug #374441, #376113 +- the posix module works for Mac OS X again +- returning an array should now work +- fixed a serious bug in several parsers: the cached buf pointer + must be updated after a reallocation of the buffer +- fixed a CSS bug that kept Firefox from rendering parts of + the generated documentation properly +- fixed a bug concerning evaluation of command statements +- overloading of ``inc``, ``dec``, ``pred``, ``succ`` should now work +- ``removeDir`` now works as the documentation says: it even removes + directories that are not empty + + +Additions +--------- + +* zero argument templates/macros can now be invoked without ``()``, + because this is not ambiguous +* new modules in the library: + - ``dynlib``: load symbols from a shared library + - ``python``: wrapper for the Python programming language + - ``tcl``: wrapper for the TCL programming language +* added ``system.max``, ``system.min`` for open arrays +* added ``system.each`` built-in +* added ``os.getFilePermissions``, ``os.setFilePermissions``, + ``os.inclFilePermissions``, ``os.exclFilePermissions`` +* the ``dynlib`` import mechanism now supports a flexible versioning scheme: + + .. code-block:: nimrod + + proc Tcl_Eval(interp: pTcl_Interp, script: cstring): int {.cdecl, + importc, dynlib: "libtcl(8.5|8.4|8.3|8.2|8.1).so.(1|0)".} + +* implemented ``abstract`` types + + +Changes affecting backwards compability +--------------------------------------- + +- the organization within the ``lib`` folder now reflects the documentation; + as a result old configuration files need to be updated +- ``abstract`` is now a reserved keyword +- ``echo`` is now a built-in macro that accepts a variable numer of + arguments of different types (and calls ``$`` for the arguments that need + it); as a result it cannot be overloaded anymore +- ``where`` is no keyword anymore +- installation on UNIX produces a release version of the compiler + + +2009-05-08 Version 0.7.8 released +================================= + +Nimrod version 0.7.8 has been released! +Apart from bugfixes and added libraries the biggest change is that Nimrod +now has a new memory manager which: + +- interacts much better with the GC +- uses less memory +- is faster than the old memory manager (``dlmalloc``) +- releases memory back to the operating system + + +Bugfixes +-------- + +- generics are now processed earlier in the pipeline; thus + generics can be used within macros +- changed bootstrapping in ``koch.py`` and ``boot.nim`` to fix + bug #369607 +- the compiler now checks that ``yield`` is used inside a loop +- fixed a bug in the evaluation code for ``system.len``, + ``system.setlen`` and ``system.newSeq`` +- overflow checking for ``newSeq`` fixes a security issue + + +Additions +--------- + +- new module: ``parsecsv`` for parsing CSV files +- new module: ``xmlgen`` for generating XML or HTML +- new module: ``osproc`` for OS process communication +- added ``math.TRunningStat`` object and its methods +- added ``strutils.validIdentifier`` +- the reStructuredText parser now supports the ``container`` directive that + translates to the HTML ``div`` element +- the ``cgi`` module registers a handler, so that stack traces contain the + HTML ``
    `` element making CGI applications easier to debug +- added the ``cgi.decodeData`` iterator +- ``copy`` and ``newString`` can now be evaluated at compile time. As a + result more procedures from the ``strutils`` module can be evaluated at + compile time. +- ``macros.error`` now prints a stack trace +- Nimrod now supports the Boehm-Demers-Weiser conservative garbage collector: + The ``--gc:boehm`` command line switch activates it. However, the native + Nimrod collector is faster! + + +Documentation +------------- + +- Nimrod's abstract syntax trees are now documented in the + `macros `_ module. Unfortunately the documentation is still + incomplete. + + +2009-04-22 Version 0.7.6 released +================================= + +Nimrod version 0.7.6 has been released! +This is mostly a bugfix release. Some new features and libraries have +also been implemented. + +Bugfixes +-------- + +- installation on Windows Vista may now work out of the box; please try! +- fixed a bug that kept the "recursive modules" example from working +- mixing named and unnamed parameters in a procedure call now works +- octal numbers with the prefix ``0c`` are now properly supported +- enumerations now may start with negative values +- ``parseInt``, ``ParseBiggestInt`` now throw an exception if the + string does not end after the parsed number +- the compiler now handles top-level statements correctly +- generated ``nimcache`` directory never ends in a slash +- ``createDir`` now works for global directories under UNIX ("/somepath/here") +- the compiler now executes the executable with a leading "./" under UNIX +- the compiler now supports constant arrays of procedure pointers +- ``elif`` in ``case`` statements now works +- iterators using an open array parameter now work +- fixed a bug where in some contexts ``$myEnum`` did not work + + +Additions +--------- +- implemented the passing of a code-block to the last parameter of a + template/macro: + + .. code-block:: nimrod + + template withFile(f, filename, mode: expr, + actions: stmt): stmt = + block: + var f: TFile + if openFile(f, filename, mode): + try: + actions + finally: + closeFile(f) + else: + quit("cannot open: " & filename) + + withFile(txt, "ttempl3.txt", fmWrite): + txt.writeln("line 1") + txt.writeln("line 2") + +- new pragma ``deprecated`` can be used to mark deprecated identifiers +- added ``system.pop`` built-in for sequences +- added ``addf``, ``addSep`` and ``validEmailAddress`` to the + ``strutils`` module +- nice ``=~`` template operator for the ``regexprs`` module +- the scoping rules for ``for``, ``while``, ``if``, ``case`` changed + in a subtle way to support the new ``=~`` template +- added common regular expressions for regexprs +- ``posix`` module now declares socket stuff +- new module: ``cgi`` for creating CGI applications +- new module: ``terminal`` for simple terminal output customization +- new module: ``parsexml`` for HTML/XML parsing with some support for + parsing *dirty* HTML +- new module: ``web`` for retrieving web pages +- new module: ``md5`` for computation of MD5 checksums +- new wrappers: ``mysql``, ``sqlite3``, ``libcurl`` + + +Changes affecting backwards compability +--------------------------------------- + +- ``strutils.findSubStr``, ``strutils.findChars`` deprecated: + use ``strutils.find`` instead + + +Documentation +------------- + +- The library is now divided into *pure libraries*, *impure libraries* + and *wrappers*. + + +2009-01-22 Forum added +====================== +We now have a `forum `_ where you can discuss +Nimrod. + + +2009-01-07 Version 0.7.4 released +================================= + +Nimrod version 0.7.4 has been released! + +Bugfixes +-------- + +- installation on Windows should work now if the directory contains spaces +- the documentation generator now only renders documentation comments +- ``\`` is allowed for operators as the manual says +- in rare cases, the index check has been optimized away, even though + it would have been necessary +- several bugfixes for tuple types + +Additions +--------- + +- added an ``unicode`` module for UTF-8 handling +- added ``hostOS`` and ``hostCPU`` magics to the ``system`` module +- ``system.echo`` now accepts multiple arguments +- added optimization: in some cases inlining of iterators now produces + substantially better code +- added whole program dead code elimination +- the magic ``$`` operator now works for enumerations +- in ``const`` sections advanced compile time evaluation is done: + +.. code-block:: nimrod + proc fac(n: int): int = + if n <= 1: return 1 + else: return n*(fac(n-1)) + + const + z = fac(3) # computes 6 at compile time + +Changes affecting backwards compability +--------------------------------------- + +- renamed ``in_Operator`` to ``contains``: ``in`` is now a template that + translates to ``contains`` +- changed ``strutils.quoteIfSpaceExists`` to ``strutils.quoteIfContainsWhite`` +- the parser is now much more picky about missings commas, etc. If this affects + your code too much, try to run your code through the pretty printer. +- the ``macros`` API is no longer part of the ``system`` module, to use this + API you now have to import the ``macros`` module + +Documentation +------------- + +- added a tutorial + + + +2008-12-12 Version 0.7.2 released +================================= + +Nimrod version 0.7.2 has been released! This is a bugfix release. This most +important fix is that Nimrod now works again on AMD64 (x86_64) processors. No +new features have been implemented. + + +2008-11-16 Version 0.7.0 released +================================= + +Nimrod version 0.7.0 has been released! +Changes: +* various bug fixes, too many to list them here +* the installation for UNIX-based systems does not depend on Python any longer +* the ``koch.py`` script now works with older Python versions (including 1.5.2) +* changed integer operations and conversions rules +* added ``GC_ref`` and ``GC_unref`` procs +* sequences now need to be constructed with the ``@`` operator. This leads to + less ambiguities. +* the compiler now uses less memory and is much faster +* the GC is now much faster +* new bindings: zlib, SDL, Xlib, OpenGL, ODBC, Lua +* the generated C code is much faster to optimize with GCC +* new libraries: streams, zipfiles +* the Nimrod compiler has been ported to FreeBSD: it should work on + other BSD's too + + +2008-08-22 Version 0.6.0 released +================================= + +Nimrod version 0.6.0 has been released! +**This is the first version of the compiler that is able to compile itself!** +A nice side-effect from this is that a source-based installation does not +depend on FreePascal any longer. + +Changes: +* various bug fixes, too many to list them here +* cleaned up the type system: records are now superfluous and not + supported anymore +* improved the performance of the garbage collector +* new modules in the library: + - ``parseopt``: a simple to use command line parser + - ``hashes``: efficient computation of hash values + - ``strtabs``: efficient mapping from strings to strings + - ``parsecfg``: an efficient configuration file parser +* macros and compile-time evaluation implemented (however, still experimental) +* generics implemented (however, still experimental) diff --git a/web/nimrod.ini b/web/nimrod.ini new file mode 100755 index 000000000..4bb611c71 --- /dev/null +++ b/web/nimrod.ini @@ -0,0 +1,41 @@ +[Project] +Name: "Nimrod" +Title: "Nimrod Programming Language" +Logo: "efficient, expressive, elegant" +Authors: "Andreas Rumpf" + +[Links] +GCC: "http://gcc.gnu.org" +LLVM: "http://llvm.org" + +[Tabs] +# Menu entry: filename +home: index +news: news +docs: documentation +download: download +community: community +FAQ: question + +[Ticker] +file: ticker + +[Documentation] +doc: "endb;intern;lib;manual;tut1;tut2;nimrodc;overview" +srcdoc: "system.nim;pure/os;pure/strutils;pure/regexprs;pure/math" +srcdoc: "pure/complex;pure/times;pure/osproc" +srcdoc: "pure/parseopt;pure/hashes;pure/strtabs;pure/lexbase" +srcdoc: "pure/parsecfg;pure/parsexml;pure/parsecsv" +srcdoc: "pure/streams;pure/terminal;pure/cgi;impure/web;pure/unicode" +srcdoc: "impure/zipfiles;pure/xmlgen;pure/macros" + +webdoc: "wrappers/libcurl;pure/md5;wrappers/mysql" +webdoc: "wrappers/sqlite3;wrappers/python;wrappers/tcl" + +webdoc: "posix/posix;wrappers/odbcsql;impure/dialogs" +webdoc: "wrappers/zip/zlib;wrappers/zip/libzip" +webdoc: "wrappers/cairo" +webdoc: "wrappers/gtk" +webdoc: "windows" +webdoc: "wrappers/x11;wrappers/opengl;wrappers/sdl;wrappers/lua" + diff --git a/web/question.txt b/web/question.txt new file mode 100755 index 000000000..83edfda72 --- /dev/null +++ b/web/question.txt @@ -0,0 +1,107 @@ +=========================================== + Questions and Answers +=========================================== + + +General +======= + +What is Nimrod? +--------------- + +Nimrod is a new statically typed, imperative +programming language, that supports procedural, functional, object oriented and +generic programming styles while remaining simple and efficient. A special +feature that Nimrod inherited from Lisp is that Nimrod's abstract syntax tree +(*AST*) is part of the specification - this allows a powerful macro system which +can be used to create domain specific languages. Nimrod does not sacrifice +flexibility for speed. You get both. + +How is Nimrod licensed? +----------------------- + +The Nimrod compiler is GPL licensed, the runtime library is LGPL licensed. +This means that you can use any license for your own programs developed with +Nimrod. If I receive enough requests with good arguments, I may change the +license of Nimrod to the BSD license. + +How stable is Nimrod? +--------------------- + +The compiler is in development and some important features are still missing. +However, the compiler is quite stable already: It is able to compile itself +and a substantial body of other code. Until version 1.0.0 is released, slight +incompabilities with older versions of the compiler may be introduced. + + +Compilation +=========== + +Execution of GCC fails (Windows) +-------------------------------- + +On Windows the configuration file ``config\nimrod.cfg`` assumes that GCC is in +``$nimrod\dist\mingw\bin``: This is where the Windows installer puts GCC. +If you delete the line ``gcc.path = r"$nimrod\dist\mingw\bin"``, Nimrod uses +the GCC from your ``PATH`` environment variable. + +If you cannot modify ``$nimrod\config\nimrod.cfg``, copy +``$nimrod\config\nimrod.cfg`` to ``$APPDATA\nimrod.cfg`` and modify +``$APPDATA\nimrod.cfg`` instead. To determine what ``$APPDATA`` means for your +Windows account, use the shell command:: + + echo %APPDATA% + + + +How do I use a different C compiler than the default one? +--------------------------------------------------------- + +Edit the ``config/nimrod.cfg`` file. +Change the value of the ``cc`` variable to one of the following: + +============== ============================================ +Abbreviation C/C++ Compiler +============== ============================================ +``dmc`` Digital Mars C++ +``wcc`` Watcom C++ (now unsupported!) +``bcc`` Borland C++ (now unsupported!) +``vcc`` Microsoft's Visual C++ +``gcc`` Gnu C +``pcc`` Pelles C (now unsupported!) +``lcc`` Lcc-win32 (now unsupported!) +``tcc`` Tiny C +``llvm_gcc`` LLVM-GCC compiler +``icc`` Intel C++ compiler +``ucc`` Generic UNIX C compiler +============== ============================================ + +If your C compiler is not in the above list, try using the +*generic UNIX C compiler* (``ucc``). If the C compiler needs +different command line arguments try the ``--passc`` and ``--passl`` switches. +Unsupported compilers contain serious bugs that keep them from bootstrapping +Nimrod. + +The linker outputs strange errors about missing symbols +------------------------------------------------------- + +I have seen this bug only with the GNU linker. The reason for this unknown. +Try recompiling your code with the ``--force_build`` command line switch. + + +Why is compilation so slow? +--------------------------- + +There are two reasons for this: + +(1) Nimrod always recompiles **everything** (but only calls the C compiler for + modules that changed). In a future version, only modules that have changed + will be recompiled. +(2) The C compiler that is called by Nimrod may be slow. + Especially GCC's compile times are not very heady. On Linux you may be able + to get `Tiny C `_ to work. TCC has excellent + compile times. You should not use TCC for producing the release version + though, as it has no optimizer. + +Note that from version 0.7.10 onwards the default build produces an optimized +binary. diff --git a/web/snippets/snippet1.nim b/web/snippets/snippet1.nim new file mode 100755 index 000000000..05359a0e0 --- /dev/null +++ b/web/snippets/snippet1.nim @@ -0,0 +1,4 @@ +import strutils +echo "Give a list of integers (separated by spaces): ", + stdin.readLine.splitSeq.each(parseInt).max, + " is the maximum!" diff --git a/web/ticker.txt b/web/ticker.txt new file mode 100755 index 000000000..61e5e40fd --- /dev/null +++ b/web/ticker.txt @@ -0,0 +1,31 @@ +| `2009-09-12`:newsdate: +| Nimrod version 0.8.0 has been released! + Get it `here <./download.html>`_. + +| `2009-06-08`:newsdate: +| Nimrod version 0.7.10 has been released! + +| `2009-05-08`:newsdate: +| Nimrod version 0.7.8 has been released! + +| `2009-04-22`:newsdate: +| Nimrod version 0.7.6 has been released! + +| `2009-01-22`:newsdate: +| Forum added! + +| `2009-01-07`:newsdate: +| Nimrod version 0.7.4 has been released! + +| `2008-12-12`:newsdate: +| Nimrod version 0.7.2 has been released! + +| `2008-11-16`:newsdate: +| Nimrod version 0.7.0 has been released! + +| `2008-08-22`:newsdate: +| Nimrod version 0.6.0 has been released! + +| `2008-06-22`:newsdate: +| This page is finally online! + diff --git a/whiteutils.py b/whiteutils.py old mode 100644 new mode 100755