diff options
-rw-r--r-- | .gitignore | 397 | ||||
-rw-r--r-- | compiler/aliases.nim | 14 | ||||
-rw-r--r-- | compiler/ast.nim | 169 | ||||
-rw-r--r-- | compiler/astalgo.nim | 310 | ||||
-rw-r--r-- | compiler/babelcmd.nim | 10 | ||||
-rw-r--r-- | compiler/bitsets.nim | 40 | ||||
-rw-r--r-- | compiler/c2nim/c2nim.nim | 24 | ||||
-rw-r--r-- | compiler/c2nim/clex.nim | 100 | ||||
-rw-r--r-- | compiler/c2nim/cparse.nim | 789 | ||||
-rw-r--r-- | compiler/c2nim/cpp.nim | 12 | ||||
-rw-r--r-- | compiler/c2nim/tests/vincent.c | 33 | ||||
-rw-r--r-- | compiler/c2nim/tests/vincent.h | 3 | ||||
-rw-r--r-- | compiler/ccgcalls.nim | 16 | ||||
-rw-r--r-- | compiler/ccgexprs.nim | 290 | ||||
-rw-r--r-- | compiler/ccgmerge.nim | 33 | ||||
-rw-r--r-- | compiler/ccgstmts.nim | 134 | ||||
-rw-r--r-- | compiler/ccgthreadvars.nim | 6 | ||||
-rw-r--r-- | compiler/ccgtrav.nim | 8 | ||||
-rw-r--r-- | compiler/ccgtypes.nim | 96 | ||||
-rw-r--r-- | compiler/ccgutils.nim | 49 | ||||
-rw-r--r-- | compiler/cgen.nim | 338 | ||||
-rw-r--r-- | compiler/cgendata.nim | 17 | ||||
-rw-r--r-- | compiler/cgmeth.nim | 24 | ||||
-rw-r--r-- | compiler/commands.nim | 209 | ||||
-rw-r--r-- | compiler/condsyms.nim | 76 | ||||
-rw-r--r-- | compiler/crc.nim | 14 | ||||
-rw-r--r-- | compiler/depends.nim | 4 | ||||
-rw-r--r-- | compiler/docgen.nim | 320 | ||||
-rw-r--r-- | compiler/docgen2.nim | 4 | ||||
-rw-r--r-- | compiler/evalffi.nim | 138 | ||||
-rw-r--r-- | compiler/evals.nim | 21 | ||||
-rw-r--r-- | compiler/evaltempl.nim | 59 | ||||
-rw-r--r-- | compiler/extccomp.nim | 147 | ||||
-rw-r--r-- | compiler/filter_tmpl.nim | 112 | ||||
-rw-r--r-- | compiler/filters.nim | 30 | ||||
-rw-r--r-- | compiler/guards.nim | 12 | ||||
-rw-r--r-- | compiler/hlo.nim | 8 | ||||
-rw-r--r-- | compiler/idents.nim | 2 | ||||
-rw-r--r-- | compiler/idgen.nim | 14 | ||||
-rw-r--r-- | compiler/importer.nim | 46 | ||||
-rw-r--r-- | compiler/jsgen.nim | 143 | ||||
-rw-r--r-- | compiler/jstypes.nim | 8 | ||||
-rw-r--r-- | compiler/lambdalifting.nim | 512 | ||||
-rw-r--r-- | compiler/lexer.nim | 232 | ||||
-rw-r--r-- | compiler/lists.nim | 58 | ||||
-rw-r--r-- | compiler/llstream.nim | 97 | ||||
-rw-r--r-- | compiler/lookups.nim | 123 | ||||
-rw-r--r-- | compiler/magicsys.nim | 33 | ||||
-rw-r--r-- | compiler/main.nim | 219 | ||||
-rw-r--r-- | compiler/modules.nim | 28 | ||||
-rw-r--r-- | compiler/msgs.nim | 177 | ||||
-rw-r--r-- | compiler/nimconf.nim | 37 | ||||
-rw-r--r-- | compiler/nimlexbase.nim | 45 | ||||
-rw-r--r-- | compiler/nimrod.dot | 591 | ||||
-rw-r--r-- | compiler/nimrod.nim | 38 | ||||
-rw-r--r-- | compiler/nimrod.nimrod.cfg (renamed from compiler/nimrod.cfg) | 6 | ||||
-rw-r--r-- | compiler/nimsets.nim | 38 | ||||
-rw-r--r-- | compiler/options.nim | 40 | ||||
-rw-r--r-- | compiler/parampatterns.nim | 14 | ||||
-rw-r--r-- | compiler/parser.nim | 267 | ||||
-rw-r--r-- | compiler/pas2nim/pas2nim.nim | 2 | ||||
-rw-r--r-- | compiler/pas2nim/paslex.nim | 74 | ||||
-rw-r--r-- | compiler/pas2nim/pasparse.nim | 52 | ||||
-rw-r--r-- | compiler/passaux.nim | 8 | ||||
-rw-r--r-- | compiler/passes.nim | 8 | ||||
-rw-r--r-- | compiler/patterns.nim | 16 | ||||
-rw-r--r-- | compiler/pbraces.nim | 2 | ||||
-rw-r--r-- | compiler/platform.nim | 20 | ||||
-rw-r--r-- | compiler/pragmas.nim | 272 | ||||
-rw-r--r-- | compiler/pretty.nim | 178 | ||||
-rw-r--r-- | compiler/procfind.nim | 54 | ||||
-rw-r--r-- | compiler/renderer.nim | 139 | ||||
-rw-r--r-- | compiler/rodread.nim | 158 | ||||
-rw-r--r-- | compiler/rodutils.nim | 6 | ||||
-rw-r--r-- | compiler/rodwrite.nim | 54 | ||||
-rw-r--r-- | compiler/ropes.nim | 67 | ||||
-rw-r--r-- | compiler/saturate.nim | 12 | ||||
-rw-r--r-- | compiler/sem.nim | 182 | ||||
-rw-r--r-- | compiler/semcall.nim | 58 | ||||
-rw-r--r-- | compiler/semdata.nim | 88 | ||||
-rw-r--r-- | compiler/semdestruct.nim | 99 | ||||
-rw-r--r-- | compiler/semexprs.nim | 407 | ||||
-rw-r--r-- | compiler/semfold.nim | 115 | ||||
-rw-r--r-- | compiler/semgnrc.nim | 33 | ||||
-rw-r--r-- | compiler/seminst.nim | 182 | ||||
-rw-r--r-- | compiler/semmacrosanity.nim | 89 | ||||
-rw-r--r-- | compiler/semmagic.nim | 39 | ||||
-rw-r--r-- | compiler/sempass2.nim | 30 | ||||
-rw-r--r-- | compiler/semstmts.nim | 326 | ||||
-rw-r--r-- | compiler/semtempl.nim | 142 | ||||
-rw-r--r-- | compiler/semthreads.nim | 43 | ||||
-rw-r--r-- | compiler/semtypes.nim | 447 | ||||
-rw-r--r-- | compiler/semtypinst.nim | 351 | ||||
-rw-r--r-- | compiler/service.nim | 12 | ||||
-rw-r--r-- | compiler/sigmatch.nim | 718 | ||||
-rw-r--r-- | compiler/suggest.nim | 55 | ||||
-rw-r--r-- | compiler/syntaxes.nim | 60 | ||||
-rw-r--r-- | compiler/testability.nim | 5 | ||||
-rw-r--r-- | compiler/transf.nim | 102 | ||||
-rw-r--r-- | compiler/trees.nim | 40 | ||||
-rw-r--r-- | compiler/treetab.nim | 36 | ||||
-rw-r--r-- | compiler/types.nim | 458 | ||||
-rw-r--r-- | compiler/vm.nim | 649 | ||||
-rw-r--r-- | compiler/vmdef.nim | 42 | ||||
-rw-r--r-- | compiler/vmdeps.nim | 61 | ||||
-rw-r--r-- | compiler/vmgen.nim | 536 | ||||
-rw-r--r-- | compiler/wordrecg.nim | 19 | ||||
-rw-r--r-- | config/nimdoc.cfg | 2 | ||||
-rw-r--r-- | config/nimdoc.tex.cfg | 2 | ||||
-rw-r--r-- | config/nimrod.cfg | 11 | ||||
-rw-r--r-- | copying.txt | 2 | ||||
-rw-r--r-- | devel/logging.nim | 210 | ||||
-rw-r--r-- | doc/docgen.txt | 192 | ||||
-rw-r--r-- | doc/docgen_sample.nim | 12 | ||||
-rw-r--r-- | doc/gc.txt | 19 | ||||
-rw-r--r-- | doc/grammar.txt | 33 | ||||
-rw-r--r-- | doc/idetools.txt | 20 | ||||
-rw-r--r-- | doc/intern.txt | 2 | ||||
-rw-r--r-- | doc/keywords.txt | 3 | ||||
-rw-r--r-- | doc/lib.txt | 119 | ||||
-rw-r--r-- | doc/manual.txt | 477 | ||||
-rw-r--r-- | doc/nimrodc.txt | 20 | ||||
-rw-r--r-- | doc/subexes.txt | 4 | ||||
-rw-r--r-- | doc/tut1.txt | 143 | ||||
-rw-r--r-- | doc/tut2.txt | 308 | ||||
-rw-r--r-- | examples/cairoex.nim | 15 | ||||
-rw-r--r-- | examples/cgi/cgi_server.py | 11 | ||||
-rw-r--r-- | examples/cgi/cgi_stacktrace.nim | 5 | ||||
-rw-r--r-- | examples/cgi/example.nim | 7 | ||||
-rw-r--r-- | examples/gtk/ex1.nim | 14 | ||||
-rw-r--r-- | examples/gtk/ex2.nim | 22 | ||||
-rw-r--r-- | examples/gtk/ex3.nim | 34 | ||||
-rw-r--r-- | examples/gtk/ex4.nim | 29 | ||||
-rw-r--r-- | examples/gtk/ex5.nim | 24 | ||||
-rw-r--r-- | examples/gtk/ex6.nim | 50 | ||||
-rw-r--r-- | examples/gtk/ex7.nim | 46 | ||||
-rw-r--r-- | examples/gtk/ex8.nim | 29 | ||||
-rw-r--r-- | examples/gtk/ex9.nim | 49 | ||||
-rw-r--r-- | examples/luaex.nim | 15 | ||||
-rw-r--r-- | examples/pythonex.nim | 11 | ||||
-rw-r--r-- | examples/tclex.nim | 25 | ||||
-rw-r--r-- | examples/x11ex.nim | 71 | ||||
-rw-r--r-- | install.txt | 6 | ||||
-rw-r--r-- | koch.nim | 44 | ||||
-rw-r--r-- | lib/core/locks.nim | 50 | ||||
-rw-r--r-- | lib/core/macros.nim | 116 | ||||
-rw-r--r-- | lib/impure/db_mongo.nim | 10 | ||||
-rw-r--r-- | lib/impure/db_mysql.nim | 24 | ||||
-rw-r--r-- | lib/impure/db_postgres.nim | 37 | ||||
-rw-r--r-- | lib/impure/db_sqlite.nim | 46 | ||||
-rw-r--r-- | lib/impure/dialogs.nim | 8 | ||||
-rw-r--r-- | lib/impure/graphics.nim | 2 | ||||
-rw-r--r-- | lib/impure/osinfo_win.nim | 44 | ||||
-rw-r--r-- | lib/impure/rdstdin.nim | 10 | ||||
-rw-r--r-- | lib/impure/re.nim | 66 | ||||
-rw-r--r-- | lib/impure/zipfiles.nim | 4 | ||||
-rw-r--r-- | lib/packages/docutils/highlite.nim | 22 | ||||
-rw-r--r-- | lib/packages/docutils/rst.nim | 94 | ||||
-rw-r--r-- | lib/packages/docutils/rstast.nim | 10 | ||||
-rw-r--r-- | lib/packages/docutils/rstgen.nim | 153 | ||||
-rw-r--r-- | lib/posix/posix.nim | 1285 | ||||
-rw-r--r-- | lib/pure/actors.nimrod.cfg (renamed from lib/pure/actors.cfg) | 0 | ||||
-rw-r--r-- | lib/pure/algorithm.nim | 37 | ||||
-rw-r--r-- | lib/pure/asyncio.nim | 27 | ||||
-rw-r--r-- | lib/pure/base64.nim | 242 | ||||
-rw-r--r-- | lib/pure/browsers.nim | 10 | ||||
-rw-r--r-- | lib/pure/cgi.nim | 36 | ||||
-rw-r--r-- | lib/pure/collections/LockFreeHash.nim | 582 | ||||
-rw-r--r-- | lib/pure/collections/baseutils.nim | 41 | ||||
-rw-r--r-- | lib/pure/collections/intsets.nim | 22 | ||||
-rw-r--r-- | lib/pure/collections/lists.nim | 8 | ||||
-rw-r--r-- | lib/pure/collections/sequtils.nim | 41 | ||||
-rw-r--r-- | lib/pure/collections/sets.nim | 55 | ||||
-rw-r--r-- | lib/pure/collections/tables.nim | 88 | ||||
-rw-r--r-- | lib/pure/dynlib.nim | 20 | ||||
-rw-r--r-- | lib/pure/encodings.nim | 72 | ||||
-rw-r--r-- | lib/pure/endians.nim | 14 | ||||
-rw-r--r-- | lib/pure/fsmonitor.nim | 10 | ||||
-rw-r--r-- | lib/pure/ftpclient.nim | 24 | ||||
-rw-r--r-- | lib/pure/hashes.nim | 12 | ||||
-rw-r--r-- | lib/pure/htmlgen.nim | 2 | ||||
-rw-r--r-- | lib/pure/htmlparser.nim | 34 | ||||
-rw-r--r-- | lib/pure/httpclient.nim | 3 | ||||
-rw-r--r-- | lib/pure/httpserver.nim | 5 | ||||
-rw-r--r-- | lib/pure/irc.nim | 14 | ||||
-rw-r--r-- | lib/pure/json.nim | 75 | ||||
-rw-r--r-- | lib/pure/lexbase.nim | 38 | ||||
-rw-r--r-- | lib/pure/logging.nim | 267 | ||||
-rw-r--r-- | lib/pure/matchers.nim | 2 | ||||
-rw-r--r-- | lib/pure/math.nim | 8 | ||||
-rw-r--r-- | lib/pure/md5.nim | 60 | ||||
-rw-r--r-- | lib/pure/memfiles.nim | 52 | ||||
-rw-r--r-- | lib/pure/mersenne.nim | 39 | ||||
-rw-r--r-- | lib/pure/oids.nim | 8 | ||||
-rw-r--r-- | lib/pure/os.nim | 819 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 458 | ||||
-rw-r--r-- | lib/pure/parsecfg.nim | 72 | ||||
-rw-r--r-- | lib/pure/parsecsv.nim | 2 | ||||
-rw-r--r-- | lib/pure/parseopt.nim | 15 | ||||
-rw-r--r-- | lib/pure/parseopt2.nim | 148 | ||||
-rw-r--r-- | lib/pure/parsesql.nim | 6 | ||||
-rw-r--r-- | lib/pure/parseutils.nim | 20 | ||||
-rw-r--r-- | lib/pure/pegs.nim | 136 | ||||
-rw-r--r-- | lib/pure/scgi.nim | 2 | ||||
-rw-r--r-- | lib/pure/smtp.nim | 4 | ||||
-rw-r--r-- | lib/pure/sockets.nim | 240 | ||||
-rw-r--r-- | lib/pure/streams.nim | 6 | ||||
-rw-r--r-- | lib/pure/strtabs.nim | 24 | ||||
-rw-r--r-- | lib/pure/strutils.nim | 2228 | ||||
-rw-r--r-- | lib/pure/terminal.nim | 86 | ||||
-rw-r--r-- | lib/pure/times.nim | 51 | ||||
-rw-r--r-- | lib/pure/unicode.nim | 94 | ||||
-rw-r--r-- | lib/pure/unittest.nim | 25 | ||||
-rw-r--r-- | lib/pure/xmlparser.nim | 4 | ||||
-rw-r--r-- | lib/system.nim | 381 | ||||
-rw-r--r-- | lib/system/alloc.nim | 94 | ||||
-rw-r--r-- | lib/system/ansi_c.nim | 85 | ||||
-rw-r--r-- | lib/system/assign.nim | 54 | ||||
-rw-r--r-- | lib/system/atomics.nim | 241 | ||||
-rw-r--r-- | lib/system/avltree.nim | 10 | ||||
-rw-r--r-- | lib/system/cellsets.nim | 54 | ||||
-rw-r--r-- | lib/system/channels.nim | 29 | ||||
-rw-r--r-- | lib/system/chcks.nim | 4 | ||||
-rw-r--r-- | lib/system/dyncalls.nim | 17 | ||||
-rw-r--r-- | lib/system/excpt.nim | 56 | ||||
-rw-r--r-- | lib/system/gc.nim | 103 | ||||
-rw-r--r-- | lib/system/gc2.nim | 3 | ||||
-rw-r--r-- | lib/system/gc_ms.nim | 28 | ||||
-rw-r--r-- | lib/system/hti.nim | 2 | ||||
-rw-r--r-- | lib/system/jssys.nim | 6 | ||||
-rw-r--r-- | lib/system/mmdisp.nim | 102 | ||||
-rw-r--r-- | lib/system/repr.nim | 32 | ||||
-rw-r--r-- | lib/system/sysio.nim | 68 | ||||
-rw-r--r-- | lib/system/syslocks.nim | 57 | ||||
-rw-r--r-- | lib/system/sysstr.nim | 26 | ||||
-rw-r--r-- | lib/system/threads.nim | 65 | ||||
-rw-r--r-- | lib/system/widestrs.nim | 300 | ||||
-rw-r--r-- | lib/windows/windows.nim | 19 | ||||
-rw-r--r-- | lib/windows/winlean.nim | 288 | ||||
-rw-r--r-- | lib/wrappers/cairo/cairo.nim | 733 | ||||
-rw-r--r-- | lib/wrappers/cairo/cairo_pragma.nim | 16 | ||||
-rw-r--r-- | lib/wrappers/cairo/cairoft.nim | 36 | ||||
-rw-r--r-- | lib/wrappers/cairo/cairowin32.nim | 37 | ||||
-rw-r--r-- | lib/wrappers/cairo/cairoxlib.nim | 41 | ||||
-rw-r--r-- | lib/wrappers/gtk/atk.nim | 1308 | ||||
-rw-r--r-- | lib/wrappers/gtk/gdk2.nim | 3873 | ||||
-rw-r--r-- | lib/wrappers/gtk/gdk2pixbuf.nim | 271 | ||||
-rw-r--r-- | lib/wrappers/gtk/gdkglext.nim | 554 | ||||
-rw-r--r-- | lib/wrappers/gtk/glib2.nim | 4540 | ||||
-rw-r--r-- | lib/wrappers/gtk/gtk2.nim | 17064 | ||||
-rw-r--r-- | lib/wrappers/gtk/gtkglext.nim | 53 | ||||
-rw-r--r-- | lib/wrappers/gtk/gtkhtml.nim | 523 | ||||
-rw-r--r-- | lib/wrappers/gtk/libglade2.nim | 111 | ||||
-rw-r--r-- | lib/wrappers/gtk/pango.nim | 1160 | ||||
-rw-r--r-- | lib/wrappers/gtk/pangoutils.nim | 42 | ||||
-rw-r--r-- | lib/wrappers/libffi/common/ffi.h | 331 | ||||
-rw-r--r-- | lib/wrappers/libffi/common/ffi_common.h | 77 | ||||
-rw-r--r-- | lib/wrappers/libffi/common/fficonfig.h | 96 | ||||
-rw-r--r-- | lib/wrappers/libffi/common/ffitarget.h | 150 | ||||
-rw-r--r-- | lib/wrappers/libffi/common/malloc_closure.c | 110 | ||||
-rw-r--r-- | lib/wrappers/libffi/common/raw_api.c | 254 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/closures.c | 627 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/ffi.c | 841 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/ffi64.c | 673 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/prep_cif.c | 237 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/types.c | 77 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/win32_asm.asm | 759 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/win32_asm.s | 736 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/win64_asm.asm | 467 | ||||
-rw-r--r-- | lib/wrappers/libffi/gcc/win64_asm.s | 227 | ||||
-rw-r--r-- | lib/wrappers/libffi/libffi.nim (renamed from lib/wrappers/libffi.nim) | 80 | ||||
-rw-r--r-- | lib/wrappers/libffi/msvc/ffi.c | 457 | ||||
-rw-r--r-- | lib/wrappers/libffi/msvc/prep_cif.c | 175 | ||||
-rw-r--r-- | lib/wrappers/libffi/msvc/types.c | 104 | ||||
-rw-r--r-- | lib/wrappers/libffi/msvc/win32.c | 162 | ||||
-rw-r--r-- | lib/wrappers/libffi/msvc/win32_asm.asm | 470 | ||||
-rw-r--r-- | lib/wrappers/libffi/msvc/win64_asm.asm | 156 | ||||
-rw-r--r-- | lib/wrappers/lua/lauxlib.nim | 208 | ||||
-rw-r--r-- | lib/wrappers/lua/lua.nim | 364 | ||||
-rw-r--r-- | lib/wrappers/lua/lualib.nim | 64 | ||||
-rw-r--r-- | lib/wrappers/mongo.nim | 52 | ||||
-rw-r--r-- | lib/wrappers/mysql.nim | 4 | ||||
-rw-r--r-- | lib/wrappers/opengl/gl.nim | 1536 | ||||
-rw-r--r-- | lib/wrappers/opengl/glext.nim | 4673 | ||||
-rw-r--r-- | lib/wrappers/opengl/glu.nim | 335 | ||||
-rw-r--r-- | lib/wrappers/opengl/glut.nim | 438 | ||||
-rw-r--r-- | lib/wrappers/opengl/glx.nim | 153 | ||||
-rw-r--r-- | lib/wrappers/opengl/opengl.nim | 9708 | ||||
-rw-r--r-- | lib/wrappers/opengl/wingl.nim | 368 | ||||
-rw-r--r-- | lib/wrappers/openssl.nim | 24 | ||||
-rw-r--r-- | lib/wrappers/pcre.nim | 18 | ||||
-rw-r--r-- | lib/wrappers/python.nim | 1587 | ||||
-rw-r--r-- | lib/wrappers/tcl.nim | 865 | ||||
-rw-r--r-- | lib/wrappers/x11/cursorfont.nim | 110 | ||||
-rw-r--r-- | lib/wrappers/x11/keysym.nim | 1926 | ||||
-rw-r--r-- | lib/wrappers/x11/x.nim | 401 | ||||
-rw-r--r-- | lib/wrappers/x11/x11pragma.nim | 20 | ||||
-rw-r--r-- | lib/wrappers/x11/xatom.nim | 81 | ||||
-rw-r--r-- | lib/wrappers/x11/xcms.nim | 396 | ||||
-rw-r--r-- | lib/wrappers/x11/xf86dga.nim | 235 | ||||
-rw-r--r-- | lib/wrappers/x11/xf86vmode.nim | 229 | ||||
-rw-r--r-- | lib/wrappers/x11/xi.nim | 307 | ||||
-rw-r--r-- | lib/wrappers/x11/xinerama.nim | 25 | ||||
-rw-r--r-- | lib/wrappers/x11/xkb.nim | 2387 | ||||
-rw-r--r-- | lib/wrappers/x11/xkblib.nim | 661 | ||||
-rw-r--r-- | lib/wrappers/x11/xlib.nim | 2027 | ||||
-rw-r--r-- | lib/wrappers/x11/xrandr.nim | 194 | ||||
-rw-r--r-- | lib/wrappers/x11/xrender.nim | 241 | ||||
-rw-r--r-- | lib/wrappers/x11/xresource.nim | 200 | ||||
-rw-r--r-- | lib/wrappers/x11/xshm.nim | 77 | ||||
-rw-r--r-- | lib/wrappers/x11/xutil.nim | 412 | ||||
-rw-r--r-- | lib/wrappers/x11/xv.nim | 84 | ||||
-rw-r--r-- | lib/wrappers/x11/xvlib.nim | 234 | ||||
-rw-r--r-- | lib/wrappers/zip/libzip.nim | 108 | ||||
-rw-r--r-- | readme.md | 12 | ||||
-rw-r--r-- | readme.txt | 12 | ||||
-rw-r--r-- | tests/actiontable/tactiontable.nim (renamed from tests/run/tactiontable.nim) | 0 | ||||
-rw-r--r-- | tests/actiontable/tactiontable2.nim (renamed from tests/reject/tactiontable2.nim) | 14 | ||||
-rw-r--r-- | tests/alias/talias.nim (renamed from tests/compile/talias.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsym1.nim (renamed from tests/reject/mambsym1.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsym2.nim (renamed from tests/reject/mambsym2.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsys1.nim (renamed from tests/run/mambsys1.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/mambsys2.nim (renamed from tests/run/mambsys2.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsym.nim (renamed from tests/reject/tambsym.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsym2.nim (renamed from tests/run/tambsym2.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsym3.nim (renamed from tests/reject/tambsym3.nim) | 0 | ||||
-rw-r--r-- | tests/ambsym/tambsys.nim (renamed from tests/run/tambsys.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarray.nim (renamed from tests/run/tarray.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarray2.nim (renamed from tests/run/tarray2.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarray3.nim (renamed from tests/run/tarray3.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarraycons.nim (renamed from tests/reject/tarraycons.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarraycons2.nim (renamed from tests/run/tarraycons.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarrayplus.nim (renamed from tests/reject/tarrayplus.nim) | 0 | ||||
-rw-r--r-- | tests/array/tarrindx.nim (renamed from tests/compile/tarrindx.nim) | 0 | ||||
-rw-r--r-- | tests/assert/tassert.nim (renamed from tests/run/tassert.nim) | 0 | ||||
-rw-r--r-- | tests/assert/tfailedassert.nim | 51 | ||||
-rw-r--r-- | tests/assert/tunittests.nim | 1 | ||||
-rw-r--r-- | tests/assert/tuserassert.nim (renamed from tests/run/tuserassert.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tassign.nim (renamed from tests/compile/tassign.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tcopy.nim (renamed from tests/run/tcopy.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tgenericassign.nim (renamed from tests/run/tgenericassign.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tgenericassigntuples.nim (renamed from tests/run/tgenericassigntuples.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tobjasgn.nim (renamed from tests/run/tobjasgn.nim) | 0 | ||||
-rw-r--r-- | tests/assign/tvariantasgn.nim (renamed from tests/run/tvariantasgn.nim) | 0 | ||||
-rw-r--r-- | tests/astoverload/tastoverload1.nim (renamed from tests/run/tastoverload1.nim) | 0 | ||||
-rw-r--r-- | tests/async/tasynciossl.nim (renamed from tests/run/tasynciossl.nim) | 0 | ||||
-rw-r--r-- | tests/async/tasyncudp.nim (renamed from tests/run/tasyncudp.nim) | 0 | ||||
-rw-r--r-- | tests/bind/mbind3.nim (renamed from tests/run/mbind3.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbind1.nim (renamed from tests/run/tbind1.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbind2.nim (renamed from tests/reject/tbind2.nim) | 2 | ||||
-rw-r--r-- | tests/bind/tbind3.nim (renamed from tests/run/tbind3.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbindoverload.nim (renamed from tests/compile/tbindoverload.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tbindtypedesc.nim (renamed from tests/reject/tbindtypedesc.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tdatabind.nim (renamed from tests/compile/tdatabind.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tmixin.nim (renamed from tests/run/tmixin.nim) | 0 | ||||
-rw-r--r-- | tests/bind/tnicerrorforsymchoice.nim (renamed from tests/reject/tnicerrorforsymchoice.nim) | 0 | ||||
-rw-r--r-- | tests/borrow/tborrow.nim (renamed from tests/run/tborrow.nim) | 0 | ||||
-rw-r--r-- | tests/borrow/tinvalidborrow.nim (renamed from tests/reject/tinvalidborrow.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcase_setconstr.nim (renamed from tests/run/tcase_setconstr.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcaseexpr1.nim (renamed from tests/reject/tcaseexpr1.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcaseoverlaprange.nim (renamed from tests/reject/tcaseoverlaprange.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcaseoverlaprange2.nim (renamed from tests/reject/tcaseoverlaprange2.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcasestm.nim (renamed from tests/run/tcasestm.nim) | 0 | ||||
-rw-r--r-- | tests/casestmt/tcomputedgoto.nim (renamed from tests/compile/tcomputedgoto.nim) | 31 | ||||
-rw-r--r-- | tests/casestmt/tlinearscanend.nim (renamed from tests/compile/tlinearscanend.nim) | 0 | ||||
-rw-r--r-- | tests/ccgbugs/tccgen1.nim (renamed from tests/compile/tccgen1.nim) | 0 | ||||
-rw-r--r-- | tests/ccgbugs/tcgbug.nim (renamed from tests/run/tcgbug.nim) | 0 | ||||
-rw-r--r-- | tests/ccgbugs/tcodegenbug1.nim (renamed from tests/compile/tcodegenbug1.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure.nim (renamed from tests/run/tclosure.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure2.nim (renamed from tests/run/tclosure2.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure3.nim (renamed from tests/run/tclosure3.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosure4.nim (renamed from tests/compile/tclosure4.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tclosurebug2.nim (renamed from tests/compile/tclosurebug2.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tinterf.nim (renamed from tests/run/tinterf.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tinvalidclosure.nim (renamed from tests/reject/tinvalidclosure.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tinvalidclosure2.nim (renamed from tests/reject/tinvalidclosure2.nim) | 0 | ||||
-rw-r--r-- | tests/closure/tnamedparamanonproc.nim (renamed from tests/compile/tnamedparamanonproc.nim) | 4 | ||||
-rw-r--r-- | tests/closure/tnestedproc.nim (renamed from tests/compile/tnestedproc.nim) | 0 | ||||
-rw-r--r-- | tests/closure/uclosures.nim (renamed from tests/run/uclosures.nim) | 0 | ||||
-rw-r--r-- | tests/cnstseq/tcnstseq.nim (renamed from tests/run/tcnstseq.nim) | 0 | ||||
-rw-r--r-- | tests/cnstseq/tcnstseq2.nim (renamed from tests/run/tcnstseq2.nim) | 0 | ||||
-rw-r--r-- | tests/cnstseq/tcnstseq3.nim (renamed from tests/run/tcnstseq3.nim) | 0 | ||||
-rw-r--r-- | tests/collections/ttables.nim | 22 | ||||
-rw-r--r-- | tests/compile/mvarious.nim | 6 | ||||
-rw-r--r-- | tests/compile/sunset.tmpl | 68 | ||||
-rw-r--r-- | tests/compile/tambsym2.nim | 6 | ||||
-rw-r--r-- | tests/compile/tbindtypedesc.nim | 87 | ||||
-rw-r--r-- | tests/compile/tcmdline.nim | 14 | ||||
-rw-r--r-- | tests/compile/tcolonisproc.nim | 12 | ||||
-rw-r--r-- | tests/compile/tdllvar.nim | 16 | ||||
-rw-r--r-- | tests/compile/temptyecho.nim | 2 | ||||
-rw-r--r-- | tests/compile/tendian.nim | 3 | ||||
-rw-r--r-- | tests/compile/tfib.nim | 11 | ||||
-rw-r--r-- | tests/compile/tgenericshardcases.nim | 30 | ||||
-rw-r--r-- | tests/compile/tgetstartmilsecs.nim | 7 | ||||
-rw-r--r-- | tests/compile/tgtk.nim | 51 | ||||
-rw-r--r-- | tests/compile/thallo.nim | 85 | ||||
-rw-r--r-- | tests/compile/theaproots.nim | 71 | ||||
-rw-r--r-- | tests/compile/tlastmod.nim | 18 | ||||
-rw-r--r-- | tests/compile/tlibs.nim | 24 | ||||
-rw-r--r-- | tests/compile/tloops.nim | 87 | ||||
-rw-r--r-- | tests/compile/tmandelbrot.nim | 57 | ||||
-rw-r--r-- | tests/compile/tnew.nim | 49 | ||||
-rw-r--r-- | tests/compile/tnewlibs.nim | 17 | ||||
-rw-r--r-- | tests/compile/tnewsets.nim | 6 | ||||
-rw-r--r-- | tests/compile/tnewuns.nim | 12 | ||||
-rw-r--r-- | tests/compile/tnoforward.nim | 10 | ||||
-rw-r--r-- | tests/compile/tparedef.nim | 4 | ||||
-rw-r--r-- | tests/compile/tprep.nim | 30 | ||||
-rw-r--r-- | tests/compile/tquicksort.nim | 26 | ||||
-rw-r--r-- | tests/compile/tradix.nim | 319 | ||||
-rw-r--r-- | tests/compile/treadln.nim | 12 | ||||
-rw-r--r-- | tests/compile/treadx.nim | 14 | ||||
-rw-r--r-- | tests/compile/tshadow_magic_type.nim | 24 | ||||
-rw-r--r-- | tests/compile/tsizeof.nim | 10 | ||||
-rw-r--r-- | tests/compile/tstrace.nim | 16 | ||||
-rw-r--r-- | tests/compile/tstrdesc.nim | 14 | ||||
-rw-r--r-- | tests/compile/tstrdist.nim | 26 | ||||
-rw-r--r-- | tests/compile/tvarious.nim | 63 | ||||
-rw-r--r-- | tests/compiles/tcompiles.nim (renamed from tests/compile/tcompiles.nim) | 0 | ||||
-rw-r--r-- | tests/concat/tconcat.nim (renamed from tests/run/tconcat.nim) | 0 | ||||
-rw-r--r-- | tests/concurrency/tnodeadlocks.nim (renamed from tests/run/tnodeadlocks.nim) | 0 | ||||
-rw-r--r-- | tests/constr/tconstr1.nim (renamed from tests/reject/tconstr1.nim) | 0 | ||||
-rw-r--r-- | tests/constr/tconstr2.nim (renamed from tests/run/tconstr2.nim) | 0 | ||||
-rw-r--r-- | tests/constraints/tconstraints.nim (renamed from tests/reject/tconstraints.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tblock1.nim (renamed from tests/reject/tblock1.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tcontinue.nim (renamed from tests/run/tcontinue.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tnestif.nim (renamed from tests/run/tnestif.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tstatret.nim (renamed from tests/reject/tstatret.nim) | 0 | ||||
-rw-r--r-- | tests/converter/tconvcolors.nim (renamed from tests/compile/tconvcolors.nim) | 0 | ||||
-rw-r--r-- | tests/converter/tconvert.nim (renamed from tests/compile/tconvert.nim) | 0 | ||||
-rw-r--r-- | tests/converter/tgenericconverter.nim (renamed from tests/run/tgenericconverter.nim) | 0 | ||||
-rw-r--r-- | tests/converter/ttypeconverter1.nim (renamed from tests/compile/ttypeconverter1.nim) | 0 | ||||
-rw-r--r-- | tests/defaultprocparam/mdefaultprocparam.nim (renamed from tests/compile/mdefaultprocparam.nim) | 0 | ||||
-rw-r--r-- | tests/defaultprocparam/tdefaultprocparam.nim (renamed from tests/compile/tdefaultprocparam.nim) | 0 | ||||
-rw-r--r-- | tests/deprecated/tdeprecated.nim (renamed from tests/reject/tdeprecated.nim) | 0 | ||||
-rw-r--r-- | tests/destructor/tdestructor.nim | 84 | ||||
-rw-r--r-- | tests/destructor/tdestructor2.nim (renamed from tests/reject/tdestructor.nim) | 0 | ||||
-rw-r--r-- | tests/destructor/tdictdestruct.nim (renamed from tests/compile/tdictdestruct.nim) | 0 | ||||
-rw-r--r-- | tests/discard/tdiscardable.nim (renamed from tests/compile/tdiscardable.nim) | 0 | ||||
-rw-r--r-- | tests/discard/tneedsdiscard.nim (renamed from tests/reject/tneedsdiscard.nim) | 0 | ||||
-rw-r--r-- | tests/distinct/tcurrncy.nim (renamed from tests/run/tcurrncy.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects1.nim (renamed from tests/reject/teffects1.nim) | 2 | ||||
-rw-r--r-- | tests/effects/teffects2.nim (renamed from tests/reject/teffects2.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects3.nim (renamed from tests/reject/teffects3.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects4.nim (renamed from tests/reject/teffects4.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects5.nim (renamed from tests/reject/teffects5.nim) | 0 | ||||
-rw-r--r-- | tests/effects/teffects6.nim (renamed from tests/compile/teffects1.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee1.nim (renamed from tests/reject/tsidee1.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee2.nim (renamed from tests/run/tsidee2.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee3.nim (renamed from tests/run/tsidee3.nim) | 0 | ||||
-rw-r--r-- | tests/effects/tsidee4.nim (renamed from tests/reject/tsidee4.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenum.nim (renamed from tests/compile/tenum.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenum2.nim (renamed from tests/compile/tenum2.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenum3.nim (renamed from tests/compile/tenum3.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenumhole.nim (renamed from tests/run/tenumhole.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenumitems.nim (renamed from tests/reject/tenumitems.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenumitems2.nim (renamed from tests/run/tenumitems.nim) | 0 | ||||
-rw-r--r-- | tests/enum/tenummix.nim (renamed from tests/reject/tenummix.nim) | 4 | ||||
-rw-r--r-- | tests/enum/tnamedenumfields.nim (renamed from tests/run/tnamedenumfields.nim) | 0 | ||||
-rw-r--r-- | tests/enum/toptions.nim (renamed from tests/compile/toptions.nim) | 4 | ||||
-rw-r--r-- | tests/exception/tcontinuexc.nim (renamed from tests/run/tcontinuexc.nim) | 0 | ||||
-rw-r--r-- | tests/exception/texceptions.nim (renamed from tests/run/texceptions.nim) | 0 | ||||
-rw-r--r-- | tests/exception/texcpt1.nim (renamed from tests/run/texcpt1.nim) | 0 | ||||
-rw-r--r-- | tests/exception/texcsub.nim (renamed from tests/run/texcsub.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tfinally.nim (renamed from tests/run/tfinally.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tfinally2.nim (renamed from tests/run/tfinally2.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tfinally3.nim (renamed from tests/run/tfinally3.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tonraise.nim (renamed from tests/run/tonraise.nim) | 0 | ||||
-rw-r--r-- | tests/exception/treraise.nim (renamed from tests/run/treraise.nim) | 0 | ||||
-rw-r--r-- | tests/exception/tunhandledexc.nim (renamed from tests/run/tunhandledexc.nim) | 0 | ||||
-rw-r--r-- | tests/exception/twrongexc.nim (renamed from tests/run/twrongexc.nim) | 0 | ||||
-rw-r--r-- | tests/exprs/texprstmt.nim (renamed from tests/reject/texprstmt.nim) | 0 | ||||
-rw-r--r-- | tests/exprs/tstmtexp.nim (renamed from tests/reject/tstmtexp.nim) | 0 | ||||
-rw-r--r-- | tests/exprs/tstmtexprs.nim (renamed from tests/run/tstmtexprs.nim) | 19 | ||||
-rw-r--r-- | tests/fields/tfieldindex.nim (renamed from tests/run/tfieldindex.nim) | 0 | ||||
-rw-r--r-- | tests/fields/tfielditerator.nim (renamed from tests/run/tfielditerator.nim) | 0 | ||||
-rw-r--r-- | tests/fields/tfielditerator2.nim (renamed from tests/run/tfielditerator2.nim) | 0 | ||||
-rw-r--r-- | tests/float/tfloat1.nim (renamed from tests/run/tfloat1.nim) | 0 | ||||
-rw-r--r-- | tests/float/tfloat2.nim (renamed from tests/run/tfloat2.nim) | 0 | ||||
-rw-r--r-- | tests/float/tfloat3.nim (renamed from tests/run/tfloat3.nim) | 0 | ||||
-rw-r--r-- | tests/friends/mfriends.nim (renamed from tests/run/mfriends.nim) | 0 | ||||
-rw-r--r-- | tests/friends/tfriends.nim (renamed from tests/run/tfriends.nim) | 0 | ||||
-rw-r--r-- | tests/gc/gcleak4.nim | 2 | ||||
-rw-r--r-- | tests/gc/gcleak5.nim | 25 | ||||
-rw-r--r-- | tests/generics/tbintre2.nim (renamed from tests/run/tbintre2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tbintree.nim (renamed from tests/run/tbintree.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_alias_generic.nim (renamed from tests/compile/tcan_alias_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_alias_specialised_generic.nim (renamed from tests/compile/tcan_alias_specialised_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_inherit_generic.nim (renamed from tests/compile/tcan_inherit_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tcan_specialise_generic.nim (renamed from tests/compile/tcan_specialise_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/texplicitgeneric1.nim (renamed from tests/run/texplicitgeneric1.nim) | 0 | ||||
-rw-r--r-- | tests/generics/texplicitgeneric2.nim (renamed from tests/run/texplicitgeneric2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tforwardgeneric.nim (renamed from tests/compile/tforwardgeneric.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric0.nim (renamed from tests/compile/tgeneric.nim) | 8 | ||||
-rw-r--r-- | tests/generics/tgeneric1.nim (renamed from tests/run/tgenerics1.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric2.nim (renamed from tests/compile/tgeneric2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric3.nim (renamed from tests/compile/tgeneric3.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgeneric4.nim (renamed from tests/compile/tgeneric4.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericdefaults.nim (renamed from tests/compile/tgenericdefaults.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericmatcher.nim (renamed from tests/compile/tgenericmatcher.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericmatcher2.nim (renamed from tests/compile/tgenericmatcher2.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericprocvar.nim (renamed from tests/run/tgenericprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericprop.nim (renamed from tests/compile/tgenericprop.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericrefs.nim (renamed from tests/compile/tgenericrefs.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericshardcases.nim | 36 | ||||
-rw-r--r-- | tests/generics/tgenerictmpl.nim (renamed from tests/compile/tgenerictmpl.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tgenericvariant.nim (renamed from tests/compile/tgenericvariant.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tspecialised_is_equivalent.nim (renamed from tests/compile/tspecialised_is_equivalent.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tthread_generic.nim (renamed from tests/compile/tthread_generic.nim) | 0 | ||||
-rw-r--r-- | tests/generics/tvarargs_vs_generic.nim (renamed from tests/run/tvarargs_vs_generic.nim) | 0 | ||||
-rw-r--r-- | tests/gensym/tgensym.nim (renamed from tests/run/tgensym.nim) | 0 | ||||
-rw-r--r-- | tests/gensym/tgensymgeneric.nim (renamed from tests/compile/tgensymgeneric.nim) | 0 | ||||
-rw-r--r-- | tests/global/tglobal.nim (renamed from tests/run/tglobal.nim) | 0 | ||||
-rw-r--r-- | tests/global/tglobalforvar.nim (renamed from tests/compile/tglobalforvar.nim) | 0 | ||||
-rw-r--r-- | tests/implicit/timplicititems.nim (renamed from tests/compile/timplicititems.nim) | 0 | ||||
-rw-r--r-- | tests/implicit/timplictderef.nim (renamed from tests/compile/timplictderef.nim) | 0 | ||||
-rw-r--r-- | tests/init/tuninit1.nim (renamed from tests/reject/tuninit1.nim) | 0 | ||||
-rw-r--r-- | tests/init/tzeroarray.nim (renamed from tests/run/tzeroarray.nim) | 0 | ||||
-rw-r--r-- | tests/iter/tanoniter1.nim | 32 | ||||
-rw-r--r-- | tests/iter/tcountup.nim (renamed from tests/run/tcountup.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer.nim (renamed from tests/compile/titer.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer2.nim (renamed from tests/compile/titer2.nim) | 2 | ||||
-rw-r--r-- | tests/iter/titer3.nim (renamed from tests/run/titer3.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer4.nim (renamed from tests/reject/titer4.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer5.nim (renamed from tests/run/titer5.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer6.nim (renamed from tests/run/titer6.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer7.nim (renamed from tests/run/titer7.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer8.nim (renamed from tests/run/titer8.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer9.nim (renamed from tests/run/titer9.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titer_no_tuple_unpack.nim (renamed from tests/compile/titer_no_tuple_unpack.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titerovl.nim (renamed from tests/compile/titerovl.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titerslice.nim (renamed from tests/run/titerslice.nim) | 0 | ||||
-rw-r--r-- | tests/iter/titervaropenarray.nim (renamed from tests/run/titervaropenarray.nim) | 0 | ||||
-rw-r--r-- | tests/iter/tmoditer.nim (renamed from tests/run/tmoditer.nim) | 0 | ||||
-rw-r--r-- | tests/iter/treciter.nim (renamed from tests/reject/treciter.nim) | 0 | ||||
-rw-r--r-- | tests/iter/twrongiter.nim | 13 | ||||
-rw-r--r-- | tests/let/tlet.nim (renamed from tests/reject/tlet.nim) | 0 | ||||
-rw-r--r-- | tests/let/tlet2.nim (renamed from tests/reject/tlet2.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/thexlit.nim (renamed from tests/run/thexlit.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/thexrange.nim (renamed from tests/compile/thexrange.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tident.nim (renamed from tests/compile/tident.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tind1.nim (renamed from tests/reject/tind1.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tindent1.nim (renamed from tests/run/tindent1.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tlexer.nim (renamed from tests/compile/tlexer.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tmissingnl.nim (renamed from tests/reject/tmissingnl.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tstrlits.nim (renamed from tests/run/tstrlits.nim) | 0 | ||||
-rw-r--r-- | tests/lexer/tunderscores.nim (renamed from tests/reject/tunderscores.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tkoeniglookup.nim (renamed from tests/run/tkoeniglookup.nim) | 0 | ||||
-rw-r--r-- | tests/lookups/tredef.nim (renamed from tests/compile/tredef.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tdebugstmt.nim | 29 | ||||
-rw-r--r-- | tests/macros/tdumpast.nim (renamed from tests/compile/tdumpast.nim) | 2 | ||||
-rw-r--r-- | tests/macros/tdumpast2.nim (renamed from tests/compile/tdumpast2.nim) | 2 | ||||
-rw-r--r-- | tests/macros/tdumptree.nim (renamed from tests/run/tdumptree.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tidgen.nim (renamed from tests/run/tidgen.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro1.nim (renamed from tests/compile/tmacro1.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro2.nim (renamed from tests/run/tmacro2.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro3.nim (renamed from tests/run/tmacro3.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro4.nim (renamed from tests/run/tmacro4.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacro5.nim (renamed from tests/compile/tmacro2.nim) | 2 | ||||
-rw-r--r-- | tests/macros/tmacroaspragma.nim (renamed from tests/compile/tmacroaspragma.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacrogenerics.nim (renamed from tests/run/tmacrogenerics.nim) | 6 | ||||
-rw-r--r-- | tests/macros/tmacros1.nim (renamed from tests/run/tmacros1.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacrostmt.nim (renamed from tests/compile/tmacrostmt.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tmacrotypes.nim (renamed from tests/compile/tmacrotypes.nim) | 4 | ||||
-rw-r--r-- | tests/macros/tmemit.nim | 7 | ||||
-rw-r--r-- | tests/macros/tnimrodnode_for_runtime.nim (renamed from tests/compile/tnimrodnode_for_runtime.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tprintf.nim (renamed from tests/run/tprintf.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tquotewords.nim (renamed from tests/run/tquotewords.nim) | 0 | ||||
-rw-r--r-- | tests/macros/trecmacro.nim (renamed from tests/reject/trecmacro.nim) | 0 | ||||
-rw-r--r-- | tests/macros/tstringinterp.nim (renamed from tests/run/tstringinterp.nim) | 6 | ||||
-rw-r--r-- | tests/macros/tvtable.nim (renamed from tests/run/tvtable.nim) | 0 | ||||
-rw-r--r-- | tests/magics/tlowhigh.nim (renamed from tests/run/tlowhigh.nim) | 0 | ||||
-rw-r--r-- | tests/matrix/tmatrix.nim (renamed from tests/run/tmatrix.nim) | 0 | ||||
-rw-r--r-- | tests/matrix/tmatrix1.nim (renamed from tests/compile/tmatrix1.nim) | 0 | ||||
-rw-r--r-- | tests/matrix/tmatrix2.nim (renamed from tests/compile/tmatrix2.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tbindtypedesc.nim | 91 | ||||
-rw-r--r-- | tests/metatype/tcompositetypeclasses.nim | 59 | ||||
-rw-r--r-- | tests/metatype/tconstraints.nim (renamed from tests/compile/tconstraints.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/tsemistatic.nim | 24 | ||||
-rw-r--r-- | tests/metatype/tstaticparams.nim | 31 | ||||
-rw-r--r-- | tests/metatype/ttypebar.nim | 14 | ||||
-rw-r--r-- | tests/metatype/ttypeclasses.nim (renamed from tests/compile/ttypeclasses.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/ttypedesc1.nim (renamed from tests/run/ttypedesc1.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/ttypeselectors.nim (renamed from tests/compile/ttypeselectors.nim) | 0 | ||||
-rw-r--r-- | tests/metatype/ttypetraits.nim (renamed from tests/run/ttypetraits.nim) | 2 | ||||
-rw-r--r-- | tests/metatype/tusertypeclasses.nim | 28 | ||||
-rw-r--r-- | tests/metatype/utypeclasses.nim (renamed from tests/run/utypeclasses.nim) | 0 | ||||
-rw-r--r-- | tests/method/mmultim3.nim (renamed from tests/run/mmultim3.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmethod.nim (renamed from tests/reject/tmethod.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmethods1.nim (renamed from tests/run/tmethods1.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim1.nim (renamed from tests/run/tmultim1.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim2.nim (renamed from tests/run/tmultim2.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim3.nim (renamed from tests/run/tmultim3.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim4.nim (renamed from tests/run/tmultim4.nim) | 0 | ||||
-rw-r--r-- | tests/method/tmultim6.nim (renamed from tests/run/tmultim6.nim) | 0 | ||||
-rw-r--r-- | tests/method/tsimmeth.nim (renamed from tests/run/tsimmeth.nim) | 0 | ||||
-rw-r--r-- | tests/module/mopaque.nim (renamed from tests/reject/mopaque.nim) | 0 | ||||
-rw-r--r-- | tests/module/mrecmod.nim (renamed from tests/compile/mrecmod.nim) | 0 | ||||
-rw-r--r-- | tests/module/mrecmod2.nim (renamed from tests/compile/mrecmod2.nim) | 0 | ||||
-rw-r--r-- | tests/module/topaque.nim (renamed from tests/reject/topaque.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecinca.nim (renamed from tests/reject/trecinca.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecincb.nim (renamed from tests/reject/trecincb.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecmod.nim (renamed from tests/compile/trecmod.nim) | 0 | ||||
-rw-r--r-- | tests/module/trecmod2.nim (renamed from tests/compile/trecmod2.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mexporta.nim (renamed from tests/compile/mexporta.nim) | 0 | ||||
-rw-r--r-- | tests/modules/mexportb.nim (renamed from tests/compile/mexportb.nim) | 0 | ||||
-rw-r--r-- | tests/modules/texport.nim (renamed from tests/compile/texport.nim) | 0 | ||||
-rw-r--r-- | tests/modules/timportexcept.nim (renamed from tests/reject/timportexcept.nim) | 0 | ||||
-rw-r--r-- | tests/namedparams/tnamedparams.nim (renamed from tests/reject/tnamedparams.nim) | 0 | ||||
-rw-r--r-- | tests/namedparams/tnamedparams2.nim (renamed from tests/compile/tnamedparams.nim) | 0 | ||||
-rw-r--r-- | tests/namspc/mnamspc1.nim (renamed from tests/reject/mnamspc1.nim) | 0 | ||||
-rw-r--r-- | tests/namspc/mnamspc2.nim (renamed from tests/reject/mnamspc2.nim) | 0 | ||||
-rw-r--r-- | tests/namspc/tnamspc.nim (renamed from tests/reject/tnamspc.nim) | 0 | ||||
-rw-r--r-- | tests/notnil/tnotnil.nim (renamed from tests/reject/tnotnil.nim) | 0 | ||||
-rw-r--r-- | tests/notnil/tnotnil1.nim (renamed from tests/reject/tnotnil1.nim) | 0 | ||||
-rw-r--r-- | tests/notnil/tnotnil2.nim (renamed from tests/reject/tnotnil2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjconstr.nim (renamed from tests/run/tobjconstr.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjconstr2.nim (renamed from tests/compile/tobjconstr2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjcov.nim (renamed from tests/compile/tobjcov.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject.nim (renamed from tests/run/tobject.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject2.nim (renamed from tests/compile/tobject2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject3.nim (renamed from tests/compile/tobject3.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjects.nim (renamed from tests/compile/tobjects.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tofopr.nim (renamed from tests/run/tofopr.nim) | 0 | ||||
-rw-r--r-- | tests/objects/toop.nim (renamed from tests/compile/toop.nim) | 0 | ||||
-rw-r--r-- | tests/objects/toop1.nim (renamed from tests/run/toop1.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/tadrdisc.nim (renamed from tests/reject/tadrdisc.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/tcheckedfield1.nim (renamed from tests/reject/tcheckedfield1.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/temptycaseobj.nim (renamed from tests/reject/temptycaseobj.nim) | 0 | ||||
-rw-r--r-- | tests/objvariant/tvariantstack.nim (renamed from tests/run/tvariantstack.nim) | 0 | ||||
-rw-r--r-- | tests/openarray/topena1.nim (renamed from tests/reject/topena1.nim) | 0 | ||||
-rw-r--r-- | tests/openarray/topenarrayrepr.nim (renamed from tests/run/topenarrayrepr.nim) | 0 | ||||
-rw-r--r-- | tests/openarray/topenlen.nim (renamed from tests/run/topenlen.nim) | 0 | ||||
-rw-r--r-- | tests/overflw/toverflw.nim (renamed from tests/run/toverflw.nim) | 0 | ||||
-rw-r--r-- | tests/overflw/toverflw2.nim (renamed from tests/run/toverflw2.nim) | 0 | ||||
-rw-r--r-- | tests/overflw/tovfint.nim (renamed from tests/run/tovfint.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverl.nim (renamed from tests/reject/toverl.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverl2.nim (renamed from tests/run/toverl2.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverl3.nim (renamed from tests/run/toverl3.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverprc.nim (renamed from tests/compile/toverprc.nim) | 0 | ||||
-rw-r--r-- | tests/overload/toverwr.nim (renamed from tests/run/toverwr.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tcommand_as_expr.nim | 23 | ||||
-rw-r--r-- | tests/parser/tdomulttest.nim (renamed from tests/run/tdomulttest.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tinvwhen.nim (renamed from tests/reject/tinvwhen.nim) | 4 | ||||
-rw-r--r-- | tests/parser/toprprec.nim (renamed from tests/run/toprprec.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tprecedence.nim (renamed from tests/run/tprecedence.nim) | 0 | ||||
-rw-r--r-- | tests/patterns/tor.nim | 2 | ||||
-rw-r--r-- | tests/patterns/tpatterns.nim (renamed from tests/run/tpatterns.nim) | 0 | ||||
-rw-r--r-- | tests/pragmas/tpush.nim (renamed from tests/compile/tpush.nim) | 0 | ||||
-rw-r--r-- | tests/pragmas/tuserpragma.nim (renamed from tests/compile/tuserpragma.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tnestprc.nim (renamed from tests/run/tnestprc.nim) | 0 | ||||
-rw-r--r-- | tests/proc/tprocredef.nim (renamed from tests/reject/tprocredef.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tgenericprocvar.nim (renamed from tests/compile/tgenericprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tprocvar.nim (renamed from tests/reject/tprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tprocvar2.nim (renamed from tests/run/tprocvar.nim) | 0 | ||||
-rw-r--r-- | tests/procvar/tprocvars.nim (renamed from tests/compile/tprocvars.nim) | 0 | ||||
-rw-r--r-- | tests/range/compilehelpers.nim | 6 | ||||
-rw-r--r-- | tests/range/tbug499771.nim (renamed from tests/run/tbug499771.nim) | 0 | ||||
-rw-r--r-- | tests/range/tcolors.nim (renamed from tests/compile/tcolors.nim) | 0 | ||||
-rw-r--r-- | tests/range/tmatrix3.nim | 41 | ||||
-rw-r--r-- | tests/range/tsubrange.nim (renamed from tests/reject/tsubrange.nim) | 0 | ||||
-rw-r--r-- | tests/range/tsubrange2.nim (renamed from tests/run/tsubrange2.nim) | 0 | ||||
-rw-r--r-- | tests/range/tsubrange3.nim (renamed from tests/run/tsubrange.nim) | 0 | ||||
-rw-r--r-- | tests/reject/99bottles.nim | 1 | ||||
-rw-r--r-- | tests/reject/mbind4.nim | 9 | ||||
-rw-r--r-- | tests/reject/t99bott.nim | 36 | ||||
-rw-r--r-- | tests/reject/tatomic.nim | 12 | ||||
-rw-r--r-- | tests/reject/tbind4.nim | 13 | ||||
-rw-r--r-- | tests/reject/tgenconstraints.nim | 30 | ||||
-rw-r--r-- | tests/reject/tinc.nim | 12 | ||||
-rw-r--r-- | tests/reject/tinout.nim | 16 | ||||
-rw-r--r-- | tests/reject/tinvalidarrayaccess.nim | 14 | ||||
-rw-r--r-- | tests/reject/tinvalidnewseq.nim | 27 | ||||
-rw-r--r-- | tests/reject/tnoinst.nim | 16 | ||||
-rw-r--r-- | tests/reject/tnolen.nim | 9 | ||||
-rw-r--r-- | tests/reject/tnoop.nim | 12 | ||||
-rw-r--r-- | tests/reject/tnot.nim | 21 | ||||
-rw-r--r-- | tests/reject/trawstr.nim | 12 | ||||
-rw-r--r-- | tests/reject/tsimtych.nim | 12 | ||||
-rw-r--r-- | tests/run/globalaux.nim | 15 | ||||
-rw-r--r-- | tests/run/globalaux2.nim | 4 | ||||
-rw-r--r-- | tests/run/minit.nim | 2 | ||||
-rw-r--r-- | tests/run/tack.nim | 21 | ||||
-rw-r--r-- | tests/run/tbug511622.nim | 16 | ||||
-rw-r--r-- | tests/run/tdestructor.nim | 26 | ||||
-rw-r--r-- | tests/run/temit.nim | 20 | ||||
-rw-r--r-- | tests/run/teventemitter.nim | 33 | ||||
-rw-r--r-- | tests/run/tevents.nim | 48 | ||||
-rw-r--r-- | tests/run/tfilter.nim | 41 | ||||
-rw-r--r-- | tests/run/thintoff.nim | 12 | ||||
-rw-r--r-- | tests/run/tinit.nim | 12 | ||||
-rw-r--r-- | tests/run/tints.nim | 45 | ||||
-rw-r--r-- | tests/run/tlocals.nim | 11 | ||||
-rw-r--r-- | tests/run/tmemoization.nim | 17 | ||||
-rw-r--r-- | tests/run/tnewderef.nim | 11 | ||||
-rw-r--r-- | tests/run/tpos.nim | 35 | ||||
-rw-r--r-- | tests/run/tromans.nim | 71 | ||||
-rw-r--r-- | tests/run/tsimplesort.nim | 313 | ||||
-rw-r--r-- | tests/run/tslices.nim | 59 | ||||
-rw-r--r-- | tests/run/tsortdev.nim | 59 | ||||
-rw-r--r-- | tests/run/tstaticparams.nim | 22 | ||||
-rw-r--r-- | tests/run/tstrange.nim | 23 | ||||
-rw-r--r-- | tests/run/tunittests.nim | 1 | ||||
-rw-r--r-- | tests/run/tvarious1.nim | 29 | ||||
-rw-r--r-- | tests/run/tvarnums.nim | 142 | ||||
-rw-r--r-- | tests/seq/tseq2.nim (renamed from tests/compile/tseq2.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tseqcon.nim (renamed from tests/run/tseqcon.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tseqcon2.nim (renamed from tests/compile/tseqcon2.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tseqtuple.nim (renamed from tests/run/tseqtuple.nim) | 0 | ||||
-rw-r--r-- | tests/seq/tsequtils.nim (renamed from tests/run/tsequtils.nim) | 0 | ||||
-rw-r--r-- | tests/seq/ttoseq.nim (renamed from tests/run/ttoseq.nim) | 0 | ||||
-rw-r--r-- | tests/sets/testequivalence.nim | 15 | ||||
-rw-r--r-- | tests/sets/tsets.nim (renamed from tests/run/tsets.nim) | 0 | ||||
-rw-r--r-- | tests/sets/tsets2.nim (renamed from tests/run/tsets2.nim) | 0 | ||||
-rw-r--r-- | tests/showoff/tdrdobbs_examples.nim | 134 | ||||
-rw-r--r-- | tests/showoff/tformatopt.nim | 57 | ||||
-rw-r--r-- | tests/showoff/thello2.nim | 11 | ||||
-rw-r--r-- | tests/showoff/thtml1.nim | 11 | ||||
-rw-r--r-- | tests/showoff/thtml2.nim | 37 | ||||
-rw-r--r-- | tests/showoff/tonce.nim | 22 | ||||
-rw-r--r-- | tests/showoff/tquasiquote.nim | 14 | ||||
-rw-r--r-- | tests/specials.nim | 238 | ||||
-rw-r--r-- | tests/stdlib/talgorithm.nim | 8 | ||||
-rw-r--r-- | tests/stdlib/tcputime.nim (renamed from tests/compile/tcputime.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tcritbits.nim (renamed from tests/run/tcritbits.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tdialogs.nim (renamed from tests/compile/tdialogs.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/techo.nim (renamed from tests/compile/techo.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tformat.nim (renamed from tests/run/tformat.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/thashes.nim (renamed from tests/run/thashes.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tio.nim (renamed from tests/compile/tio.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tircbot.nim (renamed from tests/compile/tircbot.nim) | 6 | ||||
-rw-r--r-- | tests/stdlib/tlists.nim (renamed from tests/run/tlists.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmarshal.nim (renamed from tests/compile/tmarshal.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmath.nim (renamed from tests/run/tmath.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmath2.nim (renamed from tests/compile/tmath.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tmongo.nim (renamed from tests/compile/tmongo.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tos.nim (renamed from tests/compile/tos.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tparscfg.nim (renamed from tests/compile/tparscfg.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tparsefloat.nim (renamed from tests/compile/tparsefloat.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tparsopt.nim (renamed from tests/compile/tparsopt.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tpegs.nim (renamed from tests/run/tpegs.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tposix.nim (renamed from tests/compile/tposix.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tquit.nim (renamed from tests/compile/tquit.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tregex.nim (renamed from tests/run/tregex.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/treguse.nim (renamed from tests/run/treguse.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/trepr.nim (renamed from tests/run/trepr.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/trepr2.nim (renamed from tests/compile/trepr.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tsockets.nim (renamed from tests/compile/tsockets.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tsortcall.nim (renamed from tests/compile/tsortcall.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tsplit.nim (renamed from tests/run/tsplit.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstreams.nim (renamed from tests/compile/tstreams.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstrset.nim (renamed from tests/compile/tstrset.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstrtabs.nim (renamed from tests/compile/tstrtabs.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tstrutil.nim (renamed from tests/run/tstrutil.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/ttime.nim (renamed from tests/compile/ttime.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/tunidecode.nim (renamed from tests/run/tunidecode.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/twalker.nim (renamed from tests/compile/twalker.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/txmlgen.nim (renamed from tests/run/txmlgen.nim) | 0 | ||||
-rw-r--r-- | tests/stdlib/txmltree.nim (renamed from tests/run/txmltree.nim) | 0 | ||||
-rw-r--r-- | tests/system/params.nim | 18 | ||||
-rw-r--r-- | tests/table/ttableconstr.nim (renamed from tests/compile/ttableconstr.nim) | 0 | ||||
-rw-r--r-- | tests/table/ttables.nim (renamed from tests/run/ttables.nim) | 0 | ||||
-rw-r--r-- | tests/table/ttables2.nim (renamed from tests/run/ttables2.nim) | 0 | ||||
-rw-r--r-- | tests/template/mcan_access_hidden_field.nim | 9 | ||||
-rw-r--r-- | tests/template/mtempl5.nim (renamed from tests/compile/mtempl5.nim) | 0 | ||||
-rw-r--r-- | tests/template/tcan_access_hidden_field.nim | 9 | ||||
-rw-r--r-- | tests/template/thygienictempl.nim (renamed from tests/compile/thygienictempl.nim) | 0 | ||||
-rw-r--r-- | tests/template/tmodulealias.nim (renamed from tests/compile/tmodulealias.nim) | 0 | ||||
-rw-r--r-- | tests/template/tprefer_immediate.nim | 17 | ||||
-rw-r--r-- | tests/template/tstempl.nim (renamed from tests/run/tstempl.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl.nim (renamed from tests/compile/ttempl.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl2.nim (renamed from tests/reject/ttempl2.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl3.nim (renamed from tests/compile/ttempl3.nim) | 2 | ||||
-rw-r--r-- | tests/template/ttempl4.nim (renamed from tests/compile/ttempl4.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttempl5.nim (renamed from tests/compile/ttempl5.nim) | 0 | ||||
-rw-r--r-- | tests/template/ttemplreturntype.nim (renamed from tests/compile/ttemplreturntype.nim) | 0 | ||||
-rw-r--r-- | tests/template/utemplates.nim (renamed from tests/run/utemplates.nim) | 2 | ||||
-rw-r--r-- | tests/testament/backend.nim | 121 | ||||
-rw-r--r-- | tests/testament/caasdriver.nim (renamed from tests/caasdriver.nim) | 0 | ||||
-rw-r--r-- | tests/testament/categories.nim | 269 | ||||
-rw-r--r-- | tests/testament/css/boilerplate.css (renamed from tests/css/boilerplate.css) | 0 | ||||
-rw-r--r-- | tests/testament/css/style.css (renamed from tests/css/style.css) | 0 | ||||
-rw-r--r-- | tests/testament/htmlgen.nim | 180 | ||||
-rw-r--r-- | tests/testament/specs.nim | 130 | ||||
-rw-r--r-- | tests/testament/tester.nim | 260 | ||||
-rw-r--r-- | tests/tester.nim | 457 | ||||
-rw-r--r-- | tests/trmacros/tdisallowif.nim (renamed from tests/reject/tdisallowif.nim) | 3 | ||||
-rw-r--r-- | tests/tuples/tanontuples.nim (renamed from tests/run/tanontuples.nim) | 0 | ||||
-rw-r--r-- | tests/tuples/twrongtupleaccess.nim (renamed from tests/reject/twrongtupleaccess.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tcommontype.nim (renamed from tests/compile/tcommontype.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tno_int_in_bool_context.nim (renamed from tests/reject/tno_int_in_bool_context.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tnoargopenarray.nim (renamed from tests/compile/tnoargopenarray.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tnocontains.nim (renamed from tests/reject/tnocontains.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trectuple.nim (renamed from tests/compile/trectuple.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trectuples.nim (renamed from tests/compile/trectuples.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trectype.nim (renamed from tests/reject/trectype.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trefs.nim (renamed from tests/reject/trefs.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/trettypeinference.nim (renamed from tests/run/trettypeinference.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tsecondarrayproperty.nim (renamed from tests/compile/tsecondarrayproperty.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttuple1.nim (renamed from tests/compile/ttuple1.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttypelessemptyset.nim (renamed from tests/reject/ttypelessemptyset.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttypenoval.nim (renamed from tests/reject/ttypenoval.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/ttypenovalue.nim (renamed from tests/reject/ttypenovalue.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/tvoid.nim (renamed from tests/compile/tvoid.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/typalias.nim (renamed from tests/compile/typalias.nim) | 0 | ||||
-rw-r--r-- | tests/typerel/typredef.nim (renamed from tests/reject/typredef.nim) | 6 | ||||
-rw-r--r-- | tests/types/tfinalobj.nim (renamed from tests/run/tfinalobj.nim) | 0 | ||||
-rw-r--r-- | tests/types/tforwty.nim (renamed from tests/compile/tforwty.nim) | 0 | ||||
-rw-r--r-- | tests/types/tforwty2.nim (renamed from tests/compile/tforwty2.nim) | 0 | ||||
-rw-r--r-- | tests/types/tillegaltyperecursion.nim (renamed from tests/reject/tillegaltyperecursion.nim) | 0 | ||||
-rw-r--r-- | tests/types/tillrec.nim (renamed from tests/reject/tillrec.nim) | 19 | ||||
-rw-r--r-- | tests/types/tinheritref.nim (renamed from tests/compile/tinheritref.nim) | 0 | ||||
-rw-r--r-- | tests/types/tisop.nim (renamed from tests/compile/tisop.nim) | 0 | ||||
-rw-r--r-- | tests/types/tisopr.nim (renamed from tests/run/tisopr.nim) | 0 | ||||
-rw-r--r-- | tests/usingstmt/tusingstatement.nim (renamed from tests/run/tusingstatement.nim) | 24 | ||||
-rw-r--r-- | tests/varres/tvarres1.nim (renamed from tests/reject/tvarres1.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvarres2.nim (renamed from tests/reject/tvarres2.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvarres3.nim (renamed from tests/run/tvarres1.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvarres4.nim (renamed from tests/run/tvarres2.nim) | 0 | ||||
-rw-r--r-- | tests/varres/tvartup.nim (renamed from tests/run/tvartup.nim) | 0 | ||||
-rw-r--r-- | tests/varstmt/tlet.nim (renamed from tests/run/tlet.nim) | 0 | ||||
-rw-r--r-- | tests/varstmt/tvardecl.nim (renamed from tests/run/tvardecl.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tconsteval.nim (renamed from tests/compile/tconsteval.nim) | 0 | ||||
-rw-r--r-- | tests/vm/teval1.nim (renamed from tests/compile/teval1.nim) | 0 | ||||
-rw-r--r-- | tests/vm/tslurp.nim (renamed from tests/compile/tslurp.nim) | 0 | ||||
-rw-r--r-- | tests/vm/twrongconst.nim (renamed from tests/reject/twrongconst.nim) | 4 | ||||
-rw-r--r-- | tinyc/tccgen.c | 2 | ||||
-rw-r--r-- | todo.txt | 55 | ||||
-rw-r--r-- | tools/cmerge.nim | 4 | ||||
-rw-r--r-- | tools/detect/detect.nim | 23 | ||||
-rw-r--r-- | tools/detect/linux_amd64_consts.nim | 631 | ||||
-rw-r--r-- | tools/detect/macosx_consts.nim | 629 | ||||
-rw-r--r-- | tools/detect/windows_amd64_consts.nim | 152 | ||||
-rw-r--r-- | tools/detect/windows_i386_consts.nim | 96 | ||||
-rw-r--r-- | tools/nimgrep.nim | 6 | ||||
-rw-r--r-- | tools/niminst/buildbat.tmpl | 6 | ||||
-rw-r--r-- | tools/niminst/buildsh.tmpl | 6 | ||||
-rw-r--r-- | tools/niminst/debcreation.nim | 2 | ||||
-rw-r--r-- | tools/niminst/deinstall.tmpl | 2 | ||||
-rw-r--r-- | tools/niminst/inno.tmpl | 2 | ||||
-rw-r--r-- | tools/niminst/install.tmpl | 2 | ||||
-rw-r--r-- | tools/niminst/niminst.nim | 37 | ||||
-rw-r--r-- | tools/nimweb.nim | 36 | ||||
-rw-r--r-- | tools/noprefix.nim | 32 | ||||
-rw-r--r-- | web/community.txt | 2 | ||||
-rw-r--r-- | web/news.txt | 40 | ||||
-rw-r--r-- | web/nimrod.ini | 11 |
848 files changed, 25977 insertions, 75631 deletions
diff --git a/.gitignore b/.gitignore index 536ec9d24..15272385f 100644 --- a/.gitignore +++ b/.gitignore @@ -58,12 +58,16 @@ examples/cross_calculator/android/tags # Generated files. /compile.json /compiler/c2nim/c2nim +/compiler/nimrod.dot /compiler/pas2nim/pas2nim /compiler/service /examples/allany /examples/cairoex /examples/cgiex +/examples/cgi/cgi_stacktrace +/examples/cgi/example /examples/curlex +/examples/debugging /examples/docstrings /examples/filterex /examples/fizzbuzz @@ -89,6 +93,12 @@ examples/cross_calculator/android/tags /examples/pythonex /examples/sdlex /examples/statcsv +/examples/talk/dsl +/examples/talk/formatoptimizer +/examples/talk/hoisting +/examples/talk/lazyeval +/examples/talk/quasiquote +/examples/talk/tags /examples/tclex /examples/transff /examples/tunit @@ -96,10 +106,13 @@ examples/cross_calculator/android/tags /examples/x11ex /lib/libnimrtl.dylib /lib/libserver.dylib +/lib/packages/docutils/highlite /lib/pure/actors /lib/pure/algorithm /lib/pure/asyncio /lib/pure/base64 +/lib/pure/basic2d +/lib/pure/basic3d /lib/pure/browsers /lib/pure/cgi /lib/pure/collections/sequtils @@ -111,6 +124,7 @@ examples/cross_calculator/android/tags /lib/pure/encodings /lib/pure/endians /lib/pure/events +/lib/pure/fsmonitor /lib/pure/ftpclient /lib/pure/gentabs /lib/pure/hashes @@ -127,19 +141,23 @@ examples/cross_calculator/android/tags /lib/pure/math /lib/pure/md5 /lib/pure/memfiles +/lib/pure/mersenne /lib/pure/mimetypes /lib/pure/nimprof +/lib/pure/numeric /lib/pure/oids /lib/pure/os /lib/pure/osproc /lib/pure/parsecfg /lib/pure/parsecsv /lib/pure/parseopt +/lib/pure/parseopt2 /lib/pure/parsesql /lib/pure/parseurl /lib/pure/parseutils /lib/pure/parsexml /lib/pure/pegs +/lib/pure/poly /lib/pure/redis /lib/pure/romans /lib/pure/ropes @@ -167,9 +185,9 @@ examples/cross_calculator/android/tags /run.json /testresults.html /testresults.json -/tests/caas/SymbolProcRun.*/ /tests/caas/absurd_nesting /tests/caas/completion_dot_syntax_main +/tests/caasdriver /tests/caas/forward_declarations /tests/caas/idetools_api /tests/caas/imported @@ -178,5 +196,380 @@ examples/cross_calculator/android/tags /tests/caas/issue_477_dynamic_dispatch /tests/caas/its_full_of_procs /tests/caas/main -/tests/caasdriver +/tests/caas/SymbolProcRun.*/ +/tests/ccg/tmissingbracket +/tests/compile/talias +/tests/compile/tambsym2 +/tests/compile/tarrindx +/tests/compile/tassign +/tests/compile/tbindoverload +/tests/compile/tcan_alias_generic +/tests/compile/tcan_alias_specialised_generic +/tests/compile/tcan_inherit_generic +/tests/compile/tcan_specialise_generic +/tests/compile/tccgen1 +/tests/compile/tclosure4 +/tests/compile/tclosurebug2 +/tests/compile/tcmdline +/tests/compile/tcodegenbug1 +/tests/compile/tcolonisproc +/tests/compile/tcolors +/tests/compile/tcommontype +/tests/compile/tcompiles +/tests/compile/tcomputedgoto +/tests/compile/tconsteval +/tests/compile/tconstraints +/tests/compile/tconvcolors +/tests/compile/tcputime +/tests/compile/tdefaultprocparam +/tests/compile/tdictdestruct +/tests/compile/tdiscardable +/tests/compile/tdllvar +/tests/compile/tdumpast +/tests/compile/tdumpast2 +/tests/compile/techo +/tests/compile/teffects1 +/tests/compile/temptyecho +/tests/compile/tendian +/tests/compile/tenum +/tests/compile/tenum2 +/tests/compile/tenum3 +/tests/compile/teval1 +/tests/compile/texport +/tests/compile/tfib +/tests/compile/tforwardgeneric +/tests/compile/tforwty +/tests/compile/tforwty2 +/tests/compile/tgeneric +/tests/compile/tgeneric2 +/tests/compile/tgeneric3 +/tests/compile/tgeneric4 +/tests/compile/tgenericmatcher +/tests/compile/tgenericmatcher2 +/tests/compile/tgenericprocvar +/tests/compile/tgenericprop +/tests/compile/tgenericrefs +/tests/compile/tgenerictmpl +/tests/compile/tgenericvariant +/tests/compile/tgensymgeneric +/tests/compile/tgetstartmilsecs +/tests/compile/tglobalforvar +/tests/compile/thallo +/tests/compile/theaproots +/tests/compile/thexrange +/tests/compile/thygienictempl +/tests/compile/tident +/tests/compile/timplicititems +/tests/compile/timplictderef +/tests/compile/tinheritref +/tests/compile/tio +/tests/compile/tircbot +/tests/compile/titer +/tests/compile/titer2 +/tests/compile/titer_no_tuple_unpack +/tests/compile/titerovl +/tests/compile/tlastmod +/tests/compile/tlinearscanend +/tests/compile/tloops +/tests/compile/tmacro1 +/tests/compile/tmacro2 +/tests/compile/tmacroaspragma +/tests/compile/tmacrostmt +/tests/compile/tmandelbrot +/tests/compile/tmarshal +/tests/compile/tmath +/tests/compile/tmatrix1 +/tests/compile/tmatrix2 +/tests/compile/tmongo +/tests/compile/tnamedparamanonproc +/tests/compile/tnamedparams +/tests/compile/tnestedproc +/tests/compile/tnew +/tests/compile/tnewsets +/tests/compile/tnewuns +/tests/compile/tnoargopenarray +/tests/compile/tnoforward +/tests/compile/tobjconstr2 +/tests/compile/tobjcov +/tests/compile/tobject2 +/tests/compile/tobject3 +/tests/compile/tobjects +/tests/compile/toop +/tests/compile/toptions +/tests/compile/tos +/tests/compile/toverprc +/tests/compile/tparedef +/tests/compile/tparscfg +/tests/compile/tparsefloat +/tests/compile/tparsopt +/tests/compile/tposix +/tests/compile/tprep +/tests/compile/tprocvars +/tests/compile/tpush +/tests/compile/tquicksort +/tests/compile/tquit +/tests/compile/tradix +/tests/compile/treadln +/tests/compile/treadx +/tests/compile/trecmod +/tests/compile/trecmod2 +/tests/compile/trectuple +/tests/compile/trectuples +/tests/compile/tredef +/tests/compile/trepr +/tests/compile/tsecondarrayproperty +/tests/compile/tseq2 +/tests/compile/tseqcon2 +/tests/compile/tshadow_magic_type +/tests/compile/tsizeof +/tests/compile/tslurp +/tests/compile/tsockets +/tests/compile/tsortcall +/tests/compile/tspecialised_is_equivalent +/tests/compile/tstrace +/tests/compile/tstrdesc +/tests/compile/tstrdist +/tests/compile/tstreams +/tests/compile/tstrset +/tests/compile/tstrtabs +/tests/compile/ttableconstr +/tests/compile/ttempl +/tests/compile/ttempl3 +/tests/compile/ttempl4 +/tests/compile/ttempl5 +/tests/compile/ttemplreturntype +/tests/compile/tthread_generic +/tests/compile/ttime +/tests/compile/ttuple1 +/tests/compile/ttypeclasses +/tests/compile/ttypeconverter1 +/tests/compile/tuserpragma +/tests/compile/tvoid +/tests/compile/twalker +/tests/compile/typalias +/tests/dll/client +/tests/gc/closureleak +/tests/gc/cycleleak +/tests/gc/gcbench +/tests/gc/gcleak +/tests/gc/gcleak2 +/tests/gc/gcleak3 +/tests/gc/gctest +/tests/gc/weakrefs +/tests/manyloc/argument_parser/ex_wget +/tests/manyloc/nake/nakefile +/tests/manyloc/packages/noconflicts +/tests/manyloc/standalone/barebone +/tests/patterns/targlist +/tests/patterns/tcse +/tests/patterns/thoist +/tests/patterns/tmatrix +/tests/patterns/tnoalias +/tests/patterns/tnoendlessrec +/tests/patterns/tor +/tests/patterns/tpartial +/tests/patterns/tstar +/tests/patterns/tstmtlist +/tests/reject/t99bott +/tests/reject/tcheckedfield1 +/tests/reject/tdeprecated +/tests/reject/tdisallowif +/tests/reject/tuninit1 +/tests/rodfiles/aconv +/tests/rodfiles/bconv +/tests/rodfiles/bmethods +/tests/rodfiles/bmethods2 +/tests/rodfiles/deada +/tests/rodfiles/deada2 +/tests/rodfiles/hallo +/tests/rodfiles/hallo2 +/tests/rodfiles/tgeneric1 +/tests/rodfiles/tgeneric2 +/tests/run/tack +/tests/run/tactiontable +/tests/run/tambsym2 +/tests/run/tambsys +/tests/run/tanontuples +/tests/run/tarray +/tests/run/tarray2 +/tests/run/tarray3 +/tests/run/tarraycons +/tests/run/tassert +/tests/run/tastoverload1 +/tests/run/tasynciossl +/tests/run/tasyncudp +/tests/run/tbind1 +/tests/run/tbind3 +/tests/run/tbintre2 +/tests/run/tbintree +/tests/run/tborrow +/tests/run/tbug499771 +/tests/run/tbug511622 +/tests/run/tcase_setconstr +/tests/run/tcasestm +/tests/run/tcgbug +/tests/run/tclosure2 +/tests/run/tclosure3 +/tests/run/tcnstseq +/tests/run/tcnstseq2 +/tests/run/tcnstseq3 +/tests/run/tconcat +/tests/run/tconstr2 +/tests/run/tcontinue +/tests/run/tcontinuexc +/tests/run/tcopy +/tests/run/tcountup +/tests/run/tcritbits +/tests/run/tcurrncy +/tests/run/tdestructor +/tests/run/tdrdobbs_examples +/tests/run/temit +/tests/run/tenumhole +/tests/run/tenumitems +/tests/run/teventemitter +/tests/run/tevents +/tests/run/texceptions +/tests/run/texcpt1 +/tests/run/texcsub +/tests/run/texplicitgeneric1 +/tests/run/tfieldindex +/tests/run/tfielditerator +/tests/run/tfielditerator2 +/tests/run/tfilter +/tests/run/tfinally +/tests/run/tfinally2 +/tests/run/tfinally3 +/tests/run/tfinalobj +/tests/run/tfloat1 +/tests/run/tfloat2 +/tests/run/tfloat3 +/tests/run/tformat +/tests/run/tfriends +/tests/run/tgenericassign +/tests/run/tgenericassigntuples +/tests/run/tgenericconverter +/tests/run/tgenericprocvar +/tests/run/tgenerics1 +/tests/run/tgensym +/tests/run/tglobal +/tests/run/thashes +/tests/run/thexlit +/tests/run/thintoff +/tests/run/tidgen +/tests/run/tindent1 +/tests/run/tinit +/tests/run/tinterf +/tests/run/tints +/tests/run/tisopr +/tests/run/titer3 +/tests/run/titer5 +/tests/run/titer6 +/tests/run/titer7 +/tests/run/titer8 +/tests/run/titer9 +/tests/run/titerslice +/tests/run/titervaropenarray +/tests/run/tkoeniglookup +/tests/run/tlet +/tests/run/tlists +/tests/run/tlocals +/tests/run/tlowhigh +/tests/run/tmacro2 +/tests/run/tmacro3 +/tests/run/tmacro4 +/tests/run/tmacros1 +/tests/run/tmath +/tests/run/tmatrix +/tests/run/tmemoization +/tests/run/tmethods1 +/tests/run/tmixin +/tests/run/tmoditer +/tests/run/tmultim1 +/tests/run/tmultim2 +/tests/run/tmultim3 +/tests/run/tmultim4 +/tests/run/tmultim6 +/tests/run/tnamedenumfields +/tests/run/tnestif +/tests/run/tnestprc +/tests/run/tnewderef +/tests/run/tnodeadlocks +/tests/run/tobjasgn +/tests/run/tobjconstr +/tests/run/tobject +/tests/run/tofopr +/tests/run/tonraise +/tests/run/toop1 +/tests/run/topenarrayrepr +/tests/run/topenlen +/tests/run/toprprec +/tests/run/toverflw +/tests/run/toverflw2 +/tests/run/toverl2 +/tests/run/toverl3 +/tests/run/toverwr +/tests/run/tovfint +/tests/run/tpatterns +/tests/run/tpegs +/tests/run/tpos +/tests/run/tprecedence +/tests/run/tprintf +/tests/run/tprocvar +/tests/run/tquotewords +/tests/run/tregex +/tests/run/treguse +/tests/run/trepr +/tests/run/treraise +/tests/run/tromans +/tests/run/tseqcon +/tests/run/tseqtuple +/tests/run/tsequtils +/tests/run/tsets +/tests/run/tsets2 +/tests/run/tsidee2 +/tests/run/tsidee3 +/tests/run/tsimmeth +/tests/run/tsimplesort +/tests/run/tslices +/tests/run/tsortdev +/tests/run/tsplit +/tests/run/tstempl +/tests/run/tstmtexprs +/tests/run/tstrange +/tests/run/tstringinterp +/tests/run/tstrlits +/tests/run/tstrutil +/tests/run/tsubrange +/tests/run/tsubrange2 +/tests/run/ttables +/tests/run/ttables2 +/tests/run/ttoseq +/tests/run/ttypedesc1 +/tests/run/tunhandledexc +/tests/run/tunidecode +/tests/run/tunittests +/tests/run/tuserassert +/tests/run/tvarargs_vs_generic +/tests/run/tvardecl +/tests/run/tvariantasgn +/tests/run/tvariantstack +/tests/run/tvarious1 +/tests/run/tvarnums +/tests/run/tvarres1 +/tests/run/tvarres2 +/tests/run/tvartup +/tests/run/tvtable +/tests/run/twrongexc +/tests/run/txmlgen +/tests/run/txmltree +/tests/run/tzeroarray +/tests/system/helpers/readall_echo +/tests/system/io +/tests/system/params +/tests/tester +/tests/threads/tactors +/tests/threads/tactors2 +/tests/threads/tthreadanalysis2 +/tests/threads/tthreadanalysis3 +/tests/threads/tthreadheapviolation1 /tools/nimgrep diff --git a/compiler/aliases.nim b/compiler/aliases.nim index 7accb8ce3..a26b94303 100644 --- a/compiler/aliases.nim +++ b/compiler/aliases.nim @@ -42,7 +42,7 @@ proc isPartOfAux(n: PNode, b: PType, marker: var TIntSet): TAnalysisResult = proc isPartOfAux(a, b: PType, marker: var TIntSet): TAnalysisResult = result = arNo if a == nil or b == nil: return - if ContainsOrIncl(marker, a.id): return + if containsOrIncl(marker, a.id): return if compareTypes(a, b, dcEqIgnoreDistinct): return arYes case a.kind of tyObject: @@ -54,11 +54,11 @@ proc isPartOfAux(a, b: PType, marker: var TIntSet): TAnalysisResult = for i in countup(0, sonsLen(a) - 1): result = isPartOfAux(a.sons[i], b, marker) if result == arYes: return - else: nil + else: discard proc isPartOf(a, b: PType): TAnalysisResult = ## checks iff 'a' can be part of 'b'. Iterates over VALUE types! - var marker = InitIntSet() + var marker = initIntSet() # watch out: parameters reversed because I'm too lazy to change the code... result = isPartOfAux(b, a, marker) @@ -115,7 +115,7 @@ proc isPartOf*(a, b: PNode): TAnalysisResult = var x = if a[1].kind == nkHiddenStdConv: a[1][1] else: a[1] var y = if b[1].kind == nkHiddenStdConv: b[1][1] else: b[1] - if SameValue(x, y): result = arYes + if sameValue(x, y): result = arYes else: result = arNo # else: maybe and no are accurate else: @@ -140,7 +140,7 @@ proc isPartOf*(a, b: PNode): TAnalysisResult = result = isPartOf(a[1], b[1]) of nkObjUpConv, nkObjDownConv, nkCheckedFieldExpr: result = isPartOf(a[0], b[0]) - else: nil + else: discard # Calls return a new location, so a default of ``arNo`` is fine. else: # go down recursively; this is quite demanding: @@ -177,6 +177,6 @@ proc isPartOf*(a, b: PNode): TAnalysisResult = if isPartOf(a.typ, b.typ) != arNo: result = isPartOf(a[0], b) if result == arNo: result = arMaybe - else: nil - else: nil + else: discard + else: discard diff --git a/compiler/ast.nim b/compiler/ast.nim index 2a7d8a551..cd002eef1 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -192,6 +192,7 @@ type nkObjectTy, # object body nkTupleTy, # tuple body nkTypeClassTy, # user-defined type class + nkStaticTy, # ``static[T]`` nkRecList, # list of object parts nkRecCase, # case section of object nkRecWhen, # when section of object @@ -238,7 +239,7 @@ type sfMainModule, # module is the main module sfSystemModule, # module is the system module sfNoReturn, # proc never returns (an exit proc) - sfAddrTaken, # the variable's address is taken (ex- or implicitely); + sfAddrTaken, # the variable's address is taken (ex- or implicitly); # *OR*: a proc is indirectly called (used as first class) sfCompilerProc, # proc is a compiler proc, that is a C proc that is # needed for the code generator @@ -257,7 +258,7 @@ type # for interfacing with C++, JS sfNamedParamCall, # symbol needs named parameter call syntax in target # language; for interfacing with Objective C - sfDiscardable, # returned value may be discarded implicitely + sfDiscardable, # returned value may be discarded implicitly sfDestructor, # proc is destructor sfGenSym # symbol is 'gensym'ed; do not add to symbol table @@ -335,13 +336,66 @@ type tyConst, tyMutable, tyVarargs, tyIter, # unused tyProxy # used as errornous type (for idetools) - tyTypeClass, + + tyBuiltInTypeClass #\ + # Type such as the catch-all object, tuple, seq, etc + + tyUserTypeClass #\ + # the body of a user-defined type class + + tyUserTypeClassInst #\ + # Instance of a parametric user-defined type class. + # Structured similarly to tyGenericInst. + # tyGenericInst represents concrete types, while + # this is still a "generic param" that will bind types + # and resolves them during sigmatch and instantiation. + + tyCompositeTypeClass #\ + # Type such as seq[Number] + # The notes for tyUserTypeClassInst apply here as well + # sons[0]: the original expression used by the user. + # sons[1]: fully expanded and instantiated meta type + # (potentially following aliases) + + tyAnd, tyOr, tyNot #\ + # boolean type classes such as `string|int`,`not seq`, + # `Sortable and Enumable`, etc + + tyAnything #\ + # a type class matching any type + + tyStatic #\ + # a value known at compile type (the underlying type is .base) + + tyFromExpr #\ + # This is a type representing an expression that depends + # on generic parameters (the exprsesion is stored in t.n) + # It will be converted to a real type only during generic + # instantiation and prior to this it has the potential to + # be any type. + + tyFieldAccessor #\ + # Expressions such as Type.field (valid in contexts such + # as the `is` operator and magics like `high` and `low`). + # Could be lifted to a single argument proc returning the + # field value. + # sons[0]: type of containing object or tuple + # sons[1]: field type + # .n: nkDotExpr storing the field name const tyPureObject* = tyTuple GcTypeKinds* = {tyRef, tySequence, tyString} tyError* = tyProxy # as an errornous node should match everything + tyUnknownTypes* = {tyError, tyFromExpr} + + tyTypeClasses* = {tyBuiltInTypeClass, tyCompositeTypeClass, + tyUserTypeClass, tyUserTypeClassInst, + tyAnd, tyOr, tyNot, tyAnything} + + tyMetaTypes* = {tyGenericParam, tyTypeDesc, tyStatic, tyExpr} + tyTypeClasses + type TTypeKinds* = set[TTypeKind] @@ -357,6 +411,7 @@ type nfSem # node has been checked for semantics nfDelegate # the call can use a delegator nfExprCall # this is an attempt to call a regular expression + nfIsRef # this node is a 'ref' node; used for the VM TNodeFlags* = set[TNodeFlag] TTypeFlag* = enum # keep below 32 for efficiency reasons (now: 23) @@ -375,8 +430,6 @@ type # proc foo(T: typedesc, list: seq[T]): var T tfRetType, # marks return types in proc (used to detect type classes # used as return types for return type inference) - tfAll, # type class requires all constraints to be met (default) - tfAny, # type class requires any constraint to be met tfCapturesEnv, # whether proc really captures some environment tfByCopy, # pass object/tuple by copy (C backend) tfByRef, # pass object/tuple by reference (C backend) @@ -387,8 +440,12 @@ type tfNeedsInit, # type constains a "not nil" constraint somewhere or some # other type so that it requires inititalization tfHasShared, # type constains a "shared" constraint modifier somewhere - tfHasMeta, # type has "typedesc" or "expr" somewhere; or uses '|' + tfHasMeta, # type contains "wildcard" sub-types such as generic params + # or other type classes tfHasGCedMem, # type contains GC'ed memory + tfHasStatic + tfGenericTypeParam + tfImplicitTypeParam TTypeFlags* = set[TTypeFlag] @@ -537,11 +594,11 @@ type typ*: PType info*: TLineInfo flags*: TNodeFlags - case Kind*: TNodeKind + case kind*: TNodeKind of nkCharLit..nkUInt64Lit: - intVal*: biggestInt + intVal*: BiggestInt of nkFloatLit..nkFloat128Lit: - floatVal*: biggestFloat + floatVal*: BiggestFloat of nkStrLit..nkTripleStrLit: strVal*: string of nkSym: @@ -712,7 +769,6 @@ type # -1 means that the size is unkwown align*: int # the type's alignment requirements loc*: TLoc - testeeName*: PIdent # the test variable in user-defined type classes TPair*{.final.} = object key*, val*: PObject @@ -766,9 +822,11 @@ const GenericTypes*: TTypeKinds = {tyGenericInvokation, tyGenericBody, tyGenericParam} + StructuralEquivTypes*: TTypeKinds = {tyArrayConstr, tyNil, tyTuple, tyArray, tySet, tyRange, tyPtr, tyRef, tyVar, tySequence, tyProc, tyOpenArray, tyVarargs} + ConcreteTypes*: TTypeKinds = { # types of the expr that may occur in:: # var x = expr tyBool, tyChar, tyEnum, tyArray, tyObject, @@ -785,7 +843,7 @@ const ExportableSymKinds* = {skVar, skConst, skProc, skMethod, skType, skIterator, skMacro, skTemplate, skConverter, skEnumField, skLet, skStub} PersistentNodeFlags*: TNodeFlags = {nfBase2, nfBase8, nfBase16, - nfAllConst, nfDelegate} + nfAllConst, nfDelegate, nfIsRef} namePos* = 0 patternPos* = 1 # empty except for term rewriting macros genericParamsPos* = 2 @@ -814,7 +872,7 @@ const # imported via 'importc: "fullname"' and no format string. # creator procs: -proc newSym*(symKind: TSymKind, Name: PIdent, owner: PSym, +proc newSym*(symKind: TSymKind, name: PIdent, owner: PSym, info: TLineInfo): PSym proc newType*(kind: TTypeKind, owner: PSym): PType proc newNode*(kind: TNodeKind): PNode @@ -887,6 +945,9 @@ template `{}=`*(n: PNode, i: int, s: PNode): stmt = var emptyNode* = newNode(nkEmpty) # There is a single empty node that is shared! Do not overwrite it! +proc isMetaType*(t: PType): bool = + return t.kind in tyMetaTypes or tfHasMeta in t.flags + proc linkTo*(t: PType, s: PSym): PType {.discardable.} = t.sym = s s.typ = t @@ -903,7 +964,7 @@ template fileIdx*(c: PSym): int32 = template filename*(c: PSym): string = # XXX: this should be used only on module symbols - c.position.int32.toFileName + c.position.int32.toFilename proc appendToModule*(m: PSym, n: PNode) = ## The compiler will use this internally to add nodes that will be @@ -922,7 +983,7 @@ const # for all kind of hash tables: proc copyStrTable(dest: var TStrTable, src: TStrTable) = dest.counter = src.counter if isNil(src.data): return - setlen(dest.data, len(src.data)) + setLen(dest.data, len(src.data)) for i in countup(0, high(src.data)): dest.data[i] = src.data[i] proc copyIdTable(dest: var TIdTable, src: TIdTable) = @@ -934,13 +995,13 @@ proc copyIdTable(dest: var TIdTable, src: TIdTable) = proc copyTable(dest: var TTable, src: TTable) = dest.counter = src.counter if isNil(src.data): return - setlen(dest.data, len(src.data)) + setLen(dest.data, len(src.data)) for i in countup(0, high(src.data)): dest.data[i] = src.data[i] proc copyObjectSet(dest: var TObjectSet, src: TObjectSet) = dest.counter = src.counter if isNil(src.data): return - setlen(dest.data, len(src.data)) + setLen(dest.data, len(src.data)) for i in countup(0, high(src.data)): dest.data[i] = src.data[i] proc discardSons(father: PNode) = @@ -1060,7 +1121,7 @@ proc newProcNode*(kind: TNodeKind, info: TLineInfo, body: PNode, pragmas, exceptions, body] -proc NewType(kind: TTypeKind, owner: PSym): PType = +proc newType(kind: TTypeKind, owner: PSym): PType = new(result) result.kind = kind result.owner = owner @@ -1068,7 +1129,7 @@ proc NewType(kind: TTypeKind, owner: PSym): PType = result.align = 2 # default alignment result.id = getID() when debugIds: - RegisterId(result) + registerId(result) #if result.id < 2000 then # MessageOut(typeKindToStr[kind] & ' has id: ' & toString(result.id)) @@ -1088,7 +1149,6 @@ proc assignType(dest, src: PType) = dest.size = src.size dest.align = src.align dest.destructor = src.destructor - dest.testeeName = src.testeeName # this fixes 'type TLock = TSysLock': if src.sym != nil: if dest.sym != nil: @@ -1101,12 +1161,12 @@ proc assignType(dest, src: PType) = for i in countup(0, sonsLen(src) - 1): dest.sons[i] = src.sons[i] proc copyType(t: PType, owner: PSym, keepId: bool): PType = - result = newType(t.Kind, owner) + result = newType(t.kind, owner) assignType(result, t) if keepId: result.id = t.id else: - when debugIds: RegisterId(result) + when debugIds: registerId(result) result.sym = t.sym # backend-info should not be copied proc copySym(s: PSym, keepId: bool = false): PSym = @@ -1117,7 +1177,7 @@ proc copySym(s: PSym, keepId: bool = false): PSym = result.id = s.id else: result.id = getID() - when debugIds: RegisterId(result) + when debugIds: registerId(result) result.flags = s.flags result.magic = s.magic if s.kind == skModule: @@ -1141,12 +1201,12 @@ proc createModuleAlias*(s: PSym, newIdent: PIdent, info: TLineInfo): PSym = # XXX once usedGenerics is used, ensure module aliases keep working! assert s.usedGenerics == nil -proc newSym(symKind: TSymKind, Name: PIdent, owner: PSym, +proc newSym(symKind: TSymKind, name: PIdent, owner: PSym, info: TLineInfo): PSym = # generates a symbol and initializes the hash field too new(result) - result.Name = Name - result.Kind = symKind + result.name = name + result.kind = symKind result.flags = {} result.info = info result.options = gOptions @@ -1154,36 +1214,36 @@ proc newSym(symKind: TSymKind, Name: PIdent, owner: PSym, result.offset = - 1 result.id = getID() when debugIds: - RegisterId(result) + registerId(result) #if result.id < 2000: # MessageOut(name.s & " has id: " & toString(result.id)) proc initStrTable(x: var TStrTable) = x.counter = 0 - newSeq(x.data, startSize) + newSeq(x.data, StartSize) proc newStrTable*: TStrTable = initStrTable(result) proc initTable(x: var TTable) = x.counter = 0 - newSeq(x.data, startSize) + newSeq(x.data, StartSize) proc initIdTable(x: var TIdTable) = x.counter = 0 - newSeq(x.data, startSize) + newSeq(x.data, StartSize) proc initObjectSet(x: var TObjectSet) = x.counter = 0 - newSeq(x.data, startSize) + newSeq(x.data, StartSize) proc initIdNodeTable(x: var TIdNodeTable) = x.counter = 0 - newSeq(x.data, startSize) + newSeq(x.data, StartSize) proc initNodeTable(x: var TNodeTable) = x.counter = 0 - newSeq(x.data, startSize) + newSeq(x.data, StartSize) proc sonsLen(n: PType): int = if isNil(n.sons): result = 0 @@ -1197,7 +1257,7 @@ proc newSons(father: PType, length: int) = if isNil(father.sons): newSeq(father.sons, length) else: - setlen(father.sons, length) + setLen(father.sons, length) proc sonsLen(n: PNode): int = if isNil(n.sons): result = 0 @@ -1207,12 +1267,16 @@ proc newSons(father: PNode, length: int) = if isNil(father.sons): newSeq(father.sons, length) else: - setlen(father.sons, length) + setLen(father.sons, length) + +proc skipTypes*(t: PType, kinds: TTypeKinds): PType = + result = t + while result.kind in kinds: result = lastSon(result) proc propagateToOwner*(owner, elem: PType) = const HaveTheirOwnEmpty = {tySequence, tySet} owner.flags = owner.flags + (elem.flags * {tfHasShared, tfHasMeta, - tfHasGCedMem}) + tfHasStatic, tfHasGCedMem}) if tfNotNil in elem.flags: if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvokation}: owner.flags.incl tfNotNil @@ -1220,15 +1284,19 @@ proc propagateToOwner*(owner, elem: PType) = owner.flags.incl tfNeedsInit if tfNeedsInit in elem.flags: - if owner.kind in HaveTheirOwnEmpty: nil + if owner.kind in HaveTheirOwnEmpty: discard else: owner.flags.incl tfNeedsInit if tfShared in elem.flags: owner.flags.incl tfHasShared - - if elem.kind in {tyExpr, tyTypeDesc}: + + if elem.kind in tyMetaTypes: owner.flags.incl tfHasMeta - elif elem.kind in {tyString, tyRef, tySequence} or + + if elem.kind == tyStatic: + owner.flags.incl tfHasStatic + + if elem.kind in {tyString, tyRef, tySequence} or elem.kind == tyProc and elem.callConv == ccClosure: owner.flags.incl tfHasGCedMem @@ -1250,7 +1318,7 @@ proc delSon(father: PNode, idx: int) = if isNil(father.sons): return var length = sonsLen(father) for i in countup(idx, length - 2): father.sons[i] = father.sons[i + 1] - setlen(father.sons, length - 1) + setLen(father.sons, length - 1) proc copyNode(src: PNode): PNode = # does not copy its sons! @@ -1263,13 +1331,13 @@ proc copyNode(src: PNode): PNode = when defined(useNodeIds): if result.id == nodeIdToDebug: echo "COMES FROM ", src.id - case src.Kind + case src.kind of nkCharLit..nkUInt64Lit: result.intVal = src.intVal of nkFloatLit..nkFloat128Lit: result.floatVal = src.floatVal of nkSym: result.sym = src.sym of nkIdent: result.ident = src.ident of nkStrLit..nkTripleStrLit: result.strVal = src.strVal - else: nil + else: discard proc shallowCopy*(src: PNode): PNode = # does not copy its sons, but provides space for them: @@ -1281,7 +1349,7 @@ proc shallowCopy*(src: PNode): PNode = when defined(useNodeIds): if result.id == nodeIdToDebug: echo "COMES FROM ", src.id - case src.Kind + case src.kind of nkCharLit..nkUInt64Lit: result.intVal = src.intVal of nkFloatLit..nkFloat128Lit: result.floatVal = src.floatVal of nkSym: result.sym = src.sym @@ -1300,7 +1368,7 @@ proc copyTree(src: PNode): PNode = when defined(useNodeIds): if result.id == nodeIdToDebug: echo "COMES FROM ", src.id - case src.Kind + case src.kind of nkCharLit..nkUInt64Lit: result.intVal = src.intVal of nkFloatLit..nkFloat128Lit: result.floatVal = src.floatVal of nkSym: result.sym = src.sym @@ -1358,14 +1426,14 @@ proc sonsNotNil(n: PNode): bool = return false result = true -proc getInt*(a: PNode): biggestInt = +proc getInt*(a: PNode): BiggestInt = case a.kind of nkIntLit..nkUInt64Lit: result = a.intVal else: internalError(a.info, "getInt") result = 0 -proc getFloat*(a: PNode): biggestFloat = +proc getFloat*(a: PNode): BiggestFloat = case a.kind of nkFloatLit..nkFloat128Lit: result = a.floatVal else: @@ -1392,16 +1460,20 @@ proc isGenericRoutine*(s: PSym): bool = of skProcKinds: result = sfFromGeneric in s.flags or (s.ast != nil and s.ast[genericParamsPos].kind != nkEmpty) - else: nil + else: discard proc skipGenericOwner*(s: PSym): PSym = - InternalAssert s.kind in skProcKinds + internalAssert s.kind in skProcKinds ## Generic instantiations are owned by their originating generic ## symbol. This proc skips such owners and goes straigh to the owner ## of the generic itself (the module or the enclosing proc). result = if sfFromGeneric in s.flags: s.owner.owner else: s.owner +proc originatingModule*(s: PSym): PSym = + result = s.owner + while result.kind != skModule: result = result.owner + proc isRoutine*(s: PSym): bool {.inline.} = result = s.kind in {skProc, skTemplate, skMacro, skIterator, skMethod, skConverter} @@ -1418,3 +1490,4 @@ proc isAtom*(n: PNode): bool {.inline.} = proc isEmptyType*(t: PType): bool {.inline.} = ## 'void' and 'stmt' types are often equivalent to 'nil' these days: result = t == nil or t.kind in {tyEmpty, tyStmt} + diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim index 6c48dd00f..64c1b717c 100644 --- a/compiler/astalgo.nim +++ b/compiler/astalgo.nim @@ -24,35 +24,35 @@ proc symToYaml*(n: PSym, indent: int = 0, maxRecDepth: int = - 1): PRope proc lineInfoToStr*(info: TLineInfo): PRope # ----------------------- node sets: --------------------------------------- -proc ObjectSetContains*(t: TObjectSet, obj: PObject): bool +proc objectSetContains*(t: TObjectSet, obj: PObject): bool # returns true whether n is in t -proc ObjectSetIncl*(t: var TObjectSet, obj: PObject) +proc objectSetIncl*(t: var TObjectSet, obj: PObject) # include an element n in the table t -proc ObjectSetContainsOrIncl*(t: var TObjectSet, obj: PObject): bool +proc objectSetContainsOrIncl*(t: var TObjectSet, obj: PObject): bool # more are not needed ... # ----------------------- (key, val)-Hashtables ---------------------------- -proc TablePut*(t: var TTable, key, val: PObject) -proc TableGet*(t: TTable, key: PObject): PObject +proc tablePut*(t: var TTable, key, val: PObject) +proc tableGet*(t: TTable, key: PObject): PObject type TCmpProc* = proc (key, closure: PObject): bool {.nimcall.} # true if found -proc TableSearch*(t: TTable, key, closure: PObject, +proc tableSearch*(t: TTable, key, closure: PObject, comparator: TCmpProc): PObject # return val as soon as comparator returns true; if this never happens, # nil is returned # ----------------------- str table ----------------------------------------- -proc StrTableContains*(t: TStrTable, n: PSym): bool -proc StrTableAdd*(t: var TStrTable, n: PSym) -proc StrTableGet*(t: TStrTable, name: PIdent): PSym +proc strTableContains*(t: TStrTable, n: PSym): bool +proc strTableAdd*(t: var TStrTable, n: PSym) +proc strTableGet*(t: TStrTable, name: PIdent): PSym type TTabIter*{.final.} = object # consider all fields here private h*: THash # current hash -proc InitTabIter*(ti: var TTabIter, tab: TStrTable): PSym -proc NextIter*(ti: var TTabIter, tab: TStrTable): PSym +proc initTabIter*(ti: var TTabIter, tab: TStrTable): PSym +proc nextIter*(ti: var TTabIter, tab: TStrTable): PSym # usage: # var # i: TTabIter @@ -69,8 +69,8 @@ type name*: PIdent -proc InitIdentIter*(ti: var TIdentIter, tab: TStrTable, s: PIdent): PSym -proc NextIdentIter*(ti: var TIdentIter, tab: TStrTable): PSym +proc initIdentIter*(ti: var TIdentIter, tab: TStrTable, s: PIdent): PSym +proc nextIdentIter*(ti: var TIdentIter, tab: TStrTable): PSym # these are for debugging only: They are not really deprecated, but I want # the warning so that release versions do not contain debugging statements: @@ -79,15 +79,14 @@ proc debug*(n: PType) {.deprecated.} proc debug*(n: PNode) {.deprecated.} # --------------------------- ident tables ---------------------------------- -proc IdTableGet*(t: TIdTable, key: PIdObj): PObject -proc IdTableGet*(t: TIdTable, key: int): PObject -proc IdTablePut*(t: var TIdTable, key: PIdObj, val: PObject) -proc IdTableHasObjectAsKey*(t: TIdTable, key: PIdObj): bool +proc idTableGet*(t: TIdTable, key: PIdObj): PObject +proc idTableGet*(t: TIdTable, key: int): PObject +proc idTablePut*(t: var TIdTable, key: PIdObj, val: PObject) +proc idTableHasObjectAsKey*(t: TIdTable, key: PIdObj): bool # checks if `t` contains the `key` (compared by the pointer value, not only # `key`'s id) -proc IdNodeTableGet*(t: TIdNodeTable, key: PIdObj): PNode -proc IdNodeTablePut*(t: var TIdNodeTable, key: PIdObj, val: PNode) -proc writeIdNodeTable*(t: TIdNodeTable) +proc idNodeTableGet*(t: TIdNodeTable, key: PIdObj): PNode +proc idNodeTablePut*(t: var TIdNodeTable, key: PIdObj, val: PNode) # --------------------------------------------------------------------------- @@ -111,9 +110,9 @@ type data*: TIIPairSeq -proc initIITable*(x: var TIITable) -proc IITableGet*(t: TIITable, key: int): int -proc IITablePut*(t: var TIITable, key, val: int) +proc initIiTable*(x: var TIITable) +proc iiTableGet*(t: TIITable, key: int): int +proc iiTablePut*(t: var TIITable, key, val: int) # implementation @@ -129,7 +128,7 @@ proc skipConvTakeType*(n: PNode): PNode = result = n.skipConv result.typ = n.typ -proc SameValue*(a, b: PNode): bool = +proc sameValue*(a, b: PNode): bool = result = false case a.kind of nkCharLit..nkInt64Lit: @@ -141,7 +140,7 @@ proc SameValue*(a, b: PNode): bool = else: # don't raise an internal error for 'nimrod check': #InternalError(a.info, "SameValue") - nil + discard proc leValue*(a, b: PNode): bool = # a <= b? @@ -156,7 +155,7 @@ proc leValue*(a, b: PNode): bool = else: # don't raise an internal error for 'nimrod check': #InternalError(a.info, "leValue") - nil + discard proc lookupInRecord(n: PNode, field: PIdent): PSym = result = nil @@ -166,7 +165,7 @@ proc lookupInRecord(n: PNode, field: PIdent): PSym = result = lookupInRecord(n.sons[i], field) if result != nil: return of nkRecCase: - if (n.sons[0].kind != nkSym): InternalError(n.info, "lookupInRecord") + if (n.sons[0].kind != nkSym): internalError(n.info, "lookupInRecord") result = lookupInRecord(n.sons[0], field) if result != nil: return for i in countup(1, sonsLen(n) - 1): @@ -182,14 +181,14 @@ proc lookupInRecord(n: PNode, field: PIdent): PSym = proc getModule(s: PSym): PSym = result = s assert((result.kind == skModule) or (result.owner != result)) - while (result != nil) and (result.kind != skModule): result = result.owner + while result != nil and result.kind != skModule: result = result.owner proc getSymFromList(list: PNode, ident: PIdent, start: int = 0): PSym = for i in countup(start, sonsLen(list) - 1): if list.sons[i].kind == nkSym: result = list.sons[i].sym if result.name.id == ident.id: return - else: InternalError(list.info, "getSymFromList") + else: internalError(list.info, "getSymFromList") result = nil proc hashNode(p: PObject): THash = @@ -203,7 +202,7 @@ proc spaces(x: int): PRope = # returns x spaces result = toRope(repeatChar(x)) -proc toYamlChar(c: Char): string = +proc toYamlChar(c: char): string = case c of '\0'..'\x1F', '\x80'..'\xFF': result = "\\u" & strutils.toHex(ord(c), 4) of '\'', '\"', '\\': result = '\\' & c @@ -216,7 +215,7 @@ proc makeYamlString*(s: string): PRope = const MaxLineLength = 64 result = nil var res = "\"" - for i in countup(0, len(s) - 1): + for i in countup(0, if s.isNil: -1 else: (len(s)-1)): if (i + 1) mod MaxLineLength == 0: add(res, '\"') add(res, "\n") @@ -262,7 +261,7 @@ proc strTableToYaml(n: TStrTable, marker: var TIntSet, indent: int, app(result, "]") assert(mycount == n.counter) -proc ropeConstr(indent: int, c: openarray[PRope]): PRope = +proc ropeConstr(indent: int, c: openArray[PRope]): PRope = # array of (name, value) pairs var istr = spaces(indent + 2) result = toRope("{") @@ -277,7 +276,7 @@ proc symToYamlAux(n: PSym, marker: var TIntSet, indent: int, maxRecDepth: int): PRope = if n == nil: result = toRope("null") - elif ContainsOrIncl(marker, n.id): + elif containsOrIncl(marker, n.id): result = ropef("\"$1 @$2\"", [toRope(n.name.s), toRope( strutils.toHex(cast[TAddress](n), sizeof(n) * 2))]) else: @@ -298,7 +297,7 @@ proc typeToYamlAux(n: PType, marker: var TIntSet, indent: int, maxRecDepth: int): PRope = if n == nil: result = toRope("null") - elif ContainsOrIncl(marker, n.id): + elif containsOrIncl(marker, n.id): result = ropef("\"$1 @$2\"", [toRope($n.kind), toRope( strutils.toHex(cast[TAddress](n), sizeof(n) * 2))]) else: @@ -315,7 +314,7 @@ proc typeToYamlAux(n: PType, marker: var TIntSet, indent: int, makeYamlString($n.kind), toRope("sym"), symToYamlAux(n.sym, marker, indent + 2, maxRecDepth - 1), toRope("n"), treeToYamlAux(n.n, marker, - indent + 2, maxRecDepth - 1), toRope("flags"), FlagsToStr(n.flags), + indent + 2, maxRecDepth - 1), toRope("flags"), flagsToStr(n.flags), toRope("callconv"), makeYamlString(CallingConvToStr[n.callConv]), toRope("size"), toRope(n.size), @@ -336,7 +335,7 @@ proc treeToYamlAux(n: PNode, marker: var TIntSet, indent: int, appf(result, ",$N$1\"intVal\": $2", [istr, toRope(n.intVal)]) of nkFloatLit, nkFloat32Lit, nkFloat64Lit: appf(result, ",$N$1\"floatVal\": $2", - [istr, toRope(n.floatVal.ToStrMaxPrecision)]) + [istr, toRope(n.floatVal.toStrMaxPrecision)]) of nkStrLit..nkTripleStrLit: appf(result, ",$N$1\"strVal\": $2", [istr, makeYamlString(n.strVal)]) of nkSym: @@ -360,15 +359,15 @@ proc treeToYamlAux(n: PNode, marker: var TIntSet, indent: int, appf(result, "$N$1}", [spaces(indent)]) proc treeToYaml(n: PNode, indent: int = 0, maxRecDepth: int = - 1): PRope = - var marker = InitIntSet() + var marker = initIntSet() result = treeToYamlAux(n, marker, indent, maxRecDepth) proc typeToYaml(n: PType, indent: int = 0, maxRecDepth: int = - 1): PRope = - var marker = InitIntSet() + var marker = initIntSet() result = typeToYamlAux(n, marker, indent, maxRecDepth) proc symToYaml(n: PSym, indent: int = 0, maxRecDepth: int = - 1): PRope = - var marker = InitIntSet() + var marker = initIntSet() result = symToYamlAux(n, marker, indent, maxRecDepth) proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope @@ -406,7 +405,7 @@ proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope = appf(result, ",$N$1\"intVal\": $2", [istr, toRope(n.intVal)]) of nkFloatLit, nkFloat32Lit, nkFloat64Lit: appf(result, ",$N$1\"floatVal\": $2", - [istr, toRope(n.floatVal.ToStrMaxPrecision)]) + [istr, toRope(n.floatVal.toStrMaxPrecision)]) of nkStrLit..nkTripleStrLit: appf(result, ",$N$1\"strVal\": $2", [istr, makeYamlString(n.strVal)]) of nkSym: @@ -433,6 +432,8 @@ proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope = proc debug(n: PSym) = if n == nil: writeln(stdout, "null") + elif n.kind == skUnknown: + writeln(stdout, "skUnknown") else: #writeln(stdout, ropeToStr(symToYaml(n, 0, 1))) writeln(stdout, ropeToStr(ropef("$1_$2: $3, $4", [ @@ -454,18 +455,18 @@ proc nextTry(h, maxHash: THash): THash = # generates each int in range(maxHash) exactly once (see any text on # random-number generation for proof). -proc objectSetContains(t: TObjectSet, obj: PObject): bool = +proc objectSetContains(t: TObjectSet, obj: PObject): bool = # returns true whether n is in t var h: THash = hashNode(obj) and high(t.data) # start with real hash value - while t.data[h] != nil: - if (t.data[h] == obj): + while t.data[h] != nil: + if t.data[h] == obj: return true h = nextTry(h, high(t.data)) result = false -proc objectSetRawInsert(data: var TObjectSeq, obj: PObject) = - var h: THash = HashNode(obj) and high(data) - while data[h] != nil: +proc objectSetRawInsert(data: var TObjectSeq, obj: PObject) = + var h: THash = hashNode(obj) and high(data) + while data[h] != nil: assert(data[h] != obj) h = nextTry(h, high(data)) assert(data[h] == nil) @@ -473,8 +474,8 @@ proc objectSetRawInsert(data: var TObjectSeq, obj: PObject) = proc objectSetEnlarge(t: var TObjectSet) = var n: TObjectSeq - newSeq(n, len(t.data) * growthFactor) - for i in countup(0, high(t.data)): + newSeq(n, len(t.data) * GrowthFactor) + for i in countup(0, high(t.data)): if t.data[i] != nil: objectSetRawInsert(n, t.data[i]) swap(t.data, n) @@ -485,7 +486,7 @@ proc objectSetIncl(t: var TObjectSet, obj: PObject) = proc objectSetContainsOrIncl(t: var TObjectSet, obj: PObject): bool = # returns true if obj is already in the string table: - var h: THash = HashNode(obj) and high(t.data) + var h: THash = hashNode(obj) and high(t.data) while true: var it = t.data[h] if it == nil: break @@ -501,7 +502,7 @@ proc objectSetContainsOrIncl(t: var TObjectSet, obj: PObject): bool = inc(t.counter) result = false -proc TableRawGet(t: TTable, key: PObject): int = +proc tableRawGet(t: TTable, key: PObject): int = var h: THash = hashNode(key) and high(t.data) # start with real hash value while t.data[h].key != nil: if t.data[h].key == key: @@ -509,7 +510,7 @@ proc TableRawGet(t: TTable, key: PObject): int = h = nextTry(h, high(t.data)) result = -1 -proc TableSearch(t: TTable, key, closure: PObject, +proc tableSearch(t: TTable, key, closure: PObject, comparator: TCmpProc): PObject = var h: THash = hashNode(key) and high(t.data) # start with real hash value while t.data[h].key != nil: @@ -520,13 +521,13 @@ proc TableSearch(t: TTable, key, closure: PObject, h = nextTry(h, high(t.data)) result = nil -proc TableGet(t: TTable, key: PObject): PObject = - var index = TableRawGet(t, key) +proc tableGet(t: TTable, key: PObject): PObject = + var index = tableRawGet(t, key) if index >= 0: result = t.data[index].val else: result = nil -proc TableRawInsert(data: var TPairSeq, key, val: PObject) = - var h: THash = HashNode(key) and high(data) +proc tableRawInsert(data: var TPairSeq, key, val: PObject) = + var h: THash = hashNode(key) and high(data) while data[h].key != nil: assert(data[h].key != key) h = nextTry(h, high(data)) @@ -534,23 +535,23 @@ proc TableRawInsert(data: var TPairSeq, key, val: PObject) = data[h].key = key data[h].val = val -proc TableEnlarge(t: var TTable) = +proc tableEnlarge(t: var TTable) = var n: TPairSeq - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(t.data)): - if t.data[i].key != nil: TableRawInsert(n, t.data[i].key, t.data[i].val) + if t.data[i].key != nil: tableRawInsert(n, t.data[i].key, t.data[i].val) swap(t.data, n) -proc TablePut(t: var TTable, key, val: PObject) = - var index = TableRawGet(t, key) +proc tablePut(t: var TTable, key, val: PObject) = + var index = tableRawGet(t, key) if index >= 0: t.data[index].val = val else: - if mustRehash(len(t.data), t.counter): TableEnlarge(t) - TableRawInsert(t.data, key, val) + if mustRehash(len(t.data), t.counter): tableEnlarge(t) + tableRawInsert(t.data, key, val) inc(t.counter) -proc StrTableContains(t: TStrTable, n: PSym): bool = +proc strTableContains(t: TStrTable, n: PSym): bool = var h: THash = n.name.h and high(t.data) # start with real hash value while t.data[h] != nil: if (t.data[h] == n): @@ -558,18 +559,35 @@ proc StrTableContains(t: TStrTable, n: PSym): bool = h = nextTry(h, high(t.data)) result = false -proc StrTableRawInsert(data: var TSymSeq, n: PSym) = +proc strTableRawInsert(data: var TSymSeq, n: PSym) = var h: THash = n.name.h and high(data) - while data[h] != nil: - if data[h] == n: - # allowed for 'export' feature: - #InternalError(n.info, "StrTableRawInsert: " & n.name.s) - return - h = nextTry(h, high(data)) - assert(data[h] == nil) - data[h] = n - -proc SymTabReplaceRaw(data: var TSymSeq, prevSym: PSym, newSym: PSym) = + if sfImmediate notin n.flags: + # fast path: + while data[h] != nil: + if data[h] == n: + # allowed for 'export' feature: + #InternalError(n.info, "StrTableRawInsert: " & n.name.s) + return + h = nextTry(h, high(data)) + assert(data[h] == nil) + data[h] = n + else: + # slow path; we have to ensure immediate symbols are preferred for + # symbol lookups. + # consider the chain: foo (immediate), foo, bar, bar (immediate) + # then bar (immediate) gets replaced with foo (immediate) and the non + # immediate foo is picked! Thus we need to replace it with the first + # slot that has in fact the same identifier stored in it! + var favPos = -1 + while data[h] != nil: + if data[h] == n: return + if favPos < 0 and data[h].name.id == n.name.id: favPos = h + h = nextTry(h, high(data)) + assert(data[h] == nil) + data[h] = n + if favPos >= 0: swap data[h], data[favPos] + +proc symTabReplaceRaw(data: var TSymSeq, prevSym: PSym, newSym: PSym) = assert prevSym.name.h == newSym.name.h var h: THash = prevSym.name.h and high(data) while data[h] != nil: @@ -579,22 +597,22 @@ proc SymTabReplaceRaw(data: var TSymSeq, prevSym: PSym, newSym: PSym) = h = nextTry(h, high(data)) assert false -proc SymTabReplace*(t: var TStrTable, prevSym: PSym, newSym: PSym) = - SymTabReplaceRaw(t.data, prevSym, newSym) +proc symTabReplace*(t: var TStrTable, prevSym: PSym, newSym: PSym) = + symTabReplaceRaw(t.data, prevSym, newSym) -proc StrTableEnlarge(t: var TStrTable) = +proc strTableEnlarge(t: var TStrTable) = var n: TSymSeq - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(t.data)): - if t.data[i] != nil: StrTableRawInsert(n, t.data[i]) + if t.data[i] != nil: strTableRawInsert(n, t.data[i]) swap(t.data, n) -proc StrTableAdd(t: var TStrTable, n: PSym) = - if mustRehash(len(t.data), t.counter): StrTableEnlarge(t) - StrTableRawInsert(t.data, n) +proc strTableAdd(t: var TStrTable, n: PSym) = + if mustRehash(len(t.data), t.counter): strTableEnlarge(t) + strTableRawInsert(t.data, n) inc(t.counter) -proc StrTableIncl*(t: var TStrTable, n: PSym): bool {.discardable.} = +proc strTableIncl*(t: var TStrTable, n: PSym): bool {.discardable.} = # returns true if n is already in the string table: # It is essential that `n` is written nevertheless! # This way the newest redefinition is picked by the semantic analyses! @@ -608,15 +626,15 @@ proc StrTableIncl*(t: var TStrTable, n: PSym): bool {.discardable.} = return true # found it h = nextTry(h, high(t.data)) if mustRehash(len(t.data), t.counter): - StrTableEnlarge(t) - StrTableRawInsert(t.data, n) + strTableEnlarge(t) + strTableRawInsert(t.data, n) else: assert(t.data[h] == nil) t.data[h] = n inc(t.counter) result = false -proc StrTableGet(t: TStrTable, name: PIdent): PSym = +proc strTableGet(t: TStrTable, name: PIdent): PSym = var h: THash = name.h and high(t.data) while true: result = t.data[h] @@ -624,19 +642,19 @@ proc StrTableGet(t: TStrTable, name: PIdent): PSym = if result.name.id == name.id: break h = nextTry(h, high(t.data)) -proc InitIdentIter(ti: var TIdentIter, tab: TStrTable, s: PIdent): PSym = +proc initIdentIter(ti: var TIdentIter, tab: TStrTable, s: PIdent): PSym = ti.h = s.h ti.name = s - if tab.Counter == 0: result = nil - else: result = NextIdentIter(ti, tab) + if tab.counter == 0: result = nil + else: result = nextIdentIter(ti, tab) -proc NextIdentIter(ti: var TIdentIter, tab: TStrTable): PSym = +proc nextIdentIter(ti: var TIdentIter, tab: TStrTable): PSym = var h, start: THash h = ti.h and high(tab.data) start = h result = tab.data[h] while result != nil: - if result.Name.id == ti.name.id: break + if result.name.id == ti.name.id: break h = nextTry(h, high(tab.data)) if h == start: result = nil @@ -644,13 +662,13 @@ proc NextIdentIter(ti: var TIdentIter, tab: TStrTable): PSym = result = tab.data[h] ti.h = nextTry(h, high(tab.data)) -proc NextIdentExcluding*(ti: var TIdentIter, tab: TStrTable, +proc nextIdentExcluding*(ti: var TIdentIter, tab: TStrTable, excluding: TIntSet): PSym = var h: THash = ti.h and high(tab.data) var start = h result = tab.data[h] while result != nil: - if result.Name.id == ti.name.id and not Contains(excluding, result.id): + if result.name.id == ti.name.id and not contains(excluding, result.id): break h = nextTry(h, high(tab.data)) if h == start: @@ -658,35 +676,35 @@ proc NextIdentExcluding*(ti: var TIdentIter, tab: TStrTable, break result = tab.data[h] ti.h = nextTry(h, high(tab.data)) - if result != nil and Contains(excluding, result.id): result = nil + if result != nil and contains(excluding, result.id): result = nil -proc FirstIdentExcluding*(ti: var TIdentIter, tab: TStrTable, s: PIdent, +proc firstIdentExcluding*(ti: var TIdentIter, tab: TStrTable, s: PIdent, excluding: TIntSet): PSym = ti.h = s.h ti.name = s - if tab.Counter == 0: result = nil - else: result = NextIdentExcluding(ti, tab, excluding) + if tab.counter == 0: result = nil + else: result = nextIdentExcluding(ti, tab, excluding) -proc InitTabIter(ti: var TTabIter, tab: TStrTable): PSym = +proc initTabIter(ti: var TTabIter, tab: TStrTable): PSym = ti.h = 0 # we start by zero ... if tab.counter == 0: result = nil # FIX 1: removed endless loop else: - result = NextIter(ti, tab) + result = nextIter(ti, tab) -proc NextIter(ti: var TTabIter, tab: TStrTable): PSym = +proc nextIter(ti: var TTabIter, tab: TStrTable): PSym = result = nil while (ti.h <= high(tab.data)): result = tab.data[ti.h] - Inc(ti.h) # ... and increment by one always + inc(ti.h) # ... and increment by one always if result != nil: break iterator items*(tab: TStrTable): PSym = var it: TTabIter - var s = InitTabIter(it, tab) + var s = initTabIter(it, tab) while s != nil: yield s - s = NextIter(it, tab) + s = nextIter(it, tab) proc hasEmptySlot(data: TIdPairSeq): bool = for h in countup(0, high(data)): @@ -694,27 +712,27 @@ proc hasEmptySlot(data: TIdPairSeq): bool = return true result = false -proc IdTableRawGet(t: TIdTable, key: int): int = +proc idTableRawGet(t: TIdTable, key: int): int = var h: THash h = key and high(t.data) # start with real hash value while t.data[h].key != nil: - if (t.data[h].key.id == key): + if t.data[h].key.id == key: return h h = nextTry(h, high(t.data)) result = - 1 -proc IdTableHasObjectAsKey(t: TIdTable, key: PIdObj): bool = - var index = IdTableRawGet(t, key.id) +proc idTableHasObjectAsKey(t: TIdTable, key: PIdObj): bool = + var index = idTableRawGet(t, key.id) if index >= 0: result = t.data[index].key == key else: result = false -proc IdTableGet(t: TIdTable, key: PIdObj): PObject = - var index = IdTableRawGet(t, key.id) +proc idTableGet(t: TIdTable, key: PIdObj): PObject = + var index = idTableRawGet(t, key.id) if index >= 0: result = t.data[index].val else: result = nil -proc IdTableGet(t: TIdTable, key: int): PObject = - var index = IdTableRawGet(t, key) +proc idTableGet(t: TIdTable, key: int): PObject = + var index = idTableRawGet(t, key) if index >= 0: result = t.data[index].val else: result = nil @@ -723,7 +741,7 @@ iterator pairs*(t: TIdTable): tuple[key: int, value: PObject] = if t.data[i].key != nil: yield (t.data[i].key.id, t.data[i].val) -proc IdTableRawInsert(data: var TIdPairSeq, key: PIdObj, val: PObject) = +proc idTableRawInsert(data: var TIdPairSeq, key: PIdObj, val: PObject) = var h: THash h = key.id and high(data) while data[h].key != nil: @@ -733,33 +751,30 @@ proc IdTableRawInsert(data: var TIdPairSeq, key: PIdObj, val: PObject) = data[h].key = key data[h].val = val -proc IdTablePut(t: var TIdTable, key: PIdObj, val: PObject) = +proc idTablePut(t: var TIdTable, key: PIdObj, val: PObject) = var index: int n: TIdPairSeq - index = IdTableRawGet(t, key.id) + index = idTableRawGet(t, key.id) if index >= 0: assert(t.data[index].key != nil) t.data[index].val = val else: if mustRehash(len(t.data), t.counter): - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(t.data)): if t.data[i].key != nil: - IdTableRawInsert(n, t.data[i].key, t.data[i].val) + idTableRawInsert(n, t.data[i].key, t.data[i].val) assert(hasEmptySlot(n)) swap(t.data, n) - IdTableRawInsert(t.data, key, val) + idTableRawInsert(t.data, key, val) inc(t.counter) -iterator IdTablePairs*(t: TIdTable): tuple[key: PIdObj, val: PObject] = +iterator idTablePairs*(t: TIdTable): tuple[key: PIdObj, val: PObject] = for i in 0 .. high(t.data): if not isNil(t.data[i].key): yield (t.data[i].key, t.data[i].val) -proc writeIdNodeTable(t: TIdNodeTable) = - nil - -proc IdNodeTableRawGet(t: TIdNodeTable, key: PIdObj): int = +proc idNodeTableRawGet(t: TIdNodeTable, key: PIdObj): int = var h: THash h = key.id and high(t.data) # start with real hash value while t.data[h].key != nil: @@ -768,17 +783,17 @@ proc IdNodeTableRawGet(t: TIdNodeTable, key: PIdObj): int = h = nextTry(h, high(t.data)) result = - 1 -proc IdNodeTableGet(t: TIdNodeTable, key: PIdObj): PNode = +proc idNodeTableGet(t: TIdNodeTable, key: PIdObj): PNode = var index: int - index = IdNodeTableRawGet(t, key) + index = idNodeTableRawGet(t, key) if index >= 0: result = t.data[index].val else: result = nil -proc IdNodeTableGetLazy*(t: TIdNodeTable, key: PIdObj): PNode = +proc idNodeTableGetLazy*(t: TIdNodeTable, key: PIdObj): PNode = if not isNil(t.data): - result = IdNodeTableGet(t, key) + result = idNodeTableGet(t, key) -proc IdNodeTableRawInsert(data: var TIdNodePairSeq, key: PIdObj, val: PNode) = +proc idNodeTableRawInsert(data: var TIdNodePairSeq, key: PIdObj, val: PNode) = var h: THash h = key.id and high(data) while data[h].key != nil: @@ -788,25 +803,25 @@ proc IdNodeTableRawInsert(data: var TIdNodePairSeq, key: PIdObj, val: PNode) = data[h].key = key data[h].val = val -proc IdNodeTablePut(t: var TIdNodeTable, key: PIdObj, val: PNode) = - var index = IdNodeTableRawGet(t, key) +proc idNodeTablePut(t: var TIdNodeTable, key: PIdObj, val: PNode) = + var index = idNodeTableRawGet(t, key) if index >= 0: assert(t.data[index].key != nil) t.data[index].val = val else: if mustRehash(len(t.data), t.counter): var n: TIdNodePairSeq - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(t.data)): if t.data[i].key != nil: - IdNodeTableRawInsert(n, t.data[i].key, t.data[i].val) + idNodeTableRawInsert(n, t.data[i].key, t.data[i].val) swap(t.data, n) - IdNodeTableRawInsert(t.data, key, val) + idNodeTableRawInsert(t.data, key, val) inc(t.counter) -proc IdNodeTablePutLazy*(t: var TIdNodeTable, key: PIdObj, val: PNode) = +proc idNodeTablePutLazy*(t: var TIdNodeTable, key: PIdObj, val: PNode) = if isNil(t.data): initIdNodeTable(t) - IdNodeTablePut(t, key, val) + idNodeTablePut(t, key, val) iterator pairs*(t: TIdNodeTable): tuple[key: PIdObj, val: PNode] = for i in 0 .. high(t.data): @@ -814,24 +829,23 @@ iterator pairs*(t: TIdNodeTable): tuple[key: PIdObj, val: PNode] = proc initIITable(x: var TIITable) = x.counter = 0 - newSeq(x.data, startSize) - for i in countup(0, startSize - 1): x.data[i].key = InvalidKey + newSeq(x.data, StartSize) + for i in countup(0, StartSize - 1): x.data[i].key = InvalidKey -proc IITableRawGet(t: TIITable, key: int): int = +proc iiTableRawGet(t: TIITable, key: int): int = var h: THash h = key and high(t.data) # start with real hash value while t.data[h].key != InvalidKey: - if (t.data[h].key == key): - return h + if t.data[h].key == key: return h h = nextTry(h, high(t.data)) - result = - 1 + result = -1 -proc IITableGet(t: TIITable, key: int): int = - var index = IITableRawGet(t, key) +proc iiTableGet(t: TIITable, key: int): int = + var index = iiTableRawGet(t, key) if index >= 0: result = t.data[index].val else: result = InvalidKey -proc IITableRawInsert(data: var TIIPairSeq, key, val: int) = +proc iiTableRawInsert(data: var TIIPairSeq, key, val: int) = var h: THash h = key and high(data) while data[h].key != InvalidKey: @@ -841,19 +855,19 @@ proc IITableRawInsert(data: var TIIPairSeq, key, val: int) = data[h].key = key data[h].val = val -proc IITablePut(t: var TIITable, key, val: int) = - var index = IITableRawGet(t, key) +proc iiTablePut(t: var TIITable, key, val: int) = + var index = iiTableRawGet(t, key) if index >= 0: assert(t.data[index].key != InvalidKey) t.data[index].val = val else: if mustRehash(len(t.data), t.counter): var n: TIIPairSeq - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(n)): n[i].key = InvalidKey for i in countup(0, high(t.data)): if t.data[i].key != InvalidKey: - IITableRawInsert(n, t.data[i].key, t.data[i].val) + iiTableRawInsert(n, t.data[i].key, t.data[i].val) swap(t.data, n) - IITableRawInsert(t.data, key, val) + iiTableRawInsert(t.data, key, val) inc(t.counter) diff --git a/compiler/babelcmd.nim b/compiler/babelcmd.nim index b67a26040..7fa233732 100644 --- a/compiler/babelcmd.nim +++ b/compiler/babelcmd.nim @@ -13,7 +13,7 @@ import parseutils, strutils, strtabs, os, options, msgs, lists proc addPath*(path: string, info: TLineInfo) = if not contains(options.searchPaths, path): - lists.PrependStr(options.searchPaths, path) + lists.prependStr(options.searchPaths, path) proc versionSplitPos(s: string): int = result = s.len-2 @@ -45,9 +45,9 @@ proc `<.`(a, b: string): bool = proc addPackage(packages: PStringTable, p: string) = let x = versionSplitPos(p) - let name = p.subStr(0, x-1) + let name = p.substr(0, x-1) if x < p.len: - let version = p.subStr(x+1) + let version = p.substr(x+1) if packages[name] <. version: packages[name] = version else: @@ -60,8 +60,8 @@ iterator chosen(packages: PStringTable): string = proc addBabelPath(p: string, info: TLineInfo) = if not contains(options.searchPaths, p): - if gVerbosity >= 1: Message(info, hintPath, p) - lists.PrependStr(options.lazyPaths, p) + if gVerbosity >= 1: message(info, hintPath, p) + lists.prependStr(options.lazyPaths, p) proc addPathWithNimFiles(p: string, info: TLineInfo) = proc hasNimFile(dir: string): bool = diff --git a/compiler/bitsets.nim b/compiler/bitsets.nim index dfb23b06d..740bdd5ef 100644 --- a/compiler/bitsets.nim +++ b/compiler/bitsets.nim @@ -18,53 +18,53 @@ type const ElemSize* = sizeof(int8) * 8 -proc BitSetInit*(b: var TBitSet, length: int) -proc BitSetUnion*(x: var TBitSet, y: TBitSet) -proc BitSetDiff*(x: var TBitSet, y: TBitSet) -proc BitSetSymDiff*(x: var TBitSet, y: TBitSet) -proc BitSetIntersect*(x: var TBitSet, y: TBitSet) -proc BitSetIncl*(x: var TBitSet, elem: BiggestInt) -proc BitSetExcl*(x: var TBitSet, elem: BiggestInt) -proc BitSetIn*(x: TBitSet, e: BiggestInt): bool -proc BitSetEquals*(x, y: TBitSet): bool -proc BitSetContains*(x, y: TBitSet): bool +proc bitSetInit*(b: var TBitSet, length: int) +proc bitSetUnion*(x: var TBitSet, y: TBitSet) +proc bitSetDiff*(x: var TBitSet, y: TBitSet) +proc bitSetSymDiff*(x: var TBitSet, y: TBitSet) +proc bitSetIntersect*(x: var TBitSet, y: TBitSet) +proc bitSetIncl*(x: var TBitSet, elem: BiggestInt) +proc bitSetExcl*(x: var TBitSet, elem: BiggestInt) +proc bitSetIn*(x: TBitSet, e: BiggestInt): bool +proc bitSetEquals*(x, y: TBitSet): bool +proc bitSetContains*(x, y: TBitSet): bool # implementation -proc BitSetIn(x: TBitSet, e: BiggestInt): bool = +proc bitSetIn(x: TBitSet, e: BiggestInt): bool = result = (x[int(e div ElemSize)] and toU8(int(1 shl (e mod ElemSize)))) != toU8(0) -proc BitSetIncl(x: var TBitSet, elem: BiggestInt) = +proc bitSetIncl(x: var TBitSet, elem: BiggestInt) = assert(elem >= 0) x[int(elem div ElemSize)] = x[int(elem div ElemSize)] or toU8(int(1 shl (elem mod ElemSize))) -proc BitSetExcl(x: var TBitSet, elem: BiggestInt) = +proc bitSetExcl(x: var TBitSet, elem: BiggestInt) = x[int(elem div ElemSize)] = x[int(elem div ElemSize)] and not toU8(int(1 shl (elem mod ElemSize))) -proc BitSetInit(b: var TBitSet, length: int) = +proc bitSetInit(b: var TBitSet, length: int) = newSeq(b, length) -proc BitSetUnion(x: var TBitSet, y: TBitSet) = +proc bitSetUnion(x: var TBitSet, y: TBitSet) = for i in countup(0, high(x)): x[i] = x[i] or y[i] -proc BitSetDiff(x: var TBitSet, y: TBitSet) = +proc bitSetDiff(x: var TBitSet, y: TBitSet) = for i in countup(0, high(x)): x[i] = x[i] and not y[i] -proc BitSetSymDiff(x: var TBitSet, y: TBitSet) = +proc bitSetSymDiff(x: var TBitSet, y: TBitSet) = for i in countup(0, high(x)): x[i] = x[i] xor y[i] -proc BitSetIntersect(x: var TBitSet, y: TBitSet) = +proc bitSetIntersect(x: var TBitSet, y: TBitSet) = for i in countup(0, high(x)): x[i] = x[i] and y[i] -proc BitSetEquals(x, y: TBitSet): bool = +proc bitSetEquals(x, y: TBitSet): bool = for i in countup(0, high(x)): if x[i] != y[i]: return false result = true -proc BitSetContains(x, y: TBitSet): bool = +proc bitSetContains(x, y: TBitSet): bool = for i in countup(0, high(x)): if (x[i] and not y[i]) != int8(0): return false diff --git a/compiler/c2nim/c2nim.nim b/compiler/c2nim/c2nim.nim index df1e42f23..9b12b9e47 100644 --- a/compiler/c2nim/c2nim.nim +++ b/compiler/c2nim/c2nim.nim @@ -34,25 +34,36 @@ Options: --skipcomments do not copy comments --ignoreRValueRefs translate C++'s ``T&&`` to ``T`` instead ``of var T`` --keepBodies keep C++'s method bodies + --spliceHeader parse and emit header before source file -v, --version write c2nim's version -h, --help show this help """ -proc main(infile, outfile: string, options: PParserOptions) = - var start = getTime() - var stream = LLStreamOpen(infile, fmRead) +proc parse(infile: string, options: PParserOptions): PNode = + var stream = llStreamOpen(infile, fmRead) if stream == nil: rawMessage(errCannotOpenFile, infile) var p: TParser openParser(p, infile, stream, options) - var module = parseUnit(p) + result = parseUnit(p) closeParser(p) - renderModule(module, outfile) + +proc main(infile, outfile: string, options: PParserOptions, spliceHeader: bool) = + var start = getTime() + if spliceHeader and infile.splitFile.ext == ".c" and existsFile(infile.changeFileExt(".h")): + var header_module = parse(infile.changeFileExt(".h"), options) + var source_module = parse(infile, options) + for n in source_module: + addson(header_module, n) + renderModule(header_module, outfile) + else: + renderModule(parse(infile, options), outfile) rawMessage(hintSuccessX, [$gLinesCompiled, $(getTime() - start), formatSize(getTotalMem())]) var infile = "" outfile = "" + spliceHeader = false parserOptions = newParserOptions() for kind, key, val in getopt(): case kind @@ -66,6 +77,7 @@ for kind, key, val in getopt(): stdout.write(Version & "\n") quit(0) of "o", "out": outfile = val + of "spliceheader": spliceHeader = true else: if not parserOptions.setOption(key, val): stdout.writeln("[Error] unknown option: " & key) @@ -77,4 +89,4 @@ else: if outfile.len == 0: outfile = changeFileExt(infile, "nim") infile = addFileExt(infile, "h") - main(infile, outfile, parserOptions) + main(infile, outfile, parserOptions, spliceHeader) diff --git a/compiler/c2nim/clex.nim b/compiler/c2nim/clex.nim index f949b97cb..3934eea63 100644 --- a/compiler/c2nim/clex.nim +++ b/compiler/c2nim/clex.nim @@ -103,7 +103,7 @@ type inDirective: bool proc getTok*(L: var TLexer, tok: var TToken) -proc PrintTok*(tok: TToken) +proc printTok*(tok: TToken) proc `$`*(tok: TToken): string # implementation @@ -138,7 +138,7 @@ proc lexMessagePos(L: var TLexer, msg: TMsgKind, pos: int, arg = "") = var info = newLineInfo(L.fileIdx, L.linenumber, pos - L.lineStart) msgs.GlobalError(info, msg, arg) -proc TokKindToStr*(k: TTokKind): string = +proc tokKindToStr*(k: TTokKind): string = case k of pxEof: result = "[EOF]" of pxInvalid: result = "[invalid]" @@ -211,9 +211,9 @@ proc `$`(tok: TToken): string = of pxSymbol, pxInvalid, pxStarComment, pxLineComment, pxStrLit: result = tok.s of pxIntLit, pxInt64Lit: result = $tok.iNumber of pxFloatLit: result = $tok.fNumber - else: result = TokKindToStr(tok.xkind) + else: result = tokKindToStr(tok.xkind) -proc PrintTok(tok: TToken) = +proc printTok(tok: TToken) = writeln(stdout, $tok) proc matchUnderscoreChars(L: var TLexer, tok: var TToken, chars: TCharSet) = @@ -223,12 +223,12 @@ proc matchUnderscoreChars(L: var TLexer, tok: var TToken, chars: TCharSet) = while true: if buf[pos] in chars: add(tok.s, buf[pos]) - Inc(pos) + inc(pos) else: break if buf[pos] == '_': add(tok.s, '_') - Inc(pos) + inc(pos) L.bufPos = pos proc isFloatLiteral(s: string): bool = @@ -239,7 +239,7 @@ proc isFloatLiteral(s: string): bool = proc getNumber2(L: var TLexer, tok: var TToken) = var pos = L.bufpos + 2 # skip 0b tok.base = base2 - var xi: biggestInt = 0 + var xi: BiggestInt = 0 var bits = 0 while true: case L.buf[pos] @@ -264,7 +264,7 @@ proc getNumber2(L: var TLexer, tok: var TToken) = proc getNumber8(L: var TLexer, tok: var TToken) = var pos = L.bufpos + 1 # skip 0 tok.base = base8 - var xi: biggestInt = 0 + var xi: BiggestInt = 0 var bits = 0 while true: case L.buf[pos] @@ -289,7 +289,7 @@ proc getNumber8(L: var TLexer, tok: var TToken) = proc getNumber16(L: var TLexer, tok: var TToken) = var pos = L.bufpos + 2 # skip 0x tok.base = base16 - var xi: biggestInt = 0 + var xi: BiggestInt = 0 var bits = 0 while true: case L.buf[pos] @@ -315,19 +315,34 @@ proc getNumber16(L: var TLexer, tok: var TToken) = else: tok.xkind = pxIntLit L.bufpos = pos +proc getFloating(L: var TLexer, tok: var TToken) = + matchUnderscoreChars(L, tok, {'0'..'9'}) + if L.buf[L.bufpos] in {'e', 'E'}: + add(tok.s, L.buf[L.bufpos]) + inc(L.bufpos) + if L.buf[L.bufpos] in {'+', '-'}: + add(tok.s, L.buf[L.bufpos]) + inc(L.bufpos) + matchUnderscoreChars(L, tok, {'0'..'9'}) + proc getNumber(L: var TLexer, tok: var TToken) = tok.base = base10 - matchUnderscoreChars(L, tok, {'0'..'9'}) - if (L.buf[L.bufpos] == '.') and (L.buf[L.bufpos + 1] in {'0'..'9'}): - add(tok.s, '.') + if L.buf[L.bufpos] == '.': + add(tok.s, "0.") inc(L.bufpos) - matchUnderscoreChars(L, tok, {'e', 'E', '+', '-', '0'..'9'}) + getFloating(L, tok) + else: + matchUnderscoreChars(L, tok, {'0'..'9'}) + if L.buf[L.bufpos] == '.': + add(tok.s, '.') + inc(L.bufpos) + getFloating(L, tok) try: if isFloatLiteral(tok.s): tok.fnumber = parseFloat(tok.s) tok.xkind = pxFloatLit else: - tok.iNumber = ParseInt(tok.s) + tok.iNumber = parseInt(tok.s) if (tok.iNumber < low(int32)) or (tok.iNumber > high(int32)): tok.xkind = pxInt64Lit else: @@ -339,10 +354,10 @@ proc getNumber(L: var TLexer, tok: var TToken) = # ignore type suffix: while L.buf[L.bufpos] in {'A'..'Z', 'a'..'z'}: inc(L.bufpos) -proc HandleCRLF(L: var TLexer, pos: int): int = +proc handleCRLF(L: var TLexer, pos: int): int = case L.buf[pos] - of CR: result = nimlexbase.HandleCR(L, pos) - of LF: result = nimlexbase.HandleLF(L, pos) + of CR: result = nimlexbase.handleCR(L, pos) + of LF: result = nimlexbase.handleLF(L, pos) else: result = pos proc escape(L: var TLexer, tok: var TToken, allowEmpty=false) = @@ -382,6 +397,23 @@ proc escape(L: var TLexer, tok: var TToken, allowEmpty=false) = xi = (xi shl 3) or (ord(L.buf[L.bufpos]) - ord('0')) inc(L.bufpos) add(tok.s, chr(xi)) + of 'x': + var xi = 0 + inc(L.bufpos) + while true: + case L.buf[L.bufpos] + of '0'..'9': + xi = `shl`(xi, 4) or (ord(L.buf[L.bufpos]) - ord('0')) + inc(L.bufpos) + of 'a'..'f': + xi = `shl`(xi, 4) or (ord(L.buf[L.bufpos]) - ord('a') + 10) + inc(L.bufpos) + of 'A'..'F': + xi = `shl`(xi, 4) or (ord(L.buf[L.bufpos]) - ord('A') + 10) + inc(L.bufpos) + else: + break + add(tok.s, chr(xi)) elif not allowEmpty: lexMessage(L, errInvalidCharacterConstant) @@ -405,7 +437,7 @@ proc getString(L: var TLexer, tok: var TToken) = while true: case buf[pos] of '\"': - Inc(pos) + inc(pos) break of CR: pos = nimlexbase.HandleCR(L, pos) @@ -427,7 +459,7 @@ proc getString(L: var TLexer, tok: var TToken) = pos = L.bufpos else: add(tok.s, buf[pos]) - Inc(pos) + inc(pos) L.bufpos = pos tok.xkind = pxStrLit @@ -438,7 +470,7 @@ proc getSymbol(L: var TLexer, tok: var TToken) = var c = buf[pos] if c notin SymChars: break add(tok.s, c) - Inc(pos) + inc(pos) L.bufpos = pos tok.xkind = pxSymbol @@ -475,7 +507,7 @@ proc scanStarComment(L: var TLexer, tok: var TToken) = while true: case buf[pos] of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf add(tok.s, "\n#") # skip annoying stars as line prefix: (eg. @@ -511,12 +543,12 @@ proc skip(L: var TLexer, tok: var TToken) = if L.inDirective: while buf[pos] in {' ', '\t'}: inc(pos) if buf[pos] in {CR, LF}: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf of ' ', Tabulator: - Inc(pos) # newline is special: + inc(pos) # newline is special: of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf if L.inDirective: tok.xkind = pxNewLine @@ -559,13 +591,13 @@ proc getTok(L: var TLexer, tok: var TToken) = of 'b', 'B': getNumber2(L, tok) of '1'..'7': getNumber8(L, tok) else: getNumber(L, tok) - elif c in {'1'..'9'}: + elif c in {'1'..'9'} or (c == '.' and L.buf[L.bufpos+1] in {'0'..'9'}): getNumber(L, tok) else: case c of ';': tok.xkind = pxSemicolon - Inc(L.bufpos) + inc(L.bufpos) of '/': if L.buf[L.bufpos + 1] == '/': scanLineComment(L, tok) @@ -580,9 +612,9 @@ proc getTok(L: var TLexer, tok: var TToken) = inc(L.bufpos) of ',': tok.xkind = pxComma - Inc(L.bufpos) + inc(L.bufpos) of '(': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxParLe of '*': inc(L.bufpos) @@ -592,13 +624,13 @@ proc getTok(L: var TLexer, tok: var TToken) = else: tok.xkind = pxStar of ')': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxParRi of '[': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxBracketLe of ']': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxBracketRi of '.': inc(L.bufpos) @@ -608,10 +640,10 @@ proc getTok(L: var TLexer, tok: var TToken) = else: tok.xkind = pxDot of '{': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxCurlyLe of '}': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxCurlyRi of '+': inc(L.bufpos) @@ -752,4 +784,4 @@ proc getTok(L: var TLexer, tok: var TToken) = tok.s = $c tok.xkind = pxInvalid lexMessage(L, errInvalidToken, c & " (\\" & $(ord(c)) & ')') - Inc(L.bufpos) + inc(L.bufpos) diff --git a/compiler/c2nim/cparse.nim b/compiler/c2nim/cparse.nim index 44be556db..ffab05788 100644 --- a/compiler/c2nim/cparse.nim +++ b/compiler/c2nim/cparse.nim @@ -61,6 +61,8 @@ type TReplaceTuple* = array[0..1, string] + ERetryParsing = object of ESynch + proc newParserOptions*(): PParserOptions = new(result) result.prefixes = @[] @@ -93,16 +95,16 @@ proc setOption*(parserOptions: PParserOptions, key: string, val=""): bool = of "class": parserOptions.classes[val] = "true" else: result = false -proc ParseUnit*(p: var TParser): PNode +proc parseUnit*(p: var TParser): PNode proc openParser*(p: var TParser, filename: string, inputStream: PLLStream, options = newParserOptions()) proc closeParser*(p: var TParser) # implementation -proc OpenParser(p: var TParser, filename: string, +proc openParser(p: var TParser, filename: string, inputStream: PLLStream, options = newParserOptions()) = - OpenLexer(p.lex, filename, inputStream) + openLexer(p.lex, filename, inputStream) p.options = options p.backtrack = @[] new(p.tok) @@ -111,7 +113,7 @@ proc parMessage(p: TParser, msg: TMsgKind, arg = "") = #assert false lexMessage(p.lex, msg, arg) -proc CloseParser(p: var TParser) = CloseLexer(p.lex) +proc closeParser(p: var TParser) = closeLexer(p.lex) proc saveContext(p: var TParser) = p.backtrack.add(p.tok) proc closeContext(p: var TParser) = discard p.backtrack.pop() proc backtrackContext(p: var TParser) = p.tok = p.backtrack.pop() @@ -145,7 +147,7 @@ proc findMacro(p: TParser): int = proc rawEat(p: var TParser, xkind: TTokKind) = if p.tok.xkind == xkind: rawGetTok(p) - else: parMessage(p, errTokenExpected, TokKindToStr(xkind)) + else: parMessage(p, errTokenExpected, tokKindToStr(xkind)) proc parseMacroArguments(p: var TParser): seq[seq[ref TToken]] = result = @[] @@ -228,7 +230,7 @@ proc skipComAux(p: var TParser, n: PNode) = getTok(p) proc skipCom(p: var TParser, n: PNode) = - while p.tok.xkind in {pxLineComment, pxStarComment}: skipcomAux(p, n) + while p.tok.xkind in {pxLineComment, pxStarComment}: skipComAux(p, n) proc skipStarCom(p: var TParser, n: PNode) = while p.tok.xkind == pxStarComment: skipComAux(p, n) @@ -242,11 +244,11 @@ proc expectIdent(p: TParser) = proc eat(p: var TParser, xkind: TTokKind, n: PNode) = if p.tok.xkind == xkind: getTok(p, n) - else: parMessage(p, errTokenExpected, TokKindToStr(xkind)) + else: parMessage(p, errTokenExpected, tokKindToStr(xkind)) proc eat(p: var TParser, xkind: TTokKind) = if p.tok.xkind == xkind: getTok(p) - else: parMessage(p, errTokenExpected, TokKindToStr(xkind)) + else: parMessage(p, errTokenExpected, tokKindToStr(xkind)) proc eat(p: var TParser, tok: string, n: PNode) = if p.tok.s == tok: getTok(p, n) @@ -420,9 +422,9 @@ proc markTypeIdent(p: var TParser, typ: PNode) = # avoids to build a symbol table, which can't be done reliably anyway for our # purposes. -proc expression(p: var TParser): PNode -proc constantExpression(p: var TParser): PNode -proc assignmentExpression(p: var TParser): PNode +proc expression(p: var TParser, rbp: int = 0): PNode +proc constantExpression(p: var TParser): PNode = expression(p, 40) +proc assignmentExpression(p: var TParser): PNode = expression(p, 30) proc compoundStatement(p: var TParser): PNode proc statement(p: var TParser): PNode @@ -605,7 +607,7 @@ proc addPragmas(father, pragmas: PNode) = proc addReturnType(params, rettyp: PNode) = if rettyp == nil: addSon(params, ast.emptyNode) elif rettyp.kind != nkNilLit: addSon(params, rettyp) - else: addson(params, ast.emptyNode) + else: addSon(params, ast.emptyNode) proc parseFormalParams(p: var TParser, params, pragmas: PNode) @@ -651,6 +653,22 @@ proc parseTypeSuffix(p: var TParser, typ: PNode): PNode = proc typeDesc(p: var TParser): PNode = result = pointer(p, typeAtom(p)) +proc abstractDeclarator(p: var TParser, a: PNode): PNode + +proc directAbstractDeclarator(p: var TParser, a: PNode): PNode = + if p.tok.xkind == pxParLe: + getTok(p, a) + if p.tok.xkind in {pxStar, pxAmp, pxAmpAmp}: + result = abstractDeclarator(p, a) + eat(p, pxParRi, result) + return parseTypeSuffix(p, a) + +proc abstractDeclarator(p: var TParser, a: PNode): PNode = + return directAbstractDeclarator(p, pointer(p, a)) + +proc typeName(p: var TParser): PNode = + return abstractDeclarator(p, typeAtom(p)) + proc parseField(p: var TParser, kind: TNodeKind): PNode = if p.tok.xkind == pxParLe: getTok(p, nil) @@ -690,8 +708,8 @@ proc parseStructBody(p: var TParser, isUnion: bool, proc structPragmas(p: TParser, name: PNode, origName: string): PNode = assert name.kind == nkIdent result = newNodeP(nkPragmaExpr, p) - addson(result, exportSym(p, name, origName)) - var pragmas = newNodep(nkPragma, p) + addSon(result, exportSym(p, name, origName)) + var pragmas = newNodeP(nkPragma, p) addSon(pragmas, newIdentNodeP("pure", p), newIdentNodeP("final", p)) if p.options.header.len > 0: addSon(pragmas, newIdentStrLitPair("importc", origName, p), @@ -700,8 +718,8 @@ proc structPragmas(p: TParser, name: PNode, origName: string): PNode = proc enumPragmas(p: TParser, name: PNode): PNode = result = newNodeP(nkPragmaExpr, p) - addson(result, name) - var pragmas = newNodep(nkPragma, p) + addSon(result, name) + var pragmas = newNodeP(nkPragma, p) var e = newNodeP(nkExprColonExpr, p) # HACK: sizeof(cint) should be constructed as AST addSon(e, newIdentNodeP("size", p), newIdentNodeP("sizeof(cint)", p)) @@ -716,18 +734,36 @@ proc parseStruct(p: var TParser, isUnion: bool): PNode = else: addSon(result, newNodeP(nkRecList, p)) +proc declarator(p: var TParser, a: PNode, ident: ptr PNode): PNode + +proc directDeclarator(p: var TParser, a: PNode, ident: ptr PNode): PNode = + case p.tok.xkind + of pxSymbol: + ident[] = skipIdent(p) + of pxParLe: + getTok(p, a) + if p.tok.xkind in {pxStar, pxAmp, pxAmpAmp, pxSymbol}: + result = declarator(p, a, ident) + eat(p, pxParRi, result) + else: + nil + return parseTypeSuffix(p, a) + +proc declarator(p: var TParser, a: PNode, ident: ptr PNode): PNode = + return directDeclarator(p, pointer(p, a), ident) + +# parameter-declaration +# declaration-specifiers declarator +# declaration-specifiers asbtract-declarator(opt) proc parseParam(p: var TParser, params: PNode) = var typ = typeDesc(p) # support for ``(void)`` parameter list: if typ.kind == nkNilLit and p.tok.xkind == pxParRi: return var name: PNode - if p.tok.xkind == pxSymbol: - name = skipIdent(p) - else: - # generate a name for the formal parameter: + typ = declarator(p, typ, addr name) + if name == nil: var idx = sonsLen(params)+1 name = newIdentNodeP("a" & $idx, p) - typ = parseTypeSuffix(p, typ) var x = newNodeP(nkIdentDefs, p) addSon(x, name, typ) if p.tok.xkind == pxAsgn: @@ -1045,7 +1081,7 @@ proc declaration(p: var TParser): PNode = of pxSemicolon: getTok(p) addSon(result, ast.emptyNode) # nobody - if p.scopeCounter == 0: DoImport(origName, pragmas, p) + if p.scopeCounter == 0: doImport(origName, pragmas, p) of pxCurlyLe: addSon(result, compoundStatement(p)) else: @@ -1134,224 +1170,27 @@ proc setBaseFlags(n: PNode, base: TNumericalBase) = of base8: incl(n.flags, nfBase8) of base16: incl(n.flags, nfBase16) -proc unaryExpression(p: var TParser): PNode - -proc isDefinitelyAType(p: var TParser): bool = - var starFound = false - var words = 0 - while true: - case p.tok.xkind - of pxSymbol: - if declKeyword(p, p.tok.s): return true - elif starFound: return false - else: inc(words) - of pxStar, pxAmp, pxAmpAmp: - starFound = true - of pxParRi: return words == 0 or words > 1 or starFound - else: return false - getTok(p, nil) - -proc castExpression(p: var TParser): PNode = - if p.tok.xkind == pxParLe: - saveContext(p) - result = newNodeP(nkCast, p) - getTok(p, result) - var t = isDefinitelyAType(p) - backtrackContext(p) - if t: - eat(p, pxParLe, result) - var a = typeDesc(p) - eat(p, pxParRi, result) - addSon(result, a) - addSon(result, castExpression(p)) - else: - # else it is just an expression in (): - result = newNodeP(nkPar, p) - eat(p, pxParLe, result) - addSon(result, expression(p)) - if p.tok.xkind != pxParRi: - # ugh, it is a cast, even though it does not look like one: - result.kind = nkCast - addSon(result, castExpression(p)) - eat(p, pxParRi, result) - #result = unaryExpression(p) - else: - result = unaryExpression(p) - -proc primaryExpression(p: var TParser): PNode = - case p.tok.xkind - of pxSymbol: - if p.tok.s == "NULL": - result = newNodeP(nkNilLit, p) - else: - result = mangledIdent(p.tok.s, p) - getTok(p, result) - result = optScope(p, result) - of pxIntLit: - result = newIntNodeP(nkIntLit, p.tok.iNumber, p) - setBaseFlags(result, p.tok.base) - getTok(p, result) - of pxInt64Lit: - result = newIntNodeP(nkInt64Lit, p.tok.iNumber, p) - setBaseFlags(result, p.tok.base) - getTok(p, result) - of pxFloatLit: - result = newFloatNodeP(nkFloatLit, p.tok.fNumber, p) - setBaseFlags(result, p.tok.base) - getTok(p, result) - of pxStrLit: - # Ansi C allows implicit string literal concatenations: - result = newStrNodeP(nkStrLit, p.tok.s, p) - getTok(p, result) - while p.tok.xkind == pxStrLit: - add(result.strVal, p.tok.s) - getTok(p, result) - of pxCharLit: - result = newIntNodeP(nkCharLit, ord(p.tok.s[0]), p) - getTok(p, result) - of pxParLe: - result = castExpression(p) - else: - result = ast.emptyNode - -proc multiplicativeExpression(p: var TParser): PNode = - result = castExpression(p) - while true: - case p.tok.xkind - of pxStar: - var a = result - result = newNodeP(nkInfix, p) - addSon(result, newIdentNodeP("*", p), a) - getTok(p, result) - var b = castExpression(p) - addSon(result, b) - of pxSlash: - var a = result - result = newNodeP(nkInfix, p) - addSon(result, newIdentNodeP("div", p), a) - getTok(p, result) - var b = castExpression(p) - addSon(result, b) - of pxMod: - var a = result - result = newNodeP(nkInfix, p) - addSon(result, newIdentNodeP("mod", p), a) - getTok(p, result) - var b = castExpression(p) - addSon(result, b) - else: break - -proc additiveExpression(p: var TParser): PNode = - result = multiplicativeExpression(p) - while true: - case p.tok.xkind - of pxPlus: - var a = result - result = newNodeP(nkInfix, p) - addSon(result, newIdentNodeP("+", p), a) - getTok(p, result) - var b = multiplicativeExpression(p) - addSon(result, b) - of pxMinus: - var a = result - result = newNodeP(nkInfix, p) - addSon(result, newIdentNodeP("-", p), a) - getTok(p, result) - var b = multiplicativeExpression(p) - addSon(result, b) - else: break - -proc incdec(p: var TParser, opr: string): PNode = - result = newNodeP(nkCall, p) - addSon(result, newIdentNodeP(opr, p)) - gettok(p, result) - addSon(result, unaryExpression(p)) - -proc unaryOp(p: var TParser, kind: TNodeKind): PNode = - result = newNodeP(kind, p) - getTok(p, result) - addSon(result, castExpression(p)) - -proc prefixCall(p: var TParser, opr: string): PNode = - result = newNodeP(nkPrefix, p) - addSon(result, newIdentNodeP(opr, p)) - gettok(p, result) - addSon(result, castExpression(p)) - -proc postfixExpression(p: var TParser): PNode = - result = primaryExpression(p) - while true: - case p.tok.xkind - of pxBracketLe: - var a = result - result = newNodeP(nkBracketExpr, p) - addSon(result, a) - getTok(p, result) - var b = expression(p) - addSon(result, b) - eat(p, pxBracketRi, result) - of pxParLe: - var a = result - result = newNodeP(nkCall, p) - addSon(result, a) - getTok(p, result) - if p.tok.xkind != pxParRi: - a = assignmentExpression(p) - addSon(result, a) - while p.tok.xkind == pxComma: - getTok(p, a) - a = assignmentExpression(p) - addSon(result, a) - eat(p, pxParRi, result) - of pxDot, pxArrow: - var a = result - result = newNodeP(nkDotExpr, p) - addSon(result, a) - getTok(p, result) - addSon(result, skipIdent(p)) - of pxPlusPlus: - var a = result - result = newNodeP(nkCall, p) - addSon(result, newIdentNodeP("inc", p)) - gettok(p, result) - addSon(result, a) - of pxMinusMinus: - var a = result - result = newNodeP(nkCall, p) - addSon(result, newIdentNodeP("dec", p)) - gettok(p, result) - addSon(result, a) - of pxLt: - if isTemplateAngleBracket(p): - result = optAngle(p, result) - else: break - else: break - -proc unaryExpression(p: var TParser): PNode = - case p.tok.xkind - of pxPlusPlus: result = incdec(p, "inc") - of pxMinusMinus: result = incdec(p, "dec") - of pxAmp: result = unaryOp(p, nkAddr) - of pxStar: result = unaryOp(p, nkBracketExpr) - of pxPlus: result = prefixCall(p, "+") - of pxMinus: result = prefixCall(p, "-") - of pxTilde: result = prefixCall(p, "not") - of pxNot: result = prefixCall(p, "not") +proc startExpression(p : var TParser, tok : TToken) : PNode = + #echo "nud ", $tok + case tok.xkind: of pxSymbol: - if p.tok.s == "sizeof": + if tok.s == "NULL": + result = newNodeP(nkNilLit, p) + elif tok.s == "sizeof": result = newNodeP(nkCall, p) addSon(result, newIdentNodeP("sizeof", p)) - getTok(p, result) - if p.tok.xkind == pxParLe: - getTok(p, result) - addSon(result, typeDesc(p)) - eat(p, pxParRi, result) - else: - addSon(result, unaryExpression(p)) - elif p.tok.s == "new" or p.tok.s == "delete" and pfCpp in p.options.flags: - var opr = p.tok.s + saveContext(p) + try: + addSon(result, expression(p, 139)) + closeContext(p) + except ERetryParsing: + backtrackContext(p) + eat(p, pxParLe) + addSon(result, typeName(p)) + eat(p, pxParRi) + elif (tok.s == "new" or tok.s == "delete") and pfCpp in p.options.flags: + var opr = tok.s result = newNodeP(nkCall, p) - getTok(p, result) if p.tok.xkind == pxBracketLe: getTok(p) eat(p, pxBracketRi) @@ -1362,148 +1201,269 @@ proc unaryExpression(p: var TParser): PNode = addSon(result, typeDesc(p)) eat(p, pxParRi, result) else: - addSon(result, unaryExpression(p)) + addSon(result, expression(p, 139)) else: - result = postfixExpression(p) - else: result = postfixExpression(p) - -proc expression(p: var TParser): PNode = - # we cannot support C's ``,`` operator - result = assignmentExpression(p) - if p.tok.xkind == pxComma: - getTok(p, result) - parMessage(p, errOperatorExpected, ",") - -proc conditionalExpression(p: var TParser): PNode - -proc constantExpression(p: var TParser): PNode = - result = conditionalExpression(p) - -proc lvalue(p: var TParser): PNode = - result = unaryExpression(p) - -proc asgnExpr(p: var TParser, opr: string, a: PNode): PNode = - closeContext(p) - getTok(p, a) - var b = assignmentExpression(p) - result = newNodeP(nkAsgn, p) - addSon(result, a, newBinary(opr, copyTree(a), b, p)) - -proc incdec(p: var TParser, opr: string, a: PNode): PNode = - closeContext(p) - getTok(p, a) - var b = assignmentExpression(p) - result = newNodeP(nkCall, p) - addSon(result, newIdentNodeP(getIdent(opr), p), a, b) - -proc assignmentExpression(p: var TParser): PNode = - saveContext(p) - var a = lvalue(p) - case p.tok.xkind - of pxAsgn: - closeContext(p) - getTok(p, a) - var b = assignmentExpression(p) + result = mangledIdent(tok.s, p) + result = optScope(p, result) + result = optAngle(p, result) + of pxIntLit: + result = newIntNodeP(nkIntLit, tok.iNumber, p) + setBaseFlags(result, tok.base) + of pxInt64Lit: + result = newIntNodeP(nkInt64Lit, tok.iNumber, p) + setBaseFlags(result, tok.base) + of pxFloatLit: + result = newFloatNodeP(nkFloatLit, tok.fNumber, p) + setBaseFlags(result, tok.base) + of pxStrLit: + result = newStrNodeP(nkStrLit, tok.s, p) + while p.tok.xkind == pxStrLit: + add(result.strVal, p.tok.s) + getTok(p, result) + of pxCharLit: + result = newIntNodeP(nkCharLit, ord(tok.s[0]), p) + of pxParLe: + try: + saveContext(p) + result = newNodeP(nkPar, p) + addSon(result, expression(p, 0)) + if p.tok.xkind != pxParRi: + raise newException(ERetryParsing, "expected a ')'") + getTok(p, result) + if p.tok.xkind in {pxSymbol, pxIntLit, pxFloatLit, pxStrLit, pxCharLit}: + raise newException(ERetryParsing, "expected a non literal token") + closeContext(p) + except ERetryParsing: + backtrackContext(p) + result = newNodeP(nkCast, p) + addSon(result, typeName(p)) + eat(p, pxParRi, result) + addSon(result, expression(p, 139)) + of pxPlusPlus: + result = newNodeP(nkCall, p) + addSon(result, newIdentNodeP("inc", p)) + addSon(result, expression(p, 139)) + of pxMinusMinus: + result = newNodeP(nkCall, p) + addSon(result, newIdentNodeP("dec", p)) + addSon(result, expression(p, 139)) + of pxAmp: + result = newNodeP(nkAddr, p) + addSon(result, expression(p, 139)) + of pxStar: + result = newNodeP(nkBracketExpr, p) + addSon(result, expression(p, 139)) + of pxPlus: + result = newNodeP(nkPrefix, p) + addSon(result, newIdentNodeP("+", p)) + addSon(result, expression(p, 139)) + of pxMinus: + result = newNodeP(nkPrefix, p) + addSon(result, newIdentNodeP("-", p)) + addSon(result, expression(p, 139)) + of pxTilde: + result = newNodeP(nkPrefix, p) + addSon(result, newIdentNodeP("not", p)) + addSon(result, expression(p, 139)) + of pxNot: + result = newNodeP(nkPrefix, p) + addSon(result, newIdentNodeP("not", p)) + addSon(result, expression(p, 139)) + else: + # probably from a failed sub expression attempt, try a type cast + raise newException(ERetryParsing, "did not expect " & $tok) + +proc leftBindingPower(p : var TParser, tok : ref TToken) : int = + #echo "lbp ", $tok[] + case tok.xkind: + of pxComma: + return 10 + # throw == 20 + of pxAsgn, pxPlusAsgn, pxMinusAsgn, pxStarAsgn, pxSlashAsgn, pxModAsgn, pxShlAsgn, pxShrAsgn, pxAmpAsgn, pxHatAsgn, pxBarAsgn: + return 30 + of pxConditional: + return 40 + of pxBarBar: + return 50 + of pxAmpAmp: + return 60 + of pxBar: + return 70 + of pxHat: + return 80 + of pxAmp: + return 90 + of pxEquals, pxNeq: + return 100 + of pxLt, pxLe, pxGt, pxGe: + return 110 + of pxShl, pxShr: + return 120 + of pxPlus, pxMinus: + return 130 + of pxStar, pxSlash, pxMod: + return 140 + # .* ->* == 150 + of pxPlusPlus, pxMinusMinus, pxParLe, pxDot, pxArrow, pxBracketLe: + return 160 + # :: == 170 + else: + return 0 + +proc buildStmtList(a: PNode): PNode + +proc leftExpression(p : var TParser, tok : TToken, left : PNode) : PNode = + #echo "led ", $tok + case tok.xkind: + of pxComma: # 10 + # not supported as an expression, turns into a statement list + result = buildStmtList(left) + addSon(result, expression(p, 0)) + # throw == 20 + of pxAsgn: # 30 + result = newNodeP(nkAsgn, p) + addSon(result, left, expression(p, 29)) + of pxPlusAsgn: # 30 + result = newNodeP(nkCall, p) + addSon(result, newIdentNodeP(getIdent("inc"), p), left, expression(p, 29)) + of pxMinusAsgn: # 30 + result = newNodeP(nkCall, p) + addSon(result, newIdentNodeP(getIdent("dec"), p), left, expression(p, 29)) + of pxStarAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("*", copyTree(left), right, p)) + of pxSlashAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("/", copyTree(left), right, p)) + of pxModAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("mod", copyTree(left), right, p)) + of pxShlAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("shl", copyTree(left), right, p)) + of pxShrAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("shr", copyTree(left), right, p)) + of pxAmpAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("and", copyTree(left), right, p)) + of pxHatAsgn: # 30 + result = newNodeP(nkAsgn, p) + var right = expression(p, 29) + addSon(result, left, newBinary("xor", copyTree(left), right, p)) + of pxBarAsgn: # 30 result = newNodeP(nkAsgn, p) - addSon(result, a, b) - of pxPlusAsgn: result = incDec(p, "inc", a) - of pxMinusAsgn: result = incDec(p, "dec", a) - of pxStarAsgn: result = asgnExpr(p, "*", a) - of pxSlashAsgn: result = asgnExpr(p, "/", a) - of pxModAsgn: result = asgnExpr(p, "mod", a) - of pxShlAsgn: result = asgnExpr(p, "shl", a) - of pxShrAsgn: result = asgnExpr(p, "shr", a) - of pxAmpAsgn: result = asgnExpr(p, "and", a) - of pxHatAsgn: result = asgnExpr(p, "xor", a) - of pxBarAsgn: result = asgnExpr(p, "or", a) + var right = expression(p, 29) + addSon(result, left, newBinary("or", copyTree(left), right, p)) + of pxConditional: # 40 + var a = expression(p, 0) + eat(p, pxColon, a) + var b = expression(p, 39) + result = newNodeP(nkIfExpr, p) + var branch = newNodeP(nkElifExpr, p) + addSon(branch, left, a) + addSon(result, branch) + branch = newNodeP(nkElseExpr, p) + addSon(branch, b) + addSon(result, branch) + of pxBarBar: # 50 + result = newBinary("or", left, expression(p, 50), p) + of pxAmpAmp: # 60 + result = newBinary("and", left, expression(p, 60), p) + of pxBar: # 70 + result = newBinary("or", left, expression(p, 70), p) + of pxHat: # 80 + result = newBinary("^", left, expression(p, 80), p) + of pxAmp: # 90 + result = newBinary("and", left, expression(p, 90), p) + of pxEquals: # 100 + result = newBinary("==", left, expression(p, 100), p) + of pxNeq: # 100 + result = newBinary("!=", left, expression(p, 100), p) + of pxLt: # 110 + result = newBinary("<", left, expression(p, 110), p) + of pxLe: # 110 + result = newBinary("<=", left, expression(p, 110), p) + of pxGt: # 110 + result = newBinary(">", left, expression(p, 110), p) + of pxGe: # 110 + result = newBinary(">=", left, expression(p, 110), p) + of pxShl: # 120 + result = newBinary("shl", left, expression(p, 120), p) + of pxShr: # 120 + result = newBinary("shr", left, expression(p, 120), p) + of pxPlus: # 130 + result = newNodeP(nkInfix, p) + addSon(result, newIdentNodeP("+", p), left) + addSon(result, expression(p, 130)) + of pxMinus: # 130 + result = newNodeP(nkInfix, p) + addSon(result, newIdentNodeP("+", p), left) + addSon(result, expression(p, 130)) + of pxStar: # 140 + result = newNodeP(nkInfix, p) + addSon(result, newIdentNodeP("*", p), left) + addSon(result, expression(p, 140)) + of pxSlash: # 140 + result = newNodeP(nkInfix, p) + addSon(result, newIdentNodeP("div", p), left) + addSon(result, expression(p, 140)) + of pxMod: # 140 + result = newNodeP(nkInfix, p) + addSon(result, newIdentNodeP("mod", p), left) + addSon(result, expression(p, 140)) + # .* ->* == 150 + of pxPlusPlus: # 160 + result = newNodeP(nkCall, p) + addSon(result, newIdentNodeP("inc", p), left) + of pxMinusMinus: # 160 + result = newNodeP(nkCall, p) + addSon(result, newIdentNodeP("dec", p), left) + of pxParLe: # 160 + result = newNodeP(nkCall, p) + addSon(result, left) + while p.tok.xkind != pxParRi: + var a = expression(p, 29) + addSon(result, a) + while p.tok.xkind == pxComma: + getTok(p, a) + a = expression(p, 29) + addSon(result, a) + eat(p, pxParRi, result) + of pxDot: # 160 + result = newNodeP(nkDotExpr, p) + addSon(result, left) + addSon(result, skipIdent(p)) + of pxArrow: # 160 + result = newNodeP(nkDotExpr, p) + addSon(result, left) + addSon(result, skipIdent(p)) + of pxBracketLe: # 160 + result = newNodeP(nkBracketExpr, p) + addSon(result, left, expression(p)) + eat(p, pxBracketRi, result) + # :: == 170 else: - backtrackContext(p) - result = conditionalExpression(p) - -proc shiftExpression(p: var TParser): PNode = - result = additiveExpression(p) - while p.tok.xkind in {pxShl, pxShr}: - var op = if p.tok.xkind == pxShl: "shl" else: "shr" - getTok(p, result) - var a = result - var b = additiveExpression(p) - result = newBinary(op, a, b, p) - -proc relationalExpression(p: var TParser): PNode = - result = shiftExpression(p) - # Nimrod uses ``<`` and ``<=``, etc. too: - while p.tok.xkind in {pxLt, pxLe, pxGt, pxGe}: - var op = TokKindToStr(p.tok.xkind) - getTok(p, result) - var a = result - var b = shiftExpression(p) - result = newBinary(op, a, b, p) - -proc equalityExpression(p: var TParser): PNode = - result = relationalExpression(p) - # Nimrod uses ``==`` and ``!=`` too: - while p.tok.xkind in {pxEquals, pxNeq}: - var op = TokKindToStr(p.tok.xkind) - getTok(p, result) - var a = result - var b = relationalExpression(p) - result = newBinary(op, a, b, p) + result = left -proc andExpression(p: var TParser): PNode = - result = equalityExpression(p) - while p.tok.xkind == pxAmp: - getTok(p, result) - var a = result - var b = equalityExpression(p) - result = newBinary("and", a, b, p) +proc expression*(p : var TParser, rbp : int = 0) : PNode = + var tok : TToken -proc exclusiveOrExpression(p: var TParser): PNode = - result = andExpression(p) - while p.tok.xkind == pxHat: - getTok(p, result) - var a = result - var b = andExpression(p) - result = newBinary("^", a, b, p) + tok = p.tok[] + getTok(p, result) -proc inclusiveOrExpression(p: var TParser): PNode = - result = exclusiveOrExpression(p) - while p.tok.xkind == pxBar: - getTok(p, result) - var a = result - var b = exclusiveOrExpression(p) - result = newBinary("or", a, b, p) - -proc logicalAndExpression(p: var TParser): PNode = - result = inclusiveOrExpression(p) - while p.tok.xkind == pxAmpAmp: - getTok(p, result) - var a = result - var b = inclusiveOrExpression(p) - result = newBinary("and", a, b, p) + result = startExpression(p, tok) -proc logicalOrExpression(p: var TParser): PNode = - result = logicalAndExpression(p) - while p.tok.xkind == pxBarBar: + while rbp < leftBindingPower(p, p.tok): + tok = p.tok[] getTok(p, result) - var a = result - var b = logicalAndExpression(p) - result = newBinary("or", a, b, p) - -proc conditionalExpression(p: var TParser): PNode = - result = logicalOrExpression(p) - if p.tok.xkind == pxConditional: - getTok(p, result) # skip '?' - var a = result - var b = expression(p) - eat(p, pxColon, b) - var c = conditionalExpression(p) - result = newNodeP(nkIfExpr, p) - var branch = newNodeP(nkElifExpr, p) - addSon(branch, a, b) - addSon(result, branch) - branch = newNodeP(nkElseExpr, p) - addSon(branch, c) - addSon(result, branch) + result = leftExpression(p, tok, result) # Statements @@ -1549,12 +1509,12 @@ proc parseIf(p: var TParser): PNode = while true: getTok(p) # skip ``if`` var branch = newNodeP(nkElifBranch, p) - skipCom(p, branch) eat(p, pxParLe, branch) addSon(branch, expression(p)) eat(p, pxParRi, branch) addSon(branch, nestedStatement(p)) addSon(result, branch) + skipCom(p, branch) if p.tok.s == "else": getTok(p, result) if p.tok.s != "if": @@ -1574,19 +1534,51 @@ proc parseWhile(p: var TParser): PNode = eat(p, pxParRi, result) addSon(result, nestedStatement(p)) +proc embedStmts(sl, a: PNode) + proc parseDoWhile(p: var TParser): PNode = - # we only support ``do stmt while (0)`` as an idiom for - # ``block: stmt`` - result = newNodeP(nkBlockStmt, p) - getTok(p, result) # skip "do" - addSon(result, ast.emptyNode, nestedStatement(p)) + # parsing + result = newNodeP(nkWhileStmt, p) + getTok(p, result) + var stm = nestedStatement(p) eat(p, "while", result) eat(p, pxParLe, result) - if p.tok.xkind == pxIntLit and p.tok.iNumber == 0: getTok(p, result) - else: parMessage(p, errTokenExpected, "0") + var exp = expression(p) eat(p, pxParRi, result) if p.tok.xkind == pxSemicolon: getTok(p) + # while true: + # stmt + # if not expr: + # break + addSon(result, newIdentNodeP("true", p)) + + stm = buildStmtList(stm) + + # get the last exp if it is a stmtlist + var cleanedExp = exp + if exp.kind == nkStmtList: + cleanedExp = exp.sons[exp.len-1] + exp.sons = exp.sons[0..exp.len-2] + embedStmts(stm, exp) + + var notExp = newNodeP(nkPrefix, p) + addSon(notExp, newIdentNodeP("not", p)) + addSon(notExp, cleanedExp) + + var brkStm = newNodeP(nkBreakStmt, p) + addSon(brkStm, ast.emptyNode) + + var ifStm = newNodeP(nkIfStmt, p) + var ifBranch = newNodeP(nkElifBranch, p) + addSon(ifBranch, notExp) + addSon(ifBranch, brkStm) + addSon(ifStm, ifBranch) + + embedStmts(stm, ifStm) + + addSon(result, stm) + proc declarationOrStatement(p: var TParser): PNode = if p.tok.xkind != pxSymbol: result = expressionStatement(p) @@ -1666,7 +1658,7 @@ proc parseFor(p: var TParser, result: PNode) = eat(p, pxParLe, result) var initStmt = declarationOrStatement(p) if initStmt.kind != nkEmpty: - addSon(result, initStmt) + embedStmts(result, initStmt) var w = newNodeP(nkWhileStmt, p) var condition = expressionStatement(p) if condition.kind == nkEmpty: condition = newIdentNodeP("true", p) @@ -1676,7 +1668,7 @@ proc parseFor(p: var TParser, result: PNode) = var loopBody = nestedStatement(p) if step.kind != nkEmpty: loopBody = buildStmtList(loopBody) - addSon(loopBody, step) + embedStmts(loopBody, step) addSon(w, loopBody) addSon(result, w) @@ -1818,7 +1810,7 @@ proc parseConstructor(p: var TParser, pragmas: PNode, else: parMessage(p, errTokenExpected, ";") if result.sons[bodyPos].kind == nkEmpty: - DoImport((if isDestructor: "~" else: "") & origName, pragmas, p) + doImport((if isDestructor: "~" else: "") & origName, pragmas, p) elif isDestructor: addSon(pragmas, newIdentNodeP("destructor", p)) if sonsLen(result.sons[pragmasPos]) == 0: @@ -1862,8 +1854,8 @@ proc parseMethod(p: var TParser, origName: string, rettyp, pragmas: PNode, else: parMessage(p, errTokenExpected, ";") if result.sons[bodyPos].kind == nkEmpty: - if isStatic: DoImport(origName, pragmas, p) - else: DoImportCpp(origName, pragmas, p) + if isStatic: doImport(origName, pragmas, p) + else: doImportCpp(origName, pragmas, p) if sonsLen(result.sons[pragmasPos]) == 0: result.sons[pragmasPos] = ast.emptyNode @@ -1880,7 +1872,7 @@ proc parseOperator(p: var TParser, origName: var string): bool = case p.tok.xkind of pxAmp..pxArrow: # ordinary operator symbol: - origName.add(TokKindToStr(p.tok.xkind)) + origName.add(tokKindToStr(p.tok.xkind)) getTok(p) of pxSymbol: if p.tok.s == "new" or p.tok.s == "delete": @@ -2048,6 +2040,10 @@ proc parseStandaloneClass(p: var TParser, isStruct: bool): PNode = result = declaration(p) p.currentClass = oldClass +proc unwrap(a: PNode): PNode = + if a.kind == nkPar: + return a.sons[0] + return a include cpp @@ -2082,16 +2078,10 @@ proc statement(p: var TParser): PNode = of "return": result = newNodeP(nkReturnStmt, p) getTok(p) - # special case for ``return (expr)`` because I hate the redundant - # parenthesis ;-) - if p.tok.xkind == pxParLe: - getTok(p, result) - addSon(result, expression(p)) - eat(p, pxParRi, result) - elif p.tok.xkind != pxSemicolon: - addSon(result, expression(p)) - else: + if p.tok.xkind == pxSemicolon: addSon(result, ast.emptyNode) + else: + addSon(result, unwrap(expression(p))) eat(p, pxSemicolon) of "enum": result = enumSpecifier(p) of "typedef": result = parseTypeDef(p) @@ -2140,9 +2130,12 @@ proc statement(p: var TParser): PNode = assert result != nil proc parseUnit(p: var TParser): PNode = - result = newNodeP(nkStmtList, p) - getTok(p) # read first token - while p.tok.xkind != pxEof: - var s = statement(p) - if s.kind != nkEmpty: embedStmts(result, s) + try: + result = newNodeP(nkStmtList, p) + getTok(p) # read first token + while p.tok.xkind != pxEof: + var s = statement(p) + if s.kind != nkEmpty: embedStmts(result, s) + except ERetryParsing: + parMessage(p, errGenerated, "Uncaught parsing exception raised") diff --git a/compiler/c2nim/cpp.nim b/compiler/c2nim/cpp.nim index 2ce64e59b..1707b75db 100644 --- a/compiler/c2nim/cpp.nim +++ b/compiler/c2nim/cpp.nim @@ -226,7 +226,7 @@ proc skipUntilElifElseEndif(p: var TParser): TEndifMarker = proc parseIfdef(p: var TParser): PNode = getTok(p) # skip #ifdef - ExpectIdent(p) + expectIdent(p) case p.tok.s of "__cplusplus": skipUntilEndif(p) @@ -245,7 +245,7 @@ proc parseIfdef(p: var TParser): PNode = proc parseIfndef(p: var TParser): PNode = result = ast.emptyNode getTok(p) # skip #ifndef - ExpectIdent(p) + expectIdent(p) if p.tok.s == c2nimSymbol: skipLine(p) case skipUntilElifElseEndif(p) @@ -282,11 +282,11 @@ proc parseIfDir(p: var TParser): PNode = proc parsePegLit(p: var TParser): TPeg = var col = getColumn(p.lex) + 2 getTok(p) - if p.tok.xkind != pxStrLit: ExpectIdent(p) + if p.tok.xkind != pxStrLit: expectIdent(p) try: result = parsePeg( pattern = if p.tok.xkind == pxStrLit: p.tok.s else: escapePeg(p.tok.s), - filename = p.lex.fileIdx.ToFilename, + filename = p.lex.fileIdx.toFilename, line = p.lex.linenumber, col = col) getTok(p) @@ -295,7 +295,7 @@ proc parsePegLit(p: var TParser): TPeg = proc parseMangleDir(p: var TParser) = var pattern = parsePegLit(p) - if p.tok.xkind != pxStrLit: ExpectIdent(p) + if p.tok.xkind != pxStrLit: expectIdent(p) p.options.mangleRules.add((pattern, p.tok.s)) getTok(p) eatNewLine(p, nil) @@ -326,7 +326,7 @@ proc parseDir(p: var TParser): PNode = of "dynlib", "header", "prefix", "suffix", "class": var key = p.tok.s getTok(p) - if p.tok.xkind != pxStrLit: ExpectIdent(p) + if p.tok.xkind != pxStrLit: expectIdent(p) discard setOption(p.options, key, p.tok.s) getTok(p) eatNewLine(p, nil) diff --git a/compiler/c2nim/tests/vincent.c b/compiler/c2nim/tests/vincent.c new file mode 100644 index 000000000..24c6d6425 --- /dev/null +++ b/compiler/c2nim/tests/vincent.c @@ -0,0 +1,33 @@ +#include <stdlib.h> +#include <stdio.h> + +int rand(void); + +int id2(void) { + return (int *)1; +} + +int id(void (*f)(void)) { + f(); + ((void (*)(int))f)(10); + return 10; + return (20+1); + return (int *)id; +} + +int main() { + float f = .2, + g = 2., + h = 1.0+rand(), + i = 1.0e+3; + int j, a; + for(j = 0, a = 10; j < 0; j++, a++) ; + do { + printf("howdy"); + } while(--i, 0); + if(1) + printf("1"); // error from this comment + else + printf("2"); + return '\x00'; +} diff --git a/compiler/c2nim/tests/vincent.h b/compiler/c2nim/tests/vincent.h new file mode 100644 index 000000000..b4e761ee1 --- /dev/null +++ b/compiler/c2nim/tests/vincent.h @@ -0,0 +1,3 @@ +struct foo { + int x,y,z; +}; diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index 1d6df3c15..84c5bf419 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -73,7 +73,7 @@ proc isInCurrentFrame(p: BProc, n: PNode): bool = result = false of nkObjUpConv, nkObjDownConv, nkCheckedFieldExpr: result = isInCurrentFrame(p, n.sons[0]) - else: nil + else: discard proc openArrayLoc(p: BProc, n: PNode): PRope = var a: TLoc @@ -88,7 +88,7 @@ proc openArrayLoc(p: BProc, n: PNode): PRope = result = ropef("$1->data, $1->$2", [a.rdLoc, lenField()]) of tyArray, tyArrayConstr: result = ropef("$1, $2", [rdLoc(a), toRope(lengthOrd(a.t))]) - else: InternalError("openArrayLoc: " & typeToString(a.t)) + else: internalError("openArrayLoc: " & typeToString(a.t)) proc genArgStringToCString(p: BProc, n: PNode): PRope {.inline.} = @@ -146,7 +146,8 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) = proc addComma(r: PRope): PRope = result = if r == nil: r else: con(r, ~", ") - const CallPattern = "$1.ClEnv? $1.ClPrc($3$1.ClEnv) : (($4)($1.ClPrc))($2)" + const PatProc = "$1.ClEnv? $1.ClPrc($3$1.ClEnv):(($4)($1.ClPrc))($2)" + const PatIter = "$1.ClPrc($3$1.ClEnv)" # we know the env exists var op: TLoc initLocExpr(p, ri.sons[0], op) var pl: PRope @@ -164,9 +165,10 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) = if i < length - 1: app(pl, ~", ") template genCallPattern {.dirty.} = - lineF(p, cpsStmts, CallPattern & ";$n", op.r, pl, pl.addComma, rawProc) + lineF(p, cpsStmts, callPattern & ";$n", op.r, pl, pl.addComma, rawProc) let rawProc = getRawProcType(p, typ) + let callPattern = if tfIterator in typ.flags: PatIter else: PatProc if typ.sons[0] != nil: if isInvalidReturnType(typ.sons[0]): if sonsLen(ri) > 1: app(pl, ~", ") @@ -190,7 +192,7 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) = assert(d.t != nil) # generate an assignment to d: var list: TLoc initLoc(list, locCall, d.t, OnUnknown) - list.r = ropef(CallPattern, op.r, pl, pl.addComma, rawProc) + list.r = ropef(callPattern, op.r, pl, pl.addComma, rawProc) genAssignment(p, d, list, {}) # no need for deep copying else: genCallPattern() @@ -243,7 +245,7 @@ proc genNamedParamCall(p: BProc, ri: PNode, d: var TLoc) = for i in countup(3, length-1): assert(sonsLen(typ) == sonsLen(typ.n)) if i >= sonsLen(typ): - InternalError(ri.info, "varargs for objective C method?") + internalError(ri.info, "varargs for objective C method?") assert(typ.n.sons[i].kind == nkSym) var param = typ.n.sons[i].sym app(pl, ~" ") @@ -290,6 +292,7 @@ proc genCall(p: BProc, e: PNode, d: var TLoc) = genNamedParamCall(p, e, d) else: genPrefixCall(p, nil, e, d) + postStmtActions(p) when false: if d.s == onStack and containsGarbageCollectedRef(d.t): keepAlive(p, d) @@ -303,6 +306,7 @@ proc genAsgnCall(p: BProc, le, ri: PNode, d: var TLoc) = genNamedParamCall(p, ri, d) else: genPrefixCall(p, le, ri, d) + postStmtActions(p) when false: if d.s == onStack and containsGarbageCollectedRef(d.t): keepAlive(p, d) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index c50fd4536..031ab8d70 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -11,7 +11,7 @@ # -------------------------- constant expressions ------------------------ -proc intLiteral(i: biggestInt): PRope = +proc intLiteral(i: BiggestInt): PRope = if (i > low(int32)) and (i <= high(int32)): result = toRope(i) elif i == low(int32): @@ -22,7 +22,7 @@ proc intLiteral(i: biggestInt): PRope = else: result = ~"(IL64(-9223372036854775807) - IL64(1))" -proc int32Literal(i: Int): PRope = +proc int32Literal(i: int): PRope = if i == int(low(int32)): result = ~"(-2147483647 -1)" else: @@ -39,7 +39,7 @@ proc getStrLit(m: BModule, s: string): PRope = discard cgsym(m, "TGenericSeq") result = con("TMP", toRope(backendId())) appf(m.s[cfsData], "STRING_LITERAL($1, $2, $3);$n", - [result, makeCString(s), ToRope(len(s))]) + [result, makeCString(s), toRope(len(s))]) proc genLiteral(p: BProc, n: PNode, ty: PType): PRope = if ty == nil: internalError(n.info, "genLiteral: ty is nil") @@ -62,7 +62,7 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): PRope = of nkNilLit: let t = skipTypes(ty, abstractVarRange) if t.kind == tyProc and t.callConv == ccClosure: - var id = NodeTableTestOrSet(p.module.dataCache, n, gBackendId) + var id = nodeTableTestOrSet(p.module.dataCache, n, gBackendId) result = con("TMP", toRope(id)) if id == gBackendId: # not found in cache: @@ -74,7 +74,7 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): PRope = result = toRope("NIM_NIL") of nkStrLit..nkTripleStrLit: if skipTypes(ty, abstractVarRange).kind == tyString: - var id = NodeTableTestOrSet(p.module.dataCache, n, gBackendId) + var id = nodeTableTestOrSet(p.module.dataCache, n, gBackendId) if id == gBackendId: # string literal not found in the cache: result = ropecg(p.module, "((#NimStringDesc*) &$1)", @@ -84,9 +84,9 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): PRope = else: result = makeCString(n.strVal) of nkFloatLit..nkFloat64Lit: - result = toRope(n.floatVal.ToStrMaxPrecision) + result = toRope(n.floatVal.toStrMaxPrecision) else: - InternalError(n.info, "genLiteral(" & $n.kind & ')') + internalError(n.info, "genLiteral(" & $n.kind & ')') result = nil proc genLiteral(p: BProc, n: PNode): PRope = @@ -96,7 +96,7 @@ proc bitSetToWord(s: TBitSet, size: int): BiggestInt = result = 0 when true: for j in countup(0, size - 1): - if j < len(s): result = result or `shl`(Ze64(s[j]), j * 8) + if j < len(s): result = result or `shl`(ze64(s[j]), j * 8) else: # not needed, too complex thinking: if CPU[platform.hostCPU].endian == CPU[targetCPU].endian: @@ -117,7 +117,7 @@ proc genRawSetData(cs: TBitSet, size: int): PRope = else: frmt = "0x$1, " else: frmt = "0x$1}$n" - appf(result, frmt, [toRope(toHex(Ze64(cs[i]), 2))]) + appf(result, frmt, [toRope(toHex(ze64(cs[i]), 2))]) else: result = intLiteral(bitSetToWord(cs, size)) # result := toRope('0x' + ToHex(bitSetToWord(cs, size), size * 2)) @@ -127,7 +127,7 @@ proc genSetNode(p: BProc, n: PNode): PRope = var size = int(getSize(n.typ)) toBitSet(n, cs) if size > 8: - var id = NodeTableTestOrSet(p.module.dataCache, n, gBackendId) + var id = nodeTableTestOrSet(p.module.dataCache, n, gBackendId) result = con("TMP", toRope(id)) if id == gBackendId: # not found in cache: @@ -155,7 +155,7 @@ proc getStorageLoc(n: PNode): TStorageLoc = of tyVar: result = OnUnknown of tyPtr: result = OnStack of tyRef: result = OnHeap - else: InternalError(n.info, "getStorageLoc") + else: internalError(n.info, "getStorageLoc") of nkBracketExpr, nkDotExpr, nkObjDownConv, nkObjUpConv: result = getStorageLoc(n.sons[0]) else: result = OnUnknown @@ -202,7 +202,7 @@ proc asgnComplexity(n: PNode): int = of nkRecList: for t in items(n): result += asgnComplexity(t) - else: nil + else: discard proc optAsgnLoc(a: TLoc, t: PType, field: PRope): TLoc = result.k = locField @@ -228,7 +228,7 @@ proc genOptAsgnObject(p: BProc, dest, src: TLoc, flags: TAssignmentFlags, optAsgnLoc(src, field.typ, field.loc.r), flags) of nkRecList: for child in items(t): genOptAsgnObject(p, dest, src, flags, child) - else: nil + else: discard proc genGenericAsgn(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = # Consider: @@ -240,6 +240,7 @@ proc genGenericAsgn(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = if needToCopy notin flags or tfShallow in skipTypes(dest.t, abstractVarRange).flags: if dest.s == OnStack or not usesNativeGC(): + useStringh(p.module) linefmt(p, cpsStmts, "memcpy((void*)$1, (NIM_CONST void*)$2, sizeof($3));$n", addrLoc(dest), addrLoc(src), rdLoc(dest)) @@ -316,6 +317,7 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = if needsComplexAssignment(dest.t): genGenericAsgn(p, dest, src, flags) else: + useStringh(p.module) linefmt(p, cpsStmts, "memcpy((void*)$1, (NIM_CONST void*)$2, sizeof($1));$n", rdLoc(dest), rdLoc(src)) @@ -327,11 +329,13 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = "#genericAssignOpenArray((void*)$1, (void*)$2, $1Len0, $3);$n", addrLoc(dest), addrLoc(src), genTypeInfo(p.module, dest.t)) else: + useStringh(p.module) linefmt(p, cpsStmts, "memcpy((void*)$1, (NIM_CONST void*)$2, sizeof($1[0])*$1Len0);$n", rdLoc(dest), rdLoc(src)) of tySet: if mapType(ty) == ctArray: + useStringh(p.module) linefmt(p, cpsStmts, "memcpy((void*)$1, (NIM_CONST void*)$2, $3);$n", rdLoc(dest), rdLoc(src), toRope(getSize(dest.t))) else: @@ -339,7 +343,7 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = of tyPtr, tyPointer, tyChar, tyBool, tyEnum, tyCString, tyInt..tyUInt64, tyRange, tyVar: linefmt(p, cpsStmts, "$1 = $2;$n", rdLoc(dest), rdLoc(src)) - else: InternalError("genAssignment(" & $ty.kind & ')') + else: internalError("genAssignment: " & $ty.kind) proc getDestLoc(p: BProc, d: var TLoc, typ: PType) = if d.k == locNone: getTemp(p, typ, d) @@ -369,62 +373,62 @@ proc putIntoDest(p: BProc, d: var TLoc, t: PType, r: PRope) = proc binaryStmt(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a, b: TLoc - if d.k != locNone: InternalError(e.info, "binaryStmt") - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + if d.k != locNone: internalError(e.info, "binaryStmt") + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) lineCg(p, cpsStmts, frmt, rdLoc(a), rdLoc(b)) proc unaryStmt(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a: TLoc - if d.k != locNone: InternalError(e.info, "unaryStmt") - InitLocExpr(p, e.sons[1], a) + if d.k != locNone: internalError(e.info, "unaryStmt") + initLocExpr(p, e.sons[1], a) lineCg(p, cpsStmts, frmt, [rdLoc(a)]) proc binaryStmtChar(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a, b: TLoc - if (d.k != locNone): InternalError(e.info, "binaryStmtChar") - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + if (d.k != locNone): internalError(e.info, "binaryStmtChar") + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) lineCg(p, cpsStmts, frmt, [rdCharLoc(a), rdCharLoc(b)]) proc binaryExpr(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a, b: TLoc assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) putIntoDest(p, d, e.typ, ropecg(p.module, frmt, [rdLoc(a), rdLoc(b)])) proc binaryExprChar(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a, b: TLoc assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) putIntoDest(p, d, e.typ, ropecg(p.module, frmt, [a.rdCharLoc, b.rdCharLoc])) proc unaryExpr(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a: TLoc - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) putIntoDest(p, d, e.typ, ropecg(p.module, frmt, [rdLoc(a)])) proc unaryExprChar(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a: TLoc - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) putIntoDest(p, d, e.typ, ropecg(p.module, frmt, [rdCharLoc(a)])) proc binaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) = const - prc: array[mAddi..mModi64, string] = ["addInt", "subInt", "mulInt", + prc: array[mAddI..mModI64, string] = ["addInt", "subInt", "mulInt", "divInt", "modInt", "addInt64", "subInt64", "mulInt64", "divInt64", "modInt64"] - opr: array[mAddi..mModi64, string] = ["+", "-", "*", "/", "%", "+", "-", + opr: array[mAddI..mModI64, string] = ["+", "-", "*", "/", "%", "+", "-", "*", "/", "%"] var a, b: TLoc assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) var t = skipTypes(e.typ, abstractRange) if optOverflowCheck notin p.options: putIntoDest(p, d, e.typ, ropef("(NI$4)($2 $1 $3)", [toRope(opr[m]), @@ -432,7 +436,7 @@ proc binaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) = else: var storage: PRope var size = getSize(t) - if size < platform.IntSize: + if size < platform.intSize: storage = toRope("NI") else: storage = getTypeDesc(p.module, t) @@ -440,7 +444,7 @@ proc binaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) = linefmt(p, cpsLocals, "$1 $2;$n", storage, tmp) lineCg(p, cpsStmts, "$1 = #$2($3, $4);$n", tmp, toRope(prc[m]), rdLoc(a), rdLoc(b)) - if size < platform.IntSize or t.kind in {tyRange, tyEnum, tySet}: + if size < platform.intSize or t.kind in {tyRange, tyEnum, tySet}: linefmt(p, cpsStmts, "if ($1 < $2 || $1 > $3) #raiseOverflow();$n", tmp, intLiteral(firstOrd(t)), intLiteral(lastOrd(t))) putIntoDest(p, d, e.typ, ropef("(NI$1)($2)", [toRope(getSize(t)*8), tmp])) @@ -456,7 +460,7 @@ proc unaryArithOverflow(p: BProc, e: PNode, d: var TLoc, m: TMagic) = a: TLoc t: PType assert(e.sons[1].typ != nil) - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) t = skipTypes(e.typ, abstractRange) if optOverflowCheck in p.options: linefmt(p, cpsStmts, "if ($1 == $2) #raiseOverflow();$n", @@ -522,11 +526,11 @@ proc binaryArith(p: BProc, e: PNode, d: var TLoc, op: TMagic) = "($1 != $2)"] # Xor var a, b: TLoc - s: biggestInt + s: BiggestInt assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) # BUGFIX: cannot use result-type here, as it may be a boolean s = max(getSize(a.t), getSize(b.t)) * 8 putIntoDest(p, d, e.typ, @@ -537,8 +541,8 @@ proc genEqProc(p: BProc, e: PNode, d: var TLoc) = var a, b: TLoc assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) if a.t.callConv == ccClosure: putIntoDest(p, d, e.typ, ropef("($1.ClPrc == $2.ClPrc && $1.ClEnv == $2.ClEnv)", [ @@ -581,7 +585,7 @@ proc unaryArith(p: BProc, e: PNode, d: var TLoc, op: TMagic) = a: TLoc t: PType assert(e.sons[1].typ != nil) - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) t = skipTypes(e.typ, abstractRange) putIntoDest(p, d, e.typ, ropef(unArithTab[op], [rdLoc(a), toRope(getSize(t) * 8), @@ -602,21 +606,21 @@ proc genDeref(p: BProc, e: PNode, d: var TLoc) = d.s = OnUnknown of tyPtr: d.s = OnUnknown # BUGFIX! - else: InternalError(e.info, "genDeref " & $a.t.kind) + else: internalError(e.info, "genDeref " & $a.t.kind) putIntoDest(p, d, a.t.sons[0], ropef("(*$1)", [rdLoc(a)])) proc genAddr(p: BProc, e: PNode, d: var TLoc) = # careful 'addr(myptrToArray)' needs to get the ampersand: if e.sons[0].typ.skipTypes(abstractInst).kind in {tyRef, tyPtr}: var a: TLoc - InitLocExpr(p, e.sons[0], a) + initLocExpr(p, e.sons[0], a) putIntoDest(p, d, e.typ, con("&", a.r)) #Message(e.info, warnUser, "HERE NEW &") elif mapType(e.sons[0].typ) == ctArray: expr(p, e.sons[0], d) else: var a: TLoc - InitLocExpr(p, e.sons[0], a) + initLocExpr(p, e.sons[0], a) putIntoDest(p, d, e.typ, addrLoc(a)) template inheritLocation(d: var TLoc, a: TLoc) = @@ -626,7 +630,7 @@ template inheritLocation(d: var TLoc, a: TLoc) = proc genRecordFieldAux(p: BProc, e: PNode, d, a: var TLoc): PType = initLocExpr(p, e.sons[0], a) - if e.sons[1].kind != nkSym: InternalError(e.info, "genRecordFieldAux") + if e.sons[1].kind != nkSym: internalError(e.info, "genRecordFieldAux") d.inheritLocation(a) discard getTypeDesc(p.module, a.t) # fill the record's fields.loc result = a.t @@ -660,13 +664,13 @@ proc genRecordField(p: BProc, e: PNode, d: var TLoc) = var field: PSym = nil while ty != nil: if ty.kind notin {tyTuple, tyObject}: - InternalError(e.info, "genRecordField") + internalError(e.info, "genRecordField") field = lookupInRecord(ty.n, f.name) if field != nil: break if gCmd != cmdCompileToCpp: app(r, ".Sup") - ty = GetUniqueType(ty.sons[0]) - if field == nil: InternalError(e.info, "genRecordField 2 ") - if field.loc.r == nil: InternalError(e.info, "genRecordField 3") + ty = getUniqueType(ty.sons[0]) + if field == nil: internalError(e.info, "genRecordField 2 ") + if field.loc.r == nil: internalError(e.info, "genRecordField 3") appf(r, ".$1", [field.loc.r]) putIntoDest(p, d, field.typ, r) @@ -682,11 +686,11 @@ proc genFieldCheck(p: BProc, e: PNode, obj: PRope, field: PSym) = if op.magic == mNot: it = it.sons[1] assert(it.sons[2].kind == nkSym) initLoc(test, locNone, it.typ, OnStack) - InitLocExpr(p, it.sons[1], u) + initLocExpr(p, it.sons[1], u) initLoc(v, locExpr, it.sons[2].typ, OnUnknown) v.r = ropef("$1.$2", [obj, it.sons[2].sym.loc.r]) genInExprAux(p, it, u, v, test) - let id = NodeTableTestOrSet(p.module.dataCache, + let id = nodeTableTestOrSet(p.module.dataCache, newStrNode(nkStrLit, field.name.s), gBackendId) let strLit = if id == gBackendId: getStrLit(p.module, field.name.s) else: con("TMP", toRope(id)) @@ -716,9 +720,9 @@ proc genCheckedRecordField(p: BProc, e: PNode, d: var TLoc) = if field != nil: break if gCmd != cmdCompileToCpp: app(r, ".Sup") ty = getUniqueType(ty.sons[0]) - if field == nil: InternalError(e.info, "genCheckedRecordField") + if field == nil: internalError(e.info, "genCheckedRecordField") if field.loc.r == nil: - InternalError(e.info, "genCheckedRecordField") # generate the checks: + internalError(e.info, "genCheckedRecordField") # generate the checks: genFieldCheck(p, e, r, field) app(r, rfmt(nil, ".$1", field.loc.r)) putIntoDest(p, d, field.typ, r) @@ -770,7 +774,7 @@ proc genOpenArrayElem(p: BProc, e: PNode, d: var TLoc) = putIntoDest(p, d, elemType(skipTypes(a.t, abstractVar)), rfmt(nil, "$1[$2]", rdLoc(a), rdCharLoc(b))) -proc genSeqElem(p: BPRoc, e: PNode, d: var TLoc) = +proc genSeqElem(p: BProc, e: PNode, d: var TLoc) = var a, b: TLoc initLocExpr(p, e.sons[0], a) initLocExpr(p, e.sons[1], b) @@ -834,7 +838,7 @@ proc genAndOr(p: BProc, e: PNode, d: var TLoc, m: TMagic) = proc genEcho(p: BProc, n: PNode) = # this unusal way of implementing it ensures that e.g. ``echo("hallo", 45)`` # is threadsafe. - discard lists.IncludeStr(p.module.headerFiles, "<stdio.h>") + discard lists.includeStr(p.module.headerFiles, "<stdio.h>") var args: PRope = nil var a: TLoc for i in countup(1, n.len-1): @@ -843,6 +847,9 @@ proc genEcho(p: BProc, n: PNode) = linefmt(p, cpsStmts, "printf($1$2);$n", makeCString(repeatStr(n.len-1, "%s") & tnl), args) +proc gcUsage(n: PNode) = + if gSelectedGC == gcNone: message(n.info, warnGcMem, n.renderTree) + proc genStrConcat(p: BProc, e: PNode, d: var TLoc) = # <Nimrod code> # s = 'Hello ' & name & ', how do you feel?' & 'z' @@ -868,12 +875,12 @@ proc genStrConcat(p: BProc, e: PNode, d: var TLoc) = for i in countup(0, sonsLen(e) - 2): # compute the length expression: initLocExpr(p, e.sons[i + 1], a) - if skipTypes(e.sons[i + 1].Typ, abstractVarRange).kind == tyChar: - Inc(L) + if skipTypes(e.sons[i + 1].typ, abstractVarRange).kind == tyChar: + inc(L) app(appends, rfmt(p.module, "#appendChar($1, $2);$n", tmp.r, rdLoc(a))) else: if e.sons[i + 1].kind in {nkStrLit..nkTripleStrLit}: - Inc(L, len(e.sons[i + 1].strVal)) + inc(L, len(e.sons[i + 1].strVal)) else: appf(lens, "$1->$2 + ", [rdLoc(a), lenField()]) app(appends, rfmt(p.module, "#appendString($1, $2);$n", tmp.r, rdLoc(a))) @@ -884,6 +891,7 @@ proc genStrConcat(p: BProc, e: PNode, d: var TLoc) = keepAlive(p, tmp) else: genAssignment(p, d, tmp, {needToKeepAlive}) # no need for deep copying + gcUsage(e) proc genStrAppend(p: BProc, e: PNode, d: var TLoc) = # <Nimrod code> @@ -906,13 +914,13 @@ proc genStrAppend(p: BProc, e: PNode, d: var TLoc) = for i in countup(0, sonsLen(e) - 3): # compute the length expression: initLocExpr(p, e.sons[i + 2], a) - if skipTypes(e.sons[i + 2].Typ, abstractVarRange).kind == tyChar: - Inc(L) + if skipTypes(e.sons[i + 2].typ, abstractVarRange).kind == tyChar: + inc(L) app(appends, rfmt(p.module, "#appendChar($1, $2);$n", rdLoc(dest), rdLoc(a))) else: if e.sons[i + 2].kind in {nkStrLit..nkTripleStrLit}: - Inc(L, len(e.sons[i + 2].strVal)) + inc(L, len(e.sons[i + 2].strVal)) else: appf(lens, "$1->$2 + ", [rdLoc(a), lenField()]) app(appends, rfmt(p.module, "#appendString($1, $2);$n", @@ -921,6 +929,7 @@ proc genStrAppend(p: BProc, e: PNode, d: var TLoc) = rdLoc(dest), lens, toRope(L)) keepAlive(p, dest) app(p.s(cpsStmts), appends) + gcUsage(e) proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) = # seq &= x --> @@ -931,20 +940,21 @@ proc genSeqElemAppend(p: BProc, e: PNode, d: var TLoc) = else: "$1 = ($2) #incrSeq($1, sizeof($3));$n" var a, b, dest: TLoc - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) lineCg(p, cpsStmts, seqAppendPattern, [ rdLoc(a), getTypeDesc(p.module, skipTypes(e.sons[1].typ, abstractVar)), - getTypeDesc(p.module, skipTypes(e.sons[2].Typ, abstractVar))]) + getTypeDesc(p.module, skipTypes(e.sons[2].typ, abstractVar))]) keepAlive(p, a) initLoc(dest, locExpr, b.t, OnHeap) dest.r = rfmt(nil, "$1->data[$1->$2-1]", rdLoc(a), lenField()) genAssignment(p, dest, b, {needToCopy, afDestIsNil}) + gcUsage(e) proc genReset(p: BProc, n: PNode) = var a: TLoc - InitLocExpr(p, n.sons[1], a) + initLocExpr(p, n.sons[1], a) linefmt(p, cpsStmts, "#genericReset((void*)$1, $2);$n", addrLoc(a), genTypeInfo(p.module, skipTypes(a.t, abstractVarRange))) @@ -955,8 +965,8 @@ proc rawGenNew(p: BProc, a: TLoc, sizeExpr: PRope) = initLoc(b, locExpr, a.t, OnHeap) if sizeExpr.isNil: sizeExpr = ropef("sizeof($1)", - getTypeDesc(p.module, skipTypes(reftype.sons[0], abstractRange))) - let args = [getTypeDesc(p.module, reftype), + getTypeDesc(p.module, skipTypes(refType.sons[0], abstractRange))) + let args = [getTypeDesc(p.module, refType), genTypeInfo(p.module, refType), sizeExpr] if a.s == OnHeap and usesNativeGC(): @@ -975,19 +985,20 @@ proc rawGenNew(p: BProc, a: TLoc, sizeExpr: PRope) = proc genNew(p: BProc, e: PNode) = var a: TLoc - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) # 'genNew' also handles 'unsafeNew': if e.len == 3: var se: TLoc - InitLocExpr(p, e.sons[2], se) + initLocExpr(p, e.sons[2], se) rawGenNew(p, a, se.rdLoc) else: rawGenNew(p, a, nil) + gcUsage(e) proc genNewSeqAux(p: BProc, dest: TLoc, length: PRope) = let seqtype = skipTypes(dest.t, abstractVarRange) let args = [getTypeDesc(p.module, seqtype), - genTypeInfo(p.module, seqType), length] + genTypeInfo(p.module, seqtype), length] var call: TLoc initLoc(call, locExpr, dest.t, OnHeap) if dest.s == OnHeap and usesNativeGC(): @@ -1003,9 +1014,10 @@ proc genNewSeqAux(p: BProc, dest: TLoc, length: PRope) = proc genNewSeq(p: BProc, e: PNode) = var a, b: TLoc - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) genNewSeqAux(p, a, b.rdLoc) + gcUsage(e) proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = var tmp: TLoc @@ -1017,6 +1029,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = rawGenNew(p, tmp, nil) t = t.sons[0].skipTypes(abstractInst) r = ropef("(*$1)", r) + gcUsage(e) discard getTypeDesc(p.module, t) for i in 1 .. <e.len: let it = e.sons[i] @@ -1028,15 +1041,15 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = field = lookupInRecord(ty.n, it.sons[0].sym.name) if field != nil: break if gCmd != cmdCompileToCpp: app(tmp2.r, ".Sup") - ty = GetUniqueType(ty.sons[0]) - if field == nil or field.loc.r == nil: InternalError(e.info, "genObjConstr") + ty = getUniqueType(ty.sons[0]) + if field == nil or field.loc.r == nil: internalError(e.info, "genObjConstr") if it.len == 3 and optFieldCheck in p.options: genFieldCheck(p, it.sons[2], r, field) app(tmp2.r, ".") app(tmp2.r, field.loc.r) tmp2.k = locTemp tmp2.t = field.loc.t - tmp2.s = onHeap + tmp2.s = if isRef: OnHeap else: OnStack tmp2.heapRoot = tmp.r expr(p, it.sons[1], tmp2) if d.k == locNone: @@ -1055,6 +1068,7 @@ proc genSeqConstr(p: BProc, t: PNode, d: var TLoc) = arr.r = rfmt(nil, "$1->data[$2]", rdLoc(d), intLiteral(i)) arr.s = OnHeap # we know that sequences are on the heap expr(p, t.sons[i], arr) + gcUsage(t) proc genArrToSeq(p: BProc, t: PNode, d: var TLoc) = var elem, a, arr: TLoc @@ -1084,17 +1098,18 @@ proc genNewFinalize(p: BProc, e: PNode) = ti: PRope oldModule: BModule refType = skipTypes(e.sons[1].typ, abstractVarRange) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], f) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], f) initLoc(b, locExpr, a.t, OnHeap) ti = genTypeInfo(p.module, refType) appf(p.module.s[cfsTypeInit3], "$1->finalizer = (void*)$2;$n", [ti, rdLoc(f)]) b.r = ropecg(p.module, "($1) #newObj($2, sizeof($3))", [ getTypeDesc(p.module, refType), - ti, getTypeDesc(p.module, skipTypes(reftype.sons[0], abstractRange))]) + ti, getTypeDesc(p.module, skipTypes(refType.sons[0], abstractRange))]) genAssignment(p, a, b, {needToKeepAlive}) # set the object type: bt = skipTypes(refType.sons[0], abstractRange) genObjectInit(p, cpsStmts, bt, a, false) + gcUsage(e) proc genOf(p: BProc, x: PNode, typ: PType, d: var TLoc) = var a: TLoc @@ -1112,7 +1127,7 @@ proc genOf(p: BProc, x: PNode, typ: PType, d: var TLoc) = app(r, ~".Sup") t = skipTypes(t.sons[0], typedescInst) if isObjLackingTypeField(t): - GlobalError(x.info, errGenerated, + globalError(x.info, errGenerated, "no 'of' operator available for pure objects") if nilCheck != nil: r = rfmt(p.module, "(($1) && #isObj($2.m_type, $3))", @@ -1128,7 +1143,7 @@ proc genOf(p: BProc, n: PNode, d: var TLoc) = proc genRepr(p: BProc, e: PNode, d: var TLoc) = # XXX we don't generate keep alive info for now here var a: TLoc - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) var t = skipTypes(e.sons[1].typ, abstractVarRange) case t.kind of tyInt..tyInt64, tyUInt..tyUInt64: @@ -1160,7 +1175,7 @@ proc genRepr(p: BProc, e: PNode, d: var TLoc) = of tyArray, tyArrayConstr: putIntoDest(p, b, e.typ, ropef("$1, $2", [rdLoc(a), toRope(lengthOrd(a.t))])) - else: InternalError(e.sons[0].info, "genRepr()") + else: internalError(e.sons[0].info, "genRepr()") putIntoDest(p, d, e.typ, ropecg(p.module, "#reprOpenArray($1, $2)", [rdLoc(b), genTypeInfo(p.module, elemType(t))])) @@ -1172,6 +1187,7 @@ proc genRepr(p: BProc, e: PNode, d: var TLoc) = else: putIntoDest(p, d, e.typ, ropecg(p.module, "#reprAny($1, $2)", [addrLoc(a), genTypeInfo(p.module, t)])) + gcUsage(e) proc genGetTypeInfo(p: BProc, e: PNode, d: var TLoc) = var t = skipTypes(e.sons[1].typ, abstractVarRange) @@ -1179,20 +1195,21 @@ proc genGetTypeInfo(p: BProc, e: PNode, d: var TLoc) = proc genDollar(p: BProc, n: PNode, d: var TLoc, frmt: string) = var a: TLoc - InitLocExpr(p, n.sons[1], a) + initLocExpr(p, n.sons[1], a) a.r = ropecg(p.module, frmt, [rdLoc(a)]) if d.k == locNone: getTemp(p, n.typ, d) genAssignment(p, d, a, {needToKeepAlive}) + gcUsage(n) proc genArrayLen(p: BProc, e: PNode, d: var TLoc, op: TMagic) = var a = e.sons[1] if a.kind == nkHiddenAddr: a = a.sons[0] - var typ = skipTypes(a.Typ, abstractVar) + var typ = skipTypes(a.typ, abstractVar) case typ.kind of tyOpenArray, tyVarargs: if op == mHigh: unaryExpr(p, e, d, "($1Len0-1)") else: unaryExpr(p, e, d, "$1Len0") - of tyCstring: + of tyCString: if op == mHigh: unaryExpr(p, e, d, "(strlen($1)-1)") else: unaryExpr(p, e, d, "strlen($1)") of tyString, tySequence: @@ -1204,15 +1221,15 @@ proc genArrayLen(p: BProc, e: PNode, d: var TLoc, op: TMagic) = else: unaryExpr(p, e, d, "$1->len") of tyArray, tyArrayConstr: # YYY: length(sideeffect) is optimized away incorrectly? - if op == mHigh: putIntoDest(p, d, e.typ, toRope(lastOrd(Typ))) + if op == mHigh: putIntoDest(p, d, e.typ, toRope(lastOrd(typ))) else: putIntoDest(p, d, e.typ, toRope(lengthOrd(typ))) - else: InternalError(e.info, "genArrayLen()") + else: internalError(e.info, "genArrayLen()") proc genSetLengthSeq(p: BProc, e: PNode, d: var TLoc) = var a, b: TLoc assert(d.k == locNone) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) var t = skipTypes(e.sons[1].typ, abstractVar) let setLenPattern = if gCmd != cmdCompileToCpp: "$1 = ($3) #setLengthSeq(&($1)->Sup, sizeof($4), $2);$n" @@ -1223,10 +1240,12 @@ proc genSetLengthSeq(p: BProc, e: PNode, d: var TLoc) = rdLoc(a), rdLoc(b), getTypeDesc(p.module, t), getTypeDesc(p.module, t.sons[0])]) keepAlive(p, a) + gcUsage(e) proc genSetLengthStr(p: BProc, e: PNode, d: var TLoc) = binaryStmt(p, e, d, "$1 = #setLengthStr($1, $2);$n") - keepAlive(P, d) + keepAlive(p, d) + gcUsage(e) proc genSwap(p: BProc, e: PNode, d: var TLoc) = # swap(a, b) --> @@ -1235,8 +1254,8 @@ proc genSwap(p: BProc, e: PNode, d: var TLoc) = # b = temp var a, b, tmp: TLoc getTemp(p, skipTypes(e.sons[1].typ, abstractVar), tmp) - InitLocExpr(p, e.sons[1], a) # eval a - InitLocExpr(p, e.sons[2], b) # eval b + initLocExpr(p, e.sons[1], a) # eval a + initLocExpr(p, e.sons[2], b) # eval b genAssignment(p, tmp, a, {}) genAssignment(p, a, b, {}) genAssignment(p, b, tmp, {}) @@ -1252,10 +1271,10 @@ proc rdSetElemLoc(a: TLoc, setType: PType): PRope = proc fewCmps(s: PNode): bool = # this function estimates whether it is better to emit code # for constructing the set or generating a bunch of comparisons directly - if s.kind != nkCurly: InternalError(s.info, "fewCmps") + if s.kind != nkCurly: internalError(s.info, "fewCmps") if (getSize(s.typ) <= platform.intSize) and (nfAllConst in s.flags): result = false # it is better to emit the set generation code - elif elemType(s.typ).Kind in {tyInt, tyInt16..tyInt64}: + elif elemType(s.typ).kind in {tyInt, tyInt16..tyInt64}: result = true # better not emit the set if int is basetype! else: result = sonsLen(s) <= 8 # 8 seems to be a good value @@ -1274,13 +1293,13 @@ proc genInExprAux(p: BProc, e: PNode, a, b, d: var TLoc) = proc binaryStmtInExcl(p: BProc, e: PNode, d: var TLoc, frmt: string) = var a, b: TLoc assert(d.k == locNone) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) lineF(p, cpsStmts, frmt, [rdLoc(a), rdSetElemLoc(b, a.t)]) proc genInOp(p: BProc, e: PNode, d: var TLoc) = var a, b, x, y: TLoc - if (e.sons[1].Kind == nkCurly) and fewCmps(e.sons[1]): + if (e.sons[1].kind == nkCurly) and fewCmps(e.sons[1]): # a set constructor but not a constant set: # do not emit the set, but generate a bunch of comparisons; and if we do # so, we skip the unnecessary range check: This is a semantical extension @@ -1294,13 +1313,13 @@ proc genInOp(p: BProc, e: PNode, d: var TLoc) = b.r = toRope("(") var length = sonsLen(e.sons[1]) for i in countup(0, length - 1): - if e.sons[1].sons[i].Kind == nkRange: - InitLocExpr(p, e.sons[1].sons[i].sons[0], x) - InitLocExpr(p, e.sons[1].sons[i].sons[1], y) + if e.sons[1].sons[i].kind == nkRange: + initLocExpr(p, e.sons[1].sons[i].sons[0], x) + initLocExpr(p, e.sons[1].sons[i].sons[1], y) appf(b.r, "$1 >= $2 && $1 <= $3", [rdCharLoc(a), rdCharLoc(x), rdCharLoc(y)]) else: - InitLocExpr(p, e.sons[1].sons[i], x) + initLocExpr(p, e.sons[1].sons[i], x) appf(b.r, "$1 == $2", [rdCharLoc(a), rdCharLoc(x)]) if i < length - 1: app(b.r, " || ") app(b.r, ")") @@ -1308,8 +1327,8 @@ proc genInOp(p: BProc, e: PNode, d: var TLoc) = else: assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) genInExprAux(p, e, a, b, d) proc genSetOp(p: BProc, e: PNode, d: var TLoc, op: TMagic) = @@ -1322,7 +1341,7 @@ proc genSetOp(p: BProc, e: PNode, d: var TLoc, op: TMagic) = "if ($3) $3 = (memcmp($4, $5, $2) != 0);$n", "&", "|", "& ~", "^"] var a, b, i: TLoc - var setType = skipTypes(e.sons[1].Typ, abstractVar) + var setType = skipTypes(e.sons[1].typ, abstractVar) var size = int(getSize(setType)) case size of 1, 2, 4, 8: @@ -1361,6 +1380,7 @@ proc genSetOp(p: BProc, e: PNode, d: var TLoc, op: TMagic) = lineF(p, cpsStmts, lookupOpr[op], [rdLoc(i), toRope(size), rdLoc(d), rdLoc(a), rdLoc(b)]) of mEqSet: + useStringh(p.module) binaryExprChar(p, e, d, "(memcmp($1, $2, " & $(size) & ")==0)") of mMulSet, mPlusSet, mMinusSet, mSymDiffSet: # we inline the simple for loop for better code generation: @@ -1386,7 +1406,7 @@ proc genSomeCast(p: BProc, e: PNode, d: var TLoc) = # we use whatever C gives us. Except if we have a value-type, we need to go # through its address: var a: TLoc - InitLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[1], a) let etyp = skipTypes(e.typ, abstractRange) if etyp.kind in ValueTypes and lfIndirect notin a.flags: putIntoDest(p, d, e.typ, ropef("(*($1*) ($2))", @@ -1428,13 +1448,13 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc, magic: string) = var dest = skipTypes(n.typ, abstractVar) # range checks for unsigned turned out to be buggy and annoying: if optRangeCheck notin p.options or dest.kind in {tyUInt..tyUInt64}: - InitLocExpr(p, n.sons[0], a) + initLocExpr(p, n.sons[0], a) putIntoDest(p, d, n.typ, ropef("(($1) ($2))", [getTypeDesc(p.module, dest), rdCharLoc(a)])) else: - InitLocExpr(p, n.sons[0], a) + initLocExpr(p, n.sons[0], a) if leValue(n.sons[2], n.sons[1]): - InternalError(n.info, "range check will always fail; empty range") + internalError(n.info, "range check will always fail; empty range") putIntoDest(p, d, dest, ropecg(p.module, "(($1)#$5($2, $3, $4))", [ getTypeDesc(p.module, dest), rdCharLoc(a), genLiteral(p, n.sons[1], dest), genLiteral(p, n.sons[2], dest), @@ -1457,6 +1477,7 @@ proc convCStrToStr(p: BProc, n: PNode, d: var TLoc) = initLocExpr(p, n.sons[0], a) putIntoDest(p, d, skipTypes(n.typ, abstractVar), ropecg(p.module, "#cstrToNimstr($1)", [rdLoc(a)])) + gcUsage(n) proc genStrEquals(p: BProc, e: PNode, d: var TLoc) = var x: TLoc @@ -1476,17 +1497,17 @@ proc genStrEquals(p: BProc, e: PNode, d: var TLoc) = binaryExpr(p, e, d, "#eqStrings($1, $2)") proc binaryFloatArith(p: BProc, e: PNode, d: var TLoc, m: TMagic) = - if {optNanCheck, optInfCheck} * p.options != {}: + if {optNaNCheck, optInfCheck} * p.options != {}: const opr: array[mAddF64..mDivF64, string] = ["+", "-", "*", "/"] var a, b: TLoc assert(e.sons[1].typ != nil) assert(e.sons[2].typ != nil) - InitLocExpr(p, e.sons[1], a) - InitLocExpr(p, e.sons[2], b) + initLocExpr(p, e.sons[1], a) + initLocExpr(p, e.sons[2], b) putIntoDest(p, d, e.typ, rfmt(nil, "(($4)($2) $1 ($4)($3))", toRope(opr[m]), rdLoc(a), rdLoc(b), getSimpleTypeDesc(p.module, e[1].typ))) - if optNanCheck in p.options: + if optNaNCheck in p.options: linefmt(p, cpsStmts, "#nanCheck($1);$n", rdLoc(d)) if optInfCheck in p.options: linefmt(p, cpsStmts, "#infCheck($1);$n", rdLoc(d)) @@ -1502,30 +1523,30 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = of mAddF64..mDivF64: binaryFloatArith(p, e, d, op) of mShrI..mXor: binaryArith(p, e, d, op) of mEqProc: genEqProc(p, e, d) - of mAddi..mModi64: binaryArithOverflow(p, e, d, op) + of mAddI..mModI64: binaryArithOverflow(p, e, d, op) of mRepr: genRepr(p, e, d) of mGetTypeInfo: genGetTypeInfo(p, e, d) of mSwap: genSwap(p, e, d) of mUnaryLt: - if not (optOverflowCheck in p.Options): unaryExpr(p, e, d, "$1 - 1") + if not (optOverflowCheck in p.options): unaryExpr(p, e, d, "$1 - 1") else: unaryExpr(p, e, d, "#subInt($1, 1)") of mPred: # XXX: range checking? - if not (optOverflowCheck in p.Options): binaryExpr(p, e, d, "$1 - $2") + if not (optOverflowCheck in p.options): binaryExpr(p, e, d, "$1 - $2") else: binaryExpr(p, e, d, "#subInt($1, $2)") of mSucc: # XXX: range checking? - if not (optOverflowCheck in p.Options): binaryExpr(p, e, d, "$1 + $2") + if not (optOverflowCheck in p.options): binaryExpr(p, e, d, "$1 + $2") else: binaryExpr(p, e, d, "#addInt($1, $2)") of mInc: - if not (optOverflowCheck in p.Options): + if not (optOverflowCheck in p.options): binaryStmt(p, e, d, "$1 += $2;$n") elif skipTypes(e.sons[1].typ, abstractVar).kind == tyInt64: binaryStmt(p, e, d, "$1 = #addInt64($1, $2);$n") else: binaryStmt(p, e, d, "$1 = #addInt($1, $2);$n") of ast.mDec: - if not (optOverflowCheck in p.Options): + if not (optOverflowCheck in p.options): binaryStmt(p, e, d, "$1 -= $2;$n") elif skipTypes(e.sons[1].typ, abstractVar).kind == tyInt64: binaryStmt(p, e, d, "$1 = #subInt64($1, $2);$n") @@ -1588,7 +1609,7 @@ proc handleConstExpr(p: BProc, n: PNode, d: var TLoc): bool = if (nfAllConst in n.flags) and (d.k == locNone) and (sonsLen(n) > 0): var t = getUniqueType(n.typ) discard getTypeDesc(p.module, t) # so that any fields are initialized - var id = NodeTableTestOrSet(p.module.dataCache, n, gBackendId) + var id = nodeTableTestOrSet(p.module.dataCache, n, gBackendId) fillLoc(d, locData, t, con("TMP", toRope(id)), OnHeap) if id == gBackendId: # expression not found in the cache: @@ -1612,6 +1633,7 @@ proc genSetConstr(p: BProc, e: PNode, d: var TLoc) = if d.k == locNone: getTemp(p, e.typ, d) if getSize(e.typ) > 8: # big set: + useStringh(p.module) lineF(p, cpsStmts, "memset($1, 0, sizeof($1));$n", [rdLoc(d)]) for i in countup(0, sonsLen(e) - 1): if e.sons[i].kind == nkRange: @@ -1663,14 +1685,14 @@ proc genTupleConstr(p: BProc, n: PNode, d: var TLoc) = [rdLoc(d), mangleRecFieldName(t.n.sons[i].sym, t)]) expr(p, it, rec) -proc IsConstClosure(n: PNode): bool {.inline.} = +proc isConstClosure(n: PNode): bool {.inline.} = result = n.sons[0].kind == nkSym and isRoutine(n.sons[0].sym) and n.sons[1].kind == nkNilLit proc genClosure(p: BProc, n: PNode, d: var TLoc) = assert n.kind == nkClosure - if IsConstClosure(n): + if isConstClosure(n): inc(p.labels) var tmp = con("LOC", toRope(p.labels)) appf(p.module.s[cfsData], "NIM_CONST $1 $2 = $3;$n", @@ -1754,7 +1776,7 @@ proc downConv(p: BProc, n: PNode, d: var TLoc) = proc exprComplexConst(p: BProc, n: PNode, d: var TLoc) = var t = getUniqueType(n.typ) discard getTypeDesc(p.module, t) # so that any fields are initialized - var id = NodeTableTestOrSet(p.module.dataCache, n, gBackendId) + var id = nodeTableTestOrSet(p.module.dataCache, n, gBackendId) var tmp = con("TMP", toRope(id)) if id == gBackendId: @@ -1772,7 +1794,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = case n.kind of nkSym: var sym = n.sym - case sym.Kind + case sym.kind of skMethod: if sym.getBody.kind == nkEmpty or sfDispatcher in sym.flags: # we cannot produce code for the dispatcher yet: @@ -1784,7 +1806,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = of skProc, skConverter, skIterator: genProc(p.module, sym) if sym.loc.r == nil or sym.loc.t == nil: - InternalError(n.info, "expr: proc not init " & sym.name.s) + internalError(n.info, "expr: proc not init " & sym.name.s) putLocIntoDest(p, d, sym.loc) of skConst: if sfFakeConst in sym.flags: @@ -1799,9 +1821,9 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = of skVar, skForVar, skResult, skLet: if sfGlobal in sym.flags: genVarPrototype(p.module, sym) if sym.loc.r == nil or sym.loc.t == nil: - InternalError(n.info, "expr: var not init " & sym.name.s) + internalError(n.info, "expr: var not init " & sym.name.s) if sfThread in sym.flags: - AccessThreadLocalVar(p, sym) + accessThreadLocalVar(p, sym) if emulatedThreadVars(): putIntoDest(p, d, sym.loc.t, con("NimTV->", sym.loc.r)) else: @@ -1810,13 +1832,13 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = putLocIntoDest(p, d, sym.loc) of skTemp: if sym.loc.r == nil or sym.loc.t == nil: - InternalError(n.info, "expr: temp not init " & sym.name.s) + internalError(n.info, "expr: temp not init " & sym.name.s) putLocIntoDest(p, d, sym.loc) of skParam: if sym.loc.r == nil or sym.loc.t == nil: - InternalError(n.info, "expr: param not init " & sym.name.s) + internalError(n.info, "expr: param not init " & sym.name.s) putLocIntoDest(p, d, sym.loc) - else: InternalError(n.info, "expr(" & $sym.kind & "); unknown symbol") + else: internalError(n.info, "expr(" & $sym.kind & "); unknown symbol") of nkNilLit: if not isEmptyType(n.typ): putIntoDest(p, d, n.typ, genLiteral(p, n)) @@ -1870,7 +1892,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = of tySequence, tyString: genSeqElem(p, n, d) of tyCString: genCStringElem(p, n, d) of tyTuple: genTupleElem(p, n, d) - else: InternalError(n.info, "expr(nkBracketExpr, " & $ty.kind & ')') + else: internalError(n.info, "expr(nkBracketExpr, " & $ty.kind & ')') of nkDerefExpr, nkHiddenDeref: genDeref(p, n, d) of nkDotExpr: genRecordField(p, n, d) of nkCheckedFieldExpr: genCheckedRecordField(p, n, d) @@ -1890,12 +1912,12 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = var sym = n.sons[namePos].sym genProc(p.module, sym) if sym.loc.r == nil or sym.loc.t == nil: - InternalError(n.info, "expr: proc not init " & sym.name.s) + internalError(n.info, "expr: proc not init " & sym.name.s) putLocIntoDest(p, d, sym.loc) of nkClosure: genClosure(p, n, d) of nkMetaNode: expr(p, n.sons[0], d) - of nkEmpty: nil + of nkEmpty: discard of nkWhileStmt: genWhileStmt(p, n) of nkVarSection, nkLetSection: genVarStmt(p, n) of nkConstSection: genConstStmt(p, n) @@ -1925,7 +1947,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = of nkCommentStmt, nkIteratorDef, nkIncludeStmt, nkImportStmt, nkImportExceptStmt, nkExportStmt, nkExportExceptStmt, nkFromStmt, nkTemplateDef, nkMacroDef: - nil + discard of nkPragma: genPragma(p, n) of nkProcDef, nkMethodDef, nkConverterDef: if (n.sons[genericParamsPos].kind == nkEmpty): @@ -1946,7 +1968,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = of nkState: genState(p, n) of nkGotoState: genGotoState(p, n) of nkBreakState: genBreakState(p, n) - else: InternalError(n.info, "expr(" & $n.kind & "); unknown node kind") + else: internalError(n.info, "expr(" & $n.kind & "); unknown node kind") proc genNamedConstExpr(p: BProc, n: PNode): PRope = if n.kind == nkExprColonExpr: result = genConstExpr(p, n.sons[1]) @@ -1984,7 +2006,7 @@ proc genConstSeq(p: BProc, n: PNode, t: PType): PRope = result = ropef("(($1)&$2)", [getTypeDesc(p.module, t), result]) proc genConstExpr(p: BProc, n: PNode): PRope = - case n.Kind + case n.kind of nkHiddenStdConv, nkHiddenSubConv: result = genConstExpr(p, n.sons[1]) of nkCurly: diff --git a/compiler/ccgmerge.nim b/compiler/ccgmerge.nim index c6c294b97..5b04f1358 100644 --- a/compiler/ccgmerge.nim +++ b/compiler/ccgmerge.nim @@ -108,7 +108,7 @@ proc genMergeInfo*(m: BModule): PRope = s.add("labels:") encodeVInt(m.labels, s) s.add(" hasframe:") - encodeVInt(ord(m.FrameDeclared), s) + encodeVInt(ord(m.frameDeclared), s) s.add(tnl) s.add("*/") result = s.toRope @@ -119,8 +119,8 @@ proc skipWhite(L: var TBaseLexer) = var pos = L.bufpos while true: case ^pos - of CR: pos = nimlexbase.HandleCR(L, pos) - of LF: pos = nimlexbase.HandleLF(L, pos) + of CR: pos = nimlexbase.handleCR(L, pos) + of LF: pos = nimlexbase.handleLF(L, pos) of ' ': inc pos else: break L.bufpos = pos @@ -129,8 +129,8 @@ proc skipUntilCmd(L: var TBaseLexer) = var pos = L.bufpos while true: case ^pos - of CR: pos = nimlexbase.HandleCR(L, pos) - of LF: pos = nimlexbase.HandleLF(L, pos) + of CR: pos = nimlexbase.handleCR(L, pos) + of LF: pos = nimlexbase.handleLF(L, pos) of '\0': break of '/': if ^(pos+1) == '*' and ^(pos+2) == '\t': @@ -179,15 +179,15 @@ proc readVerbatimSection(L: var TBaseLexer): PRope = while true: case buf[pos] of CR: - pos = nimlexbase.HandleCR(L, pos) + pos = nimlexbase.handleCR(L, pos) buf = L.buf r.add(tnl) of LF: - pos = nimlexbase.HandleLF(L, pos) + pos = nimlexbase.handleLF(L, pos) buf = L.buf r.add(tnl) of '\0': - InternalError("ccgmerge: expected: " & NimMergeEndMark) + internalError("ccgmerge: expected: " & NimMergeEndMark) break else: if atEndMark(buf, pos): @@ -208,7 +208,7 @@ proc readKey(L: var TBaseLexer, result: var string) = if buf[pos] != ':': internalError("ccgmerge: ':' expected") L.bufpos = pos + 1 # skip ':' -proc NewFakeType(id: int): PType = +proc newFakeType(id: int): PType = new(result) result.id = id @@ -224,7 +224,7 @@ proc readTypeCache(L: var TBaseLexer, result: var TIdTable) = # XXX little hack: we create a "fake" type object with the correct Id # better would be to adapt the data structure to not even store the # object as key, but only the Id - IdTablePut(result, newFakeType(key), value.toRope) + idTablePut(result, newFakeType(key), value.toRope) inc L.bufpos proc readIntSet(L: var TBaseLexer, result: var TIntSet) = @@ -249,14 +249,14 @@ proc processMergeInfo(L: var TBaseLexer, m: BModule) = of "declared": readIntSet(L, m.declaredThings) of "typeInfo": readIntSet(L, m.typeInfoMarker) of "labels": m.labels = decodeVInt(L.buf, L.bufpos) - of "hasframe": m.FrameDeclared = decodeVInt(L.buf, L.bufpos) != 0 - else: InternalError("ccgmerge: unkown key: " & k) + of "hasframe": m.frameDeclared = decodeVInt(L.buf, L.bufpos) != 0 + else: internalError("ccgmerge: unkown key: " & k) when not defined(nimhygiene): {.pragma: inject.} template withCFile(cfilename: string, body: stmt) {.immediate.} = - var s = LLStreamOpen(cfilename, fmRead) + var s = llStreamOpen(cfilename, fmRead) if s == nil: return var L {.inject.}: TBaseLexer openBaseLexer(L, s) @@ -285,7 +285,7 @@ proc readMergeSections(cfilename: string, m: var TMergeSections) = withCFile(cfilename): readKey(L, k) if k == "NIM_merge_INFO": - nil + discard elif ^L.bufpos == '*' and ^(L.bufpos+1) == '/': inc(L.bufpos, 2) # read back into section @@ -300,9 +300,9 @@ proc readMergeSections(cfilename: string, m: var TMergeSections) = if sectionB >= 0 and sectionB <= high(TCProcSection).int: m.p[TCProcSection(sectionB)] = verbatim else: - InternalError("ccgmerge: unknown section: " & k) + internalError("ccgmerge: unknown section: " & k) else: - InternalError("ccgmerge: '*/' expected") + internalError("ccgmerge: '*/' expected") proc mergeRequired*(m: BModule): bool = for i in cfsHeaders..cfsProcs: @@ -323,4 +323,3 @@ proc mergeFiles*(cfilename: string, m: BModule) = m.s[i] = con(old.f[i], m.s[i]) for i in low(TCProcSection)..high(TCProcSection): m.initProc.s(i) = con(old.p[i], m.initProc.s(i)) - diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 75cabf414..af0d657f1 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -16,7 +16,7 @@ const # above X strings a hash-switch for strings is generated proc registerGcRoot(p: BProc, v: PSym) = - if gSelectedGc in {gcMarkAndSweep, gcGenerational} and + if gSelectedGC in {gcMarkAndSweep, gcGenerational} and containsGarbageCollectedRef(v.loc.t): # we register a specialized marked proc here; this has the advantage # that it works out of the box for thread local storage then :-) @@ -26,7 +26,7 @@ proc registerGcRoot(p: BProc, v: PSym) = proc genVarTuple(p: BProc, n: PNode) = var tup, field: TLoc - if n.kind != nkVarTuple: InternalError(n.info, "genVarTuple") + if n.kind != nkVarTuple: internalError(n.info, "genVarTuple") var L = sonsLen(n) genLineDir(p, n) initLocExpr(p, n.sons[L-1], tup) @@ -45,7 +45,7 @@ proc genVarTuple(p: BProc, n: PNode) = if t.kind == tyTuple: field.r = ropef("$1.Field$2", [rdLoc(tup), toRope(i)]) else: - if t.n.sons[i].kind != nkSym: InternalError(n.info, "genVarTuple") + if t.n.sons[i].kind != nkSym: internalError(n.info, "genVarTuple") field.r = ropef("$1.$2", [rdLoc(tup), mangleRecFieldName(t.n.sons[i].sym, t)]) putLocIntoDest(p, v.loc, field) @@ -62,7 +62,7 @@ proc startBlock(p: BProc, start: TFormatStr = "{$n", lineCg(p, cpsStmts, start, args) inc(p.labels) result = len(p.blocks) - setlen(p.blocks, result + 1) + setLen(p.blocks, result + 1) p.blocks[result].id = p.labels p.blocks[result].nestedTryStmts = p.nestedTryStmts.len.int16 @@ -81,7 +81,7 @@ proc endBlock(p: BProc, blockEnd: PRope) = let topBlock = p.blocks.len-1 # the block is merged into the parent block app(p.blocks[topBlock-1].sections[cpsStmts], p.blocks[topBlock].blockBody) - setlen(p.blocks, topBlock) + setLen(p.blocks, topBlock) # this is done after the block is popped so $n is # properly indented when pretty printing is enabled line(p, cpsStmts, blockEnd) @@ -126,7 +126,7 @@ proc genGotoState(p: BProc, n: PNode) = var a: TLoc initLocExpr(p, n.sons[0], a) lineF(p, cpsStmts, "switch ($1) {$n", [rdLoc(a)]) - p.BeforeRetNeeded = true + p.beforeRetNeeded = true lineF(p, cpsStmts, "case -1: goto BeforeRet;$n", []) for i in 0 .. lastOrd(n.sons[0].typ): lineF(p, cpsStmts, "case $1: goto STATE$1;$n", [toRope(i)]) @@ -200,7 +200,7 @@ proc genConstStmt(p: BProc, t: PNode) = for i in countup(0, sonsLen(t) - 1): var it = t.sons[i] if it.kind == nkCommentStmt: continue - if it.kind != nkConstDef: InternalError(t.info, "genConstStmt") + if it.kind != nkConstDef: internalError(t.info, "genConstStmt") var c = it.sons[0].sym if c.typ.containsCompileTimeOnly: continue if sfFakeConst in c.flags: @@ -232,33 +232,33 @@ proc genIf(p: BProc, n: PNode, d: var TLoc) = # Lend: var a: TLoc - Lelse: TLabel + lelse: TLabel if not isEmptyType(n.typ) and d.k == locNone: getTemp(p, n.typ, d) genLineDir(p, n) - let Lend = getLabel(p) + let lend = getLabel(p) for i in countup(0, sonsLen(n) - 1): let it = n.sons[i] if it.len == 2: when newScopeForIf: startBlock(p) initLocExpr(p, it.sons[0], a) - Lelse = getLabel(p) + lelse = getLabel(p) inc(p.labels) lineFF(p, cpsStmts, "if (!$1) goto $2;$n", "br i1 $1, label %LOC$3, label %$2$nLOC$3: $n", - [rdLoc(a), Lelse, toRope(p.labels)]) + [rdLoc(a), lelse, toRope(p.labels)]) when not newScopeForIf: startBlock(p) expr(p, it.sons[1], d) endBlock(p) if sonsLen(n) > 1: - lineFF(p, cpsStmts, "goto $1;$n", "br label %$1$n", [Lend]) - fixLabel(p, Lelse) + lineFF(p, cpsStmts, "goto $1;$n", "br label %$1$n", [lend]) + fixLabel(p, lelse) elif it.len == 1: startBlock(p) expr(p, it.sons[0], d) endBlock(p) else: internalError(n.info, "genIf()") - if sonsLen(n) > 1: fixLabel(p, Lend) + if sonsLen(n) > 1: fixLabel(p, lend) proc blockLeaveActions(p: BProc, howMany: int) = var L = p.nestedTryStmts.len @@ -296,7 +296,7 @@ proc genReturnStmt(p: BProc, t: PNode) = proc genComputedGoto(p: BProc; n: PNode) = # first pass: Generate array of computed labels: var casePos = -1 - var arraySize: Int + var arraySize: int for i in 0 .. <n.len: let it = n.sons[i] if it.kind == nkCaseStmt: @@ -322,8 +322,20 @@ proc genComputedGoto(p: BProc; n: PNode) = gotoArray.appf("&&TMP$#, ", (id+i).toRope) gotoArray.appf("&&TMP$#};$n", (id+arraySize).toRope) line(p, cpsLocals, gotoArray) + + let topBlock = p.blocks.len-1 + let oldBody = p.blocks[topBlock].sections[cpsStmts] + p.blocks[topBlock].sections[cpsStmts] = nil + for j in casePos+1 .. <n.len: genStmts(p, n.sons[j]) + let tailB = p.blocks[topBlock].sections[cpsStmts] + + p.blocks[topBlock].sections[cpsStmts] = nil for j in 0 .. casePos-1: genStmts(p, n.sons[j]) + let tailA = p.blocks[topBlock].sections[cpsStmts] + + p.blocks[topBlock].sections[cpsStmts] = oldBody.con(tailA) + let caseStmt = n.sons[casePos] var a: TLoc initLocExpr(p, caseStmt.sons[0], a) @@ -340,8 +352,11 @@ proc genComputedGoto(p: BProc; n: PNode) = let val = getOrdValue(it.sons[j]) lineF(p, cpsStmts, "TMP$#:$n", intLiteral(val+id+1)) genStmts(p, it.lastSon) - for j in casePos+1 .. <n.len: genStmts(p, n.sons[j]) - for j in 0 .. casePos-1: genStmts(p, n.sons[j]) + #for j in casePos+1 .. <n.len: genStmts(p, n.sons[j]) # tailB + #for j in 0 .. casePos-1: genStmts(p, n.sons[j]) # tailA + app(p.s(cpsStmts), tailB) + app(p.s(cpsStmts), tailA) + var a: TLoc initLocExpr(p, caseStmt.sons[0], a) lineF(p, cpsStmts, "goto *$#[$#];$n", tmp, a.rdLoc) @@ -352,7 +367,7 @@ proc genWhileStmt(p: BProc, t: PNode) = # significantly worse code var a: TLoc - Labl: TLabel + labl: TLabel assert(sonsLen(t) == 2) inc(p.withinLoop) genLineDir(p, t) @@ -366,7 +381,7 @@ proc genWhileStmt(p: BProc, t: PNode) = lineF(p, cpsStmts, "if (!$1) goto $2;$n", [rdLoc(a), label]) var loopBody = t.sons[1] if loopBody.stmtsContainPragma(wComputedGoto) and - hasComputedGoto in CC[ccompiler].props: + hasComputedGoto in CC[cCompiler].props: # for closure support weird loop bodies are generated: if loopBody.len == 2 and loopBody.sons[0].kind == nkEmpty: loopBody = loopBody.sons[1] @@ -401,7 +416,7 @@ proc genParForStmt(p: BProc, t: PNode) = preserveBreakIdx: let forLoopVar = t.sons[0].sym var rangeA, rangeB: TLoc - assignLocalVar(P, forLoopVar) + assignLocalVar(p, forLoopVar) #initLoc(forLoopVar.loc, locLocalVar, forLoopVar.typ, onStack) #discard mangleName(forLoopVar) let call = t.sons[1] @@ -433,7 +448,7 @@ proc genBreakStmt(p: BProc, t: PNode) = # an unnamed 'break' can only break a loop after 'transf' pass: while idx >= 0 and not p.blocks[idx].isLoop: dec idx if idx < 0 or not p.blocks[idx].isLoop: - InternalError(t.info, "no loop to break") + internalError(t.info, "no loop to break") let label = assignLabel(p.blocks[idx]) blockLeaveActions(p, p.nestedTryStmts.len - p.blocks[idx].nestedTryStmts) genLineDir(p, t) @@ -454,7 +469,7 @@ proc genRaiseStmt(p: BProc, t: PNode) = genSimpleBlock(p, finallyBlock.sons[0]) if t.sons[0].kind != nkEmpty: var a: TLoc - InitLocExpr(p, t.sons[0], a) + initLocExpr(p, t.sons[0], a) var e = rdLoc(a) var typ = skipTypes(t.sons[0].typ, abstractPtrs) genLineDir(p, t) @@ -484,16 +499,16 @@ proc genCaseGenericBranch(p: BProc, b: PNode, e: TLoc, proc genCaseSecondPass(p: BProc, t: PNode, d: var TLoc, labId, until: int): TLabel = - var Lend = getLabel(p) + var lend = getLabel(p) for i in 1..until: lineF(p, cpsStmts, "LA$1: ;$n", [toRope(labId + i)]) if t.sons[i].kind == nkOfBranch: var length = sonsLen(t.sons[i]) exprBlock(p, t.sons[i].sons[length - 1], d) - lineF(p, cpsStmts, "goto $1;$n", [Lend]) + lineF(p, cpsStmts, "goto $1;$n", [lend]) else: exprBlock(p, t.sons[i].sons[0], d) - result = Lend + result = lend proc genIfForCaseUntil(p: BProc, t: PNode, d: var TLoc, rangeFormat, eqFormat: TFormatStr, @@ -520,8 +535,8 @@ proc genCaseGeneric(p: BProc, t: PNode, d: var TLoc, rangeFormat, eqFormat: TFormatStr) = var a: TLoc initLocExpr(p, t.sons[0], a) - var Lend = genIfForCaseUntil(p, t, d, rangeFormat, eqFormat, sonsLen(t)-1, a) - fixLabel(p, Lend) + var lend = genIfForCaseUntil(p, t, d, rangeFormat, eqFormat, sonsLen(t)-1, a) + fixLabel(p, lend) proc genCaseStringBranch(p: BProc, b: PNode, e: TLoc, labl: TLabel, branches: var openArray[PRope]) = @@ -565,25 +580,25 @@ proc genStringCase(p: BProc, t: PNode, d: var TLoc) = if t.sons[sonsLen(t)-1].kind != nkOfBranch: lineF(p, cpsStmts, "goto LA$1;$n", [toRope(p.labels)]) # third pass: generate statements - var Lend = genCaseSecondPass(p, t, d, labId, sonsLen(t)-1) - fixLabel(p, Lend) + var lend = genCaseSecondPass(p, t, d, labId, sonsLen(t)-1) + fixLabel(p, lend) else: genCaseGeneric(p, t, d, "", "if (#eqStrings($1, $2)) goto $3;$n") proc branchHasTooBigRange(b: PNode): bool = for i in countup(0, sonsLen(b)-2): # last son is block - if (b.sons[i].Kind == nkRange) and + if (b.sons[i].kind == nkRange) and b.sons[i].sons[1].intVal - b.sons[i].sons[0].intVal > RangeExpandLimit: return true -proc IfSwitchSplitPoint(p: BProc, n: PNode): int = +proc ifSwitchSplitPoint(p: BProc, n: PNode): int = for i in 1..n.len-1: var branch = n[i] var stmtBlock = lastSon(branch) if stmtBlock.stmtsContainPragma(wLinearScanEnd): result = i - elif hasSwitchRange notin CC[ccompiler].props: + elif hasSwitchRange notin CC[cCompiler].props: if branch.kind == nkOfBranch and branchHasTooBigRange(branch): result = i @@ -591,7 +606,7 @@ proc genCaseRange(p: BProc, branch: PNode) = var length = branch.len for j in 0 .. length-2: if branch[j].kind == nkRange: - if hasSwitchRange in CC[ccompiler].props: + if hasSwitchRange in CC[cCompiler].props: lineF(p, cpsStmts, "case $1 ... $2:$n", [ genLiteral(p, branch[j][0]), genLiteral(p, branch[j][1])]) @@ -599,18 +614,18 @@ proc genCaseRange(p: BProc, branch: PNode) = var v = copyNode(branch[j][0]) while v.intVal <= branch[j][1].intVal: lineF(p, cpsStmts, "case $1:$n", [genLiteral(p, v)]) - Inc(v.intVal) + inc(v.intVal) else: lineF(p, cpsStmts, "case $1:$n", [genLiteral(p, branch[j])]) proc genOrdinalCase(p: BProc, n: PNode, d: var TLoc) = # analyse 'case' statement: - var splitPoint = IfSwitchSplitPoint(p, n) + var splitPoint = ifSwitchSplitPoint(p, n) # generate if part (might be empty): var a: TLoc initLocExpr(p, n.sons[0], a) - var Lend = if splitPoint > 0: genIfForCaseUntil(p, n, d, + var lend = if splitPoint > 0: genIfForCaseUntil(p, n, d, rangeFormat = "if ($1 >= $2 && $1 <= $3) goto $4;$n", eqFormat = "if ($1 == $2) goto $3;$n", splitPoint, a) else: nil @@ -629,10 +644,10 @@ proc genOrdinalCase(p: BProc, n: PNode, d: var TLoc) = hasDefault = true exprBlock(p, branch.lastSon, d) lineF(p, cpsStmts, "break;$n") - if (hasAssume in CC[ccompiler].props) and not hasDefault: + if (hasAssume in CC[cCompiler].props) and not hasDefault: lineF(p, cpsStmts, "default: __assume(0);$n") lineF(p, cpsStmts, "}$n") - if Lend != nil: fixLabel(p, Lend) + if lend != nil: fixLabel(p, lend) proc genCase(p: BProc, t: PNode, d: var TLoc) = genLineDir(p, t) @@ -691,7 +706,7 @@ proc genTryCpp(p: BProc, t: PNode, d: var TLoc) = expr(p, t.sons[0], d) length = sonsLen(t) endBlock(p, ropecg(p.module, "} catch (NimException& $1) {$n", [exc])) - if optStackTrace in p.Options: + if optStackTrace in p.options: linefmt(p, cpsStmts, "#setFrame((TFrame*)&F);$n") inc p.inExceptBlock i = 1 @@ -764,7 +779,7 @@ proc genTry(p: BProc, t: PNode, d: var TLoc) = # if not isEmptyType(t.typ) and d.k == locNone: getTemp(p, t.typ, d) - discard lists.IncludeStr(p.module.headerFiles, "<setjmp.h>") + discard lists.includeStr(p.module.headerFiles, "<setjmp.h>") genLineDir(p, t) var safePoint = getTempName() discard cgsym(p.module, "E_Base") @@ -779,7 +794,7 @@ proc genTry(p: BProc, t: PNode, d: var TLoc) = endBlock(p) startBlock(p, "else {$n") linefmt(p, cpsStmts, "#popSafePoint();$n") - if optStackTrace in p.Options: + if optStackTrace in p.options: linefmt(p, cpsStmts, "#setFrame((TFrame*)&F);$n") inc p.inExceptBlock var i = 1 @@ -818,7 +833,7 @@ proc genTry(p: BProc, t: PNode, d: var TLoc) = proc genAsmOrEmitStmt(p: BProc, t: PNode, isAsmStmt=false): PRope = var res = "" for i in countup(0, sonsLen(t) - 1): - case t.sons[i].Kind + case t.sons[i].kind of nkStrLit..nkTripleStrLit: res.add(t.sons[i].strVal) of nkSym: @@ -835,9 +850,9 @@ proc genAsmOrEmitStmt(p: BProc, t: PNode, isAsmStmt=false): PRope = r = mangleName(sym) sym.loc.r = r # but be consequent! res.add(r.ropeToStr) - else: InternalError(t.sons[i].info, "genAsmOrEmitStmt()") + else: internalError(t.sons[i].info, "genAsmOrEmitStmt()") - if isAsmStmt and hasGnuAsm in CC[ccompiler].props: + if isAsmStmt and hasGnuAsm in CC[cCompiler].props: for x in splitLines(res): var j = 0 while x[j] in {' ', '\t'}: inc(j) @@ -858,9 +873,9 @@ proc genAsmStmt(p: BProc, t: PNode) = var s = genAsmOrEmitStmt(p, t, isAsmStmt=true) if p.prc == nil: # top level asm statement? - appf(p.module.s[cfsProcHeaders], CC[ccompiler].asmStmtFrmt, [s]) + appf(p.module.s[cfsProcHeaders], CC[cCompiler].asmStmtFrmt, [s]) else: - lineF(p, cpsStmts, CC[ccompiler].asmStmtFrmt, [s]) + lineF(p, cpsStmts, CC[cCompiler].asmStmtFrmt, [s]) proc genEmit(p: BProc, t: PNode) = genLineDir(p, t) @@ -877,7 +892,7 @@ var proc genBreakPoint(p: BProc, t: PNode) = var name: string - if optEndb in p.Options: + if optEndb in p.options: if t.kind == nkExprColonExpr: assert(t.sons[1].kind in {nkStrLit..nkTripleStrLit}) name = normalize(t.sons[1].strVal) @@ -891,7 +906,7 @@ proc genBreakPoint(p: BProc, t: PNode) = makeCString(name)]) proc genWatchpoint(p: BProc, n: PNode) = - if optEndb notin p.Options: return + if optEndb notin p.options: return var a: TLoc initLocExpr(p, n.sons[1], a) let typ = skipTypes(n.sons[1].typ, abstractVarRange) @@ -905,10 +920,15 @@ proc genPragma(p: BProc, n: PNode) = case whichPragma(it) of wEmit: genEmit(p, it) of wBreakpoint: genBreakPoint(p, it) - of wWatchpoint: genWatchpoint(p, it) - else: nil - -proc FieldDiscriminantCheckNeeded(p: BProc, asgn: PNode): bool = + of wWatchPoint: genWatchpoint(p, it) + of wInjectStmt: + var p = newProc(nil, p.module) + p.options = p.options - {optLineTrace, optStackTrace} + genStmts(p, it.sons[1]) + p.module.injectStmt = p.s(cpsStmts) + else: discard + +proc fieldDiscriminantCheckNeeded(p: BProc, asgn: PNode): bool = if optFieldCheck in p.options: var le = asgn.sons[0] if le.kind == nkCheckedFieldExpr: @@ -924,7 +944,7 @@ proc genDiscriminantCheck(p: BProc, a, tmp: TLoc, objtype: PType, assert t.kind == tyObject discard genTypeInfo(p.module, t) var L = lengthOrd(field.typ) - if not ContainsOrIncl(p.module.declaredThings, field.id): + if not containsOrIncl(p.module.declaredThings, field.id): appcg(p.module, cfsVars, "extern $1", discriminatorTableDecl(p.module, t, field)) lineCg(p, cpsStmts, @@ -937,7 +957,7 @@ proc asgnFieldDiscriminant(p: BProc, e: PNode) = var dotExpr = e.sons[0] var d: PSym if dotExpr.kind == nkCheckedFieldExpr: dotExpr = dotExpr.sons[0] - InitLocExpr(p, e.sons[0], a) + initLocExpr(p, e.sons[0], a) getTemp(p, a.t, tmp) expr(p, e.sons[1], tmp) genDiscriminantCheck(p, a, tmp, dotExpr.sons[0].typ, dotExpr.sons[1].sym) @@ -945,9 +965,9 @@ proc asgnFieldDiscriminant(p: BProc, e: PNode) = proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) = genLineDir(p, e) - if not FieldDiscriminantCheckNeeded(p, e): + if not fieldDiscriminantCheckNeeded(p, e): var a: TLoc - InitLocExpr(p, e.sons[0], a) + initLocExpr(p, e.sons[0], a) if fastAsgn: incl(a.flags, lfNoDeepCopy) assert(a.t != nil) loadInto(p, e.sons[0], e.sons[1], a) @@ -957,4 +977,4 @@ proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) = proc genStmts(p: BProc, t: PNode) = var a: TLoc expr(p, t, a) - InternalAssert a.k in {locNone, locTemp, locLocalVar} + internalAssert a.k in {locNone, locTemp, locLocalVar} diff --git a/compiler/ccgthreadvars.nim b/compiler/ccgthreadvars.nim index d312ea027..c00b931ef 100644 --- a/compiler/ccgthreadvars.nim +++ b/compiler/ccgthreadvars.nim @@ -16,8 +16,8 @@ proc emulatedThreadVars(): bool = result = {optThreads, optTlsEmulation} <= gGlobalOptions proc accessThreadLocalVar(p: BProc, s: PSym) = - if emulatedThreadVars() and not p.ThreadVarAccessed: - p.ThreadVarAccessed = true + if emulatedThreadVars() and not p.threadVarAccessed: + p.threadVarAccessed = true p.module.usesThreadVars = true appf(p.procSec(cpsLocals), "\tNimThreadVars* NimTV;$n") app(p.procSec(cpsInit), @@ -55,7 +55,7 @@ proc generateThreadLocalStorage(m: BModule) = for t in items(nimtvDeps): discard getTypeDesc(m, t) appf(m.s[cfsSeqTypes], "typedef struct {$1} NimThreadVars;$n", [nimtv]) -proc GenerateThreadVarsSize(m: BModule) = +proc generateThreadVarsSize(m: BModule) = if nimtv != nil: app(m.s[cfsProcs], "NI NimThreadVarsSize(){return (NI)sizeof(NimThreadVars);}" & tnl) diff --git a/compiler/ccgtrav.nim b/compiler/ccgtrav.nim index 9534eae91..26f474659 100644 --- a/compiler/ccgtrav.nim +++ b/compiler/ccgtrav.nim @@ -28,7 +28,7 @@ proc genTraverseProc(c: var TTraversalClosure, accessor: PRope, n: PNode) = for i in countup(0, sonsLen(n) - 1): genTraverseProc(c, accessor, n.sons[i]) of nkRecCase: - if (n.sons[0].kind != nkSym): InternalError(n.info, "genTraverseProc") + if (n.sons[0].kind != nkSym): internalError(n.info, "genTraverseProc") var p = c.p let disc = n.sons[0].sym lineF(p, cpsStmts, "switch ($1.$2) {$n", accessor, disc.loc.r) @@ -74,7 +74,7 @@ proc genTraverseProc(c: var TTraversalClosure, accessor: PRope, typ: PType) = genTraverseProc(c, accessor.parentObj, typ.sons[i]) if typ.n != nil: genTraverseProc(c, accessor, typ.n) of tyTuple: - let typ = GetUniqueType(typ) + let typ = getUniqueType(typ) for i in countup(0, sonsLen(typ) - 1): genTraverseProc(c, rfmt(nil, "$1.Field$2", accessor, i.toRope), typ.sons[i]) of tyRef, tyString, tySequence: @@ -83,7 +83,7 @@ proc genTraverseProc(c: var TTraversalClosure, accessor: PRope, typ: PType) = if typ.callConv == ccClosure: lineCg(p, cpsStmts, c.visitorFrmt, rfmt(nil, "$1.ClEnv", accessor)) else: - nil + discard proc genTraverseProcSeq(c: var TTraversalClosure, accessor: PRope, typ: PType) = var p = c.p @@ -111,7 +111,7 @@ proc genTraverseProc(m: BModule, typ: PType, reason: TTypeInfoReason): PRope = lineF(p, cpsInit, "a = ($1)p;$n", t) c.p = p - assert typ.kind != tyTypedesc + assert typ.kind != tyTypeDesc if typ.kind == tySequence: genTraverseProcSeq(c, "a".toRope, typ) else: diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 4548ac641..c92c15fa9 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -25,7 +25,7 @@ proc mangleField(name: string): string = of 'A'..'Z': add(result, chr(ord(name[i]) - ord('A') + ord('a'))) of '_': - nil + discard of 'a'..'z', '0'..'9': add(result, name[i]) else: @@ -48,7 +48,7 @@ proc mangle(name: string): string = of 'A'..'Z': add(result, chr(ord(name[i]) - ord('A') + ord('a'))) of '_': - nil + discard of 'a'..'z', '0'..'9': add(result, name[i]) else: @@ -76,7 +76,7 @@ proc mangleName(s: PSym): PRope = else: result = ~"%" of skTemp, skParam, skType, skEnumField, skModule: result = ~"%" - else: InternalError(s.info, "mangleName") + else: internalError(s.info, "mangleName") when oKeepVariableNames: let keepOrigName = s.kind in skLocalVars - {skForVar} and {sfFromGeneric, sfGlobal, sfShadowed, sfGenSym} * s.flags == {} and @@ -150,7 +150,7 @@ proc getTypeName(typ: PType): PRope = typ.loc.r = if gCmd != cmdCompileToLLVM: con(typ.typeName, typ.id.toRope) else: con([~"%", typ.typeName, typ.id.toRope]) result = typ.loc.r - if result == nil: InternalError("getTypeName: " & $typ.kind) + if result == nil: internalError("getTypeName: " & $typ.kind) proc mapSetType(typ: PType): TCTypeKind = case int(getSize(typ)) @@ -194,7 +194,7 @@ proc mapType(typ: PType): TCTypeKind = of tyCString: result = ctCString of tyInt..tyUInt64: result = TCTypeKind(ord(typ.kind) - ord(tyInt) + ord(ctInt)) - else: InternalError("mapType") + else: internalError("mapType") proc mapReturnType(typ: PType): TCTypeKind = if skipTypes(typ, typedescInst).kind == tyArray: result = ctPtr @@ -229,11 +229,11 @@ const "stdcall $1", "ccc $1", "safecall $1", "syscall $1", "$1 alwaysinline", "$1 noinline", "fastcc $1", "ccc $1", "$1"] -proc CacheGetType(tab: TIdTable, key: PType): PRope = +proc cacheGetType(tab: TIdTable, key: PType): PRope = # returns nil if we need to declare this type # since types are now unique via the ``GetUniqueType`` mechanism, this slow # linear search is not necessary anymore: - result = PRope(IdTableGet(tab, key)) + result = PRope(idTableGet(tab, key)) proc getTempName(): PRope = result = rfmt(nil, "TMP$1", toRope(backendId())) @@ -246,7 +246,7 @@ proc ccgIntroducedPtr(s: PSym): bool = assert skResult != s.kind if tfByRef in pt.flags: return true elif tfByCopy in pt.flags: return false - case pt.Kind + case pt.kind of tyObject: if (optByRef in s.options) or (getSize(pt) > platform.floatSize * 2): result = true # requested anyway @@ -262,7 +262,7 @@ proc ccgIntroducedPtr(s: PSym): bool = proc fillResult(param: PSym) = fillLoc(param.loc, locParam, param.typ, ~"Result", OnStack) - if (mapReturnType(param.typ) != ctArray) and IsInvalidReturnType(param.typ): + if (mapReturnType(param.typ) != ctArray) and isInvalidReturnType(param.typ): incl(param.loc.flags, lfIndirect) param.loc.s = OnUnknown @@ -288,7 +288,7 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var PRope, else: rettype = getTypeDescAux(m, t.sons[0], check) for i in countup(1, sonsLen(t.n) - 1): - if t.n.sons[i].kind != nkSym: InternalError(t.n.info, "genProcParams") + if t.n.sons[i].kind != nkSym: internalError(t.n.info, "genProcParams") var param = t.n.sons[i].sym if isCompileTimeOnly(param.typ): continue if params != nil: app(params, ~", ") @@ -305,7 +305,7 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var PRope, var arr = param.typ if arr.kind == tyVar: arr = arr.sons[0] var j = 0 - while arr.Kind in {tyOpenArray, tyVarargs}: + while arr.kind in {tyOpenArray, tyVarargs}: # this fixes the 'sort' bug: if param.typ.kind == tyVar: param.loc.s = OnUnknown # need to pass hidden parameter: @@ -344,7 +344,7 @@ proc getSimpleTypeDesc(m: BModule, typ: PType): PRope = "NI", "NI8", "NI16", "NI32", "NI64", "NF", "NF32", "NF64", "NF128", "NU", "NU8", "NU16", "NU32", "NU64",] - case typ.Kind + case typ.kind of tyPointer: result = typeNameOrLiteral(typ, "void*") of tyEnum: @@ -362,12 +362,12 @@ proc getSimpleTypeDesc(m: BModule, typ: PType): PRope = of tyString: discard cgsym(m, "NimStringDesc") result = typeNameOrLiteral(typ, "NimStringDesc*") - of tyCstring: result = typeNameOrLiteral(typ, "NCSTRING") + of tyCString: result = typeNameOrLiteral(typ, "NCSTRING") of tyBool: result = typeNameOrLiteral(typ, "NIM_BOOL") of tyChar: result = typeNameOrLiteral(typ, "NIM_CHAR") of tyNil: result = typeNameOrLiteral(typ, "0") of tyInt..tyUInt64: - result = typeNameOrLiteral(typ, NumericalTypeToStr[typ.Kind]) + result = typeNameOrLiteral(typ, NumericalTypeToStr[typ.kind]) of tyRange: result = getSimpleTypeDesc(m, typ.sons[0]) else: result = nil @@ -375,14 +375,14 @@ proc getTypePre(m: BModule, typ: PType): PRope = if typ == nil: result = toRope("void") else: result = getSimpleTypeDesc(m, typ) - if result == nil: result = CacheGetType(m.typeCache, typ) + if result == nil: result = cacheGetType(m.typeCache, typ) proc getForwardStructFormat(): string = if gCmd == cmdCompileToCpp: result = "struct $1;$n" else: result = "typedef struct $1 $1;$n" proc getTypeForward(m: BModule, typ: PType): PRope = - result = CacheGetType(m.forwTypeCache, typ) + result = cacheGetType(m.forwTypeCache, typ) if result != nil: return result = getTypePre(m, typ) if result != nil: return @@ -391,8 +391,8 @@ proc getTypeForward(m: BModule, typ: PType): PRope = result = getTypeName(typ) if not isImportedType(typ): appf(m.s[cfsForwardTypes], getForwardStructFormat(), [result]) - IdTablePut(m.forwTypeCache, typ, result) - else: InternalError("getTypeForward(" & $typ.kind & ')') + idTablePut(m.forwTypeCache, typ, result) + else: internalError("getTypeForward(" & $typ.kind & ')') proc mangleRecFieldName(field: PSym, rectype: PType): PRope = if (rectype.sym != nil) and @@ -400,7 +400,7 @@ proc mangleRecFieldName(field: PSym, rectype: PType): PRope = result = field.loc.r else: result = toRope(mangleField(field.name.s)) - if result == nil: InternalError(field.info, "mangleRecFieldName") + if result == nil: internalError(field.info, "mangleRecFieldName") proc genRecordFieldsAux(m: BModule, n: PNode, accessExpr: PRope, rectype: PType, @@ -415,7 +415,7 @@ proc genRecordFieldsAux(m: BModule, n: PNode, for i in countup(0, sonsLen(n) - 1): app(result, genRecordFieldsAux(m, n.sons[i], accessExpr, rectype, check)) of nkRecCase: - if (n.sons[0].kind != nkSym): InternalError(n.info, "genRecordFieldsAux") + if (n.sons[0].kind != nkSym): internalError(n.info, "genRecordFieldsAux") app(result, genRecordFieldsAux(m, n.sons[0], accessExpr, rectype, check)) uname = toRope(mangle(n.sons[0].sym.name.s) & 'U') if accessExpr != nil: ae = ropef("$1.$2", [accessExpr, uname]) @@ -497,49 +497,49 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var TIntSet): PRope = # returns only the type's name var name, rettype, desc, recdesc: PRope - n: biggestInt + n: BiggestInt t, et: PType t = getUniqueType(typ) - if t == nil: InternalError("getTypeDescAux: t == nil") + if t == nil: internalError("getTypeDescAux: t == nil") if t.sym != nil: useHeader(m, t.sym) result = getTypePre(m, t) if result != nil: return - if ContainsOrIncl(check, t.id): - InternalError("cannot generate C type for: " & typeToString(typ)) + if containsOrIncl(check, t.id): + internalError("cannot generate C type for: " & typeToString(typ)) # XXX: this BUG is hard to fix -> we need to introduce helper structs, # but determining when this needs to be done is hard. We should split # C type generation into an analysis and a code generation phase somehow. - case t.Kind + case t.kind of tyRef, tyPtr, tyVar: et = getUniqueType(t.sons[0]) if et.kind in {tyArrayConstr, tyArray, tyOpenArray, tyVarargs}: # this is correct! sets have no proper base type, so we treat # ``var set[char]`` in `getParamTypeDesc` et = getUniqueType(elemType(et)) - case et.Kind + case et.kind of tyObject, tyTuple: # no restriction! We have a forward declaration for structs name = getTypeForward(m, et) result = con(name, "*") - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) pushType(m, et) of tySequence: # no restriction! We have a forward declaration for structs name = getTypeForward(m, et) result = con(name, "**") - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) pushType(m, et) else: # else we have a strong dependency :-( result = con(getTypeDescAux(m, et, check), "*") - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) of tyOpenArray, tyVarargs: et = getUniqueType(t.sons[0]) result = con(getTypeDescAux(m, et, check), "*") - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) of tyProc: result = getTypeName(t) - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) genProcParams(m, t, rettype, desc, check) if not isImportedType(t): if t.callConv != ccClosure: # procedure vars may need a closure! @@ -553,14 +553,14 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var TIntSet): PRope = of tySequence: # we cannot use getTypeForward here because then t would be associated # with the name of the struct, not with the pointer to the struct: - result = CacheGetType(m.forwTypeCache, t) + result = cacheGetType(m.forwTypeCache, t) if result == nil: result = getTypeName(t) if not isImportedType(t): appf(m.s[cfsForwardTypes], getForwardStructFormat(), [result]) - IdTablePut(m.forwTypeCache, t, result) - assert(CacheGetType(m.typeCache, t) == nil) - IdTablePut(m.typeCache, t, con(result, "*")) + idTablePut(m.forwTypeCache, t, result) + assert(cacheGetType(m.typeCache, t) == nil) + idTablePut(m.typeCache, t, con(result, "*")) if not isImportedType(t): if skipTypes(t.sons[0], typedescInst).kind != tyEmpty: const @@ -579,18 +579,18 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var TIntSet): PRope = if n <= 0: n = 1 # make an array of at least one element result = getTypeName(t) - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) if not isImportedType(t): appf(m.s[cfsTypes], "typedef $1 $2[$3];$n", - [getTypeDescAux(m, t.sons[1], check), result, ToRope(n)]) + [getTypeDescAux(m, t.sons[1], check), result, toRope(n)]) of tyObject, tyTuple: - result = CacheGetType(m.forwTypeCache, t) + result = cacheGetType(m.forwTypeCache, t) if result == nil: result = getTypeName(t) if not isImportedType(t): appf(m.s[cfsForwardTypes], getForwardStructFormat(), [result]) - IdTablePut(m.forwTypeCache, t, result) - IdTablePut(m.typeCache, t, result) # always call for sideeffects: + idTablePut(m.forwTypeCache, t, result) + idTablePut(m.typeCache, t, result) # always call for sideeffects: if t.kind != tyTuple: recdesc = getRecordDesc(m, t, result, check) else: recdesc = getTupleDesc(m, t, result, check) if not isImportedType(t): app(m.s[cfsTypes], recdesc) @@ -602,7 +602,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var TIntSet): PRope = of 8: result = toRope("NU64") else: result = getTypeName(t) - IdTablePut(m.typeCache, t, result) + idTablePut(m.typeCache, t, result) if not isImportedType(t): appf(m.s[cfsTypes], "typedef NU8 $1[$2];$n", [result, toRope(getSize(t))]) @@ -610,7 +610,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var TIntSet): PRope = tyIter, tyTypeDesc: result = getTypeDescAux(m, lastSon(t), check) else: - InternalError("getTypeDescAux(" & $t.kind & ')') + internalError("getTypeDescAux(" & $t.kind & ')') result = nil # fixes bug #145: excl(check, t.id) @@ -737,10 +737,10 @@ proc discriminatorTableName(m: BModule, objtype: PType, d: PSym): PRope = var objtype = objtype while lookupInRecord(objtype.n, d.name) == nil: objtype = objtype.sons[0] - if objType.sym == nil: - InternalError(d.info, "anonymous obj with discriminator") + if objtype.sym == nil: + internalError(d.info, "anonymous obj with discriminator") result = ropef("NimDT_$1_$2", [ - toRope(objType.sym.name.s.mangle), toRope(d.name.s.mangle)]) + toRope(objtype.sym.name.s.mangle), toRope(d.name.s.mangle)]) proc discriminatorTableDecl(m: BModule, objtype: PType, d: PSym): PRope = discard cgsym(m, "TNimNode") @@ -911,7 +911,7 @@ include ccgtrav proc genTypeInfo(m: BModule, t: PType): PRope = var t = getUniqueType(t) result = ropef("NTI$1", [toRope(t.id)]) - if ContainsOrIncl(m.typeInfoMarker, t.id): + if containsOrIncl(m.typeInfoMarker, t.id): return con("(&".toRope, result, ")".toRope) let owner = t.skipTypes(typedescPtrs).owner.getModule if owner != m.module: @@ -948,8 +948,8 @@ proc genTypeInfo(m: BModule, t: PType): PRope = # BUGFIX: use consistently RTTI without proper field names; otherwise # results are not deterministic! genTupleInfo(m, t, result) - else: InternalError("genTypeInfo(" & $t.kind & ')') + else: internalError("genTypeInfo(" & $t.kind & ')') result = con("(&".toRope, result, ")".toRope) proc genTypeSection(m: BModule, n: PNode) = - nil + discard diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index c37754511..1129ecbef 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -22,19 +22,19 @@ proc getPragmaStmt*(n: PNode, w: TSpecialWord): PNode = of nkPragma: for i in 0 .. < n.len: if whichPragma(n[i]) == w: return n[i] - else: nil + else: discard proc stmtsContainPragma*(n: PNode, w: TSpecialWord): bool = result = getPragmaStmt(n, w) != nil -proc hashString*(s: string): biggestInt = +proc hashString*(s: string): BiggestInt = # has to be the same algorithm as system.hashString! if CPU[targetCPU].bit == 64: # we have to use the same bitwidth # as the target CPU var b = 0'i64 for i in countup(0, len(s) - 1): - b = b +% Ord(s[i]) + b = b +% ord(s[i]) b = b +% `shl`(b, 10) b = b xor `shr`(b, 6) b = b +% `shl`(b, 3) @@ -44,7 +44,7 @@ proc hashString*(s: string): biggestInt = else: var a = 0'i32 for i in countup(0, len(s) - 1): - a = a +% Ord(s[i]).int32 + a = a +% ord(s[i]).int32 a = a +% `shl`(a, 10'i32) a = a xor `shr`(a, 6'i32) a = a +% `shl`(a, 3'i32) @@ -57,7 +57,7 @@ var gCanonicalTypes: array[TTypeKind, PType] proc initTypeTables() = - for i in countup(low(TTypeKind), high(TTypeKind)): InitIdTable(gTypeTable[i]) + for i in countup(low(TTypeKind), high(TTypeKind)): initIdTable(gTypeTable[i]) proc resetCaches* = ## XXX: fix that more properly @@ -70,7 +70,7 @@ when false: for i in countup(low(TTypeKind), high(TTypeKind)): echo i, " ", gTypeTable[i].counter -proc GetUniqueType*(key: PType): PType = +proc getUniqueType*(key: PType): PType = # this is a hotspot in the compiler! if key == nil: return var k = key.kind @@ -86,12 +86,11 @@ proc GetUniqueType*(key: PType): PType = if result == nil: gCanonicalTypes[k] = key result = key - of tyTypeDesc, tyTypeClass: - InternalError("value expected, but got a type") - of tyGenericParam: - InternalError("GetUniqueType") + of tyTypeDesc, tyTypeClasses, tyGenericParam, + tyFromExpr, tyStatic, tyFieldAccessor: + internalError("GetUniqueType") of tyGenericInst, tyDistinct, tyOrdinal, tyMutable, tyConst, tyIter: - result = GetUniqueType(lastSon(key)) + result = getUniqueType(lastSon(key)) of tyArrayConstr, tyGenericInvokation, tyGenericBody, tyOpenArray, tyArray, tySet, tyRange, tyTuple, tyPtr, tyRef, tySequence, tyForward, tyVarargs, tyProxy, tyVar: @@ -102,33 +101,33 @@ proc GetUniqueType*(key: PType): PType = # we have to do a slow linear search because types may need # to be compared by their structure: - if IdTableHasObjectAsKey(gTypeTable[k], key): return key + if idTableHasObjectAsKey(gTypeTable[k], key): return key for h in countup(0, high(gTypeTable[k].data)): var t = PType(gTypeTable[k].data[h].key) if t != nil and sameBackendType(t, key): return t - IdTablePut(gTypeTable[k], key, key) + idTablePut(gTypeTable[k], key, key) result = key of tyObject: if tfFromGeneric notin key.flags: # fast case; lookup per id suffices: - result = PType(IdTableGet(gTypeTable[k], key)) + result = PType(idTableGet(gTypeTable[k], key)) if result == nil: - IdTablePut(gTypeTable[k], key, key) + idTablePut(gTypeTable[k], key, key) result = key else: # ugly slow case: need to compare by structure - if IdTableHasObjectAsKey(gTypeTable[k], key): return key + if idTableHasObjectAsKey(gTypeTable[k], key): return key for h in countup(0, high(gTypeTable[k].data)): var t = PType(gTypeTable[k].data[h].key) if t != nil and sameType(t, key): return t - IdTablePut(gTypeTable[k], key, key) + idTablePut(gTypeTable[k], key, key) result = key of tyEnum: - result = PType(IdTableGet(gTypeTable[k], key)) + result = PType(idTableGet(gTypeTable[k], key)) if result == nil: - IdTablePut(gTypeTable[k], key, key) + idTablePut(gTypeTable[k], key, key) result = key of tyProc: # tyVar is not 100% correct, but would speeds things up a little: @@ -136,17 +135,17 @@ proc GetUniqueType*(key: PType): PType = result = key else: # ugh, we need the canon here: - if IdTableHasObjectAsKey(gTypeTable[k], key): return key + if idTableHasObjectAsKey(gTypeTable[k], key): return key for h in countup(0, high(gTypeTable[k].data)): var t = PType(gTypeTable[k].data[h].key) if t != nil and sameBackendType(t, key): return t - IdTablePut(gTypeTable[k], key, key) + idTablePut(gTypeTable[k], key, key) result = key -proc TableGetType*(tab: TIdTable, key: PType): PObject = +proc tableGetType*(tab: TIdTable, key: PType): PObject = # returns nil if we need to declare this type - result = IdTableGet(tab, key) + result = idTableGet(tab, key) if (result == nil) and (tab.counter > 0): # we have to do a slow linear search because types may need # to be compared by their structure: @@ -169,7 +168,7 @@ proc makeLLVMString*(s: string): PRope = for i in countup(0, len(s) - 1): if (i + 1) mod MaxLineLength == 0: app(result, toRope(res)) - setlen(res, 0) + setLen(res, 0) case s[i] of '\0'..'\x1F', '\x80'..'\xFF', '\"', '\\': add(res, '\\') @@ -178,4 +177,4 @@ proc makeLLVMString*(s: string): PRope = add(res, "\\00\"") app(result, toRope(res)) -InitTypeTables() +initTypeTables() diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 910e675e1..5057ae558 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -52,7 +52,7 @@ proc emitLazily(s: PSym): bool {.inline.} = proc initLoc(result: var TLoc, k: TLocKind, typ: PType, s: TStorageLoc) = result.k = k result.s = s - result.t = GetUniqueType(typ) + result.t = getUniqueType(typ) result.r = nil result.a = - 1 result.flags = {} @@ -72,10 +72,15 @@ proc isSimpleConst(typ: PType): bool = {tyTuple, tyObject, tyArray, tyArrayConstr, tySet, tySequence} and not (t.kind == tyProc and t.callConv == ccClosure) +proc useStringh(m: BModule) = + if not m.includesStringh: + m.includesStringh = true + discard lists.includeStr(m.headerFiles, "<string.h>") + proc useHeader(m: BModule, sym: PSym) = - if lfHeader in sym.loc.Flags: + if lfHeader in sym.loc.flags: assert(sym.annex != nil) - discard lists.IncludeStr(m.headerFiles, getStr(sym.annex.path)) + discard lists.includeStr(m.headerFiles, getStr(sym.annex.path)) proc cgsym(m: BModule, name: string): PRope @@ -98,7 +103,7 @@ proc ropecg(m: BModule, frmt: TFormatStr, args: varargs[PRope]): PRope = of '0'..'9': var j = 0 while true: - j = (j * 10) + Ord(frmt[i]) - ord('0') + j = (j * 10) + ord(frmt[i]) - ord('0') inc(i) if i >= length or not (frmt[i] in {'0'..'9'}): break num = j @@ -111,7 +116,7 @@ proc ropecg(m: BModule, frmt: TFormatStr, args: varargs[PRope]): PRope = of 'N': app(result, rnl) inc(i) - else: InternalError("ropes: invalid format string $" & frmt[i]) + else: internalError("ropes: invalid format string $" & frmt[i]) elif frmt[i] == '#' and frmt[i+1] in IdentStartChars: inc(i) var j = i @@ -123,7 +128,7 @@ proc ropecg(m: BModule, frmt: TFormatStr, args: varargs[PRope]): PRope = inc(i, 2) var j = 0 while frmt[i] in Digits: - j = (j * 10) + Ord(frmt[i]) - ord('0') + j = (j * 10) + ord(frmt[i]) - ord('0') inc(i) app(result, cgsym(m, args[j-1].ropeToStr)) var start = i @@ -189,7 +194,7 @@ when compileTimeRopeFmt: if i - 1 >= start: yield (kind: ffLit, value: substr(s, start, i-1), intValue: 0) - macro rfmt(m: BModule, fmt: expr[string], args: varargs[PRope]): expr = + macro rfmt(m: BModule, fmt: static[string], args: varargs[PRope]): expr = ## Experimental optimized rope-formatting operator ## The run-time code it produces will be very fast, but will it speed up ## the compilation of nimrod itself or will the macro execution time @@ -204,7 +209,7 @@ when compileTimeRopeFmt: of ffParam: result.add(args[frag.intValue]) else: - template rfmt(m: BModule, fmt: expr[string], args: varargs[PRope]): expr = + template rfmt(m: BModule, fmt: string, args: varargs[PRope]): expr = ropecg(m, fmt, args) proc appcg(m: BModule, c: var PRope, frmt: TFormatStr, @@ -274,16 +279,19 @@ proc genLineDir(p: BProc, t: PNode) = if optEmbedOrigSrc in gGlobalOptions: app(p.s(cpsStmts), con(~"//", t.info.sourceLine, rnl)) genCLineDir(p.s(cpsStmts), t.info.toFullPath, line) - if ({optStackTrace, optEndb} * p.Options == {optStackTrace, optEndb}) and + if ({optStackTrace, optEndb} * p.options == {optStackTrace, optEndb}) and (p.prc == nil or sfPure notin p.prc.flags): linefmt(p, cpsStmts, "#endb($1, $2);$n", line.toRope, makeCString(toFilename(t.info))) - elif ({optLineTrace, optStackTrace} * p.Options == + elif ({optLineTrace, optStackTrace} * p.options == {optLineTrace, optStackTrace}) and (p.prc == nil or sfPure notin p.prc.flags): linefmt(p, cpsStmts, "nimln($1, $2);$n", line.toRope, t.info.quotedFilename) +proc postStmtActions(p: BProc) {.inline.} = + app(p.s(cpsStmts), p.module.injectStmt) + proc accessThreadLocalVar(p: BProc, s: PSym) proc emulatedThreadVars(): bool {.inline.} @@ -311,7 +319,7 @@ proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc, takeAddr: bool) = case analyseObjectWithTypeField(t) of frNone: - nil + discard of frHeader: var r = rdLoc(a) if not takeAddr: r = ropef("(*$1)", [r]) @@ -343,7 +351,7 @@ proc resetLoc(p: BProc, loc: var TLoc) = if not isComplexValueType(skipTypes(loc.t, abstractVarRange)): if containsGcRef: var nilLoc: TLoc - initLoc(nilLoc, locTemp, loc.t, onStack) + initLoc(nilLoc, locTemp, loc.t, OnStack) nilLoc.r = toRope("NIM_NIL") genRefAssign(p, loc, nilLoc, {afSrcIsNil}) else: @@ -358,19 +366,24 @@ proc resetLoc(p: BProc, loc: var TLoc) = # field, so disabling this should be safe: genObjectInit(p, cpsStmts, loc.t, loc, true) else: + useStringh(p.module) linefmt(p, cpsStmts, "memset((void*)$1, 0, sizeof($2));$n", addrLoc(loc), rdLoc(loc)) # XXX: We can be extra clever here and call memset only # on the bytes following the m_type field? genObjectInit(p, cpsStmts, loc.t, loc, true) -proc constructLoc(p: BProc, loc: TLoc, section = cpsStmts) = +proc constructLoc(p: BProc, loc: TLoc, isTemp = false) = if not isComplexValueType(skipTypes(loc.t, abstractRange)): - linefmt(p, section, "$1 = 0;$n", rdLoc(loc)) + linefmt(p, cpsStmts, "$1 = 0;$n", rdLoc(loc)) else: - linefmt(p, section, "memset((void*)$1, 0, sizeof($2));$n", - addrLoc(loc), rdLoc(loc)) - genObjectInit(p, section, loc.t, loc, true) + if not isTemp or containsGarbageCollectedRef(loc.t): + # don't use memset for temporary values for performance if we can + # avoid it: + useStringh(p.module) + linefmt(p, cpsStmts, "memset((void*)$1, 0, sizeof($2));$n", + addrLoc(loc), rdLoc(loc)) + genObjectInit(p, cpsStmts, loc.t, loc, true) proc initLocalVar(p: BProc, v: PSym, immediateAsgn: bool) = if sfNoInit notin v.flags: @@ -396,7 +409,7 @@ proc getTemp(p: BProc, t: PType, result: var TLoc) = result.t = getUniqueType(t) result.s = OnStack result.flags = {} - constructLoc(p, result) + constructLoc(p, result, isTemp=true) proc keepAlive(p: BProc, toKeepAlive: TLoc) = when false: @@ -418,6 +431,7 @@ proc keepAlive(p: BProc, toKeepAlive: TLoc) = if not isComplexValueType(skipTypes(toKeepAlive.t, abstractVarRange)): linefmt(p, cpsStmts, "$1 = $2;$n", rdLoc(result), rdLoc(toKeepAlive)) else: + useStringh(p.module) linefmt(p, cpsStmts, "memcpy((void*)$1, (NIM_CONST void*)$2, sizeof($3));$n", addrLoc(result), addrLoc(toKeepAlive), rdLoc(result)) @@ -499,7 +513,7 @@ proc assignLocalVar(p: BProc, s: PSym) = include ccgthreadvars -proc VarInDynamicLib(m: BModule, sym: PSym) +proc varInDynamicLib(m: BModule, sym: PSym) proc mangleDynLibProc(sym: PSym): PRope proc assignGlobalVar(p: BProc, s: PSym) = @@ -508,8 +522,8 @@ proc assignGlobalVar(p: BProc, s: PSym) = if lfDynamicLib in s.loc.flags: var q = findPendingModule(p.module, s) - if q != nil and not ContainsOrIncl(q.declaredThings, s.id): - VarInDynamicLib(q, s) + if q != nil and not containsOrIncl(q.declaredThings, s.id): + varInDynamicLib(q, s) else: s.loc.r = mangleDynLibProc(s) return @@ -564,7 +578,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) proc genProcPrototype(m: BModule, sym: PSym) proc putLocIntoDest(p: BProc, d: var TLoc, s: TLoc) proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) -proc intLiteral(i: biggestInt): PRope +proc intLiteral(i: BiggestInt): PRope proc genLiteral(p: BProc, n: PNode): PRope proc initLocExpr(p: BProc, e: PNode, result: var TLoc) = @@ -596,7 +610,7 @@ proc loadDynamicLib(m: BModule, lib: PLib) = var s: TStringSeq = @[] libCandidates(lib.path.strVal, s) if gVerbosity >= 2: - MsgWriteln("Dependency: " & lib.path.strVal) + msgWriteln("Dependency: " & lib.path.strVal) var loadlib: PRope = nil for i in countup(0, high(s)): inc(m.labels) @@ -618,7 +632,7 @@ proc loadDynamicLib(m: BModule, lib: PLib) = "if (!($1 = #nimLoadLibrary($2))) #nimLoadLibraryError($2);$n", [tmp, rdLoc(dest)]) - if lib.name == nil: InternalError("loadDynamicLib") + if lib.name == nil: internalError("loadDynamicLib") proc mangleDynLibProc(sym: PSym): PRope = if sfCompilerProc in sym.flags: @@ -627,7 +641,7 @@ proc mangleDynLibProc(sym: PSym): PRope = else: result = ropef("Dl_$1", [toRope(sym.id)]) -proc SymInDynamicLib(m: BModule, sym: PSym) = +proc symInDynamicLib(m: BModule, sym: PSym) = var lib = sym.annex let isCall = isGetProcAddr(lib) var extname = sym.loc.r @@ -651,14 +665,14 @@ proc SymInDynamicLib(m: BModule, sym: PSym) = params, cstringLit(m, m.s[cfsDynLibInit], ropeToStr(extname))]) var last = lastSon(n) if last.kind == nkHiddenStdConv: last = last.sons[1] - InternalAssert(last.kind == nkStrLit) + internalAssert(last.kind == nkStrLit) let idx = last.strVal if idx.len == 0: app(m.initProc.s(cpsStmts), load) elif idx.len == 1 and idx[0] in {'0'..'9'}: app(m.extensionLoaders[idx[0]], load) else: - InternalError(sym.info, "wrong index: " & idx) + internalError(sym.info, "wrong index: " & idx) else: appcg(m, m.s[cfsDynLibInit], "\t$1 = ($2) #nimGetProcAddr($3, $4);$n", @@ -668,7 +682,7 @@ proc SymInDynamicLib(m: BModule, sym: PSym) = "$1 = linkonce global $2 zeroinitializer$n", [sym.loc.r, getTypeDesc(m, sym.loc.t)]) -proc VarInDynamicLib(m: BModule, sym: PSym) = +proc varInDynamicLib(m: BModule, sym: PSym) = var lib = sym.annex var extname = sym.loc.r loadDynamicLib(m, lib) @@ -683,7 +697,7 @@ proc VarInDynamicLib(m: BModule, sym: PSym) = appf(m.s[cfsVars], "$2* $1;$n", [sym.loc.r, getTypeDesc(m, sym.loc.t)]) -proc SymInDynamicLibPartial(m: BModule, sym: PSym) = +proc symInDynamicLibPartial(m: BModule, sym: PSym) = sym.loc.r = mangleDynLibProc(sym) sym.typ.sym = nil # generate a new name @@ -694,7 +708,7 @@ proc cgsym(m: BModule, name: string): PRope = of skProc, skMethod, skConverter, skIterator: genProc(m, sym) of skVar, skResult, skLet: genVarPrototype(m, sym) of skType: discard getTypeDesc(m, sym.typ) - else: InternalError("cgsym: " & name) + else: internalError("cgsym: " & name) else: # we used to exclude the system module from this check, but for DLL # generation support this sloppyness leads to hard to detect bugs, so @@ -710,7 +724,7 @@ proc generateHeaders(m: BModule) = appf(m.s[cfsHeaders], "$N#include \"$1\"$N", [toRope(it.data)]) else: appf(m.s[cfsHeaders], "$N#include $1$N", [toRope(it.data)]) - it = PStrEntry(it.Next) + it = PStrEntry(it.next) proc retIsNotVoid(s: PSym): bool = result = (s.typ.sons[0] != nil) and not isInvalidReturnType(s.typ.sons[0]) @@ -733,7 +747,7 @@ proc closureSetup(p: BProc, prc: PSym) = # prc.ast[paramsPos].last contains the type we're after: var ls = lastSon(prc.ast[paramsPos]) if ls.kind != nkSym: - InternalError(prc.info, "closure generation failed") + internalError(prc.info, "closure generation failed") var env = ls.sym #echo "created environment: ", env.id, " for ", prc.name.s assignLocalVar(p, env) @@ -770,7 +784,7 @@ proc genProcAux(m: BModule, prc: PSym) = genStmts(p, prc.getBody) # modifies p.locals, p.init, etc. var generatedProc: PRope if sfPure in prc.flags: - if hasNakedDeclspec in extccomp.CC[extccomp.ccompiler].props: + if hasNakedDeclspec in extccomp.CC[extccomp.cCompiler].props: header = con("__declspec(naked) ", header) generatedProc = rfmt(nil, "$N$1 {$n$2$3$4}$N$N", header, p.s(cpsLocals), p.s(cpsInit), p.s(cpsStmts)) @@ -779,7 +793,7 @@ proc genProcAux(m: BModule, prc: PSym) = app(generatedProc, initGCFrame(p)) if optStackTrace in prc.options: app(generatedProc, p.s(cpsLocals)) - var procname = CStringLit(p, generatedProc, prc.name.s) + var procname = cstringLit(p, generatedProc, prc.name.s) app(generatedProc, initFrame(p, procname, prc.info.quotedFilename)) else: app(generatedProc, p.s(cpsLocals)) @@ -797,16 +811,16 @@ proc genProcAux(m: BModule, prc: PSym) = proc genProcPrototype(m: BModule, sym: PSym) = useHeader(m, sym) - if lfNoDecl in sym.loc.Flags: return - if lfDynamicLib in sym.loc.Flags: + if lfNoDecl in sym.loc.flags: return + if lfDynamicLib in sym.loc.flags: if getModule(sym).id != m.module.id and - not ContainsOrIncl(m.declaredThings, sym.id): + not containsOrIncl(m.declaredThings, sym.id): app(m.s[cfsVars], rfmt(nil, "extern $1 $2;$n", getTypeDesc(m, sym.loc.t), mangleDynLibProc(sym))) if gCmd == cmdCompileToLLVM: incl(sym.loc.flags, lfIndirect) - elif not ContainsOrIncl(m.declaredProtos, sym.id): + elif not containsOrIncl(m.declaredProtos, sym.id): var header = genProcHeader(m, sym) - if sfPure in sym.flags and hasNakedAttribute in CC[ccompiler].props: + if sfPure in sym.flags and hasNakedAttribute in CC[cCompiler].props: header.app(" __attribute__((naked))") app(m.s[cfsProcHeaders], rfmt(nil, "$1;$n", header)) @@ -818,21 +832,21 @@ proc genProcNoForward(m: BModule, prc: PSym) = discard cgsym(m, prc.name.s) return genProcPrototype(m, prc) - if lfNoDecl in prc.loc.Flags: nil + if lfNoDecl in prc.loc.flags: discard elif prc.typ.callConv == ccInline: # We add inline procs to the calling module to enable C based inlining. # This also means that a check with ``q.declaredThings`` is wrong, we need # a check for ``m.declaredThings``. - if not ContainsOrIncl(m.declaredThings, prc.id): genProcAux(m, prc) + if not containsOrIncl(m.declaredThings, prc.id): genProcAux(m, prc) elif lfDynamicLib in prc.loc.flags: var q = findPendingModule(m, prc) - if q != nil and not ContainsOrIncl(q.declaredThings, prc.id): - SymInDynamicLib(q, prc) + if q != nil and not containsOrIncl(q.declaredThings, prc.id): + symInDynamicLib(q, prc) else: - SymInDynamicLibPartial(m, prc) + symInDynamicLibPartial(m, prc) elif sfImportc notin prc.flags: var q = findPendingModule(m, prc) - if q != nil and not ContainsOrIncl(q.declaredThings, prc.id): + if q != nil and not containsOrIncl(q.declaredThings, prc.id): genProcAux(q, prc) proc requestConstImpl(p: BProc, sym: PSym) = @@ -840,15 +854,15 @@ proc requestConstImpl(p: BProc, sym: PSym) = useHeader(m, sym) if sym.loc.k == locNone: fillLoc(sym.loc, locData, sym.typ, mangleName(sym), OnUnknown) - if lfNoDecl in sym.loc.Flags: return + if lfNoDecl in sym.loc.flags: return # declare implementation: var q = findPendingModule(m, sym) - if q != nil and not ContainsOrIncl(q.declaredThings, sym.id): + if q != nil and not containsOrIncl(q.declaredThings, sym.id): assert q.initProc.module == q appf(q.s[cfsData], "NIM_CONST $1 $2 = $3;$n", [getTypeDesc(q, sym.typ), sym.loc.r, genConstExpr(q.initProc, sym.ast)]) # declare header: - if q != m and not ContainsOrIncl(m.declaredThings, sym.id): + if q != m and not containsOrIncl(m.declaredThings, sym.id): assert(sym.loc.r != nil) let headerDecl = ropef("extern NIM_CONST $1 $2;$n", [getTypeDesc(m, sym.loc.t), sym.loc.r]) @@ -865,17 +879,17 @@ proc genProc(m: BModule, prc: PSym) = else: genProcNoForward(m, prc) if {sfExportc, sfCompilerProc} * prc.flags == {sfExportc} and - generatedHeader != nil and lfNoDecl notin prc.loc.Flags: + generatedHeader != nil and lfNoDecl notin prc.loc.flags: genProcPrototype(generatedHeader, prc) if prc.typ.callConv == ccInline: - if not ContainsOrIncl(generatedHeader.declaredThings, prc.id): + if not containsOrIncl(generatedHeader.declaredThings, prc.id): genProcAux(generatedHeader, prc) proc genVarPrototypeAux(m: BModule, sym: PSym) = assert(sfGlobal in sym.flags) useHeader(m, sym) fillLoc(sym.loc, locGlobalVar, sym.typ, mangleName(sym), OnHeap) - if (lfNoDecl in sym.loc.Flags) or ContainsOrIncl(m.declaredThings, sym.id): + if (lfNoDecl in sym.loc.flags) or containsOrIncl(m.declaredThings, sym.id): return if sym.owner.id != m.module.id: # else we already have the symbol generated! @@ -897,29 +911,29 @@ proc addIntTypes(result: var PRope) {.inline.} = appf(result, "#define NIM_INTBITS $1", [ platform.CPU[targetCPU].intSize.toRope]) -proc getCopyright(cfilenoext: string): PRope = - if optCompileOnly in gGlobalOptions: - result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" & - "/* (c) 2012 Andreas Rumpf */$n" & - "/* The generated code is subject to the original license. */$n", - "; Generated by Nimrod Compiler v$1$n" & - "; (c) 2012 Andreas Rumpf$n", [toRope(versionAsString)]) - else: - result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" & - "/* (c) 2012 Andreas Rumpf */$n" & - "/* The generated code is subject to the original license. */$n" & - "/* Compiled for: $2, $3, $4 */$n" & - "/* Command for C compiler:$n $5 */$n", - "; Generated by Nimrod Compiler v$1$n" & - "; (c) 2012 Andreas Rumpf$n" & - "; Compiled for: $2, $3, $4$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), +proc getCopyright(cfilenoext: string): PRope = + if optCompileOnly in gGlobalOptions: + result = ropeff("/* Generated by Nimrod Compiler v$1 */$N" & + "/* (c) 2014 Andreas Rumpf */$N" & + "/* The generated code is subject to the original license. */$N", + "; Generated by Nimrod Compiler v$1$N" & + "; (c) 2012 Andreas Rumpf$N", [toRope(VersionAsString)]) + else: + result = ropeff("/* Generated by Nimrod Compiler v$1 */$N" & + "/* (c) 2014 Andreas Rumpf */$N" & + "/* The generated code is subject to the original license. */$N" & + "/* Compiled for: $2, $3, $4 */$N" & + "/* Command for C compiler:$n $5 */$N", + "; Generated by Nimrod Compiler v$1$N" & + "; (c) 2014 Andreas Rumpf$N" & + "; Compiled for: $2, $3, $4$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), toRope(getCompileCFileCmd(cfilenoext))]) -proc getFileHeader(cfilenoext: string): PRope = +proc getFileHeader(cfilenoext: string): PRope = result = getCopyright(cfilenoext) addIntTypes(result) @@ -927,46 +941,72 @@ proc genFilenames(m: BModule): PRope = discard cgsym(m, "dbgRegisterFilename") result = nil for i in 0.. <fileInfos.len: - result.appf("dbgRegisterFilename($1);$n", fileInfos[i].projPath.makeCString) + result.appf("dbgRegisterFilename($1);$N", fileInfos[i].projPath.makeCString) -proc genMainProc(m: BModule) = +proc genMainProc(m: BModule) = const - CommonMainBody = - "\tsystemDatInit();$n" & - "$1" & - "$2" & - "\tsystemInit();$n" & - "$3" & - "$4" - PosixNimMain = - "int cmdCount;$n" & - "char** cmdLine;$n" & - "char** gEnv;$n" & - "N_CDECL(void, NimMain)(void) {$n" & - CommonMainBody & "}$n" - PosixCMain = "int main(int argc, char** args, char** env) {$n" & - "\tcmdLine = args;$n" & "\tcmdCount = argc;$n" & "\tgEnv = env;$n" & - "\tNimMain();$n" & "\treturn nim_program_result;$n" & "}$n" - StandaloneCMain = "int main(void) {$n" & - "\tNimMain();$n" & - "\treturn 0;$n" & "}$n" - WinNimMain = "N_CDECL(void, NimMain)(void) {$n" & - CommonMainBody & "}$n" - WinCMain = "N_STDCALL(int, WinMain)(HINSTANCE hCurInstance, $n" & - " HINSTANCE hPrevInstance, $n" & - " LPSTR lpCmdLine, int nCmdShow) {$n" & - "\tNimMain();$n" & "\treturn nim_program_result;$n" & "}$n" - WinNimDllMain = "N_LIB_EXPORT N_CDECL(void, NimMain)(void) {$n" & - CommonMainBody & "}$n" - WinCDllMain = - "BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, $n" & - " LPVOID lpvReserved) {$n" & - "\tif(fwdreason == DLL_PROCESS_ATTACH) NimMain();$n" & - "\treturn 1;$n" & "}$n" + PreMainBody = + "\tsystemDatInit();$N" & + "\tsystemInit();$N" & + "$1" & + "$2" & + "$3" & + "$4" + + MainProcs = + "\tNimMain();$N" + + MainProcsWithResult = + MainProcs & "\treturn nim_program_result;$N" + + NimMainBody = + "N_CDECL(void, NimMain)(void) {$N" & + "\tPreMain();$N" & + "$1$N" & + "}$N" + + PosixNimMain = + "int cmdCount;$N" & + "char** cmdLine;$N" & + "char** gEnv;$N" & + NimMainBody + + PosixCMain = + "int main(int argc, char** args, char** env) {$N" & + "\tcmdLine = args;$N" & + "\tcmdCount = argc;$N" & + "\tgEnv = env;$N" & + MainProcsWithResult & + "}$N" + + StandaloneCMain = + "int main(void) {$N" & + MainProcs & + "\treturn 0;$N" & + "}$N" + + WinNimMain = NimMainBody + + WinCMain = "N_STDCALL(int, WinMain)(HINSTANCE hCurInstance, $N" & + " HINSTANCE hPrevInstance, $N" & + " LPSTR lpCmdLine, int nCmdShow) {$N" & + MainProcsWithResult & "}$N" + + WinNimDllMain = "N_LIB_EXPORT " & NimMainBody + + WinCDllMain = + "BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, $N" & + " LPVOID lpvReserved) {$N" & + "\tif(fwdreason == DLL_PROCESS_ATTACH) {$N" & MainProcs & "}$N" & + "\treturn 1;$N}$N" + PosixNimDllMain = WinNimDllMain - PosixCDllMain = - "void NIM_POSIX_INIT NimMainInit(void) {$n" & - "\tNimMain();$n}$n" + + PosixCDllMain = + "void NIM_POSIX_INIT NimMainInit(void) {$N" & + MainProcs & + "}$N" + var nimMain, otherMain: TFormatStr if platform.targetOS == osWindows and gGlobalOptions * {optGenGuiApp, optGenDynLib} != {}: @@ -976,10 +1016,10 @@ proc genMainProc(m: BModule) = else: nimMain = WinNimDllMain otherMain = WinCDllMain - discard lists.IncludeStr(m.headerFiles, "<windows.h>") + discard lists.includeStr(m.headerFiles, "<windows.h>") elif optGenDynLib in gGlobalOptions: - nimMain = posixNimDllMain - otherMain = posixCDllMain + nimMain = PosixNimDllMain + otherMain = PosixCDllMain elif platform.targetOS == osStandalone: nimMain = PosixNimMain otherMain = StandaloneCMain @@ -992,10 +1032,12 @@ proc genMainProc(m: BModule) = let initStackBottomCall = if emulatedThreadVars() or platform.targetOS == osStandalone: "".toRope - else: ropecg(m, "\t#initStackBottom();$n") + else: ropecg(m, "\t#initStackBottom();$N") inc(m.labels) - appcg(m, m.s[cfsProcs], nimMain, [mainDatInit, initStackBottomCall, - gBreakpoints, mainModInit, toRope(m.labels)]) + appcg(m, m.s[cfsProcs], "void PreMain() {$N" & PreMainBody & "}$N", [ + mainDatInit, initStackBottomCall, gBreakpoints, otherModsInit]) + + appcg(m, m.s[cfsProcs], nimMain, [mainModInit, toRope(m.labels)]) if optNoMain notin gGlobalOptions: appcg(m, m.s[cfsProcs], otherMain, []) @@ -1016,13 +1058,17 @@ proc registerModuleToMain(m: PSym) = "declare void $1() noinline$N", [init]) appff(mainModProcs, "N_NOINLINE(void, $1)(void);$N", "declare void $1() noinline$N", [datInit]) - if not (sfSystemModule in m.flags): - appff(mainModInit, "\t$1();$n", "call void ()* $1$n", [init]) - appff(mainDatInit, "\t$1();$n", "call void ()* $1$n", [datInit]) - + if sfSystemModule notin m.flags: + appff(mainDatInit, "\t$1();$N", "call void ()* $1$n", [datInit]) + let initCall = ropeff("\t$1();$N", "call void ()* $1$n", [init]) + if sfMainModule in m.flags: + app(mainModInit, initCall) + else: + app(otherModsInit, initCall) + proc genInitCode(m: BModule) = var initname = getInitName(m.module) - var prc = ropeff("N_NOINLINE(void, $1)(void) {$n", + var prc = ropeff("N_NOINLINE(void, $1)(void) {$N", "define void $1() noinline {$n", [initname]) if m.typeNodes > 0: appcg(m, m.s[cfsTypeInit1], "static #TNimNode $1[$2];$n", @@ -1039,12 +1085,12 @@ proc genInitCode(m: BModule) = app(prc, m.postInitProc.s(cpsLocals)) app(prc, genSectionEnd(cpsLocals)) - if optStackTrace in m.initProc.options and not m.FrameDeclared: + if optStackTrace in m.initProc.options and not m.frameDeclared: # BUT: the generated init code might depend on a current frame, so # declare it nevertheless: - m.FrameDeclared = true - if not m.PreventStackTrace: - var procname = CStringLit(m.initProc, prc, m.module.name.s) + m.frameDeclared = true + if not m.preventStackTrace: + var procname = cstringLit(m.initProc, prc, m.module.name.s) app(prc, initFrame(m.initProc, procname, m.module.info.quotedFilename)) else: app(prc, ~"\tTFrame F; F.len = 0;$N") @@ -1060,12 +1106,12 @@ proc genInitCode(m: BModule) = app(prc, m.initProc.s(cpsStmts)) app(prc, m.postInitProc.s(cpsStmts)) app(prc, genSectionEnd(cpsStmts)) - if optStackTrace in m.initProc.options and not m.PreventStackTrace: + if optStackTrace in m.initProc.options and not m.preventStackTrace: app(prc, deinitFrame(m.initProc)) app(prc, deinitGCFrame(m.initProc)) appf(prc, "}$N$N") - prc.appff("N_NOINLINE(void, $1)(void) {$n", + prc.appff("N_NOINLINE(void, $1)(void) {$N", "define void $1() noinline {$n", [getDatInitName(m.module)]) for i in cfsTypeInit1..cfsDynLibInit: @@ -1108,9 +1154,12 @@ proc newPostInitProc(m: BModule): BProc = # little hack so that unique temporaries are generated: result.labels = 200_000 +proc initProcOptions(m: BModule): TOptions = + if sfSystemModule in m.module.flags: gOptions-{optStackTrace} else: gOptions + proc rawNewModule(module: PSym, filename: string): BModule = new(result) - InitLinkedList(result.headerFiles) + initLinkedList(result.headerFiles) result.declaredThings = initIntSet() result.declaredProtos = initIntSet() result.cfilename = filename @@ -1120,7 +1169,7 @@ proc rawNewModule(module: PSym, filename: string): BModule = result.module = module result.typeInfoMarker = initIntSet() result.initProc = newProc(nil, result) - result.initProc.options = gOptions + result.initProc.options = initProcOptions(result) result.preInitProc = newPreInitProc(result) result.postInitProc = newPostInitProc(result) initNodeTable(result.dataCache) @@ -1128,7 +1177,12 @@ proc rawNewModule(module: PSym, filename: string): BModule = result.forwardedProcs = @[] result.typeNodesName = getTempName() result.nimTypesName = getTempName() - result.PreventStackTrace = sfSystemModule in module.flags + # no line tracing for the init sections of the system module so that we + # don't generate a TFrame which can confuse the stack botton initialization: + if sfSystemModule in module.flags: + result.preventStackTrace = true + excl(result.preInitProc.options, optStackTrace) + excl(result.postInitProc.options, optStackTrace) proc nullify[T](arr: var T) = for i in low(arr)..high(arr): @@ -1137,11 +1191,11 @@ proc nullify[T](arr: var T) = proc resetModule*(m: var BModule) = # between two compilations in CAAS mode, we can throw # away all the data that was written to disk - InitLinkedList(m.headerFiles) + initLinkedList(m.headerFiles) m.declaredProtos = initIntSet() initIdTable(m.forwTypeCache) m.initProc = newProc(nil, m) - m.initProc.options = gOptions + m.initProc.options = initProcOptions(m) m.preInitProc = newPreInitProc(m) m.postInitProc = newPostInitProc(m) initNodeTable(m.dataCache) @@ -1149,7 +1203,7 @@ proc resetModule*(m: var BModule) = m.forwardedProcs = @[] m.typeNodesName = getTempName() m.nimTypesName = getTempName() - m.PreventStackTrace = sfSystemModule in m.module.flags + m.preventStackTrace = sfSystemModule in m.module.flags nullify m.s m.usesThreadVars = false m.typeNodes = 0 @@ -1180,7 +1234,7 @@ proc rawNewModule(module: PSym): BModule = proc newModule(module: PSym): BModule = # we should create only one cgen module for each module sym - InternalAssert getCgenModule(module) == nil + internalAssert getCgenModule(module) == nil result = rawNewModule(module) growCache gModules, module.position @@ -1188,7 +1242,7 @@ proc newModule(module: PSym): BModule = if (optDeadCodeElim in gGlobalOptions): if (sfDeadCodeElim in module.flags): - InternalError("added pending module twice: " & module.filename) + internalError("added pending module twice: " & module.filename) proc myOpen(module: PSym): PPassContext = result = newModule(module) @@ -1231,7 +1285,7 @@ proc myProcess(b: PPassContext, n: PNode): PNode = result = n if b == nil or passes.skipCodegen(n): return var m = BModule(b) - m.initProc.options = gOptions + m.initProc.options = initProcOptions(m) genStmts(m.initProc, n) proc finishModule(m: BModule) = @@ -1241,19 +1295,19 @@ proc finishModule(m: BModule) = # a ``for`` loop here var prc = m.forwardedProcs[i] if sfForward in prc.flags: - InternalError(prc.info, "still forwarded: " & prc.name.s) + internalError(prc.info, "still forwarded: " & prc.name.s) genProcNoForward(m, prc) inc(i) assert(gForwardedProcsCounter >= i) dec(gForwardedProcsCounter, i) - setlen(m.forwardedProcs, 0) + setLen(m.forwardedProcs, 0) proc shouldRecompile(code: PRope, cfile, cfilenoext: string): bool = result = true if optForceFullMake notin gGlobalOptions: var objFile = toObjFile(cfilenoext) if writeRopeIfNotEqual(code, cfile): return - if ExistsFile(objFile) and os.FileNewer(objFile, cfile): result = false + if existsFile(objFile) and os.fileNewer(objFile, cfile): result = false else: writeRope(code, cfile) @@ -1274,7 +1328,7 @@ proc writeModule(m: BModule, pending: bool) = if sfMainModule in m.module.flags: # generate main file: app(m.s[cfsProcHeaders], mainModProcs) - GenerateThreadVarsSize(m) + generateThreadVarsSize(m) var code = genModule(m, cfilenoext) when hasTinyCBackend: @@ -1291,7 +1345,7 @@ proc writeModule(m: BModule, pending: bool) = var code = genModule(m, cfilenoext) writeRope(code, cfile) addFileToCompile(cfilenoext) - elif not ExistsFile(toObjFile(cfilenoext)): + elif not existsFile(toObjFile(cfilenoext)): # Consider: first compilation compiles ``system.nim`` and produces # ``system.c`` but then compilation fails due to an error. This means # that ``system.o`` is missing, so we need to call the C compiler for it: @@ -1318,7 +1372,7 @@ proc myClose(b: PPassContext, n: PNode): PNode = if b == nil or passes.skipCodegen(n): return var m = BModule(b) if n != nil: - m.initProc.options = gOptions + m.initProc.options = initProcOptions(m) genStmts(m.initProc, n) # cached modules need to registered too: registerModuleToMain(m.module) diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index b5888d0f4..9cd2c0d87 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -61,8 +61,8 @@ type TCProc{.final.} = object # represents C proc that is currently generated prc*: PSym # the Nimrod proc that this C proc belongs to - BeforeRetNeeded*: bool # true iff 'BeforeRet' label for proc is needed - ThreadVarAccessed*: bool # true if the proc already accessed some threadvar + beforeRetNeeded*: bool # true iff 'BeforeRet' label for proc is needed + threadVarAccessed*: bool # true if the proc already accessed some threadvar nestedTryStmts*: seq[PNode] # in how many nested try statements we are # (the vars must be volatile then) inExceptBlock*: int # are we currently inside an except block? @@ -78,7 +78,7 @@ type maxFrameLen*: int # max length of frame descriptor module*: BModule # used to prevent excessive parameter passing withinLoop*: int # > 0 if we are within a loop - gcFrameId*: natural # for the GC stack marking + gcFrameId*: Natural # for the GC stack marking gcFrameType*: PRope # the struct {} we put the GC markers into TTypeSeq* = seq[PType] @@ -86,11 +86,12 @@ type module*: PSym filename*: string s*: TCFileSections # sections of the C file - PreventStackTrace*: bool # true if stack traces need to be prevented + preventStackTrace*: bool # true if stack traces need to be prevented usesThreadVars*: bool # true if the module uses a thread var - FrameDeclared*: bool # hack for ROD support so that we don't declare + frameDeclared*: bool # hack for ROD support so that we don't declare # a frame var twice in an init proc isHeaderFile*: bool # C source file is the header file + includesStringh*: bool # C source file already includes ``<string.h>`` cfilename*: string # filename of the module (including path, # without extension) typeCache*: TIdTable # cache the generated types @@ -107,12 +108,14 @@ type forwardedProcs*: TSymSeq # keep forwarded procs here typeNodes*, nimTypes*: int # used for type info generation typeNodesName*, nimTypesName*: PRope # used for type info generation - labels*: natural # for generating unique module-scope names + labels*: Natural # for generating unique module-scope names extensionLoaders*: array['0'..'9', PRope] # special procs for the # OpenGL wrapper + injectStmt*: PRope var - mainModProcs*, mainModInit*, mainDatInit*: PRope # parts of the main module + mainModProcs*, mainModInit*, otherModsInit*, mainDatInit*: PRope + # varuious parts of the main module gMapping*: PRope # the generated mapping file (if requested) gModules*: seq[BModule] = @[] # list of all compiled modules gForwardedProcsCounter*: int = 0 diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index 33bb94b38..1c5ce7a21 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -18,16 +18,16 @@ proc genConv(n: PNode, d: PType, downcast: bool): PNode = var source = skipTypes(n.typ, abstractPtrs) if (source.kind == tyObject) and (dest.kind == tyObject): var diff = inheritanceDiff(dest, source) - if diff == high(int): InternalError(n.info, "cgmeth.genConv") + if diff == high(int): internalError(n.info, "cgmeth.genConv") if diff < 0: result = newNodeIT(nkObjUpConv, n.info, d) addSon(result, n) - if downCast: InternalError(n.info, "cgmeth.genConv: no upcast allowed") + if downcast: internalError(n.info, "cgmeth.genConv: no upcast allowed") elif diff > 0: result = newNodeIT(nkObjDownConv, n.info, d) addSon(result, n) - if not downCast: - InternalError(n.info, "cgmeth.genConv: no downcast allowed") + if not downcast: + internalError(n.info, "cgmeth.genConv: no downcast allowed") else: result = n else: @@ -66,7 +66,7 @@ proc sameMethodBucket(a, b: PSym): bool = if sameType(aa, bb) or (aa.kind == tyObject) and (bb.kind == tyObject) and (inheritanceDiff(bb, aa) < 0): - nil + discard else: return result = true @@ -112,12 +112,12 @@ proc relevantCol(methods: TSymSeq, col: int): bool = if t.kind == tyObject: for i in countup(1, high(methods)): let t2 = skipTypes(methods[i].typ.sons[col], skipPtrs) - if not SameType(t2, t): + if not sameType(t2, t): return true proc cmpSignatures(a, b: PSym, relevantCols: TIntSet): int = for col in countup(1, sonsLen(a.typ) - 1): - if Contains(relevantCols, col): + if contains(relevantCols, col): var aa = skipTypes(a.typ.sons[col], skipPtrs) var bb = skipTypes(b.typ.sons[col], skipPtrs) var d = inheritanceDiff(aa, bb) @@ -126,14 +126,14 @@ proc cmpSignatures(a, b: PSym, relevantCols: TIntSet): int = proc sortBucket(a: var TSymSeq, relevantCols: TIntSet) = # we use shellsort here; fast and simple - var N = len(a) + var n = len(a) var h = 1 while true: h = 3 * h + 1 - if h > N: break + if h > n: break while true: h = h div 3 - for i in countup(h, N - 1): + for i in countup(h, n - 1): var v = a[i] var j = i while cmpSignatures(a[j - h], v, relevantCols) >= 0: @@ -154,7 +154,7 @@ proc genDispatcher(methods: TSymSeq, relevantCols: TIntSet): PSym = var curr = methods[meth] # generate condition: var cond: PNode = nil for col in countup(1, paramLen - 1): - if Contains(relevantCols, col): + if contains(relevantCols, col): var isn = newNodeIT(nkCall, base.info, getSysType(tyBool)) addSon(isn, newSymNode(iss)) addSon(isn, newSymNode(base.typ.n.sons[col].sym)) @@ -195,7 +195,7 @@ proc generateMethodDispatchers*(): PNode = for bucket in countup(0, len(gMethods) - 1): var relevantCols = initIntSet() for col in countup(1, sonsLen(gMethods[bucket][0].typ) - 1): - if relevantCol(gMethods[bucket], col): Incl(relevantCols, col) + if relevantCol(gMethods[bucket], col): incl(relevantCols, col) sortBucket(gMethods[bucket], relevantCols) addSon(result, newSymNode(genDispatcher(gMethods[bucket], relevantCols))) diff --git a/compiler/commands.nim b/compiler/commands.nim index d3266930b..18bdb54d3 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -21,40 +21,40 @@ type passCmd2, # second pass over the command line passPP # preprocessor called ProcessCommand() -proc ProcessCommand*(switch: string, pass: TCmdLinePass) -proc processSwitch*(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) +proc processCommand*(switch: string, pass: TCmdLinePass) +proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) # implementation const - HelpMessage = "Nimrod Compiler Version $1 (" & compileDate & ") [$2: $3]\n" & - "Copyright (c) 2004-2013 by Andreas Rumpf\n" + HelpMessage = "Nimrod Compiler Version $1 (" & CompileDate & ") [$2: $3]\n" & + "Copyright (c) 2006-2014 by Andreas Rumpf\n" const Usage = slurp"doc/basicopt.txt".replace("//", "") AdvancedUsage = slurp"doc/advopt.txt".replace("//", "") proc getCommandLineDesc(): string = - result = (HelpMessage % [VersionAsString, platform.os[platform.hostOS].name, - cpu[platform.hostCPU].name]) & Usage + result = (HelpMessage % [VersionAsString, platform.OS[platform.hostOS].name, + CPU[platform.hostCPU].name]) & Usage -proc HelpOnError(pass: TCmdLinePass) = +proc helpOnError(pass: TCmdLinePass) = if pass == passCmd1: - MsgWriteln(getCommandLineDesc()) + msgWriteln(getCommandLineDesc()) quit(0) proc writeAdvancedUsage(pass: TCmdLinePass) = if pass == passCmd1: - MsgWriteln(`%`(HelpMessage, [VersionAsString, - platform.os[platform.hostOS].name, - cpu[platform.hostCPU].name]) & AdvancedUsage) + msgWriteln(`%`(HelpMessage, [VersionAsString, + platform.OS[platform.hostOS].name, + CPU[platform.hostCPU].name]) & AdvancedUsage) quit(0) proc writeVersionInfo(pass: TCmdLinePass) = if pass == passCmd1: - MsgWriteln(`%`(HelpMessage, [VersionAsString, - platform.os[platform.hostOS].name, - cpu[platform.hostCPU].name])) + msgWriteln(`%`(HelpMessage, [VersionAsString, + platform.OS[platform.hostOS].name, + CPU[platform.hostCPU].name])) quit(0) var @@ -62,16 +62,16 @@ var proc writeCommandLineUsage() = if not helpWritten: - MsgWriteln(getCommandLineDesc()) + msgWriteln(getCommandLineDesc()) helpWritten = true proc addPrefix(switch: string): string = if len(switch) == 1: result = "-" & switch else: result = "--" & switch -proc InvalidCmdLineOption(pass: TCmdLinePass, switch: string, info: TLineInfo) = - if switch == " ": LocalError(info, errInvalidCmdLineOption, "-") - else: LocalError(info, errInvalidCmdLineOption, addPrefix(switch)) +proc invalidCmdLineOption(pass: TCmdLinePass, switch: string, info: TLineInfo) = + if switch == " ": localError(info, errInvalidCmdLineOption, "-") + else: localError(info, errInvalidCmdLineOption, addPrefix(switch)) proc splitSwitch(switch: string, cmd, arg: var string, pass: TCmdLinePass, info: TLineInfo) = @@ -86,29 +86,29 @@ proc splitSwitch(switch: string, cmd, arg: var string, pass: TCmdLinePass, inc(i) if i >= len(switch): arg = "" elif switch[i] in {':', '=', '['}: arg = substr(switch, i + 1) - else: InvalidCmdLineOption(pass, switch, info) + else: invalidCmdLineOption(pass, switch, info) -proc ProcessOnOffSwitch(op: TOptions, arg: string, pass: TCmdlinePass, +proc processOnOffSwitch(op: TOptions, arg: string, pass: TCmdLinePass, info: TLineInfo) = case whichKeyword(arg) of wOn: gOptions = gOptions + op of wOff: gOptions = gOptions - op - else: LocalError(info, errOnOrOffExpectedButXFound, arg) + else: localError(info, errOnOrOffExpectedButXFound, arg) -proc ProcessOnOffSwitchG(op: TGlobalOptions, arg: string, pass: TCmdlinePass, +proc processOnOffSwitchG(op: TGlobalOptions, arg: string, pass: TCmdLinePass, info: TLineInfo) = case whichKeyword(arg) of wOn: gGlobalOptions = gGlobalOptions + op of wOff: gGlobalOptions = gGlobalOptions - op - else: LocalError(info, errOnOrOffExpectedButXFound, arg) + else: localError(info, errOnOrOffExpectedButXFound, arg) -proc ExpectArg(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = - if arg == "": LocalError(info, errCmdLineArgExpected, addPrefix(switch)) +proc expectArg(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = + if arg == "": localError(info, errCmdLineArgExpected, addPrefix(switch)) -proc ExpectNoArg(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = - if arg != "": LocalError(info, errCmdLineNoArgExpected, addPrefix(switch)) +proc expectNoArg(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = + if arg != "": localError(info, errCmdLineNoArgExpected, addPrefix(switch)) -proc ProcessSpecificNote(arg: string, state: TSpecialWord, pass: TCmdlinePass, +proc processSpecificNote(arg: string, state: TSpecialWord, pass: TCmdLinePass, info: TLineInfo) = var id = "" # arg = "X]:on|off" var i = 0 @@ -117,21 +117,21 @@ proc ProcessSpecificNote(arg: string, state: TSpecialWord, pass: TCmdlinePass, add(id, arg[i]) inc(i) if i < len(arg) and (arg[i] == ']'): inc(i) - else: InvalidCmdLineOption(pass, arg, info) + else: invalidCmdLineOption(pass, arg, info) if i < len(arg) and (arg[i] in {':', '='}): inc(i) - else: InvalidCmdLineOption(pass, arg, info) + else: invalidCmdLineOption(pass, arg, info) if state == wHint: var x = findStr(msgs.HintsToStr, id) if x >= 0: n = TNoteKind(x + ord(hintMin)) - else: InvalidCmdLineOption(pass, arg, info) + else: invalidCmdLineOption(pass, arg, info) else: var x = findStr(msgs.WarningsToStr, id) if x >= 0: n = TNoteKind(x + ord(warnMin)) - else: InvalidCmdLineOption(pass, arg, info) + else: invalidCmdLineOption(pass, arg, info) case whichKeyword(substr(arg, i)) of wOn: incl(gNotes, n) of wOff: excl(gNotes, n) - else: LocalError(info, errOnOrOffExpectedButXFound, arg) + else: localError(info, errOnOrOffExpectedButXFound, arg) proc processCompile(filename: string) = var found = findFile(filename) @@ -150,14 +150,14 @@ proc testCompileOptionArg*(switch, arg: string, info: TLineInfo): bool = of "markandsweep": result = gSelectedGC == gcMarkAndSweep of "generational": result = gSelectedGC == gcGenerational of "none": result = gSelectedGC == gcNone - else: LocalError(info, errNoneBoehmRefcExpectedButXFound, arg) + else: localError(info, errNoneBoehmRefcExpectedButXFound, arg) of "opt": case arg.normalize of "speed": result = contains(gOptions, optOptimizeSpeed) of "size": result = contains(gOptions, optOptimizeSize) of "none": result = gOptions * {optOptimizeSpeed, optOptimizeSize} == {} - else: LocalError(info, errNoneSpeedOrSizeExpectedButXFound, arg) - else: InvalidCmdLineOption(passCmd1, switch, info) + else: localError(info, errNoneSpeedOrSizeExpectedButXFound, arg) + else: invalidCmdLineOption(passCmd1, switch, info) proc testCompileOption*(switch: string, info: TLineInfo): bool = case switch.normalize @@ -173,11 +173,11 @@ proc testCompileOption*(switch: string, info: TLineInfo): bool = of "linetrace": result = contains(gOptions, optLineTrace) of "debugger": result = contains(gOptions, optEndb) of "profiler": result = contains(gOptions, optProfiler) - of "checks", "x": result = gOptions * checksOptions == checksOptions + of "checks", "x": result = gOptions * ChecksOptions == ChecksOptions of "floatchecks": - result = gOptions * {optNanCheck, optInfCheck} == {optNanCheck, optInfCheck} + result = gOptions * {optNaNCheck, optInfCheck} == {optNaNCheck, optInfCheck} of "infchecks": result = contains(gOptions, optInfCheck) - of "nanchecks": result = contains(gOptions, optNanCheck) + of "nanchecks": result = contains(gOptions, optNaNCheck) of "objchecks": result = contains(gOptions, optObjCheck) of "fieldchecks": result = contains(gOptions, optFieldCheck) of "rangechecks": result = contains(gOptions, optRangeCheck) @@ -194,7 +194,7 @@ proc testCompileOption*(switch: string, info: TLineInfo): bool = of "tlsemulation": result = contains(gGlobalOptions, optTlsEmulation) of "implicitstatic": result = contains(gOptions, optImplicitStatic) of "patterns": result = contains(gOptions, optPatterns) - else: InvalidCmdLineOption(passCmd1, switch, info) + else: invalidCmdLineOption(passCmd1, switch, info) proc processPath(path: string, notRelativeToProj = false): string = let p = if notRelativeToProj or os.isAbsolute(path) or @@ -202,20 +202,20 @@ proc processPath(path: string, notRelativeToProj = false): string = path else: options.gProjectPath / path - result = UnixToNativePath(p % ["nimrod", getPrefixDir(), "lib", libpath, + result = unixToNativePath(p % ["nimrod", getPrefixDir(), "lib", libpath, "home", removeTrailingDirSep(os.getHomeDir()), "projectname", options.gProjectName, "projectpath", options.gProjectPath]) proc trackDirty(arg: string, info: TLineInfo) = var a = arg.split(',') - if a.len != 4: LocalError(info, errTokenExpected, + if a.len != 4: localError(info, errTokenExpected, "DIRTY_BUFFER,ORIGINAL_FILE,LINE,COLUMN") var line, column: int if parseUtils.parseInt(a[2], line) <= 0: - LocalError(info, errInvalidNumber, a[1]) + localError(info, errInvalidNumber, a[1]) if parseUtils.parseInt(a[3], column) <= 0: - LocalError(info, errInvalidNumber, a[2]) + localError(info, errInvalidNumber, a[2]) gDirtyBufferIdx = a[0].fileInfoIdx gDirtyOriginalIdx = a[1].fileInfoIdx @@ -225,21 +225,21 @@ proc trackDirty(arg: string, info: TLineInfo) = proc track(arg: string, info: TLineInfo) = var a = arg.split(',') - if a.len != 3: LocalError(info, errTokenExpected, "FILE,LINE,COLUMN") + if a.len != 3: localError(info, errTokenExpected, "FILE,LINE,COLUMN") var line, column: int if parseUtils.parseInt(a[1], line) <= 0: - LocalError(info, errInvalidNumber, a[1]) + localError(info, errInvalidNumber, a[1]) if parseUtils.parseInt(a[2], column) <= 0: - LocalError(info, errInvalidNumber, a[2]) + localError(info, errInvalidNumber, a[2]) optTrackPos = newLineInfo(a[0], line, column) msgs.addCheckpoint(optTrackPos) -proc dynlibOverride(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = +proc dynlibOverride(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = if pass in {passCmd2, passPP}: expectArg(switch, arg, pass, info) options.inclDynlibOverride(arg) -proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = +proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = var theOS: TSystemOS cpu: TSystemCPU @@ -249,15 +249,18 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = expectArg(switch, arg, pass, info) addPath(processPath(arg), info) of "babelpath": - if pass in {passCmd2, passPP}: + if pass in {passCmd2, passPP} and not options.gNoBabelPath: expectArg(switch, arg, pass, info) let path = processPath(arg, notRelativeToProj=true) babelpath(path, info) + of "nobabelpath": + expectNoArg(switch, arg, pass, info) + options.gNoBabelPath = true of "excludepath": expectArg(switch, arg, pass, info) let path = processPath(arg) - lists.ExcludeStr(options.searchPaths, path) - lists.ExcludeStr(options.lazyPaths, path) + lists.excludeStr(options.searchPaths, path) + lists.excludeStr(options.lazyPaths, path) of "nimcache": expectArg(switch, arg, pass, info) options.nimcacheDir = processPath(arg) @@ -269,10 +272,10 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = optMainModule = arg of "define", "d": expectArg(switch, arg, pass, info) - DefineSymbol(arg) + defineSymbol(arg) of "undef", "u": expectArg(switch, arg, pass, info) - UndefSymbol(arg) + undefSymbol(arg) of "compile": expectArg(switch, arg, pass, info) if pass in {passCmd2, passPP}: processCompile(arg) @@ -305,7 +308,7 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = case arg.normalize of "boehm": gSelectedGC = gcBoehm - DefineSymbol("boehmgc") + defineSymbol("boehmgc") of "refc": gSelectedGC = gcRefc of "v2": @@ -319,42 +322,42 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = of "none": gSelectedGC = gcNone defineSymbol("nogc") - else: LocalError(info, errNoneBoehmRefcExpectedButXFound, arg) - of "warnings", "w": ProcessOnOffSwitch({optWarns}, arg, pass, info) - of "warning": ProcessSpecificNote(arg, wWarning, pass, info) - of "hint": ProcessSpecificNote(arg, wHint, pass, info) - of "hints": ProcessOnOffSwitch({optHints}, arg, pass, info) - of "threadanalysis": ProcessOnOffSwitchG({optThreadAnalysis}, arg, pass, info) - of "stacktrace": ProcessOnOffSwitch({optStackTrace}, arg, pass, info) - of "linetrace": ProcessOnOffSwitch({optLineTrace}, arg, pass, info) + else: localError(info, errNoneBoehmRefcExpectedButXFound, arg) + of "warnings", "w": processOnOffSwitch({optWarns}, arg, pass, info) + of "warning": processSpecificNote(arg, wWarning, pass, info) + of "hint": processSpecificNote(arg, wHint, pass, info) + of "hints": processOnOffSwitch({optHints}, arg, pass, info) + of "threadanalysis": processOnOffSwitchG({optThreadAnalysis}, arg, pass, info) + of "stacktrace": processOnOffSwitch({optStackTrace}, arg, pass, info) + of "linetrace": processOnOffSwitch({optLineTrace}, arg, pass, info) of "debugger": - ProcessOnOffSwitch({optEndb}, arg, pass, info) - if optEndb in gOptions: DefineSymbol("endb") - else: UndefSymbol("endb") + processOnOffSwitch({optEndb}, arg, pass, info) + if optEndb in gOptions: defineSymbol("endb") + else: undefSymbol("endb") of "profiler": - ProcessOnOffSwitch({optProfiler}, arg, pass, info) - if optProfiler in gOptions: DefineSymbol("profiler") - else: UndefSymbol("profiler") - of "checks", "x": ProcessOnOffSwitch(checksOptions, arg, pass, info) + processOnOffSwitch({optProfiler}, arg, pass, info) + if optProfiler in gOptions: defineSymbol("profiler") + else: undefSymbol("profiler") + of "checks", "x": processOnOffSwitch(ChecksOptions, arg, pass, info) of "floatchecks": - ProcessOnOffSwitch({optNanCheck, optInfCheck}, arg, pass, info) - of "infchecks": ProcessOnOffSwitch({optInfCheck}, arg, pass, info) - of "nanchecks": ProcessOnOffSwitch({optNanCheck}, arg, pass, info) - of "objchecks": ProcessOnOffSwitch({optObjCheck}, arg, pass, info) - of "fieldchecks": ProcessOnOffSwitch({optFieldCheck}, arg, pass, info) - of "rangechecks": ProcessOnOffSwitch({optRangeCheck}, arg, pass, info) - of "boundchecks": ProcessOnOffSwitch({optBoundsCheck}, arg, pass, info) - of "overflowchecks": ProcessOnOffSwitch({optOverflowCheck}, arg, pass, info) - of "linedir": ProcessOnOffSwitch({optLineDir}, arg, pass, info) - of "assertions", "a": ProcessOnOffSwitch({optAssert}, arg, pass, info) - of "deadcodeelim": ProcessOnOffSwitchG({optDeadCodeElim}, arg, pass, info) - of "threads": ProcessOnOffSwitchG({optThreads}, arg, pass, info) - of "tlsemulation": ProcessOnOffSwitchG({optTlsEmulation}, arg, pass, info) - of "taintmode": ProcessOnOffSwitchG({optTaintMode}, arg, pass, info) + processOnOffSwitch({optNaNCheck, optInfCheck}, arg, pass, info) + of "infchecks": processOnOffSwitch({optInfCheck}, arg, pass, info) + of "nanchecks": processOnOffSwitch({optNaNCheck}, arg, pass, info) + of "objchecks": processOnOffSwitch({optObjCheck}, arg, pass, info) + of "fieldchecks": processOnOffSwitch({optFieldCheck}, arg, pass, info) + of "rangechecks": processOnOffSwitch({optRangeCheck}, arg, pass, info) + of "boundchecks": processOnOffSwitch({optBoundsCheck}, arg, pass, info) + of "overflowchecks": processOnOffSwitch({optOverflowCheck}, arg, pass, info) + of "linedir": processOnOffSwitch({optLineDir}, arg, pass, info) + of "assertions", "a": processOnOffSwitch({optAssert}, arg, pass, info) + of "deadcodeelim": processOnOffSwitchG({optDeadCodeElim}, arg, pass, info) + of "threads": processOnOffSwitchG({optThreads}, arg, pass, info) + of "tlsemulation": processOnOffSwitchG({optTlsEmulation}, arg, pass, info) + of "taintmode": processOnOffSwitchG({optTaintMode}, arg, pass, info) of "implicitstatic": - ProcessOnOffSwitch({optImplicitStatic}, arg, pass, info) + processOnOffSwitch({optImplicitStatic}, arg, pass, info) of "patterns": - ProcessOnOffSwitch({optPatterns}, arg, pass, info) + processOnOffSwitch({optPatterns}, arg, pass, info) of "opt": expectArg(switch, arg, pass, info) case arg.normalize @@ -367,7 +370,7 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = of "none": excl(gOptions, optOptimizeSpeed) excl(gOptions, optOptimizeSize) - else: LocalError(info, errNoneSpeedOrSizeExpectedButXFound, arg) + else: localError(info, errNoneSpeedOrSizeExpectedButXFound, arg) of "app": expectArg(switch, arg, pass, info) case arg.normalize @@ -389,7 +392,7 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = excl(gGlobalOptions, optGenGuiApp) defineSymbol("library") defineSymbol("staticlib") - else: LocalError(info, errGuiConsoleOrLibExpectedButXFound, arg) + else: localError(info, errGuiConsoleOrLibExpectedButXFound, arg) of "passc", "t": expectArg(switch, arg, pass, info) if pass in {passCmd2, passPP}: extccomp.addCompileOption(arg) @@ -398,18 +401,18 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = if pass in {passCmd2, passPP}: extccomp.addLinkOption(arg) of "cincludes": expectArg(switch, arg, pass, info) - if pass in {passCmd2, passPP}: cIncludes.add arg + if pass in {passCmd2, passPP}: cIncludes.add arg.processPath of "clibdir": expectArg(switch, arg, pass, info) - if pass in {passCmd2, passPP}: cLibs.add arg + if pass in {passCmd2, passPP}: cLibs.add arg.processPath of "clib": expectArg(switch, arg, pass, info) - if pass in {passCmd2, passPP}: cLinkedLibs.add arg + if pass in {passCmd2, passPP}: cLinkedLibs.add arg.processPath of "header": headerFile = arg incl(gGlobalOptions, optGenIndex) of "index": - ProcessOnOffSwitchG({optGenIndex}, arg, pass, info) + processOnOffSwitchG({optGenIndex}, arg, pass, info) of "import": expectArg(switch, arg, pass, info) if pass in {passCmd2, passPP}: implicitImports.add arg @@ -425,19 +428,19 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = of "os": expectArg(switch, arg, pass, info) if pass in {passCmd1, passPP}: - theOS = platform.NameToOS(arg) - if theOS == osNone: LocalError(info, errUnknownOS, arg) + theOS = platform.nameToOS(arg) + if theOS == osNone: localError(info, errUnknownOS, arg) elif theOS != platform.hostOS: setTarget(theOS, targetCPU) - condsyms.InitDefines() + condsyms.initDefines() of "cpu": expectArg(switch, arg, pass, info) if pass in {passCmd1, passPP}: - cpu = platform.NameToCPU(arg) - if cpu == cpuNone: LocalError(info, errUnknownCPU, arg) + cpu = platform.nameToCPU(arg) + if cpu == cpuNone: localError(info, errUnknownCPU, arg) elif cpu != platform.hostCPU: setTarget(targetOS, cpu) - condsyms.InitDefines() + condsyms.initDefines() of "run", "r": expectNoArg(switch, arg, pass, info) incl(gGlobalOptions, optRun) @@ -457,7 +460,7 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = expectNoArg(switch, arg, pass, info) helpOnError(pass) of "symbolfiles": - ProcessOnOffSwitchG({optSymbolFiles}, arg, pass, info) + processOnOffSwitchG({optSymbolFiles}, arg, pass, info) of "skipcfg": expectNoArg(switch, arg, pass, info) incl(gGlobalOptions, optSkipConfigFile) @@ -517,13 +520,13 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) = case arg of "partial": idents.firstCharIsCS = true of "none": idents.firstCharIsCS = false - else: LocalError(info, errGenerated, + else: localError(info, errGenerated, "'partial' or 'none' expected, but found " & arg) else: if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg) - else: InvalidCmdLineOption(pass, switch, info) + else: invalidCmdLineOption(pass, switch, info) -proc ProcessCommand(switch: string, pass: TCmdLinePass) = +proc processCommand(switch: string, pass: TCmdLinePass) = var cmd, arg: string splitSwitch(switch, cmd, arg, pass, gCmdLineInfo) processSwitch(cmd, arg, pass, gCmdLineInfo) diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 21095072b..c79fda13e 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -16,10 +16,10 @@ import # to be style insensitive. Otherwise hell would break lose. var gSymbols: PStringTable -proc DefineSymbol*(symbol: string) = +proc defineSymbol*(symbol: string) = gSymbols[symbol] = "true" -proc UndefSymbol*(symbol: string) = +proc undefSymbol*(symbol: string) = gSymbols[symbol] = "false" proc isDefined*(symbol: string): bool = @@ -37,52 +37,52 @@ proc countDefinedSymbols*(): int = for key, val in pairs(gSymbols): if val == "true": inc(result) -proc InitDefines*() = +proc initDefines*() = gSymbols = newStringTable(modeStyleInsensitive) - DefineSymbol("nimrod") # 'nimrod' is always defined + defineSymbol("nimrod") # 'nimrod' is always defined # for bootstrapping purposes and old code: - DefineSymbol("nimhygiene") - DefineSymbol("niminheritable") - DefineSymbol("nimmixin") - DefineSymbol("nimeffects") - DefineSymbol("nimbabel") - DefineSymbol("nimcomputedgoto") + defineSymbol("nimhygiene") + defineSymbol("niminheritable") + defineSymbol("nimmixin") + defineSymbol("nimeffects") + defineSymbol("nimbabel") + defineSymbol("nimcomputedgoto") # add platform specific symbols: case targetCPU - of cpuI386: DefineSymbol("x86") - of cpuIa64: DefineSymbol("itanium") - of cpuAmd64: DefineSymbol("x8664") + of cpuI386: defineSymbol("x86") + of cpuIa64: defineSymbol("itanium") + of cpuAmd64: defineSymbol("x8664") else: discard case targetOS - of osDOS: - DefineSymbol("msdos") + of osDos: + defineSymbol("msdos") of osWindows: - DefineSymbol("mswindows") - DefineSymbol("win32") - of osLinux, osMorphOS, osSkyOS, osIrix, osPalmOS, osQNX, osAtari, osAix, + defineSymbol("mswindows") + defineSymbol("win32") + of osLinux, osMorphos, osSkyos, osIrix, osPalmos, osQnx, osAtari, osAix, osHaiku: # these are all 'unix-like' - DefineSymbol("unix") - DefineSymbol("posix") + defineSymbol("unix") + defineSymbol("posix") of osSolaris: - DefineSymbol("sunos") - DefineSymbol("unix") - DefineSymbol("posix") - of osNetBSD, osFreeBSD, osOpenBSD: - DefineSymbol("unix") - DefineSymbol("bsd") - DefineSymbol("posix") - of osMacOS: - DefineSymbol("macintosh") - of osMacOSX: - DefineSymbol("macintosh") - DefineSymbol("unix") - DefineSymbol("posix") + defineSymbol("sunos") + defineSymbol("unix") + defineSymbol("posix") + of osNetbsd, osFreebsd, osOpenbsd: + defineSymbol("unix") + defineSymbol("bsd") + defineSymbol("posix") + of osMacos: + defineSymbol("macintosh") + of osMacosx: + defineSymbol("macintosh") + defineSymbol("unix") + defineSymbol("posix") else: discard - DefineSymbol("cpu" & $cpu[targetCPU].bit) - DefineSymbol(normalize(endianToStr[cpu[targetCPU].endian])) - DefineSymbol(cpu[targetCPU].name) - DefineSymbol(platform.os[targetOS].name) + defineSymbol("cpu" & $CPU[targetCPU].bit) + defineSymbol(normalize(EndianToStr[CPU[targetCPU].endian])) + defineSymbol(CPU[targetCPU].name) + defineSymbol(platform.OS[targetOS].name) if platform.OS[targetOS].props.contains(ospLacksThreadVars): - DefineSymbol("emulatedthreadvars") + defineSymbol("emulatedthreadvars") diff --git a/compiler/crc.nim b/compiler/crc.nim index a3b181e20..ae1df3ff1 100644 --- a/compiler/crc.nim +++ b/compiler/crc.nim @@ -18,8 +18,8 @@ const InitAdler32* = int32(1) proc updateCrc32*(val: int8, crc: TCrc32): TCrc32 {.inline.} -proc updateCrc32*(val: Char, crc: TCrc32): TCrc32 {.inline.} -proc crcFromBuf*(buf: Pointer, length: int): TCrc32 +proc updateCrc32*(val: char, crc: TCrc32): TCrc32 {.inline.} +proc crcFromBuf*(buf: pointer, length: int): TCrc32 proc strCrc32*(s: string): TCrc32 proc crcFromFile*(filename: string): TCrc32 proc updateAdler32*(adler: int32, buf: pointer, length: int): int32 @@ -75,10 +75,10 @@ const 755167117] proc updateCrc32(val: int8, crc: TCrc32): TCrc32 = - result = TCrc32(crc32Table[(int(crc) xor (int(val) and 0x000000FF)) and + result = TCrc32(crc32table[(int(crc) xor (int(val) and 0x000000FF)) and 0x000000FF]) xor (crc shr TCrc32(8)) -proc updateCrc32(val: Char, crc: TCrc32): TCrc32 = +proc updateCrc32(val: char, crc: TCrc32): TCrc32 = result = updateCrc32(toU8(ord(val)), crc) proc strCrc32(s: string): TCrc32 = @@ -93,7 +93,7 @@ type TByteArray = array[0..10000000, int8] PByteArray = ref TByteArray -proc crcFromBuf(buf: Pointer, length: int): TCrc32 = +proc crcFromBuf(buf: pointer, length: int): TCrc32 = var p = cast[PByteArray](buf) result = InitCrc32 for i in countup(0, length - 1): result = updateCrc32(p[i], result) @@ -102,11 +102,11 @@ proc crcFromFile(filename: string): TCrc32 = const bufSize = 8000 # don't use 8K for the memory allocator! var - bin: tfile + bin: TFile result = InitCrc32 if not open(bin, filename): return # not equal if file does not exist - var buf = alloc(BufSize) + var buf = alloc(bufSize) var p = cast[PByteArray](buf) while true: var readBytes = readBuffer(bin, buf, bufSize) diff --git a/compiler/depends.nim b/compiler/depends.nim index 1468cbdb9..a43eaf844 100644 --- a/compiler/depends.nim +++ b/compiler/depends.nim @@ -39,11 +39,11 @@ proc addDotDependency(c: PPassContext, n: PNode): PNode = of nkStmtList, nkBlockStmt, nkStmtListExpr, nkBlockExpr: for i in countup(0, sonsLen(n) - 1): discard addDotDependency(c, n.sons[i]) else: - nil + discard proc generateDot(project: string) = writeRope(ropef("digraph $1 {$n$2}$n", [ - toRope(changeFileExt(extractFileName(project), "")), gDotGraph]), + toRope(changeFileExt(extractFilename(project), "")), gDotGraph]), changeFileExt(project, "dot")) proc myOpen(module: PSym): PPassContext = diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 9929b4bd9..343f415b3 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -11,10 +11,10 @@ # semantic checking is done for the code. Cross-references are generated # by knowing how the anchors are going to be named. -import - ast, strutils, strtabs, options, msgs, os, ropes, idents, - wordrecg, syntaxes, renderer, lexer, rstast, rst, rstgen, times, highlite, - importer, sempass2 +import + ast, strutils, strtabs, options, msgs, os, ropes, idents, + wordrecg, syntaxes, renderer, lexer, rstast, rst, rstgen, times, highlite, + importer, sempass2, json type TSections = array[TSymKind, PRope] @@ -25,7 +25,7 @@ type indexValFilename: string PDoc* = ref TDocumentor - + proc compilerMsgHandler(filename: string, line, col: int, msgKind: rst.TMsgKind, arg: string) {.procvar.} = # translate msg kind: @@ -40,70 +40,70 @@ proc compilerMsgHandler(filename: string, line, col: int, of mwRedefinitionOfLabel: k = warnRedefinitionOfLabel of mwUnknownSubstitution: k = warnUnknownSubstitutionX of mwUnsupportedLanguage: k = warnLanguageXNotSupported - GlobalError(newLineInfo(filename, line, col), k, arg) - + globalError(newLineInfo(filename, line, col), k, arg) + proc parseRst(text, filename: string, line, column: int, hasToc: var bool, rstOptions: TRstParseOptions): PRstNode = result = rstParse(text, filename, line, column, hasToc, rstOptions, - options.FindFile, compilerMsgHandler) + options.findFile, compilerMsgHandler) -proc newDocumentor*(filename: string, config: PStringTable): PDoc = +proc newDocumentor*(filename: string, config: PStringTable): PDoc = new(result) - initRstGenerator(result[], (if gCmd != cmdRst2Tex: outHtml else: outLatex), + initRstGenerator(result[], (if gCmd != cmdRst2tex: outHtml else: outLatex), options.gConfigVars, filename, {roSupportRawDirective}, - options.FindFile, compilerMsgHandler) + options.findFile, compilerMsgHandler) result.id = 100 -proc dispA(dest: var PRope, xml, tex: string, args: openarray[PRope]) = - if gCmd != cmdRst2Tex: appf(dest, xml, args) +proc dispA(dest: var PRope, xml, tex: string, args: openArray[PRope]) = + if gCmd != cmdRst2tex: appf(dest, xml, args) else: appf(dest, tex, args) - -proc getVarIdx(varnames: openarray[string], id: string): int = - for i in countup(0, high(varnames)): - if cmpIgnoreStyle(varnames[i], id) == 0: + +proc getVarIdx(varnames: openArray[string], id: string): int = + for i in countup(0, high(varnames)): + if cmpIgnoreStyle(varnames[i], id) == 0: return i result = -1 -proc ropeFormatNamedVars(frmt: TFormatStr, varnames: openarray[string], - varvalues: openarray[PRope]): PRope = +proc ropeFormatNamedVars(frmt: TFormatStr, varnames: openArray[string], + varvalues: openArray[PRope]): PRope = var i = 0 var L = len(frmt) result = nil var num = 0 - while i < L: - if frmt[i] == '$': + while i < L: + if frmt[i] == '$': inc(i) # skip '$' case frmt[i] - of '#': + of '#': app(result, varvalues[num]) inc(num) inc(i) - of '$': + of '$': app(result, "$") inc(i) - of '0'..'9': + of '0'..'9': var j = 0 - while true: - j = (j * 10) + Ord(frmt[i]) - ord('0') + while true: + j = (j * 10) + ord(frmt[i]) - ord('0') inc(i) - if (i > L + 0 - 1) or not (frmt[i] in {'0'..'9'}): break + if (i > L + 0 - 1) or not (frmt[i] in {'0'..'9'}): break if j > high(varvalues) + 1: internalError("ropeFormatNamedVars") num = j app(result, varvalues[j - 1]) - of 'A'..'Z', 'a'..'z', '\x80'..'\xFF': + of 'A'..'Z', 'a'..'z', '\x80'..'\xFF': var id = "" - while true: + while true: add(id, frmt[i]) inc(i) - if not (frmt[i] in {'A'..'Z', '_', 'a'..'z', '\x80'..'\xFF'}): break + if not (frmt[i] in {'A'..'Z', '_', 'a'..'z', '\x80'..'\xFF'}): break var idx = getVarIdx(varnames, id) if idx >= 0: app(result, varvalues[idx]) else: rawMessage(errUnkownSubstitionVar, id) - of '{': + of '{': var id = "" inc(i) - while frmt[i] != '}': + while frmt[i] != '}': if frmt[i] == '\0': rawMessage(errTokenExpected, "}") add(id, frmt[i]) inc(i) @@ -112,7 +112,7 @@ proc ropeFormatNamedVars(frmt: TFormatStr, varnames: openarray[string], var idx = getVarIdx(varnames, id) if idx >= 0: app(result, varvalues[idx]) else: rawMessage(errUnkownSubstitionVar, id) - else: InternalError("ropeFormatNamedVars") + else: internalError("ropeFormatNamedVars") var start = i while i < L: if frmt[i] != '$': inc(i) @@ -124,17 +124,17 @@ proc genComment(d: PDoc, n: PNode): string = var dummyHasToc: bool if n.comment != nil and startsWith(n.comment, "##"): renderRstToOut(d[], parseRst(n.comment, toFilename(n.info), - toLineNumber(n.info), toColumn(n.info), + toLinenumber(n.info), toColumn(n.info), dummyHasToc, d.options + {roSkipPounds}), result) -proc genRecComment(d: PDoc, n: PNode): PRope = +proc genRecComment(d: PDoc, n: PNode): PRope = if n == nil: return nil result = genComment(d, n).toRope - if result == nil: + if result == nil: if n.kind notin {nkEmpty..nkNilLit}: for i in countup(0, len(n)-1): result = genRecComment(d, n.sons[i]) - if result != nil: return + if result != nil: return else: n.comment = nil @@ -152,16 +152,16 @@ proc extractDocComment*(s: PSym, d: PDoc = nil): string = if not d.isNil: var dummyHasToc: bool renderRstToOut(d[], parseRst(n.comment, toFilename(n.info), - toLineNumber(n.info), toColumn(n.info), + toLinenumber(n.info), toColumn(n.info), dummyHasToc, d.options + {roSkipPounds}), result) else: result = n.comment.substr(2).replace("\n##", "\n").strip -proc isVisible(n: PNode): bool = +proc isVisible(n: PNode): bool = result = false - if n.kind == nkPostfix: - if n.len == 2 and n.sons[0].kind == nkIdent: + if n.kind == nkPostfix: + if n.len == 2 and n.sons[0].kind == nkIdent: var v = n.sons[0].ident result = v.id == ord(wStar) or v.id == ord(wMinus) elif n.kind == nkSym: @@ -171,36 +171,36 @@ proc isVisible(n: PNode): bool = result = {sfExported, sfFromGeneric, sfForward}*n.sym.flags == {sfExported} elif n.kind == nkPragmaExpr: result = isVisible(n.sons[0]) - -proc getName(d: PDoc, n: PNode, splitAfter = -1): string = + +proc getName(d: PDoc, n: PNode, splitAfter = -1): string = case n.kind of nkPostfix: result = getName(d, n.sons[1], splitAfter) of nkPragmaExpr: result = getName(d, n.sons[0], splitAfter) of nkSym: result = esc(d.target, n.sym.renderDefinitionName, splitAfter) of nkIdent: result = esc(d.target, n.ident.s, splitAfter) - of nkAccQuoted: - result = esc(d.target, "`") + of nkAccQuoted: + result = esc(d.target, "`") for i in 0.. <n.len: result.add(getName(d, n[i], splitAfter)) result.add esc(d.target, "`") else: internalError(n.info, "getName()") result = "" -proc getRstName(n: PNode): PRstNode = +proc getRstName(n: PNode): PRstNode = case n.kind of nkPostfix: result = getRstName(n.sons[1]) of nkPragmaExpr: result = getRstName(n.sons[0]) of nkSym: result = newRstNode(rnLeaf, n.sym.renderDefinitionName) of nkIdent: result = newRstNode(rnLeaf, n.ident.s) - of nkAccQuoted: + of nkAccQuoted: result = getRstName(n.sons[0]) for i in 1 .. <n.len: result.text.add(getRstName(n[i]).text) else: internalError(n.info, "getRstName()") result = nil -proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) = - if not isVisible(nameNode): return +proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) = + if not isVisible(nameNode): return var name = toRope(getName(d, nameNode)) var result: PRope = nil var literal = "" @@ -208,73 +208,89 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) = var comm = genRecComment(d, n) # call this here for the side-effect! var r: TSrcGen initTokRender(r, n, {renderNoBody, renderNoComments, renderDocComments}) - while true: + while true: getNextTok(r, kind, literal) case kind - of tkEof: - break - of tkComment: - dispA(result, "<span class=\"Comment\">$1</span>", "\\spanComment{$1}", + of tkEof: + break + of tkComment: + dispA(result, "<span class=\"Comment\">$1</span>", "\\spanComment{$1}", [toRope(esc(d.target, literal))]) - of tokKeywordLow..tokKeywordHigh: - dispA(result, "<span class=\"Keyword\">$1</span>", "\\spanKeyword{$1}", + of tokKeywordLow..tokKeywordHigh: + dispA(result, "<span class=\"Keyword\">$1</span>", "\\spanKeyword{$1}", [toRope(literal)]) - of tkOpr: - dispA(result, "<span class=\"Operator\">$1</span>", "\\spanOperator{$1}", + of tkOpr: + dispA(result, "<span class=\"Operator\">$1</span>", "\\spanOperator{$1}", [toRope(esc(d.target, literal))]) - of tkStrLit..tkTripleStrLit: - dispA(result, "<span class=\"StringLit\">$1</span>", + of tkStrLit..tkTripleStrLit: + dispA(result, "<span class=\"StringLit\">$1</span>", "\\spanStringLit{$1}", [toRope(esc(d.target, literal))]) - of tkCharLit: - dispA(result, "<span class=\"CharLit\">$1</span>", "\\spanCharLit{$1}", + of tkCharLit: + dispA(result, "<span class=\"CharLit\">$1</span>", "\\spanCharLit{$1}", [toRope(esc(d.target, literal))]) - of tkIntLit..tkUInt64Lit: - dispA(result, "<span class=\"DecNumber\">$1</span>", + of tkIntLit..tkUInt64Lit: + dispA(result, "<span class=\"DecNumber\">$1</span>", "\\spanDecNumber{$1}", [toRope(esc(d.target, literal))]) - of tkFloatLit..tkFloat128Lit: - dispA(result, "<span class=\"FloatNumber\">$1</span>", + of tkFloatLit..tkFloat128Lit: + dispA(result, "<span class=\"FloatNumber\">$1</span>", "\\spanFloatNumber{$1}", [toRope(esc(d.target, literal))]) - of tkSymbol: - dispA(result, "<span class=\"Identifier\">$1</span>", + of tkSymbol: + dispA(result, "<span class=\"Identifier\">$1</span>", "\\spanIdentifier{$1}", [toRope(esc(d.target, literal))]) - of tkSpaces, tkInvalid: + of tkSpaces, tkInvalid: app(result, literal) - of tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, tkCurlyRi, - tkBracketDotLe, tkBracketDotRi, tkCurlyDotLe, tkCurlyDotRi, tkParDotLe, - tkParDotRi, tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot, - tkAccent, tkColonColon, - tkGStrLit, tkGTripleStrLit, tkInfixOpr, tkPrefixOpr, tkPostfixOpr: - dispA(result, "<span class=\"Other\">$1</span>", "\\spanOther{$1}", + of tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, tkCurlyRi, + tkBracketDotLe, tkBracketDotRi, tkCurlyDotLe, tkCurlyDotRi, tkParDotLe, + tkParDotRi, tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot, + tkAccent, tkColonColon, + tkGStrLit, tkGTripleStrLit, tkInfixOpr, tkPrefixOpr, tkPostfixOpr: + dispA(result, "<span class=\"Other\">$1</span>", "\\spanOther{$1}", [toRope(esc(d.target, literal))]) inc(d.id) - app(d.section[k], ropeFormatNamedVars(getConfigVar("doc.item"), - ["name", "header", "desc", "itemID"], + app(d.section[k], ropeFormatNamedVars(getConfigVar("doc.item"), + ["name", "header", "desc", "itemID"], [name, result, comm, toRope(d.id)])) - app(d.toc[k], ropeFormatNamedVars(getConfigVar("doc.item.toc"), + app(d.toc[k], ropeFormatNamedVars(getConfigVar("doc.item.toc"), ["name", "header", "desc", "itemID"], [ toRope(getName(d, nameNode, d.splitAfter)), result, comm, toRope(d.id)])) setIndexTerm(d[], $d.id, getName(d, nameNode)) -proc checkForFalse(n: PNode): bool = - result = n.kind == nkIdent and IdentEq(n.ident, "false") - -proc traceDeps(d: PDoc, n: PNode) = +proc genJSONItem(d: PDoc, n, nameNode: PNode, k: TSymKind): PJsonNode = + if not isVisible(nameNode): return + var + name = getName(d, nameNode) + comm = genRecComment(d, n).ropeToStr() + r: TSrcGen + + initTokRender(r, n, {renderNoBody, renderNoComments, renderDocComments}) + + result = %{ "name": %name, "type": %($k) } + + if comm != nil and comm != "": + result["description"] = %comm + if r.buf != nil: + result["code"] = %r.buf + +proc checkForFalse(n: PNode): bool = + result = n.kind == nkIdent and identEq(n.ident, "false") + +proc traceDeps(d: PDoc, n: PNode) = const k = skModule if d.section[k] != nil: app(d.section[k], ", ") - dispA(d.section[k], - "<a class=\"reference external\" href=\"$1.html\">$1</a>", + dispA(d.section[k], + "<a class=\"reference external\" href=\"$1.html\">$1</a>", "$1", [toRope(getModuleName(n))]) -proc generateDoc*(d: PDoc, n: PNode) = +proc generateDoc*(d: PDoc, n: PNode) = case n.kind of nkCommentStmt: app(d.modDesc, genComment(d, n)) - of nkProcDef: + of nkProcDef: when useEffectSystem: documentRaises(n) genItem(d, n, n.sons[namePos], skProc) of nkMethodDef: when useEffectSystem: documentRaises(n) genItem(d, n, n.sons[namePos], skMethod) - of nkIteratorDef: + of nkIteratorDef: when useEffectSystem: documentRaises(n) genItem(d, n, n.sons[namePos], skIterator) of nkMacroDef: genItem(d, n, n.sons[namePos], skMacro) @@ -284,27 +300,69 @@ proc generateDoc*(d: PDoc, n: PNode) = genItem(d, n, n.sons[namePos], skConverter) of nkTypeSection, nkVarSection, nkLetSection, nkConstSection: for i in countup(0, sonsLen(n) - 1): - if n.sons[i].kind != nkCommentStmt: + if n.sons[i].kind != nkCommentStmt: # order is always 'type var let const': - genItem(d, n.sons[i], n.sons[i].sons[0], + genItem(d, n.sons[i], n.sons[i].sons[0], succ(skType, ord(n.kind)-ord(nkTypeSection))) - of nkStmtList: + of nkStmtList: for i in countup(0, sonsLen(n) - 1): generateDoc(d, n.sons[i]) - of nkWhenStmt: + of nkWhenStmt: # generate documentation for the first branch only: if not checkForFalse(n.sons[0].sons[0]): generateDoc(d, lastSon(n.sons[0])) of nkImportStmt: - for i in 0 .. sonsLen(n)-1: traceDeps(d, n.sons[i]) + for i in 0 .. sonsLen(n)-1: traceDeps(d, n.sons[i]) of nkFromStmt, nkImportExceptStmt: traceDeps(d, n.sons[0]) - else: nil + else: discard + +proc generateJson(d: PDoc, n: PNode, jArray: PJsonNode = nil): PJsonNode = + case n.kind + of nkCommentStmt: + if n.comment != nil and startsWith(n.comment, "##"): + let stripped = n.comment.substr(2).strip + result = %{ "comment": %stripped } + of nkProcDef: + when useEffectSystem: documentRaises(n) + result = genJSONItem(d, n, n.sons[namePos], skProc) + of nkMethodDef: + when useEffectSystem: documentRaises(n) + result = genJSONItem(d, n, n.sons[namePos], skMethod) + of nkIteratorDef: + when useEffectSystem: documentRaises(n) + result = genJSONItem(d, n, n.sons[namePos], skIterator) + of nkMacroDef: + result = genJSONItem(d, n, n.sons[namePos], skMacro) + of nkTemplateDef: + result = genJSONItem(d, n, n.sons[namePos], skTemplate) + of nkConverterDef: + when useEffectSystem: documentRaises(n) + result = genJSONItem(d, n, n.sons[namePos], skConverter) + of nkTypeSection, nkVarSection, nkLetSection, nkConstSection: + for i in countup(0, sonsLen(n) - 1): + if n.sons[i].kind != nkCommentStmt: + # order is always 'type var let const': + result = genJSONItem(d, n.sons[i], n.sons[i].sons[0], + succ(skType, ord(n.kind)-ord(nkTypeSection))) + of nkStmtList: + var elem = jArray + if elem == nil: elem = newJArray() + for i in countup(0, sonsLen(n) - 1): + var r = generateJson(d, n.sons[i], elem) + if r != nil: + elem.add(r) + if result == nil: result = elem + of nkWhenStmt: + # generate documentation for the first branch only: + if not checkForFalse(n.sons[0].sons[0]) and jArray != nil: + discard generateJson(d, lastSon(n.sons[0]), jArray) + else: discard -proc genSection(d: PDoc, kind: TSymKind) = +proc genSection(d: PDoc, kind: TSymKind) = const sectionNames: array[skModule..skTemplate, string] = [ - "Imports", "Types", "Vars", "Lets", "Consts", "Vars", "Procs", "Methods", + "Imports", "Types", "Vars", "Lets", "Consts", "Vars", "Procs", "Methods", "Iterators", "Converters", "Macros", "Templates" ] - if d.section[kind] == nil: return + if d.section[kind] == nil: return var title = sectionNames[kind].toRope d.section[kind] = ropeFormatNamedVars(getConfigVar("doc.section"), [ "sectionid", "sectionTitle", "sectionTitleID", "content"], [ @@ -313,7 +371,7 @@ proc genSection(d: PDoc, kind: TSymKind) = "sectionid", "sectionTitle", "sectionTitleID", "content"], [ ord(kind).toRope, title, toRope(ord(kind) + 50), d.toc[kind]]) -proc genOutFile(d: PDoc): PRope = +proc genOutFile(d: PDoc): PRope = var code, content: PRope title = "" @@ -321,7 +379,7 @@ proc genOutFile(d: PDoc): PRope = var tmp = "" renderTocEntries(d[], j, 1, tmp) var toc = tmp.toRope - for i in countup(low(TSymKind), high(TSymKind)): + for i in countup(low(TSymKind), high(TSymKind)): genSection(d, i) app(toc, d.toc[i]) if toc != nil: @@ -329,46 +387,46 @@ proc genOutFile(d: PDoc): PRope = for i in countup(low(TSymKind), high(TSymKind)): app(code, d.section[i]) if d.meta[metaTitle].len != 0: title = d.meta[metaTitle] else: title = "Module " & extractFilename(changeFileExt(d.filename, "")) - + let bodyname = if d.hasToc: "doc.body_toc" else: "doc.body_no_toc" - content = ropeFormatNamedVars(getConfigVar(bodyname), ["title", + content = ropeFormatNamedVars(getConfigVar(bodyname), ["title", "tableofcontents", "moduledesc", "date", "time", "content"], - [title.toRope, toc, d.modDesc, toRope(getDateStr()), + [title.toRope, toc, d.modDesc, toRope(getDateStr()), toRope(getClockStr()), code]) - if optCompileOnly notin gGlobalOptions: + if optCompileOnly notin gGlobalOptions: # XXX what is this hack doing here? 'optCompileOnly' means raw output!? - code = ropeFormatNamedVars(getConfigVar("doc.file"), ["title", - "tableofcontents", "moduledesc", "date", "time", - "content", "author", "version"], - [title.toRope, toc, d.modDesc, toRope(getDateStr()), - toRope(getClockStr()), content, d.meta[metaAuthor].toRope, + code = ropeFormatNamedVars(getConfigVar("doc.file"), ["title", + "tableofcontents", "moduledesc", "date", "time", + "content", "author", "version"], + [title.toRope, toc, d.modDesc, toRope(getDateStr()), + toRope(getClockStr()), content, d.meta[metaAuthor].toRope, d.meta[metaVersion].toRope]) - else: + else: code = content result = code proc generateIndex*(d: PDoc) = if optGenIndex in gGlobalOptions: - writeIndexFile(d[], splitFile(options.outFile).dir / - splitFile(d.filename).name & indexExt) + writeIndexFile(d[], splitFile(options.outFile).dir / + splitFile(d.filename).name & IndexExt) -proc writeOutput*(d: PDoc, filename, outExt: string, useWarning = false) = +proc writeOutput*(d: PDoc, filename, outExt: string, useWarning = false) = var content = genOutFile(d) if optStdout in gGlobalOptions: writeRope(stdout, content) else: writeRope(content, getOutFile(filename, outExt), useWarning) -proc CommandDoc*() = +proc commandDoc*() = var ast = parseFile(gProjectMainIdx) - if ast == nil: return + if ast == nil: return var d = newDocumentor(gProjectFull, options.gConfigVars) d.hasToc = true generateDoc(d, ast) writeOutput(d, gProjectFull, HtmlExt) generateIndex(d) -proc CommandRstAux(filename, outExt: string) = +proc commandRstAux(filename, outExt: string) = var filen = addFileExt(filename, "txt") var d = newDocumentor(filen, options.gConfigVars) var rst = parseRst(readFile(filen), filen, 0, 1, d.hasToc, @@ -381,19 +439,33 @@ proc CommandRstAux(filename, outExt: string) = writeOutput(d, filename, outExt) generateIndex(d) -proc CommandRst2Html*() = - CommandRstAux(gProjectFull, HtmlExt) +proc commandRst2Html*() = + commandRstAux(gProjectFull, HtmlExt) -proc CommandRst2TeX*() = +proc commandRst2TeX*() = splitter = "\\-" - CommandRstAux(gProjectFull, TexExt) + commandRstAux(gProjectFull, TexExt) -proc CommandBuildIndex*() = +proc commandJSON*() = + var ast = parseFile(gProjectMainIdx) + if ast == nil: return + var d = newDocumentor(gProjectFull, options.gConfigVars) + d.hasToc = true + var json = generateJson(d, ast) + var content = newRope(pretty(json)) + + if optStdout in gGlobalOptions: + writeRope(stdout, content) + else: + echo getOutFile(gProjectFull, JsonExt) + writeRope(content, getOutFile(gProjectFull, JsonExt), useWarning = false) + +proc commandBuildIndex*() = var content = mergeIndexes(gProjectFull).toRope - - let code = ropeFormatNamedVars(getConfigVar("doc.file"), ["title", - "tableofcontents", "moduledesc", "date", "time", - "content", "author", "version"], - ["Index".toRope, nil, nil, toRope(getDateStr()), + + let code = ropeFormatNamedVars(getConfigVar("doc.file"), ["title", + "tableofcontents", "moduledesc", "date", "time", + "content", "author", "version"], + ["Index".toRope, nil, nil, toRope(getDateStr()), toRope(getClockStr()), content, nil, nil]) writeRope(code, getOutFile("theindex", HtmlExt)) diff --git a/compiler/docgen2.nim b/compiler/docgen2.nim index d48f53d15..d76be8e3c 100644 --- a/compiler/docgen2.nim +++ b/compiler/docgen2.nim @@ -27,7 +27,7 @@ proc close(p: PPassContext, n: PNode): PNode = try: generateIndex(g.doc) except EIO: - nil + discard proc processNode(c: PPassContext, n: PNode): PNode = result = n @@ -46,4 +46,4 @@ proc myOpen(module: PSym): PPassContext = const docgen2Pass* = makePass(open = myOpen, process = processNode, close = close) proc finishDoc2Pass*(project: string) = - nil + discard diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index 21a131996..54be0ccb2 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -9,7 +9,7 @@ ## This file implements the FFI part of the evaluator for Nimrod code. -import ast, astalgo, ropes, types, options, tables, dynlib, libffi, msgs +import ast, astalgo, ropes, types, options, tables, dynlib, libffi, msgs, os when defined(windows): const libcDll = "msvcrt.dll" @@ -20,7 +20,11 @@ type TDllCache = tables.TTable[string, TLibHandle] var gDllCache = initTable[string, TLibHandle]() - gExeHandle = LoadLib() + +when defined(windows): + var gExeHandle = loadLib(os.getAppFilename()) +else: + var gExeHandle = loadLib() proc getDll(cache: var TDllCache; dll: string; info: TLineInfo): pointer = result = cache[dll] @@ -28,15 +32,17 @@ proc getDll(cache: var TDllCache; dll: string; info: TLineInfo): pointer = var libs: seq[string] = @[] libCandidates(dll, libs) for c in libs: - result = LoadLib(c) + result = loadLib(c) if not result.isNil: break if result.isNil: - GlobalError(info, "cannot load: " & dll) + globalError(info, "cannot load: " & dll) cache[dll] = result const nkPtrLit = nkIntLit # hopefully we can get rid of this hack soon +var myerrno {.importc: "errno", header: "<errno.h>".}: cint ## error variable + proc importcSymbol*(sym: PSym): PNode = let name = ropeToStr(sym.loc.r) @@ -47,10 +53,11 @@ proc importcSymbol*(sym: PSym): PNode = of "stdin": result.intVal = cast[TAddress](system.stdin) of "stdout": result.intVal = cast[TAddress](system.stdout) of "stderr": result.intVal = cast[TAddress](system.stderr) + of "vmErrnoWrapper": result.intVal = cast[TAddress](myerrno) else: let lib = sym.annex if lib != nil and lib.path.kind notin {nkStrLit..nkTripleStrLit}: - GlobalError(sym.info, "dynlib needs to be a string lit for the REPL") + globalError(sym.info, "dynlib needs to be a string lit for the REPL") var theAddr: pointer if lib.isNil and not gExehandle.isNil: # first try this exe itself: @@ -58,10 +65,12 @@ proc importcSymbol*(sym: PSym): PNode = # then try libc: if theAddr.isNil: let dllhandle = gDllCache.getDll(libcDll, sym.info) - theAddr = dllhandle.checkedSymAddr(name) - else: - let dllhandle = gDllCache.getDll(lib.path.strVal, sym.info) - theAddr = dllhandle.checkedSymAddr(name) + theAddr = dllhandle.symAddr(name) + elif not lib.isNil: + let dllhandle = gDllCache.getDll(if lib.kind == libHeader: libcDll + else: lib.path.strVal, sym.info) + theAddr = dllhandle.symAddr(name) + if theAddr.isNil: globalError(sym.info, "cannot import: " & sym.name.s) result.intVal = cast[TAddress](theAddr) proc mapType(t: ast.PType): ptr libffi.TType = @@ -78,7 +87,7 @@ proc mapType(t: ast.PType): ptr libffi.TType = of tyFloat, tyFloat64: result = addr libffi.type_double of tyFloat32: result = addr libffi.type_float of tyVar, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString, tyExpr, - tyStmt, tyTypeDesc, tyProc, tyArray, tyArrayConstr, tyNil: + tyStmt, tyTypeDesc, tyProc, tyArray, tyArrayConstr, tyStatic, tyNil: result = addr libffi.type_pointer of tyDistinct: result = mapType(t.sons[0]) @@ -93,7 +102,7 @@ proc mapCallConv(cc: TCallingConvention, info: TLineInfo): TABI = of ccStdCall: result = when defined(windows): STDCALL else: DEFAULT_ABI of ccCDecl: result = DEFAULT_ABI else: - GlobalError(info, "cannot map calling convention to FFI") + globalError(info, "cannot map calling convention to FFI") template rd(T, p: expr): expr {.immediate.} = (cast[ptr T](p))[] template wr(T, p, v: expr) {.immediate.} = (cast[ptr T](p))[] = v @@ -139,7 +148,7 @@ proc getField(n: PNode; position: int): PSym = else: internalError(n.info, "getField(record case branch)") of nkSym: if n.sym.position == position: result = n.sym - else: nil + else: discard proc packObject(x: PNode, typ: PType, res: pointer) = InternalAssert x.kind in {nkObjConstr, nkPar} @@ -155,7 +164,7 @@ proc packObject(x: PNode, typ: PType, res: pointer) = let field = getField(typ.n, i) pack(it, field.typ, res +! field.offset) else: - GlobalError(x.info, "cannot pack unnamed tuple") + globalError(x.info, "cannot pack unnamed tuple") const maxPackDepth = 20 var packRecCheck = 0 @@ -184,7 +193,7 @@ proc pack(v: PNode, typ: PType, res: pointer) = of 4: awr(int32, v.intVal.int32) of 8: awr(int64, v.intVal.int64) else: - GlobalError(v.info, "cannot map value to FFI (tyEnum, tySet)") + globalError(v.info, "cannot map value to FFI (tyEnum, tySet)") of tyFloat: awr(float, v.floatVal) of tyFloat32: awr(float32, v.floatVal) of tyFloat64: awr(float64, v.floatVal) @@ -192,23 +201,23 @@ proc pack(v: PNode, typ: PType, res: pointer) = of tyPointer, tyProc, tyCString, tyString: if v.kind == nkNilLit: # nothing to do since the memory is 0 initialized anyway - nil + discard elif v.kind == nkPtrLit: awr(pointer, cast[pointer](v.intVal)) elif v.kind in {nkStrLit..nkTripleStrLit}: awr(cstring, cstring(v.strVal)) else: - GlobalError(v.info, "cannot map pointer/proc value to FFI") + globalError(v.info, "cannot map pointer/proc value to FFI") of tyPtr, tyRef, tyVar: if v.kind == nkNilLit: # nothing to do since the memory is 0 initialized anyway - nil + discard elif v.kind == nkPtrLit: awr(pointer, cast[pointer](v.intVal)) else: if packRecCheck > maxPackDepth: packRecCheck = 0 - GlobalError(v.info, "cannot map value to FFI " & typeToString(v.typ)) + globalError(v.info, "cannot map value to FFI " & typeToString(v.typ)) inc packRecCheck pack(v.sons[0], typ.sons[0], res +! sizeof(pointer)) dec packRecCheck @@ -220,11 +229,11 @@ proc pack(v: PNode, typ: PType, res: pointer) = of tyObject, tyTuple: packObject(v, typ, res) of tyNil: - nil + discard of tyDistinct, tyGenericInst: pack(v, typ.sons[0], res) else: - GlobalError(v.info, "cannot map value to FFI " & typeToString(v.typ)) + globalError(v.info, "cannot map value to FFI " & typeToString(v.typ)) proc unpack(x: pointer, typ: PType, n: PNode): PNode @@ -234,14 +243,14 @@ proc unpackObjectAdd(x: pointer, n, result: PNode) = for i in countup(0, sonsLen(n) - 1): unpackObjectAdd(x, n.sons[i], result) of nkRecCase: - GlobalError(result.info, "case objects cannot be unpacked") + globalError(result.info, "case objects cannot be unpacked") of nkSym: var pair = newNodeI(nkExprColonExpr, result.info, 2) pair.sons[0] = n pair.sons[1] = unpack(x +! n.sym.offset, n.sym.typ, nil) #echo "offset: ", n.sym.name.s, " ", n.sym.offset result.add pair - else: nil + else: discard proc unpackObject(x: pointer, typ: PType, n: PNode): PNode = # compute the field's offsets: @@ -253,14 +262,14 @@ proc unpackObject(x: pointer, typ: PType, n: PNode): PNode = result = newNode(nkPar) result.typ = typ if typ.n.isNil: - InternalError("cannot unpack unnamed tuple") + internalError("cannot unpack unnamed tuple") unpackObjectAdd(x, typ.n, result) else: result = n if result.kind notin {nkObjConstr, nkPar}: - GlobalError(n.info, "cannot map value from FFI") + globalError(n.info, "cannot map value from FFI") if typ.n.isNil: - GlobalError(n.info, "cannot unpack unnamed tuple") + globalError(n.info, "cannot unpack unnamed tuple") for i in countup(ord(n.kind == nkObjConstr), sonsLen(n) - 1): var it = n.sons[i] if it.kind == nkExprColonExpr: @@ -279,7 +288,7 @@ proc unpackArray(x: pointer, typ: PType, n: PNode): PNode = else: result = n if result.kind != nkBracket: - GlobalError(n.info, "cannot map value from FFI") + globalError(n.info, "cannot map value from FFI") let baseSize = typ.sons[1].getSize for i in 0 .. < result.len: result.sons[i] = unpack(x +! i * baseSize, typ.sons[1], result.sons[i]) @@ -303,7 +312,7 @@ proc unpack(x: pointer, typ: PType, n: PNode): PNode = #echo "expected ", k, " but got ", result.kind #debug result return newNodeI(nkExceptBranch, n.info) - #GlobalError(n.info, "cannot map value from FFI") + #globalError(n.info, "cannot map value from FFI") result.field = v template setNil() = @@ -328,19 +337,19 @@ proc unpack(x: pointer, typ: PType, n: PNode): PNode = of tyInt16: awi(nkInt16Lit, rd(int16, x)) of tyInt32: awi(nkInt32Lit, rd(int32, x)) of tyInt64: awi(nkInt64Lit, rd(int64, x)) - of tyUInt: awi(nkUIntLit, rd(uint, x).biggestInt) - of tyUInt8: awi(nkUInt8Lit, rd(uint8, x).biggestInt) - of tyUInt16: awi(nkUInt16Lit, rd(uint16, x).biggestInt) - of tyUInt32: awi(nkUInt32Lit, rd(uint32, x).biggestInt) - of tyUInt64: awi(nkUInt64Lit, rd(uint64, x).biggestInt) + of tyUInt: awi(nkUIntLit, rd(uint, x).BiggestInt) + of tyUInt8: awi(nkUInt8Lit, rd(uint8, x).BiggestInt) + of tyUInt16: awi(nkUInt16Lit, rd(uint16, x).BiggestInt) + of tyUInt32: awi(nkUInt32Lit, rd(uint32, x).BiggestInt) + of tyUInt64: awi(nkUInt64Lit, rd(uint64, x).BiggestInt) of tyEnum: case typ.getSize - of 1: awi(nkIntLit, rd(uint8, x).biggestInt) - of 2: awi(nkIntLit, rd(uint16, x).biggestInt) - of 4: awi(nkIntLit, rd(int32, x).biggestInt) - of 8: awi(nkIntLit, rd(int64, x).biggestInt) + of 1: awi(nkIntLit, rd(uint8, x).BiggestInt) + of 2: awi(nkIntLit, rd(uint16, x).BiggestInt) + of 4: awi(nkIntLit, rd(int32, x).BiggestInt) + of 8: awi(nkIntLit, rd(int64, x).BiggestInt) else: - GlobalError(n.info, "cannot map value from FFI (tyEnum, tySet)") + globalError(n.info, "cannot map value from FFI (tyEnum, tySet)") of tyFloat: awf(nkFloatLit, rd(float, x)) of tyFloat32: awf(nkFloat32Lit, rd(float32, x)) of tyFloat64: awf(nkFloat64Lit, rd(float64, x)) @@ -365,7 +374,7 @@ proc unpack(x: pointer, typ: PType, n: PNode): PNode = n.sons[0] = unpack(p, typ.sons[0], n.sons[0]) result = n else: - GlobalError(n.info, "cannot map value from FFI " & typeToString(typ)) + globalError(n.info, "cannot map value from FFI " & typeToString(typ)) of tyObject, tyTuple: result = unpackObject(x, typ, n) of tyArray, tyArrayConstr: @@ -382,7 +391,7 @@ proc unpack(x: pointer, typ: PType, n: PNode): PNode = result = unpack(x, typ.sons[0], n) else: # XXX what to do with 'array' here? - GlobalError(n.info, "cannot map value from FFI " & typeToString(typ)) + globalError(n.info, "cannot map value from FFI " & typeToString(typ)) proc fficast*(x: PNode, destTyp: PType): PNode = if x.kind == nkPtrLit and x.typ.kind in {tyPtr, tyRef, tyVar, tyPointer, @@ -405,7 +414,7 @@ proc fficast*(x: PNode, destTyp: PType): PNode = dealloc a proc callForeignFunction*(call: PNode): PNode = - InternalAssert call.sons[0].kind == nkPtrLit + internalAssert call.sons[0].kind == nkPtrLit var cif: TCif var sig: TParamList @@ -413,12 +422,12 @@ proc callForeignFunction*(call: PNode): PNode = for i in 1..call.len-1: sig[i-1] = mapType(call.sons[i].typ) if sig[i-1].isNil: - GlobalError(call.info, "cannot map FFI type") + globalError(call.info, "cannot map FFI type") let typ = call.sons[0].typ if prep_cif(cif, mapCallConv(typ.callConv, call.info), cuint(call.len-1), mapType(typ.sons[0]), sig) != OK: - GlobalError(call.info, "error in FFI call") + globalError(call.info, "error in FFI call") var args: TArgList let fn = cast[pointer](call.sons[0].intVal) @@ -441,3 +450,46 @@ proc callForeignFunction*(call: PNode): PNode = for i in 1 .. call.len-1: call.sons[i] = unpack(args[i-1], typ.sons[i], call[i]) dealloc args[i-1] + +proc callForeignFunction*(fn: PNode, fntyp: PType, + args: var TNodeSeq, start, len: int, + info: TLineInfo): PNode = + internalAssert fn.kind == nkPtrLit + + var cif: TCif + var sig: TParamList + for i in 0..len-1: + var aTyp = args[i+start].typ + if aTyp.isNil: + internalAssert i+1 < fntyp.len + aTyp = fntyp.sons[i+1] + args[i+start].typ = aTyp + sig[i] = mapType(aTyp) + if sig[i].isNil: globalError(info, "cannot map FFI type") + + if prep_cif(cif, mapCallConv(fntyp.callConv, info), cuint(len), + mapType(fntyp.sons[0]), sig) != OK: + globalError(info, "error in FFI call") + + var cargs: TArgList + let fn = cast[pointer](fn.intVal) + for i in 0 .. len-1: + let t = args[i+start].typ + cargs[i] = alloc0(packSize(args[i+start], t)) + pack(args[i+start], t, cargs[i]) + let retVal = if isEmptyType(fntyp.sons[0]): pointer(nil) + else: alloc(fntyp.sons[0].getSize.int) + + libffi.call(cif, fn, retVal, cargs) + + if retVal.isNil: + result = emptyNode + else: + result = unpack(retVal, fntyp.sons[0], nil) + result.info = info + + if retVal != nil: dealloc retVal + for i in 0 .. len-1: + let t = args[i+start].typ + args[i+start] = unpack(cargs[i], t, args[i+start]) + dealloc cargs[i] diff --git a/compiler/evals.nim b/compiler/evals.nim index 7e2c8a41d..151adf690 100644 --- a/compiler/evals.nim +++ b/compiler/evals.nim @@ -91,6 +91,7 @@ proc evalMacroCall*(c: PEvalContext, n, nOrig: PNode, sym: PSym): PNode proc evalAux(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode proc raiseCannotEval(c: PEvalContext, info: TLineInfo): PNode = + if defined(debug) and gVerbosity >= 3: writeStackTrace() result = newNodeI(nkExceptBranch, info) # creating a nkExceptBranch without sons # means that it could not be evaluated @@ -263,8 +264,8 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode = result = newNodeIT(nkUIntLit, info, t) of tyFloat..tyFloat128: result = newNodeIt(nkFloatLit, info, t) - of tyVar, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString, tyExpr, - tyStmt, tyTypeDesc, tyProc: + of tyVar, tyPointer, tyPtr, tyRef, tyCString, tySequence, tyString, tyExpr, + tyStmt, tyTypeDesc, tyStatic, tyProc: result = newNodeIT(nkNilLit, info, t) of tyObject: result = newNodeIT(nkPar, info, t) @@ -358,7 +359,7 @@ proc evalVar(c: PEvalContext, n: PNode): PNode = proc aliasNeeded(n: PNode, flags: TEvalFlags): bool = result = efLValue in flags or n.typ == nil or - n.typ.kind in {tyExpr, tyStmt, tyTypeDesc} + n.typ.kind in {tyExpr, tyStatic, tyStmt, tyTypeDesc} proc evalVariable(c: PStackFrame, sym: PSym, flags: TEvalFlags): PNode = # We need to return a node to the actual value, @@ -550,9 +551,7 @@ proc evalSym(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode = of skProc, skConverter, skMacro, skType: result = n #result = s.getBody - of skForVar: - result = evalGlobalVar(c, s, flags) - of skVar, skLet, skTemp, skResult: + of skVar, skLet, skForVar, skTemp, skResult: if sfGlobal notin s.flags: result = evalVariable(c.tos, s, flags) else: @@ -907,17 +906,15 @@ proc evalParseStmt(c: PEvalContext, n: PNode): PNode = result = parseString(code.getStrValue, code.info.toFilename, code.info.line.int) #result.typ = newType(tyStmt, c.module) - -proc evalTypeTrait*(trait, operand: PNode, context: PSym): PNode = - InternalAssert operand.kind == nkSym - let typ = operand.sym.typ.skipTypes({tyTypeDesc}) +proc evalTypeTrait*(trait, operand: PNode, context: PSym): PNode = + let typ = operand.typ.skipTypes({tyTypeDesc}) case trait.sym.name.s.normalize of "name": result = newStrNode(nkStrLit, typ.typeToString(preferName)) result.typ = newType(tyString, context) result.info = trait.info - of "arity": + of "arity": result = newIntNode(nkIntLit, typ.n.len-1) result.typ = newType(tyInt, context) result.info = trait.info @@ -1331,7 +1328,7 @@ proc evalAux(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode = if gNestedEvals <= 0: stackTrace(c, n.info, errTooManyIterations) case n.kind of nkSym: result = evalSym(c, n, flags) - of nkType..nkNilLit: + of nkType..nkNilLit, nkTypeOfExpr: # nkStrLit is VERY common in the traces, so we should avoid # the 'copyNode' here. result = n #.copyNode diff --git a/compiler/evaltempl.nim b/compiler/evaltempl.nim index 05be0e9d3..78cdbb45f 100644 --- a/compiler/evaltempl.nim +++ b/compiler/evaltempl.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2013 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -16,9 +16,14 @@ import type TemplCtx {.pure, final.} = object owner, genSymOwner: PSym + instLines: bool # use the instantiation lines numbers mapping: TIdTable # every gensym'ed symbol needs to be mapped to some # new symbol +proc copyNode(ctx: TemplCtx, a, b: PNode): PNode = + result = copyNode(a) + if ctx.instLines: result.info = b.info + proc evalTemplateAux(templ, actual: PNode, c: var TemplCtx, result: PNode) = case templ.kind of nkSym: @@ -31,49 +36,23 @@ proc evalTemplateAux(templ, actual: PNode, c: var TemplCtx, result: PNode) = else: result.add copyTree(x) else: - InternalAssert sfGenSym in s.flags - var x = PSym(IdTableGet(c.mapping, s)) + internalAssert sfGenSym in s.flags + var x = PSym(idTableGet(c.mapping, s)) if x == nil: x = copySym(s, false) x.owner = c.genSymOwner - IdTablePut(c.mapping, s, x) - result.add newSymNode(x, templ.info) + idTablePut(c.mapping, s, x) + result.add newSymNode(x, if c.instLines: actual.info else: templ.info) else: - result.add copyNode(templ) + result.add copyNode(c, templ, actual) of nkNone..nkIdent, nkType..nkNilLit: # atom - result.add copyNode(templ) + result.add copyNode(c, templ, actual) else: - var res = copyNode(templ) + var res = copyNode(c, templ, actual) for i in countup(0, sonsLen(templ) - 1): evalTemplateAux(templ.sons[i], actual, c, res) result.add res -when false: - proc evalTemplateAux(templ, actual: PNode, c: var TemplCtx): PNode = - case templ.kind - of nkSym: - var s = templ.sym - if s.owner.id == c.owner.id: - if s.kind == skParam: - result = copyTree(actual.sons[s.position]) - else: - InternalAssert sfGenSym in s.flags - var x = PSym(IdTableGet(c.mapping, s)) - if x == nil: - x = copySym(s, false) - x.owner = c.genSymOwner - IdTablePut(c.mapping, s, x) - result = newSymNode(x, templ.info) - else: - result = copyNode(templ) - of nkNone..nkIdent, nkType..nkNilLit: # atom - result = copyNode(templ) - else: - result = copyNode(templ) - newSons(result, sonsLen(templ)) - for i in countup(0, sonsLen(templ) - 1): - result.sons[i] = evalTemplateAux(templ.sons[i], actual, c) - proc evalTemplateArgs(n: PNode, s: PSym): PNode = # if the template has zero arguments, it can be called without ``()`` # `n` is then a nkSym or something similar @@ -83,13 +62,13 @@ proc evalTemplateArgs(n: PNode, s: PSym): PNode = a = sonsLen(n) else: a = 0 var f = s.typ.sonsLen - if a > f: GlobalError(n.info, errWrongNumberOfArguments) + if a > f: globalError(n.info, errWrongNumberOfArguments) result = newNodeI(nkArgList, n.info) for i in countup(1, f - 1): var arg = if i < a: n.sons[i] else: copyTree(s.typ.n.sons[i].sym.ast) if arg == nil or arg.kind == nkEmpty: - LocalError(n.info, errWrongNumberOfArguments) + localError(n.info, errWrongNumberOfArguments) addSon(result, arg) var evalTemplateCounter* = 0 @@ -98,7 +77,7 @@ var evalTemplateCounter* = 0 proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym): PNode = inc(evalTemplateCounter) if evalTemplateCounter > 100: - GlobalError(n.info, errTemplateInstantiationTooNested) + globalError(n.info, errTemplateInstantiationTooNested) result = n # replace each param by the corresponding node: @@ -114,11 +93,13 @@ proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym): PNode = evalTemplateAux(body, args, ctx, result) if result.len == 1: result = result.sons[0] else: - GlobalError(result.info, errIllFormedAstX, + globalError(result.info, errIllFormedAstX, renderTree(result, {renderNoComments})) else: result = copyNode(body) - #evalTemplateAux(body, args, ctx, result) + ctx.instLines = body.kind notin {nkStmtList, nkStmtListExpr, + nkBlockStmt, nkBlockExpr} + if ctx.instLines: result.info = n.info for i in countup(0, safeLen(body) - 1): evalTemplateAux(body.sons[i], args, ctx, result) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index d7f3386e3..12761f1d4 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -324,7 +324,7 @@ var compileOptions: string = "" ccompilerpath: string = "" -proc NameToCC*(name: string): TSystemCC = +proc nameToCC*(name: string): TSystemCC = for i in countup(succ(ccNone), high(TSystemCC)): if cmpIgnoreStyle(name, CC[i].name) == 0: return i @@ -335,8 +335,8 @@ proc getConfigVar(c: TSystemCC, suffix: string): string = # for niminst support if (platform.hostOS != targetOS or platform.hostCPU != targetCPU) and optCompileOnly notin gGlobalOptions: - let fullCCname = platform.cpu[targetCPU].name & '.' & - platform.os[targetOS].name & '.' & + let fullCCname = platform.CPU[targetCPU].name & '.' & + platform.OS[targetOS].name & '.' & CC[c].name & suffix result = getConfigVar(fullCCname) if result.len == 0: @@ -346,13 +346,13 @@ proc getConfigVar(c: TSystemCC, suffix: string): string = result = getConfigVar(CC[c].name & suffix) proc setCC*(ccname: string) = - ccompiler = nameToCC(ccname) - if ccompiler == ccNone: rawMessage(errUnknownCcompiler, ccname) - compileOptions = getConfigVar(ccompiler, ".options.always") - linkOptions = getConfigVar(ccompiler, ".options.linker") - ccompilerpath = getConfigVar(ccompiler, ".path") + cCompiler = nameToCC(ccname) + if cCompiler == ccNone: rawMessage(errUnknownCcompiler, ccname) + compileOptions = getConfigVar(cCompiler, ".options.always") + linkOptions = getConfigVar(cCompiler, ".options.linker") + ccompilerpath = getConfigVar(cCompiler, ".path") for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name) - defineSymbol(CC[ccompiler].name) + defineSymbol(CC[cCompiler].name) proc addOpt(dest: var string, src: string) = if len(dest) == 0 or dest[len(dest)-1] != ' ': add(dest, " ") @@ -368,20 +368,20 @@ proc addCompileOption*(option: string) = proc initVars*() = # we need to define the symbol here, because ``CC`` may have never been set! for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name) - defineSymbol(CC[ccompiler].name) + defineSymbol(CC[cCompiler].name) if gCmd == cmdCompileToCpp: cExt = ".cpp" elif gCmd == cmdCompileToOC: cExt = ".m" - addCompileOption(getConfigVar(ccompiler, ".options.always")) - addLinkOption(getConfigVar(ccompiler, ".options.linker")) - if len(ccompilerPath) == 0: - ccompilerpath = getConfigVar(ccompiler, ".path") + addCompileOption(getConfigVar(cCompiler, ".options.always")) + addLinkOption(getConfigVar(cCompiler, ".options.linker")) + if len(ccompilerpath) == 0: + ccompilerpath = getConfigVar(cCompiler, ".path") proc completeCFilePath*(cfile: string, createSubDir: bool = true): string = result = completeGeneratedFilePath(cfile, createSubDir) proc toObjFile*(filenameWithoutExt: string): string = # Object file for compilation - result = changeFileExt(filenameWithoutExt, cc[ccompiler].objExt) + result = changeFileExt(filenameWithoutExt, CC[cCompiler].objExt) proc addFileToCompile*(filename: string) = appendStr(toCompile, filename) @@ -400,28 +400,28 @@ proc addFileToLink*(filename: string) = # BUGFIX: was ``appendStr`` proc execExternalProgram*(cmd: string) = - if optListCmd in gGlobalOptions or gVerbosity > 0: MsgWriteln(cmd) + if optListCmd in gGlobalOptions or gVerbosity > 0: msgWriteln(cmd) if execCmd(cmd) != 0: rawMessage(errExecutionOfProgramFailed, "") proc generateScript(projectFile: string, script: PRope) = let (dir, name, ext) = splitFile(projectFile) - WriteRope(script, dir / addFileExt("compile_" & name, - platform.os[targetOS].scriptExt)) + writeRope(script, dir / addFileExt("compile_" & name, + platform.OS[targetOS].scriptExt)) proc getOptSpeed(c: TSystemCC): string = result = getConfigVar(c, ".options.speed") if result == "": - result = cc[c].optSpeed # use default settings from this file + result = CC[c].optSpeed # use default settings from this file proc getDebug(c: TSystemCC): string = result = getConfigVar(c, ".options.debug") if result == "": - result = cc[c].debug # use default settings from this file + result = CC[c].debug # use default settings from this file proc getOptSize(c: TSystemCC): string = result = getConfigVar(c, ".options.size") if result == "": - result = cc[c].optSize # use default settings from this file + result = CC[c].optSize # use default settings from this file proc noAbsolutePaths: bool {.inline.} = # We used to check current OS != specified OS, but this makes no sense @@ -436,88 +436,88 @@ const var fileCounter: int -proc add(s: var string, many: openarray[string]) = +proc add(s: var string, many: openArray[string]) = s.add many.join -proc CFileSpecificOptions(cfilename: string): string = +proc cFileSpecificOptions(cfilename: string): string = result = compileOptions var trunk = splitFile(cfilename).name if optCDebug in gGlobalOptions: var key = trunk & ".debug" if existsConfigVar(key): addOpt(result, getConfigVar(key)) - else: addOpt(result, getDebug(ccompiler)) + else: addOpt(result, getDebug(cCompiler)) if optOptimizeSpeed in gOptions: var key = trunk & ".speed" if existsConfigVar(key): addOpt(result, getConfigVar(key)) - else: addOpt(result, getOptSpeed(ccompiler)) + else: addOpt(result, getOptSpeed(cCompiler)) elif optOptimizeSize in gOptions: var key = trunk & ".size" if existsConfigVar(key): addOpt(result, getConfigVar(key)) - else: addOpt(result, getOptSize(ccompiler)) + else: addOpt(result, getOptSize(cCompiler)) var key = trunk & ".always" if existsConfigVar(key): addOpt(result, getConfigVar(key)) proc getCompileOptions: string = - result = CFileSpecificOptions("__dummy__") + result = cFileSpecificOptions("__dummy__") proc getLinkOptions: string = result = linkOptions for linkedLib in items(cLinkedLibs): - result.add(cc[ccompiler].linkLibCmd % linkedLib.quoteIfContainsWhite) + result.add(CC[cCompiler].linkLibCmd % linkedLib.quoteShell) for libDir in items(cLibs): - result.add([cc[ccompiler].linkDirCmd, libDir.quoteIfContainsWhite]) + result.add([CC[cCompiler].linkDirCmd, libDir.quoteShell]) proc needsExeExt(): bool {.inline.} = result = (optGenScript in gGlobalOptions and targetOS == osWindows) or (platform.hostOS == osWindows) proc getCompileCFileCmd*(cfilename: string, isExternal = false): string = - var c = ccompiler - var options = CFileSpecificOptions(cfilename) + var c = cCompiler + var options = cFileSpecificOptions(cfilename) var exe = getConfigVar(c, ".exe") - if exe.len == 0: exe = cc[c].compilerExe + if exe.len == 0: exe = CC[c].compilerExe if needsExeExt(): exe = addFileExt(exe, "exe") if optGenDynLib in gGlobalOptions and ospNeedsPIC in platform.OS[targetOS].props: - add(options, ' ' & cc[c].pic) + add(options, ' ' & CC[c].pic) var includeCmd, compilePattern: string if not noAbsolutePaths(): # compute include paths: - includeCmd = cc[c].includeCmd & quoteIfContainsWhite(libpath) + includeCmd = CC[c].includeCmd & quoteShell(libpath) for includeDir in items(cIncludes): - includeCmd.add([cc[c].includeCmd, includeDir.quoteIfContainsWhite]) + includeCmd.add([CC[c].includeCmd, includeDir.quoteShell]) - compilePattern = JoinPath(ccompilerpath, exe) + compilePattern = joinPath(ccompilerpath, exe) else: includeCmd = "" - compilePattern = cc[c].compilerExe + compilePattern = CC[c].compilerExe - var cfile = if noAbsolutePaths(): extractFileName(cfilename) + var cfile = if noAbsolutePaths(): extractFilename(cfilename) else: cfilename var objfile = if not isExternal or noAbsolutePaths(): toObjFile(cfile) else: completeCFilePath(toObjFile(cfile)) - cfile = quoteIfContainsWhite(AddFileExt(cfile, cExt)) - objfile = quoteIfContainsWhite(objfile) - result = quoteIfContainsWhite(compilePattern % [ + cfile = quoteShell(addFileExt(cfile, cExt)) + objfile = quoteShell(objfile) + result = quoteShell(compilePattern % [ "file", cfile, "objfile", objfile, "options", options, "include", includeCmd, "nimrod", getPrefixDir(), "lib", libpath]) add(result, ' ') - addf(result, cc[c].compileTmpl, [ + addf(result, CC[c].compileTmpl, [ "file", cfile, "objfile", objfile, "options", options, "include", includeCmd, - "nimrod", quoteIfContainsWhite(getPrefixDir()), - "lib", quoteIfContainsWhite(libpath)]) + "nimrod", quoteShell(getPrefixDir()), + "lib", quoteShell(libpath)]) proc footprint(filename: string): TCrc32 = result = crcFromFile(filename) >< platform.OS[targetOS].name >< platform.CPU[targetCPU].name >< - extccomp.CC[extccomp.ccompiler].name >< + extccomp.CC[extccomp.cCompiler].name >< getCompileCFileCmd(filename, true) proc externalFileChanged(filename: string): bool = @@ -541,7 +541,7 @@ proc addExternalFileToCompile*(filename: string) = if optForceFullMake in gGlobalOptions or externalFileChanged(filename): appendStr(externalToCompile, filename) -proc CompileCFile(list: TLinkedList, script: var PRope, cmds: var TStringSeq, +proc compileCFile(list: TLinkedList, script: var PRope, cmds: var TStringSeq, isExternal: bool) = var it = PStrEntry(list.head) while it != nil: @@ -554,18 +554,18 @@ proc CompileCFile(list: TLinkedList, script: var PRope, cmds: var TStringSeq, app(script, tnl) it = PStrEntry(it.next) -proc CallCCompiler*(projectfile: string) = +proc callCCompiler*(projectfile: string) = var linkCmd, buildgui, builddll: string if gGlobalOptions * {optCompileOnly, optGenScript} == {optCompileOnly}: return # speed up that call if only compiling and no script shall be # generated fileCounter = 0 - var c = ccompiler + var c = cCompiler var script: PRope = nil var cmds: TStringSeq = @[] - CompileCFile(toCompile, script, cmds, false) - CompileCFile(externalToCompile, script, cmds, true) + compileCFile(toCompile, script, cmds, false) + compileCFile(externalToCompile, script, cmds, true) if optCompileOnly notin gGlobalOptions: if gNumberOfProcessors == 0: gNumberOfProcessors = countProcessors() var res = 0 @@ -583,63 +583,64 @@ proc CallCCompiler*(projectfile: string) = else: rawMessage(errGenerated, " execution of an external program failed; " & "rerun with --parallelBuild:1 to see the error message") - if optNoLinking notin gGlobalOptions and cmds.len > 0: + if optNoLinking notin gGlobalOptions: # call the linker: var it = PStrEntry(toLink.head) var objfiles = "" while it != nil: let objFile = if noAbsolutePaths(): it.data.extractFilename else: it.data add(objfiles, ' ') - add(objfiles, quoteIfContainsWhite( - addFileExt(objFile, cc[ccompiler].objExt))) + add(objfiles, quoteShell( + addFileExt(objFile, CC[cCompiler].objExt))) it = PStrEntry(it.next) if optGenStaticLib in gGlobalOptions: - linkcmd = cc[c].buildLib % ["libfile", (libNameTmpl() % gProjectName), + linkCmd = CC[c].buildLib % ["libfile", (libNameTmpl() % gProjectName), "objfiles", objfiles] if optCompileOnly notin gGlobalOptions: execExternalProgram(linkCmd) else: var linkerExe = getConfigVar(c, ".linkerexe") - if len(linkerExe) == 0: linkerExe = cc[c].linkerExe + if len(linkerExe) == 0: linkerExe = CC[c].linkerExe if needsExeExt(): linkerExe = addFileExt(linkerExe, "exe") - if noAbsolutePaths(): linkCmd = quoteIfContainsWhite(linkerExe) - else: linkCmd = quoteIfContainsWhite(JoinPath(ccompilerpath, linkerExe)) - if optGenGuiApp in gGlobalOptions: buildGui = cc[c].buildGui - else: buildGui = "" + if noAbsolutePaths(): linkCmd = quoteShell(linkerExe) + else: linkCmd = quoteShell(joinPath(ccompilerpath, linkerExe)) + if optGenGuiApp in gGlobalOptions: buildgui = CC[c].buildGui + else: buildgui = "" var exefile: string if optGenDynLib in gGlobalOptions: - exefile = platform.os[targetOS].dllFrmt % splitFile(projectFile).name - buildDll = cc[c].buildDll + exefile = platform.OS[targetOS].dllFrmt % splitFile(projectfile).name + builddll = CC[c].buildDll else: - exefile = splitFile(projectFile).name & platform.os[targetOS].exeExt - buildDll = "" + exefile = splitFile(projectfile).name & platform.OS[targetOS].exeExt + builddll = "" if options.outFile.len > 0: - exefile = options.outFile + exefile = options.outFile.expandTilde if not noAbsolutePaths(): - exefile = joinPath(splitFile(projectFile).dir, exefile) - exefile = quoteIfContainsWhite(exefile) + if not exefile.isAbsolute(): + exefile = joinPath(splitFile(projectfile).dir, exefile) + exefile = quoteShell(exefile) let linkOptions = getLinkOptions() - linkCmd = quoteIfContainsWhite(linkCmd % ["builddll", builddll, + linkCmd = quoteShell(linkCmd % ["builddll", builddll, "buildgui", buildgui, "options", linkOptions, "objfiles", objfiles, "exefile", exefile, "nimrod", getPrefixDir(), "lib", libpath]) linkCmd.add ' ' - addf(linkCmd, cc[c].linkTmpl, ["builddll", builddll, + addf(linkCmd, CC[c].linkTmpl, ["builddll", builddll, "buildgui", buildgui, "options", linkOptions, "objfiles", objfiles, "exefile", exefile, - "nimrod", quoteIfContainsWhite(getPrefixDir()), - "lib", quoteIfContainsWhite(libpath)]) + "nimrod", quoteShell(getPrefixDir()), + "lib", quoteShell(libpath)]) if optCompileOnly notin gGlobalOptions: execExternalProgram(linkCmd) else: linkCmd = "" if optGenScript in gGlobalOptions: app(script, linkCmd) app(script, tnl) - generateScript(projectFile, script) + generateScript(projectfile, script) proc genMappingFiles(list: TLinkedList): PRope = var it = PStrEntry(list.head) while it != nil: - appf(result, "--file:r\"$1\"$N", [toRope(AddFileExt(it.data, cExt))]) + appf(result, "--file:r\"$1\"$N", [toRope(addFileExt(it.data, cExt))]) it = PStrEntry(it.next) proc writeMapping*(gSymbolMapping: PRope) = @@ -657,5 +658,5 @@ proc writeMapping*(gSymbolMapping: PRope) = app(code, strutils.escape(libpath)) appf(code, "\n[Symbols]$n$1", [gSymbolMapping]) - WriteRope(code, joinPath(gProjectPath, "mapping.txt")) + writeRope(code, joinPath(gProjectPath, "mapping.txt")) diff --git a/compiler/filter_tmpl.nim b/compiler/filter_tmpl.nim index d16639d08..0014e9c78 100644 --- a/compiler/filter_tmpl.nim +++ b/compiler/filter_tmpl.nim @@ -27,7 +27,7 @@ type indent, emitPar: int x: string # the current input line outp: PLLStream # the ouput will be parsed by pnimsyn - subsChar, NimDirective: Char + subsChar, nimDirective: char emit, conc, toStr: string curly, bracket, par: int pendingExprLine: bool @@ -37,11 +37,11 @@ const PatternChars = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF', '.', '_'} proc newLine(p: var TTmplParser) = - LLStreamWrite(p.outp, repeatChar(p.emitPar, ')')) + llStreamWrite(p.outp, repeatChar(p.emitPar, ')')) p.emitPar = 0 - if p.info.line > int16(1): LLStreamWrite(p.outp, "\n") + if p.info.line > int16(1): llStreamWrite(p.outp, "\n") if p.pendingExprLine: - LLStreamWrite(p.outp, repeatChar(2)) + llStreamWrite(p.outp, repeatChar(2)) p.pendingExprLine = false proc scanPar(p: var TTmplParser, d: int) = @@ -55,7 +55,7 @@ proc scanPar(p: var TTmplParser, d: int) = of ']': dec(p.bracket) of '{': inc(p.curly) of '}': dec(p.curly) - else: nil + else: discard inc(i) proc withInExpr(p: TTmplParser): bool {.inline.} = @@ -67,9 +67,9 @@ proc parseLine(p: var TTmplParser) = keyw: string j = 0 while p.x[j] == ' ': inc(j) - if (p.x[0] == p.NimDirective) and (p.x[0 + 1] == '!'): + if (p.x[0] == p.nimDirective) and (p.x[0 + 1] == '!'): newLine(p) - elif (p.x[j] == p.NimDirective): + elif (p.x[j] == p.nimDirective): newLine(p) inc(j) while p.x[j] == ' ': inc(j) @@ -87,26 +87,26 @@ proc parseLine(p: var TTmplParser) = dec(p.indent, 2) else: p.info.col = int16(j) - LocalError(p.info, errXNotAllowedHere, "end") - LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, "#end") + localError(p.info, errXNotAllowedHere, "end") + llStreamWrite(p.outp, repeatChar(p.indent)) + llStreamWrite(p.outp, "#end") of wIf, wWhen, wTry, wWhile, wFor, wBlock, wCase, wProc, wIterator, wConverter, wMacro, wTemplate, wMethod: - LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, substr(p.x, d)) + llStreamWrite(p.outp, repeatChar(p.indent)) + llStreamWrite(p.outp, substr(p.x, d)) inc(p.indent, 2) of wElif, wOf, wElse, wExcept, wFinally: - LLStreamWrite(p.outp, repeatChar(p.indent - 2)) - LLStreamWrite(p.outp, substr(p.x, d)) + llStreamWrite(p.outp, repeatChar(p.indent - 2)) + llStreamWrite(p.outp, substr(p.x, d)) of wLet, wVar, wConst, wType: - LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, substr(p.x, d)) + llStreamWrite(p.outp, repeatChar(p.indent)) + llStreamWrite(p.outp, substr(p.x, d)) if not p.x.contains({':', '='}): # no inline element --> treat as block: inc(p.indent, 2) else: - LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, substr(p.x, d)) + llStreamWrite(p.outp, repeatChar(p.indent)) + llStreamWrite(p.outp, substr(p.x, d)) p.state = psDirective else: # data line @@ -118,15 +118,15 @@ proc parseLine(p: var TTmplParser) = case p.state of psTempl: # next line of string literal: - LLStreamWrite(p.outp, p.conc) - LLStreamWrite(p.outp, "\n") - LLStreamWrite(p.outp, repeatChar(p.indent + 2)) - LLStreamWrite(p.outp, "\"") + llStreamWrite(p.outp, p.conc) + llStreamWrite(p.outp, "\n") + llStreamWrite(p.outp, repeatChar(p.indent + 2)) + llStreamWrite(p.outp, "\"") of psDirective: newLine(p) - LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, p.emit) - LLStreamWrite(p.outp, "(\"") + llStreamWrite(p.outp, repeatChar(p.indent)) + llStreamWrite(p.outp, p.emit) + llStreamWrite(p.outp, "(\"") inc(p.emitPar) p.state = psTempl while true: @@ -134,17 +134,17 @@ proc parseLine(p: var TTmplParser) = of '\0': break of '\x01'..'\x1F', '\x80'..'\xFF': - LLStreamWrite(p.outp, "\\x") - LLStreamWrite(p.outp, toHex(ord(p.x[j]), 2)) + llStreamWrite(p.outp, "\\x") + llStreamWrite(p.outp, toHex(ord(p.x[j]), 2)) inc(j) of '\\': - LLStreamWrite(p.outp, "\\\\") + llStreamWrite(p.outp, "\\\\") inc(j) of '\'': - LLStreamWrite(p.outp, "\\\'") + llStreamWrite(p.outp, "\\\'") inc(j) of '\"': - LLStreamWrite(p.outp, "\\\"") + llStreamWrite(p.outp, "\\\"") inc(j) else: if p.x[j] == p.subsChar: @@ -153,59 +153,59 @@ proc parseLine(p: var TTmplParser) = case p.x[j] of '{': p.info.col = int16(j) - LLStreamWrite(p.outp, '\"') - LLStreamWrite(p.outp, p.conc) - LLStreamWrite(p.outp, p.toStr) - LLStreamWrite(p.outp, '(') + llStreamWrite(p.outp, '\"') + llStreamWrite(p.outp, p.conc) + llStreamWrite(p.outp, p.toStr) + llStreamWrite(p.outp, '(') inc(j) curly = 0 while true: case p.x[j] of '\0': - LocalError(p.info, errXExpected, "}") + localError(p.info, errXExpected, "}") break of '{': inc(j) inc(curly) - LLStreamWrite(p.outp, '{') + llStreamWrite(p.outp, '{') of '}': inc(j) if curly == 0: break if curly > 0: dec(curly) - LLStreamWrite(p.outp, '}') + llStreamWrite(p.outp, '}') else: - LLStreamWrite(p.outp, p.x[j]) + llStreamWrite(p.outp, p.x[j]) inc(j) - LLStreamWrite(p.outp, ')') - LLStreamWrite(p.outp, p.conc) - LLStreamWrite(p.outp, '\"') + llStreamWrite(p.outp, ')') + llStreamWrite(p.outp, p.conc) + llStreamWrite(p.outp, '\"') of 'a'..'z', 'A'..'Z', '\x80'..'\xFF': - LLStreamWrite(p.outp, '\"') - LLStreamWrite(p.outp, p.conc) - LLStreamWrite(p.outp, p.toStr) - LLStreamWrite(p.outp, '(') + llStreamWrite(p.outp, '\"') + llStreamWrite(p.outp, p.conc) + llStreamWrite(p.outp, p.toStr) + llStreamWrite(p.outp, '(') while p.x[j] in PatternChars: - LLStreamWrite(p.outp, p.x[j]) + llStreamWrite(p.outp, p.x[j]) inc(j) - LLStreamWrite(p.outp, ')') - LLStreamWrite(p.outp, p.conc) - LLStreamWrite(p.outp, '\"') + llStreamWrite(p.outp, ')') + llStreamWrite(p.outp, p.conc) + llStreamWrite(p.outp, '\"') else: if p.x[j] == p.subsChar: - LLStreamWrite(p.outp, p.subsChar) + llStreamWrite(p.outp, p.subsChar) inc(j) else: p.info.col = int16(j) - LocalError(p.info, errInvalidExpression, "$") + localError(p.info, errInvalidExpression, "$") else: - LLStreamWrite(p.outp, p.x[j]) + llStreamWrite(p.outp, p.x[j]) inc(j) - LLStreamWrite(p.outp, "\\n\"") + llStreamWrite(p.outp, "\\n\"") proc filterTmpl(stdin: PLLStream, filename: string, call: PNode): PLLStream = var p: TTmplParser p.info = newLineInfo(filename, 0, 0) - p.outp = LLStreamOpen("") + p.outp = llStreamOpen("") p.inp = stdin p.subsChar = charArg(call, "subschar", 1, '$') p.nimDirective = charArg(call, "metachar", 2, '#') @@ -213,9 +213,9 @@ proc filterTmpl(stdin: PLLStream, filename: string, call: PNode): PLLStream = p.conc = strArg(call, "conc", 4, " & ") p.toStr = strArg(call, "tostring", 5, "$") p.x = newStringOfCap(120) - while LLStreamReadLine(p.inp, p.x): + while llStreamReadLine(p.inp, p.x): p.info.line = p.info.line + int16(1) parseLine(p) newLine(p) result = p.outp - LLStreamClose(p.inp) + llStreamClose(p.inp) diff --git a/compiler/filters.nim b/compiler/filters.nim index 19da11bca..ce0ffd196 100644 --- a/compiler/filters.nim +++ b/compiler/filters.nim @@ -16,13 +16,13 @@ import proc filterReplace*(stdin: PLLStream, filename: string, call: PNode): PLLStream proc filterStrip*(stdin: PLLStream, filename: string, call: PNode): PLLStream # helpers to retrieve arguments: -proc charArg*(n: PNode, name: string, pos: int, default: Char): Char +proc charArg*(n: PNode, name: string, pos: int, default: char): char proc strArg*(n: PNode, name: string, pos: int, default: string): string proc boolArg*(n: PNode, name: string, pos: int, default: bool): bool # implementation proc invalidPragma(n: PNode) = - LocalError(n.info, errXNotAllowedHere, renderTree(n, {renderNoComments})) + localError(n.info, errXNotAllowedHere, renderTree(n, {renderNoComments})) proc getArg(n: PNode, name: string, pos: int): PNode = result = nil @@ -30,12 +30,12 @@ proc getArg(n: PNode, name: string, pos: int): PNode = for i in countup(1, sonsLen(n) - 1): if n.sons[i].kind == nkExprEqExpr: if n.sons[i].sons[0].kind != nkIdent: invalidPragma(n) - if IdentEq(n.sons[i].sons[0].ident, name): + if identEq(n.sons[i].sons[0].ident, name): return n.sons[i].sons[1] elif i == pos: return n.sons[i] -proc charArg(n: PNode, name: string, pos: int, default: Char): Char = +proc charArg(n: PNode, name: string, pos: int, default: char): char = var x = getArg(n, name, pos) if x == nil: result = default elif x.kind == nkCharLit: result = chr(int(x.intVal)) @@ -50,30 +50,30 @@ proc strArg(n: PNode, name: string, pos: int, default: string): string = proc boolArg(n: PNode, name: string, pos: int, default: bool): bool = var x = getArg(n, name, pos) if x == nil: result = default - elif (x.kind == nkIdent) and IdentEq(x.ident, "true"): result = true - elif (x.kind == nkIdent) and IdentEq(x.ident, "false"): result = false + elif (x.kind == nkIdent) and identEq(x.ident, "true"): result = true + elif (x.kind == nkIdent) and identEq(x.ident, "false"): result = false else: invalidPragma(n) proc filterStrip(stdin: PLLStream, filename: string, call: PNode): PLLStream = var pattern = strArg(call, "startswith", 1, "") var leading = boolArg(call, "leading", 2, true) var trailing = boolArg(call, "trailing", 3, true) - result = LLStreamOpen("") + result = llStreamOpen("") var line = newStringOfCap(80) - while LLStreamReadLine(stdin, line): + while llStreamReadLine(stdin, line): var stripped = strip(line, leading, trailing) if (len(pattern) == 0) or startsWith(stripped, pattern): - LLStreamWriteln(result, stripped) + llStreamWriteln(result, stripped) else: - LLStreamWriteln(result, line) - LLStreamClose(stdin) + llStreamWriteln(result, line) + llStreamClose(stdin) proc filterReplace(stdin: PLLStream, filename: string, call: PNode): PLLStream = var sub = strArg(call, "sub", 1, "") if len(sub) == 0: invalidPragma(call) var by = strArg(call, "by", 2, "") - result = LLStreamOpen("") + result = llStreamOpen("") var line = newStringOfCap(80) - while LLStreamReadLine(stdin, line): - LLStreamWriteln(result, replace(line, sub, by)) - LLStreamClose(stdin) + while llStreamReadLine(stdin, line): + llStreamWriteln(result, replace(line, sub, by)) + llStreamClose(stdin) diff --git a/compiler/guards.nim b/compiler/guards.nim index 8d271fa6d..607bb074a 100644 --- a/compiler/guards.nim +++ b/compiler/guards.nim @@ -251,10 +251,10 @@ proc invalidateFacts*(m: var TModel, n: PNode) = proc valuesUnequal(a, b: PNode): bool = if a.isValue and b.isValue: - result = not SameValue(a, b) + result = not sameValue(a, b) proc pred(n: PNode): PNode = - if n.kind in {nkCharLit..nkUInt64Lit} and n.intVal != low(biggestInt): + if n.kind in {nkCharLit..nkUInt64Lit} and n.intVal != low(BiggestInt): result = copyNode(n) dec result.intVal else: @@ -366,7 +366,7 @@ proc impliesIsNil(fact, eq: PNode): TImplication = else: discard proc impliesGe(fact, x, c: PNode): TImplication = - InternalAssert isLocation(x) + internalAssert isLocation(x) case fact.sons[0].sym.magic of someEq: if sameTree(fact.sons[1], x): @@ -439,7 +439,7 @@ proc impliesLe(fact, x, c: PNode): TImplication = if leValue(c, fact.sons[1].pred): result = impNo of mNot, mOr, mAnd: internalError(x.info, "impliesLe") - else: nil + else: discard proc impliesLt(fact, x, c: PNode): TImplication = # x < 3 same as x <= 2: @@ -484,7 +484,7 @@ proc factImplies(fact, prop: PNode): TImplication = if a == b: return ~a return impUnknown else: - InternalError(fact.info, "invalid fact") + internalError(fact.info, "invalid fact") of mAnd: result = factImplies(fact.sons[1], prop) if result != impUnknown: return result @@ -575,4 +575,4 @@ proc checkFieldAccess*(m: TModel, n: PNode) = for i in 1..n.len-1: let check = buildProperFieldCheck(n.sons[0], n.sons[i]) if m.doesImply(check) != impYes: - Message(n.info, warnProveField, renderTree(n.sons[0])); break + message(n.info, warnProveField, renderTree(n.sons[0])); break diff --git a/compiler/hlo.nim b/compiler/hlo.nim index 1492ed76f..7982d4aa1 100644 --- a/compiler/hlo.nim +++ b/compiler/hlo.nim @@ -12,7 +12,7 @@ proc hlo(c: PContext, n: PNode): PNode proc evalPattern(c: PContext, n, orig: PNode): PNode = - InternalAssert n.kind == nkCall and n.sons[0].kind == nkSym + internalAssert n.kind == nkCall and n.sons[0].kind == nkSym # we need to ensure that the resulting AST is semchecked. However, it's # aweful to semcheck before macro invocation, so we don't and treat # templates and macros as immediate in this context. @@ -28,7 +28,7 @@ proc evalPattern(c: PContext, n, orig: PNode): PNode = else: result = semDirectOp(c, n, {}) if optHints in gOptions and hintPattern in gNotes: - Message(orig.info, hintPattern, rule & " --> '" & + message(orig.info, hintPattern, rule & " --> '" & renderTree(result, {renderNoComments}) & "'") proc applyPatterns(c: PContext, n: PNode): PNode = @@ -45,7 +45,7 @@ proc applyPatterns(c: PContext, n: PNode): PNode = # better be safe than sorry, so check evalTemplateCounter too: inc(evalTemplateCounter) if evalTemplateCounter > 100: - GlobalError(n.info, errTemplateInstantiationTooNested) + globalError(n.info, errTemplateInstantiationTooNested) # deactivate this pattern: c.patterns[i] = nil if x.kind == nkStmtList: @@ -81,7 +81,7 @@ proc hlo(c: PContext, n: PNode): PNode = else: # perform type checking, so that the replacement still fits: if isEmptyType(n.typ) and isEmptyType(result.typ): - nil + discard else: result = fitNode(c, n.typ, result) # optimization has been applied so check again: diff --git a/compiler/idents.nim b/compiler/idents.nim index 1e6f9d2fd..ec903826a 100644 --- a/compiler/idents.nim +++ b/compiler/idents.nim @@ -102,7 +102,7 @@ proc getIdent*(identifier: string): PIdent = proc getIdent*(identifier: string, h: THash): PIdent = result = getIdent(cstring(identifier), len(identifier), h) -proc IdentEq*(id: PIdent, name: string): bool = +proc identEq*(id: PIdent, name: string): bool = result = id.id == getIdent(name).id var idAnon* = getIdent":anonymous" diff --git a/compiler/idgen.nim b/compiler/idgen.nim index fbf450c90..c4f5f2a9e 100644 --- a/compiler/idgen.nim +++ b/compiler/idgen.nim @@ -22,9 +22,9 @@ when debugIds: var usedIds = InitIntSet() proc registerID*(id: PIdObj) = - when debugIDs: - if id.id == -1 or ContainsOrIncl(usedIds, id.id): - InternalError("ID already used: " & $id.id) + when debugIds: + if id.id == -1 or containsOrIncl(usedIds, id.id): + internalError("ID already used: " & $id.id) proc getID*(): int {.inline.} = result = gFrontEndId @@ -37,8 +37,8 @@ proc backendId*(): int {.inline.} = proc setId*(id: int) {.inline.} = gFrontEndId = max(gFrontEndId, id + 1) -proc IDsynchronizationPoint*(idRange: int) = - gFrontEndId = (gFrontEndId div IdRange + 1) * IdRange + 1 +proc idSynchronizationPoint*(idRange: int) = + gFrontEndId = (gFrontEndId div idRange + 1) * idRange + 1 proc toGid(f: string): string = # we used to use ``f.addFileExt("gid")`` (aka ``$project.gid``), but this @@ -49,7 +49,7 @@ proc toGid(f: string): string = proc saveMaxIds*(project: string) = var f = open(project.toGid, fmWrite) f.writeln($gFrontEndId) - f.writeln($gBackEndId) + f.writeln($gBackendId) f.close() proc loadMaxIds*(project: string) = @@ -61,5 +61,5 @@ proc loadMaxIds*(project: string) = if f.readLine(line): var backEndId = parseInt(line) gFrontEndId = max(gFrontEndId, frontEndId) - gBackEndId = max(gBackEndId, backEndId) + gBackendId = max(gBackendId, backEndId) f.close() diff --git a/compiler/importer.nim b/compiler/importer.nim index 8b854bcc6..078a90c98 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -22,7 +22,7 @@ proc getModuleName*(n: PNode): string = # The proc won't perform any checks that the path is actually valid case n.kind of nkStrLit, nkRStrLit, nkTripleStrLit: - result = UnixToNativePath(n.strVal) + result = unixToNativePath(n.strVal) of nkIdent: result = n.ident.s of nkSym: @@ -50,7 +50,7 @@ proc checkModuleName*(n: PNode): int32 = let modulename = n.getModuleName let fullPath = findModule(modulename, n.info.toFullPath) if fullPath.len == 0: - LocalError(n.info, errCannotOpenFile, modulename) + localError(n.info, errCannotOpenFile, modulename) result = InvalidFileIDX else: result = fullPath.fileInfoIdx @@ -59,32 +59,32 @@ proc rawImportSymbol(c: PContext, s: PSym) = # This does not handle stubs, because otherwise loading on demand would be # pointless in practice. So importing stubs is fine here! # check if we have already a symbol of the same name: - var check = StrTableGet(c.importTable.symbols, s.name) + var check = strTableGet(c.importTable.symbols, s.name) if check != nil and check.id != s.id: if s.kind notin OverloadableSyms: # s and check need to be qualified: - Incl(c.AmbiguousSymbols, s.id) - Incl(c.AmbiguousSymbols, check.id) + incl(c.ambiguousSymbols, s.id) + incl(c.ambiguousSymbols, check.id) # thanks to 'export' feature, it could be we import the same symbol from # multiple sources, so we need to call 'StrTableAdd' here: - StrTableAdd(c.importTable.symbols, s) + strTableAdd(c.importTable.symbols, s) if s.kind == skType: var etyp = s.typ if etyp.kind in {tyBool, tyEnum} and sfPure notin s.flags: for j in countup(0, sonsLen(etyp.n) - 1): var e = etyp.n.sons[j].sym - if e.Kind != skEnumField: - InternalError(s.info, "rawImportSymbol") + if e.kind != skEnumField: + internalError(s.info, "rawImportSymbol") # BUGFIX: because of aliases for enums the symbol may already # have been put into the symbol table # BUGFIX: but only iff they are the same symbols! var it: TIdentIter - check = InitIdentIter(it, c.importTable.symbols, e.name) + check = initIdentIter(it, c.importTable.symbols, e.name) while check != nil: if check.id == e.id: e = nil break - check = NextIdentIter(it, c.importTable.symbols) + check = nextIdentIter(it, c.importTable.symbols) if e != nil: rawImportSymbol(c, e) else: @@ -94,36 +94,36 @@ proc rawImportSymbol(c: PContext, s: PSym) = proc importSymbol(c: PContext, n: PNode, fromMod: PSym) = let ident = lookups.considerAcc(n) - let s = StrTableGet(fromMod.tab, ident) + let s = strTableGet(fromMod.tab, ident) if s == nil: - LocalError(n.info, errUndeclaredIdentifier, ident.s) + localError(n.info, errUndeclaredIdentifier, ident.s) else: if s.kind == skStub: loadStub(s) - if s.Kind notin ExportableSymKinds: - InternalError(n.info, "importSymbol: 2") + if s.kind notin ExportableSymKinds: + internalError(n.info, "importSymbol: 2") # for an enumeration we have to add all identifiers - case s.Kind + case s.kind of skProc, skMethod, skIterator, skMacro, skTemplate, skConverter: # for a overloadable syms add all overloaded routines var it: TIdentIter - var e = InitIdentIter(it, fromMod.tab, s.name) + var e = initIdentIter(it, fromMod.tab, s.name) while e != nil: - if e.name.id != s.Name.id: InternalError(n.info, "importSymbol: 3") + if e.name.id != s.name.id: internalError(n.info, "importSymbol: 3") rawImportSymbol(c, e) - e = NextIdentIter(it, fromMod.tab) + e = nextIdentIter(it, fromMod.tab) else: rawImportSymbol(c, s) proc importAllSymbolsExcept(c: PContext, fromMod: PSym, exceptSet: TIntSet) = var i: TTabIter - var s = InitTabIter(i, fromMod.tab) + var s = initTabIter(i, fromMod.tab) while s != nil: if s.kind != skModule: if s.kind != skEnumField: - if s.Kind notin ExportableSymKinds: - InternalError(s.info, "importAllSymbols: " & $s.kind) + if s.kind notin ExportableSymKinds: + internalError(s.info, "importAllSymbols: " & $s.kind) if exceptSet.empty or s.name.id notin exceptSet: rawImportSymbol(c, s) - s = NextIter(i, fromMod.tab) + s = nextIter(i, fromMod.tab) proc importAllSymbols*(c: PContext, fromMod: PSym) = var exceptSet: TIntSet @@ -160,7 +160,7 @@ proc myImportModule(c: PContext, n: PNode): PSym = if f != InvalidFileIDX: result = importModuleAs(n, gImportModule(c.module, f)) if sfDeprecated in result.flags: - Message(n.info, warnDeprecated, result.name.s) + message(n.info, warnDeprecated, result.name.s) proc evalImport(c: PContext, n: PNode): PNode = result = n diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 54ee43069..c0fc4131a 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -64,7 +64,7 @@ type options: TOptions module: BModule g: PGlobals - BeforeRetNeeded: bool + beforeRetNeeded: bool target: TTarget # duplicated here for faster dispatching unique: int # for temp identifier generation blocks: seq[TBlock] @@ -111,7 +111,7 @@ proc mapType(typ: PType): TJSTypeKind = let t = skipTypes(typ, abstractInst) case t.kind of tyVar, tyRef, tyPtr: - if skipTypes(t.sons[0], abstractInst).kind in mappedToObject: + if skipTypes(t.sons[0], abstractInst).kind in MappedToObject: result = etyObject else: result = etyBaseIndex @@ -129,8 +129,9 @@ proc mapType(typ: PType): TJSTypeKind = tyVarargs: result = etyObject of tyNil: result = etyNull - of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvokation, tyNone, - tyForward, tyEmpty, tyExpr, tyStmt, tyTypeDesc, tyTypeClass: + of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvokation, + tyNone, tyFromExpr, tyForward, tyEmpty, tyFieldAccessor, + tyExpr, tyStmt, tyStatic, tyTypeDesc, tyTypeClasses: result = etyNone of tyProc: result = etyProc of tyCString: result = etyString @@ -142,7 +143,7 @@ proc mangle(name: string): string = of 'A'..'Z': add(result, chr(ord(name[i]) - ord('A') + ord('a'))) of '_': - nil + discard of 'a'..'z', '0'..'9': add(result, name[i]) else: add(result, 'X' & toHex(ord(name[i]), 2)) @@ -175,7 +176,7 @@ proc useMagic(p: PProc, name: string) = # we used to exclude the system module from this check, but for DLL # generation support this sloppyness leads to hard to detect bugs, so # we're picky here for the system module too: - if p.prc != nil: GlobalError(p.prc.info, errSystemNeeds, name) + if p.prc != nil: globalError(p.prc.info, errSystemNeeds, name) else: rawMessage(errSystemNeeds, name) proc isSimpleExpr(n: PNode): bool = @@ -240,7 +241,7 @@ proc genOr(p: PProc, a, b: PNode, r: var TCompRes) = type TMagicFrmt = array[0..3, string] - TMagicOps = array[mAddi..mStrToStr, TMagicFrmt] + TMagicOps = array[mAddI..mStrToStr, TMagicFrmt] const # magic checked op; magic unchecked op; checked op; unchecked op jsOps: TMagicOps = [ @@ -485,14 +486,14 @@ proc arith(p: PProc, n: PNode, r: var TCompRes, op: TMagic) = proc genLineDir(p: PProc, n: PNode) = let line = toLinenumber(n.info) - if optLineDir in p.Options: + if optLineDir in p.options: appf(p.body, "// line $2 \"$1\"$n" | "-- line $2 \"$1\"$n", [toRope(toFilename(n.info)), toRope(line)]) - if {optStackTrace, optEndb} * p.Options == {optStackTrace, optEndb} and + if {optStackTrace, optEndb} * p.options == {optStackTrace, optEndb} and ((p.prc == nil) or sfPure notin p.prc.flags): useMagic(p, "endb") appf(p.body, "endb($1);$n", [toRope(line)]) - elif ({optLineTrace, optStackTrace} * p.Options == + elif ({optLineTrace, optStackTrace} * p.options == {optLineTrace, optStackTrace}) and ((p.prc == nil) or not (sfPure in p.prc.flags)): appf(p.body, "F.line = $1;$n", [toRope(line)]) @@ -504,7 +505,7 @@ proc genWhileStmt(p: PProc, n: PNode) = genLineDir(p, n) inc(p.unique) var length = len(p.blocks) - setlen(p.blocks, length + 1) + setLen(p.blocks, length + 1) p.blocks[length].id = -p.unique p.blocks[length].isLoop = true let labl = p.unique.toRope @@ -514,7 +515,7 @@ proc genWhileStmt(p: PProc, n: PNode) = [cond.res, labl]) genStmt(p, n.sons[1]) appf(p.body, "}$n" | "end ::L$#::$n", [labl]) - setlen(p.blocks, length) + setLen(p.blocks, length) proc moveInto(p: PProc, src: var TCompRes, dest: TCompRes) = if src.kind != resNone: @@ -555,7 +556,7 @@ proc genTry(p: PProc, n: PNode, r: var TCompRes) = "var $1 = {prev: excHandler, exc: null};$nexcHandler = $1;$n" | "local $1 = pcall(", [safePoint]) - if optStackTrace in p.Options: app(p.body, "framePtr = F;" & tnl) + if optStackTrace in p.options: app(p.body, "framePtr = F;" & tnl) appf(p.body, "try {$n" | "function()$n") var length = sonsLen(n) var a: TCompRes @@ -579,7 +580,7 @@ proc genTry(p: PProc, n: PNode, r: var TCompRes) = useMagic(p, "isObj") for j in countup(0, blen - 2): if n.sons[i].sons[j].kind != nkType: - InternalError(n.info, "genTryStmt") + internalError(n.info, "genTryStmt") if orExpr != nil: app(orExpr, "||" | " or ") appf(orExpr, "isObj($1.exc.m_type, $2)", [safePoint, genTypeInfo(p, n.sons[i].sons[j].typ)]) @@ -641,13 +642,13 @@ proc genCaseJS(p: PProc, n: PNode, r: var TCompRes) = while v.intVal <= e.sons[1].intVal: gen(p, v, cond) appf(p.body, "case $1: ", [cond.rdLoc]) - Inc(v.intVal) + inc(v.intVal) else: if stringSwitch: case e.kind of nkStrLit..nkTripleStrLit: appf(p.body, "case $1: ", [makeJSString(e.strVal)]) - else: InternalError(e.info, "jsgen.genCaseStmt: 2") + else: internalError(e.info, "jsgen.genCaseStmt: 2") else: gen(p, e, cond) appf(p.body, "case $1: ", [cond.rdLoc]) @@ -694,7 +695,7 @@ proc genCaseLua(p: PProc, n: PNode, r: var TCompRes) = case e.kind of nkStrLit..nkTripleStrLit: appf(p.body, "eqStr($1, $2)", [tmp, makeJSString(e.strVal)]) - else: InternalError(e.info, "jsgen.genCaseStmt: 2") + else: internalError(e.info, "jsgen.genCaseStmt: 2") else: gen(p, e, cond) appf(p.body, "$1 == $2", [tmp, cond.rdLoc]) @@ -713,17 +714,17 @@ proc genBlock(p: PProc, n: PNode, r: var TCompRes) = let idx = len(p.blocks) if n.sons[0].kind != nkEmpty: # named block? - if (n.sons[0].kind != nkSym): InternalError(n.info, "genBlock") + if (n.sons[0].kind != nkSym): internalError(n.info, "genBlock") var sym = n.sons[0].sym sym.loc.k = locOther sym.loc.a = idx - setlen(p.blocks, idx + 1) + setLen(p.blocks, idx + 1) p.blocks[idx].id = - p.unique # negative because it isn't used yet let labl = p.unique appf(p.body, "L$1: do {$n" | "", labl.toRope) gen(p, n.sons[1], r) appf(p.body, "} while(false);$n" | "$n::L$#::$n", labl.toRope) - setlen(p.blocks, idx) + setLen(p.blocks, idx) proc genBreakStmt(p: PProc, n: PNode) = var idx: int @@ -739,7 +740,7 @@ proc genBreakStmt(p: PProc, n: PNode) = idx = len(p.blocks) - 1 while idx >= 0 and not p.blocks[idx].isLoop: dec idx if idx < 0 or not p.blocks[idx].isLoop: - InternalError(n.info, "no loop to break") + internalError(n.info, "no loop to break") p.blocks[idx].id = abs(p.blocks[idx].id) # label is used appf(p.body, "break L$1;$n" | "goto ::L$1::;$n", [toRope(p.blocks[idx].id)]) @@ -747,10 +748,10 @@ proc genAsmStmt(p: PProc, n: PNode) = genLineDir(p, n) assert(n.kind == nkAsmStmt) for i in countup(0, sonsLen(n) - 1): - case n.sons[i].Kind + case n.sons[i].kind of nkStrLit..nkTripleStrLit: app(p.body, n.sons[i].strVal) of nkSym: app(p.body, mangleName(n.sons[i].sym)) - else: InternalError(n.sons[i].info, "jsgen: genAsmStmt()") + else: internalError(n.sons[i].info, "jsgen: genAsmStmt()") proc genIf(p: PProc, n: PNode, r: var TCompRes) = var cond, stmt: TCompRes @@ -851,7 +852,7 @@ proc getFieldPosition(f: PNode): int = case f.kind of nkIntLit..nkUInt64Lit: result = int(f.intVal) of nkSym: result = f.sym.position - else: InternalError(f.info, "genFieldPosition") + else: internalError(f.info, "genFieldPosition") proc genFieldAddr(p: PProc, n: PNode, r: var TCompRes) = var a: TCompRes @@ -861,11 +862,11 @@ proc genFieldAddr(p: PProc, n: PNode, r: var TCompRes) = if skipTypes(b.sons[0].typ, abstractVarRange).kind == tyTuple: r.res = makeJSString("Field" & $getFieldPosition(b.sons[1])) else: - if b.sons[1].kind != nkSym: InternalError(b.sons[1].info, "genFieldAddr") + if b.sons[1].kind != nkSym: internalError(b.sons[1].info, "genFieldAddr") var f = b.sons[1].sym if f.loc.r == nil: f.loc.r = mangleName(f) r.res = makeJSString(ropeToStr(f.loc.r)) - InternalAssert a.typ != etyBaseIndex + internalAssert a.typ != etyBaseIndex r.address = a.res r.kind = resExpr @@ -875,7 +876,7 @@ proc genFieldAccess(p: PProc, n: PNode, r: var TCompRes) = if skipTypes(n.sons[0].typ, abstractVarRange).kind == tyTuple: r.res = ropef("$1.Field$2", [r.res, getFieldPosition(n.sons[1]).toRope]) else: - if n.sons[1].kind != nkSym: InternalError(n.sons[1].info, "genFieldAddr") + if n.sons[1].kind != nkSym: internalError(n.sons[1].info, "genFieldAddr") var f = n.sons[1].sym if f.loc.r == nil: f.loc.r = mangleName(f) r.res = ropef("$1.$2", [r.res, f.loc.r]) @@ -890,14 +891,14 @@ proc genCheckedFieldAccess(p: PProc, n: PNode, r: var TCompRes) = proc genArrayAddr(p: PProc, n: PNode, r: var TCompRes) = var a, b: TCompRes - first: biggestInt + first: BiggestInt r.typ = etyBaseIndex gen(p, n.sons[0], a) gen(p, n.sons[1], b) - InternalAssert a.typ != etyBaseIndex and b.typ != etyBaseIndex + internalAssert a.typ != etyBaseIndex and b.typ != etyBaseIndex r.address = a.res var typ = skipTypes(n.sons[0].typ, abstractPtrs) - if typ.kind in {tyArray, tyArrayConstr}: first = FirstOrd(typ.sons[0]) + if typ.kind in {tyArray, tyArrayConstr}: first = firstOrd(typ.sons[0]) else: first = 0 if optBoundsCheck in p.options and not isConstExpr(n.sons[1]): useMagic(p, "chckIndx") @@ -918,9 +919,9 @@ proc genArrayAccess(p: PProc, n: PNode, r: var TCompRes) = genArrayAddr(p, n, r) of tyTuple: genFieldAddr(p, n, r) - else: InternalError(n.info, "expr(nkBracketExpr, " & $ty.kind & ')') + else: internalError(n.info, "expr(nkBracketExpr, " & $ty.kind & ')') r.typ = etyNone - if r.res == nil: InternalError(n.info, "genArrayAccess") + if r.res == nil: internalError(n.info, "genArrayAccess") r.res = ropef("$1[$2]", [r.address, r.res]) r.address = nil r.kind = resExpr @@ -929,7 +930,7 @@ proc genAddr(p: PProc, n: PNode, r: var TCompRes) = case n.sons[0].kind of nkSym: let s = n.sons[0].sym - if s.loc.r == nil: InternalError(n.info, "genAddr: 3") + if s.loc.r == nil: internalError(n.info, "genAddr: 3") case s.kind of skVar, skLet, skResult: r.kind = resExpr @@ -948,8 +949,8 @@ proc genAddr(p: PProc, n: PNode, r: var TCompRes) = r.address = s.loc.r r.res = toRope("0") else: - InternalError(n.info, "genAddr: 4") - else: InternalError(n.info, "genAddr: 2") + internalError(n.info, "genAddr: 4") + else: internalError(n.info, "genAddr: 2") of nkCheckedFieldExpr: genCheckedFieldAddr(p, n, r) of nkDotExpr: @@ -963,15 +964,15 @@ proc genAddr(p: PProc, n: PNode, r: var TCompRes) = genArrayAddr(p, n, r) of tyTuple: genFieldAddr(p, n, r) - else: InternalError(n.info, "expr(nkBracketExpr, " & $ty.kind & ')') - else: InternalError(n.info, "genAddr") + else: internalError(n.info, "expr(nkBracketExpr, " & $ty.kind & ')') + else: internalError(n.info, "genAddr") proc genSym(p: PProc, n: PNode, r: var TCompRes) = var s = n.sym case s.kind of skVar, skLet, skParam, skTemp, skResult: if s.loc.r == nil: - InternalError(n.info, "symbol has no generated name: " & s.name.s) + internalError(n.info, "symbol has no generated name: " & s.name.s) var k = mapType(s.typ) if k == etyBaseIndex: r.typ = etyBaseIndex @@ -988,17 +989,17 @@ proc genSym(p: PProc, n: PNode, r: var TCompRes) = of skConst: genConstant(p, s) if s.loc.r == nil: - InternalError(n.info, "symbol has no generated name: " & s.name.s) + internalError(n.info, "symbol has no generated name: " & s.name.s) r.res = s.loc.r of skProc, skConverter, skMethod: discard mangleName(s) r.res = s.loc.r if lfNoDecl in s.loc.flags or s.magic != mNone or {sfImportc, sfInfixCall} * s.flags != {}: - nil + discard elif s.kind == skMethod and s.getBody.kind == nkEmpty: # we cannot produce code for the dispatcher yet: - nil + discard elif sfForward in s.flags: p.g.forwarded.add(s) elif not p.g.generatedSyms.containsOrIncl(s.id): @@ -1010,7 +1011,7 @@ proc genSym(p: PProc, n: PNode, r: var TCompRes) = else: app(p.g.code, newp) else: if s.loc.r == nil: - InternalError(n.info, "symbol has no generated name: " & s.name.s) + internalError(n.info, "symbol has no generated name: " & s.name.s) r.res = s.loc.r r.kind = resVal @@ -1020,7 +1021,7 @@ proc genDeref(p: PProc, n: PNode, r: var TCompRes) = else: var a: TCompRes gen(p, n.sons[0], a) - if a.typ != etyBaseIndex: InternalError(n.info, "genDeref") + if a.typ != etyBaseIndex: internalError(n.info, "genDeref") r.res = ropef("$1[$2]", [a.address, a.res]) proc genArg(p: PProc, n: PNode, r: var TCompRes) = @@ -1051,7 +1052,7 @@ proc genInfixCall(p: PProc, n: PNode, r: var TCompRes) = gen(p, n.sons[1], r) if r.typ == etyBaseIndex: if r.address == nil: - GlobalError(n.info, "cannot invoke with infix syntax") + globalError(n.info, "cannot invoke with infix syntax") r.res = ropef("$1[$2]", [r.address, r.res]) r.address = nil r.typ = etyNone @@ -1093,7 +1094,7 @@ proc createRecordVarAux(p: PProc, rec: PNode, c: var int): PRope = app(result, ": ") app(result, createVar(p, rec.sym.typ, false)) inc(c) - else: InternalError(rec.info, "createRecordVarAux") + else: internalError(rec.info, "createRecordVarAux") proc createVar(p: PProc, typ: PType, indirect: bool): PRope = var t = skipTypes(typ, abstractInst) @@ -1125,7 +1126,7 @@ proc createVar(p: PProc, typ: PType, indirect: bool): PRope = app(result, "]") of tyTuple: result = toRope("{") - for i in 0.. <t.sonslen: + for i in 0.. <t.sonsLen: if i > 0: app(result, ", ") appf(result, "Field$1: $2" | "Field$# = $#", i.toRope, createVar(p, t.sons[i], false)) @@ -1173,7 +1174,7 @@ proc genVarInit(p: PProc, v: PSym, n: PNode) = useMagic(p, "NimCopy") s = ropef("NimCopy($1, $2)", [a.res, genTypeInfo(p, n.typ)]) of etyBaseIndex: - if (a.typ != etyBaseIndex): InternalError(n.info, "genVarInit") + if (a.typ != etyBaseIndex): internalError(n.info, "genVarInit") if {sfAddrTaken, sfGlobal} * v.flags != {}: appf(p.body, "var $1 = [$2, $3];$n" | "local $1 = {$2, $3};$n", [v.loc.r, a.address, a.res]) @@ -1227,7 +1228,7 @@ proc genOrd(p: PProc, n: PNode, r: var TCompRes) = case skipTypes(n.sons[1].typ, abstractVar).kind of tyEnum, tyInt..tyInt64, tyChar: gen(p, n.sons[1], r) of tyBool: unaryExpr(p, n, r, "", "($1 ? 1:0)" | "toBool($#)") - else: InternalError(n.info, "genOrd") + else: internalError(n.info, "genOrd") proc genConStrStr(p: PProc, n: PNode, r: var TCompRes) = var a: TCompRes @@ -1293,20 +1294,20 @@ proc genMagic(p: PProc, n: PNode, r: var TCompRes) = case op of mOr: genOr(p, n.sons[1], n.sons[2], r) of mAnd: genAnd(p, n.sons[1], n.sons[2], r) - of mAddi..mStrToStr: arith(p, n, r, op) + of mAddI..mStrToStr: arith(p, n, r, op) of mRepr: genRepr(p, n, r) of mSwap: genSwap(p, n) of mUnaryLt: # XXX: range checking? - if not (optOverflowCheck in p.Options): unaryExpr(p, n, r, "", "$1 - 1") + if not (optOverflowCheck in p.options): unaryExpr(p, n, r, "", "$1 - 1") else: unaryExpr(p, n, r, "subInt", "subInt($1, 1)") of mPred: # XXX: range checking? - if not (optOverflowCheck in p.Options): binaryExpr(p, n, r, "", "$1 - $2") + if not (optOverflowCheck in p.options): binaryExpr(p, n, r, "", "$1 - $2") else: binaryExpr(p, n, r, "subInt", "subInt($1, $2)") of mSucc: # XXX: range checking? - if not (optOverflowCheck in p.Options): binaryExpr(p, n, r, "", "$1 - $2") + if not (optOverflowCheck in p.options): binaryExpr(p, n, r, "", "$1 - $2") else: binaryExpr(p, n, r, "addInt", "addInt($1, $2)") of mAppendStrCh: binaryExpr(p, n, r, "addChar", "addChar($1, $2)") of mAppendStrStr: @@ -1335,10 +1336,10 @@ proc genMagic(p: PProc, n: PNode, r: var TCompRes) = else: unaryExpr(p, n, r, "", "($1.length-1)") of mInc: - if not (optOverflowCheck in p.Options): binaryExpr(p, n, r, "", "$1 += $2") + if optOverflowCheck notin p.options: binaryExpr(p, n, r, "", "$1 += $2") else: binaryExpr(p, n, r, "addInt", "$1 = addInt($1, $2)") of ast.mDec: - if not (optOverflowCheck in p.Options): binaryExpr(p, n, r, "", "$1 -= $2") + if optOverflowCheck notin p.options: binaryExpr(p, n, r, "", "$1 -= $2") else: binaryExpr(p, n, r, "subInt", "$1 = subInt($1, $2)") of mSetLengthStr: binaryExpr(p, n, r, "", "$1.length = ($2)-1") of mSetLengthSeq: binaryExpr(p, n, r, "", "$1.length = $2") @@ -1416,7 +1417,7 @@ proc genObjConstr(p: PProc, n: PNode, r: var TCompRes) = for i in countup(1, sonsLen(n) - 1): if i > 0: app(r.res, ", ") var it = n.sons[i] - InternalAssert it.kind == nkExprColonExpr + internalAssert it.kind == nkExprColonExpr gen(p, it.sons[1], a) var f = it.sons[0].sym if f.loc.r == nil: f.loc.r = mangleName(f) @@ -1451,7 +1452,7 @@ proc convStrToCStr(p: PProc, n: PNode, r: var TCompRes) = gen(p, n.sons[0].sons[0], r) else: gen(p, n.sons[0], r) - if r.res == nil: InternalError(n.info, "convStrToCStr") + if r.res == nil: internalError(n.info, "convStrToCStr") useMagic(p, "toJSStr") r.res = ropef("toJSStr($1)", [r.res]) r.kind = resExpr @@ -1463,14 +1464,14 @@ proc convCStrToStr(p: PProc, n: PNode, r: var TCompRes) = gen(p, n.sons[0].sons[0], r) else: gen(p, n.sons[0], r) - if r.res == nil: InternalError(n.info, "convCStrToStr") + if r.res == nil: internalError(n.info, "convCStrToStr") useMagic(p, "cstrToNimstr") r.res = ropef("cstrToNimstr($1)", [r.res]) r.kind = resExpr proc genReturnStmt(p: PProc, n: PNode) = - if p.procDef == nil: InternalError(n.info, "genReturnStmt") - p.BeforeRetNeeded = true + if p.procDef == nil: internalError(n.info, "genReturnStmt") + p.beforeRetNeeded = true if (n.sons[0].kind != nkEmpty): genStmt(p, n.sons[0]) else: @@ -1543,7 +1544,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = r.res = toRope(n.intVal) of nkNilLit: if isEmptyType(n.typ): - nil + discard elif mapType(n.typ) == etyBaseIndex: r.typ = etyBaseIndex r.address = toRope"null" | toRope"nil" @@ -1564,7 +1565,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = elif f == 0.5 * f: if f > 0.0: r.res = toRope"Infinity" else: r.res = toRope"-Infinity" - else: r.res = toRope(f.ToStrMaxPrecision) + else: r.res = toRope(f.toStrMaxPrecision) of nkCallKinds: if (n.sons[0].kind == nkSym) and (n.sons[0].sym.magic != mNone): genMagic(p, n, r) @@ -1591,12 +1592,12 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = of nkChckRange: genRangeChck(p, n, r, "chckRange") of nkStringToCString: convStrToCStr(p, n, r) of nkCStringToString: convCStrToStr(p, n, r) - of nkEmpty: nil + of nkEmpty: discard of nkLambdaKinds: let s = n.sons[namePos].sym discard mangleName(s) r.res = s.loc.r - if lfNoDecl in s.loc.flags or s.magic != mNone: nil + if lfNoDecl in s.loc.flags or s.magic != mNone: discard elif not p.g.generatedSyms.containsOrIncl(s.id): app(p.locals, genProc(p, s)) of nkMetaNode: gen(p, n.sons[0], r) @@ -1613,7 +1614,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = of nkIfStmt, nkIfExpr: genIf(p, n, r) of nkWhileStmt: genWhileStmt(p, n) of nkVarSection, nkLetSection: genVarStmt(p, n) - of nkConstSection: nil + of nkConstSection: discard of nkForStmt, nkParForStmt: internalError(n.info, "for statement not eliminated") of nkCaseStmt: @@ -1632,7 +1633,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = of nkRaiseStmt: genRaiseStmt(p, n) of nkTypeSection, nkCommentStmt, nkIteratorDef, nkIncludeStmt, nkImportStmt, nkImportExceptStmt, nkExportStmt, nkExportExceptStmt, - nkFromStmt, nkTemplateDef, nkMacroDef, nkPragma: nil + nkFromStmt, nkTemplateDef, nkMacroDef, nkPragma: discard of nkProcDef, nkMethodDef, nkConverterDef: var s = n.sons[namePos].sym if {sfExportc, sfCompilerProc} * s.flags == {sfExportc}: @@ -1640,7 +1641,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) = r.res = nil of nkGotoState, nkState: internalError(n.info, "first class iterators not implemented") - else: InternalError(n.info, "gen: unknown node type: " & $n.kind) + else: internalError(n.info, "gen: unknown node type: " & $n.kind) var globals: PGlobals @@ -1651,11 +1652,11 @@ proc newModule(module: PSym): BModule = proc genHeader(): PRope = result = ropef("/* Generated by the Nimrod Compiler v$1 */$n" & - "/* (c) 2013 Andreas Rumpf */$n$n" & + "/* (c) 2014 Andreas Rumpf */$n$n" & "$nvar Globals = this;$n" & "var framePtr = null;$n" & "var excHandler = null;$n", - [toRope(versionAsString)]) + [toRope(VersionAsString)]) proc genModule(p: PProc, n: PNode) = if optStackTrace in p.options: @@ -1671,7 +1672,7 @@ proc myProcess(b: PPassContext, n: PNode): PNode = if passes.skipCodegen(n): return n result = n var m = BModule(b) - if m.module == nil: InternalError(n.info, "myProcess") + if m.module == nil: internalError(n.info, "myProcess") var p = newProc(globals, m, nil, m.module.options) genModule(p, n) app(p.g.code, p.locals) @@ -1702,7 +1703,7 @@ proc myClose(b: PPassContext, n: PNode): PNode = discard writeRopeIfNotEqual(con(genHeader(), code), outfile) proc myOpenCached(s: PSym, rd: PRodReader): PPassContext = - InternalError("symbol files are not possible with the JS code generator") + internalError("symbol files are not possible with the JS code generator") result = nil proc myOpen(s: PSym): PPassContext = diff --git a/compiler/jstypes.nim b/compiler/jstypes.nim index 0be1e99dc..6d14076e1 100644 --- a/compiler/jstypes.nim +++ b/compiler/jstypes.nim @@ -37,7 +37,7 @@ proc genObjectFields(p: PProc, typ: PType, n: PNode): PRope = [mangleName(field), s, makeJSString(field.name.s)]) of nkRecCase: length = sonsLen(n) - if (n.sons[0].kind != nkSym): InternalError(n.info, "genObjectFields") + if (n.sons[0].kind != nkSym): internalError(n.info, "genObjectFields") field = n.sons[0].sym s = genTypeInfo(p, field.typ) for i in countup(1, length - 1): @@ -98,7 +98,7 @@ proc genEnumInfo(p: PProc, typ: PType, name: PRope) = let length = sonsLen(typ.n) var s: PRope = nil for i in countup(0, length - 1): - if (typ.n.sons[i].kind != nkSym): InternalError(typ.n.info, "genEnumInfo") + if (typ.n.sons[i].kind != nkSym): internalError(typ.n.info, "genEnumInfo") let field = typ.n.sons[i].sym if i > 0: app(s, ", " & tnl) let extName = if field.ast == nil: field.name.s else: field.ast.strVal @@ -119,7 +119,7 @@ proc genTypeInfo(p: PProc, typ: PType): PRope = var t = typ if t.kind == tyGenericInst: t = lastSon(t) result = ropef("NTI$1", [toRope(t.id)]) - if ContainsOrIncl(p.g.TypeInfoGenerated, t.id): return + if containsOrIncl(p.g.typeInfoGenerated, t.id): return case t.kind of tyDistinct: result = genTypeInfo(p, typ.sons[0]) @@ -145,4 +145,4 @@ proc genTypeInfo(p: PProc, typ: PType): PRope = of tyEnum: genEnumInfo(p, t, result) of tyObject: genObjectInfo(p, t, result) of tyTuple: genTupleInfo(p, t, result) - else: InternalError("genTypeInfo(" & $t.kind & ')') + else: internalError("genTypeInfo(" & $t.kind & ')') diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 96eb3a5f4..00fa04556 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -116,9 +116,9 @@ type TDep = tuple[e: PEnv, field: PSym] TEnv {.final.} = object of TObject attachedNode: PNode - closure: PSym # if != nil it is a used environment + createdVar: PSym # if != nil it is a used environment capturedVars: seq[PSym] # captured variables in this environment - deps: seq[TDep] # dependencies + deps: seq[TDep] # dependencies up: PEnv tup: PType @@ -130,12 +130,99 @@ type TOuterContext {.final.} = object fn: PSym # may also be a module! currentEnv: PEnv + isIter: bool # first class iterator? capturedVars, processed: TIntSet localsToEnv: TIdTable # PSym->PEnv mapping localsToAccess: TIdNodeTable lambdasToEnv: TIdTable # PSym->PEnv mapping up: POuterContext + closureParam, state, resultSym: PSym # only if isIter + tup: PType # only if isIter + + +proc getStateType(iter: PSym): PType = + var n = newNodeI(nkRange, iter.info) + addSon(n, newIntNode(nkIntLit, -1)) + addSon(n, newIntNode(nkIntLit, 0)) + result = newType(tyRange, iter) + result.n = n + rawAddSon(result, getSysType(tyInt)) + +proc createStateField(iter: PSym): PSym = + result = newSym(skField, getIdent(":state"), iter, iter.info) + result.typ = getStateType(iter) + +proc newIterResult(iter: PSym): PSym = + if resultPos < iter.ast.len: + result = iter.ast.sons[resultPos].sym + else: + # XXX a bit hacky: + result = newSym(skResult, getIdent":result", iter, iter.info) + result.typ = iter.typ.sons[0] + incl(result.flags, sfUsed) + iter.ast.add newSymNode(result) + +proc addHiddenParam(routine: PSym, param: PSym) = + var params = routine.ast.sons[paramsPos] + # -1 is correct here as param.position is 0 based but we have at position 0 + # some nkEffect node: + param.position = params.len-1 + addSon(params, newSymNode(param)) + incl(routine.typ.flags, tfCapturesEnv) + #echo "produced environment: ", param.id, " for ", routine.name.s + +proc getHiddenParam(routine: PSym): PSym = + let params = routine.ast.sons[paramsPos] + let hidden = lastSon(params) + assert hidden.kind == nkSym + result = hidden.sym + +proc getEnvParam(routine: PSym): PSym = + let params = routine.ast.sons[paramsPos] + let hidden = lastSon(params) + if hidden.kind == nkSym and hidden.sym.name.s == paramName: + result = hidden.sym + +proc addField(tup: PType, s: PSym) = + var field = newSym(skField, s.name, s.owner, s.info) + let t = skipIntLit(s.typ) + field.typ = t + field.position = sonsLen(tup) + addSon(tup.n, newSymNode(field)) + rawAddSon(tup, t) + +proc initIterContext(c: POuterContext, iter: PSym) = + c.fn = iter + c.capturedVars = initIntSet() + + var cp = getEnvParam(iter) + if cp == nil: + c.tup = newType(tyTuple, iter) + c.tup.n = newNodeI(nkRecList, iter.info) + + cp = newSym(skParam, getIdent(paramName), iter, iter.info) + incl(cp.flags, sfFromGeneric) + cp.typ = newType(tyRef, iter) + rawAddSon(cp.typ, c.tup) + addHiddenParam(iter, cp) + + c.state = createStateField(iter) + addField(c.tup, c.state) + else: + c.tup = cp.typ.sons[0] + assert c.tup.kind == tyTuple + if c.tup.len > 0: + c.state = c.tup.n[0].sym + else: + c.state = createStateField(iter) + addField(c.tup, c.state) + + c.closureParam = cp + if iter.typ.sons[0] != nil: + c.resultSym = newIterResult(iter) + #iter.ast.add(newSymNode(c.resultSym)) + proc newOuterContext(fn: PSym, up: POuterContext = nil): POuterContext = new(result) result.fn = fn @@ -144,12 +231,14 @@ proc newOuterContext(fn: PSym, up: POuterContext = nil): POuterContext = initIdNodeTable(result.localsToAccess) initIdTable(result.localsToEnv) initIdTable(result.lambdasToEnv) + result.isIter = fn.kind == skIterator and fn.typ.callConv == ccClosure + if result.isIter: initIterContext(result, fn) proc newInnerContext(fn: PSym): PInnerContext = new(result) result.fn = fn initIdNodeTable(result.localsToAccess) - + proc newEnv(outerProc: PSym, up: PEnv, n: PNode): PEnv = new(result) result.deps = @[] @@ -159,17 +248,12 @@ proc newEnv(outerProc: PSym, up: PEnv, n: PNode): PEnv = result.up = up result.attachedNode = n -proc addField(tup: PType, s: PSym) = - var field = newSym(skField, s.name, s.owner, s.info) - let t = skipIntLit(s.typ) - field.typ = t - field.position = sonsLen(tup) - addSon(tup.n, newSymNode(field)) - rawAddSon(tup, t) - proc addCapturedVar(e: PEnv, v: PSym) = for x in e.capturedVars: if x == v: return + # XXX meh, just add the state field for every closure for now, it's too + # hard to figure out if it comes from a closure iterator: + if e.tup.len == 0: addField(e.tup, createStateField(v.owner)) e.capturedVars.add(v) addField(e.tup, v) @@ -189,6 +273,7 @@ proc indirectAccess(a: PNode, b: PSym, info: TLineInfo): PNode = # returns a[].b as a node var deref = newNodeI(nkHiddenDeref, info) deref.typ = a.typ.sons[0] + assert deref.typ.kind == tyTuple let field = getSymFromList(deref.typ.n, b.name) assert field != nil, b.name.s addSon(deref, a) @@ -205,37 +290,30 @@ proc newCall(a, b: PSym): PNode = result.add newSymNode(a) result.add newSymNode(b) -proc addHiddenParam(routine: PSym, param: PSym) = - var params = routine.ast.sons[paramsPos] - param.position = params.len - addSon(params, newSymNode(param)) - incl(routine.typ.flags, tfCapturesEnv) - #echo "produced environment: ", param.id, " for ", routine.name.s - -proc getHiddenParam(routine: PSym): PSym = - let params = routine.ast.sons[paramsPos] - let hidden = lastSon(params) - assert hidden.kind == nkSym - result = hidden.sym - proc isInnerProc(s, outerProc: PSym): bool {.inline.} = - result = s.kind in {skProc, skMethod, skConverter} and + result = (s.kind in {skProc, skMethod, skConverter} or + s.kind == skIterator and s.typ.callConv == ccClosure) and s.skipGenericOwner == outerProc #s.typ.callConv == ccClosure proc addClosureParam(i: PInnerContext, e: PEnv) = - var cp = newSym(skParam, getIdent(paramname), i.fn, i.fn.info) - incl(cp.flags, sfFromGeneric) - cp.typ = newType(tyRef, i.fn) - rawAddSon(cp.typ, e.tup) + var cp = getEnvParam(i.fn) + if cp == nil: + cp = newSym(skParam, getIdent(paramName), i.fn, i.fn.info) + incl(cp.flags, sfFromGeneric) + cp.typ = newType(tyRef, i.fn) + rawAddSon(cp.typ, e.tup) + addHiddenParam(i.fn, cp) + else: + e.tup = cp.typ.sons[0] + assert e.tup.kind == tyTuple i.closureParam = cp - addHiddenParam(i.fn, i.closureParam) #echo "closure param added for ", i.fn.name.s, " ", i.fn.id proc dummyClosureParam(o: POuterContext, i: PInnerContext) = var e = o.currentEnv - if IdTableGet(o.lambdasToEnv, i.fn) == nil: - IdTablePut(o.lambdasToEnv, i.fn, e) + if idTableGet(o.lambdasToEnv, i.fn) == nil: + idTablePut(o.lambdasToEnv, i.fn, e) if i.closureParam == nil: addClosureParam(i, e) proc illegalCapture(s: PSym): bool {.inline.} = @@ -247,13 +325,13 @@ proc captureVar(o: POuterContext, i: PInnerContext, local: PSym, info: TLineInfo) = # for inlined variables the owner is still wrong, so it can happen that it's # not a captured variable at all ... *sigh* - var it = PEnv(IdTableGet(o.localsToEnv, local)) + var it = PEnv(idTableGet(o.localsToEnv, local)) if it == nil: return if illegalCapture(local) or o.fn.id != local.owner.id or i.fn.typ.callConv notin {ccClosure, ccDefault}: # Currently captures are restricted to a single level of nesting: - LocalError(info, errIllegalCaptureX, local.name.s) + localError(info, errIllegalCaptureX, local.name.s) i.fn.typ.callConv = ccClosure #echo "captureVar ", i.fn.name.s, i.fn.id, " ", local.name.s, local.id @@ -261,11 +339,11 @@ proc captureVar(o: POuterContext, i: PInnerContext, local: PSym, # we need to remember which inner most closure belongs to this lambda: var e = o.currentEnv - if IdTableGet(o.lambdasToEnv, i.fn) == nil: - IdTablePut(o.lambdasToEnv, i.fn, e) + if idTableGet(o.lambdasToEnv, i.fn) == nil: + idTablePut(o.lambdasToEnv, i.fn, e) # variable already captured: - if IdNodeTableGet(i.localsToAccess, local) != nil: return + if idNodeTableGet(i.localsToAccess, local) != nil: return if i.closureParam == nil: addClosureParam(i, e) # check which environment `local` belongs to: @@ -273,13 +351,13 @@ proc captureVar(o: POuterContext, i: PInnerContext, local: PSym, addCapturedVar(it, local) if it == e: # common case: local directly in current environment: - nil + discard else: # it's in some upper environment: access = indirectAccess(access, addDep(e, it, i.fn), info) access = indirectAccess(access, local, info) incl(o.capturedVars, local.id) - IdNodeTablePut(i.localsToAccess, local, access) + idNodeTablePut(i.localsToAccess, local, access) proc interestingVar(s: PSym): bool {.inline.} = result = s.kind in {skVar, skLet, skTemp, skForVar, skParam, skResult} and @@ -304,15 +382,17 @@ proc gatherVars(o: POuterContext, i: PInnerContext, n: PNode) = var s = n.sym if interestingVar(s) and i.fn.id != s.owner.id: captureVar(o, i, s, n.info) - elif isInnerProc(s, o.fn) and tfCapturesEnv in s.typ.flags and s != i.fn: + elif s.kind in {skProc, skMethod, skConverter} and + s.skipGenericOwner == o.fn and + tfCapturesEnv in s.typ.flags and s != i.fn: # call to some other inner proc; we need to track the dependencies for # this: - let env = PEnv(IdTableGet(o.lambdasToEnv, i.fn)) - if env == nil: InternalError(n.info, "no environment computed") + let env = PEnv(idTableGet(o.lambdasToEnv, i.fn)) + if env == nil: internalError(n.info, "no environment computed") if o.currentEnv != env: discard addDep(o.currentEnv, env, i.fn) - InternalError(n.info, "too complex environment handling required") - of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: nil + internalError(n.info, "too complex environment handling required") + of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit, nkClosure: discard else: for k in countup(0, sonsLen(n) - 1): gatherVars(o, i, n.sons[k]) @@ -349,7 +429,7 @@ proc makeClosure(prc, env: PSym, info: TLineInfo): PNode = proc transformInnerProc(o: POuterContext, i: PInnerContext, n: PNode): PNode = case n.kind - of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: nil + of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: discard of nkSym: let s = n.sym if s == i.fn: @@ -363,13 +443,14 @@ proc transformInnerProc(o: POuterContext, i: PInnerContext, n: PNode): PNode = result = makeClosure(s, i.closureParam, n.info) else: # captured symbol? - result = IdNodeTableGet(i.localsToAccess, n.sym) - of nkLambdaKinds: - result = transformInnerProc(o, i, n.sons[namePos]) + result = idNodeTableGet(i.localsToAccess, n.sym) + of nkLambdaKinds, nkIteratorDef: + if n.typ != nil: + result = transformInnerProc(o, i, n.sons[namePos]) of nkProcDef, nkMethodDef, nkConverterDef, nkMacroDef, nkTemplateDef, - nkIteratorDef: + nkClosure: # don't recurse here: - nil + discard else: for j in countup(0, sonsLen(n) - 1): let x = transformInnerProc(o, i, n.sons[j]) @@ -384,7 +465,7 @@ proc searchForInnerProcs(o: POuterContext, n: PNode) = if n == nil: return case n.kind of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: - nil + discard of nkSym: if isInnerProc(n.sym, o.fn) and not containsOrIncl(o.processed, n.sym.id): var inner = newInnerContext(n.sym) @@ -398,8 +479,9 @@ proc searchForInnerProcs(o: POuterContext, n: PNode) = if inner.closureParam != nil: let ti = transformInnerProc(o, inner, body) if ti != nil: n.sym.ast.sons[bodyPos] = ti - of nkLambdaKinds: - searchForInnerProcs(o, n.sons[namePos]) + of nkLambdaKinds, nkIteratorDef: + if n.typ != nil: + searchForInnerProcs(o, n.sons[namePos]) of nkWhileStmt, nkForStmt, nkParForStmt, nkBlockStmt: # some nodes open a new scope, so they are candidates for the insertion # of closure creation; however for simplicity we merge closures between @@ -420,26 +502,26 @@ proc searchForInnerProcs(o: POuterContext, n: PNode) = # counts, not the block where it is captured! for i in countup(0, sonsLen(n) - 1): var it = n.sons[i] - if it.kind == nkCommentStmt: nil + if it.kind == nkCommentStmt: discard elif it.kind == nkIdentDefs: var L = sonsLen(it) - if it.sons[0].kind != nkSym: InternalError(it.info, "transformOuter") + if it.sons[0].kind != nkSym: internalError(it.info, "transformOuter") #echo "set: ", it.sons[0].sym.name.s, " ", o.currentBlock == nil - IdTablePut(o.localsToEnv, it.sons[0].sym, o.currentEnv) + idTablePut(o.localsToEnv, it.sons[0].sym, o.currentEnv) searchForInnerProcs(o, it.sons[L-1]) elif it.kind == nkVarTuple: var L = sonsLen(it) for j in countup(0, L-3): #echo "set: ", it.sons[j].sym.name.s, " ", o.currentBlock == nil - IdTablePut(o.localsToEnv, it.sons[j].sym, o.currentEnv) + idTablePut(o.localsToEnv, it.sons[j].sym, o.currentEnv) searchForInnerProcs(o, it.sons[L-1]) else: - InternalError(it.info, "transformOuter") + internalError(it.info, "transformOuter") of nkProcDef, nkMethodDef, nkConverterDef, nkMacroDef, nkTemplateDef, - nkIteratorDef: + nkClosure: # don't recurse here: # XXX recurse here and setup 'up' pointers - nil + discard else: for i in countup(0, sonsLen(n) - 1): searchForInnerProcs(o, n.sons[i]) @@ -461,19 +543,20 @@ proc addVar*(father, v: PNode) = addSon(vpart, ast.emptyNode) addSon(father, vpart) -proc getClosureVar(o: POuterContext, e: PEnv): PSym = - if e.closure == nil: - result = newSym(skVar, getIdent(envName), o.fn, e.attachedNode.info) - incl(result.flags, sfShadowed) - result.typ = newType(tyRef, o.fn) - result.typ.rawAddSon(e.tup) - e.closure = result - else: - result = e.closure +proc newClosureCreationVar(o: POuterContext; e: PEnv): PSym = + result = newSym(skVar, getIdent(envName), o.fn, e.attachedNode.info) + incl(result.flags, sfShadowed) + result.typ = newType(tyRef, o.fn) + result.typ.rawAddSon(e.tup) -proc generateClosureCreation(o: POuterContext, scope: PEnv): PNode = - var env = getClosureVar(o, scope) +proc getClosureVar(o: POuterContext; e: PEnv): PSym = + if e.createdVar == nil: + result = newClosureCreationVar(o, e) + e.createdVar = result + else: + result = e.createdVar +proc rawClosureCreation(o: POuterContext, scope: PEnv; env: PSym): PNode = result = newNodeI(nkStmtList, env.info) var v = newNodeI(nkVarSection, env.info) addVar(v, newSymNode(env)) @@ -488,23 +571,97 @@ proc generateClosureCreation(o: POuterContext, scope: PEnv): PNode = # maybe later: (sfByCopy in local.flags) # add ``env.param = param`` result.add(newAsgnStmt(fieldAccess, newSymNode(local), env.info)) - IdNodeTablePut(o.localsToAccess, local, fieldAccess) + idNodeTablePut(o.localsToAccess, local, fieldAccess) # add support for 'up' references: for e, field in items(scope.deps): # add ``env.up = env2`` result.add(newAsgnStmt(indirectAccess(env, field, env.info), newSymNode(getClosureVar(o, e)), env.info)) + +proc generateClosureCreation(o: POuterContext, scope: PEnv): PNode = + var env = getClosureVar(o, scope) + result = rawClosureCreation(o, scope, env) + +proc generateIterClosureCreation(o: POuterContext; env: PEnv; + scope: PNode): PSym = + result = newClosureCreationVar(o, env) + let cc = rawClosureCreation(o, env, result) + var insertPoint = scope.sons[0] + if insertPoint.kind == nkEmpty: scope.sons[0] = cc + else: + assert cc.kind == nkStmtList and insertPoint.kind == nkStmtList + for x in cc: insertPoint.add(x) + if env.createdVar == nil: env.createdVar = result + +proc interestingIterVar(s: PSym): bool {.inline.} = + result = s.kind in {skVar, skLet, skTemp, skForVar} and sfGlobal notin s.flags + +proc transformOuterProc(o: POuterContext, n: PNode): PNode + +proc transformYield(c: POuterContext, n: PNode): PNode = + inc c.state.typ.n.sons[1].intVal + let stateNo = c.state.typ.n.sons[1].intVal + + var stateAsgnStmt = newNodeI(nkAsgn, n.info) + stateAsgnStmt.add(indirectAccess(newSymNode(c.closureParam),c.state,n.info)) + stateAsgnStmt.add(newIntTypeNode(nkIntLit, stateNo, getSysType(tyInt))) + + var retStmt = newNodeI(nkReturnStmt, n.info) + if n.sons[0].kind != nkEmpty: + var a = newNodeI(nkAsgn, n.sons[0].info) + var retVal = transformOuterProc(c, n.sons[0]) + addSon(a, newSymNode(c.resultSym)) + addSon(a, if retVal.isNil: n.sons[0] else: retVal) + retStmt.add(a) + else: + retStmt.add(emptyNode) + + var stateLabelStmt = newNodeI(nkState, n.info) + stateLabelStmt.add(newIntTypeNode(nkIntLit, stateNo, getSysType(tyInt))) + + result = newNodeI(nkStmtList, n.info) + result.add(stateAsgnStmt) + result.add(retStmt) + result.add(stateLabelStmt) + +proc transformReturn(c: POuterContext, n: PNode): PNode = + result = newNodeI(nkStmtList, n.info) + var stateAsgnStmt = newNodeI(nkAsgn, n.info) + stateAsgnStmt.add(indirectAccess(newSymNode(c.closureParam),c.state,n.info)) + stateAsgnStmt.add(newIntTypeNode(nkIntLit, -1, getSysType(tyInt))) + result.add(stateAsgnStmt) + result.add(n) + +proc outerProcSons(o: POuterContext, n: PNode) = + for i in countup(0, sonsLen(n) - 1): + let x = transformOuterProc(o, n.sons[i]) + if x != nil: n.sons[i] = x proc transformOuterProc(o: POuterContext, n: PNode): PNode = if n == nil: return nil case n.kind - of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: nil + of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: discard of nkSym: var local = n.sym - var closure = PEnv(IdTableGet(o.lambdasToEnv, local)) + + if o.isIter and interestingIterVar(local) and o.fn.id == local.owner.id: + if not containsOrIncl(o.capturedVars, local.id): addField(o.tup, local) + return indirectAccess(newSymNode(o.closureParam), local, n.info) + + var closure = PEnv(idTableGet(o.lambdasToEnv, local)) if closure != nil: - # we need to replace the lambda with '(lambda, env)': - let a = closure.closure + # we need to replace the lambda with '(lambda, env)': + if local.kind == skIterator and local.typ.callConv == ccClosure: + # consider: [i1, i2, i1] Since we merged the iterator's closure + # with the captured owning variables, we need to generate the + # closure generation code again: + #if local == o.fn: message(n.info, errRecursiveDependencyX, local.name.s) + # XXX why doesn't this work? + let createdVar = generateIterClosureCreation(o, closure, + closure.attachedNode) + return makeClosure(local, createdVar, n.info) + + let a = closure.createdVar if a != nil: return makeClosure(local, a, n.info) else: @@ -514,12 +671,12 @@ proc transformOuterProc(o: POuterContext, n: PNode): PNode = if scope.sons[0].kind == nkEmpty: # change the empty node to contain the closure construction: scope.sons[0] = generateClosureCreation(o, closure) - let x = closure.closure + let x = closure.createdVar assert x != nil return makeClosure(local, x, n.info) if not contains(o.capturedVars, local.id): return - var env = PEnv(IdTableGet(o.localsToEnv, local)) + var env = PEnv(idTableGet(o.localsToEnv, local)) if env == nil: return var scope = env.attachedNode assert scope.kind == nkStmtList @@ -529,26 +686,55 @@ proc transformOuterProc(o: POuterContext, n: PNode): PNode = # change 'local' to 'closure.local', unless it's a 'byCopy' variable: # if sfByCopy notin local.flags: - result = IdNodeTableGet(o.localsToAccess, local) + result = idNodeTableGet(o.localsToAccess, local) assert result != nil, "cannot find: " & local.name.s # else it is captured by copy and this means that 'outer' should continue # to access the local as a local. - of nkLambdaKinds: - result = transformOuterProc(o, n.sons[namePos]) - of nkProcDef, nkMethodDef, nkConverterDef, nkMacroDef, nkTemplateDef, - nkIteratorDef: + of nkLambdaKinds, nkIteratorDef: + if n.typ != nil: + result = transformOuterProc(o, n.sons[namePos]) + of nkProcDef, nkMethodDef, nkConverterDef, nkMacroDef, nkTemplateDef, + nkClosure: # don't recurse here: - nil + discard of nkHiddenStdConv, nkHiddenSubConv, nkConv: let x = transformOuterProc(o, n.sons[1]) if x != nil: n.sons[1] = x result = transformOuterConv(n) + of nkYieldStmt: + if o.isIter: result = transformYield(o, n) + else: outerProcSons(o, n) + of nkReturnStmt: + if o.isIter: result = transformReturn(o, n) + else: outerProcSons(o, n) else: - for i in countup(0, sonsLen(n) - 1): - let x = transformOuterProc(o, n.sons[i]) - if x != nil: n.sons[i] = x + outerProcSons(o, n) + +proc liftIterator(c: POuterContext, body: PNode): PNode = + let iter = c.fn + result = newNodeI(nkStmtList, iter.info) + var gs = newNodeI(nkGotoState, iter.info) + gs.add(indirectAccess(newSymNode(c.closureParam), c.state, iter.info)) + result.add(gs) + var state0 = newNodeI(nkState, iter.info) + state0.add(newIntNode(nkIntLit, 0)) + result.add(state0) + + let newBody = transformOuterProc(c, body) + if newBody != nil: + result.add(newBody) + else: + result.add(body) + + var stateAsgnStmt = newNodeI(nkAsgn, iter.info) + stateAsgnStmt.add(indirectAccess(newSymNode(c.closureParam), + c.state,iter.info)) + stateAsgnStmt.add(newIntTypeNode(nkIntLit, -1, getSysType(tyInt))) + result.add(stateAsgnStmt) proc liftLambdas*(fn: PSym, body: PNode): PNode = + # XXX gCmd == cmdCompileToJS does not suffice! The compiletime stuff needs + # the transformation even when compiling to JS ... if body.kind == nkEmpty or gCmd == cmdCompileToJS: # ignore forward declaration: result = body @@ -560,16 +746,19 @@ proc liftLambdas*(fn: PSym, body: PNode): PNode = let params = fn.typ.n for i in 1.. <params.len: if params.sons[i].kind != nkSym: - InternalError(params.info, "liftLambdas: strange params") + internalError(params.info, "liftLambdas: strange params") let param = params.sons[i].sym - IdTablePut(o.localsToEnv, param, o.currentEnv) + idTablePut(o.localsToEnv, param, o.currentEnv) # put the 'result' into the environment so it can be captured: let ast = fn.ast if resultPos < sonsLen(ast) and ast.sons[resultPos].kind == nkSym: - IdTablePut(o.localsToEnv, ast.sons[resultPos].sym, o.currentEnv) + idTablePut(o.localsToEnv, ast.sons[resultPos].sym, o.currentEnv) searchForInnerProcs(o, body) - discard transformOuterProc(o, body) - result = ex + if o.isIter: + result = liftIterator(o, ex) + else: + discard transformOuterProc(o, body) + result = ex proc liftLambdasForTopLevel*(module: PSym, body: PNode): PNode = if body.kind == nkEmpty or gCmd == cmdCompileToJS: @@ -584,140 +773,15 @@ proc liftLambdasForTopLevel*(module: PSym, body: PNode): PNode = # ------------------- iterator transformation -------------------------------- -discard """ - iterator chain[S, T](a, b: *S->T, args: *S): T = - for x in a(args): yield x - for x in b(args): yield x - - let c = chain(f, g) - for x in c: echo x - - # translated to: - let c = chain( (f, newClosure(f)), (g, newClosure(g)), newClosure(chain)) -""" - -type - TIterContext {.final, pure.} = object - iter, closureParam, state, resultSym: PSym - capturedVars: TIntSet - tup: PType - -proc newIterResult(iter: PSym): PSym = - result = iter.ast.sons[resultPos].sym - when false: - result = newSym(skResult, getIdent":result", iter, iter.info) - result.typ = iter.typ.sons[0] - incl(result.flags, sfUsed) - -proc interestingIterVar(s: PSym): bool {.inline.} = - result = s.kind in {skVar, skLet, skTemp, skForVar} and sfGlobal notin s.flags - -proc transfIterBody(c: var TIterContext, n: PNode): PNode = - # gather used vars for closure generation - if n == nil: return nil - case n.kind - of nkSym: - var s = n.sym - if interestingIterVar(s) and c.iter.id == s.owner.id: - if not containsOrIncl(c.capturedVars, s.id): addField(c.tup, s) - result = indirectAccess(newSymNode(c.closureParam), s, n.info) - of nkEmpty..pred(nkSym), succ(nkSym)..nkNilLit: nil - of nkYieldStmt: - inc c.state.typ.n.sons[1].intVal - let stateNo = c.state.typ.n.sons[1].intVal - - var stateAsgnStmt = newNodeI(nkAsgn, n.info) - stateAsgnStmt.add(indirectAccess(newSymNode(c.closureParam),c.state,n.info)) - stateAsgnStmt.add(newIntTypeNode(nkIntLit, stateNo, getSysType(tyInt))) - - var retStmt = newNodeI(nkReturnStmt, n.info) - if n.sons[0].kind != nkEmpty: - var a = newNodeI(nkAsgn, n.sons[0].info) - var retVal = transfIterBody(c, n.sons[0]) - addSon(a, newSymNode(c.resultSym)) - addSon(a, if retVal.isNil: n.sons[0] else: retVal) - retStmt.add(a) - else: - retStmt.add(emptyNode) - - var stateLabelStmt = newNodeI(nkState, n.info) - stateLabelStmt.add(newIntTypeNode(nkIntLit, stateNo, getSysType(tyInt))) - - result = newNodeI(nkStmtList, n.info) - result.add(stateAsgnStmt) - result.add(retStmt) - result.add(stateLabelStmt) - of nkReturnStmt: - result = newNodeI(nkStmtList, n.info) - var stateAsgnStmt = newNodeI(nkAsgn, n.info) - stateAsgnStmt.add(indirectAccess(newSymNode(c.closureParam),c.state,n.info)) - stateAsgnStmt.add(newIntTypeNode(nkIntLit, -1, getSysType(tyInt))) - result.add(stateAsgnStmt) - result.add(n) - else: - for i in countup(0, sonsLen(n)-1): - let x = transfIterBody(c, n.sons[i]) - if x != nil: n.sons[i] = x - -proc getStateType(iter: PSym): PType = - var n = newNodeI(nkRange, iter.info) - addSon(n, newIntNode(nkIntLit, -1)) - addSon(n, newIntNode(nkIntLit, 0)) - result = newType(tyRange, iter) - result.n = n - rawAddSon(result, getSysType(tyInt)) - -proc liftIterator*(iter: PSym, body: PNode): PNode = - var c: TIterContext - c.iter = iter - c.capturedVars = initIntSet() - - c.tup = newType(tyTuple, iter) - c.tup.n = newNodeI(nkRecList, iter.info) - - var cp = newSym(skParam, getIdent(paramname), iter, iter.info) - incl(cp.flags, sfFromGeneric) - cp.typ = newType(tyRef, iter) - rawAddSon(cp.typ, c.tup) - c.closureParam = cp - addHiddenParam(iter, cp) - - c.state = newSym(skField, getIdent(":state"), iter, iter.info) - c.state.typ = getStateType(iter) - addField(c.tup, c.state) - - if iter.typ.sons[0] != nil: - c.resultSym = newIterResult(iter) - iter.ast.add(newSymNode(c.resultSym)) - - result = newNodeI(nkStmtList, iter.info) - var gs = newNodeI(nkGotoState, iter.info) - gs.add(indirectAccess(newSymNode(c.closureParam), c.state, iter.info)) - result.add(gs) - var state0 = newNodeI(nkState, iter.info) - state0.add(newIntNode(nkIntLit, 0)) - result.add(state0) - - let newBody = transfIterBody(c, body) - if newBody != nil: - result.add(newBody) - else: - result.add(body) - - var stateAsgnStmt = newNodeI(nkAsgn, iter.info) - stateAsgnStmt.add(indirectAccess(newSymNode(c.closureParam), - c.state,iter.info)) - stateAsgnStmt.add(newIntTypeNode(nkIntLit, -1, getSysType(tyInt))) - result.add(stateAsgnStmt) - proc liftIterSym*(n: PNode): PNode = # transforms (iter) to (let env = newClosure[iter](); (iter, env)) - result = newNodeIT(nkStmtListExpr, n.info, n.typ) let iter = n.sym assert iter.kind == skIterator + + result = newNodeIT(nkStmtListExpr, n.info, n.typ) + var env = copySym(getHiddenParam(iter)) env.kind = skLet - var v = newNodeI(nkVarSection, n.info) addVar(v, newSymNode(env)) result.add(v) @@ -754,7 +818,7 @@ proc liftForLoop*(body: PNode): PNode = ... """ var L = body.len - InternalAssert body.kind == nkForStmt and body[L-2].kind in nkCallKinds + internalAssert body.kind == nkForStmt and body[L-2].kind in nkCallKinds var call = body[L-2] result = newNodeI(nkStmtList, body.info) @@ -762,7 +826,7 @@ proc liftForLoop*(body: PNode): PNode = # static binding? var env: PSym if call[0].kind == nkSym and call[0].sym.kind == skIterator: - # createClose() + # createClosure() let iter = call[0].sym assert iter.kind == skIterator env = copySym(getHiddenParam(iter)) @@ -789,7 +853,7 @@ proc liftForLoop*(body: PNode): PNode = addSon(vpart, body[i]) addSon(vpart, ast.emptyNode) # no explicit type - if not env.isnil: + if not env.isNil: call.sons[0] = makeClosure(call.sons[0].sym, env, body.info) addSon(vpart, call) addSon(v2, vpart) diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 82bfa0ad4..0e7df13cd 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -41,11 +41,12 @@ type tkGeneric, tkIf, tkImport, tkIn, tkInclude, tkInterface, tkIs, tkIsnot, tkIterator, tkLambda, tkLet, - tkMacro, tkMethod, tkMixin, tkUsing, tkMod, tkNil, tkNot, tkNotin, + tkMacro, tkMethod, tkMixin, tkMod, tkNil, tkNot, tkNotin, tkObject, tkOf, tkOr, tkOut, tkProc, tkPtr, tkRaise, tkRef, tkReturn, tkShared, tkShl, tkShr, tkStatic, tkTemplate, - tkTry, tkTuple, tkType, tkVar, tkWhen, tkWhile, tkWith, tkWithout, tkXor, + tkTry, tkTuple, tkType, tkUsing, + tkVar, tkWhen, tkWhile, tkWith, tkWithout, tkXor, tkYield, # end of keywords tkIntLit, tkInt8Lit, tkInt16Lit, tkInt32Lit, tkInt64Lit, tkUIntLit, tkUInt8Lit, tkUInt16Lit, tkUInt32Lit, tkUInt64Lit, @@ -75,12 +76,13 @@ const "finally", "for", "from", "generic", "if", "import", "in", "include", "interface", "is", "isnot", "iterator", "lambda", "let", - "macro", "method", "mixin", "using", "mod", + "macro", "method", "mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc", "ptr", "raise", "ref", "return", "shared", "shl", "shr", "static", "template", - "try", "tuple", "type", "var", "when", "while", "with", "without", "xor", + "try", "tuple", "type", "using", + "var", "when", "while", "with", "without", "xor", "yield", "tkIntLit", "tkInt8Lit", "tkInt16Lit", "tkInt32Lit", "tkInt64Lit", "tkUIntLit", "tkUInt8Lit", "tkUInt16Lit", "tkUInt32Lit", "tkUInt64Lit", @@ -130,11 +132,11 @@ proc getLineInfo*(L: TLexer, tok: TToken): TLineInfo {.inline.} = newLineInfo(L.fileIdx, tok.line, tok.col) proc closeLexer*(lex: var TLexer) -proc PrintTok*(tok: TToken) +proc printTok*(tok: TToken) proc tokToStr*(tok: TToken): string proc openLexer*(lex: var TLexer, filename: string, inputstream: PLLStream) = - OpenLexer(lex, filename.fileInfoIdx, inputStream) + openLexer(lex, filename.fileInfoIdx, inputstream) proc lexMessage*(L: TLexer, msg: TMsgKind, arg = "") @@ -158,19 +160,19 @@ proc tokToStr*(tok: TToken): string = of tkFloatLit..tkFloat64Lit: result = $tok.fNumber of tkInvalid, tkStrLit..tkCharLit, tkComment: result = tok.literal of tkParLe..tkColon, tkEof, tkAccent: - result = tokTypeToStr[tok.tokType] + result = TokTypeToStr[tok.tokType] else: if tok.ident != nil: result = tok.ident.s else: - InternalError("tokToStr") + internalError("tokToStr") result = "" proc prettyTok*(tok: TToken): string = - if IsKeyword(tok.tokType): result = "keyword " & tok.ident.s + if isKeyword(tok.tokType): result = "keyword " & tok.ident.s else: result = tokToStr(tok) -proc PrintTok*(tok: TToken) = +proc printTok*(tok: TToken) = write(stdout, TokTypeToStr[tok.tokType]) write(stdout, " ") writeln(stdout, tokToStr(tok)) @@ -178,18 +180,18 @@ proc PrintTok*(tok: TToken) = var dummyIdent: PIdent proc initToken*(L: var TToken) = - L.TokType = tkInvalid + L.tokType = tkInvalid L.iNumber = 0 - L.Indent = 0 + L.indent = 0 L.literal = "" L.fNumber = 0.0 L.base = base10 L.ident = dummyIdent proc fillToken(L: var TToken) = - L.TokType = tkInvalid + L.tokType = tkInvalid L.iNumber = 0 - L.Indent = 0 + L.indent = 0 setLen(L.literal, 0) L.fNumber = 0.0 L.base = base10 @@ -197,26 +199,26 @@ proc fillToken(L: var TToken) = proc openLexer(lex: var TLexer, fileIdx: int32, inputstream: PLLStream) = openBaseLexer(lex, inputstream) - lex.fileIdx = fileIdx + lex.fileIdx = fileidx lex.indentAhead = - 1 - inc(lex.Linenumber, inputstream.lineOffset) + inc(lex.lineNumber, inputstream.lineOffset) proc closeLexer(lex: var TLexer) = - inc(gLinesCompiled, lex.LineNumber) + inc(gLinesCompiled, lex.lineNumber) closeBaseLexer(lex) proc getColumn(L: TLexer): int = - result = getColNumber(L, L.bufPos) + result = getColNumber(L, L.bufpos) proc getLineInfo(L: TLexer): TLineInfo = - result = newLineInfo(L.fileIdx, L.linenumber, getColNumber(L, L.bufpos)) + result = newLineInfo(L.fileIdx, L.lineNumber, getColNumber(L, L.bufpos)) proc lexMessage(L: TLexer, msg: TMsgKind, arg = "") = - msgs.Message(getLineInfo(L), msg, arg) + msgs.message(getLineInfo(L), msg, arg) proc lexMessagePos(L: var TLexer, msg: TMsgKind, pos: int, arg = "") = - var info = newLineInfo(L.fileIdx, L.linenumber, pos - L.lineStart) - msgs.Message(info, msg, arg) + var info = newLineInfo(L.fileIdx, L.lineNumber, pos - L.lineStart) + msgs.message(info, msg, arg) proc matchUnderscoreChars(L: var TLexer, tok: var TToken, chars: TCharSet) = var pos = L.bufpos # use registers for pos, buf @@ -224,7 +226,7 @@ proc matchUnderscoreChars(L: var TLexer, tok: var TToken, chars: TCharSet) = while true: if buf[pos] in chars: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) else: break if buf[pos] == '_': @@ -232,11 +234,11 @@ proc matchUnderscoreChars(L: var TLexer, tok: var TToken, chars: TCharSet) = lexMessage(L, errInvalidToken, "_") break add(tok.literal, '_') - Inc(pos) - L.bufPos = pos + inc(pos) + L.bufpos = pos -proc matchTwoChars(L: TLexer, first: Char, second: TCharSet): bool = - result = (L.buf[L.bufpos] == first) and (L.buf[L.bufpos + 1] in Second) +proc matchTwoChars(L: TLexer, first: char, second: TCharSet): bool = + result = (L.buf[L.bufpos] == first) and (L.buf[L.bufpos + 1] in second) proc isFloatLiteral(s: string): bool = for i in countup(0, len(s) - 1): @@ -244,10 +246,10 @@ proc isFloatLiteral(s: string): bool = return true result = false -proc GetNumber(L: var TLexer): TToken = +proc getNumber(L: var TLexer): TToken = var pos, endpos: int - xi: biggestInt + xi: BiggestInt # get the base: result.tokType = tkIntLit # int literal until we know better result.literal = "" @@ -388,25 +390,25 @@ proc GetNumber(L: var TLexer): TToken = xi = `shl`(xi, 4) or (ord(L.buf[pos]) - ord('A') + 10) inc(pos) else: break - else: InternalError(getLineInfo(L), "getNumber") + else: internalError(getLineInfo(L), "getNumber") case result.tokType of tkIntLit, tkInt64Lit: result.iNumber = xi - of tkInt8Lit: result.iNumber = biggestInt(int8(toU8(int(xi)))) - of tkInt16Lit: result.iNumber = biggestInt(toU16(int(xi))) - of tkInt32Lit: result.iNumber = biggestInt(toU32(xi)) + of tkInt8Lit: result.iNumber = BiggestInt(int8(toU8(int(xi)))) + of tkInt16Lit: result.iNumber = BiggestInt(toU16(int(xi))) + of tkInt32Lit: result.iNumber = BiggestInt(toU32(xi)) of tkUIntLit, tkUInt64Lit: result.iNumber = xi - of tkUInt8Lit: result.iNumber = biggestInt(int8(toU8(int(xi)))) - of tkUInt16Lit: result.iNumber = biggestInt(toU16(int(xi))) - of tkUInt32Lit: result.iNumber = biggestInt(toU32(xi)) + of tkUInt8Lit: result.iNumber = BiggestInt(int8(toU8(int(xi)))) + of tkUInt16Lit: result.iNumber = BiggestInt(toU16(int(xi))) + of tkUInt32Lit: result.iNumber = BiggestInt(toU32(xi)) of tkFloat32Lit: result.fNumber = (cast[PFloat32](addr(xi)))[] # note: this code is endian neutral! # XXX: Test this on big endian machine! of tkFloat64Lit: result.fNumber = (cast[PFloat64](addr(xi)))[] - else: InternalError(getLineInfo(L), "getNumber") + else: internalError(getLineInfo(L), "getNumber") elif isFloatLiteral(result.literal) or (result.tokType == tkFloat32Lit) or (result.tokType == tkFloat64Lit): - result.fnumber = parseFloat(result.literal) + result.fNumber = parseFloat(result.literal) if result.tokType == tkIntLit: result.tokType = tkFloatLit else: result.iNumber = parseBiggestInt(result.literal) @@ -432,7 +434,7 @@ proc handleHexChar(L: var TLexer, xi: var int) = of 'A'..'F': xi = (xi shl 4) or (ord(L.buf[L.bufpos]) - ord('A') + 10) inc(L.bufpos) - else: nil + else: discard proc handleDecChars(L: var TLexer, xi: var int) = while L.buf[L.bufpos] in {'0'..'9'}: @@ -443,51 +445,51 @@ proc getEscapedChar(L: var TLexer, tok: var TToken) = inc(L.bufpos) # skip '\' case L.buf[L.bufpos] of 'n', 'N': - if tok.toktype == tkCharLit: lexMessage(L, errNnotAllowedInCharacter) + if tok.tokType == tkCharLit: lexMessage(L, errNnotAllowedInCharacter) add(tok.literal, tnl) - Inc(L.bufpos) + inc(L.bufpos) of 'r', 'R', 'c', 'C': add(tok.literal, CR) - Inc(L.bufpos) + inc(L.bufpos) of 'l', 'L': add(tok.literal, LF) - Inc(L.bufpos) + inc(L.bufpos) of 'f', 'F': add(tok.literal, FF) inc(L.bufpos) of 'e', 'E': add(tok.literal, ESC) - Inc(L.bufpos) + inc(L.bufpos) of 'a', 'A': add(tok.literal, BEL) - Inc(L.bufpos) + inc(L.bufpos) of 'b', 'B': add(tok.literal, BACKSPACE) - Inc(L.bufpos) + inc(L.bufpos) of 'v', 'V': add(tok.literal, VT) - Inc(L.bufpos) + inc(L.bufpos) of 't', 'T': add(tok.literal, Tabulator) - Inc(L.bufpos) + inc(L.bufpos) of '\'', '\"': add(tok.literal, L.buf[L.bufpos]) - Inc(L.bufpos) + inc(L.bufpos) of '\\': add(tok.literal, '\\') - Inc(L.bufpos) + inc(L.bufpos) of 'x', 'X': inc(L.bufpos) var xi = 0 handleHexChar(L, xi) handleHexChar(L, xi) - add(tok.literal, Chr(xi)) + add(tok.literal, chr(xi)) of '0'..'9': if matchTwoChars(L, '0', {'0'..'9'}): lexMessage(L, warnOctalEscape) var xi = 0 handleDecChars(L, xi) - if (xi <= 255): add(tok.literal, Chr(xi)) + if (xi <= 255): add(tok.literal, chr(xi)) else: lexMessage(L, errInvalidCharacterConstant) else: lexMessage(L, errInvalidCharacterConstant) @@ -497,7 +499,7 @@ proc newString(s: cstring, len: int): string = for i in 0 .. <len: result[i] = s[i] -proc HandleCRLF(L: var TLexer, pos: int): int = +proc handleCRLF(L: var TLexer, pos: int): int = template registerLine = let col = L.getColNumber(pos) @@ -512,21 +514,21 @@ proc HandleCRLF(L: var TLexer, pos: int): int = case L.buf[pos] of CR: registerLine() - result = nimlexbase.HandleCR(L, pos) + result = nimlexbase.handleCR(L, pos) of LF: registerLine() - result = nimlexbase.HandleLF(L, pos) + result = nimlexbase.handleLF(L, pos) else: result = pos proc getString(L: var TLexer, tok: var TToken, rawMode: bool) = - var pos = L.bufPos + 1 # skip " + var pos = L.bufpos + 1 # skip " var buf = L.buf # put `buf` in a register - var line = L.linenumber # save linenumber for better error message + var line = L.lineNumber # save linenumber for better error message if buf[pos] == '\"' and buf[pos+1] == '\"': tok.tokType = tkTripleStrLit # long string literal: inc(pos, 2) # skip "" # skip leading newline: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf while true: case buf[pos] @@ -536,20 +538,20 @@ proc getString(L: var TLexer, tok: var TToken, rawMode: bool) = L.bufpos = pos + 3 # skip the three """ break add(tok.literal, '\"') - Inc(pos) + inc(pos) of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf add(tok.literal, tnl) of nimlexbase.EndOfFile: - var line2 = L.linenumber - L.LineNumber = line + var line2 = L.lineNumber + L.lineNumber = line lexMessagePos(L, errClosingTripleQuoteExpected, L.lineStart) - L.LineNumber = line2 + L.lineNumber = line2 break else: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) else: # ordinary string literal if rawMode: tok.tokType = tkRStrLit @@ -567,23 +569,23 @@ proc getString(L: var TLexer, tok: var TToken, rawMode: bool) = lexMessage(L, errClosingQuoteExpected) break elif (c == '\\') and not rawMode: - L.bufPos = pos + L.bufpos = pos getEscapedChar(L, tok) - pos = L.bufPos + pos = L.bufpos else: add(tok.literal, c) - Inc(pos) + inc(pos) L.bufpos = pos proc getCharacter(L: var TLexer, tok: var TToken) = - Inc(L.bufpos) # skip ' + inc(L.bufpos) # skip ' var c = L.buf[L.bufpos] case c - of '\0'..Pred(' '), '\'': lexMessage(L, errInvalidCharacterConstant) + of '\0'..pred(' '), '\'': lexMessage(L, errInvalidCharacterConstant) of '\\': getEscapedChar(L, tok) else: tok.literal = $c - Inc(L.bufpos) + inc(L.bufpos) if L.buf[L.bufpos] != '\'': lexMessage(L, errMissingFinalQuote) inc(L.bufpos) # skip ' @@ -604,7 +606,7 @@ proc getSymbol(L: var TLexer, tok: var TToken) = lexMessage(L, errInvalidToken, "_") break else: break - Inc(pos) + inc(pos) h = !$h tok.ident = getIdent(addr(L.buf[L.bufpos]), pos - L.bufpos, h) L.bufpos = pos @@ -629,8 +631,8 @@ proc getOperator(L: var TLexer, tok: var TToken) = while true: var c = buf[pos] if c notin OpChars: break - h = h !& Ord(c) - Inc(pos) + h = h !& ord(c) + inc(pos) endOperator(L, tok, pos, h) proc scanComment(L: var TLexer, tok: var TToken) = @@ -678,17 +680,17 @@ proc skip(L: var TLexer, tok: var TToken) = while true: case buf[pos] of ' ': - Inc(pos) + inc(pos) of Tabulator: lexMessagePos(L, errTabulatorsAreNotAllowed, pos) inc(pos) of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf var indent = 0 while buf[pos] == ' ': - Inc(pos) - Inc(indent) + inc(pos) + inc(indent) if buf[pos] > ' ': tok.indent = indent break @@ -705,7 +707,7 @@ proc rawGetTok(L: var TLexer, tok: var TToken) = tok.indent = -1 skip(L, tok) var c = L.buf[L.bufpos] - tok.line = L.linenumber + tok.line = L.lineNumber tok.col = getColNumber(L, L.bufpos) if c in SymStartChars - {'r', 'R', 'l'}: getSymbol(L, tok) @@ -722,8 +724,8 @@ proc rawGetTok(L: var TLexer, tok: var TToken) = else: getOperator(L, tok) of ',': - tok.toktype = tkComma - Inc(L.bufpos) + tok.tokType = tkComma + inc(L.bufpos) of 'l': # if we parsed exactly one character and its a small L (l), this # is treated as a warning because it may be confused with the number 1 @@ -731,59 +733,59 @@ proc rawGetTok(L: var TLexer, tok: var TToken) = lexMessage(L, warnSmallLshouldNotBeUsed) getSymbol(L, tok) of 'r', 'R': - if L.buf[L.bufPos + 1] == '\"': - Inc(L.bufPos) + if L.buf[L.bufpos + 1] == '\"': + inc(L.bufpos) getString(L, tok, true) else: getSymbol(L, tok) of '(': - Inc(L.bufpos) - if L.buf[L.bufPos] == '.' and L.buf[L.bufPos+1] != '.': - tok.toktype = tkParDotLe - Inc(L.bufpos) + inc(L.bufpos) + if L.buf[L.bufpos] == '.' and L.buf[L.bufpos+1] != '.': + tok.tokType = tkParDotLe + inc(L.bufpos) else: - tok.toktype = tkParLe + tok.tokType = tkParLe of ')': - tok.toktype = tkParRi - Inc(L.bufpos) + tok.tokType = tkParRi + inc(L.bufpos) of '[': - Inc(L.bufpos) - if L.buf[L.bufPos] == '.' and L.buf[L.bufPos+1] != '.': - tok.toktype = tkBracketDotLe - Inc(L.bufpos) + inc(L.bufpos) + if L.buf[L.bufpos] == '.' and L.buf[L.bufpos+1] != '.': + tok.tokType = tkBracketDotLe + inc(L.bufpos) else: - tok.toktype = tkBracketLe + tok.tokType = tkBracketLe of ']': - tok.toktype = tkBracketRi - Inc(L.bufpos) + tok.tokType = tkBracketRi + inc(L.bufpos) of '.': - if L.buf[L.bufPos+1] == ']': + if L.buf[L.bufpos+1] == ']': tok.tokType = tkBracketDotRi - Inc(L.bufpos, 2) - elif L.buf[L.bufPos+1] == '}': + inc(L.bufpos, 2) + elif L.buf[L.bufpos+1] == '}': tok.tokType = tkCurlyDotRi - Inc(L.bufpos, 2) - elif L.buf[L.bufPos+1] == ')': + inc(L.bufpos, 2) + elif L.buf[L.bufpos+1] == ')': tok.tokType = tkParDotRi - Inc(L.bufpos, 2) + inc(L.bufpos, 2) else: getOperator(L, tok) of '{': - Inc(L.bufpos) - if L.buf[L.bufPos] == '.' and L.buf[L.bufPos+1] != '.': - tok.toktype = tkCurlyDotLe - Inc(L.bufpos) + inc(L.bufpos) + if L.buf[L.bufpos] == '.' and L.buf[L.bufpos+1] != '.': + tok.tokType = tkCurlyDotLe + inc(L.bufpos) else: - tok.toktype = tkCurlyLe + tok.tokType = tkCurlyLe of '}': - tok.toktype = tkCurlyRi - Inc(L.bufpos) + tok.tokType = tkCurlyRi + inc(L.bufpos) of ';': - tok.toktype = tkSemiColon - Inc(L.bufpos) + tok.tokType = tkSemiColon + inc(L.bufpos) of '`': tok.tokType = tkAccent - Inc(L.bufpos) + inc(L.bufpos) of '\"': # check for extended raw string literal: var rawMode = L.bufpos > 0 and L.buf[L.bufpos-1] in SymChars @@ -802,12 +804,12 @@ proc rawGetTok(L: var TLexer, tok: var TToken) = if c in OpChars: getOperator(L, tok) elif c == nimlexbase.EndOfFile: - tok.toktype = tkEof + tok.tokType = tkEof tok.indent = 0 else: tok.literal = $c tok.tokType = tkInvalid lexMessage(L, errInvalidToken, c & " (\\" & $(ord(c)) & ')') - Inc(L.bufpos) + inc(L.bufpos) dummyIdent = getIdent("") diff --git a/compiler/lists.nim b/compiler/lists.nim index 67b32f919..dd4f5d6be 100644 --- a/compiler/lists.nim +++ b/compiler/lists.nim @@ -20,17 +20,17 @@ type PStrEntry* = ref TStrEntry TLinkedList* = object # for the "find" operation: head*, tail*: PListEntry - Counter*: int + counter*: int - TCompareProc* = proc (entry: PListEntry, closure: Pointer): bool {.nimcall.} + TCompareProc* = proc (entry: PListEntry, closure: pointer): bool {.nimcall.} -proc InitLinkedList*(list: var TLinkedList) = - list.Counter = 0 +proc initLinkedList*(list: var TLinkedList) = + list.counter = 0 list.head = nil list.tail = nil -proc Append*(list: var TLinkedList, entry: PListEntry) = - Inc(list.counter) +proc append*(list: var TLinkedList, entry: PListEntry) = + inc(list.counter) entry.next = nil entry.prev = list.tail if list.tail != nil: @@ -39,7 +39,7 @@ proc Append*(list: var TLinkedList, entry: PListEntry) = list.tail = entry if list.head == nil: list.head = entry -proc Contains*(list: TLinkedList, data: string): bool = +proc contains*(list: TLinkedList, data: string): bool = var it = list.head while it != nil: if PStrEntry(it).data == data: @@ -50,15 +50,15 @@ proc newStrEntry(data: string): PStrEntry = new(result) result.data = data -proc AppendStr*(list: var TLinkedList, data: string) = +proc appendStr*(list: var TLinkedList, data: string) = append(list, newStrEntry(data)) -proc IncludeStr*(list: var TLinkedList, data: string): bool = - if Contains(list, data): return true - AppendStr(list, data) # else: add to list +proc includeStr*(list: var TLinkedList, data: string): bool = + if contains(list, data): return true + appendStr(list, data) # else: add to list -proc Prepend*(list: var TLinkedList, entry: PListEntry) = - Inc(list.counter) +proc prepend*(list: var TLinkedList, entry: PListEntry) = + inc(list.counter) entry.prev = nil entry.next = list.head if list.head != nil: @@ -67,22 +67,22 @@ proc Prepend*(list: var TLinkedList, entry: PListEntry) = list.head = entry if list.tail == nil: list.tail = entry -proc PrependStr*(list: var TLinkedList, data: string) = +proc prependStr*(list: var TLinkedList, data: string) = prepend(list, newStrEntry(data)) -proc InsertBefore*(list: var TLinkedList, pos, entry: PListEntry) = +proc insertBefore*(list: var TLinkedList, pos, entry: PListEntry) = assert(pos != nil) if pos == list.head: prepend(list, entry) else: - Inc(list.counter) + inc(list.counter) entry.next = pos entry.prev = pos.prev if pos.prev != nil: pos.prev.next = entry pos.prev = entry -proc Remove*(list: var TLinkedList, entry: PListEntry) = - Dec(list.counter) +proc remove*(list: var TLinkedList, entry: PListEntry) = + dec(list.counter) if entry == list.tail: list.tail = entry.prev if entry == list.head: @@ -91,22 +91,26 @@ proc Remove*(list: var TLinkedList, entry: PListEntry) = if entry.prev != nil: entry.prev.next = entry.next proc bringToFront*(list: var TLinkedList, entry: PListEntry) = - if entry == list.head: return - if entry == list.tail: list.tail = entry.prev - if entry.next != nil: entry.next.prev = entry.prev - if entry.prev != nil: entry.prev.next = entry.next - entry.prev = nil - entry.next = list.head - list.head = entry + when true: + list.remove entry + list.prepend entry + else: + if entry == list.head: return + if entry == list.tail: list.tail = entry.prev + if entry.next != nil: entry.next.prev = entry.prev + if entry.prev != nil: entry.prev.next = entry.next + entry.prev = nil + entry.next = list.head + list.head = entry -proc ExcludeStr*(list: var TLinkedList, data: string) = +proc excludeStr*(list: var TLinkedList, data: string) = var it = list.head while it != nil: let nxt = it.next if PStrEntry(it).data == data: remove(list, it) it = nxt -proc Find*(list: TLinkedList, fn: TCompareProc, closure: Pointer): PListEntry = +proc find*(list: TLinkedList, fn: TCompareProc, closure: pointer): PListEntry = result = list.head while result != nil: if fn(result, closure): return diff --git a/compiler/llstream.nim b/compiler/llstream.nim index 8ccf24b99..510880ffd 100644 --- a/compiler/llstream.nim +++ b/compiler/llstream.nim @@ -23,63 +23,63 @@ type llsStdIn # stream encapsulates stdin TLLStream* = object of TObject kind*: TLLStreamKind # accessible for low-level access (lexbase uses this) - f*: tfile + f*: TFile s*: string rd*, wr*: int # for string streams lineOffset*: int # for fake stdin line numbers PLLStream* = ref TLLStream -proc LLStreamOpen*(data: string): PLLStream -proc LLStreamOpen*(f: var tfile): PLLStream -proc LLStreamOpen*(filename: string, mode: TFileMode): PLLStream -proc LLStreamOpen*(): PLLStream -proc LLStreamOpenStdIn*(): PLLStream -proc LLStreamClose*(s: PLLStream) -proc LLStreamRead*(s: PLLStream, buf: pointer, bufLen: int): int -proc LLStreamReadLine*(s: PLLStream, line: var string): bool -proc LLStreamReadAll*(s: PLLStream): string -proc LLStreamWrite*(s: PLLStream, data: string) -proc LLStreamWrite*(s: PLLStream, data: Char) -proc LLStreamWrite*(s: PLLStream, buf: pointer, buflen: int) -proc LLStreamWriteln*(s: PLLStream, data: string) +proc llStreamOpen*(data: string): PLLStream +proc llStreamOpen*(f: var TFile): PLLStream +proc llStreamOpen*(filename: string, mode: TFileMode): PLLStream +proc llStreamOpen*(): PLLStream +proc llStreamOpenStdIn*(): PLLStream +proc llStreamClose*(s: PLLStream) +proc llStreamRead*(s: PLLStream, buf: pointer, bufLen: int): int +proc llStreamReadLine*(s: PLLStream, line: var string): bool +proc llStreamReadAll*(s: PLLStream): string +proc llStreamWrite*(s: PLLStream, data: string) +proc llStreamWrite*(s: PLLStream, data: char) +proc llStreamWrite*(s: PLLStream, buf: pointer, buflen: int) +proc llStreamWriteln*(s: PLLStream, data: string) # implementation -proc LLStreamOpen(data: string): PLLStream = +proc llStreamOpen(data: string): PLLStream = new(result) result.s = data result.kind = llsString -proc LLStreamOpen(f: var tfile): PLLStream = +proc llStreamOpen(f: var TFile): PLLStream = new(result) result.f = f result.kind = llsFile -proc LLStreamOpen(filename: string, mode: TFileMode): PLLStream = +proc llStreamOpen(filename: string, mode: TFileMode): PLLStream = new(result) result.kind = llsFile if not open(result.f, filename, mode): result = nil -proc LLStreamOpen(): PLLStream = +proc llStreamOpen(): PLLStream = new(result) result.kind = llsNone -proc LLStreamOpenStdIn(): PLLStream = +proc llStreamOpenStdIn(): PLLStream = new(result) result.kind = llsStdIn result.s = "" result.lineOffset = -1 -proc LLStreamClose(s: PLLStream) = +proc llStreamClose(s: PLLStream) = case s.kind of llsNone, llsString, llsStdIn: - nil + discard of llsFile: close(s.f) -when not defined(ReadLineFromStdin): +when not defined(readLineFromStdin): # fallback implementation: - proc ReadLineFromStdin(prompt: string, line: var string): bool = + proc readLineFromStdin(prompt: string, line: var string): bool = stdout.write(prompt) result = readLine(stdin, line) @@ -99,7 +99,7 @@ proc endsWithOpr*(x: string): bool = result = x.endsWith(LineContinuationOprs) proc continueLine(line: string, inTripleString: bool): bool {.inline.} = - result = inTriplestring or + result = inTripleString or line[0] == ' ' or line.endsWith(LineContinuationOprs+AdditionalLineContinuationOprs) @@ -111,12 +111,12 @@ proc countTriples(s: string): int = inc i, 2 inc i -proc LLreadFromStdin(s: PLLStream, buf: pointer, bufLen: int): int = +proc llReadFromStdin(s: PLLStream, buf: pointer, bufLen: int): int = s.s = "" s.rd = 0 var line = newStringOfCap(120) var triples = 0 - while ReadLineFromStdin(if s.s.len == 0: ">>> " else: "... ", line): + while readLineFromStdin(if s.s.len == 0: ">>> " else: "... ", line): add(s.s, line) add(s.s, "\n") inc triples, countTriples(line) @@ -127,7 +127,7 @@ proc LLreadFromStdin(s: PLLStream, buf: pointer, bufLen: int): int = copyMem(buf, addr(s.s[s.rd]), result) inc(s.rd, result) -proc LLStreamRead(s: PLLStream, buf: pointer, bufLen: int): int = +proc llStreamRead(s: PLLStream, buf: pointer, bufLen: int): int = case s.kind of llsNone: result = 0 @@ -139,9 +139,9 @@ proc LLStreamRead(s: PLLStream, buf: pointer, bufLen: int): int = of llsFile: result = readBuffer(s.f, buf, bufLen) of llsStdIn: - result = LLreadFromStdin(s, buf, bufLen) + result = llReadFromStdin(s, buf, bufLen) -proc LLStreamReadLine(s: PLLStream, line: var string): bool = +proc llStreamReadLine(s: PLLStream, line: var string): bool = setLen(line, 0) case s.kind of llsNone: @@ -165,25 +165,25 @@ proc LLStreamReadLine(s: PLLStream, line: var string): bool = of llsStdIn: result = readLine(stdin, line) -proc LLStreamWrite(s: PLLStream, data: string) = +proc llStreamWrite(s: PLLStream, data: string) = case s.kind of llsNone, llsStdIn: - nil + discard of llsString: add(s.s, data) inc(s.wr, len(data)) of llsFile: write(s.f, data) -proc LLStreamWriteln(s: PLLStream, data: string) = - LLStreamWrite(s, data) - LLStreamWrite(s, "\n") +proc llStreamWriteln(s: PLLStream, data: string) = + llStreamWrite(s, data) + llStreamWrite(s, "\n") -proc LLStreamWrite(s: PLLStream, data: Char) = +proc llStreamWrite(s: PLLStream, data: char) = var c: char case s.kind of llsNone, llsStdIn: - nil + discard of llsString: add(s.s, data) inc(s.wr) @@ -191,22 +191,21 @@ proc LLStreamWrite(s: PLLStream, data: Char) = c = data discard writeBuffer(s.f, addr(c), sizeof(c)) -proc LLStreamWrite(s: PLLStream, buf: pointer, buflen: int) = +proc llStreamWrite(s: PLLStream, buf: pointer, buflen: int) = case s.kind of llsNone, llsStdIn: - nil + discard of llsString: - if bufLen > 0: - setlen(s.s, len(s.s) + bufLen) - copyMem(addr(s.s[0 + s.wr]), buf, bufLen) - inc(s.wr, bufLen) + if buflen > 0: + setLen(s.s, len(s.s) + buflen) + copyMem(addr(s.s[0 + s.wr]), buf, buflen) + inc(s.wr, buflen) of llsFile: - discard writeBuffer(s.f, buf, bufLen) + discard writeBuffer(s.f, buf, buflen) -proc LLStreamReadAll(s: PLLStream): string = +proc llStreamReadAll(s: PLLStream): string = const bufSize = 2048 - var bytes, i: int case s.kind of llsNone, llsStdIn: result = "" @@ -216,10 +215,10 @@ proc LLStreamReadAll(s: PLLStream): string = s.rd = len(s.s) of llsFile: result = newString(bufSize) - bytes = readBuffer(s.f, addr(result[0]), bufSize) - i = bytes + var bytes = readBuffer(s.f, addr(result[0]), bufSize) + var i = bytes while bytes == bufSize: - setlen(result, i + bufSize) + setLen(result, i + bufSize) bytes = readBuffer(s.f, addr(result[i + 0]), bufSize) inc(i, bytes) - setlen(result, i) + setLen(result, i) diff --git a/compiler/lookups.nim b/compiler/lookups.nim index e1ec9e14b..c31eb3121 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -21,7 +21,7 @@ proc considerAcc*(n: PNode): PIdent = of nkSym: result = n.sym.name of nkAccQuoted: case n.len - of 0: GlobalError(n.info, errIdentifierExpected, renderTree(n)) + of 0: globalError(n.info, errIdentifierExpected, renderTree(n)) of 1: result = considerAcc(n.sons[0]) else: var id = "" @@ -30,16 +30,16 @@ proc considerAcc*(n: PNode): PIdent = case x.kind of nkIdent: id.add(x.ident.s) of nkSym: id.add(x.sym.name.s) - else: GlobalError(n.info, errIdentifierExpected, renderTree(n)) + else: globalError(n.info, errIdentifierExpected, renderTree(n)) result = getIdent(id) else: - GlobalError(n.info, errIdentifierExpected, renderTree(n)) + globalError(n.info, errIdentifierExpected, renderTree(n)) template addSym*(scope: PScope, s: PSym) = - StrTableAdd(scope.symbols, s) + strTableAdd(scope.symbols, s) proc addUniqueSym*(scope: PScope, s: PSym): TResult = - if StrTableIncl(scope.symbols, s): + if strTableIncl(scope.symbols, s): result = Failure else: result = Success @@ -64,17 +64,17 @@ iterator walkScopes*(scope: PScope): PScope = current = current.parent proc localSearchInScope*(c: PContext, s: PIdent): PSym = - result = StrTableGet(c.currentScope.symbols, s) + result = strTableGet(c.currentScope.symbols, s) proc searchInScopes*(c: PContext, s: PIdent): PSym = for scope in walkScopes(c.currentScope): - result = StrTableGet(scope.symbols, s) + result = strTableGet(scope.symbols, s) if result != nil: return result = nil proc searchInScopes*(c: PContext, s: PIdent, filter: TSymKinds): PSym = for scope in walkScopes(c.currentScope): - result = StrTableGet(scope.symbols, s) + result = strTableGet(scope.symbols, s) if result != nil and result.kind in filter: return result = nil @@ -114,65 +114,65 @@ proc getSymRepr*(s: PSym): string = proc ensureNoMissingOrUnusedSymbols(scope: PScope) = # check if all symbols have been used and defined: var it: TTabIter - var s = InitTabIter(it, scope.symbols) + var s = initTabIter(it, scope.symbols) var missingImpls = 0 while s != nil: if sfForward in s.flags: # too many 'implementation of X' errors are annoying # and slow 'suggest' down: if missingImpls == 0: - LocalError(s.info, errImplOfXexpected, getSymRepr(s)) + localError(s.info, errImplOfXexpected, getSymRepr(s)) inc missingImpls elif {sfUsed, sfExported} * s.flags == {} and optHints in s.options: # BUGFIX: check options in s! if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam}: - Message(s.info, hintXDeclaredButNotUsed, getSymRepr(s)) - s = NextIter(it, scope.symbols) + message(s.info, hintXDeclaredButNotUsed, getSymRepr(s)) + s = nextIter(it, scope.symbols) -proc WrongRedefinition*(info: TLineInfo, s: string) = +proc wrongRedefinition*(info: TLineInfo, s: string) = if gCmd != cmdInteractive: localError(info, errAttemptToRedefine, s) proc addDecl*(c: PContext, sym: PSym) = if c.currentScope.addUniqueSym(sym) == Failure: - WrongRedefinition(sym.info, sym.Name.s) + wrongRedefinition(sym.info, sym.name.s) proc addPrelimDecl*(c: PContext, sym: PSym) = discard c.currentScope.addUniqueSym(sym) proc addDeclAt*(scope: PScope, sym: PSym) = if scope.addUniqueSym(sym) == Failure: - WrongRedefinition(sym.info, sym.Name.s) + wrongRedefinition(sym.info, sym.name.s) -proc AddInterfaceDeclAux(c: PContext, sym: PSym) = +proc addInterfaceDeclAux(c: PContext, sym: PSym) = if sfExported in sym.flags: # add to interface: - if c.module != nil: StrTableAdd(c.module.tab, sym) - else: InternalError(sym.info, "AddInterfaceDeclAux") + if c.module != nil: strTableAdd(c.module.tab, sym) + else: internalError(sym.info, "AddInterfaceDeclAux") proc addInterfaceDeclAt*(c: PContext, scope: PScope, sym: PSym) = addDeclAt(scope, sym) - AddInterfaceDeclAux(c, sym) + addInterfaceDeclAux(c, sym) proc addOverloadableSymAt*(scope: PScope, fn: PSym) = if fn.kind notin OverloadableSyms: - InternalError(fn.info, "addOverloadableSymAt") + internalError(fn.info, "addOverloadableSymAt") return - var check = StrTableGet(scope.symbols, fn.name) - if check != nil and check.Kind notin OverloadableSyms: - WrongRedefinition(fn.info, fn.Name.s) + var check = strTableGet(scope.symbols, fn.name) + if check != nil and check.kind notin OverloadableSyms: + wrongRedefinition(fn.info, fn.name.s) else: scope.addSym(fn) proc addInterfaceDecl*(c: PContext, sym: PSym) = # it adds the symbol to the interface if appropriate addDecl(c, sym) - AddInterfaceDeclAux(c, sym) + addInterfaceDeclAux(c, sym) proc addInterfaceOverloadableSymAt*(c: PContext, scope: PScope, sym: PSym) = # it adds the symbol to the interface if appropriate addOverloadableSymAt(scope, sym) - AddInterfaceDeclAux(c, sym) + addInterfaceDeclAux(c, sym) proc lookUp*(c: PContext, n: PNode): PSym = # Looks up a symbol. Generates an error in case of nil. @@ -180,7 +180,7 @@ proc lookUp*(c: PContext, n: PNode): PSym = of nkIdent: result = searchInScopes(c, n.ident) if result == nil: - LocalError(n.info, errUndeclaredIdentifier, n.ident.s) + localError(n.info, errUndeclaredIdentifier, n.ident.s) result = errorSym(c, n) of nkSym: result = n.sym @@ -188,34 +188,34 @@ proc lookUp*(c: PContext, n: PNode): PSym = var ident = considerAcc(n) result = searchInScopes(c, ident) if result == nil: - LocalError(n.info, errUndeclaredIdentifier, ident.s) + localError(n.info, errUndeclaredIdentifier, ident.s) result = errorSym(c, n) else: - InternalError(n.info, "lookUp") + internalError(n.info, "lookUp") return - if Contains(c.AmbiguousSymbols, result.id): - LocalError(n.info, errUseQualifier, result.name.s) + if contains(c.ambiguousSymbols, result.id): + localError(n.info, errUseQualifier, result.name.s) if result.kind == skStub: loadStub(result) type TLookupFlag* = enum checkAmbiguity, checkUndeclared -proc QualifiedLookUp*(c: PContext, n: PNode, flags = {checkUndeclared}): PSym = +proc qualifiedLookUp*(c: PContext, n: PNode, flags = {checkUndeclared}): PSym = case n.kind of nkIdent, nkAccQuoted: var ident = considerAcc(n) result = searchInScopes(c, ident) if result == nil and checkUndeclared in flags: - LocalError(n.info, errUndeclaredIdentifier, ident.s) + localError(n.info, errUndeclaredIdentifier, ident.s) result = errorSym(c, n) elif checkAmbiguity in flags and result != nil and - Contains(c.AmbiguousSymbols, result.id): - LocalError(n.info, errUseQualifier, ident.s) + contains(c.ambiguousSymbols, result.id): + localError(n.info, errUseQualifier, ident.s) of nkSym: result = n.sym - if checkAmbiguity in flags and Contains(c.AmbiguousSymbols, result.id): - LocalError(n.info, errUseQualifier, n.sym.name.s) + if checkAmbiguity in flags and contains(c.ambiguousSymbols, result.id): + localError(n.info, errUseQualifier, n.sym.name.s) of nkDotExpr: result = nil var m = qualifiedLookUp(c, n.sons[0], flags*{checkUndeclared}) @@ -227,28 +227,31 @@ proc QualifiedLookUp*(c: PContext, n: PNode, flags = {checkUndeclared}): PSym = ident = considerAcc(n.sons[1]) if ident != nil: if m == c.module: - result = StrTableGet(c.topLevelScope.symbols, ident) + result = strTableGet(c.topLevelScope.symbols, ident) else: - result = StrTableGet(m.tab, ident) + result = strTableGet(m.tab, ident) if result == nil and checkUndeclared in flags: - LocalError(n.sons[1].info, errUndeclaredIdentifier, ident.s) + localError(n.sons[1].info, errUndeclaredIdentifier, ident.s) result = errorSym(c, n.sons[1]) - elif checkUndeclared in flags: - LocalError(n.sons[1].info, errIdentifierExpected, + elif n.sons[1].kind == nkSym: + result = n.sons[1].sym + elif checkUndeclared in flags and + n.sons[1].kind notin {nkOpenSymChoice, nkClosedSymChoice}: + localError(n.sons[1].info, errIdentifierExpected, renderTree(n.sons[1])) result = errorSym(c, n.sons[1]) else: result = nil if result != nil and result.kind == skStub: loadStub(result) -proc InitOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym = +proc initOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym = case n.kind of nkIdent, nkAccQuoted: var ident = considerAcc(n) o.scope = c.currentScope o.mode = oimNoQualifier while true: - result = InitIdentIter(o.it, o.scope.symbols, ident) + result = initIdentIter(o.it, o.scope.symbols, ident) if result != nil: break else: @@ -269,12 +272,12 @@ proc InitOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym = if ident != nil: if o.m == c.module: # a module may access its private members: - result = InitIdentIter(o.it, c.topLevelScope.symbols, ident) + result = initIdentIter(o.it, c.topLevelScope.symbols, ident) o.mode = oimSelfModule else: - result = InitIdentIter(o.it, o.m.tab, ident) + result = initIdentIter(o.it, o.m.tab, ident) else: - LocalError(n.sons[1].info, errIdentifierExpected, + localError(n.sons[1].info, errIdentifierExpected, renderTree(n.sons[1])) result = errorSym(c, n.sons[1]) of nkClosedSymChoice, nkOpenSymChoice: @@ -282,8 +285,8 @@ proc InitOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym = result = n.sons[0].sym o.symChoiceIndex = 1 o.inSymChoice = initIntSet() - Incl(o.inSymChoice, result.id) - else: nil + incl(o.inSymChoice, result.id) + else: discard if result != nil and result.kind == skStub: loadStub(result) proc lastOverloadScope*(o: TOverloadIter): int = @@ -303,7 +306,7 @@ proc nextOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym = while result == nil: o.scope = o.scope.parent if o.scope == nil: break - result = InitIdentIter(o.it, o.scope.symbols, o.it.name) + result = initIdentIter(o.it, o.scope.symbols, o.it.name) # BUGFIX: o.it.name <-> n.ident else: result = nil @@ -314,26 +317,38 @@ proc nextOverloadIter*(o: var TOverloadIter, c: PContext, n: PNode): PSym = of oimSymChoice: if o.symChoiceIndex < sonsLen(n): result = n.sons[o.symChoiceIndex].sym - Incl(o.inSymChoice, result.id) + incl(o.inSymChoice, result.id) inc o.symChoiceIndex elif n.kind == nkOpenSymChoice: # try 'local' symbols too for Koenig's lookup: o.mode = oimSymChoiceLocalLookup o.scope = c.currentScope - result = FirstIdentExcluding(o.it, o.scope.symbols, + result = firstIdentExcluding(o.it, o.scope.symbols, n.sons[0].sym.name, o.inSymChoice) while result == nil: o.scope = o.scope.parent if o.scope == nil: break - result = FirstIdentExcluding(o.it, o.scope.symbols, + result = firstIdentExcluding(o.it, o.scope.symbols, n.sons[0].sym.name, o.inSymChoice) of oimSymChoiceLocalLookup: result = nextIdentExcluding(o.it, o.scope.symbols, o.inSymChoice) while result == nil: o.scope = o.scope.parent if o.scope == nil: break - result = FirstIdentExcluding(o.it, o.scope.symbols, + result = firstIdentExcluding(o.it, o.scope.symbols, n.sons[0].sym.name, o.inSymChoice) if result != nil and result.kind == skStub: loadStub(result) - + +when false: + proc qualifiedLookUpPreferImmediate*(c: PContext, n: PNode, + flags = {checkUndeclared}): PSym = + var o: TOverloadIter + result = initOverloadIter(o, c, n) + var a = result + while a != nil: + if sfImmediate in a.flags: return a + a = nextOverloadIter(o, c, n) + if result == nil and checkUndeclared in flags: + localError(n.info, errUndeclaredIdentifier, n.considerAcc.s) + result = errorSym(c, n) diff --git a/compiler/magicsys.nim b/compiler/magicsys.nim index 0c0b87222..b4f6e043d 100644 --- a/compiler/magicsys.nim +++ b/compiler/magicsys.nim @@ -12,14 +12,14 @@ import ast, astalgo, hashes, msgs, platform, nversion, times, idents, rodread -var SystemModule*: PSym +var systemModule*: PSym proc registerSysType*(t: PType) # magic symbols in the system module: proc getSysType*(kind: TTypeKind): PType proc getCompilerProc*(name: string): PSym proc registerCompilerProc*(s: PSym) -proc FinishSystem*(tab: TStrTable) +proc finishSystem*(tab: TStrTable) proc getSysSym*(name: string): PSym # implementation @@ -36,7 +36,7 @@ proc newSysType(kind: TTypeKind, size: int): PType = result.align = size proc getSysSym(name: string): PSym = - result = StrTableGet(systemModule.tab, getIdent(name)) + result = strTableGet(systemModule.tab, getIdent(name)) if result == nil: rawMessage(errSystemNeeds, name) result = newSym(skError, getIdent(name), systemModule, systemModule.info) @@ -46,11 +46,11 @@ proc getSysSym(name: string): PSym = proc getSysMagic*(name: string, m: TMagic): PSym = var ti: TIdentIter let id = getIdent(name) - result = InitIdentIter(ti, systemModule.tab, id) + result = initIdentIter(ti, systemModule.tab, id) while result != nil: if result.kind == skStub: loadStub(result) if result.magic == m: return result - result = NextIdentIter(ti, systemModule.tab) + result = nextIdentIter(ti, systemModule.tab) rawMessage(errSystemNeeds, name) result = newSym(skError, id, systemModule, systemModule.info) result.typ = newType(tyError, systemModule) @@ -79,14 +79,14 @@ proc getSysType(kind: TTypeKind): PType = of tyBool: result = sysTypeFromName("bool") of tyChar: result = sysTypeFromName("char") of tyString: result = sysTypeFromName("string") - of tyCstring: result = sysTypeFromName("cstring") + of tyCString: result = sysTypeFromName("cstring") of tyPointer: result = sysTypeFromName("pointer") of tyNil: result = newSysType(tyNil, ptrSize) - else: InternalError("request for typekind: " & $kind) + else: internalError("request for typekind: " & $kind) gSysTypes[kind] = result if result.kind != kind: - InternalError("wanted: " & $kind & " got: " & $result.kind) - if result == nil: InternalError("type not found: " & $kind) + internalError("wanted: " & $kind & " got: " & $result.kind) + if result == nil: internalError("type not found: " & $kind) var intTypeCache: array[-5..64, PType] @@ -126,7 +126,7 @@ proc skipIntLit*(t: PType): PType {.inline.} = return getSysType(t.kind) result = t -proc AddSonSkipIntLit*(father, son: PType) = +proc addSonSkipIntLit*(father, son: PType) = if isNil(father.sons): father.sons = @[] let s = son.skipIntLit add(father.sons, s) @@ -134,7 +134,7 @@ proc AddSonSkipIntLit*(father, son: PType) = proc setIntLitType*(result: PNode) = let i = result.intVal - case platform.IntSize + case platform.intSize of 8: result.typ = getIntLitType(result) of 4: if i >= low(int32) and i <= high(int32): @@ -158,13 +158,13 @@ proc setIntLitType*(result: PNode) = result.typ = getSysType(tyInt32) else: result.typ = getSysType(tyInt64) - else: InternalError(result.info, "invalid int size") + else: internalError(result.info, "invalid int size") proc getCompilerProc(name: string): PSym = var ident = getIdent(name, hashIgnoreStyle(name)) - result = StrTableGet(compilerprocs, ident) + result = strTableGet(compilerprocs, ident) if result == nil: - result = StrTableGet(rodCompilerProcs, ident) + result = strTableGet(rodCompilerprocs, ident) if result != nil: strTableAdd(compilerprocs, result) if result.kind == skStub: loadStub(result) @@ -172,7 +172,6 @@ proc getCompilerProc(name: string): PSym = proc registerCompilerProc(s: PSym) = strTableAdd(compilerprocs, s) -proc FinishSystem(tab: TStrTable) = nil - -initStrTable(compilerprocs) +proc finishSystem(tab: TStrTable) = discard +initStrTable(compilerprocs) diff --git a/compiler/main.nim b/compiler/main.nim index 7cfc6d406..f6d11d960 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -9,21 +9,21 @@ # implements the command dispatcher and several commands -import - llstream, strutils, ast, astalgo, lexer, syntaxes, renderer, options, msgs, +import + llstream, strutils, ast, astalgo, lexer, syntaxes, renderer, options, msgs, os, condsyms, rodread, rodwrite, times, wordrecg, sem, semdata, idents, passes, docgen, extccomp, cgen, jsgen, json, nversion, - platform, nimconf, importer, passaux, depends, evals, types, idgen, + platform, nimconf, importer, passaux, depends, vm, vmdef, types, idgen, tables, docgen2, service, parser, modules, ccgutils, sigmatch, ropes, lists, pretty -from magicsys import SystemModule, resetSysTypes +from magicsys import systemModule, resetSysTypes const - has_LLVM_Backend = false + hasLLVM_Backend = false -when has_LLVM_Backend: +when hasLLVM_Backend: import llvmgen proc rodPass = @@ -37,22 +37,22 @@ proc semanticPasses = registerPass verbosePass registerPass semPass -proc CommandGenDepend = +proc commandGenDepend = semanticPasses() - registerPass(genDependPass) + registerPass(gendependPass) registerPass(cleanupPass) compileProject() generateDot(gProjectFull) execExternalProgram("dot -Tpng -o" & changeFileExt(gProjectFull, "png") & ' ' & changeFileExt(gProjectFull, "dot")) -proc CommandCheck = +proc commandCheck = msgs.gErrorMax = high(int) # do not stop after first error semanticPasses() # use an empty backend for semantic checking only rodPass() compileProject() -proc CommandDoc2 = +proc commandDoc2 = msgs.gErrorMax = high(int) # do not stop after first error semanticPasses() registerPass(docgen2Pass) @@ -60,7 +60,7 @@ proc CommandDoc2 = compileProject() finishDoc2Pass(gProjectName) -proc CommandCompileToC = +proc commandCompileToC = semanticPasses() registerPass(cgenPass) rodPass() @@ -73,7 +73,7 @@ proc CommandCompileToC = compileProject() cgenWriteModules() if gCmd != cmdRun: - extccomp.CallCCompiler(changeFileExt(gProjectFull, "")) + extccomp.callCCompiler(changeFileExt(gProjectFull, "")) if isServing: # caas will keep track only of the compilation commands @@ -98,7 +98,7 @@ proc CommandCompileToC = # rodread.rodcompilerProcs # rodread.gTypeTable # rodread.gMods - + # !! ropes.cache # semthreads.computed? # @@ -111,45 +111,45 @@ proc CommandCompileToC = ccgutils.resetCaches() GC_fullCollect() -when has_LLVM_Backend: - proc CommandCompileToLLVM = +when hasLLVM_Backend: + proc commandCompileToLLVM = semanticPasses() registerPass(llvmgen.llvmgenPass()) rodPass() #registerPass(cleanupPass()) compileProject() -proc CommandCompileToJS = +proc commandCompileToJS = #incl(gGlobalOptions, optSafeCode) setTarget(osJS, cpuJS) #initDefines() - DefineSymbol("nimrod") # 'nimrod' is always defined - DefineSymbol("ecmascript") # For backward compatibility - DefineSymbol("js") + defineSymbol("nimrod") # 'nimrod' is always defined + defineSymbol("ecmascript") # For backward compatibility + defineSymbol("js") semanticPasses() - registerPass(jsgenPass) + registerPass(JSgenPass) compileProject() -proc InteractivePasses = +proc interactivePasses = #incl(gGlobalOptions, optSafeCode) #setTarget(osNimrodVM, cpuNimrodVM) initDefines() - DefineSymbol("nimrodvm") - when hasFFI: DefineSymbol("nimffi") + defineSymbol("nimrodvm") + when hasFFI: defineSymbol("nimffi") registerPass(verbosePass) registerPass(semPass) registerPass(evalPass) -proc CommandInteractive = +proc commandInteractive = msgs.gErrorMax = high(int) # do not stop after first error - InteractivePasses() + interactivePasses() compileSystemModule() if commandArgs.len > 0: - discard CompileModule(fileInfoIdx(gProjectFull), {}) + discard compileModule(fileInfoIdx(gProjectFull), {}) else: var m = makeStdinModule() incl(m.flags, sfMainModule) - processModule(m, LLStreamOpenStdIn(), nil) + processModule(m, llStreamOpenStdIn(), nil) const evalPasses = [verbosePass, semPass, evalPass] @@ -157,50 +157,50 @@ proc evalNim(nodes: PNode, module: PSym) = carryPasses(nodes, module, evalPasses) proc commandEval(exp: string) = - if SystemModule == nil: - InteractivePasses() + if systemModule == nil: + interactivePasses() compileSystemModule() var echoExp = "echo \"eval\\t\", " & "repr(" & exp & ")" evalNim(echoExp.parseString, makeStdinModule()) -proc CommandPrettyOld = +proc commandPrettyOld = var projectFile = addFileExt(mainCommandArg(), NimExt) var module = parseFile(projectFile.fileInfoIdx) - if module != nil: + if module != nil: renderModule(module, getOutFile(mainCommandArg(), "pretty." & NimExt)) -proc CommandPretty = +proc commandPretty = msgs.gErrorMax = high(int) # do not stop after first error semanticPasses() registerPass(prettyPass) compileProject() pretty.overwriteFiles() - -proc CommandScan = - var f = addFileExt(mainCommandArg(), nimExt) - var stream = LLStreamOpen(f, fmRead) - if stream != nil: - var + +proc commandScan = + var f = addFileExt(mainCommandArg(), NimExt) + var stream = llStreamOpen(f, fmRead) + if stream != nil: + var L: TLexer tok: TToken initToken(tok) openLexer(L, f, stream) - while true: + while true: rawGetTok(L, tok) - PrintTok(tok) - if tok.tokType == tkEof: break - CloseLexer(L) - else: + printTok(tok) + if tok.tokType == tkEof: break + closeLexer(L) + else: rawMessage(errCannotOpenFile, f) - -proc CommandSuggest = + +proc commandSuggest = if isServing: # XXX: hacky work-around ahead # Currently, it's possible to issue a idetools command, before # issuing the first compile command. This will leave the compiler # cache in a state where "no recompilation is necessary", but the # cgen pass was never executed at all. - CommandCompileToC() + commandCompileToC() if gDirtyBufferIdx != 0: discard compileModule(gDirtyBufferIdx, {sfDirty}) resetModule(gDirtyBufferIdx) @@ -219,21 +219,21 @@ proc CommandSuggest = proc wantMainModule = if gProjectFull.len == 0: if optMainModule.len == 0: - Fatal(gCmdLineInfo, errCommandExpectsFilename) + fatal(gCmdLineInfo, errCommandExpectsFilename) else: gProjectName = optMainModule gProjectFull = gProjectPath / gProjectName - gProjectMainIdx = addFileExt(gProjectFull, nimExt).fileInfoIdx + gProjectMainIdx = addFileExt(gProjectFull, NimExt).fileInfoIdx proc requireMainModuleOption = if optMainModule.len == 0: - Fatal(gCmdLineInfo, errMainModuleMustBeSpecified) + fatal(gCmdLineInfo, errMainModuleMustBeSpecified) else: gProjectName = optMainModule gProjectFull = gProjectPath / gProjectName - gProjectMainIdx = addFileExt(gProjectFull, nimExt).fileInfoIdx + gProjectMainIdx = addFileExt(gProjectFull, NimExt).fileInfoIdx proc resetMemory = resetCompilationLists() @@ -246,7 +246,7 @@ proc resetMemory = for i in low(buckets)..high(buckets): buckets[i] = nil idAnon = nil - + # XXX: clean these global vars # ccgstmts.gBreakpoints # ccgthreadvars.nimtv @@ -262,7 +262,7 @@ proc resetMemory = # rodread.rodcompilerProcs # rodread.gTypeTable # rodread.gMods - + # !! ropes.cache # semthreads.computed? # @@ -286,10 +286,10 @@ const SimiluateCaasMemReset = false PrintRopeCacheStats = false -proc MainCommand* = +proc mainCommand* = when SimiluateCaasMemReset: gGlobalOptions.incl(optCaasEnabled) - + # In "nimrod serve" scenario, each command must reset the registered passes clearPasses() gLastCmdTime = epochTime() @@ -297,90 +297,96 @@ proc MainCommand* = if gProjectFull.len != 0: # current path is always looked first for modules prependStr(searchPaths, gProjectPath) - setID(100) + setId(100) passes.gIncludeFile = includeModule passes.gImportModule = importModule case command.normalize - of "c", "cc", "compile", "compiletoc": + of "c", "cc", "compile", "compiletoc": # compile means compileToC currently gCmd = cmdCompileToC wantMainModule() - CommandCompileToC() + commandCompileToC() of "cpp", "compiletocpp": extccomp.cExt = ".cpp" gCmd = cmdCompileToCpp if cCompiler == ccGcc: setCC("gpp") wantMainModule() - DefineSymbol("cpp") - CommandCompileToC() + defineSymbol("cpp") + commandCompileToC() of "objc", "compiletooc": extccomp.cExt = ".m" gCmd = cmdCompileToOC wantMainModule() - DefineSymbol("objc") - CommandCompileToC() + defineSymbol("objc") + commandCompileToC() of "run": gCmd = cmdRun wantMainModule() when hasTinyCBackend: extccomp.setCC("tcc") - CommandCompileToC() - else: + commandCompileToC() + else: rawMessage(errInvalidCommandX, command) - of "js", "compiletojs": + of "js", "compiletojs": gCmd = cmdCompileToJS wantMainModule() - CommandCompileToJS() - of "compiletollvm": + commandCompileToJS() + of "compiletollvm": gCmd = cmdCompileToLLVM wantMainModule() - when has_LLVM_Backend: + when hasLLVM_Backend: CommandCompileToLLVM() else: rawMessage(errInvalidCommandX, command) of "pretty": gCmd = cmdPretty wantMainModule() - CommandPretty() + commandPretty() of "doc": gCmd = cmdDoc - LoadConfigs(DocConfig) + loadConfigs(DocConfig) wantMainModule() - CommandDoc() + commandDoc() of "doc2": gCmd = cmdDoc - LoadConfigs(DocConfig) + loadConfigs(DocConfig) wantMainModule() - DefineSymbol("nimdoc") - CommandDoc2() - of "rst2html": + defineSymbol("nimdoc") + commandDoc2() + of "rst2html": gCmd = cmdRst2html - LoadConfigs(DocConfig) + loadConfigs(DocConfig) wantMainModule() - CommandRst2Html() - of "rst2tex": + commandRst2Html() + of "rst2tex": gCmd = cmdRst2tex - LoadConfigs(DocTexConfig) + loadConfigs(DocTexConfig) + wantMainModule() + commandRst2TeX() + of "jsondoc": + gCmd = cmdDoc + loadConfigs(DocConfig) wantMainModule() - CommandRst2TeX() + defineSymbol("nimdoc") + commandJSON() of "buildindex": gCmd = cmdDoc - LoadConfigs(DocConfig) - CommandBuildIndex() - of "gendepend": + loadConfigs(DocConfig) + commandBuildIndex() + of "gendepend": gCmd = cmdGenDepend wantMainModule() - CommandGenDepend() + commandGenDepend() of "dump": - gcmd = cmdDump - if getconfigvar("dump.format") == "json": + gCmd = cmdDump + if getConfigVar("dump.format") == "json": requireMainModuleOption() var definedSymbols = newJArray() for s in definedSymbolNames(): definedSymbols.elems.add(%s) var libpaths = newJArray() - for dir in itersearchpath(searchpaths): libpaths.elems.add(%dir) + for dir in iterSearchPath(searchPaths): libpaths.elems.add(%dir) var dumpdata = % [ (key: "version", val: %VersionAsString), @@ -389,29 +395,29 @@ proc MainCommand* = (key: "lib_paths", val: libpaths) ] - outWriteLn($dumpdata) + outWriteln($dumpdata) else: - outWriteLn("-- list of currently defined symbols --") - for s in definedSymbolNames(): outWriteLn(s) - outWriteLn("-- end of list --") + outWriteln("-- list of currently defined symbols --") + for s in definedSymbolNames(): outWriteln(s) + outWriteln("-- end of list --") - for it in iterSearchPath(searchpaths): msgWriteLn(it) + for it in iterSearchPath(searchPaths): msgWriteln(it) of "check": gCmd = cmdCheck wantMainModule() - CommandCheck() - of "parse": + commandCheck() + of "parse": gCmd = cmdParse wantMainModule() discard parseFile(gProjectMainIdx) - of "scan": + of "scan": gCmd = cmdScan wantMainModule() - CommandScan() - MsgWriteln("Beware: Indentation tokens depend on the parser\'s state!") - of "i": + commandScan() + msgWriteln("Beware: Indentation tokens depend on the parser\'s state!") + of "i": gCmd = cmdInteractive - CommandInteractive() + commandInteractive() of "e": # XXX: temporary command for easier testing commandEval(mainCommandArg()) @@ -423,16 +429,18 @@ proc MainCommand* = commandEval(gEvalExpr) else: wantMainModule() - CommandSuggest() + commandSuggest() of "serve": isServing = true gGlobalOptions.incl(optCaasEnabled) - msgs.gErrorMax = high(int) # do not stop after first error - serve(MainCommand) + msgs.gErrorMax = high(int) # do not stop after first error + serve(mainCommand) else: rawMessage(errInvalidCommandX, command) - - if msgs.gErrorCounter == 0 and gCmd notin {cmdInterpret, cmdRun, cmdDump}: + + if (msgs.gErrorCounter == 0 and + gCmd notin {cmdInterpret, cmdRun, cmdDump} and + gVerbosity > 0): rawMessage(hintSuccessX, [$gLinesCompiled, formatFloat(epochTime() - gLastCmdTime, ffDecimal, 3), formatSize(getTotalMem())]) @@ -442,7 +450,8 @@ proc MainCommand* = echo " tries : ", gCacheTries echo " misses: ", gCacheMisses echo " int tries: ", gCacheIntTries - echo " efficiency: ", formatFloat(1-(gCacheMisses.float/gCacheTries.float), ffDecimal, 3) + echo " efficiency: ", formatFloat(1-(gCacheMisses.float/gCacheTries.float), + ffDecimal, 3) when SimiluateCaasMemReset: resetMemory() diff --git a/compiler/modules.nim b/compiler/modules.nim index ef6af3d69..6a1491682 100644 --- a/compiler/modules.nim +++ b/compiler/modules.nim @@ -41,7 +41,7 @@ template crc(x: PSym): expr = gMemCacheData[x.position].crc proc crcChanged(fileIdx: int32): bool = - InternalAssert fileIdx >= 0 and fileIdx < gMemCacheData.len + internalAssert fileIdx >= 0 and fileIdx < gMemCacheData.len template updateStatus = gMemCacheData[fileIdx].crcStatus = if result: crcHasChanged @@ -68,7 +68,7 @@ proc doCRC(fileIdx: int32) = # echo "FIRST CRC: ", fileIdx.ToFilename gMemCacheData[fileIdx].crc = crcFromFile(fileIdx.toFilename) -proc addDep(x: Psym, dep: int32) = +proc addDep(x: PSym, dep: int32) = growCache gMemCacheData, dep gMemCacheData[x.position].deps.safeAdd(dep) @@ -130,7 +130,7 @@ proc newModule(fileIdx: int32): PSym = incl(result.flags, sfUsed) initStrTable(result.tab) - StrTableAdd(result.tab, result) # a module knows itself + strTableAdd(result.tab, result) # a module knows itself proc compileModule*(fileIdx: int32, flags: TSymFlags): PSym = result = getModule(fileIdx) @@ -144,7 +144,7 @@ proc compileModule*(fileIdx: int32, flags: TSymFlags): PSym = if gCmd in {cmdCompileToC, cmdCompileToCpp, cmdCheck, cmdIdeTools}: rd = handleSymbolFile(result) if result.id < 0: - InternalError("handleSymbolFile should have set the module\'s ID") + internalError("handleSymbolFile should have set the module\'s ID") return else: result.id = getID() @@ -155,7 +155,7 @@ proc compileModule*(fileIdx: int32, flags: TSymFlags): PSym = doCRC fileIdx else: if checkDepMem(fileIdx) == Yes: - result = CompileModule(fileIdx, flags) + result = compileModule(fileIdx, flags) else: result = gCompiledModules[fileIdx] @@ -164,14 +164,14 @@ proc importModule*(s: PSym, fileIdx: int32): PSym {.procvar.} = result = compileModule(fileIdx, {}) if optCaasEnabled in gGlobalOptions: addDep(s, fileIdx) if sfSystemModule in result.flags: - LocalError(result.info, errAttemptToRedefine, result.Name.s) + localError(result.info, errAttemptToRedefine, result.name.s) proc includeModule*(s: PSym, fileIdx: int32): PNode {.procvar.} = result = syntaxes.parseFile(fileIdx) if optCaasEnabled in gGlobalOptions: growCache gMemCacheData, fileIdx addDep(s, fileIdx) - doCrc(fileIdx) + doCRC(fileIdx) proc `==^`(a, b: string): bool = try: @@ -180,17 +180,17 @@ proc `==^`(a, b: string): bool = result = false proc compileSystemModule* = - if magicsys.SystemModule == nil: - SystemFileIdx = fileInfoIdx(options.libpath/"system.nim") - discard CompileModule(SystemFileIdx, {sfSystemModule}) + if magicsys.systemModule == nil: + systemFileIdx = fileInfoIdx(options.libpath/"system.nim") + discard compileModule(systemFileIdx, {sfSystemModule}) -proc CompileProject*(projectFile = gProjectMainIdx) = +proc compileProject*(projectFile = gProjectMainIdx) = let systemFileIdx = fileInfoIdx(options.libpath / "system.nim") - if projectFile == SystemFileIdx: - discard CompileModule(projectFile, {sfMainModule, sfSystemModule}) + if projectFile == systemFileIdx: + discard compileModule(projectFile, {sfMainModule, sfSystemModule}) else: compileSystemModule() - discard CompileModule(projectFile, {sfMainModule}) + discard compileModule(projectFile, {sfMainModule}) var stdinModule: PSym proc makeStdinModule*(): PSym = diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 5363442b4..61336aa87 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -93,6 +93,7 @@ type errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile, errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitely, errOnlyACallOpCanBeDelegator, errUsingNoSymbol, + errDestructorNotGenericEnough, errXExpectsTwoArguments, errXExpectsObjectTypes, errXcanNeverBeOfThisSubtype, errTooManyIterations, @@ -112,7 +113,7 @@ type warnDifferentHeaps, warnWriteToForeignHeap, warnImplicitClosure, warnEachIdentIsTuple, warnShadowIdent, warnProveInit, warnProveField, warnProveIndex, - warnUninit, warnUser, + warnUninit, warnGcMem, warnUser, hintSuccess, hintSuccessX, hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded, hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled, @@ -322,6 +323,8 @@ const errInstantiateXExplicitely: "instantiate '$1' explicitely", errOnlyACallOpCanBeDelegator: "only a call operator can be a delegator", errUsingNoSymbol: "'$1' is not a variable, constant or a proc name", + errDestructorNotGenericEnough: "Destructor signarue is too specific. " & + "A destructor must be associated will all instantiations of a generic type", errXExpectsTwoArguments: "\'$1\' expects two arguments", errXExpectsObjectTypes: "\'$1\' expects object types", errXcanNeverBeOfThisSubtype: "\'$1\' can never be of this subtype", @@ -367,6 +370,7 @@ const warnProveField: "cannot prove that field '$1' is accessible [ProveField]", warnProveIndex: "cannot prove index '$1' is valid [ProveIndex]", warnUninit: "'$1' might not have been initialized [Uninit]", + warnGcMem: "'$1' uses GC'ed memory [GcMem]", warnUser: "$1 [User]", hintSuccess: "operation successful [Success]", hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#) [SuccessX]", @@ -386,7 +390,7 @@ const hintUser: "$1 [User]"] const - WarningsToStr*: array[0..23, string] = ["CannotOpenFile", "OctalEscape", + WarningsToStr*: array[0..24, string] = ["CannotOpenFile", "OctalEscape", "XIsNeverRead", "XmightNotBeenInit", "Deprecated", "ConfigDeprecated", "SmallLshouldNotBeUsed", "UnknownMagic", @@ -394,7 +398,7 @@ const "CommentXIgnored", "NilStmt", "AnalysisLoophole", "DifferentHeaps", "WriteToForeignHeap", "ImplicitClosure", "EachIdentIsTuple", "ShadowIdent", - "ProveInit", "ProveField", "ProveIndex", "Uninit", "User"] + "ProveInit", "ProveField", "ProveIndex", "Uninit", "GcMem", "User"] HintsToStr*: array[0..15, string] = ["Success", "SuccessX", "LineTooLong", "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded", @@ -436,9 +440,16 @@ type # only 8 bytes. line*, col*: int16 fileIndex*: int32 - + + TErrorOutput* = enum + eStdOut + eStdErr + eInMemory + + TErrorOutputs* = set[TErrorOutput] + ERecoverableError* = object of EInvalidValue - ESuggestDone* = object of EBase + ESuggestDone* = object of E_Base const InvalidFileIDX* = int32(-1) @@ -446,9 +457,9 @@ const var filenameToIndexTbl = initTable[string, int32]() fileInfos*: seq[TFileInfo] = @[] - SystemFileIdx*: int32 + systemFileIdx*: int32 -proc toCChar*(c: Char): string = +proc toCChar*(c: char): string = case c of '\0'..'\x1F', '\x80'..'\xFF': result = '\\' & toOctal(c) of '\'', '\"', '\\': result = '\\' & c @@ -467,7 +478,7 @@ proc makeCString*(s: string): PRope = add(res, '\"') add(res, tnl) app(result, toRope(res)) # reset: - setlen(res, 1) + setLen(res, 1) res[0] = '\"' add(res, toCChar(s[i])) add(res, '\"') @@ -534,22 +545,39 @@ var gHintCounter*: int = 0 gWarnCounter*: int = 0 gErrorMax*: int = 1 # stop after gErrorMax errors - gSilence*: int # == 0 if we produce any output at all when useCaas: var stdoutSocket*: TSocket -proc SuggestWriteln*(s: string) = - if gSilence == 0: +proc unknownLineInfo*(): TLineInfo = + result.line = int16(-1) + result.col = int16(-1) + result.fileIndex = -1 + +var + msgContext: seq[TLineInfo] = @[] + lastError = unknownLineInfo() + bufferedMsgs*: seq[string] + + errorOutputs* = {eStdOut, eStdErr} + +proc clearBufferedMsgs* = + bufferedMsgs = nil + +proc suggestWriteln*(s: string) = + if eStdOut in errorOutputs: when useCaas: - if isNil(stdoutSocket): Writeln(stdout, s) + if isNil(stdoutSocket): writeln(stdout, s) else: - Writeln(stdout, s) + writeln(stdout, s) stdoutSocket.send(s & "\c\L") else: - Writeln(stdout, s) + writeln(stdout, s) + + if eInMemory in errorOutputs: + bufferedMsgs.safeAdd(s) -proc SuggestQuit*() = +proc suggestQuit*() = if not isServing: quit(0) elif isWorkingWithDirtyBuffer: @@ -570,14 +598,6 @@ const RawWarningFormat* = "Warning: $1" RawHintFormat* = "Hint: $1" -proc UnknownLineInfo*(): TLineInfo = - result.line = int16(-1) - result.col = int16(-1) - result.fileIndex = -1 - -var - msgContext: seq[TLineInfo] = @[] - proc getInfoContextLen*(): int = return msgContext.len proc setInfoContextLen*(L: int) = setLen(msgContext, L) @@ -585,12 +605,12 @@ proc pushInfoContext*(info: TLineInfo) = msgContext.add(info) proc popInfoContext*() = - setlen(msgContext, len(msgContext) - 1) + setLen(msgContext, len(msgContext) - 1) proc getInfoContext*(index: int): TLineInfo = let L = msgContext.len let i = if index < 0: L + index else: index - if i >=% L: result = UnknownLineInfo() + if i >=% L: result = unknownLineInfo() else: result = msgContext[i] proc toFilename*(fileIdx: int32): string = @@ -627,6 +647,8 @@ proc toFileLine*(info: TLineInfo): string {.inline.} = proc toFileLineCol*(info: TLineInfo): string {.inline.} = result = info.toFilename & "(" & $info.line & "," & $info.col & ")" +template `$`*(info: TLineInfo): expr = toFileLineCol(info) + proc `??`* (info: TLineInfo, filename: string): bool = # only for debugging purposes result = filename in info.toFilename @@ -640,24 +662,28 @@ proc addCheckpoint*(info: TLineInfo) = proc addCheckpoint*(filename: string, line: int) = addCheckpoint(newLineInfo(filename, line, - 1)) -proc OutWriteln*(s: string) = +proc outWriteln*(s: string) = ## Writes to stdout. Always. - if gSilence == 0: Writeln(stdout, s) + if eStdOut in errorOutputs: writeln(stdout, s) -proc MsgWriteln*(s: string) = +proc msgWriteln*(s: string) = ## Writes to stdout. If --stdout option is given, writes to stderr instead. - if gSilence == 0: - if gCmd == cmdIdeTools and optCDebug notin gGlobalOptions: return - if optStdout in gGlobalOptions: Writeln(stderr, s) - else: Writeln(stdout, s) + if gCmd == cmdIdeTools and optCDebug notin gGlobalOptions: return + + if optStdout in gGlobalOptions: + if eStdErr in errorOutputs: writeln(stderr, s) + else: + if eStdOut in errorOutputs: writeln(stdout, s) + + if eInMemory in errorOutputs: bufferedMsgs.safeAdd(s) proc coordToStr(coord: int): string = if coord == -1: result = "???" else: result = $coord -proc MsgKindToString*(kind: TMsgKind): string = +proc msgKindToString*(kind: TMsgKind): string = # later versions may provide translated error messages - result = msgKindToStr[kind] + result = MsgKindToStr[kind] proc getMessageStr(msg: TMsgKind, arg: string): string = result = msgKindToString(msg) % [arg] @@ -679,23 +705,20 @@ type TErrorHandling = enum doNothing, doAbort, doRaise proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) = - template maybeTrace = - if defined(debug) or gVerbosity >= 3: + template quit = + if defined(debug) or gVerbosity >= 3 or msg == errInternal: writeStackTrace() + quit 1 - if msg == errInternal: - writeStackTrace() # we always want a stack trace here if msg >= fatalMin and msg <= fatalMax: - maybeTrace() - quit(1) + quit() if msg >= errMin and msg <= errMax: - maybeTrace() inc(gErrorCounter) options.gExitcode = 1'i8 if gErrorCounter >= gErrorMax: - quit(1) + quit() elif eh == doAbort and gCmd != cmdIdeTools: - quit(1) + quit() elif eh == doRaise: raiseRecoverableError(s) @@ -703,46 +726,43 @@ proc `==`*(a, b: TLineInfo): bool = result = a.line == b.line and a.fileIndex == b.fileIndex proc writeContext(lastinfo: TLineInfo) = - var info = lastInfo + var info = lastinfo for i in countup(0, len(msgContext) - 1): - if msgContext[i] != lastInfo and msgContext[i] != info: - MsgWriteln(posContextFormat % [toMsgFilename(msgContext[i]), + if msgContext[i] != lastinfo and msgContext[i] != info: + msgWriteln(PosContextFormat % [toMsgFilename(msgContext[i]), coordToStr(msgContext[i].line), coordToStr(msgContext[i].col), getMessageStr(errInstantiationFrom, "")]) info = msgContext[i] -proc rawMessage*(msg: TMsgKind, args: openarray[string]) = +proc rawMessage*(msg: TMsgKind, args: openArray[string]) = var frmt: string case msg of errMin..errMax: writeContext(unknownLineInfo()) - frmt = rawErrorFormat + frmt = RawErrorFormat of warnMin..warnMax: if optWarns notin gOptions: return if msg notin gNotes: return writeContext(unknownLineInfo()) - frmt = rawWarningFormat + frmt = RawWarningFormat inc(gWarnCounter) of hintMin..hintMax: if optHints notin gOptions: return if msg notin gNotes: return - frmt = rawHintFormat + frmt = RawHintFormat inc(gHintCounter) let s = `%`(frmt, `%`(msgKindToString(msg), args)) - MsgWriteln(s) + msgWriteln(s) handleError(msg, doAbort, s) proc rawMessage*(msg: TMsgKind, arg: string) = rawMessage(msg, [arg]) -var - lastError = UnknownLineInfo() - proc writeSurroundingSrc(info: TLineInfo) = const indent = " " - MsgWriteln(indent & info.sourceLine.ropeToStr) - MsgWriteln(indent & repeatChar(info.col, ' ') & '^') + msgWriteln(indent & info.sourceLine.ropeToStr) + msgWriteln(indent & repeatChar(info.col, ' ') & '^') proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, eh: TErrorHandling) = @@ -751,7 +771,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, case msg of errMin..errMax: writeContext(info) - frmt = posErrorFormat + frmt = PosErrorFormat # we try to filter error messages so that not two error message # in the same file and line are produced: #ignoreMsg = lastError == info and eh != doAbort @@ -759,54 +779,54 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, of warnMin..warnMax: ignoreMsg = optWarns notin gOptions or msg notin gNotes if not ignoreMsg: writeContext(info) - frmt = posWarningFormat + frmt = PosWarningFormat inc(gWarnCounter) of hintMin..hintMax: ignoreMsg = optHints notin gOptions or msg notin gNotes - frmt = posHintFormat + frmt = PosHintFormat inc(gHintCounter) let s = frmt % [toMsgFilename(info), coordToStr(info.line), coordToStr(info.col), getMessageStr(msg, arg)] if not ignoreMsg: - MsgWriteln(s) + msgWriteln(s) if optPrintSurroundingSrc and msg in errMin..errMax: info.writeSurroundingSrc handleError(msg, eh, s) -proc Fatal*(info: TLineInfo, msg: TMsgKind, arg = "") = +proc fatal*(info: TLineInfo, msg: TMsgKind, arg = "") = liMessage(info, msg, arg, doAbort) -proc GlobalError*(info: TLineInfo, msg: TMsgKind, arg = "") = +proc globalError*(info: TLineInfo, msg: TMsgKind, arg = "") = liMessage(info, msg, arg, doRaise) -proc GlobalError*(info: TLineInfo, arg: string) = +proc globalError*(info: TLineInfo, arg: string) = liMessage(info, errGenerated, arg, doRaise) -proc LocalError*(info: TLineInfo, msg: TMsgKind, arg = "") = +proc localError*(info: TLineInfo, msg: TMsgKind, arg = "") = liMessage(info, msg, arg, doNothing) -proc LocalError*(info: TLineInfo, arg: string) = +proc localError*(info: TLineInfo, arg: string) = liMessage(info, errGenerated, arg, doNothing) -proc Message*(info: TLineInfo, msg: TMsgKind, arg = "") = +proc message*(info: TLineInfo, msg: TMsgKind, arg = "") = liMessage(info, msg, arg, doNothing) -proc InternalError*(info: TLineInfo, errMsg: string) = +proc internalError*(info: TLineInfo, errMsg: string) = if gCmd == cmdIdeTools: return writeContext(info) liMessage(info, errInternal, errMsg, doAbort) -proc InternalError*(errMsg: string) = +proc internalError*(errMsg: string) = if gCmd == cmdIdeTools: return - writeContext(UnknownLineInfo()) + writeContext(unknownLineInfo()) rawMessage(errInternal, errMsg) -template AssertNotNil*(e: expr): expr = - if e == nil: InternalError($InstantiationInfo()) +template assertNotNil*(e: expr): expr = + if e == nil: internalError($instantiationInfo()) e -template InternalAssert*(e: bool): stmt = - if not e: InternalError($InstantiationInfo()) +template internalAssert*(e: bool): stmt = + if not e: internalError($instantiationInfo()) proc addSourceLine*(fileIdx: int32, line: string) = fileInfos[fileIdx].lines.add line.toRope @@ -820,23 +840,22 @@ proc sourceLine*(i: TLineInfo): PRope = addSourceLine i.fileIndex, line.string except EIO: discard - InternalAssert i.fileIndex < fileInfos.len + internalAssert i.fileIndex < fileInfos.len # can happen if the error points to EOF: if i.line > fileInfos[i.fileIndex].lines.len: return nil result = fileInfos[i.fileIndex].lines[i.line-1] proc quotedFilename*(i: TLineInfo): PRope = - InternalAssert i.fileIndex >= 0 + internalAssert i.fileIndex >= 0 result = fileInfos[i.fileIndex].quotedName -ropes.ErrorHandler = proc (err: TRopesError, msg: string, useWarning: bool) = +ropes.errorHandler = proc (err: TRopesError, msg: string, useWarning: bool) = case err of rInvalidFormatStr: internalError("ropes: invalid format string: " & msg) of rTokenTooLong: internalError("ropes: token too long: " & msg) of rCannotOpenFile: - rawMessage(if useWarning: warnCannotOpenFile else: errCannotOpenFile, - msg) - + rawMessage(if useWarning: warnCannotOpenFile else: errCannotOpenFile, msg) + diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index 507812d9c..136a0d454 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -49,7 +49,7 @@ proc parseExpr(L: var TLexer, tok: var TToken): bool = var b = parseAndExpr(L, tok) result = result or b -proc EvalppIf(L: var TLexer, tok: var TToken): bool = +proc evalppIf(L: var TLexer, tok: var TToken): bool = ppGetTok(L, tok) # skip 'if' or 'elif' result = parseExpr(L, tok) if tok.tokType == tkColon: ppGetTok(L, tok) @@ -60,7 +60,7 @@ var condStack: seq[bool] = @[] proc doEnd(L: var TLexer, tok: var TToken) = if high(condStack) < 0: lexMessage(L, errTokenExpected, "@if") ppGetTok(L, tok) # skip 'end' - setlen(condStack, high(condStack)) + setLen(condStack, high(condStack)) type TJumpDest = enum @@ -75,18 +75,18 @@ proc doElse(L: var TLexer, tok: var TToken) = proc doElif(L: var TLexer, tok: var TToken) = if high(condStack) < 0: lexMessage(L, errTokenExpected, "@if") - var res = EvalppIf(L, tok) + var res = evalppIf(L, tok) if condStack[high(condStack)] or not res: jumpToDirective(L, tok, jdElseEndif) else: condStack[high(condStack)] = true proc jumpToDirective(L: var TLexer, tok: var TToken, dest: TJumpDest) = var nestedIfs = 0 - while True: + while true: if (tok.ident != nil) and (tok.ident.s == "@"): ppGetTok(L, tok) case whichKeyword(tok.ident) of wIf: - Inc(nestedIfs) + inc(nestedIfs) of wElse: if (dest == jdElseEndif) and (nestedIfs == 0): doElse(L, tok) @@ -99,21 +99,21 @@ proc jumpToDirective(L: var TLexer, tok: var TToken, dest: TJumpDest) = if nestedIfs == 0: doEnd(L, tok) break - if nestedIfs > 0: Dec(nestedIfs) + if nestedIfs > 0: dec(nestedIfs) else: - nil + discard ppGetTok(L, tok) - elif tok.tokType == tkEof: + elif tok.tokType == tkEof: lexMessage(L, errTokenExpected, "@end") - else: + else: ppGetTok(L, tok) proc parseDirective(L: var TLexer, tok: var TToken) = ppGetTok(L, tok) # skip @ case whichKeyword(tok.ident) of wIf: - setlen(condStack, len(condStack) + 1) - var res = EvalppIf(L, tok) + setLen(condStack, len(condStack) + 1) + var res = evalppIf(L, tok) condStack[high(condStack)] = res if not res: jumpToDirective(L, tok, jdElseEndif) of wElif: doElif(L, tok) @@ -121,7 +121,7 @@ proc parseDirective(L: var TLexer, tok: var TToken) = of wEnd: doEnd(L, tok) of wWrite: ppGetTok(L, tok) - msgs.MsgWriteln(tokToStr(tok)) + msgs.msgWriteln(tokToStr(tok)) ppGetTok(L, tok) else: case tok.ident.s.normalize @@ -135,13 +135,13 @@ proc parseDirective(L: var TLexer, tok: var TToken) = ppGetTok(L, tok) var key = tokToStr(tok) ppGetTok(L, tok) - os.putEnv(key, tokToStr(tok) & os.getenv(key)) + os.putEnv(key, tokToStr(tok) & os.getEnv(key)) ppGetTok(L, tok) of "appendenv": ppGetTok(L, tok) var key = tokToStr(tok) ppGetTok(L, tok) - os.putEnv(key, os.getenv(key) & tokToStr(tok)) + os.putEnv(key, os.getEnv(key) & tokToStr(tok)) ppGetTok(L, tok) else: lexMessage(L, errInvalidDirectiveX, tokToStr(tok)) @@ -196,7 +196,7 @@ proc readConfigFile(filename: string) = L: TLexer tok: TToken stream: PLLStream - stream = LLStreamOpen(filename, fmRead) + stream = llStreamOpen(filename, fmRead) if stream != nil: initToken(tok) openLexer(L, filename, stream) @@ -219,7 +219,7 @@ proc getSystemConfigPath(filename: string): string = if not existsFile(result): result = joinPath([p, "etc", filename]) if not existsFile(result): result = "/etc/" & filename -proc LoadConfigs*(cfg: string) = +proc loadConfigs*(cfg: string) = # set default value (can be overwritten): if libpath == "": # choose default libpath: @@ -243,11 +243,6 @@ proc LoadConfigs*(cfg: string) = readConfigFile(pd / cfg) if gProjectName.len != 0: - var conffile = changeFileExt(gProjectFull, "cfg") - if conffile != pd / cfg and existsFile(conffile): - readConfigFile(conffile) - rawMessage(warnConfigDeprecated, conffile) - # new project wide config file: readConfigFile(changeFileExt(gProjectFull, "nimrod.cfg")) diff --git a/compiler/nimlexbase.nim b/compiler/nimlexbase.nim index 6d45a825a..038573c35 100644 --- a/compiler/nimlexbase.nim +++ b/compiler/nimlexbase.nim @@ -42,7 +42,7 @@ type buf*: cstring bufLen*: int # length of buffer in characters stream*: PLLStream # we read from this stream - LineNumber*: int # the current line number + lineNumber*: int # the current line number # private data: sentinel*: int lineStart*: int # index of last line start in buffer @@ -54,11 +54,11 @@ proc openBaseLexer*(L: var TBaseLexer, inputstream: PLLStream, proc closeBaseLexer*(L: var TBaseLexer) proc getCurrentLine*(L: TBaseLexer, marker: bool = true): string proc getColNumber*(L: TBaseLexer, pos: int): int -proc HandleCR*(L: var TBaseLexer, pos: int): int +proc handleCR*(L: var TBaseLexer, pos: int): int # Call this if you scanned over CR in the buffer; it returns the # position to continue the scanning from. `pos` must be the position # of the CR. -proc HandleLF*(L: var TBaseLexer, pos: int): int +proc handleLF*(L: var TBaseLexer, pos: int): int # Call this if you scanned over LF in the buffer; it returns the the # position to continue the scanning from. `pos` must be the position # of the LF. @@ -69,9 +69,9 @@ const proc closeBaseLexer(L: var TBaseLexer) = dealloc(L.buf) - LLStreamClose(L.stream) + llStreamClose(L.stream) -proc FillBuffer(L: var TBaseLexer) = +proc fillBuffer(L: var TBaseLexer) = var charsRead, toCopy, s: int # all are in characters, # not bytes (in case this @@ -80,12 +80,12 @@ proc FillBuffer(L: var TBaseLexer) = # we know here that pos == L.sentinel, but not if this proc # is called the first time by initBaseLexer() assert(L.sentinel < L.bufLen) - toCopy = L.BufLen - L.sentinel - 1 + toCopy = L.bufLen - L.sentinel - 1 assert(toCopy >= 0) if toCopy > 0: - MoveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize) + moveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize) # "moveMem" handles overlapping regions - charsRead = LLStreamRead(L.stream, addr(L.buf[toCopy]), + charsRead = llStreamRead(L.stream, addr(L.buf[toCopy]), (L.sentinel + 1) * chrSize) div chrSize s = toCopy + charsRead if charsRead < L.sentinel + 1: @@ -96,7 +96,7 @@ proc FillBuffer(L: var TBaseLexer) = dec(s) # BUGFIX (valgrind) while true: assert(s < L.bufLen) - while (s >= 0) and not (L.buf[s] in NewLines): Dec(s) + while (s >= 0) and not (L.buf[s] in NewLines): dec(s) if s >= 0: # we found an appropriate character for a sentinel: L.sentinel = s @@ -104,11 +104,11 @@ proc FillBuffer(L: var TBaseLexer) = else: # rather than to give up here because the line is too long, # double the buffer's size and try again: - oldBufLen = L.BufLen - L.bufLen = L.BufLen * 2 + oldBufLen = L.bufLen + L.bufLen = L.bufLen * 2 L.buf = cast[cstring](realloc(L.buf, L.bufLen * chrSize)) - assert(L.bufLen - oldBuflen == oldBufLen) - charsRead = LLStreamRead(L.stream, addr(L.buf[oldBufLen]), + assert(L.bufLen - oldBufLen == oldBufLen) + charsRead = llStreamRead(L.stream, addr(L.buf[oldBufLen]), oldBufLen * chrSize) div chrSize if charsRead < oldBufLen: L.buf[oldBufLen + charsRead] = EndOfFile @@ -126,20 +126,20 @@ proc fillBaseLexer(L: var TBaseLexer, pos: int): int = result = 0 L.lineStart = result -proc HandleCR(L: var TBaseLexer, pos: int): int = +proc handleCR(L: var TBaseLexer, pos: int): int = assert(L.buf[pos] == CR) - inc(L.linenumber) + inc(L.lineNumber) result = fillBaseLexer(L, pos) if L.buf[result] == LF: result = fillBaseLexer(L, result) -proc HandleLF(L: var TBaseLexer, pos: int): int = +proc handleLF(L: var TBaseLexer, pos: int): int = assert(L.buf[pos] == LF) - inc(L.linenumber) + inc(L.lineNumber) result = fillBaseLexer(L, pos) #L.lastNL := result-1; // BUGFIX: was: result; -proc skip_UTF_8_BOM(L: var TBaseLexer) = - if (L.buf[0] == '\xEF') and (L.buf[1] == '\xBB') and (L.buf[2] == '\xBF'): +proc skipUTF8BOM(L: var TBaseLexer) = + if L.buf[0] == '\xEF' and L.buf[1] == '\xBB' and L.buf[2] == '\xBF': inc(L.bufpos, 3) inc(L.lineStart, 3) @@ -150,10 +150,10 @@ proc openBaseLexer(L: var TBaseLexer, inputstream: PLLStream, bufLen = 8192) = L.buf = cast[cstring](alloc(bufLen * chrSize)) L.sentinel = bufLen - 1 L.lineStart = 0 - L.linenumber = 1 # lines start at 1 + L.lineNumber = 1 # lines start at 1 L.stream = inputstream fillBuffer(L) - skip_UTF_8_BOM(L) + skipUTF8BOM(L) proc getColNumber(L: TBaseLexer, pos: int): int = result = abs(pos - L.lineStart) @@ -166,5 +166,4 @@ proc getCurrentLine(L: TBaseLexer, marker: bool = true): string = inc(i) result.add("\n") if marker: - result.add(RepeatChar(getColNumber(L, L.bufpos)) & '^' & "\n") - + result.add(repeatChar(getColNumber(L, L.bufpos)) & '^' & "\n") diff --git a/compiler/nimrod.dot b/compiler/nimrod.dot deleted file mode 100644 index e9663d7c5..000000000 --- a/compiler/nimrod.dot +++ /dev/null @@ -1,591 +0,0 @@ -digraph nimrod { -times -> strutils; -os -> strutils; -os -> times; -posix -> times; -os -> posix; -nhashes -> strutils; -nstrtabs -> os; -nstrtabs -> nhashes; -nstrtabs -> strutils; -options -> os; -options -> lists; -options -> strutils; -options -> nstrtabs; -msgs -> options; -msgs -> strutils; -msgs -> os; -crc -> strutils; -platform -> strutils; -ropes -> msgs; -ropes -> strutils; -ropes -> platform; -ropes -> nhashes; -ropes -> crc; -idents -> nhashes; -idents -> strutils; -ast -> msgs; -ast -> nhashes; -ast -> nversion; -ast -> options; -ast -> strutils; -ast -> crc; -ast -> ropes; -ast -> idents; -ast -> lists; -astalgo -> ast; -astalgo -> nhashes; -astalgo -> strutils; -astalgo -> options; -astalgo -> msgs; -astalgo -> ropes; -astalgo -> idents; -condsyms -> ast; -condsyms -> astalgo; -condsyms -> msgs; -condsyms -> nhashes; -condsyms -> platform; -condsyms -> strutils; -condsyms -> idents; -hashes -> strutils; -strtabs -> os; -strtabs -> hashes; -strtabs -> strutils; -osproc -> strutils; -osproc -> os; -osproc -> strtabs; -osproc -> streams; -osproc -> posix; -extccomp -> lists; -extccomp -> ropes; -extccomp -> os; -extccomp -> strutils; -extccomp -> osproc; -extccomp -> platform; -extccomp -> condsyms; -extccomp -> options; -extccomp -> msgs; -wordrecg -> nhashes; -wordrecg -> strutils; -wordrecg -> idents; -commands -> os; -commands -> msgs; -commands -> options; -commands -> nversion; -commands -> condsyms; -commands -> strutils; -commands -> extccomp; -commands -> platform; -commands -> lists; -commands -> wordrecg; -llstream -> strutils; -lexbase -> llstream; -lexbase -> strutils; -scanner -> nhashes; -scanner -> options; -scanner -> msgs; -scanner -> strutils; -scanner -> platform; -scanner -> idents; -scanner -> lexbase; -scanner -> llstream; -scanner -> wordrecg; -nimconf -> llstream; -nimconf -> nversion; -nimconf -> commands; -nimconf -> os; -nimconf -> strutils; -nimconf -> msgs; -nimconf -> platform; -nimconf -> condsyms; -nimconf -> scanner; -nimconf -> options; -nimconf -> idents; -nimconf -> wordrecg; -pnimsyn -> llstream; -pnimsyn -> scanner; -pnimsyn -> idents; -pnimsyn -> strutils; -pnimsyn -> ast; -pnimsyn -> msgs; -pbraces -> llstream; -pbraces -> scanner; -pbraces -> idents; -pbraces -> strutils; -pbraces -> ast; -pbraces -> msgs; -pbraces -> pnimsyn; -rnimsyn -> scanner; -rnimsyn -> options; -rnimsyn -> idents; -rnimsyn -> strutils; -rnimsyn -> ast; -rnimsyn -> msgs; -rnimsyn -> lists; -filters -> llstream; -filters -> os; -filters -> wordrecg; -filters -> idents; -filters -> strutils; -filters -> ast; -filters -> astalgo; -filters -> msgs; -filters -> options; -filters -> rnimsyn; -ptmplsyn -> llstream; -ptmplsyn -> os; -ptmplsyn -> wordrecg; -ptmplsyn -> idents; -ptmplsyn -> strutils; -ptmplsyn -> ast; -ptmplsyn -> astalgo; -ptmplsyn -> msgs; -ptmplsyn -> options; -ptmplsyn -> rnimsyn; -ptmplsyn -> filters; -syntaxes -> strutils; -syntaxes -> llstream; -syntaxes -> ast; -syntaxes -> astalgo; -syntaxes -> idents; -syntaxes -> scanner; -syntaxes -> options; -syntaxes -> msgs; -syntaxes -> pnimsyn; -syntaxes -> pbraces; -syntaxes -> ptmplsyn; -syntaxes -> filters; -syntaxes -> rnimsyn; -paslex -> nhashes; -paslex -> options; -paslex -> msgs; -paslex -> strutils; -paslex -> platform; -paslex -> idents; -paslex -> lexbase; -paslex -> wordrecg; -paslex -> scanner; -pasparse -> os; -pasparse -> llstream; -pasparse -> scanner; -pasparse -> paslex; -pasparse -> idents; -pasparse -> wordrecg; -pasparse -> strutils; -pasparse -> ast; -pasparse -> astalgo; -pasparse -> msgs; -pasparse -> options; -rodread -> os; -rodread -> options; -rodread -> strutils; -rodread -> nversion; -rodread -> ast; -rodread -> astalgo; -rodread -> msgs; -rodread -> platform; -rodread -> condsyms; -rodread -> ropes; -rodread -> idents; -rodread -> crc; -trees -> ast; -trees -> astalgo; -trees -> scanner; -trees -> msgs; -trees -> strutils; -types -> ast; -types -> astalgo; -types -> trees; -types -> msgs; -types -> strutils; -types -> platform; -magicsys -> ast; -magicsys -> astalgo; -magicsys -> nhashes; -magicsys -> msgs; -magicsys -> platform; -magicsys -> nversion; -magicsys -> times; -magicsys -> idents; -magicsys -> rodread; -nimsets -> ast; -nimsets -> astalgo; -nimsets -> trees; -nimsets -> nversion; -nimsets -> msgs; -nimsets -> platform; -nimsets -> bitsets; -nimsets -> types; -nimsets -> rnimsyn; -passes -> strutils; -passes -> lists; -passes -> options; -passes -> ast; -passes -> astalgo; -passes -> llstream; -passes -> msgs; -passes -> platform; -passes -> os; -passes -> condsyms; -passes -> idents; -passes -> rnimsyn; -passes -> types; -passes -> extccomp; -passes -> math; -passes -> magicsys; -passes -> nversion; -passes -> nimsets; -passes -> syntaxes; -passes -> times; -passes -> rodread; -treetab -> nhashes; -treetab -> ast; -treetab -> astalgo; -treetab -> types; -semdata -> strutils; -semdata -> lists; -semdata -> options; -semdata -> scanner; -semdata -> ast; -semdata -> astalgo; -semdata -> trees; -semdata -> treetab; -semdata -> wordrecg; -semdata -> ropes; -semdata -> msgs; -semdata -> platform; -semdata -> os; -semdata -> condsyms; -semdata -> idents; -semdata -> rnimsyn; -semdata -> types; -semdata -> extccomp; -semdata -> math; -semdata -> magicsys; -semdata -> nversion; -semdata -> nimsets; -semdata -> pnimsyn; -semdata -> times; -semdata -> passes; -semdata -> rodread; -lookups -> ast; -lookups -> astalgo; -lookups -> idents; -lookups -> semdata; -lookups -> types; -lookups -> msgs; -lookups -> options; -lookups -> rodread; -lookups -> rnimsyn; -importer -> strutils; -importer -> os; -importer -> ast; -importer -> astalgo; -importer -> msgs; -importer -> options; -importer -> idents; -importer -> rodread; -importer -> lookups; -importer -> semdata; -importer -> passes; -rodwrite -> os; -rodwrite -> options; -rodwrite -> strutils; -rodwrite -> nversion; -rodwrite -> ast; -rodwrite -> astalgo; -rodwrite -> msgs; -rodwrite -> platform; -rodwrite -> condsyms; -rodwrite -> ropes; -rodwrite -> idents; -rodwrite -> crc; -rodwrite -> rodread; -rodwrite -> passes; -rodwrite -> importer; -semfold -> strutils; -semfold -> lists; -semfold -> options; -semfold -> ast; -semfold -> astalgo; -semfold -> trees; -semfold -> treetab; -semfold -> nimsets; -semfold -> times; -semfold -> nversion; -semfold -> platform; -semfold -> math; -semfold -> msgs; -semfold -> os; -semfold -> condsyms; -semfold -> idents; -semfold -> rnimsyn; -semfold -> types; -evals -> strutils; -evals -> magicsys; -evals -> lists; -evals -> options; -evals -> ast; -evals -> astalgo; -evals -> trees; -evals -> treetab; -evals -> nimsets; -evals -> msgs; -evals -> os; -evals -> condsyms; -evals -> idents; -evals -> rnimsyn; -evals -> types; -evals -> passes; -evals -> semfold; -procfind -> ast; -procfind -> astalgo; -procfind -> msgs; -procfind -> semdata; -procfind -> types; -procfind -> trees; -pragmas -> os; -pragmas -> platform; -pragmas -> condsyms; -pragmas -> ast; -pragmas -> astalgo; -pragmas -> idents; -pragmas -> semdata; -pragmas -> msgs; -pragmas -> rnimsyn; -pragmas -> wordrecg; -pragmas -> ropes; -pragmas -> options; -pragmas -> strutils; -pragmas -> lists; -pragmas -> extccomp; -pragmas -> math; -pragmas -> magicsys; -pragmas -> trees; -sem -> strutils; -sem -> nhashes; -sem -> lists; -sem -> options; -sem -> scanner; -sem -> ast; -sem -> astalgo; -sem -> trees; -sem -> treetab; -sem -> wordrecg; -sem -> ropes; -sem -> msgs; -sem -> os; -sem -> condsyms; -sem -> idents; -sem -> rnimsyn; -sem -> types; -sem -> platform; -sem -> math; -sem -> magicsys; -sem -> pnimsyn; -sem -> nversion; -sem -> nimsets; -sem -> semdata; -sem -> evals; -sem -> semfold; -sem -> importer; -sem -> procfind; -sem -> lookups; -sem -> rodread; -sem -> pragmas; -sem -> passes; -rst -> os; -rst -> msgs; -rst -> strutils; -rst -> platform; -rst -> nhashes; -rst -> ropes; -rst -> options; -highlite -> nhashes; -highlite -> options; -highlite -> msgs; -highlite -> strutils; -highlite -> platform; -highlite -> idents; -highlite -> lexbase; -highlite -> wordrecg; -highlite -> scanner; -docgen -> ast; -docgen -> astalgo; -docgen -> strutils; -docgen -> nhashes; -docgen -> options; -docgen -> nversion; -docgen -> msgs; -docgen -> os; -docgen -> ropes; -docgen -> idents; -docgen -> wordrecg; -docgen -> math; -docgen -> syntaxes; -docgen -> rnimsyn; -docgen -> scanner; -docgen -> rst; -docgen -> times; -docgen -> highlite; -ccgutils -> ast; -ccgutils -> astalgo; -ccgutils -> ropes; -ccgutils -> lists; -ccgutils -> nhashes; -ccgutils -> strutils; -ccgutils -> types; -ccgutils -> msgs; -cgmeth -> options; -cgmeth -> ast; -cgmeth -> astalgo; -cgmeth -> msgs; -cgmeth -> idents; -cgmeth -> rnimsyn; -cgmeth -> types; -cgmeth -> magicsys; -cgen -> ast; -cgen -> astalgo; -cgen -> strutils; -cgen -> nhashes; -cgen -> trees; -cgen -> platform; -cgen -> magicsys; -cgen -> extccomp; -cgen -> options; -cgen -> nversion; -cgen -> nimsets; -cgen -> msgs; -cgen -> crc; -cgen -> bitsets; -cgen -> idents; -cgen -> lists; -cgen -> types; -cgen -> ccgutils; -cgen -> os; -cgen -> times; -cgen -> ropes; -cgen -> math; -cgen -> passes; -cgen -> rodread; -cgen -> wordrecg; -cgen -> rnimsyn; -cgen -> treetab; -cgen -> cgmeth; -jsgen -> ast; -jsgen -> astalgo; -jsgen -> strutils; -jsgen -> nhashes; -jsgen -> trees; -jsgen -> platform; -jsgen -> magicsys; -jsgen -> extccomp; -jsgen -> options; -jsgen -> nversion; -jsgen -> nimsets; -jsgen -> msgs; -jsgen -> crc; -jsgen -> bitsets; -jsgen -> idents; -jsgen -> lists; -jsgen -> types; -jsgen -> os; -jsgen -> times; -jsgen -> ropes; -jsgen -> math; -jsgen -> passes; -jsgen -> ccgutils; -jsgen -> wordrecg; -jsgen -> rnimsyn; -jsgen -> rodread; -interact -> llstream; -interact -> strutils; -interact -> ropes; -interact -> nstrtabs; -interact -> msgs; -passaux -> strutils; -passaux -> ast; -passaux -> astalgo; -passaux -> passes; -passaux -> msgs; -passaux -> options; -depends -> os; -depends -> options; -depends -> ast; -depends -> astalgo; -depends -> msgs; -depends -> ropes; -depends -> idents; -depends -> passes; -depends -> importer; -transf -> strutils; -transf -> lists; -transf -> options; -transf -> ast; -transf -> astalgo; -transf -> trees; -transf -> treetab; -transf -> evals; -transf -> msgs; -transf -> os; -transf -> idents; -transf -> rnimsyn; -transf -> types; -transf -> passes; -transf -> semfold; -transf -> magicsys; -transf -> cgmeth; -main -> llstream; -main -> strutils; -main -> ast; -main -> astalgo; -main -> scanner; -main -> syntaxes; -main -> rnimsyn; -main -> options; -main -> msgs; -main -> os; -main -> lists; -main -> condsyms; -main -> paslex; -main -> pasparse; -main -> rodread; -main -> rodwrite; -main -> ropes; -main -> trees; -main -> wordrecg; -main -> sem; -main -> semdata; -main -> idents; -main -> passes; -main -> docgen; -main -> extccomp; -main -> cgen; -main -> jsgen; -main -> platform; -main -> interact; -main -> nimconf; -main -> importer; -main -> passaux; -main -> depends; -main -> transf; -main -> evals; -main -> types; -parseopt -> os; -parseopt -> strutils; -nimrod -> times; -nimrod -> commands; -nimrod -> scanner; -nimrod -> condsyms; -nimrod -> options; -nimrod -> msgs; -nimrod -> nversion; -nimrod -> nimconf; -nimrod -> ropes; -nimrod -> extccomp; -nimrod -> strutils; -nimrod -> os; -nimrod -> platform; -nimrod -> main; -nimrod -> parseopt; -} diff --git a/compiler/nimrod.nim b/compiler/nimrod.nim index 3fa80cebb..38d440ade 100644 --- a/compiler/nimrod.nim +++ b/compiler/nimrod.nim @@ -13,9 +13,9 @@ when defined(gcc) and defined(windows): else: {.link: "icons/nimrod_icon.o".} -import - commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes, - extccomp, strutils, os, platform, main, parseopt, service +import + commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes, + extccomp, strutils, os, osproc, platform, main, parseopt, service when hasTinyCBackend: import tccgen @@ -23,7 +23,7 @@ when hasTinyCBackend: when defined(profiler) or defined(memProfiler): {.hint: "Profiling support is turned on!".} import nimprof - + proc prependCurDir(f: string): string = when defined(unix): if os.isAbsolute(f): result = f @@ -31,12 +31,12 @@ proc prependCurDir(f: string): string = else: result = f -proc HandleCmdLine() = +proc handleCmdLine() = if paramCount() == 0: writeCommandLineUsage() else: # Process command line arguments: - ProcessCmdLine(passCmd1, "") + processCmdLine(passCmd1, "") if gProjectName != "": try: gProjectFull = canonicalizePath(gProjectName) @@ -47,12 +47,12 @@ proc HandleCmdLine() = gProjectName = p.name else: gProjectPath = getCurrentDir() - LoadConfigs(DefaultConfig) # load all config files + loadConfigs(DefaultConfig) # load all config files # now process command line arguments again, because some options in the # command line can overwite the config file's settings extccomp.initVars() - ProcessCmdLine(passCmd2, "") - MainCommand() + processCmdLine(passCmd2, "") + mainCommand() if gVerbosity >= 2: echo(GC_getStatistics()) #echo(GC_getStatistics()) if msgs.gErrorCounter == 0: @@ -61,12 +61,18 @@ proc HandleCmdLine() = tccgen.run() if optRun in gGlobalOptions: if gCmd == cmdCompileToJS: - var ex = quoteIfContainsWhite( + var ex = quoteShell( completeCFilePath(changeFileExt(gProjectFull, "js").prependCurDir)) execExternalProgram("node " & ex & ' ' & service.arguments) else: - var ex = quoteIfContainsWhite( - changeFileExt(gProjectFull, exeExt).prependCurDir) + var binPath: string + if options.outFile.len > 0: + # If the user specified an outFile path, use that directly. + binPath = options.outFile.prependCurDir + else: + # Figure out ourselves a valid binary name. + binPath = changeFileExt(gProjectFull, ExeExt).prependCurDir + var ex = quoteShell(binPath) execExternalProgram(ex & ' ' & service.arguments) when defined(GC_setMaxPause): @@ -75,6 +81,8 @@ when defined(GC_setMaxPause): when compileOption("gc", "v2") or compileOption("gc", "refc"): # the new correct mark&sweet collector is too slow :-/ GC_disableMarkAndSweep() -condsyms.InitDefines() -HandleCmdLine() -quit(int8(msgs.gErrorCounter > 0)) +condsyms.initDefines() + +when not defined(selftest): + handleCmdLine() + quit(int8(msgs.gErrorCounter > 0)) diff --git a/compiler/nimrod.cfg b/compiler/nimrod.nimrod.cfg index ac8f732f1..657c47b28 100644 --- a/compiler/nimrod.cfg +++ b/compiler/nimrod.nimrod.cfg @@ -11,4 +11,10 @@ path:"$projectPath/.." path:"$lib/packages/docutils" define:booting +import:testability +@if windows: + cincludes: "$lib/wrappers/libffi/common" +@end + +cs:partial diff --git a/compiler/nimsets.nim b/compiler/nimsets.nim index 34f79e14b..d65618e0a 100644 --- a/compiler/nimsets.nim +++ b/compiler/nimsets.nim @@ -18,7 +18,7 @@ proc overlap*(a, b: PNode): bool proc inSet*(s: PNode, elem: PNode): bool proc someInSet*(s: PNode, a, b: PNode): bool proc emptyRange*(a, b: PNode): bool -proc SetHasRange*(s: PNode): bool +proc setHasRange*(s: PNode): bool # returns true if set contains a range (needed by the code generator) # these are used for constant folding: proc unionSets*(a, b: PNode): PNode @@ -32,7 +32,7 @@ proc cardSet*(s: PNode): BiggestInt proc inSet(s: PNode, elem: PNode): bool = if s.kind != nkCurly: - InternalError(s.info, "inSet") + internalError(s.info, "inSet") return false for i in countup(0, sonsLen(s) - 1): if s.sons[i].kind == nkRange: @@ -58,10 +58,10 @@ proc overlap(a, b: PNode): bool = else: result = sameValue(a, b) -proc SomeInSet(s: PNode, a, b: PNode): bool = +proc someInSet(s: PNode, a, b: PNode): bool = # checks if some element of a..b is in the set s if s.kind != nkCurly: - InternalError(s.info, "SomeInSet") + internalError(s.info, "SomeInSet") return false for i in countup(0, sonsLen(s) - 1): if s.sons[i].kind == nkRange: @@ -82,12 +82,12 @@ proc toBitSet(s: PNode, b: var TBitSet) = if s.sons[i].kind == nkRange: j = getOrdValue(s.sons[i].sons[0]) while j <= getOrdValue(s.sons[i].sons[1]): - BitSetIncl(b, j - first) + bitSetIncl(b, j - first) inc(j) else: - BitSetIncl(b, getOrdValue(s.sons[i]) - first) + bitSetIncl(b, getOrdValue(s.sons[i]) - first) -proc ToTreeSet(s: TBitSet, settype: PType, info: TLineInfo): PNode = +proc toTreeSet(s: TBitSet, settype: PType, info: TLineInfo): PNode = var a, b, e, first: BiggestInt # a, b are interval borders elemType: PType @@ -98,14 +98,14 @@ proc ToTreeSet(s: TBitSet, settype: PType, info: TLineInfo): PNode = result.typ = settype result.info = info e = 0 - while e < len(s) * elemSize: + while e < len(s) * ElemSize: if bitSetIn(s, e): a = e b = e while true: - Inc(b) - if (b >= len(s) * elemSize) or not bitSetIn(s, b): break - Dec(b) + inc(b) + if (b >= len(s) * ElemSize) or not bitSetIn(s, b): break + dec(b) if a == b: addSon(result, newIntTypeNode(nkIntLit, a + first, elemType)) else: @@ -115,7 +115,7 @@ proc ToTreeSet(s: TBitSet, settype: PType, info: TLineInfo): PNode = addSon(n, newIntTypeNode(nkIntLit, b + first, elemType)) addSon(result, n) e = b - Inc(e) + inc(e) template nodeSetOp(a, b: PNode, op: expr) {.dirty.} = var x, y: TBitSet @@ -124,10 +124,10 @@ template nodeSetOp(a, b: PNode, op: expr) {.dirty.} = op(x, y) result = toTreeSet(x, a.typ, a.info) -proc unionSets(a, b: PNode): PNode = nodeSetOp(a, b, BitSetUnion) -proc diffSets(a, b: PNode): PNode = nodeSetOp(a, b, BitSetDiff) -proc intersectSets(a, b: PNode): PNode = nodeSetOp(a, b, BitSetIntersect) -proc symdiffSets(a, b: PNode): PNode = nodeSetOp(a, b, BitSetSymDiff) +proc unionSets(a, b: PNode): PNode = nodeSetOp(a, b, bitSetUnion) +proc diffSets(a, b: PNode): PNode = nodeSetOp(a, b, bitSetDiff) +proc intersectSets(a, b: PNode): PNode = nodeSetOp(a, b, bitSetIntersect) +proc symdiffSets(a, b: PNode): PNode = nodeSetOp(a, b, bitSetSymDiff) proc containsSets(a, b: PNode): bool = var x, y: TBitSet @@ -156,11 +156,11 @@ proc cardSet(s: PNode): BiggestInt = result = result + getOrdValue(s.sons[i].sons[1]) - getOrdValue(s.sons[i].sons[0]) + 1 else: - Inc(result) + inc(result) -proc SetHasRange(s: PNode): bool = +proc setHasRange(s: PNode): bool = if s.kind != nkCurly: - InternalError(s.info, "SetHasRange") + internalError(s.info, "SetHasRange") return false for i in countup(0, sonsLen(s) - 1): if s.sons[i].kind == nkRange: diff --git a/compiler/options.nim b/compiler/options.nim index ea6b91321..4f642e626 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -111,6 +111,7 @@ var gDirtyBufferIdx* = 0'i32 # indicates the fileIdx of the dirty version of # the tracked source X, saved by the CAAS client. gDirtyOriginalIdx* = 0'i32 # the original source file of the dirtified buffer. + gNoBabelPath* = false proc importantComments*(): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools} proc usesNativeGC*(): bool {.inline.} = gSelectedGC >= gcRefc @@ -132,6 +133,7 @@ const NimExt* = "nim" RodExt* = "rod" HtmlExt* = "html" + JsonExt* = "json" TexExt* = "tex" IniExt* = "ini" DefaultConfig* = "nimrod.cfg" @@ -141,7 +143,7 @@ const # additional configuration variables: var gConfigVars* = newStringTable(modeStyleInsensitive) - gDllOverrides = newStringtable(modeCaseInsensitive) + gDllOverrides = newStringTable(modeCaseInsensitive) libpath* = "" gProjectName* = "" # holds a name like 'nimrod' gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/ @@ -157,8 +159,6 @@ var const oKeepVariableNames* = true -const oUseLateInstantiation* = false - proc mainCommandArg*: string = ## This is intended for commands like check or parse ## which will work on the main project file unless @@ -183,7 +183,7 @@ proc getOutFile*(filename, ext: string): string = proc getPrefixDir*(): string = ## gets the application directory - result = SplitPath(getAppDir()).head + result = splitPath(getAppDir()).head proc canonicalizePath*(path: string): string = result = path.expandFilename @@ -191,16 +191,16 @@ proc canonicalizePath*(path: string): string = proc shortenDir*(dir: string): string = ## returns the interesting part of a dir - var prefix = getPrefixDir() & dirSep + var prefix = getPrefixDir() & DirSep if startsWith(dir, prefix): return substr(dir, len(prefix)) - prefix = gProjectPath & dirSep + prefix = gProjectPath & DirSep if startsWith(dir, prefix): return substr(dir, len(prefix)) result = dir proc removeTrailingDirSep*(path: string): string = - if (len(path) > 0) and (path[len(path) - 1] == dirSep): + if (len(path) > 0) and (path[len(path) - 1] == DirSep): result = substr(path, 0, len(path) - 2) else: result = path @@ -212,9 +212,9 @@ proc getGeneratedPath: string = proc getPackageName*(path: string): string = var q = 1 var b = 0 - if path[len(path)-1] in {dirsep, altsep}: q = 2 + if path[len(path)-1] in {DirSep, AltSep}: q = 2 for i in countdown(len(path)-q, 0): - if path[i] in {dirsep, altsep}: + if path[i] in {DirSep, AltSep}: if b == 0: b = i else: let x = path.substr(i+1, b-1) @@ -253,15 +253,15 @@ proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string = result = joinPath(subdir, tail) #echo "completeGeneratedFilePath(", f, ") = ", result -iterator iterSearchPath*(SearchPaths: TLinkedList): string = - var it = PStrEntry(SearchPaths.head) +iterator iterSearchPath*(searchPaths: TLinkedList): string = + var it = PStrEntry(searchPaths.head) while it != nil: yield it.data - it = PStrEntry(it.Next) + it = PStrEntry(it.next) proc rawFindFile(f: string): string = - for it in iterSearchPath(SearchPaths): - result = JoinPath(it, f) + for it in iterSearchPath(searchPaths): + result = joinPath(it, f) if existsFile(result): return result.canonicalizePath result = "" @@ -269,14 +269,14 @@ proc rawFindFile(f: string): string = proc rawFindFile2(f: string): string = var it = PStrEntry(lazyPaths.head) while it != nil: - result = JoinPath(it.data, f) + result = joinPath(it.data, f) if existsFile(result): bringToFront(lazyPaths, it) return result.canonicalizePath - it = PStrEntry(it.Next) + it = PStrEntry(it.next) result = "" -proc FindFile*(f: string): string {.procvar.} = +proc findFile*(f: string): string {.procvar.} = result = f.rawFindFile if result.len == 0: result = f.toLower.rawFindFile @@ -287,11 +287,11 @@ proc FindFile*(f: string): string {.procvar.} = proc findModule*(modulename, currentModule: string): string = # returns path to module - let m = addFileExt(modulename, nimExt) + let m = addFileExt(modulename, NimExt) let currentPath = currentModule.splitFile.dir result = currentPath / m if not existsFile(result): - result = FindFile(m) + result = findFile(m) proc libCandidates*(s: string, dest: var seq[string]) = var le = strutils.find(s, '(') @@ -318,7 +318,7 @@ proc inclDynlibOverride*(lib: string) = proc isDynlibOverride*(lib: string): bool = result = gDllOverrides.hasKey(lib.canonDynlibName) -proc binaryStrSearch*(x: openarray[string], y: string): int = +proc binaryStrSearch*(x: openArray[string], y: string): int = var a = 0 var b = len(x) - 1 while a <= b: diff --git a/compiler/parampatterns.nim b/compiler/parampatterns.nim index 283f83906..e94068776 100644 --- a/compiler/parampatterns.nim +++ b/compiler/parampatterns.nim @@ -42,7 +42,7 @@ const MaxStackSize* = 64 ## max required stack size by the VM proc patternError(n: PNode) = - LocalError(n.info, errIllFormedAstX, renderTree(n, {renderNoComments})) + localError(n.info, errIllFormedAstX, renderTree(n, {renderNoComments})) proc add(code: var TPatternCode, op: TOpcode) {.inline.} = add(code, chr(ord(op))) @@ -97,14 +97,14 @@ proc compileConstraints(p: PNode, result: var TPatternCode) = of "nosideeffect": result.add(ppNoSideEffect) else: # check all symkinds: - InternalAssert int(high(TSymKind)) < 255 + internalAssert int(high(TSymKind)) < 255 for i in low(TSymKind)..high(TSymKind): if cmpIgnoreStyle(($i).substr(2), spec) == 0: result.add(ppSymKind) result.add(chr(i.ord)) return # check all nodekinds: - InternalAssert int(high(TNodeKind)) < 255 + internalAssert int(high(TNodeKind)) < 255 for i in low(TNodeKind)..high(TNodeKind): if cmpIgnoreStyle($i, spec) == 0: result.add(ppNodeKind) @@ -124,8 +124,8 @@ proc semNodeKindConstraints*(p: PNode): PNode = if p.len >= 2: for i in 1.. <p.len: compileConstraints(p.sons[i], result.strVal) - if result.strVal.len > maxStackSize-1: - InternalError(p.info, "parameter pattern too complex") + if result.strVal.len > MaxStackSize-1: + internalError(p.info, "parameter pattern too complex") else: patternError(p) result.strVal.add(ppEof) @@ -216,12 +216,12 @@ proc isAssignable*(owner: PSym, n: PNode): TAssignableResult = of nkObjUpConv, nkObjDownConv, nkCheckedFieldExpr: result = isAssignable(owner, n.sons[0]) else: - nil + discard proc matchNodeKinds*(p, n: PNode): bool = # matches the parameter constraint 'p' against the concrete AST 'n'. # Efficiency matters here. - var stack {.noinit.}: array[0..maxStackSize, bool] + var stack {.noinit.}: array[0..MaxStackSize, bool] # empty patterns are true: stack[0] = true var sp = 1 diff --git a/compiler/parser.nim b/compiler/parser.nim index e8439466a..ff3324b47 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -18,10 +18,10 @@ # In fact the grammar is generated from this file: when isMainModule: import pegs - var outp = open("compiler/grammar.txt", fmWrite) + var outp = open("doc/grammar.txt", fmWrite) for line in lines("compiler/parser.nim"): if line =~ peg" \s* '#| ' {.*}": - outp.writeln matches[0] + outp.write matches[0], "\L" outp.close import @@ -31,11 +31,13 @@ type TParser*{.final.} = object # a TParser object represents a module that # is being parsed currInd: int # current indentation - firstTok: bool + firstTok, strongSpaces: bool lex*: TLexer # the lexer that is used for parsing tok*: TToken # the current token + inPragma: int + inSemiStmtList: int -proc ParseAll*(p: var TParser): PNode +proc parseAll*(p: var TParser): PNode proc openParser*(p: var TParser, filename: string, inputstream: PLLStream) proc closeParser*(p: var TParser) proc parseTopLevelStmt*(p: var TParser): PNode @@ -59,9 +61,9 @@ proc newFloatNodeP*(kind: TNodeKind, floatVal: BiggestFloat, p: TParser): PNode proc newStrNodeP*(kind: TNodeKind, strVal: string, p: TParser): PNode proc newIdentNodeP*(ident: PIdent, p: TParser): PNode proc expectIdentOrKeyw*(p: TParser) -proc ExpectIdent*(p: TParser) +proc expectIdent*(p: TParser) proc parLineInfo*(p: TParser): TLineInfo -proc Eat*(p: var TParser, TokType: TTokType) +proc eat*(p: var TParser, tokType: TTokType) proc skipInd*(p: var TParser) proc optPar*(p: var TParser) proc optInd*(p: var TParser, n: PNode) @@ -75,17 +77,17 @@ proc parseCase(p: var TParser): PNode proc getTok(p: var TParser) = rawGetTok(p.lex, p.tok) -proc OpenParser*(p: var TParser, fileIdx: int32, inputStream: PLLStream) = +proc openParser*(p: var TParser, fileIdx: int32, inputStream: PLLStream) = initToken(p.tok) - OpenLexer(p.lex, fileIdx, inputstream) + openLexer(p.lex, fileIdx, inputStream) getTok(p) # read the first token p.firstTok = true -proc OpenParser*(p: var TParser, filename: string, inputStream: PLLStream) = - openParser(p, filename.fileInfoIdx, inputStream) +proc openParser*(p: var TParser, filename: string, inputStream: PLLStream) = + openParser(p, filename.fileInfoIdx, inputstream) -proc CloseParser(p: var TParser) = - CloseLexer(p.lex) +proc closeParser(p: var TParser) = + closeLexer(p.lex) proc parMessage(p: TParser, msg: TMsgKind, arg: string = "") = lexMessage(p.lex, msg, arg) @@ -135,12 +137,12 @@ proc expectIdentOrKeyw(p: TParser) = if p.tok.tokType != tkSymbol and not isKeyword(p.tok.tokType): lexMessage(p.lex, errIdentifierExpected, prettyTok(p.tok)) -proc ExpectIdent(p: TParser) = +proc expectIdent(p: TParser) = if p.tok.tokType != tkSymbol: lexMessage(p.lex, errIdentifierExpected, prettyTok(p.tok)) -proc Eat(p: var TParser, TokType: TTokType) = - if p.tok.TokType == TokType: getTok(p) +proc eat(p: var TParser, tokType: TTokType) = + if p.tok.tokType == tokType: getTok(p) else: lexMessage(p.lex, errTokenExpected, TokTypeToStr[tokType]) proc parLineInfo(p: TParser): TLineInfo = @@ -185,10 +187,10 @@ proc relevantOprChar(ident: PIdent): char {.inline.} = if result == '\\' and L > 1: result = ident.s[1] -proc IsSigilLike(tok: TToken): bool {.inline.} = +proc isSigilLike(tok: TToken): bool {.inline.} = result = tok.tokType == tkOpr and relevantOprChar(tok.ident) == '@' -proc IsLeftAssociative(tok: TToken): bool {.inline.} = +proc isLeftAssociative(tok: TToken): bool {.inline.} = result = tok.tokType != tkOpr or relevantOprChar(tok.ident) != '^' proc getPrecedence(tok: TToken): int = @@ -211,7 +213,7 @@ proc getPrecedence(tok: TToken): int = of '?': result = 2 else: considerAsgn(2) of tkDiv, tkMod, tkShl, tkShr: result = 9 - of tkIn, tkNotIn, tkIs, tkIsNot, tkNot, tkOf, tkAs: result = 5 + of tkIn, tkNotin, tkIs, tkIsnot, tkNot, tkOf, tkAs: result = 5 of tkDotDot: result = 6 of tkAnd: result = 4 of tkOr, tkXor: result = 3 @@ -427,7 +429,7 @@ proc parseCast(p: var TParser): PNode = proc setBaseFlags(n: PNode, base: TNumericalBase) = case base - of base10: nil + of base10: discard of base2: incl(n.flags, nfBase2) of base8: incl(n.flags, nfBase8) of base16: incl(n.flags, nfBase16) @@ -454,11 +456,13 @@ proc complexOrSimpleStmt(p: var TParser): PNode proc simpleExpr(p: var TParser, mode = pmNormal): PNode proc semiStmtList(p: var TParser, result: PNode) = + inc p.inSemiStmtList result.add(complexOrSimpleStmt(p)) - while p.tok.tokType == tkSemicolon: + while p.tok.tokType == tkSemiColon: getTok(p) optInd(p, result) result.add(complexOrSimpleStmt(p)) + dec p.inSemiStmtList result.kind = nkStmtListExpr proc parsePar(p: var TParser): PNode = @@ -482,7 +486,7 @@ proc parsePar(p: var TParser): PNode = # XXX 'bind' used to be an expression, so we exclude it here; # tests/reject/tbind2 fails otherwise. semiStmtList(p, result) - elif p.tok.tokType == tkSemicolon: + elif p.tok.tokType == tkSemiColon: # '(;' enforces 'stmt' context: getTok(p) optInd(p, result) @@ -498,7 +502,7 @@ proc parsePar(p: var TParser): PNode = asgn.sons[0] = a asgn.sons[1] = b result.add(asgn) - elif p.tok.tokType == tkSemicolon: + elif p.tok.tokType == tkSemiColon: # stmt context: result.add(a) semiStmtList(p, result) @@ -518,14 +522,14 @@ proc parsePar(p: var TParser): PNode = eat(p, tkParRi) proc identOrLiteral(p: var TParser, mode: TPrimaryMode): PNode = + #| literal = | INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT + #| | UINT_LIT | UINT8_LIT | UINT16_LIT | UINT32_LIT | UINT64_LIT + #| | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT + #| | STR_LIT | RSTR_LIT | TRIPLESTR_LIT + #| | CHAR_LIT + #| | NIL #| generalizedLit = GENERALIZED_STR_LIT | GENERALIZED_TRIPLESTR_LIT - #| identOrLiteral = generalizedLit | symbol - #| | INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT - #| | UINT_LIT | UINT8_LIT | UINT16_LIT | UINT32_LIT | UINT64_LIT - #| | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT - #| | STR_LIT | RSTR_LIT | TRIPLESTR_LIT - #| | CHAR_LIT - #| | NIL + #| identOrLiteral = generalizedLit | symbol | literal #| | par | arrayConstr | setOrTableConstr #| | castExpr #| tupleConstr = '(' optInd (exprColonEqExpr comma?)* optPar ')' @@ -634,12 +638,14 @@ proc namedParams(p: var TParser, callee: PNode, addSon(result, a) exprColonEqExprListAux(p, endTok, result) +proc parseMacroColon(p: var TParser, x: PNode): PNode proc primarySuffix(p: var TParser, r: PNode): PNode = #| primarySuffix = '(' (exprColonEqExpr comma?)* ')' doBlocks? #| | doBlocks #| | '.' optInd ('type' | 'addr' | symbol) generalizedLit? #| | '[' optInd indexExprList optPar ']' #| | '{' optInd indexExprList optPar '}' + #| | &( '`'|IDENT|literal|'cast') expr # command syntax result = r while p.tok.indent < 0: case p.tok.tokType @@ -661,8 +667,29 @@ proc primarySuffix(p: var TParser, r: PNode): PNode = result = namedParams(p, result, nkBracketExpr, tkBracketRi) of tkCurlyLe: result = namedParams(p, result, nkCurlyExpr, tkCurlyRi) - else: break - + of tkSymbol, tkAccent, tkIntLit..tkCharLit, tkNil, tkCast: + if p.inPragma == 0: + # actually parsing {.push hints:off.} as {.push(hints:off).} is a sweet + # solution, but pragmas.nim can't handle that + let a = result + result = newNodeP(nkCommand, p) + addSon(result, a) + addSon result, parseExpr(p) + when false: + while p.tok.tokType != tkEof: + let a = parseExpr(p) + addSon(result, a) + if p.tok.tokType != tkComma: break + getTok(p) + optInd(p, a) + if p.tok.tokType == tkDo: + parseDoBlocks(p, result) + else: + result = parseMacroColon(p, result) + break + else: + break + proc primary(p: var TParser, mode: TPrimaryMode): PNode proc simpleExprAux(p: var TParser, limit: int, mode: TPrimaryMode): PNode = @@ -672,7 +699,7 @@ proc simpleExprAux(p: var TParser, limit: int, mode: TPrimaryMode): PNode = let modeB = if mode == pmTypeDef: pmTypeDesc else: mode # the operator itself must not start on a new line: while opPrec >= limit and p.tok.indent < 0: - var leftAssoc = ord(IsLeftAssociative(p.tok)) + var leftAssoc = ord(isLeftAssociative(p.tok)) var a = newNodeP(nkInfix, p) var opNode = newIdentNodeP(p.tok.ident, p) # skip operator: getTok(p) @@ -713,6 +740,7 @@ proc parseIfExpr(p: var TParser, kind: TNodeKind): PNode = proc parsePragma(p: var TParser): PNode = #| pragma = '{.' optInd (exprColonExpr comma?)* optPar ('.}' | '}') result = newNodeP(nkPragma, p) + inc p.inPragma getTok(p) optInd(p, result) while p.tok.tokType notin {tkCurlyDotRi, tkCurlyRi, tkEof}: @@ -724,6 +752,7 @@ proc parsePragma(p: var TParser): PNode = optPar(p) if p.tok.tokType in {tkCurlyDotRi, tkCurlyRi}: getTok(p) else: parMessage(p, errTokenExpected, ".}") + dec p.inPragma proc identVis(p: var TParser): PNode = #| identVis = symbol opr? # postfix position @@ -798,7 +827,7 @@ proc parseTuple(p: var TParser, indentAllowed = false): PNode = while p.tok.tokType in {tkSymbol, tkAccent}: var a = parseIdentColonEquals(p, {}) addSon(result, a) - if p.tok.tokType notin {tkComma, tkSemicolon}: break + if p.tok.tokType notin {tkComma, tkSemiColon}: break getTok(p) skipComment(p, a) optPar(p) @@ -840,13 +869,13 @@ proc parseParamList(p: var TParser, retColon = true): PNode = parMessage(p, errTokenExpected, ")") break addSon(result, a) - if p.tok.tokType notin {tkComma, tkSemicolon}: break + if p.tok.tokType notin {tkComma, tkSemiColon}: break getTok(p) skipComment(p, a) optPar(p) eat(p, tkParRi) let hasRet = if retColon: p.tok.tokType == tkColon - else: p.tok.tokType == tkOpr and IdentEq(p.tok.ident, "->") + else: p.tok.tokType == tkOpr and identEq(p.tok.ident, "->") if hasRet and p.tok.indent < 0: getTok(p) optInd(p, result) @@ -941,7 +970,7 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode = #| / 'static' primary #| / 'bind' primary if isOperator(p.tok): - let isSigil = IsSigilLike(p.tok) + let isSigil = isSigilLike(p.tok) result = newNodeP(nkPrefix, p) var a = newIdentNodeP(p.tok.ident, p) addSon(result, a) @@ -965,14 +994,19 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode = of tkTuple: result = parseTuple(p, mode == pmTypeDef) of tkProc: result = parseProcExpr(p, mode notin {pmTypeDesc, pmTypeDef}) of tkIterator: - if mode in {pmTypeDesc, pmTypeDef}: - result = parseProcExpr(p, false) - result.kind = nkIteratorTy + when false: + if mode in {pmTypeDesc, pmTypeDef}: + result = parseProcExpr(p, false) + result.kind = nkIteratorTy + else: + # no anon iterators for now: + parMessage(p, errExprExpected, p.tok) + getTok(p) # we must consume a token here to prevend endless loops! + result = ast.emptyNode else: - # no anon iterators for now: - parMessage(p, errExprExpected, p.tok) - getTok(p) # we must consume a token here to prevend endless loops! - result = ast.emptyNode + result = parseProcExpr(p, mode notin {pmTypeDesc, pmTypeDef}) + if result.kind == nkLambda: result.kind = nkIteratorDef + else: result.kind = nkIteratorTy of tkEnum: if mode == pmTypeDef: result = parseEnum(p) @@ -995,9 +1029,13 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode = getTokNoInd(p) addSon(result, primary(p, pmNormal)) of tkStatic: - result = newNodeP(nkStaticExpr, p) + let info = parLineInfo(p) getTokNoInd(p) - addSon(result, primary(p, pmNormal)) + let next = primary(p, pmNormal) + if next.kind == nkBracket and next.sonsLen == 1: + result = newNode(nkStaticTy, info, @[next.sons[0]]) + else: + result = newNode(nkStaticExpr, info, @[next]) of tkBind: result = newNodeP(nkBind, p) getTok(p) @@ -1014,6 +1052,7 @@ proc parseTypeDesc(p: var TParser): PNode = proc parseTypeDefAux(p: var TParser): PNode = #| typeDefAux = simpleExpr + #| | 'generic' typeClass result = simpleExpr(p, pmTypeDef) proc makeCall(n: PNode): PNode = @@ -1023,17 +1062,54 @@ proc makeCall(n: PNode): PNode = result = newNodeI(nkCall, n.info) result.add n +proc parseMacroColon(p: var TParser, x: PNode): PNode = + #| macroColon = ':' stmt? ( IND{=} 'of' exprList ':' stmt + #| | IND{=} 'elif' expr ':' stmt + #| | IND{=} 'except' exprList ':' stmt + #| | IND{=} 'else' ':' stmt )* + result = x + if p.tok.tokType == tkColon and p.tok.indent < 0: + result = makeCall(result) + getTok(p) + skipComment(p, result) + if p.tok.tokType notin {tkOf, tkElif, tkElse, tkExcept}: + let body = parseStmt(p) + addSon(result, newProcNode(nkDo, body.info, body)) + while sameInd(p): + var b: PNode + case p.tok.tokType + of tkOf: + b = newNodeP(nkOfBranch, p) + exprList(p, tkColon, b) + of tkElif: + b = newNodeP(nkElifBranch, p) + getTok(p) + optInd(p, b) + addSon(b, parseExpr(p)) + eat(p, tkColon) + of tkExcept: + b = newNodeP(nkExceptBranch, p) + exprList(p, tkColon, b) + skipComment(p, b) + of tkElse: + b = newNodeP(nkElse, p) + getTok(p) + eat(p, tkColon) + else: break + addSon(b, parseStmt(p)) + addSon(result, b) + if b.kind == nkElse: break + proc parseExprStmt(p: var TParser): PNode = #| exprStmt = simpleExpr #| (( '=' optInd expr ) #| / ( expr ^+ comma #| doBlocks - #| / ':' stmt? ( IND{=} 'of' exprList ':' stmt - #| | IND{=} 'elif' expr ':' stmt - #| | IND{=} 'except' exprList ':' stmt - #| | IND{=} 'else' ':' stmt )* + #| / macroColon #| ))? + inc p.inPragma var a = simpleExpr(p) + dec p.inPragma if p.tok.tokType == tkEquals: getTok(p) optInd(p, result) @@ -1056,37 +1132,7 @@ proc parseExprStmt(p: var TParser): PNode = result = makeCall(result) parseDoBlocks(p, result) return result - if p.tok.tokType == tkColon and p.tok.indent < 0: - result = makeCall(result) - getTok(p) - skipComment(p, result) - if p.tok.TokType notin {tkOf, tkElif, tkElse, tkExcept}: - let body = parseStmt(p) - addSon(result, newProcNode(nkDo, body.info, body)) - while sameInd(p): - var b: PNode - case p.tok.tokType - of tkOf: - b = newNodeP(nkOfBranch, p) - exprList(p, tkColon, b) - of tkElif: - b = newNodeP(nkElifBranch, p) - getTok(p) - optInd(p, b) - addSon(b, parseExpr(p)) - eat(p, tkColon) - of tkExcept: - b = newNodeP(nkExceptBranch, p) - exprList(p, tkColon, b) - skipComment(p, b) - of tkElse: - b = newNodeP(nkElse, p) - getTok(p) - eat(p, tkColon) - else: break - addSon(b, parseStmt(p)) - addSon(result, b) - if b.kind == nkElse: break + result = parseMacroColon(p, result) proc parseModuleName(p: var TParser, kind: TNodeKind): PNode = result = parseExpr(p) @@ -1169,8 +1215,7 @@ proc parseReturnOrRaise(p: var TParser, kind: TNodeKind): PNode = if p.tok.tokType == tkComment: skipComment(p, result) addSon(result, ast.emptyNode) - elif p.tok.indent >= 0 and p.tok.indent <= p.currInd or - p.tok.tokType == tkEof: + elif p.tok.indent >= 0 and p.tok.indent <= p.currInd or not isExprStart(p): # NL terminates: addSon(result, ast.emptyNode) else: @@ -1378,7 +1423,7 @@ proc parseGenericParamList(p: var TParser): PNode = while p.tok.tokType in {tkSymbol, tkAccent}: var a = parseGenericParam(p) addSon(result, a) - if p.tok.tokType notin {tkComma, tkSemicolon}: break + if p.tok.tokType notin {tkComma, tkSemiColon}: break getTok(p) skipComment(p, a) optPar(p) @@ -1624,10 +1669,26 @@ proc parseObject(p: var TParser): PNode = return addSon(result, parseObjectPart(p)) +proc parseTypeClassParam(p: var TParser): PNode = + if p.tok.tokType == tkVar: + getTok(p) + result = newNode(nkVarTy) + result.addSon(p.parseSymbol) + else: + result = p.parseSymbol + proc parseTypeClass(p: var TParser): PNode = + #| typeClassParam = ('var')? symbol + #| typeClass = typeClassParam ^* ',' (pragma)? ('of' typeDesc ^* ',')? + #| &IND{>} stmt result = newNodeP(nkTypeClassTy, p) getTok(p) - addSon(result, p.parseSymbol) + var args = newNode(nkArgList) + addSon(result, args) + addSon(args, p.parseTypeClassParam) + while p.tok.tokType == tkComma: + getTok(p) + addSon(args, p.parseTypeClassParam) if p.tok.tokType == tkCurlyDotLe and p.validInd: addSon(result, parsePragma(p)) else: @@ -1796,8 +1857,8 @@ proc parseStmt(p: var TParser): PNode = withInd(p): while true: if p.tok.indent == p.currInd: - nil - elif p.tok.tokType == tkSemicolon: + discard + elif p.tok.tokType == tkSemiColon: getTok(p) if p.tok.indent < 0 or p.tok.indent == p.currInd: discard else: break @@ -1805,7 +1866,7 @@ proc parseStmt(p: var TParser): PNode = if p.tok.indent > p.currInd: parMessage(p, errInvalidIndentation) break - if p.tok.toktype in {tkCurlyRi, tkParRi, tkCurlyDotRi, tkBracketRi}: + if p.tok.tokType in {tkCurlyRi, tkParRi, tkCurlyDotRi, tkBracketRi}: # XXX this ensures tnamedparamanonproc still compiles; # deprecate this syntax later break @@ -1823,14 +1884,18 @@ proc parseStmt(p: var TParser): PNode = parMessage(p, errComplexStmtRequiresInd) result = ast.emptyNode else: - result = newNodeP(nkStmtList, p) - while true: - if p.tok.indent >= 0: parMessage(p, errInvalidIndentation) - let a = simpleStmt(p) - if a.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) - result.add(a) - if p.tok.tokType != tkSemicolon: break - getTok(p) + if p.inSemiStmtList > 0: + result = simpleStmt(p) + if result.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) + else: + result = newNodeP(nkStmtList, p) + while true: + if p.tok.indent >= 0: parMessage(p, errInvalidIndentation) + let a = simpleStmt(p) + if a.kind == nkEmpty: parMessage(p, errExprExpected, p.tok) + result.add(a) + if p.tok.tokType != tkSemiColon: break + getTok(p) proc parseAll(p: var TParser): PNode = result = newNodeP(nkStmtList, p) @@ -1849,11 +1914,11 @@ proc parseTopLevelStmt(p: var TParser): PNode = result = ast.emptyNode while true: if p.tok.indent != 0: - if p.firstTok and p.tok.indent < 0: nil + if p.firstTok and p.tok.indent < 0: discard else: parMessage(p, errInvalidIndentation) p.firstTok = false case p.tok.tokType - of tkSemicolon: + of tkSemiColon: getTok(p) if p.tok.indent <= 0: discard else: parMessage(p, errInvalidIndentation) @@ -1864,11 +1929,11 @@ proc parseTopLevelStmt(p: var TParser): PNode = break proc parseString(s: string, filename: string = "", line: int = 0): PNode = - var stream = LLStreamOpen(s) + var stream = llStreamOpen(s) stream.lineOffset = line var parser: TParser - OpenParser(parser, filename, stream) + openParser(parser, filename, stream) result = parser.parseAll - CloseParser(parser) + closeParser(parser) diff --git a/compiler/pas2nim/pas2nim.nim b/compiler/pas2nim/pas2nim.nim index ce5eb5c1a..d10028167 100644 --- a/compiler/pas2nim/pas2nim.nim +++ b/compiler/pas2nim/pas2nim.nim @@ -26,7 +26,7 @@ Options: """ proc main(infile, outfile: string, flags: set[TParserFlag]) = - var stream = LLStreamOpen(infile, fmRead) + var stream = llStreamOpen(infile, fmRead) if stream == nil: rawMessage(errCannotOpenFile, infile) var p: TParser openParser(p, infile, stream, flags) diff --git a/compiler/pas2nim/paslex.nim b/compiler/pas2nim/paslex.nim index 94e664832..67473e71f 100644 --- a/compiler/pas2nim/paslex.nim +++ b/compiler/pas2nim/paslex.nim @@ -78,7 +78,7 @@ type proc getTok*(L: var TLexer, tok: var TToken) -proc PrintTok*(tok: TToken) +proc printTok*(tok: TToken) proc `$`*(tok: TToken): string # implementation @@ -109,17 +109,17 @@ proc getLineInfo*(L: TLexer): TLineInfo = result = newLineInfo(L.filename, L.linenumber, getColNumber(L, L.bufpos)) proc lexMessage*(L: TLexer, msg: TMsgKind, arg = "") = - msgs.GlobalError(getLineInfo(L), msg, arg) + msgs.globalError(getLineInfo(L), msg, arg) proc lexMessagePos(L: var TLexer, msg: TMsgKind, pos: int, arg = "") = var info = newLineInfo(L.filename, L.linenumber, pos - L.lineStart) - msgs.GlobalError(info, msg, arg) + msgs.globalError(info, msg, arg) -proc TokKindToStr*(k: TTokKind): string = +proc tokKindToStr*(k: TTokKind): string = case k of pxEof: result = "[EOF]" of firstKeyword..lastKeyword: - result = keywords[ord(k)-ord(firstKeyword)] + result = Keywords[ord(k)-ord(firstKeyword)] of pxInvalid, pxComment, pxStrLit: result = "string literal" of pxCommand: result = "{@" of pxAmp: result = "{&" @@ -160,9 +160,9 @@ proc `$`(tok: TToken): string = of pxSymbol: result = tok.ident.s of pxIntLit, pxInt64Lit: result = $tok.iNumber of pxFloatLit: result = $tok.fNumber - else: result = TokKindToStr(tok.xkind) + else: result = tokKindToStr(tok.xkind) -proc PrintTok(tok: TToken) = +proc printTok(tok: TToken) = writeln(stdout, $tok) proc setKeyword(L: var TLexer, tok: var TToken) = @@ -177,12 +177,12 @@ proc matchUnderscoreChars(L: var TLexer, tok: var TToken, chars: TCharSet) = while true: if buf[pos] in chars: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) else: break if buf[pos] == '_': add(tok.literal, '_') - Inc(pos) + inc(pos) L.bufPos = pos proc isFloatLiteral(s: string): bool = @@ -199,7 +199,7 @@ proc getNumber2(L: var TLexer, tok: var TToken) = inc(L.bufpos) return tok.base = base2 - var xi: biggestInt = 0 + var xi: BiggestInt = 0 var bits = 0 while true: case L.buf[pos] @@ -221,7 +221,7 @@ proc getNumber2(L: var TLexer, tok: var TToken) = proc getNumber16(L: var TLexer, tok: var TToken) = var pos = L.bufpos + 1 # skip $ tok.base = base16 - var xi: biggestInt = 0 + var xi: BiggestInt = 0 var bits = 0 while true: case L.buf[pos] @@ -261,7 +261,7 @@ proc getNumber10(L: var TLexer, tok: var TToken) = tok.fnumber = parseFloat(tok.literal) tok.xkind = pxFloatLit else: - tok.iNumber = ParseInt(tok.literal) + tok.iNumber = parseInt(tok.literal) if (tok.iNumber < low(int32)) or (tok.iNumber > high(int32)): tok.xkind = pxInt64Lit else: @@ -271,10 +271,10 @@ proc getNumber10(L: var TLexer, tok: var TToken) = except EOverflow: lexMessage(L, errNumberOutOfRange, tok.literal) -proc HandleCRLF(L: var TLexer, pos: int): int = +proc handleCRLF(L: var TLexer, pos: int): int = case L.buf[pos] - of CR: result = nimlexbase.HandleCR(L, pos) - of LF: result = nimlexbase.HandleLF(L, pos) + of CR: result = nimlexbase.handleCR(L, pos) + of LF: result = nimlexbase.handleLF(L, pos) else: result = pos proc getString(L: var TLexer, tok: var TToken) = @@ -319,7 +319,7 @@ proc getString(L: var TLexer, tok: var TToken) = xi = (xi * 10) + (ord(buf[pos]) - ord('0')) inc(pos) else: lexMessage(L, errInvalidCharacterConstant) - if (xi <= 255): add(tok.literal, Chr(xi)) + if (xi <= 255): add(tok.literal, chr(xi)) else: lexMessage(L, errInvalidCharacterConstant) else: break @@ -334,17 +334,17 @@ proc getSymbol(L: var TLexer, tok: var TToken) = var c = buf[pos] case c of 'a'..'z', '0'..'9', '\x80'..'\xFF': - h = h +% Ord(c) + h = h +% ord(c) h = h +% h shl 10 h = h xor (h shr 6) of 'A'..'Z': c = chr(ord(c) + (ord('a') - ord('A'))) # toLower() - h = h +% Ord(c) + h = h +% ord(c) h = h +% h shl 10 h = h xor (h shr 6) of '_': nil else: break - Inc(pos) + inc(pos) h = h +% h shl 3 h = h xor (h shr 11) h = h +% h shl 15 @@ -385,7 +385,7 @@ proc scanCurlyComment(L: var TLexer, tok: var TToken) = while true: case buf[pos] of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf add(tok.literal, "\n#") of '}': @@ -405,7 +405,7 @@ proc scanStarComment(L: var TLexer, tok: var TToken) = while true: case buf[pos] of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf add(tok.literal, "\n#") of '*': @@ -428,9 +428,9 @@ proc skip(L: var TLexer, tok: var TToken) = while true: case buf[pos] of ' ', Tabulator: - Inc(pos) # newline is special: + inc(pos) # newline is special: of CR, LF: - pos = HandleCRLF(L, pos) + pos = handleCRLF(L, pos) buf = L.buf else: break # EndOfFile also leaves the loop @@ -449,7 +449,7 @@ proc getTok(L: var TLexer, tok: var TToken) = case c of ';': tok.xkind = pxSemicolon - Inc(L.bufpos) + inc(L.bufpos) of '/': if L.buf[L.bufpos + 1] == '/': scanLineComment(L, tok) @@ -458,12 +458,12 @@ proc getTok(L: var TLexer, tok: var TToken) = inc(L.bufpos) of ',': tok.xkind = pxComma - Inc(L.bufpos) + inc(L.bufpos) of '(': - Inc(L.bufpos) + inc(L.bufpos) if (L.buf[L.bufPos] == '*'): if (L.buf[L.bufPos + 1] == '$'): - Inc(L.bufpos, 2) + inc(L.bufpos, 2) skip(L, tok) getSymbol(L, tok) tok.xkind = pxStarDirLe @@ -481,12 +481,12 @@ proc getTok(L: var TLexer, tok: var TToken) = tok.xkind = pxStar of ')': tok.xkind = pxParRi - Inc(L.bufpos) + inc(L.bufpos) of '[': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxBracketLe of ']': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxBracketRi of '.': inc(L.bufpos) @@ -496,21 +496,21 @@ proc getTok(L: var TLexer, tok: var TToken) = else: tok.xkind = pxDot of '{': - Inc(L.bufpos) + inc(L.bufpos) case L.buf[L.bufpos] of '$': - Inc(L.bufpos) + inc(L.bufpos) skip(L, tok) getSymbol(L, tok) tok.xkind = pxCurlyDirLe of '&': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxAmp of '%': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxPer of '@': - Inc(L.bufpos) + inc(L.bufpos) tok.xkind = pxCommand else: scanCurlyComment(L, tok) of '+': @@ -554,7 +554,7 @@ proc getTok(L: var TLexer, tok: var TToken) = inc(L.bufpos) of '}': tok.xkind = pxCurlyDirRi - Inc(L.bufpos) + inc(L.bufpos) of '\'', '#': getString(L, tok) of '$': @@ -567,4 +567,4 @@ proc getTok(L: var TLexer, tok: var TToken) = tok.literal = c & "" tok.xkind = pxInvalid lexMessage(L, errInvalidToken, c & " (\\" & $(ord(c)) & ')') - Inc(L.bufpos) + inc(L.bufpos) diff --git a/compiler/pas2nim/pasparse.nim b/compiler/pas2nim/pasparse.nim index 61d57dec3..928896338 100644 --- a/compiler/pas2nim/pasparse.nim +++ b/compiler/pas2nim/pasparse.nim @@ -57,7 +57,7 @@ const ["tbinaryfile", "tfile"], ["strstart", "0"], ["nl", "\"\\n\""], ["tostring", "$"]] -proc ParseUnit*(p: var TParser): PNode +proc parseUnit*(p: var TParser): PNode proc openParser*(p: var TParser, filename: string, inputStream: PLLStream, flags: set[TParserFlag] = {}) proc closeParser*(p: var TParser) @@ -67,20 +67,20 @@ proc fixRecordDef*(n: var PNode) # implementation -proc OpenParser(p: var TParser, filename: string, +proc openParser(p: var TParser, filename: string, inputStream: PLLStream, flags: set[TParserFlag] = {}) = - OpenLexer(p.lex, filename, inputStream) + openLexer(p.lex, filename, inputStream) initIdTable(p.repl) for i in countup(low(stdReplacements), high(stdReplacements)): - IdTablePut(p.repl, getIdent(stdReplacements[i][0]), + idTablePut(p.repl, getIdent(stdReplacements[i][0]), getIdent(stdReplacements[i][1])) if pfMoreReplacements in flags: for i in countup(low(nimReplacements), high(nimReplacements)): - IdTablePut(p.repl, getIdent(nimReplacements[i][0]), + idTablePut(p.repl, getIdent(nimReplacements[i][0]), getIdent(nimReplacements[i][1])) p.flags = flags -proc CloseParser(p: var TParser) = CloseLexer(p.lex) +proc closeParser(p: var TParser) = closeLexer(p.lex) proc getTok(p: var TParser) = getTok(p.lex, p.tok) proc parMessage(p: TParser, msg: TMsgKind, arg = "") = @@ -98,15 +98,15 @@ proc skipCom(p: var TParser, n: PNode) = parMessage(p, warnCommentXIgnored, p.tok.literal) getTok(p) -proc ExpectIdent(p: TParser) = +proc expectIdent(p: TParser) = if p.tok.xkind != pxSymbol: lexMessage(p.lex, errIdentifierExpected, $(p.tok)) -proc Eat(p: var TParser, xkind: TTokKind) = +proc eat(p: var TParser, xkind: TTokKind) = if p.tok.xkind == xkind: getTok(p) - else: lexMessage(p.lex, errTokenExpected, TokKindToStr(xkind)) + else: lexMessage(p.lex, errTokenExpected, tokKindToStr(xkind)) -proc Opt(p: var TParser, xkind: TTokKind) = +proc opt(p: var TParser, xkind: TTokKind) = if p.tok.xkind == xkind: getTok(p) proc newNodeP(kind: TNodeKind, p: TParser): PNode = @@ -131,7 +131,7 @@ proc newIdentNodeP(ident: PIdent, p: TParser): PNode = proc createIdentNodeP(ident: PIdent, p: TParser): PNode = result = newNodeP(nkIdent, p) - var x = PIdent(IdTableGet(p.repl, ident)) + var x = PIdent(idTableGet(p.repl, ident)) if x != nil: result.ident = x else: result.ident = ident @@ -170,7 +170,7 @@ proc parseCommand(p: var TParser, definition: PNode = nil): PNode = getTok(p) eat(p, pxCurlyDirRi) result = parseExpr(p) - if result.kind == nkEmpty: InternalError("emptyNode modified") + if result.kind == nkEmpty: internalError("emptyNode modified") result.kind = nkCurly elif p.tok.ident.id == getIdent("cast").id: getTok(p) @@ -251,7 +251,7 @@ proc bracketExprList(p: var TParser, first: PNode): PNode = getTok(p) break if p.tok.xkind == pxEof: - parMessage(p, errTokenExpected, TokKindToStr(pxBracketRi)) + parMessage(p, errTokenExpected, tokKindToStr(pxBracketRi)) break var a = rangeExpr(p) skipCom(p, a) @@ -281,7 +281,7 @@ proc exprListAux(p: var TParser, elemKind: TNodeKind, getTok(p) break if p.tok.xkind == pxEof: - parMessage(p, errTokenExpected, TokKindToStr(endtok)) + parMessage(p, errTokenExpected, tokKindToStr(endTok)) break var a = exprColonEqExpr(p, elemKind, sepTok) skipCom(p, a) @@ -319,7 +319,7 @@ proc qualifiedIdentListAux(p: var TParser, endTok: TTokKind, getTok(p) break if p.tok.xkind == pxEof: - parMessage(p, errTokenExpected, TokKindToStr(endtok)) + parMessage(p, errTokenExpected, tokKindToStr(endTok)) break var a = qualifiedIdent(p) skipCom(p, a) @@ -584,7 +584,7 @@ proc parseIncludeDir(p: var TParser): PNode = proc definedExprAux(p: var TParser): PNode = result = newNodeP(nkCall, p) addSon(result, newIdentNodeP(getIdent("defined"), p)) - ExpectIdent(p) + expectIdent(p) addSon(result, createIdentNodeP(p.tok.ident, p)) getTok(p) @@ -753,7 +753,7 @@ proc parseCase(p: var TParser): PNode = while (p.tok.xkind != pxEof) and (p.tok.xkind != pxColon): addSon(b, rangeExpr(p)) opt(p, pxComma) - skipcom(p, b) + skipCom(p, b) eat(p, pxColon) skipCom(p, b) addSon(b, parseStmt(p)) @@ -818,7 +818,7 @@ proc parseFor(p: var TParser): PNode = getTok(p) b = parseExpr(p) else: - parMessage(p, errTokenExpected, TokKindToStr(pxTo)) + parMessage(p, errTokenExpected, tokKindToStr(pxTo)) addSon(c, a) addSon(c, b) eat(p, pxDo) @@ -915,7 +915,7 @@ proc parseCallingConvention(p: var TParser): PNode = getTok(p) opt(p, pxSemicolon) else: - nil + discard proc parseRoutineSpecifiers(p: var TParser, noBody: var bool): PNode = var e: PNode @@ -1096,7 +1096,7 @@ proc parseRecordCase(p: var TParser): PNode = while (p.tok.xkind != pxEof) and (p.tok.xkind != pxColon): addSon(b, rangeExpr(p)) opt(p, pxComma) - skipcom(p, b) + skipCom(p, b) eat(p, pxColon) skipCom(p, b) c = newNodeP(nkRecList, p) @@ -1168,7 +1168,7 @@ proc addPragmaToIdent(ident: var PNode, pragma: PNode) = else: pragmasNode = ident.sons[1] if pragmasNode.kind != nkPragma: - InternalError(ident.info, "addPragmaToIdent") + internalError(ident.info, "addPragmaToIdent") addSon(pragmasNode, pragma) proc parseRecordBody(p: var TParser, result, definition: PNode) = @@ -1183,13 +1183,13 @@ proc parseRecordBody(p: var TParser, result, definition: PNode) = if definition != nil: addPragmaToIdent(definition.sons[0], newIdentNodeP(p.tok.ident, p)) else: - InternalError(result.info, "anonymous record is not supported") + internalError(result.info, "anonymous record is not supported") getTok(p) else: - InternalError(result.info, "parseRecordBody") + internalError(result.info, "parseRecordBody") of pxCommand: if definition != nil: addPragmaToIdent(definition.sons[0], parseCommand(p)) - else: InternalError(result.info, "anonymous record is not supported") + else: internalError(result.info, "anonymous record is not supported") else: nil opt(p, pxSemicolon) @@ -1223,7 +1223,7 @@ proc parseTypeDesc(p: var TParser, definition: PNode = nil): PNode = getTok(p) if p.tok.xkind == pxCommand: result = parseCommand(p) - if result.kind != nkTupleTy: InternalError(result.info, "parseTypeDesc") + if result.kind != nkTupleTy: internalError(result.info, "parseTypeDesc") parseRecordBody(p, result, definition) var a = lastSon(result) # embed nkRecList directly into nkTupleTy for i in countup(0, sonsLen(a) - 1): @@ -1237,7 +1237,7 @@ proc parseTypeDesc(p: var TParser, definition: PNode = nil): PNode = if definition != nil: addPragmaToIdent(definition.sons[0], newIdentNodeP(getIdent("final"), p)) else: - InternalError(result.info, "anonymous record is not supported") + internalError(result.info, "anonymous record is not supported") of pxObject: result = parseRecordOrObject(p, nkObjectTy, definition) of pxParLe: result = parseEnum(p) of pxArray: diff --git a/compiler/passaux.nim b/compiler/passaux.nim index 4a85c994c..0ba9f22d0 100644 --- a/compiler/passaux.nim +++ b/compiler/passaux.nim @@ -19,12 +19,12 @@ proc verboseOpen(s: PSym): PPassContext = proc verboseProcess(context: PPassContext, n: PNode): PNode = result = n - if context != nil: InternalError("logpass: context is not nil") + if context != nil: internalError("logpass: context is not nil") if gVerbosity == 3: # system.nim deactivates all hints, for verbosity:3 we want the processing # messages nonetheless, so we activate them again unconditionally: incl(msgs.gNotes, hintProcessing) - Message(n.info, hintProcessing, $idgen.gBackendId) + message(n.info, hintProcessing, $idgen.gBackendId) const verbosePass* = makePass(open = verboseOpen, process = verboseProcess) @@ -34,14 +34,14 @@ proc cleanUp(c: PPassContext, n: PNode): PNode = if optDeadCodeElim in gGlobalOptions or n == nil: return case n.kind of nkStmtList: - for i in countup(0, sonsLen(n) - 1): discard cleanup(c, n.sons[i]) + for i in countup(0, sonsLen(n) - 1): discard cleanUp(c, n.sons[i]) of nkProcDef, nkMethodDef: if n.sons[namePos].kind == nkSym: var s = n.sons[namePos].sym if sfDeadCodeElim notin getModule(s).flags and not astNeeded(s): s.ast.sons[bodyPos] = ast.emptyNode # free the memory else: - nil + discard const cleanupPass* = makePass(process = cleanUp, close = cleanUp) diff --git a/compiler/passes.nim b/compiler/passes.nim index 8d228fe9a..3dc31e7ac 100644 --- a/compiler/passes.nim +++ b/compiler/passes.nim @@ -30,8 +30,8 @@ type TPass* = tuple[open: TPassOpen, openCached: TPassOpenCached, process: TPassProcess, close: TPassClose] - TPassData* = tuple[input: PNode, closeOutput: Pnode] - TPasses* = openarray[TPass] + TPassData* = tuple[input: PNode, closeOutput: PNode] + TPasses* = openArray[TPass] # a pass is a tuple of procedure vars ``TPass.close`` may produce additional # nodes. These are passed to the other close procedures. @@ -169,7 +169,7 @@ proc processModule(module: PSym, stream: PLLStream, rd: PRodReader) = openPasses(a, module) if stream == nil: let filename = fileIdx.toFullPath - s = LLStreamOpen(filename, fmRead) + s = llStreamOpen(filename, fmRead) if s == nil: rawMessage(errCannotOpenFile, filename) return @@ -195,7 +195,7 @@ proc processModule(module: PSym, stream: PLLStream, rd: PRodReader) = if s.kind != llsStdIn: break closePasses(a) # id synchronization point for more consistent code generation: - IDsynchronizationPoint(1000) + idSynchronizationPoint(1000) else: openPassesCached(a, module, rd) var n = loadInitSection(rd) diff --git a/compiler/patterns.nim b/compiler/patterns.nim index b7792100f..d262790ab 100644 --- a/compiler/patterns.nim +++ b/compiler/patterns.nim @@ -40,7 +40,7 @@ proc canonKind(n: PNode): TNodeKind = of nkCallKinds: result = nkCall of nkStrLit..nkTripleStrLit: result = nkStrLit of nkFastAsgn: result = nkAsgn - else: nil + else: discard proc sameKinds(a, b: PNode): bool {.inline.} = result = a.kind == b.kind or a.canonKind == b.canonKind @@ -87,22 +87,22 @@ proc matchChoice(c: PPatternContext, p, n: PNode): bool = if matches(c, p.sons[i], n): return true proc bindOrCheck(c: PPatternContext, param: PSym, n: PNode): bool = - var pp = GetLazy(c, param) + var pp = getLazy(c, param) if pp != nil: # check if we got the same pattern (already unified): result = sameTrees(pp, n) #matches(c, pp, n) elif n.kind == nkArgList or checkTypes(c, param, n): - PutLazy(c, param, n) + putLazy(c, param, n) result = true proc gather(c: PPatternContext, param: PSym, n: PNode) = - var pp = GetLazy(c, param) + var pp = getLazy(c, param) if pp != nil and pp.kind == nkArgList: pp.add(n) else: pp = newNodeI(nkArgList, n.info, 1) pp.sons[0] = n - PutLazy(c, param, pp) + putLazy(c, param, pp) proc matchNested(c: PPatternContext, p, n: PNode, rpn: bool): bool = # match ``op * param`` or ``op *| param`` @@ -148,7 +148,7 @@ proc matches(c: PPatternContext, p, n: PNode): bool = of "*": result = matchNested(c, p, n, rpn=false) of "**": result = matchNested(c, p, n, rpn=true) of "~": result = not matches(c, p.sons[1], n) - else: InternalError(p.info, "invalid pattern") + else: internalError(p.info, "invalid pattern") # template {add(a, `&` * b)}(a: string{noalias}, b: varargs[string]) = # add(a, b) elif p.kind == nkCurlyExpr: @@ -256,7 +256,7 @@ proc applyRule*(c: PContext, s: PSym, n: PNode): PNode = args = newNodeI(nkArgList, n.info) for i in 1 .. < params.len: let param = params.sons[i].sym - let x = GetLazy(ctx, param) + let x = getLazy(ctx, param) # couldn't bind parameter: if isNil(x): return nil result.add(x) @@ -267,7 +267,7 @@ proc applyRule*(c: PContext, s: PSym, n: PNode): PNode = var rs = result.sons[i] let param = params.sons[i].sym case whichAlias(param) - of aqNone: nil + of aqNone: discard of aqShouldAlias: # it suffices that it aliases for sure with *some* other param: var ok = false diff --git a/compiler/pbraces.nim b/compiler/pbraces.nim index a944fe0ab..ce6e0d9a9 100644 --- a/compiler/pbraces.nim +++ b/compiler/pbraces.nim @@ -10,7 +10,7 @@ import llstream, lexer, parser, idents, strutils, ast, msgs -proc ParseAll*(p: var TParser): PNode = +proc parseAll*(p: var TParser): PNode = result = nil proc parseTopLevelStmt*(p: var TParser): PNode = diff --git a/compiler/platform.nim b/compiler/platform.nim index 59091b690..2e78d4fc5 100644 --- a/compiler/platform.nim +++ b/compiler/platform.nim @@ -185,13 +185,13 @@ var targetCPU*, hostCPU*: TSystemCPU targetOS*, hostOS*: TSystemOS -proc NameToOS*(name: string): TSystemOS -proc NameToCPU*(name: string): TSystemCPU +proc nameToOS*(name: string): TSystemOS +proc nameToCPU*(name: string): TSystemCPU var - IntSize*: int + intSize*: int floatSize*: int - PtrSize*: int + ptrSize*: int tnl*: string # target newline proc setTarget*(o: TSystemOS, c: TSystemCPU) = @@ -200,18 +200,18 @@ proc setTarget*(o: TSystemOS, c: TSystemCPU) = #echo "new Target: OS: ", o, " CPU: ", c targetCPU = c targetOS = o - intSize = cpu[c].intSize div 8 - floatSize = cpu[c].floatSize div 8 - ptrSize = cpu[c].bit div 8 - tnl = os[o].newLine + intSize = CPU[c].intSize div 8 + floatSize = CPU[c].floatSize div 8 + ptrSize = CPU[c].bit div 8 + tnl = OS[o].newLine -proc NameToOS(name: string): TSystemOS = +proc nameToOS(name: string): TSystemOS = for i in countup(succ(osNone), high(TSystemOS)): if cmpIgnoreStyle(name, OS[i].name) == 0: return i result = osNone -proc NameToCPU(name: string): TSystemCPU = +proc nameToCPU(name: string): TSystemCPU = for i in countup(succ(cpuNone), high(TSystemCPU)): if cmpIgnoreStyle(name, CPU[i].name) == 0: return i diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 8c2425de3..d9ed50cfe 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -20,48 +20,49 @@ const const procPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, - wMagic, wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, - wCompilerProc, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge, + wMagic, wNosideeffect, wSideeffect, wNoreturn, wDynlib, wHeader, + wCompilerproc, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge, wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC, wNoStackFrame, wError, wDiscardable, wNoInit, wDestructor, wCodegenDecl, - wGenSym, wInject, wRaises, wTags, wOperator, wDelegator} + wGensym, wInject, wRaises, wTags, wOperator, wDelegator} converterPragmas* = procPragmas methodPragmas* = procPragmas - templatePragmas* = {wImmediate, wDeprecated, wError, wGenSym, wInject, wDirty, + templatePragmas* = {wImmediate, wDeprecated, wError, wGensym, wInject, wDirty, wDelegator} macroPragmas* = {FirstCallConv..LastCallConv, wImmediate, wImportc, wExportc, - wNodecl, wMagic, wNosideEffect, wCompilerProc, wDeprecated, wExtern, - wImportcpp, wImportobjc, wError, wDiscardable, wGenSym, wInject, wDelegator} - iteratorPragmas* = {FirstCallConv..LastCallConv, wNosideEffect, wSideEffect, + wNodecl, wMagic, wNosideeffect, wCompilerproc, wDeprecated, wExtern, + wImportCpp, wImportObjC, wError, wDiscardable, wGensym, wInject, wDelegator} + iteratorPragmas* = {FirstCallConv..LastCallConv, wNosideeffect, wSideeffect, wImportc, wExportc, wNodecl, wMagic, wDeprecated, wBorrow, wExtern, - wImportcpp, wImportobjc, wError, wDiscardable, wGenSym, wInject, wRaises, + wImportCpp, wImportObjC, wError, wDiscardable, wGensym, wInject, wRaises, wTags, wOperator} exprPragmas* = {wLine} stmtPragmas* = {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, wWatchpoint, wPassL, wPassC, wDeadCodeElim, wDeprecated, - wFloatChecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, - wLinearScanEnd, wPatterns, wEffects, wNoForward, wComputedGoto} + wFatal, wDefine, wUndef, wCompile, wLink, wLinksys, wPure, wPush, wPop, + wBreakpoint, wWatchPoint, wPassl, wPassc, wDeadCodeElim, wDeprecated, + wFloatchecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, + wLinearScanEnd, wPatterns, wEffects, wNoForward, wComputedGoto, + wInjectStmt} lambdaPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, - wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, - wDeprecated, wExtern, wThread, wImportcpp, wImportobjc, wNoStackFrame, + wNosideeffect, wSideeffect, wNoreturn, wDynlib, wHeader, + wDeprecated, wExtern, wThread, wImportCpp, wImportObjC, wNoStackFrame, wRaises, wTags} typePragmas* = {wImportc, wExportc, wDeprecated, wMagic, wAcyclic, wNodecl, - wPure, wHeader, wCompilerProc, wFinal, wSize, wExtern, wShallow, - wImportcpp, wImportobjc, wError, wIncompleteStruct, wByCopy, wByRef, - wInheritable, wGenSym, wInject, wRequiresInit} + wPure, wHeader, wCompilerproc, wFinal, wSize, wExtern, wShallow, + wImportCpp, wImportObjC, wError, wIncompleteStruct, wByCopy, wByRef, + wInheritable, wGensym, wInject, wRequiresInit} fieldPragmas* = {wImportc, wExportc, wDeprecated, wExtern, - wImportcpp, wImportobjc, wError} + wImportCpp, wImportObjC, wError} varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl, - wMagic, wHeader, wDeprecated, wCompilerProc, wDynLib, wExtern, - wImportcpp, wImportobjc, wError, wNoInit, wCompileTime, wGlobal, - wGenSym, wInject, wCodegenDecl} + wMagic, wHeader, wDeprecated, wCompilerproc, wDynlib, wExtern, + wImportCpp, wImportObjC, wError, wNoInit, wCompileTime, wGlobal, + wGensym, wInject, wCodegenDecl} constPragmas* = {wImportc, wExportc, wHeader, wDeprecated, wMagic, wNodecl, - wExtern, wImportcpp, wImportobjc, wError, wGenSym, wInject} + wExtern, wImportCpp, wImportObjC, wError, wGensym, wInject} letPragmas* = varPragmas - procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideEffect, + procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideeffect, wThread, wRaises, wTags} allRoutinePragmas* = procPragmas + iteratorPragmas + lambdaPragmas @@ -69,7 +70,7 @@ proc pragma*(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) # implementation proc invalidPragma(n: PNode) = - LocalError(n.info, errInvalidPragmaX, renderTree(n, {renderNoComments})) + localError(n.info, errInvalidPragmaX, renderTree(n, {renderNoComments})) proc pragmaAsm*(c: PContext, n: PNode): char = result = '\0' @@ -91,12 +92,12 @@ proc setExternName(s: PSym, extname: string) = # note that '{.importc.}' is transformed into '{.importc: "$1".}' s.loc.flags.incl(lfFullExternalName) -proc MakeExternImport(s: PSym, extname: string) = +proc makeExternImport(s: PSym, extname: string) = setExternName(s, extname) incl(s.flags, sfImportc) excl(s.flags, sfForward) -proc MakeExternExport(s: PSym, extname: string) = +proc makeExternExport(s: PSym, extname: string) = setExternName(s, extname) incl(s.flags, sfExportc) @@ -124,7 +125,7 @@ proc newEmptyStrNode(n: PNode): PNode {.noinline.} = proc getStrLitNode(c: PContext, n: PNode): PNode = if n.kind != nkExprColonExpr: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) # error correction: result = newEmptyStrNode(n) else: @@ -132,7 +133,7 @@ proc getStrLitNode(c: PContext, n: PNode): PNode = case n.sons[1].kind of nkStrLit, nkRStrLit, nkTripleStrLit: result = n.sons[1] else: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) # error correction: result = newEmptyStrNode(n) @@ -141,12 +142,12 @@ proc expectStrLit(c: PContext, n: PNode): string = proc expectIntLit(c: PContext, n: PNode): int = if n.kind != nkExprColonExpr: - LocalError(n.info, errIntLiteralExpected) + localError(n.info, errIntLiteralExpected) else: n.sons[1] = c.semConstExpr(c, n.sons[1]) case n.sons[1].kind of nkIntLit..nkInt64Lit: result = int(n.sons[1].intVal) - else: LocalError(n.info, errIntLiteralExpected) + else: localError(n.info, errIntLiteralExpected) proc getOptionalStr(c: PContext, n: PNode, defaultStr: string): string = if n.kind == nkExprColonExpr: result = expectStrLit(c, n) @@ -159,7 +160,7 @@ proc processMagic(c: PContext, n: PNode, s: PSym) = #if sfSystemModule notin c.module.flags: # liMessage(n.info, errMagicOnlyInSystem) if n.kind != nkExprColonExpr: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) return var v: string if n.sons[1].kind == nkIdent: v = n.sons[1].ident.s @@ -168,57 +169,57 @@ proc processMagic(c: PContext, n: PNode, s: PSym) = if substr($m, 1) == v: s.magic = m break - if s.magic == mNone: Message(n.info, warnUnknownMagic, v) + if s.magic == mNone: message(n.info, warnUnknownMagic, v) proc wordToCallConv(sw: TSpecialWord): TCallingConvention = # this assumes that the order of special words and calling conventions is # the same result = TCallingConvention(ord(ccDefault) + ord(sw) - ord(wNimcall)) -proc IsTurnedOn(c: PContext, n: PNode): bool = +proc isTurnedOn(c: PContext, n: PNode): bool = if n.kind == nkExprColonExpr: let x = c.semConstBoolExpr(c, n.sons[1]) n.sons[1] = x if x.kind == nkIntLit: return x.intVal != 0 - LocalError(n.info, errOnOrOffExpected) + localError(n.info, errOnOrOffExpected) proc onOff(c: PContext, n: PNode, op: TOptions) = - if IsTurnedOn(c, n): gOptions = gOptions + op + if isTurnedOn(c, n): gOptions = gOptions + op else: gOptions = gOptions - op proc pragmaDeadCodeElim(c: PContext, n: PNode) = - if IsTurnedOn(c, n): incl(c.module.flags, sfDeadCodeElim) + if isTurnedOn(c, n): incl(c.module.flags, sfDeadCodeElim) else: excl(c.module.flags, sfDeadCodeElim) proc pragmaNoForward(c: PContext, n: PNode) = - if IsTurnedOn(c, n): incl(c.module.flags, sfNoForward) + if isTurnedOn(c, n): incl(c.module.flags, sfNoForward) else: excl(c.module.flags, sfNoForward) proc processCallConv(c: PContext, n: PNode) = if (n.kind == nkExprColonExpr) and (n.sons[1].kind == nkIdent): var sw = whichKeyword(n.sons[1].ident) case sw - of firstCallConv..lastCallConv: + of FirstCallConv..LastCallConv: POptionEntry(c.optionStack.tail).defaultCC = wordToCallConv(sw) - else: LocalError(n.info, errCallConvExpected) + else: localError(n.info, errCallConvExpected) else: - LocalError(n.info, errCallConvExpected) + localError(n.info, errCallConvExpected) proc getLib(c: PContext, kind: TLibKind, path: PNode): PLib = var it = PLib(c.libs.head) while it != nil: if it.kind == kind: - if trees.ExprStructuralEquivalent(it.path, path): return it + if trees.exprStructuralEquivalent(it.path, path): return it it = PLib(it.next) result = newLib(kind) result.path = path - Append(c.libs, result) + append(c.libs, result) if path.kind in {nkStrLit..nkTripleStrLit}: - result.isOverriden = options.isDynLibOverride(path.strVal) + result.isOverriden = options.isDynlibOverride(path.strVal) proc expectDynlibNode(c: PContext, n: PNode): PNode = if n.kind != nkExprColonExpr: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) # error correction: result = newEmptyStrNode(n) else: @@ -228,7 +229,7 @@ proc expectDynlibNode(c: PContext, n: PNode): PNode = if result.kind == nkSym and result.sym.kind == skConst: result = result.sym.ast # look it up if result.typ == nil or result.typ.kind notin {tyPointer, tyString, tyProc}: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) result = newEmptyStrNode(n) proc processDynLib(c: PContext, n: PNode, sym: PSym) = @@ -246,7 +247,7 @@ proc processDynLib(c: PContext, n: PNode, sym: PSym) = # since we'll be loading the dynlib symbols dynamically, we must use # a calling convention that doesn't introduce custom name mangling # cdecl is the default - the user can override this explicitly - if sym.kind in RoutineKinds and sym.typ != nil and + if sym.kind in routineKinds and sym.typ != nil and sym.typ.callConv == ccDefault: sym.typ.callConv = ccCDecl @@ -264,7 +265,7 @@ proc processNote(c: PContext, n: PNode) = of wWarning: var x = findStr(msgs.WarningsToStr, n.sons[0].sons[1].ident.s) if x >= 0: nk = TNoteKind(x + ord(warnMin)) - else: InvalidPragma(n); return + else: invalidPragma(n); return else: invalidPragma(n) return @@ -283,27 +284,27 @@ proc processOption(c: PContext, n: PNode): bool = else: var sw = whichKeyword(n.sons[0].ident) case sw - of wChecks: OnOff(c, n, checksOptions) - of wObjChecks: OnOff(c, n, {optObjCheck}) - of wFieldchecks: OnOff(c, n, {optFieldCheck}) - of wRangechecks: OnOff(c, n, {optRangeCheck}) - of wBoundchecks: OnOff(c, n, {optBoundsCheck}) - of wOverflowchecks: OnOff(c, n, {optOverflowCheck}) - of wNilchecks: OnOff(c, n, {optNilCheck}) - of wFloatChecks: OnOff(c, n, {optNanCheck, optInfCheck}) - of wNaNchecks: OnOff(c, n, {optNanCheck}) - of wInfChecks: OnOff(c, n, {optInfCheck}) - of wAssertions: OnOff(c, n, {optAssert}) - of wWarnings: OnOff(c, n, {optWarns}) - of wHints: OnOff(c, n, {optHints}) - of wCallConv: processCallConv(c, n) - of wLinedir: OnOff(c, n, {optLineDir}) - of wStacktrace: OnOff(c, n, {optStackTrace}) - of wLinetrace: OnOff(c, n, {optLineTrace}) - of wDebugger: OnOff(c, n, {optEndb}) - of wProfiler: OnOff(c, n, {optProfiler}) - of wByRef: OnOff(c, n, {optByRef}) - of wDynLib: processDynLib(c, n, nil) + of wChecks: onOff(c, n, ChecksOptions) + of wObjChecks: onOff(c, n, {optObjCheck}) + of wFieldChecks: onOff(c, n, {optFieldCheck}) + of wRangechecks: onOff(c, n, {optRangeCheck}) + of wBoundchecks: onOff(c, n, {optBoundsCheck}) + of wOverflowchecks: onOff(c, n, {optOverflowCheck}) + of wNilchecks: onOff(c, n, {optNilCheck}) + of wFloatchecks: onOff(c, n, {optNaNCheck, optInfCheck}) + of wNanChecks: onOff(c, n, {optNaNCheck}) + of wInfChecks: onOff(c, n, {optInfCheck}) + of wAssertions: onOff(c, n, {optAssert}) + of wWarnings: onOff(c, n, {optWarns}) + of wHints: onOff(c, n, {optHints}) + of wCallconv: processCallConv(c, n) + of wLinedir: onOff(c, n, {optLineDir}) + of wStacktrace: onOff(c, n, {optStackTrace}) + of wLinetrace: onOff(c, n, {optLineTrace}) + of wDebugger: onOff(c, n, {optEndb}) + of wProfiler: onOff(c, n, {optProfiler}) + of wByRef: onOff(c, n, {optByRef}) + of wDynlib: processDynLib(c, n, nil) of wOptimization: if n.sons[1].kind != nkIdent: invalidPragma(n) @@ -318,14 +319,14 @@ proc processOption(c: PContext, n: PNode): bool = of "none": excl(gOptions, optOptimizeSpeed) excl(gOptions, optOptimizeSize) - else: LocalError(n.info, errNoneSpeedOrSizeExpected) - of wImplicitStatic: OnOff(c, n, {optImplicitStatic}) - of wPatterns: OnOff(c, n, {optPatterns}) + else: localError(n.info, errNoneSpeedOrSizeExpected) + of wImplicitStatic: onOff(c, n, {optImplicitStatic}) + of wPatterns: onOff(c, n, {optPatterns}) else: result = true proc processPush(c: PContext, n: PNode, start: int) = if n.sons[start-1].kind == nkExprColonExpr: - LocalError(n.info, errGenerated, "':' after 'push' not supported") + localError(n.info, errGenerated, "':' after 'push' not supported") var x = newOptionEntry() var y = POptionEntry(c.optionStack.tail) x.options = gOptions @@ -343,7 +344,7 @@ proc processPush(c: PContext, n: PNode, start: int) = proc processPop(c: PContext, n: PNode) = if c.optionStack.counter <= 1: - LocalError(n.info, errAtPopWithoutPush) + localError(n.info, errAtPopWithoutPush) else: gOptions = POptionEntry(c.optionStack.tail).options gNotes = POptionEntry(c.optionStack.tail).notes @@ -351,15 +352,15 @@ proc processPop(c: PContext, n: PNode) = proc processDefine(c: PContext, n: PNode) = if (n.kind == nkExprColonExpr) and (n.sons[1].kind == nkIdent): - DefineSymbol(n.sons[1].ident.s) - Message(n.info, warnDeprecated, "define") + defineSymbol(n.sons[1].ident.s) + message(n.info, warnDeprecated, "define") else: invalidPragma(n) proc processUndef(c: PContext, n: PNode) = if (n.kind == nkExprColonExpr) and (n.sons[1].kind == nkIdent): - UndefSymbol(n.sons[1].ident.s) - Message(n.info, warnDeprecated, "undef") + undefSymbol(n.sons[1].ident.s) + message(n.info, warnDeprecated, "undef") else: invalidPragma(n) @@ -371,13 +372,13 @@ proc processCompile(c: PContext, n: PNode) = var s = expectStrLit(c, n) var found = findFile(s) if found == "": found = s - var trunc = ChangeFileExt(found, "") + var trunc = changeFileExt(found, "") extccomp.addExternalFileToCompile(found) extccomp.addFileToLink(completeCFilePath(trunc, false)) proc processCommonLink(c: PContext, n: PNode, feature: TLinkFeature) = var f = expectStrLit(c, n) - if splitFile(f).ext == "": f = addFileExt(f, cc[ccompiler].objExt) + if splitFile(f).ext == "": f = addFileExt(f, CC[cCompiler].objExt) var found = findFile(f) if found == "": found = f # use the default case feature @@ -386,16 +387,16 @@ proc processCommonLink(c: PContext, n: PNode, feature: TLinkFeature) = extccomp.addFileToLink(libpath / completeCFilePath(found, false)) else: internalError(n.info, "processCommonLink") -proc PragmaBreakpoint(c: PContext, n: PNode) = +proc pragmaBreakpoint(c: PContext, n: PNode) = discard getOptionalStr(c, n, "") -proc PragmaCheckpoint(c: PContext, n: PNode) = +proc pragmaCheckpoint(c: PContext, n: PNode) = # checkpoints can be used to debug the compiler; they are not documented var info = n.info inc(info.line) # next line is affected! msgs.addCheckpoint(info) -proc PragmaWatchpoint(c: PContext, n: PNode) = +proc pragmaWatchpoint(c: PContext, n: PNode) = if n.kind == nkExprColonExpr: n.sons[1] = c.semExpr(c, n.sons[1]) else: @@ -407,7 +408,7 @@ proc semAsmOrEmit*(con: PContext, n: PNode, marker: char): PNode = result = newNode(if n.kind == nkAsmStmt: nkAsmStmt else: nkArgList, n.info) var str = n.sons[1].strVal if str == "": - LocalError(n.info, errEmptyAsm) + localError(n.info, errEmptyAsm) return # now parse the string literal and substitute symbols: var a = 0 @@ -430,14 +431,14 @@ proc semAsmOrEmit*(con: PContext, n: PNode, marker: char): PNode = a = c + 1 else: illFormedAst(n) -proc PragmaEmit(c: PContext, n: PNode) = +proc pragmaEmit(c: PContext, n: PNode) = discard getStrLitNode(c, n) n.sons[1] = semAsmOrEmit(c, n, '`') proc noVal(n: PNode) = if n.kind == nkExprColonExpr: invalidPragma(n) -proc PragmaUnroll(c: PContext, n: PNode) = +proc pragmaUnroll(c: PContext, n: PNode) = if c.p.nestedLoopCounter <= 0: invalidPragma(n) elif n.kind == nkExprColonExpr: @@ -447,7 +448,7 @@ proc PragmaUnroll(c: PContext, n: PNode) = else: invalidPragma(n) -proc PragmaLine(c: PContext, n: PNode) = +proc pragmaLine(c: PContext, n: PNode) = if n.kind == nkExprColonExpr: n.sons[1] = c.semConstExpr(c, n.sons[1]) let a = n.sons[1] @@ -457,14 +458,14 @@ proc PragmaLine(c: PContext, n: PNode) = if x.kind == nkExprColonExpr: x = x.sons[1] if y.kind == nkExprColonExpr: y = y.sons[1] if x.kind != nkStrLit: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) elif y.kind != nkIntLit: - LocalError(n.info, errIntLiteralExpected) + localError(n.info, errIntLiteralExpected) else: n.info.fileIndex = msgs.fileInfoIdx(x.strVal) n.info.line = int16(y.intVal) else: - LocalError(n.info, errXExpected, "tuple") + localError(n.info, errXExpected, "tuple") else: # sensible default: n.info = getInfoContext(-1) @@ -475,11 +476,11 @@ proc processPragma(c: PContext, n: PNode, i: int) = elif it.sons[0].kind != nkIdent: invalidPragma(n) elif it.sons[1].kind != nkIdent: invalidPragma(n) - var userPragma = NewSym(skTemplate, it.sons[1].ident, nil, it.info) + var userPragma = newSym(skTemplate, it.sons[1].ident, nil, it.info) var body = newNodeI(nkPragma, n.info) for j in i+1 .. sonsLen(n)-1: addSon(body, n.sons[j]) userPragma.ast = body - StrTableAdd(c.userPragmas, userPragma) + strTableAdd(c.userPragmas, userPragma) proc pragmaRaisesOrTags(c: PContext, n: PNode) = proc processExc(c: PContext, x: PNode) = @@ -502,13 +503,13 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, var it = n.sons[i] var key = if it.kind == nkExprColonExpr: it.sons[0] else: it if key.kind == nkIdent: - var userPragma = StrTableGet(c.userPragmas, key.ident) + var userPragma = strTableGet(c.userPragmas, key.ident) if userPragma != nil: - inc c.InstCounter - if c.InstCounter > 100: - GlobalError(it.info, errRecursiveDependencyX, userPragma.name.s) + inc c.instCounter + if c.instCounter > 100: + globalError(it.info, errRecursiveDependencyX, userPragma.name.s) pragma(c, sym, userPragma.ast, validPragmas) - dec c.InstCounter + dec c.instCounter else: var k = whichKeyword(key.ident) if k in validPragmas: @@ -533,20 +534,20 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, of wAlign: if sym.typ == nil: invalidPragma(it) var align = expectIntLit(c, it) - if not IsPowerOfTwo(align) and align != 0: - LocalError(it.info, errPowerOfTwoExpected) + if not isPowerOfTwo(align) and align != 0: + localError(it.info, errPowerOfTwoExpected) else: sym.typ.align = align of wSize: if sym.typ == nil: invalidPragma(it) var size = expectIntLit(c, it) - if not IsPowerOfTwo(size) or size <= 0 or size > 8: - LocalError(it.info, errPowerOfTwoExpected) + if not isPowerOfTwo(size) or size <= 0 or size > 8: + localError(it.info, errPowerOfTwoExpected) else: sym.typ.size = size of wNodecl: noVal(it) - incl(sym.loc.Flags, lfNoDecl) + incl(sym.loc.flags, lfNoDecl) of wPure, wNoStackFrame: noVal(it) if sym != nil: incl(sym.flags, sfPure) @@ -565,20 +566,20 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, of wCompileTime: noVal(it) incl(sym.flags, sfCompileTime) - incl(sym.loc.Flags, lfNoDecl) + incl(sym.loc.flags, lfNoDecl) of wGlobal: noVal(it) incl(sym.flags, sfGlobal) incl(sym.flags, sfPure) of wMerge: - noval(it) + noVal(it) incl(sym.flags, sfMerge) of wHeader: var lib = getLib(c, libHeader, getStrLitNode(c, it)) addToLib(lib, sym) incl(sym.flags, sfImportc) incl(sym.loc.flags, lfHeader) - incl(sym.loc.Flags, lfNoDecl) + incl(sym.loc.flags, lfNoDecl) # implies nodecl, because otherwise header would not make sense if sym.loc.r == nil: sym.loc.r = toRope(sym.name.s) of wDestructor: @@ -590,23 +591,23 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, noVal(it) incl(sym.flags, sfNoSideEffect) if sym.typ != nil: incl(sym.typ.flags, tfNoSideEffect) - of wSideEffect: + of wSideeffect: noVal(it) incl(sym.flags, sfSideEffect) - of wNoReturn: + of wNoreturn: noVal(it) incl(sym.flags, sfNoReturn) - of wDynLib: + of wDynlib: processDynLib(c, it, sym) - of wCompilerProc: + of wCompilerproc: noVal(it) # compilerproc may not get a string! makeExternExport(sym, "$1") incl(sym.flags, sfCompilerProc) incl(sym.flags, sfUsed) # suppress all those stupid warnings registerCompilerProc(sym) - of wProcvar: + of wProcVar: noVal(it) - incl(sym.flags, sfProcVar) + incl(sym.flags, sfProcvar) of wDeprecated: noVal(it) if sym != nil: incl(sym.flags, sfDeprecated) @@ -637,10 +638,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, of wThread: noVal(it) incl(sym.flags, sfThread) - incl(sym.flags, sfProcVar) + incl(sym.flags, sfProcvar) if sym.typ != nil: incl(sym.typ.flags, tfThread) - of wHint: Message(it.info, hintUser, expectStrLit(c, it)) - of wWarning: Message(it.info, warnUser, expectStrLit(c, it)) + of wHint: message(it.info, hintUser, expectStrLit(c, it)) + of wWarning: message(it.info, warnUser, expectStrLit(c, it)) of wError: if sym != nil and sym.isRoutine: # This is subtle but correct: the error *statement* is only @@ -650,17 +651,17 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, noVal(it) incl(sym.flags, sfError) else: - LocalError(it.info, errUser, expectStrLit(c, it)) - of wFatal: Fatal(it.info, errUser, expectStrLit(c, it)) + localError(it.info, errUser, expectStrLit(c, it)) + of wFatal: fatal(it.info, errUser, expectStrLit(c, it)) of wDefine: processDefine(c, it) of wUndef: processUndef(c, it) of wCompile: processCompile(c, it) of wLink: processCommonLink(c, it, linkNormal) - of wLinkSys: processCommonLink(c, it, linkSys) - of wPassL: extccomp.addLinkOption(expectStrLit(c, it)) - of wPassC: extccomp.addCompileOption(expectStrLit(c, it)) - of wBreakpoint: PragmaBreakpoint(c, it) - of wWatchpoint: PragmaWatchpoint(c, it) + of wLinksys: processCommonLink(c, it, linkSys) + of wPassl: extccomp.addLinkOption(expectStrLit(c, it)) + of wPassc: extccomp.addCompileOption(expectStrLit(c, it)) + of wBreakpoint: pragmaBreakpoint(c, it) + of wWatchPoint: pragmaWatchpoint(c, it) of wPush: processPush(c, n, i + 1) result = true @@ -678,18 +679,18 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, of wChecks, wObjChecks, wFieldChecks, wRangechecks, wBoundchecks, wOverflowchecks, wNilchecks, wAssertions, wWarnings, wHints, wLinedir, wStacktrace, wLinetrace, wOptimization, - wCallConv, - wDebugger, wProfiler, wFloatChecks, wNanChecks, wInfChecks, + wCallconv, + wDebugger, wProfiler, wFloatchecks, wNanChecks, wInfChecks, wPatterns: if processOption(c, it): # calling conventions (boring...): - LocalError(it.info, errOptionExpected) - of firstCallConv..lastCallConv: + localError(it.info, errOptionExpected) + of FirstCallConv..LastCallConv: assert(sym != nil) if sym.typ == nil: invalidPragma(it) else: sym.typ.callConv = wordToCallConv(k) - of wEmit: PragmaEmit(c, it) - of wUnroll: PragmaUnroll(c, it) + of wEmit: pragmaEmit(c, it) + of wUnroll: pragmaUnroll(c, it) of wLinearScanEnd, wComputedGoto: noVal(it) of wEffects: # is later processed in effect analysis: @@ -705,23 +706,28 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, of wByRef: noVal(it) if sym == nil or sym.typ == nil: - if processOption(c, it): LocalError(it.info, errOptionExpected) + if processOption(c, it): localError(it.info, errOptionExpected) else: incl(sym.typ.flags, tfByRef) of wByCopy: noVal(it) if sym.kind != skType or sym.typ == nil: invalidPragma(it) else: incl(sym.typ.flags, tfByCopy) - of wInject, wGenSym: + of wInject, wGensym: # We check for errors, but do nothing with these pragmas otherwise # as they are handled directly in 'evalTemplate'. noVal(it) if sym == nil: invalidPragma(it) - of wLine: PragmaLine(c, it) + of wLine: pragmaLine(c, it) of wRaises, wTags: pragmaRaisesOrTags(c, it) of wOperator: if sym == nil: invalidPragma(it) else: sym.position = expectIntLit(c, it) + of wInjectStmt: + if it.kind != nkExprColonExpr: + localError(it.info, errExprExpected) + else: + it.sons[1] = c.semExpr(c, it.sons[1]) else: invalidPragma(it) else: invalidPragma(it) else: processNote(c, it) @@ -729,18 +735,18 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, proc implictPragmas*(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) = if sym != nil and sym.kind != skModule: - var it = POptionEntry(c.optionstack.head) + var it = POptionEntry(c.optionStack.head) while it != nil: let o = it.otherPragmas if not o.isNil: for i in countup(0, sonsLen(o) - 1): if singlePragma(c, sym, o, i, validPragmas): - InternalError(n.info, "implicitPragmas") + internalError(n.info, "implicitPragmas") it = it.next.POptionEntry if lfExportLib in sym.loc.flags and sfExportc notin sym.flags: - LocalError(n.info, errDynlibRequiresExportc) - var lib = POptionEntry(c.optionstack.tail).dynlib + localError(n.info, errDynlibRequiresExportc) + var lib = POptionEntry(c.optionStack.tail).dynlib if {lfDynamicLib, lfHeader} * sym.loc.flags == {} and sfImportc in sym.flags and lib != nil: incl(sym.loc.flags, lfDynamicLib) diff --git a/compiler/pretty.nim b/compiler/pretty.nim index 5036a16a3..3a5bfe197 100644 --- a/compiler/pretty.nim +++ b/compiler/pretty.nim @@ -12,12 +12,12 @@ import strutils, os, options, ast, astalgo, msgs, ropes, idents, passes, - intsets, strtabs + intsets, strtabs, semdata const removeTP = false # when true, "nimrod pretty" converts TTyp to Typ. -type +type TGen = object of TPassContext module*: PSym PGen = ref TGen @@ -29,6 +29,7 @@ type var gSourceFiles: seq[TSourceFile] = @[] + gCheckExtern: bool rules: PStringTable proc loadFile(info: TLineInfo) = @@ -44,13 +45,20 @@ proc loadFile(info: TLineInfo) = gSourceFiles[i].lines.add(line) proc overwriteFiles*() = + let overWrite = options.getConfigVar("pretty.overwrite").normalize == "on" + let doStrip = options.getConfigVar("pretty.strip").normalize == "on" for i in 0 .. high(gSourceFiles): if not gSourceFiles[i].dirty: continue - let newFile = gSourceFiles[i].fullpath.changeFileExt(".pretty.nim") + let newFile = if overWrite: gSourceFiles[i].fullpath + else: gSourceFiles[i].fullpath.changeFileExt(".pretty.nim") try: var f = open(newFile, fmWrite) for line in gSourceFiles[i].lines: - f.writeln(line) + if doStrip: + f.write line.strip(leading = false, trailing = true) + else: + f.write line + f.write("\L") f.close except EIO: rawMessage(errCannotOpenFile, newFile) @@ -60,18 +68,25 @@ proc `=~`(s: string, a: openArray[string]): bool = if s.startsWith(x): return true proc beautifyName(s: string, k: TSymKind): string = + # minimal set of rules here for transition: + # GC_ is allowed + + let allUpper = allCharsInSet(s, {'A'..'Z', '0'..'9', '_'}) + if allUpper and k in {skConst, skEnumField, skType}: return s result = newStringOfCap(s.len) var i = 0 case k of skType, skGenericParam: - # skip leading 'T' + # Types should start with a capital unless builtins like 'int' etc.: when removeTP: if s[0] == 'T' and s[1] in {'A'..'Z'}: i = 1 if s =~ ["int", "uint", "cint", "cuint", "clong", "cstring", "string", "char", "byte", "bool", "openArray", "seq", "array", "void", "pointer", "float", "csize", "cdouble", "cchar", "cschar", - "cshort", "cu"]: + "cshort", "cu", "nil", "expr", "stmt", "typedesc", "auto", "any", + "range", "openarray", "varargs", "set", "cfloat" + ]: result.add s[i] else: result.add toUpper(s[i]) @@ -81,13 +96,19 @@ proc beautifyName(s: string, k: TSymKind): string = else: # as a special rule, don't transform 'L' to 'l' if s.len == 1 and s[0] == 'L': result.add 'L' + elif '_' in s: result.add(s[i]) else: result.add toLower(s[0]) inc i - let allUpper = allCharsInSet(s, {'A'..'Z', '0'..'9', '_'}) while i < s.len: if s[i] == '_': - inc i - result.add toUpper(s[i]) + if i > 0 and s[i-1] in {'A'..'Z'}: + # don't skip '_' as it's essential for e.g. 'GC_disable' + result.add('_') + inc i + result.add s[i] + else: + inc i + result.add toUpper(s[i]) elif allUpper: result.add toLower(s[i]) else: @@ -97,8 +118,7 @@ proc beautifyName(s: string, k: TSymKind): string = proc checkStyle*(info: TLineInfo, s: string, k: TSymKind) = let beau = beautifyName(s, k) if s != beau: - Message(info, errGenerated, - "name does not adhere to naming convention; should be: " & beau) + message(info, errGenerated, "name should be: " & beau) const Letters = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF', '_'} @@ -117,13 +137,90 @@ proc differ(line: string, a, b: int, x: string): bool = inc j return false -var cannotRename = initIntSet() +proc checkDef*(n: PNode; s: PSym) = + # operators stay as they are: + if s.kind in {skResult, skTemp} or s.name.s[0] notin Letters: return + if s.kind in {skType, skGenericParam} and sfAnon in s.flags: return -proc processSym(c: PPassContext, n: PNode): PNode = - result = n - var g = PGen(c) - case n.kind - of nkSym: + if {sfImportc, sfExportc} * s.flags == {} or gCheckExtern: + checkStyle(n.info, s.name.s, s.kind) + +proc checkDef(c: PGen; n: PNode) = + if n.kind != nkSym: return + checkDef(n, n.sym) + +proc checkUse*(n: PNode, s: PSym) = + if n.info.fileIndex < 0: return + # we simply convert it to what it looks like in the definition + # for consistency + + # operators stay as they are: + if s.kind in {skResult, skTemp} or s.name.s[0] notin Letters: return + if s.kind in {skType, skGenericParam} and sfAnon in s.flags: return + let newName = s.name.s + + loadFile(n.info) + + let line = gSourceFiles[n.info.fileIndex].lines[n.info.line-1] + var first = min(n.info.col.int, line.len) + if first < 0: return + #inc first, skipIgnoreCase(line, "proc ", first) + while first > 0 and line[first-1] in Letters: dec first + if first < 0: return + if line[first] == '`': inc first + + let last = first+identLen(line, first)-1 + if differ(line, first, last, newName): + # last-first+1 != newName.len or + var x = line.substr(0, first-1) & newName & line.substr(last+1) + when removeTP: + # the WinAPI module is full of 'TX = X' which after the substitution + # becomes 'X = X'. We remove those lines: + if x.match(peg"\s* {\ident} \s* '=' \s* y$1 ('#' .*)?"): + x = "" + + system.shallowCopy(gSourceFiles[n.info.fileIndex].lines[n.info.line-1], x) + gSourceFiles[n.info.fileIndex].dirty = true + +when false: + var cannotRename = initIntSet() + + proc beautifyName(s: string, k: TSymKind): string = + let allUpper = allCharsInSet(s, {'A'..'Z', '0'..'9', '_'}) + result = newStringOfCap(s.len) + var i = 0 + case k + of skType, skGenericParam: + # skip leading 'T' + when removeTP: + if s[0] == 'T' and s[1] in {'A'..'Z'}: + i = 1 + if s =~ ["int", "uint", "cint", "cuint", "clong", "cstring", "string", + "char", "byte", "bool", "openArray", "seq", "array", "void", + "pointer", "float", "csize", "cdouble", "cchar", "cschar", + "cshort", "cu"]: + result.add s[i] + else: + result.add toUpper(s[i]) + of skConst, skEnumField: + # for 'const' we keep how it's spelt; either upper case or lower case: + result.add s[0] + else: + # as a special rule, don't transform 'L' to 'l' + if s.len == 1 and s[0] == 'L': result.add 'L' + else: result.add toLower(s[0]) + inc i + while i < s.len: + if s[i] == '_': + inc i + result.add toUpper(s[i]) + elif allUpper: + result.add toLower(s[i]) + else: + result.add s[i] + inc i + + proc checkUse(c: PGen; n: PNode) = if n.info.fileIndex < 0: return let s = n.sym # operators stay as they are: @@ -138,10 +235,11 @@ proc processSym(c: PPassContext, n: PNode): PNode = loadFile(n.info) let line = gSourceFiles[n.info.fileIndex].lines[n.info.line-1] - var first = n.info.col.int + var first = min(n.info.col.int, line.len) if first < 0: return #inc first, skipIgnoreCase(line, "proc ", first) while first > 0 and line[first-1] in Letters: dec first + if first < 0: return if line[first] == '`': inc first if {sfImportc, sfExportc} * s.flags != {}: @@ -149,8 +247,8 @@ proc processSym(c: PPassContext, n: PNode): PNode = # name: if newName != s.name.s and newName != s.loc.r.ropeToStr and lfFullExternalName notin s.loc.flags: - Message(n.info, errGenerated, - "cannot rename $# to $# due to external name" % [s.name.s, newName]) + #Message(n.info, errGenerated, + # "cannot rename $# to $# due to external name" % [s.name.s, newName]) cannotRename.incl(s.id) return let last = first+identLen(line, first)-1 @@ -165,14 +263,50 @@ proc processSym(c: PPassContext, n: PNode): PNode = system.shallowCopy(gSourceFiles[n.info.fileIndex].lines[n.info.line-1], x) gSourceFiles[n.info.fileIndex].dirty = true + +proc check(c: PGen, n: PNode) = + case n.kind + of nkSym: checkUse(n, n.sym) + of nkBlockStmt, nkBlockExpr, nkBlockType: + checkDef(c, n[0]) + check(c, n.sons[1]) + of nkForStmt, nkParForStmt: + let L = n.len + for i in countup(0, L-3): + checkDef(c, n[i]) + check(c, n[L-2]) + check(c, n[L-1]) + of nkProcDef, nkLambdaKinds, nkMethodDef, nkIteratorDef, nkTemplateDef, + nkMacroDef, nkConverterDef: + checkDef(c, n[namePos]) + for i in namePos+1 .. <n.len: check(c, n.sons[i]) + of nkIdentDefs, nkVarTuple: + let a = n + checkMinSonsLen(a, 3) + let L = len(a) + for j in countup(0, L-3): checkDef(c, a.sons[j]) + check(c, a.sons[L-2]) + check(c, a.sons[L-1]) + of nkTypeSection, nkConstSection: + for i in countup(0, sonsLen(n) - 1): + let a = n.sons[i] + if a.kind == nkCommentStmt: continue + checkSonsLen(a, 3) + checkDef(c, a.sons[0]) + check(c, a.sons[1]) + check(c, a.sons[2]) else: - for i in 0 .. <n.safeLen: - discard processSym(c, n.sons[i]) + for i in 0 .. <n.safeLen: check(c, n.sons[i]) + +proc processSym(c: PPassContext, n: PNode): PNode = + result = n + check(PGen(c), n) proc myOpen(module: PSym): PPassContext = var g: PGen new(g) g.module = module + gCheckExtern = options.getConfigVar("pretty.checkextern").normalize == "on" result = g if rules.isNil: rules = newStringTable(modeStyleInsensitive) diff --git a/compiler/procfind.nim b/compiler/procfind.nim index aefccd140..0354d585d 100644 --- a/compiler/procfind.nim +++ b/compiler/procfind.nim @@ -17,52 +17,76 @@ proc equalGenericParams(procA, procB: PNode): bool = if sonsLen(procA) != sonsLen(procB): return for i in countup(0, sonsLen(procA) - 1): if procA.sons[i].kind != nkSym: - InternalError(procA.info, "equalGenericParams") + internalError(procA.info, "equalGenericParams") return if procB.sons[i].kind != nkSym: - InternalError(procB.info, "equalGenericParams") + internalError(procB.info, "equalGenericParams") return let a = procA.sons[i].sym let b = procB.sons[i].sym if a.name.id != b.name.id or - not sameTypeOrNil(a.typ, b.typ, {TypeDescExactMatch}): return + not sameTypeOrNil(a.typ, b.typ, {ExactTypeDescValues}): return if a.ast != nil and b.ast != nil: - if not ExprStructuralEquivalent(a.ast, b.ast): return + if not exprStructuralEquivalent(a.ast, b.ast): return result = true -proc SearchForProc*(c: PContext, scope: PScope, fn: PSym): PSym = +proc searchForProcOld*(c: PContext, scope: PScope, fn: PSym): PSym = # Searchs for a forward declaration or a "twin" symbol of fn # in the symbol table. If the parameter lists are exactly # the same the sym in the symbol table is returned, else nil. var it: TIdentIter - result = initIdentIter(it, scope.symbols, fn.Name) + result = initIdentIter(it, scope.symbols, fn.name) if isGenericRoutine(fn): # we simply check the AST; this is imprecise but nearly the best what # can be done; this doesn't work either though as type constraints are # not kept in the AST .. while result != nil: - if result.Kind == fn.kind and isGenericRoutine(result): + if result.kind == fn.kind and isGenericRoutine(result): let genR = result.ast.sons[genericParamsPos] let genF = fn.ast.sons[genericParamsPos] - if ExprStructuralEquivalent(genR, genF) and - ExprStructuralEquivalent(result.ast.sons[paramsPos], + if exprStructuralEquivalent(genR, genF) and + exprStructuralEquivalent(result.ast.sons[paramsPos], fn.ast.sons[paramsPos]) and equalGenericParams(genR, genF): return - result = NextIdentIter(it, scope.symbols) + result = nextIdentIter(it, scope.symbols) else: while result != nil: - if result.Kind == fn.kind and not isGenericRoutine(result): + if result.kind == fn.kind and not isGenericRoutine(result): case equalParams(result.typ.n, fn.typ.n) of paramsEqual: return of paramsIncompatible: - LocalError(fn.info, errNotOverloadable, fn.name.s) + localError(fn.info, errNotOverloadable, fn.name.s) return of paramsNotEqual: - nil - result = NextIdentIter(it, scope.symbols) + discard + result = nextIdentIter(it, scope.symbols) +proc searchForProcNew(c: PContext, scope: PScope, fn: PSym): PSym = + const flags = {ExactGenericParams, ExactTypeDescValues, + ExactConstraints, IgnoreCC} + + var it: TIdentIter + result = initIdentIter(it, scope.symbols, fn.name) + while result != nil: + if result.kind in skProcKinds and + sameType(result.typ, fn.typ, flags): return + + result = nextIdentIter(it, scope.symbols) + + return nil + +proc searchForProc*(c: PContext, scope: PScope, fn: PSym): PSym = + result = searchForProcNew(c, scope, fn) + when false: + let old = searchForProcOld(c, scope, fn) + if old != result: + echo "Mismatch in searchForProc: ", fn.info + debug fn.typ + debug if result != nil: result.typ else: nil + debug if old != nil: old.typ else: nil + when false: proc paramsFitBorrow(child, parent: PNode): bool = var length = sonsLen(child) @@ -77,7 +101,7 @@ when false: dcEqOrDistinctOf): return result = true - proc SearchForBorrowProc*(c: PContext, startScope: PScope, fn: PSym): PSym = + proc searchForBorrowProc*(c: PContext, startScope: PScope, fn: PSym): PSym = # Searchs for the fn in the symbol table. If the parameter lists are suitable # for borrowing the sym in the symbol table is returned, else nil. var it: TIdentIter diff --git a/compiler/renderer.nim b/compiler/renderer.nim index f6fb0f8c0..1afb5961e 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -62,7 +62,7 @@ const MaxLineLen = 80 LineCommentColumn = 30 -proc InitSrcGen(g: var TSrcGen, renderFlags: TRenderFlags) = +proc initSrcGen(g: var TSrcGen, renderFlags: TRenderFlags) = g.comStack = @[] g.tokens = @[] g.indent = 0 @@ -76,7 +76,7 @@ proc InitSrcGen(g: var TSrcGen, renderFlags: TRenderFlags) = proc addTok(g: var TSrcGen, kind: TTokType, s: string) = var length = len(g.tokens) - setlen(g.tokens, length + 1) + setLen(g.tokens, length + 1) g.tokens[length].kind = kind g.tokens[length].length = int16(len(s)) add(g.buf, s) @@ -104,16 +104,16 @@ proc optNL(g: var TSrcGen) = optNL(g, g.indent) proc indentNL(g: var TSrcGen) = - inc(g.indent, indentWidth) + inc(g.indent, IndentWidth) g.pendingNL = g.indent g.lineLen = g.indent -proc Dedent(g: var TSrcGen) = - dec(g.indent, indentWidth) +proc dedent(g: var TSrcGen) = + dec(g.indent, IndentWidth) assert(g.indent >= 0) - if g.pendingNL > indentWidth: - Dec(g.pendingNL, indentWidth) - Dec(g.lineLen, indentWidth) + if g.pendingNL > IndentWidth: + dec(g.pendingNL, IndentWidth) + dec(g.lineLen, IndentWidth) proc put(g: var TSrcGen, kind: TTokType, s: string) = addPendingNL(g) @@ -127,7 +127,7 @@ proc putLong(g: var TSrcGen, kind: TTokType, s: string, lineLen: int) = addTok(g, kind, s) g.lineLen = lineLen -proc toNimChar(c: Char): string = +proc toNimChar(c: char): string = case c of '\0': result = "\\0" of '\x01'..'\x1F', '\x80'..'\xFF': result = "\\x" & strutils.toHex(ord(c), 2) @@ -236,19 +236,19 @@ proc containsNL(s: string): bool = of '\x0D', '\x0A': return true else: - nil + discard result = false proc pushCom(g: var TSrcGen, n: PNode) = var length = len(g.comStack) - setlen(g.comStack, length + 1) + setLen(g.comStack, length + 1) g.comStack[length] = n proc popAllComs(g: var TSrcGen) = - setlen(g.comStack, 0) + setLen(g.comStack, 0) proc popCom(g: var TSrcGen) = - setlen(g.comStack, len(g.comStack) - 1) + setLen(g.comStack, len(g.comStack) - 1) const Space = " " @@ -269,7 +269,7 @@ proc gcom(g: var TSrcGen, n: PNode) = if (g.pendingNL < 0) and (len(g.buf) > 0) and (g.lineLen < LineCommentColumn): var ml = maxLineLength(n.comment) - if ml + LineCommentColumn <= maxLineLen: + if ml + LineCommentColumn <= MaxLineLen: put(g, tkSpaces, repeatChar(LineCommentColumn - g.lineLen)) putComment(g, n.comment) #assert(g.comStack[high(g.comStack)] = n); @@ -278,7 +278,7 @@ proc gcoms(g: var TSrcGen) = popAllComs(g) proc lsub(n: PNode): int -proc litAux(n: PNode, x: biggestInt, size: int): string = +proc litAux(n: PNode, x: BiggestInt, size: int): string = proc skip(t: PType): PType = result = t while result.kind in {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal, @@ -295,7 +295,7 @@ proc litAux(n: PNode, x: biggestInt, size: int): string = elif nfBase16 in n.flags: result = "0x" & toHex(x, size * 2) else: result = $x -proc ulitAux(n: PNode, x: biggestInt, size: int): string = +proc ulitAux(n: PNode, x: BiggestInt, size: int): string = if nfBase2 in n.flags: result = "0b" & toBin(x, size * 8) elif nfBase8 in n.flags: result = "0o" & toOct(x, size * 3) elif nfBase16 in n.flags: result = "0x" & toHex(x, size * 2) @@ -341,7 +341,7 @@ proc atom(n: PNode): string = if (n.typ != nil) and (n.typ.sym != nil): result = n.typ.sym.name.s else: result = "[type node]" else: - InternalError("rnimsyn.atom " & $n.kind) + internalError("rnimsyn.atom " & $n.kind) result = "" proc lcomma(n: PNode, start: int = 0, theEnd: int = - 1): int = @@ -361,11 +361,11 @@ proc lsons(n: PNode, start: int = 0, theEnd: int = - 1): int = proc lsub(n: PNode): int = # computes the length of a tree if isNil(n): return 0 - if n.comment != nil: return maxLineLen + 1 + if n.comment != nil: return MaxLineLen + 1 case n.kind of nkEmpty: result = 0 of nkTripleStrLit: - if containsNL(n.strVal): result = maxLineLen + 1 + if containsNL(n.strVal): result = MaxLineLen + 1 else: result = len(atom(n)) of succ(nkEmpty)..pred(nkTripleStrLit), succ(nkTripleStrLit)..nkNilLit: result = len(atom(n)) @@ -421,10 +421,13 @@ proc lsub(n: PNode): int = of nkElifExpr: result = lsons(n) + len("_elif_:_") of nkElseExpr: result = lsub(n.sons[0]) + len("_else:_") # type descriptions of nkTypeOfExpr: result = lsub(n.sons[0]) + len("type_") - of nkRefTy: result = lsub(n.sons[0]) + len("ref_") - of nkPtrTy: result = lsub(n.sons[0]) + len("ptr_") - of nkVarTy: result = lsub(n.sons[0]) + len("var_") - of nkDistinctTy: result = lsub(n.sons[0]) + len("Distinct_") + of nkRefTy: result = (if n.len > 0: lsub(n.sons[0])+1 else: 0) + len("ref") + of nkPtrTy: result = (if n.len > 0: lsub(n.sons[0])+1 else: 0) + len("ptr") + of nkVarTy: result = (if n.len > 0: lsub(n.sons[0])+1 else: 0) + len("var") + of nkDistinctTy: result = (if n.len > 0: lsub(n.sons[0])+1 else: 0) + + len("Distinct") + of nkStaticTy: result = (if n.len > 0: lsub(n.sons[0]) else: 0) + + len("static[]") of nkTypeDef: result = lsons(n) + 3 of nkOfInherit: result = lsub(n.sons[0]) + len("of_") of nkProcTy: result = lsons(n) + len("proc_") @@ -437,7 +440,7 @@ proc lsub(n: PNode): int = result = len("enum") of nkEnumFieldDef: result = lsons(n) + 3 of nkVarSection, nkLetSection: - if sonsLen(n) > 1: result = maxLineLen + 1 + if sonsLen(n) > 1: result = MaxLineLen + 1 else: result = lsons(n) + len("var_") of nkReturnStmt: result = lsub(n.sons[0]) + len("return_") of nkRaiseStmt: result = lsub(n.sons[0]) + len("raise_") @@ -458,10 +461,10 @@ proc lsub(n: PNode): int = if n.sons[0].kind != nkEmpty: result = result + lsub(n.sons[0]) + 2 of nkExceptBranch: result = lcomma(n, 0, -2) + lsub(lastSon(n)) + len("except_:_") - else: result = maxLineLen + 1 + else: result = MaxLineLen + 1 proc fits(g: TSrcGen, x: int): bool = - result = x + g.lineLen <= maxLineLen + result = x + g.lineLen <= MaxLineLen type TSubFlag = enum @@ -486,7 +489,7 @@ proc hasCom(n: PNode): bool = result = false if n.comment != nil: return true case n.kind - of nkEmpty..nkNilLit: nil + of nkEmpty..nkNilLit: discard else: for i in countup(0, sonsLen(n) - 1): if hasCom(n.sons[i]): return true @@ -500,7 +503,7 @@ proc gcommaAux(g: var TSrcGen, n: PNode, ind: int, start: int = 0, for i in countup(start, sonsLen(n) + theEnd): var c = i < sonsLen(n) + theEnd var sublen = lsub(n.sons[i]) + ord(c) - if not fits(g, sublen) and (ind + sublen < maxLineLen): optNL(g, ind) + if not fits(g, sublen) and (ind + sublen < MaxLineLen): optNL(g, ind) let oldLen = g.tokens.len gsub(g, n.sons[i]) if c: @@ -514,21 +517,21 @@ proc gcomma(g: var TSrcGen, n: PNode, c: TContext, start: int = 0, theEnd: int = - 1) = var ind: int if rfInConstExpr in c.flags: - ind = g.indent + indentWidth + ind = g.indent + IndentWidth else: ind = g.lineLen - if ind > maxLineLen div 2: ind = g.indent + longIndentWid + if ind > MaxLineLen div 2: ind = g.indent + longIndentWid gcommaAux(g, n, ind, start, theEnd) proc gcomma(g: var TSrcGen, n: PNode, start: int = 0, theEnd: int = - 1) = var ind = g.lineLen - if ind > maxLineLen div 2: ind = g.indent + longIndentWid + if ind > MaxLineLen div 2: ind = g.indent + longIndentWid gcommaAux(g, n, ind, start, theEnd) proc gsemicolon(g: var TSrcGen, n: PNode, start: int = 0, theEnd: int = - 1) = var ind = g.lineLen - if ind > maxLineLen div 2: ind = g.indent + longIndentWid - gcommaAux(g, n, ind, start, theEnd, tkSemicolon) + if ind > MaxLineLen div 2: ind = g.indent + longIndentWid + gcommaAux(g, n, ind, start, theEnd, tkSemiColon) proc gsons(g: var TSrcGen, n: PNode, c: TContext, start: int = 0, theEnd: int = - 1) = @@ -551,13 +554,13 @@ proc longMode(n: PNode, start: int = 0, theEnd: int = - 1): bool = if not result: # check further for i in countup(start, sonsLen(n) + theEnd): - if (lsub(n.sons[i]) > maxLineLen): + if (lsub(n.sons[i]) > MaxLineLen): result = true break proc gstmts(g: var TSrcGen, n: PNode, c: TContext) = if n.kind == nkEmpty: return - if (n.kind == nkStmtList) or (n.kind == nkStmtListExpr): + if n.kind in {nkStmtList, nkStmtListExpr, nkStmtListType}: indentNL(g) for i in countup(0, sonsLen(n) - 1): optNL(g) @@ -576,7 +579,7 @@ proc gif(g: var TSrcGen, n: PNode) = gsub(g, n.sons[0].sons[0]) initContext(c) putWithSpace(g, tkColon, ":") - if longMode(n) or (lsub(n.sons[0].sons[1]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[0].sons[1]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # a good place for comments gstmts(g, n.sons[0].sons[1], c) @@ -591,7 +594,7 @@ proc gwhile(g: var TSrcGen, n: PNode) = gsub(g, n.sons[0]) putWithSpace(g, tkColon, ":") initContext(c) - if longMode(n) or (lsub(n.sons[1]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[1]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # a good place for comments gstmts(g, n.sons[1], c) @@ -600,7 +603,7 @@ proc gpattern(g: var TSrcGen, n: PNode) = var c: TContext put(g, tkCurlyLe, "{") initContext(c) - if longMode(n) or (lsub(n.sons[0]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[0]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # a good place for comments gstmts(g, n.sons[0], c) @@ -611,7 +614,7 @@ proc gpragmaBlock(g: var TSrcGen, n: PNode) = gsub(g, n.sons[0]) putWithSpace(g, tkColon, ":") initContext(c) - if longMode(n) or (lsub(n.sons[1]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[1]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # a good place for comments gstmts(g, n.sons[1], c) @@ -621,7 +624,7 @@ proc gtry(g: var TSrcGen, n: PNode) = put(g, tkTry, "try") putWithSpace(g, tkColon, ":") initContext(c) - if longMode(n) or (lsub(n.sons[0]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[0]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # a good place for comments gstmts(g, n.sons[0], c) @@ -634,7 +637,7 @@ proc gfor(g: var TSrcGen, n: PNode) = initContext(c) if longMode(n) or (lsub(n.sons[length - 1]) + lsub(n.sons[length - 2]) + 6 + g.lineLen > - maxLineLen): + MaxLineLen): incl(c.flags, rfLongMode) gcomma(g, n, c, 0, - 3) put(g, tkSpaces, Space) @@ -649,7 +652,7 @@ proc gmacro(g: var TSrcGen, n: PNode) = initContext(c) gsub(g, n.sons[0]) putWithSpace(g, tkColon, ":") - if longMode(n) or (lsub(n.sons[1]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[1]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) gsons(g, n, c, 1) @@ -700,6 +703,19 @@ proc gproc(g: var TSrcGen, n: PNode) = gcoms(g) dedent(g) +proc gTypeClassTy(g: var TSrcGen, n: PNode) = + var c: TContext + initContext(c) + putWithSpace(g, tkGeneric, "generic") + gsons(g, n[0], c) # arglist + gsub(g, n[1]) # pragmas + gsub(g, n[2]) # of + gcoms(g) + indentNL(g) + gcoms(g) + gstmts(g, n[3], c) + dedent(g) + proc gblock(g: var TSrcGen, n: PNode) = var c: TContext initContext(c) @@ -709,7 +725,7 @@ proc gblock(g: var TSrcGen, n: PNode) = else: put(g, tkBlock, "block") putWithSpace(g, tkColon, ":") - if longMode(n) or (lsub(n.sons[1]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[1]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # XXX I don't get why this is needed here! gstmts should already handle this! @@ -722,7 +738,7 @@ proc gstaticStmt(g: var TSrcGen, n: PNode) = putWithSpace(g, tkStatic, "static") putWithSpace(g, tkColon, ":") initContext(c) - if longMode(n) or (lsub(n.sons[0]) + g.lineLen > maxLineLen): + if longMode(n) or (lsub(n.sons[0]) + g.lineLen > MaxLineLen): incl(c.flags, rfLongMode) gcoms(g) # a good place for comments gstmts(g, n.sons[0], c) @@ -768,7 +784,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = if n.comment != nil: pushCom(g, n) case n.kind # atoms: of nkTripleStrLit: putRawStr(g, tkTripleStrLit, n.strVal) - of nkEmpty: nil + of nkEmpty: discard of nkType: put(g, tkInvalid, atom(n)) of nkSym, nkIdent: gident(g, n) of nkIntLit: put(g, tkIntLit, atom(n)) @@ -816,7 +832,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = put(g, tkParRi, ")") of nkStaticExpr: put(g, tkStatic, "static") - put(g, tkSpaces, space) + put(g, tkSpaces, Space) gsub(g, n.sons[0]) of nkBracketExpr: gsub(g, n.sons[0]) @@ -833,7 +849,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = gcomma(g, n, 1) of nkCommand: gsub(g, n.sons[0]) - put(g, tkSpaces, space) + put(g, tkSpaces, Space) gcomma(g, n, 1) of nkExprEqExpr, nkAsgn, nkFastAsgn: gsub(g, n.sons[0]) @@ -940,7 +956,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = of nkPrefix: gsub(g, n.sons[0]) if n.len > 1: - put(g, tkSpaces, space) + put(g, tkSpaces, Space) if n.sons[1].kind == nkInfix: put(g, tkParLe, "(") gsub(g, n.sons[1]) @@ -1053,6 +1069,12 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = gsub(g, n.sons[0]) else: put(g, tkShared, "shared") + of nkStaticTy: + put(g, tkStatic, "static") + put(g, tkBracketLe, "[") + if n.len > 0: + gsub(g, n.sons[0]) + put(g, tkBracketRi, "]") of nkEnumTy: if sonsLen(n) > 0: putWithSpace(g, tkEnum, "enum") @@ -1069,7 +1091,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = put(g, tkSpaces, Space) putWithSpace(g, tkEquals, "=") gsub(g, n.sons[1]) - of nkStmtList, nkStmtListExpr: gstmts(g, n, emptyContext) + of nkStmtList, nkStmtListExpr, nkStmtListType: gstmts(g, n, emptyContext) of nkIfStmt: putWithSpace(g, tkIf, "if") gif(g, n) @@ -1246,9 +1268,20 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = put(g, tkBracketLe, "[") gcomma(g, n) put(g, tkBracketRi, "]") + of nkMetaNode: + put(g, tkParLe, "(META|") + gsub(g, n.sons[0]) + put(g, tkParRi, ")") + of nkGotoState, nkState: + var c: TContext + initContext c + putWithSpace g, tkSymbol, if n.kind == nkState: "state" else: "goto" + gsons(g, n, c) + of nkTypeClassTy: + gTypeClassTy(g, n) else: - #nkNone, nkMetaNode, nkExplicitTypeListCall: - InternalError(n.info, "rnimsyn.gsub(" & $n.kind & ')') + #nkNone, nkExplicitTypeListCall: + internalError(n.info, "rnimsyn.gsub(" & $n.kind & ')') proc renderTree(n: PNode, renderFlags: TRenderFlags = {}): string = var g: TSrcGen @@ -1259,7 +1292,7 @@ proc renderTree(n: PNode, renderFlags: TRenderFlags = {}): string = proc renderModule(n: PNode, filename: string, renderFlags: TRenderFlags = {}) = var - f: tfile + f: TFile g: TSrcGen initSrcGen(g, renderFlags) for i in countup(0, sonsLen(n) - 1): @@ -1268,7 +1301,7 @@ proc renderModule(n: PNode, filename: string, case n.sons[i].kind of nkTypeSection, nkConstSection, nkVarSection, nkLetSection, nkCommentStmt: putNL(g) - else: nil + else: discard gcoms(g) if optStdout in gGlobalOptions: write(stdout, g.buf) diff --git a/compiler/rodread.nim b/compiler/rodread.nim index 6e6b83260..b53135a95 100644 --- a/compiler/rodread.nim +++ b/compiler/rodread.nim @@ -184,7 +184,7 @@ proc skipNode(r: PRodReader) = if par == 0: break dec par of '(': inc par - else: nil + else: discard inc pos r.pos = pos+1 # skip ')' @@ -248,7 +248,7 @@ proc decodeNodeLazyBody(r: PRodReader, fInfo: TLineInfo, if r.s[r.pos] == ')': inc(r.pos) else: internalError(result.info, "decodeNode: ')' missing") else: - InternalError(fInfo, "decodeNode: '(' missing " & $r.pos) + internalError(fInfo, "decodeNode: '(' missing " & $r.pos) proc decodeNode(r: PRodReader, fInfo: TLineInfo): PNode = result = decodeNodeLazyBody(r, fInfo, nil) @@ -286,7 +286,7 @@ proc decodeLoc(r: PRodReader, loc: var TLoc, info: TLineInfo) = else: loc.a = 0 if r.s[r.pos] == '>': inc(r.pos) - else: InternalError(info, "decodeLoc " & r.s[r.pos]) + else: internalError(info, "decodeLoc " & r.s[r.pos]) proc decodeType(r: PRodReader, info: TLineInfo): PType = result = nil @@ -303,10 +303,10 @@ proc decodeType(r: PRodReader, info: TLineInfo): PType = setId(result.id) if debugIds: registerID(result) else: - InternalError(info, "decodeType: no id") + internalError(info, "decodeType: no id") # here this also avoids endless recursion for recursive type - IdTablePut(gTypeTable, result, result) - if r.s[r.pos] == '(': result.n = decodeNode(r, UnknownLineInfo()) + idTablePut(gTypeTable, result, result) + if r.s[r.pos] == '(': result.n = decodeNode(r, unknownLineInfo()) if r.s[r.pos] == '$': inc(r.pos) result.flags = cast[TTypeFlags](int32(decodeVInt(r.s, r.pos))) @@ -335,7 +335,7 @@ proc decodeType(r: PRodReader, info: TLineInfo): PType = if r.s[r.pos] == '(': inc(r.pos) if r.s[r.pos] == ')': inc(r.pos) - else: InternalError(info, "decodeType ^(" & r.s[r.pos]) + else: internalError(info, "decodeType ^(" & r.s[r.pos]) rawAddSon(result, nil) else: var d = decodeVInt(r.s, r.pos) @@ -347,10 +347,10 @@ proc decodeLib(r: PRodReader, info: TLineInfo): PLib = new(result) inc(r.pos) result.kind = TLibKind(decodeVInt(r.s, r.pos)) - if r.s[r.pos] != '|': InternalError("decodeLib: 1") + if r.s[r.pos] != '|': internalError("decodeLib: 1") inc(r.pos) result.name = toRope(decodeStr(r.s, r.pos)) - if r.s[r.pos] != '|': InternalError("decodeLib: 2") + if r.s[r.pos] != '|': internalError("decodeLib: 2") inc(r.pos) result.path = decodeNode(r, info) @@ -370,21 +370,21 @@ proc decodeSym(r: PRodReader, info: TLineInfo): PSym = id = decodeVInt(r.s, r.pos) setId(id) else: - InternalError(info, "decodeSym: no id") + internalError(info, "decodeSym: no id") if r.s[r.pos] == '&': inc(r.pos) ident = getIdent(decodeStr(r.s, r.pos)) else: - InternalError(info, "decodeSym: no ident") + internalError(info, "decodeSym: no ident") #echo "decoding: {", ident.s - result = PSym(IdTableGet(r.syms, id)) + result = PSym(idTableGet(r.syms, id)) if result == nil: new(result) result.id = id - IdTablePut(r.syms, result, result) + idTablePut(r.syms, result, result) if debugIds: registerID(result) elif result.id != id: - InternalError(info, "decodeSym: wrong id") + internalError(info, "decodeSym: wrong id") elif result.kind != skStub and not r.inViewMode: # we already loaded the symbol return @@ -427,7 +427,7 @@ proc decodeSym(r: PRodReader, info: TLineInfo): PSym = result.annex = decodeLib(r, info) if r.s[r.pos] == '#': inc(r.pos) - result.constraint = decodeNode(r, UnknownLineInfo()) + result.constraint = decodeNode(r, unknownLineInfo()) if r.s[r.pos] == '(': if result.kind in routineKinds: result.ast = decodeNodeLazyBody(r, result.info, result) @@ -455,10 +455,10 @@ proc skipSection(r: PRodReader) = elif c > 0: dec(c) of '\0': break # end of file - else: nil + else: discard inc(r.pos) else: - InternalError("skipSection " & $r.line) + internalError("skipSection " & $r.line) proc rdWord(r: PRodReader): string = result = "" @@ -472,11 +472,11 @@ proc newStub(r: PRodReader, name: string, id: int): PSym = result.id = id result.name = getIdent(name) result.position = r.readerIndex - setID(id) #MessageOut(result.name.s); + setId(id) #MessageOut(result.name.s); if debugIds: registerID(result) proc processInterf(r: PRodReader, module: PSym) = - if r.interfIdx == 0: InternalError("processInterf") + if r.interfIdx == 0: internalError("processInterf") r.pos = r.interfIdx while (r.s[r.pos] > '\x0A') and (r.s[r.pos] != ')'): var w = decodeStr(r.s, r.pos) @@ -485,23 +485,23 @@ proc processInterf(r: PRodReader, module: PSym) = inc(r.pos) # #10 var s = newStub(r, w, key) s.owner = module - StrTableAdd(module.tab, s) - IdTablePut(r.syms, s, s) + strTableAdd(module.tab, s) + idTablePut(r.syms, s, s) proc processCompilerProcs(r: PRodReader, module: PSym) = - if r.compilerProcsIdx == 0: InternalError("processCompilerProcs") + if r.compilerProcsIdx == 0: internalError("processCompilerProcs") r.pos = r.compilerProcsIdx while (r.s[r.pos] > '\x0A') and (r.s[r.pos] != ')'): var w = decodeStr(r.s, r.pos) inc(r.pos) var key = decodeVInt(r.s, r.pos) inc(r.pos) # #10 - var s = PSym(IdTableGet(r.syms, key)) + var s = PSym(idTableGet(r.syms, key)) if s == nil: s = newStub(r, w, key) s.owner = module - IdTablePut(r.syms, s, s) - StrTableAdd(rodCompilerProcs, s) + idTablePut(r.syms, s, s) + strTableAdd(rodCompilerprocs, s) proc processIndex(r: PRodReader; idx: var TIndex; outf: TFile = nil) = var key, val, tmp: int @@ -516,11 +516,11 @@ proc processIndex(r: PRodReader; idx: var TIndex; outf: TFile = nil) = else: key = idx.lastIdxKey + 1 val = tmp + idx.lastIdxVal - IITablePut(idx.tab, key, val) + iiTablePut(idx.tab, key, val) if not outf.isNil: outf.write(key, " ", val, "\n") idx.lastIdxKey = key idx.lastIdxVal = val - setID(key) # ensure that this id will not be used + setId(key) # ensure that this id will not be used if r.s[r.pos] == '\x0A': inc(r.pos) inc(r.line) @@ -539,7 +539,7 @@ proc cmdChangeTriggersRecompilation(old, new: TCommands): bool = of cmdNone, cmdDoc, cmdInterpret, cmdPretty, cmdGenDepend, cmdDump, cmdCheck, cmdParse, cmdScan, cmdIdeTools, cmdDef, cmdRst2html, cmdRst2tex, cmdInteractive, cmdRun: - nil + discard # else: trigger recompilation: result = true @@ -558,7 +558,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) = of "ID": inc(r.pos) # skip ':' r.moduleID = decodeVInt(r.s, r.pos) - setID(r.moduleID) + setId(r.moduleID) of "ORIGFILE": inc(r.pos) r.origFile = decodeStr(r.s, r.pos) @@ -603,7 +603,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) = inc(r.pos) # skip ' ' inclCrc = decodeVInt(r.s, r.pos) if r.reason == rrNone: - if not ExistsFile(w) or (inclCrc != int(crcFromFile(w))): + if not existsFile(w) or (inclCrc != int(crcFromFile(w))): r.reason = rrInclDeps if r.s[r.pos] == '\x0A': inc(r.pos) @@ -639,7 +639,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) = r.initIdx = r.pos + 2 # "(\10" skipSection(r) else: - InternalError("invalid section: '" & section & + internalError("invalid section: '" & section & "' at " & $r.line & " in " & r.filename) #MsgWriteln("skipping section: " & section & # " at " & $r.line & " in " & r.filename) @@ -658,7 +658,7 @@ proc newRodReader(modfilename: string, crc: TCrc32, readerIndex: int): PRodReader = new(result) try: - result.memFile = memfiles.open(modfilename) + result.memfile = memfiles.open(modfilename) except EOS: return nil result.files = @[] @@ -670,13 +670,13 @@ proc newRodReader(modfilename: string, crc: TCrc32, r.line = 1 r.readerIndex = readerIndex r.filename = modfilename - InitIdTable(r.syms) + initIdTable(r.syms) # we terminate the file explicitely with ``\0``, so the cast to `cstring` # is safe: - r.s = cast[cstring](r.memFile.mem) + r.s = cast[cstring](r.memfile.mem) if startsWith(r.s, "NIM:"): - initIITable(r.index.tab) - initIITable(r.imports.tab) # looks like a ROD file + initIiTable(r.index.tab) + initIiTable(r.imports.tab) # looks like a ROD file inc(r.pos, 4) var version = "" while r.s[r.pos] notin {'\0', '\x0A'}: @@ -691,12 +691,12 @@ proc newRodReader(modfilename: string, crc: TCrc32, result = nil proc rrGetType(r: PRodReader, id: int, info: TLineInfo): PType = - result = PType(IdTableGet(gTypeTable, id)) + result = PType(idTableGet(gTypeTable, id)) if result == nil: # load the type: var oldPos = r.pos - var d = IITableGet(r.index.tab, id) - if d == invalidKey: InternalError(info, "rrGetType") + var d = iiTableGet(r.index.tab, id) + if d == InvalidKey: internalError(info, "rrGetType") r.pos = d + r.dataIdx result = decodeType(r, info) r.pos = oldPos @@ -715,7 +715,7 @@ var gMods*: TFileModuleMap = @[] proc decodeSymSafePos(rd: PRodReader, offset: int, info: TLineInfo): PSym = # all compiled modules - if rd.dataIdx == 0: InternalError(info, "dataIdx == 0") + if rd.dataIdx == 0: internalError(info, "dataIdx == 0") var oldPos = rd.pos rd.pos = offset + rd.dataIdx result = decodeSym(rd, info) @@ -725,8 +725,8 @@ proc findSomeWhere(id: int) = for i in countup(0, high(gMods)): var rd = gMods[i].rd if rd != nil: - var d = IITableGet(rd.index.tab, id) - if d != invalidKey: + var d = iiTableGet(rd.index.tab, id) + if d != InvalidKey: echo "found id ", id, " in ", gMods[i].filename proc getReader(moduleId: int): PRodReader = @@ -736,37 +736,37 @@ proc getReader(moduleId: int): PRodReader = # problems: for i in 0 .. <gMods.len: result = gMods[i].rd - if result != nil and result.moduleId == moduleId: return result + if result != nil and result.moduleID == moduleId: return result return nil proc rrGetSym(r: PRodReader, id: int, info: TLineInfo): PSym = - result = PSym(IdTableGet(r.syms, id)) + result = PSym(idTableGet(r.syms, id)) if result == nil: # load the symbol: - var d = IITableGet(r.index.tab, id) - if d == invalidKey: + var d = iiTableGet(r.index.tab, id) + if d == InvalidKey: # import from other module: - var moduleID = IiTableGet(r.imports.tab, id) + var moduleID = iiTableGet(r.imports.tab, id) if moduleID < 0: var x = "" encodeVInt(id, x) - InternalError(info, "missing from both indexes: +" & x) + internalError(info, "missing from both indexes: +" & x) var rd = getReader(moduleID) - d = IITableGet(rd.index.tab, id) - if d != invalidKey: + d = iiTableGet(rd.index.tab, id) + if d != InvalidKey: result = decodeSymSafePos(rd, d, info) else: var x = "" encodeVInt(id, x) when false: findSomeWhere(id) - InternalError(info, "rrGetSym: no reader found: +" & x) + internalError(info, "rrGetSym: no reader found: +" & x) else: # own symbol: result = decodeSymSafePos(r, d, info) if result != nil and result.kind == skStub: rawLoadStub(result) proc loadInitSection(r: PRodReader): PNode = - if r.initIdx == 0 or r.dataIdx == 0: InternalError("loadInitSection") + if r.initIdx == 0 or r.dataIdx == 0: internalError("loadInitSection") var oldPos = r.pos r.pos = r.initIdx result = newNode(nkStmtList) @@ -775,7 +775,7 @@ proc loadInitSection(r: PRodReader): PNode = inc(r.pos) # #10 var p = r.pos r.pos = d + r.dataIdx - addSon(result, decodeNode(r, UnknownLineInfo())) + addSon(result, decodeNode(r, unknownLineInfo())) r.pos = p r.pos = oldPos @@ -783,24 +783,24 @@ proc loadConverters(r: PRodReader) = # We have to ensure that no exported converter is a stub anymore, and the # import mechanism takes care of the rest. if r.convertersIdx == 0 or r.dataIdx == 0: - InternalError("importConverters") + internalError("importConverters") r.pos = r.convertersIdx while r.s[r.pos] > '\x0A': var d = decodeVInt(r.s, r.pos) - discard rrGetSym(r, d, UnknownLineInfo()) + discard rrGetSym(r, d, unknownLineInfo()) if r.s[r.pos] == ' ': inc(r.pos) proc loadMethods(r: PRodReader) = if r.methodsIdx == 0 or r.dataIdx == 0: - InternalError("loadMethods") + internalError("loadMethods") r.pos = r.methodsIdx while r.s[r.pos] > '\x0A': var d = decodeVInt(r.s, r.pos) - r.methods.add(rrGetSym(r, d, UnknownLineInfo())) + r.methods.add(rrGetSym(r, d, unknownLineInfo())) if r.s[r.pos] == ' ': inc(r.pos) -proc GetCRC*(fileIdx: int32): TCrc32 = - InternalAssert fileIdx >= 0 and fileIdx < gMods.len +proc getCRC*(fileIdx: int32): TCrc32 = + internalAssert fileIdx >= 0 and fileIdx < gMods.len if gMods[fileIdx].crcDone: return gMods[fileIdx].crc @@ -818,14 +818,14 @@ proc checkDep(fileIdx: int32): TReasonForRecompile = # reason has already been computed for this module: return gMods[fileIdx].reason let filename = fileIdx.toFilename - var crc = GetCRC(fileIdx) + var crc = getCRC(fileIdx) gMods[fileIdx].reason = rrNone # we need to set it here to avoid cycles result = rrNone var r: PRodReader = nil var rodfile = toGeneratedFile(filename.withPackageName, RodExt) r = newRodReader(rodfile, crc, fileIdx) if r == nil: - result = (if ExistsFile(rodfile): rrRodInvalid else: rrRodDoesNotExist) + result = (if existsFile(rodfile): rrRodInvalid else: rrRodDoesNotExist) else: processRodFile(r, crc) result = r.reason @@ -834,7 +834,7 @@ proc checkDep(fileIdx: int32): TReasonForRecompile = # NOTE: we need to process the entire module graph so that no ID will # be used twice! However, compilation speed does not suffer much from # this, since results are cached. - var res = checkDep(SystemFileIdx) + var res = checkDep(systemFileIdx) if res != rrNone: result = rrModDeps for i in countup(0, high(r.modDeps)): res = checkDep(r.modDeps[i]) @@ -845,7 +845,7 @@ proc checkDep(fileIdx: int32): TReasonForRecompile = rawMessage(hintProcessing, reasonToFrmt[result] % filename) if result != rrNone or optForceFullMake in gGlobalOptions: # recompilation is necessary: - if r != nil: memfiles.close(r.memFile) + if r != nil: memfiles.close(r.memfile) r = nil gMods[fileIdx].rd = r gMods[fileIdx].reason = result # now we know better @@ -858,11 +858,11 @@ proc handleSymbolFile(module: PSym): PRodReader = idgen.loadMaxIds(options.gProjectPath / options.gProjectName) discard checkDep(fileIdx) - if gMods[fileIdx].reason == rrEmpty: InternalError("handleSymbolFile") + if gMods[fileIdx].reason == rrEmpty: internalError("handleSymbolFile") result = gMods[fileIdx].rd if result != nil: module.id = result.moduleID - IdTablePut(result.syms, module, module) + idTablePut(result.syms, module, module) processInterf(result, module) processCompilerProcs(result, module) loadConverters(result) @@ -871,21 +871,21 @@ proc handleSymbolFile(module: PSym): PRodReader = module.id = getID() proc rawLoadStub(s: PSym) = - if s.kind != skStub: InternalError("loadStub") + if s.kind != skStub: internalError("loadStub") var rd = gMods[s.position].rd var theId = s.id # used for later check - var d = IITableGet(rd.index.tab, s.id) - if d == invalidKey: InternalError("loadStub: invalid key") - var rs = decodeSymSafePos(rd, d, UnknownLineInfo()) + var d = iiTableGet(rd.index.tab, s.id) + if d == InvalidKey: internalError("loadStub: invalid key") + var rs = decodeSymSafePos(rd, d, unknownLineInfo()) if rs != s: #echo "rs: ", toHex(cast[int](rs.position), int.sizeof * 2), # "\ns: ", toHex(cast[int](s.position), int.sizeof * 2) - InternalError(rs.info, "loadStub: wrong symbol") + internalError(rs.info, "loadStub: wrong symbol") elif rs.id != theId: - InternalError(rs.info, "loadStub: wrong ID") + internalError(rs.info, "loadStub: wrong ID") #MessageOut('loaded stub: ' + s.name.s); -proc LoadStub*(s: PSym) = +proc loadStub*(s: PSym) = ## loads the stub symbol `s`. # deactivate the GC here because we do a deep recursion and generate no @@ -912,8 +912,8 @@ proc getBody*(s: PSym): PNode = s.ast.sons[bodyPos] = result s.offset = 0 -InitIdTable(gTypeTable) -InitStrTable(rodCompilerProcs) +initIdTable(gTypeTable) +initStrTable(rodCompilerprocs) # viewer: proc writeNode(f: TFile; n: PNode) = @@ -1038,7 +1038,7 @@ proc viewFile(rodfile: string) = of "ID": inc(r.pos) # skip ':' r.moduleID = decodeVInt(r.s, r.pos) - setID(r.moduleID) + setId(r.moduleID) outf.writeln("ID:", $r.moduleID) of "ORIGFILE": inc(r.pos) @@ -1140,12 +1140,12 @@ proc viewFile(rodfile: string) = outf.write("DATA(\n") while r.s[r.pos] != ')': if r.s[r.pos] == '(': - outf.writeNode decodeNode(r, UnknownLineInfo()) + outf.writeNode decodeNode(r, unknownLineInfo()) outf.write("\n") elif r.s[r.pos] == '[': - outf.writeType decodeType(r, UnknownLineInfo()) + outf.writeType decodeType(r, unknownLineInfo()) else: - outf.writeSym decodeSym(r, UnknownLineInfo()) + outf.writeSym decodeSym(r, unknownLineInfo()) if r.s[r.pos] == '\x0A': inc(r.pos) inc(r.line) @@ -1166,7 +1166,7 @@ proc viewFile(rodfile: string) = if r.s[r.pos] == ')': inc r.pos outf.write("<not supported by viewer>)\n") else: - InternalError("invalid section: '" & section & + internalError("invalid section: '" & section & "' at " & $r.line & " in " & r.filename) skipSection(r) if r.s[r.pos] == '\x0A': diff --git a/compiler/rodutils.nim b/compiler/rodutils.nim index 0ee3b1ec4..4433ed4ab 100644 --- a/compiler/rodutils.nim +++ b/compiler/rodutils.nim @@ -12,7 +12,7 @@ import strutils proc c_sprintf(buf, frmt: cstring) {.importc: "sprintf", nodecl, varargs.} -proc ToStrMaxPrecision*(f: BiggestFloat): string = +proc toStrMaxPrecision*(f: BiggestFloat): string = if f != f: result = "NAN" elif f == 0.0: @@ -36,7 +36,7 @@ proc hexChar(c: char, xi: var int) = of '0'..'9': xi = (xi shl 4) or (ord(c) - ord('0')) of 'a'..'f': xi = (xi shl 4) or (ord(c) - ord('a') + 10) of 'A'..'F': xi = (xi shl 4) or (ord(c) - ord('A') + 10) - else: nil + else: discard proc decodeStr*(s: cstring, pos: var int): string = var i = pos @@ -119,7 +119,7 @@ template decodeIntImpl() = proc decodeVInt*(s: cstring, pos: var int): int = decodeIntImpl() -proc decodeVBiggestInt*(s: cstring, pos: var int): biggestInt = +proc decodeVBiggestInt*(s: cstring, pos: var int): BiggestInt = decodeIntImpl() iterator decodeVIntArray*(s: cstring): int = diff --git a/compiler/rodwrite.nim b/compiler/rodwrite.nim index 2e52aeaa7..4231da2d0 100644 --- a/compiler/rodwrite.nim +++ b/compiler/rodwrite.nim @@ -56,7 +56,7 @@ proc fileIdx(w: PRodWriter, filename: string): int = if w.files[i] == filename: return i result = len(w.files) - setlen(w.files, result + 1) + setLen(w.files, result + 1) w.files[result] = filename template filename*(w: PRodWriter): string = @@ -66,8 +66,8 @@ proc newRodWriter(crc: TCrc32, module: PSym): PRodWriter = new(result) result.sstack = @[] result.tstack = @[] - InitIITable(result.index.tab) - InitIITable(result.imports.tab) + initIiTable(result.index.tab) + initIiTable(result.imports.tab) result.index.r = "" result.imports.r = "" result.crc = crc @@ -101,12 +101,12 @@ proc addInclDep(w: PRodWriter, dep: string) = proc pushType(w: PRodWriter, t: PType) = # check so that the stack does not grow too large: - if IiTableGet(w.index.tab, t.id) == invalidKey: + if iiTableGet(w.index.tab, t.id) == InvalidKey: w.tstack.add(t) proc pushSym(w: PRodWriter, s: PSym) = # check so that the stack does not grow too large: - if IiTableGet(w.index.tab, s.id) == invalidKey: + if iiTableGet(w.index.tab, s.id) == InvalidKey: w.sstack.add(s) proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode, @@ -120,19 +120,19 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode, # we do not write comments for now # Line information takes easily 20% or more of the filesize! Therefore we # omit line information if it is the same as the father's line information: - if finfo.fileIndex != n.info.fileIndex: + if fInfo.fileIndex != n.info.fileIndex: result.add('?') encodeVInt(n.info.col, result) result.add(',') encodeVInt(n.info.line, result) result.add(',') encodeVInt(fileIdx(w, toFilename(n.info)), result) - elif finfo.line != n.info.line: + elif fInfo.line != n.info.line: result.add('?') encodeVInt(n.info.col, result) result.add(',') encodeVInt(n.info.line, result) - elif finfo.col != n.info.col: + elif fInfo.col != n.info.col: result.add('?') encodeVInt(n.info.col, result) # No need to output the file index, as this is the serialization of one @@ -190,7 +190,7 @@ proc encodeLoc(w: PRodWriter, loc: TLoc, result: var string) = if loc.a != 0: add(result, '?') encodeVInt(loc.a, result) - if oldlen + 1 == result.len: + if oldLen + 1 == result.len: # no data was necessary, so remove the '<' again: setLen(result, oldLen) else: @@ -202,7 +202,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) = result.add("[]") return # we need no surrounding [] here because the type is in a line of its own - if t.kind == tyForward: InternalError("encodeType: tyForward") + if t.kind == tyForward: internalError("encodeType: tyForward") # for the new rodfile viewer we use a preceeding [ so that the data section # can easily be disambiguated: add(result, '[') @@ -210,7 +210,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) = add(result, '+') encodeVInt(t.id, result) if t.n != nil: - encodeNode(w, UnknownLineInfo(), t.n, result) + encodeNode(w, unknownLineInfo(), t.n, result) if t.flags != {}: add(result, '$') encodeVInt(cast[int32](t.flags), result) @@ -292,7 +292,7 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) = if s.annex != nil: encodeLib(w, s.annex, s.info, result) if s.constraint != nil: add(result, '#') - encodeNode(w, UnknownLineInfo(), s.constraint, result) + encodeNode(w, unknownLineInfo(), s.constraint, result) # lazy loading will soon reload the ast lazily, so the ast needs to be # the last entry of a symbol: if s.ast != nil: @@ -322,7 +322,7 @@ proc addToIndex(w: var TIndex, key, val: int) = add(w.r, rodNL) w.lastIdxKey = key w.lastIdxVal = val - IiTablePut(w.tab, key, val) + iiTablePut(w.tab, key, val) const debugWrittenIds = false @@ -336,9 +336,9 @@ proc symStack(w: PRodWriter): int = if sfForward in s.flags: w.sstack[result] = s inc result - elif IiTableGet(w.index.tab, s.id) == invalidKey: + elif iiTableGet(w.index.tab, s.id) == InvalidKey: var m = getModule(s) - if m == nil: InternalError("symStack: module nil: " & s.name.s) + if m == nil: internalError("symStack: module nil: " & s.name.s) if (m.id == w.module.id) or (sfFromGeneric in s.flags): # put definition in here var L = w.data.len @@ -364,7 +364,7 @@ proc symStack(w: PRodWriter): int = if s.kind == skMethod and sfDispatcher notin s.flags: if w.methods.len != 0: add(w.methods, ' ') encodeVInt(s.id, w.methods) - elif IiTableGet(w.imports.tab, s.id) == invalidKey: + elif iiTableGet(w.imports.tab, s.id) == InvalidKey: addToIndex(w.imports, s.id, m.id) when debugWrittenIds: if not Contains(debugWritten, s.id): @@ -374,7 +374,7 @@ proc symStack(w: PRodWriter): int = debug(m) InternalError("Symbol referred to but never written") inc(i) - setlen(w.sstack, result) + setLen(w.sstack, result) proc typeStack(w: PRodWriter): int = var i = 0 @@ -383,13 +383,13 @@ proc typeStack(w: PRodWriter): int = if t.kind == tyForward: w.tstack[result] = t inc result - elif IiTableGet(w.index.tab, t.id) == invalidKey: + elif iiTableGet(w.index.tab, t.id) == InvalidKey: var L = w.data.len addToIndex(w.index, t.id, L) encodeType(w, t, w.data) add(w.data, rodNL) inc(i) - setlen(w.tstack, result) + setLen(w.tstack, result) proc processStacks(w: PRodWriter, finalPass: bool) = var oldS = 0 @@ -401,7 +401,7 @@ proc processStacks(w: PRodWriter, finalPass: bool) = oldS = slen oldT = tlen if finalPass and (oldS != 0 or oldT != 0): - InternalError("could not serialize some forwarded symbols/types") + internalError("could not serialize some forwarded symbols/types") proc rawAddInterfaceSym(w: PRodWriter, s: PSym) = pushSym(w, s) @@ -416,7 +416,7 @@ proc addInterfaceSym(w: PRodWriter, s: PSym) = proc addStmt(w: PRodWriter, n: PNode) = encodeVInt(w.data.len, w.init) add(w.init, rodNL) - encodeNode(w, UnknownLineInfo(), n, w.data) + encodeNode(w, unknownLineInfo(), n, w.data) add(w.data, rodNL) processStacks(w, false) @@ -534,9 +534,9 @@ proc process(c: PPassContext, n: PNode): PNode = of nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef, nkTemplateDef, nkMacroDef: var s = n.sons[namePos].sym - if s == nil: InternalError(n.info, "rodwrite.process") + if s == nil: internalError(n.info, "rodwrite.process") if n.sons[bodyPos] == nil: - InternalError(n.info, "rodwrite.process: body is nil") + internalError(n.info, "rodwrite.process: body is nil") if n.sons[bodyPos].kind != nkEmpty or s.magic != mNone or sfForward notin s.flags: addInterfaceSym(w, s) @@ -549,7 +549,7 @@ proc process(c: PPassContext, n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if a.sons[0].kind != nkSym: InternalError(a.info, "rodwrite.process") + if a.sons[0].kind != nkSym: internalError(a.info, "rodwrite.process") var s = a.sons[0].sym addInterfaceSym(w, s) # this takes care of enum fields too @@ -573,11 +573,11 @@ proc process(c: PPassContext, n: PNode): PNode = of nkPragma: addStmt(w, n) else: - nil + discard proc myOpen(module: PSym): PPassContext = - if module.id < 0: InternalError("rodwrite: module ID not set") - var w = newRodWriter(module.fileIdx.GetCRC, module) + if module.id < 0: internalError("rodwrite: module ID not set") + var w = newRodWriter(module.fileIdx.getCRC, module) rawAddInterfaceSym(w, module) result = w diff --git a/compiler/ropes.nim b/compiler/ropes.nim index 707c29123..fcf5dd202 100644 --- a/compiler/ropes.nim +++ b/compiler/ropes.nim @@ -91,13 +91,13 @@ proc writeRopeIfNotEqual*(r: PRope, filename: string): bool proc ropeToStr*(p: PRope): string proc ropef*(frmt: TFormatStr, args: varargs[PRope]): PRope proc appf*(c: var PRope, frmt: TFormatStr, args: varargs[PRope]) -proc RopeEqualsFile*(r: PRope, f: string): bool +proc ropeEqualsFile*(r: PRope, f: string): bool # returns true if the rope r is the same as the contents of file f -proc RopeInvariant*(r: PRope): bool +proc ropeInvariant*(r: PRope): bool # exported for debugging # implementation -var ErrorHandler*: proc(err: TRopesError, msg: string, useWarning = false) +var errorHandler*: proc(err: TRopesError, msg: string, useWarning = false) # avoid dependency on msgs.nim proc ropeLen(a: PRope): int = @@ -126,7 +126,7 @@ proc resetRopeCache* = for i in low(cache)..high(cache): cache[i] = nil -proc RopeInvariant(r: PRope): bool = +proc ropeInvariant(r: PRope): bool = if r == nil: result = true else: @@ -157,14 +157,14 @@ proc toRope(s: string): PRope = result = nil else: result = insertInCache(s) - assert(RopeInvariant(result)) + assert(ropeInvariant(result)) -proc RopeSeqInsert(rs: var TRopeSeq, r: PRope, at: Natural) = +proc ropeSeqInsert(rs: var TRopeSeq, r: PRope, at: Natural) = var length = len(rs) if at > length: - setlen(rs, at + 1) + setLen(rs, at + 1) else: - setlen(rs, length + 1) # move old rope elements: + setLen(rs, length + 1) # move old rope elements: for i in countdown(length, at + 1): rs[i] = rs[i - 1] # this is correct, I used pen and paper to validate it rs[at] = r @@ -177,8 +177,8 @@ proc newRecRopeToStr(result: var string, resultLen: var int, r: PRope) = add(stack, it.right) it = it.left assert(it.data != nil) - CopyMem(addr(result[resultLen]), addr(it.data[0]), it.length) - Inc(resultLen, it.length) + copyMem(addr(result[resultLen]), addr(it.data[0]), it.length) + inc(resultLen, it.length) assert(resultLen <= len(result)) proc ropeToStr(p: PRope): string = @@ -227,13 +227,13 @@ proc writeRope*(f: TFile, c: PRope) = assert(it.data != nil) write(f, it.data) -proc WriteRope*(head: PRope, filename: string, useWarning = false) = - var f: tfile +proc writeRope*(head: PRope, filename: string, useWarning = false) = + var f: TFile if open(f, filename, fmWrite): - if head != nil: WriteRope(f, head) + if head != nil: writeRope(f, head) close(f) else: - ErrorHandler(rCannotOpenFile, filename, useWarning) + errorHandler(rCannotOpenFile, filename, useWarning) var rnl* = tnl.newRope @@ -258,12 +258,12 @@ proc ropef(frmt: TFormatStr, args: varargs[PRope]): PRope = of '0'..'9': var j = 0 while true: - j = (j * 10) + Ord(frmt[i]) - ord('0') + j = (j * 10) + ord(frmt[i]) - ord('0') inc(i) if (i > length + 0 - 1) or not (frmt[i] in {'0'..'9'}): break num = j if j > high(args) + 1: - ErrorHandler(rInvalidFormatStr, $(j)) + errorHandler(rInvalidFormatStr, $(j)) else: app(result, args[j - 1]) of 'n': @@ -273,22 +273,25 @@ proc ropef(frmt: TFormatStr, args: varargs[PRope]): PRope = app(result, rnl) inc(i) else: - ErrorHandler(rInvalidFormatStr, $(frmt[i])) + errorHandler(rInvalidFormatStr, $(frmt[i])) var start = i while i < length: if frmt[i] != '$': inc(i) else: break if i - 1 >= start: app(result, substr(frmt, start, i - 1)) - assert(RopeInvariant(result)) - -{.push stack_trace: off, line_trace: off.} -proc `~`*(r: expr[string]): PRope = - # this is the new optimized "to rope" operator - # the mnemonic is that `~` looks a bit like a rope :) - var r {.global.} = r.ropef - return r -{.pop.} + assert(ropeInvariant(result)) + +when true: + template `~`*(r: string): PRope = r.ropef +else: + {.push stack_trace: off, line_trace: off.} + proc `~`*(r: static[string]): PRope = + # this is the new optimized "to rope" operator + # the mnemonic is that `~` looks a bit like a rope :) + var r {.global.} = r.ropef + return r + {.pop.} proc appf(c: var PRope, frmt: TFormatStr, args: varargs[PRope]) = app(c, ropef(frmt, args)) @@ -296,10 +299,10 @@ proc appf(c: var PRope, frmt: TFormatStr, args: varargs[PRope]) = const bufSize = 1024 # 1 KB is reasonable -proc auxRopeEqualsFile(r: PRope, bin: var tfile, buf: Pointer): bool = +proc auxRopeEqualsFile(r: PRope, bin: var TFile, buf: pointer): bool = if r.data != nil: if r.length > bufSize: - ErrorHandler(rTokenTooLong, r.data) + errorHandler(rTokenTooLong, r.data) return var readBytes = readBuffer(bin, buf, r.length) result = readBytes == r.length and @@ -308,12 +311,12 @@ proc auxRopeEqualsFile(r: PRope, bin: var tfile, buf: Pointer): bool = result = auxRopeEqualsFile(r.left, bin, buf) if result: result = auxRopeEqualsFile(r.right, bin, buf) -proc RopeEqualsFile(r: PRope, f: string): bool = - var bin: tfile +proc ropeEqualsFile(r: PRope, f: string): bool = + var bin: TFile result = open(bin, f) if not result: return # not equal if file does not exist - var buf = alloc(BufSize) + var buf = alloc(bufSize) result = auxRopeEqualsFile(r, bin, buf) if result: result = readBuffer(bin, buf, bufSize) == 0 # really at the end of file? @@ -346,7 +349,7 @@ proc newCrcFromRopeAux(r: PRope, startVal: TCrc32): TCrc32 = inc(i) proc crcFromRope(r: PRope): TCrc32 = - result = newCrcFromRopeAux(r, initCrc32) + result = newCrcFromRopeAux(r, InitCrc32) proc writeRopeIfNotEqual(r: PRope, filename: string): bool = # returns true if overwritten diff --git a/compiler/saturate.nim b/compiler/saturate.nim index e0968843b..ed197bdd1 100644 --- a/compiler/saturate.nim +++ b/compiler/saturate.nim @@ -9,7 +9,7 @@ ## Saturated arithmetic routines. XXX Make part of the stdlib? -proc `|+|`*(a, b: biggestInt): biggestInt = +proc `|+|`*(a, b: BiggestInt): BiggestInt = ## saturated addition. result = a +% b if (result xor a) >= 0'i64 or (result xor b) >= 0'i64: @@ -19,7 +19,7 @@ proc `|+|`*(a, b: biggestInt): biggestInt = else: result = high(result) -proc `|-|`*(a, b: biggestInt): biggestInt = +proc `|-|`*(a, b: BiggestInt): BiggestInt = result = a -% b if (result xor a) >= 0'i64 or (result xor not b) >= 0'i64: return result @@ -28,14 +28,14 @@ proc `|-|`*(a, b: biggestInt): biggestInt = else: result = high(result) -proc `|abs|`*(a: biggestInt): biggestInt = +proc `|abs|`*(a: BiggestInt): BiggestInt = if a != low(a): if a >= 0: result = a else: result = -a else: result = low(a) -proc `|div|`*(a, b: biggestInt): biggestInt = +proc `|div|`*(a, b: BiggestInt): BiggestInt = # (0..5) div (0..4) == (0..5) div (1..4) == (0 div 4) .. (5 div 1) if b == 0'i64: # make the same as ``div 1``: @@ -45,13 +45,13 @@ proc `|div|`*(a, b: biggestInt): biggestInt = else: result = a div b -proc `|mod|`*(a, b: biggestInt): biggestInt = +proc `|mod|`*(a, b: BiggestInt): BiggestInt = if b == 0'i64: result = a else: result = a mod b -proc `|*|`*(a, b: biggestInt): biggestInt = +proc `|*|`*(a, b: BiggestInt): BiggestInt = var resAsFloat, floatProd: float64 result = a *% b diff --git a/compiler/sem.nim b/compiler/sem.nim index 71951dd3f..00ac79716 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -14,8 +14,8 @@ import wordrecg, ropes, msgs, os, condsyms, idents, renderer, types, platform, math, magicsys, parser, nversion, nimsets, semfold, importer, procfind, lookups, rodread, pragmas, passes, semdata, semtypinst, sigmatch, - semthreads, intsets, transf, evals, idgen, aliases, cgmeth, lambdalifting, - evaltempl, patterns, parampatterns, sempass2 + semthreads, intsets, transf, vmdef, vm, idgen, aliases, cgmeth, lambdalifting, + evaltempl, patterns, parampatterns, sempass2, pretty, semmacrosanity # implementation @@ -36,36 +36,37 @@ proc semParamList(c: PContext, n, genericParams: PNode, s: PSym) proc addParams(c: PContext, n: PNode, kind: TSymKind) proc maybeAddResult(c: PContext, s: PSym, n: PNode) proc instGenericContainer(c: PContext, n: PNode, header: PType): PType -proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode +proc tryExpr(c: PContext, n: PNode, + flags: TExprFlags = {}, bufferErrors = false): PNode proc fixImmediateParams(n: PNode): PNode proc activate(c: PContext, n: PNode) proc semQuoteAst(c: PContext, n: PNode): PNode proc finishMethod(c: PContext, s: PSym) -proc IndexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode +proc indexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode proc typeMismatch(n: PNode, formal, actual: PType) = if formal.kind != tyError and actual.kind != tyError: - LocalError(n.Info, errGenerated, msgKindToString(errTypeMismatch) & + localError(n.info, errGenerated, msgKindToString(errTypeMismatch) & typeToString(actual) & ") " & `%`(msgKindToString(errButExpectedX), [typeToString(formal)])) proc fitNode(c: PContext, formal: PType, arg: PNode): PNode = if arg.typ.isNil: - LocalError(arg.info, errExprXHasNoType, + localError(arg.info, errExprXHasNoType, renderTree(arg, {renderNoComments})) # error correction: result = copyNode(arg) result.typ = formal else: - result = IndexTypesMatch(c, formal, arg.typ, arg) + result = indexTypesMatch(c, formal, arg.typ, arg) if result == nil: typeMismatch(arg, formal, arg.typ) # error correction: - result = copyNode(arg) + result = copyTree(arg) result.typ = formal -var CommonTypeBegin = PType(kind: tyExpr) +var commonTypeBegin = PType(kind: tyExpr) proc commonType*(x, y: PType): PType = # new type relation that is used for array constructors, @@ -82,13 +83,33 @@ proc commonType*(x, y: PType): PType = elif a.kind == tyTypeDesc: # turn any concrete typedesc into the abstract typedesc type if a.sons == nil: result = a - else: result = newType(tyTypeDesc, a.owner) + else: + result = newType(tyTypeDesc, a.owner) + rawAddSon(result, newType(tyNone, a.owner)) elif b.kind in {tyArray, tyArrayConstr, tySet, tySequence} and a.kind == b.kind: # check for seq[empty] vs. seq[int] let idx = ord(b.kind in {tyArray, tyArrayConstr}) if a.sons[idx].kind == tyEmpty: return y #elif b.sons[idx].kind == tyEmpty: return x + elif a.kind == tyRange and b.kind == tyRange: + # consider: (range[0..3], range[0..4]) here. We should make that + # range[0..4]. But then why is (range[0..4], 6) not range[0..6]? + # But then why is (2,4) not range[2..4]? But I think this would break + # too much code. So ... it's the same range or the base type. This means + # type(if b: 0 else 1) == int and not range[0..1]. For now. In the long + # run people expect ranges to work properly within a tuple. + if not sameType(a, b): + result = skipTypes(a, {tyRange}).skipIntLit + when false: + if a.kind != tyRange and b.kind == tyRange: + # XXX This really needs a better solution, but a proper fix now breaks + # code. + result = a #.skipIntLit + elif a.kind == tyRange and b.kind != tyRange: + result = b #.skipIntLit + elif a.kind in IntegralTypes and a.n != nil: + result = a #.skipIntLit else: var k = tyNone if a.kind in {tyRef, tyPtr}: @@ -102,7 +123,7 @@ proc commonType*(x, y: PType): PType = if result.isNil: return x if k != tyNone: let r = result - result = NewType(k, r.owner) + result = newType(k, r.owner) result.addSonSkipIntLit(r) proc isTopLevel(c: PContext): bool {.inline.} = @@ -115,8 +136,8 @@ proc newSymG*(kind: TSymKind, n: PNode, c: PContext): PSym = # like newSymS, but considers gensym'ed symbols if n.kind == nkSym: result = n.sym - InternalAssert sfGenSym in result.flags - InternalAssert result.kind == kind + internalAssert sfGenSym in result.flags + internalAssert result.kind == kind else: result = newSym(kind, considerAcc(n), getCurrOwner(), n.info) @@ -127,15 +148,15 @@ proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode, allowed: TSymFlags): PSym proc semStmtScope(c: PContext, n: PNode): PNode -proc ParamsTypeCheck(c: PContext, typ: PType) {.inline.} = +proc paramsTypeCheck(c: PContext, typ: PType) {.inline.} = if not typeAllowed(typ, skConst): - LocalError(typ.n.info, errXisNoType, typeToString(typ)) + localError(typ.n.info, errXisNoType, typeToString(typ)) proc expectMacroOrTemplateCall(c: PContext, n: PNode): PSym proc semTemplateExpr(c: PContext, n: PNode, s: PSym, semCheck = true): PNode proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode proc semWhen(c: PContext, n: PNode, semCheck: bool = true): PNode -proc IsOpImpl(c: PContext, n: PNode): PNode +proc isOpImpl(c: PContext, n: PNode): PNode proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym, semCheck: bool = true): PNode @@ -149,50 +170,86 @@ proc symNodeFromType(c: PContext, t: PType, info: TLineInfo): PNode = result = newSymNode(symFromType(t, info), info) result.typ = makeTypeDesc(c, t) -proc createEvalContext(c: PContext, mode: TEvalMode): PEvalContext = - result = newEvalContext(c.module, mode) - result.getType = proc (n: PNode): PNode = - var e = tryExpr(c, n) - if e == nil: - result = symNodeFromType(c, errorType(c), n.info) - elif e.typ == nil: - result = newSymNode(getSysSym"void") +when false: + proc createEvalContext(c: PContext, mode: TEvalMode): PEvalContext = + result = newEvalContext(c.module, mode) + result.getType = proc (n: PNode): PNode = + result = tryExpr(c, n) + if result == nil: + result = newSymNode(errorSym(c, n)) + elif result.typ == nil: + result = newSymNode(getSysSym"void") + else: + result.typ = makeTypeDesc(c, result.typ) + + result.handleIsOperator = proc (n: PNode): PNode = + result = isOpImpl(c, n) + +proc fixupTypeAfterEval(c: PContext, evaluated, eOrig: PNode): PNode = + # recompute the types as 'eval' isn't guaranteed to construct types nor + # that the types are sound: + when true: + if eOrig.typ.kind in {tyExpr, tyStmt, tyTypeDesc}: + result = semExprWithType(c, evaluated) else: - result = symNodeFromType(c, e.typ, n.info) + result = evaluated + semmacrosanity.annotateType(result, eOrig.typ) + else: + result = semExprWithType(c, evaluated) + #result = fitNode(c, e.typ, result) inlined with special case: + let arg = result + result = indexTypesMatch(c, eOrig.typ, arg.typ, arg) + if result == nil: + result = arg + # for 'tcnstseq' we support [] to become 'seq' + if eOrig.typ.skipTypes(abstractInst).kind == tySequence and + arg.typ.skipTypes(abstractInst).kind == tyArrayConstr: + arg.typ = eOrig.typ + +proc tryConstExpr(c: PContext, n: PNode): PNode = + var e = semExprWithType(c, n) + if e == nil: return - result.handleIsOperator = proc (n: PNode): PNode = - result = IsOpImpl(c, n) + result = getConstExpr(c.module, e) + if result != nil: return -proc evalConstExpr(c: PContext, module: PSym, e: PNode): PNode = - result = evalConstExprAux(c.createEvalContext(emConst), module, nil, e) + try: + result = evalConstExpr(c.module, e) + if result == nil or result.kind == nkEmpty: + return nil -proc evalStaticExpr(c: PContext, module: PSym, e: PNode, prc: PSym): PNode = - result = evalConstExprAux(c.createEvalContext(emStatic), module, prc, e) + result = fixupTypeAfterEval(c, result, e) + except: + return nil proc semConstExpr(c: PContext, n: PNode): PNode = var e = semExprWithType(c, n) if e == nil: - LocalError(n.info, errConstExprExpected) + localError(n.info, errConstExprExpected) return n result = getConstExpr(c.module, e) if result == nil: - result = evalConstExpr(c, c.module, e) + result = evalConstExpr(c.module, e) if result == nil or result.kind == nkEmpty: if e.info != n.info: pushInfoContext(n.info) - LocalError(e.info, errConstExprExpected) + localError(e.info, errConstExprExpected) popInfoContext() else: - LocalError(e.info, errConstExprExpected) + localError(e.info, errConstExprExpected) # error correction: result = e + else: + result = fixupTypeAfterEval(c, result, e) include hlo, seminst, semcall proc semAfterMacroCall(c: PContext, n: PNode, s: PSym): PNode = inc(evalTemplateCounter) if evalTemplateCounter > 100: - GlobalError(s.info, errTemplateInstantiationTooNested) + globalError(s.info, errTemplateInstantiationTooNested) + let oldFriend = c.friendModule + c.friendModule = s.owner.getModule result = n if s.typ.sons[0] == nil: @@ -209,23 +266,25 @@ proc semAfterMacroCall(c: PContext, n: PNode, s: PSym): PNode = of tyTypeDesc: if n.kind == nkStmtList: result.kind = nkStmtListType var typ = semTypeNode(c, result, nil) - result = symNodeFromType(c, typ, n.info) + result.typ = makeTypeDesc(c, typ) + #result = symNodeFromType(c, typ, n.info) else: result = semExpr(c, result) result = fitNode(c, s.typ.sons[0], result) #GlobalError(s.info, errInvalidParamKindX, typeToString(s.typ.sons[0])) dec(evalTemplateCounter) + c.friendModule = oldFriend proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym, semCheck: bool = true): PNode = markUsed(n, sym) if sym == c.p.owner: - GlobalError(n.info, errRecursiveDependencyX, sym.name.s) + globalError(n.info, errRecursiveDependencyX, sym.name.s) - if c.evalContext == nil: - c.evalContext = c.createEvalContext(emStatic) + #if c.evalContext == nil: + # c.evalContext = c.createEvalContext(emStatic) - result = evalMacroCall(c.evalContext, n, nOrig, sym) + result = evalMacroCall(c.module, n, nOrig, sym) if semCheck: result = semAfterMacroCall(c, result, sym) proc forceBool(c: PContext, n: PNode): PNode = @@ -236,13 +295,21 @@ proc semConstBoolExpr(c: PContext, n: PNode): PNode = let nn = semExprWithType(c, n) result = fitNode(c, getSysType(tyBool), nn) if result == nil: - LocalError(n.info, errConstExprExpected) + localError(n.info, errConstExprExpected) return nn result = getConstExpr(c.module, result) if result == nil: - LocalError(n.info, errConstExprExpected) + localError(n.info, errConstExprExpected) result = nn +type + TSemGenericFlag = enum + withinBind, withinTypeDesc, withinMixin + TSemGenericFlags = set[TSemGenericFlag] + +proc semGenericStmt(c: PContext, n: PNode, flags: TSemGenericFlags, + ctx: var TIntSet): PNode + include semtypes, semtempl, semgnrc, semstmts, semexprs proc addCodeForGenerics(c: PContext, n: PNode) = @@ -250,17 +317,18 @@ proc addCodeForGenerics(c: PContext, n: PNode) = var prc = c.generics[i].inst.sym if prc.kind in {skProc, skMethod, skConverter} and prc.magic == mNone: if prc.ast == nil or prc.ast.sons[bodyPos] == nil: - InternalError(prc.info, "no code for " & prc.name.s) + internalError(prc.info, "no code for " & prc.name.s) else: addSon(n, prc.ast) c.lastGenericIdx = c.generics.len proc myOpen(module: PSym): PPassContext = var c = newContext(module) - if c.p != nil: InternalError(module.info, "sem.myOpen") + if c.p != nil: internalError(module.info, "sem.myOpen") c.semConstExpr = semConstExpr c.semExpr = semExpr c.semTryExpr = tryExpr + c.semTryConstExpr = tryConstExpr c.semOperand = semOperand c.semConstBoolExpr = semConstBoolExpr c.semOverloadedCall = semOverloadedCall @@ -270,10 +338,10 @@ proc myOpen(module: PSym): PPassContext = c.importTable = openScope(c) c.importTable.addSym(module) # a module knows itself if sfSystemModule in module.flags: - magicsys.SystemModule = module # set global variable! + magicsys.systemModule = module # set global variable! else: - c.importTable.addSym magicsys.SystemModule # import the "System" identifier - importAllSymbols(c, magicsys.SystemModule) + c.importTable.addSym magicsys.systemModule # import the "System" identifier + importAllSymbols(c, magicsys.systemModule) c.topLevelScope = openScope(c) result = c @@ -281,7 +349,7 @@ proc myOpenCached(module: PSym, rd: PRodReader): PPassContext = result = myOpen(module) for m in items(rd.methods): methodDef(m, true) -proc SemStmtAndGenerateGenerics(c: PContext, n: PNode): PNode = +proc semStmtAndGenerateGenerics(c: PContext, n: PNode): PNode = result = semStmt(c, n) # BUGFIX: process newly generated generics here, not at the end! if c.lastGenericIdx < c.generics.len: @@ -296,7 +364,7 @@ proc SemStmtAndGenerateGenerics(c: PContext, n: PNode): PNode = result = buildEchoStmt(c, result) result = transformStmt(c.module, result) -proc RecoverContext(c: PContext) = +proc recoverContext(c: PContext) = # clean up in case of a semantic error: We clean up the stacks, etc. This is # faster than wrapping every stack operation in a 'try finally' block and # requires far less code. @@ -308,15 +376,15 @@ proc myProcess(context: PPassContext, n: PNode): PNode = var c = PContext(context) # no need for an expensive 'try' if we stop after the first error anyway: if msgs.gErrorMax <= 1: - result = SemStmtAndGenerateGenerics(c, n) + result = semStmtAndGenerateGenerics(c, n) else: let oldContextLen = msgs.getInfoContextLen() - let oldInGenericInst = c.InGenericInst + let oldInGenericInst = c.inGenericInst try: - result = SemStmtAndGenerateGenerics(c, n) + result = semStmtAndGenerateGenerics(c, n) except ERecoverableError, ESuggestDone: - RecoverContext(c) - c.InGenericInst = oldInGenericInst + recoverContext(c) + c.inGenericInst = oldInGenericInst msgs.setInfoContextLen(oldContextLen) if getCurrentException() of ESuggestDone: result = nil else: result = ast.emptyNode @@ -325,7 +393,7 @@ proc myProcess(context: PPassContext, n: PNode): PNode = proc checkThreads(c: PContext) = if not needsGlobalAnalysis(): return for i in 0 .. c.threadEntries.len-1: - semthreads.AnalyseThreadProc(c.threadEntries[i]) + semthreads.analyseThreadProc(c.threadEntries[i]) proc myClose(context: PPassContext, n: PNode): PNode = var c = PContext(context) @@ -333,7 +401,7 @@ proc myClose(context: PPassContext, n: PNode): PNode = rawCloseScope(c) # imported symbols; don't check for unused ones! result = newNode(nkStmtList) if n != nil: - InternalError(n.info, "n is not nil") #result := n; + internalError(n.info, "n is not nil") #result := n; addCodeForGenerics(c, result) if c.module.ast != nil: result.add(c.module.ast) diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 9e9614796..6b19dc359 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -19,7 +19,7 @@ proc sameMethodDispatcher(a, b: PSym): bool = if aa.sym == bb.sym: result = true else: - nil + discard # generics have no dispatcher yet, so we need to compare the method # names; however, the names are equal anyway because otherwise we # wouldn't even consider them to be overloaded. But even this does @@ -47,14 +47,14 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode, var z: TCandidate if sym == nil: return - initCandidate(best, sym, initialBinding, symScope) - initCandidate(alt, sym, initialBinding, symScope) + initCandidate(c, best, sym, initialBinding, symScope) + initCandidate(c, alt, sym, initialBinding, symScope) best.state = csNoMatch while sym != nil: if sym.kind in filter: determineType(c, sym) - initCandidate(z, sym, initialBinding, o.lastOverloadScope) + initCandidate(c, z, sym, initialBinding, o.lastOverloadScope) z.calleeSym = sym matches(c, n, orig, z) if errors != nil: @@ -71,16 +71,16 @@ proc pickBestCandidate(c: PContext, headSymbol: PNode, var cmp = cmpCandidates(best, z) if cmp < 0: best = z # x is better than the best so far elif cmp == 0: alt = z # x is as good as the best so far - else: nil + else: discard sym = nextOverloadIter(o, c, headSymbol) -proc NotFoundError*(c: PContext, n: PNode, errors: seq[string]) = +proc notFoundError*(c: PContext, n: PNode, errors: seq[string]) = # Gives a detailed error message; this is separated from semOverloadedCall, # as semOverlodedCall is already pretty slow (and we need this information # only in case of an error). - if c.InCompilesContext > 0: + if c.inCompilesContext > 0: # fail fast: - GlobalError(n.info, errTypeMismatch, "") + globalError(n.info, errTypeMismatch, "") var result = msgKindToString(errTypeMismatch) add(result, describeArgs(c, n, 1 + ord(nfDelegate in n.flags))) add(result, ')') @@ -93,7 +93,7 @@ proc NotFoundError*(c: PContext, n: PNode, errors: seq[string]) = if candidates != "": add(result, "\n" & msgKindToString(errButExpected) & "\n" & candidates) - LocalError(n.Info, errGenerated, result) + localError(n.info, errGenerated, result) proc gatherUsedSyms(c: PContext, usedSyms: var seq[PNode]) = for scope in walkScopes(c.currentScope): @@ -139,7 +139,7 @@ proc resolveOverloads(c: PContext, n, orig: PNode, let overloadsState = result.state if overloadsState != csMatch: if nfDelegate in n.flags: - InternalAssert f.kind == nkIdent + internalAssert f.kind == nkIdent let calleeName = newStrNode(nkStrLit, f.ident.s) calleeName.info = n.info @@ -150,26 +150,26 @@ proc resolveOverloads(c: PContext, n, orig: PNode, pickBest(callOp) if overloadsState == csEmpty and result.state == csEmpty: - LocalError(n.info, errUndeclaredIdentifier, considerAcc(f).s) + localError(n.info, errUndeclaredIdentifier, considerAcc(f).s) return elif result.state != csMatch: if nfExprCall in n.flags: - LocalError(n.info, errExprXCannotBeCalled, + localError(n.info, errExprXCannotBeCalled, renderTree(n, {renderNoComments})) else: errors = @[] pickBest(f) - NotFoundError(c, n, errors) + notFoundError(c, n, errors) return if alt.state == csMatch and cmpCandidates(result, alt) == 0 and not sameMethodDispatcher(result.calleeSym, alt.calleeSym): - InternalAssert result.state == csMatch + internalAssert result.state == csMatch #writeMatches(result) #writeMatches(alt) if c.inCompilesContext > 0: # quick error message for performance of 'compiles' built-in: - GlobalError(n.Info, errGenerated, "ambiguous call") + globalError(n.info, errGenerated, "ambiguous call") elif gErrorCounter == 0: # don't cascade errors var args = "(" @@ -178,7 +178,7 @@ proc resolveOverloads(c: PContext, n, orig: PNode, add(args, typeToString(n.sons[i].typ)) add(args, ")") - LocalError(n.Info, errGenerated, msgKindToString(errAmbiguousCallXYZ) % [ + localError(n.info, errGenerated, msgKindToString(errAmbiguousCallXYZ) % [ getProcHeader(result.calleeSym), getProcHeader(alt.calleeSym), args]) @@ -197,17 +197,17 @@ proc instGenericConvertersSons*(c: PContext, n: PNode, x: TCandidate) = for i in 1 .. <n.len: instGenericConvertersArg(c, n.sons[i], x) -proc IndexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode = +proc indexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode = var m: TCandidate - initCandidate(m, f) - result = paramTypesMatch(c, m, f, a, arg, nil) + initCandidate(c, m, f) + result = paramTypesMatch(m, f, a, arg, nil) if m.genericConverter and result != nil: instGenericConvertersArg(c, result, m) -proc ConvertTo*(c: PContext, f: PType, n: PNode): PNode = +proc convertTo*(c: PContext, f: PType, n: PNode): PNode = var m: TCandidate - initCandidate(m, f) - result = paramTypesMatch(c, m, f, n.typ, n, nil) + initCandidate(c, m, f) + result = paramTypesMatch(m, f, n.typ, n, nil) if m.genericConverter and result != nil: instGenericConvertersArg(c, result, m) @@ -225,7 +225,7 @@ proc semResolvedCall(c: PContext, n: PNode, x: TCandidate): PNode = result = x.call result.sons[0] = newSymNode(finalCallee, result.sons[0].info) result.typ = finalCallee.typ.sons[0] - if ContainsGenericType(result.typ): result.typ = errorType(c) + if containsGenericType(result.typ): result.typ = errorType(c) return result = x.call instGenericConvertersSons(c, result, x) @@ -239,13 +239,13 @@ proc semOverloadedCall(c: PContext, n, nOrig: PNode, # else: result = errorNode(c, n) proc explicitGenericInstError(n: PNode): PNode = - LocalError(n.info, errCannotInstantiateX, renderTree(n)) + localError(n.info, errCannotInstantiateX, renderTree(n)) result = n proc explicitGenericSym(c: PContext, n: PNode, s: PSym): PNode = - var x: TCandidate - initCandidate(x, s, n) - var newInst = generateInstance(c, s, x.bindings, n.info) + var m: TCandidate + initCandidate(c, m, s, n) + var newInst = generateInstance(c, s, m.bindings, n.info) markUsed(n, s) result = newSymNode(newInst, n.info) @@ -260,7 +260,7 @@ proc explicitGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode = # number of generic type parameters: if safeLen(s.ast.sons[genericParamsPos]) != n.len-1: let expected = safeLen(s.ast.sons[genericParamsPos]) - LocalError(n.info, errGenerated, "cannot instantiate: " & renderTree(n) & + localError(n.info, errGenerated, "cannot instantiate: " & renderTree(n) & "; got " & $(n.len-1) & " type(s) but expected " & $expected) return n result = explicitGenericSym(c, n, s) @@ -283,7 +283,7 @@ proc explicitGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode = else: result = explicitGenericInstError(n) -proc SearchForBorrowProc(c: PContext, startScope: PScope, fn: PSym): PSym = +proc searchForBorrowProc(c: PContext, startScope: PScope, fn: PSym): PSym = # Searchs for the fn in the symbol table. If the parameter lists are suitable # for borrowing the sym in the symbol table is returned, else nil. # New approach: generate fn(x, y, z) where x, y, z have the proper types diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 121bf297d..c9d95e1bf 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -13,7 +13,7 @@ import strutils, lists, intsets, options, lexer, ast, astalgo, trees, treetab, wordrecg, ropes, msgs, platform, os, condsyms, idents, renderer, types, extccomp, math, - magicsys, nversion, nimsets, parser, times, passes, rodread, evals + magicsys, nversion, nimsets, parser, times, passes, rodread, vmdef type TOptionEntry* = object of lists.TListEntry # entries to put on a @@ -21,7 +21,7 @@ type options*: TOptions defaultCC*: TCallingConvention dynlib*: PLib - Notes*: TNoteKinds + notes*: TNoteKinds otherPragmas*: PNode # every pragma can be pushed POptionEntry* = ref TOptionEntry @@ -32,7 +32,7 @@ type resultSym*: PSym # the result symbol (if we are in a proc) nestedLoopCounter*: int # whether we are in a loop or not nestedBlockCounter*: int # whether we are in a block or not - InTryStmt*: int # whether we are in a try statement; works also + inTryStmt*: int # whether we are in a try statement; works also # in standalone ``except`` and ``finally`` next*: PProcCon # used for stacking procedure contexts @@ -42,7 +42,7 @@ type TExprFlag* = enum efLValue, efWantIterator, efInTypeof, efWantStmt, efDetermineType, - efAllowDestructor + efAllowDestructor, efWantValue TExprFlags* = set[TExprFlag] PContext* = ref TContext @@ -55,15 +55,16 @@ type friendModule*: PSym # current friend module; may access private data; # this is used so that generic instantiations # can access private object fields - InstCounter*: int # to prevent endless instantiations + instCounter*: int # to prevent endless instantiations threadEntries*: TSymSeq # list of thread entries to check - AmbiguousSymbols*: TIntSet # ids of all ambiguous symbols (cannot + ambiguousSymbols*: TIntSet # ids of all ambiguous symbols (cannot # store this info in the syms themselves!) - InGenericContext*: int # > 0 if we are in a generic type - InUnrolledContext*: int # > 0 if we are unrolling a loop - InCompilesContext*: int # > 0 if we are in a ``compiles`` magic - InGenericInst*: int # > 0 if we are instantiating a generic + inTypeClass*: int # > 0 if we are in a user-defined type class + inGenericContext*: int # > 0 if we are in a generic type + inUnrolledContext*: int # > 0 if we are unrolling a loop + inCompilesContext*: int # > 0 if we are in a ``compiles`` magic + inGenericInst*: int # > 0 if we are instantiating a generic converters*: TSymSeq # sequence of converters patterns*: TSymSeq # sequence of pattern matchers optionStack*: TLinkedList @@ -72,7 +73,9 @@ type libs*: TLinkedList # all libs used by this module semConstExpr*: proc (c: PContext, n: PNode): PNode {.nimcall.} # for the pragmas semExpr*: proc (c: PContext, n: PNode, flags: TExprFlags = {}): PNode {.nimcall.} - semTryExpr*: proc (c: PContext, n: PNode, flags: TExprFlags = {}): PNode {.nimcall.} + semTryExpr*: proc (c: PContext, n: PNode,flags: TExprFlags = {}, + bufferErrors = false): PNode {.nimcall.} + semTryConstExpr*: proc (c: PContext, n: PNode): PNode {.nimcall.} semOperand*: proc (c: PContext, n: PNode, flags: TExprFlags = {}): PNode {.nimcall.} semConstBoolExpr*: proc (c: PContext, n: PNode): PNode {.nimcall.} # XXX bite the bullet semOverloadedCall*: proc (c: PContext, n, nOrig: PNode, @@ -81,7 +84,7 @@ type includedFiles*: TIntSet # used to detect recursive include files userPragmas*: TStrTable evalContext*: PEvalContext - UnknownIdents*: TIntSet # ids of all unknown identifiers to prevent + unknownIdents*: TIntSet # ids of all unknown identifiers to prevent # naming it multiple times generics*: seq[TInstantiationPair] # pending list of instantiated generics to compile lastGenericIdx*: int # used for the generics stack @@ -112,8 +115,8 @@ proc scopeDepth*(c: PContext): int {.inline.} = # owner handling: proc getCurrOwner*(): PSym -proc PushOwner*(owner: PSym) -proc PopOwner*() +proc pushOwner*(owner: PSym) +proc popOwner*() # implementation var gOwners*: seq[PSym] = @[] @@ -126,20 +129,20 @@ proc getCurrOwner(): PSym = # BUGFIX: global array is needed! result = gOwners[high(gOwners)] -proc PushOwner(owner: PSym) = +proc pushOwner(owner: PSym) = add(gOwners, owner) -proc PopOwner() = +proc popOwner() = var length = len(gOwners) - if length > 0: setlen(gOwners, length - 1) - else: InternalError("popOwner") + if length > 0: setLen(gOwners, length - 1) + else: internalError("popOwner") proc lastOptionEntry(c: PContext): POptionEntry = result = POptionEntry(c.optionStack.tail) proc pushProcCon*(c: PContext, owner: PSym) {.inline.} = if owner == nil: - InternalError("owner is nil") + internalError("owner is nil") return var x: PProcCon new(x) @@ -158,7 +161,7 @@ proc newOptionEntry(): POptionEntry = proc newContext(module: PSym): PContext = new(result) - result.AmbiguousSymbols = initIntset() + result.ambiguousSymbols = initIntSet() initLinkedList(result.optionStack) initLinkedList(result.libs) append(result.optionStack, newOptionEntry()) @@ -170,13 +173,13 @@ proc newContext(module: PSym): PContext = result.includedFiles = initIntSet() initStrTable(result.userPragmas) result.generics = @[] - result.UnknownIdents = initIntSet() + result.unknownIdents = initIntSet() proc inclSym(sq: var TSymSeq, s: PSym) = var L = len(sq) for i in countup(0, L - 1): if sq[i].id == s.id: return - setlen(sq, L + 1) + setLen(sq, L + 1) sq[L] = s proc addConverter*(c: PContext, conv: PSym) = @@ -196,29 +199,56 @@ proc addToLib(lib: PLib, sym: PSym) = proc makePtrType(c: PContext, baseType: PType): PType = result = newTypeS(tyPtr, c) - addSonSkipIntLit(result, baseType.AssertNotNil) + addSonSkipIntLit(result, baseType.assertNotNil) proc makeVarType(c: PContext, baseType: PType): PType = result = newTypeS(tyVar, c) - addSonSkipIntLit(result, baseType.AssertNotNil) + addSonSkipIntLit(result, baseType.assertNotNil) proc makeTypeDesc*(c: PContext, typ: PType): PType = result = newTypeS(tyTypeDesc, c) - result.addSonSkipIntLit(typ.AssertNotNil) + result.addSonSkipIntLit(typ.assertNotNil) proc makeTypeSymNode*(c: PContext, typ: PType, info: TLineInfo): PNode = let typedesc = makeTypeDesc(c, typ) + rawAddSon(typedesc, newTypeS(tyNone, c)) let sym = newSym(skType, idAnon, getCurrOwner(), info).linkTo(typedesc) return newSymNode(sym, info) -proc newTypeS(kind: TTypeKind, c: PContext): PType = - result = newType(kind, getCurrOwner()) +proc makeTypeFromExpr*(c: PContext, n: PNode): PType = + result = newTypeS(tyFromExpr, c) + result.n = n proc newTypeWithSons*(c: PContext, kind: TTypeKind, sons: seq[PType]): PType = result = newType(kind, getCurrOwner()) result.sons = sons +proc makeStaticExpr*(c: PContext, n: PNode): PNode = + result = newNodeI(nkStaticExpr, n.info) + result.sons = @[n] + result.typ = newTypeWithSons(c, tyStatic, @[n.typ]) + +proc makeAndType*(c: PContext, t1, t2: PType): PType = + result = newTypeS(tyAnd, c) + result.sons = @[t1, t2] + propagateToOwner(result, t1) + propagateToOwner(result, t2) + +proc makeOrType*(c: PContext, t1, t2: PType): PType = + result = newTypeS(tyOr, c) + result.sons = @[t1, t2] + propagateToOwner(result, t1) + propagateToOwner(result, t2) + +proc makeNotType*(c: PContext, t1: PType): PType = + result = newTypeS(tyNot, c) + result.sons = @[t1] + propagateToOwner(result, t1) + +proc newTypeS(kind: TTypeKind, c: PContext): PType = + result = newType(kind, getCurrOwner()) + proc errorType*(c: PContext): PType = ## creates a type representing an error state result = newTypeS(tyError, c) @@ -232,7 +262,7 @@ proc fillTypeS(dest: PType, kind: TTypeKind, c: PContext) = dest.owner = getCurrOwner() dest.size = - 1 -proc makeRangeType*(c: PContext; first, last: biggestInt; +proc makeRangeType*(c: PContext; first, last: BiggestInt; info: TLineInfo; intType = getSysType(tyInt)): PType = var n = newNodeI(nkRange, info) addSon(n, newIntTypeNode(nkIntLit, first, intType)) @@ -247,7 +277,7 @@ proc markIndirect*(c: PContext, s: PSym) {.inline.} = # XXX add to 'c' for global analysis proc illFormedAst*(n: PNode) = - GlobalError(n.info, errIllFormedAstX, renderTree(n, {renderNoComments})) + globalError(n.info, errIllFormedAstX, renderTree(n, {renderNoComments})) proc checkSonsLen*(n: PNode, length: int) = if sonsLen(n) != length: illFormedAst(n) diff --git a/compiler/semdestruct.nim b/compiler/semdestruct.nim index 797d8895e..fb05826cb 100644 --- a/compiler/semdestruct.nim +++ b/compiler/semdestruct.nim @@ -9,26 +9,39 @@ ## This module implements destructors. +# included from sem.nim # special marker values that indicates that we are # 1) AnalyzingDestructor: currently analyzing the type for destructor # generation (needed for recursive types) # 2) DestructorIsTrivial: completed the analysis before and determined # that the type has a trivial destructor -var AnalyzingDestructor, DestructorIsTrivial: PSym -new(AnalyzingDestructor) -new(DestructorIsTrivial) +var analyzingDestructor, destructorIsTrivial: PSym +new(analyzingDestructor) +new(destructorIsTrivial) var destructorName = getIdent"destroy_" destructorParam = getIdent"this_" - destructorPragma = newIdentNode(getIdent"destructor", UnknownLineInfo()) + destructorPragma = newIdentNode(getIdent"destructor", unknownLineInfo()) rangeDestructorProc*: PSym -proc instantiateDestructor(c: PContext, typ: PType): bool +proc instantiateDestructor(c: PContext, typ: PType): PType proc doDestructorStuff(c: PContext, s: PSym, n: PNode) = - let t = s.typ.sons[1].skipTypes({tyVar}) + var t = s.typ.sons[1].skipTypes({tyVar}) + if t.kind == tyGenericInvokation: + for i in 1 .. <t.sonsLen: + if t.sons[i].kind != tyGenericParam: + localError(n.info, errDestructorNotGenericEnough) + return + t = t.base + elif t.kind == tyCompositeTypeClass: + t = t.base + if t.kind != tyGenericBody: + localError(n.info, errDestructorNotGenericEnough) + return + t.destructor = s # automatically insert calls to base classes' destructors if n.sons[bodyPos].kind != nkEmpty: @@ -36,15 +49,17 @@ proc doDestructorStuff(c: PContext, s: PSym, n: PNode) = # when inheriting directly from object # there will be a single nil son if t.sons[i] == nil: continue - if instantiateDestructor(c, t.sons[i]): + let destructableT = instantiateDestructor(c, t.sons[i]) + if destructableT != nil: n.sons[bodyPos].addSon(newNode(nkCall, t.sym.info, @[ - useSym(t.sons[i].destructor), + useSym(destructableT.destructor), n.sons[paramsPos][1][0]])) proc destroyField(c: PContext, field: PSym, holder: PNode): PNode = - if instantiateDestructor(c, field.typ): + let destructableT = instantiateDestructor(c, field.typ) + if destructableT != nil: result = newNode(nkCall, field.info, @[ - useSym(field.typ.destructor), + useSym(destructableT.destructor), newNode(nkDotExpr, field.info, @[holder, useSym(field)])]) proc destroyCase(c: PContext, n: PNode, holder: PNode): PNode = @@ -90,7 +105,7 @@ proc generateDestructor(c: PContext, t: PType): PNode = # Tposix_spawnattr if t.n == nil or t.n.sons == nil: return internalAssert t.n.kind == nkRecList - let destructedObj = newIdentNode(destructorParam, UnknownLineInfo()) + let destructedObj = newIdentNode(destructorParam, unknownLineInfo()) # call the destructods of all fields for s in countup(0, t.n.sons.len - 1): case t.n.sons[s].kind @@ -101,32 +116,44 @@ proc generateDestructor(c: PContext, t: PType): PNode = let stmt = destroyField(c, t.n.sons[s].sym, destructedObj) if stmt != nil: addLine(stmt) else: - internalAssert false + # XXX just skip it for now so that the compiler doesn't crash, but + # please zahary fix it! arbitrary nesting of nkRecList/nkRecCase is + # possible. Any thread example seems to trigger this. + discard # base classes' destructors will be automatically called by # semProcAux for both auto-generated and user-defined destructors -proc instantiateDestructor(c: PContext, typ: PType): bool = - # returns true if the type already had a user-defined - # destructor or if the compiler generated a default - # member-wise one - var t = skipTypes(typ, {tyConst, tyMutable}) +proc instantiateDestructor(c: PContext, typ: PType): PType = + # returns nil if a variable of type `typ` doesn't require a + # destructor. Otherwise, returns the type, which holds the + # destructor that must be used for the varialbe. + # The destructor is either user-defined or automatically + # generated by the compiler in a member-wise fashion. + var t = skipTypes(typ, {tyConst, tyMutable}).skipGenericAlias + let typeHoldingUserDefinition = if t.kind == tyGenericInst: t.base + else: t - if t.destructor != nil: + if typeHoldingUserDefinition.destructor != nil: # XXX: This is not entirely correct for recursive types, but we need # it temporarily to hide the "destroy is already defined" problem - return t.destructor notin [AnalyzingDestructor, DestructorIsTrivial] + if typeHoldingUserDefinition.destructor notin + [analyzingDestructor, destructorIsTrivial]: + return typeHoldingUserDefinition + else: + return nil + t = t.skipTypes({tyGenericInst}) case t.kind of tySequence, tyArray, tyArrayConstr, tyOpenArray, tyVarargs: - if instantiateDestructor(c, t.sons[0]): + if instantiateDestructor(c, t.sons[0]) != nil: if rangeDestructorProc == nil: rangeDestructorProc = searchInScopes(c, getIdent"nimDestroyRange") t.destructor = rangeDestructorProc - return true + return t else: - return false + return nil of tyTuple, tyObject: - t.destructor = AnalyzingDestructor + t.destructor = analyzingDestructor let generated = generateDestructor(c, t) if generated != nil: internalAssert t.sym != nil @@ -139,21 +166,21 @@ proc instantiateDestructor(c: PContext, typ: PType): bool = emptyNode, newNode(nkIdentDefs, i, @[ newIdentNode(destructorParam, i), - useSym(t.sym), + symNodeFromType(c, makeVarType(c, t), t.sym.info), emptyNode]), ]), newNode(nkPragma, i, @[destructorPragma]), emptyNode, generated ]) - discard semProc(c, fullDef) - internalAssert t.destructor != nil - return true + let semantizedDef = semProc(c, fullDef) + t.destructor = semantizedDef[namePos].sym + return t else: - t.destructor = DestructorIsTrivial - return false + t.destructor = destructorIsTrivial + return nil else: - return false + return nil proc insertDestructors(c: PContext, varSection: PNode): tuple[outer, inner: PNode] = @@ -179,9 +206,11 @@ proc insertDestructors(c: PContext, varId = varSection[j][0] varTyp = varId.sym.typ info = varId.info - - if varTyp != nil and instantiateDestructor(c, varTyp) and - sfGlobal notin varId.sym.flags: + + if varTyp == nil or sfGlobal in varId.sym.flags: continue + let destructableT = instantiateDestructor(c, varTyp) + + if destructableT != nil: var tryStmt = newNodeI(nkTryStmt, info) if j < totalVars - 1: @@ -198,11 +227,11 @@ proc insertDestructors(c: PContext, else: result.inner = newNodeI(nkStmtList, info) tryStmt.addSon(result.inner) - + tryStmt.addSon( newNode(nkFinally, info, @[ semStmt(c, newNode(nkCall, info, @[ - useSym(varTyp.destructor), + useSym(destructableT.destructor), useSym(varId.sym)]))])) result.outer = newNodeI(nkStmtList, info) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 47e07d402..6c7679578 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -30,19 +30,19 @@ proc semOperand(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # XXX tyGenericInst here? if result.typ.kind == tyVar: result = newDeref(result) else: - LocalError(n.info, errExprXHasNoType, + localError(n.info, errExprXHasNoType, renderTree(result, {renderNoComments})) result.typ = errorType(c) proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = - result = semExpr(c, n, flags) + result = semExpr(c, n, flags+{efWantValue}) if result.isNil or result.kind == nkEmpty: # do not produce another redundant error message: #raiseRecoverableError("") result = errorNode(c, n) - if result.typ == nil or result.typ == EnforceVoidContext: + if result.typ == nil or result.typ == enforceVoidContext: # we cannot check for 'void' in macros ... - LocalError(n.info, errExprXHasNoType, + localError(n.info, errExprXHasNoType, renderTree(result, {renderNoComments})) result.typ = errorType(c) else: @@ -57,7 +57,7 @@ proc semExprNoDeref(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # do not produce another redundant error message: result = errorNode(c, n) if result.typ == nil: - LocalError(n.info, errExprXHasNoType, + localError(n.info, errExprXHasNoType, renderTree(result, {renderNoComments})) result.typ = errorType(c) else: @@ -102,7 +102,7 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode = # if a proc accesses a global variable, it is not side effect free: if sfGlobal in s.flags: incl(c.p.owner.flags, sfSideEffect) - elif s.kind == skParam and s.typ.kind == tyExpr and s.typ.n != nil: + elif s.kind == skParam and s.typ.kind == tyStatic and s.typ.n != nil: # XXX see the hack in sigmatch.nim ... return s.typ.n result = newSymNode(s, n.info) @@ -111,13 +111,13 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode = # var len = 0 # but won't be called # genericThatUsesLen(x) # marked as taking a closure? of skGenericParam: - if s.typ.kind == tyExpr: + if s.typ.kind == tyStatic: result = newSymNode(s, n.info) result.typ = s.typ elif s.ast != nil: result = semExpr(c, s.ast) else: - InternalError(n.info, "no default for") + internalError(n.info, "no default for") result = emptyNode of skType: markUsed(n, s) @@ -142,7 +142,7 @@ proc checkConversionBetweenObjects(castDest, src: PType): TConvStatus = const IntegralTypes = {tyBool, tyEnum, tyChar, tyInt..tyUInt64} -proc checkConvertible(castDest, src: PType): TConvStatus = +proc checkConvertible(c: PContext, castDest, src: PType): TConvStatus = result = convOK if sameType(castDest, src) and castDest.sym == src.sym: # don't annoy conversions that may be needed on another processor: @@ -151,31 +151,31 @@ proc checkConvertible(castDest, src: PType): TConvStatus = return var d = skipTypes(castDest, abstractVar) var s = skipTypes(src, abstractVar-{tyTypeDesc}) - while (d != nil) and (d.Kind in {tyPtr, tyRef}) and (d.Kind == s.Kind): + while (d != nil) and (d.kind in {tyPtr, tyRef}) and (d.kind == s.kind): d = base(d) s = base(s) if d == nil: result = convNotLegal - elif d.Kind == tyObject and s.Kind == tyObject: + elif d.kind == tyObject and s.kind == tyObject: result = checkConversionBetweenObjects(d, s) - elif (skipTypes(castDest, abstractVarRange).Kind in IntegralTypes) and - (skipTypes(src, abstractVarRange-{tyTypeDesc}).Kind in IntegralTypes): + elif (skipTypes(castDest, abstractVarRange).kind in IntegralTypes) and + (skipTypes(src, abstractVarRange-{tyTypeDesc}).kind in IntegralTypes): # accept conversion between integral types else: # we use d, s here to speed up that operation a bit: - case cmpTypes(d, s) + case cmpTypes(c, d, s) of isNone, isGeneric: if not compareTypes(castDest, src, dcEqIgnoreDistinct): result = convNotLegal else: - nil + discard proc isCastable(dst, src: PType): bool = #const # castableTypeKinds = {tyInt, tyPtr, tyRef, tyCstring, tyString, # tySequence, tyPointer, tyNil, tyOpenArray, # tyProc, tySet, tyEnum, tyBool, tyChar} - var ds, ss: biggestInt + var ds, ss: BiggestInt # this is very unrestrictive; cast is allowed if castDest.size >= src.size ds = computeSize(dst) ss = computeSize(src) @@ -191,9 +191,9 @@ proc isCastable(dst, src: PType): bool = proc isSymChoice(n: PNode): bool {.inline.} = result = n.kind in nkSymChoices -proc semConv(c: PContext, n: PNode, s: PSym): PNode = +proc semConv(c: PContext, n: PNode): PNode = if sonsLen(n) != 2: - LocalError(n.info, errConvNeedsOneArg) + localError(n.info, errConvNeedsOneArg) return n result = newNodeI(nkConv, n.info) result.typ = semTypeNode(c, n.sons[0], nil).skipTypes({tyGenericInst}) @@ -202,18 +202,18 @@ proc semConv(c: PContext, n: PNode, s: PSym): PNode = var op = result.sons[1] if not isSymChoice(op): - let status = checkConvertible(result.typ, op.typ) + let status = checkConvertible(c, result.typ, op.typ) case status - of convOK: nil + of convOK: discard of convNotNeedeed: - Message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString) + message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString) of convNotLegal: - LocalError(n.info, errGenerated, MsgKindToString(errIllegalConvFromXtoY)% + localError(n.info, errGenerated, msgKindToString(errIllegalConvFromXtoY)% [op.typ.typeToString, result.typ.typeToString]) else: for i in countup(0, sonsLen(op) - 1): let it = op.sons[i] - let status = checkConvertible(result.typ, it.typ) + let status = checkConvertible(c, result.typ, it.typ) if status == convOK: markUsed(n, it.sym) markIndirect(c, it.sym) @@ -228,36 +228,39 @@ proc semCast(c: PContext, n: PNode): PNode = result.typ = semTypeNode(c, n.sons[0], nil) addSon(result, copyTree(n.sons[0])) addSon(result, semExprWithType(c, n.sons[1])) - if not isCastable(result.typ, result.sons[1].Typ): - LocalError(result.info, errExprCannotBeCastedToX, - typeToString(result.Typ)) - + if not isCastable(result.typ, result.sons[1].typ): + localError(result.info, errExprCannotBeCastedToX, + typeToString(result.typ)) + proc semLowHigh(c: PContext, n: PNode, m: TMagic): PNode = const opToStr: array[mLow..mHigh, string] = ["low", "high"] if sonsLen(n) != 2: - LocalError(n.info, errXExpectsTypeOrValue, opToStr[m]) + localError(n.info, errXExpectsTypeOrValue, opToStr[m]) else: n.sons[1] = semExprWithType(c, n.sons[1], {efDetermineType}) - var typ = skipTypes(n.sons[1].typ, abstractVarRange) - case typ.Kind + var typ = skipTypes(n.sons[1].typ, abstractVarRange + + {tyTypeDesc, tyFieldAccessor}) + case typ.kind of tySequence, tyString, tyOpenArray, tyVarargs: n.typ = getSysType(tyInt) of tyArrayConstr, tyArray: n.typ = typ.sons[0] # indextype of tyInt..tyInt64, tyChar, tyBool, tyEnum, tyUInt8, tyUInt16, tyUInt32: # do not skip the range! - n.typ = n.sons[1].typ.skipTypes(abstractVar) + n.typ = n.sons[1].typ.skipTypes(abstractVar + {tyFieldAccessor}) of tyGenericParam: - # leave it for now, it will be resolved in semtypinst - n.typ = getSysType(tyInt) + # prepare this for resolving in semtypinst: + # we must use copyTree here in order to avoid creating a cycle + # that could easily turn into an infinite recursion in semtypinst + n.typ = makeTypeFromExpr(c, n.copyTree) else: - LocalError(n.info, errInvalidArgForX, opToStr[m]) + localError(n.info, errInvalidArgForX, opToStr[m]) result = n proc semSizeof(c: PContext, n: PNode): PNode = if sonsLen(n) != 2: - LocalError(n.info, errXExpectsTypeOrValue, "sizeof") + localError(n.info, errXExpectsTypeOrValue, "sizeof") else: n.sons[1] = semExprWithType(c, n.sons[1], {efDetermineType}) #restoreOldStyleType(n.sons[1]) @@ -276,9 +279,9 @@ proc semOf(c: PContext, n: PNode): PNode = let y = skipTypes(n.sons[2].typ, abstractPtrs-{tyTypeDesc}) if x.kind == tyTypeDesc or y.kind != tyTypeDesc: - LocalError(n.info, errXExpectsObjectTypes, "of") + localError(n.info, errXExpectsObjectTypes, "of") elif b.kind != tyObject or a.kind != tyObject: - LocalError(n.info, errXExpectsObjectTypes, "of") + localError(n.info, errXExpectsObjectTypes, "of") else: let diff = inheritanceDiff(a, b) # | returns: 0 iff `a` == `b` @@ -287,24 +290,24 @@ proc semOf(c: PContext, n: PNode): PNode = # | returns: `maxint` iff `a` and `b` are not compatible at all if diff <= 0: # optimize to true: - Message(n.info, hintConditionAlwaysTrue, renderTree(n)) + message(n.info, hintConditionAlwaysTrue, renderTree(n)) result = newIntNode(nkIntLit, 1) result.info = n.info result.typ = getSysType(tyBool) return result elif diff == high(int): - LocalError(n.info, errXcanNeverBeOfThisSubtype, typeToString(a)) + localError(n.info, errXcanNeverBeOfThisSubtype, typeToString(a)) else: - LocalError(n.info, errXExpectsTwoArguments, "of") + localError(n.info, errXExpectsTwoArguments, "of") n.typ = getSysType(tyBool) result = n -proc IsOpImpl(c: PContext, n: PNode): PNode = - InternalAssert n.sonsLen == 3 and - n[1].kind == nkSym and n[1].sym.kind == skType and +proc isOpImpl(c: PContext, n: PNode): PNode = + internalAssert n.sonsLen == 3 and + n[1].typ != nil and n[1].typ.kind == tyTypeDesc and n[2].kind in {nkStrLit..nkTripleStrLit, nkType} - let t1 = n[1].sym.typ.skipTypes({tyTypeDesc}) + let t1 = n[1].typ.skipTypes({tyTypeDesc, tyFieldAccessor}) if n[2].kind in {nkStrLit..nkTripleStrLit}: case n[2].strVal.normalize @@ -319,22 +322,20 @@ proc IsOpImpl(c: PContext, n: PNode): PNode = t.callConv == ccClosure and tfIterator in t.flags)) else: - var match: bool - let t2 = n[2].typ - if t2.kind == tyTypeClass: - var m: TCandidate - InitCandidate(m, t2) - match = matchUserTypeClass(c, m, emptyNode, t2, t1) != nil - else: - match = sameType(t1, t2) - + var t2 = n[2].typ.skipTypes({tyTypeDesc}) + let lifted = liftParamType(c, skType, newNodeI(nkArgList, n.info), + t2, ":anon", n.info) + if lifted != nil: t2 = lifted + var m: TCandidate + initCandidate(c, m, t2) + let match = typeRel(m, t2, t1) != isNone result = newIntNode(nkIntLit, ord(match)) result.typ = n.typ proc semIs(c: PContext, n: PNode): PNode = if sonsLen(n) != 3: - LocalError(n.info, errXExpectsTwoArguments, "is") + localError(n.info, errXExpectsTwoArguments, "is") result = n n.typ = getSysType(tyBool) @@ -353,7 +354,7 @@ proc semIs(c: PContext, n: PNode): PNode = let t1 = n[1].typ.sons[0] # BUGFIX: don't evaluate this too early: ``T is void`` - if not containsGenericType(t1): result = IsOpImpl(c, n) + if not containsGenericType(t1): result = isOpImpl(c, n) proc semOpAux(c: PContext, n: PNode) = const flags = {efDetermineType} @@ -385,8 +386,8 @@ proc changeType(n: PNode, newType: PType, check: bool) = changeType(n.sons[i], elemType(newType), check) of nkPar: if newType.kind != tyTuple: - InternalError(n.info, "changeType: no tuple type for constructor") - elif newType.n == nil: nil + internalError(n.info, "changeType: no tuple type for constructor") + elif newType.n == nil: discard elif sonsLen(n) > 0 and n.sons[0].kind == nkExprColonExpr: for i in countup(0, sonsLen(n) - 1): var m = n.sons[i].sons[0] @@ -410,9 +411,9 @@ proc changeType(n: PNode, newType: PType, check: bool) = if check: let value = n.intVal if value < firstOrd(newType) or value > lastOrd(newType): - LocalError(n.info, errGenerated, "cannot convert " & $value & + localError(n.info, errGenerated, "cannot convert " & $value & " to " & typeToString(newType)) - else: nil + else: discard n.typ = newType proc arrayConstrType(c: PContext, n: PNode): PType = @@ -422,7 +423,7 @@ proc arrayConstrType(c: PContext, n: PNode): PType = rawAddSon(typ, newTypeS(tyEmpty, c)) # needs an empty basetype! else: var x = n.sons[0] - var lastIndex: biggestInt = sonsLen(n) - 1 + var lastIndex: BiggestInt = sonsLen(n) - 1 var t = skipTypes(n.sons[0].typ, {tyGenericInst, tyVar, tyOrdinal}) addSonSkipIntLit(typ, t) typ.sons[0] = makeRangeType(c, 0, sonsLen(n) - 1, n.info) @@ -436,7 +437,7 @@ proc semArrayConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = rawAddSon(result.typ, newTypeS(tyEmpty, c)) # needs an empty basetype! else: var x = n.sons[0] - var lastIndex: biggestInt = 0 + var lastIndex: BiggestInt = 0 var indexType = getSysType(tyInt) if x.kind == nkExprColonExpr and sonsLen(x) == 2: var idx = semConstExpr(c, x.sons[0]) @@ -499,10 +500,10 @@ proc fixAbstractType(c: PContext, n: PNode) = changeType(it.sons[1], s, check=true) n.sons[i] = it.sons[1] of nkBracket: - # an implicitely constructed array (passed to an open array): + # an implicitly constructed array (passed to an open array): n.sons[i] = semArrayConstr(c, it, {}) else: - nil + discard #if (it.typ == nil): # InternalError(it.info, "fixAbstractType: " & renderTree(it)) @@ -573,7 +574,7 @@ proc analyseIfAddressTakenInCall(c: PContext, n: PNode) = skipTypes(t.sons[i], abstractInst-{tyTypeDesc}).kind == tyVar: if isAssignable(c, n.sons[i]) notin {arLValue, arLocalLValue}: if n.sons[i].kind != nkHiddenAddr: - LocalError(n.sons[i].info, errVarForOutParamNeeded) + localError(n.sons[i].info, errVarForOutParamNeeded) return for i in countup(1, sonsLen(n) - 1): if n.sons[i].kind == nkHiddenCallConv: @@ -631,25 +632,25 @@ proc evalAtCompileTime(c: PContext, n: PNode): PNode = call.add(a) #echo "NOW evaluating at compile time: ", call.renderTree if sfCompileTime in callee.flags: - result = evalStaticExpr(c, c.module, call, c.p.owner) + result = evalStaticExpr(c.module, call, c.p.owner) if result.isNil: - LocalError(n.info, errCannotInterpretNodeX, renderTree(call)) + localError(n.info, errCannotInterpretNodeX, renderTree(call)) else: - result = evalConstExpr(c, c.module, call) + result = evalConstExpr(c.module, call) if result.isNil: result = n #if result != n: # echo "SUCCESS evaluated at compile time: ", call.renderTree proc semStaticExpr(c: PContext, n: PNode): PNode = let a = semExpr(c, n.sons[0]) - result = evalStaticExpr(c, c.module, a, c.p.owner) + result = evalStaticExpr(c.module, a, c.p.owner) if result.isNil: - LocalError(n.info, errCannotInterpretNodeX, renderTree(n)) + localError(n.info, errCannotInterpretNodeX, renderTree(n)) result = emptyNode proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, flags: TExprFlags): PNode = - if flags*{efInTypeOf, efWantIterator} != {}: + if flags*{efInTypeof, efWantIterator} != {}: # consider: 'for x in pReturningArray()' --> we don't want the restriction # to 'skIterator' anymore; skIterator is preferred in sigmatch already for # typeof support. @@ -659,16 +660,17 @@ proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, else: result = semOverloadedCall(c, n, nOrig, {skProc, skMethod, skConverter, skMacro, skTemplate}) + if result != nil: if result.sons[0].kind != nkSym: - InternalError("semOverloadedCallAnalyseEffects") + internalError("semOverloadedCallAnalyseEffects") return let callee = result.sons[0].sym case callee.kind - of skMacro, skTemplate: nil + of skMacro, skTemplate: discard else: if (callee.kind == skIterator) and (callee.id == c.p.owner.id): - LocalError(n.info, errRecursiveDependencyX, callee.name.s) + localError(n.info, errRecursiveDependencyX, callee.name.s) if sfNoSideEffect notin callee.flags: if {sfImportc, sfSideEffect} * callee.flags != {}: incl(c.p.owner.flags, sfSideEffect) @@ -693,16 +695,16 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = semOpAux(c, n) var t: PType = nil if n.sons[0].typ != nil: - t = skipTypes(n.sons[0].typ, abstractInst-{tyTypedesc}) + t = skipTypes(n.sons[0].typ, abstractInst-{tyTypeDesc}) if t != nil and t.kind == tyProc: # This is a proc variable, apply normal overload resolution var m: TCandidate - initCandidate(m, t) + initCandidate(c, m, t) matches(c, n, nOrig, m) if m.state != csMatch: if c.inCompilesContext > 0: # speed up error generation: - GlobalError(n.Info, errTypeMismatch, "") + globalError(n.info, errTypeMismatch, "") return emptyNode else: var hasErrorType = false @@ -717,7 +719,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = if not hasErrorType: add(msg, ")\n" & msgKindToString(errButExpected) & "\n" & typeToString(n.sons[0].typ)) - LocalError(n.Info, errGenerated, msg) + localError(n.info, errGenerated, msg) return errorNode(c, n) result = nil else: @@ -729,8 +731,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = elif t != nil and t.kind == tyTypeDesc: if n.len == 1: return semObjConstr(c, n, flags) let destType = t.skipTypes({tyTypeDesc, tyGenericInst}) - result = semConv(c, n, symFromType(destType, n.info)) - return + return semConv(c, n) else: result = overloadedCallOpr(c, n) # Now that nkSym does not imply an iteration over the proc/iterator space, @@ -763,7 +764,8 @@ proc afterCallActions(c: PContext; n, orig: PNode, flags: TExprFlags): PNode = analyseIfAddressTakenInCall(c, result) if callee.magic != mNone: result = magicsAfterOverloadResolution(c, result, flags) - result = evalAtCompileTime(c, result) + if c.inTypeClass == 0: + result = evalAtCompileTime(c, result) proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = # this seems to be a hotspot in the compiler! @@ -771,6 +773,7 @@ proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = #semLazyOpAux(c, n) result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags) if result != nil: result = afterCallActions(c, result, nOrig, flags) + else: result = errorNode(c, n) proc buildStringify(c: PContext, arg: PNode): PNode = if arg.typ != nil and @@ -791,7 +794,7 @@ proc semEcho(c: PContext, n: PNode): PNode = let t = arg.typ if (t == nil or t.skipTypes(abstractInst).kind != tyString) and arg.kind != nkEmpty: - LocalError(n.info, errGenerated, + localError(n.info, errGenerated, "implicitly invoked '$' does not return string") let t = n.sons[0].typ if tfNoSideEffect notin t.flags: incl(c.p.owner.flags, sfSideEffect) @@ -800,11 +803,11 @@ proc semEcho(c: PContext, n: PNode): PNode = proc buildEchoStmt(c: PContext, n: PNode): PNode = # we MUST not check 'n' for semantics again here! result = newNodeI(nkCall, n.info) - var e = StrTableGet(magicsys.systemModule.Tab, getIdent"echo") + var e = strTableGet(magicsys.systemModule.tab, getIdent"echo") if e != nil: addSon(result, newSymNode(e)) else: - LocalError(n.info, errSystemNeeds, "echo") + localError(n.info, errSystemNeeds, "echo") addSon(result, errorNode(c, n)) var arg = buildStringify(c, n) # problem is: implicit '$' is not checked for semantics yet. So we give up @@ -814,7 +817,7 @@ proc buildEchoStmt(c: PContext, n: PNode): PNode = proc semExprNoType(c: PContext, n: PNode): PNode = result = semExpr(c, n, {efWantStmt}) - discardCheck(result) + discardCheck(c, result) proc isTypeExpr(n: PNode): bool = case n.kind @@ -834,7 +837,7 @@ proc lookupInRecordAndBuildCheck(c: PContext, n, r: PNode, field: PIdent, if result != nil: return of nkRecCase: checkMinSonsLen(r, 2) - if (r.sons[0].kind != nkSym): IllFormedAst(r) + if (r.sons[0].kind != nkSym): illFormedAst(r) result = lookupInRecordAndBuildCheck(c, n, r.sons[0], field, check) if result != nil: return var s = newNodeI(nkCurly, r.info) @@ -896,8 +899,9 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = # early exit for this; see tests/compile/tbindoverload.nim: if isSymChoice(n.sons[1]): return - var s = qualifiedLookup(c, n, {checkAmbiguity, checkUndeclared}) + var s = qualifiedLookUp(c, n, {checkAmbiguity, checkUndeclared}) if s != nil: + markUsed(n.sons[1], s) return semSym(c, n, s, flags) n.sons[0] = semExprWithType(c, n.sons[0], flags+{efDetermineType}) @@ -928,19 +932,26 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = let tParam = tbody.sons[s] if tParam.sym.name == i: let rawTyp = ty.sons[s + 1] - if rawTyp.kind == tyExpr: + if rawTyp.kind == tyStatic: return rawTyp.n else: let foundTyp = makeTypeDesc(c, rawTyp) return newSymNode(copySym(tParam.sym).linkTo(foundTyp), n.info) return + of tyObject, tyTuple: + if ty.n.kind == nkRecList: + for field in ty.n.sons: + if field.sym.name == i: + n.typ = newTypeWithSons(c, tyFieldAccessor, @[ty, field.sym.typ]) + n.typ.n = copyTree(n) + return n else: # echo "TYPE FIELD ACCESS" # debug ty return # XXX: This is probably not relevant any more # reset to prevent 'nil' bug: see "tests/reject/tenumitems.nim": - ty = n.sons[0].Typ + ty = n.sons[0].typ ty = skipTypes(ty, {tyGenericInst, tyVar, tyPtr, tyRef}) var check: PNode = nil @@ -954,10 +965,10 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = if f != nil: if fieldVisible(c, f): # is the access to a public field or in the same module or in a friend? + markUsed(n.sons[1], f) n.sons[0] = makeDeref(n.sons[0]) n.sons[1] = newSymNode(f) # we now have the correct field n.typ = f.typ - markUsed(n, f) if check == nil: result = n else: @@ -967,11 +978,11 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = elif ty.kind == tyTuple and ty.n != nil: f = getSymFromList(ty.n, i) if f != nil: + markUsed(n.sons[1], f) n.sons[0] = makeDeref(n.sons[0]) n.sons[1] = newSymNode(f) n.typ = f.typ result = n - markUsed(n, f) proc dotTransformation(c: PContext, n: PNode): PNode = if isSymChoice(n.sons[1]): @@ -1028,7 +1039,7 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode = n.sons[i] = semExprWithType(c, n.sons[i], flags*{efInTypeof, efDetermineType}) var indexType = if arr.kind == tyArray: arr.sons[0] else: getSysType(tyInt) - var arg = IndexTypesMatch(c, indexType, n.sons[1].typ, n.sons[1]) + var arg = indexTypesMatch(c, indexType, n.sons[1].typ, n.sons[1]) if arg != nil: n.sons[1] = arg result = n @@ -1038,7 +1049,9 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode = # The result so far is a tyTypeDesc bound # a tyGenericBody. The line below will substitute # it with the instantiated type. - result = symNodeFromType(c, semTypeNode(c, n, nil), n.info) + result = n + result.typ = makeTypeDesc(c, semTypeNode(c, n, nil)) + #result = symNodeFromType(c, semTypeNode(c, n, nil), n.info) of tyTuple: checkSonsLen(n, 2) n.sons[0] = makeDeref(n.sons[0]) @@ -1048,11 +1061,11 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode = {tyInt..tyInt64}: var idx = getOrdValue(n.sons[1]) if idx >= 0 and idx < sonsLen(arr): n.typ = arr.sons[int(idx)] - else: LocalError(n.info, errInvalidIndexValueForTuple) + else: localError(n.info, errInvalidIndexValueForTuple) else: - LocalError(n.info, errIndexTypesDoNotMatch) + localError(n.info, errIndexTypesDoNotMatch) result = n - else: nil + else: discard proc semArrayAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = result = semSubscript(c, n, flags) @@ -1082,13 +1095,13 @@ proc takeImplicitAddr(c: PContext, n: PNode): PNode = of nkHiddenDeref, nkDerefExpr: return n.sons[0] of nkBracketExpr: if len(n) == 1: return n.sons[0] - else: nil + else: discard var valid = isAssignable(c, n) if valid != arLValue: if valid == arLocalLValue: - LocalError(n.info, errXStackEscape, renderTree(n, {renderNoComments})) + localError(n.info, errXStackEscape, renderTree(n, {renderNoComments})) else: - LocalError(n.info, errExprHasNoAddress) + localError(n.info, errExprHasNoAddress) result = newNodeIT(nkHiddenAddr, n.info, makePtrType(c, n.typ)) result.add(n) @@ -1137,7 +1150,7 @@ proc semAsgn(c: PContext, n: PNode): PNode = # a = b # b no 'var T' means: a = addr(b) var le = a.typ if skipTypes(le, {tyGenericInst}).kind != tyVar and - IsAssignable(c, a) == arNone: + isAssignable(c, a) == arNone: # Direct assignment to a discriminant is allowed! localError(a.info, errXCannotBeAssignedTo, renderTree(a, {renderNoComments})) @@ -1149,10 +1162,10 @@ proc semAsgn(c: PContext, n: PNode): PNode = rhs = semExprWithType(c, n.sons[1], if lhsIsResult: {efAllowDestructor} else: {}) if lhsIsResult: - n.typ = EnforceVoidContext - if lhs.sym.typ.kind == tyGenericParam: - if matchTypeClass(lhs.typ, rhs.typ): - InternalAssert c.p.resultSym != nil + n.typ = enforceVoidContext + if lhs.sym.typ.isMetaType and lhs.sym.typ.kind != tyTypeDesc: + if cmpTypes(c, lhs.typ, rhs.typ) == isGeneric: + internalAssert c.p.resultSym != nil lhs.typ = rhs.typ c.p.resultSym.typ = rhs.typ c.p.owner.typ.sons[0] = rhs.typ @@ -1164,7 +1177,7 @@ proc semAsgn(c: PContext, n: PNode): PNode = asgnToResultVar(c, n, n.sons[0], n.sons[1]) result = n -proc SemReturn(c: PContext, n: PNode): PNode = +proc semReturn(c: PContext, n: PNode): PNode = result = n checkSonsLen(n, 1) if c.p.owner.kind in {skConverter, skMethod, skProc, skMacro} or @@ -1180,9 +1193,9 @@ proc SemReturn(c: PContext, n: PNode): PNode = if n[0][1].kind == nkSym and n[0][1].sym == c.p.resultSym: n.sons[0] = ast.emptyNode else: - LocalError(n.info, errNoReturnTypeDeclared) + localError(n.info, errNoReturnTypeDeclared) else: - LocalError(n.info, errXNotAllowedHere, "\'return\'") + localError(n.info, errXNotAllowedHere, "\'return\'") proc semProcBody(c: PContext, n: PNode): PNode = openScope(c) @@ -1191,7 +1204,7 @@ proc semProcBody(c: PContext, n: PNode): PNode = # transform ``expr`` to ``result = expr``, but not if the expr is already # ``result``: if result.kind == nkSym and result.sym == c.p.resultSym: - nil + discard elif result.kind == nkNilLit: # or ImplicitlyDiscardable(result): # new semantic: 'result = x' triggers the void context @@ -1208,10 +1221,10 @@ proc semProcBody(c: PContext, n: PNode): PNode = a.sons[1] = result result = semAsgn(c, a) else: - discardCheck(result) + discardCheck(c, result) closeScope(c) -proc SemYieldVarResult(c: PContext, n: PNode, restype: PType) = +proc semYieldVarResult(c: PContext, n: PNode, restype: PType) = var t = skipTypes(restype, {tyGenericInst}) case t.kind of tyVar: @@ -1228,22 +1241,22 @@ proc SemYieldVarResult(c: PContext, n: PNode, restype: PType) = a.sons[i] = takeImplicitAddr(c, a.sons[i]) else: localError(n.sons[0].info, errXExpected, "tuple constructor") - else: nil + else: discard -proc SemYield(c: PContext, n: PNode): PNode = +proc semYield(c: PContext, n: PNode): PNode = result = n checkSonsLen(n, 1) if c.p.owner == nil or c.p.owner.kind != skIterator: - LocalError(n.info, errYieldNotAllowedHere) + localError(n.info, errYieldNotAllowedHere) elif c.p.inTryStmt > 0 and c.p.owner.typ.callConv != ccInline: - LocalError(n.info, errYieldNotAllowedInTryStmt) + localError(n.info, errYieldNotAllowedInTryStmt) elif n.sons[0].kind != nkEmpty: - n.sons[0] = SemExprWithType(c, n.sons[0]) # check for type compatibility: + n.sons[0] = semExprWithType(c, n.sons[0]) # check for type compatibility: var restype = c.p.owner.typ.sons[0] if restype != nil: n.sons[0] = fitNode(c, restype, n.sons[0]) - if n.sons[0].typ == nil: InternalError(n.info, "semYield") - SemYieldVarResult(c, n, restype) + if n.sons[0].typ == nil: internalError(n.info, "semYield") + semYieldVarResult(c, n, restype) else: localError(n.info, errCannotReturnExpr) elif c.p.owner.typ.sons[0] != nil: @@ -1255,37 +1268,37 @@ proc lookUpForDefined(c: PContext, i: PIdent, onlyCurrentScope: bool): PSym = else: result = searchInScopes(c, i) # no need for stub loading -proc LookUpForDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PSym = +proc lookUpForDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PSym = case n.kind of nkIdent: - result = LookupForDefined(c, n.ident, onlyCurrentScope) + result = lookUpForDefined(c, n.ident, onlyCurrentScope) of nkDotExpr: result = nil if onlyCurrentScope: return checkSonsLen(n, 2) - var m = LookupForDefined(c, n.sons[0], onlyCurrentScope) + var m = lookUpForDefined(c, n.sons[0], onlyCurrentScope) if (m != nil) and (m.kind == skModule): if (n.sons[1].kind == nkIdent): var ident = n.sons[1].ident if m == c.module: - result = StrTableGet(c.topLevelScope.symbols, ident) + result = strTableGet(c.topLevelScope.symbols, ident) else: - result = StrTableGet(m.tab, ident) + result = strTableGet(m.tab, ident) else: - LocalError(n.sons[1].info, errIdentifierExpected, "") + localError(n.sons[1].info, errIdentifierExpected, "") of nkAccQuoted: - result = lookupForDefined(c, considerAcc(n), onlyCurrentScope) + result = lookUpForDefined(c, considerAcc(n), onlyCurrentScope) of nkSym: result = n.sym else: - LocalError(n.info, errIdentifierExpected, renderTree(n)) + localError(n.info, errIdentifierExpected, renderTree(n)) result = nil proc semDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PNode = checkSonsLen(n, 2) # we replace this node by a 'true' or 'false' node: result = newIntNode(nkIntLit, 0) - if LookUpForDefined(c, n.sons[1], onlyCurrentScope) != nil: + if lookUpForDefined(c, n.sons[1], onlyCurrentScope) != nil: result.intVal = 1 elif not onlyCurrentScope and (n.sons[1].kind == nkIdent) and condsyms.isDefined(n.sons[1].ident): @@ -1302,18 +1315,18 @@ proc expectMacroOrTemplateCall(c: PContext, n: PNode): PSym = ## The argument to the proc should be nkCall(...) or similar ## Returns the macro/template symbol if isCallExpr(n): - var expandedSym = qualifiedLookup(c, n[0], {checkUndeclared}) + var expandedSym = qualifiedLookUp(c, n[0], {checkUndeclared}) if expandedSym == nil: - LocalError(n.info, errUndeclaredIdentifier, n[0].renderTree) + localError(n.info, errUndeclaredIdentifier, n[0].renderTree) return errorSym(c, n[0]) if expandedSym.kind notin {skMacro, skTemplate}: - LocalError(n.info, errXisNoMacroOrTemplate, expandedSym.name.s) + localError(n.info, errXisNoMacroOrTemplate, expandedSym.name.s) return errorSym(c, n[0]) result = expandedSym else: - LocalError(n.info, errXisNoMacroOrTemplate, n.renderTree) + localError(n.info, errXisNoMacroOrTemplate, n.renderTree) result = errorSym(c, n) proc expectString(c: PContext, n: PNode): string = @@ -1321,10 +1334,10 @@ proc expectString(c: PContext, n: PNode): string = if n.kind in nkStrKinds: return n.strVal else: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) proc getMagicSym(magic: TMagic): PSym = - result = newSym(skProc, getIdent($magic), GetCurrOwner(), gCodegenLineInfo) + result = newSym(skProc, getIdent($magic), getCurrOwner(), gCodegenLineInfo) result.magic = magic proc newAnonSym(kind: TSymKind, info: TLineInfo, @@ -1344,9 +1357,9 @@ proc semUsing(c: PContext, n: PNode): PNode = of skProcKinds: addDeclAt(c.currentScope, usedSym.sym) continue - else: nil + else: discard - LocalError(e.info, errUsingNoSymbol, e.renderTree) + localError(e.info, errUsingNoSymbol, e.renderTree) proc semExpandToAst(c: PContext, n: PNode): PNode = var macroCall = n[1] @@ -1360,7 +1373,7 @@ proc semExpandToAst(c: PContext, n: PNode): PNode = macroCall.sons[i] = semExprWithType(c, macroCall[i], {}) # Preserve the magic symbol in order to be handled in evals.nim - InternalAssert n.sons[0].sym.magic == mExpandToAst + internalAssert n.sons[0].sym.magic == mExpandToAst n.typ = getSysSym("PNimrodNode").typ # expandedSym.getReturnType result = n @@ -1397,7 +1410,7 @@ proc processQuotations(n: var PNode, op: string, processQuotations(n.sons[i], op, quotes, ids) proc semQuoteAst(c: PContext, n: PNode): PNode = - InternalAssert n.len == 2 or n.len == 3 + internalAssert n.len == 2 or n.len == 3 # We transform the do block into a template with a param for # each interpolation. We'll pass this template to getAst. var @@ -1410,7 +1423,7 @@ proc semQuoteAst(c: PContext, n: PNode): PNode = # this will store the generated param names if doBlk.kind != nkDo: - LocalError(n.info, errXExpected, "block") + localError(n.info, errXExpected, "block") processQuotations(doBlk.sons[bodyPos], op, quotes, ids) @@ -1429,12 +1442,12 @@ proc semQuoteAst(c: PContext, n: PNode): PNode = newNode(nkCall, n.info, quotes)]) result = semExpandToAst(c, result) -proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = +proc tryExpr(c: PContext, n: PNode, + flags: TExprFlags = {}, bufferErrors = false): PNode = # watch out, hacks ahead: let oldErrorCount = msgs.gErrorCounter let oldErrorMax = msgs.gErrorMax - inc c.InCompilesContext - inc msgs.gSilence + inc c.inCompilesContext # do not halt after first error: msgs.gErrorMax = high(int) @@ -1443,29 +1456,31 @@ proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = openScope(c) let oldOwnerLen = len(gOwners) let oldGenerics = c.generics + let oldErrorOutputs = errorOutputs + errorOutputs = if bufferErrors: {eInMemory} else: {} let oldContextLen = msgs.getInfoContextLen() - let oldInGenericContext = c.InGenericContext - let oldInUnrolledContext = c.InUnrolledContext - let oldInGenericInst = c.InGenericInst + let oldInGenericContext = c.inGenericContext + let oldInUnrolledContext = c.inUnrolledContext + let oldInGenericInst = c.inGenericInst let oldProcCon = c.p c.generics = @[] try: result = semExpr(c, n, flags) if msgs.gErrorCounter != oldErrorCount: result = nil except ERecoverableError: - nil + discard # undo symbol table changes (as far as it's possible): c.generics = oldGenerics - c.InGenericContext = oldInGenericContext - c.InUnrolledContext = oldInUnrolledContext - c.InGenericInst = oldInGenericInst + c.inGenericContext = oldInGenericContext + c.inUnrolledContext = oldInUnrolledContext + c.inGenericInst = oldInGenericInst c.p = oldProcCon msgs.setInfoContextLen(oldContextLen) - setlen(gOwners, oldOwnerLen) + setLen(gOwners, oldOwnerLen) c.currentScope = oldScope - dec c.InCompilesContext - dec msgs.gSilence + dec c.inCompilesContext + errorOutputs = oldErrorOutputs msgs.gErrorCounter = oldErrorCount msgs.gErrorMax = oldErrorMax @@ -1542,7 +1557,7 @@ proc semWhen(c: PContext, n: PNode, semCheck = true): PNode = # The ``when`` statement implements the mechanism for platform dependent # code. Thus we try to ensure here consistent ID allocation after the # ``when`` statement. - IDsynchronizationPoint(200) + idSynchronizationPoint(200) proc semSetConstr(c: PContext, n: PNode): PNode = result = newNodeI(nkCurly, n.info) @@ -1571,10 +1586,10 @@ proc semSetConstr(c: PContext, n: PNode): PNode = if typ == nil: typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyOrdinal}) if not isOrdinalType(typ): - LocalError(n.info, errOrdinalTypeExpected) - typ = makeRangeType(c, 0, MaxSetElements - 1, n.info) + localError(n.info, errOrdinalTypeExpected) + typ = makeRangeType(c, 0, MaxSetElements-1, n.info) elif lengthOrd(typ) > MaxSetElements: - typ = makeRangeType(c, 0, MaxSetElements - 1, n.info) + typ = makeRangeType(c, 0, MaxSetElements-1, n.info) addSonSkipIntLit(result.typ, typ) for i in countup(0, sonsLen(n) - 1): var m: PNode @@ -1611,28 +1626,28 @@ proc semTableConstr(c: PContext, n: PNode): PNode = if lastKey != n.len: illFormedAst(n) result = semExpr(c, result) -type - TParKind = enum +type + TParKind = enum paNone, paSingle, paTupleFields, paTuplePositions -proc checkPar(n: PNode): TParKind = +proc checkPar(n: PNode): TParKind = var length = sonsLen(n) if length == 0: result = paTuplePositions # () elif length == 1: result = paSingle # (expr) - else: + else: if n.sons[0].kind == nkExprColonExpr: result = paTupleFields else: result = paTuplePositions - for i in countup(0, length - 1): - if result == paTupleFields: + for i in countup(0, length - 1): + if result == paTupleFields: if (n.sons[i].kind != nkExprColonExpr) or - not (n.sons[i].sons[0].kind in {nkSym, nkIdent}): - LocalError(n.sons[i].info, errNamedExprExpected) + not (n.sons[i].sons[0].kind in {nkSym, nkIdent}): + localError(n.sons[i].info, errNamedExprExpected) return paNone - else: - if n.sons[i].kind == nkExprColonExpr: - LocalError(n.sons[i].info, errNamedExprNotAllowed) + else: + if n.sons[i].kind == nkExprColonExpr: + localError(n.sons[i].info, errNamedExprNotAllowed) return paNone proc semTupleFieldsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = @@ -1641,13 +1656,12 @@ proc semTupleFieldsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = typ.n = newNodeI(nkRecList, n.info) # nkIdentDefs var ids = initIntSet() for i in countup(0, sonsLen(n) - 1): - if (n.sons[i].kind != nkExprColonExpr) or - not (n.sons[i].sons[0].kind in {nkSym, nkIdent}): + if n[i].kind != nkExprColonExpr or n[i][0].kind notin {nkSym, nkIdent}: illFormedAst(n.sons[i]) var id: PIdent if n.sons[i].sons[0].kind == nkIdent: id = n.sons[i].sons[0].ident else: id = n.sons[i].sons[0].sym.name - if ContainsOrIncl(ids, id.id): + if containsOrIncl(ids, id.id): localError(n.sons[i].info, errFieldInitTwice, id.s) n.sons[i].sons[1] = semExprWithType(c, n.sons[i].sons[1], flags*{efAllowDestructor}) @@ -1674,7 +1688,7 @@ proc checkInitialized(n: PNode, ids: TIntSet, info: TLineInfo) = for i in countup(0, sonsLen(n) - 1): checkInitialized(n.sons[i], ids, info) of nkRecCase: - if (n.sons[0].kind != nkSym): InternalError(info, "checkInitialized") + if (n.sons[0].kind != nkSym): internalError(info, "checkInitialized") checkInitialized(n.sons[0], ids, info) when false: # XXX we cannot check here, as we don't know the branch! @@ -1684,7 +1698,7 @@ proc checkInitialized(n: PNode, ids: TIntSet, info: TLineInfo) = else: internalError(info, "checkInitialized") of nkSym: if tfNeedsInit in n.sym.typ.flags and n.sym.name.id notin ids: - Message(info, errGenerated, "field not initialized: " & n.sym.name.s) + message(info, errGenerated, "field not initialized: " & n.sym.name.s) else: internalError(info, "checkInitialized") proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = @@ -1692,8 +1706,8 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = result = n result.typ = t result.kind = nkObjConstr - t = skipTypes(t, abstractInst) - if t.kind == tyRef: t = skipTypes(t.sons[0], abstractInst) + t = skipTypes(t, {tyGenericInst}) + if t.kind == tyRef: t = skipTypes(t.sons[0], {tyGenericInst}) if t.kind != tyObject: localError(n.info, errGenerated, "object constructor needs an object type") return @@ -1707,7 +1721,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = var id: PIdent if it.sons[0].kind == nkIdent: id = it.sons[0].ident else: id = it.sons[0].sym.name - if ContainsOrIncl(ids, id.id): + if containsOrIncl(ids, id.id): localError(it.info, errFieldInitTwice, id.s) var e = semExprWithType(c, it.sons[1], flags*{efAllowDestructor}) var @@ -1740,7 +1754,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = proc semBlock(c: PContext, n: PNode): PNode = result = n - Inc(c.p.nestedBlockCounter) + inc(c.p.nestedBlockCounter) checkSonsLen(n, 2) openScope(c) # BUGFIX: label is in the scope of block! if n.sons[0].kind != nkEmpty: @@ -1754,7 +1768,7 @@ proc semBlock(c: PContext, n: PNode): PNode = if isEmptyType(n.typ): n.kind = nkBlockStmt else: n.kind = nkBlockExpr closeScope(c) - Dec(c.p.nestedBlockCounter) + dec(c.p.nestedBlockCounter) proc buildCall(n: PNode): PNode = if n.kind == nkDotExpr and n.len == 2: @@ -1820,13 +1834,13 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = if result.kind == nkSym: markIndirect(c, result.sym) if isGenericRoutine(result.sym): - LocalError(n.info, errInstantiateXExplicitely, s.name.s) + localError(n.info, errInstantiateXExplicitely, s.name.s) of nkSym: # 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) of nkEmpty, nkNone, nkCommentStmt: - nil + discard of nkNilLit: result.typ = getSysType(tyNil) of nkIntLit: @@ -1867,17 +1881,20 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result.kind = nkCall result = semExpr(c, result, flags) of nkBind: - Message(n.info, warnDeprecated, "bind") + message(n.info, warnDeprecated, "bind") result = semExpr(c, n.sons[0], flags) - of nkTypeOfExpr, nkTupleTy, nkRefTy..nkEnumTy: + of nkTypeOfExpr, nkTupleTy, nkRefTy..nkEnumTy, nkStaticTy: var typ = semTypeNode(c, n, nil).skipTypes({tyTypeDesc}) - result = symNodeFromType(c, typ, n.info) + result.typ = makeTypeDesc(c, typ) + #result = symNodeFromType(c, typ, n.info) of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: # check if it is an expression macro: checkMinSonsLen(n, 1) let mode = if nfDelegate in n.flags: {} else: {checkUndeclared} - var s = qualifiedLookup(c, n.sons[0], mode) + var s = qualifiedLookUp(c, n.sons[0], mode) if s != nil: + if gCmd == cmdPretty and n.sons[0].kind == nkDotExpr: + pretty.checkUse(n.sons[0].sons[1], s) case s.kind of skMacro: if sfImmediate notin s.flags: @@ -1894,11 +1911,11 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = of skType: # XXX think about this more (``set`` procs) if n.len == 2: - result = semConv(c, n, s) + result = semConv(c, n) elif n.len == 1: result = semObjConstr(c, n, flags) - elif Contains(c.AmbiguousSymbols, s.id): - LocalError(n.info, errUseQualifier, s.name.s) + elif contains(c.ambiguousSymbols, s.id): + localError(n.info, errUseQualifier, s.name.s) elif s.magic == mNone: result = semDirectOp(c, n, flags) else: result = semMagic(c, n, s, flags) of skProc, skMethod, skConverter, skIterator: @@ -1922,12 +1939,14 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result = semExpr(c, result, flags) of nkBracketExpr: checkMinSonsLen(n, 1) - var s = qualifiedLookup(c, n.sons[0], {checkUndeclared}) + var s = qualifiedLookUp(c, n.sons[0], {checkUndeclared}) if s != nil and s.kind in {skProc, skMethod, skConverter, skIterator}: # type parameters: partial generic specialization n.sons[0] = semSymGenericInstantiation(c, n.sons[0], s) result = explicitGenericInstantiation(c, n, s) - else: + elif s != nil and s.kind in {skType}: + result = symNodeFromType(c, semTypeNode(c, n, nil), n.info) + else: result = semArrayAccess(c, n, flags) of nkCurlyExpr: result = semExpr(c, buildOverloadedSubscripts(n, getIdent"{}"), flags) @@ -1950,7 +1969,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = checkSonsLen(n, 1) n.sons[0] = semExprWithType(c, n.sons[0]) if isAssignable(c, n.sons[0]) notin {arLValue, arLocalLValue}: - LocalError(n.info, errExprHasNoAddress) + localError(n.info, errExprHasNoAddress) n.typ = makePtrType(c, n.sons[0].typ) of nkHiddenAddr, nkHiddenDeref: checkSonsLen(n, 1) @@ -1974,12 +1993,12 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result = semStaticExpr(c, n) of nkAsgn: result = semAsgn(c, n) of nkBlockStmt, nkBlockExpr: result = semBlock(c, n) - of nkStmtList, nkStmtListExpr: result = semStmtList(c, n) + of nkStmtList, nkStmtListExpr: result = semStmtList(c, n, flags) of nkRaiseStmt: result = semRaise(c, n) of nkVarSection: result = semVarOrLet(c, n, skVar) of nkLetSection: result = semVarOrLet(c, n, skLet) of nkConstSection: result = semConst(c, n) - of nkTypeSection: result = SemTypeSection(c, n) + of nkTypeSection: result = semTypeSection(c, n) of nkDiscardStmt: result = semDiscard(c, n) of nkWhileStmt: result = semWhile(c, n) of nkTryStmt: result = semTry(c, n) @@ -1998,25 +2017,25 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = of nkMacroDef: result = semMacroDef(c, n) of nkTemplateDef: result = semTemplateDef(c, n) of nkImportStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "import") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "import") result = evalImport(c, n) of nkImportExceptStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "import") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "import") result = evalImportExcept(c, n) of nkFromStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "from") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "from") result = evalFrom(c, n) of nkIncludeStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "include") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "include") result = evalInclude(c, n) of nkExportStmt, nkExportExceptStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "export") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "export") result = semExport(c, n) of nkPragmaBlock: result = semPragmaBlock(c, n) of nkStaticStmt: result = semStaticStmt(c, n) else: - LocalError(n.info, errInvalidExpressionX, + localError(n.info, errInvalidExpressionX, renderTree(n, {renderNoComments})) if result != nil: incl(result.flags, nfSem) diff --git a/compiler/semfold.nim b/compiler/semfold.nim index ca06ea1b6..4740ddcb3 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -66,14 +66,14 @@ proc ordinalValToString*(a: PNode): string = of tyEnum: var n = t.n for i in countup(0, sonsLen(n) - 1): - if n.sons[i].kind != nkSym: InternalError(a.info, "ordinalValToString") + if n.sons[i].kind != nkSym: internalError(a.info, "ordinalValToString") var field = n.sons[i].sym if field.position == x: if field.ast == nil: return field.name.s else: return field.ast.strVal - InternalError(a.info, "no symbol for ordinal value: " & $x) + internalError(a.info, "no symbol for ordinal value: " & $x) else: result = $x @@ -92,7 +92,7 @@ proc pickIntRange(a, b: PType): PType = proc isIntRangeOrLit(t: PType): bool = result = isIntRange(t) or isIntLit(t) -proc pickMinInt(n: PNode): biggestInt = +proc pickMinInt(n: PNode): BiggestInt = if n.kind in {nkIntLit..nkUInt64Lit}: result = n.intVal elif isIntLit(n.typ): @@ -100,9 +100,9 @@ proc pickMinInt(n: PNode): biggestInt = elif isIntRange(n.typ): result = firstOrd(n.typ) else: - InternalError(n.info, "pickMinInt") + internalError(n.info, "pickMinInt") -proc pickMaxInt(n: PNode): biggestInt = +proc pickMaxInt(n: PNode): BiggestInt = if n.kind in {nkIntLit..nkUInt64Lit}: result = n.intVal elif isIntLit(n.typ): @@ -110,9 +110,9 @@ proc pickMaxInt(n: PNode): biggestInt = elif isIntRange(n.typ): result = lastOrd(n.typ) else: - InternalError(n.info, "pickMaxInt") + internalError(n.info, "pickMaxInt") -proc makeRange(typ: PType, first, last: biggestInt): PType = +proc makeRange(typ: PType, first, last: BiggestInt): PType = var n = newNode(nkRange) addSon(n, newIntNode(nkIntLit, min(first, last))) addSon(n, newIntNode(nkIntLit, max(first, last))) @@ -120,7 +120,7 @@ proc makeRange(typ: PType, first, last: biggestInt): PType = result.n = n addSonSkipIntLit(result, skipTypes(typ, {tyRange})) -proc makeRangeF(typ: PType, first, last: biggestFloat): PType = +proc makeRangeF(typ: PType, first, last: BiggestFloat): PType = var n = newNode(nkRange) addSon(n, newFloatNode(nkFloatLit, min(first.float, last.float))) addSon(n, newFloatNode(nkFloatLit, max(first.float, last.float))) @@ -222,13 +222,40 @@ proc getIntervalType*(m: TMagic, n: PNode): PType = commutativeOp(min) of mMaxI, mMaxI64: commutativeOp(max) - else: nil + else: discard discard """ mShlI, mShlI64, mShrI, mShrI64, mAddF64, mSubF64, mMulF64, mDivF64, mMaxF64, mMinF64 """ +proc evalIs(n, a: PNode): PNode = + # XXX: This should use the standard isOpImpl + internalAssert a.kind == nkSym and a.sym.kind == skType + internalAssert n.sonsLen == 3 and + n[2].kind in {nkStrLit..nkTripleStrLit, nkType} + + let t1 = a.sym.typ + + if n[2].kind in {nkStrLit..nkTripleStrLit}: + case n[2].strVal.normalize + of "closure": + let t = skipTypes(t1, abstractRange) + result = newIntNode(nkIntLit, ord(t.kind == tyProc and + t.callConv == ccClosure and + tfIterator notin t.flags)) + of "iterator": + let t = skipTypes(t1, abstractRange) + result = newIntNode(nkIntLit, ord(t.kind == tyProc and + t.callConv == ccClosure and + tfIterator in t.flags)) + else: + # XXX semexprs.isOpImpl is slightly different and requires a context. yay. + let t2 = n[2].typ + var match = sameType(t1, t2) + result = newIntNode(nkIntLit, ord(match)) + result.typ = n.typ + proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = # b and c may be nil result = nil @@ -276,7 +303,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = of tyInt32: result = newIntNodeT(int32(getInt(a)) shl int32(getInt(b)), n) of tyInt64, tyInt, tyUInt..tyUInt64: result = newIntNodeT(`shl`(getInt(a), getInt(b)), n) - else: InternalError(n.info, "constant folding for shl") + else: internalError(n.info, "constant folding for shl") of mShrI, mShrI64: case skipTypes(n.typ, abstractRange).kind of tyInt8: result = newIntNodeT(int8(getInt(a)) shr int8(getInt(b)), n) @@ -284,7 +311,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = of tyInt32: result = newIntNodeT(int32(getInt(a)) shr int32(getInt(b)), n) of tyInt64, tyInt, tyUInt..tyUInt64: result = newIntNodeT(`shr`(getInt(a), getInt(b)), n) - else: InternalError(n.info, "constant folding for shr") + else: internalError(n.info, "constant folding for shr") of mDivI, mDivI64: result = newIntNodeT(getInt(a) div getInt(b), n) of mModI, mModI64: result = newIntNodeT(getInt(a) mod getInt(b), n) of mAddF64: result = newFloatNodeT(getFloat(a) + getFloat(b), n) @@ -327,10 +354,10 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = of mMulU: result = newIntNodeT(`*%`(getInt(a), getInt(b)), n) of mModU: result = newIntNodeT(`%%`(getInt(a), getInt(b)), n) of mDivU: result = newIntNodeT(`/%`(getInt(a), getInt(b)), n) - of mLeSet: result = newIntNodeT(Ord(containsSets(a, b)), n) - of mEqSet: result = newIntNodeT(Ord(equalSets(a, b)), n) + of mLeSet: result = newIntNodeT(ord(containsSets(a, b)), n) + of mEqSet: result = newIntNodeT(ord(equalSets(a, b)), n) of mLtSet: - result = newIntNodeT(Ord(containsSets(a, b) and not equalSets(a, b)), n) + result = newIntNodeT(ord(containsSets(a, b) and not equalSets(a, b)), n) of mMulSet: result = nimsets.intersectSets(a, b) result.info = n.info @@ -344,7 +371,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = result = nimsets.symdiffSets(a, b) result.info = n.info of mConStrStr: result = newStrNodeT(getStrOrChar(a) & getStrOrChar(b), n) - of mInSet: result = newIntNodeT(Ord(inSet(a, b)), n) + of mInSet: result = newIntNodeT(ord(inSet(a, b)), n) of mRepr: # BUGFIX: we cannot eval mRepr here for reasons that I forgot. of mIntToStr, mInt64ToStr: result = newStrNodeT($(getOrdValue(a)), n) @@ -363,19 +390,19 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = result = copyTree(a) result.typ = n.typ of mCompileOption: - result = newIntNodeT(Ord(commands.testCompileOption(a.getStr, n.info)), n) + result = newIntNodeT(ord(commands.testCompileOption(a.getStr, n.info)), n) of mCompileOptionArg: - result = newIntNodeT(Ord( + result = newIntNodeT(ord( testCompileOptionArg(getStr(a), getStr(b), n.info)), n) of mNewString, mNewStringOfCap, mExit, mInc, ast.mDec, mEcho, mSwap, mAppendStrCh, mAppendStrStr, mAppendSeqElem, mSetLengthStr, mSetLengthSeq, mParseExprToAst, mParseStmtToAst, mExpandToAst, mTypeTrait, mNLen..mNError, mEqRef, mSlurp, mStaticExec, mNGenSym: - nil + discard of mRand: result = newIntNodeT(math.random(a.getInt.int), n) - else: InternalError(a.info, "evalOp(" & $m & ')') + else: internalError(a.info, "evalOp(" & $m & ')') proc getConstIfExpr(c: PSym, n: PNode): PNode = result = nil @@ -425,13 +452,13 @@ proc leValueConv(a, b: PNode): bool = case b.kind of nkCharLit..nkUInt64Lit: result = a.intVal <= b.intVal of nkFloatLit..nkFloat128Lit: result = a.intVal <= round(b.floatVal) - else: InternalError(a.info, "leValueConv") + else: internalError(a.info, "leValueConv") of nkFloatLit..nkFloat128Lit: case b.kind of nkFloatLit..nkFloat128Lit: result = a.floatVal <= b.floatVal of nkCharLit..nkUInt64Lit: result = a.floatVal <= toFloat(int(b.intVal)) - else: InternalError(a.info, "leValueConv") - else: InternalError(a.info, "leValueConv") + else: internalError(a.info, "leValueConv") + else: internalError(a.info, "leValueConv") proc magicCall(m: PSym, n: PNode): PNode = if sonsLen(n) <= 1: return @@ -446,8 +473,6 @@ proc magicCall(m: PSym, n: PNode): PNode = if sonsLen(n) > 3: c = getConstExpr(m, n.sons[3]) if c == nil: return - else: - b = nil result = evalOp(s.magic, n, a, b, c) proc getAppType(n: PNode): PNode = @@ -460,9 +485,9 @@ proc getAppType(n: PNode): PNode = else: result = newStrNodeT("console", n) -proc rangeCheck(n: PNode, value: biggestInt) = +proc rangeCheck(n: PNode, value: BiggestInt) = if value < firstOrd(n.typ) or value > lastOrd(n.typ): - LocalError(n.info, errGenerated, "cannot convert " & $value & + localError(n.info, errGenerated, "cannot convert " & $value & " to " & typeToString(n.typ)) proc foldConv*(n, a: PNode; check = false): PNode = @@ -485,7 +510,7 @@ proc foldConv*(n, a: PNode; check = false): PNode = result = a result.typ = n.typ of tyOpenArray, tyVarargs, tyProc: - nil + discard else: result = a result.typ = n.typ @@ -511,19 +536,19 @@ proc foldArrayAccess(m: PSym, n: PNode): PNode = result = x.sons[int(idx)] if result.kind == nkExprColonExpr: result = result.sons[1] else: - LocalError(n.info, errIndexOutOfBounds) + localError(n.info, errIndexOutOfBounds) of nkBracket, nkMetaNode: if (idx >= 0) and (idx < sonsLen(x)): result = x.sons[int(idx)] - else: LocalError(n.info, errIndexOutOfBounds) + else: localError(n.info, errIndexOutOfBounds) of nkStrLit..nkTripleStrLit: result = newNodeIT(nkCharLit, x.info, n.typ) if (idx >= 0) and (idx < len(x.strVal)): result.intVal = ord(x.strVal[int(idx)]) elif idx == len(x.strVal): - nil + discard else: - LocalError(n.info, errIndexOutOfBounds) - else: nil + localError(n.info, errIndexOutOfBounds) + else: discard proc foldFieldAccess(m: PSym, n: PNode): PNode = # a real field access; proc calls have already been transformed @@ -587,12 +612,13 @@ proc getConstExpr(m: PSym, n: PNode): PNode = of skType: result = newSymNodeTypeDesc(s, n.info) of skGenericParam: - if s.typ.kind == tyExpr: - result = s.typ.n - result.typ = s.typ.sons[0] + if s.typ.kind == tyStatic: + if s.typ.n != nil: + result = s.typ.n + result.typ = s.typ.sons[0] else: result = newSymNodeTypeDesc(s, n.info) - else: nil + else: discard of nkCharLit..nkNilLit: result = copyNode(n) of nkIfExpr: @@ -604,11 +630,12 @@ proc getConstExpr(m: PSym, n: PNode): PNode = try: case s.magic of mNone: - return # XXX: if it has no sideEffect, it should be evaluated + # If it has no sideEffect, it should be evaluated. But not here. + return of mSizeOf: var a = n.sons[1] if computeSize(a.typ) < 0: - LocalError(a.info, errCannotEvalXBecauseIncompletelyDefined, + localError(a.info, errCannotEvalXBecauseIncompletelyDefined, "sizeof") result = nil elif skipTypes(a.typ, typedescInst).kind in @@ -644,12 +671,16 @@ proc getConstExpr(m: PSym, n: PNode): PNode = result = newStrNodeT(renderTree(n[1], {renderNoComments}), n) of mConStrStr: result = foldConStrStr(m, n) + of mIs: + let a = getConstExpr(m, n[1]) + if a != nil and a.kind == nkSym and a.sym.kind == skType: + result = evalIs(n, a) else: result = magicCall(m, n) except EOverflow: - LocalError(n.info, errOverOrUnderflow) + localError(n.info, errOverOrUnderflow) except EDivByZero: - LocalError(n.info, errConstantDivisionByZero) + localError(n.info, errConstantDivisionByZero) of nkAddr: var a = getConstExpr(m, n.sons[0]) if a != nil: @@ -705,7 +736,7 @@ proc getConstExpr(m: PSym, n: PNode): PNode = result = a # a <= x and x <= b result.typ = n.typ else: - LocalError(n.info, errGenerated, `%`( + localError(n.info, errGenerated, `%`( msgKindToString(errIllegalConvFromXtoY), [typeToString(n.sons[0].typ), typeToString(n.typ)])) of nkStringToCString, nkCStringToString: @@ -727,4 +758,4 @@ proc getConstExpr(m: PSym, n: PNode): PNode = of nkBracketExpr: result = foldArrayAccess(m, n) of nkDotExpr: result = foldFieldAccess(m, n) else: - nil + discard diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index d626d2eb2..89a167b96 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -17,11 +17,6 @@ # included from sem.nim -type - TSemGenericFlag = enum - withinBind, withinTypeDesc, withinMixin - TSemGenericFlags = set[TSemGenericFlag] - proc getIdentNode(n: PNode): PNode = case n.kind of nkPostfix: result = getIdentNode(n.sons[1]) @@ -31,8 +26,6 @@ proc getIdentNode(n: PNode): PNode = illFormedAst(n) result = n -proc semGenericStmt(c: PContext, n: PNode, flags: TSemGenericFlags, - ctx: var TIntSet): PNode proc semGenericStmtScope(c: PContext, n: PNode, flags: TSemGenericFlags, ctx: var TIntSet): PNode = @@ -73,7 +66,7 @@ proc semGenericStmtSymbol(c: PContext, n: PNode, s: PSym): PNode = result = n else: result = newSymNode(s, n.info) -proc Lookup(c: PContext, n: PNode, flags: TSemGenericFlags, +proc lookup(c: PContext, n: PNode, flags: TSemGenericFlags, ctx: var TIntSet): PNode = result = n let ident = considerAcc(n) @@ -96,10 +89,10 @@ proc semGenericStmt(c: PContext, n: PNode, if gCmd == cmdIdeTools: suggestStmt(c, n) case n.kind of nkIdent, nkAccQuoted: - result = Lookup(c, n, flags, ctx) + result = lookup(c, n, flags, ctx) of nkDotExpr: let luf = if withinMixin notin flags: {checkUndeclared} else: {} - var s = QualifiedLookUp(c, n, luf) + var s = qualifiedLookUp(c, n, luf) if s != nil: result = semGenericStmtSymbol(c, n, s) # XXX for example: ``result.add`` -- ``add`` needs to be looked up here... of nkEmpty, nkSym..nkNilLit: @@ -110,7 +103,7 @@ proc semGenericStmt(c: PContext, n: PNode, # not work. Copying the symbol does not work either because we're already # the owner of the symbol! What we need to do is to copy the symbol # in the generic instantiation process... - nil + discard of nkBind: result = semGenericStmt(c, n.sons[0], flags+{withinBind}, ctx) of nkMixinStmt: @@ -119,7 +112,7 @@ proc semGenericStmt(c: PContext, n: PNode, # check if it is an expression macro: checkMinSonsLen(n, 1) let fn = n.sons[0] - var s = qualifiedLookup(c, fn, {}) + var s = qualifiedLookUp(c, fn, {}) if s == nil and withinMixin notin flags and fn.kind in {nkIdent, nkAccQuoted} and considerAcc(fn).id notin ctx: localError(n.info, errUndeclaredIdentifier, fn.renderTree) @@ -219,7 +212,7 @@ proc semGenericStmt(c: PContext, n: PNode, for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): IllFormedAst(a) + if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): illFormedAst(a) checkMinSonsLen(a, 3) var L = sonsLen(a) a.sons[L-2] = semGenericStmt(c, a.sons[L-2], flags+{withinTypeDesc}, @@ -230,7 +223,7 @@ proc semGenericStmt(c: PContext, n: PNode, of nkGenericParams: for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] - if (a.kind != nkIdentDefs): IllFormedAst(a) + if (a.kind != nkIdentDefs): illFormedAst(a) checkMinSonsLen(a, 3) var L = sonsLen(a) a.sons[L-2] = semGenericStmt(c, a.sons[L-2], flags+{withinTypeDesc}, @@ -242,7 +235,7 @@ proc semGenericStmt(c: PContext, n: PNode, for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkConstDef): IllFormedAst(a) + if (a.kind != nkConstDef): illFormedAst(a) checkSonsLen(a, 3) addPrelimDecl(c, newSymS(skUnknown, getIdentNode(a.sons[0]), c)) a.sons[1] = semGenericStmt(c, a.sons[1], flags+{withinTypeDesc}, ctx) @@ -251,13 +244,13 @@ proc semGenericStmt(c: PContext, n: PNode, for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkTypeDef): IllFormedAst(a) + if (a.kind != nkTypeDef): illFormedAst(a) checkSonsLen(a, 3) addPrelimDecl(c, newSymS(skUnknown, getIdentNode(a.sons[0]), c)) for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkTypeDef): IllFormedAst(a) + if (a.kind != nkTypeDef): illFormedAst(a) checkSonsLen(a, 3) if a.sons[1].kind != nkEmpty: openScope(c) @@ -278,14 +271,14 @@ proc semGenericStmt(c: PContext, n: PNode, else: illFormedAst(n) addDecl(c, newSymS(skUnknown, getIdentNode(a.sons[i]), c)) of nkObjectTy, nkTupleTy: - nil + discard of nkFormalParams: checkMinSonsLen(n, 1) if n.sons[0].kind != nkEmpty: n.sons[0] = semGenericStmt(c, n.sons[0], flags+{withinTypeDesc}, ctx) for i in countup(1, sonsLen(n) - 1): var a = n.sons[i] - if (a.kind != nkIdentDefs): IllFormedAst(a) + if (a.kind != nkIdentDefs): illFormedAst(a) checkMinSonsLen(a, 3) var L = sonsLen(a) a.sons[L-2] = semGenericStmt(c, a.sons[L-2], flags+{withinTypeDesc}, @@ -311,7 +304,7 @@ proc semGenericStmt(c: PContext, n: PNode, else: body = n.sons[bodyPos] n.sons[bodyPos] = semGenericStmtScope(c, body, flags, ctx) closeScope(c) - of nkPragma, nkPragmaExpr: nil + of nkPragma, nkPragmaExpr: discard of nkExprColonExpr, nkExprEqExpr: checkMinSonsLen(n, 2) result.sons[1] = semGenericStmt(c, n.sons[1], flags, ctx) diff --git a/compiler/seminst.nim b/compiler/seminst.nim index 0cf5086a8..8faf1d21a 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -13,27 +13,28 @@ proc instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable, entry: var TInstantiation) = if n.kind != nkGenericParams: - InternalError(n.info, "instantiateGenericParamList; no generic params") + internalError(n.info, "instantiateGenericParamList; no generic params") newSeq(entry.concreteTypes, n.len) for i in countup(0, n.len - 1): var a = n.sons[i] if a.kind != nkSym: - InternalError(a.info, "instantiateGenericParamList; no symbol") + internalError(a.info, "instantiateGenericParamList; no symbol") var q = a.sym - if q.typ.kind notin {tyTypeDesc, tyGenericParam, tyTypeClass, tyExpr}: continue + if q.typ.kind notin {tyTypeDesc, tyGenericParam, tyStatic}+tyTypeClasses: + continue var s = newSym(skType, q.name, getCurrOwner(), q.info) s.flags = s.flags + {sfUsed, sfFromGeneric} - var t = PType(IdTableGet(pt, q.typ)) + var t = PType(idTableGet(pt, q.typ)) if t == nil: if tfRetType in q.typ.flags: # keep the generic type and allow the return type to be bound # later by semAsgn in return type inference scenario t = q.typ else: - LocalError(a.info, errCannotInstantiateX, s.name.s) + localError(a.info, errCannotInstantiateX, s.name.s) t = errorType(c) elif t.kind == tyGenericParam: - InternalError(a.info, "instantiateGenericParamList: " & q.name.s) + internalError(a.info, "instantiateGenericParamList: " & q.name.s) elif t.kind == tyGenericInvokation: #t = instGenericContainer(c, a, t) t = generateTypeInstance(c, pt, a, t) @@ -46,10 +47,10 @@ proc sameInstantiation(a, b: TInstantiation): bool = if a.concreteTypes.len == b.concreteTypes.len: for i in 0..a.concreteTypes.high: if not compareTypes(a.concreteTypes[i], b.concreteTypes[i], - flags = {TypeDescExactMatch}): return + flags = {ExactTypeDescValues}): return result = true -proc GenericCacheGet(genericSym: Psym, entry: TInstantiation): PSym = +proc genericCacheGet(genericSym: PSym, entry: TInstantiation): PSym = if genericSym.procInstCache != nil: for inst in genericSym.procInstCache: if sameInstantiation(entry, inst[]): @@ -74,11 +75,11 @@ proc removeDefaultParamValues(n: PNode) = proc freshGenSyms(n: PNode, owner: PSym, symMap: var TIdTable) = # we need to create a fresh set of gensym'ed symbols: if n.kind == nkSym and sfGenSym in n.sym.flags: - var x = PSym(IdTableGet(symMap, n.sym)) + var x = PSym(idTableGet(symMap, n.sym)) if x == nil: x = copySym(n.sym, false) x.owner = owner - IdTablePut(symMap, n.sym, x) + idTablePut(symMap, n.sym, x) n.sym = x else: for i in 0 .. <safeLen(n): freshGenSyms(n.sons[i], owner, symMap) @@ -87,7 +88,7 @@ proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) proc instantiateBody(c: PContext, n: PNode, result: PSym) = if n.sons[bodyPos].kind != nkEmpty: - inc c.InGenericInst + inc c.inGenericInst # add it here, so that recursive generic procs are possible: addDecl(c, result) pushProcCon(c, result) @@ -100,7 +101,7 @@ proc instantiateBody(c: PContext, n: PNode, result: PSym) = maybeAddResult(c, result, n) var b = n.sons[bodyPos] var symMap: TIdTable - InitIdTable symMap + initIdTable symMap freshGenSyms(b, result, symMap) b = semProcBody(c, b) b = hloBody(c, b) @@ -108,7 +109,7 @@ proc instantiateBody(c: PContext, n: PNode, result: PSym) = #echo "code instantiated ", result.name.s excl(result.flags, sfForward) popProcCon(c) - dec c.InGenericInst + dec c.inGenericInst proc fixupInstantiatedSymbols(c: PContext, s: PSym) = for i in countup(0, c.generics.len - 1): @@ -125,147 +126,33 @@ proc fixupInstantiatedSymbols(c: PContext, s: PSym) = proc sideEffectsCheck(c: PContext, s: PSym) = if {sfNoSideEffect, sfSideEffect} * s.flags == {sfNoSideEffect, sfSideEffect}: - LocalError(s.info, errXhasSideEffects, s.name.s) + localError(s.info, errXhasSideEffects, s.name.s) elif sfThread in s.flags and semthreads.needsGlobalAnalysis() and s.ast.sons[genericParamsPos].kind == nkEmpty: c.threadEntries.add(s) -proc lateInstantiateGeneric(c: PContext, invocation: PType, info: TLineInfo): PType = - InternalAssert invocation.kind == tyGenericInvokation - - let cacheHit = searchInstTypes(invocation) - if cacheHit != nil: - result = cacheHit - else: - let s = invocation.sons[0].sym - let oldScope = c.currentScope - c.currentScope = s.typScope - openScope(c) - pushInfoContext(info) - for i in 0 .. <s.typ.n.sons.len: - let genericParam = s.typ.n[i].sym - let symKind = if genericParam.typ.kind == tyExpr: skConst - else: skType - - var boundSym = newSym(symKind, s.typ.n[i].sym.name, s, info) - boundSym.typ = invocation.sons[i+1].skipTypes({tyExpr}) - boundSym.ast = invocation.sons[i+1].n - addDecl(c, boundSym) - # XXX: copyTree would have been unnecessary here if semTypeNode - # didn't modify its input parameters. Currently, it does modify - # at least the record lists of the passed object and tuple types - var instantiated = semTypeNode(c, copyTree(s.ast[2]), nil) - popInfoContext() - closeScope(c) - c.currentScope = oldScope - if instantiated != nil: - result = invocation - result.kind = tyGenericInst - result.sons.add instantiated - cacheTypeInst result - -proc instGenericContainer(c: PContext, info: TLineInfo, header: PType): PType = - when oUseLateInstantiation: - lateInstantiateGeneric(c, header, info) - else: - var cl: TReplTypeVars - InitIdTable(cl.symMap) - InitIdTable(cl.typeMap) - cl.info = info - cl.c = c - result = ReplaceTypeVarsT(cl, header) +proc instGenericContainer(c: PContext, info: TLineInfo, header: PType, + allowMetaTypes = false): PType = + var cl: TReplTypeVars + initIdTable(cl.symMap) + initIdTable(cl.typeMap) + initIdTable(cl.localCache) + cl.info = info + cl.c = c + cl.allowMetaTypes = allowMetaTypes + result = replaceTypeVarsT(cl, header) proc instGenericContainer(c: PContext, n: PNode, header: PType): PType = result = instGenericContainer(c, n.info, header) -proc fixupProcType(c: PContext, genericType: PType, - inst: TInstantiation): PType = - # XXX: This is starting to look suspiciously like ReplaceTypeVarsT - # there are few apparent differences, but maybe the code could be - # moved over. - # * the code here uses the new genericSym.position property when - # doing lookups. - # * the handling of tyTypeDesc seems suspicious in ReplaceTypeVarsT - # typedesc params were previously handled in the second pass of - # semParamList - # * void (nkEmpty) params doesn't seem to be stripped in ReplaceTypeVarsT - result = genericType - if result == nil: return - - case genericType.kind - of tyGenericParam, tyTypeClass: - result = inst.concreteTypes[genericType.sym.position] - of tyTypeDesc: - result = inst.concreteTypes[genericType.sym.position] - if tfUnresolved in genericType.flags: - result = result.sons[0] - of tyExpr: - result = inst.concreteTypes[genericType.sym.position] - of tyOpenArray, tyArray, tySet, tySequence, tyTuple, tyProc, - tyPtr, tyVar, tyRef, tyOrdinal, tyRange, tyVarargs: - if genericType.sons == nil: return - var head = 0 - for i in 0 .. <genericType.sons.len: - let origType = genericType.sons[i] - var changed = fixupProcType(c, origType, inst) - if changed != genericType.sons[i]: - var changed = changed.skipIntLit - if result == genericType: - # the first detected change initializes the result - result = copyType(genericType, genericType.owner, false) - if genericType.n != nil: - result.n = copyTree(genericType.n) - - # XXX: doh, we have to treat seq and arrays as special case - # because sometimes the `@` magic will be applied to an empty - # sequence having the type tySequence(tyEmpty) - if changed.kind == tyEmpty and - genericType.kind notin {tyArray, tySequence}: - if genericType.kind == tyProc and i == 0: - # return types of procs are overwritten with nil - changed = nil - else: - # otherwise, `empty` is just erased from the signature - result.sons[i..i] = [] - if result.n != nil: result.n.sons[i..i] = [] - continue - - result.sons[head] = changed - - if result.n != nil: - if result.n.kind == nkRecList: - for son in result.n.sons: - if son.typ == origType: - son.typ = changed - son.sym = copySym(son.sym, true) - son.sym.typ = changed - if result.n.kind == nkFormalParams: - if i != 0: - let origParam = result.n.sons[head].sym - var param = copySym(origParam) - param.typ = changed - param.ast = origParam.ast - result.n.sons[head] = newSymNode(param) - - # won't be advanced on empty (void) nodes - inc head - - of tyGenericInvokation: - result = newTypeWithSons(c, tyGenericInvokation, genericType.sons) - for i in 1 .. <genericType.sons.len: - result.sons[i] = fixupProcType(c, result.sons[i], inst) - result = instGenericContainer(c, getInfoContext(-1), result) - - else: nil - proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, info: TLineInfo): PSym = # no need to instantiate generic templates/macros: if fn.kind in {skTemplate, skMacro}: return fn - + # generates an instantiated proc - if c.InstCounter > 1000: InternalError(fn.ast.info, "nesting too deep") - inc(c.InstCounter) + if c.instCounter > 1000: internalError(fn.ast.info, "nesting too deep") + inc(c.instCounter) # careful! we copy the whole AST including the possibly nil body! var n = copyTree(fn.ast) # NOTE: for access of private fields within generics from a different module @@ -280,16 +167,15 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, result.ast = n pushOwner(result) openScope(c) - if n.sons[genericParamsPos].kind == nkEmpty: - InternalError(n.info, "generateInstance") + internalAssert n.sons[genericParamsPos].kind != nkEmpty n.sons[namePos] = newSymNode(result) pushInfoContext(info) var entry = TInstantiation.new entry.sym = result instantiateGenericParamList(c, n.sons[genericParamsPos], pt, entry[]) - result.typ = fixupProcType(c, fn.typ, entry[]) + result.typ = generateTypeInstance(c, pt, info, fn.typ) n.sons[genericParamsPos] = ast.emptyNode - var oldPrc = GenericCacheGet(fn, entry[]) + var oldPrc = genericCacheGet(fn, entry[]) if oldPrc == nil: fn.procInstCache.safeAdd(entry) c.generics.add(makeInstPair(fn, entry)) @@ -300,7 +186,7 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, if fn.kind != skTemplate: instantiateBody(c, n, result) sideEffectsCheck(c, result) - ParamsTypeCheck(c, result.typ) + paramsTypeCheck(c, result.typ) else: result = oldPrc popInfoContext() @@ -308,7 +194,5 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, popOwner() #c.currentScope = oldScope c.friendModule = oldFriend - dec(c.InstCounter) + dec(c.instCounter) if result.kind == skMethod: finishMethod(c, result) - - diff --git a/compiler/semmacrosanity.nim b/compiler/semmacrosanity.nim new file mode 100644 index 000000000..1bece95c2 --- /dev/null +++ b/compiler/semmacrosanity.nim @@ -0,0 +1,89 @@ +# +# +# The Nimrod Compiler +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## Implements type sanity checking for ASTs resulting from macros. Lots of +## room for improvement here. + +import ast, astalgo, msgs, types + +proc ithField(n: PNode, field: int): PSym = + result = nil + case n.kind + of nkRecList: + for i in countup(0, sonsLen(n) - 1): + result = ithField(n.sons[i], field-i) + if result != nil: return + of nkRecCase: + if n.sons[0].kind != nkSym: internalError(n.info, "ithField") + result = ithField(n.sons[0], field-1) + if result != nil: return + for i in countup(1, sonsLen(n) - 1): + case n.sons[i].kind + of nkOfBranch, nkElse: + result = ithField(lastSon(n.sons[i]), field-1) + if result != nil: return + else: internalError(n.info, "ithField(record case branch)") + of nkSym: + if field == 0: result = n.sym + else: discard + +proc annotateType*(n: PNode, t: PType) = + let x = t.skipTypes(abstractInst) + # Note: x can be unequal to t and we need to be careful to use 't' + # to not to skip tyGenericInst + case n.kind + of nkPar: + if x.kind == tyObject: + n.typ = t + for i in 0 .. <n.len: + let field = x.n.ithField(i) + if field.isNil: globalError n.info, "invalid field at index " & $i + else: annotateType(n.sons[i], field.typ) + elif x.kind == tyTuple: + n.typ = t + for i in 0 .. <n.len: + if i >= x.len: globalError n.info, "invalid field at index " & $i + else: annotateType(n.sons[i], x.sons[i]) + elif x.kind == tyProc and x.callConv == ccClosure: + n.typ = t + else: + globalError(n.info, "() must have an object or tuple type") + of nkBracket: + if x.kind in {tyArrayConstr, tyArray, tySequence, tyOpenarray}: + n.typ = t + for m in n: annotateType(m, x.elemType) + else: + globalError(n.info, "[] must have some form of array type") + of nkCurly: + if x.kind in {tySet}: + n.typ = t + for m in n: annotateType(m, x.elemType) + else: + globalError(n.info, "{} must have the set type") + of nkFloatLit..nkFloat128Lit: + if x.kind in {tyFloat..tyFloat128}: + n.typ = t + else: + globalError(n.info, "float literal must have some float type") + of nkCharLit..nkUInt64Lit: + if x.kind in {tyInt..tyUInt64, tyBool, tyChar, tyEnum}: + n.typ = t + else: + globalError(n.info, "integer literal must have some int type") + of nkStrLit..nkTripleStrLit: + if x.kind in {tyString, tyCString}: + n.typ = t + else: + globalError(n.info, "string literal must be of some string type") + of nkNilLit: + if x.kind in NilableTypes: + n.typ = t + else: + globalError(n.info, "nil literal must be of some pointer type") + else: discard diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 88567b10a..4caf1fb8e 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -18,7 +18,7 @@ proc expectIntLit(c: PContext, n: PNode): int = let x = c.semConstExpr(c, n) case x.kind of nkIntLit..nkInt64Lit: result = int(x.intVal) - else: LocalError(n.info, errIntLiteralExpected) + else: localError(n.info, errIntLiteralExpected) proc semInstantiationInfo(c: PContext, n: PNode): PNode = result = newNodeIT(nkPar, n.info, n.typ) @@ -26,21 +26,34 @@ proc semInstantiationInfo(c: PContext, n: PNode): PNode = let useFullPaths = expectIntLit(c, n.sons[2]) let info = getInfoContext(idx) var filename = newNodeIT(nkStrLit, n.info, getSysType(tyString)) - filename.strVal = if useFullPaths != 0: info.toFullPath else: info.ToFilename + filename.strVal = if useFullPaths != 0: info.toFullPath else: info.toFilename var line = newNodeIT(nkIntLit, n.info, getSysType(tyInt)) - line.intVal = ToLinenumber(info) + line.intVal = toLinenumber(info) result.add(filename) result.add(line) + +proc evalTypeTrait(trait: PNode, operand: PType, context: PSym): PNode = + let typ = operand.skipTypes({tyTypeDesc}) + case trait.sym.name.s.normalize + of "name": + result = newStrNode(nkStrLit, typ.typeToString(preferName)) + result.typ = newType(tyString, context) + result.info = trait.info + of "arity": + result = newIntNode(nkIntLit, typ.n.len-1) + result.typ = newType(tyInt, context) + result.info = trait.info + else: + internalAssert false proc semTypeTraits(c: PContext, n: PNode): PNode = checkMinSonsLen(n, 2) - internalAssert n.sons[1].kind == nkSym - let typArg = n.sons[1].sym - if typArg.kind == skType or - (typArg.kind == skParam and typArg.typ.sonsLen > 0): + let t = n.sons[1].typ + internalAssert t != nil and t.kind == tyTypeDesc + if t.sonsLen > 0: # This is either a type known to sem or a typedesc # param to a regular proc (again, known at instantiation) - result = evalTypeTrait(n[0], n[1], GetCurrOwner()) + result = evalTypeTrait(n[0], t, getCurrOwner()) else: # a typedesc variable, pass unmodified to evals result = n @@ -56,23 +69,23 @@ proc semBindSym(c: PContext, n: PNode): PNode = let sl = semConstExpr(c, n.sons[1]) if sl.kind notin {nkStrLit, nkRStrLit, nkTripleStrLit}: - LocalError(n.sons[1].info, errStringLiteralExpected) + localError(n.sons[1].info, errStringLiteralExpected) return errorNode(c, n) let isMixin = semConstExpr(c, n.sons[2]) if isMixin.kind != nkIntLit or isMixin.intVal < 0 or isMixin.intVal > high(TSymChoiceRule).int: - LocalError(n.sons[2].info, errConstExprExpected) + localError(n.sons[2].info, errConstExprExpected) return errorNode(c, n) let id = newIdentNode(getIdent(sl.strVal), n.info) - let s = QualifiedLookUp(c, id) + let s = qualifiedLookUp(c, id) if s != nil: # we need to mark all symbols: var sc = symChoice(c, id, s, TSymChoiceRule(isMixin.intVal)) result.add(sc) else: - LocalError(n.sons[1].info, errUndeclaredIdentifier, sl.strVal) + localError(n.sons[1].info, errUndeclaredIdentifier, sl.strVal) proc semLocals(c: PContext, n: PNode): PNode = var counter = 0 @@ -88,7 +101,7 @@ proc semLocals(c: PContext, n: PNode): PNode = #if it.owner != c.p.owner: return result if it.kind in skLocalVars and it.typ.skipTypes({tyGenericInst, tyVar}).kind notin - {tyVarargs, tyOpenArray, tyTypeDesc, tyExpr, tyStmt, tyEmpty}: + {tyVarargs, tyOpenArray, tyTypeDesc, tyStatic, tyExpr, tyStmt, tyEmpty}: var field = newSym(skField, it.name, getCurrOwner(), n.info) field.typ = it.typ.skipTypes({tyGenericInst, tyVar}) diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 7dec557be..fb266ae3a 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -95,12 +95,12 @@ proc useVar(a: PEffects, n: PNode) = if s.id notin a.init: if {tfNeedsInit, tfNotNil} * s.typ.flags != {}: when true: - Message(n.info, warnProveInit, s.name.s) + message(n.info, warnProveInit, s.name.s) else: Message(n.info, errGenerated, "'$1' might not have been initialized" % s.name.s) else: - Message(n.info, warnUninit, s.name.s) + message(n.info, warnUninit, s.name.s) # prevent superfluous warnings about the same variable: a.init.add s.id @@ -162,8 +162,8 @@ proc mergeTags(a: PEffects, b, comesFrom: PNode) = for effect in items(b): addTag(a, effect, useLineInfo=comesFrom != nil) proc listEffects(a: PEffects) = - for e in items(a.exc): Message(e.info, hintUser, typeToString(e.typ)) - for e in items(a.tags): Message(e.info, hintUser, typeToString(e.typ)) + for e in items(a.exc): message(e.info, hintUser, typeToString(e.typ)) + for e in items(a.tags): message(e.info, hintUser, typeToString(e.typ)) proc catches(tracked: PEffects, e: PType) = let e = skipTypes(e, skipPtrs) @@ -305,21 +305,21 @@ proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) = if n.kind == nkAddr: # addr(x[]) can't be proven, but addr(x) can: if not containsNode(n, {nkDerefExpr, nkHiddenDeref}): return - elif n.kind == nkSym and n.sym.kind in RoutineKinds: + elif n.kind == nkSym and n.sym.kind in routineKinds: # 'p' is not nil obviously: return case impliesNotNil(tracked.guards, n) of impUnknown: - Message(n.info, errGenerated, + message(n.info, errGenerated, "cannot prove '$1' is not nil" % n.renderTree) of impNo: - Message(n.info, errGenerated, "'$1' is provably nil" % n.renderTree) + message(n.info, errGenerated, "'$1' is provably nil" % n.renderTree) of impYes: discard proc trackOperand(tracked: PEffects, n: PNode, paramType: PType) = let op = n.typ if op != nil and op.kind == tyProc and n.kind != nkNilLit: - InternalAssert op.n.sons[0].kind == nkEffectList + internalAssert op.n.sons[0].kind == nkEffectList var effectList = op.n.sons[0] let s = n.skipConv if s.kind == nkSym and s.sym.kind in routineKinds: @@ -367,7 +367,7 @@ proc trackCase(tracked: PEffects, n: PNode) = for i in oldState.. <tracked.init.len: addToIntersection(inter, tracked.init[i]) - let exh = case skipTypes(n.sons[0].Typ, abstractVarRange-{tyTypeDesc}).Kind + let exh = case skipTypes(n.sons[0].typ, abstractVarRange-{tyTypeDesc}).kind of tyFloat..tyFloat128, tyString: lastSon(n).kind == nkElse else: @@ -549,7 +549,7 @@ proc checkRaisesSpec(spec, real: PNode, msg: string, hints: bool) = if hints: for s in 0 .. <spec.len: if not used.contains(s): - Message(spec[s].info, hintXDeclaredButNotUsed, renderTree(spec[s])) + message(spec[s].info, hintXDeclaredButNotUsed, renderTree(spec[s])) proc checkMethodEffects*(disp, branch: PSym) = ## checks for consistent effects for multi methods. @@ -568,13 +568,13 @@ proc checkMethodEffects*(disp, branch: PSym) = proc setEffectsForProcType*(t: PType, n: PNode) = var effects = t.n.sons[0] - InternalAssert t.kind == tyProc and effects.kind == nkEffectList + internalAssert t.kind == tyProc and effects.kind == nkEffectList let raisesSpec = effectSpec(n, wRaises) tagsSpec = effectSpec(n, wTags) if not isNil(raisesSpec) or not isNil(tagsSpec): - InternalAssert effects.len == 0 + internalAssert effects.len == 0 newSeq(effects.sons, effectListLen) if not isNil(raisesSpec): effects.sons[exceptionEffects] = raisesSpec @@ -583,7 +583,7 @@ proc setEffectsForProcType*(t: PType, n: PNode) = proc trackProc*(s: PSym, body: PNode) = var effects = s.typ.n.sons[0] - InternalAssert effects.kind == nkEffectList + internalAssert effects.kind == nkEffectList # effects already computed? if sfForward in s.flags: return if effects.len == effectListLen: return @@ -603,7 +603,7 @@ proc trackProc*(s: PSym, body: PNode) = s.kind in {skProc, skConverter, skMethod}: var res = s.ast.sons[resultPos].sym # get result symbol if res.id notin t.init: - Message(body.info, warnProveInit, "result") + message(body.info, warnProveInit, "result") let p = s.ast.sons[pragmasPos] let raisesSpec = effectSpec(p, wRaises) if not isNil(raisesSpec): @@ -618,4 +618,4 @@ proc trackProc*(s: PSym, body: PNode) = hints=off) # after the check, use the formal spec: effects.sons[tagEffects] = tagsSpec - \ No newline at end of file + diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index ed6787a16..0871b7fb7 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -10,7 +10,7 @@ ## this module does the semantic checking of statements # included from sem.nim -var EnforceVoidContext = PType(kind: tyStmt) +var enforceVoidContext = PType(kind: tyStmt) proc semCommand(c: PContext, n: PNode): PNode = result = semExprNoType(c, n) @@ -58,10 +58,10 @@ proc semWhile(c: PContext, n: PNode): PNode = n.sons[1] = semStmt(c, n.sons[1]) dec(c.p.nestedLoopCounter) closeScope(c) - if n.sons[1].typ == EnforceVoidContext: - result.typ = EnforceVoidContext + if n.sons[1].typ == enforceVoidContext: + result.typ = enforceVoidContext -proc toCover(t: PType): biggestInt = +proc toCover(t: PType): BiggestInt = var t2 = skipTypes(t, abstractVarRange-{tyTypeDesc}) if t2.kind == tyEnum and enumHasHoles(t2): result = sonsLen(t2.n) @@ -70,9 +70,9 @@ proc toCover(t: PType): biggestInt = proc performProcvarCheck(c: PContext, n: PNode, s: PSym) = var smoduleId = getModule(s).id - if sfProcVar notin s.flags and s.typ.callConv == ccDefault and + if sfProcvar notin s.flags and s.typ.callConv == ccDefault and smoduleId != c.module.id and smoduleId != c.friendModule.id: - LocalError(n.info, errXCannotBePassedToProcVar, s.name.s) + localError(n.info, errXCannotBePassedToProcVar, s.name.s) proc semProcvarCheck(c: PContext, n: PNode) = let n = n.skipConv @@ -86,8 +86,8 @@ include semdestruct proc semDestructorCheck(c: PContext, n: PNode, flags: TExprFlags) {.inline.} = if efAllowDestructor notin flags and n.kind in nkCallKinds+{nkObjConstr}: - if instantiateDestructor(c, n.typ): - LocalError(n.info, errGenerated, + if instantiateDestructor(c, n.typ) != nil: + localError(n.info, errGenerated, "usage of a type with a destructor in a non destructible context") # This still breaks too many things: when false: @@ -117,7 +117,7 @@ const nkElse, nkStmtListExpr, nkTryStmt, nkFinally, nkExceptBranch, nkElifBranch, nkElifExpr, nkElseExpr, nkBlockStmt, nkBlockExpr} -proc ImplicitlyDiscardable(n: PNode): bool = +proc implicitlyDiscardable(n: PNode): bool = var n = n while n.kind in skipForDiscardable: n = n.lastSon result = isCallExpr(n) and n.sons[0].kind == nkSym and @@ -132,19 +132,25 @@ proc fixNilType(n: PNode) = for it in n: fixNilType(it) n.typ = nil -proc discardCheck(result: PNode) = +proc discardCheck(c: PContext, result: PNode) = if result.typ != nil and result.typ.kind notin {tyStmt, tyEmpty}: if result.kind == nkNilLit: result.typ = nil - elif ImplicitlyDiscardable(result): + message(result.info, warnNilStatement) + elif implicitlyDiscardable(result): var n = result result.typ = nil while n.kind in skipForDiscardable: n = n.lastSon n.typ = nil + elif c.inTypeClass > 0 and result.typ.kind == tyBool: + let verdict = semConstExpr(c, result) + if verdict.intVal == 0: + localError(result.info, "type class predicate failed") elif result.typ.kind != tyError and gCmd != cmdInteractive: if result.typ.kind == tyNil: fixNilType(result) + message(result.info, warnNilStatement) else: var n = result while n.kind in skipForDiscardable: n = n.lastSon @@ -152,7 +158,7 @@ proc discardCheck(result: PNode) = proc semIf(c: PContext, n: PNode): PNode = result = n - var typ = CommonTypeBegin + var typ = commonTypeBegin var hasElse = false for i in countup(0, sonsLen(n) - 1): var it = n.sons[i] @@ -169,10 +175,10 @@ proc semIf(c: PContext, n: PNode): PNode = typ = commonType(typ, it.sons[0].typ) else: illFormedAst(it) if isEmptyType(typ) or typ.kind == tyNil or not hasElse: - for it in n: discardCheck(it.lastSon) + for it in n: discardCheck(c, it.lastSon) result.kind = nkIfStmt # propagate any enforced VoidContext: - if typ == EnforceVoidContext: result.typ = EnforceVoidContext + if typ == enforceVoidContext: result.typ = enforceVoidContext else: for it in n: let j = it.len-1 @@ -186,16 +192,16 @@ proc semCase(c: PContext, n: PNode): PNode = openScope(c) n.sons[0] = semExprWithType(c, n.sons[0]) var chckCovered = false - var covered: biggestint = 0 - var typ = CommonTypeBegin + var covered: BiggestInt = 0 + var typ = commonTypeBegin var hasElse = false - case skipTypes(n.sons[0].Typ, abstractVarRange-{tyTypeDesc}).Kind + case skipTypes(n.sons[0].typ, abstractVarRange-{tyTypeDesc}).kind of tyInt..tyInt64, tyChar, tyEnum, tyUInt..tyUInt32: chckCovered = true of tyFloat..tyFloat128, tyString, tyError: - nil + discard else: - LocalError(n.info, errSelectorMustBeOfCertainTypes) + localError(n.info, errSelectorMustBeOfCertainTypes) return for i in countup(1, sonsLen(n) - 1): var x = n.sons[i] @@ -230,10 +236,10 @@ proc semCase(c: PContext, n: PNode): PNode = localError(n.info, errNotAllCasesCovered) closeScope(c) if isEmptyType(typ) or typ.kind == tyNil or not hasElse: - for i in 1..n.len-1: discardCheck(n.sons[i].lastSon) + for i in 1..n.len-1: discardCheck(c, n.sons[i].lastSon) # propagate any enforced VoidContext: - if typ == EnforceVoidContext: - result.typ = EnforceVoidContext + if typ == enforceVoidContext: + result.typ = enforceVoidContext else: for i in 1..n.len-1: var it = n.sons[i] @@ -245,7 +251,7 @@ proc semTry(c: PContext, n: PNode): PNode = result = n inc c.p.inTryStmt checkMinSonsLen(n, 2) - var typ = CommonTypeBegin + var typ = commonTypeBegin n.sons[0] = semExprBranchScope(c, n.sons[0]) typ = commonType(typ, n.sons[0].typ) var check = initIntSet() @@ -263,10 +269,10 @@ proc semTry(c: PContext, n: PNode): PNode = var typ = semTypeNode(c, a.sons[j], nil) if typ.kind == tyRef: typ = typ.sons[0] if typ.kind != tyObject: - LocalError(a.sons[j].info, errExprCannotBeRaised) + localError(a.sons[j].info, errExprCannotBeRaised) a.sons[j] = newNodeI(nkType, a.sons[j].info) a.sons[j].typ = typ - if ContainsOrIncl(check, typ.id): + if containsOrIncl(check, typ.id): localError(a.sons[j].info, errExceptionAlreadyHandled) elif a.kind != nkFinally: illFormedAst(n) @@ -275,10 +281,10 @@ proc semTry(c: PContext, n: PNode): PNode = typ = commonType(typ, a.sons[length-1].typ) dec c.p.inTryStmt if isEmptyType(typ) or typ.kind == tyNil: - discardCheck(n.sons[0]) - for i in 1..n.len-1: discardCheck(n.sons[i].lastSon) - if typ == EnforceVoidContext: - result.typ = EnforceVoidContext + discardCheck(c, n.sons[0]) + for i in 1..n.len-1: discardCheck(c, n.sons[i].lastSon) + if typ == enforceVoidContext: + result.typ = enforceVoidContext else: n.sons[0] = fitNode(c, typ, n.sons[0]) for i in 1..n.len-1: @@ -287,7 +293,7 @@ proc semTry(c: PContext, n: PNode): PNode = it.sons[j] = fitNode(c, typ, it.sons[j]) result.typ = typ -proc fitRemoveHiddenConv(c: PContext, typ: Ptype, n: PNode): PNode = +proc fitRemoveHiddenConv(c: PContext, typ: PType, n: PNode): PNode = result = fitNode(c, typ, n) if result.kind in {nkHiddenStdConv, nkHiddenSubConv}: changeType(result.sons[1], typ, check=true) @@ -298,7 +304,7 @@ proc fitRemoveHiddenConv(c: PContext, typ: Ptype, n: PNode): PNode = proc findShadowedVar(c: PContext, v: PSym): PSym = for scope in walkScopes(c.currentScope.parent): if scope == c.topLevelScope: break - let shadowed = StrTableGet(scope.symbols, v.name) + let shadowed = strTableGet(scope.symbols, v.name) if shadowed != nil and shadowed.kind in skLocalVars: return shadowed @@ -318,9 +324,9 @@ proc semIdentDef(c: PContext, n: PNode, kind: TSymKind): PSym = proc checkNilable(v: PSym) = if sfGlobal in v.flags and {tfNotNil, tfNeedsInit} * v.typ.flags != {}: if v.ast.isNil: - Message(v.info, warnProveInit, v.name.s) + message(v.info, warnProveInit, v.name.s) elif tfNotNil in v.typ.flags and tfNotNil notin v.ast.typ.flags: - Message(v.info, warnProveInit, v.name.s) + message(v.info, warnProveInit, v.name.s) proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = var b: PNode @@ -329,7 +335,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = var a = n.sons[i] if gCmd == cmdIdeTools: suggestStmt(c, a) if a.kind == nkCommentStmt: continue - if a.kind notin {nkIdentDefs, nkVarTuple, nkConstDef}: IllFormedAst(a) + if a.kind notin {nkIdentDefs, nkVarTuple, nkConstDef}: illFormedAst(a) checkMinSonsLen(a, 3) var length = sonsLen(a) var typ: PType @@ -346,12 +352,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = else: typ = skipIntLit(def.typ) else: def = ast.emptyNode - if symkind == skLet: LocalError(a.info, errLetNeedsInit) + if symkind == skLet: localError(a.info, errLetNeedsInit) # this can only happen for errornous var statements: if typ == nil: continue if not typeAllowed(typ, symkind): - LocalError(a.info, errXisNoType, typeToString(typ)) + localError(a.info, errXisNoType, typeToString(typ)) var tup = skipTypes(typ, {tyGenericInst}) if a.kind == nkVarTuple: if tup.kind != tyTuple: @@ -366,12 +372,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = addSon(result, b) elif tup.kind == tyTuple and def.kind == nkPar and a.kind == nkIdentDefs and a.len > 3: - Message(a.info, warnEachIdentIsTuple) + message(a.info, warnEachIdentIsTuple) for j in countup(0, length-3): var v = semIdentDef(c, a.sons[j], symkind) if sfGenSym notin v.flags: addInterfaceDecl(c, v) when oKeepVariableNames: - if c.InUnrolledContext > 0: v.flags.incl(sfShadowed) + if c.inUnrolledContext > 0: v.flags.incl(sfShadowed) else: let shadowed = findShadowedVar(c, v) if shadowed != nil: @@ -379,12 +385,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = # a shadowed variable is an error unless it appears on the right # side of the '=': if warnShadowIdent in gNotes and not identWithin(def, v.name): - Message(a.info, warnShadowIdent, v.name.s) + message(a.info, warnShadowIdent, v.name.s) if a.kind != nkVarTuple: if def != nil and def.kind != nkEmpty: # this is needed for the evaluation pass and for the guard checking: v.ast = def - if sfThread in v.flags: LocalError(def.info, errThreadvarCannotInit) + if sfThread in v.flags: localError(def.info, errThreadvarCannotInit) v.typ = typ b = newNodeI(nkIdentDefs, a.info) if importantComments(): @@ -406,7 +412,7 @@ proc semConst(c: PContext, n: PNode): PNode = var a = n.sons[i] if gCmd == cmdIdeTools: suggestStmt(c, a) if a.kind == nkCommentStmt: continue - if (a.kind != nkConstDef): IllFormedAst(a) + if (a.kind != nkConstDef): illFormedAst(a) checkSonsLen(a, 3) var v = semIdentDef(c, a.sons[0], skConst) var typ: PType = nil @@ -414,16 +420,18 @@ proc semConst(c: PContext, n: PNode): PNode = var def = semConstExpr(c, a.sons[2]) if def == nil: - LocalError(a.sons[2].info, errConstExprExpected) + localError(a.sons[2].info, errConstExprExpected) continue # check type compatibility between def.typ and typ: if typ != nil: def = fitRemoveHiddenConv(c, typ, def) else: typ = def.typ - if typ == nil: continue + if typ == nil: + localError(a.sons[2].info, errConstExprExpected) + continue if not typeAllowed(typ, skConst): - LocalError(a.info, errXisNoType, typeToString(typ)) + localError(a.info, errXisNoType, typeToString(typ)) continue v.typ = typ v.ast = def # no need to copy @@ -490,17 +498,17 @@ proc semForObjectFields(c: TFieldsCtx, typ, forLoop, father: PNode) = fc.field = typ.sym fc.replaceByFieldName = c.m == mFieldPairs openScope(c.c) - inc c.c.InUnrolledContext + inc c.c.inUnrolledContext let body = instFieldLoopBody(fc, lastSon(forLoop), forLoop) - father.add(SemStmt(c.c, body)) - dec c.c.InUnrolledContext + father.add(semStmt(c.c, body)) + dec c.c.inUnrolledContext closeScope(c.c) - of nkNilLit: nil + of nkNilLit: discard of nkRecCase: let L = forLoop.len let call = forLoop.sons[L-2] if call.len > 2: - LocalError(forLoop.info, errGenerated, + localError(forLoop.info, errGenerated, "parallel 'fields' iterator does not work for 'case' objects") return # iterate over the selector: @@ -529,9 +537,9 @@ proc semForFields(c: PContext, n: PNode, m: TMagic): PNode = # so that 'break' etc. work as expected, we produce # a 'while true: stmt; break' loop ... result = newNodeI(nkWhileStmt, n.info, 2) - var trueSymbol = StrTableGet(magicsys.systemModule.Tab, getIdent"true") + var trueSymbol = strTableGet(magicsys.systemModule.tab, getIdent"true") if trueSymbol == nil: - LocalError(n.info, errSystemNeeds, "true") + localError(n.info, errSystemNeeds, "true") trueSymbol = newSym(skUnknown, getIdent"true", getCurrOwner(), n.info) trueSymbol.typ = getSysType(tyBool) @@ -542,7 +550,7 @@ proc semForFields(c: PContext, n: PNode, m: TMagic): PNode = var length = sonsLen(n) var call = n.sons[length-2] if length-2 != sonsLen(call)-1 + ord(m==mFieldPairs): - LocalError(n.info, errWrongNumberOfVariables) + localError(n.info, errWrongNumberOfVariables) return result var tupleTypeA = skipTypes(call.sons[1].typ, abstractVar-{tyTypeDesc}) @@ -551,10 +559,10 @@ proc semForFields(c: PContext, n: PNode, m: TMagic): PNode = return result for i in 1..call.len-1: var tupleTypeB = skipTypes(call.sons[i].typ, abstractVar-{tyTypeDesc}) - if not SameType(tupleTypeA, tupleTypeB): + if not sameType(tupleTypeA, tupleTypeB): typeMismatch(call.sons[i], tupleTypeA, tupleTypeB) - Inc(c.p.nestedLoopCounter) + inc(c.p.nestedLoopCounter) if tupleTypeA.kind == tyTuple: var loopBody = n.sons[length-1] for i in 0..sonsLen(tupleTypeA)-1: @@ -564,16 +572,16 @@ proc semForFields(c: PContext, n: PNode, m: TMagic): PNode = fc.tupleIndex = i fc.replaceByFieldName = m == mFieldPairs var body = instFieldLoopBody(fc, loopBody, n) - inc c.InUnrolledContext - stmts.add(SemStmt(c, body)) - dec c.InUnrolledContext + inc c.inUnrolledContext + stmts.add(semStmt(c, body)) + dec c.inUnrolledContext closeScope(c) else: var fc: TFieldsCtx fc.m = m fc.c = c semForObjectFields(fc, tupleTypeA.n, n, stmts) - Dec(c.p.nestedLoopCounter) + dec(c.p.nestedLoopCounter) # for TR macros this 'while true: ...; break' loop is pretty bad, so # we avoid it now if we can: if hasSonWith(stmts, nkBreakStmt): @@ -589,7 +597,7 @@ proc addForVarDecl(c: PContext, v: PSym) = if shadowed != nil: # XXX should we do this here? #shadowed.flags.incl(sfShadowed) - Message(v.info, warnShadowIdent, v.name.s) + message(v.info, warnShadowIdent, v.name.s) addDecl(c, v) proc symForVar(c: PContext, n: PNode): PSym = @@ -613,9 +621,9 @@ proc semForVars(c: PContext, n: PNode): PNode = n.sons[0] = newSymNode(v) if sfGenSym notin v.flags: addForVarDecl(c, v) else: - LocalError(n.info, errWrongNumberOfVariables) + localError(n.info, errWrongNumberOfVariables) elif length-2 != sonsLen(iter): - LocalError(n.info, errWrongNumberOfVariables) + localError(n.info, errWrongNumberOfVariables) else: for i in countup(0, length - 3): var v = symForVar(c, n.sons[i]) @@ -623,9 +631,9 @@ proc semForVars(c: PContext, n: PNode): PNode = v.typ = iter.sons[i] n.sons[i] = newSymNode(v) if sfGenSym notin v.flags: addForVarDecl(c, v) - Inc(c.p.nestedLoopCounter) - n.sons[length-1] = SemStmt(c, n.sons[length-1]) - Dec(c.p.nestedLoopCounter) + inc(c.p.nestedLoopCounter) + n.sons[length-1] = semStmt(c, n.sons[length-1]) + dec(c.p.nestedLoopCounter) proc implicitIterator(c: PContext, it: string, arg: PNode): PNode = result = newNodeI(nkCall, arg.info) @@ -653,7 +661,7 @@ proc semFor(c: PContext, n: PNode): PNode = elif length == 4: n.sons[length-2] = implicitIterator(c, "pairs", n.sons[length-2]) else: - LocalError(n.sons[length-2].info, errIteratorExpected) + localError(n.sons[length-2].info, errIteratorExpected) result = semForVars(c, n) elif call.sons[0].sym.magic != mNone: if call.sons[0].sym.magic == mOmpParFor: @@ -664,8 +672,8 @@ proc semFor(c: PContext, n: PNode): PNode = else: result = semForVars(c, n) # propagate any enforced VoidContext: - if n.sons[length-1].typ == EnforceVoidContext: - result.typ = EnforceVoidContext + if n.sons[length-1].typ == enforceVoidContext: + result.typ = enforceVoidContext closeScope(c) proc semRaise(c: PContext, n: PNode): PNode = @@ -691,7 +699,7 @@ proc typeSectionLeftSidePass(c: PContext, n: PNode) = var a = n.sons[i] if gCmd == cmdIdeTools: suggestStmt(c, a) if a.kind == nkCommentStmt: continue - if a.kind != nkTypeDef: IllFormedAst(a) + if a.kind != nkTypeDef: illFormedAst(a) checkSonsLen(a, 3) var s = semIdentDef(c, a.sons[0], skType) s.typ = newTypeS(tyForward, c) @@ -706,12 +714,12 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) = for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkTypeDef): IllFormedAst(a) + if (a.kind != nkTypeDef): illFormedAst(a) checkSonsLen(a, 3) - if (a.sons[0].kind != nkSym): IllFormedAst(a) + if (a.sons[0].kind != nkSym): illFormedAst(a) var s = a.sons[0].sym if s.magic == mNone and a.sons[2].kind == nkEmpty: - LocalError(a.info, errImplOfXexpected, s.name.s) + localError(a.info, errImplOfXexpected, s.name.s) if s.magic != mNone: processMagicType(c, s) if a.sons[1].kind != nkEmpty: # We have a generic type declaration here. In generic types, @@ -732,19 +740,15 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) = # we fill it out later. For magic generics like 'seq', it won't be filled # so we use tyEmpty instead of nil to not crash for strange conversions # like: mydata.seq - rawAddSon(s.typ, newTypeS(tyEmpty, c)) + rawAddSon(s.typ, newTypeS(tyNone, c)) s.ast = a - when oUseLateInstantiation: - var body: PType = nil - s.typScope = c.currentScope.parent - else: - inc c.InGenericContext - var body = semTypeNode(c, a.sons[2], nil) - dec c.InGenericContext - if body != nil: - body.sym = s - body.size = -1 # could not be computed properly - s.typ.sons[sonsLen(s.typ) - 1] = body + inc c.inGenericContext + var body = semTypeNode(c, a.sons[2], nil) + dec c.inGenericContext + if body != nil: + body.sym = s + body.size = -1 # could not be computed properly + s.typ.sons[sonsLen(s.typ) - 1] = body popOwner() closeScope(c) elif a.sons[2].kind != nkEmpty: @@ -764,7 +768,7 @@ proc typeSectionFinalPass(c: PContext, n: PNode) = for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if a.sons[0].kind != nkSym: IllFormedAst(a) + if a.sons[0].kind != nkSym: illFormedAst(a) var s = a.sons[0].sym # compute the type's size and check for illegal recursions: if a.sons[1].kind == nkEmpty: @@ -782,12 +786,12 @@ proc typeSectionFinalPass(c: PContext, n: PNode) = # give anonymous object a dummy symbol: var st = s.typ if st.kind == tyGenericBody: st = st.lastSon - InternalAssert st.kind in {tyPtr, tyRef} - InternalAssert st.sons[0].sym == nil + internalAssert st.kind in {tyPtr, tyRef} + internalAssert st.sons[0].sym == nil st.sons[0].sym = newSym(skType, getIdent(s.name.s & ":ObjectType"), getCurrOwner(), s.info) -proc SemTypeSection(c: PContext, n: PNode): PNode = +proc semTypeSection(c: PContext, n: PNode): PNode = typeSectionLeftSidePass(c, n) typeSectionRightSidePass(c, n) typeSectionFinalPass(c, n) @@ -806,12 +810,12 @@ proc addParams(c: PContext, n: PNode, kind: TSymKind) = proc semBorrow(c: PContext, n: PNode, s: PSym) = # search for the correct alias: - var b = SearchForBorrowProc(c, c.currentScope.parent, s) + var b = searchForBorrowProc(c, c.currentScope.parent, s) if b != nil: # store the alias: n.sons[bodyPos] = newSymNode(b) else: - LocalError(n.info, errNoSymbolToBorrowFromFound) + localError(n.info, errNoSymbolToBorrowFromFound) proc addResult(c: PContext, t: PType, info: TLineInfo, owner: TSymKind) = if t != nil: @@ -849,7 +853,7 @@ proc semProcAnnotation(c: PContext, prc: PNode): PNode = prc.sons[namePos] = newIdentNode(idDelegator, prc.info) prc.sons[pragmasPos] = copyExcept(n, i) else: - LocalError(prc.info, errOnlyACallOpCanBeDelegator) + localError(prc.info, errOnlyACallOpCanBeDelegator) continue # we transform ``proc p {.m, rest.}`` into ``m(do: proc p {.rest.})`` and # let the semantic checker deal with it: @@ -864,6 +868,8 @@ proc semProcAnnotation(c: PContext, prc: PNode): PNode = return semStmt(c, x) proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode = + # XXX semProcAux should be good enough for this now, we will eventually + # remove semLambda result = semProcAnnotation(c, n) if result != nil: return result result = n @@ -879,9 +885,10 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode = openScope(c) if n.sons[genericParamsPos].kind != nkEmpty: illFormedAst(n) # process parameters: - if n.sons[paramsPos].kind != nkEmpty: - semParamList(c, n.sons[ParamsPos], nil, s) - ParamsTypeCheck(c, s.typ) + if n.sons[paramsPos].kind != nkEmpty: + var gp = newNodeI(nkGenericParams, n.info) + semParamList(c, n.sons[paramsPos], gp, s) + paramsTypeCheck(c, s.typ) else: s.typ = newTypeS(tyProc, c) rawAddSon(s.typ, nil) @@ -890,7 +897,7 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode = s.options = gOptions if n.sons[bodyPos].kind != nkEmpty: if sfImportc in s.flags: - LocalError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s) + localError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s) #if efDetermineType notin flags: # XXX not good enough; see tnamedparamanonproc.nim pushProcCon(c, s) @@ -901,7 +908,7 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode = popProcCon(c) sideEffectsCheck(c, s) else: - LocalError(n.info, errImplOfXexpected, s.name.s) + localError(n.info, errImplOfXexpected, s.name.s) closeScope(c) # close scope for parameters popOwner() result.typ = s.typ @@ -917,7 +924,7 @@ proc activate(c: PContext, n: PNode) = of nkCallKinds: for i in 1 .. <n.len: activate(c, n[i]) else: - nil + discard proc maybeAddResult(c: PContext, s: PSym, n: PNode) = if s.typ.sons[0] != nil and @@ -932,7 +939,7 @@ type stepCompileBody proc isForwardDecl(s: PSym): bool = - InternalAssert s.kind == skProc + internalAssert s.kind == skProc result = s.ast[bodyPos].kind != nkEmpty proc semProcAux(c: PContext, n: PNode, kind: TSymKind, @@ -944,9 +951,15 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, checkSonsLen(n, bodyPos + 1) var s: PSym var typeIsDetermined = false + var isAnon = false if n[namePos].kind != nkSym: assert phase == stepRegisterSymbol - s = semIdentDef(c, n.sons[0], kind) + + if n[namePos].kind == nkEmpty: + s = newSym(kind, idAnon, getCurrOwner(), n.info) + isAnon = true + else: + s = semIdentDef(c, n.sons[0], kind) n.sons[namePos] = newSymNode(s) s.ast = n s.scope = c.currentScope @@ -959,6 +972,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, else: s = n[namePos].sym typeIsDetermined = s.typ == nil + s.ast = n + s.scope = c.currentScope + # if typeIsDetermined: assert phase == stepCompileBody # else: assert phase == stepDetermineType # before compiling the proc body, set as current the scope @@ -975,7 +991,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, gp = newNodeI(nkGenericParams, n.info) # process parameters: if n.sons[paramsPos].kind != nkEmpty: - semParamList(c, n.sons[ParamsPos], gp, s) + semParamList(c, n.sons[paramsPos], gp, s) if sonsLen(gp) > 0: if n.sons[genericParamsPos].kind == nkEmpty: # we have a list of implicit type parameters: @@ -987,13 +1003,15 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, rawAddSon(s.typ, nil) if n.sons[patternPos].kind != nkEmpty: n.sons[patternPos] = semPattern(c, n.sons[patternPos]) - if s.kind == skIterator: s.typ.flags.incl(tfIterator) + if s.kind == skIterator: + s.typ.flags.incl(tfIterator) - var proto = SearchForProc(c, s.scope, s) + var proto = searchForProc(c, s.scope, s) if proto == nil: - s.typ.callConv = lastOptionEntry(c).defaultCC + if s.kind == skIterator and isAnon: s.typ.callConv = ccClosure + else: s.typ.callConv = lastOptionEntry(c).defaultCC # add it here, so that recursive procs are possible: - if sfGenSym in s.flags: nil + if sfGenSym in s.flags: discard elif kind in OverloadableSyms: if not typeIsDetermined: addInterfaceOverloadableSymAt(c, s.scope, s) @@ -1006,9 +1024,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, implictPragmas(c, s, n, validPragmas) else: if n.sons[pragmasPos].kind != nkEmpty: - LocalError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProc) + localError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProc) if sfForward notin proto.flags: - WrongRedefinition(n.info, proto.name.s) + wrongRedefinition(n.info, proto.name.s) excl(proto.flags, sfForward) closeScope(c) # close scope with wrong parameter symbols openScope(c) # open scope for old (correct) parameter symbols @@ -1021,7 +1039,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, n.sons[genericParamsPos] = proto.ast.sons[genericParamsPos] n.sons[paramsPos] = proto.ast.sons[paramsPos] n.sons[pragmasPos] = proto.ast.sons[pragmasPos] - if n.sons[namePos].kind != nkSym: InternalError(n.info, "semProcAux") + if n.sons[namePos].kind != nkSym: internalError(n.info, "semProcAux") n.sons[namePos].sym = proto if importantComments() and not isNil(proto.ast.comment): n.comment = proto.ast.comment @@ -1030,12 +1048,16 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, pushOwner(s) s.options = gOptions if sfDestructor in s.flags: doDestructorStuff(c, s, n) - if n.sons[bodyPos].kind != nkEmpty: + if n.sons[bodyPos].kind != nkEmpty: # for DLL generation it is annoying to check for sfImportc! - if sfBorrow in s.flags: - LocalError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s) - if n.sons[genericParamsPos].kind == nkEmpty: - ParamsTypeCheck(c, s.typ) + if sfBorrow in s.flags: + localError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s) + let usePseudoGenerics = kind in {skMacro, skTemplate} + # Macros and Templates can have generic parameters, but they are + # only used for overload resolution (there is no instantiation of + # the symbol, so we must process the body now) + if n.sons[genericParamsPos].kind == nkEmpty or usePseudoGenerics: + if not usePseudoGenerics: paramsTypeCheck(c, s.typ) pushProcCon(c, s) maybeAddResult(c, s, n) if sfImportc notin s.flags: @@ -1045,17 +1067,17 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, # context as it may even be evaluated in 'system.compiles': n.sons[bodyPos] = transformBody(c.module, semBody, s) popProcCon(c) - else: + else: if s.typ.sons[0] != nil and kind != skIterator: addDecl(c, newSym(skUnknown, getIdent"result", nil, n.info)) var toBind = initIntSet() n.sons[bodyPos] = semGenericStmtScope(c, n.sons[bodyPos], {}, toBind) fixupInstantiatedSymbols(c, s) - if sfImportc in s.flags: + if sfImportc in s.flags: # so we just ignore the body after semantic checking for importc: n.sons[bodyPos] = ast.emptyNode else: - if proto != nil: LocalError(n.info, errImplOfXexpected, proto.name.s) + if proto != nil: localError(n.info, errImplOfXexpected, proto.name.s) if {sfImportc, sfBorrow} * s.flags == {} and s.magic == mNone: incl(s.flags, sfForward) elif sfBorrow in s.flags: semBorrow(c, n, s) @@ -1065,6 +1087,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, popOwner() if n.sons[patternPos].kind != nkEmpty: c.patterns.add(s) + if isAnon: result.typ = s.typ proc determineType(c: PContext, s: PSym) = if s.typ != nil: return @@ -1076,19 +1099,21 @@ proc semIterator(c: PContext, n: PNode): PNode = var s = result.sons[namePos].sym var t = s.typ if t.sons[0] == nil and s.typ.callConv != ccClosure: - LocalError(n.info, errXNeedsReturnType, "iterator") + localError(n.info, errXNeedsReturnType, "iterator") # iterators are either 'inline' or 'closure'; for backwards compatibility, # we require first class iterators to be marked with 'closure' explicitly # -- at least for 0.9.2. if s.typ.callConv == ccClosure: incl(s.typ.flags, tfCapturesEnv) + else: + s.typ.callConv = ccInline when false: if s.typ.callConv != ccInline: s.typ.callConv = ccClosure # and they always at least use the 'env' for the state field: incl(s.typ.flags, tfCapturesEnv) if n.sons[bodyPos].kind == nkEmpty and s.magic == mNone: - LocalError(n.info, errImplOfXexpected, s.name.s) + localError(n.info, errImplOfXexpected, s.name.s) proc semProc(c: PContext, n: PNode): PNode = result = semProcAux(c, n, skProc, procPragmas) @@ -1104,24 +1129,24 @@ proc finishMethod(c: PContext, s: PSym) = methodDef(s, false) proc semMethod(c: PContext, n: PNode): PNode = - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "method") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "method") result = semProcAux(c, n, skMethod, methodPragmas) var s = result.sons[namePos].sym - if not isGenericRoutine(s): + if not isGenericRoutine(s) and result.sons[bodyPos].kind != nkEmpty: if hasObjParam(s): - methodDef(s, false) + methodDef(s, fromCache=false) else: - LocalError(n.info, errXNeedsParamObjectType, "method") + localError(n.info, errXNeedsParamObjectType, "method") proc semConverterDef(c: PContext, n: PNode): PNode = - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "converter") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "converter") checkSonsLen(n, bodyPos + 1) result = semProcAux(c, n, skConverter, converterPragmas) var s = result.sons[namePos].sym var t = s.typ - if t.sons[0] == nil: LocalError(n.info, errXNeedsReturnType, "converter") - if sonsLen(t) != 2: LocalError(n.info, errXRequiresOneArgument, "converter") + if t.sons[0] == nil: localError(n.info, errXNeedsReturnType, "converter") + if sonsLen(t) != 2: localError(n.info, errXRequiresOneArgument, "converter") addConverter(c, s) proc semMacroDef(c: PContext, n: PNode): PNode = @@ -1129,9 +1154,9 @@ proc semMacroDef(c: PContext, n: PNode): PNode = result = semProcAux(c, n, skMacro, macroPragmas) var s = result.sons[namePos].sym var t = s.typ - if t.sons[0] == nil: LocalError(n.info, errXNeedsReturnType, "macro") + if t.sons[0] == nil: localError(n.info, errXNeedsReturnType, "macro") if n.sons[bodyPos].kind == nkEmpty: - LocalError(n.info, errImplOfXexpected, s.name.s) + localError(n.info, errImplOfXexpected, s.name.s) proc evalInclude(c: PContext, n: PNode): PNode = result = newNodeI(nkStmtList, n.info) @@ -1139,11 +1164,11 @@ proc evalInclude(c: PContext, n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): var f = checkModuleName(n.sons[i]) if f != InvalidFileIDX: - if ContainsOrIncl(c.includedFiles, f): - LocalError(n.info, errRecursiveDependencyX, f.toFilename) + if containsOrIncl(c.includedFiles, f): + localError(n.info, errRecursiveDependencyX, f.toFilename) else: addSon(result, semStmt(c, gIncludeFile(c.module, f))) - Excl(c.includedFiles, f) + excl(c.includedFiles, f) proc setLine(n: PNode, info: TLineInfo) = for i in 0 .. <safeLen(n): setLine(n.sons[i], info) @@ -1152,20 +1177,25 @@ proc setLine(n: PNode, info: TLineInfo) = proc semPragmaBlock(c: PContext, n: PNode): PNode = let pragmaList = n.sons[0] pragma(c, nil, pragmaList, exprPragmas) - result = semStmt(c, n.sons[1]) + result = semExpr(c, n.sons[1]) for i in 0 .. <pragmaList.len: if whichPragma(pragmaList.sons[i]) == wLine: setLine(result, pragmaList.sons[i].info) proc semStaticStmt(c: PContext, n: PNode): PNode = let a = semStmt(c, n.sons[0]) - result = evalStaticExpr(c, c.module, a, c.p.owner) - if result.isNil: - LocalError(n.info, errCannotInterpretNodeX, renderTree(n)) - result = emptyNode - elif result.kind == nkEmpty: - result = newNodeI(nkDiscardStmt, n.info, 1) - result.sons[0] = emptyNode + n.sons[0] = a + evalStaticStmt(c.module, a, c.p.owner) + result = newNodeI(nkDiscardStmt, n.info, 1) + result.sons[0] = emptyNode + when false: + result = evalStaticStmt(c.module, a, c.p.owner) + if result.isNil: + LocalError(n.info, errCannotInterpretNodeX, renderTree(n)) + result = emptyNode + elif result.kind == nkEmpty: + result = newNodeI(nkDiscardStmt, n.info, 1) + result.sons[0] = emptyNode proc usesResult(n: PNode): bool = # nkStmtList(expr) properly propagates the void context, @@ -1179,7 +1209,7 @@ proc usesResult(n: PNode): bool = for c in n: if usesResult(c): return true -proc semStmtList(c: PContext, n: PNode): PNode = +proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode = # these must be last statements in a block: const LastBlockStmts = {nkRaiseStmt, nkReturnStmt, nkBreakStmt, nkContinueStmt} @@ -1217,30 +1247,32 @@ proc semStmtList(c: PContext, n: PNode): PNode = return else: n.sons[i] = semExpr(c, n.sons[i]) - if n.sons[i].typ == EnforceVoidContext or usesResult(n.sons[i]): + if n.sons[i].typ == enforceVoidContext or usesResult(n.sons[i]): voidContext = true - n.typ = EnforceVoidContext - if i != last or voidContext: - discardCheck(n.sons[i]) + n.typ = enforceVoidContext + if i == last and efWantValue in flags: + n.typ = n.sons[i].typ + if not isEmptyType(n.typ): n.kind = nkStmtListExpr + elif i != last or voidContext or c.inTypeClass > 0: + discardCheck(c, n.sons[i]) else: n.typ = n.sons[i].typ - if not isEmptyType(n.typ): - n.kind = nkStmtListExpr + if not isEmptyType(n.typ): n.kind = nkStmtListExpr case n.sons[i].kind of nkVarSection, nkLetSection: let (outer, inner) = insertDestructors(c, n.sons[i]) if outer != nil: n.sons[i] = outer for j in countup(i+1, length-1): - inner.addSon(SemStmt(c, n.sons[j])) + inner.addSon(semStmt(c, n.sons[j])) n.sons.setLen(i+1) return of LastBlockStmts: for j in countup(i + 1, length - 1): case n.sons[j].kind - of nkPragma, nkCommentStmt, nkNilLit, nkEmpty: nil + of nkPragma, nkCommentStmt, nkNilLit, nkEmpty: discard else: localError(n.sons[j].info, errStmtInvalidAfterReturn) - else: nil + else: discard if result.len == 1: result = result.sons[0] when false: @@ -1253,7 +1285,7 @@ proc semStmtList(c: PContext, n: PNode): PNode = # "Last expression must be explicitly returned if it " & # "is discardable or discarded") -proc SemStmt(c: PContext, n: PNode): PNode = +proc semStmt(c: PContext, n: PNode): PNode = # now: simply an alias: result = semExprNoType(c, n) diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 68abc9aa6..5abc3ef33 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -14,7 +14,7 @@ discard """ template `||` (a, b: expr): expr = let aa = a - (if aa: aa else: b) + if aa: aa else: b var a, b: T @@ -36,9 +36,9 @@ proc symBinding(n: PNode): TSymBinding = var key = if it.kind == nkExprColonExpr: it.sons[0] else: it if key.kind == nkIdent: case whichKeyword(key.ident) - of wGenSym: return spGenSym + of wGensym: return spGenSym of wInject: return spInject - else: nil + else: discard type TSymChoiceRule = enum @@ -79,7 +79,7 @@ proc semBindStmt(c: PContext, n: PNode, toBind: var TIntSet): PNode = # the same symbol! # This is however not true anymore for hygienic templates as semantic # processing for them changes the symbol table... - let s = QualifiedLookUp(c, a) + let s = qualifiedLookUp(c, a) if s != nil: # we need to mark all symbols: let sc = symChoice(c, n, s, scClosed) @@ -106,7 +106,7 @@ proc replaceIdentBySym(n: var PNode, s: PNode) = type TemplCtx {.pure, final.} = object c: PContext - toBind, toMixin: TIntSet + toBind, toMixin, toInject: TIntSet owner: PSym proc getIdentNode(c: var TemplCtx, n: PNode): PNode = @@ -115,7 +115,7 @@ proc getIdentNode(c: var TemplCtx, n: PNode): PNode = of nkPragmaExpr: result = getIdentNode(c, n.sons[0]) of nkIdent: result = n - let s = QualifiedLookUp(c.c, n, {}) + let s = qualifiedLookUp(c.c, n, {}) if s != nil: if s.owner == c.owner and s.kind == skParam: result = newSymNode(s, n.info) @@ -145,7 +145,18 @@ proc newGenSym(kind: TSymKind, n: PNode, c: var TemplCtx): PSym = proc addLocalDecl(c: var TemplCtx, n: var PNode, k: TSymKind) = # locals default to 'gensym': - if n.kind != nkPragmaExpr or symBinding(n.sons[1]) != spInject: + if n.kind == nkPragmaExpr and symBinding(n.sons[1]) == spInject: + # even if injected, don't produce a sym choice here: + #n = semTemplBody(c, n) + var x = n[0] + while true: + case x.kind + of nkPostfix: x = x[1] + of nkPragmaExpr: x = x[0] + of nkIdent: break + else: illFormedAst(x) + c.toInject.incl(x.ident.id) + else: let ident = getIdentNode(c, n) if not isTemplParam(c, ident): let local = newGenSym(k, ident, c) @@ -153,8 +164,37 @@ proc addLocalDecl(c: var TemplCtx, n: var PNode, k: TSymKind) = replaceIdentBySym(n, newSymNode(local, n.info)) else: replaceIdentBySym(n, ident) + +proc semTemplSymbol(c: PContext, n: PNode, s: PSym): PNode = + incl(s.flags, sfUsed) + case s.kind + of skUnknown: + # Introduced in this pass! Leave it as an identifier. + result = n + of skProc, skMethod, skIterator, skConverter, skTemplate, skMacro: + result = symChoice(c, n, s, scOpen) + of skGenericParam: + result = newSymNodeTypeDesc(s, n.info) + of skParam: + result = n + of skType: + if (s.typ != nil) and (s.typ.kind != tyGenericParam): + result = newSymNodeTypeDesc(s, n.info) + else: + result = n + else: result = newSymNode(s, n.info) + +proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode = + result = n + if n.kind == nkIdent: + let s = qualifiedLookUp(c.c, n, {}) + if s != nil: + if s.owner == c.owner and (s.kind == skParam or sfGenSym in s.flags): + incl(s.flags, sfUsed) + result = newSymNode(s, n.info) else: - n = semTemplBody(c, n) + for i in countup(0, safeLen(n) - 1): + result.sons[i] = semRoutineInTemplName(c, n.sons[i]) proc semRoutineInTemplBody(c: var TemplCtx, n: PNode, k: TSymKind): PNode = result = n @@ -170,17 +210,17 @@ proc semRoutineInTemplBody(c: var TemplCtx, n: PNode, k: TSymKind): PNode = else: n.sons[namePos] = ident else: - n.sons[namePos] = semTemplBody(c, n.sons[namePos]) + n.sons[namePos] = semRoutineInTemplName(c, n.sons[namePos]) openScope(c) for i in patternPos..bodyPos: n.sons[i] = semTemplBody(c, n.sons[i]) closeScope(c) proc semTemplSomeDecl(c: var TemplCtx, n: PNode, symKind: TSymKind) = - for i in countup(ord(symkind == skConditional), sonsLen(n) - 1): + for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): IllFormedAst(a) + if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): illFormedAst(a) checkMinSonsLen(a, 3) var L = sonsLen(a) a.sons[L-2] = semTemplBody(c, a.sons[L-2]) @@ -193,18 +233,23 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = result = n case n.kind of nkIdent: - let s = QualifiedLookUp(c.c, n, {}) + if n.ident.id in c.toInject: return n + let s = qualifiedLookUp(c.c, n, {}) if s != nil: if s.owner == c.owner and s.kind == skParam: incl(s.flags, sfUsed) result = newSymNode(s, n.info) - elif Contains(c.toBind, s.id): + elif contains(c.toBind, s.id): result = symChoice(c.c, n, s, scClosed) + elif contains(c.toMixin, s.name.id): + result = symChoice(c.c, n, s, scForceOpen) elif s.owner == c.owner and sfGenSym in s.flags: # template tmp[T](x: var seq[T]) = # var yz: T incl(s.flags, sfUsed) result = newSymNode(s, n.info) + else: + result = semTemplSymbol(c.c, n, s) of nkBind: result = semTemplBody(c, n.sons[0]) of nkBindStmt: @@ -212,7 +257,7 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = of nkMixinStmt: result = semMixinStmt(c.c, n, c.toMixin) of nkEmpty, nkSym..nkNilLit: - nil + discard of nkIfStmt: for i in countup(0, sonsLen(n)-1): var it = n.sons[i] @@ -274,7 +319,7 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkConstDef): IllFormedAst(a) + if (a.kind != nkConstDef): illFormedAst(a) checkSonsLen(a, 3) addLocalDecl(c, a.sons[0], skConst) a.sons[1] = semTemplBody(c, a.sons[1]) @@ -283,13 +328,13 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkTypeDef): IllFormedAst(a) + if (a.kind != nkTypeDef): illFormedAst(a) checkSonsLen(a, 3) addLocalDecl(c, a.sons[0], skType) for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] if a.kind == nkCommentStmt: continue - if (a.kind != nkTypeDef): IllFormedAst(a) + if (a.kind != nkTypeDef): illFormedAst(a) checkSonsLen(a, 3) if a.sons[1].kind != nkEmpty: openScope(c) @@ -310,14 +355,22 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = result = semRoutineInTemplBody(c, n, skMacro) of nkConverterDef: result = semRoutineInTemplBody(c, n, skConverter) + of nkPragmaExpr: + result.sons[0] = semTemplBody(c, n.sons[0]) + of nkPragma: + discard else: # dotExpr is ambiguous: note that we explicitely allow 'x.TemplateParam', # so we use the generic code for nkDotExpr too if n.kind == nkDotExpr or n.kind == nkAccQuoted: - let s = QualifiedLookUp(c.c, n, {}) + let s = qualifiedLookUp(c.c, n, {}) if s != nil: - if Contains(c.toBind, s.id): + if contains(c.toBind, s.id): return symChoice(c.c, n, s, scClosed) + elif contains(c.toMixin, s.name.id): + return symChoice(c.c, n, s, scForceOpen) + else: + return symChoice(c.c, n, s, scOpen) result = n for i in countup(0, sonsLen(n) - 1): result.sons[i] = semTemplBody(c, n.sons[i]) @@ -326,24 +379,24 @@ proc semTemplBodyDirty(c: var TemplCtx, n: PNode): PNode = result = n case n.kind of nkIdent: - let s = QualifiedLookUp(c.c, n, {}) + let s = qualifiedLookUp(c.c, n, {}) if s != nil: if s.owner == c.owner and s.kind == skParam: result = newSymNode(s, n.info) - elif Contains(c.toBind, s.id): + elif contains(c.toBind, s.id): result = symChoice(c.c, n, s, scClosed) of nkBind: result = semTemplBodyDirty(c, n.sons[0]) of nkBindStmt: result = semBindStmt(c.c, n, c.toBind) of nkEmpty, nkSym..nkNilLit: - nil + discard else: # dotExpr is ambiguous: note that we explicitely allow 'x.TemplateParam', # so we use the generic code for nkDotExpr too if n.kind == nkDotExpr or n.kind == nkAccQuoted: - let s = QualifiedLookUp(c.c, n, {}) - if s != nil and Contains(c.toBind, s.id): + let s = qualifiedLookUp(c.c, n, {}) + if s != nil and contains(c.toBind, s.id): return symChoice(c.c, n, s, scClosed) result = n for i in countup(0, sonsLen(n) - 1): @@ -358,7 +411,7 @@ proc transformToExpr(n: PNode): PNode = for i in countup(0, sonsLen(n) - 1): case n.sons[i].kind of nkCommentStmt, nkEmpty, nkNilLit: - nil + discard else: if realStmt == - 1: realStmt = i else: realStmt = - 2 @@ -368,7 +421,7 @@ proc transformToExpr(n: PNode): PNode = n.kind = nkBlockExpr #nkIfStmt: n.kind = nkIfExpr // this is not correct! else: - nil + discard proc semTemplateDef(c: PContext, n: PNode): PNode = var s: PSym @@ -378,6 +431,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode = else: s = semIdentVis(c, skTemplate, n.sons[0], {}) # check parameter list: + s.scope = c.currentScope pushOwner(s) openScope(c) n.sons[namePos] = newSymNode(s, n.sons[namePos].info) @@ -392,7 +446,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode = gp = newNodeI(nkGenericParams, n.info) # process parameters: if n.sons[paramsPos].kind != nkEmpty: - semParamList(c, n.sons[ParamsPos], gp, s) + semParamList(c, n.sons[paramsPos], gp, s) if sonsLen(gp) > 0: if n.sons[genericParamsPos].kind == nkEmpty: # we have a list of implicit type parameters: @@ -413,6 +467,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode = var ctx: TemplCtx ctx.toBind = initIntSet() ctx.toMixin = initIntSet() + ctx.toInject = initIntSet() ctx.c = c ctx.owner = s if sfDirty in s.flags: @@ -427,12 +482,12 @@ proc semTemplateDef(c: PContext, n: PNode): PNode = s.ast = n result = n if n.sons[bodyPos].kind == nkEmpty: - LocalError(n.info, errImplOfXexpected, s.name.s) - var proto = SearchForProc(c, c.currentScope, s) + localError(n.info, errImplOfXexpected, s.name.s) + var proto = searchForProc(c, c.currentScope, s) if proto == nil: addInterfaceOverloadableSymAt(c, c.currentScope, s) else: - SymTabReplace(c.currentScope.symbols, proto, s) + symTabReplace(c.currentScope.symbols, proto, s) if n.sons[patternPos].kind != nkEmpty: c.patterns.add(s) @@ -455,17 +510,17 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode = if s != nil: if s.owner == c.owner and s.kind == skParam: result = newParam(c, n, s) - elif Contains(c.toBind, s.id): + elif contains(c.toBind, s.id): result = symChoice(c.c, n, s, scClosed) elif templToExpand(s): result = semPatternBody(c, semTemplateExpr(c.c, n, s, false)) else: - nil + discard # we keep the ident unbound for matching instantiated symbols and # more flexibility proc expectParam(c: var TemplCtx, n: PNode): PNode = - let s = QualifiedLookUp(c.c, n, {}) + let s = qualifiedLookUp(c.c, n, {}) if s != nil and s.owner == c.owner and s.kind == skParam: result = newParam(c, n, s) else: @@ -475,11 +530,11 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode = result = n case n.kind of nkIdent: - let s = QualifiedLookUp(c.c, n, {}) + let s = qualifiedLookUp(c.c, n, {}) result = handleSym(c, n, s) of nkBindStmt: result = semBindStmt(c.c, n, c.toBind) - of nkEmpty, nkSym..nkNilLit: nil + of nkEmpty, nkSym..nkNilLit: discard of nkCurlyExpr: # we support '(pattern){x}' to bind a subpattern to a parameter 'x'; # '(pattern){|x}' does the same but the matches will be gathered in 'x' @@ -498,10 +553,10 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode = else: localError(n.info, errInvalidExpression) of nkCallKinds: - let s = QualifiedLookUp(c.c, n.sons[0], {}) + let s = qualifiedLookUp(c.c, n.sons[0], {}) if s != nil: - if s.owner == c.owner and s.kind == skParam: nil - elif Contains(c.toBind, s.id): nil + if s.owner == c.owner and s.kind == skParam: discard + elif contains(c.toBind, s.id): discard elif templToExpand(s): return semPatternBody(c, semTemplateExpr(c.c, n, s, false)) @@ -537,15 +592,15 @@ proc semPatternBody(c: var TemplCtx, n: PNode): PNode = # so we use the generic code for nkDotExpr too case n.kind of nkDotExpr, nkAccQuoted: - let s = QualifiedLookUp(c.c, n, {}) + let s = qualifiedLookUp(c.c, n, {}) if s != nil: - if Contains(c.toBind, s.id): + if contains(c.toBind, s.id): return symChoice(c.c, n, s, scClosed) else: return newIdentNode(s.name, n.info) of nkPar: if n.len == 1: return semPatternBody(c, n.sons[0]) - else: nil + else: discard for i in countup(0, sonsLen(n) - 1): result.sons[i] = semPatternBody(c, n.sons[i]) @@ -554,6 +609,7 @@ proc semPattern(c: PContext, n: PNode): PNode = var ctx: TemplCtx ctx.toBind = initIntSet() ctx.toMixin = initIntSet() + ctx.toInject = initIntSet() ctx.c = c ctx.owner = getCurrOwner() result = flattenStmts(semPatternBody(ctx, n)) @@ -561,5 +617,5 @@ proc semPattern(c: PContext, n: PNode): PNode = if result.len == 1: result = result.sons[0] elif result.len == 0: - LocalError(n.info, errInvalidExpression) + localError(n.info, errInvalidExpression) closeScope(c) diff --git a/compiler/semthreads.nim b/compiler/semthreads.nim index 595ab0454..f7322db80 100644 --- a/compiler/semthreads.nim +++ b/compiler/semthreads.nim @@ -97,7 +97,7 @@ proc `==`(a, b: TCall): bool = proc newProcCtx(owner: PSym): PProcCtx = assert owner != nil new(result) - result.mapping = tables.InitTable[int, TThreadOwner]() + result.mapping = tables.initTable[int, TThreadOwner]() result.owner = owner proc analyse(c: PProcCtx, n: PNode): TThreadOwner @@ -119,7 +119,7 @@ proc analyseSym(c: PProcCtx, n: PNode): TThreadOwner = of skParam: result = c.mapping[v.id] if result == toUndefined: - InternalError(n.info, "param not set: " & v.name.s) + internalError(n.info, "param not set: " & v.name.s) else: result = toNil c.mapping[v.id] = result @@ -132,7 +132,7 @@ proc lvalueSym(n: PNode): PNode = proc writeAccess(c: PProcCtx, n: PNode, owner: TThreadOwner) = if owner notin {toNil, toMine, toTheirs}: - InternalError(n.info, "writeAccess: " & $owner) + internalError(n.info, "writeAccess: " & $owner) var a = lvalueSym(n) if a.kind == nkSym: var v = a.sym @@ -151,21 +151,21 @@ proc writeAccess(c: PProcCtx, n: PNode, owner: TThreadOwner) = newOwner = toMine # XXX BUG what if the tuple contains both ``tyRef`` and ``tyString``? c.mapping[v.id] = newOwner - of toVoid, toUndefined: InternalError(n.info, "writeAccess") - of toTheirs: Message(n.info, warnWriteToForeignHeap) + of toVoid, toUndefined: internalError(n.info, "writeAccess") + of toTheirs: message(n.info, warnWriteToForeignHeap) of toMine: if lastOwner != owner and owner != toNil: - Message(n.info, warnDifferentHeaps) + message(n.info, warnDifferentHeaps) else: # we could not backtrack to a concrete symbol, but that's fine: var lastOwner = analyse(c, n) case lastOwner - of toNil: nil # fine, toNil can be overwritten - of toVoid, toUndefined: InternalError(n.info, "writeAccess") - of toTheirs: Message(n.info, warnWriteToForeignHeap) + of toNil: discard # fine, toNil can be overwritten + of toVoid, toUndefined: internalError(n.info, "writeAccess") + of toTheirs: message(n.info, warnWriteToForeignHeap) of toMine: if lastOwner != owner and owner != toNil: - Message(n.info, warnDifferentHeaps) + message(n.info, warnDifferentHeaps) proc analyseAssign(c: PProcCtx, le, ri: PNode) = var y = analyse(c, ri) # read access; ok @@ -192,7 +192,7 @@ proc analyseCall(c: PProcCtx, n: PNode): TThreadOwner = result = analyse(newCtx, prc.getBody) if prc.ast.sons[bodyPos].kind == nkEmpty and {sfNoSideEffect, sfThread, sfImportc} * prc.flags == {}: - Message(n.info, warnAnalysisLoophole, renderTree(n)) + message(n.info, warnAnalysisLoophole, renderTree(n)) if result == toUndefined: result = toNil if prc.typ.sons[0] != nil: if prc.ast.len > resultPos: @@ -215,12 +215,12 @@ proc analyseCall(c: PProcCtx, n: PNode): TThreadOwner = else: result = toNil proc analyseVarTuple(c: PProcCtx, n: PNode) = - if n.kind != nkVarTuple: InternalError(n.info, "analyseVarTuple") + if n.kind != nkVarTuple: internalError(n.info, "analyseVarTuple") var L = n.len - for i in countup(0, L-3): AnalyseAssign(c, n.sons[i], n.sons[L-1]) + for i in countup(0, L-3): analyseAssign(c, n.sons[i], n.sons[L-1]) proc analyseSingleVar(c: PProcCtx, a: PNode) = - if a.sons[2].kind != nkEmpty: AnalyseAssign(c, a.sons[0], a.sons[2]) + if a.sons[2].kind != nkEmpty: analyseAssign(c, a.sons[0], a.sons[2]) proc analyseVarSection(c: PProcCtx, n: PNode): TThreadOwner = for i in countup(0, sonsLen(n) - 1): @@ -238,7 +238,7 @@ proc analyseConstSection(c: PProcCtx, t: PNode): TThreadOwner = for i in countup(0, sonsLen(t) - 1): var it = t.sons[i] if it.kind == nkCommentStmt: continue - if it.kind != nkConstDef: InternalError(t.info, "analyseConstSection") + if it.kind != nkConstDef: internalError(t.info, "analyseConstSection") if sfFakeConst in it.sons[0].sym.flags: analyseSingleVar(c, it) result = toVoid @@ -246,7 +246,7 @@ template aggregateOwner(result, ana: expr) = var a = ana # eval once if result != a: if result == toNil: result = a - elif a != toNil: Message(n.info, warnDifferentHeaps) + elif a != toNil: message(n.info, warnDifferentHeaps) proc analyseArgs(c: PProcCtx, n: PNode, start = 1) = for i in start..n.len-1: discard analyse(c, n[i]) @@ -254,7 +254,7 @@ proc analyseArgs(c: PProcCtx, n: PNode, start = 1) = proc analyseOp(c: PProcCtx, n: PNode): TThreadOwner = if n[0].kind != nkSym or n[0].sym.kind != skProc: if {tfNoSideEffect, tfThread} * n[0].typ.flags == {}: - Message(n.info, warnAnalysisLoophole, renderTree(n)) + message(n.info, warnAnalysisLoophole, renderTree(n)) result = toNil else: var prc = n[0].sym @@ -352,7 +352,7 @@ proc analyse(c: PProcCtx, n: PNode): TThreadOwner = result = analyse(c, n.sons[0]) of nkRaiseStmt: var a = analyse(c, n.sons[0]) - if a != toMine: Message(n.info, warnDifferentHeaps) + if a != toMine: message(n.info, warnDifferentHeaps) result = toVoid of nkVarSection, nkLetSection: result = analyseVarSection(c, n) of nkConstSection: result = analyseConstSection(c, n) @@ -369,18 +369,19 @@ proc analyse(c: PProcCtx, n: PNode): TThreadOwner = result = toMine of nkAsmStmt, nkPragma, nkIteratorDef, nkProcDef, nkMethodDef, nkConverterDef, nkMacroDef, nkTemplateDef, - nkGotoState, nkState, nkBreakState, nkType: + nkGotoState, nkState, nkBreakState, nkType, nkIdent: result = toVoid of nkExprColonExpr: result = analyse(c, n.sons[1]) - else: InternalError(n.info, "analysis not implemented for: " & $n.kind) + else: internalError(n.info, "analysis not implemented for: " & $n.kind) proc analyseThreadProc*(prc: PSym) = var c = newProcCtx(prc) var formals = skipTypes(prc.typ, abstractInst).n for i in 1 .. formals.len-1: var formal = formals.sons[i].sym - c.mapping[formal.id] = toTheirs # thread receives foreign data! + # the input is copied and belongs to the thread: + c.mapping[formal.id] = toMine discard analyse(c, prc.getBody) proc needsGlobalAnalysis*: bool = diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index b9893d037..44e414e9c 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -18,7 +18,7 @@ proc newOrPrevType(kind: TTypeKind, prev: PType, c: PContext): PType = if result.kind == tyForward: result.kind = kind proc newConstraint(c: PContext, k: TTypeKind): PType = - result = newTypeS(tyTypeClass, c) + result = newTypeS(tyBuiltInTypeClass, c) result.addSonSkipIntLit(newTypeS(k, c)) proc semEnum(c: PContext, n: PNode, prev: PType): PType = @@ -50,13 +50,13 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = of tyTuple: if sonsLen(v) == 2: strVal = v.sons[1] # second tuple part is the string value - if skipTypes(strVal.typ, abstractInst).kind in {tyString, tyCstring}: + if skipTypes(strVal.typ, abstractInst).kind in {tyString, tyCString}: x = getOrdValue(v.sons[0]) # first tuple part is the ordinal else: - LocalError(strVal.info, errStringLiteralExpected) + localError(strVal.info, errStringLiteralExpected) else: - LocalError(v.info, errWrongNumberOfVariables) - of tyString, tyCstring: + localError(v.info, errWrongNumberOfVariables) + of tyString, tyCString: strVal = v x = counter else: @@ -64,7 +64,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = if i != 1: if x != counter: incl(result.flags, tfEnumHasHoles) if x < counter: - LocalError(n.sons[i].info, errInvalidOrderInEnumX, e.name.s) + localError(n.sons[i].info, errInvalidOrderInEnumX, e.name.s) x = counter e.ast = strVal # might be nil counter = x @@ -79,7 +79,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = if result.sym != nil and sfExported in result.sym.flags: incl(e.flags, sfUsed) incl(e.flags, sfExported) - if not isPure: StrTableAdd(c.module.tab, e) + if not isPure: strTableAdd(c.module.tab, e) addSon(result.n, newSymNode(e)) if sfGenSym notin e.flags and not isPure: addDecl(c, e) inc(counter) @@ -93,11 +93,11 @@ proc semSet(c: PContext, n: PNode, prev: PType): PType = if base.kind == tyGenericInst: base = lastSon(base) if base.kind != tyGenericParam: if not isOrdinalType(base): - LocalError(n.info, errOrdinalTypeExpected) + localError(n.info, errOrdinalTypeExpected) elif lengthOrd(base) > MaxSetElements: - LocalError(n.info, errSetTooBig) + localError(n.info, errSetTooBig) else: - LocalError(n.info, errXExpectsOneTypeParam, "set") + localError(n.info, errXExpectsOneTypeParam, "set") addSonSkipIntLit(result, errorType(c)) proc semContainer(c: PContext, n: PNode, kind: TTypeKind, kindStr: string, @@ -107,7 +107,7 @@ proc semContainer(c: PContext, n: PNode, kind: TTypeKind, kindStr: string, var base = semTypeNode(c, n.sons[1], nil) addSonSkipIntLit(result, base) else: - LocalError(n.info, errXExpectsOneTypeParam, kindStr) + localError(n.info, errXExpectsOneTypeParam, kindStr) addSonSkipIntLit(result, errorType(c)) proc semVarargs(c: PContext, n: PNode, prev: PType): PType = @@ -118,7 +118,7 @@ proc semVarargs(c: PContext, n: PNode, prev: PType): PType = if sonsLen(n) == 3: result.n = newIdentNode(considerAcc(n.sons[2]), n.sons[2].info) else: - LocalError(n.info, errXExpectsOneTypeParam, "varargs") + localError(n.info, errXExpectsOneTypeParam, "varargs") addSonSkipIntLit(result, errorType(c)) proc semAnyRef(c: PContext, n: PNode, kind: TTypeKind, prev: PType): PType = @@ -134,7 +134,7 @@ proc semVarType(c: PContext, n: PNode, prev: PType): PType = result = newOrPrevType(tyVar, prev, c) var base = semTypeNode(c, n.sons[0], nil) if base.kind == tyVar: - LocalError(n.info, errVarVarTypeNotAllowed) + localError(n.info, errVarVarTypeNotAllowed) base = base.sons[0] addSonSkipIntLit(result, base) else: @@ -148,22 +148,22 @@ proc semDistinct(c: PContext, n: PNode, prev: PType): PType = result = newConstraint(c, tyDistinct) proc semRangeAux(c: PContext, n: PNode, prev: PType): PType = - assert IsRange(n) + assert isRange(n) checkSonsLen(n, 3) result = newOrPrevType(tyRange, prev, c) result.n = newNodeI(nkRange, n.info) if (n[1].kind == nkEmpty) or (n[2].kind == nkEmpty): - LocalError(n.Info, errRangeIsEmpty) + localError(n.info, errRangeIsEmpty) var a = semConstExpr(c, n[1]) var b = semConstExpr(c, n[2]) if not sameType(a.typ, b.typ): - LocalError(n.info, errPureTypeMismatch) + localError(n.info, errPureTypeMismatch) elif a.typ.kind notin {tyInt..tyInt64,tyEnum,tyBool,tyChar, tyFloat..tyFloat128,tyUInt8..tyUInt32}: - LocalError(n.info, errOrdinalTypeExpected) + localError(n.info, errOrdinalTypeExpected) elif enumHasHoles(a.typ): - LocalError(n.info, errEnumXHasHoles, a.typ.sym.name.s) - elif not leValue(a, b): LocalError(n.Info, errRangeIsEmpty) + localError(n.info, errEnumXHasHoles, a.typ.sym.name.s) + elif not leValue(a, b): localError(n.info, errRangeIsEmpty) addSon(result.n, a) addSon(result.n, b) addSonSkipIntLit(result, b.typ) @@ -180,12 +180,17 @@ proc semRange(c: PContext, n: PNode, prev: PType): PType = elif n.sons[0].floatVal > 0.0 or n.sons[1].floatVal < 0.0: incl(result.flags, tfNeedsInit) else: - LocalError(n.sons[0].info, errRangeExpected) + localError(n.sons[0].info, errRangeExpected) result = newOrPrevType(tyError, prev, c) else: - LocalError(n.info, errXExpectsOneTypeParam, "range") + localError(n.info, errXExpectsOneTypeParam, "range") result = newOrPrevType(tyError, prev, c) +proc nMinusOne(n: PNode): PNode = + result = newNode(nkCall, n.info, @[ + newSymNode(getSysMagic("<", mUnaryLt)), + n]) + proc semArray(c: PContext, n: PNode, prev: PType): PType = var indx, base: PType result = newOrPrevType(tyArray, prev, c) @@ -194,27 +199,43 @@ proc semArray(c: PContext, n: PNode, prev: PType): PType = if isRange(n[1]): indx = semRangeAux(c, n[1], nil) else: let e = semExprWithType(c, n.sons[1], {efDetermineType}) - if e.kind in {nkIntLit..nkUInt64Lit}: + if e.typ.kind == tyFromExpr: + indx = e.typ + elif e.kind in {nkIntLit..nkUInt64Lit}: indx = makeRangeType(c, 0, e.intVal-1, n.info, e.typ) - elif e.kind == nkSym and e.typ.kind == tyExpr: + elif e.kind == nkSym and e.typ.kind == tyStatic: if e.sym.ast != nil: return semArray(c, e.sym.ast, nil) - InternalAssert c.InGenericContext > 0 + internalAssert c.inGenericContext > 0 if not isOrdinalType(e.typ.lastSon): localError(n[1].info, errOrdinalTypeExpected) indx = e.typ + elif e.kind in nkCallKinds and hasGenericArguments(e): + if not isOrdinalType(e.typ): + localError(n[1].info, errOrdinalTypeExpected) + # This is an int returning call, depending on an + # yet unknown generic param (see tgenericshardcases). + # We are going to construct a range type that will be + # properly filled-out in semtypinst (see how tyStaticExpr + # is handled there). + let intType = getSysType(tyInt) + indx = newTypeS(tyRange, c) + indx.sons = @[intType] + indx.n = newNode(nkRange, n.info, @[ + newIntTypeNode(nkIntLit, 0, intType), + makeStaticExpr(c, e.nMinusOne)]) else: indx = e.typ.skipTypes({tyTypeDesc}) addSonSkipIntLit(result, indx) if indx.kind == tyGenericInst: indx = lastSon(indx) - if indx.kind notin {tyGenericParam, tyExpr}: + if indx.kind notin {tyGenericParam, tyStatic, tyFromExpr}: if not isOrdinalType(indx): - LocalError(n.sons[1].info, errOrdinalTypeExpected) + localError(n.sons[1].info, errOrdinalTypeExpected) elif enumHasHoles(indx): - LocalError(n.sons[1].info, errEnumXHasHoles, indx.sym.name.s) + localError(n.sons[1].info, errEnumXHasHoles, indx.sym.name.s) base = semTypeNode(c, n.sons[2], nil) addSonSkipIntLit(result, base) else: - LocalError(n.info, errArrayExpectsTwoTypeParams) + localError(n.info, errArrayExpectsTwoTypeParams) result = newOrPrevType(tyError, prev, c) proc semOrdinal(c: PContext, n: PNode, prev: PType): PType = @@ -223,29 +244,29 @@ proc semOrdinal(c: PContext, n: PNode, prev: PType): PType = var base = semTypeNode(c, n.sons[1], nil) if base.kind != tyGenericParam: if not isOrdinalType(base): - LocalError(n.sons[1].info, errOrdinalTypeExpected) + localError(n.sons[1].info, errOrdinalTypeExpected) addSonSkipIntLit(result, base) else: - LocalError(n.info, errXExpectsOneTypeParam, "ordinal") + localError(n.info, errXExpectsOneTypeParam, "ordinal") result = newOrPrevType(tyError, prev, c) proc semTypeIdent(c: PContext, n: PNode): PSym = if n.kind == nkSym: result = n.sym else: - result = qualifiedLookup(c, n, {checkAmbiguity, checkUndeclared}) + result = qualifiedLookUp(c, n, {checkAmbiguity, checkUndeclared}) if result != nil: markUsed(n, result) if result.kind == skParam and result.typ.kind == tyTypeDesc: # This is a typedesc param. is it already bound? # it's not bound when it's used multiple times in the # proc signature for example - if c.InGenericInst > 0: + if c.inGenericInst > 0: let bound = result.typ.sons[0].sym if bound != nil: return bound return result if result.typ.sym == nil: - LocalError(n.info, errTypeExpected) + localError(n.info, errTypeExpected) return errorSym(c, n) result = result.typ.sym.copySym result.typ = copyType(result.typ, result.typ.owner, true) @@ -253,12 +274,12 @@ proc semTypeIdent(c: PContext, n: PNode): PSym = if result.kind != skType: # this implements the wanted ``var v: V, x: V`` feature ... var ov: TOverloadIter - var amb = InitOverloadIter(ov, c, n) + var amb = initOverloadIter(ov, c, n) while amb != nil and amb.kind != skType: amb = nextOverloadIter(ov, c, n) if amb != nil: result = amb else: - if result.kind != skError: LocalError(n.info, errTypeExpected) + if result.kind != skError: localError(n.info, errTypeExpected) return errorSym(c, n) if result.typ.kind != tyGenericParam: # XXX get rid of this hack! @@ -268,7 +289,7 @@ proc semTypeIdent(c: PContext, n: PNode): PSym = n.sym = result n.info = oldInfo else: - LocalError(n.info, errIdentifierExpected) + localError(n.info, errIdentifierExpected) result = errorSym(c, n) proc semTuple(c: PContext, n: PNode, prev: PType): PType = @@ -280,26 +301,27 @@ proc semTuple(c: PContext, n: PNode, prev: PType): PType = var counter = 0 for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] - if (a.kind != nkIdentDefs): IllFormedAst(a) + if (a.kind != nkIdentDefs): illFormedAst(a) checkMinSonsLen(a, 3) var length = sonsLen(a) if a.sons[length - 2].kind != nkEmpty: typ = semTypeNode(c, a.sons[length - 2], nil) else: - LocalError(a.info, errTypeExpected) + localError(a.info, errTypeExpected) typ = errorType(c) if a.sons[length - 1].kind != nkEmpty: - LocalError(a.sons[length - 1].info, errInitHereNotAllowed) + localError(a.sons[length - 1].info, errInitHereNotAllowed) for j in countup(0, length - 3): var field = newSymG(skField, a.sons[j], c) field.typ = typ field.position = counter inc(counter) - if ContainsOrIncl(check, field.name.id): - LocalError(a.sons[j].info, errAttemptToRedefine, field.name.s) + if containsOrIncl(check, field.name.id): + localError(a.sons[j].info, errAttemptToRedefine, field.name.s) else: addSon(result.n, newSymNode(field)) addSonSkipIntLit(result, typ) + if gCmd == cmdPretty: checkDef(a.sons[j], field) proc semIdentVis(c: PContext, kind: TSymKind, n: PNode, allowed: TSymFlags): PSym = @@ -313,7 +335,7 @@ proc semIdentVis(c: PContext, kind: TSymKind, n: PNode, if sfExported in allowed and v.id == ord(wStar): incl(result.flags, sfExported) else: - LocalError(n.sons[0].info, errInvalidVisibilityX, v.s) + localError(n.sons[0].info, errInvalidVisibilityX, v.s) else: illFormedAst(n) else: @@ -331,9 +353,10 @@ proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode, of skVar: pragma(c, result, n.sons[1], varPragmas) of skLet: pragma(c, result, n.sons[1], letPragmas) of skConst: pragma(c, result, n.sons[1], constPragmas) - else: nil + else: discard else: result = semIdentVis(c, kind, n, allowed) + if gCmd == cmdPretty: checkDef(n, result) proc checkForOverlap(c: PContext, t: PNode, currentEx, branchIndex: int) = let ex = t[branchIndex][currentEx].skipConv @@ -341,9 +364,9 @@ proc checkForOverlap(c: PContext, t: PNode, currentEx, branchIndex: int) = for j in countup(0, sonsLen(t.sons[i]) - 2): if i == branchIndex and j == currentEx: break if overlap(t.sons[i].sons[j].skipConv, ex): - LocalError(ex.info, errDuplicateCaseLabel) + localError(ex.info, errDuplicateCaseLabel) -proc semBranchRange(c: PContext, t, a, b: PNode, covered: var biggestInt): PNode = +proc semBranchRange(c: PContext, t, a, b: PNode, covered: var BiggestInt): PNode = checkMinSonsLen(t, 1) let ac = semConstExpr(c, a) let bc = semConstExpr(c, b) @@ -353,16 +376,16 @@ proc semBranchRange(c: PContext, t, a, b: PNode, covered: var biggestInt): PNode result = newNodeI(nkRange, a.info) result.add(at) result.add(bt) - if emptyRange(ac, bc): LocalError(b.info, errRangeIsEmpty) + if emptyRange(ac, bc): localError(b.info, errRangeIsEmpty) else: covered = covered + getOrdValue(bc) - getOrdValue(ac) + 1 -proc SemCaseBranchRange(c: PContext, t, b: PNode, - covered: var biggestInt): PNode = +proc semCaseBranchRange(c: PContext, t, b: PNode, + covered: var BiggestInt): PNode = checkSonsLen(b, 3) result = semBranchRange(c, t, b.sons[1], b.sons[2], covered) proc semCaseBranchSetElem(c: PContext, t, b: PNode, - covered: var biggestInt): PNode = + covered: var BiggestInt): PNode = if isRange(b): checkSonsLen(b, 3) result = semBranchRange(c, t, b.sons[1], b.sons[2], covered) @@ -374,7 +397,7 @@ proc semCaseBranchSetElem(c: PContext, t, b: PNode, inc(covered) proc semCaseBranch(c: PContext, t, branch: PNode, branchIndex: int, - covered: var biggestInt) = + covered: var BiggestInt) = for i in countup(0, sonsLen(branch) - 2): var b = branch.sons[i] if b.kind == nkRange: @@ -411,14 +434,14 @@ proc semRecordCase(c: PContext, n: PNode, check: var TIntSet, pos: var int, internalError("semRecordCase: discriminant is no symbol") return incl(a.sons[0].sym.flags, sfDiscriminant) - var covered: biggestInt = 0 - var typ = skipTypes(a.sons[0].Typ, abstractVar-{tyTypeDesc}) + var covered: BiggestInt = 0 + var typ = skipTypes(a.sons[0].typ, abstractVar-{tyTypeDesc}) if not isOrdinalType(typ): - LocalError(n.info, errSelectorMustBeOrdinal) + localError(n.info, errSelectorMustBeOrdinal) elif firstOrd(typ) < 0: - LocalError(n.info, errOrdXMustNotBeNegative, a.sons[0].sym.name.s) + localError(n.info, errOrdXMustNotBeNegative, a.sons[0].sym.name.s) elif lengthOrd(typ) > 0x00007FFF: - LocalError(n.info, errLenXinvalid, a.sons[0].sym.name.s) + localError(n.info, errLenXinvalid, a.sons[0].sym.name.s) var chckCovered = true for i in countup(1, sonsLen(n) - 1): var b = copyTree(n.sons[i]) @@ -450,9 +473,9 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var TIntSet, pos: var int, case it.kind of nkElifBranch: checkSonsLen(it, 2) - if c.InGenericContext == 0: + if c.inGenericContext == 0: var e = semConstBoolExpr(c, it.sons[0]) - if e.kind != nkIntLit: InternalError(e.info, "semRecordNodeAux") + if e.kind != nkIntLit: internalError(e.info, "semRecordNodeAux") elif e.intVal != 0 and branch == nil: branch = it.sons[1] else: it.sons[0] = forceBool(c, semExprWithType(c, it.sons[0])) @@ -461,15 +484,15 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var TIntSet, pos: var int, if branch == nil: branch = it.sons[0] idx = 0 else: illFormedAst(n) - if c.InGenericContext > 0: + if c.inGenericContext > 0: # use a new check intset here for each branch: var newCheck: TIntSet assign(newCheck, check) var newPos = pos var newf = newNodeI(nkRecList, n.info) - semRecordNodeAux(c, it.sons[idx], newcheck, newpos, newf, rectype) + semRecordNodeAux(c, it.sons[idx], newCheck, newPos, newf, rectype) it.sons[idx] = if newf.len == 1: newf[0] else: newf - if c.InGenericContext > 0: + if c.inGenericContext > 0: addSon(father, n) elif branch != nil: semRecordNodeAux(c, branch, check, pos, father, rectype) @@ -493,7 +516,7 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var TIntSet, pos: var int, localError(n.sons[length-1].info, errInitHereNotAllowed) var typ: PType if n.sons[length-2].kind == nkEmpty: - LocalError(n.info, errTypeExpected) + localError(n.info, errTypeExpected) typ = errorType(c) else: typ = semTypeNode(c, n.sons[length-2], nil) @@ -509,19 +532,19 @@ proc semRecordNodeAux(c: PContext, n: PNode, check: var TIntSet, pos: var int, f.loc.r = toRope(f.name.s) f.flags = f.flags + ({sfImportc, sfExportc} * rec.flags) inc(pos) - if ContainsOrIncl(check, f.name.id): + if containsOrIncl(check, f.name.id): localError(n.sons[i].info, errAttemptToRedefine, f.name.s) if a.kind == nkEmpty: addSon(father, newSymNode(f)) else: addSon(a, newSymNode(f)) if a.kind != nkEmpty: addSon(father, a) - of nkEmpty: nil + of nkEmpty: discard else: illFormedAst(n) proc addInheritedFieldsAux(c: PContext, check: var TIntSet, pos: var int, n: PNode) = case n.kind of nkRecCase: - if (n.sons[0].kind != nkSym): InternalError(n.info, "addInheritedFieldsAux") + if (n.sons[0].kind != nkSym): internalError(n.info, "addInheritedFieldsAux") addInheritedFieldsAux(c, check, pos, n.sons[0]) for i in countup(1, sonsLen(n) - 1): case n.sons[i].kind @@ -532,9 +555,9 @@ proc addInheritedFieldsAux(c: PContext, check: var TIntSet, pos: var int, for i in countup(0, sonsLen(n) - 1): addInheritedFieldsAux(c, check, pos, n.sons[i]) of nkSym: - Incl(check, n.sym.name.id) + incl(check, n.sym.name.id) inc(pos) - else: InternalError(n.info, "addInheritedFieldsAux()") + else: internalError(n.info, "addInheritedFieldsAux()") proc addInheritedFields(c: PContext, check: var TIntSet, pos: var int, obj: PType) = @@ -565,7 +588,7 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType): PType = if concreteBase.kind != tyError: localError(n.sons[1].info, errInheritanceOnlyWithNonFinalObjects) base = nil - if n.kind != nkObjectTy: InternalError(n.info, "semObjectNode") + if n.kind != nkObjectTy: internalError(n.info, "semObjectNode") result = newOrPrevType(tyObject, prev, c) rawAddSon(result, base) result.n = newNodeI(nkRecList, n.info) @@ -577,9 +600,9 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType): PType = pragma(c, s, n.sons[0], typePragmas) if base == nil and tfInheritable notin result.flags: incl(result.flags, tfFinal) - + proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) = - if kind == skMacro and param.typ.kind != tyTypeDesc: + if kind == skMacro and param.typ.kind notin {tyTypeDesc, tyStatic}: # within a macro, every param has the type PNimrodNode! # and param.typ.kind in {tyTypeDesc, tyExpr, tyStmt}: let nn = getSysSym"PNimrodNode" @@ -591,18 +614,22 @@ proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) = let typedescId = getIdent"typedesc" +template shouldHaveMeta(t) = + internalAssert tfHasMeta in t.flags + # result.lastSon.flags.incl tfHasMeta + proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, paramType: PType, paramName: string, info: TLineInfo, anon = false): PType = - if procKind in {skMacro, skTemplate}: - # generic param types in macros and templates affect overload - # resolution, but don't work as generic params when it comes - # to proc instantiation. We don't need to lift such params here. - return + if paramType == nil: return # (e.g. proc return type) proc addImplicitGenericImpl(typeClass: PType, typId: PIdent): PType = let finalTypId = if typId != nil: typId else: getIdent(paramName & ":type") + if genericParams == nil: + # This happens with anonymous proc types appearing in signatures + # XXX: we need to lift these earlier + return # is this a bindOnce type class already present in the param list? for i in countup(0, genericParams.len - 1): if genericParams.sons[i].sym.name.id == finalTypId.id: @@ -613,10 +640,11 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, var s = newSym(skType, finalTypId, owner, info) if typId == nil: s.flags.incl(sfAnon) s.linkTo(typeClass) + typeClass.flags.incl tfImplicitTypeParam s.position = genericParams.len genericParams.addSon(newSymNode(s)) result = typeClass - + # XXX: There are codegen errors if this is turned into a nested proc template liftingWalk(typ: PType, anonFlag = false): expr = liftParamType(c, procKind, genericParams, typ, paramName, info, anonFlag) @@ -629,34 +657,38 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, addImplicitGenericImpl(e, paramTypId) case paramType.kind: - of tyExpr: - if paramType.sonsLen == 0: - # proc(a, b: expr) - # no constraints, treat like generic param - result = addImplicitGeneric(newTypeS(tyGenericParam, c)) - else: - # proc(a: expr{string}, b: expr{nkLambda}) - # overload on compile time values and AST trees - result = addImplicitGeneric(c.newTypeWithSons(tyExpr, paramType.sons)) + of tyAnything: + result = addImplicitGeneric(newTypeS(tyGenericParam, c)) + + of tyStatic: + # proc(a: expr{string}, b: expr{nkLambda}) + # overload on compile time values and AST trees + result = addImplicitGeneric(c.newTypeWithSons(tyStatic, paramType.sons)) + result.flags.incl tfHasStatic + of tyTypeDesc: if tfUnresolved notin paramType.flags: # naked typedescs are not bindOnce types if paramType.sonsLen == 0 and paramTypId != nil and paramTypId.id == typedescId.id: paramTypId = nil result = addImplicitGeneric(c.newTypeWithSons(tyTypeDesc, paramType.sons)) + of tyDistinct: if paramType.sonsLen == 1: # disable the bindOnce behavior for the type class result = liftingWalk(paramType.sons[0], true) - of tySequence, tySet, tyArray, tyOpenArray: + + of tySequence, tySet, tyArray, tyOpenArray, + tyVar, tyPtr, tyRef, tyProc: # XXX: this is a bit strange, but proc(s: seq) - # produces tySequence(tyGenericParam, null). + # produces tySequence(tyGenericParam, tyNone). # This also seems to be true when creating aliases # like: type myseq = distinct seq. # Maybe there is another better place to associate # the seq type class with the seq identifier. - if paramType.lastSon == nil: - let typ = c.newTypeWithSons(tyTypeClass, @[newTypeS(paramType.kind, c)]) + if paramType.kind == tySequence and paramType.lastSon.kind == tyNone: + let typ = c.newTypeWithSons(tyBuiltInTypeClass, + @[newTypeS(paramType.kind, c)]) result = addImplicitGeneric(typ) else: for i in 0 .. <paramType.sons.len: @@ -664,25 +696,61 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, if lifted != nil: paramType.sons[i] = lifted result = paramType + of tyGenericBody: - # type Foo[T] = object - # proc x(a: Foo, b: Foo) - var typ = newTypeS(tyTypeClass, c) - typ.addSonSkipIntLit(paramType) - result = addImplicitGeneric(typ) + result = newTypeS(tyGenericInvokation, c) + result.rawAddSon(paramType) + for i in 0 .. paramType.sonsLen - 2: + result.rawAddSon newTypeS(tyAnything, c) + # result.rawAddSon(copyType(paramType.sons[i], getCurrOwner(), true)) + result = instGenericContainer(c, paramType.sym.info, result, + allowMetaTypes = true) + result.lastSon.shouldHaveMeta + result = newTypeWithSons(c, tyCompositeTypeClass, @[paramType, result]) + result = addImplicitGeneric(result) + of tyGenericInst: + if paramType.lastSon.kind == tyUserTypeClass: + var cp = copyType(paramType, getCurrOwner(), false) + cp.kind = tyUserTypeClassInst + return addImplicitGeneric(cp) + for i in 1 .. (paramType.sons.len - 2): var lifted = liftingWalk(paramType.sons[i]) if lifted != nil: paramType.sons[i] = lifted result = paramType - - if result != nil: - result.kind = tyGenericInvokation - result.sons.setLen(result.sons.len - 1) - of tyTypeClass: - result = addImplicitGeneric(copyType(paramType, getCurrOwner(), false)) - else: nil + result.lastSon.shouldHaveMeta + + let liftBody = liftingWalk(paramType.lastSon) + if liftBody != nil: + result = liftBody + result.shouldHaveMeta + + of tyGenericInvokation: + for i in 1 .. <paramType.sonsLen: + let lifted = liftingWalk(paramType.sons[i]) + if lifted != nil: paramType.sons[i] = lifted + + let expanded = instGenericContainer(c, info, paramType, + allowMetaTypes = true) + result = liftingWalk(expanded) + + of tyUserTypeClass, tyBuiltInTypeClass, tyAnd, tyOr, tyNot: + result = addImplicitGeneric(copyType(paramType, getCurrOwner(), true)) + + of tyExpr: + if procKind notin {skMacro, skTemplate}: + result = addImplicitGeneric(newTypeS(tyAnything, c)) + + of tyGenericParam: + if tfGenericTypeParam in paramType.flags and false: + if paramType.sonsLen > 0: + result = liftingWalk(paramType.lastSon) + else: + result = addImplicitGeneric(newTypeS(tyAnything, c)) + + else: discard # result = liftingWalk(paramType) @@ -714,7 +782,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, var counter = 0 for i in countup(1, n.len - 1): var a = n.sons[i] - if a.kind != nkIdentDefs: IllFormedAst(a) + if a.kind != nkIdentDefs: illFormedAst(a) checkMinSonsLen(a, 3) var typ: PType = nil @@ -738,8 +806,9 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, if not containsGenericType(typ): def = fitNode(c, typ, def) if not (hasType or hasDefault): - typ = newTypeS(tyExpr, c) - + let tdef = if kind in {skTemplate, skMacro}: tyExpr else: tyAnything + typ = newTypeS(tdef, c) + if skipTypes(typ, {tyGenericInst}).kind == tyEmpty: continue for j in countup(0, length-3): var arg = newSymG(skParam, a.sons[j], c) @@ -751,11 +820,13 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, arg.constraint = constraint inc(counter) if def != nil and def.kind != nkEmpty: arg.ast = copyTree(def) - if ContainsOrIncl(check, arg.name.id): - LocalError(a.sons[j].info, errAttemptToRedefine, arg.name.s) + if containsOrIncl(check, arg.name.id): + localError(a.sons[j].info, errAttemptToRedefine, arg.name.s) addSon(result.n, newSymNode(arg)) rawAddSon(result, finalType) addParamOrResult(c, arg, kind) + if gCmd == cmdPretty: checkDef(a.sons[j], arg) + if n.sons[0].kind != nkEmpty: var r = semTypeNode(c, n.sons[0], nil) @@ -783,7 +854,7 @@ proc semStmtListType(c: PContext, n: PNode, prev: PType): PType = result = nil proc semBlockType(c: PContext, n: PNode, prev: PType): PType = - Inc(c.p.nestedBlockCounter) + inc(c.p.nestedBlockCounter) checkSonsLen(n, 2) openScope(c) if n.sons[0].kind notin {nkEmpty, nkSym}: @@ -792,59 +863,47 @@ proc semBlockType(c: PContext, n: PNode, prev: PType): PType = n.sons[1].typ = result n.typ = result closeScope(c) - Dec(c.p.nestedBlockCounter) + dec(c.p.nestedBlockCounter) proc semGenericParamInInvokation(c: PContext, n: PNode): PType = - # XXX hack 1022 for generics ... would have been nice if the compiler had - # been designed with them in mind from start ... - when false: - if n.kind == nkSym: - # for generics we need to lookup the type var again: - var s = searchInScopes(c, n.sym.name) - if s != nil: - if s.kind == skType and s.typ != nil: - var t = n.sym.typ - echo "came here" - return t - else: - echo "s is crap:" - debug(s) - else: - echo "s is nil!!!!" result = semTypeNode(c, n, nil) proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType = result = newOrPrevType(tyGenericInvokation, prev, c) addSonSkipIntLit(result, s.typ) - + template addToResult(typ) = if typ.isNil: - InternalAssert false + internalAssert false rawAddSon(result, typ) else: addSonSkipIntLit(result, typ) if s.typ == nil: - LocalError(n.info, errCannotInstantiateX, s.name.s) + localError(n.info, errCannotInstantiateX, s.name.s) return newOrPrevType(tyError, prev, c) elif s.typ.kind == tyForward: for i in countup(1, sonsLen(n)-1): var elem = semGenericParamInInvokation(c, n.sons[i]) addToResult(elem) + elif s.typ.kind != tyGenericBody: + #we likely got code of the form TypeA[TypeB] where TypeA is + #not generic. + localError(n.info, errNoGenericParamsAllowedForX, s.name.s) + return newOrPrevType(tyError, prev, c) else: - internalAssert s.typ.kind == tyGenericBody - var m = newCandidate(s, n) + var m = newCandidate(c, s, n) matches(c, n, copyTree(n), m) if m.state != csMatch: var err = "cannot instantiate " & typeToString(s.typ) & "\n" & "got: (" & describeArgs(c, n) & ")\n" & "but expected: (" & describeArgs(c, s.typ.n, 0) & ")" - LocalError(n.info, errGenerated, err) + localError(n.info, errGenerated, err) return newOrPrevType(tyError, prev, c) var isConcrete = true - + for i in 1 .. <m.call.len: let typ = m.call[i].typ.skipTypes({tyTypeDesc}) if containsGenericType(typ): isConcrete = false @@ -852,20 +911,18 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType = if isConcrete: if s.ast == nil: - LocalError(n.info, errCannotInstantiateX, s.name.s) + localError(n.info, errCannotInstantiateX, s.name.s) result = newOrPrevType(tyError, prev, c) else: - when oUseLateInstantiation: - result = lateInstantiateGeneric(c, result, n.info) - else: - result = instGenericContainer(c, n, result) + result = instGenericContainer(c, n.info, result, + allowMetaTypes = false) proc semTypeExpr(c: PContext, n: PNode): PType = var n = semExprWithType(c, n, {efDetermineType}) - if n.kind == nkSym and n.sym.kind == skType: - result = n.sym.typ + if n.typ.kind == tyTypeDesc: + result = n.typ.base else: - LocalError(n.info, errTypeExpected, n.renderTree) + localError(n.info, errTypeExpected, n.renderTree) proc freshType(res, prev: PType): PType {.inline.} = if prev.isNil: @@ -875,9 +932,8 @@ proc freshType(res, prev: PType): PType {.inline.} = proc semTypeClass(c: PContext, n: PNode, prev: PType): PType = # if n.sonsLen == 0: return newConstraint(c, tyTypeClass) - result = newOrPrevType(tyTypeClass, prev, c) - result.testeeName = considerAcc(n[0]) - result.n = n[3] + result = newOrPrevType(tyUserTypeClass, prev, c) + result.n = n let pragmas = n[1] @@ -892,7 +948,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result = nil if gCmd == cmdIdeTools: suggestExpr(c, n) case n.kind - of nkEmpty: nil + of nkEmpty: discard of nkTypeOfExpr: # for ``type(countup(1,3))``, see ``tests/ttoseq``. checkSonsLen(n, 1) @@ -901,7 +957,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = if sonsLen(n) == 1: result = semTypeNode(c, n.sons[0], prev) else: # XXX support anon tuple here - LocalError(n.info, errTypeExpected) + localError(n.info, errTypeExpected) result = newOrPrevType(tyError, prev, c) of nkCallKinds: if isRange(n): @@ -913,26 +969,29 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = var t1 = semTypeNode(c, n.sons[1], nil) t2 = semTypeNode(c, n.sons[2], nil) - if t1 == nil: - LocalError(n.sons[1].info, errTypeExpected) + if t1 == nil: + localError(n.sons[1].info, errTypeExpected) result = newOrPrevType(tyError, prev, c) - elif t2 == nil: - LocalError(n.sons[2].info, errTypeExpected) + elif t2 == nil: + localError(n.sons[2].info, errTypeExpected) result = newOrPrevType(tyError, prev, c) else: - result = newTypeS(tyTypeClass, c) - result.addSonSkipIntLit(t1) - result.addSonSkipIntLit(t2) - result.flags.incl(if op.id == ord(wAnd): tfAll else: tfAny) - result.flags.incl(tfHasMeta) + result = if op.id == ord(wAnd): makeAndType(c, t1, t2) + else: makeOrType(c, t1, t2) elif op.id == ord(wNot): - checkSonsLen(n, 3) - result = semTypeNode(c, n.sons[1], prev) - if result.kind in NilableTypes and n.sons[2].kind == nkNilLit: - result = freshType(result, prev) - result.flags.incl(tfNotNil) + case n.len + of 3: + result = semTypeNode(c, n.sons[1], prev) + if result.kind in NilableTypes and n.sons[2].kind == nkNilLit: + result = freshType(result, prev) + result.flags.incl(tfNotNil) + else: + localError(n.info, errGenerated, "invalid type") + of 2: + let negated = semTypeNode(c, n.sons[1], prev) + result = makeNotType(c, negated) else: - LocalError(n.info, errGenerated, "invalid type") + localError(n.info, errGenerated, "invalid type") else: result = semTypeExpr(c, n) else: @@ -960,13 +1019,19 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result.rawAddSon(semTypeNode(c, n.sons[i], nil)) else: result = semGeneric(c, n, s, prev) of nkIdent, nkDotExpr, nkAccQuoted: + if n.kind == nkDotExpr: + let head = qualifiedLookUp(c, n[0], {checkAmbiguity, checkUndeclared}) + if head.kind in {skType}: + var toBind = initIntSet() + var preprocessed = semGenericStmt(c, n, {}, toBind) + return makeTypeFromExpr(c, preprocessed) var s = semTypeIdent(c, n) if s.typ == nil: - if s.kind != skError: LocalError(n.info, errTypeExpected) + if s.kind != skError: localError(n.info, errTypeExpected) result = newOrPrevType(tyError, prev, c) elif s.kind == skParam and s.typ.kind == tyTypeDesc: assert s.typ.len > 0 - InternalAssert prev == nil + internalAssert prev == nil result = s.typ.sons[0] elif prev == nil: result = s.typ @@ -987,7 +1052,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result = prev markUsed(n, n.sym) else: - if n.sym.kind != skError: LocalError(n.info, errTypeExpected) + if n.sym.kind != skError: localError(n.info, errTypeExpected) result = newOrPrevType(tyError, prev, c) of nkObjectTy: result = semObjectNode(c, n, prev) of nkTupleTy: result = semTuple(c, n, prev) @@ -996,6 +1061,11 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = of nkPtrTy: result = semAnyRef(c, n, tyPtr, prev) of nkVarTy: result = semVarType(c, n, prev) of nkDistinctTy: result = semDistinct(c, n, prev) + of nkStaticTy: + result = newOrPrevType(tyStatic, prev, c) + var base = semTypeNode(c, n.sons[0], nil) + result.rawAddSon(base) + result.flags.incl tfHasStatic of nkProcTy, nkIteratorTy: if n.sonsLen == 0: result = newConstraint(c, tyProc) @@ -1012,7 +1082,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = #Message(n.info, warnImplicitClosure, renderTree(n)) else: pragma(c, s, n.sons[1], procTypePragmas) - when useEffectSystem: SetEffectsForProcType(result, n.sons[1]) + when useEffectSystem: setEffectsForProcType(result, n.sons[1]) closeScope(c) if n.kind == nkIteratorTy: result.flags.incl(tfIterator) @@ -1027,7 +1097,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType = result = freshType(result, prev) result.flags.incl(tfShared) else: - LocalError(n.info, errTypeExpected) + localError(n.info, errTypeExpected) result = newOrPrevType(tyError, prev, c) proc setMagicType(m: PSym, kind: TTypeKind, size: int) = @@ -1067,24 +1137,31 @@ proc processMagicType(c: PContext, m: PSym) = of mNil: setMagicType(m, tyNil, ptrSize) of mExpr: setMagicType(m, tyExpr, 0) of mStmt: setMagicType(m, tyStmt, 0) - of mTypeDesc: setMagicType(m, tyTypeDesc, 0) + of mTypeDesc: + setMagicType(m, tyTypeDesc, 0) + rawAddSon(m.typ, newTypeS(tyNone, c)) of mVoidType: setMagicType(m, tyEmpty, 0) - of mArray: setMagicType(m, tyArray, 0) - of mOpenArray: setMagicType(m, tyOpenArray, 0) - of mVarargs: setMagicType(m, tyVarargs, 0) - of mRange: setMagicType(m, tyRange, 0) - of mSet: setMagicType(m, tySet, 0) - of mSeq: setMagicType(m, tySequence, 0) - of mOrdinal: setMagicType(m, tyOrdinal, 0) - of mPNimrodNode: nil - else: LocalError(m.info, errTypeExpected) + of mArray: + setMagicType(m, tyArray, 0) + of mOpenArray: + setMagicType(m, tyOpenArray, 0) + of mVarargs: + setMagicType(m, tyVarargs, 0) + of mRange: + setMagicType(m, tyRange, 0) + rawAddSon(m.typ, newTypeS(tyNone, c)) + of mSet: + setMagicType(m, tySet, 0) + of mSeq: + setMagicType(m, tySequence, 0) + of mOrdinal: + setMagicType(m, tyOrdinal, 0) + rawAddSon(m.typ, newTypeS(tyNone, c)) + of mPNimrodNode: discard + else: localError(m.info, errTypeExpected) proc semGenericConstraints(c: PContext, x: PType): PType = - if x.kind in StructuralEquivTypes and ( - sonsLen(x) == 0 or x.sons[0].kind in {tyGenericParam, tyEmpty}): - result = newConstraint(c, x.kind) - else: - result = newTypeWithSons(c, tyGenericParam, @[x]) + result = newTypeWithSons(c, tyGenericParam, @[x]) proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = result = copyNode(n) @@ -1101,10 +1178,10 @@ proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = if constraint.kind != nkEmpty: typ = semTypeNode(c, constraint, nil) - if typ.kind != tyExpr or typ.len == 0: + if typ.kind != tyStatic or typ.len == 0: if typ.kind == tyTypeDesc: - if typ.len == 0: - typ = newTypeS(tyTypeDesc, c) + if typ.sons[0].kind == tyNone: + typ = newTypeWithSons(c, tyTypeDesc, @[newTypeS(tyNone, c)]) else: typ = semGenericConstraints(c, typ) @@ -1112,14 +1189,16 @@ proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = def = semConstExpr(c, def) if typ == nil: if def.typ.kind != tyTypeDesc: - typ = newTypeWithSons(c, tyExpr, @[def.typ]) + typ = newTypeWithSons(c, tyStatic, @[def.typ]) else: if not containsGenericType(def.typ): def = fitNode(c, typ, def) if typ == nil: typ = newTypeS(tyGenericParam, c) - + + typ.flags.incl tfGenericTypeParam + for j in countup(0, L-3): let finalType = if j == 0: typ else: copyType(typ, typ.owner, false) @@ -1128,7 +1207,7 @@ proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = # of the parameter will be stored in the # attached symbol. var s = case finalType.kind - of tyExpr: + of tyStatic: newSymG(skGenericParam, a.sons[j], c).linkTo(finalType) else: newSymG(skType, a.sons[j], c).linkTo(finalType) diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 61c31a4fe..a07d91241 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -11,21 +11,24 @@ import ast, astalgo, msgs, types, magicsys, semdata, renderer +const + tfInstClearedFlags = {tfHasMeta} + proc checkPartialConstructedType(info: TLineInfo, t: PType) = if tfAcyclic in t.flags and skipTypes(t, abstractInst).kind != tyObject: - LocalError(info, errInvalidPragmaX, "acyclic") + localError(info, errInvalidPragmaX, "acyclic") elif t.kind == tyVar and t.sons[0].kind == tyVar: - LocalError(info, errVarVarTypeNotAllowed) + localError(info, errVarVarTypeNotAllowed) -proc checkConstructedType*(info: TLineInfo, typ: PType) = +proc checkConstructedType*(info: TLineInfo, typ: PType) = var t = typ.skipTypes({tyDistinct}) - if t.kind in {tyTypeClass}: nil + if t.kind in tyTypeClasses: discard elif tfAcyclic in t.flags and skipTypes(t, abstractInst).kind != tyObject: - LocalError(info, errInvalidPragmaX, "acyclic") + localError(info, errInvalidPragmaX, "acyclic") elif t.kind == tyVar and t.sons[0].kind == tyVar: - LocalError(info, errVarVarTypeNotAllowed) - elif computeSize(t) < 0: - LocalError(info, errIllegalRecursionInTypeX, typeToString(t)) + localError(info, errVarVarTypeNotAllowed) + elif computeSize(t) == szIllegalRecursion: + localError(info, errIllegalRecursionInTypeX, typeToString(t)) when false: if t.kind == tyObject and t.sons[0] != nil: if t.sons[0].kind != tyObject or tfFinal in t.sons[0].flags: @@ -33,7 +36,7 @@ proc checkConstructedType*(info: TLineInfo, typ: PType) = proc searchInstTypes*(key: PType): PType = let genericTyp = key.sons[0] - InternalAssert genericTyp.kind == tyGenericBody and + internalAssert genericTyp.kind == tyGenericBody and key.sons[0] == genericTyp and genericTyp.sym != nil @@ -47,12 +50,13 @@ proc searchInstTypes*(key: PType): PType = # types such as TChannel[empty]. Why? # See the notes for PActor in handleGenericInvokation return - block MatchType: + block matchType: for j in 1 .. high(key.sons): # XXX sameType is not really correct for nested generics? - if not sameType(inst.sons[j], key.sons[j]): - break MatchType - + if not compareTypes(inst.sons[j], key.sons[j], + flags = {ExactGenericParams}): + break matchType + return inst proc cacheTypeInst*(inst: PType) = @@ -66,30 +70,89 @@ type c*: PContext typeMap*: TIdTable # map PType to PType symMap*: TIdTable # map PSym to PSym + localCache*: TIdTable # local cache for remembering alraedy replaced + # types during instantiation of meta types + # (they are not stored in the global cache) info*: TLineInfo + allowMetaTypes*: bool # allow types such as seq[Number] + # i.e. the result contains unresolved generics -proc ReplaceTypeVarsT*(cl: var TReplTypeVars, t: PType): PType -proc ReplaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym -proc ReplaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode +proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType +proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym +proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode + +template checkMetaInvariants(cl: TReplTypeVars, t: PType) = + when false: + if t != nil and tfHasMeta in t.flags and + cl.allowMetaTypes == false: + echo "UNEXPECTED META ", t.id, " ", instantiationInfo(-1) + debug t + writeStackTrace() + quit 1 + +proc replaceTypeVarsT*(cl: var TReplTypeVars, t: PType): PType = + result = replaceTypeVarsTAux(cl, t) + checkMetaInvariants(cl, result) proc prepareNode(cl: var TReplTypeVars, n: PNode): PNode = result = copyNode(n) - result.typ = ReplaceTypeVarsT(cl, n.typ) - if result.kind == nkSym: result.sym = ReplaceTypeVarsS(cl, n.sym) - for i in 0 .. safeLen(n)-1: - # XXX HACK: ``f(a, b)``, avoid to instantiate `f` - if i == 0: result.add(n[i]) + result.typ = replaceTypeVarsT(cl, n.typ) + if result.kind == nkSym: result.sym = replaceTypeVarsS(cl, n.sym) + let isCall = result.kind in nkCallKinds + for i in 0 .. <n.safeLen: + # XXX HACK: ``f(a, b)``, avoid to instantiate `f` + if isCall and i == 0: result.add(n[i]) else: result.add(prepareNode(cl, n[i])) -proc ReplaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode = +proc isTypeParam(n: PNode): bool = + # XXX: generic params should use skGenericParam instead of skType + return n.kind == nkSym and + (n.sym.kind == skGenericParam or + (n.sym.kind == skType and sfFromGeneric in n.sym.flags)) + +proc hasGenericArguments*(n: PNode): bool = + if n.kind == nkSym: + return n.sym.kind == skGenericParam or + (n.sym.kind == skType and + n.sym.typ.flags * {tfGenericTypeParam, tfImplicitTypeParam} != {}) + else: + for i in 0.. <n.safeLen: + if hasGenericArguments(n.sons[i]): return true + return false + +proc reResolveCallsWithTypedescParams(cl: var TReplTypeVars, n: PNode): PNode = + # This is needed fo tgenericshardcases + # It's possible that a generic param will be used in a proc call to a + # typedesc accepting proc. After generic param substitution, such procs + # should be optionally instantiated with the correct type. In order to + # perform this instantiation, we need to re-run the generateInstance path + # in the compiler, but it's quite complicated to do so at the moment so we + # resort to a mild hack; the head symbol of the call is temporary reset and + # overload resolution is executed again (which may trigger generateInstance). + if n.kind in nkCallKinds and sfFromGeneric in n[0].sym.flags: + var needsFixing = false + for i in 1 .. <n.safeLen: + if isTypeParam(n[i]): needsFixing = true + if needsFixing: + n.sons[0] = newSymNode(n.sons[0].sym.owner) + return cl.c.semOverloadedCall(cl.c, n, n, {skProc}) + + for i in 0 .. <n.safeLen: + n.sons[i] = reResolveCallsWithTypedescParams(cl, n[i]) + + return n + +proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode = if n == nil: return result = copyNode(n) - result.typ = ReplaceTypeVarsT(cl, n.typ) + if n.typ != nil: + result.typ = replaceTypeVarsT(cl, n.typ) + checkMetaInvariants(cl, result.typ) case n.kind of nkNone..pred(nkSym), succ(nkSym)..nkNilLit: - nil + discard of nkSym: - result.sym = ReplaceTypeVarsS(cl, n.sym) + result.sym = replaceTypeVarsS(cl, n.sym) of nkRecWhen: var branch: PNode = nil # the branch to take for i in countup(0, sonsLen(n) - 1): @@ -101,72 +164,91 @@ proc ReplaceTypeVarsN(cl: var TReplTypeVars, n: PNode): PNode = var cond = prepareNode(cl, it.sons[0]) var e = cl.c.semConstExpr(cl.c, cond) if e.kind != nkIntLit: - InternalError(e.info, "ReplaceTypeVarsN: when condition not a bool") + internalError(e.info, "ReplaceTypeVarsN: when condition not a bool") if e.intVal != 0 and branch == nil: branch = it.sons[1] of nkElse: checkSonsLen(it, 1) if branch == nil: branch = it.sons[0] else: illFormedAst(n) if branch != nil: - result = ReplaceTypeVarsN(cl, branch) + result = replaceTypeVarsN(cl, branch) else: result = newNodeI(nkRecList, n.info) + of nkStaticExpr: + var n = prepareNode(cl, n) + n = reResolveCallsWithTypedescParams(cl, n) + result = cl.c.semExpr(cl.c, n) else: var length = sonsLen(n) if length > 0: newSons(result, length) for i in countup(0, length - 1): - result.sons[i] = ReplaceTypeVarsN(cl, n.sons[i]) + result.sons[i] = replaceTypeVarsN(cl, n.sons[i]) -proc ReplaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym = +proc replaceTypeVarsS(cl: var TReplTypeVars, s: PSym): PSym = if s == nil: return nil result = PSym(idTableGet(cl.symMap, s)) if result == nil: result = copySym(s, false) incl(result.flags, sfFromGeneric) idTablePut(cl.symMap, s, result) - result.typ = ReplaceTypeVarsT(cl, s.typ) + result.typ = replaceTypeVarsT(cl, s.typ) result.owner = s.owner - result.ast = ReplaceTypeVarsN(cl, s.ast) + result.ast = replaceTypeVarsN(cl, s.ast) proc lookupTypeVar(cl: TReplTypeVars, t: PType): PType = result = PType(idTableGet(cl.typeMap, t)) if result == nil: - LocalError(t.sym.info, errCannotInstantiateX, typeToString(t)) + if cl.allowMetaTypes or tfRetType in t.flags: return + localError(t.sym.info, errCannotInstantiateX, typeToString(t)) result = errorType(cl.c) - elif result.kind == tyGenericParam: - InternalError(cl.info, "substitution with generic parameter") - + elif result.kind == tyGenericParam and not cl.allowMetaTypes: + internalError(cl.info, "substitution with generic parameter") + +proc instCopyType(cl: var TReplTypeVars, t: PType): PType = + # XXX: relying on allowMetaTypes is a kludge + result = copyType(t, t.owner, cl.allowMetaTypes) + result.flags.incl tfFromGeneric + result.flags.excl tfInstClearedFlags + proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType = # tyGenericInvokation[A, tyGenericInvokation[A, B]] # is difficult to handle: var body = t.sons[0] - if body.kind != tyGenericBody: InternalError(cl.info, "no generic body") + if body.kind != tyGenericBody: internalError(cl.info, "no generic body") var header: PType = nil # search for some instantiation here: - result = searchInstTypes(t) + if cl.allowMetaTypes: + result = PType(idTableGet(cl.localCache, t)) + else: + result = searchInstTypes(t) if result != nil: return for i in countup(1, sonsLen(t) - 1): var x = t.sons[i] if x.kind == tyGenericParam: x = lookupTypeVar(cl, x) - if header == nil: header = copyType(t, t.owner, false) - header.sons[i] = x - propagateToOwner(header, x) - #idTablePut(cl.typeMap, body.sons[i-1], x) - + if x != nil: + if header == nil: header = instCopyType(cl, t) + header.sons[i] = x + propagateToOwner(header, x) + if header != nil: # search again after first pass: result = searchInstTypes(header) if result != nil: return else: - header = copyType(t, t.owner, false) + header = instCopyType(cl, t) + + result = newType(tyGenericInst, t.sons[0].owner) + # be careful not to propagate unnecessary flags here (don't use rawAddSon) + result.sons = @[header.sons[0]] # ugh need another pass for deeply recursive generic types (e.g. PActor) # we need to add the candidate here, before it's fully instantiated for # recursive instantions: - result = newType(tyGenericInst, t.sons[0].owner) - result.rawAddSon(header.sons[0]) - cacheTypeInst(result) + if not cl.allowMetaTypes: + cacheTypeInst(result) + else: + idTablePut(cl.localCache, t, result) for i in countup(1, sonsLen(t) - 1): var x = replaceTypeVarsT(cl, t.sons[i]) @@ -175,71 +257,168 @@ proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType = propagateToOwner(header, x) idTablePut(cl.typeMap, body.sons[i-1], x) - for i in countup(1, sonsLen(t) - 1): + for i in countup(1, sonsLen(t) - 1): # if one of the params is not concrete, we cannot do anything # but we already raised an error! rawAddSon(result, header.sons[i]) - - var newbody = ReplaceTypeVarsT(cl, lastSon(body)) - newbody.flags = newbody.flags + t.flags + body.flags + + var newbody = replaceTypeVarsT(cl, lastSon(body)) + newbody.flags = newbody.flags + (t.flags + body.flags - tfInstClearedFlags) result.flags = result.flags + newbody.flags newbody.callConv = body.callConv - newbody.n = ReplaceTypeVarsN(cl, lastSon(body).n) # This type may be a generic alias and we want to resolve it here. # One step is enough, because the recursive nature of # handleGenericInvokation will handle the alias-to-alias-to-alias case if newbody.isGenericAlias: newbody = newbody.skipGenericAlias rawAddSon(result, newbody) checkPartialConstructedType(cl.info, newbody) + +proc eraseVoidParams(t: PType) = + if t.sons[0] != nil and t.sons[0].kind == tyEmpty: + t.sons[0] = nil -proc ReplaceTypeVarsT*(cl: var TReplTypeVars, t: PType): PType = + for i in 1 .. <t.sonsLen: + # don't touch any memory unless necessary + if t.sons[i].kind == tyEmpty: + var pos = i + for j in i+1 .. <t.sonsLen: + if t.sons[j].kind != tyEmpty: + t.sons[pos] = t.sons[j] + t.n.sons[pos] = t.n.sons[j] + inc pos + setLen t.sons, pos + setLen t.n.sons, pos + return + +proc skipIntLiteralParams(t: PType) = + for i in 0 .. <t.sonsLen: + let p = t.sons[i] + if p == nil: continue + let skipped = p.skipIntLit + if skipped != p: + t.sons[i] = skipped + if i > 0: t.n.sons[i].sym.typ = skipped + +proc propagateFieldFlags(t: PType, n: PNode) = + # This is meant for objects and tuples + # The type must be fully instantiated! + internalAssert n.kind != nkRecWhen + case n.kind + of nkSym: + propagateToOwner(t, n.sym.typ) + of nkRecList, nkRecCase, nkOfBranch, nkElse: + if n.sons != nil: + for son in n.sons: + propagateFieldFlags(t, son) + else: discard + +proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = result = t - if t == nil: return + if t == nil: return + + if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses: + let lookup = PType(idTableGet(cl.typeMap, t)) + if lookup != nil: return lookup + case t.kind - of tyTypeClass: nil - of tyGenericParam: - result = lookupTypeVar(cl, t) - if result.kind == tyGenericInvokation: - result = handleGenericInvokation(cl, result) - of tyExpr: - if t.sym != nil and t.sym.kind == skGenericParam: - result = lookupTypeVar(cl, t) - of tyGenericInvokation: + of tyGenericInvokation: result = handleGenericInvokation(cl, t) + of tyGenericBody: - InternalError(cl.info, "ReplaceTypeVarsT: tyGenericBody") - result = ReplaceTypeVarsT(cl, lastSon(t)) + internalError(cl.info, "ReplaceTypeVarsT: tyGenericBody" ) + result = replaceTypeVarsT(cl, lastSon(t)) + + of tyFromExpr: + var n = prepareNode(cl, t.n) + n = cl.c.semConstExpr(cl.c, n) + if n.typ.kind == tyTypeDesc: + # XXX: sometimes, chained typedescs enter here. + # It may be worth investigating why this is happening, + # because it may cause other bugs elsewhere. + result = n.typ.skipTypes({tyTypeDesc}) + # result = n.typ.base + else: + if n.typ.kind != tyStatic: + # XXX: In the future, semConstExpr should + # return tyStatic values to let anyone make + # use of this knowledge. The patching here + # won't be necessary then. + result = newTypeS(tyStatic, cl.c) + result.sons = @[n.typ] + result.n = n + else: + result = n.typ + of tyInt: result = skipIntLit(t) # XXX now there are also float literals + + of tyTypeDesc: + let lookup = PType(idTableGet(cl.typeMap, t)) # lookupTypeVar(cl, t) + if lookup != nil: + result = lookup + if tfUnresolved in t.flags: result = result.base + elif t.sons[0].kind != tyNone: + result = makeTypeDesc(cl.c, replaceTypeVarsT(cl, t.sons[0])) + + of tyUserTypeClass: + result = t + + of tyGenericInst: + result = instCopyType(cl, t) + for i in 1 .. <result.sonsLen: + result.sons[i] = replaceTypeVarsT(cl, result.sons[i]) + propagateToOwner(result, result.lastSon) + else: - if t.kind == tyArray: - let idxt = t.sons[0] - if idxt.kind == tyExpr and - idxt.sym != nil and idxt.sym.kind == skGenericParam: - let value = lookupTypeVar(cl, idxt).n - t.sons[0] = makeRangeType(cl.c, 0, value.intVal - 1, value.info) if containsGenericType(t): - result = copyType(t, t.owner, false) - incl(result.flags, tfFromGeneric) + result = instCopyType(cl, t) result.size = -1 # needs to be recomputed + for i in countup(0, sonsLen(result) - 1): - result.sons[i] = ReplaceTypeVarsT(cl, result.sons[i]) - result.n = ReplaceTypeVarsN(cl, result.n) - if result.Kind in GenericTypes: - LocalError(cl.info, errCannotInstantiateX, TypeToString(t, preferName)) - if result.kind == tyProc and result.sons[0] != nil: - if result.sons[0].kind == tyEmpty: - result.sons[0] = nil - -proc generateTypeInstance*(p: PContext, pt: TIdTable, arg: PNode, - t: PType): PType = + if result.sons[i] != nil: + result.sons[i] = replaceTypeVarsT(cl, result.sons[i]) + propagateToOwner(result, result.sons[i]) + + result.n = replaceTypeVarsN(cl, result.n) + + # XXX: This is not really needed? + # if result.kind in GenericTypes: + # localError(cl.info, errCannotInstantiateX, typeToString(t, preferName)) + + case result.kind + of tyArray: + let idx = result.sons[0] + if idx.kind == tyStatic: + if idx.n == nil: + let lookup = lookupTypeVar(cl, idx) + internalAssert lookup != nil + idx.n = lookup.n + + result.sons[0] = makeRangeType(cl.c, 0, idx.n.intVal - 1, idx.n.info) + + of tyObject, tyTuple: + propagateFieldFlags(result, result.n) + + of tyProc: + eraseVoidParams(result) + skipIntLiteralParams(result) + + else: discard + +proc generateTypeInstance*(p: PContext, pt: TIdTable, info: TLineInfo, + t: PType): PType = var cl: TReplTypeVars - InitIdTable(cl.symMap) + initIdTable(cl.symMap) copyIdTable(cl.typeMap, pt) - cl.info = arg.info + initIdTable(cl.localCache) + cl.info = info cl.c = p - pushInfoContext(arg.info) - result = ReplaceTypeVarsT(cl, t) + pushInfoContext(info) + result = replaceTypeVarsT(cl, t) popInfoContext() +template generateTypeInstance*(p: PContext, pt: TIdTable, arg: PNode, + t: PType): expr = + generateTypeInstance(p, pt, arg.info, t) + diff --git a/compiler/service.nim b/compiler/service.nim index 1de83af7c..42c4aa9f4 100644 --- a/compiler/service.nim +++ b/compiler/service.nim @@ -29,23 +29,23 @@ var # the arguments to be passed to the program that # should be run -proc ProcessCmdLine*(pass: TCmdLinePass, cmd: string) = +proc processCmdLine*(pass: TCmdLinePass, cmd: string) = var p = parseopt.initOptParser(cmd) var argsCount = 0 while true: parseopt.next(p) case p.kind of cmdEnd: break - of cmdLongOption, cmdShortOption: + of cmdLongoption, cmdShortOption: # hint[X]:off is parsed as (p.key = "hint[X]", p.val = "off") # we fix this here var bracketLe = strutils.find(p.key, '[') if bracketLe >= 0: var key = substr(p.key, 0, bracketLe - 1) var val = substr(p.key, bracketLe + 1) & ':' & p.val - ProcessSwitch(key, val, pass, gCmdLineInfo) + processSwitch(key, val, pass, gCmdLineInfo) else: - ProcessSwitch(p.key, p.val, pass, gCmdLineInfo) + processSwitch(p.key, p.val, pass, gCmdLineInfo) of cmdArgument: if argsCount == 0: options.command = p.key @@ -79,11 +79,11 @@ proc serve*(action: proc (){.nimcall.}) = if line == "quit": quit() execute line echo "" - FlushFile(stdout) + flushFile(stdout) of "tcp", "": when useCaas: - var server = Socket() + var server = socket() let p = getConfigVar("server.port") let port = if p.len > 0: parseInt(p).TPort else: 6000.TPort server.bindAddr(port, getConfigVar("server.address")) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 318acc660..f9200ea0c 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -21,7 +21,8 @@ type TCandidateState* = enum csEmpty, csMatch, csNoMatch - TCandidate* {.final.} = object + TCandidate* {.final.} = object + c*: PContext exactMatches*: int # also misused to prefer iters over procs genericMatches: int # also misused to prefer constraints subtypeMatches: int @@ -30,7 +31,8 @@ type state*: TCandidateState callee*: PType # may not be nil! calleeSym*: PSym # may be nil - calleeScope: int # may be -1 for unknown scope + calleeScope*: int # scope depth: + # is this a top-level symbol or a nested proc? call*: PNode # modified call bindings*: TIdTable # maps types to types baseTypeMatch: bool # needed for conversions from T to openarray[T] @@ -58,7 +60,9 @@ const proc markUsed*(n: PNode, s: PSym) -proc initCandidateAux(c: var TCandidate, callee: PType) {.inline.} = +proc initCandidateAux(ctx: PContext, + c: var TCandidate, callee: PType) {.inline.} = + c.c = ctx c.exactMatches = 0 c.subtypeMatches = 0 c.convMatches = 0 @@ -71,31 +75,44 @@ proc initCandidateAux(c: var TCandidate, callee: PType) {.inline.} = c.genericConverter = false c.inheritancePenalty = 0 -proc initCandidate*(c: var TCandidate, callee: PType) = - initCandidateAux(c, callee) +proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PType) = + initCandidateAux(ctx, c, callee) c.calleeSym = nil initIdTable(c.bindings) proc put(t: var TIdTable, key, val: PType) {.inline.} = - IdTablePut(t, key, val) + idTablePut(t, key, val) -proc initCandidate*(c: var TCandidate, callee: PSym, binding: PNode, - calleeScope = -1) = - initCandidateAux(c, callee.typ) +proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PSym, + binding: PNode, calleeScope = -1) = + initCandidateAux(ctx, c, callee.typ) c.calleeSym = callee - c.calleeScope = calleeScope + if callee.kind in skProcKinds and calleeScope == -1: + if callee.originatingModule == ctx.module: + let rootSym = if sfFromGeneric notin callee.flags: callee + else: callee.owner + c.calleeScope = rootSym.scope.depthLevel + else: + c.calleeScope = 1 + else: + c.calleeScope = calleeScope initIdTable(c.bindings) - if binding != nil and callee.kind in RoutineKinds: + c.errors = nil + if binding != nil and callee.kind in routineKinds: var typeParams = callee.ast[genericParamsPos] for i in 1..min(sonsLen(typeParams), sonsLen(binding)-1): var formalTypeParam = typeParams.sons[i-1].typ - #debug(formalTypeParam) - put(c.bindings, formalTypeParam, binding[i].typ) + var bound = binding[i].typ + if bound != nil and formalTypeParam.kind != tyTypeDesc: + bound = bound.skipTypes({tyTypeDesc}) + put(c.bindings, formalTypeParam, bound) -proc newCandidate*(callee: PSym, binding: PNode, calleeScope = -1): TCandidate = - initCandidate(result, callee, binding, calleeScope) +proc newCandidate*(ctx: PContext, callee: PSym, + binding: PNode, calleeScope = -1): TCandidate = + initCandidate(ctx, result, callee, binding, calleeScope) proc copyCandidate(a: var TCandidate, b: TCandidate) = + a.c = b.c a.exactMatches = b.exactMatches a.subtypeMatches = b.subtypeMatches a.convMatches = b.convMatches @@ -123,7 +140,7 @@ proc sumGeneric(t: PType): int = result = ord(t.kind == tyGenericInvokation) for i in 0 .. <t.len: result += t.sons[i].sumGeneric break - of tyGenericParam, tyExpr, tyStmt, tyTypeDesc, tyTypeClass: break + of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break else: return 0 proc complexDisambiguation(a, b: PType): int = @@ -158,9 +175,8 @@ proc cmpCandidates*(a, b: TCandidate): int = if result != 0: return result = a.convMatches - b.convMatches if result != 0: return - if (a.calleeScope != -1) and (b.calleeScope != -1): - result = a.calleeScope - b.calleeScope - if result != 0: return + result = a.calleeScope - b.calleeScope + if result != 0: return # the other way round because of other semantics: result = b.inheritancePenalty - a.inheritancePenalty if result != 0: return @@ -168,11 +184,11 @@ proc cmpCandidates*(a, b: TCandidate): int = result = complexDisambiguation(a.callee, b.callee) proc writeMatches*(c: TCandidate) = - Writeln(stdout, "exact matches: " & $c.exactMatches) - Writeln(stdout, "subtype matches: " & $c.subtypeMatches) - Writeln(stdout, "conv matches: " & $c.convMatches) - Writeln(stdout, "intconv matches: " & $c.intConvMatches) - Writeln(stdout, "generic matches: " & $c.genericMatches) + writeln(stdout, "exact matches: " & $c.exactMatches) + writeln(stdout, "subtype matches: " & $c.subtypeMatches) + writeln(stdout, "conv matches: " & $c.convMatches) + writeln(stdout, "intconv matches: " & $c.intConvMatches) + writeln(stdout, "generic matches: " & $c.genericMatches) proc argTypeToString(arg: PNode): string = if arg.kind in nkSymChoices: @@ -202,7 +218,7 @@ proc describeArgs*(c: PContext, n: PNode, startIdx = 1): string = add(result, argTypeToString(arg)) if i != sonsLen(n) - 1: add(result, ", ") -proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation +proc typeRel*(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation proc concreteType(c: TCandidate, t: PType): PType = case t.kind of tyArrayConstr: @@ -212,7 +228,7 @@ proc concreteType(c: TCandidate, t: PType): PType = addSonSkipIntLit(result, t.sons[1]) # XXX: semantic checking for the type? of tyNil: result = nil # what should it be? - of tyGenericParam: + of tyGenericParam, tyAnything: result = t while true: result = PType(idTableGet(c.bindings, t)) @@ -222,7 +238,7 @@ proc concreteType(c: TCandidate, t: PType): PType = # proc sort[T](cmp: proc(a, b: T): int = cmp) if result.kind != tyGenericParam: break of tyGenericInvokation: - InternalError("cannot resolve type: " & typeToString(t)) + internalError("cannot resolve type: " & typeToString(t)) result = t else: result = t # Note: empty is valid here @@ -295,24 +311,27 @@ proc minRel(a, b: TTypeRelation): TTypeRelation = if a <= b: result = a else: result = b -proc tupleRel(c: var TCandidate, f, a: PType): TTypeRelation = +proc recordRel(c: var TCandidate, f, a: PType): TTypeRelation = result = isNone - if sameType(f, a): - result = isEqual + if sameType(f, a): result = isEqual elif sonsLen(a) == sonsLen(f): result = isEqual - for i in countup(0, sonsLen(f) - 1): + let firstField = if f.kind == tyTuple: 0 + else: 1 + for i in countup(firstField, sonsLen(f) - 1): var m = typeRel(c, f.sons[i], a.sons[i]) if m < isSubtype: return isNone result = minRel(result, m) if f.n != nil and a.n != nil: for i in countup(0, sonsLen(f.n) - 1): # check field names: - if f.n.sons[i].kind != nkSym: InternalError(f.n.info, "tupleRel") - elif a.n.sons[i].kind != nkSym: InternalError(a.n.info, "tupleRel") + if f.n.sons[i].kind != nkSym: internalError(f.n.info, "recordRel") + elif a.n.sons[i].kind != nkSym: internalError(a.n.info, "recordRel") else: var x = f.n.sons[i].sym var y = a.n.sons[i].sym + if f.kind == tyObject and typeRel(c, x.typ, y.typ) < isSubtype: + return isNone if x.name.id != y.name.id: return isNone proc allowsNil(f: PType): TTypeRelation {.inline.} = @@ -353,20 +372,16 @@ proc procTypeRel(c: var TCandidate, f, a: PType): TTypeRelation = return isNone elif f.flags * {tfIterator} != a.flags * {tfIterator}: return isNone - elif f.callconv != a.callconv: + elif f.callConv != a.callConv: # valid to pass a 'nimcall' thingie to 'closure': - if f.callconv == ccClosure and a.callconv == ccDefault: + if f.callConv == ccClosure and a.callConv == ccDefault: result = isConvertible else: return isNone when useEffectSystem: if not compatibleEffects(f, a): return isNone of tyNil: result = f.allowsNil - else: nil - -proc matchTypeClass(c: var TCandidate, f, a: PType): TTypeRelation = - result = if matchTypeClass(c.bindings, f, a): isGeneric - else: isNone + else: discard proc typeRangeRel(f, a: PType): TTypeRelation {.noinline.} = let @@ -384,23 +399,160 @@ proc typeRangeRel(f, a: PType): TTypeRelation {.noinline.} = else: result = isNone -proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = - # is a subtype of f? +proc matchUserTypeClass*(c: PContext, m: var TCandidate, + ff, a: PType): TTypeRelation = + #if f.n == nil: + # let r = typeRel(m, f, a) + # return if r == isGeneric: arg else: nil + + var body = ff.skipTypes({tyUserTypeClassInst}) + + # var prev = PType(idTableGet(m.bindings, f)) + # if prev != nil: + # if sameType(prev, a): return arg + # else: return nil + + # pushInfoContext(arg.info) + openScope(c) + inc c.inTypeClass + + finally: + dec c.inTypeClass + closeScope(c) + + if ff.kind == tyUserTypeClassInst: + for i in 1 .. <(ff.len - 1): + var + typeParamName = ff.base.sons[i-1].sym.name + typ = ff.sons[i] + param = newSym(skType, typeParamName, body.sym, body.sym.info) + + param.typ = makeTypeDesc(c, typ) + addDecl(c, param) + + for param in body.n[0]: + var + dummyName: PNode + dummyType: PType + + if param.kind == nkVarTy: + dummyName = param[0] + dummyType = makeVarType(c, a) + else: + dummyName = param + dummyType = a + + internalAssert dummyName.kind == nkIdent + var dummyParam = newSym(skType, dummyName.ident, body.sym, body.sym.info) + dummyParam.typ = dummyType + addDecl(c, dummyParam) + + var checkedBody = c.semTryExpr(c, copyTree(body.n[3]), bufferErrors = false) + m.errors = bufferedMsgs + clearBufferedMsgs() + if checkedBody == nil: return isNone + + if checkedBody.kind == nkStmtList: + for stmt in checkedBody: + case stmt.kind + of nkReturnStmt: discard + of nkTypeSection: discard + of nkConstDef: discard + else: discard + + return isGeneric + # put(m.bindings, f, a) + +proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation = + # typeRel can be used to establish various relationships between types: + # + # 1) When used with concrete types, it will check for type equivalence + # or a subtype relationship. + # + # 2) When used with a concrete type against a type class (such as generic + # signature of a proc), it will check whether the concrete type is a member + # of the designated type class. + # + # 3) When used with two type classes, it will check whether the types + # matching the first type class are a strict subset of the types matching + # the other. This allows us to compare the signatures of generic procs in + # order to give preferrence to the most specific one: + # + # seq[seq[any]] is a strict subset of seq[any] and hence more specific. + result = isNone assert(f != nil) - assert(a != nil) + + if f.kind == tyExpr: + put(c.bindings, f, aOrig) + return isGeneric + + assert(aOrig != nil) + + # var and static arguments match regular modifier-free types + let a = aOrig.skipTypes({tyStatic, tyVar}) + if a.kind == tyGenericInst and skipTypes(f, {tyVar}).kind notin { tyGenericBody, tyGenericInvokation, - tyGenericParam, tyTypeClass}: + tyGenericInst, tyGenericParam} + tyTypeClasses: return typeRel(c, f, lastSon(a)) - if a.kind == tyVar and f.kind != tyVar: - return typeRel(c, f, a.sons[0]) + + template bindingRet(res) = + when res == isGeneric: + let bound = aOrig.skipTypes({tyRange}).skipIntLit + put(c.bindings, f, bound) + return res + + template considerPreviousT(body: stmt) {.immediate.} = + var prev = PType(idTableGet(c.bindings, f)) + if prev == nil: body + else: return typeRel(c, prev, a) + + case a.kind + of tyOr: + # seq[int|string] vs seq[number] + # both int and string must match against number + for branch in a.sons: + if typeRel(c, f, branch, false) == isNone: + return isNone + + return isGeneric + + of tyAnd: + # seq[Sortable and Iterable] vs seq[Sortable] + # only one match is enough + for branch in a.sons: + if typeRel(c, f, branch, false) != isNone: + return isGeneric + + return isNone + + of tyNot: + case f.kind + of tyNot: + # seq[!int] vs seq[!number] + # seq[float] matches the first, but not the second + # we must turn the problem around: + # is number a subset of int? + return typeRel(c, a.lastSon, f.lastSon) + + else: + # negative type classes are essentially infinite, + # so only the `any` type class is their superset + return if f.kind == tyAnything: isGeneric + else: isNone + + of tyAnything: + return if f.kind == tyAnything: isGeneric + else: isNone + else: discard + case f.kind - of tyEnum: + of tyEnum: if a.kind == f.kind and sameEnumTypes(f, a): result = isEqual elif sameEnumTypes(f, skipTypes(a, {tyRange})): result = isSubtype - of tyBool, tyChar: + of tyBool, tyChar: if a.kind == f.kind: result = isEqual elif skipTypes(a, {tyRange}).kind == f.kind: result = isSubtype of tyRange: @@ -410,10 +562,11 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = #if result < isGeneric: result = isNone if result notin {isNone, isGeneric}: result = typeRangeRel(f, a) - elif skipTypes(f, {tyRange}).kind == a.kind: - result = isIntConv - elif isConvertibleToRange(skipTypes(f, {tyRange}), a): - result = isConvertible # a convertible to f + else: + if skipTypes(f, {tyRange}).kind == a.kind: + result = isIntConv + elif isConvertibleToRange(skipTypes(f, {tyRange}), a): + result = isConvertible # a convertible to f of tyInt: result = handleRange(f, a, tyInt8, tyInt32) of tyInt8: result = handleRange(f, a, tyInt8, tyInt8) of tyInt16: result = handleRange(f, a, tyInt8, tyInt16) @@ -428,9 +581,9 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = of tyFloat32: result = handleFloatRange(f, a) of tyFloat64: result = handleFloatRange(f, a) of tyFloat128: result = handleFloatRange(f, a) - of tyVar: - if a.kind == f.kind: result = typeRel(c, base(f), base(a)) - else: result = typeRel(c, base(f), a) + of tyVar: + if aOrig.kind == tyVar: result = typeRel(c, f.base, aOrig.base) + else: result = typeRel(c, f.base, aOrig) of tyArray, tyArrayConstr: # tyArrayConstr cannot happen really, but # we wanna be safe here @@ -447,9 +600,9 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = result = typeRel(c, f.sons[1], a.sons[1]) if result < isGeneric: result = isNone elif lengthOrd(fRange) != lengthOrd(a): result = isNone - else: nil + else: discard of tyOpenArray, tyVarargs: - case a.Kind + case a.kind of tyOpenArray, tyVarargs: result = typeRel(c, base(f), base(a)) if result < isGeneric: result = isNone @@ -468,9 +621,9 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = result = isConvertible elif typeRel(c, base(f), a.sons[0]) >= isGeneric: result = isConvertible - else: nil + else: discard of tySequence: - case a.Kind + case a.kind of tySequence: if (f.sons[0].kind != tyGenericParam) and (a.sons[0].kind == tyEmpty): result = isSubtype @@ -480,23 +633,27 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = elif tfNotNil in f.flags and tfNotNil notin a.flags: result = isNilConversion of tyNil: result = f.allowsNil - else: nil + else: discard of tyOrdinal: if isOrdinalType(a): var x = if a.kind == tyOrdinal: a.sons[0] else: a - - result = typeRel(c, f.sons[0], x) - if result < isGeneric: result = isNone + if f.sons[0].kind == tyNone: + result = isGeneric + else: + result = typeRel(c, f.sons[0], x) + if result < isGeneric: result = isNone elif a.kind == tyGenericParam: result = isGeneric - of tyForward: InternalError("forward type in typeRel()") + of tyForward: internalError("forward type in typeRel()") of tyNil: if a.kind == f.kind: result = isEqual of tyTuple: - if a.kind == tyTuple: result = tupleRel(c, f, a) + if a.kind == tyTuple: result = recordRel(c, f, a) of tyObject: if a.kind == tyObject: - if sameObjectTypes(f, a): result = isEqual + if sameObjectTypes(f, a): + result = isEqual + # elif tfHasMeta in f.flags: result = recordRel(c, f, a) else: var depth = isObjectSubtype(a, f) if depth > 0: @@ -520,7 +677,7 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = elif tfNotNil in f.flags and tfNotNil notin a.flags: result = isNilConversion of tyNil: result = f.allowsNil - else: nil + else: discard of tyRef: case a.kind of tyRef: @@ -529,7 +686,7 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = elif tfNotNil in f.flags and tfNotNil notin a.flags: result = isNilConversion of tyNil: result = f.allowsNil - else: nil + else: discard of tyProc: result = procTypeRel(c, f, a) if result != isNone and tfNotNil in f.flags and tfNotNil notin a.flags: @@ -545,7 +702,7 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = of tyProc: if a.callConv != ccClosure: result = isConvertible of tyPtr, tyCString: result = isConvertible - else: nil + else: discard of tyString: case a.kind of tyString: @@ -554,10 +711,10 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = else: result = isEqual of tyNil: result = f.allowsNil - else: nil + else: discard of tyCString: # conversion from string to cstring is automatic: - case a.Kind + case a.kind of tyCString: if tfNotNil in f.flags and tfNotNil notin a.flags: result = isNilConversion @@ -572,26 +729,45 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = (skipTypes(a.sons[0], {tyRange}).kind in {tyInt..tyInt64}) and (a.sons[1].kind == tyChar): result = isConvertible - else: nil - of tyEmpty: + else: discard + + of tyEmpty: if a.kind == tyEmpty: result = isEqual - of tyGenericInst: - result = typeRel(c, lastSon(f), a) - of tyGenericBody: - let ff = lastSon(f) - if ff != nil: result = typeRel(c, ff, a) + + of tyGenericInst: + let roota = a.skipGenericAlias + let rootf = f.skipGenericAlias + if a.kind == tyGenericInst and roota.base == rootf.base: + for i in 1 .. rootf.sonsLen-2: + let ff = rootf.sons[i] + let aa = roota.sons[i] + result = typeRel(c, ff, aa) + if result == isNone: return + if ff.kind == tyRange and result != isEqual: return isNone + + result = isGeneric + else: + result = typeRel(c, lastSon(f), a) + + of tyGenericBody: + considerPreviousT: + if a.kind == tyGenericInst and a.sons[0] == f: + bindingRet isGeneric + let ff = lastSon(f) + if ff != nil: result = typeRel(c, ff, a) + of tyGenericInvokation: var x = a.skipGenericAlias if x.kind == tyGenericInvokation or f.sons[0].kind != tyGenericBody: #InternalError("typeRel: tyGenericInvokation -> tyGenericInvokation") # simply no match for now: - nil + discard elif x.kind == tyGenericInst and (f.sons[0] == x.sons[0]) and (sonsLen(x) - 1 == sonsLen(f)): for i in countup(1, sonsLen(f) - 1): if x.sons[i].kind == tyGenericParam: - InternalError("wrong instantiated type!") + internalError("wrong instantiated type!") elif typeRel(c, f.sons[i], x.sons[i]) <= isSubtype: return result = isGeneric else: @@ -601,9 +777,65 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = for i in countup(1, sonsLen(f) - 1): var x = PType(idTableGet(c.bindings, f.sons[0].sons[i - 1])) if x == nil or x.kind in {tyGenericInvokation, tyGenericParam}: - InternalError("wrong instantiated type!") + internalError("wrong instantiated type!") put(c.bindings, f.sons[i], x) - of tyGenericParam, tyTypeClass: + + of tyAnd: + considerPreviousT: + for branch in f.sons: + if typeRel(c, branch, aOrig) == isNone: + return isNone + + bindingRet isGeneric + + of tyOr: + considerPreviousT: + for branch in f.sons: + if typeRel(c, branch, aOrig) != isNone: + bindingRet isGeneric + + return isNone + + of tyNot: + considerPreviousT: + for branch in f.sons: + if typeRel(c, branch, aOrig) != isNone: + return isNone + + bindingRet isGeneric + + of tyAnything: + considerPreviousT: + var concrete = concreteType(c, a) + if concrete != nil and doBind: + put(c.bindings, f, concrete) + return isGeneric + + of tyBuiltInTypeClass: + considerPreviousT: + let targetKind = f.sons[0].kind + if targetKind == a.skipTypes({tyRange, tyGenericInst}).kind or + (targetKind in {tyProc, tyPointer} and a.kind == tyNil): + put(c.bindings, f, a) + return isGeneric + else: + return isNone + + of tyUserTypeClass, tyUserTypeClassInst: + considerPreviousT: + result = matchUserTypeClass(c.c, c, f, a) + if result == isGeneric: + put(c.bindings, f, a) + + of tyCompositeTypeClass: + considerPreviousT: + if typeRel(c, f.sons[1], a) != isNone: + put(c.bindings, f, a) + return isGeneric + else: + return isNone + + of tyGenericParam: var x = PType(idTableGet(c.bindings, f)) if x == nil: if c.calleeSym != nil and c.calleeSym.kind == skType and @@ -614,59 +846,70 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = # by a tyTypeDesc params. Unfortunately, this requires more substantial # changes in semtypinst and elsewhere. if a.kind == tyTypeDesc: - if f.sons == nil or f.sons.len == 0: + if f.sonsLen == 0: result = isGeneric else: - InternalAssert a.sons != nil and a.sons.len > 0 + internalAssert a.sons != nil and a.sons.len > 0 c.typedescMatched = true result = typeRel(c, f.sons[0], a.sons[0]) else: result = isNone else: - if a.kind == tyTypeClass: - result = isGeneric + if f.sonsLen > 0 and f.sons[0].kind != tyNone: + result = typeRel(c, f.lastSon, a) else: - result = matchTypeClass(c, f, a) - + result = isGeneric + if result == isGeneric: var concrete = concreteType(c, a) if concrete == nil: result = isNone else: - put(c.bindings, f, concrete) + if doBind: put(c.bindings, f, concrete) elif a.kind == tyEmpty: result = isGeneric elif x.kind == tyGenericParam: result = isGeneric else: result = typeRel(c, x, a) # check if it fits + + of tyStatic: + if aOrig.kind == tyStatic: + result = typeRel(c, f.lastSon, a) + if result != isNone: put(c.bindings, f, aOrig) + else: + result = isNone + of tyTypeDesc: var prev = PType(idTableGet(c.bindings, f)) if prev == nil: if a.kind == tyTypeDesc: - if f.sonsLen == 0: + if f.sons[0].kind == tyNone: result = isGeneric else: - result = matchTypeClass(c, f, a.sons[0]) - if result == isGeneric: + result = typeRel(c, f.sons[0], a.sons[0]) + if result != isNone: put(c.bindings, f, a) else: result = isNone else: - InternalAssert prev.sonsLen == 1 + internalAssert prev.sonsLen == 1 let toMatch = if tfUnresolved in f.flags: a else: a.sons[0] result = typeRel(c, prev.sons[0], toMatch) - of tyExpr, tyStmt: + + of tyStmt: result = isGeneric + of tyProxy: result = isEqual + else: internalError("typeRel: " & $f.kind) -proc cmpTypes*(f, a: PType): TTypeRelation = - var c: TCandidate - InitCandidate(c, f) - result = typeRel(c, f, a) +proc cmpTypes*(c: PContext, f, a: PType): TTypeRelation = + var m: TCandidate + initCandidate(c, m, f) + result = typeRel(m, f, a) proc getInstantiatedType(c: PContext, arg: PNode, m: TCandidate, f: PType): PType = @@ -674,7 +917,7 @@ proc getInstantiatedType(c: PContext, arg: PNode, m: TCandidate, if result == nil: result = generateTypeInstance(c, m.bindings, arg, f) if result == nil: - InternalError(arg.info, "getInstantiatedType") + internalError(arg.info, "getInstantiatedType") result = errorType(c) proc implicitConv(kind: TNodeKind, f: PType, arg: PNode, m: TCandidate, @@ -687,7 +930,7 @@ proc implicitConv(kind: TNodeKind, f: PType, arg: PNode, m: TCandidate, result.typ = errorType(c) else: result.typ = f - if result.typ == nil: InternalError(arg.info, "implicitConv") + if result.typ == nil: internalError(arg.info, "implicitConv") addSon(result, ast.emptyNode) addSon(result, arg) @@ -726,7 +969,7 @@ proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, var call = newNodeI(nkCall, arg.info) call.add(f.n.copyTree) call.add(arg.copyTree) - result = c.semOverloadedCall(c, call, call, RoutineKinds) + result = c.semOverloadedCall(c, call, call, routineKinds) if result != nil: # resulting type must be consistent with the other arguments: var r = typeRel(m, f.sons[0], result.typ) @@ -737,95 +980,33 @@ proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, result.typ = getInstantiatedType(c, arg, m, base(f)) m.baseTypeMatch = true -proc matchUserTypeClass*(c: PContext, m: var TCandidate, - arg: PNode, f, a: PType): PNode = - if f.n == nil: - let r = typeRel(m, f, a) - return if r == isGeneric: arg else: nil - - var prev = PType(idTableGet(m.bindings, f)) - if prev != nil: - if sameType(prev, a): return arg - else: return nil - - # pushInfoContext(arg.info) - openScope(c) - - var testee = newSym(skParam, f.testeeName, f.sym, f.sym.info) - testee.typ = a - addDecl(c, testee) - - for stmt in f.n: - var e = c.semTryExpr(c, copyTree(stmt)) - if e == nil: - let expStr = renderTree(stmt, {renderNoComments}) - m.errors.safeAdd("can't compile " & expStr & " for " & a.typeToString) - return nil - case e.kind - of nkReturnStmt: - nil - of nkTypeSection: nil - of nkConstDef: nil - else: - if e.typ.kind == tyBool: - let verdict = c.semConstExpr(c, e) - if verdict.intVal == 0: - let expStr = renderTree(stmt, {renderNoComments}) - m.errors.safeAdd(expStr & " doesn't hold for " & a.typeToString) - return nil - - closeScope(c) - - result = arg - put(m.bindings, f, a) - -proc ParamTypesMatchAux(c: PContext, m: var TCandidate, f, a: PType, +proc paramTypesMatchAux(m: var TCandidate, f, argType: PType, argSemantized, argOrig: PNode): PNode = - var arg = argSemantized - var r: TTypeRelation - let fMaybeExpr = f.skipTypes({tyDistinct}) - case fMaybeExpr.kind - of tyExpr: - if fMaybeExpr.sonsLen == 0: - r = isGeneric - else: - if a.kind == tyExpr: - InternalAssert a.len > 0 - r = typeRel(m, f.lastSon, a.lastSon) - else: - let match = matchTypeClass(m, fMaybeExpr, a) - if match != isGeneric: r = isNone - else: - # XXX: Ideally, this should happen much earlier somewhere near - # semOpAux, but to do that, we need to be able to query the - # overload set to determine whether compile-time value is expected - # for the param before entering the full-blown sigmatch algorithm. - # This is related to the immediate pragma since querying the - # overload set could help there too. - var evaluated = c.semConstExpr(c, arg) - if evaluated != nil: - r = isGeneric - arg.typ = newTypeS(tyExpr, c) - arg.typ.sons = @[evaluated.typ] - arg.typ.n = evaluated - - if r == isGeneric: - put(m.bindings, f, arg.typ) - of tyTypeClass: - if fMaybeExpr.n != nil: - let match = matchUserTypeClass(c, m, arg, fMaybeExpr, a) - if match != nil: - r = isGeneric - arg = match - else: - r = isNone - else: - r = typeRel(m, f, a) - else: + var + fMaybeStatic = f.skipTypes({tyDistinct}) + arg = argSemantized + argType = argType + c = m.c + + if tfHasStatic in fMaybeStatic.flags: + # XXX: When implicit statics are the default + # this will be done earlier - we just have to + # make sure that static types enter here + var evaluated = c.semTryConstExpr(c, arg) + if evaluated != nil: + arg.typ = newTypeS(tyStatic, c) + arg.typ.sons = @[evaluated.typ] + arg.typ.n = evaluated + argType = arg.typ + + var + a = if c.inTypeClass > 0: argType.skipTypes({tyTypeDesc}) + else: argType + r = typeRel(m, f, a) case r - of isConvertible: + of isConvertible: inc(m.convMatches) result = implicitConv(nkHiddenStdConv, f, copyTree(arg), m, c) of isIntConv: @@ -847,6 +1028,8 @@ proc ParamTypesMatchAux(c: PContext, m: var TCandidate, f, a: PType, result = argOrig[bodyPos] elif f.kind == tyTypeDesc: result = arg + elif f.kind == tyStatic: + result = arg.typ.n else: result = argOrig else: @@ -889,19 +1072,20 @@ proc ParamTypesMatchAux(c: PContext, m: var TCandidate, f, a: PType, else: result = userConvMatch(c, m, base(f), a, arg) -proc ParamTypesMatch*(c: PContext, m: var TCandidate, f, a: PType, +proc paramTypesMatch*(m: var TCandidate, f, a: PType, arg, argOrig: PNode): PNode = if arg == nil or arg.kind notin nkSymChoices: - result = ParamTypesMatchAux(c, m, f, a, arg, argOrig) + result = paramTypesMatchAux(m, f, a, arg, argOrig) else: # CAUTION: The order depends on the used hashing scheme. Thus it is # incorrect to simply use the first fitting match. However, to implement # this correctly is inefficient. We have to copy `m` here to be able to # roll back the side effects of the unification algorithm. + let c = m.c var x, y, z: TCandidate - initCandidate(x, m.callee) - initCandidate(y, m.callee) - initCandidate(z, m.callee) + initCandidate(c, x, m.callee) + initCandidate(c, y, m.callee) + initCandidate(c, z, m.callee) x.calleeSym = m.calleeSym y.calleeSym = m.calleeSym z.calleeSym = m.calleeSym @@ -927,17 +1111,17 @@ proc ParamTypesMatch*(c: PContext, m: var TCandidate, f, a: PType, result = nil elif (y.state == csMatch) and (cmpCandidates(x, y) == 0): if x.state != csMatch: - InternalError(arg.info, "x.state is not csMatch") + internalError(arg.info, "x.state is not csMatch") # ambiguous: more than one symbol fits result = nil else: # only one valid interpretation found: markUsed(arg, arg.sons[best].sym) - result = ParamTypesMatchAux(c, m, f, arg.sons[best].typ, arg.sons[best], + result = paramTypesMatchAux(m, f, arg.sons[best].typ, arg.sons[best], argOrig) proc setSon(father: PNode, at: int, son: PNode) = - if sonsLen(father) <= at: setlen(father.sons, at + 1) + if sonsLen(father) <= at: setLen(father.sons, at + 1) father.sons[at] = son # we are allowed to modify the calling node in the 'prepare*' procs: @@ -1008,7 +1192,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode, # check if m.callee has such a param: prepareNamedParam(n.sons[a]) if n.sons[a].sons[0].kind != nkIdent: - LocalError(n.sons[a].info, errNamedParamHasToBeIdent) + localError(n.sons[a].info, errNamedParamHasToBeIdent) m.state = csNoMatch return formal = getSymFromList(m.callee.n, n.sons[a].sons[0].ident, 1) @@ -1016,15 +1200,15 @@ proc matchesAux(c: PContext, n, nOrig: PNode, # no error message! m.state = csNoMatch return - if ContainsOrIncl(marker, formal.position): + if containsOrIncl(marker, formal.position): # already in namedParams: - LocalError(n.sons[a].info, errCannotBindXTwice, formal.name.s) + localError(n.sons[a].info, errCannotBindXTwice, formal.name.s) m.state = csNoMatch return m.baseTypeMatch = false n.sons[a].sons[1] = prepareOperand(c, formal.typ, n.sons[a].sons[1]) n.sons[a].typ = n.sons[a].sons[1].typ - var arg = ParamTypesMatch(c, m, formal.typ, n.sons[a].typ, + var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ, n.sons[a].sons[1], nOrig.sons[a].sons[1]) if arg == nil: m.state = csNoMatch @@ -1042,7 +1226,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode, # unnamed param if f >= formalLen: # too many arguments? - if tfVarArgs in m.callee.flags: + if tfVarargs in m.callee.flags: # is ok... but don't increment any counters... # we have no formal here to snoop at: n.sons[a] = prepareOperand(c, n.sons[a]) @@ -1054,7 +1238,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode, elif formal != nil: m.baseTypeMatch = false n.sons[a] = prepareOperand(c, formal.typ, n.sons[a]) - var arg = ParamTypesMatch(c, m, formal.typ, n.sons[a].typ, + var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ, n.sons[a], nOrig.sons[a]) if (arg != nil) and m.baseTypeMatch and (container != nil): addSon(container, arg) @@ -1067,17 +1251,17 @@ proc matchesAux(c: PContext, n, nOrig: PNode, return else: if m.callee.n.sons[f].kind != nkSym: - InternalError(n.sons[a].info, "matches") + internalError(n.sons[a].info, "matches") return formal = m.callee.n.sons[f].sym - if ContainsOrIncl(marker, formal.position): + if containsOrIncl(marker, formal.position): # already in namedParams: - LocalError(n.sons[a].info, errCannotBindXTwice, formal.name.s) + localError(n.sons[a].info, errCannotBindXTwice, formal.name.s) m.state = csNoMatch return m.baseTypeMatch = false n.sons[a] = prepareOperand(c, formal.typ, n.sons[a]) - var arg = ParamTypesMatch(c, m, formal.typ, n.sons[a].typ, + var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ, n.sons[a], nOrig.sons[a]) if arg == nil: m.state = csNoMatch @@ -1114,7 +1298,7 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) = var f = 1 while f < sonsLen(m.callee.n): var formal = m.callee.n.sons[f].sym - if not ContainsOrIncl(marker, formal.position): + if not containsOrIncl(marker, formal.position): if formal.ast == nil: if formal.typ.kind == tyVarargs: var container = newNodeIT(nkBracket, n.info, arrayConstr(c, n.info)) @@ -1129,13 +1313,131 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) = setSon(m.call, formal.position + 1, copyTree(formal.ast)) inc(f) -proc argtypeMatches*(c: PContext, f, a: PType): bool = +proc argtypeMatches*(c: PContext, f, a: PType): bool = var m: TCandidate - initCandidate(m, f) - let res = paramTypesMatch(c, m, f, a, ast.emptyNode, nil) + initCandidate(c, m, f) + let res = paramTypesMatch(m, f, a, ast.emptyNode, nil) #instantiateGenericConverters(c, res, m) # XXX this is used by patterns.nim too; I think it's better to not # instantiate generic converters for that result = res != nil include suggest + +tests: + var dummyOwner = newSym(skModule, getIdent("test_module"), nil, UnknownLineInfo()) + + proc `|` (t1, t2: PType): PType = + result = newType(tyOr, dummyOwner) + result.rawAddSon(t1) + result.rawAddSon(t2) + + proc `&` (t1, t2: PType): PType = + result = newType(tyAnd, dummyOwner) + result.rawAddSon(t1) + result.rawAddSon(t2) + + proc `!` (t: PType): PType = + result = newType(tyNot, dummyOwner) + result.rawAddSon(t) + + proc seq(t: PType): PType = + result = newType(tySequence, dummyOwner) + result.rawAddSon(t) + + proc array(x: int, t: PType): PType = + result = newType(tyArray, dummyOwner) + + var n = newNodeI(nkRange, UnknownLineInfo()) + addSon(n, newIntNode(nkIntLit, 0)) + addSon(n, newIntNode(nkIntLit, x)) + let range = newType(tyRange, dummyOwner) + + result.rawAddSon(range) + result.rawAddSon(t) + + suite "type classes": + let + int = newType(tyInt, dummyOwner) + float = newType(tyFloat, dummyOwner) + string = newType(tyString, dummyOwner) + ordinal = newType(tyOrdinal, dummyOwner) + any = newType(tyAnything, dummyOwner) + number = int | float + + var TFoo = newType(tyObject, dummyOwner) + TFoo.sym = newSym(skType, getIdent"TFoo", dummyOwner, UnknownLineInfo()) + + var T1 = newType(tyGenericParam, dummyOwner) + T1.sym = newSym(skType, getIdent"T1", dummyOwner, UnknownLineInfo()) + T1.sym.position = 0 + + var T2 = newType(tyGenericParam, dummyOwner) + T2.sym = newSym(skType, getIdent"T2", dummyOwner, UnknownLineInfo()) + T2.sym.position = 1 + + setup: + var c: TCandidate + InitCandidate(nil, c, nil) + + template yes(x, y) = + test astToStr(x) & " is " & astToStr(y): + check typeRel(c, y, x) == isGeneric + + template no(x, y) = + test astToStr(x) & " is not " & astToStr(y): + check typeRel(c, y, x) == isNone + + yes seq(any), array(10, int) | seq(any) + # Sure, seq[any] is directly included + + yes seq(int), seq(any) + yes seq(int), seq(number) + # Sure, the int sequence is certainly + # part of the number sequences (and all sequences) + + no seq(any), seq(float) + # Nope, seq[any] includes types that are not seq[float] (e.g. seq[int]) + + yes seq(int|string), seq(any) + # Sure + + yes seq(int&string), seq(any) + # Again + + yes seq(int&string), seq(int) + # A bit more complicated + # seq[int&string] is not a real type, but it's analogous to + # seq[Sortable and Iterable], which is certainly a subset of seq[Sortable] + + no seq(int|string), seq(int|float) + # Nope, seq[string] is not included in not included in + # the seq[int|float] set + + no seq(!(int|string)), seq(string) + # A sequence that is neither seq[int] or seq[string] + # is obviously not seq[string] + + no seq(!int), seq(number) + # Now your head should start to hurt a bit + # A sequence that is not seq[int] is not necessarily a number sequence + # it could well be seq[string] for example + + yes seq(!(int|string)), seq(!string) + # all sequnece types besides seq[int] and seq[string] + # are subset of all sequence types that are not seq[string] + + no seq(!(int|string)), seq(!(string|TFoo)) + # Nope, seq[TFoo] is included in the first set, but not in the second + + no seq(!string), seq(!number) + # Nope, seq[int] in included in the first set, but not in the second + + yes seq(!number), seq(any) + yes seq(!int), seq(any) + no seq(any), seq(!any) + no seq(!int), seq(!any) + + yes int, ordinal + no string, ordinal + diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 76a6c21d9..49611f649 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -11,7 +11,7 @@ # included from sigmatch.nim -import algorithm, sequtils +import algorithm, sequtils, pretty const sep = '\t' @@ -28,7 +28,7 @@ proc origModuleName(m: PSym): string = else: m.name.s -proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string = +proc symToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string = result = section result.add(sep) result.add($s.kind) @@ -48,15 +48,15 @@ proc SymToStr(s: PSym, isLocal: bool, section: string, li: TLineInfo): string = result.add(sep) result.add(toFullPath(li)) result.add(sep) - result.add($ToLinenumber(li)) + result.add($toLinenumber(li)) result.add(sep) - result.add($ToColumn(li)) + result.add($toColumn(li)) result.add(sep) when not defined(noDocgen): result.add(s.extractDocComment.escape) -proc SymToStr(s: PSym, isLocal: bool, section: string): string = - result = SymToStr(s, isLocal, section, s.info) +proc symToStr(s: PSym, isLocal: bool, section: string): string = + result = symToStr(s, isLocal, section, s.info) proc filterSym(s: PSym): bool {.inline.} = result = s.name.s[0] in lexer.SymChars and s.kind != skModule @@ -68,7 +68,7 @@ proc fieldVisible*(c: PContext, f: PSym): bool {.inline.} = proc suggestField(c: PContext, s: PSym, outputs: var int) = if filterSym(s) and fieldVisible(c, s): - SuggestWriteln(SymToStr(s, isLocal=true, sectionSuggest)) + suggestWriteln(symToStr(s, isLocal=true, sectionSuggest)) inc outputs when not defined(nimhygiene): @@ -84,7 +84,7 @@ template wholeSymTab(cond, section: expr) {.immediate.} = for item in entries: let it {.inject.} = item if cond: - SuggestWriteln(SymToStr(it, isLocal = isLocal, section)) + suggestWriteln(symToStr(it, isLocal = isLocal, section)) inc outputs proc suggestSymList(c: PContext, list: PNode, outputs: var int) = @@ -103,7 +103,7 @@ proc suggestObject(c: PContext, n: PNode, outputs: var int) = suggestObject(c, n.sons[0], outputs) for i in countup(1, L-1): suggestObject(c, lastSon(n.sons[i]), outputs) of nkSym: suggestField(c, n.sym, outputs) - else: nil + else: discard proc nameFits(c: PContext, s: PSym, n: PNode): bool = var op = n.sons[0] @@ -119,7 +119,7 @@ proc argsFit(c: PContext, candidate: PSym, n, nOrig: PNode): bool = case candidate.kind of OverloadableSyms: var m: TCandidate - initCandidate(m, candidate, nil) + initCandidate(c, m, candidate, nil) sigmatch.partialMatch(c, n, nOrig, m) result = m.state != csNoMatch else: @@ -144,14 +144,14 @@ proc suggestEverything(c: PContext, n: PNode, outputs: var int) = if scope == c.topLevelScope: isLocal = false for it in items(scope.symbols): if filterSym(it): - SuggestWriteln(SymToStr(it, isLocal = isLocal, sectionSuggest)) + suggestWriteln(symToStr(it, isLocal = isLocal, sectionSuggest)) inc outputs if scope == c.topLevelScope: break proc suggestFieldAccess(c: PContext, n: PNode, outputs: var int) = # special code that deals with ``myObj.``. `n` is NOT the nkDotExpr-node, but # ``myObj``. - var typ = n.Typ + var typ = n.typ if typ == nil: # a module symbol has no type for example: if n.kind == nkSym and n.sym.kind == skModule: @@ -159,12 +159,12 @@ proc suggestFieldAccess(c: PContext, n: PNode, outputs: var int) = # all symbols accessible, because we are in the current module: for it in items(c.topLevelScope.symbols): if filterSym(it): - SuggestWriteln(SymToStr(it, isLocal=false, sectionSuggest)) + suggestWriteln(symToStr(it, isLocal=false, sectionSuggest)) inc outputs else: for it in items(n.sym.tab): if filterSym(it): - SuggestWriteln(SymToStr(it, isLocal=false, sectionSuggest)) + suggestWriteln(symToStr(it, isLocal=false, sectionSuggest)) inc outputs else: # fallback: @@ -203,7 +203,7 @@ const CallNodes = {nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit} proc findClosestCall(n: PNode): PNode = - if n.kind in callNodes and msgs.inCheckpoint(n.info) == cpExact: + if n.kind in CallNodes and msgs.inCheckpoint(n.info) == cpExact: result = n else: for i in 0.. <safeLen(n): @@ -246,16 +246,16 @@ var proc findUsages(node: PNode, s: PSym) = if usageSym == nil and isTracked(node.info, s.name.s.len): usageSym = s - SuggestWriteln(SymToStr(s, isLocal=false, sectionUsage)) + suggestWriteln(symToStr(s, isLocal=false, sectionUsage)) elif s == usageSym: if lastLineInfo != node.info: - SuggestWriteln(SymToStr(s, isLocal=false, sectionUsage, node.info)) + suggestWriteln(symToStr(s, isLocal=false, sectionUsage, node.info)) lastLineInfo = node.info proc findDefinition(node: PNode, s: PSym) = if isTracked(node.info, s.name.s.len): - SuggestWriteln(SymToStr(s, isLocal=false, sectionDef)) - SuggestQuit() + suggestWriteln(symToStr(s, isLocal=false, sectionDef)) + suggestQuit() type TSourceMap = object @@ -281,7 +281,7 @@ proc resetSourceMap*(fileIdx: int32) = ensureIdx(gSourceMaps, fileIdx) gSourceMaps[fileIdx].lines = @[] -proc addToSourceMap(sym: Psym, info: TLineInfo) = +proc addToSourceMap(sym: PSym, info: TLineInfo) = ensureIdx(gSourceMaps, info.fileIndex) ensureSeq(gSourceMaps[info.fileIndex].lines) ensureIdx(gSourceMaps[info.fileIndex].lines, info.line) @@ -302,7 +302,7 @@ proc defFromLine(entries: var seq[TEntry], col: int32) = # that the first expr that ends after the cursor column is # the one we are looking for. if e.pos >= col: - SuggestWriteln(SymToStr(e.sym, isLocal=false, sectionDef)) + suggestWriteln(symToStr(e.sym, isLocal=false, sectionDef)) return proc defFromSourceMap*(i: TLineInfo) = @@ -324,9 +324,10 @@ proc suggestSym*(n: PNode, s: PSym) {.inline.} = proc markUsed(n: PNode, s: PSym) = incl(s.flags, sfUsed) if {sfDeprecated, sfError} * s.flags != {}: - if sfDeprecated in s.flags: Message(n.info, warnDeprecated, s.name.s) - if sfError in s.flags: LocalError(n.info, errWrongSymbolX, s.name.s) + if sfDeprecated in s.flags: message(n.info, warnDeprecated, s.name.s) + if sfError in s.flags: localError(n.info, errWrongSymbolX, s.name.s) suggestSym(n, s) + if gCmd == cmdPretty: checkUse(n, s) proc useSym*(sym: PSym): PNode = result = newSymNode(sym) @@ -337,8 +338,8 @@ proc suggestExpr*(c: PContext, node: PNode) = if cp == cpNone: return var outputs = 0 # This keeps semExpr() from coming here recursively: - if c.InCompilesContext > 0: return - inc(c.InCompilesContext) + if c.inCompilesContext > 0: return + inc(c.inCompilesContext) if optSuggest in gGlobalOptions: var n = findClosestDot(node) @@ -368,8 +369,8 @@ proc suggestExpr*(c: PContext, node: PNode) = addSon(a, x) suggestCall(c, a, n, outputs) - dec(c.InCompilesContext) - if outputs > 0 and optUsages notin gGlobalOptions: SuggestQuit() + dec(c.inCompilesContext) + if outputs > 0 and optUsages notin gGlobalOptions: suggestQuit() proc suggestStmt*(c: PContext, n: PNode) = suggestExpr(c, n) diff --git a/compiler/syntaxes.nim b/compiler/syntaxes.nim index 3965cb3fe..7c44ec0b4 100644 --- a/compiler/syntaxes.nim +++ b/compiler/syntaxes.nim @@ -40,17 +40,17 @@ proc parseTopLevelStmt*(p: var TParsers): PNode # implementation -proc ParseFile(fileIdx: int32): PNode = +proc parseFile(fileIdx: int32): PNode = var p: TParsers - f: tfile + f: TFile let filename = fileIdx.toFullPath if not open(f, filename): rawMessage(errCannotOpenFile, filename) return - OpenParsers(p, fileIdx, LLStreamOpen(f)) - result = ParseAll(p) - CloseParsers(p) + openParsers(p, fileIdx, llStreamOpen(f)) + result = parseAll(p) + closeParsers(p) proc parseAll(p: var TParsers): PNode = case p.skin @@ -59,7 +59,7 @@ proc parseAll(p: var TParsers): PNode = of skinBraces: result = pbraces.parseAll(p.parser) of skinEndX: - InternalError("parser to implement") + internalError("parser to implement") result = ast.emptyNode # skinEndX: result := pendx.parseAll(p.parser); @@ -70,11 +70,11 @@ proc parseTopLevelStmt(p: var TParsers): PNode = of skinBraces: result = pbraces.parseTopLevelStmt(p.parser) of skinEndX: - InternalError("parser to implement") + internalError("parser to implement") result = ast.emptyNode #skinEndX: result := pendx.parseTopLevelStmt(p.parser); -proc UTF8_BOM(s: string): int = +proc utf8Bom(s: string): int = if (s[0] == '\xEF') and (s[1] == '\xBB') and (s[2] == '\xBF'): result = 3 else: @@ -83,37 +83,37 @@ proc UTF8_BOM(s: string): int = proc containsShebang(s: string, i: int): bool = if (s[i] == '#') and (s[i + 1] == '!'): var j = i + 2 - while s[j] in WhiteSpace: inc(j) + while s[j] in Whitespace: inc(j) result = s[j] == '/' proc parsePipe(filename: string, inputStream: PLLStream): PNode = result = ast.emptyNode - var s = LLStreamOpen(filename, fmRead) + var s = llStreamOpen(filename, fmRead) if s != nil: var line = newStringOfCap(80) - discard LLStreamReadLine(s, line) - var i = UTF8_Bom(line) + discard llStreamReadLine(s, line) + var i = utf8Bom(line) if containsShebang(line, i): - discard LLStreamReadLine(s, line) + discard llStreamReadLine(s, line) i = 0 if line[i] == '#' and line[i+1] == '!': inc(i, 2) - while line[i] in WhiteSpace: inc(i) + while line[i] in Whitespace: inc(i) var q: TParser - OpenParser(q, filename, LLStreamOpen(substr(line, i))) + openParser(q, filename, llStreamOpen(substr(line, i))) result = parser.parseAll(q) - CloseParser(q) - LLStreamClose(s) + closeParser(q) + llStreamClose(s) proc getFilter(ident: PIdent): TFilterKind = for i in countup(low(TFilterKind), high(TFilterKind)): - if IdentEq(ident, filterNames[i]): + if identEq(ident, filterNames[i]): return i result = filtNone proc getParser(ident: PIdent): TParserKind = for i in countup(low(TParserKind), high(TParserKind)): - if IdentEq(ident, parserNames[i]): + if identEq(ident, parserNames[i]): return i rawMessage(errInvalidDirectiveX, ident.s) @@ -142,32 +142,32 @@ proc applyFilter(p: var TParsers, n: PNode, filename: string, if f != filtNone: if gVerbosity >= 2: rawMessage(hintCodeBegin, []) - MsgWriteln(result.s) + msgWriteln(result.s) rawMessage(hintCodeEnd, []) proc evalPipe(p: var TParsers, n: PNode, filename: string, start: PLLStream): PLLStream = result = start if n.kind == nkEmpty: return - if (n.kind == nkInfix) and (n.sons[0].kind == nkIdent) and - IdentEq(n.sons[0].ident, "|"): - for i in countup(1, 2): - if n.sons[i].kind == nkInfix: + if n.kind == nkInfix and n.sons[0].kind == nkIdent and + identEq(n.sons[0].ident, "|"): + for i in countup(1, 2): + if n.sons[i].kind == nkInfix: result = evalPipe(p, n.sons[i], filename, result) - else: + else: result = applyFilter(p, n.sons[i], filename, result) - elif n.kind == nkStmtList: + elif n.kind == nkStmtList: result = evalPipe(p, n.sons[0], filename, result) - else: + else: result = applyFilter(p, n, filename, result) proc openParsers(p: var TParsers, fileIdx: int32, inputstream: PLLStream) = var s: PLLStream p.skin = skinStandard let filename = fileIdx.toFullPath - var pipe = parsePipe(filename, inputStream) - if pipe != nil: s = evalPipe(p, pipe, filename, inputStream) - else: s = inputStream + var pipe = parsePipe(filename, inputstream) + if pipe != nil: s = evalPipe(p, pipe, filename, inputstream) + else: s = inputstream case p.skin of skinStandard, skinBraces, skinEndX: parser.openParser(p.parser, fileIdx, s) diff --git a/compiler/testability.nim b/compiler/testability.nim new file mode 100644 index 000000000..ceefd0a5e --- /dev/null +++ b/compiler/testability.nim @@ -0,0 +1,5 @@ +template tests*(body: stmt) {.immediate.} = + when defined(selftest): + when not defined(unittest): import unittest + body + diff --git a/compiler/transf.nim b/compiler/transf.nim index 206c21c3d..deb821eff 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -88,7 +88,7 @@ proc pushTransCon(c: PTransf, t: PTransCon) = c.transCon = t proc popTransCon(c: PTransf) = - if (c.transCon == nil): InternalError("popTransCon") + if (c.transCon == nil): internalError("popTransCon") c.transCon = c.transCon.next proc getCurrOwner(c: PTransf): PSym = @@ -113,8 +113,8 @@ proc newAsgnStmt(c: PTransf, le: PNode, ri: PTransNode): PTransNode = result[1] = ri proc transformSymAux(c: PTransf, n: PNode): PNode = - if n.sym.kind == skIterator and n.sym.typ.callConv == ccClosure: - return liftIterSym(n) + #if n.sym.kind == skIterator and n.sym.typ.callConv == ccClosure: + # return liftIterSym(n) var b: PNode var tc = c.transCon if sfBorrow in n.sym.flags: @@ -126,7 +126,7 @@ proc transformSymAux(c: PTransf, n: PNode): PNode = else: b = n while tc != nil: - result = IdNodeTableGet(tc.mapping, b.sym) + result = idNodeTableGet(tc.mapping, b.sym) if result != nil: return tc = tc.next result = b @@ -141,32 +141,32 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode = if it.kind == nkCommentStmt: result[i] = PTransNode(it) elif it.kind == nkIdentDefs: - if it.sons[0].kind != nkSym: InternalError(it.info, "transformVarSection") - InternalAssert(it.len == 3) + if it.sons[0].kind != nkSym: internalError(it.info, "transformVarSection") + internalAssert(it.len == 3) var newVar = copySym(it.sons[0].sym) incl(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)) + idNodeTablePut(c.transCon.mapping, it.sons[0].sym, newSymNode(newVar)) var defs = newTransNode(nkIdentDefs, it.info, 3) if importantComments(): # keep documentation information: - pnode(defs).comment = it.comment + PNode(defs).comment = it.comment defs[0] = newSymNode(newVar).PTransNode defs[1] = it.sons[1].PTransNode defs[2] = transform(c, it.sons[2]) result[i] = defs else: if it.kind != nkVarTuple: - InternalError(it.info, "transformVarSection: not nkVarTuple") + internalError(it.info, "transformVarSection: not nkVarTuple") var L = sonsLen(it) var defs = newTransNode(it.kind, it.info, L) for j in countup(0, L-3): var newVar = copySym(it.sons[j].sym) incl(newVar.flags, sfFromGeneric) newVar.owner = getCurrOwner(c) - IdNodeTablePut(c.transCon.mapping, it.sons[j].sym, newSymNode(newVar)) + idNodeTablePut(c.transCon.mapping, it.sons[j].sym, newSymNode(newVar)) defs[j] = newSymNode(newVar).PTransNode assert(it.sons[L-2].kind == nkEmpty) defs[L-1] = transform(c, it.sons[L-1]) @@ -179,21 +179,21 @@ proc transformConstSection(c: PTransf, v: PNode): PTransNode = if it.kind == nkCommentStmt: result[i] = PTransNode(it) else: - if it.kind != nkConstDef: InternalError(it.info, "transformConstSection") + if it.kind != nkConstDef: internalError(it.info, "transformConstSection") if it.sons[0].kind != nkSym: - InternalError(it.info, "transformConstSection") + internalError(it.info, "transformConstSection") if sfFakeConst in it[0].sym.flags: var b = newNodeI(nkConstDef, it.info) addSon(b, it[0]) addSon(b, ast.emptyNode) # no type description - addSon(b, transform(c, it[2]).pnode) + addSon(b, transform(c, it[2]).PNode) result[i] = PTransNode(b) else: result[i] = PTransNode(it) proc hasContinue(n: PNode): bool = case n.kind - of nkEmpty..nkNilLit, nkForStmt, nkParForStmt, nkWhileStmt: nil + of nkEmpty..nkNilLit, nkForStmt, nkParForStmt, nkWhileStmt: discard of nkContinueStmt: result = true else: for i in countup(0, sonsLen(n) - 1): @@ -217,7 +217,7 @@ proc transformBlock(c: PTransf, n: PNode): PTransNode = proc transformBreak(c: PTransf, n: PNode): PTransNode = if c.inLoop > 0 or n.sons[0].kind != nkEmpty: - result = n.ptransNode + result = n.PTransNode else: let labl = c.breakSyms[c.breakSyms.high] result = transformSons(c, n) @@ -292,11 +292,11 @@ proc transformYield(c: PTransf, n: PNode): PTransNode = add(result, c.transCon.forLoopBody) else: # we need to introduce new local variables: - add(result, introduceNewLocalVars(c, c.transCon.forLoopBody.pnode)) + add(result, introduceNewLocalVars(c, c.transCon.forLoopBody.PNode)) proc transformAddrDeref(c: PTransf, n: PNode, a, b: TNodeKind): PTransNode = result = transformSons(c, n) - var n = result.pnode + var n = result.PNode case n.sons[0].kind of nkObjUpConv, nkObjDownConv, nkChckRange, nkChckRangeF, nkChckRange64: var m = n.sons[0].sons[0] @@ -389,7 +389,7 @@ proc transformConv(c: PTransf, n: PNode): PTransNode = result[0] = transform(c, n.sons[1]) else: result = transform(c, n.sons[1]) - of tyGenericParam, tyOrdinal, tyTypeClass: + of tyGenericParam, tyOrdinal: result = transform(c, n.sons[1]) # happens sometimes for generated assignments, etc. else: @@ -429,15 +429,15 @@ proc findWrongOwners(c: PTransf, n: PNode) = proc transformFor(c: PTransf, n: PNode): PTransNode = # generate access statements for the parameters (unless they are constant) # put mapping from formal parameters to actual parameters - if n.kind != nkForStmt: InternalError(n.info, "transformFor") + if n.kind != nkForStmt: internalError(n.info, "transformFor") var length = sonsLen(n) var call = n.sons[length - 2] if call.kind notin nkCallKinds or call.sons[0].kind != nkSym or call.sons[0].typ.callConv == ccClosure or call.sons[0].sym.kind != skIterator: - n.sons[length-1] = transformLoopBody(c, n.sons[length-1]).pnode - return lambdalifting.liftForLoop(n).ptransNode + n.sons[length-1] = transformLoopBody(c, n.sons[length-1]).PNode + return lambdalifting.liftForLoop(n).PTransNode #InternalError(call.info, "transformFor") #echo "transforming: ", renderTree(n) @@ -446,7 +446,7 @@ proc transformFor(c: PTransf, n: PNode): PTransNode = var v = newNodeI(nkVarSection, n.info) for i in countup(0, length - 3): addVar(v, copyTree(n.sons[i])) # declare new vars - add(result, v.ptransNode) + add(result, v.PTransNode) # Bugfix: inlined locals belong to the invoking routine, not to the invoked # iterator! @@ -454,24 +454,24 @@ proc transformFor(c: PTransf, n: PNode): PTransNode = var newC = newTransCon(getCurrOwner(c)) newC.forStmt = n newC.forLoopBody = loopBody - if iter.kind != skIterator: InternalError(call.info, "transformFor") + if iter.kind != skIterator: internalError(call.info, "transformFor") # generate access statements for the parameters (unless they are constant) pushTransCon(c, newC) for i in countup(1, sonsLen(call) - 1): - var arg = transform(c, call.sons[i]).pnode + var arg = transform(c, call.sons[i]).PNode var formal = skipTypes(iter.typ, abstractInst).n.sons[i].sym case putArgInto(arg, formal.typ) of paDirectMapping: - IdNodeTablePut(newC.mapping, formal, arg) + idNodeTablePut(newC.mapping, formal, arg) of paFastAsgn: # generate a temporary and produce an assignment statement: var temp = newTemp(c, formal.typ, formal.info) addVar(v, newSymNode(temp)) - add(result, newAsgnStmt(c, newSymNode(temp), arg.ptransNode)) - IdNodeTablePut(newC.mapping, formal, newSymNode(temp)) + add(result, newAsgnStmt(c, newSymNode(temp), arg.PTransNode)) + idNodeTablePut(newC.mapping, formal, newSymNode(temp)) of paVarAsgn: assert(skipTypes(formal.typ, abstractInst).kind == tyVar) - IdNodeTablePut(newC.mapping, formal, arg) + idNodeTablePut(newC.mapping, formal, arg) # XXX BUG still not correct if the arg has a side effect! var body = iter.getBody pushInfoContext(n.info) @@ -500,20 +500,20 @@ proc transformCase(c: PTransf, n: PNode): PTransNode = var e = transform(c, it) case it.kind of nkElifBranch: - if ifs.pnode == nil: + if ifs.PNode == nil: ifs = newTransNode(nkIfStmt, it.info, 0) ifs.add(e) of nkElse: - if ifs.pnode == nil: result.add(e) + if ifs.PNode == nil: result.add(e) else: ifs.add(e) else: result.add(e) - if ifs.pnode != nil: + if ifs.PNode != nil: var elseBranch = newTransNode(nkElse, n.info, 1) elseBranch[0] = ifs result.add(elseBranch) - elif result.Pnode.lastSon.kind != nkElse and not ( - skipTypes(n.sons[0].Typ, abstractVarRange).Kind in + elif result.PNode.lastSon.kind != nkElse and not ( + skipTypes(n.sons[0].typ, abstractVarRange).kind in {tyInt..tyInt64, tyChar, tyEnum, tyUInt..tyUInt32}): # fix a stupid code gen bug by normalizing: var elseBranch = newTransNode(nkElse, n.info, 1) @@ -523,7 +523,7 @@ proc transformCase(c: PTransf, n: PNode): PTransNode = proc transformArrayAccess(c: PTransf, n: PNode): PTransNode = # XXX this is really bad; transf should use a proper AST visitor if n.sons[0].kind == nkSym and n.sons[0].sym.kind == skType: - result = n.ptransnode + result = n.PTransNode else: result = newTransNode(n) for i in 0 .. < n.len: @@ -533,10 +533,10 @@ proc getMergeOp(n: PNode): PSym = case n.kind of nkCall, nkHiddenCallConv, nkCommand, nkInfix, nkPrefix, nkPostfix, nkCallStrLit: - if (n.sons[0].Kind == nkSym) and (n.sons[0].sym.kind == skProc) and + if (n.sons[0].kind == nkSym) and (n.sons[0].sym.kind == skProc) and (sfMerge in n.sons[0].sym.flags): result = n.sons[0].sym - else: nil + else: discard proc flattenTreeAux(d, a: PNode, op: PSym) = var op2 = getMergeOp(a) @@ -563,24 +563,24 @@ proc transformCall(c: PTransf, n: PNode): PTransNode = add(result, transform(c, n.sons[0])) var j = 1 while j < sonsLen(n): - var a = transform(c, n.sons[j]).pnode + var a = transform(c, n.sons[j]).PNode inc(j) if isConstExpr(a): while (j < sonsLen(n)): - let b = transform(c, n.sons[j]).pnode + let b = transform(c, n.sons[j]).PNode if not isConstExpr(b): break a = evalOp(op.magic, n, a, b, nil) inc(j) - add(result, a.ptransnode) + add(result, a.PTransNode) if len(result) == 2: result = result[1] else: - let s = transformSons(c, n).pnode + let s = transformSons(c, n).PNode # bugfix: check after 'transformSons' if it's still a method call: # use the dispatcher for the call: if s.sons[0].kind == nkSym and s.sons[0].sym.kind == skMethod: - result = methodCall(s).ptransNode + result = methodCall(s).PTransNode else: - result = s.ptransNode + result = s.PTransNode proc dontInlineConstant(orig, cnst: PNode): bool {.inline.} = # symbols that expand to a complex constant (array, etc.) should not be @@ -636,6 +636,8 @@ proc transform(c: PTransf, n: PNode): PTransNode = s.ast.sons[bodyPos] = n.sons[bodyPos] #n.sons[bodyPos] = liftLambdas(s, n) #if n.kind == nkMethodDef: methodDef(s, false) + #if n.kind == nkIteratorDef and n.typ != nil: + # return liftIterSym(n.sons[namePos]).PTransNode result = PTransNode(n) of nkMacroDef: # XXX no proper closure support yet: @@ -683,7 +685,7 @@ proc transform(c: PTransf, n: PNode): PTransNode = # completely: result = PTransNode(newNode(nkCommentStmt)) of nkCommentStmt, nkTemplateDef: - return n.ptransNode + return n.PTransNode of nkConstSection: # do not replace ``const c = 3`` with ``const 3 = 3`` return transformConstSection(c, n) @@ -707,7 +709,8 @@ proc transform(c: PTransf, n: PNode): PTransNode = result = transformSons(c, n) # XXX comment handling really sucks: if importantComments(): - pnode(result).comment = n.comment + PNode(result).comment = n.comment + of nkClosure: return PTransNode(n) else: result = transformSons(c, n) var cnst = getConstExpr(c.module, PNode(result)) @@ -719,7 +722,7 @@ proc processTransf(c: PTransf, n: PNode, owner: PSym): PNode = # Note: For interactive mode we cannot call 'passes.skipCodegen' and skip # this step! We have to rely that the semantic pass transforms too errornous # nodes into an empty node. - if passes.skipCodegen(n) or c.fromCache or nfTransf in n.flags: return n + if c.fromCache or nfTransf in n.flags: return n pushTransCon(c, newTransCon(owner)) result = PNode(transform(c, n)) popTransCon(c) @@ -735,14 +738,11 @@ proc transformBody*(module: PSym, n: PNode, prc: PSym): PNode = if nfTransf in n.flags or prc.kind in {skTemplate}: result = n else: - #when useEffectSystem: trackProc(prc, n) var c = openTransf(module, "") result = processTransf(c, n, prc) - if prc.kind != skMacro: - # XXX no closures yet for macros: - result = liftLambdas(prc, result) - if prc.kind == skIterator and prc.typ.callConv == ccClosure: - result = lambdalifting.liftIterator(prc, result) + result = liftLambdas(prc, result) + #if prc.kind == skIterator and prc.typ.callConv == ccClosure: + # result = lambdalifting.liftIterator(prc, result) incl(result.flags, nfTransf) when useEffectSystem: trackProc(prc, result) diff --git a/compiler/trees.nim b/compiler/trees.nim index ab5c97a19..35e9334cc 100644 --- a/compiler/trees.nim +++ b/compiler/trees.nim @@ -36,7 +36,7 @@ proc cyclicTree*(n: PNode): bool = var s = newNodeI(nkEmpty, n.info) result = cyclicTreeAux(n, s) -proc ExprStructuralEquivalent*(a, b: PNode): bool = +proc exprStructuralEquivalent*(a, b: PNode): bool = result = false if a == b: result = true @@ -53,17 +53,17 @@ proc ExprStructuralEquivalent*(a, b: PNode): bool = else: if sonsLen(a) == sonsLen(b): for i in countup(0, sonsLen(a) - 1): - if not ExprStructuralEquivalent(a.sons[i], b.sons[i]): return + if not exprStructuralEquivalent(a.sons[i], b.sons[i]): return result = true -proc sameTree*(a, b: PNode): bool = +proc sameTree*(a, b: PNode): bool = result = false - if a == b: + if a == b: result = true - elif (a != nil) and (b != nil) and (a.kind == b.kind): - if a.flags != b.flags: return - if a.info.line != b.info.line: return - if a.info.col != b.info.col: + elif a != nil and b != nil and a.kind == b.kind: + if a.flags != b.flags: return + if a.info.line != b.info.line: return + if a.info.col != b.info.col: return #if a.info.fileIndex <> b.info.fileIndex then exit; case a.kind of nkSym: @@ -74,7 +74,7 @@ proc sameTree*(a, b: PNode): bool = of nkFloatLit..nkFloat64Lit: result = a.floatVal == b.floatVal of nkStrLit..nkTripleStrLit: result = a.strVal == b.strVal of nkEmpty, nkNilLit, nkType: result = true - else: + else: if sonsLen(a) == sonsLen(b): for i in countup(0, sonsLen(a) - 1): if not sameTree(a.sons[i], b.sons[i]): return @@ -84,22 +84,22 @@ proc getProcSym*(call: PNode): PSym = result = call.sons[0].sym proc getOpSym*(op: PNode): PSym = - if not (op.kind in {nkCall, nkHiddenCallConv, nkCommand, nkCallStrLit}): + if op.kind notin {nkCall, nkHiddenCallConv, nkCommand, nkCallStrLit}: result = nil - else: - if (sonsLen(op) <= 0): InternalError(op.info, "getOpSym") - elif op.sons[0].Kind == nkSym: result = op.sons[0].sym + else: + if sonsLen(op) <= 0: internalError(op.info, "getOpSym") + elif op.sons[0].kind == nkSym: result = op.sons[0].sym else: result = nil - + proc getMagic*(op: PNode): TMagic = case op.kind of nkCallKinds: - case op.sons[0].Kind + case op.sons[0].kind of nkSym: result = op.sons[0].sym.magic else: result = mNone else: result = mNone -proc TreeToSym*(t: PNode): PSym = +proc treeToSym*(t: PNode): PSym = result = t.sym proc isConstExpr*(n: PNode): bool = @@ -118,7 +118,7 @@ proc isDeepConstExpr*(n: PNode): bool = for i in 0 .. <n.len: if not isDeepConstExpr(n.sons[i]): return false result = true - else: nil + else: discard proc flattenTreeAux(d, a: PNode, op: TMagic) = if (getMagic(a) == op): # a is a "leaf", so add it: @@ -129,17 +129,17 @@ proc flattenTreeAux(d, a: PNode, op: TMagic) = proc flattenTree*(root: PNode, op: TMagic): PNode = result = copyNode(root) - if (getMagic(root) == op): + if getMagic(root) == op: # BUGFIX: forget to copy prc addSon(result, copyNode(root.sons[0])) flattenTreeAux(result, root, op) -proc SwapOperands*(op: PNode) = +proc swapOperands*(op: PNode) = var tmp = op.sons[1] op.sons[1] = op.sons[2] op.sons[2] = tmp -proc IsRange*(n: PNode): bool {.inline.} = +proc isRange*(n: PNode): bool {.inline.} = if n.kind == nkInfix: if n[0].kind == nkIdent and n[0].ident.id == ord(wDotDot) or n[0].kind in {nkClosedSymChoice, nkOpenSymChoice} and diff --git a/compiler/treetab.nim b/compiler/treetab.nim index 75e3fd20a..ecb8fb083 100644 --- a/compiler/treetab.nim +++ b/compiler/treetab.nim @@ -17,7 +17,7 @@ proc hashTree(n: PNode): THash = result = ord(n.kind) case n.kind of nkEmpty, nkNilLit, nkType: - nil + discard of nkIdent: result = result !& n.ident.h of nkSym: @@ -34,7 +34,7 @@ proc hashTree(n: PNode): THash = for i in countup(0, sonsLen(n) - 1): result = result !& hashTree(n.sons[i]) -proc TreesEquivalent(a, b: PNode): bool = +proc treesEquivalent(a, b: PNode): bool = if a == b: result = true elif (a != nil) and (b != nil) and (a.kind == b.kind): @@ -48,24 +48,24 @@ proc TreesEquivalent(a, b: PNode): bool = else: if sonsLen(a) == sonsLen(b): for i in countup(0, sonsLen(a) - 1): - if not TreesEquivalent(a.sons[i], b.sons[i]): return + if not treesEquivalent(a.sons[i], b.sons[i]): return result = true if result: result = sameTypeOrNil(a.typ, b.typ) -proc NodeTableRawGet(t: TNodeTable, k: THash, key: PNode): int = +proc nodeTableRawGet(t: TNodeTable, k: THash, key: PNode): int = var h: THash = k and high(t.data) while t.data[h].key != nil: - if (t.data[h].h == k) and TreesEquivalent(t.data[h].key, key): + if (t.data[h].h == k) and treesEquivalent(t.data[h].key, key): return h h = nextTry(h, high(t.data)) result = -1 -proc NodeTableGet*(t: TNodeTable, key: PNode): int = - var index = NodeTableRawGet(t, hashTree(key), key) +proc nodeTableGet*(t: TNodeTable, key: PNode): int = + var index = nodeTableRawGet(t, hashTree(key), key) if index >= 0: result = t.data[index].val else: result = low(int) -proc NodeTableRawInsert(data: var TNodePairSeq, k: THash, key: PNode, +proc nodeTableRawInsert(data: var TNodePairSeq, k: THash, key: PNode, val: int) = var h: THash = k and high(data) while data[h].key != nil: h = nextTry(h, high(data)) @@ -74,37 +74,37 @@ proc NodeTableRawInsert(data: var TNodePairSeq, k: THash, key: PNode, data[h].key = key data[h].val = val -proc NodeTablePut*(t: var TNodeTable, key: PNode, val: int) = +proc nodeTablePut*(t: var TNodeTable, key: PNode, val: int) = var n: TNodePairSeq var k: THash = hashTree(key) - var index = NodeTableRawGet(t, k, key) + var index = nodeTableRawGet(t, k, key) if index >= 0: assert(t.data[index].key != nil) t.data[index].val = val else: if mustRehash(len(t.data), t.counter): - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(t.data)): if t.data[i].key != nil: - NodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val) + nodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val) swap(t.data, n) - NodeTableRawInsert(t.data, k, key, val) + nodeTableRawInsert(t.data, k, key, val) inc(t.counter) -proc NodeTableTestOrSet*(t: var TNodeTable, key: PNode, val: int): int = +proc nodeTableTestOrSet*(t: var TNodeTable, key: PNode, val: int): int = var n: TNodePairSeq var k: THash = hashTree(key) - var index = NodeTableRawGet(t, k, key) + var index = nodeTableRawGet(t, k, key) if index >= 0: assert(t.data[index].key != nil) result = t.data[index].val else: if mustRehash(len(t.data), t.counter): - newSeq(n, len(t.data) * growthFactor) + newSeq(n, len(t.data) * GrowthFactor) for i in countup(0, high(t.data)): if t.data[i].key != nil: - NodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val) + nodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val) swap(t.data, n) - NodeTableRawInsert(t.data, k, key, val) + nodeTableRawInsert(t.data, k, key, val) result = val inc(t.counter) diff --git a/compiler/types.nim b/compiler/types.nim index 66748c308..db75cd3c0 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -10,16 +10,16 @@ # this module contains routines for accessing and iterating over types import - intsets, ast, astalgo, trees, msgs, strutils, platform + intsets, ast, astalgo, trees, msgs, strutils, platform, renderer -proc firstOrd*(t: PType): biggestInt -proc lastOrd*(t: PType): biggestInt -proc lengthOrd*(t: PType): biggestInt +proc firstOrd*(t: PType): BiggestInt +proc lastOrd*(t: PType): BiggestInt +proc lengthOrd*(t: PType): BiggestInt type TPreferedDesc* = enum preferName, preferDesc, preferExported -proc TypeToString*(typ: PType, prefer: TPreferedDesc = preferName): string +proc typeToString*(typ: PType, prefer: TPreferedDesc = preferName): string proc getProcHeader*(sym: PSym): string proc base*(t: PType): PType # ------------------- type iterator: ---------------------------------------- @@ -28,7 +28,7 @@ type TTypeMutator* = proc (t: PType, closure: PObject): PType {.nimcall.} # copy t and mutate it TTypePredicate* = proc (t: PType): bool {.nimcall.} -proc IterOverType*(t: PType, iter: TTypeIter, closure: PObject): bool +proc iterOverType*(t: PType, iter: TTypeIter, closure: PObject): bool # Returns result of `iter`. proc mutateType*(t: PType, iter: TTypeMutator, closure: PObject): PType # Returns result of `iter`. @@ -47,7 +47,8 @@ proc equalParams*(a, b: PNode): TParamsEquality # returns whether the parameter lists of the procs a, b are exactly the same proc isOrdinalType*(t: PType): bool proc enumHasHoles*(t: PType): bool -const + +const abstractPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyDistinct, tyOrdinal, tyConst, tyMutable, tyTypeDesc} abstractVar* = {tyVar, tyGenericInst, tyDistinct, tyOrdinal, @@ -64,17 +65,16 @@ const typedescPtrs* = abstractPtrs + {tyTypeDesc} typedescInst* = abstractInst + {tyTypeDesc} -proc skipTypes*(t: PType, kinds: TTypeKinds): PType proc containsObject*(t: PType): bool proc containsGarbageCollectedRef*(typ: PType): bool proc containsHiddenPointer*(typ: PType): bool proc canFormAcycle*(typ: PType): bool proc isCompatibleToCString*(a: PType): bool -proc getOrdValue*(n: PNode): biggestInt -proc computeSize*(typ: PType): biggestInt -proc getSize*(typ: PType): biggestInt +proc getOrdValue*(n: PNode): BiggestInt +proc computeSize*(typ: PType): BiggestInt +proc getSize*(typ: PType): BiggestInt proc isPureObject*(typ: PType): bool -proc InvalidGenericInst*(f: PType): bool +proc invalidGenericInst*(f: PType): bool # for debugging type TTypeFieldResult* = enum @@ -89,21 +89,21 @@ proc analyseObjectWithTypeField*(t: PType): TTypeFieldResult proc typeAllowed*(t: PType, kind: TSymKind): bool # implementation -proc InvalidGenericInst(f: PType): bool = - result = (f.kind == tyGenericInst) and (lastSon(f) == nil) +proc invalidGenericInst(f: PType): bool = + result = f.kind == tyGenericInst and lastSon(f) == nil proc isPureObject(typ: PType): bool = var t = typ while t.kind == tyObject and t.sons[0] != nil: t = t.sons[0] result = t.sym != nil and sfPure in t.sym.flags -proc getOrdValue(n: PNode): biggestInt = +proc getOrdValue(n: PNode): BiggestInt = case n.kind of nkCharLit..nkInt64Lit: result = n.intVal of nkNilLit: result = 0 of nkHiddenStdConv: result = getOrdValue(n.sons[1]) else: - LocalError(n.info, errOrdinalTypeExpected) + localError(n.info, errOrdinalTypeExpected) result = 0 proc isIntLit*(t: PType): bool {.inline.} = @@ -132,7 +132,7 @@ proc getProcHeader(sym: PSym): string = add(result, typeToString(p.sym.typ)) if i != sonsLen(n)-1: add(result, ", ") else: - InternalError("getProcHeader") + internalError("getProcHeader") add(result, ')') if n.sons[0].typ != nil: result.add(": " & typeToString(n.sons[0].typ)) @@ -148,21 +148,17 @@ proc skipGeneric(t: PType): PType = result = t while result.kind == tyGenericInst: result = lastSon(result) -proc skipTypes(t: PType, kinds: TTypeKinds): PType = - result = t - while result.kind in kinds: result = lastSon(result) - proc isOrdinalType(t: PType): bool = assert(t != nil) # caution: uint, uint64 are no ordinal types! - result = t.Kind in {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} or - (t.Kind in {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst}) and + result = t.kind in {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} or + (t.kind in {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst}) and isOrdinalType(t.sons[0]) proc enumHasHoles(t: PType): bool = var b = t while b.kind in {tyConst, tyMutable, tyRange, tyGenericInst}: b = b.sons[0] - result = b.Kind == tyEnum and tfEnumHasHoles in b.flags + result = b.kind == tyEnum and tfEnumHasHoles in b.flags proc iterOverTypeAux(marker: var TIntSet, t: PType, iter: TTypeIter, closure: PObject): bool @@ -184,7 +180,7 @@ proc iterOverTypeAux(marker: var TIntSet, t: PType, iter: TTypeIter, if t == nil: return result = iter(t, closure) if result: return - if not ContainsOrIncl(marker, t.id): + if not containsOrIncl(marker, t.id): case t.kind of tyGenericInst, tyGenericBody: result = iterOverTypeAux(marker, lastSon(t), iter, closure) @@ -194,8 +190,8 @@ proc iterOverTypeAux(marker: var TIntSet, t: PType, iter: TTypeIter, if result: return if t.n != nil: result = iterOverNode(marker, t.n, iter, closure) -proc IterOverType(t: PType, iter: TTypeIter, closure: PObject): bool = - var marker = InitIntSet() +proc iterOverType(t: PType, iter: TTypeIter, closure: PObject): bool = + var marker = initIntSet() result = iterOverTypeAux(marker, t, iter, closure) proc searchTypeForAux(t: PType, predicate: TTypePredicate, @@ -228,8 +224,8 @@ proc searchTypeForAux(t: PType, predicate: TTypePredicate, # iterates over VALUE types! result = false if t == nil: return - if ContainsOrIncl(marker, t.id): return - result = Predicate(t) + if containsOrIncl(marker, t.id): return + result = predicate(t) if result: return case t.kind of tyObject: @@ -242,10 +238,10 @@ proc searchTypeForAux(t: PType, predicate: TTypePredicate, result = searchTypeForAux(t.sons[i], predicate, marker) if result: return else: - nil + discard proc searchTypeFor(t: PType, predicate: TTypePredicate): bool = - var marker = InitIntSet() + var marker = initIntSet() result = searchTypeForAux(t, predicate, marker) proc isObjectPredicate(t: PType): bool = @@ -284,10 +280,10 @@ proc analyseObjectWithTypeFieldAux(t: PType, if res != frNone: return frEmbedded else: - nil + discard proc analyseObjectWithTypeField(t: PType): TTypeFieldResult = - var marker = InitIntSet() + var marker = initIntSet() result = analyseObjectWithTypeFieldAux(t, marker) proc isGCRef(t: PType): bool = @@ -322,7 +318,7 @@ proc canFormAcycleNode(marker: var TIntSet, n: PNode, startId: int): bool = if not result: case n.kind of nkNone..nkNilLit: - nil + discard else: for i in countup(0, sonsLen(n) - 1): result = canFormAcycleNode(marker, n.sons[i], startId) @@ -337,7 +333,7 @@ proc canFormAcycleAux(marker: var TIntSet, typ: PType, startId: int): bool = case t.kind of tyTuple, tyObject, tyRef, tySequence, tyArray, tyArrayConstr, tyOpenArray, tyVarargs: - if not ContainsOrIncl(marker, t.id): + if not containsOrIncl(marker, t.id): for i in countup(0, sonsLen(t) - 1): result = canFormAcycleAux(marker, t.sons[i], startId) if result: return @@ -350,10 +346,10 @@ proc canFormAcycleAux(marker: var TIntSet, typ: PType, startId: int): bool = # # damn inheritance may introduce cycles: # result = true of tyProc: result = typ.callConv == ccClosure - else: nil + else: discard proc canFormAcycle(typ: PType): bool = - var marker = InitIntSet() + var marker = initIntSet() result = canFormAcycleAux(marker, typ, typ.id) proc mutateTypeAux(marker: var TIntSet, t: PType, iter: TTypeMutator, @@ -367,6 +363,7 @@ proc mutateNode(marker: var TIntSet, n: PNode, iter: TTypeMutator, case n.kind of nkNone..nkNilLit: # a leaf + discard else: for i in countup(0, sonsLen(n) - 1): addSon(result, mutateNode(marker, n.sons[i], iter, closure)) @@ -376,60 +373,52 @@ proc mutateTypeAux(marker: var TIntSet, t: PType, iter: TTypeMutator, result = nil if t == nil: return result = iter(t, closure) - if not ContainsOrIncl(marker, t.id): + if not containsOrIncl(marker, t.id): for i in countup(0, sonsLen(t) - 1): result.sons[i] = mutateTypeAux(marker, result.sons[i], iter, closure) if t.n != nil: result.n = mutateNode(marker, t.n, iter, closure) assert(result != nil) -proc mutateType(t: PType, iter: TTypeMutator, closure: PObject): PType = - var marker = InitIntSet() +proc mutateType(t: PType, iter: TTypeMutator, closure: PObject): PType = + var marker = initIntSet() result = mutateTypeAux(marker, t, iter, closure) -proc ValueToString(a: PNode): string = +proc valueToString(a: PNode): string = case a.kind of nkCharLit..nkUInt64Lit: result = $(a.intVal) of nkFloatLit..nkFloat128Lit: result = $(a.floatVal) of nkStrLit..nkTripleStrLit: result = a.strVal else: result = "<invalid value>" -proc rangeToStr(n: PNode): string = +proc rangeToStr(n: PNode): string = assert(n.kind == nkRange) - result = ValueToString(n.sons[0]) & ".." & ValueToString(n.sons[1]) + result = valueToString(n.sons[0]) & ".." & valueToString(n.sons[1]) const - typeToStr: array[TTypeKind, string] = ["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", + typeToStr: array[TTypeKind, string] = ["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", "OpenArray[$1]", "string", "CString", "Forward", "int", "int8", "int16", "int32", "int64", "float", "float32", "float64", "float128", "uint", "uint8", "uint16", "uint32", "uint64", "bignum", "const ", - "!", "varargs[$1]", "iter[$1]", "Error Type", "TypeClass"] - -proc consToStr(t: PType): string = - if t.len > 0: result = t.typeToString - else: result = typeToStr[t.kind].strip + "!", "varargs[$1]", "iter[$1]", "Error Type", + "BuiltInTypeClass", "UserTypeClass", + "UserTypeClassInst", "CompositeTypeClass", + "and", "or", "not", "any", "static", "TypeFromExpr", "FieldAccessor"] -proc constraintsToStr(t: PType): string = - let sep = if tfAny in t.flags: " or " else: " and " - result = "" - for i in countup(0, t.len - 1): - if i > 0: result.add(sep) - result.add(t.sons[i].consToStr) - -proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string = +proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = var t = typ result = "" if t == nil: return if prefer == preferName and t.sym != nil and sfAnon notin t.sym.flags: if t.kind == tyInt and isIntLit(t): - return t.sym.Name.s & " literal(" & $t.n.intVal & ")" - return t.sym.Name.s - case t.Kind + return t.sym.name.s & " literal(" & $t.n.intVal & ")" + return t.sym.name.s + case t.kind of tyInt: if not isIntLit(t) or prefer == preferExported: result = typeToStr[t.kind] @@ -443,16 +432,45 @@ proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string = add(result, ']') of tyTypeDesc: if t.len == 0: result = "typedesc" - else: result = "typedesc[" & constraintsToStr(t) & "]" - of tyTypeClass: - if t.n != nil: return t.sym.owner.name.s - case t.len - of 0: result = "typeclass[]" - of 1: result = "typeclass[" & consToStr(t.sons[0]) & "]" - else: result = constraintsToStr(t) + else: result = "typedesc[" & typeToString(t.sons[0]) & "]" + of tyStatic: + internalAssert t.len > 0 + result = "static[" & typeToString(t.sons[0]) & "]" + of tyUserTypeClass: + internalAssert t.sym != nil and t.sym.owner != nil + return t.sym.owner.name.s + of tyBuiltInTypeClass: + result = case t.base.kind: + of tyVar: "var" + of tyRef: "ref" + of tyPtr: "ptr" + of tySequence: "seq" + of tyArray: "array" + of tySet: "set" + of tyRange: "range" + of tyDistinct: "distinct" + of tyProc: "proc" + of tyObject: "object" + of tyTuple: "tuple" + else: (internalAssert(false); "") + of tyUserTypeClassInst: + let body = t.base + result = body.sym.name.s & "[" + for i in countup(1, sonsLen(t) - 2): + if i > 1: add(result, ", ") + add(result, typeToString(t.sons[i])) + result.add "]" + of tyAnd: + result = typeToString(t.sons[0]) & " and " & typeToString(t.sons[1]) + of tyOr: + result = typeToString(t.sons[0]) & " and " & typeToString(t.sons[1]) + of tyNot: + result = "not " & typeToString(t.sons[0]) of tyExpr: - if t.len == 0: result = "expr" - else: result = "expr[" & constraintsToStr(t) & "]" + internalAssert t.len == 0 + result = "expr" + of tyFromExpr, tyFieldAccessor: + result = renderTree(t.n) of tyArray: if t.sons[0].kind == tyRange: result = "array[" & rangeToStr(t.sons[0].n) & ", " & @@ -499,7 +517,7 @@ proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string = add(result, typeToString(t.sons[i])) if i < sonsLen(t) - 1: add(result, ", ") add(result, ')') - if t.sons[0] != nil: add(result, ": " & TypeToString(t.sons[0])) + if t.sons[0] != nil: add(result, ": " & typeToString(t.sons[0])) var prag: string if t.callConv != ccDefault: prag = CallingConvToStr[t.callConv] else: prag = "" @@ -524,7 +542,7 @@ proc resultType(t: PType): PType = proc base(t: PType): PType = result = t.sons[0] -proc firstOrd(t: PType): biggestInt = +proc firstOrd(t: PType): BiggestInt = case t.kind of tyBool, tyChar, tySequence, tyOpenArray, tyString, tyVarargs, tyProxy: result = 0 @@ -549,13 +567,14 @@ proc firstOrd(t: PType): biggestInt = else: assert(t.n.sons[0].kind == nkSym) result = t.n.sons[0].sym.position - of tyGenericInst, tyDistinct, tyConst, tyMutable, tyTypeDesc: + of tyGenericInst, tyDistinct, tyConst, tyMutable, + tyTypeDesc, tyFieldAccessor: result = firstOrd(lastSon(t)) else: - InternalError("invalid kind for first(" & $t.kind & ')') + internalError("invalid kind for first(" & $t.kind & ')') result = 0 -proc lastOrd(t: PType): biggestInt = +proc lastOrd(t: PType): BiggestInt = case t.kind of tyBool: result = 1 of tyChar: result = 255 @@ -582,14 +601,15 @@ proc lastOrd(t: PType): biggestInt = of tyEnum: assert(t.n.sons[sonsLen(t.n) - 1].kind == nkSym) result = t.n.sons[sonsLen(t.n) - 1].sym.position - of tyGenericInst, tyDistinct, tyConst, tyMutable, tyTypeDesc: + of tyGenericInst, tyDistinct, tyConst, tyMutable, + tyTypeDesc, tyFieldAccessor: result = lastOrd(lastSon(t)) of tyProxy: result = 0 else: - InternalError("invalid kind for last(" & $t.kind & ')') + internalError("invalid kind for last(" & $t.kind & ')') result = 0 -proc lengthOrd(t: PType): biggestInt = +proc lengthOrd(t: PType): BiggestInt = case t.kind of tyInt64, tyInt32, tyInt: result = lastOrd(t) of tyDistinct, tyConst, tyMutable: result = lengthOrd(t.sons[0]) @@ -605,8 +625,11 @@ type dcEqOrDistinctOf ## a equals b or a is distinct of b TTypeCmpFlag* = enum - IgnoreTupleFields, - TypeDescExactMatch, + IgnoreTupleFields + IgnoreCC + ExactTypeDescValues + ExactGenericParams + ExactConstraints AllowCommonBase TTypeCmpFlags* = set[TTypeCmpFlag] @@ -620,39 +643,41 @@ type proc initSameTypeClosure: TSameTypeClosure = # we do the initialization lazily for performance (avoids memory allocations) - nil + discard proc containsOrIncl(c: var TSameTypeClosure, a, b: PType): bool = - result = not IsNil(c.s) and c.s.contains((a.id, b.id)) + result = not isNil(c.s) and c.s.contains((a.id, b.id)) if not result: - if IsNil(c.s): c.s = @[] + if isNil(c.s): c.s = @[] c.s.add((a.id, b.id)) -proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool -proc SameTypeOrNilAux(a, b: PType, c: var TSameTypeClosure): bool = +proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool +proc sameTypeOrNilAux(a, b: PType, c: var TSameTypeClosure): bool = if a == b: result = true else: if a == nil or b == nil: result = false - else: result = SameTypeAux(a, b, c) + else: result = sameTypeAux(a, b, c) -proc SameTypeOrNil*(a, b: PType, flags: TTypeCmpFlags = {}): bool = +proc sameType*(a, b: PType, flags: TTypeCmpFlags = {}): bool = + var c = initSameTypeClosure() + c.flags = flags + result = sameTypeAux(a, b, c) + +proc sameTypeOrNil*(a, b: PType, flags: TTypeCmpFlags = {}): bool = if a == b: result = true - else: + else: if a == nil or b == nil: result = false - else: - var c = initSameTypeClosure() - c.flags = flags - result = SameTypeAux(a, b, c) + else: result = sameType(a, b, flags) proc equalParam(a, b: PSym): TParamsEquality = - if SameTypeOrNil(a.typ, b.typ, {TypeDescExactMatch}) and - ExprStructuralEquivalent(a.constraint, b.constraint): + if sameTypeOrNil(a.typ, b.typ, {ExactTypeDescValues}) and + exprStructuralEquivalent(a.constraint, b.constraint): if a.ast == b.ast: result = paramsEqual elif a.ast != nil and b.ast != nil: - if ExprStructuralEquivalent(a.ast, b.ast): result = paramsEqual + if exprStructuralEquivalent(a.ast, b.ast): result = paramsEqual else: result = paramsIncompatible elif a.ast != nil: result = paramsEqual @@ -660,7 +685,15 @@ proc equalParam(a, b: PSym): TParamsEquality = result = paramsIncompatible else: result = paramsNotEqual - + +proc sameConstraints(a, b: PNode): bool = + internalAssert a.len == b.len + for i in 1 .. <a.len: + if not exprStructuralEquivalent(a[i].sym.constraint, + b[i].sym.constraint): + return false + return true + proc equalParams(a, b: PNode): TParamsEquality = result = paramsEqual var length = sonsLen(a) @@ -675,7 +708,7 @@ proc equalParams(a, b: PNode): TParamsEquality = of paramsNotEqual: return paramsNotEqual of paramsEqual: - nil + discard of paramsIncompatible: result = paramsIncompatible if (m.name.id != n.name.id): @@ -683,14 +716,14 @@ proc equalParams(a, b: PNode): TParamsEquality = return paramsNotEqual # paramsIncompatible; # continue traversal! If not equal, we can return immediately; else # it stays incompatible - if not SameTypeOrNil(a.sons[0].typ, b.sons[0].typ, {TypeDescExactMatch}): + if not sameTypeOrNil(a.sons[0].typ, b.sons[0].typ, {ExactTypeDescValues}): if (a.sons[0].typ == nil) or (b.sons[0].typ == nil): result = paramsNotEqual # one proc has a result, the other not is OK else: result = paramsIncompatible # overloading by different # result types does not work -proc SameLiteral(x, y: PNode): bool = +proc sameLiteral(x, y: PNode): bool = if x.kind == y.kind: case x.kind of nkCharLit..nkInt64Lit: result = x.intVal == y.intVal @@ -698,9 +731,9 @@ proc SameLiteral(x, y: PNode): bool = of nkNilLit: result = true else: assert(false) -proc SameRanges(a, b: PNode): bool = - result = SameLiteral(a.sons[0], b.sons[0]) and - SameLiteral(a.sons[1], b.sons[1]) +proc sameRanges(a, b: PNode): bool = + result = sameLiteral(a.sons[0], b.sons[0]) and + sameLiteral(a.sons[1], b.sons[1]) proc sameTuple(a, b: PType, c: var TSameTypeClosure): bool = # two tuples are equivalent iff the names, types and positions are the same; @@ -715,7 +748,7 @@ proc sameTuple(a, b: PType, c: var TSameTypeClosure): bool = x = skipTypes(x, {tyRange}) y = skipTypes(y, {tyRange}) - result = SameTypeAux(x, y, c) + result = sameTypeAux(x, y, c) if not result: return if a.n != nil and b.n != nil and IgnoreTupleFields notin c.flags: for i in countup(0, sonsLen(a.n) - 1): @@ -725,11 +758,11 @@ proc sameTuple(a, b: PType, c: var TSameTypeClosure): bool = var y = b.n.sons[i].sym result = x.name.id == y.name.id if not result: break - else: InternalError(a.n.info, "sameTuple") + else: internalError(a.n.info, "sameTuple") else: result = false -template IfFastObjectTypeCheckFailed(a, b: PType, body: stmt) {.immediate.} = +template ifFastObjectTypeCheckFailed(a, b: PType, body: stmt) {.immediate.} = if tfFromGeneric notin a.flags + b.flags: # fast case: id comparison suffices: result = a.id == b.id @@ -744,15 +777,15 @@ template IfFastObjectTypeCheckFailed(a, b: PType, body: stmt) {.immediate.} = # TA[T] = object # TB[T] = object # --> TA[int] != TB[int] - if tfFromGeneric in a.flags * b.flags and a.sym.Id == b.sym.Id: + if tfFromGeneric in a.flags * b.flags and a.sym.id == b.sym.id: # ok, we need the expensive structural check body proc sameObjectTypes*(a, b: PType): bool = # specialized for efficiency (sigmatch uses it) - IfFastObjectTypeCheckFailed(a, b): + ifFastObjectTypeCheckFailed(a, b): var c = initSameTypeClosure() - result = sameTypeAux(a, b, c) + result = sameTypeAux(a, b, c) proc sameDistinctTypes*(a, b: PType): bool {.inline.} = result = sameObjectTypes(a, b) @@ -760,7 +793,7 @@ proc sameDistinctTypes*(a, b: PType): bool {.inline.} = proc sameEnumTypes*(a, b: PType): bool {.inline.} = result = a.id == b.id -proc SameObjectTree(a, b: PNode, c: var TSameTypeClosure): bool = +proc sameObjectTree(a, b: PNode, c: var TSameTypeClosure): bool = if a == b: result = true elif (a != nil) and (b != nil) and (a.kind == b.kind): @@ -777,26 +810,26 @@ proc SameObjectTree(a, b: PNode, c: var TSameTypeClosure): bool = else: if sonsLen(a) == sonsLen(b): for i in countup(0, sonsLen(a) - 1): - if not SameObjectTree(a.sons[i], b.sons[i], c): return + if not sameObjectTree(a.sons[i], b.sons[i], c): return result = true proc sameObjectStructures(a, b: PType, c: var TSameTypeClosure): bool = # check base types: if sonsLen(a) != sonsLen(b): return for i in countup(0, sonsLen(a) - 1): - if not SameTypeOrNilAux(a.sons[i], b.sons[i], c): return - if not SameObjectTree(a.n, b.n, c): return + if not sameTypeOrNilAux(a.sons[i], b.sons[i], c): return + if not sameObjectTree(a.n, b.n, c): return result = true proc sameChildrenAux(a, b: PType, c: var TSameTypeClosure): bool = if sonsLen(a) != sonsLen(b): return false result = true for i in countup(0, sonsLen(a) - 1): - result = SameTypeOrNilAux(a.sons[i], b.sons[i], c) + result = sameTypeOrNilAux(a.sons[i], b.sons[i], c) if not result: return -proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = - template CycleCheck() = +proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = + template cycleCheck() = # believe it or not, the direct check for ``containsOrIncl(c, a, b)`` # increases bootstrapping time from 2.4s to 3.3s on my laptop! So we cheat # again: Since the recursion check is only to not get caught in an endless @@ -808,11 +841,11 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = if containsOrIncl(c, a, b): return true proc sameFlags(a, b: PType): bool {.inline.} = - result = eqTypeFlags*a.flags == eqTypeFlags*b.flags - + result = eqTypeFlags*a.flags == eqTypeFlags*b.flags + if x == y: return true var a = skipTypes(x, {tyGenericInst}) - var b = skipTypes(y, {tyGenericInst}) + var b = skipTypes(y, {tyGenericInst}) assert(a != nil) assert(b != nil) if a.kind != b.kind: @@ -824,54 +857,60 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = if a.kind != b.kind: return false of dcEqOrDistinctOf: while a.kind == tyDistinct: a = a.sons[0] - if a.kind != b.kind: return false - case a.Kind + if a.kind != b.kind: return false + case a.kind of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, - tyInt..tyBigNum, tyStmt: + tyInt..tyBigNum, tyStmt, tyExpr: result = sameFlags(a, b) - of tyExpr: - result = ExprStructuralEquivalent(a.n, b.n) and sameFlags(a, b) + of tyStatic, tyFromExpr: + result = exprStructuralEquivalent(a.n, b.n) and sameFlags(a, b) of tyObject: - IfFastObjectTypeCheckFailed(a, b): - CycleCheck() + ifFastObjectTypeCheckFailed(a, b): + cycleCheck() result = sameObjectStructures(a, b, c) and sameFlags(a, b) of tyDistinct: - CycleCheck() - if c.cmp == dcEq: result = sameTypeAux(a, b, c) and sameFlags(a, b) - else: result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b) + cycleCheck() + if c.cmp == dcEq: + if sameFlags(a, b): + ifFastObjectTypeCheckFailed(a, b): + result = sameTypeAux(a.sons[0], b.sons[0], c) + else: + result = sameTypeAux(a.sons[0], b.sons[0], c) and sameFlags(a, b) of tyEnum, tyForward, tyProxy: # XXX generic enums do not make much sense, but require structural checking result = a.id == b.id and sameFlags(a, b) of tyTuple: - CycleCheck() + cycleCheck() result = sameTuple(a, b, c) and sameFlags(a, b) - of tyGenericInst: + of tyGenericInst: result = sameTypeAux(lastSon(a), lastSon(b), c) of tyTypeDesc: if c.cmp == dcEqIgnoreDistinct: result = false - elif TypeDescExactMatch in c.flags: - CycleCheck() + elif ExactTypeDescValues in c.flags: + cycleCheck() result = sameChildrenAux(x, y, c) and sameFlags(a, b) else: result = sameFlags(a, b) - of tyGenericParam, tyGenericInvokation, tyGenericBody, tySequence, + of tyGenericParam: + result = sameChildrenAux(a, b, c) and sameFlags(a, b) + if result and ExactGenericParams in c.flags: + result = a.sym.position == b.sym.position + of tyGenericInvokation, tyGenericBody, tySequence, tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr, tyArray, tyProc, tyConst, tyMutable, tyVarargs, tyIter, - tyOrdinal, tyTypeClass: - CycleCheck() + tyOrdinal, tyTypeClasses, tyFieldAccessor: + cycleCheck() + if a.kind == tyUserTypeClass and a.n != nil: return a.n == b.n result = sameChildrenAux(a, b, c) and sameFlags(a, b) - if result and (a.kind == tyProc): - result = a.callConv == b.callConv + if result and a.kind == tyProc: + result = ((IgnoreCC in c.flags) or a.callConv == b.callConv) and + ((ExactConstraints notin c.flags) or sameConstraints(a.n, b.n)) of tyRange: - CycleCheck() - result = SameTypeOrNilAux(a.sons[0], b.sons[0], c) and - SameValue(a.n.sons[0], b.n.sons[0]) and - SameValue(a.n.sons[1], b.n.sons[1]) - of tyNone: result = false - -proc sameType*(x, y: PType): bool = - var c = initSameTypeClosure() - result = sameTypeAux(x, y, c) + cycleCheck() + result = sameTypeOrNilAux(a.sons[0], b.sons[0], c) and + sameValue(a.n.sons[0], b.n.sons[0]) and + sameValue(a.n.sons[1], b.n.sons[1]) + of tyNone: result = false proc sameBackendType*(x, y: PType): bool = var c = initSameTypeClosure() @@ -949,7 +988,7 @@ proc typeAllowedNode(marker: var TIntSet, n: PNode, kind: TSymKind, if result: case n.kind of nkNone..nkNilLit: - nil + discard else: for i in countup(0, sonsLen(n) - 1): result = typeAllowedNode(marker, n.sons[i], kind, flags) @@ -960,7 +999,7 @@ proc matchType*(a: PType, pattern: openArray[tuple[k:TTypeKind, i:int]], var a = a for k, i in pattern.items: if a.kind != k: return false - if i >= a.sonslen or a.sons[i] == nil: return false + if i >= a.sonsLen or a.sons[i] == nil: return false a = a.sons[i] result = a.kind == last @@ -970,42 +1009,6 @@ proc isGenericAlias*(t: PType): bool = proc skipGenericAlias*(t: PType): PType = return if t.isGenericAlias: t.lastSon else: t -proc matchTypeClass*(bindings: var TIdTable, typeClass, t: PType): bool = - for i in countup(0, typeClass.sonsLen - 1): - let req = typeClass.sons[i] - var match = req.kind == skipTypes(t, {tyRange, tyGenericInst}).kind - - if not match: - case req.kind - of tyGenericBody: - if t.kind == tyGenericInst and t.sons[0] == req: - match = true - IdTablePut(bindings, typeClass, t) - of tyTypeClass: - match = matchTypeClass(bindings, req, t) - elif t.kind == tyTypeClass: - match = matchTypeClass(bindings, t, req) - - elif t.kind in {tyObject} and req.len != 0: - # empty 'object' is fine as constraint in a type class - match = sameType(t, req) - - if tfAny in typeClass.flags: - if match: return true - else: - if not match: return false - - # if the loop finished without returning, either all constraints matched - # or none of them matched. - result = if tfAny in typeClass.flags: false else: true - if result == true: - IdTablePut(bindings, typeClass, t) - -proc matchTypeClass*(typeClass, typ: PType): bool = - var bindings: TIdTable - initIdTable(bindings) - result = matchTypeClass(bindings, typeClass, typ) - proc typeAllowedAux(marker: var TIntSet, typ: PType, kind: TSymKind, flags: TTypeAllowedFlags = {}): bool = assert(kind in {skVar, skLet, skConst, skParam, skResult}) @@ -1013,7 +1016,7 @@ proc typeAllowedAux(marker: var TIntSet, typ: PType, kind: TSymKind, # evaluation if something is wrong: result = true if typ == nil: return - if ContainsOrIncl(marker, typ.id): return + if containsOrIncl(marker, typ.id): return var t = skipTypes(typ, abstractInst-{tyTypeDesc}) case t.kind of tyVar: @@ -1033,14 +1036,15 @@ proc typeAllowedAux(marker: var TIntSet, typ: PType, kind: TSymKind, if not result: break if result and t.sons[0] != nil: result = typeAllowedAux(marker, t.sons[0], skResult, flags) - of tyExpr, tyStmt, tyTypeDesc: + of tyExpr, tyStmt, tyTypeDesc, tyStatic: result = true # XXX er ... no? these should not be allowed! of tyEmpty: result = taField in flags - of tyTypeClass: + of tyTypeClasses: result = true - of tyGenericBody, tyGenericParam, tyForward, tyNone, tyGenericInvokation: + of tyGenericBody, tyGenericParam, tyGenericInvokation, + tyNone, tyForward, tyFromExpr, tyFieldAccessor: result = false of tyNil: result = kind == skConst @@ -1083,15 +1087,15 @@ proc typeAllowedAux(marker: var TIntSet, typ: PType, kind: TSymKind, result = true proc typeAllowed(t: PType, kind: TSymKind): bool = - var marker = InitIntSet() + var marker = initIntSet() result = typeAllowedAux(marker, t, kind, {}) -proc align(address, alignment: biggestInt): biggestInt = +proc align(address, alignment: BiggestInt): BiggestInt = result = (address + (alignment - 1)) and not (alignment - 1) -proc computeSizeAux(typ: PType, a: var biggestInt): biggestInt -proc computeRecSizeAux(n: PNode, a, currOffset: var biggestInt): biggestInt = - var maxAlign, maxSize, b, res: biggestInt +proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt +proc computeRecSizeAux(n: PNode, a, currOffset: var BiggestInt): BiggestInt = + var maxAlign, maxSize, b, res: BiggestInt case n.kind of nkRecCase: assert(n.sons[0].kind == nkSym) @@ -1123,25 +1127,29 @@ proc computeRecSizeAux(n: PNode, a, currOffset: var biggestInt): biggestInt = result = computeSizeAux(n.sym.typ, a) n.sym.offset = int(currOffset) else: - InternalError("computeRecSizeAux()") + internalError("computeRecSizeAux()") a = 1 result = - 1 -proc computeSizeAux(typ: PType, a: var biggestInt): biggestInt = - var res, maxAlign, length, currOffset: biggestInt - if typ.size == - 2: +const + szIllegalRecursion* = -2 + szUnknownSize* = -1 + +proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt = + var res, maxAlign, length, currOffset: BiggestInt + if typ.size == szIllegalRecursion: # we are already computing the size of the type # --> illegal recursion in type - return - 2 - if typ.size >= 0: + return szIllegalRecursion + if typ.size >= 0: # size already computed result = typ.size a = typ.align return - typ.size = - 2 # mark as being computed + typ.size = szIllegalRecursion # mark as being computed case typ.kind of tyInt, tyUInt: - result = IntSize + result = intSize a = result of tyInt8, tyUInt8, tyBool, tyChar: result = 1 @@ -1169,8 +1177,10 @@ proc computeSizeAux(typ: PType, a: var biggestInt): biggestInt = tyBigNum: result = ptrSize a = result - of tyArray, tyArrayConstr: - result = lengthOrd(typ.sons[0]) * computeSizeAux(typ.sons[1], a) + of tyArray, tyArrayConstr: + let elemSize = computeSizeAux(typ.sons[1], a) + if elemSize < 0: return elemSize + result = lengthOrd(typ.sons[0]) * elemSize of tyEnum: if firstOrd(typ) < 0: result = 4 # use signed int32 @@ -1178,7 +1188,7 @@ proc computeSizeAux(typ: PType, a: var biggestInt): biggestInt = length = lastOrd(typ) # BUGFIX: use lastOrd! if length + 1 < `shl`(1, 8): result = 1 elif length + 1 < `shl`(1, 16): result = 2 - elif length + 1 < `shl`(biggestInt(1), 32): result = 4 + elif length + 1 < `shl`(BiggestInt(1), 32): result = 4 else: result = 8 a = result of tySet: @@ -1221,16 +1231,17 @@ proc computeSizeAux(typ: PType, a: var biggestInt): biggestInt = of tyGenericInst, tyDistinct, tyGenericBody, tyMutable, tyConst, tyIter: result = computeSizeAux(lastSon(typ), a) of tyTypeDesc: - result = (if typ.len == 1: computeSizeAux(typ.sons[0], a) else: -1) - of tyProxy: result = 1 + result = if typ.len == 1: computeSizeAux(typ.sons[0], a) + else: szUnknownSize + of tyForward: return szIllegalRecursion else: #internalError("computeSizeAux()") - result = - 1 + result = szUnknownSize typ.size = result typ.align = int(a) -proc computeSize(typ: PType): biggestInt = - var a: biggestInt = 1 +proc computeSize(typ: PType): BiggestInt = + var a: BiggestInt = 1 result = computeSizeAux(typ, a) proc getReturnType*(s: PSym): PType = @@ -1238,13 +1249,20 @@ proc getReturnType*(s: PSym): PType = assert s.kind in {skProc, skTemplate, skMacro, skIterator} result = s.typ.sons[0] -proc getSize(typ: PType): biggestInt = +proc getSize(typ: PType): BiggestInt = result = computeSize(typ) - if result < 0: InternalError("getSize: " & $typ.kind) + if result < 0: internalError("getSize: " & $typ.kind) + +proc containsGenericTypeIter(t: PType, closure: PObject): bool = + if t.kind in GenericTypes + tyTypeClasses + {tyFromExpr}: + return true + if t.kind == tyTypeDesc: + if t.sons[0].kind == tyNone: return true + if containsGenericTypeIter(t.base, closure): return true + return false -proc containsGenericTypeIter(t: PType, closure: PObject): bool = - result = t.kind in GenericTypes + return t.kind == tyStatic and t.n == nil proc containsGenericType*(t: PType): bool = result = iterOverType(t, containsGenericTypeIter, nil) @@ -1283,8 +1301,8 @@ proc compatibleEffectsAux(se, re: PNode): bool = proc compatibleEffects*(formal, actual: PType): bool = # for proc type compatibility checking: assert formal.kind == tyProc and actual.kind == tyProc - InternalAssert formal.n.sons[0].kind == nkEffectList - InternalAssert actual.n.sons[0].kind == nkEffectList + internalAssert formal.n.sons[0].kind == nkEffectList + internalAssert actual.n.sons[0].kind == nkEffectList var spec = formal.n.sons[0] if spec.len != 0: @@ -1294,7 +1312,7 @@ proc compatibleEffects*(formal, actual: PType): bool = # if 'se.kind == nkArgList' it is no formal type really, but a # computed effect and as such no spec: # 'r.msgHandler = if isNil(msgHandler): defaultMsgHandler else: msgHandler' - if not IsNil(se) and se.kind != nkArgList: + if not isNil(se) and se.kind != nkArgList: # spec requires some exception or tag, but we don't know anything: if real.len == 0: return false result = compatibleEffectsAux(se, real.sons[exceptionEffects]) @@ -1309,7 +1327,7 @@ proc compatibleEffects*(formal, actual: PType): bool = result = true proc isCompileTimeOnly*(t: PType): bool {.inline.} = - result = t.kind in {tyTypedesc, tyExpr} + result = t.kind in {tyTypeDesc, tyStatic} proc containsCompileTimeOnly*(t: PType): bool = if isCompileTimeOnly(t): return true diff --git a/compiler/vm.nim b/compiler/vm.nim index 7705746de..10ac7aaaf 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -10,11 +10,17 @@ ## This file implements the new evaluation engine for Nimrod code. ## An instruction is 1-2 int32s in memory, it is a register based VM. +import ast except getstr + import - strutils, ast, astalgo, msgs, vmdef, vmgen, nimsets, types, passes, unsigned, - parser, vmdeps, idents + strutils, astalgo, msgs, vmdef, vmgen, nimsets, types, passes, unsigned, + parser, vmdeps, idents, trees, renderer, options, transf from semfold import leValueConv, ordinalValToString +from evaltempl import evalTemplate + +when hasFFI: + import evalffi type PStackFrame* = ref TStackFrame @@ -34,7 +40,7 @@ proc stackTraceAux(c: PCtx; x: PStackFrame; pc: int) = var info = c.debug[pc] # we now use the same format as in system/except.nim var s = toFilename(info) - var line = toLineNumber(info) + var line = toLinenumber(info) if line > 0: add(s, '(') add(s, $line) @@ -42,13 +48,13 @@ proc stackTraceAux(c: PCtx; x: PStackFrame; pc: int) = if x.prc != nil: for k in 1..max(1, 25-s.len): add(s, ' ') add(s, x.prc.name.s) - MsgWriteln(s) + msgWriteln(s) proc stackTrace(c: PCtx, tos: PStackFrame, pc: int, msg: TMsgKind, arg = "") = - MsgWriteln("stack trace: (most recent call last)") + msgWriteln("stack trace: (most recent call last)") stackTraceAux(c, tos, pc) - LocalError(c.debug[pc], msg, arg) + localError(c.debug[pc], msg, arg) proc bailOut(c: PCtx; tos: PStackFrame) = stackTrace(c, tos, c.exceptionInstr, errUnhandledExceptionX, @@ -57,15 +63,25 @@ proc bailOut(c: PCtx; tos: PStackFrame) = when not defined(nimComputedGoto): {.pragma: computedGoto.} -template inc(pc: ptr TInstr, diff = 1) = - inc cast[TAddress](pc), TInstr.sizeof * diff - proc myreset(n: PNode) = when defined(system.reset): var oldInfo = n.info reset(n[]) n.info = oldInfo +proc skipMeta(n: PNode): PNode = (if n.kind != nkMetaNode: n else: n.sons[0]) + +proc setMeta(n, child: PNode) = + assert n.kind == nkMetaNode + let child = child.skipMeta + if n.sons.isNil: n.sons = @[child] + else: n.sons[0] = child + +proc uast(n: PNode): PNode {.inline.} = + # "underlying ast" + assert n.kind == nkMetaNode + n.sons[0] + template ensureKind(k: expr) {.immediate, dirty.} = if regs[ra].kind != k: myreset(regs[ra]) @@ -93,26 +109,56 @@ template decodeBx(k: expr) {.immediate, dirty.} = let rbx = instr.regBx - wordExcess ensureKind(k) -template move(a, b: expr) = system.shallowCopy(a, b) +template move(a, b: expr) {.immediate, dirty.} = system.shallowCopy(a, b) # XXX fix minor 'shallowCopy' overloading bug in compiler -proc asgnRef(x, y: PNode) = - myreset(x) - x.kind = y.kind +proc moveConst(x, y: PNode) = + if x.kind != y.kind: + myreset(x) + x.kind = y.kind x.typ = y.typ case x.kind of nkCharLit..nkInt64Lit: x.intVal = y.intVal of nkFloatLit..nkFloat64Lit: x.floatVal = y.floatVal - of nkStrLit..nkTripleStrLit: x.strVal = y.strVal + of nkStrLit..nkTripleStrLit: move(x.strVal, y.strVal) of nkIdent: x.ident = y.ident of nkSym: x.sym = y.sym + of nkMetaNode: + if x.sons.isNil: x.sons = @[y.sons[0]] + else: x.sons[0] = y.sons[0] else: if x.kind notin {nkEmpty..nkNilLit}: move(x.sons, y.sons) +# this seems to be the best way to model the reference semantics +# of PNimrodNode: +template asgnRef(x, y: expr) = moveConst(x, y) + +proc copyValue(src: PNode): PNode = + if src == nil or nfIsRef in src.flags: + return src + result = newNode(src.kind) + result.info = src.info + result.typ = src.typ + result.flags = src.flags * PersistentNodeFlags + when defined(useNodeIds): + if result.id == nodeIdToDebug: + echo "COMES FROM ", src.id + case src.kind + of nkCharLit..nkUInt64Lit: result.intVal = src.intVal + of nkFloatLit..nkFloat128Lit: result.floatVal = src.floatVal + of nkSym: result.sym = src.sym + of nkIdent: result.ident = src.ident + of nkStrLit..nkTripleStrLit: result.strVal = src.strVal + else: + newSeq(result.sons, sonsLen(src)) + for i in countup(0, sonsLen(src) - 1): + result.sons[i] = copyValue(src.sons[i]) + proc asgnComplex(x, y: PNode) = - myreset(x) - x.kind = y.kind + if x.kind != y.kind: + myreset(x) + x.kind = y.kind x.typ = y.typ case x.kind of nkCharLit..nkInt64Lit: x.intVal = y.intVal @@ -120,13 +166,18 @@ proc asgnComplex(x, y: PNode) = of nkStrLit..nkTripleStrLit: x.strVal = y.strVal of nkIdent: x.ident = y.ident of nkSym: x.sym = y.sym + of nkMetaNode: + if x.sons.isNil: x.sons = @[y.sons[0]] + else: x.sons[0] = y.sons[0] else: if x.kind notin {nkEmpty..nkNilLit}: - let y = y.copyTree - for i in countup(0, sonsLen(y) - 1): addSon(x, y.sons[i]) + let y = y.copyValue + for i in countup(0, sonsLen(y) - 1): + if i < x.len: x.sons[i] = y.sons[i] + else: addSon(x, y.sons[i]) template getstr(a: expr): expr = - (if a.kind == nkStrLit: a.strVal else: $chr(int(a.intVal))) + (if a.kind in {nkStrLit..nkTripleStrLit}: a.strVal else: $chr(int(a.intVal))) proc pushSafePoint(f: PStackFrame; pc: int) = if f.safePoints.isNil: f.safePoints = @[] @@ -231,16 +282,23 @@ proc compile(c: PCtx, s: PSym): int = result = vmgen.genProc(c, s) #c.echoCode -proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = +proc regsContents(regs: TNodeSeq) = + for i in 0.. <regs.len: + echo "Register ", i + #debug regs[i] + +proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode = var pc = start var tos = tos var regs: TNodeSeq # alias to tos.slots for performance move(regs, tos.slots) + #echo "NEW RUN ------------------------" while true: - {.computedGoto.} + #{.computedGoto.} let instr = c.code[pc] let ra = instr.regA #echo "PC ", pc, " ", c.code[pc].opcode, " ra ", ra + #message(c.debug[pc], warnUser, "gah") case instr.opcode of opcEof: return regs[ra] of opcRet: @@ -248,20 +306,26 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = pc = tos.comesFrom tos = tos.next let retVal = regs[0] - if tos.isNil: return retVal + if tos.isNil: + #echo "RET ", retVal.rendertree + return retVal move(regs, tos.slots) assert c.code[pc].opcode in {opcIndCall, opcIndCallAsgn} if c.code[pc].opcode == opcIndCallAsgn: regs[c.code[pc].regA] = retVal + #echo "RET2 ", retVal.rendertree, " ", c.code[pc].regA of opcYldYoid: assert false of opcYldVal: assert false of opcAsgnInt: decodeB(nkIntLit) regs[ra].intVal = regs[rb].intVal of opcAsgnStr: - decodeB(nkStrLit) - regs[ra].strVal = regs[rb].strVal + if regs[instr.regB].kind == nkNilLit: + decodeB(nkNilLit) + else: + decodeB(nkStrLit) + regs[ra].strVal = regs[rb].strVal of opcAsgnFloat: decodeB(nkFloatLit) regs[ra].floatVal = regs[rb].floatVal @@ -270,42 +334,73 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcAsgnRef: asgnRef(regs[ra], regs[instr.regB]) of opcWrGlobalRef: - asgnRef(c.globals[instr.regBx-wordExcess-1], regs[ra]) + asgnRef(c.globals.sons[instr.regBx-wordExcess-1], regs[ra]) of opcWrGlobal: asgnComplex(c.globals.sons[instr.regBx-wordExcess-1], regs[ra]) - of opcLdArr: + of opcLdArr, opcLdArrRef: # a = b[c] let rb = instr.regB let rc = instr.regC - let idx = regs[rc].intVal + if regs[rc].intVal > high(int): + stackTrace(c, tos, pc, errIndexOutOfBounds) + let idx = regs[rc].intVal.int # XXX what if the array is not 0-based? -> codegen should insert a sub - regs[ra] = regs[rb].sons[idx.int] + assert regs[rb].kind != nkMetaNode + let src = regs[rb] + if src.kind notin {nkEmpty..nkNilLit} and idx <% src.len: + if instr.opcode == opcLdArrRef and false: + # XXX activate when seqs are fixed + asgnRef(regs[ra], src.sons[idx]) + else: + asgnComplex(regs[ra], src.sons[idx]) + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcLdStrIdx: decodeBC(nkIntLit) - let idx = regs[rc].intVal - regs[ra].intVal = regs[rb].strVal[idx.int].ord + let idx = regs[rc].intVal.int + if idx <=% regs[rb].strVal.len: + regs[ra].intVal = regs[rb].strVal[idx].ord + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcWrArr: # a[b] = c let rb = instr.regB let rc = instr.regC - let idx = regs[rb].intVal - asgnComplex(regs[ra].sons[idx.int], regs[rc]) + let idx = regs[rb].intVal.int + if idx <% regs[ra].len: + asgnComplex(regs[ra].sons[idx], regs[rc]) + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcWrArrRef: let rb = instr.regB let rc = instr.regC - let idx = regs[rb].intVal - asgnRef(regs[ra].sons[idx.int], regs[rc]) + let idx = regs[rb].intVal.int + if idx <% regs[ra].len: + asgnRef(regs[ra].sons[idx], regs[rc]) + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcLdObj: # a = b.c let rb = instr.regB let rc = instr.regC - # XXX this creates a wrong alias - #Message(c.debug[pc], warnUser, $regs[rb].len & " " & $rc) + #Message(c.debug[pc], warnUser, $regs[rb].safeLen & " " & $rc) + asgnComplex(regs[ra], regs[rb].sons[rc]) + of opcLdObjRef: + # a = b.c + let rb = instr.regB + let rc = instr.regC + # XXX activate when seqs are fixed asgnComplex(regs[ra], regs[rb].sons[rc]) + #asgnRef(regs[ra], regs[rb].sons[rc]) of opcWrObj: # a.b = c let rb = instr.regB let rc = instr.regC + #if regs[ra].isNil or regs[ra].sons.isNil or rb >= len(regs[ra]): + # debug regs[ra] + # debug regs[rc] + # echo "RB ", rb + # internalError(c.debug[pc], "argl") asgnComplex(regs[ra].sons[rb], regs[rc]) of opcWrObjRef: let rb = instr.regB @@ -314,7 +409,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcWrStrIdx: decodeBC(nkStrLit) let idx = regs[rb].intVal.int - regs[ra].strVal[idx] = chr(regs[rc].intVal) + if idx <% regs[ra].strVal.len: + regs[ra].strVal[idx] = chr(regs[rc].intVal) + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcAddr: decodeB(nkRefTy) if regs[ra].len == 0: regs[ra].add regs[rb] @@ -325,6 +423,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = if regs[rb].kind == nkNilLit: stackTrace(c, tos, pc, errNilAccess) assert regs[rb].kind == nkRefTy + # XXX this is not correct regs[ra] = regs[rb].sons[0] of opcAddInt: decodeBC(nkIntLit) @@ -341,15 +440,24 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcLenSeq: decodeBImm(nkIntLit) #assert regs[rb].kind == nkBracket - # also used by mNLen - regs[ra].intVal = regs[rb].len - imm + # also used by mNLen: + regs[ra].intVal = regs[rb].skipMeta.len - imm of opcLenStr: decodeBImm(nkIntLit) - assert regs[rb].kind == nkStrLit - regs[ra].intVal = regs[rb].strVal.len - imm + if regs[rb].kind == nkNilLit: + stackTrace(c, tos, pc, errNilAccess) + else: + assert regs[rb].kind in {nkStrLit..nkTripleStrLit} + regs[ra].intVal = regs[rb].strVal.len - imm of opcIncl: decodeB(nkCurly) if not inSet(regs[ra], regs[rb]): addSon(regs[ra], copyTree(regs[rb])) + of opcInclRange: + decodeBC(nkCurly) + var r = newNode(nkRange) + r.add regs[rb] + r.add regs[rc] + addSon(regs[ra], r.copyTree) of opcExcl: decodeB(nkCurly) var b = newNodeIT(nkCurly, regs[rb].info, regs[rb].typ) @@ -440,6 +548,9 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = regs[ra].intVal = ord((regs[rb].kind == nkNilLit and regs[rc].kind == nkNilLit) or regs[rb].sons == regs[rc].sons) + of opcEqNimrodNode: + decodeBC(nkIntLit) + regs[ra].intVal = ord(regs[rb].skipMeta == regs[rc].skipMeta) of opcXor: decodeBC(nkIntLit) regs[ra].intVal = ord(regs[rb].intVal != regs[rc].intVal) @@ -461,24 +572,24 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = regs[ra].intVal = not regs[rb].intVal of opcEqStr: decodeBC(nkIntLit) - regs[ra].intVal = Ord(regs[rb].strVal == regs[rc].strVal) + regs[ra].intVal = ord(regs[rb].strVal == regs[rc].strVal) of opcLeStr: decodeBC(nkIntLit) - regs[ra].intVal = Ord(regs[rb].strVal <= regs[rc].strVal) + regs[ra].intVal = ord(regs[rb].strVal <= regs[rc].strVal) of opcLtStr: decodeBC(nkIntLit) - regs[ra].intVal = Ord(regs[rb].strVal < regs[rc].strVal) + regs[ra].intVal = ord(regs[rb].strVal < regs[rc].strVal) of opcLeSet: decodeBC(nkIntLit) - regs[ra].intVal = Ord(containsSets(regs[rb], regs[rc])) + regs[ra].intVal = ord(containsSets(regs[rb], regs[rc])) of opcEqSet: decodeBC(nkIntLit) - regs[ra].intVal = Ord(equalSets(regs[rb], regs[rc])) + regs[ra].intVal = ord(equalSets(regs[rb], regs[rc])) of opcLtSet: decodeBC(nkIntLit) let a = regs[rb] let b = regs[rc] - regs[ra].intVal = Ord(containsSets(a, b) and not equalSets(a, b)) + regs[ra].intVal = ord(containsSets(a, b) and not equalSets(a, b)) of opcMulSet: decodeBC(nkCurly) move(regs[ra].sons, nimsets.intersectSets(regs[rb], regs[rc]).sons) @@ -488,7 +599,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcMinusSet: decodeBC(nkCurly) move(regs[ra].sons, nimsets.diffSets(regs[rb], regs[rc]).sons) - of opcSymDiffSet: + of opcSymdiffSet: decodeBC(nkCurly) move(regs[ra].sons, nimsets.symdiffSets(regs[rb], regs[rc]).sons) of opcConcatStr: @@ -508,12 +619,12 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcEcho: let rb = instr.regB for i in ra..ra+rb-1: - if regs[i].kind != nkStrLit: debug regs[i] + #if regs[i].kind != nkStrLit: debug regs[i] write(stdout, regs[i].strVal) writeln(stdout, "") of opcContainsSet: decodeBC(nkIntLit) - regs[ra].intVal = Ord(inSet(regs[rb], regs[rc])) + regs[ra].intVal = ord(inSet(regs[rb], regs[rc])) of opcSubStr: decodeBC(nkStrLit) inc pc @@ -533,22 +644,55 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = # dest = call regStart, n; where regStart = fn, arg1, ... let rb = instr.regB let rc = instr.regC - let prc = regs[rb].sym - let newPc = compile(c, prc) - var newFrame = PStackFrame(prc: prc, comesFrom: pc, next: tos) - newSeq(newFrame.slots, prc.position) - if not isEmptyType(prc.typ.sons[0]): - newFrame.slots[0] = getNullValue(prc.typ.sons[0], prc.info) - # pass every parameter by var (the language definition allows this): - for i in 1 .. rc-1: - newFrame.slots[i] = regs[rb+i] - # allocate the temporaries: - for i in rc .. <prc.position: - newFrame.slots[i] = newNode(nkEmpty) - tos = newFrame - move(regs, newFrame.slots) - # -1 for the following 'inc pc' - pc = newPc-1 + let isClosure = regs[rb].kind == nkPar + let prc = if not isClosure: regs[rb].sym else: regs[rb].sons[0].sym + if sfImportc in prc.flags: + if allowFFI notin c.features: + globalError(c.debug[pc], errGenerated, "VM not allowed to do FFI") + # we pass 'tos.slots' instead of 'regs' so that the compiler can keep + # 'regs' in a register: + when hasFFI: + let prcValue = c.globals.sons[prc.position-1] + if prcValue.kind == nkEmpty: + globalError(c.debug[pc], errGenerated, "canot run " & prc.name.s) + let newValue = callForeignFunction(prcValue, prc.typ, tos.slots, + rb+1, rc-1, c.debug[pc]) + if newValue.kind != nkEmpty: + assert instr.opcode == opcIndCallAsgn + asgnRef(regs[ra], newValue) + else: + globalError(c.debug[pc], errGenerated, "VM not built with FFI support") + elif prc.kind != skTemplate: + let newPc = compile(c, prc) + #echo "new pc ", newPc, " calling: ", prc.name.s + var newFrame = PStackFrame(prc: prc, comesFrom: pc, next: tos) + newSeq(newFrame.slots, prc.offset) + if not isEmptyType(prc.typ.sons[0]) or prc.kind == skMacro: + newFrame.slots[0] = getNullValue(prc.typ.sons[0], prc.info) + # pass every parameter by var (the language definition allows this): + for i in 1 .. rc-1: + newFrame.slots[i] = regs[rb+i] + if isClosure: + newFrame.slots[rc] = regs[rb].sons[1] + # allocate the temporaries: + for i in rc+ord(isClosure) .. <prc.offset: + newFrame.slots[i] = newNode(nkEmpty) + tos = newFrame + move(regs, newFrame.slots) + # -1 for the following 'inc pc' + pc = newPc-1 + else: + # for 'getAst' support we need to support template expansion here: + let genSymOwner = if tos.next != nil and tos.next.prc != nil: + tos.next.prc + else: + c.module + var macroCall = newNodeI(nkCall, c.debug[pc]) + macroCall.add(newSymNode(prc)) + for i in 1 .. rc-1: macroCall.add(regs[rb+i].skipMeta) + let a = evalTemplate(macroCall, prc, genSymOwner) + ensureKind(nkMetaNode) + setMeta(regs[ra], a) of opcTJmp: # jump Bx if A != 0 let rbx = instr.regBx - wordExcess - 1 # -1 for the following 'inc pc' @@ -564,18 +708,18 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = let rbx = instr.regBx - wordExcess - 1 # -1 for the following 'inc pc' inc pc, rbx of opcBranch: - # we know the next instruction is a 'jmp': + # we know the next instruction is a 'fjmp': let branch = c.constants[instr.regBx-wordExcess] var cond = false for j in countup(0, sonsLen(branch) - 2): if overlap(regs[ra], branch.sons[j]): cond = true break - assert c.code[pc+1].opcode == opcJmp + assert c.code[pc+1].opcode == opcFJmp inc pc # we skip this instruction so that the final 'inc(pc)' skips # the following jump - if cond: + if not cond: let instr2 = c.code[pc] let rbx = instr2.regBx - wordExcess - 1 # -1 for the following 'inc pc' inc pc, rbx @@ -592,7 +736,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcFinallyEnd: if c.currentExceptionA != nil: # we are in a cleanup run: - pc = cleanupOnException(c, tos, regs)-1 + pc = cleanUpOnException(c, tos, regs)-1 if pc < 0: bailOut(c, tos) return @@ -601,23 +745,24 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = c.currentExceptionA = raised c.exceptionInstr = pc # -1 because of the following 'inc' - pc = cleanupOnException(c, tos, regs) - 1 + pc = cleanUpOnException(c, tos, regs) - 1 if pc < 0: bailOut(c, tos) return of opcNew: let typ = c.types[instr.regBx - wordExcess] regs[ra] = getNullValue(typ, regs[ra].info) + regs[ra].flags.incl nfIsRef of opcNewSeq: let typ = c.types[instr.regBx - wordExcess] inc pc ensureKind(nkBracket) let instr2 = c.code[pc] - let rb = instr2.regA + let count = regs[instr2.regA].intVal.int regs[ra].typ = typ - newSeq(regs[ra].sons, rb) - for i in 0 .. <rb: - regs[ra].sons[i] = getNullValue(typ, regs[ra].info) + newSeq(regs[ra].sons, count) + for i in 0 .. <count: + regs[ra].sons[i] = getNullValue(typ.sons[0], regs[ra].info) of opcNewStr: decodeB(nkStrLit) regs[ra].strVal = newString(regs[rb].intVal.int) @@ -629,7 +774,11 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = let typ = c.types[instr.regBx - wordExcess] regs[ra] = getNullValue(typ, c.debug[pc]) of opcLdConst: - regs[ra] = c.constants.sons[instr.regBx - wordExcess] + let rb = instr.regBx - wordExcess + if regs[ra].isNil: + regs[ra] = copyTree(c.constants.sons[rb]) + else: + moveConst(regs[ra], c.constants.sons[rb]) of opcAsgnConst: let rb = instr.regBx - wordExcess if regs[ra].isNil: @@ -637,67 +786,111 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = else: asgnComplex(regs[ra], c.constants.sons[rb]) of opcLdGlobal: - let rb = instr.regBx - wordExcess + let rb = instr.regBx - wordExcess - 1 if regs[ra].isNil: regs[ra] = copyTree(c.globals.sons[rb]) else: asgnComplex(regs[ra], c.globals.sons[rb]) - of opcRepr, opcSetLenStr, opcSetLenSeq, - opcSwap, opcIsNil, opcOf, - opcCast, opcQuit, opcReset: + of opcRepr: + decodeB(nkStrLit) + regs[ra].strVal = renderTree(regs[rb].skipMeta, {renderNoComments}) + of opcQuit: + if c.mode in {emRepl, emStaticExpr, emStaticStmt}: + message(c.debug[pc], hintQuitCalled) + quit(int(getOrdValue(regs[ra]))) + else: + return nil + of opcSetLenStr: + decodeB(nkStrLit) + regs[ra].strVal.setLen(regs[rb].getOrdValue.int) + of opcOf: + decodeBC(nkIntLit) + let typ = c.types[regs[rc].intVal.int] + regs[ra].intVal = ord(inheritanceDiff(regs[rb].typ, typ) >= 0) + of opcIs: + decodeBC(nkIntLit) + let t1 = regs[rb].typ.skipTypes({tyTypeDesc}) + let t2 = c.types[regs[rc].intVal.int] + # XXX: This should use the standard isOpImpl + let match = if t2.kind == tyUserTypeClass: true + else: sameType(t1, t2) + regs[ra].intVal = ord(match) + of opcSetLenSeq: + decodeB(nkBracket) + let newLen = regs[rb].getOrdValue.int + setLen(regs[ra].sons, newLen) + of opcSwap, opcReset: internalError(c.debug[pc], "too implement") + of opcIsNil: + decodeB(nkIntLit) + regs[ra].intVal = ord(regs[rb].skipMeta.kind == nkNilLit) of opcNBindSym: - # trivial implementation: - let rb = instr.regB - regs[ra] = regs[rb].sons[1] + decodeBx(nkMetaNode) + setMeta(regs[ra], copyTree(c.constants.sons[rbx])) of opcNChild: - let rb = instr.regB - let rc = instr.regC - regs[ra] = regs[rb].sons[regs[rc].intVal.int] + decodeBC(nkMetaNode) + if regs[rb].kind != nkMetaNode: + internalError(c.debug[pc], "no MetaNode") + let idx = regs[rc].intVal.int + let src = regs[rb].uast + if src.kind notin {nkEmpty..nkNilLit} and idx <% src.len: + setMeta(regs[ra], src.sons[idx]) + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcNSetChild: - let rb = instr.regB - let rc = instr.regC - regs[ra].sons[regs[rb].intVal.int] = regs[rc] + decodeBC(nkMetaNode) + let idx = regs[rb].intVal.int + var dest = regs[ra].uast + if dest.kind notin {nkEmpty..nkNilLit} and idx <% dest.len: + dest.sons[idx] = regs[rc].uast + else: + stackTrace(c, tos, pc, errIndexOutOfBounds) of opcNAdd: - declBC() - regs[rb].add(regs[rb]) - regs[ra] = regs[rb] + decodeBC(nkMetaNode) + var u = regs[rb].uast + u.add(regs[rc].uast) + setMeta(regs[ra], u) of opcNAddMultiple: - declBC() + decodeBC(nkMetaNode) let x = regs[rc] + var u = regs[rb].uast # XXX can be optimized: - for i in 0.. <x.len: regs[rb].add(x.sons[i]) - regs[ra] = regs[rb] + for i in 0.. <x.len: u.add(x.sons[i].skipMeta) + setMeta(regs[ra], u) of opcNKind: decodeB(nkIntLit) - regs[ra].intVal = ord(regs[rb].kind) + regs[ra].intVal = ord(regs[rb].uast.kind) of opcNIntVal: decodeB(nkIntLit) - let a = regs[rb] + let a = regs[rb].uast case a.kind of nkCharLit..nkInt64Lit: regs[ra].intVal = a.intVal else: stackTrace(c, tos, pc, errFieldXNotFound, "intVal") of opcNFloatVal: decodeB(nkFloatLit) - let a = regs[rb] + let a = regs[rb].uast case a.kind of nkFloatLit..nkFloat64Lit: regs[ra].floatVal = a.floatVal else: stackTrace(c, tos, pc, errFieldXNotFound, "floatVal") of opcNSymbol: - let rb = instr.regB - if regs[rb].kind != nkSym: + decodeB(nkSym) + let a = regs[rb].uast + if a.kind == nkSym: + regs[ra].sym = a.sym + else: stackTrace(c, tos, pc, errFieldXNotFound, "symbol") - regs[ra] = regs[rb] of opcNIdent: - let rb = instr.regB - if regs[rb].kind != nkIdent: + decodeB(nkIdent) + let a = regs[rb].uast + if a.kind == nkIdent: + regs[ra].ident = a.ident + else: stackTrace(c, tos, pc, errFieldXNotFound, "ident") - regs[ra] = regs[rb] of opcNGetType: - InternalError(c.debug[pc], "unknown opcode " & $instr.opcode) + internalError(c.debug[pc], "unknown opcode " & $instr.opcode) of opcNStrVal: decodeB(nkStrLit) - let a = regs[rb] + let a = regs[rb].uast case a.kind of nkStrLit..nkTripleStrLit: regs[ra].strVal = a.strVal else: stackTrace(c, tos, pc, errFieldXNotFound, "strVal") @@ -710,29 +903,30 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = of opcNError: stackTrace(c, tos, pc, errUser, regs[ra].strVal) of opcNWarning: - Message(c.debug[pc], warnUser, regs[ra].strVal) + message(c.debug[pc], warnUser, regs[ra].strVal) of opcNHint: - Message(c.debug[pc], hintUser, regs[ra].strVal) + message(c.debug[pc], hintUser, regs[ra].strVal) of opcParseExprToAst: - let rb = instr.regB + decodeB(nkMetaNode) # c.debug[pc].line.int - countLines(regs[rb].strVal) ? let ast = parseString(regs[rb].strVal, c.debug[pc].toFilename, c.debug[pc].line.int) if sonsLen(ast) != 1: - GlobalError(c.debug[pc], errExprExpected, "multiple statements") - regs[ra] = ast.sons[0] + globalError(c.debug[pc], errExprExpected, "multiple statements") + setMeta(regs[ra], ast.sons[0]) of opcParseStmtToAst: - let rb = instr.regB + decodeB(nkMetaNode) let ast = parseString(regs[rb].strVal, c.debug[pc].toFilename, c.debug[pc].line.int) - regs[ra] = ast + setMeta(regs[ra], ast) of opcCallSite: - if c.callsite != nil: regs[ra] = c.callsite + ensureKind(nkMetaNode) + if c.callsite != nil: setMeta(regs[ra], c.callsite) else: stackTrace(c, tos, pc, errFieldXNotFound, "callsite") of opcNLineInfo: - let rb = instr.regB + decodeB(nkStrLit) let n = regs[rb] - regs[ra] = newStrNode(nkStrLit, n.info.toFileLineCol) + regs[ra].strVal = n.info.toFileLineCol regs[ra].info = c.debug[pc] of opcEqIdent: decodeBC(nkIntLit) @@ -741,16 +935,16 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = else: regs[ra].intVal = 0 of opcStrToIdent: - let rb = instr.regB + decodeB(nkIdent) if regs[rb].kind notin {nkStrLit..nkTripleStrLit}: stackTrace(c, tos, pc, errFieldXNotFound, "strVal") else: - regs[ra] = newNodeI(nkIdent, c.debug[pc]) + regs[ra].info = c.debug[pc] regs[ra].ident = getIdent(regs[rb].strVal) of opcIdentToStr: - let rb = instr.regB + decodeB(nkStrLit) let a = regs[rb] - regs[ra] = newNodeI(nkStrLit, c.debug[pc]) + regs[ra].info = c.debug[pc] if a.kind == nkSym: regs[ra].strVal = a.sym.name.s elif a.kind == nkIdent: @@ -767,86 +961,124 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame) = stackTrace(c, tos, pc, errGenerated, msgKindToString(errIllegalConvFromXtoY) % [ "unknown type" , "unknown type"]) - of opcNSetIntVal: + of opcCast: let rb = instr.regB - if regs[ra].kind in {nkCharLit..nkInt64Lit} and + inc pc + let typ = c.types[c.code[pc].regBx - wordExcess] + when hasFFI: + let dest = fficast(regs[rb], typ) + asgnRef(regs[ra], dest) + else: + globalError(c.debug[pc], "cannot evaluate cast") + of opcNSetIntVal: + decodeB(nkMetaNode) + var dest = regs[ra].uast + if dest.kind in {nkCharLit..nkInt64Lit} and regs[rb].kind in {nkCharLit..nkInt64Lit}: - regs[ra].intVal = regs[rb].intVal - else: + dest.intVal = regs[rb].intVal + else: stackTrace(c, tos, pc, errFieldXNotFound, "intVal") of opcNSetFloatVal: - let rb = instr.regB - if regs[ra].kind in {nkFloatLit..nkFloat64Lit} and + decodeB(nkMetaNode) + var dest = regs[ra].uast + if dest.kind in {nkFloatLit..nkFloat64Lit} and regs[rb].kind in {nkFloatLit..nkFloat64Lit}: - regs[ra].floatVal = regs[rb].floatVal + dest.floatVal = regs[rb].floatVal else: stackTrace(c, tos, pc, errFieldXNotFound, "floatVal") of opcNSetSymbol: - let rb = instr.regB - if regs[ra].kind == nkSym and regs[rb].kind == nkSym: - regs[ra].sym = regs[rb].sym + decodeB(nkMetaNode) + var dest = regs[ra].uast + if dest.kind == nkSym and regs[rb].kind == nkSym: + dest.sym = regs[rb].sym else: stackTrace(c, tos, pc, errFieldXNotFound, "symbol") of opcNSetIdent: - let rb = instr.regB - if regs[ra].kind == nkIdent and regs[rb].kind == nkIdent: - regs[ra].ident = regs[rb].ident + decodeB(nkMetaNode) + var dest = regs[ra].uast + if dest.kind == nkIdent and regs[rb].kind == nkIdent: + dest.ident = regs[rb].ident else: stackTrace(c, tos, pc, errFieldXNotFound, "ident") of opcNSetType: - let b = regs[instr.regB] - InternalAssert b.kind == nkSym and b.sym.kind == skType - regs[ra].typ = b.sym.typ + decodeB(nkMetaNode) + let b = regs[rb].skipMeta + internalAssert b.kind == nkSym and b.sym.kind == skType + regs[ra].uast.typ = b.sym.typ of opcNSetStrVal: - let rb = instr.regB - if regs[ra].kind in {nkStrLit..nkTripleStrLit} and + decodeB(nkMetaNode) + var dest = regs[ra].uast + if dest.kind in {nkStrLit..nkTripleStrLit} and regs[rb].kind in {nkStrLit..nkTripleStrLit}: - regs[ra].strVal = regs[rb].strVal + dest.strVal = regs[rb].strVal else: stackTrace(c, tos, pc, errFieldXNotFound, "strVal") of opcNNewNimNode: - let rb = instr.regB - let rc = instr.regC + decodeBC(nkMetaNode) var k = regs[rb].intVal - if k < 0 or k > ord(high(TNodeKind)): + if k < 0 or k > ord(high(TNodeKind)) or k == ord(nkMetaNode): internalError(c.debug[pc], - "request to create a NimNode with invalid kind") - regs[ra] = newNodeI(TNodeKind(int(k)), - if regs[rc].kind == nkNilLit: c.debug[pc] else: regs[rc].info) + "request to create a NimNode of invalid kind") + let cc = regs[rc].skipMeta + setMeta(regs[ra], newNodeI(TNodeKind(int(k)), + if cc.kind == nkNilLit: c.debug[pc] else: cc.info)) + regs[ra].sons[0].flags.incl nfIsRef of opcNCopyNimNode: - let rb = instr.regB - regs[ra] = copyNode(regs[rb]) + decodeB(nkMetaNode) + setMeta(regs[ra], copyNode(regs[rb])) of opcNCopyNimTree: - let rb = instr.regB - regs[ra] = copyTree(regs[rb]) + decodeB(nkMetaNode) + setMeta(regs[ra], copyTree(regs[rb])) of opcNDel: - let rb = instr.regB - let rc = instr.regC + decodeBC(nkMetaNode) + let bb = regs[rb].intVal.int for i in countup(0, regs[rc].intVal.int-1): - delSon(regs[ra], regs[rb].intVal.int) + delSon(regs[ra].uast, bb) of opcGenSym: - let k = regs[instr.regB].intVal - let b = regs[instr.regC] - let name = if b.strVal.len == 0: ":tmp" else: b.strVal + decodeBC(nkMetaNode) + let k = regs[rb].intVal + let name = if regs[rc].strVal.len == 0: ":tmp" else: regs[rc].strVal if k < 0 or k > ord(high(TSymKind)): internalError(c.debug[pc], "request to create symbol of invalid kind") - regs[ra] = newSymNode(newSym(k.TSymKind, name.getIdent, c.module, - c.debug[pc])) - incl(regs[ra].sym.flags, sfGenSym) + var sym = newSym(k.TSymKind, name.getIdent, c.module, c.debug[pc]) + incl(sym.flags, sfGenSym) + setMeta(regs[ra], newSymNode(sym)) of opcTypeTrait: # XXX only supports 'name' for now; we can use regC to encode the # type trait operation decodeB(nkStrLit) - let typ = regs[rb].sym.typ.skipTypes({tyTypeDesc}) + var typ = regs[rb].typ + internalAssert typ != nil + while typ.kind == tyTypeDesc and typ.len > 0: typ = typ.sons[0] regs[ra].strVal = typ.typeToString(preferExported) + of opcGlobalOnce: + let rb = instr.regBx + if c.globals.sons[rb - wordExcess - 1].kind != nkEmpty: + # skip initialization instructions: + while true: + inc pc + if c.code[pc].opcode in {opcWrGlobal, opcWrGlobalRef} and + c.code[pc].regBx == rb: + break + of opcGlobalAlias: + let rb = instr.regBx - wordExcess - 1 + regs[ra] = c.globals.sons[rb] inc pc -proc execute(c: PCtx, start: int) = +proc fixType(result, n: PNode) {.inline.} = + # XXX do it deeply for complex values; there seems to be no simple + # solution except to check it deeply here. + #if result.typ.isNil: result.typ = n.typ + discard + +proc execute(c: PCtx, start: int): PNode = var tos = PStackFrame(prc: nil, comesFrom: 0, next: nil) newSeq(tos.slots, c.prc.maxSlots) - rawExecute(c, start, tos) + for i in 0 .. <c.prc.maxSlots: tos.slots[i] = newNode(nkEmpty) + result = rawExecute(c, start, tos) proc evalStmt*(c: PCtx, n: PNode) = + let n = transformExpr(c.module, n) let start = genStmt(c, n) # execute new instructions; this redundant opcEof check saves us lots # of allocations in 'execute': @@ -854,15 +1086,34 @@ proc evalStmt*(c: PCtx, n: PNode) = discard execute(c, start) proc evalExpr*(c: PCtx, n: PNode): PNode = + let n = transformExpr(c.module, n) let start = genExpr(c, n) assert c.code[start].opcode != opcEof result = execute(c, start) + if not result.isNil: + result = result.skipMeta + fixType(result, n) + +# for now we share the 'globals' environment. XXX Coming soon: An API for +# storing&loading the 'globals' environment to get what a component system +# requires. +var + globalCtx: PCtx + +proc setupGlobalCtx(module: PSym) = + if globalCtx.isNil: globalCtx = newCtx(module) + else: refresh(globalCtx, module) proc myOpen(module: PSym): PPassContext = #var c = newEvalContext(module, emRepl) #c.features = {allowCast, allowFFI, allowInfiniteLoops} #pushStackFrame(c, newStackFrame()) - result = newCtx(module) + + # XXX produce a new 'globals' environment here: + setupGlobalCtx(module) + result = globalCtx + when hasFFI: + globalCtx.features = {allowFFI, allowCast} var oldErrorCount: int @@ -875,50 +1126,72 @@ proc myProcess(c: PPassContext, n: PNode): PNode = result = n oldErrorCount = msgs.gErrorCounter -const vmPass* = makePass(myOpen, nil, myProcess, myProcess) +const evalPass* = makePass(myOpen, nil, myProcess, myProcess) -proc evalConstExprAux(module, prc: PSym, e: PNode, mode: TEvalMode): PNode = - var p = newCtx(module) - var s = newStackFrame() - s.call = e - s.prc = prc - pushStackFrame(p, s) - result = tryEval(p, e) - if result != nil and result.kind == nkExceptBranch: result = nil - popStackFrame(p) +proc evalConstExprAux(module, prc: PSym, n: PNode, mode: TEvalMode): PNode = + let n = transformExpr(module, n) + setupGlobalCtx(module) + var c = globalCtx + c.mode = mode + let start = genExpr(c, n, requiresValue = mode!=emStaticStmt) + if c.code[start].opcode == opcEof: return emptyNode + assert c.code[start].opcode != opcEof + var tos = PStackFrame(prc: prc, comesFrom: 0, next: nil) + newSeq(tos.slots, c.prc.maxSlots) + for i in 0 .. <c.prc.maxSlots: tos.slots[i] = newNode(nkEmpty) + result = rawExecute(c, start, tos) + fixType(result, n) proc evalConstExpr*(module: PSym, e: PNode): PNode = result = evalConstExprAux(module, nil, e, emConst) -proc evalStaticExpr*(module: PSym, e: PNode, prc: PSym): PNode = - result = evalConstExprAux(module, prc, e, emStatic) +proc evalStaticExpr*(module: PSym, e: PNode, prc: PSym): PNode = + result = evalConstExprAux(module, prc, e, emStaticExpr) + +proc evalStaticStmt*(module: PSym, e: PNode, prc: PSym) = + discard evalConstExprAux(module, prc, e, emStaticStmt) proc setupMacroParam(x: PNode): PNode = result = x if result.kind in {nkHiddenSubConv, nkHiddenStdConv}: result = result.sons[1] + let y = result + y.flags.incl nfIsRef + result = newNode(nkMetaNode) + result.add y + result.typ = x.typ -proc evalMacroCall(c: PEvalContext, n, nOrig: PNode, sym: PSym): PNode = +var evalMacroCounter: int + +proc evalMacroCall*(module: PSym, n, nOrig: PNode, sym: PSym): PNode = # XXX GlobalError() is ugly here, but I don't know a better solution for now - inc(evalTemplateCounter) - if evalTemplateCounter > 100: - GlobalError(n.info, errTemplateInstantiationTooNested) + inc(evalMacroCounter) + if evalMacroCounter > 100: + globalError(n.info, errTemplateInstantiationTooNested) + setupGlobalCtx(module) + var c = globalCtx c.callsite = nOrig - let body = optBody(c, sym) - let start = genStmt(c, body) + let start = genProc(c, sym) var tos = PStackFrame(prc: sym, comesFrom: 0, next: nil) - newSeq(tos.slots, c.prc.maxSlots) + let maxSlots = sym.offset + newSeq(tos.slots, maxSlots) # setup arguments: var L = n.safeLen if L == 0: L = 1 - InternalAssert tos.slots.len >= L + # This is wrong for tests/reject/tind1.nim where the passed 'else' part + # doesn't end up in the parameter: + #InternalAssert tos.slots.len >= L # return value: - tos.slots[0] = newNodeIT(nkNilLit, n.info, sym.typ.sons[0]) + tos.slots[0] = newNodeIT(nkEmpty, n.info, sym.typ.sons[0]) # setup parameters: - for i in 1 .. < L: tos.slots[i] = setupMacroParam(n.sons[i]) - rawExecute(c, start, tos) - result = tos.slots[0] - if cyclicTree(result): GlobalError(n.info, errCyclicTree) - dec(evalTemplateCounter) + for i in 1 .. < min(tos.slots.len, L): + tos.slots[i] = setupMacroParam(n.sons[i]) + # temporary storage: + for i in L .. <maxSlots: tos.slots[i] = newNode(nkEmpty) + result = rawExecute(c, start, tos) + if cyclicTree(result): globalError(n.info, errCyclicTree) + dec(evalMacroCounter) + if result != nil: + result = result.skipMeta c.callsite = nil diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index d4b3d891d..87159c813 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -34,9 +34,11 @@ type opcAsgnComplex, opcLdArr, # a = b[c] + opcLdArrRef, opcWrArr, # a[b] = c opcWrArrRef, opcLdObj, # a = b.c + opcLdObjRef, opcWrObj, # a.b = c opcWrObjRef, opcAddr, @@ -51,16 +53,16 @@ type opcLenSeq, opcLenStr, - opcIncl, opcExcl, opcCard, opcMulInt, opcDivInt, opcModInt, + opcIncl, opcInclRange, opcExcl, opcCard, opcMulInt, opcDivInt, opcModInt, opcAddFloat, opcSubFloat, opcMulFloat, opcDivFloat, opcShrInt, opcShlInt, opcBitandInt, opcBitorInt, opcBitxorInt, opcAddu, opcSubu, opcMulu, opcDivu, opcModu, opcEqInt, opcLeInt, opcLtInt, opcEqFloat, - opcLeFloat, opcLtFloat, opcLeu, opcLtu, opcEqRef, opcXor, + opcLeFloat, opcLtFloat, opcLeu, opcLtu, opcEqRef, opcEqNimrodNode, opcXor, opcNot, opcUnaryMinusInt, opcUnaryMinusFloat, opcBitnotInt, opcEqStr, opcLeStr, opcLtStr, opcEqSet, opcLeSet, opcLtSet, opcMulSet, opcPlusSet, opcMinusSet, opcSymdiffSet, opcConcatStr, opcContainsSet, opcRepr, opcSetLenStr, opcSetLenSeq, - opcSwap, opcIsNil, opcOf, + opcSwap, opcIsNil, opcOf, opcIs, opcSubStr, opcConv, opcCast, opcQuit, opcReset, opcAddStrCh, @@ -101,7 +103,6 @@ type opcRaise, opcNChild, opcNSetChild, - opcNBindSym, # opcodes for the AST manipulation following opcCallSite, opcNewStr, @@ -120,8 +121,11 @@ type opcAsgnConst, # dest = copy(constants[Bx]) opcLdGlobal, # dest = globals[Bx] opcLdImmInt, # dest = immediate value + opcNBindSym, opcWrGlobal, opcWrGlobalRef, + opcGlobalAlias, # load an alias to a global into a register + opcGlobalOnce, # used to introduce an assignment to a global once opcSetType, # dest.typ = types[Bx] opcTypeTrait @@ -129,6 +133,21 @@ type label*: PSym fixups*: seq[TPosition] + TEvalMode* = enum ## reason for evaluation + emRepl, ## evaluate because in REPL mode + emConst, ## evaluate for 'const' according to spec + emOptimize, ## evaluate for optimization purposes (same as + ## emConst?) + emStaticExpr, ## evaluate for enforced compile time eval + ## ('static' context) + emStaticStmt ## 'static' as an expression + + TSandboxFlag* = enum ## what the evaluation engine should allow + allowCast, ## allow unsafe language feature: 'cast' + allowFFI, ## allow the FFI + allowInfiniteLoops ## allow endless loops + TSandboxFlags* = set[TSandboxFlag] + TSlotKind* = enum # We try to re-use slots in a smart way to # minimize allocations; however the VM supports arbitrary # temporary slot usage. This is required for the parameter @@ -146,6 +165,8 @@ type blocks*: seq[TBlock] # blocks; temp data structure slots*: array[TRegister, tuple[inUse: bool, kind: TSlotKind]] maxSlots*: int + globals*: array[TRegister, int] # hack: to support passing globals byref + # we map a slot persistently to a global PCtx* = ref TCtx TCtx* = object of passes.TPassContext # code gen context @@ -160,21 +181,26 @@ type prc*: PProc module*: PSym callsite*: PNode + mode*: TEvalMode + features*: TSandboxFlags TPosition* = distinct int PEvalContext* = PCtx - proc newCtx*(module: PSym): PCtx = PCtx(code: @[], debug: @[], - globals: newNode(nkStmtList), constants: newNode(nkStmtList), types: @[], + globals: newNode(nkStmtListExpr), constants: newNode(nkStmtList), types: @[], prc: PProc(blocks: @[]), module: module) +proc refresh*(c: PCtx, module: PSym) = + c.module = module + c.prc = PProc(blocks: @[]) + const firstABxInstr* = opcTJmp largeInstrs* = { # instructions which use 2 int32s instead of 1: - opcSubstr, opcConv, opcCast, opcNewSeq, opcOf} + opcSubStr, opcConv, opcCast, opcNewSeq, opcOf} slotSomeTemp* = slotTempUnknown relativeJumps* = {opcTJmp, opcFJmp, opcJmp} @@ -183,3 +209,5 @@ template regA*(x: TInstr): TRegister {.immediate.} = TRegister(x.uint32 shr 8'u3 template regB*(x: TInstr): TRegister {.immediate.} = TRegister(x.uint32 shr 16'u32 and 0xff'u32) template regC*(x: TInstr): TRegister {.immediate.} = TRegister(x.uint32 shr 24'u32) template regBx*(x: TInstr): int {.immediate.} = (x.uint32 shr 16'u32).int + +template jmpDiff*(x: TInstr): int {.immediate.} = regBx(x) - wordExcess diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 2a40276d1..0e01f5031 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -25,69 +25,12 @@ proc opGorge*(cmd, input: string): string = proc opSlurp*(file: string, info: TLineInfo, module: PSym): string = try: - let filename = file.FindFile + let filename = file.findFile result = readFile(filename) # we produce a fake include statement for every slurped filename, so that # the module dependencies are accurate: appendToModule(module, newNode(nkIncludeStmt, info, @[ newStrNode(nkStrLit, filename)])) except EIO: + localError(info, errCannotOpenFile, file) result = "" - LocalError(info, errCannotOpenFile, file) - -when false: - proc opExpandToAst*(c: PEvalContext, original: PNode): PNode = - var - n = original.copyTree - macroCall = n.sons[1] - expandedSym = macroCall.sons[0].sym - - for i in countup(1, macroCall.sonsLen - 1): - macroCall.sons[i] = evalAux(c, macroCall.sons[i], {}) - - case expandedSym.kind - of skTemplate: - let genSymOwner = if c.tos != nil and c.tos.prc != nil: - c.tos.prc - else: - c.module - result = evalTemplate(macroCall, expandedSym, genSymOwner) - of skMacro: - # At this point macroCall.sons[0] is nkSym node. - # To be completely compatible with normal macro invocation, - # we want to replace it with nkIdent node featuring - # the original unmangled macro name. - macroCall.sons[0] = newIdentNode(expandedSym.name, expandedSym.info) - result = evalMacroCall(c, macroCall, original, expandedSym) - else: - InternalError(macroCall.info, - "ExpandToAst: expanded symbol is no macro or template") - result = emptyNode - - proc opIs*(n: PNode): PNode = - InternalAssert n.sonsLen == 3 and - n[1].kind == nkSym and n[1].sym.kind == skType and - n[2].kind in {nkStrLit..nkTripleStrLit, nkType} - - let t1 = n[1].sym.typ - - if n[2].kind in {nkStrLit..nkTripleStrLit}: - case n[2].strVal.normalize - of "closure": - let t = skipTypes(t1, abstractRange) - result = newIntNode(nkIntLit, ord(t.kind == tyProc and - t.callConv == ccClosure and - tfIterator notin t.flags)) - of "iterator": - let t = skipTypes(t1, abstractRange) - result = newIntNode(nkIntLit, ord(t.kind == tyProc and - t.callConv == ccClosure and - tfIterator in t.flags)) - else: - let t2 = n[2].typ - var match = if t2.kind == tyTypeClass: matchTypeClass(t2, t1) - else: sameType(t1, t2) - result = newIntNode(nkIntLit, ord(match)) - - result.typ = n.typ - diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 84d82e117..d0e8dacf3 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -11,19 +11,31 @@ import unsigned, strutils, ast, astalgo, types, msgs, renderer, vmdef, - trees, intsets, rodread, magicsys + trees, intsets, rodread, magicsys, options -proc codeListing(c: PCtx, result: var string) = +from os import splitFile + +when hasFFI: + import evalffi + +type + TGenFlag = enum gfNone, gfAddrOf + TGenFlags = set[TGenFlag] + +proc debugInfo(info: TLineInfo): string = + result = info.toFilename.splitFile.name & ":" & $info.line + +proc codeListing(c: PCtx, result: var string, start=0) = # first iteration: compute all necessary labels: var jumpTargets = initIntSet() - for i in 0.. < c.code.len: + for i in start.. < c.code.len: let x = c.code[i] if x.opcode in relativeJumps: jumpTargets.incl(i+x.regBx-wordExcess) # for debugging purposes - var i = 0 + var i = start while i < c.code.len: if i in jumpTargets: result.addf("L$1:\n", i) let x = c.code[i] @@ -41,13 +53,13 @@ proc codeListing(c: PCtx, result: var string) = else: result.addf("\t$#\tr$#, $#", ($opc).substr(3), x.regA, x.regBx-wordExcess) result.add("\t#") - result.add(toFileLine(c.debug[i])) + result.add(debugInfo(c.debug[i])) result.add("\n") inc i -proc echoCode*(c: PCtx) = +proc echoCode*(c: PCtx, start=0) {.deprecated.} = var buf = "" - codeListing(c, buf) + codeListing(c, buf, start) echo buf proc gABC(ctx: PCtx; n: PNode; opc: TOpcode; a, b, c: TRegister = 0) = @@ -58,7 +70,7 @@ proc gABC(ctx: PCtx; n: PNode; opc: TOpcode; a, b, c: TRegister = 0) = ctx.code.add(ins) ctx.debug.add(n.info) -proc gABI(c: PCtx; n: PNode; opc: TOpcode; a, b: TRegister; imm: biggestInt) = +proc gABI(c: PCtx; n: PNode; opc: TOpcode; a, b: TRegister; imm: BiggestInt) = let ins = (opc.uint32 or (a.uint32 shl 8'u32) or (b.uint32 shl 16'u32) or (imm+byteExcess).uint32 shl 24'u32).TInstr @@ -82,7 +94,7 @@ proc genLabel(c: PCtx): TPosition = proc jmpBack(c: PCtx, n: PNode, opc: TOpcode, p = TPosition(0)) = let dist = p.int - c.code.len - InternalAssert(-0x7fff < dist and dist < 0x7fff) + internalAssert(-0x7fff < dist and dist < 0x7fff) gABx(c, n, opc, 0, dist) proc patch(c: PCtx, p: TPosition) = @@ -90,14 +102,14 @@ proc patch(c: PCtx, p: TPosition) = let p = p.int let diff = c.code.len - p #c.jumpTargets.incl(c.code.len) - InternalAssert(-0x7fff < diff and diff < 0x7fff) + internalAssert(-0x7fff < diff and diff < 0x7fff) let oldInstr = c.code[p] # opcode and regA stay the same: c.code[p] = ((oldInstr.uint32 and 0xffff'u32).uint32 or uint32(diff+wordExcess) shl 16'u32).TInstr proc getSlotKind(t: PType): TSlotKind = - case t.skipTypes(abstractRange).kind + case t.skipTypes(abstractRange-{tyTypeDesc}).kind of tyBool, tyChar, tyEnum, tyOrdinal, tyInt..tyInt64, tyUInt..tyUInt64: slotTempInt of tyString, tyCString: @@ -112,8 +124,10 @@ const proc getTemp(c: PCtx; typ: PType): TRegister = let c = c.prc - # we prefer the same slot kind here for efficiency: - let k = typ.getSlotKind + # we prefer the same slot kind here for efficiency. Unfortunately for + # discardable return types we may not know the desired type. This can happen + # for e.g. mNAdd[Multiple]: + let k = if typ.isNil: slotTempComplex else: typ.getSlotKind for i in 0 .. c.maxSlots-1: if c.slots[i].kind == k and not c.slots[i].inUse: c.slots[i].inUse = true @@ -129,6 +143,21 @@ proc getTemp(c: PCtx; typ: PType): TRegister = c.slots[c.maxSlots] = (inUse: true, kind: k) inc c.maxSlots +proc getGlobalSlot(c: PCtx; n: PNode; s: PSym): TRegister = + let p = c.prc + for i in 0 .. p.maxSlots-1: + if p.globals[i] == s.id: return TRegister(i) + + result = TRegister(p.maxSlots) + p.slots[p.maxSlots] = (inUse: true, kind: slotFixedVar) + p.globals[p.maxSlots] = s.id + inc p.maxSlots + # XXX this is still not correct! We need to load the global in a proc init + # section, otherwise control flow could lead to a usage before it's been + # loaded. + c.gABx(n, opcGlobalAlias, result, s.position) + # XXX add some internal asserts here + proc freeTemp(c: PCtx; r: TRegister) = let c = c.prc if c.slots[r].kind >= slotSomeTemp: c.slots[r].inUse = false @@ -146,7 +175,7 @@ proc getTempRange(c: PCtx; n: int; kind: TSlotKind): TRegister = for k in result .. result+n-1: c.slots[k] = (inUse: true, kind: kind) return if c.maxSlots+n >= high(TRegister): - InternalError("cannot generate code; too many registers required") + internalError("cannot generate code; too many registers required") result = TRegister(c.maxSlots) inc c.maxSlots, n for k in result .. result+n-1: c.slots[k] = (inUse: true, kind: kind) @@ -170,22 +199,28 @@ template withBlock(labl: PSym; body: stmt) {.immediate, dirty.} = body popBlock(c, oldLen) -proc gen(c: PCtx; n: PNode; dest: var TDest) -proc gen(c: PCtx; n: PNode; dest: TRegister) = +proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) +proc gen(c: PCtx; n: PNode; dest: TRegister; flags: TGenFlags = {}) = var d: TDest = dest - gen(c, n, d) - InternalAssert d == dest + gen(c, n, d, flags) + internalAssert d == dest -proc gen(c: PCtx; n: PNode) = +proc gen(c: PCtx; n: PNode; flags: TGenFlags = {}) = var tmp: TDest = -1 - gen(c, n, tmp) - InternalAssert tmp < 0 + gen(c, n, tmp, flags) + #if n.typ.isEmptyType: InternalAssert tmp < 0 -proc genx(c: PCtx; n: PNode): TRegister = +proc genx(c: PCtx; n: PNode; flags: TGenFlags = {}): TRegister = var tmp: TDest = -1 - gen(c, n, tmp) + gen(c, n, tmp, flags) + internalAssert tmp >= 0 result = TRegister(tmp) +proc clearDest(n: PNode; dest: var TDest) {.inline.} = + # stmt is different from 'void' in meta programming contexts. + # So we only set dest to -1 if 'void': + if n.typ.isNil or n.typ.kind == tyEmpty: dest = -1 + proc isNotOpr(n: PNode): bool = n.kind in nkCallKinds and n.sons[0].kind == nkSym and n.sons[0].sym.magic == mNot @@ -224,6 +259,7 @@ proc genWhile(c: PCtx; n: PNode) = proc genBlock(c: PCtx; n: PNode; dest: var TDest) = withBlock(n.sons[0].sym): c.gen(n.sons[1], dest) + clearDest(n, dest) proc genBreak(c: PCtx; n: PNode) = let L1 = c.xjmp(n, opcJmp) @@ -233,7 +269,7 @@ proc genBreak(c: PCtx; n: PNode) = if c.prc.blocks[i].label == n.sons[0].sym: c.prc.blocks[i].fixups.add L1 return - InternalError(n.info, "cannot find 'break' target") + internalError(n.info, "cannot find 'break' target") else: c.prc.blocks[c.prc.blocks.high].fixups.add L1 @@ -268,6 +304,7 @@ proc genIf(c: PCtx, n: PNode; dest: var TDest) = else: c.gen(it.sons[0], dest) for endPos in endings: c.patch(endPos) + clearDest(n, dest) proc genAndOr(c: PCtx; n: PNode; opc: TOpcode; dest: var TDest) = # asgn dest, a @@ -275,15 +312,15 @@ proc genAndOr(c: PCtx; n: PNode; opc: TOpcode; dest: var TDest) = # asgn dest, b # L1: if dest < 0: dest = getTemp(c, n.typ) - c.gen(n.sons[0], dest) - let L1 = c.xjmp(n, opc) c.gen(n.sons[1], dest) + let L1 = c.xjmp(n, opc, dest) + c.gen(n.sons[2], dest) c.patch(L1) proc rawGenLiteral(c: PCtx; n: PNode): int = result = c.constants.len c.constants.add n - InternalAssert result < 0x7fff + internalAssert result < 0x7fff proc sameConstant*(a, b: PNode): bool = result = false @@ -296,7 +333,8 @@ proc sameConstant*(a, b: PNode): bool = of nkCharLit..nkInt64Lit: result = a.intVal == b.intVal of nkFloatLit..nkFloat64Lit: result = a.floatVal == b.floatVal of nkStrLit..nkTripleStrLit: result = a.strVal == b.strVal - of nkEmpty, nkNilLit, nkType: result = true + of nkType: result = a.typ == b.typ + of nkEmpty, nkNilLit: result = true else: if sonsLen(a) == sonsLen(b): for i in countup(0, sonsLen(a) - 1): @@ -309,6 +347,11 @@ proc genLiteral(c: PCtx; n: PNode): int = if sameConstant(c.constants[i], n): return i result = rawGenLiteral(c, n) +proc unused(n: PNode; x: TDest) {.inline.} = + if x >= 0: + #debug(n) + internalError(n.info, "not unused") + proc genCase(c: PCtx; n: PNode; dest: var TDest) = # if (!expr1) goto L1; # thenPart @@ -320,7 +363,10 @@ proc genCase(c: PCtx; n: PNode; dest: var TDest) = # L2: # elsePart # Lend: - if dest < 0 and not isEmptyType(n.typ): dest = getTemp(c, n.typ) + if not isEmptyType(n.typ): + if dest < 0: dest = getTemp(c, n.typ) + else: + unused(n, dest) var endings: seq[TPosition] = @[] withTemp(tmp, n.sons[0].typ): c.gen(n.sons[0], tmp) @@ -340,6 +386,7 @@ proc genCase(c: PCtx; n: PNode; dest: var TDest) = endings.add(c.xjmp(it.lastSon, opcJmp, 0)) c.patch(elsePos) for endPos in endings: c.patch(endPos) + clearDest(n, dest) proc genType(c: PCtx; typ: PType): int = for i, t in c.types: @@ -362,7 +409,7 @@ proc genTry(c: PCtx; n: PNode; dest: var TDest) = let endExcept = c.xjmp(it, opcExcept, 0) for j in countup(0, blen - 2): assert(it.sons[j].kind == nkType) - let typ = it.sons[j].typ.skipTypes(abstractPtrs) + let typ = it.sons[j].typ.skipTypes(abstractPtrs-{tyTypeDesc}) c.gABx(it, opcExcept, 0, c.genType(typ)) if blen == 1: # general except section: @@ -379,6 +426,7 @@ proc genTry(c: PCtx; n: PNode; dest: var TDest) = if fin.kind == nkFinally: c.gen(fin.sons[0], dest) c.gABx(fin, opcFinallyEnd, 0, 0) + clearDest(n, dest) proc genRaise(c: PCtx; n: PNode) = let dest = genx(c, n.sons[0]) @@ -393,30 +441,58 @@ proc genReturn(c: PCtx; n: PNode) = proc genCall(c: PCtx; n: PNode; dest: var TDest) = if dest < 0 and not isEmptyType(n.typ): dest = getTemp(c, n.typ) let x = c.getTempRange(n.len, slotTempUnknown) - for i in 0.. <n.len: + # varargs need 'opcSetType' for the FFI support: + let fntyp = n.sons[0].typ + for i in 0.. <n.len: var r: TRegister = x+i c.gen(n.sons[i], r) + if i >= fntyp.len: + internalAssert tfVarargs in fntyp.flags + c.gABx(n, opcSetType, r, c.genType(n.sons[i].typ)) if dest < 0: c.gABC(n, opcIndCall, 0, x, n.len) else: c.gABC(n, opcIndCallAsgn, dest, x, n.len) c.freeTempRange(x, n.len) +proc needsAsgnPatch(n: PNode): bool = + n.kind in {nkBracketExpr, nkDotExpr, nkCheckedFieldExpr} + +proc genAsgnPatch(c: PCtx; le: PNode, value: TRegister) = + case le.kind + of nkBracketExpr: + let dest = c.genx(le.sons[0]) + let idx = c.genx(le.sons[1]) + c.gABC(le, opcWrArrRef, dest, idx, value) + of nkDotExpr, nkCheckedFieldExpr: + # XXX field checks here + let left = if le.kind == nkDotExpr: le else: le.sons[0] + let dest = c.genx(left.sons[0]) + let idx = c.genx(left.sons[1]) + c.gABC(left, opcWrObjRef, dest, idx, value) + else: + discard + proc genNew(c: PCtx; n: PNode) = - let dest = c.genx(n.sons[1]) + let dest = if needsAsgnPatch(n.sons[1]): c.getTemp(n.sons[1].typ) + else: c.genx(n.sons[1]) # we use the ref's base type here as the VM conflates 'ref object' # and 'object' since internally we already have a pointer. c.gABx(n, opcNew, dest, - c.genType(n.sons[1].typ.skipTypes(abstractVar).sons[0])) + c.genType(n.sons[1].typ.skipTypes(abstractVar-{tyTypeDesc}).sons[0])) + c.genAsgnPatch(n.sons[1], dest) c.freeTemp(dest) proc genNewSeq(c: PCtx; n: PNode) = - let dest = c.genx(n.sons[1]) - c.gABx(n, opcNewSeq, dest, c.genType(n.sons[1].typ.skipTypes(abstractVar))) + let dest = if needsAsgnPatch(n.sons[1]): c.getTemp(n.sons[1].typ) + else: c.genx(n.sons[1]) let tmp = c.genx(n.sons[2]) + c.gABx(n, opcNewSeq, dest, c.genType(n.sons[1].typ.skipTypes( + abstractVar-{tyTypeDesc}))) c.gABx(n, opcNewSeq, tmp, 0) - c.freeTemp(dest) c.freeTemp(tmp) + c.genAsgnPatch(n.sons[1], dest) + c.freeTemp(dest) proc genUnaryABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) = let tmp = c.genx(n.sons[1]) @@ -440,7 +516,7 @@ proc genBinaryABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) = c.freeTemp(tmp2) proc genSetType(c: PCtx; n: PNode; dest: TRegister) = - let t = skipTypes(n.typ, abstractInst) + let t = skipTypes(n.typ, abstractInst-{tyTypeDesc}) if t.kind == tySet: c.gABx(n, opcSetType, dest, c.genType(t)) @@ -462,8 +538,16 @@ proc genBinaryStmt(c: PCtx; n: PNode; opc: TOpcode) = c.gABC(n, opc, dest, tmp, 0) c.freeTemp(tmp) +proc genBinaryStmtVar(c: PCtx; n: PNode; opc: TOpcode) = + let + dest = c.genx(n.sons[1], {gfAddrOf}) + tmp = c.genx(n.sons[2]) + c.gABC(n, opc, dest, tmp, 0) + #c.genAsgnPatch(n.sons[1], dest) + c.freeTemp(tmp) + proc genUnaryStmt(c: PCtx; n: PNode; opc: TOpcode) = - let tmp = c.genx(n.sons[2]) + let tmp = c.genx(n.sons[1]) c.gABC(n, opc, tmp, 0, 0) c.freeTemp(tmp) @@ -493,9 +577,6 @@ proc genAddSubInt(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) = else: genBinaryABC(c, n, dest, opc) -proc unused(n: PNode; x: TDest) {.inline.} = - if x >= 0: InternalError(n.info, "not unused") - proc genConv(c: PCtx; n, arg: PNode; dest: var TDest; opc=opcConv) = let tmp = c.genx(arg) c.gABx(n, opcSetType, tmp, genType(c, arg.typ)) @@ -508,7 +589,7 @@ proc genCard(c: PCtx; n: PNode; dest: var TDest) = let tmp = c.genx(n.sons[1]) if dest < 0: dest = c.getTemp(n.typ) c.genSetType(n.sons[1], tmp) - c.gABC(n, opc, dest, tmp) + c.gABC(n, opcCard, dest, tmp) c.freeTemp(tmp) proc genMagic(c: PCtx; n: PNode; dest: var TDest) = @@ -529,6 +610,7 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = unused(n, dest) var d = c.genx(n.sons[1]).TDest c.genAddSubInt(n, d, if m == mInc: opcAddInt else: opcSubInt) + c.genAsgnPatch(n.sons[1], d) c.freeTemp(d.TRegister) of mOrd, mChr, mArrToSeq: c.gen(n.sons[1], dest) of mNew, mNewFinalize: @@ -624,6 +706,7 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = var d = c.genx(n.sons[1]) var tmp = c.genx(n.sons[2]) c.gABC(n, if m == mSetLengthStr: opcSetLenStr else: opcSetLenSeq, d, tmp) + c.genAsgnPatch(n.sons[1], d) c.freeTemp(tmp) of mSwap: unused(n, dest) @@ -639,8 +722,8 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = tmp2 = c.genx(n.sons[2]) tmp3 = c.getTemp(n.sons[2].typ) c.gABC(n, opcLenStr, tmp3, tmp1) - c.gABC(n, opcSubstr, dest, tmp1, tmp2) - c.gABC(n, opcSubstr, tmp3) + c.gABC(n, opcSubStr, dest, tmp1, tmp2) + c.gABC(n, opcSubStr, tmp3) c.freeTemp(tmp1) c.freeTemp(tmp2) c.freeTemp(tmp3) @@ -650,8 +733,8 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = tmp1 = c.genx(n.sons[1]) tmp2 = c.genx(n.sons[2]) tmp3 = c.genx(n.sons[3]) - c.gABC(n, opcSubstr, dest, tmp1, tmp2) - c.gABC(n, opcSubstr, tmp3) + c.gABC(n, opcSubStr, dest, tmp1, tmp2) + c.gABC(n, opcSubStr, tmp3) c.freeTemp(tmp1) c.freeTemp(tmp2) c.freeTemp(tmp3) @@ -659,18 +742,22 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = unused(n, dest) var d = c.genx(n.sons[1]) c.gABC(n, opcReset, d) - of mOf: + of mOf, mIs: if dest < 0: dest = c.getTemp(n.typ) var tmp = c.genx(n.sons[1]) - c.gABC(n, opcOf, dest, tmp) - c.gABx(n, opcOf, 0, c.genType(n.sons[2].typ.skipTypes(abstractPtrs))) + var idx = c.getTemp(getSysType(tyInt)) + var typ = n.sons[2].typ + if m == mOf: typ = typ.skipTypes(abstractPtrs-{tyTypeDesc}) + c.gABx(n, opcLdImmInt, idx, c.genType(typ)) + c.gABC(n, if m == mOf: opcOf else: opcIs, dest, tmp, idx) c.freeTemp(tmp) + c.freeTemp(idx) of mSizeOf: - GlobalError(n.info, errCannotInterpretNodeX, renderTree(n)) + globalError(n.info, errCannotInterpretNodeX, renderTree(n)) of mHigh: if dest < 0: dest = c.getTemp(n.typ) let tmp = c.genx(n.sons[1]) - if n.sons[1].typ.skipTypes(abstractVar).kind == tyString: + if n.sons[1].typ.skipTypes(abstractVar-{tyTypeDesc}).kind == tyString: c.gABI(n, opcLenStr, dest, tmp, 1) else: c.gABI(n, opcLenSeq, dest, tmp, 1) @@ -685,27 +772,23 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = c.freeTempRange(x, n.len-1) of mAppendStrCh: unused(n, dest) - genBinaryStmt(c, n, opcAddStrCh) + genBinaryStmtVar(c, n, opcAddStrCh) of mAppendStrStr: unused(n, dest) - genBinaryStmt(c, n, opcAddStrStr) + genBinaryStmtVar(c, n, opcAddStrStr) of mAppendSeqElem: unused(n, dest) - genBinaryStmt(c, n, opcAddSeqElem) + genBinaryStmtVar(c, n, opcAddSeqElem) of mParseExprToAst: genUnaryABC(c, n, dest, opcParseExprToAst) of mParseStmtToAst: genUnaryABC(c, n, dest, opcParseStmtToAst) - of mExpandToAst: - InternalError(n.info, "cannot generate code for: " & $m) of mTypeTrait: let tmp = c.genx(n.sons[1]) if dest < 0: dest = c.getTemp(n.typ) - c.gABx(n, opcSetType, tmp, c.genType(n.sons[1])) + c.gABx(n, opcSetType, tmp, c.genType(n.sons[1].typ)) c.gABC(n, opcTypeTrait, dest, tmp) c.freeTemp(tmp) - of mIs: - InternalError(n.info, "cannot generate code for: " & $m) of mSlurp: genUnaryABC(c, n, dest, opcSlurp) of mStaticExec: genBinaryABC(c, n, dest, opcGorge) of mNLen: genUnaryABI(c, n, dest, opcLenSeq) @@ -750,11 +833,17 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = of mNNewNimNode: genBinaryABC(c, n, dest, opcNNewNimNode) of mNCopyNimNode: genUnaryABC(c, n, dest, opcNCopyNimNode) of mNCopyNimTree: genUnaryABC(c, n, dest, opcNCopyNimTree) - of mNBindSym: genUnaryABC(c, n, dest, opcNBindSym) + of mNBindSym: + if n[1].kind in {nkClosedSymChoice, nkOpenSymChoice, nkSym}: + let idx = c.genLiteral(n[1]) + if dest < 0: dest = c.getTemp(n.typ) + c.gABx(n, opcNBindSym, dest, idx) + else: + internalError(n.info, "invalid bindSym usage") of mStrToIdent: genUnaryABC(c, n, dest, opcStrToIdent) of mIdentToStr: genUnaryABC(c, n, dest, opcIdentToStr) of mEqIdent: genBinaryABC(c, n, dest, opcEqIdent) - of mEqNimrodNode: genBinaryABC(c, n, dest, opcEqRef) + of mEqNimrodNode: genBinaryABC(c, n, dest, opcEqNimrodNode) of mNLineInfo: genUnaryABC(c, n, dest, opcNLineInfo) of mNHint: unused(n, dest) @@ -771,13 +860,27 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = of mNGenSym: genBinaryABC(c, n, dest, opcGenSym) of mMinI, mMaxI, mMinI64, mMaxI64, mAbsF64, mMinF64, mMaxF64, mAbsI, mAbsI64: c.genCall(n, dest) + clearDest(n, dest) + of mExpandToAst: + if n.len != 2: + globalError(n.info, errGenerated, "expandToAst requires 1 argument") + let arg = n.sons[1] + if arg.kind in nkCallKinds: + #if arg[0].kind != nkSym or arg[0].sym.kind notin {skTemplate, skMacro}: + # "ExpandToAst: expanded symbol is no macro or template" + if dest < 0: dest = c.getTemp(n.typ) + c.genCall(arg, dest) + # do not call clearDest(n, dest) here as getAst has a meta-type as such + # produces a value + else: + globalError(n.info, "expandToAst requires a call expression") else: # mGCref, mGCunref, - InternalError(n.info, "cannot generate code for: " & $m) + internalError(n.info, "cannot generate code for: " & $m) const atomicTypes = {tyBool, tyChar, - tyExpr, tyStmt, tyTypeDesc, + tyExpr, tyStmt, tyTypeDesc, tyStatic, tyEnum, tyOrdinal, tyRange, @@ -789,7 +892,7 @@ const tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64} proc requiresCopy(n: PNode): bool = - if n.typ.skipTypes(abstractInst).kind in atomicTypes: + if n.typ.skipTypes(abstractInst-{tyTypeDesc}).kind in atomicTypes: result = false elif n.kind in ({nkCurly, nkBracket, nkPar, nkObjConstr}+nkCallKinds): result = false @@ -797,7 +900,7 @@ proc requiresCopy(n: PNode): bool = result = true proc unneededIndirection(n: PNode): bool = - n.typ.skipTypes(abstractInst).kind == tyRef + n.typ.skipTypes(abstractInst-{tyTypeDesc}).kind == tyRef proc skipDeref(n: PNode): PNode = if n.kind in {nkDerefExpr, nkHiddenDeref} and unneededIndirection(n.sons[0]): @@ -805,30 +908,32 @@ proc skipDeref(n: PNode): PNode = else: result = n -proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) = +proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode; + flags: TGenFlags) = # a nop for certain types + let flags = if opc == opcAddr: flags+{gfAddrOf} else: flags if unneededIndirection(n.sons[0]): - gen(c, n.sons[0], dest) + gen(c, n.sons[0], dest, flags) else: - let tmp = c.genx(n.sons[0]) + let tmp = c.genx(n.sons[0], flags) if dest < 0: dest = c.getTemp(n.typ) gABC(c, n, opc, dest, tmp) c.freeTemp(tmp) proc whichAsgnOpc(n: PNode): TOpcode = - case n.typ.skipTypes(abstractRange).kind + case n.typ.skipTypes(abstractRange-{tyTypeDesc}).kind of tyBool, tyChar, tyEnum, tyOrdinal, tyInt..tyInt64, tyUInt..tyUInt64: opcAsgnInt of tyString, tyCString: opcAsgnStr of tyFloat..tyFloat128: opcAsgnFloat - of tyRef, tyNil: + of tyRef, tyNil, tyVar: opcAsgnRef else: opcAsgnComplex -proc isRef(t: PType): bool = t.skipTypes(abstractRange).kind == tyRef +proc isRef(t: PType): bool = t.skipTypes(abstractRange-{tyTypeDesc}).kind == tyRef proc whichAsgnOpc(n: PNode; opc: TOpcode): TOpcode = if isRef(n.typ): succ(opc) else: opc @@ -839,32 +944,46 @@ proc genAsgn(c: PCtx; dest: TDest; ri: PNode; requiresCopy: bool) = gABC(c, ri, whichAsgnOpc(ri), dest, tmp) c.freeTemp(tmp) +template isGlobal(s: PSym): bool = sfGlobal in s.flags and s.kind != skForVar + +proc setSlot(c: PCtx; v: PSym) = + # XXX generate type initialization here? + if v.position == 0: + v.position = c.prc.maxSlots + c.prc.slots[v.position] = (inUse: true, + kind: if v.kind == skLet: slotFixedLet else: slotFixedVar) + inc c.prc.maxSlots + proc genAsgn(c: PCtx; le, ri: PNode; requiresCopy: bool) = case le.kind of nkBracketExpr: let dest = c.genx(le.sons[0]) let idx = c.genx(le.sons[1]) let tmp = c.genx(ri) - if le.sons[0].typ.skipTypes(abstractVarRange).kind in {tyString, tyCString}: + if le.sons[0].typ.skipTypes(abstractVarRange-{tyTypeDesc}).kind in { + tyString, tyCString}: c.gABC(le, opcWrStrIdx, dest, idx, tmp) else: c.gABC(le, whichAsgnOpc(le, opcWrArr), dest, idx, tmp) c.freeTemp(tmp) - of nkDotExpr: - let dest = c.genx(le.sons[0]) - let idx = c.genx(le.sons[1]) + of nkDotExpr, nkCheckedFieldExpr: + # XXX field checks here + let left = if le.kind == nkDotExpr: le else: le.sons[0] + let dest = c.genx(left.sons[0]) + let idx = c.genx(left.sons[1]) let tmp = c.genx(ri) - c.gABC(le, whichAsgnOpc(le, opcWrObj), dest, idx, tmp) + c.gABC(left, whichAsgnOpc(left, opcWrObj), dest, idx, tmp) c.freeTemp(tmp) of nkSym: let s = le.sym - if sfGlobal in s.flags: + if s.isGlobal: withTemp(tmp, le.typ): gen(c, ri, tmp) c.gABx(le, whichAsgnOpc(le, opcWrGlobal), tmp, s.position) else: - InternalAssert s.position > 0 or (s.position == 0 and - s.kind in {skParam, skResult}) + if s.kind == skForVar and c.mode == emRepl: c.setSlot s + internalAssert s.position > 0 or (s.position == 0 and + s.kind in {skParam,skResult}) var dest: TRegister = s.position + ord(s.kind == skParam) gen(c, ri, dest) else: @@ -878,41 +997,87 @@ proc genLit(c: PCtx; n: PNode; dest: var TDest) = let lit = genLiteral(c, n) c.gABx(n, opc, dest, lit) +proc genTypeLit(c: PCtx; t: PType; dest: var TDest) = + var n = newNode(nkType) + n.typ = t + genLit(c, n, dest) + +proc importcSym(c: PCtx; info: TLineInfo; s: PSym) = + when hasFFI: + if allowFFI in c.features: + c.globals.add(importcSymbol(s)) + s.position = c.globals.len + else: + localError(info, errGenerated, "VM is not allowed to 'importc'") + else: + localError(info, errGenerated, + "cannot 'importc' variable at compile time") + +proc cannotEval(n: PNode) {.noinline.} = + globalError(n.info, errGenerated, "cannot evaluate at compile time: " & + n.renderTree) + +proc genGlobalInit(c: PCtx; n: PNode; s: PSym) = + c.globals.add(emptyNode.copyNode) + s.position = c.globals.len + # This is rather hard to support, due to the laziness of the VM code + # generator. See tests/compile/tmacro2 for why this is necesary: + # var decls{.compileTime.}: seq[PNimrodNode] = @[] + c.gABx(n, opcGlobalOnce, 0, s.position) + let tmp = c.genx(s.ast) + c.gABx(n, whichAsgnOpc(n, opcWrGlobal), tmp, s.position) + c.freeTemp(tmp) + proc genRdVar(c: PCtx; n: PNode; dest: var TDest) = let s = n.sym - if sfGlobal in s.flags: - if dest < 0: dest = c.getTemp(s.typ) + if s.isGlobal: + if sfCompileTime in s.flags or c.mode == emRepl: + discard + elif s.position == 0: + cannotEval(n) if s.position == 0: - c.globals.add(s.ast) - s.position = c.globals.len - # XXX var g = codeHere() ? - c.gABx(n, opcLdGlobal, dest, s.position) + if sfImportc in s.flags: c.importcSym(n.info, s) + else: genGlobalInit(c, n, s) + if dest < 0: + dest = c.getGlobalSlot(n, s) + #c.gABx(n, opcAliasGlobal, dest, s.position) + else: + c.gABx(n, opcLdGlobal, dest, s.position) else: - if s.position > 0 or (s.position == 0 and s.kind in {skParam, skResult}): + if s.kind == skForVar and c.mode == emRepl: c.setSlot s + if s.position > 0 or (s.position == 0 and + s.kind in {skParam,skResult}): if dest < 0: dest = s.position + ord(s.kind == skParam) else: # we need to generate an assignment: genAsgn(c, dest, n, c.prc.slots[dest].kind >= slotSomeTemp) else: - InternalError(n.info, s.name.s & " " & $s.position) + # see tests/t99bott for an example that triggers it: + cannotEval(n) -proc genAccess(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) = - let a = c.genx(n.sons[0]) - let b = c.genx(n.sons[1]) +proc genAccess(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode; + flags: TGenFlags) = + let a = c.genx(n.sons[0], flags) + let b = c.genx(n.sons[1], {}) if dest < 0: dest = c.getTemp(n.typ) - c.gABC(n, opc, dest, a, b) + c.gABC(n, (if gfAddrOf in flags: succ(opc) else: opc), dest, a, b) c.freeTemp(a) c.freeTemp(b) -proc genObjAccess(c: PCtx; n: PNode; dest: var TDest) = - genAccess(c, n, dest, opcLdObj) +proc genObjAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) = + genAccess(c, n, dest, opcLdObj, flags) -proc genArrAccess(c: PCtx; n: PNode; dest: var TDest) = - if n.sons[0].typ.skipTypes(abstractVarRange).kind in {tyString, tyCString}: - genAccess(c, n, dest, opcLdStrIdx) +proc genCheckedObjAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) = + # XXX implement field checks! + genAccess(c, n.sons[0], dest, opcLdObj, flags) + +proc genArrAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) = + if n.sons[0].typ.skipTypes(abstractVarRange-{tyTypeDesc}).kind in { + tyString, tyCString}: + genAccess(c, n, dest, opcLdStrIdx, {}) else: - genAccess(c, n, dest, opcLdArr) + genAccess(c, n, dest, opcLdArr, flags) proc getNullValue*(typ: PType, info: TLineInfo): PNode proc getNullValueAux(obj: PNode, result: PNode) = @@ -925,7 +1090,7 @@ proc getNullValueAux(obj: PNode, result: PNode) = getNullValueAux(lastSon(obj.sons[i]), result) of nkSym: addSon(result, getNullValue(obj.sym.typ, result.info)) - else: InternalError(result.info, "getNullValueAux") + else: internalError(result.info, "getNullValueAux") proc getNullValue(typ: PType, info: TLineInfo): PNode = var t = skipTypes(typ, abstractRange-{tyTypeDesc}) @@ -936,10 +1101,17 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode = of tyUInt..tyUInt64: result = newNodeIT(nkUIntLit, info, t) of tyFloat..tyFloat128: - result = newNodeIt(nkFloatLit, info, t) - of tyVar, tyPointer, tyPtr, tyCString, tySequence, tyString, tyExpr, - tyStmt, tyTypeDesc, tyProc, tyRef: + result = newNodeIT(nkFloatLit, info, t) + of tyVar, tyPointer, tyPtr, tyCString, tySequence, tyString, tyExpr, + tyStmt, tyTypeDesc, tyStatic, tyRef: result = newNodeIT(nkNilLit, info, t) + of tyProc: + if t.callConv != ccClosure: + result = newNodeIT(nkNilLit, info, t) + else: + result = newNodeIT(nkPar, info, t) + result.add(newNodeIT(nkNilLit, info, t)) + result.add(newNodeIT(nkNilLit, info, t)) of tyObject: result = newNodeIT(nkPar, info, t) getNullValueAux(t.n, result) @@ -958,15 +1130,7 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode = addSon(result, getNullValue(t.sons[i], info)) of tySet: result = newNodeIT(nkCurly, info, t) - else: InternalError("getNullValue: " & $t.kind) - -proc setSlot(c: PCtx; v: PSym) = - # XXX generate type initialization here? - if v.position == 0: - v.position = c.prc.maxSlots - c.prc.slots[v.position] = (inUse: true, - kind: if v.kind == skLet: slotFixedLet else: slotFixedVar) - inc c.prc.maxSlots + else: internalError("getNullValue: " & $t.kind) proc genVarSection(c: PCtx; n: PNode) = for a in n: @@ -984,11 +1148,14 @@ proc genVarSection(c: PCtx; n: PNode) = c.freeTemp(tmp) elif a.sons[0].kind == nkSym: let s = a.sons[0].sym - if sfGlobal in s.flags: + if s.isGlobal: if s.position == 0: - let sa = if s.ast.isNil: getNullValue(s.typ, a.info) else: s.ast - c.globals.add(sa) - s.position = c.globals.len + if sfImportc in s.flags: c.importcSym(a.info, s) + else: + let sa = if s.ast.isNil: getNullValue(s.typ, a.info) else: s.ast + c.globals.add(sa) + s.position = c.globals.len + # "Once support" is unnecessary here if a.sons[2].kind == nkEmpty: when false: withTemp(tmp, s.typ): @@ -1016,27 +1183,35 @@ proc genVarSection(c: PCtx; n: PNode) = proc genArrayConstr(c: PCtx, n: PNode, dest: var TDest) = if dest < 0: dest = c.getTemp(n.typ) c.gABx(n, opcLdNull, dest, c.genType(n.typ)) - let intType = getSysType(tyInt) - var tmp = getTemp(c, intType) - c.gABx(n, opcLdNull, tmp, c.genType(intType)) - for x in n: - let a = c.genx(x) - c.gABC(n, opcWrArr, dest, a, tmp) - c.gABI(n, opcAddImmInt, tmp, tmp, 1) - c.freeTemp(a) - c.freeTemp(tmp) + if n.len > 0: + let intType = getSysType(tyInt) + var tmp = getTemp(c, intType) + c.gABx(n, opcLdNull, tmp, c.genType(intType)) + for x in n: + let a = c.genx(x) + c.gABC(n, whichAsgnOpc(x, opcWrArr), dest, tmp, a) + c.gABI(n, opcAddImmInt, tmp, tmp, 1) + c.freeTemp(a) + c.freeTemp(tmp) proc genSetConstr(c: PCtx, n: PNode, dest: var TDest) = if dest < 0: dest = c.getTemp(n.typ) c.gABx(n, opcLdNull, dest, c.genType(n.typ)) for x in n: - let a = c.genx(x) - c.gABC(n, opcIncl, dest, a) - c.freeTemp(a) + if x.kind == nkRange: + let a = c.genx(x.sons[0]) + let b = c.genx(x.sons[1]) + c.gABC(n, opcInclRange, dest, a, b) + c.freeTemp(b) + c.freeTemp(a) + else: + let a = c.genx(x) + c.gABC(n, opcIncl, dest, a) + c.freeTemp(a) proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) = if dest < 0: dest = c.getTemp(n.typ) - let t = n.typ.skipTypes(abstractRange) + let t = n.typ.skipTypes(abstractRange-{tyTypeDesc}) if t.kind == tyRef: c.gABx(n, opcNew, dest, c.genType(t.sons[0])) else: @@ -1054,7 +1229,8 @@ proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) = proc genTupleConstr(c: PCtx, n: PNode, dest: var TDest) = if dest < 0: dest = c.getTemp(n.typ) - var idx = getTemp(c, getSysType(tyInt)) + c.gABx(n, opcLdNull, dest, c.genType(n.typ)) + # XXX x = (x.old, 22) produces wrong code ... stupid self assignments for i in 0.. <n.len: let it = n.sons[i] if it.kind == nkExprColonExpr: @@ -1065,21 +1241,21 @@ proc genTupleConstr(c: PCtx, n: PNode, dest: var TDest) = c.freeTemp(idx) else: let tmp = c.genx(it) - c.gABx(it, opcLdImmInt, idx, i) - c.gABC(it, whichAsgnOpc(it, opcWrObj), dest, idx, tmp) + c.gABC(it, whichAsgnOpc(it, opcWrObj), dest, i.TRegister, tmp) c.freeTemp(tmp) - c.freeTemp(idx) proc genProc*(c: PCtx; s: PSym): int -proc gen(c: PCtx; n: PNode; dest: var TDest) = +proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) = case n.kind of nkSym: let s = n.sym case s.kind of skVar, skForVar, skTemp, skLet, skParam, skResult: genRdVar(c, n, dest) - of skProc, skConverter, skMacro, skMethod, skIterator: + of skProc, skConverter, skMacro, skTemplate, skMethod, skIterator: + # 'skTemplate' is only allowed for 'getAst' support: + if sfImportc in s.flags: c.importcSym(n.info, s) genLit(c, n, dest) of skConst: gen(c, s.ast, dest) @@ -1091,32 +1267,39 @@ proc gen(c: PCtx; n: PNode; dest: var TDest) = var lit = genLiteral(c, newIntNode(nkIntLit, s.position)) c.gABx(n, opcLdConst, dest, lit) of skField: - InternalAssert dest < 0 + internalAssert dest < 0 if s.position > high(dest): - InternalError(n.info, + internalError(n.info, "too large offset! cannot generate code for: " & s.name.s) dest = s.position + of skType: + genTypeLit(c, s.typ, dest) else: - InternalError(n.info, "cannot generate code for: " & s.name.s) + internalError(n.info, "cannot generate code for: " & s.name.s) of nkCallKinds: if n.sons[0].kind == nkSym and n.sons[0].sym.magic != mNone: genMagic(c, n, dest) else: genCall(c, n, dest) + clearDest(n, dest) of nkCharLit..nkInt64Lit: if isInt16Lit(n): if dest < 0: dest = c.getTemp(n.typ) c.gABx(n, opcLdImmInt, dest, n.intVal.int) else: genLit(c, n, dest) - of nkUIntLit..nkNilLit: genLit(c, n, dest) + of nkUIntLit..pred(nkNilLit): genLit(c, n, dest) + of nkNilLit: + if not n.typ.isEmptyType: genLit(c, n, dest) + else: unused(n, dest) of nkAsgn, nkFastAsgn: unused(n, dest) genAsgn(c, n.sons[0], n.sons[1], n.kind == nkAsgn) - of nkDotExpr: genObjAccess(c, n, dest) - of nkBracketExpr: genArrAccess(c, n, dest) - of nkDerefExpr, nkHiddenDeref: genAddrDeref(c, n, dest, opcDeref) - of nkAddr, nkHiddenAddr: genAddrDeref(c, n, dest, opcAddr) + of nkDotExpr: genObjAccess(c, n, dest, flags) + of nkCheckedFieldExpr: genCheckedObjAccess(c, n, dest, flags) + of nkBracketExpr: genArrAccess(c, n, dest, flags) + of nkDerefExpr, nkHiddenDeref: genAddrDeref(c, n, dest, opcDeref, flags) + of nkAddr, nkHiddenAddr: genAddrDeref(c, n, dest, opcAddr, flags) of nkWhenStmt, nkIfStmt, nkIfExpr: genIf(c, n, dest) of nkCaseStmt: genCase(c, n, dest) of nkWhileStmt: @@ -1139,7 +1322,7 @@ proc gen(c: PCtx; n: PNode; dest: var TDest) = of nkStmtListExpr: let L = n.len-1 for i in 0 .. <L: gen(c, n.sons[i]) - gen(c, n.sons[L], dest) + gen(c, n.sons[L], dest, flags) of nkDiscardStmt: unused(n, dest) gen(c, n.sons[0]) @@ -1168,7 +1351,7 @@ proc gen(c: PCtx; n: PNode; dest: var TDest) = else: dest = tmp0 of nkEmpty, nkCommentStmt, nkTypeSection, nkConstSection, nkPragma, - nkTemplateDef, nkIncludeStmt, nkImportStmt: + nkTemplateDef, nkIncludeStmt, nkImportStmt, nkFromStmt: unused(n, dest) of nkStringToCString, nkCStringToString: gen(c, n.sons[0], dest) @@ -1176,8 +1359,13 @@ proc gen(c: PCtx; n: PNode; dest: var TDest) = of nkCurly: genSetConstr(c, n, dest) of nkObjConstr: genObjConstr(c, n, dest) of nkPar, nkClosure: genTupleConstr(c, n, dest) + of nkCast: + if allowCast in c.features: + genConv(c, n, n.sons[1], dest, opcCast) + else: + localError(n.info, errGenerated, "VM is not allowed to 'cast'") else: - InternalError n.info, "too implement " & $n.kind + internalError n.info, "too implement " & $n.kind proc removeLastEof(c: PCtx) = let last = c.code.len-1 @@ -1193,14 +1381,16 @@ proc genStmt*(c: PCtx; n: PNode): int = var d: TDest = -1 c.gen(n, d) c.gABC(n, opcEof) - InternalAssert d < 0 + if d >= 0: internalError(n.info, "some destination set") -proc genExpr*(c: PCtx; n: PNode): int = +proc genExpr*(c: PCtx; n: PNode, requiresValue = true): int = c.removeLastEof result = c.code.len var d: TDest = -1 c.gen(n, d) - InternalAssert d >= 0 + if d < 0: + if requiresValue: internalError(n.info, "no destination set") + d = 0 c.gABC(n, opcEof, d) proc genParams(c: PCtx; params: PNode) = @@ -1212,7 +1402,7 @@ proc genParams(c: PCtx; params: PNode) = c.prc.maxSlots = max(params.len, 1) proc finalJumpTarget(c: PCtx; pc, diff: int) = - InternalAssert(-0x7fff < diff and diff < 0x7fff) + internalAssert(-0x7fff < diff and diff < 0x7fff) let oldInstr = c.code[pc] # opcode and regA stay the same: c.code[pc] = ((oldInstr.uint32 and 0xffff'u32).uint32 or @@ -1225,12 +1415,11 @@ proc optimizeJumps(c: PCtx; start: int) = case opc of opcTJmp, opcFJmp: var reg = c.code[i].regA - var d = i + c.code[i].regBx - var iters = maxIterations - while iters > 0: + var d = i + c.code[i].jmpDiff + for iters in countdown(maxIterations, 0): case c.code[d].opcode of opcJmp: - d = d + c.code[d].regBx + d = d + c.code[d].jmpDiff of opcTJmp, opcFJmp: if c.code[d].regA != reg: break # tjmp x, 23 @@ -1238,28 +1427,40 @@ proc optimizeJumps(c: PCtx; start: int) = # tjmp x, 12 # -- we know 'x' is true, and so can jump to 12+13: if c.code[d].opcode == opc: - d = d + c.code[d].regBx + d = d + c.code[d].jmpDiff else: # tjmp x, 23 # fjmp x, 22 # We know 'x' is true so skip to the next instruction: d = d + 1 else: break - dec iters - c.finalJumpTarget(i, d - i) + if d != i + c.code[i].jmpDiff: + c.finalJumpTarget(i, d - i) of opcJmp: - var d = i + c.code[i].regBx + var d = i + c.code[i].jmpDiff var iters = maxIterations while c.code[d].opcode == opcJmp and iters > 0: - d = d + c.code[d].regBx + d = d + c.code[d].jmpDiff dec iters - c.finalJumpTarget(i, d - i) + if c.code[d].opcode == opcRet: + # optimize 'jmp to ret' to 'ret' here + c.code[i] = c.code[d] + elif d != i + c.code[i].jmpDiff: + c.finalJumpTarget(i, d - i) else: discard proc genProc(c: PCtx; s: PSym): int = let x = s.ast.sons[optimizedCodePos] if x.kind == nkEmpty: - c.removeLastEof + #if s.name.s == "outterMacro" or s.name.s == "innerProc": + # echo "GENERATING CODE FOR ", s.name.s + let last = c.code.len-1 + var eofInstr: TInstr + if last >= 0 and c.code[last].opcode == opcEof: + eofInstr = c.code[last] + c.code.setLen(last) + c.debug.setLen(last) + #c.removeLastEof result = c.code.len+1 # skip the jump instruction s.ast.sons[optimizedCodePos] = newIntNode(nkIntLit, result) # thanks to the jmp we can add top level statements easily and also nest @@ -1271,13 +1472,22 @@ proc genProc(c: PCtx; s: PSym): int = c.prc = p # iterate over the parameters and allocate space for them: genParams(c, s.typ.n) + if tfCapturesEnv in s.typ.flags: + #let env = s.ast.sons[paramsPos].lastSon.sym + #assert env.position == 2 + c.prc.slots[c.prc.maxSlots] = (inUse: true, kind: slotFixedLet) + inc c.prc.maxSlots gen(c, body) # generate final 'return' statement: c.gABC(body, opcRet) c.patch(procStart) - c.gABC(body, opcEof) - s.position = c.prc.maxSlots + c.gABC(body, opcEof, eofInstr.regA) + c.optimizeJumps(result) + s.offset = c.prc.maxSlots + #if s.name.s == "concatStyleInterpolation": + # c.echoCode(result) + # echo renderTree(body) c.prc = oldPrc - #c.echoCode else: + c.prc.maxSlots = s.offset result = x.intVal.int diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index b37a7bb4f..837bb4f50 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -28,9 +28,9 @@ type wElif, wElse, wEnd, wEnum, wExcept, wExport, wFinally, wFor, wFrom, wGeneric, wIf, wImport, wIn, wInclude, wInterface, wIs, wIsnot, wIterator, wLambda, wLet, - wMacro, wMethod, wMixin, wUsing, wMod, wNil, + wMacro, wMethod, wMixin, wMod, wNil, wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn, - wShared, wShl, wShr, wStatic, wTemplate, wTry, wTuple, wType, wVar, + wShared, wShl, wShr, wStatic, wTemplate, wTry, wTuple, wType, wUsing, wVar, wWhen, wWhile, wWith, wWithout, wXor, wYield, wColon, wColonColon, wEquals, wDot, wDotDot, @@ -60,7 +60,7 @@ type wPassc, wPassl, wBorrow, wDiscardable, wFieldChecks, wWatchPoint, wSubsChar, - wAcyclic, wShallow, wUnroll, wLinearScanEnd, wComputedGoto, + wAcyclic, wShallow, wUnroll, wLinearScanEnd, wComputedGoto, wInjectStmt, wWrite, wGensym, wInject, wDirty, wInheritable, wThreadVar, wEmit, wNoStackFrame, wImplicitStatic, wGlobal, wCodegenDecl, @@ -95,7 +95,7 @@ const cppNimSharedKeywords* = { wAsm, wBreak, wCase, wConst, wContinue, wDo, wElse, wEnum, wExport, - wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing } + wFor, wIf, wReturn, wStatic, wTemplate, wTry, wWhile, wUsing} specialWords*: array[low(TSpecialWord)..high(TSpecialWord), string] = ["", @@ -107,11 +107,11 @@ const "finally", "for", "from", "generic", "if", "import", "in", "include", "interface", "is", "isnot", "iterator", "lambda", "let", - "macro", "method", "mixin", "using", "mod", "nil", "not", "notin", + "macro", "method", "mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc", "ptr", "raise", "ref", "return", "shared", "shl", "shr", "static", - "template", "try", "tuple", "type", "var", + "template", "try", "tuple", "type", "using", "var", "when", "while", "with", "without", "xor", "yield", @@ -142,7 +142,8 @@ const "compiletime", "noinit", "passc", "passl", "borrow", "discardable", "fieldchecks", "watchpoint", - "subschar", "acyclic", "shallow", "unroll", "linearscanend", "computedgoto", + "subschar", "acyclic", "shallow", "unroll", "linearscanend", + "computedgoto", "injectstmt", "write", "gensym", "inject", "dirty", "inheritable", "threadvar", "emit", "nostackframe", "implicitstatic", "global", "codegendecl", @@ -165,7 +166,7 @@ const "inout", "bycopy", "byref", "oneway", ] -proc findStr*(a: openarray[string], s: string): int = +proc findStr*(a: openArray[string], s: string): int = for i in countup(low(a), high(a)): if cmpIgnoreStyle(a[i], s) == 0: return i @@ -175,7 +176,7 @@ proc whichKeyword*(id: PIdent): TSpecialWord = if id.id < 0: result = wInvalid else: result = TSpecialWord(id.id) -proc whichKeyword*(id: String): TSpecialWord = +proc whichKeyword*(id: string): TSpecialWord = result = whichKeyword(getIdent(id)) proc initSpecials() = diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg index d47dccb63..63a3c30c4 100644 --- a/config/nimdoc.cfg +++ b/config/nimdoc.cfg @@ -76,7 +76,7 @@ span.LongStringLit {color: blue} span.CharLit {color: blue} span.EscapeSequence {color: black} span.Operator {color: black} -span.Punctation {color: black} +span.Punctuation {color: black} span.Comment, span.LongComment {font-style:italic; color: green} span.RegularExpression {color: DarkViolet} span.TagStart {color: DarkViolet} diff --git a/config/nimdoc.tex.cfg b/config/nimdoc.tex.cfg index 8b59f2ee9..599ede345 100644 --- a/config/nimdoc.tex.cfg +++ b/config/nimdoc.tex.cfg @@ -98,7 +98,7 @@ doc.file = """ \newcommand{\spanCharLit}[1]{#1} \newcommand{\spanEscapeSequence}[1]{#1} \newcommand{\spanOperator}[1]{#1} -\newcommand{\spanPunctation}[1]{#1} +\newcommand{\spanPunctuation}[1]{#1} \newcommand{\spanComment}[1]{\emph{#1}} \newcommand{\spanLongComment}[1]{\emph{#1}} \newcommand{\spanRegularExpression}[1]{#1} diff --git a/config/nimrod.cfg b/config/nimrod.cfg index 77cc742b2..2817eac55 100644 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -18,15 +18,16 @@ path="$lib/pure" path="$lib/pure/collections" path="$lib/impure" path="$lib/wrappers" -path="$lib/wrappers/cairo" -path="$lib/wrappers/gtk" -path="$lib/wrappers/lua" -path="$lib/wrappers/opengl" +# path="$lib/wrappers/cairo" +# path="$lib/wrappers/gtk" +# path="$lib/wrappers/lua" +# path="$lib/wrappers/opengl" path="$lib/wrappers/pcre" path="$lib/wrappers/readline" path="$lib/wrappers/sdl" -path="$lib/wrappers/x11" +# path="$lib/wrappers/x11" path="$lib/wrappers/zip" +path="$lib/wrappers/libffi" path="$lib/windows" path="$lib/posix" path="$lib/js" diff --git a/copying.txt b/copying.txt index 0ff6b7d87..4041ca027 100644 --- a/copying.txt +++ b/copying.txt @@ -1,7 +1,7 @@ =============================================================================== Nimrod -- a Compiler for Nimrod. http://nimrod-code.org/ -Copyright (C) 2004-2013 Andreas Rumpf. All rights reserved. +Copyright (C) 2004-2014 Andreas Rumpf. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/devel/logging.nim b/devel/logging.nim deleted file mode 100644 index a10478dab..000000000 --- a/devel/logging.nim +++ /dev/null @@ -1,210 +0,0 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2012 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module implements a simple logger. It is based on the following design: -## * Runtime log formating is a bug: Sooner or later every log file is parsed. -## * Keep it simple: If this library does not fullfill your needs, write your -## own. Trying to support every logging feature just leads to bloat. -## -## Format is:: -## -## DEBUG|INFO|... (2009-11-02 00:00:00)? (Component: )? Message -## -## - -import strutils, os, times - -type - TLevel* = enum ## logging level - lvlAll, ## all levels active - lvlDebug, ## debug level (and any above) active - lvlInfo, ## info level (and any above) active - lvlWarn, ## warn level (and any above) active - lvlError, ## error level (and any above) active - lvlFatal, ## fatal level (and any above) active - lvlNone - -const - LevelNames*: array [TLevel, string] = [ - "DEBUG", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "NONE" - ] - - defaultFmtStr = "" ## default string between log level and message per logger - verboseFmtStr = "$date $time " - -type - TLogger* = object of TObject ## abstract logger; the base type of all loggers - levelThreshold*: TLevel ## only messages of level >= levelThreshold - ## should be processed - fmtStr: string ## = defaultFmtStr by default, see substituteLog for $date etc. - - TConsoleLogger* = object of TLogger ## logger that writes the messages to the - ## console - - TFileLogger* = object of TLogger ## logger that writes the messages to a file - f: TFile - - # TODO: implement rolling log, will produce filename.1, filename.2 etc. - TRollingFileLogger* = object of TFileLogger ## logger that writes the - ## message to a file - maxLines: int # maximum number of lines - curLine : int - baseName: string # initial filename - logFiles: int # how many log files already created, e.g. basename.1, basename.2... - - - - -proc substituteLog*(frmt: string): string = - ## converts $date to the current date - ## converts $time to the current time - ## converts $app to getAppFilename() - ## converts - result = newStringOfCap(frmt.len + 20) - var i = 0 - while i < frmt.len: - if frmt[i] != '$': - result.add(frmt[i]) - inc(i) - else: - inc(i) - var v = "" - var app = getAppFilename() - while frmt[i] in IdentChars: - v.add(toLower(frmt[i])) - inc(i) - case v - of "date": result.add(getDateStr()) - of "time": result.add(getClockStr()) - of "app": result.add(app) - of "appdir": result.add(app.splitFile.dir) - of "appname": result.add(app.splitFile.name) - - - -method log*(L: ref TLogger, level: TLevel, - frmt: string, args: varargs[string, `$`]) = - ## override this method in custom loggers. Default implementation does - ## nothing. - nil - -method log*(L: ref TConsoleLogger, level: TLevel, - frmt: string, args: varargs[string, `$`]) = - Writeln(stdout, LevelNames[level], " ", substituteLog(L.fmtStr), frmt % args) - -method log*(L: ref TFileLogger, level: TLevel, - frmt: string, args: varargs[string, `$`]) = - Writeln(L.f, LevelNames[level], " ", substituteLog(L.fmtStr), frmt % args) - -proc defaultFilename*(): string = - ## returns the default filename for a logger - var (path, name, ext) = splitFile(getAppFilename()) - result = changeFileExt(path / name & "_" & getDateStr(), "log") - - - - -proc newConsoleLogger*(levelThreshold = lvlAll) : ref TConsoleLogger = - new result - result.fmtStr = defaultFmtStr - result.levelThreshold = levelThreshold - -proc newFileLogger*(filename = defaultFilename(), - mode: TFileMode = fmAppend, - levelThreshold = lvlAll): ref TFileLogger = - new(result) - result.levelThreshold = levelThreshold - result.f = open(filename, mode) - result.fmtStr = defaultFmtStr - -# ------ - -proc readLogLines(logger : ref TRollingFileLogger) = nil - #f.readLine # TODO read all lines, update curLine - - -proc newRollingFileLogger*(filename = defaultFilename(), - mode: TFileMode = fmReadWrite, - levelThreshold = lvlAll, - maxLines = 1000): ref TRollingFileLogger = - new(result) - result.levelThreshold = levelThreshold - result.fmtStr = defaultFmtStr - result.maxLines = maxLines - result.f = open(filename, mode) - result.curLine = 0 - - # TODO count all number files - # count lines in existing filename file - # if >= maxLines then rename to next numbered file and create new file - - #if mode in {fmReadWrite, fmReadWriteExisting}: - # readLogLines(result) - - - -method log*(L: ref TRollingFileLogger, level: TLevel, - frmt: string, args: varargs[string, `$`]) = - # TODO - # if more than maxlines, then set cursor to zero - - Writeln(L.f, LevelNames[level], " ", frmt % args) - -# -------- - -var - level* = lvlAll ## global log filter - handlers*: seq[ref TLogger] = @[] ## handlers with their own log levels - -proc logLoop(level: TLevel, frmt: string, args: varargs[string, `$`]) = - for logger in items(handlers): - if level >= logger.levelThreshold: - log(logger, level, frmt, args) - -template log*(level: TLevel, frmt: string, args: varargs[string, `$`]) = - ## logs a message of the given level - bind logLoop - bind `%` - bind logging.Level - - if level >= logging.Level: - logLoop(level, frmt, args) - -template debug*(frmt: string, args: varargs[string, `$`]) = - ## logs a debug message - log(lvlDebug, frmt, args) - -template info*(frmt: string, args: varargs[string, `$`]) = - ## logs an info message - log(lvlInfo, frmt, args) - -template warn*(frmt: string, args: varargs[string, `$`]) = - ## logs a warning message - log(lvlWarn, frmt, args) - -template error*(frmt: string, args: varargs[string, `$`]) = - ## logs an error message - log(lvlError, frmt, args) - -template fatal*(frmt: string, args: varargs[string, `$`]) = - ## logs a fatal error message - log(lvlFatal, frmt, args) - - -# -------------- - -when isMainModule: - var L = newConsoleLogger() - var fL = newFileLogger("test.log") - fL.fmtStr = verboseFmtStr - handlers.add(L) - handlers.add(fL) - info("hello", []) - - diff --git a/doc/docgen.txt b/doc/docgen.txt new file mode 100644 index 000000000..acd09f2eb --- /dev/null +++ b/doc/docgen.txt @@ -0,0 +1,192 @@ +=================================== + Nimrod DocGen Tools Guide +=================================== + +:Author: Erik O'Leary +:Version: |nimrodversion| + +.. contents:: + + +Introduction +============ + +This document describes the `documentation generation tools`:idx: built into +the `Nimrod compiler <nimrodc.html>`_, which can generate HTML and JSON output +from input .nim files and projects, as well as HTML and LaTeX from input RST +(reStructuredText) files. The output documentation will include module +dependencies (``import``), any top-level documentation comments (##), and +exported symbols (*), including procedures, types, and variables. + + +Documentation Comments +---------------------- + +Any comments which are preceded by a double-hash (##), are interpreted as +documentation. Comments are parsed as RST (see `reference +<http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_), providing +Nimrod module authors the ability to easily generate richly formatted +documentation with only their well-documented code. + +Example: + +.. code-block:: nimrod + type TPerson* = object + ## This type contains a description of a person + name: string + age: int + +Outputs:: + TPerson* = object + name: string + age: int + +This type contains a description of a person + +Field documentation comments can be added to fields like so: + +.. code-block:: nimrod + var numValues: int ## \ + ## `numValues` stores the number of values + +Note that without the `*` following the name of the type, the documentation for +this type would not be generated. Documentation will only be generated for +*exported* types/procedures/etc. + + +Nimrod file input +----------------- + +The following examples will generate documentation for the below contrived +*Nimrod* module, aptly named 'sample.nim' + +sample.nim: + +.. code-block:: nimrod + ## This module is a sample. + + import strutils + + proc helloWorld*(times: int) = + ## Takes an integer and outputs + ## as many "hello world!"s + + for i in 0 .. times-1: + echo "hello world!" + + helloWorld(5) + + +Document Types +============== + + +HTML +---- + +Generation of HTML documents is done via both the ``doc`` and ``doc2`` +commands. These command take either a single .nim file, outputting a single +.html file with the same base filename, or multiple .nim files, outputting +multiple .html files and, optionally, an index file. + +The ``doc`` command:: + nimrod doc sample + +Partial Output:: + ... + proc helloWorld*(times: int) + ... + +Output can be viewed in full here: `docgen_sample.html <docgen_sample.html>`_. +The next command, called ``doc2``, is very similar to the ``doc`` command, but +will be run after the compiler performs semantic checking on the input nimrod +module(s), which allows it to process macros. + +The ``doc2`` command:: + nimrod doc2 sample + +Partial Output:: + ... + proc helloWorld(times: int) {.raises: [], tags: [].} + ... + +The full output can be seen here: `docgen_sample2.html <docgen_sample2.html>`_. +As you can see, the tool has extracted additional information provided to it by +the compiler beyond what the ``doc`` command provides, such as pragmas attached +implicitly by the compiler. This type of information is not available from +looking at the AST (Abstract Syntax Tree) prior to semantic checking, as the +``doc`` command does. + + +JSON +---- + +Generation of JSON documents is done via the ``jsondoc`` command. This command +takes in a .nim file, and outputs a .json file with the same base filename. +Note that this tool is built off of the ``doc`` command, and therefore is +performed before semantic checking. + +The ``jsondoc`` command:: + nimrod jsondoc sample + +Output:: + [ + { + "comment": "This module is a sample." + }, + { + "name": "helloWorld", + "type": "skProc", + "description": "Takes an integer and outputs as many "hello world!"s", + "code": "proc helloWorld*(times: int)" + } + ] + + +Related Options +=============== + +``--project`` switch +:: + nimrod doc2 --project sample + +This will recursively generate documentation of all nimrod modules imported +into the input module, including system modules. Be careful with this command, +as it may end up sprinkling html files all over your filesystem! + + +``--index`` switch +:: + nimrod doc2 --index:on sample + +This will generate an index of all the exported symbols in the input Nimrod +module, and put it into a neighboring file with the extension of `.idx`. + + +Other Input Formats +=================== + +The *Nimrod compiler* also has support for RST (reStructuredText) files with +the ``rst2html`` and ``rst2tex`` commands. Documents like this one are +initially written in a dialect of RST which adds support for nimrod sourcecode +highlighting with the ``.. code-block:: nimrod`` prefix. ``code-block`` also +supports highlighting of C++ and some other c-like languages. + +Usage:: + nimrod rst2html docgen.txt + +Output:: + You're reading it! + +The input can be viewed here `docgen.txt <docgen.txt>`_. The ``rst2tex`` +command is invoked identically to ``rst2html``, but outputs a .tex file instead +of .html. + + +Additional Resources +========= + +`Nimrod Compiler User Guide <nimrodc.html#command-line-switches>`_ + +`RST Quick Reference +<http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ diff --git a/doc/docgen_sample.nim b/doc/docgen_sample.nim new file mode 100644 index 000000000..875993187 --- /dev/null +++ b/doc/docgen_sample.nim @@ -0,0 +1,12 @@ +## This module is a sample. + +import strutils + +proc helloWorld*(times: int) = + ## Takes an integer and outputs + ## as many "hello world!"s + + for i in 0 .. times-1: + echo "hello world!" + +helloWorld(5) diff --git a/doc/gc.txt b/doc/gc.txt index 854f9ce2a..18fb03b6d 100644 --- a/doc/gc.txt +++ b/doc/gc.txt @@ -13,7 +13,7 @@ Introduction This document describes how the GC works and how to tune it for (soft) `realtime systems`:idx:. -The basic algorithm is *Deferrent Reference Counting* with cycle detection. +The basic algorithm is *Deferred Reference Counting* with cycle detection. References on the stack are not counted for better performance (and easier C code generation). The GC **never** scans the whole heap but it may scan the delta-subgraph of the heap that changed since its last run. @@ -107,3 +107,20 @@ that up to 100 objects are traversed and freed before it checks again. Thus ``workPackage`` affects the timing granularity and may need to be tweaked in highly specialized environments or for older hardware. + +Keeping track of memory +----------------------- + +If you need to pass around memory allocated by Nimrod to C, you can use the +procs ``GC_ref`` and ``GC_unref`` to mark objects as referenced to avoid them +being freed by the GC. Other useful procs from `system <system.html>`_ you can +use to keep track of memory are: + +* getTotalMem(): returns the amount of total memory managed by the GC. +* getOccupiedMem(): bytes reserved by the GC and used by objects. +* getFreeMem(): bytes reserved by the GC and not in use. + +In addition to ``GC_ref`` and ``GC_unref`` you can avoid the GC by manually +allocating memory with procs like ``alloc``, ``allocShared``, or +``allocCStringArray``. The GC won't try to free them, you need to call their +respective *dealloc* pairs when you are done with them or they will leak. diff --git a/doc/grammar.txt b/doc/grammar.txt index 7fe2b56aa..63e898e11 100644 --- a/doc/grammar.txt +++ b/doc/grammar.txt @@ -42,14 +42,14 @@ par = '(' optInd (&parKeyw complexOrSimpleStmt ^+ ';' | simpleExpr ('=' expr (';' complexOrSimpleStmt ^+ ';' )? )? | (':' expr)? (',' (exprColonEqExpr comma?)*)? )? optPar ')' +literal = | INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT + | UINT_LIT | UINT8_LIT | UINT16_LIT | UINT32_LIT | UINT64_LIT + | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT + | STR_LIT | RSTR_LIT | TRIPLESTR_LIT + | CHAR_LIT + | NIL generalizedLit = GENERALIZED_STR_LIT | GENERALIZED_TRIPLESTR_LIT -identOrLiteral = generalizedLit | symbol - | INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT - | UINT_LIT | UINT8_LIT | UINT16_LIT | UINT32_LIT | UINT64_LIT - | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT - | STR_LIT | RSTR_LIT | TRIPLESTR_LIT - | CHAR_LIT - | NIL +identOrLiteral = generalizedLit | symbol | literal | par | arrayConstr | setOrTableConstr | castExpr tupleConstr = '(' optInd (exprColonEqExpr comma?)* optPar ')' @@ -59,6 +59,7 @@ primarySuffix = '(' (exprColonEqExpr comma?)* ')' doBlocks? | '.' optInd ('type' | 'addr' | symbol) generalizedLit? | '[' optInd indexExprList optPar ']' | '{' optInd indexExprList optPar '}' + | &( '`'|IDENT|literal|'cast') expr # command syntax condExpr = expr colcom expr optInd ('elif' expr colcom expr optInd)* 'else' colcom expr @@ -95,18 +96,19 @@ primary = typeKeyw typeDescK / 'bind' primary typeDesc = simpleExpr typeDefAux = simpleExpr + | 'generic' typeClass +macroColon = ':' stmt? ( IND{=} 'of' exprList ':' stmt + | IND{=} 'elif' expr ':' stmt + | IND{=} 'except' exprList ':' stmt + | IND{=} 'else' ':' stmt )* exprStmt = simpleExpr (( '=' optInd expr ) / ( expr ^+ comma doBlocks - / ':' stmt? ( IND{=} 'of' exprList ':' stmt - | IND{=} 'elif' expr ':' stmt - | IND{=} 'except' exprList ':' stmt - | IND{=} 'else' ':' stmt )* + / macroColon ))? -moduleName = expr ('as' expr)? -importStmt = 'import' optInd moduleName - ((comma moduleName)* +importStmt = 'import' optInd expr + ((comma expr)* / 'except' optInd (expr ^+ comma)) includeStmt = 'include' optInd expr ^+ comma fromStmt = 'from' moduleName 'import' optInd expr (comma expr)* @@ -161,6 +163,9 @@ objectCase = 'case' identWithPragma ':' typeDesc ':'? COMMENT? objectPart = IND{>} objectPart^+IND{=} DED / objectWhen / objectCase / 'nil' / declColonEquals object = 'object' pragma? ('of' typeDesc)? COMMENT? objectPart +typeClassParam = ('var')? symbol +typeClass = typeClassParam ^* ',' (pragma)? ('of' typeDesc ^* ',')? + &IND{>} stmt distinct = 'distinct' optInd typeDesc typeDef = identWithPragma genericParamList? '=' optInd typeDefAux indAndComment? diff --git a/doc/idetools.txt b/doc/idetools.txt index fdc4ebde6..c1eba9e5f 100644 --- a/doc/idetools.txt +++ b/doc/idetools.txt @@ -8,6 +8,11 @@ .. contents:: +.. raw:: html + <blockquote><p> + "yes, I'm the creator" -- Araq, 2013-07-26 19:28:32. + </p></blockquote> + Nimrod differs from many other compilers in that it is really fast, and being so fast makes it suited to provide external queries for text editors about the source code being written. Through the @@ -522,21 +527,6 @@ At the moment idetools support is still in development so the test suite is not integrated with the main test suite and you have to run it manually. First you have to compile the tester:: - $ cd my/nimrod/checkout - $ nimrod c tests/tester.nim - -Running the tester without parameters will display some options. -To run the caas test suite (and other special tests) you need to -use the `special` command. You need to run this command from the -root of the checkout or it won't be able to open the required files:: - - $ ./tests/tester special - -However this is a roundabout way of running the test suite. You can -also compile and run ``tests/caasdriver.nim`` manually. In fact, -running it manually will allow you to specify special parameters -too. Example:: - $ cd my/nimrod/checkout/tests $ nimrod c caasdriver.nim diff --git a/doc/intern.txt b/doc/intern.txt index 9d9eb66cc..c602e4933 100644 --- a/doc/intern.txt +++ b/doc/intern.txt @@ -215,7 +215,7 @@ Backend issues - Init procs must not be "forgotten" to be called. - Files must not be "forgotten" to be linked. - Anything that is contained in ``nim__dat.c`` is shared between modules - implicitely. + implicitly. - Method dispatchers are global. - DLL loading via ``dlsym`` is global. - Emulated thread vars are global. diff --git a/doc/keywords.txt b/doc/keywords.txt index fa3ce4786..2d18d7969 100644 --- a/doc/keywords.txt +++ b/doc/keywords.txt @@ -7,13 +7,14 @@ finally for from generic if import in include interface is isnot iterator lambda let -macro method mixin using mod +macro method mixin mod nil not notin object of or out proc ptr raise ref return shared shl shr static template try tuple type +using var when while with without xor diff --git a/doc/lib.txt b/doc/lib.txt index 1b004aa9d..3214cdae2 100644 --- a/doc/lib.txt +++ b/doc/lib.txt @@ -64,6 +64,8 @@ Core Collections and algorithms -------------------------- +* `algorithm <algorithm.html>`_ + Implements some common generic algorithms like sort or binary search. * `tables <tables.html>`_ Nimrod hash table support. Contains tables, ordered tables and count tables. * `sets <sets.html>`_ @@ -225,7 +227,12 @@ Parsers ------- * `parseopt <parseopt.html>`_ - The ``parseopt`` module implements a command line option parser. This + The ``parseopt`` module implements a command line option parser. + **Deprecated since version 0.9.3:** Use the `parseopt2 + <parseopt2.html>`_ module instead. + +* `parseopt2 <parseopt2.html>`_ + The ``parseopt2`` module implements a command line option parser. This supports long and short command options with optional values and command line arguments. @@ -334,6 +341,9 @@ Miscellaneous * `endians <endians.html>`_ This module contains helpers that deal with different byte orders. +* `logging <logging.html>`_ + This module implements a simple logger. + Database support ---------------- @@ -379,9 +389,6 @@ Database support * `db_mongo <db_mongo.html>`_ A higher level **mongodb** wrapper. -* `mongodb <mongo.html>`_ - Lower level wrapper for the **mongodb** client C library. - Other ----- @@ -444,45 +451,6 @@ UNIX specific * `posix <posix.html>`_ Contains a wrapper for the POSIX standard. -* `cursorfont <cursorfont.html>`_ - Part of the wrapper for X11. -* `keysym <keysym.html>`_ - Part of the wrapper for X11. -* `x <x.html>`_ - Part of the wrapper for X11. -* `xatom <xatom.html>`_ - Part of the wrapper for X11. -* `xcms <xcms.html>`_ - Part of the wrapper for X11. -* `xf86dga <xf86dga.html>`_ - Part of the wrapper for X11. -* `xf86vmode <xf86vmode.html>`_ - Part of the wrapper for X11. -* `xi <xi.html>`_ - Part of the wrapper for X11. -* `xinerama <xinerama.html>`_ - Part of the wrapper for X11. -* `xkb <xkb.html>`_ - Part of the wrapper for X11. -* `xkblib <xkblib.html>`_ - Part of the wrapper for X11. -* `xlib <xlib.html>`_ - Part of the wrapper for X11. -* `xrandr <xrandr.html>`_ - Part of the wrapper for X11. -* `xrender <xrender.html>`_ - Part of the wrapper for X11. -* `xresource <xresource.html>`_ - Part of the wrapper for X11. -* `xshm <xshm.html>`_ - Part of the wrapper for X11. -* `xutil <xutil.html>`_ - Part of the wrapper for X11. -* `xv <xv.html>`_ - Part of the wrapper for X11. -* `xvlib <xvlib.html>`_ - Part of the wrapper for X11. - * `readline <readline.html>`_ Part of the wrapper for the GNU readline library. * `history <history.html>`_ @@ -503,15 +471,6 @@ Regular expressions Graphics libraries ------------------ -* `cairo <cairo.html>`_ - Wrapper for the cairo library. -* `cairoft <cairoft.html>`_ - Wrapper for the cairoft library. -* `cairowin32 <cairowin32.html>`_ - Wrapper for the cairowin32 library. -* `cairoxlib <cairoxlib.html>`_ - Wrapper for the cairoxlib library. - * `sdl <sdl.html>`_ Part of the wrapper for SDL. * `sdl_gfx <sdl_gfx.html>`_ @@ -527,47 +486,10 @@ Graphics libraries * `smpeg <smpeg.html>`_ Part of the wrapper for SDL. -* `gl <gl.html>`_ - Part of the wrapper for OpenGL. -* `glext <glext.html>`_ - Part of the wrapper for OpenGL. -* `glu <glu.html>`_ - Part of the wrapper for OpenGL. -* `glut <glut.html>`_ - Part of the wrapper for OpenGL. -* `glx <glx.html>`_ - Part of the wrapper for OpenGL. -* `wingl <wingl.html>`_ - Part of the wrapper for OpenGL. - -* `opengl <opengl.html>`_ - New wrapper for OpenGL supporting up to version 4.2. - GUI libraries ------------- -* `atk <atk.html>`_ - Wrapper for the atk library. -* `gdk2 <gdk2.html>`_ - Wrapper for the gdk2 library. -* `gdk2pixbuf <gdk2pixbuf.html>`_ - Wrapper for the gdk2pixbuf library. -* `gdkglext <gdkglext.html>`_ - Wrapper for the gdkglext library. -* `glib2 <glib2.html>`_ - Wrapper for the glib2 library. -* `gtk2 <gtk2.html>`_ - Wrapper for the gtk2 library. -* `gtkglext <gtkglext.html>`_ - Wrapper for the gtkglext library. -* `gtkhtml <gtkhtml.html>`_ - Wrapper for the gtkhtml library. -* `libglade2 <libglade2.html>`_ - Wrapper for the libglade2 library. -* `pango <pango.html>`_ - Wrapper for the pango library. -* `pangoutils <pangoutils.html>`_ - Wrapper for the pangoutils library. + * `iup <iup.html>`_ Wrapper of the IUP GUI library. @@ -581,6 +503,8 @@ Database support Contains a wrapper for the mySQL API. * `sqlite3 <sqlite3.html>`_ Contains a wrapper for SQLite 3 API. +* `mongodb <mongo.html>`_ + Lower level wrapper for the **mongodb** client C library. * `odbcsql <odbcsql.html>`_ interface to the ODBC driver. * `sphinx <sphinx.html>`_ @@ -610,21 +534,6 @@ Network Programming and Internet Protocols Wrapper for OpenSSL. -Scripting languages -------------------- - -* `lua <lua.html>`_ - Part of the wrapper for Lua. -* `lualib <lualib.html>`_ - Part of the wrapper for Lua. -* `lauxlib <lauxlib.html>`_ - Part of the wrapper for Lua. -* `tcl <tcl.html>`_ - Wrapper for the TCL programming language. -* `python <python.html>`_ - Wrapper for the Python programming language. - - Data Compression and Archiving ------------------------------ diff --git a/doc/manual.txt b/doc/manual.txt index c63df0304..520e4f62e 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -12,6 +12,8 @@ Nimrod Manual 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 =================== @@ -312,14 +314,39 @@ Character literals ------------------ Character literals are enclosed in single quotes ``''`` and can contain the -same escape sequences as strings - with one exception: ``\n`` is not allowed -as it may be wider than one character (often it is the pair CR/LF for example). +same escape sequences as strings - with one exception: `newline`:idx: (``\n``) +is not allowed as it may be wider than one character (often it is the pair +CR/LF for example). Here are the valid `escape sequences`:idx: for character +literals: + +================== =================================================== + Escape sequence Meaning +================== =================================================== + ``\r``, ``\c`` `carriage return`:idx: + ``\l`` `line feed`:idx: + ``\f`` `form feed`:idx: + ``\t`` `tabulator`:idx: + ``\v`` `vertical tabulator`:idx: + ``\\`` `backslash`:idx: + ``\"`` `quotation mark`:idx: + ``\'`` `apostrophe`:idx: + ``\`` '0'..'9'+ `character with decimal value d`:idx:; + all decimal digits directly + following are used for the character + ``\a`` `alert`:idx: + ``\b`` `backspace`:idx: + ``\e`` `escape`:idx: `[ESC]`:idx: + ``\x`` HH `character with hex value HH`:idx:; + exactly two hex digits are allowed +================== =================================================== + A character is not an Unicode character but a single byte. The reason for this is efficiency: for the overwhelming majority of use-cases, the resulting programs will still handle UTF-8 properly as UTF-8 was specially designed for -this. -Another reason is that Nimrod can thus support ``array[char, int]`` or -``set[char]`` efficiently as many algorithms rely on this feature. +this. Another reason is that Nimrod can thus 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 in the `unicode module <unicode.html>`_. Numerical constants @@ -750,7 +777,8 @@ 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 in the ``unicode`` module. +character. ``TRune`` is declared in the `unicode module <unicode.html>`_. + @@ -847,8 +875,8 @@ arrays, they can be used in case statements: Per convention, all strings are UTF-8 strings, but this is not enforced. For example, when reading strings from binary files, they are merely a sequence of bytes. The index operation ``s[i]`` means the i-th *char* of ``s``, not the -i-th *unichar*. The iterator ``runes`` from the ``unicode`` -module can be used for iteration over all Unicode characters. +i-th *unichar*. The iterator ``runes`` from the `unicode module +<unicode.html>`_ can be used for iteration over all Unicode characters. CString type @@ -1268,12 +1296,13 @@ exclude ``nil`` as a valid value with the `not nil`:idx: annotation: # compiler catches this: p(nil) - # but not this: + # and also this: var x: PObject p(x) -As shown in the example this is merely an annotation for documentation purposes; -for now the compiler can only catch the most trivial type violations. +The compiler ensures that every code path initializes variables which contain +not nilable pointers. The details of this analysis are still to be specified +here. Procedural type @@ -1286,12 +1315,9 @@ Examples: .. code-block:: nimrod - type - TCallback = proc (x: int) {.cdecl.} - - proc printItem(x: Int) = ... + proc printItem(x: int) = ... - proc forEach(c: TCallback) = + proc forEach(c: proc (x: int) {.cdecl.}) = ... forEach(printItem) # this will NOT work because calling conventions differ @@ -1306,7 +1332,7 @@ Examples: # has default calling convention echo "x: ", mouseX, " y: ", mouseY - proc setOnMouseMove(mouseMoveEvent: TOnMouseMove) = nil + proc setOnMouseMove(mouseMoveEvent: TOnMouseMove) = discard # ok, 'onMouseMove' has the default calling convention, which is compatible # to 'closure': @@ -1452,7 +1478,7 @@ 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 = + template additive(typ: typedesc): stmt = proc `+` *(x, y: typ): typ {.borrow.} proc `-` *(x, y: typ): typ {.borrow.} @@ -1460,26 +1486,26 @@ currency. This can be solved with templates_. proc `+` *(x: typ): typ {.borrow.} proc `-` *(x: typ): typ {.borrow.} - template Multiplicative(typ, base: typedesc): 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: typedesc): stmt = + 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 = + template defineCurrency(typ, base: expr): stmt = type typ* = distinct base - Additive(typ) - Multiplicative(typ, base) - Comparable(typ) + additive(typ) + multiplicative(typ, base) + comparable(typ) - DefineCurrency(TDollar, int) - DefineCurrency(TEuro, int) + defineCurrency(TDollar, int) + defineCurrency(TEuro, int) Void type @@ -1504,8 +1530,8 @@ The ``void`` type is particularly useful for generic code: else: p(x) - proc intProc(x: int) = nil - proc emptyProc() = nil + proc intProc(x: int) = discard + proc emptyProc() = discard callProc[int](intProc, 12) callProc[void](emptyProc) @@ -1767,6 +1793,15 @@ been declared with the `discardable`:idx: pragma: p(3, 4) # now valid +An empty ``discard`` statement is often used as a null statement: + +.. code-block:: nimrod + proc classify(s: string) = + case s[0] + of SymChars, '_': echo "an identifier" + of '0'..'9': echo "a number" + else: discard + Var statement ------------- @@ -1816,7 +1851,7 @@ If a proc is annotated with the ``noinit`` pragma this refers to its implicit ``result`` variable: .. code-block:: nimrod - proc returnUndefinedValue: int {.noinit.} = nil + proc returnUndefinedValue: int {.noinit.} = discard The implicit initialization can be also prevented by the `requiresInit`:idx: @@ -2196,12 +2231,14 @@ Instead of: Using statement --------------- -The using statement provides syntactic convenience for procs that heavily use a -single contextual parameter. When applied to a variable or a constant, it will -instruct Nimrod to automatically consider the used symbol as a hidden leading -parameter for any procedure calls, following the using statement in the current -scope. Thus, it behaves much like the hidden `this` parameter available in some -object-oriented programming languages. +**Warning**: The ``using`` statement is highly experimental! + +The `using statement`:idx: provides syntactic convenience for procs that +heavily use a single contextual parameter. When applied to a variable or a +constant, it will instruct Nimrod to automatically consider the used symbol as +a hidden leading parameter for any procedure calls, following the using +statement in the current scope. Thus, it behaves much like the hidden `this` +parameter available in some object-oriented programming languages. .. code-block:: nimrod @@ -2224,6 +2261,24 @@ from different modules having the same name. import windows, sdl using sdl.SetTimer +Note that ``using`` only *adds* to the current context, it doesn't remove or +replace, **neither** does it create a new scope. What this means is that if one +applies this to multiple variables the compiler will find conflicts in what +variable to use: + +.. code-block:: nimrod + var a, b = "kill it" + using a + add(" with fire") + using b + add(" with water") + echo a + echo b + +When the compiler reaches the second ``add`` call, both ``a`` and ``b`` could +be used with the proc, so one gets ``Error: expression '(a|b)' has no type (or +is ambiguous)``. To solve this you would need to nest ``using`` with a +``block`` statement so as to control the reach of the ``using`` statement. If expression ------------- @@ -2314,8 +2369,8 @@ The `addr`:idx: operator returns the address of an l-value. If the type of the location is ``T``, the `addr` operator result is of the type ``ptr T``. An address is always an untraced reference. Taking the address of an object that resides on the stack is **unsafe**, as the pointer may live longer than the -object on the stack and can thus reference a non-existing object. You can get -the address of variables, but you can't use it on variables declared through +object on the stack and can thus reference a non-existing object. One can get +the address of variables, but one can't use it on variables declared through ``let`` statements: .. code-block:: nimrod @@ -2403,6 +2458,83 @@ notation. (Thus an operator can have more than two parameters): assert `*+`(3, 4, 6) == `*`(a, `+`(b, c)) + +Method call syntax +------------------ + +For object oriented programming, the syntax ``obj.method(args)`` can be used +instead of ``method(obj, args)``. The parentheses can be omitted if there are no +remaining arguments: ``obj.len`` (instead of ``len(obj)``). + +This `method call syntax`:idx: is not restricted to objects, it can be used +to supply any type of first argument for procedures: + +.. code-block:: nimrod + + echo("abc".len) # is the same as echo(len("abc")) + echo("abc".toUpper()) + echo({'a', 'b', 'c'}.card) + stdout.writeln("Hallo") # the same as writeln(stdout, "Hallo") + +Another way to look at the method call syntax is that it provides the missing +postfix notation. + + +Properties +---------- +Nimrod has no need for *get-properties*: Ordinary get-procedures that are called +with the *method call syntax* achieve the same. But setting a value is +different; for this a special setter syntax is needed: + +.. code-block:: nimrod + + type + TSocket* = object of TObject + FHost: int # cannot be accessed from the outside of the module + # the `F` prefix is a convention to avoid clashes since + # the accessors are named `host` + + proc `host=`*(s: var TSocket, value: int) {.inline.} = + ## setter of hostAddr + s.FHost = value + + proc host*(s: TSocket): int {.inline.} = + ## getter of hostAddr + return s.FHost + + var + s: TSocket + s.host = 34 # same as `host=`(s, 34) + + +Command invocation syntax +------------------------- + +Routines can be invoked without the ``()`` if the call is syntatically +a statement. This `command invocation syntax`:idx: also works for +expressions, but then only a single argument may follow. This restriction +means ``echo f 1, f 2`` is parsed as ``echo(f(1), f(2))`` and not as +``echo(f(1, f(2)))``. The method call syntax may be used to provide one +more argument in this case: + +.. code-block:: nimrod + proc optarg(x:int, y:int = 0):int = x + y + proc singlearg(x:int):int = 20*x + + echo optarg 1, " ", singlearg 2 # prints "1 40" + + let fail = optarg 1, optarg 8 # Wrong. Too many arguments for a command call + let x = optarg(1, optarg 8) # traditional procedure call with 2 arguments + let y = 1.optarg optarg 8 # same thing as above, w/o the parenthesis + assert x == y + +The command invocation syntax also can't have complex expressions as arguments. +For example: (`anonymous procs`_), ``if``, ``case`` or ``try``. The (`do +notation`_) is limited, but usable for a single proc (see the example in the +corresponding section). Function calls with no arguments still needs () to +distinguish between a call and the function itself as a first class value. + + Closures -------- @@ -2415,6 +2547,7 @@ the closure and its enclosing scope (i.e. any modifications made to them are visible in both places). The closure environment may be allocated on the heap or on the stack if the compiler determines that this would be safe. + Anonymous Procs --------------- @@ -2441,6 +2574,9 @@ calls can use the ``do`` keyword: .. code-block:: nimrod sort(cities) do (x,y: string) -> int: cmp(x.len, y.len) + # Less parenthesis using the method plus command syntax: + cities = cities.map do (x:string) -> string: + "City of " & x ``do`` is written after the parentheses enclosing the regular proc params. The proc expression represented by the do block is appended to them. @@ -2710,7 +2846,7 @@ First class iterators There are 2 kinds of iterators in Nimrod: *inline* and *closure* iterators. An `inline iterator`:idx: is an iterator that's always inlined by the compiler leading to zero overhead for the abstraction, but may result in a heavy -increasee in code size. Inline iterators are second class +increase in code size. Inline iterators are second class citizens; one cannot pass them around like first class procs. In contrast to that, a `closure iterator`:idx: can be passed around: @@ -2781,7 +2917,24 @@ a `collaborative tasking`:idx: system: The builtin ``system.finished`` can be used to determine if an iterator has finished its operation; no exception is raised on an attempt to invoke an -iterator that has already finished its work. +iterator that has already finished its work. + +Closure iterators are *resumable functions* and so one has to provide the +arguments to every call. To get around this limitation one can capture +parameters of an outer factory proc: + +.. code-block:: nimrod + proc mycount(a, b: int): iterator (): int = + return iterator (): int = + var x = a + while x <= b: + yield x + inc x + + let foo = mycount 1, 4 + + for f in foo(): + echo f Type sections @@ -2869,9 +3022,9 @@ in an implicit try block: finally: close(f) ... -The ``except`` statement has a limitation in this form: you can't specify the -type of the exception, you have to catch everything. Also, if you want to use -both ``finally`` and ``except`` you need to reverse the usual sequence of the +The ``except`` statement has a limitation in this form: one can't specify the +type of the exception, one has to catch everything. Also, if one wants to use +both ``finally`` and ``except`` one needs to reverse the usual sequence of the statements. Example: .. code-block:: nimrod @@ -3207,7 +3360,7 @@ Nimrod also allows for type classes and regular types to be specified as `type constraints`:idx: of the generic type parameter: .. code-block:: nimrod - proc onlyIntOrString[T: int|string](x, y: T) = nil + proc onlyIntOrString[T: int|string](x, y: T) = discard onlyIntOrString(450, 616) # valid onlyIntOrString(5.0, 0.0) # type mismatch @@ -3289,27 +3442,36 @@ Declarative type classes are written in the following form: for value in c: type(value) is T - -The identifiers following the `generic` keyword are treated as variables of -the matched type and the body of the type class consists of arbitrary code that -must be valid under these circumstances. - -Specifically, the type class will be matched if: +The type class will be matched if: a) all of the expressions within the body can be compiled for the tested type b) all statically evaluatable boolean expressions in the body must be true -Please note that the ``is`` operator allows you to easily verify the precise type -signatures of the required operations, but since type inference and default -parameters are still applied in the provided block, it's also possible to encode -usage protocols that doesn't reveal implementation details. +The identifiers following the `generic` keyword represent instances of the +currently matched type. These instances can act both as variables of the type, +when used in contexts, where a value is expected, and as the type itself, when +used in a contexts, where a type is expected. + +Please note that the ``is`` operator allows one to easily verify the precise +type signatures of the required operations, but since type inference and +default parameters are still applied in the provided block, it's also possible +to encode usage protocols that doesn't reveal implementation details. + +As a special rule providing further convenience when writing type classes, any +type value appearing in a callable expression will be treated as a variable of +the designated type for overload resolution purposes, unless the type value was +passed in its explicit ``typedesc[T]`` form: + +.. code-block:: nimrod + type + OutputStream = generic S + write(var S, string) Much like generics, the user defined type classes will be instantiated exactly once for each tested type and any static code included within them will also be executed once. - Return Type Inference --------------------- @@ -3360,13 +3522,41 @@ A symbol can be forced to be open by a `mixin`:idx: declaration: .. code-block:: nimrod proc create*[T](): ref T = - # there is no overloaded 'mixin' here, so we need to state that it's an + # there is no overloaded 'init' here, so we need to state that it's an # open symbol explicitly: mixin init new result init result +Bind statement +-------------- + +The `bind`:idx: statement is the counterpart to the ``mixin`` statement. It +can be used to explicitly declare identifiers that should be bound early (i.e. +the identifiers should be looked up in the scope of the template/generic +definition): + +.. code-block:: nimrod + # Module A + var + lastId = 0 + + template genId*: expr = + bind lastId + inc(lastId) + lastId + +.. code-block:: nimrod + # Module B + import A + + echo genId() + +But a ``bind`` is rarely useful because symbol binding from the definition +scope is the default. + + Templates ========= @@ -3426,28 +3616,6 @@ receive undeclared identifiers: declareInt(x) # valid -Scoping in templates --------------------- - -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 {.immediate.} = - var x: t - - template declareInNewScope(x: expr, t: typedesc): stmt {.immediate.} = - # 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 - - Passing a code block to a template ---------------------------------- @@ -3458,50 +3626,28 @@ special ``:`` syntax: .. code-block:: nimrod template withFile(f, fn, mode: expr, actions: stmt): stmt {.immediate.} = - block: - var f: TFile - if open(f, fn, mode): - try: - actions - finally: - close(f) - else: - quit("cannot open: " & fn) + 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. - -**Note:** The symbol binding rules for templates might change! +parameter. -Symbol binding within templates happens after template instantiation: -.. code-block:: nimrod - # Module A - var - lastId = 0 - - template genId*: expr = - inc(lastId) - lastId - -.. code-block:: nimrod - # Module B - import A - - echo genId() # Error: undeclared identifier: 'lastId' - - -Bind statement --------------- +Symbol binding in templates +--------------------------- -Exporting a template is a often a leaky abstraction as it can depend on -symbols that are not visible from a client module. However, to compensate for -this case, a `bind`:idx: statement can be used: It declares all identifiers -that should be bound early (i.e. when the template is parsed): +A template is a `hygienic`:idx: macro and so opens a new scope. Most symbols are +bound from the definition scope of the template: .. code-block:: nimrod # Module A @@ -3509,7 +3655,6 @@ that should be bound early (i.e. when the template is parsed): lastId = 0 template genId*: expr = - bind lastId inc(lastId) lastId @@ -3517,9 +3662,11 @@ that should be bound early (i.e. when the template is parsed): # Module B import A - echo genId() # Works + echo genId() # Works as 'lastId' has been bound in 'genId's defining scope + +As in generics symbol binding can be influenced via ``mixin`` or ``bind`` +statements. -A ``bind`` statement can also be used in generics for the same purpose. Identifier construction @@ -3773,7 +3920,7 @@ regular expressions: macro case_token(n: stmt): stmt = # creates a lexical analyzer from regular expressions # ... (implementation is an exercise for the reader :-) - nil + discard case_token: # this colon tells the parser it is a macro statement of r"[A-Za-z_]+[A-Za-z_0-9]*": @@ -3802,22 +3949,76 @@ Whole routines (procs, iterators etc.) can also be passed to a template or a macro via the pragma notation: .. code-block:: nimrod - template m(s: stmt) = nil + template m(s: stmt) = discard - proc p() {.m.} = nil + proc p() {.m.} = discard This is a simple syntactic transformation into: .. code-block:: nimrod - template m(s: stmt) = nil + template m(s: stmt) = discard m: - proc p() = nil + proc p() = discard Special Types ============= +static[T] +--------- + +As their name suggests, static params must be known at compile-time: + +.. code-block:: nimrod + + proc precompiledRegex(pattern: static[string]): TRegEx = + var res {.global.} = re(pattern) + return res + + precompiledRegex("/d+") # Replaces the call with a precompiled + # regex, stored in a global variable + + precompiledRegex(paramStr(1)) # Error, command-line options + # are not known at compile-time + + +For the purposes of code generation, all static params are treated as +generic params - the proc will be compiled separately for each unique +supplied value (or combination of values). + +Furthermore, the system module defines a `semistatic[T]` type than can be +used to declare procs accepting both static and run-time values, which can +optimize their body according to the supplied param using the `isStatic(p)` +predicate: + +.. code-block:: nimrod + + # The following proc will be compiled once for each unique static + # value and also once for the case handling all run-time values: + + proc re(pattern: semistatic[string]): TRegEx = + when isStatic(pattern): + return precompiledRegex(pattern) + else: + return compile(pattern) + +Static params can also appear in the signatures of generic types: + +.. code-block:: nimrod + + type + Matrix[M,N: static[int]; T: Number] = array[0..(M*N - 1), T] + # Note how `Number` is just a type constraint here, while + # `static[int]` requires us to supply a compile-time int value + + AffineTransform2D[T] = Matrix[3, 3, T] + AffineTransform3D[T] = Matrix[4, 4, T] + + AffineTransform3D[float] # OK + AffineTransform2D[string] # Error, `string` is not a `Number` + + typedesc -------- @@ -4133,9 +4334,9 @@ all the arguments, but also the matched operators in reverse polish notation: TMatrix = object dummy: int - proc `*`(a, b: TMatrix): TMatrix = nil - proc `+`(a, b: TMatrix): TMatrix = nil - proc `-`(a, b: TMatrix): TMatrix = nil + proc `*`(a, b: TMatrix): TMatrix = discard + proc `+`(a, b: TMatrix): TMatrix = discard + proc `-`(a, b: TMatrix): TMatrix = discard proc `$`(a: TMatrix): string = result = $a.dummy proc mat21(): TMatrix = result.dummy = 21 @@ -4551,10 +4752,16 @@ These rules ensure that the construction is tied to a variable and can easily be destructed at its scope exit. Later versions of the language will improve the support of destructors. +Be aware that destructors are not called for objects allocated with ``new``. +This may change in future versions of language, but for now use +the ``finalizer`` parameter to ``new``. + delegator pragma ---------------- +**Note**: The design of the delegator feature is subject to change. + The delegator pragma can be used to intercept and rewrite proc call and field access attempts referring to previously undeclared symbol names. It can be used to provide a fluent interface to objects lying outside the static confines of @@ -4699,7 +4906,11 @@ fatal pragma ------------ The `fatal`:idx: pragma is used to make the compiler output an error message with the given content. In contrast to the ``error`` pragma, compilation -is guaranteed to be aborted by this pragma. +is guaranteed to be aborted by this pragma. Example: + +.. code-block:: nimrod + when not defined(objc): + {.fatal: "Compile this program with the objc command!".} warning pragma -------------- @@ -5033,9 +5244,9 @@ the same feature under the same name. Exportc pragma -------------- The `exportc`:idx: pragma provides a means to export a type, a variable, or a -procedure to C. The optional argument is a string containing the C identifier. -If the argument is missing, the C name is the Nimrod -identifier *exactly as spelled*: +procedure to C. Enums and constants can't be exported. The optional argument +is a string containing the C identifier. If the argument is missing, the C +name is the Nimrod identifier *exactly as spelled*: .. code-block:: Nimrod proc callme(formatstr: cstring) {.exportc: "callMe", varargs.} @@ -5044,6 +5255,18 @@ Note that this pragma is somewhat of a misnomer: Other backends will provide the same feature under the same name. +Extern pragma +------------- +Like ``exportc`` or ``importc`` the `extern`:idx: pragma affects name +mangling. The string literal passed to ``extern`` can be a format string: + +.. code-block:: Nimrod + proc p(s: string) {.extern: "prefix$1".} = + echo s + +In the example the external name of ``p`` is set to ``prefixp``. + + Bycopy pragma ------------- diff --git a/doc/nimrodc.txt b/doc/nimrodc.txt index d494a0922..52e0a6eaf 100644 --- a/doc/nimrodc.txt +++ b/doc/nimrodc.txt @@ -468,6 +468,19 @@ proc is declared in the generated code: proc myinterrupt() {.codegenDecl: "__interrupt $# $#$#".} = echo "realistic interrupt handler" + + +InjectStmt pragma +----------------- + +The `injectStmt`:idx: pragma can be used to inject a statement before every +other statement in the current module. It is only supposed to be used for +debugging: + +.. code-block:: nimrod + {.injectStmt: gcInvariants().} + + # ... complex code here that produces crashes ... LineDir option @@ -525,6 +538,13 @@ on Linux:: nimrod c --dynlibOverride:lua --passL:liblua.lib program.nim +Nimrod documentation tools +========================== + +Nimrod provides the `doc`:idx: and `doc2`:idx: commands to generate HTML +documentation from ``.nim`` source files. Only exported symbols will appear in +the output. For more details `see the docgen documentation <docgen.html>`_. + Nimrod idetools integration =========================== diff --git a/doc/subexes.txt b/doc/subexes.txt index 3565dbf43..10e0f4cc1 100644 --- a/doc/subexes.txt +++ b/doc/subexes.txt @@ -14,7 +14,9 @@ Thanks to its conditional construct ``$[0|1|2|else]`` it supports Notation meaning ===================== ===================================================== ``$#`` use first or next argument -``$name`` use named argument +``$name`` use named argument, you can wrap the named argument + in curly braces (eg. ``${name}``) to separate it from + the next characters. ``$1`` use first argument ``$-1`` use last argument ``${1..3}`` use arguments 1 to 3 diff --git a/doc/tut1.txt b/doc/tut1.txt index 0cc9b05c1..b70f40f4a 100644 --- a/doc/tut1.txt +++ b/doc/tut1.txt @@ -189,9 +189,24 @@ to a storage location: var x = "abc" # introduces a new variable `x` and assigns a value to it x = "xyz" # assigns a new value to `x` -``=`` is the *assignment operator*. The assignment operator cannot -be overloaded, overwritten or forbidden, but this might change in a future -version of Nimrod. +``=`` is the *assignment operator*. The assignment operator cannot be +overloaded, overwritten or forbidden, but this might change in a future version +of Nimrod. You can declare multiple variables with a single assignment +statement and all the variables will have the same value: + +.. code-block:: + var x, y = 3 # assigns 3 to the variables `x` and `y` + echo "x ", x # outputs "x 3" + echo "y ", y # outputs "y 3" + x = 42 # changes `x` to 42 without changing `y` + echo "x ", x # outputs "x 42" + echo "y ", y # outputs "y 3" + +Note that declaring multiple variables with a single assignment which calls a +procedure can have unexpected results: the compiler will *unroll* the +assignments and end up calling the procedure several times. If the result of +the procedure depends on side effects, your variables may end up having +different values! For safety use only constant values. Constants @@ -309,12 +324,12 @@ the compiler that for every other value nothing should be done: case n of 0..2, 4..7: echo("The number is in the set: {0, 1, 2, 4, 5, 6, 7}") of 3, 8: echo("The number is 3 or 8") - else: nil + else: discard -The ``nil`` statement is a *do nothing* statement. The compiler knows that a -case statement with an else part cannot fail and thus the error disappears. Note -that it is impossible to cover all possible string values: that is why there is -no such check for string cases. +The empty ``discard`` statement is a *do nothing* statement. The compiler knows +that a case statement with an else part cannot fail and thus the error +disappears. Note that it is impossible to cover all possible string values: +that is why there is no such check for string cases. In general the case statement is used for subrange types or enumerations where it is of great help that the compiler checks that you covered any possible @@ -610,7 +625,7 @@ allow to silently throw away a return value: discard yes("May I ask a pointless question?") -The return value can be ignored implicitely if the called proc/iterator has +The return value can be ignored implicitly if the called proc/iterator has been declared with the ``discardable`` pragma: .. code-block:: nimrod @@ -798,7 +813,11 @@ important differences: However, you can also use a ``closure`` iterator to get a different set of restrictions. See `first class iterators <manual.html#first-class-iterators>`_ -for details. +for details. Iterators can have the same name and parameters as a proc, +essentially they have their own namespace. Therefore it is common practice to +wrap iterators in procs of the same name which accumulate the result of the +iterator and return it as a sequence, like ``split`` from the `strutils module +<strutils.html>`_. Basic types @@ -1077,7 +1096,7 @@ can also be used to include elements (and ranges of elements): TCharSet = set[char] var x: TCharSet - x = {'a'..'z', '0'..'9'} # This constructs a set that conains the + x = {'a'..'z', '0'..'9'} # This constructs a set that contains the # letters from 'a' to 'z' and the digits # from '0' to '9' @@ -1201,7 +1220,7 @@ to specify a range from zero to the specified index minus one: Sequences --------- `Sequences`:idx: are similar to arrays but of dynamic length which may change -during runtime (like strings). Since sequences are resizeable they are always +during runtime (like strings). Since sequences are resizable they are always allocated on the heap and garbage collected. Sequences are always indexed with an ``int`` starting at position 0. @@ -1302,6 +1321,30 @@ In this example ``$`` is applied to any argument that is passed to the parameter ``a``. Note that ``$`` applied to strings is a nop. +Slices +------ + +Slices look similar to subranges types in syntax but are used in a different +context. A slice is just an object of type TSlice which contains two bounds, +`a` and `b`. By itself a slice is not very useful, but other collection types +define operators which accept TSlice objects to define ranges. + +.. code-block:: nimrod + + var + a = "Nimrod is a progamming language" + b = "Slices are useless." + + echo a[10..15] # --> 'a prog' + b[11.. -2] = "useful" + echo b # --> 'Slices are useful.' + +In the previous example slices are used to modify a part of a string, and even +a negative index is used. The slice's bounds can hold any value supported by +their type, but it is the proc using the slice object which defines what values +are accepted. + + Tuples ------ @@ -1352,6 +1395,45 @@ Even though you don't need to declare a type for a tuple to use it, tuples created with different field names will be considered different objects despite having the same field types. +Tuples can be *unpacked* during variable assignment (and only then!). This can +be handy to assign directly the fields of the tuples to individually named +variables. An example of this is the ``splitFile`` proc from the `os module +<os.html>`_ which returns the directory, name and extension of a path at the +same time. For tuple unpacking to work you have to use parenthesis around the +values you want to assign the unpacking to, otherwise you will be assigning the +same value to all the individual variables! Example: + +.. code-block:: nimrod + + import os + + let + path = "usr/local/nimrodc.html" + (dir, name, ext) = splitFile(path) + baddir, badname, badext = splitFile(path) + echo dir # outputs `usr/local` + echo name # outputs `nimrodc` + echo ext # outputs `.html` + # All the following output the same line: + # `(dir: usr/local, name: nimrodc, ext: .html)` + echo baddir + echo badname + echo badext + +Tuple unpacking **only** works in ``var`` or ``let`` blocks. The following code +won't compile: + +.. code-block:: nimrod + + import os + + var + path = "usr/local/nimrodc.html" + dir, name, ext = "" + + (dir, name, ext) = splitFile(path) + # --> Error: '(dir, name, ext)' cannot be assigned to + Reference and pointer types --------------------------- @@ -1534,6 +1616,17 @@ rules apply: write(stdout, x(3)) # ambiguous: which `x` is to call? +Excluding symbols +----------------- + +The normal ``import`` statement will bring in all exported symbols. +These can be limited by naming symbols which should be excluded with +the ``except`` qualifier. + +.. code-block:: nimrod + import mymodule except y + + From statement -------------- @@ -1544,10 +1637,34 @@ exported symbols. An alternative that only imports listed symbols is the .. code-block:: nimrod from mymodule import x, y, z +The ``from`` statement can also force namespace qualification on +symbols, thereby making symbols available, but needing to be qualified +to be used. + +.. code-block:: nimrod + from mymodule import x, y, z + + x() # use x without any qualification + +.. code-block:: nimrod + from mymodule import nil + + mymodule.x() # must qualify x with the module name as prefix + + x() # using x here without qualification is a compile error + +Since module names are generally long to be descriptive, you can also +define a shorter alias to use when qualifying symbols. + +.. code-block:: nimrod + from mymodule as m import nil + + m.x() # m is aliasing mymodule + Include statement ----------------- -The `include`:idx: statement does something fundametally different than +The `include`:idx: statement does something fundamentally different than importing a module: it merely includes the contents of a file. The ``include`` statement is useful to split up a large module into several files: diff --git a/doc/tut2.txt b/doc/tut2.txt index e1e36bfc4..6738c5551 100644 --- a/doc/tut2.txt +++ b/doc/tut2.txt @@ -16,9 +16,9 @@ Introduction This document is a tutorial for the advanced constructs of the *Nimrod* -programming language. **Note that this document is somewhat obsolete as -the `manual <manual.html>`_ contains many more examples of the advanced -language features.** +programming language. **Note that this document is somewhat obsolete as the** +`manual <manual.html>`_ **contains many more examples of the advanced language +features.** Pragmas @@ -77,7 +77,7 @@ section. Inheritance is done with the ``object of`` syntax. Multiple inheritance is currently not supported. If an object type has no suitable ancestor, ``TObject`` can be used as its ancestor, but this is only a convention. Objects that have -no ancestor are implicitely ``final``. You can use the ``inheritable`` pragma +no ancestor are implicitly ``final``. You can use the ``inheritable`` pragma to introduce new object roots apart from ``system.TObject``. (This is used in the GTK wrapper for instance.) @@ -528,7 +528,7 @@ containers: 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]) = # insert a node into the tree @@ -569,7 +569,7 @@ containers: var root: PBinaryTree[string] # instantiate a PBinaryTree with ``string`` - add(root, newNode("hallo")) # instantiates ``newNode`` and ``add`` + add(root, newNode("hello")) # instantiates ``newNode`` and ``add`` add(root, "world") # instantiates the second ``add`` proc for str in preorder(root): stdout.writeln(str) @@ -614,7 +614,7 @@ simple proc for logging: .. code-block:: nimrod const - debug = True + debug = true proc log(msg: string) {.inline.} = if debug: stdout.writeln(msg) @@ -631,7 +631,7 @@ Turning the ``log`` proc into a template solves this problem: .. code-block:: nimrod const - debug = True + debug = true template log(msg: string) = if debug: stdout.writeln(msg) @@ -674,16 +674,15 @@ via a special ``:`` syntax: template withFile(f: expr, filename: string, mode: TFileMode, body: stmt): stmt {.immediate.} = - block: - let fn = filename - var f: TFile - if open(f, fn, mode): - try: - body - finally: - close(f) - else: - quit("cannot open: " & fn) + let fn = filename + var f: TFile + if open(f, fn, mode): + try: + body + finally: + close(f) + else: + quit("cannot open: " & fn) withFile(txt, "ttempl3.txt", fmWrite): txt.writeln("line 1") @@ -699,15 +698,22 @@ once. Macros ====== -Macros enable advanced compile-time code transformations, but they -cannot change Nimrod's syntax. However, this is no real restriction because -Nimrod's syntax is flexible enough anyway. - -To write a macro, one needs to know how the Nimrod concrete syntax is converted -to an abstract syntax tree (AST). The AST is documented in the -`macros <macros.html>`_ module. - -There are two ways to invoke a macro: +Macros enable advanced compile-time code transformations, but they cannot +change Nimrod's syntax. However, this is no real restriction because Nimrod's +syntax is flexible enough anyway. Macros have to be implemented in pure Nimrod +code if `foreign function interface (FFI) +<manual.html#foreign-function-interface>`_ is not enabled in the compiler, but +other than that restriction (which at some point in the future will go away) +you can write any kind of Nimrod code and the compiler will run it at compile +time. + +There are two ways to write a macro, either *generating* Nimrod source code and +letting the compiler parse it, or creating manually an abstract syntax tree +(AST) which you feed to the compiler. In order to build the AST one needs to +know how the Nimrod concrete syntax is converted to an abstract syntax tree +(AST). The AST is documented in the `macros <macros.html>`_ module. + +Once your macro is finished, there are two ways to invoke it: (1) invoking a macro like a procedure call (`expression macros`:idx:) (2) invoking a macro with the special ``macrostmt`` syntax (`statement macros`:idx:) @@ -777,7 +783,7 @@ regular expressions: macro case_token(n: stmt): stmt = # creates a lexical analyzer from regular expressions # ... (implementation is an exercise for the reader :-) - nil + discard case_token: # this colon tells the parser it is a macro statement of r"[A-Za-z_]+[A-Za-z_0-9]*": @@ -796,3 +802,249 @@ Term rewriting macros Term rewriting macros can be used to enhance the compilation process with user defined optimizations; see this `document <trmacros.html>`_ for further information. + + +Building your first macro +------------------------- + +To give a footstart to writing macros we will show now how to turn your typical +dynamic code into something that compiles statically. For the exercise we will +use the following snippet of code as the starting point: + +.. code-block:: nimrod + + import strutils, tables + + proc readCfgAtRuntime(cfgFilename: string): TTable[string, string] = + let + inputString = readFile(cfgFilename) + var + source = "" + + result = initTable[string, string]() + for line in inputString.splitLines: + # Ignore empty lines + if line.len < 1: continue + var chunks = split(line, ',') + if chunks.len != 2: + quit("Input needs comma split values, got: " & line) + result[chunks[0]] = chunks[1] + + if result.len < 1: quit("Input file empty!") + + let info = readCfgAtRuntime("data.cfg") + + when isMainModule: + echo info["licenseOwner"] + echo info["licenseKey"] + echo info["version"] + +Presumably this snippet of code could be used in a commercial software, reading +a configuration file to display information about the person who bought the +software. This external file would be generated by an online web shopping cart +to be included along the program containing the license information:: + + version,1.1 + licenseOwner,Hyori Lee + licenseKey,M1Tl3PjBWO2CC48m + +The ``readCfgAtRuntime`` proc will open the given filename and return a +``TTable`` from the `tables module <tables.html>`_. The parsing of the file is +done (without much care for handling invalid data or corner cases) using the +``splitLines`` proc from the `strutils module <strutils.html>`_. There are many +things which can fail; mind the purpose is explaining how to make this run at +compile time, not how to properly implement a DRM scheme. + +The reimplementation of this code as a compile time proc will allow us to get +rid of the ``data.cfg`` file we would need to distribute along the binary, plus +if the information is really constant, it doesn't make from a logical point of +view to have it *mutable* in a global variable, it would be better if it was a +constant. Finally, and likely the most valuable feature, we can implement some +verification at compile time. You could think of this as a *better unit +testing*, since it is impossible to obtain a binary unless everything is +correct, preventing you to ship to users a broken program which won't start +because a small critical file is missing or its contents changed by mistake to +something invalid. + + +Generating source code +++++++++++++++++++++++ + +Our first attempt will start by modifying the program to generate a compile +time string with the *generated source code*, which we then pass to the +``parseStmt`` proc from the `macros module <macros.html>`_. Here is the +modified source code implementing the macro: + +.. code-block:: nimrod + import macros, strutils + + macro readCfgAndBuildSource(cfgFilename: string): stmt = + let + inputString = slurp(cfgFilename.strVal) + var + source = "" + + for line in inputString.splitLines: + # Ignore empty lines + if line.len < 1: continue + var chunks = split(line, ',') + if chunks.len != 2: + error("Input needs comma split values, got: " & line) + source &= "const cfg" & chunks[0] & "= \"" & chunks[1] & "\"\n" + + if source.len < 1: error("Input file empty!") + result = parseStmt(source) + + readCfgAndBuildSource("data.cfg") + + when isMainModule: + echo cfglicenseOwner + echo cfglicenseKey + echo cfgversion + +The good news is not much has changed! First, we need to change the handling of +the input parameter. In the dynamic version the ``readCfgAtRuntime`` proc +receives a string parameter. However, in the macro version it is also declared +as string, but this is the *outside* interface of the macro. When the macro is +run, it actually gets a ``PNimrodNode`` object instead of a string, and we have +to call the ``strVal`` proc from the `macros module <macros.html>`_ to obtain +the string being passed in to the macro. + +Second, we cannot use the ``readFile`` proc from the `system module +<system.html>`_ due to FFI restriction at compile time. If we try to use this +proc, or any other which depends on FFI, the compiler will error with the +message ``cannot evaluate`` and a dump of the macro's source code, along with a +stack trace where the compiler reached before bailing out. We can get around +this limitation by using the ``slurp`` proc from the `system module +<system.html>`_, which was precisely made for compilation time (just like +``gorge`` which executes an external program and captures its output). + +The interesting thing is that our macro does not return a runtime ``TTable`` +object. Instead, it builds up Nimrod source code into the ``source`` variable. +For each line of the configuration file a ``const`` variable will be generated. +To avoid conflicts we prefix these variables with ``cfg``. In essence, what the +compiler is doing is replacing the line calling the macro with the following +snippet of code: + +.. code-block:: nimrod + const cfgversion= "1.1" + const cfglicenseOwner= "Hyori Lee" + const cfglicenseKey= "M1Tl3PjBWO2CC48m" + +You can verify this yourself adding the line ``echo source`` somewhere at the +end of the macro and compiling the program. Another difference is that instead +of calling the usual ``quit`` proc to abort (which we could still call) this +version calls the ``error`` proc. The ``error`` proc has the same behavior as +``quit`` but will dump also the source and file line information where the +error happened, making it easier for the programmer to find where compilation +failed. In this situation it would point to the line invoking the macro, but +**not** the line of ``data.cfg`` we are processing, that's something the macro +itself would need to control. + + +Generating AST by hand +++++++++++++++++++++++ + +To generate an AST we would need to intimately know the structures used by the +Nimrod compiler exposed in the `macros module <macros.html>`_, which at first +look seems a daunting task. But we can use as helper shortcut the ``dumpTree`` +macro, which is used as a statement macro instead of an expression macro. +Since we know that we want to generate a bunch of ``const`` symbols we can +create the following source file and compile it to see what the compiler +*expects* from us: + +.. code-block:: nimrod + import macros + + dumpTree: + const cfgversion: string = "1.1" + const cfglicenseOwner= "Hyori Lee" + const cfglicenseKey= "M1Tl3PjBWO2CC48m" + +During compilation of the source code we should see the following lines in the +output (again, since this is a macro, compilation is enough, you don't have to +run any binary):: + + StmtList + ConstSection + ConstDef + Ident !"cfgversion" + Ident !"string" + StrLit 1.1 + ConstSection + ConstDef + Ident !"cfglicenseOwner" + Empty + StrLit Hyori Lee + ConstSection + ConstDef + Ident !"cfglicenseKey" + Empty + StrLit M1Tl3PjBWO2CC48m + +With this output we have a better idea of what kind of input the compiler +expects. We need to generate a list of statements. For each constant the source +code generates a ``ConstSection`` and a ``ConstDef``. If we were to move all +the constants to a single ``const`` block we would see only a single +``ConstSection`` with three children. + +Maybe you didn't notice, but in the ``dumpTree`` example the first constant +explicitly specifies the type of the constant. That's why in the tree output +the two last constants have their second child ``Empty`` but the first has a +string identifier. So basically a ``const`` definition is made up from an +identifier, optionally a type (can be an *empty* node) and the value. Armed +with this knowledge, let's look at the finished version of the AST building +macro: + +.. code-block:: nimrod + import macros, strutils + + macro readCfgAndBuildAST(cfgFilename: string): stmt = + let + inputString = slurp(cfgFilename.strVal) + + result = newNimNode(nnkStmtList) + for line in inputString.splitLines: + # Ignore empty lines + if line.len < 1: continue + var chunks = split(line, ',') + if chunks.len != 2: + error("Input needs comma split values, got: " & line) + var + section = newNimNode(nnkConstSection) + constDef = newNimNode(nnkConstDef) + constDef.add(newIdentNode("cfg" & chunks[0])) + constDef.add(newEmptyNode()) + constDef.add(newStrLitNode(chunks[1])) + section.add(constDef) + result.add(section) + + if result.len < 1: error("Input file empty!") + + readCfgAndBuildAST("data.cfg") + + when isMainModule: + echo cfglicenseOwner + echo cfglicenseKey + echo cfgversion + +Since we are building on the previous example generating source code, we will +only mention the differences to it. Instead of creating a temporary ``string`` +variable and writing into it source code as if it were written *by hand*, we +use the ``result`` variable directly and create a statement list node +(``nnkStmtList``) which will hold our children. + +For each input line we have to create a constant definition (``nnkConstDef``) +and wrap it inside a constant section (``nnkConstSection``). Once these +variables are created, we fill them hierarchichally like the previous AST dump +tree showed: the constant definition is a child of the section definition, and +the constant definition has an identifier node, an empty node (we let the +compiler figure out the type), and a string literal with the value. + +A last tip when writing a macro: if you are not sure the AST you are building +looks ok, you may be tempted to use the ``dumpTree`` macro. But you can't use +it *inside* the macro you are writting/debugging. Instead ``echo`` the string +generated by ``treeRepr``. If at the end of the this example you add ``echo +treeRepr(result)`` you should get the same output as using the ``dumpTree`` +macro, but of course you can call that at any point of the macro where you +might be having troubles. diff --git a/examples/cairoex.nim b/examples/cairoex.nim deleted file mode 100644 index 492428705..000000000 --- a/examples/cairoex.nim +++ /dev/null @@ -1,15 +0,0 @@ -import cairo - -var surface = image_surface_create(FORMAT_ARGB32, 240, 80) -var cr = create(surface) - -select_font_face(cr, "serif", FONT_SLANT_NORMAL, - FONT_WEIGHT_BOLD) -set_font_size(cr, 32.0) -set_source_rgb(cr, 0.0, 0.0, 1.0) -move_to(cr, 10.0, 50.0) -show_text(cr, "Hello, world") -destroy(cr) -discard write_to_png(surface, "hello.png") -destroy(surface) - diff --git a/examples/cgi/cgi_server.py b/examples/cgi/cgi_server.py new file mode 100644 index 000000000..1907515e8 --- /dev/null +++ b/examples/cgi/cgi_server.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +import BaseHTTPServer +import CGIHTTPServer + +server = BaseHTTPServer.HTTPServer +handler = CGIHTTPServer.CGIHTTPRequestHandler +server_address = ('localhost', 8008) +handler.cgi_directories = ['/'] + +httpd = server(server_address, handler) +httpd.serve_forever() diff --git a/examples/cgi/cgi_stacktrace.nim b/examples/cgi/cgi_stacktrace.nim new file mode 100644 index 000000000..e9f2f567c --- /dev/null +++ b/examples/cgi/cgi_stacktrace.nim @@ -0,0 +1,5 @@ +import cgi +cgi.setStackTraceStdout() + +var a: string = nil +a.add "foobar" diff --git a/examples/cgi/example.nim b/examples/cgi/example.nim new file mode 100644 index 000000000..17629982a --- /dev/null +++ b/examples/cgi/example.nim @@ -0,0 +1,7 @@ +import cgi + +write(stdout, "Content-type: text/html\n\n") +write(stdout, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n") +write(stdout, "<html><head><title>Test</title></head><body>\n") +write(stdout, "Hello!") +writeln(stdout, "</body></html>") diff --git a/examples/gtk/ex1.nim b/examples/gtk/ex1.nim deleted file mode 100644 index deabffa3e..000000000 --- a/examples/gtk/ex1.nim +++ /dev/null @@ -1,14 +0,0 @@ -import - cairo, glib2, gtk2 - -proc destroy(widget: pWidget, data: pgpointer) {.cdecl.} = - main_quit() - -var - window: pWidget -nimrod_init() -window = window_new(WINDOW_TOPLEVEL) -discard signal_connect(window, "destroy", - SIGNAL_FUNC(ex1.destroy), nil) -show(window) -main() diff --git a/examples/gtk/ex2.nim b/examples/gtk/ex2.nim deleted file mode 100644 index fab64cef5..000000000 --- a/examples/gtk/ex2.nim +++ /dev/null @@ -1,22 +0,0 @@ - -import - glib2, gtk2 - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -var - window: PWidget - button: PWidget - -nimrod_init() -window = window_new(WINDOW_TOPLEVEL) -button = button_new("Click me") -set_border_width(PContainer(Window), 5) -add(PContainer(window), button) -discard signal_connect(window, "destroy", - SIGNAL_FUNC(ex2.destroy), nil) -show(button) -show(window) -main() - diff --git a/examples/gtk/ex3.nim b/examples/gtk/ex3.nim deleted file mode 100644 index 3b39c07ce..000000000 --- a/examples/gtk/ex3.nim +++ /dev/null @@ -1,34 +0,0 @@ - -import - glib2, gtk2 - -proc newbutton(ALabel: cstring): PWidget = - Result = button_new(ALabel) - show(result) - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -nimrod_init() -var window = window_new(WINDOW_TOPLEVEL) # Box to divide window in 2 halves: -var totalbox = vbox_new(true, 10) -show(totalbox) # A box for each half of the screen: -var hbox = hbox_new(false, 5) -show(hbox) -var vbox = vbox_new(true, 5) -show(vbox) # Put boxes in their halves -pack_start(totalbox, hbox, true, true, 0) -pack_start(totalbox, vbox, true, true, 0) # Now fill boxes with buttons. - -pack_start(hbox, newbutton("Button 1"), false, false, 0) -pack_start(hbox, newbutton("Button 2"), false, false, 0) -pack_start(hbox, newbutton("Button 3"), false, false, 0) # Vertical box -pack_start(vbox, newbutton("Button A"), true, true, 0) -pack_start(vbox, newbutton("Button B"), true, true, 0) -pack_start(vbox, newbutton("Button C"), true, true, 0) # Put totalbox in window -set_border_width(PCONTAINER(Window), 5) -add(PContainer(window), totalbox) -discard signal_connect(window, "destroy", SIGNAL_FUNC(ex3.destroy), nil) -show(window) -main() - diff --git a/examples/gtk/ex4.nim b/examples/gtk/ex4.nim deleted file mode 100644 index 2964042de..000000000 --- a/examples/gtk/ex4.nim +++ /dev/null @@ -1,29 +0,0 @@ - -import - glib2, gtk2 - -proc newbutton(ALabel: cstring): PWidget = - Result = button_new(ALabel) - show(result) - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -nimrod_init() -var window = window_new(WINDOW_TOPLEVEL) -var Maintable = table_new(6, 6, True) - -proc AddToTable(Widget: PWidget, Left, Right, Top, Bottom: guint) = - attach_defaults(MainTable, Widget, Left, right, top, bottom) - -show(MainTable) -AddToTable(newbutton("1,1 At 1,1"), 1, 2, 1, 2) -AddToTable(newbutton("2,2 At 3,1"), 3, 5, 1, 3) -AddToTable(newbutton("4,1 At 4,1"), 1, 5, 4, 5) # Put all in window -set_border_width(Window, 5) -add(window, maintable) -discard signal_connect(window, "destroy", - SignalFunc(ex4.destroy), nil) -show(window) -main() - diff --git a/examples/gtk/ex5.nim b/examples/gtk/ex5.nim deleted file mode 100644 index 841ebc681..000000000 --- a/examples/gtk/ex5.nim +++ /dev/null @@ -1,24 +0,0 @@ - -import - glib2, gtk2 - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -proc widgetDestroy(w: PWidget) {.cdecl.} = - destroy(w) - -nimrod_init() -var window = window_new(WINDOW_TOPLEVEL) -var button = button_new("Click me") -set_border_width(Window, 5) -add(window, button) -discard signal_connect(window, "destroy", - SIGNAL_FUNC(ex5.destroy), nil) -discard signal_connect_object(button, "clicked", - SIGNAL_FUNC(widgetDestroy), - window) -show(button) -show(window) -main() - diff --git a/examples/gtk/ex6.nim b/examples/gtk/ex6.nim deleted file mode 100644 index 7374b19cd..000000000 --- a/examples/gtk/ex6.nim +++ /dev/null @@ -1,50 +0,0 @@ - -import - glib2, gtk2 - -type - TButtonSignalState = object - Obj: gtk2.PObject - SignalID: int32 - Disable: bool - - PButtonSignalState = ptr TButtonSignalState - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -proc widgetDestroy(w: PWidget) {.cdecl.} = destroy(w) - -proc disablesignal(widget: pWidget, data: pgpointer){.cdecl.} = - var s = cast[PButtonSignalState](Data) - if s.Disable: - signal_handler_block(s.Obj, s.SignalID) - else: - signal_handler_unblock(s.Obj, s.SignalID) - s.disable = not s.disable - -var - QuitState: TButtonSignalState - -nimrod_init() -var window = window_new(WINDOW_TOPLEVEL) -var quitbutton = button_new("Quit program") -var disablebutton = button_new("Disable button") -var windowbox = vbox_new(TRUE, 10) -pack_start(windowbox, disablebutton, True, false, 0) -pack_start(windowbox, quitbutton, True, false, 0) -set_border_width(Window, 10) -add(window, windowbox) -discard signal_connect(window, "destroy", SIGNAL_FUNC(ex6.destroy), nil) -QuitState.Obj = QuitButton -quitState.SignalID = signal_connect_object(QuitState.Obj, "clicked", - SIGNAL_FUNC(widgetDestroy), window).int32 -QuitState.Disable = True -discard signal_connect(disablebutton, "clicked", - SIGNAL_FUNC(disablesignal), addr(QuitState)) -show(quitbutton) -show(disablebutton) -show(windowbox) -show(window) -main() - diff --git a/examples/gtk/ex7.nim b/examples/gtk/ex7.nim deleted file mode 100644 index 852d80a41..000000000 --- a/examples/gtk/ex7.nim +++ /dev/null @@ -1,46 +0,0 @@ - -import - gdk2, glib2, gtk2 - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -const - Inside: cstring = "Mouse is over label" - OutSide: cstring = "Mouse is not over label" - -var - OverLabel: bool - -nimrod_init() -var window = window_new(gtk2.WINDOW_TOPLEVEL) -var stackbox = vbox_new(TRUE, 10) -var box1 = event_box_new() -var label1 = label_new("Move mouse over label") -add(box1, label1) -var box2 = event_box_new() -var label2 = label_new(OutSide) -add(box2, label2) -pack_start(stackbox, box1, TRUE, TRUE, 0) -pack_start(stackbox, box2, TRUE, TRUE, 0) -set_border_width(Window, 5) -add(window, stackbox) -discard signal_connect(window, "destroy", - SIGNAL_FUNC(ex7.destroy), nil) -overlabel = False - - -proc ChangeLabel(P: PWidget, Event: gdk2.PEventCrossing, - Data: var bool){.cdecl.} = - if not Data: set_text(Label1, Inside) - else: set_text(Label2, Outside) - Data = not Data - - -discard signal_connect(box1, "enter_notify_event", - SIGNAL_FUNC(ChangeLabel), addr(Overlabel)) -discard signal_connect(box1, "leave_notify_event", - SIGNAL_FUNC(ChangeLabel), addr(Overlabel)) -show_all(window) -main() - diff --git a/examples/gtk/ex8.nim b/examples/gtk/ex8.nim deleted file mode 100644 index 242a15393..000000000 --- a/examples/gtk/ex8.nim +++ /dev/null @@ -1,29 +0,0 @@ - -import - glib2, gtk2 - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -nimrod_init() -var window = window_new(WINDOW_TOPLEVEL) -var stackbox = vbox_new(TRUE, 10) -var label1 = label_new("Red label text") -var labelstyle = copy(get_style(label1)) -LabelStyle.fg[STATE_NORMAL].pixel = 0 -LabelStyle.fg[STATE_NORMAL].red = -1'i16 -LabelStyle.fg[STATE_NORMAL].blue = 0'i16 -LabelStyle.fg[STATE_NORMAL].green = 0'i16 -set_style(label1, labelstyle) -# Uncomment this to see the effect of setting the default style. -# set_default_style(labelstyle) -var label2 = label_new("Black label text") -pack_start(stackbox, label1, TRUE, TRUE, 0) -pack_start(stackbox, label2, TRUE, TRUE, 0) -set_border_width(Window, 5) -add(window, stackbox) -discard signal_connect(window, "destroy", - SIGNAL_FUNC(ex8.destroy), nil) -show_all(window) -main() - diff --git a/examples/gtk/ex9.nim b/examples/gtk/ex9.nim deleted file mode 100644 index 1481e6be1..000000000 --- a/examples/gtk/ex9.nim +++ /dev/null @@ -1,49 +0,0 @@ - -import - gdk2, glib2, gtk2 - -proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = - main_quit() - -const - Inside: cstring = "Mouse is over label" - OutSide: cstring = "Mouse is not over label" - -var - OverButton: bool - -nimrod_init() -var window = window_new(gtk2.WINDOW_TOPLEVEL) -var stackbox = vbox_new(TRUE, 10) -var button1 = button_new("Move mouse over button") -var buttonstyle = copy(get_style(Button1)) -ButtonStyle.bg[STATE_PRELIGHT].pixel = 0 -ButtonStyle.bg[STATE_PRELIGHT].red = -1'i16 -ButtonStyle.bg[STATE_PRELIGHT].blue = 0'i16 -ButtonStyle.bg[STATE_PRELIGHT].green = 0'i16 -set_style(button1, buttonstyle) -var button2 = button_new() -var ALabel = label_new(Outside) - - -proc ChangeLabel(P: PWidget, Event: gdk2.PEventCrossing, - Data: var bool){.cdecl.} = - if Not Data: set_text(ALabel, Inside) - else: set_text(ALabel, Outside) - Data = Not Data - - -add(button2, ALAbel) -pack_start(stackbox, button1, TRUE, TRUE, 0) -pack_start(stackbox, button2, TRUE, TRUE, 0) -set_border_width(Window, 5) -add(window, stackbox) -discard signal_connect(window, "destroy", - SIGNAL_FUNC(ex9.destroy), nil) -overbutton = False -discard signal_connect(button1, "enter_notify_event", - SIGNAL_FUNC(ChangeLabel), addr(OverButton)) -discard signal_connect(button1, "leave_notify_event", - SIGNAL_FUNC(ChangeLabel), addr(OverButton)) -show_all(window) -main() diff --git a/examples/luaex.nim b/examples/luaex.nim deleted file mode 100644 index 7628ddd12..000000000 --- a/examples/luaex.nim +++ /dev/null @@ -1,15 +0,0 @@ -# Embedds Lua into a Nimrod application - -import - lua, lualib, lauxlib - -const - code = """ -print 'hi' -""" - -var L = newstate() -openlibs(L) -discard loadbuffer(L, code, code.len, "line") -discard pcall(L, 0, 0, 0) - diff --git a/examples/pythonex.nim b/examples/pythonex.nim deleted file mode 100644 index 310d80151..000000000 --- a/examples/pythonex.nim +++ /dev/null @@ -1,11 +0,0 @@ -# Example to embed Python into your application - -import python - -# IMPORTANT: Python on Windows does not like CR characters, so -# we use only \L here. - -Py_Initialize() -discard PyRun_SimpleString("from time import time,ctime\L" & - "print 'Today is',ctime(time())\L") -Py_Finalize() diff --git a/examples/tclex.nim b/examples/tclex.nim deleted file mode 100644 index daf2d52e2..000000000 --- a/examples/tclex.nim +++ /dev/null @@ -1,25 +0,0 @@ -# Example to embed TCL in Nimrod - -import tcl, os - -const - myScript = """puts "Hello, World - In quotes" """ - myScript2 = """ -package require Tk -pack [entry .e -textvar e -width 50] -bind .e <Return> { - set e [regsub { *=.*} $e ""] ;# remove evaluation (Chris) - catch {expr [string map {/ *1./} $e]} res - append e " = $res" -} -""" - -FindExecutable(getAppFilename()) -var interp = CreateInterp() -if interp == nil: quit("cannot create TCL interpreter") -if Init(interp) != TCL_OK: - quit("cannot init interpreter") -if tcl.Eval(interp, myScript) != TCL_OK: - quit("cannot execute script.tcl") - - diff --git a/examples/x11ex.nim b/examples/x11ex.nim deleted file mode 100644 index 6c63d0a01..000000000 --- a/examples/x11ex.nim +++ /dev/null @@ -1,71 +0,0 @@ -import xlib, xutil, x, keysym - -const - WINDOW_WIDTH = 400 - WINDOW_HEIGHT = 300 - -var - width, height: cuint - display: PDisplay - screen: cint - depth: int - win: TWindow - sizeHints: TXSizeHints - -proc create_window = - width = WINDOW_WIDTH - height = WINDOW_HEIGHT - - display = XOpenDisplay(nil) - if display == nil: - echo("Verbindung zum X-Server fehlgeschlagen") - quit(1) - - screen = XDefaultScreen(display) - depth = XDefaultDepth(display, screen) - var rootwin = XRootWindow(display, screen) - win = XCreateSimpleWindow(display, rootwin, 100, 10, - width, height, 5, - XBlackPixel(display, screen), - XWhitePixel(display, screen)) - size_hints.flags = PSize or PMinSize or PMaxSize - size_hints.min_width = width.cint - size_hints.max_width = width.cint - size_hints.min_height = height.cint - size_hints.max_height = height.cint - discard XSetStandardProperties(display, win, "Simple Window", "window", - 0, nil, 0, addr(size_hints)) - discard XSelectInput(display, win, ButtonPressMask or KeyPressMask or - PointerMotionMask) - discard XMapWindow(display, win) - -proc close_window = - discard XDestroyWindow(display, win) - discard XCloseDisplay(display) - -var - xev: TXEvent - -proc process_event = - var key: TKeySym - case int(xev.theType) - of KeyPress: - key = XLookupKeysym(cast[ptr TXKeyEvent](addr(xev)), 0) - if key.int != 0: - echo("keyboard event") - of ButtonPressMask, PointerMotionMask: - Echo("Mouse event") - else: nil - -proc eventloop = - discard XFlush(display) - var num_events = int(XPending(display)) - while num_events != 0: - dec(num_events) - discard XNextEvent(display, addr(xev)) - process_event() - -create_window() -while true: - eventloop() -close_window() diff --git a/install.txt b/install.txt index 11c502235..2883c8495 100644 --- a/install.txt +++ b/install.txt @@ -62,3 +62,9 @@ Currently, the following C compilers are supported under Windows: | http://www.digitalmars.com/download/freecompiler.html However, most testing is done with GCC. + +Bootstrapping from Github +------------------------- + +Take a look at the readme file on github `here <https://github.com/Araq/Nimrod#readme>`_ +for instructions. diff --git a/koch.nim b/koch.nim index 97fcf5b2c..4d2b3bfb7 100644 --- a/koch.nim +++ b/koch.nim @@ -1,7 +1,7 @@ # # # Maintenance program for Nimrod -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -26,7 +26,7 @@ const +-----------------------------------------------------------------+ | Maintenance program for Nimrod | | Version $1| -| (c) 2013 Andreas Rumpf | +| (c) 2014 Andreas Rumpf | +-----------------------------------------------------------------+ Build time: $2, $3 @@ -42,9 +42,10 @@ Possible Commands: csource [options] builds the C sources for installation zip builds the installation ZIP package inno [options] builds the Inno Setup installer (for Windows) - tests run the testsuite + tests [options] run the testsuite update updates nimrod to the latest version from github (compile koch with -d:withUpdate to enable) + temp options creates a temporary compiler for testing Boot options: -d:release produce a release version of the compiler -d:tinyc include the Tiny C backend (not supported on Windows) @@ -109,16 +110,16 @@ proc findStartNimrod: string = # If these fail, we try to build nimrod with the "build.(sh|bat)" script. var nimrod = "nimrod".exe result = "bin" / nimrod - if ExistsFile(result): return + if existsFile(result): return for dir in split(getEnv("PATH"), PathSep): - if ExistsFile(dir / nimrod): return nimrod + if existsFile(dir / nimrod): return dir / nimrod when defined(Posix): const buildScript = "build.sh" - if ExistsFile(buildScript): + if existsFile(buildScript): if tryExec("./" & buildScript): return "bin" / nimrod else: const buildScript = "build.bat" - if ExistsFile(buildScript): + if existsFile(buildScript): if tryExec(buildScript): return "bin" / nimrod echo("Found no nimrod compiler and every attempt to build one failed!") @@ -177,24 +178,24 @@ proc cleanAux(dir: string) = of "nimcache": echo "removing dir: ", path removeDir(path) - of "dist", ".git", "icons": nil + of "dist", ".git", "icons": discard else: cleanAux(path) - else: nil + else: discard proc removePattern(pattern: string) = - for f in WalkFiles(pattern): + for f in walkFiles(pattern): echo "removing: ", f removeFile(f) proc clean(args: string) = - if ExistsFile("koch.dat"): removeFile("koch.dat") + if existsFile("koch.dat"): removeFile("koch.dat") removePattern("web/*.html") removePattern("doc/*.html") cleanAux(getCurrentDir()) for kind, path in walkDir(getCurrentDir() / "build"): if kind == pcDir: echo "removing dir: ", path - RemoveDir(path) + removeDir(path) # -------------- update ------------------------------------------------------- @@ -259,14 +260,22 @@ when defined(withUpdate): # -------------- tests -------------------------------------------------------- +template `|`(a, b): expr = (if a.len > 0: a else: b) + proc tests(args: string) = # we compile the tester with taintMode:on to have a basic # taint mode test :-) - exec("nimrod cc --taintMode:on tests/tester") - exec(getCurrentDir() / "tests/tester".exe & " reject") - exec(getCurrentDir() / "tests/tester".exe & " compile") - exec(getCurrentDir() / "tests/tester".exe & " run") - exec(getCurrentDir() / "tests/tester".exe & " merge") + exec "nimrod cc --taintMode:on tests/testament/tester" + let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe) + exec tester & " " & (args|"all") + exec tester & " html" + +proc temp(args: string) = + var output = "compiler" / "nimrod".exe + var finalDest = "bin" / "nimrod_temp".exe + exec("nimrod c compiler" / "nimrod") + copyExe(output, finalDest) + if args.len > 0: exec(finalDest & " " & args) proc showHelp() = quit(HelpText % [NimrodVersion & repeatChar(44-len(NimrodVersion)), @@ -291,6 +300,7 @@ of cmdArgument: update(op.cmdLineRest) else: quit "this Koch has not been compiled with -d:withUpdate" + of "temp": temp(op.cmdLineRest) else: showHelp() of cmdEnd: showHelp() diff --git a/lib/core/locks.nim b/lib/core/locks.nim index 071bde93a..894965a85 100644 --- a/lib/core/locks.nim +++ b/lib/core/locks.nim @@ -45,28 +45,28 @@ when noDeadlocks: locksLen {.threadvar.}: int locks {.threadvar.}: array [0..MaxLocksPerThread-1, pointer] - proc OrderedLocks(): bool = + proc orderedLocks(): bool = for i in 0 .. locksLen-2: if locks[i] >= locks[i+1]: return false result = true -proc InitLock*(lock: var TLock) {.inline.} = +proc initLock*(lock: var TLock) {.inline.} = ## Initializes the given lock. - InitSysLock(lock) + initSysLock(lock) -proc DeinitLock*(lock: var TLock) {.inline.} = +proc deinitLock*(lock: var TLock) {.inline.} = ## Frees the resources associated with the lock. - DeinitSys(lock) + deinitSys(lock) -proc TryAcquire*(lock: var TLock): bool {.tags: [FAquireLock].} = +proc tryAcquire*(lock: var TLock): bool {.tags: [FAquireLock].} = ## Tries to acquire the given lock. Returns `true` on success. - result = TryAcquireSys(lock) + result = tryAcquireSys(lock) when noDeadlocks: if not result: return # we have to add it to the ordered list. Oh, and we might fail if # there is no space in the array left ... if locksLen >= len(locks): - ReleaseSys(lock) + releaseSys(lock) raise newException(EResourceExhausted, "cannot acquire additional lock") # find the position to add: var p = addr(lock) @@ -83,14 +83,14 @@ proc TryAcquire*(lock: var TLock): bool {.tags: [FAquireLock].} = dec L locks[i] = p inc(locksLen) - assert OrderedLocks() + assert orderedLocks() return # simply add to the end: locks[locksLen] = p inc(locksLen) - assert OrderedLocks() + assert orderedLocks() -proc Acquire*(lock: var TLock) {.tags: [FAquireLock].} = +proc acquire*(lock: var TLock) {.tags: [FAquireLock].} = ## Acquires the given lock. when nodeadlocks: var p = addr(lock) @@ -106,36 +106,36 @@ proc Acquire*(lock: var TLock) {.tags: [FAquireLock].} = raise newException(EResourceExhausted, "cannot acquire additional lock") while L >= i: - ReleaseSys(cast[ptr TSysLock](locks[L])[]) + releaseSys(cast[ptr TSysLock](locks[L])[]) locks[L+1] = locks[L] dec L # acquire the current lock: - AcquireSys(lock) + acquireSys(lock) locks[i] = p inc(locksLen) # acquire old locks in proper order again: L = locksLen-1 inc i while i <= L: - AcquireSys(cast[ptr TSysLock](locks[i])[]) + acquireSys(cast[ptr TSysLock](locks[i])[]) inc(i) # DANGER: We can only modify this global var if we gained every lock! # NO! We need an atomic increment. Crap. discard system.atomicInc(deadlocksPrevented, 1) - assert OrderedLocks() + assert orderedLocks() return # simply add to the end: if locksLen >= len(locks): raise newException(EResourceExhausted, "cannot acquire additional lock") - AcquireSys(lock) + acquireSys(lock) locks[locksLen] = p inc(locksLen) - assert OrderedLocks() + assert orderedLocks() else: - AcquireSys(lock) + acquireSys(lock) -proc Release*(lock: var TLock) {.tags: [FReleaseLock].} = +proc release*(lock: var TLock) {.tags: [FReleaseLock].} = ## Releases the given lock. when nodeadlocks: var p = addr(lock) @@ -145,20 +145,20 @@ proc Release*(lock: var TLock) {.tags: [FReleaseLock].} = for j in i..L-2: locks[j] = locks[j+1] dec locksLen break - ReleaseSys(lock) + releaseSys(lock) -proc InitCond*(cond: var TCond) {.inline.} = +proc initCond*(cond: var TCond) {.inline.} = ## Initializes the given condition variable. - InitSysCond(cond) + initSysCond(cond) -proc DeinitCond*(cond: var TCond) {.inline.} = +proc deinitCond*(cond: var TCond) {.inline.} = ## Frees the resources associated with the lock. - DeinitSysCond(cond) + deinitSysCond(cond) proc wait*(cond: var TCond, lock: var TLock) {.inline.} = ## waits on the condition variable `cond`. - WaitSysCond(cond, lock) + waitSysCond(cond, lock) proc signal*(cond: var TCond) {.inline.} = ## sends a signal to the condition variable `cond`. diff --git a/lib/core/macros.nim b/lib/core/macros.nim index fc93a157d..585ccf869 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -59,7 +59,8 @@ type nnkBindStmt, nnkMixinStmt, nnkUsingStmt, nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, nnkBlockType, nnkTypeOfExpr, nnkObjectTy, - nnkTupleTy, nnkTypeClassTy, nnkRecList, nnkRecCase, nnkRecWhen, + nnkTupleTy, nnkTypeClassTy, nnkStaticTy, + nnkRecList, nnkRecCase, nnkRecWhen, nnkRefTy, nnkPtrTy, nnkVarTy, nnkConstTy, nnkMutableTy, nnkDistinctTy, @@ -147,18 +148,24 @@ proc del*(father: PNimrodNode, idx = 0, n = 1) {.magic: "NDel".} proc kind*(n: PNimrodNode): TNimrodNodeKind {.magic: "NKind".} ## returns the `kind` of the node `n`. -proc intVal*(n: PNimrodNode): biggestInt {.magic: "NIntVal".} -proc floatVal*(n: PNimrodNode): biggestFloat {.magic: "NFloatVal".} +proc intVal*(n: PNimrodNode): BiggestInt {.magic: "NIntVal".} +proc floatVal*(n: PNimrodNode): BiggestFloat {.magic: "NFloatVal".} proc symbol*(n: PNimrodNode): PNimrodSymbol {.magic: "NSymbol".} proc ident*(n: PNimrodNode): TNimrodIdent {.magic: "NIdent".} proc typ*(n: PNimrodNode): typedesc {.magic: "NGetType".} proc strVal*(n: PNimrodNode): string {.magic: "NStrVal".} -proc `intVal=`*(n: PNimrodNode, val: biggestInt) {.magic: "NSetIntVal".} -proc `floatVal=`*(n: PNimrodNode, val: biggestFloat) {.magic: "NSetFloatVal".} +proc `intVal=`*(n: PNimrodNode, val: BiggestInt) {.magic: "NSetIntVal".} +proc `floatVal=`*(n: PNimrodNode, val: BiggestFloat) {.magic: "NSetFloatVal".} proc `symbol=`*(n: PNimrodNode, val: PNimrodSymbol) {.magic: "NSetSymbol".} proc `ident=`*(n: PNimrodNode, val: TNimrodIdent) {.magic: "NSetIdent".} -proc `typ=`*(n: PNimrodNode, typ: typedesc) {.magic: "NSetType".} +#proc `typ=`*(n: PNimrodNode, typ: typedesc) {.magic: "NSetType".} +# this is not sound! Unfortunately forbidding 'typ=' is not enough, as you +# can easily do: +# let bracket = semCheck([1, 2]) +# let fake = semCheck(2.0) +# bracket[0] = fake # constructs a mixed array with ints and floats! + proc `strVal=`*(n: PNimrodNode, val: string) {.magic: "NSetStrVal".} proc newNimNode*(kind: TNimrodNodeKind, @@ -181,12 +188,12 @@ proc newStrLitNode*(s: string): PNimrodNode {.compileTime.} = result = newNimNode(nnkStrLit) result.strVal = s -proc newIntLitNode*(i: biggestInt): PNimrodNode {.compileTime.} = +proc newIntLitNode*(i: BiggestInt): PNimrodNode {.compileTime.} = ## creates a int literal node from `i` result = newNimNode(nnkIntLit) result.intVal = i -proc newFloatLitNode*(f: biggestFloat): PNimrodNode {.compileTime.} = +proc newFloatLitNode*(f: BiggestFloat): PNimrodNode {.compileTime.} = ## creates a float literal node from `f` result = newNimNode(nnkFloatLit) result.floatVal = f @@ -268,6 +275,8 @@ proc quote*(bl: stmt, op = "``"): PNimrodNode {.magic: "QuoteAst".} ## ## Example: ## + ## .. code-block:: nimrod + ## ## macro check(ex: expr): stmt = ## # this is a simplified version of the check macro from the ## # unittest module. @@ -285,15 +294,6 @@ proc quote*(bl: stmt, op = "``"): PNimrodNode {.magic: "QuoteAst".} ## if not `ex`: ## echo `info` & ": Check failed: " & `expString` -template emit*(e: expr[string]): stmt = - ## accepts a single string argument and treats it as nimrod code - ## that should be inserted verbatim in the program - ## Example: - ## - ## emit("echo " & '"' & "hello world".toUpper & '"') - ## - eval: result = e.parseStmt - proc expectKind*(n: PNimrodNode, k: TNimrodNodeKind) {.compileTime.} = ## checks that `n` is of kind `k`. If this is not the case, ## compilation aborts with an error message. This is useful for writing @@ -341,12 +341,12 @@ proc newLit*(c: char): PNimrodNode {.compileTime.} = result = newNimNode(nnkCharLit) result.intVal = ord(c) -proc newLit*(i: biggestInt): PNimrodNode {.compileTime.} = +proc newLit*(i: BiggestInt): PNimrodNode {.compileTime.} = ## produces a new integer literal node. result = newNimNode(nnkIntLit) result.intVal = i -proc newLit*(f: biggestFloat): PNimrodNode {.compileTime.} = +proc newLit*(f: BiggestFloat): PNimrodNode {.compileTime.} = ## produces a new float literal node. result = newNimNode(nnkFloatLit) result.floatVal = f @@ -377,7 +377,7 @@ proc treeRepr*(n: PNimrodNode): string {.compileTime.} = res.add(($n.kind).substr(3)) case n.kind - of nnkEmpty: nil # same as nil node in this representation + of nnkEmpty: discard # same as nil node in this representation of nnkNilLit: res.add(" nil") of nnkCharLit..nnkInt64Lit: res.add(" " & $n.intVal) of nnkFloatLit..nnkFloat64Lit: res.add(" " & $n.floatVal) @@ -402,13 +402,14 @@ proc lispRepr*(n: PNimrodNode): string {.compileTime.} = add(result, "(") case n.kind - of nnkEmpty: nil # same as nil node in this representation + of nnkEmpty: discard # same as nil node in this representation of nnkNilLit: add(result, "nil") of nnkCharLit..nnkInt64Lit: add(result, $n.intVal) of nnkFloatLit..nnkFloat64Lit: add(result, $n.floatVal) of nnkStrLit..nnkTripleStrLit: add(result, $n.strVal) of nnkIdent: add(result, "!\"" & $n.ident & '"') - of nnkSym, nnkNone: assert false + of nnkSym: add(result, $n.symbol) + of nnkNone: assert false else: add(result, lispRepr(n[0])) for j in 1..n.len-1: @@ -474,6 +475,34 @@ proc newDotExpr*(a, b: PNimrodNode): PNimrodNode {.compileTime.} = proc newIdentDefs*(name, kind: PNimrodNode; default = newEmptyNode()): PNimrodNode {.compileTime.} = + ## Creates a new ``nnkIdentDefs`` node of a specific kind and value. + ## + ## ``nnkIdentDefs`` need to have at least three children, but they can have + ## more: first comes a list of identifiers followed by a type and value + ## nodes. This helper proc creates a three node subtree, the first subnode + ## being a single identifier name. Both the ``kind`` node and ``default`` + ## (value) nodes may be empty depending on where the ``nnkIdentDefs`` + ## appears: tuple or object definitions will have an empty ``default`` node, + ## ``let`` or ``var`` blocks may have an empty ``kind`` node if the + ## identifier is being assigned a value. Example: + ## + ## .. code-block:: nimrod + ## + ## var varSection = newNimNode(nnkVarSection).add( + ## newIdentDefs(ident("a"), ident("string")), + ## newIdentDefs(ident("b"), newEmptyNode(), newLit(3))) + ## # --> var + ## # a: string + ## # b = 3 + ## + ## If you need to create multiple identifiers you need to use the lower level + ## ``newNimNode``: + ## + ## .. code-block:: nimrod + ## + ## result = newNimNode(nnkIdentDefs).add( + ## ident("a"), ident("b"), ident("c"), ident("string"), + ## newStrLitNode("Hello")) newNimNode(nnkIdentDefs).add(name, kind, default) proc newNilLit*(): PNimrodNode {.compileTime.} = @@ -494,14 +523,14 @@ const from strutils import cmpIgnoreStyle, format -proc ExpectKind*(n: PNimrodNode; k: set[TNimrodNodeKind]) {.compileTime.} = +proc expectKind*(n: PNimrodNode; k: set[TNimrodNodeKind]) {.compileTime.} = assert n.kind in k, "Expected one of $1, got $2".format(k, n.kind) -proc newProc*(name = newEmptyNode(); params: openarray[PNimrodNode] = []; +proc newProc*(name = newEmptyNode(); params: openArray[PNimrodNode] = [newEmptyNode()]; body: PNimrodNode = newStmtList(), procType = nnkProcDef): PNimrodNode {.compileTime.} = ## shortcut for creating a new proc ## - ## The ``params`` array should start with the return type of the proc, + ## The ``params`` array must start with the return type of the proc, ## followed by a list of IdentDefs which specify the params. assert procType in RoutineNodes result = newNimNode(procType).add( @@ -535,7 +564,7 @@ proc copyChildrenTo*(src, dest: PNimrodNode) {.compileTime.}= dest.add src[i].copyNimTree template expectRoutine(node: PNimrodNode): stmt = - expectKind(node, routineNodes) + expectKind(node, RoutineNodes) proc name*(someProc: PNimrodNode): PNimrodNode {.compileTime.} = someProc.expectRoutine @@ -572,7 +601,7 @@ proc body*(someProc: PNimrodNode): PNimrodNode {.compileTime.} = of routineNodes: return someProc[6] of nnkBlockStmt, nnkWhileStmt: - return someproc[1] + return someProc[1] of nnkForStmt: return someProc.last else: @@ -596,7 +625,7 @@ proc `$`*(node: PNimrodNode): string {.compileTime.} = of nnkIdent: result = $node.ident of nnkStrLit: - result = node.strval + result = node.strVal else: badNodeKind node.kind, "$" @@ -607,10 +636,13 @@ iterator children*(n: PNimrodNode): PNimrodNode {.inline.}= for i in 0 .. high(n): yield n[i] -template findChild*(n: PNimrodNode; cond: expr): PNimrodNode {.immediate, dirty.} = - ## Find the first child node matching condition (or nil) - ## var res = findChild(n, it.kind == nnkPostfix and it.basename.ident == !"foo") - +template findChild*(n: PNimrodNode; cond: expr): PNimrodNode {. + immediate, dirty.} = + ## Find the first child node matching condition (or nil). + ## + ## .. code-block:: nimrod + ## var res = findChild(n, it.kind == nnkPostfix and + ## it.basename.ident == !"foo") block: var result: PNimrodNode for it in n.children: @@ -619,7 +651,7 @@ template findChild*(n: PNimrodNode; cond: expr): PNimrodNode {.immediate, dirty. break result -proc insert*(a: PNimrodNOde; pos: int; b: PNimrodNode) {.compileTime.} = +proc insert*(a: PNimrodNode; pos: int; b: PNimrodNode) {.compileTime.} = ## Insert node B into A at pos if high(a) < pos: ## add some empty nodes first @@ -640,14 +672,14 @@ proc basename*(a: PNimrodNode): PNimrodNode {.compiletime.} = of nnkIdent: return a of nnkPostfix, nnkPrefix: return a[1] else: - quit "Do not know how to get basename of ("& treerepr(a) &")\n"& repr(a) + quit "Do not know how to get basename of ("& treeRepr(a) &")\n"& repr(a) proc `basename=`*(a: PNimrodNode; val: string) {.compileTime.}= case a.kind of nnkIdent: macros.`ident=`(a, !val) of nnkPostfix, nnkPrefix: a[1] = ident(val) else: - quit "Do not know how to get basename of ("& treerepr(a)& ")\n"& repr(a) + quit "Do not know how to get basename of ("& treeRepr(a)& ")\n"& repr(a) proc postfix*(node: PNimrodNode; op: string): PNimrodNode {.compileTime.} = newNimNode(nnkPostfix).add(ident(op), node) @@ -698,6 +730,18 @@ proc addIdentIfAbsent*(dest: PNimrodNode, ident: string) {.compiletime.} = if ident.eqIdent($node): return of nnkExprColonExpr: if ident.eqIdent($node[0]): return - else: nil + else: discard dest.add(ident(ident)) +when not defined(booting): + template emit*(e: static[string]): stmt = + ## accepts a single string argument and treats it as nimrod code + ## that should be inserted verbatim in the program + ## Example: + ## + ## .. code-block:: nimrod + ## emit("echo " & '"' & "hello world".toUpper & '"') + ## + macro payload: stmt {.gensym.} = + result = parseStmt(e) + payload() diff --git a/lib/impure/db_mongo.nim b/lib/impure/db_mongo.nim index b11db78f8..dc8a808f2 100644 --- a/lib/impure/db_mongo.nim +++ b/lib/impure/db_mongo.nim @@ -47,18 +47,18 @@ proc dbError*(db: TDbConn, msg: string) {.noreturn.} = e.msg = $db.err & " " & msg raise e -proc Close*(db: var TDbConn) {.tags: [FDB].} = +proc close*(db: var TDbConn) {.tags: [FDB].} = ## closes the database connection. disconnect(db) destroy(db) -proc Open*(host: string = defaultHost, port: int = defaultPort): TDbConn {. +proc open*(host: string = defaultHost, port: int = defaultPort): TDbConn {. tags: [FDB].} = ## opens a database connection. Raises `EDb` if the connection could not ## be established. init(result) - let x = connect(result, host, port.cint) + let x = client(result, host, port.cint) if x != 0'i32: dbError(result, "cannot open: " & host) @@ -113,13 +113,13 @@ proc getId*(obj: var TBSon): TOid = else: raise newException(EInvalidIndex, "_id not in object") -proc insertID*(db: var TDbConn, namespace: string, data: PJsonNode): TOid {. +proc insertId*(db: var TDbConn, namespace: string, data: PJsonNode): TOid {. tags: [FWriteDb].} = ## converts `data` to BSON format and inserts it in `namespace`. Returns ## the generated OID for the ``_id`` field. result = genOid() var x = jsonToBSon(data, result) - insert(db, namespace, x) + insert(db, namespace, x, nil) destroy(x) proc insert*(db: var TDbConn, namespace: string, data: PJsonNode) {. diff --git a/lib/impure/db_mysql.nim b/lib/impure/db_mysql.nim index 91cf8a5eb..8cdccda01 100644 --- a/lib/impure/db_mysql.nim +++ b/lib/impure/db_mysql.nim @@ -65,7 +65,7 @@ proc dbFormat(formatstr: TSqlQuery, args: varargs[string]): string = else: add(result, c) -proc TryExec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): bool {. +proc tryExec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): bool {. tags: [FReadDB, FWriteDb].} = ## tries to execute the query and returns true if successful, false otherwise. var q = dbFormat(query, args) @@ -75,7 +75,7 @@ proc rawExec(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) = var q = dbFormat(query, args) if mysql.RealQuery(db, q, q.len) != 0'i32: dbError(db) -proc Exec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) {. +proc exec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) {. tags: [FReadDB, FWriteDb].} = ## executes the query and raises EDB if not successful. var q = dbFormat(query, args) @@ -90,7 +90,7 @@ proc properFreeResult(sqlres: mysql.PRES, row: cstringArray) = while mysql.FetchRow(sqlres) != nil: nil mysql.FreeResult(sqlres) -iterator FastRows*(db: TDbConn, query: TSqlQuery, +iterator fastRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = ## executes the query and iterates over the result dataset. This is very ## fast, but potenially dangerous: If the for-loop-body executes another @@ -126,7 +126,7 @@ proc getRow*(db: TDbConn, query: TSqlQuery, add(result[i], row[i]) properFreeResult(sqlres, row) -proc GetAllRows*(db: TDbConn, query: TSqlQuery, +proc getAllRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} = ## executes the query and returns the whole result dataset. result = @[] @@ -145,12 +145,12 @@ proc GetAllRows*(db: TDbConn, query: TSqlQuery, inc(j) mysql.FreeResult(sqlres) -iterator Rows*(db: TDbConn, query: TSqlQuery, +iterator rows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = ## same as `FastRows`, but slower and safe. for r in items(GetAllRows(db, query, args)): yield r -proc GetValue*(db: TDbConn, query: TSqlQuery, +proc getValue*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): string {.tags: [FReadDB].} = ## executes the query and returns the first column of the first row of the ## result dataset. Returns "" if the dataset contains no rows or the database @@ -160,7 +160,7 @@ proc GetValue*(db: TDbConn, query: TSqlQuery, result = row[0] break -proc TryInsertID*(db: TDbConn, query: TSqlQuery, +proc tryInsertId*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {.tags: [FWriteDb].} = ## executes the query (typically "INSERT") and returns the ## generated ID for the row or -1 in case of an error. @@ -170,14 +170,14 @@ proc TryInsertID*(db: TDbConn, query: TSqlQuery, else: result = mysql.InsertId(db) -proc InsertID*(db: TDbConn, query: TSqlQuery, +proc insertId*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {.tags: [FWriteDb].} = ## executes the query (typically "INSERT") and returns the ## generated ID for the row. result = TryInsertID(db, query, args) if result < 0: dbError(db) -proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery, +proc execAffectedRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {. tags: [FReadDB, FWriteDb].} = ## runs the query (typically "UPDATE") and returns the @@ -185,11 +185,11 @@ proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery, rawExec(db, query, args) result = mysql.AffectedRows(db) -proc Close*(db: TDbConn) {.tags: [FDb].} = +proc close*(db: TDbConn) {.tags: [FDb].} = ## closes the database connection. - if db != nil: mysql.Close(db) + if db != nil: mysql.close(db) -proc Open*(connection, user, password, database: string): TDbConn {. +proc open*(connection, user, password, database: string): TDbConn {. tags: [FDb].} = ## opens a database connection. Raises `EDb` if the connection could not ## be established. diff --git a/lib/impure/db_postgres.nim b/lib/impure/db_postgres.nim index 2dd55e05f..f6ae93303 100644 --- a/lib/impure/db_postgres.nim +++ b/lib/impure/db_postgres.nim @@ -64,7 +64,7 @@ proc dbFormat(formatstr: TSqlQuery, args: varargs[string]): string = else: add(result, c) -proc TryExec*(db: TDbConn, query: TSqlQuery, +proc tryExec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): bool {.tags: [FReadDB, FWriteDb].} = ## tries to execute the query and returns true if successful, false otherwise. var q = dbFormat(query, args) @@ -72,7 +72,7 @@ proc TryExec*(db: TDbConn, query: TSqlQuery, result = PQresultStatus(res) == PGRES_COMMAND_OK PQclear(res) -proc Exec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) {. +proc exec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) {. tags: [FReadDB, FWriteDb].} = ## executes the query and raises EDB if not successful. var q = dbFormat(query, args) @@ -96,7 +96,7 @@ proc setRow(res: PPGresult, r: var TRow, line, cols: int32) = var x = PQgetvalue(res, line, col) add(r[col], x) -iterator FastRows*(db: TDbConn, query: TSqlQuery, +iterator fastRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = ## executes the query and iterates over the result dataset. This is very ## fast, but potenially dangerous: If the for-loop-body executes another @@ -119,19 +119,19 @@ proc getRow*(db: TDbConn, query: TSqlQuery, setRow(res, result, 0, L) PQclear(res) -proc GetAllRows*(db: TDbConn, query: TSqlQuery, +proc getAllRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} = ## executes the query and returns the whole result dataset. result = @[] for r in FastRows(db, query, args): result.add(r) -iterator Rows*(db: TDbConn, query: TSqlQuery, +iterator rows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = ## same as `FastRows`, but slower and safe. for r in items(GetAllRows(db, query, args)): yield r -proc GetValue*(db: TDbConn, query: TSqlQuery, +proc getValue*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): string {.tags: [FReadDB].} = ## executes the query and returns the first column of the first row of the ## result dataset. Returns "" if the dataset contains no rows or the database @@ -139,7 +139,7 @@ proc GetValue*(db: TDbConn, query: TSqlQuery, var x = PQgetvalue(setupQuery(db, query, args), 0, 0) result = if isNil(x): "" else: $x -proc TryInsertID*(db: TDbConn, query: TSqlQuery, +proc tryInsertID*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {.tags: [FWriteDb].}= ## executes the query (typically "INSERT") and returns the ## generated ID for the row or -1 in case of an error. For Postgre this adds @@ -152,7 +152,7 @@ proc TryInsertID*(db: TDbConn, query: TSqlQuery, else: result = -1 -proc InsertID*(db: TDbConn, query: TSqlQuery, +proc insertID*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {.tags: [FWriteDb].} = ## executes the query (typically "INSERT") and returns the ## generated ID for the row. For Postgre this adds @@ -161,7 +161,7 @@ proc InsertID*(db: TDbConn, query: TSqlQuery, result = TryInsertID(db, query, args) if result < 0: dbError(db) -proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery, +proc execAffectedRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {.tags: [ FReadDB, FWriteDb].} = ## executes the query (typically "UPDATE") and returns the @@ -172,14 +172,29 @@ proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery, result = parseBiggestInt($PQcmdTuples(res)) PQclear(res) -proc Close*(db: TDbConn) {.tags: [FDb].} = +proc close*(db: TDbConn) {.tags: [FDb].} = ## closes the database connection. if db != nil: PQfinish(db) -proc Open*(connection, user, password, database: string): TDbConn {. +proc open*(connection, user, password, database: string): TDbConn {. tags: [FDb].} = ## opens a database connection. Raises `EDb` if the connection could not ## be established. + ## + ## Clients can also use Postgres keyword/value connection strings to + ## connect. + ## + ## Example: + ## + ## .. code-block:: nimrod + ## + ## con = Open("", "", "", "host=localhost port=5432 dbname=mydb") + ## + ## See http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING + ## for more information. + ## + ## Note that the connection parameter is not used but exists to maintain + ## the nimrod db api. result = PQsetdbLogin(nil, nil, nil, nil, database, user, password) if PQStatus(result) != CONNECTION_OK: dbError(result) # result = nil diff --git a/lib/impure/db_sqlite.nim b/lib/impure/db_sqlite.nim index 693077553..809ee7039 100644 --- a/lib/impure/db_sqlite.nim +++ b/lib/impure/db_sqlite.nim @@ -64,7 +64,7 @@ proc dbFormat(formatstr: TSqlQuery, args: varargs[string]): string = else: add(result, c) -proc TryExec*(db: TDbConn, query: TSqlQuery, +proc tryExec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): bool {.tags: [FReadDB, FWriteDb].} = ## tries to execute the query and returns true if successful, false otherwise. var q = dbFormat(query, args) @@ -73,10 +73,10 @@ proc TryExec*(db: TDbConn, query: TSqlQuery, if step(stmt) == SQLITE_DONE: result = finalize(stmt) == SQLITE_OK -proc Exec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) {. +proc exec*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]) {. tags: [FReadDB, FWriteDb].} = ## executes the query and raises EDB if not successful. - if not TryExec(db, query, args): dbError(db) + if not tryExec(db, query, args): dbError(db) proc newRow(L: int): TRow = newSeq(result, L) @@ -94,7 +94,7 @@ proc setRow(stmt: PStmt, r: var TRow, cols: cint) = let x = column_text(stmt, col) if not isNil(x): add(r[col], x) -iterator FastRows*(db: TDbConn, query: TSqlQuery, +iterator fastRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = ## executes the query and iterates over the result dataset. This is very ## fast, but potenially dangerous: If the for-loop-body executes another @@ -118,19 +118,19 @@ proc getRow*(db: TDbConn, query: TSqlQuery, setRow(stmt, result, L) if finalize(stmt) != SQLITE_OK: dbError(db) -proc GetAllRows*(db: TDbConn, query: TSqlQuery, +proc getAllRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} = ## executes the query and returns the whole result dataset. result = @[] - for r in FastRows(db, query, args): + for r in fastRows(db, query, args): result.add(r) -iterator Rows*(db: TDbConn, query: TSqlQuery, +iterator rows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = ## same as `FastRows`, but slower and safe. - for r in FastRows(db, query, args): yield r + for r in fastRows(db, query, args): yield r -proc GetValue*(db: TDbConn, query: TSqlQuery, +proc getValue*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): string {.tags: [FReadDB].} = ## executes the query and returns the first column of the first row of the ## result dataset. Returns "" if the dataset contains no rows or the database @@ -143,44 +143,46 @@ proc GetValue*(db: TDbConn, query: TSqlQuery, else: result = newStringOfCap(cb) add(result, column_text(stmt, 0)) - if finalize(stmt) != SQLITE_OK: dbError(db) else: result = "" + if finalize(stmt) != SQLITE_OK: dbError(db) -proc TryInsertID*(db: TDbConn, query: TSqlQuery, - args: varargs[string, `$`]): int64 {.tags: [FWriteDb].} = +proc tryInsertID*(db: TDbConn, query: TSqlQuery, + args: varargs[string, `$`]): int64 + {.tags: [FWriteDb], raises: [].} = ## executes the query (typically "INSERT") and returns the ## generated ID for the row or -1 in case of an error. var q = dbFormat(query, args) var stmt: sqlite3.PStmt + result = -1 if prepare_v2(db, q, q.len.cint, stmt, nil) == SQLITE_OK: if step(stmt) == SQLITE_DONE: - if finalize(stmt) == SQLITE_OK: - return last_insert_rowid(db) - result = -1 + result = last_insert_rowid(db) + if finalize(stmt) != SQLITE_OK: + result = -1 -proc InsertID*(db: TDbConn, query: TSqlQuery, +proc insertID*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {.tags: [FWriteDb].} = ## executes the query (typically "INSERT") and returns the ## generated ID for the row. For Postgre this adds ## ``RETURNING id`` to the query, so it only works if your primary key is ## named ``id``. - result = TryInsertID(db, query, args) + result = tryInsertID(db, query, args) if result < 0: dbError(db) -proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery, +proc execAffectedRows*(db: TDbConn, query: TSqlQuery, args: varargs[string, `$`]): int64 {. tags: [FReadDB, FWriteDb].} = ## executes the query (typically "UPDATE") and returns the ## number of affected rows. - Exec(db, query, args) + exec(db, query, args) result = changes(db) -proc Close*(db: TDbConn) {.tags: [FDB].} = +proc close*(db: TDbConn) {.tags: [FDB].} = ## closes the database connection. if sqlite3.close(db) != SQLITE_OK: dbError(db) -proc Open*(connection, user, password, database: string): TDbConn {. +proc open*(connection, user, password, database: string): TDbConn {. tags: [FDB].} = ## opens a database connection. Raises `EDb` if the connection could not ## be established. Only the ``connection`` parameter is used for ``sqlite``. @@ -192,7 +194,7 @@ proc Open*(connection, user, password, database: string): TDbConn {. when isMainModule: var db = open("db.sql", "", "", "") - Exec(db, sql"create table tbl1(one varchar(10), two smallint)", []) + exec(db, sql"create table tbl1(one varchar(10), two smallint)", []) exec(db, sql"insert into tbl1 values('hello!',10)", []) exec(db, sql"insert into tbl1 values('goodbye', 20)", []) #db.query("create table tbl1(one varchar(10), two smallint)") diff --git a/lib/impure/dialogs.nim b/lib/impure/dialogs.nim index 5bd7bf6f6..00ba2663e 100644 --- a/lib/impure/dialogs.nim +++ b/lib/impure/dialogs.nim @@ -57,7 +57,7 @@ proc error*(window: PWindow, msg: string) = destroy(PWidget(dialog)) -proc ChooseFileToOpen*(window: PWindow, root: string = ""): string = +proc chooseFileToOpen*(window: PWindow, root: string = ""): string = ## Opens a dialog that requests a filename from the user. Returns "" ## if the user closed the dialog without selecting a file. On Windows, ## the native dialog is used, else the GTK dialog is used. @@ -92,7 +92,7 @@ proc ChooseFileToOpen*(window: PWindow, root: string = ""): string = result = "" destroy(PWidget(chooser)) -proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] = +proc chooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] = ## Opens a dialog that requests filenames from the user. Returns ``@[]`` ## if the user closed the dialog without selecting a file. On Windows, ## the native dialog is used, else the GTK dialog is used. @@ -153,7 +153,7 @@ proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] = destroy(PWidget(chooser)) -proc ChooseFileToSave*(window: PWindow, root: string = ""): string = +proc chooseFileToSave*(window: PWindow, root: string = ""): string = ## Opens a dialog that requests a filename to save to from the user. ## Returns "" if the user closed the dialog without selecting a file. ## On Windows, the native dialog is used, else the GTK dialog is used. @@ -190,7 +190,7 @@ proc ChooseFileToSave*(window: PWindow, root: string = ""): string = destroy(PWidget(chooser)) -proc ChooseDir*(window: PWindow, root: string = ""): string = +proc chooseDir*(window: PWindow, root: string = ""): string = ## Opens a dialog that requests a directory from the user. ## Returns "" if the user closed the dialog without selecting a directory. ## On Windows, the native dialog is used, else the GTK dialog is used. diff --git a/lib/impure/graphics.nim b/lib/impure/graphics.nim index 85eeaed42..2c8e96460 100644 --- a/lib/impure/graphics.nim +++ b/lib/impure/graphics.nim @@ -343,7 +343,7 @@ proc fillRect*(sur: PSurface, r: TRect, col: TColor) = if sdl.FillRect(sur.s, addr(rect), sur.createSdlColor(col)) == -1: raiseEGraphics() -proc Plot4EllipsePoints(sur: PSurface, CX, CY, X, Y: Natural, col: TColor) = +proc plot4EllipsePoints(sur: PSurface, CX, CY, X, Y: Natural, col: TColor) = var video = cast[PPixels](sur.s.pixels) var pitch = sur.s.pitch.int div ColSize if CX+X <= sur.s.w-1: diff --git a/lib/impure/osinfo_win.nim b/lib/impure/osinfo_win.nim index 208ef7114..572e50273 100644 --- a/lib/impure/osinfo_win.nim +++ b/lib/impure/osinfo_win.nim @@ -151,7 +151,7 @@ const # GetSystemMetrics SM_SERVERR2 = 89 -proc GlobalMemoryStatusEx*(lpBuffer: var TMEMORYSTATUSEX){.stdcall, dynlib: "kernel32", +proc globalMemoryStatusEx*(lpBuffer: var TMEMORYSTATUSEX){.stdcall, dynlib: "kernel32", importc: "GlobalMemoryStatusEx".} proc getMemoryInfo*(): TMemoryInfo = @@ -159,7 +159,7 @@ proc getMemoryInfo*(): TMemoryInfo = var statex: TMEMORYSTATUSEX statex.dwLength = sizeof(statex).int32 - GlobalMemoryStatusEx(statex) + globalMemoryStatusEx(statex) result.MemoryLoad = statex.dwMemoryLoad result.TotalPhysMem = statex.ullTotalPhys result.AvailablePhysMem = statex.ullAvailPhys @@ -168,20 +168,20 @@ proc getMemoryInfo*(): TMemoryInfo = result.TotalVirtualMem = statex.ullTotalVirtual result.AvailableVirtualMem = statex.ullAvailExtendedVirtual -proc GetVersionEx*(lpVersionInformation: var TOSVERSIONINFOEX): WINBOOL{.stdcall, +proc getVersionEx*(lpVersionInformation: var TOSVERSIONINFOEX): WINBOOL{.stdcall, dynlib: "kernel32", importc: "GetVersionExA".} -proc GetProcAddress*(hModule: int, lpProcName: cstring): pointer{.stdcall, +proc getProcAddress*(hModule: int, lpProcName: cstring): pointer{.stdcall, dynlib: "kernel32", importc: "GetProcAddress".} -proc GetModuleHandleA*(lpModuleName: cstring): int{.stdcall, - dynlib: "kernel32", importc.} +proc getModuleHandleA*(lpModuleName: cstring): int{.stdcall, + dynlib: "kernel32", importc: "GetModuleHandleA".} proc getVersionInfo*(): TVersionInfo = ## Retrieves operating system info var osvi: TOSVERSIONINFOEX osvi.dwOSVersionInfoSize = sizeof(osvi).int32 - discard GetVersionEx(osvi) + discard getVersionEx(osvi) result.majorVersion = osvi.dwMajorVersion result.minorVersion = osvi.dwMinorVersion result.buildNumber = osvi.dwBuildNumber @@ -197,8 +197,8 @@ proc getProductInfo*(majorVersion, minorVersion, SPMajorVersion, ## Retrieves Windows' ProductInfo, this function only works in Vista and 7 var pGPI = cast[proc (dwOSMajorVersion, dwOSMinorVersion, - dwSpMajorVersion, dwSpMinorVersion: int32, outValue: Pint32)](GetProcAddress( - GetModuleHandleA("kernel32.dll"), "GetProductInfo")) + dwSpMajorVersion, dwSpMinorVersion: int32, outValue: Pint32)](getProcAddress( + getModuleHandleA("kernel32.dll"), "GetProductInfo")) if pGPI != nil: var dwType: int32 @@ -207,25 +207,25 @@ proc getProductInfo*(majorVersion, minorVersion, SPMajorVersion, else: return PRODUCT_UNDEFINED -proc GetSystemInfo*(lpSystemInfo: LPSYSTEM_INFO){.stdcall, dynlib: "kernel32", +proc getSystemInfo*(lpSystemInfo: LPSYSTEM_INFO){.stdcall, dynlib: "kernel32", importc: "GetSystemInfo".} proc getSystemInfo*(): TSYSTEM_INFO = ## Returns the SystemInfo # Use GetNativeSystemInfo if it's available - var pGNSI = cast[proc (lpSystemInfo: LPSYSTEM_INFO)](GetProcAddress( - GetModuleHandleA("kernel32.dll"), "GetNativeSystemInfo")) + var pGNSI = cast[proc (lpSystemInfo: LPSYSTEM_INFO)](getProcAddress( + getModuleHandleA("kernel32.dll"), "GetNativeSystemInfo")) var systemi: TSYSTEM_INFO if pGNSI != nil: pGNSI(addr(systemi)) else: - GetSystemInfo(addr(systemi)) + getSystemInfo(addr(systemi)) return systemi -proc GetSystemMetrics*(nIndex: int32): int32{.stdcall, dynlib: "user32", +proc getSystemMetrics*(nIndex: int32): int32{.stdcall, dynlib: "user32", importc: "GetSystemMetrics".} proc `$`*(osvi: TVersionInfo): string = @@ -283,11 +283,11 @@ proc `$`*(osvi: TVersionInfo): string = of PRODUCT_WEB_SERVER: result.add("Web Server Edition") else: - nil + discard # End of Windows 6.* if osvi.majorVersion == 5 and osvi.minorVersion == 2: - if GetSystemMetrics(SM_SERVERR2) != 0: + if getSystemMetrics(SM_SERVERR2) != 0: result.add("Windows Server 2003 R2, ") elif (osvi.SuiteMask and VER_SUITE_PERSONAL) != 0: # Not sure if this will work result.add("Windows Storage Server 2003") @@ -365,21 +365,21 @@ proc `$`*(osvi: TVersionInfo): string = result = "Unknown version of windows[Kernel version <= 4]" -proc getFileSize*(file: string): biggestInt = +proc getFileSize*(file: string): BiggestInt = var fileData: TWIN32_FIND_DATA when useWinUnicode: var aa = newWideCString(file) - var hFile = FindFirstFileW(aa, fileData) + var hFile = findFirstFileW(aa, fileData) else: - var hFile = FindFirstFileA(file, fileData) + var hFile = findFirstFileA(file, fileData) if hFile == INVALID_HANDLE_VALUE: - raise newException(EIO, $GetLastError()) + raise newException(EIO, $getLastError()) return fileData.nFileSizeLow -proc GetDiskFreeSpaceEx*(lpDirectoryName: cstring, lpFreeBytesAvailableToCaller, +proc getDiskFreeSpaceEx*(lpDirectoryName: cstring, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes: var TFiletime): WINBOOL{. stdcall, dynlib: "kernel32", importc: "GetDiskFreeSpaceExA".} @@ -387,7 +387,7 @@ proc GetDiskFreeSpaceEx*(lpDirectoryName: cstring, lpFreeBytesAvailableToCaller, proc getPartitionInfo*(partition: string): TPartitionInfo = ## Retrieves partition info, for example ``partition`` may be ``"C:\"`` var FreeBytes, TotalBytes, TotalFreeBytes: TFiletime - var res = GetDiskFreeSpaceEx(r"C:\", FreeBytes, TotalBytes, + var res = getDiskFreeSpaceEx(r"C:\", FreeBytes, TotalBytes, TotalFreeBytes) return (FreeBytes, TotalBytes) diff --git a/lib/impure/rdstdin.nim b/lib/impure/rdstdin.nim index cf076e929..1037d3bda 100644 --- a/lib/impure/rdstdin.nim +++ b/lib/impure/rdstdin.nim @@ -14,13 +14,13 @@ ## wanted functionality. when defined(Windows): - proc ReadLineFromStdin*(prompt: string): TaintedString {. + proc readLineFromStdin*(prompt: string): TaintedString {. tags: [FReadIO, FWriteIO].} = ## Reads a line from stdin. stdout.write(prompt) result = readLine(stdin) - proc ReadLineFromStdin*(prompt: string, line: var TaintedString): bool {. + proc readLineFromStdin*(prompt: string, line: var TaintedString): bool {. tags: [FReadIO, FWriteIO].} = ## Reads a `line` from stdin. `line` must not be ## ``nil``! May throw an IO exception. @@ -34,7 +34,7 @@ when defined(Windows): else: import readline, history - proc ReadLineFromStdin*(prompt: string): TaintedString {. + proc readLineFromStdin*(prompt: string): TaintedString {. tags: [FReadIO, FWriteIO].} = var buffer = readline.readLine(prompt) if isNil(buffer): quit(0) @@ -43,7 +43,7 @@ else: add_history(buffer) readline.free(buffer) - proc ReadLineFromStdin*(prompt: string, line: var TaintedString): bool {. + proc readLineFromStdin*(prompt: string, line: var TaintedString): bool {. tags: [FReadIO, FWriteIO].} = var buffer = readline.readLine(prompt) if isNil(buffer): quit(0) @@ -56,7 +56,7 @@ else: # initialization: # disable auto-complete: - proc doNothing(a, b: cint): cint {.cdecl, procvar.} = nil + proc doNothing(a, b: cint): cint {.cdecl, procvar.} = discard discard readline.bind_key('\t'.ord, doNothing) diff --git a/lib/impure/re.nim b/lib/impure/re.nim index b92d39bf0..f6511dab4 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -28,7 +28,7 @@ const ## More subpatterns cannot be captured! type - TRegExFlag* = enum ## options for regular expressions + TRegexFlag* = enum ## options for regular expressions reIgnoreCase = 0, ## do caseless matching reMultiLine = 1, ## ``^`` and ``$`` match newlines within data reDotAll = 2, ## ``.`` matches anything including NL @@ -36,11 +36,11 @@ type reStudy = 4 ## study the expression (may be omitted if the ## expression will be used only once) - TRegExDesc {.pure, final.} = object + TRegexDesc {.pure, final.} = object h: PPcre e: ptr TExtra - TRegEx* = ref TRegExDesc ## a compiled regular expression + TRegex* = ref TRegexDesc ## a compiled regular expression EInvalidRegEx* = object of EInvalidValue ## is raised if the pattern is no valid regular expression. @@ -53,13 +53,13 @@ proc raiseInvalidRegex(msg: string) {.noinline, noreturn.} = proc rawCompile(pattern: string, flags: cint): PPcre = var - msg: CString + msg: cstring offset: cint result = pcre.Compile(pattern, flags, addr(msg), addr(offset), nil) if result == nil: - raiseInvalidRegEx($msg & "\n" & pattern & "\n" & repeatChar(offset) & "^\n") + raiseInvalidRegex($msg & "\n" & pattern & "\n" & repeatChar(offset) & "^\n") -proc finalizeRegEx(x: TRegEx) = +proc finalizeRegEx(x: TRegex) = # XXX This is a hack, but PCRE does not export its "free" function properly. # Sigh. The hack relies on PCRE's implementation (see ``pcre_get.c``). # Fortunately the implementation is unlikely to change. @@ -67,7 +67,7 @@ proc finalizeRegEx(x: TRegEx) = if not isNil(x.e): pcre.free_substring(cast[cstring](x.e)) -proc re*(s: string, flags = {reExtended, reStudy}): TRegEx = +proc re*(s: string, flags = {reExtended, reStudy}): TRegex = ## Constructor of regular expressions. Note that Nimrod's ## extended raw string literals support this syntax ``re"[abc]"`` as ## a short form for ``re(r"[abc]")``. @@ -78,7 +78,7 @@ proc re*(s: string, flags = {reExtended, reStudy}): TRegEx = result.e = pcre.study(result.h, 0, msg) if not isNil(msg): raiseInvalidRegex($msg) -proc matchOrFind(s: string, pattern: TRegEx, matches: var openarray[string], +proc matchOrFind(s: string, pattern: TRegex, matches: var openArray[string], start, flags: cint): cint = var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] @@ -92,7 +92,7 @@ proc matchOrFind(s: string, pattern: TRegEx, matches: var openarray[string], else: matches[i-1] = "" return rawMatches[1] - rawMatches[0] -proc findBounds*(s: string, pattern: TRegEx, matches: var openarray[string], +proc findBounds*(s: string, pattern: TRegex, matches: var openArray[string], start = 0): tuple[first, last: int] = ## returns the starting position and end position of `pattern` in `s` ## and the captured @@ -110,8 +110,8 @@ proc findBounds*(s: string, pattern: TRegEx, matches: var openarray[string], else: matches[i-1] = "" return (rawMatches[0].int, rawMatches[1].int - 1) -proc findBounds*(s: string, pattern: TRegEx, - matches: var openarray[tuple[first, last: int]], +proc findBounds*(s: string, pattern: TRegex, + matches: var openArray[tuple[first, last: int]], start = 0): tuple[first, last: int] = ## returns the starting position and end position of ``pattern`` in ``s`` ## and the captured substrings in the array `matches`. @@ -129,7 +129,7 @@ proc findBounds*(s: string, pattern: TRegEx, else: matches[i-1] = (-1,0) return (rawMatches[0].int, rawMatches[1].int - 1) -proc findBounds*(s: string, pattern: TRegEx, +proc findBounds*(s: string, pattern: TRegex, start = 0): tuple[first, last: int] = ## returns the starting position of `pattern` in `s`. If it does not ## match, ``(-1,0)`` is returned. @@ -140,14 +140,14 @@ proc findBounds*(s: string, pattern: TRegEx, if res < 0'i32: return (int(res), 0) return (int(rawMatches[0]), int(rawMatches[1]-1)) -proc matchOrFind(s: string, pattern: TRegEx, start, flags: cint): cint = +proc matchOrFind(s: string, pattern: TRegex, start, flags: cint): cint = var rawMatches: array [0..maxSubpatterns * 3 - 1, cint] result = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, flags, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if result >= 0'i32: result = rawMatches[1] - rawMatches[0] -proc match*(s: string, pattern: TRegEx, matches: var openarray[string], +proc match*(s: string, pattern: TRegex, matches: var openArray[string], start = 0): bool = ## returns ``true`` if ``s[start..]`` matches the ``pattern`` and ## the captured substrings in the array ``matches``. If it does not @@ -156,24 +156,24 @@ proc match*(s: string, pattern: TRegEx, matches: var openarray[string], return matchOrFind(s, pattern, matches, start.cint, pcre.ANCHORED) == cint(s.len - start) -proc match*(s: string, pattern: TRegEx, start = 0): bool = +proc match*(s: string, pattern: TRegex, start = 0): bool = ## returns ``true`` if ``s[start..]`` matches the ``pattern``. return matchOrFind(s, pattern, start.cint, pcre.ANCHORED) == cint(s.len-start) -proc matchLen*(s: string, pattern: TRegEx, matches: var openarray[string], +proc matchLen*(s: string, pattern: TRegex, matches: var openArray[string], start = 0): int = ## the same as ``match``, but it returns the length of the match, ## if there is no match, -1 is returned. Note that a match length ## of zero can happen. return matchOrFind(s, pattern, matches, start.cint, pcre.ANCHORED) -proc matchLen*(s: string, pattern: TRegEx, start = 0): int = +proc matchLen*(s: string, pattern: TRegex, start = 0): int = ## the same as ``match``, but it returns the length of the match, ## if there is no match, -1 is returned. Note that a match length ## of zero can happen. return matchOrFind(s, pattern, start.cint, pcre.ANCHORED) -proc find*(s: string, pattern: TRegEx, matches: var openarray[string], +proc find*(s: string, pattern: TRegex, matches: var openArray[string], start = 0): int = ## returns the starting position of ``pattern`` in ``s`` and the captured ## substrings in the array ``matches``. If it does not match, nothing @@ -190,7 +190,7 @@ proc find*(s: string, pattern: TRegEx, matches: var openarray[string], else: matches[i-1] = "" return rawMatches[0] -proc find*(s: string, pattern: TRegEx, start = 0): int = +proc find*(s: string, pattern: TRegex, start = 0): int = ## returns the starting position of ``pattern`` in ``s``. If it does not ## match, -1 is returned. var @@ -200,7 +200,7 @@ proc find*(s: string, pattern: TRegEx, start = 0): int = if res < 0'i32: return res return rawMatches[0] -iterator findAll*(s: string, pattern: TRegEx, start = 0): string = +iterator findAll*(s: string, pattern: TRegex, start = 0): string = ## Yields all matching *substrings* of `s` that match `pattern`. ## ## Note that since this is an iterator you should not modify the string you @@ -216,7 +216,7 @@ iterator findAll*(s: string, pattern: TRegEx, start = 0): string = yield substr(s, int(a), int(b)-1) i = b -proc findAll*(s: string, pattern: TRegEx, start = 0): seq[string] = +proc findAll*(s: string, pattern: TRegex, start = 0): seq[string] = ## returns all matching *substrings* of `s` that match `pattern`. ## If it does not match, @[] is returned. accumulateResult(findAll(s, pattern, start)) @@ -224,7 +224,7 @@ proc findAll*(s: string, pattern: TRegEx, start = 0): seq[string] = when not defined(nimhygiene): {.pragma: inject.} -template `=~` *(s: string, pattern: TRegEx): expr = +template `=~` *(s: string, pattern: TRegex): expr = ## This calls ``match`` with an implicit declared ``matches`` array that ## can be used in the scope of the ``=~`` call: ## @@ -244,30 +244,30 @@ template `=~` *(s: string, pattern: TRegEx): expr = ## bind maxSubPatterns when not definedInScope(matches): - var matches {.inject.}: array[0..maxSubPatterns-1, string] + var matches {.inject.}: array[0..MaxSubpatterns-1, string] match(s, pattern, matches) # ------------------------- more string handling ------------------------------ -proc contains*(s: string, pattern: TRegEx, start = 0): bool = +proc contains*(s: string, pattern: TRegex, start = 0): bool = ## same as ``find(s, pattern, start) >= 0`` return find(s, pattern, start) >= 0 -proc contains*(s: string, pattern: TRegEx, matches: var openArray[string], +proc contains*(s: string, pattern: TRegex, matches: var openArray[string], start = 0): bool = ## same as ``find(s, pattern, matches, start) >= 0`` return find(s, pattern, matches, start) >= 0 -proc startsWith*(s: string, prefix: TRegEx): bool = +proc startsWith*(s: string, prefix: TRegex): bool = ## returns true if `s` starts with the pattern `prefix` result = matchLen(s, prefix) >= 0 -proc endsWith*(s: string, suffix: TRegEx): bool = +proc endsWith*(s: string, suffix: TRegex): bool = ## returns true if `s` ends with the pattern `prefix` for i in 0 .. s.len-1: if matchLen(s, suffix, i) == s.len - i: return true -proc replace*(s: string, sub: TRegEx, by = ""): string = +proc replace*(s: string, sub: TRegex, by = ""): string = ## Replaces `sub` in `s` by the string `by`. Captures cannot be ## accessed in `by`. Examples: ## @@ -289,7 +289,7 @@ proc replace*(s: string, sub: TRegEx, by = ""): string = prev = match.last + 1 add(result, substr(s, prev)) -proc replacef*(s: string, sub: TRegEx, by: string): string = +proc replacef*(s: string, sub: TRegex, by: string): string = ## Replaces `sub` in `s` by the string `by`. Captures can be accessed in `by` ## with the notation ``$i`` and ``$#`` (see strutils.`%`). Examples: ## @@ -327,7 +327,7 @@ proc replacef*(s: string, sub: TRegEx, by: string): string = add(result, substr(s, i)) proc parallelReplace*(s: string, subs: openArray[ - tuple[pattern: TRegEx, repl: string]]): string = + tuple[pattern: TRegex, repl: string]]): string = ## Returns a modified copy of `s` with the substitutions in `subs` ## applied in parallel. result = "" @@ -347,14 +347,14 @@ proc parallelReplace*(s: string, subs: openArray[ add(result, substr(s, i)) proc transformFile*(infile, outfile: string, - subs: openArray[tuple[pattern: TRegEx, repl: string]]) = + subs: openArray[tuple[pattern: TRegex, repl: string]]) = ## reads in the file `infile`, performs a parallel replacement (calls ## `parallelReplace`) and writes back to `outfile`. Raises ``EIO`` if an ## error occurs. This is supposed to be used for quick scripting. var x = readFile(infile).string writeFile(outfile, x.parallelReplace(subs)) -iterator split*(s: string, sep: TRegEx): string = +iterator split*(s: string, sep: TRegex): string = ## Splits the string `s` into substrings. ## ## Substrings are separated by the regular expression `sep`. @@ -386,7 +386,7 @@ iterator split*(s: string, sep: TRegEx): string = if first < last: yield substr(s, first, last-1) -proc split*(s: string, sep: TRegEx): seq[string] = +proc split*(s: string, sep: TRegex): seq[string] = ## Splits the string `s` into substrings. accumulateResult(split(s, sep)) diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim index de73b500d..1726449d8 100644 --- a/lib/impure/zipfiles.nim +++ b/lib/impure/zipfiles.nim @@ -71,7 +71,7 @@ proc addFile*(z: var TZipArchive, file: string) = addFile(z, file, file) proc mySourceCallback(state, data: pointer, len: int, - cmd: Tzip_source_cmd): int {.cdecl.} = + cmd: TZipSourceCmd): int {.cdecl.} = var src = cast[PStream](state) case cmd of ZIP_SOURCE_OPEN: @@ -108,7 +108,7 @@ proc addFile*(z: var TZipArchive, dest: string, src: PStream) = type TZipFileStream = object of TStream - f: Pzip_file + f: PZipFile PZipFileStream* = ref TZipFileStream ## a reader stream of a file within a zip archive diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim index 69da2bba8..4ca0c79e0 100644 --- a/lib/packages/docutils/highlite.nim +++ b/lib/packages/docutils/highlite.nim @@ -19,7 +19,7 @@ type gtEof, gtNone, gtWhitespace, gtDecNumber, gtBinNumber, gtHexNumber, gtOctNumber, gtFloatNumber, gtIdentifier, gtKeyword, gtStringLit, gtLongStringLit, gtCharLit, gtEscapeSequence, # escape sequence like \xff - gtOperator, gtPunctation, gtComment, gtLongComment, gtRegularExpression, + gtOperator, gtPunctuation, gtComment, gtLongComment, gtRegularExpression, gtTagStart, gtTagEnd, gtKey, gtValue, gtRawData, gtAssembler, gtPreprocessor, gtDirective, gtCommand, gtRule, gtHyperlink, gtLabel, gtReference, gtOther @@ -39,7 +39,7 @@ const tokenClassToStr*: array[TTokenClass, string] = ["Eof", "None", "Whitespace", "DecNumber", "BinNumber", "HexNumber", "OctNumber", "FloatNumber", "Identifier", "Keyword", "StringLit", "LongStringLit", "CharLit", - "EscapeSequence", "Operator", "Punctation", "Comment", "LongComment", + "EscapeSequence", "Operator", "Punctuation", "Comment", "LongComment", "RegularExpression", "TagStart", "TagEnd", "Key", "Value", "RawData", "Assembler", "Preprocessor", "Directive", "Command", "Rule", "Hyperlink", "Label", "Reference", "Other"] @@ -53,7 +53,7 @@ const "interface", "is", "isnot", "iterator", "lambda", "let", "macro", "method", "mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc", "ptr", "raise", "ref", "return", "shared", "shl", "shr", "static", - "template", "try", "tuple", "type", "var", "when", "while", "with", + "template", "try", "tuple", "type", "using", "var", "when", "while", "with", "without", "xor", "yield"] proc getSourceLanguage*(name: string): TSourceLanguage = @@ -73,7 +73,7 @@ proc initGeneralTokenizer*(g: var TGeneralTokenizer, buf: string) = g.pos = pos proc deinitGeneralTokenizer*(g: var TGeneralTokenizer) = - nil + discard proc nimGetKeyword(id: string): TTokenClass = for k in nimrodKeywords: @@ -102,7 +102,7 @@ proc nimNumberPostfix(g: var TGeneralTokenizer, position: int): int = if g.buf[pos] in {'0'..'9'}: inc(pos) if g.buf[pos] in {'0'..'9'}: inc(pos) else: - nil + discard result = pos proc nimNumber(g: var TGeneralTokenizer, position: int): int = @@ -258,7 +258,7 @@ proc nimNextToken(g: var TGeneralTokenizer) = else: inc(pos) of '(', ')', '[', ']', '{', '}', '`', ':', ',', ';': inc(pos) - g.kind = gtPunctation + g.kind = gtPunctuation of '\0': g.kind = gtEof else: @@ -321,7 +321,7 @@ proc generalStrLit(g: var TGeneralTokenizer, position: int): int = inc(pos) result = pos -proc isKeyword(x: openarray[string], y: string): int = +proc isKeyword(x: openArray[string], y: string): int = var a = 0 var b = len(x) - 1 while a <= b: @@ -335,7 +335,7 @@ proc isKeyword(x: openarray[string], y: string): int = return mid result = - 1 -proc isKeywordIgnoreCase(x: openarray[string], y: string): int = +proc isKeywordIgnoreCase(x: openArray[string], y: string): int = var a = 0 var b = len(x) - 1 while a <= b: @@ -354,7 +354,7 @@ type hasPreprocessor, hasNestedComments TTokenizerFlags = set[TTokenizerFlag] -proc clikeNextToken(g: var TGeneralTokenizer, keywords: openarray[string], +proc clikeNextToken(g: var TGeneralTokenizer, keywords: openArray[string], flags: TTokenizerFlags) = const hexChars = {'0'..'9', 'A'..'F', 'a'..'f'} @@ -428,7 +428,7 @@ proc clikeNextToken(g: var TGeneralTokenizer, keywords: openarray[string], g.kind = gtOperator of 'a'..'z', 'A'..'Z', '_', '\x80'..'\xFF': var id = "" - while g.buf[pos] in SymChars: + while g.buf[pos] in symChars: add(id, g.buf[pos]) inc(pos) if isKeyword(keywords, id) >= 0: g.kind = gtKeyword @@ -473,7 +473,7 @@ proc clikeNextToken(g: var TGeneralTokenizer, keywords: openarray[string], else: inc(pos) of '(', ')', '[', ']', '{', '}', ':', ',', ';', '.': inc(pos) - g.kind = gtPunctation + g.kind = gtPunctuation of '\0': g.kind = gtEof else: diff --git a/lib/packages/docutils/rst.nim b/lib/packages/docutils/rst.nim index 91664cd50..bb018bc1e 100644 --- a/lib/packages/docutils/rst.nim +++ b/lib/packages/docutils/rst.nim @@ -130,7 +130,7 @@ proc getThing(L: var TLexer, tok: var TToken, s: TCharSet) = tok.line = L.line tok.col = L.col var pos = L.bufpos - while True: + while true: add(tok.symbol, L.buf[pos]) inc(pos) if L.buf[pos] notin s: break @@ -143,7 +143,7 @@ proc getAdornment(L: var TLexer, tok: var TToken) = tok.col = L.col var pos = L.bufpos var c = L.buf[pos] - while True: + while true: add(tok.symbol, L.buf[pos]) inc(pos) if L.buf[pos] != c: break @@ -162,7 +162,7 @@ proc getIndentAux(L: var TLexer, start: int): int = if L.skipPounds: if buf[pos] == '#': inc(pos) if buf[pos] == '#': inc(pos) - while True: + while true: case buf[pos] of ' ', '\x0B', '\x0C': inc(pos) @@ -242,7 +242,7 @@ proc getTokens(buffer: string, skipPounds: bool, tokens: var TTokenSeq): int = inc(result) while true: inc(length) - setlen(tokens, length) + setLen(tokens, length) rawGetTok(L, tokens[length - 1]) if tokens[length - 1].kind == tkEof: break if tokens[0].kind == tkWhite: @@ -251,7 +251,7 @@ proc getTokens(buffer: string, skipPounds: bool, tokens: var TTokenSeq): int = tokens[0].kind = tkIndent type - TLevelMap = array[Char, int] + TLevelMap = array[char, int] TSubstitution{.final.} = object key*: string value*: PRstNode @@ -294,11 +294,11 @@ proc whichMsgClass*(k: TMsgKind): TMsgClass = proc defaultMsgHandler*(filename: string, line, col: int, msgkind: TMsgKind, arg: string) {.procvar.} = - let mc = msgKind.whichMsgClass - let a = messages[msgKind] % arg + let mc = msgkind.whichMsgClass + let a = messages[msgkind] % arg let message = "$1($2, $3) $4: $5" % [filename, $line, $col, $mc, a] if mc == mcError: raise newException(EParseError, message) - else: Writeln(stdout, message) + else: writeln(stdout, message) proc defaultFindFile*(filename: string): string {.procvar.} = if existsFile(filename): result = filename @@ -339,7 +339,7 @@ proc pushInd(p: var TRstParser, ind: int) = add(p.indentStack, ind) proc popInd(p: var TRstParser) = - if len(p.indentStack) > 1: setlen(p.indentStack, len(p.indentStack) - 1) + if len(p.indentStack) > 1: setLen(p.indentStack, len(p.indentStack) - 1) proc initParser(p: var TRstParser, sharedState: PSharedState) = p.indentStack = @[0] @@ -408,7 +408,7 @@ proc setSub(p: var TRstParser, key: string, value: PRstNode) = if key == p.s.subs[i].key: p.s.subs[i].value = value return - setlen(p.s.subs, length + 1) + setLen(p.s.subs, length + 1) p.s.subs[length].key = key p.s.subs[length].value = value @@ -421,7 +421,7 @@ proc setRef(p: var TRstParser, key: string, value: PRstNode) = p.s.refs[i].value = value return - setlen(p.s.refs, length + 1) + setLen(p.s.refs, length + 1) p.s.refs[length].key = key p.s.refs[length].value = value @@ -479,7 +479,7 @@ proc isInlineMarkupEnd(p: TRstParser, markup: string): bool = result = false proc isInlineMarkupStart(p: TRstParser, markup: string): bool = - var d: Char + var d: char result = p.tok[p.idx].symbol == markup if not result: return # Rule 1: @@ -535,7 +535,7 @@ proc match(p: TRstParser, start: int, expr: string): bool = case p.tok[j].symbol[0] of 'a'..'z', 'A'..'Z': result = len(p.tok[j].symbol) == 1 of '0'..'9': result = allCharsInSet(p.tok[j].symbol, {'0'..'9'}) - else: nil + else: discard else: var c = expr[i] var length = 0 @@ -615,7 +615,7 @@ proc matchVerbatim(p: TRstParser, start: int, expr: string): int = proc parseSmiley(p: var TRstParser): PRstNode = if p.tok[p.idx].symbol[0] notin SmileyStartChars: return - for key, val in items(smilies): + for key, val in items(Smilies): let m = matchVerbatim(p, p.idx, key) if m > 0: p.idx = m @@ -629,18 +629,18 @@ when false: '$', '(', ')', '~', '_', '?', '+', '-', '=', '\\', '.', '&', '\128'..'\255'} -proc isURL(p: TRstParser, i: int): bool = +proc isUrl(p: TRstParser, i: int): bool = result = (p.tok[i+1].symbol == ":") and (p.tok[i+2].symbol == "//") and (p.tok[i+3].kind == tkWord) and (p.tok[i].symbol in ["http", "https", "ftp", "telnet", "file"]) -proc parseURL(p: var TRstParser, father: PRstNode) = +proc parseUrl(p: var TRstParser, father: PRstNode) = #if p.tok[p.idx].symbol[strStart] == '<': - if isURL(p, p.idx): + if isUrl(p, p.idx): var n = newRstNode(rnStandaloneHyperlink) while true: case p.tok[p.idx].kind - of tkWord, tkAdornment, tkOther: nil + of tkWord, tkAdornment, tkOther: discard of tkPunct: if p.tok[p.idx+1].kind notin {tkWord, tkAdornment, tkOther, tkPunct}: break @@ -806,7 +806,7 @@ proc parseInline(p: var TRstParser, father: PRstNode) = return add(father, newLeaf(p)) inc(p.idx) - else: nil + else: discard proc getDirective(p: var TRstParser): string = if p.tok[p.idx].kind == tkWhite and p.tok[p.idx+1].kind == tkWord: @@ -835,14 +835,14 @@ proc parseComment(p: var TRstParser): PRstNode = inc(p.idx) # empty comment else: var indent = p.tok[p.idx].ival - while True: + while true: case p.tok[p.idx].kind of tkEof: break of tkIndent: if (p.tok[p.idx].ival < indent): break else: - nil + discard inc(p.idx) else: while p.tok[p.idx].kind notin {tkIndent, tkEof}: inc(p.idx) @@ -864,18 +864,24 @@ proc getDirKind(s: string): TDirKind = else: result = dkNone proc parseLine(p: var TRstParser, father: PRstNode) = - while True: + while true: case p.tok[p.idx].kind of tkWhite, tkWord, tkOther, tkPunct: parseInline(p, father) else: break + +proc parseUntilNewline(p: var TRstParser, father: PRstNode) = + while true: + case p.tok[p.idx].kind + of tkWhite, tkWord, tkAdornment, tkOther, tkPunct: parseInline(p, father) + of tkEof, tkIndent: break proc parseSection(p: var TRstParser, result: PRstNode) proc parseField(p: var TRstParser): PRstNode = result = newRstNode(rnField) var col = p.tok[p.idx].col - var fieldname = newRstNode(rnFieldname) + var fieldname = newRstNode(rnFieldName) parseUntil(p, fieldname, ":", false) - var fieldbody = newRstNode(rnFieldbody) + var fieldbody = newRstNode(rnFieldBody) if p.tok[p.idx].kind != tkIndent: parseLine(p, fieldbody) if p.tok[p.idx].kind == tkIndent: var indent = p.tok[p.idx].ival @@ -927,7 +933,7 @@ proc parseLiteralBlock(p: var TRstParser): PRstNode = if p.tok[p.idx].kind == tkIndent: var indent = p.tok[p.idx].ival inc(p.idx) - while True: + while true: case p.tok[p.idx].kind of tkEof: break @@ -947,7 +953,7 @@ proc parseLiteralBlock(p: var TRstParser): PRstNode = inc(p.idx) add(result, n) -proc getLevel(map: var TLevelMap, lvl: var int, c: Char): int = +proc getLevel(map: var TLevelMap, lvl: var int, c: char): int = if map[c] == 0: inc(lvl) map[c] = lvl @@ -993,7 +999,7 @@ proc whichSection(p: TRstParser): TRstNodeKind = elif match(p, p.idx + 1, "i"): result = rnOverline else: result = rnLeaf of tkPunct: - if match(p, tokenAfterNewLine(p), "ai"): + if match(p, tokenAfterNewline(p), "ai"): result = rnHeadline elif p.tok[p.idx].symbol == "::": result = rnLiteralBlock @@ -1020,7 +1026,7 @@ proc whichSection(p: TRstParser): TRstNodeKind = else: result = rnParagraph of tkWord, tkOther, tkWhite: - if match(p, tokenAfterNewLine(p), "ai"): result = rnHeadline + if match(p, tokenAfterNewline(p), "ai"): result = rnHeadline elif match(p, p.idx, "e) ") or match(p, p.idx, "e. "): result = rnEnumList elif isDefList(p): result = rnDefList else: result = rnParagraph @@ -1046,7 +1052,7 @@ proc parseLineBlock(p: var TRstParser): PRstNode = popInd(p) proc parseParagraph(p: var TRstParser, result: PRstNode) = - while True: + while true: case p.tok[p.idx].kind of tkIndent: if p.tok[p.idx + 1].kind == tkIndent: @@ -1078,7 +1084,7 @@ proc parseParagraph(p: var TRstParser, result: PRstNode) = proc parseHeadline(p: var TRstParser): PRstNode = result = newRstNode(rnHeadline) - parseLine(p, result) + parseUntilNewline(p, result) assert(p.tok[p.idx].kind == tkIndent) assert(p.tok[p.idx + 1].kind == tkAdornment) var c = p.tok[p.idx + 1].symbol[0] @@ -1095,7 +1101,7 @@ proc getColumns(p: var TRstParser, cols: var TIntSeq) = var L = 0 while true: inc(L) - setlen(cols, L) + setLen(cols, L) cols[L - 1] = tokEnd(p) assert(p.tok[p.idx].kind == tkAdornment) inc(p.idx) @@ -1113,7 +1119,7 @@ proc parseSimpleTable(p: var TRstParser): PRstNode = cols: TIntSeq row: seq[string] i, last, line: int - c: Char + c: char q: TRstParser a, b: PRstNode result = newRstNode(rnTable) @@ -1129,7 +1135,7 @@ proc parseSimpleTable(p: var TRstParser): PRstNode = p.idx = last break getColumns(p, cols) - setlen(row, len(cols)) + setLen(row, len(cols)) if a != nil: for j in 0..len(a)-1: a.sons[j].kind = rnTableHeaderCell if p.tok[p.idx].kind == tkEof: break @@ -1172,7 +1178,7 @@ proc parseOverline(p: var TRstParser): PRstNode = inc(p.idx, 2) result = newRstNode(rnOverline) while true: - parseLine(p, result) + parseUntilNewline(p, result) if p.tok[p.idx].kind == tkIndent: inc(p.idx) if p.tok[p.idx - 1].ival > currInd(p): @@ -1237,7 +1243,7 @@ proc parseOptionList(p: var TRstParser): PRstNode = proc parseDefinitionList(p: var TRstParser): PRstNode = result = nil - var j = tokenAfterNewLine(p) - 1 + var j = tokenAfterNewline(p) - 1 if (j >= 1) and (p.tok[j].kind == tkIndent) and (p.tok[j].ival > currInd(p)) and (p.tok[j - 1].symbol != "::"): var col = p.tok[p.idx].col @@ -1263,10 +1269,10 @@ proc parseDefinitionList(p: var TRstParser): PRstNode = break if (p.tok[p.idx].kind == tkIndent) and (p.tok[p.idx].ival == col): inc(p.idx) - j = tokenAfterNewLine(p) - 1 + j = tokenAfterNewline(p) - 1 if j >= 1 and p.tok[j].kind == tkIndent and p.tok[j].ival > col and p.tok[j-1].symbol != "::" and p.tok[j+1].kind != tkIndent: - nil + discard else: break if len(result) == 0: result = nil @@ -1284,7 +1290,7 @@ proc parseEnumList(p: var TRstParser): PRstNode = var col = p.tok[p.idx].col result = newRstNode(rnEnumList) inc(p.idx, wildpos[w] + 3) - var j = tokenAfterNewLine(p) + var j = tokenAfterNewline(p) if (p.tok[j].col == p.tok[p.idx].col) or match(p, j, wildcards[w]): pushInd(p, p.tok[p.idx].col) while true: @@ -1329,11 +1335,11 @@ proc parseSection(p: var TRstParser, result: PRstNode) = inc(p.idx) # skip '::' a = parseLiteralBlock(p) of rnBulletList: a = parseBulletList(p) - of rnLineblock: a = parseLineBlock(p) + of rnLineBlock: a = parseLineBlock(p) of rnDirective: a = parseDotDot(p) of rnEnumList: a = parseEnumList(p) of rnLeaf: rstMessage(p, meNewSectionExpected) - of rnParagraph: nil + of rnParagraph: discard of rnDefList: a = parseDefinitionList(p) of rnFieldList: if p.idx > 0: dec(p.idx) @@ -1345,7 +1351,7 @@ proc parseSection(p: var TRstParser, result: PRstNode) = of rnOptionList: a = parseOptionList(p) else: #InternalError("rst.parseSection()") - nil + discard if a == nil and k != rnDirective: a = newRstNode(rnParagraph) parseParagraph(p, a) @@ -1388,7 +1394,7 @@ proc parseDirective(p: var TRstParser, flags: TDirFlags): PRstNode = if hasArg in flags: args = newRstNode(rnDirArg) if argIsFile in flags: - while True: + while true: case p.tok[p.idx].kind of tkWord, tkOther, tkPunct, tkAdornment: add(args, newLeaf(p)) @@ -1560,7 +1566,7 @@ proc parseDotDot(p: var TRstParser): PRstNode = result = dirRaw(p) else: rstMessage(p, meInvalidDirective, d) - of dkCodeblock: result = dirCodeBlock(p) + of dkCodeBlock: result = dirCodeBlock(p) of dkIndex: result = dirIndex(p) else: rstMessage(p, meInvalidDirective, d) popInd(p) @@ -1618,7 +1624,7 @@ proc resolveSubs(p: var TRstParser, n: PRstNode): PRstNode = add(result, n) add(result, y) of rnLeaf: - nil + discard of rnContents: p.hasToc = true else: diff --git a/lib/packages/docutils/rstast.nim b/lib/packages/docutils/rstast.nim index 3d191dacb..f5ef0f53d 100644 --- a/lib/packages/docutils/rstast.nim +++ b/lib/packages/docutils/rstast.nim @@ -62,9 +62,9 @@ type # leaf val - PRSTNode* = ref TRstNode ## an RST node + PRstNode* = ref TRstNode ## an RST node TRstNodeSeq* = seq[PRstNode] - TRSTNode* {.acyclic, final.} = object ## an RST node's description + TRstNode* {.acyclic, final.} = object ## an RST node's description kind*: TRstNodeKind ## the node's kind text*: string ## valid for leafs in the AST; and the title of ## the document or the section @@ -120,11 +120,11 @@ proc renderRstToRst(d: var TRenderContext, n: PRstNode, result: var string) = let oldLen = result.len renderRstSons(d, n, result) - let HeadlineLen = result.len - oldLen + let headlineLen = result.len - oldLen result.add("\n") result.add(ind) - result.add repeatChar(HeadlineLen, lvlToChar[n.level]) + result.add repeatChar(headlineLen, lvlToChar[n.level]) of rnOverline: result.add("\n") result.add(ind) @@ -132,7 +132,7 @@ proc renderRstToRst(d: var TRenderContext, n: PRstNode, result: var string) = var headline = "" renderRstSons(d, n, headline) - let lvl = repeatChar(headline.Len - d.indent, lvlToChar[n.level]) + let lvl = repeatChar(headline.len - d.indent, lvlToChar[n.level]) result.add(lvl) result.add("\n") result.add(headline) diff --git a/lib/packages/docutils/rstgen.nim b/lib/packages/docutils/rstgen.nim index 364f847cc..5c09d521e 100644 --- a/lib/packages/docutils/rstgen.nim +++ b/lib/packages/docutils/rstgen.nim @@ -7,7 +7,18 @@ # distribution, for details about the copyright. # -## This module implements a generator of HTML/Latex from `reStructuredText`:idx:. +## This module implements a generator of HTML/Latex from +## `reStructuredText`:idx: (see http://docutils.sourceforge.net/rst.html for +## information on this markup syntax). You can generate HTML output through the +## convenience proc ``rstToHtml``, which provided an input string with rst +## markup returns a string with the generated HTML. The final output is meant +## to be embedded inside a full document you provide yourself, so it won't +## contain the usual ``<header>`` or ``<body>`` parts. +## +## You can also create a ``TRstGenerator`` structure and populate it with the +## other lower level methods to finally build complete documents. This requires +## many options and tweaking, but you are not limited to snippets and can +## generate `LaTeX documents <https://en.wikipedia.org/wiki/LaTeX>`_ too. import strutils, os, hashes, strtabs, rstast, rst, highlite @@ -33,20 +44,58 @@ type splitAfter*: int # split too long entries in the TOC tocPart*: seq[TTocEntry] hasToc*: bool - theIndex: string + theIndex: string # Contents of the index file to be dumped at the end. options*: TRstParseOptions findFile*: TFindFileHandler msgHandler*: TMsgHandler filename*: string meta*: array[TMetaEnum, string] - PDoc = var TRstGenerator + PDoc = var TRstGenerator ## Alias to type less. proc initRstGenerator*(g: var TRstGenerator, target: TOutputTarget, config: PStringTable, filename: string, options: TRstParseOptions, findFile: TFindFileHandler, msgHandler: TMsgHandler) = + ## Initializes a ``TRstGenerator``. + ## + ## You need to call this before using a ``TRstGenerator`` with any other + ## procs in this module. Pass a non ``nil`` ``PStringTable`` value as + ## ``config`` with parameters used by the HTML output generator. If you + ## don't know what to use, pass the results of the ``defaultConfig()`` proc. + ## The ``filename`` is symbolic and used only for error reporting, you can + ## pass any non ``nil`` string here. + ## + ## The ``TRstParseOptions``, ``TFindFileHandler`` and ``TMsgHandler`` types + ## are defined in the the `packages/docutils/rst module <rst.html>`_. + ## ``options`` selects the behaviour of the rst parser. + ## + ## ``findFile`` is a proc used by the rst ``include`` directive among others. + ## The purpose of this proc is to mangle or filter paths. It receives paths + ## specified in the rst document and has to return a valid path to existing + ## files or the empty string otherwise. If you pass ``nil``, a default proc + ## will be used which given a path returns the input path only if the file + ## exists. One use for this proc is to transform relative paths found in the + ## document to absolute path, useful if the rst file and the resources it + ## references are not in the same directory as the current working directory. + ## + ## The ``msgHandler`` is a proc used for user error reporting. It will be + ## called with the filename, line, col, and type of any error found during + ## parsing. If you pass ``nil``, a default message handler will be used which + ## writes the messages to the standard output. + ## + ## Example: + ## + ## .. code-block:: nimrod + ## + ## import packages/docutils/rstgen + ## + ## var gen: TRstGenerator + ## + ## gen.initRstGenerator(outHtml, defaultConfig(), + ## "filename", {}, nil, nil) + g.config = config g.target = target g.tocPart = @[] @@ -62,9 +111,13 @@ proc initRstGenerator*(g: var TRstGenerator, target: TOutputTarget, for i in low(g.meta)..high(g.meta): g.meta[i] = "" proc writeIndexFile*(g: var TRstGenerator, outfile: string) = + ## Writes the current index buffer to the specified output file. + ## + ## You previously need to add entries to the index with the ``setIndexTerm`` + ## proc. If the index is empty the file won't be created. if g.theIndex.len > 0: writeFile(outfile, g.theIndex) -proc addXmlChar(dest: var string, c: Char) = +proc addXmlChar(dest: var string, c: char) = case c of '&': add(dest, "&") of '<': add(dest, "<") @@ -72,14 +125,14 @@ proc addXmlChar(dest: var string, c: Char) = of '\"': add(dest, """) else: add(dest, c) -proc addRtfChar(dest: var string, c: Char) = +proc addRtfChar(dest: var string, c: char) = case c of '{': add(dest, "\\{") of '}': add(dest, "\\}") of '\\': add(dest, "\\\\") else: add(dest, c) -proc addTexChar(dest: var string, c: Char) = +proc addTexChar(dest: var string, c: char) = case c of '_': add(dest, "\\_") of '{': add(dest, "\\symbol{123}") @@ -99,7 +152,7 @@ proc addTexChar(dest: var string, c: Char) = var splitter*: string = "<wbr />" -proc escChar*(target: TOutputTarget, dest: var string, c: Char) {.inline.} = +proc escChar*(target: TOutputTarget, dest: var string, c: char) {.inline.} = case target of outHtml: addXmlChar(dest, c) of outLatex: addTexChar(dest, c) @@ -112,7 +165,7 @@ proc nextSplitPoint*(s: string, start: int): int = of 'a'..'z': if result + 1 < len(s) + 0: if s[result + 1] in {'A'..'Z'}: return - else: nil + else: discard inc(result) dec(result) # last valid index @@ -147,7 +200,19 @@ proc dispA(target: TOutputTarget, dest: var string, if target != outLatex: addf(dest, xml, args) else: addf(dest, tex, args) -proc renderRstToOut*(d: PDoc, n: PRstNode, result: var string) +proc renderRstToOut*(d: var TRstGenerator, n: PRstNode, result: var string) + ## Writes into ``result`` the rst ast ``n`` using the ``d`` configuration. + ## + ## Before using this proc you need to initialise a ``TRstGenerator`` with + ## ``initRstGenerator`` and parse a rst file with ``rstParse`` from the + ## `packages/docutils/rst module <rst.html>`_. Example: + ## + ## .. code-block:: nimrod + ## + ## # ...configure gen and rst vars... + ## var generatedHTML = "" + ## renderRstToOut(gen, rst, generatedHTML) + ## echo generatedHTML proc renderAux(d: PDoc, n: PRstNode, result: var string) = for i in countup(0, len(n)-1): renderRstToOut(d, n.sons[i], result) @@ -162,7 +227,14 @@ proc renderAux(d: PDoc, n: PRstNode, frmtA, frmtB: string, result: var string) = # ---------------- index handling -------------------------------------------- -proc setIndexTerm*(d: PDoc, id, term: string) = +proc setIndexTerm*(d: var TRstGenerator, id, term: string) = + ## Adds a `term` to the index using the specified hyperlink identifier. + ## + ## The ``d.theIndex`` string will be used to append the term in the format + ## ``term<tab>file#id``. The anchor will be the based on the name of the file + ## currently being parsed plus the `id`, which will be appended after a hash. + ## + ## The index won't be written to disk unless you call ``writeIndexFile``. d.theIndex.add(term) d.theIndex.add('\t') let htmlFile = changeFileExt(extractFilename(d.filename), HtmlExt) @@ -202,14 +274,14 @@ proc `<-`(a: var TIndexEntry, b: TIndexEntry) = proc sortIndex(a: var openArray[TIndexEntry]) = # we use shellsort here; fast and simple - let N = len(a) + let n = len(a) var h = 1 while true: h = 3 * h + 1 - if h > N: break + if h > n: break while true: h = h div 3 - for i in countup(h, N - 1): + for i in countup(h, n - 1): var v: TIndexEntry v <- a[i] var j = i @@ -259,7 +331,7 @@ proc renderHeadline(d: PDoc, n: PRstNode, result: var string) = var refname = rstnodeToRefname(n) if d.hasToc: var length = len(d.tocPart) - setlen(d.tocPart, length + 1) + setLen(d.tocPart, length + 1) d.tocPart[length].refname = refname d.tocPart[length].n = n d.tocPart[length].header = tmp @@ -295,7 +367,7 @@ proc renderTocEntry(d: PDoc, e: TTocEntry, result: var string) = "<li><a class=\"reference\" id=\"$1_toc\" href=\"#$1\">$2</a></li>\n", "\\item\\label{$1_toc} $2\\ref{$1}\n", [e.refname, e.header]) -proc renderTocEntries*(d: PDoc, j: var int, lvl: int, result: var string) = +proc renderTocEntries*(d: var TRstGenerator, j: var int, lvl: int, result: var string) = var tmp = "" while j <= high(d.tocPart): var a = abs(d.tocPart[j].n.level) @@ -395,7 +467,7 @@ proc renderField(d: PDoc, n: PRstNode, result: var string) = if d.meta[metaAuthor].len == 0: d.meta[metaAuthor] = fieldval b = true - elif cmpIgnoreStyle(fieldName, "version") == 0: + elif cmpIgnoreStyle(fieldname, "version") == 0: if d.meta[metaVersion].len == 0: d.meta[metaVersion] = fieldval b = true @@ -559,14 +631,14 @@ proc renderRstToOut(d: PDoc, n: PRstNode, result: var string) = # ----------------------------------------------------------------------------- -proc getVarIdx(varnames: openarray[string], id: string): int = +proc getVarIdx(varnames: openArray[string], id: string): int = for i in countup(0, high(varnames)): if cmpIgnoreStyle(varnames[i], id) == 0: return i result = -1 -proc formatNamedVars*(frmt: string, varnames: openarray[string], - varvalues: openarray[string]): string = +proc formatNamedVars*(frmt: string, varnames: openArray[string], + varvalues: openArray[string]): string = var i = 0 var L = len(frmt) result = "" @@ -585,7 +657,7 @@ proc formatNamedVars*(frmt: string, varnames: openarray[string], of '0'..'9': var j = 0 while true: - j = (j * 10) + Ord(frmt[i]) - ord('0') + j = (j * 10) + ord(frmt[i]) - ord('0') inc(i) if i > L-1 or frmt[i] notin {'0'..'9'}: break if j > high(varvalues) + 1: @@ -627,7 +699,18 @@ proc formatNamedVars*(frmt: string, varnames: openarray[string], proc defaultConfig*(): PStringTable = - ## creates a default configuration for HTML generation. + ## Returns a default configuration for embedded HTML generation. + ## + ## The returned ``PStringTable`` contains the paramters used by the HTML + ## engine to build the final output. For information on what these parameters + ## are and their purpose, please look up the file ``config/nimdoc.cfg`` + ## bundled with the compiler. + ## + ## The only difference between the contents of that file and the values + ## provided by this proc is the ``doc.file`` variable. The ``doc.file`` + ## variable of the configuration file contains HTML to build standalone + ## pages, while this proc returns just the content for procs like + ## ``rstToHtml`` to generate the bare minimum HTML. result = newStringTable(modeStyleInsensitive) template setConfigVar(key, val: expr) = @@ -678,8 +761,26 @@ $content proc rstToHtml*(s: string, options: TRstParseOptions, config: PStringTable): string = - ## exported for *nimforum*. - + ## Converts an input rst string into embeddable HTML. + ## + ## This convenience proc parses any input string using rst markup (it doesn't + ## have to be a full document!) and returns an embeddable piece of HTML. The + ## proc is meant to be used in *online* environments without access to a + ## meaningful filesystem, and therefore rst ``include`` like directives won't + ## work. For an explanation of the ``config`` parameter see the + ## ``initRstGenerator`` proc. Example: + ## + ## .. code-block:: nimrod + ## import packages/docutils/rstgen, strtabs + ## + ## echo rstToHtml("*Hello* **world**!", {}, + ## newStringTable(modeStyleInsensitive)) + ## # --> <em>Hello</em> <strong>world</strong>! + ## + ## If you need to allow the rst ``include`` directive or tweak the generated + ## output you have to create your own ``TRstGenerator`` with + ## ``initRstGenerator`` and related procs. + proc myFindFile(filename: string): string = # we don't find any files in online mode: result = "" @@ -692,4 +793,8 @@ proc rstToHtml*(s: string, options: TRstParseOptions, var rst = rstParse(s, filen, 0, 1, dummyHasToc, options) result = "" renderRstToOut(d, rst, result) - + + +when isMainModule: + echo rstToHtml("*Hello* **world**!", {}, + newStringTable(modeStyleInsensitive)) diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index 806c255ee..41260b36f 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -14,7 +14,7 @@ ## This is a raw POSIX interface module. It does not not provide any ## convenience: cstrings are used instead of proper Nimrod strings and -## return codes indicate errors. If you want exceptions +## return codes indicate errors. If you want exceptions ## and a proper Nimrod-like interface, use the OS module or write a wrapper. ## Coding conventions: @@ -63,74 +63,74 @@ const MM_NULLTXT* = nil MM_NULLACT* = nil MM_NULLTAG* = nil - + STDERR_FILENO* = 2 ## File number of stderr; STDIN_FILENO* = 0 ## File number of stdin; - STDOUT_FILENO* = 1 ## File number of stdout; + STDOUT_FILENO* = 1 ## File number of stdout; when defined(endb): # to not break bootstrapping again ... type - TDIR* {.importc: "DIR", header: "<dirent.h>", + TDIR* {.importc: "DIR", header: "<dirent.h>", final, pure, incompleteStruct.} = object - ## A type representing a directory stream. + ## A type representing a directory stream. else: type - TDIR* {.importc: "DIR", header: "<dirent.h>", + TDIR* {.importc: "DIR", header: "<dirent.h>", final, pure.} = object - ## A type representing a directory stream. - + ## A type representing a directory stream. + type TSocketHandle* = distinct cint # The type used to represent socket descriptors - Tdirent* {.importc: "struct dirent", + Tdirent* {.importc: "struct dirent", header: "<dirent.h>", final, pure.} = object ## dirent_t struct - d_ino*: TIno ## File serial number. + d_ino*: Tino ## File serial number. d_name*: array [0..255, char] ## Name of entry. Tflock* {.importc: "flock", final, pure, header: "<fcntl.h>".} = object ## flock type - l_type*: cshort ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. - l_whence*: cshort ## Flag for starting offset. - l_start*: Toff ## Relative offset in bytes. - l_len*: Toff ## Size; if 0 then until EOF. - l_pid*: TPid ## Process ID of the process holding the lock; - ## returned with F_GETLK. - - Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final, pure.} = + l_type*: cshort ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. + l_whence*: cshort ## Flag for starting offset. + l_start*: TOff ## Relative offset in bytes. + l_len*: TOff ## Size; if 0 then until EOF. + l_pid*: TPid ## Process ID of the process holding the lock; + ## returned with F_GETLK. + + Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final, pure.} = object ## Represents the entire floating-point environment. The ## floating-point environment refers collectively to any ## floating-point status flags and control modes supported ## by the implementation. - Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final, pure.} = - object ## Represents the floating-point status flags collectively, - ## including any status the implementation associates with the - ## flags. A floating-point status flag is a system variable + Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final, pure.} = + object ## Represents the floating-point status flags collectively, + ## including any status the implementation associates with the + ## flags. A floating-point status flag is a system variable ## whose value is set (but never cleared) when a floating-point ## exception is raised, which occurs as a side effect of ## exceptional floating-point arithmetic to provide auxiliary ## information. A floating-point control mode is a system variable - ## whose value may be set by the user to affect the subsequent + ## whose value may be set by the user to affect the subsequent ## behavior of floating-point arithmetic. TFTW* {.importc: "struct FTW", header: "<ftw.h>", final, pure.} = object base*: cint level*: cint - - TGlob* {.importc: "glob_t", header: "<glob.h>", + + TGlob* {.importc: "glob_t", header: "<glob.h>", final, pure.} = object ## glob_t - gl_pathc*: int ## Count of paths matched by pattern. - gl_pathv*: cstringArray ## Pointer to a list of matched pathnames. - gl_offs*: int ## Slots to reserve at the beginning of gl_pathv. - - TGroup* {.importc: "struct group", header: "<grp.h>", + gl_pathc*: int ## Count of paths matched by pattern. + gl_pathv*: cstringArray ## Pointer to a list of matched pathnames. + gl_offs*: int ## Slots to reserve at the beginning of gl_pathv. + + TGroup* {.importc: "struct group", header: "<grp.h>", final, pure.} = object ## struct group - gr_name*: cstring ## The name of the group. - gr_gid*: TGid ## Numerical group ID. - gr_mem*: cstringArray ## Pointer to a null-terminated array of character - ## pointers to member names. + gr_name*: cstring ## The name of the group. + gr_gid*: TGid ## Numerical group ID. + gr_mem*: cstringArray ## Pointer to a null-terminated array of character + ## pointers to member names. - Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final, pure.} = + Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final, pure.} = object ## Identifies the conversion from one codeset to another. Tlconv* {.importc: "struct lconv", header: "<locale.h>", final, @@ -161,21 +161,21 @@ type thousands_sep*: cstring TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final, pure.} = object - TMqAttr* {.importc: "struct mq_attr", - header: "<mqueue.h>", + TMqAttr* {.importc: "struct mq_attr", + header: "<mqueue.h>", final, pure.} = object ## message queue attribute - mq_flags*: int ## Message queue flags. - mq_maxmsg*: int ## Maximum number of messages. - mq_msgsize*: int ## Maximum message size. - mq_curmsgs*: int ## Number of messages currently queued. + mq_flags*: int ## Message queue flags. + mq_maxmsg*: int ## Maximum number of messages. + mq_msgsize*: int ## Maximum message size. + mq_curmsgs*: int ## Number of messages currently queued. - TPasswd* {.importc: "struct passwd", header: "<pwd.h>", + TPasswd* {.importc: "struct passwd", header: "<pwd.h>", final, pure.} = object ## struct passwd - pw_name*: cstring ## User's login name. - pw_uid*: TUid ## Numerical user ID. - pw_gid*: TGid ## Numerical group ID. - pw_dir*: cstring ## Initial working directory. - pw_shell*: cstring ## Program to use as shell. + pw_name*: cstring ## User's login name. + pw_uid*: Tuid ## Numerical user ID. + pw_gid*: TGid ## Numerical group ID. + pw_dir*: cstring ## Initial working directory. + pw_shell*: cstring ## Program to use as shell. Tblkcnt* {.importc: "blkcnt_t", header: "<sys/types.h>".} = int ## used for file block counts @@ -195,289 +195,289 @@ type TOff* {.importc: "off_t", header: "<sys/types.h>".} = int64 TPid* {.importc: "pid_t", header: "<sys/types.h>".} = int Tpthread_attr* {.importc: "pthread_attr_t", header: "<sys/types.h>".} = int - Tpthread_barrier* {.importc: "pthread_barrier_t", + Tpthread_barrier* {.importc: "pthread_barrier_t", header: "<sys/types.h>".} = int - Tpthread_barrierattr* {.importc: "pthread_barrierattr_t", + Tpthread_barrierattr* {.importc: "pthread_barrierattr_t", header: "<sys/types.h>".} = int Tpthread_cond* {.importc: "pthread_cond_t", header: "<sys/types.h>".} = int - Tpthread_condattr* {.importc: "pthread_condattr_t", + Tpthread_condattr* {.importc: "pthread_condattr_t", header: "<sys/types.h>".} = int Tpthread_key* {.importc: "pthread_key_t", header: "<sys/types.h>".} = int Tpthread_mutex* {.importc: "pthread_mutex_t", header: "<sys/types.h>".} = int - Tpthread_mutexattr* {.importc: "pthread_mutexattr_t", + Tpthread_mutexattr* {.importc: "pthread_mutexattr_t", header: "<sys/types.h>".} = int Tpthread_once* {.importc: "pthread_once_t", header: "<sys/types.h>".} = int - Tpthread_rwlock* {.importc: "pthread_rwlock_t", + Tpthread_rwlock* {.importc: "pthread_rwlock_t", header: "<sys/types.h>".} = int - Tpthread_rwlockattr* {.importc: "pthread_rwlockattr_t", + Tpthread_rwlockattr* {.importc: "pthread_rwlockattr_t", header: "<sys/types.h>".} = int - Tpthread_spinlock* {.importc: "pthread_spinlock_t", + Tpthread_spinlock* {.importc: "pthread_spinlock_t", header: "<sys/types.h>".} = int Tpthread* {.importc: "pthread_t", header: "<sys/types.h>".} = int Tsuseconds* {.importc: "suseconds_t", header: "<sys/types.h>".} = int #Ttime* {.importc: "time_t", header: "<sys/types.h>".} = int Ttimer* {.importc: "timer_t", header: "<sys/types.h>".} = int Ttrace_attr* {.importc: "trace_attr_t", header: "<sys/types.h>".} = int - Ttrace_event_id* {.importc: "trace_event_id_t", + Ttrace_event_id* {.importc: "trace_event_id_t", header: "<sys/types.h>".} = int - Ttrace_event_set* {.importc: "trace_event_set_t", + Ttrace_event_set* {.importc: "trace_event_set_t", header: "<sys/types.h>".} = int Ttrace_id* {.importc: "trace_id_t", header: "<sys/types.h>".} = int Tuid* {.importc: "uid_t", header: "<sys/types.h>".} = int Tuseconds* {.importc: "useconds_t", header: "<sys/types.h>".} = int - - Tutsname* {.importc: "struct utsname", - header: "<sys/utsname.h>", + + Tutsname* {.importc: "struct utsname", + header: "<sys/utsname.h>", final, pure.} = object ## struct utsname - sysname*, ## Name of this implementation of the operating system. - nodename*, ## Name of this node within the communications - ## network to which this node is attached, if any. - release*, ## Current release level of this implementation. - version*, ## Current version level of this release. + sysname*, ## Name of this implementation of the operating system. + nodename*, ## Name of this node within the communications + ## network to which this node is attached, if any. + release*, ## Current release level of this implementation. + version*, ## Current version level of this release. machine*: array [0..255, char] ## Name of the hardware type on which the - ## system is running. + ## system is running. TSem* {.importc: "sem_t", header: "<semaphore.h>", final, pure.} = object - Tipc_perm* {.importc: "struct ipc_perm", + Tipc_perm* {.importc: "struct ipc_perm", header: "<sys/ipc.h>", final, pure.} = object ## struct ipc_perm - uid*: tuid ## Owner's user ID. - gid*: tgid ## Owner's group ID. - cuid*: Tuid ## Creator's user ID. - cgid*: Tgid ## Creator's group ID. - mode*: TMode ## Read/write permission. - - TStat* {.importc: "struct stat", + uid*: Tuid ## Owner's user ID. + gid*: TGid ## Owner's group ID. + cuid*: Tuid ## Creator's user ID. + cgid*: TGid ## Creator's group ID. + mode*: TMode ## Read/write permission. + + TStat* {.importc: "struct stat", header: "<sys/stat.h>", final, pure.} = object ## struct stat - st_dev*: TDev ## Device ID of device containing file. - st_ino*: TIno ## File serial number. - st_mode*: TMode ## Mode of file (see below). - st_nlink*: tnlink ## Number of hard links to the file. - st_uid*: tuid ## User ID of file. - st_gid*: Tgid ## Group ID of file. - st_rdev*: TDev ## Device ID (if file is character or block special). - st_size*: TOff ## For regular files, the file size in bytes. - ## For symbolic links, the length in bytes of the - ## pathname contained in the symbolic link. - ## For a shared memory object, the length in bytes. - ## For a typed memory object, the length in bytes. - ## For other file types, the use of this field is - ## unspecified. - st_atime*: ttime ## Time of last access. - st_mtime*: ttime ## Time of last data modification. - st_ctime*: ttime ## Time of last status change. - st_blksize*: Tblksize ## A file system-specific preferred I/O block size - ## for this object. In some file system types, this - ## may vary from file to file. - st_blocks*: Tblkcnt ## Number of blocks allocated for this object. - - - TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", + st_dev*: TDev ## Device ID of device containing file. + st_ino*: Tino ## File serial number. + st_mode*: TMode ## Mode of file (see below). + st_nlink*: TNlink ## Number of hard links to the file. + st_uid*: Tuid ## User ID of file. + st_gid*: TGid ## Group ID of file. + st_rdev*: TDev ## Device ID (if file is character or block special). + st_size*: TOff ## For regular files, the file size in bytes. + ## For symbolic links, the length in bytes of the + ## pathname contained in the symbolic link. + ## For a shared memory object, the length in bytes. + ## For a typed memory object, the length in bytes. + ## For other file types, the use of this field is + ## unspecified. + st_atime*: TTime ## Time of last access. + st_mtime*: TTime ## Time of last data modification. + st_ctime*: TTime ## Time of last status change. + st_blksize*: Tblksize ## A file system-specific preferred I/O block size + ## for this object. In some file system types, this + ## may vary from file to file. + st_blocks*: Tblkcnt ## Number of blocks allocated for this object. + + + TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", final, pure.} = object ## struct statvfs - f_bsize*: int ## File system block size. - f_frsize*: int ## Fundamental file system block size. + f_bsize*: int ## File system block size. + f_frsize*: int ## Fundamental file system block size. f_blocks*: Tfsblkcnt ## Total number of blocks on file system - ## in units of f_frsize. - f_bfree*: Tfsblkcnt ## Total number of free blocks. - f_bavail*: Tfsblkcnt ## Number of free blocks available to - ## non-privileged process. - f_files*: Tfsfilcnt ## Total number of file serial numbers. - f_ffree*: Tfsfilcnt ## Total number of free file serial numbers. - f_favail*: Tfsfilcnt ## Number of file serial numbers available to - ## non-privileged process. - f_fsid*: int ## File system ID. - f_flag*: int ## Bit mask of f_flag values. - f_namemax*: int ## Maximum filename length. - - Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", + ## in units of f_frsize. + f_bfree*: Tfsblkcnt ## Total number of free blocks. + f_bavail*: Tfsblkcnt ## Number of free blocks available to + ## non-privileged process. + f_files*: Tfsfilcnt ## Total number of file serial numbers. + f_ffree*: Tfsfilcnt ## Total number of free file serial numbers. + f_favail*: Tfsfilcnt ## Number of file serial numbers available to + ## non-privileged process. + f_fsid*: int ## File system ID. + f_flag*: int ## Bit mask of f_flag values. + f_namemax*: int ## Maximum filename length. + + Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", header: "<sys/mman.h>", final, pure.} = object posix_tmi_length*: int - - Ttm* {.importc: "struct tm", header: "<time.h>", + + Ttm* {.importc: "struct tm", header: "<time.h>", final, pure.} = object ## struct tm - tm_sec*: cint ## Seconds [0,60]. - tm_min*: cint ## Minutes [0,59]. - tm_hour*: cint ## Hour [0,23]. - tm_mday*: cint ## Day of month [1,31]. - tm_mon*: cint ## Month of year [0,11]. - tm_year*: cint ## Years since 1900. - tm_wday*: cint ## Day of week [0,6] (Sunday =0). - tm_yday*: cint ## Day of year [0,365]. - tm_isdst*: cint ## Daylight Savings flag. - Ttimespec* {.importc: "struct timespec", + tm_sec*: cint ## Seconds [0,60]. + tm_min*: cint ## Minutes [0,59]. + tm_hour*: cint ## Hour [0,23]. + tm_mday*: cint ## Day of month [1,31]. + tm_mon*: cint ## Month of year [0,11]. + tm_year*: cint ## Years since 1900. + tm_wday*: cint ## Day of week [0,6] (Sunday =0). + tm_yday*: cint ## Day of year [0,365]. + tm_isdst*: cint ## Daylight Savings flag. + Ttimespec* {.importc: "struct timespec", header: "<time.h>", final, pure.} = object ## struct timespec - tv_sec*: Ttime ## Seconds. - tv_nsec*: int ## Nanoseconds. - titimerspec* {.importc: "struct itimerspec", header: "<time.h>", + tv_sec*: TTime ## Seconds. + tv_nsec*: int ## Nanoseconds. + titimerspec* {.importc: "struct itimerspec", header: "<time.h>", final, pure.} = object ## struct itimerspec - it_interval*: ttimespec ## Timer period. - it_value*: ttimespec ## Timer expiration. - + it_interval*: Ttimespec ## Timer period. + it_value*: Ttimespec ## Timer expiration. + Tsig_atomic* {.importc: "sig_atomic_t", header: "<signal.h>".} = cint - ## Possibly volatile-qualified integer type of an object that can be + ## Possibly volatile-qualified integer type of an object that can be ## accessed as an atomic entity, even in the presence of asynchronous ## interrupts. Tsigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object - - TsigEvent* {.importc: "struct sigevent", + + TsigEvent* {.importc: "struct sigevent", header: "<signal.h>", final, pure.} = object ## struct sigevent - sigev_notify*: cint ## Notification type. - sigev_signo*: cint ## Signal number. - sigev_value*: Tsigval ## Signal value. - sigev_notify_function*: proc (x: TSigval) {.noconv.} ## Notification func. - sigev_notify_attributes*: ptr Tpthreadattr ## Notification attributes. + sigev_notify*: cint ## Notification type. + sigev_signo*: cint ## Signal number. + sigev_value*: TsigVal ## Signal value. + sigev_notify_function*: proc (x: TsigVal) {.noconv.} ## Notification func. + sigev_notify_attributes*: ptr Tpthread_attr ## Notification attributes. - TsigVal* {.importc: "union sigval", + TsigVal* {.importc: "union sigval", header: "<signal.h>", final, pure.} = object ## struct sigval - sival_ptr*: pointer ## pointer signal value; + sival_ptr*: pointer ## pointer signal value; ## integer signal value not defined! - TSigaction* {.importc: "struct sigaction", + TSigaction* {.importc: "struct sigaction", header: "<signal.h>", final, pure.} = object ## struct sigaction sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching - ## function or one of the macros - ## SIG_IGN or SIG_DFL. - sa_mask*: TsigSet ## Set of signals to be blocked during execution of - ## the signal handling function. - sa_flags*: cint ## Special flags. - sa_sigaction*: proc (x: cint, y: var TSigInfo, z: pointer) {.noconv.} + ## function or one of the macros + ## SIG_IGN or SIG_DFL. + sa_mask*: Tsigset ## Set of signals to be blocked during execution of + ## the signal handling function. + sa_flags*: cint ## Special flags. + sa_sigaction*: proc (x: cint, y: var TsigInfo, z: pointer) {.noconv.} TStack* {.importc: "stack_t", header: "<signal.h>", final, pure.} = object ## stack_t - ss_sp*: pointer ## Stack base or pointer. - ss_size*: int ## Stack size. - ss_flags*: cint ## Flags. + ss_sp*: pointer ## Stack base or pointer. + ss_size*: int ## Stack size. + ss_flags*: cint ## Flags. - TSigStack* {.importc: "struct sigstack", + TSigStack* {.importc: "struct sigstack", header: "<signal.h>", final, pure.} = object ## struct sigstack - ss_onstack*: cint ## Non-zero when signal stack is in use. - ss_sp*: pointer ## Signal stack pointer. + ss_onstack*: cint ## Non-zero when signal stack is in use. + ss_sp*: pointer ## Signal stack pointer. - TsigInfo* {.importc: "siginfo_t", + TsigInfo* {.importc: "siginfo_t", header: "<signal.h>", final, pure.} = object ## siginfo_t - si_signo*: cint ## Signal number. - si_code*: cint ## Signal code. - si_errno*: cint ## If non-zero, an errno value associated with - ## this signal, as defined in <errno.h>. - si_pid*: tpid ## Sending process ID. - si_uid*: tuid ## Real user ID of sending process. - si_addr*: pointer ## Address of faulting instruction. - si_status*: cint ## Exit value or signal. - si_band*: int ## Band event for SIGPOLL. - si_value*: TSigval ## Signal value. - + si_signo*: cint ## Signal number. + si_code*: cint ## Signal code. + si_errno*: cint ## If non-zero, an errno value associated with + ## this signal, as defined in <errno.h>. + si_pid*: TPid ## Sending process ID. + si_uid*: Tuid ## Real user ID of sending process. + si_addr*: pointer ## Address of faulting instruction. + si_status*: cint ## Exit value or signal. + si_band*: int ## Band event for SIGPOLL. + si_value*: TsigVal ## Signal value. + Tnl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint Tnl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = cint - Tsched_param* {.importc: "struct sched_param", - header: "<sched.h>", + Tsched_param* {.importc: "struct sched_param", + header: "<sched.h>", final, pure.} = object ## struct sched_param sched_priority*: cint - sched_ss_low_priority*: cint ## Low scheduling priority for - ## sporadic server. - sched_ss_repl_period*: ttimespec ## Replenishment period for - ## sporadic server. - sched_ss_init_budget*: ttimespec ## Initial budget for sporadic server. - sched_ss_max_repl*: cint ## Maximum pending replenishments for - ## sporadic server. - - Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", + sched_ss_low_priority*: cint ## Low scheduling priority for + ## sporadic server. + sched_ss_repl_period*: Ttimespec ## Replenishment period for + ## sporadic server. + sched_ss_init_budget*: Ttimespec ## Initial budget for sporadic server. + sched_ss_max_repl*: cint ## Maximum pending replenishments for + ## sporadic server. + + Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", final, pure.} = object ## struct timeval - tv_sec*: int ## Seconds. - tv_usec*: int ## Microseconds. - Tfd_set* {.importc: "fd_set", header: "<sys/select.h>", - final, pure.} = object - Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", + tv_sec*: int ## Seconds. + tv_usec*: int ## Microseconds. + TFdSet* {.importc: "fd_set", header: "<sys/select.h>", + final, pure.} = object + Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", final, pure.} = object - Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", + Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", final, pure.} = object ## ucontext_t - uc_link*: ptr Tucontext ## Pointer to the context that is resumed - ## when this context returns. - uc_sigmask*: Tsigset ## The set of signals that are blocked when this - ## context is active. - uc_stack*: TStack ## The stack used by this context. - uc_mcontext*: Tmcontext ## A machine-specific representation of the saved - ## context. + uc_link*: ptr Tucontext ## Pointer to the context that is resumed + ## when this context returns. + uc_sigmask*: Tsigset ## The set of signals that are blocked when this + ## context is active. + uc_stack*: TStack ## The stack used by this context. + uc_mcontext*: Tmcontext ## A machine-specific representation of the saved + ## context. when hasAioH: type - Taiocb* {.importc: "struct aiocb", header: "<aio.h>", + Taiocb* {.importc: "struct aiocb", header: "<aio.h>", final, pure.} = object ## struct aiocb - aio_fildes*: cint ## File descriptor. - aio_offset*: TOff ## File offset. - aio_buf*: pointer ## Location of buffer. - aio_nbytes*: int ## Length of transfer. - aio_reqprio*: cint ## Request priority offset. - aio_sigevent*: TSigEvent ## Signal number and value. - aio_lio_opcode: cint ## Operation to be performed. - + aio_fildes*: cint ## File descriptor. + aio_offset*: TOff ## File offset. + aio_buf*: pointer ## Location of buffer. + aio_nbytes*: int ## Length of transfer. + aio_reqprio*: cint ## Request priority offset. + aio_sigevent*: TsigEvent ## Signal number and value. + aio_lio_opcode: cint ## Operation to be performed. + when hasSpawnH: type - Tposix_spawnattr* {.importc: "posix_spawnattr_t", + Tposix_spawnattr* {.importc: "posix_spawnattr_t", header: "<spawn.h>", final, pure.} = object - Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", + Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", header: "<spawn.h>", final, pure.} = object type TSocklen* {.importc: "socklen_t", header: "<sys/socket.h>".} = cuint TSa_Family* {.importc: "sa_family_t", header: "<sys/socket.h>".} = cint - - TSockAddr* {.importc: "struct sockaddr", header: "<sys/socket.h>", + + TSockAddr* {.importc: "struct sockaddr", header: "<sys/socket.h>", pure, final.} = object ## struct sockaddr - sa_family*: Tsa_family ## Address family. - sa_data*: array [0..255, char] ## Socket address (variable-length data). - + sa_family*: TSa_Family ## Address family. + sa_data*: array [0..255, char] ## Socket address (variable-length data). + Tsockaddr_storage* {.importc: "struct sockaddr_storage", - header: "<sys/socket.h>", + header: "<sys/socket.h>", pure, final.} = object ## struct sockaddr_storage - ss_family*: Tsa_family ## Address family. + ss_family*: TSa_Family ## Address family. - Tif_nameindex* {.importc: "struct if_nameindex", final, + Tif_nameindex* {.importc: "struct if_nameindex", final, pure, header: "<net/if.h>".} = object ## struct if_nameindex - if_index*: cint ## Numeric index of the interface. - if_name*: cstring ## Null-terminated name of the interface. + if_index*: cint ## Numeric index of the interface. + if_name*: cstring ## Null-terminated name of the interface. TIOVec* {.importc: "struct iovec", pure, final, header: "<sys/uio.h>".} = object ## struct iovec - iov_base*: pointer ## Base address of a memory region for input or output. - iov_len*: int ## The size of the memory pointed to by iov_base. - + iov_base*: pointer ## Base address of a memory region for input or output. + iov_len*: int ## The size of the memory pointed to by iov_base. + Tmsghdr* {.importc: "struct msghdr", pure, final, header: "<sys/socket.h>".} = object ## struct msghdr - msg_name*: pointer ## Optional address. - msg_namelen*: TSockLen ## Size of address. - msg_iov*: ptr TIOVec ## Scatter/gather array. - msg_iovlen*: cint ## Members in msg_iov. - msg_control*: pointer ## Ancillary data; see below. - msg_controllen*: TSockLen ## Ancillary data buffer len. - msg_flags*: cint ## Flags on received message. + msg_name*: pointer ## Optional address. + msg_namelen*: TSocklen ## Size of address. + msg_iov*: ptr TIOVec ## Scatter/gather array. + msg_iovlen*: cint ## Members in msg_iov. + msg_control*: pointer ## Ancillary data; see below. + msg_controllen*: TSocklen ## Ancillary data buffer len. + msg_flags*: cint ## Flags on received message. - Tcmsghdr* {.importc: "struct cmsghdr", pure, final, + Tcmsghdr* {.importc: "struct cmsghdr", pure, final, header: "<sys/socket.h>".} = object ## struct cmsghdr - cmsg_len*: TSockLen ## Data byte count, including the cmsghdr. - cmsg_level*: cint ## Originating protocol. - cmsg_type*: cint ## Protocol-specific type. + cmsg_len*: TSocklen ## Data byte count, including the cmsghdr. + cmsg_level*: cint ## Originating protocol. + cmsg_type*: cint ## Protocol-specific type. - TLinger* {.importc: "struct linger", pure, final, + TLinger* {.importc: "struct linger", pure, final, header: "<sys/socket.h>".} = object ## struct linger - l_onoff*: cint ## Indicates whether linger option is enabled. - l_linger*: cint ## Linger time, in seconds. - + l_onoff*: cint ## Indicates whether linger option is enabled. + l_linger*: cint ## Linger time, in seconds. + TInPort* = int16 ## unsigned! TInAddrScalar* = int32 ## unsigned! TInAddrT* {.importc: "in_addr_t", pure, final, header: "<netinet/in.h>".} = int32 ## unsigned! - TInAddr* {.importc: "struct in_addr", pure, final, + TInAddr* {.importc: "struct in_addr", pure, final, header: "<netinet/in.h>".} = object ## struct in_addr s_addr*: TInAddrScalar - Tsockaddr_in* {.importc: "struct sockaddr_in", pure, final, + Tsockaddr_in* {.importc: "struct sockaddr_in", pure, final, header: "<netinet/in.h>".} = object ## struct sockaddr_in - sin_family*: TSa_family ## AF_INET. - sin_port*: TInPort ## Port number. - sin_addr*: TInAddr ## IP address. + sin_family*: TSa_Family ## AF_INET. + sin_port*: TInPort ## Port number. + sin_addr*: TInAddr ## IP address. TIn6Addr* {.importc: "struct in6_addr", pure, final, header: "<netinet/in.h>".} = object ## struct in6_addr @@ -485,75 +485,75 @@ type Tsockaddr_in6* {.importc: "struct sockaddr_in6", pure, final, header: "<netinet/in.h>".} = object ## struct sockaddr_in6 - sin6_family*: TSa_family ## AF_INET6. - sin6_port*: TInPort ## Port number. - sin6_flowinfo*: int32 ## IPv6 traffic class and flow information. - sin6_addr*: Tin6Addr ## IPv6 address. - sin6_scope_id*: int32 ## Set of interfaces for a scope. - - Tipv6_mreq* {.importc: "struct ipv6_mreq", pure, final, + sin6_family*: TSa_Family ## AF_INET6. + sin6_port*: TInPort ## Port number. + sin6_flowinfo*: int32 ## IPv6 traffic class and flow information. + sin6_addr*: TIn6Addr ## IPv6 address. + sin6_scope_id*: int32 ## Set of interfaces for a scope. + + Tipv6_mreq* {.importc: "struct ipv6_mreq", pure, final, header: "<netinet/in.h>".} = object ## struct ipv6_mreq - ipv6mr_multiaddr*: TIn6Addr ## IPv6 multicast address. - ipv6mr_interface*: cint ## Interface index. + ipv6mr_multiaddr*: TIn6Addr ## IPv6 multicast address. + ipv6mr_interface*: cint ## Interface index. - Thostent* {.importc: "struct hostent", pure, final, + Thostent* {.importc: "struct hostent", pure, final, header: "<netdb.h>".} = object ## struct hostent - h_name*: cstring ## Official name of the host. - h_aliases*: cstringArray ## A pointer to an array of pointers to - ## alternative host names, terminated by a - ## null pointer. - h_addrtype*: cint ## Address type. - h_length*: cint ## The length, in bytes, of the address. - h_addr_list*: cstringArray ## A pointer to an array of pointers to network + h_name*: cstring ## Official name of the host. + h_aliases*: cstringArray ## A pointer to an array of pointers to + ## alternative host names, terminated by a + ## null pointer. + h_addrtype*: cint ## Address type. + h_length*: cint ## The length, in bytes, of the address. + h_addr_list*: cstringArray ## A pointer to an array of pointers to network ## addresses (in network byte order) for the - ## host, terminated by a null pointer. + ## host, terminated by a null pointer. - Tnetent* {.importc: "struct netent", pure, final, + Tnetent* {.importc: "struct netent", pure, final, header: "<netdb.h>".} = object ## struct netent - n_name*: cstring ## Official, fully-qualified (including the - ## domain) name of the host. - n_aliases*: cstringArray ## A pointer to an array of pointers to - ## alternative network names, terminated by a - ## null pointer. - n_addrtype*: cint ## The address type of the network. - n_net*: int32 ## The network number, in host byte order. - - TProtoent* {.importc: "struct protoent", pure, final, + n_name*: cstring ## Official, fully-qualified (including the + ## domain) name of the host. + n_aliases*: cstringArray ## A pointer to an array of pointers to + ## alternative network names, terminated by a + ## null pointer. + n_addrtype*: cint ## The address type of the network. + n_net*: int32 ## The network number, in host byte order. + + TProtoent* {.importc: "struct protoent", pure, final, header: "<netdb.h>".} = object ## struct protoent - p_name*: cstring ## Official name of the protocol. - p_aliases*: cstringArray ## A pointer to an array of pointers to - ## alternative protocol names, terminated by - ## a null pointer. - p_proto*: cint ## The protocol number. + p_name*: cstring ## Official name of the protocol. + p_aliases*: cstringArray ## A pointer to an array of pointers to + ## alternative protocol names, terminated by + ## a null pointer. + p_proto*: cint ## The protocol number. - TServent* {.importc: "struct servent", pure, final, + TServent* {.importc: "struct servent", pure, final, header: "<netdb.h>".} = object ## struct servent - s_name*: cstring ## Official name of the service. - s_aliases*: cstringArray ## A pointer to an array of pointers to - ## alternative service names, terminated by - ## a null pointer. - s_port*: cint ## The port number at which the service - ## resides, in network byte order. - s_proto*: cstring ## The name of the protocol to use when - ## contacting the service. - - Taddrinfo* {.importc: "struct addrinfo", pure, final, + s_name*: cstring ## Official name of the service. + s_aliases*: cstringArray ## A pointer to an array of pointers to + ## alternative service names, terminated by + ## a null pointer. + s_port*: cint ## The port number at which the service + ## resides, in network byte order. + s_proto*: cstring ## The name of the protocol to use when + ## contacting the service. + + Taddrinfo* {.importc: "struct addrinfo", pure, final, header: "<netdb.h>".} = object ## struct addrinfo - ai_flags*: cint ## Input flags. - ai_family*: cint ## Address family of socket. - ai_socktype*: cint ## Socket type. - ai_protocol*: cint ## Protocol of socket. - ai_addrlen*: TSockLen ## Length of socket address. - ai_addr*: ptr TSockAddr ## Socket address of socket. - ai_canonname*: cstring ## Canonical name of service location. - ai_next*: ptr TAddrInfo ## Pointer to next in list. - - TPollfd* {.importc: "struct pollfd", pure, final, + ai_flags*: cint ## Input flags. + ai_family*: cint ## Address family of socket. + ai_socktype*: cint ## Socket type. + ai_protocol*: cint ## Protocol of socket. + ai_addrlen*: TSocklen ## Length of socket address. + ai_addr*: ptr TSockAddr ## Socket address of socket. + ai_canonname*: cstring ## Canonical name of service location. + ai_next*: ptr Taddrinfo ## Pointer to next in list. + + TPollfd* {.importc: "struct pollfd", pure, final, header: "<poll.h>".} = object ## struct pollfd - fd*: cint ## The following descriptor being polled. - events*: cshort ## The input event flags (see below). - revents*: cshort ## The output event flags (see below). - + fd*: cint ## The following descriptor being polled. + events*: cshort ## The input event flags (see below). + revents*: cshort ## The output event flags (see below). + Tnfds* {.importc: "nfds_t", header: "<poll.h>".} = cint var @@ -561,31 +561,31 @@ var h_errno* {.importc, header: "<netdb.h>".}: cint daylight* {.importc, header: "<time.h>".}: cint timezone* {.importc, header: "<time.h>".}: int - + # Constants as variables: when hasAioH: var AIO_ALLDONE* {.importc, header: "<aio.h>".}: cint - ## A return value indicating that none of the requested operations + ## A return value indicating that none of the requested operations ## could be canceled since they are already complete. AIO_CANCELED* {.importc, header: "<aio.h>".}: cint ## A return value indicating that all requested operations have ## been canceled. AIO_NOTCANCELED* {.importc, header: "<aio.h>".}: cint - ## A return value indicating that some of the requested operations could + ## A return value indicating that some of the requested operations could ## not be canceled since they are in progress. LIO_NOP* {.importc, header: "<aio.h>".}: cint ## A lio_listio() element operation option indicating that no transfer is ## requested. LIO_NOWAIT* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() synchronization operation indicating that the calling - ## thread is to continue execution while the lio_listio() operation is + ## A lio_listio() synchronization operation indicating that the calling + ## thread is to continue execution while the lio_listio() operation is ## being performed, and no notification is given when the operation is ## complete. LIO_READ* {.importc, header: "<aio.h>".}: cint ## A lio_listio() element operation option requesting a read. LIO_WAIT* {.importc, header: "<aio.h>".}: cint - ## A lio_listio() synchronization operation indicating that the calling + ## A lio_listio() synchronization operation indicating that the calling ## thread is to suspend until the lio_listio() operation is complete. LIO_WRITE* {.importc, header: "<aio.h>".}: cint ## A lio_listio() element operation option requesting a write. @@ -598,9 +598,9 @@ var RTLD_GLOBAL* {.importc, header: "<dlfcn.h>".}: cint ## All symbols are available for relocation processing of other modules. RTLD_LOCAL* {.importc, header: "<dlfcn.h>".}: cint - ## All symbols are not made available for relocation processing by - ## other modules. - + ## All symbols are not made available for relocation processing by + ## other modules. + E2BIG* {.importc, header: "<errno.h>".}: cint ## Argument list too long. EACCES* {.importc, header: "<errno.h>".}: cint @@ -758,7 +758,7 @@ var EWOULDBLOCK* {.importc, header: "<errno.h>".}: cint ## Operation would block (may be the same value as [EAGAIN]). EXDEV* {.importc, header: "<errno.h>".}: cint - ## Cross-device link. + ## Cross-device link. F_DUPFD* {.importc, header: "<fcntl.h>".}: cint ## Duplicate file descriptor. @@ -779,15 +779,15 @@ var F_GETOWN* {.importc, header: "<fcntl.h>".}: cint ## Get process or process group ID to receive SIGURG signals. F_SETOWN* {.importc, header: "<fcntl.h>".}: cint - ## Set process or process group ID to receive SIGURG signals. + ## Set process or process group ID to receive SIGURG signals. FD_CLOEXEC* {.importc, header: "<fcntl.h>".}: cint - ## Close the file descriptor upon execution of an exec family function. + ## Close the file descriptor upon execution of an exec family function. F_RDLCK* {.importc, header: "<fcntl.h>".}: cint ## Shared or read lock. F_UNLCK* {.importc, header: "<fcntl.h>".}: cint ## Unlock. F_WRLCK* {.importc, header: "<fcntl.h>".}: cint - ## Exclusive or write lock. + ## Exclusive or write lock. O_CREAT* {.importc, header: "<fcntl.h>".}: cint ## Create file if it does not exist. O_EXCL* {.importc, header: "<fcntl.h>".}: cint @@ -795,7 +795,7 @@ var O_NOCTTY* {.importc, header: "<fcntl.h>".}: cint ## Do not assign controlling terminal. O_TRUNC* {.importc, header: "<fcntl.h>".}: cint - ## Truncate flag. + ## Truncate flag. O_APPEND* {.importc, header: "<fcntl.h>".}: cint ## Set append mode. O_DSYNC* {.importc, header: "<fcntl.h>".}: cint @@ -805,21 +805,21 @@ var O_RSYNC* {.importc, header: "<fcntl.h>".}: cint ## Synchronized read I/O operations. O_SYNC* {.importc, header: "<fcntl.h>".}: cint - ## Write according to synchronized I/O file integrity completion. + ## Write according to synchronized I/O file integrity completion. O_ACCMODE* {.importc, header: "<fcntl.h>".}: cint - ## Mask for file access modes. + ## Mask for file access modes. O_RDONLY* {.importc, header: "<fcntl.h>".}: cint ## Open for reading only. O_RDWR* {.importc, header: "<fcntl.h>".}: cint ## Open for reading and writing. O_WRONLY* {.importc, header: "<fcntl.h>".}: cint - ## Open for writing only. + ## Open for writing only. POSIX_FADV_NORMAL* {.importc, header: "<fcntl.h>".}: cint ## The application has no advice to give on its behavior with ## respect to the specified data. It is the default characteristic ## if no advice is given for an open file. POSIX_FADV_SEQUENTIAL* {.importc, header: "<fcntl.h>".}: cint - ## The application expects to access the specified data + ## The application expects to access the specified data # sequentially from lower offsets to higher offsets. POSIX_FADV_RANDOM* {.importc, header: "<fcntl.h>".}: cint ## The application expects to access the specified data in a random order. @@ -829,8 +829,8 @@ var ## The application expects that it will not access the specified data ## in the near future. POSIX_FADV_NOREUSE* {.importc, header: "<fcntl.h>".}: cint - ## The application expects to access the specified data once and - ## then not reuse it thereafter. + ## The application expects to access the specified data once and + ## then not reuse it thereafter. FE_DIVBYZERO* {.importc, header: "<fenv.h>".}: cint FE_INEXACT* {.importc, header: "<fenv.h>".}: cint @@ -875,20 +875,20 @@ when not defined(haiku): MM_PRINT* {.importc, header: "<fmtmsg.h>".}: cint ## Display message on standard error. MM_CONSOLE* {.importc, header: "<fmtmsg.h>".}: cint - ## Display message on system console. + ## Display message on system console. MM_OK* {.importc, header: "<fmtmsg.h>".}: cint ## The function succeeded. MM_NOTOK* {.importc, header: "<fmtmsg.h>".}: cint ## The function failed completely. MM_NOMSG* {.importc, header: "<fmtmsg.h>".}: cint - ## The function was unable to generate a message on standard error, + ## The function was unable to generate a message on standard error, ## but otherwise succeeded. MM_NOCON* {.importc, header: "<fmtmsg.h>".}: cint - ## The function was unable to generate a console message, but - ## otherwise succeeded. + ## The function was unable to generate a console message, but + ## otherwise succeeded. -var +var FNM_NOMATCH* {.importc, header: "<fnmatch.h>".}: cint ## The string does not match the specified pattern. FNM_PATHNAME* {.importc, header: "<fnmatch.h>".}: cint @@ -916,14 +916,14 @@ var ## Symbolic link that names a nonexistent file. FTW_PHYS* {.importc, header: "<ftw.h>".}: cint - ## Physical walk, does not follow symbolic links. Otherwise, nftw() + ## Physical walk, does not follow symbolic links. Otherwise, nftw() ## follows links but does not walk down any path that crosses itself. FTW_MOUNT* {.importc, header: "<ftw.h>".}: cint ## The walk does not cross a mount point. FTW_DEPTH* {.importc, header: "<ftw.h>".}: cint ## All subdirectories are visited before the directory itself. FTW_CHDIR* {.importc, header: "<ftw.h>".}: cint - ## The walk changes to each directory before reading it. + ## The walk changes to each directory before reading it. GLOB_APPEND* {.importc, header: "<glob.h>".}: cint ## Append generated pathnames to those previously obtained. @@ -932,7 +932,7 @@ var GLOB_ERR* {.importc, header: "<glob.h>".}: cint ## Cause glob() to return on error. GLOB_MARK* {.importc, header: "<glob.h>".}: cint - ## Each pathname that is a directory that matches pattern has a + ## Each pathname that is a directory that matches pattern has a ## slash appended. GLOB_NOCHECK* {.importc, header: "<glob.h>".}: cint ## If pattern does not match any pathname, then return a list @@ -942,10 +942,10 @@ var GLOB_NOSORT* {.importc, header: "<glob.h>".}: cint ## Do not sort the pathnames returned. GLOB_ABORTED* {.importc, header: "<glob.h>".}: cint - ## The scan was stopped because GLOB_ERR was set or errfunc() + ## The scan was stopped because GLOB_ERR was set or errfunc() ## returned non-zero. GLOB_NOMATCH* {.importc, header: "<glob.h>".}: cint - ## The pattern does not match any existing pathname, and GLOB_NOCHECK + ## The pattern does not match any existing pathname, and GLOB_NOCHECK ## was not set in flags. GLOB_NOSPACE* {.importc, header: "<glob.h>".}: cint ## An attempt to allocate memory failed. @@ -1033,10 +1033,10 @@ var NOEXPR* {.importc, header: "<langinfo.h>".}: cint ## Negative response expression. CRNCYSTR* {.importc, header: "<langinfo.h>".}: cint - ## Local currency symbol, preceded by '-' if the symbol - ## should appear before the value, '+' if the symbol should appear + ## Local currency symbol, preceded by '-' if the symbol + ## should appear before the value, '+' if the symbol should appear ## after the value, or '.' if the symbol should replace the radix - ## character. If the local currency symbol is the empty string, + ## character. If the local currency symbol is the empty string, ## implementations may return the empty string ( "" ). LC_ALL* {.importc, header: "<locale.h>".}: cint @@ -1046,7 +1046,7 @@ var LC_MONETARY* {.importc, header: "<locale.h>".}: cint LC_NUMERIC* {.importc, header: "<locale.h>".}: cint LC_TIME* {.importc, header: "<locale.h>".}: cint - + PTHREAD_BARRIER_SERIAL_THREAD* {.importc, header: "<pthread.h>".}: cint PTHREAD_CANCEL_ASYNCHRONOUS* {.importc, header: "<pthread.h>".}: cint PTHREAD_CANCEL_ENABLE* {.importc, header: "<pthread.h>".}: cint @@ -1115,7 +1115,7 @@ var PC_ALLOC_SIZE_MIN* {.importc: "_PC_ALLOC_SIZE_MIN", header: "<unistd.h>".}: cint PC_ASYNC_IO* {.importc: "_PC_ASYNC_IO", header: "<unistd.h>".}: cint - PC_CHOWN_RESTRICTED* {.importc: "_PC_CHOWN_RESTRICTED", + PC_CHOWN_RESTRICTED* {.importc: "_PC_CHOWN_RESTRICTED", header: "<unistd.h>".}: cint PC_FILESIZEBITS* {.importc: "_PC_FILESIZEBITS", header: "<unistd.h>".}: cint PC_LINK_MAX* {.importc: "_PC_LINK_MAX", header: "<unistd.h>".}: cint @@ -1127,9 +1127,9 @@ var PC_PATH_MAX*{.importc: "_PC_PATH_MAX", header: "<unistd.h>".}: cint PC_PIPE_BUF*{.importc: "_PC_PIPE_BUF", header: "<unistd.h>".}: cint PC_PRIO_IO*{.importc: "_PC_PRIO_IO", header: "<unistd.h>".}: cint - PC_REC_INCR_XFER_SIZE*{.importc: "_PC_REC_INCR_XFER_SIZE", + PC_REC_INCR_XFER_SIZE*{.importc: "_PC_REC_INCR_XFER_SIZE", header: "<unistd.h>".}: cint - PC_REC_MIN_XFER_SIZE*{.importc: "_PC_REC_MIN_XFER_SIZE", + PC_REC_MIN_XFER_SIZE*{.importc: "_PC_REC_MIN_XFER_SIZE", header: "<unistd.h>".}: cint PC_REC_XFER_ALIGN*{.importc: "_PC_REC_XFER_ALIGN", header: "<unistd.h>".}: cint PC_SYMLINK_MAX*{.importc: "_PC_SYMLINK_MAX", header: "<unistd.h>".}: cint @@ -1142,9 +1142,9 @@ var SC_2_FORT_RUN*{.importc: "_SC_2_FORT_RUN", header: "<unistd.h>".}: cint SC_2_LOCALEDEF*{.importc: "_SC_2_LOCALEDEF", header: "<unistd.h>".}: cint SC_2_PBS*{.importc: "_SC_2_PBS", header: "<unistd.h>".}: cint - SC_2_PBS_ACCOUNTING*{.importc: "_SC_2_PBS_ACCOUNTING", + SC_2_PBS_ACCOUNTING*{.importc: "_SC_2_PBS_ACCOUNTING", header: "<unistd.h>".}: cint - SC_2_PBS_CHECKPOINT*{.importc: "_SC_2_PBS_CHECKPOINT", + SC_2_PBS_CHECKPOINT*{.importc: "_SC_2_PBS_CHECKPOINT", header: "<unistd.h>".}: cint SC_2_PBS_LOCATE*{.importc: "_SC_2_PBS_LOCATE", header: "<unistd.h>".}: cint SC_2_PBS_MESSAGE*{.importc: "_SC_2_PBS_MESSAGE", header: "<unistd.h>".}: cint @@ -1155,10 +1155,10 @@ var SC_ADVISORY_INFO*{.importc: "_SC_ADVISORY_INFO", header: "<unistd.h>".}: cint SC_AIO_LISTIO_MAX*{.importc: "_SC_AIO_LISTIO_MAX", header: "<unistd.h>".}: cint SC_AIO_MAX*{.importc: "_SC_AIO_MAX", header: "<unistd.h>".}: cint - SC_AIO_PRIO_DELTA_MAX*{.importc: "_SC_AIO_PRIO_DELTA_MAX", + SC_AIO_PRIO_DELTA_MAX*{.importc: "_SC_AIO_PRIO_DELTA_MAX", header: "<unistd.h>".}: cint SC_ARG_MAX*{.importc: "_SC_ARG_MAX", header: "<unistd.h>".}: cint - SC_ASYNCHRONOUS_IO*{.importc: "_SC_ASYNCHRONOUS_IO", + SC_ASYNCHRONOUS_IO*{.importc: "_SC_ASYNCHRONOUS_IO", header: "<unistd.h>".}: cint SC_ATEXIT_MAX*{.importc: "_SC_ATEXIT_MAX", header: "<unistd.h>".}: cint SC_BARRIERS*{.importc: "_SC_BARRIERS", header: "<unistd.h>".}: cint @@ -1168,17 +1168,17 @@ var SC_BC_STRING_MAX*{.importc: "_SC_BC_STRING_MAX", header: "<unistd.h>".}: cint SC_CHILD_MAX*{.importc: "_SC_CHILD_MAX", header: "<unistd.h>".}: cint SC_CLK_TCK*{.importc: "_SC_CLK_TCK", header: "<unistd.h>".}: cint - SC_CLOCK_SELECTION*{.importc: "_SC_CLOCK_SELECTION", + SC_CLOCK_SELECTION*{.importc: "_SC_CLOCK_SELECTION", header: "<unistd.h>".}: cint - SC_COLL_WEIGHTS_MAX*{.importc: "_SC_COLL_WEIGHTS_MAX", + SC_COLL_WEIGHTS_MAX*{.importc: "_SC_COLL_WEIGHTS_MAX", header: "<unistd.h>".}: cint SC_CPUTIME*{.importc: "_SC_CPUTIME", header: "<unistd.h>".}: cint SC_DELAYTIMER_MAX*{.importc: "_SC_DELAYTIMER_MAX", header: "<unistd.h>".}: cint SC_EXPR_NEST_MAX*{.importc: "_SC_EXPR_NEST_MAX", header: "<unistd.h>".}: cint SC_FSYNC*{.importc: "_SC_FSYNC", header: "<unistd.h>".}: cint - SC_GETGR_R_SIZE_MAX*{.importc: "_SC_GETGR_R_SIZE_MAX", + SC_GETGR_R_SIZE_MAX*{.importc: "_SC_GETGR_R_SIZE_MAX", header: "<unistd.h>".}: cint - SC_GETPW_R_SIZE_MAX*{.importc: "_SC_GETPW_R_SIZE_MAX", + SC_GETPW_R_SIZE_MAX*{.importc: "_SC_GETPW_R_SIZE_MAX", header: "<unistd.h>".}: cint SC_HOST_NAME_MAX*{.importc: "_SC_HOST_NAME_MAX", header: "<unistd.h>".}: cint SC_IOV_MAX*{.importc: "_SC_IOV_MAX", header: "<unistd.h>".}: cint @@ -1189,11 +1189,11 @@ var SC_MAPPED_FILES*{.importc: "_SC_MAPPED_FILES", header: "<unistd.h>".}: cint SC_MEMLOCK*{.importc: "_SC_MEMLOCK", header: "<unistd.h>".}: cint SC_MEMLOCK_RANGE*{.importc: "_SC_MEMLOCK_RANGE", header: "<unistd.h>".}: cint - SC_MEMORY_PROTECTION*{.importc: "_SC_MEMORY_PROTECTION", + SC_MEMORY_PROTECTION*{.importc: "_SC_MEMORY_PROTECTION", header: "<unistd.h>".}: cint - SC_MESSAGE_PASSING*{.importc: "_SC_MESSAGE_PASSING", + SC_MESSAGE_PASSING*{.importc: "_SC_MESSAGE_PASSING", header: "<unistd.h>".}: cint - SC_MONOTONIC_CLOCK*{.importc: "_SC_MONOTONIC_CLOCK", + SC_MONOTONIC_CLOCK*{.importc: "_SC_MONOTONIC_CLOCK", header: "<unistd.h>".}: cint SC_MQ_OPEN_MAX*{.importc: "_SC_MQ_OPEN_MAX", header: "<unistd.h>".}: cint SC_MQ_PRIO_MAX*{.importc: "_SC_MQ_PRIO_MAX", header: "<unistd.h>".}: cint @@ -1201,13 +1201,13 @@ var SC_OPEN_MAX*{.importc: "_SC_OPEN_MAX", header: "<unistd.h>".}: cint SC_PAGE_SIZE*{.importc: "_SC_PAGE_SIZE", header: "<unistd.h>".}: cint SC_PRIORITIZED_IO*{.importc: "_SC_PRIORITIZED_IO", header: "<unistd.h>".}: cint - SC_PRIORITY_SCHEDULING*{.importc: "_SC_PRIORITY_SCHEDULING", + SC_PRIORITY_SCHEDULING*{.importc: "_SC_PRIORITY_SCHEDULING", header: "<unistd.h>".}: cint SC_RAW_SOCKETS*{.importc: "_SC_RAW_SOCKETS", header: "<unistd.h>".}: cint SC_RE_DUP_MAX*{.importc: "_SC_RE_DUP_MAX", header: "<unistd.h>".}: cint - SC_READER_WRITER_LOCKS*{.importc: "_SC_READER_WRITER_LOCKS", + SC_READER_WRITER_LOCKS*{.importc: "_SC_READER_WRITER_LOCKS", header: "<unistd.h>".}: cint - SC_REALTIME_SIGNALS*{.importc: "_SC_REALTIME_SIGNALS", + SC_REALTIME_SIGNALS*{.importc: "_SC_REALTIME_SIGNALS", header: "<unistd.h>".}: cint SC_REGEXP*{.importc: "_SC_REGEXP", header: "<unistd.h>".}: cint SC_RTSIG_MAX*{.importc: "_SC_RTSIG_MAX", header: "<unistd.h>".}: cint @@ -1215,43 +1215,43 @@ var SC_SEM_NSEMS_MAX*{.importc: "_SC_SEM_NSEMS_MAX", header: "<unistd.h>".}: cint SC_SEM_VALUE_MAX*{.importc: "_SC_SEM_VALUE_MAX", header: "<unistd.h>".}: cint SC_SEMAPHORES*{.importc: "_SC_SEMAPHORES", header: "<unistd.h>".}: cint - SC_SHARED_MEMORY_OBJECTS*{.importc: "_SC_SHARED_MEMORY_OBJECTS", + SC_SHARED_MEMORY_OBJECTS*{.importc: "_SC_SHARED_MEMORY_OBJECTS", header: "<unistd.h>".}: cint SC_SHELL*{.importc: "_SC_SHELL", header: "<unistd.h>".}: cint SC_SIGQUEUE_MAX*{.importc: "_SC_SIGQUEUE_MAX", header: "<unistd.h>".}: cint SC_SPAWN*{.importc: "_SC_SPAWN", header: "<unistd.h>".}: cint SC_SPIN_LOCKS*{.importc: "_SC_SPIN_LOCKS", header: "<unistd.h>".}: cint - SC_SPORADIC_SERVER*{.importc: "_SC_SPORADIC_SERVER", + SC_SPORADIC_SERVER*{.importc: "_SC_SPORADIC_SERVER", header: "<unistd.h>".}: cint SC_SS_REPL_MAX*{.importc: "_SC_SS_REPL_MAX", header: "<unistd.h>".}: cint SC_STREAM_MAX*{.importc: "_SC_STREAM_MAX", header: "<unistd.h>".}: cint SC_SYMLOOP_MAX*{.importc: "_SC_SYMLOOP_MAX", header: "<unistd.h>".}: cint - SC_SYNCHRONIZED_IO*{.importc: "_SC_SYNCHRONIZED_IO", + SC_SYNCHRONIZED_IO*{.importc: "_SC_SYNCHRONIZED_IO", header: "<unistd.h>".}: cint - SC_THREAD_ATTR_STACKADDR*{.importc: "_SC_THREAD_ATTR_STACKADDR", + SC_THREAD_ATTR_STACKADDR*{.importc: "_SC_THREAD_ATTR_STACKADDR", header: "<unistd.h>".}: cint - SC_THREAD_ATTR_STACKSIZE*{.importc: "_SC_THREAD_ATTR_STACKSIZE", + SC_THREAD_ATTR_STACKSIZE*{.importc: "_SC_THREAD_ATTR_STACKSIZE", header: "<unistd.h>".}: cint SC_THREAD_CPUTIME*{.importc: "_SC_THREAD_CPUTIME", header: "<unistd.h>".}: cint SC_THREAD_DESTRUCTOR_ITERATIONS*{.importc: "_SC_THREAD_DESTRUCTOR_ITERATIONS", header: "<unistd.h>".}: cint - SC_THREAD_KEYS_MAX*{.importc: "_SC_THREAD_KEYS_MAX", + SC_THREAD_KEYS_MAX*{.importc: "_SC_THREAD_KEYS_MAX", header: "<unistd.h>".}: cint - SC_THREAD_PRIO_INHERIT*{.importc: "_SC_THREAD_PRIO_INHERIT", + SC_THREAD_PRIO_INHERIT*{.importc: "_SC_THREAD_PRIO_INHERIT", header: "<unistd.h>".}: cint - SC_THREAD_PRIO_PROTECT*{.importc: "_SC_THREAD_PRIO_PROTECT", + SC_THREAD_PRIO_PROTECT*{.importc: "_SC_THREAD_PRIO_PROTECT", header: "<unistd.h>".}: cint SC_THREAD_PRIORITY_SCHEDULING*{.importc: "_SC_THREAD_PRIORITY_SCHEDULING", header: "<unistd.h>".}: cint - SC_THREAD_PROCESS_SHARED*{.importc: "_SC_THREAD_PROCESS_SHARED", + SC_THREAD_PROCESS_SHARED*{.importc: "_SC_THREAD_PROCESS_SHARED", header: "<unistd.h>".}: cint - SC_THREAD_SAFE_FUNCTIONS*{.importc: "_SC_THREAD_SAFE_FUNCTIONS", + SC_THREAD_SAFE_FUNCTIONS*{.importc: "_SC_THREAD_SAFE_FUNCTIONS", header: "<unistd.h>".}: cint - SC_THREAD_SPORADIC_SERVER*{.importc: "_SC_THREAD_SPORADIC_SERVER", + SC_THREAD_SPORADIC_SERVER*{.importc: "_SC_THREAD_SPORADIC_SERVER", header: "<unistd.h>".}: cint - SC_THREAD_STACK_MIN*{.importc: "_SC_THREAD_STACK_MIN", + SC_THREAD_STACK_MIN*{.importc: "_SC_THREAD_STACK_MIN", header: "<unistd.h>".}: cint - SC_THREAD_THREADS_MAX*{.importc: "_SC_THREAD_THREADS_MAX", + SC_THREAD_THREADS_MAX*{.importc: "_SC_THREAD_THREADS_MAX", header: "<unistd.h>".}: cint SC_THREADS*{.importc: "_SC_THREADS", header: "<unistd.h>".}: cint SC_TIMEOUTS*{.importc: "_SC_TIMEOUTS", header: "<unistd.h>".}: cint @@ -1276,21 +1276,21 @@ var SC_XBS5_ILP32_OFF32*{.importc: "_SC_XBS5_ILP32_OFF32", header: "<unistd.h>".}: cint SC_XBS5_ILP32_OFFBIG*{.importc: "_SC_XBS5_ILP32_OFFBIG", header: "<unistd.h>".}: cint SC_XBS5_LP64_OFF64*{.importc: "_SC_XBS5_LP64_OFF64", header: "<unistd.h>".}: cint - SC_XBS5_LPBIG_OFFBIG*{.importc: "_SC_XBS5_LPBIG_OFFBIG", + SC_XBS5_LPBIG_OFFBIG*{.importc: "_SC_XBS5_LPBIG_OFFBIG", header: "<unistd.h>".}: cint SC_XOPEN_CRYPT*{.importc: "_SC_XOPEN_CRYPT", header: "<unistd.h>".}: cint SC_XOPEN_ENH_I18N*{.importc: "_SC_XOPEN_ENH_I18N", header: "<unistd.h>".}: cint SC_XOPEN_LEGACY*{.importc: "_SC_XOPEN_LEGACY", header: "<unistd.h>".}: cint SC_XOPEN_REALTIME*{.importc: "_SC_XOPEN_REALTIME", header: "<unistd.h>".}: cint - SC_XOPEN_REALTIME_THREADS*{.importc: "_SC_XOPEN_REALTIME_THREADS", + SC_XOPEN_REALTIME_THREADS*{.importc: "_SC_XOPEN_REALTIME_THREADS", header: "<unistd.h>".}: cint SC_XOPEN_SHM*{.importc: "_SC_XOPEN_SHM", header: "<unistd.h>".}: cint SC_XOPEN_STREAMS*{.importc: "_SC_XOPEN_STREAMS", header: "<unistd.h>".}: cint SC_XOPEN_UNIX*{.importc: "_SC_XOPEN_UNIX", header: "<unistd.h>".}: cint SC_XOPEN_VERSION*{.importc: "_SC_XOPEN_VERSION", header: "<unistd.h>".}: cint - SC_NPROCESSORS_ONLN*{.importc: "_SC_NPROCESSORS_ONLN", + SC_NPROCESSORS_ONLN*{.importc: "_SC_NPROCESSORS_ONLN", header: "<unistd.h>".}: cint - + SEM_FAILED* {.importc, header: "<semaphore.h>".}: pointer IPC_CREAT* {.importc, header: "<sys/ipc.h>".}: cint ## Create entry if key does not exist. @@ -1307,7 +1307,7 @@ var IPC_SET* {.importc, header: "<sys/ipc.h>".}: cint ## Set options. IPC_STAT* {.importc, header: "<sys/ipc.h>".}: cint - ## Get options. + ## Get options. S_IFMT* {.importc, header: "<sys/stat.h>".}: cint ## Type of file. @@ -1355,12 +1355,12 @@ var ## Set-group-ID on execution. S_ISVTX* {.importc, header: "<sys/stat.h>".}: cint ## On directories, restricted deletion flag. - + ST_RDONLY* {.importc, header: "<sys/statvfs.h>".}: cint ## Read-only file system. ST_NOSUID* {.importc, header: "<sys/statvfs.h>".}: cint ## Does not support the semantics of the ST_ISUID and ST_ISGID file mode bits. - + PROT_READ* {.importc, header: "<sys/mman.h>".}: cint ## Page can be read. PROT_WRITE* {.importc, header: "<sys/mman.h>".}: cint @@ -1387,8 +1387,8 @@ var ## Lock pages that become mapped. MAP_FAILED* {.importc, header: "<sys/mman.h>".}: cint POSIX_MADV_NORMAL* {.importc, header: "<sys/mman.h>".}: cint - ## The application has no advice to give on its behavior with - ## respect to the specified range. It is the default characteristic + ## The application has no advice to give on its behavior with + ## respect to the specified range. It is the default characteristic ## if no advice is given for a range of memory. POSIX_MADV_SEQUENTIAL* {.importc, header: "<sys/mman.h>".}: cint ## The application expects to access the specified range sequentially @@ -1407,13 +1407,13 @@ var ## A number used to convert the value returned by the clock() function ## into seconds. CLOCK_PROCESS_CPUTIME_ID* {.importc, header: "<time.h>".}: cint - ## The identifier of the CPU-time clock associated with the process + ## The identifier of the CPU-time clock associated with the process ## making a clock() or timer*() function call. CLOCK_THREAD_CPUTIME_ID* {.importc, header: "<time.h>".}: cint CLOCK_REALTIME* {.importc, header: "<time.h>".}: cint ## The identifier of the system-wide realtime clock. TIMER_ABSTIME* {.importc, header: "<time.h>".}: cint - ## Flag indicating time is absolute. For functions taking timer + ## Flag indicating time is absolute. For functions taking timer ## objects, this refers to the clock associated with the timer. CLOCK_MONOTONIC* {.importc, header: "<time.h>".}: cint @@ -1438,25 +1438,25 @@ var WEXITED* {.importc, header: "<sys/wait.h>".}: cint ## Wait for processes that have exited. WSTOPPED* {.importc, header: "<sys/wait.h>".}: cint - ## Status is returned for any child that has stopped upon receipt + ## Status is returned for any child that has stopped upon receipt ## of a signal. WCONTINUED* {.importc, header: "<sys/wait.h>".}: cint ## Status is returned for any child that was stopped and has been continued. WNOWAIT* {.importc, header: "<sys/wait.h>".}: cint - ## Keep the process whose status is returned in infop in a waitable state. - P_ALL* {.importc, header: "<sys/wait.h>".}: cint - P_PID* {.importc, header: "<sys/wait.h>".}: cint + ## Keep the process whose status is returned in infop in a waitable state. + P_ALL* {.importc, header: "<sys/wait.h>".}: cint + P_PID* {.importc, header: "<sys/wait.h>".}: cint P_PGID* {.importc, header: "<sys/wait.h>".}: cint - + SIG_DFL* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.} ## Request for default signal handling. SIG_ERR* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.} ## Return value from signal() in case of error. - cSIG_HOLD* {.importc: "SIG_HOLD", + cSIG_HOLD* {.importc: "SIG_HOLD", header: "<signal.h>".}: proc (x: cint) {.noconv.} ## Request that signal be held. SIG_IGN* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.} - ## Request that signal be ignored. + ## Request that signal be ignored. SIGEV_NONE* {.importc, header: "<signal.h>".}: cint SIGEV_SIGNAL* {.importc, header: "<signal.h>".}: cint @@ -1518,8 +1518,8 @@ var SEEK_END* {.importc, header: "<unistd.h>".}: cint SCM_RIGHTS* {.importc, header: "<sys/socket.h>".}: cint - ## Indicates that the data array contains the access rights - ## to be sent or received. + ## Indicates that the data array contains the access rights + ## to be sent or received. SOCK_DGRAM* {.importc, header: "<sys/socket.h>".}: cint ## Datagram socket. SOCK_RAW* {.importc, header: "<sys/socket.h>".}: cint @@ -1527,11 +1527,11 @@ var SOCK_SEQPACKET* {.importc, header: "<sys/socket.h>".}: cint ## Sequenced-packet socket. SOCK_STREAM* {.importc, header: "<sys/socket.h>".}: cint - ## Byte-stream socket. - + ## Byte-stream socket. + SOL_SOCKET* {.importc, header: "<sys/socket.h>".}: cint - ## Options to be accessed at socket level, not protocol level. - + ## Options to be accessed at socket level, not protocol level. + SO_ACCEPTCONN* {.importc, header: "<sys/socket.h>".}: cint ## Socket is accepting connections. SO_BROADCAST* {.importc, header: "<sys/socket.h>".}: cint @@ -1563,11 +1563,11 @@ var SO_SNDTIMEO* {.importc, header: "<sys/socket.h>".}: cint ## Send timeout. SO_TYPE* {.importc, header: "<sys/socket.h>".}: cint - ## Socket type. - + ## Socket type. + SOMAXCONN* {.importc, header: "<sys/socket.h>".}: cint - ## The maximum backlog queue length. - + ## The maximum backlog queue length. + MSG_CTRUNC* {.importc, header: "<sys/socket.h>".}: cint ## Control data truncated. MSG_DONTROUTE* {.importc, header: "<sys/socket.h>".}: cint @@ -1583,7 +1583,7 @@ var MSG_TRUNC* {.importc, header: "<sys/socket.h>".}: cint ## Normal data truncated. MSG_WAITALL* {.importc, header: "<sys/socket.h>".}: cint - ## Attempt to fill the read buffer. + ## Attempt to fill the read buffer. AF_INET* {.importc, header: "<sys/socket.h>".}: cint ## Internet domain sockets for use with IPv4 addresses. @@ -1592,17 +1592,17 @@ var AF_UNIX* {.importc, header: "<sys/socket.h>".}: cint ## UNIX domain sockets. AF_UNSPEC* {.importc, header: "<sys/socket.h>".}: cint - ## Unspecified. + ## Unspecified. SHUT_RD* {.importc, header: "<sys/socket.h>".}: cint ## Disables further receive operations. SHUT_RDWR* {.importc, header: "<sys/socket.h>".}: cint ## Disables further send and receive operations. SHUT_WR* {.importc, header: "<sys/socket.h>".}: cint - ## Disables further send operations. + ## Disables further send operations. IF_NAMESIZE* {.importc, header: "<net/if.h>".}: cint - + IPPROTO_IP* {.importc, header: "<netinet/in.h>".}: cint ## Internet protocol. IPPROTO_IPV6* {.importc, header: "<netinet/in.h>".}: cint @@ -1610,19 +1610,19 @@ var IPPROTO_ICMP* {.importc, header: "<netinet/in.h>".}: cint ## Control message protocol. IPPROTO_RAW* {.importc, header: "<netinet/in.h>".}: cint - ## Raw IP Packets Protocol. + ## Raw IP Packets Protocol. IPPROTO_TCP* {.importc, header: "<netinet/in.h>".}: cint ## Transmission control protocol. IPPROTO_UDP* {.importc, header: "<netinet/in.h>".}: cint ## User datagram protocol. - INADDR_ANY* {.importc, header: "<netinet/in.h>".}: TinAddrScalar + INADDR_ANY* {.importc, header: "<netinet/in.h>".}: TInAddrScalar ## IPv4 local host address. - INADDR_BROADCAST* {.importc, header: "<netinet/in.h>".}: TinAddrScalar + INADDR_BROADCAST* {.importc, header: "<netinet/in.h>".}: TInAddrScalar ## IPv4 broadcast address. INET_ADDRSTRLEN* {.importc, header: "<netinet/in.h>".}: cint - ## 16. Length of the string form for IP. + ## 16. Length of the string form for IP. IPV6_JOIN_GROUP* {.importc, header: "<netinet/in.h>".}: cint ## Join a multicast group. @@ -1640,68 +1640,68 @@ var ## Restrict AF_INET6 socket to IPv6 communications only. TCP_NODELAY* {.importc, header: "<netinet/tcp.h>".}: cint - ## Avoid coalescing of small segments. + ## Avoid coalescing of small segments. - IPPORT_RESERVED* {.importc, header: "<netdb.h>".}: cint + IPPORT_RESERVED* {.importc, header: "<netdb.h>".}: cint - HOST_NOT_FOUND* {.importc, header: "<netdb.h>".}: cint - NO_DATA* {.importc, header: "<netdb.h>".}: cint - NO_RECOVERY* {.importc, header: "<netdb.h>".}: cint - TRY_AGAIN* {.importc, header: "<netdb.h>".}: cint + HOST_NOT_FOUND* {.importc, header: "<netdb.h>".}: cint + NO_DATA* {.importc, header: "<netdb.h>".}: cint + NO_RECOVERY* {.importc, header: "<netdb.h>".}: cint + TRY_AGAIN* {.importc, header: "<netdb.h>".}: cint - AI_PASSIVE* {.importc, header: "<netdb.h>".}: cint + AI_PASSIVE* {.importc, header: "<netdb.h>".}: cint ## Socket address is intended for bind(). - AI_CANONNAME* {.importc, header: "<netdb.h>".}: cint + AI_CANONNAME* {.importc, header: "<netdb.h>".}: cint ## Request for canonical name. - AI_NUMERICHOST* {.importc, header: "<netdb.h>".}: cint + AI_NUMERICHOST* {.importc, header: "<netdb.h>".}: cint ## Return numeric host address as name. - AI_NUMERICSERV* {.importc, header: "<netdb.h>".}: cint + AI_NUMERICSERV* {.importc, header: "<netdb.h>".}: cint ## Inhibit service name resolution. - AI_V4MAPPED* {.importc, header: "<netdb.h>".}: cint + AI_V4MAPPED* {.importc, header: "<netdb.h>".}: cint ## If no IPv6 addresses are found, query for IPv4 addresses and ## return them to the caller as IPv4-mapped IPv6 addresses. - AI_ALL* {.importc, header: "<netdb.h>".}: cint + AI_ALL* {.importc, header: "<netdb.h>".}: cint ## Query for both IPv4 and IPv6 addresses. - AI_ADDRCONFIG* {.importc, header: "<netdb.h>".}: cint - ## Query for IPv4 addresses only when an IPv4 address is configured; + AI_ADDRCONFIG* {.importc, header: "<netdb.h>".}: cint + ## Query for IPv4 addresses only when an IPv4 address is configured; ## query for IPv6 addresses only when an IPv6 address is configured. - NI_NOFQDN* {.importc, header: "<netdb.h>".}: cint + NI_NOFQDN* {.importc, header: "<netdb.h>".}: cint ## Only the nodename portion of the FQDN is returned for local hosts. - NI_NUMERICHOST* {.importc, header: "<netdb.h>".}: cint + NI_NUMERICHOST* {.importc, header: "<netdb.h>".}: cint ## The numeric form of the node's address is returned instead of its name. - NI_NAMEREQD* {.importc, header: "<netdb.h>".}: cint + NI_NAMEREQD* {.importc, header: "<netdb.h>".}: cint ## Return an error if the node's name cannot be located in the database. - NI_NUMERICSERV* {.importc, header: "<netdb.h>".}: cint + NI_NUMERICSERV* {.importc, header: "<netdb.h>".}: cint ## The numeric form of the service address is returned instead of its name. - NI_NUMERICSCOPE* {.importc, header: "<netdb.h>".}: cint + NI_NUMERICSCOPE* {.importc, header: "<netdb.h>".}: cint ## For IPv6 addresses, the numeric form of the scope identifier is ## returned instead of its name. - NI_DGRAM* {.importc, header: "<netdb.h>".}: cint - ## Indicates that the service is a datagram service (SOCK_DGRAM). + NI_DGRAM* {.importc, header: "<netdb.h>".}: cint + ## Indicates that the service is a datagram service (SOCK_DGRAM). - EAI_AGAIN* {.importc, header: "<netdb.h>".}: cint + EAI_AGAIN* {.importc, header: "<netdb.h>".}: cint ## The name could not be resolved at this time. Future attempts may succeed. - EAI_BADFLAGS* {.importc, header: "<netdb.h>".}: cint + EAI_BADFLAGS* {.importc, header: "<netdb.h>".}: cint ## The flags had an invalid value. - EAI_FAIL* {.importc, header: "<netdb.h>".}: cint + EAI_FAIL* {.importc, header: "<netdb.h>".}: cint ## A non-recoverable error occurred. - EAI_FAMILY* {.importc, header: "<netdb.h>".}: cint - ## The address family was not recognized or the address length + EAI_FAMILY* {.importc, header: "<netdb.h>".}: cint + ## The address family was not recognized or the address length ## was invalid for the specified family. - EAI_MEMORY* {.importc, header: "<netdb.h>".}: cint + EAI_MEMORY* {.importc, header: "<netdb.h>".}: cint ## There was a memory allocation failure. - EAI_NONAME* {.importc, header: "<netdb.h>".}: cint + EAI_NONAME* {.importc, header: "<netdb.h>".}: cint ## The name does not resolve for the supplied parameters. - ## NI_NAMEREQD is set and the host's name cannot be located, + ## NI_NAMEREQD is set and the host's name cannot be located, ## or both nodename and servname were null. - EAI_SERVICE* {.importc, header: "<netdb.h>".}: cint + EAI_SERVICE* {.importc, header: "<netdb.h>".}: cint ## The service passed was not recognized for the specified socket type. - EAI_SOCKTYPE* {.importc, header: "<netdb.h>".}: cint + EAI_SOCKTYPE* {.importc, header: "<netdb.h>".}: cint ## The intended socket type was not recognized. - EAI_SYSTEM* {.importc, header: "<netdb.h>".}: cint + EAI_SYSTEM* {.importc, header: "<netdb.h>".}: cint ## A system error occurred. The error code can be found in errno. - EAI_OVERFLOW* {.importc, header: "<netdb.h>".}: cint + EAI_OVERFLOW* {.importc, header: "<netdb.h>".}: cint ## An argument buffer overflowed. POLLIN* {.importc, header: "<poll.h>".}: cshort @@ -1723,10 +1723,10 @@ var POLLHUP* {.importc, header: "<poll.h>".}: cshort ## Device has been disconnected (revents only). POLLNVAL* {.importc, header: "<poll.h>".}: cshort - ## Invalid fd member (revents only). + ## Invalid fd member (revents only). -when hasSpawnh: +when hasSpawnH: var POSIX_SPAWN_RESETIDS* {.importc, header: "<spawn.h>".}: cint POSIX_SPAWN_SETPGROUP* {.importc, header: "<spawn.h>".}: cint @@ -1743,18 +1743,18 @@ when hasSpawnh: # macosx lacks this, so we define the constant to be 0 to not affect # OR'ing of flags: const POSIX_SPAWN_USEVFORK* = cint(0) - + when hasAioH: proc aio_cancel*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".} proc aio_error*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} proc aio_fsync*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".} proc aio_read*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} proc aio_return*(a1: ptr Taiocb): int {.importc, header: "<aio.h>".} - proc aio_suspend*(a1: ptr ptr Taiocb, a2: cint, a3: ptr ttimespec): cint {. + proc aio_suspend*(a1: ptr ptr Taiocb, a2: cint, a3: ptr Ttimespec): cint {. importc, header: "<aio.h>".} proc aio_write*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".} proc lio_listio*(a1: cint, a2: ptr ptr Taiocb, a3: cint, - a4: ptr Tsigevent): cint {.importc, header: "<aio.h>".} + a4: ptr TsigEvent): cint {.importc, header: "<aio.h>".} # arpa/inet.h proc htonl*(a1: int32): int32 {.importc, header: "<arpa/inet.h>".} @@ -1778,9 +1778,9 @@ proc IN6ADDR_LOOPBACK_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".} # dirent.h proc closedir*(a1: ptr TDIR): cint {.importc, header: "<dirent.h>".} -proc opendir*(a1: cstring): ptr TDir {.importc, header: "<dirent.h>".} -proc readdir*(a1: ptr TDIR): ptr TDirent {.importc, header: "<dirent.h>".} -proc readdir_r*(a1: ptr TDIR, a2: ptr Tdirent, a3: ptr ptr TDirent): cint {. +proc opendir*(a1: cstring): ptr TDIR {.importc, header: "<dirent.h>".} +proc readdir*(a1: ptr TDIR): ptr Tdirent {.importc, header: "<dirent.h>".} +proc readdir_r*(a1: ptr TDIR, a2: ptr Tdirent, a3: ptr ptr Tdirent): cint {. importc, header: "<dirent.h>".} proc rewinddir*(a1: ptr TDIR) {.importc, header: "<dirent.h>".} proc seekdir*(a1: ptr TDIR, a2: int) {.importc, header: "<dirent.h>".} @@ -1792,12 +1792,12 @@ proc dlerror*(): cstring {.importc, header: "<dlfcn.h>".} proc dlopen*(a1: cstring, a2: cint): pointer {.importc, header: "<dlfcn.h>".} proc dlsym*(a1: pointer, a2: cstring): pointer {.importc, header: "<dlfcn.h>".} -proc creat*(a1: cstring, a2: Tmode): cint {.importc, header: "<fcntl.h>".} +proc creat*(a1: cstring, a2: TMode): cint {.importc, header: "<fcntl.h>".} proc fcntl*(a1: cint | TSocketHandle, a2: cint): cint {.varargs, importc, header: "<fcntl.h>".} proc open*(a1: cstring, a2: cint): cint {.varargs, importc, header: "<fcntl.h>".} -proc posix_fadvise*(a1: cint, a2, a3: Toff, a4: cint): cint {. +proc posix_fadvise*(a1: cint, a2, a3: TOff, a4: cint): cint {. importc, header: "<fcntl.h>".} -proc posix_fallocate*(a1: cint, a2, a3: Toff): cint {. +proc posix_fallocate*(a1: cint, a2, a3: TOff): cint {. importc, header: "<fcntl.h>".} proc feclearexcept*(a1: cint): cint {.importc, header: "<fenv.h>".} @@ -1812,32 +1812,32 @@ proc fesetround*(a1: cint): cint {.importc, header: "<fenv.h>".} proc fegetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".} proc feholdexcept*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".} proc fesetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".} -proc feupdateenv*(a1: ptr TFenv): cint {.importc, header: "<fenv.h>".} +proc feupdateenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".} when not defined(haiku): proc fmtmsg*(a1: int, a2: cstring, a3: cint, a4, a5, a6: cstring): cint {.importc, header: "<fmtmsg.h>".} - + proc fnmatch*(a1, a2: cstring, a3: cint): cint {.importc, header: "<fnmatch.h>".} -proc ftw*(a1: cstring, +proc ftw*(a1: cstring, a2: proc (x1: cstring, x2: ptr TStat, x3: cint): cint {.noconv.}, a3: cint): cint {.importc, header: "<ftw.h>".} -proc nftw*(a1: cstring, - a2: proc (x1: cstring, x2: ptr TStat, +proc nftw*(a1: cstring, + a2: proc (x1: cstring, x2: ptr TStat, x3: cint, x4: ptr TFTW): cint {.noconv.}, a3: cint, a4: cint): cint {.importc, header: "<ftw.h>".} proc glob*(a1: cstring, a2: cint, a3: proc (x1: cstring, x2: cint): cint {.noconv.}, - a4: ptr Tglob): cint {.importc, header: "<glob.h>".} + a4: ptr TGlob): cint {.importc, header: "<glob.h>".} proc globfree*(a1: ptr TGlob) {.importc, header: "<glob.h>".} proc getgrgid*(a1: TGid): ptr TGroup {.importc, header: "<grp.h>".} proc getgrnam*(a1: cstring): ptr TGroup {.importc, header: "<grp.h>".} -proc getgrgid_r*(a1: Tgid, a2: ptr TGroup, a3: cstring, a4: int, +proc getgrgid_r*(a1: TGid, a2: ptr TGroup, a3: cstring, a4: int, a5: ptr ptr TGroup): cint {.importc, header: "<grp.h>".} -proc getgrnam_r*(a1: cstring, a2: ptr TGroup, a3: cstring, +proc getgrnam_r*(a1: cstring, a2: ptr TGroup, a3: cstring, a4: int, a5: ptr ptr TGroup): cint {. importc, header: "<grp.h>".} proc getgrent*(): ptr TGroup {.importc, header: "<grp.h>".} @@ -1845,7 +1845,7 @@ proc endgrent*() {.importc, header: "<grp.h>".} proc setgrent*() {.importc, header: "<grp.h>".} -proc iconv_open*(a1, a2: cstring): TIconv {.importc, header: "<iconv.h>".} +proc iconv_open*(a1, a2: cstring): Ticonv {.importc, header: "<iconv.h>".} proc iconv*(a1: Ticonv, a2: var cstring, a3: var int, a4: var cstring, a5: var int): int {.importc, header: "<iconv.h>".} proc iconv_close*(a1: Ticonv): cint {.importc, header: "<iconv.h>".} @@ -1862,33 +1862,33 @@ proc setlocale*(a1: cint, a2: cstring): cstring {. proc strfmon*(a1: cstring, a2: int, a3: cstring): int {.varargs, importc, header: "<monetary.h>".} -proc mq_close*(a1: Tmqd): cint {.importc, header: "<mqueue.h>".} -proc mq_getattr*(a1: Tmqd, a2: ptr Tmq_attr): cint {. +proc mq_close*(a1: TMqd): cint {.importc, header: "<mqueue.h>".} +proc mq_getattr*(a1: TMqd, a2: ptr TMqAttr): cint {. importc, header: "<mqueue.h>".} -proc mq_notify*(a1: Tmqd, a2: ptr Tsigevent): cint {. +proc mq_notify*(a1: TMqd, a2: ptr TsigEvent): cint {. importc, header: "<mqueue.h>".} proc mq_open*(a1: cstring, a2: cint): TMqd {. varargs, importc, header: "<mqueue.h>".} -proc mq_receive*(a1: Tmqd, a2: cstring, a3: int, a4: var int): int {. +proc mq_receive*(a1: TMqd, a2: cstring, a3: int, a4: var int): int {. importc, header: "<mqueue.h>".} -proc mq_send*(a1: Tmqd, a2: cstring, a3: int, a4: int): cint {. +proc mq_send*(a1: TMqd, a2: cstring, a3: int, a4: int): cint {. importc, header: "<mqueue.h>".} -proc mq_setattr*(a1: Tmqd, a2, a3: ptr Tmq_attr): cint {. +proc mq_setattr*(a1: TMqd, a2, a3: ptr TMqAttr): cint {. importc, header: "<mqueue.h>".} -proc mq_timedreceive*(a1: Tmqd, a2: cstring, a3: int, a4: int, - a5: ptr TTimespec): int {.importc, header: "<mqueue.h>".} -proc mq_timedsend*(a1: Tmqd, a2: cstring, a3: int, a4: int, - a5: ptr TTimeSpec): cint {.importc, header: "<mqueue.h>".} +proc mq_timedreceive*(a1: TMqd, a2: cstring, a3: int, a4: int, + a5: ptr Ttimespec): int {.importc, header: "<mqueue.h>".} +proc mq_timedsend*(a1: TMqd, a2: cstring, a3: int, a4: int, + a5: ptr Ttimespec): cint {.importc, header: "<mqueue.h>".} proc mq_unlink*(a1: cstring): cint {.importc, header: "<mqueue.h>".} proc getpwnam*(a1: cstring): ptr TPasswd {.importc, header: "<pwd.h>".} proc getpwuid*(a1: Tuid): ptr TPasswd {.importc, header: "<pwd.h>".} -proc getpwnam_r*(a1: cstring, a2: ptr Tpasswd, a3: cstring, a4: int, - a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".} -proc getpwuid_r*(a1: Tuid, a2: ptr Tpasswd, a3: cstring, - a4: int, a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".} +proc getpwnam_r*(a1: cstring, a2: ptr TPasswd, a3: cstring, a4: int, + a5: ptr ptr TPasswd): cint {.importc, header: "<pwd.h>".} +proc getpwuid_r*(a1: Tuid, a2: ptr TPasswd, a3: cstring, + a4: int, a5: ptr ptr TPasswd): cint {.importc, header: "<pwd.h>".} proc endpwent*() {.importc, header: "<pwd.h>".} proc getpwent*(): ptr TPasswd {.importc, header: "<pwd.h>".} proc setpwent*() {.importc, header: "<pwd.h>".} @@ -1933,9 +1933,9 @@ proc pthread_attr_setscope*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".} proc pthread_attr_setstack*(a1: ptr Tpthread_attr, a2: pointer, a3: int): cint {. importc, header: "<pthread.h>".} -proc pthread_attr_setstackaddr*(a1: ptr TPthread_attr, a2: pointer): cint {. +proc pthread_attr_setstackaddr*(a1: ptr Tpthread_attr, a2: pointer): cint {. importc, header: "<pthread.h>".} -proc pthread_attr_setstacksize*(a1: ptr TPthread_attr, a2: int): cint {. +proc pthread_attr_setstacksize*(a1: ptr Tpthread_attr, a2: int): cint {. importc, header: "<pthread.h>".} proc pthread_barrier_destroy*(a1: ptr Tpthread_barrier): cint {. importc, header: "<pthread.h>".} @@ -1949,9 +1949,9 @@ proc pthread_barrierattr_destroy*(a1: ptr Tpthread_barrierattr): cint {. proc pthread_barrierattr_getpshared*( a1: ptr Tpthread_barrierattr, a2: var cint): cint {. importc, header: "<pthread.h>".} -proc pthread_barrierattr_init*(a1: ptr TPthread_barrierattr): cint {. +proc pthread_barrierattr_init*(a1: ptr Tpthread_barrierattr): cint {. importc, header: "<pthread.h>".} -proc pthread_barrierattr_setpshared*(a1: ptr TPthread_barrierattr, +proc pthread_barrierattr_setpshared*(a1: ptr Tpthread_barrierattr, a2: cint): cint {.importc, header: "<pthread.h>".} proc pthread_cancel*(a1: Tpthread): cint {.importc, header: "<pthread.h>".} proc pthread_cleanup_push*(a1: proc (x: pointer) {.noconv.}, a2: pointer) {. @@ -1970,13 +1970,13 @@ proc pthread_cond_wait*(a1: ptr Tpthread_cond, a2: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".} proc pthread_condattr_destroy*(a1: ptr Tpthread_condattr): cint {.importc, header: "<pthread.h>".} proc pthread_condattr_getclock*(a1: ptr Tpthread_condattr, - a2: var Tclockid): cint {.importc, header: "<pthread.h>".} + a2: var TClockId): cint {.importc, header: "<pthread.h>".} proc pthread_condattr_getpshared*(a1: ptr Tpthread_condattr, a2: var cint): cint {.importc, header: "<pthread.h>".} - -proc pthread_condattr_init*(a1: ptr TPthread_condattr): cint {.importc, header: "<pthread.h>".} -proc pthread_condattr_setclock*(a1: ptr TPthread_condattr,a2: Tclockid): cint {.importc, header: "<pthread.h>".} -proc pthread_condattr_setpshared*(a1: ptr TPthread_condattr, a2: cint): cint {.importc, header: "<pthread.h>".} + +proc pthread_condattr_init*(a1: ptr Tpthread_condattr): cint {.importc, header: "<pthread.h>".} +proc pthread_condattr_setclock*(a1: ptr Tpthread_condattr,a2: TClockId): cint {.importc, header: "<pthread.h>".} +proc pthread_condattr_setpshared*(a1: ptr Tpthread_condattr, a2: cint): cint {.importc, header: "<pthread.h>".} proc pthread_create*(a1: ptr Tpthread, a2: ptr Tpthread_attr, a3: proc (x: pointer): pointer {.noconv.}, a4: pointer): cint {.importc, header: "<pthread.h>".} @@ -1984,7 +1984,7 @@ proc pthread_detach*(a1: Tpthread): cint {.importc, header: "<pthread.h>".} proc pthread_equal*(a1, a2: Tpthread): cint {.importc, header: "<pthread.h>".} proc pthread_exit*(a1: pointer) {.importc, header: "<pthread.h>".} proc pthread_getconcurrency*(): cint {.importc, header: "<pthread.h>".} -proc pthread_getcpuclockid*(a1: Tpthread, a2: var Tclockid): cint {.importc, header: "<pthread.h>".} +proc pthread_getcpuclockid*(a1: Tpthread, a2: var TClockId): cint {.importc, header: "<pthread.h>".} proc pthread_getschedparam*(a1: Tpthread, a2: var cint, a3: ptr Tsched_param): cint {.importc, header: "<pthread.h>".} proc pthread_getspecific*(a1: Tpthread_key): pointer {.importc, header: "<pthread.h>".} @@ -2016,7 +2016,7 @@ proc pthread_mutexattr_gettype*(a1: ptr Tpthread_mutexattr, a2: var cint): cint {.importc, header: "<pthread.h>".} proc pthread_mutexattr_init*(a1: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".} -proc pthread_mutexattr_setprioceiling*(a1: ptr tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".} +proc pthread_mutexattr_setprioceiling*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".} proc pthread_mutexattr_setprotocol*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".} proc pthread_mutexattr_setpshared*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".} proc pthread_mutexattr_settype*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".} @@ -2069,7 +2069,7 @@ proc pthread_testcancel*() {.importc, header: "<pthread.h>".} proc access*(a1: cstring, a2: cint): cint {.importc, header: "<unistd.h>".} proc alarm*(a1: cint): cint {.importc, header: "<unistd.h>".} proc chdir*(a1: cstring): cint {.importc, header: "<unistd.h>".} -proc chown*(a1: cstring, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".} +proc chown*(a1: cstring, a2: Tuid, a3: TGid): cint {.importc, header: "<unistd.h>".} proc close*(a1: cint | TSocketHandle): cint {.importc, header: "<unistd.h>".} proc confstr*(a1: cint, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".} proc crypt*(a1, a2: cstring): cstring {.importc, header: "<unistd.h>".} @@ -2085,19 +2085,20 @@ proc execv*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>" proc execve*(a1: cstring, a2, a3: cstringArray): cint {. importc, header: "<unistd.h>".} proc execvp*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".} -proc fchown*(a1: cint, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".} +proc execvpe*(a1: cstring, a2: cstringArray, a3: cstringArray): cint {.importc, header: "<unistd.h>".} +proc fchown*(a1: cint, a2: Tuid, a3: TGid): cint {.importc, header: "<unistd.h>".} proc fchdir*(a1: cint): cint {.importc, header: "<unistd.h>".} proc fdatasync*(a1: cint): cint {.importc, header: "<unistd.h>".} -proc fork*(): Tpid {.importc, header: "<unistd.h>".} +proc fork*(): TPid {.importc, header: "<unistd.h>".} proc fpathconf*(a1, a2: cint): int {.importc, header: "<unistd.h>".} proc fsync*(a1: cint): cint {.importc, header: "<unistd.h>".} -proc ftruncate*(a1: cint, a2: Toff): cint {.importc, header: "<unistd.h>".} +proc ftruncate*(a1: cint, a2: TOff): cint {.importc, header: "<unistd.h>".} proc getcwd*(a1: cstring, a2: int): cstring {.importc, header: "<unistd.h>".} proc getegid*(): TGid {.importc, header: "<unistd.h>".} -proc geteuid*(): TUid {.importc, header: "<unistd.h>".} +proc geteuid*(): Tuid {.importc, header: "<unistd.h>".} proc getgid*(): TGid {.importc, header: "<unistd.h>".} -proc getgroups*(a1: cint, a2: ptr array[0..255, Tgid]): cint {. +proc getgroups*(a1: cint, a2: ptr array[0..255, TGid]): cint {. importc, header: "<unistd.h>".} proc gethostid*(): int {.importc, header: "<unistd.h>".} proc gethostname*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".} @@ -2106,120 +2107,120 @@ proc getlogin_r*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".} proc getopt*(a1: cint, a2: cstringArray, a3: cstring): cint {. importc, header: "<unistd.h>".} -proc getpgid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".} -proc getpgrp*(): Tpid {.importc, header: "<unistd.h>".} -proc getpid*(): Tpid {.importc, header: "<unistd.h>".} -proc getppid*(): Tpid {.importc, header: "<unistd.h>".} -proc getsid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".} +proc getpgid*(a1: TPid): TPid {.importc, header: "<unistd.h>".} +proc getpgrp*(): TPid {.importc, header: "<unistd.h>".} +proc getpid*(): TPid {.importc, header: "<unistd.h>".} +proc getppid*(): TPid {.importc, header: "<unistd.h>".} +proc getsid*(a1: TPid): TPid {.importc, header: "<unistd.h>".} proc getuid*(): Tuid {.importc, header: "<unistd.h>".} proc getwd*(a1: cstring): cstring {.importc, header: "<unistd.h>".} proc isatty*(a1: cint): cint {.importc, header: "<unistd.h>".} -proc lchown*(a1: cstring, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".} +proc lchown*(a1: cstring, a2: Tuid, a3: TGid): cint {.importc, header: "<unistd.h>".} proc link*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".} -proc lockf*(a1, a2: cint, a3: Toff): cint {.importc, header: "<unistd.h>".} -proc lseek*(a1: cint, a2: Toff, a3: cint): Toff {.importc, header: "<unistd.h>".} +proc lockf*(a1, a2: cint, a3: TOff): cint {.importc, header: "<unistd.h>".} +proc lseek*(a1: cint, a2: TOff, a3: cint): TOff {.importc, header: "<unistd.h>".} proc nice*(a1: cint): cint {.importc, header: "<unistd.h>".} proc pathconf*(a1: cstring, a2: cint): int {.importc, header: "<unistd.h>".} proc pause*(): cint {.importc, header: "<unistd.h>".} proc pipe*(a: array[0..1, cint]): cint {.importc, header: "<unistd.h>".} -proc pread*(a1: cint, a2: pointer, a3: int, a4: Toff): int {. +proc pread*(a1: cint, a2: pointer, a3: int, a4: TOff): int {. importc, header: "<unistd.h>".} -proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Toff): int {. +proc pwrite*(a1: cint, a2: pointer, a3: int, a4: TOff): int {. importc, header: "<unistd.h>".} proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".} proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".} proc rmdir*(a1: cstring): cint {.importc, header: "<unistd.h>".} -proc setegid*(a1: Tgid): cint {.importc, header: "<unistd.h>".} +proc setegid*(a1: TGid): cint {.importc, header: "<unistd.h>".} proc seteuid*(a1: Tuid): cint {.importc, header: "<unistd.h>".} -proc setgid*(a1: Tgid): cint {.importc, header: "<unistd.h>".} +proc setgid*(a1: TGid): cint {.importc, header: "<unistd.h>".} -proc setpgid*(a1, a2: Tpid): cint {.importc, header: "<unistd.h>".} -proc setpgrp*(): Tpid {.importc, header: "<unistd.h>".} -proc setregid*(a1, a2: Tgid): cint {.importc, header: "<unistd.h>".} +proc setpgid*(a1, a2: TPid): cint {.importc, header: "<unistd.h>".} +proc setpgrp*(): TPid {.importc, header: "<unistd.h>".} +proc setregid*(a1, a2: TGid): cint {.importc, header: "<unistd.h>".} proc setreuid*(a1, a2: Tuid): cint {.importc, header: "<unistd.h>".} -proc setsid*(): Tpid {.importc, header: "<unistd.h>".} +proc setsid*(): TPid {.importc, header: "<unistd.h>".} proc setuid*(a1: Tuid): cint {.importc, header: "<unistd.h>".} proc sleep*(a1: cint): cint {.importc, header: "<unistd.h>".} proc swab*(a1, a2: pointer, a3: int) {.importc, header: "<unistd.h>".} proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".} proc sync*() {.importc, header: "<unistd.h>".} proc sysconf*(a1: cint): int {.importc, header: "<unistd.h>".} -proc tcgetpgrp*(a1: cint): tpid {.importc, header: "<unistd.h>".} -proc tcsetpgrp*(a1: cint, a2: Tpid): cint {.importc, header: "<unistd.h>".} -proc truncate*(a1: cstring, a2: Toff): cint {.importc, header: "<unistd.h>".} +proc tcgetpgrp*(a1: cint): TPid {.importc, header: "<unistd.h>".} +proc tcsetpgrp*(a1: cint, a2: TPid): cint {.importc, header: "<unistd.h>".} +proc truncate*(a1: cstring, a2: TOff): cint {.importc, header: "<unistd.h>".} proc ttyname*(a1: cint): cstring {.importc, header: "<unistd.h>".} proc ttyname_r*(a1: cint, a2: cstring, a3: int): cint {. importc, header: "<unistd.h>".} proc ualarm*(a1, a2: Tuseconds): Tuseconds {.importc, header: "<unistd.h>".} proc unlink*(a1: cstring): cint {.importc, header: "<unistd.h>".} proc usleep*(a1: Tuseconds): cint {.importc, header: "<unistd.h>".} -proc vfork*(): tpid {.importc, header: "<unistd.h>".} +proc vfork*(): TPid {.importc, header: "<unistd.h>".} proc write*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".} -proc sem_close*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".} -proc sem_destroy*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".} -proc sem_getvalue*(a1: ptr Tsem, a2: var cint): cint {. +proc sem_close*(a1: ptr TSem): cint {.importc, header: "<semaphore.h>".} +proc sem_destroy*(a1: ptr TSem): cint {.importc, header: "<semaphore.h>".} +proc sem_getvalue*(a1: ptr TSem, a2: var cint): cint {. importc, header: "<semaphore.h>".} -proc sem_init*(a1: ptr Tsem, a2: cint, a3: cint): cint {. +proc sem_init*(a1: ptr TSem, a2: cint, a3: cint): cint {. importc, header: "<semaphore.h>".} proc sem_open*(a1: cstring, a2: cint): ptr TSem {. varargs, importc, header: "<semaphore.h>".} -proc sem_post*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".} -proc sem_timedwait*(a1: ptr Tsem, a2: ptr Ttimespec): cint {. +proc sem_post*(a1: ptr TSem): cint {.importc, header: "<semaphore.h>".} +proc sem_timedwait*(a1: ptr TSem, a2: ptr Ttimespec): cint {. importc, header: "<semaphore.h>".} -proc sem_trywait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".} +proc sem_trywait*(a1: ptr TSem): cint {.importc, header: "<semaphore.h>".} proc sem_unlink*(a1: cstring): cint {.importc, header: "<semaphore.h>".} -proc sem_wait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".} +proc sem_wait*(a1: ptr TSem): cint {.importc, header: "<semaphore.h>".} -proc ftok*(a1: cstring, a2: cint): Tkey {.importc, header: "<sys/ipc.h>".} +proc ftok*(a1: cstring, a2: cint): TKey {.importc, header: "<sys/ipc.h>".} -proc statvfs*(a1: cstring, a2: var Tstatvfs): cint {. +proc statvfs*(a1: cstring, a2: var TStatvfs): cint {. importc, header: "<sys/statvfs.h>".} -proc fstatvfs*(a1: cint, a2: var Tstatvfs): cint {. +proc fstatvfs*(a1: cint, a2: var TStatvfs): cint {. importc, header: "<sys/statvfs.h>".} proc chmod*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".} proc fchmod*(a1: cint, a2: TMode): cint {.importc, header: "<sys/stat.h>".} -proc fstat*(a1: cint, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".} -proc lstat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".} +proc fstat*(a1: cint, a2: var TStat): cint {.importc, header: "<sys/stat.h>".} +proc lstat*(a1: cstring, a2: var TStat): cint {.importc, header: "<sys/stat.h>".} proc mkdir*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".} proc mkfifo*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".} -proc mknod*(a1: cstring, a2: TMode, a3: Tdev): cint {. +proc mknod*(a1: cstring, a2: TMode, a3: TDev): cint {. importc, header: "<sys/stat.h>".} -proc stat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".} -proc umask*(a1: Tmode): TMode {.importc, header: "<sys/stat.h>".} +proc stat*(a1: cstring, a2: var TStat): cint {.importc, header: "<sys/stat.h>".} +proc umask*(a1: TMode): TMode {.importc, header: "<sys/stat.h>".} -proc S_ISBLK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} +proc S_ISBLK*(m: TMode): bool {.importc, header: "<sys/stat.h>".} ## Test for a block special file. -proc S_ISCHR*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} +proc S_ISCHR*(m: TMode): bool {.importc, header: "<sys/stat.h>".} ## Test for a character special file. -proc S_ISDIR*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} +proc S_ISDIR*(m: TMode): bool {.importc, header: "<sys/stat.h>".} ## Test for a directory. -proc S_ISFIFO*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} +proc S_ISFIFO*(m: TMode): bool {.importc, header: "<sys/stat.h>".} ## Test for a pipe or FIFO special file. -proc S_ISREG*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} +proc S_ISREG*(m: TMode): bool {.importc, header: "<sys/stat.h>".} ## Test for a regular file. -proc S_ISLNK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} +proc S_ISLNK*(m: TMode): bool {.importc, header: "<sys/stat.h>".} ## Test for a symbolic link. -proc S_ISSOCK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".} - ## Test for a socket. - +proc S_ISSOCK*(m: TMode): bool {.importc, header: "<sys/stat.h>".} + ## Test for a socket. + proc S_TYPEISMQ*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".} ## Test for a message queue. proc S_TYPEISSEM*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".} ## Test for a semaphore. proc S_TYPEISSHM*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".} - ## Test for a shared memory object. - + ## Test for a shared memory object. + proc S_TYPEISTMO*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".} - ## Test macro for a typed memory object. - + ## Test macro for a typed memory object. + proc mlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".} proc mlockall*(a1: cint): cint {.importc, header: "<sys/mman.h>".} -proc mmap*(a1: pointer, a2: int, a3, a4, a5: cint, a6: Toff): pointer {. +proc mmap*(a1: pointer, a2: int, a3, a4, a5: cint, a6: TOff): pointer {. importc, header: "<sys/mman.h>".} proc mprotect*(a1: pointer, a2: int, a3: cint): cint {. importc, header: "<sys/mman.h>".} @@ -2229,75 +2230,75 @@ proc munlockall*(): cint {.importc, header: "<sys/mman.h>".} proc munmap*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".} proc posix_madvise*(a1: pointer, a2: int, a3: cint): cint {. importc, header: "<sys/mman.h>".} -proc posix_mem_offset*(a1: pointer, a2: int, a3: var Toff, +proc posix_mem_offset*(a1: pointer, a2: int, a3: var TOff, a4: var int, a5: var cint): cint {.importc, header: "<sys/mman.h>".} -proc posix_typed_mem_get_info*(a1: cint, +proc posix_typed_mem_get_info*(a1: cint, a2: var Tposix_typed_mem_info): cint {.importc, header: "<sys/mman.h>".} proc posix_typed_mem_open*(a1: cstring, a2, a3: cint): cint {. importc, header: "<sys/mman.h>".} -proc shm_open*(a1: cstring, a2: cint, a3: Tmode): cint {. +proc shm_open*(a1: cstring, a2: cint, a3: TMode): cint {. importc, header: "<sys/mman.h>".} proc shm_unlink*(a1: cstring): cint {.importc, header: "<sys/mman.h>".} -proc asctime*(a1: var ttm): cstring{.importc, header: "<time.h>".} +proc asctime*(a1: var Ttm): cstring{.importc, header: "<time.h>".} -proc asctime_r*(a1: var ttm, a2: cstring): cstring {.importc, header: "<time.h>".} -proc clock*(): Tclock {.importc, header: "<time.h>".} -proc clock_getcpuclockid*(a1: tpid, a2: var Tclockid): cint {. +proc asctime_r*(a1: var Ttm, a2: cstring): cstring {.importc, header: "<time.h>".} +proc clock*(): TClock {.importc, header: "<time.h>".} +proc clock_getcpuclockid*(a1: TPid, a2: var TClockId): cint {. importc, header: "<time.h>".} -proc clock_getres*(a1: Tclockid, a2: var Ttimespec): cint {. +proc clock_getres*(a1: TClockId, a2: var Ttimespec): cint {. importc, header: "<time.h>".} -proc clock_gettime*(a1: Tclockid, a2: var Ttimespec): cint {. +proc clock_gettime*(a1: TClockId, a2: var Ttimespec): cint {. importc, header: "<time.h>".} -proc clock_nanosleep*(a1: Tclockid, a2: cint, a3: var Ttimespec, +proc clock_nanosleep*(a1: TClockId, a2: cint, a3: var Ttimespec, a4: var Ttimespec): cint {.importc, header: "<time.h>".} -proc clock_settime*(a1: Tclockid, a2: var Ttimespec): cint {. +proc clock_settime*(a1: TClockId, a2: var Ttimespec): cint {. importc, header: "<time.h>".} -proc ctime*(a1: var Ttime): cstring {.importc, header: "<time.h>".} -proc ctime_r*(a1: var Ttime, a2: cstring): cstring {.importc, header: "<time.h>".} -proc difftime*(a1, a2: Ttime): cdouble {.importc, header: "<time.h>".} -proc getdate*(a1: cstring): ptr ttm {.importc, header: "<time.h>".} +proc ctime*(a1: var TTime): cstring {.importc, header: "<time.h>".} +proc ctime_r*(a1: var TTime, a2: cstring): cstring {.importc, header: "<time.h>".} +proc difftime*(a1, a2: TTime): cdouble {.importc, header: "<time.h>".} +proc getdate*(a1: cstring): ptr Ttm {.importc, header: "<time.h>".} -proc gmtime*(a1: var ttime): ptr ttm {.importc, header: "<time.h>".} -proc gmtime_r*(a1: var ttime, a2: var ttm): ptr ttm {.importc, header: "<time.h>".} -proc localtime*(a1: var ttime): ptr ttm {.importc, header: "<time.h>".} -proc localtime_r*(a1: var ttime, a2: var ttm): ptr ttm {.importc, header: "<time.h>".} -proc mktime*(a1: var ttm): ttime {.importc, header: "<time.h>".} +proc gmtime*(a1: var TTime): ptr Ttm {.importc, header: "<time.h>".} +proc gmtime_r*(a1: var TTime, a2: var Ttm): ptr Ttm {.importc, header: "<time.h>".} +proc localtime*(a1: var TTime): ptr Ttm {.importc, header: "<time.h>".} +proc localtime_r*(a1: var TTime, a2: var Ttm): ptr Ttm {.importc, header: "<time.h>".} +proc mktime*(a1: var Ttm): TTime {.importc, header: "<time.h>".} proc nanosleep*(a1, a2: var Ttimespec): cint {.importc, header: "<time.h>".} proc strftime*(a1: cstring, a2: int, a3: cstring, - a4: var ttm): int {.importc, header: "<time.h>".} -proc strptime*(a1, a2: cstring, a3: var ttm): cstring {.importc, header: "<time.h>".} -proc time*(a1: var Ttime): ttime {.importc, header: "<time.h>".} -proc timer_create*(a1: var Tclockid, a2: var Tsigevent, + a4: var Ttm): int {.importc, header: "<time.h>".} +proc strptime*(a1, a2: cstring, a3: var Ttm): cstring {.importc, header: "<time.h>".} +proc time*(a1: var TTime): TTime {.importc, header: "<time.h>".} +proc timer_create*(a1: var TClockId, a2: var TsigEvent, a3: var Ttimer): cint {.importc, header: "<time.h>".} proc timer_delete*(a1: var Ttimer): cint {.importc, header: "<time.h>".} -proc timer_gettime*(a1: Ttimer, a2: var Titimerspec): cint {. +proc timer_gettime*(a1: Ttimer, a2: var titimerspec): cint {. importc, header: "<time.h>".} proc timer_getoverrun*(a1: Ttimer): cint {.importc, header: "<time.h>".} -proc timer_settime*(a1: Ttimer, a2: cint, a3: var Titimerspec, +proc timer_settime*(a1: Ttimer, a2: cint, a3: var titimerspec, a4: var titimerspec): cint {.importc, header: "<time.h>".} proc tzset*() {.importc, header: "<time.h>".} -proc wait*(a1: var cint): tpid {.importc, header: "<sys/wait.h>".} -proc waitid*(a1: cint, a2: tid, a3: var Tsiginfo, a4: cint): cint {. +proc wait*(a1: var cint): TPid {.importc, header: "<sys/wait.h>".} +proc waitid*(a1: cint, a2: Tid, a3: var TsigInfo, a4: cint): cint {. importc, header: "<sys/wait.h>".} -proc waitpid*(a1: tpid, a2: var cint, a3: cint): tpid {. +proc waitpid*(a1: TPid, a2: var cint, a3: cint): TPid {. importc, header: "<sys/wait.h>".} proc bsd_signal*(a1: cint, a2: proc (x: pointer) {.noconv.}) {. importc, header: "<signal.h>".} -proc kill*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".} -proc killpg*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".} -proc pthread_kill*(a1: tpthread, a2: cint): cint {.importc, header: "<signal.h>".} +proc kill*(a1: TPid, a2: cint): cint {.importc, header: "<signal.h>".} +proc killpg*(a1: TPid, a2: cint): cint {.importc, header: "<signal.h>".} +proc pthread_kill*(a1: Tpthread, a2: cint): cint {.importc, header: "<signal.h>".} proc pthread_sigmask*(a1: cint, a2, a3: var Tsigset): cint {. importc, header: "<signal.h>".} proc `raise`*(a1: cint): cint {.importc, header: "<signal.h>".} -proc sigaction*(a1: cint, a2, a3: var Tsigaction): cint {. +proc sigaction*(a1: cint, a2, a3: var TSigaction): cint {. importc, header: "<signal.h>".} proc sigaddset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".} -proc sigaltstack*(a1, a2: var Tstack): cint {.importc, header: "<signal.h>".} +proc sigaltstack*(a1, a2: var TStack): cint {.importc, header: "<signal.h>".} proc sigdelset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".} proc sigemptyset*(a1: var Tsigset): cint {.importc, header: "<signal.h>".} proc sigfillset*(a1: var Tsigset): cint {.importc, header: "<signal.h>".} @@ -2308,20 +2309,20 @@ proc sigismember*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h proc signal*(a1: cint, a2: proc (x: cint) {.noconv.}) {. importc, header: "<signal.h>".} proc sigpause*(a1: cint): cint {.importc, header: "<signal.h>".} -proc sigpending*(a1: var tsigset): cint {.importc, header: "<signal.h>".} -proc sigprocmask*(a1: cint, a2, a3: var tsigset): cint {. +proc sigpending*(a1: var Tsigset): cint {.importc, header: "<signal.h>".} +proc sigprocmask*(a1: cint, a2, a3: var Tsigset): cint {. importc, header: "<signal.h>".} -proc sigqueue*(a1: tpid, a2: cint, a3: Tsigval): cint {. +proc sigqueue*(a1: TPid, a2: cint, a3: TsigVal): cint {. importc, header: "<signal.h>".} proc sigrelse*(a1: cint): cint {.importc, header: "<signal.h>".} proc sigset*(a1: int, a2: proc (x: cint) {.noconv.}) {. importc, header: "<signal.h>".} proc sigsuspend*(a1: var Tsigset): cint {.importc, header: "<signal.h>".} -proc sigtimedwait*(a1: var Tsigset, a2: var tsiginfo, - a3: var ttimespec): cint {.importc, header: "<signal.h>".} +proc sigtimedwait*(a1: var Tsigset, a2: var TsigInfo, + a3: var Ttimespec): cint {.importc, header: "<signal.h>".} proc sigwait*(a1: var Tsigset, a2: var cint): cint {. importc, header: "<signal.h>".} -proc sigwaitinfo*(a1: var Tsigset, a2: var tsiginfo): cint {. +proc sigwaitinfo*(a1: var Tsigset, a2: var TsigInfo): cint {. importc, header: "<signal.h>".} @@ -2333,81 +2334,81 @@ proc catopen*(a1: cstring, a2: cint): Tnl_catd {. proc sched_get_priority_max*(a1: cint): cint {.importc, header: "<sched.h>".} proc sched_get_priority_min*(a1: cint): cint {.importc, header: "<sched.h>".} -proc sched_getparam*(a1: tpid, a2: var Tsched_param): cint {. +proc sched_getparam*(a1: TPid, a2: var Tsched_param): cint {. importc, header: "<sched.h>".} -proc sched_getscheduler*(a1: tpid): cint {.importc, header: "<sched.h>".} -proc sched_rr_get_interval*(a1: tpid, a2: var Ttimespec): cint {. +proc sched_getscheduler*(a1: TPid): cint {.importc, header: "<sched.h>".} +proc sched_rr_get_interval*(a1: TPid, a2: var Ttimespec): cint {. importc, header: "<sched.h>".} -proc sched_setparam*(a1: tpid, a2: var Tsched_param): cint {. +proc sched_setparam*(a1: TPid, a2: var Tsched_param): cint {. importc, header: "<sched.h>".} -proc sched_setscheduler*(a1: tpid, a2: cint, a3: var tsched_param): cint {. +proc sched_setscheduler*(a1: TPid, a2: cint, a3: var Tsched_param): cint {. importc, header: "<sched.h>".} proc sched_yield*(): cint {.importc, header: "<sched.h>".} proc strerror*(errnum: cint): cstring {.importc, header: "<string.h>".} proc hstrerror*(herrnum: cint): cstring {.importc, header: "<netdb.h>".} -proc FD_CLR*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".} -proc FD_ISSET*(a1: cint | TSocketHandle, a2: var Tfd_set): cint {. +proc FD_CLR*(a1: cint, a2: var TFdSet) {.importc, header: "<sys/select.h>".} +proc FD_ISSET*(a1: cint | TSocketHandle, a2: var TFdSet): cint {. importc, header: "<sys/select.h>".} -proc FD_SET*(a1: cint | TSocketHandle, a2: var Tfd_set) {.importc, header: "<sys/select.h>".} -proc FD_ZERO*(a1: var Tfd_set) {.importc, header: "<sys/select.h>".} +proc FD_SET*(a1: cint | TSocketHandle, a2: var TFdSet) {.importc, header: "<sys/select.h>".} +proc FD_ZERO*(a1: var TFdSet) {.importc, header: "<sys/select.h>".} -proc pselect*(a1: cint, a2, a3, a4: ptr Tfd_set, a5: ptr ttimespec, +proc pselect*(a1: cint, a2, a3, a4: ptr TFdSet, a5: ptr Ttimespec, a6: var Tsigset): cint {.importc, header: "<sys/select.h>".} -proc select*(a1: cint, a2, a3, a4: ptr Tfd_set, a5: ptr ttimeval): cint {. +proc select*(a1: cint, a2, a3, a4: ptr TFdSet, a5: ptr Ttimeval): cint {. importc, header: "<sys/select.h>".} when hasSpawnH: - proc posix_spawn*(a1: var tpid, a2: cstring, + proc posix_spawn*(a1: var TPid, a2: cstring, a3: var Tposix_spawn_file_actions, - a4: var Tposix_spawnattr, + a4: var Tposix_spawnattr, a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} - proc posix_spawn_file_actions_addclose*(a1: var tposix_spawn_file_actions, + proc posix_spawn_file_actions_addclose*(a1: var Tposix_spawn_file_actions, a2: cint): cint {.importc, header: "<spawn.h>".} - proc posix_spawn_file_actions_adddup2*(a1: var tposix_spawn_file_actions, + proc posix_spawn_file_actions_adddup2*(a1: var Tposix_spawn_file_actions, a2, a3: cint): cint {.importc, header: "<spawn.h>".} - proc posix_spawn_file_actions_addopen*(a1: var tposix_spawn_file_actions, - a2: cint, a3: cstring, a4: cint, a5: tmode): cint {. + proc posix_spawn_file_actions_addopen*(a1: var Tposix_spawn_file_actions, + a2: cint, a3: cstring, a4: cint, a5: TMode): cint {. importc, header: "<spawn.h>".} proc posix_spawn_file_actions_destroy*( - a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} + a1: var Tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} proc posix_spawn_file_actions_init*( - a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_destroy*(a1: var tposix_spawnattr): cint {. + a1: var Tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_destroy*(a1: var Tposix_spawnattr): cint {. importc, header: "<spawn.h>".} - proc posix_spawnattr_getsigdefault*(a1: var tposix_spawnattr, + proc posix_spawnattr_getsigdefault*(a1: var Tposix_spawnattr, a2: var Tsigset): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_getflags*(a1: var tposix_spawnattr, + proc posix_spawnattr_getflags*(a1: var Tposix_spawnattr, a2: var cshort): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_getpgroup*(a1: var tposix_spawnattr, - a2: var tpid): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_getschedparam*(a1: var tposix_spawnattr, - a2: var tsched_param): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_getschedpolicy*(a1: var tposix_spawnattr, + proc posix_spawnattr_getpgroup*(a1: var Tposix_spawnattr, + a2: var TPid): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getschedparam*(a1: var Tposix_spawnattr, + a2: var Tsched_param): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_getschedpolicy*(a1: var Tposix_spawnattr, a2: var cint): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_getsigmask*(a1: var tposix_spawnattr, - a2: var tsigset): cint {.importc, header: "<spawn.h>".} - - proc posix_spawnattr_init*(a1: var tposix_spawnattr): cint {. + proc posix_spawnattr_getsigmask*(a1: var Tposix_spawnattr, + a2: var Tsigset): cint {.importc, header: "<spawn.h>".} + + proc posix_spawnattr_init*(a1: var Tposix_spawnattr): cint {. importc, header: "<spawn.h>".} - proc posix_spawnattr_setsigdefault*(a1: var tposix_spawnattr, - a2: var tsigset): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_setflags*(a1: var tposix_spawnattr, a2: cint): cint {. + proc posix_spawnattr_setsigdefault*(a1: var Tposix_spawnattr, + a2: var Tsigset): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setflags*(a1: var Tposix_spawnattr, a2: cint): cint {. importc, header: "<spawn.h>".} - proc posix_spawnattr_setpgroup*(a1: var tposix_spawnattr, a2: tpid): cint {. + proc posix_spawnattr_setpgroup*(a1: var Tposix_spawnattr, a2: TPid): cint {. importc, header: "<spawn.h>".} - - proc posix_spawnattr_setschedparam*(a1: var tposix_spawnattr, - a2: var tsched_param): cint {.importc, header: "<spawn.h>".} - proc posix_spawnattr_setschedpolicy*(a1: var tposix_spawnattr, + + proc posix_spawnattr_setschedparam*(a1: var Tposix_spawnattr, + a2: var Tsched_param): cint {.importc, header: "<spawn.h>".} + proc posix_spawnattr_setschedpolicy*(a1: var Tposix_spawnattr, a2: cint): cint {. importc, header: "<spawn.h>".} - proc posix_spawnattr_setsigmask*(a1: var tposix_spawnattr, - a2: var tsigset): cint {.importc, header: "<spawn.h>".} - proc posix_spawnp*(a1: var tpid, a2: cstring, - a3: var tposix_spawn_file_actions, - a4: var tposix_spawnattr, + proc posix_spawnattr_setsigmask*(a1: var Tposix_spawnattr, + a2: var Tsigset): cint {.importc, header: "<spawn.h>".} + proc posix_spawnp*(a1: var TPid, a2: cstring, + a3: var Tposix_spawn_file_actions, + a4: var Tposix_spawnattr, a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} proc getcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".} @@ -2424,10 +2425,10 @@ proc writev*(a1: cint, a2: ptr TIOVec, a3: cint): int {. proc CMSG_DATA*(cmsg: ptr Tcmsghdr): cstring {. importc, header: "<sys/socket.h>".} -proc CMSG_NXTHDR*(mhdr: ptr TMsgHdr, cmsg: ptr TCMsgHdr): ptr TCmsgHdr {. +proc CMSG_NXTHDR*(mhdr: ptr Tmsghdr, cmsg: ptr Tcmsghdr): ptr Tcmsghdr {. importc, header: "<sys/socket.h>".} -proc CMSG_FIRSTHDR*(mhdr: ptr TMsgHdr): ptr TCMsgHdr {. +proc CMSG_FIRSTHDR*(mhdr: ptr Tmsghdr): ptr Tcmsghdr {. importc, header: "<sys/socket.h>".} const @@ -2435,21 +2436,21 @@ const proc `==`*(x, y: TSocketHandle): bool {.borrow.} -proc accept*(a1: TSocketHandle, a2: ptr Tsockaddr, a3: ptr Tsocklen): TSocketHandle {. +proc accept*(a1: TSocketHandle, a2: ptr TSockAddr, a3: ptr TSocklen): TSocketHandle {. importc, header: "<sys/socket.h>".} -proc bindSocket*(a1: TSocketHandle, a2: ptr Tsockaddr, a3: Tsocklen): cint {. +proc bindSocket*(a1: TSocketHandle, a2: ptr TSockAddr, a3: TSocklen): cint {. importc: "bind", header: "<sys/socket.h>".} ## is Posix's ``bind``, because ``bind`` is a reserved word - -proc connect*(a1: TSocketHandle, a2: ptr Tsockaddr, a3: Tsocklen): cint {. + +proc connect*(a1: TSocketHandle, a2: ptr TSockAddr, a3: TSocklen): cint {. importc, header: "<sys/socket.h>".} -proc getpeername*(a1: TSocketHandle, a2: ptr Tsockaddr, a3: ptr Tsocklen): cint {. +proc getpeername*(a1: TSocketHandle, a2: ptr TSockAddr, a3: ptr TSocklen): cint {. importc, header: "<sys/socket.h>".} -proc getsockname*(a1: TSocketHandle, a2: ptr Tsockaddr, a3: ptr Tsocklen): cint {. +proc getsockname*(a1: TSocketHandle, a2: ptr TSockAddr, a3: ptr TSocklen): cint {. importc, header: "<sys/socket.h>".} -proc getsockopt*(a1: TSocketHandle, a2, a3: cint, a4: pointer, a5: ptr Tsocklen): cint {. +proc getsockopt*(a1: TSocketHandle, a2, a3: cint, a4: pointer, a5: ptr TSocklen): cint {. importc, header: "<sys/socket.h>".} proc listen*(a1: TSocketHandle, a2: cint): cint {. @@ -2457,7 +2458,7 @@ proc listen*(a1: TSocketHandle, a2: cint): cint {. proc recv*(a1: TSocketHandle, a2: pointer, a3: int, a4: cint): int {. importc, header: "<sys/socket.h>".} proc recvfrom*(a1: TSocketHandle, a2: pointer, a3: int, a4: cint, - a5: ptr Tsockaddr, a6: ptr Tsocklen): int {. + a5: ptr TSockAddr, a6: ptr TSocklen): int {. importc, header: "<sys/socket.h>".} proc recvmsg*(a1: TSocketHandle, a2: ptr Tmsghdr, a3: cint): int {. importc, header: "<sys/socket.h>".} @@ -2465,10 +2466,10 @@ proc send*(a1: TSocketHandle, a2: pointer, a3: int, a4: cint): int {. importc, header: "<sys/socket.h>".} proc sendmsg*(a1: TSocketHandle, a2: ptr Tmsghdr, a3: cint): int {. importc, header: "<sys/socket.h>".} -proc sendto*(a1: TSocketHandle, a2: pointer, a3: int, a4: cint, a5: ptr Tsockaddr, - a6: Tsocklen): int {. +proc sendto*(a1: TSocketHandle, a2: pointer, a3: int, a4: cint, a5: ptr TSockAddr, + a6: TSocklen): int {. importc, header: "<sys/socket.h>".} -proc setsockopt*(a1: TSocketHandle, a2, a3: cint, a4: pointer, a5: Tsocklen): cint {. +proc setsockopt*(a1: TSocketHandle, a2, a3: cint, a4: pointer, a5: TSocklen): cint {. importc, header: "<sys/socket.h>".} proc shutdown*(a1: TSocketHandle, a2: cint): cint {. importc, header: "<sys/socket.h>".} @@ -2530,21 +2531,21 @@ proc freeaddrinfo*(a1: ptr Taddrinfo) {.importc, header: "<netdb.h>".} proc gai_strerror*(a1: cint): cstring {.importc, header: "<netdb.h>".} -proc getaddrinfo*(a1, a2: cstring, a3: ptr TAddrInfo, - a4: var ptr TAddrInfo): cint {.importc, header: "<netdb.h>".} - -proc gethostbyaddr*(a1: pointer, a2: Tsocklen, a3: cint): ptr THostent {. +proc getaddrinfo*(a1, a2: cstring, a3: ptr Taddrinfo, + a4: var ptr Taddrinfo): cint {.importc, header: "<netdb.h>".} + +proc gethostbyaddr*(a1: pointer, a2: TSocklen, a3: cint): ptr Thostent {. importc, header: "<netdb.h>".} -proc gethostbyname*(a1: cstring): ptr THostent {.importc, header: "<netdb.h>".} -proc gethostent*(): ptr THostent {.importc, header: "<netdb.h>".} +proc gethostbyname*(a1: cstring): ptr Thostent {.importc, header: "<netdb.h>".} +proc gethostent*(): ptr Thostent {.importc, header: "<netdb.h>".} -proc getnameinfo*(a1: ptr Tsockaddr, a2: Tsocklen, - a3: cstring, a4: Tsocklen, a5: cstring, - a6: Tsocklen, a7: cint): cint {.importc, header: "<netdb.h>".} +proc getnameinfo*(a1: ptr TSockAddr, a2: TSocklen, + a3: cstring, a4: TSocklen, a5: cstring, + a6: TSocklen, a7: cint): cint {.importc, header: "<netdb.h>".} -proc getnetbyaddr*(a1: int32, a2: cint): ptr TNetent {.importc, header: "<netdb.h>".} -proc getnetbyname*(a1: cstring): ptr TNetent {.importc, header: "<netdb.h>".} -proc getnetent*(): ptr TNetent {.importc, header: "<netdb.h>".} +proc getnetbyaddr*(a1: int32, a2: cint): ptr Tnetent {.importc, header: "<netdb.h>".} +proc getnetbyname*(a1: cstring): ptr Tnetent {.importc, header: "<netdb.h>".} +proc getnetent*(): ptr Tnetent {.importc, header: "<netdb.h>".} proc getprotobyname*(a1: cstring): ptr TProtoent {.importc, header: "<netdb.h>".} proc getprotobynumber*(a1: cint): ptr TProtoent {.importc, header: "<netdb.h>".} @@ -2560,10 +2561,20 @@ proc setnetent*(a1: cint) {.importc, header: "<netdb.h>".} proc setprotoent*(a1: cint) {.importc, header: "<netdb.h>".} proc setservent*(a1: cint) {.importc, header: "<netdb.h>".} -proc poll*(a1: ptr Tpollfd, a2: Tnfds, a3: int): cint {. +proc poll*(a1: ptr TPollfd, a2: Tnfds, a3: int): cint {. importc, header: "<poll.h>".} -proc realpath*(name, resolved: CString): CString {. +proc realpath*(name, resolved: cstring): cstring {. importc: "realpath", header: "<stdlib.h>".} - +proc utimes*(path: cstring, times: ptr array [2, Ttimeval]): int {. + importc: "utimes", header: "<sys/time.h>".} + ## Sets file access and modification times. + ## + ## Pass the filename and an array of times to set the access and modification + ## times respectively. If you pass nil as the array both attributes will be + ## set to the current time. + ## + ## Returns zero on success. + ## + ## For more information read http://www.unix.com/man-page/posix/3/utimes/. diff --git a/lib/pure/actors.cfg b/lib/pure/actors.nimrod.cfg index c6bb9c545..c6bb9c545 100644 --- a/lib/pure/actors.cfg +++ b/lib/pure/actors.nimrod.cfg diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index 8b44e69d9..921c659de 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -34,7 +34,7 @@ proc reverse*[T](a: var openArray[T]) = ## reverses the array `a`. reverse(a, 0, a.high) -proc binarySearch*[T](a: openarray[T], key: T): int = +proc binarySearch*[T](a: openArray[T], key: T): int = ## binary search for `key` in `a`. Returns -1 if not found. var b = len(a) while result < b: @@ -79,7 +79,7 @@ proc merge[T](a, b: var openArray[T], lo, m, hi: int, inc(bb) inc(j) else: - CopyMem(addr(b[0]), addr(a[j]), sizeof(T)*(m-j+1)) + copyMem(addr(b[0]), addr(a[j]), sizeof(T)*(m-j+1)) j = m+1 var i = 0 var k = lo @@ -131,3 +131,36 @@ proc sort*[T](a: var openArray[T], dec(m, s*2) s = s*2 +proc product*[T](x: openarray[seq[T]]): seq[seq[T]] = + ## produces the Cartesian product of the array. Warning: complexity + ## may explode. + result = @[] + if x.len == 0: + return + if x.len == 1: + result = @x + return + var + indexes = newSeq[int](x.len) + initial = newSeq[int](x.len) + index = 0 + # replace with newSeq as soon as #853 is fixed + var next: seq[T] = @[] + next.setLen(x.len) + for i in 0..(x.len-1): + if len(x[i]) == 0: return + initial[i] = len(x[i])-1 + indexes = initial + while true: + while indexes[index] == -1: + indexes[index] = initial[index] + index +=1 + if index == x.len: return + indexes[index] -=1 + for ni, i in indexes: + next[ni] = x[ni][i] + var res: seq[T] + shallowCopy(res, next) + result.add(res) + index = 0 + indexes[index] -=1 diff --git a/lib/pure/asyncio.nim b/lib/pure/asyncio.nim index c4a07d751..96afc6f4f 100644 --- a/lib/pure/asyncio.nim +++ b/lib/pure/asyncio.nim @@ -139,27 +139,27 @@ type proc newDelegate*(): PDelegate = ## Creates a new delegate. new(result) - result.handleRead = (proc (h: PObject) = nil) - result.handleWrite = (proc (h: PObject) = nil) - result.handleError = (proc (h: PObject) = nil) + result.handleRead = (proc (h: PObject) = discard) + result.handleWrite = (proc (h: PObject) = discard) + result.handleError = (proc (h: PObject) = discard) result.hasDataBuffered = (proc (h: PObject): bool = return false) - result.task = (proc (h: PObject) = nil) + result.task = (proc (h: PObject) = discard) result.mode = fmRead proc newAsyncSocket(): PAsyncSocket = new(result) result.info = SockIdle - result.handleRead = (proc (s: PAsyncSocket) = nil) + result.handleRead = (proc (s: PAsyncSocket) = discard) result.handleWrite = nil - result.handleConnect = (proc (s: PAsyncSocket) = nil) - result.handleAccept = (proc (s: PAsyncSocket) = nil) - result.handleTask = (proc (s: PAsyncSocket) = nil) + result.handleConnect = (proc (s: PAsyncSocket) = discard) + result.handleAccept = (proc (s: PAsyncSocket) = discard) + result.handleTask = (proc (s: PAsyncSocket) = discard) result.lineBuffer = "".TaintedString result.sendBuffer = "" -proc AsyncSocket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, +proc asyncSocket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, protocol: TProtocol = IPPROTO_TCP, buffered = true): PAsyncSocket = ## Initialises an AsyncSocket object. If a socket cannot be initialised @@ -233,8 +233,11 @@ proc asyncSockHandleWrite(h: PObject) = let sock = PAsyncSocket(h) try: let bytesSent = sock.socket.sendAsync(sock.sendBuffer) - assert bytesSent > 0 - if bytesSent != sock.sendBuffer.len: + if bytesSent == 0: + # Apparently the socket cannot be written to. Even though select + # just told us that it can be... This used to be an assert. Just + # do nothing instead. + elif bytesSent != sock.sendBuffer.len: sock.sendBuffer = sock.sendBuffer[bytesSent .. -1] elif bytesSent == sock.sendBuffer.len: sock.sendBuffer = "" @@ -686,5 +689,5 @@ when isMainModule: server.listen() d.register(server) - while d.poll(-1): nil + while d.poll(-1): discard diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim index 685313551..4e59a6ca6 100644 --- a/lib/pure/base64.nim +++ b/lib/pure/base64.nim @@ -1,117 +1,127 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2010 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module implements a base64 encoder and decoder. - -const - cb64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" - -proc encode*(s: string, lineLen = 75, newLine="\13\10"): string = - ## encodes `s` into base64 representation. After `lineLen` characters, a - ## `newline` is added. - var total = ((len(s) + 2) div 3) * 4 - var numLines = (total + lineLen - 1) div lineLen +# +# +# Nimrod's Runtime Library +# (c) Copyright 2010 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This module implements a base64 encoder and decoder. + +const + cb64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + +template encodeInternal(s: expr, lineLen: int, newLine: string): stmt {.immediate.} = + ## encodes `s` into base64 representation. After `lineLen` characters, a + ## `newline` is added. + var total = ((len(s) + 2) div 3) * 4 + var numLines = (total + lineLen - 1) div lineLen if numLines > 0: inc(total, (numLines-1) * newLine.len) - - result = newString(total) - var i = 0 - var r = 0 - var currLine = 0 - while i < s.len - 2: - var a = ord(s[i]) - var b = ord(s[i+1]) - var c = ord(s[i+2]) - result[r] = cb64[a shr 2] - result[r+1] = cb64[((a and 3) shl 4) or ((b and 0xF0) shr 4)] - result[r+2] = cb64[((b and 0x0F) shl 2) or ((c and 0xC0) shr 6)] - result[r+3] = cb64[c and 0x3F] - inc(r, 4) - inc(i, 3) - inc(currLine, 4) - if currLine >= lineLen and i != s.len-2: - for x in items(newLine): - result[r] = x - inc(r) - currLine = 0 - - if i < s.len-1: - var a = ord(s[i]) - var b = ord(s[i+1]) - result[r] = cb64[a shr 2] - result[r+1] = cb64[((a and 3) shl 4) or ((b and 0xF0) shr 4)] - result[r+2] = cb64[((b and 0x0F) shl 2)] - result[r+3] = '=' - if r+4 != result.len: - setLen(result, r+4) - elif i < s.len: - var a = ord(s[i]) - result[r] = cb64[a shr 2] - result[r+1] = cb64[(a and 3) shl 4] - result[r+2] = '=' - result[r+3] = '=' - if r+4 != result.len: - setLen(result, r+4) - else: - assert(r == result.len) - -proc decodeByte(b: char): int {.inline.} = - case b - of '+': result = ord('>') - of '0'..'9': result = ord(b) + 4 - of 'A'..'Z': result = ord(b) - ord('A') - of 'a'..'z': result = ord(b) - 71 - else: result = 63 - -proc decode*(s: string): string = - ## decodes a string in base64 representation back into its original form. - ## Whitespace is skipped. - const Whitespace = {' ', '\t', '\v', '\r', '\l', '\f'} - var total = ((len(s) + 3) div 4) * 3 - # total is an upper bound, as we will skip arbitrary whitespace: - result = newString(total) - - var i = 0 - var r = 0 - while true: - while s[i] in Whitespace: inc(i) - if i < s.len-3: - var a = s[i].decodeByte - var b = s[i+1].decodeByte - var c = s[i+2].decodeByte - var d = s[i+3].decodeByte - - result[r] = chr((a shl 2) and 0xff or ((b shr 4) and 0x03)) - result[r+1] = chr((b shl 4) and 0xff or ((c shr 2) and 0x0F)) - result[r+2] = chr((c shl 6) and 0xff or (d and 0x3F)) - inc(r, 3) - inc(i, 4) - else: break - assert i == s.len - # adjust the length: - if i > 0 and s[i-1] == '=': - dec(r) - if i > 1 and s[i-2] == '=': dec(r) - setLen(result, r) - -when isMainModule: - assert encode("leasure.") == "bGVhc3VyZS4=" - assert encode("easure.") == "ZWFzdXJlLg==" - assert encode("asure.") == "YXN1cmUu" - assert encode("sure.") == "c3VyZS4=" - - const longText = """Man is distinguished, not only by his reason, but by this - singular passion from other animals, which is a lust of the mind, - that by a perseverance of delight in the continued and indefatigable - generation of knowledge, exceeds the short vehemence of any carnal - pleasure.""" - const tests = ["", "abc", "xyz", "man", "leasure.", "sure.", "easure.", - "asure.", longText] - for t in items(tests): - assert decode(encode(t)) == t - + + result = newString(total) + var i = 0 + var r = 0 + var currLine = 0 + while i < s.len - 2: + var a = ord(s[i]) + var b = ord(s[i+1]) + var c = ord(s[i+2]) + result[r] = cb64[a shr 2] + result[r+1] = cb64[((a and 3) shl 4) or ((b and 0xF0) shr 4)] + result[r+2] = cb64[((b and 0x0F) shl 2) or ((c and 0xC0) shr 6)] + result[r+3] = cb64[c and 0x3F] + inc(r, 4) + inc(i, 3) + inc(currLine, 4) + if currLine >= lineLen and i != s.len-2: + for x in items(newLine): + result[r] = x + inc(r) + currLine = 0 + + if i < s.len-1: + var a = ord(s[i]) + var b = ord(s[i+1]) + result[r] = cb64[a shr 2] + result[r+1] = cb64[((a and 3) shl 4) or ((b and 0xF0) shr 4)] + result[r+2] = cb64[((b and 0x0F) shl 2)] + result[r+3] = '=' + if r+4 != result.len: + setLen(result, r+4) + elif i < s.len: + var a = ord(s[i]) + result[r] = cb64[a shr 2] + result[r+1] = cb64[(a and 3) shl 4] + result[r+2] = '=' + result[r+3] = '=' + if r+4 != result.len: + setLen(result, r+4) + else: + assert(r == result.len) + +proc encode*[T:TInteger|char](s: openarray[T], lineLen = 75, newLine="\13\10"): string = + ## encodes `s` into base64 representation. After `lineLen` characters, a + ## `newline` is added. + encodeInternal(s, lineLen, newLine) + +proc encode*(s: string, lineLen = 75, newLine="\13\10"): string = + ## encodes `s` into base64 representation. After `lineLen` characters, a + ## `newline` is added. + encodeInternal(s, lineLen, newLine) + +proc decodeByte(b: char): int {.inline.} = + case b + of '+': result = ord('>') + of '0'..'9': result = ord(b) + 4 + of 'A'..'Z': result = ord(b) - ord('A') + of 'a'..'z': result = ord(b) - 71 + else: result = 63 + +proc decode*(s: string): string = + ## decodes a string in base64 representation back into its original form. + ## Whitespace is skipped. + const Whitespace = {' ', '\t', '\v', '\r', '\l', '\f'} + var total = ((len(s) + 3) div 4) * 3 + # total is an upper bound, as we will skip arbitrary whitespace: + result = newString(total) + + var i = 0 + var r = 0 + while true: + while s[i] in Whitespace: inc(i) + if i < s.len-3: + var a = s[i].decodeByte + var b = s[i+1].decodeByte + var c = s[i+2].decodeByte + var d = s[i+3].decodeByte + + result[r] = chr((a shl 2) and 0xff or ((b shr 4) and 0x03)) + result[r+1] = chr((b shl 4) and 0xff or ((c shr 2) and 0x0F)) + result[r+2] = chr((c shl 6) and 0xff or (d and 0x3F)) + inc(r, 3) + inc(i, 4) + else: break + assert i == s.len + # adjust the length: + if i > 0 and s[i-1] == '=': + dec(r) + if i > 1 and s[i-2] == '=': dec(r) + setLen(result, r) + +when isMainModule: + assert encode("leasure.") == "bGVhc3VyZS4=" + assert encode("easure.") == "ZWFzdXJlLg==" + assert encode("asure.") == "YXN1cmUu" + assert encode("sure.") == "c3VyZS4=" + + const longText = """Man is distinguished, not only by his reason, but by this + singular passion from other animals, which is a lust of the mind, + that by a perseverance of delight in the continued and indefatigable + generation of knowledge, exceeds the short vehemence of any carnal + pleasure.""" + const tests = ["", "abc", "xyz", "man", "leasure.", "sure.", "easure.", + "asure.", longText] + for t in items(tests): + assert decode(encode(t)) == t + diff --git a/lib/pure/browsers.nim b/lib/pure/browsers.nim index 6f5bf7ddb..3a8429f81 100644 --- a/lib/pure/browsers.nim +++ b/lib/pure/browsers.nim @@ -29,14 +29,14 @@ proc openDefaultBrowser*(url: string) = when useWinUnicode: var o = newWideCString("open") var u = newWideCString(url) - discard ShellExecuteW(0'i32, o, u, nil, nil, SW_SHOWNORMAL) + discard shellExecuteW(0'i32, o, u, nil, nil, SW_SHOWNORMAL) else: - discard ShellExecuteA(0'i32, "open", url, nil, nil, SW_SHOWNORMAL) + discard shellExecuteA(0'i32, "open", url, nil, nil, SW_SHOWNORMAL) elif defined(macosx): - discard execShellCmd("open " & quoteIfContainsWhite(url)) + discard execShellCmd("open " & quoteShell(url)) else: const attempts = ["gnome-open ", "kde-open ", "xdg-open "] - var u = quoteIfContainsWhite(url) + var u = quoteShell(url) for a in items(attempts): if execShellCmd(a & u) == 0: return for b in getEnv("BROWSER").string.split(PathSep): @@ -45,4 +45,4 @@ proc openDefaultBrowser*(url: string) = discard startProcess(command=b, args=[url], options={poUseShell}) return except EOS: - nil + discard diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim index c499abdc0..29c686fd7 100644 --- a/lib/pure/cgi.nim +++ b/lib/pure/cgi.nim @@ -342,16 +342,35 @@ proc writeContentType*() = ## ## .. code-block:: Nimrod ## write(stdout, "Content-type: text/html\n\n") - ## - ## It also modifies the debug stack traces so that they contain - ## ``<br />`` and are easily readable in a browser. write(stdout, "Content-type: text/html\n\n") - system.stackTraceNewLine = "<br />\n" -proc setStackTraceNewLine*() = - ## Modifies the debug stack traces so that they contain - ## ``<br />`` and are easily readable in a browser. - system.stackTraceNewLine = "<br />\n" +proc resetForStacktrace() = + stdout.write """<!--: spam +Content-Type: text/html + +<body bgcolor=#f0f0f8><font color=#f0f0f8 size=-5> --> +<body bgcolor=#f0f0f8><font color=#f0f0f8 size=-5> --> --> +</font> </font> </font> </script> </object> </blockquote> </pre> +</table> </table> </table> </table> </table> </font> </font> </font> +""" + +proc writeErrorMessage*(data: string) = + ## Tries to reset browser state and writes `data` to stdout in + ## <plaintext> tag. + resetForStacktrace() + # We use <plaintext> here, instead of escaping, so stacktrace can + # be understood by human looking at source. + stdout.write("<plaintext>\n") + stdout.write(data) + +proc setStackTraceStdout*() = + ## Makes Nimrod output stacktraces to stdout, instead of server log. + errorMessageWriter = writeErrorMessage + +proc setStackTraceNewLine*() {.deprecated.} = + ## Makes Nimrod output stacktraces to stdout, instead of server log. + ## Depracated alias for setStackTraceStdout. + setStackTraceStdout() proc setCookie*(name, value: string) = ## Sets a cookie. @@ -374,4 +393,3 @@ when isMainModule: const test1 = "abc\L+def xyz" assert UrlEncode(test1) == "abc%0A%2Bdef+xyz" assert UrlDecode(UrlEncode(test1)) == test1 - diff --git a/lib/pure/collections/LockFreeHash.nim b/lib/pure/collections/LockFreeHash.nim new file mode 100644 index 000000000..b94b542ff --- /dev/null +++ b/lib/pure/collections/LockFreeHash.nim @@ -0,0 +1,582 @@ +#nimrod c -t:-march=i686 --cpu:amd64 --threads:on -d:release lockfreehash.nim + +import baseutils, unsigned, math, hashes + + + +const + minTableSize = 8 + reProbeLimit = 12 + minCopyWork = 4096 + intSize = sizeof(int) + + + +when sizeof(int) == 4: # 32bit + type + TRaw = range[0..1073741823] + ## The range of uint values that can be stored directly in a value slot + ## when on a 32 bit platform + +elif sizeof(int) == 8: # 64bit + type + TRaw = range[0..4611686018427387903] + ## The range of uint values that can be stored directly in a value slot + ## when on a 64 bit platform +else: + {.error: "unsupported platform".} + +type + TEntry = tuple + key: int + value: int + + TEntryArr = ptr array[0..10_000_000, TEntry] + + PConcTable[K,V] = ptr object {.pure.} + len: int + used: int + active: int + copyIdx: int + copyDone: int + next: PConcTable[K,V] + data: TEntryArr + + +proc setVal[K,V](table: var PConcTable[K,V], key: int, val: int, + expVal: int, match: bool): int + +#------------------------------------------------------------------------------ + +# Create a new table +proc newLFTable*[K,V](size: int = minTableSize): PConcTable[K,V] = + let + dataLen = max(nextPowerOfTwo(size), minTableSize) + dataSize = dataLen*sizeof(TEntry) + dataMem = allocShared0(dataSize) + tableSize = 7 * intSize + tableMem = allocShared0(tableSize) + table = cast[PConcTable[K,V]](tableMem) + table.len = dataLen + table.used = 0 + table.active = 0 + table.copyIdx = 0 + table.copyDone = 0 + table.next = nil + table.data = cast[TEntryArr](dataMem) + result = table + +#------------------------------------------------------------------------------ + +# Delete a table +proc deleteConcTable[K,V](tbl: PConcTable[K,V]) = + deallocShared(tbl.data) + deallocShared(tbl) + +#------------------------------------------------------------------------------ + +proc `[]`[K,V](table: var PConcTable[K,V], i: int): var TEntry {.inline.} = + table.data[i] + +#------------------------------------------------------------------------------ +# State flags stored in ptr + + +proc pack[T](x: T): int {.inline.} = + result = (cast[int](x) shl 2) + #echo("packKey ",cast[int](x) , " -> ", result) + +# Pop the flags off returning a 4 byte aligned ptr to our Key or Val +proc pop(x: int): int {.inline.} = + result = x and 0xFFFFFFFC'i32 + +# Pop the raw value off of our Key or Val +proc popRaw(x: int): int {.inline.} = + result = x shr 2 + +# Pop the flags off returning a 4 byte aligned ptr to our Key or Val +proc popPtr[V](x: int): ptr V {.inline.} = + result = cast[ptr V](pop(x)) + #echo("popPtr " & $x & " -> " & $cast[int](result)) + +# Ghost (sentinel) +# K or V is no longer valid use new table +const Ghost = 0xFFFFFFFC +proc isGhost(x: int): bool {.inline.} = + result = x == 0xFFFFFFFC + +# Tombstone +# applied to V = K is dead +proc isTomb(x: int): bool {.inline.} = + result = (x and 0x00000002) != 0 + +proc setTomb(x: int): int {.inline.} = + result = x or 0x00000002 + +# Prime +# K or V is in new table copied from old +proc isPrime(x: int): bool {.inline.} = + result = (x and 0x00000001) != 0 + +proc setPrime(x: int): int {.inline.} = + result = x or 0x00000001 + +#------------------------------------------------------------------------------ + +##This is for i32 only need to override for i64 +proc hashInt(x: int):int {.inline.} = + var h = uint32(x) #shr 2'u32 + h = h xor (h shr 16'u32) + h *= 0x85ebca6b'u32 + h = h xor (h shr 13'u32) + h *= 0xc2b2ae35'u32 + h = h xor (h shr 16'u32) + result = int(h) + +#------------------------------------------------------------------------------ + +proc resize[K,V](self: PConcTable[K,V]): PConcTable[K,V] = + var next = atomic_load_n(self.next.addr, ATOMIC_RELAXED) + #echo("next = " & $cast[int](next)) + if next != nil: + #echo("A new table already exists, copy in progress") + return next + var + oldLen = atomic_load_n(self.len.addr, ATOMIC_RELAXED) + newTable = newLFTable[K,V](oldLen*2) + success = atomic_compare_exchange_n(self.next.addr, next.addr, newTable, + false, ATOMIC_RELAXED, ATOMIC_RELAXED) + if not success: + echo("someone beat us to it! delete table we just created and return his " & $cast[int](next)) + deleteConcTable(newTable) + return next + else: + echo("Created New Table! " & $cast[int](newTable) & " Size = " & $newTable.len) + return newTable + + +#------------------------------------------------------------------------------ +#proc keyEQ[K](key1: ptr K, key2: ptr K): bool {.inline.} = +proc keyEQ[K](key1: int, key2: int): bool {.inline.} = + result = false + when K is TRaw: + if key1 == key2: + result = true + else: + var + p1 = popPtr[K](key1) + p2 = popPtr[K](key2) + if p1 != nil and p2 != nil: + if cast[int](p1) == cast[int](p2): + return true + if p1[] == p2[]: + return true + +#------------------------------------------------------------------------------ + +#proc tableFull(self: var PConcTable[K,V]) : bool {.inline.} = + + +#------------------------------------------------------------------------------ + +proc copySlot[K,V](idx: int, oldTbl: var PConcTable[K,V], newTbl: var PConcTable[K,V]): bool = + #echo("Copy idx " & $idx) + var + oldVal = 0 + oldkey = 0 + ok = false + result = false + #Block the key so no other threads waste time here + while not ok: + ok = atomic_compare_exchange_n(oldTbl[idx].key.addr, oldKey.addr, + setTomb(oldKey), false, ATOMIC_RELAXED, ATOMIC_RELAXED) + #echo("oldKey was = " & $oldKey & " set it to tomb " & $setTomb(oldKey)) + #Prevent new values from appearing in the old table by priming + oldVal = atomic_load_n(oldTbl[idx].value.addr, ATOMIC_RELAXED) + while not isPrime(oldVal): + var box = if oldVal == NULL or isTomb(oldVal) : oldVal.setTomb.setPrime + else: oldVal.setPrime + if atomic_compare_exchange_n(oldTbl[idx].value.addr, oldVal.addr, + box, false, ATOMIC_RELAXED, ATOMIC_RELAXED): + if isPrime(box) and isTomb(box): + return true + oldVal = box + break + #echo("oldVal was = ", oldVal, " set it to prime ", box) + if isPrime(oldVal) and isTomb(oldVal): + #when not (K is TRaw): + # deallocShared(popPtr[K](oldKey)) + return false + if isTomb(oldVal): + echo("oldVal is Tomb!!!, should not happen") + if pop(oldVal) != NULL: + result = setVal(newTbl, pop(oldKey), pop(oldVal), NULL, true) == NULL + if result: + #echo("Copied a Slot! idx= " & $idx & " key= " & $oldKey & " val= " & $oldVal) + else: + #echo("copy slot failed") + # Our copy is done so we disable the old slot + while not ok: + ok = atomic_compare_exchange_n(oldTbl[idx].value.addr, oldVal.addr, + oldVal.setTomb.setPrime , false, ATOMIC_RELAXED, ATOMIC_RELAXED) + #echo("disabled old slot") + #echo"---------------------" + +#------------------------------------------------------------------------------ + +proc promote[K,V](table: var PConcTable[K,V]) = + var + newData = atomic_load_n(table.next.data.addr, ATOMIC_RELAXED) + newLen = atomic_load_n(table.next.len.addr, ATOMIC_RELAXED) + newUsed = atomic_load_n(table.next.used.addr, ATOMIC_RELAXED) + + deallocShared(table.data) + atomic_store_n(table.data.addr, newData, ATOMIC_RELAXED) + atomic_store_n(table.len.addr, newLen, ATOMIC_RELAXED) + atomic_store_n(table.used.addr, newUsed, ATOMIC_RELAXED) + atomic_store_n(table.copyIdx.addr, 0, ATOMIC_RELAXED) + atomic_store_n(table.copyDone.addr, 0, ATOMIC_RELAXED) + deallocShared(table.next) + atomic_store_n(table.next.addr, nil, ATOMIC_RELAXED) + echo("new table swapped!") + +#------------------------------------------------------------------------------ + +proc checkAndPromote[K,V](table: var PConcTable[K,V], workDone: int): bool = + var + oldLen = atomic_load_n(table.len.addr, ATOMIC_RELAXED) + copyDone = atomic_load_n(table.copyDone.addr, ATOMIC_RELAXED) + ok: bool + result = false + if workDone > 0: + #echo("len to copy =" & $oldLen) + #echo("copyDone + workDone = " & $copyDone & " + " & $workDone) + while not ok: + ok = atomic_compare_exchange_n(table.copyDone.addr, copyDone.addr, + copyDone + workDone, false, ATOMIC_RELAXED, ATOMIC_RELAXED) + #if ok: echo("set copyDone") + # If the copy is done we can promote this table + if copyDone + workDone >= oldLen: + # Swap new data + #echo("work is done!") + table.promote + result = true + +#------------------------------------------------------------------------------ + +proc copySlotAndCheck[K,V](table: var PConcTable[K,V], idx: int): + PConcTable[K,V] = + var + newTable = cast[PConcTable[K,V]](atomic_load_n(table.next.addr, ATOMIC_RELAXED)) + result = newTable + if newTable != nil and copySlot(idx, table, newTable): + #echo("copied a single slot, idx = " & $idx) + if checkAndPromote(table, 1): return table + + +#------------------------------------------------------------------------------ + +proc helpCopy[K,V](table: var PConcTable[K,V]): PConcTable[K,V] = + var + newTable = cast[PConcTable[K,V]](atomic_load_n(table.next.addr, ATOMIC_RELAXED)) + result = newTable + if newTable != nil: + var + oldLen = atomic_load_n(table.len.addr, ATOMIC_RELAXED) + copyDone = atomic_load_n(table.copyDone.addr, ATOMIC_RELAXED) + copyIdx = 0 + work = min(oldLen, minCopyWork) + #panicStart = -1 + workDone = 0 + if copyDone < oldLen: + var ok: bool + while not ok: + ok = atomic_compare_exchange_n(table.copyIdx.addr, copyIdx.addr, + copyIdx + work, false, ATOMIC_RELAXED, ATOMIC_RELAXED) + #echo("copy idx = ", copyIdx) + for i in 0..work-1: + var idx = (copyIdx + i) and (oldLen - 1) + if copySlot(idx, table, newTable): + workDone += 1 + if workDone > 0: + #echo("did work ", workDone, " on thread ", cast[int](myThreadID[pointer]())) + if checkAndPromote(table, workDone): return table + # In case a thread finished all the work then got stalled before promotion + if checkAndPromote(table, 0): return table + + + +#------------------------------------------------------------------------------ + +proc setVal[K,V](table: var PConcTable[K,V], key: int, val: int, + expVal: int, match: bool): int = + #echo("-try set- in table ", " key = ", (popPtr[K](key)[]), " val = ", val) + when K is TRaw: + var idx = hashInt(key) + else: + var idx = popPtr[K](key)[].hash + var + nextTable: PConcTable[K,V] + probes = 1 + # spin until we find a key slot or build and jump to next table + while true: + idx = idx and (table.len - 1) + #echo("try set idx = " & $idx & "for" & $key) + var + probedKey = NULL + openKey = atomic_compare_exchange_n(table[idx].key.addr, probedKey.addr, + key, false, ATOMIC_RELAXED, ATOMIC_RELAXED) + if openKey: + if val.isTomb: + #echo("val was tomb, bail, no reason to set an open slot to tomb") + return val + #increment used slots + #echo("found an open slot, total used = " & + #$atomic_add_fetch(table.used.addr, 1, ATOMIC_RELAXED)) + discard atomic_add_fetch(table.used.addr, 1, ATOMIC_RELAXED) + break # We found an open slot + #echo("set idx ", idx, " key = ", key, " probed = ", probedKey) + if keyEQ[K](probedKey, key): + #echo("we found the matching slot") + break # We found a matching slot + if (not(expVal != NULL and match)) and (probes >= reProbeLimit or key.isTomb): + if key.isTomb: echo("Key is Tombstone") + #if probes >= reProbeLimit: echo("Too much probing " & $probes) + #echo("try to resize") + #create next bigger table + nextTable = resize(table) + #help do some copying + #echo("help copy old table to new") + nextTable = helpCopy(table) + #now setVal in the new table instead + #echo("jumping to next table to set val") + return setVal(nextTable, key, val, expVal, match) + else: + idx += 1 + probes += 1 + # Done spinning for a new slot + var oldVal = atomic_load_n(table[idx].value.addr, ATOMIC_RELAXED) + if val == oldVal: + #echo("this val is alredy in the slot") + return oldVal + nextTable = atomic_load_n(table.next.addr, ATOMIC_SEQ_CST) + if nextTable == nil and + ((oldVal == NULL and + (probes >= reProbeLimit or table.used / table.len > 0.8)) or + (isPrime(oldVal))): + if table.used / table.len > 0.8: echo("resize because usage ratio = " & + $(table.used / table.len)) + if isPrime(oldVal): echo("old val isPrime, should be a rare mem ordering event") + nextTable = resize(table) + if nextTable != nil: + #echo("tomb old slot then set in new table") + nextTable = copySlotAndCheck(table,idx) + return setVal(nextTable, key, val, expVal, match) + # Finaly ready to add new val to table + while true: + if match and oldVal != expVal: + #echo("set failed, no match oldVal= " & $oldVal & " expVal= " & $expVal) + return oldVal + if atomic_compare_exchange_n(table[idx].value.addr, oldVal.addr, + val, false, ATOMIC_RELEASE, ATOMIC_RELAXED): + #echo("val set at table " & $cast[int](table)) + if expVal != NULL: + if (oldVal == NULL or isTomb(oldVal)) and not isTomb(val): + discard atomic_add_fetch(table.active.addr, 1, ATOMIC_RELAXED) + elif not (oldVal == NULL or isTomb(oldVal)) and isTomb(val): + discard atomic_add_fetch(table.active.addr, -1, ATOMIC_RELAXED) + if oldVal == NULL and expVal != NULL: + return setTomb(oldVal) + else: return oldVal + if isPrime(oldVal): + nextTable = copySlotAndCheck(table, idx) + return setVal(nextTable, key, val, expVal, match) + +#------------------------------------------------------------------------------ + +proc getVal[K,V](table: var PConcTable[K,V], key: int): int = + #echo("-try get- key = " & $key) + when K is TRaw: + var idx = hashInt(key) + else: + var idx = popPtr[K](key)[].hash + #echo("get idx ", idx) + var + probes = 0 + val: int + while true: + idx = idx and (table.len - 1) + var + newTable: PConcTable[K,V] # = atomic_load_n(table.next.addr, ATOMIC_ACQUIRE) + probedKey = atomic_load_n(table[idx].key.addr, ATOMIC_SEQ_CST) + if keyEQ[K](probedKey, key): + #echo("found key after ", probes+1) + val = atomic_load_n(table[idx].value.addr, ATOMIC_ACQUIRE) + if not isPrime(val): + if isTomb(val): + #echo("val was tomb but not prime") + return NULL + else: + #echo("-GotIt- idx = ", idx, " key = ", key, " val ", val ) + return val + else: + newTable = copySlotAndCheck(table, idx) + return getVal(newTable, key) + else: + #echo("probe ", probes, " idx = ", idx, " key = ", key, " found ", probedKey ) + if probes >= reProbeLimit*4 or key.isTomb: + if newTable == nil: + #echo("too many probes and no new table ", key, " ", idx ) + return NULL + else: + newTable = helpCopy(table) + return getVal(newTable, key) + idx += 1 + probes += 1 + +#------------------------------------------------------------------------------ + +#proc set*(table: var PConcTable[TRaw,TRaw], key: TRaw, val: TRaw) = +# discard setVal(table, pack(key), pack(key), NULL, false) + +#proc set*[V](table: var PConcTable[TRaw,V], key: TRaw, val: ptr V) = +# discard setVal(table, pack(key), cast[int](val), NULL, false) + +proc set*[K,V](table: var PConcTable[K,V], key: var K, val: var V) = + when not (K is TRaw): + var newKey = cast[int](copyShared(key)) + else: + var newKey = pack(key) + when not (V is TRaw): + var newVal = cast[int](copyShared(val)) + else: + var newVal = pack(val) + var oldPtr = pop(setVal(table, newKey, newVal, NULL, false)) + #echo("oldPtr = ", cast[int](oldPtr), " newPtr = ", cast[int](newPtr)) + when not (V is TRaw): + if newVal != oldPtr and oldPtr != NULL: + deallocShared(cast[ptr V](oldPtr)) + + + +proc get*[K,V](table: var PConcTable[K,V], key: var K): V = + when not (V is TRaw): + when not (K is TRaw): + return popPtr[V](getVal(table, cast[int](key.addr)))[] + else: + return popPtr[V](getVal(table, pack(key)))[] + else: + when not (K is TRaw): + return popRaw(getVal(table, cast[int](key.addr))) + else: + return popRaw(getVal(table, pack(key))) + + + + + + + + + + + +#proc `[]`[K,V](table: var PConcTable[K,V], key: K): PEntry[K,V] {.inline.} = +# getVal(table, key) + +#proc `[]=`[K,V](table: var PConcTable[K,V], key: K, val: V): PEntry[K,V] {.inline.} = +# setVal(table, key, val) + + + + + + +#Tests ---------------------------- +when isMainModule: + import locks, times, mersenne + + const + numTests = 100000 + numThreads = 10 + + + + type + TTestObj = tuple + thr: int + f0: int + f1: int + + TData = tuple[k: string,v: TTestObj] + PDataArr = array[0..numTests-1, TData] + Dict = PConcTable[string,TTestObj] + + var + thr: array[0..numThreads-1, TThread[Dict]] + + table = newLFTable[string,TTestObj](8) + rand = newMersenneTwister(2525) + + proc createSampleData(len: int): PDataArr = + #result = cast[PDataArr](allocShared0(sizeof(TData)*numTests)) + for i in 0..len-1: + result[i].k = "mark" & $(i+1) + #echo("mark" & $(i+1), " ", hash("mark" & $(i+1))) + result[i].v.thr = 0 + result[i].v.f0 = i+1 + result[i].v.f1 = 0 + #echo("key = " & $(i+1) & " Val ptr = " & $cast[int](result[i].v.addr)) + + + + proc threadProc(tp: Dict) {.thread.} = + var t = cpuTime(); + for i in 1..numTests: + var key = "mark" & $(i) + var got = table.get(key) + got.thr = cast[int](myThreadID[pointer]()) + got.f1 = got.f1 + 1 + table.set(key, got) + t = cpuTime() - t + echo t + + + var testData = createSampleData(numTests) + + for i in 0..numTests-1: + table.set(testData[i].k, testData[i].v) + + var i = 0 + while i < numThreads: + createThread(thr[i], threadProc, table) + i += 1 + + joinThreads(thr) + + + + + + var fails = 0 + + for i in 0..numTests-1: + var got = table.get(testData[i].k) + if got.f0 != i+1 or got.f1 != numThreads: + fails += 1 + echo(got) + + echo("Failed read or write = ", fails) + + + #for i in 1..numTests: + # echo(i, " = ", hashInt(i) and 8191) + + deleteConcTable(table) + + + + + + + diff --git a/lib/pure/collections/baseutils.nim b/lib/pure/collections/baseutils.nim new file mode 100644 index 000000000..565a89ccb --- /dev/null +++ b/lib/pure/collections/baseutils.nim @@ -0,0 +1,41 @@ + + + +#------------------------------------------------------------------------------ +## Useful Constants +const NULL* = 0 + + +#------------------------------------------------------------------------------ +## Memory Utility Functions + +proc newHeap*[T](): ptr T = + result = cast[ptr T](alloc0(sizeof(T))) + +proc copyNew*[T](x: var T): ptr T = + var + size = sizeof(T) + mem = alloc(size) + copyMem(mem, x.addr, size) + return cast[ptr T](mem) + +proc copyTo*[T](val: var T, dest: int) = + copyMem(pointer(dest), val.addr, sizeof(T)) + +proc allocType*[T](): pointer = alloc(sizeof(T)) + +proc newShared*[T](): ptr T = + result = cast[ptr T](allocShared0(sizeof(T))) + +proc copyShared*[T](x: var T): ptr T = + var + size = sizeof(T) + mem = allocShared(size) + copyMem(mem, x.addr, size) + return cast[ptr T](mem) + +#------------------------------------------------------------------------------ +## Pointer arithmetic + +proc `+`*(p: pointer, i: int): pointer {.inline.} = + cast[pointer](cast[int](p) + i) \ No newline at end of file diff --git a/lib/pure/collections/intsets.nim b/lib/pure/collections/intsets.nim index 2a8d7eec2..f1e67fc0e 100644 --- a/lib/pure/collections/intsets.nim +++ b/lib/pure/collections/intsets.nim @@ -50,7 +50,7 @@ proc mustRehash(length, counter: int): bool {.inline.} = proc nextTry(h, maxHash: THash): THash {.inline.} = result = ((5 * h) + 1) and maxHash -proc IntSetGet(t: TIntSet, key: int): PTrunk = +proc intSetGet(t: TIntSet, key: int): PTrunk = var h = key and t.max while t.data[h] != nil: if t.data[h].key == key: @@ -58,7 +58,7 @@ proc IntSetGet(t: TIntSet, key: int): PTrunk = h = nextTry(h, t.max) result = nil -proc IntSetRawInsert(t: TIntSet, data: var TTrunkSeq, desc: PTrunk) = +proc intSetRawInsert(t: TIntSet, data: var TTrunkSeq, desc: PTrunk) = var h = desc.key and t.max while data[h] != nil: assert(data[h] != desc) @@ -66,22 +66,22 @@ proc IntSetRawInsert(t: TIntSet, data: var TTrunkSeq, desc: PTrunk) = assert(data[h] == nil) data[h] = desc -proc IntSetEnlarge(t: var TIntSet) = +proc intSetEnlarge(t: var TIntSet) = var n: TTrunkSeq var oldMax = t.max t.max = ((t.max + 1) * 2) - 1 newSeq(n, t.max + 1) - for i in countup(0, oldmax): - if t.data[i] != nil: IntSetRawInsert(t, n, t.data[i]) + for i in countup(0, oldMax): + if t.data[i] != nil: intSetRawInsert(t, n, t.data[i]) swap(t.data, n) -proc IntSetPut(t: var TIntSet, key: int): PTrunk = +proc intSetPut(t: var TIntSet, key: int): PTrunk = var h = key and t.max while t.data[h] != nil: if t.data[h].key == key: return t.data[h] h = nextTry(h, t.max) - if mustRehash(t.max + 1, t.counter): IntSetEnlarge(t) + if mustRehash(t.max + 1, t.counter): intSetEnlarge(t) inc(t.counter) h = key and t.max while t.data[h] != nil: h = nextTry(h, t.max) @@ -94,7 +94,7 @@ proc IntSetPut(t: var TIntSet, key: int): PTrunk = proc contains*(s: TIntSet, key: int): bool = ## returns true iff `key` is in `s`. - var t = IntSetGet(s, `shr`(key, TrunkShift)) + var t = intSetGet(s, `shr`(key, TrunkShift)) if t != nil: var u = key and TrunkMask result = (t.bits[`shr`(u, IntShift)] and `shl`(1, u and IntMask)) != 0 @@ -103,14 +103,14 @@ proc contains*(s: TIntSet, key: int): bool = proc incl*(s: var TIntSet, key: int) = ## includes an element `key` in `s`. - var t = IntSetPut(s, `shr`(key, TrunkShift)) + var t = intSetPut(s, `shr`(key, TrunkShift)) var u = key and TrunkMask t.bits[`shr`(u, IntShift)] = t.bits[`shr`(u, IntShift)] or `shl`(1, u and IntMask) proc excl*(s: var TIntSet, key: int) = ## excludes `key` from the set `s`. - var t = IntSetGet(s, `shr`(key, TrunkShift)) + var t = intSetGet(s, `shr`(key, TrunkShift)) if t != nil: var u = key and TrunkMask t.bits[`shr`(u, IntShift)] = t.bits[`shr`(u, IntShift)] and @@ -119,7 +119,7 @@ proc excl*(s: var TIntSet, key: int) = proc containsOrIncl*(s: var TIntSet, key: int): bool = ## returns true if `s` contains `key`, otherwise `key` is included in `s` ## and false is returned. - var t = IntSetGet(s, `shr`(key, TrunkShift)) + var t = intSetGet(s, `shr`(key, TrunkShift)) if t != nil: var u = key and TrunkMask result = (t.bits[`shr`(u, IntShift)] and `shl`(1, u and IntMask)) != 0 diff --git a/lib/pure/collections/lists.nim b/lib/pure/collections/lists.nim index ad8eca6a9..b8f8d20b5 100644 --- a/lib/pure/collections/lists.nim +++ b/lib/pure/collections/lists.nim @@ -41,19 +41,19 @@ type proc initSinglyLinkedList*[T](): TSinglyLinkedList[T] = ## creates a new singly linked list that is empty. - nil + discard proc initDoublyLinkedList*[T](): TDoublyLinkedList[T] = ## creates a new doubly linked list that is empty. - nil + discard proc initSinglyLinkedRing*[T](): TSinglyLinkedRing[T] = ## creates a new singly linked ring that is empty. - nil + discard proc initDoublyLinkedRing*[T](): TDoublyLinkedRing[T] = ## creates a new doubly linked ring that is empty. - nil + discard proc newDoublyLinkedNode*[T](value: T): PDoublyLinkedNode[T] = ## creates a new doubly linked node with the given `value`. diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index 3a009a8cb..b2f72ee14 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -136,7 +136,7 @@ proc delete*[T](s: var seq[T], first=0, last=0) = s[i].shallowCopy(s[j]) inc(i) inc(j) - setlen(s, newLen) + setLen(s, newLen) proc insert*[T](dest: var seq[T], src: openArray[T], pos=0) = ## Inserts items from `src` into `dest` at position `pos`. This modifies @@ -276,6 +276,38 @@ template foldr*(sequence, operation: expr): expr = result = operation result +template mapIt*(seq1, typ, pred: expr): expr = + ## Convenience template around the ``map`` proc to reduce typing. + ## + ## The template injects the ``it`` variable which you can use directly in an + ## expression. You also need to pass as `typ` the type of the expression, + ## since the new returned sequence can have a different type than the + ## original. Example: + ## + ## .. code-block:: nimrod + ## let + ## nums = @[1, 2, 3, 4] + ## strings = nums.mapIt(string, $(4 * it)) + var result {.gensym.}: seq[typ] = @[] + for it {.inject.} in items(seq1): + result.add(pred) + result + +template mapIt*(varSeq, pred: expr) = + ## Convenience template around the mutable ``map`` proc to reduce typing. + ## + ## The template injects the ``it`` variable which you can use directly in an + ## expression. The expression has to return the same type as the sequence you + ## are mutating. Example: + ## + ## .. code-block:: nimrod + ## var nums = @[1, 2, 3, 4] + ## nums.mapIt(it * 3) + ## assert nums[0] + nums[3] == 15 + for i in 0 .. <len(varSeq): + let it {.inject.} = varSeq[i] + varSeq[i] = pred + when isMainModule: import strutils block: # concat test @@ -381,4 +413,11 @@ when isMainModule: Inserting [2,2,2,2,2,2] into [1,1,1,1,1,1,1,1] at 3 is [1,1,1,2,2,2,2,2,2,1,1,1,1,1]""" + block: # mapIt tests + var + nums = @[1, 2, 3, 4] + strings = nums.mapIt(string, $(4 * it)) + nums.mapIt(it * 3) + assert nums[0] + nums[3] == 15 + echo "Finished doc tests" diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim index 42b77d427..e6ab617e5 100644 --- a/lib/pure/collections/sets.nim +++ b/lib/pure/collections/sets.nim @@ -65,38 +65,38 @@ template rawInsertImpl() {.dirty.} = data[h].key = key data[h].slot = seFilled -proc RawGet[A](s: TSet[A], key: A): int = +proc rawGet[A](s: TSet[A], key: A): int = rawGetImpl() proc contains*[A](s: TSet[A], key: A): bool = ## returns true iff `key` is in `s`. - var index = RawGet(s, key) + var index = rawGet(s, key) result = index >= 0 -proc RawInsert[A](s: var TSet[A], data: var TKeyValuePairSeq[A], key: A) = +proc rawInsert[A](s: var TSet[A], data: var TKeyValuePairSeq[A], key: A) = rawInsertImpl() -proc Enlarge[A](s: var TSet[A]) = +proc enlarge[A](s: var TSet[A]) = var n: TKeyValuePairSeq[A] newSeq(n, len(s.data) * growthFactor) for i in countup(0, high(s.data)): - if s.data[i].slot == seFilled: RawInsert(s, n, s.data[i].key) + if s.data[i].slot == seFilled: rawInsert(s, n, s.data[i].key) swap(s.data, n) template inclImpl() {.dirty.} = - var index = RawGet(s, key) + var index = rawGet(s, key) if index < 0: - if mustRehash(len(s.data), s.counter): Enlarge(s) - RawInsert(s, s.data, key) + if mustRehash(len(s.data), s.counter): enlarge(s) + rawInsert(s, s.data, key) inc(s.counter) template containsOrInclImpl() {.dirty.} = - var index = RawGet(s, key) + var index = rawGet(s, key) if index >= 0: result = true else: - if mustRehash(len(s.data), s.counter): Enlarge(s) - RawInsert(s, s.data, key) + if mustRehash(len(s.data), s.counter): enlarge(s) + rawInsert(s, s.data, key) inc(s.counter) proc incl*[A](s: var TSet[A], key: A) = @@ -105,7 +105,7 @@ proc incl*[A](s: var TSet[A], key: A) = proc excl*[A](s: var TSet[A], key: A) = ## excludes `key` from the set `s`. - var index = RawGet(s, key) + var index = rawGet(s, key) if index >= 0: s.data[index].slot = seDeleted dec(s.counter) @@ -122,7 +122,7 @@ proc initSet*[A](initialSize=64): TSet[A] = result.counter = 0 newSeq(result.data, initialSize) -proc toSet*[A](keys: openarray[A]): TSet[A] = +proc toSet*[A](keys: openArray[A]): TSet[A] = ## creates a new hash set that contains the given `keys`. result = initSet[A](nextPowerOfTwo(keys.len+10)) for key in items(keys): result.incl(key) @@ -169,15 +169,15 @@ iterator items*[A](s: TOrderedSet[A]): A = forAllOrderedPairs: yield s.data[h].key -proc RawGet[A](s: TOrderedSet[A], key: A): int = +proc rawGet[A](s: TOrderedSet[A], key: A): int = rawGetImpl() proc contains*[A](s: TOrderedSet[A], key: A): bool = ## returns true iff `key` is in `s`. - var index = RawGet(s, key) + var index = rawGet(s, key) result = index >= 0 -proc RawInsert[A](s: var TOrderedSet[A], +proc rawInsert[A](s: var TOrderedSet[A], data: var TOrderedKeyValuePairSeq[A], key: A) = rawInsertImpl() data[h].next = -1 @@ -185,7 +185,7 @@ proc RawInsert[A](s: var TOrderedSet[A], if s.last >= 0: data[s.last].next = h s.last = h -proc Enlarge[A](s: var TOrderedSet[A]) = +proc enlarge[A](s: var TOrderedSet[A]) = var n: TOrderedKeyValuePairSeq[A] newSeq(n, len(s.data) * growthFactor) var h = s.first @@ -194,7 +194,7 @@ proc Enlarge[A](s: var TOrderedSet[A]) = while h >= 0: var nxt = s.data[h].next if s.data[h].slot == seFilled: - RawInsert(s, n, s.data[h].key) + rawInsert(s, n, s.data[h].key) h = nxt swap(s.data, n) @@ -216,7 +216,7 @@ proc initOrderedSet*[A](initialSize=64): TOrderedSet[A] = result.last = -1 newSeq(result.data, initialSize) -proc toOrderedSet*[A](keys: openarray[A]): TOrderedSet[A] = +proc toOrderedSet*[A](keys: openArray[A]): TOrderedSet[A] = ## creates a new ordered hash set that contains the given `keys`. result = initOrderedSet[A](nextPowerOfTwo(keys.len+10)) for key in items(keys): result.incl(key) @@ -225,4 +225,19 @@ proc `$`*[A](s: TOrderedSet[A]): string = ## The `$` operator for ordered hash sets. dollarImpl() - +proc `<`*[A](s, t: TSet[A]): bool = + ## Is s a strict subset of t? + s.counter != t.counter and s <= t + +proc `<=`*[A](s, t: TSet[A]): bool = + ## Is s a subset of t? + result = false + if s.counter > t.counter: return + result = true + for item in s: + if not(t.contains(item)): + result = false + return + +proc `==`*[A](s, t: TSet[A]): bool = + s.counter == t.counter and s <= t diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 02d099c1f..40ae57b5a 100644 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -85,7 +85,7 @@ template rawInsertImpl() {.dirty.} = data[h].val = val data[h].slot = seFilled -proc RawGet[A, B](t: TTable[A, B], key: A): int = +proc rawGet[A, B](t: TTable[A, B], key: A): int = rawGetImpl() proc `[]`*[A, B](t: TTable[A, B], key: A): B = @@ -93,13 +93,13 @@ proc `[]`*[A, B](t: TTable[A, B], key: A): B = ## default empty value for the type `B` is returned ## and no exception is raised. One can check with ``hasKey`` whether the key ## exists. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val proc mget*[A, B](t: var TTable[A, B], key: A): var B = ## retrieves the value at ``t[key]``. The value can be modified. ## If `key` is not in `t`, the ``EInvalidKey`` exception is raised. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val else: raise newException(EInvalidKey, "key not found: " & $key) @@ -107,39 +107,39 @@ proc hasKey*[A, B](t: TTable[A, B], key: A): bool = ## returns true iff `key` is in the table `t`. result = rawGet(t, key) >= 0 -proc RawInsert[A, B](t: var TTable[A, B], data: var TKeyValuePairSeq[A, B], +proc rawInsert[A, B](t: var TTable[A, B], data: var TKeyValuePairSeq[A, B], key: A, val: B) = rawInsertImpl() -proc Enlarge[A, B](t: var TTable[A, B]) = +proc enlarge[A, B](t: var TTable[A, B]) = var n: TKeyValuePairSeq[A, B] newSeq(n, len(t.data) * growthFactor) for i in countup(0, high(t.data)): - if t.data[i].slot == seFilled: RawInsert(t, n, t.data[i].key, t.data[i].val) + if t.data[i].slot == seFilled: rawInsert(t, n, t.data[i].key, t.data[i].val) swap(t.data, n) -template AddImpl() {.dirty.} = - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) +template addImpl() {.dirty.} = + if mustRehash(len(t.data), t.counter): enlarge(t) + rawInsert(t, t.data, key, val) inc(t.counter) -template PutImpl() {.dirty.} = - var index = RawGet(t, key) +template putImpl() {.dirty.} = + var index = rawGet(t, key) if index >= 0: t.data[index].val = val else: - AddImpl() + addImpl() when false: # not yet used: - template HasKeyOrPutImpl() {.dirty.} = - var index = RawGet(t, key) + template hasKeyOrPutImpl() {.dirty.} = + var index = rawGet(t, key) if index >= 0: t.data[index].val = val result = true else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) + if mustRehash(len(t.data), t.counter): enlarge(t) + rawInsert(t, t.data, key, val) inc(t.counter) result = false @@ -149,11 +149,11 @@ proc `[]=`*[A, B](t: var TTable[A, B], key: A, val: B) = proc add*[A, B](t: var TTable[A, B], key: A, val: B) = ## puts a new (key, value)-pair into `t` even if ``t[key]`` already exists. - AddImpl() + addImpl() proc del*[A, B](t: var TTable[A, B], key: A) = ## deletes `key` from hash table `t`. - var index = RawGet(t, key) + let index = rawGet(t, key) if index >= 0: t.data[index].slot = seDeleted dec(t.counter) @@ -168,7 +168,7 @@ proc initTable*[A, B](initialSize=64): TTable[A, B] = result.counter = 0 newSeq(result.data, initialSize) -proc toTable*[A, B](pairs: openarray[tuple[key: A, +proc toTable*[A, B](pairs: openArray[tuple[key: A, val: B]]): TTable[A, B] = ## creates a new hash table that contains the given `pairs`. result = initTable[A, B](nextPowerOfTwo(pairs.len+10)) @@ -189,6 +189,16 @@ template dollarImpl(): stmt {.dirty.} = proc `$`*[A, B](t: TTable[A, B]): string = ## The `$` operator for hash tables. dollarImpl() + +proc `==`*[A, B](s, t: TTable[A, B]): bool = + s.counter == t.counter and s.data == t.data + +proc indexBy*[A, B, C](collection: A, index: proc(x: B): C): TTable[C, B] = + ## Index the collection with the proc provided. + # TODO: As soon as supported, change collection: A to collection: A[B] + result = initTable[C, B]() + for item in collection: + result[index(item)] = item # ------------------------------ ordered table ------------------------------ @@ -240,7 +250,7 @@ iterator mvalues*[A, B](t: var TOrderedTable[A, B]): var B = forAllOrderedPairs: yield t.data[h].val -proc RawGet[A, B](t: TOrderedTable[A, B], key: A): int = +proc rawGet[A, B](t: TOrderedTable[A, B], key: A): int = rawGetImpl() proc `[]`*[A, B](t: TOrderedTable[A, B], key: A): B = @@ -248,13 +258,13 @@ proc `[]`*[A, B](t: TOrderedTable[A, B], key: A): B = ## default empty value for the type `B` is returned ## and no exception is raised. One can check with ``hasKey`` whether the key ## exists. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val proc mget*[A, B](t: var TOrderedTable[A, B], key: A): var B = ## retrieves the value at ``t[key]``. The value can be modified. ## If `key` is not in `t`, the ``EInvalidKey`` exception is raised. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val else: raise newException(EInvalidKey, "key not found: " & $key) @@ -262,7 +272,7 @@ proc hasKey*[A, B](t: TOrderedTable[A, B], key: A): bool = ## returns true iff `key` is in the table `t`. result = rawGet(t, key) >= 0 -proc RawInsert[A, B](t: var TOrderedTable[A, B], +proc rawInsert[A, B](t: var TOrderedTable[A, B], data: var TOrderedKeyValuePairSeq[A, B], key: A, val: B) = rawInsertImpl() @@ -271,7 +281,7 @@ proc RawInsert[A, B](t: var TOrderedTable[A, B], if t.last >= 0: data[t.last].next = h t.last = h -proc Enlarge[A, B](t: var TOrderedTable[A, B]) = +proc enlarge[A, B](t: var TOrderedTable[A, B]) = var n: TOrderedKeyValuePairSeq[A, B] newSeq(n, len(t.data) * growthFactor) var h = t.first @@ -280,7 +290,7 @@ proc Enlarge[A, B](t: var TOrderedTable[A, B]) = while h >= 0: var nxt = t.data[h].next if t.data[h].slot == seFilled: - RawInsert(t, n, t.data[h].key, t.data[h].val) + rawInsert(t, n, t.data[h].key, t.data[h].val) h = nxt swap(t.data, n) @@ -290,7 +300,7 @@ proc `[]=`*[A, B](t: var TOrderedTable[A, B], key: A, val: B) = proc add*[A, B](t: var TOrderedTable[A, B], key: A, val: B) = ## puts a new (key, value)-pair into `t` even if ``t[key]`` already exists. - AddImpl() + addImpl() proc initOrderedTable*[A, B](initialSize=64): TOrderedTable[A, B] = ## creates a new ordered hash table that is empty. @@ -304,7 +314,7 @@ proc initOrderedTable*[A, B](initialSize=64): TOrderedTable[A, B] = result.last = -1 newSeq(result.data, initialSize) -proc toOrderedTable*[A, B](pairs: openarray[tuple[key: A, +proc toOrderedTable*[A, B](pairs: openArray[tuple[key: A, val: B]]): TOrderedTable[A, B] = ## creates a new ordered hash table that contains the given `pairs`. result = initOrderedTable[A, B](nextPowerOfTwo(pairs.len+10)) @@ -398,7 +408,7 @@ iterator mvalues*[A](t: TCountTable[A]): var int = for h in 0..high(t.data): if t.data[h].val != 0: yield t.data[h].val -proc RawGet[A](t: TCountTable[A], key: A): int = +proc rawGet[A](t: TCountTable[A], key: A): int = var h: THash = hash(key) and high(t.data) # start with real hash value while t.data[h].val != 0: if t.data[h].key == key: return h @@ -409,13 +419,13 @@ proc `[]`*[A](t: TCountTable[A], key: A): int = ## retrieves the value at ``t[key]``. If `key` is not in `t`, ## 0 is returned. One can check with ``hasKey`` whether the key ## exists. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val proc mget*[A](t: var TCountTable[A], key: A): var int = ## retrieves the value at ``t[key]``. The value can be modified. ## If `key` is not in `t`, the ``EInvalidKey`` exception is raised. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val else: raise newException(EInvalidKey, "key not found: " & $key) @@ -423,24 +433,24 @@ proc hasKey*[A](t: TCountTable[A], key: A): bool = ## returns true iff `key` is in the table `t`. result = rawGet(t, key) >= 0 -proc RawInsert[A](t: TCountTable[A], data: var seq[tuple[key: A, val: int]], +proc rawInsert[A](t: TCountTable[A], data: var seq[tuple[key: A, val: int]], key: A, val: int) = var h: THash = hash(key) and high(data) while data[h].val != 0: h = nextTry(h, high(data)) data[h].key = key data[h].val = val -proc Enlarge[A](t: var TCountTable[A]) = +proc enlarge[A](t: var TCountTable[A]) = var n: seq[tuple[key: A, val: int]] newSeq(n, len(t.data) * growthFactor) for i in countup(0, high(t.data)): - if t.data[i].val != 0: RawInsert(t, n, t.data[i].key, t.data[i].val) + if t.data[i].val != 0: rawInsert(t, n, t.data[i].key, t.data[i].val) swap(t.data, n) proc `[]=`*[A](t: var TCountTable[A], key: A, val: int) = ## puts a (key, value)-pair into `t`. `val` has to be positive. assert val > 0 - PutImpl() + putImpl() proc initCountTable*[A](initialSize=64): TCountTable[A] = ## creates a new count table that is empty. @@ -463,15 +473,15 @@ proc `$`*[A](t: TCountTable[A]): string = proc inc*[A](t: var TCountTable[A], key: A, val = 1) = ## increments `t[key]` by `val`. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: inc(t.data[index].val, val) else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) + if mustRehash(len(t.data), t.counter): enlarge(t) + rawInsert(t, t.data, key, val) inc(t.counter) -proc Smallest*[A](t: TCountTable[A]): tuple[key: A, val: int] = +proc smallest*[A](t: TCountTable[A]): tuple[key: A, val: int] = ## returns the largest (key,val)-pair. Efficiency: O(n) assert t.len > 0 var minIdx = 0 @@ -480,7 +490,7 @@ proc Smallest*[A](t: TCountTable[A]): tuple[key: A, val: int] = result.key = t.data[minIdx].key result.val = t.data[minIdx].val -proc Largest*[A](t: TCountTable[A]): tuple[key: A, val: int] = +proc largest*[A](t: TCountTable[A]): tuple[key: A, val: int] = ## returns the (key,val)-pair with the largest `val`. Efficiency: O(n) assert t.len > 0 var maxIdx = 0 diff --git a/lib/pure/dynlib.nim b/lib/pure/dynlib.nim index a64b7f138..3ed00fdb2 100644 --- a/lib/pure/dynlib.nim +++ b/lib/pure/dynlib.nim @@ -14,15 +14,15 @@ type TLibHandle* = pointer ## a handle to a dynamically loaded library -proc LoadLib*(path: string): TLibHandle +proc loadLib*(path: string): TLibHandle ## loads a library from `path`. Returns nil if the library could not ## be loaded. -proc LoadLib*(): TLibHandle +proc loadLib*(): TLibHandle ## gets the handle from the current executable. Returns nil if the ## library could not be loaded. -proc UnloadLib*(lib: TLibHandle) +proc unloadLib*(lib: TLibHandle) ## unloads the library `lib` proc raiseInvalidLibrary*(name: cstring) {.noinline, noreturn.} = @@ -60,9 +60,9 @@ when defined(posix): proc dlsym(lib: TLibHandle, name: cstring): pointer {. importc, header: "<dlfcn.h>".} - proc LoadLib(path: string): TLibHandle = return dlopen(path, RTLD_NOW) - proc LoadLib(): TLibHandle = return dlopen(nil, RTLD_NOW) - proc UnloadLib(lib: TLibHandle) = dlclose(lib) + proc loadLib(path: string): TLibHandle = return dlopen(path, RTLD_NOW) + proc loadLib(): TLibHandle = return dlopen(nil, RTLD_NOW) + proc unloadLib(lib: TLibHandle) = dlclose(lib) proc symAddr(lib: TLibHandle, name: cstring): pointer = return dlsym(lib, name) @@ -78,14 +78,14 @@ elif defined(windows) or defined(dos): proc FreeLibrary(lib: THINSTANCE) {.importc, header: "<windows.h>", stdcall.} proc winLoadLibrary(path: cstring): THINSTANCE {. importc: "LoadLibraryA", header: "<windows.h>", stdcall.} - proc GetProcAddress(lib: THINSTANCE, name: cstring): pointer {. + proc getProcAddress(lib: THINSTANCE, name: cstring): pointer {. importc: "GetProcAddress", header: "<windows.h>", stdcall.} - proc LoadLib(path: string): TLibHandle = + proc loadLib(path: string): TLibHandle = result = cast[TLibHandle](winLoadLibrary(path)) - proc LoadLib(): TLibHandle = + proc loadLib(): TLibHandle = result = cast[TLibHandle](winLoadLibrary(nil)) - proc UnloadLib(lib: TLibHandle) = FreeLibrary(cast[THINSTANCE](lib)) + proc unloadLib(lib: TLibHandle) = FreeLibrary(cast[THINSTANCE](lib)) proc symAddr(lib: TLibHandle, name: cstring): pointer = result = GetProcAddress(cast[THINSTANCE](lib), name) diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim index ce4238409..94d21ed4e 100644 --- a/lib/pure/encodings.nim +++ b/lib/pure/encodings.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -14,21 +14,21 @@ import os, parseutils, strutils when not defined(windows): type - TConverter = object {.pure, final.} + TConverter = object PConverter* = ptr TConverter ## can convert between two character sets - + else: type TCodePage = distinct int32 - PConverter* = object {.pure.} + PConverter* = object dest, src: TCodePage - + type EInvalidEncoding* = object of EInvalidValue ## exception that is raised ## for encoding errors when defined(windows): - proc EqEncodingNames(a, b: string): bool = + proc eqEncodingNames(a, b: string): bool = var i = 0 var j = 0 while i < a.len and j < b.len: @@ -208,31 +208,31 @@ when defined(windows): when false: # not needed yet: type - TCpInfo = object {.pure.} - MaxCharSize: int32 - DefaultChar: array[0..1, char] - LeadByte: array[0..12-1, char] + TCpInfo = object + maxCharSize: int32 + defaultChar: array[0..1, char] + leadByte: array[0..12-1, char] - proc GetCPInfo(CodePage: TCodePage, lpCPInfo: var TCpInfo): int32 {. + proc getCPInfo(codePage: TCodePage, lpCPInfo: var TCpInfo): int32 {. stdcall, importc: "GetCPInfo", dynlib: "kernel32".} proc nameToCodePage(name: string): TCodePage = var nameAsInt: int if parseInt(name, nameAsInt) == 0: nameAsInt = -1 for no, na in items(winEncodings): - if no == nameAsInt or EqEncodingNames(na, name): return TCodePage(no) + if no == nameAsInt or eqEncodingNames(na, name): return TCodePage(no) result = TCodePage(-1) proc codePageToName(c: TCodePage): string = for no, na in items(winEncodings): - if no == int(c): + if no == int(c): return if na.len != 0: na else: $no result = "" - proc GetACP(): TCodePage {.stdcall, importc: "GetACP", dynlib: "kernel32".} + proc getACP(): TCodePage {.stdcall, importc: "GetACP", dynlib: "kernel32".} - proc MultiByteToWideChar( - CodePage: TCodePage, + proc multiByteToWideChar( + codePage: TCodePage, dwFlags: int32, lpMultiByteStr: cstring, cbMultiByte: cint, @@ -240,8 +240,8 @@ when defined(windows): cchWideChar: cint): cint {. stdcall, importc: "MultiByteToWideChar", dynlib: "kernel32".} - proc WideCharToMultiByte( - CodePage: TCodePage, + proc wideCharToMultiByte( + codePage: TCodePage, dwFlags: int32, lpWideCharStr: cstring, cchWideChar: cint, @@ -321,7 +321,6 @@ proc close*(c: PConverter) = iconvClose(c) when defined(windows): - proc convert*(c: PConverter, s: string): string = ## converts `s` to `destEncoding` that was given to the converter `c`. It ## assumed that `s` is in `srcEncoding`. @@ -333,26 +332,26 @@ when defined(windows): var cap = s.len + s.len shr 2 result = newStringOfCap(cap*2) # convert to utf-16 LE - var m = MultiByteToWideChar(CodePage = c.src, dwFlags = 0'i32, + var m = multiByteToWideChar(codePage = c.src, dwFlags = 0'i32, lpMultiByteStr = cstring(s), cbMultiByte = cint(s.len), lpWideCharStr = cstring(result), cchWideChar = cint(cap)) if m == 0: # try again; ask for capacity: - cap = MultiByteToWideChar(CodePage = c.src, dwFlags = 0'i32, + cap = multiByteToWideChar(codePage = c.src, dwFlags = 0'i32, lpMultiByteStr = cstring(s), cbMultiByte = cint(s.len), lpWideCharStr = nil, cchWideChar = cint(0)) # and do the conversion properly: result = newStringOfCap(cap*2) - m = MultiByteToWideChar(CodePage = c.src, dwFlags = 0'i32, + m = multiByteToWideChar(codePage = c.src, dwFlags = 0'i32, lpMultiByteStr = cstring(s), cbMultiByte = cint(s.len), lpWideCharStr = cstring(result), cchWideChar = cint(cap)) - if m == 0: OSError() + if m == 0: osError(osLastError()) setLen(result, m*2) elif m <= cap: setLen(result, m*2) @@ -364,8 +363,8 @@ when defined(windows): # otherwise the fun starts again: cap = s.len + s.len shr 2 var res = newStringOfCap(cap) - m = WideCharToMultiByte( - CodePage = c.dest, + m = wideCharToMultiByte( + codePage = c.dest, dwFlags = 0'i32, lpWideCharStr = cstring(result), cchWideChar = cint(result.len div 2), @@ -373,8 +372,8 @@ when defined(windows): cbMultiByte = cap.cint) if m == 0: # try again; ask for capacity: - cap = WideCharToMultiByte( - CodePage = c.dest, + cap = wideCharToMultiByte( + codePage = c.dest, dwFlags = 0'i32, lpWideCharStr = cstring(result), cchWideChar = cint(result.len div 2), @@ -382,14 +381,14 @@ when defined(windows): cbMultiByte = cint(0)) # and do the conversion properly: res = newStringOfCap(cap) - m = WideCharToMultiByte( - CodePage = c.dest, + m = wideCharToMultiByte( + codePage = c.dest, dwFlags = 0'i32, lpWideCharStr = cstring(result), cchWideChar = cint(result.len div 2), lpMultiByteStr = cstring(res), cbMultiByte = cap.cint) - if m == 0: OSError() + if m == 0: osError(osLastError()) setLen(res, m) result = res elif m <= cap: @@ -399,15 +398,14 @@ when defined(windows): assert(false) # cannot happen else: - proc convert*(c: PConverter, s: string): string = result = newString(s.len) - var inLen = len(S) + var inLen = len(s) var outLen = len(result) - var src = cstring(S) + var src = cstring(s) var dst = cstring(result) var iconvres: int - while InLen > 0: + while inLen > 0: iconvres = iconv(c, src, inLen, dst, outLen) if iconvres == -1: var lerr = errno @@ -425,11 +423,11 @@ else: dst = cast[cstring](cast[int](cstring(result)) + offset) outLen = len(result) - offset else: - OSError() + osError(lerr.TOSErrorCode) # iconv has a buffer that needs flushing, specially if the last char is # not '\0' discard iconv(c, nil, nil, dst, outlen) - if iconvres == Cint(-1) and errno == E2BIG: + if iconvres == cint(-1) and errno == E2BIG: var offset = cast[int](dst) - cast[int](cstring(result)) setLen(result, len(result)+inLen*2+5) # 5 is minimally one utf-8 char @@ -450,7 +448,7 @@ proc convert*(s: string, destEncoding = "UTF-8", finally: close(c) -when IsMainModule: +when isMainModule: let orig = "öäüß" cp1252 = convert(orig, "CP1252", "UTF-8") diff --git a/lib/pure/endians.nim b/lib/pure/endians.nim index 34270b320..73017464d 100644 --- a/lib/pure/endians.nim +++ b/lib/pure/endians.nim @@ -34,14 +34,26 @@ proc swapEndian32*(outp, inp: pointer) = o[2] = i[1] o[3] = i[0] +proc swapEndian16*(outp, inp: pointer) = + ## copies `inp` to `outp` swapping bytes. Both buffers are supposed to + ## contain at least 2 bytes. + var + i = cast[cstring](inp) + o = cast[cstring](outp) + o[0] = i[1] + o[1] = i[0] + when system.cpuEndian == bigEndian: proc littleEndian64*(outp, inp: pointer) {.inline.} = swapEndian64(outp, inp) proc littleEndian32*(outp, inp: pointer) {.inline.} = swapEndian32(outp, inp) + proc littleEndian16*(outp, inp: pointer) {.inline.} = swapEndian16(outp, inp) proc bigEndian64*(outp, inp: pointer) {.inline.} = copyMem(outp, inp, 8) proc bigEndian32*(outp, inp: pointer) {.inline.} = copyMem(outp, inp, 4) + proc bigEndian16*(outp, inp: pointer) {.inline.} = copyMem(outp, inp, 2) else: proc littleEndian64*(outp, inp: pointer) {.inline.} = copyMem(outp, inp, 8) proc littleEndian32*(outp, inp: pointer) {.inline.} = copyMem(outp, inp, 4) + proc littleEndian16*(outp, inp: pointer){.inline.} = copyMem(outp, inp, 2) proc bigEndian64*(outp, inp: pointer) {.inline.} = swapEndian64(outp, inp) proc bigEndian32*(outp, inp: pointer) {.inline.} = swapEndian32(outp, inp) - + proc bigEndian16*(outp, inp: pointer) {.inline.} = swapEndian16(outp, inp) diff --git a/lib/pure/fsmonitor.nim b/lib/pure/fsmonitor.nim index a554cf963..d6584c1a0 100644 --- a/lib/pure/fsmonitor.nim +++ b/lib/pure/fsmonitor.nim @@ -64,10 +64,10 @@ const proc newMonitor*(): PFSMonitor = ## Creates a new file system monitor. new(result) - result.fd = inotifyInit() result.targets = initTable[cint, string]() + result.fd = inotifyInit() if result.fd < 0: - OSError() + OSError(OSLastError()) proc add*(monitor: PFSMonitor, target: string, filters = {MonitorAll}): cint {.discardable.} = @@ -93,7 +93,7 @@ proc add*(monitor: PFSMonitor, target: string, result = inotifyAddWatch(monitor.fd, target, INFilter.uint32) if result < 0: - OSError() + OSError(OSLastError()) monitor.targets.add(result, target) proc del*(monitor: PFSMonitor, wd: cint) = @@ -101,7 +101,7 @@ proc del*(monitor: PFSMonitor, wd: cint) = ## ## If ``wd`` is not a part of ``monitor`` an EOS error is raised. if inotifyRmWatch(monitor.fd, wd) < 0: - OSError() + OSError(OSLastError()) proc getEvent(m: PFSMonitor, fd: cint): seq[TMonitorEvent] = result = @[] @@ -184,7 +184,7 @@ proc FSMonitorRead(h: PObject) = proc toDelegate(m: PFSMonitor): PDelegate = result = newDelegate() result.deleVal = m - result.fd = m.fd + result.fd = (type(result.fd))(m.fd) result.mode = fmRead result.handleRead = FSMonitorRead result.open = true diff --git a/lib/pure/ftpclient.nim b/lib/pure/ftpclient.nim index b6127a9bc..f136e0016 100644 --- a/lib/pure/ftpclient.nim +++ b/lib/pure/ftpclient.nim @@ -95,7 +95,7 @@ type EInvalidReply* = object of ESynch EFTP* = object of ESynch -proc FTPClient*(address: string, port = TPort(21), +proc ftpClient*(address: string, port = TPort(21), user, pass = ""): PFTPClient = ## Create a ``PFTPClient`` object. new(result) @@ -298,7 +298,7 @@ proc getLines(ftp: PFTPClient, async: bool = false): bool = var readSocks: seq[TSocket] = @[ftp.getCSock()] # This is only needed here. Asyncio gets this socket... blockingOperation(ftp.getCSock()): - if readSocks.select(1) != 0 and ftp.getCSock() notin readSocks: + if readSocks.select(1) != 0 and ftp.getCSock() in readSocks: assertReply ftp.expectReply(), "226" return true @@ -315,7 +315,7 @@ proc listDirs*(ftp: PFTPClient, dir: string = "", assertReply ftp.send("NLST " & dir.normalizePathSep), ["125", "150"] if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard result = splitLines(ftp.job.lines) ftp.deleteJob() else: return @[] @@ -390,7 +390,7 @@ proc list*(ftp: PFTPClient, dir: string = "", async = false): string = assertReply(ftp.send("LIST" & " " & dir.normalizePathSep), ["125", "150"]) if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard result = ftp.job.lines ftp.deleteJob() else: @@ -405,7 +405,7 @@ proc retrText*(ftp: PFTPClient, file: string, async = false): string = assertReply ftp.send("RETR " & file.normalizePathSep), ["125", "150"] if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard result = ftp.job.lines ftp.deleteJob() else: @@ -434,7 +434,7 @@ proc getFile(ftp: PFTPClient, async = false): bool = if not async: var readSocks: seq[TSocket] = @[ftp.getCSock()] blockingOperation(ftp.getCSock()): - if readSocks.select(1) != 0 and ftp.getCSock() notin readSocks: + if readSocks.select(1) != 0 and ftp.getCSock() in readSocks: assertReply ftp.expectReply(), "226" return true @@ -460,7 +460,7 @@ proc retrFile*(ftp: PFTPClient, file, dest: string, async = false) = ftp.job.filename = file.normalizePathSep if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard ftp.deleteJob() proc doUpload(ftp: PFTPClient, async = false): bool = @@ -518,7 +518,7 @@ proc store*(ftp: PFTPClient, file, dest: string, async = false) = assertReply ftp.send("STOR " & dest.normalizePathSep), ["125", "150"] if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard ftp.deleteJob() proc close*(ftp: PFTPClient) = @@ -554,10 +554,10 @@ proc csockHandleRead(s: PAsyncSocket, ftp: PAsyncFTPClient) = ftp.handleEvent(ftp, r) -proc AsyncFTPClient*(address: string, port = TPort(21), +proc asyncFTPClient*(address: string, port = TPort(21), user, pass = "", handleEvent: proc (ftp: PAsyncFTPClient, ev: TFTPEvent) {.closure.} = - (proc (ftp: PAsyncFTPClient, ev: TFTPEvent) = nil)): PAsyncFTPClient = + (proc (ftp: PAsyncFTPClient, ev: TFTPEvent) = discard)): PAsyncFTPClient = ## Create a ``PAsyncFTPClient`` object. ## ## Use this if you want to use asyncio's dispatcher. @@ -604,7 +604,7 @@ when isMainModule: ftp.close() echo d.len else: assert(false) - var ftp = AsyncFTPClient("picheta.me", user = "test", pass = "asf", handleEvent = hev) + var ftp = asyncFTPClient("picheta.me", user = "test", pass = "asf", handleEvent = hev) d.register(ftp) d.len.echo() @@ -618,7 +618,7 @@ when isMainModule: when isMainModule and false: - var ftp = FTPClient("picheta.me", user = "asdasd", pass = "asfwq") + var ftp = ftpClient("picheta.me", user = "asdasd", pass = "asfwq") ftp.connect() echo ftp.pwd() echo ftp.list() diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim index 8a3135f89..ee05ad7e2 100644 --- a/lib/pure/hashes.nim +++ b/lib/pure/hashes.nim @@ -32,26 +32,26 @@ proc `!$`*(h: THash): THash {.inline.} = result = result xor (result shr 11) result = result +% result shl 15 -proc hashData*(Data: Pointer, Size: int): THash = +proc hashData*(data: pointer, size: int): THash = ## hashes an array of bytes of size `size` var h: THash = 0 when defined(js): var p: cstring asm """`p` = `Data`;""" else: - var p = cast[cstring](Data) + var p = cast[cstring](data) var i = 0 var s = size while s > 0: h = h !& ord(p[i]) - Inc(i) - Dec(s) + inc(i) + dec(s) result = !$h when defined(js): var objectID = 0 -proc hash*(x: Pointer): THash {.inline.} = +proc hash*(x: pointer): THash {.inline.} = ## efficient hashing of pointers when defined(js): asm """ @@ -126,6 +126,6 @@ proc hash*(x: float): THash {.inline.} = var y = x + 1.0 result = cast[ptr THash](addr(y))[] -proc hash*[A](x: openarray[A]): THash = +proc hash*[A](x: openArray[A]): THash = for it in items(x): result = result !& hash(it) result = !$result diff --git a/lib/pure/htmlgen.nim b/lib/pure/htmlgen.nim index 8d90f8589..63737d583 100644 --- a/lib/pure/htmlgen.nim +++ b/lib/pure/htmlgen.nim @@ -88,7 +88,7 @@ proc xmlCheckedTag*(e: PNimrodNode, tag: string, result.add(newStrLitNode("</")) result.add(newStrLitNode(tag)) result.add(newStrLitNode(">")) - result = NestList(!"&", result) + result = nestList(!"&", result) macro a*(e: expr): expr {.immediate.} = diff --git a/lib/pure/htmlparser.nim b/lib/pure/htmlparser.nim index d60d2e583..c38eb7063 100644 --- a/lib/pure/htmlparser.nim +++ b/lib/pure/htmlparser.nim @@ -17,11 +17,37 @@ ## ## echo loadHtml("mydirty.html") ## -## ## Every tag in the resulting tree is in lower case. ## ## **Note:** The resulting ``PXmlNode`` already uses the ``clientData`` field, ## so it cannot be used by clients of this library. +## +## Example: Transforming hyperlinks +## ================================ +## +## This code demonstrates how you can iterate over all the tags in an HTML file +## and write back the modified version. In this case we look for hyperlinks +## ending with the extension ``.rst`` and convert them to ``.html``. +## +## .. code-block:: nimrod +## +## import htmlparser +## import xmltree # To use '$' for PXmlNode +## import strtabs # To access PXmlAttributes +## import os # To use splitFile +## import strutils # To use cmpIgnoreCase +## +## proc transformHyperlinks() = +## let html = loadHTML("input.html") +## +## for a in html.findAll("a"): +## let href = a.attrs["href"] +## if not href.isNil: +## let (dir, filename, ext) = splitFile(href) +## if cmpIgnoreCase(ext, ".rst") == 0: +## a.attrs["href"] = dir / filename & ".html" +## +## writeFile("output.html", $html) import strutils, streams, parsexml, xmltree, unicode, strtabs @@ -454,7 +480,7 @@ proc untilElementEnd(x: var TXmlParser, result: PXmlNode, if htmlTag(x.elemName) in {tagOption, tagOptgroup}: errors.add(expected(x, result)) break - else: nil + else: discard result.addNode(parse(x, errors)) of xmlElementEnd: if cmpIgnoreCase(x.elemName, result.tag) == 0: @@ -521,14 +547,14 @@ proc parse(x: var TXmlParser, errors: var seq[string]): PXmlNode = var u = entityToUtf8(x.rawData) if u.len != 0: result = newText(u) next(x) - of xmlEof: nil + of xmlEof: discard proc parseHtml*(s: PStream, filename: string, errors: var seq[string]): PXmlNode = ## parses the XML from stream `s` and returns a ``PXmlNode``. Every ## occured parsing error is added to the `errors` sequence. var x: TXmlParser - open(x, s, filename, {reportComments}) + open(x, s, filename, {reportComments, reportWhitespace}) next(x) # skip the DOCTYPE: if x.kind == xmlSpecial: next(x) diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index 2c0e7b835..bb9835fe7 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -220,9 +220,8 @@ proc parseResponse(s: TSocket, getBody: bool, timeout: int): TResponse = inc(linei, le) if line[linei] != ':': httpError("invalid headers") inc(linei) # Skip : - linei += skipWhitespace(line, linei) - result.headers[name] = line[linei.. -1] + result.headers[name] = line[linei.. -1].strip() if not fullyRead: httpError("Connection was closed before full request has been made") if getBody: diff --git a/lib/pure/httpserver.nim b/lib/pure/httpserver.nim index 043e713a6..901fdc779 100644 --- a/lib/pure/httpserver.nim +++ b/lib/pure/httpserver.nim @@ -401,8 +401,9 @@ proc nextAsync(s: PAsyncHTTPServer) = var value = "" i = header.parseUntil(key, ':') inc(i) # skip : - i += header.skipWhiteSpace(i) - i += header.parseUntil(value, {'\c', '\L'}, i) + if i < header.len: + i += header.skipWhiteSpace(i) + i += header.parseUntil(value, {'\c', '\L'}, i) s.headers[key] = value else: s.client.close() diff --git a/lib/pure/irc.nim b/lib/pure/irc.nim index 74ad7e26a..c1b519b0b 100644 --- a/lib/pure/irc.nim +++ b/lib/pure/irc.nim @@ -98,6 +98,7 @@ type params*: seq[string] ## Parameters of the IRC message origin*: string ## The channel/user that this msg originated from raw*: string ## Raw IRC message + timestamp*: TTime ## UNIX epoch time the message was received proc send*(irc: PIRC, message: string, sendImmediately = false) = ## Sends ``message`` as a raw command. It adds ``\c\L`` for you. @@ -160,9 +161,10 @@ proc isNumber(s: string): bool = result = i == s.len and s.len > 0 proc parseMessage(msg: string): TIRCEvent = - result.typ = EvMsg - result.cmd = MUnknown - result.raw = msg + result.typ = EvMsg + result.cmd = MUnknown + result.raw = msg + result.timestamp = times.getTime() var i = 0 # Process the prefix if msg[i] == ':': @@ -344,7 +346,7 @@ proc poll*(irc: PIRC, ev: var TIRCEvent, var line = TaintedString"" var socks = @[irc.sock] var ret = socks.select(timeout) - if socks.len() == 0 and ret != 0: + if socks.len() != 0 and ret != 0: irc.sock.readLine(line) ev = irc.processLine(line.string) result = true @@ -474,12 +476,12 @@ when isMainModule: var client = irc("amber.tenthbit.net", nick="TestBot1234", joinChans = @["#flood"]) client.connect() - while True: + while true: var event: TIRCEvent if client.poll(event): case event.typ of EvConnected: - nil + discard of EvDisconnected: break of EvMsg: diff --git a/lib/pure/json.nim b/lib/pure/json.nim index df20bd852..7424bbae9 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -135,7 +135,7 @@ proc str*(my: TJsonParser): string {.inline.} = assert(my.kind in {jsonInt, jsonFloat, jsonString}) return my.a -proc getInt*(my: TJsonParser): biggestInt {.inline.} = +proc getInt*(my: TJsonParser): BiggestInt {.inline.} = ## returns the number for the event: ``jsonInt`` assert(my.kind == jsonInt) return parseBiggestInt(my.a) @@ -151,11 +151,11 @@ proc kind*(my: TJsonParser): TJsonEventKind {.inline.} = proc getColumn*(my: TJsonParser): int {.inline.} = ## get the current column the parser has arrived at. - result = getColNumber(my, my.bufPos) + result = getColNumber(my, my.bufpos) proc getLine*(my: TJsonParser): int {.inline.} = ## get the current line the parser has arrived at. - result = my.linenumber + result = my.lineNumber proc getFilename*(my: TJsonParser): string {.inline.} = ## get the filename of the file that the parser processes. @@ -173,7 +173,7 @@ proc errorMsgExpected*(my: TJsonParser, e: string): string = result = "$1($2, $3) Error: $4" % [ my.filename, $getLine(my), $getColumn(my), e & " expected"] -proc handleHexChar(c: Char, x: var int): bool = +proc handleHexChar(c: char, x: var int): bool = result = true # Success case c of '0'..'9': x = (x shl 4) or (ord(c) - ord('0')) @@ -227,11 +227,11 @@ proc parseString(my: var TJsonParser): TTokKind = add(my.a, buf[pos]) inc(pos) of '\c': - pos = lexbase.HandleCR(my, pos) + pos = lexbase.handleCR(my, pos) buf = my.buf add(my.a, '\c') of '\L': - pos = lexbase.HandleLF(my, pos) + pos = lexbase.handleLF(my, pos) buf = my.buf add(my.a, '\L') else: @@ -253,11 +253,11 @@ proc skip(my: var TJsonParser) = of '\0': break of '\c': - pos = lexbase.HandleCR(my, pos) + pos = lexbase.handleCR(my, pos) buf = my.buf break of '\L': - pos = lexbase.HandleLF(my, pos) + pos = lexbase.handleLF(my, pos) buf = my.buf break else: @@ -271,10 +271,10 @@ proc skip(my: var TJsonParser) = my.err = errEOC_Expected break of '\c': - pos = lexbase.HandleCR(my, pos) + pos = lexbase.handleCR(my, pos) buf = my.buf of '\L': - pos = lexbase.HandleLF(my, pos) + pos = lexbase.handleLF(my, pos) buf = my.buf of '*': inc(pos) @@ -286,12 +286,12 @@ proc skip(my: var TJsonParser) = else: break of ' ', '\t': - Inc(pos) + inc(pos) of '\c': - pos = lexbase.HandleCR(my, pos) + pos = lexbase.handleCR(my, pos) buf = my.buf of '\L': - pos = lexbase.HandleLF(my, pos) + pos = lexbase.handleLF(my, pos) buf = my.buf else: break @@ -517,7 +517,7 @@ type of JString: str*: string of JInt: - num*: biggestInt + num*: BiggestInt of JFloat: fnum*: float of JBool: @@ -535,30 +535,30 @@ proc raiseParseErr*(p: TJsonParser, msg: string) {.noinline, noreturn.} = ## raises an `EJsonParsingError` exception. raise newException(EJsonParsingError, errorMsgExpected(p, msg)) -proc newJString*(s: String): PJsonNode = +proc newJString*(s: string): PJsonNode = ## Creates a new `JString PJsonNode`. new(result) result.kind = JString result.str = s -proc newJStringMove(s: String): PJsonNode = +proc newJStringMove(s: string): PJsonNode = new(result) result.kind = JString shallowCopy(result.str, s) -proc newJInt*(n: biggestInt): PJsonNode = +proc newJInt*(n: BiggestInt): PJsonNode = ## Creates a new `JInt PJsonNode`. new(result) result.kind = JInt result.num = n -proc newJFloat*(n: Float): PJsonNode = +proc newJFloat*(n: float): PJsonNode = ## Creates a new `JFloat PJsonNode`. new(result) result.kind = JFloat result.fnum = n -proc newJBool*(b: Bool): PJsonNode = +proc newJBool*(b: bool): PJsonNode = ## Creates a new `JBool PJsonNode`. new(result) result.kind = JBool @@ -587,7 +587,7 @@ proc `%`*(s: string): PJsonNode = result.kind = JString result.str = s -proc `%`*(n: biggestInt): PJsonNode = +proc `%`*(n: BiggestInt): PJsonNode = ## Generic constructor for JSON data. Creates a new `JInt PJsonNode`. new(result) result.kind = JInt @@ -612,7 +612,7 @@ proc `%`*(keyVals: openArray[tuple[key: string, val: PJsonNode]]): PJsonNode = newSeq(result.fields, keyVals.len) for i, p in pairs(keyVals): result.fields[i] = p -proc `%`*(elements: openArray[PJSonNode]): PJsonNode = +proc `%`*(elements: openArray[PJsonNode]): PJsonNode = ## Generic constructor for JSON data. Creates a new `JArray PJsonNode` new(result) result.kind = JArray @@ -626,9 +626,9 @@ proc len*(n: PJsonNode): int = case n.kind of JArray: result = n.elems.len of JObject: result = n.fields.len - else: nil + else: discard -proc `[]`*(node: PJsonNode, name: String): PJsonNode = +proc `[]`*(node: PJsonNode, name: string): PJsonNode = ## Gets a field from a `JObject`. Returns nil if the key is not found. assert(node.kind == JObject) for key, item in items(node.fields): @@ -636,17 +636,18 @@ proc `[]`*(node: PJsonNode, name: String): PJsonNode = return item return nil -proc `[]`*(node: PJsonNode, index: Int): PJsonNode = +proc `[]`*(node: PJsonNode, index: int): PJsonNode = ## Gets the node at `index` in an Array. assert(node.kind == JArray) return node.elems[index] -proc hasKey*(node: PJsonNode, key: String): Bool = +proc hasKey*(node: PJsonNode, key: string): bool = ## Checks if `key` exists in `node`. assert(node.kind == JObject) for k, item in items(node.fields): - if k == key: return True -proc existsKey*(node: PJsonNode, key: String): Bool {.deprecated.} = node.hasKey(key) + if k == key: return true + +proc existsKey*(node: PJsonNode, key: string): bool {.deprecated.} = node.hasKey(key) ## Deprecated for `hasKey` proc add*(father, child: PJsonNode) = @@ -661,7 +662,7 @@ proc add*(obj: PJsonNode, key: string, val: PJsonNode) = assert obj.kind == JObject obj.fields.add((key, val)) -proc `[]=`*(obj: PJsonNode, key: String, val: PJsonNode) = +proc `[]=`*(obj: PJsonNode, key: string, val: PJsonNode) = ## Sets a field from a `JObject`. Performs a check for duplicate keys. assert(obj.kind == JObject) for i in 0..obj.fields.len-1: @@ -706,7 +707,7 @@ proc copy*(p: PJsonNode): PJsonNode = proc indent(s: var string, i: int) = s.add(repeatChar(i)) -proc newIndent(curr, indent: int, ml: bool): Int = +proc newIndent(curr, indent: int, ml: bool): int = if ml: return curr + indent else: return indent @@ -730,8 +731,8 @@ proc escapeJson*(s: string): string = result.add(toHex(r, 4)) result.add("\"") -proc toPretty(result: var string, node: PJsonNode, indent = 2, ml = True, - lstArr = False, currIndent = 0) = +proc toPretty(result: var string, node: PJsonNode, indent = 2, ml = true, + lstArr = false, currIndent = 0) = case node.kind of JObject: if currIndent != 0 and not lstArr: result.nl(ml) @@ -747,7 +748,7 @@ proc toPretty(result: var string, node: PJsonNode, indent = 2, ml = True, result.indent(newIndent(currIndent, indent, ml)) result.add(escapeJson(node.fields[i].key)) result.add(": ") - toPretty(result, node.fields[i].val, indent, ml, False, + toPretty(result, node.fields[i].val, indent, ml, false, newIndent(currIndent, indent, ml)) result.nl(ml) result.indent(currIndent) # indent the same as { @@ -776,7 +777,7 @@ proc toPretty(result: var string, node: PJsonNode, indent = 2, ml = True, result.add(", ") result.nl(ml) # New Line toPretty(result, node.elems[i], indent, ml, - True, newIndent(currIndent, indent, ml)) + true, newIndent(currIndent, indent, ml)) result.nl(ml) result.indent(currIndent) result.add("]") @@ -785,18 +786,18 @@ proc toPretty(result: var string, node: PJsonNode, indent = 2, ml = True, if lstArr: result.indent(currIndent) result.add("null") -proc pretty*(node: PJsonNode, indent = 2): String = +proc pretty*(node: PJsonNode, indent = 2): string = ## Converts `node` to its JSON Representation, with indentation and ## on multiple lines. result = "" toPretty(result, node, indent) -proc `$`*(node: PJsonNode): String = +proc `$`*(node: PJsonNode): string = ## Converts `node` to its JSON Representation on one line. result = "" - toPretty(result, node, 1, False) + toPretty(result, node, 1, false) -iterator items*(node: PJsonNode): PJSonNode = +iterator items*(node: PJsonNode): PJsonNode = ## Iterator for the items of `node`. `node` has to be a JArray. assert node.kind == JArray for i in items(node.elems): diff --git a/lib/pure/lexbase.nim b/lib/pure/lexbase.nim index 2756290d8..eee95e2e6 100644 --- a/lib/pure/lexbase.nim +++ b/lib/pure/lexbase.nim @@ -31,7 +31,7 @@ type buf*: cstring ## the buffer itself bufLen*: int ## length of buffer in characters input: PStream ## the input stream - LineNumber*: int ## the current line number + lineNumber*: int ## the current line number sentinel: int lineStart: int # index of last line start in buffer fileOpened: bool @@ -48,11 +48,11 @@ proc getCurrentLine*(L: TBaseLexer, marker: bool = true): string proc getColNumber*(L: TBaseLexer, pos: int): int ## retrieves the current column. -proc HandleCR*(L: var TBaseLexer, pos: int): int +proc handleCR*(L: var TBaseLexer, pos: int): int ## Call this if you scanned over '\c' in the buffer; it returns the the ## position to continue the scanning from. `pos` must be the position ## of the '\c'. -proc HandleLF*(L: var TBaseLexer, pos: int): int +proc handleLF*(L: var TBaseLexer, pos: int): int ## Call this if you scanned over '\L' in the buffer; it returns the the ## position to continue the scanning from. `pos` must be the position ## of the '\L'. @@ -66,7 +66,7 @@ proc close(L: var TBaseLexer) = dealloc(L.buf) close(L.input) -proc FillBuffer(L: var TBaseLexer) = +proc fillBuffer(L: var TBaseLexer) = var charsRead, toCopy, s: int # all are in characters, # not bytes (in case this @@ -75,10 +75,10 @@ proc FillBuffer(L: var TBaseLexer) = # we know here that pos == L.sentinel, but not if this proc # is called the first time by initBaseLexer() assert(L.sentinel < L.bufLen) - toCopy = L.BufLen - L.sentinel - 1 + toCopy = L.bufLen - L.sentinel - 1 assert(toCopy >= 0) if toCopy > 0: - MoveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize) + moveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize) # "moveMem" handles overlapping regions charsRead = readData(L.input, addr(L.buf[toCopy]), (L.sentinel + 1) * chrSize) div chrSize @@ -91,7 +91,7 @@ proc FillBuffer(L: var TBaseLexer) = dec(s) # BUGFIX (valgrind) while true: assert(s < L.bufLen) - while (s >= 0) and not (L.buf[s] in NewLines): Dec(s) + while (s >= 0) and not (L.buf[s] in NewLines): dec(s) if s >= 0: # we found an appropriate character for a sentinel: L.sentinel = s @@ -99,11 +99,11 @@ proc FillBuffer(L: var TBaseLexer) = else: # rather than to give up here because the line is too long, # double the buffer's size and try again: - oldBufLen = L.BufLen - L.bufLen = L.BufLen * 2 + oldBufLen = L.bufLen + L.bufLen = L.bufLen * 2 L.buf = cast[cstring](realloc(L.buf, L.bufLen * chrSize)) - assert(L.bufLen - oldBuflen == oldBufLen) - charsRead = ReadData(L.input, addr(L.buf[oldBufLen]), + assert(L.bufLen - oldBufLen == oldBufLen) + charsRead = readData(L.input, addr(L.buf[oldBufLen]), oldBufLen * chrSize) div chrSize if charsRead < oldBufLen: L.buf[oldBufLen + charsRead] = EndOfFile @@ -121,19 +121,19 @@ proc fillBaseLexer(L: var TBaseLexer, pos: int): int = result = 0 L.lineStart = result -proc HandleCR(L: var TBaseLexer, pos: int): int = +proc handleCR(L: var TBaseLexer, pos: int): int = assert(L.buf[pos] == '\c') - inc(L.linenumber) + inc(L.lineNumber) result = fillBaseLexer(L, pos) if L.buf[result] == '\L': result = fillBaseLexer(L, result) -proc HandleLF(L: var TBaseLexer, pos: int): int = +proc handleLF(L: var TBaseLexer, pos: int): int = assert(L.buf[pos] == '\L') - inc(L.linenumber) + inc(L.lineNumber) result = fillBaseLexer(L, pos) #L.lastNL := result-1; // BUGFIX: was: result; -proc skip_UTF_8_BOM(L: var TBaseLexer) = +proc skipUtf8Bom(L: var TBaseLexer) = if (L.buf[0] == '\xEF') and (L.buf[1] == '\xBB') and (L.buf[2] == '\xBF'): inc(L.bufpos, 3) inc(L.lineStart, 3) @@ -147,9 +147,9 @@ proc open(L: var TBaseLexer, input: PStream, bufLen: int = 8192) = L.buf = cast[cstring](alloc(bufLen * chrSize)) L.sentinel = bufLen - 1 L.lineStart = 0 - L.linenumber = 1 # lines start at 1 + L.lineNumber = 1 # lines start at 1 fillBuffer(L) - skip_UTF_8_BOM(L) + skipUtf8Bom(L) proc getColNumber(L: TBaseLexer, pos: int): int = result = abs(pos - L.lineStart) @@ -163,5 +163,5 @@ proc getCurrentLine(L: TBaseLexer, marker: bool = true): string = inc(i) add(result, "\n") if marker: - add(result, RepeatChar(getColNumber(L, L.bufpos)) & "^\n") + add(result, repeatChar(getColNumber(L, L.bufpos)) & "^\n") diff --git a/lib/pure/logging.nim b/lib/pure/logging.nim new file mode 100644 index 000000000..284384b37 --- /dev/null +++ b/lib/pure/logging.nim @@ -0,0 +1,267 @@ +# +# +# Nimrod's Runtime Library +# (c) Copyright 2014 Andreas Rumpf, Dominik Picheta +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This module implements a simple logger. It has been designed to be as simple +## as possible to avoid bloat, if this library does not fullfill your needs, +## write your own. +## +## Format strings support the following variables which must be prefixed with +## the dollar operator (``$``): +## +## ============ ======================= +## Operator Output +## ============ ======================= +## $date Current date +## $time Current time +## $app ``os.getAppFilename()`` +## ============ ======================= +## +## +## The following example demonstrates logging to three different handlers +## simultaneously: +## +## .. code-block:: nimrod +## +## var L = newConsoleLogger() +## var fL = newFileLogger("test.log", fmtStr = verboseFmtStr) +## var rL = newRollingFileLogger("rolling.log", fmtStr = verboseFmtStr) +## handlers.add(L) +## handlers.add(fL) +## handlers.add(rL) +## info("920410:52 accepted") +## warn("4 8 15 16 23 4-- Error") +## error("922044:16 SYSTEM FAILURE") +## fatal("SYSTEM FAILURE SYSTEM FAILURE") + +import strutils, os, times + +type + TLevel* = enum ## logging level + lvlAll, ## all levels active + lvlDebug, ## debug level (and any above) active + lvlInfo, ## info level (and any above) active + lvlWarn, ## warn level (and any above) active + lvlError, ## error level (and any above) active + lvlFatal, ## fatal level (and any above) active + lvlNone ## no levels active + +const + LevelNames*: array [TLevel, string] = [ + "DEBUG", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "NONE" + ] + + defaultFmtStr* = "" ## default string between log level and message per logger + verboseFmtStr* = "$date $time " + +type + PLogger* = ref object of PObject ## abstract logger; the base type of all loggers + levelThreshold*: TLevel ## only messages of level >= levelThreshold + ## should be processed + fmtStr: string ## = defaultFmtStr by default, see substituteLog for $date etc. + + PConsoleLogger* = ref object of PLogger ## logger that writes the messages to the + ## console + + PFileLogger* = ref object of PLogger ## logger that writes the messages to a file + f: TFile + + PRollingFileLogger* = ref object of PFileLogger ## logger that writes the + ## messages to a file and + ## performs log rotation + maxLines: int # maximum number of lines + curLine : int + baseName: string # initial filename + baseMode: TFileMode # initial file mode + logFiles: int # how many log files already created, e.g. basename.1, basename.2... + +proc substituteLog(frmt: string): string = + ## converts $date to the current date + ## converts $time to the current time + ## converts $app to getAppFilename() + ## converts + result = newStringOfCap(frmt.len + 20) + var i = 0 + while i < frmt.len: + if frmt[i] != '$': + result.add(frmt[i]) + inc(i) + else: + inc(i) + var v = "" + var app = getAppFilename() + while frmt[i] in IdentChars: + v.add(toLower(frmt[i])) + inc(i) + case v + of "date": result.add(getDateStr()) + of "time": result.add(getClockStr()) + of "app": result.add(app) + of "appdir": result.add(app.splitFile.dir) + of "appname": result.add(app.splitFile.name) + +method log*(logger: PLogger, level: TLevel, + frmt: string, args: varargs[string, `$`]) {.raises: [EBase], tags: [FTime, FWriteIO, FReadIO].} = + ## Override this method in custom loggers. Default implementation does + ## nothing. + discard + +method log*(logger: PConsoleLogger, level: TLevel, + frmt: string, args: varargs[string, `$`]) = + ## Logs to the console using ``logger`` only. + if level >= logger.levelThreshold: + writeln(stdout, LevelNames[level], " ", substituteLog(logger.fmtStr), + frmt % args) + +method log*(logger: PFileLogger, level: TLevel, + frmt: string, args: varargs[string, `$`]) = + ## Logs to a file using ``logger`` only. + if level >= logger.levelThreshold: + writeln(logger.f, LevelNames[level], " ", + substituteLog(logger.fmtStr), frmt % args) + +proc defaultFilename*(): string = + ## Returns the default filename for a logger. + var (path, name, ext) = splitFile(getAppFilename()) + result = changeFileExt(path / name, "log") + +proc newConsoleLogger*(levelThreshold = lvlAll, fmtStr = defaultFmtStr): PConsoleLogger = + ## Creates a new console logger. This logger logs to the console. + new result + result.fmtStr = fmtStr + result.levelThreshold = levelThreshold + +proc newFileLogger*(filename = defaultFilename(), + mode: TFileMode = fmAppend, + levelThreshold = lvlAll, + fmtStr = defaultFmtStr): PFileLogger = + ## Creates a new file logger. This logger logs to a file. + new(result) + result.levelThreshold = levelThreshold + result.f = open(filename, mode) + result.fmtStr = fmtStr + +# ------ + +proc countLogLines(logger: PRollingFileLogger): int = + result = 0 + for line in logger.f.lines(): + result.inc() + +proc countFiles(filename: string): int = + # Example: file.log.1 + result = 0 + let (dir, name, ext) = splitFile(filename) + for kind, path in walkDir(dir): + if kind == pcFile: + let llfn = name & ext & ExtSep + if path.extractFilename.startsWith(llfn): + let numS = path.extractFilename[llfn.len .. -1] + try: + let num = parseInt(numS) + if num > result: + result = num + except EInvalidValue: discard + +proc newRollingFileLogger*(filename = defaultFilename(), + mode: TFileMode = fmReadWrite, + levelThreshold = lvlAll, + fmtStr = defaultFmtStr, + maxLines = 1000): PRollingFileLogger = + ## Creates a new rolling file logger. Once a file reaches ``maxLines`` lines + ## a new log file will be started and the old will be renamed. + new(result) + result.levelThreshold = levelThreshold + result.fmtStr = defaultFmtStr + result.maxLines = maxLines + result.f = open(filename, mode) + result.curLine = 0 + result.baseName = filename + result.baseMode = mode + + result.logFiles = countFiles(filename) + + if mode == fmAppend: + # We need to get a line count because we will be appending to the file. + result.curLine = countLogLines(result) + +proc rotate(logger: PRollingFileLogger) = + let (dir, name, ext) = splitFile(logger.baseName) + for i in countdown(logger.logFiles, 0): + let srcSuff = if i != 0: ExtSep & $i else: "" + moveFile(dir / (name & ext & srcSuff), + dir / (name & ext & ExtSep & $(i+1))) + +method log*(logger: PRollingFileLogger, level: TLevel, + frmt: string, args: varargs[string, `$`]) = + ## Logs to a file using rolling ``logger`` only. + if level >= logger.levelThreshold: + if logger.curLine >= logger.maxLines: + logger.f.close() + rotate(logger) + logger.logFiles.inc + logger.curLine = 0 + logger.f = open(logger.baseName, logger.baseMode) + + writeln(logger.f, LevelNames[level], " ", frmt % args) + logger.curLine.inc + +# -------- + +var + level* = lvlAll ## global log filter + handlers*: seq[PLogger] = @[] ## handlers with their own log levels + +proc logLoop(level: TLevel, frmt: string, args: varargs[string, `$`]) = + for logger in items(handlers): + if level >= logger.levelThreshold: + log(logger, level, frmt, args) + +template log*(level: TLevel, frmt: string, args: varargs[string, `$`]) = + ## Logs a message to all registered handlers at the given level. + bind logLoop + bind `%` + bind logging.Level + + if level >= logging.Level: + logLoop(level, frmt, args) + +template debug*(frmt: string, args: varargs[string, `$`]) = + ## Logs a debug message to all registered handlers. + log(lvlDebug, frmt, args) + +template info*(frmt: string, args: varargs[string, `$`]) = + ## Logs an info message to all registered handlers. + log(lvlInfo, frmt, args) + +template warn*(frmt: string, args: varargs[string, `$`]) = + ## Logs a warning message to all registered handlers. + log(lvlWarn, frmt, args) + +template error*(frmt: string, args: varargs[string, `$`]) = + ## Logs an error message to all registered handlers. + log(lvlError, frmt, args) + +template fatal*(frmt: string, args: varargs[string, `$`]) = + ## Logs a fatal error message to all registered handlers. + log(lvlFatal, frmt, args) + + +# -------------- + +when isMainModule: + var L = newConsoleLogger() + var fL = newFileLogger("test.log", fmtStr = verboseFmtStr) + var rL = newRollingFileLogger("rolling.log", fmtStr = verboseFmtStr) + handlers.add(L) + handlers.add(fL) + handlers.add(rL) + for i in 0 .. 25: + info("hello" & $i, []) + + diff --git a/lib/pure/matchers.nim b/lib/pure/matchers.nim index b57e0c45a..2db7fa660 100644 --- a/lib/pure/matchers.nim +++ b/lib/pure/matchers.nim @@ -54,7 +54,7 @@ proc parseInt*(s: string, value: var int, validRange: TSlice[int]) {. try: discard parseutils.parseInt(s, x, 0) except EOverflow: - nil + discard if x in validRange: value = x when isMainModule: diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 35b9607e0..062cfae25 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -94,7 +94,7 @@ proc nextPowerOfTwo*(x: int): int = result = result or (result shr 4) result = result or (result shr 2) result = result or (result shr 1) - Inc(result) + inc(result) proc countBits32*(n: int32): int {.noSideEffect.} = ## counts the set bits in `n`. @@ -103,17 +103,17 @@ proc countBits32*(n: int32): int {.noSideEffect.} = 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.} = +proc sum*[T](x: openArray[T]): T {.noSideEffect.} = ## computes the sum of the elements in `x`. ## If `x` is empty, 0 is returned. for i in items(x): result = result + i -proc mean*(x: openarray[float]): float {.noSideEffect.} = +proc mean*(x: openArray[float]): float {.noSideEffect.} = ## computes the mean of the elements in `x`. ## If `x` is empty, NaN is returned. result = sum(x) / toFloat(len(x)) -proc variance*(x: openarray[float]): float {.noSideEffect.} = +proc variance*(x: openArray[float]): float {.noSideEffect.} = ## computes the variance of the elements in `x`. ## If `x` is empty, NaN is returned. result = 0.0 diff --git a/lib/pure/md5.nim b/lib/pure/md5.nim index e75f80b4c..0328932fd 100644 --- a/lib/pure/md5.nim +++ b/lib/pure/md5.nim @@ -16,9 +16,9 @@ type MD5Digest* = array[0..15, int8] MD5Buffer = array[0..63, int8] MD5Context* {.final.} = object - State: MD5State - Count: array[0..1, int32] - Buffer: MD5Buffer + state: MD5State + count: array[0..1, int32] + buffer: MD5Buffer const padding: cstring = "\x80\0\0\0" & @@ -32,16 +32,16 @@ const "\0\0\0\0" proc F(x, y, z: int32): int32 {.inline.} = - Result = (x and y) or ((not x) and z) + 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)) + result = (x and z) or (y and (not z)) proc H(x, y, z: int32): int32 {.inline.} = - Result = x xor y xor z + result = x xor y xor z proc I(x, y, z: int32): int32 {.inline.} = - Result = y xor (x or (not z)) + 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))) @@ -75,7 +75,7 @@ proc encode(dest: var MD5Block, src: cstring) = ord(src[j+3]) shl 24) inc(j, 4) -proc decode(dest: var openarray[int8], src: openarray[int32]) = +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) @@ -87,7 +87,7 @@ proc decode(dest: var openarray[int8], src: openarray[int32]) = proc transform(Buffer: pointer, State: var MD5State) = var myBlock: MD5Block - encode(myBlock, cast[cstring](buffer)) + encode(myBlock, cast[cstring](Buffer)) var a = State[0] var b = State[1] var c = State[2] @@ -161,7 +161,7 @@ proc transform(Buffer: pointer, State: var MD5State) = State[2] = State[2] +% c State[3] = State[3] +% d -proc MD5Init*(c: var MD5Context) = +proc md5Init*(c: var MD5Context) = ## initializes a MD5Context c.State[0] = 0x67452301'i32 c.State[1] = 0xEFCDAB89'i32 @@ -169,64 +169,64 @@ proc MD5Init*(c: var MD5Context) = c.State[3] = 0x10325476'i32 c.Count[0] = 0'i32 c.Count[1] = 0'i32 - ZeroMem(addr(c.Buffer), SizeOf(MD5Buffer)) + zeroMem(addr(c.Buffer), sizeof(MD5Buffer)) -proc MD5Update*(c: var MD5Context, input: cstring, len: int) = +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 + 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) + 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) + transform(addr(input[i]), c.State) inc(i, 64) - CopyMem(addr(c.Buffer[0]), addr(Input[i]), len-i) + copyMem(addr(c.Buffer[0]), addr(input[i]), len-i) else: - CopyMem(addr(c.Buffer[Index]), addr(Input[0]), len) + copyMem(addr(c.Buffer[Index]), addr(input[0]), len) -proc MD5Final*(c: var MD5Context, digest: var MD5Digest) = +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) + 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) + md5Update(c, padding, PadLen) + md5Update(c, cast[cstring](addr(Bits)), 8) decode(digest, c.State) - ZeroMem(addr(c), SizeOf(MD5Context)) + 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) + 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]) + add(result, Digits[(D[i] shr 4) and 0xF]) + add(result, Digits[D[i] and 0xF]) proc getMD5*(s: string): string = ## computes an MD5 value of `s` and returns its string representation var c: MD5Context d: MD5Digest - MD5Init(c) - MD5Update(c, cstring(s), len(s)) - MD5Final(c, d) + md5Init(c) + md5Update(c, cstring(s), len(s)) + md5Final(c, d) result = $d proc `==`*(D1, D2: MD5Digest): bool = diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim index 9f4094b40..8c404abe8 100644 --- a/lib/pure/memfiles.nim +++ b/lib/pure/memfiles.nim @@ -52,9 +52,9 @@ proc open*(filename: string, mode: TFileMode = fmRead, when defined(windows): template fail(errCode: TOSErrorCode, msg: expr) = rollback() - if result.fHandle != 0: discard CloseHandle(result.fHandle) - if result.mapHandle != 0: discard CloseHandle(result.mapHandle) - OSError(errCode) + if result.fHandle != 0: discard closeHandle(result.fHandle) + if result.mapHandle != 0: discard closeHandle(result.mapHandle) + osError(errCode) # return false #raise newException(EIO, msg) @@ -69,36 +69,36 @@ proc open*(filename: string, mode: TFileMode = fmRead, 0) when useWinUnicode: - result.fHandle = callCreateFile(CreateFileW, newWideCString(filename)) + result.fHandle = callCreateFile(createFileW, newWideCString(filename)) else: result.fHandle = callCreateFile(CreateFileA, filename) if result.fHandle == INVALID_HANDLE_VALUE: - fail(OSLastError(), "error opening file") + fail(osLastError(), "error opening file") if newFileSize != -1: var sizeHigh = int32(newFileSize shr 32) sizeLow = int32(newFileSize and 0xffffffff) - var status = SetFilePointer(result.fHandle, sizeLow, addr(sizeHigh), + var status = setFilePointer(result.fHandle, sizeLow, addr(sizeHigh), FILE_BEGIN) - let lastErr = OSLastError() + let lastErr = osLastError() if (status == INVALID_SET_FILE_POINTER and lastErr.int32 != NO_ERROR) or - (SetEndOfFile(result.fHandle) == 0): + (setEndOfFile(result.fHandle) == 0): fail(lastErr, "error setting file size") # since the strings are always 'nil', we simply always call # CreateFileMappingW which should be slightly faster anyway: - result.mapHandle = CreateFileMappingW( + result.mapHandle = createFileMappingW( result.fHandle, nil, if readonly: PAGE_READONLY else: PAGE_READWRITE, 0, 0, nil) if result.mapHandle == 0: - fail(OSLastError(), "error creating mapping") + fail(osLastError(), "error creating mapping") - result.mem = MapViewOfFileEx( + result.mem = mapViewOfFileEx( result.mapHandle, if readonly: FILE_MAP_READ else: FILE_MAP_WRITE, int32(offset shr 32), @@ -107,12 +107,12 @@ proc open*(filename: string, mode: TFileMode = fmRead, nil) if result.mem == nil: - fail(OSLastError(), "error mapping view") + fail(osLastError(), "error mapping view") var hi, low: int32 - low = GetFileSize(result.fHandle, addr(hi)) + low = getFileSize(result.fHandle, addr(hi)) if low == INVALID_FILE_SIZE: - fail(OSLastError(), "error getting file size") + fail(osLastError(), "error getting file size") else: var fileSize = (int64(hi) shr 32) or low if mappedSize != -1: result.size = min(fileSize, mappedSize).int @@ -122,7 +122,7 @@ proc open*(filename: string, mode: TFileMode = fmRead, template fail(errCode: TOSErrorCode, msg: expr) = rollback() if result.handle != 0: discard close(result.handle) - OSError(errCode) + osError(errCode) var flags = if readonly: O_RDONLY else: O_RDWR @@ -133,22 +133,22 @@ proc open*(filename: string, mode: TFileMode = fmRead, if result.handle == -1: # XXX: errno is supposed to be set here # Is there an exception that wraps it? - fail(OSLastError(), "error opening file") + fail(osLastError(), "error opening file") if newFileSize != -1: if ftruncate(result.handle, newFileSize) == -1: - fail(OSLastError(), "error setting file size") + fail(osLastError(), "error setting file size") if mappedSize != -1: result.size = mappedSize else: - var stat: Tstat + var stat: TStat if fstat(result.handle, stat) != -1: # XXX: Hmm, this could be unsafe # Why is mmap taking int anyway? result.size = int(stat.st_size) else: - fail(OSLastError(), "error getting file size") + fail(osLastError(), "error getting file size") result.mem = mmap( nil, @@ -159,7 +159,7 @@ proc open*(filename: string, mode: TFileMode = fmRead, offset) if result.mem == cast[pointer](MAP_FAILED): - fail(OSLastError(), "file mapping failed") + fail(osLastError(), "file mapping failed") proc close*(f: var TMemFile) = ## closes the memory mapped file `f`. All changes are written back to the @@ -170,13 +170,13 @@ proc close*(f: var TMemFile) = when defined(windows): if f.fHandle != INVALID_HANDLE_VALUE: - lastErr = OSLastError() - error = UnmapViewOfFile(f.mem) == 0 - error = (CloseHandle(f.mapHandle) == 0) or error - error = (CloseHandle(f.fHandle) == 0) or error + lastErr = osLastError() + error = unmapViewOfFile(f.mem) == 0 + error = (closeHandle(f.mapHandle) == 0) or error + error = (closeHandle(f.fHandle) == 0) or error else: if f.handle != 0: - lastErr = OSLastError() + lastErr = osLastError() error = munmap(f.mem, f.size) != 0 error = (close(f.handle) != 0) or error @@ -189,5 +189,5 @@ proc close*(f: var TMemFile) = else: f.handle = 0 - if error: OSError(lastErr) + if error: osError(lastErr) diff --git a/lib/pure/mersenne.nim b/lib/pure/mersenne.nim new file mode 100644 index 000000000..2b12cce73 --- /dev/null +++ b/lib/pure/mersenne.nim @@ -0,0 +1,39 @@ +import unsigned + +type + TMersenneTwister* = object + mt: array[0..623, uint32] + index: int + +proc newMersenneTwister*(seed: int): TMersenneTwister = + result.index = 0 + result.mt[0]= uint32(seed) + for i in 1..623'u32: + result.mt[i]= (0x6c078965'u32 * (result.mt[i-1] xor (result.mt[i-1] shr 30'u32)) + i) + +proc generateNumbers(m: var TMersenneTwister) = + for i in 0..623: + var y = (m.mt[i] and 0x80000000'u32) + (m.mt[(i+1) mod 624] and 0x7fffffff'u32) + m.mt[i] = m.mt[(i+397) mod 624] xor uint32(y shr 1'u32) + if (y mod 2'u32) != 0: + m.mt[i] = m.mt[i] xor 0x9908b0df'u32 + +proc getNum*(m: var TMersenneTwister): int = + if m.index == 0: + generateNumbers(m) + var y = m.mt[m.index] + y = y xor (y shr 11'u32) + y = y xor ((7'u32 shl y) and 0x9d2c5680'u32) + y = y xor ((15'u32 shl y) and 0xefc60000'u32) + y = y xor (y shr 18'u32) + m.index = (m.index+1) mod 624 + return int(y) + + + +# Test +when isMainModule: + var mt = newMersenneTwister(2525) + + for i in 0..99: + echo mt.getNum \ No newline at end of file diff --git a/lib/pure/oids.nim b/lib/pure/oids.nim index 0fd1d8cd2..b3e74d2a1 100644 --- a/lib/pure/oids.nim +++ b/lib/pure/oids.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2013 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -28,7 +28,7 @@ proc hexbyte*(hex: char): int = of '0'..'9': result = (ord(hex) - ord('0')) of 'a'..'f': result = (ord(hex) - ord('a') + 10) of 'A'..'F': result = (ord(hex) - ord('A') + 10) - else: nil + else: discard proc parseOid*(str: cstring): TOid = ## parses an OID. @@ -52,6 +52,10 @@ proc oidToString*(oid: TOid, str: cstring) = inc(i) str[24] = '\0' +proc `$`*(oid: TOid): string = + result = newString(25) + oidToString(oid, result) + var incr: int fuzz: int32 diff --git a/lib/pure/os.nim b/lib/pure/os.nim index a39ca7b83..bb70f28b6 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -21,7 +21,7 @@ import when defined(windows): import winlean -elif defined(posix): +elif defined(posix): import posix else: {.error: "OS module not ported to your operating system!".} @@ -33,7 +33,7 @@ type ## from an environment variable FWriteEnv* = object of FWriteIO ## effect that denotes a write ## to an environment variable - + FReadDir* = object of FReadIO ## effect that denotes a write operation to ## the directory structure FWriteDir* = object of FWriteIO ## effect that denotes a write operation to @@ -93,11 +93,11 @@ when defined(Nimdoc): # only for proper documentation: elif defined(macos): const - curdir* = ':' - pardir* = "::" - dirsep* = ':' - altsep* = dirsep - pathsep* = ',' + CurDir* = ':' + ParDir* = "::" + DirSep* = ':' + AltSep* = Dirsep + PathSep* = ',' FileSystemCaseSensitive* = false ExeExt* = "" ScriptExt* = "" @@ -123,84 +123,88 @@ elif defined(macos): # grandparent etc. elif doslike: const - curdir* = '.' - pardir* = ".." - dirsep* = '\\' # seperator within paths - altsep* = '/' - pathSep* = ';' # seperator between paths + CurDir* = '.' + ParDir* = ".." + DirSep* = '\\' # seperator within paths + AltSep* = '/' + PathSep* = ';' # seperator between paths FileSystemCaseSensitive* = false ExeExt* = "exe" ScriptExt* = "bat" DynlibFormat* = "$1.dll" elif defined(PalmOS) or defined(MorphOS): const - dirsep* = '/' - altsep* = dirsep + DirSep* = '/' + AltSep* = Dirsep PathSep* = ';' - pardir* = ".." + ParDir* = ".." FileSystemCaseSensitive* = false ExeExt* = "" ScriptExt* = "" DynlibFormat* = "$1.prc" elif defined(RISCOS): const - dirsep* = '.' - altsep* = '.' - pardir* = ".." # is this correct? - pathSep* = ',' + DirSep* = '.' + AltSep* = '.' + ParDir* = ".." # is this correct? + PathSep* = ',' FileSystemCaseSensitive* = true ExeExt* = "" ScriptExt* = "" DynlibFormat* = "lib$1.so" else: # UNIX-like operating system const - curdir* = '.' - pardir* = ".." - dirsep* = '/' - altsep* = dirsep - pathSep* = ':' + CurDir* = '.' + ParDir* = ".." + DirSep* = '/' + AltSep* = DirSep + PathSep* = ':' FileSystemCaseSensitive* = true ExeExt* = "" ScriptExt* = "" DynlibFormat* = when defined(macosx): "lib$1.dylib" else: "lib$1.so" when defined(posix): - var - pathMax {.importc: "PATH_MAX", header: "<stdlib.h>".}: cint + when NoFakeVars: + const pathMax = 5000 # doesn't matter really. The concept of PATH_MAX + # doesn't work anymore on modern OSes. + else: + var + pathMax {.importc: "PATH_MAX", header: "<stdlib.h>".}: cint const ExtSep* = '.' ## The character which separates the base filename from the extension; ## for example, the '.' in ``os.nim``. -proc OSErrorMsg*(): string {.rtl, extern: "nos$1", deprecated.} = +proc osErrorMsg*(): string {.rtl, extern: "nos$1", deprecated.} = ## Retrieves the operating system's error flag, ``errno``. ## On Windows ``GetLastError`` is checked before ``errno``. ## Returns "" if no error occured. ## ## **Deprecated since version 0.9.4**: use the other ``OSErrorMsg`` proc. - + result = "" when defined(Windows): - var err = GetLastError() + var err = getLastError() if err != 0'i32: when useWinUnicode: - var msgbuf: widecstring - if FormatMessageW(0x00000100 or 0x00001000 or 0x00000200, + var msgbuf: WideCString + if formatMessageW(0x00000100 or 0x00001000 or 0x00000200, nil, err, 0, addr(msgbuf), 0, nil) != 0'i32: result = $msgbuf - if msgbuf != nil: LocalFree(cast[pointer](msgbuf)) + if msgbuf != nil: localFree(cast[pointer](msgbuf)) else: var msgbuf: cstring - if FormatMessageA(0x00000100 or 0x00001000 or 0x00000200, + if formatMessageA(0x00000100 or 0x00001000 or 0x00000200, nil, err, 0, addr(msgbuf), 0, nil) != 0'i32: result = $msgbuf - if msgbuf != nil: LocalFree(msgbuf) + if msgbuf != nil: localFree(msgbuf) if errno != 0'i32: result = $os.strerror(errno) {.push warning[deprecated]: off.} -proc OSError*(msg: string = "") {.noinline, rtl, extern: "nos$1", deprecated.} = +proc osError*(msg: string = "") {.noinline, rtl, extern: "nos$1", deprecated.} = ## raises an EOS exception with the given message ``msg``. ## If ``msg == ""``, the operating system's error flag ## (``errno``) is converted to a readable error message. On Windows @@ -209,7 +213,7 @@ proc OSError*(msg: string = "") {.noinline, rtl, extern: "nos$1", deprecated.} = ## ## **Deprecated since version 0.9.4**: use the other ``OSError`` proc. if len(msg) == 0: - var m = OSErrorMsg() + var m = osErrorMsg() raise newException(EOS, if m.len > 0: m else: "unknown OS error") else: raise newException(EOS, msg) @@ -218,7 +222,7 @@ proc OSError*(msg: string = "") {.noinline, rtl, extern: "nos$1", deprecated.} = proc `==`*(err1, err2: TOSErrorCode): bool {.borrow.} proc `$`*(err: TOSErrorCode): string {.borrow.} -proc OSErrorMsg*(errorCode: TOSErrorCode): string = +proc osErrorMsg*(errorCode: TOSErrorCode): string = ## Converts an OS error code into a human readable string. ## ## The error code can be retrieved using the ``OSLastError`` proc. @@ -233,22 +237,22 @@ proc OSErrorMsg*(errorCode: TOSErrorCode): string = when defined(Windows): if errorCode != TOSErrorCode(0'i32): when useWinUnicode: - var msgbuf: widecstring - if FormatMessageW(0x00000100 or 0x00001000 or 0x00000200, + var msgbuf: WideCString + if formatMessageW(0x00000100 or 0x00001000 or 0x00000200, nil, errorCode.int32, 0, addr(msgbuf), 0, nil) != 0'i32: result = $msgbuf - if msgbuf != nil: LocalFree(cast[pointer](msgbuf)) + if msgbuf != nil: localFree(cast[pointer](msgbuf)) else: var msgbuf: cstring - if FormatMessageA(0x00000100 or 0x00001000 or 0x00000200, + if formatMessageA(0x00000100 or 0x00001000 or 0x00000200, nil, errorCode.int32, 0, addr(msgbuf), 0, nil) != 0'i32: result = $msgbuf - if msgbuf != nil: LocalFree(msgbuf) + if msgbuf != nil: localFree(msgbuf) else: if errorCode != TOSErrorCode(0'i32): result = $os.strerror(errorCode.int32) -proc OSError*(errorCode: TOSErrorCode) = +proc osError*(errorCode: TOSErrorCode) = ## Raises an ``EOS`` exception. The ``errorCode`` will determine the ## message, ``OSErrorMsg`` will be used to get this message. ## @@ -256,14 +260,14 @@ proc OSError*(errorCode: TOSErrorCode) = ## ## If the error code is ``0`` or an error message could not be retrieved, ## the message ``unknown OS error`` will be used. - let msg = OSErrorMsg(errorCode) + let msg = osErrorMsg(errorCode) if msg == "": raise newException(EOS, "unknown OS error") else: raise newException(EOS, msg) {.push stackTrace:off.} -proc OSLastError*(): TOSErrorCode = +proc osLastError*(): TOSErrorCode = ## Retrieves the last operating system error code. ## ## This procedure is useful in the event when an OS call fails. In that case @@ -276,19 +280,25 @@ proc OSLastError*(): TOSErrorCode = ## On Windows some OS calls can reset the error code to ``0`` causing this ## procedure to return ``0``. It is therefore advised to call this procedure ## immediately after an OS call fails. On POSIX systems this is not a problem. - + when defined(windows): - result = TOSErrorCode(GetLastError()) + result = TOSErrorCode(getLastError()) else: result = TOSErrorCode(errno) {.pop.} -proc UnixToNativePath*(path: string): string {. +proc unixToNativePath*(path: string, drive=""): string {. noSideEffect, rtl, extern: "nos$1".} = ## Converts an UNIX-like path to a native one. ## ## On an UNIX system this does nothing. Else it converts ## '/', '.', '..' to the appropriate things. + ## + ## On systems with a concept of "drives", `drive` is used to determine + ## which drive label to use during absolute path conversion. + ## `drive` defaults to the drive of the current working directory, and is + ## ignored on systems that do not have a concept of "drives". + when defined(unix): result = path else: @@ -296,15 +306,18 @@ proc UnixToNativePath*(path: string): string {. if path[0] == '/': # an absolute path when doslike: - result = r"C:\" + if drive != "": + result = drive & ":" & DirSep + else: + result = $DirSep elif defined(macos): result = "" # must not start with ':' else: - result = $dirSep + result = $DirSep start = 1 elif path[0] == '.' and path[1] == '/': # current directory - result = $curdir + result = $CurDir start = 2 else: result = "" @@ -318,12 +331,12 @@ proc UnixToNativePath*(path: string): string {. if result[high(result)] == ':': add result, ':' else: - add result, pardir + add result, ParDir else: - add result, pardir & dirSep + add result, ParDir & DirSep inc(i, 3) elif path[i] == '/': - add result, dirSep + add result, DirSep inc(i) else: add result, path[i] @@ -336,34 +349,33 @@ when defined(windows): template wrapBinary(varname, winApiProc, arg, arg2: expr) {.immediate.} = var varname = winApiProc(newWideCString(arg), arg2) - proc FindFirstFile(a: string, b: var TWIN32_FIND_DATA): THandle = - result = FindFirstFileW(newWideCString(a), b) - template FindNextFile(a, b: expr): expr = FindNextFileW(a, b) + proc findFirstFile(a: string, b: var TWIN32_FIND_DATA): THandle = + result = findFirstFileW(newWideCString(a), b) + template findNextFile(a, b: expr): expr = findNextFileW(a, b) template getCommandLine(): expr = getCommandLineW() - proc skipFindData(f: TWIN32_FIND_DATA): bool {.inline.} = - result = f.cFilename[0].int == ord('.') - template getFilename(f: expr): expr = $cast[WideCString](addr(f.cFilename[0])) else: - template FindFirstFile(a, b: expr): expr = FindFirstFileA(a, b) - template FindNextFile(a, b: expr): expr = FindNextFileA(a, b) + template findFirstFile(a, b: expr): expr = findFirstFileA(a, b) + template findNextFile(a, b: expr): expr = findNextFileA(a, b) template getCommandLine(): expr = getCommandLineA() - proc skipFindData(f: TWIN32_FIND_DATA): bool {.inline.} = - result = f.cFilename[0] == '.' - template getFilename(f: expr): expr = $f.cFilename - -proc existsFile*(filename: string): bool {.rtl, extern: "nos$1", + + proc skipFindData(f: TWIN32_FIND_DATA): bool {.inline.} = + const dot = ord('.') + result = f.cFileName[0].int == dot and(f.cFileName[1].int == 0 or + f.cFileName[1].int == dot and f.cFileName[2].int == 0) + +proc existsFile*(filename: string): bool {.rtl, extern: "nos$1", tags: [FReadDir].} = ## Returns true if the file exists, false otherwise. when defined(windows): when useWinUnicode: - wrapUnary(a, GetFileAttributesW, filename) + wrapUnary(a, getFileAttributesW, filename) else: - var a = GetFileAttributesA(filename) + var a = getFileAttributesA(filename) if a != -1'i32: result = (a and FILE_ATTRIBUTE_DIRECTORY) == 0'i32 else: @@ -375,53 +387,76 @@ proc existsDir*(dir: string): bool {.rtl, extern: "nos$1", tags: [FReadDir].} = ## is returned. when defined(windows): when useWinUnicode: - wrapUnary(a, GetFileAttributesW, dir) + wrapUnary(a, getFileAttributesW, dir) else: - var a = GetFileAttributesA(dir) + var a = getFileAttributesA(dir) if a != -1'i32: result = (a and FILE_ATTRIBUTE_DIRECTORY) != 0'i32 else: var res: TStat return stat(dir, res) >= 0'i32 and S_ISDIR(res.st_mode) +proc symlinkExists*(link: string): bool {.rtl, extern: "nos$1", + tags: [FReadDir].} = + ## Returns true iff the symlink `link` exists. Will return true + ## regardless of whether the link points to a directory or file. + when defined(windows): + when useWinUnicode: + wrapUnary(a, getFileAttributesW, link) + else: + var a = getFileAttributesA(link) + if a != -1'i32: + result = (a and FILE_ATTRIBUTE_REPARSE_POINT) != 0'i32 + else: + var res: TStat + return lstat(link, res) >= 0'i32 and S_ISLNK(res.st_mode) + +proc fileExists*(filename: string): bool {.inline.} = + ## Synonym for existsFile + existsFile(filename) + +proc dirExists*(dir: string): bool {.inline.} = + ## Synonym for existsDir + existsDir(dir) + proc getLastModificationTime*(file: string): TTime {.rtl, extern: "nos$1".} = ## Returns the `file`'s last modification time. when defined(posix): var res: TStat - if stat(file, res) < 0'i32: OSError(OSLastError()) + if stat(file, res) < 0'i32: osError(osLastError()) return res.st_mtime else: - var f: TWIN32_Find_Data - var h = findfirstFile(file, f) - if h == -1'i32: OSError(OSLastError()) + var f: TWIN32_FIND_DATA + var h = findFirstFile(file, f) + if h == -1'i32: osError(osLastError()) result = winTimeToUnixTime(rdFileTime(f.ftLastWriteTime)) - findclose(h) + findClose(h) proc getLastAccessTime*(file: string): TTime {.rtl, extern: "nos$1".} = ## Returns the `file`'s last read or write access time. when defined(posix): var res: TStat - if stat(file, res) < 0'i32: OSError(OSLastError()) + if stat(file, res) < 0'i32: osError(osLastError()) return res.st_atime else: - var f: TWIN32_Find_Data - var h = findfirstFile(file, f) - if h == -1'i32: OSError(OSLastError()) + var f: TWIN32_FIND_DATA + var h = findFirstFile(file, f) + if h == -1'i32: osError(osLastError()) result = winTimeToUnixTime(rdFileTime(f.ftLastAccessTime)) - findclose(h) + findClose(h) -proc getCreationTime*(file: string): TTime {.rtl, extern: "nos$1".} = +proc getCreationTime*(file: string): TTime {.rtl, extern: "nos$1".} = ## Returns the `file`'s creation time. when defined(posix): var res: TStat - if stat(file, res) < 0'i32: OSError(OSLastError()) + if stat(file, res) < 0'i32: osError(osLastError()) return res.st_ctime else: - var f: TWIN32_Find_Data - var h = findfirstFile(file, f) - if h == -1'i32: OSError(OSLastError()) + var f: TWIN32_FIND_DATA + var h = findFirstFile(file, f) + if h == -1'i32: osError(osLastError()) result = winTimeToUnixTime(rdFileTime(f.ftCreationTime)) - findclose(h) + findClose(h) proc fileNewer*(a, b: string): bool {.rtl, extern: "nos$1".} = ## Returns true if the file `a` is newer than file `b`, i.e. if `a`'s @@ -434,40 +469,41 @@ proc getCurrentDir*(): string {.rtl, extern: "nos$1", tags: [].} = when defined(windows): when useWinUnicode: var res = newWideCString("", bufsize) - var L = GetCurrentDirectoryW(bufsize, res) - if L == 0'i32: OSError(OSLastError()) + var L = getCurrentDirectoryW(bufsize, res) + if L == 0'i32: osError(osLastError()) result = res$L else: result = newString(bufsize) - var L = GetCurrentDirectoryA(bufsize, result) - if L == 0'i32: OSError(OSLastError()) + var L = getCurrentDirectoryA(bufsize, result) + if L == 0'i32: osError(osLastError()) setLen(result, L) else: result = newString(bufsize) if getcwd(result, bufsize) != nil: - setlen(result, c_strlen(result)) + setLen(result, c_strlen(result)) else: - OSError(OSLastError()) + osError(osLastError()) proc setCurrentDir*(newDir: string) {.inline, tags: [].} = ## Sets the `current working directory`:idx:; `EOS` is raised if ## `newDir` cannot been set. when defined(Windows): when useWinUnicode: - if SetCurrentDirectoryW(newWideCString(newDir)) == 0'i32: OSError(OSLastError()) + if setCurrentDirectoryW(newWideCString(newDir)) == 0'i32: + osError(osLastError()) else: - if SetCurrentDirectoryA(newDir) == 0'i32: OSError(OSLastError()) + if setCurrentDirectoryA(newDir) == 0'i32: osError(osLastError()) else: - if chdir(newDir) != 0'i32: OSError(OSLastError()) + if chdir(newDir) != 0'i32: osError(osLastError()) -proc JoinPath*(head, tail: string): string {. +proc joinPath*(head, tail: string): string {. noSideEffect, rtl, extern: "nos$1".} = ## Joins two directory names to one. ## ## For example on Unix: ## ## .. code-block:: nimrod - ## JoinPath("usr", "lib") + ## joinPath("usr", "lib") ## ## results in: ## @@ -481,10 +517,10 @@ proc JoinPath*(head, tail: string): string {. ## examples on Unix: ## ## .. code-block:: nimrod - ## assert JoinPath("usr", "") == "usr/" - ## assert JoinPath("", "lib") == "lib" - ## assert JoinPath("", "/lib") == "/lib" - ## assert JoinPath("usr/", "/lib") == "usr/lib" + ## assert joinPath("usr", "") == "usr/" + ## assert joinPath("", "lib") == "lib" + ## assert joinPath("", "/lib") == "/lib" + ## assert joinPath("usr/", "/lib") == "usr/lib" if len(head) == 0: result = tail elif head[len(head)-1] in {DirSep, AltSep}: @@ -498,17 +534,17 @@ proc JoinPath*(head, tail: string): string {. else: result = head & DirSep & tail -proc JoinPath*(parts: varargs[string]): string {.noSideEffect, +proc joinPath*(parts: varargs[string]): string {.noSideEffect, rtl, extern: "nos$1OpenArray".} = - ## The same as `JoinPath(head, tail)`, but works with any number of directory + ## The same as `joinPath(head, tail)`, but works with any number of directory ## parts. You need to pass at least one element or the proc will assert in ## debug builds and crash on release builds. result = parts[0] for i in 1..high(parts): - result = JoinPath(result, parts[i]) + result = joinPath(result, parts[i]) proc `/` * (head, tail: string): string {.noSideEffect.} = - ## The same as ``JoinPath(head, tail)`` + ## The same as ``joinPath(head, tail)`` ## ## Here are some examples for Unix: ## @@ -517,24 +553,24 @@ proc `/` * (head, tail: string): string {.noSideEffect.} = ## assert "" / "lib" == "lib" ## assert "" / "/lib" == "/lib" ## assert "usr/" / "/lib" == "usr/lib" - return JoinPath(head, tail) + return joinPath(head, tail) -proc SplitPath*(path: string): tuple[head, tail: string] {. +proc splitPath*(path: string): tuple[head, tail: string] {. noSideEffect, rtl, extern: "nos$1".} = ## Splits a directory into (head, tail), so that - ## ``JoinPath(head, tail) == path``. + ## ``joinPath(head, tail) == path``. ## - ## Examples: + ## Examples: ## ## .. code-block:: nimrod - ## SplitPath("usr/local/bin") -> ("usr/local", "bin") - ## SplitPath("usr/local/bin/") -> ("usr/local/bin", "") - ## SplitPath("bin") -> ("", "bin") - ## SplitPath("/bin") -> ("", "bin") - ## SplitPath("") -> ("", "") + ## splitPath("usr/local/bin") -> ("usr/local", "bin") + ## splitPath("usr/local/bin/") -> ("usr/local/bin", "") + ## splitPath("bin") -> ("", "bin") + ## splitPath("/bin") -> ("", "bin") + ## splitPath("") -> ("", "") var sepPos = -1 for i in countdown(len(path)-1, 0): - if path[i] in {dirsep, altsep}: + if path[i] in {DirSep, AltSep}: sepPos = i break if sepPos >= 0: @@ -546,9 +582,9 @@ proc SplitPath*(path: string): tuple[head, tail: string] {. proc parentDirPos(path: string): int = var q = 1 - if path[len(path)-1] in {dirsep, altsep}: q = 2 + if path[len(path)-1] in {DirSep, AltSep}: q = 2 for i in countdown(len(path)-q, 0): - if path[i] in {dirsep, altsep}: return i + if path[i] in {DirSep, AltSep}: return i result = -1 proc parentDir*(path: string): string {. @@ -567,7 +603,7 @@ proc parentDir*(path: string): string {. proc isRootDir*(path: string): bool {. noSideEffect, rtl, extern: "nos$1".} = - ## Checks whether a given `path` is a root directory + ## Checks whether a given `path` is a root directory result = parentDirPos(path) < 0 iterator parentDirs*(path: string, fromRoot=false, inclusive=true): string = @@ -589,8 +625,8 @@ iterator parentDirs*(path: string, fromRoot=false, inclusive=true): string = else: for i in countup(0, path.len - 2): # ignore the last / # deal with non-normalized paths such as /foo//bar//baz - if path[i] in {dirsep, altsep} and - (i == 0 or path[i-1] notin {dirsep, altsep}): + if path[i] in {DirSep, AltSep} and + (i == 0 or path[i-1] notin {DirSep, AltSep}): yield path.substr(0, i) if inclusive: yield path @@ -605,17 +641,17 @@ proc `/../` * (head, tail: string): string {.noSideEffect.} = result = head / tail proc normExt(ext: string): string = - if ext == "" or ext[0] == extSep: result = ext # no copy needed here - else: result = extSep & ext + if ext == "" or ext[0] == ExtSep: result = ext # no copy needed here + else: result = ExtSep & ext proc searchExtPos(s: string): int = # BUGFIX: do not search until 0! .DS_Store is no file extension! result = -1 for i in countdown(len(s)-1, 1): - if s[i] == extsep: + if s[i] == ExtSep: result = i break - elif s[i] in {dirsep, altsep}: + elif s[i] in {DirSep, AltSep}: break # do not skip over path proc splitFile*(path: string): tuple[dir, name, ext: string] {. @@ -635,16 +671,16 @@ proc splitFile*(path: string): tuple[dir, name, ext: string] {. ## If `path` has no extension, `ext` is the empty string. ## If `path` has no directory component, `dir` is the empty string. ## If `path` has no filename component, `name` and `ext` are empty strings. - if path.len == 0 or path[path.len-1] in {dirSep, altSep}: + if path.len == 0 or path[path.len-1] in {DirSep, AltSep}: result = (path, "", "") else: var sepPos = -1 var dotPos = path.len for i in countdown(len(path)-1, 0): if path[i] == ExtSep: - if dotPos == path.len and i > 0 and - path[i-1] notin {dirsep, altsep}: dotPos = i - elif path[i] in {dirsep, altsep}: + if dotPos == path.len and i > 0 and + path[i-1] notin {DirSep, AltSep}: dotPos = i + elif path[i] in {DirSep, AltSep}: sepPos = i break result.dir = substr(path, 0, sepPos-1) @@ -653,9 +689,9 @@ proc splitFile*(path: string): tuple[dir, name, ext: string] {. proc extractFilename*(path: string): string {. noSideEffect, rtl, extern: "nos$1".} = - ## Extracts the filename of a given `path`. This is the same as + ## Extracts the filename of a given `path`. This is the same as ## ``name & ext`` from ``splitFile(path)``. - if path.len == 0 or path[path.len-1] in {dirSep, altSep}: + if path.len == 0 or path[path.len-1] in {DirSep, AltSep}: result = "" else: result = splitPath(path).tail @@ -666,26 +702,26 @@ proc expandFilename*(filename: string): string {.rtl, extern: "nos$1", when defined(windows): const bufsize = 3072'i32 when useWinUnicode: - var unused: widecstring + var unused: WideCString var res = newWideCString("", bufsize div 2) - var L = GetFullPathNameW(newWideCString(filename), bufsize, res, unused) - if L <= 0'i32 or L >= bufsize: - OSError(OSLastError()) + var L = getFullPathNameW(newWideCString(filename), bufsize, res, unused) + if L <= 0'i32 or L >= bufsize: + osError(osLastError()) result = res$L else: var unused: cstring result = newString(bufsize) - var L = GetFullPathNameA(filename, bufsize, result, unused) - if L <= 0'i32 or L >= bufsize: OSError(OSLastError()) + var L = getFullPathNameA(filename, bufsize, result, unused) + if L <= 0'i32 or L >= bufsize: osError(osLastError()) setLen(result, L) else: # careful, realpath needs to take an allocated buffer according to Posix: result = newString(pathMax) var r = realpath(filename, result) - if r.isNil: OSError(OSLastError()) - setlen(result, c_strlen(result)) - -proc ChangeFileExt*(filename, ext: string): string {. + if r.isNil: osError(osLastError()) + setLen(result, c_strlen(result)) + +proc changeFileExt*(filename, ext: string): string {. noSideEffect, rtl, extern: "nos$1".} = ## Changes the file extension to `ext`. ## @@ -740,12 +776,12 @@ proc isAbsolute*(path: string): bool {.rtl, noSideEffect, extern: "nos$1".} = elif defined(posix): result = path[0] == '/' -proc sameFile*(path1, path2: string): bool {.rtl, extern: "nos$1", +proc sameFile*(path1, path2: string): bool {.rtl, extern: "nos$1", tags: [FReadDir].} = - ## Returns True if both pathname arguments refer to the same physical + ## Returns True if both pathname arguments refer to the same physical ## file or directory. Raises an exception if any of the files does not ## exist or information about it can not be obtained. - ## + ## ## This proc will return true if given two alternative hard-linked or ## sym-linked paths to the same file or directory. when defined(Windows): @@ -754,47 +790,47 @@ proc sameFile*(path1, path2: string): bool {.rtl, extern: "nos$1", when useWinUnicode: var p1 = newWideCString(path1) var p2 = newWideCString(path2) - template OpenHandle(path: expr): expr = - CreateFileW(path, 0'i32, FILE_SHARE_DELETE or FILE_SHARE_READ or + template openHandle(path: expr): expr = + createFileW(path, 0'i32, FILE_SHARE_DELETE or FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS or FILE_ATTRIBUTE_NORMAL, 0) - var f1 = OpenHandle(p1) - var f2 = OpenHandle(p2) - + var f1 = openHandle(p1) + var f2 = openHandle(p2) + else: - template OpenHandle(path: expr): expr = - CreateFileA(path, 0'i32, FILE_SHARE_DELETE or FILE_SHARE_READ or + template openHandle(path: expr): expr = + createFileA(path, 0'i32, FILE_SHARE_DELETE or FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS or FILE_ATTRIBUTE_NORMAL, 0) - var f1 = OpenHandle(path1) - var f2 = OpenHandle(path2) + var f1 = openHandle(path1) + var f2 = openHandle(path2) var lastErr: TOSErrorCode if f1 != INVALID_HANDLE_VALUE and f2 != INVALID_HANDLE_VALUE: var fi1, fi2: TBY_HANDLE_FILE_INFORMATION - if GetFileInformationByHandle(f1, addr(fi1)) != 0 and - GetFileInformationByHandle(f2, addr(fi2)) != 0: + if getFileInformationByHandle(f1, addr(fi1)) != 0 and + getFileInformationByHandle(f2, addr(fi2)) != 0: result = fi1.dwVolumeSerialNumber == fi2.dwVolumeSerialNumber and fi1.nFileIndexHigh == fi2.nFileIndexHigh and fi1.nFileIndexLow == fi2.nFileIndexLow else: - lastErr = OSLastError() + lastErr = osLastError() success = false else: - lastErr = OSLastError() + lastErr = osLastError() success = false - discard CloseHandle(f1) - discard CloseHandle(f2) + discard closeHandle(f1) + discard closeHandle(f2) - if not success: OSError(lastErr) + if not success: osError(lastErr) else: var a, b: TStat if stat(path1, a) < 0'i32 or stat(path2, b) < 0'i32: - OSError(OSLastError()) + osError(osLastError()) else: result = a.st_dev == b.st_dev and a.st_ino == b.st_ino @@ -810,11 +846,11 @@ proc sameFileContent*(path1, path2: string): bool {.rtl, extern: "nos$1", if not open(b, path2): close(a) return false - var bufA = alloc(bufsize) - var bufB = alloc(bufsize) - while True: - var readA = readBuffer(a, bufA, bufsize) - var readB = readBuffer(b, bufB, bufsize) + var bufA = alloc(bufSize) + var bufB = alloc(bufSize) + while true: + var readA = readBuffer(a, bufA, bufSize) + var readB = readBuffer(b, bufB, bufSize) if readA != readB: result = false break @@ -829,7 +865,87 @@ proc sameFileContent*(path1, path2: string): bool {.rtl, extern: "nos$1", close(a) close(b) -proc copyFile*(source, dest: string) {.rtl, extern: "nos$1", +type + TFilePermission* = enum ## file access permission; modelled after UNIX + fpUserExec, ## execute access for the file owner + fpUserWrite, ## write access for the file owner + fpUserRead, ## read access for the file owner + fpGroupExec, ## execute access for the group + fpGroupWrite, ## write access for the group + fpGroupRead, ## read access for the group + fpOthersExec, ## execute access for others + fpOthersWrite, ## write access for others + fpOthersRead ## read access for others + +proc getFilePermissions*(filename: string): set[TFilePermission] {. + rtl, extern: "nos$1", tags: [FReadDir].} = + ## retrieves file permissions for `filename`. `OSError` is raised in case of + ## an error. On Windows, only the ``readonly`` flag is checked, every other + ## permission is available in any case. + when defined(posix): + var a: TStat + if stat(filename, a) < 0'i32: osError(osLastError()) + result = {} + if (a.st_mode and S_IRUSR) != 0'i32: result.incl(fpUserRead) + if (a.st_mode and S_IWUSR) != 0'i32: result.incl(fpUserWrite) + if (a.st_mode and S_IXUSR) != 0'i32: result.incl(fpUserExec) + + if (a.st_mode and S_IRGRP) != 0'i32: result.incl(fpGroupRead) + if (a.st_mode and S_IWGRP) != 0'i32: result.incl(fpGroupWrite) + if (a.st_mode and S_IXGRP) != 0'i32: result.incl(fpGroupExec) + + if (a.st_mode and S_IROTH) != 0'i32: result.incl(fpOthersRead) + if (a.st_mode and S_IWOTH) != 0'i32: result.incl(fpOthersWrite) + if (a.st_mode and S_IXOTH) != 0'i32: result.incl(fpOthersExec) + else: + when useWinUnicode: + wrapUnary(res, getFileAttributesW, filename) + else: + var res = getFileAttributesA(filename) + if res == -1'i32: osError(osLastError()) + if (res and FILE_ATTRIBUTE_READONLY) != 0'i32: + result = {fpUserExec, fpUserRead, fpGroupExec, fpGroupRead, + fpOthersExec, fpOthersRead} + else: + result = {fpUserExec..fpOthersRead} + +proc setFilePermissions*(filename: string, permissions: set[TFilePermission]) {. + rtl, extern: "nos$1", tags: [FWriteDir].} = + ## sets the file permissions for `filename`. `OSError` is raised in case of + ## an error. On Windows, only the ``readonly`` flag is changed, depending on + ## ``fpUserWrite``. + when defined(posix): + var p = 0'i32 + if fpUserRead in permissions: p = p or S_IRUSR + if fpUserWrite in permissions: p = p or S_IWUSR + if fpUserExec in permissions: p = p or S_IXUSR + + if fpGroupRead in permissions: p = p or S_IRGRP + if fpGroupWrite in permissions: p = p or S_IWGRP + if fpGroupExec in permissions: p = p or S_IXGRP + + if fpOthersRead in permissions: p = p or S_IROTH + if fpOthersWrite in permissions: p = p or S_IWOTH + if fpOthersExec in permissions: p = p or S_IXOTH + + if chmod(filename, p) != 0: osError(osLastError()) + else: + when useWinUnicode: + wrapUnary(res, getFileAttributesW, filename) + else: + var res = getFileAttributesA(filename) + if res == -1'i32: osError(osLastError()) + if fpUserWrite in permissions: + res = res and not FILE_ATTRIBUTE_READONLY + else: + res = res or FILE_ATTRIBUTE_READONLY + when useWinUnicode: + wrapBinary(res2, setFileAttributesW, filename, res) + else: + var res2 = setFileAttributesA(filename, res) + if res2 == - 1'i32: osError(osLastError()) + +proc copyFile*(source, dest: string) {.rtl, extern: "nos$1", tags: [FReadIO, FWriteIO].} = ## Copies a file from `source` to `dest`. ## @@ -844,48 +960,74 @@ proc copyFile*(source, dest: string) {.rtl, extern: "nos$1", when useWinUnicode: let s = newWideCString(source) let d = newWideCString(dest) - if CopyFileW(s, d, 0'i32) == 0'i32: OSError(OSLastError()) + if copyFileW(s, d, 0'i32) == 0'i32: osError(osLastError()) else: - if CopyFileA(source, dest, 0'i32) == 0'i32: OSError(OSLastError()) + if copyFileA(source, dest, 0'i32) == 0'i32: osError(osLastError()) else: # generic version of copyFile which works for any platform: const bufSize = 8000 # better for memory manager var d, s: TFile - if not open(s, source): OSError(OSLastError()) + if not open(s, source): osError(osLastError()) if not open(d, dest, fmWrite): close(s) - OSError(OSLastError()) - var buf = alloc(bufsize) - while True: - var bytesread = readBuffer(s, buf, bufsize) + osError(osLastError()) + var buf = alloc(bufSize) + while true: + var bytesread = readBuffer(s, buf, bufSize) if bytesread > 0: var byteswritten = writeBuffer(d, buf, bytesread) - if bytesread != bytesWritten: + if bytesread != byteswritten: dealloc(buf) close(s) close(d) - OSError(OSLastError()) + osError(osLastError()) if bytesread != bufSize: break dealloc(buf) close(s) close(d) -proc moveFile*(source, dest: string) {.rtl, extern: "nos$1", +proc moveFile*(source, dest: string) {.rtl, extern: "nos$1", tags: [FReadIO, FWriteIO].} = ## Moves a file from `source` to `dest`. If this fails, `EOS` is raised. - if crename(source, dest) != 0'i32: + if c_rename(source, dest) != 0'i32: raise newException(EOS, $strerror(errno)) -when not defined(ENOENT): - var ENOENT {.importc, header: "<errno.h>".}: cint +when not defined(ENOENT) and not defined(Windows): + when NoFakeVars: + const ENOENT = cint(2) # 2 on most systems including Solaris + else: + var ENOENT {.importc, header: "<errno.h>".}: cint + +when defined(Windows): + when useWinUnicode: + template deleteFile(file: expr): expr {.immediate.} = deleteFileW(file) + template setFileAttributes(file, attrs: expr): expr {.immediate.} = + setFileAttributesW(file, attrs) + else: + template deleteFile(file: expr): expr {.immediate.} = deleteFileA(file) + template setFileAttributes(file, attrs: expr): expr {.immediate.} = + setFileAttributesA(file, attrs) proc removeFile*(file: string) {.rtl, extern: "nos$1", tags: [FWriteDir].} = ## Removes the `file`. If this fails, `EOS` is raised. This does not fail ## if the file never existed in the first place. - if cremove(file) != 0'i32 and errno != ENOENT: - raise newException(EOS, $strerror(errno)) + ## On Windows, ignores the read-only attribute. + when defined(Windows): + when useWinUnicode: + let f = newWideCString(file) + else: + let f = file + if deleteFile(f) == 0: + if getLastError() == ERROR_ACCESS_DENIED: + if setFileAttributes(f, FILE_ATTRIBUTE_NORMAL) == 0: + osError(osLastError()) + if deleteFile(f) == 0: + osError(osLastError()) + else: + if c_remove(file) != 0'i32 and errno != ENOENT: + raise newException(EOS, $strerror(errno)) -proc execShellCmd*(command: string): int {.rtl, extern: "nos$1", +proc execShellCmd*(command: string): int {.rtl, extern: "nos$1", tags: [FExecIO].} = ## Executes a `shell command`:idx:. ## @@ -895,9 +1037,9 @@ proc execShellCmd*(command: string): int {.rtl, extern: "nos$1", ## the process has finished. To execute a program without having a ## shell involved, use the `execProcess` proc of the `osproc` ## module. - result = csystem(command) + result = c_system(command) shr 8 -# Environment handling cannot be put into RTL, because the ``envPairs`` +# Environment handling cannot be put into RTL, because the ``envPairs`` # iterator depends on ``environment``. var @@ -908,10 +1050,10 @@ when defined(windows): # because we support Windows GUI applications, things get really # messy here... when useWinUnicode: - proc strEnd(cstr: wideCString, c = 0'i32): wideCString {. + proc strEnd(cstr: WideCString, c = 0'i32): WideCString {. importc: "wcschr", header: "<string.h>".} else: - proc strEnd(cstr: CString, c = 0'i32): CString {. + proc strEnd(cstr: cstring, c = 0'i32): cstring {. importc: "strchr", header: "<string.h>".} proc getEnvVarsC() = @@ -922,32 +1064,32 @@ when defined(windows): env = getEnvironmentStringsW() e = env if e == nil: return # an error occured - while True: + while true: var eend = strEnd(e) add(environment, $e) - e = cast[wideCString](cast[TAddress](eend)+2) + e = cast[WideCString](cast[TAddress](eend)+2) if eend[1].int == 0: break - discard FreeEnvironmentStringsW(env) + discard freeEnvironmentStringsW(env) else: var env = getEnvironmentStringsA() e = env if e == nil: return # an error occured - while True: + while true: var eend = strEnd(e) add(environment, $e) - e = cast[CString](cast[TAddress](eend)+1) + e = cast[cstring](cast[TAddress](eend)+1) if eend[1] == '\0': break - discard FreeEnvironmentStringsA(env) + discard freeEnvironmentStringsA(env) envComputed = true else: const - useNSGetEnviron = defined(macosx) and + useNSGetEnviron = defined(macosx) and (defined(createNimRtl) or defined(useNimRtl)) when useNSGetEnviron: # From the manual: - # Shared libraries and bundles don't have direct access to environ, + # Shared libraries and bundles don't have direct access to environ, # which is only available to the loader ld(1) when a complete program # is being linked. # The environment routines can still be used, but if direct access to @@ -966,7 +1108,7 @@ else: when useNSGetEnviron: var gEnv = NSGetEnviron()[] var i = 0 - while True: + while true: if gEnv[i] == nil: break add environment, $gEnv[i] inc(i) @@ -989,14 +1131,14 @@ proc getEnv*(key: string): TaintedString {.tags: [FReadEnv].} = if i >= 0: return TaintedString(substr(environment[i], find(environment[i], '=')+1)) else: - var env = cgetenv(key) + var env = c_getenv(key) if env == nil: return TaintedString("") result = TaintedString($env) proc existsEnv*(key: string): bool {.tags: [FReadEnv].} = ## Checks whether the environment variable named `key` exists. ## Returns true if it exists, false otherwise. - if cgetenv(key) != nil: return true + if c_getenv(key) != nil: return true else: return findEnvVar(key) >= 0 proc putEnv*(key, val: string) {.tags: [FWriteEnv].} = @@ -1014,24 +1156,24 @@ proc putEnv*(key, val: string) {.tags: [FWriteEnv].} = add environment, (key & '=' & val) indx = high(environment) when defined(unix): - if cputenv(environment[indx]) != 0'i32: - OSError(OSLastError()) + if c_putenv(environment[indx]) != 0'i32: + osError(osLastError()) else: when useWinUnicode: var k = newWideCString(key) var v = newWideCString(val) - if SetEnvironmentVariableW(k, v) == 0'i32: OSError(OSLastError()) + if setEnvironmentVariableW(k, v) == 0'i32: osError(osLastError()) else: - if SetEnvironmentVariableA(key, val) == 0'i32: OSError(OSLastError()) + if setEnvironmentVariableA(key, val) == 0'i32: osError(osLastError()) iterator envPairs*(): tuple[key, value: TaintedString] {.tags: [FReadEnv].} = - ## Iterate over all `environments variables`:idx:. In the first component + ## Iterate over all `environments variables`:idx:. 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): var p = find(environment[i], '=') - yield (TaintedString(substr(environment[i], 0, p-1)), + yield (TaintedString(substr(environment[i], 0, p-1)), TaintedString(substr(environment[i], p+1))) iterator walkFiles*(pattern: string): string {.tags: [FReadDir].} = @@ -1042,15 +1184,15 @@ iterator walkFiles*(pattern: string): string {.tags: [FReadDir].} = ## notation is supported. when defined(windows): var - f: TWin32FindData + f: TWIN32_FIND_DATA res: int - res = findfirstFile(pattern, f) + res = findFirstFile(pattern, f) if res != -1: while true: if not skipFindData(f): yield splitFile(pattern).dir / extractFilename(getFilename(f)) - if findnextFile(res, f) == 0'i32: break - findclose(res) + if findNextFile(res, f) == 0'i32: break + findClose(res) else: # here we use glob var f: TGlob @@ -1095,22 +1237,24 @@ iterator walkDir*(dir: string): tuple[kind: TPathComponent, path: string] {. ## dirA/fileA1.txt ## dirA/fileA2.txt when defined(windows): - var f: TWIN32_Find_Data - var h = findfirstFile(dir / "*", f) + var f: TWIN32_FIND_DATA + var h = findFirstFile(dir / "*", f) if h != -1: while true: var k = pcFile if not skipFindData(f): if (f.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) != 0'i32: k = pcDir + if (f.dwFileAttributes and FILE_ATTRIBUTE_REPARSE_POINT) != 0'i32: + k = succ(k) yield (k, dir / extractFilename(getFilename(f))) - if findnextFile(h, f) == 0'i32: break - findclose(h) + if findNextFile(h, f) == 0'i32: break + findClose(h) else: - var d = openDir(dir) + var d = opendir(dir) if d != nil: while true: - var x = readDir(d) + var x = readdir(d) if x == nil: break var y = $x.d_name if y != "." and y != "..": @@ -1121,12 +1265,16 @@ iterator walkDir*(dir: string): tuple[kind: TPathComponent, path: string] {. if S_ISDIR(s.st_mode): k = pcDir if S_ISLNK(s.st_mode): k = succ(k) yield (k, y) - discard closeDir(d) + discard closedir(d) iterator walkDirRec*(dir: string, filter={pcFile, pcDir}): string {. tags: [FReadDir].} = - ## walks over the directory `dir` and yields for each file in `dir`. The + ## walks over the directory `dir` and yields for each file in `dir`. The ## full path for each file is returned. + ## **Warning**: + ## Modifying the directory structure while the iterator + ## is traversing may result in undefined behavior! + ## ## Walking is recursive. `filter` controls the behaviour of the iterator: ## ## --------------------- --------------------------------------------- @@ -1137,7 +1285,7 @@ iterator walkDirRec*(dir: string, filter={pcFile, pcDir}): string {. ## ``pcDir`` follow real directories ## ``pcLinkToDir`` follow symbolic links to directories ## --------------------- --------------------------------------------- - ## + ## var stack = @[dir] while stack.len > 0: for k,p in walkDir(stack.pop()): @@ -1146,18 +1294,18 @@ iterator walkDirRec*(dir: string, filter={pcFile, pcDir}): string {. of pcFile, pcLinkToFile: yield p of pcDir, pcLinkToDir: stack.add(p) -proc rawRemoveDir(dir: string) = +proc rawRemoveDir(dir: string) = when defined(windows): when useWinUnicode: - wrapUnary(res, RemoveDirectoryW, dir) + wrapUnary(res, removeDirectoryW, dir) else: - var res = RemoveDirectoryA(dir) - let lastError = OSLastError() - if res == 0'i32 and lastError.int32 != 3'i32 and + var res = removeDirectoryA(dir) + let lastError = osLastError() + if res == 0'i32 and lastError.int32 != 3'i32 and lastError.int32 != 18'i32 and lastError.int32 != 2'i32: - OSError(lastError) + osError(lastError) else: - if rmdir(dir) != 0'i32 and errno != ENOENT: OSError(OSLastError()) + if rmdir(dir) != 0'i32 and errno != ENOENT: osError(osLastError()) proc removeDir*(dir: string) {.rtl, extern: "nos$1", tags: [ FWriteDir, FReadDir].} = @@ -1166,7 +1314,7 @@ proc removeDir*(dir: string) {.rtl, extern: "nos$1", tags: [ ## ## If this fails, `EOS` is raised. This does not fail if the directory never ## existed in the first place. - for kind, path in walkDir(dir): + for kind, path in walkDir(dir): case kind of pcFile, pcLinkToFile, pcLinkToDir: removeFile(path) of pcDir: removeDir(path) @@ -1175,37 +1323,37 @@ proc removeDir*(dir: string) {.rtl, extern: "nos$1", tags: [ proc rawCreateDir(dir: string) = when defined(solaris): if mkdir(dir, 0o711) != 0'i32 and errno != EEXIST and errno != ENOSYS: - OSError(OSLastError()) + osError(osLastError()) elif defined(unix): if mkdir(dir, 0o711) != 0'i32 and errno != EEXIST: - OSError(OSLastError()) + osError(osLastError()) else: when useWinUnicode: - wrapUnary(res, CreateDirectoryW, dir) + wrapUnary(res, createDirectoryW, dir) else: - var res = CreateDirectoryA(dir) - if res == 0'i32 and GetLastError() != 183'i32: - OSError(OSLastError()) + var res = createDirectoryA(dir) + if res == 0'i32 and getLastError() != 183'i32: + osError(osLastError()) proc createDir*(dir: string) {.rtl, extern: "nos$1", tags: [FWriteDir].} = ## Creates the `directory`:idx: `dir`. ## ## The directory may contain several subdirectories that do not exist yet. ## The full path is created. If this fails, `EOS` is raised. It does **not** - ## fail if the path already exists because for most usages this does not + ## fail if the path already exists because for most usages this does not ## indicate an error. var omitNext = false when defined(doslike): omitNext = isAbsolute(dir) for i in 1.. dir.len-1: - if dir[i] in {dirsep, altsep}: + if dir[i] in {DirSep, AltSep}: if omitNext: omitNext = false else: rawCreateDir(substr(dir, 0, i-1)) rawCreateDir(dir) -proc copyDir*(source, dest: string) {.rtl, extern: "nos$1", +proc copyDir*(source, dest: string) {.rtl, extern: "nos$1", tags: [FWriteIO, FReadIO].} = ## Copies a directory from `source` to `dest`. If this fails, `EOS` is raised. createDir(dest) @@ -1216,11 +1364,51 @@ proc copyDir*(source, dest: string) {.rtl, extern: "nos$1", copyFile(path, dest / noSource) of pcDir: copyDir(path, dest / noSource) - else: nil + else: discard + +proc createSymlink*(src, dest: string) = + ## Create a symbolic link at `dest` which points to the item specified + ## by `src`. On most operating systems, will fail if a lonk + ## + ## **Warning**: + ## Some OS's (such as Microsoft Windows) restrict the creation + ## of symlinks to root users (administrators). + when defined(Windows): + let flag = dirExists(src).int32 + when useWinUnicode: + var wSrc = newWideCString(src) + var wDst = newWideCString(dest) + if createSymbolicLinkW(wDst, wSrc, flag) == 0 or getLastError() != 0: + osError(osLastError()) + else: + if createSymbolicLinkA(dest, src, flag) == 0 or getLastError() != 0: + osError(osLastError()) + else: + if symlink(src, dest) != 0: + osError(osLastError()) + +proc createHardlink*(src, dest: string) = + ## Create a hard link at `dest` which points to the item specified + ## by `src`. + ## + ## **Warning**: Most OS's restrict the creation of hard links to + ## root users (administrators) . + when defined(Windows): + when useWinUnicode: + var wSrc = newWideCString(src) + var wDst = newWideCString(dest) + if createHardLinkW(wDst, wSrc, nil) == 0: + osError(osLastError()) + else: + if createHardLinkA(dest, src, nil) == 0: + osError(osLastError()) + else: + if link(src, dest) != 0: + osError(osLastError()) proc parseCmdLine*(c: string): seq[string] {. noSideEffect, rtl, extern: "nos$1".} = - ## Splits a command line into several components; + ## Splits a command line into several components; ## This proc is only occassionally useful, better use the `parseopt` module. ## ## On Windows, it uses the following parsing rules @@ -1247,7 +1435,7 @@ proc parseCmdLine*(c: string): seq[string] {. ## causing a literal double quotation mark (") to be placed in argv. ## ## On Posix systems, it uses the following parsing rules: - ## Components are separated by whitespace unless the whitespace + ## Components are separated by whitespace unless the whitespace ## occurs within ``"`` or ``'`` quotes. result = @[] var i = 0 @@ -1260,31 +1448,31 @@ proc parseCmdLine*(c: string): seq[string] {. if c[i] == '\0': break var inQuote = false while true: - case c[i] + case c[i] of '\0': break of '\\': var j = i while c[j] == '\\': inc(j) - if c[j] == '"': + if c[j] == '"': for k in 1..(j-i) div 2: a.add('\\') - if (j-i) mod 2 == 0: + if (j-i) mod 2 == 0: i = j - else: + else: a.add('"') i = j+1 - else: + else: a.add(c[i]) inc(i) of '"': inc(i) if not inQuote: inQuote = true - elif c[i] == '"': + elif c[i] == '"': a.add(c[i]) inc(i) else: inQuote = false break - of ' ', '\t': + of ' ', '\t': if not inQuote: break a.add(c[i]) inc(i) @@ -1306,86 +1494,6 @@ proc parseCmdLine*(c: string): seq[string] {. add(a, c[i]) inc(i) add(result, a) - -type - TFilePermission* = enum ## file access permission; modelled after UNIX - fpUserExec, ## execute access for the file owner - fpUserWrite, ## write access for the file owner - fpUserRead, ## read access for the file owner - fpGroupExec, ## execute access for the group - fpGroupWrite, ## write access for the group - fpGroupRead, ## read access for the group - fpOthersExec, ## execute access for others - fpOthersWrite, ## write access for others - fpOthersRead ## read access for others - -proc getFilePermissions*(filename: string): set[TFilePermission] {. - rtl, extern: "nos$1", tags: [FReadDir].} = - ## retrieves file permissions for `filename`. `OSError` is raised in case of - ## an error. On Windows, only the ``readonly`` flag is checked, every other - ## permission is available in any case. - when defined(posix): - var a: TStat - if stat(filename, a) < 0'i32: OSError(OSLastError()) - result = {} - if (a.st_mode and S_IRUSR) != 0'i32: result.incl(fpUserRead) - if (a.st_mode and S_IWUSR) != 0'i32: result.incl(fpUserWrite) - if (a.st_mode and S_IXUSR) != 0'i32: result.incl(fpUserExec) - - if (a.st_mode and S_IRGRP) != 0'i32: result.incl(fpGroupRead) - if (a.st_mode and S_IWGRP) != 0'i32: result.incl(fpGroupWrite) - if (a.st_mode and S_IXGRP) != 0'i32: result.incl(fpGroupExec) - - if (a.st_mode and S_IROTH) != 0'i32: result.incl(fpOthersRead) - if (a.st_mode and S_IWOTH) != 0'i32: result.incl(fpOthersWrite) - if (a.st_mode and S_IXOTH) != 0'i32: result.incl(fpOthersExec) - else: - when useWinUnicode: - wrapUnary(res, GetFileAttributesW, filename) - else: - var res = GetFileAttributesA(filename) - if res == -1'i32: OSError(OSLastError()) - if (res and FILE_ATTRIBUTE_READONLY) != 0'i32: - result = {fpUserExec, fpUserRead, fpGroupExec, fpGroupRead, - fpOthersExec, fpOthersRead} - else: - result = {fpUserExec..fpOthersRead} - -proc setFilePermissions*(filename: string, permissions: set[TFilePermission]) {. - rtl, extern: "nos$1", tags: [FWriteDir].} = - ## sets the file permissions for `filename`. `OSError` is raised in case of - ## an error. On Windows, only the ``readonly`` flag is changed, depending on - ## ``fpUserWrite``. - when defined(posix): - var p = 0'i32 - if fpUserRead in permissions: p = p or S_IRUSR - if fpUserWrite in permissions: p = p or S_IWUSR - if fpUserExec in permissions: p = p or S_IXUSR - - if fpGroupRead in permissions: p = p or S_IRGRP - if fpGroupWrite in permissions: p = p or S_IWGRP - if fpGroupExec in permissions: p = p or S_IXGRP - - if fpOthersRead in permissions: p = p or S_IROTH - if fpOthersWrite in permissions: p = p or S_IWOTH - if fpOthersExec in permissions: p = p or S_IXOTH - - if chmod(filename, p) != 0: OSError(OSLastError()) - else: - when useWinUnicode: - wrapUnary(res, GetFileAttributesW, filename) - else: - var res = GetFileAttributesA(filename) - if res == -1'i32: OSError(OSLastError()) - if fpUserWrite in permissions: - res = res and not FILE_ATTRIBUTE_READONLY - else: - res = res or FILE_ATTRIBUTE_READONLY - when useWinUnicode: - wrapBinary(res2, SetFileAttributesW, filename, res) - else: - var res2 = SetFileAttributesA(filename, res) - if res2 == - 1'i32: OSError(OSLastError()) proc copyFileWithPermissions*(source, dest: string, ignorePermissionErrors = true) = @@ -1407,19 +1515,19 @@ proc copyFileWithPermissions*(source, dest: string, if not ignorePermissionErrors: raise -proc inclFilePermissions*(filename: string, +proc inclFilePermissions*(filename: string, permissions: set[TFilePermission]) {. rtl, extern: "nos$1", tags: [FReadDir, FWriteDir].} = - ## a convenience procedure for: + ## a convenience procedure for: ## ## .. code-block:: nimrod ## setFilePermissions(filename, getFilePermissions(filename)+permissions) setFilePermissions(filename, getFilePermissions(filename)+permissions) -proc exclFilePermissions*(filename: string, +proc exclFilePermissions*(filename: string, permissions: set[TFilePermission]) {. rtl, extern: "nos$1", tags: [FReadDir, FWriteDir].} = - ## a convenience procedure for: + ## a convenience procedure for: ## ## .. code-block:: nimrod ## setFilePermissions(filename, getFilePermissions(filename)-permissions) @@ -1459,7 +1567,7 @@ when defined(windows): if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLine()) result = ownArgv.len-1 - proc paramStr*(i: int): TaintedString {.rtl, extern: "nos$1", + proc paramStr*(i: int): TaintedString {.rtl, extern: "nos$1", tags: [FReadIO].} = ## Returns the `i`-th `command line argument`:idx: given to the ## application. @@ -1481,6 +1589,12 @@ elif not defined(createNimRtl): proc paramCount*(): int {.tags: [FReadIO].} = return cmdCount-1 +when defined(paramCount): + proc commandLineParams*(): seq[TaintedString] = + result = @[] + for i in 1..paramCount(): + result.add(paramStr(i)) + when defined(linux) or defined(solaris) or defined(bsd) or defined(aix): proc getApplAux(procPath: string): string = result = newString(256) @@ -1488,13 +1602,13 @@ when defined(linux) or defined(solaris) or defined(bsd) or defined(aix): if len > 256: result = newString(len+1) len = readlink(procPath, result, len) - setlen(result, len) + setLen(result, len) when defined(macosx): type cuint32* {.importc: "unsigned int", nodecl.} = int ## This is the same as the type ``uint32_t`` in *C*. - + # a really hacky solution: since we like to include 2 headers we have to # define two procs which in reality are the same proc getExecPath1(c: cstring, size: var cuint32) {. @@ -1517,7 +1631,7 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} = # /proc/<pid>/file when defined(windows): when useWinUnicode: - var buf = cast[wideCString](alloc(256*2)) + var buf = cast[WideCString](alloc(256*2)) var len = getModuleFileNameW(0, buf, 256) result = buf$len else: @@ -1542,24 +1656,24 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} = # little heuristic that may work on other POSIX-like systems: result = string(getEnv("_")) if len(result) == 0: - result = string(ParamStr(0)) + result = string(paramStr(0)) # POSIX guaranties that this contains the executable # as it has been executed by the calling process if len(result) > 0 and result[0] != DirSep: # not an absolute path? # iterate over any path in the $PATH environment variable for p in split(string(getEnv("PATH")), {PathSep}): - var x = JoinPath(p, result) - if ExistsFile(x): return x + var x = joinPath(p, result) + if existsFile(x): return x proc getApplicationFilename*(): string {.rtl, extern: "nos$1", deprecated.} = ## Returns the filename of the application's executable. - ## **Deprecated since version 0.8.12**: use ``getAppFilename`` + ## **Deprecated since version 0.8.12**: use ``getAppFilename`` ## instead. result = getAppFilename() proc getApplicationDir*(): string {.rtl, extern: "nos$1", deprecated.} = ## Returns the directory of the application's executable. - ## **Deprecated since version 0.8.12**: use ``getAppDir`` + ## **Deprecated since version 0.8.12**: use ``getAppDir`` ## instead. result = splitFile(getAppFilename()).dir @@ -1578,33 +1692,33 @@ proc sleep*(milsecs: int) {.rtl, extern: "nos$1", tags: [FTime].} = a.tv_nsec = (milsecs mod 1000) * 1000 * 1000 discard posix.nanosleep(a, b) -proc getFileSize*(file: string): biggestInt {.rtl, extern: "nos$1", +proc getFileSize*(file: string): BiggestInt {.rtl, extern: "nos$1", tags: [FReadIO].} = - ## returns the file size of `file`. Can raise ``EOS``. + ## returns the file size of `file`. Can raise ``EOS``. when defined(windows): - var a: TWin32FindData - var resA = findfirstFile(file, a) - if resA == -1: OSError(OSLastError()) + var a: TWIN32_FIND_DATA + var resA = findFirstFile(file, a) + if resA == -1: osError(osLastError()) result = rdFileSize(a) - findclose(resA) + findClose(resA) else: var f: TFile - if open(f, file): + if open(f, file): result = getFileSize(f) close(f) - else: OSError(OSLastError()) + else: osError(osLastError()) -proc findExe*(exe: string): string {.tags: [FReadDir, FReadEnv].} = +proc findExe*(exe: string): string {.tags: [FReadDir, FReadEnv].} = ## Searches for `exe` in the current working directory and then - ## in directories listed in the ``PATH`` environment variable. - ## Returns "" if the `exe` cannot be found. On DOS-like platforms, `exe` + ## in directories listed in the ``PATH`` environment variable. + ## Returns "" if the `exe` cannot be found. On DOS-like platforms, `exe` ## is added an ``.exe`` file extension if it has no extension. - result = addFileExt(exe, os.exeExt) - if ExistsFile(result): return + result = addFileExt(exe, os.ExeExt) + if existsFile(result): return var path = string(os.getEnv("PATH")) - for candidate in split(path, pathSep): + for candidate in split(path, PathSep): var x = candidate / result - if ExistsFile(x): return x + if existsFile(x): return x result = "" proc expandTilde*(path: string): string = @@ -1629,4 +1743,3 @@ proc expandTilde*(path: string): string = result = path {.pop.} - diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 754e34b85..6df85bbc6 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -13,7 +13,7 @@ include "system/inclrtl" import - strutils, os, strtabs, streams + strutils, os, strtabs, streams, sequtils when defined(windows): import winlean @@ -23,7 +23,7 @@ else: type TProcess = object of TObject when defined(windows): - FProcessHandle: Thandle + fProcessHandle: THandle inHandle, outHandle, errHandle: TFileHandle id: THandle else: @@ -36,18 +36,81 @@ type TProcessOption* = enum ## options that can be passed `startProcess` poEchoCmd, ## echo the command before execution - poUseShell, ## use the shell to execute the command; NOTE: This - ## often creates a security hole! + poUsePath, ## Asks system to search for executable using PATH environment + ## variable. + ## On Windows, this is the default. + poEvalCommand, ## Pass `command` directly to the shell, without quoting. + ## Use it only if `command` comes from trused source. poStdErrToStdOut, ## merge stdout and stderr to the stdout stream poParentStreams ## use the parent's streams +template poUseShell*: TProcessOption {.deprecated.} = poUsePath + ## Deprecated alias for poUsePath. + +proc quoteShellWindows*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} = + ## Quote s, so it can be safely passed to Windows API. + ## Based on Python's subprocess.list2cmdline + ## See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + let needQuote = {' ', '\t'} in s or s.len == 0 + + result = "" + var backslashBuff = "" + if needQuote: + result.add("\"") + + for c in s: + if c == '\\': + backslashBuff.add(c) + elif c == '\"': + result.add(backslashBuff) + result.add(backslashBuff) + backslashBuff.setLen(0) + result.add("\\\"") + else: + if backslashBuff.len != 0: + result.add(backslashBuff) + backslashBuff.setLen(0) + result.add(c) + + if needQuote: + result.add("\"") + +proc quoteShellPosix*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} = + ## Quote s, so it can be safely passed to POSIX shell. + ## Based on Python's pipes.quote + const safeUnixChars = {'%', '+', '-', '.', '/', '_', ':', '=', '@', + '0'..'9', 'A'..'Z', 'a'..'z'} + if s.len == 0: + return "''" + + let safe = s.allCharsInSet(safeUnixChars) + + if safe: + return s + else: + return "'" & s.replace("'", "'\"'\"'") & "'" + +proc quoteShell*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} = + ## Quote s, so it can be safely passed to shell. + when defined(Windows): + return quoteShellWindows(s) + elif defined(posix): + return quoteShellPosix(s) + else: + {.error:"quoteShell is not supported on your system".} + proc execProcess*(command: string, + args: openarray[string] = [], + env: PStringTable = nil, options: set[TProcessOption] = {poStdErrToStdOut, - poUseShell}): TaintedString {. + poUsePath, + poEvalCommand}): TaintedString {. rtl, extern: "nosp$1", tags: [FExecIO, FReadIO].} ## A convenience procedure that executes ``command`` with ``startProcess`` ## and returns its output as a string. + ## WARNING: this function uses poEvalCommand by default for backward compatibility. + ## Make sure to pass options explicitly. proc execCmd*(command: string): int {.rtl, extern: "nosp$1", tags: [FExecIO].} ## Executes ``command`` and returns its error code. Standard input, output, @@ -56,9 +119,9 @@ proc execCmd*(command: string): int {.rtl, extern: "nosp$1", tags: [FExecIO].} proc startProcess*(command: string, workingDir: string = "", - args: openarray[string] = [], - env: PStringTable = nil, - options: set[TProcessOption] = {poStdErrToStdOut}): + args: openArray[string] = [], + env: PStringTable = nil, + options: set[TProcessOption] = {poStdErrToStdOut}): PProcess {.rtl, extern: "nosp$1", tags: [FExecIO, FReadEnv].} ## Starts a process. `Command` is the executable file, `workingDir` is the ## process's working directory. If ``workingDir == ""`` the current directory @@ -75,16 +138,10 @@ proc startProcess*(command: string, ## but ``EOS`` is raised in case of an error. proc startCmd*(command: string, options: set[TProcessOption] = { - poStdErrToStdOut, poUseShell}): PProcess {. - tags: [FExecIO, FReadEnv].} = - ## a simpler version of `startProcess` that parses the command line into - ## program and arguments and then calls `startProcess` with the empty string - ## for `workingDir` and the nil string table for `env`. - var c = parseCmdLine(command) - var a: seq[string] - newSeq(a, c.len-1) # avoid slicing for now (still unstable) - for i in 1 .. c.len-1: a[i-1] = c[i] - result = startProcess(command=c[0], args=a, options=options) + poStdErrToStdOut, poUsePath}): PProcess {. + tags: [FExecIO, FReadEnv], deprecated.} = + ## Deprecated - use `startProcess` directly. + result = startProcess(command=command, options=options + {poEvalCommand}) proc close*(p: PProcess) {.rtl, extern: "nosp$1", tags: [].} ## When the process has finished executing, cleanup related handles @@ -105,7 +162,7 @@ proc processID*(p: PProcess): int {.rtl, extern: "nosp$1".} = ## returns `p`'s process ID. return p.id -proc waitForExit*(p: PProcess, timeout: int = -1): int {.rtl, +proc waitForExit*(p: PProcess, timeout: int = -1): int {.rtl, extern: "nosp$1", tags: [].} ## waits for the process to finish and returns `p`'s error code. @@ -115,19 +172,19 @@ proc peekExitCode*(p: PProcess): int {.tags: [].} proc inputStream*(p: PProcess): PStream {.rtl, extern: "nosp$1", tags: [].} ## returns ``p``'s input stream for writing to. ## - ## **Warning**: The returned `PStream` should not be closed manually as it + ## **Warning**: The returned `PStream` should not be closed manually as it ## is closed when closing the PProcess ``p``. proc outputStream*(p: PProcess): PStream {.rtl, extern: "nosp$1", tags: [].} ## returns ``p``'s output stream for reading from. ## - ## **Warning**: The returned `PStream` should not be closed manually as it + ## **Warning**: The returned `PStream` should not be closed manually as it ## is closed when closing the PProcess ``p``. proc errorStream*(p: PProcess): PStream {.rtl, extern: "nosp$1", tags: [].} ## returns ``p``'s error stream for reading from. ## - ## **Warning**: The returned `PStream` should not be closed manually as it + ## **Warning**: The returned `PStream` should not be closed manually as it ## is closed when closing the PProcess ``p``. proc inputHandle*(p: PProcess): TFileHandle {.rtl, extern: "nosp$1", @@ -167,7 +224,7 @@ proc countProcessors*(): int {.rtl, extern: "nosp$1".} = ## returns the numer of the processors/cores the machine has. ## Returns 0 if it cannot be detected. when defined(windows): - var x = getenv("NUMBER_OF_PROCESSORS") + var x = getEnv("NUMBER_OF_PROCESSORS") if x.len > 0: result = parseInt(x.string) elif defined(macosx) or defined(bsd): var @@ -193,15 +250,15 @@ proc countProcessors*(): int {.rtl, extern: "nosp$1".} = proc execProcesses*(cmds: openArray[string], options = {poStdErrToStdOut, poParentStreams}, - n = countProcessors()): int {.rtl, extern: "nosp$1", - tags: [FExecIO, FTime, FReadEnv].} = + n = countProcessors()): int {.rtl, extern: "nosp$1", + tags: [FExecIO, FTime, FReadEnv]} = ## executes the commands `cmds` in parallel. Creates `n` processes ## that execute in parallel. The highest return value of all processes ## is returned. when defined(posix): # poParentStreams causes problems on Posix, so we simply disable it: var options = options - {poParentStreams} - + assert n > 0 if n > 1: var q: seq[PProcess] @@ -255,13 +312,17 @@ proc select*(readfds: var seq[PProcess], timeout = 500): int when not defined(useNimRtl): proc execProcess(command: string, + args: openarray[string] = [], + env: PStringTable = nil, options: set[TProcessOption] = {poStdErrToStdOut, - poUseShell}): TaintedString = - var p = startCmd(command, options=options) + poUsePath, + poEvalCommand}): TaintedString = + var p = startProcess(command, args=args, env=env, options=options) var outp = outputStream(p) result = TaintedString"" var line = newStringOfCap(120).TaintedString while true: + # FIXME: converts CR-LF to LF. if outp.readLine(line): result.string.add(line.string) result.string.add("\n") @@ -277,18 +338,18 @@ when defined(Windows) and not defined(useNimRtl): handle: THandle atTheEnd: bool - proc hsClose(s: PStream) = nil # nothing to do here + proc hsClose(s: PStream) = discard # nothing to do here proc hsAtEnd(s: PStream): bool = return PFileHandleStream(s).atTheEnd proc hsReadData(s: PStream, buffer: pointer, bufLen: int): int = var s = PFileHandleStream(s) if s.atTheEnd: return 0 var br: int32 - var a = winlean.ReadFile(s.handle, buffer, bufLen.cint, br, nil) + var a = winlean.readFile(s.handle, buffer, bufLen.cint, br, nil) # TRUE and zero bytes returned (EOF). # TRUE and n (>0) bytes returned (good data). # FALSE and bytes returned undefined (system error). - if a == 0 and br != 0: OSError(OSLastError()) + if a == 0 and br != 0: osError(osLastError()) s.atTheEnd = br < bufLen result = br @@ -296,7 +357,7 @@ when defined(Windows) and not defined(useNimRtl): var s = PFileHandleStream(s) var bytesWritten: int32 var a = winlean.writeFile(s.handle, buffer, bufLen.cint, bytesWritten, nil) - if a == 0: OSError(OSLastError()) + if a == 0: osError(osLastError()) proc newFileHandleStream(handle: THandle): PFileHandleStream = new(result) @@ -306,11 +367,11 @@ when defined(Windows) and not defined(useNimRtl): result.readDataImpl = hsReadData result.writeDataImpl = hsWriteData - proc buildCommandLine(a: string, args: openarray[string]): cstring = - var res = quoteIfContainsWhite(a) + proc buildCommandLine(a: string, args: openArray[string]): cstring = + var res = quoteShell(a) for i in 0..high(args): res.add(' ') - res.add(quoteIfContainsWhite(args[i])) + res.add(quoteShell(args[i])) result = cast[cstring](alloc0(res.len+1)) copyMem(result, cstring(res), res.len) @@ -331,52 +392,53 @@ when defined(Windows) and not defined(useNimRtl): # O_WRONLY {.importc: "_O_WRONLY", header: "<fcntl.h>".}: int # O_RDONLY {.importc: "_O_RDONLY", header: "<fcntl.h>".}: int - proc CreatePipeHandles(Rdhandle, WrHandle: var THandle) = - var piInheritablePipe: TSecurityAttributes - piInheritablePipe.nlength = SizeOF(TSecurityAttributes).cint + proc createPipeHandles(rdHandle, wrHandle: var THandle) = + var piInheritablePipe: TSECURITY_ATTRIBUTES + piInheritablePipe.nLength = sizeof(TSECURITY_ATTRIBUTES).cint piInheritablePipe.lpSecurityDescriptor = nil - piInheritablePipe.Binherithandle = 1 - if CreatePipe(Rdhandle, Wrhandle, piInheritablePipe, 1024) == 0'i32: - OSError(OSLastError()) + piInheritablePipe.bInheritHandle = 1 + if createPipe(rdHandle, wrHandle, piInheritablePipe, 1024) == 0'i32: + osError(osLastError()) proc fileClose(h: THandle) {.inline.} = - if h > 4: discard CloseHandle(h) + if h > 4: discard closeHandle(h) proc startProcess(command: string, workingDir: string = "", - args: openarray[string] = [], + args: openArray[string] = [], env: PStringTable = nil, options: set[TProcessOption] = {poStdErrToStdOut}): PProcess = var - SI: TStartupInfo - ProcInfo: TProcessInformation + si: TSTARTUPINFO + procInfo: TPROCESS_INFORMATION success: int hi, ho, he: THandle new(result) - SI.cb = SizeOf(SI).cint + si.cb = sizeof(si).cint if poParentStreams notin options: - SI.dwFlags = STARTF_USESTDHANDLES # STARTF_USESHOWWINDOW or - CreatePipeHandles(SI.hStdInput, HI) - CreatePipeHandles(HO, Si.hStdOutput) + si.dwFlags = STARTF_USESTDHANDLES # STARTF_USESHOWWINDOW or + createPipeHandles(si.hStdInput, hi) + createPipeHandles(ho, si.hStdOutput) if poStdErrToStdOut in options: - SI.hStdError = SI.hStdOutput - HE = HO + si.hStdError = si.hStdOutput + he = ho else: - CreatePipeHandles(HE, Si.hStdError) + createPipeHandles(he, si.hStdError) result.inHandle = TFileHandle(hi) result.outHandle = TFileHandle(ho) result.errHandle = TFileHandle(he) else: - SI.hStdError = GetStdHandle(STD_ERROR_HANDLE) - SI.hStdInput = GetStdHandle(STD_INPUT_HANDLE) - SI.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE) + si.hStdError = getStdHandle(STD_ERROR_HANDLE) + si.hStdInput = getStdHandle(STD_INPUT_HANDLE) + si.hStdOutput = getStdHandle(STD_OUTPUT_HANDLE) result.inHandle = TFileHandle(si.hStdInput) result.outHandle = TFileHandle(si.hStdOutput) result.errHandle = TFileHandle(si.hStdError) var cmdl: cstring - when false: # poUseShell in options: - cmdl = buildCommandLine(getEnv("COMSPEC"), @["/c", command] & args) + if poEvalCommand in options: + cmdl = command + assert args.len == 0 else: cmdl = buildCommandLine(command, args) var wd: cstring = nil @@ -388,64 +450,63 @@ when defined(Windows) and not defined(useNimRtl): var tmp = newWideCString(cmdl) var ee = newWideCString(e) var wwd = newWideCString(wd) - success = winlean.CreateProcessW(nil, - tmp, nil, nil, 1, NORMAL_PRIORITY_CLASS or CREATE_UNICODE_ENVIRONMENT, - ee, wwd, SI, ProcInfo) + success = winlean.createProcessW(nil, + tmp, nil, nil, 1, NORMAL_PRIORITY_CLASS or CREATE_UNICODE_ENVIRONMENT, + ee, wwd, si, procInfo) else: - success = winlean.CreateProcessA(nil, - cmdl, nil, nil, 1, NORMAL_PRIORITY_CLASS, e, wd, SI, ProcInfo) - let lastError = OSLastError() + success = winlean.createProcessA(nil, + cmdl, nil, nil, 1, NORMAL_PRIORITY_CLASS, e, wd, si, procInfo) + let lastError = osLastError() if poParentStreams notin options: - FileClose(si.hStdInput) - FileClose(si.hStdOutput) + fileClose(si.hStdInput) + fileClose(si.hStdOutput) if poStdErrToStdOut notin options: - FileClose(si.hStdError) + fileClose(si.hStdError) if e != nil: dealloc(e) - dealloc(cmdl) - if success == 0: OSError(lastError) + if success == 0: osError(lastError) # Close the handle now so anyone waiting is woken: discard closeHandle(procInfo.hThread) - result.FProcessHandle = procInfo.hProcess - result.id = procInfo.dwProcessID + result.fProcessHandle = procInfo.hProcess + result.id = procInfo.dwProcessId proc close(p: PProcess) = when false: # somehow this does not work on Windows: - discard CloseHandle(p.inHandle) - discard CloseHandle(p.outHandle) - discard CloseHandle(p.errHandle) - discard CloseHandle(p.FProcessHandle) + discard closeHandle(p.inHandle) + discard closeHandle(p.outHandle) + discard closeHandle(p.errHandle) + discard closeHandle(p.FProcessHandle) proc suspend(p: PProcess) = - discard SuspendThread(p.FProcessHandle) + discard suspendThread(p.fProcessHandle) proc resume(p: PProcess) = - discard ResumeThread(p.FProcessHandle) + discard resumeThread(p.fProcessHandle) proc running(p: PProcess): bool = - var x = waitForSingleObject(p.FProcessHandle, 50) + var x = waitForSingleObject(p.fProcessHandle, 50) return x == WAIT_TIMEOUT proc terminate(p: PProcess) = if running(p): - discard TerminateProcess(p.FProcessHandle, 0) + discard terminateProcess(p.fProcessHandle, 0) proc waitForExit(p: PProcess, timeout: int = -1): int = - discard WaitForSingleObject(p.FProcessHandle, timeout.int32) + discard waitForSingleObject(p.fProcessHandle, timeout.int32) var res: int32 - discard GetExitCodeProcess(p.FProcessHandle, res) + discard getExitCodeProcess(p.fProcessHandle, res) result = res - discard CloseHandle(p.FProcessHandle) + discard closeHandle(p.fProcessHandle) proc peekExitCode(p: PProcess): int = - var b = waitForSingleObject(p.FProcessHandle, 50) == WAIT_TIMEOUT + var b = waitForSingleObject(p.fProcessHandle, 50) == WAIT_TIMEOUT if b: result = -1 - else: + else: var res: int32 - discard GetExitCodeProcess(p.FProcessHandle, res) + discard getExitCodeProcess(p.fProcessHandle, res) return res proc inputStream(p: PProcess): PStream = @@ -459,46 +520,46 @@ when defined(Windows) and not defined(useNimRtl): proc execCmd(command: string): int = var - SI: TStartupInfo - ProcInfo: TProcessInformation + si: TSTARTUPINFO + procInfo: TPROCESS_INFORMATION process: THandle L: int32 - SI.cb = SizeOf(SI).cint - SI.hStdError = GetStdHandle(STD_ERROR_HANDLE) - SI.hStdInput = GetStdHandle(STD_INPUT_HANDLE) - SI.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE) + si.cb = sizeof(si).cint + si.hStdError = getStdHandle(STD_ERROR_HANDLE) + si.hStdInput = getStdHandle(STD_INPUT_HANDLE) + si.hStdOutput = getStdHandle(STD_OUTPUT_HANDLE) when useWinUnicode: var c = newWideCString(command) - var res = winlean.CreateProcessW(nil, c, nil, nil, 0, - NORMAL_PRIORITY_CLASS, nil, nil, SI, ProcInfo) + var res = winlean.createProcessW(nil, c, nil, nil, 0, + NORMAL_PRIORITY_CLASS, nil, nil, si, procInfo) else: - var res = winlean.CreateProcessA(nil, command, nil, nil, 0, - NORMAL_PRIORITY_CLASS, nil, nil, SI, ProcInfo) + var res = winlean.createProcessA(nil, command, nil, nil, 0, + NORMAL_PRIORITY_CLASS, nil, nil, si, procInfo) if res == 0: - OSError(OSLastError()) + osError(osLastError()) else: - Process = ProcInfo.hProcess - discard CloseHandle(ProcInfo.hThread) - if WaitForSingleObject(Process, INFINITE) != -1: - discard GetExitCodeProcess(Process, L) + process = procInfo.hProcess + discard closeHandle(procInfo.hThread) + if waitForSingleObject(process, INFINITE) != -1: + discard getExitCodeProcess(process, L) result = int(L) else: result = -1 - discard CloseHandle(Process) + discard closeHandle(process) - proc select(readfds: var seq[PProcess], timeout = 500): int = + proc select(readfds: var seq[PProcess], timeout = 500): int = assert readfds.len <= MAXIMUM_WAIT_OBJECTS var rfds: TWOHandleArray for i in 0..readfds.len()-1: - rfds[i] = readfds[i].FProcessHandle - - var ret = waitForMultipleObjects(readfds.len.int32, + rfds[i] = readfds[i].fProcessHandle + + var ret = waitForMultipleObjects(readfds.len.int32, addr(rfds), 0'i32, timeout.int32) case ret of WAIT_TIMEOUT: return 0 of WAIT_FAILED: - OSError(OSLastError()) + osError(osLastError()) else: var i = ret - WAIT_OBJECT_0 readfds.del(i) @@ -509,22 +570,7 @@ elif not defined(useNimRtl): readIdx = 0 writeIdx = 1 - proc addCmdArgs(command: string, args: openarray[string]): string = - result = quoteIfContainsWhite(command) - for i in 0 .. high(args): - add(result, " ") - add(result, quoteIfContainsWhite(args[i])) - - proc toCStringArray(b, a: openarray[string]): cstringArray = - result = cast[cstringArray](alloc0((a.len + b.len + 1) * sizeof(cstring))) - for i in 0..high(b): - result[i] = cast[cstring](alloc(b[i].len+1)) - copyMem(result[i], cstring(b[i]), b[i].len+1) - for i in 0..high(a): - result[i+b.len] = cast[cstring](alloc(a[i].len+1)) - copyMem(result[i+b.len], cstring(a[i]), a[i].len+1) - - proc ToCStringArray(t: PStringTable): cstringArray = + proc envToCStringArray(t: PStringTable): cstringArray = result = cast[cstringArray](alloc0((t.len + 1) * sizeof(cstring))) var i = 0 for key, val in pairs(t): @@ -533,7 +579,7 @@ elif not defined(useNimRtl): copyMem(result[i], addr(x[0]), x.len+1) inc(i) - proc EnvToCStringArray(): cstringArray = + proc envToCStringArray(): cstringArray = var counter = 0 for key, val in envPairs(): inc counter result = cast[cstringArray](alloc0((counter + 1) * sizeof(cstring))) @@ -543,104 +589,113 @@ elif not defined(useNimRtl): result[i] = cast[cstring](alloc(x.len+1)) copyMem(result[i], addr(x[0]), x.len+1) inc(i) - + proc startProcess(command: string, workingDir: string = "", - args: openarray[string] = [], + args: openArray[string] = [], env: PStringTable = nil, options: set[TProcessOption] = {poStdErrToStdOut}): PProcess = var - p_stdin, p_stdout, p_stderr: array [0..1, cint] + pStdin, pStdout, pStderr: array [0..1, cint] new(result) result.exitCode = -3 # for ``waitForExit`` if poParentStreams notin options: - if pipe(p_stdin) != 0'i32 or pipe(p_stdout) != 0'i32 or - pipe(p_stderr) != 0'i32: - OSError(OSLastError()) - + if pipe(pStdin) != 0'i32 or pipe(pStdout) != 0'i32 or + pipe(pStderr) != 0'i32: + osError(osLastError()) + + var sys_command: string + var sys_args_raw: seq[string] + if poEvalCommand in options: + sys_command = "/bin/sh" + sys_args_raw = @[sys_command, "-c", command] + assert args.len == 0 + else: + sys_command = command + sys_args_raw = @[command] + for arg in args.items: + sys_args_raw.add arg + + var sys_args = allocCStringArray(sys_args_raw) + finally: deallocCStringArray(sys_args) + var pid: TPid when defined(posix_spawn) and not defined(useFork): var attr: Tposix_spawnattr var fops: Tposix_spawn_file_actions - template chck(e: expr) = - if e != 0'i32: OSError(OSLastError()) + template chck(e: expr) = + if e != 0'i32: osError(osLastError()) chck posix_spawn_file_actions_init(fops) chck posix_spawnattr_init(attr) - + var mask: Tsigset chck sigemptyset(mask) chck posix_spawnattr_setsigmask(attr, mask) chck posix_spawnattr_setpgroup(attr, 0'i32) - + chck posix_spawnattr_setflags(attr, POSIX_SPAWN_USEVFORK or POSIX_SPAWN_SETSIGMASK or POSIX_SPAWN_SETPGROUP) if poParentStreams notin options: - chck posix_spawn_file_actions_addclose(fops, p_stdin[writeIdx]) - chck posix_spawn_file_actions_adddup2(fops, p_stdin[readIdx], readIdx) - chck posix_spawn_file_actions_addclose(fops, p_stdout[readIdx]) - chck posix_spawn_file_actions_adddup2(fops, p_stdout[writeIdx], writeIdx) - chck posix_spawn_file_actions_addclose(fops, p_stderr[readIdx]) + chck posix_spawn_file_actions_addclose(fops, pStdin[writeIdx]) + chck posix_spawn_file_actions_adddup2(fops, pStdin[readIdx], readIdx) + chck posix_spawn_file_actions_addclose(fops, pStdout[readIdx]) + chck posix_spawn_file_actions_adddup2(fops, pStdout[writeIdx], writeIdx) + chck posix_spawn_file_actions_addclose(fops, pStderr[readIdx]) if poStdErrToStdOut in options: - chck posix_spawn_file_actions_adddup2(fops, p_stdout[writeIdx], 2) + chck posix_spawn_file_actions_adddup2(fops, pStdout[writeIdx], 2) else: chck posix_spawn_file_actions_adddup2(fops, p_stderr[writeIdx], 2) - - var e = if env == nil: EnvToCStringArray() else: ToCStringArray(env) - var a: cstringArray + + var sys_env = if env == nil: envToCStringArray() else: envToCStringArray(env) var res: cint + # This is incorrect! if workingDir.len > 0: os.setCurrentDir(workingDir) - if poUseShell notin options: - a = toCStringArray([extractFilename(command)], args) - res = posix_spawn(pid, command, fops, attr, a, e) + if poUsePath in options: + res = posix_spawnp(pid, sys_command, fops, attr, sys_args, sys_env) else: - var x = addCmdArgs(command, args) - a = toCStringArray(["sh", "-c"], [x]) - res = posix_spawn(pid, "/bin/sh", fops, attr, a, e) - deallocCStringArray(a) - deallocCStringArray(e) + res = posix_spawn(pid, sys_command, fops, attr, sys_args, sys_env) + deallocCStringArray(sys_env) discard posix_spawn_file_actions_destroy(fops) discard posix_spawnattr_destroy(attr) chck res else: - - Pid = fork() - if Pid < 0: OSError(OSLastError()) + pid = fork() + if pid < 0: osError(osLastError()) if pid == 0: ## child process: if poParentStreams notin options: discard close(p_stdin[writeIdx]) - if dup2(p_stdin[readIdx], readIdx) < 0: OSError(OSLastError()) + if dup2(p_stdin[readIdx], readIdx) < 0: osError(osLastError()) discard close(p_stdout[readIdx]) - if dup2(p_stdout[writeIdx], writeIdx) < 0: OSError(OSLastError()) + if dup2(p_stdout[writeIdx], writeIdx) < 0: osError(osLastError()) discard close(p_stderr[readIdx]) if poStdErrToStdOut in options: - if dup2(p_stdout[writeIdx], 2) < 0: OSError(OSLastError()) + if dup2(p_stdout[writeIdx], 2) < 0: osError(osLastError()) else: - if dup2(p_stderr[writeIdx], 2) < 0: OSError(OSLastError()) + if dup2(p_stderr[writeIdx], 2) < 0: osError(osLastError()) # Create a new process group if setpgid(0, 0) == -1: quit("setpgid call failed: " & $strerror(errno)) if workingDir.len > 0: os.setCurrentDir(workingDir) - if poUseShell notin options: - var a = toCStringArray([extractFilename(command)], args) - if env == nil: - discard execv(command, a) + + if env == nil: + if poUsePath in options: + discard execvp(sys_command, sys_args) else: - discard execve(command, a, ToCStringArray(env)) + discard execv(sys_command, sys_args) else: - var x = addCmdArgs(command, args) - var a = toCStringArray(["sh", "-c"], [x]) - if env == nil: - discard execv("/bin/sh", a) + var c_env = envToCStringArray(env) + if poUsePath in options: + discard execvpe(sys_command, sys_args, c_env) else: - discard execve("/bin/sh", a, ToCStringArray(env)) + discard execve(sys_command, sys_args, c_env) # too risky to raise an exception here: quit("execve call failed: " & $strerror(errno)) # Parent process. Copy process information. @@ -657,16 +712,16 @@ elif not defined(useNimRtl): else: result.errHandle = 2 else: - result.inHandle = p_stdin[writeIdx] - result.outHandle = p_stdout[readIdx] + result.inHandle = pStdin[writeIdx] + result.outHandle = pStdout[readIdx] if poStdErrToStdOut in options: result.errHandle = result.outHandle - discard close(p_stderr[readIdx]) + discard close(pStderr[readIdx]) else: - result.errHandle = p_stderr[readIdx] - discard close(p_stderr[writeIdx]) - discard close(p_stdin[readIdx]) - discard close(p_stdout[writeIdx]) + result.errHandle = pStderr[readIdx] + discard close(pStderr[writeIdx]) + discard close(pStdin[readIdx]) + discard close(pStdout[writeIdx]) proc close(p: PProcess) = if p.inStream != nil: close(p.inStream) @@ -677,21 +732,21 @@ elif not defined(useNimRtl): discard close(p.errHandle) proc suspend(p: PProcess) = - if kill(-p.id, SIGSTOP) != 0'i32: OSError(OSLastError()) + if kill(-p.id, SIGSTOP) != 0'i32: osError(osLastError()) proc resume(p: PProcess) = - if kill(-p.id, SIGCONT) != 0'i32: OSError(OSLastError()) + if kill(-p.id, SIGCONT) != 0'i32: osError(osLastError()) proc running(p: PProcess): bool = - var ret = waitPid(p.id, p.exitCode, WNOHANG) + var ret = waitpid(p.id, p.exitCode, WNOHANG) if ret == 0: return true # Can't establish status. Assume running. result = ret == int(p.id) proc terminate(p: PProcess) = if kill(-p.id, SIGTERM) == 0'i32: if p.running(): - if kill(-p.id, SIGKILL) != 0'i32: OSError(OSLastError()) - else: OSError(OSLastError()) + if kill(-p.id, SIGKILL) != 0'i32: osError(osLastError()) + else: osError(osLastError()) proc waitForExit(p: PProcess, timeout: int = -1): int = #if waitPid(p.id, p.exitCode, 0) == int(p.id): @@ -699,14 +754,14 @@ elif not defined(useNimRtl): # ``running`` probably set ``p.exitCode`` for us. Since ``p.exitCode`` is # initialized with -3, wrong success exit codes are prevented. if p.exitCode != -3: return p.exitCode - if waitPid(p.id, p.exitCode, 0) < 0: + if waitpid(p.id, p.exitCode, 0) < 0: p.exitCode = -3 - OSError(OSLastError()) + osError(osLastError()) result = int(p.exitCode) shr 8 proc peekExitCode(p: PProcess): int = if p.exitCode != -3: return p.exitCode - var ret = waitPid(p.id, p.exitCode, WNOHANG) + var ret = waitpid(p.id, p.exitCode, WNOHANG) var b = ret == int(p.id) if b: result = -1 if p.exitCode == -3: result = -1 @@ -715,7 +770,7 @@ elif not defined(useNimRtl): proc createStream(stream: var PStream, handle: var TFileHandle, fileMode: TFileMode) = var f: TFile - if not open(f, handle, fileMode): OSError(OSLastError()) + if not open(f, handle, fileMode): osError(osLastError()) stream = newFileStream(f) proc inputStream(p: PProcess): PStream = @@ -736,45 +791,45 @@ elif not defined(useNimRtl): proc csystem(cmd: cstring): cint {.nodecl, importc: "system".} proc execCmd(command: string): int = - result = csystem(command) + result = csystem(command) shr 8 - proc createFdSet(fd: var TFdSet, s: seq[PProcess], m: var int) = + proc createFdSet(fd: var TFdSet, s: seq[PProcess], m: var int) = FD_ZERO(fd) - for i in items(s): + for i in items(s): m = max(m, int(i.outHandle)) FD_SET(cint(i.outHandle), fd) - - proc pruneProcessSet(s: var seq[PProcess], fd: var TFdSet) = + + proc pruneProcessSet(s: var seq[PProcess], fd: var TFdSet) = var i = 0 var L = s.len while i < L: - if FD_ISSET(cint(s[i].outHandle), fd) != 0'i32: + if FD_ISSET(cint(s[i].outHandle), fd) == 0'i32: s[i] = s[L-1] dec(L) else: inc(i) setLen(s, L) - proc select(readfds: var seq[PProcess], timeout = 500): int = + proc select(readfds: var seq[PProcess], timeout = 500): int = var tv: TTimeVal tv.tv_sec = 0 tv.tv_usec = timeout * 1000 - + var rd: TFdSet var m = 0 createFdSet((rd), readfds, m) - + if timeout != -1: result = int(select(cint(m+1), addr(rd), nil, nil, addr(tv))) else: result = int(select(cint(m+1), addr(rd), nil, nil, nil)) - + pruneProcessSet(readfds, (rd)) proc execCmdEx*(command: string, options: set[TProcessOption] = { - poStdErrToStdOut, poUseShell}): tuple[ - output: TaintedString, + poStdErrToStdOut, poUsePath}): tuple[ + output: TaintedString, exitCode: int] {.tags: [FExecIO, FReadIO].} = ## a convenience proc that runs the `command`, grabs all its output and ## exit code and returns both. @@ -792,5 +847,14 @@ proc execCmdEx*(command: string, options: set[TProcessOption] = { close(p) when isMainModule: - var x = execProcess("gcc -v") - echo "ECHO ", x + assert quoteShellWindows("aaa") == "aaa" + assert quoteShellWindows("aaa\"") == "aaa\\\"" + assert quoteShellWindows("") == "\"\"" + + assert quoteShellPosix("aaa") == "aaa" + assert quoteShellPosix("aaa a") == "'aaa a'" + assert quoteShellPosix("") == "''" + assert quoteShellPosix("a'a") == "'a'\"'\"'a'" + + when defined(posix): + assert quoteShell("") == "''" diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim index e8014cece..f3249b107 100644 --- a/lib/pure/parsecfg.nim +++ b/lib/pure/parsecfg.nim @@ -82,7 +82,7 @@ proc open*(c: var TCfgParser, input: PStream, filename: string, c.filename = filename c.tok.kind = tkInvalid c.tok.literal = "" - inc(c.linenumber, lineOffset) + inc(c.lineNumber, lineOffset) rawGetTok(c, c.tok) proc close*(c: var TCfgParser) {.rtl, extern: "npc$1".} = @@ -91,11 +91,11 @@ proc close*(c: var TCfgParser) {.rtl, extern: "npc$1".} = proc getColumn*(c: TCfgParser): int {.rtl, extern: "npc$1".} = ## get the current column the parser has arrived at. - result = getColNumber(c, c.bufPos) + result = getColNumber(c, c.bufpos) proc getLine*(c: TCfgParser): int {.rtl, extern: "npc$1".} = ## get the current line the parser has arrived at. - result = c.linenumber + result = c.lineNumber proc getFilename*(c: TCfgParser): string {.rtl, extern: "npc$1".} = ## get the filename of the file that the parser processes. @@ -113,7 +113,7 @@ proc handleHexChar(c: var TCfgParser, xi: var int) = xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10) inc(c.bufpos) else: - nil + discard proc handleDecChars(c: var TCfgParser, xi: var int) = while c.buf[c.bufpos] in {'0'..'9'}: @@ -125,74 +125,74 @@ proc getEscapedChar(c: var TCfgParser, tok: var TToken) = case c.buf[c.bufpos] of 'n', 'N': add(tok.literal, "\n") - Inc(c.bufpos) + inc(c.bufpos) of 'r', 'R', 'c', 'C': add(tok.literal, '\c') - Inc(c.bufpos) + inc(c.bufpos) of 'l', 'L': add(tok.literal, '\L') - Inc(c.bufpos) + inc(c.bufpos) of 'f', 'F': add(tok.literal, '\f') inc(c.bufpos) of 'e', 'E': add(tok.literal, '\e') - Inc(c.bufpos) + inc(c.bufpos) of 'a', 'A': add(tok.literal, '\a') - Inc(c.bufpos) + inc(c.bufpos) of 'b', 'B': add(tok.literal, '\b') - Inc(c.bufpos) + inc(c.bufpos) of 'v', 'V': add(tok.literal, '\v') - Inc(c.bufpos) + inc(c.bufpos) of 't', 'T': add(tok.literal, '\t') - Inc(c.bufpos) + inc(c.bufpos) of '\'', '"': add(tok.literal, c.buf[c.bufpos]) - Inc(c.bufpos) + inc(c.bufpos) of '\\': add(tok.literal, '\\') - Inc(c.bufpos) + inc(c.bufpos) of 'x', 'X': inc(c.bufpos) var xi = 0 handleHexChar(c, xi) handleHexChar(c, xi) - add(tok.literal, Chr(xi)) + add(tok.literal, chr(xi)) of '0'..'9': var xi = 0 handleDecChars(c, xi) - if (xi <= 255): add(tok.literal, Chr(xi)) + if (xi <= 255): add(tok.literal, chr(xi)) else: tok.kind = tkInvalid else: tok.kind = tkInvalid -proc HandleCRLF(c: var TCfgParser, pos: int): int = +proc handleCRLF(c: var TCfgParser, pos: int): int = case c.buf[pos] - of '\c': result = lexbase.HandleCR(c, pos) - of '\L': result = lexbase.HandleLF(c, pos) + of '\c': result = lexbase.handleCR(c, pos) + of '\L': result = lexbase.handleLF(c, pos) else: result = pos proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) = - var pos = c.bufPos + 1 # skip " + var pos = c.bufpos + 1 # skip " var buf = c.buf # put `buf` in a register tok.kind = tkSymbol if (buf[pos] == '"') and (buf[pos + 1] == '"'): # long string literal: inc(pos, 2) # skip "" # skip leading newline: - pos = HandleCRLF(c, pos) + pos = handleCRLF(c, pos) buf = c.buf while true: case buf[pos] of '"': if (buf[pos + 1] == '"') and (buf[pos + 2] == '"'): break add(tok.literal, '"') - Inc(pos) + inc(pos) of '\c', '\L': - pos = HandleCRLF(c, pos) + pos = handleCRLF(c, pos) buf = c.buf add(tok.literal, "\n") of lexbase.EndOfFile: @@ -200,7 +200,7 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) = break else: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) c.bufpos = pos + 3 # skip the three """ else: # ordinary string literal @@ -213,12 +213,12 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) = tok.kind = tkInvalid break if (ch == '\\') and not rawMode: - c.bufPos = pos + c.bufpos = pos getEscapedChar(c, tok) - pos = c.bufPos + pos = c.bufpos else: add(tok.literal, ch) - Inc(pos) + inc(pos) c.bufpos = pos proc getSymbol(c: var TCfgParser, tok: var TToken) = @@ -226,7 +226,7 @@ proc getSymbol(c: var TCfgParser, tok: var TToken) = var buf = c.buf while true: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) if not (buf[pos] in SymChars): break c.bufpos = pos tok.kind = tkSymbol @@ -237,11 +237,11 @@ proc skip(c: var TCfgParser) = while true: case buf[pos] of ' ', '\t': - Inc(pos) + inc(pos) of '#', ';': while not (buf[pos] in {'\c', '\L', lexbase.EndOfFile}): inc(pos) of '\c', '\L': - pos = HandleCRLF(c, pos) + pos = handleCRLF(c, pos) buf = c.buf else: break # EndOfFile also leaves the loop @@ -249,7 +249,7 @@ proc skip(c: var TCfgParser) = proc rawGetTok(c: var TCfgParser, tok: var TToken) = tok.kind = tkInvalid - setlen(tok.literal, 0) + setLen(tok.literal, 0) skip(c) case c.buf[c.bufpos] of '=': @@ -257,8 +257,8 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) = inc(c.bufpos) tok.literal = "=" of '-': - inc(c.bufPos) - if c.buf[c.bufPos] == '-': inc(c.bufPos) + inc(c.bufpos) + if c.buf[c.bufpos] == '-': inc(c.bufpos) tok.kind = tkDashDash tok.literal = "--" of ':': @@ -266,8 +266,8 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) = inc(c.bufpos) tok.literal = ":" of 'r', 'R': - if c.buf[c.bufPos + 1] == '\"': - Inc(c.bufPos) + if c.buf[c.bufpos + 1] == '\"': + inc(c.bufpos) getString(c, tok, true) else: getSymbol(c, tok) @@ -277,7 +277,7 @@ proc rawGetTok(c: var TCfgParser, tok: var TToken) = tok.literal = "]" of ']': tok.kind = tkBracketRi - Inc(c.bufpos) + inc(c.bufpos) tok.literal = "]" of '"': getString(c, tok, false) diff --git a/lib/pure/parsecsv.nim b/lib/pure/parsecsv.nim index 5970f2090..4b25babec 100644 --- a/lib/pure/parsecsv.nim +++ b/lib/pure/parsecsv.nim @@ -149,7 +149,7 @@ proc readRow*(my: var TCsvParser, columns = 0): bool = of '\c': my.bufpos = handleCR(my, my.bufpos) of '\l': my.bufpos = handleLF(my, my.bufpos) else: break - of '\0': nil + of '\0': discard else: error(my, my.bufpos, my.sep & " expected") break diff --git a/lib/pure/parseopt.nim b/lib/pure/parseopt.nim index 6d9d16bc9..68ae537c7 100644 --- a/lib/pure/parseopt.nim +++ b/lib/pure/parseopt.nim @@ -10,7 +10,10 @@ ## This module provides the standard Nimrod command line parser. ## It supports one convenience iterator over all command line options and some ## lower-level features. - +## +## **Deprecated since version 0.9.3:** Use the `parseopt2 <parseopt2.html>`_ +## module instead as this version has issues with spaces in arguments. +{.deprecated.} {.push debugger: off.} include "system/inclrtl" @@ -34,7 +37,7 @@ type ## or the argument, ``value`` is not "" if ## the option was given a value -when defined(os.ParamCount): +when defined(os.paramCount): # we cannot provide this for NimRtl creation on Posix, because we can't # access the command line arguments then! @@ -47,7 +50,7 @@ when defined(os.ParamCount): result.cmd = cmdline else: result.cmd = "" - for i in countup(1, ParamCount()): + for i in countup(1, paramCount()): result.cmd = result.cmd & quoteIfContainsWhite(paramStr(i).string) & ' ' result.kind = cmdEnd result.key = TaintedString"" @@ -91,8 +94,8 @@ proc next*(p: var TOptParser) {. var i = p.pos while p.cmd[i] in {'\x09', ' '}: inc(i) p.pos = i - setlen(p.key.string, 0) - setlen(p.val.string, 0) + setLen(p.key.string, 0) + setLen(p.val.string, 0) if p.inShortState: handleShortOption(p) return @@ -102,7 +105,7 @@ proc next*(p: var TOptParser) {. of '-': inc(i) if p.cmd[i] == '-': - p.kind = cmdLongOption + p.kind = cmdLongoption inc(i) i = parseWord(p.cmd, i, p.key.string, {'\0', ' ', '\x09', ':', '='}) while p.cmd[i] in {'\x09', ' '}: inc(i) diff --git a/lib/pure/parseopt2.nim b/lib/pure/parseopt2.nim new file mode 100644 index 000000000..5e79d8a18 --- /dev/null +++ b/lib/pure/parseopt2.nim @@ -0,0 +1,148 @@ +# +# +# Nimrod's Runtime Library +# (c) Copyright 2012 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This module provides the standard Nimrod command line parser. +## It supports one convenience iterator over all command line options and some +## lower-level features. +## +## Supported syntax: +## +## 1. short options - ``-abcd``, where a, b, c, d are names +## 2. long option - ``--foo:bar``, ``--foo=bar`` or ``--foo`` +## 3. argument - everything else + +{.push debugger: off.} + +include "system/inclrtl" + +import + os, strutils + +type + TCmdLineKind* = enum ## the detected command line token + cmdEnd, ## end of command line reached + cmdArgument, ## argument detected + cmdLongOption, ## a long option ``--option`` detected + cmdShortOption ## a short option ``-c`` detected + TOptParser* = + object of TObject ## this object implements the command line parser + cmd: seq[string] + pos: int + remainingShortOptions: string + kind*: TCmdLineKind ## the dected command line token + key*, val*: TaintedString ## key and value pair; ``key`` is the option + ## or the argument, ``value`` is not "" if + ## the option was given a value + +proc initOptParser*(cmdline: seq[string]): TOptParser {.rtl.} = + ## Initalizes option parses with cmdline. cmdline should not contain + ## argument 0 - program name. + ## If cmdline == nil default to current command line arguments. + result.remainingShortOptions = "" + when not defined(createNimRtl): + if cmdline == nil: + result.cmd = commandLineParams() + return + else: + assert cmdline != nil, "Cannot determine command line arguments." + + result.cmd = @cmdline + +proc initOptParser*(cmdline: string): TOptParser {.rtl, deprecated.} = + ## Initalizes option parses with cmdline. Splits cmdline in on spaces + ## and calls initOptParser(openarray[string]) + ## Do not use. + if cmdline == "": # backward compatibilty + return initOptParser(seq[string](nil)) + else: + return initOptParser(cmdline.split) + +when not defined(createNimRtl): + proc initOptParser*(): TOptParser = + ## Initializes option parser from current command line arguments. + return initOptParser(commandLineParams()) + +proc next*(p: var TOptParser) {.rtl, extern: "npo$1".} + +proc nextOption(p: var TOptParser, token: string, allowEmpty: bool) = + for splitchar in [':', '=']: + if splitchar in token: + let pos = token.find(splitchar) + p.key = token[0..pos-1] + p.val = token[pos+1..token.len-1] + return + + p.key = token + if allowEmpty: + p.val = "" + else: + p.remainingShortOptions = token[0..token.len-1] + p.next() + +proc next(p: var TOptParser) = + if p.remainingShortOptions.len != 0: + p.kind = cmdShortOption + p.key = TaintedString(p.remainingShortOptions[0..0]) + p.val = "" + p.remainingShortOptions = p.remainingShortOptions[1..p.remainingShortOptions.len-1] + return + + if p.pos >= p.cmd.len: + p.kind = cmdEnd + return + + let token = p.cmd[p.pos] + p.pos += 1 + + if token.startswith("--"): + p.kind = cmdLongOption + nextOption(p, token[2..token.len-1], allowEmpty=true) + elif token.startswith("-"): + p.kind = cmdShortOption + nextOption(p, token[1..token.len-1], allowEmpty=true) + else: + p.kind = cmdArgument + p.key = token + p.val = "" + +proc cmdLineRest*(p: TOptParser): TaintedString {.rtl, extern: "npo$1", deprecated.} = + ## Returns part of command line string that has not been parsed yet. + ## Do not use - does not correctly handle whitespace. + return p.cmd[p.pos..p.cmd.len-1].join(" ") + +type + TGetoptResult* = tuple[kind: TCmdLineKind, key, val: TaintedString] + +when defined(paramCount): + iterator getopt*(): TGetoptResult = + ## This is an convenience iterator for iterating over the command line. + ## This uses the TOptParser object. Example: + ## + ## .. code-block:: nimrod + ## var + ## filename = "" + ## for kind, key, val in getopt(): + ## case kind + ## of cmdArgument: + ## filename = key + ## of cmdLongOption, cmdShortOption: + ## case key + ## of "help", "h": writeHelp() + ## of "version", "v": writeVersion() + ## of cmdEnd: assert(false) # cannot happen + ## if filename == "": + ## # no filename has been given, so we show the help: + ## writeHelp() + var p = initOptParser() + while true: + next(p) + if p.kind == cmdEnd: break + yield (p.kind, p.key, p.val) + +{.pop.} diff --git a/lib/pure/parsesql.nim b/lib/pure/parsesql.nim index 31951e966..3f9686e1e 100644 --- a/lib/pure/parsesql.nim +++ b/lib/pure/parsesql.nim @@ -79,7 +79,7 @@ proc handleHexChar(c: var TSqlLexer, xi: var int) = xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10) inc(c.bufpos) else: - nil + discard proc handleOctChar(c: var TSqlLexer, xi: var int) = if c.buf[c.bufpos] in {'0'..'7'}: @@ -373,7 +373,7 @@ proc getOperator(c: var TSqlLexer, tok: var TToken) = of '+': if not trailingPlusMinus and buf[pos+1] notin operators and tok.literal.len > 0: break - of '*', '<', '>', '=': nil + of '*', '<', '>', '=': discard else: break add(tok.literal, buf[pos]) inc(pos) @@ -1120,7 +1120,7 @@ proc rs(n: PSqlNode, s: var string, indent: int, proc ra(n: PSqlNode, s: var string, indent: int) = if n == nil: return case n.kind - of nkNone: nil + of nkNone: discard of nkIdent: if allCharsInSet(n.strVal, {'\33'..'\127'}): s.add(n.strVal) diff --git a/lib/pure/parseutils.nim b/lib/pure/parseutils.nim index c11265bfd..484ba5184 100644 --- a/lib/pure/parseutils.nim +++ b/lib/pure/parseutils.nim @@ -51,7 +51,7 @@ proc parseHex*(s: string, number: var int, start = 0): int {. elif s[i] == '#': inc(i) while true: case s[i] - of '_': nil + of '_': discard of '0'..'9': number = number shl 4 or (ord(s[i]) - ord('0')) foundDigit = true @@ -74,7 +74,7 @@ proc parseOct*(s: string, number: var int, start = 0): int {. if s[i] == '0' and (s[i+1] == 'o' or s[i+1] == 'O'): inc(i, 2) while true: case s[i] - of '_': nil + of '_': discard of '0'..'7': number = number shl 3 or (ord(s[i]) - ord('0')) foundDigit = true @@ -189,7 +189,7 @@ proc captureBetween*(s: string, first: char, second = '\0', start = 0): string = {.push overflowChecks: on.} # this must be compiled with overflow checking turned on: -proc rawParseInt(s: string, b: var biggestInt, start = 0): int = +proc rawParseInt(s: string, b: var BiggestInt, start = 0): int = var sign: BiggestInt = -1 i = start @@ -207,12 +207,12 @@ proc rawParseInt(s: string, b: var biggestInt, start = 0): int = result = i - start {.pop.} # overflowChecks -proc parseBiggestInt*(s: string, number: var biggestInt, start = 0): int {. +proc parseBiggestInt*(s: string, number: var BiggestInt, start = 0): int {. rtl, extern: "npuParseBiggestInt", noSideEffect.} = ## parses an integer starting at `start` and stores the value into `number`. ## Result is the number of processed chars or 0 if there is no integer. ## `EOverflow` is raised if an overflow occurs. - var res: biggestInt + var res: BiggestInt # use 'res' for exception safety (don't write to 'number' in case of an # overflow exception: result = rawParseInt(s, res, start) @@ -223,7 +223,7 @@ proc parseInt*(s: string, number: var int, start = 0): int {. ## parses an integer starting at `start` and stores the value into `number`. ## Result is the number of processed chars or 0 if there is no integer. ## `EOverflow` is raised if an overflow occurs. - var res: biggestInt + var res: BiggestInt result = parseBiggestInt(s, res, start) if (sizeof(int) <= 4) and ((res < low(int)) or (res > high(int))): @@ -231,7 +231,7 @@ proc parseInt*(s: string, number: var int, start = 0): int {. else: number = int(res) -proc tenToThePowerOf(b: int): biggestFloat = +proc tenToThePowerOf(b: int): BiggestFloat = var b = b var a = 10.0 result = 1.0 @@ -242,7 +242,7 @@ proc tenToThePowerOf(b: int): biggestFloat = if b == 0: break a *= a -proc parseBiggestFloat*(s: string, number: var biggestFloat, start = 0): int {. +proc parseBiggestFloat*(s: string, number: var BiggestFloat, start = 0): int {. rtl, extern: "npuParseBiggestFloat", noSideEffect.} = ## parses a float starting at `start` and stores the value into `number`. ## Result is the number of processed chars or 0 if there occured a parsing @@ -319,7 +319,7 @@ proc parseFloat*(s: string, number: var float, start = 0): int {. ## parses a float starting at `start` and stores the value into `number`. ## Result is the number of processed chars or 0 if there occured a parsing ## error. - var bf: biggestFloat + var bf: BiggestFloat result = parseBiggestFloat(s, bf, start) number = bf @@ -370,7 +370,7 @@ iterator interpolatedFragments*(s: string): tuple[kind: TInterpolatedKind, of '\0': raise newException(EInvalidValue, "Expected closing '}': " & s[i..s.len]) - else: nil + else: discard inc j inc i, 2 # skip ${ kind = ikExpr diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index d8fed845a..70b617393 100644 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -249,23 +249,23 @@ proc newLine*: TPeg {.inline.} = ## constructs the PEG `newline`:idx: (``\n``) result.kind = pkNewline -proc UnicodeLetter*: TPeg {.inline.} = +proc unicodeLetter*: TPeg {.inline.} = ## constructs the PEG ``\letter`` which matches any Unicode letter. result.kind = pkLetter -proc UnicodeLower*: TPeg {.inline.} = +proc unicodeLower*: TPeg {.inline.} = ## constructs the PEG ``\lower`` which matches any Unicode lowercase letter. result.kind = pkLower -proc UnicodeUpper*: TPeg {.inline.} = +proc unicodeUpper*: TPeg {.inline.} = ## constructs the PEG ``\upper`` which matches any Unicode uppercase letter. result.kind = pkUpper -proc UnicodeTitle*: TPeg {.inline.} = +proc unicodeTitle*: TPeg {.inline.} = ## constructs the PEG ``\title`` which matches any Unicode title letter. result.kind = pkTitle -proc UnicodeWhitespace*: TPeg {.inline.} = +proc unicodeWhitespace*: TPeg {.inline.} = ## constructs the PEG ``\white`` which matches any Unicode ## whitespace character. result.kind = pkWhitespace @@ -306,7 +306,7 @@ proc backrefIgnoreStyle*(index: range[1..MaxSubPatterns]): TPeg {. proc spaceCost(n: TPeg): int = case n.kind - of pkEmpty: nil + of pkEmpty: discard of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle, pkChar, pkGreedyRepChar, pkCharChoice, pkGreedyRepSet, pkAny..pkWhitespace, pkGreedyAny: @@ -340,28 +340,28 @@ proc newNonTerminal*(name: string, line, column: int): PNonTerminal {. template letters*: expr = ## expands to ``charset({'A'..'Z', 'a'..'z'})`` - charset({'A'..'Z', 'a'..'z'}) + charSet({'A'..'Z', 'a'..'z'}) template digits*: expr = ## expands to ``charset({'0'..'9'})`` - charset({'0'..'9'}) + charSet({'0'..'9'}) template whitespace*: expr = ## expands to ``charset({' ', '\9'..'\13'})`` - charset({' ', '\9'..'\13'}) + charSet({' ', '\9'..'\13'}) template identChars*: expr = ## expands to ``charset({'a'..'z', 'A'..'Z', '0'..'9', '_'})`` - charset({'a'..'z', 'A'..'Z', '0'..'9', '_'}) + charSet({'a'..'z', 'A'..'Z', '0'..'9', '_'}) template identStartChars*: expr = ## expands to ``charset({'A'..'Z', 'a'..'z', '_'})`` - charset({'a'..'z', 'A'..'Z', '_'}) + charSet({'a'..'z', 'A'..'Z', '_'}) template ident*: expr = ## same as ``[a-zA-Z_][a-zA-z_0-9]*``; standard identifier - sequence(charset({'a'..'z', 'A'..'Z', '_'}), - *charset({'a'..'z', 'A'..'Z', '0'..'9', '_'})) + sequence(charSet({'a'..'z', 'A'..'Z', '_'}), + *charSet({'a'..'z', 'A'..'Z', '0'..'9', '_'})) template natural*: expr = ## same as ``\d+`` @@ -385,7 +385,7 @@ proc esc(c: char, reserved = {'\0'..'\255'}): string = elif c in reserved: result = '\\' & c else: result = $c -proc singleQuoteEsc(c: Char): string = return "'" & esc(c, {'\''}) & "'" +proc singleQuoteEsc(c: char): string = return "'" & esc(c, {'\''}) & "'" proc singleQuoteEsc(str: string): string = result = "'" @@ -409,11 +409,11 @@ proc charSetEscAux(cc: set[char]): string = c1 = c2 inc(c1) -proc CharSetEsc(cc: set[char]): string = +proc charSetEsc(cc: set[char]): string = if card(cc) >= 128+64: - result = "[^" & CharSetEscAux({'\1'..'\xFF'} - cc) & ']' + result = "[^" & charSetEscAux({'\1'..'\xFF'} - cc) & ']' else: - result = '[' & CharSetEscAux(cc) & ']' + result = '[' & charSetEscAux(cc) & ']' proc toStrAux(r: TPeg, res: var string) = case r.kind @@ -590,7 +590,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {. var a: TRune result = start fastRuneAt(s, result, a) - if isWhitespace(a): dec(result, start) + if isWhiteSpace(a): dec(result, start) else: result = -1 else: result = -1 @@ -747,7 +747,7 @@ template fillMatches(s, caps, c: expr) = for k in 0..c.ml-1: caps[k] = substr(s, c.matches[k][0], c.matches[k][1]) -proc match*(s: string, pattern: TPeg, matches: var openarray[string], +proc match*(s: string, pattern: TPeg, matches: var openArray[string], start = 0): bool {.nosideEffect, rtl, extern: "npegs$1Capture".} = ## returns ``true`` if ``s[start..]`` matches the ``pattern`` and ## the captured substrings in the array ``matches``. If it does not @@ -765,7 +765,7 @@ proc match*(s: string, pattern: TPeg, c.origStart = start result = rawMatch(s, pattern, start, c) == len(s)-start -proc matchLen*(s: string, pattern: TPeg, matches: var openarray[string], +proc matchLen*(s: string, pattern: TPeg, matches: var openArray[string], start = 0): int {.nosideEffect, rtl, extern: "npegs$1Capture".} = ## the same as ``match``, but it returns the length of the match, ## if there is no match, -1 is returned. Note that a match length @@ -786,7 +786,7 @@ proc matchLen*(s: string, pattern: TPeg, c.origStart = start result = rawMatch(s, pattern, start, c) -proc find*(s: string, pattern: TPeg, matches: var openarray[string], +proc find*(s: string, pattern: TPeg, matches: var openArray[string], start = 0): int {.nosideEffect, rtl, extern: "npegs$1Capture".} = ## returns the starting position of ``pattern`` in ``s`` and the captured ## substrings in the array ``matches``. If it does not match, nothing @@ -801,7 +801,7 @@ proc find*(s: string, pattern: TPeg, matches: var openarray[string], return -1 # could also use the pattern here: (!P .)* P -proc findBounds*(s: string, pattern: TPeg, matches: var openarray[string], +proc findBounds*(s: string, pattern: TPeg, matches: var openArray[string], start = 0): tuple[first, last: int] {. nosideEffect, rtl, extern: "npegs$1Capture".} = ## returns the starting position and end position of ``pattern`` in ``s`` @@ -869,7 +869,7 @@ template `=~`*(s: string, pattern: TPeg): bool = ## bind maxSubpatterns when not definedInScope(matches): - var matches {.inject.}: array[0..maxSubpatterns-1, string] + var matches {.inject.}: array[0..MaxSubpatterns-1, string] match(s, pattern, matches) # ------------------------- more string handling ------------------------------ @@ -1074,14 +1074,14 @@ const "@", "built-in", "escaped", "$", "$", "^" ] -proc HandleCR(L: var TPegLexer, pos: int): int = +proc handleCR(L: var TPegLexer, pos: int): int = assert(L.buf[pos] == '\c') inc(L.linenumber) result = pos+1 if L.buf[result] == '\L': inc(result) L.lineStart = result -proc HandleLF(L: var TPegLexer, pos: int): int = +proc handleLF(L: var TPegLexer, pos: int): int = assert(L.buf[pos] == '\L') inc(L.linenumber) result = pos+1 @@ -1117,45 +1117,45 @@ proc handleHexChar(c: var TPegLexer, xi: var int) = of 'A'..'F': xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10) inc(c.bufpos) - else: nil + else: discard proc getEscapedChar(c: var TPegLexer, tok: var TToken) = inc(c.bufpos) case c.buf[c.bufpos] of 'r', 'R', 'c', 'C': add(tok.literal, '\c') - Inc(c.bufpos) + inc(c.bufpos) of 'l', 'L': add(tok.literal, '\L') - Inc(c.bufpos) + inc(c.bufpos) of 'f', 'F': add(tok.literal, '\f') inc(c.bufpos) of 'e', 'E': add(tok.literal, '\e') - Inc(c.bufpos) + inc(c.bufpos) of 'a', 'A': add(tok.literal, '\a') - Inc(c.bufpos) + inc(c.bufpos) of 'b', 'B': add(tok.literal, '\b') - Inc(c.bufpos) + inc(c.bufpos) of 'v', 'V': add(tok.literal, '\v') - Inc(c.bufpos) + inc(c.bufpos) of 't', 'T': add(tok.literal, '\t') - Inc(c.bufpos) + inc(c.bufpos) of 'x', 'X': inc(c.bufpos) var xi = 0 handleHexChar(c, xi) handleHexChar(c, xi) if xi == 0: tok.kind = tkInvalid - else: add(tok.literal, Chr(xi)) + else: add(tok.literal, chr(xi)) of '0'..'9': var val = ord(c.buf[c.bufpos]) - ord('0') - Inc(c.bufpos) + inc(c.bufpos) var i = 1 while (i <= 3) and (c.buf[c.bufpos] in {'0'..'9'}): val = val * 10 + ord(c.buf[c.bufpos]) - ord('0') @@ -1169,7 +1169,7 @@ proc getEscapedChar(c: var TPegLexer, tok: var TToken) = tok.kind = tkInvalid else: add(tok.literal, c.buf[c.bufpos]) - Inc(c.bufpos) + inc(c.bufpos) proc skip(c: var TPegLexer) = var pos = c.bufpos @@ -1177,14 +1177,14 @@ proc skip(c: var TPegLexer) = while true: case buf[pos] of ' ', '\t': - Inc(pos) + inc(pos) of '#': while not (buf[pos] in {'\c', '\L', '\0'}): inc(pos) of '\c': - pos = HandleCR(c, pos) + pos = handleCR(c, pos) buf = c.buf of '\L': - pos = HandleLF(c, pos) + pos = handleLF(c, pos) buf = c.buf else: break # EndOfFile also leaves the loop @@ -1209,7 +1209,7 @@ proc getString(c: var TPegLexer, tok: var TToken) = break else: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) c.bufpos = pos proc getDollar(c: var TPegLexer, tok: var TToken) = @@ -1250,7 +1250,7 @@ proc getCharSet(c: var TPegLexer, tok: var TToken) = break else: ch = buf[pos] - Inc(pos) + inc(pos) incl(tok.charset, ch) if buf[pos] == '-': if buf[pos+1] == ']': @@ -1270,7 +1270,7 @@ proc getCharSet(c: var TPegLexer, tok: var TToken) = break else: ch2 = buf[pos] - Inc(pos) + inc(pos) for i in ord(ch)+1 .. ord(ch2): incl(tok.charset, chr(i)) c.bufpos = pos @@ -1281,7 +1281,7 @@ proc getSymbol(c: var TPegLexer, tok: var TToken) = var buf = c.buf while true: add(tok.literal, buf[pos]) - Inc(pos) + inc(pos) if buf[pos] notin strutils.IdentChars: break c.bufpos = pos tok.kind = tkIdentifier @@ -1298,7 +1298,7 @@ proc getBuiltin(c: var TPegLexer, tok: var TToken) = proc getTok(c: var TPegLexer, tok: var TToken) = tok.kind = tkInvalid tok.modifier = modNone - setlen(tok.literal, 0) + setLen(tok.literal, 0) skip(c) case c.buf[c.bufpos] of '{': @@ -1315,14 +1315,14 @@ proc getTok(c: var TPegLexer, tok: var TToken) = inc(c.bufpos) add(tok.literal, '}') of '[': - getCharset(c, tok) + getCharSet(c, tok) of '(': tok.kind = tkParLe - Inc(c.bufpos) + inc(c.bufpos) add(tok.literal, '(') of ')': tok.kind = tkParRi - Inc(c.bufpos) + inc(c.bufpos) add(tok.literal, ')') of '.': tok.kind = tkAny @@ -1347,7 +1347,7 @@ proc getTok(c: var TPegLexer, tok: var TToken) = of "i": tok.modifier = modIgnoreCase of "y": tok.modifier = modIgnoreStyle of "v": tok.modifier = modVerbatim - else: nil + else: discard setLen(tok.literal, 0) if c.buf[c.bufpos] == '$': getDollar(c, tok) @@ -1452,28 +1452,28 @@ proc modifiedTerm(s: string, m: TModifier): TPeg = proc modifiedBackref(s: int, m: TModifier): TPeg = case m - of modNone, modVerbatim: result = backRef(s) - of modIgnoreCase: result = backRefIgnoreCase(s) - of modIgnoreStyle: result = backRefIgnoreStyle(s) + of modNone, modVerbatim: result = backref(s) + of modIgnoreCase: result = backrefIgnoreCase(s) + of modIgnoreStyle: result = backrefIgnoreStyle(s) proc builtin(p: var TPegParser): TPeg = # do not use "y", "skip" or "i" as these would be ambiguous case p.tok.literal of "n": result = newLine() - of "d": result = charset({'0'..'9'}) - of "D": result = charset({'\1'..'\xff'} - {'0'..'9'}) - of "s": result = charset({' ', '\9'..'\13'}) - of "S": result = charset({'\1'..'\xff'} - {' ', '\9'..'\13'}) - of "w": result = charset({'a'..'z', 'A'..'Z', '_', '0'..'9'}) - of "W": result = charset({'\1'..'\xff'} - {'a'..'z','A'..'Z','_','0'..'9'}) - of "a": result = charset({'a'..'z', 'A'..'Z'}) - of "A": result = charset({'\1'..'\xff'} - {'a'..'z', 'A'..'Z'}) + of "d": result = charSet({'0'..'9'}) + of "D": result = charSet({'\1'..'\xff'} - {'0'..'9'}) + of "s": result = charSet({' ', '\9'..'\13'}) + of "S": result = charSet({'\1'..'\xff'} - {' ', '\9'..'\13'}) + of "w": result = charSet({'a'..'z', 'A'..'Z', '_', '0'..'9'}) + of "W": result = charSet({'\1'..'\xff'} - {'a'..'z','A'..'Z','_','0'..'9'}) + of "a": result = charSet({'a'..'z', 'A'..'Z'}) + of "A": result = charSet({'\1'..'\xff'} - {'a'..'z', 'A'..'Z'}) of "ident": result = pegs.ident - of "letter": result = UnicodeLetter() - of "upper": result = UnicodeUpper() - of "lower": result = UnicodeLower() - of "title": result = UnicodeTitle() - of "white": result = UnicodeWhitespace() + of "letter": result = unicodeLetter() + of "upper": result = unicodeUpper() + of "lower": result = unicodeLower() + of "title": result = unicodeTitle() + of "white": result = unicodeWhitespace() else: pegError(p, "unknown built-in: " & p.tok.literal) proc token(terminal: TPeg, p: TPegParser): TPeg = @@ -1494,7 +1494,7 @@ proc primary(p: var TPegParser): TPeg = of tkCurlyAt: getTok(p) return !*\primary(p).token(p) - else: nil + else: discard case p.tok.kind of tkIdentifier: if p.identIsVerbatim: @@ -1505,7 +1505,7 @@ proc primary(p: var TPegParser): TPeg = elif not arrowIsNextTok(p): var nt = getNonTerminal(p, p.tok.literal) incl(nt.flags, ntUsed) - result = nonTerminal(nt).token(p) + result = nonterminal(nt).token(p) getTok(p) else: pegError(p, "expression expected, but found: " & p.tok.literal) @@ -1517,7 +1517,7 @@ proc primary(p: var TPegParser): TPeg = of tkCharSet: if '\0' in p.tok.charset: pegError(p, "binary zero ('\\0') not allowed in character class") - result = charset(p.tok.charset).token(p) + result = charSet(p.tok.charset).token(p) getTok(p) of tkParLe: getTok(p) @@ -1549,7 +1549,7 @@ proc primary(p: var TPegParser): TPeg = of tkBackref: var m = p.tok.modifier if m == modNone: m = p.modifier - result = modifiedBackRef(p.tok.index, m).token(p) + result = modifiedBackref(p.tok.index, m).token(p) if p.tok.index < 0 or p.tok.index > p.captures: pegError(p, "invalid back reference index: " & $p.tok.index) getTok(p) diff --git a/lib/pure/scgi.nim b/lib/pure/scgi.nim index b18fe0094..04b77fafe 100644 --- a/lib/pure/scgi.nim +++ b/lib/pure/scgi.nim @@ -119,7 +119,7 @@ proc next*(s: var TScgistate, timeout: int = -1): bool = ## request, if ``timeout`` is `-1` then this function will never time out. ## Returns `True` if a new request has been processed. var rsocks = @[s.server] - if select(rsocks, timeout) == 1 and rsocks.len == 0: + if select(rsocks, timeout) == 1 and rsocks.len == 1: new(s.client) accept(s.server, s.client) var L = 0 diff --git a/lib/pure/smtp.nim b/lib/pure/smtp.nim index 6a3f65279..88afeb589 100644 --- a/lib/pure/smtp.nim +++ b/lib/pure/smtp.nim @@ -66,13 +66,15 @@ proc checkReply(smtp: var TSMTP, reply: string) = if not line.string.startswith(reply): quitExcpt(smtp, "Expected " & reply & " reply, got: " & line.string) +const compiledWithSsl = defined(ssl) + proc connect*(address: string, port = 25, ssl = false, debug = false): TSMTP = ## Establishes a connection with a SMTP server. ## May fail with EInvalidReply or with a socket error. result.sock = socket() if ssl: - when defined(ssl): + when compiledWithSsl: let ctx = newContext(verifyMode = CVerifyNone) ctx.wrapSocket(result.sock) else: diff --git a/lib/pure/sockets.nim b/lib/pure/sockets.nim index 99117ea4e..76d37879b 100644 --- a/lib/pure/sockets.nim +++ b/lib/pure/sockets.nim @@ -26,7 +26,7 @@ {.deadCodeElim: on.} -when hostos == "solaris": +when hostOS == "solaris": {.passl: "-lsocket -lnsl".} import os, parseutils @@ -132,17 +132,17 @@ type ETimeout* = object of ESynch let - InvalidSocket*: TSocket = nil ## invalid socket + invalidSocket*: TSocket = nil ## invalid socket when defined(windows): let - OSInvalidSocket = winlean.INVALID_SOCKET + osInvalidSocket = winlean.INVALID_SOCKET else: let - OSInvalidSocket = posix.INVALID_SOCKET + osInvalidSocket = posix.INVALID_SOCKET proc newTSocket(fd: TSocketHandle, isBuff: bool): TSocket = - if fd == OSInvalidSocket: + if fd == osInvalidSocket: return nil new(result) result.fd = fd @@ -154,9 +154,8 @@ proc newTSocket(fd: TSocketHandle, isBuff: bool): TSocket = proc `==`*(a, b: TPort): bool {.borrow.} ## ``==`` for ports. -proc `$`*(p: TPort): string = +proc `$`*(p: TPort): string {.borrow.} ## returns the port number as a string - result = $ze(int16(p)) proc ntohl*(x: int32): int32 = ## Converts 32-bit integers from network to host byte order. @@ -188,22 +187,22 @@ proc htons*(x: int16): int16 = result = sockets.ntohs(x) when defined(Posix): - proc ToInt(domain: TDomain): cint = + proc toInt(domain: TDomain): cint = case domain of AF_UNIX: result = posix.AF_UNIX of AF_INET: result = posix.AF_INET of AF_INET6: result = posix.AF_INET6 - else: nil + else: discard - proc ToInt(typ: TType): cint = + proc toInt(typ: TType): cint = case typ of SOCK_STREAM: result = posix.SOCK_STREAM of SOCK_DGRAM: result = posix.SOCK_DGRAM of SOCK_SEQPACKET: result = posix.SOCK_SEQPACKET of SOCK_RAW: result = posix.SOCK_RAW - else: nil + else: discard - proc ToInt(p: TProtocol): cint = + proc toInt(p: TProtocol): cint = case p of IPPROTO_TCP: result = posix.IPPROTO_TCP of IPPROTO_UDP: result = posix.IPPROTO_UDP @@ -211,16 +210,16 @@ when defined(Posix): of IPPROTO_IPV6: result = posix.IPPROTO_IPV6 of IPPROTO_RAW: result = posix.IPPROTO_RAW of IPPROTO_ICMP: result = posix.IPPROTO_ICMP - else: nil + else: discard else: proc toInt(domain: TDomain): cint = result = toU16(ord(domain)) - proc ToInt(typ: TType): cint = + proc toInt(typ: TType): cint = result = cint(ord(typ)) - proc ToInt(p: TProtocol): cint = + proc toInt(p: TProtocol): cint = result = cint(ord(p)) proc socket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, @@ -231,7 +230,7 @@ proc socket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, when defined(Windows): result = newTSocket(winlean.socket(ord(domain), ord(typ), ord(protocol)), buffered) else: - result = newTSocket(posix.socket(ToInt(domain), ToInt(typ), ToInt(protocol)), buffered) + result = newTSocket(posix.socket(toInt(domain), toInt(typ), toInt(protocol)), buffered) when defined(ssl): CRYPTO_malloc_init() @@ -312,7 +311,8 @@ when defined(ssl): newCTX.SSLCTXSetVerify(SSLVerifyNone, nil) if newCTX == nil: SSLError() - + + discard newCTX.SSLCTXSetMode(SSL_MODE_AUTO_RETRY) newCTX.loadCertificates(certFile, keyFile) return PSSLContext(newCTX) @@ -334,7 +334,7 @@ when defined(ssl): if SSLSetFd(socket.sslHandle, socket.fd) != 1: SSLError() -proc SocketError*(socket: TSocket, err: int = -1, async = false) = +proc socketError*(socket: TSocket, err: int = -1, async = false) = ## Raises proper errors based on return values of ``recv`` functions. ## ## If ``async`` is ``True`` no error will be thrown in the case when the @@ -363,28 +363,28 @@ proc SocketError*(socket: TSocket, err: int = -1, async = false) = else: SSLError("Unknown Error") if err == -1 and not (when defined(ssl): socket.isSSL else: false): - let lastError = OSLastError() + let lastError = osLastError() if async: when defined(windows): if lastError.int32 == WSAEWOULDBLOCK: return - else: OSError(lastError) + else: osError(lastError) else: if lastError.int32 == EAGAIN or lastError.int32 == EWOULDBLOCK: return - else: OSError(lastError) - else: OSError(lastError) + else: osError(lastError) + else: osError(lastError) proc listen*(socket: TSocket, backlog = SOMAXCONN) {.tags: [FReadIO].} = ## Marks ``socket`` as accepting connections. ## ``Backlog`` specifies the maximum length of the ## queue of pending connections. - if listen(socket.fd, cint(backlog)) < 0'i32: OSError(OSLastError()) + if listen(socket.fd, cint(backlog)) < 0'i32: osError(osLastError()) proc invalidIp4(s: string) {.noreturn, noinline.} = raise newException(EInvalidValue, "invalid ip4 address: " & s) -proc parseIp4*(s: string): biggestInt = +proc parseIp4*(s: string): BiggestInt = ## parses an IP version 4 in dotted decimal form like "a.b.c.d". ## ## This is equivalent to `inet_ntoa`:idx:. @@ -411,14 +411,14 @@ proc parseIp4*(s: string): biggestInt = if j <= 0: invalidIp4(s) inc(i, j) if s[i] != '\0': invalidIp4(s) - result = biggestInt(a shl 24 or b shl 16 or c shl 8 or d) + result = BiggestInt(a shl 24 or b shl 16 or c shl 8 or d) template gaiNim(a, p, h, list: expr): stmt = block: - var gaiResult = getAddrInfo(a, $p, addr(h), list) + var gaiResult = getaddrinfo(a, $p, addr(h), list) if gaiResult != 0'i32: when defined(windows): - OSError(OSLastError()) + osError(osLastError()) else: raise newException(EOS, $gai_strerror(gaiResult)) @@ -437,17 +437,17 @@ proc bindAddr*(socket: TSocket, port = TPort(0), address = "") {. name.sin_port = sockets.htons(int16(port)) name.sin_addr.s_addr = sockets.htonl(INADDR_ANY) if bindSocket(socket.fd, cast[ptr TSockAddr](addr(name)), - sizeof(name).TSockLen) < 0'i32: - OSError(OSLastError()) + sizeof(name).TSocklen) < 0'i32: + osError(osLastError()) else: - var hints: TAddrInfo - var aiList: ptr TAddrInfo = nil + var hints: Taddrinfo + var aiList: ptr Taddrinfo = nil hints.ai_family = toInt(AF_INET) hints.ai_socktype = toInt(SOCK_STREAM) hints.ai_protocol = toInt(IPPROTO_TCP) gaiNim(address, port, hints, aiList) - if bindSocket(socket.fd, aiList.ai_addr, aiList.ai_addrLen.TSockLen) < 0'i32: - OSError(OSLastError()) + if bindSocket(socket.fd, aiList.ai_addr, aiList.ai_addrlen.TSocklen) < 0'i32: + osError(osLastError()) proc getSockName*(socket: TSocket): TPort = ## returns the socket's associated port number. @@ -458,40 +458,40 @@ proc getSockName*(socket: TSocket): TPort = name.sin_family = posix.AF_INET #name.sin_port = htons(cint16(port)) #name.sin_addr.s_addr = htonl(INADDR_ANY) - var namelen = sizeof(name).TSockLen + var namelen = sizeof(name).TSocklen if getsockname(socket.fd, cast[ptr TSockAddr](addr(name)), addr(namelen)) == -1'i32: - OSError(OSLastError()) + osError(osLastError()) result = TPort(sockets.ntohs(name.sin_port)) template acceptAddrPlain(noClientRet, successRet: expr, sslImplementation: stmt): stmt {.immediate.} = assert(client != nil) var sockAddress: Tsockaddr_in - var addrLen = sizeof(sockAddress).TSockLen + var addrLen = sizeof(sockAddress).TSocklen var sock = accept(server.fd, cast[ptr TSockAddr](addr(sockAddress)), addr(addrLen)) - if sock == OSInvalidSocket: - let err = OSLastError() + if sock == osInvalidSocket: + let err = osLastError() when defined(windows): if err.int32 == WSAEINPROGRESS: - client = InvalidSocket + client = invalidSocket address = "" when noClientRet.int == -1: return else: return noClientRet - else: OSError(err) + else: osError(err) else: if err.int32 == EAGAIN or err.int32 == EWOULDBLOCK: - client = InvalidSocket + client = invalidSocket address = "" when noClientRet.int == -1: return else: return noClientRet - else: OSError(err) + else: osError(err) else: client.fd = sock client.isBuffered = server.isBuffered @@ -629,7 +629,7 @@ proc accept*(server: TSocket): TSocket {.deprecated, tags: [FReadIO].} = proc close*(socket: TSocket) = ## closes a socket. when defined(windows): - discard winlean.closeSocket(socket.fd) + discard winlean.closesocket(socket.fd) else: discard posix.close(socket.fd) # TODO: These values should not be discarded. An EOS should be raised. @@ -670,7 +670,7 @@ proc getServByPort*(port: TPort, proto: string): TServent {.tags: [FReadIO].} = result.port = TPort(s.s_port) result.proto = $s.s_proto -proc getHostByAddr*(ip: string): THostEnt {.tags: [FReadIO].} = +proc getHostByAddr*(ip: string): Thostent {.tags: [FReadIO].} = ## This function will lookup the hostname of an IP Address. var myaddr: TInAddr myaddr.s_addr = inet_addr(ip) @@ -678,43 +678,43 @@ proc getHostByAddr*(ip: string): THostEnt {.tags: [FReadIO].} = when defined(windows): var s = winlean.gethostbyaddr(addr(myaddr), sizeof(myaddr).cuint, cint(sockets.AF_INET)) - if s == nil: OSError(OSLastError()) + if s == nil: osError(osLastError()) else: - var s = posix.gethostbyaddr(addr(myaddr), sizeof(myaddr).TSockLen, + var s = posix.gethostbyaddr(addr(myaddr), sizeof(myaddr).TSocklen, cint(posix.AF_INET)) if s == nil: - raise newException(EOS, $hStrError(h_errno)) + raise newException(EOS, $hstrerror(h_errno)) result.name = $s.h_name result.aliases = cstringArrayToSeq(s.h_aliases) when defined(windows): - result.addrType = TDomain(s.h_addrtype) + result.addrtype = TDomain(s.h_addrtype) else: if s.h_addrtype == posix.AF_INET: - result.addrType = AF_INET + result.addrtype = AF_INET elif s.h_addrtype == posix.AF_INET6: - result.addrType = AF_INET6 + result.addrtype = AF_INET6 else: raise newException(EOS, "unknown h_addrtype") result.addrList = cstringArrayToSeq(s.h_addr_list) result.length = int(s.h_length) -proc getHostByName*(name: string): THostEnt {.tags: [FReadIO].} = +proc getHostByName*(name: string): Thostent {.tags: [FReadIO].} = ## This function will lookup the IP address of a hostname. when defined(Windows): var s = winlean.gethostbyname(name) else: var s = posix.gethostbyname(name) - if s == nil: OSError(OSLastError()) + if s == nil: osError(osLastError()) result.name = $s.h_name result.aliases = cstringArrayToSeq(s.h_aliases) when defined(windows): - result.addrType = TDomain(s.h_addrtype) + result.addrtype = TDomain(s.h_addrtype) else: if s.h_addrtype == posix.AF_INET: - result.addrType = AF_INET + result.addrtype = AF_INET elif s.h_addrtype == posix.AF_INET6: - result.addrType = AF_INET6 + result.addrtype = AF_INET6 else: raise newException(EOS, "unknown h_addrtype") result.addrList = cstringArrayToSeq(s.h_addr_list) @@ -724,10 +724,10 @@ proc getSockOptInt*(socket: TSocket, level, optname: int): int {. tags: [FReadIO].} = ## getsockopt for integer options. var res: cint - var size = sizeof(res).TSockLen + var size = sizeof(res).TSocklen if getsockopt(socket.fd, cint(level), cint(optname), addr(res), addr(size)) < 0'i32: - OSError(OSLastError()) + osError(osLastError()) result = int(res) proc setSockOptInt*(socket: TSocket, level, optname, optval: int) {. @@ -735,8 +735,8 @@ proc setSockOptInt*(socket: TSocket, level, optname, optval: int) {. ## setsockopt for integer options. var value = cint(optval) if setsockopt(socket.fd, cint(level), cint(optname), addr(value), - sizeof(value).TSockLen) < 0'i32: - OSError(OSLastError()) + sizeof(value).TSocklen) < 0'i32: + osError(osLastError()) proc toCInt(opt: TSOBool): cint = case opt @@ -752,10 +752,10 @@ proc getSockOpt*(socket: TSocket, opt: TSOBool, level = SOL_SOCKET): bool {. tags: [FReadIO].} = ## Retrieves option ``opt`` as a boolean value. var res: cint - var size = sizeof(res).TSockLen + var size = sizeof(res).TSocklen if getsockopt(socket.fd, cint(level), toCInt(opt), addr(res), addr(size)) < 0'i32: - OSError(OSLastError()) + osError(osLastError()) result = res != 0 proc setSockOpt*(socket: TSocket, opt: TSOBool, value: bool, level = SOL_SOCKET) {. @@ -763,8 +763,8 @@ proc setSockOpt*(socket: TSocket, opt: TSOBool, value: bool, level = SOL_SOCKET) ## Sets option ``opt`` to a boolean value specified by ``value``. var valuei = cint(if value: 1 else: 0) if setsockopt(socket.fd, cint(level), toCInt(opt), addr(valuei), - sizeof(valuei).TSockLen) < 0'i32: - OSError(OSLastError()) + sizeof(valuei).TSocklen) < 0'i32: + osError(osLastError()) proc connect*(socket: TSocket, address: string, port = TPort(0), af: TDomain = AF_INET) {.tags: [FReadIO].} = @@ -774,8 +774,8 @@ proc connect*(socket: TSocket, address: string, port = TPort(0), ## not do it. ## ## If ``socket`` is an SSL socket a handshake will be automatically performed. - var hints: TAddrInfo - var aiList: ptr TAddrInfo = nil + var hints: Taddrinfo + var aiList: ptr Taddrinfo = nil hints.ai_family = toInt(af) hints.ai_socktype = toInt(SOCK_STREAM) hints.ai_protocol = toInt(IPPROTO_TCP) @@ -785,14 +785,14 @@ proc connect*(socket: TSocket, address: string, port = TPort(0), var lastError: TOSErrorCode var it = aiList while it != nil: - if connect(socket.fd, it.ai_addr, it.ai_addrlen.TSockLen) == 0'i32: + if connect(socket.fd, it.ai_addr, it.ai_addrlen.TSocklen) == 0'i32: success = true break - else: lastError = OSLastError() + else: lastError = osLastError() it = it.ai_next freeaddrinfo(aiList) - if not success: OSError(lastError) + if not success: osError(lastError) when defined(ssl): if socket.isSSL: @@ -837,8 +837,8 @@ proc connectAsync*(socket: TSocket, name: string, port = TPort(0), ## ## **Note**: For SSL sockets, the ``handshake`` procedure must be called ## whenever the socket successfully connects to a server. - var hints: TAddrInfo - var aiList: ptr TAddrInfo = nil + var hints: Taddrinfo + var aiList: ptr Taddrinfo = nil hints.ai_family = toInt(af) hints.ai_socktype = toInt(SOCK_STREAM) hints.ai_protocol = toInt(IPPROTO_TCP) @@ -848,12 +848,12 @@ proc connectAsync*(socket: TSocket, name: string, port = TPort(0), var lastError: TOSErrorCode var it = aiList while it != nil: - var ret = connect(socket.fd, it.ai_addr, it.ai_addrlen.TSockLen) + var ret = connect(socket.fd, it.ai_addr, it.ai_addrlen.TSocklen) if ret == 0'i32: success = true break else: - lastError = OSLastError() + lastError = osLastError() when defined(windows): # Windows EINTR doesn't behave same as POSIX. if lastError.int32 == WSAEWOULDBLOCK: @@ -867,7 +867,7 @@ proc connectAsync*(socket: TSocket, name: string, port = TPort(0), it = it.ai_next freeaddrinfo(aiList) - if not success: OSError(lastError) + if not success: osError(lastError) when defined(ssl): if socket.isSSL: socket.sslNoHandshake = true @@ -913,7 +913,7 @@ when defined(ssl): else: SSLError("Socket is not an SSL socket.") -proc timeValFromMilliseconds(timeout = 500): TTimeVal = +proc timeValFromMilliseconds(timeout = 500): Ttimeval = if timeout != -1: var seconds = timeout div 1000 result.tv_sec = seconds.int32 @@ -929,7 +929,7 @@ proc pruneSocketSet(s: var seq[TSocket], fd: var TFdSet) = var i = 0 var L = s.len while i < L: - if FD_ISSET(s[i].fd, fd) != 0'i32: + if FD_ISSET(s[i].fd, fd) == 0'i32: s[i] = s[L-1] dec(L) else: @@ -971,7 +971,7 @@ proc select*(readfds, writefds, exceptfds: var seq[TSocket], if buffersFilled > 0: return buffersFilled - var tv {.noInit.}: TTimeVal = timeValFromMilliseconds(timeout) + var tv {.noInit.}: Ttimeval = timeValFromMilliseconds(timeout) var rd, wr, ex: TFdSet var m = 0 @@ -994,7 +994,7 @@ proc select*(readfds, writefds: var seq[TSocket], let buffersFilled = checkBuffer(readfds) if buffersFilled > 0: return buffersFilled - var tv {.noInit.}: TTimeVal = timeValFromMilliseconds(timeout) + var tv {.noInit.}: Ttimeval = timeValFromMilliseconds(timeout) var rd, wr: TFdSet var m = 0 @@ -1018,7 +1018,7 @@ proc selectWrite*(writefds: var seq[TSocket], ## ## ``timeout`` is specified in miliseconds and ``-1`` can be specified for ## an unlimited time. - var tv {.noInit.}: TTimeVal = timeValFromMilliseconds(timeout) + var tv {.noInit.}: Ttimeval = timeValFromMilliseconds(timeout) var wr: TFdSet var m = 0 @@ -1036,7 +1036,7 @@ proc select*(readfds: var seq[TSocket], timeout = 500): int = let buffersFilled = checkBuffer(readfds) if buffersFilled > 0: return buffersFilled - var tv {.noInit.}: TTimeVal = timeValFromMilliseconds(timeout) + var tv {.noInit.}: Ttimeval = timeValFromMilliseconds(timeout) var rd: TFdSet var m = 0 @@ -1059,7 +1059,7 @@ proc readIntoBuf(socket: TSocket, flags: int32): int = else: result = recv(socket.fd, addr(socket.buffer), cint(socket.buffer.high), flags) if result <= 0: - socket.buflen = 0 + socket.bufLen = 0 socket.currPos = 0 return result socket.bufLen = result @@ -1143,7 +1143,7 @@ proc waitFor(socket: TSocket, waited: var float, timeout, size: int, var s = @[socket] var startTime = epochTime() let selRet = select(s, timeout - int(waited * 1000.0)) - if selRet < 0: OSError(OSLastError()) + if selRet < 0: osError(osLastError()) if selRet != 1: raise newException(ETimeout, "Call to '" & funcName & "' timed out.") waited += (epochTime() - startTime) @@ -1181,7 +1181,7 @@ proc recv*(socket: TSocket, data: var string, size: int, timeout = -1): int = result = recv(socket, cstring(data), size, timeout) if result < 0: data.setLen(0) - socket.SocketError(result) + socket.socketError(result) data.setLen(result) proc recvAsync*(socket: TSocket, data: var string, size: int): int = @@ -1195,7 +1195,7 @@ proc recvAsync*(socket: TSocket, data: var string, size: int): int = result = recv(socket, cstring(data), size) if result < 0: data.setLen(0) - socket.SocketError(async = true) + socket.socketError(async = true) result = -1 data.setLen(result) @@ -1259,10 +1259,10 @@ proc recvLine*(socket: TSocket, line: var TaintedString, timeout = -1): bool {. if n > 0 and c == '\L': discard recv(socket, addr(c), 1) elif n <= 0: return false - addNlIfEmpty() + addNLIfEmpty() return true elif c == '\L': - addNlIfEmpty() + addNLIfEmpty() return true add(line.string, c) @@ -1292,18 +1292,18 @@ proc readLine*(socket: TSocket, line: var TaintedString, timeout = -1) {. var c: char discard waitFor(socket, waited, timeout, 1, "readLine") var n = recv(socket, addr(c), 1) - if n < 0: OSError(OSLastError()) + if n < 0: socket.socketError() elif n == 0: return if c == '\r': discard waitFor(socket, waited, timeout, 1, "readLine") n = peekChar(socket, c) if n > 0 and c == '\L': discard recv(socket, addr(c), 1) - elif n <= 0: OSError(OSLastError()) - addNlIfEmpty() + elif n <= 0: socket.socketError() + addNLIfEmpty() return elif c == '\L': - addNlIfEmpty() + addNLIfEmpty() return add(line.string, c) @@ -1353,7 +1353,7 @@ proc readLineAsync*(socket: TSocket, setLen(line.string, 0) template errorOrNone = - socket.SocketError(async = true) + socket.socketError(async = true) return ReadNone while true: @@ -1386,7 +1386,7 @@ proc recv*(socket: TSocket): TaintedString {.tags: [FReadIO], deprecated.} = var pos = 0 while true: var bytesRead = recv(socket, addr(string(result)[pos]), bufSize-1) - if bytesRead == -1: OSError(OSLastError()) + if bytesRead == -1: osError(osLastError()) setLen(result.string, pos + bytesRead) if bytesRead != bufSize-1: break # increase capacity: @@ -1455,22 +1455,22 @@ proc recvAsync*(socket: TSocket, s: var TaintedString): bool {. else: SSLError("Unknown Error") if bytesRead == -1 and not (when defined(ssl): socket.isSSL else: false): - let err = OSLastError() + let err = osLastError() when defined(windows): if err.int32 == WSAEWOULDBLOCK: - return False - else: OSError(err) + return false + else: osError(err) else: if err.int32 == EAGAIN or err.int32 == EWOULDBLOCK: - return False - else: OSError(err) + return false + else: osError(err) setLen(s.string, pos + bytesRead) if bytesRead != bufSize-1: break # increase capacity: setLen(s.string, s.string.len + bufSize) inc(pos, bytesRead) - result = True + result = true proc recvFrom*(socket: TSocket, data: var string, length: int, address: var string, port: var TPort, flags = 0'i32): int {. @@ -1489,8 +1489,8 @@ proc recvFrom*(socket: TSocket, data: var string, length: int, # TODO: Buffered sockets data.setLen(length) var sockAddress: Tsockaddr_in - var addrLen = sizeof(sockAddress).TSockLen - result = recvFrom(socket.fd, cstring(data), length.cint, flags.cint, + var addrLen = sizeof(sockAddress).TSocklen + result = recvfrom(socket.fd, cstring(data), length.cint, flags.cint, cast[ptr TSockAddr](addr(sockAddress)), addr(addrLen)) if result != -1: @@ -1498,7 +1498,7 @@ proc recvFrom*(socket: TSocket, data: var string, length: int, address = $inet_ntoa(sockAddress.sin_addr) port = ntohs(sockAddress.sin_port).TPort -proc recvFromAsync*(socket: TSocket, data: var String, length: int, +proc recvFromAsync*(socket: TSocket, data: var string, length: int, address: var string, port: var TPort, flags = 0'i32): bool {.tags: [FReadIO].} = ## Variant of ``recvFrom`` for non-blocking sockets. Unlike ``recvFrom``, @@ -1508,15 +1508,15 @@ proc recvFromAsync*(socket: TSocket, data: var String, length: int, result = true var callRes = recvFrom(socket, data, length, address, port, flags) if callRes < 0: - let err = OSLastError() + let err = osLastError() when defined(windows): if err.int32 == WSAEWOULDBLOCK: - return False - else: OSError(err) + return false + else: osError(err) else: if err.int32 == EAGAIN or err.int32 == EWOULDBLOCK: - return False - else: OSError(err) + return false + else: osError(err) proc skip*(socket: TSocket) {.tags: [FReadIO], deprecated.} = ## skips all the data that is pending for the socket @@ -1524,7 +1524,7 @@ proc skip*(socket: TSocket) {.tags: [FReadIO], deprecated.} = ## **Deprecated since version 0.9.2**: This function is not safe for use. const bufSize = 1000 var buf = alloc(bufSize) - while recv(socket, buf, bufSize) == bufSize: nil + while recv(socket, buf, bufSize) == bufSize: discard dealloc(buf) proc skip*(socket: TSocket, size: int, timeout = -1) = @@ -1566,7 +1566,7 @@ proc send*(socket: TSocket, data: string) {.tags: [FWriteIO].} = if socket.isSSL: SSLError() - OSError(OSLastError()) + osError(osLastError()) if sent != data.len: raise newException(EOS, "Could not send all data.") @@ -1599,15 +1599,15 @@ proc sendAsync*(socket: TSocket, data: string): int {.tags: [FWriteIO].} = else: return if result == -1: - let err = OSLastError() + let err = osLastError() when defined(windows): if err.int32 == WSAEINPROGRESS: return 0 - else: OSError(err) + else: osError(err) else: if err.int32 == EAGAIN or err.int32 == EWOULDBLOCK: return 0 - else: OSError(err) + else: osError(err) proc trySend*(socket: TSocket, data: string): bool {.tags: [FWriteIO].} = @@ -1623,8 +1623,8 @@ proc sendTo*(socket: TSocket, address: string, port: TPort, data: pointer, ## this function will try each IP of that hostname. ## ## **Note:** This proc is not available for SSL sockets. - var hints: TAddrInfo - var aiList: ptr TAddrInfo = nil + var hints: Taddrinfo + var aiList: ptr Taddrinfo = nil hints.ai_family = toInt(af) hints.ai_socktype = toInt(SOCK_STREAM) hints.ai_protocol = toInt(IPPROTO_TCP) @@ -1634,8 +1634,8 @@ proc sendTo*(socket: TSocket, address: string, port: TPort, data: pointer, var success = false var it = aiList while it != nil: - result = sendTo(socket.fd, data, size.cint, flags.cint, it.ai_addr, - it.ai_addrlen.TSockLen) + result = sendto(socket.fd, data, size.cint, flags.cint, it.ai_addr, + it.ai_addrlen.TSocklen) if result != -1'i32: success = true break @@ -1662,16 +1662,16 @@ when defined(Windows): proc setBlocking(s: TSocket, blocking: bool) = when defined(Windows): var mode = clong(ord(not blocking)) # 1 for non-blocking, 0 for blocking - if ioctlsocket(TSocketHandle(s.fd), FIONBIO, addr(mode)) == -1: - OSError(OSLastError()) + if ioctlsocket(s.fd, FIONBIO, addr(mode)) == -1: + osError(osLastError()) else: # BSD sockets var x: int = fcntl(s.fd, F_GETFL, 0) if x == -1: - OSError(OSLastError()) + osError(osLastError()) else: var mode = if blocking: x and not O_NONBLOCK else: x or O_NONBLOCK if fcntl(s.fd, F_SETFL, mode) == -1: - OSError(OSLastError()) + osError(osLastError()) s.nonblocking = not blocking discard """ proc setReuseAddr*(s: TSocket) = @@ -1710,7 +1710,7 @@ proc isBlocking*(socket: TSocket): bool = not socket.nonblocking ## Determines whether ``socket`` is blocking. when defined(Windows): - var wsa: TWSADATA - if WSAStartup(0x0101'i16, addr wsa) != 0: OSError(OSLastError()) + var wsa: TWSAData + if wsaStartup(0x0101'i16, addr wsa) != 0: osError(osLastError()) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 764471b78..e944dd2fc 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -249,7 +249,7 @@ proc fsClose(s: PStream) = close(PFileStream(s).f) PFileStream(s).f = nil proc fsFlush(s: PStream) = flushFile(PFileStream(s).f) -proc fsAtEnd(s: PStream): bool = return EndOfFile(PFileStream(s).f) +proc fsAtEnd(s: PStream): bool = return endOfFile(PFileStream(s).f) proc fsSetPosition(s: PStream, pos: int) = setFilePos(PFileStream(s).f, pos) proc fsGetPosition(s: PStream): int = return int(getFilePos(PFileStream(s).f)) @@ -277,11 +277,11 @@ proc newFileStream*(filename: string, mode: TFileMode): PFileStream = ## If the file cannot be opened, nil is returned. See the `system ## <system.html>`_ module for a list of available TFileMode enums. var f: TFile - if Open(f, filename, mode): result = newFileStream(f) + if open(f, filename, mode): result = newFileStream(f) when true: - nil + discard else: type TFileHandle* = cint ## Operating system file handle diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim index 77b463fc0..7003acfcf 100644 --- a/lib/pure/strtabs.nim +++ b/lib/pure/strtabs.nim @@ -88,10 +88,10 @@ proc mustRehash(length, counter: int): bool = proc nextTry(h, maxHash: THash): THash {.inline.} = result = ((5 * h) + 1) and maxHash -proc RawGet(t: PStringTable, key: string): int = +proc rawGet(t: PStringTable, key: string): int = var h: THash = myhash(t, key) and high(t.data) # start with real hash value while not isNil(t.data[h].key): - if mycmp(t, t.data[h].key, key): + if myCmp(t, t.data[h].key, key): return h h = nextTry(h, high(t.data)) result = - 1 @@ -100,7 +100,7 @@ proc `[]`*(t: PStringTable, key: string): string {.rtl, extern: "nstGet".} = ## retrieves the value at ``t[key]``. If `key` is not in `t`, "" is returned ## and no exception is raised. One can check with ``hasKey`` whether the key ## exists. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val else: result = "" @@ -108,7 +108,7 @@ proc mget*(t: PStringTable, key: string): var string {. rtl, extern: "nstTake".} = ## retrieves the location at ``t[key]``. If `key` is not in `t`, the ## ``EInvalidKey`` exception is raised. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val else: raise newException(EInvalidKey, "key does not exist: " & key) @@ -116,31 +116,31 @@ proc hasKey*(t: PStringTable, key: string): bool {.rtl, extern: "nst$1".} = ## returns true iff `key` is in the table `t`. result = rawGet(t, key) >= 0 -proc RawInsert(t: PStringTable, data: var TKeyValuePairSeq, key, val: string) = +proc rawInsert(t: PStringTable, data: var TKeyValuePairSeq, key, val: string) = var h: THash = myhash(t, key) and high(data) while not isNil(data[h].key): h = nextTry(h, high(data)) data[h].key = key data[h].val = val -proc Enlarge(t: PStringTable) = +proc enlarge(t: PStringTable) = var n: TKeyValuePairSeq newSeq(n, len(t.data) * growthFactor) for i in countup(0, high(t.data)): - if not isNil(t.data[i].key): RawInsert(t, n, t.data[i].key, t.data[i].val) + if not isNil(t.data[i].key): rawInsert(t, n, t.data[i].key, t.data[i].val) swap(t.data, n) proc `[]=`*(t: PStringTable, key, val: string) {.rtl, extern: "nstPut".} = ## puts a (key, value)-pair into `t`. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: t.data[index].val = val else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) + if mustRehash(len(t.data), t.counter): enlarge(t) + rawInsert(t, t.data, key, val) inc(t.counter) -proc RaiseFormatException(s: string) = +proc raiseFormatException(s: string) = var e: ref EInvalidValue new(e) e.msg = "format string: key not found: " & s @@ -184,7 +184,7 @@ proc newStringTable*(keyValuePairs: varargs[tuple[key, val: string]], ## var mytab = newStringTable({"key1": "val1", "key2": "val2"}, ## modeCaseInsensitive) result = newStringTable(mode) - for key, val in items(keyvaluePairs): result[key] = val + for key, val in items(keyValuePairs): result[key] = val proc `%`*(f: string, t: PStringTable, flags: set[TFormatFlag] = {}): string {. rtl, extern: "nstFormat".} = diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index a4aa81578..b63224cec 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -1,170 +1,180 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2012 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module contains various string utility routines. -## See the module `re <re.html>`_ for regular expression support. -## See the module `pegs <pegs.html>`_ for PEG support. - -import parseutils - -{.deadCodeElim: on.} - -{.push debugger:off .} # the user does not want to trace a part - # of the standard library! - -include "system/inclrtl" - -type - TCharSet* = set[char] # for compatibility with Nim - -const - Whitespace* = {' ', '\t', '\v', '\r', '\l', '\f'} - ## All the characters that count as whitespace. - - Letters* = {'A'..'Z', 'a'..'z'} - ## the set of letters - - Digits* = {'0'..'9'} - ## the set of digits - - HexDigits* = {'0'..'9', 'A'..'F', 'a'..'f'} - ## the set of hexadecimal digits - - IdentChars* = {'a'..'z', 'A'..'Z', '0'..'9', '_'} - ## the set of characters an identifier can consist of - - IdentStartChars* = {'a'..'z', 'A'..'Z', '_'} - ## the set of characters an identifier can start with - - NewLines* = {'\13', '\10'} - ## the set of characters a newline terminator can start with - -proc toLower*(c: Char): Char {.noSideEffect, procvar, - rtl, extern: "nsuToLowerChar".} = - ## Converts `c` into lower case. This works only for the letters A-Z. - ## See `unicode.toLower` for a version that works for any Unicode character. - if c in {'A'..'Z'}: - result = chr(ord(c) + (ord('a') - ord('A'))) - else: - result = c - -proc toLower*(s: string): string {.noSideEffect, procvar, - rtl, extern: "nsuToLowerStr".} = - ## Converts `s` into lower case. This works only for the letters A-Z. - ## See `unicode.toLower` for a version that works for any Unicode character. - result = newString(len(s)) - for i in 0..len(s) - 1: - result[i] = toLower(s[i]) - -proc toUpper*(c: Char): Char {.noSideEffect, procvar, - rtl, extern: "nsuToUpperChar".} = - ## Converts `c` into upper case. This works only for the letters a-z. - ## See `unicode.toUpper` for a version that works for any Unicode character. - if c in {'a'..'z'}: - result = Chr(Ord(c) - (Ord('a') - Ord('A'))) - else: - result = c - -proc toUpper*(s: string): string {.noSideEffect, procvar, - rtl, extern: "nsuToUpperStr".} = - ## Converts `s` into upper case. This works only for the letters a-z. - ## See `unicode.toUpper` for a version that works for any Unicode character. - result = newString(len(s)) - for i in 0..len(s) - 1: - result[i] = toUpper(s[i]) - -proc capitalize*(s: string): string {.noSideEffect, procvar, - rtl, extern: "nsuCapitalize".} = - ## Converts the first character of `s` into upper case. - ## This works only for the letters a-z. - result = toUpper(s[0]) & substr(s, 1) - -proc normalize*(s: string): string {.noSideEffect, procvar, - rtl, extern: "nsuNormalize".} = - ## Normalizes the string `s`. That means to convert it to lower case and - ## remove any '_'. This is needed for Nimrod identifiers for example. - result = newString(s.len) - var j = 0 - for i in 0..len(s) - 1: - if s[i] in {'A'..'Z'}: - result[j] = Chr(Ord(s[i]) + (Ord('a') - Ord('A'))) - inc j - elif s[i] != '_': - result[j] = s[i] - inc j - if j != s.len: setLen(result, j) - -proc cmpIgnoreCase*(a, b: string): int {.noSideEffect, - rtl, extern: "nsuCmpIgnoreCase", procvar, operator: 4.} = - ## Compares two strings in a case insensitive manner. Returns: - ## - ## | 0 iff a == b - ## | < 0 iff a < b - ## | > 0 iff a > b - var i = 0 - var m = min(a.len, b.len) - while i < m: - result = ord(toLower(a[i])) - ord(toLower(b[i])) - if result != 0: return - inc(i) - result = a.len - b.len - -{.push checks: off, line_trace: off .} # this is a hot-spot in the compiler! - # thus we compile without checks here - -proc cmpIgnoreStyle*(a, b: string): int {.noSideEffect, - rtl, extern: "nsuCmpIgnoreStyle", procvar, operator: 3.} = - ## Compares two strings normalized (i.e. case and - ## underscores do not matter). Returns: - ## - ## | 0 iff a == b - ## | < 0 iff a < b - ## | > 0 iff a > b - var i = 0 - var j = 0 - while True: - while a[i] == '_': inc(i) - while b[j] == '_': inc(j) # BUGFIX: typo - var aa = toLower(a[i]) - var bb = toLower(b[j]) - result = ord(aa) - ord(bb) - if result != 0 or aa == '\0': break - inc(i) - inc(j) - -{.pop.} - -proc strip*(s: string, leading = true, trailing = true): string {.noSideEffect, - rtl, extern: "nsuStrip", operator: 5.} = - ## Strips whitespace from `s` and returns the resulting string. - ## If `leading` is true, leading whitespace is stripped. - ## If `trailing` is true, trailing whitespace is stripped. - const - chars: set[Char] = Whitespace - var - first = 0 - last = len(s)-1 - if leading: - while s[first] in chars: inc(first) - if trailing: - while last >= 0 and s[last] in chars: dec(last) - result = substr(s, first, last) - -proc toOctal*(c: char): string {.noSideEffect, rtl, extern: "nsuToOctal".} = - ## Converts a character `c` to its octal representation. The resulting - ## string may not have a leading zero. Its length is always exactly 3. - result = newString(3) - var val = ord(c) - for i in countdown(2, 0): - result[i] = Chr(val mod 8 + ord('0')) - val = val div 8 - +# +# +# Nimrod's Runtime Library +# (c) Copyright 2012 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This module contains various string utility routines. +## See the module `re <re.html>`_ for regular expression support. +## See the module `pegs <pegs.html>`_ for PEG support. + +import parseutils + +{.deadCodeElim: on.} + +{.push debugger:off .} # the user does not want to trace a part + # of the standard library! + +include "system/inclrtl" + +type + TCharSet* = set[char] # for compatibility with Nim + +const + Whitespace* = {' ', '\t', '\v', '\r', '\l', '\f'} + ## All the characters that count as whitespace. + + Letters* = {'A'..'Z', 'a'..'z'} + ## the set of letters + + Digits* = {'0'..'9'} + ## the set of digits + + HexDigits* = {'0'..'9', 'A'..'F', 'a'..'f'} + ## the set of hexadecimal digits + + IdentChars* = {'a'..'z', 'A'..'Z', '0'..'9', '_'} + ## the set of characters an identifier can consist of + + IdentStartChars* = {'a'..'z', 'A'..'Z', '_'} + ## the set of characters an identifier can start with + + NewLines* = {'\13', '\10'} + ## the set of characters a newline terminator can start with + + AllChars* = {'\x00'..'\xFF'} + ## A set with all the possible characters. Not very useful by its own, you + ## can use it to create *inverted* sets to make the ``find()`` proc find + ## **invalid** characters in strings. Example: + ## + ## .. code-block:: nimrod + ## let invalid = AllChars - Digits + ## doAssert "01234".find(invalid) == -1 + ## doAssert "01A34".find(invalid) == 2 + +proc toLower*(c: char): char {.noSideEffect, procvar, + rtl, extern: "nsuToLowerChar".} = + ## Converts `c` into lower case. This works only for the letters A-Z. + ## See `unicode.toLower` for a version that works for any Unicode character. + if c in {'A'..'Z'}: + result = chr(ord(c) + (ord('a') - ord('A'))) + else: + result = c + +proc toLower*(s: string): string {.noSideEffect, procvar, + rtl, extern: "nsuToLowerStr".} = + ## Converts `s` into lower case. This works only for the letters A-Z. + ## See `unicode.toLower` for a version that works for any Unicode character. + result = newString(len(s)) + for i in 0..len(s) - 1: + result[i] = toLower(s[i]) + +proc toUpper*(c: char): char {.noSideEffect, procvar, + rtl, extern: "nsuToUpperChar".} = + ## Converts `c` into upper case. This works only for the letters a-z. + ## See `unicode.toUpper` for a version that works for any Unicode character. + if c in {'a'..'z'}: + result = chr(ord(c) - (ord('a') - ord('A'))) + else: + result = c + +proc toUpper*(s: string): string {.noSideEffect, procvar, + rtl, extern: "nsuToUpperStr".} = + ## Converts `s` into upper case. This works only for the letters a-z. + ## See `unicode.toUpper` for a version that works for any Unicode character. + result = newString(len(s)) + for i in 0..len(s) - 1: + result[i] = toUpper(s[i]) + +proc capitalize*(s: string): string {.noSideEffect, procvar, + rtl, extern: "nsuCapitalize".} = + ## Converts the first character of `s` into upper case. + ## This works only for the letters a-z. + result = toUpper(s[0]) & substr(s, 1) + +proc normalize*(s: string): string {.noSideEffect, procvar, + rtl, extern: "nsuNormalize".} = + ## Normalizes the string `s`. That means to convert it to lower case and + ## remove any '_'. This is needed for Nimrod identifiers for example. + result = newString(s.len) + var j = 0 + for i in 0..len(s) - 1: + if s[i] in {'A'..'Z'}: + result[j] = chr(ord(s[i]) + (ord('a') - ord('A'))) + inc j + elif s[i] != '_': + result[j] = s[i] + inc j + if j != s.len: setLen(result, j) + +proc cmpIgnoreCase*(a, b: string): int {.noSideEffect, + rtl, extern: "nsuCmpIgnoreCase", procvar, operator: 4.} = + ## Compares two strings in a case insensitive manner. Returns: + ## + ## | 0 iff a == b + ## | < 0 iff a < b + ## | > 0 iff a > b + var i = 0 + var m = min(a.len, b.len) + while i < m: + result = ord(toLower(a[i])) - ord(toLower(b[i])) + if result != 0: return + inc(i) + result = a.len - b.len + +{.push checks: off, line_trace: off .} # this is a hot-spot in the compiler! + # thus we compile without checks here + +proc cmpIgnoreStyle*(a, b: string): int {.noSideEffect, + rtl, extern: "nsuCmpIgnoreStyle", procvar, operator: 3.} = + ## Compares two strings normalized (i.e. case and + ## underscores do not matter). Returns: + ## + ## | 0 iff a == b + ## | < 0 iff a < b + ## | > 0 iff a > b + var i = 0 + var j = 0 + while true: + while a[i] == '_': inc(i) + while b[j] == '_': inc(j) # BUGFIX: typo + var aa = toLower(a[i]) + var bb = toLower(b[j]) + result = ord(aa) - ord(bb) + if result != 0 or aa == '\0': break + inc(i) + inc(j) + +{.pop.} + +proc strip*(s: string, leading = true, trailing = true): string {.noSideEffect, + rtl, extern: "nsuStrip", operator: 5.} = + ## Strips whitespace from `s` and returns the resulting string. + ## If `leading` is true, leading whitespace is stripped. + ## If `trailing` is true, trailing whitespace is stripped. + const + chars: set[char] = Whitespace + var + first = 0 + last = len(s)-1 + if leading: + while s[first] in chars: inc(first) + if trailing: + while last >= 0 and s[last] in chars: dec(last) + result = substr(s, first, last) + +proc toOctal*(c: char): string {.noSideEffect, rtl, extern: "nsuToOctal".} = + ## Converts a character `c` to its octal representation. The resulting + ## string may not have a leading zero. Its length is always exactly 3. + result = newString(3) + var val = ord(c) + for i in countdown(2, 0): + result[i] = chr(val mod 8 + ord('0')) + val = val div 8 + iterator split*(s: string, seps: set[char] = Whitespace): string = ## Splits the string `s` into substrings using a group of separators. ## @@ -209,199 +219,199 @@ iterator split*(s: string, seps: set[char] = Whitespace): string = ## "08" ## "08.398990" ## - var last = 0 - assert(not ('\0' in seps)) - while last < len(s): - while s[last] in seps: inc(last) - var first = last - while last < len(s) and s[last] not_in seps: inc(last) # BUGFIX! - if first <= last-1: - yield substr(s, first, last-1) - -iterator split*(s: string, sep: char): string = - ## Splits the string `s` into substrings using a single separator. - ## - ## Substrings are separated by the character `sep`. - ## Unlike the version of the iterator which accepts a set of separator - ## characters, this proc will not coalesce groups of the - ## separator, returning a string for each found character. The code: - ## - ## .. code-block:: nimrod - ## for word in split(";;this;is;an;;example;;;", ';'): - ## writeln(stdout, word) - ## - ## Results in: - ## - ## .. code-block:: - ## "" - ## "" - ## "this" - ## "is" - ## "an" - ## "" - ## "example" - ## "" - ## "" - ## "" - ## - var last = 0 - assert('\0' != sep) - if len(s) > 0: - # `<=` is correct here for the edge cases! - while last <= len(s): - var first = last - while last < len(s) and s[last] != sep: inc(last) - yield substr(s, first, last-1) - inc(last) - -iterator splitLines*(s: string): string = - ## Splits the string `s` into its containing lines. Every newline - ## combination (CR, LF, CR-LF) is supported. The result strings contain - ## no trailing ``\n``. - ## - ## Example: - ## - ## .. code-block:: nimrod - ## for line in splitLines("\nthis\nis\nan\n\nexample\n"): - ## writeln(stdout, line) - ## - ## Results in: - ## - ## .. code-block:: nimrod - ## "" - ## "this" - ## "is" - ## "an" - ## "" - ## "example" - ## "" - var first = 0 - var last = 0 - while true: - while s[last] notin {'\0', '\c', '\l'}: inc(last) - yield substr(s, first, last-1) - # skip newlines: - if s[last] == '\l': inc(last) - elif s[last] == '\c': - inc(last) - if s[last] == '\l': inc(last) - else: break # was '\0' - first = last - -proc splitLines*(s: string): seq[string] {.noSideEffect, - rtl, extern: "nsuSplitLines".} = - ## The same as the `splitLines` iterator, but is a proc that returns a - ## sequence of substrings. - accumulateResult(splitLines(s)) - -proc countLines*(s: string): int {.noSideEffect, - rtl, extern: "nsuCountLines".} = - ## same as ``len(splitLines(s))``, but much more efficient. - var i = 0 - while i < s.len: - case s[i] - of '\c': - if s[i+1] == '\l': inc i - inc result - of '\l': inc result - else: nil - inc i - -proc split*(s: string, seps: set[char] = Whitespace): seq[string] {. - noSideEffect, rtl, extern: "nsuSplitCharSet".} = - ## The same as the `split` iterator, but is a proc that returns a - ## sequence of substrings. - accumulateResult(split(s, seps)) - -proc split*(s: string, sep: char): seq[string] {.noSideEffect, - rtl, extern: "nsuSplitChar".} = - ## The same as the `split` iterator, but is a proc that returns a sequence - ## of substrings. - accumulateResult(split(s, sep)) - -proc toHex*(x: BiggestInt, len: int): string {.noSideEffect, - rtl, extern: "nsuToHex".} = - ## 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 an unsigned value. - const - HexChars = "0123456789ABCDEF" - var - shift: BiggestInt - result = newString(len) - for j in countdown(len-1, 0): - result[j] = HexChars[toU32(x shr shift) and 0xF'i32] - shift = shift + 4 - -proc intToStr*(x: int, minchars: int = 1): string {.noSideEffect, - rtl, extern: "nsuIntToStr".} = - ## Converts `x` to its decimal representation. The resulting string - ## will be minimally `minchars` characters long. This is achieved by - ## adding leading zeros. - result = $abs(x) - for i in 1 .. minchars - len(result): - result = '0' & result - if x < 0: - result = '-' & result - -proc ParseInt*(s: string): int {.noSideEffect, procvar, - rtl, extern: "nsuParseInt".} = - ## Parses a decimal integer value contained in `s`. If `s` is not - ## a valid integer, `EInvalidValue` is raised. - var L = parseutils.parseInt(s, result, 0) - if L != s.len or L == 0: - raise newException(EInvalidValue, "invalid integer: " & s) - -proc ParseBiggestInt*(s: string): biggestInt {.noSideEffect, procvar, - rtl, extern: "nsuParseBiggestInt".} = - ## Parses a decimal integer value contained in `s`. If `s` is not - ## a valid integer, `EInvalidValue` is raised. - var L = parseutils.parseBiggestInt(s, result, 0) - if L != s.len or L == 0: - raise newException(EInvalidValue, "invalid integer: " & s) - -proc ParseFloat*(s: string): float {.noSideEffect, procvar, - rtl, extern: "nsuParseFloat".} = - ## Parses a decimal floating point value contained in `s`. If `s` is not - ## a valid floating point number, `EInvalidValue` is raised. ``NAN``, - ## ``INF``, ``-INF`` are also supported (case insensitive comparison). - var L = parseutils.parseFloat(s, result, 0) - if L != s.len or L == 0: - raise newException(EInvalidValue, "invalid float: " & s) - -proc ParseHexInt*(s: string): int {.noSideEffect, procvar, - rtl, extern: "nsuParseHexInt".} = - ## Parses a hexadecimal integer value contained in `s`. If `s` is not - ## a valid integer, `EInvalidValue` is raised. `s` can have one of the - ## following optional prefixes: ``0x``, ``0X``, ``#``. - ## Underscores within `s` are ignored. - var i = 0 - if s[i] == '0' and (s[i+1] == 'x' or s[i+1] == 'X'): inc(i, 2) - elif s[i] == '#': inc(i) - while true: - case s[i] - of '_': inc(i) - of '0'..'9': - result = result shl 4 or (ord(s[i]) - ord('0')) - inc(i) - of 'a'..'f': - result = result shl 4 or (ord(s[i]) - ord('a') + 10) - inc(i) - of 'A'..'F': - result = result shl 4 or (ord(s[i]) - ord('A') + 10) - inc(i) - of '\0': break - else: raise newException(EInvalidValue, "invalid integer: " & s) - -proc parseBool*(s: string): bool = - ## Parses a value into a `bool`. If ``s`` is one of the following values: - ## ``y, yes, true, 1, on``, then returns `true`. If ``s`` is one of the - ## following values: ``n, no, false, 0, off``, then returns `false`. - ## If ``s`` is something else a ``EInvalidValue`` exception is raised. - case normalize(s) - of "y", "yes", "true", "1", "on": result = true - of "n", "no", "false", "0", "off": result = false - else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s) + var last = 0 + assert(not ('\0' in seps)) + while last < len(s): + while s[last] in seps: inc(last) + var first = last + while last < len(s) and s[last] notin seps: inc(last) # BUGFIX! + if first <= last-1: + yield substr(s, first, last-1) + +iterator split*(s: string, sep: char): string = + ## Splits the string `s` into substrings using a single separator. + ## + ## Substrings are separated by the character `sep`. + ## Unlike the version of the iterator which accepts a set of separator + ## characters, this proc will not coalesce groups of the + ## separator, returning a string for each found character. The code: + ## + ## .. code-block:: nimrod + ## for word in split(";;this;is;an;;example;;;", ';'): + ## writeln(stdout, word) + ## + ## Results in: + ## + ## .. code-block:: + ## "" + ## "" + ## "this" + ## "is" + ## "an" + ## "" + ## "example" + ## "" + ## "" + ## "" + ## + var last = 0 + assert('\0' != sep) + if len(s) > 0: + # `<=` is correct here for the edge cases! + while last <= len(s): + var first = last + while last < len(s) and s[last] != sep: inc(last) + yield substr(s, first, last-1) + inc(last) + +iterator splitLines*(s: string): string = + ## Splits the string `s` into its containing lines. Every newline + ## combination (CR, LF, CR-LF) is supported. The result strings contain + ## no trailing ``\n``. + ## + ## Example: + ## + ## .. code-block:: nimrod + ## for line in splitLines("\nthis\nis\nan\n\nexample\n"): + ## writeln(stdout, line) + ## + ## Results in: + ## + ## .. code-block:: nimrod + ## "" + ## "this" + ## "is" + ## "an" + ## "" + ## "example" + ## "" + var first = 0 + var last = 0 + while true: + while s[last] notin {'\0', '\c', '\l'}: inc(last) + yield substr(s, first, last-1) + # skip newlines: + if s[last] == '\l': inc(last) + elif s[last] == '\c': + inc(last) + if s[last] == '\l': inc(last) + else: break # was '\0' + first = last + +proc splitLines*(s: string): seq[string] {.noSideEffect, + rtl, extern: "nsuSplitLines".} = + ## The same as the `splitLines` iterator, but is a proc that returns a + ## sequence of substrings. + accumulateResult(splitLines(s)) + +proc countLines*(s: string): int {.noSideEffect, + rtl, extern: "nsuCountLines".} = + ## same as ``len(splitLines(s))``, but much more efficient. + var i = 0 + while i < s.len: + case s[i] + of '\c': + if s[i+1] == '\l': inc i + inc result + of '\l': inc result + else: discard + inc i + +proc split*(s: string, seps: set[char] = Whitespace): seq[string] {. + noSideEffect, rtl, extern: "nsuSplitCharSet".} = + ## The same as the `split` iterator, but is a proc that returns a + ## sequence of substrings. + accumulateResult(split(s, seps)) + +proc split*(s: string, sep: char): seq[string] {.noSideEffect, + rtl, extern: "nsuSplitChar".} = + ## The same as the `split` iterator, but is a proc that returns a sequence + ## of substrings. + accumulateResult(split(s, sep)) + +proc toHex*(x: BiggestInt, len: int): string {.noSideEffect, + rtl, extern: "nsuToHex".} = + ## 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 an unsigned value. + const + HexChars = "0123456789ABCDEF" + var + shift: BiggestInt + result = newString(len) + for j in countdown(len-1, 0): + result[j] = HexChars[toU32(x shr shift) and 0xF'i32] + shift = shift + 4 + +proc intToStr*(x: int, minchars: int = 1): string {.noSideEffect, + rtl, extern: "nsuIntToStr".} = + ## Converts `x` to its decimal representation. The resulting string + ## will be minimally `minchars` characters long. This is achieved by + ## adding leading zeros. + result = $abs(x) + for i in 1 .. minchars - len(result): + result = '0' & result + if x < 0: + result = '-' & result + +proc parseInt*(s: string): int {.noSideEffect, procvar, + rtl, extern: "nsuParseInt".} = + ## Parses a decimal integer value contained in `s`. If `s` is not + ## a valid integer, `EInvalidValue` is raised. + var L = parseutils.parseInt(s, result, 0) + if L != s.len or L == 0: + raise newException(EInvalidValue, "invalid integer: " & s) + +proc parseBiggestInt*(s: string): BiggestInt {.noSideEffect, procvar, + rtl, extern: "nsuParseBiggestInt".} = + ## Parses a decimal integer value contained in `s`. If `s` is not + ## a valid integer, `EInvalidValue` is raised. + var L = parseutils.parseBiggestInt(s, result, 0) + if L != s.len or L == 0: + raise newException(EInvalidValue, "invalid integer: " & s) + +proc parseFloat*(s: string): float {.noSideEffect, procvar, + rtl, extern: "nsuParseFloat".} = + ## Parses a decimal floating point value contained in `s`. If `s` is not + ## a valid floating point number, `EInvalidValue` is raised. ``NAN``, + ## ``INF``, ``-INF`` are also supported (case insensitive comparison). + var L = parseutils.parseFloat(s, result, 0) + if L != s.len or L == 0: + raise newException(EInvalidValue, "invalid float: " & s) + +proc parseHexInt*(s: string): int {.noSideEffect, procvar, + rtl, extern: "nsuParseHexInt".} = + ## Parses a hexadecimal integer value contained in `s`. If `s` is not + ## a valid integer, `EInvalidValue` is raised. `s` can have one of the + ## following optional prefixes: ``0x``, ``0X``, ``#``. + ## Underscores within `s` are ignored. + var i = 0 + if s[i] == '0' and (s[i+1] == 'x' or s[i+1] == 'X'): inc(i, 2) + elif s[i] == '#': inc(i) + while true: + case s[i] + of '_': inc(i) + of '0'..'9': + result = result shl 4 or (ord(s[i]) - ord('0')) + inc(i) + of 'a'..'f': + result = result shl 4 or (ord(s[i]) - ord('a') + 10) + inc(i) + of 'A'..'F': + result = result shl 4 or (ord(s[i]) - ord('A') + 10) + inc(i) + of '\0': break + else: raise newException(EInvalidValue, "invalid integer: " & s) + +proc parseBool*(s: string): bool = + ## Parses a value into a `bool`. If ``s`` is one of the following values: + ## ``y, yes, true, 1, on``, then returns `true`. If ``s`` is one of the + ## following values: ``n, no, false, 0, off``, then returns `false`. + ## If ``s`` is something else a ``EInvalidValue`` exception is raised. + case normalize(s) + of "y", "yes", "true", "1", "on": result = true + of "n", "no", "false", "0", "off": result = false + else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s) proc parseEnum*[T: enum](s: string): T = ## parses an enum ``T``. Raises ``EInvalidValue`` for an invalid value in @@ -418,30 +428,30 @@ proc parseEnum*[T: enum](s: string, default: T): T = if cmpIgnoreStyle(s, $e) == 0: return e result = default - -proc repeatChar*(count: int, c: Char = ' '): string {.noSideEffect, - rtl, extern: "nsuRepeatChar".} = - ## Returns a string of length `count` consisting only of - ## the character `c`. You can use this proc to left align strings. Example: - ## - ## .. code-block:: nimrod - ## let - ## width = 15 - ## text1 = "Hello user!" - ## text2 = "This is a very long string" - ## echo text1 & repeatChar(max(0, width - text1.len)) & "|" - ## echo text2 & repeatChar(max(0, width - text2.len)) & "|" - result = newString(count) - for i in 0..count-1: result[i] = c - -proc repeatStr*(count: int, s: string): string {.noSideEffect, - rtl, extern: "nsuRepeatStr".} = - ## Returns `s` concatenated `count` times. - result = newStringOfCap(count*s.len) - for i in 0..count-1: result.add(s) - -proc align*(s: string, count: int, padding = ' '): string {. - noSideEffect, rtl, extern: "nsuAlignString".} = + +proc repeatChar*(count: int, c: char = ' '): string {.noSideEffect, + rtl, extern: "nsuRepeatChar".} = + ## Returns a string of length `count` consisting only of + ## the character `c`. You can use this proc to left align strings. Example: + ## + ## .. code-block:: nimrod + ## let + ## width = 15 + ## text1 = "Hello user!" + ## text2 = "This is a very long string" + ## echo text1 & repeatChar(max(0, width - text1.len)) & "|" + ## echo text2 & repeatChar(max(0, width - text2.len)) & "|" + result = newString(count) + for i in 0..count-1: result[i] = c + +proc repeatStr*(count: int, s: string): string {.noSideEffect, + rtl, extern: "nsuRepeatStr".} = + ## Returns `s` concatenated `count` times. + result = newStringOfCap(count*s.len) + for i in 0..count-1: result.add(s) + +proc align*(s: string, count: int, padding = ' '): string {. + noSideEffect, rtl, extern: "nsuAlignString".} = ## Aligns a string `s` with `padding`, so that is of length `count`. ## `padding` characters (by default spaces) are added before `s` resulting in ## right alignment. If ``s.len >= count``, no spaces are added and `s` is @@ -453,247 +463,247 @@ proc align*(s: string, count: int, padding = ' '): string {. ## assert align("a", 0) == "a" ## assert align("1232", 6) == " 1232" ## assert align("1232", 6, '#') == "##1232" - if s.len < count: - result = newString(count) - var spaces = count - s.len - for i in 0..spaces-1: result[i] = padding - for i in spaces..count-1: result[i] = s[i-spaces] - else: - result = s - -iterator tokenize*(s: string, seps: set[char] = Whitespace): tuple[ - token: string, isSep: bool] = - ## Tokenizes the string `s` into substrings. - ## - ## Substrings are separated by a substring containing only `seps`. - ## Examples: - ## - ## .. code-block:: nimrod - ## for word in tokenize(" this is an example "): - ## writeln(stdout, word) - ## - ## Results in: - ## - ## .. code-block:: nimrod - ## (" ", true) - ## ("this", false) - ## (" ", true) - ## ("is", false) - ## (" ", true) - ## ("an", false) - ## (" ", true) - ## ("example", false) - ## (" ", true) - var i = 0 - while true: - var j = i - var isSep = s[j] in seps - while j < s.len and (s[j] in seps) == isSep: inc(j) - if j > i: - yield (substr(s, i, j-1), isSep) - else: - break - i = j - -proc wordWrap*(s: string, maxLineWidth = 80, - splitLongWords = true, - seps: set[char] = whitespace, - newLine = "\n"): string {. - noSideEffect, rtl, extern: "nsuWordWrap".} = - ## word wraps `s`. - result = newStringOfCap(s.len + s.len shr 6) - var SpaceLeft = maxLineWidth - for word, isSep in tokenize(s, seps): - if len(word) > SpaceLeft: - if splitLongWords and len(word) > maxLineWidth: - result.add(substr(word, 0, spaceLeft-1)) - var w = spaceLeft+1 - var wordLeft = len(word) - spaceLeft - while wordLeft > 0: - result.add(newLine) - var L = min(maxLineWidth, wordLeft) - SpaceLeft = maxLineWidth - L - result.add(substr(word, w, w+L-1)) - inc(w, L) - dec(wordLeft, L) - else: - SpaceLeft = maxLineWidth - len(Word) - result.add(newLine) - result.add(word) - else: - SpaceLeft = SpaceLeft - len(Word) - result.add(word) - -proc unindent*(s: string, eatAllIndent = false): string {. - noSideEffect, rtl, extern: "nsuUnindent".} = - ## unindents `s`. - result = newStringOfCap(s.len) - var i = 0 - var pattern = true - var indent = 0 - while s[i] == ' ': inc i - var level = if i == 0: -1 else: i - while i < s.len: - if s[i] == ' ': - if i > 0 and s[i-1] in {'\l', '\c'}: - pattern = true - indent = 0 - if pattern: - inc(indent) - if indent > level and not eatAllIndent: - result.add(s[i]) - if level < 0: level = indent - else: - # a space somewhere: do not delete - result.add(s[i]) - else: - pattern = false - result.add(s[i]) - inc i - -proc startsWith*(s, prefix: string): bool {.noSideEffect, - rtl, extern: "nsuStartsWith".} = - ## Returns true iff ``s`` starts with ``prefix``. - ## If ``prefix == ""`` true is returned. - var i = 0 - while true: - if prefix[i] == '\0': return true - if s[i] != prefix[i]: return false - inc(i) - -proc endsWith*(s, suffix: string): bool {.noSideEffect, - rtl, extern: "nsuEndsWith".} = - ## Returns true iff ``s`` ends with ``suffix``. - ## If ``suffix == ""`` true is returned. - var i = 0 - var j = len(s) - len(suffix) - while i+j <% s.len: - if s[i+j] != suffix[i]: return false - inc(i) - if suffix[i] == '\0': return true + if s.len < count: + result = newString(count) + let spaces = count - s.len + for i in 0..spaces-1: result[i] = padding + for i in spaces..count-1: result[i] = s[i-spaces] + else: + result = s + +iterator tokenize*(s: string, seps: set[char] = Whitespace): tuple[ + token: string, isSep: bool] = + ## Tokenizes the string `s` into substrings. + ## + ## Substrings are separated by a substring containing only `seps`. + ## Examples: + ## + ## .. code-block:: nimrod + ## for word in tokenize(" this is an example "): + ## writeln(stdout, word) + ## + ## Results in: + ## + ## .. code-block:: nimrod + ## (" ", true) + ## ("this", false) + ## (" ", true) + ## ("is", false) + ## (" ", true) + ## ("an", false) + ## (" ", true) + ## ("example", false) + ## (" ", true) + var i = 0 + while true: + var j = i + var isSep = s[j] in seps + while j < s.len and (s[j] in seps) == isSep: inc(j) + if j > i: + yield (substr(s, i, j-1), isSep) + else: + break + i = j + +proc wordWrap*(s: string, maxLineWidth = 80, + splitLongWords = true, + seps: set[char] = Whitespace, + newLine = "\n"): string {. + noSideEffect, rtl, extern: "nsuWordWrap".} = + ## word wraps `s`. + result = newStringOfCap(s.len + s.len shr 6) + var spaceLeft = maxLineWidth + for word, isSep in tokenize(s, seps): + if len(word) > spaceLeft: + if splitLongWords and len(word) > maxLineWidth: + result.add(substr(word, 0, spaceLeft-1)) + var w = spaceLeft+1 + var wordLeft = len(word) - spaceLeft + while wordLeft > 0: + result.add(newLine) + var L = min(maxLineWidth, wordLeft) + spaceLeft = maxLineWidth - L + result.add(substr(word, w, w+L-1)) + inc(w, L) + dec(wordLeft, L) + else: + spaceLeft = maxLineWidth - len(word) + result.add(newLine) + result.add(word) + else: + spaceLeft = spaceLeft - len(word) + result.add(word) + +proc unindent*(s: string, eatAllIndent = false): string {. + noSideEffect, rtl, extern: "nsuUnindent".} = + ## unindents `s`. + result = newStringOfCap(s.len) + var i = 0 + var pattern = true + var indent = 0 + while s[i] == ' ': inc i + var level = if i == 0: -1 else: i + while i < s.len: + if s[i] == ' ': + if i > 0 and s[i-1] in {'\l', '\c'}: + pattern = true + indent = 0 + if pattern: + inc(indent) + if indent > level and not eatAllIndent: + result.add(s[i]) + if level < 0: level = indent + else: + # a space somewhere: do not delete + result.add(s[i]) + else: + pattern = false + result.add(s[i]) + inc i + +proc startsWith*(s, prefix: string): bool {.noSideEffect, + rtl, extern: "nsuStartsWith".} = + ## Returns true iff ``s`` starts with ``prefix``. + ## If ``prefix == ""`` true is returned. + var i = 0 + while true: + if prefix[i] == '\0': return true + if s[i] != prefix[i]: return false + inc(i) + +proc endsWith*(s, suffix: string): bool {.noSideEffect, + rtl, extern: "nsuEndsWith".} = + ## Returns true iff ``s`` ends with ``suffix``. + ## If ``suffix == ""`` true is returned. + var i = 0 + var j = len(s) - len(suffix) + while i+j <% s.len: + if s[i+j] != suffix[i]: return false + inc(i) + if suffix[i] == '\0': return true proc continuesWith*(s, substr: string, start: int): bool {.noSideEffect, rtl, extern: "nsuContinuesWith".} = - ## Returns true iff ``s`` continues with ``substr`` at position ``start``. - ## If ``substr == ""`` true is returned. - var i = 0 - while true: - if substr[i] == '\0': return true - if s[i+start] != substr[i]: return false - inc(i) - -proc addSep*(dest: var string, sep = ", ", startLen = 0) {.noSideEffect, - inline.} = - ## A shorthand for: - ## - ## .. code-block:: nimrod - ## if dest.len > startLen: add(dest, sep) - ## - ## This is often useful for generating some code where the items need to - ## be *separated* by `sep`. `sep` is only added if `dest` is longer than - ## `startLen`. The following example creates a string describing - ## an array of integers: - ## - ## .. code-block:: nimrod - ## var arr = "[" - ## for x in items([2, 3, 5, 7, 11]): - ## addSep(arr, startLen=len("[")) - ## add(arr, $x) - ## add(arr, "]") - if dest.len > startLen: add(dest, sep) - -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 c notin theSet: return false - return true - -proc abbrev*(s: string, possibilities: openarray[string]): int = - ## returns the index of the first item in `possibilities` if not - ## 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 possibilities[i] == s: - # special case: exact match shouldn't be ambiguous - return i - if result >= 0: return -2 # ambiguous - result = i - -# --------------------------------------------------------------------------- - -proc join*(a: openArray[string], sep: string): string {. - noSideEffect, rtl, extern: "nsuJoinSep".} = - ## concatenates all strings in `a` separating them with `sep`. - if len(a) > 0: - var L = sep.len * (a.len-1) - for i in 0..high(a): inc(L, a[i].len) - result = newStringOfCap(L) - add(result, a[0]) - for i in 1..high(a): - add(result, sep) - add(result, a[i]) - else: - result = "" - -proc join*(a: openArray[string]): string {. - noSideEffect, rtl, extern: "nsuJoin".} = - ## concatenates all strings in `a`. - if len(a) > 0: - var L = 0 - for i in 0..high(a): inc(L, a[i].len) - result = newStringOfCap(L) - for i in 0..high(a): add(result, a[i]) - else: - result = "" - -type - TSkipTable = array[Char, int] - -proc preprocessSub(sub: string, a: var TSkipTable) = - var m = len(sub) - for i in 0..0xff: a[chr(i)] = m+1 - for i in 0..m-1: a[sub[i]] = m-i - -proc findAux(s, sub: string, start: int, a: TSkipTable): int = - # fast "quick search" algorithm: - var - m = len(sub) - n = len(s) - # search: - var j = start - while j <= n - m: - block match: - for k in 0..m-1: - if sub[k] != s[k+j]: break match - return j - inc(j, a[s[j+m]]) - return -1 - -proc find*(s, sub: string, start: int = 0): int {.noSideEffect, - rtl, extern: "nsuFindStr", operator: 6.} = - ## Searches for `sub` in `s` starting at position `start`. Searching is - ## case-sensitive. If `sub` is not in `s`, -1 is returned. - var a {.noinit.}: TSkipTable - preprocessSub(sub, a) - result = findAux(s, sub, start, a) - -proc find*(s: string, sub: char, start: int = 0): int {.noSideEffect, - rtl, extern: "nsuFindChar".} = - ## Searches for `sub` in `s` starting at position `start`. Searching is - ## case-sensitive. If `sub` is not in `s`, -1 is returned. - for i in start..len(s)-1: - if sub == s[i]: return i - return -1 - -proc find*(s: string, chars: set[char], start: int = 0): int {.noSideEffect, - rtl, extern: "nsuFindCharSet".} = - ## Searches for `chars` in `s` starting at position `start`. If `s` contains - ## none of the characters in `chars`, -1 is returned. - for i in start..s.len-1: - if s[i] in chars: return i - return -1 + ## Returns true iff ``s`` continues with ``substr`` at position ``start``. + ## If ``substr == ""`` true is returned. + var i = 0 + while true: + if substr[i] == '\0': return true + if s[i+start] != substr[i]: return false + inc(i) + +proc addSep*(dest: var string, sep = ", ", startLen = 0) {.noSideEffect, + inline.} = + ## A shorthand for: + ## + ## .. code-block:: nimrod + ## if dest.len > startLen: add(dest, sep) + ## + ## This is often useful for generating some code where the items need to + ## be *separated* by `sep`. `sep` is only added if `dest` is longer than + ## `startLen`. The following example creates a string describing + ## an array of integers: + ## + ## .. code-block:: nimrod + ## var arr = "[" + ## for x in items([2, 3, 5, 7, 11]): + ## addSep(arr, startLen=len("[")) + ## add(arr, $x) + ## add(arr, "]") + if dest.len > startLen: add(dest, sep) + +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 c notin theSet: return false + return true + +proc abbrev*(s: string, possibilities: openArray[string]): int = + ## returns the index of the first item in `possibilities` if not + ## 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 possibilities[i] == s: + # special case: exact match shouldn't be ambiguous + return i + if result >= 0: return -2 # ambiguous + result = i + +# --------------------------------------------------------------------------- + +proc join*(a: openArray[string], sep: string): string {. + noSideEffect, rtl, extern: "nsuJoinSep".} = + ## concatenates all strings in `a` separating them with `sep`. + if len(a) > 0: + var L = sep.len * (a.len-1) + for i in 0..high(a): inc(L, a[i].len) + result = newStringOfCap(L) + add(result, a[0]) + for i in 1..high(a): + add(result, sep) + add(result, a[i]) + else: + result = "" + +proc join*(a: openArray[string]): string {. + noSideEffect, rtl, extern: "nsuJoin".} = + ## concatenates all strings in `a`. + if len(a) > 0: + var L = 0 + for i in 0..high(a): inc(L, a[i].len) + result = newStringOfCap(L) + for i in 0..high(a): add(result, a[i]) + else: + result = "" + +type + TSkipTable = array[char, int] + +proc preprocessSub(sub: string, a: var TSkipTable) = + var m = len(sub) + for i in 0..0xff: a[chr(i)] = m+1 + for i in 0..m-1: a[sub[i]] = m-i + +proc findAux(s, sub: string, start: int, a: TSkipTable): int = + # fast "quick search" algorithm: + var + m = len(sub) + n = len(s) + # search: + var j = start + while j <= n - m: + block match: + for k in 0..m-1: + if sub[k] != s[k+j]: break match + return j + inc(j, a[s[j+m]]) + return -1 + +proc find*(s, sub: string, start: int = 0): int {.noSideEffect, + rtl, extern: "nsuFindStr", operator: 6.} = + ## Searches for `sub` in `s` starting at position `start`. Searching is + ## case-sensitive. If `sub` is not in `s`, -1 is returned. + var a {.noinit.}: TSkipTable + preprocessSub(sub, a) + result = findAux(s, sub, start, a) + +proc find*(s: string, sub: char, start: int = 0): int {.noSideEffect, + rtl, extern: "nsuFindChar".} = + ## Searches for `sub` in `s` starting at position `start`. Searching is + ## case-sensitive. If `sub` is not in `s`, -1 is returned. + for i in start..len(s)-1: + if sub == s[i]: return i + return -1 + +proc find*(s: string, chars: set[char], start: int = 0): int {.noSideEffect, + rtl, extern: "nsuFindCharSet".} = + ## Searches for `chars` in `s` starting at position `start`. If `s` contains + ## none of the characters in `chars`, -1 is returned. + for i in start..s.len-1: + if s[i] in chars: return i + return -1 proc rfind*(s, sub: string, start: int = -1): int {.noSideEffect.} = ## Searches for `sub` in `s` in reverse, starting at `start` and going @@ -708,178 +718,180 @@ proc rfind*(s, sub: string, start: int = -1): int {.noSideEffect.} = break if result != -1: return return -1 - -proc quoteIfContainsWhite*(s: string): string = - ## returns ``'"' & s & '"'`` if `s` contains a space and does not - ## start with a quote, else returns `s` - if find(s, {' ', '\t'}) >= 0 and s[0] != '"': - result = '"' & s & '"' - else: - result = s - -proc contains*(s: string, c: char): bool {.noSideEffect.} = - ## Same as ``find(s, c) >= 0``. - return find(s, c) >= 0 - -proc contains*(s, sub: string): bool {.noSideEffect.} = - ## Same as ``find(s, sub) >= 0``. - return find(s, sub) >= 0 - -proc contains*(s: string, chars: set[char]): bool {.noSideEffect.} = - ## Same as ``find(s, chars) >= 0``. - return find(s, chars) >= 0 - -proc replace*(s, sub: string, by = ""): string {.noSideEffect, - rtl, extern: "nsuReplaceStr", operator: 1.} = - ## Replaces `sub` in `s` by the string `by`. - var a {.noinit.}: TSkipTable - result = "" - preprocessSub(sub, a) - var i = 0 - while true: - var j = findAux(s, sub, i, a) - if j < 0: break - add result, substr(s, i, j - 1) - add result, by - i = j + len(sub) - # copy the rest: - add result, substr(s, i) - -proc replace*(s: string, sub, by: char): string {.noSideEffect, - rtl, extern: "nsuReplaceChar".} = - ## optimized version for characters. - result = newString(s.len) - var i = 0 - while i < s.len: - if s[i] == sub: result[i] = by - else: result[i] = s[i] - inc(i) - -proc replaceWord*(s, sub: string, by = ""): string {.noSideEffect, - rtl, extern: "nsuReplaceWord".} = - ## Replaces `sub` in `s` by the string `by`. Each occurance of `sub` - ## has to be surrounded by word boundaries (comparable to ``\\w`` in - ## regular expressions), otherwise it is not replaced. - const wordChars = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\128'..'\255'} - var a {.noinit.}: TSkipTable - result = "" - preprocessSub(sub, a) - var i = 0 - while true: - var j = findAux(s, sub, i, a) - if j < 0: break - # word boundary? - if (j == 0 or s[j-1] notin wordChars) and - (j+sub.len >= s.len or s[j+sub.len] notin wordChars): - add result, substr(s, i, j - 1) - add result, by - i = j + len(sub) - else: - add result, substr(s, i, j) - i = j + 1 - # copy the rest: - add result, substr(s, i) - -proc delete*(s: var string, first, last: int) {.noSideEffect, - rtl, extern: "nsuDelete".} = - ## Deletes in `s` the characters at position `first` .. `last`. This modifies - ## `s` itself, it does not return a copy. - var i = first - var j = last+1 - var newLen = len(s)-j+i - while i < newLen: - s[i] = s[j] - inc(i) - inc(j) - setlen(s, newLen) - -proc ParseOctInt*(s: string): int {.noSideEffect, - rtl, extern: "nsuParseOctInt".} = - ## Parses an octal integer value contained in `s`. If `s` is not - ## a valid integer, `EInvalidValue` is raised. `s` can have one of the - ## following optional prefixes: ``0o``, ``0O``. - ## Underscores within `s` are ignored. - var i = 0 - if s[i] == '0' and (s[i+1] == 'o' or s[i+1] == 'O'): inc(i, 2) - while true: - case s[i] - of '_': inc(i) - of '0'..'7': - result = result shl 3 or (ord(s[i]) - ord('0')) - inc(i) - of '\0': break - else: raise newException(EInvalidValue, "invalid integer: " & s) - -proc toOct*(x: BiggestInt, len: int): string {.noSideEffect, - rtl, extern: "nsuToOct".} = - ## converts `x` into its octal representation. The resulting string is - ## always `len` characters long. No leading ``0o`` prefix is generated. - var - mask: BiggestInt = 7 - shift: BiggestInt = 0 - assert(len > 0) - result = newString(len) - for j in countdown(len-1, 0): - result[j] = chr(int((x and mask) shr shift) + ord('0')) - shift = shift + 3 - mask = mask shl 3 - -proc toBin*(x: BiggestInt, len: int): string {.noSideEffect, - rtl, extern: "nsuToBin".} = - ## converts `x` into its binary representation. The resulting string is - ## always `len` characters long. No leading ``0b`` prefix is generated. - var - mask: BiggestInt = 1 - shift: BiggestInt = 0 - assert(len > 0) - result = newString(len) - for j in countdown(len-1, 0): - result[j] = chr(int((x and mask) shr shift) + ord('0')) - shift = shift + 1 - mask = mask shl 1 - -proc insertSep*(s: string, sep = '_', digits = 3): string {.noSideEffect, - rtl, extern: "nsuInsertSep".} = - ## inserts the separator `sep` after `digits` digits from right to left. - ## Even though the algorithm works with any string `s`, it is only useful - ## if `s` contains a number. - ## Example: ``insertSep("1000000") == "1_000_000"`` - var L = (s.len-1) div digits + s.len - result = newString(L) - var j = 0 - dec(L) - for i in countdown(len(s)-1, 0): - if j == digits: - result[L] = sep - dec(L) - j = 0 - result[L] = s[i] - inc(j) - dec(L) - -proc escape*(s: string, prefix = "\"", suffix = "\""): string {.noSideEffect, - rtl, extern: "nsuEscape".} = - ## Escapes a string `s`. This does these operations (at the same time): - ## * replaces any ``\`` by ``\\`` - ## * replaces any ``'`` by ``\'`` - ## * replaces any ``"`` by ``\"`` - ## * replaces any other character in the set ``{'\0'..'\31', '\128'..'\255'}`` - ## by ``\xHH`` where ``HH`` is its hexadecimal value. - ## The procedure has been designed so that its output is usable for many - ## different common syntaxes. The resulting string is prefixed with - ## `prefix` and suffixed with `suffix`. Both may be empty strings. - result = newStringOfCap(s.len + s.len shr 2) - result.add(prefix) - for c in items(s): - case c - of '\0'..'\31', '\128'..'\255': - add(result, "\\x") - add(result, toHex(ord(c), 2)) - of '\\': add(result, "\\\\") - of '\'': add(result, "\\'") - of '\"': add(result, "\\\"") - else: add(result, c) - add(result, suffix) + +proc quoteIfContainsWhite*(s: string): string {.deprecated.} = + ## returns ``'"' & s & '"'`` if `s` contains a space and does not + ## start with a quote, else returns `s` + ## DEPRECATED as it was confused for shell quoting function. + ## For this application use osproc.quoteShell. + if find(s, {' ', '\t'}) >= 0 and s[0] != '"': + result = '"' & s & '"' + else: + result = s + +proc contains*(s: string, c: char): bool {.noSideEffect.} = + ## Same as ``find(s, c) >= 0``. + return find(s, c) >= 0 + +proc contains*(s, sub: string): bool {.noSideEffect.} = + ## Same as ``find(s, sub) >= 0``. + return find(s, sub) >= 0 + +proc contains*(s: string, chars: set[char]): bool {.noSideEffect.} = + ## Same as ``find(s, chars) >= 0``. + return find(s, chars) >= 0 + +proc replace*(s, sub: string, by = ""): string {.noSideEffect, + rtl, extern: "nsuReplaceStr", operator: 1.} = + ## Replaces `sub` in `s` by the string `by`. + var a {.noinit.}: TSkipTable + result = "" + preprocessSub(sub, a) + var i = 0 + while true: + var j = findAux(s, sub, i, a) + if j < 0: break + add result, substr(s, i, j - 1) + add result, by + i = j + len(sub) + # copy the rest: + add result, substr(s, i) + +proc replace*(s: string, sub, by: char): string {.noSideEffect, + rtl, extern: "nsuReplaceChar".} = + ## optimized version for characters. + result = newString(s.len) + var i = 0 + while i < s.len: + if s[i] == sub: result[i] = by + else: result[i] = s[i] + inc(i) + +proc replaceWord*(s, sub: string, by = ""): string {.noSideEffect, + rtl, extern: "nsuReplaceWord".} = + ## Replaces `sub` in `s` by the string `by`. Each occurance of `sub` + ## has to be surrounded by word boundaries (comparable to ``\\w`` in + ## regular expressions), otherwise it is not replaced. + const wordChars = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\128'..'\255'} + var a {.noinit.}: TSkipTable + result = "" + preprocessSub(sub, a) + var i = 0 + while true: + var j = findAux(s, sub, i, a) + if j < 0: break + # word boundary? + if (j == 0 or s[j-1] notin wordChars) and + (j+sub.len >= s.len or s[j+sub.len] notin wordChars): + add result, substr(s, i, j - 1) + add result, by + i = j + len(sub) + else: + add result, substr(s, i, j) + i = j + 1 + # copy the rest: + add result, substr(s, i) + +proc delete*(s: var string, first, last: int) {.noSideEffect, + rtl, extern: "nsuDelete".} = + ## Deletes in `s` the characters at position `first` .. `last`. This modifies + ## `s` itself, it does not return a copy. + var i = first + var j = last+1 + var newLen = len(s)-j+i + while i < newLen: + s[i] = s[j] + inc(i) + inc(j) + setLen(s, newLen) + +proc parseOctInt*(s: string): int {.noSideEffect, + rtl, extern: "nsuParseOctInt".} = + ## Parses an octal integer value contained in `s`. If `s` is not + ## a valid integer, `EInvalidValue` is raised. `s` can have one of the + ## following optional prefixes: ``0o``, ``0O``. + ## Underscores within `s` are ignored. + var i = 0 + if s[i] == '0' and (s[i+1] == 'o' or s[i+1] == 'O'): inc(i, 2) + while true: + case s[i] + of '_': inc(i) + of '0'..'7': + result = result shl 3 or (ord(s[i]) - ord('0')) + inc(i) + of '\0': break + else: raise newException(EInvalidValue, "invalid integer: " & s) + +proc toOct*(x: BiggestInt, len: int): string {.noSideEffect, + rtl, extern: "nsuToOct".} = + ## converts `x` into its octal representation. The resulting string is + ## always `len` characters long. No leading ``0o`` prefix is generated. + var + mask: BiggestInt = 7 + shift: BiggestInt = 0 + assert(len > 0) + result = newString(len) + for j in countdown(len-1, 0): + result[j] = chr(int((x and mask) shr shift) + ord('0')) + shift = shift + 3 + mask = mask shl 3 + +proc toBin*(x: BiggestInt, len: int): string {.noSideEffect, + rtl, extern: "nsuToBin".} = + ## converts `x` into its binary representation. The resulting string is + ## always `len` characters long. No leading ``0b`` prefix is generated. + var + mask: BiggestInt = 1 + shift: BiggestInt = 0 + assert(len > 0) + result = newString(len) + for j in countdown(len-1, 0): + result[j] = chr(int((x and mask) shr shift) + ord('0')) + shift = shift + 1 + mask = mask shl 1 + +proc insertSep*(s: string, sep = '_', digits = 3): string {.noSideEffect, + rtl, extern: "nsuInsertSep".} = + ## inserts the separator `sep` after `digits` digits from right to left. + ## Even though the algorithm works with any string `s`, it is only useful + ## if `s` contains a number. + ## Example: ``insertSep("1000000") == "1_000_000"`` + var L = (s.len-1) div digits + s.len + result = newString(L) + var j = 0 + dec(L) + for i in countdown(len(s)-1, 0): + if j == digits: + result[L] = sep + dec(L) + j = 0 + result[L] = s[i] + inc(j) + dec(L) + +proc escape*(s: string, prefix = "\"", suffix = "\""): string {.noSideEffect, + rtl, extern: "nsuEscape".} = + ## Escapes a string `s`. This does these operations (at the same time): + ## * replaces any ``\`` by ``\\`` + ## * replaces any ``'`` by ``\'`` + ## * replaces any ``"`` by ``\"`` + ## * replaces any other character in the set ``{'\0'..'\31', '\128'..'\255'}`` + ## by ``\xHH`` where ``HH`` is its hexadecimal value. + ## The procedure has been designed so that its output is usable for many + ## different common syntaxes. The resulting string is prefixed with + ## `prefix` and suffixed with `suffix`. Both may be empty strings. + result = newStringOfCap(s.len + s.len shr 2) + result.add(prefix) + for c in items(s): + case c + of '\0'..'\31', '\128'..'\255': + add(result, "\\x") + add(result, toHex(ord(c), 2)) + of '\\': add(result, "\\\\") + of '\'': add(result, "\\'") + of '\"': add(result, "\\\"") + else: add(result, c) + add(result, suffix) proc unescape*(s: string, prefix = "\"", suffix = "\""): string {.noSideEffect, rtl, extern: "nsuUnescape".} = @@ -894,7 +906,7 @@ proc unescape*(s: string, prefix = "\"", suffix = "\""): string {.noSideEffect, raise newException(EInvalidValue, "String does not start with a prefix of: " & prefix) i.inc() - while True: + while true: if i == s.len-suffix.len: break case s[i] of '\\': @@ -918,323 +930,323 @@ proc unescape*(s: string, prefix = "\"", suffix = "\""): string {.noSideEffect, if s[i .. -1] != suffix: raise newException(EInvalidValue, "String does not end with a suffix of: " & suffix) - -proc validIdentifier*(s: string): bool {.noSideEffect, - rtl, extern: "nsuValidIdentifier".} = - ## returns true if `s` is a valid identifier. A valid identifier starts - ## with a character of the set `IdentStartChars` and is followed by any - ## number of characters of the set `IdentChars`. - if s[0] in IdentStartChars: - for i in 1..s.len-1: - if s[i] notin IdentChars: return false - return true - -proc editDistance*(a, b: string): int {.noSideEffect, - rtl, extern: "nsuEditDistance".} = - ## returns the edit distance between `a` and `b`. This uses the - ## `Levenshtein`:idx: distance algorithm with only a linear memory overhead. - ## This implementation is highly optimized! - var len1 = a.len - var len2 = b.len - if len1 > len2: - # make `b` the longer string - return editDistance(b, a) - - # strip common prefix: - var s = 0 - while a[s] == b[s] and a[s] != '\0': - inc(s) - dec(len1) - dec(len2) - # strip common suffix: - while len1 > 0 and len2 > 0 and a[s+len1-1] == b[s+len2-1]: - dec(len1) - dec(len2) - # trivial cases: - if len1 == 0: return len2 - if len2 == 0: return len1 - - # another special case: - if len1 == 1: - for j in s..len2-1: - if a[s] == b[j]: return len2 - 1 - return len2 - - inc(len1) - inc(len2) - var half = len1 shr 1 - # initalize first row: - #var row = cast[ptr array[0..high(int) div 8, int]](alloc(len2*sizeof(int))) - var row: seq[int] - newSeq(row, len2) - var e = s + len2 - 1 # end marker - for i in 1..len2 - half - 1: row[i] = i - row[0] = len1 - half - 1 - for i in 1 .. len1 - 1: - var char1 = a[i + s - 1] - var char2p: int - var D, x: int - var p: int - if i >= len1 - half: - # skip the upper triangle: - var offset = i - len1 + half - char2p = offset - p = offset - var c3 = row[p] + ord(char1 != b[s + char2p]) - inc(p) - inc(char2p) - x = row[p] + 1 - D = x - if x > c3: x = c3 - row[p] = x - inc(p) - else: - p = 1 - char2p = 0 - D = i - x = i - if i <= half + 1: - # skip the lower triangle: - e = len2 + i - half - 2 - # main: - while p <= e: - dec(D) - var c3 = D + ord(char1 != b[char2p + s]) - inc(char2p) - inc(x) - if x > c3: x = c3 - D = row[p] + 1 - if x > D: x = D - row[p] = x - inc(p) - # lower triangle sentinel: - if i <= half: - dec(D) - var c3 = D + ord(char1 != b[char2p + s]) - inc(x) - if x > c3: x = c3 - row[p] = x - result = row[e] - #dealloc(row) - - -# floating point formating: - -proc c_sprintf(buf, frmt: CString) {.nodecl, importc: "sprintf", varargs, - noSideEffect.} - -type - TFloatFormat* = enum ## the different modes of floating point formating - ffDefault, ## use the shorter floating point notation - ffDecimal, ## use decimal floating point notation - ffScientific ## use scientific notation (using ``e`` character) - -proc formatBiggestFloat*(f: BiggestFloat, format: TFloatFormat = ffDefault, + +proc validIdentifier*(s: string): bool {.noSideEffect, + rtl, extern: "nsuValidIdentifier".} = + ## returns true if `s` is a valid identifier. A valid identifier starts + ## with a character of the set `IdentStartChars` and is followed by any + ## number of characters of the set `IdentChars`. + if s[0] in IdentStartChars: + for i in 1..s.len-1: + if s[i] notin IdentChars: return false + return true + +proc editDistance*(a, b: string): int {.noSideEffect, + rtl, extern: "nsuEditDistance".} = + ## returns the edit distance between `a` and `b`. This uses the + ## `Levenshtein`:idx: distance algorithm with only a linear memory overhead. + ## This implementation is highly optimized! + var len1 = a.len + var len2 = b.len + if len1 > len2: + # make `b` the longer string + return editDistance(b, a) + + # strip common prefix: + var s = 0 + while a[s] == b[s] and a[s] != '\0': + inc(s) + dec(len1) + dec(len2) + # strip common suffix: + while len1 > 0 and len2 > 0 and a[s+len1-1] == b[s+len2-1]: + dec(len1) + dec(len2) + # trivial cases: + if len1 == 0: return len2 + if len2 == 0: return len1 + + # another special case: + if len1 == 1: + for j in s..len2-1: + if a[s] == b[j]: return len2 - 1 + return len2 + + inc(len1) + inc(len2) + var half = len1 shr 1 + # initalize first row: + #var row = cast[ptr array[0..high(int) div 8, int]](alloc(len2*sizeof(int))) + var row: seq[int] + newSeq(row, len2) + var e = s + len2 - 1 # end marker + for i in 1..len2 - half - 1: row[i] = i + row[0] = len1 - half - 1 + for i in 1 .. len1 - 1: + var char1 = a[i + s - 1] + var char2p: int + var D, x: int + var p: int + if i >= len1 - half: + # skip the upper triangle: + var offset = i - len1 + half + char2p = offset + p = offset + var c3 = row[p] + ord(char1 != b[s + char2p]) + inc(p) + inc(char2p) + x = row[p] + 1 + D = x + if x > c3: x = c3 + row[p] = x + inc(p) + else: + p = 1 + char2p = 0 + D = i + x = i + if i <= half + 1: + # skip the lower triangle: + e = len2 + i - half - 2 + # main: + while p <= e: + dec(D) + var c3 = D + ord(char1 != b[char2p + s]) + inc(char2p) + inc(x) + if x > c3: x = c3 + D = row[p] + 1 + if x > D: x = D + row[p] = x + inc(p) + # lower triangle sentinel: + if i <= half: + dec(D) + var c3 = D + ord(char1 != b[char2p + s]) + inc(x) + if x > c3: x = c3 + row[p] = x + result = row[e] + #dealloc(row) + + +# floating point formating: + +proc c_sprintf(buf, frmt: cstring) {.header: "<stdio.h>", importc: "sprintf", + varargs, noSideEffect.} + +type + TFloatFormat* = enum ## the different modes of floating point formating + ffDefault, ## use the shorter floating point notation + ffDecimal, ## use decimal floating point notation + ffScientific ## use scientific notation (using ``e`` character) + +proc formatBiggestFloat*(f: BiggestFloat, format: TFloatFormat = ffDefault, precision: range[0..32] = 16): string {. - noSideEffect, operator: 2, rtl, extern: "nsu$1".} = - ## converts a floating point value `f` to a string. - ## - ## If ``format == ffDecimal`` then precision is the number of digits to - ## be printed after the decimal point. - ## If ``format == ffScientific`` then precision is the maximum number - ## of significant digits to be printed. - ## `precision`'s default value is the maximum number of meaningful digits + noSideEffect, operator: 2, rtl, extern: "nsu$1".} = + ## converts a floating point value `f` to a string. + ## + ## If ``format == ffDecimal`` then precision is the number of digits to + ## be printed after the decimal point. + ## If ``format == ffScientific`` then precision is the maximum number + ## of significant digits to be printed. + ## `precision`'s default value is the maximum number of meaningful digits ## after the decimal point for Nimrod's ``biggestFloat`` type. ## - ## If ``precision == 0``, it tries to format it nicely. - const floatFormatToChar: array[TFloatFormat, char] = ['g', 'f', 'e'] - var - frmtstr {.noinit.}: array[0..5, char] - buf {.noinit.}: array[0..2500, char] - frmtstr[0] = '%' - if precision > 0: - frmtstr[1] = '#' - frmtstr[2] = '.' - frmtstr[3] = '*' - frmtstr[4] = floatFormatToChar[format] - frmtstr[5] = '\0' - c_sprintf(buf, frmtstr, precision, f) - else: - frmtstr[1] = floatFormatToChar[format] - frmtstr[2] = '\0' - c_sprintf(buf, frmtstr, f) - result = $buf - -proc formatFloat*(f: float, format: TFloatFormat = ffDefault, + ## If ``precision == 0``, it tries to format it nicely. + const floatFormatToChar: array[TFloatFormat, char] = ['g', 'f', 'e'] + var + frmtstr {.noinit.}: array[0..5, char] + buf {.noinit.}: array[0..2500, char] + frmtstr[0] = '%' + if precision > 0: + frmtstr[1] = '#' + frmtstr[2] = '.' + frmtstr[3] = '*' + frmtstr[4] = floatFormatToChar[format] + frmtstr[5] = '\0' + c_sprintf(buf, frmtstr, precision, f) + else: + frmtstr[1] = floatFormatToChar[format] + frmtstr[2] = '\0' + c_sprintf(buf, frmtstr, f) + result = $buf + +proc formatFloat*(f: float, format: TFloatFormat = ffDefault, precision: range[0..32] = 16): string {. - noSideEffect, operator: 2, rtl, extern: "nsu$1".} = - ## converts a floating point value `f` to a string. - ## - ## If ``format == ffDecimal`` then precision is the number of digits to - ## be printed after the decimal point. - ## If ``format == ffScientific`` then precision is the maximum number - ## of significant digits to be printed. - ## `precision`'s default value is the maximum number of meaningful digits - ## after the decimal point for Nimrod's ``float`` type. - result = formatBiggestFloat(f, format, precision) - -proc formatSize*(bytes: biggestInt, decimalSep = '.'): string = - ## Rounds and formats `bytes`. Examples: - ## - ## .. code-block:: nimrod - ## - ## formatSize(1'i64 shl 31 + 300'i64) == "2.204GB" - ## formatSize(4096) == "4KB" - ## - template frmt(a, b, c: expr): expr = - let bs = $b - insertSep($a) & decimalSep & bs.substr(0, 2) & c - let gigabytes = bytes shr 30 - let megabytes = bytes shr 20 - let kilobytes = bytes shr 10 - if gigabytes != 0: - result = frmt(gigabytes, megabytes, "GB") - elif megabytes != 0: - result = frmt(megabytes, kilobytes, "MB") - elif kilobytes != 0: - result = frmt(kilobytes, bytes, "KB") - else: - result = insertSep($bytes) & "B" - -proc findNormalized(x: string, inArray: openarray[string]): int = - var i = 0 - while i < high(inArray): - if cmpIgnoreStyle(x, inArray[i]) == 0: return i - inc(i, 2) # incrementing by 1 would probably lead to a - # security hole... - return -1 - -proc invalidFormatString() {.noinline.} = - raise newException(EInvalidValue, "invalid format string") - -proc addf*(s: var string, formatstr: string, a: varargs[string, `$`]) {. - noSideEffect, rtl, extern: "nsuAddf".} = - ## The same as ``add(s, formatstr % a)``, but more efficient. - const PatternChars = {'a'..'z', 'A'..'Z', '0'..'9', '\128'..'\255', '_'} - var i = 0 - var num = 0 - while i < len(formatstr): - if formatstr[i] == '$': - case formatstr[i+1] # again we use the fact that strings - # are zero-terminated here - of '#': - if num >% a.high: invalidFormatString() - add s, a[num] - inc i, 2 - inc num - of '$': - add s, '$' - inc(i, 2) - of '1'..'9', '-': - var j = 0 - inc(i) # skip $ - var negative = formatstr[i] == '-' - if negative: inc i - while formatstr[i] in Digits: - j = j * 10 + ord(formatstr[i]) - ord('0') - inc(i) - let idx = if not negative: j-1 else: a.len-j - if idx >% a.high: invalidFormatString() - add s, a[idx] - of '{': - var j = i+1 - while formatstr[j] notin {'\0', '}'}: inc(j) - var x = findNormalized(substr(formatstr, i+2, j-1), a) - if x >= 0 and x < high(a): add s, a[x+1] - else: invalidFormatString() - i = j+1 - of 'a'..'z', 'A'..'Z', '\128'..'\255', '_': - var j = i+1 - while formatstr[j] in PatternChars: inc(j) - var x = findNormalized(substr(formatstr, i+1, j-1), a) - if x >= 0 and x < high(a): add s, a[x+1] - else: invalidFormatString() - i = j - else: - invalidFormatString() - else: - add s, formatstr[i] - inc(i) - -proc `%` *(formatstr: string, a: openarray[string]): string {.noSideEffect, - rtl, extern: "nsuFormatOpenArray".} = - ## The `substitution`:idx: operator performs string substitutions in - ## `formatstr` and returns a modified `formatstr`. This is often called - ## `string interpolation`:idx:. - ## - ## This is best explained by an example: - ## - ## .. code-block:: nimrod - ## "$1 eats $2." % ["The cat", "fish"] - ## - ## Results in: - ## - ## .. code-block:: nimrod - ## "The cat eats fish." - ## - ## The substitution variables (the thing after the ``$``) are enumerated - ## from 1 to ``a.len``. - ## To produce a verbatim ``$``, use ``$$``. - ## 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. - ## An example: - ## - ## .. code-block:: nimrod - ## "$animal eats $food." % ["animal", "The cat", "food", "fish"] - ## - ## Results in: - ## - ## .. code-block:: nimrod - ## "The cat eats fish." - ## - ## The variables are compared with `cmpIgnoreStyle`. `EInvalidValue` is - ## raised if an ill-formed format string has been passed to the `%` operator. - result = newStringOfCap(formatstr.len + a.len shl 4) - addf(result, formatstr, a) - -proc `%` *(formatstr, a: string): string {.noSideEffect, - rtl, extern: "nsuFormatSingleElem".} = - ## This is the same as ``formatstr % [a]``. - result = newStringOfCap(formatstr.len + a.len) - addf(result, formatstr, [a]) - -proc format*(formatstr: string, a: varargs[string, `$`]): string {.noSideEffect, - rtl, extern: "nsuFormatVarargs".} = + noSideEffect, operator: 2, rtl, extern: "nsu$1".} = + ## converts a floating point value `f` to a string. + ## + ## If ``format == ffDecimal`` then precision is the number of digits to + ## be printed after the decimal point. + ## If ``format == ffScientific`` then precision is the maximum number + ## of significant digits to be printed. + ## `precision`'s default value is the maximum number of meaningful digits + ## after the decimal point for Nimrod's ``float`` type. + result = formatBiggestFloat(f, format, precision) + +proc formatSize*(bytes: BiggestInt, decimalSep = '.'): string = + ## Rounds and formats `bytes`. Examples: + ## + ## .. code-block:: nimrod + ## + ## formatSize(1'i64 shl 31 + 300'i64) == "2.204GB" + ## formatSize(4096) == "4KB" + ## + template frmt(a, b, c: expr): expr = + let bs = $b + insertSep($a) & decimalSep & bs.substr(0, 2) & c + let gigabytes = bytes shr 30 + let megabytes = bytes shr 20 + let kilobytes = bytes shr 10 + if gigabytes != 0: + result = frmt(gigabytes, megabytes, "GB") + elif megabytes != 0: + result = frmt(megabytes, kilobytes, "MB") + elif kilobytes != 0: + result = frmt(kilobytes, bytes, "KB") + else: + result = insertSep($bytes) & "B" + +proc findNormalized(x: string, inArray: openArray[string]): int = + var i = 0 + while i < high(inArray): + if cmpIgnoreStyle(x, inArray[i]) == 0: return i + inc(i, 2) # incrementing by 1 would probably lead to a + # security hole... + return -1 + +proc invalidFormatString() {.noinline.} = + raise newException(EInvalidValue, "invalid format string") + +proc addf*(s: var string, formatstr: string, a: varargs[string, `$`]) {. + noSideEffect, rtl, extern: "nsuAddf".} = + ## The same as ``add(s, formatstr % a)``, but more efficient. + const PatternChars = {'a'..'z', 'A'..'Z', '0'..'9', '\128'..'\255', '_'} + var i = 0 + var num = 0 + while i < len(formatstr): + if formatstr[i] == '$': + case formatstr[i+1] # again we use the fact that strings + # are zero-terminated here + of '#': + if num >% a.high: invalidFormatString() + add s, a[num] + inc i, 2 + inc num + of '$': + add s, '$' + inc(i, 2) + of '1'..'9', '-': + var j = 0 + inc(i) # skip $ + var negative = formatstr[i] == '-' + if negative: inc i + while formatstr[i] in Digits: + j = j * 10 + ord(formatstr[i]) - ord('0') + inc(i) + let idx = if not negative: j-1 else: a.len-j + if idx >% a.high: invalidFormatString() + add s, a[idx] + of '{': + var j = i+1 + while formatstr[j] notin {'\0', '}'}: inc(j) + var x = findNormalized(substr(formatstr, i+2, j-1), a) + if x >= 0 and x < high(a): add s, a[x+1] + else: invalidFormatString() + i = j+1 + of 'a'..'z', 'A'..'Z', '\128'..'\255', '_': + var j = i+1 + while formatstr[j] in PatternChars: inc(j) + var x = findNormalized(substr(formatstr, i+1, j-1), a) + if x >= 0 and x < high(a): add s, a[x+1] + else: invalidFormatString() + i = j + else: + invalidFormatString() + else: + add s, formatstr[i] + inc(i) + +proc `%` *(formatstr: string, a: openArray[string]): string {.noSideEffect, + rtl, extern: "nsuFormatOpenArray".} = + ## The `substitution`:idx: operator performs string substitutions in + ## `formatstr` and returns a modified `formatstr`. This is often called + ## `string interpolation`:idx:. + ## + ## This is best explained by an example: + ## + ## .. code-block:: nimrod + ## "$1 eats $2." % ["The cat", "fish"] + ## + ## Results in: + ## + ## .. code-block:: nimrod + ## "The cat eats fish." + ## + ## The substitution variables (the thing after the ``$``) are enumerated + ## from 1 to ``a.len``. + ## To produce a verbatim ``$``, use ``$$``. + ## 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. + ## An example: + ## + ## .. code-block:: nimrod + ## "$animal eats $food." % ["animal", "The cat", "food", "fish"] + ## + ## Results in: + ## + ## .. code-block:: nimrod + ## "The cat eats fish." + ## + ## The variables are compared with `cmpIgnoreStyle`. `EInvalidValue` is + ## raised if an ill-formed format string has been passed to the `%` operator. + result = newStringOfCap(formatstr.len + a.len shl 4) + addf(result, formatstr, a) + +proc `%` *(formatstr, a: string): string {.noSideEffect, + rtl, extern: "nsuFormatSingleElem".} = + ## This is the same as ``formatstr % [a]``. + result = newStringOfCap(formatstr.len + a.len) + addf(result, formatstr, [a]) + +proc format*(formatstr: string, a: varargs[string, `$`]): string {.noSideEffect, + rtl, extern: "nsuFormatVarargs".} = ## This is the same as ``formatstr % a`` except that it supports - ## auto stringification. - result = newStringOfCap(formatstr.len + a.len) - addf(result, formatstr, a) - -{.pop.} - -when isMainModule: - doAssert align("abc", 4) == " abc" - doAssert align("a", 0) == "a" - doAssert align("1232", 6) == " 1232" - doAssert align("1232", 6, '#') == "##1232" - echo wordWrap(""" this is a long text -- muchlongerthan10chars and here - it goes""", 10, false) - doAssert formatBiggestFloat(0.00000000001, ffDecimal, 11) == "0.00000000001" - doAssert formatBiggestFloat(0.00000000001, ffScientific, 1) == "1.0e-11" - - doAssert "$# $3 $# $#" % ["a", "b", "c"] == "a c b c" - echo formatSize(1'i64 shl 31 + 300'i64) # == "4,GB" - echo formatSize(1'i64 shl 31) - - doAssert "$animal eats $food." % ["animal", "The cat", "food", "fish"] == - "The cat eats fish." - - doAssert "-ld a-ldz -ld".replaceWord("-ld") == " a-ldz " - doAssert "-lda-ldz -ld abc".replaceWord("-ld") == "-lda-ldz abc" + ## auto stringification. + result = newStringOfCap(formatstr.len + a.len) + addf(result, formatstr, a) + +{.pop.} + +when isMainModule: + doAssert align("abc", 4) == " abc" + doAssert align("a", 0) == "a" + doAssert align("1232", 6) == " 1232" + doAssert align("1232", 6, '#') == "##1232" + echo wordWrap(""" this is a long text -- muchlongerthan10chars and here + it goes""", 10, false) + doAssert formatBiggestFloat(0.00000000001, ffDecimal, 11) == "0.00000000001" + doAssert formatBiggestFloat(0.00000000001, ffScientific, 1) == "1.0e-11" + + doAssert "$# $3 $# $#" % ["a", "b", "c"] == "a c b c" + echo formatSize(1'i64 shl 31 + 300'i64) # == "4,GB" + echo formatSize(1'i64 shl 31) + + doAssert "$animal eats $food." % ["animal", "The cat", "food", "fish"] == + "The cat eats fish." + + doAssert "-ld a-ldz -ld".replaceWord("-ld") == " a-ldz " + doAssert "-lda-ldz -ld abc".replaceWord("-ld") == "-lda-ldz abc" - type TMyEnum = enum enA, enB, enC, enuD, enE - doAssert parseEnum[TMyEnum]("enu_D") == enuD + type TMyEnum = enum enA, enB, enC, enuD, enE + doAssert parseEnum[TMyEnum]("enu_D") == enuD - doAssert parseEnum("invalid enum value", enC) == enC + doAssert parseEnum("invalid enum value", enC) == enC diff --git a/lib/pure/terminal.nim b/lib/pure/terminal.nim index 501184aca..20f1d0695 100644 --- a/lib/pure/terminal.nim +++ b/lib/pure/terminal.nim @@ -27,15 +27,15 @@ when defined(windows): var hTemp = GetStdHandle(STD_OUTPUT_HANDLE) if DuplicateHandle(GetCurrentProcess(), hTemp, GetCurrentProcess(), addr(conHandle), 0, 1, DUPLICATE_SAME_ACCESS) == 0: - OSError(OSLastError()) + osError(osLastError()) proc getCursorPos(): tuple [x,y: int] = - var c: TCONSOLE_SCREEN_BUFFER_INFO - if GetConsoleScreenBufferInfo(conHandle, addr(c)) == 0: OSError(OSLastError()) + var c: TCONSOLESCREENBUFFERINFO + if GetConsoleScreenBufferInfo(conHandle, addr(c)) == 0: osError(osLastError()) return (int(c.dwCursorPosition.x), int(c.dwCursorPosition.y)) proc getAttributes(): int16 = - var c: TCONSOLE_SCREEN_BUFFER_INFO + var c: TCONSOLESCREENBUFFERINFO # workaround Windows bugs: try several times if GetConsoleScreenBufferInfo(conHandle, addr(c)) != 0: return c.wAttributes @@ -48,10 +48,10 @@ proc setCursorPos*(x, y: int) = ## sets the terminal's cursor to the (x,y) position. (0,0) is the ## upper left of the screen. when defined(windows): - var c: TCoord + var c: TCOORD c.x = int16(x) c.y = int16(y) - if SetConsoleCursorPosition(conHandle, c) == 0: OSError(OSLastError()) + if SetConsoleCursorPosition(conHandle, c) == 0: osError(osLastError()) else: stdout.write("\e[" & $y & ';' & $x & 'f') @@ -59,12 +59,12 @@ proc setCursorXPos*(x: int) = ## sets the terminal's cursor to the x position. The y position is ## not changed. when defined(windows): - var scrbuf: TCONSOLE_SCREEN_BUFFER_INFO + var scrbuf: TCONSOLESCREENBUFFERINFO var hStdout = conHandle - if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: OSError(OSLastError()) + if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: osError(osLastError()) var origin = scrbuf.dwCursorPosition origin.x = int16(x) - if SetConsoleCursorPosition(conHandle, origin) == 0: OSError(OSLastError()) + if SetConsoleCursorPosition(conHandle, origin) == 0: osError(osLastError()) else: stdout.write("\e[" & $x & 'G') @@ -73,16 +73,16 @@ when defined(windows): ## sets the terminal's cursor to the y position. The x position is ## not changed. **Warning**: This is not supported on UNIX! when defined(windows): - var scrbuf: TCONSOLE_SCREEN_BUFFER_INFO + var scrbuf: TCONSOLESCREENBUFFERINFO var hStdout = conHandle - if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: OSError(OSLastError()) + if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: osError(osLastError()) var origin = scrbuf.dwCursorPosition origin.y = int16(y) - if SetConsoleCursorPosition(conHandle, origin) == 0: OSError(OSLastError()) + if SetConsoleCursorPosition(conHandle, origin) == 0: osError(osLastError()) else: - nil + discard -proc CursorUp*(count=1) = +proc cursorUp*(count=1) = ## Moves the cursor up by `count` rows. when defined(windows): var p = getCursorPos() @@ -91,7 +91,7 @@ proc CursorUp*(count=1) = else: stdout.write("\e[" & $count & 'A') -proc CursorDown*(count=1) = +proc cursorDown*(count=1) = ## Moves the cursor down by `count` rows. when defined(windows): var p = getCursorPos() @@ -100,7 +100,7 @@ proc CursorDown*(count=1) = else: stdout.write("\e[" & $count & 'B') -proc CursorForward*(count=1) = +proc cursorForward*(count=1) = ## Moves the cursor forward by `count` columns. when defined(windows): var p = getCursorPos() @@ -109,7 +109,7 @@ proc CursorForward*(count=1) = else: stdout.write("\e[" & $count & 'C') -proc CursorBackward*(count=1) = +proc cursorBackward*(count=1) = ## Moves the cursor backward by `count` columns. when defined(windows): var p = getCursorPos() @@ -119,78 +119,78 @@ proc CursorBackward*(count=1) = stdout.write("\e[" & $count & 'D') when true: - nil + discard else: - proc EraseLineEnd* = + proc eraseLineEnd* = ## Erases from the current cursor position to the end of the current line. when defined(windows): - nil + discard else: stdout.write("\e[K") - proc EraseLineStart* = + proc eraseLineStart* = ## Erases from the current cursor position to the start of the current line. when defined(windows): - nil + discard else: stdout.write("\e[1K") - proc EraseDown* = + proc eraseDown* = ## Erases the screen from the current line down to the bottom of the screen. when defined(windows): - nil + discard else: stdout.write("\e[J") - proc EraseUp* = + proc eraseUp* = ## Erases the screen from the current line up to the top of the screen. when defined(windows): - nil + discard else: stdout.write("\e[1J") -proc EraseLine* = +proc eraseLine* = ## Erases the entire current line. when defined(windows): - var scrbuf: TCONSOLE_SCREEN_BUFFER_INFO + var scrbuf: TCONSOLESCREENBUFFERINFO var numwrote: DWORD var hStdout = conHandle - if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: OSError(OSLastError()) + if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: osError(osLastError()) var origin = scrbuf.dwCursorPosition origin.x = 0'i16 - if SetConsoleCursorPosition(conHandle, origin) == 0: OSError(OSLastError()) + if SetConsoleCursorPosition(conHandle, origin) == 0: osError(osLastError()) var ht = scrbuf.dwSize.Y - origin.Y var wt = scrbuf.dwSize.X - origin.X if FillConsoleOutputCharacter(hStdout,' ', ht*wt, origin, addr(numwrote)) == 0: - OSError(OSLastError()) + osError(osLastError()) if FillConsoleOutputAttribute(hStdout, scrbuf.wAttributes, ht * wt, scrbuf.dwCursorPosition, addr(numwrote)) == 0: - OSError(OSLastError()) + osError(osLastError()) else: stdout.write("\e[2K") setCursorXPos(0) -proc EraseScreen* = +proc eraseScreen* = ## Erases the screen with the background colour and moves the cursor to home. when defined(windows): - var scrbuf: TCONSOLE_SCREEN_BUFFER_INFO + var scrbuf: TCONSOLESCREENBUFFERINFO var numwrote: DWORD - var origin: TCoord # is inititalized to 0, 0 + var origin: TCOORD # is inititalized to 0, 0 var hStdout = conHandle - if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: OSError(OSLastError()) + if GetConsoleScreenBufferInfo(hStdout, addr(scrbuf)) == 0: osError(osLastError()) if FillConsoleOutputCharacter(hStdout, ' ', scrbuf.dwSize.X*scrbuf.dwSize.Y, origin, addr(numwrote)) == 0: - OSError(OSLastError()) + osError(osLastError()) if FillConsoleOutputAttribute(hStdout, scrbuf.wAttributes, scrbuf.dwSize.X * scrbuf.dwSize.Y, origin, addr(numwrote)) == 0: - OSError(OSLastError()) + osError(osLastError()) setCursorXPos(0) else: stdout.write("\e[2J") -proc ResetAttributes* {.noconv.} = +proc resetAttributes* {.noconv.} = ## resets all attributes; it is advisable to register this as a quit proc ## with ``system.addQuitProc(resetAttributes)``. when defined(windows): @@ -227,7 +227,7 @@ proc setStyle*(style: set[TStyle]) = for s in items(style): stdout.write("\e[" & $ord(s) & 'm') -proc WriteStyled*(txt: string, style: set[TStyle] = {styleBright}) = +proc writeStyled*(txt: string, style: set[TStyle] = {styleBright}) = ## writes the text `txt` in a given `style`. when defined(windows): var old = getAttributes() @@ -320,8 +320,8 @@ proc isatty*(f: TFile): bool = proc styledEchoProcessArg(s: string) = write stdout, s proc styledEchoProcessArg(style: TStyle) = setStyle({style}) proc styledEchoProcessArg(style: set[TStyle]) = setStyle style -proc styledEchoProcessArg(color: TForegroundColor) = setForeGroundColor color -proc styledEchoProcessArg(color: TBackgroundColor) = setBackGroundColor color +proc styledEchoProcessArg(color: TForegroundColor) = setForegroundColor color +proc styledEchoProcessArg(color: TBackgroundColor) = setBackgroundColor color macro styledEcho*(m: varargs[expr]): stmt = ## to be documented. @@ -345,4 +345,4 @@ when isMainModule: writeln(stdout, "ordinary text") styledEcho("styled text ", {styleBright, styleBlink, styleUnderscore}) - \ No newline at end of file + diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 80a5ad8d3..de6c4e4fa 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -146,7 +146,7 @@ proc getGMTime*(t: TTime): TTimeInfo {.tags: [FTime], raises: [].} ## converts the calendar time `t` to broken-down time representation, ## expressed in Coordinated Universal Time (UTC). -proc TimeInfoToTime*(timeInfo: TTimeInfo): TTime {.tags: [].} +proc timeInfoToTime*(timeInfo: TTimeInfo): TTime {.tags: [].} ## converts a broken-down time structure to ## calendar time representation. The function ignores the specified ## contents of the structure members `weekday` and `yearday` and recomputes @@ -211,7 +211,9 @@ proc initInterval*(miliseconds, seconds, minutes, hours, days, months, result.months = months result.years = years -proc isLeapYear(year: int): bool = +proc isLeapYear*(year: int): bool = + ## returns true if ``year`` is a leap year + if year mod 400 == 0: return true elif year mod 100 == 0: @@ -221,7 +223,9 @@ proc isLeapYear(year: int): bool = else: return false -proc getDaysInMonth(month: TMonth, year: int): int = +proc getDaysInMonth*(month: TMonth, year: int): int = + ## gets the amount of days in a ``month`` of a ``year`` + # http://www.dispersiondesign.com/articles/time/number_of_days_in_a_month case month of mFeb: result = if isLeapYear(year): 29 else: 28 @@ -246,7 +250,8 @@ proc toSeconds(a: TTimeInfo, interval: TTimeInterval): float = else: curMonth.inc() result += float(newinterv.days * 24 * 60 * 60) - result += float(newinterv.minutes * 60 * 60) + result += float(newinterv.hours * 60 * 60) + result += float(newinterv.minutes * 60) result += float(newinterv.seconds) result += newinterv.miliseconds / 1000 @@ -255,7 +260,7 @@ proc `+`*(a: TTimeInfo, interval: TTimeInterval): TTimeInfo = ## ## **Note:** This has been only briefly tested and it may not be ## very accurate. - let t = toSeconds(TimeInfoToTime(a)) + let t = toSeconds(timeInfoToTime(a)) let secs = toSeconds(a, interval) if a.tzname == "UTC": result = getGMTime(fromSeconds(t + secs)) @@ -267,7 +272,7 @@ proc `-`*(a: TTimeInfo, interval: TTimeInterval): TTimeInfo = ## ## **Note:** This has been only briefly tested, it is inaccurate especially ## when you subtract so much that you reach the Julian calendar. - let t = toSeconds(TimeInfoToTime(a)) + let t = toSeconds(timeInfoToTime(a)) let secs = toSeconds(a, interval) if a.tzname == "UTC": result = getGMTime(fromSeconds(t - secs)) @@ -296,7 +301,7 @@ when not defined(JS): when not defined(JS): # C wrapper: type - structTM {.importc: "struct tm", final.} = object + StructTM {.importc: "struct tm", final.} = object second {.importc: "tm_sec".}, minute {.importc: "tm_min".}, hour {.importc: "tm_hour".}, @@ -307,7 +312,7 @@ when not defined(JS): yearday {.importc: "tm_yday".}, isdst {.importc: "tm_isdst".}: cint - PTimeInfo = ptr structTM + PTimeInfo = ptr StructTM PTime = ptr TTime TClock {.importc: "clock_t".} = distinct int @@ -318,11 +323,11 @@ when not defined(JS): importc: "gmtime", header: "<time.h>", tags: [].} proc timec(timer: PTime): TTime {. importc: "time", header: "<time.h>", tags: [].} - proc mktime(t: structTM): TTime {. + proc mktime(t: StructTM): TTime {. importc: "mktime", header: "<time.h>", tags: [].} - proc asctime(tblock: structTM): CString {. + proc asctime(tblock: StructTM): cstring {. importc: "asctime", header: "<time.h>", tags: [].} - proc ctime(time: PTime): CString {. + proc ctime(time: PTime): cstring {. importc: "ctime", header: "<time.h>", tags: [].} # strftime(s: CString, maxsize: int, fmt: CString, t: tm): int {. # importc: "strftime", header: "<time.h>".} @@ -334,7 +339,7 @@ when not defined(JS): clocksPerSec {.importc: "CLOCKS_PER_SEC", nodecl.}: int # our own procs on top of that: - proc tmToTimeInfo(tm: structTM, local: bool): TTimeInfo = + proc tmToTimeInfo(tm: StructTM, local: bool): TTimeInfo = const weekDays: array [0..6, TWeekDay] = [ dSun, dMon, dTue, dWed, dThu, dFri, dSat] @@ -344,11 +349,11 @@ when not defined(JS): monthday: int(tm.monthday), month: TMonth(tm.month), year: tm.year + 1900'i32, - weekday: weekDays[int(tm.weekDay)], + weekday: weekDays[int(tm.weekday)], yearday: int(tm.yearday), - isDST: tm.isDST > 0, + isDST: tm.isdst > 0, tzname: if local: - if tm.isDST > 0: + if tm.isdst > 0: getTzname().DST else: getTzname().nonDST @@ -357,7 +362,7 @@ when not defined(JS): timezone: if local: getTimezone() else: 0 ) - proc timeInfoToTM(t: TTimeInfo): structTM = + proc timeInfoToTM(t: TTimeInfo): StructTM = const weekDays: array [TWeekDay, int8] = [1'i8,2'i8,3'i8,4'i8,5'i8,6'i8,0'i8] result.second = t.second @@ -366,7 +371,7 @@ when not defined(JS): result.monthday = t.monthday result.month = ord(t.month) result.year = t.year - 1900 - result.weekday = weekDays[t.weekDay] + result.weekday = weekDays[t.weekday] result.yearday = t.yearday result.isdst = if t.isDST: 1 else: 0 @@ -400,7 +405,7 @@ when not defined(JS): # copying is needed anyway to provide reentrancity; thus # the conversion is not expensive - proc TimeInfoToTime(timeInfo: TTimeInfo): TTime = + proc timeInfoToTime(timeInfo: TTimeInfo): TTime = var cTimeInfo = timeInfo # for C++ we have to make a copy, # because the header of mktime is broken in my version of libc return mktime(timeInfoToTM(cTimeInfo)) @@ -452,7 +457,7 @@ when not defined(JS): result = toFloat(a.tv_sec) + toFloat(a.tv_usec)*0.00_0001 elif defined(windows): var f: winlean.TFiletime - GetSystemTimeAsFileTime(f) + getSystemTimeAsFileTime(f) var i64 = rdFileTime(f) - epochDiff var secs = i64 div rateDiff var subsecs = i64 mod rateDiff @@ -497,7 +502,7 @@ elif defined(JS): result.weekday = weekDays[t.getUTCDay()] result.yearday = 0 - proc TimeInfoToTime*(timeInfo: TTimeInfo): TTime = + proc timeInfoToTime*(timeInfo: TTimeInfo): TTime = result = internGetTime() result.setSeconds(timeInfo.second) result.setMinutes(timeInfo.minute) @@ -531,7 +536,7 @@ proc getDateStr*(): string {.rtl, extern: "nt$1", tags: [FTime].} = ## gets the current date as a string of the format ``YYYY-MM-DD``. var ti = getLocalTime(getTime()) result = $ti.year & '-' & intToStr(ord(ti.month)+1, 2) & - '-' & intToStr(ti.monthDay, 2) + '-' & intToStr(ti.monthday, 2) proc getClockStr*(): string {.rtl, extern: "nt$1", tags: [FTime].} = ## gets the current clock time as a string of the format ``HH:MM:SS``. @@ -592,7 +597,7 @@ proc format*(info: TTimeInfo, f: string): string = result = "" var i = 0 var currentF = "" - while True: + while true: case f[i] of ' ', '-', '/', ':', '\'', '\0', '(', ')', '[', ']', ',': case currentF @@ -697,7 +702,7 @@ proc format*(info: TTimeInfo, f: string): string = of "ZZZ": result.add(info.tzname) of "": - nil # Do nothing. + discard else: raise newException(EInvalidValue, "Invalid format string: " & currentF) diff --git a/lib/pure/unicode.nim b/lib/pure/unicode.nim index 142178a86..6e73eea3f 100644 --- a/lib/pure/unicode.nim +++ b/lib/pure/unicode.nim @@ -14,8 +14,8 @@ include "system/inclrtl" type - irune = int # underlying type of TRune - TRune* = distinct irune ## type that can hold any Unicode character + IRune = int # underlying type of TRune + TRune* = distinct IRune ## type that can hold any Unicode character TRune16* = distinct int16 ## 16 bit Unicode character proc `<=%`*(a, b: TRune): bool = return int(a) <=% int(b) @@ -55,31 +55,31 @@ template fastRuneAt*(s: string, i: int, result: expr, doInc = true) = result = TRune(ord(s[i])) when doInc: inc(i) elif ord(s[i]) shr 5 == 0b110: - assert(ord(s[i+1]) shr 6 == 0b10) + # assert(ord(s[i+1]) shr 6 == 0b10) result = TRune((ord(s[i]) and (ones(5))) shl 6 or (ord(s[i+1]) and ones(6))) when doInc: inc(i, 2) elif ord(s[i]) shr 4 == 0b1110: - assert(ord(s[i+1]) shr 6 == 0b10) - assert(ord(s[i+2]) shr 6 == 0b10) + # assert(ord(s[i+1]) shr 6 == 0b10) + # assert(ord(s[i+2]) shr 6 == 0b10) result = TRune((ord(s[i]) and ones(4)) shl 12 or (ord(s[i+1]) and ones(6)) shl 6 or (ord(s[i+2]) and ones(6))) when doInc: inc(i, 3) elif ord(s[i]) shr 3 == 0b11110: - assert(ord(s[i+1]) shr 6 == 0b10) - assert(ord(s[i+2]) shr 6 == 0b10) - assert(ord(s[i+3]) shr 6 == 0b10) + # assert(ord(s[i+1]) shr 6 == 0b10) + # assert(ord(s[i+2]) shr 6 == 0b10) + # assert(ord(s[i+3]) shr 6 == 0b10) result = TRune((ord(s[i]) and ones(3)) shl 18 or (ord(s[i+1]) and ones(6)) shl 12 or (ord(s[i+2]) and ones(6)) shl 6 or (ord(s[i+3]) and ones(6))) when doInc: inc(i, 4) elif ord(s[i]) shr 2 == 0b111110: - assert(ord(s[i+1]) shr 6 == 0b10) - assert(ord(s[i+2]) shr 6 == 0b10) - assert(ord(s[i+3]) shr 6 == 0b10) - assert(ord(s[i+4]) shr 6 == 0b10) + # assert(ord(s[i+1]) shr 6 == 0b10) + # assert(ord(s[i+2]) shr 6 == 0b10) + # assert(ord(s[i+3]) shr 6 == 0b10) + # assert(ord(s[i+4]) shr 6 == 0b10) result = TRune((ord(s[i]) and ones(2)) shl 24 or (ord(s[i+1]) and ones(6)) shl 18 or (ord(s[i+2]) and ones(6)) shl 12 or @@ -87,11 +87,11 @@ template fastRuneAt*(s: string, i: int, result: expr, doInc = true) = (ord(s[i+4]) and ones(6))) when doInc: inc(i, 5) elif ord(s[i]) shr 1 == 0b1111110: - assert(ord(s[i+1]) shr 6 == 0b10) - assert(ord(s[i+2]) shr 6 == 0b10) - assert(ord(s[i+3]) shr 6 == 0b10) - assert(ord(s[i+4]) shr 6 == 0b10) - assert(ord(s[i+5]) shr 6 == 0b10) + # assert(ord(s[i+1]) shr 6 == 0b10) + # assert(ord(s[i+2]) shr 6 == 0b10) + # assert(ord(s[i+3]) shr 6 == 0b10) + # assert(ord(s[i+4]) shr 6 == 0b10) + # assert(ord(s[i+5]) shr 6 == 0b10) result = TRune((ord(s[i]) and ones(1)) shl 30 or (ord(s[i+1]) and ones(6)) shl 24 or (ord(s[i+2]) and ones(6)) shl 18 or @@ -109,7 +109,7 @@ proc runeAt*(s: string, i: int): TRune = proc toUTF8*(c: TRune): string {.rtl, extern: "nuc$1".} = ## converts a rune into its UTF8 representation - var i = irune(c) + var i = IRune(c) if i <=% 127: result = newString(1) result[0] = chr(i) @@ -132,6 +132,10 @@ proc toUTF8*(c: TRune): string {.rtl, extern: "nuc$1".} = result = newString(1) result[0] = chr(i) +proc `$`*(rune: TRune): string = + ## converts a rune to a string + rune.toUTF8 + proc `$`*(runes: seq[TRune]): string = ## converts a sequence of runes to a string result = "" @@ -1096,7 +1100,7 @@ const 0x01f1, 501, # 0x01f3, 499] # -proc binarySearch(c: irune, tab: openArray[iRune], len, stride: int): int = +proc binarySearch(c: IRune, tab: openArray[IRune], len, stride: int): int = var n = len var t = 0 while n > 1: @@ -1114,29 +1118,29 @@ proc binarySearch(c: irune, tab: openArray[iRune], len, stride: int): int = proc toLower*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.} = ## Converts `c` into lower case. This works for any Unicode character. ## If possible, prefer `toLower` over `toUpper`. - var c = irune(c) - var p = binarySearch(c, tolowerRanges, len(toLowerRanges) div 3, 3) + var c = IRune(c) + var p = binarySearch(c, tolowerRanges, len(tolowerRanges) div 3, 3) if p >= 0 and c >= tolowerRanges[p] and c <= tolowerRanges[p+1]: return TRune(c + tolowerRanges[p+2] - 500) - p = binarySearch(c, toLowerSinglets, len(toLowerSinglets) div 2, 2) - if p >= 0 and c == toLowerSinglets[p]: - return TRune(c + toLowerSinglets[p+1] - 500) + p = binarySearch(c, tolowerSinglets, len(tolowerSinglets) div 2, 2) + if p >= 0 and c == tolowerSinglets[p]: + return TRune(c + tolowerSinglets[p+1] - 500) return TRune(c) proc toUpper*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.} = ## Converts `c` into upper case. This works for any Unicode character. ## If possible, prefer `toLower` over `toUpper`. - var c = irune(c) - var p = binarySearch(c, toUpperRanges, len(toUpperRanges) div 3, 3) - if p >= 0 and c >= toUpperRanges[p] and c <= toUpperRanges[p+1]: - return TRune(c + toUpperRanges[p+2] - 500) - p = binarySearch(c, toUpperSinglets, len(toUpperSinglets) div 2, 2) - if p >= 0 and c == toUpperSinglets[p]: - return TRune(c + toUpperSinglets[p+1] - 500) + var c = IRune(c) + var p = binarySearch(c, toupperRanges, len(toupperRanges) div 3, 3) + if p >= 0 and c >= toupperRanges[p] and c <= toupperRanges[p+1]: + return TRune(c + toupperRanges[p+2] - 500) + p = binarySearch(c, toupperSinglets, len(toupperSinglets) div 2, 2) + if p >= 0 and c == toupperSinglets[p]: + return TRune(c + toupperSinglets[p+1] - 500) return TRune(c) proc toTitle*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.} = - var c = irune(c) + var c = IRune(c) var p = binarySearch(c, toTitleSinglets, len(toTitleSinglets) div 2, 2) if p >= 0 and c == toTitleSinglets[p]: return TRune(c + toTitleSinglets[p+1] - 500) @@ -1145,32 +1149,32 @@ proc toTitle*(c: TRune): TRune {.rtl, extern: "nuc$1", procvar.} = proc isLower*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.} = ## returns true iff `c` is a lower case Unicode character ## If possible, prefer `isLower` over `isUpper`. - var c = irune(c) + var c = IRune(c) # Note: toUpperRanges is correct here! - var p = binarySearch(c, toUpperRanges, len(toUpperRanges) div 3, 3) - if p >= 0 and c >= toUpperRanges[p] and c <= toUpperRanges[p+1]: + var p = binarySearch(c, toupperRanges, len(toupperRanges) div 3, 3) + if p >= 0 and c >= toupperRanges[p] and c <= toupperRanges[p+1]: return true - p = binarySearch(c, toUpperSinglets, len(toUpperSinglets) div 2, 2) - if p >= 0 and c == toUpperSinglets[p]: + p = binarySearch(c, toupperSinglets, len(toupperSinglets) div 2, 2) + if p >= 0 and c == toupperSinglets[p]: return true proc isUpper*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.} = ## returns true iff `c` is a upper case Unicode character ## If possible, prefer `isLower` over `isUpper`. - var c = irune(c) + var c = IRune(c) # Note: toLowerRanges is correct here! - var p = binarySearch(c, toLowerRanges, len(toLowerRanges) div 3, 3) - if p >= 0 and c >= toLowerRanges[p] and c <= toLowerRanges[p+1]: + var p = binarySearch(c, tolowerRanges, len(tolowerRanges) div 3, 3) + if p >= 0 and c >= tolowerRanges[p] and c <= tolowerRanges[p+1]: return true - p = binarySearch(c, toLowerSinglets, len(toLowerSinglets) div 2, 2) - if p >= 0 and c == toLowerSinglets[p]: + p = binarySearch(c, tolowerSinglets, len(tolowerSinglets) div 2, 2) + if p >= 0 and c == tolowerSinglets[p]: return true proc isAlpha*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.} = ## returns true iff `c` is an *alpha* Unicode character (i.e. a letter) if isUpper(c) or isLower(c): return true - var c = irune(c) + var c = IRune(c) var p = binarySearch(c, alphaRanges, len(alphaRanges) div 2, 2) if p >= 0 and c >= alphaRanges[p] and c <= alphaRanges[p+1]: return true @@ -1183,7 +1187,7 @@ proc isTitle*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.} = proc isWhiteSpace*(c: TRune): bool {.rtl, extern: "nuc$1", procvar.} = ## returns true iff `c` is a Unicode whitespace character - var c = irune(c) + var c = IRune(c) var p = binarySearch(c, spaceRanges, len(spaceRanges) div 2, 2) if p >= 0 and c >= spaceRanges[p] and c <= spaceRanges[p+1]: return true @@ -1210,7 +1214,7 @@ proc cmpRunesIgnoreCase*(a, b: string): int {.rtl, extern: "nuc$1", procvar.} = # slow path: fastRuneAt(a, i, ar) fastRuneAt(b, j, br) - result = irune(toLower(ar)) - irune(toLower(br)) + result = IRune(toLower(ar)) - IRune(toLower(br)) if result != 0: return result = a.len - b.len diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 71f4d498b..f5640a1b4 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -37,8 +37,8 @@ var checkpoints: seq[string] = @[] -template TestSetupIMPL*: stmt {.immediate, dirty.} = nil -template TestTeardownIMPL*: stmt {.immediate, dirty.} = nil +template TestSetupIMPL*: stmt {.immediate, dirty.} = discard +template TestTeardownIMPL*: stmt {.immediate, dirty.} = discard proc shouldRun(testName: string): bool = result = true @@ -98,8 +98,12 @@ template fail* = when not defined(ECMAScript): if AbortOnError: quit(1) - - TestStatusIMPL = FAILED + + when defined(TestStatusIMPL): + TestStatusIMPL = FAILED + else: + program_result += 1 + checkpoints = @[] macro check*(conditions: stmt): stmt {.immediate.} = @@ -111,7 +115,8 @@ macro check*(conditions: stmt): stmt {.immediate.} = counter = 0 template asgn(a, value: expr): stmt = - let a = value + var a = value # XXX: we need "var: var" here in order to + # preserve the semantics of var params template print(name, value: expr): stmt = when compiles(string($value)): @@ -121,7 +126,7 @@ macro check*(conditions: stmt): stmt {.immediate.} = for i in 1 .. <exp.len: if exp[i].kind notin nnkLiterals: inc counter - var arg = newIdentNode(":p" & ($counter)) + var arg = newIdentNode(":p" & $counter) var argStr = exp[i].toStrLit if exp[i].kind in nnkCallKinds: inspectArgs(exp[i]) argsAsgns.add getAst(asgn(arg, exp[i])) @@ -141,12 +146,14 @@ macro check*(conditions: stmt): stmt {.immediate.} = var checkedStr = checked.toStrLit inspectArgs(checked) - result = getAst(rewrite(checked, checked.lineinfo, checkedStr, argsAsgns, argsPrintOuts)) + result = getAst(rewrite(checked, checked.lineinfo, checkedStr, + argsAsgns, argsPrintOuts)) of nnkStmtList: result = newNimNode(nnkStmtList) for i in countup(0, checked.len - 1): - result.add(newCall(!"check", checked[i])) + if checked[i].kind != nnkCommentStmt: + result.add(newCall(!"check", checked[i])) else: template rewrite(Exp, lineInfoLit: expr, expLit: string): stmt = @@ -170,7 +177,7 @@ macro expect*(exceptions: varargs[expr], body: stmt): stmt {.immediate.} = checkpoint(lineInfoLit & ": Expect Failed, no exception was thrown.") fail() except errorTypes: - nil + discard var body = exp[exp.len - 1] diff --git a/lib/pure/xmlparser.nim b/lib/pure/xmlparser.nim index 16bbe1455..8b8bb3b03 100644 --- a/lib/pure/xmlparser.nim +++ b/lib/pure/xmlparser.nim @@ -96,7 +96,7 @@ proc parse(x: var TXmlParser, errors: var seq[string]): PXmlNode = ## &entity; errors.add(errorMsg(x, "unknown entity: " & x.entityName)) next(x) - of xmlEof: nil + of xmlEof: discard proc parseXml*(s: PStream, filename: string, errors: var seq[string]): PXmlNode = @@ -110,7 +110,7 @@ proc parseXml*(s: PStream, filename: string, of xmlElementOpen, xmlElementStart: result = parse(x, errors) break - of xmlComment, xmlWhitespace, xmlSpecial, xmlPI: nil # just skip it + of xmlComment, xmlWhitespace, xmlSpecial, xmlPI: discard # just skip it of xmlError: errors.add(errorMsg(x)) else: diff --git a/lib/system.nim b/lib/system.nim index b2d19a885..2acb989c5 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -144,7 +144,7 @@ proc reset*[T](obj: var T) {.magic: "Reset", noSideEffect.} ## be called before any possible `object branch transition`:idx:. # for low and high the return type T may not be correct, but -# we handle that with compiler magic in SemLowHigh() +# we handle that with compiler magic in semLowHigh() proc high*[T](x: T): T {.magic: "High", noSideEffect.} ## returns the highest possible index of an array, a sequence, a string or ## the highest possible value of an ordinal value `x`. As a special @@ -159,7 +159,7 @@ type range*{.magic: "Range".}[T] ## Generic type to construct range types. array*{.magic: "Array".}[I, T] ## Generic type to construct ## fixed-length arrays. - openarray*{.magic: "OpenArray".}[T] ## Generic type to construct open arrays. + openArray*{.magic: "OpenArray".}[T] ## Generic type to construct open arrays. ## Open arrays are implemented as a ## pointer to the array data and a ## length field. @@ -186,7 +186,10 @@ proc `..`*[T](b: T): TSlice[T] {.noSideEffect, inline.} = when not defined(niminheritable): {.pragma: inheritable.} -when not defined(JS) and not defined(NimrodVM): +const NoFakeVars* = defined(NimrodVM) ## true if the backend doesn't support \ + ## "fake variables" like 'var EBADF {.importc.}: cint'. + +when not defined(JS): type TGenericSeq {.compilerproc, pure, inheritable.} = object len, reserved: int @@ -195,14 +198,15 @@ when not defined(JS) and not defined(NimrodVM): NimStringDesc {.compilerproc, final.} = object of TGenericSeq data: array[0..100_000_000, char] NimString = ptr NimStringDesc - + +when not defined(JS) and not defined(NimrodVM): template space(s: PGenericSeq): int {.dirty.} = s.reserved and not seqShallowFlag include "system/hti" type - Byte* = uInt8 ## this is an alias for ``uint8``, that is an unsigned + Byte* = uint8 ## this is an alias for ``uint8``, that is an unsigned ## int 8 bits wide. Natural* = range[0..high(int)] @@ -335,13 +339,13 @@ type TResult* = enum Failure, Success -proc sizeof*[T](x: T): natural {.magic: "SizeOf", noSideEffect.} +proc sizeof*[T](x: T): Natural {.magic: "SizeOf", noSideEffect.} ## returns the size of ``x`` in bytes. Since this is a low-level proc, ## its usage is discouraged - using ``new`` for the most cases suffices ## that one never needs to know ``x``'s size. As a special semantic rule, ## ``x`` may also be a type identifier (``sizeof(int)`` is valid). -proc `<`*[T](x: ordinal[T]): T {.magic: "UnaryLt", noSideEffect.} +proc `<`*[T](x: Ordinal[T]): T {.magic: "UnaryLt", noSideEffect.} ## unary ``<`` that can be used for nice looking excluding ranges: ## ## .. code-block:: nimrod @@ -349,22 +353,22 @@ proc `<`*[T](x: ordinal[T]): T {.magic: "UnaryLt", noSideEffect.} ## ## Semantically this is the same as ``pred``. -proc succ*[T](x: ordinal[T], y = 1): T {.magic: "Succ", noSideEffect.} +proc succ*[T](x: Ordinal[T], y = 1): T {.magic: "Succ", noSideEffect.} ## returns the ``y``-th successor of the value ``x``. ``T`` has to be ## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised ## or a compile time error occurs. -proc pred*[T](x: ordinal[T], y = 1): T {.magic: "Pred", noSideEffect.} +proc pred*[T](x: Ordinal[T], y = 1): T {.magic: "Pred", noSideEffect.} ## returns the ``y``-th predecessor of the value ``x``. ``T`` has to be ## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised ## or a compile time error occurs. -proc inc*[T](x: var ordinal[T], y = 1) {.magic: "Inc", noSideEffect.} +proc inc*[T](x: var Ordinal[T], y = 1) {.magic: "Inc", noSideEffect.} ## increments the ordinal ``x`` by ``y``. If such a value does not ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a ## short notation for: ``x = succ(x, y)``. -proc dec*[T](x: var ordinal[T], y = 1) {.magic: "Dec", noSideEffect.} +proc dec*[T](x: var Ordinal[T], y = 1) {.magic: "Dec", noSideEffect.} ## decrements the ordinal ``x`` by ``y``. If such a value does not ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a ## short notation for: ``x = pred(x, y)``. @@ -374,10 +378,10 @@ proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq", noSideEffect.} ## This is equivalent to ``s = @[]; setlen(s, len)``, but more ## efficient since no reallocation is needed. ## - ## Note that the sequence will be filled with uninitialized entries, which - ## can be a problem for sequences containing strings. After the creation of - ## the sequence you should assign entries to the sequence instead of adding - ## them. Example: + ## Note that the sequence will be filled with zeroed entries, which can be a + ## problem for sequences containing strings since their value will be + ## ``nil``. After the creation of the sequence you should assign entries to + ## the sequence instead of adding them. Example: ## ## .. code-block:: nimrod ## var inputStrings : seq[string] @@ -390,10 +394,10 @@ proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq", noSideEffect.} proc newSeq*[T](len = 0): seq[T] = ## creates a new sequence of type ``seq[T]`` with length ``len``. ## - ## Note that the sequence will be filled with uninitialized entries, which - ## can be a problem for sequences containing strings. After the creation of - ## the sequence you should assign entries to the sequence instead of adding - ## them. Example: + ## Note that the sequence will be filled with zeroed entries, which can be a + ## problem for sequences containing strings since their value will be + ## ``nil``. After the creation of the sequence you should assign entries to + ## the sequence instead of adding them. Example: ## ## .. code-block:: nimrod ## var inputStrings = newSeq[string](3) @@ -418,10 +422,18 @@ proc incl*[T](x: var set[T], y: T) {.magic: "Incl", noSideEffect.} ## includes element ``y`` to the set ``x``. This is the same as ## ``x = x + {y}``, but it might be more efficient. +template incl*[T](s: var set[T], flags: set[T]) = + ## includes the set of flags to the set ``x``. + s = s + flags + proc excl*[T](x: var set[T], y: T) {.magic: "Excl", noSideEffect.} ## excludes element ``y`` to the set ``x``. This is the same as ## ``x = x - {y}``, but it might be more efficient. +template excl*[T](s: var set[T], flags: set[T]) = + ## excludes the set of flags to ``x``. + s = s - flags + proc card*[T](x: set[T]): int {.magic: "Card", noSideEffect.} ## returns the cardinality of the set ``x``, i.e. the number of elements ## in the set. @@ -435,38 +447,38 @@ proc chr*(u: range[0..255]): char {.magic: "Chr", noSideEffect.} # -------------------------------------------------------------------------- # built-in operators -proc ze*(x: int8): int {.magic: "Ze8ToI", noSideEffect.} - ## zero extends a smaller integer type to ``int``. This treats `x` as - ## unsigned. -proc ze*(x: int16): int {.magic: "Ze16ToI", noSideEffect.} - ## zero extends a smaller integer type to ``int``. This treats `x` as - ## unsigned. - -proc ze64*(x: int8): int64 {.magic: "Ze8ToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. -proc ze64*(x: int16): int64 {.magic: "Ze16ToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. - -proc ze64*(x: int32): int64 {.magic: "Ze32ToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. -proc ze64*(x: int): int64 {.magic: "ZeIToI64", noSideEffect.} - ## zero extends a smaller integer type to ``int64``. This treats `x` as - ## unsigned. Does nothing if the size of an ``int`` is the same as ``int64``. - ## (This is the case on 64 bit processors.) - -proc toU8*(x: int): int8 {.magic: "ToU8", noSideEffect.} - ## treats `x` as unsigned and converts it to a byte by taking the last 8 bits - ## from `x`. -proc toU16*(x: int): int16 {.magic: "ToU16", noSideEffect.} - ## treats `x` as unsigned and converts it to an ``int16`` by taking the last - ## 16 bits from `x`. -proc toU32*(x: int64): int32 {.magic: "ToU32", noSideEffect.} - ## treats `x` as unsigned and converts it to an ``int32`` by taking the - ## last 32 bits from `x`. - +when not defined(JS): + proc ze*(x: int8): int {.magic: "Ze8ToI", noSideEffect.} + ## zero extends a smaller integer type to ``int``. This treats `x` as + ## unsigned. + proc ze*(x: int16): int {.magic: "Ze16ToI", noSideEffect.} + ## zero extends a smaller integer type to ``int``. This treats `x` as + ## unsigned. + + proc ze64*(x: int8): int64 {.magic: "Ze8ToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. + proc ze64*(x: int16): int64 {.magic: "Ze16ToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. + + proc ze64*(x: int32): int64 {.magic: "Ze32ToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. + proc ze64*(x: int): int64 {.magic: "ZeIToI64", noSideEffect.} + ## zero extends a smaller integer type to ``int64``. This treats `x` as + ## unsigned. Does nothing if the size of an ``int`` is the same as ``int64``. + ## (This is the case on 64 bit processors.) + + proc toU8*(x: int): int8 {.magic: "ToU8", noSideEffect.} + ## treats `x` as unsigned and converts it to a byte by taking the last 8 bits + ## from `x`. + proc toU16*(x: int): int16 {.magic: "ToU16", noSideEffect.} + ## treats `x` as unsigned and converts it to an ``int16`` by taking the last + ## 16 bits from `x`. + proc toU32*(x: int64): int32 {.magic: "ToU32", noSideEffect.} + ## treats `x` as unsigned and converts it to an ``int32`` by taking the + ## last 32 bits from `x`. # integer calculations: proc `+` *(x: int): int {.magic: "UnaryPlusI", noSideEffect.} @@ -584,46 +596,46 @@ proc `<` *(x, y: int64): bool {.magic: "LtI64", noSideEffect.} ## Returns true iff `x` is less than `y`. type - IntMax32 = bool|int|int8|int16|int32 + IntMax32 = int|int8|int16|int32 proc `+%` *(x, y: IntMax32): IntMax32 {.magic: "AddU", noSideEffect.} -proc `+%` *(x, y: Int64): Int64 {.magic: "AddU", noSideEffect.} +proc `+%` *(x, y: int64): int64 {.magic: "AddU", noSideEffect.} ## treats `x` and `y` as unsigned and adds them. The result is truncated to ## fit into the result. This implements modulo arithmetic. No overflow ## errors are possible. proc `-%` *(x, y: IntMax32): IntMax32 {.magic: "SubU", noSideEffect.} -proc `-%` *(x, y: Int64): Int64 {.magic: "SubU", noSideEffect.} +proc `-%` *(x, y: int64): int64 {.magic: "SubU", noSideEffect.} ## treats `x` and `y` as unsigned and subtracts them. The result is ## truncated to fit into the result. This implements modulo arithmetic. ## No overflow errors are possible. proc `*%` *(x, y: IntMax32): IntMax32 {.magic: "MulU", noSideEffect.} -proc `*%` *(x, y: Int64): Int64 {.magic: "MulU", noSideEffect.} +proc `*%` *(x, y: int64): int64 {.magic: "MulU", noSideEffect.} ## treats `x` and `y` as unsigned and multiplies them. The result is ## truncated to fit into the result. This implements modulo arithmetic. ## No overflow errors are possible. proc `/%` *(x, y: IntMax32): IntMax32 {.magic: "DivU", noSideEffect.} -proc `/%` *(x, y: Int64): Int64 {.magic: "DivU", noSideEffect.} +proc `/%` *(x, y: int64): int64 {.magic: "DivU", noSideEffect.} ## treats `x` and `y` as unsigned and divides them. The result is ## truncated to fit into the result. This implements modulo arithmetic. ## No overflow errors are possible. proc `%%` *(x, y: IntMax32): IntMax32 {.magic: "ModU", noSideEffect.} -proc `%%` *(x, y: Int64): Int64 {.magic: "ModU", noSideEffect.} +proc `%%` *(x, y: int64): int64 {.magic: "ModU", noSideEffect.} ## treats `x` and `y` as unsigned and compute the modulo of `x` and `y`. ## The result is truncated to fit into the result. ## This implements modulo arithmetic. ## No overflow errors are possible. proc `<=%` *(x, y: IntMax32): bool {.magic: "LeU", noSideEffect.} -proc `<=%` *(x, y: Int64): bool {.magic: "LeU64", noSideEffect.} +proc `<=%` *(x, y: int64): bool {.magic: "LeU64", noSideEffect.} ## treats `x` and `y` as unsigned and compares them. ## Returns true iff ``unsigned(x) <= unsigned(y)``. proc `<%` *(x, y: IntMax32): bool {.magic: "LtU", noSideEffect.} -proc `<%` *(x, y: Int64): bool {.magic: "LtU64", noSideEffect.} +proc `<%` *(x, y: int64): bool {.magic: "LtU64", noSideEffect.} ## treats `x` and `y` as unsigned and compares them. ## Returns true iff ``unsigned(x) < unsigned(y)``. @@ -728,10 +740,10 @@ proc contains*[T](s: TSlice[T], value: T): bool {.noSideEffect, inline.} = result = s.a <= value and value <= s.b template `in` * (x, y: expr): expr {.immediate.} = contains(y, x) -template `not_in` * (x, y: expr): expr {.immediate.} = not contains(y, x) +template `notin` * (x, y: expr): expr {.immediate.} = not contains(y, x) proc `is` *[T, S](x: T, y: S): bool {.magic: "Is", noSideEffect.} -template `is_not` *(x, y: expr): expr {.immediate.} = not (x is y) +template `isnot` *(x, y: expr): expr {.immediate.} = not (x is y) proc `of` *[T, S](x: T, y: S): bool {.magic: "Of", noSideEffect.} @@ -923,13 +935,16 @@ proc quit*(errorcode: int = QuitSuccess) {. ## The proc ``quit(QuitSuccess)`` is called implicitly when your nimrod ## program finishes without incident. A raised unhandled exception is ## equivalent to calling ``quit(QuitFailure)``. + ## + ## Note that this is a *runtime* call and using ``quit`` inside a macro won't + ## have any compile time effect. If you need to stop the compiler inside a + ## macro, use the ``error`` or ``fatal`` pragmas. template sysAssert(cond: bool, msg: string) = when defined(useSysAssert): if not cond: echo "[SYSASSERT] ", msg quit 1 - nil include "system/inclrtl" @@ -999,11 +1014,17 @@ type ## platform-dependant in general. when defined(windows): - type clong* {.importc: "long", nodecl.} = int32 - ## This is the same as the type ``long`` in *C*. + type + clong* {.importc: "long", nodecl.} = int32 + ## This is the same as the type ``long`` in *C*. + culong* {.importc: "unsigned long", nodecl.} = uint32 + ## This is the same as the type ``unsigned long`` in *C*. else: - type clong* {.importc: "long", nodecl.} = int - ## This is the same as the type ``long`` in *C*. + type + clong* {.importc: "long", nodecl.} = int + ## This is the same as the type ``long`` in *C*. + culong* {.importc: "unsigned long", nodecl.} = uint + ## This is the same as the type ``unsigned long`` in *C*. type # these work for most platforms: cchar* {.importc: "char", nodecl.} = char @@ -1032,8 +1053,6 @@ type # these work for most platforms: ## This is the same as the type ``unsigned short`` in *C*. cuint* {.importc: "int", nodecl.} = uint32 ## This is the same as the type ``unsigned int`` in *C*. - culong* {.importc: "unsigned long", nodecl.} = uint - ## This is the same as the type ``unsigned long`` in *C*. culonglong* {.importc: "unsigned long long", nodecl.} = uint64 ## This is the same as the type ``unsigned long long`` in *C*. @@ -1042,10 +1061,10 @@ type # these work for most platforms: ## high value is large enough to disable bounds checking in practice. ## Use `cstringArrayToSeq` to convert it into a ``seq[string]``. - PFloat32* = ptr Float32 ## an alias for ``ptr float32`` - PFloat64* = ptr Float64 ## an alias for ``ptr float64`` - PInt64* = ptr Int64 ## an alias for ``ptr int64`` - PInt32* = ptr Int32 ## an alias for ``ptr int32`` + PFloat32* = ptr float32 ## an alias for ``ptr float32`` + PFloat64* = ptr float64 ## an alias for ``ptr float64`` + PInt64* = ptr int64 ## an alias for ``ptr int64`` + PInt32* = ptr int32 ## an alias for ``ptr int32`` proc toFloat*(i: int): float {. magic: "ToFloat", noSideEffect, importc: "toFloat".} @@ -1053,7 +1072,7 @@ proc toFloat*(i: int): float {. ## fails, `EInvalidValue` is raised. However, on most platforms the ## conversion cannot fail. -proc toBiggestFloat*(i: biggestint): biggestfloat {. +proc toBiggestFloat*(i: BiggestInt): BiggestFloat {. magic: "ToBiggestFloat", noSideEffect, importc: "toBiggestFloat".} ## converts an biggestint `i` into a ``biggestfloat``. If the conversion ## fails, `EInvalidValue` is raised. However, on most platforms the @@ -1065,7 +1084,7 @@ proc toInt*(f: float): int {. ## rounds `f` if it does not contain an integer value. If the conversion ## fails (because `f` is infinite for example), `EInvalidValue` is raised. -proc toBiggestInt*(f: biggestfloat): biggestint {. +proc toBiggestInt*(f: BiggestFloat): BiggestInt {. magic: "ToBiggestInt", noSideEffect, importc: "toBiggestInt".} ## converts a biggestfloat `f` into a ``biggestint``. Conversion ## rounds `f` if it does not contain an integer value. If the conversion @@ -1107,19 +1126,19 @@ proc substr*(s: string, first, last: int): string {. ## or `limit`:idx: a string's length. when not defined(nimrodVM): - proc zeroMem*(p: Pointer, size: int) {.importc, noDecl.} + proc zeroMem*(p: pointer, size: int) {.importc, noDecl.} ## overwrites the contents of the memory at ``p`` with the value 0. ## Exactly ``size`` bytes will be overwritten. Like any procedure ## dealing with raw memory this is *unsafe*. - proc copyMem*(dest, source: Pointer, size: int) {. + proc copyMem*(dest, source: pointer, size: int) {. importc: "memcpy", header: "<string.h>".} ## copies the contents from the memory at ``source`` to the memory ## at ``dest``. Exactly ``size`` bytes will be copied. The memory ## regions may not overlap. Like any procedure dealing with raw ## memory this is *unsafe*. - proc moveMem*(dest, source: Pointer, size: int) {. + proc moveMem*(dest, source: pointer, size: int) {. importc: "memmove", header: "<string.h>".} ## copies the contents from the memory at ``source`` to the memory ## at ``dest``. Exactly ``size`` bytes will be copied. The memory @@ -1127,14 +1146,14 @@ when not defined(nimrodVM): ## and is thus somewhat more safe than ``copyMem``. Like any procedure ## dealing with raw memory this is still *unsafe*, though. - proc equalMem*(a, b: Pointer, size: int): bool {. + proc equalMem*(a, b: pointer, size: int): bool {. importc: "equalMem", noDecl, noSideEffect.} ## compares the memory blocks ``a`` and ``b``. ``size`` bytes will ## be compared. If the blocks are equal, true is returned, false ## otherwise. Like any procedure dealing with raw memory this is ## *unsafe*. - when hostOs != "standalone": + when hostOS != "standalone": proc alloc*(size: int): pointer {.noconv, rtl, tags: [].} ## allocates a new memory block with at least ``size`` bytes. The ## block has to be freed with ``realloc(block, 0)`` or @@ -1149,7 +1168,7 @@ when not defined(nimrodVM): ## containing zero, so it is somewhat safer than ``alloc``. ## The allocated memory belongs to its allocating thread! ## Use `allocShared0` to allocate from a shared heap. - proc realloc*(p: Pointer, newsize: int): pointer {.noconv, rtl, tags: [].} + proc realloc*(p: pointer, newsize: int): pointer {.noconv, rtl, tags: [].} ## grows or shrinks a given memory block. If p is **nil** then a new ## memory block is returned. In either way the block has at least ## ``newsize`` bytes. If ``newsize == 0`` and p is not **nil** @@ -1157,7 +1176,7 @@ when not defined(nimrodVM): ## be freed with ``dealloc``. ## The allocated memory belongs to its allocating thread! ## Use `reallocShared` to reallocate from a shared heap. - proc dealloc*(p: Pointer) {.noconv, rtl, tags: [].} + proc dealloc*(p: pointer) {.noconv, rtl, tags: [].} ## frees the memory allocated with ``alloc``, ``alloc0`` or ## ``realloc``. This procedure is dangerous! If one forgets to ## free the memory a leak occurs; if one tries to access freed @@ -1178,13 +1197,13 @@ when not defined(nimrodVM): ## ``reallocShared(block, 0)`` or ``deallocShared(block)``. ## The block is initialized with all bytes ## containing zero, so it is somewhat safer than ``allocShared``. - proc reallocShared*(p: Pointer, newsize: int): pointer {.noconv, rtl.} + proc reallocShared*(p: pointer, newsize: int): pointer {.noconv, rtl.} ## grows or shrinks a given memory block on the heap. If p is **nil** ## then a new memory block is returned. In either way the block has at least ## ``newsize`` bytes. If ``newsize == 0`` and p is not **nil** ## ``reallocShared`` calls ``deallocShared(p)``. In other cases the ## block has to be freed with ``deallocShared``. - proc deallocShared*(p: Pointer) {.noconv, rtl.} + proc deallocShared*(p: pointer) {.noconv, rtl.} ## frees the memory allocated with ``allocShared``, ``allocShared0`` or ## ``reallocShared``. This procedure is dangerous! If one forgets to ## free the memory a leak occurs; if one tries to access freed @@ -1229,7 +1248,7 @@ proc `$` *(x: char): string {.magic: "CharToStr", noSideEffect.} ## The stingify operator for a character argument. Returns `x` ## converted to a string. -proc `$` *(x: Cstring): string {.magic: "CStrToStr", noSideEffect.} +proc `$` *(x: cstring): string {.magic: "CStrToStr", noSideEffect.} ## The stingify operator for a CString argument. Returns `x` ## converted to a string. @@ -1251,13 +1270,13 @@ proc getRefcount*[T](x: seq[T]): int {.importc: "getRefcount", noSideEffect.} ## retrieves the reference count of an heap-allocated object. The ## value is implementation-dependent. -# new constants: + const - inf* {.magic: "Inf".} = 1.0 / 0.0 + Inf* {.magic: "Inf".} = 1.0 / 0.0 ## contains the IEEE floating point value of positive infinity. - neginf* {.magic: "NegInf".} = -inf + NegInf* {.magic: "NegInf".} = -Inf ## contains the IEEE floating point value of negative infinity. - nan* {.magic: "NaN".} = 0.0 / 0.0 + NaN* {.magic: "NaN".} = 0.0 / 0.0 ## contains an IEEE floating point value of *Not A Number*. Note ## that you cannot compare a floating point value to this value ## and expect a reasonable result - use the `classify` procedure @@ -1311,7 +1330,7 @@ iterator `||`*[S, T](a: S, b: T, annotation=""): T {. ## such isn't aware of the parallelism in your code! Be careful! Later ## versions of ``||`` will get proper support by Nimrod's code generator ## and GC. - nil + discard {.push stackTrace:off.} proc min*(x, y: int): int {.magic: "MinI", noSideEffect.} = @@ -1364,7 +1383,7 @@ proc clamp*[T](x, a, b: T): T = if x > b: return b return x -iterator items*[T](a: openarray[T]): T {.inline.} = +iterator items*[T](a: openArray[T]): T {.inline.} = ## iterates over each item of `a`. var i = 0 while i < len(a): @@ -1417,7 +1436,7 @@ iterator items*(E: typedesc[enum]): E = for v in low(E)..high(E): yield v -iterator pairs*[T](a: openarray[T]): tuple[key: int, val: T] {.inline.} = +iterator pairs*[T](a: openArray[T]): tuple[key: int, val: T] {.inline.} = ## iterates over each item of `a`. Yields ``(index, a[index])`` pairs. var i = 0 while i < len(a): @@ -1943,30 +1962,28 @@ when not defined(JS): #and not defined(NimrodVM): ## The standard output stream. stderr* {.importc: "stderr", header: "<stdio.h>".}: TFile ## The standard error stream. - ## - ## Note: In my opinion, this should not be used -- the concept of a - ## separate error stream is a design flaw of UNIX. A separate *message - ## stream* is a good idea, but since it is named ``stderr`` there are few - ## programs out there that distinguish properly between ``stdout`` and - ## ``stderr``. So, that's what you get if you don't name your variables - ## appropriately. It also annoys people if redirection - ## via ``>output.txt`` does not work because the program writes - ## to ``stderr``. - - proc Open*(f: var TFile, filename: string, - mode: TFileMode = fmRead, bufSize: int = -1): Bool {.tags: [].} + + when defined(useStdoutAsStdmsg): + template stdmsg*: TFile = stdout + else: + template stdmsg*: TFile = stderr + ## Template which expands to either stdout or stderr depending on + ## `useStdoutAsStdmsg` compile-time switch. + + proc open*(f: var TFile, filename: string, + mode: TFileMode = fmRead, bufSize: int = -1): bool {.tags: [].} ## Opens a file named `filename` with given `mode`. ## ## Default mode is readonly. Returns true iff the file could be opened. ## This throws no exception if the file could not be opened. - proc Open*(f: var TFile, filehandle: TFileHandle, - mode: TFileMode = fmRead): Bool {.tags: [].} + proc open*(f: var TFile, filehandle: TFileHandle, + mode: TFileMode = fmRead): bool {.tags: [].} ## Creates a ``TFile`` from a `filehandle` with given `mode`. ## ## Default mode is readonly. Returns true iff the file could be opened. - proc Open*(filename: string, + proc open*(filename: string, mode: TFileMode = fmRead, bufSize: int = -1): TFile = ## Opens a file named `filename` with given `mode`. ## @@ -1983,16 +2000,16 @@ when not defined(JS): #and not defined(NimrodVM): ## ## Default mode is readonly. Returns true iff the file could be reopened. - proc Close*(f: TFile) {.importc: "fclose", header: "<stdio.h>", tags: [].} + proc close*(f: TFile) {.importc: "fclose", header: "<stdio.h>", tags: [].} ## Closes the file. - proc EndOfFile*(f: TFile): Bool {.tags: [].} + proc endOfFile*(f: TFile): bool {.tags: [].} ## Returns true iff `f` is at the end. proc readChar*(f: TFile): char {. importc: "fgetc", header: "<stdio.h>", tags: [FReadIO].} ## Reads a single character from the stream `f`. - proc FlushFile*(f: TFile) {. + proc flushFile*(f: TFile) {. importc: "fflush", header: "<stdio.h>", tags: [FWriteIO].} ## Flushes `f`'s buffer. @@ -2012,10 +2029,10 @@ when not defined(JS): #and not defined(NimrodVM): proc write*(f: TFile, r: float32) {.tags: [FWriteIO].} proc write*(f: TFile, i: int) {.tags: [FWriteIO].} - proc write*(f: TFile, i: biggestInt) {.tags: [FWriteIO].} - proc write*(f: TFile, r: biggestFloat) {.tags: [FWriteIO].} + proc write*(f: TFile, i: BiggestInt) {.tags: [FWriteIO].} + proc write*(f: TFile, r: BiggestFloat) {.tags: [FWriteIO].} proc write*(f: TFile, s: string) {.tags: [FWriteIO].} - proc write*(f: TFile, b: Bool) {.tags: [FWriteIO].} + proc write*(f: TFile, b: bool) {.tags: [FWriteIO].} proc write*(f: TFile, c: char) {.tags: [FWriteIO].} proc write*(f: TFile, c: cstring) {.tags: [FWriteIO].} proc write*(f: TFile, a: varargs[string, `$`]) {.tags: [FWriteIO].} @@ -2041,13 +2058,13 @@ when not defined(JS): #and not defined(NimrodVM): proc getFileSize*(f: TFile): int64 {.tags: [FReadIO].} ## retrieves the file size (in bytes) of `f`. - proc ReadBytes*(f: TFile, a: var openarray[int8], start, len: int): int {. + proc readBytes*(f: TFile, a: var openArray[int8], start, len: int): int {. tags: [FReadIO].} ## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns ## the actual number of bytes that have been read which may be less than ## `len` (if not as many bytes are remaining), but not greater. - proc ReadChars*(f: TFile, a: var openarray[char], start, len: int): int {. + proc readChars*(f: TFile, a: var openArray[char], start, len: int): int {. tags: [FReadIO].} ## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns ## the actual number of bytes that have been read which may be less than @@ -2058,13 +2075,13 @@ when not defined(JS): #and not defined(NimrodVM): ## the actual number of bytes that have been read which may be less than ## `len` (if not as many bytes are remaining), but not greater. - proc writeBytes*(f: TFile, a: openarray[int8], start, len: int): int {. + proc writeBytes*(f: TFile, a: openArray[int8], start, len: int): int {. tags: [FWriteIO].} ## writes the bytes of ``a[start..start+len-1]`` to the file `f`. Returns ## the number of actual written bytes, which may be less than `len` in case ## of an error. - proc writeChars*(f: tFile, a: openarray[char], start, len: int): int {. + proc writeChars*(f: TFile, a: openArray[char], start, len: int): int {. tags: [FWriteIO].} ## writes the bytes of ``a[start..start+len-1]`` to the file `f`. Returns ## the number of actual written bytes, which may be less than `len` in case @@ -2186,7 +2203,7 @@ when not defined(JS): #and not defined(NimrodVM): const GenericSeqSize = (2 * sizeof(int)) - proc getDiscriminant(aa: Pointer, n: ptr TNimNode): int = + proc getDiscriminant(aa: pointer, n: ptr TNimNode): int = sysAssert(n.kind == nkCase, "getDiscriminant: node != nkCase") var d: int var a = cast[TAddress](aa) @@ -2197,7 +2214,7 @@ when not defined(JS): #and not defined(NimrodVM): else: sysAssert(false, "getDiscriminant: invalid n.typ.size") return d - proc selectBranch(aa: Pointer, n: ptr TNimNode): ptr TNimNode = + proc selectBranch(aa: pointer, n: ptr TNimNode): ptr TNimNode = var discr = getDiscriminant(aa, n) if discr <% n.len: result = n.sons[discr] @@ -2219,8 +2236,19 @@ when not defined(JS): #and not defined(NimrodVM): when hostOS != "standalone": iterator lines*(filename: string): TaintedString {.tags: [FReadIO].} = - ## Iterate over any line in the file named `filename`. - ## If the file does not exist `EIO` is raised. + ## Iterates over any line in the file named `filename`. + ## + ## If the file does not exist `EIO` is raised. The trailing newline + ## character(s) are removed from the iterated lines. Example: + ## + ## .. code-block:: nimrod + ## import strutils + ## + ## proc transformLetters(filename: string) = + ## var buffer = "" + ## for line in filename.lines: + ## buffer.add(line.replace("a", "0") & '\x0A') + ## writeFile(filename, buffer) var f = open(filename) var res = TaintedString(newStringOfCap(80)) while f.readLine(res): yield res @@ -2228,6 +2256,17 @@ when not defined(JS): #and not defined(NimrodVM): iterator lines*(f: TFile): TaintedString {.tags: [FReadIO].} = ## Iterate over any line in the file `f`. + ## + ## The trailing newline character(s) are removed from the iterated lines. + ## Example: + ## + ## .. code-block:: nimrod + ## proc countZeros(filename: TFile): tuple[lines, zeros: int] = + ## for line in filename.lines: + ## for letter in line: + ## if letter == '0': + ## result.zeros += 1 + ## result.lines += 1 var res = TaintedString(newStringOfCap(80)) while f.readLine(res): yield res @@ -2294,29 +2333,29 @@ when not defined(JS): #and not defined(NimrodVM): elif defined(JS): # Stubs: - proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} = nil - - proc GC_disable() = nil - proc GC_enable() = nil - proc GC_fullCollect() = nil - proc GC_setStrategy(strategy: TGC_Strategy) = nil - proc GC_enableMarkAndSweep() = nil - proc GC_disableMarkAndSweep() = nil + proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} = discard + + proc GC_disable() = discard + proc GC_enable() = discard + proc GC_fullCollect() = discard + proc GC_setStrategy(strategy: TGC_Strategy) = discard + proc GC_enableMarkAndSweep() = discard + proc GC_disableMarkAndSweep() = discard proc GC_getStatistics(): string = return "" proc getOccupiedMem(): int = return -1 proc getFreeMem(): int = return -1 proc getTotalMem(): int = return -1 - proc dealloc(p: pointer) = nil - proc alloc(size: int): pointer = nil - proc alloc0(size: int): pointer = nil - proc realloc(p: Pointer, newsize: int): pointer = nil + proc dealloc(p: pointer) = discard + proc alloc(size: int): pointer = discard + proc alloc0(size: int): pointer = discard + proc realloc(p: Pointer, newsize: int): pointer = discard - proc allocShared(size: int): pointer = nil - proc allocShared0(size: int): pointer = nil - proc deallocShared(p: pointer) = nil - proc reallocShared(p: pointer, newsize: int): pointer = nil + proc allocShared(size: int): pointer = discard + proc allocShared0(size: int): pointer = discard + proc deallocShared(p: pointer) = discard + proc reallocShared(p: pointer, newsize: int): pointer = discard when defined(JS): include "system/jssys" @@ -2451,11 +2490,11 @@ proc staticRead*(filename: string): string {.magic: "Slurp".} ## ``slurp`` is an alias for ``staticRead``. proc gorge*(command: string, input = ""): string {. - magic: "StaticExec".} = nil + magic: "StaticExec".} = discard ## This is an alias for ``staticExec``. proc staticExec*(command: string, input = ""): string {. - magic: "StaticExec".} = nil + magic: "StaticExec".} = discard ## Executes an external process at compile-time. ## if `input` is not an empty string, it will be passed as a standard input ## to the executed program. @@ -2522,7 +2561,7 @@ proc instantiationInfo*(index = -1, fullPaths = false): tuple[ ## $pos.line, astToStr(code)] ## assert false, "A test expecting failure succeeded?" ## except exception: - ## nil + ## discard ## ## proc tester(pos: int): int = ## let @@ -2541,7 +2580,7 @@ proc raiseAssert*(msg: string) {.noinline.} = sysFatal(EAssertionFailed, msg) when true: - proc hiddenRaiseAssert(msg: string) {.raises: [], tags: [].} = + proc failedAssertImpl*(msg: string) {.raises: [], tags: [].} = # trick the compiler to not list ``EAssertionFailed`` when called # by ``assert``. type THide = proc (msg: string) {.noinline, raises: [], noSideEffect, @@ -2554,11 +2593,11 @@ template assert*(cond: bool, msg = "") = ## raises an ``EAssertionFailure`` exception. However, the compiler may ## not generate any code at all for ``assert`` if it is advised to do so. ## Use ``assert`` for debugging purposes only. - bind instantiationInfo, hiddenRaiseAssert + bind instantiationInfo + mixin failedAssertImpl when compileOption("assertions"): {.line.}: - if not cond: - hiddenRaiseAssert(astToStr(cond) & ' ' & msg) + if not cond: failedAssertImpl(astToStr(cond) & ' ' & msg) template doAssert*(cond: bool, msg = "") = ## same as `assert` but is always turned on and not affected by the @@ -2571,9 +2610,9 @@ template doAssert*(cond: bool, msg = "") = when not defined(nimhygiene): {.pragma: inject.} -template onFailedAssert*(msg: expr, code: stmt): stmt = - ## Sets an assertion failure handler that will intercept any assert statements - ## following `onFailedAssert` in the current lexical scope. +template onFailedAssert*(msg: expr, code: stmt): stmt {.dirty, immediate.} = + ## Sets an assertion failure handler that will intercept any assert + ## statements following `onFailedAssert` in the current lexical scope. ## Can be defined multiple times in a single function. ## ## .. code-block:: nimrod @@ -2590,8 +2629,8 @@ template onFailedAssert*(msg: expr, code: stmt): stmt = ## ## assert(...) ## - template raiseAssert(msgIMPL: string): stmt = - let msg {.inject.} = msgIMPL + template failedAssertImpl(msgIMPL: string): stmt {.dirty, immediate.} = + let msg = msgIMPL code proc shallow*[T](s: var seq[T]) {.noSideEffect, inline.} = @@ -2615,12 +2654,13 @@ type PNimrodNode* {.magic: "PNimrodNode".} = ref TNimrodNode ## represents a Nimrod AST node. Macros operate on this type. -template eval*(blk: stmt): stmt = - ## executes a block of code at compile time just as if it was a macro - ## optionally, the block can return an AST tree that will replace the - ## eval expression - macro payload: stmt {.gensym.} = blk - payload() +when false: + template eval*(blk: stmt): stmt = + ## executes a block of code at compile time just as if it was a macro + ## optionally, the block can return an AST tree that will replace the + ## eval expression + macro payload: stmt {.gensym.} = blk + payload() when hostOS != "standalone": proc insert*(x: var string, item: string, i = 0) {.noSideEffect.} = @@ -2636,7 +2676,7 @@ when hostOS != "standalone": x[j+i] = item[j] inc(j) -proc compiles*(x: expr): bool {.magic: "Compiles", noSideEffect.} = +proc compiles*(x): bool {.magic: "Compiles", noSideEffect.} = ## Special compile-time procedure that checks whether `x` can be compiled ## without any semantic error. ## This can be used to check whether a type supports some operation: @@ -2644,7 +2684,7 @@ proc compiles*(x: expr): bool {.magic: "Compiles", noSideEffect.} = ## .. code-block:: Nimrod ## when not compiles(3 + 4): ## echo "'+' for integers is available" - nil + discard when defined(initDebugger): initDebugger() @@ -2668,5 +2708,30 @@ proc locals*(): TObject {.magic: "Locals", noSideEffect.} = ## in the current scope. This is quite fast as it does not rely ## on any debug or runtime information. Note that in constrast to what ## the official signature says, the return type is not ``TObject`` but a - ## tuple of a structure that depends on the current scope. - nil + ## tuple of a structure that depends on the current scope. Example: + ## + ## .. code-block:: nimrod + ## proc testLocals() = + ## var + ## a = "something" + ## b = 4 + ## c = locals() + ## d = "super!" + ## + ## b = 1 + ## for name, value in fieldPairs(c): + ## echo "name ", name, " with value ", value + ## echo "B is ", b + ## # -> name a with value something + ## # -> name b with value 4 + ## # -> B is 1 + discard + +when not defined(booting): + type + semistatic*[T] = static[T] | T + # indicates a param of proc specialized for each static value, + # but also accepting run-time values + + template isStatic*(x): expr = compiles(static(x)) + # checks whether `x` is a value known at compile-time diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index 744c26d36..954485eb4 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -59,15 +59,16 @@ elif defined(windows): MEM_DECOMMIT = 0x4000 MEM_RELEASE = 0x8000 - proc VirtualAlloc(lpAddress: pointer, dwSize: int, flAllocationType, + proc virtualAlloc(lpAddress: pointer, dwSize: int, flAllocationType, flProtect: int32): pointer {. - header: "<windows.h>", stdcall.} + header: "<windows.h>", stdcall, importc: "VirtualAlloc".} - proc VirtualFree(lpAddress: pointer, dwSize: int, - dwFreeType: int32) {.header: "<windows.h>", stdcall.} + proc virtualFree(lpAddress: pointer, dwSize: int, + dwFreeType: int32) {.header: "<windows.h>", stdcall, + importc: "VirtualFree".} proc osAllocPages(size: int): pointer {.inline.} = - result = VirtualAlloc(nil, size, MEM_RESERVE or MEM_COMMIT, + result = virtualAlloc(nil, size, MEM_RESERVE or MEM_COMMIT, PAGE_READWRITE) if result == nil: raiseOutOfMem() @@ -78,7 +79,7 @@ elif defined(windows): # Windows :-(. We have to live with MEM_DECOMMIT instead. # Well that used to be the case but MEM_DECOMMIT fragments the address # space heavily, so we now treat Windows as a strange unmap target. - when reallyOsDealloc: VirtualFree(p, 0, MEM_RELEASE) + when reallyOsDealloc: virtualFree(p, 0, MEM_RELEASE) #VirtualFree(p, size, MEM_DECOMMIT) else: @@ -108,7 +109,7 @@ type data: TTrunkBuckets type - TAlignType = biggestFloat + TAlignType = BiggestFloat TFreeCell {.final, pure.} = object next: ptr TFreeCell # next free cell in chunk (overlaid with refcount) zeroField: int # 0 means cell is not used (overlaid with typ field) @@ -251,36 +252,36 @@ proc llDeallocAll(a: var TMemRegion) = osDeallocPages(it, PageSize) it = next -proc IntSetGet(t: TIntSet, key: int): PTrunk = +proc intSetGet(t: TIntSet, key: int): PTrunk = var it = t.data[key and high(t.data)] while it != nil: if it.key == key: return it it = it.next result = nil -proc IntSetPut(a: var TMemRegion, t: var TIntSet, key: int): PTrunk = - result = IntSetGet(t, key) +proc intSetPut(a: var TMemRegion, t: var TIntSet, key: int): PTrunk = + result = intSetGet(t, key) if result == nil: result = cast[PTrunk](llAlloc(a, sizeof(result[]))) result.next = t.data[key and high(t.data)] t.data[key and high(t.data)] = result result.key = key -proc Contains(s: TIntSet, key: int): bool = - var t = IntSetGet(s, key shr TrunkShift) +proc contains(s: TIntSet, key: int): bool = + var t = intSetGet(s, key shr TrunkShift) if t != nil: var u = key and TrunkMask result = (t.bits[u shr IntShift] and (1 shl (u and IntMask))) != 0 else: result = false -proc Incl(a: var TMemRegion, s: var TIntSet, key: int) = - var t = IntSetPut(a, s, key shr TrunkShift) +proc incl(a: var TMemRegion, s: var TIntSet, key: int) = + var t = intSetPut(a, s, key shr TrunkShift) var u = key and TrunkMask t.bits[u shr IntShift] = t.bits[u shr IntShift] or (1 shl (u and IntMask)) -proc Excl(s: var TIntSet, key: int) = - var t = IntSetGet(s, key shr TrunkShift) +proc excl(s: var TIntSet, key: int) = + var t = intSetGet(s, key shr TrunkShift) if t != nil: var u = key and TrunkMask t.bits[u shr IntShift] = t.bits[u shr IntShift] and not @@ -387,7 +388,7 @@ proc freeOsChunks(a: var TMemRegion, p: pointer, size: int) = #c_fprintf(c_stdout, "[Alloc] back to OS: %ld\n", size) proc isAccessible(a: TMemRegion, p: pointer): bool {.inline.} = - result = Contains(a.chunkStarts, pageIndex(p)) + result = contains(a.chunkStarts, pageIndex(p)) proc contains[T](list, x: T): bool = var it = list @@ -403,7 +404,7 @@ proc writeFreeList(a: TMemRegion) = it, it.next, it.prev) it = it.next -proc ListAdd[T](head: var T, c: T) {.inline.} = +proc listAdd[T](head: var T, c: T) {.inline.} = sysAssert(c notin head, "listAdd 1") sysAssert c.prev == nil, "listAdd 2" sysAssert c.next == nil, "listAdd 3" @@ -413,7 +414,7 @@ proc ListAdd[T](head: var T, c: T) {.inline.} = head.prev = c head = c -proc ListRemove[T](head: var T, c: T) {.inline.} = +proc listRemove[T](head: var T, c: T) {.inline.} = sysAssert(c in head, "listRemove") if c == head: head = c.next @@ -443,7 +444,7 @@ proc freeBigChunk(a: var TMemRegion, c: PBigChunk) = if isAccessible(a, ri) and chunkUnused(ri): sysAssert(not isSmallChunk(ri), "freeBigChunk 3") if not isSmallChunk(ri): - ListRemove(a.freeChunksList, cast[PBigChunk](ri)) + listRemove(a.freeChunksList, cast[PBigChunk](ri)) inc(c.size, ri.size) excl(a.chunkStarts, pageIndex(ri)) when coalescLeft: @@ -453,7 +454,7 @@ proc freeBigChunk(a: var TMemRegion, c: PBigChunk) = if isAccessible(a, le) and chunkUnused(le): sysAssert(not isSmallChunk(le), "freeBigChunk 5") if not isSmallChunk(le): - ListRemove(a.freeChunksList, cast[PBigChunk](le)) + listRemove(a.freeChunksList, cast[PBigChunk](le)) inc(le.size, c.size) excl(a.chunkStarts, pageIndex(c)) c = cast[PBigChunk](le) @@ -461,7 +462,7 @@ proc freeBigChunk(a: var TMemRegion, c: PBigChunk) = if c.size < ChunkOsReturn or weirdUnmap: incl(a, a.chunkStarts, pageIndex(c)) updatePrevSize(a, c, c.size) - ListAdd(a.freeChunksList, c) + listAdd(a.freeChunksList, c) c.used = false else: freeOsChunks(a, c, c.size) @@ -477,7 +478,7 @@ proc splitChunk(a: var TMemRegion, c: PBigChunk, size: int) = updatePrevSize(a, c, rest.size) c.size = size incl(a, a.chunkStarts, pageIndex(rest)) - ListAdd(a.freeChunksList, rest) + listAdd(a.freeChunksList, rest) proc getBigChunk(a: var TMemRegion, size: int): PBigChunk = # use first fit for now: @@ -488,10 +489,10 @@ proc getBigChunk(a: var TMemRegion, size: int): PBigChunk = while result != nil: sysAssert chunkUnused(result), "getBigChunk 3" if result.size == size: - ListRemove(a.freeChunksList, result) + listRemove(a.freeChunksList, result) break search elif result.size > size: - ListRemove(a.freeChunksList, result) + listRemove(a.freeChunksList, result) splitChunk(a, result, size) break search result = result.next @@ -520,11 +521,18 @@ proc allocInv(a: TMemRegion): bool = for s in low(a.freeSmallChunks)..high(a.freeSmallChunks): var c = a.freeSmallChunks[s] while c != nil: - if c.next == c: return false - if c.size != s * MemAlign: return false + if c.next == c: + echo "[SYSASSERT] c.next == c" + return false + if c.size != s * MemAlign: + echo "[SYSASSERT] c.size != s * MemAlign" + return false var it = c.freeList while it != nil: - if it.zeroField != 0: return false + if it.zeroField != 0: + echo "[SYSASSERT] it.zeroField != 0" + c_printf("%ld %p\n", it.zeroField, it) + return false it = it.next c = c.next result = true @@ -549,7 +557,7 @@ proc rawAlloc(a: var TMemRegion, requestedSize: int): pointer = c.free = SmallChunkSize - smallChunkOverhead() - size c.next = nil c.prev = nil - ListAdd(a.freeSmallChunks[s], c) + listAdd(a.freeSmallChunks[s], c) result = addr(c.data) sysAssert((cast[TAddress](result) and (MemAlign-1)) == 0, "rawAlloc 4") else: @@ -573,7 +581,7 @@ proc rawAlloc(a: var TMemRegion, requestedSize: int): pointer = sysAssert(allocInv(a), "rawAlloc: before c.free < size") if c.free < size: sysAssert(allocInv(a), "rawAlloc: before listRemove test") - ListRemove(a.freeSmallChunks[s], c) + listRemove(a.freeSmallChunks[s], c) sysAssert(allocInv(a), "rawAlloc: end listRemove test") sysAssert(((cast[TAddress](result) and PageMask) - smallChunkOverhead()) %% size == 0, "rawAlloc 21") @@ -591,6 +599,7 @@ proc rawAlloc(a: var TMemRegion, requestedSize: int): pointer = add(a, a.root, cast[TAddress](result), cast[TAddress](result)+%size) sysAssert(isAccessible(a, result), "rawAlloc 14") sysAssert(allocInv(a), "rawAlloc: end") + when logAlloc: cprintf("rawAlloc: %ld %p\n", requestedSize, result) proc rawAlloc0(a: var TMemRegion, requestedSize: int): pointer = result = rawAlloc(a, requestedSize) @@ -619,12 +628,12 @@ proc rawDealloc(a: var TMemRegion, p: pointer) = # check if it is not in the freeSmallChunks[s] list: if c.free < s: # add it to the freeSmallChunks[s] array: - ListAdd(a.freeSmallChunks[s div memAlign], c) + listAdd(a.freeSmallChunks[s div MemAlign], c) inc(c.free, s) else: inc(c.free, s) if c.free == SmallChunkSize-smallChunkOverhead(): - ListRemove(a.freeSmallChunks[s div memAlign], c) + listRemove(a.freeSmallChunks[s div MemAlign], c) c.size = SmallChunkSize freeBigChunk(a, cast[PBigChunk](c)) sysAssert(((cast[TAddress](p) and PageMask) - smallChunkOverhead()) %% @@ -638,6 +647,7 @@ proc rawDealloc(a: var TMemRegion, p: pointer) = del(a, a.root, cast[int](addr(c.data))) freeBigChunk(a, c) sysAssert(allocInv(a), "rawDealloc: end") + when logAlloc: cprintf("rawDealloc: %p\n", p) proc isAllocatedPtr(a: TMemRegion, p: pointer): bool = if isAccessible(a, p): @@ -729,7 +739,7 @@ proc realloc(allocator: var TMemRegion, p: pointer, newsize: int): pointer = proc deallocOsPages(a: var TMemRegion) = # we free every 'ordinarily' allocated page by iterating over the page bits: for p in elements(a.chunkStarts): - var page = cast[PChunk](p shl pageShift) + var page = cast[PChunk](p shl PageShift) when not weirdUnmap: var size = if page.size < PageSize: PageSize else: page.size osDeallocPages(page, size) @@ -750,8 +760,8 @@ proc getOccupiedMem(a: TMemRegion): int {.inline.} = # ---------------------- thread memory region ------------------------------- -template InstantiateForRegion(allocator: expr) = - when false: +template instantiateForRegion(allocator: expr) = + when defined(fulldebug): proc interiorAllocatedPtr*(p: pointer): pointer = result = interiorAllocatedPtr(allocator, p) @@ -792,13 +802,13 @@ template InstantiateForRegion(allocator: expr) = when hasThreadSupport: var sharedHeap: TMemRegion var heapLock: TSysLock - InitSysLock(HeapLock) + initSysLock(heapLock) proc allocShared(size: int): pointer = when hasThreadSupport: - AcquireSys(HeapLock) + acquireSys(heapLock) result = alloc(sharedHeap, size) - ReleaseSys(HeapLock) + releaseSys(heapLock) else: result = alloc(size) @@ -808,17 +818,17 @@ template InstantiateForRegion(allocator: expr) = proc deallocShared(p: pointer) = when hasThreadSupport: - AcquireSys(HeapLock) + acquireSys(heapLock) dealloc(sharedHeap, p) - ReleaseSys(HeapLock) + releaseSys(heapLock) else: dealloc(p) proc reallocShared(p: pointer, newsize: int): pointer = when hasThreadSupport: - AcquireSys(HeapLock) + acquireSys(heapLock) result = realloc(sharedHeap, p, newsize) - ReleaseSys(HeapLock) + releaseSys(heapLock) else: result = realloc(p, newsize) diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 13e8496d2..2d33965e3 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -13,12 +13,12 @@ {.push hints:off} -proc c_strcmp(a, b: CString): cint {.header: "<string.h>", +proc c_strcmp(a, b: cstring): cint {.header: "<string.h>", noSideEffect, importc: "strcmp".} -proc c_memcmp(a, b: CString, size: int): cint {.header: "<string.h>", +proc c_memcmp(a, b: cstring, size: int): cint {.header: "<string.h>", noSideEffect, importc: "memcmp".} -proc c_memcpy(a, b: CString, size: int) {.header: "<string.h>", importc: "memcpy".} -proc c_strlen(a: CString): int {.header: "<string.h>", +proc c_memcpy(a, b: cstring, size: int) {.header: "<string.h>", importc: "memcpy".} +proc c_strlen(a: cstring): int {.header: "<string.h>", noSideEffect, importc: "strlen".} proc c_memset(p: pointer, value: cint, size: int) {. header: "<string.h>", importc: "memset".} @@ -28,8 +28,8 @@ type final, incompleteStruct.} = object C_BinaryFile {.importc: "FILE", header: "<stdio.h>", final, incompleteStruct.} = object - C_TextFileStar = ptr CTextFile - C_BinaryFileStar = ptr CBinaryFile + C_TextFileStar = ptr C_TextFile + C_BinaryFileStar = ptr C_BinaryFile C_JmpBuf {.importc: "jmp_buf", header: "<setjmp.h>".} = object @@ -40,21 +40,40 @@ var # constants faked as variables: when not defined(SIGINT): - var - SIGINT {.importc: "SIGINT", nodecl.}: cint - SIGSEGV {.importc: "SIGSEGV", nodecl.}: cint - SIGABRT {.importc: "SIGABRT", nodecl.}: cint - SIGFPE {.importc: "SIGFPE", nodecl.}: cint - SIGILL {.importc: "SIGILL", nodecl.}: cint + when NoFakeVars: + when defined(windows): + const + SIGABRT = cint(22) + SIGFPE = cint(8) + SIGILL = cint(4) + SIGINT = cint(2) + SIGSEGV = cint(11) + SIGTERM = cint(15) + elif defined(macosx) or defined(linux): + const + SIGABRT = cint(6) + SIGFPE = cint(8) + SIGILL = cint(4) + SIGINT = cint(2) + SIGSEGV = cint(11) + SIGTERM = cint(15) + else: + {.error: "SIGABRT not ported to your platform".} + else: + var + SIGINT {.importc: "SIGINT", nodecl.}: cint + SIGSEGV {.importc: "SIGSEGV", nodecl.}: cint + SIGABRT {.importc: "SIGABRT", nodecl.}: cint + SIGFPE {.importc: "SIGFPE", nodecl.}: cint + SIGILL {.importc: "SIGILL", nodecl.}: cint when defined(macosx): - var - SIGBUS {.importc: "SIGBUS", nodecl.}: cint - # hopefully this does not lead to new bugs + when NoFakeVars: + const SIGBUS = cint(10) + else: + var SIGBUS {.importc: "SIGBUS", nodecl.}: cint else: - var - SIGBUS {.importc: "SIGSEGV", nodecl.}: cint - # only Mac OS X has this shit + template SIGBUS: expr = SIGSEGV proc c_longjmp(jmpb: C_JmpBuf, retval: cint) {. header: "<setjmp.h>", importc: "longjmp".} @@ -73,27 +92,27 @@ proc c_fgetc(stream: C_TextFileStar): int {.importc: "fgetc", header: "<stdio.h>".} proc c_ungetc(c: int, f: C_TextFileStar) {.importc: "ungetc", header: "<stdio.h>".} -proc c_putc(c: Char, stream: C_TextFileStar) {.importc: "putc", +proc c_putc(c: char, stream: C_TextFileStar) {.importc: "putc", header: "<stdio.h>".} -proc c_fprintf(f: C_TextFileStar, frmt: CString) {. +proc c_fprintf(f: C_TextFileStar, frmt: cstring) {. importc: "fprintf", header: "<stdio.h>", varargs.} -proc c_printf(frmt: CString) {. +proc c_printf(frmt: cstring) {. importc: "printf", header: "<stdio.h>", varargs.} proc c_fopen(filename, mode: cstring): C_TextFileStar {. importc: "fopen", header: "<stdio.h>".} proc c_fclose(f: C_TextFileStar) {.importc: "fclose", header: "<stdio.h>".} -proc c_sprintf(buf, frmt: CString) {.header: "<stdio.h>", +proc c_sprintf(buf, frmt: cstring) {.header: "<stdio.h>", importc: "sprintf", varargs, noSideEffect.} # we use it only in a way that cannot lead to security issues -proc c_fread(buf: Pointer, size, n: int, f: C_BinaryFileStar): int {. +proc c_fread(buf: pointer, size, n: int, f: C_BinaryFileStar): int {. importc: "fread", header: "<stdio.h>".} proc c_fseek(f: C_BinaryFileStar, offset: clong, whence: int): int {. importc: "fseek", header: "<stdio.h>".} -proc c_fwrite(buf: Pointer, size, n: int, f: C_BinaryFileStar): int {. +proc c_fwrite(buf: pointer, size, n: int, f: C_BinaryFileStar): int {. importc: "fwrite", header: "<stdio.h>".} proc c_exit(errorcode: cint) {.importc: "exit", header: "<stdlib.h>".} @@ -111,16 +130,22 @@ proc c_realloc(p: pointer, newsize: int): pointer {. when hostOS != "standalone": when not defined(errno): - var errno {.importc, header: "<errno.h>".}: cint ## error variable + when defined(NimrodVM): + var vmErrnoWrapper {.importc.}: ptr cint + template errno: expr = + bind vmErrnoWrapper + vmErrnoWrapper[] + else: + var errno {.importc, header: "<errno.h>".}: cint ## error variable proc strerror(errnum: cint): cstring {.importc, header: "<string.h>".} -proc c_remove(filename: CString): cint {. +proc c_remove(filename: cstring): cint {. importc: "remove", header: "<stdio.h>".} -proc c_rename(oldname, newname: CString): cint {. +proc c_rename(oldname, newname: cstring): cint {. importc: "rename", header: "<stdio.h>".} -proc c_system(cmd: CString): cint {.importc: "system", header: "<stdlib.h>".} -proc c_getenv(env: CString): CString {.importc: "getenv", header: "<stdlib.h>".} -proc c_putenv(env: CString): cint {.importc: "putenv", header: "<stdlib.h>".} +proc c_system(cmd: cstring): cint {.importc: "system", header: "<stdlib.h>".} +proc c_getenv(env: cstring): cstring {.importc: "getenv", header: "<stdlib.h>".} +proc c_putenv(env: cstring): cint {.importc: "putenv", header: "<stdlib.h>".} {.pop} diff --git a/lib/system/assign.nim b/lib/system/assign.nim index 3b43abcd1..bed8820be 100644 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -7,10 +7,10 @@ # distribution, for details about the copyright. # -proc genericResetAux(dest: Pointer, n: ptr TNimNode) +proc genericResetAux(dest: pointer, n: ptr TNimNode) -proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) -proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) = +proc genericAssignAux(dest, src: pointer, mt: PNimType, shallow: bool) +proc genericAssignAux(dest, src: pointer, n: ptr TNimNode, shallow: bool) = var d = cast[TAddress](dest) s = cast[TAddress](src) @@ -37,37 +37,37 @@ proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) = # echo "ugh memory corruption! ", n.kind # quit 1 -proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) = +proc genericAssignAux(dest, src: pointer, mt: PNimType, shallow: bool) = var d = cast[TAddress](dest) s = cast[TAddress](src) sysAssert(mt != nil, "genericAssignAux 2") - case mt.Kind + case mt.kind of tyString: - var x = cast[ppointer](dest) - var s2 = cast[ppointer](s)[] + var x = cast[PPointer](dest) + var s2 = cast[PPointer](s)[] if s2 == nil or shallow or ( cast[PGenericSeq](s2).reserved and seqShallowFlag) != 0: unsureAsgnRef(x, s2) else: unsureAsgnRef(x, copyString(cast[NimString](s2))) of tySequence: - var s2 = cast[ppointer](src)[] + var s2 = cast[PPointer](src)[] var seq = cast[PGenericSeq](s2) - var x = cast[ppointer](dest) + var x = cast[PPointer](dest) if s2 == nil or shallow or (seq.reserved and seqShallowFlag) != 0: # this can happen! nil sequences are allowed unsureAsgnRef(x, s2) return sysAssert(dest != nil, "genericAssignAux 3") unsureAsgnRef(x, newSeq(mt, seq.len)) - var dst = cast[taddress](cast[ppointer](dest)[]) + var dst = cast[TAddress](cast[PPointer](dest)[]) for i in 0..seq.len-1: genericAssignAux( cast[pointer](dst +% i*% mt.base.size +% GenericSeqSize), - cast[pointer](cast[taddress](s2) +% i *% mt.base.size +% + cast[pointer](cast[TAddress](s2) +% i *% mt.base.size +% GenericSeqSize), - mt.Base, shallow) + mt.base, shallow) of tyObject: # we need to copy m_type field for tyObject, as it could be empty for # sequence reallocations: @@ -83,16 +83,16 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) = genericAssignAux(cast[pointer](d +% i*% mt.base.size), cast[pointer](s +% i*% mt.base.size), mt.base, shallow) of tyRef: - unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)[]) + unsureAsgnRef(cast[PPointer](dest), cast[PPointer](s)[]) else: copyMem(dest, src, mt.size) # copy raw bits -proc genericAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} = +proc genericAssign(dest, src: pointer, mt: PNimType) {.compilerProc.} = GC_disable() genericAssignAux(dest, src, mt, false) GC_enable() -proc genericShallowAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} = +proc genericShallowAssign(dest, src: pointer, mt: PNimType) {.compilerProc.} = GC_disable() genericAssignAux(dest, src, mt, true) GC_enable() @@ -126,7 +126,7 @@ when false: cprintf("%s %ld\n", k, t.size) debugNimType(t.base) -proc genericSeqAssign(dest, src: Pointer, mt: PNimType) {.compilerProc.} = +proc genericSeqAssign(dest, src: pointer, mt: PNimType) {.compilerProc.} = var src = src # ugly, but I like to stress the parser sometimes :-) genericAssign(dest, addr(src), mt) @@ -139,12 +139,12 @@ proc genericAssignOpenArray(dest, src: pointer, len: int, genericAssign(cast[pointer](d +% i*% mt.base.size), cast[pointer](s +% i*% mt.base.size), mt.base) -proc objectInit(dest: Pointer, typ: PNimType) {.compilerProc.} -proc objectInitAux(dest: Pointer, n: ptr TNimNode) = +proc objectInit(dest: pointer, typ: PNimType) {.compilerProc.} +proc objectInitAux(dest: pointer, n: ptr TNimNode) = var d = cast[TAddress](dest) case n.kind of nkNone: sysAssert(false, "objectInitAux") - of nkSLot: objectInit(cast[pointer](d +% n.offset), n.typ) + of nkSlot: objectInit(cast[pointer](d +% n.offset), n.typ) of nkList: for i in 0..n.len-1: objectInitAux(dest, n.sons[i]) @@ -152,7 +152,7 @@ proc objectInitAux(dest: Pointer, n: ptr TNimNode) = var m = selectBranch(dest, n) if m != nil: objectInitAux(dest, m) -proc objectInit(dest: Pointer, typ: PNimType) = +proc objectInit(dest: pointer, typ: PNimType) = # the generic init proc that takes care of initialization of complex # objects on the stack or heap var d = cast[TAddress](dest) @@ -168,12 +168,12 @@ proc objectInit(dest: Pointer, typ: PNimType) = of tyArray, tyArrayConstr: for i in 0..(typ.size div typ.base.size)-1: objectInit(cast[pointer](d +% i * typ.base.size), typ.base) - else: nil # nothing to do + else: discard # nothing to do # ---------------------- assign zero ----------------------------------------- when not defined(nimmixin): - proc destroy(x: int) = nil + proc destroy(x: int) = discard proc nimDestroyRange*[T](r: T) = # internal proc used for destroying sequences and arrays for i in countup(0, r.len - 1): destroy(r[i]) @@ -184,8 +184,8 @@ else: mixin destroy for i in countup(0, r.len - 1): destroy(r[i]) -proc genericReset(dest: Pointer, mt: PNimType) {.compilerProc.} -proc genericResetAux(dest: Pointer, n: ptr TNimNode) = +proc genericReset(dest: pointer, mt: PNimType) {.compilerProc.} +proc genericResetAux(dest: pointer, n: ptr TNimNode) = var d = cast[TAddress](dest) case n.kind of nkNone: sysAssert(false, "genericResetAux") @@ -197,12 +197,12 @@ proc genericResetAux(dest: Pointer, n: ptr TNimNode) = if m != nil: genericResetAux(dest, m) zeroMem(cast[pointer](d +% n.offset), n.typ.size) -proc genericReset(dest: Pointer, mt: PNimType) = +proc genericReset(dest: pointer, mt: PNimType) = var d = cast[TAddress](dest) sysAssert(mt != nil, "genericReset 2") - case mt.Kind + case mt.kind of tyString, tyRef, tySequence: - unsureAsgnRef(cast[ppointer](dest), nil) + unsureAsgnRef(cast[PPointer](dest), nil) of tyObject, tyTuple: # we don't need to reset m_type field for tyObject genericResetAux(dest, mt.node) diff --git a/lib/system/atomics.nim b/lib/system/atomics.nim index 623f8d0d2..b1a96b209 100644 --- a/lib/system/atomics.nim +++ b/lib/system/atomics.nim @@ -7,70 +7,199 @@ # distribution, for details about the copyright. # -# Atomic operations for Nimrod. - -when (defined(gcc) or defined(llvm_gcc)) and hasThreadSupport and - not defined(windows): - proc sync_add_and_fetch(p: var int, val: int): int {. - importc: "__sync_add_and_fetch", nodecl.} - proc sync_sub_and_fetch(p: var int, val: int): int {. - importc: "__sync_sub_and_fetch", nodecl.} +## Atomic operations for Nimrod. + +when (defined(gcc) or defined(llvm_gcc)) and hasThreadSupport: + type + AtomMemModel* = enum + ATOMIC_RELAXED, ## No barriers or synchronization. + ATOMIC_CONSUME, ## Data dependency only for both barrier and + ## synchronization with another thread. + ATOMIC_ACQUIRE, ## Barrier to hoisting of code and synchronizes with + ## release (or stronger) + ## semantic stores from another thread. + ATOMIC_RELEASE, ## Barrier to sinking of code and synchronizes with + ## acquire (or stronger) + ## semantic loads from another thread. + ATOMIC_ACQ_REL, ## Full barrier in both directions and synchronizes + ## with acquire loads + ## and release stores in another thread. + ATOMIC_SEQ_CST ## Full barrier in both directions and synchronizes + ## with acquire loads + ## and release stores in all threads. + + TAtomType* = TNumber|pointer|ptr|char + ## Type Class representing valid types for use with atomic procs + + proc atomicLoadN*[T: TAtomType](p: ptr T, mem: AtomMemModel): T {. + importc: "__atomic_load_n", nodecl.} + ## This proc implements an atomic load operation. It returns the contents at p. + ## ATOMIC_RELAXED, ATOMIC_SEQ_CST, ATOMIC_ACQUIRE, ATOMIC_CONSUME. + + proc atomicLoad*[T: TAtomType](p, ret: ptr T, mem: AtomMemModel) {. + importc: "__atomic_load", nodecl.} + ## This is the generic version of an atomic load. It returns the contents at p in ret. + + proc atomicStoreN*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel) {. + importc: "__atomic_store_n", nodecl.} + ## This proc implements an atomic store operation. It writes val at p. + ## ATOMIC_RELAXED, ATOMIC_SEQ_CST, and ATOMIC_RELEASE. + + proc atomicStore*[T: TAtomType](p, val: ptr T, mem: AtomMemModel) {. + importc: "__atomic_store", nodecl.} + ## This is the generic version of an atomic store. It stores the value of val at p + + proc atomicExchangeN*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_exchange_n", nodecl.} + ## This proc implements an atomic exchange operation. It writes val at p, + ## and returns the previous contents at p. + ## ATOMIC_RELAXED, ATOMIC_SEQ_CST, ATOMIC_ACQUIRE, ATOMIC_RELEASE, ATOMIC_ACQ_REL + + proc atomicExchange*[T: TAtomType](p, val, ret: ptr T, mem: AtomMemModel) {. + importc: "__atomic_exchange", nodecl.} + ## This is the generic version of an atomic exchange. It stores the contents at val at p. + ## The original value at p is copied into ret. + + proc atomicCompareExchangeN*[T: TAtomType](p, expected: ptr T, desired: T, + weak: bool, success_memmodel: AtomMemModel, failure_memmodel: AtomMemModel): bool {. + importc: "__atomic_compare_exchange_n ", nodecl.} + ## This proc implements an atomic compare and exchange operation. This compares the + ## contents at p with the contents at expected and if equal, writes desired at p. + ## If they are not equal, the current contents at p is written into expected. + ## Weak is true for weak compare_exchange, and false for the strong variation. + ## Many targets only offer the strong variation and ignore the parameter. + ## When in doubt, use the strong variation. + ## True is returned if desired is written at p and the execution is considered + ## to conform to the memory model specified by success_memmodel. There are no + ## restrictions on what memory model can be used here. False is returned otherwise, + ## and the execution is considered to conform to failure_memmodel. This memory model + ## cannot be __ATOMIC_RELEASE nor __ATOMIC_ACQ_REL. It also cannot be a stronger model + ## than that specified by success_memmodel. + + proc atomicCompareExchange*[T: TAtomType](p, expected, desired: ptr T, + weak: bool, success_memmodel: AtomMemModel, failure_memmodel: AtomMemModel): bool {. + importc: "__atomic_compare_exchange_n ", nodecl.} + ## This proc implements the generic version of atomic_compare_exchange. + ## The proc is virtually identical to atomic_compare_exchange_n, except the desired + ## value is also a pointer. + + ## Perform the operation return the new value, all memory models are valid + proc atomicAddFetch*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_add_fetch", nodecl.} + proc atomicSubFetch*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_sub_fetch", nodecl.} + proc atomicOrFetch*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_or_fetch ", nodecl.} + proc atomicAndFetch*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_and_fetch", nodecl.} + proc atomicXorFetch*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_xor_fetch", nodecl.} + proc atomicNandFetch*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_nand_fetch ", nodecl.} + + ## Perform the operation return the old value, all memory models are valid + proc atomicFetchAdd*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_fetch_add", nodecl.} + proc atomicFetchSub*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_fetch_sub", nodecl.} + proc atomicFetchOr*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_fetch_or", nodecl.} + proc atomicFetchAnd*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_fetch_and", nodecl.} + proc atomicFetchXor*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_fetch_xor", nodecl.} + proc atomicFetchNand*[T: TAtomType](p: ptr T, val: T, mem: AtomMemModel): T {. + importc: "__atomic_fetch_nand", nodecl.} + + proc atomicTestAndSet*(p: pointer, mem: AtomMemModel): bool {. + importc: "__atomic_test_and_set", nodecl.} + ## This built-in function performs an atomic test-and-set operation on the byte at p. + ## The byte is set to some implementation defined nonzero “set†value and the return + ## value is true if and only if the previous contents were “setâ€. + ## All memory models are valid. + + proc atomicClear*(p: pointer, mem: AtomMemModel) {. + importc: "__atomic_clear", nodecl.} + ## This built-in function performs an atomic clear operation at p. + ## After the operation, at p contains 0. + ## ATOMIC_RELAXED, ATOMIC_SEQ_CST, ATOMIC_RELEASE + + proc atomicThreadFence*(mem: AtomMemModel) {. + importc: "__atomic_thread_fence", nodecl.} + ## This built-in function acts as a synchronization fence between threads based + ## on the specified memory model. All memory orders are valid. + + proc atomicSignalFence*(mem: AtomMemModel) {. + importc: "__atomic_signal_fence", nodecl.} + ## This built-in function acts as a synchronization fence between a thread and + ## signal handlers based in the same thread. All memory orders are valid. + + proc atomicAlwaysLockFree*(size: int, p: pointer): bool {. + importc: "__atomic_always_lock_free", nodecl.} + ## This built-in function returns true if objects of size bytes always generate + ## lock free atomic instructions for the target architecture. size must resolve + ## to a compile-time constant and the result also resolves to a compile-time constant. + ## ptr is an optional pointer to the object that may be used to determine alignment. + ## A value of 0 indicates typical alignment should be used. The compiler may also + ## ignore this parameter. + + proc atomicIsLockFree*(size: int, p: pointer): bool {. + importc: "__atomic_is_lock_free", nodecl.} + ## This built-in function returns true if objects of size bytes always generate + ## lock free atomic instructions for the target architecture. If it is not known + ## to be lock free a call is made to a runtime routine named __atomic_is_lock_free. + ## ptr is an optional pointer to the object that may be used to determine alignment. + ## A value of 0 indicates typical alignment should be used. The compiler may also + ## ignore this parameter. + elif defined(vcc) and hasThreadSupport: - proc sync_add_and_fetch(p: var int, val: int): int {. + proc addAndFetch*(p: ptr int, val: int): int {. importc: "NimXadd", nodecl.} else: - proc sync_add_and_fetch(p: var int, val: int): int {.inline.} = - inc(p, val) - result = p + proc addAndFetch*(p: ptr int, val: int): int {.inline.} = + inc(p[], val) + result = p[] + +# atomic compare and swap (CAS) funcitons to implement lock-free algorithms + +#if defined(windows) and not defined(gcc) and hasThreadSupport: +# proc InterlockedCompareExchangePointer(mem: ptr pointer, +# newValue: pointer, comparand: pointer) : pointer {.nodecl, +# importc: "InterlockedCompareExchangePointer", header:"windows.h".} -proc atomicInc(memLoc: var int, x: int = 1): int = - when hasThreadSupport: - result = sync_add_and_fetch(memLoc, x) +# proc compareAndSwap*[T](mem: ptr T, +# expected: T, newValue: T): bool {.inline.}= +# ## Returns true if successfully set value at mem to newValue when value +# ## at mem == expected +# return InterlockedCompareExchangePointer(addr(mem), +# addr(newValue), addr(expected))[] == expected + +#elif not hasThreadSupport: +# proc compareAndSwap*[T](mem: ptr T, +# expected: T, newValue: T): bool {.inline.} = +# ## Returns true if successfully set value at mem to newValue when value +# ## at mem == expected +# var oldval = mem[] +# if oldval == expected: +# mem[] = newValue +# return true +# return false + + +# Some convenient functions +proc atomicInc*(memLoc: var int, x: int = 1): int = + when defined(gcc) and hasThreadSupport: + result = atomic_add_fetch(memLoc.addr, x, ATOMIC_RELAXED) else: inc(memLoc, x) result = memLoc -proc atomicDec(memLoc: var int, x: int = 1): int = - when hasThreadSupport: - when defined(sync_sub_and_fetch): - result = sync_sub_and_fetch(memLoc, x) +proc atomicDec*(memLoc: var int, x: int = 1): int = + when defined(gcc) and hasThreadSupport: + when defined(atomic_sub_fetch): + result = atomic_sub_fetch(memLoc.addr, x, ATOMIC_RELAXED) else: - result = sync_add_and_fetch(memLoc, -x) + result = atomic_add_fetch(memLoc.addr, -x, ATOMIC_RELAXED) else: dec(memLoc, x) - result = memLoc - - -# atomic compare and swap (CAS) funcitons to implement lock-free algorithms - -when (defined(gcc) or defined(llvm_gcc)) and hasThreadSupport: - proc compareAndSwap*[T: ptr|ref|pointer](mem: var T, expected: T, newValue: T): bool {.nodecl, - importc: " __sync_bool_compare_and_swap".} - ## Returns true if successfully set value at mem to newValue when value - ## at mem == expected - -elif defined(windows) and hasThreadSupport: - proc InterlockedCompareExchangePointer(mem: ptr pointer, - newValue: pointer, comparand: pointer) : pointer {.nodecl, - importc: "InterlockedCompareExchangePointer", header:"windows.h".} - - - proc compareAndSwap*[T: ptr|ref|pointer](mem: var T, - expected: T, newValue: T): bool {.inline.}= - ## Returns true if successfully set value at mem to newValue when value - ## at mem == expected - return InterlockedCompareExchangePointer(addr(mem), - newValue, expected) == expected - -elif not hasThreadSupport: - proc compareAndSwap*[T: ptr|ref|pointer](mem: var T, - expected: T, newValue: T): bool {.inline.} = - ## Returns true if successfully set value at mem to newValue when value - ## at mem == expected - var oldval = mem - if oldval == expected: - mem = newValue - return true - return false - - + result = memLoc diff --git a/lib/system/avltree.nim b/lib/system/avltree.nim index 6a268b453..fc965d6aa 100644 --- a/lib/system/avltree.nim +++ b/lib/system/avltree.nim @@ -9,30 +9,30 @@ # not really an AVL tree anymore, but still balanced ... -template IsBottom(n: PAvlNode): bool = n == bottom +template isBottom(n: PAvlNode): bool = n == bottom proc lowGauge(n: PAvlNode): int = var it = n - while not IsBottom(it): + while not isBottom(it): result = it.key it = it.link[0] proc highGauge(n: PAvlNode): int = result = -1 var it = n - while not IsBottom(it): + while not isBottom(it): result = it.upperBound it = it.link[1] proc find(root: PAvlNode, key: int): PAvlNode = var it = root - while not IsBottom(it): + while not isBottom(it): if it.key == key: return it it = it.link[ord(it.key <% key)] proc inRange(root: PAvlNode, key: int): PAvlNode = var it = root - while not IsBottom(it): + while not isBottom(it): if it.key <=% key and key <% it.upperBound: return it it = it.link[ord(it.key <% key)] diff --git a/lib/system/cellsets.nim b/lib/system/cellsets.nim index 7ad814da4..9a22ed0c5 100644 --- a/lib/system/cellsets.nim +++ b/lib/system/cellsets.nim @@ -43,15 +43,15 @@ type proc contains(s: TCellSeq, c: PCell): bool {.inline.} = for i in 0 .. s.len-1: - if s.d[i] == c: return True - return False + if s.d[i] == c: return true + return false proc add(s: var TCellSeq, c: PCell) {.inline.} = if s.len >= s.cap: s.cap = s.cap * 3 div 2 - var d = cast[PCellArray](Alloc(s.cap * sizeof(PCell))) + var d = cast[PCellArray](alloc(s.cap * sizeof(PCell))) copyMem(d, s.d, s.len * sizeof(PCell)) - Dealloc(s.d) + dealloc(s.d) s.d = d # XXX: realloc? s.d[s.len] = c @@ -60,10 +60,10 @@ proc add(s: var TCellSeq, c: PCell) {.inline.} = proc init(s: var TCellSeq, cap: int = 1024) = s.len = 0 s.cap = cap - s.d = cast[PCellArray](Alloc0(cap * sizeof(PCell))) + s.d = cast[PCellArray](alloc0(cap * sizeof(PCell))) proc deinit(s: var TCellSeq) = - Dealloc(s.d) + dealloc(s.d) s.d = nil s.len = 0 s.cap = 0 @@ -73,20 +73,20 @@ proc deinit(s: var TCellSeq) = const InitCellSetSize = 1024 # must be a power of two! -proc Init(s: var TCellSet) = - s.data = cast[PPageDescArray](Alloc0(InitCellSetSize * sizeof(PPageDesc))) +proc init(s: var TCellSet) = + s.data = cast[PPageDescArray](alloc0(InitCellSetSize * sizeof(PPageDesc))) s.max = InitCellSetSize-1 s.counter = 0 s.head = nil -proc Deinit(s: var TCellSet) = +proc deinit(s: var TCellSet) = var it = s.head while it != nil: var n = it.next - Dealloc(it) + dealloc(it) it = n s.head = nil # play it safe here - Dealloc(s.data) + dealloc(s.data) s.data = nil s.counter = 0 @@ -96,14 +96,14 @@ proc nextTry(h, maxHash: int): int {.inline.} = # generates each int in range(maxHash) exactly once (see any text on # random-number generation for proof). -proc CellSetGet(t: TCellSet, key: TAddress): PPageDesc = +proc cellSetGet(t: TCellSet, key: TAddress): PPageDesc = var h = cast[int](key) and t.max while t.data[h] != nil: if t.data[h].key == key: return t.data[h] h = nextTry(h, t.max) return nil -proc CellSetRawInsert(t: TCellSet, data: PPageDescArray, desc: PPageDesc) = +proc cellSetRawInsert(t: TCellSet, data: PPageDescArray, desc: PPageDesc) = var h = cast[int](desc.key) and t.max while data[h] != nil: sysAssert(data[h] != desc, "CellSetRawInsert 1") @@ -111,17 +111,17 @@ proc CellSetRawInsert(t: TCellSet, data: PPageDescArray, desc: PPageDesc) = sysAssert(data[h] == nil, "CellSetRawInsert 2") data[h] = desc -proc CellSetEnlarge(t: var TCellSet) = +proc cellSetEnlarge(t: var TCellSet) = var oldMax = t.max t.max = ((t.max+1)*2)-1 - var n = cast[PPageDescArray](Alloc0((t.max + 1) * sizeof(PPageDesc))) - for i in 0 .. oldmax: + var n = cast[PPageDescArray](alloc0((t.max + 1) * sizeof(PPageDesc))) + for i in 0 .. oldMax: if t.data[i] != nil: - CellSetRawInsert(t, n, t.data[i]) - Dealloc(t.data) + cellSetRawInsert(t, n, t.data[i]) + dealloc(t.data) t.data = n -proc CellSetPut(t: var TCellSet, key: TAddress): PPageDesc = +proc cellSetPut(t: var TCellSet, key: TAddress): PPageDesc = var h = cast[int](key) and t.max while true: var x = t.data[h] @@ -130,13 +130,13 @@ proc CellSetPut(t: var TCellSet, key: TAddress): PPageDesc = h = nextTry(h, t.max) if ((t.max+1)*2 < t.counter*3) or ((t.max+1)-t.counter < 4): - CellSetEnlarge(t) + cellSetEnlarge(t) inc(t.counter) h = cast[int](key) and t.max while t.data[h] != nil: h = nextTry(h, t.max) sysAssert(t.data[h] == nil, "CellSetPut") # the new page descriptor goes into result - result = cast[PPageDesc](Alloc0(sizeof(TPageDesc))) + result = cast[PPageDesc](alloc0(sizeof(TPageDesc))) result.next = t.head result.key = key t.head = result @@ -146,7 +146,7 @@ proc CellSetPut(t: var TCellSet, key: TAddress): PPageDesc = proc contains(s: TCellSet, cell: PCell): bool = var u = cast[TAddress](cell) - var t = CellSetGet(s, u shr PageShift) + var t = cellSetGet(s, u shr PageShift) if t != nil: u = (u %% PageSize) /% MemAlign result = (t.bits[u shr IntShift] and (1 shl (u and IntMask))) != 0 @@ -155,13 +155,13 @@ proc contains(s: TCellSet, cell: PCell): bool = proc incl(s: var TCellSet, cell: PCell) {.noinline.} = var u = cast[TAddress](cell) - var t = CellSetPut(s, u shr PageShift) + var t = cellSetPut(s, u shr PageShift) u = (u %% PageSize) /% MemAlign t.bits[u shr IntShift] = t.bits[u shr IntShift] or (1 shl (u and IntMask)) proc excl(s: var TCellSet, cell: PCell) = var u = cast[TAddress](cell) - var t = CellSetGet(s, u shr PageShift) + var t = cellSetGet(s, u shr PageShift) if t != nil: u = (u %% PageSize) /% MemAlign t.bits[u shr IntShift] = (t.bits[u shr IntShift] and @@ -169,7 +169,7 @@ proc excl(s: var TCellSet, cell: PCell) = proc containsOrIncl(s: var TCellSet, cell: PCell): bool = var u = cast[TAddress](cell) - var t = CellSetGet(s, u shr PageShift) + var t = cellSetGet(s, u shr PageShift) if t != nil: u = (u %% PageSize) /% MemAlign result = (t.bits[u shr IntShift] and (1 shl (u and IntMask))) != 0 @@ -177,7 +177,7 @@ proc containsOrIncl(s: var TCellSet, cell: PCell): bool = t.bits[u shr IntShift] = t.bits[u shr IntShift] or (1 shl (u and IntMask)) else: - Incl(s, cell) + incl(s, cell) result = false iterator elements(t: TCellSet): PCell {.inline.} = @@ -201,7 +201,7 @@ iterator elements(t: TCellSet): PCell {.inline.} = iterator elementsExcept(t, s: TCellSet): PCell {.inline.} = var r = t.head while r != nil: - let ss = CellSetGet(s, r.key) + let ss = cellSetGet(s, r.key) var i = 0 while i <= high(r.bits): var w = r.bits[i] diff --git a/lib/system/channels.nim b/lib/system/channels.nim index d0294322a..bf949529b 100644 --- a/lib/system/channels.nim +++ b/lib/system/channels.nim @@ -13,6 +13,9 @@ ## ## **Note:** The current implementation of message passing is slow and does ## not work with cyclic data structures. + +when not defined(NimString): + {.error: "You must not import this module explicitly".} type pbytes = ptr array[0.. 0xffff, byte] @@ -45,9 +48,9 @@ proc deinitRawChannel(p: pointer) = deinitSys(c.lock) deinitSysCond(c.cond) -proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, +proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel, mode: TLoadStoreMode) -proc storeAux(dest, src: Pointer, n: ptr TNimNode, t: PRawChannel, +proc storeAux(dest, src: pointer, n: ptr TNimNode, t: PRawChannel, mode: TLoadStoreMode) = var d = cast[TAddress](dest) @@ -64,7 +67,7 @@ proc storeAux(dest, src: Pointer, n: ptr TNimNode, t: PRawChannel, if m != nil: storeAux(dest, src, m, t, mode) of nkNone: sysAssert(false, "storeAux") -proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, +proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel, mode: TLoadStoreMode) = var d = cast[TAddress](dest) @@ -79,7 +82,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, x[] = nil else: var ss = cast[NimString](s2) - var ns = cast[NimString](Alloc(t.region, ss.len+1 + GenericSeqSize)) + var ns = cast[NimString](alloc(t.region, ss.len+1 + GenericSeqSize)) copyMem(ns, ss, ss.len+1 + GenericSeqSize) x[] = ns else: @@ -89,7 +92,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, unsureAsgnRef(x, s2) else: unsureAsgnRef(x, copyString(cast[NimString](s2))) - Dealloc(t.region, s2) + dealloc(t.region, s2) of tySequence: var s2 = cast[ppointer](src)[] var seq = cast[PGenericSeq](s2) @@ -102,7 +105,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, else: sysAssert(dest != nil, "dest == nil") if mode == mStore: - x[] = Alloc(t.region, seq.len *% mt.base.size +% GenericSeqSize) + x[] = alloc(t.region, seq.len *% mt.base.size +% GenericSeqSize) else: unsureAsgnRef(x, newObj(mt, seq.len * mt.base.size + GenericSeqSize)) var dst = cast[taddress](cast[ppointer](dest)[]) @@ -115,7 +118,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, var dstseq = cast[PGenericSeq](dst) dstseq.len = seq.len dstseq.reserved = seq.len - if mode != mStore: Dealloc(t.region, s2) + if mode != mStore: dealloc(t.region, s2) of tyObject: # copy type field: var pint = cast[ptr PNimType](dest) @@ -140,7 +143,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, unsureAsgnRef(x, nil) else: if mode == mStore: - x[] = Alloc(t.region, mt.base.size) + x[] = alloc(t.region, mt.base.size) else: # XXX we should use the dynamic type here too, but that is not stored # in the inbox at all --> use source[]'s object type? but how? we need @@ -148,7 +151,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel, var obj = newObj(mt, mt.base.size) unsureAsgnRef(x, obj) storeAux(x[], s, mt.base, t, mode) - if mode != mStore: Dealloc(t.region, s) + if mode != mStore: dealloc(t.region, s) else: copyMem(dest, src, mt.size) # copy raw bits @@ -158,7 +161,7 @@ proc rawSend(q: PRawChannel, data: pointer, typ: PNimType) = if q.count >= cap: # start with capacity for 2 entries in the queue: if cap == 0: cap = 1 - var n = cast[pbytes](Alloc0(q.region, cap*2*typ.size)) + var n = cast[pbytes](alloc0(q.region, cap*2*typ.size)) var z = 0 var i = q.rd var c = q.count @@ -167,7 +170,7 @@ proc rawSend(q: PRawChannel, data: pointer, typ: PNimType) = copyMem(addr(n[z*typ.size]), addr(q.data[i*typ.size]), typ.size) i = (i + 1) and q.mask inc z - if q.data != nil: Dealloc(q.region, q.data) + if q.data != nil: dealloc(q.region, q.data) q.data = n q.mask = cap*2 - 1 q.wr = q.count @@ -197,7 +200,7 @@ template sendImpl(q: expr) {.immediate.} = rawSend(q, addr(m), typ) q.elemType = typ releaseSys(q.lock) - SignalSysCond(q.cond) + signalSysCond(q.cond) proc send*[TMsg](c: var TChannel[TMsg], msg: TMsg) = ## sends a message to a thread. `msg` is deeply copied. @@ -209,7 +212,7 @@ proc llRecv(q: PRawChannel, res: pointer, typ: PNimType) = acquireSys(q.lock) q.ready = true while q.count <= 0: - WaitSysCond(q.cond, q.lock) + waitSysCond(q.cond, q.lock) q.ready = false if typ != q.elemType: releaseSys(q.lock) diff --git a/lib/system/chcks.nim b/lib/system/chcks.nim index e78129483..f29e222e8 100644 --- a/lib/system/chcks.nim +++ b/lib/system/chcks.nim @@ -9,8 +9,8 @@ # Implementation of some runtime checks. -proc raiseRangeError(val: biggestInt) {.compilerproc, noreturn, noinline.} = - when hostOs == "standalone": +proc raiseRangeError(val: BiggestInt) {.compilerproc, noreturn, noinline.} = + when hostOS == "standalone": sysFatal(EOutOfRange, "value out of range") else: sysFatal(EOutOfRange, "value out of range: ", $val) diff --git a/lib/system/dyncalls.nim b/lib/system/dyncalls.nim index 6a80369b9..9ef1a99ca 100644 --- a/lib/system/dyncalls.nim +++ b/lib/system/dyncalls.nim @@ -28,7 +28,7 @@ proc nimLoadLibraryError(path: string) = stdout.rawWrite("\n") quit(1) -proc ProcAddrError(name: cstring) {.noinline.} = +proc procAddrError(name: cstring) {.noinline.} = # carefully written to avoid memory allocation: stdout.rawWrite("could not import: ") stdout.write(name) @@ -56,7 +56,7 @@ when defined(posix): RTLD_NOW {.importc: "RTLD_NOW", header: "<dlfcn.h>".}: int proc dlclose(lib: TLibHandle) {.importc, header: "<dlfcn.h>".} - proc dlopen(path: CString, mode: int): TLibHandle {. + proc dlopen(path: cstring, mode: int): TLibHandle {. importc, header: "<dlfcn.h>".} proc dlsym(lib: TLibHandle, name: cstring): TProcAddr {. importc, header: "<dlfcn.h>".} @@ -72,7 +72,7 @@ when defined(posix): proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr = result = dlsym(lib, name) - if result == nil: ProcAddrError(name) + if result == nil: procAddrError(name) elif defined(windows) or defined(dos): # @@ -83,21 +83,22 @@ elif defined(windows) or defined(dos): type THINSTANCE {.importc: "HINSTANCE".} = pointer - proc FreeLibrary(lib: THINSTANCE) {.importc, header: "<windows.h>", stdcall.} + proc freeLibrary(lib: THINSTANCE) {. + importc: "FreeLibrary", header: "<windows.h>", stdcall.} proc winLoadLibrary(path: cstring): THINSTANCE {. importc: "LoadLibraryA", header: "<windows.h>", stdcall.} - proc GetProcAddress(lib: THINSTANCE, name: cstring): TProcAddr {. + proc getProcAddress(lib: THINSTANCE, name: cstring): TProcAddr {. importc: "GetProcAddress", header: "<windows.h>", stdcall.} proc nimUnloadLibrary(lib: TLibHandle) = - FreeLibrary(cast[THINSTANCE](lib)) + freeLibrary(cast[THINSTANCE](lib)) proc nimLoadLibrary(path: string): TLibHandle = result = cast[TLibHandle](winLoadLibrary(path)) proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr = - result = GetProcAddress(cast[THINSTANCE](lib), name) - if result == nil: ProcAddrError(name) + result = getProcAddress(cast[THINSTANCE](lib), name) + if result == nil: procAddrError(name) elif defined(mac): # diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 7937d9738..e50ba7b9f 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -11,22 +11,27 @@ # use the heap (and nor exceptions) do not include the GC or memory allocator. var - stackTraceNewLine*: string ## undocumented feature; it is replaced by ``<br>`` - ## for CGI applications - -template stackTraceNL: expr = - (if IsNil(stackTraceNewLine): "\n" else: stackTraceNewLine) + errorMessageWriter*: (proc(msg: string) {.tags: [FWriteIO].}) + ## Function that will be called + ## instead of stdmsg.write when printing stacktrace. + ## Unstable API. when not defined(windows) or not defined(guiapp): - proc writeToStdErr(msg: CString) = write(stdout, msg) + proc writeToStdErr(msg: cstring) = write(stdmsg, msg) else: proc MessageBoxA(hWnd: cint, lpText, lpCaption: cstring, uType: int): int32 {. header: "<windows.h>", nodecl.} - proc writeToStdErr(msg: CString) = + proc writeToStdErr(msg: cstring) = discard MessageBoxA(0, msg, nil, 0) +proc showErrorMessage(data: cstring) = + if errorMessageWriter != nil: + errorMessageWriter($data) + else: + writeToStdErr(data) + proc chckIndx(i, a, b: int): int {.inline, compilerproc.} proc chckRange(i, a, b: int): int {.inline, compilerproc.} proc chckRangeF(x, a, b: float): float {.inline, compilerproc.} @@ -75,9 +80,9 @@ when defined(nativeStacktrace) and nativeStackTraceSupported: type TDl_info {.importc: "Dl_info", header: "<dlfcn.h>", final, pure.} = object - dli_fname: CString + dli_fname: cstring dli_fbase: pointer - dli_sname: CString + dli_sname: cstring dli_saddr: pointer proc backtrace(symbols: ptr pointer, size: int): int {. @@ -111,7 +116,7 @@ when defined(nativeStacktrace) and nativeStackTraceSupported: add(s, tempDlInfo.dli_sname) else: add(s, '?') - add(s, stackTraceNL) + add(s, "\n") else: if dlresult != 0 and tempDlInfo.dli_sname != nil and c_strcmp(tempDlInfo.dli_sname, "signalHandler") == 0'i32: @@ -172,21 +177,18 @@ proc auxWriteStackTrace(f: PFrame, s: var string) = add(s, ')') for k in 1..max(1, 25-(s.len-oldLen)): add(s, ' ') add(s, tempFrames[j].procname) - add(s, stackTraceNL) + add(s, "\n") when hasSomeStackTrace: proc rawWriteStackTrace(s: var string) = when nimrodStackTrace: if framePtr == nil: - add(s, "No stack traceback available") - add(s, stackTraceNL) + add(s, "No stack traceback available\n") else: - add(s, "Traceback (most recent call last)") - add(s, stackTraceNL) + add(s, "Traceback (most recent call last)\n") auxWriteStackTrace(framePtr, s) elif defined(nativeStackTrace) and nativeStackTraceSupported: - add(s, "Traceback from system (most recent call last)") - add(s, stackTraceNL) + add(s, "Traceback from system (most recent call last)\n") auxWriteStackTraceWithBacktrace(s) else: add(s, "No stack traceback available\n") @@ -207,7 +209,7 @@ proc raiseExceptionAux(e: ref E_Base) = pushCurrentException(e) c_longjmp(excHandler.context, 1) elif e[] of EOutOfMemory: - writeToStdErr(e.name) + showErrorMessage(e.name) quitOrDebug() else: when hasSomeStackTrace: @@ -219,7 +221,7 @@ proc raiseExceptionAux(e: ref E_Base) = add(buf, " [") add(buf, $e.name) add(buf, "]\n") - writeToStdErr(buf) + showErrorMessage(buf) else: # ugly, but avoids heap allocations :-) template xadd(buf, s, slen: expr) = @@ -235,10 +237,10 @@ proc raiseExceptionAux(e: ref E_Base) = add(buf, " [") xadd(buf, e.name, c_strlen(e.name)) add(buf, "]\n") - writeToStdErr(buf) + showErrorMessage(buf) quitOrDebug() -proc raiseException(e: ref E_Base, ename: CString) {.compilerRtl.} = +proc raiseException(e: ref E_Base, ename: cstring) {.compilerRtl.} = e.name = ename when hasSomeStackTrace: e.trace = "" @@ -251,13 +253,13 @@ proc reraiseException() {.compilerRtl.} = else: raiseExceptionAux(currException) -proc WriteStackTrace() = +proc writeStackTrace() = when hasSomeStackTrace: var s = "" rawWriteStackTrace(s) - writeToStdErr(s) + showErrorMessage(s) else: - writeToStdErr("No stack traceback available\n") + showErrorMessage("No stack traceback available\n") proc getStackTrace(): string = when hasSomeStackTrace: @@ -278,7 +280,7 @@ when defined(endb): when not defined(noSignalHandler): proc signalHandler(sig: cint) {.exportc: "signalHandler", noconv.} = - template processSignal(s, action: expr) {.immediate.} = + template processSignal(s, action: expr) {.immediate, dirty.} = if s == SIGINT: action("SIGINT: Interrupted by Ctrl-C.\n") elif s == SIGSEGV: action("SIGSEGV: Illegal storage access. (Attempt to read from nil?)\n") @@ -298,13 +300,13 @@ when not defined(noSignalHandler): var buf = newStringOfCap(2000) rawWriteStackTrace(buf) processSignal(sig, buf.add) # nice hu? currying a la nimrod :-) - writeToStdErr(buf) + showErrorMessage(buf) GC_enable() else: var msg: cstring template asgn(y: expr) = msg = y processSignal(sig, asgn) - writeToStdErr(msg) + showErrorMessage(msg) when defined(endb): dbgAborting = True quit(1) # always quit when SIGABRT diff --git a/lib/system/gc.nim b/lib/system/gc.nim index c5d4d2aa2..820093b3e 100644 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -9,7 +9,7 @@ # Garbage Collector # -# The basic algorithm is *Deferrent Reference Counting* with cycle detection. +# The basic algorithm is *Deferred Reference Counting* with cycle detection. # This is achieved by combining a Deutsch-Bobrow garbage collector # together with Christoper's partial mark-sweep garbage collector. # @@ -84,7 +84,7 @@ var gch {.rtlThreadVar.}: TGcHeap when not defined(useNimRtl): - InstantiateForRegion(gch.region) + instantiateForRegion(gch.region) template acquire(gch: TGcHeap) = when hasThreadSupport and hasSharedHeap: @@ -132,9 +132,9 @@ when BitsPerPage mod (sizeof(int)*8) != 0: template color(c): expr = c.refCount and colorMask template setColor(c, col) = when col == rcBlack: - c.refcount = c.refCount and not colorMask + c.refcount = c.refcount and not colorMask else: - c.refcount = c.refCount and not colorMask or col + c.refcount = c.refcount and not colorMask or col proc writeCell(msg: cstring, c: PCell) = var kind = -1 @@ -151,10 +151,10 @@ template gcTrace(cell, state: expr): stmt {.immediate.} = # forward declarations: proc collectCT(gch: var TGcHeap) -proc IsOnStack*(p: pointer): bool {.noinline.} +proc isOnStack*(p: pointer): bool {.noinline.} proc forAllChildren(cell: PCell, op: TWalkOp) proc doOperation(p: pointer, op: TWalkOp) -proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) +proc forAllChildrenAux(dest: pointer, mt: PNimType, op: TWalkOp) # we need the prototype here for debugging purposes when hasThreadSupport and hasSharedHeap: @@ -162,9 +162,9 @@ when hasThreadSupport and hasSharedHeap: template `++`(x: expr): stmt = discard atomicInc(x, rcIncrement) else: template `--`(x: expr): expr = - Dec(x, rcIncrement) + dec(x, rcIncrement) x <% rcIncrement - template `++`(x: expr): stmt = Inc(x, rcIncrement) + template `++`(x: expr): stmt = inc(x, rcIncrement) proc prepareDealloc(cell: PCell) = when useMarkForDebug: @@ -203,7 +203,7 @@ proc decRef(c: PCell) {.inline.} = gcAssert(c.refcount >=% rcIncrement, "decRef") if --c.refcount: rtlAddZCT(c) - elif canBeCycleRoot(c): + elif canbeCycleRoot(c): # unfortunately this is necessary here too, because a cycle might just # have been broken up and we could recycle it. rtlAddCycleRoot(c) @@ -211,10 +211,10 @@ proc decRef(c: PCell) {.inline.} = proc incRef(c: PCell) {.inline.} = gcAssert(isAllocatedPtr(gch.region, c), "incRef: interiorPtr") - c.refcount = c.refCount +% rcIncrement + c.refcount = c.refcount +% rcIncrement # and not colorMask #writeCell("incRef", c) - if canBeCycleRoot(c): + if canbeCycleRoot(c): rtlAddCycleRoot(c) proc nimGCref(p: pointer) {.compilerProc, inline.} = incRef(usrToCell(p)) @@ -235,7 +235,7 @@ proc nimGCunrefNoCycle(p: pointer) {.compilerProc, inline.} = sysAssert(allocInv(gch.region), "end nimGCunrefNoCycle 2") sysAssert(allocInv(gch.region), "end nimGCunrefNoCycle 5") -proc asgnRef(dest: ppointer, src: pointer) {.compilerProc, inline.} = +proc asgnRef(dest: PPointer, src: pointer) {.compilerProc, inline.} = # the code generator calls this proc! gcAssert(not isOnStack(dest), "asgnRef") # BUGFIX: first incRef then decRef! @@ -243,7 +243,7 @@ proc asgnRef(dest: ppointer, src: pointer) {.compilerProc, inline.} = if dest[] != nil: decRef(usrToCell(dest[])) dest[] = src -proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerProc, inline.} = +proc asgnRefNoCycle(dest: PPointer, src: pointer) {.compilerProc, inline.} = # the code generator calls this proc if it is known at compile time that no # cycle is possible. if src != nil: @@ -255,7 +255,7 @@ proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerProc, inline.} = rtlAddZCT(c) dest[] = src -proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerProc.} = +proc unsureAsgnRef(dest: PPointer, src: pointer) {.compilerProc.} = # unsureAsgnRef updates the reference counters only if dest is not on the # stack. It is used by the code generator if it cannot decide wether a # reference is in the stack or not (this can happen for var parameters). @@ -318,7 +318,7 @@ proc forAllSlotsAux(dest: pointer, n: ptr TNimNode, op: TWalkOp) = # inlined for speed if n.sons[i].kind == nkSlot: if n.sons[i].typ.kind in {tyRef, tyString, tySequence}: - doOperation(cast[ppointer](d +% n.sons[i].offset)[], op) + doOperation(cast[PPointer](d +% n.sons[i].offset)[], op) else: forAllChildrenAux(cast[pointer](d +% n.sons[i].offset), n.sons[i].typ, op) @@ -329,29 +329,30 @@ proc forAllSlotsAux(dest: pointer, n: ptr TNimNode, op: TWalkOp) = if m != nil: forAllSlotsAux(dest, m, op) of nkNone: sysAssert(false, "forAllSlotsAux") -proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) = +proc forAllChildrenAux(dest: pointer, mt: PNimType, op: TWalkOp) = var d = cast[TAddress](dest) if dest == nil: return # nothing to do if ntfNoRefs notin mt.flags: - case mt.Kind + case mt.kind of tyRef, tyString, tySequence: # leaf: - doOperation(cast[ppointer](d)[], op) + doOperation(cast[PPointer](d)[], op) of tyObject, tyTuple: forAllSlotsAux(dest, mt.node, op) of tyArray, tyArrayConstr, tyOpenArray: for i in 0..(mt.size div mt.base.size)-1: forAllChildrenAux(cast[pointer](d +% i *% mt.base.size), mt.base, op) - else: nil + else: discard proc forAllChildren(cell: PCell, op: TWalkOp) = gcAssert(cell != nil, "forAllChildren: 1") - gcAssert(cell.typ != nil, "forAllChildren: 2") - gcAssert cell.typ.kind in {tyRef, tySequence, tyString}, "forAllChildren: 3" + gcAssert(isAllocatedPtr(gch.region, cell), "forAllChildren: 2") + gcAssert(cell.typ != nil, "forAllChildren: 3") + gcAssert cell.typ.kind in {tyRef, tySequence, tyString}, "forAllChildren: 4" let marker = cell.typ.marker if marker != nil: marker(cellToUsr(cell), op.int) else: - case cell.typ.Kind + case cell.typ.kind of tyRef: # common case forAllChildrenAux(cellToUsr(cell), cell.typ.base, op) of tySequence: @@ -361,7 +362,7 @@ proc forAllChildren(cell: PCell, op: TWalkOp) = for i in 0..s.len-1: forAllChildrenAux(cast[pointer](d +% i *% cell.typ.base.size +% GenericSeqSize), cell.typ.base, op) - else: nil + else: discard proc addNewObjToZCT(res: PCell, gch: var TGcHeap) {.inline.} = # we check the last 8 entries (cache line) for a slot that could be reused. @@ -407,12 +408,19 @@ proc addNewObjToZCT(res: PCell, gch: var TGcHeap) {.inline.} = return add(gch.zct, res) +{.push stackTrace: off, profiler:off.} +proc gcInvariant*() = + sysAssert(allocInv(gch.region), "injected") + when defined(markForDebug): + markForDebug(gch) +{.pop.} + proc rawNewObj(typ: PNimType, size: int, gch: var TGcHeap): pointer = # generates a new object and sets its reference counter to 0 + sysAssert(allocInv(gch.region), "rawNewObj begin") acquire(gch) gcAssert(typ.kind in {tyRef, tyString, tySequence}, "newObj: 1") collectCT(gch) - sysAssert(allocInv(gch.region), "rawNewObj begin") var res = cast[PCell](rawAlloc(gch.region, size + sizeof(TCell))) gcAssert((cast[TAddress](res) and (MemAlign-1)) == 0, "newObj: 2") # now it is buffered in the ZCT @@ -511,13 +519,15 @@ proc growObj(old: pointer, newsize: int, gch: var TGcHeap): pointer = d[j] = res break dec(j) - if canBeCycleRoot(ol): excl(gch.cycleRoots, ol) + if canbeCycleRoot(ol): excl(gch.cycleRoots, ol) when logGC: writeCell("growObj old cell", ol) writeCell("growObj new cell", res) gcTrace(ol, csZctFreed) gcTrace(res, csAllocated) - when reallyDealloc: rawDealloc(gch.region, ol) + when reallyDealloc: + sysAssert(allocInv(gch.region), "growObj before dealloc") + rawDealloc(gch.region, ol) else: sysAssert(ol.typ != nil, "growObj: 5") zeroMem(ol, sizeof(TCell)) @@ -537,7 +547,9 @@ proc freeCyclicCell(gch: var TGcHeap, c: PCell) = prepareDealloc(c) gcTrace(c, csCycFreed) when logGC: writeCell("cycle collector dealloc cell", c) - when reallyDealloc: rawDealloc(gch.region, c) + when reallyDealloc: + sysAssert(allocInv(gch.region), "free cyclic cell") + rawDealloc(gch.region, c) else: gcAssert(c.typ != nil, "freeCyclicCell") zeroMem(c, sizeof(TCell)) @@ -561,7 +573,7 @@ proc scan(s: PCell) = proc collectWhite(s: PCell) = if s.color == rcWhite and s notin gch.cycleRoots: - s.setcolor(rcBlack) + s.setColor(rcBlack) forAllChildren(s, waCollectWhite) freeCyclicCell(gch, s) @@ -570,7 +582,7 @@ proc markRoots(gch: var TGcHeap) = for s in elements(gch.cycleRoots): #writeCell("markRoot", s) inc tabSize - if s.color == rcPurple and s.refCount >=% rcIncrement: + if s.color == rcPurple and s.refcount >=% rcIncrement: markGray(s) else: excl(gch.cycleRoots, s) @@ -620,8 +632,7 @@ proc doOperation(p: pointer, op: TWalkOp) = case op of waZctDecRef: #if not isAllocatedPtr(gch.region, c): - # return - # c_fprintf(c_stdout, "[GC] decref bug: %p", c) + # c_fprintf(c_stdout, "[GC] decref bug: %p", c) gcAssert(isAllocatedPtr(gch.region, c), "decRef: waZctDecRef") gcAssert(c.refcount >=% rcIncrement, "doOperation 2") #c.refcount = c.refcount -% rcIncrement @@ -658,7 +669,7 @@ proc doOperation(p: pointer, op: TWalkOp) = proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} = doOperation(d, TWalkOp(op)) -proc CollectZCT(gch: var TGcHeap): bool +proc collectZCT(gch: var TGcHeap): bool when useMarkForDebug or useBackupGc: proc markStackAndRegistersForSweep(gch: var TGcHeap) {.noinline, cdecl.} @@ -858,7 +869,7 @@ else: sp = sp +% sizeof(pointer)*8 # last few entries: while sp <=% max: - gcMark(gch, cast[ppointer](sp)[]) + gcMark(gch, cast[PPointer](sp)[]) sp = sp +% sizeof(pointer) proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} = @@ -880,7 +891,7 @@ proc collectZCT(gch: var TGcHeap): bool = const workPackage = 100 var L = addr(gch.zct.len) - when withRealtime: + when withRealTime: var steps = workPackage var t0: TTicks if gch.maxPause > 0: t0 = getticks() @@ -893,7 +904,7 @@ proc collectZCT(gch: var TGcHeap): bool = c.refcount = c.refcount and not ZctFlag gch.zct.d[0] = gch.zct.d[L[] - 1] dec(L[]) - when withRealtime: dec steps + when withRealTime: dec steps if c.refcount <% rcIncrement: # It may have a RC > 0, if it is in the hardware stack or # it has not been removed yet from the ZCT. This is because @@ -902,7 +913,7 @@ proc collectZCT(gch: var TGcHeap): bool = # In any case, it should be removed from the ZCT. But not # freed. **KEEP THIS IN MIND WHEN MAKING THIS INCREMENTAL!** when cycleGC: - if canBeCycleRoot(c): excl(gch.cycleRoots, c) + if canbeCycleRoot(c): excl(gch.cycleRoots, c) when logGC: writeCell("zct dealloc cell", c) gcTrace(c, csZctFreed) # We are about to free the object, call the finalizer BEFORE its @@ -910,11 +921,13 @@ proc collectZCT(gch: var TGcHeap): bool = # access invalid memory. This is done by prepareDealloc(): prepareDealloc(c) forAllChildren(c, waZctDecRef) - when reallyDealloc: rawDealloc(gch.region, c) + when reallyDealloc: + sysAssert(allocInv(gch.region), "collectZCT: rawDealloc") + rawDealloc(gch.region, c) else: sysAssert(c.typ != nil, "collectZCT 2") zeroMem(c, sizeof(TCell)) - when withRealtime: + when withRealTime: if steps == 0: steps = workPackage if gch.maxPause > 0: @@ -939,7 +952,7 @@ proc unmarkStackAndRegisters(gch: var TGcHeap) = gch.decStack.len = 0 proc collectCTBody(gch: var TGcHeap) = - when withRealtime: + when withRealTime: let t0 = getticks() sysAssert(allocInv(gch.region), "collectCT: begin") @@ -957,12 +970,12 @@ proc collectCTBody(gch: var TGcHeap) = #discard collectZCT(gch) inc(gch.stat.cycleCollections) gch.cycleThreshold = max(InitialCycleThreshold, getOccupiedMem() * - cycleIncrease) + CycleIncrease) gch.stat.maxThreshold = max(gch.stat.maxThreshold, gch.cycleThreshold) unmarkStackAndRegisters(gch) sysAssert(allocInv(gch.region), "collectCT: end") - when withRealtime: + when withRealTime: let duration = getticks() - t0 gch.stat.maxPause = max(gch.stat.maxPause, duration) when defined(reportMissedDeadlines): @@ -984,7 +997,7 @@ proc collectCT(gch: var TGcHeap) = markForDebug(gch) collectCTBody(gch) -when withRealtime: +when withRealTime: proc toNano(x: int): TNanos {.inline.} = result = x * 1000 @@ -1016,11 +1029,7 @@ when not defined(useNimRtl): dec(gch.recGcLock) proc GC_setStrategy(strategy: TGC_Strategy) = - case strategy - of gcThroughput: nil - of gcResponsiveness: nil - of gcOptimizeSpace: nil - of gcOptimizeTime: nil + discard proc GC_enableMarkAndSweep() = gch.cycleThreshold = InitialCycleThreshold diff --git a/lib/system/gc2.nim b/lib/system/gc2.nim index 05c291371..31c99a601 100644 --- a/lib/system/gc2.nim +++ b/lib/system/gc2.nim @@ -387,8 +387,7 @@ template `--`(rc: TRefCount): expr = rc <% rcIncrement template `--` (rc: TRefCount, heapType: THeapType): expr = - (when heapType == SharedHeap: atomicDec(rc, rcIncrement) <% rcIncrement - else: --rc) + (when heapType == SharedHeap: atomicDec(rc, rcIncrement) <% rcIncrement else: --rc) template doDecRef(cc: PCell, heapType = LocalHeap, diff --git a/lib/system/gc_ms.nim b/lib/system/gc_ms.nim index 2e3596985..e78a4e5cd 100644 --- a/lib/system/gc_ms.nim +++ b/lib/system/gc_ms.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2013 Andreas Rumpf +# (c) Copyright 2014 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -59,11 +59,11 @@ var gch {.rtlThreadVar.}: TGcHeap when not defined(useNimRtl): - InstantiateForRegion(gch.region) + instantiateForRegion(gch.region) template acquire(gch: TGcHeap) = when hasThreadSupport and hasSharedHeap: - AcquireSys(HeapLock) + acquireSys(HeapLock) template release(gch: TGcHeap) = when hasThreadSupport and hasSharedHeap: @@ -90,7 +90,7 @@ proc extGetCellType(c: pointer): PNimType {.compilerproc.} = # used for code generation concerning debugging result = usrToCell(c).typ -proc unsureAsgnRef(dest: ppointer, src: pointer) {.inline.} = +proc unsureAsgnRef(dest: PPointer, src: pointer) {.inline.} = dest[] = src proc internRefcount(p: pointer): int {.exportc: "getRefcount".} = @@ -114,10 +114,10 @@ when BitsPerPage mod (sizeof(int)*8) != 0: # forward declarations: proc collectCT(gch: var TGcHeap) -proc IsOnStack*(p: pointer): bool {.noinline.} +proc isOnStack*(p: pointer): bool {.noinline.} proc forAllChildren(cell: PCell, op: TWalkOp) proc doOperation(p: pointer, op: TWalkOp) -proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) +proc forAllChildrenAux(dest: pointer, mt: PNimType, op: TWalkOp) # we need the prototype here for debugging purposes proc prepareDealloc(cell: PCell) = @@ -162,19 +162,19 @@ proc forAllSlotsAux(dest: pointer, n: ptr TNimNode, op: TWalkOp) = if m != nil: forAllSlotsAux(dest, m, op) of nkNone: sysAssert(false, "forAllSlotsAux") -proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) = +proc forAllChildrenAux(dest: pointer, mt: PNimType, op: TWalkOp) = var d = cast[TAddress](dest) if dest == nil: return # nothing to do if ntfNoRefs notin mt.flags: - case mt.Kind + case mt.kind of tyRef, tyString, tySequence: # leaf: - doOperation(cast[ppointer](d)[], op) + doOperation(cast[PPointer](d)[], op) of tyObject, tyTuple: forAllSlotsAux(dest, mt.node, op) of tyArray, tyArrayConstr, tyOpenArray: for i in 0..(mt.size div mt.base.size)-1: forAllChildrenAux(cast[pointer](d +% i *% mt.base.size), mt.base, op) - else: nil + else: discard proc forAllChildren(cell: PCell, op: TWalkOp) = gcAssert(cell != nil, "forAllChildren: 1") @@ -184,7 +184,7 @@ proc forAllChildren(cell: PCell, op: TWalkOp) = if marker != nil: marker(cellToUsr(cell), op.int) else: - case cell.typ.Kind + case cell.typ.kind of tyRef: # common case forAllChildrenAux(cellToUsr(cell), cell.typ.base, op) of tySequence: @@ -194,7 +194,7 @@ proc forAllChildren(cell: PCell, op: TWalkOp) = for i in 0..s.len-1: forAllChildrenAux(cast[pointer](d +% i *% cell.typ.base.size +% GenericSeqSize), cell.typ.base, op) - else: nil + else: discard proc rawNewObj(typ: PNimType, size: int, gch: var TGcHeap): pointer = # generates a new object and sets its reference counter to 0 @@ -466,7 +466,7 @@ else: sp = sp +% sizeof(pointer)*8 # last few entries: while sp <=% max: - gcMark(gch, cast[ppointer](sp)[]) + gcMark(gch, cast[PPointer](sp)[]) sp = sp +% sizeof(pointer) # ---------------------------------------------------------------------------- @@ -505,7 +505,7 @@ when not defined(useNimRtl): else: dec(gch.recGcLock) - proc GC_setStrategy(strategy: TGC_Strategy) = nil + proc GC_setStrategy(strategy: TGC_Strategy) = discard proc GC_enableMarkAndSweep() = gch.cycleThreshold = InitialThreshold diff --git a/lib/system/hti.nim b/lib/system/hti.nim index a2d132dbf..9d8ece7df 100644 --- a/lib/system/hti.nim +++ b/lib/system/hti.nim @@ -69,7 +69,7 @@ type kind: TNimNodeKind offset: int typ: ptr TNimType - name: Cstring + name: cstring len: int sons: ptr array [0..0x7fff, ptr TNimNode] diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim index 850dd1e11..4fc5f479b 100644 --- a/lib/system/jssys.nim +++ b/lib/system/jssys.nim @@ -472,17 +472,17 @@ proc Ze(a: int): int {.compilerproc.} = proc Ze64(a: int64): int64 {.compilerproc.} = result = a -proc toU8(a: int): int8 {.noStackFrame, compilerproc.} = +proc ToU8(a: int): int8 {.noStackFrame, compilerproc.} = asm """ return `a`; """ -proc toU16(a: int): int16 {.noStackFrame, compilerproc.} = +proc ToU16(a: int): int16 {.noStackFrame, compilerproc.} = asm """ return `a`; """ -proc toU32(a: int): int32 {.noStackFrame, compilerproc.} = +proc ToU32(a: int): int32 {.noStackFrame, compilerproc.} = asm """ return `a`; """ diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim index c9801abad..d060cc9a8 100644 --- a/lib/system/mmdisp.nim +++ b/lib/system/mmdisp.nim @@ -18,7 +18,8 @@ const logGC = false traceGC = false # extensive debugging alwaysCycleGC = false - alwaysGC = false # collect after every memory allocation (for debugging) + alwaysGC = defined(fulldebug) # collect after every memory + # allocation (for debugging) leakDetector = false overwriteFree = false trackAllocationSource = leakDetector @@ -28,10 +29,11 @@ const reallyOsDealloc = true coalescRight = true coalescLeft = true + logAlloc = false type PPointer = ptr pointer - TByteArray = array[0..1000_0000, byte] + TByteArray = array[0..1000_0000, Byte] PByte = ptr TByteArray PString = ptr string @@ -112,10 +114,10 @@ when defined(boehmgc): proc alloc0(size: int): pointer = result = alloc(size) zeroMem(result, size) - proc realloc(p: Pointer, newsize: int): pointer = + proc realloc(p: pointer, newsize: int): pointer = result = boehmRealloc(p, newsize) if result == nil: raiseOutOfMem() - proc dealloc(p: Pointer) = boehmDealloc(p) + proc dealloc(p: pointer) = boehmDealloc(p) proc allocShared(size: int): pointer = result = boehmAlloc(size) @@ -123,26 +125,26 @@ when defined(boehmgc): proc allocShared0(size: int): pointer = result = alloc(size) zeroMem(result, size) - proc reallocShared(p: Pointer, newsize: int): pointer = + proc reallocShared(p: pointer, newsize: int): pointer = result = boehmRealloc(p, newsize) if result == nil: raiseOutOfMem() - proc deallocShared(p: Pointer) = boehmDealloc(p) + proc deallocShared(p: pointer) = boehmDealloc(p) #boehmGCincremental() proc GC_disable() = boehmGC_disable() proc GC_enable() = boehmGC_enable() proc GC_fullCollect() = boehmGCfullCollect() - proc GC_setStrategy(strategy: TGC_Strategy) = nil - proc GC_enableMarkAndSweep() = nil - proc GC_disableMarkAndSweep() = nil + proc GC_setStrategy(strategy: TGC_Strategy) = discard + proc GC_enableMarkAndSweep() = discard + proc GC_disableMarkAndSweep() = discard proc GC_getStatistics(): string = return "" proc getOccupiedMem(): int = return boehmGetHeapSize()-boehmGetFreeBytes() proc getFreeMem(): int = return boehmGetFreeBytes() proc getTotalMem(): int = return boehmGetHeapSize() - proc setStackBottom(theStackBottom: pointer) = nil + proc setStackBottom(theStackBottom: pointer) = discard proc initGC() = when defined(macosx): boehmGCinit() @@ -158,8 +160,8 @@ when defined(boehmgc): proc growObj(old: pointer, newsize: int): pointer = result = realloc(old, newsize) - proc nimGCref(p: pointer) {.compilerproc, inline.} = nil - proc nimGCunref(p: pointer) {.compilerproc, inline.} = nil + proc nimGCref(p: pointer) {.compilerproc, inline.} = discard + proc nimGCunref(p: pointer) {.compilerproc, inline.} = discard proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerproc, inline.} = dest[] = src @@ -171,15 +173,15 @@ when defined(boehmgc): type TMemRegion = object {.final, pure.} - proc Alloc(r: var TMemRegion, size: int): pointer = + proc alloc(r: var TMemRegion, size: int): pointer = result = boehmAlloc(size) if result == nil: raiseOutOfMem() - proc Alloc0(r: var TMemRegion, size: int): pointer = + proc alloc0(r: var TMemRegion, size: int): pointer = result = alloc(size) zeroMem(result, size) - proc Dealloc(r: var TMemRegion, p: Pointer) = boehmDealloc(p) - proc deallocOsPages(r: var TMemRegion) {.inline.} = nil - proc deallocOsPages() {.inline.} = nil + proc dealloc(r: var TMemRegion, p: Pointer) = boehmDealloc(p) + proc deallocOsPages(r: var TMemRegion) {.inline.} = discard + proc deallocOsPages() {.inline.} = discard include "system/cellsets" elif defined(nogc) and defined(useMalloc): @@ -191,10 +193,10 @@ elif defined(nogc) and defined(useMalloc): proc alloc0(size: int): pointer = result = alloc(size) zeroMem(result, size) - proc realloc(p: Pointer, newsize: int): pointer = + proc realloc(p: pointer, newsize: int): pointer = result = crealloc(p, newsize) if result == nil: raiseOutOfMem() - proc dealloc(p: Pointer) = cfree(p) + proc dealloc(p: pointer) = cfree(p) proc allocShared(size: int): pointer = result = cmalloc(size) @@ -202,26 +204,26 @@ elif defined(nogc) and defined(useMalloc): proc allocShared0(size: int): pointer = result = alloc(size) zeroMem(result, size) - proc reallocShared(p: Pointer, newsize: int): pointer = + proc reallocShared(p: pointer, newsize: int): pointer = result = crealloc(p, newsize) if result == nil: raiseOutOfMem() - proc deallocShared(p: Pointer) = cfree(p) - - proc GC_disable() = nil - proc GC_enable() = nil - proc GC_fullCollect() = nil - proc GC_setStrategy(strategy: TGC_Strategy) = nil - proc GC_enableMarkAndSweep() = nil - proc GC_disableMarkAndSweep() = nil + proc deallocShared(p: pointer) = cfree(p) + + proc GC_disable() = discard + proc GC_enable() = discard + proc GC_fullCollect() = discard + proc GC_setStrategy(strategy: TGC_Strategy) = discard + proc GC_enableMarkAndSweep() = discard + proc GC_disableMarkAndSweep() = discard proc GC_getStatistics(): string = return "" - proc getOccupiedMem(): int = nil - proc getFreeMem(): int = nil - proc getTotalMem(): int = nil + proc getOccupiedMem(): int = discard + proc getFreeMem(): int = discard + proc getTotalMem(): int = discard - proc setStackBottom(theStackBottom: pointer) = nil + proc setStackBottom(theStackBottom: pointer) = discard - proc initGC() = nil + proc initGC() = discard proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} = result = alloc(size) @@ -233,8 +235,8 @@ elif defined(nogc) and defined(useMalloc): proc growObj(old: pointer, newsize: int): pointer = result = realloc(old, newsize) - proc nimGCref(p: pointer) {.compilerproc, inline.} = nil - proc nimGCunref(p: pointer) {.compilerproc, inline.} = nil + proc nimGCref(p: pointer) {.compilerproc, inline.} = discard + proc nimGCunref(p: pointer) {.compilerproc, inline.} = discard proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerproc, inline.} = dest[] = src @@ -246,13 +248,13 @@ elif defined(nogc) and defined(useMalloc): type TMemRegion = object {.final, pure.} - proc Alloc(r: var TMemRegion, size: int): pointer = + proc alloc(r: var TMemRegion, size: int): pointer = result = alloc(size) - proc Alloc0(r: var TMemRegion, size: int): pointer = + proc alloc0(r: var TMemRegion, size: int): pointer = result = alloc0(size) - proc Dealloc(r: var TMemRegion, p: Pointer) = Dealloc(p) - proc deallocOsPages(r: var TMemRegion) {.inline.} = nil - proc deallocOsPages() {.inline.} = nil + proc dealloc(r: var TMemRegion, p: pointer) = dealloc(p) + proc deallocOsPages(r: var TMemRegion) {.inline.} = discard + proc deallocOsPages() {.inline.} = discard elif defined(nogc): # Even though we don't want the GC, we cannot simply use C's memory manager @@ -266,13 +268,13 @@ elif defined(nogc): include "system/alloc" - proc initGC() = nil - proc GC_disable() = nil - proc GC_enable() = nil - proc GC_fullCollect() = nil - proc GC_setStrategy(strategy: TGC_Strategy) = nil - proc GC_enableMarkAndSweep() = nil - proc GC_disableMarkAndSweep() = nil + proc initGC() = discard + proc GC_disable() = discard + proc GC_enable() = discard + proc GC_fullCollect() = discard + proc GC_setStrategy(strategy: TGC_Strategy) = discard + proc GC_enableMarkAndSweep() = discard + proc GC_disableMarkAndSweep() = discard proc GC_getStatistics(): string = return "" @@ -285,9 +287,9 @@ elif defined(nogc): proc growObj(old: pointer, newsize: int): pointer = result = realloc(old, newsize) - proc setStackBottom(theStackBottom: pointer) = nil - proc nimGCref(p: pointer) {.compilerproc, inline.} = nil - proc nimGCunref(p: pointer) {.compilerproc, inline.} = nil + proc setStackBottom(theStackBottom: pointer) = discard + proc nimGCref(p: pointer) {.compilerproc, inline.} = discard + proc nimGCunref(p: pointer) {.compilerproc, inline.} = discard proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerproc, inline.} = dest[] = src diff --git a/lib/system/repr.nim b/lib/system/repr.nim index a51864ac2..cd3f7c3f4 100644 --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -72,7 +72,7 @@ proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} = result = $e & " (invalid data!)" type - pbyteArray = ptr array[0.. 0xffff, int8] + PByteArray = ptr array[0.. 0xffff, int8] proc addSetElem(result: var string, elem: int, typ: PNimType) = case typ.kind @@ -96,7 +96,7 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) = of 4: u = ze64(cast[ptr int32](p)[]) of 8: u = cast[ptr int64](p)[] else: - var a = cast[pbyteArray](p) + var a = cast[PByteArray](p) for i in 0 .. typ.size*8-1: if (ze(a[i div 8]) and (1 shl (i mod 8))) != 0: if elemCounter > 0: add result, ", " @@ -129,12 +129,12 @@ when not defined(useNimRtl): when hasThreadSupport and hasSharedHeap and defined(heapLock): AcquireSys(HeapLock) when defined(TCellSet): - Init(cl.marked) + init(cl.marked) cl.recdepth = -1 # default is to display everything! cl.indent = 0 proc deinitReprClosure(cl: var TReprClosure) = - when defined(TCellSet): Deinit(cl.marked) + when defined(TCellSet): deinit(cl.marked) when hasThreadSupport and hasSharedHeap and defined(heapLock): ReleaseSys(HeapLock) @@ -164,7 +164,7 @@ when not defined(useNimRtl): for i in 0..cast[PGenericSeq](p).len-1: if i > 0: add result, ", " reprAux(result, cast[pointer](cast[TAddress](p) + GenericSeqSize + i*bs), - typ.Base, cl) + typ.base, cl) add result, "]" proc reprRecordAux(result: var string, p: pointer, n: ptr TNimNode, @@ -224,17 +224,17 @@ when not defined(useNimRtl): reprRecord(result, p, t, cl) of tyRef, tyPtr: sysAssert(p != nil, "reprAux") - if cast[ppointer](p)[] == nil: add result, "nil" - else: reprRef(result, cast[ppointer](p)[], typ, cl) + if cast[PPointer](p)[] == nil: add result, "nil" + else: reprRef(result, cast[PPointer](p)[], typ, cl) of tySequence: - reprSequence(result, cast[ppointer](p)[], typ, cl) + reprSequence(result, cast[PPointer](p)[], typ, cl) of tyInt: add result, $(cast[ptr int](p)[]) - of tyInt8: add result, $int(cast[ptr Int8](p)[]) - of tyInt16: add result, $int(cast[ptr Int16](p)[]) - of tyInt32: add result, $int(cast[ptr Int32](p)[]) - of tyInt64: add result, $(cast[ptr Int64](p)[]) - of tyUInt8: add result, $ze(cast[ptr Int8](p)[]) - of tyUInt16: add result, $ze(cast[ptr Int16](p)[]) + of tyInt8: add result, $int(cast[ptr int8](p)[]) + of tyInt16: add result, $int(cast[ptr int16](p)[]) + of tyInt32: add result, $int(cast[ptr int32](p)[]) + of tyInt64: add result, $(cast[ptr int64](p)[]) + of tyUInt8: add result, $ze(cast[ptr int8](p)[]) + of tyUInt16: add result, $ze(cast[ptr int16](p)[]) of tyFloat: add result, $(cast[ptr float](p)[]) of tyFloat32: add result, $(cast[ptr float32](p)[]) @@ -246,8 +246,8 @@ when not defined(useNimRtl): of tyCString: reprStrAux(result, $(cast[ptr cstring](p)[])) of tyRange: reprAux(result, p, typ.base, cl) of tyProc, tyPointer: - if cast[ppointer](p)[] == nil: add result, "nil" - else: add result, reprPointer(cast[ppointer](p)[]) + if cast[PPointer](p)[] == nil: add result, "nil" + else: add result, reprPointer(cast[PPointer](p)[]) else: add result, "(invalid data!)" inc(cl.recdepth) diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index a877f8b28..56e6a9e5f 100644 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -24,16 +24,16 @@ proc fgetc(stream: TFile): cint {.importc: "fgetc", header: "<stdio.h>", tags: [FReadIO].} proc ungetc(c: cint, f: TFile) {.importc: "ungetc", header: "<stdio.h>", tags: [].} -proc putc(c: Char, stream: TFile) {.importc: "putc", header: "<stdio.h>", +proc putc(c: char, stream: TFile) {.importc: "putc", header: "<stdio.h>", tags: [FWriteIO].} -proc fprintf(f: TFile, frmt: CString) {.importc: "fprintf", +proc fprintf(f: TFile, frmt: cstring) {.importc: "fprintf", header: "<stdio.h>", varargs, tags: [FWriteIO].} proc strlen(c: cstring): int {. importc: "strlen", header: "<string.h>", tags: [].} # C routine that is used here: -proc fread(buf: Pointer, size, n: int, f: TFile): int {. +proc fread(buf: pointer, size, n: int, f: TFile): int {. importc: "fread", header: "<stdio.h>", tags: [FReadIO].} proc fseek(f: TFile, offset: clong, whence: int): int {. importc: "fseek", header: "<stdio.h>", tags: [].} @@ -45,12 +45,24 @@ proc setvbuf(stream: TFile, buf: pointer, typ, size: cint): cint {. proc write(f: TFile, c: cstring) = fputs(c, f) {.pop.} -var - IOFBF {.importc: "_IOFBF", nodecl.}: cint - IONBF {.importc: "_IONBF", nodecl.}: cint +when NoFakeVars: + when defined(windows): + const + IOFBF = cint(0) + IONBF = cint(4) + elif defined(macosx) or defined(linux): + const + IOFBF = cint(0) + IONBF = cint(2) + else: + {.error: "IOFBF not ported to your platform".} +else: + var + IOFBF {.importc: "_IOFBF", nodecl.}: cint + IONBF {.importc: "_IONBF", nodecl.}: cint const - buf_size = 4000 + BufSize = 4000 proc raiseEIO(msg: string) {.noinline, noreturn.} = sysFatal(EIO, msg) @@ -59,7 +71,7 @@ proc readLine(f: TFile, line: var TaintedString): bool = # 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 setLen(line.string, 0) # reuse the buffer! - while True: + while true: var c = fgetc(f) if c < 0'i32: if line.len > 0: break @@ -82,8 +94,8 @@ proc write(f: TFile, i: int) = else: fprintf(f, "%ld", i) -proc write(f: TFile, i: biggestInt) = - when sizeof(biggestint) == 8: +proc write(f: TFile, i: BiggestInt) = + when sizeof(BiggestInt) == 8: fprintf(f, "%lld", i) else: fprintf(f, "%ld", i) @@ -92,9 +104,9 @@ proc write(f: TFile, b: bool) = if b: write(f, "true") else: write(f, "false") proc write(f: TFile, r: float32) = fprintf(f, "%g", r) -proc write(f: TFile, r: biggestFloat) = fprintf(f, "%g", r) +proc write(f: TFile, r: BiggestFloat) = fprintf(f, "%g", r) -proc write(f: TFile, c: Char) = putc(c, f) +proc write(f: TFile, c: char) = putc(c, f) proc write(f: TFile, a: varargs[string, `$`]) = for x in items(a): write(f, x) @@ -102,10 +114,10 @@ proc readAllBuffer(file: TFile): string = # This proc is for TFile we want to read but don't know how many # bytes we need to read before the buffer is empty. result = "" - var buffer = newString(buf_size) - var bytesRead = buf_size - while bytesRead == buf_size: - bytesRead = readBuffer(file, addr(buffer[0]), buf_size) + var buffer = newString(BufSize) + var bytesRead = BufSize + while bytesRead == BufSize: + bytesRead = readBuffer(file, addr(buffer[0]), BufSize) result.add(buffer) proc rawFileSize(file: TFile): int = @@ -149,7 +161,7 @@ proc writeFile(filename, content: string) = finally: close(f) -proc EndOfFile(f: TFile): bool = +proc endOfFile(f: TFile): bool = # do not blame me; blame the ANSI C standard this is so brain-damaged var c = fgetc(f) ungetc(c, f) @@ -167,12 +179,12 @@ proc rawEchoNL() {.inline, compilerproc.} = write(stdout, "\n") when defined(windows) and not defined(useWinAnsi): include "system/widestrs" - proc wfopen(filename, mode: widecstring): pointer {. + proc wfopen(filename, mode: WideCString): pointer {. importc: "_wfopen", nodecl.} - proc wfreopen(filename, mode: widecstring, stream: TFile): TFile {. + proc wfreopen(filename, mode: WideCString, stream: TFile): TFile {. importc: "_wfreopen", nodecl.} - proc fopen(filename, mode: CString): pointer = + proc fopen(filename, mode: cstring): pointer = var f = newWideCString(filename) var m = newWideCString(mode) result = wfopen(f, m) @@ -183,7 +195,7 @@ when defined(windows) and not defined(useWinAnsi): result = wfreopen(f, m, stream) else: - proc fopen(filename, mode: CString): pointer {.importc: "fopen", noDecl.} + proc fopen(filename, mode: cstring): pointer {.importc: "fopen", noDecl.} proc freopen(filename, mode: cstring, stream: TFile): TFile {. importc: "freopen", nodecl.} @@ -194,9 +206,9 @@ const # should not be translated. -proc Open(f: var TFile, filename: string, +proc open(f: var TFile, filename: string, mode: TFileMode = fmRead, - bufSize: int = -1): Bool = + bufSize: int = -1): bool = var p: pointer = fopen(filename, FormatOpen[mode]) result = (p != nil) f = cast[TFile](p) @@ -217,23 +229,23 @@ proc open(f: var TFile, filehandle: TFileHandle, mode: TFileMode): bool = f = fdopen(filehandle, FormatOpen[mode]) result = f != nil -proc fwrite(buf: Pointer, size, n: int, f: TFile): int {. +proc fwrite(buf: pointer, size, n: int, f: TFile): int {. importc: "fwrite", noDecl.} proc readBuffer(f: TFile, buffer: pointer, len: int): int = result = fread(buffer, 1, len, f) -proc ReadBytes(f: TFile, a: var openarray[int8], start, len: int): int = +proc readBytes(f: TFile, a: var openArray[int8], start, len: int): int = result = readBuffer(f, addr(a[start]), len) -proc ReadChars(f: TFile, a: var openarray[char], start, len: int): int = +proc readChars(f: TFile, a: var openArray[char], start, len: int): int = result = readBuffer(f, addr(a[start]), len) {.push stackTrace:off, profiler:off.} -proc writeBytes(f: TFile, a: openarray[int8], start, len: int): int = +proc writeBytes(f: TFile, a: openArray[int8], start, len: int): int = var x = cast[ptr array[0..1000_000_000, int8]](a) result = writeBuffer(f, addr(x[start]), len) -proc writeChars(f: TFile, a: openarray[char], start, len: int): int = +proc writeChars(f: TFile, a: openArray[char], start, len: int): int = var x = cast[ptr array[0..1000_000_000, int8]](a) result = writeBuffer(f, addr(x[start]), len) proc writeBuffer(f: TFile, buffer: pointer, len: int): int = diff --git a/lib/system/syslocks.nim b/lib/system/syslocks.nim index 4d81dee01..5e3b04b7f 100644 --- a/lib/system/syslocks.nim +++ b/lib/system/syslocks.nim @@ -22,50 +22,53 @@ when defined(Windows): TSysCond = THandle - proc InitSysLock(L: var TSysLock) {.stdcall, noSideEffect, + proc initSysLock(L: var TSysLock) {.stdcall, noSideEffect, dynlib: "kernel32", importc: "InitializeCriticalSection".} ## Initializes the lock `L`. - proc TryAcquireSysAux(L: var TSysLock): int32 {.stdcall, noSideEffect, + proc tryAcquireSysAux(L: var TSysLock): int32 {.stdcall, noSideEffect, dynlib: "kernel32", importc: "TryEnterCriticalSection".} ## Tries to acquire the lock `L`. - proc TryAcquireSys(L: var TSysLock): bool {.inline.} = + proc tryAcquireSys(L: var TSysLock): bool {.inline.} = result = TryAcquireSysAux(L) != 0'i32 - proc AcquireSys(L: var TSysLock) {.stdcall, noSideEffect, + proc acquireSys(L: var TSysLock) {.stdcall, noSideEffect, dynlib: "kernel32", importc: "EnterCriticalSection".} ## Acquires the lock `L`. - proc ReleaseSys(L: var TSysLock) {.stdcall, noSideEffect, + proc releaseSys(L: var TSysLock) {.stdcall, noSideEffect, dynlib: "kernel32", importc: "LeaveCriticalSection".} ## Releases the lock `L`. - proc DeinitSys(L: var TSysLock) {.stdcall, noSideEffect, + proc deinitSys(L: var TSysLock) {.stdcall, noSideEffect, dynlib: "kernel32", importc: "DeleteCriticalSection".} - proc CreateEvent(lpEventAttributes: pointer, + proc createEvent(lpEventAttributes: pointer, bManualReset, bInitialState: int32, lpName: cstring): TSysCond {.stdcall, noSideEffect, dynlib: "kernel32", importc: "CreateEventA".} - proc CloseHandle(hObject: THandle) {.stdcall, noSideEffect, + proc closeHandle(hObject: THandle) {.stdcall, noSideEffect, dynlib: "kernel32", importc: "CloseHandle".} - proc WaitForSingleObject(hHandle: THandle, dwMilliseconds: int32): int32 {. + proc waitForSingleObject(hHandle: THandle, dwMilliseconds: int32): int32 {. stdcall, dynlib: "kernel32", importc: "WaitForSingleObject".} - proc SignalSysCond(hEvent: TSysCond) {.stdcall, noSideEffect, + proc signalSysCond(hEvent: TSysCond) {.stdcall, noSideEffect, dynlib: "kernel32", importc: "SetEvent".} - proc InitSysCond(cond: var TSysCond) {.inline.} = - cond = CreateEvent(nil, 0'i32, 0'i32, nil) - proc DeinitSysCond(cond: var TSysCond) {.inline.} = - CloseHandle(cond) - proc WaitSysCond(cond: var TSysCond, lock: var TSysLock) = + proc initSysCond(cond: var TSysCond) {.inline.} = + cond = createEvent(nil, 0'i32, 0'i32, nil) + proc deinitSysCond(cond: var TSysCond) {.inline.} = + closeHandle(cond) + proc waitSysCond(cond: var TSysCond, lock: var TSysLock) = releaseSys(lock) - discard WaitForSingleObject(cond, -1'i32) + discard waitForSingleObject(cond, -1'i32) acquireSys(lock) + proc waitSysCondWindows(cond: var TSysCond) = + discard waitForSingleObject(cond, -1'i32) + else: type TSysLock {.importc: "pthread_mutex_t", pure, final, @@ -73,29 +76,29 @@ else: TSysCond {.importc: "pthread_cond_t", pure, final, header: "<sys/types.h>".} = object - proc InitSysLock(L: var TSysLock, attr: pointer = nil) {. + proc initSysLock(L: var TSysLock, attr: pointer = nil) {. importc: "pthread_mutex_init", header: "<pthread.h>", noSideEffect.} - proc AcquireSys(L: var TSysLock) {.noSideEffect, + proc acquireSys(L: var TSysLock) {.noSideEffect, importc: "pthread_mutex_lock", header: "<pthread.h>".} - proc TryAcquireSysAux(L: var TSysLock): cint {.noSideEffect, + proc tryAcquireSysAux(L: var TSysLock): cint {.noSideEffect, importc: "pthread_mutex_trylock", header: "<pthread.h>".} - proc TryAcquireSys(L: var TSysLock): bool {.inline.} = - result = TryAcquireSysAux(L) == 0'i32 + proc tryAcquireSys(L: var TSysLock): bool {.inline.} = + result = tryAcquireSysAux(L) == 0'i32 - proc ReleaseSys(L: var TSysLock) {.noSideEffect, + proc releaseSys(L: var TSysLock) {.noSideEffect, importc: "pthread_mutex_unlock", header: "<pthread.h>".} - proc DeinitSys(L: var TSysLock) {. + proc deinitSys(L: var TSysLock) {. importc: "pthread_mutex_destroy", header: "<pthread.h>".} - proc InitSysCond(cond: var TSysCond, cond_attr: pointer = nil) {. + proc initSysCond(cond: var TSysCond, cond_attr: pointer = nil) {. importc: "pthread_cond_init", header: "<pthread.h>".} - proc WaitSysCond(cond: var TSysCond, lock: var TSysLock) {. + proc waitSysCond(cond: var TSysCond, lock: var TSysLock) {. importc: "pthread_cond_wait", header: "<pthread.h>".} - proc SignalSysCond(cond: var TSysCond) {. + proc signalSysCond(cond: var TSysCond) {. importc: "pthread_cond_signal", header: "<pthread.h>".} - proc DeinitSysCond(cond: var TSysCond) {. + proc deinitSysCond(cond: var TSysCond) {. importc: "pthread_cond_destroy", header: "<pthread.h>".} diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index d62a987ff..4244bae4c 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -55,7 +55,7 @@ proc copyStrLast(s: NimString, start, last: int): NimString {.compilerProc.} = if len > 0: result = rawNewString(len) result.len = len - c_memcpy(result.data, addr(s.data[start]), len * sizeof(Char)) + c_memcpy(result.data, addr(s.data[start]), len * sizeof(char)) #result.data[len] = '\0' else: result = rawNewString(len) @@ -63,14 +63,14 @@ proc copyStrLast(s: NimString, start, last: int): NimString {.compilerProc.} = proc copyStr(s: NimString, start: int): NimString {.compilerProc.} = result = copyStrLast(s, start, s.len-1) -proc toNimStr(str: CString, len: int): NimString {.compilerProc.} = +proc toNimStr(str: cstring, len: int): NimString {.compilerProc.} = result = rawNewString(len) result.len = len - c_memcpy(result.data, str, (len+1) * sizeof(Char)) + c_memcpy(result.data, str, (len+1) * sizeof(char)) #result.data[len] = '\0' # readline relies on this! -proc cstrToNimstr(str: CString): NimString {.compilerRtl.} = - result = toNimstr(str, c_strlen(str)) +proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} = + result = toNimStr(str, c_strlen(str)) proc copyString(src: NimString): NimString {.compilerRtl.} = if src != nil: @@ -79,7 +79,7 @@ proc copyString(src: NimString): NimString {.compilerRtl.} = else: result = rawNewString(src.space) result.len = src.len - c_memcpy(result.data, src.data, (src.len + 1) * sizeof(Char)) + c_memcpy(result.data, src.data, (src.len + 1) * sizeof(char)) proc copyStringRC1(src: NimString): NimString {.compilerRtl.} = if src != nil: @@ -98,8 +98,8 @@ proc hashString(s: string): int {.compilerproc.} = # the compiler needs exactly the same hash function! # this used to be used for efficient generation of string case statements var h = 0 - for i in 0..Len(s)-1: - h = h +% Ord(s[i]) + for i in 0..len(s)-1: + h = h +% ord(s[i]) h = h +% h shl 10 h = h xor (h shr 6) h = h +% h shl 3 @@ -150,10 +150,10 @@ proc addChar(s: NimString, c: char): NimString = # s = rawNewString(0); proc resizeString(dest: NimString, addlen: int): NimString {.compilerRtl.} = - if dest.len + addLen <= dest.space: + if dest.len + addlen <= dest.space: result = dest else: # slow path: - var sp = max(resize(dest.space), dest.len + addLen) + var sp = max(resize(dest.space), dest.len + addlen) result = cast[NimString](growObj(dest, sizeof(TGenericSeq) + sp + 1)) result.reserved = sp #result = rawNewString(sp) @@ -236,7 +236,7 @@ proc nimIntToStr(x: int): string {.compilerRtl.} = result = newString(sizeof(x)*4) var i = 0 var y = x - while True: + while true: var d = y div 10 result[i] = chr(abs(int(y - d*10)) + ord('0')) inc(i) @@ -259,7 +259,7 @@ proc nimInt64ToStr(x: int64): string {.compilerRtl.} = result = newString(sizeof(x)*4) var i = 0 var y = x - while True: + while true: var d = y div 10 result[i] = chr(abs(int(y - d*10)) + ord('0')) inc(i) @@ -280,7 +280,7 @@ proc nimCharToStr(x: char): string {.compilerRtl.} = result = newString(1) result[0] = x -proc binaryStrSearch(x: openarray[string], y: string): int {.compilerproc.} = +proc binaryStrSearch(x: openArray[string], y: string): int {.compilerproc.} = var a = 0 b = len(x) diff --git a/lib/system/threads.nim b/lib/system/threads.nim index 7d74de92d..ff9ab6cc0 100644 --- a/lib/system/threads.nim +++ b/lib/system/threads.nim @@ -29,16 +29,19 @@ ## ## proc threadFunc(interval: tuple[a,b: int]) {.thread.} = ## for i in interval.a..interval.b: -## Acquire(L) # lock stdout +## acquire(L) # lock stdout ## echo i -## Release(L) +## release(L) ## -## InitLock(L) +## initLock(L) ## ## for i in 0..high(thr): ## createThread(thr[i], threadFunc, (i*10, i*10+5)) ## joinThreads(thr) +when not defined(NimString): + {.error: "You must not import this module explicitly".} + const maxRegisters = 256 # don't think there is an arch with more registers useStackMaskHack = false ## use the stack mask hack for better performance @@ -51,9 +54,9 @@ when defined(windows): TSysThread = THandle TWinThreadProc = proc (x: pointer): int32 {.stdcall.} - proc CreateThread(lpThreadAttributes: Pointer, dwStackSize: int32, + proc createThread(lpThreadAttributes: pointer, dwStackSize: int32, lpStartAddress: TWinThreadProc, - lpParameter: Pointer, + lpParameter: pointer, dwCreationFlags: int32, lpThreadId: var int32): TSysThread {. stdcall, dynlib: "kernel32", importc: "CreateThread".} @@ -64,23 +67,23 @@ when defined(windows): proc winResumeThread(hThread: TSysThread): int32 {. stdcall, dynlib: "kernel32", importc: "ResumeThread".} - proc WaitForMultipleObjects(nCount: int32, + proc waitForMultipleObjects(nCount: int32, lpHandles: ptr TSysThread, bWaitAll: int32, dwMilliseconds: int32): int32 {. stdcall, dynlib: "kernel32", importc: "WaitForMultipleObjects".} - proc TerminateThread(hThread: TSysThread, dwExitCode: int32): int32 {. + proc terminateThread(hThread: TSysThread, dwExitCode: int32): int32 {. stdcall, dynlib: "kernel32", importc: "TerminateThread".} type TThreadVarSlot = distinct int32 - proc ThreadVarAlloc(): TThreadVarSlot {. + proc threadVarAlloc(): TThreadVarSlot {. importc: "TlsAlloc", stdcall, dynlib: "kernel32".} - proc ThreadVarSetValue(dwTlsIndex: TThreadVarSlot, lpTlsValue: pointer) {. + proc threadVarSetValue(dwTlsIndex: TThreadVarSlot, lpTlsValue: pointer) {. importc: "TlsSetValue", stdcall, dynlib: "kernel32".} - proc ThreadVarGetValue(dwTlsIndex: TThreadVarSlot): pointer {. + proc threadVarGetValue(dwTlsIndex: TThreadVarSlot): pointer {. importc: "TlsGetValue", stdcall, dynlib: "kernel32".} else: @@ -113,14 +116,14 @@ else: proc pthread_cancel(a1: TSysThread): cint {. importc: "pthread_cancel", header: "<pthread.h>".} - proc AcquireSysTimeoutAux(L: var TSysLock, timeout: var Ttimespec): cint {. + proc acquireSysTimeoutAux(L: var TSysLock, timeout: var Ttimespec): cint {. importc: "pthread_mutex_timedlock", header: "<time.h>".} - proc AcquireSysTimeout(L: var TSysLock, msTimeout: int) {.inline.} = + proc acquireSysTimeout(L: var TSysLock, msTimeout: int) {.inline.} = var a: Ttimespec a.tv_sec = msTimeout div 1000 a.tv_nsec = (msTimeout mod 1000) * 1000 - var res = AcquireSysTimeoutAux(L, a) + var res = acquireSysTimeoutAux(L, a) if res != 0'i32: raise newException(EResourceExhausted, $strerror(res)) type @@ -138,11 +141,11 @@ else: proc pthread_setspecific(a1: TThreadVarSlot, a2: pointer): int32 {. importc: "pthread_setspecific", header: "<pthread.h>".} - proc ThreadVarAlloc(): TThreadVarSlot {.inline.} = + proc threadVarAlloc(): TThreadVarSlot {.inline.} = discard pthread_key_create(addr(result), nil) - proc ThreadVarSetValue(s: TThreadVarSlot, value: pointer) {.inline.} = + proc threadVarSetValue(s: TThreadVarSlot, value: pointer) {.inline.} = discard pthread_setspecific(s, value) - proc ThreadVarGetValue(s: TThreadVarSlot): pointer {.inline.} = + proc threadVarGetValue(s: TThreadVarSlot): pointer {.inline.} = result = pthread_getspecific(s) when useStackMaskHack: @@ -156,7 +159,7 @@ const when emulatedThreadVars: # the compiler generates this proc for us, so that we can get the size of # the thread local var block; we use this only for sanity checking though - proc NimThreadVarsSize(): int {.noconv, importc: "NimThreadVarsSize".} + proc nimThreadVarsSize(): int {.noconv, importc: "NimThreadVarsSize".} # we preallocate a fixed size for thread local storage, so that no heap # allocations are needed. Currently less than 7K are used on a 64bit machine. @@ -181,7 +184,7 @@ type # XXX it'd be more efficient to not use a global variable for the # thread storage slot, but to rely on the implementation to assign slot X # for us... ;-) -var globalsSlot = ThreadVarAlloc() +var globalsSlot = threadVarAlloc() #const globalsSlot = TThreadVarSlot(0) #sysAssert checkSlot.int == globalsSlot.int @@ -190,7 +193,7 @@ when emulatedThreadVars: result = addr(cast[PGcThread](ThreadVarGetValue(globalsSlot)).tls) when useStackMaskHack: - proc MaskStackPointer(offset: int): pointer {.compilerRtl, inl.} = + proc maskStackPointer(offset: int): pointer {.compilerRtl, inl.} = var x {.volatile.}: pointer x = addr(x) result = cast[pointer]((cast[int](x) and not ThreadStackMask) +% @@ -202,7 +205,7 @@ when not defined(useNimRtl): when not useStackMaskHack: var mainThread: TGcThread - ThreadVarSetValue(globalsSlot, addr(mainThread)) + threadVarSetValue(globalsSlot, addr(mainThread)) when not defined(createNimRtl): initStackBottom() initGC() @@ -217,18 +220,18 @@ when not defined(useNimRtl): proc registerThread(t: PGcThread) = # we need to use the GC global lock here! - AcquireSys(HeapLock) + acquireSys(HeapLock) t.prev = nil t.next = threadList if threadList != nil: sysAssert(threadList.prev == nil, "threadList.prev == nil") threadList.prev = t threadList = t - ReleaseSys(HeapLock) + releaseSys(HeapLock) proc unregisterThread(t: PGcThread) = # we need to use the GC global lock here! - AcquireSys(HeapLock) + acquireSys(HeapLock) if t == threadList: threadList = t.next if t.next != nil: t.next.prev = t.prev if t.prev != nil: t.prev.next = t.next @@ -236,7 +239,7 @@ when not defined(useNimRtl): # code executes `destroyThread`: t.next = nil t.prev = nil - ReleaseSys(HeapLock) + releaseSys(HeapLock) # on UNIX, the GC uses ``SIGFREEZE`` to tell every thread to stop so that # the GC can examine the stacks? @@ -263,7 +266,7 @@ type when not defined(boehmgc) and not hasSharedHeap: proc deallocOsPages() -template ThreadProcWrapperBody(closure: expr) {.immediate.} = +template threadProcWrapperBody(closure: expr) {.immediate.} = when defined(globalsSlot): ThreadVarSetValue(globalsSlot, closure) var t = cast[ptr TThread[TArg]](closure) when useStackMaskHack: @@ -291,11 +294,11 @@ template ThreadProcWrapperBody(closure: expr) {.immediate.} = {.push stack_trace:off.} when defined(windows): proc threadProcWrapper[TArg](closure: pointer): int32 {.stdcall.} = - ThreadProcWrapperBody(closure) - # implicitely return 0 + threadProcWrapperBody(closure) + # implicitly return 0 else: proc threadProcWrapper[TArg](closure: pointer) {.noconv.} = - ThreadProcWrapperBody(closure) + threadProcWrapperBody(closure) {.pop.} proc running*[TArg](t: TThread[TArg]): bool {.inline.} = @@ -305,7 +308,7 @@ proc running*[TArg](t: TThread[TArg]): bool {.inline.} = proc joinThread*[TArg](t: TThread[TArg]) {.inline.} = ## waits for the thread `t` to finish. when hostOS == "windows": - discard WaitForSingleObject(t.sys, -1'i32) + discard waitForSingleObject(t.sys, -1'i32) else: discard pthread_join(t.sys, nil) @@ -315,7 +318,7 @@ proc joinThreads*[TArg](t: varargs[TThread[TArg]]) = var a: array[0..255, TSysThread] sysAssert a.len >= t.len, "a.len >= t.len" for i in 0..t.high: a[i] = t[i].sys - discard WaitForMultipleObjects(t.len.int32, + discard waitForMultipleObjects(t.len.int32, cast[ptr TSysThread](addr(a)), 1, -1) else: for i in 0..t.high: joinThread(t[i]) @@ -343,7 +346,7 @@ proc createThread*[TArg](t: var TThread[TArg], when hasSharedHeap: t.stackSize = ThreadStackSize when hostOS == "windows": var dummyThreadId: int32 - t.sys = CreateThread(nil, ThreadStackSize, threadProcWrapper[TArg], + t.sys = createThread(nil, ThreadStackSize, threadProcWrapper[TArg], addr(t), 0'i32, dummyThreadId) if t.sys <= 0: raise newException(EResourceExhausted, "cannot create thread") diff --git a/lib/system/widestrs.nim b/lib/system/widestrs.nim index cf1f0910c..e2a5d87e9 100644 --- a/lib/system/widestrs.nim +++ b/lib/system/widestrs.nim @@ -1,149 +1,153 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2012 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## Nimrod support for C/C++'s `wide strings`:idx:. This is part of the system -## module! Do not import it directly! - -type - TUtf16Char* = distinct int16 - WideCString* = ref array[0.. 1_000_000, TUtf16Char] - -proc len*(w: WideCString): int = - ## returns the length of a widestring. This traverses the whole string to - ## find the binary zero end marker! - while int16(w[result]) != 0'i16: inc result - -const - UNI_REPLACEMENT_CHAR = TUtf16Char(0xFFFD'i16) - UNI_MAX_BMP = 0x0000FFFF - UNI_MAX_UTF16 = 0x0010FFFF - UNI_MAX_UTF32 = 0x7FFFFFFF - UNI_MAX_LEGAL_UTF32 = 0x0010FFFF - - halfShift = 10 - halfBase = 0x0010000 - halfMask = 0x3FF - - UNI_SUR_HIGH_START = 0xD800 - UNI_SUR_HIGH_END = 0xDBFF - UNI_SUR_LOW_START = 0xDC00 - UNI_SUR_LOW_END = 0xDFFF - -template ones(n: expr): expr = ((1 shl n)-1) - -template fastRuneAt(s: cstring, i: int, result: expr, doInc = true) = - ## Returns the unicode character ``s[i]`` in `result`. If ``doInc == true`` - ## `i` is incremented by the number of bytes that have been processed. - bind ones - - if ord(s[i]) <=% 127: - result = ord(s[i]) - when doInc: inc(i) - elif ord(s[i]) shr 5 == 0b110: - #assert(ord(s[i+1]) shr 6 == 0b10) - result = (ord(s[i]) and (ones(5))) shl 6 or (ord(s[i+1]) and ones(6)) - when doInc: inc(i, 2) - elif ord(s[i]) shr 4 == 0b1110: - #assert(ord(s[i+1]) shr 6 == 0b10) - #assert(ord(s[i+2]) shr 6 == 0b10) - result = (ord(s[i]) and ones(4)) shl 12 or - (ord(s[i+1]) and ones(6)) shl 6 or - (ord(s[i+2]) and ones(6)) - when doInc: inc(i, 3) - elif ord(s[i]) shr 3 == 0b11110: - #assert(ord(s[i+1]) shr 6 == 0b10) - #assert(ord(s[i+2]) shr 6 == 0b10) - #assert(ord(s[i+3]) shr 6 == 0b10) - result = (ord(s[i]) and ones(3)) shl 18 or - (ord(s[i+1]) and ones(6)) shl 12 or - (ord(s[i+2]) and ones(6)) shl 6 or - (ord(s[i+3]) and ones(6)) - when doInc: inc(i, 4) - else: - result = 0xFFFD - when doInc: inc(i) - -iterator runes(s: cstring): int = - var - i = 0 - result: int - while s[i] != '\0': - fastRuneAt(s, i, result, true) - yield result - -proc newWideCString*(source: cstring, L: int): WideCString = +# +# +# Nimrod's Runtime Library +# (c) Copyright 2012 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## Nimrod support for C/C++'s `wide strings`:idx:. This is part of the system +## module! Do not import it directly! + +when not defined(NimString): + {.error: "You must not import this module explicitly".} + +type + TUtf16Char* = distinct int16 + WideCString* = ref array[0.. 1_000_000, TUtf16Char] + +proc len*(w: WideCString): int = + ## returns the length of a widestring. This traverses the whole string to + ## find the binary zero end marker! + while int16(w[result]) != 0'i16: inc result + +const + UNI_REPLACEMENT_CHAR = TUtf16Char(0xFFFD'i16) + UNI_MAX_BMP = 0x0000FFFF + UNI_MAX_UTF16 = 0x0010FFFF + UNI_MAX_UTF32 = 0x7FFFFFFF + UNI_MAX_LEGAL_UTF32 = 0x0010FFFF + + halfShift = 10 + halfBase = 0x0010000 + halfMask = 0x3FF + + UNI_SUR_HIGH_START = 0xD800 + UNI_SUR_HIGH_END = 0xDBFF + UNI_SUR_LOW_START = 0xDC00 + UNI_SUR_LOW_END = 0xDFFF + +template ones(n: expr): expr = ((1 shl n)-1) + +template fastRuneAt(s: cstring, i: int, result: expr, doInc = true) = + ## Returns the unicode character ``s[i]`` in `result`. If ``doInc == true`` + ## `i` is incremented by the number of bytes that have been processed. + bind ones + + if ord(s[i]) <=% 127: + result = ord(s[i]) + when doInc: inc(i) + elif ord(s[i]) shr 5 == 0b110: + #assert(ord(s[i+1]) shr 6 == 0b10) + result = (ord(s[i]) and (ones(5))) shl 6 or (ord(s[i+1]) and ones(6)) + when doInc: inc(i, 2) + elif ord(s[i]) shr 4 == 0b1110: + #assert(ord(s[i+1]) shr 6 == 0b10) + #assert(ord(s[i+2]) shr 6 == 0b10) + result = (ord(s[i]) and ones(4)) shl 12 or + (ord(s[i+1]) and ones(6)) shl 6 or + (ord(s[i+2]) and ones(6)) + when doInc: inc(i, 3) + elif ord(s[i]) shr 3 == 0b11110: + #assert(ord(s[i+1]) shr 6 == 0b10) + #assert(ord(s[i+2]) shr 6 == 0b10) + #assert(ord(s[i+3]) shr 6 == 0b10) + result = (ord(s[i]) and ones(3)) shl 18 or + (ord(s[i+1]) and ones(6)) shl 12 or + (ord(s[i+2]) and ones(6)) shl 6 or + (ord(s[i+3]) and ones(6)) + when doInc: inc(i, 4) + else: + result = 0xFFFD + when doInc: inc(i) + +iterator runes(s: cstring): int = + var + i = 0 + result: int + while s[i] != '\0': + fastRuneAt(s, i, result, true) + yield result + +proc newWideCString*(source: cstring, L: int): WideCString = unsafeNew(result, L * 4 + 2) - #result = cast[wideCString](alloc(L * 4 + 2)) - var d = 0 - for ch in runes(source): - if ch <=% UNI_MAX_BMP: - if ch >=% UNI_SUR_HIGH_START and ch <=% UNI_SUR_LOW_END: - result[d] = UNI_REPLACEMENT_CHAR - else: - result[d] = TUtf16Char(toU16(ch)) - elif ch >% UNI_MAX_UTF16: - result[d] = UNI_REPLACEMENT_CHAR - else: - let ch = ch -% halfBase - result[d] = TUtf16Char(toU16((ch shr halfShift) +% UNI_SUR_HIGH_START)) - inc d - result[d] = TUtf16Char(toU16((ch and halfMask) +% UNI_SUR_LOW_START)) - inc d - result[d] = TUtf16Char(0'i16) - -proc newWideCString*(s: cstring): WideCString = - if s.isNil: return nil - - when not defined(c_strlen): - proc c_strlen(a: CString): int {.nodecl, noSideEffect, importc: "strlen".} - - let L = cstrlen(s) - result = newWideCString(s, L) - -proc newWideCString*(s: string): WideCString = - result = newWideCString(s, s.len) - -proc `$`*(w: wideCString, estimate: int): string = - result = newStringOfCap(estimate + estimate shr 2) - - var i = 0 - while w[i].int16 != 0'i16: - var ch = w[i].int - inc i - if ch >=% UNI_SUR_HIGH_START and ch <=% UNI_SUR_HIGH_END: - # If the 16 bits following the high surrogate are in the source buffer... - let ch2 = w[i].int - # If it's a low surrogate, convert to UTF32: - if ch2 >=% UNI_SUR_LOW_START and ch2 <=% UNI_SUR_LOW_END: - ch = ((ch -% UNI_SUR_HIGH_START) shr halfShift) +% - (ch2 -% UNI_SUR_LOW_START) +% halfBase - inc i - - if ch <=% 127: - result.add chr(ch) - elif ch <=% 0x07FF: - result.add chr((ch shr 6) or 0b110_00000) - result.add chr((ch and ones(6)) or 0b10_000000) - elif ch <=% 0xFFFF: - result.add chr(ch shr 12 or 0b1110_0000) - result.add chr(ch shr 6 and ones(6) or 0b10_0000_00) - result.add chr(ch and ones(6) or 0b10_0000_00) - elif ch <=% 0x0010FFFF: - result.add chr(ch shr 18 or 0b1111_0000) - result.add chr(ch shr 12 and ones(6) or 0b10_0000_00) - result.add chr(ch shr 6 and ones(6) or 0b10_0000_00) - result.add chr(ch and ones(6) or 0b10_0000_00) - else: - # replacement char: - result.add chr(0xFFFD shr 12 or 0b1110_0000) - result.add chr(0xFFFD shr 6 and ones(6) or 0b10_0000_00) - result.add chr(0xFFFD and ones(6) or 0b10_0000_00) - -proc `$`*(s: WideCString): string = - result = s $ 80 + #result = cast[wideCString](alloc(L * 4 + 2)) + var d = 0 + for ch in runes(source): + if ch <=% UNI_MAX_BMP: + if ch >=% UNI_SUR_HIGH_START and ch <=% UNI_SUR_LOW_END: + result[d] = UNI_REPLACEMENT_CHAR + else: + result[d] = TUtf16Char(toU16(ch)) + elif ch >% UNI_MAX_UTF16: + result[d] = UNI_REPLACEMENT_CHAR + else: + let ch = ch -% halfBase + result[d] = TUtf16Char(toU16((ch shr halfShift) +% UNI_SUR_HIGH_START)) + inc d + result[d] = TUtf16Char(toU16((ch and halfMask) +% UNI_SUR_LOW_START)) + inc d + result[d] = TUtf16Char(0'i16) + +proc newWideCString*(s: cstring): WideCString = + if s.isNil: return nil + + when not defined(c_strlen): + proc c_strlen(a: cstring): int {. + header: "<string.h>", noSideEffect, importc: "strlen".} + + let L = c_strlen(s) + result = newWideCString(s, L) + +proc newWideCString*(s: string): WideCString = + result = newWideCString(s, s.len) + +proc `$`*(w: WideCString, estimate: int): string = + result = newStringOfCap(estimate + estimate shr 2) + + var i = 0 + while w[i].int16 != 0'i16: + var ch = w[i].int + inc i + if ch >=% UNI_SUR_HIGH_START and ch <=% UNI_SUR_HIGH_END: + # If the 16 bits following the high surrogate are in the source buffer... + let ch2 = w[i].int + # If it's a low surrogate, convert to UTF32: + if ch2 >=% UNI_SUR_LOW_START and ch2 <=% UNI_SUR_LOW_END: + ch = ((ch -% UNI_SUR_HIGH_START) shr halfShift) +% + (ch2 -% UNI_SUR_LOW_START) +% halfBase + inc i + + if ch <=% 127: + result.add chr(ch) + elif ch <=% 0x07FF: + result.add chr((ch shr 6) or 0b110_00000) + result.add chr((ch and ones(6)) or 0b10_000000) + elif ch <=% 0xFFFF: + result.add chr(ch shr 12 or 0b1110_0000) + result.add chr(ch shr 6 and ones(6) or 0b10_0000_00) + result.add chr(ch and ones(6) or 0b10_0000_00) + elif ch <=% 0x0010FFFF: + result.add chr(ch shr 18 or 0b1111_0000) + result.add chr(ch shr 12 and ones(6) or 0b10_0000_00) + result.add chr(ch shr 6 and ones(6) or 0b10_0000_00) + result.add chr(ch and ones(6) or 0b10_0000_00) + else: + # replacement char: + result.add chr(0xFFFD shr 12 or 0b1110_0000) + result.add chr(0xFFFD shr 6 and ones(6) or 0b10_0000_00) + result.add chr(0xFFFD and ones(6) or 0b10_0000_00) + +proc `$`*(s: WideCString): string = + result = s $ 80 diff --git a/lib/windows/windows.nim b/lib/windows/windows.nim index 9b55b47b9..dd743ffa4 100644 --- a/lib/windows/windows.nim +++ b/lib/windows/windows.nim @@ -21856,15 +21856,9 @@ proc InflateRect*(lprc: var TRect, dx, dy: int): WINBOOL{.stdcall, dynlib: "user32", importc: "InflateRect".} proc InitializeAcl*(pAcl: var TACL, nAclLength, dwAclRevision: DWORD): WINBOOL{. stdcall, dynlib: "advapi32", importc: "InitializeAcl".} -proc InitializeCriticalSectionAndSpinCount*( - lpCriticalSection: var TRTLCriticalSection, dwSpinCount: DWORD): WINBOOL{. - stdcall, dynlib: "kernel32", - importc: "InitializeCriticalSectionAndSpinCount".} proc InitializeSid*(Sid: Pointer, pIdentifierAuthority: TSIDIdentifierAuthority, nSubAuthorityCount: int8): WINBOOL{.stdcall, dynlib: "advapi32", importc: "InitializeSid".} -proc InsertMenuItem*(p1: HMENU, p2: UINT, p3: WINBOOL, p4: TMenuItemInfo): WINBOOL{. - stdcall, dynlib: "user32", importc: "InsertMenuItemA".} proc InsertMenuItemA*(p1: HMENU, p2: UINT, p3: WINBOOL, p4: TMenuItemInfoA): WINBOOL{. stdcall, dynlib: "user32", importc: "InsertMenuItemA".} #function InsertMenuItemW(p1: HMENU; p2: UINT; p3: WINBOOL; const p4: TMenuItemInfoW): WINBOOL; stdcall; external 'user32' name 'InsertMenuItemW'; @@ -22362,11 +22356,6 @@ proc SetConsoleCursorInfo*(hConsoleOutput: THandle, lpConsoleCursorInfo: TConsoleCursorInfo): WINBOOL{. stdcall, dynlib: "kernel32", importc: "SetConsoleCursorInfo".} #function SetConsoleWindowInfo(hConsoleOutput: THandle; bAbsolute: WINBOOL; const lpConsoleWindow: TSmallRect): WINBOOL; stdcall; external 'kernel32' name 'SetConsoleWindowInfo'; -proc SetCriticalSectionSpinCount*(lpCriticalSection: var TRTLCriticalSection, - dwSpinCount: DWORD): DWORD{.stdcall, - dynlib: "kernel32", importc: "SetCriticalSectionSpinCount".} -proc SetDeviceGammaRamp*(DC: HDC, Ramp: pointer): WINBOOL{.stdcall, - dynlib: "gdi32", importc: "SetDeviceGammaRamp".} proc SetDIBColorTable*(DC: HDC, p2, p3: UINT, RGBQuadSTructs: pointer): UINT{. stdcall, dynlib: "gdi32", importc: "SetDIBColorTable".} proc SetDIBits*(DC: HDC, Bitmap: HBITMAP, StartScan, NumScans: UINT, @@ -22476,8 +22465,6 @@ proc TranslateMDISysAccel*(hWndClient: HWND, lpMsg: TMsg): WINBOOL{.stdcall, proc TranslateMessage*(lpMsg: TMsg): WINBOOL{.stdcall, dynlib: "user32", importc: "TranslateMessage".} #function TransparentDIBits(DC: HDC; p2, p3, p4, p5: Integer; const p6: Pointer; const p7: PBitmapInfo; p8: UINT; p9, p10, p11, p12: Integer; p13: UINT): WINBOOL;stdcall; external 'gdi32' name 'TransparentDIBits'; -proc TryEnterCriticalSection*(lpCriticalSection: var TRTLCriticalSection): WINBOOL{. - stdcall, dynlib: "kernel32", importc: "TryEnterCriticalSection".} proc UnhandledExceptionFilter*(ExceptionInfo: TExceptionPointers): int32{. stdcall, dynlib: "kernel32", importc: "UnhandledExceptionFilter".} proc UnionRect*(lprcDst: var TRect, lprcSrc1, lprcSrc2: TRect): WINBOOL{. @@ -22847,12 +22834,6 @@ proc SUBLANGID*(lgid: int32): int32 = # return type might be wrong result = toU16(lgid) shr 10'i16 -proc LANGIDFROMLCID*(lcid: int32): int16 = - result = toU16(lcid) - -proc SORTIDFROMLCID*(lcid: int32): int16 = - result = toU16((lcid and 0x000FFFFF'i32) shr 16'i32) - proc MAKELCID*(lgid, srtid: int32): DWORD = result = toU32(srtid shl 16'i32 or lgid and 0xffff'i32) diff --git a/lib/windows/winlean.nim b/lib/windows/winlean.nim index 56d279db6..5b641185e 100644 --- a/lib/windows/winlean.nim +++ b/lib/windows/winlean.nim @@ -42,13 +42,13 @@ type wShowWindow*: int16 cbReserved2*: int16 lpReserved2*: pointer - hStdInput*: THANDLE - hStdOutput*: THANDLE - hStdError*: THANDLE + hStdInput*: THandle + hStdOutput*: THandle + hStdError*: THandle TPROCESS_INFORMATION* {.final, pure.} = object - hProcess*: THANDLE - hThread*: THANDLE + hProcess*: THandle + hThread*: THandle dwProcessId*: int32 dwThreadId*: int32 @@ -92,39 +92,39 @@ const DETACHED_PROCESS* = 8'i32 SW_SHOWNORMAL* = 1'i32 - INVALID_HANDLE_VALUE* = THANDLE(-1) + INVALID_HANDLE_VALUE* = THandle(-1) CREATE_UNICODE_ENVIRONMENT* = 1024'i32 -proc CloseHandle*(hObject: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32", +proc closeHandle*(hObject: THandle): WINBOOL {.stdcall, dynlib: "kernel32", importc: "CloseHandle".} -proc ReadFile*(hFile: THandle, Buffer: pointer, nNumberOfBytesToRead: int32, +proc readFile*(hFile: THandle, Buffer: pointer, nNumberOfBytesToRead: int32, lpNumberOfBytesRead: var int32, lpOverlapped: pointer): WINBOOL{. stdcall, dynlib: "kernel32", importc: "ReadFile".} -proc WriteFile*(hFile: THandle, Buffer: pointer, nNumberOfBytesToWrite: int32, +proc writeFile*(hFile: THandle, Buffer: pointer, nNumberOfBytesToWrite: int32, lpNumberOfBytesWritten: var int32, lpOverlapped: pointer): WINBOOL{. stdcall, dynlib: "kernel32", importc: "WriteFile".} -proc CreatePipe*(hReadPipe, hWritePipe: var THandle, +proc createPipe*(hReadPipe, hWritePipe: var THandle, lpPipeAttributes: var TSECURITY_ATTRIBUTES, nSize: int32): WINBOOL{. stdcall, dynlib: "kernel32", importc: "CreatePipe".} when useWinUnicode: - proc CreateProcessW*(lpApplicationName, lpCommandLine: widecstring, + proc createProcessW*(lpApplicationName, lpCommandLine: WideCString, lpProcessAttributes: ptr TSECURITY_ATTRIBUTES, lpThreadAttributes: ptr TSECURITY_ATTRIBUTES, bInheritHandles: WINBOOL, dwCreationFlags: int32, - lpEnvironment, lpCurrentDirectory: widecstring, + lpEnvironment, lpCurrentDirectory: WideCString, lpStartupInfo: var TSTARTUPINFO, lpProcessInformation: var TPROCESS_INFORMATION): WINBOOL{. stdcall, dynlib: "kernel32", importc: "CreateProcessW".} else: - proc CreateProcessA*(lpApplicationName, lpCommandLine: cstring, + proc createProcessA*(lpApplicationName, lpCommandLine: cstring, lpProcessAttributes: ptr TSECURITY_ATTRIBUTES, lpThreadAttributes: ptr TSECURITY_ATTRIBUTES, bInheritHandles: WINBOOL, dwCreationFlags: int32, @@ -134,75 +134,92 @@ else: stdcall, dynlib: "kernel32", importc: "CreateProcessA".} -proc SuspendThread*(hThread: THANDLE): int32 {.stdcall, dynlib: "kernel32", +proc suspendThread*(hThread: THandle): int32 {.stdcall, dynlib: "kernel32", importc: "SuspendThread".} -proc ResumeThread*(hThread: THANDLE): int32 {.stdcall, dynlib: "kernel32", +proc resumeThread*(hThread: THandle): int32 {.stdcall, dynlib: "kernel32", importc: "ResumeThread".} -proc WaitForSingleObject*(hHandle: THANDLE, dwMilliseconds: int32): int32 {. +proc waitForSingleObject*(hHandle: THandle, dwMilliseconds: int32): int32 {. stdcall, dynlib: "kernel32", importc: "WaitForSingleObject".} -proc TerminateProcess*(hProcess: THANDLE, uExitCode: int): WINBOOL {.stdcall, +proc terminateProcess*(hProcess: THandle, uExitCode: int): WINBOOL {.stdcall, dynlib: "kernel32", importc: "TerminateProcess".} -proc GetExitCodeProcess*(hProcess: THANDLE, lpExitCode: var int32): WINBOOL {. +proc getExitCodeProcess*(hProcess: THandle, lpExitCode: var int32): WINBOOL {. stdcall, dynlib: "kernel32", importc: "GetExitCodeProcess".} -proc GetStdHandle*(nStdHandle: int32): THANDLE {.stdcall, dynlib: "kernel32", +proc getStdHandle*(nStdHandle: int32): THandle {.stdcall, dynlib: "kernel32", importc: "GetStdHandle".} -proc SetStdHandle*(nStdHandle: int32, hHandle: THANDLE): WINBOOL {.stdcall, +proc setStdHandle*(nStdHandle: int32, hHandle: THandle): WINBOOL {.stdcall, dynlib: "kernel32", importc: "SetStdHandle".} -proc FlushFileBuffers*(hFile: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32", +proc flushFileBuffers*(hFile: THandle): WINBOOL {.stdcall, dynlib: "kernel32", importc: "FlushFileBuffers".} -proc GetLastError*(): int32 {.importc, stdcall, dynlib: "kernel32".} +proc getLastError*(): int32 {.importc: "GetLastError", + stdcall, dynlib: "kernel32".} when useWinUnicode: - proc FormatMessageW*(dwFlags: int32, lpSource: pointer, + proc formatMessageW*(dwFlags: int32, lpSource: pointer, dwMessageId, dwLanguageId: int32, lpBuffer: pointer, nSize: int32, Arguments: pointer): int32 {. - importc, stdcall, dynlib: "kernel32".} + importc: "FormatMessageW", stdcall, dynlib: "kernel32".} else: - proc FormatMessageA*(dwFlags: int32, lpSource: pointer, + proc formatMessageA*(dwFlags: int32, lpSource: pointer, dwMessageId, dwLanguageId: int32, lpBuffer: pointer, nSize: int32, Arguments: pointer): int32 {. - importc, stdcall, dynlib: "kernel32".} + importc: "FormatMessageA", stdcall, dynlib: "kernel32".} -proc LocalFree*(p: pointer) {.importc, stdcall, dynlib: "kernel32".} +proc localFree*(p: pointer) {. + importc: "LocalFree", stdcall, dynlib: "kernel32".} when useWinUnicode: - proc GetCurrentDirectoryW*(nBufferLength: int32, - lpBuffer: widecstring): int32 {. - importc, dynlib: "kernel32", stdcall.} - proc SetCurrentDirectoryW*(lpPathName: widecstring): int32 {. - importc, dynlib: "kernel32", stdcall.} - proc CreateDirectoryW*(pathName: widecstring, security: Pointer=nil): int32 {. + proc getCurrentDirectoryW*(nBufferLength: int32, + lpBuffer: WideCString): int32 {. + importc: "GetCurrentDirectoryW", dynlib: "kernel32", stdcall.} + proc setCurrentDirectoryW*(lpPathName: WideCString): int32 {. + importc: "SetCurrentDirectoryW", dynlib: "kernel32", stdcall.} + proc createDirectoryW*(pathName: WideCString, security: pointer=nil): int32 {. importc: "CreateDirectoryW", dynlib: "kernel32", stdcall.} - proc RemoveDirectoryW*(lpPathName: widecstring): int32 {. - importc, dynlib: "kernel32", stdcall.} - proc SetEnvironmentVariableW*(lpName, lpValue: widecstring): int32 {. - stdcall, dynlib: "kernel32", importc.} + proc removeDirectoryW*(lpPathName: WideCString): int32 {. + importc: "RemoveDirectoryW", dynlib: "kernel32", stdcall.} + proc setEnvironmentVariableW*(lpName, lpValue: WideCString): int32 {. + stdcall, dynlib: "kernel32", importc: "SetEnvironmentVariableW".} - proc GetModuleFileNameW*(handle: THandle, buf: wideCString, - size: int32): int32 {.importc, + proc getModuleFileNameW*(handle: THandle, buf: WideCString, + size: int32): int32 {.importc: "GetModuleFileNameW", dynlib: "kernel32", stdcall.} else: - proc GetCurrentDirectoryA*(nBufferLength: int32, lpBuffer: cstring): int32 {. - importc, dynlib: "kernel32", stdcall.} - proc SetCurrentDirectoryA*(lpPathName: cstring): int32 {. - importc, dynlib: "kernel32", stdcall.} - proc CreateDirectoryA*(pathName: cstring, security: Pointer=nil): int32 {. + proc getCurrentDirectoryA*(nBufferLength: int32, lpBuffer: cstring): int32 {. + importc: "GetCurrentDirectoryA", dynlib: "kernel32", stdcall.} + proc setCurrentDirectoryA*(lpPathName: cstring): int32 {. + importc: "SetCurrentDirectoryA", dynlib: "kernel32", stdcall.} + proc createDirectoryA*(pathName: cstring, security: pointer=nil): int32 {. importc: "CreateDirectoryA", dynlib: "kernel32", stdcall.} - proc RemoveDirectoryA*(lpPathName: cstring): int32 {. - importc, dynlib: "kernel32", stdcall.} - proc SetEnvironmentVariableA*(lpName, lpValue: cstring): int32 {. - stdcall, dynlib: "kernel32", importc.} + proc removeDirectoryA*(lpPathName: cstring): int32 {. + importc: "RemoveDirectoryA", dynlib: "kernel32", stdcall.} + proc setEnvironmentVariableA*(lpName, lpValue: cstring): int32 {. + stdcall, dynlib: "kernel32", importc: "SetEnvironmentVariableA".} + + proc getModuleFileNameA*(handle: THandle, buf: cstring, size: int32): int32 {. + importc: "GetModuleFileNameA", dynlib: "kernel32", stdcall.} + +when useWinUnicode: + proc createSymbolicLinkW*(lpSymlinkFileName, lpTargetFileName: WideCString, + flags: DWORD): int32 {. + importc:"CreateSymbolicLinkW", dynlib: "kernel32", stdcall.} + proc createHardLinkW*(lpFileName, lpExistingFileName: WideCString, + security: pointer=nil): int32 {. + importc:"CreateHardLinkW", dynlib: "kernel32", stdcall.} +else: + proc createSymbolicLinkA*(lpSymlinkFileName, lpTargetFileName: cstring, + flags: DWORD): int32 {. + importc:"CreateSymbolicLinkA", dynlib: "kernel32", stdcall.} + proc createHardLinkA*(lpFileName, lpExistingFileName: cstring, + security: pointer=nil): int32 {. + importc:"CreateHardLinkA", dynlib: "kernel32", stdcall.} - proc GetModuleFileNameA*(handle: THandle, buf: CString, size: int32): int32 {. - importc, dynlib: "kernel32", stdcall.} - const FILE_ATTRIBUTE_ARCHIVE* = 32'i32 FILE_ATTRIBUTE_COMPRESSED* = 2048'i32 @@ -210,6 +227,7 @@ const FILE_ATTRIBUTE_DIRECTORY* = 16'i32 FILE_ATTRIBUTE_HIDDEN* = 2'i32 FILE_ATTRIBUTE_READONLY* = 1'i32 + FILE_ATTRIBUTE_REPARSE_POINT* = 1024'i32 FILE_ATTRIBUTE_SYSTEM* = 4'i32 FILE_ATTRIBUTE_TEMPORARY* = 256'i32 @@ -228,91 +246,97 @@ type cAlternateFileName*: array[0..13, TWinChar] when useWinUnicode: - proc FindFirstFileW*(lpFileName: widecstring, - lpFindFileData: var TWIN32_FIND_DATA): THANDLE {. + proc findFirstFileW*(lpFileName: WideCString, + lpFindFileData: var TWIN32_FIND_DATA): THandle {. stdcall, dynlib: "kernel32", importc: "FindFirstFileW".} - proc FindNextFileW*(hFindFile: THANDLE, + proc findNextFileW*(hFindFile: THandle, lpFindFileData: var TWIN32_FIND_DATA): int32 {. stdcall, dynlib: "kernel32", importc: "FindNextFileW".} else: - proc FindFirstFileA*(lpFileName: cstring, + proc findFirstFileA*(lpFileName: cstring, lpFindFileData: var TWIN32_FIND_DATA): THANDLE {. stdcall, dynlib: "kernel32", importc: "FindFirstFileA".} - proc FindNextFileA*(hFindFile: THANDLE, + proc findNextFileA*(hFindFile: THANDLE, lpFindFileData: var TWIN32_FIND_DATA): int32 {. stdcall, dynlib: "kernel32", importc: "FindNextFileA".} -proc FindClose*(hFindFile: THANDLE) {.stdcall, dynlib: "kernel32", +proc findClose*(hFindFile: THandle) {.stdcall, dynlib: "kernel32", importc: "FindClose".} when useWinUnicode: - proc GetFullPathNameW*(lpFileName: widecstring, nBufferLength: int32, - lpBuffer: widecstring, - lpFilePart: var widecstring): int32 {. - stdcall, dynlib: "kernel32", importc.} - proc GetFileAttributesW*(lpFileName: widecstring): int32 {. - stdcall, dynlib: "kernel32", importc.} - proc SetFileAttributesW*(lpFileName: widecstring, + proc getFullPathNameW*(lpFileName: WideCString, nBufferLength: int32, + lpBuffer: WideCString, + lpFilePart: var WideCString): int32 {. + stdcall, dynlib: "kernel32", + importc: "GetFullPathNameW".} + proc getFileAttributesW*(lpFileName: WideCString): int32 {. + stdcall, dynlib: "kernel32", + importc: "GetFileAttributesW".} + proc setFileAttributesW*(lpFileName: WideCString, dwFileAttributes: int32): WINBOOL {. stdcall, dynlib: "kernel32", importc: "SetFileAttributesW".} - proc CopyFileW*(lpExistingFileName, lpNewFileName: wideCString, + proc copyFileW*(lpExistingFileName, lpNewFileName: WideCString, bFailIfExists: cint): cint {. - importc, stdcall, dynlib: "kernel32".} + importc: "CopyFileW", stdcall, dynlib: "kernel32".} - proc GetEnvironmentStringsW*(): widecstring {. - stdcall, dynlib: "kernel32", importc.} - proc FreeEnvironmentStringsW*(para1: widecstring): int32 {. - stdcall, dynlib: "kernel32", importc.} + proc getEnvironmentStringsW*(): WideCString {. + stdcall, dynlib: "kernel32", importc: "GetEnvironmentStringsW".} + proc freeEnvironmentStringsW*(para1: WideCString): int32 {. + stdcall, dynlib: "kernel32", importc: "FreeEnvironmentStringsW".} - proc GetCommandLineW*(): wideCString {.importc, stdcall, dynlib: "kernel32".} + proc getCommandLineW*(): WideCString {.importc: "GetCommandLineW", + stdcall, dynlib: "kernel32".} else: - proc GetFullPathNameA*(lpFileName: cstring, nBufferLength: int32, + proc getFullPathNameA*(lpFileName: cstring, nBufferLength: int32, lpBuffer: cstring, lpFilePart: var cstring): int32 {. - stdcall, dynlib: "kernel32", importc.} - proc GetFileAttributesA*(lpFileName: cstring): int32 {. - stdcall, dynlib: "kernel32", importc.} - proc SetFileAttributesA*(lpFileName: cstring, + stdcall, dynlib: "kernel32", + importc: "GetFullPathNameA".} + proc getFileAttributesA*(lpFileName: cstring): int32 {. + stdcall, dynlib: "kernel32", + importc: "GetFileAttributesA".} + proc setFileAttributesA*(lpFileName: cstring, dwFileAttributes: int32): WINBOOL {. stdcall, dynlib: "kernel32", importc: "SetFileAttributesA".} - proc CopyFileA*(lpExistingFileName, lpNewFileName: CString, + proc copyFileA*(lpExistingFileName, lpNewFileName: cstring, bFailIfExists: cint): cint {. - importc, stdcall, dynlib: "kernel32".} + importc: "CopyFileA", stdcall, dynlib: "kernel32".} - proc GetEnvironmentStringsA*(): cstring {. - stdcall, dynlib: "kernel32", importc.} - proc FreeEnvironmentStringsA*(para1: cstring): int32 {. - stdcall, dynlib: "kernel32", importc.} + proc getEnvironmentStringsA*(): cstring {. + stdcall, dynlib: "kernel32", importc: "GetEnvironmentStringsA".} + proc freeEnvironmentStringsA*(para1: cstring): int32 {. + stdcall, dynlib: "kernel32", importc: "FreeEnvironmentStringsA".} - proc GetCommandLineA*(): CString {.importc, stdcall, dynlib: "kernel32".} + proc getCommandLineA*(): cstring {. + importc: "GetCommandLineA", stdcall, dynlib: "kernel32".} proc rdFileTime*(f: TFILETIME): int64 = result = ze64(f.dwLowDateTime) or (ze64(f.dwHighDateTime) shl 32) -proc rdFileSize*(f: TWin32FindData): int64 = +proc rdFileSize*(f: TWIN32_FIND_DATA): int64 = result = ze64(f.nFileSizeLow) or (ze64(f.nFileSizeHigh) shl 32) -proc GetSystemTimeAsFileTime*(lpSystemTimeAsFileTime: var TFILETIME) {. +proc getSystemTimeAsFileTime*(lpSystemTimeAsFileTime: var TFILETIME) {. importc: "GetSystemTimeAsFileTime", dynlib: "kernel32", stdcall.} -proc Sleep*(dwMilliseconds: int32){.stdcall, dynlib: "kernel32", +proc sleep*(dwMilliseconds: int32){.stdcall, dynlib: "kernel32", importc: "Sleep".} when useWinUnicode: - proc ShellExecuteW*(HWND: THandle, lpOperation, lpFile, - lpParameters, lpDirectory: widecstring, + proc shellExecuteW*(HWND: THandle, lpOperation, lpFile, + lpParameters, lpDirectory: WideCString, nShowCmd: int32): THandle{. stdcall, dynlib: "shell32.dll", importc: "ShellExecuteW".} else: - proc ShellExecuteA*(HWND: THandle, lpOperation, lpFile, + proc shellExecuteA*(HWND: THandle, lpOperation, lpFile, lpParameters, lpDirectory: cstring, nShowCmd: int32): THandle{. stdcall, dynlib: "shell32.dll", importc: "ShellExecuteA".} -proc GetFileInformationByHandle*(hFile: THandle, +proc getFileInformationByHandle*(hFile: THandle, lpFileInformation: ptr TBY_HANDLE_FILE_INFORMATION): WINBOOL{. stdcall, dynlib: "kernel32", importc: "GetFileInformationByHandle".} @@ -332,7 +356,7 @@ const WSAEWOULDBLOCK* = 10035 WSAEINPROGRESS* = 10036 -proc WSAGetLastError*(): cint {.importc: "WSAGetLastError", dynlib: ws2dll.} +proc wsaGetLastError*(): cint {.importc: "WSAGetLastError", dynlib: ws2dll.} type TSocketHandle* = distinct int @@ -410,23 +434,23 @@ type ai_addr*: ptr TSockAddr ## Socket address of socket. ai_next*: ptr TAddrInfo ## Pointer to next in list. - Tsocklen* = cuint + TSockLen* = cuint var SOMAXCONN* {.importc, header: "Winsock2.h".}: cint INVALID_SOCKET* {.importc, header: "Winsock2.h".}: TSocketHandle SOL_SOCKET* {.importc, header: "Winsock2.h".}: cint - SO_DEBUG* {.importc, header: "Winsock2.h".}: cint ## turn on debugging info recording - SO_ACCEPTCONN* {.importc, header: "Winsock2.h".}: cint # socket has had listen() - SO_REUSEADDR* {.importc, header: "Winsock2.h".}: cint # allow local address reuse - SO_KEEPALIVE* {.importc, header: "Winsock2.h".}: cint # keep connections alive - SO_DONTROUTE* {.importc, header: "Winsock2.h".}: cint # just use interface addresses - SO_BROADCAST* {.importc, header: "Winsock2.h".}: cint # permit sending of broadcast msgs - SO_USELOOPBACK* {.importc, header: "Winsock2.h".}: cint # bypass hardware when possible - SO_LINGER* {.importc, header: "Winsock2.h".}: cint # linger on close if data present - SO_OOBINLINE* {.importc, header: "Winsock2.h".}: cint # leave received OOB data in line - - SO_DONTLINGER* {.importc, header: "Winsock2.h".}: cint + SO_DEBUG* {.importc, header: "Winsock2.h".}: cint ## turn on debugging info recording + SO_ACCEPTCONN* {.importc, header: "Winsock2.h".}: cint # socket has had listen() + SO_REUSEADDR* {.importc, header: "Winsock2.h".}: cint # allow local address reuse + SO_KEEPALIVE* {.importc, header: "Winsock2.h".}: cint # keep connections alive + SO_DONTROUTE* {.importc, header: "Winsock2.h".}: cint # just use interface addresses + SO_BROADCAST* {.importc, header: "Winsock2.h".}: cint # permit sending of broadcast msgs + SO_USELOOPBACK* {.importc, header: "Winsock2.h".}: cint # bypass hardware when possible + SO_LINGER* {.importc, header: "Winsock2.h".}: cint # linger on close if data present + SO_OOBINLINE* {.importc, header: "Winsock2.h".}: cint # leave received OOB data in line + + SO_DONTLINGER* {.importc, header: "Winsock2.h".}: cint SO_EXCLUSIVEADDRUSE* {.importc, header: "Winsock2.h".}: cint # disallow local address reuse proc `==`*(x, y: TSocketHandle): bool {.borrow.} @@ -437,10 +461,10 @@ proc getservbyname*(name, proto: cstring): ptr TServent {. proc getservbyport*(port: cint, proto: cstring): ptr TServent {. stdcall, importc: "getservbyport", dynlib: ws2dll.} -proc gethostbyaddr*(ip: ptr TInAddr, len: cuint, theType: cint): ptr THostEnt {. +proc gethostbyaddr*(ip: ptr TInAddr, len: cuint, theType: cint): ptr Thostent {. stdcall, importc: "gethostbyaddr", dynlib: ws2dll.} -proc gethostbyname*(name: cstring): ptr THostEnt {. +proc gethostbyname*(name: cstring): ptr Thostent {. stdcall, importc: "gethostbyname", dynlib: ws2dll.} proc socket*(af, typ, protocol: cint): TSocketHandle {. @@ -470,7 +494,7 @@ proc listen*(s: TSocketHandle, backlog: cint): cint {. proc recv*(s: TSocketHandle, buf: pointer, len, flags: cint): cint {. stdcall, importc: "recv", dynlib: ws2dll.} proc recvfrom*(s: TSocketHandle, buf: cstring, len, flags: cint, - fromm: ptr TSockAddr, fromlen: ptr Tsocklen): cint {. + fromm: ptr TSockAddr, fromlen: ptr TSockLen): cint {. stdcall, importc: "recvfrom", dynlib: ws2dll.} proc select*(nfds: cint, readfds, writefds, exceptfds: ptr TFdSet, timeout: ptr TTimeval): cint {. @@ -478,35 +502,35 @@ proc select*(nfds: cint, readfds, writefds, exceptfds: ptr TFdSet, proc send*(s: TSocketHandle, buf: pointer, len, flags: cint): cint {. stdcall, importc: "send", dynlib: ws2dll.} proc sendto*(s: TSocketHandle, buf: pointer, len, flags: cint, - to: ptr TSockAddr, tolen: Tsocklen): cint {. + to: ptr TSockAddr, tolen: TSockLen): cint {. stdcall, importc: "sendto", dynlib: ws2dll.} proc shutdown*(s: TSocketHandle, how: cint): cint {. stdcall, importc: "shutdown", dynlib: ws2dll.} -proc getnameinfo*(a1: ptr Tsockaddr, a2: Tsocklen, - a3: cstring, a4: Tsocklen, a5: cstring, - a6: Tsocklen, a7: cint): cint {. +proc getnameinfo*(a1: ptr TSockAddr, a2: TSockLen, + a3: cstring, a4: TSockLen, a5: cstring, + a6: TSockLen, a7: cint): cint {. stdcall, importc: "getnameinfo", dynlib: ws2dll.} proc inet_addr*(cp: cstring): int32 {. stdcall, importc: "inet_addr", dynlib: ws2dll.} -proc WSAFDIsSet(s: TSocketHandle, FDSet: var TFDSet): bool {. +proc WSAFDIsSet(s: TSocketHandle, FDSet: var TFdSet): bool {. stdcall, importc: "__WSAFDIsSet", dynlib: ws2dll.} -proc FD_ISSET*(Socket: TSocketHandle, FDSet: var TFDSet): cint = +proc FD_ISSET*(Socket: TSocketHandle, FDSet: var TFdSet): cint = result = if WSAFDIsSet(Socket, FDSet): 1'i32 else: 0'i32 -proc FD_SET*(Socket: TSocketHandle, FDSet: var TFDSet) = +proc FD_SET*(Socket: TSocketHandle, FDSet: var TFdSet) = if FDSet.fd_count < FD_SETSIZE: FDSet.fd_array[int(FDSet.fd_count)] = Socket inc(FDSet.fd_count) -proc FD_ZERO*(FDSet: var TFDSet) = +proc FD_ZERO*(FDSet: var TFdSet) = FDSet.fd_count = 0 -proc WSAStartup*(wVersionRequired: int16, WSData: ptr TWSAData): cint {. +proc wsaStartup*(wVersionRequired: int16, WSData: ptr TWSAData): cint {. stdcall, importc: "WSAStartup", dynlib: ws2dll.} proc getaddrinfo*(nodename, servname: cstring, hints: ptr TAddrInfo, @@ -523,10 +547,10 @@ const MAXIMUM_WAIT_OBJECTS* = 0x00000040 type - TWOHandleArray* = array[0..MAXIMUM_WAIT_OBJECTS - 1, THANDLE] + TWOHandleArray* = array[0..MAXIMUM_WAIT_OBJECTS - 1, THandle] PWOHandleArray* = ptr TWOHandleArray -proc WaitForMultipleObjects*(nCount: DWORD, lpHandles: PWOHandleArray, +proc waitForMultipleObjects*(nCount: DWORD, lpHandles: PWOHandleArray, bWaitAll: WINBOOL, dwMilliseconds: DWORD): DWORD{. stdcall, dynlib: "kernel32", importc: "WaitForMultipleObjects".} @@ -553,50 +577,58 @@ const FILE_FLAG_BACKUP_SEMANTICS* = 33554432'i32 +# Error Constants +const + ERROR_ACCESS_DENIED* = 5 + when useWinUnicode: - proc CreateFileW*(lpFileName: widecstring, dwDesiredAccess, dwShareMode: DWORD, + proc createFileW*(lpFileName: WideCString, dwDesiredAccess, dwShareMode: DWORD, lpSecurityAttributes: pointer, dwCreationDisposition, dwFlagsAndAttributes: DWORD, - hTemplateFile: THANDLE): THANDLE {. + hTemplateFile: THandle): THandle {. stdcall, dynlib: "kernel32", importc: "CreateFileW".} + proc deleteFileW*(pathName: WideCString): int32 {. + importc: "DeleteFileW", dynlib: "kernel32", stdcall.} else: - proc CreateFileA*(lpFileName: cstring, dwDesiredAccess, dwShareMode: DWORD, + proc createFileA*(lpFileName: cstring, dwDesiredAccess, dwShareMode: DWORD, lpSecurityAttributes: pointer, dwCreationDisposition, dwFlagsAndAttributes: DWORD, hTemplateFile: THANDLE): THANDLE {. stdcall, dynlib: "kernel32", importc: "CreateFileA".} + proc deleteFileA*(pathName: cstring): int32 {. + importc: "DeleteFileA", dynlib: "kernel32", stdcall.} -proc SetEndOfFile*(hFile: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32", +proc setEndOfFile*(hFile: THandle): WINBOOL {.stdcall, dynlib: "kernel32", importc: "SetEndOfFile".} -proc SetFilePointer*(hFile: THANDLE, lDistanceToMove: LONG, +proc setFilePointer*(hFile: THandle, lDistanceToMove: LONG, lpDistanceToMoveHigh: ptr LONG, dwMoveMethod: DWORD): DWORD {. stdcall, dynlib: "kernel32", importc: "SetFilePointer".} -proc GetFileSize*(hFile: THANDLE, lpFileSizeHigh: ptr DWORD): DWORD{.stdcall, +proc getFileSize*(hFile: THandle, lpFileSizeHigh: ptr DWORD): DWORD{.stdcall, dynlib: "kernel32", importc: "GetFileSize".} -proc MapViewOfFileEx*(hFileMappingObject: THANDLE, dwDesiredAccess: DWORD, +proc mapViewOfFileEx*(hFileMappingObject: THandle, dwDesiredAccess: DWORD, dwFileOffsetHigh, dwFileOffsetLow: DWORD, dwNumberOfBytesToMap: DWORD, lpBaseAddress: pointer): pointer{. stdcall, dynlib: "kernel32", importc: "MapViewOfFileEx".} -proc CreateFileMappingW*(hFile: THANDLE, +proc createFileMappingW*(hFile: THandle, lpFileMappingAttributes: pointer, flProtect, dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, - lpName: pointer): THANDLE {. + lpName: pointer): THandle {. stdcall, dynlib: "kernel32", importc: "CreateFileMappingW".} when not useWinUnicode: - proc CreateFileMappingA*(hFile: THANDLE, + proc createFileMappingA*(hFile: THANDLE, lpFileMappingAttributes: pointer, flProtect, dwMaximumSizeHigh: DWORD, dwMaximumSizeLow: DWORD, lpName: cstring): THANDLE {. stdcall, dynlib: "kernel32", importc: "CreateFileMappingA".} -proc UnmapViewOfFile*(lpBaseAddress: pointer): WINBOOL {.stdcall, +proc unmapViewOfFile*(lpBaseAddress: pointer): WINBOOL {.stdcall, dynlib: "kernel32", importc: "UnmapViewOfFile".} diff --git a/lib/wrappers/cairo/cairo.nim b/lib/wrappers/cairo/cairo.nim deleted file mode 100644 index 172880529..000000000 --- a/lib/wrappers/cairo/cairo.nim +++ /dev/null @@ -1,733 +0,0 @@ -#* cairo - a vector graphics library with display and print output -# * -# * Copyright © 2002 University of Southern California -# * Copyright © 2005 Red Hat, Inc. -# * -# * This library is free software; you can redistribute it and/or -# * modify it either under the terms of the GNU Lesser General Public -# * License version 2.1 as published by the Free Software Foundation -# * (the "LGPL") or, at your option, under the terms of the Mozilla -# * Public License Version 1.1 (the "MPL"). If you do not alter this -# * notice, a recipient may use your version of this file under either -# * the MPL or the LGPL. -# * -# * You should have received a copy of the LGPL along with this library -# * in the file COPYING-LGPL-2.1; if not, write to the Free Software -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# * You should have received a copy of the MPL along with this library -# * in the file COPYING-MPL-1.1 -# * -# * The contents of this file are subject to the Mozilla Public License -# * Version 1.1 (the "License"); you may not use this file except in -# * compliance with the License. You may obtain a copy of the License at -# * http://www.mozilla.org/MPL/ -# * -# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY -# * OF ANY KIND, either express or implied. See the LGPL or the MPL for -# * the specific language governing rights and limitations. -# * -# * The Original Code is the cairo graphics library. -# * -# * The Initial Developer of the Original Code is University of Southern -# * California. -# * -# * Contributor(s): -# * Carl D. Worth <cworth@cworth.org> -# #* -# * This FreePascal binding generated August 26, 2005 -# * by Jeffrey Pohlmeyer <yetanothergeek@yahoo.com> -# - -# -# - Updated to cairo version 1.4 -# - Grouped OS specific fuctions in separated units -# - Organized the functions by group and ordered exactly as the c header -# - Cleared parameter list syntax according to pascal standard -# -# By Luiz Américo Pereira Câmara -# October 2007 -# - -include "cairo_pragma.nim" - -type - PByte = cstring - TStatus* = enum - STATUS_SUCCESS = 0, - STATUS_NO_MEMORY, - STATUS_INVALID_RESTORE, - STATUS_INVALID_POP_GROUP, - STATUS_NO_CURRENT_POINT, - STATUS_INVALID_MATRIX, - STATUS_INVALID_STATUS, - STATUS_NULL_POINTER, - STATUS_INVALID_STRING, - STATUS_INVALID_PATH_DATA, - STATUS_READ_ERROR, - STATUS_WRITE_ERROR, - STATUS_SURFACE_FINISHED, - STATUS_SURFACE_TYPE_MISMATCH, - STATUS_PATTERN_TYPE_MISMATCH, - STATUS_INVALID_CONTENT, - STATUS_INVALID_FORMAT, - STATUS_INVALID_VISUAL, - STATUS_FILE_NOT_FOUND, - STATUS_INVALID_DASH, - STATUS_INVALID_DSC_COMMENT, - STATUS_INVALID_INDEX, - STATUS_CLIP_NOT_REPRESENTABLE, - STATUS_TEMP_FILE_ERROR, - STATUS_INVALID_STRIDE, - STATUS_FONT_TYPE_MISMATCH, - STATUS_USER_FONT_IMMUTABLE, - STATUS_USER_FONT_ERROR, - STATUS_NEGATIVE_COUNT, - STATUS_INVALID_CLUSTERS, - STATUS_INVALID_SLANT, - STATUS_INVALID_WEIGHT - - - TOperator* = enum - OPERATOR_CLEAR, OPERATOR_SOURCE, OPERATOR_OVER, OPERATOR_IN, OPERATOR_OUT, - OPERATOR_ATOP, OPERATOR_DEST, OPERATOR_DEST_OVER, OPERATOR_DEST_IN, - OPERATOR_DEST_OUT, OPERATOR_DEST_ATOP, OPERATOR_XOR, OPERATOR_ADD, - OPERATOR_SATURATE - TAntialias* = enum - ANTIALIAS_DEFAULT, ANTIALIAS_NONE, ANTIALIAS_GRAY, ANTIALIAS_SUBPIXEL - TFillRule* = enum - FILL_RULE_WINDING, FILL_RULE_EVEN_ODD - TLineCap* = enum - LINE_CAP_BUTT, LINE_CAP_ROUND, LINE_CAP_SQUARE - TLineJoin* = enum - LINE_JOIN_MITER, LINE_JOIN_ROUND, LINE_JOIN_BEVEL - TFontSlant* = enum - FONT_SLANT_NORMAL, FONT_SLANT_ITALIC, FONT_SLANT_OBLIQUE - TFontWeight* = enum - FONT_WEIGHT_NORMAL, FONT_WEIGHT_BOLD - TSubpixelOrder* = enum - SUBPIXEL_ORDER_DEFAULT, SUBPIXEL_ORDER_RGB, SUBPIXEL_ORDER_BGR, - SUBPIXEL_ORDER_VRGB, SUBPIXEL_ORDER_VBGR - THintStyle* = enum - HINT_STYLE_DEFAULT, HINT_STYLE_NONE, HINT_STYLE_SLIGHT, HINT_STYLE_MEDIUM, - HINT_STYLE_FULL - THintMetrics* = enum - HINT_METRICS_DEFAULT, HINT_METRICS_OFF, HINT_METRICS_ON - TPathDataType* = enum - PATH_MOVE_TO, PATH_LINE_TO, PATH_CURVE_TO, PATH_CLOSE_PATH - TContent* = enum - CONTENT_COLOR = 0x00001000, CONTENT_ALPHA = 0x00002000, - CONTENT_COLOR_ALPHA = 0x00003000 - TFormat* = enum - FORMAT_ARGB32, FORMAT_RGB24, FORMAT_A8, FORMAT_A1 - TExtend* = enum - EXTEND_NONE, EXTEND_REPEAT, EXTEND_REFLECT, EXTEND_PAD - TFilter* = enum - FILTER_FAST, FILTER_GOOD, FILTER_BEST, FILTER_NEAREST, FILTER_BILINEAR, - FILTER_GAUSSIAN - TFontType* = enum - FONT_TYPE_TOY, FONT_TYPE_FT, FONT_TYPE_WIN32, FONT_TYPE_ATSUI - TPatternType* = enum - PATTERN_TYPE_SOLID, PATTERN_TYPE_SURFACE, PATTERN_TYPE_LINEAR, - PATTERN_TYPE_RADIAL - TSurfaceType* = enum - SURFACE_TYPE_IMAGE, SURFACE_TYPE_PDF, SURFACE_TYPE_PS, SURFACE_TYPE_XLIB, - SURFACE_TYPE_XCB, SURFACE_TYPE_GLITZ, SURFACE_TYPE_QUARTZ, - SURFACE_TYPE_WIN32, SURFACE_TYPE_BEOS, SURFACE_TYPE_DIRECTFB, - SURFACE_TYPE_SVG, SURFACE_TYPE_OS2 - TSvgVersion* = enum - SVG_VERSION_1_1, SVG_VERSION_1_2 - PSurface* = ptr TSurface - PPSurface* = ptr PSurface - PContext* = ptr TContext - PPattern* = ptr TPattern - PFontOptions* = ptr TFontOptions - PFontFace* = ptr TFontFace - PScaledFont* = ptr TScaledFont - PBool* = ptr TBool - TBool* = int32 - PMatrix* = ptr TMatrix - PUserDataKey* = ptr TUserDataKey - PGlyph* = ptr TGlyph - PTextExtents* = ptr TTextExtents - PFontExtents* = ptr TFontExtents - PPathDataType* = ptr TPathDataType - PPathData* = ptr TPathData - PPath* = ptr TPath - PRectangle* = ptr TRectangle - PRectangleList* = ptr TRectangleList - TDestroyFunc* = proc (data: Pointer){.cdecl.} - TWriteFunc* = proc (closure: Pointer, data: PByte, len: int32): TStatus{.cdecl.} - TReadFunc* = proc (closure: Pointer, data: PByte, len: int32): TStatus{.cdecl.} - TContext*{.final.} = object #OPAQUE - TSurface*{.final.} = object #OPAQUE - TPattern*{.final.} = object #OPAQUE - TScaledFont*{.final.} = object #OPAQUE - TFontFace*{.final.} = object #OPAQUE - TFontOptions*{.final.} = object #OPAQUE - TMatrix*{.final.} = object - xx: float64 - yx: float64 - xy: float64 - yy: float64 - x0: float64 - y0: float64 - - TUserDataKey*{.final.} = object - unused: int32 - - TGlyph*{.final.} = object - index: int32 - x: float64 - y: float64 - - TTextExtents*{.final.} = object - x_bearing: float64 - y_bearing: float64 - width: float64 - height: float64 - x_advance: float64 - y_advance: float64 - - TFontExtents*{.final.} = object - ascent: float64 - descent: float64 - height: float64 - max_x_advance: float64 - max_y_advance: float64 - - TPathData*{.final.} = object #* _type : TCairoPathDataType; - # length : LongInt; - # end - x: float64 - y: float64 - - TPath*{.final.} = object - status: TStatus - data: PPathData - num_data: int32 - - TRectangle*{.final.} = object - x, y, width, height: float64 - - TRectangleList*{.final.} = object - status: TStatus - rectangles: PRectangle - num_rectangles: int32 - - -proc version*(): int32{.cdecl, importc: "cairo_version", libcairo.} -proc version_string*(): cstring{.cdecl, importc: "cairo_version_string", - libcairo.} - #Helper function to retrieve decoded version -proc version*(major, minor, micro: var int32) - #* Functions for manipulating state objects -proc create*(target: PSurface): PContext{.cdecl, importc: "cairo_create", - libcairo.} -proc reference*(cr: PContext): PContext{.cdecl, importc: "cairo_reference", libcairo.} -proc destroy*(cr: PContext){.cdecl, importc: "cairo_destroy", libcairo.} -proc get_reference_count*(cr: PContext): int32{.cdecl, - importc: "cairo_get_reference_count", libcairo.} -proc get_user_data*(cr: PContext, key: PUserDataKey): pointer{.cdecl, - importc: "cairo_get_user_data", libcairo.} -proc set_user_data*(cr: PContext, key: PUserDataKey, user_data: Pointer, - destroy: TDestroyFunc): TStatus{.cdecl, - importc: "cairo_set_user_data", libcairo.} -proc save*(cr: PContext){.cdecl, importc: "cairo_save", libcairo.} -proc restore*(cr: PContext){.cdecl, importc: "cairo_restore", libcairo.} -proc push_group*(cr: PContext){.cdecl, importc: "cairo_push_group", libcairo.} -proc push_group_with_content*(cr: PContext, content: TContent){.cdecl, - importc: "cairo_push_group_with_content", libcairo.} -proc pop_group*(cr: PContext): PPattern{.cdecl, importc: "cairo_pop_group", - libcairo.} -proc pop_group_to_source*(cr: PContext){.cdecl, importc: "cairo_pop_group_to_source", - libcairo.} - #* Modify state -proc set_operator*(cr: PContext, op: TOperator){.cdecl, importc: "cairo_set_operator", - libcairo.} -proc set_source*(cr: PContext, source: PPattern){.cdecl, importc: "cairo_set_source", - libcairo.} -proc set_source_rgb*(cr: PContext, red, green, blue: float64){.cdecl, - importc: "cairo_set_source_rgb", libcairo.} -proc set_source_rgba*(cr: PContext, red, green, blue, alpha: float64){.cdecl, - importc: "cairo_set_source_rgba", libcairo.} -proc set_source*(cr: PContext, surface: PSurface, x, y: float64){.cdecl, - importc: "cairo_set_source_surface", libcairo.} -proc set_tolerance*(cr: PContext, tolerance: float64){.cdecl, - importc: "cairo_set_tolerance", libcairo.} -proc set_antialias*(cr: PContext, antialias: TAntialias){.cdecl, - importc: "cairo_set_antialias", libcairo.} -proc set_fill_rule*(cr: PContext, fill_rule: TFillRule){.cdecl, - importc: "cairo_set_fill_rule", libcairo.} -proc set_line_width*(cr: PContext, width: float64){.cdecl, - importc: "cairo_set_line_width", libcairo.} -proc set_line_cap*(cr: PContext, line_cap: TLineCap){.cdecl, - importc: "cairo_set_line_cap", libcairo.} -proc set_line_join*(cr: PContext, line_join: TLineJoin){.cdecl, - importc: "cairo_set_line_join", libcairo.} -proc set_dash*(cr: PContext, dashes: openarray[float64], offset: float64){.cdecl, - importc: "cairo_set_dash", libcairo.} -proc set_miter_limit*(cr: PContext, limit: float64){.cdecl, - importc: "cairo_set_miter_limit", libcairo.} -proc translate*(cr: PContext, tx, ty: float64){.cdecl, importc: "cairo_translate", - libcairo.} -proc scale*(cr: PContext, sx, sy: float64){.cdecl, importc: "cairo_scale", - libcairo.} -proc rotate*(cr: PContext, angle: float64){.cdecl, importc: "cairo_rotate", - libcairo.} -proc transform*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_transform", - libcairo.} -proc set_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_set_matrix", - libcairo.} -proc identity_matrix*(cr: PContext){.cdecl, importc: "cairo_identity_matrix", - libcairo.} -proc user_to_device*(cr: PContext, x, y: var float64){.cdecl, - importc: "cairo_user_to_device", libcairo.} -proc user_to_device_distance*(cr: PContext, dx, dy: var float64){.cdecl, - importc: "cairo_user_to_device_distance", libcairo.} -proc device_to_user*(cr: PContext, x, y: var float64){.cdecl, - importc: "cairo_device_to_user", libcairo.} -proc device_to_user_distance*(cr: PContext, dx, dy: var float64){.cdecl, - importc: "cairo_device_to_user_distance", libcairo.} - #* Path creation functions -proc new_path*(cr: PContext){.cdecl, importc: "cairo_new_path", libcairo.} -proc move_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_move_to", - libcairo.} -proc new_sub_path*(cr: PContext){.cdecl, importc: "cairo_new_sub_path", - libcairo.} -proc line_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_line_to", - libcairo.} -proc curve_to*(cr: PContext, x1, y1, x2, y2, x3, y3: float64){.cdecl, - importc: "cairo_curve_to", libcairo.} -proc arc*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl, - importc: "cairo_arc", libcairo.} -proc arc_negative*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl, - importc: "cairo_arc_negative", libcairo.} -proc rel_move_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_move_to", - libcairo.} -proc rel_line_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_line_to", - libcairo.} -proc rel_curve_to*(cr: PContext, dx1, dy1, dx2, dy2, dx3, dy3: float64){.cdecl, - importc: "cairo_rel_curve_to", libcairo.} -proc rectangle*(cr: PContext, x, y, width, height: float64){.cdecl, - importc: "cairo_rectangle", libcairo.} -proc close_path*(cr: PContext){.cdecl, importc: "cairo_close_path", libcairo.} - #* Painting functions -proc paint*(cr: PContext){.cdecl, importc: "cairo_paint", libcairo.} -proc paint_with_alpha*(cr: PContext, alpha: float64){.cdecl, - importc: "cairo_paint_with_alpha", libcairo.} -proc mask*(cr: PContext, pattern: PPattern){.cdecl, importc: "cairo_mask", - libcairo.} -proc mask*(cr: PContext, surface: PSurface, surface_x, surface_y: float64){. - cdecl, importc: "cairo_mask_surface", libcairo.} -proc stroke*(cr: PContext){.cdecl, importc: "cairo_stroke", libcairo.} -proc stroke_preserve*(cr: PContext){.cdecl, importc: "cairo_stroke_preserve", - libcairo.} -proc fill*(cr: PContext){.cdecl, importc: "cairo_fill", libcairo.} -proc fill_preserve*(cr: PContext){.cdecl, importc: "cairo_fill_preserve", - libcairo.} -proc copy_page*(cr: PContext){.cdecl, importc: "cairo_copy_page", libcairo.} -proc show_page*(cr: PContext){.cdecl, importc: "cairo_show_page", libcairo.} - #* Insideness testing -proc in_stroke*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_stroke", - libcairo.} -proc in_fill*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_fill", - libcairo.} - #* Rectangular extents -proc stroke_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl, - importc: "cairo_stroke_extents", libcairo.} -proc fill_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl, - importc: "cairo_fill_extents", libcairo.} - #* Clipping -proc reset_clip*(cr: PContext){.cdecl, importc: "cairo_reset_clip", libcairo.} -proc clip*(cr: PContext){.cdecl, importc: "cairo_clip", libcairo.} -proc clip_preserve*(cr: PContext){.cdecl, importc: "cairo_clip_preserve", - libcairo.} -proc clip_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl, - importc: "cairo_clip_extents", libcairo.} -proc copy_clip_rectangle_list*(cr: PContext): PRectangleList{.cdecl, - importc: "cairo_copy_clip_rectangle_list", libcairo.} -proc rectangle_list_destroy*(rectangle_list: PRectangleList){.cdecl, - importc: "cairo_rectangle_list_destroy", libcairo.} - #* Font/Text functions -proc font_options_create*(): PFontOptions{.cdecl, - importc: "cairo_font_options_create", libcairo.} -proc copy*(original: PFontOptions): PFontOptions{.cdecl, - importc: "cairo_font_options_copy", libcairo.} -proc destroy*(options: PFontOptions){.cdecl, - importc: "cairo_font_options_destroy", libcairo.} -proc status*(options: PFontOptions): TStatus{.cdecl, - importc: "cairo_font_options_status", libcairo.} -proc merge*(options, other: PFontOptions){.cdecl, - importc: "cairo_font_options_merge", libcairo.} -proc equal*(options, other: PFontOptions): TBool{.cdecl, - importc: "cairo_font_options_equal", libcairo.} -proc hash*(options: PFontOptions): int32{.cdecl, - importc: "cairo_font_options_hash", libcairo.} -proc set_antialias*(options: PFontOptions, antialias: TAntialias){. - cdecl, importc: "cairo_font_options_set_antialias", libcairo.} -proc get_antialias*(options: PFontOptions): TAntialias{.cdecl, - importc: "cairo_font_options_get_antialias", libcairo.} -proc set_subpixel_order*(options: PFontOptions, - subpixel_order: TSubpixelOrder){.cdecl, - importc: "cairo_font_options_set_subpixel_order", libcairo.} -proc get_subpixel_order*(options: PFontOptions): TSubpixelOrder{. - cdecl, importc: "cairo_font_options_get_subpixel_order", libcairo.} -proc set_hint_style*(options: PFontOptions, hint_style: THintStyle){. - cdecl, importc: "cairo_font_options_set_hint_style", libcairo.} -proc get_hint_style*(options: PFontOptions): THintStyle{.cdecl, - importc: "cairo_font_options_get_hint_style", libcairo.} -proc set_hint_metrics*(options: PFontOptions, - hint_metrics: THintMetrics){.cdecl, - importc: "cairo_font_options_set_hint_metrics", libcairo.} -proc get_hint_metrics*(options: PFontOptions): THintMetrics{.cdecl, - importc: "cairo_font_options_get_hint_metrics", libcairo.} - #* This interface is for dealing with text as text, not caring about the - # font object inside the the TCairo. -proc select_font_face*(cr: PContext, family: cstring, slant: TFontSlant, - weight: TFontWeight){.cdecl, - importc: "cairo_select_font_face", libcairo.} -proc set_font_size*(cr: PContext, size: float64){.cdecl, - importc: "cairo_set_font_size", libcairo.} -proc set_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl, - importc: "cairo_set_font_matrix", libcairo.} -proc get_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl, - importc: "cairo_get_font_matrix", libcairo.} -proc set_font_options*(cr: PContext, options: PFontOptions){.cdecl, - importc: "cairo_set_font_options", libcairo.} -proc get_font_options*(cr: PContext, options: PFontOptions){.cdecl, - importc: "cairo_get_font_options", libcairo.} -proc set_font_face*(cr: PContext, font_face: PFontFace){.cdecl, - importc: "cairo_set_font_face", libcairo.} -proc get_font_face*(cr: PContext): PFontFace{.cdecl, importc: "cairo_get_font_face", - libcairo.} -proc set_scaled_font*(cr: PContext, scaled_font: PScaledFont){.cdecl, - importc: "cairo_set_scaled_font", libcairo.} -proc get_scaled_font*(cr: PContext): PScaledFont{.cdecl, - importc: "cairo_get_scaled_font", libcairo.} -proc show_text*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_show_text", - libcairo.} -proc show_glyphs*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl, - importc: "cairo_show_glyphs", libcairo.} -proc text_path*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_text_path", - libcairo.} -proc glyph_path*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl, - importc: "cairo_glyph_path", libcairo.} -proc text_extents*(cr: PContext, utf8: cstring, extents: PTextExtents){.cdecl, - importc: "cairo_text_extents", libcairo.} -proc glyph_extents*(cr: PContext, glyphs: PGlyph, num_glyphs: int32, - extents: PTextExtents){.cdecl, - importc: "cairo_glyph_extents", libcairo.} -proc font_extents*(cr: PContext, extents: PFontExtents){.cdecl, - importc: "cairo_font_extents", libcairo.} - #* Generic identifier for a font style -proc reference*(font_face: PFontFace): PFontFace{.cdecl, - importc: "cairo_font_face_reference", libcairo.} -proc destroy*(font_face: PFontFace){.cdecl, - importc: "cairo_font_face_destroy", libcairo.} -proc get_reference_count*(font_face: PFontFace): int32{.cdecl, - importc: "cairo_font_face_get_reference_count", libcairo.} -proc status*(font_face: PFontFace): TStatus{.cdecl, - importc: "cairo_font_face_status", libcairo.} -proc get_type*(font_face: PFontFace): TFontType{.cdecl, - importc: "cairo_font_face_get_type", libcairo.} -proc get_user_data*(font_face: PFontFace, key: PUserDataKey): pointer{. - cdecl, importc: "cairo_font_face_get_user_data", libcairo.} -proc set_user_data*(font_face: PFontFace, key: PUserDataKey, - user_data: pointer, destroy: TDestroyFunc): TStatus{. - cdecl, importc: "cairo_font_face_set_user_data", libcairo.} - #* Portable interface to general font features -proc scaled_font_create*(font_face: PFontFace, font_matrix: PMatrix, - ctm: PMatrix, options: PFontOptions): PScaledFont{. - cdecl, importc: "cairo_scaled_font_create", libcairo.} -proc reference*(scaled_font: PScaledFont): PScaledFont{.cdecl, - importc: "cairo_scaled_font_reference", libcairo.} -proc destroy*(scaled_font: PScaledFont){.cdecl, - importc: "cairo_scaled_font_destroy", libcairo.} -proc get_reference_count*(scaled_font: PScaledFont): int32{.cdecl, - importc: "cairo_scaled_font_get_reference_count", libcairo.} -proc status*(scaled_font: PScaledFont): TStatus{.cdecl, - importc: "cairo_scaled_font_status", libcairo.} -proc get_type*(scaled_font: PScaledFont): TFontType{.cdecl, - importc: "cairo_scaled_font_get_type", libcairo.} -proc get_user_data*(scaled_font: PScaledFont, key: PUserDataKey): Pointer{. - cdecl, importc: "cairo_scaled_font_get_user_data", libcairo.} -proc set_user_data*(scaled_font: PScaledFont, key: PUserDataKey, - user_data: Pointer, destroy: TDestroyFunc): TStatus{. - cdecl, importc: "cairo_scaled_font_set_user_data", libcairo.} -proc extents*(scaled_font: PScaledFont, extents: PFontExtents){. - cdecl, importc: "cairo_scaled_font_extents", libcairo.} -proc text_extents*(scaled_font: PScaledFont, utf8: cstring, - extents: PTextExtents){.cdecl, - importc: "cairo_scaled_font_text_extents", libcairo.} -proc glyph_extents*(scaled_font: PScaledFont, glyphs: PGlyph, - num_glyphs: int32, extents: PTextExtents){. - cdecl, importc: "cairo_scaled_font_glyph_extents", libcairo.} -proc get_font_face*(scaled_font: PScaledFont): PFontFace{.cdecl, - importc: "cairo_scaled_font_get_font_face", libcairo.} -proc get_font_matrix*(scaled_font: PScaledFont, font_matrix: PMatrix){. - cdecl, importc: "cairo_scaled_font_get_font_matrix", libcairo.} -proc get_ctm*(scaled_font: PScaledFont, ctm: PMatrix){.cdecl, - importc: "cairo_scaled_font_get_ctm", libcairo.} -proc get_font_options*(scaled_font: PScaledFont, - options: PFontOptions){.cdecl, - importc: "cairo_scaled_font_get_font_options", libcairo.} - #* Query functions -proc get_operator*(cr: PContext): TOperator{.cdecl, importc: "cairo_get_operator", - libcairo.} -proc get_source*(cr: PContext): PPattern{.cdecl, importc: "cairo_get_source", - libcairo.} -proc get_tolerance*(cr: PContext): float64{.cdecl, importc: "cairo_get_tolerance", - libcairo.} -proc get_antialias*(cr: PContext): TAntialias{.cdecl, importc: "cairo_get_antialias", - libcairo.} -proc get_current_point*(cr: PContext, x, y: var float64){.cdecl, - importc: "cairo_get_current_point", libcairo.} -proc get_fill_rule*(cr: PContext): TFillRule{.cdecl, importc: "cairo_get_fill_rule", - libcairo.} -proc get_line_width*(cr: PContext): float64{.cdecl, importc: "cairo_get_line_width", - libcairo.} -proc get_line_cap*(cr: PContext): TLineCap{.cdecl, importc: "cairo_get_line_cap", - libcairo.} -proc get_line_join*(cr: PContext): TLineJoin{.cdecl, importc: "cairo_get_line_join", - libcairo.} -proc get_miter_limit*(cr: PContext): float64{.cdecl, importc: "cairo_get_miter_limit", - libcairo.} -proc get_dash_count*(cr: PContext): int32{.cdecl, importc: "cairo_get_dash_count", - libcairo.} -proc get_dash*(cr: PContext, dashes, offset: var float64){.cdecl, - importc: "cairo_get_dash", libcairo.} -proc get_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_get_matrix", - libcairo.} -proc get_target*(cr: PContext): PSurface{.cdecl, importc: "cairo_get_target", - libcairo.} -proc get_group_target*(cr: PContext): PSurface{.cdecl, - importc: "cairo_get_group_target", libcairo.} -proc copy_path*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path", - libcairo.} -proc copy_path_flat*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path_flat", - libcairo.} -proc append_path*(cr: PContext, path: PPath){.cdecl, importc: "cairo_append_path", - libcairo.} -proc destroy*(path: PPath){.cdecl, importc: "cairo_path_destroy", - libcairo.} - #* Error status queries -proc status*(cr: PContext): TStatus{.cdecl, importc: "cairo_status", libcairo.} -proc status_to_string*(status: TStatus): cstring{.cdecl, - importc: "cairo_status_to_string", libcairo.} - #* Surface manipulation -proc surface_create_similar*(other: PSurface, content: TContent, - width, height: int32): PSurface{.cdecl, - importc: "cairo_surface_create_similar", libcairo.} -proc reference*(surface: PSurface): PSurface{.cdecl, - importc: "cairo_surface_reference", libcairo.} -proc finish*(surface: PSurface){.cdecl, importc: "cairo_surface_finish", - libcairo.} -proc destroy*(surface: PSurface){.cdecl, - importc: "cairo_surface_destroy", libcairo.} -proc get_reference_count*(surface: PSurface): int32{.cdecl, - importc: "cairo_surface_get_reference_count", libcairo.} -proc status*(surface: PSurface): TStatus{.cdecl, - importc: "cairo_surface_status", libcairo.} -proc get_type*(surface: PSurface): TSurfaceType{.cdecl, - importc: "cairo_surface_get_type", libcairo.} -proc get_content*(surface: PSurface): TContent{.cdecl, - importc: "cairo_surface_get_content", libcairo.} -proc write_to_png*(surface: PSurface, filename: cstring): TStatus{. - cdecl, importc: "cairo_surface_write_to_png", libcairo.} -proc write_to_png*(surface: PSurface, write_func: TWriteFunc, - closure: pointer): TStatus{.cdecl, - importc: "cairo_surface_write_to_png_stream", libcairo.} -proc get_user_data*(surface: PSurface, key: PUserDataKey): pointer{. - cdecl, importc: "cairo_surface_get_user_data", libcairo.} -proc set_user_data*(surface: PSurface, key: PUserDataKey, - user_data: pointer, destroy: TDestroyFunc): TStatus{. - cdecl, importc: "cairo_surface_set_user_data", libcairo.} -proc get_font_options*(surface: PSurface, options: PFontOptions){.cdecl, - importc: "cairo_surface_get_font_options", libcairo.} -proc flush*(surface: PSurface){.cdecl, importc: "cairo_surface_flush", - libcairo.} -proc mark_dirty*(surface: PSurface){.cdecl, - importc: "cairo_surface_mark_dirty", libcairo.} -proc mark_dirty_rectangle*(surface: PSurface, x, y, width, height: int32){. - cdecl, importc: "cairo_surface_mark_dirty_rectangle", libcairo.} -proc set_device_offset*(surface: PSurface, x_offset, y_offset: float64){. - cdecl, importc: "cairo_surface_set_device_offset", libcairo.} -proc get_device_offset*(surface: PSurface, - x_offset, y_offset: var float64){.cdecl, - importc: "cairo_surface_get_device_offset", libcairo.} -proc set_fallback_resolution*(surface: PSurface, x_pixels_per_inch, - y_pixels_per_inch: float64){.cdecl, importc: "cairo_surface_set_fallback_resolution", - libcairo.} - #* Image-surface functions -proc image_surface_create*(format: TFormat, width, height: int32): PSurface{. - cdecl, importc: "cairo_image_surface_create", libcairo.} -proc image_surface_create*(data: Pbyte, format: TFormat, - width, height, stride: int32): PSurface{. - cdecl, importc: "cairo_image_surface_create_for_data", libcairo.} -proc get_data*(surface: PSurface): cstring{.cdecl, - importc: "cairo_image_surface_get_data", libcairo.} -proc get_format*(surface: PSurface): TFormat{.cdecl, - importc: "cairo_image_surface_get_format", libcairo.} -proc get_width*(surface: PSurface): int32{.cdecl, - importc: "cairo_image_surface_get_width", libcairo.} -proc get_height*(surface: PSurface): int32{.cdecl, - importc: "cairo_image_surface_get_height", libcairo.} -proc get_stride*(surface: PSurface): int32{.cdecl, - importc: "cairo_image_surface_get_stride", libcairo.} -proc image_surface_create_from_png*(filename: cstring): PSurface{.cdecl, - importc: "cairo_image_surface_create_from_png", libcairo.} -proc image_surface_create_from_png*(read_func: TReadFunc, - closure: pointer): PSurface{.cdecl, importc: "cairo_image_surface_create_from_png_stream", - libcairo.} - #* Pattern creation functions -proc pattern_create_rgb*(red, green, blue: float64): PPattern{.cdecl, - importc: "cairo_pattern_create_rgb", libcairo.} -proc pattern_create_rgba*(red, green, blue, alpha: float64): PPattern{.cdecl, - importc: "cairo_pattern_create_rgba", libcairo.} -proc pattern_create_for_surface*(surface: PSurface): PPattern{.cdecl, - importc: "cairo_pattern_create_for_surface", libcairo.} -proc pattern_create_linear*(x0, y0, x1, y1: float64): PPattern{.cdecl, - importc: "cairo_pattern_create_linear", libcairo.} -proc pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): PPattern{. - cdecl, importc: "cairo_pattern_create_radial", libcairo.} -proc reference*(pattern: PPattern): PPattern{.cdecl, - importc: "cairo_pattern_reference", libcairo.} -proc destroy*(pattern: PPattern){.cdecl, - importc: "cairo_pattern_destroy", libcairo.} -proc get_reference_count*(pattern: PPattern): int32{.cdecl, - importc: "cairo_pattern_get_reference_count", libcairo.} -proc status*(pattern: PPattern): TStatus{.cdecl, - importc: "cairo_pattern_status", libcairo.} -proc get_user_data*(pattern: PPattern, key: PUserDataKey): Pointer{. - cdecl, importc: "cairo_pattern_get_user_data", libcairo.} -proc set_user_data*(pattern: PPattern, key: PUserDataKey, - user_data: Pointer, destroy: TDestroyFunc): TStatus{. - cdecl, importc: "cairo_pattern_set_user_data", libcairo.} -proc get_type*(pattern: PPattern): TPatternType{.cdecl, - importc: "cairo_pattern_get_type", libcairo.} -proc add_color_stop_rgb*(pattern: PPattern, - offset, red, green, blue: float64){.cdecl, - importc: "cairo_pattern_add_color_stop_rgb", libcairo.} -proc add_color_stop_rgba*(pattern: PPattern, - offset, red, green, blue, alpha: float64){. - cdecl, importc: "cairo_pattern_add_color_stop_rgba", libcairo.} -proc set_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl, - importc: "cairo_pattern_set_matrix", libcairo.} -proc get_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl, - importc: "cairo_pattern_get_matrix", libcairo.} -proc set_extend*(pattern: PPattern, extend: TExtend){.cdecl, - importc: "cairo_pattern_set_extend", libcairo.} -proc get_extend*(pattern: PPattern): TExtend{.cdecl, - importc: "cairo_pattern_get_extend", libcairo.} -proc set_filter*(pattern: PPattern, filter: TFilter){.cdecl, - importc: "cairo_pattern_set_filter", libcairo.} -proc get_filter*(pattern: PPattern): TFilter{.cdecl, - importc: "cairo_pattern_get_filter", libcairo.} -proc get_rgba*(pattern: PPattern, - red, green, blue, alpha: var float64): TStatus{. - cdecl, importc: "cairo_pattern_get_rgba", libcairo.} -proc get_surface*(pattern: PPattern, surface: PPSurface): TStatus{. - cdecl, importc: "cairo_pattern_get_surface", libcairo.} -proc get_color_stop_rgba*(pattern: PPattern, index: int32, - offset, red, green, blue, alpha: var float64): TStatus{. - cdecl, importc: "cairo_pattern_get_color_stop_rgba", libcairo.} -proc get_color_stop_count*(pattern: PPattern, count: var int32): TStatus{. - cdecl, importc: "cairo_pattern_get_color_stop_count", libcairo.} -proc get_linear_points*(pattern: PPattern, - x0, y0, x1, y1: var float64): TStatus{. - cdecl, importc: "cairo_pattern_get_linear_points", libcairo.} -proc get_radial_circles*(pattern: PPattern, - x0, y0, r0, x1, y1, r1: var float64): TStatus{. - cdecl, importc: "cairo_pattern_get_radial_circles", libcairo.} - #* Matrix functions -proc init*(matrix: PMatrix, xx, yx, xy, yy, x0, y0: float64){.cdecl, - importc: "cairo_matrix_init", libcairo.} -proc init_identity*(matrix: PMatrix){.cdecl, - importc: "cairo_matrix_init_identity", libcairo.} -proc init_translate*(matrix: PMatrix, tx, ty: float64){.cdecl, - importc: "cairo_matrix_init_translate", libcairo.} -proc init_scale*(matrix: PMatrix, sx, sy: float64){.cdecl, - importc: "cairo_matrix_init_scale", libcairo.} -proc init_rotate*(matrix: PMatrix, radians: float64){.cdecl, - importc: "cairo_matrix_init_rotate", libcairo.} -proc translate*(matrix: PMatrix, tx, ty: float64){.cdecl, - importc: "cairo_matrix_translate", libcairo.} -proc scale*(matrix: PMatrix, sx, sy: float64){.cdecl, - importc: "cairo_matrix_scale", libcairo.} -proc rotate*(matrix: PMatrix, radians: float64){.cdecl, - importc: "cairo_matrix_rotate", libcairo.} -proc invert*(matrix: PMatrix): TStatus{.cdecl, - importc: "cairo_matrix_invert", libcairo.} -proc multiply*(result, a, b: PMatrix){.cdecl, - importc: "cairo_matrix_multiply", libcairo.} -proc transform_distance*(matrix: PMatrix, dx, dy: var float64){.cdecl, - importc: "cairo_matrix_transform_distance", libcairo.} -proc transform_point*(matrix: PMatrix, x, y: var float64){.cdecl, - importc: "cairo_matrix_transform_point", libcairo.} - #* PDF functions -proc pdf_surface_create*(filename: cstring, - width_in_points, height_in_points: float64): PSurface{. - cdecl, importc: "cairo_pdf_surface_create", libcairo.} -proc pdf_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer, - width_in_points, height_in_points: float64): PSurface{. - cdecl, importc: "cairo_pdf_surface_create_for_stream", libcairo.} -proc pdf_surface_set_size*(surface: PSurface, - width_in_points, height_in_points: float64){.cdecl, - importc: "cairo_pdf_surface_set_size", libcairo.} - #* PS functions -proc ps_surface_create*(filename: cstring, - width_in_points, height_in_points: float64): PSurface{. - cdecl, importc: "cairo_ps_surface_create", libcairo.} -proc ps_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer, - width_in_points, height_in_points: float64): PSurface{. - cdecl, importc: "cairo_ps_surface_create_for_stream", libcairo.} -proc ps_surface_set_size*(surface: PSurface, - width_in_points, height_in_points: float64){.cdecl, - importc: "cairo_ps_surface_set_size", libcairo.} -proc ps_surface_dsc_comment*(surface: PSurface, comment: cstring){.cdecl, - importc: "cairo_ps_surface_dsc_comment", libcairo.} -proc ps_surface_dsc_begin_setup*(surface: PSurface){.cdecl, - importc: "cairo_ps_surface_dsc_begin_setup", libcairo.} -proc ps_surface_dsc_begin_page_setup*(surface: PSurface){.cdecl, - importc: "cairo_ps_surface_dsc_begin_page_setup", libcairo.} - #* SVG functions -proc svg_surface_create*(filename: cstring, - width_in_points, height_in_points: float64): PSurface{. - cdecl, importc: "cairo_svg_surface_create", libcairo.} -proc svg_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer, - width_in_points, height_in_points: float64): PSurface{. - cdecl, importc: "cairo_svg_surface_create_for_stream", libcairo.} -proc svg_surface_restrict_to_version*(surface: PSurface, version: TSvgVersion){. - cdecl, importc: "cairo_svg_surface_restrict_to_version", libcairo.} - #todo: see how translate this - #procedure cairo_svg_get_versions(TCairoSvgVersion const **versions, - # int *num_versions); -proc svg_version_to_string*(version: TSvgVersion): cstring{.cdecl, - importc: "cairo_svg_version_to_string", libcairo.} - #* Functions to be used while debugging (not intended for use in production code) -proc debug_reset_static_data*(){.cdecl, - importc: "cairo_debug_reset_static_data", - libcairo.} -# implementation - -proc version(major, minor, micro: var int32) = - var version: int32 - version = version() - major = version div 10000'i32 - minor = (version mod (major * 10000'i32)) div 100'i32 - micro = (version mod ((major * 10000'i32) + (minor * 100'i32))) - -proc checkStatus*(s: cairo.TStatus) {.noinline.} = - ## if ``s != StatusSuccess`` the error is turned into an appropirate Nimrod - ## exception and raised. - case s - of StatusSuccess: nil - of StatusNoMemory: - raise newException(EOutOfMemory, $statusToString(s)) - of STATUS_READ_ERROR, STATUS_WRITE_ERROR, STATUS_FILE_NOT_FOUND, - STATUS_TEMP_FILE_ERROR: - raise newException(EIO, $statusToString(s)) - else: - raise newException(EAssertionFailed, $statusToString(s)) - - diff --git a/lib/wrappers/cairo/cairo_pragma.nim b/lib/wrappers/cairo/cairo_pragma.nim deleted file mode 100644 index 11bf237f9..000000000 --- a/lib/wrappers/cairo/cairo_pragma.nim +++ /dev/null @@ -1,16 +0,0 @@ -# included by cairo bindings - -when defined(use_pkg_config) or defined(use_pkg_config_static): - {.pragma: libcairo, cdecl.} - when defined(use_pkg_config_static): - {.passl: gorge("pkg-config cairo --libs --static").} - else: - {.passl: gorge("pkg-config cairo --libs").} -else: - when defined(windows): - const LIB_CAIRO* = "libcairo-2.dll" - elif defined(macosx): - const LIB_CAIRO* = "libcairo.dylib" - else: - const LIB_CAIRO* = "libcairo.so(|.2)" - {.pragma: libcairo, cdecl, dynlib: LIB_CAIRO.} diff --git a/lib/wrappers/cairo/cairoft.nim b/lib/wrappers/cairo/cairoft.nim deleted file mode 100644 index 5f4e47662..000000000 --- a/lib/wrappers/cairo/cairoft.nim +++ /dev/null @@ -1,36 +0,0 @@ -# -# Translation of cairo-ft.h -# by Jeffrey Pohlmeyer -# updated to version 1.4 by Luiz Américo Pereira Câmara 2007 -# - -import - cairo, freetypeh - -include "cairo_pragma.nim" -#todo: properly define FcPattern: -#It will require translate FontConfig header - -#* -#typedef struct _XftPattern { -# int num; -# int size; -# XftPatternElt *elts; -# } XftPattern; -# typedef FcPattern XftPattern; -# - -type - FcPattern* = Pointer - PFcPattern* = ptr FcPattern - -proc ft_font_face_create_for_pattern*(pattern: PFcPattern): PFontFace{.libcairo, - importc: "cairo_ft_font_face_create_for_pattern".} -proc ft_font_options_substitute*(options: PFontOptions, pattern: PFcPattern){. - libcairo, importc: "cairo_ft_font_options_substitute".} -proc ft_font_face_create_for_ft_face*(face: TFT_Face, load_flags: int32): PFontFace{.libcairo, - importc: "cairo_ft_font_face_create_for_ft_face".} -proc ft_scaled_font_lock_face*(scaled_font: PScaledFont): TFT_Face{.libcairo, - importc: "cairo_ft_scaled_font_lock_face".} -proc ft_scaled_font_unlock_face*(scaled_font: PScaledFont){.libcairo, - importc: "cairo_ft_scaled_font_unlock_face".} diff --git a/lib/wrappers/cairo/cairowin32.nim b/lib/wrappers/cairo/cairowin32.nim deleted file mode 100644 index cec3a5bc5..000000000 --- a/lib/wrappers/cairo/cairowin32.nim +++ /dev/null @@ -1,37 +0,0 @@ -# -# Translation of cairo-win32.h version 1.4 -# by Luiz Américo Pereira Câmara 2007 -# - -import - cairo, windows - -proc win32_surface_create*(hdc: HDC): PSurface{.cdecl, - importc: "cairo_win32_surface_create", dynlib: LIB_CAIRO.} -proc win32_surface_create_with_ddb*(hdc: HDC, format: TFormat, - width, height: int32): PSurface{.cdecl, - importc: "cairo_win32_surface_create_with_ddb", dynlib: LIB_CAIRO.} -proc win32_surface_create_with_dib*(format: TFormat, width, height: int32): PSurface{. - cdecl, importc: "cairo_win32_surface_create_with_dib", dynlib: LIB_CAIRO.} -proc win32_surface_get_dc*(surface: PSurface): HDC{.cdecl, - importc: "cairo_win32_surface_get_dc", dynlib: LIB_CAIRO.} -proc win32_surface_get_image*(surface: PSurface): PSurface{.cdecl, - importc: "cairo_win32_surface_get_image", dynlib: LIB_CAIRO.} -proc win32_font_face_create_for_logfontw*(logfont: pLOGFONTW): PFontFace{.cdecl, - importc: "cairo_win32_font_face_create_for_logfontw", dynlib: LIB_CAIRO.} -proc win32_font_face_create_for_hfont*(font: HFONT): PFontFace{.cdecl, - importc: "cairo_win32_font_face_create_for_hfont", dynlib: LIB_CAIRO.} -proc win32_scaled_font_select_font*(scaled_font: PScaledFont, hdc: HDC): TStatus{. - cdecl, importc: "cairo_win32_scaled_font_select_font", dynlib: LIB_CAIRO.} -proc win32_scaled_font_done_font*(scaled_font: PScaledFont){.cdecl, - importc: "cairo_win32_scaled_font_done_font", dynlib: LIB_CAIRO.} -proc win32_scaled_font_get_metrics_factor*(scaled_font: PScaledFont): float64{. - cdecl, importc: "cairo_win32_scaled_font_get_metrics_factor", - dynlib: LIB_CAIRO.} -proc win32_scaled_font_get_logical_to_device*(scaled_font: PScaledFont, - logical_to_device: PMatrix){.cdecl, importc: "cairo_win32_scaled_font_get_logical_to_device", - dynlib: LIB_CAIRO.} -proc win32_scaled_font_get_device_to_logical*(scaled_font: PScaledFont, - device_to_logical: PMatrix){.cdecl, importc: "cairo_win32_scaled_font_get_device_to_logical", - dynlib: LIB_CAIRO.} -# implementation diff --git a/lib/wrappers/cairo/cairoxlib.nim b/lib/wrappers/cairo/cairoxlib.nim deleted file mode 100644 index 273a8b42f..000000000 --- a/lib/wrappers/cairo/cairoxlib.nim +++ /dev/null @@ -1,41 +0,0 @@ -# -# Translation of cairo-xlib.h version 1.4 -# by Jeffrey Pohlmeyer -# updated to version 1.4 by Luiz Américo Pereira Câmara 2007 -# - -import - cairo, x, xlib, xrender - -include "cairo_pragma.nim" - -proc xlib_surface_create*(dpy: PDisplay, drawable: TDrawable, visual: PVisual, - width, height: int32): PSurface{.cdecl, - importc: "cairo_xlib_surface_create", libcairo.} -proc xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap, - screen: PScreen, width, height: int32): PSurface{. - cdecl, importc: "cairo_xlib_surface_create_for_bitmap", libcairo.} -proc xlib_surface_create_with_xrender_format*(dpy: PDisplay, - drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat, - width, height: int32): PSurface{.cdecl, importc: "cairo_xlib_surface_create_with_xrender_format", - libcairo.} -proc xlib_surface_get_depth*(surface: PSurface): int32{.cdecl, - importc: "cairo_xlib_surface_get_depth", libcairo.} -proc xlib_surface_get_display*(surface: PSurface): PDisplay{.cdecl, - importc: "cairo_xlib_surface_get_display", libcairo.} -proc xlib_surface_get_drawable*(surface: PSurface): TDrawable{.cdecl, - importc: "cairo_xlib_surface_get_drawable", libcairo.} -proc xlib_surface_get_height*(surface: PSurface): int32{.cdecl, - importc: "cairo_xlib_surface_get_height", libcairo.} -proc xlib_surface_get_screen*(surface: PSurface): PScreen{.cdecl, - importc: "cairo_xlib_surface_get_screen", libcairo.} -proc xlib_surface_get_visual*(surface: PSurface): PVisual{.cdecl, - importc: "cairo_xlib_surface_get_visual", libcairo.} -proc xlib_surface_get_width*(surface: PSurface): int32{.cdecl, - importc: "cairo_xlib_surface_get_width", libcairo.} -proc xlib_surface_set_size*(surface: PSurface, width, height: int32){.cdecl, - importc: "cairo_xlib_surface_set_size", libcairo.} -proc xlib_surface_set_drawable*(surface: PSurface, drawable: TDrawable, - width, height: int32){.cdecl, - importc: "cairo_xlib_surface_set_drawable", libcairo.} -# implementation diff --git a/lib/wrappers/gtk/atk.nim b/lib/wrappers/gtk/atk.nim deleted file mode 100644 index f59d95f87..000000000 --- a/lib/wrappers/gtk/atk.nim +++ /dev/null @@ -1,1308 +0,0 @@ -{.deadCodeElim: on.} -import - glib2 - -when defined(windows): - const - lib = "libatk-1.0-0.dll" -elif defined(macosx): - const - lib = "libatk-1.0.dylib" -else: - const - lib = "libatk-1.0.so" -type - PImplementor* = pointer - PAction* = pointer - PComponent* = pointer - PDocument* = pointer - PEditableText* = pointer - PHypertext* = pointer - PImage* = pointer - PSelection* = pointer - PStreamableContent* = pointer - PTable* = pointer - PText* = pointer - PValue* = pointer - PRelationSet* = ptr TRelationSet - PStateSet* = ptr TStateSet - PAttributeSet* = ptr TAttributeSet - PCoordType* = ptr TCoordType - TCoordType* = enum - XY_SCREEN, XY_WINDOW - PRole* = ptr TRole - TRole* = enum - ROLE_INVALID, ROLE_ACCEL_LABEL, ROLE_ALERT, ROLE_ANIMATION, ROLE_ARROW, - ROLE_CALENDAR, ROLE_CANVAS, ROLE_CHECK_BOX, ROLE_CHECK_MENU_ITEM, - ROLE_COLOR_CHOOSER, ROLE_COLUMN_HEADER, ROLE_COMBO_BOX, ROLE_DATE_EDITOR, - ROLE_DESKTOP_ICON, ROLE_DESKTOP_FRAME, ROLE_DIAL, ROLE_DIALOG, - ROLE_DIRECTORY_PANE, ROLE_DRAWING_AREA, ROLE_FILE_CHOOSER, ROLE_FILLER, - ROLE_FONT_CHOOSER, ROLE_FRAME, ROLE_GLASS_PANE, ROLE_HTML_CONTAINER, - ROLE_ICON, ROLE_IMAGE, ROLE_INTERNAL_FRAME, ROLE_LABEL, ROLE_LAYERED_PANE, - ROLE_LIST, ROLE_LIST_ITEM, ROLE_MENU, ROLE_MENU_BAR, ROLE_MENU_ITEM, - ROLE_OPTION_PANE, ROLE_PAGE_TAB, ROLE_PAGE_TAB_LIST, ROLE_PANEL, - ROLE_PASSWORD_TEXT, ROLE_POPUP_MENU, ROLE_PROGRESS_BAR, ROLE_PUSH_BUTTON, - ROLE_RADIO_BUTTON, ROLE_RADIO_MENU_ITEM, ROLE_ROOT_PANE, ROLE_ROW_HEADER, - ROLE_SCROLL_BAR, ROLE_SCROLL_PANE, ROLE_SEPARATOR, ROLE_SLIDER, - ROLE_SPLIT_PANE, ROLE_SPIN_BUTTON, ROLE_STATUSBAR, ROLE_TABLE, - ROLE_TABLE_CELL, ROLE_TABLE_COLUMN_HEADER, ROLE_TABLE_ROW_HEADER, - ROLE_TEAR_OFF_MENU_ITEM, ROLE_TERMINAL, ROLE_TEXT, ROLE_TOGGLE_BUTTON, - ROLE_TOOL_BAR, ROLE_TOOL_TIP, ROLE_TREE, ROLE_TREE_TABLE, ROLE_UNKNOWN, - ROLE_VIEWPORT, ROLE_WINDOW, ROLE_LAST_DEFINED - PLayer* = ptr TLayer - TLayer* = enum - LAYER_INVALID, LAYER_BACKGROUND, LAYER_CANVAS, LAYER_WIDGET, LAYER_MDI, - LAYER_POPUP, LAYER_OVERLAY - PPropertyValues* = ptr TPropertyValues - TPropertyValues*{.final, pure.} = object - property_name*: cstring - old_value*: TGValue - new_value*: TGValue - - TFunction* = proc (data: gpointer): gboolean{.cdecl.} - PObject* = ptr TObject - PPAtkObject* = ptr PObject - TObject* = object of TGObject - description*: cstring - name*: cstring - accessible_parent*: PObject - role*: TRole - relation_set*: PRelationSet - layer*: TLayer - - TPropertyChangeHandler* = proc (para1: PObject, para2: PPropertyValues){.cdecl.} - PObjectClass* = ptr TObjectClass - TObjectClass* = object of TGObjectClass - get_name*: proc (accessible: PObject): cstring{.cdecl.} - get_description*: proc (accessible: PObject): cstring{.cdecl.} - get_parent*: proc (accessible: PObject): PObject{.cdecl.} - get_n_children*: proc (accessible: PObject): gint{.cdecl.} - ref_child*: proc (accessible: PObject, i: gint): PObject{.cdecl.} - get_index_in_parent*: proc (accessible: PObject): gint{.cdecl.} - ref_relation_set*: proc (accessible: PObject): PRelationSet{.cdecl.} - get_role*: proc (accessible: PObject): TRole{.cdecl.} - get_layer*: proc (accessible: PObject): TLayer{.cdecl.} - get_mdi_zorder*: proc (accessible: PObject): gint{.cdecl.} - ref_state_set*: proc (accessible: PObject): PStateSet{.cdecl.} - set_name*: proc (accessible: PObject, name: cstring){.cdecl.} - set_description*: proc (accessible: PObject, description: cstring){.cdecl.} - set_parent*: proc (accessible: PObject, parent: PObject){.cdecl.} - set_role*: proc (accessible: PObject, role: TRole){.cdecl.} - connect_property_change_handler*: proc (accessible: PObject, - handler: TPropertyChangeHandler): guint{.cdecl.} - remove_property_change_handler*: proc (accessible: PObject, - handler_id: guint){.cdecl.} - initialize*: proc (accessible: PObject, data: gpointer){.cdecl.} - children_changed*: proc (accessible: PObject, change_index: guint, - changed_child: gpointer){.cdecl.} - focus_event*: proc (accessible: PObject, focus_in: gboolean){.cdecl.} - property_change*: proc (accessible: PObject, values: PPropertyValues){.cdecl.} - state_change*: proc (accessible: PObject, name: cstring, state_set: gboolean){. - cdecl.} - visible_data_changed*: proc (accessible: PObject){.cdecl.} - pad1*: TFunction - pad2*: TFunction - pad3*: TFunction - pad4*: TFunction - - PImplementorIface* = ptr TImplementorIface - TImplementorIface* = object of TGTypeInterface - ref_accessible*: proc (implementor: PImplementor): PObject{.cdecl.} - - PActionIface* = ptr TActionIface - TActionIface* = object of TGTypeInterface - do_action*: proc (action: PAction, i: gint): gboolean{.cdecl.} - get_n_actions*: proc (action: PAction): gint{.cdecl.} - get_description*: proc (action: PAction, i: gint): cstring{.cdecl.} - get_name*: proc (action: PAction, i: gint): cstring{.cdecl.} - get_keybinding*: proc (action: PAction, i: gint): cstring{.cdecl.} - set_description*: proc (action: PAction, i: gint, desc: cstring): gboolean{. - cdecl.} - pad1*: TFunction - pad2*: TFunction - - TFocusHandler* = proc (para1: PObject, para2: gboolean){.cdecl.} - PComponentIface* = ptr TComponentIface - TComponentIface* = object of TGTypeInterface - add_focus_handler*: proc (component: PComponent, handler: TFocusHandler): guint{. - cdecl.} - contains*: proc (component: PComponent, x: gint, y: gint, - coord_type: TCoordType): gboolean{.cdecl.} - ref_accessible_at_point*: proc (component: PComponent, x: gint, y: gint, - coord_type: TCoordType): PObject{.cdecl.} - get_extents*: proc (component: PComponent, x: Pgint, y: Pgint, width: Pgint, - height: Pgint, coord_type: TCoordType){.cdecl.} - get_position*: proc (component: PComponent, x: Pgint, y: Pgint, - coord_type: TCoordType){.cdecl.} - get_size*: proc (component: PComponent, width: Pgint, height: Pgint){.cdecl.} - grab_focus*: proc (component: PComponent): gboolean{.cdecl.} - remove_focus_handler*: proc (component: PComponent, handler_id: guint){. - cdecl.} - set_extents*: proc (component: PComponent, x: gint, y: gint, width: gint, - height: gint, coord_type: TCoordType): gboolean{.cdecl.} - set_position*: proc (component: PComponent, x: gint, y: gint, - coord_type: TCoordType): gboolean{.cdecl.} - set_size*: proc (component: PComponent, width: gint, height: gint): gboolean{. - cdecl.} - get_layer*: proc (component: PComponent): TLayer{.cdecl.} - get_mdi_zorder*: proc (component: PComponent): gint{.cdecl.} - pad1*: TFunction - pad2*: TFunction - - PDocumentIface* = ptr TDocumentIface - TDocumentIface* = object of TGTypeInterface - get_document_type*: proc (document: PDocument): cstring{.cdecl.} - get_document*: proc (document: PDocument): gpointer{.cdecl.} - pad1*: TFunction - pad2*: TFunction - pad3*: TFunction - pad4*: TFunction - pad5*: TFunction - pad6*: TFunction - pad7*: TFunction - pad8*: TFunction - - PEditableTextIface* = ptr TEditableTextIface - TEditableTextIface* = object of TGTypeInterface - set_run_attributes*: proc (text: PEditableText, attrib_set: PAttributeSet, - start_offset: gint, end_offset: gint): gboolean{. - cdecl.} - set_text_contents*: proc (text: PEditableText, `string`: cstring){.cdecl.} - insert_text*: proc (text: PEditableText, `string`: cstring, length: gint, - position: Pgint){.cdecl.} - copy_text*: proc (text: PEditableText, start_pos: gint, end_pos: gint){. - cdecl.} - cut_text*: proc (text: PEditableText, start_pos: gint, end_pos: gint){.cdecl.} - delete_text*: proc (text: PEditableText, start_pos: gint, end_pos: gint){. - cdecl.} - paste_text*: proc (text: PEditableText, position: gint){.cdecl.} - pad1*: TFunction - pad2*: TFunction - - PGObjectAccessible* = ptr TGObjectAccessible - TGObjectAccessible* = object of TObject - PGObjectAccessibleClass* = ptr TGObjectAccessibleClass - TGObjectAccessibleClass* = object of TObjectClass - pad5*: TFunction - pad6*: TFunction - - PHyperlink* = ptr THyperlink - THyperlink* = object of TGObject - PHyperlinkClass* = ptr THyperlinkClass - THyperlinkClass* = object of TGObjectClass - get_uri*: proc (link: PHyperlink, i: gint): cstring{.cdecl.} - get_object*: proc (link: PHyperlink, i: gint): PObject{.cdecl.} - get_end_index*: proc (link: PHyperlink): gint{.cdecl.} - get_start_index*: proc (link: PHyperlink): gint{.cdecl.} - is_valid*: proc (link: PHyperlink): gboolean{.cdecl.} - get_n_anchors*: proc (link: PHyperlink): gint{.cdecl.} - pad7*: TFunction - pad8*: TFunction - pad9*: TFunction - pad10*: TFunction - - PHypertextIface* = ptr THypertextIface - THypertextIface* = object of TGTypeInterface - get_link*: proc (hypertext: PHypertext, link_index: gint): PHyperlink{.cdecl.} - get_n_links*: proc (hypertext: PHypertext): gint{.cdecl.} - get_link_index*: proc (hypertext: PHypertext, char_index: gint): gint{.cdecl.} - pad11*: TFunction - pad12*: TFunction - pad13*: TFunction - pad14*: TFunction - - PImageIface* = ptr TImageIface - TImageIface* = object of TGTypeInterface - get_image_position*: proc (image: PImage, x: Pgint, y: Pgint, - coord_type: TCoordType){.cdecl.} - get_image_description*: proc (image: PImage): cstring{.cdecl.} - get_image_size*: proc (image: PImage, width: Pgint, height: Pgint){.cdecl.} - set_image_description*: proc (image: PImage, description: cstring): gboolean{. - cdecl.} - pad15*: TFunction - pad16*: TFunction - - PObjectFactory* = ptr TObjectFactory - TObjectFactory* = object of TGObject - PObjectFactoryClass* = ptr TObjectFactoryClass - TObjectFactoryClass* = object of TGObjectClass - create_accessible*: proc (obj: PGObject): PObject{.cdecl.} - invalidate*: proc (factory: PObjectFactory){.cdecl.} - get_accessible_type*: proc (): GType{.cdecl.} - pad17*: TFunction - pad18*: TFunction - - PRegistry* = ptr TRegistry - TRegistry* = object of TGObject - factory_type_registry*: PGHashTable - factory_singleton_cache*: PGHashTable - - PRegistryClass* = ptr TRegistryClass - TRegistryClass* = object of TGObjectClass - PRelationType* = ptr TRelationType - TRelationType* = enum - RELATION_NULL, RELATION_CONTROLLED_BY, RELATION_CONTROLLER_FOR, - RELATION_LABEL_FOR, RELATION_LABELLED_BY, RELATION_MEMBER_OF, - RELATION_NODE_CHILD_OF, RELATION_LAST_DEFINED - PRelation* = ptr TRelation - PGPtrArray = pointer - TRelation* = object of TGObject - target*: PGPtrArray - relationship*: TRelationType - - PRelationClass* = ptr TRelationClass - TRelationClass* = object of TGObjectClass - TRelationSet* = object of TGObject - relations*: PGPtrArray - - PRelationSetClass* = ptr TRelationSetClass - TRelationSetClass* = object of TGObjectClass - pad19*: TFunction - pad20*: TFunction - - PSelectionIface* = ptr TSelectionIface - TSelectionIface* = object of TGTypeInterface - add_selection*: proc (selection: PSelection, i: gint): gboolean{.cdecl.} - clear_selection*: proc (selection: PSelection): gboolean{.cdecl.} - ref_selection*: proc (selection: PSelection, i: gint): PObject{.cdecl.} - get_selection_count*: proc (selection: PSelection): gint{.cdecl.} - is_child_selected*: proc (selection: PSelection, i: gint): gboolean{.cdecl.} - remove_selection*: proc (selection: PSelection, i: gint): gboolean{.cdecl.} - select_all_selection*: proc (selection: PSelection): gboolean{.cdecl.} - selection_changed*: proc (selection: PSelection){.cdecl.} - pad1*: TFunction - pad2*: TFunction - - PStateType* = ptr TStateType - TStateType* = enum - STATE_INVALID, STATE_ACTIVE, STATE_ARMED, STATE_BUSY, STATE_CHECKED, - STATE_DEFUNCT, STATE_EDITABLE, STATE_ENABLED, STATE_EXPANDABLE, - STATE_EXPANDED, STATE_FOCUSABLE, STATE_FOCUSED, STATE_HORIZONTAL, - STATE_ICONIFIED, STATE_MODAL, STATE_MULTI_LINE, STATE_MULTISELECTABLE, - STATE_OPAQUE, STATE_PRESSED, STATE_RESIZABLE, STATE_SELECTABLE, - STATE_SELECTED, STATE_SENSITIVE, STATE_SHOWING, STATE_SINGLE_LINE, - STATE_STALE, STATE_TRANSIENT, STATE_VERTICAL, STATE_VISIBLE, - STATE_LAST_DEFINED - PState* = ptr TState - TState* = guint64 - TStateSet* = object of TGObject - PStateSetClass* = ptr TStateSetClass - TStateSetClass* = object of TGObjectClass - PStreamableContentIface* = ptr TStreamableContentIface - TStreamableContentIface* = object of TGTypeInterface - get_n_mime_types*: proc (streamable: PStreamableContent): gint{.cdecl.} - get_mime_type*: proc (streamable: PStreamableContent, i: gint): cstring{. - cdecl.} - get_stream*: proc (streamable: PStreamableContent, mime_type: cstring): PGIOChannel{. - cdecl.} - pad21*: TFunction - pad22*: TFunction - pad23*: TFunction - pad24*: TFunction - - PTableIface* = ptr TTableIface - TTableIface* = object of TGTypeInterface - ref_at*: proc (table: PTable, row: gint, column: gint): PObject{.cdecl.} - get_index_at*: proc (table: PTable, row: gint, column: gint): gint{.cdecl.} - get_column_at_index*: proc (table: PTable, index: gint): gint{.cdecl.} - get_row_at_index*: proc (table: PTable, index: gint): gint{.cdecl.} - get_n_columns*: proc (table: PTable): gint{.cdecl.} - get_n_rows*: proc (table: PTable): gint{.cdecl.} - get_column_extent_at*: proc (table: PTable, row: gint, column: gint): gint{. - cdecl.} - get_row_extent_at*: proc (table: PTable, row: gint, column: gint): gint{. - cdecl.} - get_caption*: proc (table: PTable): PObject{.cdecl.} - get_column_description*: proc (table: PTable, column: gint): cstring{.cdecl.} - get_column_header*: proc (table: PTable, column: gint): PObject{.cdecl.} - get_row_description*: proc (table: PTable, row: gint): cstring{.cdecl.} - get_row_header*: proc (table: PTable, row: gint): PObject{.cdecl.} - get_summary*: proc (table: PTable): PObject{.cdecl.} - set_caption*: proc (table: PTable, caption: PObject){.cdecl.} - set_column_description*: proc (table: PTable, column: gint, - description: cstring){.cdecl.} - set_column_header*: proc (table: PTable, column: gint, header: PObject){. - cdecl.} - set_row_description*: proc (table: PTable, row: gint, description: cstring){. - cdecl.} - set_row_header*: proc (table: PTable, row: gint, header: PObject){.cdecl.} - set_summary*: proc (table: PTable, accessible: PObject){.cdecl.} - get_selected_columns*: proc (table: PTable, selected: PPgint): gint{.cdecl.} - get_selected_rows*: proc (table: PTable, selected: PPgint): gint{.cdecl.} - is_column_selected*: proc (table: PTable, column: gint): gboolean{.cdecl.} - is_row_selected*: proc (table: PTable, row: gint): gboolean{.cdecl.} - is_selected*: proc (table: PTable, row: gint, column: gint): gboolean{.cdecl.} - add_row_selection*: proc (table: PTable, row: gint): gboolean{.cdecl.} - remove_row_selection*: proc (table: PTable, row: gint): gboolean{.cdecl.} - add_column_selection*: proc (table: PTable, column: gint): gboolean{.cdecl.} - remove_column_selection*: proc (table: PTable, column: gint): gboolean{. - cdecl.} - row_inserted*: proc (table: PTable, row: gint, num_inserted: gint){.cdecl.} - column_inserted*: proc (table: PTable, column: gint, num_inserted: gint){. - cdecl.} - row_deleted*: proc (table: PTable, row: gint, num_deleted: gint){.cdecl.} - column_deleted*: proc (table: PTable, column: gint, num_deleted: gint){. - cdecl.} - row_reordered*: proc (table: PTable){.cdecl.} - column_reordered*: proc (table: PTable){.cdecl.} - model_changed*: proc (table: PTable){.cdecl.} - pad25*: TFunction - pad26*: TFunction - pad27*: TFunction - pad28*: TFunction - - TAttributeSet* = TGSList - PAttribute* = ptr TAttribute - TAttribute*{.final, pure.} = object - name*: cstring - value*: cstring - - PTextAttribute* = ptr TTextAttribute - TTextAttribute* = enum - TEXT_ATTR_INVALID, TEXT_ATTR_LEFT_MARGIN, TEXT_ATTR_RIGHT_MARGIN, - TEXT_ATTR_INDENT, TEXT_ATTR_INVISIBLE, TEXT_ATTR_EDITABLE, - TEXT_ATTR_PIXELS_ABOVE_LINES, TEXT_ATTR_PIXELS_BELOW_LINES, - TEXT_ATTR_PIXELS_INSIDE_WRAP, TEXT_ATTR_BG_FULL_HEIGHT, TEXT_ATTR_RISE, - TEXT_ATTR_UNDERLINE, TEXT_ATTR_STRIKETHROUGH, TEXT_ATTR_SIZE, - TEXT_ATTR_SCALE, TEXT_ATTR_WEIGHT, TEXT_ATTR_LANGUAGE, - TEXT_ATTR_FAMILY_NAME, TEXT_ATTR_BG_COLOR, TEXT_ATTR_FG_COLOR, - TEXT_ATTR_BG_STIPPLE, TEXT_ATTR_FG_STIPPLE, TEXT_ATTR_WRAP_MODE, - TEXT_ATTR_DIRECTION, TEXT_ATTR_JUSTIFICATION, TEXT_ATTR_STRETCH, - TEXT_ATTR_VARIANT, TEXT_ATTR_STYLE, TEXT_ATTR_LAST_DEFINED - PTextBoundary* = ptr TTextBoundary - TTextBoundary* = enum - TEXT_BOUNDARY_CHAR, TEXT_BOUNDARY_WORD_START, TEXT_BOUNDARY_WORD_END, - TEXT_BOUNDARY_SENTENCE_START, TEXT_BOUNDARY_SENTENCE_END, - TEXT_BOUNDARY_LINE_START, TEXT_BOUNDARY_LINE_END - PTextIface* = ptr TTextIface - TTextIface* = object of TGTypeInterface - get_text*: proc (text: PText, start_offset: gint, end_offset: gint): cstring{. - cdecl.} - get_text_after_offset*: proc (text: PText, offset: gint, - boundary_type: TTextBoundary, - start_offset: Pgint, end_offset: Pgint): cstring{. - cdecl.} - get_text_at_offset*: proc (text: PText, offset: gint, - boundary_type: TTextBoundary, - start_offset: Pgint, end_offset: Pgint): cstring{. - cdecl.} - get_character_at_offset*: proc (text: PText, offset: gint): gunichar{.cdecl.} - get_text_before_offset*: proc (text: PText, offset: gint, - boundary_type: TTextBoundary, - start_offset: Pgint, end_offset: Pgint): cstring{. - cdecl.} - get_caret_offset*: proc (text: PText): gint{.cdecl.} - get_run_attributes*: proc (text: PText, offset: gint, start_offset: Pgint, - end_offset: Pgint): PAttributeSet{.cdecl.} - get_default_attributes*: proc (text: PText): PAttributeSet{.cdecl.} - get_character_extents*: proc (text: PText, offset: gint, x: Pgint, y: Pgint, - width: Pgint, height: Pgint, - coords: TCoordType){.cdecl.} - get_character_count*: proc (text: PText): gint{.cdecl.} - get_offset_at_point*: proc (text: PText, x: gint, y: gint, - coords: TCoordType): gint{.cdecl.} - get_n_selections*: proc (text: PText): gint{.cdecl.} - get_selection*: proc (text: PText, selection_num: gint, start_offset: Pgint, - end_offset: Pgint): cstring{.cdecl.} - add_selection*: proc (text: PText, start_offset: gint, end_offset: gint): gboolean{. - cdecl.} - remove_selection*: proc (text: PText, selection_num: gint): gboolean{.cdecl.} - set_selection*: proc (text: PText, selection_num: gint, start_offset: gint, - end_offset: gint): gboolean{.cdecl.} - set_caret_offset*: proc (text: PText, offset: gint): gboolean{.cdecl.} - text_changed*: proc (text: PText, position: gint, length: gint){.cdecl.} - text_caret_moved*: proc (text: PText, location: gint){.cdecl.} - text_selection_changed*: proc (text: PText){.cdecl.} - pad29*: TFunction - pad30*: TFunction - pad31*: TFunction - pad32*: TFunction - - TEventListener* = proc (para1: PObject){.cdecl.} - TEventListenerInitProc* = proc (){.cdecl.} - TEventListenerInit* = proc (para1: TEventListenerInitProc){.cdecl.} - PKeyEventStruct* = ptr TKeyEventStruct - TKeyEventStruct*{.final, pure.} = object - `type`*: gint - state*: guint - keyval*: guint - length*: gint - string*: cstring - keycode*: guint16 - timestamp*: guint32 - - TKeySnoopFunc* = proc (event: PKeyEventStruct, func_data: gpointer): gint{. - cdecl.} - PKeyEventType* = ptr TKeyEventType - TKeyEventType* = enum - KEY_EVENT_PRESS, KEY_EVENT_RELEASE, KEY_EVENT_LAST_DEFINED - PUtil* = ptr TUtil - TUtil* = object of TGObject - PUtilClass* = ptr TUtilClass - TUtilClass* = object of TGObjectClass - add_global_event_listener*: proc (listener: TGSignalEmissionHook, - event_type: cstring): guint{.cdecl.} - remove_global_event_listener*: proc (listener_id: guint){.cdecl.} - add_key_event_listener*: proc (listener: TKeySnoopFunc, data: gpointer): guint{. - cdecl.} - remove_key_event_listener*: proc (listener_id: guint){.cdecl.} - get_root*: proc (): PObject{.cdecl.} - get_toolkit_name*: proc (): cstring{.cdecl.} - get_toolkit_version*: proc (): cstring{.cdecl.} - - PValueIface* = ptr TValueIface - TValueIface* = object of TGTypeInterface - get_current_value*: proc (obj: PValue, value: PGValue){.cdecl.} - get_maximum_value*: proc (obj: PValue, value: PGValue){.cdecl.} - get_minimum_value*: proc (obj: PValue, value: PGValue){.cdecl.} - set_current_value*: proc (obj: PValue, value: PGValue): gboolean{.cdecl.} - pad33*: TFunction - pad34*: TFunction - - -proc role_register*(name: cstring): TRole{.cdecl, dynlib: lib, - importc: "atk_role_register".} -proc object_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_object_get_type".} -proc TYPE_OBJECT*(): GType -proc `OBJECT`*(obj: pointer): PObject -proc OBJECT_CLASS*(klass: pointer): PObjectClass -proc IS_OBJECT*(obj: pointer): bool -proc IS_OBJECT_CLASS*(klass: pointer): bool -proc OBJECT_GET_CLASS*(obj: pointer): PObjectClass -proc TYPE_IMPLEMENTOR*(): GType -proc IS_IMPLEMENTOR*(obj: pointer): bool -proc IMPLEMENTOR*(obj: pointer): PImplementor -proc IMPLEMENTOR_GET_IFACE*(obj: pointer): PImplementorIface -proc implementor_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_implementor_get_type".} -proc ref_accessible*(implementor: PImplementor): PObject{.cdecl, - dynlib: lib, importc: "atk_implementor_ref_accessible".} -proc get_name*(accessible: PObject): cstring{.cdecl, dynlib: lib, - importc: "atk_object_get_name".} -proc get_description*(accessible: PObject): cstring{.cdecl, dynlib: lib, - importc: "atk_object_get_description".} -proc get_parent*(accessible: PObject): PObject{.cdecl, dynlib: lib, - importc: "atk_object_get_parent".} -proc get_n_accessible_children*(accessible: PObject): gint{.cdecl, - dynlib: lib, importc: "atk_object_get_n_accessible_children".} -proc ref_accessible_child*(accessible: PObject, i: gint): PObject{.cdecl, - dynlib: lib, importc: "atk_object_ref_accessible_child".} -proc ref_relation_set*(accessible: PObject): PRelationSet{.cdecl, - dynlib: lib, importc: "atk_object_ref_relation_set".} -proc get_role*(accessible: PObject): TRole{.cdecl, dynlib: lib, - importc: "atk_object_get_role".} -proc get_layer*(accessible: PObject): TLayer{.cdecl, dynlib: lib, - importc: "atk_object_get_layer".} -proc get_mdi_zorder*(accessible: PObject): gint{.cdecl, dynlib: lib, - importc: "atk_object_get_mdi_zorder".} -proc ref_state_set*(accessible: PObject): PStateSet{.cdecl, dynlib: lib, - importc: "atk_object_ref_state_set".} -proc get_index_in_parent*(accessible: PObject): gint{.cdecl, dynlib: lib, - importc: "atk_object_get_index_in_parent".} -proc set_name*(accessible: PObject, name: cstring){.cdecl, dynlib: lib, - importc: "atk_object_set_name".} -proc set_description*(accessible: PObject, description: cstring){.cdecl, - dynlib: lib, importc: "atk_object_set_description".} -proc set_parent*(accessible: PObject, parent: PObject){.cdecl, - dynlib: lib, importc: "atk_object_set_parent".} -proc set_role*(accessible: PObject, role: TRole){.cdecl, dynlib: lib, - importc: "atk_object_set_role".} -proc connect_property_change_handler*(accessible: PObject, - handler: TPropertyChangeHandler): guint{.cdecl, dynlib: lib, - importc: "atk_object_connect_property_change_handler".} -proc remove_property_change_handler*(accessible: PObject, - handler_id: guint){.cdecl, dynlib: lib, - importc: "atk_object_remove_property_change_handler".} -proc notify_state_change*(accessible: PObject, state: TState, - value: gboolean){.cdecl, dynlib: lib, - importc: "atk_object_notify_state_change".} -proc initialize*(accessible: PObject, data: gpointer){.cdecl, - dynlib: lib, importc: "atk_object_initialize".} -proc role_get_name*(role: TRole): cstring{.cdecl, dynlib: lib, - importc: "atk_role_get_name".} -proc role_for_name*(name: cstring): TRole{.cdecl, dynlib: lib, - importc: "atk_role_for_name".} -proc TYPE_ACTION*(): GType -proc IS_ACTION*(obj: pointer): bool -proc ACTION*(obj: pointer): PAction -proc ACTION_GET_IFACE*(obj: pointer): PActionIface -proc action_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_action_get_type".} -proc do_action*(action: PAction, i: gint): gboolean{.cdecl, dynlib: lib, - importc: "atk_action_do_action".} -proc get_n_actions*(action: PAction): gint{.cdecl, dynlib: lib, - importc: "atk_action_get_n_actions".} -proc get_description*(action: PAction, i: gint): cstring{.cdecl, - dynlib: lib, importc: "atk_action_get_description".} -proc get_name*(action: PAction, i: gint): cstring{.cdecl, dynlib: lib, - importc: "atk_action_get_name".} -proc get_keybinding*(action: PAction, i: gint): cstring{.cdecl, - dynlib: lib, importc: "atk_action_get_keybinding".} -proc set_description*(action: PAction, i: gint, desc: cstring): gboolean{. - cdecl, dynlib: lib, importc: "atk_action_set_description".} -proc TYPE_COMPONENT*(): GType -proc IS_COMPONENT*(obj: pointer): bool -proc COMPONENT*(obj: pointer): PComponent -proc COMPONENT_GET_IFACE*(obj: pointer): PComponentIface -proc component_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_component_get_type".} -proc add_focus_handler*(component: PComponent, handler: TFocusHandler): guint{. - cdecl, dynlib: lib, importc: "atk_component_add_focus_handler".} -proc contains*(component: PComponent, x, y: gint, - coord_type: TCoordType): gboolean{.cdecl, dynlib: lib, - importc: "atk_component_contains".} -proc ref_accessible_at_point*(component: PComponent, x, y: gint, - coord_type: TCoordType): PObject{.cdecl, - dynlib: lib, importc: "atk_component_ref_accessible_at_point".} -proc get_extents*(component: PComponent, x, y, width, height: Pgint, - coord_type: TCoordType){.cdecl, dynlib: lib, - importc: "atk_component_get_extents".} -proc get_position*(component: PComponent, x: Pgint, y: Pgint, - coord_type: TCoordType){.cdecl, dynlib: lib, - importc: "atk_component_get_position".} -proc get_size*(component: PComponent, width: Pgint, height: Pgint){. - cdecl, dynlib: lib, importc: "atk_component_get_size".} -proc get_layer*(component: PComponent): TLayer{.cdecl, dynlib: lib, - importc: "atk_component_get_layer".} -proc get_mdi_zorder*(component: PComponent): gint{.cdecl, dynlib: lib, - importc: "atk_component_get_mdi_zorder".} -proc grab_focus*(component: PComponent): gboolean{.cdecl, dynlib: lib, - importc: "atk_component_grab_focus".} -proc remove_focus_handler*(component: PComponent, handler_id: guint){. - cdecl, dynlib: lib, importc: "atk_component_remove_focus_handler".} -proc set_extents*(component: PComponent, x: gint, y: gint, - width: gint, height: gint, coord_type: TCoordType): gboolean{. - cdecl, dynlib: lib, importc: "atk_component_set_extents".} -proc set_position*(component: PComponent, x: gint, y: gint, - coord_type: TCoordType): gboolean{.cdecl, - dynlib: lib, importc: "atk_component_set_position".} -proc set_size*(component: PComponent, width: gint, height: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_component_set_size".} -proc TYPE_DOCUMENT*(): GType -proc IS_DOCUMENT*(obj: pointer): bool -proc DOCUMENT*(obj: pointer): PDocument -proc DOCUMENT_GET_IFACE*(obj: pointer): PDocumentIface -proc document_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_document_get_type".} -proc get_document_type*(document: PDocument): cstring{.cdecl, - dynlib: lib, importc: "atk_document_get_document_type".} -proc get_document*(document: PDocument): gpointer{.cdecl, dynlib: lib, - importc: "atk_document_get_document".} -proc TYPE_EDITABLE_TEXT*(): GType -proc IS_EDITABLE_TEXT*(obj: pointer): bool -proc EDITABLE_TEXT*(obj: pointer): PEditableText -proc EDITABLE_TEXT_GET_IFACE*(obj: pointer): PEditableTextIface -proc editable_text_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_editable_text_get_type".} -proc set_run_attributes*(text: PEditableText, - attrib_set: PAttributeSet, - start_offset: gint, end_offset: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_editable_text_set_run_attributes".} -proc set_text_contents*(text: PEditableText, string: cstring){. - cdecl, dynlib: lib, importc: "atk_editable_text_set_text_contents".} -proc insert_text*(text: PEditableText, `string`: cstring, - length: gint, position: Pgint){.cdecl, - dynlib: lib, importc: "atk_editable_text_insert_text".} -proc copy_text*(text: PEditableText, start_pos: gint, - end_pos: gint){.cdecl, dynlib: lib, - importc: "atk_editable_text_copy_text".} -proc cut_text*(text: PEditableText, start_pos: gint, end_pos: gint){. - cdecl, dynlib: lib, importc: "atk_editable_text_cut_text".} -proc delete_text*(text: PEditableText, start_pos: gint, - end_pos: gint){.cdecl, dynlib: lib, - importc: "atk_editable_text_delete_text".} -proc paste_text*(text: PEditableText, position: gint){.cdecl, - dynlib: lib, importc: "atk_editable_text_paste_text".} -proc TYPE_GOBJECT_ACCESSIBLE*(): GType -proc GOBJECT_ACCESSIBLE*(obj: pointer): PGObjectAccessible -proc GOBJECT_ACCESSIBLE_CLASS*(klass: pointer): PGObjectAccessibleClass -proc IS_GOBJECT_ACCESSIBLE*(obj: pointer): bool -proc IS_GOBJECT_ACCESSIBLE_CLASS*(klass: pointer): bool -proc GOBJECT_ACCESSIBLE_GET_CLASS*(obj: pointer): PGObjectAccessibleClass -proc gobject_accessible_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_gobject_accessible_get_type".} -proc accessible_for_object*(obj: PGObject): PObject{.cdecl, dynlib: lib, - importc: "atk_gobject_accessible_for_object".} -proc get_object*(obj: PGObjectAccessible): PGObject{.cdecl, - dynlib: lib, importc: "atk_gobject_accessible_get_object".} -proc TYPE_HYPERLINK*(): GType -proc HYPERLINK*(obj: pointer): PHyperlink -proc HYPERLINK_CLASS*(klass: pointer): PHyperlinkClass -proc IS_HYPERLINK*(obj: pointer): bool -proc IS_HYPERLINK_CLASS*(klass: pointer): bool -proc HYPERLINK_GET_CLASS*(obj: pointer): PHyperlinkClass -proc hyperlink_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_hyperlink_get_type".} -proc get_uri*(link: PHyperlink, i: gint): cstring{.cdecl, dynlib: lib, - importc: "atk_hyperlink_get_uri".} -proc get_object*(link: PHyperlink, i: gint): PObject{.cdecl, - dynlib: lib, importc: "atk_hyperlink_get_object".} -proc get_end_index*(link: PHyperlink): gint{.cdecl, dynlib: lib, - importc: "atk_hyperlink_get_end_index".} -proc get_start_index*(link: PHyperlink): gint{.cdecl, dynlib: lib, - importc: "atk_hyperlink_get_start_index".} -proc is_valid*(link: PHyperlink): gboolean{.cdecl, dynlib: lib, - importc: "atk_hyperlink_is_valid".} -proc get_n_anchors*(link: PHyperlink): gint{.cdecl, dynlib: lib, - importc: "atk_hyperlink_get_n_anchors".} -proc TYPE_HYPERTEXT*(): GType -proc IS_HYPERTEXT*(obj: pointer): bool -proc HYPERTEXT*(obj: pointer): PHypertext -proc HYPERTEXT_GET_IFACE*(obj: pointer): PHypertextIface -proc hypertext_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_hypertext_get_type".} -proc get_link*(hypertext: PHypertext, link_index: gint): PHyperlink{. - cdecl, dynlib: lib, importc: "atk_hypertext_get_link".} -proc get_n_links*(hypertext: PHypertext): gint{.cdecl, dynlib: lib, - importc: "atk_hypertext_get_n_links".} -proc get_link_index*(hypertext: PHypertext, char_index: gint): gint{. - cdecl, dynlib: lib, importc: "atk_hypertext_get_link_index".} -proc TYPE_IMAGE*(): GType -proc IS_IMAGE*(obj: pointer): bool -proc IMAGE*(obj: pointer): PImage -proc IMAGE_GET_IFACE*(obj: pointer): PImageIface -proc image_get_type*(): GType{.cdecl, dynlib: lib, importc: "atk_image_get_type".} -proc get_image_description*(image: PImage): cstring{.cdecl, dynlib: lib, - importc: "atk_image_get_image_description".} -proc get_image_size*(image: PImage, width: Pgint, height: Pgint){.cdecl, - dynlib: lib, importc: "atk_image_get_image_size".} -proc set_image_description*(image: PImage, description: cstring): gboolean{. - cdecl, dynlib: lib, importc: "atk_image_set_image_description".} -proc get_image_position*(image: PImage, x: Pgint, y: Pgint, - coord_type: TCoordType){.cdecl, dynlib: lib, - importc: "atk_image_get_image_position".} -proc TYPE_OBJECT_FACTORY*(): GType -proc OBJECT_FACTORY*(obj: pointer): PObjectFactory -proc OBJECT_FACTORY_CLASS*(klass: pointer): PObjectFactoryClass -proc IS_OBJECT_FACTORY*(obj: pointer): bool -proc IS_OBJECT_FACTORY_CLASS*(klass: pointer): bool -proc OBJECT_FACTORY_GET_CLASS*(obj: pointer): PObjectFactoryClass -proc object_factory_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_object_factory_get_type".} -proc create_accessible*(factory: PObjectFactory, obj: PGObject): PObject{. - cdecl, dynlib: lib, importc: "atk_object_factory_create_accessible".} -proc invalidate*(factory: PObjectFactory){.cdecl, dynlib: lib, - importc: "atk_object_factory_invalidate".} -proc get_accessible_type*(factory: PObjectFactory): GType{.cdecl, - dynlib: lib, importc: "atk_object_factory_get_accessible_type".} -proc TYPE_REGISTRY*(): GType -proc REGISTRY*(obj: pointer): PRegistry -proc REGISTRY_CLASS*(klass: pointer): PRegistryClass -proc IS_REGISTRY*(obj: pointer): bool -proc IS_REGISTRY_CLASS*(klass: pointer): bool -proc REGISTRY_GET_CLASS*(obj: pointer): PRegistryClass -proc registry_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_registry_get_type".} -proc set_factory_type*(registry: PRegistry, `type`: GType, - factory_type: GType){.cdecl, dynlib: lib, - importc: "atk_registry_set_factory_type".} -proc get_factory_type*(registry: PRegistry, `type`: GType): GType{. - cdecl, dynlib: lib, importc: "atk_registry_get_factory_type".} -proc get_factory*(registry: PRegistry, `type`: GType): PObjectFactory{. - cdecl, dynlib: lib, importc: "atk_registry_get_factory".} -proc get_default_registry*(): PRegistry{.cdecl, dynlib: lib, - importc: "atk_get_default_registry".} -proc TYPE_RELATION*(): GType -proc RELATION*(obj: pointer): PRelation -proc RELATION_CLASS*(klass: pointer): PRelationClass -proc IS_RELATION*(obj: pointer): bool -proc IS_RELATION_CLASS*(klass: pointer): bool -proc RELATION_GET_CLASS*(obj: pointer): PRelationClass -proc relation_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_relation_get_type".} -proc relation_type_register*(name: cstring): TRelationType{.cdecl, dynlib: lib, - importc: "atk_relation_type_register".} -proc relation_type_get_name*(`type`: TRelationType): cstring{.cdecl, - dynlib: lib, importc: "atk_relation_type_get_name".} -proc relation_type_for_name*(name: cstring): TRelationType{.cdecl, dynlib: lib, - importc: "atk_relation_type_for_name".} -proc relation_new*(targets: PPAtkObject, n_targets: gint, - relationship: TRelationType): PRelation{.cdecl, dynlib: lib, - importc: "atk_relation_new".} -proc get_relation_type*(relation: PRelation): TRelationType{.cdecl, - dynlib: lib, importc: "atk_relation_get_relation_type".} -proc get_target*(relation: PRelation): PGPtrArray{.cdecl, dynlib: lib, - importc: "atk_relation_get_target".} -proc TYPE_RELATION_SET*(): GType -proc RELATION_SET*(obj: pointer): PRelationSet -proc RELATION_SET_CLASS*(klass: pointer): PRelationSetClass -proc IS_RELATION_SET*(obj: pointer): bool -proc IS_RELATION_SET_CLASS*(klass: pointer): bool -proc RELATION_SET_GET_CLASS*(obj: pointer): PRelationSetClass -proc relation_set_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_relation_set_get_type".} -proc relation_set_new*(): PRelationSet{.cdecl, dynlib: lib, - importc: "atk_relation_set_new".} -proc contains*(RelationSet: PRelationSet, - relationship: TRelationType): gboolean{.cdecl, - dynlib: lib, importc: "atk_relation_set_contains".} -proc remove*(RelationSet: PRelationSet, relation: PRelation){. - cdecl, dynlib: lib, importc: "atk_relation_set_remove".} -proc add*(RelationSet: PRelationSet, relation: PRelation){.cdecl, - dynlib: lib, importc: "atk_relation_set_add".} -proc get_n_relations*(RelationSet: PRelationSet): gint{.cdecl, - dynlib: lib, importc: "atk_relation_set_get_n_relations".} -proc get_relation*(RelationSet: PRelationSet, i: gint): PRelation{. - cdecl, dynlib: lib, importc: "atk_relation_set_get_relation".} -proc get_relation_by_type*(RelationSet: PRelationSet, - relationship: TRelationType): PRelation{. - cdecl, dynlib: lib, importc: "atk_relation_set_get_relation_by_type".} -proc TYPE_SELECTION*(): GType -proc IS_SELECTION*(obj: pointer): bool -proc SELECTION*(obj: pointer): PSelection -proc SELECTION_GET_IFACE*(obj: pointer): PSelectionIface -proc selection_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_selection_get_type".} -proc add_selection*(selection: PSelection, i: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_selection_add_selection".} -proc clear_selection*(selection: PSelection): gboolean{.cdecl, - dynlib: lib, importc: "atk_selection_clear_selection".} -proc ref_selection*(selection: PSelection, i: gint): PObject{.cdecl, - dynlib: lib, importc: "atk_selection_ref_selection".} -proc get_selection_count*(selection: PSelection): gint{.cdecl, - dynlib: lib, importc: "atk_selection_get_selection_count".} -proc is_child_selected*(selection: PSelection, i: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_selection_is_child_selected".} -proc remove_selection*(selection: PSelection, i: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_selection_remove_selection".} -proc select_all_selection*(selection: PSelection): gboolean{.cdecl, - dynlib: lib, importc: "atk_selection_select_all_selection".} -proc state_type_register*(name: cstring): TStateType{.cdecl, dynlib: lib, - importc: "atk_state_type_register".} -proc state_type_get_name*(`type`: TStateType): cstring{.cdecl, dynlib: lib, - importc: "atk_state_type_get_name".} -proc state_type_for_name*(name: cstring): TStateType{.cdecl, dynlib: lib, - importc: "atk_state_type_for_name".} -proc TYPE_STATE_SET*(): GType -proc STATE_SET*(obj: pointer): PStateSet -proc STATE_SET_CLASS*(klass: pointer): PStateSetClass -proc IS_STATE_SET*(obj: pointer): bool -proc IS_STATE_SET_CLASS*(klass: pointer): bool -proc STATE_SET_GET_CLASS*(obj: pointer): PStateSetClass -proc state_set_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_state_set_get_type".} -proc state_set_new*(): PStateSet{.cdecl, dynlib: lib, - importc: "atk_state_set_new".} -proc is_empty*(StateSet: PStateSet): gboolean{.cdecl, dynlib: lib, - importc: "atk_state_set_is_empty".} -proc add_state*(StateSet: PStateSet, `type`: TStateType): gboolean{. - cdecl, dynlib: lib, importc: "atk_state_set_add_state".} -proc add_states*(StateSet: PStateSet, types: PStateType, n_types: gint){. - cdecl, dynlib: lib, importc: "atk_state_set_add_states".} -proc clear_states*(StateSet: PStateSet){.cdecl, dynlib: lib, - importc: "atk_state_set_clear_states".} -proc contains_state*(StateSet: PStateSet, `type`: TStateType): gboolean{. - cdecl, dynlib: lib, importc: "atk_state_set_contains_state".} -proc contains_states*(StateSet: PStateSet, types: PStateType, - n_types: gint): gboolean{.cdecl, dynlib: lib, - importc: "atk_state_set_contains_states".} -proc remove_state*(StateSet: PStateSet, `type`: TStateType): gboolean{. - cdecl, dynlib: lib, importc: "atk_state_set_remove_state".} -proc and_sets*(StateSet: PStateSet, compare_set: PStateSet): PStateSet{. - cdecl, dynlib: lib, importc: "atk_state_set_and_sets".} -proc or_sets*(StateSet: PStateSet, compare_set: PStateSet): PStateSet{. - cdecl, dynlib: lib, importc: "atk_state_set_or_sets".} -proc xor_sets*(StateSet: PStateSet, compare_set: PStateSet): PStateSet{. - cdecl, dynlib: lib, importc: "atk_state_set_xor_sets".} -proc TYPE_STREAMABLE_CONTENT*(): GType -proc IS_STREAMABLE_CONTENT*(obj: pointer): bool -proc STREAMABLE_CONTENT*(obj: pointer): PStreamableContent -proc STREAMABLE_CONTENT_GET_IFACE*(obj: pointer): PStreamableContentIface -proc streamable_content_get_type*(): GType{.cdecl, dynlib: lib, - importc: "atk_streamable_content_get_type".} -proc get_n_mime_types*(streamable: PStreamableContent): gint{. - cdecl, dynlib: lib, importc: "atk_streamable_content_get_n_mime_types".} -proc get_mime_type*(streamable: PStreamableContent, i: gint): cstring{. - cdecl, dynlib: lib, importc: "atk_streamable_content_get_mime_type".} -proc get_stream*(streamable: PStreamableContent, - mime_type: cstring): PGIOChannel{.cdecl, - dynlib: lib, importc: "atk_streamable_content_get_stream".} -proc TYPE_TABLE*(): GType -proc IS_TABLE*(obj: pointer): bool -proc TABLE*(obj: pointer): PTable -proc TABLE_GET_IFACE*(obj: pointer): PTableIface -proc table_get_type*(): GType{.cdecl, dynlib: lib, importc: "atk_table_get_type".} -proc ref_at*(table: PTable, row, column: gint): PObject{.cdecl, - dynlib: lib, importc: "atk_table_ref_at".} -proc get_index_at*(table: PTable, row, column: gint): gint{.cdecl, - dynlib: lib, importc: "atk_table_get_index_at".} -proc get_column_at_index*(table: PTable, index: gint): gint{.cdecl, - dynlib: lib, importc: "atk_table_get_column_at_index".} -proc get_row_at_index*(table: PTable, index: gint): gint{.cdecl, - dynlib: lib, importc: "atk_table_get_row_at_index".} -proc get_n_columns*(table: PTable): gint{.cdecl, dynlib: lib, - importc: "atk_table_get_n_columns".} -proc get_n_rows*(table: PTable): gint{.cdecl, dynlib: lib, - importc: "atk_table_get_n_rows".} -proc get_column_extent_at*(table: PTable, row: gint, column: gint): gint{. - cdecl, dynlib: lib, importc: "atk_table_get_column_extent_at".} -proc get_row_extent_at*(table: PTable, row: gint, column: gint): gint{. - cdecl, dynlib: lib, importc: "atk_table_get_row_extent_at".} -proc get_caption*(table: PTable): PObject{.cdecl, dynlib: lib, - importc: "atk_table_get_caption".} -proc get_column_description*(table: PTable, column: gint): cstring{.cdecl, - dynlib: lib, importc: "atk_table_get_column_description".} -proc get_column_header*(table: PTable, column: gint): PObject{.cdecl, - dynlib: lib, importc: "atk_table_get_column_header".} -proc get_row_description*(table: PTable, row: gint): cstring{.cdecl, - dynlib: lib, importc: "atk_table_get_row_description".} -proc get_row_header*(table: PTable, row: gint): PObject{.cdecl, - dynlib: lib, importc: "atk_table_get_row_header".} -proc get_summary*(table: PTable): PObject{.cdecl, dynlib: lib, - importc: "atk_table_get_summary".} -proc set_caption*(table: PTable, caption: PObject){.cdecl, dynlib: lib, - importc: "atk_table_set_caption".} -proc set_column_description*(table: PTable, column: gint, - description: cstring){.cdecl, dynlib: lib, - importc: "atk_table_set_column_description".} -proc set_column_header*(table: PTable, column: gint, header: PObject){. - cdecl, dynlib: lib, importc: "atk_table_set_column_header".} -proc set_row_description*(table: PTable, row: gint, description: cstring){. - cdecl, dynlib: lib, importc: "atk_table_set_row_description".} -proc set_row_header*(table: PTable, row: gint, header: PObject){.cdecl, - dynlib: lib, importc: "atk_table_set_row_header".} -proc set_summary*(table: PTable, accessible: PObject){.cdecl, dynlib: lib, - importc: "atk_table_set_summary".} -proc get_selected_columns*(table: PTable, selected: PPgint): gint{.cdecl, - dynlib: lib, importc: "atk_table_get_selected_columns".} -proc get_selected_rows*(table: PTable, selected: PPgint): gint{.cdecl, - dynlib: lib, importc: "atk_table_get_selected_rows".} -proc is_column_selected*(table: PTable, column: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_table_is_column_selected".} -proc is_row_selected*(table: PTable, row: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_table_is_row_selected".} -proc is_selected*(table: PTable, row: gint, column: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_table_is_selected".} -proc add_row_selection*(table: PTable, row: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_table_add_row_selection".} -proc remove_row_selection*(table: PTable, row: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_table_remove_row_selection".} -proc add_column_selection*(table: PTable, column: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_table_add_column_selection".} -proc remove_column_selection*(table: PTable, column: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_table_remove_column_selection".} -proc text_attribute_register*(name: cstring): TTextAttribute{.cdecl, - dynlib: lib, importc: "atk_text_attribute_register".} -proc TYPE_TEXT*(): GType -proc IS_TEXT*(obj: pointer): bool -proc TEXT*(obj: pointer): PText -proc TEXT_GET_IFACE*(obj: pointer): PTextIface -proc text_get_type*(): GType{.cdecl, dynlib: lib, importc: "atk_text_get_type".} -proc get_text*(text: PText, start_offset: gint, end_offset: gint): cstring{. - cdecl, dynlib: lib, importc: "atk_text_get_text".} -proc get_character_at_offset*(text: PText, offset: gint): gunichar{.cdecl, - dynlib: lib, importc: "atk_text_get_character_at_offset".} -proc get_text_after_offset*(text: PText, offset: gint, - boundary_type: TTextBoundary, - start_offset: Pgint, end_offset: Pgint): cstring{. - cdecl, dynlib: lib, importc: "atk_text_get_text_after_offset".} -proc get_text_at_offset*(text: PText, offset: gint, - boundary_type: TTextBoundary, start_offset: Pgint, - end_offset: Pgint): cstring{.cdecl, dynlib: lib, - importc: "atk_text_get_text_at_offset".} -proc get_text_before_offset*(text: PText, offset: gint, - boundary_type: TTextBoundary, - start_offset: Pgint, end_offset: Pgint): cstring{. - cdecl, dynlib: lib, importc: "atk_text_get_text_before_offset".} -proc get_caret_offset*(text: PText): gint{.cdecl, dynlib: lib, - importc: "atk_text_get_caret_offset".} -proc get_character_extents*(text: PText, offset: gint, x: Pgint, y: Pgint, - width: Pgint, height: Pgint, coords: TCoordType){. - cdecl, dynlib: lib, importc: "atk_text_get_character_extents".} -proc get_run_attributes*(text: PText, offset: gint, start_offset: Pgint, - end_offset: Pgint): PAttributeSet{.cdecl, - dynlib: lib, importc: "atk_text_get_run_attributes".} -proc get_default_attributes*(text: PText): PAttributeSet{.cdecl, - dynlib: lib, importc: "atk_text_get_default_attributes".} -proc get_character_count*(text: PText): gint{.cdecl, dynlib: lib, - importc: "atk_text_get_character_count".} -proc get_offset_at_point*(text: PText, x: gint, y: gint, coords: TCoordType): gint{. - cdecl, dynlib: lib, importc: "atk_text_get_offset_at_point".} -proc get_n_selections*(text: PText): gint{.cdecl, dynlib: lib, - importc: "atk_text_get_n_selections".} -proc get_selection*(text: PText, selection_num: gint, start_offset: Pgint, - end_offset: Pgint): cstring{.cdecl, dynlib: lib, - importc: "atk_text_get_selection".} -proc add_selection*(text: PText, start_offset: gint, end_offset: gint): gboolean{. - cdecl, dynlib: lib, importc: "atk_text_add_selection".} -proc remove_selection*(text: PText, selection_num: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_text_remove_selection".} -proc set_selection*(text: PText, selection_num: gint, start_offset: gint, - end_offset: gint): gboolean{.cdecl, dynlib: lib, - importc: "atk_text_set_selection".} -proc set_caret_offset*(text: PText, offset: gint): gboolean{.cdecl, - dynlib: lib, importc: "atk_text_set_caret_offset".} -proc free*(attrib_set: PAttributeSet){.cdecl, dynlib: lib, - importc: "atk_attribute_set_free".} -proc text_attribute_get_name*(attr: TTextAttribute): cstring{.cdecl, - dynlib: lib, importc: "atk_text_attribute_get_name".} -proc text_attribute_for_name*(name: cstring): TTextAttribute{.cdecl, - dynlib: lib, importc: "atk_text_attribute_for_name".} -proc text_attribute_get_value*(attr: TTextAttribute, index: gint): cstring{. - cdecl, dynlib: lib, importc: "atk_text_attribute_get_value".} -proc TYPE_UTIL*(): GType -proc IS_UTIL*(obj: pointer): bool -proc UTIL*(obj: pointer): PUtil -proc UTIL_CLASS*(klass: pointer): PUtilClass -proc IS_UTIL_CLASS*(klass: pointer): bool -proc UTIL_GET_CLASS*(obj: pointer): PUtilClass -proc util_get_type*(): GType{.cdecl, dynlib: lib, importc: "atk_util_get_type".} -proc add_focus_tracker*(focus_tracker: TEventListener): guint{.cdecl, - dynlib: lib, importc: "atk_add_focus_tracker".} -proc remove_focus_tracker*(tracker_id: guint){.cdecl, dynlib: lib, - importc: "atk_remove_focus_tracker".} -proc focus_tracker_init*(add_function: TEventListenerInit){.cdecl, dynlib: lib, - importc: "atk_focus_tracker_init".} -proc focus_tracker_notify*(anObject: PObject){.cdecl, dynlib: lib, - importc: "atk_focus_tracker_notify".} -proc add_global_event_listener*(listener: TGSignalEmissionHook, - event_type: cstring): guint{.cdecl, dynlib: lib, - importc: "atk_add_global_event_listener".} -proc remove_global_event_listener*(listener_id: guint){.cdecl, dynlib: lib, - importc: "atk_remove_global_event_listener".} -proc add_key_event_listener*(listener: TKeySnoopFunc, data: gpointer): guint{. - cdecl, dynlib: lib, importc: "atk_add_key_event_listener".} -proc remove_key_event_listener*(listener_id: guint){.cdecl, dynlib: lib, - importc: "atk_remove_key_event_listener".} -proc get_root*(): PObject{.cdecl, dynlib: lib, importc: "atk_get_root".} -proc get_toolkit_name*(): cstring{.cdecl, dynlib: lib, - importc: "atk_get_toolkit_name".} -proc get_toolkit_version*(): cstring{.cdecl, dynlib: lib, - importc: "atk_get_toolkit_version".} -proc TYPE_VALUE*(): GType -proc IS_VALUE*(obj: pointer): bool -proc VALUE*(obj: pointer): PValue -proc VALUE_GET_IFACE*(obj: pointer): PValueIface -proc value_get_type*(): GType{.cdecl, dynlib: lib, importc: "atk_value_get_type".} -proc get_current_value*(obj: PValue, value: PGValue){.cdecl, dynlib: lib, - importc: "atk_value_get_current_value".} -proc get_maximum_value*(obj: PValue, value: PGValue){.cdecl, dynlib: lib, - importc: "atk_value_get_maximum_value".} -proc get_minimum_value*(obj: PValue, value: PGValue){.cdecl, dynlib: lib, - importc: "atk_value_get_minimum_value".} -proc set_current_value*(obj: PValue, value: PGValue): gboolean{.cdecl, - dynlib: lib, importc: "atk_value_set_current_value".} -proc TYPE_OBJECT*(): GType = - result = object_get_type() - -proc `OBJECT`*(obj: pointer): PObject = - result = cast[PObject](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_OBJECT())) - -proc OBJECT_CLASS*(klass: pointer): PObjectClass = - result = cast[PObjectClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_OBJECT())) - -proc IS_OBJECT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_OBJECT()) - -proc IS_OBJECT_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_OBJECT()) - -proc OBJECT_GET_CLASS*(obj: pointer): PObjectClass = - result = cast[PObjectClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_OBJECT())) - -proc TYPE_IMPLEMENTOR*(): GType = - result = implementor_get_type() - -proc IS_IMPLEMENTOR*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_IMPLEMENTOR()) - -proc IMPLEMENTOR*(obj: pointer): PImplementor = - result = PImplementor(G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_IMPLEMENTOR())) - -proc IMPLEMENTOR_GET_IFACE*(obj: pointer): PImplementorIface = - result = cast[PImplementorIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_IMPLEMENTOR())) - -proc TYPE_ACTION*(): GType = - result = action_get_type() - -proc IS_ACTION*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_ACTION()) - -proc ACTION*(obj: pointer): PAction = - result = PAction(G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_ACTION())) - -proc ACTION_GET_IFACE*(obj: pointer): PActionIface = - result = cast[PActionIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, TYPE_ACTION())) - -proc TYPE_COMPONENT*(): GType = - result = component_get_type() - -proc IS_COMPONENT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_COMPONENT()) - -proc COMPONENT*(obj: pointer): PComponent = - result = PComponent(G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_COMPONENT())) - -proc COMPONENT_GET_IFACE*(obj: pointer): PComponentIface = - result = cast[PComponentIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_COMPONENT())) - -proc TYPE_DOCUMENT*(): GType = - result = document_get_type() - -proc IS_DOCUMENT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_DOCUMENT()) - -proc DOCUMENT*(obj: pointer): PDocument = - result = cast[PDocument](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_DOCUMENT())) - -proc DOCUMENT_GET_IFACE*(obj: pointer): PDocumentIface = - result = cast[PDocumentIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_DOCUMENT())) - -proc TYPE_EDITABLE_TEXT*(): GType = - result = editable_text_get_type() - -proc IS_EDITABLE_TEXT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_EDITABLE_TEXT()) - -proc EDITABLE_TEXT*(obj: pointer): PEditableText = - result = cast[PEditableText](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_EDITABLE_TEXT())) - -proc EDITABLE_TEXT_GET_IFACE*(obj: pointer): PEditableTextIface = - result = cast[PEditableTextIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_EDITABLE_TEXT())) - -proc TYPE_GOBJECT_ACCESSIBLE*(): GType = - result = gobject_accessible_get_type() - -proc GOBJECT_ACCESSIBLE*(obj: pointer): PGObjectAccessible = - result = cast[PGObjectAccessible](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_GOBJECT_ACCESSIBLE())) - -proc GOBJECT_ACCESSIBLE_CLASS*(klass: pointer): PGObjectAccessibleClass = - result = cast[PGObjectAccessibleClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_GOBJECT_ACCESSIBLE())) - -proc IS_GOBJECT_ACCESSIBLE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_GOBJECT_ACCESSIBLE()) - -proc IS_GOBJECT_ACCESSIBLE_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GOBJECT_ACCESSIBLE()) - -proc GOBJECT_ACCESSIBLE_GET_CLASS*(obj: pointer): PGObjectAccessibleClass = - result = cast[PGObjectAccessibleClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_GOBJECT_ACCESSIBLE())) - -proc TYPE_HYPERLINK*(): GType = - result = hyperlink_get_type() - -proc HYPERLINK*(obj: pointer): PHyperlink = - result = cast[PHyperlink](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_HYPERLINK())) - -proc HYPERLINK_CLASS*(klass: pointer): PHyperlinkClass = - result = cast[PHyperlinkClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_HYPERLINK())) - -proc IS_HYPERLINK*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_HYPERLINK()) - -proc IS_HYPERLINK_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_HYPERLINK()) - -proc HYPERLINK_GET_CLASS*(obj: pointer): PHyperlinkClass = - result = cast[PHyperlinkClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_HYPERLINK())) - -proc TYPE_HYPERTEXT*(): GType = - result = hypertext_get_type() - -proc IS_HYPERTEXT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_HYPERTEXT()) - -proc HYPERTEXT*(obj: pointer): PHypertext = - result = cast[PHypertext](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_HYPERTEXT())) - -proc HYPERTEXT_GET_IFACE*(obj: pointer): PHypertextIface = - result = cast[PHypertextIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_HYPERTEXT())) - -proc TYPE_IMAGE*(): GType = - result = image_get_type() - -proc IS_IMAGE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_IMAGE()) - -proc IMAGE*(obj: pointer): PImage = - result = cast[PImage](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_IMAGE())) - -proc IMAGE_GET_IFACE*(obj: pointer): PImageIface = - result = cast[PImageIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, TYPE_IMAGE())) - -proc TYPE_OBJECT_FACTORY*(): GType = - result = object_factory_get_type() - -proc OBJECT_FACTORY*(obj: pointer): PObjectFactory = - result = cast[PObjectFactory](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_OBJECT_FACTORY())) - -proc OBJECT_FACTORY_CLASS*(klass: pointer): PObjectFactoryClass = - result = cast[PObjectFactoryClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_OBJECT_FACTORY())) - -proc IS_OBJECT_FACTORY*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_OBJECT_FACTORY()) - -proc IS_OBJECT_FACTORY_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_OBJECT_FACTORY()) - -proc OBJECT_FACTORY_GET_CLASS*(obj: pointer): PObjectFactoryClass = - result = cast[PObjectFactoryClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_OBJECT_FACTORY())) - -proc TYPE_REGISTRY*(): GType = - result = registry_get_type() - -proc REGISTRY*(obj: pointer): PRegistry = - result = cast[PRegistry](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_REGISTRY())) - -proc REGISTRY_CLASS*(klass: pointer): PRegistryClass = - result = cast[PRegistryClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_REGISTRY())) - -proc IS_REGISTRY*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_REGISTRY()) - -proc IS_REGISTRY_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_REGISTRY()) - -proc REGISTRY_GET_CLASS*(obj: pointer): PRegistryClass = - result = cast[PRegistryClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_REGISTRY())) - -proc TYPE_RELATION*(): GType = - result = relation_get_type() - -proc RELATION*(obj: pointer): PRelation = - result = cast[PRelation](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_RELATION())) - -proc RELATION_CLASS*(klass: pointer): PRelationClass = - result = cast[PRelationClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_RELATION())) - -proc IS_RELATION*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_RELATION()) - -proc IS_RELATION_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_RELATION()) - -proc RELATION_GET_CLASS*(obj: pointer): PRelationClass = - result = cast[PRelationClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_RELATION())) - -proc TYPE_RELATION_SET*(): GType = - result = relation_set_get_type() - -proc RELATION_SET*(obj: pointer): PRelationSet = - result = cast[PRelationSet](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_RELATION_SET())) - -proc RELATION_SET_CLASS*(klass: pointer): PRelationSetClass = - result = cast[PRelationSetClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_RELATION_SET())) - -proc IS_RELATION_SET*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_RELATION_SET()) - -proc IS_RELATION_SET_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_RELATION_SET()) - -proc RELATION_SET_GET_CLASS*(obj: pointer): PRelationSetClass = - result = cast[PRelationSetClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_RELATION_SET())) - -proc TYPE_SELECTION*(): GType = - result = selection_get_type() - -proc IS_SELECTION*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_SELECTION()) - -proc SELECTION*(obj: pointer): PSelection = - result = cast[PSelection](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_SELECTION())) - -proc SELECTION_GET_IFACE*(obj: pointer): PSelectionIface = - result = cast[PSelectionIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_SELECTION())) - -proc TYPE_STATE_SET*(): GType = - result = state_set_get_type() - -proc STATE_SET*(obj: pointer): PStateSet = - result = cast[PStateSet](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_STATE_SET())) - -proc STATE_SET_CLASS*(klass: pointer): PStateSetClass = - result = cast[PStateSetClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_STATE_SET())) - -proc IS_STATE_SET*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_STATE_SET()) - -proc IS_STATE_SET_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_STATE_SET()) - -proc STATE_SET_GET_CLASS*(obj: pointer): PStateSetClass = - result = cast[PStateSetClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_STATE_SET())) - -proc TYPE_STREAMABLE_CONTENT*(): GType = - result = streamable_content_get_type() - -proc IS_STREAMABLE_CONTENT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_STREAMABLE_CONTENT()) - -proc STREAMABLE_CONTENT*(obj: pointer): PStreamableContent = - result = cast[PStreamableContent](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_STREAMABLE_CONTENT())) - -proc STREAMABLE_CONTENT_GET_IFACE*(obj: pointer): PStreamableContentIface = - result = cast[PStreamableContentIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_STREAMABLE_CONTENT())) - -proc TYPE_TABLE*(): GType = - result = table_get_type() - -proc IS_TABLE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TABLE()) - -proc TABLE*(obj: pointer): PTable = - result = cast[PTable](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_TABLE())) - -proc TABLE_GET_IFACE*(obj: pointer): PTableIface = - result = cast[PTableIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, TYPE_TABLE())) - -proc TYPE_TEXT*(): GType = - result = text_get_type() - -proc IS_TEXT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TEXT()) - -proc TEXT*(obj: pointer): PText = - result = cast[PText](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_TEXT())) - -proc TEXT_GET_IFACE*(obj: pointer): PTextIface = - result = cast[PTextIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, TYPE_TEXT())) - -proc TYPE_UTIL*(): GType = - result = util_get_type() - -proc IS_UTIL*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_UTIL()) - -proc UTIL*(obj: pointer): PUtil = - result = cast[PUtil](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_UTIL())) - -proc UTIL_CLASS*(klass: pointer): PUtilClass = - result = cast[PUtilClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_UTIL())) - -proc IS_UTIL_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_UTIL()) - -proc UTIL_GET_CLASS*(obj: pointer): PUtilClass = - result = cast[PUtilClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_UTIL())) - -proc TYPE_VALUE*(): GType = - result = value_get_type() - -proc IS_VALUE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_VALUE()) - -proc VALUE*(obj: pointer): PValue = - result = cast[PValue](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_VALUE())) - -proc VALUE_GET_IFACE*(obj: pointer): PValueIface = - result = cast[PValueIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, TYPE_VALUE())) diff --git a/lib/wrappers/gtk/gdk2.nim b/lib/wrappers/gtk/gdk2.nim deleted file mode 100644 index d84f7ccc3..000000000 --- a/lib/wrappers/gtk/gdk2.nim +++ /dev/null @@ -1,3873 +0,0 @@ -{.deadCodeElim: on.} -import - glib2, gdk2pixbuf, pango - -when defined(win32): - const - lib = "libgdk-win32-2.0-0.dll" -elif defined(macosx): - # linklib gtk-x11-2.0 - # linklib gdk-x11-2.0 - # linklib pango-1.0.0 - # linklib glib-2.0.0 - # linklib gobject-2.0.0 - # linklib gdk_pixbuf-2.0.0 - # linklib atk-1.0.0 - const - lib = "libgdk-x11-2.0.dylib" -else: - const - lib = "libgdk-x11-2.0.so(|.0)" -const - NUMPTSTOBUFFER* = 200 - MAX_TIMECOORD_AXES* = 128 - -type - PDeviceClass* = ptr TDeviceClass - TDeviceClass* = object of TGObjectClass - PVisualClass* = ptr TVisualClass - TVisualClass* = object of TGObjectClass - PColor* = ptr TColor - TColor*{.final, pure.} = object - pixel*: guint32 - red*: guint16 - green*: guint16 - blue*: guint16 - - PColormap* = ptr TColormap - PDrawable* = ptr TDrawable - TDrawable* = object of TGObject - PWindow* = ptr TWindow - TWindow* = TDrawable - PPixmap* = ptr TPixmap - TPixmap* = TDrawable - PBitmap* = ptr TBitmap - TBitmap* = TDrawable - PFontType* = ptr TFontType - TFontType* = enum - FONT_FONT, FONT_FONTSET - PFont* = ptr TFont - TFont*{.final, pure.} = object - `type`*: TFontType - ascent*: gint - descent*: gint - - PFunction* = ptr TFunction - TFunction* = enum - funcCOPY, funcINVERT, funcXOR, funcCLEAR, funcAND, - funcAND_REVERSE, funcAND_INVERT, funcNOOP, funcOR, funcEQUIV, - funcOR_REVERSE, funcCOPY_INVERT, funcOR_INVERT, funcNAND, funcNOR, funcSET - PCapStyle* = ptr TCapStyle - TCapStyle* = enum - CAP_NOT_LAST, CAP_BUTT, CAP_ROUND, CAP_PROJECTING - PFill* = ptr TFill - TFill* = enum - SOLID, TILED, STIPPLED, OPAQUE_STIPPLED - PJoinStyle* = ptr TJoinStyle - TJoinStyle* = enum - JOIN_MITER, JOIN_ROUND, JOIN_BEVEL - PLineStyle* = ptr TLineStyle - TLineStyle* = enum - LINE_SOLID, LINE_ON_OFF_DASH, LINE_DOUBLE_DASH - PSubwindowMode* = ptr TSubwindowMode - TSubwindowMode* = int - PGCValuesMask* = ptr TGCValuesMask - TGCValuesMask* = int32 - PGCValues* = ptr TGCValues - TGCValues*{.final, pure.} = object - foreground*: TColor - background*: TColor - font*: PFont - `function`*: TFunction - fill*: TFill - tile*: PPixmap - stipple*: PPixmap - clip_mask*: PPixmap - subwindow_mode*: TSubwindowMode - ts_x_origin*: gint - ts_y_origin*: gint - clip_x_origin*: gint - clip_y_origin*: gint - graphics_exposures*: gint - line_width*: gint - line_style*: TLineStyle - cap_style*: TCapStyle - join_style*: TJoinStyle - - PGC* = ptr TGC - TGC* = object of TGObject - clip_x_origin*: gint - clip_y_origin*: gint - ts_x_origin*: gint - ts_y_origin*: gint - colormap*: PColormap - - PImageType* = ptr TImageType - TImageType* = enum - IMAGE_NORMAL, IMAGE_SHARED, IMAGE_FASTEST - PImage* = ptr TImage - PDevice* = ptr TDevice - PTimeCoord* = ptr TTimeCoord - PPTimeCoord* = ptr PTimeCoord - PRgbDither* = ptr TRgbDither - TRgbDither* = enum - RGB_DITHER_NONE, RGB_DITHER_NORMAL, RGB_DITHER_MAX - PDisplay* = ptr TDisplay - PScreen* = ptr TScreen - TScreen* = object of TGObject - PInputCondition* = ptr TInputCondition - TInputCondition* = int32 - PStatus* = ptr TStatus - TStatus* = int32 - TPoint*{.final, pure.} = object - x*: gint - y*: gint - - PPoint* = ptr TPoint - PPPoint* = ptr PPoint - PSpan* = ptr TSpan - PWChar* = ptr TWChar - TWChar* = guint32 - PSegment* = ptr TSegment - TSegment*{.final, pure.} = object - x1*: gint - y1*: gint - x2*: gint - y2*: gint - - PRectangle* = ptr TRectangle - TRectangle*{.final, pure.} = object - x*: gint - y*: gint - width*: gint - height*: gint - - PAtom* = ptr TAtom - TAtom* = gulong - PByteOrder* = ptr TByteOrder - TByteOrder* = enum - LSB_FIRST, MSB_FIRST - PModifierType* = ptr TModifierType - TModifierType* = gint - PVisualType* = ptr TVisualType - TVisualType* = enum - VISUAL_STATIC_GRAY, VISUAL_GRAYSCALE, VISUAL_STATIC_COLOR, - VISUAL_PSEUDO_COLOR, VISUAL_TRUE_COLOR, VISUAL_DIRECT_COLOR - PVisual* = ptr TVisual - TVisual* = object of TGObject - TheType*: TVisualType - depth*: gint - byte_order*: TByteOrder - colormap_size*: gint - bits_per_rgb*: gint - red_mask*: guint32 - red_shift*: gint - red_prec*: gint - green_mask*: guint32 - green_shift*: gint - green_prec*: gint - blue_mask*: guint32 - blue_shift*: gint - blue_prec*: gint - screen*: PScreen - - PColormapClass* = ptr TColormapClass - TColormapClass* = object of TGObjectClass - TColormap* = object of TGObject - size*: gint - colors*: PColor - visual*: PVisual - windowing_data*: gpointer - screen*: PScreen - - PCursorType* = ptr TCursorType - TCursorType* = gint - PCursor* = ptr TCursor - TCursor*{.final, pure.} = object - `type`*: TCursorType - ref_count*: guint - - PDragAction* = ptr TDragAction - TDragAction* = int32 - PDragProtocol* = ptr TDragProtocol - TDragProtocol* = enum - DRAG_PROTO_MOTIF, DRAG_PROTO_XDND, DRAG_PROTO_ROOTWIN, DRAG_PROTO_NONE, - DRAG_PROTO_WIN32_DROPFILES, DRAG_PROTO_OLE2, DRAG_PROTO_LOCAL - PDragContext* = ptr TDragContext - TDragContext* = object of TGObject - protocol*: TDragProtocol - is_source*: gboolean - source_window*: PWindow - dest_window*: PWindow - targets*: PGList - actions*: TDragAction - suggested_action*: TDragAction - action*: TDragAction - start_time*: guint32 - windowing_data*: gpointer - - PDragContextClass* = ptr TDragContextClass - TDragContextClass* = object of TGObjectClass - PRegionBox* = ptr TRegionBox - TRegionBox* = TSegment - PRegion* = ptr TRegion - TRegion*{.final, pure.} = object - size*: int32 - numRects*: int32 - rects*: PRegionBox - extents*: TRegionBox - - PPOINTBLOCK* = ptr TPOINTBLOCK - TPOINTBLOCK*{.final, pure.} = object - pts*: array[0..(NUMPTSTOBUFFER) - 1, TPoint] - next*: PPOINTBLOCK - - PDrawableClass* = ptr TDrawableClass - TDrawableClass* = object of TGObjectClass - create_gc*: proc (drawable: PDrawable, values: PGCValues, - mask: TGCValuesMask): PGC{.cdecl.} - draw_rectangle*: proc (drawable: PDrawable, gc: PGC, filled: gint, x: gint, - y: gint, width: gint, height: gint){.cdecl.} - draw_arc*: proc (drawable: PDrawable, gc: PGC, filled: gint, x: gint, - y: gint, width: gint, height: gint, angle1: gint, - angle2: gint){.cdecl.} - draw_polygon*: proc (drawable: PDrawable, gc: PGC, filled: gint, - points: PPoint, npoints: gint){.cdecl.} - draw_text*: proc (drawable: PDrawable, font: PFont, gc: PGC, x: gint, - y: gint, text: cstring, text_length: gint){.cdecl.} - draw_text_wc*: proc (drawable: PDrawable, font: PFont, gc: PGC, x: gint, - y: gint, text: PWChar, text_length: gint){.cdecl.} - draw_drawable*: proc (drawable: PDrawable, gc: PGC, src: PDrawable, - xsrc: gint, ysrc: gint, xdest: gint, ydest: gint, - width: gint, height: gint){.cdecl.} - draw_points*: proc (drawable: PDrawable, gc: PGC, points: PPoint, - npoints: gint){.cdecl.} - draw_segments*: proc (drawable: PDrawable, gc: PGC, segs: PSegment, - nsegs: gint){.cdecl.} - draw_lines*: proc (drawable: PDrawable, gc: PGC, points: PPoint, - npoints: gint){.cdecl.} - draw_glyphs*: proc (drawable: PDrawable, gc: PGC, font: PFont, x: gint, - y: gint, glyphs: PGlyphString){.cdecl.} - draw_image*: proc (drawable: PDrawable, gc: PGC, image: PImage, xsrc: gint, - ysrc: gint, xdest: gint, ydest: gint, width: gint, - height: gint){.cdecl.} - get_depth*: proc (drawable: PDrawable): gint{.cdecl.} - get_size*: proc (drawable: PDrawable, width: Pgint, height: Pgint){.cdecl.} - set_colormap*: proc (drawable: PDrawable, cmap: PColormap){.cdecl.} - get_colormap*: proc (drawable: PDrawable): PColormap{.cdecl.} - get_visual*: proc (drawable: PDrawable): PVisual{.cdecl.} - get_screen*: proc (drawable: PDrawable): PScreen{.cdecl.} - get_image*: proc (drawable: PDrawable, x: gint, y: gint, width: gint, - height: gint): PImage{.cdecl.} - get_clip_region*: proc (drawable: PDrawable): PRegion{.cdecl.} - get_visible_region*: proc (drawable: PDrawable): PRegion{.cdecl.} - get_composite_drawable*: proc (drawable: PDrawable, x: gint, y: gint, - width: gint, height: gint, - composite_x_offset: Pgint, - composite_y_offset: Pgint): PDrawable{.cdecl.} - `draw_pixbuf`*: proc (drawable: PDrawable, gc: PGC, pixbuf: PPixbuf, - src_x: gint, src_y: gint, dest_x: gint, dest_y: gint, - width: gint, height: gint, dither: TRgbDither, - x_dither: gint, y_dither: gint){.cdecl.} - `copy_to_image`*: proc (drawable: PDrawable, image: PImage, src_x: gint, - src_y: gint, dest_x: gint, dest_y: gint, - width: gint, height: gint): PImage{.cdecl.} - `reserved1`: proc (){.cdecl.} - `reserved2`: proc (){.cdecl.} - `reserved3`: proc (){.cdecl.} - `reserved4`: proc (){.cdecl.} - `reserved5`: proc (){.cdecl.} - `reserved6`: proc (){.cdecl.} - `reserved7`: proc (){.cdecl.} - `reserved9`: proc (){.cdecl.} - `reserved10`: proc (){.cdecl.} - `reserved11`: proc (){.cdecl.} - `reserved12`: proc (){.cdecl.} - `reserved13`: proc (){.cdecl.} - `reserved14`: proc (){.cdecl.} - `reserved15`: proc (){.cdecl.} - `reserved16`: proc (){.cdecl.} - - PEvent* = ptr TEvent - TEventFunc* = proc (event: PEvent, data: gpointer){.cdecl.} - PXEvent* = ptr TXEvent - TXEvent* = proc () {.cdecl.} - PFilterReturn* = ptr TFilterReturn - TFilterReturn* = enum - FILTER_CONTINUE, FILTER_TRANSLATE, FILTER_REMOVE - TFilterFunc* = proc (xevent: PXEvent, event: PEvent, data: gpointer): TFilterReturn{. - cdecl.} - PEventType* = ptr TEventType - TEventType* = gint - PEventMask* = ptr TEventMask - TEventMask* = gint32 - PVisibilityState* = ptr TVisibilityState - TVisibilityState* = enum - VISIBILITY_UNOBSCURED, VISIBILITY_PARTIAL, VISIBILITY_FULLY_OBSCURED - PScrollDirection* = ptr TScrollDirection - TScrollDirection* = enum - SCROLL_UP, SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT - PNotifyType* = ptr TNotifyType - TNotifyType* = int - PCrossingMode* = ptr TCrossingMode - TCrossingMode* = enum - CROSSING_NORMAL, CROSSING_GRAB, CROSSING_UNGRAB - PPropertyState* = ptr TPropertyState - TPropertyState* = enum - PROPERTY_NEW_VALUE, PROPERTY_STATE_DELETE - PWindowState* = ptr TWindowState - TWindowState* = gint - PSettingAction* = ptr TSettingAction - TSettingAction* = enum - SETTING_ACTION_NEW, SETTING_ACTION_CHANGED, SETTING_ACTION_DELETED - PEventAny* = ptr TEventAny - TEventAny*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - - PEventExpose* = ptr TEventExpose - TEventExpose*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - area*: TRectangle - region*: PRegion - count*: gint - - PEventNoExpose* = ptr TEventNoExpose - TEventNoExpose*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - - PEventVisibility* = ptr TEventVisibility - TEventVisibility*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - state*: TVisibilityState - - PEventMotion* = ptr TEventMotion - TEventMotion*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - time*: guint32 - x*: gdouble - y*: gdouble - axes*: Pgdouble - state*: guint - is_hint*: gint16 - device*: PDevice - x_root*: gdouble - y_root*: gdouble - - PEventButton* = ptr TEventButton - TEventButton*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - time*: guint32 - x*: gdouble - y*: gdouble - axes*: Pgdouble - state*: guint - button*: guint - device*: PDevice - x_root*: gdouble - y_root*: gdouble - - PEventScroll* = ptr TEventScroll - TEventScroll*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - time*: guint32 - x*: gdouble - y*: gdouble - state*: guint - direction*: TScrollDirection - device*: PDevice - x_root*: gdouble - y_root*: gdouble - - PEventKey* = ptr TEventKey - TEventKey*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - time*: guint32 - state*: guint - keyval*: guint - length*: gint - `string`*: cstring - hardware_keycode*: guint16 - group*: guint8 - - PEventCrossing* = ptr TEventCrossing - TEventCrossing*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - subwindow*: PWindow - time*: guint32 - x*: gdouble - y*: gdouble - x_root*: gdouble - y_root*: gdouble - mode*: TCrossingMode - detail*: TNotifyType - focus*: gboolean - state*: guint - - PEventFocus* = ptr TEventFocus - TEventFocus*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - `in`*: gint16 - - PEventConfigure* = ptr TEventConfigure - TEventConfigure*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - x*: gint - y*: gint - width*: gint - height*: gint - - PEventProperty* = ptr TEventProperty - TEventProperty*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - atom*: TAtom - time*: guint32 - state*: guint - - TNativeWindow* = pointer - PEventSelection* = ptr TEventSelection - TEventSelection*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - selection*: TAtom - target*: TAtom - `property`*: TAtom - time*: guint32 - requestor*: TNativeWindow - - PEventProximity* = ptr TEventProximity - TEventProximity*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - time*: guint32 - device*: PDevice - - PmatDUMMY* = ptr TmatDUMMY - TmatDUMMY*{.final, pure.} = object - b*: array[0..19, char] - - PEventClient* = ptr TEventClient - TEventClient*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - message_type*: TAtom - data_format*: gushort - b*: array[0..19, char] - - PEventSetting* = ptr TEventSetting - TEventSetting*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - action*: TSettingAction - name*: cstring - - PEventWindowState* = ptr TEventWindowState - TEventWindowState*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - changed_mask*: TWindowState - new_window_state*: TWindowState - - PEventDND* = ptr TEventDND - TEventDND*{.final, pure.} = object - `type`*: TEventType - window*: PWindow - send_event*: gint8 - context*: PDragContext - time*: guint32 - x_root*: gshort - y_root*: gshort - - TEvent*{.final, pure.} = object - data*: array[0..255, char] # union of - # `type`: TEventType - # any: TEventAny - # expose: TEventExpose - # no_expose: TEventNoExpose - # visibility: TEventVisibility - # motion: TEventMotion - # button: TEventButton - # scroll: TEventScroll - # key: TEventKey - # crossing: TEventCrossing - # focus_change: TEventFocus - # configure: TEventConfigure - # `property`: TEventProperty - # selection: TEventSelection - # proximity: TEventProximity - # client: TEventClient - # dnd: TEventDND - # window_state: TEventWindowState - # setting: TEventSetting - - PGCClass* = ptr TGCClass - TGCClass* = object of TGObjectClass - get_values*: proc (gc: PGC, values: PGCValues){.cdecl.} - set_values*: proc (gc: PGC, values: PGCValues, mask: TGCValuesMask){.cdecl.} - set_dashes*: proc (gc: PGC, dash_offset: gint, dash_list: openarray[gint8]){. - cdecl.} - `reserved1`*: proc (){.cdecl.} - `reserved2`*: proc (){.cdecl.} - `reserved3`*: proc (){.cdecl.} - `reserved4`*: proc (){.cdecl.} - - PImageClass* = ptr TImageClass - TImageClass* = object of TGObjectClass - TImage* = object of TGObject - `type`*: TImageType - visual*: PVisual - byte_order*: TByteOrder - width*: gint - height*: gint - depth*: guint16 - bpp*: guint16 - bpl*: guint16 - bits_per_pixel*: guint16 - mem*: gpointer - colormap*: PColormap - windowing_data*: gpointer - - PExtensionMode* = ptr TExtensionMode - TExtensionMode* = enum - EXTENSION_EVENTS_NONE, EXTENSION_EVENTS_ALL, EXTENSION_EVENTS_CURSOR - PInputSource* = ptr TInputSource - TInputSource* = enum - SOURCE_MOUSE, SOURCE_PEN, SOURCE_ERASER, SOURCE_CURSOR - PInputMode* = ptr TInputMode - TInputMode* = enum - MODE_DISABLED, MODE_SCREEN, MODE_WINDOW - PAxisUse* = ptr TAxisUse - TAxisUse* = int32 - PDeviceKey* = ptr TDeviceKey - TDeviceKey*{.final, pure.} = object - keyval*: guint - modifiers*: TModifierType - - PDeviceAxis* = ptr TDeviceAxis - TDeviceAxis*{.final, pure.} = object - use*: TAxisUse - min*: gdouble - max*: gdouble - - TDevice* = object of TGObject - name*: cstring - source*: TInputSource - mode*: TInputMode - has_cursor*: gboolean - num_axes*: gint - axes*: PDeviceAxis - num_keys*: gint - keys*: PDeviceKey - - TTimeCoord*{.final, pure.} = object - time*: guint32 - axes*: array[0..(MAX_TIMECOORD_AXES) - 1, gdouble] - - PKeymapKey* = ptr TKeymapKey - TKeymapKey*{.final, pure.} = object - keycode*: guint - group*: gint - level*: gint - - PKeymap* = ptr TKeymap - TKeymap* = object of TGObject - display*: PDisplay - - PKeymapClass* = ptr TKeymapClass - TKeymapClass* = object of TGObjectClass - direction_changed*: proc (keymap: PKeymap){.cdecl.} - - PAttrStipple* = ptr TAttrStipple - TAttrStipple*{.final, pure.} = object - attr*: TAttribute - stipple*: PBitmap - - PAttrEmbossed* = ptr TAttrEmbossed - TAttrEmbossed*{.final, pure.} = object - attr*: TAttribute - embossed*: gboolean - - PPixmapObject* = ptr TPixmapObject - TPixmapObject* = object of TDrawable - impl*: PDrawable - depth*: gint - - PPixmapObjectClass* = ptr TPixmapObjectClass - TPixmapObjectClass* = object of TDrawableClass - PPropMode* = ptr TPropMode - TPropMode* = enum - PROP_MODE_REPLACE, PROP_MODE_PREPEND, PROP_MODE_APPEND - PFillRule* = ptr TFillRule - TFillRule* = enum - EVEN_ODD_RULE, WINDING_RULE - POverlapType* = ptr TOverlapType - TOverlapType* = enum - OVERLAP_RECTANGLE_IN, OVERLAP_RECTANGLE_OUT, OVERLAP_RECTANGLE_PART - TSpanFunc* = proc (span: PSpan, data: gpointer){.cdecl.} - PRgbCmap* = ptr TRgbCmap - TRgbCmap*{.final, pure.} = object - colors*: array[0..255, guint32] - n_colors*: gint - info_list*: PGSList - - TDisplay* = object of TGObject - queued_events*: PGList - queued_tail*: PGList - button_click_time*: array[0..1, guint32] - button_window*: array[0..1, PWindow] - button_number*: array[0..1, guint] - double_click_time*: guint - - PDisplayClass* = ptr TDisplayClass - TDisplayClass* = object of TGObjectClass - get_display_name*: proc (display: PDisplay): cstring{.cdecl.} - get_n_screens*: proc (display: PDisplay): gint{.cdecl.} - get_screen*: proc (display: PDisplay, screen_num: gint): PScreen{.cdecl.} - get_default_screen*: proc (display: PDisplay): PScreen{.cdecl.} - - PScreenClass* = ptr TScreenClass - TScreenClass* = object of TGObjectClass - get_display*: proc (screen: PScreen): PDisplay{.cdecl.} - get_width*: proc (screen: PScreen): gint{.cdecl.} - get_height*: proc (screen: PScreen): gint{.cdecl.} - get_width_mm*: proc (screen: PScreen): gint{.cdecl.} - get_height_mm*: proc (screen: PScreen): gint{.cdecl.} - get_root_depth*: proc (screen: PScreen): gint{.cdecl.} - get_screen_num*: proc (screen: PScreen): gint{.cdecl.} - get_root_window*: proc (screen: PScreen): PWindow{.cdecl.} - get_default_colormap*: proc (screen: PScreen): PColormap{.cdecl.} - set_default_colormap*: proc (screen: PScreen, colormap: PColormap){.cdecl.} - get_window_at_pointer*: proc (screen: PScreen, win_x: Pgint, win_y: Pgint): PWindow{. - cdecl.} - get_n_monitors*: proc (screen: PScreen): gint{.cdecl.} - get_monitor_geometry*: proc (screen: PScreen, monitor_num: gint, - dest: PRectangle){.cdecl.} - - PGrabStatus* = ptr TGrabStatus - TGrabStatus* = int - TInputFunction* = proc (data: gpointer, source: gint, - condition: TInputCondition){.cdecl.} - TDestroyNotify* = proc (data: gpointer){.cdecl.} - TSpan*{.final, pure.} = object - x*: gint - y*: gint - width*: gint - - PWindowClass* = ptr TWindowClass - TWindowClass* = enum - INPUT_OUTPUT, INPUT_ONLY - PWindowType* = ptr TWindowType - TWindowType* = enum - WINDOW_ROOT, WINDOW_TOPLEVEL, WINDOW_CHILD, WINDOW_DIALOG, WINDOW_TEMP, - WINDOW_FOREIGN - PWindowAttributesType* = ptr TWindowAttributesType - TWindowAttributesType* = int32 - PWindowHints* = ptr TWindowHints - TWindowHints* = int32 - PWindowTypeHint* = ptr TWindowTypeHint - TWindowTypeHint* = enum - WINDOW_TYPE_HINT_NORMAL, WINDOW_TYPE_HINT_DIALOG, WINDOW_TYPE_HINT_MENU, - WINDOW_TYPE_HINT_TOOLBAR, WINDOW_TYPE_HINT_SPLASHSCREEN, - WINDOW_TYPE_HINT_UTILITY, WINDOW_TYPE_HINT_DOCK, - WINDOW_TYPE_HINT_DESKTOP, WINDOW_TYPE_HINT_DROPDOWN_MENU, - WINDOW_TYPE_HINT_POPUP_MENU, WINDOW_TYPE_HINT_TOOLTIP, - WINDOW_TYPE_HINT_NOTIFICATION, WINDOW_TYPE_HINT_COMBO, - WINDOW_TYPE_HINT_DND - PWMDecoration* = ptr TWMDecoration - TWMDecoration* = int32 - PWMFunction* = ptr TWMFunction - TWMFunction* = int32 - PGravity* = ptr TGravity - TGravity* = int - PWindowEdge* = ptr TWindowEdge - TWindowEdge* = enum - WINDOW_EDGE_NORTH_WEST, WINDOW_EDGE_NORTH, WINDOW_EDGE_NORTH_EAST, - WINDOW_EDGE_WEST, WINDOW_EDGE_EAST, WINDOW_EDGE_SOUTH_WEST, - WINDOW_EDGE_SOUTH, WINDOW_EDGE_SOUTH_EAST - PWindowAttr* = ptr TWindowAttr - TWindowAttr*{.final, pure.} = object - title*: cstring - event_mask*: gint - x*: gint - y*: gint - width*: gint - height*: gint - wclass*: TWindowClass - visual*: PVisual - colormap*: PColormap - window_type*: TWindowType - cursor*: PCursor - wmclass_name*: cstring - wmclass_class*: cstring - override_redirect*: gboolean - - PGeometry* = ptr TGeometry - TGeometry*{.final, pure.} = object - min_width*: gint - min_height*: gint - max_width*: gint - max_height*: gint - base_width*: gint - base_height*: gint - width_inc*: gint - height_inc*: gint - min_aspect*: gdouble - max_aspect*: gdouble - win_gravity*: TGravity - - PPointerHooks* = ptr TPointerHooks - TPointerHooks*{.final, pure.} = object - get_pointer*: proc (window: PWindow, x: Pgint, y: Pgint, mask: PModifierType): PWindow{. - cdecl.} - window_at_pointer*: proc (screen: PScreen, win_x: Pgint, win_y: Pgint): PWindow{. - cdecl.} - - PWindowObject* = ptr TWindowObject - TWindowObject* = object of TDrawable - impl*: PDrawable - parent*: PWindowObject - user_data*: gpointer - x*: gint - y*: gint - extension_events*: gint - filters*: PGList - children*: PGList - bg_color*: TColor - bg_pixmap*: PPixmap - paint_stack*: PGSList - update_area*: PRegion - update_freeze_count*: guint - window_type*: guint8 - depth*: guint8 - resize_count*: guint8 - state*: TWindowState - flag0*: guint16 - event_mask*: TEventMask - - PWindowObjectClass* = ptr TWindowObjectClass - TWindowObjectClass* = object of TDrawableClass - window_invalidate_maybe_recurse_child_func* = proc (para1: PWindow, - para2: gpointer): gboolean {.cdecl.} - -proc TYPE_COLORMAP*(): GType -proc COLORMAP*(anObject: pointer): PColormap -proc COLORMAP_CLASS*(klass: pointer): PColormapClass -proc IS_COLORMAP*(anObject: pointer): bool -proc IS_COLORMAP_CLASS*(klass: pointer): bool -proc COLORMAP_GET_CLASS*(obj: pointer): PColormapClass -proc TYPE_COLOR*(): GType -proc colormap_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_colormap_get_type".} -proc colormap_new*(visual: PVisual, allocate: gboolean): PColormap{.cdecl, - dynlib: lib, importc: "gdk_colormap_new".} -proc alloc_colors*(colormap: PColormap, colors: PColor, ncolors: gint, - writeable: gboolean, best_match: gboolean, - success: Pgboolean): gint{.cdecl, dynlib: lib, - importc: "gdk_colormap_alloc_colors".} -proc alloc_color*(colormap: PColormap, color: PColor, - writeable: gboolean, best_match: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gdk_colormap_alloc_color".} -proc free_colors*(colormap: PColormap, colors: PColor, ncolors: gint){. - cdecl, dynlib: lib, importc: "gdk_colormap_free_colors".} -proc query_color*(colormap: PColormap, pixel: gulong, result: PColor){. - cdecl, dynlib: lib, importc: "gdk_colormap_query_color".} -proc get_visual*(colormap: PColormap): PVisual{.cdecl, dynlib: lib, - importc: "gdk_colormap_get_visual".} -proc copy*(color: PColor): PColor{.cdecl, dynlib: lib, - importc: "gdk_color_copy".} -proc free*(color: PColor){.cdecl, dynlib: lib, importc: "gdk_color_free".} -proc color_parse*(spec: cstring, color: PColor): gint{.cdecl, dynlib: lib, - importc: "gdk_color_parse".} -proc hash*(colora: PColor): guint{.cdecl, dynlib: lib, - importc: "gdk_color_hash".} -proc equal*(colora: PColor, colorb: PColor): gboolean{.cdecl, dynlib: lib, - importc: "gdk_color_equal".} -proc color_get_type*(): GType{.cdecl, dynlib: lib, importc: "gdk_color_get_type".} -const - CURSOR_IS_PIXMAP* = - (1) - X_CURSOR* = 0 - ARROW* = 2 - BASED_ARROW_DOWN* = 4 - BASED_ARROW_UP* = 6 - BOAT* = 8 - BOGOSITY* = 10 - BOTTOM_LEFT_CORNER* = 12 - BOTTOM_RIGHT_CORNER* = 14 - BOTTOM_SIDE* = 16 - BOTTOM_TEE* = 18 - BOX_SPIRAL* = 20 - CENTER_PTR* = 22 - CIRCLE* = 24 - CLOCK* = 26 - COFFEE_MUG* = 28 - CROSS* = 30 - CROSS_REVERSE* = 32 - CROSSHAIR* = 34 - DIAMOND_CROSS* = 36 - DOT* = 38 - DOTBOX* = 40 - DOUBLE_ARROW* = 42 - DRAFT_LARGE* = 44 - DRAFT_SMALL* = 46 - DRAPED_BOX* = 48 - EXCHANGE* = 50 - FLEUR* = 52 - GOBBLER* = 54 - GUMBY* = 56 - HAND1* = 58 - HAND2* = 60 - HEART* = 62 - ICON* = 64 - IRON_CROSS* = 66 - LEFT_PTR* = 68 - LEFT_SIDE* = 70 - LEFT_TEE* = 72 - LEFTBUTTON* = 74 - LL_ANGLE* = 76 - LR_ANGLE* = 78 - MAN* = 80 - MIDDLEBUTTON* = 82 - MOUSE* = 84 - PENCIL* = 86 - PIRATE* = 88 - PLUS* = 90 - QUESTION_ARROW* = 92 - RIGHT_PTR* = 94 - RIGHT_SIDE* = 96 - RIGHT_TEE* = 98 - RIGHTBUTTON* = 100 - RTL_LOGO* = 102 - SAILBOAT* = 104 - SB_DOWN_ARROW* = 106 - SB_H_DOUBLE_ARROW* = 108 - SB_LEFT_ARROW* = 110 - SB_RIGHT_ARROW* = 112 - SB_UP_ARROW* = 114 - SB_V_DOUBLE_ARROW* = 116 - SHUTTLE* = 118 - SIZING* = 120 - SPIDER* = 122 - SPRAYCAN* = 124 - STAR* = 126 - TARGET* = 128 - TCROSS* = 130 - TOP_LEFT_ARROW* = 132 - TOP_LEFT_CORNER* = 134 - TOP_RIGHT_CORNER* = 136 - TOP_SIDE* = 138 - TOP_TEE* = 140 - TREK* = 142 - UL_ANGLE* = 144 - UMBRELLA* = 146 - UR_ANGLE* = 148 - WATCH* = 150 - XTERM* = 152 - LAST_CURSOR* = XTERM + 1 - -proc TYPE_CURSOR*(): GType -proc cursor_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_cursor_get_type".} -proc cursor_new_for_screen*(screen: PScreen, cursor_type: TCursorType): PCursor{. - cdecl, dynlib: lib, importc: "gdk_cursor_new_for_screen".} -proc cursor_new_from_pixmap*(source: PPixmap, mask: PPixmap, fg: PColor, - bg: PColor, x: gint, y: gint): PCursor{.cdecl, - dynlib: lib, importc: "gdk_cursor_new_from_pixmap".} -proc get_screen*(cursor: PCursor): PScreen{.cdecl, dynlib: lib, - importc: "gdk_cursor_get_screen".} -proc reference*(cursor: PCursor): PCursor{.cdecl, dynlib: lib, - importc: "gdk_cursor_ref".} -proc unref*(cursor: PCursor){.cdecl, dynlib: lib, - importc: "gdk_cursor_unref".} -const - ACTION_DEFAULT* = 1 shl 0 - ACTION_COPY* = 1 shl 1 - ACTION_MOVE* = 1 shl 2 - ACTION_LINK* = 1 shl 3 - ACTION_PRIVATE* = 1 shl 4 - ACTION_ASK* = 1 shl 5 - -proc TYPE_DRAG_CONTEXT*(): GType -proc DRAG_CONTEXT*(anObject: Pointer): PDragContext -proc DRAG_CONTEXT_CLASS*(klass: Pointer): PDragContextClass -proc IS_DRAG_CONTEXT*(anObject: Pointer): bool -proc IS_DRAG_CONTEXT_CLASS*(klass: Pointer): bool -proc DRAG_CONTEXT_GET_CLASS*(obj: Pointer): PDragContextClass -proc drag_context_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_drag_context_get_type".} -proc drag_context_new*(): PDragContext{.cdecl, dynlib: lib, - importc: "gdk_drag_context_new".} -proc status*(context: PDragContext, action: TDragAction, time: guint32){. - cdecl, dynlib: lib, importc: "gdk_drag_status".} -proc drop_reply*(context: PDragContext, ok: gboolean, time: guint32){.cdecl, - dynlib: lib, importc: "gdk_drop_reply".} -proc drop_finish*(context: PDragContext, success: gboolean, time: guint32){. - cdecl, dynlib: lib, importc: "gdk_drop_finish".} -proc get_selection*(context: PDragContext): TAtom{.cdecl, dynlib: lib, - importc: "gdk_drag_get_selection".} -proc drag_begin*(window: PWindow, targets: PGList): PDragContext{.cdecl, - dynlib: lib, importc: "gdk_drag_begin".} -proc drag_get_protocol_for_display*(display: PDisplay, xid: guint32, - protocol: PDragProtocol): guint32{.cdecl, - dynlib: lib, importc: "gdk_drag_get_protocol_for_display".} -proc find_window*(context: PDragContext, drag_window: PWindow, - x_root: gint, y_root: gint, w: var PWindow, - protocol: PDragProtocol){.cdecl, dynlib: lib, - importc: "gdk_drag_find_window".} -proc motion*(context: PDragContext, dest_window: PWindow, - protocol: TDragProtocol, x_root: gint, y_root: gint, - suggested_action: TDragAction, possible_actions: TDragAction, - time: guint32): gboolean{.cdecl, dynlib: lib, - importc: "gdk_drag_motion".} -proc drop*(context: PDragContext, time: guint32){.cdecl, dynlib: lib, - importc: "gdk_drag_drop".} -proc abort*(context: PDragContext, time: guint32){.cdecl, dynlib: lib, - importc: "gdk_drag_abort".} -proc region_EXTENTCHECK*(r1, r2: PRegionBox): bool -proc EXTENTS*(r: PRegionBox, idRect: PRegion) -proc MEMCHECK*(reg: PRegion, ARect, firstrect: var PRegionBox): bool -proc CHECK_PREVIOUS*(Reg: PRegion, R: PRegionBox, - Rx1, Ry1, Rx2, Ry2: gint): bool -proc ADDRECT*(reg: PRegion, r: PRegionBox, rx1, ry1, rx2, ry2: gint) -proc ADDRECTNOX*(reg: PRegion, r: PRegionBox, rx1, ry1, rx2, ry2: gint) -proc EMPTY_REGION*(pReg: PRegion): bool -proc REGION_NOT_EMPTY*(pReg: PRegion): bool -proc region_INBOX*(r: TRegionBox, x, y: gint): bool -proc TYPE_DRAWABLE*(): GType -proc DRAWABLE*(anObject: Pointer): PDrawable -proc DRAWABLE_CLASS*(klass: Pointer): PDrawableClass -proc IS_DRAWABLE*(anObject: Pointer): bool -proc IS_DRAWABLE_CLASS*(klass: Pointer): bool -proc DRAWABLE_GET_CLASS*(obj: Pointer): PDrawableClass -proc drawable_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_type".} -proc get_size*(drawable: PDrawable, width: Pgint, height: Pgint){. - cdecl, dynlib: lib, importc: "gdk_drawable_get_size".} -proc set_colormap*(drawable: PDrawable, colormap: PColormap){.cdecl, - dynlib: lib, importc: "gdk_drawable_set_colormap".} -proc get_colormap*(drawable: PDrawable): PColormap{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_colormap".} -proc get_visual*(drawable: PDrawable): PVisual{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_visual".} -proc get_depth*(drawable: PDrawable): gint{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_depth".} -proc get_screen*(drawable: PDrawable): PScreen{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_screen".} -proc get_display*(drawable: PDrawable): PDisplay{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_display".} -proc point*(drawable: PDrawable, gc: PGC, x: gint, y: gint){.cdecl, - dynlib: lib, importc: "gdk_draw_point".} -proc line*(drawable: PDrawable, gc: PGC, x1: gint, y1: gint, x2: gint, - y2: gint){.cdecl, dynlib: lib, importc: "gdk_draw_line".} -proc rectangle*(drawable: PDrawable, gc: PGC, filled: gint, x: gint, - y: gint, width: gint, height: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_rectangle".} -proc arc*(drawable: PDrawable, gc: PGC, filled: gint, x: gint, y: gint, - width: gint, height: gint, angle1: gint, angle2: gint){.cdecl, - dynlib: lib, importc: "gdk_draw_arc".} -proc polygon*(drawable: PDrawable, gc: PGC, filled: gint, points: PPoint, - npoints: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_polygon".} -proc drawable*(drawable: PDrawable, gc: PGC, src: PDrawable, xsrc: gint, - ysrc: gint, xdest: gint, ydest: gint, width: gint, - height: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_drawable".} -proc image*(drawable: PDrawable, gc: PGC, image: PImage, xsrc: gint, - ysrc: gint, xdest: gint, ydest: gint, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "gdk_draw_image".} -proc points*(drawable: PDrawable, gc: PGC, points: PPoint, npoints: gint){. - cdecl, dynlib: lib, importc: "gdk_draw_points".} -proc segments*(drawable: PDrawable, gc: PGC, segs: PSegment, nsegs: gint){. - cdecl, dynlib: lib, importc: "gdk_draw_segments".} -proc lines*(drawable: PDrawable, gc: PGC, points: PPoint, npoints: gint){. - cdecl, dynlib: lib, importc: "gdk_draw_lines".} -proc glyphs*(drawable: PDrawable, gc: PGC, font: PFont, x: gint, - y: gint, glyphs: PGlyphString){.cdecl, dynlib: lib, - importc: "gdk_draw_glyphs".} -proc layout_line*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - line: PLayoutLine){.cdecl, dynlib: lib, - importc: "gdk_draw_layout_line".} -proc layout*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - layout: PLayout){.cdecl, dynlib: lib, - importc: "gdk_draw_layout".} -proc layout_line*(drawable: PDrawable, gc: PGC, x: gint, - y: gint, line: PLayoutLine, - foreground: PColor, background: PColor){. - cdecl, dynlib: lib, importc: "gdk_draw_layout_line_with_colors".} -proc layout*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - layout: PLayout, foreground: PColor, - background: PColor){.cdecl, dynlib: lib, - importc: "gdk_draw_layout_with_colors".} -proc get_image*(drawable: PDrawable, x: gint, y: gint, width: gint, - height: gint): PImage{.cdecl, dynlib: lib, - importc: "gdk_drawable_get_image".} -proc get_clip_region*(drawable: PDrawable): PRegion{.cdecl, - dynlib: lib, importc: "gdk_drawable_get_clip_region".} -proc get_visible_region*(drawable: PDrawable): PRegion{.cdecl, - dynlib: lib, importc: "gdk_drawable_get_visible_region".} -const - NOTHING* = - (1) - DELETE* = 0 - constDESTROY* = 1 - EXPOSE* = 2 - MOTION_NOTIFY* = 3 - BUTTON_PRESS* = 4 - BUTTON2_PRESS* = 5 - BUTTON3_PRESS* = 6 - BUTTON_RELEASE* = 7 - KEY_PRESS* = 8 - KEY_RELEASE* = 9 - ENTER_NOTIFY* = 10 - LEAVE_NOTIFY* = 11 - FOCUS_CHANGE* = 12 - CONFIGURE* = 13 - MAP* = 14 - UNMAP* = 15 - PROPERTY_NOTIFY* = 16 - SELECTION_CLEAR* = 17 - SELECTION_REQUEST* = 18 - SELECTION_NOTIFY* = 19 - PROXIMITY_IN* = 20 - PROXIMITY_OUT* = 21 - DRAG_ENTER* = 22 - DRAG_LEAVE* = 23 - DRAG_MOTION_EVENT* = 24 - DRAG_STATUS_EVENT* = 25 - DROP_START* = 26 - DROP_FINISHED* = 27 - CLIENT_EVENT* = 28 - VISIBILITY_NOTIFY* = 29 - NO_EXPOSE* = 30 - constSCROLL* = 31 - WINDOW_STATE* = 32 - SETTING* = 33 - NOTIFY_ANCESTOR* = 0 - NOTIFY_VIRTUAL* = 1 - NOTIFY_INFERIOR* = 2 - NOTIFY_NONLINEAR* = 3 - NOTIFY_NONLINEAR_VIRTUAL* = 4 - NOTIFY_UNKNOWN* = 5 - -proc TYPE_EVENT*(): GType -const - G_PRIORITY_DEFAULT* = 0 - PRIORITY_EVENTS* = G_PRIORITY_DEFAULT #GDK_PRIORITY_REDRAW* = G_PRIORITY_HIGH_IDLE + 20 - EXPOSURE_MASK* = 1 shl 1 - POINTER_MOTION_MASK* = 1 shl 2 - POINTER_MOTION_HINT_MASK* = 1 shl 3 - BUTTON_MOTION_MASK* = 1 shl 4 - BUTTON1_MOTION_MASK* = 1 shl 5 - BUTTON2_MOTION_MASK* = 1 shl 6 - BUTTON3_MOTION_MASK* = 1 shl 7 - BUTTON_PRESS_MASK* = 1 shl 8 - BUTTON_RELEASE_MASK* = 1 shl 9 - KEY_PRESS_MASK* = 1 shl 10 - KEY_RELEASE_MASK* = 1 shl 11 - ENTER_NOTIFY_MASK* = 1 shl 12 - LEAVE_NOTIFY_MASK* = 1 shl 13 - FOCUS_CHANGE_MASK* = 1 shl 14 - STRUCTURE_MASK* = 1 shl 15 - PROPERTY_CHANGE_MASK* = 1 shl 16 - VISIBILITY_NOTIFY_MASK* = 1 shl 17 - PROXIMITY_IN_MASK* = 1 shl 18 - PROXIMITY_OUT_MASK* = 1 shl 19 - SUBSTRUCTURE_MASK* = 1 shl 20 - SCROLL_MASK* = 1 shl 21 - ALL_EVENTS_MASK* = 0x003FFFFE - WINDOW_STATE_WITHDRAWN* = 1 shl 0 - WINDOW_STATE_ICONIFIED* = 1 shl 1 - WINDOW_STATE_MAXIMIZED* = 1 shl 2 - WINDOW_STATE_STICKY* = 1 shl 3 - -proc event_get_type*(): GType{.cdecl, dynlib: lib, importc: "gdk_event_get_type".} -proc events_pending*(): gboolean{.cdecl, dynlib: lib, - importc: "gdk_events_pending".} -proc event_get*(): PEvent{.cdecl, dynlib: lib, importc: "gdk_event_get".} -proc event_peek*(): PEvent{.cdecl, dynlib: lib, importc: "gdk_event_peek".} -proc event_get_graphics_expose*(window: PWindow): PEvent{.cdecl, dynlib: lib, - importc: "gdk_event_get_graphics_expose".} -proc put*(event: PEvent){.cdecl, dynlib: lib, importc: "gdk_event_put".} -proc copy*(event: PEvent): PEvent{.cdecl, dynlib: lib, - importc: "gdk_event_copy".} -proc free*(event: PEvent){.cdecl, dynlib: lib, importc: "gdk_event_free".} -proc get_time*(event: PEvent): guint32{.cdecl, dynlib: lib, - importc: "gdk_event_get_time".} -proc get_state*(event: PEvent, state: PModifierType): gboolean{.cdecl, - dynlib: lib, importc: "gdk_event_get_state".} -proc get_coords*(event: PEvent, x_win: Pgdouble, y_win: Pgdouble): gboolean{. - cdecl, dynlib: lib, importc: "gdk_event_get_coords".} -proc get_root_coords*(event: PEvent, x_root: Pgdouble, y_root: Pgdouble): gboolean{. - cdecl, dynlib: lib, importc: "gdk_event_get_root_coords".} -proc get_axis*(event: PEvent, axis_use: TAxisUse, value: Pgdouble): gboolean{. - cdecl, dynlib: lib, importc: "gdk_event_get_axis".} -proc event_handler_set*(func: TEventFunc, data: gpointer, - notify: TGDestroyNotify){.cdecl, dynlib: lib, - importc: "gdk_event_handler_set".} -proc set_show_events*(show_events: gboolean){.cdecl, dynlib: lib, - importc: "gdk_set_show_events".} -proc get_show_events*(): gboolean{.cdecl, dynlib: lib, - importc: "gdk_get_show_events".} -proc TYPE_FONT*(): GType -proc font_get_type*(): GType{.cdecl, dynlib: lib, importc: "gdk_font_get_type".} -proc font_load_for_display*(display: PDisplay, font_name: cstring): PFont{. - cdecl, dynlib: lib, importc: "gdk_font_load_for_display".} -proc fontset_load_for_display*(display: PDisplay, fontset_name: cstring): PFont{. - cdecl, dynlib: lib, importc: "gdk_fontset_load_for_display".} -proc font_from_description_for_display*(display: PDisplay, - font_desc: PFontDescription): PFont{. - cdecl, dynlib: lib, importc: "gdk_font_from_description_for_display".} -proc reference*(font: PFont): PFont{.cdecl, dynlib: lib, importc: "gdk_font_ref".} -proc unref*(font: PFont){.cdecl, dynlib: lib, importc: "gdk_font_unref".} -proc id*(font: PFont): gint{.cdecl, dynlib: lib, importc: "gdk_font_id".} -proc equal*(fonta: PFont, fontb: PFont): gboolean{.cdecl, dynlib: lib, - importc: "gdk_font_equal".} -proc string_width*(font: PFont, `string`: cstring): gint{.cdecl, dynlib: lib, - importc: "gdk_string_width".} -proc text_width*(font: PFont, text: cstring, text_length: gint): gint{.cdecl, - dynlib: lib, importc: "gdk_text_width".} -proc text_width_wc*(font: PFont, text: PWChar, text_length: gint): gint{.cdecl, - dynlib: lib, importc: "gdk_text_width_wc".} -proc char_width*(font: PFont, character: gchar): gint{.cdecl, dynlib: lib, - importc: "gdk_char_width".} -proc char_width_wc*(font: PFont, character: TWChar): gint{.cdecl, dynlib: lib, - importc: "gdk_char_width_wc".} -proc string_measure*(font: PFont, `string`: cstring): gint{.cdecl, dynlib: lib, - importc: "gdk_string_measure".} -proc text_measure*(font: PFont, text: cstring, text_length: gint): gint{.cdecl, - dynlib: lib, importc: "gdk_text_measure".} -proc char_measure*(font: PFont, character: gchar): gint{.cdecl, dynlib: lib, - importc: "gdk_char_measure".} -proc string_height*(font: PFont, `string`: cstring): gint{.cdecl, dynlib: lib, - importc: "gdk_string_height".} -proc text_height*(font: PFont, text: cstring, text_length: gint): gint{.cdecl, - dynlib: lib, importc: "gdk_text_height".} -proc char_height*(font: PFont, character: gchar): gint{.cdecl, dynlib: lib, - importc: "gdk_char_height".} -proc text_extents*(font: PFont, text: cstring, text_length: gint, - lbearing: Pgint, rbearing: Pgint, width: Pgint, - ascent: Pgint, descent: Pgint){.cdecl, dynlib: lib, - importc: "gdk_text_extents".} -proc text_extents_wc*(font: PFont, text: PWChar, text_length: gint, - lbearing: Pgint, rbearing: Pgint, width: Pgint, - ascent: Pgint, descent: Pgint){.cdecl, dynlib: lib, - importc: "gdk_text_extents_wc".} -proc string_extents*(font: PFont, `string`: cstring, lbearing: Pgint, - rbearing: Pgint, width: Pgint, ascent: Pgint, - descent: Pgint){.cdecl, dynlib: lib, - importc: "gdk_string_extents".} -proc get_display*(font: PFont): PDisplay{.cdecl, dynlib: lib, - importc: "gdk_font_get_display".} -const - GC_FOREGROUND* = 1 shl 0 - GC_BACKGROUND* = 1 shl 1 - GC_FONT* = 1 shl 2 - GC_FUNCTION* = 1 shl 3 - GC_FILL* = 1 shl 4 - GC_TILE* = 1 shl 5 - GC_STIPPLE* = 1 shl 6 - GC_CLIP_MASK* = 1 shl 7 - GC_SUBWINDOW* = 1 shl 8 - GC_TS_X_ORIGIN* = 1 shl 9 - GC_TS_Y_ORIGIN* = 1 shl 10 - GC_CLIP_X_ORIGIN* = 1 shl 11 - GC_CLIP_Y_ORIGIN* = 1 shl 12 - GC_EXPOSURES* = 1 shl 13 - GC_LINE_WIDTH* = 1 shl 14 - GC_LINE_STYLE* = 1 shl 15 - GC_CAP_STYLE* = 1 shl 16 - GC_JOIN_STYLE* = 1 shl 17 - CLIP_BY_CHILDREN* = 0 - INCLUDE_INFERIORS* = 1 - -proc TYPE_GC*(): GType -proc GC*(anObject: Pointer): PGC -proc GC_CLASS*(klass: Pointer): PGCClass -proc IS_GC*(anObject: Pointer): bool -proc IS_GC_CLASS*(klass: Pointer): bool -proc GC_GET_CLASS*(obj: Pointer): PGCClass -proc gc_get_type*(): GType{.cdecl, dynlib: lib, importc: "gdk_gc_get_type".} -proc gc_new*(drawable: PDrawable): PGC{.cdecl, dynlib: lib, - importc: "gdk_gc_new".} -proc gc_new*(drawable: PDrawable, values: PGCValues, - values_mask: TGCValuesMask): PGC{.cdecl, dynlib: lib, - importc: "gdk_gc_new_with_values".} -proc get_values*(gc: PGC, values: PGCValues){.cdecl, dynlib: lib, - importc: "gdk_gc_get_values".} -proc set_values*(gc: PGC, values: PGCValues, values_mask: TGCValuesMask){. - cdecl, dynlib: lib, importc: "gdk_gc_set_values".} -proc set_foreground*(gc: PGC, color: PColor){.cdecl, dynlib: lib, - importc: "gdk_gc_set_foreground".} -proc set_background*(gc: PGC, color: PColor){.cdecl, dynlib: lib, - importc: "gdk_gc_set_background".} -proc set_function*(gc: PGC, `function`: TFunction){.cdecl, dynlib: lib, - importc: "gdk_gc_set_function".} -proc set_fill*(gc: PGC, fill: TFill){.cdecl, dynlib: lib, - importc: "gdk_gc_set_fill".} -proc set_tile*(gc: PGC, tile: PPixmap){.cdecl, dynlib: lib, - importc: "gdk_gc_set_tile".} -proc set_stipple*(gc: PGC, stipple: PPixmap){.cdecl, dynlib: lib, - importc: "gdk_gc_set_stipple".} -proc set_ts_origin*(gc: PGC, x: gint, y: gint){.cdecl, dynlib: lib, - importc: "gdk_gc_set_ts_origin".} -proc set_clip_origin*(gc: PGC, x: gint, y: gint){.cdecl, dynlib: lib, - importc: "gdk_gc_set_clip_origin".} -proc set_clip_mask*(gc: PGC, mask: PBitmap){.cdecl, dynlib: lib, - importc: "gdk_gc_set_clip_mask".} -proc set_clip_rectangle*(gc: PGC, rectangle: PRectangle){.cdecl, dynlib: lib, - importc: "gdk_gc_set_clip_rectangle".} -proc set_clip_region*(gc: PGC, region: PRegion){.cdecl, dynlib: lib, - importc: "gdk_gc_set_clip_region".} -proc set_subwindow*(gc: PGC, mode: TSubwindowMode){.cdecl, dynlib: lib, - importc: "gdk_gc_set_subwindow".} -proc set_exposures*(gc: PGC, exposures: gboolean){.cdecl, dynlib: lib, - importc: "gdk_gc_set_exposures".} -proc set_line_attributes*(gc: PGC, line_width: gint, line_style: TLineStyle, - cap_style: TCapStyle, join_style: TJoinStyle){. - cdecl, dynlib: lib, importc: "gdk_gc_set_line_attributes".} -proc set_dashes*(gc: PGC, dash_offset: gint, dash_list: openarray[gint8]){. - cdecl, dynlib: lib, importc: "gdk_gc_set_dashes".} -proc offset*(gc: PGC, x_offset: gint, y_offset: gint){.cdecl, dynlib: lib, - importc: "gdk_gc_offset".} -proc copy*(dst_gc: PGC, src_gc: PGC){.cdecl, dynlib: lib, - importc: "gdk_gc_copy".} -proc set_colormap*(gc: PGC, colormap: PColormap){.cdecl, dynlib: lib, - importc: "gdk_gc_set_colormap".} -proc get_colormap*(gc: PGC): PColormap{.cdecl, dynlib: lib, - importc: "gdk_gc_get_colormap".} -proc set_rgb_fg_color*(gc: PGC, color: PColor){.cdecl, dynlib: lib, - importc: "gdk_gc_set_rgb_fg_color".} -proc set_rgb_bg_color*(gc: PGC, color: PColor){.cdecl, dynlib: lib, - importc: "gdk_gc_set_rgb_bg_color".} -proc get_screen*(gc: PGC): PScreen{.cdecl, dynlib: lib, - importc: "gdk_gc_get_screen".} -proc TYPE_IMAGE*(): GType -proc IMAGE*(anObject: Pointer): PImage -proc IMAGE_CLASS*(klass: Pointer): PImageClass -proc IS_IMAGE*(anObject: Pointer): bool -proc IS_IMAGE_CLASS*(klass: Pointer): bool -proc IMAGE_GET_CLASS*(obj: Pointer): PImageClass -proc image_get_type*(): GType{.cdecl, dynlib: lib, importc: "gdk_image_get_type".} -proc image_new*(`type`: TImageType, visual: PVisual, width: gint, height: gint): PImage{. - cdecl, dynlib: lib, importc: "gdk_image_new".} -proc put_pixel*(image: PImage, x: gint, y: gint, pixel: guint32){.cdecl, - dynlib: lib, importc: "gdk_image_put_pixel".} -proc get_pixel*(image: PImage, x: gint, y: gint): guint32{.cdecl, - dynlib: lib, importc: "gdk_image_get_pixel".} -proc set_colormap*(image: PImage, colormap: PColormap){.cdecl, - dynlib: lib, importc: "gdk_image_set_colormap".} -proc get_colormap*(image: PImage): PColormap{.cdecl, dynlib: lib, - importc: "gdk_image_get_colormap".} -const - AXIS_IGNORE* = 0 - AXIS_X* = 1 - AXIS_Y* = 2 - AXIS_PRESSURE* = 3 - AXIS_XTILT* = 4 - AXIS_YTILT* = 5 - AXIS_WHEEL* = 6 - AXIS_LAST* = 7 - -proc TYPE_DEVICE*(): GType -proc DEVICE*(anObject: Pointer): PDevice -proc DEVICE_CLASS*(klass: Pointer): PDeviceClass -proc IS_DEVICE*(anObject: Pointer): bool -proc IS_DEVICE_CLASS*(klass: Pointer): bool -proc DEVICE_GET_CLASS*(obj: Pointer): PDeviceClass -proc device_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_device_get_type".} -proc set_source*(device: PDevice, source: TInputSource){.cdecl, - dynlib: lib, importc: "gdk_device_set_source".} -proc set_mode*(device: PDevice, mode: TInputMode): gboolean{.cdecl, - dynlib: lib, importc: "gdk_device_set_mode".} -proc set_key*(device: PDevice, index: guint, keyval: guint, - modifiers: TModifierType){.cdecl, dynlib: lib, - importc: "gdk_device_set_key".} -proc set_axis_use*(device: PDevice, index: guint, use: TAxisUse){.cdecl, - dynlib: lib, importc: "gdk_device_set_axis_use".} -proc get_state*(device: PDevice, window: PWindow, axes: Pgdouble, - mask: PModifierType){.cdecl, dynlib: lib, - importc: "gdk_device_get_state".} -proc get_history*(device: PDevice, window: PWindow, start: guint32, - stop: guint32, s: var PPTimeCoord, n_events: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "gdk_device_get_history".} -proc device_free_history*(events: PPTimeCoord, n_events: gint){.cdecl, - dynlib: lib, importc: "gdk_device_free_history".} -proc get_axis*(device: PDevice, axes: Pgdouble, use: TAxisUse, - value: Pgdouble): gboolean{.cdecl, dynlib: lib, - importc: "gdk_device_get_axis".} -proc input_set_extension_events*(window: PWindow, mask: gint, - mode: TExtensionMode){.cdecl, dynlib: lib, - importc: "gdk_input_set_extension_events".} -proc device_get_core_pointer*(): PDevice{.cdecl, dynlib: lib, - importc: "gdk_device_get_core_pointer".} -proc TYPE_KEYMAP*(): GType -proc KEYMAP*(anObject: Pointer): PKeymap -proc KEYMAP_CLASS*(klass: Pointer): PKeymapClass -proc IS_KEYMAP*(anObject: Pointer): bool -proc IS_KEYMAP_CLASS*(klass: Pointer): bool -proc KEYMAP_GET_CLASS*(obj: Pointer): PKeymapClass -proc keymap_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_keymap_get_type".} -proc keymap_get_for_display*(display: PDisplay): PKeymap{.cdecl, dynlib: lib, - importc: "gdk_keymap_get_for_display".} -proc lookup_key*(keymap: PKeymap, key: PKeymapKey): guint{.cdecl, - dynlib: lib, importc: "gdk_keymap_lookup_key".} -proc translate_keyboard_state*(keymap: PKeymap, hardware_keycode: guint, - state: TModifierType, group: gint, - keyval: Pguint, effective_group: Pgint, - level: Pgint, - consumed_modifiers: PModifierType): gboolean{. - cdecl, dynlib: lib, importc: "gdk_keymap_translate_keyboard_state".} -proc get_entries_for_keyval*(keymap: PKeymap, keyval: guint, - s: var PKeymapKey, n_keys: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "gdk_keymap_get_entries_for_keyval".} -proc get_entries_for_keycode*(keymap: PKeymap, hardware_keycode: guint, - s: var PKeymapKey, sasdf: var Pguint, - n_entries: Pgint): gboolean{.cdecl, - dynlib: lib, importc: "gdk_keymap_get_entries_for_keycode".} -proc get_direction*(keymap: PKeymap): TDirection{.cdecl, - dynlib: lib, importc: "gdk_keymap_get_direction".} -proc keyval_name*(keyval: guint): cstring{.cdecl, dynlib: lib, - importc: "gdk_keyval_name".} -proc keyval_from_name*(keyval_name: cstring): guint{.cdecl, dynlib: lib, - importc: "gdk_keyval_from_name".} -proc keyval_convert_case*(symbol: guint, lower: Pguint, upper: Pguint){.cdecl, - dynlib: lib, importc: "gdk_keyval_convert_case".} -proc keyval_to_upper*(keyval: guint): guint{.cdecl, dynlib: lib, - importc: "gdk_keyval_to_upper".} -proc keyval_to_lower*(keyval: guint): guint{.cdecl, dynlib: lib, - importc: "gdk_keyval_to_lower".} -proc keyval_is_upper*(keyval: guint): gboolean{.cdecl, dynlib: lib, - importc: "gdk_keyval_is_upper".} -proc keyval_is_lower*(keyval: guint): gboolean{.cdecl, dynlib: lib, - importc: "gdk_keyval_is_lower".} -proc keyval_to_unicode*(keyval: guint): guint32{.cdecl, dynlib: lib, - importc: "gdk_keyval_to_unicode".} -proc unicode_to_keyval*(wc: guint32): guint{.cdecl, dynlib: lib, - importc: "gdk_unicode_to_keyval".} -const - KEY_VoidSymbol* = 0x00FFFFFF - KEY_BackSpace* = 0x0000FF08 - KEY_Tab* = 0x0000FF09 - KEY_Linefeed* = 0x0000FF0A - KEY_Clear* = 0x0000FF0B - KEY_Return* = 0x0000FF0D - KEY_Pause* = 0x0000FF13 - KEY_Scroll_Lock* = 0x0000FF14 - KEY_Sys_Req* = 0x0000FF15 - KEY_Escape* = 0x0000FF1B - KEY_Delete* = 0x0000FFFF - KEY_Multi_key* = 0x0000FF20 - KEY_Codeinput* = 0x0000FF37 - KEY_SingleCandidate* = 0x0000FF3C - KEY_MultipleCandidate* = 0x0000FF3D - KEY_PreviousCandidate* = 0x0000FF3E - KEY_Kanji* = 0x0000FF21 - KEY_Muhenkan* = 0x0000FF22 - KEY_Henkan_Mode* = 0x0000FF23 - KEY_Henkan* = 0x0000FF23 - KEY_Romaji* = 0x0000FF24 - KEY_Hiragana* = 0x0000FF25 - KEY_Katakana* = 0x0000FF26 - KEY_Hiragana_Katakana* = 0x0000FF27 - KEY_Zenkaku* = 0x0000FF28 - KEY_Hankaku* = 0x0000FF29 - KEY_Zenkaku_Hankaku* = 0x0000FF2A - KEY_Touroku* = 0x0000FF2B - KEY_Massyo* = 0x0000FF2C - KEY_Kana_Lock* = 0x0000FF2D - KEY_Kana_Shift* = 0x0000FF2E - KEY_Eisu_Shift* = 0x0000FF2F - KEY_Eisu_toggle* = 0x0000FF30 - KEY_Kanji_Bangou* = 0x0000FF37 - KEY_Zen_Koho* = 0x0000FF3D - KEY_Mae_Koho* = 0x0000FF3E - KEY_Home* = 0x0000FF50 - KEY_Left* = 0x0000FF51 - KEY_Up* = 0x0000FF52 - KEY_Right* = 0x0000FF53 - KEY_Down* = 0x0000FF54 - KEY_Prior* = 0x0000FF55 - KEY_Page_Up* = 0x0000FF55 - KEY_Next* = 0x0000FF56 - KEY_Page_Down* = 0x0000FF56 - KEY_End* = 0x0000FF57 - KEY_Begin* = 0x0000FF58 - KEY_Select* = 0x0000FF60 - KEY_Print* = 0x0000FF61 - KEY_Execute* = 0x0000FF62 - KEY_Insert* = 0x0000FF63 - KEY_Undo* = 0x0000FF65 - KEY_Redo* = 0x0000FF66 - KEY_Menu* = 0x0000FF67 - KEY_Find* = 0x0000FF68 - KEY_Cancel* = 0x0000FF69 - KEY_Help* = 0x0000FF6A - KEY_Break* = 0x0000FF6B - KEY_Mode_switch* = 0x0000FF7E - KEY_script_switch* = 0x0000FF7E - KEY_Num_Lock* = 0x0000FF7F - KEY_KP_Space* = 0x0000FF80 - KEY_KP_Tab* = 0x0000FF89 - KEY_KP_Enter* = 0x0000FF8D - KEY_KP_F1* = 0x0000FF91 - KEY_KP_F2* = 0x0000FF92 - KEY_KP_F3* = 0x0000FF93 - KEY_KP_F4* = 0x0000FF94 - KEY_KP_Home* = 0x0000FF95 - KEY_KP_Left* = 0x0000FF96 - KEY_KP_Up* = 0x0000FF97 - KEY_KP_Right* = 0x0000FF98 - KEY_KP_Down* = 0x0000FF99 - KEY_KP_Prior* = 0x0000FF9A - KEY_KP_Page_Up* = 0x0000FF9A - KEY_KP_Next* = 0x0000FF9B - KEY_KP_Page_Down* = 0x0000FF9B - KEY_KP_End* = 0x0000FF9C - KEY_KP_Begin* = 0x0000FF9D - KEY_KP_Insert* = 0x0000FF9E - KEY_KP_Delete* = 0x0000FF9F - KEY_KP_Equal* = 0x0000FFBD - KEY_KP_Multiply* = 0x0000FFAA - KEY_KP_Add* = 0x0000FFAB - KEY_KP_Separator* = 0x0000FFAC - KEY_KP_Subtract* = 0x0000FFAD - KEY_KP_Decimal* = 0x0000FFAE - KEY_KP_Divide* = 0x0000FFAF - KEY_KP_0* = 0x0000FFB0 - KEY_KP_1* = 0x0000FFB1 - KEY_KP_2* = 0x0000FFB2 - KEY_KP_3* = 0x0000FFB3 - KEY_KP_4* = 0x0000FFB4 - KEY_KP_5* = 0x0000FFB5 - KEY_KP_6* = 0x0000FFB6 - KEY_KP_7* = 0x0000FFB7 - KEY_KP_8* = 0x0000FFB8 - KEY_KP_9* = 0x0000FFB9 - KEY_F1* = 0x0000FFBE - KEY_F2* = 0x0000FFBF - KEY_F3* = 0x0000FFC0 - KEY_F4* = 0x0000FFC1 - KEY_F5* = 0x0000FFC2 - KEY_F6* = 0x0000FFC3 - KEY_F7* = 0x0000FFC4 - KEY_F8* = 0x0000FFC5 - KEY_F9* = 0x0000FFC6 - KEY_F10* = 0x0000FFC7 - KEY_F11* = 0x0000FFC8 - KEY_L1* = 0x0000FFC8 - KEY_F12* = 0x0000FFC9 - KEY_L2* = 0x0000FFC9 - KEY_F13* = 0x0000FFCA - KEY_L3* = 0x0000FFCA - KEY_F14* = 0x0000FFCB - KEY_L4* = 0x0000FFCB - KEY_F15* = 0x0000FFCC - KEY_L5* = 0x0000FFCC - KEY_F16* = 0x0000FFCD - KEY_L6* = 0x0000FFCD - KEY_F17* = 0x0000FFCE - KEY_L7* = 0x0000FFCE - KEY_F18* = 0x0000FFCF - KEY_L8* = 0x0000FFCF - KEY_F19* = 0x0000FFD0 - KEY_L9* = 0x0000FFD0 - KEY_F20* = 0x0000FFD1 - KEY_L10* = 0x0000FFD1 - KEY_F21* = 0x0000FFD2 - KEY_R1* = 0x0000FFD2 - KEY_F22* = 0x0000FFD3 - KEY_R2* = 0x0000FFD3 - KEY_F23* = 0x0000FFD4 - KEY_R3* = 0x0000FFD4 - KEY_F24* = 0x0000FFD5 - KEY_R4* = 0x0000FFD5 - KEY_F25* = 0x0000FFD6 - KEY_R5* = 0x0000FFD6 - KEY_F26* = 0x0000FFD7 - KEY_R6* = 0x0000FFD7 - KEY_F27* = 0x0000FFD8 - KEY_R7* = 0x0000FFD8 - KEY_F28* = 0x0000FFD9 - KEY_R8* = 0x0000FFD9 - KEY_F29* = 0x0000FFDA - KEY_R9* = 0x0000FFDA - KEY_F30* = 0x0000FFDB - KEY_R10* = 0x0000FFDB - KEY_F31* = 0x0000FFDC - KEY_R11* = 0x0000FFDC - KEY_F32* = 0x0000FFDD - KEY_R12* = 0x0000FFDD - KEY_F33* = 0x0000FFDE - KEY_R13* = 0x0000FFDE - KEY_F34* = 0x0000FFDF - KEY_R14* = 0x0000FFDF - KEY_F35* = 0x0000FFE0 - KEY_R15* = 0x0000FFE0 - KEY_Shift_L* = 0x0000FFE1 - KEY_Shift_R* = 0x0000FFE2 - KEY_Control_L* = 0x0000FFE3 - KEY_Control_R* = 0x0000FFE4 - KEY_Caps_Lock* = 0x0000FFE5 - KEY_Shift_Lock* = 0x0000FFE6 - KEY_Meta_L* = 0x0000FFE7 - KEY_Meta_R* = 0x0000FFE8 - KEY_Alt_L* = 0x0000FFE9 - KEY_Alt_R* = 0x0000FFEA - KEY_Super_L* = 0x0000FFEB - KEY_Super_R* = 0x0000FFEC - KEY_Hyper_L* = 0x0000FFED - KEY_Hyper_R* = 0x0000FFEE - KEY_ISO_Lock* = 0x0000FE01 - KEY_ISO_Level2_Latch* = 0x0000FE02 - KEY_ISO_Level3_Shift* = 0x0000FE03 - KEY_ISO_Level3_Latch* = 0x0000FE04 - KEY_ISO_Level3_Lock* = 0x0000FE05 - KEY_ISO_Group_Shift* = 0x0000FF7E - KEY_ISO_Group_Latch* = 0x0000FE06 - KEY_ISO_Group_Lock* = 0x0000FE07 - KEY_ISO_Next_Group* = 0x0000FE08 - KEY_ISO_Next_Group_Lock* = 0x0000FE09 - KEY_ISO_Prev_Group* = 0x0000FE0A - KEY_ISO_Prev_Group_Lock* = 0x0000FE0B - KEY_ISO_First_Group* = 0x0000FE0C - KEY_ISO_First_Group_Lock* = 0x0000FE0D - KEY_ISO_Last_Group* = 0x0000FE0E - KEY_ISO_Last_Group_Lock* = 0x0000FE0F - KEY_ISO_Left_Tab* = 0x0000FE20 - KEY_ISO_Move_Line_Up* = 0x0000FE21 - KEY_ISO_Move_Line_Down* = 0x0000FE22 - KEY_ISO_Partial_Line_Up* = 0x0000FE23 - KEY_ISO_Partial_Line_Down* = 0x0000FE24 - KEY_ISO_Partial_Space_Left* = 0x0000FE25 - KEY_ISO_Partial_Space_Right* = 0x0000FE26 - KEY_ISO_Set_Margin_Left* = 0x0000FE27 - KEY_ISO_Set_Margin_Right* = 0x0000FE28 - KEY_ISO_Release_Margin_Left* = 0x0000FE29 - KEY_ISO_Release_Margin_Right* = 0x0000FE2A - KEY_ISO_Release_Both_Margins* = 0x0000FE2B - KEY_ISO_Fast_Cursor_Left* = 0x0000FE2C - KEY_ISO_Fast_Cursor_Right* = 0x0000FE2D - KEY_ISO_Fast_Cursor_Up* = 0x0000FE2E - KEY_ISO_Fast_Cursor_Down* = 0x0000FE2F - KEY_ISO_Continuous_Underline* = 0x0000FE30 - KEY_ISO_Discontinuous_Underline* = 0x0000FE31 - KEY_ISO_Emphasize* = 0x0000FE32 - KEY_ISO_Center_Object* = 0x0000FE33 - KEY_ISO_Enter* = 0x0000FE34 - KEY_dead_grave* = 0x0000FE50 - KEY_dead_acute* = 0x0000FE51 - KEY_dead_circumflex* = 0x0000FE52 - KEY_dead_tilde* = 0x0000FE53 - KEY_dead_macron* = 0x0000FE54 - KEY_dead_breve* = 0x0000FE55 - KEY_dead_abovedot* = 0x0000FE56 - KEY_dead_diaeresis* = 0x0000FE57 - KEY_dead_abovering* = 0x0000FE58 - KEY_dead_doubleacute* = 0x0000FE59 - KEY_dead_caron* = 0x0000FE5A - KEY_dead_cedilla* = 0x0000FE5B - KEY_dead_ogonek* = 0x0000FE5C - KEY_dead_iota* = 0x0000FE5D - KEY_dead_voiced_sound* = 0x0000FE5E - KEY_dead_semivoiced_sound* = 0x0000FE5F - KEY_dead_belowdot* = 0x0000FE60 - KEY_First_Virtual_Screen* = 0x0000FED0 - KEY_Prev_Virtual_Screen* = 0x0000FED1 - KEY_Next_Virtual_Screen* = 0x0000FED2 - KEY_Last_Virtual_Screen* = 0x0000FED4 - KEY_Terminate_Server* = 0x0000FED5 - KEY_AccessX_Enable* = 0x0000FE70 - KEY_AccessX_Feedback_Enable* = 0x0000FE71 - KEY_RepeatKeys_Enable* = 0x0000FE72 - KEY_SlowKeys_Enable* = 0x0000FE73 - KEY_BounceKeys_Enable* = 0x0000FE74 - KEY_StickyKeys_Enable* = 0x0000FE75 - KEY_MouseKeys_Enable* = 0x0000FE76 - KEY_MouseKeys_Accel_Enable* = 0x0000FE77 - KEY_Overlay1_Enable* = 0x0000FE78 - KEY_Overlay2_Enable* = 0x0000FE79 - KEY_AudibleBell_Enable* = 0x0000FE7A - KEY_Pointer_Left* = 0x0000FEE0 - KEY_Pointer_Right* = 0x0000FEE1 - KEY_Pointer_Up* = 0x0000FEE2 - KEY_Pointer_Down* = 0x0000FEE3 - KEY_Pointer_UpLeft* = 0x0000FEE4 - KEY_Pointer_UpRight* = 0x0000FEE5 - KEY_Pointer_DownLeft* = 0x0000FEE6 - KEY_Pointer_DownRight* = 0x0000FEE7 - KEY_Pointer_Button_Dflt* = 0x0000FEE8 - KEY_Pointer_Button1* = 0x0000FEE9 - KEY_Pointer_Button2* = 0x0000FEEA - KEY_Pointer_Button3* = 0x0000FEEB - KEY_Pointer_Button4* = 0x0000FEEC - KEY_Pointer_Button5* = 0x0000FEED - KEY_Pointer_DblClick_Dflt* = 0x0000FEEE - KEY_Pointer_DblClick1* = 0x0000FEEF - KEY_Pointer_DblClick2* = 0x0000FEF0 - KEY_Pointer_DblClick3* = 0x0000FEF1 - KEY_Pointer_DblClick4* = 0x0000FEF2 - KEY_Pointer_DblClick5* = 0x0000FEF3 - KEY_Pointer_Drag_Dflt* = 0x0000FEF4 - KEY_Pointer_Drag1* = 0x0000FEF5 - KEY_Pointer_Drag2* = 0x0000FEF6 - KEY_Pointer_Drag3* = 0x0000FEF7 - KEY_Pointer_Drag4* = 0x0000FEF8 - KEY_Pointer_Drag5* = 0x0000FEFD - KEY_Pointer_EnableKeys* = 0x0000FEF9 - KEY_Pointer_Accelerate* = 0x0000FEFA - KEY_Pointer_DfltBtnNext* = 0x0000FEFB - KEY_Pointer_DfltBtnPrev* = 0x0000FEFC - KEY_3270_Duplicate* = 0x0000FD01 - KEY_3270_FieldMark* = 0x0000FD02 - KEY_3270_Right2* = 0x0000FD03 - KEY_3270_Left2* = 0x0000FD04 - KEY_3270_BackTab* = 0x0000FD05 - KEY_3270_EraseEOF* = 0x0000FD06 - KEY_3270_EraseInput* = 0x0000FD07 - KEY_3270_Reset* = 0x0000FD08 - KEY_3270_Quit* = 0x0000FD09 - KEY_3270_PA1* = 0x0000FD0A - KEY_3270_PA2* = 0x0000FD0B - KEY_3270_PA3* = 0x0000FD0C - KEY_3270_Test* = 0x0000FD0D - KEY_3270_Attn* = 0x0000FD0E - KEY_3270_CursorBlink* = 0x0000FD0F - KEY_3270_AltCursor* = 0x0000FD10 - KEY_3270_KeyClick* = 0x0000FD11 - KEY_3270_Jump* = 0x0000FD12 - KEY_3270_Ident* = 0x0000FD13 - KEY_3270_Rule* = 0x0000FD14 - KEY_3270_Copy* = 0x0000FD15 - KEY_3270_Play* = 0x0000FD16 - KEY_3270_Setup* = 0x0000FD17 - KEY_3270_Record* = 0x0000FD18 - KEY_3270_ChangeScreen* = 0x0000FD19 - KEY_3270_DeleteWord* = 0x0000FD1A - KEY_3270_ExSelect* = 0x0000FD1B - KEY_3270_CursorSelect* = 0x0000FD1C - KEY_3270_PrintScreen* = 0x0000FD1D - KEY_3270_Enter* = 0x0000FD1E - KEY_space* = 0x00000020 - KEY_exclam* = 0x00000021 - KEY_quotedbl* = 0x00000022 - KEY_numbersign* = 0x00000023 - KEY_dollar* = 0x00000024 - KEY_percent* = 0x00000025 - KEY_ampersand* = 0x00000026 - KEY_apostrophe* = 0x00000027 - KEY_quoteright* = 0x00000027 - KEY_parenleft* = 0x00000028 - KEY_parenright* = 0x00000029 - KEY_asterisk* = 0x0000002A - KEY_plus* = 0x0000002B - KEY_comma* = 0x0000002C - KEY_minus* = 0x0000002D - KEY_period* = 0x0000002E - KEY_slash* = 0x0000002F - KEY_0* = 0x00000030 - KEY_1* = 0x00000031 - KEY_2* = 0x00000032 - KEY_3* = 0x00000033 - KEY_4* = 0x00000034 - KEY_5* = 0x00000035 - KEY_6* = 0x00000036 - KEY_7* = 0x00000037 - KEY_8* = 0x00000038 - KEY_9* = 0x00000039 - KEY_colon* = 0x0000003A - KEY_semicolon* = 0x0000003B - KEY_less* = 0x0000003C - KEY_equal* = 0x0000003D - KEY_greater* = 0x0000003E - KEY_question* = 0x0000003F - KEY_at* = 0x00000040 - KEY_CAPITAL_A* = 0x00000041 - KEY_CAPITAL_B* = 0x00000042 - KEY_CAPITAL_C* = 0x00000043 - KEY_CAPITAL_D* = 0x00000044 - KEY_CAPITAL_E* = 0x00000045 - KEY_CAPITAL_F* = 0x00000046 - KEY_CAPITAL_G* = 0x00000047 - KEY_CAPITAL_H* = 0x00000048 - KEY_CAPITAL_I* = 0x00000049 - KEY_CAPITAL_J* = 0x0000004A - KEY_CAPITAL_K* = 0x0000004B - KEY_CAPITAL_L* = 0x0000004C - KEY_CAPITAL_M* = 0x0000004D - KEY_CAPITAL_N* = 0x0000004E - KEY_CAPITAL_O* = 0x0000004F - KEY_CAPITAL_P* = 0x00000050 - KEY_CAPITAL_Q* = 0x00000051 - KEY_CAPITAL_R* = 0x00000052 - KEY_CAPITAL_S* = 0x00000053 - KEY_CAPITAL_T* = 0x00000054 - KEY_CAPITAL_U* = 0x00000055 - KEY_CAPITAL_V* = 0x00000056 - KEY_CAPITAL_W* = 0x00000057 - KEY_CAPITAL_X* = 0x00000058 - KEY_CAPITAL_Y* = 0x00000059 - KEY_CAPITAL_Z* = 0x0000005A - KEY_bracketleft* = 0x0000005B - KEY_backslash* = 0x0000005C - KEY_bracketright* = 0x0000005D - KEY_asciicircum* = 0x0000005E - KEY_underscore* = 0x0000005F - KEY_grave* = 0x00000060 - KEY_quoteleft* = 0x00000060 - KEY_a* = 0x00000061 - KEY_b* = 0x00000062 - KEY_c* = 0x00000063 - KEY_d* = 0x00000064 - KEY_e* = 0x00000065 - KEY_f* = 0x00000066 - KEY_g* = 0x00000067 - KEY_h* = 0x00000068 - KEY_i* = 0x00000069 - KEY_j* = 0x0000006A - KEY_k* = 0x0000006B - KEY_l* = 0x0000006C - KEY_m* = 0x0000006D - KEY_n* = 0x0000006E - KEY_o* = 0x0000006F - KEY_p* = 0x00000070 - KEY_q* = 0x00000071 - KEY_r* = 0x00000072 - KEY_s* = 0x00000073 - KEY_t* = 0x00000074 - KEY_u* = 0x00000075 - KEY_v* = 0x00000076 - KEY_w* = 0x00000077 - KEY_x* = 0x00000078 - KEY_y* = 0x00000079 - KEY_z* = 0x0000007A - KEY_braceleft* = 0x0000007B - KEY_bar* = 0x0000007C - KEY_braceright* = 0x0000007D - KEY_asciitilde* = 0x0000007E - KEY_nobreakspace* = 0x000000A0 - KEY_exclamdown* = 0x000000A1 - KEY_cent* = 0x000000A2 - KEY_sterling* = 0x000000A3 - KEY_currency* = 0x000000A4 - KEY_yen* = 0x000000A5 - KEY_brokenbar* = 0x000000A6 - KEY_section* = 0x000000A7 - KEY_diaeresis* = 0x000000A8 - KEY_copyright* = 0x000000A9 - KEY_ordfeminine* = 0x000000AA - KEY_guillemotleft* = 0x000000AB - KEY_notsign* = 0x000000AC - KEY_hyphen* = 0x000000AD - KEY_registered* = 0x000000AE - KEY_macron* = 0x000000AF - KEY_degree* = 0x000000B0 - KEY_plusminus* = 0x000000B1 - KEY_twosuperior* = 0x000000B2 - KEY_threesuperior* = 0x000000B3 - KEY_acute* = 0x000000B4 - KEY_mu* = 0x000000B5 - KEY_paragraph* = 0x000000B6 - KEY_periodcentered* = 0x000000B7 - KEY_cedilla* = 0x000000B8 - KEY_onesuperior* = 0x000000B9 - KEY_masculine* = 0x000000BA - KEY_guillemotright* = 0x000000BB - KEY_onequarter* = 0x000000BC - KEY_onehalf* = 0x000000BD - KEY_threequarters* = 0x000000BE - KEY_questiondown* = 0x000000BF - KEY_CAPITAL_Agrave* = 0x000000C0 - KEY_CAPITAL_Aacute* = 0x000000C1 - KEY_CAPITAL_Acircumflex* = 0x000000C2 - KEY_CAPITAL_Atilde* = 0x000000C3 - KEY_CAPITAL_Adiaeresis* = 0x000000C4 - KEY_CAPITAL_Aring* = 0x000000C5 - KEY_CAPITAL_AE* = 0x000000C6 - KEY_CAPITAL_Ccedilla* = 0x000000C7 - KEY_CAPITAL_Egrave* = 0x000000C8 - KEY_CAPITAL_Eacute* = 0x000000C9 - KEY_CAPITAL_Ecircumflex* = 0x000000CA - KEY_CAPITAL_Ediaeresis* = 0x000000CB - KEY_CAPITAL_Igrave* = 0x000000CC - KEY_CAPITAL_Iacute* = 0x000000CD - KEY_CAPITAL_Icircumflex* = 0x000000CE - KEY_CAPITAL_Idiaeresis* = 0x000000CF - KEY_CAPITAL_ETH* = 0x000000D0 - KEY_CAPITAL_Ntilde* = 0x000000D1 - KEY_CAPITAL_Ograve* = 0x000000D2 - KEY_CAPITAL_Oacute* = 0x000000D3 - KEY_CAPITAL_Ocircumflex* = 0x000000D4 - KEY_CAPITAL_Otilde* = 0x000000D5 - KEY_CAPITAL_Odiaeresis* = 0x000000D6 - KEY_multiply* = 0x000000D7 - KEY_Ooblique* = 0x000000D8 - KEY_CAPITAL_Ugrave* = 0x000000D9 - KEY_CAPITAL_Uacute* = 0x000000DA - KEY_CAPITAL_Ucircumflex* = 0x000000DB - KEY_CAPITAL_Udiaeresis* = 0x000000DC - KEY_CAPITAL_Yacute* = 0x000000DD - KEY_CAPITAL_THORN* = 0x000000DE - KEY_ssharp* = 0x000000DF - KEY_agrave* = 0x000000E0 - KEY_aacute* = 0x000000E1 - KEY_acircumflex* = 0x000000E2 - KEY_atilde* = 0x000000E3 - KEY_adiaeresis* = 0x000000E4 - KEY_aring* = 0x000000E5 - KEY_ae* = 0x000000E6 - KEY_ccedilla* = 0x000000E7 - KEY_egrave* = 0x000000E8 - KEY_eacute* = 0x000000E9 - KEY_ecircumflex* = 0x000000EA - KEY_ediaeresis* = 0x000000EB - KEY_igrave* = 0x000000EC - KEY_iacute* = 0x000000ED - KEY_icircumflex* = 0x000000EE - KEY_idiaeresis* = 0x000000EF - KEY_eth* = 0x000000F0 - KEY_ntilde* = 0x000000F1 - KEY_ograve* = 0x000000F2 - KEY_oacute* = 0x000000F3 - KEY_ocircumflex* = 0x000000F4 - KEY_otilde* = 0x000000F5 - KEY_odiaeresis* = 0x000000F6 - KEY_division* = 0x000000F7 - KEY_oslash* = 0x000000F8 - KEY_ugrave* = 0x000000F9 - KEY_uacute* = 0x000000FA - KEY_ucircumflex* = 0x000000FB - KEY_udiaeresis* = 0x000000FC - KEY_yacute* = 0x000000FD - KEY_thorn* = 0x000000FE - KEY_ydiaeresis* = 0x000000FF - KEY_CAPITAL_Aogonek* = 0x000001A1 - KEY_breve* = 0x000001A2 - KEY_CAPITAL_Lstroke* = 0x000001A3 - KEY_CAPITAL_Lcaron* = 0x000001A5 - KEY_CAPITAL_Sacute* = 0x000001A6 - KEY_CAPITAL_Scaron* = 0x000001A9 - KEY_CAPITAL_Scedilla* = 0x000001AA - KEY_CAPITAL_Tcaron* = 0x000001AB - KEY_CAPITAL_Zacute* = 0x000001AC - KEY_CAPITAL_Zcaron* = 0x000001AE - KEY_CAPITAL_Zabovedot* = 0x000001AF - KEY_aogonek* = 0x000001B1 - KEY_ogonek* = 0x000001B2 - KEY_lstroke* = 0x000001B3 - KEY_lcaron* = 0x000001B5 - KEY_sacute* = 0x000001B6 - KEY_caron* = 0x000001B7 - KEY_scaron* = 0x000001B9 - KEY_scedilla* = 0x000001BA - KEY_tcaron* = 0x000001BB - KEY_zacute* = 0x000001BC - KEY_doubleacute* = 0x000001BD - KEY_zcaron* = 0x000001BE - KEY_zabovedot* = 0x000001BF - KEY_CAPITAL_Racute* = 0x000001C0 - KEY_CAPITAL_Abreve* = 0x000001C3 - KEY_CAPITAL_Lacute* = 0x000001C5 - KEY_CAPITAL_Cacute* = 0x000001C6 - KEY_CAPITAL_Ccaron* = 0x000001C8 - KEY_CAPITAL_Eogonek* = 0x000001CA - KEY_CAPITAL_Ecaron* = 0x000001CC - KEY_CAPITAL_Dcaron* = 0x000001CF - KEY_CAPITAL_Dstroke* = 0x000001D0 - KEY_CAPITAL_Nacute* = 0x000001D1 - KEY_CAPITAL_Ncaron* = 0x000001D2 - KEY_CAPITAL_Odoubleacute* = 0x000001D5 - KEY_CAPITAL_Rcaron* = 0x000001D8 - KEY_CAPITAL_Uring* = 0x000001D9 - KEY_CAPITAL_Udoubleacute* = 0x000001DB - KEY_CAPITAL_Tcedilla* = 0x000001DE - KEY_racute* = 0x000001E0 - KEY_abreve* = 0x000001E3 - KEY_lacute* = 0x000001E5 - KEY_cacute* = 0x000001E6 - KEY_ccaron* = 0x000001E8 - KEY_eogonek* = 0x000001EA - KEY_ecaron* = 0x000001EC - KEY_dcaron* = 0x000001EF - KEY_dstroke* = 0x000001F0 - KEY_nacute* = 0x000001F1 - KEY_ncaron* = 0x000001F2 - KEY_odoubleacute* = 0x000001F5 - KEY_udoubleacute* = 0x000001FB - KEY_rcaron* = 0x000001F8 - KEY_uring* = 0x000001F9 - KEY_tcedilla* = 0x000001FE - KEY_abovedot* = 0x000001FF - KEY_CAPITAL_Hstroke* = 0x000002A1 - KEY_CAPITAL_Hcircumflex* = 0x000002A6 - KEY_CAPITAL_Iabovedot* = 0x000002A9 - KEY_CAPITAL_Gbreve* = 0x000002AB - KEY_CAPITAL_Jcircumflex* = 0x000002AC - KEY_hstroke* = 0x000002B1 - KEY_hcircumflex* = 0x000002B6 - KEY_idotless* = 0x000002B9 - KEY_gbreve* = 0x000002BB - KEY_jcircumflex* = 0x000002BC - KEY_CAPITAL_Cabovedot* = 0x000002C5 - KEY_CAPITAL_Ccircumflex* = 0x000002C6 - KEY_CAPITAL_Gabovedot* = 0x000002D5 - KEY_CAPITAL_Gcircumflex* = 0x000002D8 - KEY_CAPITAL_Ubreve* = 0x000002DD - KEY_CAPITAL_Scircumflex* = 0x000002DE - KEY_cabovedot* = 0x000002E5 - KEY_ccircumflex* = 0x000002E6 - KEY_gabovedot* = 0x000002F5 - KEY_gcircumflex* = 0x000002F8 - KEY_ubreve* = 0x000002FD - KEY_scircumflex* = 0x000002FE - KEY_kra* = 0x000003A2 - KEY_kappa* = 0x000003A2 - KEY_CAPITAL_Rcedilla* = 0x000003A3 - KEY_CAPITAL_Itilde* = 0x000003A5 - KEY_CAPITAL_Lcedilla* = 0x000003A6 - KEY_CAPITAL_Emacron* = 0x000003AA - KEY_CAPITAL_Gcedilla* = 0x000003AB - KEY_CAPITAL_Tslash* = 0x000003AC - KEY_rcedilla* = 0x000003B3 - KEY_itilde* = 0x000003B5 - KEY_lcedilla* = 0x000003B6 - KEY_emacron* = 0x000003BA - KEY_gcedilla* = 0x000003BB - KEY_tslash* = 0x000003BC - KEY_CAPITAL_ENG* = 0x000003BD - KEY_eng* = 0x000003BF - KEY_CAPITAL_Amacron* = 0x000003C0 - KEY_CAPITAL_Iogonek* = 0x000003C7 - KEY_CAPITAL_Eabovedot* = 0x000003CC - KEY_CAPITAL_Imacron* = 0x000003CF - KEY_CAPITAL_Ncedilla* = 0x000003D1 - KEY_CAPITAL_Omacron* = 0x000003D2 - KEY_CAPITAL_Kcedilla* = 0x000003D3 - KEY_CAPITAL_Uogonek* = 0x000003D9 - KEY_CAPITAL_Utilde* = 0x000003DD - KEY_CAPITAL_Umacron* = 0x000003DE - KEY_amacron* = 0x000003E0 - KEY_iogonek* = 0x000003E7 - KEY_eabovedot* = 0x000003EC - KEY_imacron* = 0x000003EF - KEY_ncedilla* = 0x000003F1 - KEY_omacron* = 0x000003F2 - KEY_kcedilla* = 0x000003F3 - KEY_uogonek* = 0x000003F9 - KEY_utilde* = 0x000003FD - KEY_umacron* = 0x000003FE - KEY_CAPITAL_OE* = 0x000013BC - KEY_oe* = 0x000013BD - KEY_CAPITAL_Ydiaeresis* = 0x000013BE - KEY_overline* = 0x0000047E - KEY_kana_fullstop* = 0x000004A1 - KEY_kana_openingbracket* = 0x000004A2 - KEY_kana_closingbracket* = 0x000004A3 - KEY_kana_comma* = 0x000004A4 - KEY_kana_conjunctive* = 0x000004A5 - KEY_kana_middledot* = 0x000004A5 - KEY_kana_WO* = 0x000004A6 - KEY_kana_a* = 0x000004A7 - KEY_kana_i* = 0x000004A8 - KEY_kana_u* = 0x000004A9 - KEY_kana_e* = 0x000004AA - KEY_kana_o* = 0x000004AB - KEY_kana_ya* = 0x000004AC - KEY_kana_yu* = 0x000004AD - KEY_kana_yo* = 0x000004AE - KEY_kana_tsu* = 0x000004AF - KEY_kana_tu* = 0x000004AF - KEY_prolongedsound* = 0x000004B0 - KEY_kana_CAPITAL_A* = 0x000004B1 - KEY_kana_CAPITAL_I* = 0x000004B2 - KEY_kana_CAPITAL_U* = 0x000004B3 - KEY_kana_CAPITAL_E* = 0x000004B4 - KEY_kana_CAPITAL_O* = 0x000004B5 - KEY_kana_KA* = 0x000004B6 - KEY_kana_KI* = 0x000004B7 - KEY_kana_KU* = 0x000004B8 - KEY_kana_KE* = 0x000004B9 - KEY_kana_KO* = 0x000004BA - KEY_kana_SA* = 0x000004BB - KEY_kana_SHI* = 0x000004BC - KEY_kana_SU* = 0x000004BD - KEY_kana_SE* = 0x000004BE - KEY_kana_SO* = 0x000004BF - KEY_kana_TA* = 0x000004C0 - KEY_kana_CHI* = 0x000004C1 - KEY_kana_TI* = 0x000004C1 - KEY_kana_CAPITAL_TSU* = 0x000004C2 - KEY_kana_CAPITAL_TU* = 0x000004C2 - KEY_kana_TE* = 0x000004C3 - KEY_kana_TO* = 0x000004C4 - KEY_kana_NA* = 0x000004C5 - KEY_kana_NI* = 0x000004C6 - KEY_kana_NU* = 0x000004C7 - KEY_kana_NE* = 0x000004C8 - KEY_kana_NO* = 0x000004C9 - KEY_kana_HA* = 0x000004CA - KEY_kana_HI* = 0x000004CB - KEY_kana_FU* = 0x000004CC - KEY_kana_HU* = 0x000004CC - KEY_kana_HE* = 0x000004CD - KEY_kana_HO* = 0x000004CE - KEY_kana_MA* = 0x000004CF - KEY_kana_MI* = 0x000004D0 - KEY_kana_MU* = 0x000004D1 - KEY_kana_ME* = 0x000004D2 - KEY_kana_MO* = 0x000004D3 - KEY_kana_CAPITAL_YA* = 0x000004D4 - KEY_kana_CAPITAL_YU* = 0x000004D5 - KEY_kana_CAPITAL_YO* = 0x000004D6 - KEY_kana_RA* = 0x000004D7 - KEY_kana_RI* = 0x000004D8 - KEY_kana_RU* = 0x000004D9 - KEY_kana_RE* = 0x000004DA - KEY_kana_RO* = 0x000004DB - KEY_kana_WA* = 0x000004DC - KEY_kana_N* = 0x000004DD - KEY_voicedsound* = 0x000004DE - KEY_semivoicedsound* = 0x000004DF - KEY_kana_switch* = 0x0000FF7E - KEY_Arabic_comma* = 0x000005AC - KEY_Arabic_semicolon* = 0x000005BB - KEY_Arabic_question_mark* = 0x000005BF - KEY_Arabic_hamza* = 0x000005C1 - KEY_Arabic_maddaonalef* = 0x000005C2 - KEY_Arabic_hamzaonalef* = 0x000005C3 - KEY_Arabic_hamzaonwaw* = 0x000005C4 - KEY_Arabic_hamzaunderalef* = 0x000005C5 - KEY_Arabic_hamzaonyeh* = 0x000005C6 - KEY_Arabic_alef* = 0x000005C7 - KEY_Arabic_beh* = 0x000005C8 - KEY_Arabic_tehmarbuta* = 0x000005C9 - KEY_Arabic_teh* = 0x000005CA - KEY_Arabic_theh* = 0x000005CB - KEY_Arabic_jeem* = 0x000005CC - KEY_Arabic_hah* = 0x000005CD - KEY_Arabic_khah* = 0x000005CE - KEY_Arabic_dal* = 0x000005CF - KEY_Arabic_thal* = 0x000005D0 - KEY_Arabic_ra* = 0x000005D1 - KEY_Arabic_zain* = 0x000005D2 - KEY_Arabic_seen* = 0x000005D3 - KEY_Arabic_sheen* = 0x000005D4 - KEY_Arabic_sad* = 0x000005D5 - KEY_Arabic_dad* = 0x000005D6 - KEY_Arabic_tah* = 0x000005D7 - KEY_Arabic_zah* = 0x000005D8 - KEY_Arabic_ain* = 0x000005D9 - KEY_Arabic_ghain* = 0x000005DA - KEY_Arabic_tatweel* = 0x000005E0 - KEY_Arabic_feh* = 0x000005E1 - KEY_Arabic_qaf* = 0x000005E2 - KEY_Arabic_kaf* = 0x000005E3 - KEY_Arabic_lam* = 0x000005E4 - KEY_Arabic_meem* = 0x000005E5 - KEY_Arabic_noon* = 0x000005E6 - KEY_Arabic_ha* = 0x000005E7 - KEY_Arabic_heh* = 0x000005E7 - KEY_Arabic_waw* = 0x000005E8 - KEY_Arabic_alefmaksura* = 0x000005E9 - KEY_Arabic_yeh* = 0x000005EA - KEY_Arabic_fathatan* = 0x000005EB - KEY_Arabic_dammatan* = 0x000005EC - KEY_Arabic_kasratan* = 0x000005ED - KEY_Arabic_fatha* = 0x000005EE - KEY_Arabic_damma* = 0x000005EF - KEY_Arabic_kasra* = 0x000005F0 - KEY_Arabic_shadda* = 0x000005F1 - KEY_Arabic_sukun* = 0x000005F2 - KEY_Arabic_switch* = 0x0000FF7E - KEY_Serbian_dje* = 0x000006A1 - KEY_Macedonia_gje* = 0x000006A2 - KEY_Cyrillic_io* = 0x000006A3 - KEY_Ukrainian_ie* = 0x000006A4 - KEY_Ukranian_je* = 0x000006A4 - KEY_Macedonia_dse* = 0x000006A5 - KEY_Ukrainian_i* = 0x000006A6 - KEY_Ukranian_i* = 0x000006A6 - KEY_Ukrainian_yi* = 0x000006A7 - KEY_Ukranian_yi* = 0x000006A7 - KEY_Cyrillic_je* = 0x000006A8 - KEY_Serbian_je* = 0x000006A8 - KEY_Cyrillic_lje* = 0x000006A9 - KEY_Serbian_lje* = 0x000006A9 - KEY_Cyrillic_nje* = 0x000006AA - KEY_Serbian_nje* = 0x000006AA - KEY_Serbian_tshe* = 0x000006AB - KEY_Macedonia_kje* = 0x000006AC - KEY_Byelorussian_shortu* = 0x000006AE - KEY_Cyrillic_dzhe* = 0x000006AF - KEY_Serbian_dze* = 0x000006AF - KEY_numerosign* = 0x000006B0 - KEY_Serbian_CAPITAL_DJE* = 0x000006B1 - KEY_Macedonia_CAPITAL_GJE* = 0x000006B2 - KEY_Cyrillic_CAPITAL_IO* = 0x000006B3 - KEY_Ukrainian_CAPITAL_IE* = 0x000006B4 - KEY_Ukranian_CAPITAL_JE* = 0x000006B4 - KEY_Macedonia_CAPITAL_DSE* = 0x000006B5 - KEY_Ukrainian_CAPITAL_I* = 0x000006B6 - KEY_Ukranian_CAPITAL_I* = 0x000006B6 - KEY_Ukrainian_CAPITAL_YI* = 0x000006B7 - KEY_Ukranian_CAPITAL_YI* = 0x000006B7 - KEY_Cyrillic_CAPITAL_JE* = 0x000006B8 - KEY_Serbian_CAPITAL_JE* = 0x000006B8 - KEY_Cyrillic_CAPITAL_LJE* = 0x000006B9 - KEY_Serbian_CAPITAL_LJE* = 0x000006B9 - KEY_Cyrillic_CAPITAL_NJE* = 0x000006BA - KEY_Serbian_CAPITAL_NJE* = 0x000006BA - KEY_Serbian_CAPITAL_TSHE* = 0x000006BB - KEY_Macedonia_CAPITAL_KJE* = 0x000006BC - KEY_Byelorussian_CAPITAL_SHORTU* = 0x000006BE - KEY_Cyrillic_CAPITAL_DZHE* = 0x000006BF - KEY_Serbian_CAPITAL_DZE* = 0x000006BF - KEY_Cyrillic_yu* = 0x000006C0 - KEY_Cyrillic_a* = 0x000006C1 - KEY_Cyrillic_be* = 0x000006C2 - KEY_Cyrillic_tse* = 0x000006C3 - KEY_Cyrillic_de* = 0x000006C4 - KEY_Cyrillic_ie* = 0x000006C5 - KEY_Cyrillic_ef* = 0x000006C6 - KEY_Cyrillic_ghe* = 0x000006C7 - KEY_Cyrillic_ha* = 0x000006C8 - KEY_Cyrillic_i* = 0x000006C9 - KEY_Cyrillic_shorti* = 0x000006CA - KEY_Cyrillic_ka* = 0x000006CB - KEY_Cyrillic_el* = 0x000006CC - KEY_Cyrillic_em* = 0x000006CD - KEY_Cyrillic_en* = 0x000006CE - KEY_Cyrillic_o* = 0x000006CF - KEY_Cyrillic_pe* = 0x000006D0 - KEY_Cyrillic_ya* = 0x000006D1 - KEY_Cyrillic_er* = 0x000006D2 - KEY_Cyrillic_es* = 0x000006D3 - KEY_Cyrillic_te* = 0x000006D4 - KEY_Cyrillic_u* = 0x000006D5 - KEY_Cyrillic_zhe* = 0x000006D6 - KEY_Cyrillic_ve* = 0x000006D7 - KEY_Cyrillic_softsign* = 0x000006D8 - KEY_Cyrillic_yeru* = 0x000006D9 - KEY_Cyrillic_ze* = 0x000006DA - KEY_Cyrillic_sha* = 0x000006DB - KEY_Cyrillic_e* = 0x000006DC - KEY_Cyrillic_shcha* = 0x000006DD - KEY_Cyrillic_che* = 0x000006DE - KEY_Cyrillic_hardsign* = 0x000006DF - KEY_Cyrillic_CAPITAL_YU* = 0x000006E0 - KEY_Cyrillic_CAPITAL_A* = 0x000006E1 - KEY_Cyrillic_CAPITAL_BE* = 0x000006E2 - KEY_Cyrillic_CAPITAL_TSE* = 0x000006E3 - KEY_Cyrillic_CAPITAL_DE* = 0x000006E4 - KEY_Cyrillic_CAPITAL_IE* = 0x000006E5 - KEY_Cyrillic_CAPITAL_EF* = 0x000006E6 - KEY_Cyrillic_CAPITAL_GHE* = 0x000006E7 - KEY_Cyrillic_CAPITAL_HA* = 0x000006E8 - KEY_Cyrillic_CAPITAL_I* = 0x000006E9 - KEY_Cyrillic_CAPITAL_SHORTI* = 0x000006EA - KEY_Cyrillic_CAPITAL_KA* = 0x000006EB - KEY_Cyrillic_CAPITAL_EL* = 0x000006EC - KEY_Cyrillic_CAPITAL_EM* = 0x000006ED - KEY_Cyrillic_CAPITAL_EN* = 0x000006EE - KEY_Cyrillic_CAPITAL_O* = 0x000006EF - KEY_Cyrillic_CAPITAL_PE* = 0x000006F0 - KEY_Cyrillic_CAPITAL_YA* = 0x000006F1 - KEY_Cyrillic_CAPITAL_ER* = 0x000006F2 - KEY_Cyrillic_CAPITAL_ES* = 0x000006F3 - KEY_Cyrillic_CAPITAL_TE* = 0x000006F4 - KEY_Cyrillic_CAPITAL_U* = 0x000006F5 - KEY_Cyrillic_CAPITAL_ZHE* = 0x000006F6 - KEY_Cyrillic_CAPITAL_VE* = 0x000006F7 - KEY_Cyrillic_CAPITAL_SOFTSIGN* = 0x000006F8 - KEY_Cyrillic_CAPITAL_YERU* = 0x000006F9 - KEY_Cyrillic_CAPITAL_ZE* = 0x000006FA - KEY_Cyrillic_CAPITAL_SHA* = 0x000006FB - KEY_Cyrillic_CAPITAL_E* = 0x000006FC - KEY_Cyrillic_CAPITAL_SHCHA* = 0x000006FD - KEY_Cyrillic_CAPITAL_CHE* = 0x000006FE - KEY_Cyrillic_CAPITAL_HARDSIGN* = 0x000006FF - KEY_Greek_CAPITAL_ALPHAaccent* = 0x000007A1 - KEY_Greek_CAPITAL_EPSILONaccent* = 0x000007A2 - KEY_Greek_CAPITAL_ETAaccent* = 0x000007A3 - KEY_Greek_CAPITAL_IOTAaccent* = 0x000007A4 - KEY_Greek_CAPITAL_IOTAdiaeresis* = 0x000007A5 - KEY_Greek_CAPITAL_OMICRONaccent* = 0x000007A7 - KEY_Greek_CAPITAL_UPSILONaccent* = 0x000007A8 - KEY_Greek_CAPITAL_UPSILONdieresis* = 0x000007A9 - KEY_Greek_CAPITAL_OMEGAaccent* = 0x000007AB - KEY_Greek_accentdieresis* = 0x000007AE - KEY_Greek_horizbar* = 0x000007AF - KEY_Greek_alphaaccent* = 0x000007B1 - KEY_Greek_epsilonaccent* = 0x000007B2 - KEY_Greek_etaaccent* = 0x000007B3 - KEY_Greek_iotaaccent* = 0x000007B4 - KEY_Greek_iotadieresis* = 0x000007B5 - KEY_Greek_iotaaccentdieresis* = 0x000007B6 - KEY_Greek_omicronaccent* = 0x000007B7 - KEY_Greek_upsilonaccent* = 0x000007B8 - KEY_Greek_upsilondieresis* = 0x000007B9 - KEY_Greek_upsilonaccentdieresis* = 0x000007BA - KEY_Greek_omegaaccent* = 0x000007BB - KEY_Greek_CAPITAL_ALPHA* = 0x000007C1 - KEY_Greek_CAPITAL_BETA* = 0x000007C2 - KEY_Greek_CAPITAL_GAMMA* = 0x000007C3 - KEY_Greek_CAPITAL_DELTA* = 0x000007C4 - KEY_Greek_CAPITAL_EPSILON* = 0x000007C5 - KEY_Greek_CAPITAL_ZETA* = 0x000007C6 - KEY_Greek_CAPITAL_ETA* = 0x000007C7 - KEY_Greek_CAPITAL_THETA* = 0x000007C8 - KEY_Greek_CAPITAL_IOTA* = 0x000007C9 - KEY_Greek_CAPITAL_KAPPA* = 0x000007CA - KEY_Greek_CAPITAL_LAMDA* = 0x000007CB - KEY_Greek_CAPITAL_LAMBDA* = 0x000007CB - KEY_Greek_CAPITAL_MU* = 0x000007CC - KEY_Greek_CAPITAL_NU* = 0x000007CD - KEY_Greek_CAPITAL_XI* = 0x000007CE - KEY_Greek_CAPITAL_OMICRON* = 0x000007CF - KEY_Greek_CAPITAL_PI* = 0x000007D0 - KEY_Greek_CAPITAL_RHO* = 0x000007D1 - KEY_Greek_CAPITAL_SIGMA* = 0x000007D2 - KEY_Greek_CAPITAL_TAU* = 0x000007D4 - KEY_Greek_CAPITAL_UPSILON* = 0x000007D5 - KEY_Greek_CAPITAL_PHI* = 0x000007D6 - KEY_Greek_CAPITAL_CHI* = 0x000007D7 - KEY_Greek_CAPITAL_PSI* = 0x000007D8 - KEY_Greek_CAPITAL_OMEGA* = 0x000007D9 - KEY_Greek_alpha* = 0x000007E1 - KEY_Greek_beta* = 0x000007E2 - KEY_Greek_gamma* = 0x000007E3 - KEY_Greek_delta* = 0x000007E4 - KEY_Greek_epsilon* = 0x000007E5 - KEY_Greek_zeta* = 0x000007E6 - KEY_Greek_eta* = 0x000007E7 - KEY_Greek_theta* = 0x000007E8 - KEY_Greek_iota* = 0x000007E9 - KEY_Greek_kappa* = 0x000007EA - KEY_Greek_lamda* = 0x000007EB - KEY_Greek_lambda* = 0x000007EB - KEY_Greek_mu* = 0x000007EC - KEY_Greek_nu* = 0x000007ED - KEY_Greek_xi* = 0x000007EE - KEY_Greek_omicron* = 0x000007EF - KEY_Greek_pi* = 0x000007F0 - KEY_Greek_rho* = 0x000007F1 - KEY_Greek_sigma* = 0x000007F2 - KEY_Greek_finalsmallsigma* = 0x000007F3 - KEY_Greek_tau* = 0x000007F4 - KEY_Greek_upsilon* = 0x000007F5 - KEY_Greek_phi* = 0x000007F6 - KEY_Greek_chi* = 0x000007F7 - KEY_Greek_psi* = 0x000007F8 - KEY_Greek_omega* = 0x000007F9 - KEY_Greek_switch* = 0x0000FF7E - KEY_leftradical* = 0x000008A1 - KEY_topleftradical* = 0x000008A2 - KEY_horizconnector* = 0x000008A3 - KEY_topintegral* = 0x000008A4 - KEY_botintegral* = 0x000008A5 - KEY_vertconnector* = 0x000008A6 - KEY_topleftsqbracket* = 0x000008A7 - KEY_botleftsqbracket* = 0x000008A8 - KEY_toprightsqbracket* = 0x000008A9 - KEY_botrightsqbracket* = 0x000008AA - KEY_topleftparens* = 0x000008AB - KEY_botleftparens* = 0x000008AC - KEY_toprightparens* = 0x000008AD - KEY_botrightparens* = 0x000008AE - KEY_leftmiddlecurlybrace* = 0x000008AF - KEY_rightmiddlecurlybrace* = 0x000008B0 - KEY_topleftsummation* = 0x000008B1 - KEY_botleftsummation* = 0x000008B2 - KEY_topvertsummationconnector* = 0x000008B3 - KEY_botvertsummationconnector* = 0x000008B4 - KEY_toprightsummation* = 0x000008B5 - KEY_botrightsummation* = 0x000008B6 - KEY_rightmiddlesummation* = 0x000008B7 - KEY_lessthanequal* = 0x000008BC - KEY_notequal* = 0x000008BD - KEY_greaterthanequal* = 0x000008BE - KEY_integral* = 0x000008BF - KEY_therefore* = 0x000008C0 - KEY_variation* = 0x000008C1 - KEY_infinity* = 0x000008C2 - KEY_nabla* = 0x000008C5 - KEY_approximate* = 0x000008C8 - KEY_similarequal* = 0x000008C9 - KEY_ifonlyif* = 0x000008CD - KEY_implies* = 0x000008CE - KEY_identical* = 0x000008CF - KEY_radical* = 0x000008D6 - KEY_includedin* = 0x000008DA - KEY_includes* = 0x000008DB - KEY_intersection* = 0x000008DC - KEY_union* = 0x000008DD - KEY_logicaland* = 0x000008DE - KEY_logicalor* = 0x000008DF - KEY_partialderivative* = 0x000008EF - KEY_function* = 0x000008F6 - KEY_leftarrow* = 0x000008FB - KEY_uparrow* = 0x000008FC - KEY_rightarrow* = 0x000008FD - KEY_downarrow* = 0x000008FE - KEY_blank* = 0x000009DF - KEY_soliddiamond* = 0x000009E0 - KEY_checkerboard* = 0x000009E1 - KEY_ht* = 0x000009E2 - KEY_ff* = 0x000009E3 - KEY_cr* = 0x000009E4 - KEY_lf* = 0x000009E5 - KEY_nl* = 0x000009E8 - KEY_vt* = 0x000009E9 - KEY_lowrightcorner* = 0x000009EA - KEY_uprightcorner* = 0x000009EB - KEY_upleftcorner* = 0x000009EC - KEY_lowleftcorner* = 0x000009ED - KEY_crossinglines* = 0x000009EE - KEY_horizlinescan1* = 0x000009EF - KEY_horizlinescan3* = 0x000009F0 - KEY_horizlinescan5* = 0x000009F1 - KEY_horizlinescan7* = 0x000009F2 - KEY_horizlinescan9* = 0x000009F3 - KEY_leftt* = 0x000009F4 - KEY_rightt* = 0x000009F5 - KEY_bott* = 0x000009F6 - KEY_topt* = 0x000009F7 - KEY_vertbar* = 0x000009F8 - KEY_emspace* = 0x00000AA1 - KEY_enspace* = 0x00000AA2 - KEY_em3space* = 0x00000AA3 - KEY_em4space* = 0x00000AA4 - KEY_digitspace* = 0x00000AA5 - KEY_punctspace* = 0x00000AA6 - KEY_thinspace* = 0x00000AA7 - KEY_hairspace* = 0x00000AA8 - KEY_emdash* = 0x00000AA9 - KEY_endash* = 0x00000AAA - KEY_signifblank* = 0x00000AAC - KEY_ellipsis* = 0x00000AAE - KEY_doubbaselinedot* = 0x00000AAF - KEY_onethird* = 0x00000AB0 - KEY_twothirds* = 0x00000AB1 - KEY_onefifth* = 0x00000AB2 - KEY_twofifths* = 0x00000AB3 - KEY_threefifths* = 0x00000AB4 - KEY_fourfifths* = 0x00000AB5 - KEY_onesixth* = 0x00000AB6 - KEY_fivesixths* = 0x00000AB7 - KEY_careof* = 0x00000AB8 - KEY_figdash* = 0x00000ABB - KEY_leftanglebracket* = 0x00000ABC - KEY_decimalpoint* = 0x00000ABD - KEY_rightanglebracket* = 0x00000ABE - KEY_marker* = 0x00000ABF - KEY_oneeighth* = 0x00000AC3 - KEY_threeeighths* = 0x00000AC4 - KEY_fiveeighths* = 0x00000AC5 - KEY_seveneighths* = 0x00000AC6 - KEY_trademark* = 0x00000AC9 - KEY_signaturemark* = 0x00000ACA - KEY_trademarkincircle* = 0x00000ACB - KEY_leftopentriangle* = 0x00000ACC - KEY_rightopentriangle* = 0x00000ACD - KEY_emopencircle* = 0x00000ACE - KEY_emopenrectangle* = 0x00000ACF - KEY_leftsinglequotemark* = 0x00000AD0 - KEY_rightsinglequotemark* = 0x00000AD1 - KEY_leftdoublequotemark* = 0x00000AD2 - KEY_rightdoublequotemark* = 0x00000AD3 - KEY_prescription* = 0x00000AD4 - KEY_minutes* = 0x00000AD6 - KEY_seconds* = 0x00000AD7 - KEY_latincross* = 0x00000AD9 - KEY_hexagram* = 0x00000ADA - KEY_filledrectbullet* = 0x00000ADB - KEY_filledlefttribullet* = 0x00000ADC - KEY_filledrighttribullet* = 0x00000ADD - KEY_emfilledcircle* = 0x00000ADE - KEY_emfilledrect* = 0x00000ADF - KEY_enopencircbullet* = 0x00000AE0 - KEY_enopensquarebullet* = 0x00000AE1 - KEY_openrectbullet* = 0x00000AE2 - KEY_opentribulletup* = 0x00000AE3 - KEY_opentribulletdown* = 0x00000AE4 - KEY_openstar* = 0x00000AE5 - KEY_enfilledcircbullet* = 0x00000AE6 - KEY_enfilledsqbullet* = 0x00000AE7 - KEY_filledtribulletup* = 0x00000AE8 - KEY_filledtribulletdown* = 0x00000AE9 - KEY_leftpointer* = 0x00000AEA - KEY_rightpointer* = 0x00000AEB - KEY_club* = 0x00000AEC - KEY_diamond* = 0x00000AED - KEY_heart* = 0x00000AEE - KEY_maltesecross* = 0x00000AF0 - KEY_dagger* = 0x00000AF1 - KEY_doubledagger* = 0x00000AF2 - KEY_checkmark* = 0x00000AF3 - KEY_ballotcross* = 0x00000AF4 - KEY_musicalsharp* = 0x00000AF5 - KEY_musicalflat* = 0x00000AF6 - KEY_malesymbol* = 0x00000AF7 - KEY_femalesymbol* = 0x00000AF8 - KEY_telephone* = 0x00000AF9 - KEY_telephonerecorder* = 0x00000AFA - KEY_phonographcopyright* = 0x00000AFB - KEY_caret* = 0x00000AFC - KEY_singlelowquotemark* = 0x00000AFD - KEY_doublelowquotemark* = 0x00000AFE - KEY_cursor* = 0x00000AFF - KEY_leftcaret* = 0x00000BA3 - KEY_rightcaret* = 0x00000BA6 - KEY_downcaret* = 0x00000BA8 - KEY_upcaret* = 0x00000BA9 - KEY_overbar* = 0x00000BC0 - KEY_downtack* = 0x00000BC2 - KEY_upshoe* = 0x00000BC3 - KEY_downstile* = 0x00000BC4 - KEY_underbar* = 0x00000BC6 - KEY_jot* = 0x00000BCA - KEY_quad* = 0x00000BCC - KEY_uptack* = 0x00000BCE - KEY_circle* = 0x00000BCF - KEY_upstile* = 0x00000BD3 - KEY_downshoe* = 0x00000BD6 - KEY_rightshoe* = 0x00000BD8 - KEY_leftshoe* = 0x00000BDA - KEY_lefttack* = 0x00000BDC - KEY_righttack* = 0x00000BFC - KEY_hebrew_doublelowline* = 0x00000CDF - KEY_hebrew_aleph* = 0x00000CE0 - KEY_hebrew_bet* = 0x00000CE1 - KEY_hebrew_beth* = 0x00000CE1 - KEY_hebrew_gimel* = 0x00000CE2 - KEY_hebrew_gimmel* = 0x00000CE2 - KEY_hebrew_dalet* = 0x00000CE3 - KEY_hebrew_daleth* = 0x00000CE3 - KEY_hebrew_he* = 0x00000CE4 - KEY_hebrew_waw* = 0x00000CE5 - KEY_hebrew_zain* = 0x00000CE6 - KEY_hebrew_zayin* = 0x00000CE6 - KEY_hebrew_chet* = 0x00000CE7 - KEY_hebrew_het* = 0x00000CE7 - KEY_hebrew_tet* = 0x00000CE8 - KEY_hebrew_teth* = 0x00000CE8 - KEY_hebrew_yod* = 0x00000CE9 - KEY_hebrew_finalkaph* = 0x00000CEA - KEY_hebrew_kaph* = 0x00000CEB - KEY_hebrew_lamed* = 0x00000CEC - KEY_hebrew_finalmem* = 0x00000CED - KEY_hebrew_mem* = 0x00000CEE - KEY_hebrew_finalnun* = 0x00000CEF - KEY_hebrew_nun* = 0x00000CF0 - KEY_hebrew_samech* = 0x00000CF1 - KEY_hebrew_samekh* = 0x00000CF1 - KEY_hebrew_ayin* = 0x00000CF2 - KEY_hebrew_finalpe* = 0x00000CF3 - KEY_hebrew_pe* = 0x00000CF4 - KEY_hebrew_finalzade* = 0x00000CF5 - KEY_hebrew_finalzadi* = 0x00000CF5 - KEY_hebrew_zade* = 0x00000CF6 - KEY_hebrew_zadi* = 0x00000CF6 - KEY_hebrew_qoph* = 0x00000CF7 - KEY_hebrew_kuf* = 0x00000CF7 - KEY_hebrew_resh* = 0x00000CF8 - KEY_hebrew_shin* = 0x00000CF9 - KEY_hebrew_taw* = 0x00000CFA - KEY_hebrew_taf* = 0x00000CFA - KEY_Hebrew_switch* = 0x0000FF7E - KEY_Thai_kokai* = 0x00000DA1 - KEY_Thai_khokhai* = 0x00000DA2 - KEY_Thai_khokhuat* = 0x00000DA3 - KEY_Thai_khokhwai* = 0x00000DA4 - KEY_Thai_khokhon* = 0x00000DA5 - KEY_Thai_khorakhang* = 0x00000DA6 - KEY_Thai_ngongu* = 0x00000DA7 - KEY_Thai_chochan* = 0x00000DA8 - KEY_Thai_choching* = 0x00000DA9 - KEY_Thai_chochang* = 0x00000DAA - KEY_Thai_soso* = 0x00000DAB - KEY_Thai_chochoe* = 0x00000DAC - KEY_Thai_yoying* = 0x00000DAD - KEY_Thai_dochada* = 0x00000DAE - KEY_Thai_topatak* = 0x00000DAF - KEY_Thai_thothan* = 0x00000DB0 - KEY_Thai_thonangmontho* = 0x00000DB1 - KEY_Thai_thophuthao* = 0x00000DB2 - KEY_Thai_nonen* = 0x00000DB3 - KEY_Thai_dodek* = 0x00000DB4 - KEY_Thai_totao* = 0x00000DB5 - KEY_Thai_thothung* = 0x00000DB6 - KEY_Thai_thothahan* = 0x00000DB7 - KEY_Thai_thothong* = 0x00000DB8 - KEY_Thai_nonu* = 0x00000DB9 - KEY_Thai_bobaimai* = 0x00000DBA - KEY_Thai_popla* = 0x00000DBB - KEY_Thai_phophung* = 0x00000DBC - KEY_Thai_fofa* = 0x00000DBD - KEY_Thai_phophan* = 0x00000DBE - KEY_Thai_fofan* = 0x00000DBF - KEY_Thai_phosamphao* = 0x00000DC0 - KEY_Thai_moma* = 0x00000DC1 - KEY_Thai_yoyak* = 0x00000DC2 - KEY_Thai_rorua* = 0x00000DC3 - KEY_Thai_ru* = 0x00000DC4 - KEY_Thai_loling* = 0x00000DC5 - KEY_Thai_lu* = 0x00000DC6 - KEY_Thai_wowaen* = 0x00000DC7 - KEY_Thai_sosala* = 0x00000DC8 - KEY_Thai_sorusi* = 0x00000DC9 - KEY_Thai_sosua* = 0x00000DCA - KEY_Thai_hohip* = 0x00000DCB - KEY_Thai_lochula* = 0x00000DCC - KEY_Thai_oang* = 0x00000DCD - KEY_Thai_honokhuk* = 0x00000DCE - KEY_Thai_paiyannoi* = 0x00000DCF - KEY_Thai_saraa* = 0x00000DD0 - KEY_Thai_maihanakat* = 0x00000DD1 - KEY_Thai_saraaa* = 0x00000DD2 - KEY_Thai_saraam* = 0x00000DD3 - KEY_Thai_sarai* = 0x00000DD4 - KEY_Thai_saraii* = 0x00000DD5 - KEY_Thai_saraue* = 0x00000DD6 - KEY_Thai_sarauee* = 0x00000DD7 - KEY_Thai_sarau* = 0x00000DD8 - KEY_Thai_sarauu* = 0x00000DD9 - KEY_Thai_phinthu* = 0x00000DDA - KEY_Thai_maihanakat_maitho* = 0x00000DDE - KEY_Thai_baht* = 0x00000DDF - KEY_Thai_sarae* = 0x00000DE0 - KEY_Thai_saraae* = 0x00000DE1 - KEY_Thai_sarao* = 0x00000DE2 - KEY_Thai_saraaimaimuan* = 0x00000DE3 - KEY_Thai_saraaimaimalai* = 0x00000DE4 - KEY_Thai_lakkhangyao* = 0x00000DE5 - KEY_Thai_maiyamok* = 0x00000DE6 - KEY_Thai_maitaikhu* = 0x00000DE7 - KEY_Thai_maiek* = 0x00000DE8 - KEY_Thai_maitho* = 0x00000DE9 - KEY_Thai_maitri* = 0x00000DEA - KEY_Thai_maichattawa* = 0x00000DEB - KEY_Thai_thanthakhat* = 0x00000DEC - KEY_Thai_nikhahit* = 0x00000DED - KEY_Thai_leksun* = 0x00000DF0 - KEY_Thai_leknung* = 0x00000DF1 - KEY_Thai_leksong* = 0x00000DF2 - KEY_Thai_leksam* = 0x00000DF3 - KEY_Thai_leksi* = 0x00000DF4 - KEY_Thai_lekha* = 0x00000DF5 - KEY_Thai_lekhok* = 0x00000DF6 - KEY_Thai_lekchet* = 0x00000DF7 - KEY_Thai_lekpaet* = 0x00000DF8 - KEY_Thai_lekkao* = 0x00000DF9 - KEY_Hangul* = 0x0000FF31 - KEY_Hangul_Start* = 0x0000FF32 - KEY_Hangul_End* = 0x0000FF33 - KEY_Hangul_Hanja* = 0x0000FF34 - KEY_Hangul_Jamo* = 0x0000FF35 - KEY_Hangul_Romaja* = 0x0000FF36 - KEY_Hangul_Codeinput* = 0x0000FF37 - KEY_Hangul_Jeonja* = 0x0000FF38 - KEY_Hangul_Banja* = 0x0000FF39 - KEY_Hangul_PreHanja* = 0x0000FF3A - KEY_Hangul_PostHanja* = 0x0000FF3B - KEY_Hangul_SingleCandidate* = 0x0000FF3C - KEY_Hangul_MultipleCandidate* = 0x0000FF3D - KEY_Hangul_PreviousCandidate* = 0x0000FF3E - KEY_Hangul_Special* = 0x0000FF3F - KEY_Hangul_switch* = 0x0000FF7E - KEY_Hangul_Kiyeog* = 0x00000EA1 - KEY_Hangul_SsangKiyeog* = 0x00000EA2 - KEY_Hangul_KiyeogSios* = 0x00000EA3 - KEY_Hangul_Nieun* = 0x00000EA4 - KEY_Hangul_NieunJieuj* = 0x00000EA5 - KEY_Hangul_NieunHieuh* = 0x00000EA6 - KEY_Hangul_Dikeud* = 0x00000EA7 - KEY_Hangul_SsangDikeud* = 0x00000EA8 - KEY_Hangul_Rieul* = 0x00000EA9 - KEY_Hangul_RieulKiyeog* = 0x00000EAA - KEY_Hangul_RieulMieum* = 0x00000EAB - KEY_Hangul_RieulPieub* = 0x00000EAC - KEY_Hangul_RieulSios* = 0x00000EAD - KEY_Hangul_RieulTieut* = 0x00000EAE - KEY_Hangul_RieulPhieuf* = 0x00000EAF - KEY_Hangul_RieulHieuh* = 0x00000EB0 - KEY_Hangul_Mieum* = 0x00000EB1 - KEY_Hangul_Pieub* = 0x00000EB2 - KEY_Hangul_SsangPieub* = 0x00000EB3 - KEY_Hangul_PieubSios* = 0x00000EB4 - KEY_Hangul_Sios* = 0x00000EB5 - KEY_Hangul_SsangSios* = 0x00000EB6 - KEY_Hangul_Ieung* = 0x00000EB7 - KEY_Hangul_Jieuj* = 0x00000EB8 - KEY_Hangul_SsangJieuj* = 0x00000EB9 - KEY_Hangul_Cieuc* = 0x00000EBA - KEY_Hangul_Khieuq* = 0x00000EBB - KEY_Hangul_Tieut* = 0x00000EBC - KEY_Hangul_Phieuf* = 0x00000EBD - KEY_Hangul_Hieuh* = 0x00000EBE - KEY_Hangul_A* = 0x00000EBF - KEY_Hangul_AE* = 0x00000EC0 - KEY_Hangul_YA* = 0x00000EC1 - KEY_Hangul_YAE* = 0x00000EC2 - KEY_Hangul_EO* = 0x00000EC3 - KEY_Hangul_E* = 0x00000EC4 - KEY_Hangul_YEO* = 0x00000EC5 - KEY_Hangul_YE* = 0x00000EC6 - KEY_Hangul_O* = 0x00000EC7 - KEY_Hangul_WA* = 0x00000EC8 - KEY_Hangul_WAE* = 0x00000EC9 - KEY_Hangul_OE* = 0x00000ECA - KEY_Hangul_YO* = 0x00000ECB - KEY_Hangul_U* = 0x00000ECC - KEY_Hangul_WEO* = 0x00000ECD - KEY_Hangul_WE* = 0x00000ECE - KEY_Hangul_WI* = 0x00000ECF - KEY_Hangul_YU* = 0x00000ED0 - KEY_Hangul_EU* = 0x00000ED1 - KEY_Hangul_YI* = 0x00000ED2 - KEY_Hangul_I* = 0x00000ED3 - KEY_Hangul_J_Kiyeog* = 0x00000ED4 - KEY_Hangul_J_SsangKiyeog* = 0x00000ED5 - KEY_Hangul_J_KiyeogSios* = 0x00000ED6 - KEY_Hangul_J_Nieun* = 0x00000ED7 - KEY_Hangul_J_NieunJieuj* = 0x00000ED8 - KEY_Hangul_J_NieunHieuh* = 0x00000ED9 - KEY_Hangul_J_Dikeud* = 0x00000EDA - KEY_Hangul_J_Rieul* = 0x00000EDB - KEY_Hangul_J_RieulKiyeog* = 0x00000EDC - KEY_Hangul_J_RieulMieum* = 0x00000EDD - KEY_Hangul_J_RieulPieub* = 0x00000EDE - KEY_Hangul_J_RieulSios* = 0x00000EDF - KEY_Hangul_J_RieulTieut* = 0x00000EE0 - KEY_Hangul_J_RieulPhieuf* = 0x00000EE1 - KEY_Hangul_J_RieulHieuh* = 0x00000EE2 - KEY_Hangul_J_Mieum* = 0x00000EE3 - KEY_Hangul_J_Pieub* = 0x00000EE4 - KEY_Hangul_J_PieubSios* = 0x00000EE5 - KEY_Hangul_J_Sios* = 0x00000EE6 - KEY_Hangul_J_SsangSios* = 0x00000EE7 - KEY_Hangul_J_Ieung* = 0x00000EE8 - KEY_Hangul_J_Jieuj* = 0x00000EE9 - KEY_Hangul_J_Cieuc* = 0x00000EEA - KEY_Hangul_J_Khieuq* = 0x00000EEB - KEY_Hangul_J_Tieut* = 0x00000EEC - KEY_Hangul_J_Phieuf* = 0x00000EED - KEY_Hangul_J_Hieuh* = 0x00000EEE - KEY_Hangul_RieulYeorinHieuh* = 0x00000EEF - KEY_Hangul_SunkyeongeumMieum* = 0x00000EF0 - KEY_Hangul_SunkyeongeumPieub* = 0x00000EF1 - KEY_Hangul_PanSios* = 0x00000EF2 - KEY_Hangul_KkogjiDalrinIeung* = 0x00000EF3 - KEY_Hangul_SunkyeongeumPhieuf* = 0x00000EF4 - KEY_Hangul_YeorinHieuh* = 0x00000EF5 - KEY_Hangul_AraeA* = 0x00000EF6 - KEY_Hangul_AraeAE* = 0x00000EF7 - KEY_Hangul_J_PanSios* = 0x00000EF8 - KEY_Hangul_J_KkogjiDalrinIeung* = 0x00000EF9 - KEY_Hangul_J_YeorinHieuh* = 0x00000EFA - KEY_Korean_Won* = 0x00000EFF - KEY_EcuSign* = 0x000020A0 - KEY_ColonSign* = 0x000020A1 - KEY_CruzeiroSign* = 0x000020A2 - KEY_FFrancSign* = 0x000020A3 - KEY_LiraSign* = 0x000020A4 - KEY_MillSign* = 0x000020A5 - KEY_NairaSign* = 0x000020A6 - KEY_PesetaSign* = 0x000020A7 - KEY_RupeeSign* = 0x000020A8 - KEY_WonSign* = 0x000020A9 - KEY_NewSheqelSign* = 0x000020AA - KEY_DongSign* = 0x000020AB - KEY_EuroSign* = 0x000020AC - -proc pango_context_get_for_screen*(screen: PScreen): PContext{.cdecl, - dynlib: lib, importc: "gdk_pango_context_get_for_screen".} -proc pango_context_set_colormap*(context: PContext, colormap: PColormap){. - cdecl, dynlib: lib, importc: "gdk_pango_context_set_colormap".} -proc pango_layout_line_get_clip_region*(line: PLayoutLine, x_origin: gint, - y_origin: gint, index_ranges: Pgint, - n_ranges: gint): PRegion{.cdecl, - dynlib: lib, importc: "gdk_pango_layout_line_get_clip_region".} -proc pango_layout_get_clip_region*(layout: PLayout, x_origin: gint, - y_origin: gint, index_ranges: Pgint, - n_ranges: gint): PRegion{.cdecl, dynlib: lib, - importc: "gdk_pango_layout_get_clip_region".} -proc pango_attr_stipple_new*(stipple: PBitmap): PAttribute{.cdecl, - dynlib: lib, importc: "gdk_pango_attr_stipple_new".} -proc pango_attr_embossed_new*(embossed: gboolean): PAttribute{.cdecl, - dynlib: lib, importc: "gdk_pango_attr_embossed_new".} -proc render_threshold_alpha*(pixbuf: PPixbuf, bitmap: PBitmap, - src_x: int32, src_y: int32, dest_x: int32, - dest_y: int32, width: int32, height: int32, - alpha_threshold: int32){.cdecl, dynlib: lib, - importc: "gdk_pixbuf_render_threshold_alpha".} -proc render_to_drawable*(pixbuf: PPixbuf, drawable: PDrawable, gc: PGC, - src_x: int32, src_y: int32, dest_x: int32, - dest_y: int32, width: int32, height: int32, - dither: TRgbDither, x_dither: int32, - y_dither: int32){.cdecl, dynlib: lib, - importc: "gdk_pixbuf_render_to_drawable".} -proc render_to_drawable_alpha*(pixbuf: PPixbuf, drawable: PDrawable, - src_x: int32, src_y: int32, dest_x: int32, - dest_y: int32, width: int32, - height: int32, - alpha_mode: TPixbufAlphaMode, - alpha_threshold: int32, - dither: TRgbDither, x_dither: int32, - y_dither: int32){.cdecl, dynlib: lib, - importc: "gdk_pixbuf_render_to_drawable_alpha".} -proc render_pixmap_and_mask_for_colormap*(pixbuf: PPixbuf, - colormap: PColormap, n: var PPixmap, nasdfdsafw4e: var PBitmap, - alpha_threshold: int32){.cdecl, dynlib: lib, importc: "gdk_pixbuf_render_pixmap_and_mask_for_colormap".} -proc get_from_drawable*(dest: PPixbuf, src: PDrawable, cmap: PColormap, - src_x: int32, src_y: int32, dest_x: int32, - dest_y: int32, width: int32, height: int32): PPixbuf{. - cdecl, dynlib: lib, importc: "gdk_pixbuf_get_from_drawable".} -proc get_from_image*(dest: PPixbuf, src: PImage, cmap: PColormap, - src_x: int32, src_y: int32, dest_x: int32, - dest_y: int32, width: int32, height: int32): PPixbuf{. - cdecl, dynlib: lib, importc: "gdk_pixbuf_get_from_image".} -proc TYPE_PIXMAP*(): GType -proc PIXMAP*(anObject: Pointer): PPixmap -proc PIXMAP_CLASS*(klass: Pointer): PPixmapObjectClass -proc IS_PIXMAP*(anObject: Pointer): bool -proc IS_PIXMAP_CLASS*(klass: Pointer): bool -proc PIXMAP_GET_CLASS*(obj: Pointer): PPixmapObjectClass -proc PIXMAP_OBJECT*(anObject: Pointer): PPixmapObject -proc pixmap_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_pixmap_get_type".} -proc pixmap_new*(window: PWindow, width: gint, height: gint, depth: gint): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_new".} -proc bitmap_create_from_data*(window: PWindow, data: cstring, width: gint, - height: gint): PBitmap{.cdecl, dynlib: lib, - importc: "gdk_bitmap_create_from_data".} -proc pixmap_create_from_data*(window: PWindow, data: cstring, width: gint, - height: gint, depth: gint, fg: PColor, bg: PColor): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_create_from_data".} -proc pixmap_create_from_xpm*(window: PWindow, k: var PBitmap, - transparent_color: PColor, filename: cstring): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_create_from_xpm".} -proc pixmap_colormap_create_from_xpm*(window: PWindow, colormap: PColormap, - k: var PBitmap, transparent_color: PColor, - filename: cstring): PPixmap{.cdecl, - dynlib: lib, importc: "gdk_pixmap_colormap_create_from_xpm".} -proc pixmap_create_from_xpm_d*(window: PWindow, k: var PBitmap, - transparent_color: PColor, data: PPgchar): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_create_from_xpm_d".} -proc pixmap_colormap_create_from_xpm_d*(window: PWindow, colormap: PColormap, - k: var PBitmap, - transparent_color: PColor, data: PPgchar): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_colormap_create_from_xpm_d".} -proc pixmap_foreign_new_for_display*(display: PDisplay, anid: TNativeWindow): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_foreign_new_for_display".} -proc pixmap_lookup_for_display*(display: PDisplay, anid: TNativeWindow): PPixmap{. - cdecl, dynlib: lib, importc: "gdk_pixmap_lookup_for_display".} -proc atom_intern*(atom_name: cstring, only_if_exists: gboolean): TAtom{.cdecl, - dynlib: lib, importc: "gdk_atom_intern".} -proc atom_name*(atom: TAtom): cstring{.cdecl, dynlib: lib, - importc: "gdk_atom_name".} -proc property_get*(window: PWindow, `property`: TAtom, `type`: TAtom, - offset: gulong, length: gulong, pdelete: gint, - actual_property_type: PAtom, actual_format: Pgint, - actual_length: Pgint, data: PPguchar): gboolean{.cdecl, - dynlib: lib, importc: "gdk_property_get".} -proc property_change*(window: PWindow, `property`: TAtom, `type`: TAtom, - format: gint, mode: TPropMode, data: Pguchar, - nelements: gint){.cdecl, dynlib: lib, - importc: "gdk_property_change".} -proc property_delete*(window: PWindow, `property`: TAtom){.cdecl, dynlib: lib, - importc: "gdk_property_delete".} -proc text_property_to_text_list_for_display*(display: PDisplay, encoding: TAtom, - format: gint, text: Pguchar, length: gint, t: var PPgchar): gint{.cdecl, - dynlib: lib, importc: "gdk_text_property_to_text_list_for_display".} -proc text_property_to_utf8_list_for_display*(display: PDisplay, encoding: TAtom, - format: gint, text: Pguchar, length: gint, t: var PPgchar): gint{.cdecl, - dynlib: lib, importc: "gdk_text_property_to_utf8_list_for_display".} -proc utf8_to_string_target*(str: cstring): cstring{.cdecl, dynlib: lib, - importc: "gdk_utf8_to_string_target".} -proc string_to_compound_text_for_display*(display: PDisplay, str: cstring, - encoding: PAtom, format: Pgint, ctext: PPguchar, length: Pgint): gint{. - cdecl, dynlib: lib, importc: "gdk_string_to_compound_text_for_display".} -proc utf8_to_compound_text_for_display*(display: PDisplay, str: cstring, - encoding: PAtom, format: Pgint, - ctext: PPguchar, length: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "gdk_utf8_to_compound_text_for_display".} -proc free_text_list*(list: PPgchar){.cdecl, dynlib: lib, - importc: "gdk_free_text_list".} -proc free_compound_text*(ctext: Pguchar){.cdecl, dynlib: lib, - importc: "gdk_free_compound_text".} -proc region_new*(): PRegion{.cdecl, dynlib: lib, importc: "gdk_region_new".} -proc region_polygon*(points: PPoint, npoints: gint, fill_rule: TFillRule): PRegion{. - cdecl, dynlib: lib, importc: "gdk_region_polygon".} -proc copy*(region: PRegion): PRegion{.cdecl, dynlib: lib, - importc: "gdk_region_copy".} -proc region_rectangle*(rectangle: PRectangle): PRegion{.cdecl, dynlib: lib, - importc: "gdk_region_rectangle".} -proc destroy*(region: PRegion){.cdecl, dynlib: lib, - importc: "gdk_region_destroy".} -proc get_clipbox*(region: PRegion, rectangle: PRectangle){.cdecl, - dynlib: lib, importc: "gdk_region_get_clipbox".} -proc get_rectangles*(region: PRegion, s: var PRectangle, - n_rectangles: Pgint){.cdecl, dynlib: lib, - importc: "gdk_region_get_rectangles".} -proc empty*(region: PRegion): gboolean{.cdecl, dynlib: lib, - importc: "gdk_region_empty".} -proc equal*(region1: PRegion, region2: PRegion): gboolean{.cdecl, - dynlib: lib, importc: "gdk_region_equal".} -proc point_in*(region: PRegion, x: int32, y: int32): gboolean{.cdecl, - dynlib: lib, importc: "gdk_region_point_in".} -proc rect_in*(region: PRegion, rect: PRectangle): TOverlapType{.cdecl, - dynlib: lib, importc: "gdk_region_rect_in".} -proc offset*(region: PRegion, dx: gint, dy: gint){.cdecl, dynlib: lib, - importc: "gdk_region_offset".} -proc shrink*(region: PRegion, dx: gint, dy: gint){.cdecl, dynlib: lib, - importc: "gdk_region_shrink".} -proc union*(region: PRegion, rect: PRectangle){.cdecl, - dynlib: lib, importc: "gdk_region_union_with_rect".} -proc intersect*(source1: PRegion, source2: PRegion){.cdecl, dynlib: lib, - importc: "gdk_region_intersect".} -proc union*(source1: PRegion, source2: PRegion){.cdecl, dynlib: lib, - importc: "gdk_region_union".} -proc subtract*(source1: PRegion, source2: PRegion){.cdecl, dynlib: lib, - importc: "gdk_region_subtract".} -proc `xor`*(source1: PRegion, source2: PRegion){.cdecl, dynlib: lib, - importc: "gdk_region_xor".} -proc spans_intersect_foreach*(region: PRegion, spans: PSpan, - n_spans: int32, sorted: gboolean, - `function`: TSpanFunc, data: gpointer){. - cdecl, dynlib: lib, importc: "gdk_region_spans_intersect_foreach".} -proc rgb_find_color*(colormap: PColormap, color: PColor){.cdecl, dynlib: lib, - importc: "gdk_rgb_find_color".} -proc rgb_image*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - width: gint, height: gint, dith: TRgbDither, - rgb_buf: Pguchar, rowstride: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_rgb_image".} -proc rgb_image_dithalign*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - width: gint, height: gint, dith: TRgbDither, - rgb_buf: Pguchar, rowstride: gint, xdith: gint, - ydith: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_rgb_image_dithalign".} -proc rgb_32_image*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - width: gint, height: gint, dith: TRgbDither, - buf: Pguchar, rowstride: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_rgb_32_image".} -proc rgb_32_image_dithalign*(drawable: PDrawable, gc: PGC, x: gint, - y: gint, width: gint, height: gint, - dith: TRgbDither, buf: Pguchar, - rowstride: gint, xdith: gint, ydith: gint){. - cdecl, dynlib: lib, importc: "gdk_draw_rgb_32_image_dithalign".} -proc gray_image*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - width: gint, height: gint, dith: TRgbDither, buf: Pguchar, - rowstride: gint){.cdecl, dynlib: lib, - importc: "gdk_draw_gray_image".} -proc indexed_image*(drawable: PDrawable, gc: PGC, x: gint, y: gint, - width: gint, height: gint, dith: TRgbDither, - buf: Pguchar, rowstride: gint, cmap: PRgbCmap){.cdecl, - dynlib: lib, importc: "gdk_draw_indexed_image".} -proc rgb_cmap_new*(colors: Pguint32, n_colors: gint): PRgbCmap{.cdecl, - dynlib: lib, importc: "gdk_rgb_cmap_new".} -proc free*(cmap: PRgbCmap){.cdecl, dynlib: lib, - importc: "gdk_rgb_cmap_free".} -proc rgb_set_verbose*(verbose: gboolean){.cdecl, dynlib: lib, - importc: "gdk_rgb_set_verbose".} -proc rgb_set_install*(install: gboolean){.cdecl, dynlib: lib, - importc: "gdk_rgb_set_install".} -proc rgb_set_min_colors*(min_colors: gint){.cdecl, dynlib: lib, - importc: "gdk_rgb_set_min_colors".} -proc TYPE_DISPLAY*(): GType -proc DISPLAY_OBJECT*(anObject: pointer): PDisplay -proc DISPLAY_CLASS*(klass: pointer): PDisplayClass -proc IS_DISPLAY*(anObject: pointer): bool -proc IS_DISPLAY_CLASS*(klass: pointer): bool -proc DISPLAY_GET_CLASS*(obj: pointer): PDisplayClass -proc display_open*(display_name: cstring): PDisplay{.cdecl, dynlib: lib, - importc: "gdk_display_open".} -proc get_name*(display: PDisplay): cstring{.cdecl, dynlib: lib, - importc: "gdk_display_get_name".} -proc get_n_screens*(display: PDisplay): gint{.cdecl, dynlib: lib, - importc: "gdk_display_get_n_screens".} -proc get_screen*(display: PDisplay, screen_num: gint): PScreen{.cdecl, - dynlib: lib, importc: "gdk_display_get_screen".} -proc get_default_screen*(display: PDisplay): PScreen{.cdecl, - dynlib: lib, importc: "gdk_display_get_default_screen".} -proc pointer_ungrab*(display: PDisplay, time: guint32){.cdecl, - dynlib: lib, importc: "gdk_display_pointer_ungrab".} -proc keyboard_ungrab*(display: PDisplay, time: guint32){.cdecl, - dynlib: lib, importc: "gdk_display_keyboard_ungrab".} -proc pointer_is_grabbed*(display: PDisplay): gboolean{.cdecl, - dynlib: lib, importc: "gdk_display_pointer_is_grabbed".} -proc beep*(display: PDisplay){.cdecl, dynlib: lib, - importc: "gdk_display_beep".} -proc sync*(display: PDisplay){.cdecl, dynlib: lib, - importc: "gdk_display_sync".} -proc close*(display: PDisplay){.cdecl, dynlib: lib, - importc: "gdk_display_close".} -proc list_devices*(display: PDisplay): PGList{.cdecl, dynlib: lib, - importc: "gdk_display_list_devices".} -proc get_event*(display: PDisplay): PEvent{.cdecl, dynlib: lib, - importc: "gdk_display_get_event".} -proc peek_event*(display: PDisplay): PEvent{.cdecl, dynlib: lib, - importc: "gdk_display_peek_event".} -proc put_event*(display: PDisplay, event: PEvent){.cdecl, dynlib: lib, - importc: "gdk_display_put_event".} -proc add_client_message_filter*(display: PDisplay, message_type: TAtom, - func: TFilterFunc, data: gpointer){. - cdecl, dynlib: lib, importc: "gdk_display_add_client_message_filter".} -proc set_double_click_time*(display: PDisplay, msec: guint){.cdecl, - dynlib: lib, importc: "gdk_display_set_double_click_time".} -proc set_sm_client_id*(display: PDisplay, sm_client_id: cstring){.cdecl, - dynlib: lib, importc: "gdk_display_set_sm_client_id".} -proc set_default_display*(display: PDisplay){.cdecl, dynlib: lib, - importc: "gdk_set_default_display".} -proc get_default_display*(): PDisplay{.cdecl, dynlib: lib, - importc: "gdk_get_default_display".} -proc TYPE_SCREEN*(): GType -proc SCREEN*(anObject: Pointer): PScreen -proc SCREEN_CLASS*(klass: Pointer): PScreenClass -proc IS_SCREEN*(anObject: Pointer): bool -proc IS_SCREEN_CLASS*(klass: Pointer): bool -proc SCREEN_GET_CLASS*(obj: Pointer): PScreenClass -proc get_default_colormap*(screen: PScreen): PColormap{.cdecl, - dynlib: lib, importc: "gdk_screen_get_default_colormap".} -proc set_default_colormap*(screen: PScreen, colormap: PColormap){.cdecl, - dynlib: lib, importc: "gdk_screen_set_default_colormap".} -proc get_system_colormap*(screen: PScreen): PColormap{.cdecl, - dynlib: lib, importc: "gdk_screen_get_system_colormap".} -proc get_system_visual*(screen: PScreen): PVisual{.cdecl, dynlib: lib, - importc: "gdk_screen_get_system_visual".} -proc get_rgb_colormap*(screen: PScreen): PColormap{.cdecl, dynlib: lib, - importc: "gdk_screen_get_rgb_colormap".} -proc get_rgb_visual*(screen: PScreen): PVisual{.cdecl, dynlib: lib, - importc: "gdk_screen_get_rgb_visual".} -proc get_root_window*(screen: PScreen): PWindow{.cdecl, dynlib: lib, - importc: "gdk_screen_get_root_window".} -proc get_display*(screen: PScreen): PDisplay{.cdecl, dynlib: lib, - importc: "gdk_screen_get_display".} -proc get_number*(screen: PScreen): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_get_number".} -proc get_window_at_pointer*(screen: PScreen, win_x: Pgint, win_y: Pgint): PWindow{. - cdecl, dynlib: lib, importc: "gdk_screen_get_window_at_pointer".} -proc get_width*(screen: PScreen): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_get_width".} -proc get_height*(screen: PScreen): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_get_height".} -proc get_width_mm*(screen: PScreen): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_get_width_mm".} -proc get_height_mm*(screen: PScreen): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_get_height_mm".} -proc close*(screen: PScreen){.cdecl, dynlib: lib, - importc: "gdk_screen_close".} -proc list_visuals*(screen: PScreen): PGList{.cdecl, dynlib: lib, - importc: "gdk_screen_list_visuals".} -proc get_toplevel_windows*(screen: PScreen): PGList{.cdecl, dynlib: lib, - importc: "gdk_screen_get_toplevel_windows".} -proc get_n_monitors*(screen: PScreen): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_get_n_monitors".} -proc get_monitor_geometry*(screen: PScreen, monitor_num: gint, - dest: PRectangle){.cdecl, dynlib: lib, - importc: "gdk_screen_get_monitor_geometry".} -proc get_monitor_at_point*(screen: PScreen, x: gint, y: gint): gint{. - cdecl, dynlib: lib, importc: "gdk_screen_get_monitor_at_point".} -proc get_monitor_at_window*(screen: PScreen, window: PWindow): gint{. - cdecl, dynlib: lib, importc: "gdk_screen_get_monitor_at_window".} -proc broadcast_client_message*(screen: PScreen, event: PEvent){.cdecl, - dynlib: lib, importc: "gdk_screen_broadcast_client_message".} -proc get_default_screen*(): PScreen{.cdecl, dynlib: lib, - importc: "gdk_get_default_screen".} -proc get_setting*(screen: PScreen, name: cstring, value: PGValue): gboolean{. - cdecl, dynlib: lib, importc: "gdk_screen_get_setting".} -proc SELECTION_PRIMARY*(): TAtom -proc SELECTION_SECONDARY*(): TAtom -proc SELECTION_CLIPBOARD*(): TAtom -proc TARGET_BITMAP*(): TAtom -proc TARGET_COLORMAP*(): TAtom -proc TARGET_DRAWABLE*(): TAtom -proc TARGET_PIXMAP*(): TAtom -proc TARGET_STRING*(): TAtom -proc SELECTION_TYPE_ATOM*(): TAtom -proc SELECTION_TYPE_BITMAP*(): TAtom -proc SELECTION_TYPE_COLORMAP*(): TAtom -proc SELECTION_TYPE_DRAWABLE*(): TAtom -proc SELECTION_TYPE_INTEGER*(): TAtom -proc SELECTION_TYPE_PIXMAP*(): TAtom -proc SELECTION_TYPE_WINDOW*(): TAtom -proc SELECTION_TYPE_STRING*(): TAtom -proc selection_owner_set_for_display*(display: PDisplay, owner: PWindow, - selection: TAtom, time: guint32, - send_event: gboolean): gboolean{.cdecl, - dynlib: lib, importc: "gdk_selection_owner_set_for_display".} -proc selection_owner_get_for_display*(display: PDisplay, selection: TAtom): PWindow{. - cdecl, dynlib: lib, importc: "gdk_selection_owner_get_for_display".} -proc selection_convert*(requestor: PWindow, selection: TAtom, target: TAtom, - time: guint32){.cdecl, dynlib: lib, - importc: "gdk_selection_convert".} -proc selection_property_get*(requestor: PWindow, data: PPguchar, - prop_type: PAtom, prop_format: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "gdk_selection_property_get".} -proc selection_send_notify_for_display*(display: PDisplay, requestor: guint32, - selection: TAtom, target: TAtom, - `property`: TAtom, time: guint32){. - cdecl, dynlib: lib, importc: "gdk_selection_send_notify_for_display".} -const - CURRENT_TIME* = 0 - PARENT_RELATIVE* = 1 - OK* = 0 - ERROR* = - (1) - ERROR_PARAM* = - (2) - ERROR_FILE* = - (3) - ERROR_MEM* = - (4) - SHIFT_MASK* = 1 shl 0 - LOCK_MASK* = 1 shl 1 - CONTROL_MASK* = 1 shl 2 - MOD1_MASK* = 1 shl 3 - MOD2_MASK* = 1 shl 4 - MOD3_MASK* = 1 shl 5 - MOD4_MASK* = 1 shl 6 - MOD5_MASK* = 1 shl 7 - BUTTON1_MASK* = 1 shl 8 - BUTTON2_MASK* = 1 shl 9 - BUTTON3_MASK* = 1 shl 10 - BUTTON4_MASK* = 1 shl 11 - BUTTON5_MASK* = 1 shl 12 - RELEASE_MASK* = 1 shl 30 - MODIFIER_MASK* = ord(RELEASE_MASK) or 0x00001FFF - INPUT_READ* = 1 shl 0 - INPUT_WRITE* = 1 shl 1 - INPUT_EXCEPTION* = 1 shl 2 - GRAB_SUCCESS* = 0 - GRAB_ALREADY_GRABBED* = 1 - GRAB_INVALID_TIME* = 2 - GRAB_NOT_VIEWABLE* = 3 - GRAB_FROZEN* = 4 - -proc ATOM_TO_POINTER*(atom: TAtom): Pointer -proc POINTER_TO_ATOM*(p: Pointer): TAtom -proc `MAKE_ATOM`*(val: guint): TAtom -proc NONE*(): TAtom -proc TYPE_VISUAL*(): GType -proc VISUAL*(anObject: Pointer): PVisual -proc VISUAL_CLASS*(klass: Pointer): PVisualClass -proc IS_VISUAL*(anObject: Pointer): bool -proc IS_VISUAL_CLASS*(klass: Pointer): bool -proc VISUAL_GET_CLASS*(obj: Pointer): PVisualClass -proc visual_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_visual_get_type".} -const - WA_TITLE* = 1 shl 1 - WA_X* = 1 shl 2 - WA_Y* = 1 shl 3 - WA_CURSOR* = 1 shl 4 - WA_COLORMAP* = 1 shl 5 - WA_VISUAL* = 1 shl 6 - WA_WMCLASS* = 1 shl 7 - WA_NOREDIR* = 1 shl 8 - HINT_POS* = 1 shl 0 - HINT_MIN_SIZE* = 1 shl 1 - HINT_MAX_SIZE* = 1 shl 2 - HINT_BASE_SIZE* = 1 shl 3 - HINT_ASPECT* = 1 shl 4 - HINT_RESIZE_INC* = 1 shl 5 - HINT_WIN_GRAVITY* = 1 shl 6 - HINT_USER_POS* = 1 shl 7 - HINT_USER_SIZE* = 1 shl 8 - DECOR_ALL* = 1 shl 0 - DECOR_BORDER* = 1 shl 1 - DECOR_RESIZEH* = 1 shl 2 - DECOR_TITLE* = 1 shl 3 - DECOR_MENU* = 1 shl 4 - DECOR_MINIMIZE* = 1 shl 5 - DECOR_MAXIMIZE* = 1 shl 6 - FUNC_ALL* = 1 shl 0 - FUNC_RESIZE* = 1 shl 1 - FUNC_MOVE* = 1 shl 2 - FUNC_MINIMIZE* = 1 shl 3 - FUNC_MAXIMIZE* = 1 shl 4 - FUNC_CLOSE* = 1 shl 5 - GRAVITY_NORTH_WEST* = 1 - GRAVITY_NORTH* = 2 - GRAVITY_NORTH_EAST* = 3 - GRAVITY_WEST* = 4 - GRAVITY_CENTER* = 5 - GRAVITY_EAST* = 6 - GRAVITY_SOUTH_WEST* = 7 - GRAVITY_SOUTH* = 8 - GRAVITY_SOUTH_EAST* = 9 - GRAVITY_STATIC* = 10 - -proc TYPE_WINDOW*(): GType -proc WINDOW*(anObject: Pointer): PWindow -proc WINDOW_CLASS*(klass: Pointer): PWindowObjectClass -proc IS_WINDOW*(anObject: Pointer): bool -proc IS_WINDOW_CLASS*(klass: Pointer): bool -proc WINDOW_GET_CLASS*(obj: Pointer): PWindowObjectClass -proc WINDOW_OBJECT*(anObject: Pointer): PWindowObject -const - bm_TWindowObject_guffaw_gravity* = 0x0001'i16 - bp_TWindowObject_guffaw_gravity* = 0'i16 - bm_TWindowObject_input_only* = 0x0002'i16 - bp_TWindowObject_input_only* = 1'i16 - bm_TWindowObject_modal_hint* = 0x0004'i16 - bp_TWindowObject_modal_hint* = 2'i16 - bm_TWindowObject_destroyed* = 0x0018'i16 - bp_TWindowObject_destroyed* = 3'i16 - -proc WindowObject_guffaw_gravity*(a: PWindowObject): guint -proc WindowObject_set_guffaw_gravity*(a: PWindowObject, - `guffaw_gravity`: guint) -proc WindowObject_input_only*(a: PWindowObject): guint -proc WindowObject_set_input_only*(a: PWindowObject, `input_only`: guint) -proc WindowObject_modal_hint*(a: PWindowObject): guint -proc WindowObject_set_modal_hint*(a: PWindowObject, `modal_hint`: guint) -proc WindowObject_destroyed*(a: PWindowObject): guint -proc WindowObject_set_destroyed*(a: PWindowObject, `destroyed`: guint) -proc window_object_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_window_object_get_type".} -proc new*(parent: PWindow, attributes: PWindowAttr, attributes_mask: gint): PWindow{. - cdecl, dynlib: lib, importc: "gdk_window_new".} -proc destroy*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_destroy".} -proc get_window_type*(window: PWindow): TWindowType{.cdecl, dynlib: lib, - importc: "gdk_window_get_window_type".} -proc window_at_pointer*(win_x: Pgint, win_y: Pgint): PWindow{.cdecl, - dynlib: lib, importc: "gdk_window_at_pointer".} -proc show*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_show".} -proc hide*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_hide".} -proc withdraw*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_withdraw".} -proc show_unraised*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_show_unraised".} -proc move*(window: PWindow, x: gint, y: gint){.cdecl, dynlib: lib, - importc: "gdk_window_move".} -proc resize*(window: PWindow, width: gint, height: gint){.cdecl, - dynlib: lib, importc: "gdk_window_resize".} -proc move_resize*(window: PWindow, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: lib, - importc: "gdk_window_move_resize".} -proc reparent*(window: PWindow, new_parent: PWindow, x: gint, y: gint){. - cdecl, dynlib: lib, importc: "gdk_window_reparent".} -proc clear*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_clear".} -proc clear_area*(window: PWindow, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: lib, - importc: "gdk_window_clear_area".} -proc clear_area_e*(window: PWindow, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: lib, - importc: "gdk_window_clear_area_e".} -proc `raise`*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_raise".} -proc lower*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_lower".} -proc focus*(window: PWindow, timestamp: guint32){.cdecl, dynlib: lib, - importc: "gdk_window_focus".} -proc set_user_data*(window: PWindow, user_data: gpointer){.cdecl, - dynlib: lib, importc: "gdk_window_set_user_data".} -proc set_override_redirect*(window: PWindow, override_redirect: gboolean){. - cdecl, dynlib: lib, importc: "gdk_window_set_override_redirect".} -proc add_filter*(window: PWindow, `function`: TFilterFunc, data: gpointer){. - cdecl, dynlib: lib, importc: "gdk_window_add_filter".} -proc remove_filter*(window: PWindow, `function`: TFilterFunc, - data: gpointer){.cdecl, dynlib: lib, - importc: "gdk_window_remove_filter".} -proc scroll*(window: PWindow, dx: gint, dy: gint){.cdecl, dynlib: lib, - importc: "gdk_window_scroll".} -proc shape_combine_mask*(window: PWindow, mask: PBitmap, x: gint, y: gint){. - cdecl, dynlib: lib, importc: "gdk_window_shape_combine_mask".} -proc shape_combine_region*(window: PWindow, shape_region: PRegion, - offset_x: gint, offset_y: gint){.cdecl, - dynlib: lib, importc: "gdk_window_shape_combine_region".} -proc set_child_shapes*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_set_child_shapes".} -proc merge_child_shapes*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_merge_child_shapes".} -proc is_visible*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gdk_window_is_visible".} -proc is_viewable*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gdk_window_is_viewable".} -proc get_state*(window: PWindow): TWindowState{.cdecl, dynlib: lib, - importc: "gdk_window_get_state".} -proc set_static_gravities*(window: PWindow, use_static: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gdk_window_set_static_gravities".} -proc window_foreign_new_for_display*(display: PDisplay, anid: TNativeWindow): PWindow{. - cdecl, dynlib: lib, importc: "gdk_window_foreign_new_for_display".} -proc window_lookup_for_display*(display: PDisplay, anid: TNativeWindow): PWindow{. - cdecl, dynlib: lib, importc: "gdk_window_lookup_for_display".} -proc set_type_hint*(window: PWindow, hint: TWindowTypeHint){.cdecl, - dynlib: lib, importc: "gdk_window_set_type_hint".} -proc set_modal_hint*(window: PWindow, modal: gboolean){.cdecl, - dynlib: lib, importc: "gdk_window_set_modal_hint".} -proc set_geometry_hints*(window: PWindow, geometry: PGeometry, - geom_mask: TWindowHints){.cdecl, dynlib: lib, - importc: "gdk_window_set_geometry_hints".} -proc set_sm_client_id*(sm_client_id: cstring){.cdecl, dynlib: lib, - importc: "gdk_set_sm_client_id".} -proc begin_paint_rect*(window: PWindow, rectangle: PRectangle){.cdecl, - dynlib: lib, importc: "gdk_window_begin_paint_rect".} -proc begin_paint_region*(window: PWindow, region: PRegion){.cdecl, - dynlib: lib, importc: "gdk_window_begin_paint_region".} -proc end_paint*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_end_paint".} -proc set_title*(window: PWindow, title: cstring){.cdecl, dynlib: lib, - importc: "gdk_window_set_title".} -proc set_role*(window: PWindow, role: cstring){.cdecl, dynlib: lib, - importc: "gdk_window_set_role".} -proc set_transient_for*(window: PWindow, parent: PWindow){.cdecl, - dynlib: lib, importc: "gdk_window_set_transient_for".} -proc set_background*(window: PWindow, color: PColor){.cdecl, dynlib: lib, - importc: "gdk_window_set_background".} -proc set_back_pixmap*(window: PWindow, pixmap: PPixmap, - parent_relative: gboolean){.cdecl, dynlib: lib, - importc: "gdk_window_set_back_pixmap".} -proc set_cursor*(window: PWindow, cursor: PCursor){.cdecl, dynlib: lib, - importc: "gdk_window_set_cursor".} -proc get_user_data*(window: PWindow, data: gpointer){.cdecl, dynlib: lib, - importc: "gdk_window_get_user_data".} -proc get_geometry*(window: PWindow, x: Pgint, y: Pgint, width: Pgint, - height: Pgint, depth: Pgint){.cdecl, dynlib: lib, - importc: "gdk_window_get_geometry".} -proc get_position*(window: PWindow, x: Pgint, y: Pgint){.cdecl, - dynlib: lib, importc: "gdk_window_get_position".} -proc get_origin*(window: PWindow, x: Pgint, y: Pgint): gint{.cdecl, - dynlib: lib, importc: "gdk_window_get_origin".} -proc get_root_origin*(window: PWindow, x: Pgint, y: Pgint){.cdecl, - dynlib: lib, importc: "gdk_window_get_root_origin".} -proc get_frame_extents*(window: PWindow, rect: PRectangle){.cdecl, - dynlib: lib, importc: "gdk_window_get_frame_extents".} -proc get_pointer*(window: PWindow, x: Pgint, y: Pgint, - mask: PModifierType): PWindow{.cdecl, dynlib: lib, - importc: "gdk_window_get_pointer".} -proc get_parent*(window: PWindow): PWindow{.cdecl, dynlib: lib, - importc: "gdk_window_get_parent".} -proc get_toplevel*(window: PWindow): PWindow{.cdecl, dynlib: lib, - importc: "gdk_window_get_toplevel".} -proc get_children*(window: PWindow): PGList{.cdecl, dynlib: lib, - importc: "gdk_window_get_children".} -proc peek_children*(window: PWindow): PGList{.cdecl, dynlib: lib, - importc: "gdk_window_peek_children".} -proc get_events*(window: PWindow): TEventMask{.cdecl, dynlib: lib, - importc: "gdk_window_get_events".} -proc set_events*(window: PWindow, event_mask: TEventMask){.cdecl, - dynlib: lib, importc: "gdk_window_set_events".} -proc set_icon_list*(window: PWindow, pixbufs: PGList){.cdecl, - dynlib: lib, importc: "gdk_window_set_icon_list".} -proc set_icon*(window: PWindow, icon_window: PWindow, pixmap: PPixmap, - mask: PBitmap){.cdecl, dynlib: lib, - importc: "gdk_window_set_icon".} -proc set_icon_name*(window: PWindow, name: cstring){.cdecl, dynlib: lib, - importc: "gdk_window_set_icon_name".} -proc set_group*(window: PWindow, leader: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_set_group".} -proc set_decorations*(window: PWindow, decorations: TWMDecoration){. - cdecl, dynlib: lib, importc: "gdk_window_set_decorations".} -proc get_decorations*(window: PWindow, decorations: PWMDecoration): gboolean{. - cdecl, dynlib: lib, importc: "gdk_window_get_decorations".} -proc set_functions*(window: PWindow, functions: TWMFunction){.cdecl, - dynlib: lib, importc: "gdk_window_set_functions".} -proc iconify*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_iconify".} -proc deiconify*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_deiconify".} -proc stick*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_stick".} -proc unstick*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_unstick".} -proc maximize*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_maximize".} -proc unmaximize*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_unmaximize".} -proc register_dnd*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_register_dnd".} -proc begin_resize_drag*(window: PWindow, edge: TWindowEdge, button: gint, - root_x: gint, root_y: gint, timestamp: guint32){. - cdecl, dynlib: lib, importc: "gdk_window_begin_resize_drag".} -proc begin_move_drag*(window: PWindow, button: gint, root_x: gint, - root_y: gint, timestamp: guint32){.cdecl, - dynlib: lib, importc: "gdk_window_begin_move_drag".} -proc invalidate_rect*(window: PWindow, rect: PRectangle, - invalidate_children: gboolean){.cdecl, dynlib: lib, - importc: "gdk_window_invalidate_rect".} -proc invalidate_region*(window: PWindow, region: PRegion, - invalidate_children: gboolean){.cdecl, - dynlib: lib, importc: "gdk_window_invalidate_region".} -proc invalidate_maybe_recurse*(window: PWindow, region: PRegion, - child_func: window_invalidate_maybe_recurse_child_func, user_data: gpointer){. - cdecl, dynlib: lib, importc: "gdk_window_invalidate_maybe_recurse".} -proc get_update_area*(window: PWindow): PRegion{.cdecl, dynlib: lib, - importc: "gdk_window_get_update_area".} -proc freeze_updates*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_freeze_updates".} -proc thaw_updates*(window: PWindow){.cdecl, dynlib: lib, - importc: "gdk_window_thaw_updates".} -proc window_process_all_updates*(){.cdecl, dynlib: lib, - importc: "gdk_window_process_all_updates".} -proc process_updates*(window: PWindow, update_children: gboolean){.cdecl, - dynlib: lib, importc: "gdk_window_process_updates".} -proc window_set_debug_updates*(setting: gboolean){.cdecl, dynlib: lib, - importc: "gdk_window_set_debug_updates".} -proc window_constrain_size*(geometry: PGeometry, flags: guint, width: gint, - height: gint, new_width: Pgint, new_height: Pgint){. - cdecl, dynlib: lib, importc: "gdk_window_constrain_size".} -proc get_internal_paint_info*(window: PWindow, e: var PDrawable, - x_offset: Pgint, y_offset: Pgint){.cdecl, - dynlib: lib, importc: "gdk_window_get_internal_paint_info".} -proc set_pointer_hooks*(new_hooks: PPointerHooks): PPointerHooks{.cdecl, - dynlib: lib, importc: "gdk_set_pointer_hooks".} -proc get_default_root_window*(): PWindow{.cdecl, dynlib: lib, - importc: "gdk_get_default_root_window".} -proc parse_args*(argc: Pgint, v: var PPgchar){.cdecl, dynlib: lib, - importc: "gdk_parse_args".} -proc init*(argc: Pgint, v: var PPgchar){.cdecl, dynlib: lib, importc: "gdk_init".} -proc init_check*(argc: Pgint, v: var PPgchar): gboolean{.cdecl, dynlib: lib, - importc: "gdk_init_check".} -when not defined(DISABLE_DEPRECATED): - proc exit*(error_code: gint){.cdecl, dynlib: lib, importc: "gdk_exit".} -proc set_locale*(): cstring{.cdecl, dynlib: lib, importc: "gdk_set_locale".} -proc get_program_class*(): cstring{.cdecl, dynlib: lib, - importc: "gdk_get_program_class".} -proc set_program_class*(program_class: cstring){.cdecl, dynlib: lib, - importc: "gdk_set_program_class".} -proc error_trap_push*(){.cdecl, dynlib: lib, importc: "gdk_error_trap_push".} -proc error_trap_pop*(): gint{.cdecl, dynlib: lib, importc: "gdk_error_trap_pop".} -when not defined(DISABLE_DEPRECATED): - proc set_use_xshm*(use_xshm: gboolean){.cdecl, dynlib: lib, - importc: "gdk_set_use_xshm".} - proc get_use_xshm*(): gboolean{.cdecl, dynlib: lib, - importc: "gdk_get_use_xshm".} -proc get_display*(): cstring{.cdecl, dynlib: lib, importc: "gdk_get_display".} -proc get_display_arg_name*(): cstring{.cdecl, dynlib: lib, - importc: "gdk_get_display_arg_name".} -when not defined(DISABLE_DEPRECATED): - proc input_add_full*(source: gint, condition: TInputCondition, - `function`: TInputFunction, data: gpointer, - destroy: TDestroyNotify): gint{.cdecl, dynlib: lib, - importc: "gdk_input_add_full".} - proc input_add*(source: gint, condition: TInputCondition, - `function`: TInputFunction, data: gpointer): gint{.cdecl, - dynlib: lib, importc: "gdk_input_add".} - proc input_remove*(tag: gint){.cdecl, dynlib: lib, importc: "gdk_input_remove".} -proc pointer_grab*(window: PWindow, owner_events: gboolean, - event_mask: TEventMask, confine_to: PWindow, cursor: PCursor, - time: guint32): TGrabStatus{.cdecl, dynlib: lib, - importc: "gdk_pointer_grab".} -proc keyboard_grab*(window: PWindow, owner_events: gboolean, time: guint32): TGrabStatus{. - cdecl, dynlib: lib, importc: "gdk_keyboard_grab".} -when not defined(MULTIHEAD_SAFE): - proc pointer_ungrab*(time: guint32){.cdecl, dynlib: lib, - importc: "gdk_pointer_ungrab".} - proc keyboard_ungrab*(time: guint32){.cdecl, dynlib: lib, - importc: "gdk_keyboard_ungrab".} - proc pointer_is_grabbed*(): gboolean{.cdecl, dynlib: lib, - importc: "gdk_pointer_is_grabbed".} - proc screen_width*(): gint{.cdecl, dynlib: lib, importc: "gdk_screen_width".} - proc screen_height*(): gint{.cdecl, dynlib: lib, importc: "gdk_screen_height".} - proc screen_width_mm*(): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_width_mm".} - proc screen_height_mm*(): gint{.cdecl, dynlib: lib, - importc: "gdk_screen_height_mm".} - proc beep*(){.cdecl, dynlib: lib, importc: "gdk_beep".} -proc flush*(){.cdecl, dynlib: lib, importc: "gdk_flush".} -when not defined(MULTIHEAD_SAFE): - proc set_double_click_time*(msec: guint){.cdecl, dynlib: lib, - importc: "gdk_set_double_click_time".} -proc intersect*(src1: PRectangle, src2: PRectangle, dest: PRectangle): gboolean{. - cdecl, dynlib: lib, importc: "gdk_rectangle_intersect".} -proc union*(src1: PRectangle, src2: PRectangle, dest: PRectangle){. - cdecl, dynlib: lib, importc: "gdk_rectangle_union".} -proc rectangle_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gdk_rectangle_get_type".} -proc TYPE_RECTANGLE*(): GType -proc wcstombs*(src: PWChar): cstring{.cdecl, dynlib: lib, - importc: "gdk_wcstombs".} -proc mbstowcs*(dest: PWChar, src: cstring, dest_max: gint): gint{.cdecl, - dynlib: lib, importc: "gdk_mbstowcs".} -when not defined(MULTIHEAD_SAFE): - proc event_send_client_message*(event: PEvent, xid: guint32): gboolean{.cdecl, - dynlib: lib, importc: "gdk_event_send_client_message".} - proc event_send_clientmessage_toall*(event: PEvent){.cdecl, dynlib: lib, - importc: "gdk_event_send_clientmessage_toall".} -proc event_send_client_message_for_display*(display: PDisplay, event: PEvent, - xid: guint32): gboolean{.cdecl, dynlib: lib, importc: "gdk_event_send_client_message_for_display".} -proc threads_enter*(){.cdecl, dynlib: lib, importc: "gdk_threads_enter".} -proc threads_leave*(){.cdecl, dynlib: lib, importc: "gdk_threads_leave".} -proc threads_init*(){.cdecl, dynlib: lib, importc: "gdk_threads_init".} -proc TYPE_RECTANGLE*(): GType = - result = rectangle_get_type() - -proc TYPE_COLORMAP*(): GType = - result = colormap_get_type() - -proc COLORMAP*(anObject: pointer): PColormap = - result = cast[PColormap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_COLORMAP())) - -proc COLORMAP_CLASS*(klass: pointer): PColormapClass = - result = cast[PColormapClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_COLORMAP())) - -proc IS_COLORMAP*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_COLORMAP()) - -proc IS_COLORMAP_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_COLORMAP()) - -proc COLORMAP_GET_CLASS*(obj: pointer): PColormapClass = - result = cast[PColormapClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_COLORMAP())) - -proc TYPE_COLOR*(): GType = - result = gdk2.color_get_type() - -proc destroy*(cursor: PCursor) = - unref(cursor) - -proc TYPE_CURSOR*(): GType = - result = cursor_get_type() - -proc TYPE_DRAG_CONTEXT*(): GType = - result = drag_context_get_type() - -proc DRAG_CONTEXT*(anObject: Pointer): PDragContext = - result = cast[PDragContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_DRAG_CONTEXT())) - -proc DRAG_CONTEXT_CLASS*(klass: Pointer): PDragContextClass = - result = cast[PDragContextClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_DRAG_CONTEXT())) - -proc IS_DRAG_CONTEXT*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_DRAG_CONTEXT()) - -proc IS_DRAG_CONTEXT_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_DRAG_CONTEXT()) - -proc DRAG_CONTEXT_GET_CLASS*(obj: Pointer): PDragContextClass = - result = cast[PDragContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_DRAG_CONTEXT())) - -proc region_EXTENTCHECK*(r1, r2: PRegionBox): bool = - result = ((r1.x2) > r2.x1) and ((r1.x1) < r2.x2) and ((r1.y2) > r2.y1) and - ((r1.y1) < r2.y2) - -proc EXTENTS*(r: PRegionBox, idRect: PRegion) = - if ((r.x1) < idRect.extents.x1): - idRect.extents.x1 = r.x1 - if (r.y1) < idRect.extents.y1: - idRect.extents.y1 = r.y1 - if (r.x2) > idRect.extents.x2: - idRect.extents.x2 = r.x2 - -proc MEMCHECK*(reg: PRegion, ARect, firstrect: var PRegionBox): bool = - assert(false) # to implement - -proc CHECK_PREVIOUS*(Reg: PRegion, R: PRegionBox, - Rx1, Ry1, Rx2, Ry2: gint): bool = - assert(false) # to implement - -proc ADDRECT*(reg: PRegion, r: PRegionBox, rx1, ry1, rx2, ry2: gint) = - if (((rx1) < rx2) and ((ry1) < ry2) and - CHECK_PREVIOUS(reg, r, rx1, ry1, rx2, ry2)): - r.x1 = rx1 - r.y1 = ry1 - r.x2 = rx2 - r.y2 = ry2 - -proc ADDRECTNOX*(reg: PRegion, r: PRegionBox, rx1, ry1, rx2, ry2: gint) = - if (((rx1) < rx2) and ((ry1) < ry2) and - CHECK_PREVIOUS(reg, r, rx1, ry1, rx2, ry2)): - r.x1 = rx1 - r.y1 = ry1 - r.x2 = rx2 - r.y2 = ry2 - inc(reg.numRects) - -proc EMPTY_REGION*(pReg: PRegion): bool = - result = pReg.numRects == 0'i32 - -proc REGION_NOT_EMPTY*(pReg: PRegion): bool = - result = pReg.numRects != 0'i32 - -proc region_INBOX*(r: TRegionBox, x, y: gint): bool = - result = ((((r.x2) > x) and ((r.x1) <= x)) and ((r.y2) > y)) and - ((r.y1) <= y) - -proc TYPE_DRAWABLE*(): GType = - result = drawable_get_type() - -proc DRAWABLE*(anObject: Pointer): PDrawable = - result = cast[PDrawable](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_DRAWABLE())) - -proc DRAWABLE_CLASS*(klass: Pointer): PDrawableClass = - result = cast[PDrawableClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_DRAWABLE())) - -proc IS_DRAWABLE*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_DRAWABLE()) - -proc IS_DRAWABLE_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_DRAWABLE()) - -proc DRAWABLE_GET_CLASS*(obj: Pointer): PDrawableClass = - result = cast[PDrawableClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_DRAWABLE())) - -proc pixmap*(drawable: PDrawable, gc: PGC, src: PDrawable, xsrc: gint, - ysrc: gint, xdest: gint, ydest: gint, width: gint, - height: gint) = - drawable(drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height) - -proc bitmap*(drawable: PDrawable, gc: PGC, src: PDrawable, xsrc: gint, - ysrc: gint, xdest: gint, ydest: gint, width: gint, - height: gint) = - drawable(drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height) - -proc TYPE_EVENT*(): GType = - result = event_get_type() - -proc TYPE_FONT*(): GType = - result = gdk2.font_get_type() - -proc TYPE_GC*(): GType = - result = gc_get_type() - -proc GC*(anObject: Pointer): PGC = - result = cast[PGC](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GC())) - -proc GC_CLASS*(klass: Pointer): PGCClass = - result = cast[PGCClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GC())) - -proc IS_GC*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GC()) - -proc IS_GC_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GC()) - -proc GC_GET_CLASS*(obj: Pointer): PGCClass = - result = cast[PGCClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GC())) - -proc destroy*(gc: PGC) = - g_object_unref(G_OBJECT(gc)) - -proc TYPE_IMAGE*(): GType = - result = image_get_type() - -proc IMAGE*(anObject: Pointer): PImage = - result = cast[PImage](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_IMAGE())) - -proc IMAGE_CLASS*(klass: Pointer): PImageClass = - result = cast[PImageClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_IMAGE())) - -proc IS_IMAGE*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_IMAGE()) - -proc IS_IMAGE_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_IMAGE()) - -proc IMAGE_GET_CLASS*(obj: Pointer): PImageClass = - result = cast[PImageClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_IMAGE())) - -proc destroy*(image: PImage) = - g_object_unref(G_OBJECT(image)) - -proc TYPE_DEVICE*(): GType = - result = device_get_type() - -proc DEVICE*(anObject: Pointer): PDevice = - result = cast[PDevice](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_DEVICE())) - -proc DEVICE_CLASS*(klass: Pointer): PDeviceClass = - result = cast[PDeviceClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_DEVICE())) - -proc IS_DEVICE*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_DEVICE()) - -proc IS_DEVICE_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_DEVICE()) - -proc DEVICE_GET_CLASS*(obj: Pointer): PDeviceClass = - result = cast[PDeviceClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_DEVICE())) - -proc TYPE_KEYMAP*(): GType = - result = keymap_get_type() - -proc KEYMAP*(anObject: Pointer): PKeymap = - result = cast[PKeymap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_KEYMAP())) - -proc KEYMAP_CLASS*(klass: Pointer): PKeymapClass = - result = cast[PKeymapClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_KEYMAP())) - -proc IS_KEYMAP*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_KEYMAP()) - -proc IS_KEYMAP_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_KEYMAP()) - -proc KEYMAP_GET_CLASS*(obj: Pointer): PKeymapClass = - result = cast[PKeymapClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_KEYMAP())) - -proc TYPE_PIXMAP*(): GType = - result = pixmap_get_type() - -proc PIXMAP*(anObject: Pointer): PPixmap = - result = cast[PPixmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_PIXMAP())) - -proc PIXMAP_CLASS*(klass: Pointer): PPixmapObjectClass = - result = cast[PPixmapObjectClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_PIXMAP())) - -proc IS_PIXMAP*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXMAP()) - -proc IS_PIXMAP_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_PIXMAP()) - -proc PIXMAP_GET_CLASS*(obj: Pointer): PPixmapObjectClass = - result = cast[PPixmapObjectClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_PIXMAP())) - -proc PIXMAP_OBJECT*(anObject: Pointer): PPixmapObject = - result = cast[PPixmapObject](PIXMAP(anObject)) - -proc bitmap_ref*(drawable: PDrawable): PDrawable = - result = DRAWABLE(g_object_ref(G_OBJECT(drawable))) - -proc bitmap_unref*(drawable: PDrawable) = - g_object_unref(G_OBJECT(drawable)) - -proc pixmap_ref*(drawable: PDrawable): PDrawable = - result = DRAWABLE(g_object_ref(G_OBJECT(drawable))) - -proc pixmap_unref*(drawable: PDrawable) = - g_object_unref(G_OBJECT(drawable)) - -proc rgb_get_cmap*(): PColormap = - result = nil #gdk_rgb_get_colormap() - -proc TYPE_DISPLAY*(): GType = - nil - #result = nil - -proc DISPLAY_OBJECT*(anObject: pointer): PDisplay = - result = cast[PDisplay](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_DISPLAY())) - -proc DISPLAY_CLASS*(klass: pointer): PDisplayClass = - result = cast[PDisplayClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_DISPLAY())) - -proc IS_DISPLAY*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_DISPLAY()) - -proc IS_DISPLAY_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_DISPLAY()) - -proc DISPLAY_GET_CLASS*(obj: pointer): PDisplayClass = - result = cast[PDisplayClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_DISPLAY())) - -proc TYPE_SCREEN*(): GType = - nil - -proc SCREEN*(anObject: Pointer): PScreen = - result = cast[PScreen](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_SCREEN())) - -proc SCREEN_CLASS*(klass: Pointer): PScreenClass = - result = cast[PScreenClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_SCREEN())) - -proc IS_SCREEN*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_SCREEN()) - -proc IS_SCREEN_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_SCREEN()) - -proc SCREEN_GET_CLASS*(obj: Pointer): PScreenClass = - result = cast[PScreenClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_SCREEN())) - -proc SELECTION_PRIMARY*(): TAtom = - result = `MAKE_ATOM`(1) - -proc SELECTION_SECONDARY*(): TAtom = - result = `MAKE_ATOM`(2) - -proc SELECTION_CLIPBOARD*(): TAtom = - result = `MAKE_ATOM`(69) - -proc TARGET_BITMAP*(): TAtom = - result = `MAKE_ATOM`(5) - -proc TARGET_COLORMAP*(): TAtom = - result = `MAKE_ATOM`(7) - -proc TARGET_DRAWABLE*(): TAtom = - result = `MAKE_ATOM`(17) - -proc TARGET_PIXMAP*(): TAtom = - result = `MAKE_ATOM`(20) - -proc TARGET_STRING*(): TAtom = - result = `MAKE_ATOM`(31) - -proc SELECTION_TYPE_ATOM*(): TAtom = - result = `MAKE_ATOM`(4) - -proc SELECTION_TYPE_BITMAP*(): TAtom = - result = `MAKE_ATOM`(5) - -proc SELECTION_TYPE_COLORMAP*(): TAtom = - result = `MAKE_ATOM`(7) - -proc SELECTION_TYPE_DRAWABLE*(): TAtom = - result = `MAKE_ATOM`(17) - -proc SELECTION_TYPE_INTEGER*(): TAtom = - result = `MAKE_ATOM`(19) - -proc SELECTION_TYPE_PIXMAP*(): TAtom = - result = `MAKE_ATOM`(20) - -proc SELECTION_TYPE_WINDOW*(): TAtom = - result = `MAKE_ATOM`(33) - -proc SELECTION_TYPE_STRING*(): TAtom = - result = `MAKE_ATOM`(31) - -proc ATOM_TO_POINTER*(atom: TAtom): pointer = - result = cast[Pointer](atom) - -proc POINTER_TO_ATOM*(p: Pointer): TAtom = - result = cast[TAtom](p) - -proc `MAKE_ATOM`*(val: guint): TAtom = - result = cast[TAtom](val) - -proc NONE*(): TAtom = - result = `MAKE_ATOM`(0) - -proc TYPE_VISUAL*(): GType = - result = visual_get_type() - -proc VISUAL*(anObject: Pointer): PVisual = - result = cast[PVisual](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_VISUAL())) - -proc VISUAL_CLASS*(klass: Pointer): PVisualClass = - result = cast[PVisualClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_VISUAL())) - -proc IS_VISUAL*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_VISUAL()) - -proc IS_VISUAL_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_VISUAL()) - -proc VISUAL_GET_CLASS*(obj: Pointer): PVisualClass = - result = cast[PVisualClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_VISUAL())) - -proc reference*(v: PVisual) = - discard g_object_ref(v) - -proc unref*(v: PVisual) = - g_object_unref(v) - -proc TYPE_WINDOW*(): GType = - result = window_object_get_type() - -proc WINDOW*(anObject: Pointer): PWindow = - result = cast[PWindow](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_WINDOW())) - -proc WINDOW_CLASS*(klass: Pointer): PWindowObjectClass = - result = cast[PWindowObjectClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_WINDOW())) - -proc IS_WINDOW*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_WINDOW()) - -proc IS_WINDOW_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_WINDOW()) - -proc WINDOW_GET_CLASS*(obj: Pointer): PWindowObjectClass = - result = cast[PWindowObjectClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_WINDOW())) - -proc WINDOW_OBJECT*(anObject: Pointer): PWindowObject = - result = cast[PWindowObject](WINDOW(anObject)) - -proc WindowObject_guffaw_gravity*(a: PWindowObject): guint = - result = (a.flag0 and bm_TWindowObject_guffaw_gravity) shr - bp_TWindowObject_guffaw_gravity - -proc WindowObject_set_guffaw_gravity*(a: PWindowObject, - `guffaw_gravity`: guint) = - a.flag0 = a.flag0 or - (int16(`guffaw_gravity` shl bp_TWindowObject_guffaw_gravity) and - bm_TWindowObject_guffaw_gravity) - -proc WindowObject_input_only*(a: PWindowObject): guint = - result = (a.flag0 and bm_TWindowObject_input_only) shr - bp_TWindowObject_input_only - -proc WindowObject_set_input_only*(a: PWindowObject, `input_only`: guint) = - a.flag0 = a.flag0 or - (int16(`input_only` shl bp_TWindowObject_input_only) and - bm_TWindowObject_input_only) - -proc WindowObject_modal_hint*(a: PWindowObject): guint = - result = (a.flag0 and bm_TWindowObject_modal_hint) shr - bp_TWindowObject_modal_hint - -proc WindowObject_set_modal_hint*(a: PWindowObject, `modal_hint`: guint) = - a.flag0 = a.flag0 or - (int16(`modal_hint` shl bp_TWindowObject_modal_hint) and - bm_TWindowObject_modal_hint) - -proc WindowObject_destroyed*(a: PWindowObject): guint = - result = (a.flag0 and bm_TWindowObject_destroyed) shr - bp_TWindowObject_destroyed - -proc WindowObject_set_destroyed*(a: PWindowObject, `destroyed`: guint) = - a.flag0 = a.flag0 or - (int16(`destroyed` shl bp_TWindowObject_destroyed) and - bm_TWindowObject_destroyed) - -proc ROOT_PARENT*(): PWindow = - result = get_default_root_window() - -proc window_get_size*(drawable: PDrawable, width: Pgint, height: Pgint) = - get_size(drawable, width, height) - -proc get_type*(window: PWindow): TWindowType = - result = get_window_type(window) - -proc window_get_colormap*(drawable: PDrawable): PColormap = - result = get_colormap(drawable) - -proc window_set_colormap*(drawable: PDrawable, colormap: PColormap) = - set_colormap(drawable, colormap) - -proc window_get_visual*(drawable: PDrawable): PVisual = - result = get_visual(drawable) - -proc window_ref*(drawable: PDrawable): PDrawable = - result = DRAWABLE(g_object_ref(G_OBJECT(drawable))) - -proc window_unref*(drawable: PDrawable) = - g_object_unref(G_OBJECT(drawable)) - -proc window_copy_area*(drawable: PDrawable, gc: PGC, x, y: gint, - source_drawable: PDrawable, source_x, source_y: gint, - width, height: gint) = - pixmap(drawable, gc, source_drawable, source_x, source_y, x, y, width, - height) diff --git a/lib/wrappers/gtk/gdk2pixbuf.nim b/lib/wrappers/gtk/gdk2pixbuf.nim deleted file mode 100644 index ee50317f8..000000000 --- a/lib/wrappers/gtk/gdk2pixbuf.nim +++ /dev/null @@ -1,271 +0,0 @@ -{.deadCodeElim: on.} -import - glib2 - -when defined(win32): - const - pixbuflib = "libgdk_pixbuf-2.0-0.dll" -elif defined(macosx): - const - pixbuflib = "libgdk_pixbuf-2.0.0.dylib" - # linklib gtk-x11-2.0 - # linklib gdk-x11-2.0 - # linklib pango-1.0.0 - # linklib glib-2.0.0 - # linklib gobject-2.0.0 - # linklib gdk_pixbuf-2.0.0 - # linklib atk-1.0.0 -else: - const - pixbuflib = "libgdk_pixbuf-2.0.so" -type - PPixbuf* = pointer - PPixbufAnimation* = pointer - PPixbufAnimationIter* = pointer - PPixbufAlphaMode* = ptr TPixbufAlphaMode - TPixbufAlphaMode* = enum - PIXBUF_ALPHA_BILEVEL, PIXBUF_ALPHA_FULL - PColorspace* = ptr TColorspace - TColorspace* = enum - COLORSPACE_RGB - TPixbufDestroyNotify* = proc (pixels: Pguchar, data: gpointer){.cdecl.} - PPixbufError* = ptr TPixbufError - TPixbufError* = enum - PIXBUF_ERROR_CORRUPT_IMAGE, PIXBUF_ERROR_INSUFFICIENT_MEMORY, - PIXBUF_ERROR_BAD_OPTION, PIXBUF_ERROR_UNKNOWN_TYPE, - PIXBUF_ERROR_UNSUPPORTED_OPERATION, PIXBUF_ERROR_FAILED - PInterpType* = ptr TInterpType - TInterpType* = enum - INTERP_NEAREST, INTERP_TILES, INTERP_BILINEAR, INTERP_HYPER - -proc TYPE_PIXBUF*(): GType -proc PIXBUF*(anObject: pointer): PPixbuf -proc IS_PIXBUF*(anObject: pointer): bool -proc TYPE_PIXBUF_ANIMATION*(): GType -proc PIXBUF_ANIMATION*(anObject: pointer): PPixbufAnimation -proc IS_PIXBUF_ANIMATION*(anObject: pointer): bool -proc TYPE_PIXBUF_ANIMATION_ITER*(): GType -proc PIXBUF_ANIMATION_ITER*(anObject: pointer): PPixbufAnimationIter -proc IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool -proc PIXBUF_ERROR*(): TGQuark -proc pixbuf_error_quark*(): TGQuark{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_error_quark".} -proc pixbuf_get_type*(): GType{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_type".} -when not defined(PIXBUF_DISABLE_DEPRECATED): - proc pixbuf_ref*(pixbuf: PPixbuf): PPixbuf{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_ref".} - proc pixbuf_unref*(pixbuf: PPixbuf){.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_unref".} -proc get_colorspace*(pixbuf: PPixbuf): TColorspace{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_get_colorspace".} -proc get_n_channels*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_n_channels".} -proc get_has_alpha*(pixbuf: PPixbuf): gboolean{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_has_alpha".} -proc get_bits_per_sample*(pixbuf: PPixbuf): int32{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_get_bits_per_sample".} -proc get_pixels*(pixbuf: PPixbuf): Pguchar{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_pixels".} -proc get_width*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_width".} -proc get_height*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_height".} -proc get_rowstride*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_get_rowstride".} -proc pixbuf_new*(colorspace: TColorspace, has_alpha: gboolean, - bits_per_sample: int32, width: int32, height: int32): PPixbuf{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_new".} -proc copy*(pixbuf: PPixbuf): PPixbuf{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_copy".} -proc new_subpixbuf*(src_pixbuf: PPixbuf, src_x: int32, src_y: int32, - width: int32, height: int32): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_new_subpixbuf".} -proc pixbuf_new_from_file*(filename: cstring, error: pointer): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_file".} -proc pixbuf_new_from_data*(data: Pguchar, colorspace: TColorspace, - has_alpha: gboolean, bits_per_sample: int32, - width: int32, height: int32, rowstride: int32, - destroy_fn: TPixbufDestroyNotify, - destroy_fn_data: gpointer): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_data".} -proc pixbuf_new_from_xpm_data*(data: PPchar): PPixbuf{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_new_from_xpm_data".} -proc pixbuf_new_from_inline*(data_length: gint, a: var guint8, - copy_pixels: gboolean, error: pointer): PPixbuf{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_inline".} -proc pixbuf_new_from_file_at_size*(filename: cstring, width, height: gint, - error: pointer): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_file_at_size".} -proc pixbuf_new_from_file_at_scale*(filename: cstring, width, height: gint, - preserve_aspect_ratio: gboolean, - error: pointer): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_file_at_scale".} -proc fill*(pixbuf: PPixbuf, pixel: guint32){.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_fill".} -proc save*(pixbuf: PPixbuf, filename: cstring, `type`: cstring, - error: pointer): gboolean{.cdecl, varargs, dynlib: pixbuflib, - importc: "gdk_pixbuf_save".} -proc savev*(pixbuf: PPixbuf, filename: cstring, `type`: cstring, - option_keys: PPchar, option_values: PPchar, error: pointer): gboolean{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_savev".} -proc add_alpha*(pixbuf: PPixbuf, substitute_color: gboolean, r: guchar, - g: guchar, b: guchar): PPixbuf{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_add_alpha".} -proc copy_area*(src_pixbuf: PPixbuf, src_x: int32, src_y: int32, - width: int32, height: int32, dest_pixbuf: PPixbuf, - dest_x: int32, dest_y: int32){.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_copy_area".} -proc saturate_and_pixelate*(src: PPixbuf, dest: PPixbuf, - saturation: gfloat, pixelate: gboolean){. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_saturate_and_pixelate".} -proc scale*(src: PPixbuf, dest: PPixbuf, dest_x: int32, dest_y: int32, - dest_width: int32, dest_height: int32, offset_x: float64, - offset_y: float64, scale_x: float64, scale_y: float64, - interp_type: TInterpType){.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_scale".} -proc composite*(src: PPixbuf, dest: PPixbuf, dest_x: int32, - dest_y: int32, dest_width: int32, dest_height: int32, - offset_x: float64, offset_y: float64, scale_x: float64, - scale_y: float64, interp_type: TInterpType, - overall_alpha: int32){.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_composite".} -proc composite_color*(src: PPixbuf, dest: PPixbuf, dest_x: int32, - dest_y: int32, dest_width: int32, - dest_height: int32, offset_x: float64, - offset_y: float64, scale_x: float64, - scale_y: float64, interp_type: TInterpType, - overall_alpha: int32, check_x: int32, - check_y: int32, check_size: int32, color1: guint32, - color2: guint32){.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_composite_color".} -proc scale_simple*(src: PPixbuf, dest_width: int32, dest_height: int32, - interp_type: TInterpType): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_scale_simple".} -proc composite_color_simple*(src: PPixbuf, dest_width: int32, - dest_height: int32, - interp_type: TInterpType, - overall_alpha: int32, check_size: int32, - color1: guint32, color2: guint32): PPixbuf{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_composite_color_simple".} -proc pixbuf_animation_get_type*(): GType{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_animation_get_type".} -proc pixbuf_animation_new_from_file*(filename: cstring, error: pointer): PPixbufAnimation{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_new_from_file".} -when not defined(PIXBUF_DISABLE_DEPRECATED): - proc pixbuf_animation_ref*(animation: PPixbufAnimation): PPixbufAnimation{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_ref".} - proc pixbuf_animation_unref*(animation: PPixbufAnimation){.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_animation_unref".} -proc get_width*(animation: PPixbufAnimation): int32{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_width".} -proc get_height*(animation: PPixbufAnimation): int32{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_height".} -proc is_static_image*(animation: PPixbufAnimation): gboolean{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_is_static_image".} -proc get_static_image*(animation: PPixbufAnimation): PPixbuf{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_static_image".} -proc get_iter*(animation: PPixbufAnimation, e: var TGTimeVal): PPixbufAnimationIter{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_iter".} -proc pixbuf_animation_iter_get_type*(): GType{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_animation_iter_get_type".} -proc iter_get_delay_time*(iter: PPixbufAnimationIter): int32{. - cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_animation_iter_get_delay_time".} -proc iter_get_pixbuf*(iter: PPixbufAnimationIter): PPixbuf{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_iter_get_pixbuf".} -proc pixbuf_animation_iter_on_currently_loading_frame*( - iter: PPixbufAnimationIter): gboolean{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_animation_iter_on_currently_loading_frame".} -proc iter_advance*(iter: PPixbufAnimationIter, e: var TGTimeVal): gboolean{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_iter_advance".} -proc get_option*(pixbuf: PPixbuf, key: cstring): cstring{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_get_option".} -type - PPixbufLoader* = ptr TPixbufLoader - TPixbufLoader*{.final, pure.} = object - parent_instance*: TGObject - priv*: gpointer - - PPixbufLoaderClass* = ptr TPixbufLoaderClass - TPixbufLoaderClass*{.final, pure.} = object - parent_class*: TGObjectClass - area_prepared*: proc (loader: PPixbufLoader){.cdecl.} - area_updated*: proc (loader: PPixbufLoader, x: int32, y: int32, - width: int32, height: int32){.cdecl.} - closed*: proc (loader: PPixbufLoader){.cdecl.} - - -proc TYPE_PIXBUF_LOADER*(): GType -proc PIXBUF_LOADER*(obj: pointer): PPixbufLoader -proc PIXBUF_LOADER_CLASS*(klass: pointer): PPixbufLoaderClass -proc IS_PIXBUF_LOADER*(obj: pointer): bool -proc IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool -proc PIXBUF_LOADER_GET_CLASS*(obj: pointer): PPixbufLoaderClass -proc pixbuf_loader_get_type*(): GType{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_loader_get_type".} -proc pixbuf_loader_new*(): PPixbufLoader{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_loader_new".} -proc pixbuf_loader_new*(image_type: cstring, error: pointer): PPixbufLoader{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_loader_new_with_type".} -proc write*(loader: PPixbufLoader, buf: Pguchar, count: gsize, - error: pointer): gboolean{.cdecl, dynlib: pixbuflib, - importc: "gdk_pixbuf_loader_write".} -proc get_pixbuf*(loader: PPixbufLoader): PPixbuf{.cdecl, - dynlib: pixbuflib, importc: "gdk_pixbuf_loader_get_pixbuf".} -proc get_animation*(loader: PPixbufLoader): PPixbufAnimation{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_loader_get_animation".} -proc close*(loader: PPixbufLoader, error: pointer): gboolean{. - cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_loader_close".} -proc TYPE_PIXBUF_LOADER*(): GType = - result = pixbuf_loader_get_type() - -proc PIXBUF_LOADER*(obj: pointer): PPixbufLoader = - result = cast[PPixbufLoader](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_PIXBUF_LOADER())) - -proc PIXBUF_LOADER_CLASS*(klass: pointer): PPixbufLoaderClass = - result = cast[PPixbufLoaderClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_PIXBUF_LOADER())) - -proc IS_PIXBUF_LOADER*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_PIXBUF_LOADER()) - -proc IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_PIXBUF_LOADER()) - -proc PIXBUF_LOADER_GET_CLASS*(obj: pointer): PPixbufLoaderClass = - result = cast[PPixbufLoaderClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_PIXBUF_LOADER())) - -proc TYPE_PIXBUF*(): GType = - result = pixbuf_get_type() - -proc PIXBUF*(anObject: pointer): PPixbuf = - result = cast[PPixbuf](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_PIXBUF())) - -proc IS_PIXBUF*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXBUF()) - -proc TYPE_PIXBUF_ANIMATION*(): GType = - result = pixbuf_animation_get_type() - -proc PIXBUF_ANIMATION*(anObject: pointer): PPixbufAnimation = - result = cast[PPixbufAnimation](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_PIXBUF_ANIMATION())) - -proc IS_PIXBUF_ANIMATION*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXBUF_ANIMATION()) - -proc TYPE_PIXBUF_ANIMATION_ITER*(): GType = - result = pixbuf_animation_iter_get_type() - -proc PIXBUF_ANIMATION_ITER*(anObject: pointer): PPixbufAnimationIter = - result = cast[PPixbufAnimationIter](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_PIXBUF_ANIMATION_ITER())) - -proc IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXBUF_ANIMATION_ITER()) - -proc PIXBUF_ERROR*(): TGQuark = - result = pixbuf_error_quark() diff --git a/lib/wrappers/gtk/gdkglext.nim b/lib/wrappers/gtk/gdkglext.nim deleted file mode 100644 index 0d550c6e2..000000000 --- a/lib/wrappers/gtk/gdkglext.nim +++ /dev/null @@ -1,554 +0,0 @@ -{.deadCodeElim: on.} -import - Glib2, gdk2 - -when defined(WIN32): - const - GLExtLib = "libgdkglext-win32-1.0-0.dll" -elif defined(macosx): - const - GLExtLib = "libgdkglext-x11-1.0.dylib" -else: - const - GLExtLib = "libgdkglext-x11-1.0.so" -type - TGLConfigAttrib* = int32 - TGLConfigCaveat* = int32 - TGLVisualType* = int32 - TGLTransparentType* = int32 - TGLDrawableTypeMask* = int32 - TGLRenderTypeMask* = int32 - TGLBufferMask* = int32 - TGLConfigError* = int32 - TGLRenderType* = int32 - TGLDrawableAttrib* = int32 - TGLPbufferAttrib* = int32 - TGLEventMask* = int32 - TGLEventType* = int32 - TGLDrawableType* = int32 - TGLProc* = Pointer - PGLConfig* = ptr TGLConfig - PGLContext* = ptr TGLContext - PGLDrawable* = ptr TGLDrawable - PGLPixmap* = ptr TGLPixmap - PGLWindow* = ptr TGLWindow - TGLConfig* = object of TGObject - layer_plane*: gint - n_aux_buffers*: gint - n_sample_buffers*: gint - flag0*: int16 - - PGLConfigClass* = ptr TGLConfigClass - TGLConfigClass* = object of TGObjectClass - TGLContext* = object of TGObject - PGLContextClass* = ptr TGLContextClass - TGLContextClass* = object of TGObjectClass - TGLDrawable* = object of TGObject - PGLDrawableClass* = ptr TGLDrawableClass - TGLDrawableClass* = object of TGTypeInterface - create_new_context*: proc (gldrawable: PGLDrawable, share_list: PGLContext, - direct: gboolean, render_type: int32): PGLContext{. - cdecl.} - make_context_current*: proc (draw: PGLDrawable, a_read: PGLDrawable, - glcontext: PGLContext): gboolean{.cdecl.} - is_double_buffered*: proc (gldrawable: PGLDrawable): gboolean{.cdecl.} - swap_buffers*: proc (gldrawable: PGLDrawable){.cdecl.} - wait_gl*: proc (gldrawable: PGLDrawable){.cdecl.} - wait_gdk*: proc (gldrawable: PGLDrawable){.cdecl.} - gl_begin*: proc (draw: PGLDrawable, a_read: PGLDrawable, - glcontext: PGLContext): gboolean{.cdecl.} - gl_end*: proc (gldrawable: PGLDrawable){.cdecl.} - get_gl_config*: proc (gldrawable: PGLDrawable): PGLConfig{.cdecl.} - get_size*: proc (gldrawable: PGLDrawable, width, height: PGInt){.cdecl.} - - TGLPixmap* = object of TGObject - drawable*: PDrawable - - PGLPixmapClass* = ptr TGLPixmapClass - TGLPixmapClass* = object of TGObjectClass - TGLWindow* = object of TGObject - drawable*: PDrawable - - PGLWindowClass* = ptr TGLWindowClass - TGLWindowClass* = object of TGObjectClass - -const - HEADER_GDKGLEXT_MAJOR_VERSION* = 1 - HEADER_GDKGLEXT_MINOR_VERSION* = 0 - HEADER_GDKGLEXT_MICRO_VERSION* = 6 - HEADER_GDKGLEXT_INTERFACE_AGE* = 4 - HEADER_GDKGLEXT_BINARY_AGE* = 6 - -proc HEADER_GDKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool -var - glext_major_version*{.importc, dynlib: GLExtLib.}: guint - glext_minor_version*{.importc, dynlib: GLExtLib.}: guint - glext_micro_version*{.importc, dynlib: GLExtLib.}: guint - glext_interface_age*{.importc, dynlib: GLExtLib.}: guint - glext_binary_age*{.importc, dynlib: GLExtLib.}: guint - -const - GL_SUCCESS* = 0 - GL_ATTRIB_LIST_NONE* = 0 - GL_USE_GL* = 1 - GL_BUFFER_SIZE* = 2 - GL_LEVEL* = 3 - GL_RGBA* = 4 - GL_DOUBLEBUFFER* = 5 - GL_STEREO* = 6 - GL_AUX_BUFFERS* = 7 - GL_RED_SIZE* = 8 - GL_GREEN_SIZE* = 9 - GL_BLUE_SIZE* = 10 - GL_ALPHA_SIZE* = 11 - GL_DEPTH_SIZE* = 12 - GL_STENCIL_SIZE* = 13 - GL_ACCUM_RED_SIZE* = 14 - GL_ACCUM_GREEN_SIZE* = 15 - GL_ACCUM_BLUE_SIZE* = 16 - GL_ACCUM_ALPHA_SIZE* = 17 - GL_CONFIG_CAVEAT* = 0x00000020 - GL_X_VISUAL_TYPE* = 0x00000022 - GL_TRANSPARENT_TYPE* = 0x00000023 - GL_TRANSPARENT_INDEX_VALUE* = 0x00000024 - GL_TRANSPARENT_RED_VALUE* = 0x00000025 - GL_TRANSPARENT_GREEN_VALUE* = 0x00000026 - GL_TRANSPARENT_BLUE_VALUE* = 0x00000027 - GL_TRANSPARENT_ALPHA_VALUE* = 0x00000028 - GL_DRAWABLE_TYPE* = 0x00008010 - GL_RENDER_TYPE* = 0x00008011 - GL_X_RENDERABLE* = 0x00008012 - GL_FBCONFIG_ID* = 0x00008013 - GL_MAX_PBUFFER_WIDTH* = 0x00008016 - GL_MAX_PBUFFER_HEIGHT* = 0x00008017 - GL_MAX_PBUFFER_PIXELS* = 0x00008018 - GL_VISUAL_ID* = 0x0000800B - GL_SCREEN* = 0x0000800C - GL_SAMPLE_BUFFERS* = 100000 - GL_SAMPLES* = 100001 - GL_DONT_CARE* = 0xFFFFFFFF - GL_NONE* = 0x00008000 - GL_CONFIG_CAVEAT_DONT_CARE* = 0xFFFFFFFF - GL_CONFIG_CAVEAT_NONE* = 0x00008000 - GL_SLOW_CONFIG* = 0x00008001 - GL_NON_CONFORMANT_CONFIG* = 0x0000800D - GL_VISUAL_TYPE_DONT_CARE* = 0xFFFFFFFF - GL_TRUE_COLOR* = 0x00008002 - GL_DIRECT_COLOR* = 0x00008003 - GL_PSEUDO_COLOR* = 0x00008004 - GL_STATIC_COLOR* = 0x00008005 - GL_GRAY_SCALE* = 0x00008006 - GL_STATIC_GRAY* = 0x00008007 - GL_TRANSPARENT_NONE* = 0x00008000 - GL_TRANSPARENT_RGB* = 0x00008008 - GL_TRANSPARENT_INDEX* = 0x00008009 - GL_WINDOW_BIT* = 1 shl 0 - GL_PIXMAP_BIT* = 1 shl 1 - GL_PBUFFER_BIT* = 1 shl 2 - GL_RGBA_BIT* = 1 shl 0 - GL_COLOR_INDEX_BIT* = 1 shl 1 - GL_FRONT_LEFT_BUFFER_BIT* = 1 shl 0 - GL_FRONT_RIGHT_BUFFER_BIT* = 1 shl 1 - GL_BACK_LEFT_BUFFER_BIT* = 1 shl 2 - GL_BACK_RIGHT_BUFFER_BIT* = 1 shl 3 - GL_AUX_BUFFERS_BIT* = 1 shl 4 - GL_DEPTH_BUFFER_BIT* = 1 shl 5 - GL_STENCIL_BUFFER_BIT* = 1 shl 6 - GL_ACCUM_BUFFER_BIT* = 1 shl 7 - GL_BAD_SCREEN* = 1 - GL_BAD_ATTRIBUTE* = 2 - GL_NO_EXTENSION* = 3 - GL_BAD_VISUAL* = 4 - GL_BAD_CONTEXT* = 5 - GL_BAD_VALUE* = 6 - GL_BAD_ENUM* = 7 - GL_RGBA_TYPE* = 0x00008014 - GL_COLOR_INDEX_TYPE* = 0x00008015 - GL_PRESERVED_CONTENTS* = 0x0000801B - GL_LARGEST_PBUFFER* = 0x0000801C - GL_WIDTH* = 0x0000801D - GL_HEIGHT* = 0x0000801E - GL_EVENT_MASK* = 0x0000801F - GL_PBUFFER_PRESERVED_CONTENTS* = 0x0000801B - GL_PBUFFER_LARGEST_PBUFFER* = 0x0000801C - GL_PBUFFER_HEIGHT* = 0x00008040 - GL_PBUFFER_WIDTH* = 0x00008041 - GL_PBUFFER_CLOBBER_MASK* = 1 shl 27 - GL_DAMAGED* = 0x00008020 - GL_SAVED* = 0x00008021 - GL_WINDOW_VALUE* = 0x00008022 - GL_PBUFFER* = 0x00008023 - -proc gl_config_attrib_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_attrib_get_type".} -proc TYPE_GL_CONFIG_ATTRIB*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_attrib_get_type".} -proc gl_config_caveat_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_caveat_get_type".} -proc TYPE_GL_CONFIG_CAVEAT*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_caveat_get_type".} -proc gl_visual_type_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_visual_type_get_type".} -proc TYPE_GL_VISUAL_TYPE*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_visual_type_get_type".} -proc gl_transparent_type_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_transparent_type_get_type".} -proc TYPE_GL_TRANSPARENT_TYPE*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_transparent_type_get_type".} -proc gl_drawable_type_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_type_mask_get_type".} -proc TYPE_GL_DRAWABLE_TYPE_MASK*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_type_mask_get_type".} -proc gl_render_type_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_render_type_mask_get_type".} -proc TYPE_GL_RENDER_TYPE_MASK*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_render_type_mask_get_type".} -proc gl_buffer_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_buffer_mask_get_type".} -proc TYPE_GL_BUFFER_MASK*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_buffer_mask_get_type".} -proc gl_config_error_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_error_get_type".} -proc TYPE_GL_CONFIG_ERROR*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_error_get_type".} -proc gl_render_type_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_render_type_get_type".} -proc TYPE_GL_RENDER_TYPE*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_render_type_get_type".} -proc gl_drawable_attrib_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_attrib_get_type".} -proc TYPE_GL_DRAWABLE_ATTRIB*(): GType{.cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_attrib_get_type".} -proc gl_pbuffer_attrib_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_pbuffer_attrib_get_type".} -proc TYPE_GL_PBUFFER_ATTRIB*(): GType{.cdecl, dynlib: GLExtLib, importc: "gdk_gl_pbuffer_attrib_get_type".} -proc gl_event_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_event_mask_get_type".} -proc TYPE_GL_EVENT_MASK*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_event_mask_get_type".} -proc gl_event_type_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_event_type_get_type".} -proc TYPE_GL_EVENT_TYPE*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_event_type_get_type".} -proc gl_drawable_type_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_type_get_type".} -proc TYPE_GL_DRAWABLE_TYPE*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_type_get_type".} -proc gl_config_mode_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_mode_get_type".} -proc TYPE_GL_CONFIG_MODE*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_mode_get_type".} -proc gl_parse_args*(argc: var int32, argv: ptr cstringArray): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_parse_args".} -proc gl_init_check*(argc: var int32, argv: ptr cstringArray): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_init_check".} -proc gl_init*(argc: var int32, argv: ptr cstringArray){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_init".} -proc gl_query_gl_extension*(extension: cstring): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_query_gl_extension".} -proc gl_get_proc_address*(proc_name: cstring): TGLProc{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_get_proc_address".} -const - bm_TGdkGLConfig_is_rgba* = 1 shl 0 - bp_TGdkGLConfig_is_rgba* = 0 - bm_TGdkGLConfig_is_double_buffered* = 1 shl 1 - bp_TGdkGLConfig_is_double_buffered* = 1 - bm_TGdkGLConfig_as_single_mode* = 1 shl 2 - bp_TGdkGLConfig_as_single_mode* = 2 - bm_TGdkGLConfig_is_stereo* = 1 shl 3 - bp_TGdkGLConfig_is_stereo* = 3 - bm_TGdkGLConfig_has_alpha* = 1 shl 4 - bp_TGdkGLConfig_has_alpha* = 4 - bm_TGdkGLConfig_has_depth_buffer* = 1 shl 5 - bp_TGdkGLConfig_has_depth_buffer* = 5 - bm_TGdkGLConfig_has_stencil_buffer* = 1 shl 6 - bp_TGdkGLConfig_has_stencil_buffer* = 6 - bm_TGdkGLConfig_has_accum_buffer* = 1 shl 7 - bp_TGdkGLConfig_has_accum_buffer* = 7 - -const - GL_MODE_RGB* = 0 - GL_MODE_RGBA* = 0 - GL_MODE_INDEX* = 1 shl 0 - GL_MODE_SINGLE* = 0 - GL_MODE_DOUBLE* = 1 shl 1 - GL_MODE_STEREO* = 1 shl 2 - GL_MODE_ALPHA* = 1 shl 3 - GL_MODE_DEPTH* = 1 shl 4 - GL_MODE_STENCIL* = 1 shl 5 - GL_MODE_ACCUM* = 1 shl 6 - GL_MODE_MULTISAMPLE* = 1 shl 7 - -type - TGLConfigMode* = int32 - PGLConfigMode* = ptr TGLConfigMode - -proc TYPE_GL_CONFIG*(): GType -proc GL_CONFIG*(anObject: Pointer): PGLConfig -proc GL_CONFIG_CLASS*(klass: Pointer): PGLConfigClass -proc IS_GL_CONFIG*(anObject: Pointer): bool -proc IS_GL_CONFIG_CLASS*(klass: Pointer): bool -proc GL_CONFIG_GET_CLASS*(obj: Pointer): PGLConfigClass -proc gl_config_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_get_type".} -proc get_screen*(glconfig: PGLConfig): PScreen{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_get_screen".} -proc get_attrib*(glconfig: PGLConfig, attribute: int, value: var cint): gboolean{. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_config_get_attrib".} -proc get_colormap*(glconfig: PGLConfig): PColormap{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_get_colormap".} -proc get_visual*(glconfig: PGLConfig): PVisual{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_get_visual".} -proc get_depth*(glconfig: PGLConfig): gint{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_get_depth".} -proc get_layer_plane*(glconfig: PGLConfig): gint{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_get_layer_plane".} -proc get_n_aux_buffers*(glconfig: PGLConfig): gint{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_get_n_aux_buffers".} -proc get_n_sample_buffers*(glconfig: PGLConfig): gint{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_get_n_sample_buffers".} -proc is_rgba*(glconfig: PGLConfig): gboolean{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_config_is_rgba".} -proc is_double_buffered*(glconfig: PGLConfig): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_is_double_buffered".} -proc is_stereo*(glconfig: PGLConfig): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_is_stereo".} -proc has_alpha*(glconfig: PGLConfig): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_has_alpha".} -proc has_depth_buffer*(glconfig: PGLConfig): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_has_depth_buffer".} -proc has_stencil_buffer*(glconfig: PGLConfig): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_has_stencil_buffer".} -proc has_accum_buffer*(glconfig: PGLConfig): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_config_has_accum_buffer".} -proc TYPE_GL_CONTEXT*(): GType -proc GL_CONTEXT*(anObject: Pointer): PGLContext -proc GL_CONTEXT_CLASS*(klass: Pointer): PGLContextClass -proc IS_GL_CONTEXT*(anObject: Pointer): bool -proc IS_GL_CONTEXT_CLASS*(klass: Pointer): bool -proc GL_CONTEXT_GET_CLASS*(obj: Pointer): PGLContextClass -proc gl_context_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_context_get_type".} -proc context_new*(gldrawable: PGLDrawable, share_list: PGLContext, - direct: gboolean, render_type: int32): PGLContext{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_context_new".} -proc destroy*(glcontext: PGLContext){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_context_destroy".} -proc copy*(glcontext: PGLContext, src: PGLContext, mask: int32): gboolean{. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_context_copy".} -proc get_gl_drawable*(glcontext: PGLContext): PGLDrawable{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_context_get_gl_drawable".} -proc get_gl_config*(glcontext: PGLContext): PGLConfig{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_context_get_gl_config".} -proc get_share_list*(glcontext: PGLContext): PGLContext{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_context_get_share_list".} -proc is_direct*(glcontext: PGLContext): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_context_is_direct".} -proc get_render_type*(glcontext: PGLContext): int32{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_context_get_render_type".} -proc gl_context_get_current*(): PGLContext{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_context_get_current".} -proc TYPE_GL_DRAWABLE*(): GType -proc GL_DRAWABLE*(inst: Pointer): PGLDrawable -proc GL_DRAWABLE_CLASS*(vtable: Pointer): PGLDrawableClass -proc IS_GL_DRAWABLE*(inst: Pointer): bool -proc IS_GL_DRAWABLE_CLASS*(vtable: Pointer): bool -proc GL_DRAWABLE_GET_CLASS*(inst: Pointer): PGLDrawableClass -proc gl_drawable_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_get_type".} -proc make_current*(gldrawable: PGLDrawable, glcontext: PGLContext): gboolean{. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_make_current".} -proc is_double_buffered*(gldrawable: PGLDrawable): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_drawable_is_double_buffered".} -proc swap_buffers*(gldrawable: PGLDrawable){.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_drawable_swap_buffers".} -proc wait_gl*(gldrawable: PGLDrawable){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_wait_gl".} -proc wait_gdk*(gldrawable: PGLDrawable){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_wait_gdk".} -proc gl_begin*(gldrawable: PGLDrawable, glcontext: PGLContext): gboolean{. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_gl_begin".} -proc gl_end*(gldrawable: PGLDrawable){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_gl_end".} -proc get_gl_config*(gldrawable: PGLDrawable): PGLConfig{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_drawable_get_gl_config".} -proc get_size*(gldrawable: PGLDrawable, width, height: PGInt){. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_get_size".} -proc gl_drawable_get_current*(): PGLDrawable{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_drawable_get_current".} -proc TYPE_GL_PIXMAP*(): GType -proc GL_PIXMAP*(anObject: Pointer): PGLPixmap -proc GL_PIXMAP_CLASS*(klass: Pointer): PGLPixmapClass -proc IS_GL_PIXMAP*(anObject: Pointer): bool -proc IS_GL_PIXMAP_CLASS*(klass: Pointer): bool -proc GL_PIXMAP_GET_CLASS*(obj: Pointer): PGLPixmapClass -proc gl_pixmap_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_pixmap_get_type".} -proc pixmap_new*(glconfig: PGLConfig, pixmap: PPixmap, attrib_list: ptr int32): PGLPixmap{. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_pixmap_new".} -proc destroy*(glpixmap: PGLPixmap){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_pixmap_destroy".} -proc get_pixmap*(glpixmap: PGLPixmap): PPixmap{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_pixmap_get_pixmap".} -proc set_gl_capability*(pixmap: PPixmap, glconfig: PGLConfig, - attrib_list: ptr int32): PGLPixmap{.cdecl, - dynlib: GLExtLib, importc: "gdk_pixmap_set_gl_capability".} -proc unset_gl_capability*(pixmap: PPixmap){.cdecl, dynlib: GLExtLib, - importc: "gdk_pixmap_unset_gl_capability".} -proc is_gl_capable*(pixmap: PPixmap): gboolean{.cdecl, dynlib: GLExtLib, - importc: "gdk_pixmap_is_gl_capable".} -proc get_gl_pixmap*(pixmap: PPixmap): PGLPixmap{.cdecl, dynlib: GLExtLib, - importc: "gdk_pixmap_get_gl_pixmap".} -proc get_gl_drawable*(pixmap: PPixmap): PGLDrawable -proc TYPE_GL_WINDOW*(): GType -proc GL_WINDOW*(anObject: Pointer): PGLWindow -proc GL_WINDOW_CLASS*(klass: Pointer): PGLWindowClass -proc IS_GL_WINDOW*(anObject: Pointer): bool -proc IS_GL_WINDOW_CLASS*(klass: Pointer): bool -proc GL_WINDOW_GET_CLASS*(obj: Pointer): PGLWindowClass -proc gl_window_get_type*(): GType{.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_window_get_type".} -proc window_new*(glconfig: PGLConfig, window: PWindow, attrib_list: ptr int32): PGLWindow{. - cdecl, dynlib: GLExtLib, importc: "gdk_gl_window_new".} -proc destroy*(glwindow: PGLWindow){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_window_destroy".} -proc get_window*(glwindow: PGLWindow): PWindow{.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_window_get_window".} -proc set_gl_capability*(window: PWindow, glconfig: PGLConfig, - attrib_list: ptr int32): PGLWindow{.cdecl, - dynlib: GLExtLib, importc: "gdk_window_set_gl_capability".} -proc unset_gl_capability*(window: PWindow){.cdecl, dynlib: GLExtLib, - importc: "gdk_window_unset_gl_capability".} -proc is_gl_capable*(window: PWindow): gboolean{.cdecl, dynlib: GLExtLib, - importc: "gdk_window_is_gl_capable".} -proc get_gl_window*(window: PWindow): PGLWindow{.cdecl, dynlib: GLExtLib, - importc: "gdk_window_get_gl_window".} -proc get_gl_drawable*(window: PWindow): PGLDrawable -proc gl_draw_cube*(solid: gboolean, size: float64){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_cube".} -proc gl_draw_sphere*(solid: gboolean, radius: float64, slices: int32, - stacks: int32){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_sphere".} -proc gl_draw_cone*(solid: gboolean, base: float64, height: float64, - slices: int32, stacks: int32){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_cone".} -proc gl_draw_torus*(solid: gboolean, inner_radius: float64, - outer_radius: float64, nsides: int32, rings: int32){.cdecl, - dynlib: GLExtLib, importc: "gdk_gl_draw_torus".} -proc gl_draw_tetrahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_tetrahedron".} -proc gl_draw_octahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_octahedron".} -proc gl_draw_dodecahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_dodecahedron".} -proc gl_draw_icosahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_icosahedron".} -proc gl_draw_teapot*(solid: gboolean, scale: float64){.cdecl, dynlib: GLExtLib, - importc: "gdk_gl_draw_teapot".} -proc HEADER_GDKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool = - result = (HEADER_GDKGLEXT_MAJOR_VERSION > major) or - ((HEADER_GDKGLEXT_MAJOR_VERSION == major) and - (HEADER_GDKGLEXT_MINOR_VERSION > minor)) or - ((HEADER_GDKGLEXT_MAJOR_VERSION == major) and - (HEADER_GDKGLEXT_MINOR_VERSION == minor) and - (HEADER_GDKGLEXT_MICRO_VERSION >= micro)) - -proc TYPE_GL_CONFIG*(): GType = - result = gl_config_get_type() - -proc GL_CONFIG*(anObject: Pointer): PGLConfig = - result = cast[PGLConfig](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GL_CONFIG())) - -proc GL_CONFIG_CLASS*(klass: Pointer): PGLConfigClass = - result = cast[PGLConfigClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GL_CONFIG())) - -proc IS_GL_CONFIG*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_CONFIG()) - -proc IS_GL_CONFIG_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_CONFIG()) - -proc GL_CONFIG_GET_CLASS*(obj: Pointer): PGLConfigClass = - result = cast[PGLConfigClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GL_CONFIG())) - -proc TYPE_GL_CONTEXT*(): GType = - result = gl_context_get_type() - -proc GL_CONTEXT*(anObject: Pointer): PGLContext = - result = cast[PGLContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_GL_CONTEXT())) - -proc GL_CONTEXT_CLASS*(klass: Pointer): PGLContextClass = - result = cast[PGLContextClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_GL_CONTEXT())) - -proc IS_GL_CONTEXT*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_CONTEXT()) - -proc IS_GL_CONTEXT_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_CONTEXT()) - -proc GL_CONTEXT_GET_CLASS*(obj: Pointer): PGLContextClass = - result = cast[PGLContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_GL_CONTEXT())) - -proc TYPE_GL_DRAWABLE*(): GType = - result = gl_drawable_get_type() - -proc GL_DRAWABLE*(inst: Pointer): PGLDrawable = - result = cast[PGLDrawable](G_TYPE_CHECK_INSTANCE_CAST(inst, TYPE_GL_DRAWABLE())) - -proc GL_DRAWABLE_CLASS*(vtable: Pointer): PGLDrawableClass = - result = cast[PGLDrawableClass](G_TYPE_CHECK_CLASS_CAST(vtable, - TYPE_GL_DRAWABLE())) - -proc IS_GL_DRAWABLE*(inst: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(inst, TYPE_GL_DRAWABLE()) - -proc IS_GL_DRAWABLE_CLASS*(vtable: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(vtable, TYPE_GL_DRAWABLE()) - -proc GL_DRAWABLE_GET_CLASS*(inst: Pointer): PGLDrawableClass = - result = cast[PGLDrawableClass](G_TYPE_INSTANCE_GET_INTERFACE(inst, - TYPE_GL_DRAWABLE())) - -proc TYPE_GL_PIXMAP*(): GType = - result = gl_pixmap_get_type() - -proc GL_PIXMAP*(anObject: Pointer): PGLPixmap = - result = cast[PGLPixmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GL_PIXMAP())) - -proc GL_PIXMAP_CLASS*(klass: Pointer): PGLPixmapClass = - result = cast[PGLPixmapClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GL_PIXMAP())) - -proc IS_GL_PIXMAP*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_PIXMAP()) - -proc IS_GL_PIXMAP_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_PIXMAP()) - -proc GL_PIXMAP_GET_CLASS*(obj: Pointer): PGLPixmapClass = - result = cast[PGLPixmapClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GL_PIXMAP())) - -proc get_gl_drawable*(pixmap: PPixmap): PGLDrawable = - result = GL_DRAWABLE(get_gl_pixmap(pixmap)) - -proc TYPE_GL_WINDOW*(): GType = - result = gl_window_get_type() - -proc GL_WINDOW*(anObject: Pointer): PGLWindow = - result = cast[PGLWindow](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GL_WINDOW())) - -proc GL_WINDOW_CLASS*(klass: Pointer): PGLWindowClass = - result = cast[PGLWindowClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GL_WINDOW())) - -proc IS_GL_WINDOW*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_WINDOW()) - -proc IS_GL_WINDOW_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_WINDOW()) - -proc GL_WINDOW_GET_CLASS*(obj: Pointer): PGLWindowClass = - result = cast[PGLWindowClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GL_WINDOW())) - -proc get_gl_drawable*(window: PWindow): PGLDrawable = - result = GL_DRAWABLE(get_gl_window(window)) diff --git a/lib/wrappers/gtk/glib2.nim b/lib/wrappers/gtk/glib2.nim deleted file mode 100644 index 3fa672c85..000000000 --- a/lib/wrappers/gtk/glib2.nim +++ /dev/null @@ -1,4540 +0,0 @@ -{.deadCodeElim: on.} -when defined(windows): - const - gliblib = "libglib-2.0-0.dll" - gmodulelib = "libgmodule-2.0-0.dll" - gobjectlib = "libgobject-2.0-0.dll" -elif defined(macosx): - const - gliblib = "libglib-2.0.dylib" - gmodulelib = "libgmodule-2.0.dylib" - gobjectlib = "libgobject-2.0.dylib" -else: - const - gliblib = "libglib-2.0.so(|.0)" - gmodulelib = "libgmodule-2.0.so(|.0)" - gobjectlib = "libgobject-2.0.so(|.0)" -# gthreadlib = "libgthread-2.0.so" - -type - PGTypePlugin* = pointer - PGParamSpecPool* = pointer - PPchar* = ptr cstring - PPPchar* = ptr PPchar - PPPgchar* = ptr PPgchar - PPgchar* = ptr cstring - gchar* = char - gshort* = cshort - glong* = clong - gint* = cint - gboolean* = distinct gint - guchar* = char - gushort* = int16 - gulong* = int - guint* = cint - gfloat* = cfloat - gdouble* = cdouble - gpointer* = pointer - Pgshort* = ptr gshort - Pglong* = ptr glong - Pgint* = ptr gint - PPgint* = ptr Pgint - Pgboolean* = ptr gboolean - Pguchar* = ptr guchar - PPguchar* = ptr Pguchar - Pgushort* = ptr gushort - Pgulong* = ptr gulong - Pguint* = ptr guint - Pgfloat* = ptr gfloat - Pgdouble* = ptr gdouble - pgpointer* = ptr gpointer - gconstpointer* = pointer - PGCompareFunc* = ptr TGCompareFunc - TGCompareFunc* = proc (a, b: gconstpointer): gint{.cdecl.} - PGCompareDataFunc* = ptr TGCompareDataFunc - TGCompareDataFunc* = proc (a, b: gconstpointer, user_data: gpointer): gint{. - cdecl.} - PGEqualFunc* = ptr TGEqualFunc - TGEqualFunc* = proc (a, b: gconstpointer): gboolean{.cdecl.} - PGDestroyNotify* = ptr TGDestroyNotify - TGDestroyNotify* = proc (data: gpointer){.cdecl.} - PGFunc* = ptr TGFunc - TGFunc* = proc (data, userdata: gpointer, key: gconstpointer){.cdecl.} - PGHashFunc* = ptr TGHashFunc - TGHashFunc* = proc (key: gconstpointer): guint{.cdecl.} - PGHFunc* = ptr TGHFunc - TGHFunc* = proc (key, value, user_data: gpointer){.cdecl.} - PGFreeFunc* = proc (data: gpointer){.cdecl.} - PGTimeVal* = ptr TGTimeVal - TGTimeVal*{.final.} = object - tv_sec*: glong - tv_usec*: glong - - guint64* = int64 - gint8* = int8 - guint8* = int8 - gint16* = int16 - guint16* = int16 - gint32* = int32 - guint32* = int32 - gint64* = int64 - gssize* = int32 - gsize* = int32 - Pgint8* = ptr gint8 - Pguint8* = ptr guint8 - Pgint16* = ptr gint16 - Pguint16* = ptr guint16 - Pgint32* = ptr gint32 - Pguint32* = ptr guint32 - Pgint64* = ptr gint64 - Pguint64* = ptr guint64 - pgssize* = ptr gssize - pgsize* = ptr gsize - TGQuark* = guint32 - PGQuark* = ptr TGQuark - PGTypeCValue* = ptr TGTypeCValue - TGTypeCValue*{.final.} = object - v_double*: gdouble - - GType* = gulong - PGType* = ptr GType - PGTypeClass* = ptr TGTypeClass - TGTypeClass*{.final.} = object - g_type*: GType - - PGTypeInstance* = ptr TGTypeInstance - TGTypeInstance*{.final.} = object - g_class*: PGTypeClass - - PGTypeInterface* = ptr TGTypeInterface - TGTypeInterface*{.pure, inheritable.} = object - g_type*: GType - g_instance_type*: GType - - PGTypeQuery* = ptr TGTypeQuery - TGTypeQuery*{.final.} = object - theType*: GType - type_name*: cstring - class_size*: guint - instance_size*: guint - - PGValue* = ptr TGValue - TGValue*{.final.} = object - g_type*: GType - data*: array[0..1, gdouble] - - PGData* = pointer - PPGData* = ptr PGData - PGSList* = ptr TGSList - PPGSList* = ptr PGSList - TGSList*{.final.} = object - data*: gpointer - next*: PGSList - - PGList* = ptr TGList - TGList*{.final.} = object - data*: gpointer - next*: PGList - prev*: PGList - - TGParamFlags* = int32 - PGParamFlags* = ptr TGParamFlags - PGParamSpec* = ptr TGParamSpec - PPGParamSpec* = ptr PGParamSpec - TGParamSpec*{.final.} = object - g_type_instance*: TGTypeInstance - name*: cstring - flags*: TGParamFlags - value_type*: GType - owner_type*: GType - nick*: cstring - blurb*: cstring - qdata*: PGData - ref_count*: guint - param_id*: guint - - PGParamSpecClass* = ptr TGParamSpecClass - TGParamSpecClass*{.final.} = object - g_type_class*: TGTypeClass - value_type*: GType - finalize*: proc (pspec: PGParamSpec){.cdecl.} - value_set_default*: proc (pspec: PGParamSpec, value: PGValue){.cdecl.} - value_validate*: proc (pspec: PGParamSpec, value: PGValue): gboolean{.cdecl.} - values_cmp*: proc (pspec: PGParamSpec, value1: PGValue, value2: PGValue): gint{. - cdecl.} - dummy*: array[0..3, gpointer] - - PGParameter* = ptr TGParameter - TGParameter*{.final.} = object - name*: cstring - value*: TGValue - - TGBoxedCopyFunc* = proc (boxed: gpointer): gpointer{.cdecl.} - TGBoxedFreeFunc* = proc (boxed: gpointer){.cdecl.} - PGsource = pointer # I don't know and don't care - -converter gbool*(nimbool: bool): gboolean = - return ord(nimbool).gboolean - -converter toBool*(gbool: gboolean): bool = - return int(gbool) == 1 - -const - G_TYPE_FUNDAMENTAL_SHIFT* = 2 - G_TYPE_FUNDAMENTAL_MAX* = 255 shl G_TYPE_FUNDAMENTAL_SHIFT - G_TYPE_INVALID* = GType(0 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_NONE* = GType(1 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_INTERFACE* = GType(2 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_CHAR* = GType(3 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_UCHAR* = GType(4 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_BOOLEAN* = GType(5 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_INT* = GType(6 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_UINT* = GType(7 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_LONG* = GType(8 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_ULONG* = GType(9 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_INT64* = GType(10 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_UINT64* = GType(11 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_ENUM* = GType(12 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_FLAGS* = GType(13 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_FLOAT* = GType(14 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_DOUBLE* = GType(15 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_STRING* = GType(16 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_POINTER* = GType(17 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_BOXED* = GType(18 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_PARAM* = GType(19 shl G_TYPE_FUNDAMENTAL_SHIFT) - G_TYPE_OBJECT* = GType(20 shl G_TYPE_FUNDAMENTAL_SHIFT) - -const - G_PRIORITY_HIGH_IDLE* = 100 - G_PRIORITY_DEFAULT_IDLE* = 200 - G_PRIORITY_LOW* = 300 - G_PRIORITY_HIGH* = -100 - G_PRIORITY_DEFAULT* = 0 - - -proc G_TYPE_MAKE_FUNDAMENTAL*(x: int): GType -const - G_TYPE_RESERVED_GLIB_FIRST* = 21 - G_TYPE_RESERVED_GLIB_LAST* = 31 - G_TYPE_RESERVED_BSE_FIRST* = 32 - G_TYPE_RESERVED_BSE_LAST* = 48 - G_TYPE_RESERVED_USER_FIRST* = 49 - -proc G_TYPE_IS_FUNDAMENTAL*(theType: GType): bool -proc G_TYPE_IS_DERIVED*(theType: GType): bool -proc G_TYPE_IS_INTERFACE*(theType: GType): bool -proc G_TYPE_IS_CLASSED*(theType: GType): gboolean -proc G_TYPE_IS_INSTANTIATABLE*(theType: GType): bool -proc G_TYPE_IS_DERIVABLE*(theType: GType): bool -proc G_TYPE_IS_DEEP_DERIVABLE*(theType: GType): bool -proc G_TYPE_IS_ABSTRACT*(theType: GType): bool -proc G_TYPE_IS_VALUE_ABSTRACT*(theType: GType): bool -proc G_TYPE_IS_VALUE_TYPE*(theType: GType): bool -proc G_TYPE_HAS_VALUE_TABLE*(theType: GType): bool -proc G_TYPE_CHECK_INSTANCE*(instance: Pointer): gboolean -proc G_TYPE_CHECK_INSTANCE_CAST*(instance: Pointer, g_type: GType): PGTypeInstance -proc G_TYPE_CHECK_INSTANCE_TYPE*(instance: Pointer, g_type: GType): bool -proc G_TYPE_INSTANCE_GET_CLASS*(instance: Pointer, g_type: GType): PGTypeClass -proc G_TYPE_INSTANCE_GET_INTERFACE*(instance: Pointer, g_type: GType): Pointer -proc G_TYPE_CHECK_CLASS_CAST*(g_class: pointer, g_type: GType): Pointer -proc G_TYPE_CHECK_CLASS_TYPE*(g_class: pointer, g_type: GType): bool -proc G_TYPE_CHECK_VALUE*(value: Pointer): bool -proc G_TYPE_CHECK_VALUE_TYPE*(value: pointer, g_type: GType): bool -proc G_TYPE_FROM_INSTANCE*(instance: Pointer): GType -proc G_TYPE_FROM_CLASS*(g_class: Pointer): GType -proc G_TYPE_FROM_INTERFACE*(g_iface: Pointer): GType -type - TGTypeDebugFlags* = int32 - PGTypeDebugFlags* = ptr TGTypeDebugFlags - -const - G_TYPE_DEBUG_NONE* = 0 - G_TYPE_DEBUG_OBJECTS* = 1 shl 0 - G_TYPE_DEBUG_SIGNALS* = 1 shl 1 - G_TYPE_DEBUG_MASK* = 0x00000003 - -proc g_type_init*(){.cdecl, dynlib: gobjectlib, importc: "g_type_init".} -proc g_type_init*(debug_flags: TGTypeDebugFlags){.cdecl, - dynlib: gobjectlib, importc: "g_type_init_with_debug_flags".} -proc g_type_name*(theType: GType): cstring{.cdecl, dynlib: gobjectlib, - importc: "g_type_name".} -proc g_type_qname*(theType: GType): TGQuark{.cdecl, dynlib: gobjectlib, - importc: "g_type_qname".} -proc g_type_from_name*(name: cstring): GType{.cdecl, dynlib: gobjectlib, - importc: "g_type_from_name".} -proc g_type_parent*(theType: GType): GType{.cdecl, dynlib: gobjectlib, - importc: "g_type_parent".} -proc g_type_depth*(theType: GType): guint{.cdecl, dynlib: gobjectlib, - importc: "g_type_depth".} -proc g_type_next_base*(leaf_type: GType, root_type: GType): GType{.cdecl, - dynlib: gobjectlib, importc: "g_type_next_base".} -proc g_type_is_a*(theType: GType, is_a_type: GType): gboolean{.cdecl, - dynlib: gobjectlib, importc: "g_type_is_a".} -proc g_type_class_ref*(theType: GType): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_type_class_ref".} -proc g_type_class_peek*(theType: GType): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_type_class_peek".} -proc g_type_class_unref*(g_class: gpointer){.cdecl, dynlib: gobjectlib, - importc: "g_type_class_unref".} -proc g_type_class_peek_parent*(g_class: gpointer): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_type_class_peek_parent".} -proc g_type_interface_peek*(instance_class: gpointer, iface_type: GType): gpointer{. - cdecl, dynlib: gobjectlib, importc: "g_type_interface_peek".} -proc g_type_interface_peek_parent*(g_iface: gpointer): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_type_interface_peek_parent".} -proc g_type_children*(theType: GType, n_children: Pguint): PGType{.cdecl, - dynlib: gobjectlib, importc: "g_type_children".} -proc g_type_interfaces*(theType: GType, n_interfaces: Pguint): PGType{.cdecl, - dynlib: gobjectlib, importc: "g_type_interfaces".} -proc g_type_set_qdata*(theType: GType, quark: TGQuark, data: gpointer){.cdecl, - dynlib: gobjectlib, importc: "g_type_set_qdata".} -proc g_type_get_qdata*(theType: GType, quark: TGQuark): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_type_get_qdata".} -proc g_type_query*(theType: GType, query: PGTypeQuery){.cdecl, - dynlib: gobjectlib, importc: "g_type_query".} -type - TGBaseInitFunc* = proc (g_class: gpointer){.cdecl.} - TGBaseFinalizeFunc* = proc (g_class: gpointer){.cdecl.} - TGClassInitFunc* = proc (g_class: gpointer, class_data: gpointer){.cdecl.} - TGClassFinalizeFunc* = proc (g_class: gpointer, class_data: gpointer){.cdecl.} - TGInstanceInitFunc* = proc (instance: PGTypeInstance, g_class: gpointer){. - cdecl.} - TGInterfaceInitFunc* = proc (g_iface: gpointer, iface_data: gpointer){.cdecl.} - TGInterfaceFinalizeFunc* = proc (g_iface: gpointer, iface_data: gpointer){. - cdecl.} - TGTypeClassCacheFunc* = proc (cache_data: gpointer, g_class: PGTypeClass): gboolean{. - cdecl.} - TGTypeFundamentalFlags* = int32 - PGTypeFundamentalFlags* = ptr TGTypeFundamentalFlags - -const - G_TYPE_FLAG_CLASSED* = 1 shl 0 - G_TYPE_FLAG_INSTANTIATABLE* = 1 shl 1 - G_TYPE_FLAG_DERIVABLE* = 1 shl 2 - G_TYPE_FLAG_DEEP_DERIVABLE* = 1 shl 3 - -type - TGTypeFlags* = int32 - PGTypeFlags* = ptr TGTypeFlags - -const - G_TYPE_FLAG_ABSTRACT* = 1 shl 4 - G_TYPE_FLAG_VALUE_ABSTRACT* = 1 shl 5 - -type - PGTypeValueTable* = ptr TGTypeValueTable - TGTypeValueTable*{.final.} = object - value_init*: proc (value: PGValue){.cdecl.} - value_free*: proc (value: PGValue){.cdecl.} - value_copy*: proc (src_value: PGValue, dest_value: PGValue){.cdecl.} - value_peek_pointer*: proc (value: PGValue): gpointer{.cdecl.} - collect_format*: cstring - collect_value*: proc (value: PGValue, n_collect_values: guint, - collect_values: PGTypeCValue, collect_flags: guint): cstring{. - cdecl.} - lcopy_format*: cstring - lcopy_value*: proc (value: PGValue, n_collect_values: guint, - collect_values: PGTypeCValue, collect_flags: guint): cstring{. - cdecl.} - - PGTypeInfo* = ptr TGTypeInfo - TGTypeInfo*{.final.} = object - class_size*: guint16 - base_init*: TGBaseInitFunc - base_finalize*: TGBaseFinalizeFunc - class_init*: TGClassInitFunc - class_finalize*: TGClassFinalizeFunc - class_data*: gconstpointer - instance_size*: guint16 - n_preallocs*: guint16 - instance_init*: TGInstanceInitFunc - value_table*: PGTypeValueTable - - PGTypeFundamentalInfo* = ptr TGTypeFundamentalInfo - TGTypeFundamentalInfo*{.final.} = object - type_flags*: TGTypeFundamentalFlags - - PGInterfaceInfo* = ptr TGInterfaceInfo - TGInterfaceInfo*{.final.} = object - interface_init*: TGInterfaceInitFunc - interface_finalize*: TGInterfaceFinalizeFunc - interface_data*: gpointer - - -proc g_type_register_static*(parent_type: GType, type_name: cstring, - info: PGTypeInfo, flags: TGTypeFlags): GType{. - cdecl, dynlib: gobjectlib, importc: "g_type_register_static".} -proc g_type_register_dynamic*(parent_type: GType, type_name: cstring, - plugin: PGTypePlugin, flags: TGTypeFlags): GType{. - cdecl, dynlib: gobjectlib, importc: "g_type_register_dynamic".} -proc g_type_register_fundamental*(type_id: GType, type_name: cstring, - info: PGTypeInfo, - finfo: PGTypeFundamentalInfo, - flags: TGTypeFlags): GType{.cdecl, - dynlib: gobjectlib, importc: "g_type_register_fundamental".} -proc g_type_add_interface_static*(instance_type: GType, interface_type: GType, - info: PGInterfaceInfo){.cdecl, - dynlib: gobjectlib, importc: "g_type_add_interface_static".} -proc g_type_add_interface_dynamic*(instance_type: GType, interface_type: GType, - plugin: PGTypePlugin){.cdecl, - dynlib: gobjectlib, importc: "g_type_add_interface_dynamic".} -proc g_type_interface_add_prerequisite*(interface_type: GType, - prerequisite_type: GType){.cdecl, - dynlib: gobjectlib, importc: "g_type_interface_add_prerequisite".} -proc g_type_get_plugin*(theType: GType): PGTypePlugin{.cdecl, - dynlib: gobjectlib, importc: "g_type_get_plugin".} -proc g_type_interface_get_plugin*(instance_type: GType, - implementation_type: GType): PGTypePlugin{. - cdecl, dynlib: gobjectlib, importc: "g_type_interface_get_plugin".} -proc g_type_fundamental_next*(): GType{.cdecl, dynlib: gobjectlib, - importc: "g_type_fundamental_next".} -proc g_type_fundamental*(type_id: GType): GType{.cdecl, dynlib: gobjectlib, - importc: "g_type_fundamental".} -proc g_type_create_instance*(theType: GType): PGTypeInstance{.cdecl, - dynlib: gobjectlib, importc: "g_type_create_instance".} -proc free_instance*(instance: PGTypeInstance){.cdecl, dynlib: gobjectlib, - importc: "g_type_free_instance".} -proc g_type_add_class_cache_func*(cache_data: gpointer, - cache_func: TGTypeClassCacheFunc){.cdecl, - dynlib: gobjectlib, importc: "g_type_add_class_cache_func".} -proc g_type_remove_class_cache_func*(cache_data: gpointer, - cache_func: TGTypeClassCacheFunc){.cdecl, - dynlib: gobjectlib, importc: "g_type_remove_class_cache_func".} -proc g_type_class_unref_uncached*(g_class: gpointer){.cdecl, dynlib: gobjectlib, - importc: "g_type_class_unref_uncached".} -proc g_type_value_table_peek*(theType: GType): PGTypeValueTable{.cdecl, - dynlib: gobjectlib, importc: "g_type_value_table_peek".} -proc private_g_type_check_instance*(instance: PGTypeInstance): gboolean{.cdecl, - dynlib: gobjectlib, importc: "g_type_check_instance".} -proc private_g_type_check_instance_cast*(instance: PGTypeInstance, - iface_type: GType): PGTypeInstance{.cdecl, dynlib: gobjectlib, - importc: "g_type_check_instance_cast".} -proc private_g_type_check_instance_is_a*(instance: PGTypeInstance, - iface_type: GType): gboolean{.cdecl, dynlib: gobjectlib, - importc: "g_type_check_instance_is_a".} -proc private_g_type_check_class_cast*(g_class: PGTypeClass, is_a_type: GType): PGTypeClass{. - cdecl, dynlib: gobjectlib, importc: "g_type_check_class_cast".} -proc private_g_type_check_class_is_a*(g_class: PGTypeClass, is_a_type: GType): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_type_check_class_is_a".} -proc private_g_type_check_is_value_type*(theType: GType): gboolean{.cdecl, - dynlib: gobjectlib, importc: "g_type_check_is_value_type".} -proc private_g_type_check_value*(value: PGValue): gboolean{.cdecl, - dynlib: gobjectlib, importc: "g_type_check_value".} -proc private_g_type_check_value_holds*(value: PGValue, theType: GType): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_type_check_value_holds".} -proc private_g_type_test_flags*(theType: GType, flags: guint): gboolean{.cdecl, - dynlib: gobjectlib, importc: "g_type_test_flags".} -proc name_from_instance*(instance: PGTypeInstance): cstring{.cdecl, - dynlib: gobjectlib, importc: "g_type_name_from_instance".} -proc name_from_class*(g_class: PGTypeClass): cstring{.cdecl, - dynlib: gobjectlib, importc: "g_type_name_from_class".} -const - G_TYPE_FLAG_RESERVED_ID_BIT* = GType(1 shl 0) - -proc G_TYPE_IS_VALUE*(theType: GType): bool -proc G_IS_VALUE*(value: pointer): bool -proc G_VALUE_TYPE*(value: Pointer): GType -proc G_VALUE_TYPE_NAME*(value: Pointer): cstring -proc G_VALUE_HOLDS*(value: pointer, g_type: GType): bool -type - TGValueTransform* = proc (src_value: PGValue, dest_value: PGValue){.cdecl.} - -proc init*(value: PGValue, g_type: GType): PGValue{.cdecl, - dynlib: gobjectlib, importc: "g_value_init".} -proc copy*(src_value: PGValue, dest_value: PGValue){.cdecl, - dynlib: gobjectlib, importc: "g_value_copy".} -proc reset*(value: PGValue): PGValue{.cdecl, dynlib: gobjectlib, - importc: "g_value_reset".} -proc unset*(value: PGValue){.cdecl, dynlib: gobjectlib, - importc: "g_value_unset".} -proc set_instance*(value: PGValue, instance: gpointer){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_instance".} -proc fits_pointer*(value: PGValue): gboolean{.cdecl, dynlib: gobjectlib, - importc: "g_value_fits_pointer".} -proc peek_pointer*(value: PGValue): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_value_peek_pointer".} -proc g_value_type_compatible*(src_type: GType, dest_type: GType): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_value_type_compatible".} -proc g_value_type_transformable*(src_type: GType, dest_type: GType): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_value_type_transformable".} -proc transform*(src_value: PGValue, dest_value: PGValue): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_value_transform".} -proc g_value_register_transform_func*(src_type: GType, dest_type: GType, - transform_func: TGValueTransform){.cdecl, - dynlib: gobjectlib, importc: "g_value_register_transform_func".} -const - G_VALUE_NOCOPY_CONTENTS* = 1 shl 27 - -type - PGValueArray* = ptr TGValueArray - TGValueArray*{.final.} = object - n_values*: guint - values*: PGValue - n_prealloced*: guint - - -proc array_get_nth*(value_array: PGValueArray, index: guint): PGValue{. - cdecl, dynlib: gobjectlib, importc: "g_value_array_get_nth".} -proc g_value_array_new*(n_prealloced: guint): PGValueArray{.cdecl, - dynlib: gobjectlib, importc: "g_value_array_new".} -proc array_free*(value_array: PGValueArray){.cdecl, dynlib: gobjectlib, - importc: "g_value_array_free".} -proc array_copy*(value_array: PGValueArray): PGValueArray{.cdecl, - dynlib: gobjectlib, importc: "g_value_array_copy".} -proc array_prepend*(value_array: PGValueArray, value: PGValue): PGValueArray{. - cdecl, dynlib: gobjectlib, importc: "g_value_array_prepend".} -proc array_append*(value_array: PGValueArray, value: PGValue): PGValueArray{. - cdecl, dynlib: gobjectlib, importc: "g_value_array_append".} -proc array_insert*(value_array: PGValueArray, index: guint, - value: PGValue): PGValueArray{.cdecl, - dynlib: gobjectlib, importc: "g_value_array_insert".} -proc array_remove*(value_array: PGValueArray, index: guint): PGValueArray{. - cdecl, dynlib: gobjectlib, importc: "g_value_array_remove".} -proc array_sort*(value_array: PGValueArray, compare_func: TGCompareFunc): PGValueArray{. - cdecl, dynlib: gobjectlib, importc: "g_value_array_sort".} -proc array_sort*(value_array: PGValueArray, - compare_func: TGCompareDataFunc, - user_data: gpointer): PGValueArray{.cdecl, - dynlib: gobjectlib, importc: "g_value_array_sort_with_data".} -const - G_VALUE_COLLECT_INT* = 'i' - G_VALUE_COLLECT_LONG* = 'l' - G_VALUE_COLLECT_INT64* = 'q' - G_VALUE_COLLECT_DOUBLE* = 'd' - G_VALUE_COLLECT_POINTER* = 'p' - G_VALUE_COLLECT_FORMAT_MAX_LENGTH* = 8 - -proc HOLDS_CHAR*(value: PGValue): bool -proc HOLDS_UCHAR*(value: PGValue): bool -proc HOLDS_BOOLEAN*(value: PGValue): bool -proc HOLDS_INT*(value: PGValue): bool -proc HOLDS_UINT*(value: PGValue): bool -proc HOLDS_LONG*(value: PGValue): bool -proc HOLDS_ULONG*(value: PGValue): bool -proc HOLDS_INT64*(value: PGValue): bool -proc HOLDS_UINT64*(value: PGValue): bool -proc HOLDS_FLOAT*(value: PGValue): bool -proc HOLDS_DOUBLE*(value: PGValue): bool -proc HOLDS_STRING*(value: PGValue): bool -proc HOLDS_POINTER*(value: PGValue): bool -proc set_char*(value: PGValue, v_char: gchar){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_char".} -proc get_char*(value: PGValue): gchar{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_char".} -proc set_uchar*(value: PGValue, v_uchar: guchar){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_uchar".} -proc get_uchar*(value: PGValue): guchar{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_uchar".} -proc set_boolean*(value: PGValue, v_boolean: gboolean){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_boolean".} -proc get_boolean*(value: PGValue): gboolean{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_boolean".} -proc set_int*(value: PGValue, v_int: gint){.cdecl, dynlib: gobjectlib, - importc: "g_value_set_int".} -proc get_int*(value: PGValue): gint{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_int".} -proc set_uint*(value: PGValue, v_uint: guint){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_uint".} -proc get_uint*(value: PGValue): guint{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_uint".} -proc set_long*(value: PGValue, v_long: glong){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_long".} -proc get_long*(value: PGValue): glong{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_long".} -proc set_ulong*(value: PGValue, v_ulong: gulong){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_ulong".} -proc get_ulong*(value: PGValue): gulong{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_ulong".} -proc set_int64*(value: PGValue, v_int64: gint64){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_int64".} -proc get_int64*(value: PGValue): gint64{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_int64".} -proc set_uint64*(value: PGValue, v_uint64: guint64){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_uint64".} -proc get_uint64*(value: PGValue): guint64{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_uint64".} -proc set_float*(value: PGValue, v_float: gfloat){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_float".} -proc get_float*(value: PGValue): gfloat{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_float".} -proc set_double*(value: PGValue, v_double: gdouble){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_double".} -proc get_double*(value: PGValue): gdouble{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_double".} -proc set_string*(value: PGValue, v_string: cstring){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_string".} -proc set_static_string*(value: PGValue, v_string: cstring){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_static_string".} -proc get_string*(value: PGValue): cstring{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_string".} -proc dup_string*(value: PGValue): cstring{.cdecl, dynlib: gobjectlib, - importc: "g_value_dup_string".} -proc set_pointer*(value: PGValue, v_pointer: gpointer){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_pointer".} -proc get_pointer*(value: PGValue): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_pointer".} -proc g_pointer_type_register_static*(name: cstring): GType{.cdecl, - dynlib: gobjectlib, importc: "g_pointer_type_register_static".} -proc strdup_value_contents*(value: PGValue): cstring{.cdecl, - dynlib: gobjectlib, importc: "g_strdup_value_contents".} -proc set_string_take_ownership*(value: PGValue, v_string: cstring){. - cdecl, dynlib: gobjectlib, importc: "g_value_set_string_take_ownership".} -type - Tgchararray* = gchar - Pgchararray* = ptr Tgchararray - -proc G_TYPE_IS_PARAM*(theType: GType): bool -proc G_PARAM_SPEC*(pspec: Pointer): PGParamSpec -proc G_IS_PARAM_SPEC*(pspec: Pointer): bool -proc G_PARAM_SPEC_CLASS*(pclass: Pointer): PGParamSpecClass -proc G_IS_PARAM_SPEC_CLASS*(pclass: Pointer): bool -proc G_PARAM_SPEC_GET_CLASS*(pspec: Pointer): PGParamSpecClass -proc G_PARAM_SPEC_TYPE*(pspec: Pointer): GType -proc G_PARAM_SPEC_TYPE_NAME*(pspec: Pointer): cstring -proc G_PARAM_SPEC_VALUE_TYPE*(pspec: Pointer): GType -proc G_VALUE_HOLDS_PARAM*(value: Pointer): bool -const - G_PARAM_READABLE* = 1 shl 0 - G_PARAM_WRITABLE* = 1 shl 1 - G_PARAM_CONSTRUCT* = 1 shl 2 - G_PARAM_CONSTRUCT_ONLY* = 1 shl 3 - G_PARAM_LAX_VALIDATION* = 1 shl 4 - G_PARAM_PRIVATE* = 1 shl 5 - G_PARAM_READWRITE* = G_PARAM_READABLE or G_PARAM_WRITABLE - G_PARAM_MASK* = 0x000000FF - G_PARAM_USER_SHIFT* = 8 - -proc spec_ref*(pspec: PGParamSpec): PGParamSpec{.cdecl, dynlib: gliblib, - importc: "g_param_spec_ref".} -proc spec_unref*(pspec: PGParamSpec){.cdecl, dynlib: gliblib, - importc: "g_param_spec_unref".} -proc spec_sink*(pspec: PGParamSpec){.cdecl, dynlib: gliblib, - importc: "g_param_spec_sink".} -proc spec_get_qdata*(pspec: PGParamSpec, quark: TGQuark): gpointer{. - cdecl, dynlib: gliblib, importc: "g_param_spec_get_qdata".} -proc spec_set_qdata*(pspec: PGParamSpec, quark: TGQuark, data: gpointer){. - cdecl, dynlib: gliblib, importc: "g_param_spec_set_qdata".} -proc spec_set_qdata_full*(pspec: PGParamSpec, quark: TGQuark, - data: gpointer, destroy: TGDestroyNotify){. - cdecl, dynlib: gliblib, importc: "g_param_spec_set_qdata_full".} -proc spec_steal_qdata*(pspec: PGParamSpec, quark: TGQuark): gpointer{. - cdecl, dynlib: gliblib, importc: "g_param_spec_steal_qdata".} -proc value_set_default*(pspec: PGParamSpec, value: PGValue){.cdecl, - dynlib: gliblib, importc: "g_param_value_set_default".} -proc value_defaults*(pspec: PGParamSpec, value: PGValue): gboolean{. - cdecl, dynlib: gliblib, importc: "g_param_value_defaults".} -proc value_validate*(pspec: PGParamSpec, value: PGValue): gboolean{. - cdecl, dynlib: gliblib, importc: "g_param_value_validate".} -proc value_convert*(pspec: PGParamSpec, src_value: PGValue, - dest_value: PGValue, strict_validation: gboolean): gboolean{. - cdecl, dynlib: gliblib, importc: "g_param_value_convert".} -proc values_cmp*(pspec: PGParamSpec, value1: PGValue, value2: PGValue): gint{. - cdecl, dynlib: gliblib, importc: "g_param_values_cmp".} -proc spec_get_name*(pspec: PGParamSpec): cstring{.cdecl, - dynlib: gliblib, importc: "g_param_spec_get_name".} -proc spec_get_nick*(pspec: PGParamSpec): cstring{.cdecl, - dynlib: gliblib, importc: "g_param_spec_get_nick".} -proc spec_get_blurb*(pspec: PGParamSpec): cstring{.cdecl, - dynlib: gliblib, importc: "g_param_spec_get_blurb".} -proc set_param*(value: PGValue, param: PGParamSpec){.cdecl, - dynlib: gliblib, importc: "g_value_set_param".} -proc get_param*(value: PGValue): PGParamSpec{.cdecl, dynlib: gliblib, - importc: "g_value_get_param".} -proc dup_param*(value: PGValue): PGParamSpec{.cdecl, dynlib: gliblib, - importc: "g_value_dup_param".} -proc set_param_take_ownership*(value: PGValue, param: PGParamSpec){. - cdecl, dynlib: gliblib, importc: "g_value_set_param_take_ownership".} -type - PGParamSpecTypeInfo* = ptr TGParamSpecTypeInfo - TGParamSpecTypeInfo*{.final.} = object - instance_size*: guint16 - n_preallocs*: guint16 - instance_init*: proc (pspec: PGParamSpec){.cdecl.} - value_type*: GType - finalize*: proc (pspec: PGParamSpec){.cdecl.} - value_set_default*: proc (pspec: PGParamSpec, value: PGValue){.cdecl.} - value_validate*: proc (pspec: PGParamSpec, value: PGValue): gboolean{.cdecl.} - values_cmp*: proc (pspec: PGParamSpec, value1: PGValue, value2: PGValue): gint{. - cdecl.} - - -proc g_param_type_register_static*(name: cstring, - pspec_info: PGParamSpecTypeInfo): GType{. - cdecl, dynlib: gliblib, importc: "g_param_type_register_static".} -proc g_param_type_register_static_constant*(name: cstring, - pspec_info: PGParamSpecTypeInfo, opt_type: GType): GType{.cdecl, - dynlib: gliblib, importc: "`g_param_type_register_static_constant`".} -proc g_param_spec_internal*(param_type: GType, name: cstring, nick: cstring, - blurb: cstring, flags: TGParamFlags): gpointer{. - cdecl, dynlib: gliblib, importc: "g_param_spec_internal".} -proc g_param_spec_pool_new*(type_prefixing: gboolean): PGParamSpecPool{.cdecl, - dynlib: gliblib, importc: "g_param_spec_pool_new".} -proc spec_pool_insert*(pool: PGParamSpecPool, pspec: PGParamSpec, - owner_type: GType){.cdecl, dynlib: gliblib, - importc: "g_param_spec_pool_insert".} -proc spec_pool_remove*(pool: PGParamSpecPool, pspec: PGParamSpec){. - cdecl, dynlib: gliblib, importc: "g_param_spec_pool_remove".} -proc spec_pool_lookup*(pool: PGParamSpecPool, param_name: cstring, - owner_type: GType, walk_ancestors: gboolean): PGParamSpec{. - cdecl, dynlib: gliblib, importc: "g_param_spec_pool_lookup".} -proc spec_pool_list_owned*(pool: PGParamSpecPool, owner_type: GType): PGList{. - cdecl, dynlib: gliblib, importc: "g_param_spec_pool_list_owned".} -proc spec_pool_list*(pool: PGParamSpecPool, owner_type: GType, - n_pspecs_p: Pguint): PPGParamSpec{.cdecl, - dynlib: gliblib, importc: "g_param_spec_pool_list".} -type - PGClosure* = ptr TGClosure - PGClosureNotifyData* = ptr TGClosureNotifyData - TGClosureNotify* = proc (data: gpointer, closure: PGClosure){.cdecl.} - TGClosure*{.final.} = object - flag0*: int32 - marshal*: proc (closure: PGClosure, return_value: PGValue, - n_param_values: guint, param_values: PGValue, - invocation_hint, marshal_data: gpointer){.cdecl.} - data*: gpointer - notifiers*: PGClosureNotifyData - - TGCallBackProcedure* = proc (){.cdecl.} - TGCallback* = proc (){.cdecl.} - TGClosureMarshal* = proc (closure: PGClosure, return_value: PGValue, - n_param_values: guint, param_values: PGValue, - invocation_hint: gpointer, marshal_data: gpointer){. - cdecl.} - TGClosureNotifyData*{.final.} = object - data*: gpointer - notify*: TGClosureNotify - - -proc G_CLOSURE_NEEDS_MARSHAL*(closure: Pointer): bool -proc N_NOTIFIERS*(cl: PGClosure): int32 -proc CCLOSURE_SWAP_DATA*(cclosure: PGClosure): int32 -proc G_CALLBACK*(f: pointer): TGCallback -const - bm_TGClosure_ref_count* = 0x00007FFF'i32 - bp_TGClosure_ref_count* = 0'i32 - bm_TGClosure_meta_marshal* = 0x00008000'i32 - bp_TGClosure_meta_marshal* = 15'i32 - bm_TGClosure_n_guards* = 0x00010000'i32 - bp_TGClosure_n_guards* = 16'i32 - bm_TGClosure_n_fnotifiers* = 0x00060000'i32 - bp_TGClosure_n_fnotifiers* = 17'i32 - bm_TGClosure_n_inotifiers* = 0x07F80000'i32 - bp_TGClosure_n_inotifiers* = 19'i32 - bm_TGClosure_in_inotify* = 0x08000000'i32 - bp_TGClosure_in_inotify* = 27'i32 - bm_TGClosure_floating* = 0x10000000'i32 - bp_TGClosure_floating* = 28'i32 - bm_TGClosure_derivative_flag* = 0x20000000'i32 - bp_TGClosure_derivative_flag* = 29'i32 - bm_TGClosure_in_marshal* = 0x40000000'i32 - bp_TGClosure_in_marshal* = 30'i32 - bm_TGClosure_is_invalid* = 0x80000000'i32 - bp_TGClosure_is_invalid* = 31'i32 - -proc ref_count*(a: PGClosure): guint -proc set_ref_count*(a: PGClosure, ref_count: guint) -proc meta_marshal*(a: PGClosure): guint -proc set_meta_marshal*(a: PGClosure, meta_marshal: guint) -proc n_guards*(a: PGClosure): guint -proc set_n_guards*(a: PGClosure, n_guards: guint) -proc n_fnotifiers*(a: PGClosure): guint -proc set_n_fnotifiers*(a: PGClosure, n_fnotifiers: guint) -proc n_inotifiers*(a: PGClosure): guint -proc in_inotify*(a: PGClosure): guint -proc set_in_inotify*(a: PGClosure, in_inotify: guint) -proc floating*(a: PGClosure): guint -proc set_floating*(a: PGClosure, floating: guint) -proc derivative_flag*(a: PGClosure): guint -proc set_derivative_flag*(a: PGClosure, derivative_flag: guint) -proc in_marshal*(a: PGClosure): guint -proc set_in_marshal*(a: PGClosure, in_marshal: guint) -proc is_invalid*(a: PGClosure): guint -proc set_is_invalid*(a: PGClosure, is_invalid: guint) -type - PGCClosure* = ptr TGCClosure - TGCClosure*{.final.} = object - closure*: TGClosure - callback*: gpointer - - -proc g_cclosure_new*(callback_func: TGCallback, user_data: gpointer, - destroy_data: TGClosureNotify): PGClosure{.cdecl, - dynlib: gliblib, importc: "g_cclosure_new".} -proc g_cclosure_new_swap*(callback_func: TGCallback, user_data: gpointer, - destroy_data: TGClosureNotify): PGClosure{.cdecl, - dynlib: gliblib, importc: "g_cclosure_new_swap".} -proc g_signal_type_cclosure_new*(itype: GType, struct_offset: guint): PGClosure{. - cdecl, dynlib: gliblib, importc: "g_signal_type_cclosure_new".} -proc reference*(closure: PGClosure): PGClosure{.cdecl, dynlib: gliblib, - importc: "g_closure_ref".} -proc sink*(closure: PGClosure){.cdecl, dynlib: gliblib, - importc: "g_closure_sink".} -proc unref*(closure: PGClosure){.cdecl, dynlib: gliblib, - importc: "g_closure_unref".} -proc g_closure_new_simple*(sizeof_closure: guint, data: gpointer): PGClosure{. - cdecl, dynlib: gliblib, importc: "g_closure_new_simple".} -proc add_finalize_notifier*(closure: PGClosure, notify_data: gpointer, - notify_func: TGClosureNotify){.cdecl, - dynlib: gliblib, importc: "g_closure_add_finalize_notifier".} -proc remove_finalize_notifier*(closure: PGClosure, - notify_data: gpointer, notify_func: TGClosureNotify){.cdecl, - dynlib: gliblib, importc: "g_closure_remove_finalize_notifier".} -proc add_invalidate_notifier*(closure: PGClosure, - notify_data: gpointer, - notify_func: TGClosureNotify){.cdecl, - dynlib: gliblib, importc: "g_closure_add_invalidate_notifier".} -proc remove_invalidate_notifier*(closure: PGClosure, - notify_data: gpointer, notify_func: TGClosureNotify){.cdecl, - dynlib: gliblib, importc: "g_closure_remove_invalidate_notifier".} -proc add_marshal_guards*(closure: PGClosure, - pre_marshal_data: gpointer, - pre_marshal_notify: TGClosureNotify, - post_marshal_data: gpointer, - post_marshal_notify: TGClosureNotify){.cdecl, - dynlib: gliblib, importc: "g_closure_add_marshal_guards".} -proc set_marshal*(closure: PGClosure, marshal: TGClosureMarshal){. - cdecl, dynlib: gliblib, importc: "g_closure_set_marshal".} -proc set_meta_marshal*(closure: PGClosure, marshal_data: gpointer, - meta_marshal: TGClosureMarshal){.cdecl, - dynlib: gliblib, importc: "g_closure_set_meta_marshal".} -proc invalidate*(closure: PGClosure){.cdecl, dynlib: gliblib, - importc: "g_closure_invalidate".} -proc invoke*(closure: PGClosure, return_value: PGValue, - n_param_values: guint, param_values: PGValue, - invocation_hint: gpointer){.cdecl, dynlib: gliblib, - importc: "g_closure_invoke".} -type - PGSignalInvocationHint* = ptr TGSignalInvocationHint - PGSignalCMarshaller* = ptr TGSignalCMarshaller - TGSignalCMarshaller* = TGClosureMarshal - TGSignalEmissionHook* = proc (ihint: PGSignalInvocationHint, - n_param_values: guint, param_values: PGValue, - data: gpointer): gboolean{.cdecl.} - TGSignalAccumulator* = proc (ihint: PGSignalInvocationHint, - return_accu: PGValue, handler_return: PGValue, - data: gpointer): gboolean{.cdecl.} - PGSignalFlags* = ptr TGSignalFlags - TGSignalFlags* = int32 - TGSignalInvocationHint*{.final.} = object - signal_id*: guint - detail*: TGQuark - run_type*: TGSignalFlags - - PGSignalQuery* = ptr TGSignalQuery - TGSignalQuery*{.final.} = object - signal_id*: guint - signal_name*: cstring - itype*: GType - signal_flags*: TGSignalFlags - return_type*: GType - n_params*: guint - param_types*: PGType - - -const - G_SIGNAL_RUN_FIRST* = 1 shl 0 - G_SIGNAL_RUN_LAST* = 1 shl 1 - G_SIGNAL_RUN_CLEANUP* = 1 shl 2 - G_SIGNAL_NO_RECURSE* = 1 shl 3 - G_SIGNAL_DETAILED* = 1 shl 4 - G_SIGNAL_ACTION* = 1 shl 5 - G_SIGNAL_NO_HOOKS* = 1 shl 6 - G_SIGNAL_FLAGS_MASK* = 0x0000007F - -type - PGConnectFlags* = ptr TGConnectFlags - TGConnectFlags* = int32 - -const - G_CONNECT_AFTER* = 1 shl 0 - G_CONNECT_SWAPPED* = 1 shl 1 - -type - PGSignalMatchType* = ptr TGSignalMatchType - TGSignalMatchType* = int32 - -const - G_SIGNAL_MATCH_ID* = 1 shl 0 - G_SIGNAL_MATCH_DETAIL* = 1 shl 1 - G_SIGNAL_MATCH_CLOSURE* = 1 shl 2 - G_SIGNAL_MATCH_FUNC* = 1 shl 3 - G_SIGNAL_MATCH_DATA* = 1 shl 4 - G_SIGNAL_MATCH_UNBLOCKED* = 1 shl 5 - G_SIGNAL_MATCH_MASK* = 0x0000003F - G_SIGNAL_TYPE_STATIC_SCOPE* = G_TYPE_FLAG_RESERVED_ID_BIT - -proc g_signal_newv*(signal_name: cstring, itype: GType, - signal_flags: TGSignalFlags, class_closure: PGClosure, - accumulator: TGSignalAccumulator, accu_data: gpointer, - c_marshaller: TGSignalCMarshaller, return_type: GType, - n_params: guint, param_types: PGType): guint{.cdecl, - dynlib: gobjectlib, importc: "g_signal_newv".} -proc signal_emitv*(instance_and_params: PGValue, signal_id: guint, - detail: TGQuark, return_value: PGValue){.cdecl, - dynlib: gobjectlib, importc: "g_signal_emitv".} -proc g_signal_lookup*(name: cstring, itype: GType): guint{.cdecl, - dynlib: gobjectlib, importc: "g_signal_lookup".} -proc g_signal_name*(signal_id: guint): cstring{.cdecl, dynlib: gobjectlib, - importc: "g_signal_name".} -proc g_signal_query*(signal_id: guint, query: PGSignalQuery){.cdecl, - dynlib: gobjectlib, importc: "g_signal_query".} -proc g_signal_list_ids*(itype: GType, n_ids: Pguint): Pguint{.cdecl, - dynlib: gobjectlib, importc: "g_signal_list_ids".} -proc g_signal_parse_name*(detailed_signal: cstring, itype: GType, - signal_id_p: Pguint, detail_p: PGQuark, - force_detail_quark: gboolean): gboolean{.cdecl, - dynlib: gobjectlib, importc: "g_signal_parse_name".} -proc g_signal_get_invocation_hint*(instance: gpointer): PGSignalInvocationHint{. - cdecl, dynlib: gobjectlib, importc: "g_signal_get_invocation_hint".} -proc g_signal_stop_emission*(instance: gpointer, signal_id: guint, - detail: TGQuark){.cdecl, dynlib: gobjectlib, - importc: "g_signal_stop_emission".} -proc g_signal_stop_emission_by_name*(instance: gpointer, - detailed_signal: cstring){.cdecl, - dynlib: gobjectlib, importc: "g_signal_stop_emission_by_name".} -proc g_signal_add_emission_hook*(signal_id: guint, quark: TGQuark, - hook_func: TGSignalEmissionHook, - hook_data: gpointer, - data_destroy: TGDestroyNotify): gulong{.cdecl, - dynlib: gobjectlib, importc: "g_signal_add_emission_hook".} -proc g_signal_remove_emission_hook*(signal_id: guint, hook_id: gulong){.cdecl, - dynlib: gobjectlib, importc: "g_signal_remove_emission_hook".} -proc g_signal_has_handler_pending*(instance: gpointer, signal_id: guint, - detail: TGQuark, may_be_blocked: gboolean): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_signal_has_handler_pending".} -proc g_signal_connect_closure_by_id*(instance: gpointer, signal_id: guint, - detail: TGQuark, closure: PGClosure, - after: gboolean): gulong{.cdecl, - dynlib: gobjectlib, importc: "g_signal_connect_closure_by_id".} -proc g_signal_connect_closure*(instance: gpointer, detailed_signal: cstring, - closure: PGClosure, after: gboolean): gulong{. - cdecl, dynlib: gobjectlib, importc: "g_signal_connect_closure".} -proc g_signal_connect_data*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer, - destroy_data: TGClosureNotify, - connect_flags: TGConnectFlags): gulong{.cdecl, - dynlib: gobjectlib, importc: "g_signal_connect_data".} -proc g_signal_handler_block*(instance: gpointer, handler_id: gulong){.cdecl, - dynlib: gobjectlib, importc: "g_signal_handler_block".} -proc g_signal_handler_unblock*(instance: gpointer, handler_id: gulong){.cdecl, - dynlib: gobjectlib, importc: "g_signal_handler_unblock".} -proc g_signal_handler_disconnect*(instance: gpointer, handler_id: gulong){. - cdecl, dynlib: gobjectlib, importc: "g_signal_handler_disconnect".} -proc g_signal_handler_is_connected*(instance: gpointer, handler_id: gulong): gboolean{. - cdecl, dynlib: gobjectlib, importc: "g_signal_handler_is_connected".} -proc g_signal_handler_find*(instance: gpointer, mask: TGSignalMatchType, - signal_id: guint, detail: TGQuark, - closure: PGClosure, func: gpointer, data: gpointer): gulong{. - cdecl, dynlib: gobjectlib, importc: "g_signal_handler_find".} -proc g_signal_handlers_block_matched*(instance: gpointer, - mask: TGSignalMatchType, signal_id: guint, - detail: TGQuark, closure: PGClosure, - func: gpointer, data: gpointer): guint{. - cdecl, dynlib: gobjectlib, importc: "g_signal_handlers_block_matched".} -proc g_signal_handlers_unblock_matched*(instance: gpointer, - mask: TGSignalMatchType, - signal_id: guint, detail: TGQuark, - closure: PGClosure, func: gpointer, - data: gpointer): guint{.cdecl, - dynlib: gobjectlib, importc: "g_signal_handlers_unblock_matched".} -proc g_signal_handlers_disconnect_matched*(instance: gpointer, - mask: TGSignalMatchType, signal_id: guint, detail: TGQuark, - closure: PGClosure, func: gpointer, data: gpointer): guint{.cdecl, - dynlib: gobjectlib, importc: "g_signal_handlers_disconnect_matched".} -proc g_signal_override_class_closure*(signal_id: guint, instance_type: GType, - class_closure: PGClosure){.cdecl, - dynlib: gobjectlib, importc: "g_signal_override_class_closure".} -proc signal_chain_from_overridden*(instance_and_params: PGValue, - return_value: PGValue){.cdecl, - dynlib: gobjectlib, importc: "g_signal_chain_from_overridden".} -proc g_signal_connect*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer): gulong -proc g_signal_connect_after*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer): gulong -proc g_signal_connect_swapped*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer): gulong -proc g_signal_handlers_disconnect_by_func*(instance: gpointer, - func, data: gpointer): guint -proc g_signal_handlers_block_by_func*(instance: gpointer, func, data: gpointer) -proc g_signal_handlers_unblock_by_func*(instance: gpointer, func, data: gpointer) -proc g_signal_handlers_destroy*(instance: gpointer){.cdecl, dynlib: gobjectlib, - importc: "g_signal_handlers_destroy".} -proc g_signals_destroy*(itype: GType){.cdecl, dynlib: gobjectlib, - importc: "`g_signals_destroy`".} -type - TGTypePluginUse* = proc (plugin: PGTypePlugin){.cdecl.} - TGTypePluginUnuse* = proc (plugin: PGTypePlugin){.cdecl.} - TGTypePluginCompleteTypeInfo* = proc (plugin: PGTypePlugin, g_type: GType, - info: PGTypeInfo, - value_table: PGTypeValueTable){.cdecl.} - TGTypePluginCompleteInterfaceInfo* = proc (plugin: PGTypePlugin, - instance_type: GType, interface_type: GType, info: PGInterfaceInfo){.cdecl.} - PGTypePluginClass* = ptr TGTypePluginClass - TGTypePluginClass*{.final.} = object - base_iface*: TGTypeInterface - use_plugin*: TGTypePluginUse - unuse_plugin*: TGTypePluginUnuse - complete_type_info*: TGTypePluginCompleteTypeInfo - complete_interface_info*: TGTypePluginCompleteInterfaceInfo - - -proc G_TYPE_TYPE_PLUGIN*(): GType -proc G_TYPE_PLUGIN*(inst: Pointer): PGTypePlugin -proc G_TYPE_PLUGIN_CLASS*(vtable: Pointer): PGTypePluginClass -proc G_IS_TYPE_PLUGIN*(inst: Pointer): bool -proc G_IS_TYPE_PLUGIN_CLASS*(vtable: Pointer): bool -proc G_TYPE_PLUGIN_GET_CLASS*(inst: Pointer): PGTypePluginClass -proc g_type_plugin_get_type*(): GType{.cdecl, dynlib: gliblib, - importc: "g_type_plugin_get_type".} -proc plugin_use*(plugin: PGTypePlugin){.cdecl, dynlib: gliblib, - importc: "g_type_plugin_use".} -proc plugin_unuse*(plugin: PGTypePlugin){.cdecl, dynlib: gliblib, - importc: "g_type_plugin_unuse".} -proc plugin_complete_type_info*(plugin: PGTypePlugin, g_type: GType, - info: PGTypeInfo, - value_table: PGTypeValueTable){.cdecl, - dynlib: gliblib, importc: "g_type_plugin_complete_type_info".} -proc plugin_complete_interface_info*(plugin: PGTypePlugin, - instance_type: GType, interface_type: GType, info: PGInterfaceInfo){.cdecl, - dynlib: gliblib, importc: "g_type_plugin_complete_interface_info".} -type - PGObject* = ptr TGObject - TGObject*{.pure, inheritable.} = object - g_type_instance*: TGTypeInstance - ref_count*: guint - qdata*: PGData - - TGObjectGetPropertyFunc* = proc (anObject: PGObject, property_id: guint, - value: PGValue, pspec: PGParamSpec){.cdecl.} - TGObjectSetPropertyFunc* = proc (anObject: PGObject, property_id: guint, - value: PGValue, pspec: PGParamSpec){.cdecl.} - TGObjectFinalizeFunc* = proc (anObject: PGObject){.cdecl.} - TGWeakNotify* = proc (data: gpointer, where_the_object_was: PGObject){.cdecl.} - PGObjectConstructParam* = ptr TGObjectConstructParam - PGObjectClass* = ptr TGObjectClass - TGObjectClass*{.pure, inheritable.} = object - g_type_class*: TGTypeClass - construct_properties*: PGSList - constructor*: proc (theType: GType, n_construct_properties: guint, - construct_properties: PGObjectConstructParam): PGObject{. - cdecl.} - set_property*: proc (anObject: PGObject, property_id: guint, value: PGValue, - pspec: PGParamSpec){.cdecl.} - get_property*: proc (anObject: PGObject, property_id: guint, value: PGValue, - pspec: PGParamSpec){.cdecl.} - dispose*: proc (anObject: PGObject){.cdecl.} - finalize*: proc (anObject: PGObject){.cdecl.} - dispatch_properties_changed*: proc (anObject: PGObject, n_pspecs: guint, - pspecs: PPGParamSpec){.cdecl.} - notify*: proc (anObject: PGObject, pspec: PGParamSpec){.cdecl.} - pdummy*: array[0..7, gpointer] - - TGObjectConstructParam*{.final.} = object - pspec*: PGParamSpec - value*: PGValue - - -proc G_TYPE_IS_OBJECT*(theType: GType): bool -proc G_OBJECT*(anObject: pointer): PGObject -proc G_OBJECT_CLASS*(class: Pointer): PGObjectClass -proc G_IS_OBJECT*(anObject: pointer): bool -proc G_IS_OBJECT_CLASS*(class: Pointer): bool -proc G_OBJECT_GET_CLASS*(anObject: pointer): PGObjectClass -proc G_OBJECT_TYPE*(anObject: pointer): GType -proc G_OBJECT_TYPE_NAME*(anObject: pointer): cstring -proc G_OBJECT_CLASS_TYPE*(class: Pointer): GType -proc G_OBJECT_CLASS_NAME*(class: Pointer): cstring -proc G_VALUE_HOLDS_OBJECT*(value: Pointer): bool -proc class_install_property*(oclass: PGObjectClass, property_id: guint, - pspec: PGParamSpec){.cdecl, - dynlib: gobjectlib, importc: "g_object_class_install_property".} -proc class_find_property*(oclass: PGObjectClass, property_name: cstring): PGParamSpec{. - cdecl, dynlib: gobjectlib, importc: "g_object_class_find_property".} -proc class_list_properties*(oclass: PGObjectClass, n_properties: Pguint): PPGParamSpec{. - cdecl, dynlib: gobjectlib, importc: "g_object_class_list_properties".} -proc set_property*(anObject: PGObject, property_name: cstring, - value: PGValue){.cdecl, dynlib: gobjectlib, - importc: "g_object_set_property".} -proc get_property*(anObject: PGObject, property_name: cstring, - value: PGValue){.cdecl, dynlib: gobjectlib, - importc: "g_object_get_property".} -proc freeze_notify*(anObject: PGObject){.cdecl, dynlib: gobjectlib, - importc: "g_object_freeze_notify".} -proc notify*(anObject: PGObject, property_name: cstring){.cdecl, - dynlib: gobjectlib, importc: "g_object_notify".} -proc thaw_notify*(anObject: PGObject){.cdecl, dynlib: gobjectlib, - importc: "g_object_thaw_notify".} -proc g_object_ref*(anObject: gpointer): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_object_ref".} -proc g_object_unref*(anObject: gpointer){.cdecl, dynlib: gobjectlib, - importc: "g_object_unref".} -proc weak_ref*(anObject: PGObject, notify: TGWeakNotify, data: gpointer){. - cdecl, dynlib: gobjectlib, importc: "g_object_weak_ref".} -proc weak_unref*(anObject: PGObject, notify: TGWeakNotify, - data: gpointer){.cdecl, dynlib: gobjectlib, - importc: "g_object_weak_unref".} -proc add_weak_pointer*(anObject: PGObject, - weak_pointer_location: Pgpointer){.cdecl, - dynlib: gobjectlib, importc: "g_object_add_weak_pointer".} -proc remove_weak_pointer*(anObject: PGObject, - weak_pointer_location: Pgpointer){.cdecl, - dynlib: gobjectlib, importc: "g_object_remove_weak_pointer".} -proc get_qdata*(anObject: PGObject, quark: TGQuark): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_object_get_qdata".} -proc set_qdata*(anObject: PGObject, quark: TGQuark, data: gpointer){. - cdecl, dynlib: gobjectlib, importc: "g_object_set_qdata".} -proc set_qdata_full*(anObject: PGObject, quark: TGQuark, - data: gpointer, destroy: TGDestroyNotify){.cdecl, - dynlib: gobjectlib, importc: "g_object_set_qdata_full".} -proc steal_qdata*(anObject: PGObject, quark: TGQuark): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_object_steal_qdata".} -proc get_data*(anObject: PGObject, key: cstring): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_object_get_data".} -proc set_data*(anObject: PGObject, key: cstring, data: gpointer){. - cdecl, dynlib: gobjectlib, importc: "g_object_set_data".} -proc set_data_full*(anObject: PGObject, key: cstring, data: gpointer, - destroy: TGDestroyNotify){.cdecl, - dynlib: gobjectlib, importc: "g_object_set_data_full".} -proc steal_data*(anObject: PGObject, key: cstring): gpointer{.cdecl, - dynlib: gobjectlib, importc: "g_object_steal_data".} -proc watch_closure*(anObject: PGObject, closure: PGClosure){.cdecl, - dynlib: gobjectlib, importc: "g_object_watch_closure".} -proc g_cclosure_new_object*(callback_func: TGCallback, anObject: PGObject): PGClosure{. - cdecl, dynlib: gobjectlib, importc: "g_cclosure_new_object".} -proc g_cclosure_new_object_swap*(callback_func: TGCallback, anObject: PGObject): PGClosure{. - cdecl, dynlib: gobjectlib, importc: "g_cclosure_new_object_swap".} -proc g_closure_new_object*(sizeof_closure: guint, anObject: PGObject): PGClosure{. - cdecl, dynlib: gobjectlib, importc: "g_closure_new_object".} -proc set_object*(value: PGValue, v_object: gpointer){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_object".} -proc get_object*(value: PGValue): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_object".} -proc dup_object*(value: PGValue): PGObject{.cdecl, dynlib: gobjectlib, - importc: "g_value_dup_object".} -proc g_signal_connect_object*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, gobject: gpointer, - connect_flags: TGConnectFlags): gulong{.cdecl, - dynlib: gobjectlib, importc: "g_signal_connect_object".} -proc run_dispose*(anObject: PGObject){.cdecl, dynlib: gobjectlib, - importc: "g_object_run_dispose".} -proc set_object_take_ownership*(value: PGValue, v_object: gpointer){. - cdecl, dynlib: gobjectlib, importc: "g_value_set_object_take_ownership".} -proc G_OBJECT_WARN_INVALID_PSPEC*(anObject: gpointer, pname: cstring, - property_id: gint, pspec: gpointer) -proc G_OBJECT_WARN_INVALID_PROPERTY_ID*(anObject: gpointer, property_id: gint, - pspec: gpointer) -type - G_FLAGS_TYPE* = GType - -const - G_E* = 2.71828 - G_LN2* = 0.693147 - G_LN10* = 2.30259 - G_PI* = 3.14159 - G_PI_2* = 1.57080 - G_PI_4* = 0.785398 - G_SQRT2* = 1.41421 - G_LITTLE_ENDIAN* = 1234 - G_BIG_ENDIAN* = 4321 - G_PDP_ENDIAN* = 3412 - -proc GUINT16_SWAP_LE_BE_CONSTANT*(val: guint16): guint16 -proc GUINT32_SWAP_LE_BE_CONSTANT*(val: guint32): guint32 -type - PGEnumClass* = ptr TGEnumClass - PGEnumValue* = ptr TGEnumValue - TGEnumClass*{.final.} = object - g_type_class*: TGTypeClass - minimum*: gint - maximum*: gint - n_values*: guint - values*: PGEnumValue - - TGEnumValue*{.final.} = object - value*: gint - value_name*: cstring - value_nick*: cstring - - PGFlagsClass* = ptr TGFlagsClass - PGFlagsValue* = ptr TGFlagsValue - TGFlagsClass*{.final.} = object - g_type_class*: TGTypeClass - mask*: guint - n_values*: guint - values*: PGFlagsValue - - TGFlagsValue*{.final.} = object - value*: guint - value_name*: cstring - value_nick*: cstring - - -proc G_TYPE_IS_ENUM*(theType: GType): gboolean -proc G_ENUM_CLASS*(class: pointer): PGEnumClass -proc G_IS_ENUM_CLASS*(class: pointer): gboolean -proc G_ENUM_CLASS_TYPE*(class: pointer): GType -proc G_ENUM_CLASS_TYPE_NAME*(class: pointer): cstring -proc G_TYPE_IS_FLAGS*(theType: GType): gboolean -proc G_FLAGS_CLASS*(class: pointer): PGFlagsClass -proc G_IS_FLAGS_CLASS*(class: pointer): gboolean -proc G_FLAGS_CLASS_TYPE*(class: pointer): GType -proc G_FLAGS_CLASS_TYPE_NAME*(class: pointer): cstring -proc G_VALUE_HOLDS_ENUM*(value: pointer): gboolean -proc G_VALUE_HOLDS_FLAGS*(value: pointer): gboolean -proc get_value*(enum_class: PGEnumClass, value: gint): PGEnumValue{. - cdecl, dynlib: gliblib, importc: "g_enum_get_value".} -proc get_value_by_name*(enum_class: PGEnumClass, name: cstring): PGEnumValue{. - cdecl, dynlib: gliblib, importc: "g_enum_get_value_by_name".} -proc get_value_by_nick*(enum_class: PGEnumClass, nick: cstring): PGEnumValue{. - cdecl, dynlib: gliblib, importc: "g_enum_get_value_by_nick".} -proc get_first_value*(flags_class: PGFlagsClass, value: guint): PGFlagsValue{. - cdecl, dynlib: gliblib, importc: "g_flags_get_first_value".} -proc get_value_by_name*(flags_class: PGFlagsClass, name: cstring): PGFlagsValue{. - cdecl, dynlib: gliblib, importc: "g_flags_get_value_by_name".} -proc get_value_by_nick*(flags_class: PGFlagsClass, nick: cstring): PGFlagsValue{. - cdecl, dynlib: gliblib, importc: "g_flags_get_value_by_nick".} -proc set_enum*(value: PGValue, v_enum: gint){.cdecl, dynlib: gliblib, - importc: "g_value_set_enum".} -proc get_enum*(value: PGValue): gint{.cdecl, dynlib: gliblib, - importc: "g_value_get_enum".} -proc set_flags*(value: PGValue, v_flags: guint){.cdecl, dynlib: gliblib, - importc: "g_value_set_flags".} -proc get_flags*(value: PGValue): guint{.cdecl, dynlib: gliblib, - importc: "g_value_get_flags".} -proc g_enum_register_static*(name: cstring, const_static_values: PGEnumValue): GType{. - cdecl, dynlib: gliblib, importc: "g_enum_register_static".} -proc g_flags_register_static*(name: cstring, const_static_values: PGFlagsValue): GType{. - cdecl, dynlib: gliblib, importc: "g_flags_register_static".} -proc g_enum_complete_type_info*(g_enum_type: GType, info: PGTypeInfo, - const_values: PGEnumValue){.cdecl, - dynlib: gliblib, importc: "g_enum_complete_type_info".} -proc g_flags_complete_type_info*(g_flags_type: GType, info: PGTypeInfo, - const_values: PGFlagsValue){.cdecl, - dynlib: gliblib, importc: "g_flags_complete_type_info".} -const - G_MINFLOAT* = 0.00000 - G_MAXFLOAT* = 1.70000e+308 - G_MINDOUBLE* = G_MINFLOAT - G_MAXDOUBLE* = G_MAXFLOAT - G_MAXSHORT* = 32767 - G_MINSHORT* = - G_MAXSHORT - 1 - G_MAXUSHORT* = 2 * G_MAXSHORT + 1 - G_MAXINT* = 2147483647 - G_MININT* = - G_MAXINT - 1 - G_MAXUINT* = - 1 - G_MINLONG* = G_MININT - G_MAXLONG* = G_MAXINT - G_MAXULONG* = G_MAXUINT - G_MAXINT64* = high(int64) - G_MININT64* = low(int64) - -const - G_GINT16_FORMAT* = "hi" - G_GUINT16_FORMAT* = "hu" - G_GINT32_FORMAT* = 'i' - G_GUINT32_FORMAT* = 'u' - G_HAVE_GINT64* = 1 - G_GINT64_FORMAT* = "I64i" - G_GUINT64_FORMAT* = "I64u" - GLIB_SIZEOF_VOID_P* = SizeOf(Pointer) - GLIB_SIZEOF_LONG* = SizeOf(int32) - GLIB_SIZEOF_SIZE_T* = SizeOf(int32) - -type - PGSystemThread* = ptr TGSystemThread - TGSystemThread*{.final.} = object - data*: array[0..3, char] - dummy_double*: float64 - dummy_pointer*: pointer - dummy_long*: int32 - - -const - GLIB_SYSDEF_POLLIN* = 1 - GLIB_SYSDEF_POLLOUT* = 4 - GLIB_SYSDEF_POLLPRI* = 2 - GLIB_SYSDEF_POLLERR* = 8 - GLIB_SYSDEF_POLLHUP* = 16 - GLIB_SYSDEF_POLLNVAL* = 32 - -proc GUINT_TO_POINTER*(i: guint): pointer -type - PGAsciiType* = ptr TGAsciiType - TGAsciiType* = int32 - -const - G_ASCII_ALNUM* = 1 shl 0 - G_ASCII_ALPHA* = 1 shl 1 - G_ASCII_CNTRL* = 1 shl 2 - G_ASCII_DIGIT* = 1 shl 3 - G_ASCII_GRAPH* = 1 shl 4 - G_ASCII_LOWER* = 1 shl 5 - G_ASCII_PRINT* = 1 shl 6 - G_ASCII_PUNCT* = 1 shl 7 - G_ASCII_SPACE* = 1 shl 8 - G_ASCII_UPPER* = 1 shl 9 - G_ASCII_XDIGIT* = 1 shl 10 - -proc g_ascii_tolower*(c: gchar): gchar{.cdecl, dynlib: gliblib, - importc: "g_ascii_tolower".} -proc g_ascii_toupper*(c: gchar): gchar{.cdecl, dynlib: gliblib, - importc: "g_ascii_toupper".} -proc g_ascii_digit_value*(c: gchar): gint{.cdecl, dynlib: gliblib, - importc: "g_ascii_digit_value".} -proc g_ascii_xdigit_value*(c: gchar): gint{.cdecl, dynlib: gliblib, - importc: "g_ascii_xdigit_value".} -const - G_STR_DELIMITERS* = "``-|> <." - -proc g_strdelimit*(str: cstring, delimiters: cstring, new_delimiter: gchar): cstring{. - cdecl, dynlib: gliblib, importc: "g_strdelimit".} -proc g_strcanon*(str: cstring, valid_chars: cstring, substitutor: gchar): cstring{. - cdecl, dynlib: gliblib, importc: "g_strcanon".} -proc g_strerror*(errnum: gint): cstring{.cdecl, dynlib: gliblib, - importc: "g_strerror".} -proc g_strsignal*(signum: gint): cstring{.cdecl, dynlib: gliblib, - importc: "g_strsignal".} -proc g_strreverse*(str: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_strreverse".} -proc g_strlcpy*(dest: cstring, src: cstring, dest_size: gsize): gsize{.cdecl, - dynlib: gliblib, importc: "g_strlcpy".} -proc g_strlcat*(dest: cstring, src: cstring, dest_size: gsize): gsize{.cdecl, - dynlib: gliblib, importc: "g_strlcat".} -proc g_strstr_len*(haystack: cstring, haystack_len: gssize, needle: cstring): cstring{. - cdecl, dynlib: gliblib, importc: "g_strstr_len".} -proc g_strrstr*(haystack: cstring, needle: cstring): cstring{.cdecl, - dynlib: gliblib, importc: "g_strrstr".} -proc g_strrstr_len*(haystack: cstring, haystack_len: gssize, needle: cstring): cstring{. - cdecl, dynlib: gliblib, importc: "g_strrstr_len".} -proc g_str_has_suffix*(str: cstring, suffix: cstring): gboolean{.cdecl, - dynlib: gliblib, importc: "g_str_has_suffix".} -proc g_str_has_prefix*(str: cstring, prefix: cstring): gboolean{.cdecl, - dynlib: gliblib, importc: "g_str_has_prefix".} -proc g_strtod*(nptr: cstring, endptr: PPgchar): gdouble{.cdecl, dynlib: gliblib, - importc: "g_strtod".} -proc g_ascii_strtod*(nptr: cstring, endptr: PPgchar): gdouble{.cdecl, - dynlib: gliblib, importc: "g_ascii_strtod".} -const - G_ASCII_DTOSTR_BUF_SIZE* = 29 + 10 - -proc g_ascii_dtostr*(buffer: cstring, buf_len: gint, d: gdouble): cstring{. - cdecl, dynlib: gliblib, importc: "g_ascii_dtostr".} -proc g_ascii_formatd*(buffer: cstring, buf_len: gint, format: cstring, - d: gdouble): cstring{.cdecl, dynlib: gliblib, - importc: "g_ascii_formatd".} -proc g_strchug*(str: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_strchug".} -proc g_strchomp*(str: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_strchomp".} -proc g_ascii_strcasecmp*(s1: cstring, s2: cstring): gint{.cdecl, - dynlib: gliblib, importc: "g_ascii_strcasecmp".} -proc g_ascii_strncasecmp*(s1: cstring, s2: cstring, n: gsize): gint{.cdecl, - dynlib: gliblib, importc: "g_ascii_strncasecmp".} -proc g_ascii_strdown*(str: cstring, len: gssize): cstring{.cdecl, - dynlib: gliblib, importc: "g_ascii_strdown".} -proc g_ascii_strup*(str: cstring, len: gssize): cstring{.cdecl, dynlib: gliblib, - importc: "g_ascii_strup".} -proc g_strdup*(str: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_strdup".} -proc g_strndup*(str: cstring, n: gsize): cstring{.cdecl, dynlib: gliblib, - importc: "g_strndup".} -proc g_strnfill*(length: gsize, fill_char: gchar): cstring{.cdecl, - dynlib: gliblib, importc: "g_strnfill".} -proc g_strcompress*(source: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_strcompress".} -proc g_strescape*(source: cstring, exceptions: cstring): cstring{.cdecl, - dynlib: gliblib, importc: "g_strescape".} -proc g_memdup*(mem: gconstpointer, byte_size: guint): gpointer{.cdecl, - dynlib: gliblib, importc: "g_memdup".} -proc g_strsplit*(str: cstring, delimiter: cstring, max_tokens: gint): PPgchar{. - cdecl, dynlib: gliblib, importc: "g_strsplit".} -proc g_strjoinv*(separator: cstring, str_array: PPgchar): cstring{.cdecl, - dynlib: gliblib, importc: "g_strjoinv".} -proc g_strfreev*(str_array: PPgchar){.cdecl, dynlib: gliblib, - importc: "g_strfreev".} -proc g_strdupv*(str_array: PPgchar): PPgchar{.cdecl, dynlib: gliblib, - importc: "g_strdupv".} -proc g_stpcpy*(dest: cstring, src: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_stpcpy".} -proc g_get_user_name*(): cstring{.cdecl, dynlib: gliblib, - importc: "g_get_user_name".} -proc g_get_real_name*(): cstring{.cdecl, dynlib: gliblib, - importc: "g_get_real_name".} -proc g_get_home_dir*(): cstring{.cdecl, dynlib: gliblib, - importc: "g_get_home_dir".} -proc g_get_tmp_dir*(): cstring{.cdecl, dynlib: gliblib, importc: "g_get_tmp_dir".} -proc g_get_prgname*(): cstring{.cdecl, dynlib: gliblib, importc: "g_get_prgname".} -proc g_set_prgname*(prgname: cstring){.cdecl, dynlib: gliblib, - importc: "g_set_prgname".} -type - PGDebugKey* = ptr TGDebugKey - TGDebugKey*{.final.} = object - key*: cstring - value*: guint - - -proc g_parse_debug_string*(str: cstring, keys: PGDebugKey, nkeys: guint): guint{. - cdecl, dynlib: gliblib, importc: "g_parse_debug_string".} -proc g_path_is_absolute*(file_name: cstring): gboolean{.cdecl, dynlib: gliblib, - importc: "g_path_is_absolute".} -proc g_path_skip_root*(file_name: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_path_skip_root".} -proc g_basename*(file_name: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_basename".} -proc g_dirname*(file_name: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_path_get_dirname".} -proc g_get_current_dir*(): cstring{.cdecl, dynlib: gliblib, - importc: "g_get_current_dir".} -proc g_path_get_basename*(file_name: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_path_get_basename".} -proc g_path_get_dirname*(file_name: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_path_get_dirname".} -proc nullify_pointer*(nullify_location: Pgpointer){.cdecl, dynlib: gliblib, - importc: "g_nullify_pointer".} -proc g_getenv*(variable: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_getenv".} -type - TGVoidFunc* = proc (){.cdecl.} - -proc g_atexit*(func: TGVoidFunc){.cdecl, dynlib: gliblib, importc: "g_atexit".} -proc g_find_program_in_path*(program: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_find_program_in_path".} -proc g_bit_nth_lsf*(mask: gulong, nth_bit: gint): gint{.cdecl, dynlib: gliblib, - importc: "g_bit_nth_lsf".} -proc g_bit_nth_msf*(mask: gulong, nth_bit: gint): gint{.cdecl, dynlib: gliblib, - importc: "g_bit_nth_msf".} -proc g_bit_storage*(number: gulong): guint{.cdecl, dynlib: gliblib, - importc: "g_bit_storage".} -type - PPGTrashStack* = ptr PGTrashStack - PGTrashStack* = ptr TGTrashStack - TGTrashStack*{.final.} = object - next*: PGTrashStack - - -proc g_trash_stack_push*(stack_p: PPGTrashStack, data_p: gpointer){.cdecl, - dynlib: gliblib, importc: "g_trash_stack_push".} -proc g_trash_stack_pop*(stack_p: PPGTrashStack): gpointer{.cdecl, - dynlib: gliblib, importc: "g_trash_stack_pop".} -proc g_trash_stack_peek*(stack_p: PPGTrashStack): gpointer{.cdecl, - dynlib: gliblib, importc: "g_trash_stack_peek".} -proc g_trash_stack_height*(stack_p: PPGTrashStack): guint{.cdecl, - dynlib: gliblib, importc: "g_trash_stack_height".} -type - PGHashTable* = pointer - TGHRFunc* = proc (key, value, user_data: gpointer): gboolean{.cdecl.} - -proc g_hash_table_new*(hash_func: TGHashFunc, key_equal_func: TGEqualFunc): PGHashTable{. - cdecl, dynlib: gliblib, importc: "g_hash_table_new".} -proc g_hash_table_new_full*(hash_func: TGHashFunc, key_equal_func: TGEqualFunc, - key_destroy_func: TGDestroyNotify, - value_destroy_func: TGDestroyNotify): PGHashTable{. - cdecl, dynlib: gliblib, importc: "g_hash_table_new_full".} -proc table_destroy*(hash_table: PGHashTable){.cdecl, dynlib: gliblib, - importc: "g_hash_table_destroy".} -proc table_insert*(hash_table: PGHashTable, key: gpointer, - value: gpointer){.cdecl, dynlib: gliblib, - importc: "g_hash_table_insert".} -proc table_replace*(hash_table: PGHashTable, key: gpointer, - value: gpointer){.cdecl, dynlib: gliblib, - importc: "g_hash_table_replace".} -proc table_remove*(hash_table: PGHashTable, key: gconstpointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_hash_table_remove".} -proc table_steal*(hash_table: PGHashTable, key: gconstpointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_hash_table_steal".} -proc table_lookup*(hash_table: PGHashTable, key: gconstpointer): gpointer{. - cdecl, dynlib: gliblib, importc: "g_hash_table_lookup".} -proc table_lookup_extended*(hash_table: PGHashTable, - lookup_key: gconstpointer, - orig_key: Pgpointer, value: Pgpointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_hash_table_lookup_extended".} -proc table_foreach*(hash_table: PGHashTable, func: TGHFunc, - user_data: gpointer){.cdecl, dynlib: gliblib, - importc: "g_hash_table_foreach".} -proc table_foreach_remove*(hash_table: PGHashTable, func: TGHRFunc, - user_data: gpointer): guint{.cdecl, - dynlib: gliblib, importc: "g_hash_table_foreach_remove".} -proc table_foreach_steal*(hash_table: PGHashTable, func: TGHRFunc, - user_data: gpointer): guint{.cdecl, - dynlib: gliblib, importc: "g_hash_table_foreach_steal".} -proc table_size*(hash_table: PGHashTable): guint{.cdecl, dynlib: gliblib, - importc: "g_hash_table_size".} -proc g_str_equal*(v: gconstpointer, v2: gconstpointer): gboolean{.cdecl, - dynlib: gliblib, importc: "g_str_equal".} -proc g_str_hash*(v: gconstpointer): guint{.cdecl, dynlib: gliblib, - importc: "g_str_hash".} -proc g_int_equal*(v: gconstpointer, v2: gconstpointer): gboolean{.cdecl, - dynlib: gliblib, importc: "g_int_equal".} -proc g_int_hash*(v: gconstpointer): guint{.cdecl, dynlib: gliblib, - importc: "g_int_hash".} -proc g_direct_hash*(v: gconstpointer): guint{.cdecl, dynlib: gliblib, - importc: "g_direct_hash".} -proc g_direct_equal*(v: gconstpointer, v2: gconstpointer): gboolean{.cdecl, - dynlib: gliblib, importc: "g_direct_equal".} -proc g_quark_try_string*(str: cstring): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_quark_try_string".} -proc g_quark_from_static_string*(str: cstring): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_quark_from_static_string".} -proc g_quark_from_string*(str: cstring): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_quark_from_string".} -proc g_quark_to_string*(quark: TGQuark): cstring{.cdecl, dynlib: gliblib, - importc: "g_quark_to_string".} -const - G_MEM_ALIGN* = GLIB_SIZEOF_VOID_P - -type - PGMemVTable* = ptr TGMemVTable - TGMemVTable*{.final.} = object - malloc*: proc (n_bytes: gsize): gpointer{.cdecl.} - realloc*: proc (mem: gpointer, n_bytes: gsize): gpointer{.cdecl.} - free*: proc (mem: gpointer){.cdecl.} - calloc*: proc (n_blocks: gsize, n_block_bytes: gsize): gpointer{.cdecl.} - try_malloc*: proc (n_bytes: gsize): gpointer{.cdecl.} - try_realloc*: proc (mem: gpointer, n_bytes: gsize): gpointer{.cdecl.} - - PGMemChunk* = pointer - PGAllocator* = pointer - -proc g_malloc*(n_bytes: gulong): gpointer{.cdecl, dynlib: gliblib, - importc: "g_malloc".} -proc g_malloc0*(n_bytes: gulong): gpointer{.cdecl, dynlib: gliblib, - importc: "g_malloc0".} -proc g_realloc*(mem: gpointer, n_bytes: gulong): gpointer{.cdecl, - dynlib: gliblib, importc: "g_realloc".} -proc g_free*(mem: gpointer){.cdecl, dynlib: gliblib, importc: "g_free".} -proc g_try_malloc*(n_bytes: gulong): gpointer{.cdecl, dynlib: gliblib, - importc: "g_try_malloc".} -proc g_try_realloc*(mem: gpointer, n_bytes: gulong): gpointer{.cdecl, - dynlib: gliblib, importc: "g_try_realloc".} -#proc g_new*(bytes_per_struct, n_structs: gsize): gpointer -#proc g_new0*(bytes_per_struct, n_structs: gsize): gpointer -#proc g_renew*(struct_size: gsize, OldMem: gpointer, n_structs: gsize): gpointer - -proc set_vtable*(vtable: PGMemVTable){.cdecl, dynlib: gliblib, - importc: "g_mem_set_vtable".} -proc g_mem_is_system_malloc*(): gboolean{.cdecl, dynlib: gliblib, - importc: "g_mem_is_system_malloc".} -proc g_mem_profile*(){.cdecl, dynlib: gliblib, importc: "g_mem_profile".} -proc g_chunk_new*(chunk: Pointer): Pointer -proc g_chunk_new0*(chunk: Pointer): Pointer - -const - G_ALLOC_ONLY* = 1 - G_ALLOC_AND_FREE* = 2 - -proc g_mem_chunk_new*(name: cstring, atom_size: gint, area_size: gulong, - theType: gint): PGMemChunk{.cdecl, dynlib: gliblib, - importc: "g_mem_chunk_new".} -proc chunk_destroy*(mem_chunk: PGMemChunk){.cdecl, dynlib: gliblib, - importc: "g_mem_chunk_destroy".} -proc chunk_alloc*(mem_chunk: PGMemChunk): gpointer{.cdecl, - dynlib: gliblib, importc: "g_mem_chunk_alloc".} -proc chunk_alloc0*(mem_chunk: PGMemChunk): gpointer{.cdecl, - dynlib: gliblib, importc: "g_mem_chunk_alloc0".} -proc chunk_free*(mem_chunk: PGMemChunk, mem: gpointer){.cdecl, - dynlib: gliblib, importc: "g_mem_chunk_free".} -proc chunk_clean*(mem_chunk: PGMemChunk){.cdecl, dynlib: gliblib, - importc: "g_mem_chunk_clean".} -proc chunk_reset*(mem_chunk: PGMemChunk){.cdecl, dynlib: gliblib, - importc: "g_mem_chunk_reset".} -proc chunk_print*(mem_chunk: PGMemChunk){.cdecl, dynlib: gliblib, - importc: "g_mem_chunk_print".} -proc g_mem_chunk_info*(){.cdecl, dynlib: gliblib, importc: "g_mem_chunk_info".} -proc g_blow_chunks*(){.cdecl, dynlib: gliblib, importc: "g_blow_chunks".} -proc g_allocator_new*(name: cstring, n_preallocs: guint): PGAllocator{.cdecl, - dynlib: gliblib, importc: "g_allocator_new".} -proc free*(allocator: PGAllocator){.cdecl, dynlib: gliblib, - importc: "g_allocator_free".} -const - G_ALLOCATOR_LIST* = 1 - G_ALLOCATOR_SLIST* = 2 - G_ALLOCATOR_NODE* = 3 - -proc slist_push_allocator*(allocator: PGAllocator){.cdecl, dynlib: gliblib, - importc: "g_slist_push_allocator".} -proc g_slist_pop_allocator*(){.cdecl, dynlib: gliblib, - importc: "g_slist_pop_allocator".} -proc g_slist_alloc*(): PGSList{.cdecl, dynlib: gliblib, importc: "g_slist_alloc".} -proc free*(list: PGSList){.cdecl, dynlib: gliblib, - importc: "g_slist_free".} -proc free_1*(list: PGSList){.cdecl, dynlib: gliblib, - importc: "g_slist_free_1".} -proc append*(list: PGSList, data: gpointer): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_append".} -proc prepend*(list: PGSList, data: gpointer): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_prepend".} -proc insert*(list: PGSList, data: gpointer, position: gint): PGSList{. - cdecl, dynlib: gliblib, importc: "g_slist_insert".} -proc insert_sorted*(list: PGSList, data: gpointer, func: TGCompareFunc): PGSList{. - cdecl, dynlib: gliblib, importc: "g_slist_insert_sorted".} -proc insert_before*(slist: PGSList, sibling: PGSList, data: gpointer): PGSList{. - cdecl, dynlib: gliblib, importc: "g_slist_insert_before".} -proc concat*(list1: PGSList, list2: PGSList): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_concat".} -proc remove*(list: PGSList, data: gconstpointer): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_remove".} -proc remove_all*(list: PGSList, data: gconstpointer): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_remove_all".} -proc remove_link*(list: PGSList, link: PGSList): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_remove_link".} -proc delete_link*(list: PGSList, link: PGSList): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_delete_link".} -proc reverse*(list: PGSList): PGSList{.cdecl, dynlib: gliblib, - importc: "g_slist_reverse".} -proc copy*(list: PGSList): PGSList{.cdecl, dynlib: gliblib, - importc: "g_slist_copy".} -proc nth*(list: PGSList, n: guint): PGSList{.cdecl, dynlib: gliblib, - importc: "g_slist_nth".} -proc find*(list: PGSList, data: gconstpointer): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_find".} -proc find_custom*(list: PGSList, data: gconstpointer, - func: TGCompareFunc): PGSList{.cdecl, dynlib: gliblib, - importc: "g_slist_find_custom".} -proc position*(list: PGSList, llink: PGSList): gint{.cdecl, - dynlib: gliblib, importc: "g_slist_position".} -proc index*(list: PGSList, data: gconstpointer): gint{.cdecl, - dynlib: gliblib, importc: "g_slist_index".} -proc last*(list: PGSList): PGSList{.cdecl, dynlib: gliblib, - importc: "g_slist_last".} -proc length*(list: PGSList): guint{.cdecl, dynlib: gliblib, - importc: "g_slist_length".} -proc foreach*(list: PGSList, func: TGFunc, user_data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_slist_foreach".} -proc sort*(list: PGSList, compare_func: TGCompareFunc): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_sort".} -proc sort*(list: PGSList, compare_func: TGCompareDataFunc, - user_data: gpointer): PGSList{.cdecl, - dynlib: gliblib, importc: "g_slist_sort_with_data".} -proc nth_data*(list: PGSList, n: guint): gpointer{.cdecl, - dynlib: gliblib, importc: "g_slist_nth_data".} -proc next*(slist: PGSList): PGSList -proc list_push_allocator*(allocator: PGAllocator){.cdecl, dynlib: gliblib, - importc: "g_list_push_allocator".} -proc g_list_pop_allocator*(){.cdecl, dynlib: gliblib, - importc: "g_list_pop_allocator".} -proc g_list_alloc*(): PGList{.cdecl, dynlib: gliblib, importc: "g_list_alloc".} -proc free*(list: PGList){.cdecl, dynlib: gliblib, importc: "g_list_free".} -proc free_1*(list: PGList){.cdecl, dynlib: gliblib, - importc: "g_list_free_1".} -proc append*(list: PGList, data: gpointer): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_append".} -proc prepend*(list: PGList, data: gpointer): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_prepend".} -proc insert*(list: PGList, data: gpointer, position: gint): PGList{. - cdecl, dynlib: gliblib, importc: "g_list_insert".} -proc insert_sorted*(list: PGList, data: gpointer, func: TGCompareFunc): PGList{. - cdecl, dynlib: gliblib, importc: "g_list_insert_sorted".} -proc insert_before*(list: PGList, sibling: PGList, data: gpointer): PGList{. - cdecl, dynlib: gliblib, importc: "g_list_insert_before".} -proc concat*(list1: PGList, list2: PGList): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_concat".} -proc remove*(list: PGList, data: gconstpointer): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_remove".} -proc remove_all*(list: PGList, data: gconstpointer): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_remove_all".} -proc remove_link*(list: PGList, llink: PGList): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_remove_link".} -proc delete_link*(list: PGList, link: PGList): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_delete_link".} -proc reverse*(list: PGList): PGList{.cdecl, dynlib: gliblib, - importc: "g_list_reverse".} -proc copy*(list: PGList): PGList{.cdecl, dynlib: gliblib, - importc: "g_list_copy".} -proc nth*(list: PGList, n: guint): PGList{.cdecl, dynlib: gliblib, - importc: "g_list_nth".} -proc nth_prev*(list: PGList, n: guint): PGList{.cdecl, dynlib: gliblib, - importc: "g_list_nth_prev".} -proc find*(list: PGList, data: gconstpointer): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_find".} -proc find_custom*(list: PGList, data: gconstpointer, func: TGCompareFunc): PGList{. - cdecl, dynlib: gliblib, importc: "g_list_find_custom".} -proc position*(list: PGList, llink: PGList): gint{.cdecl, - dynlib: gliblib, importc: "g_list_position".} -proc index*(list: PGList, data: gconstpointer): gint{.cdecl, - dynlib: gliblib, importc: "g_list_index".} -proc last*(list: PGList): PGList{.cdecl, dynlib: gliblib, - importc: "g_list_last".} -proc first*(list: PGList): PGList{.cdecl, dynlib: gliblib, - importc: "g_list_first".} -proc length*(list: PGList): guint{.cdecl, dynlib: gliblib, - importc: "g_list_length".} -proc foreach*(list: PGList, func: TGFunc, user_data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_list_foreach".} -proc sort*(list: PGList, compare_func: TGCompareFunc): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_sort".} -proc sort*(list: PGList, compare_func: TGCompareDataFunc, - user_data: gpointer): PGList{.cdecl, - dynlib: gliblib, importc: "g_list_sort_with_data".} -proc nth_data*(list: PGList, n: guint): gpointer{.cdecl, dynlib: gliblib, - importc: "g_list_nth_data".} -proc previous*(list: PGList): PGList -proc next*(list: PGList): PGList -type - PGCache* = pointer - TGCacheNewFunc* = proc (key: gpointer): gpointer{.cdecl.} - TGCacheDupFunc* = proc (value: gpointer): gpointer{.cdecl.} - TGCacheDestroyFunc* = proc (value: gpointer){.cdecl.} - -proc g_cache_new*(value_new_func: TGCacheNewFunc, - value_destroy_func: TGCacheDestroyFunc, - key_dup_func: TGCacheDupFunc, - key_destroy_func: TGCacheDestroyFunc, - hash_key_func: TGHashFunc, hash_value_func: TGHashFunc, - key_equal_func: TGEqualFunc): PGCache{.cdecl, dynlib: gliblib, - importc: "g_cache_new".} -proc destroy*(cache: PGCache){.cdecl, dynlib: gliblib, - importc: "g_cache_destroy".} -proc insert*(cache: PGCache, key: gpointer): gpointer{.cdecl, - dynlib: gliblib, importc: "g_cache_insert".} -proc remove*(cache: PGCache, value: gconstpointer){.cdecl, - dynlib: gliblib, importc: "g_cache_remove".} -proc key_foreach*(cache: PGCache, func: TGHFunc, user_data: gpointer){. - cdecl, dynlib: gliblib, importc: "g_cache_key_foreach".} -proc value_foreach*(cache: PGCache, func: TGHFunc, user_data: gpointer){. - cdecl, dynlib: gliblib, importc: "g_cache_value_foreach".} -type - PGCompletionFunc* = ptr TGCompletionFunc - TGCompletionFunc* = gchar - TGCompletionStrncmpFunc* = proc (s1: cstring, s2: cstring, n: gsize): gint{. - cdecl.} - PGCompletion* = ptr TGCompletion - TGCompletion*{.final.} = object - items*: PGList - func*: TGCompletionFunc - prefix*: cstring - cache*: PGList - strncmp_func*: TGCompletionStrncmpFunc - - -proc g_completion_new*(func: TGCompletionFunc): PGCompletion{.cdecl, - dynlib: gliblib, importc: "g_completion_new".} -proc add_items*(cmp: PGCompletion, items: PGList){.cdecl, - dynlib: gliblib, importc: "g_completion_add_items".} -proc remove_items*(cmp: PGCompletion, items: PGList){.cdecl, - dynlib: gliblib, importc: "g_completion_remove_items".} -proc clear_items*(cmp: PGCompletion){.cdecl, dynlib: gliblib, - importc: "g_completion_clear_items".} -proc complete*(cmp: PGCompletion, prefix: cstring, - new_prefix: PPgchar): PGList{.cdecl, - dynlib: gliblib, importc: "g_completion_complete".} -proc set_compare*(cmp: PGCompletion, - strncmp_func: TGCompletionStrncmpFunc){.cdecl, - dynlib: gliblib, importc: "g_completion_set_compare".} -proc free*(cmp: PGCompletion){.cdecl, dynlib: gliblib, - importc: "g_completion_free".} -type - PGConvertError* = ptr TGConvertError - TGConvertError* = enum - G_CONVERT_ERROR_NO_CONVERSION, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, - G_CONVERT_ERROR_FAILED, G_CONVERT_ERROR_PARTIAL_INPUT, - G_CONVERT_ERROR_BAD_URI, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH - -proc G_CONVERT_ERROR*(): TGQuark -proc g_convert_error_quark*(): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_convert_error_quark".} -type - PGIConv* = ptr TGIConv - TGIConv* = pointer - -proc g_iconv_open*(to_codeset: cstring, from_codeset: cstring): TGIConv{.cdecl, - dynlib: gliblib, importc: "g_iconv_open".} -proc g_iconv*(`converter`: TGIConv, inbuf: PPgchar, inbytes_left: Pgsize, - outbuf: PPgchar, outbytes_left: Pgsize): gsize{.cdecl, - dynlib: gliblib, importc: "g_iconv".} -proc g_iconv_close*(`converter`: TGIConv): gint{.cdecl, dynlib: gliblib, - importc: "g_iconv_close".} -proc g_convert*(str: cstring, len: gssize, to_codeset: cstring, - from_codeset: cstring, bytes_read: Pgsize, - bytes_written: Pgsize, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_convert".} -proc g_convert*(str: cstring, len: gssize, `converter`: TGIConv, - bytes_read: Pgsize, bytes_written: Pgsize, - error: pointer): cstring{.cdecl, dynlib: gliblib, - importc: "g_convert_with_iconv".} -proc g_convert*(str: cstring, len: gssize, to_codeset: cstring, - from_codeset: cstring, fallback: cstring, - bytes_read: Pgsize, bytes_written: Pgsize, - error: pointer): cstring{.cdecl, dynlib: gliblib, - importc: "g_convert_with_fallback".} -proc g_locale_to_utf8*(opsysstring: cstring, len: gssize, bytes_read: Pgsize, - bytes_written: Pgsize, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_locale_to_utf8".} -proc g_locale_from_utf8*(utf8string: cstring, len: gssize, bytes_read: Pgsize, - bytes_written: Pgsize, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_locale_from_utf8".} -proc g_filename_to_utf8*(opsysstring: cstring, len: gssize, bytes_read: Pgsize, - bytes_written: Pgsize, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_filename_to_utf8".} -proc g_filename_from_utf8*(utf8string: cstring, len: gssize, bytes_read: Pgsize, - bytes_written: Pgsize, error: pointer): cstring{. - cdecl, dynlib: gliblib, importc: "g_filename_from_utf8".} -proc g_filename_from_uri*(uri: cstring, hostname: PPchar, error: pointer): cstring{. - cdecl, dynlib: gliblib, importc: "g_filename_from_uri".} -proc g_filename_to_uri*(filename: cstring, hostname: cstring, error: pointer): cstring{. - cdecl, dynlib: gliblib, importc: "g_filename_to_uri".} -type - TGDataForeachFunc* = proc (key_id: TGQuark, data: gpointer, - user_data: gpointer){.cdecl.} - -proc g_datalist_init*(datalist: PPGData){.cdecl, dynlib: gliblib, - importc: "g_datalist_init".} -proc g_datalist_clear*(datalist: PPGData){.cdecl, dynlib: gliblib, - importc: "g_datalist_clear".} -proc g_datalist_id_get_data*(datalist: PPGData, key_id: TGQuark): gpointer{. - cdecl, dynlib: gliblib, importc: "g_datalist_id_get_data".} -proc g_datalist_id_set_data_full*(datalist: PPGData, key_id: TGQuark, - data: gpointer, destroy_func: TGDestroyNotify){. - cdecl, dynlib: gliblib, importc: "g_datalist_id_set_data_full".} -proc g_datalist_id_remove_no_notify*(datalist: PPGData, key_id: TGQuark): gpointer{. - cdecl, dynlib: gliblib, importc: "g_datalist_id_remove_no_notify".} -proc g_datalist_foreach*(datalist: PPGData, func: TGDataForeachFunc, - user_data: gpointer){.cdecl, dynlib: gliblib, - importc: "g_datalist_foreach".} -proc g_datalist_id_set_data*(datalist: PPGData, key_id: TGQuark, data: gpointer) -proc g_datalist_id_remove_data*(datalist: PPGData, key_id: TGQuark) -proc g_datalist_get_data*(datalist: PPGData, key_str: cstring): PPGData -proc g_datalist_set_data_full*(datalist: PPGData, key_str: cstring, - data: gpointer, destroy_func: TGDestroyNotify) -proc g_datalist_set_data*(datalist: PPGData, key_str: cstring, data: gpointer) -proc g_datalist_remove_no_notify*(datalist: PPGData, key_str: cstring) -proc g_datalist_remove_data*(datalist: PPGData, key_str: cstring) -proc g_dataset_id_get_data*(dataset_location: gconstpointer, key_id: TGQuark): gpointer{. - cdecl, dynlib: gliblib, importc: "g_dataset_id_get_data".} -proc g_dataset_id_set_data_full*(dataset_location: gconstpointer, - key_id: TGQuark, data: gpointer, - destroy_func: TGDestroyNotify){.cdecl, - dynlib: gliblib, importc: "g_dataset_id_set_data_full".} -proc g_dataset_id_remove_no_notify*(dataset_location: gconstpointer, - key_id: TGQuark): gpointer{.cdecl, - dynlib: gliblib, importc: "g_dataset_id_remove_no_notify".} -proc g_dataset_foreach*(dataset_location: gconstpointer, - func: TGDataForeachFunc, user_data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_dataset_foreach".} -proc g_dataset_id_set_data*(location: gconstpointer, key_id: TGQuark, - data: gpointer) -proc g_dataset_id_remove_data*(location: gconstpointer, key_id: TGQuark) -proc g_dataset_get_data*(location: gconstpointer, key_str: cstring): gpointer -proc g_dataset_set_data_full*(location: gconstpointer, key_str: cstring, - data: gpointer, destroy_func: TGDestroyNotify) -proc g_dataset_remove_no_notify*(location: gconstpointer, key_str: cstring) -proc g_dataset_set_data*(location: gconstpointer, key_str: cstring, - data: gpointer) -proc g_dataset_remove_data*(location: gconstpointer, key_str: cstring) -type - PGTime* = ptr TGTime - TGTime* = gint32 - PGDateYear* = ptr TGDateYear - TGDateYear* = guint16 - PGDateDay* = ptr TGDateDay - TGDateDay* = guint8 - Ptm* = ptr Ttm - Ttm*{.final.} = object - tm_sec*: gint - tm_min*: gint - tm_hour*: gint - tm_mday*: gint - tm_mon*: gint - tm_year*: gint - tm_wday*: gint - tm_yday*: gint - tm_isdst*: gint - tm_gmtoff*: glong - tm_zone*: cstring - - -type - PGDateDMY* = ptr TGDateDMY - TGDateDMY* = int - -const - G_DATE_DAY* = 0 - G_DATE_MONTH* = 1 - G_DATE_YEAR* = 2 - -type - PGDateWeekday* = ptr TGDateWeekday - TGDateWeekday* = int - -const - G_DATE_BAD_WEEKDAY* = 0 - G_DATE_MONDAY* = 1 - G_DATE_TUESDAY* = 2 - G_DATE_WEDNESDAY* = 3 - G_DATE_THURSDAY* = 4 - G_DATE_FRIDAY* = 5 - G_DATE_SATURDAY* = 6 - G_DATE_SUNDAY* = 7 - -type - PGDateMonth* = ptr TGDateMonth - TGDateMonth* = int - -const - G_DATE_BAD_MONTH* = 0 - G_DATE_JANUARY* = 1 - G_DATE_FEBRUARY* = 2 - G_DATE_MARCH* = 3 - G_DATE_APRIL* = 4 - G_DATE_MAY* = 5 - G_DATE_JUNE* = 6 - G_DATE_JULY* = 7 - G_DATE_AUGUST* = 8 - G_DATE_SEPTEMBER* = 9 - G_DATE_OCTOBER* = 10 - G_DATE_NOVEMBER* = 11 - G_DATE_DECEMBER* = 12 - -const - G_DATE_BAD_JULIAN* = 0 - G_DATE_BAD_DAY* = 0 - G_DATE_BAD_YEAR* = 0 - -type - PGDate* = ptr TGDate - TGDate*{.final.} = object - flag0*: int32 - flag1*: int32 - - -proc g_date_new*(): PGDate{.cdecl, dynlib: gliblib, importc: "g_date_new".} -proc g_date_new_dmy*(day: TGDateDay, month: TGDateMonth, year: TGDateYear): PGDate{. - cdecl, dynlib: gliblib, importc: "g_date_new_dmy".} -proc g_date_new_julian*(julian_day: guint32): PGDate{.cdecl, dynlib: gliblib, - importc: "g_date_new_julian".} -proc free*(date: PGDate){.cdecl, dynlib: gliblib, importc: "g_date_free".} -proc valid*(date: PGDate): gboolean{.cdecl, dynlib: gliblib, - importc: "g_date_valid".} -proc g_date_valid_month*(month: TGDateMonth): gboolean{.cdecl, dynlib: gliblib, - importc: "g_date_valid_month".} -proc g_date_valid_year*(year: TGDateYear): gboolean{.cdecl, dynlib: gliblib, - importc: "g_date_valid_year".} -proc g_date_valid_weekday*(weekday: TGDateWeekday): gboolean{.cdecl, - dynlib: gliblib, importc: "g_date_valid_weekday".} -proc g_date_valid_julian*(julian_date: guint32): gboolean{.cdecl, - dynlib: gliblib, importc: "g_date_valid_julian".} -proc get_weekday*(date: PGDate): TGDateWeekday{.cdecl, dynlib: gliblib, - importc: "g_date_get_weekday".} -proc get_month*(date: PGDate): TGDateMonth{.cdecl, dynlib: gliblib, - importc: "g_date_get_month".} -proc get_year*(date: PGDate): TGDateYear{.cdecl, dynlib: gliblib, - importc: "g_date_get_year".} -proc get_day*(date: PGDate): TGDateDay{.cdecl, dynlib: gliblib, - importc: "g_date_get_day".} -proc get_julian*(date: PGDate): guint32{.cdecl, dynlib: gliblib, - importc: "g_date_get_julian".} -proc get_day_of_year*(date: PGDate): guint{.cdecl, dynlib: gliblib, - importc: "g_date_get_day_of_year".} -proc get_monday_week_of_year*(date: PGDate): guint{.cdecl, - dynlib: gliblib, importc: "g_date_get_monday_week_of_year".} -proc get_sunday_week_of_year*(date: PGDate): guint{.cdecl, - dynlib: gliblib, importc: "g_date_get_sunday_week_of_year".} -proc clear*(date: PGDate, n_dates: guint){.cdecl, dynlib: gliblib, - importc: "g_date_clear".} -proc set_parse*(date: PGDate, str: cstring){.cdecl, dynlib: gliblib, - importc: "g_date_set_parse".} -proc set_time*(date: PGDate, time: TGTime){.cdecl, dynlib: gliblib, - importc: "g_date_set_time".} -proc set_month*(date: PGDate, month: TGDateMonth){.cdecl, - dynlib: gliblib, importc: "g_date_set_month".} -proc set_day*(date: PGDate, day: TGDateDay){.cdecl, dynlib: gliblib, - importc: "g_date_set_day".} -proc set_year*(date: PGDate, year: TGDateYear){.cdecl, dynlib: gliblib, - importc: "g_date_set_year".} -proc set_dmy*(date: PGDate, day: TGDateDay, month: TGDateMonth, - y: TGDateYear){.cdecl, dynlib: gliblib, - importc: "g_date_set_dmy".} -proc set_julian*(date: PGDate, julian_date: guint32){.cdecl, - dynlib: gliblib, importc: "g_date_set_julian".} -proc is_first_of_month*(date: PGDate): gboolean{.cdecl, dynlib: gliblib, - importc: "g_date_is_first_of_month".} -proc is_last_of_month*(date: PGDate): gboolean{.cdecl, dynlib: gliblib, - importc: "g_date_is_last_of_month".} -proc add_days*(date: PGDate, n_days: guint){.cdecl, dynlib: gliblib, - importc: "g_date_add_days".} -proc subtract_days*(date: PGDate, n_days: guint){.cdecl, dynlib: gliblib, - importc: "g_date_subtract_days".} -proc add_months*(date: PGDate, n_months: guint){.cdecl, dynlib: gliblib, - importc: "g_date_add_months".} -proc subtract_months*(date: PGDate, n_months: guint){.cdecl, - dynlib: gliblib, importc: "g_date_subtract_months".} -proc add_years*(date: PGDate, n_years: guint){.cdecl, dynlib: gliblib, - importc: "g_date_add_years".} -proc subtract_years*(date: PGDate, n_years: guint){.cdecl, - dynlib: gliblib, importc: "g_date_subtract_years".} -proc g_date_is_leap_year*(year: TGDateYear): gboolean{.cdecl, dynlib: gliblib, - importc: "g_date_is_leap_year".} -proc g_date_get_days_in_month*(month: TGDateMonth, year: TGDateYear): guint8{. - cdecl, dynlib: gliblib, importc: "g_date_get_days_in_month".} -proc g_date_get_monday_weeks_in_year*(year: TGDateYear): guint8{.cdecl, - dynlib: gliblib, importc: "g_date_get_monday_weeks_in_year".} -proc g_date_get_sunday_weeks_in_year*(year: TGDateYear): guint8{.cdecl, - dynlib: gliblib, importc: "g_date_get_sunday_weeks_in_year".} -proc days_between*(date1: PGDate, date2: PGDate): gint{.cdecl, - dynlib: gliblib, importc: "g_date_days_between".} -proc compare*(lhs: PGDate, rhs: PGDate): gint{.cdecl, dynlib: gliblib, - importc: "g_date_compare".} -proc to_struct_tm*(date: PGDate, tm: Ptm){.cdecl, dynlib: gliblib, - importc: "g_date_to_struct_tm".} -proc clamp*(date: PGDate, min_date: PGDate, max_date: PGDate){.cdecl, - dynlib: gliblib, importc: "g_date_clamp".} -proc order*(date1: PGDate, date2: PGDate){.cdecl, dynlib: gliblib, - importc: "g_date_order".} -proc g_date_strftime*(s: cstring, slen: gsize, format: cstring, date: PGDate): gsize{. - cdecl, dynlib: gliblib, importc: "g_date_strftime".} -type - PGDir* = pointer - -proc g_dir_open*(path: cstring, flags: guint, error: pointer): PGDir{.cdecl, - dynlib: gliblib, importc: "g_dir_open".} -proc read_name*(dir: PGDir): cstring{.cdecl, dynlib: gliblib, - importc: "g_dir_read_name".} -proc rewind*(dir: PGDir){.cdecl, dynlib: gliblib, importc: "g_dir_rewind".} -proc close*(dir: PGDir){.cdecl, dynlib: gliblib, importc: "g_dir_close".} -type - PGFileError* = ptr TGFileError - TGFileError* = gint - -type - PGFileTest* = ptr TGFileTest - TGFileTest* = int - -const - G_FILE_TEST_IS_REGULAR* = 1 shl 0 - G_FILE_TEST_IS_SYMLINK* = 1 shl 1 - G_FILE_TEST_IS_DIR* = 1 shl 2 - G_FILE_TEST_IS_EXECUTABLE* = 1 shl 3 - G_FILE_TEST_EXISTS* = 1 shl 4 - -const - G_FILE_ERROR_EXIST* = 0 - G_FILE_ERROR_ISDIR* = 1 - G_FILE_ERROR_ACCES* = 2 - G_FILE_ERROR_NAMETOOLONG* = 3 - G_FILE_ERROR_NOENT* = 4 - G_FILE_ERROR_NOTDIR* = 5 - G_FILE_ERROR_NXIO* = 6 - G_FILE_ERROR_NODEV* = 7 - G_FILE_ERROR_ROFS* = 8 - G_FILE_ERROR_TXTBSY* = 9 - G_FILE_ERROR_FAULT* = 10 - G_FILE_ERROR_LOOP* = 11 - G_FILE_ERROR_NOSPC* = 12 - G_FILE_ERROR_NOMEM* = 13 - G_FILE_ERROR_MFILE* = 14 - G_FILE_ERROR_NFILE* = 15 - G_FILE_ERROR_BADF* = 16 - G_FILE_ERROR_INVAL* = 17 - G_FILE_ERROR_PIPE* = 18 - G_FILE_ERROR_AGAIN* = 19 - G_FILE_ERROR_INTR* = 20 - G_FILE_ERROR_IO* = 21 - G_FILE_ERROR_PERM* = 22 - G_FILE_ERROR_FAILED* = 23 - -proc G_FILE_ERROR*(): TGQuark -proc g_file_error_quark*(): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_file_error_quark".} -proc g_file_error_from_errno*(err_no: gint): TGFileError{.cdecl, - dynlib: gliblib, importc: "g_file_error_from_errno".} -proc g_file_test*(filename: cstring, test: TGFileTest): gboolean{.cdecl, - dynlib: gliblib, importc: "g_file_test".} -proc g_file_get_contents*(filename: cstring, contents: PPgchar, length: Pgsize, - error: pointer): gboolean{.cdecl, dynlib: gliblib, - importc: "g_file_get_contents".} -proc g_mkstemp*(tmpl: cstring): int32{.cdecl, dynlib: gliblib, - importc: "g_mkstemp".} -proc g_file_open_tmp*(tmpl: cstring, name_used: PPchar, error: pointer): int32{. - cdecl, dynlib: gliblib, importc: "g_file_open_tmp".} -type - PGHook* = ptr TGHook - TGHook*{.final.} = object - data*: gpointer - next*: PGHook - prev*: PGHook - ref_count*: guint - hook_id*: gulong - flags*: guint - func*: gpointer - destroy*: TGDestroyNotify - - PGHookList* = ptr TGHookList - TGHookCompareFunc* = proc (new_hook: PGHook, sibling: PGHook): gint{.cdecl.} - TGHookFindFunc* = proc (hook: PGHook, data: gpointer): gboolean{.cdecl.} - TGHookMarshaller* = proc (hook: PGHook, marshal_data: gpointer){.cdecl.} - TGHookCheckMarshaller* = proc (hook: PGHook, marshal_data: gpointer): gboolean{. - cdecl.} - TGHookFunc* = proc (data: gpointer){.cdecl.} - TGHookCheckFunc* = proc (data: gpointer): gboolean{.cdecl.} - TGHookFinalizeFunc* = proc (hook_list: PGHookList, hook: PGHook){.cdecl.} - TGHookList*{.final.} = object - seq_id*: gulong - flag0*: int32 - hooks*: PGHook - hook_memchunk*: PGMemChunk - finalize_hook*: TGHookFinalizeFunc - dummy*: array[0..1, gpointer] - - -type - PGHookFlagMask* = ptr TGHookFlagMask - TGHookFlagMask* = int - -const - G_HOOK_FLAG_ACTIVE* = 1'i32 shl 0'i32 - G_HOOK_FLAG_IN_CALL* = 1'i32 shl 1'i32 - G_HOOK_FLAG_MASK* = 0x0000000F'i32 - -const - G_HOOK_FLAG_USER_SHIFT* = 4'i32 - bm_TGHookList_hook_size* = 0x0000FFFF'i32 - bp_TGHookList_hook_size* = 0'i32 - bm_TGHookList_is_setup* = 0x00010000'i32 - bp_TGHookList_is_setup* = 16'i32 - -proc TGHookList_hook_size*(a: PGHookList): guint -proc TGHookList_set_hook_size*(a: PGHookList, `hook_size`: guint) -proc TGHookList_is_setup*(a: PGHookList): guint -proc TGHookList_set_is_setup*(a: PGHookList, `is_setup`: guint) -proc G_HOOK*(hook: pointer): PGHook -proc FLAGS*(hook: PGHook): guint -proc ACTIVE*(hook: PGHook): bool -proc IN_CALL*(hook: PGHook): bool -proc IS_VALID*(hook: PGHook): bool -proc IS_UNLINKED*(hook: PGHook): bool -proc list_init*(hook_list: PGHookList, hook_size: guint){.cdecl, - dynlib: gliblib, importc: "g_hook_list_init".} -proc list_clear*(hook_list: PGHookList){.cdecl, dynlib: gliblib, - importc: "g_hook_list_clear".} -proc alloc*(hook_list: PGHookList): PGHook{.cdecl, dynlib: gliblib, - importc: "g_hook_alloc".} -proc free*(hook_list: PGHookList, hook: PGHook){.cdecl, dynlib: gliblib, - importc: "g_hook_free".} -proc reference*(hook_list: PGHookList, hook: PGHook){.cdecl, dynlib: gliblib, - importc: "g_hook_ref".} -proc unref*(hook_list: PGHookList, hook: PGHook){.cdecl, dynlib: gliblib, - importc: "g_hook_unref".} -proc destroy*(hook_list: PGHookList, hook_id: gulong): gboolean{.cdecl, - dynlib: gliblib, importc: "g_hook_destroy".} -proc destroy_link*(hook_list: PGHookList, hook: PGHook){.cdecl, - dynlib: gliblib, importc: "g_hook_destroy_link".} -proc prepend*(hook_list: PGHookList, hook: PGHook){.cdecl, - dynlib: gliblib, importc: "g_hook_prepend".} -proc insert_before*(hook_list: PGHookList, sibling: PGHook, hook: PGHook){. - cdecl, dynlib: gliblib, importc: "g_hook_insert_before".} -proc insert_sorted*(hook_list: PGHookList, hook: PGHook, - func: TGHookCompareFunc){.cdecl, dynlib: gliblib, - importc: "g_hook_insert_sorted".} -proc get*(hook_list: PGHookList, hook_id: gulong): PGHook{.cdecl, - dynlib: gliblib, importc: "g_hook_get".} -proc find*(hook_list: PGHookList, need_valids: gboolean, - func: TGHookFindFunc, data: gpointer): PGHook{.cdecl, - dynlib: gliblib, importc: "g_hook_find".} -proc find_data*(hook_list: PGHookList, need_valids: gboolean, - data: gpointer): PGHook{.cdecl, dynlib: gliblib, - importc: "g_hook_find_data".} -proc find_func*(hook_list: PGHookList, need_valids: gboolean, - func: gpointer): PGHook{.cdecl, dynlib: gliblib, - importc: "g_hook_find_func".} -proc find_func_data*(hook_list: PGHookList, need_valids: gboolean, - func: gpointer, data: gpointer): PGHook{.cdecl, - dynlib: gliblib, importc: "g_hook_find_func_data".} -proc first_valid*(hook_list: PGHookList, may_be_in_call: gboolean): PGHook{. - cdecl, dynlib: gliblib, importc: "g_hook_first_valid".} -proc next_valid*(hook_list: PGHookList, hook: PGHook, - may_be_in_call: gboolean): PGHook{.cdecl, - dynlib: gliblib, importc: "g_hook_next_valid".} -proc compare_ids*(new_hook: PGHook, sibling: PGHook): gint{.cdecl, - dynlib: gliblib, importc: "g_hook_compare_ids".} -proc append*(hook_list: PGHookList, hook: PGHook) -proc list_invoke_check*(hook_list: PGHookList, may_recurse: gboolean){. - cdecl, dynlib: gliblib, importc: "g_hook_list_invoke_check".} -proc list_marshal*(hook_list: PGHookList, may_recurse: gboolean, - marshaller: TGHookMarshaller, marshal_data: gpointer){. - cdecl, dynlib: gliblib, importc: "g_hook_list_marshal".} -proc list_marshal_check*(hook_list: PGHookList, may_recurse: gboolean, - marshaller: TGHookCheckMarshaller, - marshal_data: gpointer){.cdecl, dynlib: gliblib, - importc: "g_hook_list_marshal_check".} -type - PGThreadPool* = ptr TGThreadPool - TGThreadPool*{.final.} = object - func*: TGFunc - user_data*: gpointer - exclusive*: gboolean - - -proc g_thread_pool_new*(func: TGFunc, user_data: gpointer, max_threads: gint, - exclusive: gboolean, error: pointer): PGThreadPool{. - cdecl, dynlib: gliblib, importc: "g_thread_pool_new".} -proc pool_push*(pool: PGThreadPool, data: gpointer, error: pointer){. - cdecl, dynlib: gliblib, importc: "g_thread_pool_push".} -proc pool_set_max_threads*(pool: PGThreadPool, max_threads: gint, - error: pointer){.cdecl, dynlib: gliblib, - importc: "g_thread_pool_set_max_threads".} -proc pool_get_max_threads*(pool: PGThreadPool): gint{.cdecl, - dynlib: gliblib, importc: "g_thread_pool_get_max_threads".} -proc pool_get_num_threads*(pool: PGThreadPool): guint{.cdecl, - dynlib: gliblib, importc: "g_thread_pool_get_num_threads".} -proc pool_unprocessed*(pool: PGThreadPool): guint{.cdecl, - dynlib: gliblib, importc: "g_thread_pool_unprocessed".} -proc pool_free*(pool: PGThreadPool, immediate: gboolean, wait: gboolean){. - cdecl, dynlib: gliblib, importc: "g_thread_pool_free".} -proc g_thread_pool_set_max_unused_threads*(max_threads: gint){.cdecl, - dynlib: gliblib, importc: "g_thread_pool_set_max_unused_threads".} -proc g_thread_pool_get_max_unused_threads*(): gint{.cdecl, dynlib: gliblib, - importc: "g_thread_pool_get_max_unused_threads".} -proc g_thread_pool_get_num_unused_threads*(): guint{.cdecl, dynlib: gliblib, - importc: "g_thread_pool_get_num_unused_threads".} -proc g_thread_pool_stop_unused_threads*(){.cdecl, dynlib: gliblib, - importc: "g_thread_pool_stop_unused_threads".} -type - PGTimer* = pointer - -const - G_USEC_PER_SEC* = 1000000 - -proc g_timer_new*(): PGTimer{.cdecl, dynlib: gliblib, importc: "g_timer_new".} -proc destroy*(timer: PGTimer){.cdecl, dynlib: gliblib, - importc: "g_timer_destroy".} -proc start*(timer: PGTimer){.cdecl, dynlib: gliblib, - importc: "g_timer_start".} -proc stop*(timer: PGTimer){.cdecl, dynlib: gliblib, - importc: "g_timer_stop".} -proc reset*(timer: PGTimer){.cdecl, dynlib: gliblib, - importc: "g_timer_reset".} -proc elapsed*(timer: PGTimer, microseconds: Pgulong): gdouble{.cdecl, - dynlib: gliblib, importc: "g_timer_elapsed".} -proc g_usleep*(microseconds: gulong){.cdecl, dynlib: gliblib, - importc: "g_usleep".} -proc val_add*(time: PGTimeVal, microseconds: glong){.cdecl, - dynlib: gliblib, importc: "g_time_val_add".} -type - Pgunichar* = ptr gunichar - gunichar* = guint32 - Pgunichar2* = ptr gunichar2 - gunichar2* = guint16 - PGUnicodeType* = ptr TGUnicodeType - TGUnicodeType* = enum - G_UNICODE_CONTROL, G_UNICODE_FORMAT, G_UNICODE_UNASSIGNED, - G_UNICODE_PRIVATE_USE, G_UNICODE_SURROGATE, G_UNICODE_LOWERCASE_LETTER, - G_UNICODE_MODIFIER_LETTER, G_UNICODE_OTHER_LETTER, - G_UNICODE_TITLECASE_LETTER, G_UNICODE_UPPERCASE_LETTER, - G_UNICODE_COMBINING_MARK, G_UNICODE_ENCLOSING_MARK, - G_UNICODE_NON_SPACING_MARK, G_UNICODE_DECIMAL_NUMBER, - G_UNICODE_LETTER_NUMBER, G_UNICODE_OTHER_NUMBER, - G_UNICODE_CONNECT_PUNCTUATION, G_UNICODE_DASH_PUNCTUATION, - G_UNICODE_CLOSE_PUNCTUATION, G_UNICODE_FINAL_PUNCTUATION, - G_UNICODE_INITIAL_PUNCTUATION, G_UNICODE_OTHER_PUNCTUATION, - G_UNICODE_OPEN_PUNCTUATION, G_UNICODE_CURRENCY_SYMBOL, - G_UNICODE_MODIFIER_SYMBOL, G_UNICODE_MATH_SYMBOL, G_UNICODE_OTHER_SYMBOL, - G_UNICODE_LINE_SEPARATOR, G_UNICODE_PARAGRAPH_SEPARATOR, - G_UNICODE_SPACE_SEPARATOR - PGUnicodeBreakType* = ptr TGUnicodeBreakType - TGUnicodeBreakType* = enum - G_UNICODE_BREAK_MANDATORY, G_UNICODE_BREAK_CARRIAGE_RETURN, - G_UNICODE_BREAK_LINE_FEED, G_UNICODE_BREAK_COMBINING_MARK, - G_UNICODE_BREAK_SURROGATE, G_UNICODE_BREAK_ZERO_WIDTH_SPACE, - G_UNICODE_BREAK_INSEPARABLE, G_UNICODE_BREAK_NON_BREAKING_GLUE, - G_UNICODE_BREAK_CONTINGENT, G_UNICODE_BREAK_SPACE, G_UNICODE_BREAK_AFTER, - G_UNICODE_BREAK_BEFORE, G_UNICODE_BREAK_BEFORE_AND_AFTER, - G_UNICODE_BREAK_HYPHEN, G_UNICODE_BREAK_NON_STARTER, - G_UNICODE_BREAK_OPEN_PUNCTUATION, G_UNICODE_BREAK_CLOSE_PUNCTUATION, - G_UNICODE_BREAK_QUOTATION, G_UNICODE_BREAK_EXCLAMATION, - G_UNICODE_BREAK_IDEOGRAPHIC, G_UNICODE_BREAK_NUMERIC, - G_UNICODE_BREAK_INFIX_SEPARATOR, G_UNICODE_BREAK_SYMBOL, - G_UNICODE_BREAK_ALPHABETIC, G_UNICODE_BREAK_PREFIX, G_UNICODE_BREAK_POSTFIX, - G_UNICODE_BREAK_COMPLEX_CONTEXT, G_UNICODE_BREAK_AMBIGUOUS, - G_UNICODE_BREAK_UNKNOWN - -proc g_get_charset*(charset: PPchar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_get_charset".} -proc g_unichar_isalnum*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isalnum".} -proc g_unichar_isalpha*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isalpha".} -proc g_unichar_iscntrl*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_iscntrl".} -proc g_unichar_isdigit*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isdigit".} -proc g_unichar_isgraph*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isgraph".} -proc g_unichar_islower*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_islower".} -proc g_unichar_isprint*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isprint".} -proc g_unichar_ispunct*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_ispunct".} -proc g_unichar_isspace*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isspace".} -proc g_unichar_isupper*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isupper".} -proc g_unichar_isxdigit*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isxdigit".} -proc g_unichar_istitle*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_istitle".} -proc g_unichar_isdefined*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_isdefined".} -proc g_unichar_iswide*(c: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_iswide".} -proc g_unichar_toupper*(c: gunichar): gunichar{.cdecl, dynlib: gliblib, - importc: "g_unichar_toupper".} -proc g_unichar_tolower*(c: gunichar): gunichar{.cdecl, dynlib: gliblib, - importc: "g_unichar_tolower".} -proc g_unichar_totitle*(c: gunichar): gunichar{.cdecl, dynlib: gliblib, - importc: "g_unichar_totitle".} -proc g_unichar_digit_value*(c: gunichar): gint{.cdecl, dynlib: gliblib, - importc: "g_unichar_digit_value".} -proc g_unichar_xdigit_value*(c: gunichar): gint{.cdecl, dynlib: gliblib, - importc: "g_unichar_xdigit_value".} -proc g_unichar_type*(c: gunichar): TGUnicodeType{.cdecl, dynlib: gliblib, - importc: "g_unichar_type".} -proc g_unichar_break_type*(c: gunichar): TGUnicodeBreakType{.cdecl, - dynlib: gliblib, importc: "g_unichar_break_type".} -proc unicode_canonical_ordering*(str: Pgunichar, len: gsize){.cdecl, - dynlib: gliblib, importc: "g_unicode_canonical_ordering".} -proc g_unicode_canonical_decomposition*(ch: gunichar, result_len: Pgsize): Pgunichar{. - cdecl, dynlib: gliblib, importc: "g_unicode_canonical_decomposition".} -proc utf8_next_char*(p: pguchar): pguchar -proc g_utf8_get_char*(p: cstring): gunichar{.cdecl, dynlib: gliblib, - importc: "g_utf8_get_char".} -proc g_utf8_get_char_validated*(p: cstring, max_len: gssize): gunichar{.cdecl, - dynlib: gliblib, importc: "g_utf8_get_char_validated".} -proc g_utf8_offset_to_pointer*(str: cstring, offset: glong): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_offset_to_pointer".} -proc g_utf8_pointer_to_offset*(str: cstring, pos: cstring): glong{.cdecl, - dynlib: gliblib, importc: "g_utf8_pointer_to_offset".} -proc g_utf8_prev_char*(p: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_utf8_prev_char".} -proc g_utf8_find_next_char*(p: cstring, `end`: cstring): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_find_next_char".} -proc g_utf8_find_prev_char*(str: cstring, p: cstring): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_find_prev_char".} -proc g_utf8_strlen*(p: cstring, max: gssize): glong{.cdecl, dynlib: gliblib, - importc: "g_utf8_strlen".} -proc g_utf8_strncpy*(dest: cstring, src: cstring, n: gsize): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_strncpy".} -proc g_utf8_strchr*(p: cstring, len: gssize, c: gunichar): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_strchr".} -proc g_utf8_strrchr*(p: cstring, len: gssize, c: gunichar): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_strrchr".} -proc g_utf8_to_utf16*(str: cstring, len: glong, items_read: Pglong, - items_written: Pglong, error: pointer): Pgunichar2{.cdecl, - dynlib: gliblib, importc: "g_utf8_to_utf16".} -proc g_utf8_to_ucs4*(str: cstring, len: glong, items_read: Pglong, - items_written: Pglong, error: pointer): Pgunichar{.cdecl, - dynlib: gliblib, importc: "g_utf8_to_ucs4".} -proc g_utf8_to_ucs4_fast*(str: cstring, len: glong, items_written: Pglong): Pgunichar{. - cdecl, dynlib: gliblib, importc: "g_utf8_to_ucs4_fast".} -proc utf16_to_ucs4*(str: Pgunichar2, len: glong, items_read: Pglong, - items_written: Pglong, error: pointer): Pgunichar{.cdecl, - dynlib: gliblib, importc: "g_utf16_to_ucs4".} -proc utf16_to_utf8*(str: Pgunichar2, len: glong, items_read: Pglong, - items_written: Pglong, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf16_to_utf8".} -proc ucs4_to_utf16*(str: Pgunichar, len: glong, items_read: Pglong, - items_written: Pglong, error: pointer): Pgunichar2{.cdecl, - dynlib: gliblib, importc: "g_ucs4_to_utf16".} -proc ucs4_to_utf8*(str: Pgunichar, len: glong, items_read: Pglong, - items_written: Pglong, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_ucs4_to_utf8".} -proc g_unichar_to_utf8*(c: gunichar, outbuf: cstring): gint{.cdecl, - dynlib: gliblib, importc: "g_unichar_to_utf8".} -proc g_utf8_validate*(str: cstring, max_len: gssize, `end`: PPgchar): gboolean{. - cdecl, dynlib: gliblib, importc: "g_utf8_validate".} -proc g_unichar_validate*(ch: gunichar): gboolean{.cdecl, dynlib: gliblib, - importc: "g_unichar_validate".} -proc g_utf8_strup*(str: cstring, len: gssize): cstring{.cdecl, dynlib: gliblib, - importc: "g_utf8_strup".} -proc g_utf8_strdown*(str: cstring, len: gssize): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_strdown".} -proc g_utf8_casefold*(str: cstring, len: gssize): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_casefold".} -type - PGNormalizeMode* = ptr TGNormalizeMode - TGNormalizeMode* = gint - -const - G_NORMALIZE_DEFAULT* = 0 - G_NORMALIZE_NFD* = G_NORMALIZE_DEFAULT - G_NORMALIZE_DEFAULT_COMPOSE* = 1 - G_NORMALIZE_NFC* = G_NORMALIZE_DEFAULT_COMPOSE - G_NORMALIZE_ALL* = 2 - G_NORMALIZE_NFKD* = G_NORMALIZE_ALL - G_NORMALIZE_ALL_COMPOSE* = 3 - G_NORMALIZE_NFKC* = G_NORMALIZE_ALL_COMPOSE - -proc g_utf8_normalize*(str: cstring, len: gssize, mode: TGNormalizeMode): cstring{. - cdecl, dynlib: gliblib, importc: "g_utf8_normalize".} -proc g_utf8_collate*(str1: cstring, str2: cstring): gint{.cdecl, - dynlib: gliblib, importc: "g_utf8_collate".} -proc g_utf8_collate_key*(str: cstring, len: gssize): cstring{.cdecl, - dynlib: gliblib, importc: "g_utf8_collate_key".} -type - PGString* = ptr TGString - TGString*{.final.} = object - str*: cstring - len*: gsize - allocated_len*: gsize - - PGStringChunk* = pointer - -proc g_string_chunk_new*(size: gsize): PGStringChunk{.cdecl, dynlib: gliblib, - importc: "g_string_chunk_new".} -proc chunk_free*(chunk: PGStringChunk){.cdecl, dynlib: gliblib, - importc: "g_string_chunk_free".} -proc chunk_insert*(chunk: PGStringChunk, str: cstring): cstring{.cdecl, - dynlib: gliblib, importc: "g_string_chunk_insert".} -proc chunk_insert_const*(chunk: PGStringChunk, str: cstring): cstring{. - cdecl, dynlib: gliblib, importc: "g_string_chunk_insert_const".} -proc g_string_new*(init: cstring): PGString{.cdecl, dynlib: gliblib, - importc: "g_string_new".} -proc g_string_new_len*(init: cstring, len: gssize): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_new_len".} -proc g_string_sized_new*(dfl_size: gsize): PGString{.cdecl, dynlib: gliblib, - importc: "g_string_sized_new".} -proc free*(str: PGString, free_segment: gboolean): cstring{.cdecl, - dynlib: gliblib, importc: "g_string_free".} -proc equal*(v: PGString, v2: PGString): gboolean{.cdecl, - dynlib: gliblib, importc: "g_string_equal".} -proc hash*(str: PGString): guint{.cdecl, dynlib: gliblib, - importc: "g_string_hash".} -proc assign*(str: PGString, rval: cstring): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_assign".} -proc truncate*(str: PGString, len: gsize): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_truncate".} -proc set_size*(str: PGString, len: gsize): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_set_size".} -proc insert_len*(str: PGString, pos: gssize, val: cstring, len: gssize): PGString{. - cdecl, dynlib: gliblib, importc: "g_string_insert_len".} -proc append*(str: PGString, val: cstring): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_append".} -proc append_len*(str: PGString, val: cstring, len: gssize): PGString{. - cdecl, dynlib: gliblib, importc: "g_string_append_len".} -proc append_c*(str: PGString, c: gchar): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_append_c".} -proc append_unichar*(str: PGString, wc: gunichar): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_append_unichar".} -proc prepend*(str: PGString, val: cstring): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_prepend".} -proc prepend_c*(str: PGString, c: gchar): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_prepend_c".} -proc prepend_unichar*(str: PGString, wc: gunichar): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_prepend_unichar".} -proc prepend_len*(str: PGString, val: cstring, len: gssize): PGString{. - cdecl, dynlib: gliblib, importc: "g_string_prepend_len".} -proc insert*(str: PGString, pos: gssize, val: cstring): PGString{. - cdecl, dynlib: gliblib, importc: "g_string_insert".} -proc insert_c*(str: PGString, pos: gssize, c: gchar): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_insert_c".} -proc insert_unichar*(str: PGString, pos: gssize, wc: gunichar): PGString{. - cdecl, dynlib: gliblib, importc: "g_string_insert_unichar".} -proc erase*(str: PGString, pos: gssize, len: gssize): PGString{.cdecl, - dynlib: gliblib, importc: "g_string_erase".} -proc ascii_down*(str: PGString): PGString{.cdecl, dynlib: gliblib, - importc: "g_string_ascii_down".} -proc ascii_up*(str: PGString): PGString{.cdecl, dynlib: gliblib, - importc: "g_string_ascii_up".} -proc down*(str: PGString): PGString{.cdecl, dynlib: gliblib, - importc: "g_string_down".} -proc up*(str: PGString): PGString{.cdecl, dynlib: gliblib, - importc: "g_string_up".} -type - PGIOError* = ptr TGIOError - TGIOError* = enum - G_IO_ERROR_NONE, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_UNKNOWN - -proc G_IO_CHANNEL_ERROR*(): TGQuark -type - PGIOChannelError* = ptr TGIOChannelError - TGIOChannelError* = enum - G_IO_CHANNEL_ERROR_FBIG, G_IO_CHANNEL_ERROR_INVAL, G_IO_CHANNEL_ERROR_IO, - G_IO_CHANNEL_ERROR_ISDIR, G_IO_CHANNEL_ERROR_NOSPC, G_IO_CHANNEL_ERROR_NXIO, - G_IO_CHANNEL_ERROR_OVERFLOW, G_IO_CHANNEL_ERROR_PIPE, - G_IO_CHANNEL_ERROR_FAILED - PGIOStatus* = ptr TGIOStatus - TGIOStatus* = enum - G_IO_STATUS_ERROR, G_IO_STATUS_NORMAL, G_IO_STATUS_EOF, G_IO_STATUS_AGAIN - PGSeekType* = ptr TGSeekType - TGSeekType* = enum - G_SEEK_CUR, G_SEEK_SET, G_SEEK_END - PGIOCondition* = ptr TGIOCondition - TGIOCondition* = gint - -const - G_IO_IN* = GLIB_SYSDEF_POLLIN - G_IO_OUT* = GLIB_SYSDEF_POLLOUT - G_IO_PRI* = GLIB_SYSDEF_POLLPRI - G_IO_ERR* = GLIB_SYSDEF_POLLERR - G_IO_HUP* = GLIB_SYSDEF_POLLHUP - G_IO_NVAL* = GLIB_SYSDEF_POLLNVAL - -type - PGIOFlags* = ptr TGIOFlags - TGIOFlags* = gint - -const - G_IO_FLAG_APPEND* = 1 shl 0 - G_IO_FLAG_NONBLOCK* = 1 shl 1 - G_IO_FLAG_IS_READABLE* = 1 shl 2 - G_IO_FLAG_IS_WRITEABLE* = 1 shl 3 - G_IO_FLAG_IS_SEEKABLE* = 1 shl 4 - G_IO_FLAG_MASK* = (1 shl 5) - 1 - G_IO_FLAG_GET_MASK* = G_IO_FLAG_MASK - G_IO_FLAG_SET_MASK* = G_IO_FLAG_APPEND or G_IO_FLAG_NONBLOCK - -type - PGIOChannel* = ptr TGIOChannel - TGIOFunc* = proc (source: PGIOChannel, condition: TGIOCondition, - data: gpointer): gboolean{.cdecl.} - PGIOFuncs* = ptr TGIOFuncs - TGIOFuncs*{.final.} = object - io_read*: proc (channel: PGIOChannel, buf: cstring, count: gsize, - bytes_read: Pgsize, err: pointer): TGIOStatus{.cdecl.} - io_write*: proc (channel: PGIOChannel, buf: cstring, count: gsize, - bytes_written: Pgsize, err: pointer): TGIOStatus{.cdecl.} - io_seek*: proc (channel: PGIOChannel, offset: gint64, theType: TGSeekType, - err: pointer): TGIOStatus{.cdecl.} - io_close*: proc (channel: PGIOChannel, err: pointer): TGIOStatus{.cdecl.} - io_create_watch*: proc (channel: PGIOChannel, condition: TGIOCondition): PGSource{. - cdecl.} - io_free*: proc (channel: PGIOChannel){.cdecl.} - io_set_flags*: proc (channel: PGIOChannel, flags: TGIOFlags, err: pointer): TGIOStatus{. - cdecl.} - io_get_flags*: proc (channel: PGIOChannel): TGIOFlags{.cdecl.} - - TGIOChannel*{.final.} = object - ref_count*: guint - funcs*: PGIOFuncs - encoding*: cstring - read_cd*: TGIConv - write_cd*: TGIConv - line_term*: cstring - line_term_len*: guint - buf_size*: gsize - read_buf*: PGString - encoded_read_buf*: PGString - write_buf*: PGString - partial_write_buf*: array[0..5, gchar] - flag0*: guint16 - reserved1*: gpointer - reserved2*: gpointer - - -const - bm_TGIOChannel_use_buffer* = 0x0001'i16 - bp_TGIOChannel_use_buffer* = 0'i16 - bm_TGIOChannel_do_encode* = 0x0002'i16 - bp_TGIOChannel_do_encode* = 1'i16 - bm_TGIOChannel_close_on_unref* = 0x0004'i16 - bp_TGIOChannel_close_on_unref* = 2'i16 - bm_TGIOChannel_is_readable* = 0x0008'i16 - bp_TGIOChannel_is_readable* = 3'i16 - bm_TGIOChannel_is_writeable* = 0x0010'i16 - bp_TGIOChannel_is_writeable* = 4'i16 - bm_TGIOChannel_is_seekable* = 0x0020'i16 - bp_TGIOChannel_is_seekable* = 5'i16 - -proc TGIOChannel_use_buffer*(a: PGIOChannel): guint -proc TGIOChannel_set_use_buffer*(a: PGIOChannel, `use_buffer`: guint) -proc TGIOChannel_do_encode*(a: PGIOChannel): guint -proc TGIOChannel_set_do_encode*(a: PGIOChannel, `do_encode`: guint) -proc TGIOChannel_close_on_unref*(a: PGIOChannel): guint -proc TGIOChannel_set_close_on_unref*(a: PGIOChannel, `close_on_unref`: guint) -proc TGIOChannel_is_readable*(a: PGIOChannel): guint -proc TGIOChannel_set_is_readable*(a: PGIOChannel, `is_readable`: guint) -proc TGIOChannel_is_writeable*(a: PGIOChannel): guint -proc TGIOChannel_set_is_writeable*(a: PGIOChannel, `is_writeable`: guint) -proc TGIOChannel_is_seekable*(a: PGIOChannel): guint -proc TGIOChannel_set_is_seekable*(a: PGIOChannel, `is_seekable`: guint) -proc channel_init*(channel: PGIOChannel){.cdecl, dynlib: gliblib, - importc: "g_io_channel_init".} -proc channel_ref*(channel: PGIOChannel){.cdecl, dynlib: gliblib, - importc: "g_io_channel_ref".} -proc channel_unref*(channel: PGIOChannel){.cdecl, dynlib: gliblib, - importc: "g_io_channel_unref".} -proc channel_read*(channel: PGIOChannel, buf: cstring, count: gsize, - bytes_read: Pgsize): TGIOError{.cdecl, dynlib: gliblib, - importc: "g_io_channel_read".} -proc channel_write*(channel: PGIOChannel, buf: cstring, count: gsize, - bytes_written: Pgsize): TGIOError{.cdecl, - dynlib: gliblib, importc: "g_io_channel_write".} -proc channel_seek*(channel: PGIOChannel, offset: gint64, - theType: TGSeekType): TGIOError{.cdecl, dynlib: gliblib, - importc: "g_io_channel_seek".} -proc channel_close*(channel: PGIOChannel){.cdecl, dynlib: gliblib, - importc: "g_io_channel_close".} -proc channel_shutdown*(channel: PGIOChannel, flush: gboolean, err: pointer): TGIOStatus{. - cdecl, dynlib: gliblib, importc: "g_io_channel_shutdown".} -proc add_watch_full*(channel: PGIOChannel, priority: gint, - condition: TGIOCondition, func: TGIOFunc, - user_data: gpointer, notify: TGDestroyNotify): guint{. - cdecl, dynlib: gliblib, importc: "g_io_add_watch_full".} -proc create_watch*(channel: PGIOChannel, condition: TGIOCondition): PGSource{. - cdecl, dynlib: gliblib, importc: "g_io_create_watch".} -proc add_watch*(channel: PGIOChannel, condition: TGIOCondition, - func: TGIOFunc, user_data: gpointer): guint{.cdecl, - dynlib: gliblib, importc: "g_io_add_watch".} -proc channel_set_buffer_size*(channel: PGIOChannel, size: gsize){.cdecl, - dynlib: gliblib, importc: "g_io_channel_set_buffer_size".} -proc channel_get_buffer_size*(channel: PGIOChannel): gsize{.cdecl, - dynlib: gliblib, importc: "g_io_channel_get_buffer_size".} -proc channel_get_buffer_condition*(channel: PGIOChannel): TGIOCondition{. - cdecl, dynlib: gliblib, importc: "g_io_channel_get_buffer_condition".} -proc channel_set_flags*(channel: PGIOChannel, flags: TGIOFlags, - error: pointer): TGIOStatus{.cdecl, - dynlib: gliblib, importc: "g_io_channel_set_flags".} -proc channel_get_flags*(channel: PGIOChannel): TGIOFlags{.cdecl, - dynlib: gliblib, importc: "g_io_channel_get_flags".} -proc channel_set_line_term*(channel: PGIOChannel, line_term: cstring, - length: gint){.cdecl, dynlib: gliblib, - importc: "g_io_channel_set_line_term".} -proc channel_get_line_term*(channel: PGIOChannel, length: Pgint): cstring{. - cdecl, dynlib: gliblib, importc: "g_io_channel_get_line_term".} -proc channel_set_buffered*(channel: PGIOChannel, buffered: gboolean){. - cdecl, dynlib: gliblib, importc: "g_io_channel_set_buffered".} -proc channel_get_buffered*(channel: PGIOChannel): gboolean{.cdecl, - dynlib: gliblib, importc: "g_io_channel_get_buffered".} -proc channel_set_encoding*(channel: PGIOChannel, encoding: cstring, - error: pointer): TGIOStatus{.cdecl, - dynlib: gliblib, importc: "g_io_channel_set_encoding".} -proc channel_get_encoding*(channel: PGIOChannel): cstring{.cdecl, - dynlib: gliblib, importc: "g_io_channel_get_encoding".} -proc channel_set_close_on_unref*(channel: PGIOChannel, do_close: gboolean){. - cdecl, dynlib: gliblib, importc: "g_io_channel_set_close_on_unref".} -proc channel_get_close_on_unref*(channel: PGIOChannel): gboolean{.cdecl, - dynlib: gliblib, importc: "g_io_channel_get_close_on_unref".} -proc channel_flush*(channel: PGIOChannel, error: pointer): TGIOStatus{. - cdecl, dynlib: gliblib, importc: "g_io_channel_flush".} -proc channel_read_line*(channel: PGIOChannel, str_return: PPgchar, - length: Pgsize, terminator_pos: Pgsize, - error: pointer): TGIOStatus{.cdecl, - dynlib: gliblib, importc: "g_io_channel_read_line".} -proc channel_read_line_string*(channel: PGIOChannel, buffer: PGString, - terminator_pos: Pgsize, error: pointer): TGIOStatus{. - cdecl, dynlib: gliblib, importc: "g_io_channel_read_line_string".} -proc channel_read_to_end*(channel: PGIOChannel, str_return: PPgchar, - length: Pgsize, error: pointer): TGIOStatus{. - cdecl, dynlib: gliblib, importc: "g_io_channel_read_to_end".} -proc channel_read_chars*(channel: PGIOChannel, buf: cstring, count: gsize, - bytes_read: Pgsize, error: pointer): TGIOStatus{. - cdecl, dynlib: gliblib, importc: "g_io_channel_read_chars".} -proc channel_read_unichar*(channel: PGIOChannel, thechar: Pgunichar, - error: pointer): TGIOStatus{.cdecl, - dynlib: gliblib, importc: "g_io_channel_read_unichar".} -proc channel_write_chars*(channel: PGIOChannel, buf: cstring, - count: gssize, bytes_written: Pgsize, - error: pointer): TGIOStatus{.cdecl, - dynlib: gliblib, importc: "g_io_channel_write_chars".} -proc channel_write_unichar*(channel: PGIOChannel, thechar: gunichar, - error: pointer): TGIOStatus{.cdecl, - dynlib: gliblib, importc: "g_io_channel_write_unichar".} -proc channel_seek_position*(channel: PGIOChannel, offset: gint64, - theType: TGSeekType, error: pointer): TGIOStatus{. - cdecl, dynlib: gliblib, importc: "g_io_channel_seek_position".} -proc g_io_channel_new_file*(filename: cstring, mode: cstring, error: pointer): PGIOChannel{. - cdecl, dynlib: gliblib, importc: "g_io_channel_new_file".} -proc g_io_channel_error_quark*(): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_io_channel_error_quark".} -proc g_io_channel_error_from_errno*(en: gint): TGIOChannelError{.cdecl, - dynlib: gliblib, importc: "g_io_channel_error_from_errno".} -proc g_io_channel_unix_new*(fd: int32): PGIOChannel{.cdecl, dynlib: gliblib, - importc: "g_io_channel_unix_new".} -proc channel_unix_get_fd*(channel: PGIOChannel): gint{.cdecl, - dynlib: gliblib, importc: "g_io_channel_unix_get_fd".} -const - G_LOG_LEVEL_USER_SHIFT* = 8 - -type - PGLogLevelFlags* = ptr TGLogLevelFlags - TGLogLevelFlags* = int32 - -const - G_LOG_FLAG_RECURSION* = 1 shl 0 - G_LOG_FLAG_FATAL* = 1 shl 1 - G_LOG_LEVEL_ERROR* = 1 shl 2 - G_LOG_LEVEL_CRITICAL* = 1 shl 3 - G_LOG_LEVEL_WARNING* = 1 shl 4 - G_LOG_LEVEL_MESSAGE* = 1 shl 5 - G_LOG_LEVEL_INFO* = 1 shl 6 - G_LOG_LEVEL_DEBUG* = 1 shl 7 - G_LOG_LEVEL_MASK* = not 3 - -const - G_LOG_FATAL_MASK* = 5 - -type - TGLogFunc* = proc (log_domain: cstring, log_level: TGLogLevelFlags, - TheMessage: cstring, user_data: gpointer){.cdecl.} - -proc g_log_set_handler*(log_domain: cstring, log_levels: TGLogLevelFlags, - log_func: TGLogFunc, user_data: gpointer): guint{.cdecl, - dynlib: gliblib, importc: "g_log_set_handler".} -proc g_log_remove_handler*(log_domain: cstring, handler_id: guint){.cdecl, - dynlib: gliblib, importc: "g_log_remove_handler".} -proc g_log_default_handler*(log_domain: cstring, log_level: TGLogLevelFlags, - TheMessage: cstring, unused_data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_log_default_handler".} -proc g_log_set_fatal_mask*(log_domain: cstring, fatal_mask: TGLogLevelFlags): TGLogLevelFlags{. - cdecl, dynlib: gliblib, importc: "g_log_set_fatal_mask".} -proc g_log_set_always_fatal*(fatal_mask: TGLogLevelFlags): TGLogLevelFlags{. - cdecl, dynlib: gliblib, importc: "g_log_set_always_fatal".} -proc `g_log_fallback_handler`*(log_domain: cstring, log_level: TGLogLevelFlags, - message: cstring, unused_data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_log_fallback_handler".} -const - G_LOG_DOMAIN* = nil - -when false: - proc g_error*(format: cstring){.varargs.} - proc g_message*(format: cstring){.varargs.} - proc g_critical*(format: cstring){.varargs.} - proc g_warning*(format: cstring){.varargs.} -type - TGPrintFunc* = proc (str: cstring){.cdecl, varargs.} - -proc g_set_print_handler*(func: TGPrintFunc): TGPrintFunc{.cdecl, - dynlib: gliblib, importc: "g_set_print_handler".} -proc g_set_printerr_handler*(func: TGPrintFunc): TGPrintFunc{.cdecl, - dynlib: gliblib, importc: "g_set_printerr_handler".} -type - PGMarkupError* = ptr TGMarkupError - TGMarkupError* = enum - G_MARKUP_ERROR_BAD_UTF8, G_MARKUP_ERROR_EMPTY, G_MARKUP_ERROR_PARSE, - G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, - G_MARKUP_ERROR_INVALID_CONTENT - -proc G_MARKUP_ERROR*(): TGQuark -proc g_markup_error_quark*(): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_markup_error_quark".} -type - PGMarkupParseFlags* = ptr TGMarkupParseFlags - TGMarkupParseFlags* = int - -const - G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG* = 1 shl 0 - -type - PGMarkupParseContext* = ptr TGMarkupParseContext - TGMarkupParseContext* = pointer - PGMarkupParser* = ptr TGMarkupParser - TGMarkupParser*{.final.} = object - start_element*: proc (context: PGMarkupParseContext, element_name: cstring, - attribute_names: PPgchar, attribute_values: PPgchar, - user_data: gpointer, error: pointer){.cdecl.} - end_element*: proc (context: PGMarkupParseContext, element_name: cstring, - user_data: gpointer, error: pointer){.cdecl.} - text*: proc (context: PGMarkupParseContext, text: cstring, text_len: gsize, - user_data: gpointer, error: pointer){.cdecl.} - passthrough*: proc (context: PGMarkupParseContext, - passthrough_text: cstring, text_len: gsize, - user_data: gpointer, error: pointer){.cdecl.} - error*: proc (context: PGMarkupParseContext, error: pointer, - user_data: gpointer){.cdecl.} - - -proc parse_context_new*(parser: PGMarkupParser, - flags: TGMarkupParseFlags, user_data: gpointer, - user_data_dnotify: TGDestroyNotify): PGMarkupParseContext{. - cdecl, dynlib: gliblib, importc: "g_markup_parse_context_new".} -proc parse_context_free*(context: PGMarkupParseContext){.cdecl, - dynlib: gliblib, importc: "g_markup_parse_context_free".} -proc parse_context_parse*(context: PGMarkupParseContext, text: cstring, - text_len: gssize, error: pointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_markup_parse_context_parse".} -proc parse_context_end_parse*(context: PGMarkupParseContext, - error: pointer): gboolean{.cdecl, - dynlib: gliblib, importc: "g_markup_parse_context_end_parse".} -proc parse_context_get_position*(context: PGMarkupParseContext, - line_number: Pgint, char_number: Pgint){.cdecl, dynlib: gliblib, - importc: "g_markup_parse_context_get_position".} -proc g_markup_escape_text*(text: cstring, length: gssize): cstring{.cdecl, - dynlib: gliblib, importc: "g_markup_escape_text".} -type - PGNode* = ptr TGNode - TGNode*{.final.} = object - data*: gpointer - next*: PGNode - prev*: PGNode - parent*: PGNode - children*: PGNode - - PGTraverseFlags* = ptr TGTraverseFlags - TGTraverseFlags* = gint - -const - G_TRAVERSE_LEAFS* = 1 shl 0 - G_TRAVERSE_NON_LEAFS* = 1 shl 1 - G_TRAVERSE_ALL* = G_TRAVERSE_LEAFS or G_TRAVERSE_NON_LEAFS - G_TRAVERSE_MASK* = 0x00000003 - -type - PGTraverseType* = ptr TGTraverseType - TGTraverseType* = enum - G_IN_ORDER, G_PRE_ORDER, G_POST_ORDER, G_LEVEL_ORDER - TGNodeTraverseFunc* = proc (node: PGNode, data: gpointer): gboolean{.cdecl.} - TGNodeForeachFunc* = proc (node: PGNode, data: gpointer){.cdecl.} - -proc IS_ROOT*(node: PGNode): bool -proc IS_LEAF*(node: PGNode): bool -proc node_push_allocator*(allocator: PGAllocator){.cdecl, dynlib: gliblib, - importc: "g_node_push_allocator".} -proc g_node_pop_allocator*(){.cdecl, dynlib: gliblib, - importc: "g_node_pop_allocator".} -proc g_node_new*(data: gpointer): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_new".} -proc destroy*(root: PGNode){.cdecl, dynlib: gliblib, - importc: "g_node_destroy".} -proc unlink*(node: PGNode){.cdecl, dynlib: gliblib, - importc: "g_node_unlink".} -proc copy*(node: PGNode): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_copy".} -proc insert*(parent: PGNode, position: gint, node: PGNode): PGNode{. - cdecl, dynlib: gliblib, importc: "g_node_insert".} -proc insert_before*(parent: PGNode, sibling: PGNode, node: PGNode): PGNode{. - cdecl, dynlib: gliblib, importc: "g_node_insert_before".} -proc insert_after*(parent: PGNode, sibling: PGNode, node: PGNode): PGNode{. - cdecl, dynlib: gliblib, importc: "g_node_insert_after".} -proc prepend*(parent: PGNode, node: PGNode): PGNode{.cdecl, - dynlib: gliblib, importc: "g_node_prepend".} -proc n_nodes*(root: PGNode, flags: TGTraverseFlags): guint{.cdecl, - dynlib: gliblib, importc: "g_node_n_nodes".} -proc get_root*(node: PGNode): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_get_root".} -proc is_ancestor*(node: PGNode, descendant: PGNode): gboolean{.cdecl, - dynlib: gliblib, importc: "g_node_is_ancestor".} -proc depth*(node: PGNode): guint{.cdecl, dynlib: gliblib, - importc: "g_node_depth".} -proc find*(root: PGNode, order: TGTraverseType, flags: TGTraverseFlags, - data: gpointer): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_find".} -proc append*(parent: PGNode, node: PGNode): PGNode -proc insert_data*(parent: PGNode, position: gint, data: gpointer): PGNode -proc insert_data_before*(parent: PGNode, sibling: PGNode, data: gpointer): PGNode -proc prepend_data*(parent: PGNode, data: gpointer): PGNode -proc append_data*(parent: PGNode, data: gpointer): PGNode -proc traverse*(root: PGNode, order: TGTraverseType, - flags: TGTraverseFlags, max_depth: gint, - func: TGNodeTraverseFunc, data: gpointer): guint{.cdecl, - dynlib: gliblib, importc: "g_node_traverse".} -proc max_height*(root: PGNode): guint{.cdecl, dynlib: gliblib, - importc: "g_node_max_height".} -proc children_foreach*(node: PGNode, flags: TGTraverseFlags, - func: TGNodeForeachFunc, data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_node_children_foreach".} -proc reverse_children*(node: PGNode){.cdecl, dynlib: gliblib, - importc: "g_node_reverse_children".} -proc n_children*(node: PGNode): guint{.cdecl, dynlib: gliblib, - importc: "g_node_n_children".} -proc nth_child*(node: PGNode, n: guint): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_nth_child".} -proc last_child*(node: PGNode): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_last_child".} -proc find_child*(node: PGNode, flags: TGTraverseFlags, data: gpointer): PGNode{. - cdecl, dynlib: gliblib, importc: "g_node_find_child".} -proc child_position*(node: PGNode, child: PGNode): gint{.cdecl, - dynlib: gliblib, importc: "g_node_child_position".} -proc child_index*(node: PGNode, data: gpointer): gint{.cdecl, - dynlib: gliblib, importc: "g_node_child_index".} -proc first_sibling*(node: PGNode): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_first_sibling".} -proc last_sibling*(node: PGNode): PGNode{.cdecl, dynlib: gliblib, - importc: "g_node_last_sibling".} -proc prev_sibling*(node: PGNode): PGNode -proc next_sibling*(node: PGNode): PGNode -proc first_child*(node: PGNode): PGNode -type - PGTree* = pointer - TGTraverseFunc* = proc (key: gpointer, value: gpointer, data: gpointer): gboolean{. - cdecl.} - -proc g_tree_new*(key_compare_func: TGCompareFunc): PGTree{.cdecl, - dynlib: gliblib, importc: "g_tree_new".} -proc g_tree_new*(key_compare_func: TGCompareDataFunc, - key_compare_data: gpointer): PGTree{.cdecl, - dynlib: gliblib, importc: "g_tree_new_with_data".} -proc g_tree_new_full*(key_compare_func: TGCompareDataFunc, - key_compare_data: gpointer, - key_destroy_func: TGDestroyNotify, - value_destroy_func: TGDestroyNotify): PGTree{.cdecl, - dynlib: gliblib, importc: "g_tree_new_full".} -proc destroy*(tree: PGTree){.cdecl, dynlib: gliblib, - importc: "g_tree_destroy".} -proc insert*(tree: PGTree, key: gpointer, value: gpointer){.cdecl, - dynlib: gliblib, importc: "g_tree_insert".} -proc replace*(tree: PGTree, key: gpointer, value: gpointer){.cdecl, - dynlib: gliblib, importc: "g_tree_replace".} -proc remove*(tree: PGTree, key: gconstpointer){.cdecl, dynlib: gliblib, - importc: "g_tree_remove".} -proc steal*(tree: PGTree, key: gconstpointer){.cdecl, dynlib: gliblib, - importc: "g_tree_steal".} -proc lookup*(tree: PGTree, key: gconstpointer): gpointer{.cdecl, - dynlib: gliblib, importc: "g_tree_lookup".} -proc lookup_extended*(tree: PGTree, lookup_key: gconstpointer, - orig_key: Pgpointer, value: Pgpointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_tree_lookup_extended".} -proc foreach*(tree: PGTree, func: TGTraverseFunc, user_data: gpointer){. - cdecl, dynlib: gliblib, importc: "g_tree_foreach".} -proc search*(tree: PGTree, search_func: TGCompareFunc, - user_data: gconstpointer): gpointer{.cdecl, dynlib: gliblib, - importc: "g_tree_search".} -proc height*(tree: PGTree): gint{.cdecl, dynlib: gliblib, - importc: "g_tree_height".} -proc nnodes*(tree: PGTree): gint{.cdecl, dynlib: gliblib, - importc: "g_tree_nnodes".} -type - PGPatternSpec* = pointer - -proc g_pattern_spec_new*(pattern: cstring): PGPatternSpec{.cdecl, - dynlib: gliblib, importc: "g_pattern_spec_new".} -proc spec_free*(pspec: PGPatternSpec){.cdecl, dynlib: gliblib, - importc: "g_pattern_spec_free".} -proc spec_equal*(pspec1: PGPatternSpec, pspec2: PGPatternSpec): gboolean{. - cdecl, dynlib: gliblib, importc: "g_pattern_spec_equal".} -proc match*(pspec: PGPatternSpec, string_length: guint, str: cstring, - string_reversed: cstring): gboolean{.cdecl, - dynlib: gliblib, importc: "g_pattern_match".} -proc match_string*(pspec: PGPatternSpec, str: cstring): gboolean{. - cdecl, dynlib: gliblib, importc: "g_pattern_match_string".} -proc g_pattern_match_simple*(pattern: cstring, str: cstring): gboolean{.cdecl, - dynlib: gliblib, importc: "g_pattern_match_simple".} -proc g_spaced_primes_closest*(num: guint): guint{.cdecl, dynlib: gliblib, - importc: "g_spaced_primes_closest".} -proc g_qsort*(pbase: gconstpointer, total_elems: gint, size: gsize, - compare_func: TGCompareDataFunc, user_data: gpointer){. - cdecl, dynlib: gliblib, importc: "g_qsort_with_data".} -type - PGQueue* = ptr TGQueue - TGQueue*{.final.} = object - head*: PGList - tail*: PGList - length*: guint - - -proc g_queue_new*(): PGQueue{.cdecl, dynlib: gliblib, importc: "g_queue_new".} -proc free*(queue: PGQueue){.cdecl, dynlib: gliblib, - importc: "g_queue_free".} -proc push_head*(queue: PGQueue, data: gpointer){.cdecl, dynlib: gliblib, - importc: "g_queue_push_head".} -proc push_tail*(queue: PGQueue, data: gpointer){.cdecl, dynlib: gliblib, - importc: "g_queue_push_tail".} -proc pop_head*(queue: PGQueue): gpointer{.cdecl, dynlib: gliblib, - importc: "g_queue_pop_head".} -proc pop_tail*(queue: PGQueue): gpointer{.cdecl, dynlib: gliblib, - importc: "g_queue_pop_tail".} -proc is_empty*(queue: PGQueue): gboolean{.cdecl, dynlib: gliblib, - importc: "g_queue_is_empty".} -proc peek_head*(queue: PGQueue): gpointer{.cdecl, dynlib: gliblib, - importc: "g_queue_peek_head".} -proc peek_tail*(queue: PGQueue): gpointer{.cdecl, dynlib: gliblib, - importc: "g_queue_peek_tail".} -proc push_head_link*(queue: PGQueue, link: PGList){.cdecl, - dynlib: gliblib, importc: "g_queue_push_head_link".} -proc push_tail_link*(queue: PGQueue, link: PGList){.cdecl, - dynlib: gliblib, importc: "g_queue_push_tail_link".} -proc pop_head_link*(queue: PGQueue): PGList{.cdecl, dynlib: gliblib, - importc: "g_queue_pop_head_link".} -proc pop_tail_link*(queue: PGQueue): PGList{.cdecl, dynlib: gliblib, - importc: "g_queue_pop_tail_link".} -type - PGRand* = pointer - -proc g_rand_new*(seed: guint32): PGRand{.cdecl, dynlib: gliblib, - importc: "g_rand_new_with_seed".} -proc g_rand_new*(): PGRand{.cdecl, dynlib: gliblib, importc: "g_rand_new".} -proc free*(rand: PGRand){.cdecl, dynlib: gliblib, importc: "g_rand_free".} -proc set_seed*(rand: PGRand, seed: guint32){.cdecl, dynlib: gliblib, - importc: "g_rand_set_seed".} -proc boolean*(rand: PGRand): gboolean -proc randint*(rand: PGRand): guint32{.cdecl, dynlib: gliblib, - importc: "g_rand_int".} -proc int_range*(rand: PGRand, `begin`: gint32, `end`: gint32): gint32{. - cdecl, dynlib: gliblib, importc: "g_rand_int_range".} -proc double*(rand: PGRand): gdouble{.cdecl, dynlib: gliblib, - importc: "g_rand_double".} -proc double_range*(rand: PGRand, `begin`: gdouble, `end`: gdouble): gdouble{. - cdecl, dynlib: gliblib, importc: "g_rand_double_range".} -proc g_random_set_seed*(seed: guint32){.cdecl, dynlib: gliblib, - importc: "g_random_set_seed".} -proc g_random_boolean*(): gboolean -proc g_random_int*(): guint32{.cdecl, dynlib: gliblib, importc: "g_random_int".} -proc g_random_int_range*(`begin`: gint32, `end`: gint32): gint32{.cdecl, - dynlib: gliblib, importc: "g_random_int_range".} -proc g_random_double*(): gdouble{.cdecl, dynlib: gliblib, - importc: "g_random_double".} -proc g_random_double_range*(`begin`: gdouble, `end`: gdouble): gdouble{.cdecl, - dynlib: gliblib, importc: "g_random_double_range".} -type - PGTuples* = ptr TGTuples - TGTuples*{.final.} = object - len*: guint - - PGRelation* = pointer - -proc g_relation_new*(fields: gint): PGRelation{.cdecl, dynlib: gliblib, - importc: "g_relation_new".} -proc destroy*(relation: PGRelation){.cdecl, dynlib: gliblib, - importc: "g_relation_destroy".} -proc index*(relation: PGRelation, field: gint, hash_func: TGHashFunc, - key_equal_func: TGEqualFunc){.cdecl, dynlib: gliblib, - importc: "g_relation_index".} -proc delete*(relation: PGRelation, key: gconstpointer, field: gint): gint{. - cdecl, dynlib: gliblib, importc: "g_relation_delete".} -proc select*(relation: PGRelation, key: gconstpointer, field: gint): PGTuples{. - cdecl, dynlib: gliblib, importc: "g_relation_select".} -proc count*(relation: PGRelation, key: gconstpointer, field: gint): gint{. - cdecl, dynlib: gliblib, importc: "g_relation_count".} -proc print*(relation: PGRelation){.cdecl, dynlib: gliblib, - importc: "g_relation_print".} -proc destroy*(tuples: PGTuples){.cdecl, dynlib: gliblib, - importc: "g_tuples_destroy".} -proc index*(tuples: PGTuples, index: gint, field: gint): gpointer{. - cdecl, dynlib: gliblib, importc: "g_tuples_index".} -type - PGTokenType* = ptr TGTokenType - TGTokenType* = gint - -const - G_TOKEN_LEFT_PAREN* = 40 - G_TOKEN_RIGHT_PAREN* = 41 - G_TOKEN_LEFT_CURLY* = 123 - G_TOKEN_RIGHT_CURLY* = 125 - G_TOKEN_LEFT_BRACE* = 91 - G_TOKEN_RIGHT_BRACE* = 93 - G_TOKEN_EQUAL_SIGN* = 61 - G_TOKEN_COMMA* = 44 - G_TOKEN_NONE* = 256 - G_TOKEN_ERROR* = 257 - G_TOKEN_CHAR* = 258 - G_TOKEN_OCTAL* = 260 - G_TOKEN_INT* = 261 - G_TOKEN_HEX* = 262 - G_TOKEN_FLOAT* = 263 - G_TOKEN_STRING* = 264 - G_TOKEN_SYMBOL* = 265 - G_TOKEN_IDENTIFIER* = 266 - G_TOKEN_IDENTIFIER_NULL* = 267 - G_TOKEN_COMMENT_SINGLE* = 268 - G_TOKEN_COMMENT_MULTI* = 269 - G_TOKEN_LAST* = 270 - -type - PGScanner* = ptr TGScanner - PGScannerConfig* = ptr TGScannerConfig - PGTokenValue* = ptr TGTokenValue - TGTokenValue*{.final.} = object - v_float*: gdouble - - TGScannerMsgFunc* = proc (scanner: PGScanner, message: cstring, - error: gboolean){.cdecl.} - TGScanner*{.final.} = object - user_data*: gpointer - max_parse_errors*: guint - parse_errors*: guint - input_name*: cstring - qdata*: PGData - config*: PGScannerConfig - token*: TGTokenType - value*: TGTokenValue - line*: guint - position*: guint - next_token*: TGTokenType - next_value*: TGTokenValue - next_line*: guint - next_position*: guint - symbol_table*: PGHashTable - input_fd*: gint - text*: cstring - text_end*: cstring - buffer*: cstring - scope_id*: guint - msg_handler*: TGScannerMsgFunc - - TGScannerConfig*{.final.} = object - cset_skip_characters*: cstring - cset_identifier_first*: cstring - cset_identifier_nth*: cstring - cpair_comment_single*: cstring - flag0*: int32 - padding_dummy*: guint - - -const - G_CSET_A_2_Z_UCASE* = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - G_CSET_a_2_z_lcase* = "abcdefghijklmnopqrstuvwxyz" - G_CSET_DIGITS* = "0123456789" - -const - bm_TGScannerConfig_case_sensitive* = 0x00000001'i32 - bp_TGScannerConfig_case_sensitive* = 0'i32 - bm_TGScannerConfig_skip_comment_multi* = 0x00000002'i32 - bp_TGScannerConfig_skip_comment_multi* = 1'i32 - bm_TGScannerConfig_skip_comment_single* = 0x00000004'i32 - bp_TGScannerConfig_skip_comment_single* = 2'i32 - bm_TGScannerConfig_scan_comment_multi* = 0x00000008'i32 - bp_TGScannerConfig_scan_comment_multi* = 3'i32 - bm_TGScannerConfig_scan_identifier* = 0x00000010'i32 - bp_TGScannerConfig_scan_identifier* = 4'i32 - bm_TGScannerConfig_scan_identifier_1char* = 0x00000020'i32 - bp_TGScannerConfig_scan_identifier_1char* = 5'i32 - bm_TGScannerConfig_scan_identifier_NULL* = 0x00000040'i32 - bp_TGScannerConfig_scan_identifier_NULL* = 6'i32 - bm_TGScannerConfig_scan_symbols* = 0x00000080'i32 - bp_TGScannerConfig_scan_symbols* = 7'i32 - bm_TGScannerConfig_scan_binary* = 0x00000100'i32 - bp_TGScannerConfig_scan_binary* = 8'i32 - bm_TGScannerConfig_scan_octal* = 0x00000200'i32 - bp_TGScannerConfig_scan_octal* = 9'i32 - bm_TGScannerConfig_scan_float* = 0x00000400'i32 - bp_TGScannerConfig_scan_float* = 10'i32 - bm_TGScannerConfig_scan_hex* = 0x00000800'i32 - bp_TGScannerConfig_scan_hex* = 11'i32 - bm_TGScannerConfig_scan_hex_dollar* = 0x00001000'i32 - bp_TGScannerConfig_scan_hex_dollar* = 12'i32 - bm_TGScannerConfig_scan_string_sq* = 0x00002000'i32 - bp_TGScannerConfig_scan_string_sq* = 13'i32 - bm_TGScannerConfig_scan_string_dq* = 0x00004000'i32 - bp_TGScannerConfig_scan_string_dq* = 14'i32 - bm_TGScannerConfig_numbers_2_int* = 0x00008000'i32 - bp_TGScannerConfig_numbers_2_int* = 15'i32 - bm_TGScannerConfig_int_2_float* = 0x00010000'i32 - bp_TGScannerConfig_int_2_float* = 16'i32 - bm_TGScannerConfig_identifier_2_string* = 0x00020000'i32 - bp_TGScannerConfig_identifier_2_string* = 17'i32 - bm_TGScannerConfig_char_2_token* = 0x00040000'i32 - bp_TGScannerConfig_char_2_token* = 18'i32 - bm_TGScannerConfig_symbol_2_token* = 0x00080000'i32 - bp_TGScannerConfig_symbol_2_token* = 19'i32 - bm_TGScannerConfig_scope_0_fallback* = 0x00100000'i32 - bp_TGScannerConfig_scope_0_fallback* = 20'i32 - -proc TGScannerConfig_case_sensitive*(a: PGScannerConfig): guint -proc TGScannerConfig_set_case_sensitive*(a: PGScannerConfig, - `case_sensitive`: guint) -proc TGScannerConfig_skip_comment_multi*(a: PGScannerConfig): guint -proc TGScannerConfig_set_skip_comment_multi*(a: PGScannerConfig, - `skip_comment_multi`: guint) -proc TGScannerConfig_skip_comment_single*(a: PGScannerConfig): guint -proc TGScannerConfig_set_skip_comment_single*(a: PGScannerConfig, - `skip_comment_single`: guint) -proc TGScannerConfig_scan_comment_multi*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_comment_multi*(a: PGScannerConfig, - `scan_comment_multi`: guint) -proc TGScannerConfig_scan_identifier*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_identifier*(a: PGScannerConfig, - `scan_identifier`: guint) -proc TGScannerConfig_scan_identifier_1char*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_identifier_1char*(a: PGScannerConfig, - `scan_identifier_1char`: guint) -proc TGScannerConfig_scan_identifier_NULL*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_identifier_NULL*(a: PGScannerConfig, - `scan_identifier_NULL`: guint) -proc TGScannerConfig_scan_symbols*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_symbols*(a: PGScannerConfig, - `scan_symbols`: guint) -proc TGScannerConfig_scan_binary*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_binary*(a: PGScannerConfig, - `scan_binary`: guint) -proc TGScannerConfig_scan_octal*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_octal*(a: PGScannerConfig, `scan_octal`: guint) -proc TGScannerConfig_scan_float*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_float*(a: PGScannerConfig, `scan_float`: guint) -proc TGScannerConfig_scan_hex*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_hex*(a: PGScannerConfig, `scan_hex`: guint) -proc TGScannerConfig_scan_hex_dollar*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_hex_dollar*(a: PGScannerConfig, - `scan_hex_dollar`: guint) -proc TGScannerConfig_scan_string_sq*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_string_sq*(a: PGScannerConfig, - `scan_string_sq`: guint) -proc TGScannerConfig_scan_string_dq*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scan_string_dq*(a: PGScannerConfig, - `scan_string_dq`: guint) -proc TGScannerConfig_numbers_2_int*(a: PGScannerConfig): guint -proc TGScannerConfig_set_numbers_2_int*(a: PGScannerConfig, - `numbers_2_int`: guint) -proc TGScannerConfig_int_2_float*(a: PGScannerConfig): guint -proc TGScannerConfig_set_int_2_float*(a: PGScannerConfig, - `int_2_float`: guint) -proc TGScannerConfig_identifier_2_string*(a: PGScannerConfig): guint -proc TGScannerConfig_set_identifier_2_string*(a: PGScannerConfig, - `identifier_2_string`: guint) -proc TGScannerConfig_char_2_token*(a: PGScannerConfig): guint -proc TGScannerConfig_set_char_2_token*(a: PGScannerConfig, - `char_2_token`: guint) -proc TGScannerConfig_symbol_2_token*(a: PGScannerConfig): guint -proc TGScannerConfig_set_symbol_2_token*(a: PGScannerConfig, - `symbol_2_token`: guint) -proc TGScannerConfig_scope_0_fallback*(a: PGScannerConfig): guint -proc TGScannerConfig_set_scope_0_fallback*(a: PGScannerConfig, - `scope_0_fallback`: guint) -proc new*(config_templ: PGScannerConfig): PGScanner{.cdecl, - dynlib: gliblib, importc: "g_scanner_new".} -proc destroy*(scanner: PGScanner){.cdecl, dynlib: gliblib, - importc: "g_scanner_destroy".} -proc input_file*(scanner: PGScanner, input_fd: gint){.cdecl, - dynlib: gliblib, importc: "g_scanner_input_file".} -proc sync_file_offset*(scanner: PGScanner){.cdecl, dynlib: gliblib, - importc: "g_scanner_sync_file_offset".} -proc input_text*(scanner: PGScanner, text: cstring, text_len: guint){. - cdecl, dynlib: gliblib, importc: "g_scanner_input_text".} -proc get_next_token*(scanner: PGScanner): TGTokenType{.cdecl, - dynlib: gliblib, importc: "g_scanner_get_next_token".} -proc peek_next_token*(scanner: PGScanner): TGTokenType{.cdecl, - dynlib: gliblib, importc: "g_scanner_peek_next_token".} -proc cur_token*(scanner: PGScanner): TGTokenType{.cdecl, - dynlib: gliblib, importc: "g_scanner_cur_token".} -proc cur_value*(scanner: PGScanner): TGTokenValue{.cdecl, - dynlib: gliblib, importc: "g_scanner_cur_value".} -proc cur_line*(scanner: PGScanner): guint{.cdecl, dynlib: gliblib, - importc: "g_scanner_cur_line".} -proc cur_position*(scanner: PGScanner): guint{.cdecl, dynlib: gliblib, - importc: "g_scanner_cur_position".} -proc eof*(scanner: PGScanner): gboolean{.cdecl, dynlib: gliblib, - importc: "g_scanner_eof".} -proc set_scope*(scanner: PGScanner, scope_id: guint): guint{.cdecl, - dynlib: gliblib, importc: "g_scanner_set_scope".} -proc scope_add_symbol*(scanner: PGScanner, scope_id: guint, - symbol: cstring, value: gpointer){.cdecl, - dynlib: gliblib, importc: "g_scanner_scope_add_symbol".} -proc scope_remove_symbol*(scanner: PGScanner, scope_id: guint, - symbol: cstring){.cdecl, dynlib: gliblib, - importc: "g_scanner_scope_remove_symbol".} -proc scope_lookup_symbol*(scanner: PGScanner, scope_id: guint, - symbol: cstring): gpointer{.cdecl, - dynlib: gliblib, importc: "g_scanner_scope_lookup_symbol".} -proc scope_foreach_symbol*(scanner: PGScanner, scope_id: guint, - func: TGHFunc, user_data: gpointer){.cdecl, - dynlib: gliblib, importc: "g_scanner_scope_foreach_symbol".} -proc lookup_symbol*(scanner: PGScanner, symbol: cstring): gpointer{. - cdecl, dynlib: gliblib, importc: "g_scanner_lookup_symbol".} -proc unexp_token*(scanner: PGScanner, expected_token: TGTokenType, - identifier_spec: cstring, symbol_spec: cstring, - symbol_name: cstring, `message`: cstring, - is_error: gint){.cdecl, dynlib: gliblib, - importc: "g_scanner_unexp_token".} -proc G_SHELL_ERROR*(): TGQuark -type - PGShellError* = ptr TGShellError - TGShellError* = enum - G_SHELL_ERROR_BAD_QUOTING, G_SHELL_ERROR_EMPTY_STRING, G_SHELL_ERROR_FAILED - -proc g_shell_error_quark*(): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_shell_error_quark".} -proc g_shell_quote*(unquoted_string: cstring): cstring{.cdecl, dynlib: gliblib, - importc: "g_shell_quote".} -proc g_shell_unquote*(quoted_string: cstring, error: pointer): cstring{.cdecl, - dynlib: gliblib, importc: "g_shell_unquote".} -proc g_shell_parse_argv*(command_line: cstring, argcp: Pgint, argvp: PPPgchar, - error: pointer): gboolean{.cdecl, dynlib: gliblib, - importc: "g_shell_parse_argv".} -proc G_SPAWN_ERROR*(): TGQuark -type - PGSpawnError* = ptr TGSpawnError - TGSpawnError* = enum - G_SPAWN_ERROR_FORK, G_SPAWN_ERROR_READ, G_SPAWN_ERROR_CHDIR, - G_SPAWN_ERROR_ACCES, G_SPAWN_ERROR_PERM, G_SPAWN_ERROR_2BIG, - G_SPAWN_ERROR_NOEXEC, G_SPAWN_ERROR_NAMETOOLONG, G_SPAWN_ERROR_NOENT, - G_SPAWN_ERROR_NOMEM, G_SPAWN_ERROR_NOTDIR, G_SPAWN_ERROR_LOOP, - G_SPAWN_ERROR_TXTBUSY, G_SPAWN_ERROR_IO, G_SPAWN_ERROR_NFILE, - G_SPAWN_ERROR_MFILE, G_SPAWN_ERROR_INVAL, G_SPAWN_ERROR_ISDIR, - G_SPAWN_ERROR_LIBBAD, G_SPAWN_ERROR_FAILED - TGSpawnChildSetupFunc* = proc (user_data: gpointer){.cdecl.} - PGSpawnFlags* = ptr TGSpawnFlags - TGSpawnFlags* = int - -const - G_SPAWN_LEAVE_DESCRIPTORS_OPEN* = 1 shl 0 - G_SPAWN_DO_NOT_REAP_CHILD* = 1 shl 1 - G_SPAWN_SEARCH_PATH* = 1 shl 2 - G_SPAWN_STDOUT_TO_DEV_NULL* = 1 shl 3 - G_SPAWN_STDERR_TO_DEV_NULL* = 1 shl 4 - G_SPAWN_CHILD_INHERITS_STDIN* = 1 shl 5 - G_SPAWN_FILE_AND_ARGV_ZERO* = 1 shl 6 - -proc g_spawn_error_quark*(): TGQuark{.cdecl, dynlib: gliblib, - importc: "g_spawn_error_quark".} -proc g_spawn_async*(working_directory: cstring, argv: PPgchar, envp: PPgchar, - flags: TGSpawnFlags, child_setup: TGSpawnChildSetupFunc, - user_data: gpointer, child_pid: Pgint, error: pointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_spawn_async".} -proc g_spawn_async*(working_directory: cstring, argv: PPgchar, - envp: PPgchar, flags: TGSpawnFlags, - child_setup: TGSpawnChildSetupFunc, - user_data: gpointer, child_pid: Pgint, - standard_input: Pgint, standard_output: Pgint, - standard_error: Pgint, error: pointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_spawn_async_with_pipes".} -proc g_spawn_sync*(working_directory: cstring, argv: PPgchar, envp: PPgchar, - flags: TGSpawnFlags, child_setup: TGSpawnChildSetupFunc, - user_data: gpointer, standard_output: PPgchar, - standard_error: PPgchar, exit_status: Pgint, error: pointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_spawn_sync".} -proc g_spawn_command_line_sync*(command_line: cstring, standard_output: PPgchar, - standard_error: PPgchar, exit_status: Pgint, - error: pointer): gboolean{.cdecl, - dynlib: gliblib, importc: "g_spawn_command_line_sync".} -proc g_spawn_command_line_async*(command_line: cstring, error: pointer): gboolean{. - cdecl, dynlib: gliblib, importc: "g_spawn_command_line_async".} -proc G_TYPE_IS_BOXED*(theType: GType): gboolean -proc HOLDS_BOXED*(value: PGValue): gboolean -proc G_TYPE_CLOSURE*(): GType -proc G_TYPE_VALUE*(): GType -proc G_TYPE_VALUE_ARRAY*(): GType -proc G_TYPE_GSTRING*(): GType -proc g_boxed_copy*(boxed_type: GType, src_boxed: gconstpointer): gpointer{. - cdecl, dynlib: gobjectlib, importc: "g_boxed_copy".} -proc g_boxed_free*(boxed_type: GType, boxed: gpointer){.cdecl, - dynlib: gobjectlib, importc: "g_boxed_free".} -proc set_boxed*(value: PGValue, v_boxed: gconstpointer){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_boxed".} -proc set_static_boxed*(value: PGValue, v_boxed: gconstpointer){.cdecl, - dynlib: gobjectlib, importc: "g_value_set_static_boxed".} -proc get_boxed*(value: PGValue): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_boxed".} -proc dup_boxed*(value: PGValue): gpointer{.cdecl, dynlib: gobjectlib, - importc: "g_value_dup_boxed".} -proc g_boxed_type_register_static*(name: cstring, boxed_copy: TGBoxedCopyFunc, - boxed_free: TGBoxedFreeFunc): GType{.cdecl, - dynlib: gobjectlib, importc: "g_boxed_type_register_static".} -proc set_boxed_take_ownership*(value: PGValue, v_boxed: gconstpointer){. - cdecl, dynlib: gobjectlib, importc: "g_value_set_boxed_take_ownership".} -proc g_closure_get_type*(): GType{.cdecl, dynlib: gobjectlib, - importc: "g_closure_get_type".} -proc g_value_get_type*(): GType{.cdecl, dynlib: gobjectlib, - importc: "g_value_get_type".} -proc g_value_array_get_type*(): GType{.cdecl, dynlib: gobjectlib, - importc: "g_value_array_get_type".} -proc g_gstring_get_type*(): GType{.cdecl, dynlib: gobjectlib, - importc: "g_gstring_get_type".} -type - PGModule* = pointer - TGModuleFlags* = int32 - TGModuleCheckInit* = proc (module: PGModule): cstring{.cdecl.} - TGModuleUnload* = proc (module: PGModule){.cdecl.} - -const - G_MODULE_BIND_LAZY* = 1 shl 0 - G_MODULE_BIND_MASK* = 1 - -proc g_module_supported*(): gboolean{.cdecl, dynlib: gmodulelib, - importc: "g_module_supported".} -proc g_module_open*(file_name: cstring, flags: TGModuleFlags): PGModule{.cdecl, - dynlib: gmodulelib, importc: "g_module_open".} -proc close*(module: PGModule): gboolean{.cdecl, dynlib: gmodulelib, - importc: "g_module_close".} -proc make_resident*(module: PGModule){.cdecl, dynlib: gmodulelib, - importc: "g_module_make_resident".} -proc g_module_error*(): cstring{.cdecl, dynlib: gmodulelib, - importc: "g_module_error".} -proc symbol*(module: PGModule, symbol_name: cstring, symbol: Pgpointer): gboolean{. - cdecl, dynlib: gmodulelib, importc: "g_module_symbol".} -proc name*(module: PGModule): cstring{.cdecl, dynlib: gmodulelib, - importc: "g_module_name".} -proc g_module_build_path*(directory: cstring, module_name: cstring): cstring{. - cdecl, dynlib: gmodulelib, importc: "g_module_build_path".} -proc cclosure_marshal_VOID_VOID*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__VOID".} -proc cclosure_marshal_VOID_BOOLEAN*(closure: PGClosure, - return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__BOOLEAN".} -proc cclosure_marshal_VOID_CHAR*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__CHAR".} -proc cclosure_marshal_VOID_UCHAR*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__UCHAR".} -proc cclosure_marshal_VOID_INT*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__INT".} -proc cclosure_marshal_VOID_UINT*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__UINT".} -proc cclosure_marshal_VOID_LONG*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__LONG".} -proc cclosure_marshal_VOID_ULONG*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__ULONG".} -proc cclosure_marshal_VOID_ENUM*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__ENUM".} -proc cclosure_marshal_VOID_FLAGS*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__FLAGS".} -proc cclosure_marshal_VOID_FLOAT*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__FLOAT".} -proc cclosure_marshal_VOID_DOUBLE*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__DOUBLE".} -proc cclosure_marshal_VOID_STRING*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__STRING".} -proc cclosure_marshal_VOID_PARAM*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__PARAM".} -proc cclosure_marshal_VOID_BOXED*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__BOXED".} -proc cclosure_marshal_VOID_POINTER*(closure: PGClosure, - return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__POINTER".} -proc cclosure_marshal_VOID_OBJECT*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__OBJECT".} -proc cclosure_marshal_STRING_OBJECT_POINTER*(closure: PGClosure, - return_value: PGValue, n_param_values: GUInt, param_values: PGValue, - invocation_hint: GPointer, marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_STRING__OBJECT_POINTER".} -proc cclosure_marshal_VOID_UINT_POINTER*(closure: PGClosure, - return_value: PGValue, n_param_values: GUInt, param_values: PGValue, - invocation_hint: GPointer, marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_VOID__UINT_POINTER".} -proc cclosure_marshal_BOOLEAN_FLAGS*(closure: PGClosure, - return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gobjectlib, importc: "g_cclosure_marshal_BOOLEAN__FLAGS".} -proc cclosure_marshal_BOOL_FLAGS*(closure: PGClosure, return_value: PGValue, - n_param_values: GUInt, - param_values: PGValue, - invocation_hint: GPointer, - marshal_data: GPointer){.cdecl, - dynlib: gliblib, importc: "g_cclosure_marshal_BOOLEAN__FLAGS".} -proc GUINT16_SWAP_LE_BE_CONSTANT*(val: guint16): guint16 = - Result = ((val and 0x00FF'i16) shl 8'i16) or - ((val and 0xFF00'i16) shr 8'i16) - -proc GUINT32_SWAP_LE_BE_CONSTANT*(val: guint32): guint32 = - Result = ((val and 0x000000FF'i32) shl 24'i32) or - ((val and 0x0000FF00'i32) shl 8'i32) or - ((val and 0x00FF0000'i32) shr 8'i32) or - ((val and 0xFF000000'i32) shr 24'i32) - -proc GUINT_TO_POINTER*(i: guint): pointer = - Result = cast[Pointer](TAddress(i)) - -when false: - type - PGArray* = pointer - proc g_array_append_val*(a: PGArray, v: gpointer): PGArray = - result = g_array_append_vals(a, addr(v), 1) - - proc g_array_prepend_val*(a: PGArray, v: gpointer): PGArray = - result = g_array_prepend_vals(a, addr(v), 1) - - proc g_array_insert_val*(a: PGArray, i: guint, v: gpointer): PGArray = - result = g_array_insert_vals(a, i, addr(v), 1) - - proc g_ptr_array_index*(parray: PGPtrArray, index: guint): gpointer = - result = cast[PGPointer](cast[int](parray []. pdata) + - index * SizeOf(GPointer))[] - - proc G_THREAD_ERROR*(): TGQuark = - result = g_thread_error_quark() - - proc g_mutex_lock*(mutex: PGMutex) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.mutex_lock(mutex) - - proc g_mutex_trylock*(mutex: PGMutex): gboolean = - if g_threads_got_initialized: - result = g_thread_functions_for_glib_use.mutex_trylock(mutex) - else: - result = true - - proc g_mutex_unlock*(mutex: PGMutex) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.mutex_unlock(mutex) - - proc g_mutex_free*(mutex: PGMutex) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.mutex_free(mutex) - - proc g_cond_wait*(cond: PGCond, mutex: PGMutex) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.cond_wait(cond, mutex) - - proc g_cond_timed_wait*(cond: PGCond, mutex: PGMutex, end_time: PGTimeVal): gboolean = - if g_threads_got_initialized: - result = g_thread_functions_for_glib_use.cond_timed_wait(cond, mutex, - end_time) - else: - result = true - - proc g_thread_supported*(): gboolean = - result = g_threads_got_initialized - - proc g_mutex_new*(): PGMutex = - result = g_thread_functions_for_glib_use.mutex_new() - - proc g_cond_new*(): PGCond = - result = g_thread_functions_for_glib_use.cond_new() - - proc g_cond_signal*(cond: PGCond) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.cond_signal(cond) - - proc g_cond_broadcast*(cond: PGCond) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.cond_broadcast(cond) - - proc g_cond_free*(cond: PGCond) = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.cond_free(cond) - - proc g_private_new*(dest: TGDestroyNotify): PGPrivate = - result = g_thread_functions_for_glib_use.private_new(dest) - - proc g_private_get*(private_key: PGPrivate): gpointer = - if g_threads_got_initialized: - result = g_thread_functions_for_glib_use.private_get(private_key) - else: - result = private_key - - proc g_private_set*(private_key: var PGPrivate, data: gpointer) = - if g_threads_got_initialized: - nil - else: - private_key = data - - proc g_thread_yield*() = - if g_threads_got_initialized: - g_thread_functions_for_glib_use.thread_yield - - proc g_thread_create*(func: TGThreadFunc, data: gpointer, joinable: gboolean, - error: pointer): PGThread = - result = g_thread_create_full(func, data, 0, joinable, false, - G_THREAD_PRIORITY_NORMAL, error) - - proc g_static_mutex_get_mutex*(mutex: PPGMutex): PGMutex = - result = g_static_mutex_get_mutex_impl(mutex) - - proc g_static_mutex_lock*(mutex: PGStaticMutex) = - g_mutex_lock(g_static_mutex_get_mutex_impl(PPGMutex(mutex))) - - proc g_static_mutex_trylock*(mutex: PGStaticMutex): gboolean = - result = g_mutex_trylock(g_static_mutex_get_mutex(PPGMutex(mutex))) - - proc g_static_mutex_unlock*(mutex: PGStaticMutex) = - g_mutex_unlock(g_static_mutex_get_mutex_impl(PPGMutex(mutex))) - - proc g_main_new*(is_running: gboolean): PGMainLoop = - result = g_main_loop_new(nil, is_running) - - proc g_main_iteration*(may_block: gboolean): gboolean = - result = g_main_context_iteration(nil, may_block) - - proc g_main_pending*(): gboolean = - result = g_main_context_pending(nil) - - proc g_main_set_poll_func*(func: TGPollFunc) = - g_main_context_set_poll_func(nil, func) - -proc next*(slist: PGSList): PGSList = - if slist != nil: - result = slist.next - else: - result = nil - -proc g_new*(bytes_per_struct, n_structs: int): gpointer = - result = g_malloc(n_structs * bytes_per_struct) - -proc g_new0*(bytes_per_struct, n_structs: int): gpointer = - result = g_malloc0(n_structs * bytes_per_struct) - -proc g_renew*(struct_size: int, OldMem: gpointer, n_structs: int): gpointer = - result = g_realloc(OldMem, struct_size * n_structs) - -proc g_chunk_new*(chunk: Pointer): Pointer = - result = chunk_alloc(chunk) - -proc g_chunk_new0*(chunk: Pointer): Pointer = - result = chunk_alloc0(chunk) - -proc previous*(list: PGList): PGList = - if list != nil: - result = list.prev - else: - result = nil - -proc next*(list: PGList): PGList = - if list != nil: - result = list.next - else: - result = nil - -proc G_CONVERT_ERROR*(): TGQuark = - result = g_convert_error_quark() - -proc g_datalist_id_set_data*(datalist: PPGData, key_id: TGQuark, data: gpointer) = - g_datalist_id_set_data_full(datalist, key_id, data, TGDestroyNotify(nil)) - -proc g_datalist_id_remove_data*(datalist: PPGData, key_id: TGQuark) = - g_datalist_id_set_data(datalist, key_id, nil) - -proc g_datalist_get_data*(datalist: PPGData, key_str: cstring): PPGData = - result = cast[PPGData](g_datalist_id_get_data(datalist, - g_quark_try_string(key_str))) - -proc g_datalist_set_data_full*(datalist: PPGData, key_str: cstring, - data: gpointer, destroy_func: TGDestroyNotify) = - g_datalist_id_set_data_full(datalist, g_quark_from_string(key_str), data, - destroy_func) - -proc g_datalist_set_data*(datalist: PPGData, key_str: cstring, data: gpointer) = - g_datalist_set_data_full(datalist, key_str, data, nil) - -proc g_datalist_remove_no_notify*(datalist: PPGData, key_str: cstring) = - discard g_datalist_id_remove_no_notify(datalist, g_quark_try_string(key_str)) - -proc g_datalist_remove_data*(datalist: PPGData, key_str: cstring) = - g_datalist_id_set_data(datalist, g_quark_try_string(key_str), nil) - -proc g_dataset_id_set_data*(location: gconstpointer, key_id: TGQuark, - data: gpointer) = - g_dataset_id_set_data_full(location, key_id, data, nil) - -proc g_dataset_id_remove_data*(location: gconstpointer, key_id: TGQuark) = - g_dataset_id_set_data(location, key_id, nil) - -proc g_dataset_get_data*(location: gconstpointer, key_str: cstring): gpointer = - result = g_dataset_id_get_data(location, g_quark_try_string(key_str)) - -proc g_dataset_set_data_full*(location: gconstpointer, key_str: cstring, - data: gpointer, destroy_func: TGDestroyNotify) = - g_dataset_id_set_data_full(location, g_quark_from_string(key_str), data, - destroy_func) - -proc g_dataset_remove_no_notify*(location: gconstpointer, key_str: cstring) = - discard g_dataset_id_remove_no_notify(location, g_quark_try_string(key_str)) - -proc g_dataset_set_data*(location: gconstpointer, key_str: cstring, - data: gpointer) = - g_dataset_set_data_full(location, key_str, data, nil) - -proc g_dataset_remove_data*(location: gconstpointer, key_str: cstring) = - g_dataset_id_set_data(location, g_quark_try_string(key_str), nil) - -proc G_FILE_ERROR*(): TGQuark = - result = g_file_error_quark() - -proc TGHookList_hook_size*(a: PGHookList): guint = - result = (a.flag0 and bm_TGHookList_hook_size) shr bp_TGHookList_hook_size - -proc TGHookList_set_hook_size*(a: PGHookList, `hook_size`: guint) = - a.flag0 = a.flag0 or - ((`hook_size` shl bp_TGHookList_hook_size) and bm_TGHookList_hook_size) - -proc TGHookList_is_setup*(a: PGHookList): guint = - result = (a.flag0 and bm_TGHookList_is_setup) shr bp_TGHookList_is_setup - -proc TGHookList_set_is_setup*(a: PGHookList, `is_setup`: guint) = - a.flag0 = a.flag0 or - ((`is_setup` shl bp_TGHookList_is_setup) and bm_TGHookList_is_setup) - -proc G_HOOK*(hook: pointer): PGHook = - result = cast[PGHook](hook) - -proc FLAGS*(hook: PGHook): guint = - result = hook.flags - -proc ACTIVE*(hook: PGHook): bool = - result = (hook.flags and G_HOOK_FLAG_ACTIVE) != 0'i32 - -proc IN_CALL*(hook: PGHook): bool = - result = (hook.flags and G_HOOK_FLAG_IN_CALL) != 0'i32 - -proc IS_VALID*(hook: PGHook): bool = - result = (hook.hook_id != 0) and ACTIVE(hook) - -proc IS_UNLINKED*(hook: PGHook): bool = - result = (hook.next == nil) and (hook.prev == nil) and (hook.hook_id == 0) and - (hook.ref_count == 0'i32) - -proc append*(hook_list: PGHookList, hook: PGHook) = - insert_before(hook_list, nil, hook) - -proc G_IO_CHANNEL_ERROR*(): TGQuark = - result = g_io_channel_error_quark() - -proc TGIOChannel_use_buffer*(a: PGIOChannel): guint = - result = (a.flag0 and bm_TGIOChannel_use_buffer) shr - bp_TGIOChannel_use_buffer - -proc TGIOChannel_set_use_buffer*(a: PGIOChannel, `use_buffer`: guint) = - a.flag0 = a.flag0 or - (int16(`use_buffer` shl bp_TGIOChannel_use_buffer) and - bm_TGIOChannel_use_buffer) - -proc TGIOChannel_do_encode*(a: PGIOChannel): guint = - result = (a.flag0 and bm_TGIOChannel_do_encode) shr - bp_TGIOChannel_do_encode - -proc TGIOChannel_set_do_encode*(a: PGIOChannel, `do_encode`: guint) = - a.flag0 = a.flag0 or - (int16(`do_encode` shl bp_TGIOChannel_do_encode) and - bm_TGIOChannel_do_encode) - -proc TGIOChannel_close_on_unref*(a: PGIOChannel): guint = - result = (a.flag0 and bm_TGIOChannel_close_on_unref) shr - bp_TGIOChannel_close_on_unref - -proc TGIOChannel_set_close_on_unref*(a: PGIOChannel, `close_on_unref`: guint) = - a.flag0 = a.flag0 or - (int16(`close_on_unref` shl bp_TGIOChannel_close_on_unref) and - bm_TGIOChannel_close_on_unref) - -proc TGIOChannel_is_readable*(a: PGIOChannel): guint = - result = (a.flag0 and bm_TGIOChannel_is_readable) shr - bp_TGIOChannel_is_readable - -proc TGIOChannel_set_is_readable*(a: PGIOChannel, `is_readable`: guint) = - a.flag0 = a.flag0 or - (int16(`is_readable` shl bp_TGIOChannel_is_readable) and - bm_TGIOChannel_is_readable) - -proc TGIOChannel_is_writeable*(a: PGIOChannel): guint = - result = (a.flag0 and bm_TGIOChannel_is_writeable) shr - bp_TGIOChannel_is_writeable - -proc TGIOChannel_set_is_writeable*(a: PGIOChannel, `is_writeable`: guint) = - a.flag0 = a.flag0 or - (int16(`is_writeable` shl bp_TGIOChannel_is_writeable) and - bm_TGIOChannel_is_writeable) - -proc TGIOChannel_is_seekable*(a: PGIOChannel): guint = - result = (a.flag0 and bm_TGIOChannel_is_seekable) shr - bp_TGIOChannel_is_seekable - -proc TGIOChannel_set_is_seekable*(a: PGIOChannel, `is_seekable`: guint) = - a.flag0 = a.flag0 or - (int16(`is_seekable` shl bp_TGIOChannel_is_seekable) and - bm_TGIOChannel_is_seekable) - -proc utf8_next_char*(p: pguchar): pguchar = - result = cast[pguchar](cast[TAddress](p) + 1) # p + ord((g_utf8_skip + p[] )[] ) - -when false: - proc GLIB_CHECK_VERSION*(major, minor, micro: guint): bool = - result = ((GLIB_MAJOR_VERSION > major) or - ((GLIB_MAJOR_VERSION == major) and (GLIB_MINOR_VERSION > minor)) or - ((GLIB_MAJOR_VERSION == major) and (GLIB_MINOR_VERSION == minor) and - (GLIB_MICRO_VERSION >= micro))) - - proc g_error*(format: cstring) = - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format) - - proc g_message*(format: cstring) = - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format) - - proc g_critical*(format: cstring) = - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format) - - proc g_warning*(format: cstring) = - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format) - -proc G_MARKUP_ERROR*(): TGQuark = - result = g_markup_error_quark() - -proc IS_ROOT*(node: PGNode): bool = - result = (node.parent == nil) and (node.next == nil) and (node.prev == nil) - -proc IS_LEAF*(node: PGNode): bool = - result = node.children == nil - -proc append*(parent: PGNode, node: PGNode): PGNode = - result = insert_before(parent, nil, node) - -proc insert_data*(parent: PGNode, position: gint, data: gpointer): PGNode = - result = insert(parent, position, g_node_new(data)) - -proc insert_data_before*(parent: PGNode, sibling: PGNode, - data: gpointer): PGNode = - result = insert_before(parent, sibling, g_node_new(data)) - -proc prepend_data*(parent: PGNode, data: gpointer): PGNode = - result = prepend(parent, g_node_new(data)) - -proc append_data*(parent: PGNode, data: gpointer): PGNode = - result = insert_before(parent, nil, g_node_new(data)) - -proc prev_sibling*(node: PGNode): PGNode = - if node != nil: - result = node.prev - else: - result = nil - -proc next_sibling*(node: PGNode): PGNode = - if node != nil: - result = node.next - else: - result = nil - -proc first_child*(node: PGNode): PGNode = - if node != nil: - result = node.children - else: - result = nil - -proc boolean*(rand: PGRand): gboolean = - result = (int(rand_int(rand)) and (1 shl 15)) != 0 - -proc g_random_boolean*(): gboolean = - result = (int(g_random_int()) and (1 shl 15)) != 0 - -proc TGScannerConfig_case_sensitive*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_case_sensitive) shr - bp_TGScannerConfig_case_sensitive - -proc TGScannerConfig_set_case_sensitive*(a: PGScannerConfig, - `case_sensitive`: guint) = - a.flag0 = a.flag0 or - ((`case_sensitive` shl bp_TGScannerConfig_case_sensitive) and - bm_TGScannerConfig_case_sensitive) - -proc TGScannerConfig_skip_comment_multi*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_skip_comment_multi) shr - bp_TGScannerConfig_skip_comment_multi - -proc TGScannerConfig_set_skip_comment_multi*(a: PGScannerConfig, - `skip_comment_multi`: guint) = - a.flag0 = a.flag0 or - ((`skip_comment_multi` shl bp_TGScannerConfig_skip_comment_multi) and - bm_TGScannerConfig_skip_comment_multi) - -proc TGScannerConfig_skip_comment_single*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_skip_comment_single) shr - bp_TGScannerConfig_skip_comment_single - -proc TGScannerConfig_set_skip_comment_single*(a: PGScannerConfig, - `skip_comment_single`: guint) = - a.flag0 = a.flag0 or - ((`skip_comment_single` shl bp_TGScannerConfig_skip_comment_single) and - bm_TGScannerConfig_skip_comment_single) - -proc TGScannerConfig_scan_comment_multi*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_comment_multi) shr - bp_TGScannerConfig_scan_comment_multi - -proc TGScannerConfig_set_scan_comment_multi*(a: PGScannerConfig, - `scan_comment_multi`: guint) = - a.flag0 = a.flag0 or - ((`scan_comment_multi` shl bp_TGScannerConfig_scan_comment_multi) and - bm_TGScannerConfig_scan_comment_multi) - -proc TGScannerConfig_scan_identifier*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_identifier) shr - bp_TGScannerConfig_scan_identifier - -proc TGScannerConfig_set_scan_identifier*(a: PGScannerConfig, - `scan_identifier`: guint) = - a.flag0 = a.flag0 or - ((`scan_identifier` shl bp_TGScannerConfig_scan_identifier) and - bm_TGScannerConfig_scan_identifier) - -proc TGScannerConfig_scan_identifier_1char*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_identifier_1char) shr - bp_TGScannerConfig_scan_identifier_1char - -proc TGScannerConfig_set_scan_identifier_1char*(a: PGScannerConfig, - `scan_identifier_1char`: guint) = - a.flag0 = a.flag0 or - ((`scan_identifier_1char` shl bp_TGScannerConfig_scan_identifier_1char) and - bm_TGScannerConfig_scan_identifier_1char) - -proc TGScannerConfig_scan_identifier_NULL*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_identifier_NULL) shr - bp_TGScannerConfig_scan_identifier_NULL - -proc TGScannerConfig_set_scan_identifier_NULL*(a: PGScannerConfig, - `scan_identifier_NULL`: guint) = - a.flag0 = a.flag0 or - ((`scan_identifier_NULL` shl bp_TGScannerConfig_scan_identifier_NULL) and - bm_TGScannerConfig_scan_identifier_NULL) - -proc TGScannerConfig_scan_symbols*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_symbols) shr - bp_TGScannerConfig_scan_symbols - -proc TGScannerConfig_set_scan_symbols*(a: PGScannerConfig, - `scan_symbols`: guint) = - a.flag0 = a.flag0 or - ((`scan_symbols` shl bp_TGScannerConfig_scan_symbols) and - bm_TGScannerConfig_scan_symbols) - -proc TGScannerConfig_scan_binary*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_binary) shr - bp_TGScannerConfig_scan_binary - -proc TGScannerConfig_set_scan_binary*(a: PGScannerConfig, - `scan_binary`: guint) = - a.flag0 = a.flag0 or - ((`scan_binary` shl bp_TGScannerConfig_scan_binary) and - bm_TGScannerConfig_scan_binary) - -proc TGScannerConfig_scan_octal*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_octal) shr - bp_TGScannerConfig_scan_octal - -proc TGScannerConfig_set_scan_octal*(a: PGScannerConfig, `scan_octal`: guint) = - a.flag0 = a.flag0 or - ((`scan_octal` shl bp_TGScannerConfig_scan_octal) and - bm_TGScannerConfig_scan_octal) - -proc TGScannerConfig_scan_float*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_float) shr - bp_TGScannerConfig_scan_float - -proc TGScannerConfig_set_scan_float*(a: PGScannerConfig, `scan_float`: guint) = - a.flag0 = a.flag0 or - ((`scan_float` shl bp_TGScannerConfig_scan_float) and - bm_TGScannerConfig_scan_float) - -proc TGScannerConfig_scan_hex*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_hex) shr - bp_TGScannerConfig_scan_hex - -proc TGScannerConfig_set_scan_hex*(a: PGScannerConfig, `scan_hex`: guint) = - a.flag0 = a.flag0 or - ((`scan_hex` shl bp_TGScannerConfig_scan_hex) and - bm_TGScannerConfig_scan_hex) - -proc TGScannerConfig_scan_hex_dollar*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_hex_dollar) shr - bp_TGScannerConfig_scan_hex_dollar - -proc TGScannerConfig_set_scan_hex_dollar*(a: PGScannerConfig, - `scan_hex_dollar`: guint) = - a.flag0 = a.flag0 or - ((`scan_hex_dollar` shl bp_TGScannerConfig_scan_hex_dollar) and - bm_TGScannerConfig_scan_hex_dollar) - -proc TGScannerConfig_scan_string_sq*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_string_sq) shr - bp_TGScannerConfig_scan_string_sq - -proc TGScannerConfig_set_scan_string_sq*(a: PGScannerConfig, - `scan_string_sq`: guint) = - a.flag0 = a.flag0 or - ((`scan_string_sq` shl bp_TGScannerConfig_scan_string_sq) and - bm_TGScannerConfig_scan_string_sq) - -proc TGScannerConfig_scan_string_dq*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scan_string_dq) shr - bp_TGScannerConfig_scan_string_dq - -proc TGScannerConfig_set_scan_string_dq*(a: PGScannerConfig, - `scan_string_dq`: guint) = - a.flag0 = a.flag0 or - ((`scan_string_dq` shl bp_TGScannerConfig_scan_string_dq) and - bm_TGScannerConfig_scan_string_dq) - -proc TGScannerConfig_numbers_2_int*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_numbers_2_int) shr - bp_TGScannerConfig_numbers_2_int - -proc TGScannerConfig_set_numbers_2_int*(a: PGScannerConfig, - `numbers_2_int`: guint) = - a.flag0 = a.flag0 or - ((`numbers_2_int` shl bp_TGScannerConfig_numbers_2_int) and - bm_TGScannerConfig_numbers_2_int) - -proc TGScannerConfig_int_2_float*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_int_2_float) shr - bp_TGScannerConfig_int_2_float - -proc TGScannerConfig_set_int_2_float*(a: PGScannerConfig, - `int_2_float`: guint) = - a.flag0 = a.flag0 or - ((`int_2_float` shl bp_TGScannerConfig_int_2_float) and - bm_TGScannerConfig_int_2_float) - -proc TGScannerConfig_identifier_2_string*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_identifier_2_string) shr - bp_TGScannerConfig_identifier_2_string - -proc TGScannerConfig_set_identifier_2_string*(a: PGScannerConfig, - `identifier_2_string`: guint) = - a.flag0 = a.flag0 or - ((`identifier_2_string` shl bp_TGScannerConfig_identifier_2_string) and - bm_TGScannerConfig_identifier_2_string) - -proc TGScannerConfig_char_2_token*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_char_2_token) shr - bp_TGScannerConfig_char_2_token - -proc TGScannerConfig_set_char_2_token*(a: PGScannerConfig, - `char_2_token`: guint) = - a.flag0 = a.flag0 or - ((`char_2_token` shl bp_TGScannerConfig_char_2_token) and - bm_TGScannerConfig_char_2_token) - -proc TGScannerConfig_symbol_2_token*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_symbol_2_token) shr - bp_TGScannerConfig_symbol_2_token - -proc TGScannerConfig_set_symbol_2_token*(a: PGScannerConfig, - `symbol_2_token`: guint) = - a.flag0 = a.flag0 or - ((`symbol_2_token` shl bp_TGScannerConfig_symbol_2_token) and - bm_TGScannerConfig_symbol_2_token) - -proc TGScannerConfig_scope_0_fallback*(a: PGScannerConfig): guint = - result = (a.flag0 and bm_TGScannerConfig_scope_0_fallback) shr - bp_TGScannerConfig_scope_0_fallback - -proc TGScannerConfig_set_scope_0_fallback*(a: PGScannerConfig, - `scope_0_fallback`: guint) = - a.flag0 = a.flag0 or - ((`scope_0_fallback` shl bp_TGScannerConfig_scope_0_fallback) and - bm_TGScannerConfig_scope_0_fallback) - -proc freeze_symbol_table*(scanner: PGScanner) = - if Scanner == nil: nil - -proc thaw_symbol_table*(scanner: PGScanner) = - if Scanner == nil: nil - -proc G_SHELL_ERROR*(): TGQuark = - result = g_shell_error_quark() - -proc G_SPAWN_ERROR*(): TGQuark = - result = g_spawn_error_quark() - -when false: - proc g_ascii_isalnum*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_ALNUM) != 0 - - proc g_ascii_isalpha*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_ALPHA) != 0 - - proc g_ascii_iscntrl*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_CNTRL) != 0 - - proc g_ascii_isdigit*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_DIGIT) != 0 - - proc g_ascii_isgraph*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_GRAPH) != 0 - - proc g_ascii_islower*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_LOWER) != 0 - - proc g_ascii_isprint*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_PRINT) != 0 - - proc g_ascii_ispunct*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_PUNCT) != 0 - - proc g_ascii_isspace*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_SPACE) != 0 - - proc g_ascii_isupper*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_UPPER) != 0 - - proc g_ascii_isxdigit*(c: gchar): bool = - result = ((g_ascii_table[guchar(c)]) and G_ASCII_XDIGIT) != 0 - - proc g_strstrip*(str: cstring): cstring = - result = g_strchomp(g_strchug(str)) - -proc G_TYPE_MAKE_FUNDAMENTAL*(x: int): GType = - result = GType(x shl G_TYPE_FUNDAMENTAL_SHIFT) - -proc G_TYPE_IS_FUNDAMENTAL*(theType: GType): bool = - result = theType <= G_TYPE_FUNDAMENTAL_MAX - -proc G_TYPE_IS_DERIVED*(theType: GType): bool = - result = theType > G_TYPE_FUNDAMENTAL_MAX - -proc G_TYPE_IS_INTERFACE*(theType: GType): bool = - result = (G_TYPE_FUNDAMENTAL(theType)) == G_TYPE_INTERFACE - -proc G_TYPE_IS_CLASSED*(theType: GType): gboolean = - result = private_g_type_test_flags(theType, G_TYPE_FLAG_CLASSED) - -proc G_TYPE_IS_INSTANTIATABLE*(theType: GType): bool = - result = private_g_type_test_flags(theType, G_TYPE_FLAG_INSTANTIATABLE) - -proc G_TYPE_IS_DERIVABLE*(theType: GType): bool = - result = private_g_type_test_flags(theType, G_TYPE_FLAG_DERIVABLE) - -proc G_TYPE_IS_DEEP_DERIVABLE*(theType: GType): bool = - result = private_g_type_test_flags(theType, G_TYPE_FLAG_DEEP_DERIVABLE) - -proc G_TYPE_IS_ABSTRACT*(theType: GType): bool = - result = private_g_type_test_flags(theType, G_TYPE_FLAG_ABSTRACT) - -proc G_TYPE_IS_VALUE_ABSTRACT*(theType: GType): bool = - result = private_g_type_test_flags(theType, G_TYPE_FLAG_VALUE_ABSTRACT) - -proc G_TYPE_IS_VALUE_TYPE*(theType: GType): bool = - result = private_g_type_check_is_value_type(theType) - -proc G_TYPE_HAS_VALUE_TABLE*(theType: GType): bool = - result = (g_type_value_table_peek(theType)) != nil - -proc G_TYPE_CHECK_INSTANCE*(instance: Pointer): gboolean = - result = private_g_type_check_instance(cast[PGTypeInstance](instance)) - -proc G_TYPE_CHECK_INSTANCE_CAST*(instance: Pointer, g_type: GType): PGTypeInstance = - result = cast[PGTypeInstance](private_g_type_check_instance_cast( - cast[PGTypeInstance](instance), g_type)) - -proc G_TYPE_CHECK_INSTANCE_TYPE*(instance: Pointer, g_type: GType): bool = - result = private_g_type_check_instance_is_a(cast[PGTypeInstance](instance), - g_type) - -proc G_TYPE_INSTANCE_GET_CLASS*(instance: Pointer, g_type: GType): PGTypeClass = - result = cast[PGTypeInstance](Instance).g_class - result = private_g_type_check_class_cast(result, g_type) - -proc G_TYPE_INSTANCE_GET_INTERFACE*(instance: Pointer, g_type: GType): Pointer = - result = g_type_interface_peek((cast[PGTypeInstance](instance)).g_class, - g_type) - -proc G_TYPE_CHECK_CLASS_CAST*(g_class: pointer, g_type: GType): Pointer = - result = private_g_type_check_class_cast(cast[PGTypeClass](g_class), g_type) - -proc G_TYPE_CHECK_CLASS_TYPE*(g_class: pointer, g_type: GType): bool = - result = private_g_type_check_class_is_a(cast[PGTypeClass](g_class), g_type) - -proc G_TYPE_CHECK_VALUE*(value: Pointer): bool = - result = private_g_type_check_value(cast[PGValue](Value)) - -proc G_TYPE_CHECK_VALUE_TYPE*(value: pointer, g_type: GType): bool = - result = private_g_type_check_value_holds(cast[PGValue](value), g_type) - -proc G_TYPE_FROM_INSTANCE*(instance: Pointer): GType = - result = G_TYPE_FROM_CLASS((cast[PGTypeInstance](instance)).g_class) - -proc G_TYPE_FROM_CLASS*(g_class: Pointer): GType = - result = (cast[PGTypeClass](g_class)).g_type - -proc G_TYPE_FROM_INTERFACE*(g_iface: Pointer): GType = - result = (cast[PGTypeInterface](g_iface)).g_type - -proc G_TYPE_IS_VALUE*(theType: GType): bool = - result = private_g_type_check_is_value_type(theType) - -proc G_IS_VALUE*(value: Pointer): bool = - result = G_TYPE_CHECK_VALUE(value) - -proc G_VALUE_TYPE*(value: Pointer): GType = - result = (cast[PGValue](value)).g_type - -proc G_VALUE_TYPE_NAME*(value: Pointer): cstring = - result = g_type_name(G_VALUE_TYPE(value)) - -proc G_VALUE_HOLDS*(value: pointer, g_type: GType): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, g_type) - -proc G_TYPE_IS_PARAM*(theType: GType): bool = - result = (G_TYPE_FUNDAMENTAL(theType)) == G_TYPE_PARAM - -proc G_PARAM_SPEC*(pspec: Pointer): PGParamSpec = - result = cast[PGParamSpec](G_TYPE_CHECK_INSTANCE_CAST(pspec, G_TYPE_PARAM)) - -proc G_IS_PARAM_SPEC*(pspec: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(pspec, G_TYPE_PARAM) - -proc G_PARAM_SPEC_CLASS*(pclass: Pointer): PGParamSpecClass = - result = cast[PGParamSpecClass](G_TYPE_CHECK_CLASS_CAST(pclass, G_TYPE_PARAM)) - -proc G_IS_PARAM_SPEC_CLASS*(pclass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(pclass, G_TYPE_PARAM) - -proc G_PARAM_SPEC_GET_CLASS*(pspec: Pointer): PGParamSpecClass = - result = cast[PGParamSpecClass](G_TYPE_INSTANCE_GET_CLASS(pspec, G_TYPE_PARAM)) - -proc G_PARAM_SPEC_TYPE*(pspec: Pointer): GType = - result = G_TYPE_FROM_INSTANCE(pspec) - -proc G_PARAM_SPEC_TYPE_NAME*(pspec: Pointer): cstring = - result = g_type_name(G_PARAM_SPEC_TYPE(pspec)) - -proc G_PARAM_SPEC_VALUE_TYPE*(pspec: Pointer): GType = - result = (G_PARAM_SPEC(pspec)).value_type - -proc G_VALUE_HOLDS_PARAM*(value: Pointer): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_PARAM) - -proc G_CLOSURE_NEEDS_MARSHAL*(closure: Pointer): bool = - result = cast[PGClosure](closure).marshal == nil - -proc N_NOTIFIERS*(cl: PGClosure): int32 = - result = ((meta_marshal(cl) + ((n_guards(cl)) shl 1'i32)) + - (n_fnotifiers(cl))) + (n_inotifiers(cl)) - -proc CCLOSURE_SWAP_DATA*(cclosure: PGClosure): int32 = - result = derivative_flag(cclosure) - -proc G_CALLBACK*(f: pointer): TGCallback = - result = cast[TGCallback](f) - -proc ref_count*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_ref_count) shr bp_TGClosure_ref_count - -proc set_ref_count*(a: PGClosure, `ref_count`: guint) = - a.flag0 = a.flag0 or - ((`ref_count` shl bp_TGClosure_ref_count) and bm_TGClosure_ref_count) - -proc meta_marshal*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_meta_marshal) shr - bp_TGClosure_meta_marshal - -proc set_meta_marshal*(a: PGClosure, `meta_marshal`: guint) = - a.flag0 = a.flag0 or - ((`meta_marshal` shl bp_TGClosure_meta_marshal) and - bm_TGClosure_meta_marshal) - -proc n_guards*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_n_guards) shr bp_TGClosure_n_guards - -proc set_n_guards*(a: PGClosure, `n_guards`: guint) = - a.flag0 = a.flag0 or - ((`n_guards` shl bp_TGClosure_n_guards) and bm_TGClosure_n_guards) - -proc n_fnotifiers*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_n_fnotifiers) shr - bp_TGClosure_n_fnotifiers - -proc set_n_fnotifiers*(a: PGClosure, `n_fnotifiers`: guint) = - a.flag0 = a.flag0 or - ((`n_fnotifiers` shl bp_TGClosure_n_fnotifiers) and - bm_TGClosure_n_fnotifiers) - -proc n_inotifiers*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_n_inotifiers) shr - bp_TGClosure_n_inotifiers - -proc set_n_inotifiers*(a: PGClosure, `n_inotifiers`: guint) = - a.flag0 = a.flag0 or - ((`n_inotifiers` shl bp_TGClosure_n_inotifiers) and - bm_TGClosure_n_inotifiers) - -proc in_inotify*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_in_inotify) shr bp_TGClosure_in_inotify - -proc set_in_inotify*(a: PGClosure, `in_inotify`: guint) = - a.flag0 = a.flag0 or - ((`in_inotify` shl bp_TGClosure_in_inotify) and bm_TGClosure_in_inotify) - -proc floating*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_floating) shr bp_TGClosure_floating - -proc set_floating*(a: PGClosure, `floating`: guint) = - a.flag0 = a.flag0 or - ((`floating` shl bp_TGClosure_floating) and bm_TGClosure_floating) - -proc derivative_flag*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_derivative_flag) shr - bp_TGClosure_derivative_flag - -proc set_derivative_flag*(a: PGClosure, `derivative_flag`: guint) = - a.flag0 = a.flag0 or - ((`derivative_flag` shl bp_TGClosure_derivative_flag) and - bm_TGClosure_derivative_flag) - -proc in_marshal*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_in_marshal) shr bp_TGClosure_in_marshal - -proc set_in_marshal*(a: PGClosure, in_marshal: guint) = - a.flag0 = a.flag0 or - ((in_marshal shl bp_TGClosure_in_marshal) and bm_TGClosure_in_marshal) - -proc is_invalid*(a: PGClosure): guint = - result = (a.flag0 and bm_TGClosure_is_invalid) shr bp_TGClosure_is_invalid - -proc set_is_invalid*(a: PGClosure, is_invalid: guint) = - a.flag0 = a.flag0 or - ((is_invalid shl bp_TGClosure_is_invalid) and bm_TGClosure_is_invalid) - -proc g_signal_connect*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer): gulong = - result = g_signal_connect_data(instance, detailed_signal, c_handler, data, - nil, TGConnectFlags(0)) - -proc g_signal_connect_after*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer): gulong = - result = g_signal_connect_data(instance, detailed_signal, c_handler, data, - nil, G_CONNECT_AFTER) - -proc g_signal_connect_swapped*(instance: gpointer, detailed_signal: cstring, - c_handler: TGCallback, data: gpointer): gulong = - result = g_signal_connect_data(instance, detailed_signal, c_handler, data, - nil, G_CONNECT_SWAPPED) - -proc g_signal_handlers_disconnect_by_func*(instance: gpointer, - func, data: gpointer): guint = - result = g_signal_handlers_disconnect_matched(instance, - TGSignalMatchType(G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA), 0, 0, nil, - func, data) - -proc g_signal_handlers_block_by_func*(instance: gpointer, func, data: gpointer) = - discard g_signal_handlers_block_matched(instance, - TGSignalMatchType(G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA), 0, 0, nil, - func, data) - -proc g_signal_handlers_unblock_by_func*(instance: gpointer, func, data: gpointer) = - discard g_signal_handlers_unblock_matched(instance, - TGSignalMatchType(G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA), 0, 0, nil, - func, data) - -proc G_TYPE_IS_OBJECT*(theType: GType): bool = - result = (G_TYPE_FUNDAMENTAL(theType)) == G_TYPE_OBJECT - -proc G_OBJECT*(anObject: pointer): PGObject = - result = cast[PGObject](G_TYPE_CHECK_INSTANCE_CAST(anObject, G_TYPE_OBJECT)) - -proc G_OBJECT_CLASS*(class: Pointer): PGObjectClass = - result = cast[PGObjectClass](G_TYPE_CHECK_CLASS_CAST(class, G_TYPE_OBJECT)) - -proc G_IS_OBJECT*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, G_TYPE_OBJECT) - -proc G_IS_OBJECT_CLASS*(class: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(class, G_TYPE_OBJECT) - -proc G_OBJECT_GET_CLASS*(anObject: pointer): PGObjectClass = - result = cast[PGObjectClass](G_TYPE_INSTANCE_GET_CLASS(anObject, G_TYPE_OBJECT)) - -proc G_OBJECT_TYPE*(anObject: pointer): GType = - result = G_TYPE_FROM_INSTANCE(anObject) - -proc G_OBJECT_TYPE_NAME*(anObject: pointer): cstring = - result = g_type_name(G_OBJECT_TYPE(anObject)) - -proc G_OBJECT_CLASS_TYPE*(class: Pointer): GType = - result = G_TYPE_FROM_CLASS(class) - -proc G_OBJECT_CLASS_NAME*(class: Pointer): cstring = - result = g_type_name(G_OBJECT_CLASS_TYPE(class)) - -proc G_VALUE_HOLDS_OBJECT*(value: Pointer): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_OBJECT) - -proc G_OBJECT_WARN_INVALID_PROPERTY_ID*(anObject: gpointer, property_id: gint, - pspec: gpointer) = - G_OBJECT_WARN_INVALID_PSPEC(anObject, "property", property_id, pspec) - -proc G_OBJECT_WARN_INVALID_PSPEC*(anObject: gpointer, pname: cstring, - property_id: gint, pspec: gpointer) = - var - theObject: PGObject - pspec2: PGParamSpec - property_id: guint - theObject = cast[PGObject](anObject) - pspec2 = cast[PGParamSpec](pspec) - property_id = (property_id) - write(stdout, "invalid thingy\x0A") - #g_warning("%s: invalid %s id %u for \"%s\" of type `%s\' in `%s\'", "", pname, - # `property_id`, `pspec` . name, - # g_type_name(G_PARAM_SPEC_TYPE(`pspec`)), - # G_OBJECT_TYPE_NAME(theobject)) - -proc G_TYPE_TYPE_PLUGIN*(): GType = - result = g_type_plugin_get_type() - -proc G_TYPE_PLUGIN*(inst: Pointer): PGTypePlugin = - result = PGTypePlugin(G_TYPE_CHECK_INSTANCE_CAST(inst, G_TYPE_TYPE_PLUGIN())) - -proc G_TYPE_PLUGIN_CLASS*(vtable: Pointer): PGTypePluginClass = - result = cast[PGTypePluginClass](G_TYPE_CHECK_CLASS_CAST(vtable, - G_TYPE_TYPE_PLUGIN())) - -proc G_IS_TYPE_PLUGIN*(inst: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(inst, G_TYPE_TYPE_PLUGIN()) - -proc G_IS_TYPE_PLUGIN_CLASS*(vtable: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(vtable, G_TYPE_TYPE_PLUGIN()) - -proc G_TYPE_PLUGIN_GET_CLASS*(inst: Pointer): PGTypePluginClass = - result = cast[PGTypePluginClass](G_TYPE_INSTANCE_GET_INTERFACE(inst, - G_TYPE_TYPE_PLUGIN())) - -proc G_TYPE_IS_ENUM*(theType: GType): gboolean = - result = (G_TYPE_FUNDAMENTAL(theType) == G_TYPE_ENUM) - -proc G_ENUM_CLASS*(class: pointer): PGEnumClass = - result = cast[PGEnumClass](G_TYPE_CHECK_CLASS_CAST(class, G_TYPE_ENUM)) - -proc G_IS_ENUM_CLASS*(class: pointer): gboolean = - result = G_TYPE_CHECK_CLASS_TYPE(class, G_TYPE_ENUM) - -proc G_ENUM_CLASS_TYPE*(class: pointer): GType = - result = G_TYPE_FROM_CLASS(class) - -proc G_ENUM_CLASS_TYPE_NAME*(class: pointer): cstring = - result = g_type_name(G_ENUM_CLASS_TYPE(class)) - -proc G_TYPE_IS_FLAGS*(theType: GType): gboolean = - result = (G_TYPE_FUNDAMENTAL(theType)) == G_TYPE_FLAGS - -proc G_FLAGS_CLASS*(class: pointer): PGFlagsClass = - result = cast[PGFlagsClass](G_TYPE_CHECK_CLASS_CAST(class, G_TYPE_FLAGS)) - -proc G_IS_FLAGS_CLASS*(class: pointer): gboolean = - result = G_TYPE_CHECK_CLASS_TYPE(class, G_TYPE_FLAGS) - -proc G_FLAGS_CLASS_TYPE*(class: pointer): GType = - result = G_TYPE_FROM_CLASS(class) - -proc G_FLAGS_CLASS_TYPE_NAME*(class: pointer): cstring = - result = g_type_name(G_FLAGS_TYPE(cast[TAddress](class))) - -proc G_VALUE_HOLDS_ENUM*(value: pointer): gboolean = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_ENUM) - -proc G_VALUE_HOLDS_FLAGS*(value: pointer): gboolean = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_FLAGS) - -proc CLAMP*(x, MinX, MaxX: int): int = - if x < MinX: - result = MinX - elif x > MaxX: - result = MaxX - else: - result = x - -proc GPOINTER_TO_SIZE*(p: GPointer): GSize = - result = GSize(cast[TAddress](p)) - -proc GSIZE_TO_POINTER*(s: GSize): GPointer = - result = cast[GPointer](s) - -proc HOLDS_CHAR*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_CHAR) - -proc HOLDS_UCHAR*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_UCHAR) - -proc HOLDS_BOOLEAN*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_BOOLEAN) - -proc HOLDS_INT*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_INT) - -proc HOLDS_UINT*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_UINT) - -proc HOLDS_LONG*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_LONG) - -proc HOLDS_ULONG*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_ULONG) - -proc HOLDS_INT64*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_INT64) - -proc HOLDS_UINT64*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_UINT64) - -proc HOLDS_FLOAT*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_FLOAT) - -proc HOLDS_DOUBLE*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_DOUBLE) - -proc HOLDS_STRING*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_STRING) - -proc HOLDS_POINTER*(value: PGValue): bool = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_POINTER) - -proc G_TYPE_IS_BOXED*(theType: GType): gboolean = - result = (G_TYPE_FUNDAMENTAL(theType)) == G_TYPE_BOXED - -proc HOLDS_BOXED*(value: PGValue): gboolean = - result = G_TYPE_CHECK_VALUE_TYPE(value, G_TYPE_BOXED) - -proc G_TYPE_CLOSURE*(): GType = - result = g_closure_get_type() - -proc G_TYPE_VALUE*(): GType = - result = g_value_get_type() - -proc G_TYPE_VALUE_ARRAY*(): GType = - result = g_value_array_get_type() - -proc G_TYPE_GSTRING*(): GType = - result = g_gstring_get_type() - -proc g_thread_init*(vtable: pointer) {. - cdecl, dynlib: gobjectlib, importc: "g_thread_init".} - -proc g_timeout_add*(interval: guint, function, data: gpointer): guint {. - cdecl, dynlib: gliblib, importc: "g_timeout_add".} - -proc g_timeout_add_full*(priority: guint, interval: guint, function, - data, notify: gpointer): guint {.cdecl, dynlib: gliblib, - importc: "g_timeout_add_full".} - -proc g_idle_add*(function, data: gpointer): guint {. - cdecl, dynlib: gliblib, importc: "g_idle_add".} - -proc g_idle_add_full*(priority: guint, function, - data, notify: gpointer): guint {.cdecl, dynlib: gliblib, - importc: "g_idle_add_full".} - -proc g_source_remove*(tag: guint): gboolean {. - cdecl, dynlib: gliblib, importc: "g_source_remove".} - -proc g_signal_emit_by_name*(instance: gpointer, detailed_signal: cstring) {. - cdecl, varargs, dynlib: gobjectlib, importc.} diff --git a/lib/wrappers/gtk/gtk2.nim b/lib/wrappers/gtk/gtk2.nim deleted file mode 100644 index 63e69130a..000000000 --- a/lib/wrappers/gtk/gtk2.nim +++ /dev/null @@ -1,17064 +0,0 @@ -{.deadCodeElim: on.} -import - glib2, atk, pango, gdk2pixbuf, gdk2 - -export gbool, toBool - -when defined(win32): - const - lib = "libgtk-win32-2.0-0.dll" -elif defined(macosx): - const - lib = "libgtk-x11-2.0.dylib" - # linklib gtk-x11-2.0 - # linklib gdk-x11-2.0 - # linklib pango-1.0.0 - # linklib glib-2.0.0 - # linklib gobject-2.0.0 - # linklib gdk_pixbuf-2.0.0 - # linklib atk-1.0.0 -else: - const - lib = "libgtk-x11-2.0.so(|.0)" - -const - MAX_COMPOSE_LEN* = 7 - -type - PObject* = ptr TObject - PPGtkObject* = ptr PObject - PArg* = ptr TArg - PType* = ptr TType - TType* = GType - PWidget* = ptr TWidget - PMisc* = ptr TMisc - PLabel* = ptr TLabel - PMenu* = ptr TMenu - PAnchorType* = ptr TAnchorType - TAnchorType* = int32 - PArrowType* = ptr TArrowType - TArrowType* = int32 - PAttachOptions* = ptr TAttachOptions - TAttachOptions* = int32 - PButtonBoxStyle* = ptr TButtonBoxStyle - TButtonBoxStyle* = int32 - PCurveType* = ptr TCurveType - TCurveType* = int32 - PDeleteType* = ptr TDeleteType - TDeleteType* = int32 - PDirectionType* = ptr TDirectionType - TDirectionType* = int32 - PExpanderStyle* = ptr TExpanderStyle - TExpanderStyle* = int32 - PPGtkIconSize* = ptr PIconSize - PIconSize* = ptr TIconSize - TIconSize* = int32 - PTextDirection* = ptr TTextDirection - TTextDirection* = int32 - PJustification* = ptr TJustification - TJustification* = int32 - PMenuDirectionType* = ptr TMenuDirectionType - TMenuDirectionType* = int32 - PMetricType* = ptr TMetricType - TMetricType* = int32 - PMovementStep* = ptr TMovementStep - TMovementStep* = int32 - POrientation* = ptr TOrientation - TOrientation* = int32 - PCornerType* = ptr TCornerType - TCornerType* = int32 - PPackType* = ptr TPackType - TPackType* = int32 - PPathPriorityType* = ptr TPathPriorityType - TPathPriorityType* = int32 - PPathType* = ptr TPathType - TPathType* = int32 - PPolicyType* = ptr TPolicyType - TPolicyType* = int32 - PPositionType* = ptr TPositionType - TPositionType* = int32 - PReliefStyle* = ptr TReliefStyle - TReliefStyle* = int32 - PResizeMode* = ptr TResizeMode - TResizeMode* = int32 - PScrollType* = ptr TScrollType - TScrollType* = int32 - PSelectionMode* = ptr TSelectionMode - TSelectionMode* = int32 - PShadowType* = ptr TShadowType - TShadowType* = int32 - PStateType* = ptr TStateType - TStateType* = int32 - PSubmenuDirection* = ptr TSubmenuDirection - TSubmenuDirection* = int32 - PSubmenuPlacement* = ptr TSubmenuPlacement - TSubmenuPlacement* = int32 - PToolbarStyle* = ptr TToolbarStyle - TToolbarStyle* = int32 - PUpdateType* = ptr TUpdateType - TUpdateType* = int32 - PVisibility* = ptr TVisibility - TVisibility* = int32 - PWindowPosition* = ptr TWindowPosition - TWindowPosition* = int32 - PWindowType* = ptr TWindowType - TWindowType* = int32 - PWrapMode* = ptr TWrapMode - TWrapMode* = int32 - PSortType* = ptr TSortType - TSortType* = int32 - PStyle* = ptr TStyle - PPGtkTreeModel* = ptr PTreeModel - PTreeModel* = pointer - PTreePath* = pointer - PTreeIter* = ptr TTreeIter - PSelectionData* = ptr TSelectionData - PTextTagTable* = ptr TTextTagTable - PTextBTreeNode* = pointer - PTextBTree* = pointer - PTextLine* = ptr TTextLine - PTreeViewColumn* = ptr TTreeViewColumn - PTreeView* = ptr TTreeView - TTreeViewColumnDropFunc* = proc (tree_view: PTreeView, - column: PTreeViewColumn, - prev_column: PTreeViewColumn, - next_column: PTreeViewColumn, data: gpointer): gboolean{. - cdecl.} - TTreeViewMappingFunc* = proc (tree_view: PTreeView, path: PTreePath, - user_data: gpointer){.cdecl.} - TTreeViewSearchEqualFunc* = proc (model: PTreeModel, column: gint, - key: cstring, iter: PTreeIter, - search_data: gpointer): gboolean{.cdecl.} - TTreeDestroyCountFunc* = proc (tree_view: PTreeView, path: PTreePath, - children: gint, user_data: gpointer){.cdecl.} - PTreeViewDropPosition* = ptr TTreeViewDropPosition - TTreeViewDropPosition* = enum - TREE_VIEW_DROP_BEFORE, TREE_VIEW_DROP_AFTER, TREE_VIEW_DROP_INTO_OR_BEFORE, - TREE_VIEW_DROP_INTO_OR_AFTER - PObjectFlags* = ptr TObjectFlags - TObjectFlags* = int32 - TObject* = object of TGObject - flags*: guint32 - - PObjectClass* = ptr TObjectClass - TObjectClass* = object of TGObjectClass - set_arg*: proc (anObject: PObject, arg: PArg, arg_id: guint){.cdecl.} - get_arg*: proc (anObject: PObject, arg: PArg, arg_id: guint){.cdecl.} - destroy*: proc (anObject: PObject){.cdecl.} - - PFundamentalType* = ptr TFundamentalType - TFundamentalType* = GType - TFunction* = proc (data: gpointer): gboolean{.cdecl.} - TDestroyNotify* = proc (data: gpointer){.cdecl.} - TCallbackMarshal* = proc (anObject: PObject, data: gpointer, n_args: guint, - args: PArg){.cdecl.} - TSignalFunc* = proc (para1: pointer){.cdecl.} - PSignalMarshaller* = ptr TSignalMarshaller - TSignalMarshaller* = TGSignalCMarshaller - TArgSignalData*{.final, pure.} = object - f*: TSignalFunc - d*: gpointer - - TArg*{.final, pure.} = object - `type`*: TType - name*: cstring - d*: gdouble # was a union type - - PTypeInfo* = ptr TTypeInfo - TTypeInfo*{.final, pure.} = object - type_name*: cstring - object_size*: guint - class_size*: guint - class_init_func*: pointer #TGtkClassInitFunc - object_init_func*: pointer #TGtkObjectInitFunc - reserved_1*: gpointer - reserved_2*: gpointer - base_class_init_func*: pointer #TGtkClassInitFunc - - PEnumValue* = ptr TEnumValue - TEnumValue* = TGEnumValue - PFlagValue* = ptr TFlagValue - TFlagValue* = TGFlagsValue - PWidgetFlags* = ptr TWidgetFlags - TWidgetFlags* = int32 - PWidgetHelpType* = ptr TWidgetHelpType - TWidgetHelpType* = enum - WIDGET_HELP_TOOLTIP, WIDGET_HELP_WHATS_THIS - PAllocation* = ptr TAllocation - TAllocation* = Gdk2.TRectangle - TCallback* = proc (widget: PWidget, data: gpointer){.cdecl.} - PRequisition* = ptr TRequisition - TRequisition*{.final, pure.} = object - width*: gint - height*: gint - - TWidget* = object of TObject - private_flags*: guint16 - state*: guint8 - saved_state*: guint8 - name*: cstring - style*: PStyle - requisition*: TRequisition - allocation*: TAllocation - window*: Gdk2.PWindow - parent*: PWidget - - PWidgetClass* = ptr TWidgetClass - TWidgetClass* = object of TObjectClass - activate_signal*: guint - set_scroll_adjustments_signal*: guint - dispatch_child_properties_changed*: proc (widget: PWidget, n_pspecs: guint, - pspecs: PPGParamSpec){.cdecl.} - show*: proc (widget: PWidget){.cdecl.} - show_all*: proc (widget: PWidget){.cdecl.} - hide*: proc (widget: PWidget){.cdecl.} - hide_all*: proc (widget: PWidget){.cdecl.} - map*: proc (widget: PWidget){.cdecl.} - unmap*: proc (widget: PWidget){.cdecl.} - realize*: proc (widget: PWidget){.cdecl.} - unrealize*: proc (widget: PWidget){.cdecl.} - size_request*: proc (widget: PWidget, requisition: PRequisition){.cdecl.} - size_allocate*: proc (widget: PWidget, allocation: PAllocation){.cdecl.} - state_changed*: proc (widget: PWidget, previous_state: TStateType){.cdecl.} - parent_set*: proc (widget: PWidget, previous_parent: PWidget){.cdecl.} - hierarchy_changed*: proc (widget: PWidget, previous_toplevel: PWidget){. - cdecl.} - style_set*: proc (widget: PWidget, previous_style: PStyle){.cdecl.} - direction_changed*: proc (widget: PWidget, - previous_direction: TTextDirection){.cdecl.} - grab_notify*: proc (widget: PWidget, was_grabbed: gboolean){.cdecl.} - child_notify*: proc (widget: PWidget, pspec: PGParamSpec){.cdecl.} - mnemonic_activate*: proc (widget: PWidget, group_cycling: gboolean): gboolean{. - cdecl.} - grab_focus*: proc (widget: PWidget){.cdecl.} - focus*: proc (widget: PWidget, direction: TDirectionType): gboolean{.cdecl.} - event*: proc (widget: PWidget, event: Gdk2.PEvent): gboolean{.cdecl.} - button_press_event*: proc (widget: PWidget, event: PEventButton): gboolean{. - cdecl.} - button_release_event*: proc (widget: PWidget, event: PEventButton): gboolean{. - cdecl.} - scroll_event*: proc (widget: PWidget, event: PEventScroll): gboolean{. - cdecl.} - motion_notify_event*: proc (widget: PWidget, event: PEventMotion): gboolean{. - cdecl.} - delete_event*: proc (widget: PWidget, event: PEventAny): gboolean{.cdecl.} - destroy_event*: proc (widget: PWidget, event: PEventAny): gboolean{.cdecl.} - expose_event*: proc (widget: PWidget, event: PEventExpose): gboolean{. - cdecl.} - key_press_event*: proc (widget: PWidget, event: PEventKey): gboolean{. - cdecl.} - key_release_event*: proc (widget: PWidget, event: PEventKey): gboolean{. - cdecl.} - enter_notify_event*: proc (widget: PWidget, event: PEventCrossing): gboolean{. - cdecl.} - leave_notify_event*: proc (widget: PWidget, event: PEventCrossing): gboolean{. - cdecl.} - configure_event*: proc (widget: PWidget, event: PEventConfigure): gboolean{. - cdecl.} - focus_in_event*: proc (widget: PWidget, event: PEventFocus): gboolean{. - cdecl.} - focus_out_event*: proc (widget: PWidget, event: PEventFocus): gboolean{. - cdecl.} - map_event*: proc (widget: PWidget, event: PEventAny): gboolean{.cdecl.} - unmap_event*: proc (widget: PWidget, event: PEventAny): gboolean{.cdecl.} - property_notify_event*: proc (widget: PWidget, event: PEventProperty): gboolean{. - cdecl.} - selection_clear_event*: proc (widget: PWidget, event: PEventSelection): gboolean{. - cdecl.} - selection_request_event*: proc (widget: PWidget, event: PEventSelection): gboolean{. - cdecl.} - selection_notify_event*: proc (widget: PWidget, event: PEventSelection): gboolean{. - cdecl.} - proximity_in_event*: proc (widget: PWidget, event: PEventProximity): gboolean{. - cdecl.} - proximity_out_event*: proc (widget: PWidget, event: PEventProximity): gboolean{. - cdecl.} - visibility_notify_event*: proc (widget: PWidget, event: PEventVisibility): gboolean{. - cdecl.} - client_event*: proc (widget: PWidget, event: PEventClient): gboolean{. - cdecl.} - no_expose_event*: proc (widget: PWidget, event: PEventAny): gboolean{. - cdecl.} - window_state_event*: proc (widget: PWidget, event: PEventWindowState): gboolean{. - cdecl.} - selection_get*: proc (widget: PWidget, selection_data: PSelectionData, - info: guint, time: guint){.cdecl.} - selection_received*: proc (widget: PWidget, selection_data: PSelectionData, - time: guint){.cdecl.} - drag_begin*: proc (widget: PWidget, context: PDragContext){.cdecl.} - drag_end*: proc (widget: PWidget, context: PDragContext){.cdecl.} - drag_data_get*: proc (widget: PWidget, context: PDragContext, - selection_data: PSelectionData, info: guint, - time: guint){.cdecl.} - drag_data_delete*: proc (widget: PWidget, context: PDragContext){.cdecl.} - drag_leave*: proc (widget: PWidget, context: PDragContext, time: guint){. - cdecl.} - drag_motion*: proc (widget: PWidget, context: PDragContext, x: gint, - y: gint, time: guint): gboolean{.cdecl.} - drag_drop*: proc (widget: PWidget, context: PDragContext, x: gint, - y: gint, time: guint): gboolean{.cdecl.} - drag_data_received*: proc (widget: PWidget, context: PDragContext, - x: gint, y: gint, selection_data: PSelectionData, - info: guint, time: guint){.cdecl.} - popup_menu*: proc (widget: PWidget): gboolean{.cdecl.} - show_help*: proc (widget: PWidget, help_type: TWidgetHelpType): gboolean{. - cdecl.} - get_accessible*: proc (widget: PWidget): atk.PObject{.cdecl.} - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - reserved5*: proc (){.cdecl.} - reserved6*: proc (){.cdecl.} - reserved7*: proc (){.cdecl.} - reserved8*: proc (){.cdecl.} - - PWidgetAuxInfo* = ptr TWidgetAuxInfo - TWidgetAuxInfo*{.final, pure.} = object - x*: gint - y*: gint - width*: gint - height*: gint - flag0*: guint16 - - PWidgetShapeInfo* = ptr TWidgetShapeInfo - TWidgetShapeInfo*{.final, pure.} = object - offset_x*: gint16 - offset_y*: gint16 - shape_mask*: gdk2.PBitmap - - TMisc* = object of TWidget - xalign*: gfloat - yalign*: gfloat - xpad*: guint16 - ypad*: guint16 - - PMiscClass* = ptr TMiscClass - TMiscClass* = object of TWidgetClass - PAccelFlags* = ptr TAccelFlags - TAccelFlags* = int32 - PAccelGroup* = ptr TAccelGroup - PAccelGroupEntry* = ptr TAccelGroupEntry - TAccelGroupActivate* = proc (accel_group: PAccelGroup, - acceleratable: PGObject, keyval: guint, - modifier: gdk2.TModifierType): gboolean{.cdecl.} - TAccelGroup* = object of TGObject - lock_count*: guint - modifier_mask*: gdk2.TModifierType - acceleratables*: PGSList - n_accels*: guint - priv_accels*: PAccelGroupEntry - - PAccelGroupClass* = ptr TAccelGroupClass - TAccelGroupClass* = object of TGObjectClass - accel_changed*: proc (accel_group: PAccelGroup, keyval: guint, - modifier: gdk2.TModifierType, accel_closure: PGClosure){. - cdecl.} - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - - PAccelKey* = ptr TAccelKey - TAccelKey*{.final, pure.} = object - accel_key*: guint - accel_mods*: gdk2.TModifierType - flag0*: guint16 - - TAccelGroupEntry*{.final, pure.} = object - key*: TAccelKey - closure*: PGClosure - accel_path_quark*: TGQuark - - Taccel_group_find_func* = proc (key: PAccelKey, closure: PGClosure, - data: gpointer): gboolean{.cdecl.} - PContainer* = ptr TContainer - TContainer* = object of TWidget - focus_child*: PWidget - Container_flag0*: int32 - - PContainerClass* = ptr TContainerClass - TContainerClass* = object of TWidgetClass - add*: proc (container: PContainer, widget: PWidget){.cdecl.} - remove*: proc (container: PContainer, widget: PWidget){.cdecl.} - check_resize*: proc (container: PContainer){.cdecl.} - forall*: proc (container: PContainer, include_internals: gboolean, - callback: TCallback, callback_data: gpointer){.cdecl.} - set_focus_child*: proc (container: PContainer, widget: PWidget){.cdecl.} - child_type*: proc (container: PContainer): TType{.cdecl.} - composite_name*: proc (container: PContainer, child: PWidget): cstring{. - cdecl.} - set_child_property*: proc (container: PContainer, child: PWidget, - property_id: guint, value: PGValue, - pspec: PGParamSpec){.cdecl.} - get_child_property*: proc (container: PContainer, child: PWidget, - property_id: guint, value: PGValue, - pspec: PGParamSpec){.cdecl.} - reserved20: proc (){.cdecl.} - reserved21: proc (){.cdecl.} - reserved23: proc (){.cdecl.} - reserved24: proc (){.cdecl.} - - PBin* = ptr TBin - TBin* = object of TContainer - child*: PWidget - - PBinClass* = ptr TBinClass - TBinClass* = object of TContainerClass - PWindowGeometryInfo* = pointer - PWindowGroup* = ptr TWindowGroup - PWindow* = ptr TWindow - TWindow* = object of TBin - title*: cstring - wmclass_name*: cstring - wmclass_class*: cstring - wm_role*: cstring - focus_widget*: PWidget - default_widget*: PWidget - transient_parent*: PWindow - geometry_info*: PWindowGeometryInfo - frame*: gdk2.PWindow - group*: PWindowGroup - configure_request_count*: guint16 - window_flag0*: int32 - frame_left*: guint - frame_top*: guint - frame_right*: guint - frame_bottom*: guint - keys_changed_handler*: guint - mnemonic_modifier*: gdk2.TModifierType - screen*: gdk2.PScreen - - PWindowClass* = ptr TWindowClass - TWindowClass* = object of TBinClass - set_focus*: proc (window: PWindow, focus: PWidget){.cdecl.} - frame_event*: proc (window: PWindow, event: gdk2.PEvent): gboolean{.cdecl.} - activate_focus*: proc (window: PWindow){.cdecl.} - activate_default*: proc (window: PWindow){.cdecl.} - move_focus*: proc (window: PWindow, direction: TDirectionType){.cdecl.} - keys_changed*: proc (window: PWindow){.cdecl.} - reserved30: proc (){.cdecl.} - reserved31: proc (){.cdecl.} - reserved32: proc (){.cdecl.} - reserved33: proc (){.cdecl.} - - TWindowGroup* = object of TGObject - grabs*: PGSList - - PWindowGroupClass* = ptr TWindowGroupClass - TWindowGroupClass* = object of TGObjectClass - reserved40: proc (){.cdecl.} - reserved41: proc (){.cdecl.} - reserved42: proc (){.cdecl.} - reserved43: proc (){.cdecl.} - - TWindowKeysForeachFunc* = proc (window: PWindow, keyval: guint, - modifiers: gdk2.TModifierType, - is_mnemonic: gboolean, data: gpointer){.cdecl.} - PLabelSelectionInfo* = pointer - TLabel* = object of TMisc - `label`*: cstring - Label_flag0*: guint16 - mnemonic_keyval*: guint - text*: cstring - attrs*: pango.PAttrList - effective_attrs*: pango.PAttrList - layout*: pango.PLayout - mnemonic_widget*: PWidget - mnemonic_window*: PWindow - select_info*: PLabelSelectionInfo - - PLabelClass* = ptr TLabelClass - TLabelClass* = object of TMiscClass - move_cursor*: proc (`label`: PLabel, step: TMovementStep, count: gint, - extend_selection: gboolean){.cdecl.} - copy_clipboard*: proc (`label`: PLabel){.cdecl.} - populate_popup*: proc (`label`: PLabel, menu: PMenu){.cdecl.} - reserved50: proc (){.cdecl.} - reserved51: proc (){.cdecl.} - reserved52: proc (){.cdecl.} - reserved53: proc (){.cdecl.} - - PAccelLabel* = ptr TAccelLabel - TAccelLabel* = object of TLabel - queue_id*: guint - accel_padding*: guint - accel_widget*: PWidget - accel_closure*: PGClosure - accel_group*: PAccelGroup - accel_string*: cstring - accel_string_width*: guint16 - - PAccelLabelClass* = ptr TAccelLabelClass - TAccelLabelClass* = object of TLabelClass - signal_quote1*: cstring - signal_quote2*: cstring - mod_name_shift*: cstring - mod_name_control*: cstring - mod_name_alt*: cstring - mod_separator*: cstring - accel_seperator*: cstring - AccelLabelClass_flag0*: guint16 - reserved61: proc (){.cdecl.} - reserved62: proc (){.cdecl.} - reserved63: proc (){.cdecl.} - reserved64: proc (){.cdecl.} - - TAccelMapForeach* = proc (data: gpointer, accel_path: cstring, - accel_key: guint, accel_mods: gdk2.TModifierType, - changed: gboolean){.cdecl.} - PAccessible* = ptr TAccessible - TAccessible* = object of atk.TObject - widget*: PWidget - - PAccessibleClass* = ptr TAccessibleClass - TAccessibleClass* = object of atk.TObjectClass - connect_widget_destroyed*: proc (accessible: PAccessible){.cdecl.} - reserved71: proc (){.cdecl.} - reserved72: proc (){.cdecl.} - reserved73: proc (){.cdecl.} - reserved74: proc (){.cdecl.} - - PAdjustment* = ptr TAdjustment - TAdjustment* = object of TObject - lower*: gdouble - upper*: gdouble - value*: gdouble - step_increment*: gdouble - page_increment*: gdouble - page_size*: gdouble - - PAdjustmentClass* = ptr TAdjustmentClass - TAdjustmentClass* = object of TObjectClass - changed*: proc (adjustment: PAdjustment){.cdecl.} - value_changed*: proc (adjustment: PAdjustment){.cdecl.} - reserved81: proc (){.cdecl.} - reserved82: proc (){.cdecl.} - reserved83: proc (){.cdecl.} - reserved84: proc (){.cdecl.} - - PAlignment* = ptr TAlignment - TAlignment* = object of TBin - xalign*: gfloat - yalign*: gfloat - xscale*: gfloat - yscale*: gfloat - - PAlignmentClass* = ptr TAlignmentClass - TAlignmentClass* = object of TBinClass - PFrame* = ptr TFrame - TFrame* = object of TBin - label_widget*: PWidget - shadow_type*: gint16 - label_xalign*: gfloat - label_yalign*: gfloat - child_allocation*: TAllocation - - PFrameClass* = ptr TFrameClass - TFrameClass* = object of TBinClass - compute_child_allocation*: proc (frame: PFrame, allocation: PAllocation){. - cdecl.} - - PAspectFrame* = ptr TAspectFrame - TAspectFrame* = object of TFrame - xalign*: gfloat - yalign*: gfloat - ratio*: gfloat - obey_child*: gboolean - center_allocation*: TAllocation - - PAspectFrameClass* = ptr TAspectFrameClass - TAspectFrameClass* = object of TFrameClass - PArrow* = ptr TArrow - TArrow* = object of TMisc - arrow_type*: gint16 - shadow_type*: gint16 - - PArrowClass* = ptr TArrowClass - TArrowClass* = object of TMiscClass - PBindingEntry* = ptr TBindingEntry - PBindingSignal* = ptr TBindingSignal - PBindingArg* = ptr TBindingArg - PBindingSet* = ptr TBindingSet - TBindingSet*{.final, pure.} = object - set_name*: cstring - priority*: gint - widget_path_pspecs*: PGSList - widget_class_pspecs*: PGSList - class_branch_pspecs*: PGSList - entries*: PBindingEntry - current*: PBindingEntry - flag0*: guint16 - - TBindingEntry*{.final, pure.} = object - keyval*: guint - modifiers*: gdk2.TModifierType - binding_set*: PBindingSet - flag0*: guint16 - set_next*: PBindingEntry - hash_next*: PBindingEntry - signals*: PBindingSignal - - TBindingSignal*{.final, pure.} = object - next*: PBindingSignal - signal_name*: cstring - n_args*: guint - args*: PBindingArg - - TBindingArg*{.final, pure.} = object - arg_type*: TType - d*: gdouble - - PBox* = ptr TBox - TBox* = object of TContainer - children*: PGList - spacing*: gint16 - box_flag0*: guint16 - - PBoxClass* = ptr TBoxClass - TBoxClass* = object of TContainerClass - PBoxChild* = ptr TBoxChild - TBoxChild*{.final, pure.} = object - widget*: PWidget - padding*: guint16 - flag0*: guint16 - - PButtonBox* = ptr TButtonBox - TButtonBox* = object of TBox - child_min_width*: gint - child_min_height*: gint - child_ipad_x*: gint - child_ipad_y*: gint - layout_style*: TButtonBoxStyle - - PButtonBoxClass* = ptr TButtonBoxClass - TButtonBoxClass* = object of TBoxClass - PButton* = ptr TButton - TButton* = object of TBin - event_window*: gdk2.PWindow - label_text*: cstring - activate_timeout*: guint - button_flag0*: guint16 - - PButtonClass* = ptr TButtonClass - TButtonClass* = object of TBinClass - pressed*: proc (button: PButton){.cdecl.} - released*: proc (button: PButton){.cdecl.} - clicked*: proc (button: PButton){.cdecl.} - enter*: proc (button: PButton){.cdecl.} - leave*: proc (button: PButton){.cdecl.} - activate*: proc (button: PButton){.cdecl.} - reserved101: proc (){.cdecl.} - reserved102: proc (){.cdecl.} - reserved103: proc (){.cdecl.} - reserved104: proc (){.cdecl.} - - PCalendarDisplayOptions* = ptr TCalendarDisplayOptions - TCalendarDisplayOptions* = int32 - PCalendar* = ptr TCalendar - TCalendar* = object of TWidget - header_style*: PStyle - label_style*: PStyle - month*: gint - year*: gint - selected_day*: gint - day_month*: array[0..5, array[0..6, gint]] - day*: array[0..5, array[0..6, gint]] - num_marked_dates*: gint - marked_date*: array[0..30, gint] - display_flags*: TCalendarDisplayOptions - marked_date_color*: array[0..30, gdk2.TColor] - gc*: gdk2.PGC - xor_gc*: gdk2.PGC - focus_row*: gint - focus_col*: gint - highlight_row*: gint - highlight_col*: gint - private_data*: gpointer - grow_space*: array[0..31, gchar] - reserved111: proc (){.cdecl.} - reserved112: proc (){.cdecl.} - reserved113: proc (){.cdecl.} - reserved114: proc (){.cdecl.} - - PCalendarClass* = ptr TCalendarClass - TCalendarClass* = object of TWidgetClass - month_changed*: proc (calendar: PCalendar){.cdecl.} - day_selected*: proc (calendar: PCalendar){.cdecl.} - day_selected_double_click*: proc (calendar: PCalendar){.cdecl.} - prev_month*: proc (calendar: PCalendar){.cdecl.} - next_month*: proc (calendar: PCalendar){.cdecl.} - prev_year*: proc (calendar: PCalendar){.cdecl.} - next_year*: proc (calendar: PCalendar){.cdecl.} - - PCellEditable* = pointer - PCellEditableIface* = ptr TCellEditableIface - TCellEditableIface* = object of TGTypeInterface - editing_done*: proc (cell_editable: PCellEditable){.cdecl.} - remove_widget*: proc (cell_editable: PCellEditable){.cdecl.} - start_editing*: proc (cell_editable: PCellEditable, event: gdk2.PEvent){.cdecl.} - - PCellRendererState* = ptr TCellRendererState - TCellRendererState* = int32 - PCellRendererMode* = ptr TCellRendererMode - TCellRendererMode* = enum - CELL_RENDERER_MODE_INERT, CELL_RENDERER_MODE_ACTIVATABLE, - CELL_RENDERER_MODE_EDITABLE - PCellRenderer* = ptr TCellRenderer - TCellRenderer* = object of TObject - xalign*: gfloat - yalign*: gfloat - width*: gint - height*: gint - xpad*: guint16 - ypad*: guint16 - CellRenderer_flag0*: guint16 - - PCellRendererClass* = ptr TCellRendererClass - TCellRendererClass* = object of TObjectClass - get_size*: proc (cell: PCellRenderer, widget: PWidget, - cell_area: gdk2.PRectangle, x_offset: Pgint, y_offset: Pgint, - width: Pgint, height: Pgint){.cdecl.} - render*: proc (cell: PCellRenderer, window: gdk2.PWindow, widget: PWidget, - background_area: gdk2.PRectangle, cell_area: gdk2.PRectangle, - expose_area: gdk2.PRectangle, flags: TCellRendererState){.cdecl.} - activate*: proc (cell: PCellRenderer, event: gdk2.PEvent, widget: PWidget, - path: cstring, background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, flags: TCellRendererState): gboolean{. - cdecl.} - start_editing*: proc (cell: PCellRenderer, event: gdk2.PEvent, - widget: PWidget, path: cstring, - background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, flags: TCellRendererState): PCellEditable{. - cdecl.} - reserved121: proc (){.cdecl.} - reserved122: proc (){.cdecl.} - reserved123: proc (){.cdecl.} - reserved124: proc (){.cdecl.} - - PCellRendererText* = ptr TCellRendererText - TCellRendererText* = object of TCellRenderer - text*: cstring - font*: pango.PFontDescription - font_scale*: gdouble - foreground*: pango.TColor - background*: pango.TColor - extra_attrs*: pango.PAttrList - underline_style*: pango.TUnderline - rise*: gint - fixed_height_rows*: gint - CellRendererText_flag0*: guint16 - - PCellRendererTextClass* = ptr TCellRendererTextClass - TCellRendererTextClass* = object of TCellRendererClass - edited*: proc (cell_renderer_text: PCellRendererText, path: cstring, - new_text: cstring){.cdecl.} - reserved131: proc (){.cdecl.} - reserved132: proc (){.cdecl.} - reserved133: proc (){.cdecl.} - reserved134: proc (){.cdecl.} - - PCellRendererToggle* = ptr TCellRendererToggle - TCellRendererToggle* = object of TCellRenderer - CellRendererToggle_flag0*: guint16 - - PCellRendererToggleClass* = ptr TCellRendererToggleClass - TCellRendererToggleClass* = object of TCellRendererClass - toggled*: proc (cell_renderer_toggle: PCellRendererToggle, path: cstring){. - cdecl.} - reserved141: proc (){.cdecl.} - reserved142: proc (){.cdecl.} - reserved143: proc (){.cdecl.} - reserved144: proc (){.cdecl.} - - PCellRendererPixbuf* = ptr TCellRendererPixbuf - TCellRendererPixbuf* = object of TCellRenderer - pixbuf*: gdk2pixbuf.PPixbuf - pixbuf_expander_open*: gdk2pixbuf.PPixbuf - pixbuf_expander_closed*: gdk2pixbuf.PPixbuf - - PCellRendererPixbufClass* = ptr TCellRendererPixbufClass - TCellRendererPixbufClass* = object of TCellRendererClass - reserved151: proc (){.cdecl.} - reserved152: proc (){.cdecl.} - reserved153: proc (){.cdecl.} - reserved154: proc (){.cdecl.} - - PItem* = ptr TItem - TItem* = object of TBin - PItemClass* = ptr TItemClass - TItemClass* = object of TBinClass - select*: proc (item: PItem){.cdecl.} - deselect*: proc (item: PItem){.cdecl.} - toggle*: proc (item: PItem){.cdecl.} - reserved161: proc (){.cdecl.} - reserved162: proc (){.cdecl.} - reserved163: proc (){.cdecl.} - reserved164: proc (){.cdecl.} - - PMenuItem* = ptr TMenuItem - TMenuItem* = object of TItem - submenu*: PWidget - event_window*: gdk2.PWindow - toggle_size*: guint16 - accelerator_width*: guint16 - accel_path*: cstring - MenuItem_flag0*: guint16 - timer*: guint - - PMenuItemClass* = ptr TMenuItemClass - TMenuItemClass* = object of TItemClass - MenuItemClass_flag0*: guint16 - activate*: proc (menu_item: PMenuItem){.cdecl.} - activate_item*: proc (menu_item: PMenuItem){.cdecl.} - toggle_size_request*: proc (menu_item: PMenuItem, requisition: Pgint){.cdecl.} - toggle_size_allocate*: proc (menu_item: PMenuItem, allocation: gint){.cdecl.} - reserved171: proc (){.cdecl.} - reserved172: proc (){.cdecl.} - reserved173: proc (){.cdecl.} - reserved174: proc (){.cdecl.} - - PToggleButton* = ptr TToggleButton - TToggleButton* = object of TButton - ToggleButton_flag0*: guint16 - - PToggleButtonClass* = ptr TToggleButtonClass - TToggleButtonClass* = object of TButtonClass - toggled*: proc (toggle_button: PToggleButton){.cdecl.} - reserved171: proc (){.cdecl.} - reserved172: proc (){.cdecl.} - reserved173: proc (){.cdecl.} - reserved174: proc (){.cdecl.} - - PCheckButton* = ptr TCheckButton - TCheckButton* = object of TToggleButton - PCheckButtonClass* = ptr TCheckButtonClass - TCheckButtonClass* = object of TToggleButtonClass - draw_indicator*: proc (check_button: PCheckButton, area: gdk2.PRectangle){. - cdecl.} - reserved181: proc (){.cdecl.} - reserved182: proc (){.cdecl.} - reserved183: proc (){.cdecl.} - reserved184: proc (){.cdecl.} - - PCheckMenuItem* = ptr TCheckMenuItem - TCheckMenuItem* = object of TMenuItem - CheckMenuItem_flag0*: guint16 - - PCheckMenuItemClass* = ptr TCheckMenuItemClass - TCheckMenuItemClass* = object of TMenuItemClass - toggled*: proc (check_menu_item: PCheckMenuItem){.cdecl.} - draw_indicator*: proc (check_menu_item: PCheckMenuItem, area: gdk2.PRectangle){. - cdecl.} - reserved191: proc (){.cdecl.} - reserved192: proc (){.cdecl.} - reserved193: proc (){.cdecl.} - reserved194: proc (){.cdecl.} - - PClipboard* = pointer - TClipboardReceivedFunc* = proc (clipboard: PClipboard, - selection_data: PSelectionData, data: gpointer){. - cdecl.} - TClipboardTextReceivedFunc* = proc (clipboard: PClipboard, text: cstring, - data: gpointer){.cdecl.} - TClipboardGetFunc* = proc (clipboard: PClipboard, - selection_data: PSelectionData, info: guint, - user_data_or_owner: gpointer){.cdecl.} - TClipboardClearFunc* = proc (clipboard: PClipboard, - user_data_or_owner: gpointer){.cdecl.} - PCList* = ptr TCList - PCListColumn* = ptr TCListColumn - PCListRow* = ptr TCListRow - PCell* = ptr TCell - PCellType* = ptr TCellType - TCellType* = enum - CELL_EMPTY, CELL_TEXT, CELL_PIXMAP, CELL_PIXTEXT, CELL_WIDGET - PCListDragPos* = ptr TCListDragPos - TCListDragPos* = enum - CLIST_DRAG_NONE, CLIST_DRAG_BEFORE, CLIST_DRAG_INTO, CLIST_DRAG_AFTER - PButtonAction* = ptr TButtonAction - TButtonAction* = int32 - TCListCompareFunc* = proc (clist: PCList, ptr1: gconstpointer, - ptr2: gconstpointer): gint{.cdecl.} - PCListCellInfo* = ptr TCListCellInfo - TCListCellInfo*{.final, pure.} = object - row*: gint - column*: gint - - PCListDestInfo* = ptr TCListDestInfo - TCListDestInfo*{.final, pure.} = object - cell*: TCListCellInfo - insert_pos*: TCListDragPos - - TCList* = object of TContainer - CList_flags*: guint16 - row_mem_chunk*: PGMemChunk - cell_mem_chunk*: PGMemChunk - freeze_count*: guint - internal_allocation*: gdk2.TRectangle - rows*: gint - row_height*: gint - row_list*: PGList - row_list_end*: PGList - columns*: gint - column_title_area*: gdk2.TRectangle - title_window*: gdk2.PWindow - column*: PCListColumn - clist_window*: gdk2.PWindow - clist_window_width*: gint - clist_window_height*: gint - hoffset*: gint - voffset*: gint - shadow_type*: TShadowType - selection_mode*: TSelectionMode - selection*: PGList - selection_end*: PGList - undo_selection*: PGList - undo_unselection*: PGList - undo_anchor*: gint - button_actions*: array[0..4, guint8] - drag_button*: guint8 - click_cell*: TCListCellInfo - hadjustment*: PAdjustment - vadjustment*: PAdjustment - xor_gc*: gdk2.PGC - fg_gc*: gdk2.PGC - bg_gc*: gdk2.PGC - cursor_drag*: gdk2.PCursor - x_drag*: gint - focus_row*: gint - focus_header_column*: gint - anchor*: gint - anchor_state*: TStateType - drag_pos*: gint - htimer*: gint - vtimer*: gint - sort_type*: TSortType - compare*: TCListCompareFunc - sort_column*: gint - drag_highlight_row*: gint - drag_highlight_pos*: TCListDragPos - - PCListClass* = ptr TCListClass - TCListClass* = object of TContainerClass - set_scroll_adjustments*: proc (clist: PCList, hadjustment: PAdjustment, - vadjustment: PAdjustment){.cdecl.} - refresh*: proc (clist: PCList){.cdecl.} - select_row*: proc (clist: PCList, row: gint, column: gint, event: gdk2.PEvent){. - cdecl.} - unselect_row*: proc (clist: PCList, row: gint, column: gint, - event: gdk2.PEvent){.cdecl.} - row_move*: proc (clist: PCList, source_row: gint, dest_row: gint){.cdecl.} - click_column*: proc (clist: PCList, column: gint){.cdecl.} - resize_column*: proc (clist: PCList, column: gint, width: gint){.cdecl.} - toggle_focus_row*: proc (clist: PCList){.cdecl.} - select_all*: proc (clist: PCList){.cdecl.} - unselect_all*: proc (clist: PCList){.cdecl.} - undo_selection*: proc (clist: PCList){.cdecl.} - start_selection*: proc (clist: PCList){.cdecl.} - end_selection*: proc (clist: PCList){.cdecl.} - extend_selection*: proc (clist: PCList, scroll_type: TScrollType, - position: gfloat, auto_start_selection: gboolean){. - cdecl.} - scroll_horizontal*: proc (clist: PCList, scroll_type: TScrollType, - position: gfloat){.cdecl.} - scroll_vertical*: proc (clist: PCList, scroll_type: TScrollType, - position: gfloat){.cdecl.} - toggle_add_mode*: proc (clist: PCList){.cdecl.} - abort_column_resize*: proc (clist: PCList){.cdecl.} - resync_selection*: proc (clist: PCList, event: gdk2.PEvent){.cdecl.} - selection_find*: proc (clist: PCList, row_number: gint, - row_list_element: PGList): PGList{.cdecl.} - draw_row*: proc (clist: PCList, area: gdk2.PRectangle, row: gint, - clist_row: PCListRow){.cdecl.} - draw_drag_highlight*: proc (clist: PCList, target_row: PCListRow, - target_row_number: gint, drag_pos: TCListDragPos){. - cdecl.} - clear*: proc (clist: PCList){.cdecl.} - fake_unselect_all*: proc (clist: PCList, row: gint){.cdecl.} - sort_list*: proc (clist: PCList){.cdecl.} - insert_row*: proc (clist: PCList, row: gint): gint{.cdecl, varargs.} - remove_row*: proc (clist: PCList, row: gint){.cdecl.} - set_cell_contents*: proc (clist: PCList, clist_row: PCListRow, column: gint, - thetype: TCellType, text: cstring, - spacing: guint8, pixmap: gdk2.PPixmap, - mask: gdk2.PBitmap){.cdecl.} - cell_size_request*: proc (clist: PCList, clist_row: PCListRow, column: gint, - requisition: PRequisition){.cdecl.} - - PGPtrArray = pointer - PGArray = pointer - TCListColumn*{.final, pure.} = object - title*: cstring - area*: gdk2.TRectangle - button*: PWidget - window*: gdk2.PWindow - width*: gint - min_width*: gint - max_width*: gint - justification*: TJustification - flag0*: guint16 - - TCListRow*{.final, pure.} = object - cell*: PCell - state*: TStateType - foreground*: gdk2.TColor - background*: gdk2.TColor - style*: PStyle - data*: gpointer - destroy*: TDestroyNotify - flag0*: guint16 - - PCellText* = ptr TCellText - TCellText*{.final, pure.} = object - `type`*: TCellType - vertical*: gint16 - horizontal*: gint16 - style*: PStyle - text*: cstring - - PCellPixmap* = ptr TCellPixmap - TCellPixmap*{.final, pure.} = object - `type`*: TCellType - vertical*: gint16 - horizontal*: gint16 - style*: PStyle - pixmap*: gdk2.PPixmap - mask*: gdk2.PBitmap - - PCellPixText* = ptr TCellPixText - TCellPixText*{.final, pure.} = object - `type`*: TCellType - vertical*: gint16 - horizontal*: gint16 - style*: PStyle - text*: cstring - spacing*: guint8 - pixmap*: gdk2.PPixmap - mask*: gdk2.PBitmap - - PCellWidget* = ptr TCellWidget - TCellWidget*{.final, pure.} = object - `type`*: TCellType - vertical*: gint16 - horizontal*: gint16 - style*: PStyle - widget*: PWidget - - TCell*{.final, pure.} = object - `type`*: TCellType - vertical*: gint16 - horizontal*: gint16 - style*: PStyle - text*: cstring - spacing*: guint8 - pixmap*: gdk2.PPixmap - mask*: gdk2.PBitmap - - PDialogFlags* = ptr TDialogFlags - TDialogFlags* = int32 - PResponseType* = ptr TResponseType - TResponseType* = int32 - PDialog* = ptr TDialog - TDialog* = object of TWindow - vbox*: PBox - action_area*: PWidget - separator*: PWidget - - PDialogClass* = ptr TDialogClass - TDialogClass* = object of TWindowClass - response*: proc (dialog: PDialog, response_id: gint){.cdecl.} - closeFile*: proc (dialog: PDialog){.cdecl.} - reserved201: proc (){.cdecl.} - reserved202: proc (){.cdecl.} - reserved203: proc (){.cdecl.} - reserved204: proc (){.cdecl.} - - PVBox* = ptr TVBox - TVBox* = object of TBox - PVBoxClass* = ptr TVBoxClass - TVBoxClass* = object of TBoxClass - TColorSelectionChangePaletteFunc* = proc (colors: gdk2.PColor, n_colors: gint){. - cdecl.} - TColorSelectionChangePaletteWithScreenFunc* = proc (screen: gdk2.PScreen, - colors: gdk2.PColor, n_colors: gint){.cdecl.} - PColorSelection* = ptr TColorSelection - TColorSelection* = object of TVBox - private_data*: gpointer - - PColorSelectionClass* = ptr TColorSelectionClass - TColorSelectionClass* = object of TVBoxClass - color_changed*: proc (color_selection: PColorSelection){.cdecl.} - reserved211: proc (){.cdecl.} - reserved212: proc (){.cdecl.} - reserved213: proc (){.cdecl.} - reserved214: proc (){.cdecl.} - - PColorSelectionDialog* = ptr TColorSelectionDialog - TColorSelectionDialog* = object of TDialog - colorsel*: PWidget - ok_button*: PWidget - cancel_button*: PWidget - help_button*: PWidget - - PColorSelectionDialogClass* = ptr TColorSelectionDialogClass - TColorSelectionDialogClass* = object of TDialogClass - reserved221: proc (){.cdecl.} - reserved222: proc (){.cdecl.} - reserved223: proc (){.cdecl.} - reserved224: proc (){.cdecl.} - - PHBox* = ptr THBox - THBox* = object of TBox - PHBoxClass* = ptr THBoxClass - THBoxClass* = object of TBoxClass - PCombo* = ptr TCombo - TCombo* = object of THBox - entry*: PWidget - button*: PWidget - popup*: PWidget - popwin*: PWidget - list*: PWidget - entry_change_id*: guint - list_change_id*: guint - Combo_flag0*: guint16 - current_button*: guint16 - activate_id*: guint - - PComboClass* = ptr TComboClass - TComboClass* = object of THBoxClass - reserved231: proc (){.cdecl.} - reserved232: proc (){.cdecl.} - reserved233: proc (){.cdecl.} - reserved234: proc (){.cdecl.} - - PCTreePos* = ptr TCTreePos - TCTreePos* = enum - CTREE_POS_BEFORE, CTREE_POS_AS_CHILD, CTREE_POS_AFTER - PCTreeLineStyle* = ptr TCTreeLineStyle - TCTreeLineStyle* = enum - CTREE_LINES_NONE, CTREE_LINES_SOLID, CTREE_LINES_DOTTED, CTREE_LINES_TABBED - PCTreeExpanderStyle* = ptr TCTreeExpanderStyle - TCTreeExpanderStyle* = enum - CTREE_EXPANDER_NONE, CTREE_EXPANDER_SQUARE, CTREE_EXPANDER_TRIANGLE, - CTREE_EXPANDER_CIRCULAR - PCTreeExpansionType* = ptr TCTreeExpansionType - TCTreeExpansionType* = enum - CTREE_EXPANSION_EXPAND, CTREE_EXPANSION_EXPAND_RECURSIVE, - CTREE_EXPANSION_COLLAPSE, CTREE_EXPANSION_COLLAPSE_RECURSIVE, - CTREE_EXPANSION_TOGGLE, CTREE_EXPANSION_TOGGLE_RECURSIVE - PCTree* = ptr TCTree - PCTreeNode* = ptr TCTreeNode - TCTreeFunc* = proc (ctree: PCTree, node: PCTreeNode, data: gpointer){.cdecl.} - TCTreeGNodeFunc* = proc (ctree: PCTree, depth: guint, gnode: PGNode, - cnode: PCTreeNode, data: gpointer): gboolean{.cdecl.} - TCTreeCompareDragFunc* = proc (ctree: PCTree, source_node: PCTreeNode, - new_parent: PCTreeNode, new_sibling: PCTreeNode): gboolean{. - cdecl.} - TCTree* = object of TCList - lines_gc*: gdk2.PGC - tree_indent*: gint - tree_spacing*: gint - tree_column*: gint - CTree_flag0*: guint16 - drag_compare*: TCTreeCompareDragFunc - - PCTreeClass* = ptr TCTreeClass - TCTreeClass* = object of TCListClass - tree_select_row*: proc (ctree: PCTree, row: PCTreeNode, column: gint){.cdecl.} - tree_unselect_row*: proc (ctree: PCTree, row: PCTreeNode, column: gint){. - cdecl.} - tree_expand*: proc (ctree: PCTree, node: PCTreeNode){.cdecl.} - tree_collapse*: proc (ctree: PCTree, node: PCTreeNode){.cdecl.} - tree_move*: proc (ctree: PCTree, node: PCTreeNode, new_parent: PCTreeNode, - new_sibling: PCTreeNode){.cdecl.} - change_focus_row_expansion*: proc (ctree: PCTree, - action: TCTreeExpansionType){.cdecl.} - - PCTreeRow* = ptr TCTreeRow - TCTreeRow*{.final, pure.} = object - row*: TCListRow - parent*: PCTreeNode - sibling*: PCTreeNode - children*: PCTreeNode - pixmap_closed*: gdk2.PPixmap - mask_closed*: gdk2.PBitmap - pixmap_opened*: gdk2.PPixmap - mask_opened*: gdk2.PBitmap - level*: guint16 - CTreeRow_flag0*: guint16 - - TCTreeNode*{.final, pure.} = object - list*: TGList - - PDrawingArea* = ptr TDrawingArea - TDrawingArea* = object of TWidget - draw_data*: gpointer - - PDrawingAreaClass* = ptr TDrawingAreaClass - TDrawingAreaClass* = object of TWidgetClass - reserved241: proc (){.cdecl.} - reserved242: proc (){.cdecl.} - reserved243: proc (){.cdecl.} - reserved244: proc (){.cdecl.} - - Tctlpoint* = array[0..1, gfloat] - Pctlpoint* = ptr Tctlpoint - PCurve* = ptr TCurve - TCurve* = object of TDrawingArea - cursor_type*: gint - min_x*: gfloat - max_x*: gfloat - min_y*: gfloat - max_y*: gfloat - pixmap*: gdk2.PPixmap - curve_type*: TCurveType - height*: gint - grab_point*: gint - last*: gint - num_points*: gint - point*: gdk2.PPoint - num_ctlpoints*: gint - ctlpoint*: Pctlpoint - - PCurveClass* = ptr TCurveClass - TCurveClass* = object of TDrawingAreaClass - curve_type_changed*: proc (curve: PCurve){.cdecl.} - reserved251: proc (){.cdecl.} - reserved252: proc (){.cdecl.} - reserved253: proc (){.cdecl.} - reserved254: proc (){.cdecl.} - - PDestDefaults* = ptr TDestDefaults - TDestDefaults* = int32 - PTargetFlags* = ptr TTargetFlags - TTargetFlags* = int32 - PEditable* = pointer - PEditableClass* = ptr TEditableClass - TEditableClass* = object of TGTypeInterface - insert_text*: proc (editable: PEditable, text: cstring, length: gint, - position: Pgint){.cdecl.} - delete_text*: proc (editable: PEditable, start_pos: gint, end_pos: gint){. - cdecl.} - changed*: proc (editable: PEditable){.cdecl.} - do_insert_text*: proc (editable: PEditable, text: cstring, length: gint, - position: Pgint){.cdecl.} - do_delete_text*: proc (editable: PEditable, start_pos: gint, end_pos: gint){. - cdecl.} - get_chars*: proc (editable: PEditable, start_pos: gint, end_pos: gint): cstring{. - cdecl.} - set_selection_bounds*: proc (editable: PEditable, start_pos: gint, - end_pos: gint){.cdecl.} - get_selection_bounds*: proc (editable: PEditable, start_pos: Pgint, - end_pos: Pgint): gboolean{.cdecl.} - set_position*: proc (editable: PEditable, position: gint){.cdecl.} - get_position*: proc (editable: PEditable): gint{.cdecl.} - - PIMContext* = ptr TIMContext - TIMContext* = object of TGObject - PIMContextClass* = ptr TIMContextClass - TIMContextClass* = object of TObjectClass - preedit_start*: proc (context: PIMContext){.cdecl.} - preedit_end*: proc (context: PIMContext){.cdecl.} - preedit_changed*: proc (context: PIMContext){.cdecl.} - commit*: proc (context: PIMContext, str: cstring){.cdecl.} - retrieve_surrounding*: proc (context: PIMContext): gboolean{.cdecl.} - delete_surrounding*: proc (context: PIMContext, offset: gint, n_chars: gint): gboolean{. - cdecl.} - set_client_window*: proc (context: PIMContext, window: gdk2.PWindow){.cdecl.} - get_preedit_string*: proc (context: PIMContext, str: PPgchar, - attrs: var pango.PAttrList, cursor_pos: Pgint){. - cdecl.} - filter_keypress*: proc (context: PIMContext, event: gdk2.PEventKey): gboolean{. - cdecl.} - focus_in*: proc (context: PIMContext){.cdecl.} - focus_out*: proc (context: PIMContext){.cdecl.} - reset*: proc (context: PIMContext){.cdecl.} - set_cursor_location*: proc (context: PIMContext, area: gdk2.PRectangle){.cdecl.} - set_use_preedit*: proc (context: PIMContext, use_preedit: gboolean){.cdecl.} - set_surrounding*: proc (context: PIMContext, text: cstring, len: gint, - cursor_index: gint){.cdecl.} - get_surrounding*: proc (context: PIMContext, text: PPgchar, - cursor_index: Pgint): gboolean{.cdecl.} - reserved261: proc (){.cdecl.} - reserved262: proc (){.cdecl.} - reserved263: proc (){.cdecl.} - reserved264: proc (){.cdecl.} - reserved265: proc (){.cdecl.} - reserved266: proc (){.cdecl.} - - PMenuShell* = ptr TMenuShell - TMenuShell* = object of TContainer - children*: PGList - active_menu_item*: PWidget - parent_menu_shell*: PWidget - button*: guint - activate_time*: guint32 - MenuShell_flag0*: guint16 - - PMenuShellClass* = ptr TMenuShellClass - TMenuShellClass* = object of TContainerClass - MenuShellClass_flag0*: guint16 - deactivate*: proc (menu_shell: PMenuShell){.cdecl.} - selection_done*: proc (menu_shell: PMenuShell){.cdecl.} - move_current*: proc (menu_shell: PMenuShell, direction: TMenuDirectionType){. - cdecl.} - activate_current*: proc (menu_shell: PMenuShell, force_hide: gboolean){. - cdecl.} - cancel*: proc (menu_shell: PMenuShell){.cdecl.} - select_item*: proc (menu_shell: PMenuShell, menu_item: PWidget){.cdecl.} - insert*: proc (menu_shell: PMenuShell, child: PWidget, position: gint){. - cdecl.} - reserved271: proc (){.cdecl.} - reserved272: proc (){.cdecl.} - reserved273: proc (){.cdecl.} - reserved274: proc (){.cdecl.} - - TMenuPositionFunc* = proc (menu: PMenu, x: Pgint, y: Pgint, - push_in: Pgboolean, user_data: gpointer){.cdecl.} - TMenuDetachFunc* = proc (attach_widget: PWidget, menu: PMenu){.cdecl.} - TMenu* = object of TMenuShell - parent_menu_item*: PWidget - old_active_menu_item*: PWidget - accel_group*: PAccelGroup - accel_path*: cstring - position_func*: TMenuPositionFunc - position_func_data*: gpointer - toggle_size*: guint - toplevel*: PWidget - tearoff_window*: PWidget - tearoff_hbox*: PWidget - tearoff_scrollbar*: PWidget - tearoff_adjustment*: PAdjustment - view_window*: gdk2.PWindow - bin_window*: gdk2.PWindow - scroll_offset*: gint - saved_scroll_offset*: gint - scroll_step*: gint - timeout_id*: guint - navigation_region*: gdk2.PRegion - navigation_timeout*: guint - Menu_flag0*: guint16 - - PMenuClass* = ptr TMenuClass - TMenuClass* = object of TMenuShellClass - reserved281: proc (){.cdecl.} - reserved282: proc (){.cdecl.} - reserved283: proc (){.cdecl.} - reserved284: proc (){.cdecl.} - - PEntry* = ptr TEntry - TEntry* = object of TWidget - text*: cstring - Entry_flag0*: guint16 - text_length*: guint16 - text_max_length*: guint16 - text_area*: gdk2.PWindow - im_context*: PIMContext - popup_menu*: PWidget - current_pos*: gint - selection_bound*: gint - cached_layout*: pango.PLayout - flag1*: guint16 - button*: guint - blink_timeout*: guint - recompute_idle*: guint - scroll_offset*: gint - ascent*: gint - descent*: gint - text_size*: guint16 - n_bytes*: guint16 - preedit_length*: guint16 - preedit_cursor*: guint16 - dnd_position*: gint - drag_start_x*: gint - drag_start_y*: gint - invisible_char*: gunichar - width_chars*: gint - - PEntryClass* = ptr TEntryClass - TEntryClass* = object of TWidgetClass - populate_popup*: proc (entry: PEntry, menu: PMenu){.cdecl.} - activate*: proc (entry: PEntry){.cdecl.} - move_cursor*: proc (entry: PEntry, step: TMovementStep, count: gint, - extend_selection: gboolean){.cdecl.} - insert_at_cursor*: proc (entry: PEntry, str: cstring){.cdecl.} - delete_from_cursor*: proc (entry: PEntry, thetype: TDeleteType, count: gint){. - cdecl.} - cut_clipboard*: proc (entry: PEntry){.cdecl.} - copy_clipboard*: proc (entry: PEntry){.cdecl.} - paste_clipboard*: proc (entry: PEntry){.cdecl.} - toggle_overwrite*: proc (entry: PEntry){.cdecl.} - reserved291: proc (){.cdecl.} - reserved292: proc (){.cdecl.} - reserved293: proc (){.cdecl.} - reserved294: proc (){.cdecl.} - - PEventBox* = ptr TEventBox - TEventBox* = object of TBin - PEventBoxClass* = ptr TEventBoxClass - TEventBoxClass* = object of TBinClass - PFileSelection* = ptr TFileSelection - TFileSelection* = object of TDialog - dir_list*: PWidget - file_list*: PWidget - selection_entry*: PWidget - selection_text*: PWidget - main_vbox*: PWidget - ok_button*: PWidget - cancel_button*: PWidget - help_button*: PWidget - history_pulldown*: PWidget - history_menu*: PWidget - history_list*: PGList - fileop_dialog*: PWidget - fileop_entry*: PWidget - fileop_file*: cstring - cmpl_state*: gpointer - fileop_c_dir*: PWidget - fileop_del_file*: PWidget - fileop_ren_file*: PWidget - button_area*: PWidget - FileSelection_action_area*: PWidget - selected_names*: PGPtrArray - last_selected*: cstring - - PFileSelectionClass* = ptr TFileSelectionClass - TFileSelectionClass* = object of TDialogClass - reserved301: proc (){.cdecl.} - reserved302: proc (){.cdecl.} - reserved303: proc (){.cdecl.} - reserved304: proc (){.cdecl.} - - PFixed* = ptr TFixed - TFixed* = object of TContainer - children*: PGList - - PFixedClass* = ptr TFixedClass - TFixedClass* = object of TContainerClass - PFixedChild* = ptr TFixedChild - TFixedChild*{.final, pure.} = object - widget*: PWidget - x*: gint - y*: gint - - PFontSelection* = ptr TFontSelection - TFontSelection* = object of TVBox - font_entry*: PWidget - family_list*: PWidget - font_style_entry*: PWidget - face_list*: PWidget - size_entry*: PWidget - size_list*: PWidget - pixels_button*: PWidget - points_button*: PWidget - filter_button*: PWidget - preview_entry*: PWidget - family*: pango.PFontFamily - face*: pango.PFontFace - size*: gint - font*: gdk2.PFont - - PFontSelectionClass* = ptr TFontSelectionClass - TFontSelectionClass* = object of TVBoxClass - reserved311: proc (){.cdecl.} - reserved312: proc (){.cdecl.} - reserved313: proc (){.cdecl.} - reserved314: proc (){.cdecl.} - - PFontSelectionDialog* = ptr TFontSelectionDialog - TFontSelectionDialog* = object of TDialog - fontsel*: PWidget - main_vbox*: PWidget - FontSelectionDialog_action_area*: PWidget - ok_button*: PWidget - apply_button*: PWidget - cancel_button*: PWidget - dialog_width*: gint - auto_resize*: gboolean - - PFontSelectionDialogClass* = ptr TFontSelectionDialogClass - TFontSelectionDialogClass* = object of TDialogClass - reserved321: proc (){.cdecl.} - reserved322: proc (){.cdecl.} - reserved323: proc (){.cdecl.} - reserved324: proc (){.cdecl.} - - PGammaCurve* = ptr TGammaCurve - TGammaCurve* = object of TVBox - table*: PWidget - curve*: PWidget - button*: array[0..4, PWidget] - gamma*: gfloat - gamma_dialog*: PWidget - gamma_text*: PWidget - - PGammaCurveClass* = ptr TGammaCurveClass - TGammaCurveClass* = object of TVBoxClass - reserved331: proc (){.cdecl.} - reserved332: proc (){.cdecl.} - reserved333: proc (){.cdecl.} - reserved334: proc (){.cdecl.} - - PHandleBox* = ptr THandleBox - THandleBox* = object of TBin - bin_window*: gdk2.PWindow - float_window*: gdk2.PWindow - shadow_type*: TShadowType - HandleBox_flag0*: guint16 - deskoff_x*: gint - deskoff_y*: gint - attach_allocation*: TAllocation - float_allocation*: TAllocation - - PHandleBoxClass* = ptr THandleBoxClass - THandleBoxClass* = object of TBinClass - child_attached*: proc (handle_box: PHandleBox, child: PWidget){.cdecl.} - child_detached*: proc (handle_box: PHandleBox, child: PWidget){.cdecl.} - reserved341: proc (){.cdecl.} - reserved342: proc (){.cdecl.} - reserved343: proc (){.cdecl.} - reserved344: proc (){.cdecl.} - - PPaned* = ptr TPaned - TPaned* = object of TContainer - child1*: PWidget - child2*: PWidget - handle*: gdk2.PWindow - xor_gc*: gdk2.PGC - cursor_type*: gdk2.TCursorType - handle_pos*: gdk2.TRectangle - child1_size*: gint - last_allocation*: gint - min_position*: gint - max_position*: gint - Paned_flag0*: guint16 - last_child1_focus*: PWidget - last_child2_focus*: PWidget - saved_focus*: PWidget - drag_pos*: gint - original_position*: gint - - PPanedClass* = ptr TPanedClass - TPanedClass* = object of TContainerClass - cycle_child_focus*: proc (paned: PPaned, reverse: gboolean): gboolean{.cdecl.} - toggle_handle_focus*: proc (paned: PPaned): gboolean{.cdecl.} - move_handle*: proc (paned: PPaned, scroll: TScrollType): gboolean{.cdecl.} - cycle_handle_focus*: proc (paned: PPaned, reverse: gboolean): gboolean{. - cdecl.} - accept_position*: proc (paned: PPaned): gboolean{.cdecl.} - cancel_position*: proc (paned: PPaned): gboolean{.cdecl.} - reserved351: proc (){.cdecl.} - reserved352: proc (){.cdecl.} - reserved353: proc (){.cdecl.} - reserved354: proc (){.cdecl.} - - PHButtonBox* = ptr THButtonBox - THButtonBox* = object of TButtonBox - PHButtonBoxClass* = ptr THButtonBoxClass - THButtonBoxClass* = object of TButtonBoxClass - PHPaned* = ptr THPaned - THPaned* = object of TPaned - PHPanedClass* = ptr THPanedClass - THPanedClass* = object of TPanedClass - PRulerMetric* = ptr TRulerMetric - PRuler* = ptr TRuler - TRuler* = object of TWidget - backing_store*: gdk2.PPixmap - non_gr_exp_gc*: gdk2.PGC - metric*: PRulerMetric - xsrc*: gint - ysrc*: gint - slider_size*: gint - lower*: gdouble - upper*: gdouble - position*: gdouble - max_size*: gdouble - - PRulerClass* = ptr TRulerClass - TRulerClass* = object of TWidgetClass - draw_ticks*: proc (ruler: PRuler){.cdecl.} - draw_pos*: proc (ruler: PRuler){.cdecl.} - reserved361: proc (){.cdecl.} - reserved362: proc (){.cdecl.} - reserved363: proc (){.cdecl.} - reserved364: proc (){.cdecl.} - - TRulerMetric*{.final, pure.} = object - metric_name*: cstring - abbrev*: cstring - pixels_per_unit*: gdouble - ruler_scale*: array[0..9, gdouble] - subdivide*: array[0..4, gint] - - PHRuler* = ptr THRuler - THRuler* = object of TRuler - PHRulerClass* = ptr THRulerClass - THRulerClass* = object of TRulerClass - PRcContext* = pointer - PSettings* = ptr TSettings - TSettings* = object of TGObject - queued_settings*: PGData - property_values*: PGValue - rc_context*: PRcContext - screen*: gdk2.PScreen - - PSettingsClass* = ptr TSettingsClass - TSettingsClass* = object of TGObjectClass - PSettingsValue* = ptr TSettingsValue - TSettingsValue*{.final, pure.} = object - origin*: cstring - value*: TGValue - - PRcFlags* = ptr TRcFlags - TRcFlags* = int32 - PRcStyle* = ptr TRcStyle - TRcStyle* = object of TGObject - name*: cstring - bg_pixmap_name*: array[0..4, cstring] - font_desc*: pango.PFontDescription - color_flags*: array[0..4, TRcFlags] - fg*: array[0..4, gdk2.TColor] - bg*: array[0..4, gdk2.TColor] - text*: array[0..4, gdk2.TColor] - base*: array[0..4, gdk2.TColor] - xthickness*: gint - ythickness*: gint - rc_properties*: PGArray - rc_style_lists*: PGSList - icon_factories*: PGSList - RcStyle_flag0*: guint16 - - PRcStyleClass* = ptr TRcStyleClass - TRcStyleClass* = object of TGObjectClass - create_rc_style*: proc (rc_style: PRcStyle): PRcStyle{.cdecl.} - parse*: proc (rc_style: PRcStyle, settings: PSettings, scanner: PGScanner): guint{. - cdecl.} - merge*: proc (dest: PRcStyle, src: PRcStyle){.cdecl.} - create_style*: proc (rc_style: PRcStyle): PStyle{.cdecl.} - reserved371: proc (){.cdecl.} - reserved372: proc (){.cdecl.} - reserved373: proc (){.cdecl.} - reserved374: proc (){.cdecl.} - - PRcTokenType* = ptr TRcTokenType - TRcTokenType* = enum - RC_TOKEN_INVALID, RC_TOKEN_INCLUDE, RC_TOKEN_NORMAL, RC_TOKEN_ACTIVE, - RC_TOKEN_PRELIGHT, RC_TOKEN_SELECTED, RC_TOKEN_INSENSITIVE, RC_TOKEN_FG, - RC_TOKEN_BG, RC_TOKEN_TEXT, RC_TOKEN_BASE, RC_TOKEN_XTHICKNESS, - RC_TOKEN_YTHICKNESS, RC_TOKEN_FONT, RC_TOKEN_FONTSET, RC_TOKEN_FONT_NAME, - RC_TOKEN_BG_PIXMAP, RC_TOKEN_PIXMAP_PATH, RC_TOKEN_STYLE, RC_TOKEN_BINDING, - RC_TOKEN_BIND, RC_TOKEN_WIDGET, RC_TOKEN_WIDGET_CLASS, RC_TOKEN_CLASS, - RC_TOKEN_LOWEST, RC_TOKEN_GTK, RC_TOKEN_APPLICATION, RC_TOKEN_THEME, - RC_TOKEN_RC, RC_TOKEN_HIGHEST, RC_TOKEN_ENGINE, RC_TOKEN_MODULE_PATH, - RC_TOKEN_IM_MODULE_PATH, RC_TOKEN_IM_MODULE_FILE, RC_TOKEN_STOCK, - RC_TOKEN_LTR, RC_TOKEN_RTL, RC_TOKEN_LAST - PRcProperty* = ptr TRcProperty - TRcProperty*{.final, pure.} = object - type_name*: TGQuark - property_name*: TGQuark - origin*: cstring - value*: TGValue - - PIconSource* = pointer - TRcPropertyParser* = proc (pspec: PGParamSpec, rc_string: PGString, - property_value: PGValue): gboolean{.cdecl.} - TStyle* = object of TGObject - fg*: array[0..4, gdk2.TColor] - bg*: array[0..4, gdk2.TColor] - light*: array[0..4, gdk2.TColor] - dark*: array[0..4, gdk2.TColor] - mid*: array[0..4, gdk2.TColor] - text*: array[0..4, gdk2.TColor] - base*: array[0..4, gdk2.TColor] - text_aa*: array[0..4, gdk2.TColor] - black*: gdk2.TColor - white*: gdk2.TColor - font_desc*: pango.PFontDescription - xthickness*: gint - ythickness*: gint - fg_gc*: array[0..4, gdk2.PGC] - bg_gc*: array[0..4, gdk2.PGC] - light_gc*: array[0..4, gdk2.PGC] - dark_gc*: array[0..4, gdk2.PGC] - mid_gc*: array[0..4, gdk2.PGC] - text_gc*: array[0..4, gdk2.PGC] - base_gc*: array[0..4, gdk2.PGC] - text_aa_gc*: array[0..4, gdk2.PGC] - black_gc*: gdk2.PGC - white_gc*: gdk2.PGC - bg_pixmap*: array[0..4, gdk2.PPixmap] - attach_count*: gint - depth*: gint - colormap*: gdk2.PColormap - private_font*: gdk2.PFont - private_font_desc*: pango.PFontDescription - rc_style*: PRcStyle - styles*: PGSList - property_cache*: PGArray - icon_factories*: PGSList - - PStyleClass* = ptr TStyleClass - TStyleClass* = object of TGObjectClass - realize*: proc (style: PStyle){.cdecl.} - unrealize*: proc (style: PStyle){.cdecl.} - copy*: proc (style: PStyle, src: PStyle){.cdecl.} - clone*: proc (style: PStyle): PStyle{.cdecl.} - init_from_rc*: proc (style: PStyle, rc_style: PRcStyle){.cdecl.} - set_background*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType){.cdecl.} - render_icon*: proc (style: PStyle, source: PIconSource, - direction: TTextDirection, state: TStateType, - size: TIconSize, widget: PWidget, detail: cstring): gdk2pixbuf.PPixbuf{. - cdecl.} - draw_hline*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x1: gint, x2: gint, - y: gint){.cdecl.} - draw_vline*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, y1: gint, y2: gint, - x: gint){.cdecl.} - draw_shadow*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint){.cdecl.} - draw_polygon*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - point: gdk2.PPoint, npoints: gint, fill: gboolean){.cdecl.} - draw_arrow*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - arrow_type: TArrowType, fill: gboolean, x: gint, y: gint, - width: gint, height: gint){.cdecl.} - draw_diamond*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint){.cdecl.} - draw_string*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - `string`: cstring){.cdecl.} - draw_box*: proc (style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl.} - draw_flat_box*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint){.cdecl.} - draw_check*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint){.cdecl.} - draw_option*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint){.cdecl.} - draw_tab*: proc (style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl.} - draw_shadow_gap*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, - detail: cstring, x: gint, y: gint, width: gint, - height: gint, gap_side: TPositionType, gap_x: gint, - gap_width: gint){.cdecl.} - draw_box_gap*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint, - gap_side: TPositionType, gap_x: gint, gap_width: gint){. - cdecl.} - draw_extension*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, - detail: cstring, x: gint, y: gint, width: gint, - height: gint, gap_side: TPositionType){.cdecl.} - draw_focus*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl.} - draw_slider*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint, - orientation: TOrientation){.cdecl.} - draw_handle*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint, - orientation: TOrientation){.cdecl.} - draw_expander*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - expander_style: TExpanderStyle){.cdecl.} - draw_layout*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, use_text: gboolean, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, layout: pango.PLayout){.cdecl.} - draw_resize_grip*: proc (style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, - edge: gdk2.TWindowEdge, x: gint, y: gint, - width: gint, height: gint){.cdecl.} - reserved381: proc (){.cdecl.} - reserved382: proc (){.cdecl.} - reserved383: proc (){.cdecl.} - reserved384: proc (){.cdecl.} - reserved385: proc (){.cdecl.} - reserved386: proc (){.cdecl.} - reserved387: proc (){.cdecl.} - reserved388: proc (){.cdecl.} - reserved389: proc (){.cdecl.} - reserved3810: proc (){.cdecl.} - reserved3811: proc (){.cdecl.} - reserved3812: proc (){.cdecl.} - - PBorder* = ptr TBorder - TBorder*{.final, pure.} = object - left*: gint - right*: gint - top*: gint - bottom*: gint - - PRangeLayout* = pointer - PRangeStepTimer* = pointer - PRange* = ptr TRange - TRange* = object of TWidget - adjustment*: PAdjustment - update_policy*: TUpdateType - Range_flag0*: guint16 - min_slider_size*: gint - orientation*: TOrientation - range_rect*: gdk2.TRectangle - slider_start*: gint - slider_end*: gint - round_digits*: gint - flag1*: guint16 - layout*: PRangeLayout - timer*: PRangeStepTimer - slide_initial_slider_position*: gint - slide_initial_coordinate*: gint - update_timeout_id*: guint - event_window*: gdk2.PWindow - - PRangeClass* = ptr TRangeClass - TRangeClass* = object of TWidgetClass - slider_detail*: cstring - stepper_detail*: cstring - value_changed*: proc (range: PRange){.cdecl.} - adjust_bounds*: proc (range: PRange, new_value: gdouble){.cdecl.} - move_slider*: proc (range: PRange, scroll: TScrollType){.cdecl.} - get_range_border*: proc (range: PRange, border: PBorder){.cdecl.} - reserved401: proc (){.cdecl.} - reserved402: proc (){.cdecl.} - reserved403: proc (){.cdecl.} - reserved404: proc (){.cdecl.} - - PScale* = ptr TScale - TScale* = object of TRange - digits*: gint - Scale_flag0*: guint16 - - PScaleClass* = ptr TScaleClass - TScaleClass* = object of TRangeClass - format_value*: proc (scale: PScale, value: gdouble): cstring{.cdecl.} - draw_value*: proc (scale: PScale){.cdecl.} - reserved411: proc (){.cdecl.} - reserved412: proc (){.cdecl.} - reserved413: proc (){.cdecl.} - reserved414: proc (){.cdecl.} - - PHScale* = ptr THScale - THScale* = object of TScale - PHScaleClass* = ptr THScaleClass - THScaleClass* = object of TScaleClass - PScrollbar* = ptr TScrollbar - TScrollbar* = object of TRange - PScrollbarClass* = ptr TScrollbarClass - TScrollbarClass* = object of TRangeClass - reserved421: proc (){.cdecl.} - reserved422: proc (){.cdecl.} - reserved423: proc (){.cdecl.} - reserved424: proc (){.cdecl.} - - PHScrollbar* = ptr THScrollbar - THScrollbar* = object of TScrollbar - PHScrollbarClass* = ptr THScrollbarClass - THScrollbarClass* = object of TScrollbarClass - PSeparator* = ptr TSeparator - TSeparator* = object of TWidget - PSeparatorClass* = ptr TSeparatorClass - TSeparatorClass* = object of TWidgetClass - PHSeparator* = ptr THSeparator - THSeparator* = object of TSeparator - PHSeparatorClass* = ptr THSeparatorClass - THSeparatorClass* = object of TSeparatorClass - PIconFactory* = ptr TIconFactory - TIconFactory* = object of TGObject - icons*: PGHashTable - - PIconFactoryClass* = ptr TIconFactoryClass - TIconFactoryClass* = object of TGObjectClass - reserved431: proc (){.cdecl.} - reserved432: proc (){.cdecl.} - reserved433: proc (){.cdecl.} - reserved434: proc (){.cdecl.} - - PIconSet* = pointer - PImagePixmapData* = ptr TImagePixmapData - TImagePixmapData*{.final, pure.} = object - pixmap*: gdk2.PPixmap - - PImageImageData* = ptr TImageImageData - TImageImageData*{.final, pure.} = object - image*: gdk2.PImage - - PImagePixbufData* = ptr TImagePixbufData - TImagePixbufData*{.final, pure.} = object - pixbuf*: gdk2pixbuf.PPixbuf - - PImageStockData* = ptr TImageStockData - TImageStockData*{.final, pure.} = object - stock_id*: cstring - - PImageIconSetData* = ptr TImageIconSetData - TImageIconSetData*{.final, pure.} = object - icon_set*: PIconSet - - PImageAnimationData* = ptr TImageAnimationData - TImageAnimationData*{.final, pure.} = object - anim*: gdk2pixbuf.PPixbufAnimation - iter*: gdk2pixbuf.PPixbufAnimationIter - frame_timeout*: guint - - PImageType* = ptr TImageType - TImageType* = enum - IMAGE_EMPTY, IMAGE_PIXMAP, IMAGE_IMAGE, IMAGE_PIXBUF, IMAGE_STOCK, - IMAGE_ICON_SET, IMAGE_ANIMATION - PImage* = ptr TImage - TImage* = object of TMisc - storage_type*: TImageType - pixmap*: TImagePixmapData - mask*: gdk2.PBitmap - icon_size*: TIconSize - - PImageClass* = ptr TImageClass - TImageClass* = object of TMiscClass - reserved441: proc (){.cdecl.} - reserved442: proc (){.cdecl.} - reserved443: proc (){.cdecl.} - reserved444: proc (){.cdecl.} - - PImageMenuItem* = ptr TImageMenuItem - TImageMenuItem* = object of TMenuItem - image*: PWidget - - PImageMenuItemClass* = ptr TImageMenuItemClass - TImageMenuItemClass* = object of TMenuItemClass - PIMContextSimple* = ptr TIMContextSimple - TIMContextSimple* = object of TIMContext - tables*: PGSList - compose_buffer*: array[0..(MAX_COMPOSE_LEN + 1) - 1, guint] - tentative_match*: gunichar - tentative_match_len*: gint - IMContextSimple_flag0*: guint16 - - PIMContextSimpleClass* = ptr TIMContextSimpleClass - TIMContextSimpleClass* = object of TIMContextClass - PIMMulticontext* = ptr TIMMulticontext - TIMMulticontext* = object of TIMContext - slave*: PIMContext - client_window*: gdk2.PWindow - context_id*: cstring - - PIMMulticontextClass* = ptr TIMMulticontextClass - TIMMulticontextClass* = object of TIMContextClass - reserved451: proc (){.cdecl.} - reserved452: proc (){.cdecl.} - reserved453: proc (){.cdecl.} - reserved454: proc (){.cdecl.} - - PInputDialog* = ptr TInputDialog - TInputDialog* = object of TDialog - axis_list*: PWidget - axis_listbox*: PWidget - mode_optionmenu*: PWidget - close_button*: PWidget - save_button*: PWidget - axis_items*: array[0..(gdk2.AXIS_LAST) - 1, PWidget] - current_device*: gdk2.PDevice - keys_list*: PWidget - keys_listbox*: PWidget - - PInputDialogClass* = ptr TInputDialogClass - TInputDialogClass* = object of TDialogClass - enable_device*: proc (inputd: PInputDialog, device: gdk2.PDevice){.cdecl.} - disable_device*: proc (inputd: PInputDialog, device: gdk2.PDevice){.cdecl.} - reserved461: proc (){.cdecl.} - reserved462: proc (){.cdecl.} - reserved463: proc (){.cdecl.} - reserved464: proc (){.cdecl.} - - PInvisible* = ptr TInvisible - TInvisible* = object of TWidget - has_user_ref_count*: gboolean - screen*: gdk2.PScreen - - PInvisibleClass* = ptr TInvisibleClass - TInvisibleClass* = object of TWidgetClass - reserved701: proc (){.cdecl.} - reserved702: proc (){.cdecl.} - reserved703: proc (){.cdecl.} - reserved704: proc (){.cdecl.} - - TPrintFunc* = proc (func_data: gpointer, str: cstring){.cdecl.} - PTranslateFunc* = ptr TTranslateFunc - TTranslateFunc* = gchar - TItemFactoryCallback* = proc (){.cdecl.} - TItemFactoryCallback1* = proc (callback_data: gpointer, - callback_action: guint, widget: PWidget){.cdecl.} - PItemFactory* = ptr TItemFactory - TItemFactory* = object of TObject - path*: cstring - accel_group*: PAccelGroup - widget*: PWidget - items*: PGSList - translate_func*: TTranslateFunc - translate_data*: gpointer - translate_notify*: TDestroyNotify - - PItemFactoryClass* = ptr TItemFactoryClass - TItemFactoryClass* = object of TObjectClass - item_ht*: PGHashTable - reserved471: proc (){.cdecl.} - reserved472: proc (){.cdecl.} - reserved473: proc (){.cdecl.} - reserved474: proc (){.cdecl.} - - PItemFactoryEntry* = ptr TItemFactoryEntry - TItemFactoryEntry*{.final, pure.} = object - path*: cstring - accelerator*: cstring - callback*: TItemFactoryCallback - callback_action*: guint - item_type*: cstring - extra_data*: gconstpointer - - PItemFactoryItem* = ptr TItemFactoryItem - TItemFactoryItem*{.final, pure.} = object - path*: cstring - widgets*: PGSList - - PLayout* = ptr TLayout - TLayout* = object of TContainer - children*: PGList - width*: guint - height*: guint - hadjustment*: PAdjustment - vadjustment*: PAdjustment - bin_window*: gdk2.PWindow - visibility*: gdk2.TVisibilityState - scroll_x*: gint - scroll_y*: gint - freeze_count*: guint - - PLayoutClass* = ptr TLayoutClass - TLayoutClass* = object of TContainerClass - set_scroll_adjustments*: proc (layout: PLayout, hadjustment: PAdjustment, - vadjustment: PAdjustment){.cdecl.} - reserved481: proc (){.cdecl.} - reserved482: proc (){.cdecl.} - reserved483: proc (){.cdecl.} - reserved484: proc (){.cdecl.} - - PList* = ptr TList - TList* = object of TContainer - children*: PGList - selection*: PGList - undo_selection*: PGList - undo_unselection*: PGList - last_focus_child*: PWidget - undo_focus_child*: PWidget - htimer*: guint - vtimer*: guint - anchor*: gint - drag_pos*: gint - anchor_state*: TStateType - List_flag0*: guint16 - - PListClass* = ptr TListClass - TListClass* = object of TContainerClass - selection_changed*: proc (list: PList){.cdecl.} - select_child*: proc (list: PList, child: PWidget){.cdecl.} - unselect_child*: proc (list: PList, child: PWidget){.cdecl.} - - TTreeModelForeachFunc* = proc (model: PTreeModel, path: PTreePath, - iter: PTreeIter, data: gpointer): gboolean{. - cdecl.} - PTreeModelFlags* = ptr TTreeModelFlags - TTreeModelFlags* = int32 - TTreeIter*{.final, pure.} = object - stamp*: gint - user_data*: gpointer - user_data2*: gpointer - user_data3*: gpointer - - PTreeModelIface* = ptr TTreeModelIface - TTreeModelIface* = object of TGTypeInterface - row_changed*: proc (tree_model: PTreeModel, path: PTreePath, iter: PTreeIter){. - cdecl.} - row_inserted*: proc (tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter){.cdecl.} - row_has_child_toggled*: proc (tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter){.cdecl.} - row_deleted*: proc (tree_model: PTreeModel, path: PTreePath){.cdecl.} - rows_reordered*: proc (tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter, new_order: Pgint){.cdecl.} - get_flags*: proc (tree_model: PTreeModel): TTreeModelFlags{.cdecl.} - get_n_columns*: proc (tree_model: PTreeModel): gint{.cdecl.} - get_column_type*: proc (tree_model: PTreeModel, index: gint): GType{.cdecl.} - get_iter*: proc (tree_model: PTreeModel, iter: PTreeIter, path: PTreePath): gboolean{. - cdecl.} - get_path*: proc (tree_model: PTreeModel, iter: PTreeIter): PTreePath{.cdecl.} - get_value*: proc (tree_model: PTreeModel, iter: PTreeIter, column: gint, - value: PGValue){.cdecl.} - iter_next*: proc (tree_model: PTreeModel, iter: PTreeIter): gboolean{.cdecl.} - iter_children*: proc (tree_model: PTreeModel, iter: PTreeIter, - parent: PTreeIter): gboolean{.cdecl.} - iter_has_child*: proc (tree_model: PTreeModel, iter: PTreeIter): gboolean{. - cdecl.} - iter_n_children*: proc (tree_model: PTreeModel, iter: PTreeIter): gint{. - cdecl.} - iter_nth_child*: proc (tree_model: PTreeModel, iter: PTreeIter, - parent: PTreeIter, n: gint): gboolean{.cdecl.} - iter_parent*: proc (tree_model: PTreeModel, iter: PTreeIter, - child: PTreeIter): gboolean{.cdecl.} - ref_node*: proc (tree_model: PTreeModel, iter: PTreeIter){.cdecl.} - unref_node*: proc (tree_model: PTreeModel, iter: PTreeIter){.cdecl.} - - PTreeSortable* = pointer - TTreeIterCompareFunc* = proc (model: PTreeModel, a: PTreeIter, b: PTreeIter, - user_data: gpointer): gint{.cdecl.} - PTreeSortableIface* = ptr TTreeSortableIface - TTreeSortableIface* = object of TGTypeInterface - sort_column_changed*: proc (sortable: PTreeSortable){.cdecl.} - get_sort_column_id*: proc (sortable: PTreeSortable, sort_column_id: Pgint, - order: PSortType): gboolean{.cdecl.} - set_sort_column_id*: proc (sortable: PTreeSortable, sort_column_id: gint, - order: TSortType){.cdecl.} - set_sort_func*: proc (sortable: PTreeSortable, sort_column_id: gint, - func: TTreeIterCompareFunc, data: gpointer, - destroy: TDestroyNotify){.cdecl.} - set_default_sort_func*: proc (sortable: PTreeSortable, - func: TTreeIterCompareFunc, data: gpointer, - destroy: TDestroyNotify){.cdecl.} - has_default_sort_func*: proc (sortable: PTreeSortable): gboolean{.cdecl.} - - PTreeModelSort* = ptr TTreeModelSort - TTreeModelSort* = object of TGObject - root*: gpointer - stamp*: gint - child_flags*: guint - child_model*: PTreeModel - zero_ref_count*: gint - sort_list*: PGList - sort_column_id*: gint - order*: TSortType - default_sort_func*: TTreeIterCompareFunc - default_sort_data*: gpointer - default_sort_destroy*: TDestroyNotify - changed_id*: guint - inserted_id*: guint - has_child_toggled_id*: guint - deleted_id*: guint - reordered_id*: guint - - PTreeModelSortClass* = ptr TTreeModelSortClass - TTreeModelSortClass* = object of TGObjectClass - reserved491: proc (){.cdecl.} - reserved492: proc (){.cdecl.} - reserved493: proc (){.cdecl.} - reserved494: proc (){.cdecl.} - - PListStore* = ptr TListStore - TListStore* = object of TGObject - stamp*: gint - root*: gpointer - tail*: gpointer - sort_list*: PGList - n_columns*: gint - sort_column_id*: gint - order*: TSortType - column_headers*: PGType - length*: gint - default_sort_func*: TTreeIterCompareFunc - default_sort_data*: gpointer - default_sort_destroy*: TDestroyNotify - ListStore_flag0*: guint16 - - PListStoreClass* = ptr TListStoreClass - TListStoreClass* = object of TGObjectClass - reserved501: proc (){.cdecl.} - reserved502: proc (){.cdecl.} - reserved503: proc (){.cdecl.} - reserved504: proc (){.cdecl.} - - TModuleInitFunc* = proc (argc: Pgint, argv: PPPgchar){.cdecl.} - TKeySnoopFunc* = proc (grab_widget: PWidget, event: gdk2.PEventKey, - func_data: gpointer): gint{.cdecl.} - PMenuBar* = ptr TMenuBar - TMenuBar* = object of TMenuShell - PMenuBarClass* = ptr TMenuBarClass - TMenuBarClass* = object of TMenuShellClass - reserved511: proc (){.cdecl.} - reserved512: proc (){.cdecl.} - reserved513: proc (){.cdecl.} - reserved514: proc (){.cdecl.} - - PMessageType* = ptr TMessageType - TMessageType* = enum - MESSAGE_INFO, MESSAGE_WARNING, MESSAGE_QUESTION, MESSAGE_ERROR - PButtonsType* = ptr TButtonsType - TButtonsType* = enum - BUTTONS_NONE, BUTTONS_OK, BUTTONS_CLOSE, BUTTONS_CANCEL, BUTTONS_YES_NO, - BUTTONS_OK_CANCEL - PMessageDialog* = ptr TMessageDialog - TMessageDialog* = object of TDialog - image*: PWidget - label*: PWidget - - PMessageDialogClass* = ptr TMessageDialogClass - TMessageDialogClass* = object of TDialogClass - reserved521: proc (){.cdecl.} - reserved522: proc (){.cdecl.} - reserved523: proc (){.cdecl.} - reserved524: proc (){.cdecl.} - - PNotebookPage* = pointer - PNotebookTab* = ptr TNotebookTab - TNotebookTab* = enum - NOTEBOOK_TAB_FIRST, NOTEBOOK_TAB_LAST - PNotebook* = ptr TNotebook - TNotebook* = object of TContainer - cur_page*: PNotebookPage - children*: PGList - first_tab*: PGList - focus_tab*: PGList - menu*: PWidget - event_window*: gdk2.PWindow - timer*: guint32 - tab_hborder*: guint16 - tab_vborder*: guint16 - Notebook_flag0*: guint16 - - PNotebookClass* = ptr TNotebookClass - TNotebookClass* = object of TContainerClass - switch_page*: proc (notebook: PNotebook, page: PNotebookPage, - page_num: guint){.cdecl.} - select_page*: proc (notebook: PNotebook, move_focus: gboolean): gboolean{. - cdecl.} - focus_tab*: proc (notebook: PNotebook, thetype: TNotebookTab): gboolean{. - cdecl.} - change_current_page*: proc (notebook: PNotebook, offset: gint){.cdecl.} - move_focus_out*: proc (notebook: PNotebook, direction: TDirectionType){. - cdecl.} - reserved531: proc (){.cdecl.} - reserved532: proc (){.cdecl.} - reserved533: proc (){.cdecl.} - reserved534: proc (){.cdecl.} - - POldEditable* = ptr TOldEditable - TOldEditable* = object of TWidget - current_pos*: guint - selection_start_pos*: guint - selection_end_pos*: guint - OldEditable_flag0*: guint16 - clipboard_text*: cstring - - TTextFunction* = proc (editable: POldEditable, time: guint32){.cdecl.} - POldEditableClass* = ptr TOldEditableClass - TOldEditableClass* = object of TWidgetClass - activate*: proc (editable: POldEditable){.cdecl.} - set_editable*: proc (editable: POldEditable, is_editable: gboolean){.cdecl.} - move_cursor*: proc (editable: POldEditable, x: gint, y: gint){.cdecl.} - move_word*: proc (editable: POldEditable, n: gint){.cdecl.} - move_page*: proc (editable: POldEditable, x: gint, y: gint){.cdecl.} - move_to_row*: proc (editable: POldEditable, row: gint){.cdecl.} - move_to_column*: proc (editable: POldEditable, row: gint){.cdecl.} - kill_char*: proc (editable: POldEditable, direction: gint){.cdecl.} - kill_word*: proc (editable: POldEditable, direction: gint){.cdecl.} - kill_line*: proc (editable: POldEditable, direction: gint){.cdecl.} - cut_clipboard*: proc (editable: POldEditable){.cdecl.} - copy_clipboard*: proc (editable: POldEditable){.cdecl.} - paste_clipboard*: proc (editable: POldEditable){.cdecl.} - update_text*: proc (editable: POldEditable, start_pos: gint, end_pos: gint){. - cdecl.} - get_chars*: proc (editable: POldEditable, start_pos: gint, end_pos: gint): cstring{. - cdecl.} - set_selection*: proc (editable: POldEditable, start_pos: gint, end_pos: gint){. - cdecl.} - set_position*: proc (editable: POldEditable, position: gint){.cdecl.} - - POptionMenu* = ptr TOptionMenu - TOptionMenu* = object of TButton - menu*: PWidget - menu_item*: PWidget - width*: guint16 - height*: guint16 - - POptionMenuClass* = ptr TOptionMenuClass - TOptionMenuClass* = object of TButtonClass - changed*: proc (option_menu: POptionMenu){.cdecl.} - reserved541: proc (){.cdecl.} - reserved542: proc (){.cdecl.} - reserved543: proc (){.cdecl.} - reserved544: proc (){.cdecl.} - - PPixmap* = ptr TPixmap - TPixmap* = object of TMisc - pixmap*: gdk2.PPixmap - mask*: gdk2.PBitmap - pixmap_insensitive*: gdk2.PPixmap - Pixmap_flag0*: guint16 - - PPixmapClass* = ptr TPixmapClass - TPixmapClass* = object of TMiscClass - PPlug* = ptr TPlug - TPlug* = object of TWindow - socket_window*: gdk2.PWindow - modality_window*: PWidget - modality_group*: PWindowGroup - grabbed_keys*: PGHashTable - Plug_flag0*: guint16 - - PPlugClass* = ptr TPlugClass - TPlugClass* = object of TWindowClass - embedded*: proc (plug: PPlug){.cdecl.} - reserved551: proc (){.cdecl.} - reserved552: proc (){.cdecl.} - reserved553: proc (){.cdecl.} - reserved554: proc (){.cdecl.} - - PPreview* = ptr TPreview - TPreview* = object of TWidget - buffer*: Pguchar - buffer_width*: guint16 - buffer_height*: guint16 - bpp*: guint16 - rowstride*: guint16 - dither*: gdk2.TRgbDither - Preview_flag0*: guint16 - - PPreviewInfo* = ptr TPreviewInfo - TPreviewInfo*{.final, pure.} = object - lookup*: Pguchar - gamma*: gdouble - - PDitherInfo* = ptr TDitherInfo - TDitherInfo*{.final, pure.} = object - c*: array[0..3, guchar] - - PPreviewClass* = ptr TPreviewClass - TPreviewClass* = object of TWidgetClass - info*: TPreviewInfo - - PProgress* = ptr TProgress - TProgress* = object of TWidget - adjustment*: PAdjustment - offscreen_pixmap*: gdk2.PPixmap - format*: cstring - x_align*: gfloat - y_align*: gfloat - Progress_flag0*: guint16 - - PProgressClass* = ptr TProgressClass - TProgressClass* = object of TWidgetClass - paint*: proc (progress: PProgress){.cdecl.} - update*: proc (progress: PProgress){.cdecl.} - act_mode_enter*: proc (progress: PProgress){.cdecl.} - reserved561: proc (){.cdecl.} - reserved562: proc (){.cdecl.} - reserved563: proc (){.cdecl.} - reserved564: proc (){.cdecl.} - - PProgressBarStyle* = ptr TProgressBarStyle - TProgressBarStyle* = enum - PROGRESS_CONTINUOUS, PROGRESS_DISCRETE - PProgressBarOrientation* = ptr TProgressBarOrientation - TProgressBarOrientation* = enum - PROGRESS_LEFT_TO_RIGHT, PROGRESS_RIGHT_TO_LEFT, PROGRESS_BOTTOM_TO_TOP, - PROGRESS_TOP_TO_BOTTOM - PProgressBar* = ptr TProgressBar - TProgressBar* = object of TProgress - bar_style*: TProgressBarStyle - orientation*: TProgressBarOrientation - blocks*: guint - in_block*: gint - activity_pos*: gint - activity_step*: guint - activity_blocks*: guint - pulse_fraction*: gdouble - ProgressBar_flag0*: guint16 - - PProgressBarClass* = ptr TProgressBarClass - TProgressBarClass* = object of TProgressClass - reserved571: proc (){.cdecl.} - reserved572: proc (){.cdecl.} - reserved573: proc (){.cdecl.} - reserved574: proc (){.cdecl.} - - PRadioButton* = ptr TRadioButton - TRadioButton* = object of TCheckButton - group*: PGSList - - PRadioButtonClass* = ptr TRadioButtonClass - TRadioButtonClass* = object of TCheckButtonClass - reserved581: proc (){.cdecl.} - reserved582: proc (){.cdecl.} - reserved583: proc (){.cdecl.} - reserved584: proc (){.cdecl.} - - PRadioMenuItem* = ptr TRadioMenuItem - TRadioMenuItem* = object of TCheckMenuItem - group*: PGSList - - PRadioMenuItemClass* = ptr TRadioMenuItemClass - TRadioMenuItemClass* = object of TCheckMenuItemClass - reserved591: proc (){.cdecl.} - reserved592: proc (){.cdecl.} - reserved593: proc (){.cdecl.} - reserved594: proc (){.cdecl.} - - PScrolledWindow* = ptr TScrolledWindow - TScrolledWindow* = object of TBin - hscrollbar*: PWidget - vscrollbar*: PWidget - ScrolledWindow_flag0*: guint16 - shadow_type*: guint16 - - PScrolledWindowClass* = ptr TScrolledWindowClass - TScrolledWindowClass* = object of TBinClass - scrollbar_spacing*: gint - scroll_child*: proc (scrolled_window: PScrolledWindow, scroll: TScrollType, - horizontal: gboolean){.cdecl.} - move_focus_out*: proc (scrolled_window: PScrolledWindow, - direction: TDirectionType){.cdecl.} - reserved601: proc (){.cdecl.} - reserved602: proc (){.cdecl.} - reserved603: proc (){.cdecl.} - reserved604: proc (){.cdecl.} - - TSelectionData*{.final, pure.} = object - selection*: gdk2.TAtom - target*: gdk2.TAtom - thetype*: gdk2.TAtom - format*: gint - data*: Pguchar - length*: gint - display*: gdk2.PDisplay - - PTargetEntry* = ptr TTargetEntry - TTargetEntry*{.final, pure.} = object - target*: cstring - flags*: guint - info*: guint - - PTargetList* = ptr TTargetList - TTargetList*{.final, pure.} = object - list*: PGList - ref_count*: guint - - PTargetPair* = ptr TTargetPair - TTargetPair*{.final, pure.} = object - target*: gdk2.TAtom - flags*: guint - info*: guint - - PSeparatorMenuItem* = ptr TSeparatorMenuItem - TSeparatorMenuItem* = object of TMenuItem - PSeparatorMenuItemClass* = ptr TSeparatorMenuItemClass - TSeparatorMenuItemClass* = object of TMenuItemClass - PSizeGroup* = ptr TSizeGroup - TSizeGroup* = object of TGObject - widgets*: PGSList - mode*: guint8 - SizeGroup_flag0*: guint16 - requisition*: TRequisition - - PSizeGroupClass* = ptr TSizeGroupClass - TSizeGroupClass* = object of TGObjectClass - reserved611: proc (){.cdecl.} - reserved612: proc (){.cdecl.} - reserved613: proc (){.cdecl.} - reserved614: proc (){.cdecl.} - - PSizeGroupMode* = ptr TSizeGroupMode - TSizeGroupMode* = enum - SIZE_GROUP_NONE, SIZE_GROUP_HORIZONTAL, SIZE_GROUP_VERTICAL, SIZE_GROUP_BOTH - PSocket* = ptr TSocket - TSocket* = object of TContainer - request_width*: guint16 - request_height*: guint16 - current_width*: guint16 - current_height*: guint16 - plug_window*: gdk2.PWindow - plug_widget*: PWidget - xembed_version*: gshort - Socket_flag0*: guint16 - accel_group*: PAccelGroup - toplevel*: PWidget - - PSocketClass* = ptr TSocketClass - TSocketClass* = object of TContainerClass - plug_added*: proc (socket: PSocket){.cdecl.} - plug_removed*: proc (socket: PSocket): gboolean{.cdecl.} - reserved621: proc (){.cdecl.} - reserved622: proc (){.cdecl.} - reserved623: proc (){.cdecl.} - reserved624: proc (){.cdecl.} - - PSpinButtonUpdatePolicy* = ptr TSpinButtonUpdatePolicy - TSpinButtonUpdatePolicy* = enum - UPDATE_ALWAYS, UPDATE_IF_VALID - PSpinType* = ptr TSpinType - TSpinType* = enum - SPIN_STEP_FORWARD, SPIN_STEP_BACKWARD, SPIN_PAGE_FORWARD, - SPIN_PAGE_BACKWARD, SPIN_HOME, SPIN_END, SPIN_USER_DEFINED - PSpinButton* = ptr TSpinButton - TSpinButton* = object of TEntry - adjustment*: PAdjustment - panel*: gdk2.PWindow - timer*: guint32 - climb_rate*: gdouble - timer_step*: gdouble - update_policy*: TSpinButtonUpdatePolicy - SpinButton_flag0*: int32 - - PSpinButtonClass* = ptr TSpinButtonClass - TSpinButtonClass* = object of TEntryClass - input*: proc (spin_button: PSpinButton, new_value: Pgdouble): gint{.cdecl.} - output*: proc (spin_button: PSpinButton): gint{.cdecl.} - value_changed*: proc (spin_button: PSpinButton){.cdecl.} - change_value*: proc (spin_button: PSpinButton, scroll: TScrollType){.cdecl.} - reserved631: proc (){.cdecl.} - reserved632: proc (){.cdecl.} - reserved633: proc (){.cdecl.} - reserved634: proc (){.cdecl.} - - PStockItem* = ptr TStockItem - TStockItem*{.final, pure.} = object - stock_id*: cstring - label*: cstring - modifier*: gdk2.TModifierType - keyval*: guint - translation_domain*: cstring - - PStatusbar* = ptr TStatusbar - TStatusbar* = object of THBox - frame*: PWidget - `label`*: PWidget - messages*: PGSList - keys*: PGSList - seq_context_id*: guint - seq_message_id*: guint - grip_window*: gdk2.PWindow - Statusbar_flag0*: guint16 - - PStatusbarClass* = ptr TStatusbarClass - TStatusbarClass* = object of THBoxClass - messages_mem_chunk*: PGMemChunk - text_pushed*: proc (statusbar: PStatusbar, context_id: guint, text: cstring){. - cdecl.} - text_popped*: proc (statusbar: PStatusbar, context_id: guint, text: cstring){. - cdecl.} - reserved641: proc (){.cdecl.} - reserved642: proc (){.cdecl.} - reserved643: proc (){.cdecl.} - reserved644: proc (){.cdecl.} - - PTableRowCol* = ptr TTableRowCol - PTable* = ptr TTable - TTable* = object of TContainer - children*: PGList - rows*: PTableRowCol - cols*: PTableRowCol - nrows*: guint16 - ncols*: guint16 - column_spacing*: guint16 - row_spacing*: guint16 - Table_flag0*: guint16 - - PTableClass* = ptr TTableClass - TTableClass* = object of TContainerClass - PTableChild* = ptr TTableChild - TTableChild*{.final, pure.} = object - widget*: PWidget - left_attach*: guint16 - right_attach*: guint16 - top_attach*: guint16 - bottom_attach*: guint16 - xpadding*: guint16 - ypadding*: guint16 - TableChild_flag0*: guint16 - - TTableRowCol*{.final, pure.} = object - requisition*: guint16 - allocation*: guint16 - spacing*: guint16 - flag0*: guint16 - - PTearoffMenuItem* = ptr TTearoffMenuItem - TTearoffMenuItem* = object of TMenuItem - TearoffMenuItem_flag0*: guint16 - - PTearoffMenuItemClass* = ptr TTearoffMenuItemClass - TTearoffMenuItemClass* = object of TMenuItemClass - reserved651: proc (){.cdecl.} - reserved652: proc (){.cdecl.} - reserved653: proc (){.cdecl.} - reserved654: proc (){.cdecl.} - - PTextFont* = pointer - PPropertyMark* = ptr TPropertyMark - TPropertyMark*{.final, pure.} = object - `property`*: PGList - offset*: guint - index*: guint - - PText* = ptr TText - TText* = object of TOldEditable - text_area*: gdk2.PWindow - hadj*: PAdjustment - vadj*: PAdjustment - gc*: gdk2.PGC - line_wrap_bitmap*: gdk2.PPixmap - line_arrow_bitmap*: gdk2.PPixmap - text*: Pguchar - text_len*: guint - gap_position*: guint - gap_size*: guint - text_end*: guint - line_start_cache*: PGList - first_line_start_index*: guint - first_cut_pixels*: guint - first_onscreen_hor_pixel*: guint - first_onscreen_ver_pixel*: guint - Text_flag0*: guint16 - freeze_count*: guint - text_properties*: PGList - text_properties_end*: PGList - point*: TPropertyMark - scratch_buffer*: Pguchar - scratch_buffer_len*: guint - last_ver_value*: gint - cursor_pos_x*: gint - cursor_pos_y*: gint - cursor_mark*: TPropertyMark - cursor_char*: gdk2.TWChar - cursor_char_offset*: gchar - cursor_virtual_x*: gint - cursor_drawn_level*: gint - current_line*: PGList - tab_stops*: PGList - default_tab_width*: gint - current_font*: PTextFont - timer*: gint - button*: guint - bg_gc*: gdk2.PGC - - PTextClass* = ptr TTextClass - TTextClass* = object of TOldEditableClass - set_scroll_adjustments*: proc (text: PText, hadjustment: PAdjustment, - vadjustment: PAdjustment){.cdecl.} - - PTextSearchFlags* = ptr TTextSearchFlags - TTextSearchFlags* = int32 - PTextIter* = ptr TTextIter - TTextIter*{.final, pure.} = object - dummy1*: gpointer - dummy2*: gpointer - dummy3*: gint - dummy4*: gint - dummy5*: gint - dummy6*: gint - dummy7*: gint - dummy8*: gint - dummy9*: gpointer - dummy10*: gpointer - dummy11*: gint - dummy12*: gint - dummy13*: gint - dummy14*: gpointer - - TTextCharPredicate* = proc (ch: gunichar, user_data: gpointer): gboolean{. - cdecl.} - PTextTagClass* = ptr TTextTagClass - PTextAttributes* = ptr TTextAttributes - PTextTag* = ptr TTextTag - PPGtkTextTag* = ptr PTextTag - TTextTag* = object of TGObject - table*: PTextTagTable - name*: cstring - priority*: int32 - values*: PTextAttributes - TextTag_flag0*: int32 - - TTextTagClass* = object of TGObjectClass - event*: proc (tag: PTextTag, event_object: PGObject, event: gdk2.PEvent, - iter: PTextIter): gboolean{.cdecl.} - reserved661: proc (){.cdecl.} - reserved662: proc (){.cdecl.} - reserved663: proc (){.cdecl.} - reserved664: proc (){.cdecl.} - - PTextAppearance* = ptr TTextAppearance - TTextAppearance*{.final, pure.} = object - bg_color*: gdk2.TColor - fg_color*: gdk2.TColor - bg_stipple*: gdk2.PBitmap - fg_stipple*: gdk2.PBitmap - rise*: gint - padding1*: gpointer - flag0*: guint16 - - TTextAttributes*{.final, pure.} = object - refcount*: guint - appearance*: TTextAppearance - justification*: TJustification - direction*: TTextDirection - font*: pango.PFontDescription - font_scale*: gdouble - left_margin*: gint - indent*: gint - right_margin*: gint - pixels_above_lines*: gint - pixels_below_lines*: gint - pixels_inside_wrap*: gint - tabs*: pango.PTabArray - wrap_mode*: TWrapMode - language*: pango.PLanguage - padding1*: gpointer - flag0*: guint16 - - TTextTagTableForeach* = proc (tag: PTextTag, data: gpointer){.cdecl.} - TTextTagTable* = object of TGObject - hash*: PGHashTable - anonymous*: PGSList - anon_count*: gint - buffers*: PGSList - - PTextTagTableClass* = ptr TTextTagTableClass - TTextTagTableClass* = object of TGObjectClass - tag_changed*: proc (table: PTextTagTable, tag: PTextTag, - size_changed: gboolean){.cdecl.} - tag_added*: proc (table: PTextTagTable, tag: PTextTag){.cdecl.} - tag_removed*: proc (table: PTextTagTable, tag: PTextTag){.cdecl.} - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - - PTextMark* = ptr TTextMark - TTextMark* = object of TGObject - segment*: gpointer - - PTextMarkClass* = ptr TTextMarkClass - TTextMarkClass* = object of TGObjectClass - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - - PTextMarkBody* = ptr TTextMarkBody - TTextMarkBody*{.final, pure.} = object - obj*: PTextMark - name*: cstring - tree*: PTextBTree - line*: PTextLine - flag0*: guint16 - - PTextChildAnchor* = ptr TTextChildAnchor - TTextChildAnchor* = object of TGObject - segment*: gpointer - - PTextChildAnchorClass* = ptr TTextChildAnchorClass - TTextChildAnchorClass* = object of TGObjectClass - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - - PTextPixbuf* = ptr TTextPixbuf - TTextPixbuf*{.final, pure.} = object - pixbuf*: gdk2pixbuf.PPixbuf - - PTextChildBody* = ptr TTextChildBody - TTextChildBody*{.final, pure.} = object - obj*: PTextChildAnchor - widgets*: PGSList - tree*: PTextBTree - line*: PTextLine - - PTextLineSegment* = ptr TTextLineSegment - PTextLineSegmentClass* = ptr TTextLineSegmentClass - PTextTagInfo* = ptr TTextTagInfo - TTextTagInfo*{.final, pure.} = object - tag*: PTextTag - tag_root*: PTextBTreeNode - toggle_count*: gint - - PTextToggleBody* = ptr TTextToggleBody - TTextToggleBody*{.final, pure.} = object - info*: PTextTagInfo - inNodeCounts*: gboolean - - TTextLineSegment*{.final, pure.} = object - `type`*: PTextLineSegmentClass - next*: PTextLineSegment - char_count*: int32 - byte_count*: int32 - body*: TTextChildBody - - PTextSegSplitFunc* = ptr TTextSegSplitFunc - TTextSegSplitFunc* = TTextLineSegment - TTextSegDeleteFunc* = proc (seg: PTextLineSegment, line: PTextLine, - tree_gone: gboolean): gboolean{.cdecl.} - PTextSegCleanupFunc* = ptr TTextSegCleanupFunc - TTextSegCleanupFunc* = TTextLineSegment - TTextSegLineChangeFunc* = proc (seg: PTextLineSegment, line: PTextLine){.cdecl.} - TTextSegCheckFunc* = proc (seg: PTextLineSegment, line: PTextLine){.cdecl.} - TTextLineSegmentClass*{.final, pure.} = object - name*: cstring - leftGravity*: gboolean - splitFunc*: TTextSegSplitFunc - deleteFunc*: TTextSegDeleteFunc - cleanupFunc*: TTextSegCleanupFunc - lineChangeFunc*: TTextSegLineChangeFunc - checkFunc*: TTextSegCheckFunc - - PTextLineData* = ptr TTextLineData - TTextLineData*{.final, pure.} = object - view_id*: gpointer - next*: PTextLineData - height*: gint - flag0*: int32 - - TTextLine*{.final, pure.} = object - parent*: PTextBTreeNode - next*: PTextLine - segments*: PTextLineSegment - views*: PTextLineData - - PTextLogAttrCache* = pointer - PTextBuffer* = ptr TTextBuffer - TTextBuffer* = object of TGObject - tag_table*: PTextTagTable - btree*: PTextBTree - clipboard_contents_buffers*: PGSList - selection_clipboards*: PGSList - log_attr_cache*: PTextLogAttrCache - user_action_count*: guint - TextBuffer_flag0*: guint16 - - PTextBufferClass* = ptr TTextBufferClass - TTextBufferClass* = object of TGObjectClass - insert_text*: proc (buffer: PTextBuffer, pos: PTextIter, text: cstring, - length: gint){.cdecl.} - insert_pixbuf*: proc (buffer: PTextBuffer, pos: PTextIter, - pixbuf: gdk2pixbuf.PPixbuf){.cdecl.} - insert_child_anchor*: proc (buffer: PTextBuffer, pos: PTextIter, - anchor: PTextChildAnchor){.cdecl.} - delete_range*: proc (buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter){.cdecl.} - changed*: proc (buffer: PTextBuffer){.cdecl.} - modified_changed*: proc (buffer: PTextBuffer){.cdecl.} - mark_set*: proc (buffer: PTextBuffer, location: PTextIter, mark: PTextMark){. - cdecl.} - mark_deleted*: proc (buffer: PTextBuffer, mark: PTextMark){.cdecl.} - apply_tag*: proc (buffer: PTextBuffer, tag: PTextTag, start_char: PTextIter, - end_char: PTextIter){.cdecl.} - remove_tag*: proc (buffer: PTextBuffer, tag: PTextTag, - start_char: PTextIter, end_char: PTextIter){.cdecl.} - begin_user_action*: proc (buffer: PTextBuffer){.cdecl.} - end_user_action*: proc (buffer: PTextBuffer){.cdecl.} - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - reserved5: proc (){.cdecl.} - reserved6: proc (){.cdecl.} - - PTextLineDisplay* = ptr TTextLineDisplay - PTextLayout* = ptr TTextLayout - TTextLayout* = object of TGObject - screen_width*: gint - width*: gint - height*: gint - buffer*: PTextBuffer - default_style*: PTextAttributes - ltr_context*: pango.PContext - rtl_context*: pango.PContext - one_style_cache*: PTextAttributes - one_display_cache*: PTextLineDisplay - wrap_loop_count*: gint - TextLayout_flag0*: guint16 - preedit_string*: cstring - preedit_attrs*: pango.PAttrList - preedit_len*: gint - preedit_cursor*: gint - - PTextLayoutClass* = ptr TTextLayoutClass - TTextLayoutClass* = object of TGObjectClass - invalidated*: proc (layout: PTextLayout){.cdecl.} - changed*: proc (layout: PTextLayout, y: gint, old_height: gint, - new_height: gint){.cdecl.} - wrap*: proc (layout: PTextLayout, line: PTextLine, line_data: PTextLineData): PTextLineData{. - cdecl.} - get_log_attrs*: proc (layout: PTextLayout, line: PTextLine, - attrs: var pango.PLogAttr, n_attrs: Pgint){.cdecl.} - invalidate*: proc (layout: PTextLayout, start: PTextIter, theEnd: PTextIter){. - cdecl.} - free_line_data*: proc (layout: PTextLayout, line: PTextLine, - line_data: PTextLineData){.cdecl.} - allocate_child*: proc (layout: PTextLayout, child: PWidget, x: gint, y: gint){. - cdecl.} - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - - PTextAttrAppearance* = ptr TTextAttrAppearance - TTextAttrAppearance*{.final, pure.} = object - attr*: pango.TAttribute - appearance*: TTextAppearance - - PTextCursorDisplay* = ptr TTextCursorDisplay - TTextCursorDisplay*{.final, pure.} = object - x*: gint - y*: gint - height*: gint - flag0*: guint16 - - TTextLineDisplay*{.final, pure.} = object - layout*: pango.PLayout - cursors*: PGSList - shaped_objects*: PGSList - direction*: TTextDirection - width*: gint - total_width*: gint - height*: gint - x_offset*: gint - left_margin*: gint - right_margin*: gint - top_margin*: gint - bottom_margin*: gint - insert_index*: gint - size_only*: gboolean - line*: PTextLine - - PTextWindow* = pointer - PTextPendingScroll* = pointer - PTextWindowType* = ptr TTextWindowType - TTextWindowType* = enum - TEXT_WINDOW_PRIVATE, TEXT_WINDOW_WIDGET, TEXT_WINDOW_TEXT, TEXT_WINDOW_LEFT, - TEXT_WINDOW_RIGHT, TEXT_WINDOW_TOP, TEXT_WINDOW_BOTTOM - PTextView* = ptr TTextView - TTextView* = object of TContainer - layout*: PTextLayout - buffer*: PTextBuffer - selection_drag_handler*: guint - scroll_timeout*: guint - pixels_above_lines*: gint - pixels_below_lines*: gint - pixels_inside_wrap*: gint - wrap_mode*: TWrapMode - justify*: TJustification - left_margin*: gint - right_margin*: gint - indent*: gint - tabs*: pango.PTabArray - TextView_flag0*: guint16 - text_window*: PTextWindow - left_window*: PTextWindow - right_window*: PTextWindow - top_window*: PTextWindow - bottom_window*: PTextWindow - hadjustment*: PAdjustment - vadjustment*: PAdjustment - xoffset*: gint - yoffset*: gint - width*: gint - height*: gint - virtual_cursor_x*: gint - virtual_cursor_y*: gint - first_para_mark*: PTextMark - first_para_pixels*: gint - dnd_mark*: PTextMark - blink_timeout*: guint - first_validate_idle*: guint - incremental_validate_idle*: guint - im_context*: PIMContext - popup_menu*: PWidget - drag_start_x*: gint - drag_start_y*: gint - children*: PGSList - pending_scroll*: PTextPendingScroll - pending_place_cursor_button*: gint - - PTextViewClass* = ptr TTextViewClass - TTextViewClass* = object of TContainerClass - set_scroll_adjustments*: proc (text_view: PTextView, - hadjustment: PAdjustment, - vadjustment: PAdjustment){.cdecl.} - populate_popup*: proc (text_view: PTextView, menu: PMenu){.cdecl.} - move_cursor*: proc (text_view: PTextView, step: TMovementStep, count: gint, - extend_selection: gboolean){.cdecl.} - page_horizontally*: proc (text_view: PTextView, count: gint, - extend_selection: gboolean){.cdecl.} - set_anchor*: proc (text_view: PTextView){.cdecl.} - insert_at_cursor*: proc (text_view: PTextView, str: cstring){.cdecl.} - delete_from_cursor*: proc (text_view: PTextView, thetype: TDeleteType, - count: gint){.cdecl.} - cut_clipboard*: proc (text_view: PTextView){.cdecl.} - copy_clipboard*: proc (text_view: PTextView){.cdecl.} - paste_clipboard*: proc (text_view: PTextView){.cdecl.} - toggle_overwrite*: proc (text_view: PTextView){.cdecl.} - move_focus*: proc (text_view: PTextView, direction: TDirectionType){.cdecl.} - reserved711: proc (){.cdecl.} - reserved712: proc (){.cdecl.} - reserved713: proc (){.cdecl.} - reserved714: proc (){.cdecl.} - reserved715: proc (){.cdecl.} - reserved716: proc (){.cdecl.} - reserved717: proc (){.cdecl.} - reserved718: proc (){.cdecl.} - - PTipsQuery* = ptr TTipsQuery - TTipsQuery* = object of TLabel - TipsQuery_flag0*: guint16 - label_inactive*: cstring - label_no_tip*: cstring - caller*: PWidget - last_crossed*: PWidget - query_cursor*: gdk2.PCursor - - PTipsQueryClass* = ptr TTipsQueryClass - TTipsQueryClass* = object of TLabelClass - start_query*: proc (tips_query: PTipsQuery){.cdecl.} - stop_query*: proc (tips_query: PTipsQuery){.cdecl.} - widget_entered*: proc (tips_query: PTipsQuery, widget: PWidget, - tip_text: cstring, tip_private: cstring){.cdecl.} - widget_selected*: proc (tips_query: PTipsQuery, widget: PWidget, - tip_text: cstring, tip_private: cstring, - event: gdk2.PEventButton): gint{.cdecl.} - reserved721: proc (){.cdecl.} - reserved722: proc (){.cdecl.} - reserved723: proc (){.cdecl.} - reserved724: proc (){.cdecl.} - - PTooltips* = ptr TTooltips - PTooltipsData* = ptr TTooltipsData - TTooltipsData*{.final, pure.} = object - tooltips*: PTooltips - widget*: PWidget - tip_text*: cstring - tip_private*: cstring - - TTooltips* = object of TObject - tip_window*: PWidget - tip_label*: PWidget - active_tips_data*: PTooltipsData - tips_data_list*: PGList - Tooltips_flag0*: int32 - flag1*: guint16 - timer_tag*: gint - last_popdown*: TGTimeVal - - PTooltipsClass* = ptr TTooltipsClass - TTooltipsClass* = object of TObjectClass - reserved1: proc (){.cdecl.} - reserved2: proc (){.cdecl.} - reserved3: proc (){.cdecl.} - reserved4: proc (){.cdecl.} - - PToolbarChildType* = ptr TToolbarChildType - TToolbarChildType* = enum - TOOLBAR_CHILD_SPACE, TOOLBAR_CHILD_BUTTON, TOOLBAR_CHILD_TOGGLEBUTTON, - TOOLBAR_CHILD_RADIOBUTTON, TOOLBAR_CHILD_WIDGET - PToolbarSpaceStyle* = ptr TToolbarSpaceStyle - TToolbarSpaceStyle* = enum - TOOLBAR_SPACE_EMPTY, TOOLBAR_SPACE_LINE - PToolbarChild* = ptr TToolbarChild - TToolbarChild*{.final, pure.} = object - `type`*: TToolbarChildType - widget*: PWidget - icon*: PWidget - label*: PWidget - - PToolbar* = ptr TToolbar - TToolbar* = object of TContainer - num_children*: gint - children*: PGList - orientation*: TOrientation - Toolbar_style*: TToolbarStyle - icon_size*: TIconSize - tooltips*: PTooltips - button_maxw*: gint - button_maxh*: gint - style_set_connection*: guint - icon_size_connection*: guint - Toolbar_flag0*: guint16 - - PToolbarClass* = ptr TToolbarClass - TToolbarClass* = object of TContainerClass - orientation_changed*: proc (toolbar: PToolbar, orientation: TOrientation){. - cdecl.} - style_changed*: proc (toolbar: PToolbar, style: TToolbarStyle){.cdecl.} - reserved731: proc (){.cdecl.} - reserved732: proc (){.cdecl.} - reserved733: proc (){.cdecl.} - reserved734: proc (){.cdecl.} - - PTreeViewMode* = ptr TTreeViewMode - TTreeViewMode* = enum - TREE_VIEW_LINE, TREE_VIEW_ITEM - PTree* = ptr TTree - TTree* = object of TContainer - children*: PGList - root_tree*: PTree - tree_owner*: PWidget - selection*: PGList - level*: guint - indent_value*: guint - current_indent*: guint - Tree_flag0*: guint16 - - PTreeClass* = ptr TTreeClass - TTreeClass* = object of TContainerClass - selection_changed*: proc (tree: PTree){.cdecl.} - select_child*: proc (tree: PTree, child: PWidget){.cdecl.} - unselect_child*: proc (tree: PTree, child: PWidget){.cdecl.} - - PTreeDragSource* = pointer - PTreeDragDest* = pointer - PTreeDragSourceIface* = ptr TTreeDragSourceIface - TTreeDragSourceIface* = object of TGTypeInterface - row_draggable*: proc (drag_source: PTreeDragSource, path: PTreePath): gboolean{. - cdecl.} - drag_data_get*: proc (drag_source: PTreeDragSource, path: PTreePath, - selection_data: PSelectionData): gboolean{.cdecl.} - drag_data_delete*: proc (drag_source: PTreeDragSource, path: PTreePath): gboolean{. - cdecl.} - - PTreeDragDestIface* = ptr TTreeDragDestIface - TTreeDragDestIface* = object of TGTypeInterface - drag_data_received*: proc (drag_dest: PTreeDragDest, dest: PTreePath, - selection_data: PSelectionData): gboolean{.cdecl.} - row_drop_possible*: proc (drag_dest: PTreeDragDest, dest_path: PTreePath, - selection_data: PSelectionData): gboolean{.cdecl.} - - PTreeItem* = ptr TTreeItem - TTreeItem* = object of TItem - subtree*: PWidget - pixmaps_box*: PWidget - plus_pix_widget*: PWidget - minus_pix_widget*: PWidget - pixmaps*: PGList - TreeItem_flag0*: guint16 - - PTreeItemClass* = ptr TTreeItemClass - TTreeItemClass* = object of TItemClass - expand*: proc (tree_item: PTreeItem){.cdecl.} - collapse*: proc (tree_item: PTreeItem){.cdecl.} - - PTreeSelection* = ptr TTreeSelection - TTreeSelectionFunc* = proc (selection: PTreeSelection, model: PTreeModel, - path: PTreePath, - path_currently_selected: gboolean, data: gpointer): gboolean{. - cdecl.} - TTreeSelectionForeachFunc* = proc (model: PTreeModel, path: PTreePath, - iter: PTreeIter, data: gpointer){.cdecl.} - TTreeSelection* = object of TGObject - tree_view*: PTreeView - thetype*: TSelectionMode - user_func*: TTreeSelectionFunc - user_data*: gpointer - destroy*: TDestroyNotify - - PTreeSelectionClass* = ptr TTreeSelectionClass - TTreeSelectionClass* = object of TGObjectClass - changed*: proc (selection: PTreeSelection){.cdecl.} - reserved741: proc (){.cdecl.} - reserved742: proc (){.cdecl.} - reserved743: proc (){.cdecl.} - reserved744: proc (){.cdecl.} - - PTreeStore* = ptr TTreeStore - TTreeStore* = object of TGObject - stamp*: gint - root*: gpointer - last*: gpointer - n_columns*: gint - sort_column_id*: gint - sort_list*: PGList - order*: TSortType - column_headers*: PGType - default_sort_func*: TTreeIterCompareFunc - default_sort_data*: gpointer - default_sort_destroy*: TDestroyNotify - TreeStore_flag0*: guint16 - - PTreeStoreClass* = ptr TTreeStoreClass - TTreeStoreClass* = object of TGObjectClass - reserved751: proc (){.cdecl.} - reserved752: proc (){.cdecl.} - reserved753: proc (){.cdecl.} - reserved754: proc (){.cdecl.} - - PTreeViewColumnSizing* = ptr TTreeViewColumnSizing - TTreeViewColumnSizing* = enum - TREE_VIEW_COLUMN_GROW_ONLY, TREE_VIEW_COLUMN_AUTOSIZE, - TREE_VIEW_COLUMN_FIXED - TTreeCellDataFunc* = proc (tree_column: PTreeViewColumn, cell: PCellRenderer, - tree_model: PTreeModel, iter: PTreeIter, - data: gpointer){.cdecl.} - TTreeViewColumn* = object of TObject - tree_view*: PWidget - button*: PWidget - child*: PWidget - arrow*: PWidget - alignment*: PWidget - window*: gdk2.PWindow - editable_widget*: PCellEditable - xalign*: gfloat - property_changed_signal*: guint - spacing*: gint - column_type*: TTreeViewColumnSizing - requested_width*: gint - button_request*: gint - resized_width*: gint - width*: gint - fixed_width*: gint - min_width*: gint - max_width*: gint - drag_x*: gint - drag_y*: gint - title*: cstring - cell_list*: PGList - sort_clicked_signal*: guint - sort_column_changed_signal*: guint - sort_column_id*: gint - sort_order*: TSortType - TreeViewColumn_flag0*: guint16 - - PTreeViewColumnClass* = ptr TTreeViewColumnClass - TTreeViewColumnClass* = object of TObjectClass - clicked*: proc (tree_column: PTreeViewColumn){.cdecl.} - reserved751: proc (){.cdecl.} - reserved752: proc (){.cdecl.} - reserved753: proc (){.cdecl.} - reserved754: proc (){.cdecl.} - - PRBNodeColor* = ptr TRBNodeColor - TRBNodeColor* = int32 - PRBTree* = ptr TRBTree - PRBNode* = ptr TRBNode - TRBTreeTraverseFunc* = proc (tree: PRBTree, node: PRBNode, data: gpointer){. - cdecl.} - TRBTree*{.final, pure.} = object - root*: PRBNode - `nil`*: PRBNode - parent_tree*: PRBTree - parent_node*: PRBNode - - TRBNode*{.final, pure.} = object - flag0*: guint16 - left*: PRBNode - right*: PRBNode - parent*: PRBNode - count*: gint - offset*: gint - children*: PRBTree - - PTreeRowReference* = pointer - PTreeViewFlags* = ptr TTreeViewFlags - TTreeViewFlags* = int32 - TTreeViewSearchDialogPositionFunc* = proc (tree_view: PTreeView, - search_dialog: PWidget){.cdecl.} - PTreeViewColumnReorder* = ptr TTreeViewColumnReorder - TTreeViewColumnReorder*{.final, pure.} = object - left_align*: gint - right_align*: gint - left_column*: PTreeViewColumn - right_column*: PTreeViewColumn - - PTreeViewPrivate* = ptr TTreeViewPrivate - TTreeViewPrivate*{.final, pure.} = object - model*: PTreeModel - flags*: guint - tree*: PRBTree - button_pressed_node*: PRBNode - button_pressed_tree*: PRBTree - children*: PGList - width*: gint - height*: gint - expander_size*: gint - hadjustment*: PAdjustment - vadjustment*: PAdjustment - bin_window*: gdk2.PWindow - header_window*: gdk2.PWindow - drag_window*: gdk2.PWindow - drag_highlight_window*: gdk2.PWindow - drag_column*: PTreeViewColumn - last_button_press*: PTreeRowReference - last_button_press_2*: PTreeRowReference - top_row*: PTreeRowReference - top_row_dy*: gint - dy*: gint - drag_column_x*: gint - expander_column*: PTreeViewColumn - edited_column*: PTreeViewColumn - presize_handler_timer*: guint - validate_rows_timer*: guint - scroll_sync_timer*: guint - focus_column*: PTreeViewColumn - anchor*: PTreeRowReference - cursor*: PTreeRowReference - drag_pos*: gint - x_drag*: gint - prelight_node*: PRBNode - prelight_tree*: PRBTree - expanded_collapsed_node*: PRBNode - expanded_collapsed_tree*: PRBTree - expand_collapse_timeout*: guint - selection*: PTreeSelection - n_columns*: gint - columns*: PGList - header_height*: gint - column_drop_func*: TTreeViewColumnDropFunc - column_drop_func_data*: gpointer - column_drop_func_data_destroy*: TDestroyNotify - column_drag_info*: PGList - cur_reorder*: PTreeViewColumnReorder - destroy_count_func*: TTreeDestroyCountFunc - destroy_count_data*: gpointer - destroy_count_destroy*: TDestroyNotify - scroll_timeout*: guint - drag_dest_row*: PTreeRowReference - drag_dest_pos*: TTreeViewDropPosition - open_dest_timeout*: guint - pressed_button*: gint - press_start_x*: gint - press_start_y*: gint - scroll_to_path*: PTreeRowReference - scroll_to_column*: PTreeViewColumn - scroll_to_row_align*: gfloat - scroll_to_col_align*: gfloat - flag0*: guint16 - search_column*: gint - search_dialog_position_func*: TTreeViewSearchDialogPositionFunc - search_equal_func*: TTreeViewSearchEqualFunc - search_user_data*: gpointer - search_destroy*: TDestroyNotify - - TTreeView* = object of TContainer - priv*: PTreeViewPrivate - - PTreeViewClass* = ptr TTreeViewClass - TTreeViewClass* = object of TContainerClass - set_scroll_adjustments*: proc (tree_view: PTreeView, - hadjustment: PAdjustment, - vadjustment: PAdjustment){.cdecl.} - row_activated*: proc (tree_view: PTreeView, path: PTreePath, - column: PTreeViewColumn){.cdecl.} - test_expand_row*: proc (tree_view: PTreeView, iter: PTreeIter, - path: PTreePath): gboolean{.cdecl.} - test_collapse_row*: proc (tree_view: PTreeView, iter: PTreeIter, - path: PTreePath): gboolean{.cdecl.} - row_expanded*: proc (tree_view: PTreeView, iter: PTreeIter, path: PTreePath){. - cdecl.} - row_collapsed*: proc (tree_view: PTreeView, iter: PTreeIter, path: PTreePath){. - cdecl.} - columns_changed*: proc (tree_view: PTreeView){.cdecl.} - cursor_changed*: proc (tree_view: PTreeView){.cdecl.} - move_cursor*: proc (tree_view: PTreeView, step: TMovementStep, count: gint): gboolean{. - cdecl.} - select_all*: proc (tree_view: PTreeView){.cdecl.} - unselect_all*: proc (tree_view: PTreeView){.cdecl.} - select_cursor_row*: proc (tree_view: PTreeView, start_editing: gboolean){. - cdecl.} - toggle_cursor_row*: proc (tree_view: PTreeView){.cdecl.} - expand_collapse_cursor_row*: proc (tree_view: PTreeView, logical: gboolean, - expand: gboolean, open_all: gboolean){. - cdecl.} - select_cursor_parent*: proc (tree_view: PTreeView){.cdecl.} - start_interactive_search*: proc (tree_view: PTreeView){.cdecl.} - reserved760: proc (){.cdecl.} - reserved761: proc (){.cdecl.} - reserved762: proc (){.cdecl.} - reserved763: proc (){.cdecl.} - reserved764: proc (){.cdecl.} - - PVButtonBox* = ptr TVButtonBox - TVButtonBox* = object of TButtonBox - PVButtonBoxClass* = ptr TVButtonBoxClass - TVButtonBoxClass* = object of TButtonBoxClass - PViewport* = ptr TViewport - TViewport* = object of TBin - shadow_type*: TShadowType - view_window*: gdk2.PWindow - bin_window*: gdk2.PWindow - hadjustment*: PAdjustment - vadjustment*: PAdjustment - - PViewportClass* = ptr TViewportClass - TViewportClass* = object of TBinClass - set_scroll_adjustments*: proc (viewport: PViewport, - hadjustment: PAdjustment, - vadjustment: PAdjustment){.cdecl.} - - PVPaned* = ptr TVPaned - TVPaned* = object of TPaned - PVPanedClass* = ptr TVPanedClass - TVPanedClass* = object of TPanedClass - PVRuler* = ptr TVRuler - TVRuler* = object of TRuler - PVRulerClass* = ptr TVRulerClass - TVRulerClass* = object of TRulerClass - PVScale* = ptr TVScale - TVScale* = object of TScale - PVScaleClass* = ptr TVScaleClass - TVScaleClass* = object of TScaleClass - PVScrollbar* = ptr TVScrollbar - TVScrollbar* = object of TScrollbar - PVScrollbarClass* = ptr TVScrollbarClass - TVScrollbarClass* = object of TScrollbarClass - PVSeparator* = ptr TVSeparator - TVSeparator* = object of TSeparator - PVSeparatorClass* = ptr TVSeparatorClass - TVSeparatorClass* = object of TSeparatorClass - -const - IN_DESTRUCTION* = 1 shl 0 - FLOATING* = 1 shl 1 - RESERVED_1* = 1 shl 2 - RESERVED_2* = 1 shl 3 - ARG_READABLE* = G_PARAM_READABLE - ARG_WRITABLE* = G_PARAM_WRITABLE - ARG_CONSTRUCT* = G_PARAM_CONSTRUCT - ARG_CONSTRUCT_ONLY* = G_PARAM_CONSTRUCT_ONLY - ARG_CHILD_ARG* = 1 shl 4 - -proc TYPE_OBJECT*(): GType -proc `OBJECT`*(anObject: pointer): PObject -proc OBJECT_CLASS*(klass: pointer): PObjectClass -proc IS_OBJECT*(anObject: pointer): bool -proc IS_OBJECT_CLASS*(klass: pointer): bool -proc OBJECT_GET_CLASS*(anObject: pointer): PObjectClass -proc OBJECT_TYPE*(anObject: pointer): GType -proc OBJECT_TYPE_NAME*(anObject: pointer): cstring -proc OBJECT_FLAGS*(obj: pointer): guint32 -proc OBJECT_FLOATING*(obj: pointer): gboolean -proc OBJECT_SET_FLAGS*(obj: pointer, flag: guint32) -proc OBJECT_UNSET_FLAGS*(obj: pointer, flag: guint32) -proc object_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_object_get_type".} -proc object_new*(thetype: TType, first_property_name: cstring): PObject{.cdecl, - varargs, dynlib: lib, importc: "gtk_object_new".} -proc sink*(anObject: PObject){.cdecl, dynlib: lib, - importc: "gtk_object_sink".} -proc destroy*(anObject: PObject){.cdecl, dynlib: lib, - importc: "gtk_object_destroy".} -const - TYPE_INVALID* = G_TYPE_INVALID - TYPE_NONE* = G_TYPE_NONE - TYPE_ENUM* = G_TYPE_ENUM - TYPE_FLAGS* = G_TYPE_FLAGS - TYPE_CHAR* = G_TYPE_CHAR - TYPE_UCHAR* = G_TYPE_UCHAR - TYPE_BOOL* = G_TYPE_BOOLEAN - TYPE_INT* = G_TYPE_INT - TYPE_UINT* = G_TYPE_UINT - TYPE_LONG* = G_TYPE_LONG - TYPE_ULONG* = G_TYPE_ULONG - TYPE_FLOAT* = G_TYPE_FLOAT - TYPE_DOUBLE* = G_TYPE_DOUBLE - TYPE_STRING* = G_TYPE_STRING - TYPE_BOXED* = G_TYPE_BOXED - TYPE_POINTER* = G_TYPE_POINTER - -proc TYPE_IDENTIFIER*(): GType -proc identifier_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_identifier_get_type".} -proc SIGNAL_FUNC*(f: pointer): TSignalFunc -proc type_class*(thetype: TType): gpointer{.cdecl, dynlib: lib, - importc: "gtk_type_class".} -const - TOPLEVEL* = 1 shl 4 - NO_WINDOW* = 1 shl 5 - constREALIZED* = 1 shl 6 - MAPPED* = 1 shl 7 - constVISIBLE* = 1 shl 8 - SENSITIVE* = 1 shl 9 - PARENT_SENSITIVE* = 1 shl 10 - CAN_FOCUS* = 1 shl 11 - constHAS_FOCUS* = 1 shl 12 - CAN_DEFAULT* = 1 shl 13 - HAS_DEFAULT* = 1 shl 14 - HAS_GRAB* = 1 shl 15 - RC_STYLE* = 1 shl 16 - COMPOSITE_CHILD* = 1 shl 17 - NO_REPARENT* = 1 shl 18 - APP_PAINTABLE* = 1 shl 19 - RECEIVES_DEFAULT* = 1 shl 20 - DOUBLE_BUFFERED* = 1 shl 21 - -const - bm_TGtkWidgetAuxInfo_x_set* = 0x0001'i16 - bp_TGtkWidgetAuxInfo_x_set* = 0'i16 - bm_TGtkWidgetAuxInfo_y_set* = 0x0002'i16 - bp_TGtkWidgetAuxInfo_y_set* = 1'i16 - -proc TYPE_WIDGET*(): GType -proc WIDGET*(widget: pointer): PWidget -proc WIDGET_CLASS*(klass: pointer): PWidgetClass -proc IS_WIDGET*(widget: pointer): bool -proc IS_WIDGET_CLASS*(klass: pointer): bool -proc WIDGET_GET_CLASS*(obj: pointer): PWidgetClass -proc WIDGET_TYPE*(wid: pointer): GType -proc WIDGET_STATE*(wid: pointer): int32 -proc WIDGET_SAVED_STATE*(wid: pointer): int32 -proc WIDGET_FLAGS*(wid: pointer): guint32 -proc WIDGET_TOPLEVEL*(wid: pointer): gboolean -proc WIDGET_NO_WINDOW*(wid: pointer): gboolean -proc WIDGET_REALIZED*(wid: pointer): gboolean -proc WIDGET_MAPPED*(wid: pointer): gboolean -proc WIDGET_VISIBLE*(wid: pointer): gboolean -proc WIDGET_DRAWABLE*(wid: pointer): gboolean -proc WIDGET_SENSITIVE*(wid: pointer): gboolean -proc WIDGET_PARENT_SENSITIVE*(wid: pointer): gboolean -proc WIDGET_IS_SENSITIVE*(wid: pointer): gboolean -proc WIDGET_CAN_FOCUS*(wid: pointer): gboolean -proc WIDGET_HAS_FOCUS*(wid: pointer): gboolean -proc WIDGET_CAN_DEFAULT*(wid: pointer): gboolean -proc WIDGET_HAS_DEFAULT*(wid: pointer): gboolean -proc WIDGET_HAS_GRAB*(wid: pointer): gboolean -proc WIDGET_RC_STYLE*(wid: pointer): gboolean -proc WIDGET_COMPOSITE_CHILD*(wid: pointer): gboolean -proc WIDGET_APP_PAINTABLE*(wid: pointer): gboolean -proc WIDGET_RECEIVES_DEFAULT*(wid: pointer): gboolean -proc WIDGET_DOUBLE_BUFFERED*(wid: pointer): gboolean -proc SET_FLAGS*(wid: PWidget, flags: TWidgetFlags): TWidgetFlags -proc UNSET_FLAGS*(wid: PWidget, flags: TWidgetFlags): TWidgetFlags -proc TYPE_REQUISITION*(): GType -proc x_set*(a: PWidgetAuxInfo): guint -proc set_x_set*(a: PWidgetAuxInfo, x_set: guint) -proc y_set*(a: PWidgetAuxInfo): guint -proc set_y_set*(a: PWidgetAuxInfo, y_set: guint) -proc widget_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_widget_get_type".} -proc reference*(widget: PWidget): PWidget{.cdecl, dynlib: lib, - importc: "gtk_widget_ref".} -proc unref*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_unref".} -proc destroy*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_destroy".} -proc destroyed*(widget: PWidget, r: var PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_destroyed".} -proc unparent*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_unparent".} -proc show*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_show".} -proc show_now*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_show_now".} -proc hide*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_hide".} -proc show_all*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_show_all".} -proc hide_all*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_hide_all".} -proc map*(widget: PWidget){.cdecl, dynlib: lib, importc: "gtk_widget_map".} -proc unmap*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_unmap".} -proc realize*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_realize".} -proc unrealize*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_unrealize".} -proc queue_draw*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_queue_draw".} -proc queue_draw_area*(widget: PWidget, x: gint, y: gint, width: gint, - height: gint){.cdecl, dynlib: lib, - importc: "gtk_widget_queue_draw_area".} -proc queue_resize*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_queue_resize".} -proc size_request*(widget: PWidget, requisition: PRequisition){.cdecl, - dynlib: lib, importc: "gtk_widget_size_request".} -proc size_allocate*(widget: PWidget, allocation: PAllocation){.cdecl, - dynlib: lib, importc: "gtk_widget_size_allocate".} -proc get_child_requisition*(widget: PWidget, requisition: PRequisition){. - cdecl, dynlib: lib, importc: "gtk_widget_get_child_requisition".} -proc add_accelerator*(widget: PWidget, accel_signal: cstring, - accel_group: PAccelGroup, accel_key: guint, - accel_mods: gdk2.TModifierType, - accel_flags: TAccelFlags){.cdecl, dynlib: lib, - importc: "gtk_widget_add_accelerator".} -proc remove_accelerator*(widget: PWidget, accel_group: PAccelGroup, - accel_key: guint, accel_mods: gdk2.TModifierType): gboolean{. - cdecl, dynlib: lib, importc: "gtk_widget_remove_accelerator".} -proc set_accel_path*(widget: PWidget, accel_path: cstring, - accel_group: PAccelGroup){.cdecl, dynlib: lib, - importc: "gtk_widget_set_accel_path".} -proc get_accel_path*(widget: PWidget, locked: Pgboolean): cstring{.cdecl, - dynlib: lib, importc: "_gtk_widget_get_accel_path".} -proc list_accel_closures*(widget: PWidget): PGList{.cdecl, dynlib: lib, - importc: "gtk_widget_list_accel_closures".} -proc mnemonic_activate*(widget: PWidget, group_cycling: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_widget_mnemonic_activate".} -proc event*(widget: PWidget, event: gdk2.PEvent): gboolean{.cdecl, - dynlib: lib, importc: "gtk_widget_event".} -proc send_expose*(widget: PWidget, event: gdk2.PEvent): gint{.cdecl, - dynlib: lib, importc: "gtk_widget_send_expose".} -proc activate*(widget: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_activate".} -proc set_scroll_adjustments*(widget: PWidget, hadjustment: PAdjustment, - vadjustment: PAdjustment): gboolean{.cdecl, - dynlib: lib, importc: "gtk_widget_set_scroll_adjustments".} -proc reparent*(widget: PWidget, new_parent: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_reparent".} -proc intersect*(widget: PWidget, area: gdk2.PRectangle, - intersection: gdk2.PRectangle): gboolean{.cdecl, - dynlib: lib, importc: "gtk_widget_intersect".} -proc region_intersect*(widget: PWidget, region: gdk2.PRegion): gdk2.PRegion{. - cdecl, dynlib: lib, importc: "gtk_widget_region_intersect".} -proc freeze_child_notify*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_freeze_child_notify".} -proc child_notify*(widget: PWidget, child_property: cstring){.cdecl, - dynlib: lib, importc: "gtk_widget_child_notify".} -proc thaw_child_notify*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_thaw_child_notify".} -proc is_focus*(widget: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_is_focus".} -proc grab_focus*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_grab_focus".} -proc grab_default*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_grab_default".} -proc set_name*(widget: PWidget, name: cstring){.cdecl, dynlib: lib, - importc: "gtk_widget_set_name".} -proc get_name*(widget: PWidget): cstring{.cdecl, dynlib: lib, - importc: "gtk_widget_get_name".} -proc set_state*(widget: PWidget, state: TStateType){.cdecl, dynlib: lib, - importc: "gtk_widget_set_state".} -proc set_sensitive*(widget: PWidget, sensitive: gboolean){.cdecl, - dynlib: lib, importc: "gtk_widget_set_sensitive".} -proc set_app_paintable*(widget: PWidget, app_paintable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_widget_set_app_paintable".} -proc set_double_buffered*(widget: PWidget, double_buffered: gboolean){. - cdecl, dynlib: lib, importc: "gtk_widget_set_double_buffered".} -proc set_redraw_on_allocate*(widget: PWidget, - redraw_on_allocate: gboolean){.cdecl, - dynlib: lib, importc: "gtk_widget_set_redraw_on_allocate".} -proc set_parent*(widget: PWidget, parent: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_set_parent".} -proc set_parent_window*(widget: PWidget, parent_window: gdk2.PWindow){. - cdecl, dynlib: lib, importc: "gtk_widget_set_parent_window".} -proc set_child_visible*(widget: PWidget, is_visible: gboolean){.cdecl, - dynlib: lib, importc: "gtk_widget_set_child_visible".} -proc get_child_visible*(widget: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_get_child_visible".} -proc get_parent*(widget: PWidget): PWidget{.cdecl, dynlib: lib, - importc: "gtk_widget_get_parent".} -proc get_parent_window*(widget: PWidget): gdk2.PWindow{.cdecl, dynlib: lib, - importc: "gtk_widget_get_parent_window".} -proc child_focus*(widget: PWidget, direction: TDirectionType): gboolean{. - cdecl, dynlib: lib, importc: "gtk_widget_child_focus".} -proc set_size_request*(widget: PWidget, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "gtk_widget_set_size_request".} -proc get_size_request*(widget: PWidget, width: Pgint, height: Pgint){. - cdecl, dynlib: lib, importc: "gtk_widget_get_size_request".} -proc set_events*(widget: PWidget, events: gint){.cdecl, dynlib: lib, - importc: "gtk_widget_set_events".} -proc add_events*(widget: PWidget, events: gint){.cdecl, dynlib: lib, - importc: "gtk_widget_add_events".} -proc set_extension_events*(widget: PWidget, mode: gdk2.TExtensionMode){. - cdecl, dynlib: lib, importc: "gtk_widget_set_extension_events".} -proc get_extension_events*(widget: PWidget): gdk2.TExtensionMode{.cdecl, - dynlib: lib, importc: "gtk_widget_get_extension_events".} -proc get_toplevel*(widget: PWidget): PWidget{.cdecl, dynlib: lib, - importc: "gtk_widget_get_toplevel".} -proc get_ancestor*(widget: PWidget, widget_type: TType): PWidget{.cdecl, - dynlib: lib, importc: "gtk_widget_get_ancestor".} -proc get_colormap*(widget: PWidget): gdk2.PColormap{.cdecl, dynlib: lib, - importc: "gtk_widget_get_colormap".} -proc get_visual*(widget: PWidget): gdk2.PVisual{.cdecl, dynlib: lib, - importc: "gtk_widget_get_visual".} -proc get_screen*(widget: PWidget): gdk2.PScreen{.cdecl, dynlib: lib, - importc: "gtk_widget_get_screen".} -proc has_screen*(widget: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_has_screen".} -proc get_display*(widget: PWidget): gdk2.PDisplay{.cdecl, dynlib: lib, - importc: "gtk_widget_get_display".} -proc get_root_window*(widget: PWidget): gdk2.PWindow{.cdecl, dynlib: lib, - importc: "gtk_widget_get_root_window".} -proc get_settings*(widget: PWidget): PSettings{.cdecl, dynlib: lib, - importc: "gtk_widget_get_settings".} -proc get_clipboard*(widget: PWidget, selection: gdk2.TAtom): PClipboard{. - cdecl, dynlib: lib, importc: "gtk_widget_get_clipboard".} -proc get_accessible*(widget: PWidget): atk.PObject{.cdecl, dynlib: lib, - importc: "gtk_widget_get_accessible".} -proc set_colormap*(widget: PWidget, colormap: gdk2.PColormap){.cdecl, - dynlib: lib, importc: "gtk_widget_set_colormap".} -proc get_events*(widget: PWidget): gint{.cdecl, dynlib: lib, - importc: "gtk_widget_get_events".} -proc get_pointer*(widget: PWidget, x: Pgint, y: Pgint){.cdecl, - dynlib: lib, importc: "gtk_widget_get_pointer".} -proc is_ancestor*(widget: PWidget, ancestor: PWidget): gboolean{.cdecl, - dynlib: lib, importc: "gtk_widget_is_ancestor".} -proc translate_coordinates*(src_widget: PWidget, dest_widget: PWidget, - src_x: gint, src_y: gint, dest_x: Pgint, - dest_y: Pgint): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_translate_coordinates".} -proc hide_on_delete*(widget: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_hide_on_delete".} -proc set_style*(widget: PWidget, style: PStyle){.cdecl, dynlib: lib, - importc: "gtk_widget_set_style".} -proc ensure_style*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_ensure_style".} -proc get_style*(widget: PWidget): PStyle{.cdecl, dynlib: lib, - importc: "gtk_widget_get_style".} -proc modify_style*(widget: PWidget, style: PRcStyle){.cdecl, dynlib: lib, - importc: "gtk_widget_modify_style".} -proc get_modifier_style*(widget: PWidget): PRcStyle{.cdecl, dynlib: lib, - importc: "gtk_widget_get_modifier_style".} -proc modify_fg*(widget: PWidget, state: TStateType, color: gdk2.PColor){. - cdecl, dynlib: lib, importc: "gtk_widget_modify_fg".} -proc modify_bg*(widget: PWidget, state: TStateType, color: gdk2.PColor){. - cdecl, dynlib: lib, importc: "gtk_widget_modify_bg".} -proc modify_text*(widget: PWidget, state: TStateType, color: gdk2.PColor){. - cdecl, dynlib: lib, importc: "gtk_widget_modify_text".} -proc modify_base*(widget: PWidget, state: TStateType, color: gdk2.PColor){. - cdecl, dynlib: lib, importc: "gtk_widget_modify_base".} -proc modify_font*(widget: PWidget, font_desc: pango.PFontDescription){. - cdecl, dynlib: lib, importc: "gtk_widget_modify_font".} -proc create_pango_context*(widget: PWidget): pango.PContext{.cdecl, - dynlib: lib, importc: "gtk_widget_create_pango_context".} -proc get_pango_context*(widget: PWidget): pango.PContext{.cdecl, - dynlib: lib, importc: "gtk_widget_get_pango_context".} -proc create_pango_layout*(widget: PWidget, text: cstring): pango.PLayout{. - cdecl, dynlib: lib, importc: "gtk_widget_create_pango_layout".} -proc render_icon*(widget: PWidget, stock_id: cstring, size: TIconSize, - detail: cstring): gdk2pixbuf.PPixbuf{.cdecl, dynlib: lib, - importc: "gtk_widget_render_icon".} -proc set_composite_name*(widget: PWidget, name: cstring){.cdecl, - dynlib: lib, importc: "gtk_widget_set_composite_name".} -proc get_composite_name*(widget: PWidget): cstring{.cdecl, dynlib: lib, - importc: "gtk_widget_get_composite_name".} -proc reset_rc_styles*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_reset_rc_styles".} -proc widget_push_colormap*(cmap: gdk2.PColormap){.cdecl, dynlib: lib, - importc: "gtk_widget_push_colormap".} -proc widget_push_composite_child*(){.cdecl, dynlib: lib, - importc: "gtk_widget_push_composite_child".} -proc widget_pop_composite_child*(){.cdecl, dynlib: lib, - importc: "gtk_widget_pop_composite_child".} -proc widget_pop_colormap*(){.cdecl, dynlib: lib, - importc: "gtk_widget_pop_colormap".} -proc install_style_property*(klass: PWidgetClass, - pspec: PGParamSpec){.cdecl, dynlib: lib, - importc: "gtk_widget_class_install_style_property".} -proc install_style_property_parser*(klass: PWidgetClass, - pspec: PGParamSpec, parser: TRcPropertyParser){.cdecl, dynlib: lib, - importc: "gtk_widget_class_install_style_property_parser".} -proc find_style_property*(klass: PWidgetClass, - property_name: cstring): PGParamSpec{. - cdecl, dynlib: lib, importc: "gtk_widget_class_find_style_property".} -proc list_style_properties*(klass: PWidgetClass, - n_properties: Pguint): PPGParamSpec{.cdecl, dynlib: lib, - importc: "gtk_widget_class_list_style_properties".} -proc style_get_property*(widget: PWidget, property_name: cstring, - value: PGValue){.cdecl, dynlib: lib, - importc: "gtk_widget_style_get_property".} -proc widget_set_default_colormap*(colormap: gdk2.PColormap){.cdecl, dynlib: lib, - importc: "gtk_widget_set_default_colormap".} -proc widget_get_default_style*(): PStyle{.cdecl, dynlib: lib, - importc: "gtk_widget_get_default_style".} -proc set_direction*(widget: PWidget, dir: TTextDirection){.cdecl, - dynlib: lib, importc: "gtk_widget_set_direction".} -proc get_direction*(widget: PWidget): TTextDirection{.cdecl, dynlib: lib, - importc: "gtk_widget_get_direction".} -proc widget_set_default_direction*(dir: TTextDirection){.cdecl, dynlib: lib, - importc: "gtk_widget_set_default_direction".} -proc widget_get_default_direction*(): TTextDirection{.cdecl, dynlib: lib, - importc: "gtk_widget_get_default_direction".} -proc shape_combine_mask*(widget: PWidget, shape_mask: gdk2.PBitmap, - offset_x: gint, offset_y: gint){.cdecl, - dynlib: lib, importc: "gtk_widget_shape_combine_mask".} -proc reset_shapes*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_reset_shapes".} -proc path*(widget: PWidget, path_length: Pguint, path: PPgchar, - path_reversed: PPgchar){.cdecl, dynlib: lib, - importc: "gtk_widget_path".} -proc class_path*(widget: PWidget, path_length: Pguint, path: PPgchar, - path_reversed: PPgchar){.cdecl, dynlib: lib, - importc: "gtk_widget_class_path".} -proc requisition_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_requisition_get_type".} -proc copy*(requisition: PRequisition): PRequisition{.cdecl, - dynlib: lib, importc: "gtk_requisition_copy".} -proc free*(requisition: PRequisition){.cdecl, dynlib: lib, - importc: "gtk_requisition_free".} -proc get_aux_info*(widget: PWidget, create: gboolean): PWidgetAuxInfo{. - cdecl, dynlib: lib, importc: "gtk_widget_get_aux_info".} -proc propagate_hierarchy_changed*(widget: PWidget, - previous_toplevel: PWidget){.cdecl, dynlib: lib, importc: "_gtk_widget_propagate_hierarchy_changed".} -proc widget_peek_colormap*(): gdk2.PColormap{.cdecl, dynlib: lib, - importc: "_gtk_widget_peek_colormap".} -proc TYPE_MISC*(): GType -proc MISC*(obj: pointer): PMisc -proc MISC_CLASS*(klass: pointer): PMiscClass -proc IS_MISC*(obj: pointer): bool -proc IS_MISC_CLASS*(klass: pointer): bool -proc MISC_GET_CLASS*(obj: pointer): PMiscClass -proc misc_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_misc_get_type".} -proc set_alignment*(misc: PMisc, xalign: gfloat, yalign: gfloat){.cdecl, - dynlib: lib, importc: "gtk_misc_set_alignment".} -proc get_alignment*(misc: PMisc, xalign, yalign: var Pgfloat){.cdecl, - dynlib: lib, importc: "gtk_misc_get_alignment".} -proc set_padding*(misc: PMisc, xpad: gint, ypad: gint){.cdecl, dynlib: lib, - importc: "gtk_misc_set_padding".} -proc get_padding*(misc: PMisc, xpad, ypad: var Pgint){.cdecl, dynlib: lib, - importc: "gtk_misc_get_padding".} -const - ACCEL_VISIBLE* = 1 shl 0 - ACCEL_LOCKED* = 1 shl 1 - ACCEL_MASK* = 0x00000007 - bm_TGtkAccelKey_accel_flags* = 0xFFFF'i16 - bp_TGtkAccelKey_accel_flags* = 0'i16 - -proc TYPE_ACCEL_GROUP*(): GType -proc ACCEL_GROUP*(anObject: pointer): PAccelGroup -proc ACCEL_GROUP_CLASS*(klass: pointer): PAccelGroupClass -proc IS_ACCEL_GROUP*(anObject: pointer): bool -proc IS_ACCEL_GROUP_CLASS*(klass: pointer): bool -proc ACCEL_GROUP_GET_CLASS*(obj: pointer): PAccelGroupClass -proc accel_flags*(a: PAccelKey): guint -proc set_accel_flags*(a: PAccelKey, `accel_flags`: guint) -proc accel_group_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_accel_group_get_type".} -proc accel_group_new*(): PAccelGroup{.cdecl, dynlib: lib, - importc: "gtk_accel_group_new".} -proc lock*(accel_group: PAccelGroup){.cdecl, dynlib: lib, - importc: "gtk_accel_group_lock".} -proc unlock*(accel_group: PAccelGroup){.cdecl, dynlib: lib, - importc: "gtk_accel_group_unlock".} -proc connect*(accel_group: PAccelGroup, accel_key: guint, - accel_mods: gdk2.TModifierType, - accel_flags: TAccelFlags, closure: PGClosure){.cdecl, - dynlib: lib, importc: "gtk_accel_group_connect".} -proc connect_by_path*(accel_group: PAccelGroup, accel_path: cstring, - closure: PGClosure){.cdecl, dynlib: lib, - importc: "gtk_accel_group_connect_by_path".} -proc disconnect*(accel_group: PAccelGroup, closure: PGClosure): gboolean{. - cdecl, dynlib: lib, importc: "gtk_accel_group_disconnect".} -proc disconnect_key*(accel_group: PAccelGroup, accel_key: guint, - accel_mods: gdk2.TModifierType): gboolean{.cdecl, - dynlib: lib, importc: "gtk_accel_group_disconnect_key".} -proc attach*(accel_group: PAccelGroup, anObject: PGObject){.cdecl, - dynlib: lib, importc: "_gtk_accel_group_attach".} -proc detach*(accel_group: PAccelGroup, anObject: PGObject){.cdecl, - dynlib: lib, importc: "_gtk_accel_group_detach".} -proc accel_groups_activate*(anObject: PGObject, accel_key: guint, - accel_mods: gdk2.TModifierType): gboolean{.cdecl, - dynlib: lib, importc: "gtk_accel_groups_activate".} -proc accel_groups_from_object*(anObject: PGObject): PGSList{.cdecl, dynlib: lib, - importc: "gtk_accel_groups_from_object".} -proc find*(accel_group: PAccelGroup, - find_func: Taccel_group_find_func, data: gpointer): PAccelKey{. - cdecl, dynlib: lib, importc: "gtk_accel_group_find".} -proc accel_group_from_accel_closure*(closure: PGClosure): PAccelGroup{.cdecl, - dynlib: lib, importc: "gtk_accel_group_from_accel_closure".} -proc accelerator_valid*(keyval: guint, modifiers: gdk2.TModifierType): gboolean{. - cdecl, dynlib: lib, importc: "gtk_accelerator_valid".} -proc accelerator_parse*(accelerator: cstring, accelerator_key: Pguint, - accelerator_mods: gdk2.PModifierType){.cdecl, dynlib: lib, - importc: "gtk_accelerator_parse".} -proc accelerator_name*(accelerator_key: guint, - accelerator_mods: gdk2.TModifierType): cstring{.cdecl, - dynlib: lib, importc: "gtk_accelerator_name".} -proc accelerator_set_default_mod_mask*(default_mod_mask: gdk2.TModifierType){. - cdecl, dynlib: lib, importc: "gtk_accelerator_set_default_mod_mask".} -proc accelerator_get_default_mod_mask*(): guint{.cdecl, dynlib: lib, - importc: "gtk_accelerator_get_default_mod_mask".} -proc query*(accel_group: PAccelGroup, accel_key: guint, - accel_mods: gdk2.TModifierType, n_entries: Pguint): PAccelGroupEntry{. - cdecl, dynlib: lib, importc: "gtk_accel_group_query".} -proc reconnect*(accel_group: PAccelGroup, accel_path_quark: TGQuark){. - cdecl, dynlib: lib, importc: "_gtk_accel_group_reconnect".} -const - bm_TGtkContainer_border_width* = 0x0000FFFF'i32 - bp_TGtkContainer_border_width* = 0'i32 - bm_TGtkContainer_need_resize* = 0x00010000'i32 - bp_TGtkContainer_need_resize* = 16'i32 - bm_TGtkContainer_resize_mode* = 0x00060000'i32 - bp_TGtkContainer_resize_mode* = 17'i32 - bm_TGtkContainer_reallocate_redraws* = 0x00080000'i32 - bp_TGtkContainer_reallocate_redraws* = 19'i32 - bm_TGtkContainer_has_focus_chain* = 0x00100000'i32 - bp_TGtkContainer_has_focus_chain* = 20'i32 - -proc TYPE_CONTAINER*(): GType -proc CONTAINER*(obj: pointer): PContainer -proc CONTAINER_CLASS*(klass: pointer): PContainerClass -proc IS_CONTAINER*(obj: pointer): bool -proc IS_CONTAINER_CLASS*(klass: pointer): bool -proc CONTAINER_GET_CLASS*(obj: pointer): PContainerClass -proc IS_RESIZE_CONTAINER*(widget: pointer): bool -proc border_width*(a: PContainer): guint -proc need_resize*(a: PContainer): guint -proc set_need_resize*(a: PContainer, `need_resize`: guint) -proc resize_mode*(a: PContainer): guint -proc set_resize_mode*(a: PContainer, `resize_mode`: guint) -proc reallocate_redraws*(a: PContainer): guint -proc set_reallocate_redraws*(a: PContainer, `reallocate_redraws`: guint) -proc has_focus_chain*(a: PContainer): guint -proc set_has_focus_chain*(a: PContainer, `has_focus_chain`: guint) -proc container_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_container_get_type".} -proc set_border_width*(container: PContainer, border_width: guint){. - cdecl, dynlib: lib, importc: "gtk_container_set_border_width".} -proc get_border_width*(container: PContainer): guint{.cdecl, - dynlib: lib, importc: "gtk_container_get_border_width".} -proc add*(container: PContainer, widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_container_add".} -proc remove*(container: PContainer, widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_container_remove".} -proc set_resize_mode*(container: PContainer, resize_mode: TResizeMode){. - cdecl, dynlib: lib, importc: "gtk_container_set_resize_mode".} -proc get_resize_mode*(container: PContainer): TResizeMode{.cdecl, - dynlib: lib, importc: "gtk_container_get_resize_mode".} -proc check_resize*(container: PContainer){.cdecl, dynlib: lib, - importc: "gtk_container_check_resize".} -proc foreach*(container: PContainer, callback: TCallback, - callback_data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_container_foreach".} -proc get_children*(container: PContainer): PGList{.cdecl, dynlib: lib, - importc: "gtk_container_get_children".} -proc propagate_expose*(container: PContainer, child: PWidget, - event: gdk2.PEventExpose){.cdecl, dynlib: lib, - importc: "gtk_container_propagate_expose".} -proc set_focus_chain*(container: PContainer, focusable_widgets: PGList){. - cdecl, dynlib: lib, importc: "gtk_container_set_focus_chain".} -proc get_focus_chain*(container: PContainer, s: var PGList): gboolean{. - cdecl, dynlib: lib, importc: "gtk_container_get_focus_chain".} -proc unset_focus_chain*(container: PContainer){.cdecl, dynlib: lib, - importc: "gtk_container_unset_focus_chain".} -proc set_reallocate_redraws*(container: PContainer, - needs_redraws: gboolean){.cdecl, - dynlib: lib, importc: "gtk_container_set_reallocate_redraws".} -proc set_focus_child*(container: PContainer, child: PWidget){.cdecl, - dynlib: lib, importc: "gtk_container_set_focus_child".} -proc set_focus_vadjustment*(container: PContainer, - adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_container_set_focus_vadjustment".} -proc get_focus_vadjustment*(container: PContainer): PAdjustment{. - cdecl, dynlib: lib, importc: "gtk_container_get_focus_vadjustment".} -proc set_focus_hadjustment*(container: PContainer, - adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_container_set_focus_hadjustment".} -proc get_focus_hadjustment*(container: PContainer): PAdjustment{. - cdecl, dynlib: lib, importc: "gtk_container_get_focus_hadjustment".} -proc resize_children*(container: PContainer){.cdecl, dynlib: lib, - importc: "gtk_container_resize_children".} -proc child_type*(container: PContainer): TType{.cdecl, dynlib: lib, - importc: "gtk_container_child_type".} -proc install_child_property*(cclass: PContainerClass, - property_id: guint, pspec: PGParamSpec){.cdecl, dynlib: lib, - importc: "gtk_container_class_install_child_property".} -proc container_class_find_child_property*(cclass: PGObjectClass, - property_name: cstring): PGParamSpec{.cdecl, dynlib: lib, - importc: "gtk_container_class_find_child_property".} -proc container_class_list_child_properties*(cclass: PGObjectClass, - n_properties: Pguint): PPGParamSpec{.cdecl, dynlib: lib, - importc: "gtk_container_class_list_child_properties".} -proc child_set_property*(container: PContainer, child: PWidget, - property_name: cstring, value: PGValue){. - cdecl, dynlib: lib, importc: "gtk_container_child_set_property".} -proc child_get_property*(container: PContainer, child: PWidget, - property_name: cstring, value: PGValue){. - cdecl, dynlib: lib, importc: "gtk_container_child_get_property".} -proc CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID*(anObject: pointer, - property_id: guint, pspec: pointer) -proc forall*(container: PContainer, callback: TCallback, - callback_data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_container_forall".} -proc queue_resize*(container: PContainer){.cdecl, dynlib: lib, - importc: "_gtk_container_queue_resize".} -proc clear_resize_widgets*(container: PContainer){.cdecl, dynlib: lib, - importc: "_gtk_container_clear_resize_widgets".} -proc child_composite_name*(container: PContainer, child: PWidget): cstring{. - cdecl, dynlib: lib, importc: "_gtk_container_child_composite_name".} -proc dequeue_resize_handler*(container: PContainer){.cdecl, - dynlib: lib, importc: "_gtk_container_dequeue_resize_handler".} -proc focus_sort*(container: PContainer, children: PGList, - direction: TDirectionType, old_focus: PWidget): PGList{. - cdecl, dynlib: lib, importc: "_gtk_container_focus_sort".} -proc TYPE_BIN*(): GType -proc BIN*(obj: pointer): PBin -proc BIN_CLASS*(klass: pointer): PBinClass -proc IS_BIN*(obj: pointer): bool -proc IS_BIN_CLASS*(klass: pointer): bool -proc BIN_GET_CLASS*(obj: pointer): PBinClass -proc bin_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_bin_get_type".} -proc get_child*(bin: PBin): PWidget{.cdecl, dynlib: lib, - importc: "gtk_bin_get_child".} -const - bm_TGtkWindow_allow_shrink* = 0x00000001'i32 - bp_TGtkWindow_allow_shrink* = 0'i32 - bm_TGtkWindow_allow_grow* = 0x00000002'i32 - bp_TGtkWindow_allow_grow* = 1'i32 - bm_TGtkWindow_configure_notify_received* = 0x00000004'i32 - bp_TGtkWindow_configure_notify_received* = 2'i32 - bm_TGtkWindow_need_default_position* = 0x00000008'i32 - bp_TGtkWindow_need_default_position* = 3'i32 - bm_TGtkWindow_need_default_size* = 0x00000010'i32 - bp_TGtkWindow_need_default_size* = 4'i32 - bm_TGtkWindow_position* = 0x000000E0'i32 - bp_TGtkWindow_position* = 5'i32 - bm_TGtkWindow_type* = 0x00000F00'i32 - bp_TGtkWindow_type* = 8'i32 - bm_TGtkWindow_has_user_ref_count* = 0x00001000'i32 - bp_TGtkWindow_has_user_ref_count* = 12'i32 - bm_TGtkWindow_has_focus* = 0x00002000'i32 - bp_TGtkWindow_has_focus* = 13'i32 - bm_TGtkWindow_modal* = 0x00004000'i32 - bp_TGtkWindow_modal* = 14'i32 - bm_TGtkWindow_destroy_with_parent* = 0x00008000'i32 - bp_TGtkWindow_destroy_with_parent* = 15'i32 - bm_TGtkWindow_has_frame* = 0x00010000'i32 - bp_TGtkWindow_has_frame* = 16'i32 - bm_TGtkWindow_iconify_initially* = 0x00020000'i32 - bp_TGtkWindow_iconify_initially* = 17'i32 - bm_TGtkWindow_stick_initially* = 0x00040000'i32 - bp_TGtkWindow_stick_initially* = 18'i32 - bm_TGtkWindow_maximize_initially* = 0x00080000'i32 - bp_TGtkWindow_maximize_initially* = 19'i32 - bm_TGtkWindow_decorated* = 0x00100000'i32 - bp_TGtkWindow_decorated* = 20'i32 - bm_TGtkWindow_type_hint* = 0x00E00000'i32 - bp_TGtkWindow_type_hint* = 21'i32 - bm_TGtkWindow_gravity* = 0x1F000000'i32 - bp_TGtkWindow_gravity* = 24'i32 - -proc TYPE_WINDOW*(): GType -proc WINDOW*(obj: pointer): PWindow -proc WINDOW_CLASS*(klass: pointer): PWindowClass -proc IS_WINDOW*(obj: pointer): bool -proc IS_WINDOW_CLASS*(klass: pointer): bool -proc WINDOW_GET_CLASS*(obj: pointer): PWindowClass -proc allow_shrink*(a: gtk2.PWindow): guint -proc set_allow_shrink*(a: gtk2.PWindow, `allow_shrink`: guint) -proc allow_grow*(a: gtk2.PWindow): guint -proc set_allow_grow*(a: gtk2.PWindow, `allow_grow`: guint) -proc configure_notify_received*(a: gtk2.PWindow): guint -proc set_configure_notify_received*(a: gtk2.PWindow, - `configure_notify_received`: guint) -proc need_default_position*(a: gtk2.PWindow): guint -proc set_need_default_position*(a: gtk2.PWindow, `need_default_position`: guint) -proc need_default_size*(a: gtk2.PWindow): guint -proc set_need_default_size*(a: gtk2.PWindow, `need_default_size`: guint) -proc position*(a: gtk2.PWindow): guint -proc get_type*(a: gtk2.PWindow): guint -proc set_type*(a: gtk2.PWindow, `type`: guint) -proc has_user_ref_count*(a: gtk2.PWindow): guint -proc set_has_user_ref_count*(a: gtk2.PWindow, `has_user_ref_count`: guint) -proc has_focus*(a: gtk2.PWindow): guint -proc set_has_focus*(a: gtk2.PWindow, `has_focus`: guint) -proc modal*(a: gtk2.PWindow): guint -proc set_modal*(a: gtk2.PWindow, `modal`: guint) -proc destroy_with_parent*(a: gtk2.PWindow): guint -proc set_destroy_with_parent*(a: gtk2.PWindow, `destroy_with_parent`: guint) -proc has_frame*(a: gtk2.PWindow): guint -proc set_has_frame*(a: gtk2.PWindow, `has_frame`: guint) -proc iconify_initially*(a: gtk2.PWindow): guint -proc set_iconify_initially*(a: gtk2.PWindow, `iconify_initially`: guint) -proc stick_initially*(a: gtk2.PWindow): guint -proc set_stick_initially*(a: gtk2.PWindow, `stick_initially`: guint) -proc maximize_initially*(a: gtk2.PWindow): guint -proc set_maximize_initially*(a: gtk2.PWindow, `maximize_initially`: guint) -proc decorated*(a: gtk2.PWindow): guint -proc set_decorated*(a: gtk2.PWindow, `decorated`: guint) -proc type_hint*(a: gtk2.PWindow): guint -proc set_type_hint*(a: gtk2.PWindow, `type_hint`: guint) -proc gravity*(a: gtk2.PWindow): guint -proc set_gravity*(a: gtk2.PWindow, `gravity`: guint) -proc TYPE_WINDOW_GROUP*(): GType -proc WINDOW_GROUP*(anObject: pointer): PWindowGroup -proc WINDOW_GROUP_CLASS*(klass: pointer): PWindowGroupClass -proc IS_WINDOW_GROUP*(anObject: pointer): bool -proc IS_WINDOW_GROUP_CLASS*(klass: pointer): bool -proc WINDOW_GROUP_GET_CLASS*(obj: pointer): PWindowGroupClass -proc window_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_window_get_type".} -proc window_new*(thetype: TWindowType): PWindow{.cdecl, dynlib: lib, - importc: "gtk_window_new".} -proc set_title*(window: PWindow, title: cstring){.cdecl, dynlib: lib, - importc: "gtk_window_set_title".} -proc get_title*(window: PWindow): cstring{.cdecl, dynlib: lib, - importc: "gtk_window_get_title".} -proc set_wmclass*(window: PWindow, wmclass_name: cstring, - wmclass_class: cstring){.cdecl, dynlib: lib, - importc: "gtk_window_set_wmclass".} -proc set_role*(window: PWindow, role: cstring){.cdecl, dynlib: lib, - importc: "gtk_window_set_role".} -proc get_role*(window: PWindow): cstring{.cdecl, dynlib: lib, - importc: "gtk_window_get_role".} -proc add_accel_group*(window: PWindow, accel_group: PAccelGroup){.cdecl, - dynlib: lib, importc: "gtk_window_add_accel_group".} -proc remove_accel_group*(window: PWindow, accel_group: PAccelGroup){. - cdecl, dynlib: lib, importc: "gtk_window_remove_accel_group".} -proc set_position*(window: PWindow, position: TWindowPosition){.cdecl, - dynlib: lib, importc: "gtk_window_set_position".} -proc activate_focus*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gtk_window_activate_focus".} -proc set_focus*(window: PWindow, focus: PWidget){.cdecl, dynlib: lib, - importc: "gtk_window_set_focus".} -proc get_focus*(window: PWindow): PWidget{.cdecl, dynlib: lib, - importc: "gtk_window_get_focus".} -proc set_default*(window: PWindow, default_widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_window_set_default".} -proc activate_default*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gtk_window_activate_default".} -proc set_transient_for*(window: PWindow, parent: PWindow){.cdecl, - dynlib: lib, importc: "gtk_window_set_transient_for".} -proc get_transient_for*(window: PWindow): PWindow{.cdecl, dynlib: lib, - importc: "gtk_window_get_transient_for".} -proc set_type_hint*(window: PWindow, hint: gdk2.TWindowTypeHint){.cdecl, - dynlib: lib, importc: "gtk_window_set_type_hint".} -proc get_type_hint*(window: PWindow): gdk2.TWindowTypeHint{.cdecl, - dynlib: lib, importc: "gtk_window_get_type_hint".} -proc set_destroy_with_parent*(window: PWindow, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_window_set_destroy_with_parent".} -proc get_destroy_with_parent*(window: PWindow): gboolean{.cdecl, - dynlib: lib, importc: "gtk_window_get_destroy_with_parent".} -proc set_resizable*(window: PWindow, resizable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_window_set_resizable".} -proc get_resizable*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gtk_window_get_resizable".} -proc set_gravity*(window: PWindow, gravity: gdk2.TGravity){.cdecl, - dynlib: lib, importc: "gtk_window_set_gravity".} -proc get_gravity*(window: PWindow): gdk2.TGravity{.cdecl, dynlib: lib, - importc: "gtk_window_get_gravity".} -proc set_geometry_hints*(window: PWindow, geometry_widget: PWidget, - geometry: gdk2.PGeometry, - geom_mask: gdk2.TWindowHints){.cdecl, dynlib: lib, - importc: "gtk_window_set_geometry_hints".} -proc set_screen*(window: PWindow, screen: gdk2.PScreen){.cdecl, - dynlib: lib, importc: "gtk_window_set_screen".} -proc get_screen*(window: PWindow): gdk2.PScreen{.cdecl, dynlib: lib, - importc: "gtk_window_get_screen".} -proc set_has_frame*(window: PWindow, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_window_set_has_frame".} -proc get_has_frame*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gtk_window_get_has_frame".} -proc set_frame_dimensions*(window: PWindow, left: gint, top: gint, - right: gint, bottom: gint){.cdecl, - dynlib: lib, importc: "gtk_window_set_frame_dimensions".} -proc get_frame_dimensions*(window: PWindow, left: Pgint, top: Pgint, - right: Pgint, bottom: Pgint){.cdecl, - dynlib: lib, importc: "gtk_window_get_frame_dimensions".} -proc set_decorated*(window: PWindow, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_window_set_decorated".} -proc get_decorated*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gtk_window_get_decorated".} -proc set_icon_list*(window: PWindow, list: PGList){.cdecl, dynlib: lib, - importc: "gtk_window_set_icon_list".} -proc get_icon_list*(window: PWindow): PGList{.cdecl, dynlib: lib, - importc: "gtk_window_get_icon_list".} -proc set_icon*(window: PWindow, icon: gdk2pixbuf.PPixbuf){.cdecl, dynlib: lib, - importc: "gtk_window_set_icon".} -proc get_icon*(window: PWindow): gdk2pixbuf.PPixbuf{.cdecl, dynlib: lib, - importc: "gtk_window_get_icon".} -proc window_set_default_icon_list*(list: PGList){.cdecl, dynlib: lib, - importc: "gtk_window_set_default_icon_list".} -proc window_get_default_icon_list*(): PGList{.cdecl, dynlib: lib, - importc: "gtk_window_get_default_icon_list".} -proc set_modal*(window: PWindow, modal: gboolean){.cdecl, dynlib: lib, - importc: "gtk_window_set_modal".} -proc get_modal*(window: PWindow): gboolean{.cdecl, dynlib: lib, - importc: "gtk_window_get_modal".} -proc window_list_toplevels*(): PGList{.cdecl, dynlib: lib, - importc: "gtk_window_list_toplevels".} -proc add_mnemonic*(window: PWindow, keyval: guint, target: PWidget){. - cdecl, dynlib: lib, importc: "gtk_window_add_mnemonic".} -proc remove_mnemonic*(window: PWindow, keyval: guint, target: PWidget){. - cdecl, dynlib: lib, importc: "gtk_window_remove_mnemonic".} -proc mnemonic_activate*(window: PWindow, keyval: guint, - modifier: gdk2.TModifierType): gboolean{.cdecl, - dynlib: lib, importc: "gtk_window_mnemonic_activate".} -proc set_mnemonic_modifier*(window: PWindow, modifier: gdk2.TModifierType){. - cdecl, dynlib: lib, importc: "gtk_window_set_mnemonic_modifier".} -proc get_mnemonic_modifier*(window: PWindow): gdk2.TModifierType{.cdecl, - dynlib: lib, importc: "gtk_window_get_mnemonic_modifier".} -proc present*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_present".} -proc iconify*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_iconify".} -proc deiconify*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_deiconify".} -proc stick*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_stick".} -proc unstick*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_unstick".} -proc maximize*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_maximize".} -proc unmaximize*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_unmaximize".} -proc begin_resize_drag*(window: PWindow, edge: gdk2.TWindowEdge, - button: gint, root_x: gint, root_y: gint, - timestamp: guint32){.cdecl, dynlib: lib, - importc: "gtk_window_begin_resize_drag".} -proc begin_move_drag*(window: PWindow, button: gint, root_x: gint, - root_y: gint, timestamp: guint32){.cdecl, - dynlib: lib, importc: "gtk_window_begin_move_drag".} -proc set_default_size*(window: PWindow, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "gtk_window_set_default_size".} -proc get_default_size*(window: PWindow, width: Pgint, height: Pgint){. - cdecl, dynlib: lib, importc: "gtk_window_get_default_size".} -proc resize*(window: PWindow, width: gint, height: gint){.cdecl, - dynlib: lib, importc: "gtk_window_resize".} -proc get_size*(window: PWindow, width: Pgint, height: Pgint){.cdecl, - dynlib: lib, importc: "gtk_window_get_size".} -proc move*(window: PWindow, x: gint, y: gint){.cdecl, dynlib: lib, - importc: "gtk_window_move".} -proc get_position*(window: PWindow, root_x: Pgint, root_y: Pgint){.cdecl, - dynlib: lib, importc: "gtk_window_get_position".} -proc parse_geometry*(window: PWindow, geometry: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_window_parse_geometry".} -proc reshow_with_initial_size*(window: PWindow){.cdecl, dynlib: lib, - importc: "gtk_window_reshow_with_initial_size".} -proc window_group_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_window_group_get_type".} -proc window_group_new*(): PWindowGroup{.cdecl, dynlib: lib, - importc: "gtk_window_group_new".} -proc add_window*(window_group: PWindowGroup, window: PWindow){. - cdecl, dynlib: lib, importc: "gtk_window_group_add_window".} -proc remove_window*(window_group: PWindowGroup, window: PWindow){. - cdecl, dynlib: lib, importc: "gtk_window_group_remove_window".} -proc window_set_default_icon_name*(name: cstring){.cdecl, dynlib: lib, - importc: "gtk_window_set_default_icon_name".} -proc internal_set_focus*(window: PWindow, focus: PWidget){.cdecl, - dynlib: lib, importc: "_gtk_window_internal_set_focus".} -proc remove_embedded_xid*(window: PWindow, xid: guint){.cdecl, - dynlib: lib, importc: "gtk_window_remove_embedded_xid".} -proc add_embedded_xid*(window: PWindow, xid: guint){.cdecl, dynlib: lib, - importc: "gtk_window_add_embedded_xid".} -proc reposition*(window: PWindow, x: gint, y: gint){.cdecl, dynlib: lib, - importc: "_gtk_window_reposition".} -proc constrain_size*(window: PWindow, width: gint, height: gint, - new_width: Pgint, new_height: Pgint){.cdecl, - dynlib: lib, importc: "_gtk_window_constrain_size".} -proc get_group*(window: PWindow): PWindowGroup{.cdecl, dynlib: lib, - importc: "_gtk_window_get_group".} -proc activate_key*(window: PWindow, event: gdk2.PEventKey): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_window_activate_key".} -proc keys_foreach*(window: PWindow, func: TWindowKeysForeachFunc, - func_data: gpointer){.cdecl, dynlib: lib, - importc: "_gtk_window_keys_foreach".} -proc query_nonaccels*(window: PWindow, accel_key: guint, - accel_mods: gdk2.TModifierType): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_window_query_nonaccels".} -const - bm_TGtkLabel_jtype* = 0x0003'i16 - bp_TGtkLabel_jtype* = 0'i16 - bm_TGtkLabel_wrap* = 0x0004'i16 - bp_TGtkLabel_wrap* = 2'i16 - bm_TGtkLabel_use_underline* = 0x0008'i16 - bp_TGtkLabel_use_underline* = 3'i16 - bm_TGtkLabel_use_markup* = 0x0010'i16 - bp_TGtkLabel_use_markup* = 4'i16 - -proc TYPE_LABEL*(): GType -proc LABEL*(obj: pointer): PLabel -proc LABEL_CLASS*(klass: pointer): PLabelClass -proc IS_LABEL*(obj: pointer): bool -proc IS_LABEL_CLASS*(klass: pointer): bool -proc LABEL_GET_CLASS*(obj: pointer): PLabelClass -proc jtype*(a: PLabel): guint -proc set_jtype*(a: PLabel, `jtype`: guint) -proc wrap*(a: PLabel): guint -proc set_wrap*(a: PLabel, `wrap`: guint) -proc use_underline*(a: PLabel): guint -proc set_use_underline*(a: PLabel, `use_underline`: guint) -proc use_markup*(a: PLabel): guint -proc set_use_markup*(a: PLabel, `use_markup`: guint) -proc label_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_label_get_type".} -proc label_new*(str: cstring): PLabel{.cdecl, dynlib: lib, - importc: "gtk_label_new".} -proc label_new_with_mnemonic*(str: cstring): PLabel{.cdecl, dynlib: lib, - importc: "gtk_label_new_with_mnemonic".} -proc set_text*(`label`: PLabel, str: cstring){.cdecl, dynlib: lib, - importc: "gtk_label_set_text".} -proc get_text*(`label`: PLabel): cstring{.cdecl, dynlib: lib, - importc: "gtk_label_get_text".} -proc set_attributes*(`label`: PLabel, attrs: pango.PAttrList){.cdecl, - dynlib: lib, importc: "gtk_label_set_attributes".} -proc get_attributes*(`label`: PLabel): pango.PAttrList{.cdecl, dynlib: lib, - importc: "gtk_label_get_attributes".} -proc set_label*(`label`: PLabel, str: cstring){.cdecl, dynlib: lib, - importc: "gtk_label_set_label".} -proc get_label*(`label`: PLabel): cstring{.cdecl, dynlib: lib, - importc: "gtk_label_get_label".} -proc set_markup*(`label`: PLabel, str: cstring){.cdecl, dynlib: lib, - importc: "gtk_label_set_markup".} -proc set_use_markup*(`label`: PLabel, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_label_set_use_markup".} -proc get_use_markup*(`label`: PLabel): gboolean{.cdecl, dynlib: lib, - importc: "gtk_label_get_use_markup".} -proc set_use_underline*(`label`: PLabel, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_label_set_use_underline".} -proc get_use_underline*(`label`: PLabel): gboolean{.cdecl, dynlib: lib, - importc: "gtk_label_get_use_underline".} -proc set_markup_with_mnemonic*(`label`: PLabel, str: cstring){.cdecl, - dynlib: lib, importc: "gtk_label_set_markup_with_mnemonic".} -proc get_mnemonic_keyval*(`label`: PLabel): guint{.cdecl, dynlib: lib, - importc: "gtk_label_get_mnemonic_keyval".} -proc set_mnemonic_widget*(`label`: PLabel, widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_label_set_mnemonic_widget".} -proc get_mnemonic_widget*(`label`: PLabel): PWidget{.cdecl, dynlib: lib, - importc: "gtk_label_get_mnemonic_widget".} -proc set_text_with_mnemonic*(`label`: PLabel, str: cstring){.cdecl, - dynlib: lib, importc: "gtk_label_set_text_with_mnemonic".} -proc set_justify*(`label`: PLabel, jtype: TJustification){.cdecl, - dynlib: lib, importc: "gtk_label_set_justify".} -proc get_justify*(`label`: PLabel): TJustification{.cdecl, dynlib: lib, - importc: "gtk_label_get_justify".} -proc set_pattern*(`label`: PLabel, pattern: cstring){.cdecl, dynlib: lib, - importc: "gtk_label_set_pattern".} -proc set_line_wrap*(`label`: PLabel, wrap: gboolean){.cdecl, dynlib: lib, - importc: "gtk_label_set_line_wrap".} -proc get_line_wrap*(`label`: PLabel): gboolean{.cdecl, dynlib: lib, - importc: "gtk_label_get_line_wrap".} -proc set_selectable*(`label`: PLabel, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_label_set_selectable".} -proc get_selectable*(`label`: PLabel): gboolean{.cdecl, dynlib: lib, - importc: "gtk_label_get_selectable".} -proc select_region*(`label`: PLabel, start_offset: gint, end_offset: gint){. - cdecl, dynlib: lib, importc: "gtk_label_select_region".} -proc get_selection_bounds*(`label`: PLabel, start: Pgint, theEnd: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_label_get_selection_bounds".} -proc get_layout*(`label`: PLabel): pango.PLayout{.cdecl, dynlib: lib, - importc: "gtk_label_get_layout".} -proc get_layout_offsets*(`label`: PLabel, x: Pgint, y: Pgint){.cdecl, - dynlib: lib, importc: "gtk_label_get_layout_offsets".} -const - bm_TGtkAccelLabelClass_latin1_to_char* = 0x0001'i16 - bp_TGtkAccelLabelClass_latin1_to_char* = 0'i16 - -proc TYPE_ACCEL_LABEL*(): GType -proc ACCEL_LABEL*(obj: pointer): PAccelLabel -proc ACCEL_LABEL_CLASS*(klass: pointer): PAccelLabelClass -proc IS_ACCEL_LABEL*(obj: pointer): bool -proc IS_ACCEL_LABEL_CLASS*(klass: pointer): bool -proc ACCEL_LABEL_GET_CLASS*(obj: pointer): PAccelLabelClass -proc latin1_to_char*(a: PAccelLabelClass): guint -proc set_latin1_to_char*(a: PAccelLabelClass, `latin1_to_char`: guint) -proc accel_label_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_accel_label_get_type".} -proc accel_label_new*(`string`: cstring): PAccelLabel{.cdecl, dynlib: lib, - importc: "gtk_accel_label_new".} -proc get_accel_widget*(accel_label: PAccelLabel): PWidget{.cdecl, - dynlib: lib, importc: "gtk_accel_label_get_accel_widget".} -proc get_accel_width*(accel_label: PAccelLabel): guint{.cdecl, - dynlib: lib, importc: "gtk_accel_label_get_accel_width".} -proc set_accel_widget*(accel_label: PAccelLabel, - accel_widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_accel_label_set_accel_widget".} -proc set_accel_closure*(accel_label: PAccelLabel, - accel_closure: PGClosure){.cdecl, - dynlib: lib, importc: "gtk_accel_label_set_accel_closure".} -proc refetch*(accel_label: PAccelLabel): gboolean{.cdecl, - dynlib: lib, importc: "gtk_accel_label_refetch".} -proc accel_map_add_entry*(accel_path: cstring, accel_key: guint, - accel_mods: gdk2.TModifierType){.cdecl, dynlib: lib, - importc: "gtk_accel_map_add_entry".} -proc accel_map_lookup_entry*(accel_path: cstring, key: PAccelKey): gboolean{. - cdecl, dynlib: lib, importc: "gtk_accel_map_lookup_entry".} -proc accel_map_change_entry*(accel_path: cstring, accel_key: guint, - accel_mods: gdk2.TModifierType, replace: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_accel_map_change_entry".} -proc accel_map_load*(file_name: cstring){.cdecl, dynlib: lib, - importc: "gtk_accel_map_load".} -proc accel_map_save*(file_name: cstring){.cdecl, dynlib: lib, - importc: "gtk_accel_map_save".} -proc accel_map_foreach*(data: gpointer, foreach_func: TAccelMapForeach){.cdecl, - dynlib: lib, importc: "gtk_accel_map_foreach".} -proc accel_map_load_fd*(fd: gint){.cdecl, dynlib: lib, - importc: "gtk_accel_map_load_fd".} -proc accel_map_load_scanner*(scanner: PGScanner){.cdecl, dynlib: lib, - importc: "gtk_accel_map_load_scanner".} -proc accel_map_save_fd*(fd: gint){.cdecl, dynlib: lib, - importc: "gtk_accel_map_save_fd".} -proc accel_map_add_filter*(filter_pattern: cstring){.cdecl, dynlib: lib, - importc: "gtk_accel_map_add_filter".} -proc accel_map_foreach_unfiltered*(data: gpointer, - foreach_func: TAccelMapForeach){.cdecl, - dynlib: lib, importc: "gtk_accel_map_foreach_unfiltered".} -proc accel_map_init*(){.cdecl, dynlib: lib, importc: "_gtk_accel_map_init".} -proc accel_map_add_group*(accel_path: cstring, accel_group: PAccelGroup){.cdecl, - dynlib: lib, importc: "_gtk_accel_map_add_group".} -proc accel_map_remove_group*(accel_path: cstring, accel_group: PAccelGroup){. - cdecl, dynlib: lib, importc: "_gtk_accel_map_remove_group".} -proc accel_path_is_valid*(accel_path: cstring): gboolean{.cdecl, dynlib: lib, - importc: "_gtk_accel_path_is_valid".} -proc TYPE_ACCESSIBLE*(): GType -proc ACCESSIBLE*(obj: pointer): PAccessible -proc ACCESSIBLE_CLASS*(klass: pointer): PAccessibleClass -proc IS_ACCESSIBLE*(obj: pointer): bool -proc IS_ACCESSIBLE_CLASS*(klass: pointer): bool -proc ACCESSIBLE_GET_CLASS*(obj: pointer): PAccessibleClass -proc accessible_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_accessible_get_type".} -proc connect_widget_destroyed*(accessible: PAccessible){.cdecl, - dynlib: lib, importc: "gtk_accessible_connect_widget_destroyed".} -proc TYPE_ADJUSTMENT*(): GType -proc ADJUSTMENT*(obj: pointer): PAdjustment -proc ADJUSTMENT_CLASS*(klass: pointer): PAdjustmentClass -proc IS_ADJUSTMENT*(obj: pointer): bool -proc IS_ADJUSTMENT_CLASS*(klass: pointer): bool -proc ADJUSTMENT_GET_CLASS*(obj: pointer): PAdjustmentClass -proc adjustment_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_adjustment_get_type".} -proc adjustment_new*(value: gdouble, lower: gdouble, upper: gdouble, - step_increment: gdouble, page_increment: gdouble, - page_size: gdouble): PAdjustment{.cdecl, dynlib: lib, - importc: "gtk_adjustment_new".} -proc changed*(adjustment: PAdjustment){.cdecl, dynlib: lib, - importc: "gtk_adjustment_changed".} -proc value_changed*(adjustment: PAdjustment){.cdecl, dynlib: lib, - importc: "gtk_adjustment_value_changed".} -proc clamp_page*(adjustment: PAdjustment, lower: gdouble, - upper: gdouble){.cdecl, dynlib: lib, - importc: "gtk_adjustment_clamp_page".} -proc get_value*(adjustment: PAdjustment): gdouble{.cdecl, - dynlib: lib, importc: "gtk_adjustment_get_value".} -proc set_value*(adjustment: PAdjustment, value: gdouble){.cdecl, - dynlib: lib, importc: "gtk_adjustment_set_value".} -proc get_upper*(adjustment: PAdjustment): gdouble{.cdecl, - dynlib: lib, importc: "gtk_adjustment_get_upper".} -proc get_page_size*(adjustment: PAdjustment): gdouble{.cdecl, - dynlib: lib, importc: "gtk_adjustment_get_page_size".} -proc TYPE_ALIGNMENT*(): GType -proc ALIGNMENT*(obj: pointer): PAlignment -proc ALIGNMENT_CLASS*(klass: pointer): PAlignmentClass -proc IS_ALIGNMENT*(obj: pointer): bool -proc IS_ALIGNMENT_CLASS*(klass: pointer): bool -proc ALIGNMENT_GET_CLASS*(obj: pointer): PAlignmentClass -proc alignment_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_alignment_get_type".} -proc alignment_new*(xalign: gfloat, yalign: gfloat, xscale: gfloat, - yscale: gfloat): PAlignment{.cdecl, dynlib: lib, - importc: "gtk_alignment_new".} -proc set*(alignment: PAlignment, xalign: gfloat, yalign: gfloat, - xscale: gfloat, yscale: gfloat){.cdecl, dynlib: lib, - importc: "gtk_alignment_set".} -proc TYPE_FRAME*(): GType -proc FRAME*(obj: pointer): PFrame -proc FRAME_CLASS*(klass: pointer): PFrameClass -proc IS_FRAME*(obj: pointer): bool -proc IS_FRAME_CLASS*(klass: pointer): bool -proc FRAME_GET_CLASS*(obj: pointer): PFrameClass -proc frame_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_frame_get_type".} -proc frame_new*(`label`: cstring): PFrame{.cdecl, dynlib: lib, - importc: "gtk_frame_new".} -proc set_label*(frame: PFrame, `label`: cstring){.cdecl, dynlib: lib, - importc: "gtk_frame_set_label".} -proc get_label*(frame: PFrame): cstring{.cdecl, dynlib: lib, - importc: "gtk_frame_get_label".} -proc set_label_widget*(frame: PFrame, label_widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_frame_set_label_widget".} -proc get_label_widget*(frame: PFrame): PWidget{.cdecl, dynlib: lib, - importc: "gtk_frame_get_label_widget".} -proc set_label_align*(frame: PFrame, xalign: gfloat, yalign: gfloat){. - cdecl, dynlib: lib, importc: "gtk_frame_set_label_align".} -proc get_label_align*(frame: PFrame, xalign: Pgfloat, yalign: Pgfloat){. - cdecl, dynlib: lib, importc: "gtk_frame_get_label_align".} -proc set_shadow_type*(frame: PFrame, thetype: TShadowType){.cdecl, - dynlib: lib, importc: "gtk_frame_set_shadow_type".} -proc get_shadow_type*(frame: PFrame): TShadowType{.cdecl, dynlib: lib, - importc: "gtk_frame_get_shadow_type".} -proc TYPE_ASPECT_FRAME*(): GType -proc ASPECT_FRAME*(obj: pointer): PAspectFrame -proc ASPECT_FRAME_CLASS*(klass: pointer): PAspectFrameClass -proc IS_ASPECT_FRAME*(obj: pointer): bool -proc IS_ASPECT_FRAME_CLASS*(klass: pointer): bool -proc ASPECT_FRAME_GET_CLASS*(obj: pointer): PAspectFrameClass -proc aspect_frame_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_aspect_frame_get_type".} -proc aspect_frame_new*(`label`: cstring, xalign: gfloat, yalign: gfloat, - ratio: gfloat, obey_child: gboolean): PAspectFrame{. - cdecl, dynlib: lib, importc: "gtk_aspect_frame_new".} -proc set*(aspect_frame: PAspectFrame, xalign: gfloat, - yalign: gfloat, ratio: gfloat, obey_child: gboolean){. - cdecl, dynlib: lib, importc: "gtk_aspect_frame_set".} -proc TYPE_ARROW*(): GType -proc ARROW*(obj: pointer): PArrow -proc ARROW_CLASS*(klass: pointer): PArrowClass -proc IS_ARROW*(obj: pointer): bool -proc IS_ARROW_CLASS*(klass: pointer): bool -proc ARROW_GET_CLASS*(obj: pointer): PArrowClass -proc arrow_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_arrow_get_type".} -proc arrow_new*(arrow_type: TArrowType, shadow_type: TShadowType): PArrow{. - cdecl, dynlib: lib, importc: "gtk_arrow_new".} -proc set*(arrow: PArrow, arrow_type: TArrowType, shadow_type: TShadowType){. - cdecl, dynlib: lib, importc: "gtk_arrow_set".} -const - bm_TGtkBindingSet_parsed* = 0x0001'i16 - bp_TGtkBindingSet_parsed* = 0'i16 - bm_TGtkBindingEntry_destroyed* = 0x0001'i16 - bp_TGtkBindingEntry_destroyed* = 0'i16 - bm_TGtkBindingEntry_in_emission* = 0x0002'i16 - bp_TGtkBindingEntry_in_emission* = 1'i16 - -proc entry_add*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType) -proc parsed*(a: PBindingSet): guint -proc set_parsed*(a: PBindingSet, `parsed`: guint) -proc destroyed*(a: PBindingEntry): guint -proc set_destroyed*(a: PBindingEntry, `destroyed`: guint) -proc in_emission*(a: PBindingEntry): guint -proc set_in_emission*(a: PBindingEntry, `in_emission`: guint) -proc binding_set_new*(set_name: cstring): PBindingSet{.cdecl, dynlib: lib, - importc: "gtk_binding_set_new".} -proc binding_set_by_class*(object_class: gpointer): PBindingSet{.cdecl, - dynlib: lib, importc: "gtk_binding_set_by_class".} -proc binding_set_find*(set_name: cstring): PBindingSet{.cdecl, dynlib: lib, - importc: "gtk_binding_set_find".} -proc bindings_activate*(anObject: PObject, keyval: guint, - modifiers: gdk2.TModifierType): gboolean{.cdecl, - dynlib: lib, importc: "gtk_bindings_activate".} -proc activate*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType, anObject: PObject): gboolean{. - cdecl, dynlib: lib, importc: "gtk_binding_set_activate".} -proc entry_clear*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType){.cdecl, dynlib: lib, - importc: "gtk_binding_entry_clear".} -proc add_path*(binding_set: PBindingSet, path_type: TPathType, - path_pattern: cstring, priority: TPathPriorityType){. - cdecl, dynlib: lib, importc: "gtk_binding_set_add_path".} -proc entry_remove*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType){.cdecl, dynlib: lib, - importc: "gtk_binding_entry_remove".} -proc entry_add_signall*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType, - signal_name: cstring, binding_args: PGSList){. - cdecl, dynlib: lib, importc: "gtk_binding_entry_add_signall".} -proc binding_parse_binding*(scanner: PGScanner): guint{.cdecl, dynlib: lib, - importc: "gtk_binding_parse_binding".} -proc bindings_activate_event*(anObject: PObject, event: gdk2.PEventKey): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_bindings_activate_event".} -proc binding_reset_parsed*(){.cdecl, dynlib: lib, - importc: "_gtk_binding_reset_parsed".} -const - bm_TGtkBox_homogeneous* = 0x0001'i16 - bp_TGtkBox_homogeneous* = 0'i16 - bm_TGtkBoxChild_expand* = 0x0001'i16 - bp_TGtkBoxChild_expand* = 0'i16 - bm_TGtkBoxChild_fill* = 0x0002'i16 - bp_TGtkBoxChild_fill* = 1'i16 - bm_TGtkBoxChild_pack* = 0x0004'i16 - bp_TGtkBoxChild_pack* = 2'i16 - bm_TGtkBoxChild_is_secondary* = 0x0008'i16 - bp_TGtkBoxChild_is_secondary* = 3'i16 - -proc TYPE_BOX*(): GType -proc BOX*(obj: pointer): PBox -proc BOX_CLASS*(klass: pointer): PBoxClass -proc IS_BOX*(obj: pointer): bool -proc IS_BOX_CLASS*(klass: pointer): bool -proc BOX_GET_CLASS*(obj: pointer): PBoxClass -proc homogeneous*(a: PBox): guint -proc set_homogeneous*(a: PBox, `homogeneous`: guint) -proc expand*(a: PBoxChild): guint -proc set_expand*(a: PBoxChild, `expand`: guint) -proc fill*(a: PBoxChild): guint -proc set_fill*(a: PBoxChild, `fill`: guint) -proc pack*(a: PBoxChild): guint -proc set_pack*(a: PBoxChild, `pack`: guint) -proc is_secondary*(a: PBoxChild): guint -proc set_is_secondary*(a: PBoxChild, `is_secondary`: guint) -proc box_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_box_get_type".} -proc pack_start*(box: PBox, child: PWidget, expand: gboolean, - fill: gboolean, padding: guint){.cdecl, dynlib: lib, - importc: "gtk_box_pack_start".} -proc pack_end*(box: PBox, child: PWidget, expand: gboolean, fill: gboolean, - padding: guint){.cdecl, dynlib: lib, - importc: "gtk_box_pack_end".} -proc pack_start_defaults*(box: PBox, widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_box_pack_start_defaults".} -proc pack_end_defaults*(box: PBox, widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_box_pack_end_defaults".} -proc set_homogeneous*(box: PBox, homogeneous: gboolean){.cdecl, dynlib: lib, - importc: "gtk_box_set_homogeneous".} -proc get_homogeneous*(box: PBox): gboolean{.cdecl, dynlib: lib, - importc: "gtk_box_get_homogeneous".} -proc set_spacing*(box: PBox, spacing: gint){.cdecl, dynlib: lib, - importc: "gtk_box_set_spacing".} -proc get_spacing*(box: PBox): gint{.cdecl, dynlib: lib, - importc: "gtk_box_get_spacing".} -proc reorder_child*(box: PBox, child: PWidget, position: gint){.cdecl, - dynlib: lib, importc: "gtk_box_reorder_child".} -proc query_child_packing*(box: PBox, child: PWidget, expand: Pgboolean, - fill: Pgboolean, padding: Pguint, - pack_type: PPackType){.cdecl, dynlib: lib, - importc: "gtk_box_query_child_packing".} -proc set_child_packing*(box: PBox, child: PWidget, expand: gboolean, - fill: gboolean, padding: guint, pack_type: TPackType){. - cdecl, dynlib: lib, importc: "gtk_box_set_child_packing".} -const - BUTTONBOX_DEFAULT* = - (1) - -proc TYPE_BUTTON_BOX*(): GType -proc BUTTON_BOX*(obj: pointer): PButtonBox -proc BUTTON_BOX_CLASS*(klass: pointer): PButtonBoxClass -proc IS_BUTTON_BOX*(obj: pointer): bool -proc IS_BUTTON_BOX_CLASS*(klass: pointer): bool -proc BUTTON_BOX_GET_CLASS*(obj: pointer): PButtonBoxClass -proc button_box_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_button_box_get_type".} -proc get_layout*(widget: PButtonBox): TButtonBoxStyle{.cdecl, - dynlib: lib, importc: "gtk_button_box_get_layout".} -proc set_layout*(widget: PButtonBox, layout_style: TButtonBoxStyle){. - cdecl, dynlib: lib, importc: "gtk_button_box_set_layout".} -proc set_child_secondary*(widget: PButtonBox, child: PWidget, - is_secondary: gboolean){.cdecl, - dynlib: lib, importc: "gtk_button_box_set_child_secondary".} -proc button_box_child_requisition*(widget: PWidget, nvis_children: var int32, - nvis_secondaries: var int32, - width: var int32, height: var int32){.cdecl, - dynlib: lib, importc: "_gtk_button_box_child_requisition".} -const - bm_TGtkButton_constructed* = 0x0001'i16 - bp_TGtkButton_constructed* = 0'i16 - bm_TGtkButton_in_button* = 0x0002'i16 - bp_TGtkButton_in_button* = 1'i16 - bm_TGtkButton_button_down* = 0x0004'i16 - bp_TGtkButton_button_down* = 2'i16 - bm_TGtkButton_relief* = 0x0018'i16 - bp_TGtkButton_relief* = 3'i16 - bm_TGtkButton_use_underline* = 0x0020'i16 - bp_TGtkButton_use_underline* = 5'i16 - bm_TGtkButton_use_stock* = 0x0040'i16 - bp_TGtkButton_use_stock* = 6'i16 - bm_TGtkButton_depressed* = 0x0080'i16 - bp_TGtkButton_depressed* = 7'i16 - bm_TGtkButton_depress_on_activate* = 0x0100'i16 - bp_TGtkButton_depress_on_activate* = 8'i16 - -proc TYPE_BUTTON*(): GType -proc BUTTON*(obj: pointer): PButton -proc BUTTON_CLASS*(klass: pointer): PButtonClass -proc IS_BUTTON*(obj: pointer): bool -proc IS_BUTTON_CLASS*(klass: pointer): bool -proc BUTTON_GET_CLASS*(obj: pointer): PButtonClass -proc constructed*(a: PButton): guint -proc set_constructed*(a: PButton, `constructed`: guint) -proc in_button*(a: PButton): guint -proc set_in_button*(a: PButton, `in_button`: guint) -proc button_down*(a: PButton): guint -proc set_button_down*(a: PButton, `button_down`: guint) -proc relief*(a: PButton): guint -proc use_underline*(a: PButton): guint -proc set_use_underline*(a: PButton, `use_underline`: guint) -proc use_stock*(a: PButton): guint -proc set_use_stock*(a: PButton, `use_stock`: guint) -proc depressed*(a: PButton): guint -proc set_depressed*(a: PButton, `depressed`: guint) -proc depress_on_activate*(a: PButton): guint -proc set_depress_on_activate*(a: PButton, `depress_on_activate`: guint) -proc button_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_button_get_type".} -proc button_new*(): PButton{.cdecl, dynlib: lib, importc: "gtk_button_new".} -proc button_new*(`label`: cstring): PButton{.cdecl, dynlib: lib, - importc: "gtk_button_new_with_label".} -proc button_new_from_stock*(stock_id: cstring): PButton{.cdecl, dynlib: lib, - importc: "gtk_button_new_from_stock".} -proc button_new_with_mnemonic*(`label`: cstring): PButton{.cdecl, dynlib: lib, - importc: "gtk_button_new_with_mnemonic".} -proc pressed*(button: PButton){.cdecl, dynlib: lib, - importc: "gtk_button_pressed".} -proc released*(button: PButton){.cdecl, dynlib: lib, - importc: "gtk_button_released".} -proc clicked*(button: PButton){.cdecl, dynlib: lib, - importc: "gtk_button_clicked".} -proc enter*(button: PButton){.cdecl, dynlib: lib, - importc: "gtk_button_enter".} -proc leave*(button: PButton){.cdecl, dynlib: lib, - importc: "gtk_button_leave".} -proc set_relief*(button: PButton, newstyle: TReliefStyle){.cdecl, - dynlib: lib, importc: "gtk_button_set_relief".} -proc get_relief*(button: PButton): TReliefStyle{.cdecl, dynlib: lib, - importc: "gtk_button_get_relief".} -proc set_label*(button: PButton, `label`: cstring){.cdecl, dynlib: lib, - importc: "gtk_button_set_label".} -proc get_label*(button: PButton): cstring{.cdecl, dynlib: lib, - importc: "gtk_button_get_label".} -proc set_use_underline*(button: PButton, use_underline: gboolean){.cdecl, - dynlib: lib, importc: "gtk_button_set_use_underline".} -proc get_use_underline*(button: PButton): gboolean{.cdecl, dynlib: lib, - importc: "gtk_button_get_use_underline".} -proc set_use_stock*(button: PButton, use_stock: gboolean){.cdecl, - dynlib: lib, importc: "gtk_button_set_use_stock".} -proc get_use_stock*(button: PButton): gboolean{.cdecl, dynlib: lib, - importc: "gtk_button_get_use_stock".} -proc set_depressed*(button: PButton, depressed: gboolean){.cdecl, - dynlib: lib, importc: "_gtk_button_set_depressed".} -proc paint*(button: PButton, area: gdk2.PRectangle, state_type: TStateType, - shadow_type: TShadowType, main_detail: cstring, - default_detail: cstring){.cdecl, dynlib: lib, - importc: "_gtk_button_paint".} -proc set_image*(button: PButton, image: PWidget){.cdecl, dynlib: lib, - importc: "gtk_button_set_image".} -proc get_image*(button: PButton): PWidget{.cdecl, dynlib: lib, - importc: "gtk_button_get_image".} -const - CALENDAR_SHOW_HEADING* = 1 shl 0 - CALENDAR_SHOW_DAY_NAMES* = 1 shl 1 - CALENDAR_NO_MONTH_CHANGE* = 1 shl 2 - CALENDAR_SHOW_WEEK_NUMBERS* = 1 shl 3 - CALENDAR_WEEK_START_MONDAY* = 1 shl 4 - -proc TYPE_CALENDAR*(): GType -proc CALENDAR*(obj: pointer): PCalendar -proc CALENDAR_CLASS*(klass: pointer): PCalendarClass -proc IS_CALENDAR*(obj: pointer): bool -proc IS_CALENDAR_CLASS*(klass: pointer): bool -proc CALENDAR_GET_CLASS*(obj: pointer): PCalendarClass -proc calendar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_calendar_get_type".} -proc calendar_new*(): PCalendar{.cdecl, dynlib: lib, importc: "gtk_calendar_new".} -proc select_month*(calendar: PCalendar, month: guint, year: guint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_calendar_select_month".} -proc select_day*(calendar: PCalendar, day: guint){.cdecl, dynlib: lib, - importc: "gtk_calendar_select_day".} -proc mark_day*(calendar: PCalendar, day: guint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_calendar_mark_day".} -proc unmark_day*(calendar: PCalendar, day: guint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_calendar_unmark_day".} -proc clear_marks*(calendar: PCalendar){.cdecl, dynlib: lib, - importc: "gtk_calendar_clear_marks".} -proc display_options*(calendar: PCalendar, - flags: TCalendarDisplayOptions){.cdecl, - dynlib: lib, importc: "gtk_calendar_display_options".} -proc get_date*(calendar: PCalendar, year: Pguint, month: Pguint, - day: Pguint){.cdecl, dynlib: lib, - importc: "gtk_calendar_get_date".} -proc freeze*(calendar: PCalendar){.cdecl, dynlib: lib, - importc: "gtk_calendar_freeze".} -proc thaw*(calendar: PCalendar){.cdecl, dynlib: lib, - importc: "gtk_calendar_thaw".} -proc TYPE_CELL_EDITABLE*(): GType -proc CELL_EDITABLE*(obj: pointer): PCellEditable -proc CELL_EDITABLE_CLASS*(obj: pointer): PCellEditableIface -proc IS_CELL_EDITABLE*(obj: pointer): bool -proc CELL_EDITABLE_GET_IFACE*(obj: pointer): PCellEditableIface -proc cell_editable_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_cell_editable_get_type".} -proc start_editing*(cell_editable: PCellEditable, event: gdk2.PEvent){. - cdecl, dynlib: lib, importc: "gtk_cell_editable_start_editing".} -proc editing_done*(cell_editable: PCellEditable){.cdecl, - dynlib: lib, importc: "gtk_cell_editable_editing_done".} -proc remove_widget*(cell_editable: PCellEditable){.cdecl, - dynlib: lib, importc: "gtk_cell_editable_remove_widget".} -const - CELL_RENDERER_SELECTED* = 1 shl 0 - CELL_RENDERER_PRELIT* = 1 shl 1 - CELL_RENDERER_INSENSITIVE* = 1 shl 2 - CELL_RENDERER_SORTED* = 1 shl 3 - -const - bm_TGtkCellRenderer_mode* = 0x0003'i16 - bp_TGtkCellRenderer_mode* = 0'i16 - bm_TGtkCellRenderer_visible* = 0x0004'i16 - bp_TGtkCellRenderer_visible* = 2'i16 - bm_TGtkCellRenderer_is_expander* = 0x0008'i16 - bp_TGtkCellRenderer_is_expander* = 3'i16 - bm_TGtkCellRenderer_is_expanded* = 0x0010'i16 - bp_TGtkCellRenderer_is_expanded* = 4'i16 - bm_TGtkCellRenderer_cell_background_set* = 0x0020'i16 - bp_TGtkCellRenderer_cell_background_set* = 5'i16 - -proc TYPE_CELL_RENDERER*(): GType -proc CELL_RENDERER*(obj: pointer): PCellRenderer -proc CELL_RENDERER_CLASS*(klass: pointer): PCellRendererClass -proc IS_CELL_RENDERER*(obj: pointer): bool -proc IS_CELL_RENDERER_CLASS*(klass: pointer): bool -proc CELL_RENDERER_GET_CLASS*(obj: pointer): PCellRendererClass -proc mode*(a: PCellRenderer): guint -proc set_mode*(a: PCellRenderer, `mode`: guint) -proc visible*(a: PCellRenderer): guint -proc set_visible*(a: PCellRenderer, `visible`: guint) -proc is_expander*(a: PCellRenderer): guint -proc set_is_expander*(a: PCellRenderer, `is_expander`: guint) -proc is_expanded*(a: PCellRenderer): guint -proc set_is_expanded*(a: PCellRenderer, `is_expanded`: guint) -proc cell_background_set*(a: PCellRenderer): guint -proc set_cell_background_set*(a: PCellRenderer, `cell_background_set`: guint) -proc cell_renderer_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_get_type".} -proc get_size*(cell: PCellRenderer, widget: PWidget, - cell_area: gdk2.PRectangle, x_offset: Pgint, - y_offset: Pgint, width: Pgint, height: Pgint){. - cdecl, dynlib: lib, importc: "gtk_cell_renderer_get_size".} -proc render*(cell: PCellRenderer, window: gdk2.PWindow, - widget: PWidget, background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, expose_area: gdk2.PRectangle, - flags: TCellRendererState){.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_render".} -proc activate*(cell: PCellRenderer, event: gdk2.PEvent, - widget: PWidget, path: cstring, - background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, flags: TCellRendererState): gboolean{. - cdecl, dynlib: lib, importc: "gtk_cell_renderer_activate".} -proc start_editing*(cell: PCellRenderer, event: gdk2.PEvent, - widget: PWidget, path: cstring, - background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, - flags: TCellRendererState): PCellEditable{. - cdecl, dynlib: lib, importc: "gtk_cell_renderer_start_editing".} -proc set_fixed_size*(cell: PCellRenderer, width: gint, - height: gint){.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_set_fixed_size".} -proc get_fixed_size*(cell: PCellRenderer, width: Pgint, - height: Pgint){.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_get_fixed_size".} -const - bm_TGtkCellRendererText_strikethrough* = 0x0001'i16 - bp_TGtkCellRendererText_strikethrough* = 0'i16 - bm_TGtkCellRendererText_editable* = 0x0002'i16 - bp_TGtkCellRendererText_editable* = 1'i16 - bm_TGtkCellRendererText_scale_set* = 0x0004'i16 - bp_TGtkCellRendererText_scale_set* = 2'i16 - bm_TGtkCellRendererText_foreground_set* = 0x0008'i16 - bp_TGtkCellRendererText_foreground_set* = 3'i16 - bm_TGtkCellRendererText_background_set* = 0x0010'i16 - bp_TGtkCellRendererText_background_set* = 4'i16 - bm_TGtkCellRendererText_underline_set* = 0x0020'i16 - bp_TGtkCellRendererText_underline_set* = 5'i16 - bm_TGtkCellRendererText_rise_set* = 0x0040'i16 - bp_TGtkCellRendererText_rise_set* = 6'i16 - bm_TGtkCellRendererText_strikethrough_set* = 0x0080'i16 - bp_TGtkCellRendererText_strikethrough_set* = 7'i16 - bm_TGtkCellRendererText_editable_set* = 0x0100'i16 - bp_TGtkCellRendererText_editable_set* = 8'i16 - bm_TGtkCellRendererText_calc_fixed_height* = 0x0200'i16 - bp_TGtkCellRendererText_calc_fixed_height* = 9'i16 - -proc TYPE_CELL_RENDERER_TEXT*(): GType -proc CELL_RENDERER_TEXT*(obj: pointer): PCellRendererText -proc CELL_RENDERER_TEXT_CLASS*(klass: pointer): PCellRendererTextClass -proc IS_CELL_RENDERER_TEXT*(obj: pointer): bool -proc IS_CELL_RENDERER_TEXT_CLASS*(klass: pointer): bool -proc CELL_RENDERER_TEXT_GET_CLASS*(obj: pointer): PCellRendererTextClass -proc strikethrough*(a: PCellRendererText): guint -proc set_strikethrough*(a: PCellRendererText, `strikethrough`: guint) -proc editable*(a: PCellRendererText): guint -proc set_editable*(a: PCellRendererText, `editable`: guint) -proc scale_set*(a: PCellRendererText): guint -proc set_scale_set*(a: PCellRendererText, `scale_set`: guint) -proc foreground_set*(a: PCellRendererText): guint -proc set_foreground_set*(a: PCellRendererText, `foreground_set`: guint) -proc background_set*(a: PCellRendererText): guint -proc set_background_set*(a: PCellRendererText, `background_set`: guint) -proc underline_set*(a: PCellRendererText): guint -proc set_underline_set*(a: PCellRendererText, `underline_set`: guint) -proc rise_set*(a: PCellRendererText): guint -proc set_rise_set*(a: PCellRendererText, `rise_set`: guint) -proc strikethrough_set*(a: PCellRendererText): guint -proc set_strikethrough_set*(a: PCellRendererText, `strikethrough_set`: guint) -proc editable_set*(a: PCellRendererText): guint -proc set_editable_set*(a: PCellRendererText, `editable_set`: guint) -proc calc_fixed_height*(a: PCellRendererText): guint -proc set_calc_fixed_height*(a: PCellRendererText, `calc_fixed_height`: guint) -proc cell_renderer_text_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_text_get_type".} -proc cell_renderer_text_new*(): PCellRenderer{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_text_new".} -proc text_set_fixed_height_from_font*(renderer: PCellRendererText, - number_of_rows: gint){.cdecl, dynlib: lib, importc: "gtk_cell_renderer_text_set_fixed_height_from_font".} -const - bm_TGtkCellRendererToggle_active* = 0x0001'i16 - bp_TGtkCellRendererToggle_active* = 0'i16 - bm_TGtkCellRendererToggle_activatable* = 0x0002'i16 - bp_TGtkCellRendererToggle_activatable* = 1'i16 - bm_TGtkCellRendererToggle_radio* = 0x0004'i16 - bp_TGtkCellRendererToggle_radio* = 2'i16 - -proc TYPE_CELL_RENDERER_TOGGLE*(): GType -proc CELL_RENDERER_TOGGLE*(obj: pointer): PCellRendererToggle -proc CELL_RENDERER_TOGGLE_CLASS*(klass: pointer): PCellRendererToggleClass -proc IS_CELL_RENDERER_TOGGLE*(obj: pointer): bool -proc IS_CELL_RENDERER_TOGGLE_CLASS*(klass: pointer): bool -proc CELL_RENDERER_TOGGLE_GET_CLASS*(obj: pointer): PCellRendererToggleClass -proc active*(a: PCellRendererToggle): guint -proc set_active*(a: PCellRendererToggle, `active`: guint) -proc activatable*(a: PCellRendererToggle): guint -proc set_activatable*(a: PCellRendererToggle, `activatable`: guint) -proc radio*(a: PCellRendererToggle): guint -proc set_radio*(a: PCellRendererToggle, `radio`: guint) -proc cell_renderer_toggle_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_toggle_get_type".} -proc cell_renderer_toggle_new*(): PCellRenderer{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_toggle_new".} -proc toggle_get_radio*(toggle: PCellRendererToggle): gboolean{. - cdecl, dynlib: lib, importc: "gtk_cell_renderer_toggle_get_radio".} -proc toggle_set_radio*(toggle: PCellRendererToggle, - radio: gboolean){.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_toggle_set_radio".} -proc toggle_get_active*(toggle: PCellRendererToggle): gboolean{. - cdecl, dynlib: lib, importc: "gtk_cell_renderer_toggle_get_active".} -proc toggle_set_active*(toggle: PCellRendererToggle, - setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_toggle_set_active".} -proc TYPE_CELL_RENDERER_PIXBUF*(): GType -proc CELL_RENDERER_PIXBUF*(obj: pointer): PCellRendererPixbuf -proc CELL_RENDERER_PIXBUF_CLASS*(klass: pointer): PCellRendererPixbufClass -proc IS_CELL_RENDERER_PIXBUF*(obj: pointer): bool -proc IS_CELL_RENDERER_PIXBUF_CLASS*(klass: pointer): bool -proc CELL_RENDERER_PIXBUF_GET_CLASS*(obj: pointer): PCellRendererPixbufClass -proc cell_renderer_pixbuf_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_pixbuf_get_type".} -proc cell_renderer_pixbuf_new*(): PCellRenderer{.cdecl, dynlib: lib, - importc: "gtk_cell_renderer_pixbuf_new".} -proc TYPE_ITEM*(): GType -proc ITEM*(obj: pointer): PItem -proc ITEM_CLASS*(klass: pointer): PItemClass -proc IS_ITEM*(obj: pointer): bool -proc IS_ITEM_CLASS*(klass: pointer): bool -proc ITEM_GET_CLASS*(obj: pointer): PItemClass -proc item_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_item_get_type".} -proc select*(item: PItem){.cdecl, dynlib: lib, importc: "gtk_item_select".} -proc deselect*(item: PItem){.cdecl, dynlib: lib, - importc: "gtk_item_deselect".} -proc toggle*(item: PItem){.cdecl, dynlib: lib, importc: "gtk_item_toggle".} -const - bm_TGtkMenuItem_show_submenu_indicator* = 0x0001'i16 - bp_TGtkMenuItem_show_submenu_indicator* = 0'i16 - bm_TGtkMenuItem_submenu_placement* = 0x0002'i16 - bp_TGtkMenuItem_submenu_placement* = 1'i16 - bm_TGtkMenuItem_submenu_direction* = 0x0004'i16 - bp_TGtkMenuItem_submenu_direction* = 2'i16 - bm_TGtkMenuItem_right_justify* = 0x0008'i16 - bp_TGtkMenuItem_right_justify* = 3'i16 - bm_TGtkMenuItem_timer_from_keypress* = 0x0010'i16 - bp_TGtkMenuItem_timer_from_keypress* = 4'i16 - bm_TGtkMenuItemClass_hide_on_activate* = 0x0001'i16 - bp_TGtkMenuItemClass_hide_on_activate* = 0'i16 - -proc TYPE_MENU_ITEM*(): GType -proc MENU_ITEM*(obj: pointer): PMenuItem -proc MENU_ITEM_CLASS*(klass: pointer): PMenuItemClass -proc IS_MENU_ITEM*(obj: pointer): bool -proc IS_MENU_ITEM_CLASS*(klass: pointer): bool -proc MENU_ITEM_GET_CLASS*(obj: pointer): PMenuItemClass -proc show_submenu_indicator*(a: PMenuItem): guint -proc set_show_submenu_indicator*(a: PMenuItem, - `show_submenu_indicator`: guint) -proc submenu_placement*(a: PMenuItem): guint -proc set_submenu_placement*(a: PMenuItem, `submenu_placement`: guint) -proc submenu_direction*(a: PMenuItem): guint -proc set_submenu_direction*(a: PMenuItem, `submenu_direction`: guint) -proc right_justify*(a: PMenuItem): guint -proc set_right_justify*(a: PMenuItem, `right_justify`: guint) -proc timer_from_keypress*(a: PMenuItem): guint -proc set_timer_from_keypress*(a: PMenuItem, `timer_from_keypress`: guint) -proc hide_on_activate*(a: PMenuItemClass): guint -proc set_hide_on_activate*(a: PMenuItemClass, `hide_on_activate`: guint) -proc menu_item_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_menu_item_get_type".} -proc menu_item_new*(): PMenuItem{.cdecl, dynlib: lib, - importc: "gtk_menu_item_new".} -proc menu_item_new*(`label`: cstring): PMenuItem{.cdecl, dynlib: lib, - importc: "gtk_menu_item_new_with_label".} -proc menu_item_new_with_mnemonic*(`label`: cstring): PMenuItem{.cdecl, - dynlib: lib, importc: "gtk_menu_item_new_with_mnemonic".} -proc set_submenu*(menu_item: PMenuItem, submenu: PWidget){.cdecl, - dynlib: lib, importc: "gtk_menu_item_set_submenu".} -proc get_submenu*(menu_item: PMenuItem): PWidget{.cdecl, dynlib: lib, - importc: "gtk_menu_item_get_submenu".} -proc remove_submenu*(menu_item: PMenuItem){.cdecl, dynlib: lib, - importc: "gtk_menu_item_remove_submenu".} -proc select*(menu_item: PMenuItem){.cdecl, dynlib: lib, - importc: "gtk_menu_item_select".} -proc deselect*(menu_item: PMenuItem){.cdecl, dynlib: lib, - importc: "gtk_menu_item_deselect".} -proc activate*(menu_item: PMenuItem){.cdecl, dynlib: lib, - importc: "gtk_menu_item_activate".} -proc toggle_size_request*(menu_item: PMenuItem, requisition: Pgint){. - cdecl, dynlib: lib, importc: "gtk_menu_item_toggle_size_request".} -proc toggle_size_allocate*(menu_item: PMenuItem, allocation: gint){. - cdecl, dynlib: lib, importc: "gtk_menu_item_toggle_size_allocate".} -proc set_right_justified*(menu_item: PMenuItem, - right_justified: gboolean){.cdecl, - dynlib: lib, importc: "gtk_menu_item_set_right_justified".} -proc get_right_justified*(menu_item: PMenuItem): gboolean{.cdecl, - dynlib: lib, importc: "gtk_menu_item_get_right_justified".} -proc set_accel_path*(menu_item: PMenuItem, accel_path: cstring){. - cdecl, dynlib: lib, importc: "gtk_menu_item_set_accel_path".} -proc refresh_accel_path*(menu_item: PMenuItem, prefix: cstring, - accel_group: PAccelGroup, - group_changed: gboolean){.cdecl, dynlib: lib, - importc: "_gtk_menu_item_refresh_accel_path".} -proc menu_item_is_selectable*(menu_item: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "_gtk_menu_item_is_selectable".} -const - bm_TGtkToggleButton_active* = 0x0001'i16 - bp_TGtkToggleButton_active* = 0'i16 - bm_TGtkToggleButton_draw_indicator* = 0x0002'i16 - bp_TGtkToggleButton_draw_indicator* = 1'i16 - bm_TGtkToggleButton_inconsistent* = 0x0004'i16 - bp_TGtkToggleButton_inconsistent* = 2'i16 - -proc TYPE_TOGGLE_BUTTON*(): GType -proc TOGGLE_BUTTON*(obj: pointer): PToggleButton -proc TOGGLE_BUTTON_CLASS*(klass: pointer): PToggleButtonClass -proc IS_TOGGLE_BUTTON*(obj: pointer): bool -proc IS_TOGGLE_BUTTON_CLASS*(klass: pointer): bool -proc TOGGLE_BUTTON_GET_CLASS*(obj: pointer): PToggleButtonClass -proc active*(a: PToggleButton): guint -proc set_active*(a: PToggleButton, `active`: guint) -proc draw_indicator*(a: PToggleButton): guint -proc set_draw_indicator*(a: PToggleButton, `draw_indicator`: guint) -proc inconsistent*(a: PToggleButton): guint -proc set_inconsistent*(a: PToggleButton, `inconsistent`: guint) -proc toggle_button_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_toggle_button_get_type".} -proc toggle_button_new*(): PToggleButton{.cdecl, dynlib: lib, - importc: "gtk_toggle_button_new".} -proc toggle_button_new*(`label`: cstring): PToggleButton{.cdecl, - dynlib: lib, importc: "gtk_toggle_button_new_with_label".} -proc toggle_button_new_with_mnemonic*(`label`: cstring): PToggleButton{.cdecl, - dynlib: lib, importc: "gtk_toggle_button_new_with_mnemonic".} -proc set_mode*(toggle_button: PToggleButton, - draw_indicator: gboolean){.cdecl, dynlib: lib, - importc: "gtk_toggle_button_set_mode".} -proc get_mode*(toggle_button: PToggleButton): gboolean{.cdecl, - dynlib: lib, importc: "gtk_toggle_button_get_mode".} -proc set_active*(toggle_button: PToggleButton, is_active: gboolean){. - cdecl, dynlib: lib, importc: "gtk_toggle_button_set_active".} -proc get_active*(toggle_button: PToggleButton): gboolean{.cdecl, - dynlib: lib, importc: "gtk_toggle_button_get_active".} -proc toggled*(toggle_button: PToggleButton){.cdecl, dynlib: lib, - importc: "gtk_toggle_button_toggled".} -proc set_inconsistent*(toggle_button: PToggleButton, - setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_toggle_button_set_inconsistent".} -proc get_inconsistent*(toggle_button: PToggleButton): gboolean{. - cdecl, dynlib: lib, importc: "gtk_toggle_button_get_inconsistent".} -proc TYPE_CHECK_BUTTON*(): GType -proc CHECK_BUTTON*(obj: pointer): PCheckButton -proc CHECK_BUTTON_CLASS*(klass: pointer): PCheckButtonClass -proc IS_CHECK_BUTTON*(obj: pointer): bool -proc IS_CHECK_BUTTON_CLASS*(klass: pointer): bool -proc CHECK_BUTTON_GET_CLASS*(obj: pointer): PCheckButtonClass -proc check_button_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_check_button_get_type".} -proc check_button_new*(): PCheckButton{.cdecl, dynlib: lib, - importc: "gtk_check_button_new".} -proc check_button_new*(`label`: cstring): PCheckButton{.cdecl, - dynlib: lib, importc: "gtk_check_button_new_with_label".} -proc check_button_new_with_mnemonic*(`label`: cstring): PCheckButton{.cdecl, - dynlib: lib, importc: "gtk_check_button_new_with_mnemonic".} -proc get_props*(check_button: PCheckButton, indicator_size: Pgint, - indicator_spacing: Pgint){.cdecl, dynlib: lib, - importc: "_gtk_check_button_get_props".} -const - bm_TGtkCheckMenuItem_active* = 0x0001'i16 - bp_TGtkCheckMenuItem_active* = 0'i16 - bm_TGtkCheckMenuItem_always_show_toggle* = 0x0002'i16 - bp_TGtkCheckMenuItem_always_show_toggle* = 1'i16 - bm_TGtkCheckMenuItem_inconsistent* = 0x0004'i16 - bp_TGtkCheckMenuItem_inconsistent* = 2'i16 - -proc TYPE_CHECK_MENU_ITEM*(): GType -proc CHECK_MENU_ITEM*(obj: pointer): PCheckMenuItem -proc CHECK_MENU_ITEM_CLASS*(klass: pointer): PCheckMenuItemClass -proc IS_CHECK_MENU_ITEM*(obj: pointer): bool -proc IS_CHECK_MENU_ITEM_CLASS*(klass: pointer): bool -proc CHECK_MENU_ITEM_GET_CLASS*(obj: pointer): PCheckMenuItemClass -proc active*(a: PCheckMenuItem): guint -proc set_active*(a: PCheckMenuItem, `active`: guint) -proc always_show_toggle*(a: PCheckMenuItem): guint -proc set_always_show_toggle*(a: PCheckMenuItem, `always_show_toggle`: guint) -proc inconsistent*(a: PCheckMenuItem): guint -proc set_inconsistent*(a: PCheckMenuItem, `inconsistent`: guint) -proc check_menu_item_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_check_menu_item_get_type".} -proc check_menu_item_new*(): PCheckMenuItem{.cdecl, dynlib: lib, - importc: "gtk_check_menu_item_new".} -proc check_menu_item_new*(`label`: cstring): PCheckMenuItem{.cdecl, - dynlib: lib, importc: "gtk_check_menu_item_new_with_label".} -proc check_menu_item_new_with_mnemonic*(`label`: cstring): PCheckMenuItem{.cdecl, - dynlib: lib, importc: "gtk_check_menu_item_new_with_mnemonic".} -proc item_set_active*(check_menu_item: PCheckMenuItem, - is_active: gboolean){.cdecl, dynlib: lib, - importc: "gtk_check_menu_item_set_active".} -proc item_get_active*(check_menu_item: PCheckMenuItem): gboolean{. - cdecl, dynlib: lib, importc: "gtk_check_menu_item_get_active".} -proc item_toggled*(check_menu_item: PCheckMenuItem){.cdecl, - dynlib: lib, importc: "gtk_check_menu_item_toggled".} -proc item_set_inconsistent*(check_menu_item: PCheckMenuItem, - setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_check_menu_item_set_inconsistent".} -proc item_get_inconsistent*(check_menu_item: PCheckMenuItem): gboolean{. - cdecl, dynlib: lib, importc: "gtk_check_menu_item_get_inconsistent".} -proc clipboard_get_for_display*(display: gdk2.PDisplay, selection: gdk2.TAtom): PClipboard{. - cdecl, dynlib: lib, importc: "gtk_clipboard_get_for_display".} -proc get_display*(clipboard: PClipboard): gdk2.PDisplay{.cdecl, - dynlib: lib, importc: "gtk_clipboard_get_display".} -proc set_with_data*(clipboard: PClipboard, targets: PTargetEntry, - n_targets: guint, get_func: TClipboardGetFunc, - clear_func: TClipboardClearFunc, - user_data: gpointer): gboolean{.cdecl, - dynlib: lib, importc: "gtk_clipboard_set_with_data".} -proc set_with_owner*(clipboard: PClipboard, targets: PTargetEntry, - n_targets: guint, get_func: TClipboardGetFunc, - clear_func: TClipboardClearFunc, owner: PGObject): gboolean{. - cdecl, dynlib: lib, importc: "gtk_clipboard_set_with_owner".} -proc get_owner*(clipboard: PClipboard): PGObject{.cdecl, dynlib: lib, - importc: "gtk_clipboard_get_owner".} -proc clear*(clipboard: PClipboard){.cdecl, dynlib: lib, - importc: "gtk_clipboard_clear".} -proc set_text*(clipboard: PClipboard, text: cstring, len: gint){. - cdecl, dynlib: lib, importc: "gtk_clipboard_set_text".} -proc request_contents*(clipboard: PClipboard, target: gdk2.TAtom, - callback: TClipboardReceivedFunc, - user_data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_clipboard_request_contents".} -proc request_text*(clipboard: PClipboard, - callback: TClipboardTextReceivedFunc, - user_data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_clipboard_request_text".} -proc wait_for_contents*(clipboard: PClipboard, target: gdk2.TAtom): PSelectionData{. - cdecl, dynlib: lib, importc: "gtk_clipboard_wait_for_contents".} -proc wait_for_text*(clipboard: PClipboard): cstring{.cdecl, - dynlib: lib, importc: "gtk_clipboard_wait_for_text".} -proc wait_is_text_available*(clipboard: PClipboard): gboolean{.cdecl, - dynlib: lib, importc: "gtk_clipboard_wait_is_text_available".} -const - CLIST_IN_DRAG* = 1 shl 0 - CLIST_ROW_HEIGHT_SET* = 1 shl 1 - CLIST_SHOW_TITLES* = 1 shl 2 - CLIST_ADD_MODE* = 1 shl 4 - CLIST_AUTO_SORT* = 1 shl 5 - CLIST_AUTO_RESIZE_BLOCKED* = 1 shl 6 - CLIST_REORDERABLE* = 1 shl 7 - CLIST_USE_DRAG_ICONS* = 1 shl 8 - CLIST_DRAW_DRAG_LINE* = 1 shl 9 - CLIST_DRAW_DRAG_RECT* = 1 shl 10 - BUTTON_IGNORED* = 0 - BUTTON_SELECTS* = 1 shl 0 - BUTTON_DRAGS* = 1 shl 1 - BUTTON_EXPANDS* = 1 shl 2 - -const - bm_TGtkCListColumn_visible* = 0x0001'i16 - bp_TGtkCListColumn_visible* = 0'i16 - bm_TGtkCListColumn_width_set* = 0x0002'i16 - bp_TGtkCListColumn_width_set* = 1'i16 - bm_TGtkCListColumn_resizeable* = 0x0004'i16 - bp_TGtkCListColumn_resizeable* = 2'i16 - bm_TGtkCListColumn_auto_resize* = 0x0008'i16 - bp_TGtkCListColumn_auto_resize* = 3'i16 - bm_TGtkCListColumn_button_passive* = 0x0010'i16 - bp_TGtkCListColumn_button_passive* = 4'i16 - bm_TGtkCListRow_fg_set* = 0x0001'i16 - bp_TGtkCListRow_fg_set* = 0'i16 - bm_TGtkCListRow_bg_set* = 0x0002'i16 - bp_TGtkCListRow_bg_set* = 1'i16 - bm_TGtkCListRow_selectable* = 0x0004'i16 - bp_TGtkCListRow_selectable* = 2'i16 - -proc TYPE_CLIST*(): GType -proc CLIST*(obj: pointer): PCList -proc CLIST_CLASS*(klass: pointer): PCListClass -proc IS_CLIST*(obj: pointer): bool -proc IS_CLIST_CLASS*(klass: pointer): bool -proc CLIST_GET_CLASS*(obj: pointer): PCListClass -proc CLIST_FLAGS*(clist: pointer): guint16 -proc SET_FLAG*(clist: PCList, flag: guint16) -proc UNSET_FLAG*(clist: PCList, flag: guint16) -#proc GTK_CLIST_IN_DRAG_get*(clist: pointer): bool -#proc GTK_CLIST_ROW_HEIGHT_SET_get*(clist: pointer): bool -#proc GTK_CLIST_SHOW_TITLES_get*(clist: pointer): bool -#proc GTK_CLIST_ADD_MODE_get*(clist: pointer): bool -#proc GTK_CLIST_AUTO_SORT_get*(clist: pointer): bool -#proc GTK_CLIST_AUTO_RESIZE_BLOCKED_get*(clist: pointer): bool -#proc GTK_CLIST_REORDERABLE_get*(clist: pointer): bool -#proc GTK_CLIST_USE_DRAG_ICONS_get*(clist: pointer): bool -#proc GTK_CLIST_DRAW_DRAG_LINE_get*(clist: pointer): bool -#proc GTK_CLIST_DRAW_DRAG_RECT_get*(clist: pointer): bool -#proc GTK_CLIST_ROW_get*(glist: PGList): PGtkCListRow -#proc GTK_CELL_TEXT_get*(cell: pointer): PGtkCellText -#proc GTK_CELL_PIXMAP_get*(cell: pointer): PGtkCellPixmap -#proc GTK_CELL_PIXTEXT_get*(cell: pointer): PGtkCellPixText -#proc GTK_CELL_WIDGET_get*(cell: pointer): PGtkCellWidget - -proc visible*(a: PCListColumn): guint -proc set_visible*(a: PCListColumn, `visible`: guint) -proc width_set*(a: PCListColumn): guint -proc set_width_set*(a: PCListColumn, `width_set`: guint) -proc resizeable*(a: PCListColumn): guint -proc set_resizeable*(a: PCListColumn, `resizeable`: guint) -proc auto_resize*(a: PCListColumn): guint -proc set_auto_resize*(a: PCListColumn, `auto_resize`: guint) -proc button_passive*(a: PCListColumn): guint -proc set_button_passive*(a: PCListColumn, `button_passive`: guint) -proc fg_set*(a: PCListRow): guint -proc set_fg_set*(a: PCListRow, `fg_set`: guint) -proc bg_set*(a: PCListRow): guint -proc set_bg_set*(a: PCListRow, `bg_set`: guint) -proc selectable*(a: PCListRow): guint -proc set_selectable*(a: PCListRow, `selectable`: guint) -proc clist_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_clist_get_type".} -proc clist_new*(columns: gint): PCList{.cdecl, dynlib: lib, - importc: "gtk_clist_new".} -proc set_hadjustment*(clist: PCList, adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_clist_set_hadjustment".} -proc set_vadjustment*(clist: PCList, adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_clist_set_vadjustment".} -proc get_hadjustment*(clist: PCList): PAdjustment{.cdecl, dynlib: lib, - importc: "gtk_clist_get_hadjustment".} -proc get_vadjustment*(clist: PCList): PAdjustment{.cdecl, dynlib: lib, - importc: "gtk_clist_get_vadjustment".} -proc set_shadow_type*(clist: PCList, thetype: TShadowType){.cdecl, - dynlib: lib, importc: "gtk_clist_set_shadow_type".} -proc set_selection_mode*(clist: PCList, mode: TSelectionMode){.cdecl, - dynlib: lib, importc: "gtk_clist_set_selection_mode".} -proc set_reorderable*(clist: PCList, reorderable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_clist_set_reorderable".} -proc set_use_drag_icons*(clist: PCList, use_icons: gboolean){.cdecl, - dynlib: lib, importc: "gtk_clist_set_use_drag_icons".} -proc set_button_actions*(clist: PCList, button: guint, - button_actions: guint8){.cdecl, dynlib: lib, - importc: "gtk_clist_set_button_actions".} -proc freeze*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_freeze".} -proc thaw*(clist: PCList){.cdecl, dynlib: lib, importc: "gtk_clist_thaw".} -proc column_titles_show*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_column_titles_show".} -proc column_titles_hide*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_column_titles_hide".} -proc column_title_active*(clist: PCList, column: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_column_title_active".} -proc column_title_passive*(clist: PCList, column: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_column_title_passive".} -proc column_titles_active*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_column_titles_active".} -proc column_titles_passive*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_column_titles_passive".} -proc set_column_title*(clist: PCList, column: gint, title: cstring){. - cdecl, dynlib: lib, importc: "gtk_clist_set_column_title".} -proc get_column_title*(clist: PCList, column: gint): cstring{.cdecl, - dynlib: lib, importc: "gtk_clist_get_column_title".} -proc set_column_widget*(clist: PCList, column: gint, widget: PWidget){. - cdecl, dynlib: lib, importc: "gtk_clist_set_column_widget".} -proc get_column_widget*(clist: PCList, column: gint): PWidget{.cdecl, - dynlib: lib, importc: "gtk_clist_get_column_widget".} -proc set_column_justification*(clist: PCList, column: gint, - justification: TJustification){.cdecl, - dynlib: lib, importc: "gtk_clist_set_column_justification".} -proc set_column_visibility*(clist: PCList, column: gint, visible: gboolean){. - cdecl, dynlib: lib, importc: "gtk_clist_set_column_visibility".} -proc set_column_resizeable*(clist: PCList, column: gint, - resizeable: gboolean){.cdecl, dynlib: lib, - importc: "gtk_clist_set_column_resizeable".} -proc set_column_auto_resize*(clist: PCList, column: gint, - auto_resize: gboolean){.cdecl, dynlib: lib, - importc: "gtk_clist_set_column_auto_resize".} -proc columns_autosize*(clist: PCList): gint{.cdecl, dynlib: lib, - importc: "gtk_clist_columns_autosize".} -proc optimal_column_width*(clist: PCList, column: gint): gint{.cdecl, - dynlib: lib, importc: "gtk_clist_optimal_column_width".} -proc set_column_width*(clist: PCList, column: gint, width: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_set_column_width".} -proc set_column_min_width*(clist: PCList, column: gint, min_width: gint){. - cdecl, dynlib: lib, importc: "gtk_clist_set_column_min_width".} -proc set_column_max_width*(clist: PCList, column: gint, max_width: gint){. - cdecl, dynlib: lib, importc: "gtk_clist_set_column_max_width".} -proc set_row_height*(clist: PCList, height: guint){.cdecl, dynlib: lib, - importc: "gtk_clist_set_row_height".} -proc moveto*(clist: PCList, row: gint, column: gint, row_align: gfloat, - col_align: gfloat){.cdecl, dynlib: lib, - importc: "gtk_clist_moveto".} -proc row_is_visible*(clist: PCList, row: gint): TVisibility{.cdecl, - dynlib: lib, importc: "gtk_clist_row_is_visible".} -proc get_cell_type*(clist: PCList, row: gint, column: gint): TCellType{. - cdecl, dynlib: lib, importc: "gtk_clist_get_cell_type".} -proc set_text*(clist: PCList, row: gint, column: gint, text: cstring){. - cdecl, dynlib: lib, importc: "gtk_clist_set_text".} -proc get_text*(clist: PCList, row: gint, column: gint, text: PPgchar): gint{. - cdecl, dynlib: lib, importc: "gtk_clist_get_text".} -proc set_pixmap*(clist: PCList, row: gint, column: gint, - pixmap: gdk2.PPixmap, mask: gdk2.PBitmap){.cdecl, - dynlib: lib, importc: "gtk_clist_set_pixmap".} -proc get_pixmap*(clist: PCList, row: gint, column: gint, - pixmap: var gdk2.PPixmap, mask: var gdk2.PBitmap): gint{. - cdecl, dynlib: lib, importc: "gtk_clist_get_pixmap".} -proc set_pixtext*(clist: PCList, row: gint, column: gint, text: cstring, - spacing: guint8, pixmap: gdk2.PPixmap, mask: gdk2.PBitmap){. - cdecl, dynlib: lib, importc: "gtk_clist_set_pixtext".} -proc set_foreground*(clist: PCList, row: gint, color: gdk2.PColor){.cdecl, - dynlib: lib, importc: "gtk_clist_set_foreground".} -proc set_background*(clist: PCList, row: gint, color: gdk2.PColor){.cdecl, - dynlib: lib, importc: "gtk_clist_set_background".} -proc set_cell_style*(clist: PCList, row: gint, column: gint, style: PStyle){. - cdecl, dynlib: lib, importc: "gtk_clist_set_cell_style".} -proc get_cell_style*(clist: PCList, row: gint, column: gint): PStyle{. - cdecl, dynlib: lib, importc: "gtk_clist_get_cell_style".} -proc set_row_style*(clist: PCList, row: gint, style: PStyle){.cdecl, - dynlib: lib, importc: "gtk_clist_set_row_style".} -proc get_row_style*(clist: PCList, row: gint): PStyle{.cdecl, dynlib: lib, - importc: "gtk_clist_get_row_style".} -proc set_shift*(clist: PCList, row: gint, column: gint, vertical: gint, - horizontal: gint){.cdecl, dynlib: lib, - importc: "gtk_clist_set_shift".} -proc set_selectable*(clist: PCList, row: gint, selectable: gboolean){. - cdecl, dynlib: lib, importc: "gtk_clist_set_selectable".} -proc get_selectable*(clist: PCList, row: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_clist_get_selectable".} -proc remove*(clist: PCList, row: gint){.cdecl, dynlib: lib, - importc: "gtk_clist_remove".} -proc set_row_data*(clist: PCList, row: gint, data: gpointer){.cdecl, - dynlib: lib, importc: "gtk_clist_set_row_data".} -proc set_row_data_full*(clist: PCList, row: gint, data: gpointer, - destroy: TDestroyNotify){.cdecl, dynlib: lib, - importc: "gtk_clist_set_row_data_full".} -proc get_row_data*(clist: PCList, row: gint): gpointer{.cdecl, - dynlib: lib, importc: "gtk_clist_get_row_data".} -proc find_row_from_data*(clist: PCList, data: gpointer): gint{.cdecl, - dynlib: lib, importc: "gtk_clist_find_row_from_data".} -proc select_row*(clist: PCList, row: gint, column: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_select_row".} -proc unselect_row*(clist: PCList, row: gint, column: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_unselect_row".} -proc undo_selection*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_undo_selection".} -proc clear*(clist: PCList){.cdecl, dynlib: lib, importc: "gtk_clist_clear".} -proc get_selection_info*(clist: PCList, x: gint, y: gint, row: Pgint, - column: Pgint): gint{.cdecl, dynlib: lib, - importc: "gtk_clist_get_selection_info".} -proc select_all*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_select_all".} -proc unselect_all*(clist: PCList){.cdecl, dynlib: lib, - importc: "gtk_clist_unselect_all".} -proc swap_rows*(clist: PCList, row1: gint, row2: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_swap_rows".} -proc row_move*(clist: PCList, source_row: gint, dest_row: gint){.cdecl, - dynlib: lib, importc: "gtk_clist_row_move".} -proc set_compare_func*(clist: PCList, cmp_func: TCListCompareFunc){.cdecl, - dynlib: lib, importc: "gtk_clist_set_compare_func".} -proc set_sort_column*(clist: PCList, column: gint){.cdecl, dynlib: lib, - importc: "gtk_clist_set_sort_column".} -proc set_sort_type*(clist: PCList, sort_type: TSortType){.cdecl, - dynlib: lib, importc: "gtk_clist_set_sort_type".} -proc sort*(clist: PCList){.cdecl, dynlib: lib, importc: "gtk_clist_sort".} -proc set_auto_sort*(clist: PCList, auto_sort: gboolean){.cdecl, - dynlib: lib, importc: "gtk_clist_set_auto_sort".} -proc create_cell_layout*(clist: PCList, clist_row: PCListRow, column: gint): pango.PLayout{. - cdecl, dynlib: lib, importc: "_gtk_clist_create_cell_layout".} -const - DIALOG_MODAL* = cint(1 shl 0) - DIALOG_DESTROY_WITH_PARENT* = cint(1 shl 1) - DIALOG_NO_SEPARATOR* = cint(1 shl 2) - RESPONSE_NONE* = - cint(1) - RESPONSE_REJECT* = - cint(2) - RESPONSE_ACCEPT* = - cint(3) - RESPONSE_DELETE_EVENT* = - cint(4) - RESPONSE_OK* = - cint(5) - RESPONSE_CANCEL* = cint(-6) - RESPONSE_CLOSE* = - cint(7) - RESPONSE_YES* = - cint(8) - RESPONSE_NO* = - cint(9) - RESPONSE_APPLY* = - cint(10) - RESPONSE_HELP* = - cint(11) - -proc TYPE_DIALOG*(): GType -proc DIALOG*(obj: pointer): PDialog -proc DIALOG_CLASS*(klass: pointer): PDialogClass -proc IS_DIALOG*(obj: pointer): bool -proc IS_DIALOG_CLASS*(klass: pointer): bool -proc DIALOG_GET_CLASS*(obj: pointer): PDialogClass -proc dialog_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_dialog_get_type".} -proc dialog_new*(): PDialog{.cdecl, dynlib: lib, importc: "gtk_dialog_new".} -proc add_action_widget*(dialog: PDialog, child: PWidget, - response_id: gint){.cdecl, dynlib: lib, - importc: "gtk_dialog_add_action_widget".} -proc add_button*(dialog: PDialog, button_text: cstring, response_id: gint): PWidget{. - cdecl, dynlib: lib, importc: "gtk_dialog_add_button".} -proc set_response_sensitive*(dialog: PDialog, response_id: gint, - setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_dialog_set_response_sensitive".} -proc set_default_response*(dialog: PDialog, response_id: gint){.cdecl, - dynlib: lib, importc: "gtk_dialog_set_default_response".} -proc set_has_separator*(dialog: PDialog, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_dialog_set_has_separator".} -proc get_has_separator*(dialog: PDialog): gboolean{.cdecl, dynlib: lib, - importc: "gtk_dialog_get_has_separator".} -proc response*(dialog: PDialog, response_id: gint){.cdecl, dynlib: lib, - importc: "gtk_dialog_response".} -proc run*(dialog: PDialog): gint{.cdecl, dynlib: lib, - importc: "gtk_dialog_run".} -proc show_about_dialog*(parent: PWindow, firstPropertyName: cstring){.cdecl, - dynlib: lib, importc: "gtk_show_about_dialog", varargs.} -proc TYPE_VBOX*(): GType -proc VBOX*(obj: pointer): PVBox -proc VBOX_CLASS*(klass: pointer): PVBoxClass -proc IS_VBOX*(obj: pointer): bool -proc IS_VBOX_CLASS*(klass: pointer): bool -proc VBOX_GET_CLASS*(obj: pointer): PVBoxClass -proc vbox_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_vbox_get_type".} -proc vbox_new*(homogeneous: gboolean, spacing: gint): PVBox{.cdecl, dynlib: lib, - importc: "gtk_vbox_new".} -proc TYPE_COLOR_SELECTION*(): GType -proc COLOR_SELECTION*(obj: pointer): PColorSelection -proc COLOR_SELECTION_CLASS*(klass: pointer): PColorSelectionClass -proc IS_COLOR_SELECTION*(obj: pointer): bool -proc IS_COLOR_SELECTION_CLASS*(klass: pointer): bool -proc COLOR_SELECTION_GET_CLASS*(obj: pointer): PColorSelectionClass -proc color_selection_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_color_selection_get_type".} -proc color_selection_new*(): PColorSelection{.cdecl, dynlib: lib, - importc: "gtk_color_selection_new".} -proc get_has_opacity_control*(colorsel: PColorSelection): gboolean{. - cdecl, dynlib: lib, importc: "gtk_color_selection_get_has_opacity_control".} -proc set_has_opacity_control*(colorsel: PColorSelection, - has_opacity: gboolean){.cdecl, dynlib: lib, importc: "gtk_color_selection_set_has_opacity_control".} -proc get_has_palette*(colorsel: PColorSelection): gboolean{. - cdecl, dynlib: lib, importc: "gtk_color_selection_get_has_palette".} -proc set_has_palette*(colorsel: PColorSelection, - has_palette: gboolean){.cdecl, - dynlib: lib, importc: "gtk_color_selection_set_has_palette".} -proc set_current_color*(colorsel: PColorSelection, - color: gdk2.PColor){.cdecl, dynlib: lib, - importc: "gtk_color_selection_set_current_color".} -proc set_current_alpha*(colorsel: PColorSelection, - alpha: guint16){.cdecl, dynlib: lib, - importc: "gtk_color_selection_set_current_alpha".} -proc get_current_color*(colorsel: PColorSelection, - color: gdk2.PColor){.cdecl, dynlib: lib, - importc: "gtk_color_selection_get_current_color".} -proc get_current_alpha*(colorsel: PColorSelection): guint16{. - cdecl, dynlib: lib, importc: "gtk_color_selection_get_current_alpha".} -proc set_previous_color*(colorsel: PColorSelection, - color: gdk2.PColor){.cdecl, dynlib: lib, - importc: "gtk_color_selection_set_previous_color".} -proc set_previous_alpha*(colorsel: PColorSelection, - alpha: guint16){.cdecl, dynlib: lib, - importc: "gtk_color_selection_set_previous_alpha".} -proc get_previous_color*(colorsel: PColorSelection, - color: gdk2.PColor){.cdecl, dynlib: lib, - importc: "gtk_color_selection_get_previous_color".} -proc get_previous_alpha*(colorsel: PColorSelection): guint16{. - cdecl, dynlib: lib, importc: "gtk_color_selection_get_previous_alpha".} -proc is_adjusting*(colorsel: PColorSelection): gboolean{.cdecl, - dynlib: lib, importc: "gtk_color_selection_is_adjusting".} -proc color_selection_palette_from_string*(str: cstring, colors: var gdk2.PColor, - n_colors: Pgint): gboolean{.cdecl, dynlib: lib, importc: "gtk_color_selection_palette_from_string".} -proc color_selection_palette_to_string*(colors: gdk2.PColor, n_colors: gint): cstring{. - cdecl, dynlib: lib, importc: "gtk_color_selection_palette_to_string".} -proc color_selection_set_change_palette_with_screen_hook*( - func: TColorSelectionChangePaletteWithScreenFunc): TColorSelectionChangePaletteWithScreenFunc{. - cdecl, dynlib: lib, - importc: "gtk_color_selection_set_change_palette_with_screen_hook".} -proc TYPE_COLOR_SELECTION_DIALOG*(): GType -proc COLOR_SELECTION_DIALOG*(obj: pointer): PColorSelectionDialog -proc COLOR_SELECTION_DIALOG_CLASS*(klass: pointer): PColorSelectionDialogClass -proc IS_COLOR_SELECTION_DIALOG*(obj: pointer): bool -proc IS_COLOR_SELECTION_DIALOG_CLASS*(klass: pointer): bool -proc COLOR_SELECTION_DIALOG_GET_CLASS*(obj: pointer): PColorSelectionDialogClass -proc color_selection_dialog_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_color_selection_dialog_get_type".} -proc color_selection_dialog_new*(title: cstring): PColorSelectionDialog{.cdecl, - dynlib: lib, importc: "gtk_color_selection_dialog_new".} -proc TYPE_HBOX*(): GType -proc HBOX*(obj: pointer): PHBox -proc HBOX_CLASS*(klass: pointer): PHBoxClass -proc IS_HBOX*(obj: pointer): bool -proc IS_HBOX_CLASS*(klass: pointer): bool -proc HBOX_GET_CLASS*(obj: pointer): PHBoxClass -proc hbox_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_hbox_get_type".} -proc hbox_new*(homogeneous: gboolean, spacing: gint): PHBox{.cdecl, dynlib: lib, - importc: "gtk_hbox_new".} -const - bm_TGtkCombo_value_in_list* = 0x0001'i16 - bp_TGtkCombo_value_in_list* = 0'i16 - bm_TGtkCombo_ok_if_empty* = 0x0002'i16 - bp_TGtkCombo_ok_if_empty* = 1'i16 - bm_TGtkCombo_case_sensitive* = 0x0004'i16 - bp_TGtkCombo_case_sensitive* = 2'i16 - bm_TGtkCombo_use_arrows* = 0x0008'i16 - bp_TGtkCombo_use_arrows* = 3'i16 - bm_TGtkCombo_use_arrows_always* = 0x0010'i16 - bp_TGtkCombo_use_arrows_always* = 4'i16 - -proc TYPE_COMBO*(): GType -proc COMBO*(obj: pointer): PCombo -proc COMBO_CLASS*(klass: pointer): PComboClass -proc IS_COMBO*(obj: pointer): bool -proc IS_COMBO_CLASS*(klass: pointer): bool -proc COMBO_GET_CLASS*(obj: pointer): PComboClass -proc value_in_list*(a: PCombo): guint -proc set_value_in_list*(a: PCombo, `value_in_list`: guint) -proc ok_if_empty*(a: PCombo): guint -proc set_ok_if_empty*(a: PCombo, `ok_if_empty`: guint) -proc case_sensitive*(a: PCombo): guint -proc set_case_sensitive*(a: PCombo, `case_sensitive`: guint) -proc use_arrows*(a: PCombo): guint -proc set_use_arrows*(a: PCombo, `use_arrows`: guint) -proc use_arrows_always*(a: PCombo): guint -proc set_use_arrows_always*(a: PCombo, `use_arrows_always`: guint) -proc combo_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_combo_get_type".} -proc combo_new*(): PCombo{.cdecl, dynlib: lib, importc: "gtk_combo_new".} -proc set_value_in_list*(combo: PCombo, val: gboolean, - ok_if_empty: gboolean){.cdecl, dynlib: lib, - importc: "gtk_combo_set_value_in_list".} -proc set_use_arrows*(combo: PCombo, val: gboolean){.cdecl, dynlib: lib, - importc: "gtk_combo_set_use_arrows".} -proc set_use_arrows_always*(combo: PCombo, val: gboolean){.cdecl, - dynlib: lib, importc: "gtk_combo_set_use_arrows_always".} -proc set_case_sensitive*(combo: PCombo, val: gboolean){.cdecl, - dynlib: lib, importc: "gtk_combo_set_case_sensitive".} -proc set_item_string*(combo: PCombo, item: PItem, item_value: cstring){. - cdecl, dynlib: lib, importc: "gtk_combo_set_item_string".} -proc set_popdown_strings*(combo: PCombo, strings: PGList){.cdecl, - dynlib: lib, importc: "gtk_combo_set_popdown_strings".} -proc disable_activate*(combo: PCombo){.cdecl, dynlib: lib, - importc: "gtk_combo_disable_activate".} -const - bm_TGtkCTree_line_style* = 0x0003'i16 - bp_TGtkCTree_line_style* = 0'i16 - bm_TGtkCTree_expander_style* = 0x000C'i16 - bp_TGtkCTree_expander_style* = 2'i16 - bm_TGtkCTree_show_stub* = 0x0010'i16 - bp_TGtkCTree_show_stub* = 4'i16 - bm_TGtkCTreeRow_is_leaf* = 0x0001'i16 - bp_TGtkCTreeRow_is_leaf* = 0'i16 - bm_TGtkCTreeRow_expanded* = 0x0002'i16 - bp_TGtkCTreeRow_expanded* = 1'i16 - -proc TYPE_CTREE*(): GType -proc CTREE*(obj: pointer): PCTree -proc CTREE_CLASS*(klass: pointer): PCTreeClass -proc IS_CTREE*(obj: pointer): bool -proc IS_CTREE_CLASS*(klass: pointer): bool -proc CTREE_GET_CLASS*(obj: pointer): PCTreeClass -proc CTREE_ROW*(node: TAddress): PCTreeRow -proc CTREE_NODE*(node: TAddress): PCTreeNode -proc CTREE_NODE_NEXT*(nnode: TAddress): PCTreeNode -proc CTREE_NODE_PREV*(pnode: TAddress): PCTreeNode -proc CTREE_FUNC*(fun: TAddress): TCTreeFunc -proc TYPE_CTREE_NODE*(): GType -proc line_style*(a: PCTree): guint -proc set_line_style*(a: PCTree, `line_style`: guint) -proc expander_style*(a: PCTree): guint -proc set_expander_style*(a: PCTree, `expander_style`: guint) -proc show_stub*(a: PCTree): guint -proc set_show_stub*(a: PCTree, `show_stub`: guint) -proc is_leaf*(a: PCTreeRow): guint -proc set_is_leaf*(a: PCTreeRow, `is_leaf`: guint) -proc expanded*(a: PCTreeRow): guint -proc set_expanded*(a: PCTreeRow, `expanded`: guint) -proc ctree_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_ctree_get_type".} -proc ctree_new*(columns: gint, tree_column: gint): PCTree{.cdecl, dynlib: lib, - importc: "gtk_ctree_new".} -proc insert_node*(ctree: PCTree, parent: PCTreeNode, sibling: PCTreeNode, - text: openarray[cstring], spacing: guint8, - pixmap_closed: gdk2.PPixmap, mask_closed: gdk2.PBitmap, - pixmap_opened: gdk2.PPixmap, mask_opened: gdk2.PBitmap, - is_leaf: gboolean, expanded: gboolean): PCTreeNode{. - cdecl, dynlib: lib, importc: "gtk_ctree_insert_node".} -proc remove_node*(ctree: PCTree, node: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_remove_node".} -proc insert_gnode*(ctree: PCTree, parent: PCTreeNode, sibling: PCTreeNode, - gnode: PGNode, fun: TCTreeGNodeFunc, data: gpointer): PCTreeNode{. - cdecl, dynlib: lib, importc: "gtk_ctree_insert_gnode".} -proc export_to_gnode*(ctree: PCTree, parent: PGNode, sibling: PGNode, - node: PCTreeNode, fun: TCTreeGNodeFunc, - data: gpointer): PGNode{.cdecl, dynlib: lib, - importc: "gtk_ctree_export_to_gnode".} -proc post_recursive*(ctree: PCTree, node: PCTreeNode, fun: TCTreeFunc, - data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_ctree_post_recursive".} -proc post_recursive_to_depth*(ctree: PCTree, node: PCTreeNode, - depth: gint, fun: TCTreeFunc, - data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_ctree_post_recursive_to_depth".} -proc pre_recursive*(ctree: PCTree, node: PCTreeNode, fun: TCTreeFunc, - data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_ctree_pre_recursive".} -proc pre_recursive_to_depth*(ctree: PCTree, node: PCTreeNode, - depth: gint, fun: TCTreeFunc, - data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_ctree_pre_recursive_to_depth".} -proc is_viewable*(ctree: PCTree, node: PCTreeNode): gboolean{.cdecl, - dynlib: lib, importc: "gtk_ctree_is_viewable".} -proc last*(ctree: PCTree, node: PCTreeNode): PCTreeNode{.cdecl, - dynlib: lib, importc: "gtk_ctree_last".} -proc find_node_ptr*(ctree: PCTree, ctree_row: PCTreeRow): PCTreeNode{. - cdecl, dynlib: lib, importc: "gtk_ctree_find_node_ptr".} -proc node_nth*(ctree: PCTree, row: guint): PCTreeNode{.cdecl, dynlib: lib, - importc: "gtk_ctree_node_nth".} -proc find*(ctree: PCTree, node: PCTreeNode, child: PCTreeNode): gboolean{. - cdecl, dynlib: lib, importc: "gtk_ctree_find".} -proc is_ancestor*(ctree: PCTree, node: PCTreeNode, child: PCTreeNode): gboolean{. - cdecl, dynlib: lib, importc: "gtk_ctree_is_ancestor".} -proc find_by_row_data*(ctree: PCTree, node: PCTreeNode, data: gpointer): PCTreeNode{. - cdecl, dynlib: lib, importc: "gtk_ctree_find_by_row_data".} -proc find_all_by_row_data*(ctree: PCTree, node: PCTreeNode, - data: gpointer): PGList{.cdecl, dynlib: lib, - importc: "gtk_ctree_find_all_by_row_data".} -proc find_by_row_data_custom*(ctree: PCTree, node: PCTreeNode, - data: gpointer, fun: TGCompareFunc): PCTreeNode{. - cdecl, dynlib: lib, importc: "gtk_ctree_find_by_row_data_custom".} -proc find_all_by_row_data_custom*(ctree: PCTree, node: PCTreeNode, - data: gpointer, fun: TGCompareFunc): PGList{. - cdecl, dynlib: lib, importc: "gtk_ctree_find_all_by_row_data_custom".} -proc is_hot_spot*(ctree: PCTree, x: gint, y: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_ctree_is_hot_spot".} -proc move*(ctree: PCTree, node: PCTreeNode, new_parent: PCTreeNode, - new_sibling: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_move".} -proc expand*(ctree: PCTree, node: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_expand".} -proc expand_recursive*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_expand_recursive".} -proc expand_to_depth*(ctree: PCTree, node: PCTreeNode, depth: gint){. - cdecl, dynlib: lib, importc: "gtk_ctree_expand_to_depth".} -proc collapse*(ctree: PCTree, node: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_collapse".} -proc collapse_recursive*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_collapse_recursive".} -proc collapse_to_depth*(ctree: PCTree, node: PCTreeNode, depth: gint){. - cdecl, dynlib: lib, importc: "gtk_ctree_collapse_to_depth".} -proc toggle_expansion*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_toggle_expansion".} -proc toggle_expansion_recursive*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_toggle_expansion_recursive".} -proc select*(ctree: PCTree, node: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_select".} -proc select_recursive*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_select_recursive".} -proc unselect*(ctree: PCTree, node: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_unselect".} -proc unselect_recursive*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_unselect_recursive".} -proc real_select_recursive*(ctree: PCTree, node: PCTreeNode, state: gint){. - cdecl, dynlib: lib, importc: "gtk_ctree_real_select_recursive".} -proc node_set_text*(ctree: PCTree, node: PCTreeNode, column: gint, - text: cstring){.cdecl, dynlib: lib, - importc: "gtk_ctree_node_set_text".} -proc node_set_pixmap*(ctree: PCTree, node: PCTreeNode, column: gint, - pixmap: gdk2.PPixmap, mask: gdk2.PBitmap){.cdecl, - dynlib: lib, importc: "gtk_ctree_node_set_pixmap".} -proc node_set_pixtext*(ctree: PCTree, node: PCTreeNode, column: gint, - text: cstring, spacing: guint8, pixmap: gdk2.PPixmap, - mask: gdk2.PBitmap){.cdecl, dynlib: lib, - importc: "gtk_ctree_node_set_pixtext".} -proc set_node_info*(ctree: PCTree, node: PCTreeNode, text: cstring, - spacing: guint8, pixmap_closed: gdk2.PPixmap, - mask_closed: gdk2.PBitmap, pixmap_opened: gdk2.PPixmap, - mask_opened: gdk2.PBitmap, is_leaf: gboolean, - expanded: gboolean){.cdecl, dynlib: lib, - importc: "gtk_ctree_set_node_info".} -proc node_set_shift*(ctree: PCTree, node: PCTreeNode, column: gint, - vertical: gint, horizontal: gint){.cdecl, - dynlib: lib, importc: "gtk_ctree_node_set_shift".} -proc node_set_selectable*(ctree: PCTree, node: PCTreeNode, - selectable: gboolean){.cdecl, dynlib: lib, - importc: "gtk_ctree_node_set_selectable".} -proc node_get_selectable*(ctree: PCTree, node: PCTreeNode): gboolean{. - cdecl, dynlib: lib, importc: "gtk_ctree_node_get_selectable".} -proc node_get_cell_type*(ctree: PCTree, node: PCTreeNode, column: gint): TCellType{. - cdecl, dynlib: lib, importc: "gtk_ctree_node_get_cell_type".} -proc node_get_text*(ctree: PCTree, node: PCTreeNode, column: gint, - text: PPgchar): gboolean{.cdecl, dynlib: lib, - importc: "gtk_ctree_node_get_text".} -proc node_set_row_style*(ctree: PCTree, node: PCTreeNode, style: PStyle){. - cdecl, dynlib: lib, importc: "gtk_ctree_node_set_row_style".} -proc node_get_row_style*(ctree: PCTree, node: PCTreeNode): PStyle{.cdecl, - dynlib: lib, importc: "gtk_ctree_node_get_row_style".} -proc node_set_cell_style*(ctree: PCTree, node: PCTreeNode, column: gint, - style: PStyle){.cdecl, dynlib: lib, - importc: "gtk_ctree_node_set_cell_style".} -proc node_get_cell_style*(ctree: PCTree, node: PCTreeNode, column: gint): PStyle{. - cdecl, dynlib: lib, importc: "gtk_ctree_node_get_cell_style".} -proc node_set_foreground*(ctree: PCTree, node: PCTreeNode, - color: gdk2.PColor){.cdecl, dynlib: lib, - importc: "gtk_ctree_node_set_foreground".} -proc node_set_background*(ctree: PCTree, node: PCTreeNode, - color: gdk2.PColor){.cdecl, dynlib: lib, - importc: "gtk_ctree_node_set_background".} -proc node_set_row_data*(ctree: PCTree, node: PCTreeNode, data: gpointer){. - cdecl, dynlib: lib, importc: "gtk_ctree_node_set_row_data".} -proc node_set_row_data_full*(ctree: PCTree, node: PCTreeNode, - data: gpointer, destroy: TDestroyNotify){. - cdecl, dynlib: lib, importc: "gtk_ctree_node_set_row_data_full".} -proc node_get_row_data*(ctree: PCTree, node: PCTreeNode): gpointer{. - cdecl, dynlib: lib, importc: "gtk_ctree_node_get_row_data".} -proc node_moveto*(ctree: PCTree, node: PCTreeNode, column: gint, - row_align: gfloat, col_align: gfloat){.cdecl, - dynlib: lib, importc: "gtk_ctree_node_moveto".} -proc node_is_visible*(ctree: PCTree, node: PCTreeNode): TVisibility{. - cdecl, dynlib: lib, importc: "gtk_ctree_node_is_visible".} -proc set_indent*(ctree: PCTree, indent: gint){.cdecl, dynlib: lib, - importc: "gtk_ctree_set_indent".} -proc set_spacing*(ctree: PCTree, spacing: gint){.cdecl, dynlib: lib, - importc: "gtk_ctree_set_spacing".} -proc set_show_stub*(ctree: PCTree, show_stub: gboolean){.cdecl, - dynlib: lib, importc: "gtk_ctree_set_show_stub".} -proc set_line_style*(ctree: PCTree, line_style: TCTreeLineStyle){.cdecl, - dynlib: lib, importc: "gtk_ctree_set_line_style".} -proc set_expander_style*(ctree: PCTree, - expander_style: TCTreeExpanderStyle){.cdecl, - dynlib: lib, importc: "gtk_ctree_set_expander_style".} -proc set_drag_compare_func*(ctree: PCTree, cmp_func: TCTreeCompareDragFunc){. - cdecl, dynlib: lib, importc: "gtk_ctree_set_drag_compare_func".} -proc sort_node*(ctree: PCTree, node: PCTreeNode){.cdecl, dynlib: lib, - importc: "gtk_ctree_sort_node".} -proc sort_recursive*(ctree: PCTree, node: PCTreeNode){.cdecl, - dynlib: lib, importc: "gtk_ctree_sort_recursive".} -proc ctree_set_reorderable*(t: pointer, r: bool) -proc ctree_node_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_ctree_node_get_type".} -proc TYPE_DRAWING_AREA*(): GType -proc DRAWING_AREA*(obj: pointer): PDrawingArea -proc DRAWING_AREA_CLASS*(klass: pointer): PDrawingAreaClass -proc IS_DRAWING_AREA*(obj: pointer): bool -proc IS_DRAWING_AREA_CLASS*(klass: pointer): bool -proc DRAWING_AREA_GET_CLASS*(obj: pointer): PDrawingAreaClass -proc drawing_area_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_drawing_area_get_type".} -proc drawing_area_new*(): PDrawingArea{.cdecl, dynlib: lib, - importc: "gtk_drawing_area_new".} -proc TYPE_CURVE*(): GType -proc CURVE*(obj: pointer): PCurve -proc CURVE_CLASS*(klass: pointer): PCurveClass -proc IS_CURVE*(obj: pointer): bool -proc IS_CURVE_CLASS*(klass: pointer): bool -proc CURVE_GET_CLASS*(obj: pointer): PCurveClass -proc curve_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_curve_get_type".} -proc curve_new*(): PCurve{.cdecl, dynlib: lib, importc: "gtk_curve_new".} -proc reset*(curve: PCurve){.cdecl, dynlib: lib, importc: "gtk_curve_reset".} -proc set_gamma*(curve: PCurve, gamma: gfloat){.cdecl, dynlib: lib, - importc: "gtk_curve_set_gamma".} -proc set_range*(curve: PCurve, min_x: gfloat, max_x: gfloat, - min_y: gfloat, max_y: gfloat){.cdecl, dynlib: lib, - importc: "gtk_curve_set_range".} -proc set_curve_type*(curve: PCurve, thetype: TCurveType){.cdecl, - dynlib: lib, importc: "gtk_curve_set_curve_type".} -const - DEST_DEFAULT_MOTION* = 1 shl 0 - DEST_DEFAULT_HIGHLIGHT* = 1 shl 1 - DEST_DEFAULT_DROP* = 1 shl 2 - DEST_DEFAULT_ALL* = 0x00000007 - TARGET_SAME_APP* = 1 shl 0 - TARGET_SAME_WIDGET* = 1 shl 1 - -proc drag_get_data*(widget: PWidget, context: gdk2.PDragContext, target: gdk2.TAtom, - time: guint32){.cdecl, dynlib: lib, - importc: "gtk_drag_get_data".} -proc drag_finish*(context: gdk2.PDragContext, success: gboolean, del: gboolean, - time: guint32){.cdecl, dynlib: lib, importc: "gtk_drag_finish".} -proc drag_get_source_widget*(context: gdk2.PDragContext): PWidget{.cdecl, - dynlib: lib, importc: "gtk_drag_get_source_widget".} -proc drag_highlight*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_drag_highlight".} -proc drag_unhighlight*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_drag_unhighlight".} -proc drag_dest_set*(widget: PWidget, flags: TDestDefaults, - targets: PTargetEntry, n_targets: gint, - actions: gdk2.TDragAction){.cdecl, dynlib: lib, - importc: "gtk_drag_dest_set".} -proc drag_dest_set_proxy*(widget: PWidget, proxy_window: gdk2.PWindow, - protocol: gdk2.TDragProtocol, use_coordinates: gboolean){. - cdecl, dynlib: lib, importc: "gtk_drag_dest_set_proxy".} -proc drag_dest_unset*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_drag_dest_unset".} -proc drag_dest_find_target*(widget: PWidget, context: gdk2.PDragContext, - target_list: PTargetList): gdk2.TAtom{.cdecl, - dynlib: lib, importc: "gtk_drag_dest_find_target".} -proc drag_dest_get_target_list*(widget: PWidget): PTargetList{.cdecl, - dynlib: lib, importc: "gtk_drag_dest_get_target_list".} -proc drag_dest_set_target_list*(widget: PWidget, target_list: PTargetList){. - cdecl, dynlib: lib, importc: "gtk_drag_dest_set_target_list".} -proc drag_source_set*(widget: PWidget, start_button_mask: gdk2.TModifierType, - targets: PTargetEntry, n_targets: gint, - actions: gdk2.TDragAction){.cdecl, dynlib: lib, - importc: "gtk_drag_source_set".} -proc drag_source_unset*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_drag_source_unset".} -proc drag_source_set_icon*(widget: PWidget, colormap: gdk2.PColormap, - pixmap: gdk2.PPixmap, mask: gdk2.PBitmap){.cdecl, - dynlib: lib, importc: "gtk_drag_source_set_icon".} -proc drag_source_set_icon_pixbuf*(widget: PWidget, pixbuf: gdk2pixbuf.PPixbuf){.cdecl, - dynlib: lib, importc: "gtk_drag_source_set_icon_pixbuf".} -proc drag_source_set_icon_stock*(widget: PWidget, stock_id: cstring){.cdecl, - dynlib: lib, importc: "gtk_drag_source_set_icon_stock".} -proc drag_begin*(widget: PWidget, targets: PTargetList, actions: gdk2.TDragAction, - button: gint, event: gdk2.PEvent): gdk2.PDragContext{.cdecl, - dynlib: lib, importc: "gtk_drag_begin".} -proc drag_set_icon_widget*(context: gdk2.PDragContext, widget: PWidget, - hot_x: gint, hot_y: gint){.cdecl, dynlib: lib, - importc: "gtk_drag_set_icon_widget".} -proc drag_set_icon_pixmap*(context: gdk2.PDragContext, colormap: gdk2.PColormap, - pixmap: gdk2.PPixmap, mask: gdk2.PBitmap, hot_x: gint, - hot_y: gint){.cdecl, dynlib: lib, - importc: "gtk_drag_set_icon_pixmap".} -proc drag_set_icon_pixbuf*(context: gdk2.PDragContext, pixbuf: gdk2pixbuf.PPixbuf, - hot_x: gint, hot_y: gint){.cdecl, dynlib: lib, - importc: "gtk_drag_set_icon_pixbuf".} -proc drag_set_icon_stock*(context: gdk2.PDragContext, stock_id: cstring, - hot_x: gint, hot_y: gint){.cdecl, dynlib: lib, - importc: "gtk_drag_set_icon_stock".} -proc drag_set_icon_default*(context: gdk2.PDragContext){.cdecl, dynlib: lib, - importc: "gtk_drag_set_icon_default".} -proc drag_check_threshold*(widget: PWidget, start_x: gint, start_y: gint, - current_x: gint, current_y: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_drag_check_threshold".} -proc drag_source_handle_event*(widget: PWidget, event: gdk2.PEvent){.cdecl, - dynlib: lib, importc: "_gtk_drag_source_handle_event".} -proc drag_dest_handle_event*(toplevel: PWidget, event: gdk2.PEvent){.cdecl, - dynlib: lib, importc: "_gtk_drag_dest_handle_event".} -proc TYPE_EDITABLE*(): GType -proc EDITABLE*(obj: pointer): PEditable -proc EDITABLE_CLASS*(vtable: pointer): PEditableClass -proc IS_EDITABLE*(obj: pointer): bool -proc IS_EDITABLE_CLASS*(vtable: pointer): bool -proc EDITABLE_GET_CLASS*(inst: pointer): PEditableClass -proc editable_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_editable_get_type".} -proc select_region*(editable: PEditable, start: gint, theEnd: gint){. - cdecl, dynlib: lib, importc: "gtk_editable_select_region".} -proc get_selection_bounds*(editable: PEditable, start: Pgint, - theEnd: Pgint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_editable_get_selection_bounds".} -proc insert_text*(editable: PEditable, new_text: cstring, - new_text_length: gint, position: Pgint){.cdecl, - dynlib: lib, importc: "gtk_editable_insert_text".} -proc delete_text*(editable: PEditable, start_pos: gint, end_pos: gint){. - cdecl, dynlib: lib, importc: "gtk_editable_delete_text".} -proc get_chars*(editable: PEditable, start_pos: gint, end_pos: gint): cstring{. - cdecl, dynlib: lib, importc: "gtk_editable_get_chars".} -proc cut_clipboard*(editable: PEditable){.cdecl, dynlib: lib, - importc: "gtk_editable_cut_clipboard".} -proc copy_clipboard*(editable: PEditable){.cdecl, dynlib: lib, - importc: "gtk_editable_copy_clipboard".} -proc paste_clipboard*(editable: PEditable){.cdecl, dynlib: lib, - importc: "gtk_editable_paste_clipboard".} -proc delete_selection*(editable: PEditable){.cdecl, dynlib: lib, - importc: "gtk_editable_delete_selection".} -proc set_position*(editable: PEditable, position: gint){.cdecl, - dynlib: lib, importc: "gtk_editable_set_position".} -proc get_position*(editable: PEditable): gint{.cdecl, dynlib: lib, - importc: "gtk_editable_get_position".} -proc set_editable*(editable: PEditable, is_editable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_editable_set_editable".} -proc get_editable*(editable: PEditable): gboolean{.cdecl, dynlib: lib, - importc: "gtk_editable_get_editable".} -proc TYPE_IM_CONTEXT*(): GType -proc IM_CONTEXT*(obj: pointer): PIMContext -proc IM_CONTEXT_CLASS*(klass: pointer): PIMContextClass -proc IS_IM_CONTEXT*(obj: pointer): bool -proc IS_IM_CONTEXT_CLASS*(klass: pointer): bool -proc IM_CONTEXT_GET_CLASS*(obj: pointer): PIMContextClass -proc im_context_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_im_context_get_type".} -proc set_client_window*(context: PIMContext, window: gdk2.PWindow){. - cdecl, dynlib: lib, importc: "gtk_im_context_set_client_window".} -proc filter_keypress*(context: PIMContext, event: gdk2.PEventKey): gboolean{. - cdecl, dynlib: lib, importc: "gtk_im_context_filter_keypress".} -proc focus_in*(context: PIMContext){.cdecl, dynlib: lib, - importc: "gtk_im_context_focus_in".} -proc focus_out*(context: PIMContext){.cdecl, dynlib: lib, - importc: "gtk_im_context_focus_out".} -proc reset*(context: PIMContext){.cdecl, dynlib: lib, - importc: "gtk_im_context_reset".} -proc set_cursor_location*(context: PIMContext, area: gdk2.PRectangle){. - cdecl, dynlib: lib, importc: "gtk_im_context_set_cursor_location".} -proc set_use_preedit*(context: PIMContext, use_preedit: gboolean){. - cdecl, dynlib: lib, importc: "gtk_im_context_set_use_preedit".} -proc set_surrounding*(context: PIMContext, text: cstring, len: gint, - cursor_index: gint){.cdecl, dynlib: lib, - importc: "gtk_im_context_set_surrounding".} -proc get_surrounding*(context: PIMContext, text: PPgchar, - cursor_index: Pgint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_im_context_get_surrounding".} -proc delete_surrounding*(context: PIMContext, offset: gint, - n_chars: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_im_context_delete_surrounding".} -const - bm_TGtkMenuShell_active* = 0x0001'i16 - bp_TGtkMenuShell_active* = 0'i16 - bm_TGtkMenuShell_have_grab* = 0x0002'i16 - bp_TGtkMenuShell_have_grab* = 1'i16 - bm_TGtkMenuShell_have_xgrab* = 0x0004'i16 - bp_TGtkMenuShell_have_xgrab* = 2'i16 - bm_TGtkMenuShell_ignore_leave* = 0x0008'i16 - bp_TGtkMenuShell_ignore_leave* = 3'i16 - bm_TGtkMenuShell_menu_flag* = 0x0010'i16 - bp_TGtkMenuShell_menu_flag* = 4'i16 - bm_TGtkMenuShell_ignore_enter* = 0x0020'i16 - bp_TGtkMenuShell_ignore_enter* = 5'i16 - bm_TGtkMenuShellClass_submenu_placement* = 0x0001'i16 - bp_TGtkMenuShellClass_submenu_placement* = 0'i16 - -proc TYPE_MENU_SHELL*(): GType -proc MENU_SHELL*(obj: pointer): PMenuShell -proc MENU_SHELL_CLASS*(klass: pointer): PMenuShellClass -proc IS_MENU_SHELL*(obj: pointer): bool -proc IS_MENU_SHELL_CLASS*(klass: pointer): bool -proc MENU_SHELL_GET_CLASS*(obj: pointer): PMenuShellClass -proc active*(a: PMenuShell): guint -proc set_active*(a: PMenuShell, `active`: guint) -proc have_grab*(a: PMenuShell): guint -proc set_have_grab*(a: PMenuShell, `have_grab`: guint) -proc have_xgrab*(a: PMenuShell): guint -proc set_have_xgrab*(a: PMenuShell, `have_xgrab`: guint) -proc ignore_leave*(a: PMenuShell): guint -proc set_ignore_leave*(a: PMenuShell, `ignore_leave`: guint) -proc menu_flag*(a: PMenuShell): guint -proc set_menu_flag*(a: PMenuShell, `menu_flag`: guint) -proc ignore_enter*(a: PMenuShell): guint -proc set_ignore_enter*(a: PMenuShell, `ignore_enter`: guint) -proc submenu_placement*(a: PMenuShellClass): guint -proc set_submenu_placement*(a: PMenuShellClass, `submenu_placement`: guint) -proc menu_shell_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_menu_shell_get_type".} -proc append*(menu_shell: PMenuShell, child: PWidget){.cdecl, - dynlib: lib, importc: "gtk_menu_shell_append".} -proc prepend*(menu_shell: PMenuShell, child: PWidget){.cdecl, - dynlib: lib, importc: "gtk_menu_shell_prepend".} -proc insert*(menu_shell: PMenuShell, child: PWidget, position: gint){. - cdecl, dynlib: lib, importc: "gtk_menu_shell_insert".} -proc deactivate*(menu_shell: PMenuShell){.cdecl, dynlib: lib, - importc: "gtk_menu_shell_deactivate".} -proc select_item*(menu_shell: PMenuShell, menu_item: PWidget){.cdecl, - dynlib: lib, importc: "gtk_menu_shell_select_item".} -proc deselect*(menu_shell: PMenuShell){.cdecl, dynlib: lib, - importc: "gtk_menu_shell_deselect".} -proc activate_item*(menu_shell: PMenuShell, menu_item: PWidget, - force_deactivate: gboolean){.cdecl, dynlib: lib, - importc: "gtk_menu_shell_activate_item".} -proc select_first*(menu_shell: PMenuShell){.cdecl, dynlib: lib, - importc: "_gtk_menu_shell_select_first".} -proc activate*(menu_shell: PMenuShell){.cdecl, dynlib: lib, - importc: "_gtk_menu_shell_activate".} -const - bm_TGtkMenu_needs_destruction_ref_count* = 0x0001'i16 - bp_TGtkMenu_needs_destruction_ref_count* = 0'i16 - bm_TGtkMenu_torn_off* = 0x0002'i16 - bp_TGtkMenu_torn_off* = 1'i16 - bm_TGtkMenu_tearoff_active* = 0x0004'i16 - bp_TGtkMenu_tearoff_active* = 2'i16 - bm_TGtkMenu_scroll_fast* = 0x0008'i16 - bp_TGtkMenu_scroll_fast* = 3'i16 - bm_TGtkMenu_upper_arrow_visible* = 0x0010'i16 - bp_TGtkMenu_upper_arrow_visible* = 4'i16 - bm_TGtkMenu_lower_arrow_visible* = 0x0020'i16 - bp_TGtkMenu_lower_arrow_visible* = 5'i16 - bm_TGtkMenu_upper_arrow_prelight* = 0x0040'i16 - bp_TGtkMenu_upper_arrow_prelight* = 6'i16 - bm_TGtkMenu_lower_arrow_prelight* = 0x0080'i16 - bp_TGtkMenu_lower_arrow_prelight* = 7'i16 - -proc TYPE_MENU*(): GType -proc MENU*(obj: pointer): PMenu -proc MENU_CLASS*(klass: pointer): PMenuClass -proc IS_MENU*(obj: pointer): bool -proc IS_MENU_CLASS*(klass: pointer): bool -proc MENU_GET_CLASS*(obj: pointer): PMenuClass -proc needs_destruction_ref_count*(a: PMenu): guint -proc set_needs_destruction_ref_count*(a: PMenu, - `needs_destruction_ref_count`: guint) -proc torn_off*(a: PMenu): guint -proc set_torn_off*(a: PMenu, `torn_off`: guint) -proc tearoff_active*(a: PMenu): guint -proc set_tearoff_active*(a: PMenu, `tearoff_active`: guint) -proc scroll_fast*(a: PMenu): guint -proc set_scroll_fast*(a: PMenu, `scroll_fast`: guint) -proc upper_arrow_visible*(a: PMenu): guint -proc set_upper_arrow_visible*(a: PMenu, `upper_arrow_visible`: guint) -proc lower_arrow_visible*(a: PMenu): guint -proc set_lower_arrow_visible*(a: PMenu, `lower_arrow_visible`: guint) -proc upper_arrow_prelight*(a: PMenu): guint -proc set_upper_arrow_prelight*(a: PMenu, `upper_arrow_prelight`: guint) -proc lower_arrow_prelight*(a: PMenu): guint -proc set_lower_arrow_prelight*(a: PMenu, `lower_arrow_prelight`: guint) -proc menu_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_menu_get_type".} -proc menu_new*(): PMenu{.cdecl, dynlib: lib, importc: "gtk_menu_new".} -proc popup*(menu: PMenu, parent_menu_shell: PWidget, - parent_menu_item: PWidget, fun: TMenuPositionFunc, - data: gpointer, button: guint, activate_time: guint32){.cdecl, - dynlib: lib, importc: "gtk_menu_popup".} -proc reposition*(menu: PMenu){.cdecl, dynlib: lib, - importc: "gtk_menu_reposition".} -proc popdown*(menu: PMenu){.cdecl, dynlib: lib, importc: "gtk_menu_popdown".} -proc get_active*(menu: PMenu): PWidget{.cdecl, dynlib: lib, - importc: "gtk_menu_get_active".} -proc set_active*(menu: PMenu, index: guint){.cdecl, dynlib: lib, - importc: "gtk_menu_set_active".} -proc set_accel_group*(menu: PMenu, accel_group: PAccelGroup){.cdecl, - dynlib: lib, importc: "gtk_menu_set_accel_group".} -proc get_accel_group*(menu: PMenu): PAccelGroup{.cdecl, dynlib: lib, - importc: "gtk_menu_get_accel_group".} -proc set_accel_path*(menu: PMenu, accel_path: cstring){.cdecl, dynlib: lib, - importc: "gtk_menu_set_accel_path".} -proc attach_to_widget*(menu: PMenu, attach_widget: PWidget, - detacher: TMenuDetachFunc){.cdecl, dynlib: lib, - importc: "gtk_menu_attach_to_widget".} -proc detach*(menu: PMenu){.cdecl, dynlib: lib, importc: "gtk_menu_detach".} -proc get_attach_widget*(menu: PMenu): PWidget{.cdecl, dynlib: lib, - importc: "gtk_menu_get_attach_widget".} -proc set_tearoff_state*(menu: PMenu, torn_off: gboolean){.cdecl, - dynlib: lib, importc: "gtk_menu_set_tearoff_state".} -proc get_tearoff_state*(menu: PMenu): gboolean{.cdecl, dynlib: lib, - importc: "gtk_menu_get_tearoff_state".} -proc set_title*(menu: PMenu, title: cstring){.cdecl, dynlib: lib, - importc: "gtk_menu_set_title".} -proc get_title*(menu: PMenu): cstring{.cdecl, dynlib: lib, - importc: "gtk_menu_get_title".} -proc reorder_child*(menu: PMenu, child: PWidget, position: gint){.cdecl, - dynlib: lib, importc: "gtk_menu_reorder_child".} -proc set_screen*(menu: PMenu, screen: gdk2.PScreen){.cdecl, dynlib: lib, - importc: "gtk_menu_set_screen".} -const - bm_TGtkEntry_editable* = 0x0001'i16 - bp_TGtkEntry_editable* = 0'i16 - bm_TGtkEntry_visible* = 0x0002'i16 - bp_TGtkEntry_visible* = 1'i16 - bm_TGtkEntry_overwrite_mode* = 0x0004'i16 - bp_TGtkEntry_overwrite_mode* = 2'i16 - bm_TGtkEntry_in_drag* = 0x0008'i16 - bp_TGtkEntry_in_drag* = 3'i16 - bm_TGtkEntry_cache_includes_preedit* = 0x0001'i16 - bp_TGtkEntry_cache_includes_preedit* = 0'i16 - bm_TGtkEntry_need_im_reset* = 0x0002'i16 - bp_TGtkEntry_need_im_reset* = 1'i16 - bm_TGtkEntry_has_frame* = 0x0004'i16 - bp_TGtkEntry_has_frame* = 2'i16 - bm_TGtkEntry_activates_default* = 0x0008'i16 - bp_TGtkEntry_activates_default* = 3'i16 - bm_TGtkEntry_cursor_visible* = 0x0010'i16 - bp_TGtkEntry_cursor_visible* = 4'i16 - bm_TGtkEntry_in_click* = 0x0020'i16 - bp_TGtkEntry_in_click* = 5'i16 - bm_TGtkEntry_is_cell_renderer* = 0x0040'i16 - bp_TGtkEntry_is_cell_renderer* = 6'i16 - bm_TGtkEntry_editing_canceled* = 0x0080'i16 - bp_TGtkEntry_editing_canceled* = 7'i16 - bm_TGtkEntry_mouse_cursor_obscured* = 0x0100'i16 - bp_TGtkEntry_mouse_cursor_obscured* = 8'i16 - -proc TYPE_ENTRY*(): GType -proc ENTRY*(obj: pointer): PEntry -proc ENTRY_CLASS*(klass: pointer): PEntryClass -proc IS_ENTRY*(obj: pointer): bool -proc IS_ENTRY_CLASS*(klass: pointer): bool -proc ENTRY_GET_CLASS*(obj: pointer): PEntryClass -proc editable*(a: PEntry): guint -proc set_editable*(a: PEntry, `editable`: guint) -proc visible*(a: PEntry): guint -proc set_visible*(a: PEntry, `visible`: guint) -proc overwrite_mode*(a: PEntry): guint -proc set_overwrite_mode*(a: PEntry, `overwrite_mode`: guint) -proc in_drag*(a: PEntry): guint -proc set_in_drag*(a: PEntry, `in_drag`: guint) -proc cache_includes_preedit*(a: PEntry): guint -proc set_cache_includes_preedit*(a: PEntry, `cache_includes_preedit`: guint) -proc need_im_reset*(a: PEntry): guint -proc set_need_im_reset*(a: PEntry, `need_im_reset`: guint) -proc has_frame*(a: PEntry): guint -proc set_has_frame*(a: PEntry, `has_frame`: guint) -proc activates_default*(a: PEntry): guint -proc set_activates_default*(a: PEntry, `activates_default`: guint) -proc cursor_visible*(a: PEntry): guint -proc set_cursor_visible*(a: PEntry, `cursor_visible`: guint) -proc in_click*(a: PEntry): guint -proc set_in_click*(a: PEntry, `in_click`: guint) -proc is_cell_renderer*(a: PEntry): guint -proc set_is_cell_renderer*(a: PEntry, `is_cell_renderer`: guint) -proc editing_canceled*(a: PEntry): guint -proc set_editing_canceled*(a: PEntry, `editing_canceled`: guint) -proc mouse_cursor_obscured*(a: PEntry): guint -proc set_mouse_cursor_obscured*(a: PEntry, `mouse_cursor_obscured`: guint) -proc entry_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_entry_get_type".} -proc entry_new*(): PEntry{.cdecl, dynlib: lib, importc: "gtk_entry_new".} -proc set_visibility*(entry: PEntry, visible: gboolean){.cdecl, - dynlib: lib, importc: "gtk_entry_set_visibility".} -proc get_visibility*(entry: PEntry): gboolean{.cdecl, dynlib: lib, - importc: "gtk_entry_get_visibility".} -proc set_invisible_char*(entry: PEntry, ch: gunichar){.cdecl, dynlib: lib, - importc: "gtk_entry_set_invisible_char".} -proc get_invisible_char*(entry: PEntry): gunichar{.cdecl, dynlib: lib, - importc: "gtk_entry_get_invisible_char".} -proc set_has_frame*(entry: PEntry, setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_entry_set_has_frame".} -proc get_has_frame*(entry: PEntry): gboolean{.cdecl, dynlib: lib, - importc: "gtk_entry_get_has_frame".} -proc set_max_length*(entry: PEntry, max: gint){.cdecl, dynlib: lib, - importc: "gtk_entry_set_max_length".} -proc get_max_length*(entry: PEntry): gint{.cdecl, dynlib: lib, - importc: "gtk_entry_get_max_length".} -proc set_activates_default*(entry: PEntry, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_entry_set_activates_default".} -proc get_activates_default*(entry: PEntry): gboolean{.cdecl, dynlib: lib, - importc: "gtk_entry_get_activates_default".} -proc set_width_chars*(entry: PEntry, n_chars: gint){.cdecl, dynlib: lib, - importc: "gtk_entry_set_width_chars".} -proc get_width_chars*(entry: PEntry): gint{.cdecl, dynlib: lib, - importc: "gtk_entry_get_width_chars".} -proc set_text*(entry: PEntry, text: cstring){.cdecl, dynlib: lib, - importc: "gtk_entry_set_text".} -proc get_text*(entry: PEntry): cstring{.cdecl, dynlib: lib, - importc: "gtk_entry_get_text".} -proc get_layout*(entry: PEntry): pango.PLayout{.cdecl, dynlib: lib, - importc: "gtk_entry_get_layout".} -proc get_layout_offsets*(entry: PEntry, x: Pgint, y: Pgint){.cdecl, - dynlib: lib, importc: "gtk_entry_get_layout_offsets".} -const - ANCHOR_CENTER* = 0 - ANCHOR_NORTH* = 1 - ANCHOR_NORTH_WEST* = 2 - ANCHOR_NORTH_EAST* = 3 - ANCHOR_SOUTH* = 4 - ANCHOR_SOUTH_WEST* = 5 - ANCHOR_SOUTH_EAST* = 6 - ANCHOR_WEST* = 7 - ANCHOR_EAST* = 8 - ANCHOR_N* = ANCHOR_NORTH - ANCHOR_NW* = ANCHOR_NORTH_WEST - ANCHOR_NE* = ANCHOR_NORTH_EAST - ANCHOR_S* = ANCHOR_SOUTH - ANCHOR_SW* = ANCHOR_SOUTH_WEST - ANCHOR_SE* = ANCHOR_SOUTH_EAST - ANCHOR_W* = ANCHOR_WEST - ANCHOR_E* = ANCHOR_EAST - ARROW_UP* = 0 - ARROW_DOWN* = 1 - ARROW_LEFT* = 2 - ARROW_RIGHT* = 3 - constEXPAND* = 1 shl 0 - constSHRINK* = 1 shl 1 - constFILL* = 1 shl 2 - BUTTONBOX_DEFAULT_STYLE* = 0 - BUTTONBOX_SPREAD* = 1 - BUTTONBOX_EDGE* = 2 - BUTTONBOX_START* = 3 - BUTTONBOX_END* = 4 - CURVE_TYPE_LINEAR* = 0 - CURVE_TYPE_SPLINE* = 1 - CURVE_TYPE_FREE* = 2 - DELETE_CHARS* = 0 - DELETE_WORD_ENDS* = 1 - DELETE_WORDS* = 2 - DELETE_DISPLAY_LINES* = 3 - DELETE_DISPLAY_LINE_ENDS* = 4 - DELETE_PARAGRAPH_ENDS* = 5 - DELETE_PARAGRAPHS* = 6 - DELETE_WHITESPACE* = 7 - DIR_TAB_FORWARD* = 0 - DIR_TAB_BACKWARD* = 1 - DIR_UP* = 2 - DIR_DOWN* = 3 - DIR_LEFT* = 4 - DIR_RIGHT* = 5 - EXPANDER_COLLAPSED* = 0 - EXPANDER_SEMI_COLLAPSED* = 1 - EXPANDER_SEMI_EXPANDED* = 2 - EXPANDER_EXPANDED* = 3 - ICON_SIZE_INVALID* = 0 - ICON_SIZE_MENU* = 1 - ICON_SIZE_SMALL_TOOLBAR* = 2 - ICON_SIZE_LARGE_TOOLBAR* = 3 - ICON_SIZE_BUTTON* = 4 - ICON_SIZE_DND* = 5 - ICON_SIZE_DIALOG* = 6 - TEXT_DIR_NONE* = 0 - TEXT_DIR_LTR* = 1 - TEXT_DIR_RTL* = 2 - JUSTIFY_LEFT* = 0 - JUSTIFY_RIGHT* = 1 - JUSTIFY_CENTER* = 2 - JUSTIFY_FILL* = 3 - MENU_DIR_PARENT* = 0 - MENU_DIR_CHILD* = 1 - MENU_DIR_NEXT* = 2 - MENU_DIR_PREV* = 3 - PIXELS* = 0 - INCHES* = 1 - CENTIMETERS* = 2 - MOVEMENT_LOGICAL_POSITIONS* = 0 - MOVEMENT_VISUAL_POSITIONS* = 1 - MOVEMENT_WORDS* = 2 - MOVEMENT_DISPLAY_LINES* = 3 - MOVEMENT_DISPLAY_LINE_ENDS* = 4 - MOVEMENT_PARAGRAPHS* = 5 - MOVEMENT_PARAGRAPH_ENDS* = 6 - MOVEMENT_PAGES* = 7 - MOVEMENT_BUFFER_ENDS* = 8 - ORIENTATION_HORIZONTAL* = 0 - ORIENTATION_VERTICAL* = 1 - CORNER_TOP_LEFT* = 0 - CORNER_BOTTOM_LEFT* = 1 - CORNER_TOP_RIGHT* = 2 - CORNER_BOTTOM_RIGHT* = 3 - constPACK_START* = 0 - constPACK_END* = 1 - PATH_PRIO_LOWEST* = 0 - PATH_PRIO_GTK* = 4 - PATH_PRIO_APPLICATION* = 8 - PATH_PRIO_THEME* = 10 - PATH_PRIO_RC* = 12 - PATH_PRIO_HIGHEST* = 15 - PATH_WIDGET* = 0 - PATH_WIDGET_CLASS* = 1 - PATH_CLASS* = 2 - POLICY_ALWAYS* = 0 - POLICY_AUTOMATIC* = 1 - POLICY_NEVER* = 2 - POS_LEFT* = 0 - POS_RIGHT* = 1 - POS_TOP* = 2 - POS_BOTTOM* = 3 - PREVIEW_COLOR* = 0 - PREVIEW_GRAYSCALE* = 1 - RELIEF_NORMAL* = 0 - RELIEF_HALF* = 1 - RELIEF_NONE* = 2 - RESIZE_PARENT* = 0 - RESIZE_QUEUE* = 1 - RESIZE_IMMEDIATE* = 2 - SCROLL_NONE* = 0 - SCROLL_JUMP* = 1 - SCROLL_STEP_BACKWARD* = 2 - SCROLL_STEP_FORWARD* = 3 - SCROLL_PAGE_BACKWARD* = 4 - SCROLL_PAGE_FORWARD* = 5 - SCROLL_STEP_UP* = 6 - SCROLL_STEP_DOWN* = 7 - SCROLL_PAGE_UP* = 8 - SCROLL_PAGE_DOWN* = 9 - SCROLL_STEP_LEFT* = 10 - SCROLL_STEP_RIGHT* = 11 - SCROLL_PAGE_LEFT* = 12 - SCROLL_PAGE_RIGHT* = 13 - SCROLL_START* = 14 - SCROLL_END* = 15 - SELECTION_NONE* = 0 - SELECTION_SINGLE* = 1 - SELECTION_BROWSE* = 2 - SELECTION_MULTIPLE* = 3 - SELECTION_EXTENDED* = SELECTION_MULTIPLE - SHADOW_NONE* = 0 - SHADOW_IN* = 1 - SHADOW_OUT* = 2 - SHADOW_ETCHED_IN* = 3 - SHADOW_ETCHED_OUT* = 4 - STATE_NORMAL* = 0 - STATE_ACTIVE* = 1 - STATE_PRELIGHT* = 2 - STATE_SELECTED* = 3 - STATE_INSENSITIVE* = 4 - DIRECTION_LEFT* = 0 - DIRECTION_RIGHT* = 1 - TOP_BOTTOM* = 0 - LEFT_RIGHT* = 1 - TOOLBAR_ICONS* = 0 - TOOLBAR_TEXT* = 1 - TOOLBAR_BOTH* = 2 - TOOLBAR_BOTH_HORIZ* = 3 - UPDATE_CONTINUOUS* = 0 - UPDATE_DISCONTINUOUS* = 1 - UPDATE_DELAYED* = 2 - VISIBILITY_NONE* = 0 - VISIBILITY_PARTIAL* = 1 - VISIBILITY_FULL* = 2 - WIN_POS_NONE* = 0 - WIN_POS_CENTER* = 1 - WIN_POS_MOUSE* = 2 - WIN_POS_CENTER_ALWAYS* = 3 - WIN_POS_CENTER_ON_PARENT* = 4 - WINDOW_TOPLEVEL* = 0 - WINDOW_POPUP* = 1 - WRAP_NONE* = 0 - WRAP_CHAR* = 1 - WRAP_WORD* = 2 - SORT_ASCENDING* = 0 - SORT_DESCENDING* = 1 - -proc TYPE_EVENT_BOX*(): GType -proc EVENT_BOX*(obj: pointer): PEventBox -proc EVENT_BOX_CLASS*(klass: pointer): PEventBoxClass -proc IS_EVENT_BOX*(obj: pointer): bool -proc IS_EVENT_BOX_CLASS*(klass: pointer): bool -proc EVENT_BOX_GET_CLASS*(obj: pointer): PEventBoxClass -proc event_box_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_event_box_get_type".} -proc event_box_new*(): PEventBox{.cdecl, dynlib: lib, - importc: "gtk_event_box_new".} -const - FNM_PATHNAME* = 1 shl 0 - FNM_NOESCAPE* = 1 shl 1 - FNM_PERIOD* = 1 shl 2 - -const - FNM_FILE_NAME* = FNM_PATHNAME - FNM_LEADING_DIR* = 1 shl 3 - FNM_CASEFOLD* = 1 shl 4 - -const - FNM_NOMATCH* = 1 - -proc fnmatch*(`pattern`: char, `string`: char, `flags`: gint): gint{.cdecl, - dynlib: lib, importc: "fnmatch".} -proc TYPE_FILE_SELECTION*(): GType -proc FILE_SELECTION*(obj: pointer): PFileSelection -proc FILE_SELECTION_CLASS*(klass: pointer): PFileSelectionClass -proc IS_FILE_SELECTION*(obj: pointer): bool -proc IS_FILE_SELECTION_CLASS*(klass: pointer): bool -proc FILE_SELECTION_GET_CLASS*(obj: pointer): PFileSelectionClass -proc file_selection_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_file_selection_get_type".} -proc file_selection_new*(title: cstring): PFileSelection{.cdecl, dynlib: lib, - importc: "gtk_file_selection_new".} -proc set_filename*(filesel: PFileSelection, filename: cstring){. - cdecl, dynlib: lib, importc: "gtk_file_selection_set_filename".} -proc get_filename*(filesel: PFileSelection): cstring{.cdecl, - dynlib: lib, importc: "gtk_file_selection_get_filename".} -proc complete*(filesel: PFileSelection, pattern: cstring){.cdecl, - dynlib: lib, importc: "gtk_file_selection_complete".} -proc show_fileop_buttons*(filesel: PFileSelection){.cdecl, - dynlib: lib, importc: "gtk_file_selection_show_fileop_buttons".} -proc hide_fileop_buttons*(filesel: PFileSelection){.cdecl, - dynlib: lib, importc: "gtk_file_selection_hide_fileop_buttons".} -proc get_selections*(filesel: PFileSelection): PPgchar{.cdecl, - dynlib: lib, importc: "gtk_file_selection_get_selections".} -proc set_select_multiple*(filesel: PFileSelection, - select_multiple: gboolean){.cdecl, dynlib: lib, importc: "gtk_file_selection_set_select_multiple".} -proc get_select_multiple*(filesel: PFileSelection): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_selection_get_select_multiple".} -proc TYPE_FIXED*(): GType -proc FIXED*(obj: pointer): PFixed -proc FIXED_CLASS*(klass: pointer): PFixedClass -proc IS_FIXED*(obj: pointer): bool -proc IS_FIXED_CLASS*(klass: pointer): bool -proc FIXED_GET_CLASS*(obj: pointer): PFixedClass -proc fixed_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_fixed_get_type".} -proc fixed_new*(): PFixed{.cdecl, dynlib: lib, importc: "gtk_fixed_new".} -proc put*(fixed: PFixed, widget: PWidget, x: gint, y: gint){.cdecl, - dynlib: lib, importc: "gtk_fixed_put".} -proc move*(fixed: PFixed, widget: PWidget, x: gint, y: gint){.cdecl, - dynlib: lib, importc: "gtk_fixed_move".} -proc set_has_window*(fixed: PFixed, has_window: gboolean){.cdecl, - dynlib: lib, importc: "gtk_fixed_set_has_window".} -proc get_has_window*(fixed: PFixed): gboolean{.cdecl, dynlib: lib, - importc: "gtk_fixed_get_has_window".} -proc TYPE_FONT_SELECTION*(): GType -proc FONT_SELECTION*(obj: pointer): PFontSelection -proc FONT_SELECTION_CLASS*(klass: pointer): PFontSelectionClass -proc IS_FONT_SELECTION*(obj: pointer): bool -proc IS_FONT_SELECTION_CLASS*(klass: pointer): bool -proc FONT_SELECTION_GET_CLASS*(obj: pointer): PFontSelectionClass -proc TYPE_FONT_SELECTION_DIALOG*(): GType -proc FONT_SELECTION_DIALOG*(obj: pointer): PFontSelectionDialog -proc FONT_SELECTION_DIALOG_CLASS*(klass: pointer): PFontSelectionDialogClass -proc IS_FONT_SELECTION_DIALOG*(obj: pointer): bool -proc IS_FONT_SELECTION_DIALOG_CLASS*(klass: pointer): bool -proc FONT_SELECTION_DIALOG_GET_CLASS*(obj: pointer): PFontSelectionDialogClass -proc font_selection_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_font_selection_get_type".} -proc font_selection_new*(): PFontSelection{.cdecl, dynlib: lib, - importc: "gtk_font_selection_new".} -proc get_font_name*(fontsel: PFontSelection): cstring{.cdecl, - dynlib: lib, importc: "gtk_font_selection_get_font_name".} -proc set_font_name*(fontsel: PFontSelection, fontname: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_font_selection_set_font_name".} -proc get_preview_text*(fontsel: PFontSelection): cstring{.cdecl, - dynlib: lib, importc: "gtk_font_selection_get_preview_text".} -proc set_preview_text*(fontsel: PFontSelection, text: cstring){. - cdecl, dynlib: lib, importc: "gtk_font_selection_set_preview_text".} -proc font_selection_dialog_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_font_selection_dialog_get_type".} -proc font_selection_dialog_new*(title: cstring): PFontSelectionDialog{.cdecl, - dynlib: lib, importc: "gtk_font_selection_dialog_new".} -proc dialog_get_font_name*(fsd: PFontSelectionDialog): cstring{. - cdecl, dynlib: lib, importc: "gtk_font_selection_dialog_get_font_name".} -proc dialog_set_font_name*(fsd: PFontSelectionDialog, - fontname: cstring): gboolean{.cdecl, dynlib: lib, importc: "gtk_font_selection_dialog_set_font_name".} -proc dialog_get_preview_text*(fsd: PFontSelectionDialog): cstring{. - cdecl, dynlib: lib, importc: "gtk_font_selection_dialog_get_preview_text".} -proc dialog_set_preview_text*(fsd: PFontSelectionDialog, - text: cstring){.cdecl, dynlib: lib, - importc: "gtk_font_selection_dialog_set_preview_text".} -proc TYPE_GAMMA_CURVE*(): GType -proc GAMMA_CURVE*(obj: pointer): PGammaCurve -proc GAMMA_CURVE_CLASS*(klass: pointer): PGammaCurveClass -proc IS_GAMMA_CURVE*(obj: pointer): bool -proc IS_GAMMA_CURVE_CLASS*(klass: pointer): bool -proc GAMMA_CURVE_GET_CLASS*(obj: pointer): PGammaCurveClass -proc gamma_curve_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_gamma_curve_get_type".} -proc gamma_curve_new*(): PGammaCurve{.cdecl, dynlib: lib, - importc: "gtk_gamma_curve_new".} -proc gc_get*(depth: gint, colormap: gdk2.PColormap, values: gdk2.PGCValues, - values_mask: gdk2.TGCValuesMask): gdk2.PGC{.cdecl, dynlib: lib, - importc: "gtk_gc_get".} -proc gc_release*(gc: gdk2.PGC){.cdecl, dynlib: lib, importc: "gtk_gc_release".} -const - bm_TGtkHandleBox_handle_position* = 0x0003'i16 - bp_TGtkHandleBox_handle_position* = 0'i16 - bm_TGtkHandleBox_float_window_mapped* = 0x0004'i16 - bp_TGtkHandleBox_float_window_mapped* = 2'i16 - bm_TGtkHandleBox_child_detached* = 0x0008'i16 - bp_TGtkHandleBox_child_detached* = 3'i16 - bm_TGtkHandleBox_in_drag* = 0x0010'i16 - bp_TGtkHandleBox_in_drag* = 4'i16 - bm_TGtkHandleBox_shrink_on_detach* = 0x0020'i16 - bp_TGtkHandleBox_shrink_on_detach* = 5'i16 - bm_TGtkHandleBox_snap_edge* = 0x01C0'i16 - bp_TGtkHandleBox_snap_edge* = 6'i16 - -proc TYPE_HANDLE_BOX*(): GType -proc HANDLE_BOX*(obj: pointer): PHandleBox -proc HANDLE_BOX_CLASS*(klass: pointer): PHandleBoxClass -proc IS_HANDLE_BOX*(obj: pointer): bool -proc IS_HANDLE_BOX_CLASS*(klass: pointer): bool -proc HANDLE_BOX_GET_CLASS*(obj: pointer): PHandleBoxClass -proc handle_position*(a: PHandleBox): guint -proc set_handle_position*(a: PHandleBox, `handle_position`: guint) -proc float_window_mapped*(a: PHandleBox): guint -proc set_float_window_mapped*(a: PHandleBox, `float_window_mapped`: guint) -proc child_detached*(a: PHandleBox): guint -proc set_child_detached*(a: PHandleBox, `child_detached`: guint) -proc in_drag*(a: PHandleBox): guint -proc set_in_drag*(a: PHandleBox, `in_drag`: guint) -proc shrink_on_detach*(a: PHandleBox): guint -proc set_shrink_on_detach*(a: PHandleBox, `shrink_on_detach`: guint) -proc snap_edge*(a: PHandleBox): gint -proc set_snap_edge*(a: PHandleBox, `snap_edge`: gint) -proc handle_box_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_handle_box_get_type".} -proc handle_box_new*(): PHandleBox{.cdecl, dynlib: lib, - importc: "gtk_handle_box_new".} -proc set_shadow_type*(handle_box: PHandleBox, thetype: TShadowType){. - cdecl, dynlib: lib, importc: "gtk_handle_box_set_shadow_type".} -proc get_shadow_type*(handle_box: PHandleBox): TShadowType{.cdecl, - dynlib: lib, importc: "gtk_handle_box_get_shadow_type".} -proc set_handle_position*(handle_box: PHandleBox, - position: TPositionType){.cdecl, - dynlib: lib, importc: "gtk_handle_box_set_handle_position".} -proc get_handle_position*(handle_box: PHandleBox): TPositionType{. - cdecl, dynlib: lib, importc: "gtk_handle_box_get_handle_position".} -proc set_snap_edge*(handle_box: PHandleBox, edge: TPositionType){. - cdecl, dynlib: lib, importc: "gtk_handle_box_set_snap_edge".} -proc get_snap_edge*(handle_box: PHandleBox): TPositionType{.cdecl, - dynlib: lib, importc: "gtk_handle_box_get_snap_edge".} -const - bm_TGtkPaned_position_set* = 0x0001'i16 - bp_TGtkPaned_position_set* = 0'i16 - bm_TGtkPaned_in_drag* = 0x0002'i16 - bp_TGtkPaned_in_drag* = 1'i16 - bm_TGtkPaned_child1_shrink* = 0x0004'i16 - bp_TGtkPaned_child1_shrink* = 2'i16 - bm_TGtkPaned_child1_resize* = 0x0008'i16 - bp_TGtkPaned_child1_resize* = 3'i16 - bm_TGtkPaned_child2_shrink* = 0x0010'i16 - bp_TGtkPaned_child2_shrink* = 4'i16 - bm_TGtkPaned_child2_resize* = 0x0020'i16 - bp_TGtkPaned_child2_resize* = 5'i16 - bm_TGtkPaned_orientation* = 0x0040'i16 - bp_TGtkPaned_orientation* = 6'i16 - bm_TGtkPaned_in_recursion* = 0x0080'i16 - bp_TGtkPaned_in_recursion* = 7'i16 - bm_TGtkPaned_handle_prelit* = 0x0100'i16 - bp_TGtkPaned_handle_prelit* = 8'i16 - -proc TYPE_PANED*(): GType -proc PANED*(obj: pointer): PPaned -proc PANED_CLASS*(klass: pointer): PPanedClass -proc IS_PANED*(obj: pointer): bool -proc IS_PANED_CLASS*(klass: pointer): bool -proc PANED_GET_CLASS*(obj: pointer): PPanedClass -proc position_set*(a: PPaned): guint -proc set_position_set*(a: PPaned, `position_set`: guint) -proc in_drag*(a: PPaned): guint -proc set_in_drag*(a: PPaned, `in_drag`: guint) -proc child1_shrink*(a: PPaned): guint -proc set_child1_shrink*(a: PPaned, `child1_shrink`: guint) -proc child1_resize*(a: PPaned): guint -proc set_child1_resize*(a: PPaned, `child1_resize`: guint) -proc child2_shrink*(a: PPaned): guint -proc set_child2_shrink*(a: PPaned, `child2_shrink`: guint) -proc child2_resize*(a: PPaned): guint -proc set_child2_resize*(a: PPaned, `child2_resize`: guint) -proc orientation*(a: PPaned): guint -proc set_orientation*(a: PPaned, `orientation`: guint) -proc in_recursion*(a: PPaned): guint -proc set_in_recursion*(a: PPaned, `in_recursion`: guint) -proc handle_prelit*(a: PPaned): guint -proc set_handle_prelit*(a: PPaned, `handle_prelit`: guint) -proc paned_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_paned_get_type".} -proc add1*(paned: PPaned, child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_paned_add1".} -proc add2*(paned: PPaned, child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_paned_add2".} -proc pack1*(paned: PPaned, child: PWidget, resize: gboolean, - shrink: gboolean){.cdecl, dynlib: lib, - importc: "gtk_paned_pack1".} -proc pack2*(paned: PPaned, child: PWidget, resize: gboolean, - shrink: gboolean){.cdecl, dynlib: lib, - importc: "gtk_paned_pack2".} -proc get_position*(paned: PPaned): gint{.cdecl, dynlib: lib, - importc: "gtk_paned_get_position".} -proc set_position*(paned: PPaned, position: gint){.cdecl, dynlib: lib, - importc: "gtk_paned_set_position".} -proc compute_position*(paned: PPaned, allocation: gint, child1_req: gint, - child2_req: gint){.cdecl, dynlib: lib, - importc: "gtk_paned_compute_position".} -proc TYPE_HBUTTON_BOX*(): GType -proc HBUTTON_BOX*(obj: pointer): PHButtonBox -proc HBUTTON_BOX_CLASS*(klass: pointer): PHButtonBoxClass -proc IS_HBUTTON_BOX*(obj: pointer): bool -proc IS_HBUTTON_BOX_CLASS*(klass: pointer): bool -proc HBUTTON_BOX_GET_CLASS*(obj: pointer): PHButtonBoxClass -proc hbutton_box_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_hbutton_box_get_type".} -proc hbutton_box_new*(): PHButtonBox{.cdecl, dynlib: lib, - importc: "gtk_hbutton_box_new".} -proc TYPE_HPANED*(): GType -proc HPANED*(obj: pointer): PHPaned -proc HPANED_CLASS*(klass: pointer): PHPanedClass -proc IS_HPANED*(obj: pointer): bool -proc IS_HPANED_CLASS*(klass: pointer): bool -proc HPANED_GET_CLASS*(obj: pointer): PHPanedClass -proc hpaned_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_hpaned_get_type".} -proc hpaned_new*(): PHPaned{.cdecl, dynlib: lib, importc: "gtk_hpaned_new".} -proc TYPE_RULER*(): GType -proc RULER*(obj: pointer): PRuler -proc RULER_CLASS*(klass: pointer): PRulerClass -proc IS_RULER*(obj: pointer): bool -proc IS_RULER_CLASS*(klass: pointer): bool -proc RULER_GET_CLASS*(obj: pointer): PRulerClass -proc ruler_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_ruler_get_type".} -proc set_metric*(ruler: PRuler, metric: TMetricType){.cdecl, dynlib: lib, - importc: "gtk_ruler_set_metric".} -proc set_range*(ruler: PRuler, lower: gdouble, upper: gdouble, - position: gdouble, max_size: gdouble){.cdecl, dynlib: lib, - importc: "gtk_ruler_set_range".} -proc draw_ticks*(ruler: PRuler){.cdecl, dynlib: lib, - importc: "gtk_ruler_draw_ticks".} -proc draw_pos*(ruler: PRuler){.cdecl, dynlib: lib, - importc: "gtk_ruler_draw_pos".} -proc get_metric*(ruler: PRuler): TMetricType{.cdecl, dynlib: lib, - importc: "gtk_ruler_get_metric".} -proc get_range*(ruler: PRuler, lower: Pgdouble, upper: Pgdouble, - position: Pgdouble, max_size: Pgdouble){.cdecl, - dynlib: lib, importc: "gtk_ruler_get_range".} -proc TYPE_HRULER*(): GType -proc HRULER*(obj: pointer): PHRuler -proc HRULER_CLASS*(klass: pointer): PHRulerClass -proc IS_HRULER*(obj: pointer): bool -proc IS_HRULER_CLASS*(klass: pointer): bool -proc HRULER_GET_CLASS*(obj: pointer): PHRulerClass -proc hruler_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_hruler_get_type".} -proc hruler_new*(): PHRuler{.cdecl, dynlib: lib, importc: "gtk_hruler_new".} -proc TYPE_SETTINGS*(): GType -proc SETTINGS*(obj: pointer): PSettings -proc SETTINGS_CLASS*(klass: pointer): PSettingsClass -proc IS_SETTINGS*(obj: pointer): bool -proc IS_SETTINGS_CLASS*(klass: pointer): bool -proc SETTINGS_GET_CLASS*(obj: pointer): PSettingsClass -proc settings_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_settings_get_type".} -proc settings_get_for_screen*(screen: gdk2.PScreen): PSettings{.cdecl, - dynlib: lib, importc: "gtk_settings_get_for_screen".} -proc settings_install_property*(pspec: PGParamSpec){.cdecl, dynlib: lib, - importc: "gtk_settings_install_property".} -proc settings_install_property_parser*(pspec: PGParamSpec, - parser: TRcPropertyParser){.cdecl, - dynlib: lib, importc: "gtk_settings_install_property_parser".} -proc rc_property_parse_color*(pspec: PGParamSpec, gstring: PGString, - property_value: PGValue): gboolean{.cdecl, - dynlib: lib, importc: "gtk_rc_property_parse_color".} -proc rc_property_parse_enum*(pspec: PGParamSpec, gstring: PGString, - property_value: PGValue): gboolean{.cdecl, - dynlib: lib, importc: "gtk_rc_property_parse_enum".} -proc rc_property_parse_flags*(pspec: PGParamSpec, gstring: PGString, - property_value: PGValue): gboolean{.cdecl, - dynlib: lib, importc: "gtk_rc_property_parse_flags".} -proc rc_property_parse_requisition*(pspec: PGParamSpec, gstring: PGString, - property_value: PGValue): gboolean{.cdecl, - dynlib: lib, importc: "gtk_rc_property_parse_requisition".} -proc rc_property_parse_border*(pspec: PGParamSpec, gstring: PGString, - property_value: PGValue): gboolean{.cdecl, - dynlib: lib, importc: "gtk_rc_property_parse_border".} -proc set_property_value*(settings: PSettings, name: cstring, - svalue: PSettingsValue){.cdecl, dynlib: lib, - importc: "gtk_settings_set_property_value".} -proc set_string_property*(settings: PSettings, name: cstring, - v_string: cstring, origin: cstring){.cdecl, - dynlib: lib, importc: "gtk_settings_set_string_property".} -proc set_long_property*(settings: PSettings, name: cstring, - v_long: glong, origin: cstring){.cdecl, - dynlib: lib, importc: "gtk_settings_set_long_property".} -proc set_double_property*(settings: PSettings, name: cstring, - v_double: gdouble, origin: cstring){.cdecl, - dynlib: lib, importc: "gtk_settings_set_double_property".} -proc settings_handle_event*(event: gdk2.PEventSetting){.cdecl, dynlib: lib, - importc: "_gtk_settings_handle_event".} -proc rc_property_parser_from_type*(thetype: GType): TRcPropertyParser{.cdecl, - dynlib: lib, importc: "_gtk_rc_property_parser_from_type".} -proc settings_parse_convert*(parser: TRcPropertyParser, src_value: PGValue, - pspec: PGParamSpec, dest_value: PGValue): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_settings_parse_convert".} -const - RC_FG* = 1 shl 0 - RC_BG* = 1 shl 1 - RC_TEXT* = 1 shl 2 - RC_BASE* = 1 shl 3 - bm_TGtkRcStyle_engine_specified* = 0x0001'i16 - bp_TGtkRcStyle_engine_specified* = 0'i16 - -proc TYPE_RC_STYLE*(): GType -proc RC_STYLE_get*(anObject: pointer): PRcStyle -proc RC_STYLE_CLASS*(klass: pointer): PRcStyleClass -proc IS_RC_STYLE*(anObject: pointer): bool -proc IS_RC_STYLE_CLASS*(klass: pointer): bool -proc RC_STYLE_GET_CLASS*(obj: pointer): PRcStyleClass -proc engine_specified*(a: PRcStyle): guint -proc set_engine_specified*(a: PRcStyle, `engine_specified`: guint) -proc rc_init*(){.cdecl, dynlib: lib, importc: "_gtk_rc_init".} -proc rc_add_default_file*(filename: cstring){.cdecl, dynlib: lib, - importc: "gtk_rc_add_default_file".} -proc rc_set_default_files*(filenames: PPgchar){.cdecl, dynlib: lib, - importc: "gtk_rc_set_default_files".} -proc rc_get_default_files*(): PPgchar{.cdecl, dynlib: lib, - importc: "gtk_rc_get_default_files".} -proc rc_get_style*(widget: PWidget): PStyle{.cdecl, dynlib: lib, - importc: "gtk_rc_get_style".} -proc rc_get_style_by_paths*(settings: PSettings, widget_path: cstring, - class_path: cstring, thetype: GType): PStyle{.cdecl, - dynlib: lib, importc: "gtk_rc_get_style_by_paths".} -proc rc_reparse_all_for_settings*(settings: PSettings, force_load: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_rc_reparse_all_for_settings".} -proc rc_find_pixmap_in_path*(settings: PSettings, scanner: PGScanner, - pixmap_file: cstring): cstring{.cdecl, dynlib: lib, - importc: "gtk_rc_find_pixmap_in_path".} -proc rc_parse*(filename: cstring){.cdecl, dynlib: lib, importc: "gtk_rc_parse".} -proc rc_parse_string*(rc_string: cstring){.cdecl, dynlib: lib, - importc: "gtk_rc_parse_string".} -proc rc_reparse_all*(): gboolean{.cdecl, dynlib: lib, - importc: "gtk_rc_reparse_all".} -proc rc_style_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_rc_style_get_type".} -proc rc_style_new*(): PRcStyle{.cdecl, dynlib: lib, importc: "gtk_rc_style_new".} -proc copy*(orig: PRcStyle): PRcStyle{.cdecl, dynlib: lib, - importc: "gtk_rc_style_copy".} -proc reference*(rc_style: PRcStyle){.cdecl, dynlib: lib, - importc: "gtk_rc_style_ref".} -proc unref*(rc_style: PRcStyle){.cdecl, dynlib: lib, - importc: "gtk_rc_style_unref".} -proc rc_find_module_in_path*(module_file: cstring): cstring{.cdecl, dynlib: lib, - importc: "gtk_rc_find_module_in_path".} -proc rc_get_theme_dir*(): cstring{.cdecl, dynlib: lib, - importc: "gtk_rc_get_theme_dir".} -proc rc_get_module_dir*(): cstring{.cdecl, dynlib: lib, - importc: "gtk_rc_get_module_dir".} -proc rc_get_im_module_path*(): cstring{.cdecl, dynlib: lib, - importc: "gtk_rc_get_im_module_path".} -proc rc_get_im_module_file*(): cstring{.cdecl, dynlib: lib, - importc: "gtk_rc_get_im_module_file".} -proc rc_scanner_new*(): PGScanner{.cdecl, dynlib: lib, - importc: "gtk_rc_scanner_new".} -proc rc_parse_color*(scanner: PGScanner, color: gdk2.PColor): guint{.cdecl, - dynlib: lib, importc: "gtk_rc_parse_color".} -proc rc_parse_state*(scanner: PGScanner, state: PStateType): guint{.cdecl, - dynlib: lib, importc: "gtk_rc_parse_state".} -proc rc_parse_priority*(scanner: PGScanner, priority: PPathPriorityType): guint{. - cdecl, dynlib: lib, importc: "gtk_rc_parse_priority".} -proc lookup_rc_property*(rc_style: PRcStyle, type_name: TGQuark, - property_name: TGQuark): PRcProperty{.cdecl, - dynlib: lib, importc: "_gtk_rc_style_lookup_rc_property".} -proc rc_context_get_default_font_name*(settings: PSettings): cstring{.cdecl, - dynlib: lib, importc: "_gtk_rc_context_get_default_font_name".} -proc TYPE_STYLE*(): GType -proc STYLE*(anObject: pointer): PStyle -proc STYLE_CLASS*(klass: pointer): PStyleClass -proc IS_STYLE*(anObject: pointer): bool -proc IS_STYLE_CLASS*(klass: pointer): bool -proc STYLE_GET_CLASS*(obj: pointer): PStyleClass -proc TYPE_BORDER*(): GType -proc STYLE_ATTACHED*(style: pointer): bool -proc style_get_type*(): GType{.cdecl, dynlib: lib, importc: "gtk_style_get_type".} -proc style_new*(): PStyle{.cdecl, dynlib: lib, importc: "gtk_style_new".} -proc copy*(style: PStyle): PStyle{.cdecl, dynlib: lib, - importc: "gtk_style_copy".} -proc attach*(style: PStyle, window: gdk2.PWindow): PStyle{.cdecl, - dynlib: lib, importc: "gtk_style_attach".} -proc detach*(style: PStyle){.cdecl, dynlib: lib, - importc: "gtk_style_detach".} -proc set_background*(style: PStyle, window: gdk2.PWindow, - state_type: TStateType){.cdecl, dynlib: lib, - importc: "gtk_style_set_background".} -proc apply_default_background*(style: PStyle, window: gdk2.PWindow, - set_bg: gboolean, state_type: TStateType, - area: gdk2.PRectangle, x: gint, y: gint, - width: gint, height: gint){.cdecl, - dynlib: lib, importc: "gtk_style_apply_default_background".} -proc lookup_icon_set*(style: PStyle, stock_id: cstring): PIconSet{.cdecl, - dynlib: lib, importc: "gtk_style_lookup_icon_set".} -proc render_icon*(style: PStyle, source: PIconSource, - direction: TTextDirection, state: TStateType, - size: TIconSize, widget: PWidget, detail: cstring): gdk2pixbuf.PPixbuf{. - cdecl, dynlib: lib, importc: "gtk_style_render_icon".} -proc paint_hline*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x1: gint, x2: gint, y: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_hline".} -proc paint_vline*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - y1: gint, y2: gint, x: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_vline".} -proc paint_shadow*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_shadow".} -proc paint_polygon*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, points: gdk2.PPoint, - npoints: gint, fill: gboolean){.cdecl, dynlib: lib, - importc: "gtk_paint_polygon".} -proc paint_arrow*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, arrow_type: TArrowType, - fill: gboolean, x: gint, y: gint, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "gtk_paint_arrow".} -proc paint_diamond*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_diamond".} -proc paint_box*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, widget: PWidget, - detail: cstring, x: gint, y: gint, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "gtk_paint_box".} -proc paint_flat_box*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_flat_box".} -proc paint_check*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_check".} -proc paint_option*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_option".} -proc paint_tab*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, widget: PWidget, - detail: cstring, x: gint, y: gint, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "gtk_paint_tab".} -proc paint_shadow_gap*(style: PStyle, window: gdk2.PWindow, - state_type: TStateType, shadow_type: TShadowType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint, - gap_side: TPositionType, gap_x: gint, gap_width: gint){. - cdecl, dynlib: lib, importc: "gtk_paint_shadow_gap".} -proc paint_box_gap*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint, gap_side: TPositionType, - gap_x: gint, gap_width: gint){.cdecl, dynlib: lib, - importc: "gtk_paint_box_gap".} -proc paint_extension*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint, gap_side: TPositionType){. - cdecl, dynlib: lib, importc: "gtk_paint_extension".} -proc paint_focus*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, width: gint, height: gint){.cdecl, - dynlib: lib, importc: "gtk_paint_focus".} -proc paint_slider*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint, orientation: TOrientation){.cdecl, - dynlib: lib, importc: "gtk_paint_slider".} -proc paint_handle*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - shadow_type: TShadowType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, x: gint, y: gint, - width: gint, height: gint, orientation: TOrientation){.cdecl, - dynlib: lib, importc: "gtk_paint_handle".} -proc paint_expander*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - area: gdk2.PRectangle, widget: PWidget, detail: cstring, - x: gint, y: gint, expander_style: TExpanderStyle){.cdecl, - dynlib: lib, importc: "gtk_paint_expander".} -proc paint_layout*(style: PStyle, window: gdk2.PWindow, state_type: TStateType, - use_text: gboolean, area: gdk2.PRectangle, widget: PWidget, - detail: cstring, x: gint, y: gint, layout: pango.PLayout){. - cdecl, dynlib: lib, importc: "gtk_paint_layout".} -proc paint_resize_grip*(style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - widget: PWidget, detail: cstring, edge: gdk2.TWindowEdge, - x: gint, y: gint, width: gint, height: gint){.cdecl, - dynlib: lib, importc: "gtk_paint_resize_grip".} -proc border_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_border_get_type".} -proc copy*(border: PBorder): PBorder{.cdecl, dynlib: lib, - importc: "gtk_border_copy".} -proc free*(border: PBorder){.cdecl, dynlib: lib, - importc: "gtk_border_free".} -proc peek_property_value*(style: PStyle, widget_type: GType, - pspec: PGParamSpec, parser: TRcPropertyParser): PGValue{. - cdecl, dynlib: lib, importc: "_gtk_style_peek_property_value".} -proc get_insertion_cursor_gc*(widget: PWidget, is_primary: gboolean): gdk2.PGC{. - cdecl, dynlib: lib, importc: "_gtk_get_insertion_cursor_gc".} -proc draw_insertion_cursor*(widget: PWidget, drawable: gdk2.PDrawable, gc: gdk2.PGC, - location: gdk2.PRectangle, direction: TTextDirection, - draw_arrow: gboolean){.cdecl, dynlib: lib, - importc: "_gtk_draw_insertion_cursor".} -const - bm_TGtkRange_inverted* = 0x0001'i16 - bp_TGtkRange_inverted* = 0'i16 - bm_TGtkRange_flippable* = 0x0002'i16 - bp_TGtkRange_flippable* = 1'i16 - bm_TGtkRange_has_stepper_a* = 0x0004'i16 - bp_TGtkRange_has_stepper_a* = 2'i16 - bm_TGtkRange_has_stepper_b* = 0x0008'i16 - bp_TGtkRange_has_stepper_b* = 3'i16 - bm_TGtkRange_has_stepper_c* = 0x0010'i16 - bp_TGtkRange_has_stepper_c* = 4'i16 - bm_TGtkRange_has_stepper_d* = 0x0020'i16 - bp_TGtkRange_has_stepper_d* = 5'i16 - bm_TGtkRange_need_recalc* = 0x0040'i16 - bp_TGtkRange_need_recalc* = 6'i16 - bm_TGtkRange_slider_size_fixed* = 0x0080'i16 - bp_TGtkRange_slider_size_fixed* = 7'i16 - bm_TGtkRange_trough_click_forward* = 0x0001'i16 - bp_TGtkRange_trough_click_forward* = 0'i16 - bm_TGtkRange_update_pending* = 0x0002'i16 - bp_TGtkRange_update_pending* = 1'i16 - -proc TYPE_RANGE*(): GType -proc RANGE*(obj: pointer): PRange -proc RANGE_CLASS*(klass: pointer): PRangeClass -proc IS_RANGE*(obj: pointer): bool -proc IS_RANGE_CLASS*(klass: pointer): bool -proc RANGE_GET_CLASS*(obj: pointer): PRangeClass -proc inverted*(a: PRange): guint -proc set_inverted*(a: PRange, `inverted`: guint) -proc flippable*(a: PRange): guint -proc set_flippable*(a: PRange, `flippable`: guint) -proc has_stepper_a*(a: PRange): guint -proc set_has_stepper_a*(a: PRange, `has_stepper_a`: guint) -proc has_stepper_b*(a: PRange): guint -proc set_has_stepper_b*(a: PRange, `has_stepper_b`: guint) -proc has_stepper_c*(a: PRange): guint -proc set_has_stepper_c*(a: PRange, `has_stepper_c`: guint) -proc has_stepper_d*(a: PRange): guint -proc set_has_stepper_d*(a: PRange, `has_stepper_d`: guint) -proc need_recalc*(a: PRange): guint -proc set_need_recalc*(a: PRange, `need_recalc`: guint) -proc slider_size_fixed*(a: PRange): guint -proc set_slider_size_fixed*(a: PRange, `slider_size_fixed`: guint) -proc trough_click_forward*(a: PRange): guint -proc set_trough_click_forward*(a: PRange, `trough_click_forward`: guint) -proc update_pending*(a: PRange): guint -proc set_update_pending*(a: PRange, `update_pending`: guint) -proc range_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_range_get_type".} -proc set_update_policy*(range: PRange, policy: TUpdateType){.cdecl, - dynlib: lib, importc: "gtk_range_set_update_policy".} -proc get_update_policy*(range: PRange): TUpdateType{.cdecl, dynlib: lib, - importc: "gtk_range_get_update_policy".} -proc set_adjustment*(range: PRange, adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_range_set_adjustment".} -proc get_adjustment*(range: PRange): PAdjustment{.cdecl, dynlib: lib, - importc: "gtk_range_get_adjustment".} -proc set_inverted*(range: PRange, setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_range_set_inverted".} -proc get_inverted*(range: PRange): gboolean{.cdecl, dynlib: lib, - importc: "gtk_range_get_inverted".} -proc set_increments*(range: PRange, step: gdouble, page: gdouble){.cdecl, - dynlib: lib, importc: "gtk_range_set_increments".} -proc set_range*(range: PRange, min: gdouble, max: gdouble){.cdecl, - dynlib: lib, importc: "gtk_range_set_range".} -proc set_value*(range: PRange, value: gdouble){.cdecl, dynlib: lib, - importc: "gtk_range_set_value".} -proc get_value*(range: PRange): gdouble{.cdecl, dynlib: lib, - importc: "gtk_range_get_value".} -const - bm_TGtkScale_draw_value* = 0x0001'i16 - bp_TGtkScale_draw_value* = 0'i16 - bm_TGtkScale_value_pos* = 0x0006'i16 - bp_TGtkScale_value_pos* = 1'i16 - -proc TYPE_SCALE*(): GType -proc SCALE*(obj: pointer): PScale -proc SCALE_CLASS*(klass: pointer): PScaleClass -proc IS_SCALE*(obj: pointer): bool -proc IS_SCALE_CLASS*(klass: pointer): bool -proc SCALE_GET_CLASS*(obj: pointer): PScaleClass -proc draw_value*(a: PScale): guint -proc set_draw_value*(a: PScale, `draw_value`: guint) -proc value_pos*(a: PScale): guint -proc set_value_pos*(a: PScale, `value_pos`: guint) -proc scale_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_scale_get_type".} -proc set_digits*(scale: PScale, digits: gint){.cdecl, dynlib: lib, - importc: "gtk_scale_set_digits".} -proc get_digits*(scale: PScale): gint{.cdecl, dynlib: lib, - importc: "gtk_scale_get_digits".} -proc set_draw_value*(scale: PScale, draw_value: gboolean){.cdecl, - dynlib: lib, importc: "gtk_scale_set_draw_value".} -proc get_draw_value*(scale: PScale): gboolean{.cdecl, dynlib: lib, - importc: "gtk_scale_get_draw_value".} -proc set_value_pos*(scale: PScale, pos: TPositionType){.cdecl, - dynlib: lib, importc: "gtk_scale_set_value_pos".} -proc get_value_pos*(scale: PScale): TPositionType{.cdecl, dynlib: lib, - importc: "gtk_scale_get_value_pos".} -proc get_value_size*(scale: PScale, width: Pgint, height: Pgint){.cdecl, - dynlib: lib, importc: "_gtk_scale_get_value_size".} -proc format_value*(scale: PScale, value: gdouble): cstring{.cdecl, - dynlib: lib, importc: "_gtk_scale_format_value".} -proc TYPE_HSCALE*(): GType -proc HSCALE*(obj: pointer): PHScale -proc HSCALE_CLASS*(klass: pointer): PHScaleClass -proc IS_HSCALE*(obj: pointer): bool -proc IS_HSCALE_CLASS*(klass: pointer): bool -proc HSCALE_GET_CLASS*(obj: pointer): PHScaleClass -proc hscale_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_hscale_get_type".} -proc hscale_new*(adjustment: PAdjustment): PHScale{.cdecl, dynlib: lib, - importc: "gtk_hscale_new".} -proc hscale_new*(min: gdouble, max: gdouble, step: gdouble): PHScale{. - cdecl, dynlib: lib, importc: "gtk_hscale_new_with_range".} -proc TYPE_SCROLLBAR*(): GType -proc SCROLLBAR*(obj: pointer): PScrollbar -proc SCROLLBAR_CLASS*(klass: pointer): PScrollbarClass -proc IS_SCROLLBAR*(obj: pointer): bool -proc IS_SCROLLBAR_CLASS*(klass: pointer): bool -proc SCROLLBAR_GET_CLASS*(obj: pointer): PScrollbarClass -proc scrollbar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_scrollbar_get_type".} -proc TYPE_HSCROLLBAR*(): GType -proc HSCROLLBAR*(obj: pointer): PHScrollbar -proc HSCROLLBAR_CLASS*(klass: pointer): PHScrollbarClass -proc IS_HSCROLLBAR*(obj: pointer): bool -proc IS_HSCROLLBAR_CLASS*(klass: pointer): bool -proc HSCROLLBAR_GET_CLASS*(obj: pointer): PHScrollbarClass -proc hscrollbar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_hscrollbar_get_type".} -proc hscrollbar_new*(adjustment: PAdjustment): PHScrollbar{.cdecl, dynlib: lib, - importc: "gtk_hscrollbar_new".} -proc TYPE_SEPARATOR*(): GType -proc SEPARATOR*(obj: pointer): PSeparator -proc SEPARATOR_CLASS*(klass: pointer): PSeparatorClass -proc IS_SEPARATOR*(obj: pointer): bool -proc IS_SEPARATOR_CLASS*(klass: pointer): bool -proc SEPARATOR_GET_CLASS*(obj: pointer): PSeparatorClass -proc separator_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_separator_get_type".} -proc TYPE_HSEPARATOR*(): GType -proc HSEPARATOR*(obj: pointer): PHSeparator -proc HSEPARATOR_CLASS*(klass: pointer): PHSeparatorClass -proc IS_HSEPARATOR*(obj: pointer): bool -proc IS_HSEPARATOR_CLASS*(klass: pointer): bool -proc HSEPARATOR_GET_CLASS*(obj: pointer): PHSeparatorClass -proc hseparator_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_hseparator_get_type".} -proc hseparator_new*(): PHSeparator{.cdecl, dynlib: lib, - importc: "gtk_hseparator_new".} -proc TYPE_ICON_FACTORY*(): GType -proc ICON_FACTORY*(anObject: pointer): PIconFactory -proc ICON_FACTORY_CLASS*(klass: pointer): PIconFactoryClass -proc IS_ICON_FACTORY*(anObject: pointer): bool -proc IS_ICON_FACTORY_CLASS*(klass: pointer): bool -proc ICON_FACTORY_GET_CLASS*(obj: pointer): PIconFactoryClass -proc TYPE_ICON_SET*(): GType -proc TYPE_ICON_SOURCE*(): GType -proc icon_factory_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_icon_factory_get_type".} -proc icon_factory_new*(): PIconFactory{.cdecl, dynlib: lib, - importc: "gtk_icon_factory_new".} -proc add*(factory: PIconFactory, stock_id: cstring, - icon_set: PIconSet){.cdecl, dynlib: lib, - importc: "gtk_icon_factory_add".} -proc lookup*(factory: PIconFactory, stock_id: cstring): PIconSet{. - cdecl, dynlib: lib, importc: "gtk_icon_factory_lookup".} -proc add_default*(factory: PIconFactory){.cdecl, dynlib: lib, - importc: "gtk_icon_factory_add_default".} -proc remove_default*(factory: PIconFactory){.cdecl, dynlib: lib, - importc: "gtk_icon_factory_remove_default".} -proc icon_factory_lookup_default*(stock_id: cstring): PIconSet{.cdecl, - dynlib: lib, importc: "gtk_icon_factory_lookup_default".} -proc icon_size_lookup*(size: TIconSize, width: Pgint, height: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_icon_size_lookup".} -proc icon_size_register*(name: cstring, width: gint, height: gint): TIconSize{. - cdecl, dynlib: lib, importc: "gtk_icon_size_register".} -proc icon_size_register_alias*(alias: cstring, target: TIconSize){.cdecl, - dynlib: lib, importc: "gtk_icon_size_register_alias".} -proc icon_size_from_name*(name: cstring): TIconSize{.cdecl, dynlib: lib, - importc: "gtk_icon_size_from_name".} -proc icon_size_get_name*(size: TIconSize): cstring{.cdecl, dynlib: lib, - importc: "gtk_icon_size_get_name".} -proc icon_set_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_icon_set_get_type".} -proc icon_set_new*(): PIconSet{.cdecl, dynlib: lib, importc: "gtk_icon_set_new".} -proc icon_set_new_from_pixbuf*(pixbuf: gdk2pixbuf.PPixbuf): PIconSet{.cdecl, - dynlib: lib, importc: "gtk_icon_set_new_from_pixbuf".} -proc reference*(icon_set: PIconSet): PIconSet{.cdecl, dynlib: lib, - importc: "gtk_icon_set_ref".} -proc unref*(icon_set: PIconSet){.cdecl, dynlib: lib, - importc: "gtk_icon_set_unref".} -proc copy*(icon_set: PIconSet): PIconSet{.cdecl, dynlib: lib, - importc: "gtk_icon_set_copy".} -proc render_icon*(icon_set: PIconSet, style: PStyle, - direction: TTextDirection, state: TStateType, - size: TIconSize, widget: PWidget, detail: cstring): gdk2pixbuf.PPixbuf{. - cdecl, dynlib: lib, importc: "gtk_icon_set_render_icon".} -proc add_source*(icon_set: PIconSet, source: PIconSource){.cdecl, - dynlib: lib, importc: "gtk_icon_set_add_source".} -proc get_sizes*(icon_set: PIconSet, sizes: PPGtkIconSize, - n_sizes: pgint){.cdecl, dynlib: lib, - importc: "gtk_icon_set_get_sizes".} -proc icon_source_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_icon_source_get_type".} -proc icon_source_new*(): PIconSource{.cdecl, dynlib: lib, - importc: "gtk_icon_source_new".} -proc copy*(source: PIconSource): PIconSource{.cdecl, dynlib: lib, - importc: "gtk_icon_source_copy".} -proc free*(source: PIconSource){.cdecl, dynlib: lib, - importc: "gtk_icon_source_free".} -proc set_filename*(source: PIconSource, filename: cstring){.cdecl, - dynlib: lib, importc: "gtk_icon_source_set_filename".} -proc set_pixbuf*(source: PIconSource, pixbuf: gdk2pixbuf.PPixbuf){.cdecl, - dynlib: lib, importc: "gtk_icon_source_set_pixbuf".} -proc get_filename*(source: PIconSource): cstring{.cdecl, - dynlib: lib, importc: "gtk_icon_source_get_filename".} -proc get_pixbuf*(source: PIconSource): gdk2pixbuf.PPixbuf{.cdecl, - dynlib: lib, importc: "gtk_icon_source_get_pixbuf".} -proc set_direction_wildcarded*(source: PIconSource, - setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_icon_source_set_direction_wildcarded".} -proc set_state_wildcarded*(source: PIconSource, setting: gboolean){. - cdecl, dynlib: lib, importc: "gtk_icon_source_set_state_wildcarded".} -proc set_size_wildcarded*(source: PIconSource, setting: gboolean){. - cdecl, dynlib: lib, importc: "gtk_icon_source_set_size_wildcarded".} -proc get_size_wildcarded*(source: PIconSource): gboolean{.cdecl, - dynlib: lib, importc: "gtk_icon_source_get_size_wildcarded".} -proc get_state_wildcarded*(source: PIconSource): gboolean{.cdecl, - dynlib: lib, importc: "gtk_icon_source_get_state_wildcarded".} -proc get_direction_wildcarded*(source: PIconSource): gboolean{. - cdecl, dynlib: lib, importc: "gtk_icon_source_get_direction_wildcarded".} -proc set_direction*(source: PIconSource, direction: TTextDirection){. - cdecl, dynlib: lib, importc: "gtk_icon_source_set_direction".} -proc set_state*(source: PIconSource, state: TStateType){.cdecl, - dynlib: lib, importc: "gtk_icon_source_set_state".} -proc set_size*(source: PIconSource, size: TIconSize){.cdecl, - dynlib: lib, importc: "gtk_icon_source_set_size".} -proc get_direction*(source: PIconSource): TTextDirection{.cdecl, - dynlib: lib, importc: "gtk_icon_source_get_direction".} -proc get_state*(source: PIconSource): TStateType{.cdecl, - dynlib: lib, importc: "gtk_icon_source_get_state".} -proc get_size*(source: PIconSource): TIconSize{.cdecl, dynlib: lib, - importc: "gtk_icon_source_get_size".} -proc icon_set_invalidate_caches*(){.cdecl, dynlib: lib, - importc: "_gtk_icon_set_invalidate_caches".} -proc icon_factory_list_ids*(): PGSList{.cdecl, dynlib: lib, - importc: "_gtk_icon_factory_list_ids".} -proc TYPE_IMAGE*(): GType -proc IMAGE*(obj: pointer): PImage -proc IMAGE_CLASS*(klass: pointer): PImageClass -proc IS_IMAGE*(obj: pointer): bool -proc IS_IMAGE_CLASS*(klass: pointer): bool -proc IMAGE_GET_CLASS*(obj: pointer): PImageClass -proc image_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_image_get_type".} -proc image_new*(): PImage{.cdecl, dynlib: lib, importc: "gtk_image_new".} -proc image_new_from_pixmap*(pixmap: gdk2.PPixmap, mask: gdk2.PBitmap): PImage{. - cdecl, dynlib: lib, importc: "gtk_image_new_from_pixmap".} -proc image_new_from_image*(image: gdk2.PImage, mask: gdk2.PBitmap): PImage{.cdecl, - dynlib: lib, importc: "gtk_image_new_from_image".} -proc image_new_from_file*(filename: cstring): PImage{.cdecl, dynlib: lib, - importc: "gtk_image_new_from_file".} -proc image_new_from_pixbuf*(pixbuf: gdk2pixbuf.PPixbuf): PImage{.cdecl, dynlib: lib, - importc: "gtk_image_new_from_pixbuf".} -proc image_new_from_stock*(stock_id: cstring, size: TIconSize): PImage{.cdecl, - dynlib: lib, importc: "gtk_image_new_from_stock".} -proc image_new_from_icon_set*(icon_set: PIconSet, size: TIconSize): PImage{. - cdecl, dynlib: lib, importc: "gtk_image_new_from_icon_set".} -proc image_new_from_animation*(animation: gdk2pixbuf.PPixbufAnimation): PImage{.cdecl, - dynlib: lib, importc: "gtk_image_new_from_animation".} -proc set_from_pixmap*(image: PImage, pixmap: gdk2.PPixmap, mask: gdk2.PBitmap){. - cdecl, dynlib: lib, importc: "gtk_image_set_from_pixmap".} -proc set_from_image*(image: PImage, gdk_image: gdk2.PImage, mask: gdk2.PBitmap){. - cdecl, dynlib: lib, importc: "gtk_image_set_from_image".} -proc set_from_file*(image: PImage, filename: cstring){.cdecl, dynlib: lib, - importc: "gtk_image_set_from_file".} -proc set_from_pixbuf*(image: PImage, pixbuf: gdk2pixbuf.PPixbuf){.cdecl, - dynlib: lib, importc: "gtk_image_set_from_pixbuf".} -proc set_from_stock*(image: PImage, stock_id: cstring, size: TIconSize){. - cdecl, dynlib: lib, importc: "gtk_image_set_from_stock".} -proc set_from_icon_set*(image: PImage, icon_set: PIconSet, size: TIconSize){. - cdecl, dynlib: lib, importc: "gtk_image_set_from_icon_set".} -proc set_from_animation*(image: PImage, animation: gdk2pixbuf.PPixbufAnimation){. - cdecl, dynlib: lib, importc: "gtk_image_set_from_animation".} -proc get_storage_type*(image: PImage): TImageType{.cdecl, dynlib: lib, - importc: "gtk_image_get_storage_type".} -proc get_pixbuf*(image: PImage): gdk2pixbuf.PPixbuf{.cdecl, dynlib: lib, - importc: "gtk_image_get_pixbuf".} -proc get_stock*(image: PImage, stock_id: PPgchar, size: PIconSize){.cdecl, - dynlib: lib, importc: "gtk_image_get_stock".} -proc get_animation*(image: PImage): gdk2pixbuf.PPixbufAnimation{.cdecl, - dynlib: lib, importc: "gtk_image_get_animation".} -proc TYPE_IMAGE_MENU_ITEM*(): GType -proc IMAGE_MENU_ITEM*(obj: pointer): PImageMenuItem -proc IMAGE_MENU_ITEM_CLASS*(klass: pointer): PImageMenuItemClass -proc IS_IMAGE_MENU_ITEM*(obj: pointer): bool -proc IS_IMAGE_MENU_ITEM_CLASS*(klass: pointer): bool -proc IMAGE_MENU_ITEM_GET_CLASS*(obj: pointer): PImageMenuItemClass -proc image_menu_item_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_image_menu_item_get_type".} -proc image_menu_item_new*(): PImageMenuItem{.cdecl, dynlib: lib, - importc: "gtk_image_menu_item_new".} -proc image_menu_item_new*(`label`: cstring): PImageMenuItem{.cdecl, - dynlib: lib, importc: "gtk_image_menu_item_new_with_label".} -proc image_menu_item_new_with_mnemonic*(`label`: cstring): PImageMenuItem{. - cdecl, dynlib: lib, importc: "gtk_image_menu_item_new_with_mnemonic".} -proc image_menu_item_new_from_stock*(stock_id: cstring, accel_group: PAccelGroup): PImageMenuItem{. - cdecl, dynlib: lib, importc: "gtk_image_menu_item_new_from_stock".} -proc item_set_image*(image_menu_item: PImageMenuItem, image: PWidget){. - cdecl, dynlib: lib, importc: "gtk_image_menu_item_set_image".} -proc item_get_image*(image_menu_item: PImageMenuItem): PWidget{. - cdecl, dynlib: lib, importc: "gtk_image_menu_item_get_image".} -const - bm_TGtkIMContextSimple_in_hex_sequence* = 0x0001'i16 - bp_TGtkIMContextSimple_in_hex_sequence* = 0'i16 - -proc TYPE_IM_CONTEXT_SIMPLE*(): GType -proc IM_CONTEXT_SIMPLE*(obj: pointer): PIMContextSimple -proc IM_CONTEXT_SIMPLE_CLASS*(klass: pointer): PIMContextSimpleClass -proc IS_IM_CONTEXT_SIMPLE*(obj: pointer): bool -proc IS_IM_CONTEXT_SIMPLE_CLASS*(klass: pointer): bool -proc IM_CONTEXT_SIMPLE_GET_CLASS*(obj: pointer): PIMContextSimpleClass -proc in_hex_sequence*(a: PIMContextSimple): guint -proc set_in_hex_sequence*(a: PIMContextSimple, `in_hex_sequence`: guint) -proc im_context_simple_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_im_context_simple_get_type".} -proc im_context_simple_new*(): PIMContext{.cdecl, dynlib: lib, - importc: "gtk_im_context_simple_new".} -proc simple_add_table*(context_simple: PIMContextSimple, - data: Pguint16, max_seq_len: gint, - n_seqs: gint){.cdecl, dynlib: lib, - importc: "gtk_im_context_simple_add_table".} -proc TYPE_IM_MULTICONTEXT*(): GType -proc IM_MULTICONTEXT*(obj: pointer): PIMMulticontext -proc IM_MULTICONTEXT_CLASS*(klass: pointer): PIMMulticontextClass -proc IS_IM_MULTICONTEXT*(obj: pointer): bool -proc IS_IM_MULTICONTEXT_CLASS*(klass: pointer): bool -proc IM_MULTICONTEXT_GET_CLASS*(obj: pointer): PIMMulticontextClass -proc im_multicontext_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_im_multicontext_get_type".} -proc im_multicontext_new*(): PIMContext{.cdecl, dynlib: lib, - importc: "gtk_im_multicontext_new".} -proc append_menuitems*(context: PIMMulticontext, - menushell: PMenuShell){.cdecl, - dynlib: lib, importc: "gtk_im_multicontext_append_menuitems".} -proc TYPE_INPUT_DIALOG*(): GType -proc INPUT_DIALOG*(obj: pointer): PInputDialog -proc INPUT_DIALOG_CLASS*(klass: pointer): PInputDialogClass -proc IS_INPUT_DIALOG*(obj: pointer): bool -proc IS_INPUT_DIALOG_CLASS*(klass: pointer): bool -proc INPUT_DIALOG_GET_CLASS*(obj: pointer): PInputDialogClass -proc input_dialog_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_input_dialog_get_type".} -proc input_dialog_new*(): PInputDialog{.cdecl, dynlib: lib, - importc: "gtk_input_dialog_new".} -proc TYPE_INVISIBLE*(): GType -proc INVISIBLE*(obj: pointer): PInvisible -proc INVISIBLE_CLASS*(klass: pointer): PInvisibleClass -proc IS_INVISIBLE*(obj: pointer): bool -proc IS_INVISIBLE_CLASS*(klass: pointer): bool -proc INVISIBLE_GET_CLASS*(obj: pointer): PInvisibleClass -proc invisible_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_invisible_get_type".} -proc invisible_new*(): PInvisible{.cdecl, dynlib: lib, - importc: "gtk_invisible_new".} -proc invisible_new_for_screen*(screen: gdk2.PScreen): PInvisible{.cdecl, - dynlib: lib, importc: "gtk_invisible_new_for_screen".} -proc set_screen*(invisible: PInvisible, screen: gdk2.PScreen){.cdecl, - dynlib: lib, importc: "gtk_invisible_set_screen".} -proc get_screen*(invisible: PInvisible): gdk2.PScreen{.cdecl, - dynlib: lib, importc: "gtk_invisible_get_screen".} -proc TYPE_ITEM_FACTORY*(): GType -proc ITEM_FACTORY*(anObject: pointer): PItemFactory -proc ITEM_FACTORY_CLASS*(klass: pointer): PItemFactoryClass -proc IS_ITEM_FACTORY*(anObject: pointer): bool -proc IS_ITEM_FACTORY_CLASS*(klass: pointer): bool -proc ITEM_FACTORY_GET_CLASS*(obj: pointer): PItemFactoryClass -proc item_factory_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_item_factory_get_type".} -proc item_factory_new*(container_type: TType, path: cstring, - accel_group: PAccelGroup): PItemFactory{.cdecl, - dynlib: lib, importc: "gtk_item_factory_new".} -proc construct*(ifactory: PItemFactory, container_type: TType, - path: cstring, accel_group: PAccelGroup){.cdecl, - dynlib: lib, importc: "gtk_item_factory_construct".} -proc item_factory_add_foreign*(accel_widget: PWidget, full_path: cstring, - accel_group: PAccelGroup, keyval: guint, - modifiers: gdk2.TModifierType){.cdecl, dynlib: lib, - importc: "gtk_item_factory_add_foreign".} -proc item_factory_from_widget*(widget: PWidget): PItemFactory{.cdecl, - dynlib: lib, importc: "gtk_item_factory_from_widget".} -proc item_factory_path_from_widget*(widget: PWidget): cstring{.cdecl, - dynlib: lib, importc: "gtk_item_factory_path_from_widget".} -proc get_item*(ifactory: PItemFactory, path: cstring): PWidget{. - cdecl, dynlib: lib, importc: "gtk_item_factory_get_item".} -proc get_widget*(ifactory: PItemFactory, path: cstring): PWidget{. - cdecl, dynlib: lib, importc: "gtk_item_factory_get_widget".} -proc get_widget_by_action*(ifactory: PItemFactory, action: guint): PWidget{. - cdecl, dynlib: lib, importc: "gtk_item_factory_get_widget_by_action".} -proc get_item_by_action*(ifactory: PItemFactory, action: guint): PWidget{. - cdecl, dynlib: lib, importc: "gtk_item_factory_get_item_by_action".} -proc create_item*(ifactory: PItemFactory, entry: PItemFactoryEntry, - callback_data: gpointer, callback_type: guint){. - cdecl, dynlib: lib, importc: "gtk_item_factory_create_item".} -proc create_items*(ifactory: PItemFactory, n_entries: guint, - entries: PItemFactoryEntry, - callback_data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_item_factory_create_items".} -proc delete_item*(ifactory: PItemFactory, path: cstring){.cdecl, - dynlib: lib, importc: "gtk_item_factory_delete_item".} -proc delete_entry*(ifactory: PItemFactory, entry: PItemFactoryEntry){. - cdecl, dynlib: lib, importc: "gtk_item_factory_delete_entry".} -proc delete_entries*(ifactory: PItemFactory, n_entries: guint, - entries: PItemFactoryEntry){.cdecl, - dynlib: lib, importc: "gtk_item_factory_delete_entries".} -proc popup*(ifactory: PItemFactory, x: guint, y: guint, - mouse_button: guint, time: guint32){.cdecl, - dynlib: lib, importc: "gtk_item_factory_popup".} -proc popup*(ifactory: PItemFactory, popup_data: gpointer, - destroy: TDestroyNotify, x: guint, y: guint, - mouse_button: guint, time: guint32){.cdecl, - dynlib: lib, importc: "gtk_item_factory_popup_with_data".} -proc popup_data*(ifactory: PItemFactory): gpointer{.cdecl, - dynlib: lib, importc: "gtk_item_factory_popup_data".} -proc item_factory_popup_data_from_widget*(widget: PWidget): gpointer{.cdecl, - dynlib: lib, importc: "gtk_item_factory_popup_data_from_widget".} -proc set_translate_func*(ifactory: PItemFactory, - fun: TTranslateFunc, data: gpointer, - notify: TDestroyNotify){.cdecl, - dynlib: lib, importc: "gtk_item_factory_set_translate_func".} -proc TYPE_LAYOUT*(): GType -proc LAYOUT*(obj: pointer): PLayout -proc LAYOUT_CLASS*(klass: pointer): PLayoutClass -proc IS_LAYOUT*(obj: pointer): bool -proc IS_LAYOUT_CLASS*(klass: pointer): bool -proc LAYOUT_GET_CLASS*(obj: pointer): PLayoutClass -proc layout_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_layout_get_type".} -proc layout_new*(hadjustment: PAdjustment, vadjustment: PAdjustment): PLayout{. - cdecl, dynlib: lib, importc: "gtk_layout_new".} -proc put*(layout: PLayout, child_widget: PWidget, x: gint, y: gint){. - cdecl, dynlib: lib, importc: "gtk_layout_put".} -proc move*(layout: PLayout, child_widget: PWidget, x: gint, y: gint){. - cdecl, dynlib: lib, importc: "gtk_layout_move".} -proc set_size*(layout: PLayout, width: guint, height: guint){.cdecl, - dynlib: lib, importc: "gtk_layout_set_size".} -proc get_size*(layout: PLayout, width: Pguint, height: Pguint){.cdecl, - dynlib: lib, importc: "gtk_layout_get_size".} -proc get_hadjustment*(layout: PLayout): PAdjustment{.cdecl, dynlib: lib, - importc: "gtk_layout_get_hadjustment".} -proc get_vadjustment*(layout: PLayout): PAdjustment{.cdecl, dynlib: lib, - importc: "gtk_layout_get_vadjustment".} -proc set_hadjustment*(layout: PLayout, adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_layout_set_hadjustment".} -proc set_vadjustment*(layout: PLayout, adjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_layout_set_vadjustment".} -const - bm_TGtkList_selection_mode* = 0x0003'i16 - bp_TGtkList_selection_mode* = 0'i16 - bm_TGtkList_drag_selection* = 0x0004'i16 - bp_TGtkList_drag_selection* = 2'i16 - bm_TGtkList_add_mode* = 0x0008'i16 - bp_TGtkList_add_mode* = 3'i16 - -proc TYPE_LIST*(): GType -proc LIST*(obj: pointer): PList -proc LIST_CLASS*(klass: pointer): PListClass -proc IS_LIST*(obj: pointer): bool -proc IS_LIST_CLASS*(klass: pointer): bool -proc LIST_GET_CLASS*(obj: pointer): PListClass -proc selection_mode*(a: PList): guint -proc set_selection_mode*(a: PList, `selection_mode`: guint) -proc drag_selection*(a: PList): guint -proc set_drag_selection*(a: PList, `drag_selection`: guint) -proc add_mode*(a: PList): guint -proc set_add_mode*(a: PList, `add_mode`: guint) -proc list_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_list_get_type".} -proc list_new*(): PList{.cdecl, dynlib: lib, importc: "gtk_list_new".} -proc insert_items*(list: PList, items: PGList, position: gint){.cdecl, - dynlib: lib, importc: "gtk_list_insert_items".} -proc append_items*(list: PList, items: PGList){.cdecl, dynlib: lib, - importc: "gtk_list_append_items".} -proc prepend_items*(list: PList, items: PGList){.cdecl, dynlib: lib, - importc: "gtk_list_prepend_items".} -proc remove_items*(list: PList, items: PGList){.cdecl, dynlib: lib, - importc: "gtk_list_remove_items".} -proc remove_items_no_unref*(list: PList, items: PGList){.cdecl, - dynlib: lib, importc: "gtk_list_remove_items_no_unref".} -proc clear_items*(list: PList, start: gint, theEnd: gint){.cdecl, - dynlib: lib, importc: "gtk_list_clear_items".} -proc select_item*(list: PList, item: gint){.cdecl, dynlib: lib, - importc: "gtk_list_select_item".} -proc unselect_item*(list: PList, item: gint){.cdecl, dynlib: lib, - importc: "gtk_list_unselect_item".} -proc select_child*(list: PList, child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_list_select_child".} -proc unselect_child*(list: PList, child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_list_unselect_child".} -proc child_position*(list: PList, child: PWidget): gint{.cdecl, - dynlib: lib, importc: "gtk_list_child_position".} -proc set_selection_mode*(list: PList, mode: TSelectionMode){.cdecl, - dynlib: lib, importc: "gtk_list_set_selection_mode".} -proc extend_selection*(list: PList, scroll_type: TScrollType, - position: gfloat, auto_start_selection: gboolean){. - cdecl, dynlib: lib, importc: "gtk_list_extend_selection".} -proc start_selection*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_start_selection".} -proc end_selection*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_end_selection".} -proc select_all*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_select_all".} -proc unselect_all*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_unselect_all".} -proc scroll_horizontal*(list: PList, scroll_type: TScrollType, - position: gfloat){.cdecl, dynlib: lib, - importc: "gtk_list_scroll_horizontal".} -proc scroll_vertical*(list: PList, scroll_type: TScrollType, - position: gfloat){.cdecl, dynlib: lib, - importc: "gtk_list_scroll_vertical".} -proc toggle_add_mode*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_toggle_add_mode".} -proc toggle_focus_row*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_toggle_focus_row".} -proc toggle_row*(list: PList, item: PWidget){.cdecl, dynlib: lib, - importc: "gtk_list_toggle_row".} -proc undo_selection*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_undo_selection".} -proc end_drag_selection*(list: PList){.cdecl, dynlib: lib, - importc: "gtk_list_end_drag_selection".} -const - TREE_MODEL_ITERS_PERSIST* = 1 shl 0 - TREE_MODEL_LIST_ONLY* = 1 shl 1 - -proc TYPE_TREE_MODEL*(): GType -proc TREE_MODEL*(obj: pointer): PTreeModel -proc IS_TREE_MODEL*(obj: pointer): bool -proc TREE_MODEL_GET_IFACE*(obj: pointer): PTreeModelIface -proc TYPE_TREE_ITER*(): GType -proc TYPE_TREE_PATH*(): GType -proc tree_path_new*(): PTreePath{.cdecl, dynlib: lib, - importc: "gtk_tree_path_new".} -proc tree_path_new_from_string*(path: cstring): PTreePath{.cdecl, dynlib: lib, - importc: "gtk_tree_path_new_from_string".} -proc to_string*(path: PTreePath): cstring{.cdecl, dynlib: lib, - importc: "gtk_tree_path_to_string".} -proc tree_path_new_root*(): PTreePath -proc tree_path_new_first*(): PTreePath{.cdecl, dynlib: lib, - importc: "gtk_tree_path_new_first".} -proc append_index*(path: PTreePath, index: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_path_append_index".} -proc prepend_index*(path: PTreePath, index: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_path_prepend_index".} -proc get_depth*(path: PTreePath): gint{.cdecl, dynlib: lib, - importc: "gtk_tree_path_get_depth".} -proc get_indices*(path: PTreePath): Pgint{.cdecl, dynlib: lib, - importc: "gtk_tree_path_get_indices".} -proc free*(path: PTreePath){.cdecl, dynlib: lib, - importc: "gtk_tree_path_free".} -proc copy*(path: PTreePath): PTreePath{.cdecl, dynlib: lib, - importc: "gtk_tree_path_copy".} -proc tree_path_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_tree_path_get_type".} -proc compare*(a: PTreePath, b: PTreePath): gint{.cdecl, dynlib: lib, - importc: "gtk_tree_path_compare".} -proc next*(path: PTreePath){.cdecl, dynlib: lib, - importc: "gtk_tree_path_next".} -proc prev*(path: PTreePath): gboolean{.cdecl, dynlib: lib, - importc: "gtk_tree_path_prev".} -proc up*(path: PTreePath): gboolean{.cdecl, dynlib: lib, - importc: "gtk_tree_path_up".} -proc down*(path: PTreePath){.cdecl, dynlib: lib, - importc: "gtk_tree_path_down".} -proc is_ancestor*(path: PTreePath, descendant: PTreePath): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_path_is_ancestor".} -proc is_descendant*(path: PTreePath, ancestor: PTreePath): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_path_is_descendant".} -proc row_reference_new*(model: PTreeModel, path: PTreePath): PTreeRowReference{. - cdecl, dynlib: lib, importc: "gtk_tree_row_reference_new".} -proc tree_row_reference_new_proxy*(proxy: PGObject, model: PTreeModel, - path: PTreePath): PTreeRowReference{.cdecl, - dynlib: lib, importc: "gtk_tree_row_reference_new_proxy".} -proc reference_get_path*(reference: PTreeRowReference): PTreePath{. - cdecl, dynlib: lib, importc: "gtk_tree_row_reference_get_path".} -proc reference_valid*(reference: PTreeRowReference): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_row_reference_valid".} -proc reference_free*(reference: PTreeRowReference){.cdecl, dynlib: lib, - importc: "gtk_tree_row_reference_free".} -proc tree_row_reference_inserted*(proxy: PGObject, path: PTreePath){.cdecl, - dynlib: lib, importc: "gtk_tree_row_reference_inserted".} -proc tree_row_reference_deleted*(proxy: PGObject, path: PTreePath){.cdecl, - dynlib: lib, importc: "gtk_tree_row_reference_deleted".} -proc tree_row_reference_reordered*(proxy: PGObject, path: PTreePath, - iter: PTreeIter, new_order: Pgint){.cdecl, - dynlib: lib, importc: "gtk_tree_row_reference_reordered".} -proc copy*(iter: PTreeIter): PTreeIter{.cdecl, dynlib: lib, - importc: "gtk_tree_iter_copy".} -proc free*(iter: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_tree_iter_free".} -proc tree_iter_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_tree_iter_get_type".} -proc tree_model_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tree_model_get_type".} -proc get_flags*(tree_model: PTreeModel): TTreeModelFlags{.cdecl, - dynlib: lib, importc: "gtk_tree_model_get_flags".} -proc get_n_columns*(tree_model: PTreeModel): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_model_get_n_columns".} -proc get_column_type*(tree_model: PTreeModel, index: gint): GType{. - cdecl, dynlib: lib, importc: "gtk_tree_model_get_column_type".} -proc get_iter*(tree_model: PTreeModel, iter: PTreeIter, - path: PTreePath): gboolean{.cdecl, dynlib: lib, - importc: "gtk_tree_model_get_iter".} -proc get_iter_from_string*(tree_model: PTreeModel, iter: PTreeIter, - path_string: cstring): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_model_get_iter_from_string".} -proc get_iter_root*(tree_model: PTreeModel, iter: PTreeIter): gboolean -proc get_iter_first*(tree_model: PTreeModel, iter: PTreeIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_model_get_iter_first".} -proc get_path*(tree_model: PTreeModel, iter: PTreeIter): PTreePath{. - cdecl, dynlib: lib, importc: "gtk_tree_model_get_path".} -proc get_value*(tree_model: PTreeModel, iter: PTreeIter, - column: gint, value: PGValue){.cdecl, dynlib: lib, - importc: "gtk_tree_model_get_value".} -proc iter_next*(tree_model: PTreeModel, iter: PTreeIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_model_iter_next".} -proc iter_children*(tree_model: PTreeModel, iter: PTreeIter, - parent: PTreeIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_tree_model_iter_children".} -proc iter_has_child*(tree_model: PTreeModel, iter: PTreeIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_model_iter_has_child".} -proc iter_n_children*(tree_model: PTreeModel, iter: PTreeIter): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_model_iter_n_children".} -proc iter_nth_child*(tree_model: PTreeModel, iter: PTreeIter, - parent: PTreeIter, n: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_model_iter_nth_child".} -proc iter_parent*(tree_model: PTreeModel, iter: PTreeIter, - child: PTreeIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_tree_model_iter_parent".} -proc get_string_from_iter*(tree_model: PTreeModel, iter: PTreeIter): - cstring{.cdecl, dynlib: lib, - importc: "gtk_tree_model_get_string_from_iter".} -proc ref_node*(tree_model: PTreeModel, iter: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_tree_model_ref_node".} -proc unref_node*(tree_model: PTreeModel, iter: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_tree_model_unref_node".} -proc foreach*(model: PTreeModel, fun: TTreeModelForeachFunc, - user_data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_tree_model_foreach".} -proc row_changed*(tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_tree_model_row_changed".} -proc row_inserted*(tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_tree_model_row_inserted".} -proc row_has_child_toggled*(tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_tree_model_row_has_child_toggled".} -proc row_deleted*(tree_model: PTreeModel, path: PTreePath){.cdecl, - dynlib: lib, importc: "gtk_tree_model_row_deleted".} -proc rows_reordered*(tree_model: PTreeModel, path: PTreePath, - iter: PTreeIter, new_order: Pgint){.cdecl, - dynlib: lib, importc: "gtk_tree_model_rows_reordered".} -const - TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID* = - (1) - -proc TYPE_TREE_SORTABLE*(): GType -proc TREE_SORTABLE*(obj: pointer): PTreeSortable -proc TREE_SORTABLE_CLASS*(obj: pointer): PTreeSortableIface -proc IS_TREE_SORTABLE*(obj: pointer): bool -proc TREE_SORTABLE_GET_IFACE*(obj: pointer): PTreeSortableIface -proc tree_sortable_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_tree_sortable_get_type".} -proc sort_column_changed*(sortable: PTreeSortable){.cdecl, - dynlib: lib, importc: "gtk_tree_sortable_sort_column_changed".} -proc get_sort_column_id*(sortable: PTreeSortable, - sort_column_id: Pgint, order: PSortType): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_sortable_get_sort_column_id".} -proc set_sort_column_id*(sortable: PTreeSortable, - sort_column_id: gint, order: TSortType){. - cdecl, dynlib: lib, importc: "gtk_tree_sortable_set_sort_column_id".} -proc set_sort_func*(sortable: PTreeSortable, sort_column_id: gint, - sort_func: TTreeIterCompareFunc, - user_data: gpointer, destroy: TDestroyNotify){. - cdecl, dynlib: lib, importc: "gtk_tree_sortable_set_sort_func".} -proc set_default_sort_func*(sortable: PTreeSortable, - sort_func: TTreeIterCompareFunc, user_data: gpointer, - destroy: TDestroyNotify){.cdecl, dynlib: lib, importc: "gtk_tree_sortable_set_default_sort_func".} -proc has_default_sort_func*(sortable: PTreeSortable): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_sortable_has_default_sort_func".} -proc TYPE_TREE_MODEL_SORT*(): GType -proc TREE_MODEL_SORT*(obj: pointer): PTreeModelSort -proc TREE_MODEL_SORT_CLASS*(klass: pointer): PTreeModelSortClass -proc IS_TREE_MODEL_SORT*(obj: pointer): bool -proc IS_TREE_MODEL_SORT_CLASS*(klass: pointer): bool -proc TREE_MODEL_SORT_GET_CLASS*(obj: pointer): PTreeModelSortClass -proc tree_model_sort_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_tree_model_sort_get_type".} -proc sort_new*(child_model: PTreeModel): PTreeModel{. - cdecl, dynlib: lib, importc: "gtk_tree_model_sort_new_with_model".} -proc sort_get_model*(tree_model: PTreeModelSort): PTreeModel{.cdecl, - dynlib: lib, importc: "gtk_tree_model_sort_get_model".} -proc tree_model_sort_convert_child_path_to_path*( - tree_model_sort: PTreeModelSort, child_path: PTreePath): PTreePath{.cdecl, - dynlib: lib, importc: "gtk_tree_model_sort_convert_child_path_to_path".} -proc tree_model_sort_convert_child_iter_to_iter*( - tree_model_sort: PTreeModelSort, sort_iter: PTreeIter, child_iter: PTreeIter){. - cdecl, dynlib: lib, - importc: "gtk_tree_model_sort_convert_child_iter_to_iter".} -proc tree_model_sort_convert_path_to_child_path*( - tree_model_sort: PTreeModelSort, sorted_path: PTreePath): PTreePath{.cdecl, - dynlib: lib, importc: "gtk_tree_model_sort_convert_path_to_child_path".} -proc tree_model_sort_convert_iter_to_child_iter*( - tree_model_sort: PTreeModelSort, child_iter: PTreeIter, - sorted_iter: PTreeIter){.cdecl, dynlib: lib, importc: "gtk_tree_model_sort_convert_iter_to_child_iter".} -proc sort_reset_default_sort_func*(tree_model_sort: PTreeModelSort){. - cdecl, dynlib: lib, importc: "gtk_tree_model_sort_reset_default_sort_func".} -proc sort_clear_cache*(tree_model_sort: PTreeModelSort){.cdecl, - dynlib: lib, importc: "gtk_tree_model_sort_clear_cache".} -const - bm_TGtkListStore_columns_dirty* = 0x0001'i16 - bp_TGtkListStore_columns_dirty* = 0'i16 - -proc TYPE_LIST_STORE*(): GType -proc LIST_STORE*(obj: pointer): PListStore -proc LIST_STORE_CLASS*(klass: pointer): PListStoreClass -proc IS_LIST_STORE*(obj: pointer): bool -proc IS_LIST_STORE_CLASS*(klass: pointer): bool -proc LIST_STORE_GET_CLASS*(obj: pointer): PListStoreClass -proc columns_dirty*(a: PListStore): guint -proc set_columns_dirty*(a: PListStore, `columns_dirty`: guint) -proc list_store_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_list_store_get_type".} -proc list_store_newv*(n_columns: gint, types: PGType): PListStore{.cdecl, - dynlib: lib, importc: "gtk_list_store_newv".} -proc set_column_types*(list_store: PListStore, n_columns: gint, - types: PGType){.cdecl, dynlib: lib, - importc: "gtk_list_store_set_column_types".} -proc set_value*(list_store: PListStore, iter: PTreeIter, - column: gint, value: PGValue){.cdecl, dynlib: lib, - importc: "gtk_list_store_set_value".} -proc remove*(list_store: PListStore, iter: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_list_store_remove".} -proc insert*(list_store: PListStore, iter: PTreeIter, position: gint){. - cdecl, dynlib: lib, importc: "gtk_list_store_insert".} -proc insert_before*(list_store: PListStore, iter: PTreeIter, - sibling: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_list_store_insert_before".} -proc insert_after*(list_store: PListStore, iter: PTreeIter, - sibling: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_list_store_insert_after".} -proc prepend*(list_store: PListStore, iter: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_list_store_prepend".} -proc append*(list_store: PListStore, iter: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_list_store_append".} -proc clear*(list_store: PListStore){.cdecl, dynlib: lib, - importc: "gtk_list_store_clear".} -when false: - const - PRIORITY_RESIZE* = G_PRIORITY_HIGH_IDLE + 10 -proc check_version*(required_major: guint, required_minor: guint, - required_micro: guint): cstring{.cdecl, dynlib: lib, - importc: "gtk_check_version".} -proc disable_setlocale*(){.cdecl, dynlib: lib, importc: "gtk_disable_setlocale".} -proc set_locale*(): cstring{.cdecl, dynlib: lib, importc: "gtk_set_locale".} -proc get_default_language*(): pango.PLanguage{.cdecl, dynlib: lib, - importc: "gtk_get_default_language".} -proc events_pending*(): gint{.cdecl, dynlib: lib, importc: "gtk_events_pending".} -proc main_do_event*(event: gdk2.PEvent){.cdecl, dynlib: lib, - importc: "gtk_main_do_event".} -proc main*(){.cdecl, dynlib: lib, importc: "gtk_main".} -proc init*(argc, argv: pointer){.cdecl, dynlib: lib, importc: "gtk_init".} -proc main_level*(): guint{.cdecl, dynlib: lib, importc: "gtk_main_level".} -proc main_quit*(){.cdecl, dynlib: lib, importc: "gtk_main_quit".} -proc main_iteration*(): gboolean{.cdecl, dynlib: lib, - importc: "gtk_main_iteration".} -proc main_iteration_do*(blocking: gboolean): gboolean{.cdecl, dynlib: lib, - importc: "gtk_main_iteration_do".} -proc gtkTrue*(): gboolean{.cdecl, dynlib: lib, importc: "gtk_true".} -proc gtkFalse*(): gboolean{.cdecl, dynlib: lib, importc: "gtk_false".} -proc grab_add*(widget: PWidget){.cdecl, dynlib: lib, importc: "gtk_grab_add".} -proc grab_get_current*(): PWidget{.cdecl, dynlib: lib, - importc: "gtk_grab_get_current".} -proc grab_remove*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_grab_remove".} -proc init_add*(`function`: TFunction, data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_init_add".} -proc quit_add_destroy*(main_level: guint, anObject: PObject){.cdecl, - dynlib: lib, importc: "gtk_quit_add_destroy".} -proc quit_add*(main_level: guint, `function`: TFunction, data: gpointer): guint{. - cdecl, dynlib: lib, importc: "gtk_quit_add".} -proc quit_add_full*(main_level: guint, `function`: TFunction, - marshal: TCallbackMarshal, data: gpointer, - destroy: TDestroyNotify): guint{.cdecl, dynlib: lib, - importc: "gtk_quit_add_full".} -proc quit_remove*(quit_handler_id: guint){.cdecl, dynlib: lib, - importc: "gtk_quit_remove".} -proc quit_remove_by_data*(data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_quit_remove_by_data".} -proc timeout_add*(interval: guint32, `function`: TFunction, data: gpointer): guint{. - cdecl, dynlib: lib, importc: "gtk_timeout_add".} -proc timeout_add_full*(interval: guint32, `function`: TFunction, - marshal: TCallbackMarshal, data: gpointer, - destroy: TDestroyNotify): guint{.cdecl, dynlib: lib, - importc: "gtk_timeout_add_full".} -proc timeout_remove*(timeout_handler_id: guint){.cdecl, dynlib: lib, - importc: "gtk_timeout_remove".} -proc idle_add*(`function`: TFunction, data: gpointer): guint{.cdecl, - dynlib: lib, importc: "gtk_idle_add".} -proc idle_add_priority*(priority: gint, `function`: TFunction, data: gpointer): guint{. - cdecl, dynlib: lib, importc: "gtk_idle_add_priority".} -proc idle_add_full*(priority: gint, `function`: TFunction, - marshal: TCallbackMarshal, data: gpointer, - destroy: TDestroyNotify): guint{.cdecl, dynlib: lib, - importc: "gtk_idle_add_full".} -proc idle_remove*(idle_handler_id: guint){.cdecl, dynlib: lib, - importc: "gtk_idle_remove".} -proc idle_remove_by_data*(data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_idle_remove_by_data".} -proc input_add_full*(source: gint, condition: gdk2.TInputCondition, - `function`: gdk2.TInputFunction, marshal: TCallbackMarshal, - data: gpointer, destroy: TDestroyNotify): guint{.cdecl, - dynlib: lib, importc: "gtk_input_add_full".} -proc input_remove*(input_handler_id: guint){.cdecl, dynlib: lib, - importc: "gtk_input_remove".} -proc key_snooper_install*(snooper: TKeySnoopFunc, func_data: gpointer): guint{. - cdecl, dynlib: lib, importc: "gtk_key_snooper_install".} -proc key_snooper_remove*(snooper_handler_id: guint){.cdecl, dynlib: lib, - importc: "gtk_key_snooper_remove".} -proc get_current_event*(): gdk2.PEvent{.cdecl, dynlib: lib, - importc: "gtk_get_current_event".} -proc get_current_event_time*(): guint32{.cdecl, dynlib: lib, - importc: "gtk_get_current_event_time".} -proc get_current_event_state*(state: gdk2.PModifierType): gboolean{.cdecl, - dynlib: lib, importc: "gtk_get_current_event_state".} -proc get_event_widget*(event: gdk2.PEvent): PWidget{.cdecl, dynlib: lib, - importc: "gtk_get_event_widget".} -proc propagate_event*(widget: PWidget, event: gdk2.PEvent){.cdecl, dynlib: lib, - importc: "gtk_propagate_event".} -proc boolean_handled_accumulator*(ihint: PGSignalInvocationHint, - return_accu: PGValue, handler_return: PGValue, - dummy: gpointer): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_boolean_handled_accumulator".} -proc find_module*(name: cstring, thetype: cstring): cstring{.cdecl, dynlib: lib, - importc: "_gtk_find_module".} -proc get_module_path*(thetype: cstring): PPgchar{.cdecl, dynlib: lib, - importc: "_gtk_get_module_path".} -proc TYPE_MENU_BAR*(): GType -proc MENU_BAR*(obj: pointer): PMenuBar -proc MENU_BAR_CLASS*(klass: pointer): PMenuBarClass -proc IS_MENU_BAR*(obj: pointer): bool -proc IS_MENU_BAR_CLASS*(klass: pointer): bool -proc MENU_BAR_GET_CLASS*(obj: pointer): PMenuBarClass -proc menu_bar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_menu_bar_get_type".} -proc menu_bar_new*(): PMenuBar{.cdecl, dynlib: lib, importc: "gtk_menu_bar_new".} -proc cycle_focus*(menubar: PMenuBar, dir: TDirectionType){.cdecl, - dynlib: lib, importc: "_gtk_menu_bar_cycle_focus".} -proc TYPE_MESSAGE_DIALOG*(): GType -proc MESSAGE_DIALOG*(obj: pointer): PMessageDialog -proc MESSAGE_DIALOG_CLASS*(klass: pointer): PMessageDialogClass -proc IS_MESSAGE_DIALOG*(obj: pointer): bool -proc IS_MESSAGE_DIALOG_CLASS*(klass: pointer): bool -proc MESSAGE_DIALOG_GET_CLASS*(obj: pointer): PMessageDialogClass -proc message_dialog_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_message_dialog_get_type".} -const - bm_TGtkNotebook_show_tabs* = 0x0001'i16 - bp_TGtkNotebook_show_tabs* = 0'i16 - bm_TGtkNotebook_homogeneous* = 0x0002'i16 - bp_TGtkNotebook_homogeneous* = 1'i16 - bm_TGtkNotebook_show_border* = 0x0004'i16 - bp_TGtkNotebook_show_border* = 2'i16 - bm_TGtkNotebook_tab_pos* = 0x0018'i16 - bp_TGtkNotebook_tab_pos* = 3'i16 - bm_TGtkNotebook_scrollable* = 0x0020'i16 - bp_TGtkNotebook_scrollable* = 5'i16 - bm_TGtkNotebook_in_child* = 0x00C0'i16 - bp_TGtkNotebook_in_child* = 6'i16 - bm_TGtkNotebook_click_child* = 0x0300'i16 - bp_TGtkNotebook_click_child* = 8'i16 - bm_TGtkNotebook_button* = 0x0C00'i16 - bp_TGtkNotebook_button* = 10'i16 - bm_TGtkNotebook_need_timer* = 0x1000'i16 - bp_TGtkNotebook_need_timer* = 12'i16 - bm_TGtkNotebook_child_has_focus* = 0x2000'i16 - bp_TGtkNotebook_child_has_focus* = 13'i16 - bm_TGtkNotebook_have_visible_child* = 0x4000'i16 - bp_TGtkNotebook_have_visible_child* = 14'i16 - bm_TGtkNotebook_focus_out* = 0x8000'i16 - bp_TGtkNotebook_focus_out* = 15'i16 - -proc TYPE_NOTEBOOK*(): GType -proc NOTEBOOK*(obj: pointer): PNotebook -proc NOTEBOOK_CLASS*(klass: pointer): PNotebookClass -proc IS_NOTEBOOK*(obj: pointer): bool -proc IS_NOTEBOOK_CLASS*(klass: pointer): bool -proc NOTEBOOK_GET_CLASS*(obj: pointer): PNotebookClass -proc show_tabs*(a: PNotebook): guint -proc set_show_tabs*(a: PNotebook, `show_tabs`: guint) -proc homogeneous*(a: PNotebook): guint -proc set_homogeneous*(a: PNotebook, `homogeneous`: guint) -proc show_border*(a: PNotebook): guint -proc set_show_border*(a: PNotebook, `show_border`: guint) -proc tab_pos*(a: PNotebook): guint -proc scrollable*(a: PNotebook): guint -proc set_scrollable*(a: PNotebook, `scrollable`: guint) -proc in_child*(a: PNotebook): guint -proc set_in_child*(a: PNotebook, `in_child`: guint) -proc click_child*(a: PNotebook): guint -proc set_click_child*(a: PNotebook, `click_child`: guint) -proc button*(a: PNotebook): guint -proc set_button*(a: PNotebook, `button`: guint) -proc need_timer*(a: PNotebook): guint -proc set_need_timer*(a: PNotebook, `need_timer`: guint) -proc child_has_focus*(a: PNotebook): guint -proc set_child_has_focus*(a: PNotebook, `child_has_focus`: guint) -proc have_visible_child*(a: PNotebook): guint -proc set_have_visible_child*(a: PNotebook, `have_visible_child`: guint) -proc focus_out*(a: PNotebook): guint -proc set_focus_out*(a: PNotebook, `focus_out`: guint) -proc notebook_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_notebook_get_type".} -proc notebook_new*(): PNotebook{.cdecl, dynlib: lib, importc: "gtk_notebook_new".} -proc append_page*(notebook: PNotebook, child: PWidget, - tab_label: PWidget): gint{.cdecl, dynlib: lib, - importc: "gtk_notebook_append_page".} -proc append_page_menu*(notebook: PNotebook, child: PWidget, - tab_label: PWidget, menu_label: PWidget): gint{. - cdecl, dynlib: lib, importc: "gtk_notebook_append_page_menu".} -proc prepend_page*(notebook: PNotebook, child: PWidget, - tab_label: PWidget): gint{.cdecl, dynlib: lib, - importc: "gtk_notebook_prepend_page".} -proc prepend_page_menu*(notebook: PNotebook, child: PWidget, - tab_label: PWidget, menu_label: PWidget): gint{. - cdecl, dynlib: lib, importc: "gtk_notebook_prepend_page_menu".} -proc insert_page*(notebook: PNotebook, child: PWidget, - tab_label: PWidget, position: gint): gint{.cdecl, - dynlib: lib, importc: "gtk_notebook_insert_page".} -proc insert_page_menu*(notebook: PNotebook, child: PWidget, - tab_label: PWidget, menu_label: PWidget, - position: gint): gint{.cdecl, dynlib: lib, - importc: "gtk_notebook_insert_page_menu".} -proc remove_page*(notebook: PNotebook, page_num: gint){.cdecl, - dynlib: lib, importc: "gtk_notebook_remove_page".} -proc get_current_page*(notebook: PNotebook): gint{.cdecl, dynlib: lib, - importc: "gtk_notebook_get_current_page".} -proc get_n_pages*(notebook: PNotebook): gint{.cdecl, dynlib: lib, - importc: "gtk_notebook_get_n_pages".} -proc get_nth_page*(notebook: PNotebook, page_num: gint): PWidget{. - cdecl, dynlib: lib, importc: "gtk_notebook_get_nth_page".} -proc page_num*(notebook: PNotebook, child: PWidget): gint{.cdecl, - dynlib: lib, importc: "gtk_notebook_page_num".} -proc set_current_page*(notebook: PNotebook, page_num: gint){.cdecl, - dynlib: lib, importc: "gtk_notebook_set_current_page".} -proc next_page*(notebook: PNotebook){.cdecl, dynlib: lib, - importc: "gtk_notebook_next_page".} -proc prev_page*(notebook: PNotebook){.cdecl, dynlib: lib, - importc: "gtk_notebook_prev_page".} -proc set_show_border*(notebook: PNotebook, show_border: gboolean){. - cdecl, dynlib: lib, importc: "gtk_notebook_set_show_border".} -proc get_show_border*(notebook: PNotebook): gboolean{.cdecl, - dynlib: lib, importc: "gtk_notebook_get_show_border".} -proc set_show_tabs*(notebook: PNotebook, show_tabs: gboolean){.cdecl, - dynlib: lib, importc: "gtk_notebook_set_show_tabs".} -proc get_show_tabs*(notebook: PNotebook): gboolean{.cdecl, dynlib: lib, - importc: "gtk_notebook_get_show_tabs".} -#proc set_tab_pos*(notebook: PNotebook, pos: TPositionType){.cdecl, -# dynlib: lib, importc: "gtk_notebook_set_tab_pos".} -proc get_tab_pos*(notebook: PNotebook): TPositionType{.cdecl, - dynlib: lib, importc: "gtk_notebook_get_tab_pos".} -proc set_scrollable*(notebook: PNotebook, scrollable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_notebook_set_scrollable".} -proc get_scrollable*(notebook: PNotebook): gboolean{.cdecl, - dynlib: lib, importc: "gtk_notebook_get_scrollable".} -proc set_tab_reorderable*(notebook: PNotebook, child: PWidget, b: bool){.cdecl, - dynlib: lib, importc: "gtk_notebook_set_tab_reorderable".} -proc get_tab_reorderable*(notebook: PNotebook, child: PWidget): bool {.cdecl, - dynlib: lib, importc: "gtk_notebook_get_tab_reorderable".} -proc popup_enable*(notebook: PNotebook){.cdecl, dynlib: lib, - importc: "gtk_notebook_popup_enable".} -proc popup_disable*(notebook: PNotebook){.cdecl, dynlib: lib, - importc: "gtk_notebook_popup_disable".} -proc get_tab_label*(notebook: PNotebook, child: PWidget): PWidget{. - cdecl, dynlib: lib, importc: "gtk_notebook_get_tab_label".} -proc set_tab_label*(notebook: PNotebook, child: PWidget, - tab_label: PWidget){.cdecl, dynlib: lib, - importc: "gtk_notebook_set_tab_label".} -proc set_tab_label_text*(notebook: PNotebook, child: PWidget, - tab_text: cstring){.cdecl, dynlib: lib, - importc: "gtk_notebook_set_tab_label_text".} -proc get_tab_label_text*(notebook: PNotebook, child: PWidget): cstring{. - cdecl, dynlib: lib, importc: "gtk_notebook_get_tab_label_text".} -proc get_menu_label*(notebook: PNotebook, child: PWidget): PWidget{. - cdecl, dynlib: lib, importc: "gtk_notebook_get_menu_label".} -proc set_menu_label*(notebook: PNotebook, child: PWidget, - menu_label: PWidget){.cdecl, dynlib: lib, - importc: "gtk_notebook_set_menu_label".} -proc set_menu_label_text*(notebook: PNotebook, child: PWidget, - menu_text: cstring){.cdecl, dynlib: lib, - importc: "gtk_notebook_set_menu_label_text".} -proc get_menu_label_text*(notebook: PNotebook, child: PWidget): cstring{. - cdecl, dynlib: lib, importc: "gtk_notebook_get_menu_label_text".} -proc query_tab_label_packing*(notebook: PNotebook, child: PWidget, - expand: Pgboolean, fill: Pgboolean, - pack_type: PPackType){.cdecl, - dynlib: lib, importc: "gtk_notebook_query_tab_label_packing".} -proc set_tab_label_packing*(notebook: PNotebook, child: PWidget, - expand: gboolean, fill: gboolean, - pack_type: TPackType){.cdecl, dynlib: lib, - importc: "gtk_notebook_set_tab_label_packing".} -proc reorder_child*(notebook: PNotebook, child: PWidget, position: gint){. - cdecl, dynlib: lib, importc: "gtk_notebook_reorder_child".} -const - bm_TGtkOldEditable_has_selection* = 0x0001'i16 - bp_TGtkOldEditable_has_selection* = 0'i16 - bm_TGtkOldEditable_editable* = 0x0002'i16 - bp_TGtkOldEditable_editable* = 1'i16 - bm_TGtkOldEditable_visible* = 0x0004'i16 - bp_TGtkOldEditable_visible* = 2'i16 - -proc TYPE_OLD_EDITABLE*(): GType -proc OLD_EDITABLE*(obj: pointer): POldEditable -proc OLD_EDITABLE_CLASS*(klass: pointer): POldEditableClass -proc IS_OLD_EDITABLE*(obj: pointer): bool -proc IS_OLD_EDITABLE_CLASS*(klass: pointer): bool -proc OLD_EDITABLE_GET_CLASS*(obj: pointer): POldEditableClass -proc has_selection*(a: POldEditable): guint -proc set_has_selection*(a: POldEditable, `has_selection`: guint) -proc editable*(a: POldEditable): guint -proc set_editable*(a: POldEditable, `editable`: guint) -proc visible*(a: POldEditable): guint -proc set_visible*(a: POldEditable, `visible`: guint) -proc old_editable_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_old_editable_get_type".} -proc claim_selection*(old_editable: POldEditable, claim: gboolean, - time: guint32){.cdecl, dynlib: lib, - importc: "gtk_old_editable_claim_selection".} -proc changed*(old_editable: POldEditable){.cdecl, dynlib: lib, - importc: "gtk_old_editable_changed".} -proc TYPE_OPTION_MENU*(): GType -proc OPTION_MENU*(obj: pointer): POptionMenu -proc OPTION_MENU_CLASS*(klass: pointer): POptionMenuClass -proc IS_OPTION_MENU*(obj: pointer): bool -proc IS_OPTION_MENU_CLASS*(klass: pointer): bool -proc OPTION_MENU_GET_CLASS*(obj: pointer): POptionMenuClass -proc option_menu_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_option_menu_get_type".} -proc option_menu_new*(): POptionMenu{.cdecl, dynlib: lib, - importc: "gtk_option_menu_new".} -proc get_menu*(option_menu: POptionMenu): PWidget{.cdecl, - dynlib: lib, importc: "gtk_option_menu_get_menu".} -proc set_menu*(option_menu: POptionMenu, menu: PWidget){.cdecl, - dynlib: lib, importc: "gtk_option_menu_set_menu".} -proc remove_menu*(option_menu: POptionMenu){.cdecl, dynlib: lib, - importc: "gtk_option_menu_remove_menu".} -proc get_history*(option_menu: POptionMenu): gint{.cdecl, - dynlib: lib, importc: "gtk_option_menu_get_history".} -proc set_history*(option_menu: POptionMenu, index: guint){.cdecl, - dynlib: lib, importc: "gtk_option_menu_set_history".} -const - bm_TGtkPixmap_build_insensitive* = 0x0001'i16 - bp_TGtkPixmap_build_insensitive* = 0'i16 - -proc TYPE_PIXMAP*(): GType -proc PIXMAP*(obj: pointer): PPixmap -proc PIXMAP_CLASS*(klass: pointer): PPixmapClass -proc IS_PIXMAP*(obj: pointer): bool -proc IS_PIXMAP_CLASS*(klass: pointer): bool -proc PIXMAP_GET_CLASS*(obj: pointer): PPixmapClass -proc build_insensitive*(a: PPixmap): guint -proc set_build_insensitive*(a: PPixmap, `build_insensitive`: guint) -proc pixmap_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_pixmap_get_type".} -proc pixmap_new*(pixmap: gdk2.PPixmap, mask: gdk2.PBitmap): PPixmap{.cdecl, - dynlib: lib, importc: "gtk_pixmap_new".} -proc set*(pixmap: PPixmap, val: gdk2.PPixmap, mask: gdk2.PBitmap){.cdecl, - dynlib: lib, importc: "gtk_pixmap_set".} -proc get*(pixmap: PPixmap, val: var gdk2.PPixmap, mask: var gdk2.PBitmap){. - cdecl, dynlib: lib, importc: "gtk_pixmap_get".} -proc set_build_insensitive*(pixmap: PPixmap, build: gboolean){.cdecl, - dynlib: lib, importc: "gtk_pixmap_set_build_insensitive".} -const - bm_TGtkPlug_same_app* = 0x0001'i16 - bp_TGtkPlug_same_app* = 0'i16 - -proc TYPE_PLUG*(): GType -proc PLUG*(obj: pointer): PPlug -proc PLUG_CLASS*(klass: pointer): PPlugClass -proc IS_PLUG*(obj: pointer): bool -proc IS_PLUG_CLASS*(klass: pointer): bool -proc PLUG_GET_CLASS*(obj: pointer): PPlugClass -proc same_app*(a: PPlug): guint -proc set_same_app*(a: PPlug, `same_app`: guint) -proc plug_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_plug_get_type".} -proc construct_for_display*(plug: PPlug, display: gdk2.PDisplay, - socket_id: gdk2.TNativeWindow){.cdecl, - dynlib: lib, importc: "gtk_plug_construct_for_display".} -proc plug_new_for_display*(display: gdk2.PDisplay, socket_id: gdk2.TNativeWindow): PPlug{. - cdecl, dynlib: lib, importc: "gtk_plug_new_for_display".} -proc get_id*(plug: PPlug): gdk2.TNativeWindow{.cdecl, dynlib: lib, - importc: "gtk_plug_get_id".} -proc add_to_socket*(plug: PPlug, socket: PSocket){.cdecl, dynlib: lib, - importc: "_gtk_plug_add_to_socket".} -proc remove_from_socket*(plug: PPlug, socket: PSocket){.cdecl, dynlib: lib, - importc: "_gtk_plug_remove_from_socket".} -const - bm_TGtkPreview_type* = 0x0001'i16 - bp_TGtkPreview_type* = 0'i16 - bm_TGtkPreview_expand* = 0x0002'i16 - bp_TGtkPreview_expand* = 1'i16 - -proc TYPE_PREVIEW*(): GType -proc PREVIEW*(obj: pointer): PPreview -proc PREVIEW_CLASS*(klass: pointer): PPreviewClass -proc IS_PREVIEW*(obj: pointer): bool -proc IS_PREVIEW_CLASS*(klass: pointer): bool -proc PREVIEW_GET_CLASS*(obj: pointer): PPreviewClass -proc get_type*(a: PPreview): guint -proc set_type*(a: PPreview, `type`: guint) -proc get_expand*(a: PPreview): guint -proc set_expand*(a: PPreview, `expand`: guint) -proc preview_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_preview_get_type".} -proc preview_uninit*(){.cdecl, dynlib: lib, importc: "gtk_preview_uninit".} -proc preview_new*(thetype: TPreviewClass): PPreview{.cdecl, dynlib: lib, - importc: "gtk_preview_new".} -proc size*(preview: PPreview, width: gint, height: gint){.cdecl, - dynlib: lib, importc: "gtk_preview_size".} -proc put*(preview: PPreview, window: gdk2.PWindow, gc: gdk2.PGC, srcx: gint, - srcy: gint, destx: gint, desty: gint, width: gint, - height: gint){.cdecl, dynlib: lib, importc: "gtk_preview_put".} -proc draw_row*(preview: PPreview, data: Pguchar, x: gint, y: gint, - w: gint){.cdecl, dynlib: lib, - importc: "gtk_preview_draw_row".} -proc set_expand*(preview: PPreview, expand: gboolean){.cdecl, - dynlib: lib, importc: "gtk_preview_set_expand".} -proc preview_set_gamma*(gamma: float64){.cdecl, dynlib: lib, - importc: "gtk_preview_set_gamma".} -proc preview_set_color_cube*(nred_shades: guint, ngreen_shades: guint, - nblue_shades: guint, ngray_shades: guint){.cdecl, - dynlib: lib, importc: "gtk_preview_set_color_cube".} -proc preview_set_install_cmap*(install_cmap: gint){.cdecl, dynlib: lib, - importc: "gtk_preview_set_install_cmap".} -proc preview_set_reserved*(nreserved: gint){.cdecl, dynlib: lib, - importc: "gtk_preview_set_reserved".} -proc set_dither*(preview: PPreview, dither: gdk2.TRgbDither){.cdecl, - dynlib: lib, importc: "gtk_preview_set_dither".} -proc preview_get_info*(): PPreviewInfo{.cdecl, dynlib: lib, - importc: "gtk_preview_get_info".} -proc preview_reset*(){.cdecl, dynlib: lib, importc: "gtk_preview_reset".} -const - bm_TGtkProgress_show_text* = 0x0001'i16 - bp_TGtkProgress_show_text* = 0'i16 - bm_TGtkProgress_activity_mode* = 0x0002'i16 - bp_TGtkProgress_activity_mode* = 1'i16 - bm_TGtkProgress_use_text_format* = 0x0004'i16 - bp_TGtkProgress_use_text_format* = 2'i16 - -proc show_text*(a: PProgress): guint -proc set_show_text*(a: PProgress, `show_text`: guint) -proc activity_mode*(a: PProgress): guint -proc set_activity_mode*(a: PProgress, `activity_mode`: guint) -proc use_text_format*(a: PProgress): guint -proc set_use_text_format*(a: PProgress, `use_text_format`: guint) -const - bm_TGtkProgressBar_activity_dir* = 0x0001'i16 - bp_TGtkProgressBar_activity_dir* = 0'i16 - -proc TYPE_PROGRESS_BAR*(): GType -proc PROGRESS_BAR*(obj: pointer): PProgressBar -proc PROGRESS_BAR_CLASS*(klass: pointer): PProgressBarClass -proc IS_PROGRESS_BAR*(obj: pointer): bool -proc IS_PROGRESS_BAR_CLASS*(klass: pointer): bool -proc PROGRESS_BAR_GET_CLASS*(obj: pointer): PProgressBarClass -proc activity_dir*(a: PProgressBar): guint -proc set_activity_dir*(a: PProgressBar, `activity_dir`: guint) -proc progress_bar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_progress_bar_get_type".} -proc progress_bar_new*(): PProgressBar{.cdecl, dynlib: lib, - importc: "gtk_progress_bar_new".} -proc pulse*(pbar: PProgressBar){.cdecl, dynlib: lib, - importc: "gtk_progress_bar_pulse".} -proc set_text*(pbar: PProgressBar, text: cstring){.cdecl, - dynlib: lib, importc: "gtk_progress_bar_set_text".} -proc set_fraction*(pbar: PProgressBar, fraction: gdouble){.cdecl, - dynlib: lib, importc: "gtk_progress_bar_set_fraction".} -proc set_pulse_step*(pbar: PProgressBar, fraction: gdouble){.cdecl, - dynlib: lib, importc: "gtk_progress_bar_set_pulse_step".} -proc set_orientation*(pbar: PProgressBar, - orientation: TProgressBarOrientation){.cdecl, - dynlib: lib, importc: "gtk_progress_bar_set_orientation".} -proc get_text*(pbar: PProgressBar): cstring{.cdecl, dynlib: lib, - importc: "gtk_progress_bar_get_text".} -proc get_fraction*(pbar: PProgressBar): gdouble{.cdecl, - dynlib: lib, importc: "gtk_progress_bar_get_fraction".} -proc get_pulse_step*(pbar: PProgressBar): gdouble{.cdecl, - dynlib: lib, importc: "gtk_progress_bar_get_pulse_step".} -proc get_orientation*(pbar: PProgressBar): TProgressBarOrientation{. - cdecl, dynlib: lib, importc: "gtk_progress_bar_get_orientation".} -proc TYPE_RADIO_BUTTON*(): GType -proc RADIO_BUTTON*(obj: pointer): PRadioButton -proc RADIO_BUTTON_CLASS*(klass: pointer): PRadioButtonClass -proc IS_RADIO_BUTTON*(obj: pointer): bool -proc IS_RADIO_BUTTON_CLASS*(klass: pointer): bool -proc RADIO_BUTTON_GET_CLASS*(obj: pointer): PRadioButtonClass -proc radio_button_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_radio_button_get_type".} -proc radio_button_new*(group: PGSList): PRadioButton{.cdecl, dynlib: lib, - importc: "gtk_radio_button_new".} -proc new_from_widget*(group: PRadioButton): PRadioButton{.cdecl, - dynlib: lib, importc: "gtk_radio_button_new_from_widget".} -proc radio_button_new*(group: PGSList, `label`: cstring): PRadioButton{. - cdecl, dynlib: lib, importc: "gtk_radio_button_new_with_label".} -proc radio_button_new_with_label_from_widget*(group: PRadioButton, - `label`: cstring): PRadioButton{.cdecl, dynlib: lib, importc: "gtk_radio_button_new_with_label_from_widget".} -proc radio_button_new_with_mnemonic*(group: PGSList, `label`: cstring): PRadioButton{. - cdecl, dynlib: lib, importc: "gtk_radio_button_new_with_mnemonic".} -proc radio_button_new_with_mnemonic_from_widget*(group: PRadioButton, - `label`: cstring): PRadioButton{.cdecl, dynlib: lib, importc: "gtk_radio_button_new_with_mnemonic_from_widget".} -proc get_group*(radio_button: PRadioButton): PGSList{.cdecl, - dynlib: lib, importc: "gtk_radio_button_get_group".} -proc set_group*(radio_button: PRadioButton, group: PGSList){.cdecl, - dynlib: lib, importc: "gtk_radio_button_set_group".} -proc TYPE_RADIO_MENU_ITEM*(): GType -proc RADIO_MENU_ITEM*(obj: pointer): PRadioMenuItem -proc RADIO_MENU_ITEM_CLASS*(klass: pointer): PRadioMenuItemClass -proc IS_RADIO_MENU_ITEM*(obj: pointer): bool -proc IS_RADIO_MENU_ITEM_CLASS*(klass: pointer): bool -proc RADIO_MENU_ITEM_GET_CLASS*(obj: pointer): PRadioMenuItemClass -proc radio_menu_item_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_radio_menu_item_get_type".} -proc radio_menu_item_new*(group: PGSList): PRadioMenuItem{.cdecl, dynlib: lib, - importc: "gtk_radio_menu_item_new".} -proc radio_menu_item_new*(group: PGSList, `label`: cstring): PRadioMenuItem{. - cdecl, dynlib: lib, importc: "gtk_radio_menu_item_new_with_label".} -proc radio_menu_item_new_with_mnemonic*(group: PGSList, `label`: cstring): PRadioMenuItem{. - cdecl, dynlib: lib, importc: "gtk_radio_menu_item_new_with_mnemonic".} -proc item_get_group*(radio_menu_item: PRadioMenuItem): PGSList{. - cdecl, dynlib: lib, importc: "gtk_radio_menu_item_get_group".} -proc item_set_group*(radio_menu_item: PRadioMenuItem, group: PGSList){. - cdecl, dynlib: lib, importc: "gtk_radio_menu_item_set_group".} -const - bm_TGtkScrolledWindow_hscrollbar_policy* = 0x0003'i16 - bp_TGtkScrolledWindow_hscrollbar_policy* = 0'i16 - bm_TGtkScrolledWindow_vscrollbar_policy* = 0x000C'i16 - bp_TGtkScrolledWindow_vscrollbar_policy* = 2'i16 - bm_TGtkScrolledWindow_hscrollbar_visible* = 0x0010'i16 - bp_TGtkScrolledWindow_hscrollbar_visible* = 4'i16 - bm_TGtkScrolledWindow_vscrollbar_visible* = 0x0020'i16 - bp_TGtkScrolledWindow_vscrollbar_visible* = 5'i16 - bm_TGtkScrolledWindow_window_placement* = 0x00C0'i16 - bp_TGtkScrolledWindow_window_placement* = 6'i16 - bm_TGtkScrolledWindow_focus_out* = 0x0100'i16 - bp_TGtkScrolledWindow_focus_out* = 8'i16 - -proc TYPE_SCROLLED_WINDOW*(): GType -proc SCROLLED_WINDOW*(obj: pointer): PScrolledWindow -proc SCROLLED_WINDOW_CLASS*(klass: pointer): PScrolledWindowClass -proc IS_SCROLLED_WINDOW*(obj: pointer): bool -proc IS_SCROLLED_WINDOW_CLASS*(klass: pointer): bool -proc SCROLLED_WINDOW_GET_CLASS*(obj: pointer): PScrolledWindowClass -proc hscrollbar_policy*(a: PScrolledWindow): guint -proc set_hscrollbar_policy*(a: PScrolledWindow, `hscrollbar_policy`: guint) -proc vscrollbar_policy*(a: PScrolledWindow): guint -proc set_vscrollbar_policy*(a: PScrolledWindow, `vscrollbar_policy`: guint) -proc hscrollbar_visible*(a: PScrolledWindow): guint -proc set_hscrollbar_visible*(a: PScrolledWindow, `hscrollbar_visible`: guint) -proc vscrollbar_visible*(a: PScrolledWindow): guint -proc set_vscrollbar_visible*(a: PScrolledWindow, `vscrollbar_visible`: guint) -proc window_placement*(a: PScrolledWindow): guint -proc set_window_placement*(a: PScrolledWindow, `window_placement`: guint) -proc focus_out*(a: PScrolledWindow): guint -proc set_focus_out*(a: PScrolledWindow, `focus_out`: guint) -proc scrolled_window_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_scrolled_window_get_type".} -proc scrolled_window_new*(hadjustment: PAdjustment, vadjustment: PAdjustment): PScrolledWindow{. - cdecl, dynlib: lib, importc: "gtk_scrolled_window_new".} -proc set_hadjustment*(scrolled_window: PScrolledWindow, - hadjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_scrolled_window_set_hadjustment".} -proc set_vadjustment*(scrolled_window: PScrolledWindow, - hadjustment: PAdjustment){.cdecl, - dynlib: lib, importc: "gtk_scrolled_window_set_vadjustment".} -proc get_hadjustment*(scrolled_window: PScrolledWindow): PAdjustment{. - cdecl, dynlib: lib, importc: "gtk_scrolled_window_get_hadjustment".} -proc get_vadjustment*(scrolled_window: PScrolledWindow): PAdjustment{. - cdecl, dynlib: lib, importc: "gtk_scrolled_window_get_vadjustment".} -proc set_policy*(scrolled_window: PScrolledWindow, - hscrollbar_policy: TPolicyType, - vscrollbar_policy: TPolicyType){.cdecl, - dynlib: lib, importc: "gtk_scrolled_window_set_policy".} -proc get_policy*(scrolled_window: PScrolledWindow, - hscrollbar_policy: PPolicyType, - vscrollbar_policy: PPolicyType){.cdecl, - dynlib: lib, importc: "gtk_scrolled_window_get_policy".} -proc set_placement*(scrolled_window: PScrolledWindow, - window_placement: TCornerType){.cdecl, - dynlib: lib, importc: "gtk_scrolled_window_set_placement".} -proc get_placement*(scrolled_window: PScrolledWindow): TCornerType{. - cdecl, dynlib: lib, importc: "gtk_scrolled_window_get_placement".} -proc set_shadow_type*(scrolled_window: PScrolledWindow, - thetype: TShadowType){.cdecl, dynlib: lib, - importc: "gtk_scrolled_window_set_shadow_type".} -proc get_shadow_type*(scrolled_window: PScrolledWindow): TShadowType{. - cdecl, dynlib: lib, importc: "gtk_scrolled_window_get_shadow_type".} -proc add_with_viewport*(scrolled_window: PScrolledWindow, - child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_scrolled_window_add_with_viewport".} -proc TYPE_SELECTION_DATA*(): GType -proc list_new*(targets: PTargetEntry, ntargets: guint): PTargetList{. - cdecl, dynlib: lib, importc: "gtk_target_list_new".} -proc reference*(list: PTargetList){.cdecl, dynlib: lib, - importc: "gtk_target_list_ref".} -proc unref*(list: PTargetList){.cdecl, dynlib: lib, - importc: "gtk_target_list_unref".} -proc add*(list: PTargetList, target: gdk2.TAtom, flags: guint, - info: guint){.cdecl, dynlib: lib, - importc: "gtk_target_list_add".} -proc add_table*(list: PTargetList, targets: PTargetEntry, - ntargets: guint){.cdecl, dynlib: lib, - importc: "gtk_target_list_add_table".} -proc remove*(list: PTargetList, target: gdk2.TAtom){.cdecl, - dynlib: lib, importc: "gtk_target_list_remove".} -proc find*(list: PTargetList, target: gdk2.TAtom, info: Pguint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_target_list_find".} -proc selection_owner_set*(widget: PWidget, selection: gdk2.TAtom, time: guint32): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_owner_set".} -proc selection_owner_set_for_display*(display: gdk2.PDisplay, widget: PWidget, - selection: gdk2.TAtom, time: guint32): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_owner_set_for_display".} -proc selection_add_target*(widget: PWidget, selection: gdk2.TAtom, - target: gdk2.TAtom, info: guint){.cdecl, dynlib: lib, - importc: "gtk_selection_add_target".} -proc selection_add_targets*(widget: PWidget, selection: gdk2.TAtom, - targets: PTargetEntry, ntargets: guint){.cdecl, - dynlib: lib, importc: "gtk_selection_add_targets".} -proc selection_clear_targets*(widget: PWidget, selection: gdk2.TAtom){.cdecl, - dynlib: lib, importc: "gtk_selection_clear_targets".} -proc selection_convert*(widget: PWidget, selection: gdk2.TAtom, target: gdk2.TAtom, - time: guint32): gboolean{.cdecl, dynlib: lib, - importc: "gtk_selection_convert".} -proc set*(selection_data: PSelectionData, thetype: gdk2.TAtom, - format: gint, data: Pguchar, length: gint){.cdecl, - dynlib: lib, importc: "gtk_selection_data_set".} -proc set_text*(selection_data: PSelectionData, str: cstring, - len: gint): gboolean{.cdecl, dynlib: lib, - importc: "gtk_selection_data_set_text".} -proc get_text*(selection_data: PSelectionData): Pguchar{.cdecl, - dynlib: lib, importc: "gtk_selection_data_get_text".} -proc targets_include_text*(selection_data: PSelectionData): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_data_targets_include_text".} -proc selection_remove_all*(widget: PWidget){.cdecl, dynlib: lib, - importc: "gtk_selection_remove_all".} -proc selection_clear*(widget: PWidget, event: gdk2.PEventSelection): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_clear".} -proc selection_request*(widget: PWidget, event: gdk2.PEventSelection): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_request".} -proc selection_incr_event*(window: gdk2.PWindow, event: gdk2.PEventProperty): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_incr_event".} -proc selection_notify*(widget: PWidget, event: gdk2.PEventSelection): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_notify".} -proc selection_property_notify*(widget: PWidget, event: gdk2.PEventProperty): gboolean{. - cdecl, dynlib: lib, importc: "gtk_selection_property_notify".} -proc selection_data_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_selection_data_get_type".} -proc copy*(data: PSelectionData): PSelectionData{.cdecl, - dynlib: lib, importc: "gtk_selection_data_copy".} -proc free*(data: PSelectionData){.cdecl, dynlib: lib, - importc: "gtk_selection_data_free".} -proc TYPE_SEPARATOR_MENU_ITEM*(): GType -proc SEPARATOR_MENU_ITEM*(obj: pointer): PSeparatorMenuItem -proc SEPARATOR_MENU_ITEM_CLASS*(klass: pointer): PSeparatorMenuItemClass -proc IS_SEPARATOR_MENU_ITEM*(obj: pointer): bool -proc IS_SEPARATOR_MENU_ITEM_CLASS*(klass: pointer): bool -proc SEPARATOR_MENU_ITEM_GET_CLASS*(obj: pointer): PSeparatorMenuItemClass -proc separator_menu_item_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_separator_menu_item_get_type".} -proc separator_menu_item_new*(): PSeparatorMenuItem{.cdecl, dynlib: lib, - importc: "gtk_separator_menu_item_new".} -const - bm_TGtkSizeGroup_have_width* = 0x0001'i16 - bp_TGtkSizeGroup_have_width* = 0'i16 - bm_TGtkSizeGroup_have_height* = 0x0002'i16 - bp_TGtkSizeGroup_have_height* = 1'i16 - -proc TYPE_SIZE_GROUP*(): GType -proc SIZE_GROUP*(obj: pointer): PSizeGroup -proc SIZE_GROUP_CLASS*(klass: pointer): PSizeGroupClass -proc IS_SIZE_GROUP*(obj: pointer): bool -proc IS_SIZE_GROUP_CLASS*(klass: pointer): bool -proc SIZE_GROUP_GET_CLASS*(obj: pointer): PSizeGroupClass -proc have_width*(a: PSizeGroup): guint -proc set_have_width*(a: PSizeGroup, `have_width`: guint) -proc have_height*(a: PSizeGroup): guint -proc set_have_height*(a: PSizeGroup, `have_height`: guint) -proc size_group_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_size_group_get_type".} -proc size_group_new*(mode: TSizeGroupMode): PSizeGroup{.cdecl, dynlib: lib, - importc: "gtk_size_group_new".} -proc set_mode*(size_group: PSizeGroup, mode: TSizeGroupMode){.cdecl, - dynlib: lib, importc: "gtk_size_group_set_mode".} -proc get_mode*(size_group: PSizeGroup): TSizeGroupMode{.cdecl, - dynlib: lib, importc: "gtk_size_group_get_mode".} -proc add_widget*(size_group: PSizeGroup, widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_size_group_add_widget".} -proc remove_widget*(size_group: PSizeGroup, widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_size_group_remove_widget".} -proc size_group_get_child_requisition*(widget: PWidget, - requisition: PRequisition){.cdecl, - dynlib: lib, importc: "_gtk_size_group_get_child_requisition".} -proc size_group_compute_requisition*(widget: PWidget, requisition: PRequisition){. - cdecl, dynlib: lib, importc: "_gtk_size_group_compute_requisition".} -proc size_group_queue_resize*(widget: PWidget){.cdecl, dynlib: lib, - importc: "_gtk_size_group_queue_resize".} -const - bm_TGtkSocket_same_app* = 0x0001'i16 - bp_TGtkSocket_same_app* = 0'i16 - bm_TGtkSocket_focus_in* = 0x0002'i16 - bp_TGtkSocket_focus_in* = 1'i16 - bm_TGtkSocket_have_size* = 0x0004'i16 - bp_TGtkSocket_have_size* = 2'i16 - bm_TGtkSocket_need_map* = 0x0008'i16 - bp_TGtkSocket_need_map* = 3'i16 - bm_TGtkSocket_is_mapped* = 0x0010'i16 - bp_TGtkSocket_is_mapped* = 4'i16 - -proc TYPE_SOCKET*(): GType -proc SOCKET*(obj: pointer): PSocket -proc SOCKET_CLASS*(klass: pointer): PSocketClass -proc IS_SOCKET*(obj: pointer): bool -proc IS_SOCKET_CLASS*(klass: pointer): bool -proc SOCKET_GET_CLASS*(obj: pointer): PSocketClass -proc same_app*(a: PSocket): guint -proc set_same_app*(a: PSocket, `same_app`: guint) -proc focus_in*(a: PSocket): guint -proc set_focus_in*(a: PSocket, `focus_in`: guint) -proc have_size*(a: PSocket): guint -proc set_have_size*(a: PSocket, `have_size`: guint) -proc need_map*(a: PSocket): guint -proc set_need_map*(a: PSocket, `need_map`: guint) -proc is_mapped*(a: PSocket): guint -proc set_is_mapped*(a: PSocket, `is_mapped`: guint) -proc socket_new*(): PSocket{.cdecl, dynlib: lib, importc: "gtk_socket_new".} -proc socket_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_socket_get_type".} -proc add_id*(socket: PSocket, window_id: gdk2.TNativeWindow){.cdecl, - dynlib: lib, importc: "gtk_socket_add_id".} -proc get_id*(socket: PSocket): gdk2.TNativeWindow{.cdecl, dynlib: lib, - importc: "gtk_socket_get_id".} -const - INPUT_ERROR* = - (1) - bm_TGtkSpinButton_in_child* = 0x00000003'i32 - bp_TGtkSpinButton_in_child* = 0'i32 - bm_TGtkSpinButton_click_child* = 0x0000000C'i32 - bp_TGtkSpinButton_click_child* = 2'i32 - bm_TGtkSpinButton_button* = 0x00000030'i32 - bp_TGtkSpinButton_button* = 4'i32 - bm_TGtkSpinButton_need_timer* = 0x00000040'i32 - bp_TGtkSpinButton_need_timer* = 6'i32 - bm_TGtkSpinButton_timer_calls* = 0x00000380'i32 - bp_TGtkSpinButton_timer_calls* = 7'i32 - bm_TGtkSpinButton_digits* = 0x000FFC00'i32 - bp_TGtkSpinButton_digits* = 10'i32 - bm_TGtkSpinButton_numeric* = 0x00100000'i32 - bp_TGtkSpinButton_numeric* = 20'i32 - bm_TGtkSpinButton_wrap* = 0x00200000'i32 - bp_TGtkSpinButton_wrap* = 21'i32 - bm_TGtkSpinButton_snap_to_ticks* = 0x00400000'i32 - bp_TGtkSpinButton_snap_to_ticks* = 22'i32 - -proc TYPE_SPIN_BUTTON*(): GType -proc SPIN_BUTTON*(obj: pointer): PSpinButton -proc SPIN_BUTTON_CLASS*(klass: pointer): PSpinButtonClass -proc IS_SPIN_BUTTON*(obj: pointer): bool -proc IS_SPIN_BUTTON_CLASS*(klass: pointer): bool -proc SPIN_BUTTON_GET_CLASS*(obj: pointer): PSpinButtonClass -proc in_child*(a: PSpinButton): guint -proc set_in_child*(a: PSpinButton, `in_child`: guint) -proc click_child*(a: PSpinButton): guint -proc set_click_child*(a: PSpinButton, `click_child`: guint) -proc button*(a: PSpinButton): guint -proc set_button*(a: PSpinButton, `button`: guint) -proc need_timer*(a: PSpinButton): guint -proc set_need_timer*(a: PSpinButton, `need_timer`: guint) -proc timer_calls*(a: PSpinButton): guint -proc set_timer_calls*(a: PSpinButton, `timer_calls`: guint) -proc digits*(a: PSpinButton): guint -proc set_digits*(a: PSpinButton, `digits`: guint) -proc numeric*(a: PSpinButton): guint -proc set_numeric*(a: PSpinButton, `numeric`: guint) -proc wrap*(a: PSpinButton): guint -proc set_wrap*(a: PSpinButton, `wrap`: guint) -proc snap_to_ticks*(a: PSpinButton): guint -proc set_snap_to_ticks*(a: PSpinButton, `snap_to_ticks`: guint) -proc spin_button_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_spin_button_get_type".} -proc configure*(spin_button: PSpinButton, adjustment: PAdjustment, - climb_rate: gdouble, digits: guint){.cdecl, - dynlib: lib, importc: "gtk_spin_button_configure".} -proc spin_button_new*(adjustment: PAdjustment, climb_rate: gdouble, - digits: guint): PSpinButton{.cdecl, dynlib: lib, - importc: "gtk_spin_button_new".} -proc spin_button_new*(min: gdouble, max: gdouble, step: gdouble): PSpinButton{. - cdecl, dynlib: lib, importc: "gtk_spin_button_new_with_range".} -proc set_adjustment*(spin_button: PSpinButton, - adjustment: PAdjustment){.cdecl, dynlib: lib, - importc: "gtk_spin_button_set_adjustment".} -proc get_adjustment*(spin_button: PSpinButton): PAdjustment{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_adjustment".} -proc set_digits*(spin_button: PSpinButton, digits: guint){.cdecl, - dynlib: lib, importc: "gtk_spin_button_set_digits".} -proc get_digits*(spin_button: PSpinButton): guint{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_digits".} -proc set_increments*(spin_button: PSpinButton, step: gdouble, - page: gdouble){.cdecl, dynlib: lib, - importc: "gtk_spin_button_set_increments".} -proc get_increments*(spin_button: PSpinButton, step: Pgdouble, - page: Pgdouble){.cdecl, dynlib: lib, - importc: "gtk_spin_button_get_increments".} -proc set_range*(spin_button: PSpinButton, min: gdouble, max: gdouble){. - cdecl, dynlib: lib, importc: "gtk_spin_button_set_range".} -proc get_range*(spin_button: PSpinButton, min: Pgdouble, - max: Pgdouble){.cdecl, dynlib: lib, - importc: "gtk_spin_button_get_range".} -proc get_value*(spin_button: PSpinButton): gdouble{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_value".} -proc get_value_as_int*(spin_button: PSpinButton): gint{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_value_as_int".} -proc set_value*(spin_button: PSpinButton, value: gdouble){.cdecl, - dynlib: lib, importc: "gtk_spin_button_set_value".} -proc set_update_policy*(spin_button: PSpinButton, - policy: TSpinButtonUpdatePolicy){.cdecl, - dynlib: lib, importc: "gtk_spin_button_set_update_policy".} -proc get_update_policy*(spin_button: PSpinButton): TSpinButtonUpdatePolicy{. - cdecl, dynlib: lib, importc: "gtk_spin_button_get_update_policy".} -proc set_numeric*(spin_button: PSpinButton, numeric: gboolean){. - cdecl, dynlib: lib, importc: "gtk_spin_button_set_numeric".} -proc get_numeric*(spin_button: PSpinButton): gboolean{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_numeric".} -proc spin*(spin_button: PSpinButton, direction: TSpinType, - increment: gdouble){.cdecl, dynlib: lib, - importc: "gtk_spin_button_spin".} -proc set_wrap*(spin_button: PSpinButton, wrap: gboolean){.cdecl, - dynlib: lib, importc: "gtk_spin_button_set_wrap".} -proc get_wrap*(spin_button: PSpinButton): gboolean{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_wrap".} -proc set_snap_to_ticks*(spin_button: PSpinButton, - snap_to_ticks: gboolean){.cdecl, - dynlib: lib, importc: "gtk_spin_button_set_snap_to_ticks".} -proc get_snap_to_ticks*(spin_button: PSpinButton): gboolean{.cdecl, - dynlib: lib, importc: "gtk_spin_button_get_snap_to_ticks".} -proc update*(spin_button: PSpinButton){.cdecl, dynlib: lib, - importc: "gtk_spin_button_update".} -const - STOCK_DIALOG_INFO* = "gtk-dialog-info" - STOCK_DIALOG_WARNING* = "gtk-dialog-warning" - STOCK_DIALOG_ERROR* = "gtk-dialog-error" - STOCK_DIALOG_QUESTION* = "gtk-dialog-question" - STOCK_DND* = "gtk-dnd" - STOCK_DND_MULTIPLE* = "gtk-dnd-multiple" - STOCK_ABOUT* = "gtk-about" - STOCK_ADD_name* = "gtk-add" - STOCK_APPLY* = "gtk-apply" - STOCK_BOLD* = "gtk-bold" - STOCK_CANCEL* = "gtk-cancel" - STOCK_CDROM* = "gtk-cdrom" - STOCK_CLEAR* = "gtk-clear" - STOCK_CLOSE* = "gtk-close" - STOCK_COLOR_PICKER* = "gtk-color-picker" - STOCK_CONVERT* = "gtk-convert" - STOCK_CONNECT* = "gtk-connect" - STOCK_COPY* = "gtk-copy" - STOCK_CUT* = "gtk-cut" - STOCK_DELETE* = "gtk-delete" - STOCK_EDIT* = "gtk-edit" - STOCK_EXECUTE* = "gtk-execute" - STOCK_FIND* = "gtk-find" - STOCK_FIND_AND_REPLACE* = "gtk-find-and-replace" - STOCK_FLOPPY* = "gtk-floppy" - STOCK_GOTO_BOTTOM* = "gtk-goto-bottom" - STOCK_GOTO_FIRST* = "gtk-goto-first" - STOCK_GOTO_LAST* = "gtk-goto-last" - STOCK_GOTO_TOP* = "gtk-goto-top" - STOCK_GO_BACK* = "gtk-go-back" - STOCK_GO_DOWN* = "gtk-go-down" - STOCK_GO_FORWARD* = "gtk-go-forward" - STOCK_GO_UP* = "gtk-go-up" - STOCK_HELP* = "gtk-help" - STOCK_HOME* = "gtk-home" - STOCK_INDEX* = "gtk-index" - STOCK_ITALIC* = "gtk-italic" - STOCK_JUMP_TO* = "gtk-jump-to" - STOCK_JUSTIFY_CENTER* = "gtk-justify-center" - STOCK_JUSTIFY_FILL* = "gtk-justify-fill" - STOCK_JUSTIFY_LEFT* = "gtk-justify-left" - STOCK_JUSTIFY_RIGHT* = "gtk-justify-right" - STOCK_MEDIA_FORWARD* = "gtk-media-forward" - STOCK_MEDIA_NEXT* = "gtk-media-next" - STOCK_MEDIA_PAUSE* = "gtk-media-pause" - STOCK_MEDIA_PLAY* = "gtk-media-play" - STOCK_MEDIA_PREVIOUS* = "gtk-media-previous" - STOCK_MEDIA_RECORD* = "gtk-media-record" - STOCK_MEDIA_REWIND* = "gtk-media-rewind" - STOCK_MEDIA_STOP* = "gtk-media-stop" - STOCK_MISSING_IMAGE* = "gtk-missing-image" - STOCK_NEW* = "gtk-new" - STOCK_NO* = "gtk-no" - STOCK_OK* = "gtk-ok" - STOCK_OPEN* = "gtk-open" - STOCK_PASTE* = "gtk-paste" - STOCK_PREFERENCES* = "gtk-preferences" - STOCK_PRINT* = "gtk-print" - STOCK_PRINT_PREVIEW* = "gtk-print-preview" - STOCK_PROPERTIES* = "gtk-properties" - STOCK_QUIT* = "gtk-quit" - STOCK_REDO* = "gtk-redo" - STOCK_REFRESH* = "gtk-refresh" - STOCK_REMOVE* = "gtk-remove" - STOCK_REVERT_TO_SAVED* = "gtk-revert-to-saved" - STOCK_SAVE* = "gtk-save" - STOCK_SAVE_AS* = "gtk-save-as" - STOCK_SELECT_COLOR* = "gtk-select-color" - STOCK_SELECT_FONT* = "gtk-select-font" - STOCK_SORT_ASCENDING* = "gtk-sort-ascending" - STOCK_SORT_DESCENDING* = "gtk-sort-descending" - STOCK_SPELL_CHECK* = "gtk-spell-check" - STOCK_STOP* = "gtk-stop" - STOCK_STRIKETHROUGH* = "gtk-strikethrough" - STOCK_UNDELETE* = "gtk-undelete" - STOCK_UNDERLINE* = "gtk-underline" - STOCK_UNDO* = "gtk-undo" - STOCK_YES* = "gtk-yes" - STOCK_ZOOM_100* = "gtk-zoom-100" - STOCK_ZOOM_FIT* = "gtk-zoom-fit" - STOCK_ZOOM_IN* = "gtk-zoom-in" - STOCK_ZOOM_OUT* = "gtk-zoom-out" - -proc add*(items: PStockItem, n_items: guint){.cdecl, dynlib: lib, - importc: "gtk_stock_add".} -proc add_static*(items: PStockItem, n_items: guint){.cdecl, dynlib: lib, - importc: "gtk_stock_add_static".} -proc stock_lookup*(stock_id: cstring, item: PStockItem): gboolean{.cdecl, - dynlib: lib, importc: "gtk_stock_lookup".} -proc stock_list_ids*(): PGSList{.cdecl, dynlib: lib, - importc: "gtk_stock_list_ids".} -proc copy*(item: PStockItem): PStockItem{.cdecl, dynlib: lib, - importc: "gtk_stock_item_copy".} -proc free*(item: PStockItem){.cdecl, dynlib: lib, - importc: "gtk_stock_item_free".} -proc TYPE_STATUSBAR*(): GType -proc STATUSBAR*(obj: pointer): PStatusbar -proc STATUSBAR_CLASS*(klass: pointer): PStatusbarClass -proc IS_STATUSBAR*(obj: pointer): bool -proc IS_STATUSBAR_CLASS*(klass: pointer): bool -proc STATUSBAR_GET_CLASS*(obj: pointer): PStatusbarClass -const - bm_TGtkStatusbar_has_resize_grip* = 0x0001'i16 - bp_TGtkStatusbar_has_resize_grip* = 0'i16 - -proc has_resize_grip*(a: PStatusbar): guint -proc set_has_resize_grip*(a: PStatusbar, `has_resize_grip`: guint) -proc statusbar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_statusbar_get_type".} -proc statusbar_new*(): PStatusbar{.cdecl, dynlib: lib, - importc: "gtk_statusbar_new".} -proc get_context_id*(statusbar: PStatusbar, - context_description: cstring): guint{.cdecl, - dynlib: lib, importc: "gtk_statusbar_get_context_id".} -proc push*(statusbar: PStatusbar, context_id: guint, text: cstring): guint{. - cdecl, dynlib: lib, importc: "gtk_statusbar_push".} -proc pop*(statusbar: PStatusbar, context_id: guint){.cdecl, - dynlib: lib, importc: "gtk_statusbar_pop".} -proc remove*(statusbar: PStatusbar, context_id: guint, - message_id: guint){.cdecl, dynlib: lib, - importc: "gtk_statusbar_remove".} -proc set_has_resize_grip*(statusbar: PStatusbar, setting: gboolean){. - cdecl, dynlib: lib, importc: "gtk_statusbar_set_has_resize_grip".} -proc get_has_resize_grip*(statusbar: PStatusbar): gboolean{.cdecl, - dynlib: lib, importc: "gtk_statusbar_get_has_resize_grip".} -const - bm_TGtkTable_homogeneous* = 0x0001'i16 - bp_TGtkTable_homogeneous* = 0'i16 - bm_TGtkTableChild_xexpand* = 0x0001'i16 - bp_TGtkTableChild_xexpand* = 0'i16 - bm_TGtkTableChild_yexpand* = 0x0002'i16 - bp_TGtkTableChild_yexpand* = 1'i16 - bm_TGtkTableChild_xshrink* = 0x0004'i16 - bp_TGtkTableChild_xshrink* = 2'i16 - bm_TGtkTableChild_yshrink* = 0x0008'i16 - bp_TGtkTableChild_yshrink* = 3'i16 - bm_TGtkTableChild_xfill* = 0x0010'i16 - bp_TGtkTableChild_xfill* = 4'i16 - bm_TGtkTableChild_yfill* = 0x0020'i16 - bp_TGtkTableChild_yfill* = 5'i16 - bm_TGtkTableRowCol_need_expand* = 0x0001'i16 - bp_TGtkTableRowCol_need_expand* = 0'i16 - bm_TGtkTableRowCol_need_shrink* = 0x0002'i16 - bp_TGtkTableRowCol_need_shrink* = 1'i16 - bm_TGtkTableRowCol_expand* = 0x0004'i16 - bp_TGtkTableRowCol_expand* = 2'i16 - bm_TGtkTableRowCol_shrink* = 0x0008'i16 - bp_TGtkTableRowCol_shrink* = 3'i16 - bm_TGtkTableRowCol_empty* = 0x0010'i16 - bp_TGtkTableRowCol_empty* = 4'i16 - -proc TYPE_TABLE*(): GType -proc TABLE*(obj: pointer): PTable -proc TABLE_CLASS*(klass: pointer): PTableClass -proc IS_TABLE*(obj: pointer): bool -proc IS_TABLE_CLASS*(klass: pointer): bool -proc TABLE_GET_CLASS*(obj: pointer): PTableClass -proc homogeneous*(a: PTable): guint -proc set_homogeneous*(a: PTable, `homogeneous`: guint) -proc xexpand*(a: PTableChild): guint -proc set_xexpand*(a: PTableChild, `xexpand`: guint) -proc yexpand*(a: PTableChild): guint -proc set_yexpand*(a: PTableChild, `yexpand`: guint) -proc xshrink*(a: PTableChild): guint -proc set_xshrink*(a: PTableChild, `xshrink`: guint) -proc yshrink*(a: PTableChild): guint -proc set_yshrink*(a: PTableChild, `yshrink`: guint) -proc xfill*(a: PTableChild): guint -proc set_xfill*(a: PTableChild, `xfill`: guint) -proc yfill*(a: PTableChild): guint -proc set_yfill*(a: PTableChild, `yfill`: guint) -proc need_expand*(a: PTableRowCol): guint -proc set_need_expand*(a: PTableRowCol, `need_expand`: guint) -proc need_shrink*(a: PTableRowCol): guint -proc set_need_shrink*(a: PTableRowCol, `need_shrink`: guint) -proc expand*(a: PTableRowCol): guint -proc set_expand*(a: PTableRowCol, `expand`: guint) -proc shrink*(a: PTableRowCol): guint -proc set_shrink*(a: PTableRowCol, `shrink`: guint) -proc empty*(a: PTableRowCol): guint -proc set_empty*(a: PTableRowCol, `empty`: guint) -proc table_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_table_get_type".} -proc table_new*(rows: guint, columns: guint, homogeneous: gboolean): PTable{. - cdecl, dynlib: lib, importc: "gtk_table_new".} -proc resize*(table: PTable, rows: guint, columns: guint){.cdecl, - dynlib: lib, importc: "gtk_table_resize".} -proc attach*(table: PTable, child: PWidget, left_attach: guint, - right_attach: guint, top_attach: guint, bottom_attach: guint, - xoptions: TAttachOptions, yoptions: TAttachOptions, - xpadding: guint, ypadding: guint){.cdecl, dynlib: lib, - importc: "gtk_table_attach".} -proc attach_defaults*(table: PTable, widget: PWidget, left_attach: guint, - right_attach: guint, top_attach: guint, - bottom_attach: guint){.cdecl, dynlib: lib, - importc: "gtk_table_attach_defaults".} -proc set_row_spacing*(table: PTable, row: guint, spacing: guint){.cdecl, - dynlib: lib, importc: "gtk_table_set_row_spacing".} -proc get_row_spacing*(table: PTable, row: guint): guint{.cdecl, - dynlib: lib, importc: "gtk_table_get_row_spacing".} -proc set_col_spacing*(table: PTable, column: guint, spacing: guint){. - cdecl, dynlib: lib, importc: "gtk_table_set_col_spacing".} -proc get_col_spacing*(table: PTable, column: guint): guint{.cdecl, - dynlib: lib, importc: "gtk_table_get_col_spacing".} -proc set_row_spacings*(table: PTable, spacing: guint){.cdecl, dynlib: lib, - importc: "gtk_table_set_row_spacings".} -proc get_default_row_spacing*(table: PTable): guint{.cdecl, dynlib: lib, - importc: "gtk_table_get_default_row_spacing".} -proc set_col_spacings*(table: PTable, spacing: guint){.cdecl, dynlib: lib, - importc: "gtk_table_set_col_spacings".} -proc get_default_col_spacing*(table: PTable): guint{.cdecl, dynlib: lib, - importc: "gtk_table_get_default_col_spacing".} -proc set_homogeneous*(table: PTable, homogeneous: gboolean){.cdecl, - dynlib: lib, importc: "gtk_table_set_homogeneous".} -proc get_homogeneous*(table: PTable): gboolean{.cdecl, dynlib: lib, - importc: "gtk_table_get_homogeneous".} -const - bm_TGtkTearoffMenuItem_torn_off* = 0x0001'i16 - bp_TGtkTearoffMenuItem_torn_off* = 0'i16 - -proc TYPE_TEAROFF_MENU_ITEM*(): GType -proc TEAROFF_MENU_ITEM*(obj: pointer): PTearoffMenuItem -proc TEAROFF_MENU_ITEM_CLASS*(klass: pointer): PTearoffMenuItemClass -proc IS_TEAROFF_MENU_ITEM*(obj: pointer): bool -proc IS_TEAROFF_MENU_ITEM_CLASS*(klass: pointer): bool -proc TEAROFF_MENU_ITEM_GET_CLASS*(obj: pointer): PTearoffMenuItemClass -proc torn_off*(a: PTearoffMenuItem): guint -proc set_torn_off*(a: PTearoffMenuItem, `torn_off`: guint) -proc tearoff_menu_item_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tearoff_menu_item_get_type".} -proc tearoff_menu_item_new*(): PTearoffMenuItem{.cdecl, dynlib: lib, - importc: "gtk_tearoff_menu_item_new".} -const - bm_TGtkText_line_wrap* = 0x0001'i16 - bp_TGtkText_line_wrap* = 0'i16 - bm_TGtkText_word_wrap* = 0x0002'i16 - bp_TGtkText_word_wrap* = 1'i16 - bm_TGtkText_use_wchar* = 0x0004'i16 - bp_TGtkText_use_wchar* = 2'i16 - -proc TYPE_TEXT*(): GType -proc TEXT*(obj: pointer): PText -proc TEXT_CLASS*(klass: pointer): PTextClass -proc IS_TEXT*(obj: pointer): bool -proc IS_TEXT_CLASS*(klass: pointer): bool -proc TEXT_GET_CLASS*(obj: pointer): PTextClass -proc line_wrap*(a: PText): guint -proc set_line_wrap*(a: PText, `line_wrap`: guint) -proc word_wrap*(a: PText): guint -proc set_word_wrap*(a: PText, `word_wrap`: guint) -proc use_wchar*(a: PText): gboolean -proc set_use_wchar*(a: PText, `use_wchar`: gboolean) -proc text_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_text_get_type".} -proc text_new*(hadj: PAdjustment, vadj: PAdjustment): PText{.cdecl, dynlib: lib, - importc: "gtk_text_new".} -proc set_editable*(text: PText, editable: gboolean){.cdecl, dynlib: lib, - importc: "gtk_text_set_editable".} -proc set_word_wrap*(text: PText, word_wrap: gboolean){.cdecl, dynlib: lib, - importc: "gtk_text_set_word_wrap".} -proc set_line_wrap*(text: PText, line_wrap: gboolean){.cdecl, dynlib: lib, - importc: "gtk_text_set_line_wrap".} -proc set_adjustments*(text: PText, hadj: PAdjustment, vadj: PAdjustment){. - cdecl, dynlib: lib, importc: "gtk_text_set_adjustments".} -proc set_point*(text: PText, index: guint){.cdecl, dynlib: lib, - importc: "gtk_text_set_point".} -proc get_point*(text: PText): guint{.cdecl, dynlib: lib, - importc: "gtk_text_get_point".} -proc get_length*(text: PText): guint{.cdecl, dynlib: lib, - importc: "gtk_text_get_length".} -proc freeze*(text: PText){.cdecl, dynlib: lib, importc: "gtk_text_freeze".} -proc thaw*(text: PText){.cdecl, dynlib: lib, importc: "gtk_text_thaw".} -proc insert*(text: PText, font: gdk2.PFont, fore: gdk2.PColor, back: gdk2.PColor, - chars: cstring, length: gint){.cdecl, dynlib: lib, - importc: "gtk_text_insert".} -proc backward_delete*(text: PText, nchars: guint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_backward_delete".} -proc forward_delete*(text: PText, nchars: guint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_forward_delete".} -proc INDEX_WCHAR*(t: PText, index: guint): guint32 -proc INDEX_UCHAR*(t: PText, index: guint): GUChar -const - TEXT_SEARCH_VISIBLE_ONLY* = 0 - TEXT_SEARCH_TEXT_ONLY* = 1 - -proc TYPE_TEXT_ITER*(): GType -proc get_buffer*(iter: PTextIter): PTextBuffer{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_buffer".} -proc copy*(iter: PTextIter): PTextIter{.cdecl, dynlib: lib, - importc: "gtk_text_iter_copy".} -proc free*(iter: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_iter_free".} -proc text_iter_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_type".} -proc get_offset*(iter: PTextIter): gint{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_offset".} -proc get_line*(iter: PTextIter): gint{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_line".} -proc get_line_offset*(iter: PTextIter): gint{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_line_offset".} -proc get_line_index*(iter: PTextIter): gint{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_line_index".} -proc get_visible_line_offset*(iter: PTextIter): gint{.cdecl, - dynlib: lib, importc: "gtk_text_iter_get_visible_line_offset".} -proc get_visible_line_index*(iter: PTextIter): gint{.cdecl, - dynlib: lib, importc: "gtk_text_iter_get_visible_line_index".} -proc get_char*(iter: PTextIter): gunichar{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_char".} -proc get_slice*(start: PTextIter, theEnd: PTextIter): cstring{.cdecl, - dynlib: lib, importc: "gtk_text_iter_get_slice".} -proc get_text*(start: PTextIter, theEnd: PTextIter): cstring{.cdecl, - dynlib: lib, importc: "gtk_text_iter_get_text".} -proc get_visible_slice*(start: PTextIter, theEnd: PTextIter): cstring{. - cdecl, dynlib: lib, importc: "gtk_text_iter_get_visible_slice".} -proc get_visible_text*(start: PTextIter, theEnd: PTextIter): cstring{. - cdecl, dynlib: lib, importc: "gtk_text_iter_get_visible_text".} -proc get_pixbuf*(iter: PTextIter): gdk2pixbuf.PPixbuf{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_pixbuf".} -proc get_marks*(iter: PTextIter): PGSList{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_marks".} -proc get_child_anchor*(iter: PTextIter): PTextChildAnchor{.cdecl, - dynlib: lib, importc: "gtk_text_iter_get_child_anchor".} -proc get_toggled_tags*(iter: PTextIter, toggled_on: gboolean): PGSList{. - cdecl, dynlib: lib, importc: "gtk_text_iter_get_toggled_tags".} -proc begins_tag*(iter: PTextIter, tag: PTextTag): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_begins_tag".} -proc ends_tag*(iter: PTextIter, tag: PTextTag): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_ends_tag".} -proc toggles_tag*(iter: PTextIter, tag: PTextTag): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_toggles_tag".} -proc has_tag*(iter: PTextIter, tag: PTextTag): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_has_tag".} -proc get_tags*(iter: PTextIter): PGSList{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_tags".} -proc editable*(iter: PTextIter, default_setting: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_editable".} -proc can_insert*(iter: PTextIter, default_editability: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_can_insert".} -proc starts_word*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_starts_word".} -proc ends_word*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_ends_word".} -proc inside_word*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_inside_word".} -proc starts_sentence*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_starts_sentence".} -proc ends_sentence*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_ends_sentence".} -proc inside_sentence*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_inside_sentence".} -proc starts_line*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_starts_line".} -proc ends_line*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_ends_line".} -proc is_cursor_position*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_is_cursor_position".} -proc get_chars_in_line*(iter: PTextIter): gint{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_chars_in_line".} -proc get_bytes_in_line*(iter: PTextIter): gint{.cdecl, dynlib: lib, - importc: "gtk_text_iter_get_bytes_in_line".} -proc get_attributes*(iter: PTextIter, values: PTextAttributes): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_get_attributes".} -proc get_language*(iter: PTextIter): pango.PLanguage{.cdecl, - dynlib: lib, importc: "gtk_text_iter_get_language".} -proc is_end*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_is_end".} -proc is_start*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_is_start".} -proc forward_char*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_forward_char".} -proc backward_char*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_backward_char".} -proc forward_chars*(iter: PTextIter, count: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_forward_chars".} -proc backward_chars*(iter: PTextIter, count: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_backward_chars".} -proc forward_line*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_forward_line".} -proc backward_line*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_backward_line".} -proc forward_lines*(iter: PTextIter, count: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_forward_lines".} -proc backward_lines*(iter: PTextIter, count: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_backward_lines".} -proc forward_word_end*(iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_iter_forward_word_end".} -proc backward_word_start*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_backward_word_start".} -proc forward_word_ends*(iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_forward_word_ends".} -proc backward_word_starts*(iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_backward_word_starts".} -proc forward_sentence_end*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_forward_sentence_end".} -proc backward_sentence_start*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_backward_sentence_start".} -proc forward_sentence_ends*(iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_forward_sentence_ends".} -proc backward_sentence_starts*(iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_backward_sentence_starts".} -proc forward_cursor_position*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_forward_cursor_position".} -proc backward_cursor_position*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_backward_cursor_position".} -proc forward_cursor_positions*(iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_forward_cursor_positions".} -proc backward_cursor_positions*(iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_backward_cursor_positions".} -proc set_offset*(iter: PTextIter, char_offset: gint){.cdecl, - dynlib: lib, importc: "gtk_text_iter_set_offset".} -proc set_line*(iter: PTextIter, line_number: gint){.cdecl, - dynlib: lib, importc: "gtk_text_iter_set_line".} -proc set_line_offset*(iter: PTextIter, char_on_line: gint){.cdecl, - dynlib: lib, importc: "gtk_text_iter_set_line_offset".} -proc set_line_index*(iter: PTextIter, byte_on_line: gint){.cdecl, - dynlib: lib, importc: "gtk_text_iter_set_line_index".} -proc forward_to_end*(iter: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_iter_forward_to_end".} -proc forward_to_line_end*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_forward_to_line_end".} -proc set_visible_line_offset*(iter: PTextIter, char_on_line: gint){. - cdecl, dynlib: lib, importc: "gtk_text_iter_set_visible_line_offset".} -proc set_visible_line_index*(iter: PTextIter, byte_on_line: gint){. - cdecl, dynlib: lib, importc: "gtk_text_iter_set_visible_line_index".} -proc forward_to_tag_toggle*(iter: PTextIter, tag: PTextTag): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_forward_to_tag_toggle".} -proc backward_to_tag_toggle*(iter: PTextIter, tag: PTextTag): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_backward_to_tag_toggle".} -proc forward_find_char*(iter: PTextIter, pred: TTextCharPredicate, - user_data: gpointer, limit: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_forward_find_char".} -proc backward_find_char*(iter: PTextIter, pred: TTextCharPredicate, - user_data: gpointer, limit: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_backward_find_char".} -proc forward_search*(iter: PTextIter, str: cstring, - flags: TTextSearchFlags, match_start: PTextIter, - match_end: PTextIter, limit: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_forward_search".} -proc backward_search*(iter: PTextIter, str: cstring, - flags: TTextSearchFlags, match_start: PTextIter, - match_end: PTextIter, limit: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_backward_search".} -proc equal*(lhs: PTextIter, rhs: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_iter_equal".} -proc compare*(lhs: PTextIter, rhs: PTextIter): gint{.cdecl, - dynlib: lib, importc: "gtk_text_iter_compare".} -proc in_range*(iter: PTextIter, start: PTextIter, theEnd: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_iter_in_range".} -proc order*(first: PTextIter, second: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_iter_order".} -proc TYPE_TEXT_TAG*(): GType -proc TEXT_TAG*(obj: pointer): PTextTag -proc TEXT_TAG_CLASS*(klass: pointer): PTextTagClass -proc IS_TEXT_TAG*(obj: pointer): bool -proc IS_TEXT_TAG_CLASS*(klass: pointer): bool -proc TEXT_TAG_GET_CLASS*(obj: pointer): PTextTagClass -proc TYPE_TEXT_ATTRIBUTES*(): GType -proc text_tag_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_tag_get_type".} -proc text_tag_new*(name: cstring): PTextTag{.cdecl, dynlib: lib, - importc: "gtk_text_tag_new".} -proc get_priority*(tag: PTextTag): gint{.cdecl, dynlib: lib, - importc: "gtk_text_tag_get_priority".} -proc set_priority*(tag: PTextTag, priority: gint){.cdecl, dynlib: lib, - importc: "gtk_text_tag_set_priority".} -proc event*(tag: PTextTag, event_object: PGObject, event: gdk2.PEvent, - iter: PTextIter): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_tag_event".} -proc text_attributes_new*(): PTextAttributes{.cdecl, dynlib: lib, - importc: "gtk_text_attributes_new".} -proc copy*(src: PTextAttributes): PTextAttributes{.cdecl, - dynlib: lib, importc: "gtk_text_attributes_copy".} -proc copy_values*(src: PTextAttributes, dest: PTextAttributes){. - cdecl, dynlib: lib, importc: "gtk_text_attributes_copy_values".} -proc unref*(values: PTextAttributes){.cdecl, dynlib: lib, - importc: "gtk_text_attributes_unref".} -proc reference*(values: PTextAttributes){.cdecl, dynlib: lib, - importc: "gtk_text_attributes_ref".} -proc text_attributes_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_attributes_get_type".} -const - bm_TGtkTextTag_bg_color_set* = 0x00000001'i32 - bp_TGtkTextTag_bg_color_set* = 0'i32 - bm_TGtkTextTag_bg_stipple_set* = 0x00000002'i32 - bp_TGtkTextTag_bg_stipple_set* = 1'i32 - bm_TGtkTextTag_fg_color_set* = 0x00000004'i32 - bp_TGtkTextTag_fg_color_set* = 2'i32 - bm_TGtkTextTag_scale_set* = 0x00000008'i32 - bp_TGtkTextTag_scale_set* = 3'i32 - bm_TGtkTextTag_fg_stipple_set* = 0x00000010'i32 - bp_TGtkTextTag_fg_stipple_set* = 4'i32 - bm_TGtkTextTag_justification_set* = 0x00000020'i32 - bp_TGtkTextTag_justification_set* = 5'i32 - bm_TGtkTextTag_left_margin_set* = 0x00000040'i32 - bp_TGtkTextTag_left_margin_set* = 6'i32 - bm_TGtkTextTag_indent_set* = 0x00000080'i32 - bp_TGtkTextTag_indent_set* = 7'i32 - bm_TGtkTextTag_rise_set* = 0x00000100'i32 - bp_TGtkTextTag_rise_set* = 8'i32 - bm_TGtkTextTag_strikethrough_set* = 0x00000200'i32 - bp_TGtkTextTag_strikethrough_set* = 9'i32 - bm_TGtkTextTag_right_margin_set* = 0x00000400'i32 - bp_TGtkTextTag_right_margin_set* = 10'i32 - bm_TGtkTextTag_pixels_above_lines_set* = 0x00000800'i32 - bp_TGtkTextTag_pixels_above_lines_set* = 11'i32 - bm_TGtkTextTag_pixels_below_lines_set* = 0x00001000'i32 - bp_TGtkTextTag_pixels_below_lines_set* = 12'i32 - bm_TGtkTextTag_pixels_inside_wrap_set* = 0x00002000'i32 - bp_TGtkTextTag_pixels_inside_wrap_set* = 13'i32 - bm_TGtkTextTag_tabs_set* = 0x00004000'i32 - bp_TGtkTextTag_tabs_set* = 14'i32 - bm_TGtkTextTag_underline_set* = 0x00008000'i32 - bp_TGtkTextTag_underline_set* = 15'i32 - bm_TGtkTextTag_wrap_mode_set* = 0x00010000'i32 - bp_TGtkTextTag_wrap_mode_set* = 16'i32 - bm_TGtkTextTag_bg_full_height_set* = 0x00020000'i32 - bp_TGtkTextTag_bg_full_height_set* = 17'i32 - bm_TGtkTextTag_invisible_set* = 0x00040000'i32 - bp_TGtkTextTag_invisible_set* = 18'i32 - bm_TGtkTextTag_editable_set* = 0x00080000'i32 - bp_TGtkTextTag_editable_set* = 19'i32 - bm_TGtkTextTag_language_set* = 0x00100000'i32 - bp_TGtkTextTag_language_set* = 20'i32 - bm_TGtkTextTag_pad1* = 0x00200000'i32 - bp_TGtkTextTag_pad1* = 21'i32 - bm_TGtkTextTag_pad2* = 0x00400000'i32 - bp_TGtkTextTag_pad2* = 22'i32 - bm_TGtkTextTag_pad3* = 0x00800000'i32 - bp_TGtkTextTag_pad3* = 23'i32 - -proc bg_color_set*(a: PTextTag): guint -proc set_bg_color_set*(a: PTextTag, `bg_color_set`: guint) -proc bg_stipple_set*(a: PTextTag): guint -proc set_bg_stipple_set*(a: PTextTag, `bg_stipple_set`: guint) -proc fg_color_set*(a: PTextTag): guint -proc set_fg_color_set*(a: PTextTag, `fg_color_set`: guint) -proc scale_set*(a: PTextTag): guint -proc set_scale_set*(a: PTextTag, `scale_set`: guint) -proc fg_stipple_set*(a: PTextTag): guint -proc set_fg_stipple_set*(a: PTextTag, `fg_stipple_set`: guint) -proc justification_set*(a: PTextTag): guint -proc set_justification_set*(a: PTextTag, `justification_set`: guint) -proc left_margin_set*(a: PTextTag): guint -proc set_left_margin_set*(a: PTextTag, `left_margin_set`: guint) -proc indent_set*(a: PTextTag): guint -proc set_indent_set*(a: PTextTag, `indent_set`: guint) -proc rise_set*(a: PTextTag): guint -proc set_rise_set*(a: PTextTag, `rise_set`: guint) -proc strikethrough_set*(a: PTextTag): guint -proc set_strikethrough_set*(a: PTextTag, `strikethrough_set`: guint) -proc right_margin_set*(a: PTextTag): guint -proc set_right_margin_set*(a: PTextTag, `right_margin_set`: guint) -proc pixels_above_lines_set*(a: PTextTag): guint -proc set_pixels_above_lines_set*(a: PTextTag, - `pixels_above_lines_set`: guint) -proc pixels_below_lines_set*(a: PTextTag): guint -proc set_pixels_below_lines_set*(a: PTextTag, - `pixels_below_lines_set`: guint) -proc pixels_inside_wrap_set*(a: PTextTag): guint -proc set_pixels_inside_wrap_set*(a: PTextTag, - `pixels_inside_wrap_set`: guint) -proc tabs_set*(a: PTextTag): guint -proc set_tabs_set*(a: PTextTag, `tabs_set`: guint) -proc underline_set*(a: PTextTag): guint -proc set_underline_set*(a: PTextTag, `underline_set`: guint) -proc wrap_mode_set*(a: PTextTag): guint -proc set_wrap_mode_set*(a: PTextTag, `wrap_mode_set`: guint) -proc bg_full_height_set*(a: PTextTag): guint -proc set_bg_full_height_set*(a: PTextTag, `bg_full_height_set`: guint) -proc invisible_set*(a: PTextTag): guint -proc set_invisible_set*(a: PTextTag, `invisible_set`: guint) -proc editable_set*(a: PTextTag): guint -proc set_editable_set*(a: PTextTag, `editable_set`: guint) -proc language_set*(a: PTextTag): guint -proc set_language_set*(a: PTextTag, `language_set`: guint) -proc pad1*(a: PTextTag): guint -proc set_pad1*(a: PTextTag, `pad1`: guint) -proc pad2*(a: PTextTag): guint -proc set_pad2*(a: PTextTag, `pad2`: guint) -proc pad3*(a: PTextTag): guint -proc set_pad3*(a: PTextTag, `pad3`: guint) -const - bm_TGtkTextAppearance_underline* = 0x000F'i16 - bp_TGtkTextAppearance_underline* = 0'i16 - bm_TGtkTextAppearance_strikethrough* = 0x0010'i16 - bp_TGtkTextAppearance_strikethrough* = 4'i16 - bm_TGtkTextAppearance_draw_bg* = 0x0020'i16 - bp_TGtkTextAppearance_draw_bg* = 5'i16 - bm_TGtkTextAppearance_inside_selection* = 0x0040'i16 - bp_TGtkTextAppearance_inside_selection* = 6'i16 - bm_TGtkTextAppearance_is_text* = 0x0080'i16 - bp_TGtkTextAppearance_is_text* = 7'i16 - bm_TGtkTextAppearance_pad1* = 0x0100'i16 - bp_TGtkTextAppearance_pad1* = 8'i16 - bm_TGtkTextAppearance_pad2* = 0x0200'i16 - bp_TGtkTextAppearance_pad2* = 9'i16 - bm_TGtkTextAppearance_pad3* = 0x0400'i16 - bp_TGtkTextAppearance_pad3* = 10'i16 - bm_TGtkTextAppearance_pad4* = 0x0800'i16 - bp_TGtkTextAppearance_pad4* = 11'i16 - -proc underline*(a: PTextAppearance): guint -proc set_underline*(a: PTextAppearance, `underline`: guint) -proc strikethrough*(a: PTextAppearance): guint -proc set_strikethrough*(a: PTextAppearance, `strikethrough`: guint) -proc draw_bg*(a: PTextAppearance): guint -proc set_draw_bg*(a: PTextAppearance, `draw_bg`: guint) -proc inside_selection*(a: PTextAppearance): guint -proc set_inside_selection*(a: PTextAppearance, `inside_selection`: guint) -proc is_text*(a: PTextAppearance): guint -proc set_is_text*(a: PTextAppearance, `is_text`: guint) -proc pad1*(a: PTextAppearance): guint -proc set_pad1*(a: PTextAppearance, `pad1`: guint) -proc pad2*(a: PTextAppearance): guint -proc set_pad2*(a: PTextAppearance, `pad2`: guint) -proc pad3*(a: PTextAppearance): guint -proc set_pad3*(a: PTextAppearance, `pad3`: guint) -proc pad4*(a: PTextAppearance): guint -proc set_pad4*(a: PTextAppearance, `pad4`: guint) -const - bm_TGtkTextAttributes_invisible* = 0x0001'i16 - bp_TGtkTextAttributes_invisible* = 0'i16 - bm_TGtkTextAttributes_bg_full_height* = 0x0002'i16 - bp_TGtkTextAttributes_bg_full_height* = 1'i16 - bm_TGtkTextAttributes_editable* = 0x0004'i16 - bp_TGtkTextAttributes_editable* = 2'i16 - bm_TGtkTextAttributes_realized* = 0x0008'i16 - bp_TGtkTextAttributes_realized* = 3'i16 - bm_TGtkTextAttributes_pad1* = 0x0010'i16 - bp_TGtkTextAttributes_pad1* = 4'i16 - bm_TGtkTextAttributes_pad2* = 0x0020'i16 - bp_TGtkTextAttributes_pad2* = 5'i16 - bm_TGtkTextAttributes_pad3* = 0x0040'i16 - bp_TGtkTextAttributes_pad3* = 6'i16 - bm_TGtkTextAttributes_pad4* = 0x0080'i16 - bp_TGtkTextAttributes_pad4* = 7'i16 - -proc invisible*(a: PTextAttributes): guint -proc set_invisible*(a: PTextAttributes, `invisible`: guint) -proc bg_full_height*(a: PTextAttributes): guint -proc set_bg_full_height*(a: PTextAttributes, `bg_full_height`: guint) -proc editable*(a: PTextAttributes): guint -proc set_editable*(a: PTextAttributes, `editable`: guint) -proc realized*(a: PTextAttributes): guint -proc set_realized*(a: PTextAttributes, `realized`: guint) -proc pad1*(a: PTextAttributes): guint -proc set_pad1*(a: PTextAttributes, `pad1`: guint) -proc pad2*(a: PTextAttributes): guint -proc set_pad2*(a: PTextAttributes, `pad2`: guint) -proc pad3*(a: PTextAttributes): guint -proc set_pad3*(a: PTextAttributes, `pad3`: guint) -proc pad4*(a: PTextAttributes): guint -proc set_pad4*(a: PTextAttributes, `pad4`: guint) -proc TYPE_TEXT_TAG_TABLE*(): GType -proc TEXT_TAG_TABLE*(obj: pointer): PTextTagTable -proc TEXT_TAG_TABLE_CLASS*(klass: pointer): PTextTagTableClass -proc IS_TEXT_TAG_TABLE*(obj: pointer): bool -proc IS_TEXT_TAG_TABLE_CLASS*(klass: pointer): bool -proc TEXT_TAG_TABLE_GET_CLASS*(obj: pointer): PTextTagTableClass -proc text_tag_table_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_tag_table_get_type".} -proc text_tag_table_new*(): PTextTagTable{.cdecl, dynlib: lib, - importc: "gtk_text_tag_table_new".} -proc table_add*(table: PTextTagTable, tag: PTextTag){.cdecl, - dynlib: lib, importc: "gtk_text_tag_table_add".} -proc table_remove*(table: PTextTagTable, tag: PTextTag){.cdecl, - dynlib: lib, importc: "gtk_text_tag_table_remove".} -proc table_lookup*(table: PTextTagTable, name: cstring): PTextTag{. - cdecl, dynlib: lib, importc: "gtk_text_tag_table_lookup".} -proc table_foreach*(table: PTextTagTable, fun: TTextTagTableForeach, - data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_text_tag_table_foreach".} -proc table_get_size*(table: PTextTagTable): gint{.cdecl, dynlib: lib, - importc: "gtk_text_tag_table_get_size".} -proc table_add_buffer*(table: PTextTagTable, buffer: gpointer){.cdecl, - dynlib: lib, importc: "_gtk_text_tag_table_add_buffer".} -proc table_remove_buffer*(table: PTextTagTable, buffer: gpointer){. - cdecl, dynlib: lib, importc: "_gtk_text_tag_table_remove_buffer".} -proc TYPE_TEXT_MARK*(): GType -proc TEXT_MARK*(anObject: pointer): PTextMark -proc TEXT_MARK_CLASS*(klass: pointer): PTextMarkClass -proc IS_TEXT_MARK*(anObject: pointer): bool -proc IS_TEXT_MARK_CLASS*(klass: pointer): bool -proc TEXT_MARK_GET_CLASS*(obj: pointer): PTextMarkClass -proc text_mark_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_mark_get_type".} -proc set_visible*(mark: PTextMark, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_text_mark_set_visible".} -proc get_visible*(mark: PTextMark): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_mark_get_visible".} -proc get_name*(mark: PTextMark): cstring{.cdecl, dynlib: lib, - importc: "gtk_text_mark_get_name".} -proc get_deleted*(mark: PTextMark): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_mark_get_deleted".} -proc get_buffer*(mark: PTextMark): PTextBuffer{.cdecl, dynlib: lib, - importc: "gtk_text_mark_get_buffer".} -proc get_left_gravity*(mark: PTextMark): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_mark_get_left_gravity".} -const - bm_TGtkTextMarkBody_visible* = 0x0001'i16 - bp_TGtkTextMarkBody_visible* = 0'i16 - bm_TGtkTextMarkBody_not_deleteable* = 0x0002'i16 - bp_TGtkTextMarkBody_not_deleteable* = 1'i16 - -proc visible*(a: PTextMarkBody): guint -proc set_visible*(a: PTextMarkBody, `visible`: guint) -proc not_deleteable*(a: PTextMarkBody): guint -proc set_not_deleteable*(a: PTextMarkBody, `not_deleteable`: guint) -proc mark_segment_new*(tree: PTextBTree, left_gravity: gboolean, name: cstring): PTextLineSegment{. - cdecl, dynlib: lib, importc: "_gtk_mark_segment_new".} -proc TYPE_TEXT_CHILD_ANCHOR*(): GType -proc TEXT_CHILD_ANCHOR*(anObject: pointer): PTextChildAnchor -proc TEXT_CHILD_ANCHOR_CLASS*(klass: pointer): PTextChildAnchorClass -proc IS_TEXT_CHILD_ANCHOR*(anObject: pointer): bool -proc IS_TEXT_CHILD_ANCHOR_CLASS*(klass: pointer): bool -proc TEXT_CHILD_ANCHOR_GET_CLASS*(obj: pointer): PTextChildAnchorClass -proc text_child_anchor_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_child_anchor_get_type".} -proc text_child_anchor_new*(): PTextChildAnchor{.cdecl, dynlib: lib, - importc: "gtk_text_child_anchor_new".} -proc anchor_get_widgets*(anchor: PTextChildAnchor): PGList{.cdecl, - dynlib: lib, importc: "gtk_text_child_anchor_get_widgets".} -proc anchor_get_deleted*(anchor: PTextChildAnchor): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_child_anchor_get_deleted".} -proc pixbuf_segment_new*(pixbuf: gdk2pixbuf.PPixbuf): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_pixbuf_segment_new".} -proc widget_segment_new*(anchor: PTextChildAnchor): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_widget_segment_new".} -proc widget_segment_add*(widget_segment: PTextLineSegment, child: PWidget){. - cdecl, dynlib: lib, importc: "_gtk_widget_segment_add".} -proc widget_segment_remove*(widget_segment: PTextLineSegment, child: PWidget){. - cdecl, dynlib: lib, importc: "_gtk_widget_segment_remove".} -proc widget_segment_ref*(widget_segment: PTextLineSegment){.cdecl, dynlib: lib, - importc: "_gtk_widget_segment_ref".} -proc widget_segment_unref*(widget_segment: PTextLineSegment){.cdecl, - dynlib: lib, importc: "_gtk_widget_segment_unref".} -proc anchored_child_get_layout*(child: PWidget): PTextLayout{.cdecl, - dynlib: lib, importc: "_gtk_anchored_child_get_layout".} -proc line_segment_split*(iter: PTextIter): PTextLineSegment{.cdecl, - dynlib: lib, importc: "gtk_text_line_segment_split".} -proc char_segment_new*(text: cstring, len: guint): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_char_segment_new".} -proc char_segment_new_from_two_strings*(text1: cstring, len1: guint, - text2: cstring, len2: guint): PTextLineSegment{. - cdecl, dynlib: lib, importc: "_gtk_char_segment_new_from_two_strings".} -proc toggle_segment_new*(info: PTextTagInfo, StateOn: gboolean): PTextLineSegment{. - cdecl, dynlib: lib, importc: "_gtk_toggle_segment_new".} -proc btree_new*(table: PTextTagTable, buffer: PTextBuffer): PTextBTree{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_new".} -proc reference*(tree: PTextBTree){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_ref".} -proc unref*(tree: PTextBTree){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_unref".} -proc get_buffer*(tree: PTextBTree): PTextBuffer{.cdecl, dynlib: lib, - importc: "_gtk_text_btree_get_buffer".} -proc get_chars_changed_stamp*(tree: PTextBTree): guint{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_chars_changed_stamp".} -proc get_segments_changed_stamp*(tree: PTextBTree): guint{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_segments_changed_stamp".} -proc segments_changed*(tree: PTextBTree){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_segments_changed".} -proc is_end*(tree: PTextBTree, line: PTextLine, - seg: PTextLineSegment, byte_index: int32, - char_offset: int32): gboolean{.cdecl, dynlib: lib, - importc: "_gtk_text_btree_is_end".} -proc btree_delete*(start: PTextIter, theEnd: PTextIter){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_delete".} -proc btree_insert*(iter: PTextIter, text: cstring, len: gint){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_insert".} -proc btree_insert_pixbuf*(iter: PTextIter, pixbuf: gdk2pixbuf.PPixbuf){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_insert_pixbuf".} -proc btree_insert_child_anchor*(iter: PTextIter, anchor: PTextChildAnchor){. - cdecl, dynlib: lib, importc: "_gtk_text_btree_insert_child_anchor".} -proc btree_unregister_child_anchor*(anchor: PTextChildAnchor){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_unregister_child_anchor".} -proc find_line_by_y*(tree: PTextBTree, view_id: gpointer, - ypixel: gint, line_top_y: Pgint): PTextLine{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_find_line_by_y".} -proc find_line_top*(tree: PTextBTree, line: PTextLine, - view_id: gpointer): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_btree_find_line_top".} -proc add_view*(tree: PTextBTree, layout: PTextLayout){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_add_view".} -proc remove_view*(tree: PTextBTree, view_id: gpointer){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_remove_view".} -proc invalidate_region*(tree: PTextBTree, start: PTextIter, - theEnd: PTextIter){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_invalidate_region".} -proc get_view_size*(tree: PTextBTree, view_id: gpointer, - width: Pgint, height: Pgint){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_get_view_size".} -proc is_valid*(tree: PTextBTree, view_id: gpointer): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_is_valid".} -proc validate*(tree: PTextBTree, view_id: gpointer, max_pixels: gint, - y: Pgint, old_height: Pgint, new_height: Pgint): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_validate".} -proc validate_line*(tree: PTextBTree, line: PTextLine, - view_id: gpointer){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_validate_line".} -proc btree_tag*(start: PTextIter, theEnd: PTextIter, tag: PTextTag, - apply: gboolean){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_tag".} -proc get_line*(tree: PTextBTree, line_number: gint, - real_line_number: Pgint): PTextLine{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_line".} -proc get_line_no_last*(tree: PTextBTree, line_number: gint, - real_line_number: Pgint): PTextLine{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_line_no_last".} -proc get_end_iter_line*(tree: PTextBTree): PTextLine{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_end_iter_line".} -proc get_line_at_char*(tree: PTextBTree, char_index: gint, - line_start_index: Pgint, - real_char_index: Pgint): PTextLine{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_line_at_char".} -proc btree_get_tags*(iter: PTextIter, num_tags: Pgint): PPGtkTextTag{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_get_tags".} -proc btree_get_text*(start: PTextIter, theEnd: PTextIter, - include_hidden: gboolean, include_nonchars: gboolean): cstring{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_get_text".} -proc line_count*(tree: PTextBTree): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_btree_line_count".} -proc char_count*(tree: PTextBTree): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_btree_char_count".} -proc btree_char_is_invisible*(iter: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_char_is_invisible".} -proc get_iter_at_char*(tree: PTextBTree, iter: PTextIter, - char_index: gint){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_get_iter_at_char".} -proc get_iter_at_line_char*(tree: PTextBTree, iter: PTextIter, - line_number: gint, char_index: gint){. - cdecl, dynlib: lib, importc: "_gtk_text_btree_get_iter_at_line_char".} -proc get_iter_at_line_byte*(tree: PTextBTree, iter: PTextIter, - line_number: gint, byte_index: gint){. - cdecl, dynlib: lib, importc: "_gtk_text_btree_get_iter_at_line_byte".} -proc get_iter_from_string*(tree: PTextBTree, iter: PTextIter, - `string`: cstring): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_iter_from_string".} -proc get_iter_at_mark_name*(tree: PTextBTree, iter: PTextIter, - mark_name: cstring): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_iter_at_mark_name".} -proc get_iter_at_mark*(tree: PTextBTree, iter: PTextIter, - mark: PTextMark){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_get_iter_at_mark".} -proc get_end_iter*(tree: PTextBTree, iter: PTextIter){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_end_iter".} -proc get_iter_at_line*(tree: PTextBTree, iter: PTextIter, - line: PTextLine, byte_offset: gint){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_iter_at_line".} -proc get_iter_at_first_toggle*(tree: PTextBTree, iter: PTextIter, - tag: PTextTag): gboolean{.cdecl, dynlib: lib, importc: "_gtk_text_btree_get_iter_at_first_toggle".} -proc get_iter_at_last_toggle*(tree: PTextBTree, iter: PTextIter, - tag: PTextTag): gboolean{.cdecl, dynlib: lib, importc: "_gtk_text_btree_get_iter_at_last_toggle".} -proc get_iter_at_child_anchor*(tree: PTextBTree, iter: PTextIter, - anchor: PTextChildAnchor){.cdecl, dynlib: lib, importc: "_gtk_text_btree_get_iter_at_child_anchor".} -proc set_mark*(tree: PTextBTree, existing_mark: PTextMark, - name: cstring, left_gravity: gboolean, - index: PTextIter, should_exist: gboolean): PTextMark{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_set_mark".} -proc remove_mark_by_name*(tree: PTextBTree, name: cstring){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_remove_mark_by_name".} -proc remove_mark*(tree: PTextBTree, segment: PTextMark){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_remove_mark".} -proc get_selection_bounds*(tree: PTextBTree, start: PTextIter, - theEnd: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_text_btree_get_selection_bounds".} -proc place_cursor*(tree: PTextBTree, `where`: PTextIter){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_place_cursor".} -proc mark_is_insert*(tree: PTextBTree, segment: PTextMark): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_mark_is_insert".} -proc mark_is_selection_bound*(tree: PTextBTree, segment: PTextMark): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_mark_is_selection_bound".} -proc get_mark_by_name*(tree: PTextBTree, name: cstring): PTextMark{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_get_mark_by_name".} -proc first_could_contain_tag*(tree: PTextBTree, tag: PTextTag): PTextLine{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_first_could_contain_tag".} -proc last_could_contain_tag*(tree: PTextBTree, tag: PTextTag): PTextLine{. - cdecl, dynlib: lib, importc: "_gtk_text_btree_last_could_contain_tag".} -const - bm_TGtkTextLineData_width* = 0x00FFFFFF'i32 - bp_TGtkTextLineData_width* = 0'i32 - bm_TGtkTextLineData_valid* = 0xFF000000'i32 - bp_TGtkTextLineData_valid* = 24'i32 - -proc width*(a: PTextLineData): gint -proc set_width*(a: PTextLineData, NewWidth: gint) -proc valid*(a: PTextLineData): gint -proc set_valid*(a: PTextLineData, `valid`: gint) -proc get_number*(line: PTextLine): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_line_get_number".} -proc char_has_tag*(line: PTextLine, tree: PTextBTree, - char_in_line: gint, tag: PTextTag): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_text_line_char_has_tag".} -proc byte_has_tag*(line: PTextLine, tree: PTextBTree, - byte_in_line: gint, tag: PTextTag): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_text_line_byte_has_tag".} -proc is_last*(line: PTextLine, tree: PTextBTree): gboolean{.cdecl, - dynlib: lib, importc: "_gtk_text_line_is_last".} -proc contains_end_iter*(line: PTextLine, tree: PTextBTree): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_text_line_contains_end_iter".} -proc next*(line: PTextLine): PTextLine{.cdecl, dynlib: lib, - importc: "_gtk_text_line_next".} -proc next_excluding_last*(line: PTextLine): PTextLine{.cdecl, - dynlib: lib, importc: "_gtk_text_line_next_excluding_last".} -proc previous*(line: PTextLine): PTextLine{.cdecl, dynlib: lib, - importc: "_gtk_text_line_previous".} -proc add_data*(line: PTextLine, data: PTextLineData){.cdecl, - dynlib: lib, importc: "_gtk_text_line_add_data".} -proc remove_data*(line: PTextLine, view_id: gpointer): gpointer{. - cdecl, dynlib: lib, importc: "_gtk_text_line_remove_data".} -proc get_data*(line: PTextLine, view_id: gpointer): gpointer{.cdecl, - dynlib: lib, importc: "_gtk_text_line_get_data".} -proc invalidate_wrap*(line: PTextLine, ld: PTextLineData){.cdecl, - dynlib: lib, importc: "_gtk_text_line_invalidate_wrap".} -proc char_count*(line: PTextLine): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_line_char_count".} -proc byte_count*(line: PTextLine): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_line_byte_count".} -proc char_index*(line: PTextLine): gint{.cdecl, dynlib: lib, - importc: "_gtk_text_line_char_index".} -proc byte_to_segment*(line: PTextLine, byte_offset: gint, - seg_offset: Pgint): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_text_line_byte_to_segment".} -proc char_to_segment*(line: PTextLine, char_offset: gint, - seg_offset: Pgint): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_text_line_char_to_segment".} -proc byte_to_char_offsets*(line: PTextLine, byte_offset: gint, - line_char_offset: Pgint, - seg_char_offset: Pgint){.cdecl, - dynlib: lib, importc: "_gtk_text_line_byte_to_char_offsets".} -proc char_to_byte_offsets*(line: PTextLine, char_offset: gint, - line_byte_offset: Pgint, - seg_byte_offset: Pgint){.cdecl, - dynlib: lib, importc: "_gtk_text_line_char_to_byte_offsets".} -proc byte_to_any_segment*(line: PTextLine, byte_offset: gint, - seg_offset: Pgint): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_text_line_byte_to_any_segment".} -proc char_to_any_segment*(line: PTextLine, char_offset: gint, - seg_offset: Pgint): PTextLineSegment{.cdecl, - dynlib: lib, importc: "_gtk_text_line_char_to_any_segment".} -proc byte_to_char*(line: PTextLine, byte_offset: gint): gint{.cdecl, - dynlib: lib, importc: "_gtk_text_line_byte_to_char".} -proc char_to_byte*(line: PTextLine, char_offset: gint): gint{.cdecl, - dynlib: lib, importc: "_gtk_text_line_char_to_byte".} -proc next_could_contain_tag*(line: PTextLine, tree: PTextBTree, - tag: PTextTag): PTextLine{.cdecl, - dynlib: lib, importc: "_gtk_text_line_next_could_contain_tag".} -proc previous_could_contain_tag*(line: PTextLine, tree: PTextBTree, - tag: PTextTag): PTextLine{.cdecl, dynlib: lib, importc: "_gtk_text_line_previous_could_contain_tag".} -proc line_data_new*(layout: PTextLayout, line: PTextLine): PTextLineData{. - cdecl, dynlib: lib, importc: "_gtk_text_line_data_new".} -proc check*(tree: PTextBTree){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_check".} -proc spew*(tree: PTextBTree){.cdecl, dynlib: lib, - importc: "_gtk_text_btree_spew".} -proc toggle_segment_check_func*(segPtr: PTextLineSegment, line: PTextLine){. - cdecl, dynlib: lib, importc: "_gtk_toggle_segment_check_func".} -proc change_node_toggle_count*(node: PTextBTreeNode, info: PTextTagInfo, - delta: gint){.cdecl, dynlib: lib, - importc: "_gtk_change_node_toggle_count".} -proc release_mark_segment*(tree: PTextBTree, - segment: PTextLineSegment){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_release_mark_segment".} -proc notify_will_remove_tag*(tree: PTextBTree, tag: PTextTag){.cdecl, - dynlib: lib, importc: "_gtk_text_btree_notify_will_remove_tag".} -const - bm_TGtkTextBuffer_modified* = 0x0001'i16 - bp_TGtkTextBuffer_modified* = 0'i16 - -proc TYPE_TEXT_BUFFER*(): GType -proc TEXT_BUFFER*(obj: pointer): PTextBuffer -proc TEXT_BUFFER_CLASS*(klass: pointer): PTextBufferClass -proc IS_TEXT_BUFFER*(obj: pointer): bool -proc IS_TEXT_BUFFER_CLASS*(klass: pointer): bool -proc TEXT_BUFFER_GET_CLASS*(obj: pointer): PTextBufferClass -proc modified*(a: PTextBuffer): guint -proc set_modified*(a: PTextBuffer, `modified`: guint) -proc text_buffer_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_type".} -proc text_buffer_new*(table: PTextTagTable): PTextBuffer{.cdecl, dynlib: lib, - importc: "gtk_text_buffer_new".} -proc get_line_count*(buffer: PTextBuffer): gint{.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_line_count".} -proc get_char_count*(buffer: PTextBuffer): gint{.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_char_count".} -proc get_tag_table*(buffer: PTextBuffer): PTextTagTable{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_tag_table".} -proc set_text*(buffer: PTextBuffer, text: cstring, len: gint){. - cdecl, dynlib: lib, importc: "gtk_text_buffer_set_text".} -proc insert*(buffer: PTextBuffer, iter: PTextIter, text: cstring, - len: gint){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_insert".} -proc insert_at_cursor*(buffer: PTextBuffer, text: cstring, len: gint){. - cdecl, dynlib: lib, importc: "gtk_text_buffer_insert_at_cursor".} -proc insert_interactive*(buffer: PTextBuffer, iter: PTextIter, - text: cstring, len: gint, - default_editable: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_insert_interactive".} -proc insert_interactive_at_cursor*(buffer: PTextBuffer, - text: cstring, len: gint, default_editable: gboolean): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_insert_interactive_at_cursor".} -proc insert_range*(buffer: PTextBuffer, iter: PTextIter, - start: PTextIter, theEnd: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_insert_range".} -proc insert_range_interactive*(buffer: PTextBuffer, iter: PTextIter, - start: PTextIter, theEnd: PTextIter, default_editable: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_insert_range_interactive".} -proc delete*(buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_delete".} -proc delete_interactive*(buffer: PTextBuffer, start_iter: PTextIter, - end_iter: PTextIter, - default_editable: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_delete_interactive".} -proc get_text*(buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter, include_hidden_chars: gboolean): cstring{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_get_text".} -proc get_slice*(buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter, include_hidden_chars: gboolean): cstring{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_get_slice".} -proc insert_pixbuf*(buffer: PTextBuffer, iter: PTextIter, - pixbuf: gdk2pixbuf.PPixbuf){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_insert_pixbuf".} -proc insert_child_anchor*(buffer: PTextBuffer, iter: PTextIter, - anchor: PTextChildAnchor){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_insert_child_anchor".} -proc create_child_anchor*(buffer: PTextBuffer, iter: PTextIter): PTextChildAnchor{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_create_child_anchor".} -proc create_mark*(buffer: PTextBuffer, mark_name: cstring, - `where`: PTextIter, left_gravity: gboolean): PTextMark{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_create_mark".} -proc move_mark*(buffer: PTextBuffer, mark: PTextMark, - `where`: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_move_mark".} -proc delete_mark*(buffer: PTextBuffer, mark: PTextMark){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_delete_mark".} -proc get_mark*(buffer: PTextBuffer, name: cstring): PTextMark{. - cdecl, dynlib: lib, importc: "gtk_text_buffer_get_mark".} -proc move_mark_by_name*(buffer: PTextBuffer, name: cstring, - `where`: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_move_mark_by_name".} -proc delete_mark_by_name*(buffer: PTextBuffer, name: cstring){. - cdecl, dynlib: lib, importc: "gtk_text_buffer_delete_mark_by_name".} -proc get_insert*(buffer: PTextBuffer): PTextMark{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_insert".} -proc get_selection_bound*(buffer: PTextBuffer): PTextMark{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_selection_bound".} -proc place_cursor*(buffer: PTextBuffer, `where`: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_place_cursor".} -proc apply_tag*(buffer: PTextBuffer, tag: PTextTag, - start: PTextIter, theEnd: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_apply_tag".} -proc remove_tag*(buffer: PTextBuffer, tag: PTextTag, - start: PTextIter, theEnd: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_remove_tag".} -proc apply_tag_by_name*(buffer: PTextBuffer, name: cstring, - start: PTextIter, theEnd: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_apply_tag_by_name".} -proc remove_tag_by_name*(buffer: PTextBuffer, name: cstring, - start: PTextIter, theEnd: PTextIter){. - cdecl, dynlib: lib, importc: "gtk_text_buffer_remove_tag_by_name".} -proc remove_all_tags*(buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_remove_all_tags".} -proc get_iter_at_line_offset*(buffer: PTextBuffer, iter: PTextIter, - line_number: gint, char_offset: gint){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_iter_at_line_offset".} -proc get_iter_at_line_index*(buffer: PTextBuffer, iter: PTextIter, - line_number: gint, byte_index: gint){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_iter_at_line_index".} -proc get_iter_at_offset*(buffer: PTextBuffer, iter: PTextIter, - char_offset: gint){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_iter_at_offset".} -proc get_iter_at_line*(buffer: PTextBuffer, iter: PTextIter, - line_number: gint){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_iter_at_line".} -proc get_start_iter*(buffer: PTextBuffer, iter: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_start_iter".} -proc get_end_iter*(buffer: PTextBuffer, iter: PTextIter){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_end_iter".} -proc get_bounds*(buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_bounds".} -proc get_iter_at_mark*(buffer: PTextBuffer, iter: PTextIter, - mark: PTextMark){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_get_iter_at_mark".} -proc get_iter_at_child_anchor*(buffer: PTextBuffer, iter: PTextIter, - anchor: PTextChildAnchor){.cdecl, dynlib: lib, importc: "gtk_text_buffer_get_iter_at_child_anchor".} -proc get_modified*(buffer: PTextBuffer): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_modified".} -proc set_modified*(buffer: PTextBuffer, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_set_modified".} -proc add_selection_clipboard*(buffer: PTextBuffer, - clipboard: PClipboard){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_add_selection_clipboard".} -proc remove_selection_clipboard*(buffer: PTextBuffer, - clipboard: PClipboard){.cdecl, dynlib: lib, importc: "gtk_text_buffer_remove_selection_clipboard".} -proc cut_clipboard*(buffer: PTextBuffer, clipboard: PClipboard, - default_editable: gboolean){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_cut_clipboard".} -proc copy_clipboard*(buffer: PTextBuffer, clipboard: PClipboard){. - cdecl, dynlib: lib, importc: "gtk_text_buffer_copy_clipboard".} -proc paste_clipboard*(buffer: PTextBuffer, clipboard: PClipboard, - override_location: PTextIter, - default_editable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_text_buffer_paste_clipboard".} -proc get_selection_bounds*(buffer: PTextBuffer, start: PTextIter, - theEnd: PTextIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_selection_bounds".} -proc delete_selection*(buffer: PTextBuffer, interactive: gboolean, - default_editable: gboolean): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_buffer_delete_selection".} -proc begin_user_action*(buffer: PTextBuffer){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_begin_user_action".} -proc end_user_action*(buffer: PTextBuffer){.cdecl, dynlib: lib, - importc: "gtk_text_buffer_end_user_action".} -proc spew*(buffer: PTextBuffer){.cdecl, dynlib: lib, - importc: "_gtk_text_buffer_spew".} -proc get_btree*(buffer: PTextBuffer): PTextBTree{.cdecl, - dynlib: lib, importc: "_gtk_text_buffer_get_btree".} -proc get_line_log_attrs*(buffer: PTextBuffer, - anywhere_in_line: PTextIter, - char_len: Pgint): pango.PLogAttr{.cdecl, - dynlib: lib, importc: "_gtk_text_buffer_get_line_log_attrs".} -proc notify_will_remove_tag*(buffer: PTextBuffer, tag: PTextTag){. - cdecl, dynlib: lib, importc: "_gtk_text_buffer_notify_will_remove_tag".} -proc get_has_selection*(buffer: PTextBuffer): bool {.cdecl, - dynlib: lib, importc: "gtk_text_buffer_get_has_selection".} -proc select_range*(buffer: PTextBuffer, ins, - bound: PTextIter) {.cdecl, dynlib: lib, importc: "gtk_text_buffer_select_range".} -proc backspace*(buffer: PTextBuffer, iter: PTextIter, - interactive, defaultEditable: bool): bool {.cdecl, - dynlib: lib, importc: "gtk_text_buffer_backspace".} - -proc TYPE_TEXT_LAYOUT*(): GType -proc TEXT_LAYOUT*(obj: pointer): PTextLayout -proc TEXT_LAYOUT_CLASS*(klass: pointer): PTextLayoutClass -proc IS_TEXT_LAYOUT*(obj: pointer): bool -proc IS_TEXT_LAYOUT_CLASS*(klass: pointer): bool -proc TEXT_LAYOUT_GET_CLASS*(obj: pointer): PTextLayoutClass -const - bm_TGtkTextLayout_cursor_visible* = 0x0001'i16 - bp_TGtkTextLayout_cursor_visible* = 0'i16 - bm_TGtkTextLayout_cursor_direction* = 0x0006'i16 - bp_TGtkTextLayout_cursor_direction* = 1'i16 - -proc cursor_visible*(a: PTextLayout): guint -proc set_cursor_visible*(a: PTextLayout, `cursor_visible`: guint) -proc cursor_direction*(a: PTextLayout): gint -proc set_cursor_direction*(a: PTextLayout, `cursor_direction`: gint) -const - bm_TGtkTextCursorDisplay_is_strong* = 0x0001'i16 - bp_TGtkTextCursorDisplay_is_strong* = 0'i16 - bm_TGtkTextCursorDisplay_is_weak* = 0x0002'i16 - bp_TGtkTextCursorDisplay_is_weak* = 1'i16 - -proc is_strong*(a: PTextCursorDisplay): guint -proc set_is_strong*(a: PTextCursorDisplay, `is_strong`: guint) -proc is_weak*(a: PTextCursorDisplay): guint -proc set_is_weak*(a: PTextCursorDisplay, `is_weak`: guint) -proc text_layout_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_text_layout_get_type".} -proc text_layout_new*(): PTextLayout{.cdecl, dynlib: lib, - importc: "gtk_text_layout_new".} -proc set_buffer*(layout: PTextLayout, buffer: PTextBuffer){.cdecl, - dynlib: lib, importc: "gtk_text_layout_set_buffer".} -proc get_buffer*(layout: PTextLayout): PTextBuffer{.cdecl, - dynlib: lib, importc: "gtk_text_layout_get_buffer".} -proc set_default_style*(layout: PTextLayout, values: PTextAttributes){. - cdecl, dynlib: lib, importc: "gtk_text_layout_set_default_style".} -proc set_contexts*(layout: PTextLayout, ltr_context: pango.PContext, - rtl_context: pango.PContext){.cdecl, dynlib: lib, - importc: "gtk_text_layout_set_contexts".} -proc set_cursor_direction*(layout: PTextLayout, - direction: TTextDirection){.cdecl, - dynlib: lib, importc: "gtk_text_layout_set_cursor_direction".} -proc default_style_changed*(layout: PTextLayout){.cdecl, - dynlib: lib, importc: "gtk_text_layout_default_style_changed".} -proc set_screen_width*(layout: PTextLayout, width: gint){.cdecl, - dynlib: lib, importc: "gtk_text_layout_set_screen_width".} -proc set_preedit_string*(layout: PTextLayout, - preedit_string: cstring, - preedit_attrs: pango.PAttrList, - cursor_pos: gint){.cdecl, dynlib: lib, - importc: "gtk_text_layout_set_preedit_string".} -proc set_cursor_visible*(layout: PTextLayout, - cursor_visible: gboolean){.cdecl, - dynlib: lib, importc: "gtk_text_layout_set_cursor_visible".} -proc get_cursor_visible*(layout: PTextLayout): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_layout_get_cursor_visible".} -proc get_size*(layout: PTextLayout, width: Pgint, height: Pgint){. - cdecl, dynlib: lib, importc: "gtk_text_layout_get_size".} -proc get_lines*(layout: PTextLayout, top_y: gint, bottom_y: gint, - first_line_y: Pgint): PGSList{.cdecl, dynlib: lib, - importc: "gtk_text_layout_get_lines".} -proc wrap_loop_start*(layout: PTextLayout){.cdecl, dynlib: lib, - importc: "gtk_text_layout_wrap_loop_start".} -proc wrap_loop_end*(layout: PTextLayout){.cdecl, dynlib: lib, - importc: "gtk_text_layout_wrap_loop_end".} -proc get_line_display*(layout: PTextLayout, line: PTextLine, - size_only: gboolean): PTextLineDisplay{. - cdecl, dynlib: lib, importc: "gtk_text_layout_get_line_display".} -proc free_line_display*(layout: PTextLayout, - display: PTextLineDisplay){.cdecl, - dynlib: lib, importc: "gtk_text_layout_free_line_display".} -proc get_line_at_y*(layout: PTextLayout, target_iter: PTextIter, - y: gint, line_top: Pgint){.cdecl, dynlib: lib, - importc: "gtk_text_layout_get_line_at_y".} -proc get_iter_at_pixel*(layout: PTextLayout, iter: PTextIter, - x: gint, y: gint){.cdecl, dynlib: lib, - importc: "gtk_text_layout_get_iter_at_pixel".} -proc invalidate*(layout: PTextLayout, start: PTextIter, - theEnd: PTextIter){.cdecl, dynlib: lib, - importc: "gtk_text_layout_invalidate".} -proc free_line_data*(layout: PTextLayout, line: PTextLine, - line_data: PTextLineData){.cdecl, dynlib: lib, - importc: "gtk_text_layout_free_line_data".} -proc is_valid*(layout: PTextLayout): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_layout_is_valid".} -proc validate_yrange*(layout: PTextLayout, anchor_line: PTextIter, - y0: gint, y1: gint){.cdecl, dynlib: lib, - importc: "gtk_text_layout_validate_yrange".} -proc validate*(layout: PTextLayout, max_pixels: gint){.cdecl, - dynlib: lib, importc: "gtk_text_layout_validate".} -proc wrap*(layout: PTextLayout, line: PTextLine, - line_data: PTextLineData): PTextLineData{.cdecl, - dynlib: lib, importc: "gtk_text_layout_wrap".} -proc changed*(layout: PTextLayout, y: gint, old_height: gint, - new_height: gint){.cdecl, dynlib: lib, - importc: "gtk_text_layout_changed".} -proc get_iter_location*(layout: PTextLayout, iter: PTextIter, - rect: gdk2.PRectangle){.cdecl, dynlib: lib, - importc: "gtk_text_layout_get_iter_location".} -proc get_line_yrange*(layout: PTextLayout, iter: PTextIter, - y: Pgint, height: Pgint){.cdecl, dynlib: lib, - importc: "gtk_text_layout_get_line_yrange".} -proc get_line_xrange*(layout: PTextLayout, iter: PTextIter, - x: Pgint, width: Pgint){.cdecl, dynlib: lib, - importc: "_gtk_text_layout_get_line_xrange".} -proc get_cursor_locations*(layout: PTextLayout, iter: PTextIter, - strong_pos: gdk2.PRectangle, - weak_pos: gdk2.PRectangle){.cdecl, - dynlib: lib, importc: "gtk_text_layout_get_cursor_locations".} -proc clamp_iter_to_vrange*(layout: PTextLayout, iter: PTextIter, - top: gint, bottom: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_layout_clamp_iter_to_vrange".} -proc move_iter_to_line_end*(layout: PTextLayout, iter: PTextIter, - direction: gint): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_layout_move_iter_to_line_end".} -proc move_iter_to_previous_line*(layout: PTextLayout, - iter: PTextIter): gboolean{.cdecl, dynlib: lib, importc: "gtk_text_layout_move_iter_to_previous_line".} -proc move_iter_to_next_line*(layout: PTextLayout, iter: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_layout_move_iter_to_next_line".} -proc move_iter_to_x*(layout: PTextLayout, iter: PTextIter, x: gint){. - cdecl, dynlib: lib, importc: "gtk_text_layout_move_iter_to_x".} -proc move_iter_visually*(layout: PTextLayout, iter: PTextIter, - count: gint): gboolean{.cdecl, dynlib: lib, - importc: "gtk_text_layout_move_iter_visually".} -proc iter_starts_line*(layout: PTextLayout, iter: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_layout_iter_starts_line".} -proc get_iter_at_line*(layout: PTextLayout, iter: PTextIter, - line: PTextLine, byte_offset: gint){.cdecl, - dynlib: lib, importc: "gtk_text_layout_get_iter_at_line".} -proc anchor_register_child*(anchor: PTextChildAnchor, child: PWidget, - layout: PTextLayout){.cdecl, dynlib: lib, - importc: "gtk_text_child_anchor_register_child".} -proc anchor_unregister_child*(anchor: PTextChildAnchor, - child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_text_child_anchor_unregister_child".} -proc anchor_queue_resize*(anchor: PTextChildAnchor, - layout: PTextLayout){.cdecl, dynlib: lib, - importc: "gtk_text_child_anchor_queue_resize".} -proc text_anchored_child_set_layout*(child: PWidget, layout: PTextLayout){. - cdecl, dynlib: lib, importc: "gtk_text_anchored_child_set_layout".} -proc spew*(layout: PTextLayout){.cdecl, dynlib: lib, - importc: "gtk_text_layout_spew".} -const # GTK_TEXT_VIEW_PRIORITY_VALIDATE* = GDK_PRIORITY_REDRAW + 5 - bm_TGtkTextView_editable* = 0x0001'i16 - bp_TGtkTextView_editable* = 0'i16 - bm_TGtkTextView_overwrite_mode* = 0x0002'i16 - bp_TGtkTextView_overwrite_mode* = 1'i16 - bm_TGtkTextView_cursor_visible* = 0x0004'i16 - bp_TGtkTextView_cursor_visible* = 2'i16 - bm_TGtkTextView_need_im_reset* = 0x0008'i16 - bp_TGtkTextView_need_im_reset* = 3'i16 - bm_TGtkTextView_just_selected_element* = 0x0010'i16 - bp_TGtkTextView_just_selected_element* = 4'i16 - bm_TGtkTextView_disable_scroll_on_focus* = 0x0020'i16 - bp_TGtkTextView_disable_scroll_on_focus* = 5'i16 - bm_TGtkTextView_onscreen_validated* = 0x0040'i16 - bp_TGtkTextView_onscreen_validated* = 6'i16 - bm_TGtkTextView_mouse_cursor_obscured* = 0x0080'i16 - bp_TGtkTextView_mouse_cursor_obscured* = 7'i16 - -proc TYPE_TEXT_VIEW*(): GType -proc TEXT_VIEW*(obj: pointer): PTextView -proc TEXT_VIEW_CLASS*(klass: pointer): PTextViewClass -proc IS_TEXT_VIEW*(obj: pointer): bool -proc IS_TEXT_VIEW_CLASS*(klass: pointer): bool -proc TEXT_VIEW_GET_CLASS*(obj: pointer): PTextViewClass -proc editable*(a: PTextView): guint -proc set_editable*(a: PTextView, `editable`: guint) -proc overwrite_mode*(a: PTextView): guint -proc set_overwrite_mode*(a: PTextView, `overwrite_mode`: guint) -proc cursor_visible*(a: PTextView): guint -proc set_cursor_visible*(a: PTextView, `cursor_visible`: guint) -proc need_im_reset*(a: PTextView): guint -proc set_need_im_reset*(a: PTextView, `need_im_reset`: guint) -proc just_selected_element*(a: PTextView): guint -proc set_just_selected_element*(a: PTextView, `just_selected_element`: guint) -proc disable_scroll_on_focus*(a: PTextView): guint -proc set_disable_scroll_on_focus*(a: PTextView, - `disable_scroll_on_focus`: guint) -proc onscreen_validated*(a: PTextView): guint -proc set_onscreen_validated*(a: PTextView, `onscreen_validated`: guint) -proc mouse_cursor_obscured*(a: PTextView): guint -proc set_mouse_cursor_obscured*(a: PTextView, `mouse_cursor_obscured`: guint) -proc text_view_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_text_view_get_type".} -proc text_view_new*(): PTextView{.cdecl, dynlib: lib, - importc: "gtk_text_view_new".} -proc text_view_new*(buffer: PTextBuffer): PTextView{.cdecl, - dynlib: lib, importc: "gtk_text_view_new_with_buffer".} -proc set_buffer*(text_view: PTextView, buffer: PTextBuffer){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_buffer".} -proc get_buffer*(text_view: PTextView): PTextBuffer{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_buffer".} -proc scroll_to_iter*(text_view: PTextView, iter: PTextIter, - within_margin: gdouble, use_align: gboolean, - xalign: gdouble, yalign: gdouble): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_scroll_to_iter".} -proc scroll_to_mark*(text_view: PTextView, mark: PTextMark, - within_margin: gdouble, use_align: gboolean, - xalign: gdouble, yalign: gdouble){.cdecl, - dynlib: lib, importc: "gtk_text_view_scroll_to_mark".} -proc scroll_mark_onscreen*(text_view: PTextView, mark: PTextMark){. - cdecl, dynlib: lib, importc: "gtk_text_view_scroll_mark_onscreen".} -proc move_mark_onscreen*(text_view: PTextView, mark: PTextMark): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_move_mark_onscreen".} -proc place_cursor_onscreen*(text_view: PTextView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_view_place_cursor_onscreen".} -proc get_visible_rect*(text_view: PTextView, - visible_rect: gdk2.PRectangle){.cdecl, - dynlib: lib, importc: "gtk_text_view_get_visible_rect".} -proc set_cursor_visible*(text_view: PTextView, setting: gboolean){. - cdecl, dynlib: lib, importc: "gtk_text_view_set_cursor_visible".} -proc get_cursor_visible*(text_view: PTextView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_cursor_visible".} -proc get_iter_location*(text_view: PTextView, iter: PTextIter, - location: gdk2.PRectangle){.cdecl, dynlib: lib, - importc: "gtk_text_view_get_iter_location".} -proc get_iter_at_location*(text_view: PTextView, iter: PTextIter, - x: gint, y: gint){.cdecl, dynlib: lib, - importc: "gtk_text_view_get_iter_at_location".} -proc get_line_yrange*(text_view: PTextView, iter: PTextIter, y: Pgint, - height: Pgint){.cdecl, dynlib: lib, - importc: "gtk_text_view_get_line_yrange".} -proc get_line_at_y*(text_view: PTextView, target_iter: PTextIter, - y: gint, line_top: Pgint){.cdecl, dynlib: lib, - importc: "gtk_text_view_get_line_at_y".} -proc buffer_to_window_coords*(text_view: PTextView, - win: TTextWindowType, buffer_x: gint, - buffer_y: gint, window_x: Pgint, - window_y: Pgint){.cdecl, dynlib: lib, - importc: "gtk_text_view_buffer_to_window_coords".} -proc window_to_buffer_coords*(text_view: PTextView, - win: TTextWindowType, window_x: gint, - window_y: gint, buffer_x: Pgint, - buffer_y: Pgint){.cdecl, dynlib: lib, - importc: "gtk_text_view_window_to_buffer_coords".} -proc get_window*(text_view: PTextView, win: TTextWindowType): gdk2.PWindow{. - cdecl, dynlib: lib, importc: "gtk_text_view_get_window".} -proc get_window_type*(text_view: PTextView, window: gdk2.PWindow): TTextWindowType{. - cdecl, dynlib: lib, importc: "gtk_text_view_get_window_type".} -proc set_border_window_size*(text_view: PTextView, - thetype: TTextWindowType, size: gint){. - cdecl, dynlib: lib, importc: "gtk_text_view_set_border_window_size".} -proc get_border_window_size*(text_view: PTextView, - thetype: TTextWindowType): gint{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_border_window_size".} -proc forward_display_line*(text_view: PTextView, iter: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_forward_display_line".} -proc backward_display_line*(text_view: PTextView, iter: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_backward_display_line".} -proc forward_display_line_end*(text_view: PTextView, iter: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_forward_display_line_end".} -proc backward_display_line_start*(text_view: PTextView, - iter: PTextIter): gboolean{.cdecl, dynlib: lib, importc: "gtk_text_view_backward_display_line_start".} -proc starts_display_line*(text_view: PTextView, iter: PTextIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_starts_display_line".} -proc move_visually*(text_view: PTextView, iter: PTextIter, count: gint): gboolean{. - cdecl, dynlib: lib, importc: "gtk_text_view_move_visually".} -proc add_child_at_anchor*(text_view: PTextView, child: PWidget, - anchor: PTextChildAnchor){.cdecl, - dynlib: lib, importc: "gtk_text_view_add_child_at_anchor".} -proc add_child_in_window*(text_view: PTextView, child: PWidget, - which_window: TTextWindowType, xpos: gint, - ypos: gint){.cdecl, dynlib: lib, - importc: "gtk_text_view_add_child_in_window".} -proc move_child*(text_view: PTextView, child: PWidget, xpos: gint, - ypos: gint){.cdecl, dynlib: lib, - importc: "gtk_text_view_move_child".} -proc set_wrap_mode*(text_view: PTextView, wrap_mode: TWrapMode){. - cdecl, dynlib: lib, importc: "gtk_text_view_set_wrap_mode".} -proc get_wrap_mode*(text_view: PTextView): TWrapMode{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_wrap_mode".} -proc set_editable*(text_view: PTextView, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_editable".} -proc get_editable*(text_view: PTextView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_editable".} -proc set_pixels_above_lines*(text_view: PTextView, - pixels_above_lines: gint){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_pixels_above_lines".} -proc get_pixels_above_lines*(text_view: PTextView): gint{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_pixels_above_lines".} -proc set_pixels_below_lines*(text_view: PTextView, - pixels_below_lines: gint){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_pixels_below_lines".} -proc get_pixels_below_lines*(text_view: PTextView): gint{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_pixels_below_lines".} -proc set_pixels_inside_wrap*(text_view: PTextView, - pixels_inside_wrap: gint){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_pixels_inside_wrap".} -proc get_pixels_inside_wrap*(text_view: PTextView): gint{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_pixels_inside_wrap".} -proc set_justification*(text_view: PTextView, - justification: TJustification){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_justification".} -proc get_justification*(text_view: PTextView): TJustification{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_justification".} -proc set_left_margin*(text_view: PTextView, left_margin: gint){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_left_margin".} -proc get_left_margin*(text_view: PTextView): gint{.cdecl, dynlib: lib, - importc: "gtk_text_view_get_left_margin".} -proc set_right_margin*(text_view: PTextView, right_margin: gint){. - cdecl, dynlib: lib, importc: "gtk_text_view_set_right_margin".} -proc get_right_margin*(text_view: PTextView): gint{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_right_margin".} -proc set_indent*(text_view: PTextView, indent: gint){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_indent".} -proc get_indent*(text_view: PTextView): gint{.cdecl, dynlib: lib, - importc: "gtk_text_view_get_indent".} -proc set_tabs*(text_view: PTextView, tabs: pango.PTabArray){.cdecl, - dynlib: lib, importc: "gtk_text_view_set_tabs".} -proc get_tabs*(text_view: PTextView): pango.PTabArray{.cdecl, - dynlib: lib, importc: "gtk_text_view_get_tabs".} -proc get_default_attributes*(text_view: PTextView): PTextAttributes{. - cdecl, dynlib: lib, importc: "gtk_text_view_get_default_attributes".} -const - bm_TGtkTipsQuery_emit_always* = 0x0001'i16 - bp_TGtkTipsQuery_emit_always* = 0'i16 - bm_TGtkTipsQuery_in_query* = 0x0002'i16 - bp_TGtkTipsQuery_in_query* = 1'i16 - -proc TYPE_TIPS_QUERY*(): GType -proc TIPS_QUERY*(obj: pointer): PTipsQuery -proc TIPS_QUERY_CLASS*(klass: pointer): PTipsQueryClass -proc IS_TIPS_QUERY*(obj: pointer): bool -proc IS_TIPS_QUERY_CLASS*(klass: pointer): bool -proc TIPS_QUERY_GET_CLASS*(obj: pointer): PTipsQueryClass -proc emit_always*(a: PTipsQuery): guint -proc set_emit_always*(a: PTipsQuery, `emit_always`: guint) -proc in_query*(a: PTipsQuery): guint -proc set_in_query*(a: PTipsQuery, `in_query`: guint) -proc tips_query_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tips_query_get_type".} -proc tips_query_new*(): PTipsQuery{.cdecl, dynlib: lib, - importc: "gtk_tips_query_new".} -proc start_query*(tips_query: PTipsQuery){.cdecl, dynlib: lib, - importc: "gtk_tips_query_start_query".} -proc stop_query*(tips_query: PTipsQuery){.cdecl, dynlib: lib, - importc: "gtk_tips_query_stop_query".} -proc set_caller*(tips_query: PTipsQuery, caller: PWidget){.cdecl, - dynlib: lib, importc: "gtk_tips_query_set_caller".} -proc set_labels*(tips_query: PTipsQuery, label_inactive: cstring, - label_no_tip: cstring){.cdecl, dynlib: lib, - importc: "gtk_tips_query_set_labels".} -const - bm_TGtkTooltips_delay* = 0x3FFFFFFF'i32 - bp_TGtkTooltips_delay* = 0'i32 - bm_TGtkTooltips_enabled* = 0x40000000'i32 - bp_TGtkTooltips_enabled* = 30'i32 - bm_TGtkTooltips_have_grab* = 0x80000000'i32 - bp_TGtkTooltips_have_grab* = 31'i32 - bm_TGtkTooltips_use_sticky_delay* = 0x00000001'i32 - bp_TGtkTooltips_use_sticky_delay* = 0'i32 - -proc TYPE_TOOLTIPS*(): GType -proc TOOLTIPS*(obj: pointer): PTooltips -proc TOOLTIPS_CLASS*(klass: pointer): PTooltipsClass -proc IS_TOOLTIPS*(obj: pointer): bool -proc IS_TOOLTIPS_CLASS*(klass: pointer): bool -proc TOOLTIPS_GET_CLASS*(obj: pointer): PTooltipsClass -proc delay*(a: PTooltips): guint -proc set_delay*(a: PTooltips, `delay`: guint) -proc enabled*(a: PTooltips): guint -proc set_enabled*(a: PTooltips, `enabled`: guint) -proc have_grab*(a: PTooltips): guint -proc set_have_grab*(a: PTooltips, `have_grab`: guint) -proc use_sticky_delay*(a: PTooltips): guint -proc set_use_sticky_delay*(a: PTooltips, `use_sticky_delay`: guint) -proc tooltips_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tooltips_get_type".} -proc tooltips_new*(): PTooltips{.cdecl, dynlib: lib, importc: "gtk_tooltips_new".} -proc enable*(tooltips: PTooltips){.cdecl, dynlib: lib, - importc: "gtk_tooltips_enable".} -proc disable*(tooltips: PTooltips){.cdecl, dynlib: lib, - importc: "gtk_tooltips_disable".} -proc set_tip*(tooltips: PTooltips, widget: PWidget, tip_text: cstring, - tip_private: cstring){.cdecl, dynlib: lib, - importc: "gtk_tooltips_set_tip".} -proc tooltips_data_get*(widget: PWidget): PTooltipsData{.cdecl, dynlib: lib, - importc: "gtk_tooltips_data_get".} -proc force_window*(tooltips: PTooltips){.cdecl, dynlib: lib, - importc: "gtk_tooltips_force_window".} -proc tooltips_toggle_keyboard_mode*(widget: PWidget){.cdecl, dynlib: lib, - importc: "_gtk_tooltips_toggle_keyboard_mode".} -const - bm_TGtkToolbar_style_set* = 0x0001'i16 - bp_TGtkToolbar_style_set* = 0'i16 - bm_TGtkToolbar_icon_size_set* = 0x0002'i16 - bp_TGtkToolbar_icon_size_set* = 1'i16 - -proc TYPE_TOOLBAR*(): GType -proc TOOLBAR*(obj: pointer): PToolbar -proc TOOLBAR_CLASS*(klass: pointer): PToolbarClass -proc IS_TOOLBAR*(obj: pointer): bool -proc IS_TOOLBAR_CLASS*(klass: pointer): bool -proc TOOLBAR_GET_CLASS*(obj: pointer): PToolbarClass -proc style_set*(a: PToolbar): guint -proc set_style_set*(a: PToolbar, `style_set`: guint) -proc icon_size_set*(a: PToolbar): guint -proc set_icon_size_set*(a: PToolbar, `icon_size_set`: guint) -proc toolbar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_toolbar_get_type".} -proc toolbar_new*(): PToolbar{.cdecl, dynlib: lib, importc: "gtk_toolbar_new".} -proc append_item*(toolbar: PToolbar, text: cstring, - tooltip_text: cstring, tooltip_private_text: cstring, - icon: PWidget, callback: TSignalFunc, - user_data: gpointer): PWidget{.cdecl, dynlib: lib, - importc: "gtk_toolbar_append_item".} -proc prepend_item*(toolbar: PToolbar, text: cstring, - tooltip_text: cstring, tooltip_private_text: cstring, - icon: PWidget, callback: TSignalFunc, - user_data: gpointer): PWidget{.cdecl, dynlib: lib, - importc: "gtk_toolbar_prepend_item".} -proc insert_item*(toolbar: PToolbar, text: cstring, - tooltip_text: cstring, tooltip_private_text: cstring, - icon: PWidget, callback: TSignalFunc, - user_data: gpointer, position: gint): PWidget{.cdecl, - dynlib: lib, importc: "gtk_toolbar_insert_item".} -proc insert_stock*(toolbar: PToolbar, stock_id: cstring, - tooltip_text: cstring, tooltip_private_text: cstring, - callback: TSignalFunc, user_data: gpointer, - position: gint): PWidget{.cdecl, dynlib: lib, - importc: "gtk_toolbar_insert_stock".} -proc append_space*(toolbar: PToolbar){.cdecl, dynlib: lib, - importc: "gtk_toolbar_append_space".} -proc prepend_space*(toolbar: PToolbar){.cdecl, dynlib: lib, - importc: "gtk_toolbar_prepend_space".} -proc insert_space*(toolbar: PToolbar, position: gint){.cdecl, - dynlib: lib, importc: "gtk_toolbar_insert_space".} -proc remove_space*(toolbar: PToolbar, position: gint){.cdecl, - dynlib: lib, importc: "gtk_toolbar_remove_space".} -proc append_element*(toolbar: PToolbar, thetype: TToolbarChildType, - widget: PWidget, text: cstring, - tooltip_text: cstring, - tooltip_private_text: cstring, icon: PWidget, - callback: TSignalFunc, user_data: gpointer): PWidget{. - cdecl, dynlib: lib, importc: "gtk_toolbar_append_element".} -proc prepend_element*(toolbar: PToolbar, thetype: TToolbarChildType, - widget: PWidget, text: cstring, - tooltip_text: cstring, - tooltip_private_text: cstring, icon: PWidget, - callback: TSignalFunc, user_data: gpointer): PWidget{. - cdecl, dynlib: lib, importc: "gtk_toolbar_prepend_element".} -proc insert_element*(toolbar: PToolbar, thetype: TToolbarChildType, - widget: PWidget, text: cstring, - tooltip_text: cstring, - tooltip_private_text: cstring, icon: PWidget, - callback: TSignalFunc, user_data: gpointer, - position: gint): PWidget{.cdecl, dynlib: lib, - importc: "gtk_toolbar_insert_element".} -proc append_widget*(toolbar: PToolbar, widget: PWidget, - tooltip_text: cstring, tooltip_private_text: cstring){. - cdecl, dynlib: lib, importc: "gtk_toolbar_append_widget".} -proc prepend_widget*(toolbar: PToolbar, widget: PWidget, - tooltip_text: cstring, - tooltip_private_text: cstring){.cdecl, dynlib: lib, - importc: "gtk_toolbar_prepend_widget".} -proc insert_widget*(toolbar: PToolbar, widget: PWidget, - tooltip_text: cstring, - tooltip_private_text: cstring, position: gint){. - cdecl, dynlib: lib, importc: "gtk_toolbar_insert_widget".} -proc set_orientation*(toolbar: PToolbar, orientation: TOrientation){. - cdecl, dynlib: lib, importc: "gtk_toolbar_set_orientation".} -proc set_style*(toolbar: PToolbar, style: TToolbarStyle){.cdecl, - dynlib: lib, importc: "gtk_toolbar_set_style".} -proc set_icon_size*(toolbar: PToolbar, icon_size: TIconSize){.cdecl, - dynlib: lib, importc: "gtk_toolbar_set_icon_size".} -proc set_tooltips*(toolbar: PToolbar, enable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_toolbar_set_tooltips".} -proc unset_style*(toolbar: PToolbar){.cdecl, dynlib: lib, - importc: "gtk_toolbar_unset_style".} -proc unset_icon_size*(toolbar: PToolbar){.cdecl, dynlib: lib, - importc: "gtk_toolbar_unset_icon_size".} -proc get_orientation*(toolbar: PToolbar): TOrientation{.cdecl, - dynlib: lib, importc: "gtk_toolbar_get_orientation".} -proc get_style*(toolbar: PToolbar): TToolbarStyle{.cdecl, dynlib: lib, - importc: "gtk_toolbar_get_style".} -proc get_icon_size*(toolbar: PToolbar): TIconSize{.cdecl, dynlib: lib, - importc: "gtk_toolbar_get_icon_size".} -proc get_tooltips*(toolbar: PToolbar): gboolean{.cdecl, dynlib: lib, - importc: "gtk_toolbar_get_tooltips".} -const - bm_TGtkTree_selection_mode* = 0x0003'i16 - bp_TGtkTree_selection_mode* = 0'i16 - bm_TGtkTree_view_mode* = 0x0004'i16 - bp_TGtkTree_view_mode* = 2'i16 - bm_TGtkTree_view_line* = 0x0008'i16 - bp_TGtkTree_view_line* = 3'i16 - -proc TYPE_TREE*(): GType -proc TREE*(obj: pointer): PTree -proc TREE_CLASS*(klass: pointer): PTreeClass -proc IS_TREE*(obj: pointer): bool -proc IS_TREE_CLASS*(klass: pointer): bool -proc TREE_GET_CLASS*(obj: pointer): PTreeClass -proc IS_ROOT_TREE*(obj: pointer): bool -proc TREE_ROOT_TREE*(obj: pointer): PTree -proc TREE_SELECTION_OLD*(obj: pointer): PGList -proc selection_mode*(a: PTree): guint -proc set_selection_mode*(a: PTree, `selection_mode`: guint) -proc view_mode*(a: PTree): guint -proc set_view_mode*(a: PTree, `view_mode`: guint) -proc view_line*(a: PTree): guint -proc set_view_line*(a: PTree, `view_line`: guint) -proc tree_get_type*(): TType{.cdecl, dynlib: lib, importc: "gtk_tree_get_type".} -proc tree_new*(): PTree{.cdecl, dynlib: lib, importc: "gtk_tree_new".} -proc append*(tree: PTree, tree_item: PWidget){.cdecl, dynlib: lib, - importc: "gtk_tree_append".} -proc prepend*(tree: PTree, tree_item: PWidget){.cdecl, dynlib: lib, - importc: "gtk_tree_prepend".} -proc insert*(tree: PTree, tree_item: PWidget, position: gint){.cdecl, - dynlib: lib, importc: "gtk_tree_insert".} -proc remove_items*(tree: PTree, items: PGList){.cdecl, dynlib: lib, - importc: "gtk_tree_remove_items".} -proc clear_items*(tree: PTree, start: gint, theEnd: gint){.cdecl, - dynlib: lib, importc: "gtk_tree_clear_items".} -proc select_item*(tree: PTree, item: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_select_item".} -proc unselect_item*(tree: PTree, item: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_unselect_item".} -proc select_child*(tree: PTree, tree_item: PWidget){.cdecl, dynlib: lib, - importc: "gtk_tree_select_child".} -proc unselect_child*(tree: PTree, tree_item: PWidget){.cdecl, dynlib: lib, - importc: "gtk_tree_unselect_child".} -proc child_position*(tree: PTree, child: PWidget): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_child_position".} -proc set_selection_mode*(tree: PTree, mode: TSelectionMode){.cdecl, - dynlib: lib, importc: "gtk_tree_set_selection_mode".} -proc set_view_mode*(tree: PTree, mode: TTreeViewMode){.cdecl, dynlib: lib, - importc: "gtk_tree_set_view_mode".} -proc set_view_lines*(tree: PTree, flag: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_set_view_lines".} -proc remove_item*(tree: PTree, child: PWidget){.cdecl, dynlib: lib, - importc: "gtk_tree_remove_item".} -proc TYPE_TREE_DRAG_SOURCE*(): GType -proc TREE_DRAG_SOURCE*(obj: pointer): PTreeDragSource -proc IS_TREE_DRAG_SOURCE*(obj: pointer): bool -proc TREE_DRAG_SOURCE_GET_IFACE*(obj: pointer): PTreeDragSourceIface -proc tree_drag_source_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_tree_drag_source_get_type".} -proc source_row_draggable*(drag_source: PTreeDragSource, - path: PTreePath): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_drag_source_row_draggable".} -proc source_drag_data_delete*(drag_source: PTreeDragSource, - path: PTreePath): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_drag_source_drag_data_delete".} -proc source_drag_data_get*(drag_source: PTreeDragSource, - path: PTreePath, - selection_data: PSelectionData): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_drag_source_drag_data_get".} -proc TYPE_TREE_DRAG_DEST*(): GType -proc TREE_DRAG_DEST*(obj: pointer): PTreeDragDest -proc IS_TREE_DRAG_DEST*(obj: pointer): bool -proc TREE_DRAG_DEST_GET_IFACE*(obj: pointer): PTreeDragDestIface -proc tree_drag_dest_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_tree_drag_dest_get_type".} -proc dest_drag_data_received*(drag_dest: PTreeDragDest, - dest: PTreePath, - selection_data: PSelectionData): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_drag_dest_drag_data_received".} -proc dest_row_drop_possible*(drag_dest: PTreeDragDest, - dest_path: PTreePath, - selection_data: PSelectionData): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_drag_dest_row_drop_possible".} -proc tree_set_row_drag_data*(selection_data: PSelectionData, - tree_model: PTreeModel, path: PTreePath): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_set_row_drag_data".} -const - bm_TGtkTreeItem_expanded* = 0x0001'i16 - bp_TGtkTreeItem_expanded* = 0'i16 - -proc TYPE_TREE_ITEM*(): GType -proc TREE_ITEM*(obj: pointer): PTreeItem -proc TREE_ITEM_CLASS*(klass: pointer): PTreeItemClass -proc IS_TREE_ITEM*(obj: pointer): bool -proc IS_TREE_ITEM_CLASS*(klass: pointer): bool -proc TREE_ITEM_GET_CLASS*(obj: pointer): PTreeItemClass -proc TREE_ITEM_SUBTREE*(obj: pointer): PWidget -proc expanded*(a: PTreeItem): guint -proc set_expanded*(a: PTreeItem, `expanded`: guint) -proc tree_item_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tree_item_get_type".} -proc tree_item_new*(): PTreeItem{.cdecl, dynlib: lib, - importc: "gtk_tree_item_new".} -proc tree_item_new*(`label`: cstring): PTreeItem{.cdecl, dynlib: lib, - importc: "gtk_tree_item_new_with_label".} -proc set_subtree*(tree_item: PTreeItem, subtree: PWidget){.cdecl, - dynlib: lib, importc: "gtk_tree_item_set_subtree".} -proc remove_subtree*(tree_item: PTreeItem){.cdecl, dynlib: lib, - importc: "gtk_tree_item_remove_subtree".} -proc select*(tree_item: PTreeItem){.cdecl, dynlib: lib, - importc: "gtk_tree_item_select".} -proc deselect*(tree_item: PTreeItem){.cdecl, dynlib: lib, - importc: "gtk_tree_item_deselect".} -proc expand*(tree_item: PTreeItem){.cdecl, dynlib: lib, - importc: "gtk_tree_item_expand".} -proc collapse*(tree_item: PTreeItem){.cdecl, dynlib: lib, - importc: "gtk_tree_item_collapse".} -proc TYPE_TREE_SELECTION*(): GType -proc TREE_SELECTION*(obj: pointer): PTreeSelection -proc TREE_SELECTION_CLASS*(klass: pointer): PTreeSelectionClass -proc IS_TREE_SELECTION*(obj: pointer): bool -proc IS_TREE_SELECTION_CLASS*(klass: pointer): bool -proc TREE_SELECTION_GET_CLASS*(obj: pointer): PTreeSelectionClass -proc tree_selection_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tree_selection_get_type".} -proc set_mode*(selection: PTreeSelection, thetype: TSelectionMode){. - cdecl, dynlib: lib, importc: "gtk_tree_selection_set_mode".} -proc get_mode*(selection: PTreeSelection): TSelectionMode{.cdecl, - dynlib: lib, importc: "gtk_tree_selection_get_mode".} -proc set_select_function*(selection: PTreeSelection, - fun: TTreeSelectionFunc, data: gpointer, destroy: TDestroyNotify){.cdecl, - dynlib: lib, importc: "gtk_tree_selection_set_select_function".} -proc get_user_data*(selection: PTreeSelection): gpointer{.cdecl, - dynlib: lib, importc: "gtk_tree_selection_get_user_data".} -proc get_tree_view*(selection: PTreeSelection): PTreeView{.cdecl, - dynlib: lib, importc: "gtk_tree_selection_get_tree_view".} -proc get_selected*(selection: PTreeSelection, - model: PPGtkTreeModel, iter: PTreeIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_selection_get_selected".} -proc get_selected_rows*(selection: PTreeSelection, - model: PPGtkTreeModel): PGList{.cdecl, - dynlib: lib, importc: "gtk_tree_selection_get_selected_rows".} -proc selected_foreach*(selection: PTreeSelection, - fun: TTreeSelectionForeachFunc, - data: gpointer){.cdecl, dynlib: lib, - importc: "gtk_tree_selection_selected_foreach".} -proc select_path*(selection: PTreeSelection, path: PTreePath){. - cdecl, dynlib: lib, importc: "gtk_tree_selection_select_path".} -proc unselect_path*(selection: PTreeSelection, path: PTreePath){. - cdecl, dynlib: lib, importc: "gtk_tree_selection_unselect_path".} -proc select_iter*(selection: PTreeSelection, iter: PTreeIter){. - cdecl, dynlib: lib, importc: "gtk_tree_selection_select_iter".} -proc unselect_iter*(selection: PTreeSelection, iter: PTreeIter){. - cdecl, dynlib: lib, importc: "gtk_tree_selection_unselect_iter".} -proc path_is_selected*(selection: PTreeSelection, path: PTreePath): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_selection_path_is_selected".} -proc iter_is_selected*(selection: PTreeSelection, iter: PTreeIter): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_selection_iter_is_selected".} -proc select_all*(selection: PTreeSelection){.cdecl, dynlib: lib, - importc: "gtk_tree_selection_select_all".} -proc unselect_all*(selection: PTreeSelection){.cdecl, - dynlib: lib, importc: "gtk_tree_selection_unselect_all".} -proc select_range*(selection: PTreeSelection, - start_path: PTreePath, end_path: PTreePath){. - cdecl, dynlib: lib, importc: "gtk_tree_selection_select_range".} -const - bm_TGtkTreeStore_columns_dirty* = 0x0001'i16 - bp_TGtkTreeStore_columns_dirty* = 0'i16 - -proc TYPE_TREE_STORE*(): GType -proc TREE_STORE*(obj: pointer): PTreeStore -proc TREE_STORE_CLASS*(klass: pointer): PTreeStoreClass -proc IS_TREE_STORE*(obj: pointer): bool -proc IS_TREE_STORE_CLASS*(klass: pointer): bool -proc TREE_STORE_GET_CLASS*(obj: pointer): PTreeStoreClass -proc columns_dirty*(a: PTreeStore): guint -proc set_columns_dirty*(a: PTreeStore, `columns_dirty`: guint) -proc tree_store_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tree_store_get_type".} -proc tree_store_newv*(n_columns: gint, types: PGType): PTreeStore{.cdecl, - dynlib: lib, importc: "gtk_tree_store_newv".} -proc set_column_types*(tree_store: PTreeStore, n_columns: gint, - types: PGType){.cdecl, dynlib: lib, - importc: "gtk_tree_store_set_column_types".} -proc set_value*(tree_store: PTreeStore, iter: PTreeIter, - column: gint, value: PGValue){.cdecl, dynlib: lib, - importc: "gtk_tree_store_set_value".} -proc remove*(tree_store: PTreeStore, iter: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_tree_store_remove".} -proc insert*(tree_store: PTreeStore, iter: PTreeIter, - parent: PTreeIter, position: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_store_insert".} -proc insert_before*(tree_store: PTreeStore, iter: PTreeIter, - parent: PTreeIter, sibling: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_tree_store_insert_before".} -proc insert_after*(tree_store: PTreeStore, iter: PTreeIter, - parent: PTreeIter, sibling: PTreeIter){.cdecl, - dynlib: lib, importc: "gtk_tree_store_insert_after".} -proc prepend*(tree_store: PTreeStore, iter: PTreeIter, - parent: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_tree_store_prepend".} -proc append*(tree_store: PTreeStore, iter: PTreeIter, - parent: PTreeIter){.cdecl, dynlib: lib, - importc: "gtk_tree_store_append".} -proc is_ancestor*(tree_store: PTreeStore, iter: PTreeIter, - descendant: PTreeIter): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_store_is_ancestor".} -proc iter_depth*(tree_store: PTreeStore, iter: PTreeIter): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_store_iter_depth".} -proc clear*(tree_store: PTreeStore){.cdecl, dynlib: lib, - importc: "gtk_tree_store_clear".} -const - bm_TGtkTreeViewColumn_visible* = 0x0001'i16 - bp_TGtkTreeViewColumn_visible* = 0'i16 - bm_TGtkTreeViewColumn_resizable* = 0x0002'i16 - bp_TGtkTreeViewColumn_resizable* = 1'i16 - bm_TGtkTreeViewColumn_clickable* = 0x0004'i16 - bp_TGtkTreeViewColumn_clickable* = 2'i16 - bm_TGtkTreeViewColumn_dirty* = 0x0008'i16 - bp_TGtkTreeViewColumn_dirty* = 3'i16 - bm_TGtkTreeViewColumn_show_sort_indicator* = 0x0010'i16 - bp_TGtkTreeViewColumn_show_sort_indicator* = 4'i16 - bm_TGtkTreeViewColumn_maybe_reordered* = 0x0020'i16 - bp_TGtkTreeViewColumn_maybe_reordered* = 5'i16 - bm_TGtkTreeViewColumn_reorderable* = 0x0040'i16 - bp_TGtkTreeViewColumn_reorderable* = 6'i16 - bm_TGtkTreeViewColumn_use_resized_width* = 0x0080'i16 - bp_TGtkTreeViewColumn_use_resized_width* = 7'i16 - -proc TYPE_TREE_VIEW_COLUMN*(): GType -proc TREE_VIEW_COLUMN*(obj: pointer): PTreeViewColumn -proc TREE_VIEW_COLUMN_CLASS*(klass: pointer): PTreeViewColumnClass -proc IS_TREE_VIEW_COLUMN*(obj: pointer): bool -proc IS_TREE_VIEW_COLUMN_CLASS*(klass: pointer): bool -proc TREE_VIEW_COLUMN_GET_CLASS*(obj: pointer): PTreeViewColumnClass -proc visible*(a: PTreeViewColumn): guint -proc set_visible*(a: PTreeViewColumn, `visible`: guint) -proc resizable*(a: PTreeViewColumn): guint -proc set_resizable*(a: PTreeViewColumn, `resizable`: guint) -proc clickable*(a: PTreeViewColumn): guint -proc set_clickable*(a: PTreeViewColumn, `clickable`: guint) -proc dirty*(a: PTreeViewColumn): guint -proc set_dirty*(a: PTreeViewColumn, `dirty`: guint) -proc show_sort_indicator*(a: PTreeViewColumn): guint -proc set_show_sort_indicator*(a: PTreeViewColumn, - `show_sort_indicator`: guint) -proc maybe_reordered*(a: PTreeViewColumn): guint -proc set_maybe_reordered*(a: PTreeViewColumn, `maybe_reordered`: guint) -proc reorderable*(a: PTreeViewColumn): guint -proc set_reorderable*(a: PTreeViewColumn, `reorderable`: guint) -proc use_resized_width*(a: PTreeViewColumn): guint -proc set_use_resized_width*(a: PTreeViewColumn, `use_resized_width`: guint) -proc tree_view_column_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_get_type".} -proc tree_view_column_new*(): PTreeViewColumn{.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_new".} -proc column_pack_start*(tree_column: PTreeViewColumn, - cell: PCellRenderer, expand: gboolean){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_pack_start".} -proc column_pack_end*(tree_column: PTreeViewColumn, - cell: PCellRenderer, expand: gboolean){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_pack_end".} -proc column_clear*(tree_column: PTreeViewColumn){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_clear".} -proc column_get_cell_renderers*(tree_column: PTreeViewColumn): PGList{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_cell_renderers".} -proc column_add_attribute*(tree_column: PTreeViewColumn, - cell_renderer: PCellRenderer, - attribute: cstring, column: gint){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_add_attribute".} -proc column_set_cell_data_func*(tree_column: PTreeViewColumn, - cell_renderer: PCellRenderer, fun: TTreeCellDataFunc, func_data: gpointer, - destroy: TDestroyNotify){.cdecl, dynlib: lib, importc: "gtk_tree_view_column_set_cell_data_func".} -proc column_clear_attributes*(tree_column: PTreeViewColumn, - cell_renderer: PCellRenderer){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_clear_attributes".} -proc column_set_spacing*(tree_column: PTreeViewColumn, spacing: gint){. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_set_spacing".} -proc column_get_spacing*(tree_column: PTreeViewColumn): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_get_spacing".} -proc column_set_visible*(tree_column: PTreeViewColumn, - visible: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_visible".} -proc column_get_visible*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_visible".} -proc column_set_resizable*(tree_column: PTreeViewColumn, - resizable: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_resizable".} -proc column_get_resizable*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_resizable".} -proc column_set_sizing*(tree_column: PTreeViewColumn, - thetype: TTreeViewColumnSizing){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_set_sizing".} -proc column_get_sizing*(tree_column: PTreeViewColumn): TTreeViewColumnSizing{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_sizing".} -proc column_get_width*(tree_column: PTreeViewColumn): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_get_width".} -proc column_get_fixed_width*(tree_column: PTreeViewColumn): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_fixed_width".} -proc column_set_fixed_width*(tree_column: PTreeViewColumn, - fixed_width: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_fixed_width".} -proc column_set_min_width*(tree_column: PTreeViewColumn, - min_width: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_min_width".} -proc column_get_min_width*(tree_column: PTreeViewColumn): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_get_min_width".} -proc column_set_max_width*(tree_column: PTreeViewColumn, - max_width: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_max_width".} -proc column_get_max_width*(tree_column: PTreeViewColumn): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_get_max_width".} -proc column_clicked*(tree_column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_clicked".} -proc column_set_title*(tree_column: PTreeViewColumn, title: cstring){. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_set_title".} -proc column_get_title*(tree_column: PTreeViewColumn): cstring{.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_get_title".} -proc column_set_clickable*(tree_column: PTreeViewColumn, - clickable: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_clickable".} -proc column_get_clickable*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_clickable".} -proc column_set_widget*(tree_column: PTreeViewColumn, widget: PWidget){. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_set_widget".} -proc column_get_widget*(tree_column: PTreeViewColumn): PWidget{.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_get_widget".} -proc column_set_alignment*(tree_column: PTreeViewColumn, - xalign: gfloat){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_alignment".} -proc column_get_alignment*(tree_column: PTreeViewColumn): gfloat{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_alignment".} -proc column_set_reorderable*(tree_column: PTreeViewColumn, - reorderable: gboolean){.cdecl, - dynlib: lib, importc: "gtk_tree_view_column_set_reorderable".} -proc column_get_reorderable*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_reorderable".} -proc column_set_sort_column_id*(tree_column: PTreeViewColumn, - sort_column_id: gint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_sort_column_id".} -proc column_get_sort_column_id*(tree_column: PTreeViewColumn): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_sort_column_id".} -proc column_set_sort_indicator*(tree_column: PTreeViewColumn, - setting: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_sort_indicator".} -proc column_get_sort_indicator*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_sort_indicator".} -proc column_set_sort_order*(tree_column: PTreeViewColumn, - order: TSortType){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_set_sort_order".} -proc column_get_sort_order*(tree_column: PTreeViewColumn): TSortType{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_sort_order".} -proc column_cell_set_cell_data*(tree_column: PTreeViewColumn, - tree_model: PTreeModel, iter: PTreeIter, is_expander: gboolean, - is_expanded: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_cell_set_cell_data".} -proc column_cell_get_size*(tree_column: PTreeViewColumn, - cell_area: gdk2.PRectangle, x_offset: Pgint, - y_offset: Pgint, width: Pgint, - height: Pgint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_cell_get_size".} -proc column_cell_is_visible*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_cell_is_visible".} -proc column_focus_cell*(tree_column: PTreeViewColumn, - cell: PCellRenderer){.cdecl, dynlib: lib, - importc: "gtk_tree_view_column_focus_cell".} -proc column_set_expand*(tree_column: PTreeViewColumn, Expand: gboolean){. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_set_expand".} -proc column_get_expand*(tree_column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_column_get_expand".} -const - RBNODE_BLACK* = 1 shl 0 - RBNODE_RED* = 1 shl 1 - RBNODE_IS_PARENT* = 1 shl 2 - RBNODE_IS_SELECTED* = 1 shl 3 - RBNODE_IS_PRELIT* = 1 shl 4 - RBNODE_IS_SEMI_COLLAPSED* = 1 shl 5 - RBNODE_IS_SEMI_EXPANDED* = 1 shl 6 - RBNODE_INVALID* = 1 shl 7 - RBNODE_COLUMN_INVALID* = 1 shl 8 - RBNODE_DESCENDANTS_INVALID* = 1 shl 9 - RBNODE_NON_COLORS* = RBNODE_IS_PARENT or RBNODE_IS_SELECTED or - RBNODE_IS_PRELIT or RBNODE_IS_SEMI_COLLAPSED or RBNODE_IS_SEMI_EXPANDED or - RBNODE_INVALID or RBNODE_COLUMN_INVALID or RBNODE_DESCENDANTS_INVALID - -const - bm_TGtkRBNode_flags* = 0x3FFF'i16 - bp_TGtkRBNode_flags* = 0'i16 - bm_TGtkRBNode_parity* = 0x4000'i16 - bp_TGtkRBNode_parity* = 14'i16 - -proc flags*(a: PRBNode): guint -proc set_flags*(a: PRBNode, `flags`: guint) -proc parity*(a: PRBNode): guint -proc set_parity*(a: PRBNode, `parity`: guint) -proc GET_COLOR*(node: PRBNode): guint -proc SET_COLOR*(node: PRBNode, color: guint) -proc GET_HEIGHT*(node: PRBNode): gint -proc SET_FLAG*(node: PRBNode, flag: guint16) -proc UNSET_FLAG*(node: PRBNode, flag: guint16) -proc FLAG_SET*(node: PRBNode, flag: guint): bool -proc rbtree_push_allocator*(allocator: PGAllocator){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_push_allocator".} -proc rbtree_pop_allocator*(){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_pop_allocator".} -proc rbtree_new*(): PRBTree{.cdecl, dynlib: lib, importc: "_gtk_rbtree_new".} -proc free*(tree: PRBTree){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_free".} -proc remove*(tree: PRBTree){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_remove".} -proc destroy*(tree: PRBTree){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_destroy".} -proc insert_before*(tree: PRBTree, node: PRBNode, height: gint, - valid: gboolean): PRBNode{.cdecl, dynlib: lib, - importc: "_gtk_rbtree_insert_before".} -proc insert_after*(tree: PRBTree, node: PRBNode, height: gint, - valid: gboolean): PRBNode{.cdecl, dynlib: lib, - importc: "_gtk_rbtree_insert_after".} -proc remove_node*(tree: PRBTree, node: PRBNode){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_remove_node".} -proc reorder*(tree: PRBTree, new_order: Pgint, length: gint){.cdecl, - dynlib: lib, importc: "_gtk_rbtree_reorder".} -proc find_count*(tree: PRBTree, count: gint): PRBNode{.cdecl, - dynlib: lib, importc: "_gtk_rbtree_find_count".} -proc node_set_height*(tree: PRBTree, node: PRBNode, height: gint){. - cdecl, dynlib: lib, importc: "_gtk_rbtree_node_set_height".} -proc node_mark_invalid*(tree: PRBTree, node: PRBNode){.cdecl, - dynlib: lib, importc: "_gtk_rbtree_node_mark_invalid".} -proc node_mark_valid*(tree: PRBTree, node: PRBNode){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_node_mark_valid".} -proc column_invalid*(tree: PRBTree){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_column_invalid".} -proc mark_invalid*(tree: PRBTree){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_mark_invalid".} -proc set_fixed_height*(tree: PRBTree, height: gint){.cdecl, dynlib: lib, - importc: "_gtk_rbtree_set_fixed_height".} -proc node_find_offset*(tree: PRBTree, node: PRBNode): gint{.cdecl, - dynlib: lib, importc: "_gtk_rbtree_node_find_offset".} -proc node_find_parity*(tree: PRBTree, node: PRBNode): gint{.cdecl, - dynlib: lib, importc: "_gtk_rbtree_node_find_parity".} -proc traverse*(tree: PRBTree, node: PRBNode, order: TGTraverseType, - fun: TRBTreeTraverseFunc, data: gpointer){.cdecl, - dynlib: lib, importc: "_gtk_rbtree_traverse".} -proc next*(tree: PRBTree, node: PRBNode): PRBNode{.cdecl, dynlib: lib, - importc: "_gtk_rbtree_next".} -proc prev*(tree: PRBTree, node: PRBNode): PRBNode{.cdecl, dynlib: lib, - importc: "_gtk_rbtree_prev".} -proc get_depth*(tree: PRBTree): gint{.cdecl, dynlib: lib, - importc: "_gtk_rbtree_get_depth".} -const - TREE_VIEW_DRAG_WIDTH* = 6 - TREE_VIEW_IS_LIST* = 1 shl 0 - TREE_VIEW_SHOW_EXPANDERS* = 1 shl 1 - TREE_VIEW_IN_COLUMN_RESIZE* = 1 shl 2 - TREE_VIEW_ARROW_PRELIT* = 1 shl 3 - TREE_VIEW_HEADERS_VISIBLE* = 1 shl 4 - TREE_VIEW_DRAW_KEYFOCUS* = 1 shl 5 - TREE_VIEW_MODEL_SETUP* = 1 shl 6 - TREE_VIEW_IN_COLUMN_DRAG* = 1 shl 7 - DRAG_COLUMN_WINDOW_STATE_UNSET* = 0 - DRAG_COLUMN_WINDOW_STATE_ORIGINAL* = 1 - DRAG_COLUMN_WINDOW_STATE_ARROW* = 2 - DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT* = 3 - DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT* = 4 - -proc SET_FLAG*(tree_view: PTreeView, flag: guint) -proc UNSET_FLAG*(tree_view: PTreeView, flag: guint) -proc FLAG_SET*(tree_view: PTreeView, flag: guint): bool -proc HEADER_HEIGHT*(tree_view: PTreeView): int32 -proc COLUMN_REQUESTED_WIDTH*(column: PTreeViewColumn): int32 -proc DRAW_EXPANDERS*(tree_view: PTreeView): bool -proc COLUMN_DRAG_DEAD_MULTIPLIER*(tree_view: PTreeView): int32 -const - bm_TGtkTreeViewPrivate_scroll_to_use_align* = 0x0001'i16 - bp_TGtkTreeViewPrivate_scroll_to_use_align* = 0'i16 - bm_TGtkTreeViewPrivate_fixed_height_check* = 0x0002'i16 - bp_TGtkTreeViewPrivate_fixed_height_check* = 1'i16 - bm_TGtkTreeViewPrivate_reorderable* = 0x0004'i16 - bp_TGtkTreeViewPrivate_reorderable* = 2'i16 - bm_TGtkTreeViewPrivate_header_has_focus* = 0x0008'i16 - bp_TGtkTreeViewPrivate_header_has_focus* = 3'i16 - bm_TGtkTreeViewPrivate_drag_column_window_state* = 0x0070'i16 - bp_TGtkTreeViewPrivate_drag_column_window_state* = 4'i16 - bm_TGtkTreeViewPrivate_has_rules* = 0x0080'i16 - bp_TGtkTreeViewPrivate_has_rules* = 7'i16 - bm_TGtkTreeViewPrivate_mark_rows_col_dirty* = 0x0100'i16 - bp_TGtkTreeViewPrivate_mark_rows_col_dirty* = 8'i16 - bm_TGtkTreeViewPrivate_enable_search* = 0x0200'i16 - bp_TGtkTreeViewPrivate_enable_search* = 9'i16 - bm_TGtkTreeViewPrivate_disable_popdown* = 0x0400'i16 - bp_TGtkTreeViewPrivate_disable_popdown* = 10'i16 - -proc scroll_to_use_align*(a: PTreeViewPrivate): guint -proc set_scroll_to_use_align*(a: PTreeViewPrivate, - `scroll_to_use_align`: guint) -proc fixed_height_check*(a: PTreeViewPrivate): guint -proc set_fixed_height_check*(a: PTreeViewPrivate, - `fixed_height_check`: guint) -proc reorderable*(a: PTreeViewPrivate): guint -proc set_reorderable*(a: PTreeViewPrivate, `reorderable`: guint) -proc header_has_focus*(a: PTreeViewPrivate): guint -proc set_header_has_focus*(a: PTreeViewPrivate, `header_has_focus`: guint) -proc drag_column_window_state*(a: PTreeViewPrivate): guint -proc set_drag_column_window_state*(a: PTreeViewPrivate, - `drag_column_window_state`: guint) -proc has_rules*(a: PTreeViewPrivate): guint -proc set_has_rules*(a: PTreeViewPrivate, `has_rules`: guint) -proc mark_rows_col_dirty*(a: PTreeViewPrivate): guint -proc set_mark_rows_col_dirty*(a: PTreeViewPrivate, - `mark_rows_col_dirty`: guint) -proc enable_search*(a: PTreeViewPrivate): guint -proc set_enable_search*(a: PTreeViewPrivate, `enable_search`: guint) -proc disable_popdown*(a: PTreeViewPrivate): guint -proc set_disable_popdown*(a: PTreeViewPrivate, `disable_popdown`: guint) -proc internal_select_node*(selection: PTreeSelection, - node: PRBNode, tree: PRBTree, path: PTreePath, state: gdk2.TModifierType, - override_browse_mode: gboolean){.cdecl, dynlib: lib, importc: "_gtk_tree_selection_internal_select_node".} -proc find_node*(tree_view: PTreeView, path: PTreePath, - tree: var PRBTree, node: var PRBNode): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_find_node".} -proc find_path*(tree_view: PTreeView, tree: PRBTree, node: PRBNode): PTreePath{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_find_path".} -proc child_move_resize*(tree_view: PTreeView, widget: PWidget, - x: gint, y: gint, width: gint, height: gint){. - cdecl, dynlib: lib, importc: "_gtk_tree_view_child_move_resize".} -proc queue_draw_node*(tree_view: PTreeView, tree: PRBTree, - node: PRBNode, clip_rect: gdk2.PRectangle){. - cdecl, dynlib: lib, importc: "_gtk_tree_view_queue_draw_node".} -proc column_realize_button*(column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_realize_button".} -proc column_unrealize_button*(column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_unrealize_button".} -proc column_set_tree_view*(column: PTreeViewColumn, - tree_view: PTreeView){.cdecl, dynlib: lib, - importc: "_gtk_tree_view_column_set_tree_view".} -proc column_unset_tree_view*(column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_unset_tree_view".} -proc column_set_width*(column: PTreeViewColumn, width: gint){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_set_width".} -proc column_start_drag*(tree_view: PTreeView, column: PTreeViewColumn){. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_start_drag".} -proc column_start_editing*(tree_column: PTreeViewColumn, - editable_widget: PCellEditable){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_start_editing".} -proc column_stop_editing*(tree_column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_stop_editing".} -proc install_mark_rows_col_dirty*(tree_view: PTreeView){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_install_mark_rows_col_dirty".} -proc DOgtk_tree_view_column_autosize*(tree_view: PTreeView, - column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_autosize".} -proc column_has_editable_cell*(column: PTreeViewColumn): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_has_editable_cell".} -proc column_get_edited_cell*(column: PTreeViewColumn): PCellRenderer{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_get_edited_cell".} -proc column_count_special_cells*(column: PTreeViewColumn): gint{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_count_special_cells".} -proc column_get_cell_at_pos*(column: PTreeViewColumn, x: gint): PCellRenderer{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_get_cell_at_pos".} -proc tree_selection_new*(): PTreeSelection{.cdecl, dynlib: lib, - importc: "_gtk_tree_selection_new".} -proc selection_new*(tree_view: PTreeView): PTreeSelection{. - cdecl, dynlib: lib, importc: "_gtk_tree_selection_new_with_tree_view".} -proc set_tree_view*(selection: PTreeSelection, - tree_view: PTreeView){.cdecl, dynlib: lib, - importc: "_gtk_tree_selection_set_tree_view".} -proc column_cell_render*(tree_column: PTreeViewColumn, - window: gdk2.PWindow, - background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, - expose_area: gdk2.PRectangle, flags: guint){. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_cell_render".} -proc column_cell_focus*(tree_column: PTreeViewColumn, direction: gint, - left: gboolean, right: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_cell_focus".} -proc column_cell_draw_focus*(tree_column: PTreeViewColumn, - window: gdk2.PWindow, - background_area: gdk2.PRectangle, - cell_area: gdk2.PRectangle, - expose_area: gdk2.PRectangle, flags: guint){. - cdecl, dynlib: lib, importc: "_gtk_tree_view_column_cell_draw_focus".} -proc column_cell_set_dirty*(tree_column: PTreeViewColumn, - install_handler: gboolean){.cdecl, - dynlib: lib, importc: "_gtk_tree_view_column_cell_set_dirty".} -proc column_get_neighbor_sizes*(column: PTreeViewColumn, - cell: PCellRenderer, left: Pgint, right: Pgint){.cdecl, dynlib: lib, - importc: "_gtk_tree_view_column_get_neighbor_sizes".} -proc TYPE_TREE_VIEW*(): GType -proc TREE_VIEW*(obj: pointer): PTreeView -proc TREE_VIEW_CLASS*(klass: pointer): PTreeViewClass -proc IS_TREE_VIEW*(obj: pointer): bool -proc IS_TREE_VIEW_CLASS*(klass: pointer): bool -proc TREE_VIEW_GET_CLASS*(obj: pointer): PTreeViewClass -proc tree_view_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_tree_view_get_type".} -proc tree_view_new*(): PTreeView{.cdecl, dynlib: lib, - importc: "gtk_tree_view_new".} -proc tree_view_new*(model: PTreeModel): PTreeView{.cdecl, - dynlib: lib, importc: "gtk_tree_view_new_with_model".} -proc get_model*(tree_view: PTreeView): PTreeModel{.cdecl, dynlib: lib, - importc: "gtk_tree_view_get_model".} -proc set_model*(tree_view: PTreeView, model: PTreeModel){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_model".} -proc get_selection*(tree_view: PTreeView): PTreeSelection{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_selection".} -proc get_hadjustment*(tree_view: PTreeView): PAdjustment{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_hadjustment".} -proc set_hadjustment*(tree_view: PTreeView, adjustment: PAdjustment){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_hadjustment".} -proc get_vadjustment*(tree_view: PTreeView): PAdjustment{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_vadjustment".} -proc set_vadjustment*(tree_view: PTreeView, adjustment: PAdjustment){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_vadjustment".} -proc get_headers_visible*(tree_view: PTreeView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_headers_visible".} -proc set_headers_visible*(tree_view: PTreeView, - headers_visible: gboolean){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_headers_visible".} -proc columns_autosize*(tree_view: PTreeView){.cdecl, dynlib: lib, - importc: "gtk_tree_view_columns_autosize".} -proc set_headers_clickable*(tree_view: PTreeView, setting: gboolean){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_headers_clickable".} -proc set_rules_hint*(tree_view: PTreeView, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_rules_hint".} -proc get_rules_hint*(tree_view: PTreeView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_rules_hint".} -proc append_column*(tree_view: PTreeView, column: PTreeViewColumn): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_view_append_column".} -proc remove_column*(tree_view: PTreeView, column: PTreeViewColumn): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_view_remove_column".} -proc insert_column*(tree_view: PTreeView, column: PTreeViewColumn, - position: gint): gint{.cdecl, dynlib: lib, - importc: "gtk_tree_view_insert_column".} -proc insert_column_with_data_func*(tree_view: PTreeView, - position: gint, title: cstring, cell: PCellRenderer, - fun: TTreeCellDataFunc, data: gpointer, dnotify: TGDestroyNotify): gint{. - cdecl, dynlib: lib, importc: "gtk_tree_view_insert_column_with_data_func".} -proc get_column*(tree_view: PTreeView, n: gint): PTreeViewColumn{. - cdecl, dynlib: lib, importc: "gtk_tree_view_get_column".} -proc get_columns*(tree_view: PTreeView): PGList{.cdecl, dynlib: lib, - importc: "gtk_tree_view_get_columns".} -proc move_column_after*(tree_view: PTreeView, column: PTreeViewColumn, - base_column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "gtk_tree_view_move_column_after".} -proc set_expander_column*(tree_view: PTreeView, - column: PTreeViewColumn){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_expander_column".} -proc get_expander_column*(tree_view: PTreeView): PTreeViewColumn{. - cdecl, dynlib: lib, importc: "gtk_tree_view_get_expander_column".} -proc set_column_drag_function*(tree_view: PTreeView, - fun: TTreeViewColumnDropFunc, user_data: gpointer, destroy: TDestroyNotify){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_column_drag_function".} -proc scroll_to_point*(tree_view: PTreeView, tree_x: gint, tree_y: gint){. - cdecl, dynlib: lib, importc: "gtk_tree_view_scroll_to_point".} -proc scroll_to_cell*(tree_view: PTreeView, path: PTreePath, - column: PTreeViewColumn, use_align: gboolean, - row_align: gfloat, col_align: gfloat){.cdecl, - dynlib: lib, importc: "gtk_tree_view_scroll_to_cell".} -proc row_activated*(tree_view: PTreeView, path: PTreePath, - column: PTreeViewColumn){.cdecl, dynlib: lib, - importc: "gtk_tree_view_row_activated".} -proc expand_all*(tree_view: PTreeView){.cdecl, dynlib: lib, - importc: "gtk_tree_view_expand_all".} -proc collapse_all*(tree_view: PTreeView){.cdecl, dynlib: lib, - importc: "gtk_tree_view_collapse_all".} -proc expand_row*(tree_view: PTreeView, path: PTreePath, - open_all: gboolean): gboolean{.cdecl, dynlib: lib, - importc: "gtk_tree_view_expand_row".} -proc collapse_row*(tree_view: PTreeView, path: PTreePath): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_collapse_row".} -proc map_expanded_rows*(tree_view: PTreeView, - fun: TTreeViewMappingFunc, data: gpointer){. - cdecl, dynlib: lib, importc: "gtk_tree_view_map_expanded_rows".} -proc row_expanded*(tree_view: PTreeView, path: PTreePath): gboolean{. - cdecl, dynlib: lib, importc: "gtk_tree_view_row_expanded".} -proc set_reorderable*(tree_view: PTreeView, reorderable: gboolean){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_reorderable".} -proc get_reorderable*(tree_view: PTreeView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_reorderable".} -proc set_cursor*(tree_view: PTreeView, path: PTreePath, - focus_column: PTreeViewColumn, - start_editing: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_set_cursor".} -proc set_cursor_on_cell*(tree_view: PTreeView, path: PTreePath, - focus_column: PTreeViewColumn, - focus_cell: PCellRenderer, - start_editing: gboolean){.cdecl, dynlib: lib, - importc: "gtk_tree_view_set_cursor_on_cell".} -proc get_bin_window*(tree_view: PTreeView): gdk2.PWindow{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_bin_window".} -proc get_cell_area*(tree_view: PTreeView, path: PTreePath, - column: PTreeViewColumn, rect: gdk2.PRectangle){. - cdecl, dynlib: lib, importc: "gtk_tree_view_get_cell_area".} -proc get_background_area*(tree_view: PTreeView, path: PTreePath, - column: PTreeViewColumn, rect: gdk2.PRectangle){. - cdecl, dynlib: lib, importc: "gtk_tree_view_get_background_area".} -proc get_visible_rect*(tree_view: PTreeView, - visible_rect: gdk2.PRectangle){.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_visible_rect".} -proc widget_to_tree_coords*(tree_view: PTreeView, wx: gint, wy: gint, - tx: Pgint, ty: Pgint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_widget_to_tree_coords".} -proc tree_to_widget_coords*(tree_view: PTreeView, tx: gint, ty: gint, - wx: Pgint, wy: Pgint){.cdecl, dynlib: lib, - importc: "gtk_tree_view_tree_to_widget_coords".} -proc enable_model_drag_source*(tree_view: PTreeView, - start_button_mask: gdk2.TModifierType, targets: PTargetEntry, n_targets: gint, - actions: gdk2.TDragAction){.cdecl, dynlib: lib, - importc: "gtk_tree_view_enable_model_drag_source".} -proc enable_model_drag_dest*(tree_view: PTreeView, - targets: PTargetEntry, n_targets: gint, - actions: gdk2.TDragAction){.cdecl, - dynlib: lib, importc: "gtk_tree_view_enable_model_drag_dest".} -proc unset_rows_drag_source*(tree_view: PTreeView){.cdecl, - dynlib: lib, importc: "gtk_tree_view_unset_rows_drag_source".} -proc unset_rows_drag_dest*(tree_view: PTreeView){.cdecl, dynlib: lib, - importc: "gtk_tree_view_unset_rows_drag_dest".} -proc set_drag_dest_row*(tree_view: PTreeView, path: PTreePath, - pos: TTreeViewDropPosition){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_drag_dest_row".} -proc create_row_drag_icon*(tree_view: PTreeView, path: PTreePath): gdk2.PPixmap{. - cdecl, dynlib: lib, importc: "gtk_tree_view_create_row_drag_icon".} -proc set_enable_search*(tree_view: PTreeView, enable_search: gboolean){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_enable_search".} -proc get_enable_search*(tree_view: PTreeView): gboolean{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_enable_search".} -proc get_search_column*(tree_view: PTreeView): gint{.cdecl, - dynlib: lib, importc: "gtk_tree_view_get_search_column".} -proc set_search_column*(tree_view: PTreeView, column: gint){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_search_column".} -proc get_search_equal_func*(tree_view: PTreeView): TTreeViewSearchEqualFunc{. - cdecl, dynlib: lib, importc: "gtk_tree_view_get_search_equal_func".} -proc set_search_equal_func*(tree_view: PTreeView, search_equal_func: TTreeViewSearchEqualFunc, - search_user_data: gpointer, - search_destroy: TDestroyNotify){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_search_equal_func".} -proc set_destroy_count_func*(tree_view: PTreeView, - fun: TTreeDestroyCountFunc, - data: gpointer, destroy: TDestroyNotify){. - cdecl, dynlib: lib, importc: "gtk_tree_view_set_destroy_count_func".} -proc TYPE_VBUTTON_BOX*(): GType -proc VBUTTON_BOX*(obj: pointer): PVButtonBox -proc VBUTTON_BOX_CLASS*(klass: pointer): PVButtonBoxClass -proc IS_VBUTTON_BOX*(obj: pointer): bool -proc IS_VBUTTON_BOX_CLASS*(klass: pointer): bool -proc VBUTTON_BOX_GET_CLASS*(obj: pointer): PVButtonBoxClass -proc vbutton_box_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_vbutton_box_get_type".} -proc vbutton_box_new*(): PVButtonBox{.cdecl, dynlib: lib, - importc: "gtk_vbutton_box_new".} -proc TYPE_VIEWPORT*(): GType -proc VIEWPORT*(obj: pointer): PViewport -proc VIEWPORT_CLASS*(klass: pointer): PViewportClass -proc IS_VIEWPORT*(obj: pointer): bool -proc IS_VIEWPORT_CLASS*(klass: pointer): bool -proc VIEWPORT_GET_CLASS*(obj: pointer): PViewportClass -proc viewport_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_viewport_get_type".} -proc viewport_new*(hadjustment: PAdjustment, vadjustment: PAdjustment): PViewport{. - cdecl, dynlib: lib, importc: "gtk_viewport_new".} -proc get_hadjustment*(viewport: PViewport): PAdjustment{.cdecl, - dynlib: lib, importc: "gtk_viewport_get_hadjustment".} -proc get_vadjustment*(viewport: PViewport): PAdjustment{.cdecl, - dynlib: lib, importc: "gtk_viewport_get_vadjustment".} -proc set_hadjustment*(viewport: PViewport, adjustment: PAdjustment){. - cdecl, dynlib: lib, importc: "gtk_viewport_set_hadjustment".} -proc set_vadjustment*(viewport: PViewport, adjustment: PAdjustment){. - cdecl, dynlib: lib, importc: "gtk_viewport_set_vadjustment".} -proc set_shadow_type*(viewport: PViewport, thetype: TShadowType){. - cdecl, dynlib: lib, importc: "gtk_viewport_set_shadow_type".} -proc get_shadow_type*(viewport: PViewport): TShadowType{.cdecl, - dynlib: lib, importc: "gtk_viewport_get_shadow_type".} -proc TYPE_VPANED*(): GType -proc VPANED*(obj: pointer): PVPaned -proc VPANED_CLASS*(klass: pointer): PVPanedClass -proc IS_VPANED*(obj: pointer): bool -proc IS_VPANED_CLASS*(klass: pointer): bool -proc VPANED_GET_CLASS*(obj: pointer): PVPanedClass -proc vpaned_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_vpaned_get_type".} -proc vpaned_new*(): PVPaned{.cdecl, dynlib: lib, importc: "gtk_vpaned_new".} -proc TYPE_VRULER*(): GType -proc VRULER*(obj: pointer): PVRuler -proc VRULER_CLASS*(klass: pointer): PVRulerClass -proc IS_VRULER*(obj: pointer): bool -proc IS_VRULER_CLASS*(klass: pointer): bool -proc VRULER_GET_CLASS*(obj: pointer): PVRulerClass -proc vruler_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_vruler_get_type".} -proc vruler_new*(): PVRuler{.cdecl, dynlib: lib, importc: "gtk_vruler_new".} -proc TYPE_VSCALE*(): GType -proc VSCALE*(obj: pointer): PVScale -proc VSCALE_CLASS*(klass: pointer): PVScaleClass -proc IS_VSCALE*(obj: pointer): bool -proc IS_VSCALE_CLASS*(klass: pointer): bool -proc VSCALE_GET_CLASS*(obj: pointer): PVScaleClass -proc vscale_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_vscale_get_type".} -proc vscale_new*(adjustment: PAdjustment): PVScale{.cdecl, dynlib: lib, - importc: "gtk_vscale_new".} -proc vscale_new*(min: gdouble, max: gdouble, step: gdouble): PVScale{. - cdecl, dynlib: lib, importc: "gtk_vscale_new_with_range".} -proc TYPE_VSCROLLBAR*(): GType -proc VSCROLLBAR*(obj: pointer): PVScrollbar -proc VSCROLLBAR_CLASS*(klass: pointer): PVScrollbarClass -proc IS_VSCROLLBAR*(obj: pointer): bool -proc IS_VSCROLLBAR_CLASS*(klass: pointer): bool -proc VSCROLLBAR_GET_CLASS*(obj: pointer): PVScrollbarClass -proc vscrollbar_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_vscrollbar_get_type".} -proc vscrollbar_new*(adjustment: PAdjustment): PVScrollbar{.cdecl, dynlib: lib, - importc: "gtk_vscrollbar_new".} -proc TYPE_VSEPARATOR*(): GType -proc VSEPARATOR*(obj: pointer): PVSeparator -proc VSEPARATOR_CLASS*(klass: pointer): PVSeparatorClass -proc IS_VSEPARATOR*(obj: pointer): bool -proc IS_VSEPARATOR_CLASS*(klass: pointer): bool -proc VSEPARATOR_GET_CLASS*(obj: pointer): PVSeparatorClass -proc vseparator_get_type*(): TType{.cdecl, dynlib: lib, - importc: "gtk_vseparator_get_type".} -proc vseparator_new*(): PVSeparator{.cdecl, dynlib: lib, - importc: "gtk_vseparator_new".} -proc TYPE_OBJECT*(): GType = - result = gtk2.object_get_type() - -proc CHECK_CAST*(instance: Pointer, g_type: GType): PGTypeInstance = - result = G_TYPE_CHECK_INSTANCE_CAST(instance, g_type) - -proc CHECK_CLASS_CAST*(g_class: pointer, g_type: GType): Pointer = - result = G_TYPE_CHECK_CLASS_CAST(g_class, g_type) - -proc CHECK_GET_CLASS*(instance: Pointer, g_type: GType): PGTypeClass = - result = G_TYPE_INSTANCE_GET_CLASS(instance, g_type) - -proc CHECK_TYPE*(instance: Pointer, g_type: GType): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type) - -proc CHECK_CLASS_TYPE*(g_class: pointer, g_type: GType): bool = - result = G_TYPE_CHECK_CLASS_TYPE(g_class, g_type) - -proc `OBJECT`*(anObject: pointer): PObject = - result = cast[PObject](CHECK_CAST(anObject, gtk2.TYPE_OBJECT())) - -proc OBJECT_CLASS*(klass: pointer): PObjectClass = - result = cast[PObjectClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_OBJECT())) - -proc IS_OBJECT*(anObject: pointer): bool = - result = CHECK_TYPE(anObject, gtk2.TYPE_OBJECT()) - -proc IS_OBJECT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_OBJECT()) - -proc OBJECT_GET_CLASS*(anObject: pointer): PObjectClass = - result = cast[PObjectClass](CHECK_GET_CLASS(anObject, gtk2.TYPE_OBJECT())) - -proc OBJECT_TYPE*(anObject: pointer): GType = - result = G_TYPE_FROM_INSTANCE(anObject) - -proc OBJECT_TYPE_NAME*(anObject: pointer): cstring = - result = g_type_name(OBJECT_TYPE(anObject)) - -proc OBJECT_FLAGS*(obj: pointer): guint32 = - result = (gtk2.`OBJECT`(obj)).flags - -proc OBJECT_FLOATING*(obj: pointer): gboolean = - result = ((OBJECT_FLAGS(obj)) and cint(FLOATING)) != 0'i32 - -proc OBJECT_SET_FLAGS*(obj: pointer, flag: guint32) = - gtk2.`OBJECT`(obj).flags = gtk2.`OBJECT`(obj).flags or flag - -proc OBJECT_UNSET_FLAGS*(obj: pointer, flag: guint32) = - gtk2.`OBJECT`(obj).flags = gtk2.`OBJECT`(obj).flags and not (flag) - -proc object_data_try_key*(`string`: cstring): TGQuark = - result = g_quark_try_string(`string`) - -proc object_data_force_id*(`string`: cstring): TGQuark = - result = g_quark_from_string(`string`) - -proc CLASS_NAME*(`class`: pointer): cstring = - result = g_type_name(G_TYPE_FROM_CLASS(`class`)) - -proc CLASS_TYPE*(`class`: pointer): GType = - result = G_TYPE_FROM_CLASS(`class`) - -proc TYPE_IS_OBJECT*(thetype: GType): gboolean = - result = g_type_is_a(thetype, gtk2.TYPE_OBJECT()) - -proc TYPE_IDENTIFIER*(): GType = - result = identifier_get_type() - -proc SIGNAL_FUNC*(f: pointer): TSignalFunc = - result = cast[TSignalFunc](f) - -proc type_name*(thetype: GType): cstring = - result = g_type_name(thetype) - -proc type_from_name*(name: cstring): GType = - result = g_type_from_name(name) - -proc type_parent*(thetype: GType): GType = - result = g_type_parent(thetype) - -proc type_is_a*(thetype, is_a_type: GType): gboolean = - result = g_type_is_a(thetype, is_a_type) - -proc FUNDAMENTAL_TYPE*(thetype: GType): GType = - result = G_TYPE_FUNDAMENTAL(thetype) - -proc VALUE_CHAR*(a: TArg): gchar = - var a = a - Result = cast[ptr gchar](addr(a.d))[] - -proc VALUE_UCHAR*(a: TArg): guchar = - var a = a - Result = cast[ptr guchar](addr(a.d))[] - -proc VALUE_BOOL*(a: TArg): gboolean = - var a = a - Result = cast[ptr gboolean](addr(a.d))[] - -proc VALUE_INT*(a: TArg): gint = - var a = a - Result = cast[ptr gint](addr(a.d))[] - -proc VALUE_UINT*(a: TArg): guint = - var a = a - Result = cast[ptr guint](addr(a.d))[] - -proc VALUE_LONG*(a: TArg): glong = - var a = a - Result = cast[ptr glong](addr(a.d))[] - -proc VALUE_ULONG*(a: TArg): gulong = - var a = a - Result = cast[ptr gulong](addr(a.d))[] - -proc VALUE_FLOAT*(a: TArg): gfloat = - var a = a - Result = cast[ptr gfloat](addr(a.d))[] - -proc VALUE_DOUBLE*(a: TArg): gdouble = - var a = a - Result = cast[ptr gdouble](addr(a.d))[] - -proc VALUE_STRING*(a: TArg): cstring = - var a = a - Result = cast[ptr cstring](addr(a.d))[] - -proc VALUE_ENUM*(a: TArg): gint = - var a = a - Result = cast[ptr gint](addr(a.d))[] - -proc VALUE_FLAGS*(a: TArg): guint = - var a = a - Result = cast[ptr guint](addr(a.d))[] - -proc VALUE_BOXED*(a: TArg): gpointer = - var a = a - Result = cast[ptr gpointer](addr(a.d))[] - -proc VALUE_OBJECT*(a: TArg): PObject = - var a = a - Result = cast[ptr PObject](addr(a.d))[] - -proc VALUE_POINTER*(a: TArg): GPointer = - var a = a - Result = cast[ptr gpointer](addr(a.d))[] - -proc VALUE_SIGNAL*(a: TArg): TArgSignalData = - var a = a - Result = cast[ptr TArgSignalData](addr(a.d))[] - -proc RETLOC_CHAR*(a: TArg): cstring = - var a = a - Result = cast[ptr cstring](addr(a.d))[] - -proc RETLOC_UCHAR*(a: TArg): Pguchar = - var a = a - Result = cast[ptr pguchar](addr(a.d))[] - -proc RETLOC_BOOL*(a: TArg): Pgboolean = - var a = a - Result = cast[ptr pgboolean](addr(a.d))[] - -proc RETLOC_INT*(a: TArg): Pgint = - var a = a - Result = cast[ptr pgint](addr(a.d))[] - -proc RETLOC_UINT*(a: TArg): Pguint = - var a = a - Result = cast[ptr pguint](addr(a.d))[] - -proc RETLOC_LONG*(a: TArg): Pglong = - var a = a - Result = cast[ptr pglong](addr(a.d))[] - -proc RETLOC_ULONG*(a: TArg): Pgulong = - var a = a - Result = cast[ptr pgulong](addr(a.d))[] - -proc RETLOC_FLOAT*(a: TArg): Pgfloat = - var a = a - Result = cast[ptr pgfloat](addr(a.d))[] - -proc RETLOC_DOUBLE*(a: TArg): Pgdouble = - var a = a - Result = cast[ptr pgdouble](addr(a.d))[] - -proc RETLOC_STRING*(a: TArg): Ppgchar = - var a = a - Result = cast[ptr Ppgchar](addr(a.d))[] - -proc RETLOC_ENUM*(a: TArg): Pgint = - var a = a - Result = cast[ptr Pgint](addr(a.d))[] - -proc RETLOC_FLAGS*(a: TArg): Pguint = - var a = a - Result = cast[ptr pguint](addr(a.d))[] - -proc RETLOC_BOXED*(a: TArg): Pgpointer = - var a = a - Result = cast[ptr pgpointer](addr(a.d))[] - -proc RETLOC_OBJECT*(a: TArg): PPGtkObject = - var a = a - Result = cast[ptr ppgtkobject](addr(a.d))[] - -proc RETLOC_POINTER*(a: TArg): Pgpointer = - var a = a - Result = cast[ptr pgpointer](addr(a.d))[] - -proc TYPE_WIDGET*(): GType = - result = widget_get_type() - -proc WIDGET*(widget: pointer): PWidget = - result = cast[PWidget](CHECK_CAST(widget, TYPE_WIDGET())) - -proc WIDGET_CLASS*(klass: pointer): PWidgetClass = - result = cast[PWidgetClass](CHECK_CLASS_CAST(klass, TYPE_WIDGET())) - -proc IS_WIDGET*(widget: pointer): bool = - result = CHECK_TYPE(widget, TYPE_WIDGET()) - -proc IS_WIDGET_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_WIDGET()) - -proc WIDGET_GET_CLASS*(obj: pointer): PWidgetClass = - result = cast[PWidgetClass](CHECK_GET_CLASS(obj, TYPE_WIDGET())) - -proc WIDGET_TYPE*(wid: pointer): GType = - result = OBJECT_TYPE(wid) - -proc WIDGET_STATE*(wid: pointer): int32 = - result = (WIDGET(wid)).state - -proc WIDGET_SAVED_STATE*(wid: pointer): int32 = - result = (WIDGET(wid)).saved_state - -proc WIDGET_FLAGS*(wid: pointer): guint32 = - result = OBJECT_FLAGS(wid) - -proc WIDGET_TOPLEVEL*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(TOPLEVEL)) != 0'i32 - -proc WIDGET_NO_WINDOW*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(NO_WINDOW)) != 0'i32 - -proc WIDGET_REALIZED*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(constREALIZED)) != 0'i32 - -proc WIDGET_MAPPED*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(MAPPED)) != 0'i32 - -proc WIDGET_VISIBLE*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(constVISIBLE)) != 0'i32 - -proc WIDGET_DRAWABLE*(wid: pointer): gboolean = - result = (WIDGET_VISIBLE(wid)) and (WIDGET_MAPPED(wid)) - -proc WIDGET_SENSITIVE*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(SENSITIVE)) != 0'i32 - -proc WIDGET_PARENT_SENSITIVE*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(PARENT_SENSITIVE)) != 0'i32 - -proc WIDGET_IS_SENSITIVE*(wid: pointer): gboolean = - result = (WIDGET_SENSITIVE(wid)) and (WIDGET_PARENT_SENSITIVE(wid)) - -proc WIDGET_CAN_FOCUS*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(CAN_FOCUS)) != 0'i32 - -proc WIDGET_HAS_FOCUS*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(constHAS_FOCUS)) != 0'i32 - -proc WIDGET_CAN_DEFAULT*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(CAN_DEFAULT)) != 0'i32 - -proc WIDGET_HAS_DEFAULT*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(HAS_DEFAULT)) != 0'i32 - -proc WIDGET_HAS_GRAB*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(HAS_GRAB)) != 0'i32 - -proc WIDGET_RC_STYLE*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(RC_STYLE)) != 0'i32 - -proc WIDGET_COMPOSITE_CHILD*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(COMPOSITE_CHILD)) != 0'i32 - -proc WIDGET_APP_PAINTABLE*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(APP_PAINTABLE)) != 0'i32 - -proc WIDGET_RECEIVES_DEFAULT*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(RECEIVES_DEFAULT)) != 0'i32 - -proc WIDGET_DOUBLE_BUFFERED*(wid: pointer): gboolean = - result = ((WIDGET_FLAGS(wid)) and cint(DOUBLE_BUFFERED)) != 0'i32 - -proc TYPE_REQUISITION*(): GType = - result = requisition_get_type() - -proc x_set*(a: PWidgetAuxInfo): guint = - result = (a.flag0 and bm_TGtkWidgetAuxInfo_x_set) shr - bp_TGtkWidgetAuxInfo_x_set - -proc set_x_set*(a: PWidgetAuxInfo, `x_set`: guint) = - a.flag0 = a.flag0 or - (int16(`x_set` shl bp_TGtkWidgetAuxInfo_x_set) and - bm_TGtkWidgetAuxInfo_x_set) - -proc y_set*(a: PWidgetAuxInfo): guint = - result = (a.flag0 and bm_TGtkWidgetAuxInfo_y_set) shr - bp_TGtkWidgetAuxInfo_y_set - -proc set_y_set*(a: PWidgetAuxInfo, `y_set`: guint) = - a.flag0 = a.flag0 or - (int16(`y_set` shl bp_TGtkWidgetAuxInfo_y_set) and - bm_TGtkWidgetAuxInfo_y_set) - -proc widget_set_visual*(widget, visual: pointer) = - if (Widget != nil) and (visual != nil): nil - -proc widget_push_visual*(visual: pointer) = - if (visual != nil): nil - -proc widget_pop_visual*() = - nil - -proc widget_set_default_visual*(visual: pointer) = - if (visual != nil): nil - -proc widget_set_rc_style*(widget: pointer) = - set_style(cast[PWidget](widget), nil) - -proc widget_restore_default_style*(widget: pointer) = - set_style(cast[PWidget](widget), nil) - -proc SET_FLAGS*(wid: PWidget, flags: TWidgetFlags): TWidgetFlags = - cast[pObject](wid).flags = cast[pObject](wid).flags or (flags) - result = cast[pObject](wid).flags - -proc UNSET_FLAGS*(wid: PWidget, flags: TWidgetFlags): TWidgetFlags = - cast[pObject](wid).flags = cast[pObject](wid).flags and (not (flags)) - result = cast[pObject](wid).flags - -proc TYPE_MISC*(): GType = - result = misc_get_type() - -proc MISC*(obj: pointer): PMisc = - result = cast[PMisc](CHECK_CAST(obj, TYPE_MISC())) - -proc MISC_CLASS*(klass: pointer): PMiscClass = - result = cast[PMiscClass](CHECK_CLASS_CAST(klass, TYPE_MISC())) - -proc IS_MISC*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_MISC()) - -proc IS_MISC_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_MISC()) - -proc MISC_GET_CLASS*(obj: pointer): PMiscClass = - result = cast[PMiscClass](CHECK_GET_CLASS(obj, TYPE_MISC())) - -proc TYPE_ACCEL_GROUP*(): GType = - result = accel_group_get_type() - -proc ACCEL_GROUP*(anObject: pointer): PAccelGroup = - result = cast[PAccelGroup](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_ACCEL_GROUP())) - -proc ACCEL_GROUP_CLASS*(klass: pointer): PAccelGroupClass = - result = cast[PAccelGroupClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_ACCEL_GROUP())) - -proc IS_ACCEL_GROUP*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_ACCEL_GROUP()) - -proc IS_ACCEL_GROUP_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_ACCEL_GROUP()) - -proc ACCEL_GROUP_GET_CLASS*(obj: pointer): PAccelGroupClass = - result = cast[PAccelGroupClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_ACCEL_GROUP())) - -proc accel_flags*(a: PAccelKey): guint = - result = (a.flag0 and bm_TGtkAccelKey_accel_flags) shr - bp_TGtkAccelKey_accel_flags - -proc set_accel_flags*(a: PAccelKey, `accel_flags`: guint) = - a.flag0 = a.flag0 or - (int16(`accel_flags` shl bp_TGtkAccelKey_accel_flags) and - bm_TGtkAccelKey_accel_flags) - -proc reference*(AccelGroup: PAccelGroup) = - discard g_object_ref(AccelGroup) - -proc unref*(AccelGroup: PAccelGroup) = - g_object_unref(AccelGroup) - -proc TYPE_CONTAINER*(): GType = - result = container_get_type() - -proc CONTAINER*(obj: pointer): PContainer = - result = cast[PContainer](CHECK_CAST(obj, TYPE_CONTAINER())) - -proc CONTAINER_CLASS*(klass: pointer): PContainerClass = - result = cast[PContainerClass](CHECK_CLASS_CAST(klass, TYPE_CONTAINER())) - -proc IS_CONTAINER*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CONTAINER()) - -proc IS_CONTAINER_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CONTAINER()) - -proc CONTAINER_GET_CLASS*(obj: pointer): PContainerClass = - result = cast[PContainerClass](CHECK_GET_CLASS(obj, TYPE_CONTAINER())) - -proc IS_RESIZE_CONTAINER*(widget: pointer): bool = - result = (IS_CONTAINER(widget)) and - ((resize_mode(cast[PContainer](widget))) != cint(RESIZE_PARENT)) - -proc border_width*(a: PContainer): guint = - result = (a.Container_flag0 and bm_TGtkContainer_border_width) shr - bp_TGtkContainer_border_width - -proc need_resize*(a: PContainer): guint = - result = (a.Container_flag0 and bm_TGtkContainer_need_resize) shr - bp_TGtkContainer_need_resize - -proc set_need_resize*(a: PContainer, `need_resize`: guint) = - a.Container_flag0 = a.Container_flag0 or - ((`need_resize` shl bp_TGtkContainer_need_resize) and - bm_TGtkContainer_need_resize) - -proc resize_mode*(a: PContainer): guint = - result = (a.Container_flag0 and bm_TGtkContainer_resize_mode) shr - bp_TGtkContainer_resize_mode - -proc set_resize_mode*(a: PContainer, `resize_mode`: guint) = - a.Containerflag0 = a.Containerflag0 or - ((`resize_mode` shl bp_TGtkContainer_resize_mode) and - bm_TGtkContainer_resize_mode) - -proc reallocate_redraws*(a: PContainer): guint = - result = (a.Containerflag0 and bm_TGtkContainer_reallocate_redraws) shr - bp_TGtkContainer_reallocate_redraws - -proc set_reallocate_redraws*(a: PContainer, `reallocate_redraws`: guint) = - a.Containerflag0 = a.Containerflag0 or - ((`reallocate_redraws` shl bp_TGtkContainer_reallocate_redraws) and - bm_TGtkContainer_reallocate_redraws) - -proc has_focus_chain*(a: PContainer): guint = - result = (a.Containerflag0 and bm_TGtkContainer_has_focus_chain) shr - bp_TGtkContainer_has_focus_chain - -proc set_has_focus_chain*(a: PContainer, `has_focus_chain`: guint) = - a.Containerflag0 = a.Containerflag0 or - ((`has_focus_chain` shl bp_TGtkContainer_has_focus_chain) and - bm_TGtkContainer_has_focus_chain) - -proc CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID*(anObject: pointer, - property_id: guint, pspec: pointer) = - write(stdout, "WARNING: invalid child property id\x0A") - -proc TYPE_BIN*(): GType = - result = bin_get_type() - -proc BIN*(obj: pointer): PBin = - result = cast[PBin](CHECK_CAST(obj, TYPE_BIN())) - -proc BIN_CLASS*(klass: pointer): PBinClass = - result = cast[PBinClass](CHECK_CLASS_CAST(klass, TYPE_BIN())) - -proc IS_BIN*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_BIN()) - -proc IS_BIN_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_BIN()) - -proc BIN_GET_CLASS*(obj: pointer): PBinClass = - result = cast[PBinClass](CHECK_GET_CLASS(obj, TYPE_BIN())) - -proc TYPE_WINDOW*(): GType = - result = window_get_type() - -proc WINDOW*(obj: pointer): PWindow = - result = cast[PWindow](CHECK_CAST(obj, gtk2.TYPE_WINDOW())) - -proc WINDOW_CLASS*(klass: pointer): PWindowClass = - result = cast[PWindowClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_WINDOW())) - -proc IS_WINDOW*(obj: pointer): bool = - result = CHECK_TYPE(obj, gtk2.TYPE_WINDOW()) - -proc IS_WINDOW_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_WINDOW()) - -proc WINDOW_GET_CLASS*(obj: pointer): PWindowClass = - result = cast[PWindowClass](CHECK_GET_CLASS(obj, gtk2.TYPE_WINDOW())) - -proc allow_shrink*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_allow_shrink) shr - bp_TGtkWindow_allow_shrink - -proc set_allow_shrink*(a: gtk2.PWindow, `allow_shrink`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`allow_shrink` shl bp_TGtkWindow_allow_shrink) and - bm_TGtkWindow_allow_shrink) - -proc allow_grow*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_allow_grow) shr - bp_TGtkWindow_allow_grow - -proc set_allow_grow*(a: gtk2.PWindow, `allow_grow`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`allow_grow` shl bp_TGtkWindow_allow_grow) and - bm_TGtkWindow_allow_grow) - -proc configure_notify_received*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_configure_notify_received) shr - bp_TGtkWindow_configure_notify_received - -proc set_configure_notify_received*(a: gtk2.PWindow, - `configure_notify_received`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`configure_notify_received` shl - bp_TGtkWindow_configure_notify_received) and - bm_TGtkWindow_configure_notify_received) - -proc need_default_position*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_need_default_position) shr - bp_TGtkWindow_need_default_position - -proc set_need_default_position*(a: gtk2.PWindow, `need_default_position`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`need_default_position` shl bp_TGtkWindow_need_default_position) and - bm_TGtkWindow_need_default_position) - -proc need_default_size*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_need_default_size) shr - bp_TGtkWindow_need_default_size - -proc set_need_default_size*(a: gtk2.PWindow, `need_default_size`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`need_default_size` shl bp_TGtkWindow_need_default_size) and - bm_TGtkWindow_need_default_size) - -proc position*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_position) shr - bp_TGtkWindow_position - -proc get_type*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_type) shr bp_TGtkWindow_type - -proc set_type*(a: gtk2.PWindow, `type`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`type` shl bp_TGtkWindow_type) and bm_TGtkWindow_type) - -proc has_user_ref_count*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_has_user_ref_count) shr - bp_TGtkWindow_has_user_ref_count - -proc set_has_user_ref_count*(a: gtk2.PWindow, `has_user_ref_count`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`has_user_ref_count` shl bp_TGtkWindow_has_user_ref_count) and - bm_TGtkWindow_has_user_ref_count) - -proc has_focus*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_has_focus) shr - bp_TGtkWindow_has_focus - -proc set_has_focus*(a: gtk2.PWindow, `has_focus`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`has_focus` shl bp_TGtkWindow_has_focus) and bm_TGtkWindow_has_focus) - -proc modal*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_modal) shr bp_TGtkWindow_modal - -proc set_modal*(a: gtk2.PWindow, `modal`: guint) = - a.Window_flag0 = a.Window_flag0 or - ((`modal` shl bp_TGtkWindow_modal) and bm_TGtkWindow_modal) - -proc destroy_with_parent*(a: gtk2.PWindow): guint = - result = (a.Window_flag0 and bm_TGtkWindow_destroy_with_parent) shr - bp_TGtkWindow_destroy_with_parent - -proc set_destroy_with_parent*(a: gtk2.PWindow, `destroy_with_parent`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`destroy_with_parent` shl bp_TGtkWindow_destroy_with_parent) and - bm_TGtkWindow_destroy_with_parent) - -proc has_frame*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_has_frame) shr - bp_TGtkWindow_has_frame - -proc set_has_frame*(a: gtk2.PWindow, `has_frame`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`has_frame` shl bp_TGtkWindow_has_frame) and bm_TGtkWindow_has_frame) - -proc iconify_initially*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_iconify_initially) shr - bp_TGtkWindow_iconify_initially - -proc set_iconify_initially*(a: gtk2.PWindow, `iconify_initially`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`iconify_initially` shl bp_TGtkWindow_iconify_initially) and - bm_TGtkWindow_iconify_initially) - -proc stick_initially*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_stick_initially) shr - bp_TGtkWindow_stick_initially - -proc set_stick_initially*(a: gtk2.PWindow, `stick_initially`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`stick_initially` shl bp_TGtkWindow_stick_initially) and - bm_TGtkWindow_stick_initially) - -proc maximize_initially*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_maximize_initially) shr - bp_TGtkWindow_maximize_initially - -proc set_maximize_initially*(a: gtk2.PWindow, `maximize_initially`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`maximize_initially` shl bp_TGtkWindow_maximize_initially) and - bm_TGtkWindow_maximize_initially) - -proc decorated*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_decorated) shr - bp_TGtkWindow_decorated - -proc set_decorated*(a: gtk2.PWindow, `decorated`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`decorated` shl bp_TGtkWindow_decorated) and bm_TGtkWindow_decorated) - -proc type_hint*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_type_hint) shr - bp_TGtkWindow_type_hint - -proc set_type_hint*(a: gtk2.PWindow, `type_hint`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`type_hint` shl bp_TGtkWindow_type_hint) and bm_TGtkWindow_type_hint) - -proc gravity*(a: gtk2.PWindow): guint = - result = (a.Windowflag0 and bm_TGtkWindow_gravity) shr - bp_TGtkWindow_gravity - -proc set_gravity*(a: gtk2.PWindow, `gravity`: guint) = - a.Windowflag0 = a.Windowflag0 or - ((`gravity` shl bp_TGtkWindow_gravity) and bm_TGtkWindow_gravity) - -proc TYPE_WINDOW_GROUP*(): GType = - result = window_group_get_type() - -proc WINDOW_GROUP*(anObject: pointer): PWindowGroup = - result = cast[PWindowGroup](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_WINDOW_GROUP())) - -proc WINDOW_GROUP_CLASS*(klass: pointer): PWindowGroupClass = - result = cast[PWindowGroupClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_WINDOW_GROUP())) - -proc IS_WINDOW_GROUP*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_WINDOW_GROUP()) - -proc IS_WINDOW_GROUP_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_WINDOW_GROUP()) - -proc WINDOW_GROUP_GET_CLASS*(obj: pointer): PWindowGroupClass = - result = cast[PWindowGroupClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_WINDOW_GROUP())) - -proc TYPE_LABEL*(): GType = - result = label_get_type() - -proc LABEL*(obj: pointer): PLabel = - result = cast[PLabel](CHECK_CAST(obj, TYPE_LABEL())) - -proc LABEL_CLASS*(klass: pointer): PLabelClass = - result = cast[PLabelClass](CHECK_CLASS_CAST(klass, TYPE_LABEL())) - -proc IS_LABEL*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_LABEL()) - -proc IS_LABEL_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_LABEL()) - -proc LABEL_GET_CLASS*(obj: pointer): PLabelClass = - result = cast[PLabelClass](CHECK_GET_CLASS(obj, TYPE_LABEL())) - -proc jtype*(a: PLabel): guint = - result = (a.Labelflag0 and bm_TGtkLabel_jtype) shr bp_TGtkLabel_jtype - -proc set_jtype*(a: PLabel, `jtype`: guint) = - a.Labelflag0 = a.Labelflag0 or - (int16(`jtype` shl bp_TGtkLabel_jtype) and bm_TGtkLabel_jtype) - -proc wrap*(a: PLabel): guint = - result = (a.Labelflag0 and bm_TGtkLabel_wrap) shr bp_TGtkLabel_wrap - -proc set_wrap*(a: PLabel, `wrap`: guint) = - a.Labelflag0 = a.Labelflag0 or - (int16(`wrap` shl bp_TGtkLabel_wrap) and bm_TGtkLabel_wrap) - -proc use_underline*(a: PLabel): guint = - result = (a.Labelflag0 and bm_TGtkLabel_use_underline) shr - bp_TGtkLabel_use_underline - -proc set_use_underline*(a: PLabel, `use_underline`: guint) = - a.Labelflag0 = a.Labelflag0 or - (int16(`use_underline` shl bp_TGtkLabel_use_underline) and - bm_TGtkLabel_use_underline) - -proc use_markup*(a: PLabel): guint = - result = (a.Labelflag0 and bm_TGtkLabel_use_markup) shr - bp_TGtkLabel_use_markup - -proc set_use_markup*(a: PLabel, `use_markup`: guint) = - a.Labelflag0 = a.Labelflag0 or - (int16(`use_markup` shl bp_TGtkLabel_use_markup) and - bm_TGtkLabel_use_markup) - -proc TYPE_ACCEL_LABEL*(): GType = - result = accel_label_get_type() - -proc ACCEL_LABEL*(obj: pointer): PAccelLabel = - result = cast[PAccelLabel](CHECK_CAST(obj, TYPE_ACCEL_LABEL())) - -proc ACCEL_LABEL_CLASS*(klass: pointer): PAccelLabelClass = - result = cast[PAccelLabelClass](CHECK_CLASS_CAST(klass, TYPE_ACCEL_LABEL())) - -proc IS_ACCEL_LABEL*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ACCEL_LABEL()) - -proc IS_ACCEL_LABEL_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ACCEL_LABEL()) - -proc ACCEL_LABEL_GET_CLASS*(obj: pointer): PAccelLabelClass = - result = cast[PAccelLabelClass](CHECK_GET_CLASS(obj, TYPE_ACCEL_LABEL())) - -proc latin1_to_char*(a: PAccelLabelClass): guint = - result = (a.AccelLabelClassflag0 and bm_TGtkAccelLabelClass_latin1_to_char) shr - bp_TGtkAccelLabelClass_latin1_to_char - -proc set_latin1_to_char*(a: PAccelLabelClass, `latin1_to_char`: guint) = - a.AccelLabelClassflag0 = a.AccelLabelClassflag0 or - (int16(`latin1_to_char` shl bp_TGtkAccelLabelClass_latin1_to_char) and - bm_TGtkAccelLabelClass_latin1_to_char) - -proc accelerator_width*(accel_label: PAccelLabel): guint = - result = get_accel_width(accel_label) - -proc TYPE_ACCESSIBLE*(): GType = - result = accessible_get_type() - -proc ACCESSIBLE*(obj: pointer): PAccessible = - result = cast[PAccessible](CHECK_CAST(obj, TYPE_ACCESSIBLE())) - -proc ACCESSIBLE_CLASS*(klass: pointer): PAccessibleClass = - result = cast[PAccessibleClass](CHECK_CLASS_CAST(klass, TYPE_ACCESSIBLE())) - -proc IS_ACCESSIBLE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ACCESSIBLE()) - -proc IS_ACCESSIBLE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ACCESSIBLE()) - -proc ACCESSIBLE_GET_CLASS*(obj: pointer): PAccessibleClass = - result = cast[PAccessibleClass](CHECK_GET_CLASS(obj, TYPE_ACCESSIBLE())) - -proc TYPE_ADJUSTMENT*(): GType = - result = adjustment_get_type() - -proc ADJUSTMENT*(obj: pointer): PAdjustment = - result = cast[PAdjustment](CHECK_CAST(obj, TYPE_ADJUSTMENT())) - -proc ADJUSTMENT_CLASS*(klass: pointer): PAdjustmentClass = - result = cast[PAdjustmentClass](CHECK_CLASS_CAST(klass, TYPE_ADJUSTMENT())) - -proc IS_ADJUSTMENT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ADJUSTMENT()) - -proc IS_ADJUSTMENT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ADJUSTMENT()) - -proc ADJUSTMENT_GET_CLASS*(obj: pointer): PAdjustmentClass = - result = cast[PAdjustmentClass](CHECK_GET_CLASS(obj, TYPE_ADJUSTMENT())) - -proc TYPE_ALIGNMENT*(): GType = - result = alignment_get_type() - -proc ALIGNMENT*(obj: pointer): PAlignment = - result = cast[PAlignment](CHECK_CAST(obj, TYPE_ALIGNMENT())) - -proc ALIGNMENT_CLASS*(klass: pointer): PAlignmentClass = - result = cast[PAlignmentClass](CHECK_CLASS_CAST(klass, TYPE_ALIGNMENT())) - -proc IS_ALIGNMENT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ALIGNMENT()) - -proc IS_ALIGNMENT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ALIGNMENT()) - -proc ALIGNMENT_GET_CLASS*(obj: pointer): PAlignmentClass = - result = cast[PAlignmentClass](CHECK_GET_CLASS(obj, TYPE_ALIGNMENT())) - -proc TYPE_FRAME*(): GType = - result = frame_get_type() - -proc FRAME*(obj: pointer): PFrame = - result = cast[PFrame](CHECK_CAST(obj, TYPE_FRAME())) - -proc FRAME_CLASS*(klass: pointer): PFrameClass = - result = cast[PFrameClass](CHECK_CLASS_CAST(klass, TYPE_FRAME())) - -proc IS_FRAME*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_FRAME()) - -proc IS_FRAME_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_FRAME()) - -proc FRAME_GET_CLASS*(obj: pointer): PFrameClass = - result = cast[PFrameClass](CHECK_GET_CLASS(obj, TYPE_FRAME())) - -proc TYPE_ASPECT_FRAME*(): GType = - result = aspect_frame_get_type() - -proc ASPECT_FRAME*(obj: pointer): PAspectFrame = - result = cast[PAspectFrame](CHECK_CAST(obj, TYPE_ASPECT_FRAME())) - -proc ASPECT_FRAME_CLASS*(klass: pointer): PAspectFrameClass = - result = cast[PAspectFrameClass](CHECK_CLASS_CAST(klass, TYPE_ASPECT_FRAME())) - -proc IS_ASPECT_FRAME*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ASPECT_FRAME()) - -proc IS_ASPECT_FRAME_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ASPECT_FRAME()) - -proc ASPECT_FRAME_GET_CLASS*(obj: pointer): PAspectFrameClass = - result = cast[PAspectFrameClass](CHECK_GET_CLASS(obj, TYPE_ASPECT_FRAME())) - -proc TYPE_ARROW*(): GType = - result = arrow_get_type() - -proc ARROW*(obj: pointer): PArrow = - result = cast[PArrow](CHECK_CAST(obj, TYPE_ARROW())) - -proc ARROW_CLASS*(klass: pointer): PArrowClass = - result = cast[PArrowClass](CHECK_CLASS_CAST(klass, TYPE_ARROW())) - -proc IS_ARROW*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ARROW()) - -proc IS_ARROW_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ARROW()) - -proc ARROW_GET_CLASS*(obj: pointer): PArrowClass = - result = cast[PArrowClass](CHECK_GET_CLASS(obj, TYPE_ARROW())) - -proc parsed*(a: PBindingSet): guint = - result = (a.flag0 and bm_TGtkBindingSet_parsed) shr - bp_TGtkBindingSet_parsed - -proc set_parsed*(a: PBindingSet, `parsed`: guint) = - a.flag0 = a.flag0 or - (int16(`parsed` shl bp_TGtkBindingSet_parsed) and - bm_TGtkBindingSet_parsed) - -proc destroyed*(a: PBindingEntry): guint = - result = (a.flag0 and bm_TGtkBindingEntry_destroyed) shr - bp_TGtkBindingEntry_destroyed - -proc set_destroyed*(a: PBindingEntry, `destroyed`: guint) = - a.flag0 = a.flag0 or - (int16(`destroyed` shl bp_TGtkBindingEntry_destroyed) and - bm_TGtkBindingEntry_destroyed) - -proc in_emission*(a: PBindingEntry): guint = - result = (a.flag0 and bm_TGtkBindingEntry_in_emission) shr - bp_TGtkBindingEntry_in_emission - -proc set_in_emission*(a: PBindingEntry, `in_emission`: guint) = - a.flag0 = a.flag0 or - (int16(`in_emission` shl bp_TGtkBindingEntry_in_emission) and - bm_TGtkBindingEntry_in_emission) - -proc entry_add*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType) = - entry_clear(binding_set, keyval, modifiers) - -proc TYPE_BOX*(): GType = - result = box_get_type() - -proc BOX*(obj: pointer): PBox = - result = cast[PBox](CHECK_CAST(obj, TYPE_BOX())) - -proc BOX_CLASS*(klass: pointer): PBoxClass = - result = cast[PBoxClass](CHECK_CLASS_CAST(klass, TYPE_BOX())) - -proc IS_BOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_BOX()) - -proc IS_BOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_BOX()) - -proc BOX_GET_CLASS*(obj: pointer): PBoxClass = - result = cast[PBoxClass](CHECK_GET_CLASS(obj, TYPE_BOX())) - -proc homogeneous*(a: PBox): guint = - result = (a.Boxflag0 and bm_TGtkBox_homogeneous) shr bp_TGtkBox_homogeneous - -proc set_homogeneous*(a: PBox, `homogeneous`: guint) = - a.Boxflag0 = a.Boxflag0 or - (int16(`homogeneous` shl bp_TGtkBox_homogeneous) and - bm_TGtkBox_homogeneous) - -proc expand*(a: PBoxChild): guint = - result = (a.flag0 and bm_TGtkBoxChild_expand) shr bp_TGtkBoxChild_expand - -proc set_expand*(a: PBoxChild, `expand`: guint) = - a.flag0 = a.flag0 or - (int16(`expand` shl bp_TGtkBoxChild_expand) and bm_TGtkBoxChild_expand) - -proc fill*(a: PBoxChild): guint = - result = (a.flag0 and bm_TGtkBoxChild_fill) shr bp_TGtkBoxChild_fill - -proc set_fill*(a: PBoxChild, `fill`: guint) = - a.flag0 = a.flag0 or - (int16(`fill` shl bp_TGtkBoxChild_fill) and bm_TGtkBoxChild_fill) - -proc pack*(a: PBoxChild): guint = - result = (a.flag0 and bm_TGtkBoxChild_pack) shr bp_TGtkBoxChild_pack - -proc set_pack*(a: PBoxChild, `pack`: guint) = - a.flag0 = a.flag0 or - (int16(`pack` shl bp_TGtkBoxChild_pack) and bm_TGtkBoxChild_pack) - -proc is_secondary*(a: PBoxChild): guint = - result = (a.flag0 and bm_TGtkBoxChild_is_secondary) shr - bp_TGtkBoxChild_is_secondary - -proc set_is_secondary*(a: PBoxChild, `is_secondary`: guint) = - a.flag0 = a.flag0 or - (int16(`is_secondary` shl bp_TGtkBoxChild_is_secondary) and - bm_TGtkBoxChild_is_secondary) - -proc TYPE_BUTTON_BOX*(): GType = - result = button_box_get_type() - -proc BUTTON_BOX*(obj: pointer): PButtonBox = - result = cast[PButtonBox](CHECK_CAST(obj, TYPE_BUTTON_BOX())) - -proc BUTTON_BOX_CLASS*(klass: pointer): PButtonBoxClass = - result = cast[PButtonBoxClass](CHECK_CLASS_CAST(klass, TYPE_BUTTON_BOX())) - -proc IS_BUTTON_BOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_BUTTON_BOX()) - -proc IS_BUTTON_BOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_BUTTON_BOX()) - -proc BUTTON_BOX_GET_CLASS*(obj: pointer): PButtonBoxClass = - result = cast[PButtonBoxClass](CHECK_GET_CLASS(obj, TYPE_BUTTON_BOX())) - -proc button_box_set_spacing*(b: pointer, s: gint) = - set_spacing(BOX(b), s) - -proc button_box_get_spacing*(b: pointer): gint = - result = get_spacing(BOX(b)) - -proc TYPE_BUTTON*(): GType = - result = button_get_type() - -proc BUTTON*(obj: pointer): PButton = - result = cast[PButton](CHECK_CAST(obj, TYPE_BUTTON())) - -proc BUTTON_CLASS*(klass: pointer): PButtonClass = - result = cast[PButtonClass](CHECK_CLASS_CAST(klass, TYPE_BUTTON())) - -proc IS_BUTTON*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_BUTTON()) - -proc IS_BUTTON_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_BUTTON()) - -proc BUTTON_GET_CLASS*(obj: pointer): PButtonClass = - result = cast[PButtonClass](CHECK_GET_CLASS(obj, TYPE_BUTTON())) - -proc constructed*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_constructed) shr - bp_TGtkButton_constructed - -proc set_constructed*(a: PButton, `constructed`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`constructed` shl bp_TGtkButton_constructed) and - bm_TGtkButton_constructed) - -proc in_button*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_in_button) shr - bp_TGtkButton_in_button - -proc set_in_button*(a: PButton, `in_button`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`in_button` shl bp_TGtkButton_in_button) and - bm_TGtkButton_in_button) - -proc button_down*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_button_down) shr - bp_TGtkButton_button_down - -proc set_button_down*(a: PButton, `button_down`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`button_down` shl bp_TGtkButton_button_down) and - bm_TGtkButton_button_down) - -proc relief*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_relief) shr bp_TGtkButton_relief - -proc use_underline*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_use_underline) shr - bp_TGtkButton_use_underline - -proc set_use_underline*(a: PButton, `use_underline`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`use_underline` shl bp_TGtkButton_use_underline) and - bm_TGtkButton_use_underline) - -proc use_stock*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_use_stock) shr - bp_TGtkButton_use_stock - -proc set_use_stock*(a: PButton, `use_stock`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`use_stock` shl bp_TGtkButton_use_stock) and - bm_TGtkButton_use_stock) - -proc depressed*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_depressed) shr - bp_TGtkButton_depressed - -proc set_depressed*(a: PButton, `depressed`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`depressed` shl bp_TGtkButton_depressed) and - bm_TGtkButton_depressed) - -proc depress_on_activate*(a: PButton): guint = - result = (a.Buttonflag0 and bm_TGtkButton_depress_on_activate) shr - bp_TGtkButton_depress_on_activate - -proc set_depress_on_activate*(a: PButton, `depress_on_activate`: guint) = - a.Buttonflag0 = a.Buttonflag0 or - (int16(`depress_on_activate` shl bp_TGtkButton_depress_on_activate) and - bm_TGtkButton_depress_on_activate) - -proc TYPE_CALENDAR*(): GType = - result = calendar_get_type() - -proc CALENDAR*(obj: pointer): PCalendar = - result = cast[PCalendar](CHECK_CAST(obj, TYPE_CALENDAR())) - -proc CALENDAR_CLASS*(klass: pointer): PCalendarClass = - result = cast[PCalendarClass](CHECK_CLASS_CAST(klass, TYPE_CALENDAR())) - -proc IS_CALENDAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CALENDAR()) - -proc IS_CALENDAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CALENDAR()) - -proc CALENDAR_GET_CLASS*(obj: pointer): PCalendarClass = - result = cast[PCalendarClass](CHECK_GET_CLASS(obj, TYPE_CALENDAR())) - -proc TYPE_CELL_EDITABLE*(): GType = - result = cell_editable_get_type() - -proc CELL_EDITABLE*(obj: pointer): PCellEditable = - result = cast[PCellEditable](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_CELL_EDITABLE())) - -proc CELL_EDITABLE_CLASS*(obj: pointer): PCellEditableIface = - result = cast[PCellEditableIface](G_TYPE_CHECK_CLASS_CAST(obj, - TYPE_CELL_EDITABLE())) - -proc IS_CELL_EDITABLE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_CELL_EDITABLE()) - -proc CELL_EDITABLE_GET_IFACE*(obj: pointer): PCellEditableIface = - result = cast[PCellEditableIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_CELL_EDITABLE())) - -proc TYPE_CELL_RENDERER*(): GType = - result = cell_renderer_get_type() - -proc CELL_RENDERER*(obj: pointer): PCellRenderer = - result = cast[PCellRenderer](CHECK_CAST(obj, TYPE_CELL_RENDERER())) - -proc CELL_RENDERER_CLASS*(klass: pointer): PCellRendererClass = - result = cast[PCellRendererClass](CHECK_CLASS_CAST(klass, TYPE_CELL_RENDERER())) - -proc IS_CELL_RENDERER*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CELL_RENDERER()) - -proc IS_CELL_RENDERER_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CELL_RENDERER()) - -proc CELL_RENDERER_GET_CLASS*(obj: pointer): PCellRendererClass = - result = cast[PCellRendererClass](CHECK_GET_CLASS(obj, TYPE_CELL_RENDERER())) - -proc mode*(a: PCellRenderer): guint = - result = (a.CellRendererflag0 and bm_TGtkCellRenderer_mode) shr - bp_TGtkCellRenderer_mode - -proc set_mode*(a: PCellRenderer, `mode`: guint) = - a.CellRendererflag0 = a.CellRendererflag0 or - (int16(`mode` shl bp_TGtkCellRenderer_mode) and - bm_TGtkCellRenderer_mode) - -proc visible*(a: PCellRenderer): guint = - result = (a.CellRendererflag0 and bm_TGtkCellRenderer_visible) shr - bp_TGtkCellRenderer_visible - -proc set_visible*(a: PCellRenderer, `visible`: guint) = - a.CellRendererflag0 = a.CellRendererflag0 or - (int16(`visible` shl bp_TGtkCellRenderer_visible) and - bm_TGtkCellRenderer_visible) - -proc is_expander*(a: PCellRenderer): guint = - result = (a.CellRendererflag0 and bm_TGtkCellRenderer_is_expander) shr - bp_TGtkCellRenderer_is_expander - -proc set_is_expander*(a: PCellRenderer, `is_expander`: guint) = - a.CellRendererflag0 = a.CellRendererflag0 or - (int16(`is_expander` shl bp_TGtkCellRenderer_is_expander) and - bm_TGtkCellRenderer_is_expander) - -proc is_expanded*(a: PCellRenderer): guint = - result = (a.CellRendererflag0 and bm_TGtkCellRenderer_is_expanded) shr - bp_TGtkCellRenderer_is_expanded - -proc set_is_expanded*(a: PCellRenderer, `is_expanded`: guint) = - a.CellRendererflag0 = a.CellRendererflag0 or - (int16(`is_expanded` shl bp_TGtkCellRenderer_is_expanded) and - bm_TGtkCellRenderer_is_expanded) - -proc cell_background_set*(a: PCellRenderer): guint = - result = (a.CellRendererflag0 and bm_TGtkCellRenderer_cell_background_set) shr - bp_TGtkCellRenderer_cell_background_set - -proc set_cell_background_set*(a: PCellRenderer, `cell_background_set`: guint) = - a.CellRendererflag0 = a.CellRendererflag0 or - (int16(`cell_background_set` shl - bp_TGtkCellRenderer_cell_background_set) and - bm_TGtkCellRenderer_cell_background_set) - -proc TYPE_CELL_RENDERER_TEXT*(): GType = - result = cell_renderer_text_get_type() - -proc CELL_RENDERER_TEXT*(obj: pointer): PCellRendererText = - result = cast[PCellRendererText](CHECK_CAST(obj, TYPE_CELL_RENDERER_TEXT())) - -proc CELL_RENDERER_TEXT_CLASS*(klass: pointer): PCellRendererTextClass = - result = cast[PCellRendererTextClass](CHECK_CLASS_CAST(klass, - TYPE_CELL_RENDERER_TEXT())) - -proc IS_CELL_RENDERER_TEXT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CELL_RENDERER_TEXT()) - -proc IS_CELL_RENDERER_TEXT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CELL_RENDERER_TEXT()) - -proc CELL_RENDERER_TEXT_GET_CLASS*(obj: pointer): PCellRendererTextClass = - result = cast[PCellRendererTextClass](CHECK_GET_CLASS(obj, - TYPE_CELL_RENDERER_TEXT())) - -proc strikethrough*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and bm_TGtkCellRendererText_strikethrough) shr - bp_TGtkCellRendererText_strikethrough - -proc set_strikethrough*(a: PCellRendererText, `strikethrough`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`strikethrough` shl bp_TGtkCellRendererText_strikethrough) and - bm_TGtkCellRendererText_strikethrough) - -proc editable*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and bm_TGtkCellRendererText_editable) shr - bp_TGtkCellRendererText_editable - -proc set_editable*(a: PCellRendererText, `editable`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`editable` shl bp_TGtkCellRendererText_editable) and - bm_TGtkCellRendererText_editable) - -proc scale_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and bm_TGtkCellRendererText_scale_set) shr - bp_TGtkCellRendererText_scale_set - -proc set_scale_set*(a: PCellRendererText, `scale_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`scale_set` shl bp_TGtkCellRendererText_scale_set) and - bm_TGtkCellRendererText_scale_set) - -proc foreground_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and - bm_TGtkCellRendererText_foreground_set) shr - bp_TGtkCellRendererText_foreground_set - -proc set_foreground_set*(a: PCellRendererText, `foreground_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`foreground_set` shl bp_TGtkCellRendererText_foreground_set) and - bm_TGtkCellRendererText_foreground_set) - -proc background_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and - bm_TGtkCellRendererText_background_set) shr - bp_TGtkCellRendererText_background_set - -proc set_background_set*(a: PCellRendererText, `background_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`background_set` shl bp_TGtkCellRendererText_background_set) and - bm_TGtkCellRendererText_background_set) - -proc underline_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and bm_TGtkCellRendererText_underline_set) shr - bp_TGtkCellRendererText_underline_set - -proc set_underline_set*(a: PCellRendererText, `underline_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`underline_set` shl bp_TGtkCellRendererText_underline_set) and - bm_TGtkCellRendererText_underline_set) - -proc rise_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and bm_TGtkCellRendererText_rise_set) shr - bp_TGtkCellRendererText_rise_set - -proc set_rise_set*(a: PCellRendererText, `rise_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`rise_set` shl bp_TGtkCellRendererText_rise_set) and - bm_TGtkCellRendererText_rise_set) - -proc strikethrough_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and - bm_TGtkCellRendererText_strikethrough_set) shr - bp_TGtkCellRendererText_strikethrough_set - -proc set_strikethrough_set*(a: PCellRendererText, `strikethrough_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`strikethrough_set` shl - bp_TGtkCellRendererText_strikethrough_set) and - bm_TGtkCellRendererText_strikethrough_set) - -proc editable_set*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and bm_TGtkCellRendererText_editable_set) shr - bp_TGtkCellRendererText_editable_set - -proc set_editable_set*(a: PCellRendererText, `editable_set`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`editable_set` shl bp_TGtkCellRendererText_editable_set) and - bm_TGtkCellRendererText_editable_set) - -proc calc_fixed_height*(a: PCellRendererText): guint = - result = (a.CellRendererTextflag0 and - bm_TGtkCellRendererText_calc_fixed_height) shr - bp_TGtkCellRendererText_calc_fixed_height - -proc set_calc_fixed_height*(a: PCellRendererText, `calc_fixed_height`: guint) = - a.CellRendererTextflag0 = a.CellRendererTextflag0 or - (int16(`calc_fixed_height` shl - bp_TGtkCellRendererText_calc_fixed_height) and - bm_TGtkCellRendererText_calc_fixed_height) - -proc TYPE_CELL_RENDERER_TOGGLE*(): GType = - result = cell_renderer_toggle_get_type() - -proc CELL_RENDERER_TOGGLE*(obj: pointer): PCellRendererToggle = - result = cast[PCellRendererToggle](CHECK_CAST(obj, TYPE_CELL_RENDERER_TOGGLE())) - -proc CELL_RENDERER_TOGGLE_CLASS*(klass: pointer): PCellRendererToggleClass = - result = cast[PCellRendererToggleClass](CHECK_CLASS_CAST(klass, - TYPE_CELL_RENDERER_TOGGLE())) - -proc IS_CELL_RENDERER_TOGGLE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CELL_RENDERER_TOGGLE()) - -proc IS_CELL_RENDERER_TOGGLE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CELL_RENDERER_TOGGLE()) - -proc CELL_RENDERER_TOGGLE_GET_CLASS*(obj: pointer): PCellRendererToggleClass = - result = cast[PCellRendererToggleClass](CHECK_GET_CLASS(obj, - TYPE_CELL_RENDERER_TOGGLE())) - -proc active*(a: PCellRendererToggle): guint = - result = (a.CellRendererToggleflag0 and bm_TGtkCellRendererToggle_active) shr - bp_TGtkCellRendererToggle_active - -proc set_active*(a: PCellRendererToggle, `active`: guint) = - a.CellRendererToggleflag0 = a.CellRendererToggleflag0 or - (int16(`active` shl bp_TGtkCellRendererToggle_active) and - bm_TGtkCellRendererToggle_active) - -proc activatable*(a: PCellRendererToggle): guint = - result = (a.CellRendererToggleflag0 and - bm_TGtkCellRendererToggle_activatable) shr - bp_TGtkCellRendererToggle_activatable - -proc set_activatable*(a: PCellRendererToggle, `activatable`: guint) = - a.CellRendererToggleflag0 = a.CellRendererToggleflag0 or - (int16(`activatable` shl bp_TGtkCellRendererToggle_activatable) and - bm_TGtkCellRendererToggle_activatable) - -proc radio*(a: PCellRendererToggle): guint = - result = (a.CellRendererToggleflag0 and bm_TGtkCellRendererToggle_radio) shr - bp_TGtkCellRendererToggle_radio - -proc set_radio*(a: PCellRendererToggle, `radio`: guint) = - a.CellRendererToggleflag0 = a.CellRendererToggleflag0 or - (int16(`radio` shl bp_TGtkCellRendererToggle_radio) and - bm_TGtkCellRendererToggle_radio) - -proc TYPE_CELL_RENDERER_PIXBUF*(): GType = - result = cell_renderer_pixbuf_get_type() - -proc CELL_RENDERER_PIXBUF*(obj: pointer): PCellRendererPixbuf = - result = cast[PCellRendererPixbuf](CHECK_CAST(obj, TYPE_CELL_RENDERER_PIXBUF())) - -proc CELL_RENDERER_PIXBUF_CLASS*(klass: pointer): PCellRendererPixbufClass = - result = cast[PCellRendererPixbufClass](CHECK_CLASS_CAST(klass, - TYPE_CELL_RENDERER_PIXBUF())) - -proc IS_CELL_RENDERER_PIXBUF*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CELL_RENDERER_PIXBUF()) - -proc IS_CELL_RENDERER_PIXBUF_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CELL_RENDERER_PIXBUF()) - -proc CELL_RENDERER_PIXBUF_GET_CLASS*(obj: pointer): PCellRendererPixbufClass = - result = cast[PCellRendererPixbufClass](CHECK_GET_CLASS(obj, - TYPE_CELL_RENDERER_PIXBUF())) - -proc TYPE_ITEM*(): GType = - result = item_get_type() - -proc ITEM*(obj: pointer): PItem = - result = cast[PItem](CHECK_CAST(obj, TYPE_ITEM())) - -proc ITEM_CLASS*(klass: pointer): PItemClass = - result = cast[PItemClass](CHECK_CLASS_CAST(klass, TYPE_ITEM())) - -proc IS_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ITEM()) - -proc IS_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ITEM()) - -proc ITEM_GET_CLASS*(obj: pointer): PItemClass = - result = cast[PItemClass](CHECK_GET_CLASS(obj, TYPE_ITEM())) - -proc TYPE_MENU_ITEM*(): GType = - result = menu_item_get_type() - -proc MENU_ITEM*(obj: pointer): PMenuItem = - result = cast[PMenuItem](CHECK_CAST(obj, TYPE_MENU_ITEM())) - -proc MENU_ITEM_CLASS*(klass: pointer): PMenuItemClass = - result = cast[PMenuItemClass](CHECK_CLASS_CAST(klass, TYPE_MENU_ITEM())) - -proc IS_MENU_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_MENU_ITEM()) - -proc IS_MENU_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_MENU_ITEM()) - -proc MENU_ITEM_GET_CLASS*(obj: pointer): PMenuItemClass = - result = cast[PMenuItemClass](CHECK_GET_CLASS(obj, TYPE_MENU_ITEM())) - -proc show_submenu_indicator*(a: PMenuItem): guint = - result = (a.MenuItemflag0 and bm_TGtkMenuItem_show_submenu_indicator) shr - bp_TGtkMenuItem_show_submenu_indicator - -proc set_show_submenu_indicator*(a: PMenuItem, - `show_submenu_indicator`: guint) = - a.MenuItemflag0 = a.MenuItemflag0 or - (int16(`show_submenu_indicator` shl - bp_TGtkMenuItem_show_submenu_indicator) and - bm_TGtkMenuItem_show_submenu_indicator) - -proc submenu_placement*(a: PMenuItem): guint = - result = (a.MenuItemflag0 and bm_TGtkMenuItem_submenu_placement) shr - bp_TGtkMenuItem_submenu_placement - -proc set_submenu_placement*(a: PMenuItem, `submenu_placement`: guint) = - a.MenuItemflag0 = a.MenuItemflag0 or - (int16(`submenu_placement` shl bp_TGtkMenuItem_submenu_placement) and - bm_TGtkMenuItem_submenu_placement) - -proc submenu_direction*(a: PMenuItem): guint = - result = (a.MenuItemflag0 and bm_TGtkMenuItem_submenu_direction) shr - bp_TGtkMenuItem_submenu_direction - -proc set_submenu_direction*(a: PMenuItem, `submenu_direction`: guint) = - a.MenuItemflag0 = a.MenuItemflag0 or - (int16(`submenu_direction` shl bp_TGtkMenuItem_submenu_direction) and - bm_TGtkMenuItem_submenu_direction) - -proc right_justify*(a: PMenuItem): guint = - result = (a.MenuItemflag0 and bm_TGtkMenuItem_right_justify) shr - bp_TGtkMenuItem_right_justify - -proc set_right_justify*(a: PMenuItem, `right_justify`: guint) = - a.MenuItemflag0 = a.MenuItemflag0 or - (int16(`right_justify` shl bp_TGtkMenuItem_right_justify) and - bm_TGtkMenuItem_right_justify) - -proc timer_from_keypress*(a: PMenuItem): guint = - result = (a.MenuItemflag0 and bm_TGtkMenuItem_timer_from_keypress) shr - bp_TGtkMenuItem_timer_from_keypress - -proc set_timer_from_keypress*(a: PMenuItem, `timer_from_keypress`: guint) = - a.MenuItemflag0 = a.MenuItemflag0 or - (int16(`timer_from_keypress` shl bp_TGtkMenuItem_timer_from_keypress) and - bm_TGtkMenuItem_timer_from_keypress) - -proc hide_on_activate*(a: PMenuItemClass): guint = - result = (a.MenuItemClassflag0 and bm_TGtkMenuItemClass_hide_on_activate) shr - bp_TGtkMenuItemClass_hide_on_activate - -proc set_hide_on_activate*(a: PMenuItemClass, `hide_on_activate`: guint) = - a.MenuItemClassflag0 = a.MenuItemClassflag0 or - (int16(`hide_on_activate` shl bp_TGtkMenuItemClass_hide_on_activate) and - bm_TGtkMenuItemClass_hide_on_activate) - -proc right_justify*(menu_item: PMenuItem) = - set_right_justified(menu_item, system.true) - -proc TYPE_TOGGLE_BUTTON*(): GType = - result = toggle_button_get_type() - -proc TOGGLE_BUTTON*(obj: pointer): PToggleButton = - result = cast[PToggleButton](CHECK_CAST(obj, TYPE_TOGGLE_BUTTON())) - -proc TOGGLE_BUTTON_CLASS*(klass: pointer): PToggleButtonClass = - result = cast[PToggleButtonClass](CHECK_CLASS_CAST(klass, TYPE_TOGGLE_BUTTON())) - -proc IS_TOGGLE_BUTTON*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TOGGLE_BUTTON()) - -proc IS_TOGGLE_BUTTON_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TOGGLE_BUTTON()) - -proc TOGGLE_BUTTON_GET_CLASS*(obj: pointer): PToggleButtonClass = - result = cast[PToggleButtonClass](CHECK_GET_CLASS(obj, TYPE_TOGGLE_BUTTON())) - -proc active*(a: PToggleButton): guint = - result = (a.ToggleButtonflag0 and bm_TGtkToggleButton_active) shr - bp_TGtkToggleButton_active - -proc set_active*(a: PToggleButton, `active`: guint) = - a.ToggleButtonflag0 = a.ToggleButtonflag0 or - (int16(`active` shl bp_TGtkToggleButton_active) and - bm_TGtkToggleButton_active) - -proc draw_indicator*(a: PToggleButton): guint = - result = (a.ToggleButtonflag0 and bm_TGtkToggleButton_draw_indicator) shr - bp_TGtkToggleButton_draw_indicator - -proc set_draw_indicator*(a: PToggleButton, `draw_indicator`: guint) = - a.ToggleButtonflag0 = a.ToggleButtonflag0 or - (int16(`draw_indicator` shl bp_TGtkToggleButton_draw_indicator) and - bm_TGtkToggleButton_draw_indicator) - -proc inconsistent*(a: PToggleButton): guint = - result = (a.ToggleButtonflag0 and bm_TGtkToggleButton_inconsistent) shr - bp_TGtkToggleButton_inconsistent - -proc set_inconsistent*(a: PToggleButton, `inconsistent`: guint) = - a.ToggleButtonflag0 = a.ToggleButtonflag0 or - (int16(`inconsistent` shl bp_TGtkToggleButton_inconsistent) and - bm_TGtkToggleButton_inconsistent) - -proc TYPE_CHECK_BUTTON*(): GType = - result = check_button_get_type() - -proc CHECK_BUTTON*(obj: pointer): PCheckButton = - result = cast[PCheckButton](CHECK_CAST(obj, TYPE_CHECK_BUTTON())) - -proc CHECK_BUTTON_CLASS*(klass: pointer): PCheckButtonClass = - result = cast[PCheckButtonClass](CHECK_CLASS_CAST(klass, TYPE_CHECK_BUTTON())) - -proc IS_CHECK_BUTTON*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CHECK_BUTTON()) - -proc IS_CHECK_BUTTON_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CHECK_BUTTON()) - -proc CHECK_BUTTON_GET_CLASS*(obj: pointer): PCheckButtonClass = - result = cast[PCheckButtonClass](CHECK_GET_CLASS(obj, TYPE_CHECK_BUTTON())) - -proc TYPE_CHECK_MENU_ITEM*(): GType = - result = check_menu_item_get_type() - -proc CHECK_MENU_ITEM*(obj: pointer): PCheckMenuItem = - result = cast[PCheckMenuItem](CHECK_CAST(obj, TYPE_CHECK_MENU_ITEM())) - -proc CHECK_MENU_ITEM_CLASS*(klass: pointer): PCheckMenuItemClass = - result = cast[PCheckMenuItemClass](CHECK_CLASS_CAST(klass, - TYPE_CHECK_MENU_ITEM())) - -proc IS_CHECK_MENU_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CHECK_MENU_ITEM()) - -proc IS_CHECK_MENU_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CHECK_MENU_ITEM()) - -proc CHECK_MENU_ITEM_GET_CLASS*(obj: pointer): PCheckMenuItemClass = - result = cast[PCheckMenuItemClass](CHECK_GET_CLASS(obj, TYPE_CHECK_MENU_ITEM())) - -proc active*(a: PCheckMenuItem): guint = - result = (a.CheckMenuItemflag0 and bm_TGtkCheckMenuItem_active) shr - bp_TGtkCheckMenuItem_active - -proc set_active*(a: PCheckMenuItem, `active`: guint) = - a.CheckMenuItemflag0 = a.CheckMenuItemflag0 or - (int16(`active` shl bp_TGtkCheckMenuItem_active) and - bm_TGtkCheckMenuItem_active) - -proc always_show_toggle*(a: PCheckMenuItem): guint = - result = (a.CheckMenuItemflag0 and bm_TGtkCheckMenuItem_always_show_toggle) shr - bp_TGtkCheckMenuItem_always_show_toggle - -proc set_always_show_toggle*(a: PCheckMenuItem, `always_show_toggle`: guint) = - a.CheckMenuItemflag0 = a.CheckMenuItemflag0 or - (int16(`always_show_toggle` shl bp_TGtkCheckMenuItem_always_show_toggle) and - bm_TGtkCheckMenuItem_always_show_toggle) - -proc inconsistent*(a: PCheckMenuItem): guint = - result = (a.CheckMenuItemflag0 and bm_TGtkCheckMenuItem_inconsistent) shr - bp_TGtkCheckMenuItem_inconsistent - -proc set_inconsistent*(a: PCheckMenuItem, `inconsistent`: guint) = - a.CheckMenuItemflag0 = a.CheckMenuItemflag0 or - (int16(`inconsistent` shl bp_TGtkCheckMenuItem_inconsistent) and - bm_TGtkCheckMenuItem_inconsistent) - -proc TYPE_CLIST*(): GType = - result = clist_get_type() - -proc CLIST*(obj: pointer): PCList = - result = cast[PCList](CHECK_CAST(obj, TYPE_CLIST())) - -proc CLIST_CLASS*(klass: pointer): PCListClass = - result = cast[PCListClass](CHECK_CLASS_CAST(klass, TYPE_CLIST())) - -proc IS_CLIST*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CLIST()) - -proc IS_CLIST_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CLIST()) - -proc CLIST_GET_CLASS*(obj: pointer): PCListClass = - result = cast[PCListClass](CHECK_GET_CLASS(obj, TYPE_CLIST())) - -proc CLIST_FLAGS*(clist: pointer): guint16 = - result = toU16(CLIST(clist).flags) - -proc SET_FLAG*(clist: PCList, flag: guint16) = - clist.flags = CLIST(clist).flags or (flag) - -proc UNSET_FLAG*(clist: PCList, flag: guint16) = - clist.flags = CLIST(clist).flags and not (flag) - -proc CLIST_IN_DRAG_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_IN_DRAG)) != 0'i32 - -proc CLIST_ROW_HEIGHT_SET_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_ROW_HEIGHT_SET)) != 0'i32 - -proc CLIST_SHOW_TITLES_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_SHOW_TITLES)) != 0'i32 - -proc CLIST_ADD_MODE_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_ADD_MODE)) != 0'i32 - -proc CLIST_AUTO_SORT_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_AUTO_SORT)) != 0'i32 - -proc CLIST_AUTO_RESIZE_BLOCKED_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_AUTO_RESIZE_BLOCKED)) != 0'i32 - -proc CLIST_REORDERABLE_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_REORDERABLE)) != 0'i32 - -proc CLIST_USE_DRAG_ICONS_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_USE_DRAG_ICONS)) != 0'i32 - -proc CLIST_DRAW_DRAG_LINE_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_DRAW_DRAG_LINE)) != 0'i32 - -proc CLIST_DRAW_DRAG_RECT_get*(clist: pointer): bool = - result = ((CLIST_FLAGS(clist)) and cint(CLIST_DRAW_DRAG_RECT)) != 0'i32 - -proc CLIST_ROW_get*(glist: PGList): PCListRow = - result = cast[PCListRow](glist.data) - -when false: - proc CELL_TEXT_get*(cell: pointer): PCellText = - result = cast[PCellText](addr((cell))) - - proc CELL_PIXMAP_get*(cell: pointer): PCellPixmap = - result = cast[PCellPixmap](addr((cell))) - - proc CELL_PIXTEXT_get*(cell: pointer): PCellPixText = - result = cast[PCellPixText](addr((cell))) - - proc CELL_WIDGET_get*(cell: pointer): PCellWidget = - result = cast[PCellWidget](addr((cell))) - -proc visible*(a: PCListColumn): guint = - result = (a.flag0 and bm_TGtkCListColumn_visible) shr - bp_TGtkCListColumn_visible - -proc set_visible*(a: PCListColumn, `visible`: guint) = - a.flag0 = a.flag0 or - (int16(`visible` shl bp_TGtkCListColumn_visible) and - bm_TGtkCListColumn_visible) - -proc width_set*(a: PCListColumn): guint = - result = (a.flag0 and bm_TGtkCListColumn_width_set) shr - bp_TGtkCListColumn_width_set - -proc set_width_set*(a: PCListColumn, `width_set`: guint) = - a.flag0 = a.flag0 or - (int16(`width_set` shl bp_TGtkCListColumn_width_set) and - bm_TGtkCListColumn_width_set) - -proc resizeable*(a: PCListColumn): guint = - result = (a.flag0 and bm_TGtkCListColumn_resizeable) shr - bp_TGtkCListColumn_resizeable - -proc set_resizeable*(a: PCListColumn, `resizeable`: guint) = - a.flag0 = a.flag0 or - (int16(`resizeable` shl bp_TGtkCListColumn_resizeable) and - bm_TGtkCListColumn_resizeable) - -proc auto_resize*(a: PCListColumn): guint = - result = (a.flag0 and bm_TGtkCListColumn_auto_resize) shr - bp_TGtkCListColumn_auto_resize - -proc set_auto_resize*(a: PCListColumn, `auto_resize`: guint) = - a.flag0 = a.flag0 or - (int16(`auto_resize` shl bp_TGtkCListColumn_auto_resize) and - bm_TGtkCListColumn_auto_resize) - -proc button_passive*(a: PCListColumn): guint = - result = (a.flag0 and bm_TGtkCListColumn_button_passive) shr - bp_TGtkCListColumn_button_passive - -proc set_button_passive*(a: PCListColumn, `button_passive`: guint) = - a.flag0 = a.flag0 or - (int16(`button_passive` shl bp_TGtkCListColumn_button_passive) and - bm_TGtkCListColumn_button_passive) - -proc fg_set*(a: PCListRow): guint = - result = (a.flag0 and bm_TGtkCListRow_fg_set) shr bp_TGtkCListRow_fg_set - -proc set_fg_set*(a: PCListRow, `fg_set`: guint) = - a.flag0 = a.flag0 or - (int16(`fg_set` shl bp_TGtkCListRow_fg_set) and bm_TGtkCListRow_fg_set) - -proc bg_set*(a: PCListRow): guint = - result = (a.flag0 and bm_TGtkCListRow_bg_set) shr bp_TGtkCListRow_bg_set - -proc set_bg_set*(a: PCListRow, `bg_set`: guint) = - a.flag0 = a.flag0 or - (int16(`bg_set` shl bp_TGtkCListRow_bg_set) and bm_TGtkCListRow_bg_set) - -proc selectable*(a: PCListRow): guint = - result = (a.flag0 and bm_TGtkCListRow_selectable) shr - bp_TGtkCListRow_selectable - -proc set_selectable*(a: PCListRow, `selectable`: guint) = - a.flag0 = a.flag0 or - (int16(`selectable` shl bp_TGtkCListRow_selectable) and - bm_TGtkCListRow_selectable) - -proc TYPE_DIALOG*(): GType = - result = dialog_get_type() - -proc DIALOG*(obj: pointer): PDialog = - result = cast[PDialog](CHECK_CAST(obj, TYPE_DIALOG())) - -proc DIALOG_CLASS*(klass: pointer): PDialogClass = - result = cast[PDialogClass](CHECK_CLASS_CAST(klass, TYPE_DIALOG())) - -proc IS_DIALOG*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_DIALOG()) - -proc IS_DIALOG_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_DIALOG()) - -proc DIALOG_GET_CLASS*(obj: pointer): PDialogClass = - result = cast[PDialogClass](CHECK_GET_CLASS(obj, TYPE_DIALOG())) - -proc TYPE_VBOX*(): GType = - result = vbox_get_type() - -proc VBOX*(obj: pointer): PVBox = - result = cast[PVBox](CHECK_CAST(obj, TYPE_VBOX())) - -proc VBOX_CLASS*(klass: pointer): PVBoxClass = - result = cast[PVBoxClass](CHECK_CLASS_CAST(klass, TYPE_VBOX())) - -proc IS_VBOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VBOX()) - -proc IS_VBOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VBOX()) - -proc VBOX_GET_CLASS*(obj: pointer): PVBoxClass = - result = cast[PVBoxClass](CHECK_GET_CLASS(obj, TYPE_VBOX())) - -proc TYPE_COLOR_SELECTION*(): GType = - result = color_selection_get_type() - -proc COLOR_SELECTION*(obj: pointer): PColorSelection = - result = cast[PColorSelection](CHECK_CAST(obj, TYPE_COLOR_SELECTION())) - -proc COLOR_SELECTION_CLASS*(klass: pointer): PColorSelectionClass = - result = cast[PColorSelectionClass](CHECK_CLASS_CAST(klass, - TYPE_COLOR_SELECTION())) - -proc IS_COLOR_SELECTION*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_COLOR_SELECTION()) - -proc IS_COLOR_SELECTION_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_COLOR_SELECTION()) - -proc COLOR_SELECTION_GET_CLASS*(obj: pointer): PColorSelectionClass = - result = cast[PColorSelectionClass](CHECK_GET_CLASS(obj, - TYPE_COLOR_SELECTION())) - -proc TYPE_COLOR_SELECTION_DIALOG*(): GType = - result = color_selection_dialog_get_type() - -proc COLOR_SELECTION_DIALOG*(obj: pointer): PColorSelectionDialog = - result = cast[PColorSelectionDialog](CHECK_CAST(obj, - TYPE_COLOR_SELECTION_DIALOG())) - -proc COLOR_SELECTION_DIALOG_CLASS*(klass: pointer): PColorSelectionDialogClass = - result = cast[PColorSelectionDialogClass](CHECK_CLASS_CAST(klass, - TYPE_COLOR_SELECTION_DIALOG())) - -proc IS_COLOR_SELECTION_DIALOG*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_COLOR_SELECTION_DIALOG()) - -proc IS_COLOR_SELECTION_DIALOG_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_COLOR_SELECTION_DIALOG()) - -proc COLOR_SELECTION_DIALOG_GET_CLASS*(obj: pointer): PColorSelectionDialogClass = - result = cast[PColorSelectionDialogClass](CHECK_GET_CLASS(obj, - TYPE_COLOR_SELECTION_DIALOG())) - -proc TYPE_HBOX*(): GType = - result = hbox_get_type() - -proc HBOX*(obj: pointer): PHBox = - result = cast[PHBox](CHECK_CAST(obj, TYPE_HBOX())) - -proc HBOX_CLASS*(klass: pointer): PHBoxClass = - result = cast[PHBoxClass](CHECK_CLASS_CAST(klass, TYPE_HBOX())) - -proc IS_HBOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HBOX()) - -proc IS_HBOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HBOX()) - -proc HBOX_GET_CLASS*(obj: pointer): PHBoxClass = - result = cast[PHBoxClass](CHECK_GET_CLASS(obj, TYPE_HBOX())) - -proc TYPE_COMBO*(): GType = - result = combo_get_type() - -proc COMBO*(obj: pointer): PCombo = - result = cast[PCombo](CHECK_CAST(obj, TYPE_COMBO())) - -proc COMBO_CLASS*(klass: pointer): PComboClass = - result = cast[PComboClass](CHECK_CLASS_CAST(klass, TYPE_COMBO())) - -proc IS_COMBO*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_COMBO()) - -proc IS_COMBO_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_COMBO()) - -proc COMBO_GET_CLASS*(obj: pointer): PComboClass = - result = cast[PComboClass](CHECK_GET_CLASS(obj, TYPE_COMBO())) - -proc value_in_list*(a: PCombo): guint = - result = (a.Comboflag0 and bm_TGtkCombo_value_in_list) shr - bp_TGtkCombo_value_in_list - -proc set_value_in_list*(a: PCombo, `value_in_list`: guint) = - a.Comboflag0 = a.Comboflag0 or - (int16(`value_in_list` shl bp_TGtkCombo_value_in_list) and - bm_TGtkCombo_value_in_list) - -proc ok_if_empty*(a: PCombo): guint = - result = (a.Comboflag0 and bm_TGtkCombo_ok_if_empty) shr - bp_TGtkCombo_ok_if_empty - -proc set_ok_if_empty*(a: PCombo, `ok_if_empty`: guint) = - a.Comboflag0 = a.Comboflag0 or - (int16(`ok_if_empty` shl bp_TGtkCombo_ok_if_empty) and - bm_TGtkCombo_ok_if_empty) - -proc case_sensitive*(a: PCombo): guint = - result = (a.Comboflag0 and bm_TGtkCombo_case_sensitive) shr - bp_TGtkCombo_case_sensitive - -proc set_case_sensitive*(a: PCombo, `case_sensitive`: guint) = - a.Comboflag0 = a.Comboflag0 or - (int16(`case_sensitive` shl bp_TGtkCombo_case_sensitive) and - bm_TGtkCombo_case_sensitive) - -proc use_arrows*(a: PCombo): guint = - result = (a.Comboflag0 and bm_TGtkCombo_use_arrows) shr - bp_TGtkCombo_use_arrows - -proc set_use_arrows*(a: PCombo, `use_arrows`: guint) = - a.Comboflag0 = a.Comboflag0 or - (int16(`use_arrows` shl bp_TGtkCombo_use_arrows) and - bm_TGtkCombo_use_arrows) - -proc use_arrows_always*(a: PCombo): guint = - result = (a.Comboflag0 and bm_TGtkCombo_use_arrows_always) shr - bp_TGtkCombo_use_arrows_always - -proc set_use_arrows_always*(a: PCombo, `use_arrows_always`: guint) = - a.Comboflag0 = a.Comboflag0 or - (int16(`use_arrows_always` shl bp_TGtkCombo_use_arrows_always) and - bm_TGtkCombo_use_arrows_always) - -proc TYPE_CTREE*(): GType = - result = ctree_get_type() - -proc CTREE*(obj: pointer): PCTree = - result = cast[PCTree](CHECK_CAST(obj, TYPE_CTREE())) - -proc CTREE_CLASS*(klass: pointer): PCTreeClass = - result = cast[PCTreeClass](CHECK_CLASS_CAST(klass, TYPE_CTREE())) - -proc IS_CTREE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CTREE()) - -proc IS_CTREE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CTREE()) - -proc CTREE_GET_CLASS*(obj: pointer): PCTreeClass = - result = cast[PCTreeClass](CHECK_GET_CLASS(obj, TYPE_CTREE())) - -proc CTREE_ROW*(node: TAddress): PCTreeRow = - result = cast[PCTreeRow]((cast[PGList](node)).data) - -proc CTREE_NODE*(node: TAddress): PCTreeNode = - result = cast[PCTreeNode](node) - -proc CTREE_NODE_NEXT*(nnode: TAddress): PCTreeNode = - result = cast[PCTreeNode]((cast[PGList](nnode)).next) - -proc CTREE_NODE_PREV*(pnode: TAddress): PCTreeNode = - result = cast[PCTreeNode]((cast[PGList](pnode)).prev) - -proc CTREE_FUNC*(fun: TAddress): TCTreeFunc = - result = cast[TCTreeFunc](fun) - -proc TYPE_CTREE_NODE*(): GType = - result = ctree_node_get_type() - -proc line_style*(a: PCTree): guint = - result = (a.CTreeflag0 and bm_TGtkCTree_line_style) shr - bp_TGtkCTree_line_style - -proc set_line_style*(a: PCTree, `line_style`: guint) = - a.CTreeflag0 = a.CTreeflag0 or - (int16(`line_style` shl bp_TGtkCTree_line_style) and - bm_TGtkCTree_line_style) - -proc expander_style*(a: PCTree): guint = - result = (a.CTreeflag0 and bm_TGtkCTree_expander_style) shr - bp_TGtkCTree_expander_style - -proc set_expander_style*(a: PCTree, `expander_style`: guint) = - a.CTreeflag0 = a.CTreeflag0 or - (int16(`expander_style` shl bp_TGtkCTree_expander_style) and - bm_TGtkCTree_expander_style) - -proc show_stub*(a: PCTree): guint = - result = (a.CTreeflag0 and bm_TGtkCTree_show_stub) shr - bp_TGtkCTree_show_stub - -proc set_show_stub*(a: PCTree, `show_stub`: guint) = - a.CTreeflag0 = a.CTreeflag0 or - (int16(`show_stub` shl bp_TGtkCTree_show_stub) and - bm_TGtkCTree_show_stub) - -proc is_leaf*(a: PCTreeRow): guint = - result = (a.CTreeRow_flag0 and bm_TGtkCTreeRow_is_leaf) shr - bp_TGtkCTreeRow_is_leaf - -proc set_is_leaf*(a: PCTreeRow, `is_leaf`: guint) = - a.CTreeRow_flag0 = a.CTreeRow_flag0 or - (int16(`is_leaf` shl bp_TGtkCTreeRow_is_leaf) and - bm_TGtkCTreeRow_is_leaf) - -proc expanded*(a: PCTreeRow): guint = - result = (a.CTreeRow_flag0 and bm_TGtkCTreeRow_expanded) shr - bp_TGtkCTreeRow_expanded - -proc set_expanded*(a: PCTreeRow, `expanded`: guint) = - a.CTreeRow_flag0 = a.CTreeRowflag0 or - (int16(`expanded` shl bp_TGtkCTreeRow_expanded) and - bm_TGtkCTreeRow_expanded) - -proc ctree_set_reorderable*(t: pointer, r: bool) = - set_reorderable(cast[PCList](t), r) - -proc TYPE_DRAWING_AREA*(): GType = - result = drawing_area_get_type() - -proc DRAWING_AREA*(obj: pointer): PDrawingArea = - result = cast[PDrawingArea](CHECK_CAST(obj, TYPE_DRAWING_AREA())) - -proc DRAWING_AREA_CLASS*(klass: pointer): PDrawingAreaClass = - result = cast[PDrawingAreaClass](CHECK_CLASS_CAST(klass, TYPE_DRAWING_AREA())) - -proc IS_DRAWING_AREA*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_DRAWING_AREA()) - -proc IS_DRAWING_AREA_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_DRAWING_AREA()) - -proc DRAWING_AREA_GET_CLASS*(obj: pointer): PDrawingAreaClass = - result = cast[PDrawingAreaClass](CHECK_GET_CLASS(obj, TYPE_DRAWING_AREA())) - -proc TYPE_CURVE*(): GType = - result = curve_get_type() - -proc CURVE*(obj: pointer): PCurve = - result = cast[PCurve](CHECK_CAST(obj, TYPE_CURVE())) - -proc CURVE_CLASS*(klass: pointer): PCurveClass = - result = cast[PCurveClass](CHECK_CLASS_CAST(klass, TYPE_CURVE())) - -proc IS_CURVE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_CURVE()) - -proc IS_CURVE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_CURVE()) - -proc CURVE_GET_CLASS*(obj: pointer): PCurveClass = - result = cast[PCurveClass](CHECK_GET_CLASS(obj, TYPE_CURVE())) - -proc TYPE_EDITABLE*(): GType = - result = editable_get_type() - -proc EDITABLE*(obj: pointer): PEditable = - result = cast[PEditable](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_EDITABLE())) - -proc EDITABLE_CLASS*(vtable: pointer): PEditableClass = - result = cast[PEditableClass](G_TYPE_CHECK_CLASS_CAST(vtable, TYPE_EDITABLE())) - -proc IS_EDITABLE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_EDITABLE()) - -proc IS_EDITABLE_CLASS*(vtable: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(vtable, TYPE_EDITABLE()) - -proc EDITABLE_GET_CLASS*(inst: pointer): PEditableClass = - result = cast[PEditableClass](G_TYPE_INSTANCE_GET_INTERFACE(inst, - TYPE_EDITABLE())) - -proc TYPE_IM_CONTEXT*(): GType = - result = im_context_get_type() - -proc IM_CONTEXT*(obj: pointer): PIMContext = - result = cast[PIMContext](CHECK_CAST(obj, TYPE_IM_CONTEXT())) - -proc IM_CONTEXT_CLASS*(klass: pointer): PIMContextClass = - result = cast[PIMContextClass](CHECK_CLASS_CAST(klass, TYPE_IM_CONTEXT())) - -proc IS_IM_CONTEXT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_IM_CONTEXT()) - -proc IS_IM_CONTEXT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_IM_CONTEXT()) - -proc IM_CONTEXT_GET_CLASS*(obj: pointer): PIMContextClass = - result = cast[PIMContextClass](CHECK_GET_CLASS(obj, TYPE_IM_CONTEXT())) - -proc TYPE_MENU_SHELL*(): GType = - result = menu_shell_get_type() - -proc MENU_SHELL*(obj: pointer): PMenuShell = - result = cast[PMenuShell](CHECK_CAST(obj, TYPE_MENU_SHELL())) - -proc MENU_SHELL_CLASS*(klass: pointer): PMenuShellClass = - result = cast[PMenuShellClass](CHECK_CLASS_CAST(klass, TYPE_MENU_SHELL())) - -proc IS_MENU_SHELL*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_MENU_SHELL()) - -proc IS_MENU_SHELL_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_MENU_SHELL()) - -proc MENU_SHELL_GET_CLASS*(obj: pointer): PMenuShellClass = - result = cast[PMenuShellClass](CHECK_GET_CLASS(obj, TYPE_MENU_SHELL())) - -proc active*(a: PMenuShell): guint = - result = (a.MenuShellflag0 and bm_TGtkMenuShell_active) shr - bp_TGtkMenuShell_active - -proc set_active*(a: PMenuShell, `active`: guint) = - a.MenuShellflag0 = a.MenuShellflag0 or - (int16(`active` shl bp_TGtkMenuShell_active) and - bm_TGtkMenuShell_active) - -proc have_grab*(a: PMenuShell): guint = - result = (a.MenuShellflag0 and bm_TGtkMenuShell_have_grab) shr - bp_TGtkMenuShell_have_grab - -proc set_have_grab*(a: PMenuShell, `have_grab`: guint) = - a.MenuShellflag0 = a.MenuShellflag0 or - (int16(`have_grab` shl bp_TGtkMenuShell_have_grab) and - bm_TGtkMenuShell_have_grab) - -proc have_xgrab*(a: PMenuShell): guint = - result = (a.MenuShellflag0 and bm_TGtkMenuShell_have_xgrab) shr - bp_TGtkMenuShell_have_xgrab - -proc set_have_xgrab*(a: PMenuShell, `have_xgrab`: guint) = - a.MenuShellflag0 = a.MenuShellflag0 or - (int16(`have_xgrab` shl bp_TGtkMenuShell_have_xgrab) and - bm_TGtkMenuShell_have_xgrab) - -proc ignore_leave*(a: PMenuShell): guint = - result = (a.MenuShellflag0 and bm_TGtkMenuShell_ignore_leave) shr - bp_TGtkMenuShell_ignore_leave - -proc set_ignore_leave*(a: PMenuShell, `ignore_leave`: guint) = - a.MenuShellflag0 = a.MenuShellflag0 or - (int16(`ignore_leave` shl bp_TGtkMenuShell_ignore_leave) and - bm_TGtkMenuShell_ignore_leave) - -proc menu_flag*(a: PMenuShell): guint = - result = (a.MenuShellflag0 and bm_TGtkMenuShell_menu_flag) shr - bp_TGtkMenuShell_menu_flag - -proc set_menu_flag*(a: PMenuShell, `menu_flag`: guint) = - a.MenuShellflag0 = a.MenuShellflag0 or - (int16(`menu_flag` shl bp_TGtkMenuShell_menu_flag) and - bm_TGtkMenuShell_menu_flag) - -proc ignore_enter*(a: PMenuShell): guint = - result = (a.MenuShellflag0 and bm_TGtkMenuShell_ignore_enter) shr - bp_TGtkMenuShell_ignore_enter - -proc set_ignore_enter*(a: PMenuShell, `ignore_enter`: guint) = - a.MenuShellflag0 = a.MenuShellflag0 or - (int16(`ignore_enter` shl bp_TGtkMenuShell_ignore_enter) and - bm_TGtkMenuShell_ignore_enter) - -proc submenu_placement*(a: PMenuShellClass): guint = - result = (a.MenuShellClassflag0 and bm_TGtkMenuShellClass_submenu_placement) shr - bp_TGtkMenuShellClass_submenu_placement - -proc set_submenu_placement*(a: PMenuShellClass, `submenu_placement`: guint) = - a.MenuShellClassflag0 = a.MenuShellClassflag0 or - (int16(`submenu_placement` shl bp_TGtkMenuShellClass_submenu_placement) and - bm_TGtkMenuShellClass_submenu_placement) - -proc TYPE_MENU*(): GType = - result = menu_get_type() - -proc MENU*(obj: pointer): PMenu = - result = cast[PMenu](CHECK_CAST(obj, TYPE_MENU())) - -proc MENU_CLASS*(klass: pointer): PMenuClass = - result = cast[PMenuClass](CHECK_CLASS_CAST(klass, TYPE_MENU())) - -proc IS_MENU*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_MENU()) - -proc IS_MENU_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_MENU()) - -proc MENU_GET_CLASS*(obj: pointer): PMenuClass = - result = cast[PMenuClass](CHECK_GET_CLASS(obj, TYPE_MENU())) - -proc needs_destruction_ref_count*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_needs_destruction_ref_count) shr - bp_TGtkMenu_needs_destruction_ref_count - -proc set_needs_destruction_ref_count*(a: PMenu, - `needs_destruction_ref_count`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`needs_destruction_ref_count` shl - bp_TGtkMenu_needs_destruction_ref_count) and - bm_TGtkMenu_needs_destruction_ref_count) - -proc torn_off*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_torn_off) shr bp_TGtkMenu_torn_off - -proc set_torn_off*(a: PMenu, `torn_off`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`torn_off` shl bp_TGtkMenu_torn_off) and bm_TGtkMenu_torn_off) - -proc tearoff_active*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_tearoff_active) shr - bp_TGtkMenu_tearoff_active - -proc set_tearoff_active*(a: PMenu, `tearoff_active`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`tearoff_active` shl bp_TGtkMenu_tearoff_active) and - bm_TGtkMenu_tearoff_active) - -proc scroll_fast*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_scroll_fast) shr - bp_TGtkMenu_scroll_fast - -proc set_scroll_fast*(a: PMenu, `scroll_fast`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`scroll_fast` shl bp_TGtkMenu_scroll_fast) and - bm_TGtkMenu_scroll_fast) - -proc upper_arrow_visible*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_upper_arrow_visible) shr - bp_TGtkMenu_upper_arrow_visible - -proc set_upper_arrow_visible*(a: PMenu, `upper_arrow_visible`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`upper_arrow_visible` shl bp_TGtkMenu_upper_arrow_visible) and - bm_TGtkMenu_upper_arrow_visible) - -proc lower_arrow_visible*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_lower_arrow_visible) shr - bp_TGtkMenu_lower_arrow_visible - -proc set_lower_arrow_visible*(a: PMenu, `lower_arrow_visible`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`lower_arrow_visible` shl bp_TGtkMenu_lower_arrow_visible) and - bm_TGtkMenu_lower_arrow_visible) - -proc upper_arrow_prelight*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_upper_arrow_prelight) shr - bp_TGtkMenu_upper_arrow_prelight - -proc set_upper_arrow_prelight*(a: PMenu, `upper_arrow_prelight`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`upper_arrow_prelight` shl bp_TGtkMenu_upper_arrow_prelight) and - bm_TGtkMenu_upper_arrow_prelight) - -proc lower_arrow_prelight*(a: PMenu): guint = - result = (a.Menuflag0 and bm_TGtkMenu_lower_arrow_prelight) shr - bp_TGtkMenu_lower_arrow_prelight - -proc set_lower_arrow_prelight*(a: PMenu, `lower_arrow_prelight`: guint) = - a.Menuflag0 = a.Menuflag0 or - (int16(`lower_arrow_prelight` shl bp_TGtkMenu_lower_arrow_prelight) and - bm_TGtkMenu_lower_arrow_prelight) - -proc menu_append*(menu, child: PWidget) = - append(cast[PMenuShell](menu), child) - -proc menu_prepend*(menu, child: PWidget) = - prepend(cast[PMenuShell](menu), child) - -proc menu_insert*(menu, child: PWidget, pos: gint) = - insert(cast[PMenuShell](menu), child, pos) - -proc TYPE_ENTRY*(): GType = - result = entry_get_type() - -proc ENTRY*(obj: pointer): PEntry = - result = cast[PEntry](CHECK_CAST(obj, TYPE_ENTRY())) - -proc ENTRY_CLASS*(klass: pointer): PEntryClass = - result = cast[PEntryClass](CHECK_CLASS_CAST(klass, TYPE_ENTRY())) - -proc IS_ENTRY*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_ENTRY()) - -proc IS_ENTRY_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ENTRY()) - -proc ENTRY_GET_CLASS*(obj: pointer): PEntryClass = - result = cast[PEntryClass](CHECK_GET_CLASS(obj, TYPE_ENTRY())) - -proc editable*(a: PEntry): guint = - result = (a.Entryflag0 and bm_TGtkEntry_editable) shr bp_TGtkEntry_editable - -proc set_editable*(a: PEntry, `editable`: guint) = - a.Entryflag0 = a.Entryflag0 or - (int16(`editable` shl bp_TGtkEntry_editable) and bm_TGtkEntry_editable) - -proc visible*(a: PEntry): guint = - result = (a.Entryflag0 and bm_TGtkEntry_visible) shr bp_TGtkEntry_visible - -proc set_visible*(a: PEntry, `visible`: guint) = - a.Entryflag0 = a.Entryflag0 or - (int16(`visible` shl bp_TGtkEntry_visible) and bm_TGtkEntry_visible) - -proc overwrite_mode*(a: PEntry): guint = - result = (a.Entryflag0 and bm_TGtkEntry_overwrite_mode) shr - bp_TGtkEntry_overwrite_mode - -proc set_overwrite_mode*(a: PEntry, `overwrite_mode`: guint) = - a.Entryflag0 = a.Entryflag0 or - (int16(`overwrite_mode` shl bp_TGtkEntry_overwrite_mode) and - bm_TGtkEntry_overwrite_mode) - -proc in_drag*(a: PEntry): guint = - result = (a.Entryflag0 and bm_TGtkEntry_in_drag) shr bp_TGtkEntry_in_drag - -proc set_in_drag*(a: PEntry, `in_drag`: guint) = - a.Entryflag0 = a.Entryflag0 or - (int16(`in_drag` shl bp_TGtkEntry_in_drag) and bm_TGtkEntry_in_drag) - -proc cache_includes_preedit*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_cache_includes_preedit) shr - bp_TGtkEntry_cache_includes_preedit - -proc set_cache_includes_preedit*(a: PEntry, `cache_includes_preedit`: guint) = - a.flag1 = a.flag1 or - (int16(`cache_includes_preedit` shl bp_TGtkEntry_cache_includes_preedit) and - bm_TGtkEntry_cache_includes_preedit) - -proc need_im_reset*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_need_im_reset) shr - bp_TGtkEntry_need_im_reset - -proc set_need_im_reset*(a: PEntry, `need_im_reset`: guint) = - a.flag1 = a.flag1 or - (int16(`need_im_reset` shl bp_TGtkEntry_need_im_reset) and - bm_TGtkEntry_need_im_reset) - -proc has_frame*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_has_frame) shr bp_TGtkEntry_has_frame - -proc set_has_frame*(a: PEntry, `has_frame`: guint) = - a.flag1 = a.flag1 or - (int16(`has_frame` shl bp_TGtkEntry_has_frame) and - bm_TGtkEntry_has_frame) - -proc activates_default*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_activates_default) shr - bp_TGtkEntry_activates_default - -proc set_activates_default*(a: PEntry, `activates_default`: guint) = - a.flag1 = a.flag1 or - (int16(`activates_default` shl bp_TGtkEntry_activates_default) and - bm_TGtkEntry_activates_default) - -proc cursor_visible*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_cursor_visible) shr - bp_TGtkEntry_cursor_visible - -proc set_cursor_visible*(a: PEntry, `cursor_visible`: guint) = - a.flag1 = a.flag1 or - (int16(`cursor_visible` shl bp_TGtkEntry_cursor_visible) and - bm_TGtkEntry_cursor_visible) - -proc in_click*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_in_click) shr bp_TGtkEntry_in_click - -proc set_in_click*(a: PEntry, `in_click`: guint) = - a.flag1 = a.flag1 or - (int16(`in_click` shl bp_TGtkEntry_in_click) and bm_TGtkEntry_in_click) - -proc is_cell_renderer*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_is_cell_renderer) shr - bp_TGtkEntry_is_cell_renderer - -proc set_is_cell_renderer*(a: PEntry, `is_cell_renderer`: guint) = - a.flag1 = a.flag1 or - (int16(`is_cell_renderer` shl bp_TGtkEntry_is_cell_renderer) and - bm_TGtkEntry_is_cell_renderer) - -proc editing_canceled*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_editing_canceled) shr - bp_TGtkEntry_editing_canceled - -proc set_editing_canceled*(a: PEntry, `editing_canceled`: guint) = - a.flag1 = a.flag1 or - (int16(`editing_canceled` shl bp_TGtkEntry_editing_canceled) and - bm_TGtkEntry_editing_canceled) - -proc mouse_cursor_obscured*(a: PEntry): guint = - result = (a.flag1 and bm_TGtkEntry_mouse_cursor_obscured) shr - bp_TGtkEntry_mouse_cursor_obscured - -proc set_mouse_cursor_obscured*(a: PEntry, `mouse_cursor_obscured`: guint) = - a.flag1 = a.flag1 or - (int16(`mouse_cursor_obscured` shl bp_TGtkEntry_mouse_cursor_obscured) and - bm_TGtkEntry_mouse_cursor_obscured) - -proc TYPE_EVENT_BOX*(): GType = - result = event_box_get_type() - -proc EVENT_BOX*(obj: pointer): PEventBox = - result = cast[PEventBox](CHECK_CAST(obj, TYPE_EVENT_BOX())) - -proc EVENT_BOX_CLASS*(klass: pointer): PEventBoxClass = - result = cast[PEventBoxClass](CHECK_CLASS_CAST(klass, TYPE_EVENT_BOX())) - -proc IS_EVENT_BOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_EVENT_BOX()) - -proc IS_EVENT_BOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_EVENT_BOX()) - -proc EVENT_BOX_GET_CLASS*(obj: pointer): PEventBoxClass = - result = cast[PEventBoxClass](CHECK_GET_CLASS(obj, TYPE_EVENT_BOX())) - -proc TYPE_FILE_SELECTION*(): GType = - result = file_selection_get_type() - -proc FILE_SELECTION*(obj: pointer): PFileSelection = - result = cast[PFileSelection](CHECK_CAST(obj, TYPE_FILE_SELECTION())) - -proc FILE_SELECTION_CLASS*(klass: pointer): PFileSelectionClass = - result = cast[PFileSelectionClass](CHECK_CLASS_CAST(klass, - TYPE_FILE_SELECTION())) - -proc IS_FILE_SELECTION*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_FILE_SELECTION()) - -proc IS_FILE_SELECTION_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_FILE_SELECTION()) - -proc FILE_SELECTION_GET_CLASS*(obj: pointer): PFileSelectionClass = - result = cast[PFileSelectionClass](CHECK_GET_CLASS(obj, TYPE_FILE_SELECTION())) - -proc TYPE_FIXED*(): GType = - result = fixed_get_type() - -proc FIXED*(obj: pointer): PFixed = - result = cast[PFixed](CHECK_CAST(obj, TYPE_FIXED())) - -proc FIXED_CLASS*(klass: pointer): PFixedClass = - result = cast[PFixedClass](CHECK_CLASS_CAST(klass, TYPE_FIXED())) - -proc IS_FIXED*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_FIXED()) - -proc IS_FIXED_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_FIXED()) - -proc FIXED_GET_CLASS*(obj: pointer): PFixedClass = - result = cast[PFixedClass](CHECK_GET_CLASS(obj, TYPE_FIXED())) - -proc TYPE_FONT_SELECTION*(): GType = - result = font_selection_get_type() - -proc FONT_SELECTION*(obj: pointer): PFontSelection = - result = cast[PFontSelection](CHECK_CAST(obj, TYPE_FONT_SELECTION())) - -proc FONT_SELECTION_CLASS*(klass: pointer): PFontSelectionClass = - result = cast[PFontSelectionClass](CHECK_CLASS_CAST(klass, - TYPE_FONT_SELECTION())) - -proc IS_FONT_SELECTION*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_FONT_SELECTION()) - -proc IS_FONT_SELECTION_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_FONT_SELECTION()) - -proc FONT_SELECTION_GET_CLASS*(obj: pointer): PFontSelectionClass = - result = cast[PFontSelectionClass](CHECK_GET_CLASS(obj, TYPE_FONT_SELECTION())) - -proc TYPE_FONT_SELECTION_DIALOG*(): GType = - result = font_selection_dialog_get_type() - -proc FONT_SELECTION_DIALOG*(obj: pointer): PFontSelectionDialog = - result = cast[PFontSelectionDialog](CHECK_CAST(obj, - TYPE_FONT_SELECTION_DIALOG())) - -proc FONT_SELECTION_DIALOG_CLASS*(klass: pointer): PFontSelectionDialogClass = - result = cast[PFontSelectionDialogClass](CHECK_CLASS_CAST(klass, - TYPE_FONT_SELECTION_DIALOG())) - -proc IS_FONT_SELECTION_DIALOG*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_FONT_SELECTION_DIALOG()) - -proc IS_FONT_SELECTION_DIALOG_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_FONT_SELECTION_DIALOG()) - -proc FONT_SELECTION_DIALOG_GET_CLASS*(obj: pointer): PFontSelectionDialogClass = - result = cast[PFontSelectionDialogClass](CHECK_GET_CLASS(obj, - TYPE_FONT_SELECTION_DIALOG())) - -proc TYPE_GAMMA_CURVE*(): GType = - result = gamma_curve_get_type() - -proc GAMMA_CURVE*(obj: pointer): PGammaCurve = - result = cast[PGammaCurve](CHECK_CAST(obj, TYPE_GAMMA_CURVE())) - -proc GAMMA_CURVE_CLASS*(klass: pointer): PGammaCurveClass = - result = cast[PGammaCurveClass](CHECK_CLASS_CAST(klass, TYPE_GAMMA_CURVE())) - -proc IS_GAMMA_CURVE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_GAMMA_CURVE()) - -proc IS_GAMMA_CURVE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_GAMMA_CURVE()) - -proc GAMMA_CURVE_GET_CLASS*(obj: pointer): PGammaCurveClass = - result = cast[PGammaCurveClass](CHECK_GET_CLASS(obj, TYPE_GAMMA_CURVE())) - -proc TYPE_HANDLE_BOX*(): GType = - result = handle_box_get_type() - -proc HANDLE_BOX*(obj: pointer): PHandleBox = - result = cast[PHandleBox](CHECK_CAST(obj, TYPE_HANDLE_BOX())) - -proc HANDLE_BOX_CLASS*(klass: pointer): PHandleBoxClass = - result = cast[PHandleBoxClass](CHECK_CLASS_CAST(klass, TYPE_HANDLE_BOX())) - -proc IS_HANDLE_BOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HANDLE_BOX()) - -proc IS_HANDLE_BOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HANDLE_BOX()) - -proc HANDLE_BOX_GET_CLASS*(obj: pointer): PHandleBoxClass = - result = cast[PHandleBoxClass](CHECK_GET_CLASS(obj, TYPE_HANDLE_BOX())) - -proc handle_position*(a: PHandleBox): guint = - result = (a.HandleBoxflag0 and bm_TGtkHandleBox_handle_position) shr - bp_TGtkHandleBox_handle_position - -proc set_handle_position*(a: PHandleBox, `handle_position`: guint) = - a.HandleBoxflag0 = a.HandleBoxflag0 or - (int16(`handle_position` shl bp_TGtkHandleBox_handle_position) and - bm_TGtkHandleBox_handle_position) - -proc float_window_mapped*(a: PHandleBox): guint = - result = (a.HandleBoxflag0 and bm_TGtkHandleBox_float_window_mapped) shr - bp_TGtkHandleBox_float_window_mapped - -proc set_float_window_mapped*(a: PHandleBox, `float_window_mapped`: guint) = - a.HandleBoxflag0 = a.HandleBoxflag0 or - (int16(`float_window_mapped` shl bp_TGtkHandleBox_float_window_mapped) and - bm_TGtkHandleBox_float_window_mapped) - -proc child_detached*(a: PHandleBox): guint = - result = (a.HandleBoxflag0 and bm_TGtkHandleBox_child_detached) shr - bp_TGtkHandleBox_child_detached - -proc set_child_detached*(a: PHandleBox, `child_detached`: guint) = - a.HandleBoxflag0 = a.HandleBoxflag0 or - (int16(`child_detached` shl bp_TGtkHandleBox_child_detached) and - bm_TGtkHandleBox_child_detached) - -proc in_drag*(a: PHandleBox): guint = - result = (a.HandleBoxflag0 and bm_TGtkHandleBox_in_drag) shr - bp_TGtkHandleBox_in_drag - -proc set_in_drag*(a: PHandleBox, `in_drag`: guint) = - a.HandleBoxflag0 = a.HandleBoxflag0 or - (int16(`in_drag` shl bp_TGtkHandleBox_in_drag) and - bm_TGtkHandleBox_in_drag) - -proc shrink_on_detach*(a: PHandleBox): guint = - result = (a.HandleBoxflag0 and bm_TGtkHandleBox_shrink_on_detach) shr - bp_TGtkHandleBox_shrink_on_detach - -proc set_shrink_on_detach*(a: PHandleBox, `shrink_on_detach`: guint) = - a.HandleBoxflag0 = a.HandleBoxflag0 or - (int16(`shrink_on_detach` shl bp_TGtkHandleBox_shrink_on_detach) and - bm_TGtkHandleBox_shrink_on_detach) - -proc snap_edge*(a: PHandleBox): gint = - result = (a.HandleBoxflag0 and bm_TGtkHandleBox_snap_edge) shr - bp_TGtkHandleBox_snap_edge - -proc set_snap_edge*(a: PHandleBox, `snap_edge`: gint) = - a.HandleBoxflag0 = a.HandleBoxflag0 or - (int16(`snap_edge` shl bp_TGtkHandleBox_snap_edge) and - bm_TGtkHandleBox_snap_edge) - -proc TYPE_PANED*(): GType = - result = paned_get_type() - -proc PANED*(obj: pointer): PPaned = - result = cast[PPaned](CHECK_CAST(obj, TYPE_PANED())) - -proc PANED_CLASS*(klass: pointer): PPanedClass = - result = cast[PPanedClass](CHECK_CLASS_CAST(klass, TYPE_PANED())) - -proc IS_PANED*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_PANED()) - -proc IS_PANED_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_PANED()) - -proc PANED_GET_CLASS*(obj: pointer): PPanedClass = - result = cast[PPanedClass](CHECK_GET_CLASS(obj, TYPE_PANED())) - -proc position_set*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_position_set) shr - bp_TGtkPaned_position_set - -proc set_position_set*(a: PPaned, `position_set`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`position_set` shl bp_TGtkPaned_position_set) and - bm_TGtkPaned_position_set) - -proc in_drag*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_in_drag) shr bp_TGtkPaned_in_drag - -proc set_in_drag*(a: PPaned, `in_drag`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`in_drag` shl bp_TGtkPaned_in_drag) and bm_TGtkPaned_in_drag) - -proc child1_shrink*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_child1_shrink) shr - bp_TGtkPaned_child1_shrink - -proc set_child1_shrink*(a: PPaned, `child1_shrink`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`child1_shrink` shl bp_TGtkPaned_child1_shrink) and - bm_TGtkPaned_child1_shrink) - -proc child1_resize*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_child1_resize) shr - bp_TGtkPaned_child1_resize - -proc set_child1_resize*(a: PPaned, `child1_resize`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`child1_resize` shl bp_TGtkPaned_child1_resize) and - bm_TGtkPaned_child1_resize) - -proc child2_shrink*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_child2_shrink) shr - bp_TGtkPaned_child2_shrink - -proc set_child2_shrink*(a: PPaned, `child2_shrink`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`child2_shrink` shl bp_TGtkPaned_child2_shrink) and - bm_TGtkPaned_child2_shrink) - -proc child2_resize*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_child2_resize) shr - bp_TGtkPaned_child2_resize - -proc set_child2_resize*(a: PPaned, `child2_resize`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`child2_resize` shl bp_TGtkPaned_child2_resize) and - bm_TGtkPaned_child2_resize) - -proc orientation*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_orientation) shr - bp_TGtkPaned_orientation - -proc set_orientation*(a: PPaned, `orientation`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`orientation` shl bp_TGtkPaned_orientation) and - bm_TGtkPaned_orientation) - -proc in_recursion*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_in_recursion) shr - bp_TGtkPaned_in_recursion - -proc set_in_recursion*(a: PPaned, `in_recursion`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`in_recursion` shl bp_TGtkPaned_in_recursion) and - bm_TGtkPaned_in_recursion) - -proc handle_prelit*(a: PPaned): guint = - result = (a.Panedflag0 and bm_TGtkPaned_handle_prelit) shr - bp_TGtkPaned_handle_prelit - -proc set_handle_prelit*(a: PPaned, `handle_prelit`: guint) = - a.Panedflag0 = a.Panedflag0 or - (int16(`handle_prelit` shl bp_TGtkPaned_handle_prelit) and - bm_TGtkPaned_handle_prelit) - -proc paned_gutter_size*(p: pointer, s: gint) = - if (p != nil) and (s != 0'i32): nil - -proc paned_set_gutter_size*(p: pointer, s: gint) = - if (p != nil) and (s != 0'i32): nil - -proc TYPE_HBUTTON_BOX*(): GType = - result = hbutton_box_get_type() - -proc HBUTTON_BOX*(obj: pointer): PHButtonBox = - result = cast[PHButtonBox](CHECK_CAST(obj, TYPE_HBUTTON_BOX())) - -proc HBUTTON_BOX_CLASS*(klass: pointer): PHButtonBoxClass = - result = cast[PHButtonBoxClass](CHECK_CLASS_CAST(klass, TYPE_HBUTTON_BOX())) - -proc IS_HBUTTON_BOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HBUTTON_BOX()) - -proc IS_HBUTTON_BOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HBUTTON_BOX()) - -proc HBUTTON_BOX_GET_CLASS*(obj: pointer): PHButtonBoxClass = - result = cast[PHButtonBoxClass](CHECK_GET_CLASS(obj, TYPE_HBUTTON_BOX())) - -proc TYPE_HPANED*(): GType = - result = hpaned_get_type() - -proc HPANED*(obj: pointer): PHPaned = - result = cast[PHPaned](CHECK_CAST(obj, TYPE_HPANED())) - -proc HPANED_CLASS*(klass: pointer): PHPanedClass = - result = cast[PHPanedClass](CHECK_CLASS_CAST(klass, TYPE_HPANED())) - -proc IS_HPANED*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HPANED()) - -proc IS_HPANED_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HPANED()) - -proc HPANED_GET_CLASS*(obj: pointer): PHPanedClass = - result = cast[PHPanedClass](CHECK_GET_CLASS(obj, TYPE_HPANED())) - -proc TYPE_RULER*(): GType = - result = ruler_get_type() - -proc RULER*(obj: pointer): PRuler = - result = cast[PRuler](CHECK_CAST(obj, TYPE_RULER())) - -proc RULER_CLASS*(klass: pointer): PRulerClass = - result = cast[PRulerClass](CHECK_CLASS_CAST(klass, TYPE_RULER())) - -proc IS_RULER*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_RULER()) - -proc IS_RULER_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_RULER()) - -proc RULER_GET_CLASS*(obj: pointer): PRulerClass = - result = cast[PRulerClass](CHECK_GET_CLASS(obj, TYPE_RULER())) - -proc TYPE_HRULER*(): GType = - result = hruler_get_type() - -proc HRULER*(obj: pointer): PHRuler = - result = cast[PHRuler](CHECK_CAST(obj, TYPE_HRULER())) - -proc HRULER_CLASS*(klass: pointer): PHRulerClass = - result = cast[PHRulerClass](CHECK_CLASS_CAST(klass, TYPE_HRULER())) - -proc IS_HRULER*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HRULER()) - -proc IS_HRULER_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HRULER()) - -proc HRULER_GET_CLASS*(obj: pointer): PHRulerClass = - result = cast[PHRulerClass](CHECK_GET_CLASS(obj, TYPE_HRULER())) - -proc TYPE_SETTINGS*(): GType = - result = settings_get_type() - -proc SETTINGS*(obj: pointer): PSettings = - result = cast[PSettings](CHECK_CAST(obj, TYPE_SETTINGS())) - -proc SETTINGS_CLASS*(klass: pointer): PSettingsClass = - result = cast[PSettingsClass](CHECK_CLASS_CAST(klass, TYPE_SETTINGS())) - -proc IS_SETTINGS*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SETTINGS()) - -proc IS_SETTINGS_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SETTINGS()) - -proc SETTINGS_GET_CLASS*(obj: pointer): PSettingsClass = - result = cast[PSettingsClass](CHECK_GET_CLASS(obj, TYPE_SETTINGS())) - -proc TYPE_RC_STYLE*(): GType = - result = rc_style_get_type() - -proc RC_STYLE_get*(anObject: pointer): PRcStyle = - result = cast[PRcStyle](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_RC_STYLE())) - -proc RC_STYLE_CLASS*(klass: pointer): PRcStyleClass = - result = cast[PRcStyleClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_RC_STYLE())) - -proc IS_RC_STYLE*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_RC_STYLE()) - -proc IS_RC_STYLE_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_RC_STYLE()) - -proc RC_STYLE_GET_CLASS*(obj: pointer): PRcStyleClass = - result = cast[PRcStyleClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_RC_STYLE())) - -proc engine_specified*(a: PRcStyle): guint = - result = (a.RcStyleflag0 and bm_TGtkRcStyle_engine_specified) shr - bp_TGtkRcStyle_engine_specified - -proc set_engine_specified*(a: PRcStyle, `engine_specified`: guint) = - a.RcStyleflag0 = a.RcStyleflag0 or - (int16(`engine_specified` shl bp_TGtkRcStyle_engine_specified) and - bm_TGtkRcStyle_engine_specified) - -proc TYPE_STYLE*(): GType = - result = style_get_type() - -proc STYLE*(anObject: pointer): PStyle = - result = cast[PStyle](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_STYLE())) - -proc STYLE_CLASS*(klass: pointer): PStyleClass = - result = cast[PStyleClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_STYLE())) - -proc IS_STYLE*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_STYLE()) - -proc IS_STYLE_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_STYLE()) - -proc STYLE_GET_CLASS*(obj: pointer): PStyleClass = - result = cast[PStyleClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_STYLE())) - -proc TYPE_BORDER*(): GType = - result = border_get_type() - -proc STYLE_ATTACHED*(style: pointer): bool = - result = ((STYLE(style)).attach_count) > 0'i32 - -proc apply_default_pixmap*(style: PStyle, window: gdk2.PWindow, - state_type: TStateType, area: gdk2.PRectangle, - x: gint, y: gint, width: gint, height: gint) = - apply_default_background(style, window, true, state_type, area, x, y, - width, height) - -proc TYPE_RANGE*(): GType = - result = range_get_type() - -proc RANGE*(obj: pointer): PRange = - result = cast[PRange](CHECK_CAST(obj, TYPE_RANGE())) - -proc RANGE_CLASS*(klass: pointer): PRangeClass = - result = cast[PRangeClass](CHECK_CLASS_CAST(klass, TYPE_RANGE())) - -proc IS_RANGE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_RANGE()) - -proc IS_RANGE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_RANGE()) - -proc RANGE_GET_CLASS*(obj: pointer): PRangeClass = - result = cast[PRangeClass](CHECK_GET_CLASS(obj, TYPE_RANGE())) - -proc inverted*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_inverted) shr bp_TGtkRange_inverted - -proc set_inverted*(a: PRange, `inverted`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`inverted` shl bp_TGtkRange_inverted) and bm_TGtkRange_inverted) - -proc flippable*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_flippable) shr - bp_TGtkRange_flippable - -proc set_flippable*(a: PRange, `flippable`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`flippable` shl bp_TGtkRange_flippable) and - bm_TGtkRange_flippable) - -proc has_stepper_a*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_has_stepper_a) shr - bp_TGtkRange_has_stepper_a - -proc set_has_stepper_a*(a: PRange, `has_stepper_a`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`has_stepper_a` shl bp_TGtkRange_has_stepper_a) and - bm_TGtkRange_has_stepper_a) - -proc has_stepper_b*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_has_stepper_b) shr - bp_TGtkRange_has_stepper_b - -proc set_has_stepper_b*(a: PRange, `has_stepper_b`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`has_stepper_b` shl bp_TGtkRange_has_stepper_b) and - bm_TGtkRange_has_stepper_b) - -proc has_stepper_c*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_has_stepper_c) shr - bp_TGtkRange_has_stepper_c - -proc set_has_stepper_c*(a: PRange, `has_stepper_c`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`has_stepper_c` shl bp_TGtkRange_has_stepper_c) and - bm_TGtkRange_has_stepper_c) - -proc has_stepper_d*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_has_stepper_d) shr - bp_TGtkRange_has_stepper_d - -proc set_has_stepper_d*(a: PRange, `has_stepper_d`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`has_stepper_d` shl bp_TGtkRange_has_stepper_d) and - bm_TGtkRange_has_stepper_d) - -proc need_recalc*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_need_recalc) shr - bp_TGtkRange_need_recalc - -proc set_need_recalc*(a: PRange, `need_recalc`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`need_recalc` shl bp_TGtkRange_need_recalc) and - bm_TGtkRange_need_recalc) - -proc slider_size_fixed*(a: PRange): guint = - result = (a.Rangeflag0 and bm_TGtkRange_slider_size_fixed) shr - bp_TGtkRange_slider_size_fixed - -proc set_slider_size_fixed*(a: PRange, `slider_size_fixed`: guint) = - a.Rangeflag0 = a.Rangeflag0 or - (int16(`slider_size_fixed` shl bp_TGtkRange_slider_size_fixed) and - bm_TGtkRange_slider_size_fixed) - -proc trough_click_forward*(a: PRange): guint = - result = (a.flag1 and bm_TGtkRange_trough_click_forward) shr - bp_TGtkRange_trough_click_forward - -proc set_trough_click_forward*(a: PRange, `trough_click_forward`: guint) = - a.flag1 = a.flag1 or - (int16(`trough_click_forward` shl bp_TGtkRange_trough_click_forward) and - bm_TGtkRange_trough_click_forward) - -proc update_pending*(a: PRange): guint = - result = (a.flag1 and bm_TGtkRange_update_pending) shr - bp_TGtkRange_update_pending - -proc set_update_pending*(a: PRange, `update_pending`: guint) = - a.flag1 = a.flag1 or - (int16(`update_pending` shl bp_TGtkRange_update_pending) and - bm_TGtkRange_update_pending) - -proc TYPE_SCALE*(): GType = - result = scale_get_type() - -proc SCALE*(obj: pointer): PScale = - result = cast[PScale](CHECK_CAST(obj, TYPE_SCALE())) - -proc SCALE_CLASS*(klass: pointer): PScaleClass = - result = cast[PScaleClass](CHECK_CLASS_CAST(klass, TYPE_SCALE())) - -proc IS_SCALE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SCALE()) - -proc IS_SCALE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SCALE()) - -proc SCALE_GET_CLASS*(obj: pointer): PScaleClass = - result = cast[PScaleClass](CHECK_GET_CLASS(obj, TYPE_SCALE())) - -proc draw_value*(a: PScale): guint = - result = (a.Scaleflag0 and bm_TGtkScale_draw_value) shr - bp_TGtkScale_draw_value - -proc set_draw_value*(a: PScale, `draw_value`: guint) = - a.Scaleflag0 = a.Scaleflag0 or - (int16(`draw_value` shl bp_TGtkScale_draw_value) and - bm_TGtkScale_draw_value) - -proc value_pos*(a: PScale): guint = - result = (a.Scaleflag0 and bm_TGtkScale_value_pos) shr - bp_TGtkScale_value_pos - -proc set_value_pos*(a: PScale, `value_pos`: guint) = - a.Scaleflag0 = a.Scaleflag0 or - (int16(`value_pos` shl bp_TGtkScale_value_pos) and - bm_TGtkScale_value_pos) - -proc TYPE_HSCALE*(): GType = - result = hscale_get_type() - -proc HSCALE*(obj: pointer): PHScale = - result = cast[PHScale](CHECK_CAST(obj, TYPE_HSCALE())) - -proc HSCALE_CLASS*(klass: pointer): PHScaleClass = - result = cast[PHScaleClass](CHECK_CLASS_CAST(klass, TYPE_HSCALE())) - -proc IS_HSCALE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HSCALE()) - -proc IS_HSCALE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HSCALE()) - -proc HSCALE_GET_CLASS*(obj: pointer): PHScaleClass = - result = cast[PHScaleClass](CHECK_GET_CLASS(obj, TYPE_HSCALE())) - -proc TYPE_SCROLLBAR*(): GType = - result = scrollbar_get_type() - -proc SCROLLBAR*(obj: pointer): PScrollbar = - result = cast[PScrollbar](CHECK_CAST(obj, TYPE_SCROLLBAR())) - -proc SCROLLBAR_CLASS*(klass: pointer): PScrollbarClass = - result = cast[PScrollbarClass](CHECK_CLASS_CAST(klass, TYPE_SCROLLBAR())) - -proc IS_SCROLLBAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SCROLLBAR()) - -proc IS_SCROLLBAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SCROLLBAR()) - -proc SCROLLBAR_GET_CLASS*(obj: pointer): PScrollbarClass = - result = cast[PScrollbarClass](CHECK_GET_CLASS(obj, TYPE_SCROLLBAR())) - -proc TYPE_HSCROLLBAR*(): GType = - result = hscrollbar_get_type() - -proc HSCROLLBAR*(obj: pointer): PHScrollbar = - result = cast[PHScrollbar](CHECK_CAST(obj, TYPE_HSCROLLBAR())) - -proc HSCROLLBAR_CLASS*(klass: pointer): PHScrollbarClass = - result = cast[PHScrollbarClass](CHECK_CLASS_CAST(klass, TYPE_HSCROLLBAR())) - -proc IS_HSCROLLBAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HSCROLLBAR()) - -proc IS_HSCROLLBAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HSCROLLBAR()) - -proc HSCROLLBAR_GET_CLASS*(obj: pointer): PHScrollbarClass = - result = cast[PHScrollbarClass](CHECK_GET_CLASS(obj, TYPE_HSCROLLBAR())) - -proc TYPE_SEPARATOR*(): GType = - result = separator_get_type() - -proc SEPARATOR*(obj: pointer): PSeparator = - result = cast[PSeparator](CHECK_CAST(obj, TYPE_SEPARATOR())) - -proc SEPARATOR_CLASS*(klass: pointer): PSeparatorClass = - result = cast[PSeparatorClass](CHECK_CLASS_CAST(klass, TYPE_SEPARATOR())) - -proc IS_SEPARATOR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SEPARATOR()) - -proc IS_SEPARATOR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SEPARATOR()) - -proc SEPARATOR_GET_CLASS*(obj: pointer): PSeparatorClass = - result = cast[PSeparatorClass](CHECK_GET_CLASS(obj, TYPE_SEPARATOR())) - -proc TYPE_HSEPARATOR*(): GType = - result = hseparator_get_type() - -proc HSEPARATOR*(obj: pointer): PHSeparator = - result = cast[PHSeparator](CHECK_CAST(obj, TYPE_HSEPARATOR())) - -proc HSEPARATOR_CLASS*(klass: pointer): PHSeparatorClass = - result = cast[PHSeparatorClass](CHECK_CLASS_CAST(klass, TYPE_HSEPARATOR())) - -proc IS_HSEPARATOR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_HSEPARATOR()) - -proc IS_HSEPARATOR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_HSEPARATOR()) - -proc HSEPARATOR_GET_CLASS*(obj: pointer): PHSeparatorClass = - result = cast[PHSeparatorClass](CHECK_GET_CLASS(obj, TYPE_HSEPARATOR())) - -proc TYPE_ICON_FACTORY*(): GType = - result = icon_factory_get_type() - -proc ICON_FACTORY*(anObject: pointer): PIconFactory = - result = cast[PIconFactory](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_ICON_FACTORY())) - -proc ICON_FACTORY_CLASS*(klass: pointer): PIconFactoryClass = - result = cast[PIconFactoryClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_ICON_FACTORY())) - -proc IS_ICON_FACTORY*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_ICON_FACTORY()) - -proc IS_ICON_FACTORY_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_ICON_FACTORY()) - -proc ICON_FACTORY_GET_CLASS*(obj: pointer): PIconFactoryClass = - result = cast[PIconFactoryClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_ICON_FACTORY())) - -proc TYPE_ICON_SET*(): GType = - result = icon_set_get_type() - -proc TYPE_ICON_SOURCE*(): GType = - result = icon_source_get_type() - -proc TYPE_IMAGE*(): GType = - result = gtk2.image_get_type() - -proc IMAGE*(obj: pointer): PImage = - result = cast[PImage](CHECK_CAST(obj, gtk2.TYPE_IMAGE())) - -proc IMAGE_CLASS*(klass: pointer): PImageClass = - result = cast[PImageClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_IMAGE())) - -proc IS_IMAGE*(obj: pointer): bool = - result = CHECK_TYPE(obj, gtk2.TYPE_IMAGE()) - -proc IS_IMAGE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_IMAGE()) - -proc IMAGE_GET_CLASS*(obj: pointer): PImageClass = - result = cast[PImageClass](CHECK_GET_CLASS(obj, gtk2.TYPE_IMAGE())) - -proc TYPE_IMAGE_MENU_ITEM*(): GType = - result = image_menu_item_get_type() - -proc IMAGE_MENU_ITEM*(obj: pointer): PImageMenuItem = - result = cast[PImageMenuItem](CHECK_CAST(obj, TYPE_IMAGE_MENU_ITEM())) - -proc IMAGE_MENU_ITEM_CLASS*(klass: pointer): PImageMenuItemClass = - result = cast[PImageMenuItemClass](CHECK_CLASS_CAST(klass, - TYPE_IMAGE_MENU_ITEM())) - -proc IS_IMAGE_MENU_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_IMAGE_MENU_ITEM()) - -proc IS_IMAGE_MENU_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_IMAGE_MENU_ITEM()) - -proc IMAGE_MENU_ITEM_GET_CLASS*(obj: pointer): PImageMenuItemClass = - result = cast[PImageMenuItemClass](CHECK_GET_CLASS(obj, TYPE_IMAGE_MENU_ITEM())) - -proc TYPE_IM_CONTEXT_SIMPLE*(): GType = - result = im_context_simple_get_type() - -proc IM_CONTEXT_SIMPLE*(obj: pointer): PIMContextSimple = - result = cast[PIMContextSimple](CHECK_CAST(obj, TYPE_IM_CONTEXT_SIMPLE())) - -proc IM_CONTEXT_SIMPLE_CLASS*(klass: pointer): PIMContextSimpleClass = - result = cast[PIMContextSimpleClass](CHECK_CLASS_CAST(klass, - TYPE_IM_CONTEXT_SIMPLE())) - -proc IS_IM_CONTEXT_SIMPLE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_IM_CONTEXT_SIMPLE()) - -proc IS_IM_CONTEXT_SIMPLE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_IM_CONTEXT_SIMPLE()) - -proc IM_CONTEXT_SIMPLE_GET_CLASS*(obj: pointer): PIMContextSimpleClass = - result = cast[PIMContextSimpleClass](CHECK_GET_CLASS(obj, - TYPE_IM_CONTEXT_SIMPLE())) - -proc in_hex_sequence*(a: PIMContextSimple): guint = - result = (a.IMContextSimpleflag0 and bm_TGtkIMContextSimple_in_hex_sequence) shr - bp_TGtkIMContextSimple_in_hex_sequence - -proc set_in_hex_sequence*(a: PIMContextSimple, `in_hex_sequence`: guint) = - a.IMContextSimpleflag0 = a.IMContextSimpleflag0 or - (int16(`in_hex_sequence` shl bp_TGtkIMContextSimple_in_hex_sequence) and - bm_TGtkIMContextSimple_in_hex_sequence) - -proc TYPE_IM_MULTICONTEXT*(): GType = - result = im_multicontext_get_type() - -proc IM_MULTICONTEXT*(obj: pointer): PIMMulticontext = - result = cast[PIMMulticontext](CHECK_CAST(obj, TYPE_IM_MULTICONTEXT())) - -proc IM_MULTICONTEXT_CLASS*(klass: pointer): PIMMulticontextClass = - result = cast[PIMMulticontextClass](CHECK_CLASS_CAST(klass, - TYPE_IM_MULTICONTEXT())) - -proc IS_IM_MULTICONTEXT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_IM_MULTICONTEXT()) - -proc IS_IM_MULTICONTEXT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_IM_MULTICONTEXT()) - -proc IM_MULTICONTEXT_GET_CLASS*(obj: pointer): PIMMulticontextClass = - result = cast[PIMMulticontextClass](CHECK_GET_CLASS(obj, - TYPE_IM_MULTICONTEXT())) - -proc TYPE_INPUT_DIALOG*(): GType = - result = input_dialog_get_type() - -proc INPUT_DIALOG*(obj: pointer): PInputDialog = - result = cast[PInputDialog](CHECK_CAST(obj, TYPE_INPUT_DIALOG())) - -proc INPUT_DIALOG_CLASS*(klass: pointer): PInputDialogClass = - result = cast[PInputDialogClass](CHECK_CLASS_CAST(klass, TYPE_INPUT_DIALOG())) - -proc IS_INPUT_DIALOG*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_INPUT_DIALOG()) - -proc IS_INPUT_DIALOG_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_INPUT_DIALOG()) - -proc INPUT_DIALOG_GET_CLASS*(obj: pointer): PInputDialogClass = - result = cast[PInputDialogClass](CHECK_GET_CLASS(obj, TYPE_INPUT_DIALOG())) - -proc TYPE_INVISIBLE*(): GType = - result = invisible_get_type() - -proc INVISIBLE*(obj: pointer): PInvisible = - result = cast[PInvisible](CHECK_CAST(obj, TYPE_INVISIBLE())) - -proc INVISIBLE_CLASS*(klass: pointer): PInvisibleClass = - result = cast[PInvisibleClass](CHECK_CLASS_CAST(klass, TYPE_INVISIBLE())) - -proc IS_INVISIBLE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_INVISIBLE()) - -proc IS_INVISIBLE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_INVISIBLE()) - -proc INVISIBLE_GET_CLASS*(obj: pointer): PInvisibleClass = - result = cast[PInvisibleClass](CHECK_GET_CLASS(obj, TYPE_INVISIBLE())) - -proc TYPE_ITEM_FACTORY*(): GType = - result = item_factory_get_type() - -proc ITEM_FACTORY*(anObject: pointer): PItemFactory = - result = cast[PItemFactory](CHECK_CAST(anObject, TYPE_ITEM_FACTORY())) - -proc ITEM_FACTORY_CLASS*(klass: pointer): PItemFactoryClass = - result = cast[PItemFactoryClass](CHECK_CLASS_CAST(klass, TYPE_ITEM_FACTORY())) - -proc IS_ITEM_FACTORY*(anObject: pointer): bool = - result = CHECK_TYPE(anObject, TYPE_ITEM_FACTORY()) - -proc IS_ITEM_FACTORY_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_ITEM_FACTORY()) - -proc ITEM_FACTORY_GET_CLASS*(obj: pointer): PItemFactoryClass = - result = cast[PItemFactoryClass](CHECK_GET_CLASS(obj, TYPE_ITEM_FACTORY())) - -proc TYPE_LAYOUT*(): GType = - result = gtk2.layout_get_type() - -proc LAYOUT*(obj: pointer): PLayout = - result = cast[PLayout](CHECK_CAST(obj, gtk2.TYPE_LAYOUT())) - -proc LAYOUT_CLASS*(klass: pointer): PLayoutClass = - result = cast[PLayoutClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_LAYOUT())) - -proc IS_LAYOUT*(obj: pointer): bool = - result = CHECK_TYPE(obj, gtk2.TYPE_LAYOUT()) - -proc IS_LAYOUT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_LAYOUT()) - -proc LAYOUT_GET_CLASS*(obj: pointer): PLayoutClass = - result = cast[PLayoutClass](CHECK_GET_CLASS(obj, gtk2.TYPE_LAYOUT())) - -proc TYPE_LIST*(): GType = - result = list_get_type() - -proc LIST*(obj: pointer): PList = - result = cast[PList](CHECK_CAST(obj, TYPE_LIST())) - -proc LIST_CLASS*(klass: pointer): PListClass = - result = cast[PListClass](CHECK_CLASS_CAST(klass, TYPE_LIST())) - -proc IS_LIST*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_LIST()) - -proc IS_LIST_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_LIST()) - -proc LIST_GET_CLASS*(obj: pointer): PListClass = - result = cast[PListClass](CHECK_GET_CLASS(obj, TYPE_LIST())) - -proc selection_mode*(a: PList): guint = - result = (a.Listflag0 and bm_TGtkList_selection_mode) shr - bp_TGtkList_selection_mode - -proc set_selection_mode*(a: PList, `selection_mode`: guint) = - a.Listflag0 = a.Listflag0 or - (int16(`selection_mode` shl bp_TGtkList_selection_mode) and - bm_TGtkList_selection_mode) - -proc drag_selection*(a: PList): guint = - result = (a.Listflag0 and bm_TGtkList_drag_selection) shr - bp_TGtkList_drag_selection - -proc set_drag_selection*(a: PList, `drag_selection`: guint) = - a.Listflag0 = a.Listflag0 or - (int16(`drag_selection` shl bp_TGtkList_drag_selection) and - bm_TGtkList_drag_selection) - -proc add_mode*(a: PList): guint = - result = (a.Listflag0 and bm_TGtkList_add_mode) shr bp_TGtkList_add_mode - -proc set_add_mode*(a: PList, `add_mode`: guint) = - a.Listflag0 = a.Listflag0 or - (int16(`add_mode` shl bp_TGtkList_add_mode) and bm_TGtkList_add_mode) - -proc list_item_get_type(): GType{.importc: "gtk_list_item_get_type", cdecl, - dynlib: lib.} -proc TYPE_LIST_ITEM*(): GType = - result = list_item_get_type() - -type - TListItem = object of TItem - TListItemClass = object of TItemClass - PListItem = ptr TListItem - PListItemClass = ptr TListItemClass - -proc LIST_ITEM*(obj: pointer): PListItem = - result = cast[PListItem](CHECK_CAST(obj, TYPE_LIST_ITEM())) - -proc LIST_ITEM_CLASS*(klass: pointer): PListItemClass = - result = cast[PListItemClass](CHECK_CLASS_CAST(klass, TYPE_LIST_ITEM())) - -proc IS_LIST_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_LIST_ITEM()) - -proc IS_LIST_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_LIST_ITEM()) - -proc LIST_ITEM_GET_CLASS*(obj: pointer): PListItemClass = - #proc gtk_tree_model_get_type(): GType {.importc, cdecl, dynlib: gtklib.} - result = cast[PListItemClass](CHECK_GET_CLASS(obj, TYPE_LIST_ITEM())) - -proc TYPE_TREE_MODEL*(): GType = - result = tree_model_get_type() - -proc TREE_MODEL*(obj: pointer): PTreeModel = - result = cast[PTreeModel](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_TREE_MODEL())) - -proc IS_TREE_MODEL*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TREE_MODEL()) - -proc TREE_MODEL_GET_IFACE*(obj: pointer): PTreeModelIface = - result = cast[PTreeModelIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_TREE_MODEL())) - -proc TYPE_TREE_ITER*(): GType = - result = tree_iter_get_type() - -proc TYPE_TREE_PATH*(): GType = - result = tree_path_get_type() - -proc tree_path_new_root*(): PTreePath = - result = tree_path_new_first() - -proc get_iter_root*(tree_model: PTreeModel, iter: PTreeIter): gboolean = - result = get_iter_first(tree_model, iter) - -proc TYPE_TREE_SORTABLE*(): GType = - result = tree_sortable_get_type() - -proc TREE_SORTABLE*(obj: pointer): PTreeSortable = - result = cast[PTreeSortable](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_TREE_SORTABLE())) - -proc TREE_SORTABLE_CLASS*(obj: pointer): PTreeSortableIface = - result = cast[PTreeSortableIface](G_TYPE_CHECK_CLASS_CAST(obj, - TYPE_TREE_SORTABLE())) - -proc IS_TREE_SORTABLE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TREE_SORTABLE()) - -proc TREE_SORTABLE_GET_IFACE*(obj: pointer): PTreeSortableIface = - result = cast[PTreeSortableIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_TREE_SORTABLE())) - -proc TYPE_TREE_MODEL_SORT*(): GType = - result = tree_model_sort_get_type() - -proc TREE_MODEL_SORT*(obj: pointer): PTreeModelSort = - result = cast[PTreeModelSort](CHECK_CAST(obj, TYPE_TREE_MODEL_SORT())) - -proc TREE_MODEL_SORT_CLASS*(klass: pointer): PTreeModelSortClass = - result = cast[PTreeModelSortClass](CHECK_CLASS_CAST(klass, - TYPE_TREE_MODEL_SORT())) - -proc IS_TREE_MODEL_SORT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE_MODEL_SORT()) - -proc IS_TREE_MODEL_SORT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE_MODEL_SORT()) - -proc TREE_MODEL_SORT_GET_CLASS*(obj: pointer): PTreeModelSortClass = - result = cast[PTreeModelSortClass](CHECK_GET_CLASS(obj, TYPE_TREE_MODEL_SORT())) - -proc TYPE_LIST_STORE*(): GType = - result = list_store_get_type() - -proc LIST_STORE*(obj: pointer): PListStore = - result = cast[PListStore](CHECK_CAST(obj, TYPE_LIST_STORE())) - -proc LIST_STORE_CLASS*(klass: pointer): PListStoreClass = - result = cast[PListStoreClass](CHECK_CLASS_CAST(klass, TYPE_LIST_STORE())) - -proc IS_LIST_STORE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_LIST_STORE()) - -proc IS_LIST_STORE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_LIST_STORE()) - -proc LIST_STORE_GET_CLASS*(obj: pointer): PListStoreClass = - result = cast[PListStoreClass](CHECK_GET_CLASS(obj, TYPE_LIST_STORE())) - -proc columns_dirty*(a: PListStore): guint = - result = (a.ListStoreflag0 and bm_TGtkListStore_columns_dirty) shr - bp_TGtkListStore_columns_dirty - -proc set_columns_dirty*(a: PListStore, `columns_dirty`: guint) = - a.ListStoreflag0 = a.ListStoreflag0 or - (int16(`columns_dirty` shl bp_TGtkListStore_columns_dirty) and - bm_TGtkListStore_columns_dirty) - -proc TYPE_MENU_BAR*(): GType = - result = menu_bar_get_type() - -proc MENU_BAR*(obj: pointer): PMenuBar = - result = cast[PMenuBar](CHECK_CAST(obj, TYPE_MENU_BAR())) - -proc MENU_BAR_CLASS*(klass: pointer): PMenuBarClass = - result = cast[PMenuBarClass](CHECK_CLASS_CAST(klass, TYPE_MENU_BAR())) - -proc IS_MENU_BAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_MENU_BAR()) - -proc IS_MENU_BAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_MENU_BAR()) - -proc MENU_BAR_GET_CLASS*(obj: pointer): PMenuBarClass = - result = cast[PMenuBarClass](CHECK_GET_CLASS(obj, TYPE_MENU_BAR())) - -proc menu_bar_append*(menu, child: PWidget) = - append(cast[PMenuShell](menu), child) - -proc menu_bar_prepend*(menu, child: PWidget) = - prepend(cast[PMenuShell](menu), child) - -proc menu_bar_insert*(menu, child: PWidget, pos: gint) = - insert(cast[PMenuShell](menu), child, pos) - -proc TYPE_MESSAGE_DIALOG*(): GType = - result = message_dialog_get_type() - -proc MESSAGE_DIALOG*(obj: pointer): PMessageDialog = - result = cast[PMessageDialog](CHECK_CAST(obj, TYPE_MESSAGE_DIALOG())) - -proc MESSAGE_DIALOG_CLASS*(klass: pointer): PMessageDialogClass = - result = cast[PMessageDialogClass](CHECK_CLASS_CAST(klass, - TYPE_MESSAGE_DIALOG())) - -proc IS_MESSAGE_DIALOG*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_MESSAGE_DIALOG()) - -proc IS_MESSAGE_DIALOG_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_MESSAGE_DIALOG()) - -proc MESSAGE_DIALOG_GET_CLASS*(obj: pointer): PMessageDialogClass = - result = cast[PMessageDialogClass](CHECK_GET_CLASS(obj, TYPE_MESSAGE_DIALOG())) - -proc TYPE_NOTEBOOK*(): GType = - result = notebook_get_type() - -proc NOTEBOOK*(obj: pointer): PNotebook = - result = cast[PNotebook](CHECK_CAST(obj, TYPE_NOTEBOOK())) - -proc NOTEBOOK_CLASS*(klass: pointer): PNotebookClass = - result = cast[PNotebookClass](CHECK_CLASS_CAST(klass, TYPE_NOTEBOOK())) - -proc IS_NOTEBOOK*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_NOTEBOOK()) - -proc IS_NOTEBOOK_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_NOTEBOOK()) - -proc NOTEBOOK_GET_CLASS*(obj: pointer): PNotebookClass = - result = cast[PNotebookClass](CHECK_GET_CLASS(obj, TYPE_NOTEBOOK())) - -proc show_tabs*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_show_tabs) shr - bp_TGtkNotebook_show_tabs - -proc set_show_tabs*(a: PNotebook, `show_tabs`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`show_tabs` shl bp_TGtkNotebook_show_tabs) and - bm_TGtkNotebook_show_tabs) - -proc homogeneous*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_homogeneous) shr - bp_TGtkNotebook_homogeneous - -proc set_homogeneous*(a: PNotebook, `homogeneous`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`homogeneous` shl bp_TGtkNotebook_homogeneous) and - bm_TGtkNotebook_homogeneous) - -proc show_border*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_show_border) shr - bp_TGtkNotebook_show_border - -proc set_show_border*(a: PNotebook, `show_border`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`show_border` shl bp_TGtkNotebook_show_border) and - bm_TGtkNotebook_show_border) - -proc tab_pos*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_tab_pos) shr - bp_TGtkNotebook_tab_pos - -proc set_tab_pos*(a: PNotebook, `tab_pos`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`tab_pos` shl bp_TGtkNotebook_tab_pos) and - bm_TGtkNotebook_tab_pos) - -proc scrollable*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_scrollable) shr - bp_TGtkNotebook_scrollable - -proc set_scrollable*(a: PNotebook, `scrollable`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`scrollable` shl bp_TGtkNotebook_scrollable) and - bm_TGtkNotebook_scrollable) - -proc in_child*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_in_child) shr - bp_TGtkNotebook_in_child - -proc set_in_child*(a: PNotebook, `in_child`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`in_child` shl bp_TGtkNotebook_in_child) and - bm_TGtkNotebook_in_child) - -proc click_child*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_click_child) shr - bp_TGtkNotebook_click_child - -proc set_click_child*(a: PNotebook, `click_child`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`click_child` shl bp_TGtkNotebook_click_child) and - bm_TGtkNotebook_click_child) - -proc button*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_button) shr - bp_TGtkNotebook_button - -proc set_button*(a: PNotebook, `button`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`button` shl bp_TGtkNotebook_button) and bm_TGtkNotebook_button) - -proc need_timer*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_need_timer) shr - bp_TGtkNotebook_need_timer - -proc set_need_timer*(a: PNotebook, `need_timer`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`need_timer` shl bp_TGtkNotebook_need_timer) and - bm_TGtkNotebook_need_timer) - -proc child_has_focus*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_child_has_focus) shr - bp_TGtkNotebook_child_has_focus - -proc set_child_has_focus*(a: PNotebook, `child_has_focus`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`child_has_focus` shl bp_TGtkNotebook_child_has_focus) and - bm_TGtkNotebook_child_has_focus) - -proc have_visible_child*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_have_visible_child) shr - bp_TGtkNotebook_have_visible_child - -proc set_have_visible_child*(a: PNotebook, `have_visible_child`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`have_visible_child` shl bp_TGtkNotebook_have_visible_child) and - bm_TGtkNotebook_have_visible_child) - -proc focus_out*(a: PNotebook): guint = - result = (a.Notebookflag0 and bm_TGtkNotebook_focus_out) shr - bp_TGtkNotebook_focus_out - -proc set_focus_out*(a: PNotebook, `focus_out`: guint) = - a.Notebookflag0 = a.Notebookflag0 or - (int16(`focus_out` shl bp_TGtkNotebook_focus_out) and - bm_TGtkNotebook_focus_out) - -proc TYPE_OLD_EDITABLE*(): GType = - result = old_editable_get_type() - -proc OLD_EDITABLE*(obj: pointer): POldEditable = - result = cast[POldEditable](CHECK_CAST(obj, TYPE_OLD_EDITABLE())) - -proc OLD_EDITABLE_CLASS*(klass: pointer): POldEditableClass = - result = cast[POldEditableClass](CHECK_CLASS_CAST(klass, TYPE_OLD_EDITABLE())) - -proc IS_OLD_EDITABLE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_OLD_EDITABLE()) - -proc IS_OLD_EDITABLE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_OLD_EDITABLE()) - -proc OLD_EDITABLE_GET_CLASS*(obj: pointer): POldEditableClass = - result = cast[POldEditableClass](CHECK_GET_CLASS(obj, TYPE_OLD_EDITABLE())) - -proc has_selection*(a: POldEditable): guint = - result = (a.OldEditableflag0 and bm_TGtkOldEditable_has_selection) shr - bp_TGtkOldEditable_has_selection - -proc set_has_selection*(a: POldEditable, `has_selection`: guint) = - a.OldEditableflag0 = a.OldEditableflag0 or - (int16(`has_selection` shl bp_TGtkOldEditable_has_selection) and - bm_TGtkOldEditable_has_selection) - -proc editable*(a: POldEditable): guint = - result = (a.OldEditableflag0 and bm_TGtkOldEditable_editable) shr - bp_TGtkOldEditable_editable - -proc set_editable*(a: POldEditable, `editable`: guint) = - a.OldEditableflag0 = a.OldEditableflag0 or - (int16(`editable` shl bp_TGtkOldEditable_editable) and - bm_TGtkOldEditable_editable) - -proc visible*(a: POldEditable): guint = - result = (a.OldEditableflag0 and bm_TGtkOldEditable_visible) shr - bp_TGtkOldEditable_visible - -proc set_visible*(a: POldEditable, `visible`: guint) = - a.OldEditableflag0 = a.OldEditableflag0 or - (int16(`visible` shl bp_TGtkOldEditable_visible) and - bm_TGtkOldEditable_visible) - -proc TYPE_OPTION_MENU*(): GType = - result = option_menu_get_type() - -proc OPTION_MENU*(obj: pointer): POptionMenu = - result = cast[POptionMenu](CHECK_CAST(obj, TYPE_OPTION_MENU())) - -proc OPTION_MENU_CLASS*(klass: pointer): POptionMenuClass = - result = cast[POptionMenuClass](CHECK_CLASS_CAST(klass, TYPE_OPTION_MENU())) - -proc IS_OPTION_MENU*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_OPTION_MENU()) - -proc IS_OPTION_MENU_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_OPTION_MENU()) - -proc OPTION_MENU_GET_CLASS*(obj: pointer): POptionMenuClass = - result = cast[POptionMenuClass](CHECK_GET_CLASS(obj, TYPE_OPTION_MENU())) - -proc TYPE_PIXMAP*(): GType = - result = gtk2.pixmap_get_type() - -proc PIXMAP*(obj: pointer): PPixmap = - result = cast[PPixmap](CHECK_CAST(obj, gtk2.TYPE_PIXMAP())) - -proc PIXMAP_CLASS*(klass: pointer): PPixmapClass = - result = cast[PPixmapClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_PIXMAP())) - -proc IS_PIXMAP*(obj: pointer): bool = - result = CHECK_TYPE(obj, gtk2.TYPE_PIXMAP()) - -proc IS_PIXMAP_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_PIXMAP()) - -proc PIXMAP_GET_CLASS*(obj: pointer): PPixmapClass = - result = cast[PPixmapClass](CHECK_GET_CLASS(obj, gtk2.TYPE_PIXMAP())) - -proc build_insensitive*(a: PPixmap): guint = - result = (a.Pixmapflag0 and bm_TGtkPixmap_build_insensitive) shr - bp_TGtkPixmap_build_insensitive - -proc set_build_insensitive*(a: PPixmap, `build_insensitive`: guint) = - a.Pixmapflag0 = a.Pixmapflag0 or - (int16(`build_insensitive` shl bp_TGtkPixmap_build_insensitive) and - bm_TGtkPixmap_build_insensitive) - -proc TYPE_PLUG*(): GType = - result = plug_get_type() - -proc PLUG*(obj: pointer): PPlug = - result = cast[PPlug](CHECK_CAST(obj, TYPE_PLUG())) - -proc PLUG_CLASS*(klass: pointer): PPlugClass = - result = cast[PPlugClass](CHECK_CLASS_CAST(klass, TYPE_PLUG())) - -proc IS_PLUG*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_PLUG()) - -proc IS_PLUG_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_PLUG()) - -proc PLUG_GET_CLASS*(obj: pointer): PPlugClass = - result = cast[PPlugClass](CHECK_GET_CLASS(obj, TYPE_PLUG())) - -proc same_app*(a: PPlug): guint = - result = (a.Plugflag0 and bm_TGtkPlug_same_app) shr bp_TGtkPlug_same_app - -proc set_same_app*(a: PPlug, `same_app`: guint) = - a.Plugflag0 = a.Plugflag0 or - (int16(`same_app` shl bp_TGtkPlug_same_app) and bm_TGtkPlug_same_app) - -proc TYPE_PREVIEW*(): GType = - result = preview_get_type() - -proc PREVIEW*(obj: pointer): PPreview = - result = cast[PPreview](CHECK_CAST(obj, TYPE_PREVIEW())) - -proc PREVIEW_CLASS*(klass: pointer): PPreviewClass = - result = cast[PPreviewClass](CHECK_CLASS_CAST(klass, TYPE_PREVIEW())) - -proc IS_PREVIEW*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_PREVIEW()) - -proc IS_PREVIEW_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_PREVIEW()) - -proc PREVIEW_GET_CLASS*(obj: pointer): PPreviewClass = - result = cast[PPreviewClass](CHECK_GET_CLASS(obj, TYPE_PREVIEW())) - -proc get_type*(a: PPreview): guint = - result = (a.Previewflag0 and bm_TGtkPreview_type) shr bp_TGtkPreview_type - -proc set_type*(a: PPreview, `type`: guint) = - a.Previewflag0 = a.Previewflag0 or - (int16(`type` shl bp_TGtkPreview_type) and bm_TGtkPreview_type) - -proc get_expand*(a: PPreview): guint = - result = (a.Previewflag0 and bm_TGtkPreview_expand) shr - bp_TGtkPreview_expand - -proc set_expand*(a: PPreview, `expand`: guint) = - a.Previewflag0 = a.Previewflag0 or - (int16(`expand` shl bp_TGtkPreview_expand) and bm_TGtkPreview_expand) - -proc progress_get_type(): GType{.importc: "gtk_progress_get_type", cdecl, - dynlib: lib.} -proc TYPE_PROGRESS*(): GType = - result = progress_get_type() - -proc PROGRESS*(obj: pointer): PProgress = - result = cast[PProgress](CHECK_CAST(obj, TYPE_PROGRESS())) - -proc PROGRESS_CLASS*(klass: pointer): PProgressClass = - result = cast[PProgressClass](CHECK_CLASS_CAST(klass, TYPE_PROGRESS())) - -proc IS_PROGRESS*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_PROGRESS()) - -proc IS_PROGRESS_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_PROGRESS()) - -proc PROGRESS_GET_CLASS*(obj: pointer): PProgressClass = - result = cast[PProgressClass](CHECK_GET_CLASS(obj, TYPE_PROGRESS())) - -proc show_text*(a: PProgress): guint = - result = (a.Progressflag0 and bm_TGtkProgress_show_text) shr - bp_TGtkProgress_show_text - -proc set_show_text*(a: PProgress, `show_text`: guint) = - a.Progressflag0 = a.Progressflag0 or - (int16(`show_text` shl bp_TGtkProgress_show_text) and - bm_TGtkProgress_show_text) - -proc activity_mode*(a: PProgress): guint = - result = (a.Progressflag0 and bm_TGtkProgress_activity_mode) shr - bp_TGtkProgress_activity_mode - -proc set_activity_mode*(a: PProgress, `activity_mode`: guint) = - a.Progressflag0 = a.Progressflag0 or - (int16(`activity_mode` shl bp_TGtkProgress_activity_mode) and - bm_TGtkProgress_activity_mode) - -proc use_text_format*(a: PProgress): guint = - result = (a.Progressflag0 and bm_TGtkProgress_use_text_format) shr - bp_TGtkProgress_use_text_format - -proc set_use_text_format*(a: PProgress, `use_text_format`: guint) = - a.Progressflag0 = a.Progressflag0 or - (int16(`use_text_format` shl bp_TGtkProgress_use_text_format) and - bm_TGtkProgress_use_text_format) - -proc TYPE_PROGRESS_BAR*(): GType = - result = progress_bar_get_type() - -proc PROGRESS_BAR*(obj: pointer): PProgressBar = - result = cast[PProgressBar](CHECK_CAST(obj, TYPE_PROGRESS_BAR())) - -proc PROGRESS_BAR_CLASS*(klass: pointer): PProgressBarClass = - result = cast[PProgressBarClass](CHECK_CLASS_CAST(klass, TYPE_PROGRESS_BAR())) - -proc IS_PROGRESS_BAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_PROGRESS_BAR()) - -proc IS_PROGRESS_BAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_PROGRESS_BAR()) - -proc PROGRESS_BAR_GET_CLASS*(obj: pointer): PProgressBarClass = - result = cast[PProgressBarClass](CHECK_GET_CLASS(obj, TYPE_PROGRESS_BAR())) - -proc activity_dir*(a: PProgressBar): guint = - result = (a.ProgressBarflag0 and bm_TGtkProgressBar_activity_dir) shr - bp_TGtkProgressBar_activity_dir - -proc set_activity_dir*(a: PProgressBar, `activity_dir`: guint) = - a.ProgressBarflag0 = a.ProgressBarflag0 or - (int16(`activity_dir` shl bp_TGtkProgressBar_activity_dir) and - bm_TGtkProgressBar_activity_dir) - -proc TYPE_RADIO_BUTTON*(): GType = - result = radio_button_get_type() - -proc RADIO_BUTTON*(obj: pointer): PRadioButton = - result = cast[PRadioButton](CHECK_CAST(obj, TYPE_RADIO_BUTTON())) - -proc RADIO_BUTTON_CLASS*(klass: pointer): PRadioButtonClass = - result = cast[PRadioButtonClass](CHECK_CLASS_CAST(klass, TYPE_RADIO_BUTTON())) - -proc IS_RADIO_BUTTON*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_RADIO_BUTTON()) - -proc IS_RADIO_BUTTON_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_RADIO_BUTTON()) - -proc RADIO_BUTTON_GET_CLASS*(obj: pointer): PRadioButtonClass = - result = cast[PRadioButtonClass](CHECK_GET_CLASS(obj, TYPE_RADIO_BUTTON())) - -proc TYPE_RADIO_MENU_ITEM*(): GType = - result = radio_menu_item_get_type() - -proc RADIO_MENU_ITEM*(obj: pointer): PRadioMenuItem = - result = cast[PRadioMenuItem](CHECK_CAST(obj, TYPE_RADIO_MENU_ITEM())) - -proc RADIO_MENU_ITEM_CLASS*(klass: pointer): PRadioMenuItemClass = - result = cast[PRadioMenuItemClass](CHECK_CLASS_CAST(klass, - TYPE_RADIO_MENU_ITEM())) - -proc IS_RADIO_MENU_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_RADIO_MENU_ITEM()) - -proc IS_RADIO_MENU_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_RADIO_MENU_ITEM()) - -proc RADIO_MENU_ITEM_GET_CLASS*(obj: pointer): PRadioMenuItemClass = - result = cast[PRadioMenuItemClass](CHECK_GET_CLASS(obj, TYPE_RADIO_MENU_ITEM())) - -proc TYPE_SCROLLED_WINDOW*(): GType = - result = scrolled_window_get_type() - -proc SCROLLED_WINDOW*(obj: pointer): PScrolledWindow = - result = cast[PScrolledWindow](CHECK_CAST(obj, TYPE_SCROLLED_WINDOW())) - -proc SCROLLED_WINDOW_CLASS*(klass: pointer): PScrolledWindowClass = - result = cast[PScrolledWindowClass](CHECK_CLASS_CAST(klass, - TYPE_SCROLLED_WINDOW())) - -proc IS_SCROLLED_WINDOW*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SCROLLED_WINDOW()) - -proc IS_SCROLLED_WINDOW_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SCROLLED_WINDOW()) - -proc SCROLLED_WINDOW_GET_CLASS*(obj: pointer): PScrolledWindowClass = - result = cast[PScrolledWindowClass](CHECK_GET_CLASS(obj, - TYPE_SCROLLED_WINDOW())) - -proc hscrollbar_policy*(a: PScrolledWindow): guint = - result = (a.ScrolledWindowflag0 and bm_TGtkScrolledWindow_hscrollbar_policy) shr - bp_TGtkScrolledWindow_hscrollbar_policy - -proc set_hscrollbar_policy*(a: PScrolledWindow, `hscrollbar_policy`: guint) = - a.ScrolledWindowflag0 = a.ScrolledWindowflag0 or - (int16(`hscrollbar_policy` shl bp_TGtkScrolledWindow_hscrollbar_policy) and - bm_TGtkScrolledWindow_hscrollbar_policy) - -proc vscrollbar_policy*(a: PScrolledWindow): guint = - result = (a.ScrolledWindowflag0 and bm_TGtkScrolledWindow_vscrollbar_policy) shr - bp_TGtkScrolledWindow_vscrollbar_policy - -proc set_vscrollbar_policy*(a: PScrolledWindow, `vscrollbar_policy`: guint) = - a.ScrolledWindowflag0 = a.ScrolledWindowflag0 or - (int16(`vscrollbar_policy` shl bp_TGtkScrolledWindow_vscrollbar_policy) and - bm_TGtkScrolledWindow_vscrollbar_policy) - -proc hscrollbar_visible*(a: PScrolledWindow): guint = - result = (a.ScrolledWindowflag0 and - bm_TGtkScrolledWindow_hscrollbar_visible) shr - bp_TGtkScrolledWindow_hscrollbar_visible - -proc set_hscrollbar_visible*(a: PScrolledWindow, `hscrollbar_visible`: guint) = - a.ScrolledWindowflag0 = a.ScrolledWindowflag0 or - (int16(`hscrollbar_visible` shl - bp_TGtkScrolledWindow_hscrollbar_visible) and - bm_TGtkScrolledWindow_hscrollbar_visible) - -proc vscrollbar_visible*(a: PScrolledWindow): guint = - result = (a.ScrolledWindowflag0 and - bm_TGtkScrolledWindow_vscrollbar_visible) shr - bp_TGtkScrolledWindow_vscrollbar_visible - -proc set_vscrollbar_visible*(a: PScrolledWindow, `vscrollbar_visible`: guint) = - a.ScrolledWindowflag0 = a.ScrolledWindowflag0 or - int16((`vscrollbar_visible` shl - bp_TGtkScrolledWindow_vscrollbar_visible) and - bm_TGtkScrolledWindow_vscrollbar_visible) - -proc window_placement*(a: PScrolledWindow): guint = - result = (a.ScrolledWindowflag0 and bm_TGtkScrolledWindow_window_placement) shr - bp_TGtkScrolledWindow_window_placement - -proc set_window_placement*(a: PScrolledWindow, `window_placement`: guint) = - a.ScrolledWindowflag0 = a.ScrolledWindowflag0 or - (int16(`window_placement` shl bp_TGtkScrolledWindow_window_placement) and - bm_TGtkScrolledWindow_window_placement) - -proc focus_out*(a: PScrolledWindow): guint = - result = (a.ScrolledWindowflag0 and bm_TGtkScrolledWindow_focus_out) shr - bp_TGtkScrolledWindow_focus_out - -proc set_focus_out*(a: PScrolledWindow, `focus_out`: guint) = - a.ScrolledWindowflag0 = a.ScrolledWindowflag0 or - (int16(`focus_out` shl bp_TGtkScrolledWindow_focus_out) and - bm_TGtkScrolledWindow_focus_out) - -proc TYPE_SELECTION_DATA*(): GType = - result = selection_data_get_type() - -proc TYPE_SEPARATOR_MENU_ITEM*(): GType = - result = separator_menu_item_get_type() - -proc SEPARATOR_MENU_ITEM*(obj: pointer): PSeparatorMenuItem = - result = cast[PSeparatorMenuItem](CHECK_CAST(obj, TYPE_SEPARATOR_MENU_ITEM())) - -proc SEPARATOR_MENU_ITEM_CLASS*(klass: pointer): PSeparatorMenuItemClass = - result = cast[PSeparatorMenuItemClass](CHECK_CLASS_CAST(klass, - TYPE_SEPARATOR_MENU_ITEM())) - -proc IS_SEPARATOR_MENU_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SEPARATOR_MENU_ITEM()) - -proc IS_SEPARATOR_MENU_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SEPARATOR_MENU_ITEM()) - -proc SEPARATOR_MENU_ITEM_GET_CLASS*(obj: pointer): PSeparatorMenuItemClass = - result = cast[PSeparatorMenuItemClass](CHECK_GET_CLASS(obj, - TYPE_SEPARATOR_MENU_ITEM())) - -proc signal_lookup*(name: cstring, object_type: GType): guint = - result = g_signal_lookup(name, object_type) - -proc signal_name*(signal_id: guint): cstring = - result = g_signal_name(signal_id) - -proc signal_emit_stop*(instance: gpointer, signal_id: guint, detail: TGQuark) = - if detail != 0'i32: g_signal_stop_emission(instance, signal_id, 0) - -proc signal_connect_full*(anObject: PObject, name: cstring, fun: TSignalFunc, - unknown1: pointer, func_data: gpointer, - unknown2: pointer, unknown3, unknown4: int): gulong{. - importc: "gtk_signal_connect_full", cdecl, dynlib: lib.} -proc signal_compat_matched*(anObject: PObject, fun: TSignalFunc, - data: gpointer, m: TGSignalMatchType, u: int){. - importc: "gtk_signal_compat_matched", cdecl, dynlib: lib.} -proc signal_connect*(anObject: PObject, name: cstring, fun: TSignalFunc, - func_data: gpointer): gulong = - result = signal_connect_full(anObject, name, fun, nil, func_data, nil, 0, 0) - -proc signal_connect_after*(anObject: PObject, name: cstring, fun: TSignalFunc, - func_data: gpointer): gulong = - result = signal_connect_full(anObject, name, fun, nil, func_data, nil, 0, 1) - -proc signal_connect_object*(anObject: PObject, name: cstring, - fun: TSignalFunc, slot_object: gpointer): gulong = - result = signal_connect_full(anObject, name, fun, nil, slot_object, nil, 1, - 0) - -proc signal_connect_object_after*(anObject: PObject, name: cstring, - fun: TSignalFunc, slot_object: gpointer): gulong = - result = signal_connect_full(anObject, name, fun, nil, slot_object, nil, 1, - 1) - -proc signal_disconnect*(anObject: gpointer, handler_id: gulong) = - g_signal_handler_disconnect(anObject, handler_id) - -proc signal_handler_block*(anObject: gpointer, handler_id: gulong) = - g_signal_handler_block(anObject, handler_id) - -proc signal_handler_unblock*(anObject: gpointer, handler_id: gulong) = - g_signal_handler_unblock(anObject, handler_id) - -proc signal_disconnect_by_data*(anObject: PObject, data: gpointer) = - signal_compat_matched(anObject, nil, data, G_SIGNAL_MATCH_DATA, 0) - -proc signal_disconnect_by_func*(anObject: PObject, fun: TSignalFunc, - data: gpointer) = - signal_compat_matched(anObject, fun, data, cast[TGSignalMatchType](G_SIGNAL_MATCH_FUNC or - G_SIGNAL_MATCH_DATA), 0) - -proc signal_handler_block_by_func*(anObject: PObject, fun: TSignalFunc, - data: gpointer) = - signal_compat_matched(anObject, fun, data, TGSignalMatchType( - G_SIGNAL_MATCH_FUNC or G_SIGNAL_MATCH_DATA), 0) - -proc signal_handler_block_by_data*(anObject: PObject, data: gpointer) = - signal_compat_matched(anObject, nil, data, G_SIGNAL_MATCH_DATA, 1) - -proc signal_handler_unblock_by_func*(anObject: PObject, fun: TSignalFunc, - data: gpointer) = - signal_compat_matched(anObject, fun, data, cast[TGSignalMatchType](G_SIGNAL_MATCH_FUNC or - G_SIGNAL_MATCH_DATA), 0) - -proc signal_handler_unblock_by_data*(anObject: PObject, data: gpointer) = - signal_compat_matched(anObject, nil, data, G_SIGNAL_MATCH_DATA, 2) - -proc signal_handler_pending*(anObject: PObject, signal_id: guint, - may_be_blocked: gboolean): gboolean = - Result = g_signal_has_handler_pending(anObject, signal_id, 0, may_be_blocked) - -proc signal_handler_pending_by_func*(anObject: PObject, signal_id: guint, - may_be_blocked: gboolean, - fun: TSignalFunc, - data: gpointer): gboolean = - var T: TGSignalMatchType - t = cast[TGSignalMatchType](G_SIGNAL_MATCH_ID or G_SIGNAL_MATCH_FUNC or - G_SIGNAL_MATCH_DATA) - if not may_be_blocked: - t = t or cast[TGSignalMatchType](G_SIGNAL_MATCH_UNBLOCKED) - Result = g_signal_handler_find(anObject, t, signal_id, 0, nil, fun, data) != - 0 - -proc TYPE_SIZE_GROUP*(): GType = - result = size_group_get_type() - -proc SIZE_GROUP*(obj: pointer): PSizeGroup = - result = cast[PSizeGroup](CHECK_CAST(obj, TYPE_SIZE_GROUP())) - -proc SIZE_GROUP_CLASS*(klass: pointer): PSizeGroupClass = - result = cast[PSizeGroupClass](CHECK_CLASS_CAST(klass, TYPE_SIZE_GROUP())) - -proc IS_SIZE_GROUP*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SIZE_GROUP()) - -proc IS_SIZE_GROUP_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SIZE_GROUP()) - -proc SIZE_GROUP_GET_CLASS*(obj: pointer): PSizeGroupClass = - result = cast[PSizeGroupClass](CHECK_GET_CLASS(obj, TYPE_SIZE_GROUP())) - -proc have_width*(a: PSizeGroup): guint = - result = (a.SizeGroupflag0 and bm_TGtkSizeGroup_have_width) shr - bp_TGtkSizeGroup_have_width - -proc set_have_width*(a: PSizeGroup, `have_width`: guint) = - a.SizeGroupflag0 = a.SizeGroupflag0 or - (int16(`have_width` shl bp_TGtkSizeGroup_have_width) and - bm_TGtkSizeGroup_have_width) - -proc have_height*(a: PSizeGroup): guint = - result = (a.SizeGroupflag0 and bm_TGtkSizeGroup_have_height) shr - bp_TGtkSizeGroup_have_height - -proc set_have_height*(a: PSizeGroup, `have_height`: guint) = - a.SizeGroupflag0 = a.SizeGroupflag0 or - (int16(`have_height` shl bp_TGtkSizeGroup_have_height) and - bm_TGtkSizeGroup_have_height) - -proc TYPE_SOCKET*(): GType = - result = socket_get_type() - -proc SOCKET*(obj: pointer): PSocket = - result = cast[PSocket](CHECK_CAST(obj, TYPE_SOCKET())) - -proc SOCKET_CLASS*(klass: pointer): PSocketClass = - result = cast[PSocketClass](CHECK_CLASS_CAST(klass, TYPE_SOCKET())) - -proc IS_SOCKET*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SOCKET()) - -proc IS_SOCKET_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SOCKET()) - -proc SOCKET_GET_CLASS*(obj: pointer): PSocketClass = - result = cast[PSocketClass](CHECK_GET_CLASS(obj, TYPE_SOCKET())) - -proc same_app*(a: PSocket): guint = - result = (a.Socketflag0 and bm_TGtkSocket_same_app) shr - bp_TGtkSocket_same_app - -proc set_same_app*(a: PSocket, `same_app`: guint) = - a.Socketflag0 = a.Socketflag0 or - (int16(`same_app` shl bp_TGtkSocket_same_app) and - bm_TGtkSocket_same_app) - -proc focus_in*(a: PSocket): guint = - result = (a.Socketflag0 and bm_TGtkSocket_focus_in) shr - bp_TGtkSocket_focus_in - -proc set_focus_in*(a: PSocket, `focus_in`: guint) = - a.Socketflag0 = a.Socketflag0 or - (int16(`focus_in` shl bp_TGtkSocket_focus_in) and - bm_TGtkSocket_focus_in) - -proc have_size*(a: PSocket): guint = - result = (a.Socketflag0 and bm_TGtkSocket_have_size) shr - bp_TGtkSocket_have_size - -proc set_have_size*(a: PSocket, `have_size`: guint) = - a.Socketflag0 = a.Socketflag0 or - (int16(`have_size` shl bp_TGtkSocket_have_size) and - bm_TGtkSocket_have_size) - -proc need_map*(a: PSocket): guint = - result = (a.Socketflag0 and bm_TGtkSocket_need_map) shr - bp_TGtkSocket_need_map - -proc set_need_map*(a: PSocket, `need_map`: guint) = - a.Socketflag0 = a.Socketflag0 or - (int16(`need_map` shl bp_TGtkSocket_need_map) and - bm_TGtkSocket_need_map) - -proc is_mapped*(a: PSocket): guint = - result = (a.Socketflag0 and bm_TGtkSocket_is_mapped) shr - bp_TGtkSocket_is_mapped - -proc set_is_mapped*(a: PSocket, `is_mapped`: guint) = - a.Socketflag0 = a.Socketflag0 or - (int16(`is_mapped` shl bp_TGtkSocket_is_mapped) and - bm_TGtkSocket_is_mapped) - -proc TYPE_SPIN_BUTTON*(): GType = - result = spin_button_get_type() - -proc SPIN_BUTTON*(obj: pointer): PSpinButton = - result = cast[PSpinButton](CHECK_CAST(obj, TYPE_SPIN_BUTTON())) - -proc SPIN_BUTTON_CLASS*(klass: pointer): PSpinButtonClass = - result = cast[PSpinButtonClass](CHECK_CLASS_CAST(klass, TYPE_SPIN_BUTTON())) - -proc IS_SPIN_BUTTON*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_SPIN_BUTTON()) - -proc IS_SPIN_BUTTON_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_SPIN_BUTTON()) - -proc SPIN_BUTTON_GET_CLASS*(obj: pointer): PSpinButtonClass = - result = cast[PSpinButtonClass](CHECK_GET_CLASS(obj, TYPE_SPIN_BUTTON())) - -proc in_child*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_in_child) shr - bp_TGtkSpinButton_in_child - -proc set_in_child*(a: PSpinButton, `in_child`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`in_child` shl bp_TGtkSpinButton_in_child) and - bm_TGtkSpinButton_in_child) - -proc click_child*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_click_child) shr - bp_TGtkSpinButton_click_child - -proc set_click_child*(a: PSpinButton, `click_child`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`click_child` shl bp_TGtkSpinButton_click_child) and - bm_TGtkSpinButton_click_child) - -proc button*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_button) shr - bp_TGtkSpinButton_button - -proc set_button*(a: PSpinButton, `button`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`button` shl bp_TGtkSpinButton_button) and bm_TGtkSpinButton_button) - -proc need_timer*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_need_timer) shr - bp_TGtkSpinButton_need_timer - -proc set_need_timer*(a: PSpinButton, `need_timer`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`need_timer` shl bp_TGtkSpinButton_need_timer) and - bm_TGtkSpinButton_need_timer) - -proc timer_calls*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_timer_calls) shr - bp_TGtkSpinButton_timer_calls - -proc set_timer_calls*(a: PSpinButton, `timer_calls`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`timer_calls` shl bp_TGtkSpinButton_timer_calls) and - bm_TGtkSpinButton_timer_calls) - -proc digits*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_digits) shr - bp_TGtkSpinButton_digits - -proc set_digits*(a: PSpinButton, `digits`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`digits` shl bp_TGtkSpinButton_digits) and bm_TGtkSpinButton_digits) - -proc numeric*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_numeric) shr - bp_TGtkSpinButton_numeric - -proc set_numeric*(a: PSpinButton, `numeric`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`numeric` shl bp_TGtkSpinButton_numeric) and - bm_TGtkSpinButton_numeric) - -proc wrap*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_wrap) shr - bp_TGtkSpinButton_wrap - -proc set_wrap*(a: PSpinButton, `wrap`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`wrap` shl bp_TGtkSpinButton_wrap) and bm_TGtkSpinButton_wrap) - -proc snap_to_ticks*(a: PSpinButton): guint = - result = (a.SpinButtonflag0 and bm_TGtkSpinButton_snap_to_ticks) shr - bp_TGtkSpinButton_snap_to_ticks - -proc set_snap_to_ticks*(a: PSpinButton, `snap_to_ticks`: guint) = - a.SpinButtonflag0 = a.SpinButtonflag0 or - ((`snap_to_ticks` shl bp_TGtkSpinButton_snap_to_ticks) and - bm_TGtkSpinButton_snap_to_ticks) - -proc TYPE_STATUSBAR*(): GType = - result = statusbar_get_type() - -proc STATUSBAR*(obj: pointer): PStatusbar = - result = cast[PStatusbar](CHECK_CAST(obj, TYPE_STATUSBAR())) - -proc STATUSBAR_CLASS*(klass: pointer): PStatusbarClass = - result = cast[PStatusbarClass](CHECK_CLASS_CAST(klass, TYPE_STATUSBAR())) - -proc IS_STATUSBAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_STATUSBAR()) - -proc IS_STATUSBAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_STATUSBAR()) - -proc STATUSBAR_GET_CLASS*(obj: pointer): PStatusbarClass = - result = cast[PStatusbarClass](CHECK_GET_CLASS(obj, TYPE_STATUSBAR())) - -proc has_resize_grip*(a: PStatusbar): guint = - result = (a.Statusbarflag0 and bm_TGtkStatusbar_has_resize_grip) shr - bp_TGtkStatusbar_has_resize_grip - -proc set_has_resize_grip*(a: PStatusbar, `has_resize_grip`: guint) = - a.Statusbarflag0 = a.Statusbarflag0 or - (int16(`has_resize_grip` shl bp_TGtkStatusbar_has_resize_grip) and - bm_TGtkStatusbar_has_resize_grip) - -proc TYPE_TABLE*(): GType = - result = gtk2.table_get_type() - -proc TABLE*(obj: pointer): PTable = - result = cast[PTable](CHECK_CAST(obj, gtk2.TYPE_TABLE())) - -proc TABLE_CLASS*(klass: pointer): PTableClass = - result = cast[PTableClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_TABLE())) - -proc IS_TABLE*(obj: pointer): bool = - result = CHECK_TYPE(obj, gtk2.TYPE_TABLE()) - -proc IS_TABLE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_TABLE()) - -proc TABLE_GET_CLASS*(obj: pointer): PTableClass = - result = cast[PTableClass](CHECK_GET_CLASS(obj, gtk2.TYPE_TABLE())) - -proc homogeneous*(a: PTable): guint = - result = (a.Tableflag0 and bm_TGtkTable_homogeneous) shr - bp_TGtkTable_homogeneous - -proc set_homogeneous*(a: PTable, `homogeneous`: guint) = - a.Tableflag0 = a.Tableflag0 or - (int16(`homogeneous` shl bp_TGtkTable_homogeneous) and - bm_TGtkTable_homogeneous) - -proc xexpand*(a: PTableChild): guint = - result = (a.TableChildflag0 and bm_TGtkTableChild_xexpand) shr - bp_TGtkTableChild_xexpand - -proc set_xexpand*(a: PTableChild, `xexpand`: guint) = - a.TableChildflag0 = a.TableChildflag0 or - (int16(`xexpand` shl bp_TGtkTableChild_xexpand) and - bm_TGtkTableChild_xexpand) - -proc yexpand*(a: PTableChild): guint = - result = (a.TableChildflag0 and bm_TGtkTableChild_yexpand) shr - bp_TGtkTableChild_yexpand - -proc set_yexpand*(a: PTableChild, `yexpand`: guint) = - a.TableChildflag0 = a.TableChildflag0 or - (int16(`yexpand` shl bp_TGtkTableChild_yexpand) and - bm_TGtkTableChild_yexpand) - -proc xshrink*(a: PTableChild): guint = - result = (a.TableChildflag0 and bm_TGtkTableChild_xshrink) shr - bp_TGtkTableChild_xshrink - -proc set_xshrink*(a: PTableChild, `xshrink`: guint) = - a.TableChildflag0 = a.TableChildflag0 or - (int16(`xshrink` shl bp_TGtkTableChild_xshrink) and - bm_TGtkTableChild_xshrink) - -proc yshrink*(a: PTableChild): guint = - result = (a.TableChildflag0 and bm_TGtkTableChild_yshrink) shr - bp_TGtkTableChild_yshrink - -proc set_yshrink*(a: PTableChild, `yshrink`: guint) = - a.TableChildflag0 = a.TableChildflag0 or - (int16(`yshrink` shl bp_TGtkTableChild_yshrink) and - bm_TGtkTableChild_yshrink) - -proc xfill*(a: PTableChild): guint = - result = (a.TableChildflag0 and bm_TGtkTableChild_xfill) shr - bp_TGtkTableChild_xfill - -proc set_xfill*(a: PTableChild, `xfill`: guint) = - a.TableChildflag0 = a.TableChildflag0 or - (int16(`xfill` shl bp_TGtkTableChild_xfill) and bm_TGtkTableChild_xfill) - -proc yfill*(a: PTableChild): guint = - result = (a.TableChildflag0 and bm_TGtkTableChild_yfill) shr - bp_TGtkTableChild_yfill - -proc set_yfill*(a: PTableChild, `yfill`: guint) = - a.TableChildflag0 = a.TableChildflag0 or - (int16(`yfill` shl bp_TGtkTableChild_yfill) and bm_TGtkTableChild_yfill) - -proc need_expand*(a: PTableRowCol): guint = - result = (a.flag0 and bm_TGtkTableRowCol_need_expand) shr - bp_TGtkTableRowCol_need_expand - -proc set_need_expand*(a: PTableRowCol, `need_expand`: guint) = - a.flag0 = a.flag0 or - (int16(`need_expand` shl bp_TGtkTableRowCol_need_expand) and - bm_TGtkTableRowCol_need_expand) - -proc need_shrink*(a: PTableRowCol): guint = - result = (a.flag0 and bm_TGtkTableRowCol_need_shrink) shr - bp_TGtkTableRowCol_need_shrink - -proc set_need_shrink*(a: PTableRowCol, `need_shrink`: guint) = - a.flag0 = a.flag0 or - (int16(`need_shrink` shl bp_TGtkTableRowCol_need_shrink) and - bm_TGtkTableRowCol_need_shrink) - -proc expand*(a: PTableRowCol): guint = - result = (a.flag0 and bm_TGtkTableRowCol_expand) shr - bp_TGtkTableRowCol_expand - -proc set_expand*(a: PTableRowCol, `expand`: guint) = - a.flag0 = a.flag0 or - (int16(`expand` shl bp_TGtkTableRowCol_expand) and - bm_TGtkTableRowCol_expand) - -proc shrink*(a: PTableRowCol): guint = - result = (a.flag0 and bm_TGtkTableRowCol_shrink) shr - bp_TGtkTableRowCol_shrink - -proc set_shrink*(a: PTableRowCol, `shrink`: guint) = - a.flag0 = a.flag0 or - (int16(`shrink` shl bp_TGtkTableRowCol_shrink) and - bm_TGtkTableRowCol_shrink) - -proc empty*(a: PTableRowCol): guint = - result = (a.flag0 and bm_TGtkTableRowCol_empty) shr - bp_TGtkTableRowCol_empty - -proc set_empty*(a: PTableRowCol, `empty`: guint) = - a.flag0 = a.flag0 or - (int16(`empty` shl bp_TGtkTableRowCol_empty) and - bm_TGtkTableRowCol_empty) - -proc TYPE_TEAROFF_MENU_ITEM*(): GType = - result = tearoff_menu_item_get_type() - -proc TEAROFF_MENU_ITEM*(obj: pointer): PTearoffMenuItem = - result = cast[PTearoffMenuItem](CHECK_CAST(obj, TYPE_TEAROFF_MENU_ITEM())) - -proc TEAROFF_MENU_ITEM_CLASS*(klass: pointer): PTearoffMenuItemClass = - result = cast[PTearoffMenuItemClass](CHECK_CLASS_CAST(klass, - TYPE_TEAROFF_MENU_ITEM())) - -proc IS_TEAROFF_MENU_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TEAROFF_MENU_ITEM()) - -proc IS_TEAROFF_MENU_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TEAROFF_MENU_ITEM()) - -proc TEAROFF_MENU_ITEM_GET_CLASS*(obj: pointer): PTearoffMenuItemClass = - result = cast[PTearoffMenuItemClass](CHECK_GET_CLASS(obj, - TYPE_TEAROFF_MENU_ITEM())) - -proc torn_off*(a: PTearoffMenuItem): guint = - result = (a.TearoffMenuItemflag0 and bm_TGtkTearoffMenuItem_torn_off) shr - bp_TGtkTearoffMenuItem_torn_off - -proc set_torn_off*(a: PTearoffMenuItem, `torn_off`: guint) = - a.TearoffMenuItemflag0 = a.TearoffMenuItemflag0 or - (int16(`torn_off` shl bp_TGtkTearoffMenuItem_torn_off) and - bm_TGtkTearoffMenuItem_torn_off) - -proc TYPE_TEXT*(): GType = - result = gtk2.text_get_type() - -proc TEXT*(obj: pointer): PText = - result = cast[PText](CHECK_CAST(obj, gtk2.TYPE_TEXT())) - -proc TEXT_CLASS*(klass: pointer): PTextClass = - result = cast[PTextClass](CHECK_CLASS_CAST(klass, gtk2.TYPE_TEXT())) - -proc IS_TEXT*(obj: pointer): bool = - result = CHECK_TYPE(obj, gtk2.TYPE_TEXT()) - -proc IS_TEXT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, gtk2.TYPE_TEXT()) - -proc TEXT_GET_CLASS*(obj: pointer): PTextClass = - result = cast[PTextClass](CHECK_GET_CLASS(obj, gtk2.TYPE_TEXT())) - -proc line_wrap*(a: PText): guint = - result = (a.Textflag0 and bm_TGtkText_line_wrap) shr bp_TGtkText_line_wrap - -proc set_line_wrap*(a: PText, `line_wrap`: guint) = - a.Textflag0 = a.Textflag0 or - (int16(`line_wrap` shl bp_TGtkText_line_wrap) and bm_TGtkText_line_wrap) - -proc word_wrap*(a: PText): guint = - result = (a.Textflag0 and bm_TGtkText_word_wrap) shr bp_TGtkText_word_wrap - -proc set_word_wrap*(a: PText, `word_wrap`: guint) = - a.Textflag0 = a.Textflag0 or - (int16(`word_wrap` shl bp_TGtkText_word_wrap) and bm_TGtkText_word_wrap) - -proc use_wchar*(a: PText): gboolean = - result = ((a.Textflag0 and bm_TGtkText_use_wchar) shr bp_TGtkText_use_wchar) > - 0'i16 - -proc set_use_wchar*(a: PText, `use_wchar`: gboolean) = - if `use_wchar`: - a.Textflag0 = a.Textflag0 or bm_TGtkText_use_wchar - else: - a.Textflag0 = a.Textflag0 and not bm_TGtkText_use_wchar - -proc INDEX_WCHAR*(t: PText, index: guint): guint32 = - nil - -proc INDEX_UCHAR*(t: PText, index: guint): GUChar = - nil - -proc TYPE_TEXT_ITER*(): GType = - result = text_iter_get_type() - -proc TYPE_TEXT_TAG*(): GType = - result = text_tag_get_type() - -proc TEXT_TAG*(obj: pointer): PTextTag = - result = cast[PTextTag](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_TEXT_TAG())) - -proc TEXT_TAG_CLASS*(klass: pointer): PTextTagClass = - result = cast[PTextTagClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_TEXT_TAG())) - -proc IS_TEXT_TAG*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TEXT_TAG()) - -proc IS_TEXT_TAG_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_TEXT_TAG()) - -proc TEXT_TAG_GET_CLASS*(obj: pointer): PTextTagClass = - result = cast[PTextTagClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_TEXT_TAG())) - -proc TYPE_TEXT_ATTRIBUTES*(): GType = - result = text_attributes_get_type() - -proc bg_color_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_bg_color_set) shr - bp_TGtkTextTag_bg_color_set - -proc set_bg_color_set*(a: PTextTag, `bg_color_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`bg_color_set` shl bp_TGtkTextTag_bg_color_set) and - bm_TGtkTextTag_bg_color_set) - -proc bg_stipple_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_bg_stipple_set) shr - bp_TGtkTextTag_bg_stipple_set - -proc set_bg_stipple_set*(a: PTextTag, `bg_stipple_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`bg_stipple_set` shl bp_TGtkTextTag_bg_stipple_set) and - bm_TGtkTextTag_bg_stipple_set) - -proc fg_color_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_fg_color_set) shr - bp_TGtkTextTag_fg_color_set - -proc set_fg_color_set*(a: PTextTag, `fg_color_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`fg_color_set` shl bp_TGtkTextTag_fg_color_set) and - bm_TGtkTextTag_fg_color_set) - -proc scale_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_scale_set) shr - bp_TGtkTextTag_scale_set - -proc set_scale_set*(a: PTextTag, `scale_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`scale_set` shl bp_TGtkTextTag_scale_set) and - bm_TGtkTextTag_scale_set) - -proc fg_stipple_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_fg_stipple_set) shr - bp_TGtkTextTag_fg_stipple_set - -proc set_fg_stipple_set*(a: PTextTag, `fg_stipple_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`fg_stipple_set` shl bp_TGtkTextTag_fg_stipple_set) and - bm_TGtkTextTag_fg_stipple_set) - -proc justification_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_justification_set) shr - bp_TGtkTextTag_justification_set - -proc set_justification_set*(a: PTextTag, `justification_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`justification_set` shl bp_TGtkTextTag_justification_set) and - bm_TGtkTextTag_justification_set) - -proc left_margin_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_left_margin_set) shr - bp_TGtkTextTag_left_margin_set - -proc set_left_margin_set*(a: PTextTag, `left_margin_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`left_margin_set` shl bp_TGtkTextTag_left_margin_set) and - bm_TGtkTextTag_left_margin_set) - -proc indent_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_indent_set) shr - bp_TGtkTextTag_indent_set - -proc set_indent_set*(a: PTextTag, `indent_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`indent_set` shl bp_TGtkTextTag_indent_set) and - bm_TGtkTextTag_indent_set) - -proc rise_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_rise_set) shr - bp_TGtkTextTag_rise_set - -proc set_rise_set*(a: PTextTag, `rise_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`rise_set` shl bp_TGtkTextTag_rise_set) and bm_TGtkTextTag_rise_set) - -proc strikethrough_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_strikethrough_set) shr - bp_TGtkTextTag_strikethrough_set - -proc set_strikethrough_set*(a: PTextTag, `strikethrough_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`strikethrough_set` shl bp_TGtkTextTag_strikethrough_set) and - bm_TGtkTextTag_strikethrough_set) - -proc right_margin_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_right_margin_set) shr - bp_TGtkTextTag_right_margin_set - -proc set_right_margin_set*(a: PTextTag, `right_margin_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`right_margin_set` shl bp_TGtkTextTag_right_margin_set) and - bm_TGtkTextTag_right_margin_set) - -proc pixels_above_lines_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_pixels_above_lines_set) shr - bp_TGtkTextTag_pixels_above_lines_set - -proc set_pixels_above_lines_set*(a: PTextTag, - `pixels_above_lines_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`pixels_above_lines_set` shl bp_TGtkTextTag_pixels_above_lines_set) and - bm_TGtkTextTag_pixels_above_lines_set) - -proc pixels_below_lines_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_pixels_below_lines_set) shr - bp_TGtkTextTag_pixels_below_lines_set - -proc set_pixels_below_lines_set*(a: PTextTag, - `pixels_below_lines_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`pixels_below_lines_set` shl bp_TGtkTextTag_pixels_below_lines_set) and - bm_TGtkTextTag_pixels_below_lines_set) - -proc pixels_inside_wrap_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_pixels_inside_wrap_set) shr - bp_TGtkTextTag_pixels_inside_wrap_set - -proc set_pixels_inside_wrap_set*(a: PTextTag, - `pixels_inside_wrap_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`pixels_inside_wrap_set` shl bp_TGtkTextTag_pixels_inside_wrap_set) and - bm_TGtkTextTag_pixels_inside_wrap_set) - -proc tabs_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_tabs_set) shr - bp_TGtkTextTag_tabs_set - -proc set_tabs_set*(a: PTextTag, `tabs_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`tabs_set` shl bp_TGtkTextTag_tabs_set) and bm_TGtkTextTag_tabs_set) - -proc underline_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_underline_set) shr - bp_TGtkTextTag_underline_set - -proc set_underline_set*(a: PTextTag, `underline_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`underline_set` shl bp_TGtkTextTag_underline_set) and - bm_TGtkTextTag_underline_set) - -proc wrap_mode_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_wrap_mode_set) shr - bp_TGtkTextTag_wrap_mode_set - -proc set_wrap_mode_set*(a: PTextTag, `wrap_mode_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`wrap_mode_set` shl bp_TGtkTextTag_wrap_mode_set) and - bm_TGtkTextTag_wrap_mode_set) - -proc bg_full_height_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_bg_full_height_set) shr - bp_TGtkTextTag_bg_full_height_set - -proc set_bg_full_height_set*(a: PTextTag, `bg_full_height_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`bg_full_height_set` shl bp_TGtkTextTag_bg_full_height_set) and - bm_TGtkTextTag_bg_full_height_set) - -proc invisible_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_invisible_set) shr - bp_TGtkTextTag_invisible_set - -proc set_invisible_set*(a: PTextTag, `invisible_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`invisible_set` shl bp_TGtkTextTag_invisible_set) and - bm_TGtkTextTag_invisible_set) - -proc editable_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_editable_set) shr - bp_TGtkTextTag_editable_set - -proc set_editable_set*(a: PTextTag, `editable_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`editable_set` shl bp_TGtkTextTag_editable_set) and - bm_TGtkTextTag_editable_set) - -proc language_set*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_language_set) shr - bp_TGtkTextTag_language_set - -proc set_language_set*(a: PTextTag, `language_set`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`language_set` shl bp_TGtkTextTag_language_set) and - bm_TGtkTextTag_language_set) - -proc pad1*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_pad1) shr bp_TGtkTextTag_pad1 - -proc set_pad1*(a: PTextTag, `pad1`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`pad1` shl bp_TGtkTextTag_pad1) and bm_TGtkTextTag_pad1) - -proc pad2*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_pad2) shr bp_TGtkTextTag_pad2 - -proc set_pad2*(a: PTextTag, `pad2`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`pad2` shl bp_TGtkTextTag_pad2) and bm_TGtkTextTag_pad2) - -proc pad3*(a: PTextTag): guint = - result = (a.TextTagflag0 and bm_TGtkTextTag_pad3) shr bp_TGtkTextTag_pad3 - -proc set_pad3*(a: PTextTag, `pad3`: guint) = - a.TextTagflag0 = a.TextTagflag0 or - ((`pad3` shl bp_TGtkTextTag_pad3) and bm_TGtkTextTag_pad3) - -proc underline*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_underline) shr - bp_TGtkTextAppearance_underline - -proc set_underline*(a: PTextAppearance, `underline`: guint) = - a.flag0 = a.flag0 or - (int16(`underline` shl bp_TGtkTextAppearance_underline) and - bm_TGtkTextAppearance_underline) - -proc strikethrough*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_strikethrough) shr - bp_TGtkTextAppearance_strikethrough - -proc set_strikethrough*(a: PTextAppearance, `strikethrough`: guint) = - a.flag0 = a.flag0 or - (int16(`strikethrough` shl bp_TGtkTextAppearance_strikethrough) and - bm_TGtkTextAppearance_strikethrough) - -proc draw_bg*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_draw_bg) shr - bp_TGtkTextAppearance_draw_bg - -proc set_draw_bg*(a: PTextAppearance, `draw_bg`: guint) = - a.flag0 = a.flag0 or - (int16(`draw_bg` shl bp_TGtkTextAppearance_draw_bg) and - bm_TGtkTextAppearance_draw_bg) - -proc inside_selection*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_inside_selection) shr - bp_TGtkTextAppearance_inside_selection - -proc set_inside_selection*(a: PTextAppearance, `inside_selection`: guint) = - a.flag0 = a.flag0 or - (int16(`inside_selection` shl bp_TGtkTextAppearance_inside_selection) and - bm_TGtkTextAppearance_inside_selection) - -proc is_text*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_is_text) shr - bp_TGtkTextAppearance_is_text - -proc set_is_text*(a: PTextAppearance, `is_text`: guint) = - a.flag0 = a.flag0 or - (int16(`is_text` shl bp_TGtkTextAppearance_is_text) and - bm_TGtkTextAppearance_is_text) - -proc pad1*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_pad1) shr - bp_TGtkTextAppearance_pad1 - -proc set_pad1*(a: PTextAppearance, `pad1`: guint) = - a.flag0 = a.flag0 or - (int16(`pad1` shl bp_TGtkTextAppearance_pad1) and - bm_TGtkTextAppearance_pad1) - -proc pad2*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_pad2) shr - bp_TGtkTextAppearance_pad2 - -proc set_pad2*(a: PTextAppearance, `pad2`: guint) = - a.flag0 = a.flag0 or - (int16(`pad2` shl bp_TGtkTextAppearance_pad2) and - bm_TGtkTextAppearance_pad2) - -proc pad3*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_pad3) shr - bp_TGtkTextAppearance_pad3 - -proc set_pad3*(a: PTextAppearance, `pad3`: guint) = - a.flag0 = a.flag0 or - (int16(`pad3` shl bp_TGtkTextAppearance_pad3) and - bm_TGtkTextAppearance_pad3) - -proc pad4*(a: PTextAppearance): guint = - result = (a.flag0 and bm_TGtkTextAppearance_pad4) shr - bp_TGtkTextAppearance_pad4 - -proc set_pad4*(a: PTextAppearance, `pad4`: guint) = - a.flag0 = a.flag0 or - (int16(`pad4` shl bp_TGtkTextAppearance_pad4) and - bm_TGtkTextAppearance_pad4) - -proc invisible*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_invisible) shr - bp_TGtkTextAttributes_invisible - -proc set_invisible*(a: PTextAttributes, `invisible`: guint) = - a.flag0 = a.flag0 or - (int16(`invisible` shl bp_TGtkTextAttributes_invisible) and - bm_TGtkTextAttributes_invisible) - -proc bg_full_height*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_bg_full_height) shr - bp_TGtkTextAttributes_bg_full_height - -proc set_bg_full_height*(a: PTextAttributes, `bg_full_height`: guint) = - a.flag0 = a.flag0 or - (int16(`bg_full_height` shl bp_TGtkTextAttributes_bg_full_height) and - bm_TGtkTextAttributes_bg_full_height) - -proc editable*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_editable) shr - bp_TGtkTextAttributes_editable - -proc set_editable*(a: PTextAttributes, `editable`: guint) = - a.flag0 = a.flag0 or - (int16(`editable` shl bp_TGtkTextAttributes_editable) and - bm_TGtkTextAttributes_editable) - -proc realized*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_realized) shr - bp_TGtkTextAttributes_realized - -proc set_realized*(a: PTextAttributes, `realized`: guint) = - a.flag0 = a.flag0 or - (int16(`realized` shl bp_TGtkTextAttributes_realized) and - bm_TGtkTextAttributes_realized) - -proc pad1*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_pad1) shr - bp_TGtkTextAttributes_pad1 - -proc set_pad1*(a: PTextAttributes, `pad1`: guint) = - a.flag0 = a.flag0 or - (int16(`pad1` shl bp_TGtkTextAttributes_pad1) and - bm_TGtkTextAttributes_pad1) - -proc pad2*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_pad2) shr - bp_TGtkTextAttributes_pad2 - -proc set_pad2*(a: PTextAttributes, `pad2`: guint) = - a.flag0 = a.flag0 or - (int16(`pad2` shl bp_TGtkTextAttributes_pad2) and - bm_TGtkTextAttributes_pad2) - -proc pad3*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_pad3) shr - bp_TGtkTextAttributes_pad3 - -proc set_pad3*(a: PTextAttributes, `pad3`: guint) = - a.flag0 = a.flag0 or - (int16(`pad3` shl bp_TGtkTextAttributes_pad3) and - bm_TGtkTextAttributes_pad3) - -proc pad4*(a: PTextAttributes): guint = - result = (a.flag0 and bm_TGtkTextAttributes_pad4) shr - bp_TGtkTextAttributes_pad4 - -proc set_pad4*(a: PTextAttributes, `pad4`: guint) = - a.flag0 = a.flag0 or - (int16(`pad4` shl bp_TGtkTextAttributes_pad4) and - bm_TGtkTextAttributes_pad4) - -proc TYPE_TEXT_TAG_TABLE*(): GType = - result = text_tag_table_get_type() - -proc TEXT_TAG_TABLE*(obj: pointer): PTextTagTable = - result = cast[PTextTagTable](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_TEXT_TAG_TABLE())) - -proc TEXT_TAG_TABLE_CLASS*(klass: pointer): PTextTagTableClass = - result = cast[PTextTagTableClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_TEXT_TAG_TABLE())) - -proc IS_TEXT_TAG_TABLE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TEXT_TAG_TABLE()) - -proc IS_TEXT_TAG_TABLE_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_TEXT_TAG_TABLE()) - -proc TEXT_TAG_TABLE_GET_CLASS*(obj: pointer): PTextTagTableClass = - result = cast[PTextTagTableClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_TEXT_TAG_TABLE())) - -proc TYPE_TEXT_MARK*(): GType = - result = text_mark_get_type() - -proc TEXT_MARK*(anObject: pointer): PTextMark = - result = cast[PTextMark](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_TEXT_MARK())) - -proc TEXT_MARK_CLASS*(klass: pointer): PTextMarkClass = - result = cast[PTextMarkClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_TEXT_MARK())) - -proc IS_TEXT_MARK*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_TEXT_MARK()) - -proc IS_TEXT_MARK_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_TEXT_MARK()) - -proc TEXT_MARK_GET_CLASS*(obj: pointer): PTextMarkClass = - result = cast[PTextMarkClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_TEXT_MARK())) - -proc visible*(a: PTextMarkBody): guint = - result = (a.flag0 and bm_TGtkTextMarkBody_visible) shr - bp_TGtkTextMarkBody_visible - -proc set_visible*(a: PTextMarkBody, `visible`: guint) = - a.flag0 = a.flag0 or - (int16(`visible` shl bp_TGtkTextMarkBody_visible) and - bm_TGtkTextMarkBody_visible) - -proc not_deleteable*(a: PTextMarkBody): guint = - result = (a.flag0 and bm_TGtkTextMarkBody_not_deleteable) shr - bp_TGtkTextMarkBody_not_deleteable - -proc set_not_deleteable*(a: PTextMarkBody, `not_deleteable`: guint) = - a.flag0 = a.flag0 or - (int16(`not_deleteable` shl bp_TGtkTextMarkBody_not_deleteable) and - bm_TGtkTextMarkBody_not_deleteable) - -proc TYPE_TEXT_CHILD_ANCHOR*(): GType = - result = text_child_anchor_get_type() - -proc TEXT_CHILD_ANCHOR*(anObject: pointer): PTextChildAnchor = - result = cast[PTextChildAnchor](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_TEXT_CHILD_ANCHOR())) - -proc TEXT_CHILD_ANCHOR_CLASS*(klass: pointer): PTextChildAnchorClass = - result = cast[PTextChildAnchorClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_TEXT_CHILD_ANCHOR())) - -proc IS_TEXT_CHILD_ANCHOR*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_TEXT_CHILD_ANCHOR()) - -proc IS_TEXT_CHILD_ANCHOR_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_TEXT_CHILD_ANCHOR()) - -proc TEXT_CHILD_ANCHOR_GET_CLASS*(obj: pointer): PTextChildAnchorClass = - result = cast[PTextChildAnchorClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_TEXT_CHILD_ANCHOR())) - -proc width*(a: PTextLineData): gint = - result = a.flag0 and bm_TGtkTextLineData_width - -proc set_width*(a: PTextLineData, NewWidth: gint) = - a.flag0 = (bm_TGtkTextLineData_width and NewWidth) or a.flag0 - -proc valid*(a: PTextLineData): gint = - result = (a.flag0 and bm_TGtkTextLineData_valid) shr - bp_TGtkTextLineData_valid - -proc set_valid*(a: PTextLineData, `valid`: gint) = - a.flag0 = a.flag0 or - ((`valid` shl bp_TGtkTextLineData_valid) and bm_TGtkTextLineData_valid) - -proc TYPE_TEXT_BUFFER*(): GType = - result = text_buffer_get_type() - -proc TEXT_BUFFER*(obj: pointer): PTextBuffer = - result = cast[PTextBuffer](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_TEXT_BUFFER())) - -proc TEXT_BUFFER_CLASS*(klass: pointer): PTextBufferClass = - result = cast[PTextBufferClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_TEXT_BUFFER())) - -proc IS_TEXT_BUFFER*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TEXT_BUFFER()) - -proc IS_TEXT_BUFFER_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_TEXT_BUFFER()) - -proc TEXT_BUFFER_GET_CLASS*(obj: pointer): PTextBufferClass = - result = cast[PTextBufferClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_TEXT_BUFFER())) - -proc modified*(a: PTextBuffer): guint = - result = (a.TextBufferflag0 and bm_TGtkTextBuffer_modified) shr - bp_TGtkTextBuffer_modified - -proc set_modified*(a: PTextBuffer, `modified`: guint) = - a.TextBufferflag0 = a.TextBufferflag0 or - (int16(`modified` shl bp_TGtkTextBuffer_modified) and - bm_TGtkTextBuffer_modified) - -proc TYPE_TEXT_LAYOUT*(): GType = - result = text_layout_get_type() - -proc TEXT_LAYOUT*(obj: pointer): PTextLayout = - result = cast[PTextLayout](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_TEXT_LAYOUT())) - -proc TEXT_LAYOUT_CLASS*(klass: pointer): PTextLayoutClass = - result = cast[PTextLayoutClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_TEXT_LAYOUT())) - -proc IS_TEXT_LAYOUT*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TEXT_LAYOUT()) - -proc IS_TEXT_LAYOUT_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_TEXT_LAYOUT()) - -proc TEXT_LAYOUT_GET_CLASS*(obj: pointer): PTextLayoutClass = - result = cast[PTextLayoutClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_TEXT_LAYOUT())) - -proc cursor_visible*(a: PTextLayout): guint = - result = (a.TextLayoutflag0 and bm_TGtkTextLayout_cursor_visible) shr - bp_TGtkTextLayout_cursor_visible - -proc set_cursor_visible*(a: PTextLayout, `cursor_visible`: guint) = - a.TextLayoutflag0 = a.TextLayoutflag0 or - (int16(`cursor_visible` shl bp_TGtkTextLayout_cursor_visible) and - bm_TGtkTextLayout_cursor_visible) - -proc cursor_direction*(a: PTextLayout): gint = - result = (a.TextLayoutflag0 and bm_TGtkTextLayout_cursor_direction) shr - bp_TGtkTextLayout_cursor_direction - -proc set_cursor_direction*(a: PTextLayout, `cursor_direction`: gint) = - a.TextLayoutflag0 = a.TextLayoutflag0 or - (int16(`cursor_direction` shl bp_TGtkTextLayout_cursor_direction) and - bm_TGtkTextLayout_cursor_direction) - -proc is_strong*(a: PTextCursorDisplay): guint = - result = (a.flag0 and bm_TGtkTextCursorDisplay_is_strong) shr - bp_TGtkTextCursorDisplay_is_strong - -proc set_is_strong*(a: PTextCursorDisplay, `is_strong`: guint) = - a.flag0 = a.flag0 or - (int16(`is_strong` shl bp_TGtkTextCursorDisplay_is_strong) and - bm_TGtkTextCursorDisplay_is_strong) - -proc is_weak*(a: PTextCursorDisplay): guint = - result = (a.flag0 and bm_TGtkTextCursorDisplay_is_weak) shr - bp_TGtkTextCursorDisplay_is_weak - -proc set_is_weak*(a: PTextCursorDisplay, `is_weak`: guint) = - a.flag0 = a.flag0 or - (int16(`is_weak` shl bp_TGtkTextCursorDisplay_is_weak) and - bm_TGtkTextCursorDisplay_is_weak) - -proc TYPE_TEXT_VIEW*(): GType = - result = text_view_get_type() - -proc TEXT_VIEW*(obj: pointer): PTextView = - result = cast[PTextView](CHECK_CAST(obj, TYPE_TEXT_VIEW())) - -proc TEXT_VIEW_CLASS*(klass: pointer): PTextViewClass = - result = cast[PTextViewClass](CHECK_CLASS_CAST(klass, TYPE_TEXT_VIEW())) - -proc IS_TEXT_VIEW*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TEXT_VIEW()) - -proc IS_TEXT_VIEW_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TEXT_VIEW()) - -proc TEXT_VIEW_GET_CLASS*(obj: pointer): PTextViewClass = - result = cast[PTextViewClass](CHECK_GET_CLASS(obj, TYPE_TEXT_VIEW())) - -proc editable*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_editable) shr - bp_TGtkTextView_editable - -proc set_editable*(a: PTextView, `editable`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`editable` shl bp_TGtkTextView_editable) and - bm_TGtkTextView_editable) - -proc overwrite_mode*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_overwrite_mode) shr - bp_TGtkTextView_overwrite_mode - -proc set_overwrite_mode*(a: PTextView, `overwrite_mode`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`overwrite_mode` shl bp_TGtkTextView_overwrite_mode) and - bm_TGtkTextView_overwrite_mode) - -proc cursor_visible*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_cursor_visible) shr - bp_TGtkTextView_cursor_visible - -proc set_cursor_visible*(a: PTextView, `cursor_visible`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`cursor_visible` shl bp_TGtkTextView_cursor_visible) and - bm_TGtkTextView_cursor_visible) - -proc need_im_reset*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_need_im_reset) shr - bp_TGtkTextView_need_im_reset - -proc set_need_im_reset*(a: PTextView, `need_im_reset`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`need_im_reset` shl bp_TGtkTextView_need_im_reset) and - bm_TGtkTextView_need_im_reset) - -proc just_selected_element*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_just_selected_element) shr - bp_TGtkTextView_just_selected_element - -proc set_just_selected_element*(a: PTextView, `just_selected_element`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`just_selected_element` shl - bp_TGtkTextView_just_selected_element) and - bm_TGtkTextView_just_selected_element) - -proc disable_scroll_on_focus*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_disable_scroll_on_focus) shr - bp_TGtkTextView_disable_scroll_on_focus - -proc set_disable_scroll_on_focus*(a: PTextView, - `disable_scroll_on_focus`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`disable_scroll_on_focus` shl - bp_TGtkTextView_disable_scroll_on_focus) and - bm_TGtkTextView_disable_scroll_on_focus) - -proc onscreen_validated*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_onscreen_validated) shr - bp_TGtkTextView_onscreen_validated - -proc set_onscreen_validated*(a: PTextView, `onscreen_validated`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`onscreen_validated` shl bp_TGtkTextView_onscreen_validated) and - bm_TGtkTextView_onscreen_validated) - -proc mouse_cursor_obscured*(a: PTextView): guint = - result = (a.TextViewflag0 and bm_TGtkTextView_mouse_cursor_obscured) shr - bp_TGtkTextView_mouse_cursor_obscured - -proc set_mouse_cursor_obscured*(a: PTextView, `mouse_cursor_obscured`: guint) = - a.TextViewflag0 = a.TextViewflag0 or - (int16(`mouse_cursor_obscured` shl - bp_TGtkTextView_mouse_cursor_obscured) and - bm_TGtkTextView_mouse_cursor_obscured) - -proc TYPE_TIPS_QUERY*(): GType = - result = tips_query_get_type() - -proc TIPS_QUERY*(obj: pointer): PTipsQuery = - result = cast[PTipsQuery](CHECK_CAST(obj, TYPE_TIPS_QUERY())) - -proc TIPS_QUERY_CLASS*(klass: pointer): PTipsQueryClass = - result = cast[PTipsQueryClass](CHECK_CLASS_CAST(klass, TYPE_TIPS_QUERY())) - -proc IS_TIPS_QUERY*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TIPS_QUERY()) - -proc IS_TIPS_QUERY_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TIPS_QUERY()) - -proc TIPS_QUERY_GET_CLASS*(obj: pointer): PTipsQueryClass = - result = cast[PTipsQueryClass](CHECK_GET_CLASS(obj, TYPE_TIPS_QUERY())) - -proc emit_always*(a: PTipsQuery): guint = - result = (a.TipsQueryflag0 and bm_TGtkTipsQuery_emit_always) shr - bp_TGtkTipsQuery_emit_always - -proc set_emit_always*(a: PTipsQuery, `emit_always`: guint) = - a.TipsQueryflag0 = a.TipsQueryflag0 or - (int16(`emit_always` shl bp_TGtkTipsQuery_emit_always) and - bm_TGtkTipsQuery_emit_always) - -proc in_query*(a: PTipsQuery): guint = - result = (a.TipsQueryflag0 and bm_TGtkTipsQuery_in_query) shr - bp_TGtkTipsQuery_in_query - -proc set_in_query*(a: PTipsQuery, `in_query`: guint) = - a.TipsQueryflag0 = a.TipsQueryflag0 or - (int16(`in_query` shl bp_TGtkTipsQuery_in_query) and - bm_TGtkTipsQuery_in_query) - -proc TYPE_TOOLTIPS*(): GType = - result = tooltips_get_type() - -proc TOOLTIPS*(obj: pointer): PTooltips = - result = cast[PTooltips](CHECK_CAST(obj, TYPE_TOOLTIPS())) - -proc TOOLTIPS_CLASS*(klass: pointer): PTooltipsClass = - result = cast[PTooltipsClass](CHECK_CLASS_CAST(klass, TYPE_TOOLTIPS())) - -proc IS_TOOLTIPS*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TOOLTIPS()) - -proc IS_TOOLTIPS_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TOOLTIPS()) - -proc TOOLTIPS_GET_CLASS*(obj: pointer): PTooltipsClass = - result = cast[PTooltipsClass](CHECK_GET_CLASS(obj, TYPE_TOOLTIPS())) - -proc delay*(a: PTooltips): guint = - result = (a.Tooltipsflag0 and bm_TGtkTooltips_delay) shr - bp_TGtkTooltips_delay - -proc set_delay*(a: PTooltips, `delay`: guint) = - a.Tooltipsflag0 = a.Tooltipsflag0 or - ((`delay` shl bp_TGtkTooltips_delay) and bm_TGtkTooltips_delay) - -proc enabled*(a: PTooltips): guint = - result = (a.Tooltipsflag0 and bm_TGtkTooltips_enabled) shr - bp_TGtkTooltips_enabled - -proc set_enabled*(a: PTooltips, `enabled`: guint) = - a.Tooltipsflag0 = a.Tooltipsflag0 or - ((`enabled` shl bp_TGtkTooltips_enabled) and bm_TGtkTooltips_enabled) - -proc have_grab*(a: PTooltips): guint = - result = (a.Tooltipsflag0 and bm_TGtkTooltips_have_grab) shr - bp_TGtkTooltips_have_grab - -proc set_have_grab*(a: PTooltips, `have_grab`: guint) = - a.Tooltipsflag0 = a.Tooltipsflag0 or - ((`have_grab` shl bp_TGtkTooltips_have_grab) and - bm_TGtkTooltips_have_grab) - -proc use_sticky_delay*(a: PTooltips): guint = - result = (a.Tooltipsflag0 and bm_TGtkTooltips_use_sticky_delay) shr - bp_TGtkTooltips_use_sticky_delay - -proc set_use_sticky_delay*(a: PTooltips, `use_sticky_delay`: guint) = - a.Tooltipsflag0 = a.Tooltipsflag0 or - ((`use_sticky_delay` shl bp_TGtkTooltips_use_sticky_delay) and - bm_TGtkTooltips_use_sticky_delay) - -proc TYPE_TOOLBAR*(): GType = - result = toolbar_get_type() - -proc TOOLBAR*(obj: pointer): PToolbar = - result = cast[PToolbar](CHECK_CAST(obj, TYPE_TOOLBAR())) - -proc TOOLBAR_CLASS*(klass: pointer): PToolbarClass = - result = cast[PToolbarClass](CHECK_CLASS_CAST(klass, TYPE_TOOLBAR())) - -proc IS_TOOLBAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TOOLBAR()) - -proc IS_TOOLBAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TOOLBAR()) - -proc TOOLBAR_GET_CLASS*(obj: pointer): PToolbarClass = - result = cast[PToolbarClass](CHECK_GET_CLASS(obj, TYPE_TOOLBAR())) - -proc style_set*(a: PToolbar): guint = - result = (a.Toolbarflag0 and bm_TGtkToolbar_style_set) shr - bp_TGtkToolbar_style_set - -proc set_style_set*(a: PToolbar, `style_set`: guint) = - a.Toolbarflag0 = a.Toolbarflag0 or - (int16(`style_set` shl bp_TGtkToolbar_style_set) and - bm_TGtkToolbar_style_set) - -proc icon_size_set*(a: PToolbar): guint = - result = (a.Toolbarflag0 and bm_TGtkToolbar_icon_size_set) shr - bp_TGtkToolbar_icon_size_set - -proc set_icon_size_set*(a: PToolbar, `icon_size_set`: guint) = - a.Toolbarflag0 = a.Toolbarflag0 or - (int16(`icon_size_set` shl bp_TGtkToolbar_icon_size_set) and - bm_TGtkToolbar_icon_size_set) - -proc TYPE_TREE*(): GType = - result = tree_get_type() - -proc TREE*(obj: pointer): PTree = - result = cast[PTree](CHECK_CAST(obj, TYPE_TREE())) - -proc TREE_CLASS*(klass: pointer): PTreeClass = - result = cast[PTreeClass](CHECK_CLASS_CAST(klass, TYPE_TREE())) - -proc IS_TREE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE()) - -proc IS_TREE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE()) - -proc TREE_GET_CLASS*(obj: pointer): PTreeClass = - result = cast[PTreeClass](CHECK_GET_CLASS(obj, TYPE_TREE())) - -proc IS_ROOT_TREE*(obj: pointer): bool = - result = (cast[PObject]((TREE(obj)).root_tree)) == (cast[PObject](obj)) - -proc TREE_ROOT_TREE*(obj: pointer): PTree = - result = TREE(obj).root_tree - -proc TREE_SELECTION_OLD*(obj: pointer): PGList = - result = (TREE_ROOT_TREE(obj)).selection - -proc selection_mode*(a: PTree): guint = - result = (a.Treeflag0 and bm_TGtkTree_selection_mode) shr - bp_TGtkTree_selection_mode - -proc set_selection_mode*(a: PTree, `selection_mode`: guint) = - a.Treeflag0 = a.Treeflag0 or - (int16(`selection_mode` shl bp_TGtkTree_selection_mode) and - bm_TGtkTree_selection_mode) - -proc view_mode*(a: PTree): guint = - result = (a.Treeflag0 and bm_TGtkTree_view_mode) shr bp_TGtkTree_view_mode - -proc set_view_mode*(a: PTree, `view_mode`: guint) = - a.Treeflag0 = a.Treeflag0 or - (int16(`view_mode` shl bp_TGtkTree_view_mode) and bm_TGtkTree_view_mode) - -proc view_line*(a: PTree): guint = - result = (a.Treeflag0 and bm_TGtkTree_view_line) shr bp_TGtkTree_view_line - -proc set_view_line*(a: PTree, `view_line`: guint) = - a.Treeflag0 = a.Treeflag0 or - (int16(`view_line` shl bp_TGtkTree_view_line) and bm_TGtkTree_view_line) - -proc TYPE_TREE_DRAG_SOURCE*(): GType = - result = tree_drag_source_get_type() - -proc TREE_DRAG_SOURCE*(obj: pointer): PTreeDragSource = - result = cast[PTreeDragSource](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_TREE_DRAG_SOURCE())) - -proc IS_TREE_DRAG_SOURCE*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TREE_DRAG_SOURCE()) - -proc TREE_DRAG_SOURCE_GET_IFACE*(obj: pointer): PTreeDragSourceIface = - result = cast[PTreeDragSourceIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_TREE_DRAG_SOURCE())) - -proc TYPE_TREE_DRAG_DEST*(): GType = - result = tree_drag_dest_get_type() - -proc TREE_DRAG_DEST*(obj: pointer): PTreeDragDest = - result = cast[PTreeDragDest](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_TREE_DRAG_DEST())) - -proc IS_TREE_DRAG_DEST*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_TREE_DRAG_DEST()) - -proc TREE_DRAG_DEST_GET_IFACE*(obj: pointer): PTreeDragDestIface = - result = cast[PTreeDragDestIface](G_TYPE_INSTANCE_GET_INTERFACE(obj, - TYPE_TREE_DRAG_DEST())) - -proc TYPE_TREE_ITEM*(): GType = - result = tree_item_get_type() - -proc TREE_ITEM*(obj: pointer): PTreeItem = - result = cast[PTreeItem](CHECK_CAST(obj, TYPE_TREE_ITEM())) - -proc TREE_ITEM_CLASS*(klass: pointer): PTreeItemClass = - result = cast[PTreeItemClass](CHECK_CLASS_CAST(klass, TYPE_TREE_ITEM())) - -proc IS_TREE_ITEM*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE_ITEM()) - -proc IS_TREE_ITEM_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE_ITEM()) - -proc TREE_ITEM_GET_CLASS*(obj: pointer): PTreeItemClass = - result = cast[PTreeItemClass](CHECK_GET_CLASS(obj, TYPE_TREE_ITEM())) - -proc TREE_ITEM_SUBTREE*(obj: pointer): PWidget = - result = (TREE_ITEM(obj)).subtree - -proc expanded*(a: PTreeItem): guint = - result = (a.TreeItemflag0 and bm_TGtkTreeItem_expanded) shr - bp_TGtkTreeItem_expanded - -proc set_expanded*(a: PTreeItem, `expanded`: guint) = - a.TreeItemflag0 = a.TreeItemflag0 or - (int16(`expanded` shl bp_TGtkTreeItem_expanded) and - bm_TGtkTreeItem_expanded) - -proc TYPE_TREE_SELECTION*(): GType = - result = tree_selection_get_type() - -proc TREE_SELECTION*(obj: pointer): PTreeSelection = - result = cast[PTreeSelection](CHECK_CAST(obj, TYPE_TREE_SELECTION())) - -proc TREE_SELECTION_CLASS*(klass: pointer): PTreeSelectionClass = - result = cast[PTreeSelectionClass](CHECK_CLASS_CAST(klass, - TYPE_TREE_SELECTION())) - -proc IS_TREE_SELECTION*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE_SELECTION()) - -proc IS_TREE_SELECTION_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE_SELECTION()) - -proc TREE_SELECTION_GET_CLASS*(obj: pointer): PTreeSelectionClass = - result = cast[PTreeSelectionClass](CHECK_GET_CLASS(obj, TYPE_TREE_SELECTION())) - -proc TYPE_TREE_STORE*(): GType = - result = tree_store_get_type() - -proc TREE_STORE*(obj: pointer): PTreeStore = - result = cast[PTreeStore](CHECK_CAST(obj, TYPE_TREE_STORE())) - -proc TREE_STORE_CLASS*(klass: pointer): PTreeStoreClass = - result = cast[PTreeStoreClass](CHECK_CLASS_CAST(klass, TYPE_TREE_STORE())) - -proc IS_TREE_STORE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE_STORE()) - -proc IS_TREE_STORE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE_STORE()) - -proc TREE_STORE_GET_CLASS*(obj: pointer): PTreeStoreClass = - result = cast[PTreeStoreClass](CHECK_GET_CLASS(obj, TYPE_TREE_STORE())) - -proc columns_dirty*(a: PTreeStore): guint = - result = (a.TreeStoreflag0 and bm_TGtkTreeStore_columns_dirty) shr - bp_TGtkTreeStore_columns_dirty - -proc set_columns_dirty*(a: PTreeStore, `columns_dirty`: guint) = - a.TreeStoreflag0 = a.TreeStoreflag0 or - (int16(`columns_dirty` shl bp_TGtkTreeStore_columns_dirty) and - bm_TGtkTreeStore_columns_dirty) - -proc TYPE_TREE_VIEW_COLUMN*(): GType = - result = tree_view_column_get_type() - -proc TREE_VIEW_COLUMN*(obj: pointer): PTreeViewColumn = - result = cast[PTreeViewColumn](CHECK_CAST(obj, TYPE_TREE_VIEW_COLUMN())) - -proc TREE_VIEW_COLUMN_CLASS*(klass: pointer): PTreeViewColumnClass = - result = cast[PTreeViewColumnClass](CHECK_CLASS_CAST(klass, - TYPE_TREE_VIEW_COLUMN())) - -proc IS_TREE_VIEW_COLUMN*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE_VIEW_COLUMN()) - -proc IS_TREE_VIEW_COLUMN_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE_VIEW_COLUMN()) - -proc TREE_VIEW_COLUMN_GET_CLASS*(obj: pointer): PTreeViewColumnClass = - result = cast[PTreeViewColumnClass](CHECK_GET_CLASS(obj, - TYPE_TREE_VIEW_COLUMN())) - -proc visible*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_visible) shr - bp_TGtkTreeViewColumn_visible - -proc set_visible*(a: PTreeViewColumn, `visible`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`visible` shl bp_TGtkTreeViewColumn_visible) and - bm_TGtkTreeViewColumn_visible) - -proc resizable*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_resizable) shr - bp_TGtkTreeViewColumn_resizable - -proc set_resizable*(a: PTreeViewColumn, `resizable`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`resizable` shl bp_TGtkTreeViewColumn_resizable) and - bm_TGtkTreeViewColumn_resizable) - -proc clickable*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_clickable) shr - bp_TGtkTreeViewColumn_clickable - -proc set_clickable*(a: PTreeViewColumn, `clickable`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`clickable` shl bp_TGtkTreeViewColumn_clickable) and - bm_TGtkTreeViewColumn_clickable) - -proc dirty*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_dirty) shr - bp_TGtkTreeViewColumn_dirty - -proc set_dirty*(a: PTreeViewColumn, `dirty`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`dirty` shl bp_TGtkTreeViewColumn_dirty) and - bm_TGtkTreeViewColumn_dirty) - -proc show_sort_indicator*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and - bm_TGtkTreeViewColumn_show_sort_indicator) shr - bp_TGtkTreeViewColumn_show_sort_indicator - -proc set_show_sort_indicator*(a: PTreeViewColumn, - `show_sort_indicator`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`show_sort_indicator` shl - bp_TGtkTreeViewColumn_show_sort_indicator) and - bm_TGtkTreeViewColumn_show_sort_indicator) - -proc maybe_reordered*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_maybe_reordered) shr - bp_TGtkTreeViewColumn_maybe_reordered - -proc set_maybe_reordered*(a: PTreeViewColumn, `maybe_reordered`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`maybe_reordered` shl bp_TGtkTreeViewColumn_maybe_reordered) and - bm_TGtkTreeViewColumn_maybe_reordered) - -proc reorderable*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_reorderable) shr - bp_TGtkTreeViewColumn_reorderable - -proc set_reorderable*(a: PTreeViewColumn, `reorderable`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`reorderable` shl bp_TGtkTreeViewColumn_reorderable) and - bm_TGtkTreeViewColumn_reorderable) - -proc use_resized_width*(a: PTreeViewColumn): guint = - result = (a.TreeViewColumnflag0 and bm_TGtkTreeViewColumn_use_resized_width) shr - bp_TGtkTreeViewColumn_use_resized_width - -proc set_use_resized_width*(a: PTreeViewColumn, `use_resized_width`: guint) = - a.TreeViewColumnflag0 = a.TreeViewColumnflag0 or - (int16(`use_resized_width` shl bp_TGtkTreeViewColumn_use_resized_width) and - bm_TGtkTreeViewColumn_use_resized_width) - -proc flags*(a: PRBNode): guint = - result = (a.flag0 and bm_TGtkRBNode_flags) shr bp_TGtkRBNode_flags - -proc set_flags*(a: PRBNode, `flags`: guint) = - a.flag0 = a.flag0 or - (int16(`flags` shl bp_TGtkRBNode_flags) and bm_TGtkRBNode_flags) - -proc parity*(a: PRBNode): guint = - result = (a.flag0 and bm_TGtkRBNode_parity) shr bp_TGtkRBNode_parity - -proc set_parity*(a: PRBNode, `parity`: guint) = - a.flag0 = a.flag0 or - (int16(`parity` shl bp_TGtkRBNode_parity) and bm_TGtkRBNode_parity) - -proc GET_COLOR*(node: PRBNode): guint = - if node == nil: - Result = RBNODE_BLACK - elif (int(flags(node)) and RBNODE_RED) == RBNODE_RED: - Result = RBNODE_RED - else: - Result = RBNODE_BLACK - -proc SET_COLOR*(node: PRBNode, color: guint) = - if node == nil: - return - if ((flags(node) and (color)) != color): - set_flags(node, flags(node) xor cint(RBNODE_RED or RBNODE_BLACK)) - -proc GET_HEIGHT*(node: PRBNode): gint = - var if_local1: gint - if node.children != nil: - if_local1 = node.children.root.offset - else: - if_local1 = 0 - result = node.offset - - ((node.left.offset) + node.right.offset + if_local1) - -proc FLAG_SET*(node: PRBNode, flag: guint): bool = - result = (node != nil) and ((flags(node) and (flag)) == flag) - -proc SET_FLAG*(node: PRBNode, flag: guint16) = - set_flags(node, (flag) or flags(node)) - -proc UNSET_FLAG*(node: PRBNode, flag: guint16) = - set_flags(node, (not (flag)) and flags(node)) - -proc FLAG_SET*(tree_view: PTreeView, flag: guint): bool = - result = ((tree_view.priv.flags) and (flag)) == flag - -proc HEADER_HEIGHT*(tree_view: PTreeView): int32 = - var if_local1: int32 - if FLAG_SET(tree_view, TREE_VIEW_HEADERS_VISIBLE): - if_local1 = tree_view.priv.header_height - else: - if_local1 = 0 - result = if_local1 - -proc COLUMN_REQUESTED_WIDTH*(column: PTreeViewColumn): int32 = - var MinWidth, MaxWidth: int - if column.min_width != - 1'i32: - MinWidth = column.min_width - else: - MinWidth = column.requested_width - if column.max_width != - 1'i32: - MaxWidth = column.max_width - else: - MaxWidth = column.requested_width - result = CLAMP(column.requested_width, MinWidth, MaxWidth).int32 - -proc DRAW_EXPANDERS*(tree_view: PTreeView): bool = - result = (not (FLAG_SET(tree_view, TREE_VIEW_IS_LIST))) and - (FLAG_SET(tree_view, TREE_VIEW_SHOW_EXPANDERS)) - -proc COLUMN_DRAG_DEAD_MULTIPLIER*(tree_view: PTreeView): int32 = - result = 10'i32 * (HEADER_HEIGHT(tree_view)) - -proc scroll_to_use_align*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_scroll_to_use_align) shr - bp_TGtkTreeViewPrivate_scroll_to_use_align - -proc set_scroll_to_use_align*(a: PTreeViewPrivate, - `scroll_to_use_align`: guint) = - a.flag0 = a.flag0 or - (int16(`scroll_to_use_align` shl - bp_TGtkTreeViewPrivate_scroll_to_use_align) and - bm_TGtkTreeViewPrivate_scroll_to_use_align) - -proc fixed_height_check*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_fixed_height_check) shr - bp_TGtkTreeViewPrivate_fixed_height_check - -proc set_fixed_height_check*(a: PTreeViewPrivate, - `fixed_height_check`: guint) = - a.flag0 = a.flag0 or - (int16(`fixed_height_check` shl - bp_TGtkTreeViewPrivate_fixed_height_check) and - bm_TGtkTreeViewPrivate_fixed_height_check) - -proc reorderable*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_reorderable) shr - bp_TGtkTreeViewPrivate_reorderable - -proc set_reorderable*(a: PTreeViewPrivate, `reorderable`: guint) = - a.flag0 = a.flag0 or - (int16(`reorderable` shl bp_TGtkTreeViewPrivate_reorderable) and - bm_TGtkTreeViewPrivate_reorderable) - -proc header_has_focus*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_header_has_focus) shr - bp_TGtkTreeViewPrivate_header_has_focus - -proc set_header_has_focus*(a: PTreeViewPrivate, `header_has_focus`: guint) = - a.flag0 = a.flag0 or - (int16(`header_has_focus` shl bp_TGtkTreeViewPrivate_header_has_focus) and - bm_TGtkTreeViewPrivate_header_has_focus) - -proc drag_column_window_state*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_drag_column_window_state) shr - bp_TGtkTreeViewPrivate_drag_column_window_state - -proc set_drag_column_window_state*(a: PTreeViewPrivate, - `drag_column_window_state`: guint) = - a.flag0 = a.flag0 or - (int16(`drag_column_window_state` shl - bp_TGtkTreeViewPrivate_drag_column_window_state) and - bm_TGtkTreeViewPrivate_drag_column_window_state) - -proc has_rules*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_has_rules) shr - bp_TGtkTreeViewPrivate_has_rules - -proc set_has_rules*(a: PTreeViewPrivate, `has_rules`: guint) = - a.flag0 = a.flag0 or - (int16(`has_rules` shl bp_TGtkTreeViewPrivate_has_rules) and - bm_TGtkTreeViewPrivate_has_rules) - -proc mark_rows_col_dirty*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_mark_rows_col_dirty) shr - bp_TGtkTreeViewPrivate_mark_rows_col_dirty - -proc set_mark_rows_col_dirty*(a: PTreeViewPrivate, - `mark_rows_col_dirty`: guint) = - a.flag0 = a.flag0 or - (int16(`mark_rows_col_dirty` shl - bp_TGtkTreeViewPrivate_mark_rows_col_dirty) and - bm_TGtkTreeViewPrivate_mark_rows_col_dirty) - -proc enable_search*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_enable_search) shr - bp_TGtkTreeViewPrivate_enable_search - -proc set_enable_search*(a: PTreeViewPrivate, `enable_search`: guint) = - a.flag0 = a.flag0 or - (int16(`enable_search` shl bp_TGtkTreeViewPrivate_enable_search) and - bm_TGtkTreeViewPrivate_enable_search) - -proc disable_popdown*(a: PTreeViewPrivate): guint = - result = (a.flag0 and bm_TGtkTreeViewPrivate_disable_popdown) shr - bp_TGtkTreeViewPrivate_disable_popdown - -proc set_disable_popdown*(a: PTreeViewPrivate, `disable_popdown`: guint) = - a.flag0 = a.flag0 or - (int16(`disable_popdown` shl bp_TGtkTreeViewPrivate_disable_popdown) and - bm_TGtkTreeViewPrivate_disable_popdown) - -proc SET_FLAG*(tree_view: PTreeView, flag: guint) = - tree_view.priv.flags = tree_view.priv.flags or (flag) - -proc UNSET_FLAG*(tree_view: PTreeView, flag: guint) = - tree_view.priv.flags = tree_view.priv.flags and not (flag) - -proc TYPE_TREE_VIEW*(): GType = - result = tree_view_get_type() - -proc TREE_VIEW*(obj: pointer): PTreeView = - result = cast[PTreeView](CHECK_CAST(obj, TYPE_TREE_VIEW())) - -proc TREE_VIEW_CLASS*(klass: pointer): PTreeViewClass = - result = cast[PTreeViewClass](CHECK_CLASS_CAST(klass, TYPE_TREE_VIEW())) - -proc IS_TREE_VIEW*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_TREE_VIEW()) - -proc IS_TREE_VIEW_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_TREE_VIEW()) - -proc TREE_VIEW_GET_CLASS*(obj: pointer): PTreeViewClass = - result = cast[PTreeViewClass](CHECK_GET_CLASS(obj, TYPE_TREE_VIEW())) - -proc TYPE_VBUTTON_BOX*(): GType = - result = vbutton_box_get_type() - -proc VBUTTON_BOX*(obj: pointer): PVButtonBox = - result = cast[PVButtonBox](CHECK_CAST(obj, TYPE_VBUTTON_BOX())) - -proc VBUTTON_BOX_CLASS*(klass: pointer): PVButtonBoxClass = - result = cast[PVButtonBoxClass](CHECK_CLASS_CAST(klass, TYPE_VBUTTON_BOX())) - -proc IS_VBUTTON_BOX*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VBUTTON_BOX()) - -proc IS_VBUTTON_BOX_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VBUTTON_BOX()) - -proc VBUTTON_BOX_GET_CLASS*(obj: pointer): PVButtonBoxClass = - result = cast[PVButtonBoxClass](CHECK_GET_CLASS(obj, TYPE_VBUTTON_BOX())) - -proc TYPE_VIEWPORT*(): GType = - result = viewport_get_type() - -proc VIEWPORT*(obj: pointer): PViewport = - result = cast[PViewport](CHECK_CAST(obj, TYPE_VIEWPORT())) - -proc VIEWPORT_CLASS*(klass: pointer): PViewportClass = - result = cast[PViewportClass](CHECK_CLASS_CAST(klass, TYPE_VIEWPORT())) - -proc IS_VIEWPORT*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VIEWPORT()) - -proc IS_VIEWPORT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VIEWPORT()) - -proc VIEWPORT_GET_CLASS*(obj: pointer): PViewportClass = - result = cast[PViewportClass](CHECK_GET_CLASS(obj, TYPE_VIEWPORT())) - -proc TYPE_VPANED*(): GType = - result = vpaned_get_type() - -proc VPANED*(obj: pointer): PVPaned = - result = cast[PVPaned](CHECK_CAST(obj, TYPE_VPANED())) - -proc VPANED_CLASS*(klass: pointer): PVPanedClass = - result = cast[PVPanedClass](CHECK_CLASS_CAST(klass, TYPE_VPANED())) - -proc IS_VPANED*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VPANED()) - -proc IS_VPANED_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VPANED()) - -proc VPANED_GET_CLASS*(obj: pointer): PVPanedClass = - result = cast[PVPanedClass](CHECK_GET_CLASS(obj, TYPE_VPANED())) - -proc TYPE_VRULER*(): GType = - result = vruler_get_type() - -proc VRULER*(obj: pointer): PVRuler = - result = cast[PVRuler](CHECK_CAST(obj, TYPE_VRULER())) - -proc VRULER_CLASS*(klass: pointer): PVRulerClass = - result = cast[PVRulerClass](CHECK_CLASS_CAST(klass, TYPE_VRULER())) - -proc IS_VRULER*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VRULER()) - -proc IS_VRULER_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VRULER()) - -proc VRULER_GET_CLASS*(obj: pointer): PVRulerClass = - result = cast[PVRulerClass](CHECK_GET_CLASS(obj, TYPE_VRULER())) - -proc TYPE_VSCALE*(): GType = - result = vscale_get_type() - -proc VSCALE*(obj: pointer): PVScale = - result = cast[PVScale](CHECK_CAST(obj, TYPE_VSCALE())) - -proc VSCALE_CLASS*(klass: pointer): PVScaleClass = - result = cast[PVScaleClass](CHECK_CLASS_CAST(klass, TYPE_VSCALE())) - -proc IS_VSCALE*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VSCALE()) - -proc IS_VSCALE_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VSCALE()) - -proc VSCALE_GET_CLASS*(obj: pointer): PVScaleClass = - result = cast[PVScaleClass](CHECK_GET_CLASS(obj, TYPE_VSCALE())) - -proc TYPE_VSCROLLBAR*(): GType = - result = vscrollbar_get_type() - -proc VSCROLLBAR*(obj: pointer): PVScrollbar = - result = cast[PVScrollbar](CHECK_CAST(obj, TYPE_VSCROLLBAR())) - -proc VSCROLLBAR_CLASS*(klass: pointer): PVScrollbarClass = - result = cast[PVScrollbarClass](CHECK_CLASS_CAST(klass, TYPE_VSCROLLBAR())) - -proc IS_VSCROLLBAR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VSCROLLBAR()) - -proc IS_VSCROLLBAR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VSCROLLBAR()) - -proc VSCROLLBAR_GET_CLASS*(obj: pointer): PVScrollbarClass = - result = cast[PVScrollbarClass](CHECK_GET_CLASS(obj, TYPE_VSCROLLBAR())) - -proc TYPE_VSEPARATOR*(): GType = - result = vseparator_get_type() - -proc VSEPARATOR*(obj: pointer): PVSeparator = - result = cast[PVSeparator](CHECK_CAST(obj, TYPE_VSEPARATOR())) - -proc VSEPARATOR_CLASS*(klass: pointer): PVSeparatorClass = - result = cast[PVSeparatorClass](CHECK_CLASS_CAST(klass, TYPE_VSEPARATOR())) - -proc IS_VSEPARATOR*(obj: pointer): bool = - result = CHECK_TYPE(obj, TYPE_VSEPARATOR()) - -proc IS_VSEPARATOR_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, TYPE_VSEPARATOR()) - -proc VSEPARATOR_GET_CLASS*(obj: pointer): PVSeparatorClass = - # these were missing: - result = cast[PVSeparatorClass](CHECK_GET_CLASS(obj, TYPE_VSEPARATOR())) - -type - Tcelllayout {.pure, final.} = object - - PCellLayout* = tcelllayout - PPGtkCellLayout* = ptr PCellLayout - PSignalRunType* = ptr TSignalRunType - TSignalRunType* = int32 - PFileChooserAction* = ptr TFileChooserAction - TFileChooserAction* = enum - FILE_CHOOSER_ACTION_OPEN, FILE_CHOOSER_ACTION_SAVE, - FILE_CHOOSER_ACTION_SELECT_FOLDER, FILE_CHOOSER_ACTION_CREATE_FOLDER - PFileChooserError* = ptr TFileChooserError - TFileChooserError* = enum - FILE_CHOOSER_ERROR_NONEXISTENT, FILE_CHOOSER_ERROR_BAD_FILENAME - - TFileChooser = object of TDialog - PFileChooser* = ptr TFileChooser - PPFileChooser* = ptr PFileChooser - - -const - ARG_READWRITE* = ARG_READABLE or ARG_WRITABLE - -proc entry_add_signal*(binding_set: PBindingSet, keyval: guint, - modifiers: gdk2.TModifierType, - signal_name: cstring, n_args: guint){.varargs, - importc: "gtk_binding_entry_add_signal", cdecl, dynlib: lib.} -proc clist_new_with_titles*(columns: gint): PCList{.varargs, cdecl, - importc: "gtk_clist_new_with_titles", dynlib: lib.} -proc prepend*(clist: PCList): gint{.importc: "gtk_clist_prepend", varargs, - cdecl, dynlib: lib.} -proc append*(clist: PCList): gint{.importc: "gtk_clist_append", varargs, - cdecl, dynlib: lib.} -proc insert*(clist: PCList, row: gint): gint{.varargs, cdecl, - importc: "gtk_clist_insert", dynlib: lib.} -proc set_attributes*(cell_layout: PCellLayout, cell: PCellRenderer){. - cdecl, varargs, importc: "gtk_cell_layout_set_attributes", dynlib: lib, - importc: "gtk_cell_layout_set_attributes".} -proc add_with_properties*(container: PContainer, widget: PWidget, - first_prop_name: cstring){.varargs, - importc: "gtk_container_add_with_properties", cdecl, dynlib: lib.} -proc child_set*(container: PContainer, child: PWidget, - first_prop_name: cstring){.varargs, cdecl, - importc: "gtk_container_child_set", dynlib: lib.} -proc child_get*(container: PContainer, child: PWidget, - first_prop_name: cstring){.varargs, cdecl, - importc: "gtk_container_child_get", dynlib: lib.} -proc child_set_valist*(container: PContainer, child: PWidget, - first_property_name: cstring){.varargs, - importc: "gtk_container_child_set_valist", cdecl, dynlib: lib.} -proc child_get_valist*(container: PContainer, child: PWidget, - first_property_name: cstring){.varargs, - importc: "gtk_container_child_get_valist", cdecl, dynlib: lib.} -proc ctree_new_with_titles*(columns: gint, tree_column: gint): PCTree{. - importc: "gtk_ctree_new_with_titles", varargs, cdecl, dynlib: lib.} -proc get_vector*(curve: PCurve, veclen: int32){.varargs, cdecl, - importc: "gtk_curve_get_vector", dynlib: lib.} -proc set_vector*(curve: PCurve, veclen: int32){.varargs, cdecl, - importc: "gtk_curve_set_vector", dynlib: lib.} -proc add_buttons*(dialog: PDialog, first_button_text: cstring){.varargs, - cdecl, importc: "gtk_dialog_add_buttons", dynlib: lib.} -proc dialog_new_with_buttons*(title: cstring, parent: PWindow, - flags: TDialogFlags, first_button_text: cstring): PDialog{. - varargs, cdecl, importc: "gtk_dialog_new_with_buttons", dynlib: lib.} -proc list_store_new*(n_columns: gint): PListStore{.varargs, cdecl, - importc: "gtk_list_store_new", dynlib: lib.} -proc set*(list_store: PListStore, iter: PTreeIter){.varargs, cdecl, - importc: "gtk_list_store_set", dynlib: lib.} -proc set_valist*(list_store: PListStore, iter: PTreeIter){.varargs, - cdecl, importc: "gtk_list_store_set_valist", dynlib: lib.} -proc message_dialog_new*(parent: PWindow, flags: TDialogFlags, - thetype: TMessageType, buttons: TButtonsType, - message_format: cstring): PMessageDialog{.varargs, - cdecl, importc: "gtk_message_dialog_new", dynlib: lib.} -proc set_markup*(msgDialog: PMessageDialog, str: cstring) {.cdecl, - importc: "gtk_message_dialog_set_markup", dynlib: lib.} - -proc signal_new*(name: cstring, signal_flags: TSignalRunType, - object_type: TType, function_offset: guint, - marshaller: TSignalMarshaller, return_val: TType, n_args: guint): guint{. - varargs, importc: "gtk_signal_new", cdecl, dynlib: lib.} -proc signal_emit*(anObject: PObject, signal_id: guint){.varargs, cdecl, - importc: "gtk_signal_emit", dynlib: lib.} -proc signal_emit_by_name*(anObject: PObject, name: cstring){.varargs, cdecl, - importc: "gtk_signal_emit_by_name", dynlib: lib.} -proc insert_with_tags*(buffer: PTextBuffer, iter: PTextIter, - text: cstring, length: gint, - first_tag: PTextTag){.varargs, - importc: "gtk_text_buffer_insert_with_tags", cdecl, dynlib: lib.} -proc insert_with_tags_by_name*(buffer: PTextBuffer, iter: PTextIter, - text: cstring, length: gint, first_tag_name: cstring){.varargs, - importc: "gtk_text_buffer_insert_with_tags_by_name", cdecl, dynlib: lib.} -proc create_tag*(buffer: PTextBuffer, tag_name: cstring, - first_property_name: cstring): PTextTag{.varargs, - importc: "gtk_text_buffer_create_tag", cdecl, dynlib: lib.} -proc get*(tree_model: PTreeModel, iter: PTreeIter){.varargs, - importc: "gtk_tree_model_get", cdecl, dynlib: lib.} -proc get_valist*(tree_model: PTreeModel, iter: PTreeIter){.varargs, - importc: "gtk_tree_model_get_valist", cdecl, dynlib: lib.} -proc tree_store_new*(n_columns: gint): PTreeStore{.varargs, cdecl, - importc: "gtk_tree_store_new", dynlib: lib.} -proc set*(tree_store: PTreeStore, iter: PTreeIter){.varargs, cdecl, - importc: "gtk_tree_store_set", dynlib: lib.} -proc set_valist*(tree_store: PTreeStore, iter: PTreeIter){.varargs, - cdecl, importc: "gtk_tree_store_set_valist", dynlib: lib.} -proc iter_is_valid*(tree_store: PTreeStore, iter: PTreeIter): gboolean{. - cdecl, importc: "gtk_tree_store_iter_is_valid", dynlib: lib.} -proc reorder*(tree_store: PTreeStore, parent: PTreeIter, - new_order: pgint){.cdecl, - importc: "gtk_tree_store_reorder", dynlib: lib.} -proc swap*(tree_store: PTreeStore, a: PTreeIter, b: PTreeIter){. - cdecl, importc: "gtk_tree_store_swap", dynlib: lib.} -proc move_before*(tree_store: PTreeStore, iter: PTreeIter, - position: PTreeIter){.cdecl, - importc: "gtk_tree_store_move_before", dynlib: lib.} -proc move_after*(tree_store: PTreeStore, iter: PTreeIter, - position: PTreeIter){.cdecl, - importc: "gtk_tree_store_move_after", dynlib: lib.} -proc insert_column_with_attributes*(tree_view: PTreeView, - position: gint, title: cstring, cell: PCellRenderer): gint{.varargs, - importc: "gtk_tree_view_insert_column_with_attributes", cdecl, dynlib: lib.} -proc tree_view_column_new_with_attributes*(title: cstring, cell: PCellRenderer): PTreeViewColumn{. - importc: "gtk_tree_view_column_new_with_attributes", varargs, cdecl, - dynlib: lib.} -proc column_set_attributes*(tree_column: PTreeViewColumn, - cell_renderer: PCellRenderer){. - importc: "gtk_tree_view_column_set_attributes", varargs, cdecl, dynlib: lib.} -proc widget_new*(thetype: TType, first_property_name: cstring): PWidget{. - importc: "gtk_widget_new", varargs, cdecl, dynlib: lib.} -proc set*(widget: PWidget, first_property_name: cstring){.varargs, - importc: "gtk_widget_set", cdecl, dynlib: lib.} -proc queue_clear*(widget: PWidget){.importc: "gtk_widget_queue_clear", - cdecl, dynlib: lib.} -proc queue_clear_area*(widget: PWidget, x: gint, y: gint, width: gint, - height: gint){.cdecl, - importc: "gtk_widget_queue_clear_area", dynlib: lib.} -proc draw*(widget: PWidget, area: gdk2.PRectangle){.cdecl, - importc: "gtk_widget_draw", dynlib: lib.} -proc style_get_valist*(widget: PWidget, first_property_name: cstring){. - varargs, cdecl, importc: "gtk_widget_style_get_valist", dynlib: lib.} -proc style_get*(widget: PWidget, first_property_name: cstring){.varargs, - cdecl, importc: "gtk_widget_style_get", dynlib: lib.} -proc file_chooser_dialog_new*(title: cstring, parent: PWindow, - action: TFileChooserAction, - first_button_text: cstring): PFileChooser{.cdecl, - varargs, dynlib: lib, importc: "gtk_file_chooser_dialog_new".} - -proc file_chooser_dialog_new_with_backend*(title: cstring, parent: PWindow, - action: TFileChooserAction, backend: cstring, first_button_text: cstring): PFileChooser{. - varargs, cdecl, dynlib: lib, - importc: "gtk_file_chooser_dialog_new_with_backend".} -proc reference*(anObject: PObject): PObject{.cdecl, importc: "gtk_object_ref", - dynlib: lib.} -proc unref*(anObject: PObject){.cdecl, importc: "gtk_object_unref", - dynlib: lib.} -proc weakref*(anObject: PObject, notify: TDestroyNotify, data: gpointer){. - cdecl, importc: "gtk_object_weakref", dynlib: lib.} -proc weakunref*(anObject: PObject, notify: TDestroyNotify, data: gpointer){. - cdecl, importc: "gtk_object_weakunref", dynlib: lib.} -proc set_data*(anObject: PObject, key: cstring, data: gpointer){.cdecl, - importc: "gtk_object_set_data", dynlib: lib.} -proc set_data_full*(anObject: PObject, key: cstring, data: gpointer, - destroy: TDestroyNotify){. - importc: "gtk_object_set_data_full", cdecl, dynlib: lib.} -proc remove_data*(anObject: PObject, key: cstring){.cdecl, - importc: "gtk_object_remove_data", dynlib: lib.} -proc get_data*(anObject: PObject, key: cstring): gpointer{.cdecl, - importc: "gtk_object_get_data", dynlib: lib.} -proc remove_no_notify*(anObject: PObject, key: cstring){.cdecl, - importc: "gtk_object_remove_no_notify", dynlib: lib.} -proc set_user_data*(anObject: PObject, data: gpointer){.cdecl, - importc: "gtk_object_set_user_data", dynlib: lib.} -proc get_user_data*(anObject: PObject): gpointer{.cdecl, - importc: "gtk_object_get_user_data", dynlib: lib.} -proc set_data_by_id*(anObject: PObject, data_id: TGQuark, data: gpointer){. - cdecl, importc: "gtk_object_set_data_by_id", dynlib: lib.} -proc set_data_by_id_full*(anObject: PObject, data_id: TGQuark, - data: gpointer, destroy: TDestroyNotify){. - cdecl, importc: "gtk_object_set_data_by_id_full", dynlib: lib.} -proc get_data_by_id*(anObject: PObject, data_id: TGQuark): gpointer{. - cdecl, importc: "gtk_object_get_data_by_id", dynlib: lib.} -proc remove_data_by_id*(anObject: PObject, data_id: TGQuark){.cdecl, - importc: "gtk_object_remove_data_by_id", dynlib: lib.} -proc remove_no_notify_by_id*(anObject: PObject, key_id: TGQuark){.cdecl, - importc: "gtk_object_remove_no_notify_by_id", dynlib: lib.} -proc object_data_try_key*(str: cstring): TGQuark{.cdecl, - importc: "gtk_object_data_try_key", dynlib: lib.} -proc object_data_force_id*(str: cstring): TGQuark{.cdecl, - importc: "gtk_object_data_force_id", dynlib: lib.} -proc get*(anObject: PObject, first_property_name: cstring){.cdecl, - importc: "gtk_object_get", varargs, dynlib: lib.} -proc set*(anObject: PObject, first_property_name: cstring){.cdecl, - importc: "gtk_object_set", varargs, dynlib: lib.} -proc object_add_arg_type*(arg_name: cstring, arg_type: TType, arg_flags: guint, - arg_id: guint){.cdecl, - importc: "gtk_object_add_arg_type", dynlib: lib.} - -type - TFileFilter {.pure, final.} = object - PFileFilter* = ptr TFileFilter - PPGtkFileFilter* = ptr PFileFilter - PFileFilterFlags* = ptr TFileFilterFlags - TFileFilterFlags* = enum - FILE_FILTER_FILENAME = 1 shl 0, FILE_FILTER_URI = 1 shl 1, - FILE_FILTER_DISPLAY_NAME = 1 shl 2, FILE_FILTER_MIME_TYPE = 1 shl 3 - PFileFilterInfo* = ptr TFileFilterInfo - TFileFilterInfo*{.final, pure.} = object - contains*: TFileFilterFlags - filename*: cstring - uri*: cstring - display_name*: cstring - mime_type*: cstring - - TFileFilterFunc* = proc (filter_info: PFileFilterInfo, data: gpointer): gboolean{. - cdecl.} - -proc TYPE_FILE_FILTER*(): GType -proc FILE_FILTER*(obj: pointer): PFileFilter -proc IS_FILE_FILTER*(obj: pointer): gboolean -proc file_filter_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_file_filter_get_type".} -proc file_filter_new*(): PFileFilter{.cdecl, dynlib: lib, - importc: "gtk_file_filter_new".} -proc set_name*(filter: PFileFilter, name: cstring){.cdecl, - dynlib: lib, importc: "gtk_file_filter_set_name".} -proc get_name*(filter: PFileFilter): cstring{.cdecl, dynlib: lib, - importc: "gtk_file_filter_get_name".} -proc add_mime_type*(filter: PFileFilter, mime_type: cstring){.cdecl, - dynlib: lib, importc: "gtk_file_filter_add_mime_type".} -proc add_pattern*(filter: PFileFilter, pattern: cstring){.cdecl, - dynlib: lib, importc: "gtk_file_filter_add_pattern".} -proc add_custom*(filter: PFileFilter, needed: TFileFilterFlags, - func: TFileFilterFunc, data: gpointer, - notify: TGDestroyNotify){.cdecl, dynlib: lib, - importc: "gtk_file_filter_add_custom".} -proc get_needed*(filter: PFileFilter): TFileFilterFlags{.cdecl, - dynlib: lib, importc: "gtk_file_filter_get_needed".} -proc filter*(filter: PFileFilter, filter_info: PFileFilterInfo): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_filter_filter".} -proc TYPE_FILE_FILTER(): GType = - result = file_filter_get_type() - -proc FILE_FILTER(obj: pointer): PFileFilter = - result = cast[PFileFilter](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_FILE_FILTER())) - -proc IS_FILE_FILTER(obj: pointer): gboolean = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_FILE_FILTER()) - -proc file_chooser_get_type*(): GType{.cdecl, dynlib: lib, - importc: "gtk_file_chooser_get_type".} -proc file_chooser_error_quark*(): TGQuark{.cdecl, dynlib: lib, - importc: "gtk_file_chooser_error_quark".} -proc TYPE_FILE_CHOOSER*(): GType = - result = file_chooser_get_type() - -proc FILE_CHOOSER*(obj: pointer): PFileChooser = - result = cast[PFileChooser](G_TYPE_CHECK_INSTANCE_CAST(obj, - TYPE_FILE_CHOOSER())) - -proc IS_FILE_CHOOSER*(obj: pointer): gboolean = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_FILE_CHOOSER()) - -proc set_action*(chooser: PFileChooser, action: TFileChooserAction){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_action".} -proc get_action*(chooser: PFileChooser): TFileChooserAction{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_action".} -proc set_local_only*(chooser: PFileChooser, local_only: gboolean){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_local_only".} -proc get_local_only*(chooser: PFileChooser): gboolean{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_local_only".} -proc set_select_multiple*(chooser: PFileChooser, - select_multiple: gboolean){.cdecl, - dynlib: lib, importc: "gtk_file_chooser_set_select_multiple".} -proc get_select_multiple*(chooser: PFileChooser): gboolean{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_select_multiple".} -proc set_current_name*(chooser: PFileChooser, name: cstring){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_current_name".} -proc get_filename*(chooser: PFileChooser): cstring{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_filename".} -proc set_filename*(chooser: PFileChooser, filename: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_filename".} -proc select_filename*(chooser: PFileChooser, filename: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_select_filename".} -proc unselect_filename*(chooser: PFileChooser, filename: cstring){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_unselect_filename".} -proc select_all*(chooser: PFileChooser){.cdecl, dynlib: lib, - importc: "gtk_file_chooser_select_all".} -proc unselect_all*(chooser: PFileChooser){.cdecl, dynlib: lib, - importc: "gtk_file_chooser_unselect_all".} -proc get_filenames*(chooser: PFileChooser): PGSList{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_filenames".} -proc set_current_folder*(chooser: PFileChooser, filename: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_current_folder".} -proc get_current_folder*(chooser: PFileChooser): cstring{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_current_folder".} -proc get_uri*(chooser: PFileChooser): cstring{.cdecl, dynlib: lib, - importc: "gtk_file_chooser_get_uri".} -proc set_uri*(chooser: PFileChooser, uri: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_uri".} -proc select_uri*(chooser: PFileChooser, uri: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_select_uri".} -proc unselect_uri*(chooser: PFileChooser, uri: cstring){.cdecl, - dynlib: lib, importc: "gtk_file_chooser_unselect_uri".} -proc get_uris*(chooser: PFileChooser): PGSList{.cdecl, dynlib: lib, - importc: "gtk_file_chooser_get_uris".} -proc set_current_folder_uri*(chooser: PFileChooser, uri: cstring): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_current_folder_uri".} -proc get_current_folder_uri*(chooser: PFileChooser): cstring{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_get_current_folder_uri".} -proc set_preview_widget*(chooser: PFileChooser, - preview_widget: PWidget){.cdecl, - dynlib: lib, importc: "gtk_file_chooser_set_preview_widget".} -proc get_preview_widget*(chooser: PFileChooser): PWidget{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_preview_widget".} -proc set_preview_widget_active*(chooser: PFileChooser, - active: gboolean){.cdecl, dynlib: lib, - importc: "gtk_file_chooser_set_preview_widget_active".} -proc get_preview_widget_active*(chooser: PFileChooser): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_get_preview_widget_active".} -proc set_use_preview_label*(chooser: PFileChooser, - use_label: gboolean){.cdecl, dynlib: lib, - importc: "gtk_file_chooser_set_use_preview_label".} -proc get_use_preview_label*(chooser: PFileChooser): gboolean{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_get_use_preview_label".} -proc get_preview_filename*(chooser: PFileChooser): cstring{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_preview_filename".} -proc get_preview_uri*(chooser: PFileChooser): cstring{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_preview_uri".} -proc set_extra_widget*(chooser: PFileChooser, extra_widget: PWidget){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_extra_widget".} -proc get_extra_widget*(chooser: PFileChooser): PWidget{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_extra_widget".} -proc add_filter*(chooser: PFileChooser, filter: PFileFilter){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_add_filter".} -proc remove_filter*(chooser: PFileChooser, filter: PFileFilter){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_remove_filter".} -proc list_filters*(chooser: PFileChooser): PGSList{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_list_filters".} -proc set_filter*(chooser: PFileChooser, filter: PFileFilter){. - cdecl, dynlib: lib, importc: "gtk_file_chooser_set_filter".} -proc get_filter*(chooser: PFileChooser): PFileFilter{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_get_filter".} -proc add_shortcut_folder*(chooser: PFileChooser, folder: cstring, - error: pointer): gboolean{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_add_shortcut_folder".} -proc remove_shortcut_folder*(chooser: PFileChooser, - folder: cstring, error: pointer): gboolean{.cdecl, dynlib: lib, - importc: "gtk_file_chooser_remove_shortcut_folder".} -proc list_shortcut_folders*(chooser: PFileChooser): PGSList{.cdecl, - dynlib: lib, importc: "gtk_file_chooser_list_shortcut_folders".} -proc add_shortcut_folder_uri*(chooser: PFileChooser, uri: cstring, - error: pointer): gboolean{.cdecl, dynlib: lib, importc: "gtk_file_chooser_add_shortcut_folder_uri".} -proc remove_shortcut_folder_uri*(chooser: PFileChooser, - uri: cstring, error: pointer): gboolean{.cdecl, dynlib: lib, - importc: "gtk_file_chooser_remove_shortcut_folder_uri".} -proc list_shortcut_folder_uris*(chooser: PFileChooser): PGSList{. - cdecl, dynlib: lib, importc: "gtk_file_chooser_list_shortcut_folder_uris".} -proc set_do_overwrite_confirmation*(chooser: PFileChooser, - do_overwrite_confirmation: gboolean){.cdecl, dynlib: lib, - importc: "gtk_file_chooser_set_do_overwrite_confirmation".} - -proc get_realized*(w: PWidget): gboolean {.cdecl, dynlib: lib, - importc: "gtk_widget_get_realized".} - -proc set_skip_taskbar_hint*(window: PWindow, setting: gboolean){.cdecl, - dynlib: lib, importc: "gtk_window_set_skip_taskbar_hint".} - -type - TTooltip* {.pure, final.} = object - PTooltip* = ptr TTooltip - -proc set_tooltip_text*(w: PWidget, t: cstring){.cdecl, - dynlib: lib, importc: "gtk_widget_set_tooltip_text".} - -proc get_tooltip_text*(w: PWidget): cstring{.cdecl, - dynlib: lib, importc: "gtk_widget_get_tooltip_text".} - -proc set_tooltip_markup*(w: PWidget, m: cstring) {.cdecl, dynlib: lib, - importc: "gtk_widget_set_tooltip_markup".} - -proc get_tooltip_markup*(w: PWidget): cstring {.cdecl, dynlib: lib, - importc: "gtk_widget_get_tooltip_markup".} - -proc set_tooltip_column*(w: PTreeview, column: gint){.cdecl, - dynlib: lib, importc: "gtk_tree_view_set_tooltip_column".} - -proc trigger_tooltip_query*(widg: PWidget){.cdecl, dynlib: lib, - importc: "gtk_widget_trigger_tooltip_query".} - -proc trigger_tooltip_query*(widg: PTooltip){.cdecl, dynlib: lib, - importc: "gtk_tooltip_trigger_tooltip_query".} - -proc set_has_tooltip*(widget: PWidget, b: gboolean){.cdecl, dynlib: lib, - importc: "gtk_widget_set_has_tooltip".} - -proc get_has_tooltip*(widget: PWidget): gboolean{.cdecl, dynlib: lib, - importc: "gtk_widget_get_has_tooltip".} - -proc set_markup*(tp: PTooltip, mk: cstring){.cdecl, dynlib: lib, - importc: "gtk_tooltip_set_markup".} - -proc set_visible_window*(evBox: PEventBox, v: gboolean){.cdecl, dynlib: lib, - importc: "gtk_event_box_set_visible_window".} - -proc get_vadjustment*(scrolled_window: PTextView): PAdjustment{. - cdecl, dynlib: lib, importc: "gtk_text_view_get_vadjustment".} - -type - TInfoBar* = object of THBox - PInfoBar* = ptr TInfoBar - -proc info_bar_new*(): PInfoBar{.cdecl, dynlib: lib, importc: "gtk_info_bar_new".} -proc info_bar_new_with_buttons*(first_button_text: cstring): PInfoBar {.cdecl, dynlib:lib, - varargs, importc: "gtk_info_bar_new_with_buttons".} -proc add_action_widget*(infobar: PInfoBar, child: PWidget, respID: gint) {. - cdecl, dynlib: lib, importc: "gtk_info_bar_add_action_widget".} -proc add_button*(infobar: PInfoBar, btnText: cstring, respID: gint): PWidget{. - cdecl, dynlib: lib, importc: "gtk_info_bar_add_button".} -proc set_response_sensitive*(infobar: PInfoBar, respID: gint, setting: gboolean){. - cdecl, dynlib: lib, importc: "gtk_info_bar_set_response_sensitive".} -proc set_default_response*(infobar: PInfoBar, respID: gint){.cdecl, - dynlib: lib, importc: "gtk_info_bar_set_default_response".} -proc response*(infobar: PInfoBar, respID: gint){.cdecl, dynlib: lib, - importc: "gtk_info_bar_response".} -proc set_message_type*(infobar: PInfoBar, messageType: TMessageType){.cdecl, - dynlib: lib, importc: "gtk_info_bar_set_message_type".} -proc get_message_type*(infobar: PInfoBar): TMessageType{.cdecl, dynlib: lib, - importc: "gtk_info_bar_get_message_type".} -proc get_action_area*(infobar: PInfoBar): PWidget{.cdecl, dynlib: lib, - importc: "gtk_info_bar_get_action_area".} -proc get_content_area*(infobar: PInfoBar): PContainer{.cdecl, dynlib: lib, - importc: "gtk_info_bar_get_content_area".} - -type - TComboBox* = object of TWidget - PComboBox* = ptr TComboBox - -proc comboBoxNew*(): PComboBox{.cdecl, importc: "gtk_combo_box_new", dynlib: lib.} -proc comboBox_new_with_entry*(): PComboBox{.cdecl, - importc: "gtk_combo_box_new_with_entry", - dynlib: lib.} -proc comboBox_new_with_model*(model: PTreeModel): PComboBox{.cdecl, - importc: "gtk_combo_box_new_with_model", dynlib: lib.} -proc comboBox_new_with_model_and_entry*(model: PTreeModel): PComboBox{.cdecl, - importc: "gtk_combo_box_new_with_model_and_entry", dynlib: lib.} - -proc get_wrap_width*(combo_box: PComboBox): gint{.cdecl, - importc: "gtk_combo_box_get_wrap_width", dynlib: lib.} -proc set_wrap_width*(combo_box: PComboBox; width: gint){.cdecl, - importc: "gtk_combo_box_set_wrap_width", dynlib: lib.} -proc get_row_span_column*(combo_box: PComboBox): gint{.cdecl, - importc: "gtk_combo_box_get_row_span_column", dynlib: lib.} -proc set_row_span_column*(combo_box: PComboBox; row_span: gint){.cdecl, - importc: "gtk_combo_box_set_row_span_column", dynlib: lib.} -proc get_column_span_column*(combo_box: PComboBox): gint{.cdecl, - importc: "gtk_combo_box_get_column_span_column", dynlib: lib.} -proc set_column_span_column*(combo_box: PComboBox; column_span: gint){. - cdecl, importc: "gtk_combo_box_set_column_span_column", dynlib: lib.} -proc get_add_tearoffs*(combo_box: PComboBox): gboolean{.cdecl, - importc: "gtk_combo_box_get_add_tearoffs", dynlib: lib.} -proc set_add_tearoffs*(combo_box: PComboBox; add_tearoffs: gboolean){. - cdecl, importc: "gtk_combo_box_set_add_tearoffs", dynlib: lib.} -proc get_title*(combo_box: PComboBox): ptr gchar{.cdecl, - importc: "gtk_combo_box_get_title", dynlib: lib.} -proc set_title*(combo_box: PComboBox; title: ptr gchar){.cdecl, - importc: "gtk_combo_box_set_title", dynlib: lib.} -proc get_focus_on_click*(combo: PComboBox): gboolean{.cdecl, - importc: "gtk_combo_box_get_focus_on_click", dynlib: lib.} -proc set_focus_on_click*(combo: PComboBox; focus_on_click: gboolean){. - cdecl, importc: "gtk_combo_box_set_focus_on_click", dynlib: lib.} - -proc get_active*(combo_box: PComboBox): gint{.cdecl, - importc: "gtk_combo_box_get_active", dynlib: lib.} -proc set_active*(combo_box: PComboBox; index: gint){.cdecl, - importc: "gtk_combo_box_set_active", dynlib: lib.} -proc get_active_iter*(combo_box: PComboBox; iter: PTreeIter): gboolean{. - cdecl, importc: "gtk_combo_box_get_active_iter", dynlib: lib.} -proc set_active_iter*(combo_box: PComboBox; iter: PTreeIter){.cdecl, - importc: "gtk_combo_box_set_active_iter", dynlib: lib.} - -proc set_model*(combo_box: PComboBox; model: PTreeModel){.cdecl, - importc: "gtk_combo_box_set_model", dynlib: lib.} -proc get_model*(combo_box: PComboBox): PTreeModel{.cdecl, - importc: "gtk_combo_box_get_model", dynlib: lib.} -discard """proc get_row_separator_func*(combo_box: PComboBox): GtkTreeViewRowSeparatorFunc{. - cdecl, importc: "gtk_combo_box_get_row_separator_func", dynlib: lib.} -proc set_row_separator_func*(combo_box: PComboBox; - func: GtkTreeViewRowSeparatorFunc; data: gpointer; - destroy: GDestroyNotify){.cdecl, - importc: "gtk_combo_box_set_row_separator_func", dynlib: lib.}""" -discard """proc set_button_sensitivity*(combo_box: PComboBox; - sensitivity: GtkSensitivityType){.cdecl, - importc: "gtk_combo_box_set_button_sensitivity", dynlib: lib.} -proc get_button_sensitivity*(combo_box: PComboBox): GtkSensitivityType{. - cdecl, importc: "gtk_combo_box_get_button_sensitivity", dynlib: lib.}""" -proc get_has_entry*(combo_box: PComboBox): gboolean{.cdecl, - importc: "gtk_combo_box_get_has_entry", dynlib: lib.} -proc set_entry_text_column*(combo_box: PComboBox; text_column: gint){. - cdecl, importc: "gtk_combo_box_set_entry_text_column", dynlib: lib.} -proc get_entry_text_column*(combo_box: PComboBox): gint{.cdecl, - importc: "gtk_combo_box_get_entry_text_column", dynlib: lib.} - -proc popup*(combo_box: PComboBox){.cdecl, importc: "gtk_combo_box_popup", - dynlib: lib.} -proc popdown*(combo_box: PComboBox){.cdecl, - importc: "gtk_combo_box_popdown", dynlib: lib.} -discard """proc get_popup_accessible*(combo_box: PComboBox): ptr AtkObject{.cdecl, - importc: "gtk_combo_box_get_popup_accessible", dynlib: lib.}""" - -type - TComboBoxText* = object of TComboBox - PComboBoxText* = ptr TComboBoxText - -proc combo_box_text_new*(): PComboBoxText{.cdecl, importc: "gtk_combo_box_text_new", - dynlib: lib.} -proc combo_box_text_new_with_entry*(): PComboBoxText{.cdecl, - importc: "gtk_combo_box_text_new_with_entry", dynlib: lib.} -proc append_text*(combo_box: PComboBoxText; text: cstring){.cdecl, - importc: "gtk_combo_box_text_append_text", dynlib: lib.} -proc insert_text*(combo_box: PComboBoxText; position: gint; - text: cstring){.cdecl, - importc: "gtk_combo_box_text_insert_text", dynlib: lib.} -proc prepend_text*(combo_box: PComboBoxText; text: cstring){.cdecl, - importc: "gtk_combo_box_text_prepend_text", dynlib: lib.} -proc remove*(combo_box: PComboBoxText; position: gint){.cdecl, - importc: "gtk_combo_box_text_remove", dynlib: lib.} -proc get_active_text*(combo_box: PComboBoxText): cstring{.cdecl, - importc: "gtk_combo_box_text_get_active_text", dynlib: lib.} -proc is_active*(win: PWindow): gboolean{.cdecl, - importc: "gtk_window_is_active", dynlib: lib.} -proc has_toplevel_focus*(win: PWindow): gboolean{.cdecl, - importc: "gtk_window_has_toplevel_focus", dynlib: lib.} - -proc nimrod_init*() = - var - cmdLine{.importc: "cmdLine".}: array[0..255, cstring] - cmdCount{.importc: "cmdCount".}: cint - init(addr(cmdLine), addr(cmdCount)) diff --git a/lib/wrappers/gtk/gtkglext.nim b/lib/wrappers/gtk/gtkglext.nim deleted file mode 100644 index b3f5647bd..000000000 --- a/lib/wrappers/gtk/gtkglext.nim +++ /dev/null @@ -1,53 +0,0 @@ -{.deadCodeElim: on.} -import - Glib2, Gdk2, gtk2, GdkGLExt - -when defined(windows): - const - GLExtLib* = "libgtkglext-win32-1.0-0.dll" -elif defined(macosx): - const - GLExtLib* = "libgtkglext-x11-1.0.dylib" -else: - const - GLExtLib* = "libgtkglext-x11-1.0.so" - -const - HEADER_GTKGLEXT_MAJOR_VERSION* = 1 - HEADER_GTKGLEXT_MINOR_VERSION* = 0 - HEADER_GTKGLEXT_MICRO_VERSION* = 6 - HEADER_GTKGLEXT_INTERFACE_AGE* = 4 - HEADER_GTKGLEXT_BINARY_AGE* = 6 - -proc gl_parse_args*(argc: ptr int32, argv: PPPChar): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gtk_gl_parse_args".} -proc gl_init_check*(argc: ptr int32, argv: PPPChar): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gtk_gl_init_check".} -proc gl_init*(argc: ptr int32, argv: PPPChar){.cdecl, dynlib: GLExtLib, - importc: "gtk_gl_init".} -proc set_gl_capability*(widget: PWidget, glconfig: PGLConfig, - share_list: PGLContext, direct: gboolean, - render_type: int): gboolean{.cdecl, - dynlib: GLExtLib, importc: "gtk_widget_set_gl_capability".} -proc is_gl_capable*(widget: PWidget): gboolean{.cdecl, dynlib: GLExtLib, - importc: "gtk_widget_is_gl_capable".} -proc get_gl_config*(widget: PWidget): PGLConfig{.cdecl, - dynlib: GLExtLib, importc: "gtk_widget_get_gl_config".} -proc create_gl_context*(widget: PWidget, share_list: PGLContext, - direct: gboolean, render_type: int): PGLContext{. - cdecl, dynlib: GLExtLib, importc: "gtk_widget_create_gl_context".} -proc get_gl_context*(widget: PWidget): PGLContext{.cdecl, - dynlib: GLExtLib, importc: "gtk_widget_get_gl_context".} -proc get_gl_window*(widget: PWidget): PGLWindow{.cdecl, - dynlib: GLExtLib, importc: "gtk_widget_get_gl_window".} - -proc HEADER_GTKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool = - result = (HEADER_GTKGLEXT_MAJOR_VERSION > major) or - ((HEADER_GTKGLEXT_MAJOR_VERSION == major) and - (HEADER_GTKGLEXT_MINOR_VERSION > minor)) or - ((HEADER_GTKGLEXT_MAJOR_VERSION == major) and - (HEADER_GTKGLEXT_MINOR_VERSION == minor) and - (HEADER_GTKGLEXT_MICRO_VERSION >= micro)) - -proc get_gl_drawable*(widget: PWidget): PGLDrawable = - result = GL_DRAWABLE(get_gl_window(widget)) diff --git a/lib/wrappers/gtk/gtkhtml.nim b/lib/wrappers/gtk/gtkhtml.nim deleted file mode 100644 index 92496c03b..000000000 --- a/lib/wrappers/gtk/gtkhtml.nim +++ /dev/null @@ -1,523 +0,0 @@ -{.deadCodeElim: on.} -import - gtk2, glib2, atk, pango, gdk2pixbuf, gdk2 - -when defined(windows): - const - htmllib = "libgtkhtml-win32-2.0-0.dll" -elif defined(macosx): - const - htmllib = "libgtkhtml-2.dylib" -else: - const - htmllib = "libgtkhtml-2.so" -const - DOM_UNSPECIFIED_EVENT_TYPE_ERR* = 0 - DOM_INDEX_SIZE_ERR* = 1 - DOM_DOMSTRING_SIZE_ERR* = 2 - DOM_HIERARCHY_REQUEST_ERR* = 3 - DOM_WRONG_DOCUMENT_ERR* = 4 - DOM_INVALID_CHARACTER_ERR* = 5 - DOM_NO_DATA_ALLOWED_ERR* = 6 - DOM_NO_MODIFICATION_ALLOWED_ERR* = 7 - DOM_NOT_FOUND_ERR* = 8 - DOM_NOT_SUPPORTED_ERR* = 9 - DOM_INUSE_ATTRIBUTE_ERR* = 10 - DOM_INVALID_STATE_ERR* = 11 - DOM_SYNTAX_ERR* = 12 - DOM_INVALID_MODIFICATION_ERR* = 13 - DOM_NAMESPACE_ERR* = 14 - DOM_INVALID_ACCESS_ERR* = 15 - DOM_NO_EXCEPTION* = 255 - DOM_ELEMENT_NODE* = 1 - DOM_ATTRIBUTE_NODE* = 2 - DOM_TEXT_NODE* = 3 - DOM_CDATA_SECTION_NODE* = 4 - DOM_ENTITY_REFERENCE_NODE* = 5 - DOM_ENTITY_NODE* = 6 - DOM_PROCESSING_INSTRUCTION_NODE* = 7 - DOM_COMMENT_NODE* = 8 - DOM_DOCUMENT_NODE* = 9 - DOM_DOCUMENT_TYPE_NODE* = 10 - DOM_DOCUMENT_FRAGMENT_NODE* = 11 - DOM_NOTATION_NODE* = 12 - bm_HtmlFontSpecification_weight* = 0x0000000F - bp_HtmlFontSpecification_weight* = 0 - bm_HtmlFontSpecification_style* = 0x00000030 - bp_HtmlFontSpecification_style* = 4 - bm_HtmlFontSpecification_variant* = 0x000000C0 - bp_HtmlFontSpecification_variant* = 6 - bm_HtmlFontSpecification_stretch* = 0x00000F00 - bp_HtmlFontSpecification_stretch* = 8 - bm_HtmlFontSpecification_decoration* = 0x00007000 - bp_HtmlFontSpecification_decoration* = 12 - -type - TDomString* = gchar - PDomString* = cstring - TDomBoolean* = gboolean - TDomException* = gushort - TDomTimeStamp* = guint64 - PDomNode* = ptr TDomNode - TDomNode* = object of TGObject - xmlnode*: pointer - style*: pointer - - PDomException* = ptr TDomException - - PDomNodeClass* = ptr TDomNodeClass - TDomNodeClass* = object of TGObjectClass - `get_nodeName`*: proc (node: PDomNode): PDomString{.cdecl.} - `get_nodeValue`*: proc (node: PDomNode, exc: PDomException): PDomString{. - cdecl.} - `set_nodeValue`*: proc (node: PDomNode, value: PDomString, - exc: PDomException): PDomString{.cdecl.} - - PDomDocument* = ptr TDomDocument - TDomDocument*{.final, pure.} = object - parent*: PDomNode - iterators*: PGSList - - PDomDocumentClass* = ptr TDomDocumentClass - TDomDocumentClass*{.final, pure.} = object - parent_class*: PDomNodeClass - - PHtmlFocusIterator* = ptr THtmlFocusIterator - THtmlFocusIterator* = object of TGObject - document*: PDomDocument - current_node*: PDomNode - - PHtmlFocusIteratorClass* = ptr THtmlFocusIteratorClass - THtmlFocusIteratorClass* = object of TGObjectClass - THtmlParserType* = enum - HTML_PARSER_TYPE_HTML, HTML_PARSER_TYPE_XML - PHtmlParser* = ptr THtmlParser - THtmlParser* = object of TGObject - parser_type*: THtmlParserType - document*: PHtmlDocument - stream*: PHtmlStream - xmlctxt*: pointer - res*: int32 - chars*: array[0..9, char] - blocking*: gboolean - blocking_node*: PDomNode - - PHtmlParserClass* = ptr THtmlParserClass - THtmlParserClass* = object of gtk2.TObjectClass - done_parsing*: proc (parser: PHtmlParser){.cdecl.} - new_node*: proc (parser: PHtmlParser, node: PDomNode) - parsed_document_node*: proc (parser: PHtmlParser, document: PDomDocument) - - PHtmlStream* = ptr THtmlStream - THtmlStreamCloseFunc* = proc (stream: PHtmlStream, user_data: gpointer){.cdecl.} - THtmlStreamWriteFunc* = proc (stream: PHtmlStream, buffer: cstring, - size: guint, user_data: gpointer){.cdecl.} - THtmlStreamCancelFunc* = proc (stream: PHtmlStream, user_data: gpointer, - cancel_data: gpointer){.cdecl.} - THtmlStream* = object of TGObject - write_func*: THtmlStreamWriteFunc - close_func*: THtmlStreamCloseFunc - cancel_func*: THtmlStreamCancelFunc - user_data*: gpointer - cancel_data*: gpointer - written*: gint - mime_type*: cstring - - PHtmlStreamClass* = ptr THtmlStreamClass - THtmlStreamClass* = object of TGObjectClass - THtmlStreamBufferCloseFunc* = proc (str: cstring, len: gint, - user_data: gpointer){.cdecl.} - PHtmlContext* = ptr THtmlContext - THtmlContext* = object of TGObject - documents*: PGSList - standard_font*: PHtmlFontSpecification - fixed_font*: PHtmlFontSpecification - debug_painting*: gboolean - - PHtmlFontSpecification* = ptr THtmlFontSpecification - THtmlFontSpecification {.final, pure.} = object - - PHtmlContextClass* = ptr THtmlContextClass - THtmlContextClass* = object of TGObjectClass - THtmlDocumentState* = enum - HTML_DOCUMENT_STATE_DONE, HTML_DOCUMENT_STATE_PARSING - PHtmlDocument* = ptr THtmlDocument - THtmlDocument* = object of TGObject - stylesheets*: PGSList - current_stream*: PHtmlStream - state*: THtmlDocumentState - - PHtmlDocumentClass* = ptr THtmlDocumentClass - THtmlDocumentClass* = object of TGObjectClass - request_url*: proc (document: PHtmlDocument, url: cstring, - stream: PHtmlStream){.cdecl.} - link_clicked*: proc (document: PHtmlDocument, url: cstring){.cdecl.} - set_base*: proc (document: PHtmlDocument, url: cstring){.cdecl.} - title_changed*: proc (document: PHtmlDocument, new_title: cstring){.cdecl.} - submit*: proc (document: PHtmlDocument, `method`: cstring, url: cstring, - encoding: cstring){.cdecl.} - - PHtmlView* = ptr THtmlView - THtmlView* = object of gtk2.TLayout - document*: PHtmlDocument - node_table*: PGHashTable - relayout_idle_id*: guint - relayout_timeout_id*: guint - mouse_down_x*: gint - mouse_down_y*: gint - mouse_detail*: gint - sel_start_ypos*: gint - sel_start_index*: gint - sel_end_ypos*: gint - sel_end_index*: gint - sel_flag*: gboolean - sel_backwards*: gboolean - sel_start_found*: gboolean - sel_list*: PGSList - jump_to_anchor*: cstring - magnification*: gdouble - magnification_modified*: gboolean - on_url*: gboolean - - PHtmlViewClass* = ptr THtmlViewClass - THtmlViewClass* = object of gtk2.TLayoutClass - move_cursor*: proc (html_view: PHtmlView, step: TMovementStep, count: gint, - extend_selection: gboolean){.cdecl.} - on_url*: proc (html_view: PHtmlView, url: cstring) - activate*: proc (html_view: PHtmlView) - move_focus_out*: proc (html_view: PHtmlView, direction: TDirectionType) - - PDomNodeList* = ptr TDomNodeList - TDomNodeList {.pure, final.} = object - - PDomNamedNodeMap* = ptr TDomNamedNodeMap - TDomNamedNodeMap {.pure, final.} = object - - PDomDocumentType* = ptr TDomDocumentType - TDomDocumentType {.pure, final.} = object - - PDomElement* = ptr TDomElement - TDomElement = object of TDomNode - - PDomText* = ptr TDomText - TDomText = object of TDomNode - - PDomComment* = ptr TDomComment - TDomComment = object of TDomNode - - THtmlBox {.pure, final.} = object - PHtmlBox* = ptr THtmlBox - - -proc DOM_TYPE_NODE*(): GType -proc DOM_NODE*(theobject: pointer): PDomNode -proc DOM_NODE_CLASS*(klass: pointer): PDomNodeClass -proc DOM_IS_NODE*(theobject: pointer): bool -proc DOM_IS_NODE_CLASS*(klass: pointer): bool -proc DOM_NODE_GET_CLASS*(obj: pointer): int32 -proc dom_node_get_type*(): GType{.cdecl, dynlib: htmllib, - importc: "dom_node_get_type".} -proc dom_Node_mkref*(node: pointer): PDomNode{.cdecl, dynlib: htmllib, - importc: "dom_Node_mkref".} -proc get_childNodes*(node: PDomNode): PDomNodeList{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_childNodes".} -proc removeChild*(node: PDomNode, oldChild: PDomNode, - exc: PDomException): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node_removeChild".} -proc get_nodeValue*(node: PDomNode, exc: PDomException): PDomString{. - cdecl, dynlib: htmllib, importc: "dom_Node__get_nodeValue".} -proc get_firstChild*(node: PDomNode): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_firstChild".} -proc get_nodeName*(node: PDomNode): PDomString{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_nodeName".} -proc get_attributes*(node: PDomNode): PDomNamedNodeMap{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_attributes".} -proc get_doctype*(doc: PDomDocument): PDomDocumentType{.cdecl, - dynlib: htmllib, importc: "dom_Document__get_doctype".} -proc hasChildNodes*(node: PDomNode): bool{.cdecl, - dynlib: htmllib, importc: "dom_Node_hasChildNodes".} -proc get_parentNode*(node: PDomNode): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_parentNode".} -proc get_nextSibling*(node: PDomNode): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_nextSibling".} -proc get_nodeType*(node: PDomNode): gushort{.cdecl, dynlib: htmllib, - importc: "dom_Node__get_nodeType".} - -proc cloneNode*(node: PDomNode, deep: bool): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node_cloneNode".} -proc appendChild*(node: PDomNode, newChild: PDomNode, - exc: PDomException): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node_appendChild".} -proc get_localName*(node: PDomNode): PDomString{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_localName".} -proc get_namespaceURI*(node: PDomNode): PDomString{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_namespaceURI".} -proc get_previousSibling*(node: PDomNode): PDomNode{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_previousSibling".} -proc get_lastChild*(node: PDomNode): PDomNode{.cdecl, dynlib: htmllib, - importc: "dom_Node__get_lastChild".} -proc set_nodeValue*(node: PDomNode, value: PDomString, - exc: PDomException){.cdecl, dynlib: htmllib, - importc: "dom_Node__set_nodeValue".} -proc get_ownerDocument*(node: PDomNode): PDomDocument{.cdecl, - dynlib: htmllib, importc: "dom_Node__get_ownerDocument".} -proc hasAttributes*(node: PDomNode): gboolean{.cdecl, dynlib: htmllib, - importc: "dom_Node_hasAttributes".} -proc DOM_TYPE_DOCUMENT*(): GType -proc DOM_DOCUMENT*(theobject: pointer): PDomDocument -proc DOM_DOCUMENT_CLASS*(klass: pointer): PDomDocumentClass -proc DOM_IS_DOCUMENT*(theobject: pointer): bool -proc DOM_IS_DOCUMENT_CLASS*(klass: pointer): bool -proc DOM_DOCUMENT_GET_CLASS*(obj: pointer): PDomDocumentClass -proc dom_document_get_type*(): GType -proc get_documentElement*(doc: PDomDocument): PDomElement -proc createElement*(doc: PDomDocument, tagName: PDomString): PDomElement -proc createTextNode*(doc: PDomDocument, data: PDomString): PDomText -proc createComment*(doc: PDomDocument, data: PDomString): PDomComment -proc importNode*(doc: PDomDocument, importedNode: PDomNode, - deep: bool, exc: PDomException): PDomNode -proc HTML_TYPE_FOCUS_ITERATOR*(): GType -proc HTML_FOCUS_ITERATOR*(theobject: pointer): PHtmlFocusIterator -proc HTML_FOCUS_ITERATOR_CLASS*(klass: pointer): PHtmlFocusIteratorClass -proc HTML_IS_FOCUS_ITERATOR*(theobject: pointer): bool -proc HTML_IS_FOCUS_ITERATOR_CLASS*(klass: pointer): bool -proc HTML_FOCUS_ITERATOR_GET_CLASS*(obj: pointer): PHtmlFocusIteratorClass -proc html_focus_iterator_next_element*(document: PDomDocument, - element: PDomElement): PDomElement{. - cdecl, dynlib: htmllib, importc: "html_focus_iterator_next_element".} -proc html_focus_iterator_prev_element*(document: PDomDocument, - element: PDomElement): PDomElement{. - cdecl, dynlib: htmllib, importc: "html_focus_iterator_prev_element".} -proc HTML_PARSER_TYPE*(): GType -proc HTML_PARSER*(obj: pointer): PHtmlParser -proc HTML_PARSER_CLASS*(klass: pointer): PHtmlParserClass -proc HTML_IS_PARSER*(obj: pointer): bool -proc html_parser_get_type*(): GType -proc parser_new*(document: PHtmlDocument, parser_type: THtmlParserType): PHtmlParser -proc HTML_TYPE_STREAM*(): GType -proc HTML_STREAM*(obj: pointer): PHtmlStream -proc HTML_STREAM_CLASS*(klass: pointer): PHtmlStreamClass -proc HTML_IS_STREAM*(obj: pointer): bool -proc HTML_IS_STREAM_CLASS*(klass: pointer): bool -proc HTML_STREAM_GET_CLASS*(obj: pointer): PHtmlStreamClass -proc html_stream_get_type*(): GType{.cdecl, dynlib: htmllib, - importc: "html_stream_get_type".} -proc html_stream_new*(write_func: THtmlStreamWriteFunc, - close_func: THtmlStreamCloseFunc, user_data: gpointer): PHtmlStream{. - cdecl, dynlib: htmllib, importc: "html_stream_new".} -proc write*(stream: PHtmlStream, buffer: cstring, size: guint){. - cdecl, dynlib: htmllib, importc: "html_stream_write".} -proc close*(stream: PHtmlStream){.cdecl, dynlib: htmllib, - importc: "html_stream_close".} -proc destroy*(stream: PHtmlStream){.cdecl, dynlib: htmllib, - importc: "html_stream_destroy".} -proc get_written*(stream: PHtmlStream): gint{.cdecl, - dynlib: htmllib, importc: "html_stream_get_written".} -proc cancel*(stream: PHtmlStream){.cdecl, dynlib: htmllib, - importc: "html_stream_cancel".} -proc set_cancel_func*(stream: PHtmlStream, - abort_func: THtmlStreamCancelFunc, - cancel_data: gpointer){.cdecl, - dynlib: htmllib, importc: "html_stream_set_cancel_func".} -proc get_mime_type*(stream: PHtmlStream): cstring{.cdecl, - dynlib: htmllib, importc: "html_stream_get_mime_type".} -proc set_mime_type*(stream: PHtmlStream, mime_type: cstring){.cdecl, - dynlib: htmllib, importc: "html_stream_set_mime_type".} -proc html_stream_buffer_new*(close_func: THtmlStreamBufferCloseFunc, - user_data: gpointer): PHtmlStream{.cdecl, - dynlib: htmllib, importc: "html_stream_buffer_new".} -proc event_mouse_move*(view: PHtmlView, event: Gdk2.PEventMotion){.cdecl, - dynlib: htmllib, importc: "html_event_mouse_move".} -proc event_button_press*(view: PHtmlView, button: Gdk2.PEventButton){.cdecl, - dynlib: htmllib, importc: "html_event_button_press".} -proc event_button_release*(view: PHtmlView, event: Gdk2.PEventButton){.cdecl, - dynlib: htmllib, importc: "html_event_button_release".} -proc event_activate*(view: PHtmlView){.cdecl, dynlib: htmllib, - importc: "html_event_activate".} -proc event_key_press*(view: PHtmlView, event: Gdk2.PEventKey): gboolean{. - cdecl, dynlib: htmllib, importc: "html_event_key_press".} -proc event_find_root_box*(self: PHtmlBox, x: gint, y: gint): PHtmlBox{. - cdecl, dynlib: htmllib, importc: "html_event_find_root_box".} -proc selection_start*(view: PHtmlView, event: Gdk2.PEventButton){.cdecl, - dynlib: htmllib, importc: "html_selection_start".} -proc selection_end*(view: PHtmlView, event: Gdk2.PEventButton){.cdecl, - dynlib: htmllib, importc: "html_selection_end".} -proc selection_update*(view: PHtmlView, event: Gdk2.PEventMotion){.cdecl, - dynlib: htmllib, importc: "html_selection_update".} -proc selection_clear*(view: PHtmlView){.cdecl, dynlib: htmllib, - importc: "html_selection_clear".} -proc selection_set*(view: PHtmlView, start: PDomNode, offset: int32, - len: int32){.cdecl, dynlib: htmllib, - importc: "html_selection_set".} -proc HTML_CONTEXT_TYPE*(): GType -proc HTML_CONTEXT*(obj: pointer): PHtmlContext -proc HTML_CONTEXT_CLASS*(klass: pointer): PHtmlContextClass -proc HTML_IS_CONTEXT*(obj: pointer): bool -proc HTML_IS_CONTEXT_CLASS*(klass: pointer): bool -proc html_context_get_type*(): GType -proc html_context_get*(): PHtmlContext -proc HTML_TYPE_DOCUMENT*(): GType -proc HTML_DOCUMENT*(obj: pointer): PHtmlDocument -proc HTML_DOCUMENT_CLASS*(klass: pointer): PHtmlDocumentClass -proc HTML_IS_DOCUMENT*(obj: pointer): bool -proc html_document_get_type*(): GType{.cdecl, dynlib: htmllib, - importc: "html_document_get_type".} -proc html_document_new*(): PHtmlDocument{.cdecl, dynlib: htmllib, - importc: "html_document_new".} -proc open_stream*(document: PHtmlDocument, mime_type: cstring): gboolean{. - cdecl, dynlib: htmllib, importc: "html_document_open_stream".} -proc write_stream*(document: PHtmlDocument, buffer: cstring, - len: gint){.cdecl, dynlib: htmllib, - importc: "html_document_write_stream".} -proc close_stream*(document: PHtmlDocument){.cdecl, - dynlib: htmllib, importc: "html_document_close_stream".} -proc clear*(document: PHtmlDocument){.cdecl, dynlib: htmllib, - importc: "html_document_clear".} -proc HTML_TYPE_VIEW*(): GType -proc HTML_VIEW*(obj: pointer): PHtmlView -proc HTML_VIEW_CLASS*(klass: pointer): PHtmlViewClass -proc HTML_IS_VIEW*(obj: pointer): bool -proc html_view_get_type*(): GType{.cdecl, dynlib: htmllib, - importc: "html_view_get_type".} -proc html_view_new*(): PWidget{.cdecl, dynlib: htmllib, importc: "html_view_new".} -proc set_document*(view: PHtmlView, document: PHtmlDocument){.cdecl, - dynlib: htmllib, importc: "html_view_set_document".} -proc jump_to_anchor*(view: PHtmlView, anchor: cstring){.cdecl, - dynlib: htmllib, importc: "html_view_jump_to_anchor".} -proc get_magnification*(view: PHtmlView): gdouble{.cdecl, - dynlib: htmllib, importc: "html_view_get_magnification".} -proc set_magnification*(view: PHtmlView, magnification: gdouble){. - cdecl, dynlib: htmllib, importc: "html_view_set_magnification".} -proc zoom_in*(view: PHtmlView){.cdecl, dynlib: htmllib, - importc: "html_view_zoom_in".} -proc zoom_out*(view: PHtmlView){.cdecl, dynlib: htmllib, - importc: "html_view_zoom_out".} -proc zoom_reset*(view: PHtmlView){.cdecl, dynlib: htmllib, - importc: "html_view_zoom_reset".} - -proc DOM_TYPE_NODE*(): GType = - result = dom_node_get_type() - -proc DOM_NODE*(theobject: pointer): PDomNode = - result = G_TYPE_CHECK_INSTANCE_CAST(theobject, DOM_TYPE_NODE()) - -proc DOM_NODE_CLASS*(klass: pointer): PDomNodeClass = - result = G_TYPE_CHECK_CLASS_CAST(klass, DOM_TYPE_NODE(), TDomNodeClass) - -proc DOM_IS_NODE*(theobject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, DOM_TYPE_NODE()) - -proc DOM_IS_NODE_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, DOM_TYPE_NODE()) - -proc DOM_NODE_GET_CLASS*(obj: pointer): PDomNodeClass = - result = G_TYPE_INSTANCE_GET_CLASS(obj, DOM_TYPE_NODE(), TDomNodeClass) - -proc DOM_TYPE_DOCUMENT*(): GType = - result = dom_document_get_type() - -proc DOM_DOCUMENT*(theobject: pointer): PDomDocument = - result = G_TYPE_CHECK_INSTANCE_CAST(theobject, DOM_TYPE_DOCUMENT(), - TDomDocument) - -proc DOM_DOCUMENT_CLASS*(klass: pointer): PDomDocumentClass = - result = G_TYPE_CHECK_CLASS_CAST(klass, DOM_TYPE_DOCUMENT(), TDomDocumentClass) - -proc DOM_IS_DOCUMENT*(theobject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, DOM_TYPE_DOCUMENT()) - -proc DOM_IS_DOCUMENT_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, DOM_TYPE_DOCUMENT()) - -proc DOM_DOCUMENT_GET_CLASS*(obj: pointer): PDomDocumentClass = - result = G_TYPE_INSTANCE_GET_CLASS(obj, DOM_TYPE_DOCUMENT(), TDomDocumentClass) - -proc HTML_TYPE_FOCUS_ITERATOR*(): GType = - result = html_focus_iterator_get_type() - -proc HTML_FOCUS_ITERATOR*(theobject: pointer): PHtmlFocusIterator = - result = G_TYPE_CHECK_INSTANCE_CAST(theobject, HTML_TYPE_FOCUS_ITERATOR(), - HtmlFocusIterator) - -proc HTML_FOCUS_ITERATOR_CLASS*(klass: pointer): PHtmlFocusIteratorClass = - result = G_TYPE_CHECK_CLASS_CAST(klass, HTML_TYPE_FOCUS_ITERATOR(), - HtmlFocusIteratorClass) - -proc HTML_IS_FOCUS_ITERATOR*(theobject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, HTML_TYPE_FOCUS_ITERATOR()) - -proc HTML_IS_FOCUS_ITERATOR_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, HTML_TYPE_FOCUS_ITERATOR()) - -proc HTML_FOCUS_ITERATOR_GET_CLASS*(obj: pointer): PHtmlFocusIteratorClass = - result = G_TYPE_INSTANCE_GET_CLASS(obj, HTML_TYPE_FOCUS_ITERATOR(), - HtmlFocusIteratorClass) - -proc HTML_PARSER_TYPE*(): GType = - result = html_parser_get_type() - -proc HTML_PARSER*(obj: pointer): PHtmlParser = - result = CHECK_CAST(obj, HTML_PARSER_TYPE(), THtmlParser) - -proc HTML_PARSER_CLASS*(klass: pointer): PHtmlParserClass = - result = CHECK_CLASS_CAST(klass, HTML_PARSER_TYPE(), THtmlParserClass) - -proc HTML_IS_PARSER*(obj: pointer): bool = - result = CHECK_TYPE(obj, HTML_PARSER_TYPE()) - -proc HTML_TYPE_STREAM*(): GType = - result = html_stream_get_type() - -proc HTML_STREAM*(obj: pointer): PHtmlStream = - result = PHtmlStream(G_TYPE_CHECK_INSTANCE_CAST(obj, HTML_TYPE_STREAM())) - -proc HTML_STREAM_CLASS*(klass: pointer): PHtmlStreamClass = - result = G_TYPE_CHECK_CLASS_CAST(klass, HTML_TYPE_STREAM()) - -proc HTML_IS_STREAM*(obj: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, HTML_TYPE_STREAM()) - -proc HTML_IS_STREAM_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, HTML_TYPE_STREAM()) - -proc HTML_STREAM_GET_CLASS*(obj: pointer): PHtmlStreamClass = - result = PHtmlStreamClass(G_TYPE_INSTANCE_GET_CLASS(obj, HTML_TYPE_STREAM())) - -proc HTML_CONTEXT_TYPE*(): GType = - result = html_context_get_type() - -proc HTML_CONTEXT*(obj: pointer): PHtmlContext = - result = CHECK_CAST(obj, HTML_CONTEXT_TYPE(), THtmlContext) - -proc HTML_CONTEXT_CLASS*(klass: pointer): PHtmlContextClass = - result = CHECK_CLASS_CAST(klass, HTML_CONTEXT_TYPE(), THtmlContextClass) - -proc HTML_IS_CONTEXT*(obj: pointer): bool = - result = CHECK_TYPE(obj, HTML_CONTEXT_TYPE()) - -proc HTML_IS_CONTEXT_CLASS*(klass: pointer): bool = - result = CHECK_CLASS_TYPE(klass, HTML_CONTEXT_TYPE()) - -proc HTML_TYPE_DOCUMENT*(): GType = - result = html_document_get_type() - -proc HTML_DOCUMENT*(obj: pointer): PHtmlDocument = - result = PHtmlDocument(CHECK_CAST(obj, HTML_TYPE_DOCUMENT())) - -proc HTML_DOCUMENT_CLASS*(klass: pointer): PHtmlDocumentClass = - result = CHECK_CLASS_CAST(klass, HTML_TYPE_DOCUMENT()) - -proc HTML_IS_DOCUMENT*(obj: pointer): bool = - result = CHECK_TYPE(obj, HTML_TYPE_DOCUMENT()) - -proc HTML_TYPE_VIEW*(): GType = - result = html_view_get_type() - -proc HTML_VIEW*(obj: pointer): PHtmlView = - result = PHtmlView(CHECK_CAST(obj, HTML_TYPE_VIEW())) - -proc HTML_VIEW_CLASS*(klass: pointer): PHtmlViewClass = - result = PHtmlViewClass(CHECK_CLASS_CAST(klass, HTML_TYPE_VIEW())) - -proc HTML_IS_VIEW*(obj: pointer): bool = - result = CHECK_TYPE(obj, HTML_TYPE_VIEW()) diff --git a/lib/wrappers/gtk/libglade2.nim b/lib/wrappers/gtk/libglade2.nim deleted file mode 100644 index 6dda3364e..000000000 --- a/lib/wrappers/gtk/libglade2.nim +++ /dev/null @@ -1,111 +0,0 @@ -{.deadCodeElim: on.} -import - glib2, gtk2 - -when defined(win32): - const - LibGladeLib = "libglade-2.0-0.dll" -elif defined(macosx): - const - LibGladeLib = "libglade-2.0.dylib" -else: - const - LibGladeLib = "libglade-2.0.so" -type - PLongint* = ptr int32 - PSmallInt* = ptr int16 - PByte* = ptr int8 - PWord* = ptr int16 - PDWord* = ptr int32 - PDouble* = ptr float64 - -proc init*(){.cdecl, dynlib: LibGladeLib, importc: "glade_init".} -proc require*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib, - importc: "glade_require".} -proc provide*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib, - importc: "glade_provide".} -type - PXMLPrivate* = pointer - PXML* = ptr TXML - TXML* = object of TGObject - filename*: cstring - priv*: PXMLPrivate - - PXMLClass* = ptr TXMLClass - TXMLClass* = object of TGObjectClass - TXMLConnectFunc* = proc (handler_name: cstring, anObject: PGObject, - signal_name: cstring, signal_data: cstring, - connect_object: PGObject, after: gboolean, - user_data: gpointer){.cdecl.} - -proc TYPE_XML*(): GType -proc XML*(obj: pointer): PXML -proc XML_CLASS*(klass: pointer): PXMLClass -proc IS_XML*(obj: pointer): gboolean -proc IS_XML_CLASS*(klass: pointer): gboolean -proc XML_GET_CLASS*(obj: pointer): PXMLClass -proc xml_get_type*(): GType{.cdecl, dynlib: LibGladeLib, - importc: "glade_xml_get_type".} -proc xml_new*(fname: cstring, root: cstring, domain: cstring): PXML{.cdecl, - dynlib: LibGladeLib, importc: "glade_xml_new".} -proc xml_new_from_buffer*(buffer: cstring, size: int32, root: cstring, - domain: cstring): PXML{.cdecl, dynlib: LibGladeLib, - importc: "glade_xml_new_from_buffer".} -proc construct*(self: PXML, fname: cstring, root: cstring, domain: cstring): gboolean{. - cdecl, dynlib: LibGladeLib, importc: "glade_xml_construct".} -proc signal_connect*(self: PXML, handlername: cstring, func: TGCallback){. - cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect".} -proc signal_connect_data*(self: PXML, handlername: cstring, - func: TGCallback, user_data: gpointer){.cdecl, - dynlib: LibGladeLib, importc: "glade_xml_signal_connect_data".} -proc signal_autoconnect*(self: PXML){.cdecl, dynlib: LibGladeLib, - importc: "glade_xml_signal_autoconnect".} -proc signal_connect_full*(self: PXML, handler_name: cstring, - func: TXMLConnectFunc, user_data: gpointer){. - cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect_full".} -proc signal_autoconnect_full*(self: PXML, func: TXMLConnectFunc, - user_data: gpointer){.cdecl, - dynlib: LibGladeLib, importc: "glade_xml_signal_autoconnect_full".} -proc get_widget*(self: PXML, name: cstring): gtk2.PWidget{.cdecl, - dynlib: LibGladeLib, importc: "glade_xml_get_widget".} -proc get_widget_prefix*(self: PXML, name: cstring): PGList{.cdecl, - dynlib: LibGladeLib, importc: "glade_xml_get_widget_prefix".} -proc relative_file*(self: PXML, filename: cstring): cstring{.cdecl, - dynlib: LibGladeLib, importc: "glade_xml_relative_file".} -proc get_widget_name*(widget: gtk2.PWidget): cstring{.cdecl, dynlib: LibGladeLib, - importc: "glade_get_widget_name".} -proc get_widget_tree*(widget: gtk2.PWidget): PXML{.cdecl, dynlib: LibGladeLib, - importc: "glade_get_widget_tree".} -type - PXMLCustomWidgetHandler* = ptr TXMLCustomWidgetHandler - TXMLCustomWidgetHandler* = gtk2.TWidget - -proc set_custom_handler*(handler: TXMLCustomWidgetHandler, user_data: gpointer){. - cdecl, dynlib: LibGladeLib, importc: "glade_set_custom_handler".} -proc gnome_init*() = - init() - -proc bonobo_init*() = - init() - -proc xml_new_from_memory*(buffer: cstring, size: int32, root: cstring, - domain: cstring): PXML = - result = xml_new_from_buffer(buffer, size, root, domain) - -proc TYPE_XML*(): GType = - result = xml_get_type() - -proc XML*(obj: pointer): PXML = - result = cast[PXML](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_XML())) - -proc XML_CLASS*(klass: pointer): PXMLClass = - result = cast[PXMLClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_XML())) - -proc IS_XML*(obj: pointer): gboolean = - result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_XML()) - -proc IS_XML_CLASS*(klass: pointer): gboolean = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_XML()) - -proc XML_GET_CLASS*(obj: pointer): PXMLClass = - result = cast[PXMLClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_XML())) diff --git a/lib/wrappers/gtk/pango.nim b/lib/wrappers/gtk/pango.nim deleted file mode 100644 index 5d9fcd96f..000000000 --- a/lib/wrappers/gtk/pango.nim +++ /dev/null @@ -1,1160 +0,0 @@ -{.deadCodeElim: on.} -import - glib2 - -when defined(win32): - const - lib* = "libpango-1.0-0.dll" -elif defined(macosx): - const - lib* = "libpango-1.0.dylib" -else: - const - lib* = "libpango-1.0.so.0" -type - TFont* {.pure, final.} = object - PFont* = ptr TFont - TFontFamily* {.pure, final.} = object - PFontFamily* = ptr TFontFamily - TFontSet* {.pure, final.} = object - PFontset* = ptr TFontset - TFontMetrics* {.pure, final.} = object - PFontMetrics* = ptr TFontMetrics - TFontFace* {.pure, final.} = object - PFontFace* = ptr TFontFace - TFontMap* {.pure, final.} = object - PFontMap* = ptr TFontMap - TFontsetClass {.pure, final.} = object - PFontsetClass* = ptr TFontSetClass - TFontFamilyClass* {.pure, final.} = object - PFontFamilyClass* = ptr TFontFamilyClass - TFontFaceClass* {.pure, final.} = object - PFontFaceClass* = ptr TFontFaceClass - TFontClass* {.pure, final.} = object - PFontClass* = ptr TFontClass - TFontMapClass* {.pure, final.} = object - PFontMapClass* = ptr TFontMapClass - PFontDescription* = ptr TFontDescription - TFontDescription* {.pure, final.} = object - PAttrList* = ptr TAttrList - TAttrList* {.pure, final.} = object - PAttrIterator* = ptr TAttrIterator - TAttrIterator* {.pure, final.} = object - PLayout* = ptr TLayout - TLayout* {.pure, final.} = object - PLayoutClass* = ptr TLayoutClass - TLayoutClass* {.pure, final.} = object - PLayoutIter* = ptr TLayoutIter - TLayoutIter* {.pure, final.} = object - PContext* = ptr TContext - TContext* {.pure, final.} = object - PContextClass* = ptr TContextClass - TContextClass* {.pure, final.} = object - PFontsetSimple* = ptr TFontsetSimple - TFontsetSimple* {.pure, final.} = object - PTabArray* = ptr TTabArray - TTabArray* {.pure, final.} = object - PGlyphString* = ptr TGlyphString - PAnalysis* = ptr TAnalysis - PItem* = ptr TItem - PLanguage* = ptr TLanguage - TLanguage* {.pure, final.} = object - PGlyph* = ptr TGlyph - TGlyph* = guint32 - PRectangle* = ptr TRectangle - TRectangle*{.final, pure.} = object - x*: int32 - y*: int32 - width*: int32 - height*: int32 - - PDirection* = ptr TDirection - TDirection* = enum - DIRECTION_LTR, DIRECTION_RTL, DIRECTION_TTB_LTR, DIRECTION_TTB_RTL - PColor* = ptr TColor - TColor*{.final, pure.} = object - red*: guint16 - green*: guint16 - blue*: guint16 - - PAttrType* = ptr TAttrType - TAttrType* = int32 - PUnderline* = ptr TUnderline - TUnderline* = int32 - PAttribute* = ptr TAttribute - PAttrClass* = ptr TAttrClass - TAttribute*{.final, pure.} = object - klass*: PAttrClass - start_index*: int - end_index*: int - - TAttrClass*{.final, pure.} = object - `type`*: TAttrType - copy*: proc (attr: PAttribute): PAttribute{.cdecl.} - destroy*: proc (attr: PAttribute){.cdecl.} - equal*: proc (attr1: PAttribute, attr2: PAttribute): gboolean{.cdecl.} - - PAttrString* = ptr TAttrString - TAttrString*{.final, pure.} = object - attr*: TAttribute - value*: cstring - - PAttrLanguage* = ptr TAttrLanguage - TAttrLanguage*{.final, pure.} = object - attr*: TAttribute - value*: PLanguage - - PAttrInt* = ptr TAttrInt - TAttrInt*{.final, pure.} = object - attr*: TAttribute - value*: int32 - - PAttrFloat* = ptr TAttrFloat - TAttrFloat*{.final, pure.} = object - attr*: TAttribute - value*: gdouble - - PAttrColor* = ptr TAttrColor - TAttrColor*{.final, pure.} = object - attr*: TAttribute - color*: TColor - - PAttrShape* = ptr TAttrShape - TAttrShape*{.final, pure.} = object - attr*: TAttribute - ink_rect*: TRectangle - logical_rect*: TRectangle - - PAttrFontDesc* = ptr TAttrFontDesc - TAttrFontDesc*{.final, pure.} = object - attr*: TAttribute - desc*: PFontDescription - - PLogAttr* = ptr TLogAttr - TLogAttr*{.final, pure.} = object - flag0*: guint16 - - PCoverageLevel* = ptr TCoverageLevel - TCoverageLevel* = enum - COVERAGE_NONE, COVERAGE_FALLBACK, COVERAGE_APPROXIMATE, COVERAGE_EXACT - PBlockInfo* = ptr TBlockInfo - TBlockInfo*{.final, pure.} = object - data*: Pguchar - level*: TCoverageLevel - - PCoverage* = ptr TCoverage - TCoverage*{.final, pure.} = object - ref_count*: int - n_blocks*: int32 - data_size*: int32 - blocks*: PBlockInfo - - PEngineRange* = ptr TEngineRange - TEngineRange*{.final, pure.} = object - start*: int32 - theEnd*: int32 - langs*: cstring - - PEngineInfo* = ptr TEngineInfo - TEngineInfo*{.final, pure.} = object - id*: cstring - engine_type*: cstring - render_type*: cstring - ranges*: PEngineRange - n_ranges*: gint - - PEngine* = ptr TEngine - TEngine*{.final, pure.} = object - id*: cstring - `type`*: cstring - length*: gint - - TEngineLangScriptBreak* = proc (text: cstring, len: int32, - analysis: PAnalysis, attrs: PLogAttr, - attrs_len: int32){.cdecl.} - PEngineLang* = ptr TEngineLang - TEngineLang*{.final, pure.} = object - engine*: TEngine - script_break*: TEngineLangScriptBreak - - TEngineShapeScript* = proc (font: PFont, text: cstring, length: int32, - analysis: PAnalysis, glyphs: PGlyphString){.cdecl.} - TEngineShapeGetCoverage* = proc (font: PFont, language: PLanguage): PCoverage{. - cdecl.} - PEngineShape* = ptr TEngineShape - TEngineShape*{.final, pure.} = object - engine*: TEngine - script_shape*: TEngineShapeScript - get_coverage*: TEngineShapeGetCoverage - - PStyle* = ptr TStyle - TStyle* = gint - PVariant* = ptr TVariant - TVariant* = gint - PWeight* = ptr TWeight - TWeight* = gint - PStretch* = ptr TStretch - TStretch* = gint - PFontMask* = ptr TFontMask - TFontMask* = int32 - PGlyphUnit* = ptr TGlyphUnit - TGlyphUnit* = gint32 - PGlyphGeometry* = ptr TGlyphGeometry - TGlyphGeometry*{.final, pure.} = object - width*: TGlyphUnit - x_offset*: TGlyphUnit - y_offset*: TGlyphUnit - - PGlyphVisAttr* = ptr TGlyphVisAttr - TGlyphVisAttr*{.final, pure.} = object - flag0*: int16 - - PGlyphInfo* = ptr TGlyphInfo - TGlyphInfo*{.final, pure.} = object - glyph*: TGlyph - geometry*: TGlyphGeometry - attr*: TGlyphVisAttr - - TGlyphString*{.final, pure.} = object - num_glyphs*: gint - glyphs*: PGlyphInfo - log_clusters*: Pgint - space*: gint - - TAnalysis*{.final, pure.} = object - shape_engine*: PEngineShape - lang_engine*: PEngineLang - font*: PFont - level*: guint8 - language*: PLanguage - extra_attrs*: PGSList - - TItem*{.final, pure.} = object - offset*: gint - length*: gint - num_chars*: gint - analysis*: TAnalysis - - PAlignment* = ptr TAlignment - TAlignment* = enum - ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT - PWrapMode* = ptr TWrapMode - TWrapMode* = enum - WRAP_WORD, WRAP_CHAR - PLayoutLine* = ptr TLayoutLine - TLayoutLine*{.final, pure.} = object - layout*: PLayout - start_index*: gint - length*: gint - runs*: PGSList - - PLayoutRun* = ptr TLayoutRun - TLayoutRun*{.final, pure.} = object - item*: PItem - glyphs*: PGlyphString - - PTabAlign* = ptr TTabAlign - TTabAlign* = enum - TAB_LEFT - -const - SCALE* = 1024 - -proc PIXELS*(d: int): int -proc ASCENT*(rect: TRectangle): int32 -proc DESCENT*(rect: TRectangle): int32 -proc LBEARING*(rect: TRectangle): int32 -proc RBEARING*(rect: TRectangle): int32 -proc TYPE_LANGUAGE*(): GType -proc language_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_language_get_type".} -proc language_from_string*(language: cstring): PLanguage{.cdecl, dynlib: lib, - importc: "pango_language_from_string".} -proc to_string*(language: PLanguage): cstring -proc matches*(language: PLanguage, range_list: cstring): gboolean{. - cdecl, dynlib: lib, importc: "pango_language_matches".} -const - ATTR_INVALID* = 0 - ATTR_LANGUAGE* = 1 - ATTR_FAMILY* = 2 - ATTR_STYLE* = 3 - ATTR_WEIGHT* = 4 - ATTR_VARIANT* = 5 - ATTR_STRETCH* = 6 - ATTR_SIZE* = 7 - ATTR_FONT_DESC* = 8 - ATTR_FOREGROUND* = 9 - ATTR_BACKGROUND* = 10 - ATTR_UNDERLINE* = 11 - ATTR_STRIKETHROUGH* = 12 - ATTR_RISE* = 13 - ATTR_SHAPE* = 14 - ATTR_SCALE* = 15 - UNDERLINE_NONE* = 0 - UNDERLINE_SINGLE* = 1 - UNDERLINE_DOUBLE* = 2 - UNDERLINE_LOW* = 3 - -proc TYPE_COLOR*(): GType -proc color_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_color_get_type".} -proc copy*(src: PColor): PColor{.cdecl, dynlib: lib, - importc: "pango_color_copy".} -proc free*(color: PColor){.cdecl, dynlib: lib, importc: "pango_color_free".} -proc parse*(color: PColor, spec: cstring): gboolean{.cdecl, dynlib: lib, - importc: "pango_color_parse".} -proc TYPE_ATTR_LIST*(): GType -proc attr_type_register*(name: cstring): TAttrType{.cdecl, dynlib: lib, - importc: "pango_attr_type_register".} -proc copy*(attr: PAttribute): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attribute_copy".} -proc destroy*(attr: PAttribute){.cdecl, dynlib: lib, - importc: "pango_attribute_destroy".} -proc equal*(attr1: PAttribute, attr2: PAttribute): gboolean{.cdecl, - dynlib: lib, importc: "pango_attribute_equal".} -proc attr_language_new*(language: PLanguage): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_language_new".} -proc attr_family_new*(family: cstring): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_family_new".} -proc attr_foreground_new*(red: guint16, green: guint16, blue: guint16): PAttribute{. - cdecl, dynlib: lib, importc: "pango_attr_foreground_new".} -proc attr_background_new*(red: guint16, green: guint16, blue: guint16): PAttribute{. - cdecl, dynlib: lib, importc: "pango_attr_background_new".} -proc attr_size_new*(size: int32): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_size_new".} -proc attr_style_new*(style: TStyle): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_style_new".} -proc attr_weight_new*(weight: TWeight): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_weight_new".} -proc attr_variant_new*(variant: TVariant): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_variant_new".} -proc attr_stretch_new*(stretch: TStretch): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_stretch_new".} -proc attr_font_desc_new*(desc: PFontDescription): PAttribute{.cdecl, - dynlib: lib, importc: "pango_attr_font_desc_new".} -proc attr_underline_new*(underline: TUnderline): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_underline_new".} -proc attr_strikethrough_new*(strikethrough: gboolean): PAttribute{.cdecl, - dynlib: lib, importc: "pango_attr_strikethrough_new".} -proc attr_rise_new*(rise: int32): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_rise_new".} -proc attr_shape_new*(ink_rect: PRectangle, logical_rect: PRectangle): PAttribute{. - cdecl, dynlib: lib, importc: "pango_attr_shape_new".} -proc attr_scale_new*(scale_factor: gdouble): PAttribute{.cdecl, dynlib: lib, - importc: "pango_attr_scale_new".} -proc attr_list_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_attr_list_get_type".} -proc attr_list_new*(): PAttrList{.cdecl, dynlib: lib, - importc: "pango_attr_list_new".} -proc reference*(list: PAttrList){.cdecl, dynlib: lib, - importc: "pango_attr_list_ref".} -proc unref*(list: PAttrList){.cdecl, dynlib: lib, - importc: "pango_attr_list_unref".} -proc copy*(list: PAttrList): PAttrList{.cdecl, dynlib: lib, - importc: "pango_attr_list_copy".} -proc insert*(list: PAttrList, attr: PAttribute){.cdecl, dynlib: lib, - importc: "pango_attr_list_insert".} -proc insert_before*(list: PAttrList, attr: PAttribute){.cdecl, - dynlib: lib, importc: "pango_attr_list_insert_before".} -proc change*(list: PAttrList, attr: PAttribute){.cdecl, dynlib: lib, - importc: "pango_attr_list_change".} -proc splice*(list: PAttrList, other: PAttrList, pos: gint, len: gint){. - cdecl, dynlib: lib, importc: "pango_attr_list_splice".} -proc get_iterator*(list: PAttrList): PAttrIterator{.cdecl, - dynlib: lib, importc: "pango_attr_list_get_iterator".} -proc attr_iterator_range*(`iterator`: PAttrIterator, start: Pgint, theEnd: Pgint){. - cdecl, dynlib: lib, importc: "pango_attr_iterator_range".} -proc attr_iterator_next*(`iterator`: PAttrIterator): gboolean{.cdecl, - dynlib: lib, importc: "pango_attr_iterator_next".} -proc attr_iterator_copy*(`iterator`: PAttrIterator): PAttrIterator{.cdecl, - dynlib: lib, importc: "pango_attr_iterator_copy".} -proc attr_iterator_destroy*(`iterator`: PAttrIterator){.cdecl, dynlib: lib, - importc: "pango_attr_iterator_destroy".} -proc attr_iterator_get*(`iterator`: PAttrIterator, `type`: TAttrType): PAttribute{. - cdecl, dynlib: lib, importc: "pango_attr_iterator_get".} -proc attr_iterator_get_font*(`iterator`: PAttrIterator, desc: PFontDescription, - language: var PLanguage, extra_attrs: PPGSList){. - cdecl, dynlib: lib, importc: "pango_attr_iterator_get_font".} -proc parse_markup*(markup_text: cstring, length: int32, accel_marker: gunichar, - attr_list: var PAttrList, text: PPchar, - accel_char: Pgunichar, error: pointer): gboolean{.cdecl, - dynlib: lib, importc: "pango_parse_markup".} -const - bm_TPangoLogAttr_is_line_break* = 0x0001'i16 - bp_TPangoLogAttr_is_line_break* = 0'i16 - bm_TPangoLogAttr_is_mandatory_break* = 0x0002'i16 - bp_TPangoLogAttr_is_mandatory_break* = 1'i16 - bm_TPangoLogAttr_is_char_break* = 0x0004'i16 - bp_TPangoLogAttr_is_char_break* = 2'i16 - bm_TPangoLogAttr_is_white* = 0x0008'i16 - bp_TPangoLogAttr_is_white* = 3'i16 - bm_TPangoLogAttr_is_cursor_position* = 0x0010'i16 - bp_TPangoLogAttr_is_cursor_position* = 4'i16 - bm_TPangoLogAttr_is_word_start* = 0x0020'i16 - bp_TPangoLogAttr_is_word_start* = 5'i16 - bm_TPangoLogAttr_is_word_end* = 0x0040'i16 - bp_TPangoLogAttr_is_word_end* = 6'i16 - bm_TPangoLogAttr_is_sentence_boundary* = 0x0080'i16 - bp_TPangoLogAttr_is_sentence_boundary* = 7'i16 - bm_TPangoLogAttr_is_sentence_start* = 0x0100'i16 - bp_TPangoLogAttr_is_sentence_start* = 8'i16 - bm_TPangoLogAttr_is_sentence_end* = 0x0200'i16 - bp_TPangoLogAttr_is_sentence_end* = 9'i16 - -proc is_line_break*(a: PLogAttr): guint -proc set_is_line_break*(a: PLogAttr, `is_line_break`: guint) -proc is_mandatory_break*(a: PLogAttr): guint -proc set_is_mandatory_break*(a: PLogAttr, `is_mandatory_break`: guint) -proc is_char_break*(a: PLogAttr): guint -proc set_is_char_break*(a: PLogAttr, `is_char_break`: guint) -proc is_white*(a: PLogAttr): guint -proc set_is_white*(a: PLogAttr, `is_white`: guint) -proc is_cursor_position*(a: PLogAttr): guint -proc set_is_cursor_position*(a: PLogAttr, `is_cursor_position`: guint) -proc is_word_start*(a: PLogAttr): guint -proc set_is_word_start*(a: PLogAttr, `is_word_start`: guint) -proc is_word_end*(a: PLogAttr): guint -proc set_is_word_end*(a: PLogAttr, `is_word_end`: guint) -proc is_sentence_boundary*(a: PLogAttr): guint -proc set_is_sentence_boundary*(a: PLogAttr, `is_sentence_boundary`: guint) -proc is_sentence_start*(a: PLogAttr): guint -proc set_is_sentence_start*(a: PLogAttr, `is_sentence_start`: guint) -proc is_sentence_end*(a: PLogAttr): guint -proc set_is_sentence_end*(a: PLogAttr, `is_sentence_end`: guint) -proc `break`*(text: cstring, length: int32, analysis: PAnalysis, attrs: PLogAttr, - attrs_len: int32){.cdecl, dynlib: lib, importc: "pango_break".} -proc find_paragraph_boundary*(text: cstring, length: gint, - paragraph_delimiter_index: Pgint, - next_paragraph_start: Pgint){.cdecl, dynlib: lib, - importc: "pango_find_paragraph_boundary".} -proc get_log_attrs*(text: cstring, length: int32, level: int32, - language: PLanguage, log_attrs: PLogAttr, attrs_len: int32){. - cdecl, dynlib: lib, importc: "pango_get_log_attrs".} -proc TYPE_CONTEXT*(): GType -proc CONTEXT*(anObject: pointer): PContext -proc CONTEXT_CLASS*(klass: pointer): PContextClass -proc IS_CONTEXT*(anObject: pointer): bool -proc IS_CONTEXT_CLASS*(klass: pointer): bool -proc GET_CLASS*(obj: PContext): PContextClass -proc context_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_context_get_type".} -proc list_families*(context: PContext, - families: openarray[ptr PFontFamily]){.cdecl, - dynlib: lib, importc: "pango_context_list_families".} -proc load_font*(context: PContext, desc: PFontDescription): PFont{. - cdecl, dynlib: lib, importc: "pango_context_load_font".} -proc load_fontset*(context: PContext, desc: PFontDescription, - language: PLanguage): PFontset{.cdecl, dynlib: lib, - importc: "pango_context_load_fontset".} -proc get_metrics*(context: PContext, desc: PFontDescription, - language: PLanguage): PFontMetrics{.cdecl, - dynlib: lib, importc: "pango_context_get_metrics".} -proc set_font_description*(context: PContext, desc: PFontDescription){. - cdecl, dynlib: lib, importc: "pango_context_set_font_description".} -proc get_font_description*(context: PContext): PFontDescription{.cdecl, - dynlib: lib, importc: "pango_context_get_font_description".} -proc get_language*(context: PContext): PLanguage{.cdecl, dynlib: lib, - importc: "pango_context_get_language".} -proc set_language*(context: PContext, language: PLanguage){.cdecl, - dynlib: lib, importc: "pango_context_set_language".} -proc set_base_dir*(context: PContext, direction: TDirection){.cdecl, - dynlib: lib, importc: "pango_context_set_base_dir".} -proc get_base_dir*(context: PContext): TDirection{.cdecl, dynlib: lib, - importc: "pango_context_get_base_dir".} -proc itemize*(context: PContext, text: cstring, start_index: int32, - length: int32, attrs: PAttrList, cached_iter: PAttrIterator): PGList{. - cdecl, dynlib: lib, importc: "pango_itemize".} -proc coverage_new*(): PCoverage{.cdecl, dynlib: lib, - importc: "pango_coverage_new".} -proc reference*(coverage: PCoverage): PCoverage{.cdecl, dynlib: lib, - importc: "pango_coverage_ref".} -proc unref*(coverage: PCoverage){.cdecl, dynlib: lib, - importc: "pango_coverage_unref".} -proc copy*(coverage: PCoverage): PCoverage{.cdecl, dynlib: lib, - importc: "pango_coverage_copy".} -proc get*(coverage: PCoverage, index: int32): TCoverageLevel{.cdecl, - dynlib: lib, importc: "pango_coverage_get".} -proc set*(coverage: PCoverage, index: int32, level: TCoverageLevel){. - cdecl, dynlib: lib, importc: "pango_coverage_set".} -proc max*(coverage: PCoverage, other: PCoverage){.cdecl, dynlib: lib, - importc: "pango_coverage_max".} -proc to_bytes*(coverage: PCoverage, bytes: PPguchar, n_bytes: var int32){. - cdecl, dynlib: lib, importc: "pango_coverage_to_bytes".} -proc coverage_from_bytes*(bytes: Pguchar, n_bytes: int32): PCoverage{.cdecl, - dynlib: lib, importc: "pango_coverage_from_bytes".} -proc TYPE_FONTSET*(): GType -proc FONTSET*(anObject: pointer): PFontset -proc IS_FONTSET*(anObject: pointer): bool -proc fontset_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_fontset_get_type".} -proc get_font*(fontset: PFontset, wc: guint): PFont{.cdecl, dynlib: lib, - importc: "pango_fontset_get_font".} -proc get_metrics*(fontset: PFontset): PFontMetrics{.cdecl, dynlib: lib, - importc: "pango_fontset_get_metrics".} -const - STYLE_NORMAL* = 0 - STYLE_OBLIQUE* = 1 - STYLE_ITALIC* = 2 - VARIANT_NORMAL* = 0 - VARIANT_SMALL_CAPS* = 1 - WEIGHT_ULTRALIGHT* = 200 - WEIGHT_LIGHT* = 300 - WEIGHT_NORMAL* = 400 - WEIGHT_BOLD* = 700 - WEIGHT_ULTRABOLD* = 800 - WEIGHT_HEAVY* = 900 - STRETCH_ULTRA_CONDENSED* = 0 - STRETCH_EXTRA_CONDENSED* = 1 - STRETCH_CONDENSED* = 2 - STRETCH_SEMI_CONDENSED* = 3 - STRETCH_NORMAL* = 4 - STRETCH_SEMI_EXPANDED* = 5 - STRETCH_EXPANDED* = 6 - STRETCH_EXTRA_EXPANDED* = 7 - STRETCH_ULTRA_EXPANDED* = 8 - FONT_MASK_FAMILY* = 1 shl 0 - FONT_MASK_STYLE* = 1 shl 1 - FONT_MASK_VARIANT* = 1 shl 2 - FONT_MASK_WEIGHT* = 1 shl 3 - FONT_MASK_STRETCH* = 1 shl 4 - FONT_MASK_SIZE* = 1 shl 5 - SCALE_XX_SMALL* = 0.578704 - SCALE_X_SMALL* = 0.644444 - SCALE_SMALL* = 0.833333 - SCALE_MEDIUM* = 1.00000 - SCALE_LARGE* = 1.20000 - SCALE_X_LARGE* = 1.44000 - SCALE_XX_LARGE* = 1.72800 - -proc TYPE_FONT_DESCRIPTION*(): GType -proc font_description_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_font_description_get_type".} -proc font_description_new*(): PFontDescription{.cdecl, dynlib: lib, - importc: "pango_font_description_new".} -proc copy*(desc: PFontDescription): PFontDescription{.cdecl, - dynlib: lib, importc: "pango_font_description_copy".} -proc copy_static*(desc: PFontDescription): PFontDescription{. - cdecl, dynlib: lib, importc: "pango_font_description_copy_static".} -proc hash*(desc: PFontDescription): guint{.cdecl, dynlib: lib, - importc: "pango_font_description_hash".} -proc equal*(desc1: PFontDescription, desc2: PFontDescription): gboolean{. - cdecl, dynlib: lib, importc: "pango_font_description_equal".} -proc free*(desc: PFontDescription){.cdecl, dynlib: lib, - importc: "pango_font_description_free".} -proc font_descriptions_free*(descs: var PFontDescription, n_descs: int32){. - cdecl, dynlib: lib, importc: "pango_font_descriptions_free".} -proc set_family*(desc: PFontDescription, family: cstring){. - cdecl, dynlib: lib, importc: "pango_font_description_set_family".} -proc set_family_static*(desc: PFontDescription, family: cstring){. - cdecl, dynlib: lib, importc: "pango_font_description_set_family_static".} -proc get_family*(desc: PFontDescription): cstring{.cdecl, - dynlib: lib, importc: "pango_font_description_get_family".} -proc set_style*(desc: PFontDescription, style: TStyle){.cdecl, - dynlib: lib, importc: "pango_font_description_set_style".} -proc get_style*(desc: PFontDescription): TStyle{.cdecl, - dynlib: lib, importc: "pango_font_description_get_style".} -proc set_variant*(desc: PFontDescription, variant: TVariant){. - cdecl, dynlib: lib, importc: "pango_font_description_set_variant".} -proc get_variant*(desc: PFontDescription): TVariant{.cdecl, - dynlib: lib, importc: "pango_font_description_get_variant".} -proc set_weight*(desc: PFontDescription, weight: TWeight){. - cdecl, dynlib: lib, importc: "pango_font_description_set_weight".} -proc get_weight*(desc: PFontDescription): TWeight{.cdecl, - dynlib: lib, importc: "pango_font_description_get_weight".} -proc set_stretch*(desc: PFontDescription, stretch: TStretch){. - cdecl, dynlib: lib, importc: "pango_font_description_set_stretch".} -proc get_stretch*(desc: PFontDescription): TStretch{.cdecl, - dynlib: lib, importc: "pango_font_description_get_stretch".} -proc set_size*(desc: PFontDescription, size: gint){.cdecl, - dynlib: lib, importc: "pango_font_description_set_size".} -proc get_size*(desc: PFontDescription): gint{.cdecl, - dynlib: lib, importc: "pango_font_description_get_size".} -proc set_absolute_size*(desc: PFontDescription, size: float64){. - cdecl, dynlib: lib, importc: "pango_font_description_set_absolute_size".} -proc get_size_is_absolute*(desc: PFontDescription, - size: float64): gboolean{.cdecl, dynlib: lib, importc: "pango_font_description_get_size_is_absolute".} -proc get_set_fields*(desc: PFontDescription): TFontMask{.cdecl, - dynlib: lib, importc: "pango_font_description_get_set_fields".} -proc unset_fields*(desc: PFontDescription, to_unset: TFontMask){. - cdecl, dynlib: lib, importc: "pango_font_description_unset_fields".} -proc merge*(desc: PFontDescription, - desc_to_merge: PFontDescription, - replace_existing: gboolean){.cdecl, dynlib: lib, - importc: "pango_font_description_merge".} -proc merge_static*(desc: PFontDescription, - desc_to_merge: PFontDescription, - replace_existing: gboolean){.cdecl, - dynlib: lib, importc: "pango_font_description_merge_static".} -proc better_match*(desc: PFontDescription, - old_match: PFontDescription, - new_match: PFontDescription): gboolean{. - cdecl, dynlib: lib, importc: "pango_font_description_better_match".} -proc font_description_from_string*(str: cstring): PFontDescription{.cdecl, - dynlib: lib, importc: "pango_font_description_from_string".} -proc to_string*(desc: PFontDescription): cstring{.cdecl, - dynlib: lib, importc: "pango_font_description_to_string".} -proc to_filename*(desc: PFontDescription): cstring{.cdecl, - dynlib: lib, importc: "pango_font_description_to_filename".} -proc TYPE_FONT_METRICS*(): GType -proc font_metrics_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_font_metrics_get_type".} -proc reference*(metrics: PFontMetrics): PFontMetrics{.cdecl, dynlib: lib, - importc: "pango_font_metrics_ref".} -proc unref*(metrics: PFontMetrics){.cdecl, dynlib: lib, - importc: "pango_font_metrics_unref".} -proc get_ascent*(metrics: PFontMetrics): int32{.cdecl, dynlib: lib, - importc: "pango_font_metrics_get_ascent".} -proc get_descent*(metrics: PFontMetrics): int32{.cdecl, - dynlib: lib, importc: "pango_font_metrics_get_descent".} -proc get_approximate_char_width*(metrics: PFontMetrics): int32{. - cdecl, dynlib: lib, importc: "pango_font_metrics_get_approximate_char_width".} -proc get_approximate_digit_width*(metrics: PFontMetrics): int32{. - cdecl, dynlib: lib, - importc: "pango_font_metrics_get_approximate_digit_width".} -proc TYPE_FONT_FAMILY*(): GType -proc FONT_FAMILY*(anObject: Pointer): PFontFamily -proc IS_FONT_FAMILY*(anObject: Pointer): bool -proc font_family_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_font_family_get_type".} -proc list_faces*(family: PFontFamily, - faces: var openarray[ptr PFontFace]){.cdecl, - dynlib: lib, importc: "pango_font_family_list_faces".} -proc get_name*(family: PFontFamily): cstring{.cdecl, dynlib: lib, - importc: "pango_font_family_get_name".} -proc TYPE_FONT_FACE*(): GType -proc FONT_FACE*(anObject: pointer): PFontFace -proc IS_FONT_FACE*(anObject: pointer): bool -proc font_face_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_font_face_get_type".} -proc describe*(face: PFontFace): PFontDescription{.cdecl, dynlib: lib, - importc: "pango_font_face_describe".} -proc get_face_name*(face: PFontFace): cstring{.cdecl, dynlib: lib, - importc: "pango_font_face_get_face_name".} -proc TYPE_FONT*(): GType -proc FONT*(anObject: pointer): PFont -proc IS_FONT*(anObject: pointer): bool -proc font_get_type*(): GType{.cdecl, dynlib: lib, importc: "pango_font_get_type".} -proc describe*(font: PFont): PFontDescription{.cdecl, dynlib: lib, - importc: "pango_font_describe".} -proc get_coverage*(font: PFont, language: PLanguage): PCoverage{.cdecl, - dynlib: lib, importc: "pango_font_get_coverage".} -proc find_shaper*(font: PFont, language: PLanguage, ch: guint32): PEngineShape{. - cdecl, dynlib: lib, importc: "pango_font_find_shaper".} -proc get_metrics*(font: PFont, language: PLanguage): PFontMetrics{.cdecl, - dynlib: lib, importc: "pango_font_get_metrics".} -proc get_glyph_extents*(font: PFont, glyph: TGlyph, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, dynlib: lib, - importc: "pango_font_get_glyph_extents".} -proc TYPE_FONT_MAP*(): GType -proc FONT_MAP*(anObject: pointer): PFontMap -proc IS_FONT_MAP*(anObject: pointer): bool -proc font_map_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_font_map_get_type".} -proc load_font*(fontmap: PFontMap, context: PContext, - desc: PFontDescription): PFont{.cdecl, dynlib: lib, - importc: "pango_font_map_load_font".} -proc load_fontset*(fontmap: PFontMap, context: PContext, - desc: PFontDescription, language: PLanguage): PFontset{. - cdecl, dynlib: lib, importc: "pango_font_map_load_fontset".} -proc list_families*(fontmap: PFontMap, - families: var openarray[ptr PFontFamily]){.cdecl, - dynlib: lib, importc: "pango_font_map_list_families".} -const - bm_TPangoGlyphVisAttr_is_cluster_start* = 0x0001'i16 - bp_TPangoGlyphVisAttr_is_cluster_start* = 0'i16 - -proc is_cluster_start*(a: PGlyphVisAttr): guint -proc set_is_cluster_start*(a: PGlyphVisAttr, `is_cluster_start`: guint) -proc TYPE_GLYPH_STRING*(): GType -proc glyph_string_new*(): PGlyphString{.cdecl, dynlib: lib, - importc: "pango_glyph_string_new".} -proc glyph_string_set_size*(`string`: PGlyphString, new_len: gint){.cdecl, - dynlib: lib, importc: "pango_glyph_string_set_size".} -proc glyph_string_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_glyph_string_get_type".} -proc glyph_string_copy*(`string`: PGlyphString): PGlyphString{.cdecl, - dynlib: lib, importc: "pango_glyph_string_copy".} -proc glyph_string_free*(`string`: PGlyphString){.cdecl, dynlib: lib, - importc: "pango_glyph_string_free".} -proc extents*(glyphs: PGlyphString, font: PFont, - ink_rect: PRectangle, logical_rect: PRectangle){. - cdecl, dynlib: lib, importc: "pango_glyph_string_extents".} -proc extents_range*(glyphs: PGlyphString, start: int32, - theEnd: int32, font: PFont, - ink_rect: PRectangle, logical_rect: PRectangle){. - cdecl, dynlib: lib, importc: "pango_glyph_string_extents_range".} -proc get_logical_widths*(glyphs: PGlyphString, text: cstring, - length: int32, embedding_level: int32, - logical_widths: var int32){.cdecl, - dynlib: lib, importc: "pango_glyph_string_get_logical_widths".} -proc index_to_x*(glyphs: PGlyphString, text: cstring, - length: int32, analysis: PAnalysis, index: int32, - trailing: gboolean, x_pos: var int32){.cdecl, - dynlib: lib, importc: "pango_glyph_string_index_to_x".} -proc x_to_index*(glyphs: PGlyphString, text: cstring, - length: int32, analysis: PAnalysis, x_pos: int32, - index, trailing: var int32){.cdecl, dynlib: lib, - importc: "pango_glyph_string_x_to_index".} -proc shape*(text: cstring, length: gint, analysis: PAnalysis, - glyphs: PGlyphString){.cdecl, dynlib: lib, importc: "pango_shape".} -proc reorder_items*(logical_items: PGList): PGList{.cdecl, dynlib: lib, - importc: "pango_reorder_items".} -proc item_new*(): PItem{.cdecl, dynlib: lib, importc: "pango_item_new".} -proc copy*(item: PItem): PItem{.cdecl, dynlib: lib, - importc: "pango_item_copy".} -proc free*(item: PItem){.cdecl, dynlib: lib, importc: "pango_item_free".} -proc split*(orig: PItem, split_index: int32, split_offset: int32): PItem{. - cdecl, dynlib: lib, importc: "pango_item_split".} -proc TYPE_LAYOUT*(): GType -proc LAYOUT*(anObject: pointer): PLayout -proc LAYOUT_CLASS*(klass: pointer): PLayoutClass -proc IS_LAYOUT*(anObject: pointer): bool -proc IS_LAYOUT_CLASS*(klass: pointer): bool -proc GET_CLASS*(obj: PLayout): PLayoutClass -proc layout_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_layout_get_type".} -proc layout_new*(context: PContext): PLayout{.cdecl, dynlib: lib, - importc: "pango_layout_new".} -proc copy*(src: PLayout): PLayout{.cdecl, dynlib: lib, - importc: "pango_layout_copy".} -proc get_context*(layout: PLayout): PContext{.cdecl, dynlib: lib, - importc: "pango_layout_get_context".} -proc set_attributes*(layout: PLayout, attrs: PAttrList){.cdecl, - dynlib: lib, importc: "pango_layout_set_attributes".} -proc get_attributes*(layout: PLayout): PAttrList{.cdecl, dynlib: lib, - importc: "pango_layout_get_attributes".} -proc set_text*(layout: PLayout, text: cstring, length: int32){.cdecl, - dynlib: lib, importc: "pango_layout_set_text".} -proc get_text*(layout: PLayout): cstring{.cdecl, dynlib: lib, - importc: "pango_layout_get_text".} -proc set_markup*(layout: PLayout, markup: cstring, length: int32){.cdecl, - dynlib: lib, importc: "pango_layout_set_markup".} -proc set_markup*(layout: PLayout, markup: cstring, - length: int32, accel_marker: gunichar, - accel_char: Pgunichar){.cdecl, dynlib: lib, - importc: "pango_layout_set_markup_with_accel".} -proc set_font_description*(layout: PLayout, desc: PFontDescription){. - cdecl, dynlib: lib, importc: "pango_layout_set_font_description".} -proc set_width*(layout: PLayout, width: int32){.cdecl, dynlib: lib, - importc: "pango_layout_set_width".} -proc get_width*(layout: PLayout): int32{.cdecl, dynlib: lib, - importc: "pango_layout_get_width".} -proc set_wrap*(layout: PLayout, wrap: TWrapMode){.cdecl, dynlib: lib, - importc: "pango_layout_set_wrap".} -proc get_wrap*(layout: PLayout): TWrapMode{.cdecl, dynlib: lib, - importc: "pango_layout_get_wrap".} -proc set_indent*(layout: PLayout, indent: int32){.cdecl, dynlib: lib, - importc: "pango_layout_set_indent".} -proc get_indent*(layout: PLayout): int32{.cdecl, dynlib: lib, - importc: "pango_layout_get_indent".} -proc set_spacing*(layout: PLayout, spacing: int32){.cdecl, dynlib: lib, - importc: "pango_layout_set_spacing".} -proc get_spacing*(layout: PLayout): int32{.cdecl, dynlib: lib, - importc: "pango_layout_get_spacing".} -proc set_justify*(layout: PLayout, justify: gboolean){.cdecl, - dynlib: lib, importc: "pango_layout_set_justify".} -proc get_justify*(layout: PLayout): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_get_justify".} -proc set_alignment*(layout: PLayout, alignment: TAlignment){.cdecl, - dynlib: lib, importc: "pango_layout_set_alignment".} -proc get_alignment*(layout: PLayout): TAlignment{.cdecl, dynlib: lib, - importc: "pango_layout_get_alignment".} -proc set_tabs*(layout: PLayout, tabs: PTabArray){.cdecl, dynlib: lib, - importc: "pango_layout_set_tabs".} -proc get_tabs*(layout: PLayout): PTabArray{.cdecl, dynlib: lib, - importc: "pango_layout_get_tabs".} -proc set_single_paragraph_mode*(layout: PLayout, setting: gboolean){. - cdecl, dynlib: lib, importc: "pango_layout_set_single_paragraph_mode".} -proc get_single_paragraph_mode*(layout: PLayout): gboolean{.cdecl, - dynlib: lib, importc: "pango_layout_get_single_paragraph_mode".} -proc context_changed*(layout: PLayout){.cdecl, dynlib: lib, - importc: "pango_layout_context_changed".} -proc get_log_attrs*(layout: PLayout, attrs: var PLogAttr, n_attrs: Pgint){. - cdecl, dynlib: lib, importc: "pango_layout_get_log_attrs".} -proc index_to_pos*(layout: PLayout, index: int32, pos: PRectangle){. - cdecl, dynlib: lib, importc: "pango_layout_index_to_pos".} -proc get_cursor_pos*(layout: PLayout, index: int32, - strong_pos: PRectangle, weak_pos: PRectangle){. - cdecl, dynlib: lib, importc: "pango_layout_get_cursor_pos".} -proc move_cursor_visually*(layout: PLayout, strong: gboolean, - old_index: int32, old_trailing: int32, - direction: int32, - new_index, new_trailing: var int32){.cdecl, - dynlib: lib, importc: "pango_layout_move_cursor_visually".} -proc xy_to_index*(layout: PLayout, x: int32, y: int32, - index, trailing: var int32): gboolean{.cdecl, - dynlib: lib, importc: "pango_layout_xy_to_index".} -proc get_extents*(layout: PLayout, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, dynlib: lib, - importc: "pango_layout_get_extents".} -proc get_pixel_extents*(layout: PLayout, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, dynlib: lib, - importc: "pango_layout_get_pixel_extents".} -proc get_size*(layout: PLayout, width: var int32, height: var int32){. - cdecl, dynlib: lib, importc: "pango_layout_get_size".} -proc get_pixel_size*(layout: PLayout, width: var int32, height: var int32){. - cdecl, dynlib: lib, importc: "pango_layout_get_pixel_size".} -proc get_line_count*(layout: PLayout): int32{.cdecl, dynlib: lib, - importc: "pango_layout_get_line_count".} -proc get_line*(layout: PLayout, line: int32): PLayoutLine{.cdecl, - dynlib: lib, importc: "pango_layout_get_line".} -proc get_lines*(layout: PLayout): PGSList{.cdecl, dynlib: lib, - importc: "pango_layout_get_lines".} -proc reference*(line: PLayoutLine){.cdecl, dynlib: lib, - importc: "pango_layout_line_ref".} -proc unref*(line: PLayoutLine){.cdecl, dynlib: lib, - importc: "pango_layout_line_unref".} -proc x_to_index*(line: PLayoutLine, x_pos: int32, index: var int32, - trailing: var int32): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_line_x_to_index".} -proc index_to_x*(line: PLayoutLine, index: int32, - trailing: gboolean, x_pos: var int32){.cdecl, - dynlib: lib, importc: "pango_layout_line_index_to_x".} -proc get_extents*(line: PLayoutLine, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, dynlib: lib, - importc: "pango_layout_line_get_extents".} -proc get_pixel_extents*(layout_line: PLayoutLine, - ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, - dynlib: lib, importc: "pango_layout_line_get_pixel_extents".} -proc get_iter*(layout: PLayout): PLayoutIter{.cdecl, dynlib: lib, - importc: "pango_layout_get_iter".} -proc free*(iter: PLayoutIter){.cdecl, dynlib: lib, - importc: "pango_layout_iter_free".} -proc get_index*(iter: PLayoutIter): int32{.cdecl, dynlib: lib, - importc: "pango_layout_iter_get_index".} -proc get_run*(iter: PLayoutIter): PLayoutRun{.cdecl, dynlib: lib, - importc: "pango_layout_iter_get_run".} -proc get_line*(iter: PLayoutIter): PLayoutLine{.cdecl, dynlib: lib, - importc: "pango_layout_iter_get_line".} -proc at_last_line*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_iter_at_last_line".} -proc next_char*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_iter_next_char".} -proc next_cluster*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_iter_next_cluster".} -proc next_run*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_iter_next_run".} -proc next_line*(iter: PLayoutIter): gboolean{.cdecl, dynlib: lib, - importc: "pango_layout_iter_next_line".} -proc get_char_extents*(iter: PLayoutIter, logical_rect: PRectangle){. - cdecl, dynlib: lib, importc: "pango_layout_iter_get_char_extents".} -proc get_cluster_extents*(iter: PLayoutIter, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, - dynlib: lib, importc: "pango_layout_iter_get_cluster_extents".} -proc get_run_extents*(iter: PLayoutIter, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, dynlib: lib, - importc: "pango_layout_iter_get_run_extents".} -proc get_line_extents*(iter: PLayoutIter, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, - dynlib: lib, importc: "pango_layout_iter_get_line_extents".} -proc get_line_yrange*(iter: PLayoutIter, y0: var int32, - y1: var int32){.cdecl, dynlib: lib, - importc: "pango_layout_iter_get_line_yrange".} -proc get_layout_extents*(iter: PLayoutIter, ink_rect: PRectangle, - logical_rect: PRectangle){.cdecl, - dynlib: lib, importc: "pango_layout_iter_get_layout_extents".} -proc get_baseline*(iter: PLayoutIter): int32{.cdecl, dynlib: lib, - importc: "pango_layout_iter_get_baseline".} -proc TYPE_TAB_ARRAY*(): GType -proc tab_array_new*(initial_size: gint, positions_in_pixels: gboolean): PTabArray{. - cdecl, dynlib: lib, importc: "pango_tab_array_new".} -proc tab_array_get_type*(): GType{.cdecl, dynlib: lib, - importc: "pango_tab_array_get_type".} -proc copy*(src: PTabArray): PTabArray{.cdecl, dynlib: lib, - importc: "pango_tab_array_copy".} -proc free*(tab_array: PTabArray){.cdecl, dynlib: lib, - importc: "pango_tab_array_free".} -proc get_size*(tab_array: PTabArray): gint{.cdecl, dynlib: lib, - importc: "pango_tab_array_get_size".} -proc resize*(tab_array: PTabArray, new_size: gint){.cdecl, - dynlib: lib, importc: "pango_tab_array_resize".} -proc set_tab*(tab_array: PTabArray, tab_index: gint, - alignment: TTabAlign, location: gint){.cdecl, - dynlib: lib, importc: "pango_tab_array_set_tab".} -proc get_tab*(tab_array: PTabArray, tab_index: gint, - alignment: PTabAlign, location: Pgint){.cdecl, - dynlib: lib, importc: "pango_tab_array_get_tab".} -proc get_positions_in_pixels*(tab_array: PTabArray): gboolean{.cdecl, - dynlib: lib, importc: "pango_tab_array_get_positions_in_pixels".} -proc ASCENT*(rect: TRectangle): int32 = - result = -rect.y - -proc DESCENT*(rect: TRectangle): int32 = - result = (rect.y) + (rect.height) - -proc LBEARING*(rect: TRectangle): int32 = - result = rect.x - -proc RBEARING*(rect: TRectangle): int32 = - result = (rect.x) + (rect.width) - -proc TYPE_LANGUAGE*(): GType = - result = language_get_type() - -proc to_string*(language: PLanguage): cstring = - result = cast[cstring](language) - -proc PIXELS*(d: int): int = - if d >= 0: - result = (d + (SCALE div 2)) div SCALE - else: - result = (d - (SCALE div 2)) div SCALE - -proc TYPE_COLOR*(): GType = - result = color_get_type() - -proc TYPE_ATTR_LIST*(): GType = - result = attr_list_get_type() - -proc is_line_break*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_line_break) shr - bp_TPangoLogAttr_is_line_break - -proc set_is_line_break*(a: PLogAttr, `is_line_break`: guint) = - a.flag0 = a.flag0 or - (int16(`is_line_break` shl bp_TPangoLogAttr_is_line_break) and - bm_TPangoLogAttr_is_line_break) - -proc is_mandatory_break*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_mandatory_break) shr - bp_TPangoLogAttr_is_mandatory_break - -proc set_is_mandatory_break*(a: PLogAttr, `is_mandatory_break`: guint) = - a.flag0 = a.flag0 or - (int16(`is_mandatory_break` shl bp_TPangoLogAttr_is_mandatory_break) and - bm_TPangoLogAttr_is_mandatory_break) - -proc is_char_break*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_char_break) shr - bp_TPangoLogAttr_is_char_break - -proc set_is_char_break*(a: PLogAttr, `is_char_break`: guint) = - a.flag0 = a.flag0 or - (int16(`is_char_break` shl bp_TPangoLogAttr_is_char_break) and - bm_TPangoLogAttr_is_char_break) - -proc is_white*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_white) shr - bp_TPangoLogAttr_is_white - -proc set_is_white*(a: PLogAttr, `is_white`: guint) = - a.flag0 = a.flag0 or - (int16(`is_white` shl bp_TPangoLogAttr_is_white) and - bm_TPangoLogAttr_is_white) - -proc is_cursor_position*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_cursor_position) shr - bp_TPangoLogAttr_is_cursor_position - -proc set_is_cursor_position*(a: PLogAttr, `is_cursor_position`: guint) = - a.flag0 = a.flag0 or - (int16(`is_cursor_position` shl bp_TPangoLogAttr_is_cursor_position) and - bm_TPangoLogAttr_is_cursor_position) - -proc is_word_start*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_word_start) shr - bp_TPangoLogAttr_is_word_start - -proc set_is_word_start*(a: PLogAttr, `is_word_start`: guint) = - a.flag0 = a.flag0 or - (int16(`is_word_start` shl bp_TPangoLogAttr_is_word_start) and - bm_TPangoLogAttr_is_word_start) - -proc is_word_end*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_word_end) shr - bp_TPangoLogAttr_is_word_end - -proc set_is_word_end*(a: PLogAttr, `is_word_end`: guint) = - a.flag0 = a.flag0 or - (int16(`is_word_end` shl bp_TPangoLogAttr_is_word_end) and - bm_TPangoLogAttr_is_word_end) - -proc is_sentence_boundary*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_sentence_boundary) shr - bp_TPangoLogAttr_is_sentence_boundary - -proc set_is_sentence_boundary*(a: PLogAttr, `is_sentence_boundary`: guint) = - a.flag0 = a.flag0 or - (int16(`is_sentence_boundary` shl bp_TPangoLogAttr_is_sentence_boundary) and - bm_TPangoLogAttr_is_sentence_boundary) - -proc is_sentence_start*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_sentence_start) shr - bp_TPangoLogAttr_is_sentence_start - -proc set_is_sentence_start*(a: PLogAttr, `is_sentence_start`: guint) = - a.flag0 = a.flag0 or - (int16(`is_sentence_start` shl bp_TPangoLogAttr_is_sentence_start) and - bm_TPangoLogAttr_is_sentence_start) - -proc is_sentence_end*(a: PLogAttr): guint = - result = (a.flag0 and bm_TPangoLogAttr_is_sentence_end) shr - bp_TPangoLogAttr_is_sentence_end - -proc set_is_sentence_end*(a: PLogAttr, `is_sentence_end`: guint) = - a.flag0 = a.flag0 or - (int16(`is_sentence_end` shl bp_TPangoLogAttr_is_sentence_end) and - bm_TPangoLogAttr_is_sentence_end) - -proc TYPE_CONTEXT*(): GType = - result = context_get_type() - -proc CONTEXT*(anObject: pointer): PContext = - result = cast[PContext](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_CONTEXT())) - -proc CONTEXT_CLASS*(klass: pointer): PContextClass = - result = cast[PContextClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_CONTEXT())) - -proc IS_CONTEXT*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_CONTEXT()) - -proc IS_CONTEXT_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_CONTEXT()) - -proc GET_CLASS*(obj: PContext): PContextClass = - result = cast[PContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_CONTEXT())) - -proc TYPE_FONTSET*(): GType = - result = fontset_get_type() - -proc FONTSET*(anObject: pointer): PFontset = - result = cast[PFontset](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONTSET())) - -proc IS_FONTSET*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONTSET()) - -proc FONTSET_CLASS*(klass: pointer): PFontsetClass = - result = cast[PFontsetClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONTSET())) - -proc IS_FONTSET_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONTSET()) - -proc GET_CLASS*(obj: PFontset): PFontsetClass = - result = cast[PFontsetClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONTSET())) - -proc fontset_simple_get_type(): GType{.importc: "pango_fontset_simple_get_type", - cdecl, dynlib: lib.} -proc TYPE_FONTSET_SIMPLE*(): GType = - result = fontset_simple_get_type() - -proc FONTSET_SIMPLE*(anObject: pointer): PFontsetSimple = - result = cast[PFontsetSimple](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_FONTSET_SIMPLE())) - -proc IS_FONTSET_SIMPLE*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONTSET_SIMPLE()) - -proc TYPE_FONT_DESCRIPTION*(): GType = - result = font_description_get_type() - -proc TYPE_FONT_METRICS*(): GType = - result = font_metrics_get_type() - -proc TYPE_FONT_FAMILY*(): GType = - result = font_family_get_type() - -proc FONT_FAMILY*(anObject: pointer): PFontFamily = - result = cast[PFontFamily](G_TYPE_CHECK_INSTANCE_CAST(anObject, - TYPE_FONT_FAMILY())) - -proc IS_FONT_FAMILY*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT_FAMILY()) - -proc FONT_FAMILY_CLASS*(klass: Pointer): PFontFamilyClass = - result = cast[PFontFamilyClass](G_TYPE_CHECK_CLASS_CAST(klass, - TYPE_FONT_FAMILY())) - -proc IS_FONT_FAMILY_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT_FAMILY()) - -proc GET_CLASS*(obj: PFontFamily): PFontFamilyClass = - result = cast[PFontFamilyClass](G_TYPE_INSTANCE_GET_CLASS(obj, - TYPE_FONT_FAMILY())) - -proc TYPE_FONT_FACE*(): GType = - result = font_face_get_type() - -proc FONT_FACE*(anObject: Pointer): PFontFace = - result = cast[PFontFace](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONT_FACE())) - -proc IS_FONT_FACE*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT_FACE()) - -proc FONT_FACE_CLASS*(klass: Pointer): PFontFaceClass = - result = cast[PFontFaceClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONT_FACE())) - -proc IS_FONT_FACE_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT_FACE()) - -proc FONT_FACE_GET_CLASS*(obj: Pointer): PFontFaceClass = - result = cast[PFontFaceClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONT_FACE())) - -proc TYPE_FONT*(): GType = - result = font_get_type() - -proc FONT*(anObject: Pointer): PFont = - result = cast[PFont](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONT())) - -proc IS_FONT*(anObject: Pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT()) - -proc FONT_CLASS*(klass: Pointer): PFontClass = - result = cast[PFontClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONT())) - -proc IS_FONT_CLASS*(klass: Pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT()) - -proc GET_CLASS*(obj: PFont): PFontClass = - result = cast[PFontClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONT())) - -proc TYPE_FONT_MAP*(): GType = - result = font_map_get_type() - -proc FONT_MAP*(anObject: pointer): PFontmap = - result = cast[PFontmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_FONT_MAP())) - -proc IS_FONT_MAP*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_FONT_MAP()) - -proc FONT_MAP_CLASS*(klass: pointer): PFontMapClass = - result = cast[PFontMapClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_FONT_MAP())) - -proc IS_FONT_MAP_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_FONT_MAP()) - -proc GET_CLASS*(obj: PFontMap): PFontMapClass = - result = cast[PFontMapClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_FONT_MAP())) - -proc is_cluster_start*(a: PGlyphVisAttr): guint = - result = (a.flag0 and bm_TPangoGlyphVisAttr_is_cluster_start) shr - bp_TPangoGlyphVisAttr_is_cluster_start - -proc set_is_cluster_start*(a: PGlyphVisAttr, `is_cluster_start`: guint) = - a.flag0 = a.flag0 or - (int16(`is_cluster_start` shl bp_TPangoGlyphVisAttr_is_cluster_start) and - bm_TPangoGlyphVisAttr_is_cluster_start) - -proc TYPE_GLYPH_STRING*(): GType = - result = glyph_string_get_type() - -proc TYPE_LAYOUT*(): GType = - result = layout_get_type() - -proc LAYOUT*(anObject: pointer): PLayout = - result = cast[PLayout](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_LAYOUT())) - -proc LAYOUT_CLASS*(klass: pointer): PLayoutClass = - result = cast[PLayoutClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_LAYOUT())) - -proc IS_LAYOUT*(anObject: pointer): bool = - result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_LAYOUT()) - -proc IS_LAYOUT_CLASS*(klass: pointer): bool = - result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_LAYOUT()) - -proc GET_CLASS*(obj: PLayout): PLayoutClass = - result = cast[PLayoutClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_LAYOUT())) - -proc TYPE_TAB_ARRAY*(): GType = - result = tab_array_get_type() diff --git a/lib/wrappers/gtk/pangoutils.nim b/lib/wrappers/gtk/pangoutils.nim deleted file mode 100644 index 240273b11..000000000 --- a/lib/wrappers/gtk/pangoutils.nim +++ /dev/null @@ -1,42 +0,0 @@ -{.deadCodeElim: on.} -import - glib2, pango - -proc split_file_list*(str: cstring): PPchar{.cdecl, dynlib: lib, - importc: "pango_split_file_list".} -proc trim_string*(str: cstring): cstring{.cdecl, dynlib: lib, - importc: "pango_trim_string".} -proc read_line*(stream: TFile, str: PGString): gint{.cdecl, dynlib: lib, - importc: "pango_read_line".} -proc skip_space*(pos: PPchar): gboolean{.cdecl, dynlib: lib, - importc: "pango_skip_space".} -proc scan_word*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, dynlib: lib, - importc: "pango_scan_word".} -proc scan_string*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, dynlib: lib, - importc: "pango_scan_string".} -proc scan_int*(pos: PPchar, OutInt: ptr int32): gboolean{.cdecl, dynlib: lib, - importc: "pango_scan_int".} -proc config_key_get*(key: cstring): cstring{.cdecl, dynlib: lib, - importc: "pango_config_key_get".} -proc lookup_aliases*(fontname: cstring, families: PPPchar, n_families: ptr int32){. - cdecl, dynlib: lib, importc: "pango_lookup_aliases".} -proc parse_style*(str: cstring, style: PStyle, warn: gboolean): gboolean{.cdecl, - dynlib: lib, importc: "pango_parse_style".} -proc parse_variant*(str: cstring, variant: PVariant, warn: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "pango_parse_variant".} -proc parse_weight*(str: cstring, weight: PWeight, warn: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "pango_parse_weight".} -proc parse_stretch*(str: cstring, stretch: PStretch, warn: gboolean): gboolean{. - cdecl, dynlib: lib, importc: "pango_parse_stretch".} -proc get_sysconf_subdirectory*(): cstring{.cdecl, dynlib: lib, - importc: "pango_get_sysconf_subdirectory".} -proc get_lib_subdirectory*(): cstring{.cdecl, dynlib: lib, - importc: "pango_get_lib_subdirectory".} -proc log2vis_get_embedding_levels*(str: Pgunichar, len: int32, - pbase_dir: PDirection, - embedding_level_list: Pguint8): gboolean{. - cdecl, dynlib: lib, importc: "pango_log2vis_get_embedding_levels".} -proc get_mirror_char*(ch: gunichar, mirrored_ch: Pgunichar): gboolean{.cdecl, - dynlib: lib, importc: "pango_get_mirror_char".} -proc get_sample_string*(language: PLanguage): cstring{.cdecl, - dynlib: lib, importc: "pango_language_get_sample_string".} diff --git a/lib/wrappers/libffi/common/ffi.h b/lib/wrappers/libffi/common/ffi.h new file mode 100644 index 000000000..07d650eac --- /dev/null +++ b/lib/wrappers/libffi/common/ffi.h @@ -0,0 +1,331 @@ +/* -----------------------------------------------------------------*-C-*- + libffi 2.00-beta - Copyright (c) 1996-2003 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +//XXX #define X86 + +/* ---- System configuration information --------------------------------- */ + +#include <ffitarget.h> + +#ifndef LIBFFI_ASM + +#include <stddef.h> +#include <limits.h> + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# ifdef _MSC_VER +# define FFI_LONG_LONG_MAX _I64_MAX +# endif +# endif +#endif + +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#define ffi_type_ulong ffi_type_uint64 +#define ffi_type_slong ffi_type_sint64 +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != 9223372036854775807 + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != 9223372036854775807 + #error "long size not supported" +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + /*@null@*/ struct _ffi_type **elements; +} ffi_type; + +/* These are defined in types.c */ +extern const ffi_type ffi_type_void; +extern const ffi_type ffi_type_uint8; +extern const ffi_type ffi_type_sint8; +extern const ffi_type ffi_type_uint16; +extern const ffi_type ffi_type_sint16; +extern const ffi_type ffi_type_uint32; +extern const ffi_type ffi_type_sint32; +extern const ffi_type ffi_type_uint64; +extern const ffi_type ffi_type_sint64; +extern const ffi_type ffi_type_float; +extern const ffi_type ffi_type_double; +extern const ffi_type ffi_type_longdouble; +extern const ffi_type ffi_type_pointer; + + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + /*@dependent@*/ ffi_type **arg_types; + /*@dependent@*/ ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifdef _WIN64 +#define FFI_SIZEOF_ARG 8 +#else +#define FFI_SIZEOF_ARG 4 +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ ffi_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +} ffi_closure; + +void ffi_closure_free(void *); +void *ffi_closure_alloc (size_t size, void **code); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc); + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, + /*@dependent@*/ ffi_type **atypes); + +void +ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)())f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 1 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#define FFI_HIDDEN /* no idea what the origial definition looks like ... */ + +#ifdef __GNUC__ +# define LIKELY(x) __builtin_expect(x, 1) +# define UNLIKELY(x) __builtin_expect(x, 0) +#else +# define LIKELY(x) (x) +# define UNLIKELY(x) (x) +#endif + +#define MAYBE_UNUSED + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/lib/wrappers/libffi/common/ffi_common.h b/lib/wrappers/libffi/common/ffi_common.h new file mode 100644 index 000000000..43fb83b48 --- /dev/null +++ b/lib/wrappers/libffi/common/ffi_common.h @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- + ffi_common.h - Copyright (c) 1996 Red Hat, Inc. + + Common internal definitions and macros. Only necessary for building + libffi. + ----------------------------------------------------------------------- */ + +#ifndef FFI_COMMON_H +#define FFI_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <fficonfig.h> +#include <malloc.h> + +/* Check for the existence of memcpy. */ +#if STDC_HEADERS +# include <string.h> +#else +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#if defined(FFI_DEBUG) +#include <stdio.h> +#endif + +#ifdef FFI_DEBUG +/*@exits@*/ void ffi_assert(/*@temp@*/ char *expr, /*@temp@*/ char *file, int line); +void ffi_stop_here(void); +void ffi_type_test(/*@temp@*/ /*@out@*/ ffi_type *a, /*@temp@*/ char *file, int line); + +#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) +#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) +#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) +#else +#define FFI_ASSERT(x) +#define FFI_ASSERT_AT(x, f, l) +#define FFI_ASSERT_VALID_TYPE(x) +#endif + +#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif); + +/* Extended cif, used in callback from assembly routine */ +typedef struct +{ + /*@dependent@*/ ffi_cif *cif; + /*@dependent@*/ void *rvalue; + /*@dependent@*/ void **avalue; +} extended_cif; + +/* Terse sized type definitions. */ +typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); +typedef signed int SINT8 __attribute__((__mode__(__QI__))); +typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); +typedef signed int SINT16 __attribute__((__mode__(__HI__))); +typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); +typedef signed int SINT32 __attribute__((__mode__(__SI__))); +typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); +typedef signed int SINT64 __attribute__((__mode__(__DI__))); + +typedef float FLOAT32; + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/lib/wrappers/libffi/common/fficonfig.h b/lib/wrappers/libffi/common/fficonfig.h new file mode 100644 index 000000000..c14f653ec --- /dev/null +++ b/lib/wrappers/libffi/common/fficonfig.h @@ -0,0 +1,96 @@ +/* fficonfig.h. Originally created by configure, now hand_maintained for MSVC. */ + +/* fficonfig.h. Generated automatically by configure. */ +/* fficonfig.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define this for MSVC, but not for mingw32! */ +#ifdef _MSC_VER +#define __attribute__(x) /* */ +#endif +#define alloca _alloca + +/*----------------------------------------------------------------*/ + +/* Define if using alloca.c. */ +/* #undef C_ALLOCA */ + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +/* #undef CRAY_STACKSEG_END */ + +/* Define if you have alloca, as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +/* #define HAVE_ALLOCA_H 1 */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +/* #undef STACK_DIRECTION */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if read-only mmap of a plain file works. */ +//#define HAVE_MMAP_FILE 1 + +/* Define if mmap of /dev/zero works. */ +//#define HAVE_MMAP_DEV_ZERO 1 + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +//#define HAVE_MMAP_ANON 1 + +/* The number of bytes in type double */ +#define SIZEOF_DOUBLE 8 + +/* The number of bytes in type long double */ +#define SIZEOF_LONG_DOUBLE 12 + +/* Define if you have the long double type and it is bigger than a double */ +#define HAVE_LONG_DOUBLE 1 + +/* whether byteorder is bigendian */ +/* #undef WORDS_BIGENDIAN */ + +/* Define if the host machine stores words of multi-word integers in + big-endian order. */ +/* #undef HOST_WORDS_BIG_ENDIAN */ + +/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +#define BYTEORDER 1234 + +/* Define if your assembler and linker support unaligned PC relative relocs. */ +/* #undef HAVE_AS_SPARC_UA_PCREL */ + +/* Define if your assembler supports .register. */ +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ + +/* Define if .eh_frame sections should be read-only. */ +/* #undef HAVE_RO_EH_FRAME */ + +/* Define to the flags needed for the .section .eh_frame directive. */ +/* #define EH_FRAME_FLAGS "aw" */ + +/* Define to the flags needed for the .section .eh_frame directive. */ +/* #define EH_FRAME_FLAGS "aw" */ + +/* Define this if you want extra debugging. */ +/* #undef FFI_DEBUG */ + +/* Define this is you do not want support for aggregate types. */ +/* #undef FFI_NO_STRUCTS */ + +/* Define this is you do not want support for the raw API. */ +/* #undef FFI_NO_RAW_API */ + +/* Define this if you are using Purify and want to suppress spurious messages. */ +/* #undef USING_PURIFY */ + diff --git a/lib/wrappers/libffi/common/ffitarget.h b/lib/wrappers/libffi/common/ffitarget.h new file mode 100644 index 000000000..d8d60f2e7 --- /dev/null +++ b/lib/wrappers/libffi/common/ffitarget.h @@ -0,0 +1,150 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003, 2010 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + Target configuration macros for x86 and x86-64. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +/* ---- System specific configurations ----------------------------------- */ + +/* For code common to all platforms on x86 and x86_64. */ +#define X86_ANY + +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) +# if defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) +# define X86_64 +# define X86_WIN64 +# else +# define X86_32 +# define X86_WIN32 +# endif +#endif + +#if defined (X86_64) && defined (__i386__) +#undef X86_64 +#define X86 +#endif + +#ifdef X86_WIN64 +#define FFI_SIZEOF_ARG 8 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ +#endif + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +#ifdef X86_WIN64 +#ifdef _MSC_VER +typedef unsigned __int64 ffi_arg; +typedef __int64 ffi_sarg; +#else +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#endif +#else +#if defined __x86_64__ && defined __ILP32__ +#define FFI_SIZEOF_ARG 8 +#define FFI_SIZEOF_JAVA_RAW 4 +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#else +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; +#endif +#endif + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + + /* ---- Intel x86 Win32 ---------- */ +#ifdef X86_WIN32 + FFI_SYSV, + FFI_STDCALL, + FFI_THISCALL, + FFI_FASTCALL, + FFI_MS_CDECL, + FFI_LAST_ABI, +#ifdef _MSC_VER + FFI_DEFAULT_ABI = FFI_MS_CDECL +#else + FFI_DEFAULT_ABI = FFI_SYSV +#endif + +#elif defined(X86_WIN64) + FFI_WIN64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_WIN64 + +#else + /* ---- Intel x86 and AMD x86-64 - */ + FFI_SYSV, + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ + FFI_LAST_ABI, +#if defined(__i386__) || defined(__i386) + FFI_DEFAULT_ABI = FFI_SYSV +#else + FFI_DEFAULT_ABI = FFI_UNIX64 +#endif +#endif +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) +#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) +#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) +#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) + +#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 +#else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 52 +#else +#ifdef X86_WIN64 +#define FFI_TRAMPOLINE_SIZE 29 +#define FFI_NATIVE_RAW_API 0 +#define FFI_NO_RAW_API 1 +#else +#define FFI_TRAMPOLINE_SIZE 10 +#endif +#endif +#ifndef X86_WIN64 +#define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ +#endif +#endif + +#endif + diff --git a/lib/wrappers/libffi/common/malloc_closure.c b/lib/wrappers/libffi/common/malloc_closure.c new file mode 100644 index 000000000..5b33aa4ca --- /dev/null +++ b/lib/wrappers/libffi/common/malloc_closure.c @@ -0,0 +1,110 @@ +#include <ffi.h> +#ifdef MS_WIN32 +#include <windows.h> +#else +#include <sys/mman.h> +#include <unistd.h> +# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif +#include "ctypes.h" + +/* BLOCKSIZE can be adjusted. Larger blocksize will take a larger memory + overhead, but allocate less blocks from the system. It may be that some + systems have a limit of how many mmap'd blocks can be open. +*/ + +#define BLOCKSIZE _pagesize + +/* #define MALLOC_CLOSURE_DEBUG */ /* enable for some debugging output */ + +/******************************************************************/ + +typedef union _tagITEM { + ffi_closure closure; + union _tagITEM *next; +} ITEM; + +static ITEM *free_list; +static int _pagesize; + +static void more_core(void) +{ + ITEM *item; + int count, i; + +/* determine the pagesize */ +#ifdef MS_WIN32 + if (!_pagesize) { + SYSTEM_INFO systeminfo; + GetSystemInfo(&systeminfo); + _pagesize = systeminfo.dwPageSize; + } +#else + if (!_pagesize) { +#ifdef _SC_PAGESIZE + _pagesize = sysconf(_SC_PAGESIZE); +#else + _pagesize = getpagesize(); +#endif + } +#endif + + /* calculate the number of nodes to allocate */ + count = BLOCKSIZE / sizeof(ITEM); + + /* allocate a memory block */ +#ifdef MS_WIN32 + item = (ITEM *)VirtualAlloc(NULL, + count * sizeof(ITEM), + MEM_COMMIT, + PAGE_EXECUTE_READWRITE); + if (item == NULL) + return; +#else + item = (ITEM *)mmap(NULL, + count * sizeof(ITEM), + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, + -1, + 0); + if (item == (void *)MAP_FAILED) + return; +#endif + +#ifdef MALLOC_CLOSURE_DEBUG + printf("block at %p allocated (%d bytes), %d ITEMs\n", + item, count * sizeof(ITEM), count); +#endif + /* put them into the free list */ + for (i = 0; i < count; ++i) { + item->next = free_list; + free_list = item; + ++item; + } +} + +/******************************************************************/ + +/* put the item back into the free list */ +void ffi_closure_free(void *p) +{ + ITEM *item = (ITEM *)p; + item->next = free_list; + free_list = item; +} + +/* return one item from the free list, allocating more if needed */ +void *ffi_closure_alloc(size_t ignored, void** codeloc) +{ + ITEM *item; + if (!free_list) + more_core(); + if (!free_list) + return NULL; + item = free_list; + free_list = item->next; + *codeloc = (void *)item; + return (void *)item; +} diff --git a/lib/wrappers/libffi/common/raw_api.c b/lib/wrappers/libffi/common/raw_api.c new file mode 100644 index 000000000..ce21372e2 --- /dev/null +++ b/lib/wrappers/libffi/common/raw_api.c @@ -0,0 +1,254 @@ +/* ----------------------------------------------------------------------- + raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. + + Author: Kresten Krab Thorup <krab@gnu.org> + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* This file defines generic functions for use with the raw api. */ + +#include <ffi.h> +#include <ffi_common.h> + +#if !FFI_NO_RAW_API + +size_t +ffi_raw_size (ffi_cif *cif) +{ + size_t result = 0; + int i; + + ffi_type **at = cif->arg_types; + + for (i = cif->nargs-1; i >= 0; i--, at++) + { +#if !FFI_NO_STRUCTS + if ((*at)->type == FFI_TYPE_STRUCT) + result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); + else +#endif + result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); + } + + return result; +} + + +void +ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + +#if WORDS_BIGENDIAN + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); + break; + +#if FFI_SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); + break; +#endif + +#if !FFI_NO_STRUCTS + case FFI_TYPE_STRUCT: + *args = (raw++)->ptr; + break; +#endif + + case FFI_TYPE_POINTER: + *args = (void*) &(raw++)->ptr; + break; + + default: + *args = raw; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } + +#else /* WORDS_BIGENDIAN */ + +#if !PDP + + /* then assume little endian */ + for (i = 0; i < cif->nargs; i++, tp++, args++) + { +#if !FFI_NO_STRUCTS + if ((*tp)->type == FFI_TYPE_STRUCT) + { + *args = (raw++)->ptr; + } + else +#endif + { + *args = (void*) raw; + raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); + } + } + +#else +#error "pdp endian not supported" +#endif /* ! PDP */ + +#endif /* WORDS_BIGENDIAN */ +} + +void +ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + (raw++)->uint = *(UINT8*) (*args); + break; + + case FFI_TYPE_SINT8: + (raw++)->sint = *(SINT8*) (*args); + break; + + case FFI_TYPE_UINT16: + (raw++)->uint = *(UINT16*) (*args); + break; + + case FFI_TYPE_SINT16: + (raw++)->sint = *(SINT16*) (*args); + break; + +#if FFI_SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + (raw++)->uint = *(UINT32*) (*args); + break; + + case FFI_TYPE_SINT32: + (raw++)->sint = *(SINT32*) (*args); + break; +#endif + +#if !FFI_NO_STRUCTS + case FFI_TYPE_STRUCT: + (raw++)->ptr = *args; + break; +#endif + + case FFI_TYPE_POINTER: + (raw++)->ptr = **(void***) args; + break; + + default: + memcpy ((void*) raw->data, (void*)*args, (*tp)->size); + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } +} + +#if !FFI_NATIVE_RAW_API + + +/* This is a generic definition of ffi_raw_call, to be used if the + * native system does not provide a machine-specific implementation. + * Having this, allows code to be written for the raw API, without + * the need for system-specific code to handle input in that format; + * these following couple of functions will handle the translation forth + * and back automatically. */ + +void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) +{ + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + ffi_raw_to_ptrarray (cif, raw, avalue); + ffi_call (cif, fn, rvalue, avalue); +} + +#if FFI_CLOSURES /* base system provides closures */ + +static void +ffi_translate_args (ffi_cif *cif, void *rvalue, + void **avalue, void *user_data) +{ + ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); + ffi_raw_closure *cl = (ffi_raw_closure*)user_data; + + ffi_ptrarray_to_raw (cif, avalue, raw); + (*cl->fun) (cif, rvalue, raw, cl->user_data); +} + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc) +{ + ffi_status status; + + status = ffi_prep_closure_loc ((ffi_closure*) cl, + cif, + &ffi_translate_args, + codeloc, + codeloc); + if (status == FFI_OK) + { + cl->fun = fun; + cl->user_data = user_data; + } + + return status; +} + +#endif /* FFI_CLOSURES */ +#endif /* !FFI_NATIVE_RAW_API */ + +#if FFI_CLOSURES + +/* Again, here is the generic version of ffi_prep_raw_closure, which + * will install an intermediate "hub" for translation of arguments from + * the pointer-array format, to the raw format */ + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data) +{ + return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); +} + +#endif /* FFI_CLOSURES */ + +#endif /* !FFI_NO_RAW_API */ diff --git a/lib/wrappers/libffi/gcc/closures.c b/lib/wrappers/libffi/gcc/closures.c new file mode 100644 index 000000000..c0ee06891 --- /dev/null +++ b/lib/wrappers/libffi/gcc/closures.c @@ -0,0 +1,627 @@ +/* ----------------------------------------------------------------------- + closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc + Copyright (c) 2011 Plausible Labs Cooperative, Inc. + + Code to allocate and deallocate memory for closures. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#if defined __linux__ && !defined _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include <ffi.h> +#include <ffi_common.h> + +#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE +# if __gnu_linux__ +/* This macro indicates it may be forbidden to map anonymous memory + with both write and execute permission. Code compiled when this + option is defined will attempt to map such pages once, but if it + fails, it falls back to creating a temporary file in a writable and + executable filesystem and mapping pages from it into separate + locations in the virtual memory space, one location writable and + another executable. */ +# define FFI_MMAP_EXEC_WRIT 1 +# define HAVE_MNTENT 1 +# endif +# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) +/* Windows systems may have Data Execution Protection (DEP) enabled, + which requires the use of VirtualMalloc/VirtualFree to alloc/free + executable memory. */ +# define FFI_MMAP_EXEC_WRIT 1 +# endif +#endif + +#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX +# ifdef __linux__ +/* When defined to 1 check for SELinux and if SELinux is active, + don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that + might cause audit messages. */ +# define FFI_MMAP_EXEC_SELINUX 1 +# endif +#endif + +#if FFI_CLOSURES + +# if FFI_EXEC_TRAMPOLINE_TABLE + +// Per-target implementation; It's unclear what can reasonable be shared +// between two OS/architecture implementations. + +# elif FFI_MMAP_EXEC_WRIT /* !FFI_EXEC_TRAMPOLINE_TABLE */ + +#define USE_LOCKS 1 +#define USE_DL_PREFIX 1 +#ifdef __GNUC__ +#ifndef USE_BUILTIN_FFS +#define USE_BUILTIN_FFS 1 +#endif +#endif + +/* We need to use mmap, not sbrk. */ +#define HAVE_MORECORE 0 + +/* We could, in theory, support mremap, but it wouldn't buy us anything. */ +#define HAVE_MREMAP 0 + +/* We have no use for this, so save some code and data. */ +#define NO_MALLINFO 1 + +/* We need all allocations to be in regular segments, otherwise we + lose track of the corresponding code address. */ +#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T + +/* Don't allocate more than a page unless needed. */ +#define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize) + +#if FFI_CLOSURE_TEST +/* Don't release single pages, to avoid a worst-case scenario of + continuously allocating and releasing single pages, but release + pairs of pages, which should do just as well given that allocations + are likely to be small. */ +#define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize) +#endif + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#ifndef _MSC_VER +#include <unistd.h> +#endif +#include <string.h> +#include <stdio.h> +#if !defined(X86_WIN32) && !defined(X86_WIN64) +#ifdef HAVE_MNTENT +#include <mntent.h> +#endif /* HAVE_MNTENT */ +#include <sys/param.h> +#include <pthread.h> + +/* We don't want sys/mman.h to be included after we redefine mmap and + dlmunmap. */ +#include <sys/mman.h> +#define LACKS_SYS_MMAN_H 1 + +#if FFI_MMAP_EXEC_SELINUX +#include <sys/statfs.h> +#include <stdlib.h> + +static int selinux_enabled = -1; + +static int +selinux_enabled_check (void) +{ + struct statfs sfs; + FILE *f; + char *buf = NULL; + size_t len = 0; + + if (statfs ("/selinux", &sfs) >= 0 + && (unsigned int) sfs.f_type == 0xf97cff8cU) + return 1; + f = fopen ("/proc/mounts", "r"); + if (f == NULL) + return 0; + while (getline (&buf, &len, f) >= 0) + { + char *p = strchr (buf, ' '); + if (p == NULL) + break; + p = strchr (p + 1, ' '); + if (p == NULL) + break; + if (strncmp (p + 1, "selinuxfs ", 10) == 0) + { + free (buf); + fclose (f); + return 1; + } + } + free (buf); + fclose (f); + return 0; +} + +#define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \ + : (selinux_enabled = selinux_enabled_check ())) + +#else + +#define is_selinux_enabled() 0 + +#endif /* !FFI_MMAP_EXEC_SELINUX */ + +/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ +#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX +#include <stdlib.h> + +static int emutramp_enabled = -1; + +static int +emutramp_enabled_check (void) +{ + if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL) + return 1; + else + return 0; +} + +#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ + : (emutramp_enabled = emutramp_enabled_check ())) +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + +#elif defined (__CYGWIN__) || defined(__INTERIX) + +#include <sys/mman.h> + +/* Cygwin is Linux-like, but not quite that Linux-like. */ +#define is_selinux_enabled() 0 + +#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ + +#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX +#define is_emutramp_enabled() 0 +#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ + +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) +/* Use these for mmap and munmap within dlmalloc.c. */ +static void *dlmmap(void *, size_t, int, int, int, off_t); +static int dlmunmap(void *, size_t); +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ + +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) + +/* A mutex used to synchronize access to *exec* variables in this file. */ +static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* A file descriptor of a temporary file from which we'll map + executable pages. */ +static int execfd = -1; + +/* The amount of space already allocated from the temporary file. */ +static size_t execsize = 0; + +/* Open a temporary file name, and immediately unlink it. */ +static int +open_temp_exec_file_name (char *name) +{ + int fd = mkstemp (name); + + if (fd != -1) + unlink (name); + + return fd; +} + +/* Open a temporary file in the named directory. */ +static int +open_temp_exec_file_dir (const char *dir) +{ + static const char suffix[] = "/ffiXXXXXX"; + int lendir = strlen (dir); + char *tempname = __builtin_alloca (lendir + sizeof (suffix)); + + if (!tempname) + return -1; + + memcpy (tempname, dir, lendir); + memcpy (tempname + lendir, suffix, sizeof (suffix)); + + return open_temp_exec_file_name (tempname); +} + +/* Open a temporary file in the directory in the named environment + variable. */ +static int +open_temp_exec_file_env (const char *envvar) +{ + const char *value = getenv (envvar); + + if (!value) + return -1; + + return open_temp_exec_file_dir (value); +} + +#ifdef HAVE_MNTENT +/* Open a temporary file in an executable and writable mount point + listed in the mounts file. Subsequent calls with the same mounts + keep searching for mount points in the same file. Providing NULL + as the mounts file closes the file. */ +static int +open_temp_exec_file_mnt (const char *mounts) +{ + static const char *last_mounts; + static FILE *last_mntent; + + if (mounts != last_mounts) + { + if (last_mntent) + endmntent (last_mntent); + + last_mounts = mounts; + + if (mounts) + last_mntent = setmntent (mounts, "r"); + else + last_mntent = NULL; + } + + if (!last_mntent) + return -1; + + for (;;) + { + int fd; + struct mntent mnt; + char buf[MAXPATHLEN * 3]; + + if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)) == NULL) + return -1; + + if (hasmntopt (&mnt, "ro") + || hasmntopt (&mnt, "noexec") + || access (mnt.mnt_dir, W_OK)) + continue; + + fd = open_temp_exec_file_dir (mnt.mnt_dir); + + if (fd != -1) + return fd; + } +} +#endif /* HAVE_MNTENT */ + +/* Instructions to look for a location to hold a temporary file that + can be mapped in for execution. */ +static struct +{ + int (*func)(const char *); + const char *arg; + int repeat; +} open_temp_exec_file_opts[] = { + { open_temp_exec_file_env, "TMPDIR", 0 }, + { open_temp_exec_file_dir, "/tmp", 0 }, + { open_temp_exec_file_dir, "/var/tmp", 0 }, + { open_temp_exec_file_dir, "/dev/shm", 0 }, + { open_temp_exec_file_env, "HOME", 0 }, +#ifdef HAVE_MNTENT + { open_temp_exec_file_mnt, "/etc/mtab", 1 }, + { open_temp_exec_file_mnt, "/proc/mounts", 1 }, +#endif /* HAVE_MNTENT */ +}; + +/* Current index into open_temp_exec_file_opts. */ +static int open_temp_exec_file_opts_idx = 0; + +/* Reset a current multi-call func, then advances to the next entry. + If we're at the last, go back to the first and return nonzero, + otherwise return zero. */ +static int +open_temp_exec_file_opts_next (void) +{ + if (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) + open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL); + + open_temp_exec_file_opts_idx++; + if (open_temp_exec_file_opts_idx + == (sizeof (open_temp_exec_file_opts) + / sizeof (*open_temp_exec_file_opts))) + { + open_temp_exec_file_opts_idx = 0; + return 1; + } + + return 0; +} + +/* Return a file descriptor of a temporary zero-sized file in a + writable and exexutable filesystem. */ +static int +open_temp_exec_file (void) +{ + int fd; + + do + { + fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func + (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].arg); + + if (!open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat + || fd == -1) + { + if (open_temp_exec_file_opts_next ()) + break; + } + } + while (fd == -1); + + return fd; +} + +/* Map in a chunk of memory from the temporary exec file into separate + locations in the virtual memory address space, one writable and one + executable. Returns the address of the writable portion, after + storing an offset to the corresponding executable portion at the + last word of the requested chunk. */ +static void * +dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) +{ + void *ptr; + + if (execfd == -1) + { + open_temp_exec_file_opts_idx = 0; + retry_open: + execfd = open_temp_exec_file (); + if (execfd == -1) + return MFAIL; + } + + offset = execsize; + + if (ftruncate (execfd, offset + length)) + return MFAIL; + + flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); + flags |= MAP_SHARED; + + ptr = mmap (NULL, length, (prot & ~PROT_WRITE) | PROT_EXEC, + flags, execfd, offset); + if (ptr == MFAIL) + { + if (!offset) + { + close (execfd); + goto retry_open; + } + ftruncate (execfd, offset); + return MFAIL; + } + else if (!offset + && open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) + open_temp_exec_file_opts_next (); + + start = mmap (start, length, prot, flags, execfd, offset); + + if (start == MFAIL) + { + munmap (ptr, length); + ftruncate (execfd, offset); + return start; + } + + mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start; + + execsize += length; + + return start; +} + +/* Map in a writable and executable chunk of memory if possible. + Failing that, fall back to dlmmap_locked. */ +static void * +dlmmap (void *start, size_t length, int prot, + int flags, int fd, off_t offset) +{ + void *ptr; + + assert (start == NULL && length % malloc_getpagesize == 0 + && prot == (PROT_READ | PROT_WRITE) + && flags == (MAP_PRIVATE | MAP_ANONYMOUS) + && fd == -1 && offset == 0); + +#if FFI_CLOSURE_TEST + printf ("mapping in %zi\n", length); +#endif + + if (execfd == -1 && is_emutramp_enabled ()) + { + ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); + return ptr; + } + + if (execfd == -1 && !is_selinux_enabled ()) + { + ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); + + if (ptr != MFAIL || (errno != EPERM && errno != EACCES)) + /* Cool, no need to mess with separate segments. */ + return ptr; + + /* If MREMAP_DUP is ever introduced and implemented, try mmap + with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with + MREMAP_DUP and prot at this point. */ + } + + if (execsize == 0 || execfd == -1) + { + pthread_mutex_lock (&open_temp_exec_file_mutex); + ptr = dlmmap_locked (start, length, prot, flags, offset); + pthread_mutex_unlock (&open_temp_exec_file_mutex); + + return ptr; + } + + return dlmmap_locked (start, length, prot, flags, offset); +} + +/* Release memory at the given address, as well as the corresponding + executable page if it's separate. */ +static int +dlmunmap (void *start, size_t length) +{ + /* We don't bother decreasing execsize or truncating the file, since + we can't quite tell whether we're unmapping the end of the file. + We don't expect frequent deallocation anyway. If we did, we + could locate pages in the file by writing to the pages being + deallocated and checking that the file contents change. + Yuck. */ + msegmentptr seg = segment_holding (gm, start); + void *code; + +#if FFI_CLOSURE_TEST + printf ("unmapping %zi\n", length); +#endif + + if (seg && (code = add_segment_exec_offset (start, seg)) != start) + { + int ret = munmap (code, length); + if (ret) + return ret; + } + + return munmap (start, length); +} + +#if FFI_CLOSURE_FREE_CODE +/* Return segment holding given code address. */ +static msegmentptr +segment_holding_code (mstate m, char* addr) +{ + msegmentptr sp = &m->seg; + for (;;) { + if (addr >= add_segment_exec_offset (sp->base, sp) + && addr < add_segment_exec_offset (sp->base, sp) + sp->size) + return sp; + if ((sp = sp->next) == 0) + return 0; + } +} +#endif + +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ + +/* Allocate a chunk of memory with the given size. Returns a pointer + to the writable address, and sets *CODE to the executable + corresponding virtual address. */ +void * +ffi_closure_alloc (size_t size, void **code) +{ + *code = malloc(size); + return *code; +#if 0 + void *ptr; + + if (!code) + return NULL; + + ptr = dlmalloc (size); + + if (ptr) + { + msegmentptr seg = segment_holding (gm, ptr); + + *code = add_segment_exec_offset (ptr, seg); + } + + return ptr; +#endif +} + +/* Release a chunk of memory allocated with ffi_closure_alloc. If + FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the + writable or the executable address given. Otherwise, only the + writable address can be provided here. */ +void +ffi_closure_free (void *ptr) +{ +#if 0 +#if FFI_CLOSURE_FREE_CODE + msegmentptr seg = segment_holding_code(gm, ptr); + + if (seg) + ptr = sub_segment_exec_offset(ptr, seg); +#endif + + dlfree(ptr); +#endif + free(ptr); +} + + +#if FFI_CLOSURE_TEST +/* Do some internal sanity testing to make sure allocation and + deallocation of pages are working as intended. */ +int main () +{ + void *p[3]; +#define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0) +#define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0) + GET (0, malloc_getpagesize / 2); + GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*)); + PUT (1); + GET (1, 2 * malloc_getpagesize); + GET (2, malloc_getpagesize / 2); + PUT (1); + PUT (0); + PUT (2); + return 0; +} +#endif /* FFI_CLOSURE_TEST */ +# else /* ! FFI_MMAP_EXEC_WRIT */ + +/* On many systems, memory returned by malloc is writable and + executable, so just use it. */ + +#include <stdlib.h> + +void * +ffi_closure_alloc (size_t size, void **code) +{ + if (!code) + return NULL; + + return *code = malloc (size); +} + +void +ffi_closure_free (void *ptr) +{ + free (ptr); +} + +# endif /* ! FFI_MMAP_EXEC_WRIT */ +#endif /* FFI_CLOSURES */ diff --git a/lib/wrappers/libffi/gcc/ffi.c b/lib/wrappers/libffi/gcc/ffi.c new file mode 100644 index 000000000..0600414d4 --- /dev/null +++ b/lib/wrappers/libffi/gcc/ffi.c @@ -0,0 +1,841 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2002 Bo Thorsen + Copyright (c) 2002 Roger Sayle + Copyright (C) 2008, 2010 Free Software Foundation, Inc. + + x86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#if !defined(__x86_64__) || defined(_WIN64) + +#ifdef _WIN64 +#include <windows.h> +#endif + +#include <ffi.h> +#include <ffi_common.h> + +#include <stdlib.h> + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; +#ifdef X86_WIN32 + size_t p_stack_args[2]; + void *p_stack_data[2]; + char *argp2 = stack; + int stack_args_count = 0; + int cabi = ecif->cif->abi; +#endif + + argp = stack; + + if ((ecif->cif->flags == FFI_TYPE_STRUCT + || ecif->cif->flags == FFI_TYPE_MS_STRUCT) +#ifdef X86_WIN64 + && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 + && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) +#endif + ) + { + *(void **) argp = ecif->rvalue; +#ifdef X86_WIN32 + /* For fastcall/thiscall this is first register-passed + argument. */ + if (cabi == FFI_THISCALL || cabi == FFI_FASTCALL) + { + p_stack_args[stack_args_count] = sizeof (void*); + p_stack_data[stack_args_count] = argp; + ++stack_args_count; + } +#endif + argp += sizeof(void*); + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + i != 0; + i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(void*) - 1) & (size_t) argp) + argp = (char *) ALIGN(argp, sizeof(void*)); + + z = (*p_arg)->size; +#ifdef X86_WIN64 + if (z > sizeof(ffi_arg) + || ((*p_arg)->type == FFI_TYPE_STRUCT + && (z != 1 && z != 2 && z != 4 && z != 8)) +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE + || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) +#endif + ) + { + z = sizeof(ffi_arg); + *(void **)argp = *p_argv; + } + else if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + memcpy(argp, *p_argv, z); + } + else +#endif + if (z < sizeof(ffi_arg)) + { + z = sizeof(ffi_arg); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else + { + memcpy(argp, *p_argv, z); + } + +#ifdef X86_WIN32 + /* For thiscall/fastcall convention register-passed arguments + are the first two none-floating-point arguments with a size + smaller or equal to sizeof (void*). */ + if ((cabi == FFI_THISCALL && stack_args_count < 1) + || (cabi == FFI_FASTCALL && stack_args_count < 2)) + { + if (z <= 4 + && ((*p_arg)->type != FFI_TYPE_FLOAT + && (*p_arg)->type != FFI_TYPE_STRUCT)) + { + p_stack_args[stack_args_count] = z; + p_stack_data[stack_args_count] = argp; + ++stack_args_count; + } + } +#endif + p_argv++; +#ifdef X86_WIN64 + argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); +#else + argp += z; +#endif + } + +#ifdef X86_WIN32 + /* We need to move the register-passed arguments for thiscall/fastcall + on top of stack, so that those can be moved to registers ecx/edx by + call-handler. */ + if (stack_args_count > 0) + { + size_t zz = (p_stack_args[0] + 3) & ~3; + char *h; + + /* Move first argument to top-stack position. */ + if (p_stack_data[0] != argp2) + { + h = alloca (zz + 1); + memcpy (h, p_stack_data[0], zz); + memmove (argp2 + zz, argp2, + (size_t) ((char *) p_stack_data[0] - (char*)argp2)); + memcpy (argp2, h, zz); + } + + argp2 += zz; + --stack_args_count; + if (zz > 4) + stack_args_count = 0; + + /* If we have a second argument, then move it on top + after the first one. */ + if (stack_args_count > 0 && p_stack_data[1] != argp2) + { + zz = p_stack_args[1]; + zz = (zz + 3) & ~3; + h = alloca (zz + 1); + h = alloca (zz + 1); + memcpy (h, p_stack_data[1], zz); + memmove (argp2 + zz, argp2, (size_t) ((char*) p_stack_data[1] - (char*)argp2)); + memcpy (argp2, h, zz); + } + } +#endif + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + unsigned int i; + ffi_type **ptr; + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: +#ifdef X86_WIN64 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: +#endif + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: +#ifndef X86_WIN64 +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE + case FFI_TYPE_LONGDOUBLE: +#endif +#endif + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_UINT64: +#ifdef X86_WIN64 + case FFI_TYPE_POINTER: +#endif + cif->flags = FFI_TYPE_SINT64; + break; + + case FFI_TYPE_STRUCT: +#ifndef X86 + if (cif->rtype->size == 1) + { + cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ + } + else if (cif->rtype->size == 2) + { + cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ + } + else if (cif->rtype->size == 4) + { +#ifdef X86_WIN64 + cif->flags = FFI_TYPE_SMALL_STRUCT_4B; +#else + cif->flags = FFI_TYPE_INT; /* same as int type */ +#endif + } + else if (cif->rtype->size == 8) + { + cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ + } + else +#endif + { +#ifdef X86_WIN32 + if (cif->abi == FFI_MS_CDECL) + cif->flags = FFI_TYPE_MS_STRUCT; + else +#endif + cif->flags = FFI_TYPE_STRUCT; + /* allocate space for return value pointer */ + cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); + } + break; + + default: +#ifdef X86_WIN64 + cif->flags = FFI_TYPE_SINT64; + break; + case FFI_TYPE_INT: + cif->flags = FFI_TYPE_SINT32; +#else + cif->flags = FFI_TYPE_INT; +#endif + break; + } + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + if (((*ptr)->alignment - 1) & cif->bytes) + cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); + cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); + } + +#ifdef X86_WIN64 + /* ensure space for storing four registers */ + cif->bytes += 4 * sizeof(ffi_arg); +#endif + + cif->bytes = (cif->bytes + 15) & ~0xF; + + return FFI_OK; +} + +#ifdef X86_WIN64 +extern int +ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); +#elif defined(X86_WIN32) +extern void +ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned, unsigned *, void (*fn)(void)); +#else +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); +#endif + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + +#ifdef X86_WIN64 + if (rvalue == NULL + && cif->flags == FFI_TYPE_STRUCT + && cif->rtype->size != 1 && cif->rtype->size != 2 + && cif->rtype->size != 4 && cif->rtype->size != 8) + { + ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); + } +#else + if (rvalue == NULL + && (cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } +#endif + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { +#ifdef X86_WIN64 + case FFI_WIN64: + ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; +#elif defined(X86_WIN32) + case FFI_SYSV: + case FFI_STDCALL: + case FFI_MS_CDECL: + ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + case FFI_THISCALL: + case FFI_FASTCALL: + { + unsigned int abi = cif->abi; + unsigned int i, passed_regs = 0; + + if (cif->flags == FFI_TYPE_STRUCT) + ++passed_regs; + + for (i=0; i < cif->nargs && passed_regs < 2;i++) + { + size_t sz; + + if (cif->arg_types[i]->type == FFI_TYPE_FLOAT + || cif->arg_types[i]->type == FFI_TYPE_STRUCT) + continue; + sz = (cif->arg_types[i]->size + 3) & ~3; + if (sz == 0 || sz > 4) + continue; + ++passed_regs; + } + if (passed_regs < 2 && abi == FFI_FASTCALL) + abi = FFI_THISCALL; + if (passed_regs < 1 && abi == FFI_THISCALL) + abi = FFI_STDCALL; + ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + } + break; +#else + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, + fn); + break; +#endif + default: + FFI_ASSERT(0); + break; + } +} + + +/** private members **/ + +/* The following __attribute__((regparm(1))) decorations will have no effect + on MSVC or SUNPRO_C -- standard conventions apply. */ +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif); +void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) + __attribute__ ((regparm(1))); +unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) + __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) + __attribute__ ((regparm(1))); +#ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *) + __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) + __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *) + __attribute__ ((regparm(1))); +#endif +#ifdef X86_WIN64 +void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); +#endif + +/* This function is jumped to by the trampoline */ + +#ifdef X86_WIN64 +void * FFI_HIDDEN +ffi_closure_win64_inner (ffi_closure *closure, void *args) { + ffi_cif *cif; + void **arg_area; + void *result; + void *resp = &result; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will change RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); + + (closure->fun) (cif, resp, arg_area, closure->user_data); + + /* The result is returned in rax. This does the right thing for + result types except for floats; we have to 'mov xmm0, rax' in the + caller to correct this. + TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! + */ + return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; +} + +#else +unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) +ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) +{ + /* our various things... */ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will change RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + + (closure->fun) (cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} +#endif /* !X86_WIN64 */ + +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, + ffi_cif *cif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + +#ifdef X86_WIN64 + if (cif->rtype->size > sizeof(ffi_arg) + || (cif->flags == FFI_TYPE_STRUCT + && (cif->rtype->size != 1 && cif->rtype->size != 2 + && cif->rtype->size != 4 && cif->rtype->size != 8))) { + *rvalue = *(void **) argp; + argp += sizeof(void *); + } +#else + if ( cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT ) { + *rvalue = *(void **) argp; + argp += sizeof(void *); + } +#endif + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(void*) - 1) & (size_t) argp) { + argp = (char *) ALIGN(argp, sizeof(void*)); + } + +#ifdef X86_WIN64 + if ((*p_arg)->size > sizeof(ffi_arg) + || ((*p_arg)->type == FFI_TYPE_STRUCT + && ((*p_arg)->size != 1 && (*p_arg)->size != 2 + && (*p_arg)->size != 4 && (*p_arg)->size != 8))) + { + z = sizeof(void *); + *p_argv = *(void **)argp; + } + else +#endif + { + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + } + + p_argv++; +#ifdef X86_WIN64 + argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); +#else + argp += z; +#endif + } + + return; +} + +#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + void* __fun = (void*)(FUN); \ + void* __ctx = (void*)(CTX); \ + *(unsigned char*) &__tramp[0] = 0x41; \ + *(unsigned char*) &__tramp[1] = 0xbb; \ + *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ + *(unsigned char*) &__tramp[6] = 0x48; \ + *(unsigned char*) &__tramp[7] = 0xb8; \ + *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ + *(unsigned char *) &__tramp[16] = 0x49; \ + *(unsigned char *) &__tramp[17] = 0xba; \ + *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ + *(unsigned char *) &__tramp[26] = 0x41; \ + *(unsigned char *) &__tramp[27] = 0xff; \ + *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ + } + +/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe9; \ + *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ + } + +#define FFI_INIT_TRAMPOLINE_THISCALL(TRAMP,FUN,CTX,SIZE) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 49); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ + *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ + *(unsigned int *) &__tramp[8] = 0x04890424; /* mov %ecx, 4(%esp) */ \ + *(unsigned char*) &__tramp[12] = 0x24; /* mov %eax, (%esp) */ \ + *(unsigned char*) &__tramp[13] = 0xb8; \ + *(unsigned int *) &__tramp[14] = __size; /* mov __size, %eax */ \ + *(unsigned int *) &__tramp[18] = 0x08244c8d; /* lea 8(%esp), %ecx */ \ + *(unsigned int *) &__tramp[22] = 0x4802e8c1; /* shr $2, %eax ; dec %eax */ \ + *(unsigned short*) &__tramp[26] = 0x0b74; /* jz 1f */ \ + *(unsigned int *) &__tramp[28] = 0x8908518b; /* 2b: mov 8(%ecx), %edx */ \ + *(unsigned int *) &__tramp[32] = 0x04c18311; /* mov %edx, (%ecx) ; add $4, %ecx */ \ + *(unsigned char*) &__tramp[36] = 0x48; /* dec %eax */ \ + *(unsigned short*) &__tramp[37] = 0xf575; /* jnz 2b ; 1f: */ \ + *(unsigned char*) &__tramp[39] = 0xb8; \ + *(unsigned int*) &__tramp[40] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[44] = 0xe8; \ + *(unsigned int*) &__tramp[45] = __dis; /* call __fun */ \ + *(unsigned char*) &__tramp[49] = 0xc2; /* ret */ \ + *(unsigned short*) &__tramp[50] = (__size + 8); /* ret (__size + 8) */ \ + } + +#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe8; \ + *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ + *(unsigned char *) &__tramp[10] = 0xc2; \ + *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ + } + +/* the cif must already be prep'ed */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ +#ifdef X86_WIN64 +#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) +#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) + if (cif->abi == FFI_WIN64) + { + int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); + FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], + &ffi_closure_win64, + codeloc, mask); + /* make sure we can execute here */ + } +#else + if (cif->abi == FFI_SYSV) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } +#ifdef X86_WIN32 + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], + &ffi_closure_THISCALL, + (void*)codeloc, + cif->bytes); + } + else if (cif->abi == FFI_STDCALL) + { + FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], + &ffi_closure_STDCALL, + (void*)codeloc, cif->bytes); + } + else if (cif->abi == FFI_MS_CDECL) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } +#endif /* X86_WIN32 */ +#endif /* !X86_WIN64 */ + else + { + return FFI_BAD_ABI; + } + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* ------- Native raw API support -------------------------------- */ + +#if !FFI_NO_RAW_API + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc) +{ + int i; + + if (cif->abi != FFI_SYSV) { +#ifdef X86_WIN32 + if (cif->abi != FFI_THISCALL) +#endif + return FFI_BAD_ABI; + } + + /* we currently don't support certain kinds of arguments for raw + closures. This should be implemented by a separate assembly + language routine, since it would require argument processing, + something we don't do now for performance. */ + + for (i = cif->nargs-1; i >= 0; i--) + { + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); + } + +#ifdef X86_WIN32 + if (cif->abi == FFI_SYSV) + { +#endif + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, + codeloc); +#ifdef X86_WIN32 + } + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, + codeloc, cif->bytes); + } +#endif + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +static void +ffi_prep_args_raw(char *stack, extended_cif *ecif) +{ + memcpy (stack, ecif->avalue, ecif->cif->bytes); +} + +/* we borrow this routine from libffi (it must be changed, though, to + * actually call the function passed in the first argument. as of + * libffi-1.20, this is not the case.) + */ + +void +ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) +{ + extended_cif ecif; + void **avalue = (void **)fake_avalue; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if (rvalue == NULL + && (cif->flags == FFI_TYPE_STRUCT + || cif->flags == FFI_TYPE_MS_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { +#ifdef X86_WIN32 + case FFI_SYSV: + case FFI_STDCALL: + case FFI_MS_CDECL: + ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + case FFI_THISCALL: + case FFI_FASTCALL: + { + unsigned int abi = cif->abi; + unsigned int i, passed_regs = 0; + + if (cif->flags == FFI_TYPE_STRUCT) + ++passed_regs; + + for (i=0; i < cif->nargs && passed_regs < 2;i++) + { + size_t sz; + + if (cif->arg_types[i]->type == FFI_TYPE_FLOAT + || cif->arg_types[i]->type == FFI_TYPE_STRUCT) + continue; + sz = (cif->arg_types[i]->size + 3) & ~3; + if (sz == 0 || sz > 4) + continue; + ++passed_regs; + } + if (passed_regs < 2 && abi == FFI_FASTCALL) + cif->abi = abi = FFI_THISCALL; + if (passed_regs < 1 && abi == FFI_THISCALL) + cif->abi = abi = FFI_STDCALL; + ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags, + ecif.rvalue, fn); + } + break; +#else + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#endif + default: + FFI_ASSERT(0); + break; + } +} + +#endif + +#endif /* !__x86_64__ || X86_WIN64 */ + diff --git a/lib/wrappers/libffi/gcc/ffi64.c b/lib/wrappers/libffi/gcc/ffi64.c new file mode 100644 index 000000000..2014af24c --- /dev/null +++ b/lib/wrappers/libffi/gcc/ffi64.c @@ -0,0 +1,673 @@ +/* ----------------------------------------------------------------------- + ffi64.c - Copyright (c) 2013 The Written Word, Inc. + Copyright (c) 2011 Anthony Green + Copyright (c) 2008, 2010 Red Hat, Inc. + Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de> + + x86-64 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include <ffi.h> +#include <ffi_common.h> + +#include <stdlib.h> +#include <stdarg.h> + +#ifdef __x86_64__ + +#define MAX_GPR_REGS 6 +#define MAX_SSE_REGS 8 + +#if defined(__INTEL_COMPILER) +#define UINT128 __m128 +#else +#if defined(__SUNPRO_C) +#include <sunmedia_types.h> +#define UINT128 __m128i +#else +#define UINT128 __int128_t +#endif +#endif + +union big_int_union +{ + UINT32 i32; + UINT64 i64; + UINT128 i128; +}; + +struct register_args +{ + /* Registers for argument passing. */ + UINT64 gpr[MAX_GPR_REGS]; + union big_int_union sse[MAX_SSE_REGS]; +}; + +extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, + void *raddr, void (*fnaddr)(void), unsigned ssecount); + +/* All reference to register classes here is identical to the code in + gcc/config/i386/i386.c. Do *not* change one without the other. */ + +/* Register class used for passing given 64bit part of the argument. + These represent classes as documented by the PS ABI, with the + exception of SSESF, SSEDF classes, that are basically SSE class, + just gcc will use SF or DFmode move instead of DImode to avoid + reformatting penalties. + + Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves + whenever possible (upper half does contain padding). */ +enum x86_64_reg_class + { + X86_64_NO_CLASS, + X86_64_INTEGER_CLASS, + X86_64_INTEGERSI_CLASS, + X86_64_SSE_CLASS, + X86_64_SSESF_CLASS, + X86_64_SSEDF_CLASS, + X86_64_SSEUP_CLASS, + X86_64_X87_CLASS, + X86_64_X87UP_CLASS, + X86_64_COMPLEX_X87_CLASS, + X86_64_MEMORY_CLASS + }; + +#define MAX_CLASSES 4 + +#define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) + +/* x86-64 register passing implementation. See x86-64 ABI for details. Goal + of this code is to classify each 8bytes of incoming argument by the register + class and assign registers accordingly. */ + +/* Return the union class of CLASS1 and CLASS2. + See the x86-64 PS ABI for details. */ + +static enum x86_64_reg_class +merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) +{ + /* Rule #1: If both classes are equal, this is the resulting class. */ + if (class1 == class2) + return class1; + + /* Rule #2: If one of the classes is NO_CLASS, the resulting class is + the other class. */ + if (class1 == X86_64_NO_CLASS) + return class2; + if (class2 == X86_64_NO_CLASS) + return class1; + + /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ + if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) + return X86_64_MEMORY_CLASS; + + /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ + if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) + || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) + return X86_64_INTEGERSI_CLASS; + if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS + || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) + return X86_64_INTEGER_CLASS; + + /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, + MEMORY is used. */ + if (class1 == X86_64_X87_CLASS + || class1 == X86_64_X87UP_CLASS + || class1 == X86_64_COMPLEX_X87_CLASS + || class2 == X86_64_X87_CLASS + || class2 == X86_64_X87UP_CLASS + || class2 == X86_64_COMPLEX_X87_CLASS) + return X86_64_MEMORY_CLASS; + + /* Rule #6: Otherwise class SSE is used. */ + return X86_64_SSE_CLASS; +} + +/* Classify the argument of type TYPE and mode MODE. + CLASSES will be filled by the register class used to pass each word + of the operand. The number of words is returned. In case the parameter + should be passed in memory, 0 is returned. As a special case for zero + sized containers, classes[0] will be NO_CLASS and 1 is returned. + + See the x86-64 PS ABI for details. +*/ +static int +classify_argument (ffi_type *type, enum x86_64_reg_class classes[], + size_t byte_offset) +{ + switch (type->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_POINTER: + { + int size = byte_offset + type->size; + + if (size <= 4) + { + classes[0] = X86_64_INTEGERSI_CLASS; + return 1; + } + else if (size <= 8) + { + classes[0] = X86_64_INTEGER_CLASS; + return 1; + } + else if (size <= 12) + { + classes[0] = X86_64_INTEGER_CLASS; + classes[1] = X86_64_INTEGERSI_CLASS; + return 2; + } + else if (size <= 16) + { + classes[0] = classes[1] = X86_64_INTEGERSI_CLASS; + return 2; + } + else + FFI_ASSERT (0); + } + case FFI_TYPE_FLOAT: + if (!(byte_offset % 8)) + classes[0] = X86_64_SSESF_CLASS; + else + classes[0] = X86_64_SSE_CLASS; + return 1; + case FFI_TYPE_DOUBLE: + classes[0] = X86_64_SSEDF_CLASS; + return 1; + case FFI_TYPE_LONGDOUBLE: + classes[0] = X86_64_X87_CLASS; + classes[1] = X86_64_X87UP_CLASS; + return 2; + case FFI_TYPE_STRUCT: + { + const int UNITS_PER_WORD = 8; + int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + ffi_type **ptr; + int i; + enum x86_64_reg_class subclasses[MAX_CLASSES]; + + /* If the struct is larger than 32 bytes, pass it on the stack. */ + if (type->size > 32) + return 0; + + for (i = 0; i < words; i++) + classes[i] = X86_64_NO_CLASS; + + /* Zero sized arrays or structures are NO_CLASS. We return 0 to + signalize memory class, so handle it as special case. */ + if (!words) + { + classes[0] = X86_64_NO_CLASS; + return 1; + } + + /* Merge the fields of structure. */ + for (ptr = type->elements; *ptr != NULL; ptr++) + { + int num; + + byte_offset = ALIGN (byte_offset, (*ptr)->alignment); + + num = classify_argument (*ptr, subclasses, byte_offset % 8); + if (num == 0) + return 0; + for (i = 0; i < num; i++) + { + int pos = byte_offset / 8; + classes[i + pos] = + merge_classes (subclasses[i], classes[i + pos]); + } + + byte_offset += (*ptr)->size; + } + + if (words > 2) + { + /* When size > 16 bytes, if the first one isn't + X86_64_SSE_CLASS or any other ones aren't + X86_64_SSEUP_CLASS, everything should be passed in + memory. */ + if (classes[0] != X86_64_SSE_CLASS) + return 0; + + for (i = 1; i < words; i++) + if (classes[i] != X86_64_SSEUP_CLASS) + return 0; + } + + /* Final merger cleanup. */ + for (i = 0; i < words; i++) + { + /* If one class is MEMORY, everything should be passed in + memory. */ + if (classes[i] == X86_64_MEMORY_CLASS) + return 0; + + /* The X86_64_SSEUP_CLASS should be always preceded by + X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */ + if (classes[i] == X86_64_SSEUP_CLASS + && classes[i - 1] != X86_64_SSE_CLASS + && classes[i - 1] != X86_64_SSEUP_CLASS) + { + /* The first one should never be X86_64_SSEUP_CLASS. */ + FFI_ASSERT (i != 0); + classes[i] = X86_64_SSE_CLASS; + } + + /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS, + everything should be passed in memory. */ + if (classes[i] == X86_64_X87UP_CLASS + && (classes[i - 1] != X86_64_X87_CLASS)) + { + /* The first one should never be X86_64_X87UP_CLASS. */ + FFI_ASSERT (i != 0); + return 0; + } + } + return words; + } + + default: + FFI_ASSERT(0); + } + return 0; /* Never reached. */ +} + +/* Examine the argument and return set number of register required in each + class. Return zero iff parameter should be passed in memory, otherwise + the number of registers. */ + +static int +examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES], + _Bool in_return, int *pngpr, int *pnsse) +{ + int i, n, ngpr, nsse; + + n = classify_argument (type, classes, 0); + if (n == 0) + return 0; + + ngpr = nsse = 0; + for (i = 0; i < n; ++i) + switch (classes[i]) + { + case X86_64_INTEGER_CLASS: + case X86_64_INTEGERSI_CLASS: + ngpr++; + break; + case X86_64_SSE_CLASS: + case X86_64_SSESF_CLASS: + case X86_64_SSEDF_CLASS: + nsse++; + break; + case X86_64_NO_CLASS: + case X86_64_SSEUP_CLASS: + break; + case X86_64_X87_CLASS: + case X86_64_X87UP_CLASS: + case X86_64_COMPLEX_X87_CLASS: + return in_return != 0; + default: + abort (); + } + + *pngpr = ngpr; + *pnsse = nsse; + + return n; +} + +/* Perform machine dependent cif processing. */ + +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + int gprcount, ssecount, i, avn, n, ngpr, nsse, flags; + enum x86_64_reg_class classes[MAX_CLASSES]; + size_t bytes; + + gprcount = ssecount = 0; + + flags = cif->rtype->type; + if (flags != FFI_TYPE_VOID) + { + n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); + if (n == 0) + { + /* The return value is passed in memory. A pointer to that + memory is the first argument. Allocate a register for it. */ + gprcount++; + /* We don't have to do anything in asm for the return. */ + flags = FFI_TYPE_VOID; + } + else if (flags == FFI_TYPE_STRUCT) + { + /* Mark which registers the result appears in. */ + _Bool sse0 = SSE_CLASS_P (classes[0]); + _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]); + if (sse0 && !sse1) + flags |= 1 << 8; + else if (!sse0 && sse1) + flags |= 1 << 9; + else if (sse0 && sse1) + flags |= 1 << 10; + /* Mark the true size of the structure. */ + flags |= cif->rtype->size << 12; + } + } + + /* Go over all arguments and determine the way they should be passed. + If it's in a register and there is space for it, let that be so. If + not, add it's size to the stack byte count. */ + for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) + { + if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 + || gprcount + ngpr > MAX_GPR_REGS + || ssecount + nsse > MAX_SSE_REGS) + { + long align = cif->arg_types[i]->alignment; + + if (align < 8) + align = 8; + + bytes = ALIGN (bytes, align); + bytes += cif->arg_types[i]->size; + } + else + { + gprcount += ngpr; + ssecount += nsse; + } + } + if (ssecount) + flags |= 1 << 11; + cif->flags = flags; + cif->bytes = ALIGN (bytes, 8); + + return FFI_OK; +} + +void +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + enum x86_64_reg_class classes[MAX_CLASSES]; + char *stack, *argp; + ffi_type **arg_types; + int gprcount, ssecount, ngpr, nsse, i, avn; + _Bool ret_in_memory; + struct register_args *reg_args; + + /* Can't call 32-bit mode from 64-bit mode. */ + FFI_ASSERT (cif->abi == FFI_UNIX64); + + /* If the return value is a struct and we don't have a return value + address then we need to make one. Note the setting of flags to + VOID above in ffi_prep_cif_machdep. */ + ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT + && (cif->flags & 0xff) == FFI_TYPE_VOID); + if (rvalue == NULL && ret_in_memory) + rvalue = alloca (cif->rtype->size); + + /* Allocate the space for the arguments, plus 4 words of temp space. */ + stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8); + reg_args = (struct register_args *) stack; + argp = stack + sizeof (struct register_args); + + gprcount = ssecount = 0; + + /* If the return value is passed in memory, add the pointer as the + first integer argument. */ + if (ret_in_memory) + reg_args->gpr[gprcount++] = (unsigned long) rvalue; + + avn = cif->nargs; + arg_types = cif->arg_types; + + for (i = 0; i < avn; ++i) + { + size_t size = arg_types[i]->size; + int n; + + n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); + if (n == 0 + || gprcount + ngpr > MAX_GPR_REGS + || ssecount + nsse > MAX_SSE_REGS) + { + long align = arg_types[i]->alignment; + + /* Stack arguments are *always* at least 8 byte aligned. */ + if (align < 8) + align = 8; + + /* Pass this argument in memory. */ + argp = (void *) ALIGN (argp, align); + memcpy (argp, avalue[i], size); + argp += size; + } + else + { + /* The argument is passed entirely in registers. */ + char *a = (char *) avalue[i]; + int j; + + for (j = 0; j < n; j++, a += 8, size -= 8) + { + switch (classes[j]) + { + case X86_64_INTEGER_CLASS: + case X86_64_INTEGERSI_CLASS: + /* Sign-extend integer arguments passed in general + purpose registers, to cope with the fact that + LLVM incorrectly assumes that this will be done + (the x86-64 PS ABI does not specify this). */ + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT8 *) a); + break; + case FFI_TYPE_SINT16: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT16 *) a); + break; + case FFI_TYPE_SINT32: + *(SINT64 *)®_args->gpr[gprcount] = (SINT64) *((SINT32 *) a); + break; + default: + reg_args->gpr[gprcount] = 0; + memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); + } + gprcount++; + break; + case X86_64_SSE_CLASS: + case X86_64_SSEDF_CLASS: + reg_args->sse[ssecount++].i64 = *(UINT64 *) a; + break; + case X86_64_SSESF_CLASS: + reg_args->sse[ssecount++].i32 = *(UINT32 *) a; + break; + default: + abort(); + } + } + } + } + + ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args), + cif->flags, rvalue, fn, ssecount); +} + + +extern void ffi_closure_unix64(void); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + volatile unsigned short *tramp; + + /* Sanity check on the cif ABI. */ + { + int abi = cif->abi; + if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))) + return FFI_BAD_ABI; + } + + tramp = (volatile unsigned short *) &closure->tramp[0]; + + tramp[0] = 0xbb49; /* mov <code>, %r11 */ + *((unsigned long long * volatile) &tramp[1]) + = (unsigned long) ffi_closure_unix64; + tramp[5] = 0xba49; /* mov <data>, %r10 */ + *((unsigned long long * volatile) &tramp[6]) + = (unsigned long) codeloc; + + /* Set the carry bit iff the function uses any sse registers. + This is clc or stc, together with the first byte of the jmp. */ + tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8; + + tramp[11] = 0xe3ff; /* jmp *%r11 */ + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + return FFI_OK; +} + +int +ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue, + struct register_args *reg_args, char *argp) +{ + ffi_cif *cif; + void **avalue; + ffi_type **arg_types; + long i, avn; + int gprcount, ssecount, ngpr, nsse; + int ret; + + cif = closure->cif; + avalue = alloca(cif->nargs * sizeof(void *)); + gprcount = ssecount = 0; + + ret = cif->rtype->type; + if (ret != FFI_TYPE_VOID) + { + enum x86_64_reg_class classes[MAX_CLASSES]; + int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); + if (n == 0) + { + /* The return value goes in memory. Arrange for the closure + return value to go directly back to the original caller. */ + rvalue = (void *) (unsigned long) reg_args->gpr[gprcount++]; + /* We don't have to do anything in asm for the return. */ + ret = FFI_TYPE_VOID; + } + else if (ret == FFI_TYPE_STRUCT && n == 2) + { + /* Mark which register the second word of the structure goes in. */ + _Bool sse0 = SSE_CLASS_P (classes[0]); + _Bool sse1 = SSE_CLASS_P (classes[1]); + if (!sse0 && sse1) + ret |= 1 << 8; + else if (sse0 && !sse1) + ret |= 1 << 9; + } + } + + avn = cif->nargs; + arg_types = cif->arg_types; + + for (i = 0; i < avn; ++i) + { + enum x86_64_reg_class classes[MAX_CLASSES]; + int n; + + n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); + if (n == 0 + || gprcount + ngpr > MAX_GPR_REGS + || ssecount + nsse > MAX_SSE_REGS) + { + long align = arg_types[i]->alignment; + + /* Stack arguments are *always* at least 8 byte aligned. */ + if (align < 8) + align = 8; + + /* Pass this argument in memory. */ + argp = (void *) ALIGN (argp, align); + avalue[i] = argp; + argp += arg_types[i]->size; + } + /* If the argument is in a single register, or two consecutive + integer registers, then we can use that address directly. */ + else if (n == 1 + || (n == 2 && !(SSE_CLASS_P (classes[0]) + || SSE_CLASS_P (classes[1])))) + { + /* The argument is in a single register. */ + if (SSE_CLASS_P (classes[0])) + { + avalue[i] = ®_args->sse[ssecount]; + ssecount += n; + } + else + { + avalue[i] = ®_args->gpr[gprcount]; + gprcount += n; + } + } + /* Otherwise, allocate space to make them consecutive. */ + else + { + char *a = alloca (16); + int j; + + avalue[i] = a; + for (j = 0; j < n; j++, a += 8) + { + if (SSE_CLASS_P (classes[j])) + memcpy (a, ®_args->sse[ssecount++], 8); + else + memcpy (a, ®_args->gpr[gprcount++], 8); + } + } + } + + /* Invoke the closure. */ + closure->fun (cif, rvalue, avalue, closure->user_data); + + /* Tell assembly how to perform return type promotions. */ + return ret; +} + +#endif /* __x86_64__ */ diff --git a/lib/wrappers/libffi/gcc/prep_cif.c b/lib/wrappers/libffi/gcc/prep_cif.c new file mode 100644 index 000000000..e8ec5cf1e --- /dev/null +++ b/lib/wrappers/libffi/gcc/prep_cif.c @@ -0,0 +1,237 @@ +/* ----------------------------------------------------------------------- + prep_cif.c - Copyright (c) 2011, 2012 Anthony Green + Copyright (c) 1996, 1998, 2007 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include <ffi.h> +#include <ffi_common.h> +#include <stdlib.h> + +/* Round up to FFI_SIZEOF_ARG. */ + +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) + +/* Perform machine independent initialization of aggregate type + specifications. */ + +static ffi_status initialize_aggregate(ffi_type *arg) +{ + ffi_type **ptr; + + if (UNLIKELY(arg == NULL || arg->elements == NULL)) + return FFI_BAD_TYPEDEF; + + arg->size = 0; + arg->alignment = 0; + + ptr = &(arg->elements[0]); + + if (UNLIKELY(ptr == 0)) + return FFI_BAD_TYPEDEF; + + while ((*ptr) != NULL) + { + if (UNLIKELY(((*ptr)->size == 0) + && (initialize_aggregate((*ptr)) != FFI_OK))) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type */ + FFI_ASSERT_VALID_TYPE(*ptr); + + arg->size = ALIGN(arg->size, (*ptr)->alignment); + arg->size += (*ptr)->size; + + arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment : (*ptr)->alignment; + + ptr++; + } + + /* Structure size includes tail padding. This is important for + structures that fit in one register on ABIs like the PowerPC64 + Linux ABI that right justify small structs in a register. + It's also needed for nested structure layout, for example + struct A { long a; char b; }; struct B { struct A x; char y; }; + should find y at an offset of 2*sizeof(long) and result in a + total size of 3*sizeof(long). */ + arg->size = ALIGN (arg->size, arg->alignment); + + if (arg->size == 0) + return FFI_BAD_TYPEDEF; + else + return FFI_OK; +} + +#ifndef __CRIS__ +/* The CRIS ABI specifies structure elements to have byte + alignment only, so it completely overrides this functions, + which assumes "natural" alignment and padding. */ + +/* Perform machine independent ffi_cif preparation, then call + machine dependent routine. */ + +/* For non variadic functions isvariadic should be 0 and + nfixedargs==ntotalargs. + + For variadic calls, isvariadic should be 1 and nfixedargs + and ntotalargs set as appropriate. nfixedargs must always be >=1 */ + + +ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, + unsigned int isvariadic, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, ffi_type **atypes) +{ + unsigned bytes = 0; + unsigned int i; + ffi_type **ptr; + + FFI_ASSERT(cif != NULL); + FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); + FFI_ASSERT(nfixedargs <= ntotalargs); + +#ifndef X86_WIN32 + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) + return FFI_BAD_ABI; +#else + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL)) + return FFI_BAD_ABI; +#endif + + cif->abi = abi; + cif->arg_types = atypes; + cif->nargs = ntotalargs; + cif->rtype = rtype; + + cif->flags = 0; + + /* Initialize the return type if necessary */ + if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the return type */ + FFI_ASSERT_VALID_TYPE(cif->rtype); + + /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ +#if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT +#ifdef SPARC + && (cif->abi != FFI_V9 || cif->rtype->size > 32) +#endif +#ifdef TILE + && (cif->rtype->size > 10 * FFI_SIZEOF_ARG) +#endif +#ifdef XTENSA + && (cif->rtype->size > 16) +#endif + + ) + bytes = STACK_ARG_SIZE(sizeof(void*)); +#endif + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + + /* Initialize any uninitialized aggregate type definitions */ + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + +#if !defined X86_ANY && !defined S390 && !defined PA +#ifdef SPARC + if (((*ptr)->type == FFI_TYPE_STRUCT + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) + || ((*ptr)->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_V9)) + bytes += sizeof(void*); + else +#endif + { + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + +#ifdef TILE + if (bytes < 10 * FFI_SIZEOF_ARG && + bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG) + { + /* An argument is never split between the 10 parameter + registers and the stack. */ + bytes = 10 * FFI_SIZEOF_ARG; + } +#endif +#ifdef XTENSA + if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4) + bytes = 6*4; +#endif + + bytes += STACK_ARG_SIZE((*ptr)->size); + } +#endif + } + + cif->bytes = bytes; + + /* Perform machine dependent cif processing */ +#ifdef FFI_TARGET_SPECIFIC_VARIADIC + if (isvariadic) + return ffi_prep_cif_machdep_var(cif, nfixedargs, ntotalargs); +#endif + + return ffi_prep_cif_machdep(cif); +} +#endif /* not __CRIS__ */ + +ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, + ffi_type *rtype, ffi_type **atypes) +{ + return ffi_prep_cif_core(cif, abi, 0, nargs, nargs, rtype, atypes); +} + +ffi_status ffi_prep_cif_var(ffi_cif *cif, + ffi_abi abi, + unsigned int nfixedargs, + unsigned int ntotalargs, + ffi_type *rtype, + ffi_type **atypes) +{ + return ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes); +} + +#if FFI_CLOSURES + +ffi_status +ffi_prep_closure (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data) +{ + return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); +} + +#endif diff --git a/lib/wrappers/libffi/gcc/types.c b/lib/wrappers/libffi/gcc/types.c new file mode 100644 index 000000000..0a11eb0fb --- /dev/null +++ b/lib/wrappers/libffi/gcc/types.c @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. + + Predefined ffi_types needed by libffi. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* Hide the basic type definitions from the header file, so that we + can redefine them here as "const". */ +#define LIBFFI_HIDE_BASIC_TYPES + +#include <ffi.h> +#include <ffi_common.h> + +/* Type definitions */ + +#define FFI_TYPEDEF(name, type, id) \ +struct struct_align_##name { \ + char c; \ + type x; \ +}; \ +const ffi_type ffi_type_##name = { \ + sizeof(type), \ + offsetof(struct struct_align_##name, x), \ + id, NULL \ +} + +/* Size and alignment are fake here. They must not be 0. */ +const ffi_type ffi_type_void = { + 1, 1, FFI_TYPE_VOID, NULL +}; + +FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); +FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); +FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); +FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); +FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); +FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); +FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); +FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); + +FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); + +FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); +FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); + +#ifdef __alpha__ +/* Even if we're not configured to default to 128-bit long double, + maintain binary compatibility, as -mlong-double-128 can be used + at any time. */ +/* Validate the hard-coded number below. */ +# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 +# error FFI_TYPE_LONGDOUBLE out of date +# endif +const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; +#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); +#endif diff --git a/lib/wrappers/libffi/gcc/win32_asm.asm b/lib/wrappers/libffi/gcc/win32_asm.asm new file mode 100644 index 000000000..ce3c4f3f3 --- /dev/null +++ b/lib/wrappers/libffi/gcc/win32_asm.asm @@ -0,0 +1,759 @@ +/* ----------------------------------------------------------------------- + win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. + Copyright (c) 2001 John Beniton + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2009 Daniel Witte + + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- + */ + +#define LIBFFI_ASM +#include <fficonfig.h> +#include <ffi.h> +#include <ffitarget.h> + + .text + + // This assumes we are using gas. + .balign 16 + .globl _ffi_call_win32 +#ifndef __OS2__ + .def _ffi_call_win32; .scl 2; .type 32; .endef +#endif +_ffi_call_win32: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + // Make room for all of the new args. + movl 20(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + // Place all of the ffi_prep_args in position + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + // Return stack to previous state and call the function + addl $8,%esp + + // Handle fastcall and thiscall + cmpl $3, 16(%ebp) // FFI_THISCALL + jz .do_thiscall + cmpl $4, 16(%ebp) // FFI_FASTCALL + jnz .do_fncall + movl (%esp), %ecx + movl 4(%esp), %edx + addl $8, %esp + jmp .do_fncall +.do_thiscall: + movl (%esp), %ecx + addl $4, %esp + +.do_fncall: + + // FIXME: Align the stack to a 128-bit boundary to avoid + // potential performance hits. + + call *32(%ebp) + + // stdcall functions pop arguments off the stack themselves + + // Load %ecx with the return type code + movl 24(%ebp),%ecx + + // If the return value pointer is NULL, assume no return value. + cmpl $0,28(%ebp) + jne 0f + + // Even if there is no space for the return value, we are + // obliged to handle floating-point values. + cmpl $FFI_TYPE_FLOAT,%ecx + jne .Lnoretval + fstp %st(0) + + jmp .Lepilogue + +0: + call 1f + // Do not insert anything here between the call and the jump table. +.Lstore_table: + .long .Lnoretval /* FFI_TYPE_VOID */ + .long .Lretint /* FFI_TYPE_INT */ + .long .Lretfloat /* FFI_TYPE_FLOAT */ + .long .Lretdouble /* FFI_TYPE_DOUBLE */ + .long .Lretlongdouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lretuint8 /* FFI_TYPE_UINT8 */ + .long .Lretsint8 /* FFI_TYPE_SINT8 */ + .long .Lretuint16 /* FFI_TYPE_UINT16 */ + .long .Lretsint16 /* FFI_TYPE_SINT16 */ + .long .Lretint /* FFI_TYPE_UINT32 */ + .long .Lretint /* FFI_TYPE_SINT32 */ + .long .Lretint64 /* FFI_TYPE_UINT64 */ + .long .Lretint64 /* FFI_TYPE_SINT64 */ + .long .Lretstruct /* FFI_TYPE_STRUCT */ + .long .Lretint /* FFI_TYPE_POINTER */ + .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lretstruct /* FFI_TYPE_MS_STRUCT */ +1: + add %ecx, %ecx + add %ecx, %ecx + add (%esp),%ecx + add $4, %esp + jmp *(%ecx) + + /* Sign/zero extend as appropriate. */ +.Lretsint8: + movsbl %al, %eax + jmp .Lretint + +.Lretsint16: + movswl %ax, %eax + jmp .Lretint + +.Lretuint8: + movzbl %al, %eax + jmp .Lretint + +.Lretuint16: + movzwl %ax, %eax + jmp .Lretint + +.Lretint: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + movl %eax,0(%ecx) + jmp .Lepilogue + +.Lretfloat: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + fstps (%ecx) + jmp .Lepilogue + +.Lretdouble: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + fstpl (%ecx) + jmp .Lepilogue + +.Lretlongdouble: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + fstpt (%ecx) + jmp .Lepilogue + +.Lretint64: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp .Lepilogue + +.Lretstruct1b: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + movb %al,0(%ecx) + jmp .Lepilogue + +.Lretstruct2b: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + movw %ax,0(%ecx) + jmp .Lepilogue + +.Lretstruct4b: + // Load %ecx with the pointer to storage for the return value + movl 28(%ebp),%ecx + movl %eax,0(%ecx) + jmp .Lepilogue + +.Lretstruct: + // Nothing to do! + +.Lnoretval: +.Lepilogue: + movl %ebp,%esp + popl %ebp + ret +.ffi_call_win32_end: + .balign 16 + .globl _ffi_closure_THISCALL +#ifndef __OS2__ + .def _ffi_closure_THISCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_THISCALL: + pushl %ebp + movl %esp, %ebp + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + jmp .stub +.LFE1: + + // This assumes we are using gas. + .balign 16 + .globl _ffi_closure_SYSV +#ifndef __OS2__ + .def _ffi_closure_SYSV; .scl 2; .type 32; .endef +#endif +_ffi_closure_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx +.stub: + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + +0: + call 1f + // Do not insert anything here between the call and the jump table. +.Lcls_store_table: + .long .Lcls_noretval /* FFI_TYPE_VOID */ + .long .Lcls_retint /* FFI_TYPE_INT */ + .long .Lcls_retfloat /* FFI_TYPE_FLOAT */ + .long .Lcls_retdouble /* FFI_TYPE_DOUBLE */ + .long .Lcls_retldouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lcls_retuint8 /* FFI_TYPE_UINT8 */ + .long .Lcls_retsint8 /* FFI_TYPE_SINT8 */ + .long .Lcls_retuint16 /* FFI_TYPE_UINT16 */ + .long .Lcls_retsint16 /* FFI_TYPE_SINT16 */ + .long .Lcls_retint /* FFI_TYPE_UINT32 */ + .long .Lcls_retint /* FFI_TYPE_SINT32 */ + .long .Lcls_retllong /* FFI_TYPE_UINT64 */ + .long .Lcls_retllong /* FFI_TYPE_SINT64 */ + .long .Lcls_retstruct /* FFI_TYPE_STRUCT */ + .long .Lcls_retint /* FFI_TYPE_POINTER */ + .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lcls_retmsstruct /* FFI_TYPE_MS_STRUCT */ + +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + /* Sign/zero extend as appropriate. */ +.Lcls_retsint8: + movsbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retsint16: + movswl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retuint8: + movzbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retuint16: + movzwl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue + +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue + +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue + +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue + +.Lcls_retstruct1: + movsbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct2: + movswl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct4: + movl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct: + // Caller expects us to pop struct return value pointer hidden arg. + movl %ebp, %esp + popl %ebp + ret $0x4 + +.Lcls_retmsstruct: + // Caller expects us to return a pointer to the real return value. + mov %ecx, %eax + // Caller doesn't expects us to pop struct return value pointer hidden arg. + jmp .Lcls_epilogue + +.Lcls_noretval: +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.ffi_closure_SYSV_end: +.LFE3: + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + .balign 16 + .globl _ffi_closure_raw_THISCALL +#ifndef __OS2__ + .def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_raw_THISCALL: + pushl %ebp + movl %esp, %ebp + pushl %esi + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 12(%ebp), %edx /* __builtin_dwarf_cfa () */ + jmp .stubraw + // This assumes we are using gas. + .balign 16 + .globl _ffi_closure_raw_SYSV +#ifndef __OS2__ + .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef +#endif +_ffi_closure_raw_SYSV: +.LFB4: + pushl %ebp +.LCFI6: + movl %esp, %ebp +.LCFI7: + pushl %esi +.LCFI8: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ +.stubraw: + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ +0: + call 1f + // Do not insert anything here between the call and the jump table. +.Lrcls_store_table: + .long .Lrcls_noretval /* FFI_TYPE_VOID */ + .long .Lrcls_retint /* FFI_TYPE_INT */ + .long .Lrcls_retfloat /* FFI_TYPE_FLOAT */ + .long .Lrcls_retdouble /* FFI_TYPE_DOUBLE */ + .long .Lrcls_retldouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lrcls_retuint8 /* FFI_TYPE_UINT8 */ + .long .Lrcls_retsint8 /* FFI_TYPE_SINT8 */ + .long .Lrcls_retuint16 /* FFI_TYPE_UINT16 */ + .long .Lrcls_retsint16 /* FFI_TYPE_SINT16 */ + .long .Lrcls_retint /* FFI_TYPE_UINT32 */ + .long .Lrcls_retint /* FFI_TYPE_SINT32 */ + .long .Lrcls_retllong /* FFI_TYPE_UINT64 */ + .long .Lrcls_retllong /* FFI_TYPE_SINT64 */ + .long .Lrcls_retstruct /* FFI_TYPE_STRUCT */ + .long .Lrcls_retint /* FFI_TYPE_POINTER */ + .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + .long .Lrcls_retstruct /* FFI_TYPE_MS_STRUCT */ +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + /* Sign/zero extend as appropriate. */ +.Lrcls_retsint8: + movsbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retsint16: + movswl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retuint8: + movzbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retuint16: + movzwl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue + +.Lrcls_retstruct1: + movsbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct2: + movswl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct4: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct: + // Nothing to do! + +.Lrcls_noretval: +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.ffi_closure_raw_SYSV_end: +.LFE4: + +#endif /* !FFI_NO_RAW_API */ + + // This assumes we are using gas. + .balign 16 + .globl _ffi_closure_STDCALL +#ifndef __OS2__ + .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_STDCALL: +.LFB5: + pushl %ebp +.LCFI9: + movl %esp, %ebp +.LCFI10: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + movl %edx, 4(%esp) /* args */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx +0: + call 1f + // Do not insert anything here between the call and the jump table. +.Lscls_store_table: + .long .Lscls_noretval /* FFI_TYPE_VOID */ + .long .Lscls_retint /* FFI_TYPE_INT */ + .long .Lscls_retfloat /* FFI_TYPE_FLOAT */ + .long .Lscls_retdouble /* FFI_TYPE_DOUBLE */ + .long .Lscls_retldouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lscls_retuint8 /* FFI_TYPE_UINT8 */ + .long .Lscls_retsint8 /* FFI_TYPE_SINT8 */ + .long .Lscls_retuint16 /* FFI_TYPE_UINT16 */ + .long .Lscls_retsint16 /* FFI_TYPE_SINT16 */ + .long .Lscls_retint /* FFI_TYPE_UINT32 */ + .long .Lscls_retint /* FFI_TYPE_SINT32 */ + .long .Lscls_retllong /* FFI_TYPE_UINT64 */ + .long .Lscls_retllong /* FFI_TYPE_SINT64 */ + .long .Lscls_retstruct /* FFI_TYPE_STRUCT */ + .long .Lscls_retint /* FFI_TYPE_POINTER */ + .long .Lscls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lscls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lscls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + /* Sign/zero extend as appropriate. */ +.Lscls_retsint8: + movsbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retsint16: + movswl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retuint8: + movzbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retuint16: + movzwl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retint: + movl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retfloat: + flds (%ecx) + jmp .Lscls_epilogue + +.Lscls_retdouble: + fldl (%ecx) + jmp .Lscls_epilogue + +.Lscls_retldouble: + fldt (%ecx) + jmp .Lscls_epilogue + +.Lscls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lscls_epilogue + +.Lscls_retstruct1: + movsbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct2: + movswl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct4: + movl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct: + // Nothing to do! + +.Lscls_noretval: +.Lscls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.ffi_closure_STDCALL_end: +.LFE5: + +#ifndef __OS2__ + .section .eh_frame,"w" +#endif +.Lframe1: +.LSCIE1: + .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ +.LASCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ +#ifdef __PIC__ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ +#endif + .byte 0xc /* DW_CFA_def_cfa CFA = r4 + 4 = 4(%esp) */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 %eip at CFA + 1 * -4 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: + +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1 +#endif + .long .LFE1-.LFB1 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE1: + + +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB3-. /* FDE initial location */ +#else + .long .LFB3 +#endif + .long .LFE3-.LFB3 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LFB3 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI5-.LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE3: + +#if !FFI_NO_RAW_API + +.LSFDE4: + .long .LEFDE4-.LASFDE4 /* FDE Length */ +.LASFDE4: + .long .LASFDE4-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB4-. /* FDE initial location */ +#else + .long .LFB4 +#endif + .long .LFE4-.LFB4 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI6-.LFB4 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI7-.LCFI6 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI8-.LCFI7 + .byte 0x86 /* DW_CFA_offset, column 0x6 %esi at CFA + 3 * -4 */ + .byte 0x3 /* .uleb128 0x3 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE4: + +#endif /* !FFI_NO_RAW_API */ + +.LSFDE5: + .long .LEFDE5-.LASFDE5 /* FDE Length */ +.LASFDE5: + .long .LASFDE5-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB5-. /* FDE initial location */ +#else + .long .LFB5 +#endif + .long .LFE5-.LFB5 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI9-.LFB5 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI10-.LCFI9 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE5: diff --git a/lib/wrappers/libffi/gcc/win32_asm.s b/lib/wrappers/libffi/gcc/win32_asm.s new file mode 100644 index 000000000..7a3e7f16c --- /dev/null +++ b/lib/wrappers/libffi/gcc/win32_asm.s @@ -0,0 +1,736 @@ +# 1 "gcc\\win32_asm.asm" +# 1 "<command-line>" +# 1 "gcc\\win32_asm.asm" +# 33 "gcc\\win32_asm.asm" +# 1 "common/fficonfig.h" 1 +# 34 "gcc\\win32_asm.asm" 2 +# 1 "common/ffi.h" 1 +# 63 "common/ffi.h" +# 1 "common/ffitarget.h" 1 +# 64 "common/ffi.h" 2 +# 35 "gcc\\win32_asm.asm" 2 + + + .text + + + .balign 16 + .globl _ffi_call_win32 + + .def _ffi_call_win32; .scl 2; .type 32; .endef + +_ffi_call_win32: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + + movl 20(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + + addl $8,%esp + + + cmpl $3, 16(%ebp) + jz .do_thiscall + cmpl $4, 16(%ebp) + jnz .do_fncall + movl (%esp), %ecx + movl 4(%esp), %edx + addl $8, %esp + jmp .do_fncall +.do_thiscall: + movl (%esp), %ecx + addl $4, %esp + +.do_fncall: + + + + + call *32(%ebp) + + + + + movl 24(%ebp),%ecx + + + cmpl $0,28(%ebp) + jne 0f + + + + cmpl $2,%ecx + jne .Lnoretval + fstp %st(0) + + jmp .Lepilogue + +0: + call 1f + +.Lstore_table: + .long .Lnoretval + .long .Lretint + .long .Lretfloat + .long .Lretdouble + .long .Lretlongdouble + .long .Lretuint8 + .long .Lretsint8 + .long .Lretuint16 + .long .Lretsint16 + .long .Lretint + .long .Lretint + .long .Lretint64 + .long .Lretint64 + .long .Lretstruct + .long .Lretint + .long .Lretstruct1b + .long .Lretstruct2b + .long .Lretstruct4b + .long .Lretstruct +1: + add %ecx, %ecx + add %ecx, %ecx + add (%esp),%ecx + add $4, %esp + jmp *(%ecx) + + +.Lretsint8: + movsbl %al, %eax + jmp .Lretint + +.Lretsint16: + movswl %ax, %eax + jmp .Lretint + +.Lretuint8: + movzbl %al, %eax + jmp .Lretint + +.Lretuint16: + movzwl %ax, %eax + jmp .Lretint + +.Lretint: + + movl 28(%ebp),%ecx + movl %eax,0(%ecx) + jmp .Lepilogue + +.Lretfloat: + + movl 28(%ebp),%ecx + fstps (%ecx) + jmp .Lepilogue + +.Lretdouble: + + movl 28(%ebp),%ecx + fstpl (%ecx) + jmp .Lepilogue + +.Lretlongdouble: + + movl 28(%ebp),%ecx + fstpt (%ecx) + jmp .Lepilogue + +.Lretint64: + + movl 28(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp .Lepilogue + +.Lretstruct1b: + + movl 28(%ebp),%ecx + movb %al,0(%ecx) + jmp .Lepilogue + +.Lretstruct2b: + + movl 28(%ebp),%ecx + movw %ax,0(%ecx) + jmp .Lepilogue + +.Lretstruct4b: + + movl 28(%ebp),%ecx + movl %eax,0(%ecx) + jmp .Lepilogue + +.Lretstruct: + + +.Lnoretval: +.Lepilogue: + movl %ebp,%esp + popl %ebp + ret +.ffi_call_win32_end: + .balign 16 + .globl _ffi_closure_THISCALL + + .def _ffi_closure_THISCALL; .scl 2; .type 32; .endef + +_ffi_closure_THISCALL: + pushl %ebp + movl %esp, %ebp + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) + leal 12(%ebp), %edx + jmp .stub +.LFE1: + + + .balign 16 + .globl _ffi_closure_SYSV + + .def _ffi_closure_SYSV; .scl 2; .type 32; .endef + +_ffi_closure_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) + leal 8(%ebp), %edx +.stub: + movl %edx, 4(%esp) + leal -12(%ebp), %edx + movl %edx, (%esp) + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + +0: + call 1f + +.Lcls_store_table: + .long .Lcls_noretval + .long .Lcls_retint + .long .Lcls_retfloat + .long .Lcls_retdouble + .long .Lcls_retldouble + .long .Lcls_retuint8 + .long .Lcls_retsint8 + .long .Lcls_retuint16 + .long .Lcls_retsint16 + .long .Lcls_retint + .long .Lcls_retint + .long .Lcls_retllong + .long .Lcls_retllong + .long .Lcls_retstruct + .long .Lcls_retint + .long .Lcls_retstruct1 + .long .Lcls_retstruct2 + .long .Lcls_retstruct4 + .long .Lcls_retmsstruct + +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + +.Lcls_retsint8: + movsbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retsint16: + movswl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retuint8: + movzbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retuint16: + movzwl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue + +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue + +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue + +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue + +.Lcls_retstruct1: + movsbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct2: + movswl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct4: + movl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct: + + movl %ebp, %esp + popl %ebp + ret $0x4 + +.Lcls_retmsstruct: + + mov %ecx, %eax + + jmp .Lcls_epilogue + +.Lcls_noretval: +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.ffi_closure_SYSV_end: +.LFE3: + + + + + + + + .balign 16 + .globl _ffi_closure_raw_THISCALL + + .def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef + +_ffi_closure_raw_THISCALL: + pushl %ebp + movl %esp, %ebp + pushl %esi + subl $36, %esp + movl ((52 + 3) & ~3)(%eax), %esi + movl ((((52 + 3) & ~3) + 4) + 4)(%eax), %edx + movl %edx, 12(%esp) + leal 12(%ebp), %edx + jmp .stubraw + + .balign 16 + .globl _ffi_closure_raw_SYSV + + .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef + +_ffi_closure_raw_SYSV: +.LFB4: + pushl %ebp +.LCFI6: + movl %esp, %ebp +.LCFI7: + pushl %esi +.LCFI8: + subl $36, %esp + movl ((52 + 3) & ~3)(%eax), %esi + movl ((((52 + 3) & ~3) + 4) + 4)(%eax), %edx + movl %edx, 12(%esp) + leal 8(%ebp), %edx +.stubraw: + movl %edx, 8(%esp) + leal -24(%ebp), %edx + movl %edx, 4(%esp) + movl %esi, (%esp) + call *(((52 + 3) & ~3) + 4)(%eax) + movl 20(%esi), %eax +0: + call 1f + +.Lrcls_store_table: + .long .Lrcls_noretval + .long .Lrcls_retint + .long .Lrcls_retfloat + .long .Lrcls_retdouble + .long .Lrcls_retldouble + .long .Lrcls_retuint8 + .long .Lrcls_retsint8 + .long .Lrcls_retuint16 + .long .Lrcls_retsint16 + .long .Lrcls_retint + .long .Lrcls_retint + .long .Lrcls_retllong + .long .Lrcls_retllong + .long .Lrcls_retstruct + .long .Lrcls_retint + .long .Lrcls_retstruct1 + .long .Lrcls_retstruct2 + .long .Lrcls_retstruct4 + .long .Lrcls_retstruct +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + +.Lrcls_retsint8: + movsbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retsint16: + movswl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retuint8: + movzbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retuint16: + movzwl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue + +.Lrcls_retstruct1: + movsbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct2: + movswl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct4: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct: + + +.Lrcls_noretval: +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.ffi_closure_raw_SYSV_end: +.LFE4: + + + + + .balign 16 + .globl _ffi_closure_STDCALL + + .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef + +_ffi_closure_STDCALL: +.LFB5: + pushl %ebp +.LCFI9: + movl %esp, %ebp +.LCFI10: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) + leal 12(%ebp), %edx + movl %edx, 4(%esp) + leal -12(%ebp), %edx + movl %edx, (%esp) + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx +0: + call 1f + +.Lscls_store_table: + .long .Lscls_noretval + .long .Lscls_retint + .long .Lscls_retfloat + .long .Lscls_retdouble + .long .Lscls_retldouble + .long .Lscls_retuint8 + .long .Lscls_retsint8 + .long .Lscls_retuint16 + .long .Lscls_retsint16 + .long .Lscls_retint + .long .Lscls_retint + .long .Lscls_retllong + .long .Lscls_retllong + .long .Lscls_retstruct + .long .Lscls_retint + .long .Lscls_retstruct1 + .long .Lscls_retstruct2 + .long .Lscls_retstruct4 +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + +.Lscls_retsint8: + movsbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retsint16: + movswl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retuint8: + movzbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retuint16: + movzwl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retint: + movl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retfloat: + flds (%ecx) + jmp .Lscls_epilogue + +.Lscls_retdouble: + fldl (%ecx) + jmp .Lscls_epilogue + +.Lscls_retldouble: + fldt (%ecx) + jmp .Lscls_epilogue + +.Lscls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lscls_epilogue + +.Lscls_retstruct1: + movsbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct2: + movswl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct4: + movl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct: + + +.Lscls_noretval: +.Lscls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.ffi_closure_STDCALL_end: +.LFE5: + + + .section .eh_frame,"w" + +.Lframe1: +.LSCIE1: + .long .LECIE1-.LASCIE1 +.LASCIE1: + .long 0x0 + .byte 0x1 + + + + .ascii "\0" + + .byte 0x1 + .byte 0x7c + .byte 0x8 + + + + + .byte 0xc + .byte 0x4 + .byte 0x4 + .byte 0x88 + .byte 0x1 + .align 4 +.LECIE1: + +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + + + + .long .LFB1 + + .long .LFE1-.LFB1 + + + + + + .byte 0x4 + .long .LCFI0-.LFB1 + .byte 0xe + .byte 0x8 + .byte 0x85 + .byte 0x2 + + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .byte 0x5 + + + .align 4 +.LEFDE1: + + +.LSFDE3: + .long .LEFDE3-.LASFDE3 +.LASFDE3: + .long .LASFDE3-.Lframe1 + + + + .long .LFB3 + + .long .LFE3-.LFB3 + + + + + + .byte 0x4 + .long .LCFI4-.LFB3 + .byte 0xe + .byte 0x8 + .byte 0x85 + .byte 0x2 + + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xd + .byte 0x5 + + + .align 4 +.LEFDE3: + + + +.LSFDE4: + .long .LEFDE4-.LASFDE4 +.LASFDE4: + .long .LASFDE4-.Lframe1 + + + + .long .LFB4 + + .long .LFE4-.LFB4 + + + + + + .byte 0x4 + .long .LCFI6-.LFB4 + .byte 0xe + .byte 0x8 + .byte 0x85 + .byte 0x2 + + .byte 0x4 + .long .LCFI7-.LCFI6 + .byte 0xd + .byte 0x5 + + .byte 0x4 + .long .LCFI8-.LCFI7 + .byte 0x86 + .byte 0x3 + + + .align 4 +.LEFDE4: + + + +.LSFDE5: + .long .LEFDE5-.LASFDE5 +.LASFDE5: + .long .LASFDE5-.Lframe1 + + + + .long .LFB5 + + .long .LFE5-.LFB5 + + + + + + .byte 0x4 + .long .LCFI9-.LFB5 + .byte 0xe + .byte 0x8 + .byte 0x85 + .byte 0x2 + + .byte 0x4 + .long .LCFI10-.LCFI9 + .byte 0xd + .byte 0x5 + + + .align 4 +.LEFDE5: diff --git a/lib/wrappers/libffi/gcc/win64_asm.asm b/lib/wrappers/libffi/gcc/win64_asm.asm new file mode 100644 index 000000000..1dc98f99a --- /dev/null +++ b/lib/wrappers/libffi/gcc/win64_asm.asm @@ -0,0 +1,467 @@ +#define LIBFFI_ASM +#include <fficonfig.h> +#include <ffi.h> + +/* Constants for ffi_call_win64 */ +#define STACK 0 +#define PREP_ARGS_FN 32 +#define ECIF 40 +#define CIF_BYTES 48 +#define CIF_FLAGS 56 +#define RVALUE 64 +#define FN 72 + +/* ffi_call_win64 (void (*prep_args_fn)(char *, extended_cif *), + extended_cif *ecif, unsigned bytes, unsigned flags, + unsigned *rvalue, void (*fn)()); + */ + +#ifdef _MSC_VER +PUBLIC ffi_call_win64 + +EXTRN __chkstk:NEAR +EXTRN ffi_closure_win64_inner:NEAR + +_TEXT SEGMENT + +;;; ffi_closure_win64 will be called with these registers set: +;;; rax points to 'closure' +;;; r11 contains a bit mask that specifies which of the +;;; first four parameters are float or double +;;; +;;; It must move the parameters passed in registers to their stack location, +;;; call ffi_closure_win64_inner for the actual work, then return the result. +;;; +ffi_closure_win64 PROC FRAME + ;; copy register arguments onto stack + test r11, 1 + jne first_is_float + mov QWORD PTR [rsp+8], rcx + jmp second +first_is_float: + movlpd QWORD PTR [rsp+8], xmm0 + +second: + test r11, 2 + jne second_is_float + mov QWORD PTR [rsp+16], rdx + jmp third +second_is_float: + movlpd QWORD PTR [rsp+16], xmm1 + +third: + test r11, 4 + jne third_is_float + mov QWORD PTR [rsp+24], r8 + jmp fourth +third_is_float: + movlpd QWORD PTR [rsp+24], xmm2 + +fourth: + test r11, 8 + jne fourth_is_float + mov QWORD PTR [rsp+32], r9 + jmp done +fourth_is_float: + movlpd QWORD PTR [rsp+32], xmm3 + +done: + .ALLOCSTACK 40 + sub rsp, 40 + .ENDPROLOG + mov rcx, rax ; context is first parameter + mov rdx, rsp ; stack is second parameter + add rdx, 48 ; point to start of arguments + mov rax, ffi_closure_win64_inner + call rax ; call the real closure function + add rsp, 40 + movd xmm0, rax ; If the closure returned a float, + ; ffi_closure_win64_inner wrote it to rax + ret 0 +ffi_closure_win64 ENDP + +ffi_call_win64 PROC FRAME + ;; copy registers onto stack + mov QWORD PTR [rsp+32], r9 + mov QWORD PTR [rsp+24], r8 + mov QWORD PTR [rsp+16], rdx + mov QWORD PTR [rsp+8], rcx + .PUSHREG rbp + push rbp + .ALLOCSTACK 48 + sub rsp, 48 ; 00000030H + .SETFRAME rbp, 32 + lea rbp, QWORD PTR [rsp+32] + .ENDPROLOG + + mov eax, DWORD PTR CIF_BYTES[rbp] + add rax, 15 + and rax, -16 + call __chkstk + sub rsp, rax + lea rax, QWORD PTR [rsp+32] + mov QWORD PTR STACK[rbp], rax + + mov rdx, QWORD PTR ECIF[rbp] + mov rcx, QWORD PTR STACK[rbp] + call QWORD PTR PREP_ARGS_FN[rbp] + + mov rsp, QWORD PTR STACK[rbp] + + movlpd xmm3, QWORD PTR [rsp+24] + movd r9, xmm3 + + movlpd xmm2, QWORD PTR [rsp+16] + movd r8, xmm2 + + movlpd xmm1, QWORD PTR [rsp+8] + movd rdx, xmm1 + + movlpd xmm0, QWORD PTR [rsp] + movd rcx, xmm0 + + call QWORD PTR FN[rbp] +ret_struct4b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_4B + jne ret_struct2b$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov DWORD PTR [rcx], eax + jmp ret_void$ + +ret_struct2b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B + jne ret_struct1b$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov WORD PTR [rcx], ax + jmp ret_void$ + +ret_struct1b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B + jne ret_uint8$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov BYTE PTR [rcx], al + jmp ret_void$ + +ret_uint8$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8 + jne ret_sint8$ + + mov rcx, QWORD PTR RVALUE[rbp] + movzx rax, al + mov QWORD PTR [rcx], rax + jmp ret_void$ + +ret_sint8$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8 + jne ret_uint16$ + + mov rcx, QWORD PTR RVALUE[rbp] + movsx rax, al + mov QWORD PTR [rcx], rax + jmp ret_void$ + +ret_uint16$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16 + jne ret_sint16$ + + mov rcx, QWORD PTR RVALUE[rbp] + movzx rax, ax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_sint16$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 + jne ret_uint32$ + + mov rcx, QWORD PTR RVALUE[rbp] + movsx rax, ax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_uint32$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 + jne ret_sint32$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov eax, eax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_sint32$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 + jne ret_float$ + + mov rcx, QWORD PTR RVALUE[rbp] + cdqe + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_float$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT + jne SHORT ret_double$ + + mov rax, QWORD PTR RVALUE[rbp] + movss DWORD PTR [rax], xmm0 + jmp SHORT ret_void$ + +ret_double$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE + jne SHORT ret_sint64$ + + mov rax, QWORD PTR RVALUE[rbp] + movlpd QWORD PTR [rax], xmm0 + jmp SHORT ret_void$ + +ret_sint64$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 + jne ret_void$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_void$: + xor rax, rax + + lea rsp, QWORD PTR [rbp+16] + pop rbp + ret 0 +ffi_call_win64 ENDP +_TEXT ENDS +END + +#else + +#ifdef SYMBOL_UNDERSCORE +#define SYMBOL_NAME(name) _##name +#else +#define SYMBOL_NAME(name) name +#endif + +.text + +.extern SYMBOL_NAME(ffi_closure_win64_inner) + +// ffi_closure_win64 will be called with these registers set: +// rax points to 'closure' +// r11 contains a bit mask that specifies which of the +// first four parameters are float or double +// // It must move the parameters passed in registers to their stack location, +// call ffi_closure_win64_inner for the actual work, then return the result. +// + .balign 16 + .globl SYMBOL_NAME(ffi_closure_win64) +SYMBOL_NAME(ffi_closure_win64): + // copy register arguments onto stack + test $1,%r11 + jne .Lfirst_is_float + mov %rcx, 8(%rsp) + jmp .Lsecond +.Lfirst_is_float: + movlpd %xmm0, 8(%rsp) + +.Lsecond: + test $2, %r11 + jne .Lsecond_is_float + mov %rdx, 16(%rsp) + jmp .Lthird +.Lsecond_is_float: + movlpd %xmm1, 16(%rsp) + +.Lthird: + test $4, %r11 + jne .Lthird_is_float + mov %r8,24(%rsp) + jmp .Lfourth +.Lthird_is_float: + movlpd %xmm2, 24(%rsp) + +.Lfourth: + test $8, %r11 + jne .Lfourth_is_float + mov %r9, 32(%rsp) + jmp .Ldone +.Lfourth_is_float: + movlpd %xmm3, 32(%rsp) + +.Ldone: +// ALLOCSTACK 40 + sub $40, %rsp +// ENDPROLOG + mov %rax, %rcx // context is first parameter + mov %rsp, %rdx // stack is second parameter + add $48, %rdx // point to start of arguments + mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax + callq *%rax // call the real closure function + add $40, %rsp + movq %rax, %xmm0 // If the closure returned a float, + // ffi_closure_win64_inner wrote it to rax + retq +.ffi_closure_win64_end: + + .balign 16 + .globl SYMBOL_NAME(ffi_call_win64) +SYMBOL_NAME(ffi_call_win64): + // copy registers onto stack + mov %r9,32(%rsp) + mov %r8,24(%rsp) + mov %rdx,16(%rsp) + mov %rcx,8(%rsp) + // PUSHREG rbp + push %rbp + // ALLOCSTACK 48 + sub $48,%rsp + // SETFRAME rbp, 32 + lea 32(%rsp),%rbp + // ENDPROLOG + + mov CIF_BYTES(%rbp),%eax + add $15, %rax + and $-16, %rax + cmpq $0x1000, %rax + jb Lch_done +Lch_probe: + subq $0x1000,%rsp + orl $0x0, (%rsp) + subq $0x1000,%rax + cmpq $0x1000,%rax + ja Lch_probe +Lch_done: + subq %rax, %rsp + orl $0x0, (%rsp) + lea 32(%rsp), %rax + mov %rax, STACK(%rbp) + + mov ECIF(%rbp), %rdx + mov STACK(%rbp), %rcx + callq *PREP_ARGS_FN(%rbp) + + mov STACK(%rbp), %rsp + + movlpd 24(%rsp), %xmm3 + movd %xmm3, %r9 + + movlpd 16(%rsp), %xmm2 + movd %xmm2, %r8 + + movlpd 8(%rsp), %xmm1 + movd %xmm1, %rdx + + movlpd (%rsp), %xmm0 + movd %xmm0, %rcx + + callq *FN(%rbp) +.Lret_struct4b: + cmpl $FFI_TYPE_SMALL_STRUCT_4B, CIF_FLAGS(%rbp) + jne .Lret_struct2b + + mov RVALUE(%rbp), %rcx + mov %eax, (%rcx) + jmp .Lret_void + +.Lret_struct2b: + cmpl $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp) + jne .Lret_struct1b + + mov RVALUE(%rbp), %rcx + mov %ax, (%rcx) + jmp .Lret_void + +.Lret_struct1b: + cmpl $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp) + jne .Lret_uint8 + + mov RVALUE(%rbp), %rcx + mov %al, (%rcx) + jmp .Lret_void + +.Lret_uint8: + cmpl $FFI_TYPE_UINT8, CIF_FLAGS(%rbp) + jne .Lret_sint8 + + mov RVALUE(%rbp), %rcx + movzbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint8: + cmpl $FFI_TYPE_SINT8, CIF_FLAGS(%rbp) + jne .Lret_uint16 + + mov RVALUE(%rbp), %rcx + movsbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint16: + cmpl $FFI_TYPE_UINT16, CIF_FLAGS(%rbp) + jne .Lret_sint16 + + mov RVALUE(%rbp), %rcx + movzwq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint16: + cmpl $FFI_TYPE_SINT16, CIF_FLAGS(%rbp) + jne .Lret_uint32 + + mov RVALUE(%rbp), %rcx + movswq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint32: + cmpl $FFI_TYPE_UINT32, CIF_FLAGS(%rbp) + jne .Lret_sint32 + + mov RVALUE(%rbp), %rcx + movl %eax, %eax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint32: + cmpl $FFI_TYPE_SINT32, CIF_FLAGS(%rbp) + jne .Lret_float + + mov RVALUE(%rbp), %rcx + cltq + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_float: + cmpl $FFI_TYPE_FLOAT, CIF_FLAGS(%rbp) + jne .Lret_double + + mov RVALUE(%rbp), %rax + movss %xmm0, (%rax) + jmp .Lret_void + +.Lret_double: + cmpl $FFI_TYPE_DOUBLE, CIF_FLAGS(%rbp) + jne .Lret_sint64 + + mov RVALUE(%rbp), %rax + movlpd %xmm0, (%rax) + jmp .Lret_void + +.Lret_sint64: + cmpl $FFI_TYPE_SINT64, CIF_FLAGS(%rbp) + jne .Lret_void + + mov RVALUE(%rbp), %rcx + mov %rax, (%rcx) + jmp .Lret_void + +.Lret_void: + xor %rax, %rax + + lea 16(%rbp), %rsp + pop %rbp + retq +.ffi_call_win64_end: +#endif /* !_MSC_VER */ + diff --git a/lib/wrappers/libffi/gcc/win64_asm.s b/lib/wrappers/libffi/gcc/win64_asm.s new file mode 100644 index 000000000..f2c2df10d --- /dev/null +++ b/lib/wrappers/libffi/gcc/win64_asm.s @@ -0,0 +1,227 @@ +# 1 "gcc\\win64_asm.asm" +# 1 "<command-line>" +# 1 "gcc\\win64_asm.asm" + +# 1 "common/fficonfig.h" 1 +# 3 "gcc\\win64_asm.asm" 2 +# 1 "common/ffi.h" 1 +# 63 "common/ffi.h" +# 1 "common/ffitarget.h" 1 +# 64 "common/ffi.h" 2 +# 4 "gcc\\win64_asm.asm" 2 +# 244 "gcc\\win64_asm.asm" +.text + +.extern ffi_closure_win64_inner +# 255 "gcc\\win64_asm.asm" + .balign 16 + .globl ffi_closure_win64 +ffi_closure_win64: + + test $1,%r11 + jne .Lfirst_is_float + mov %rcx, 8(%rsp) + jmp .Lsecond +.Lfirst_is_float: + movlpd %xmm0, 8(%rsp) + +.Lsecond: + test $2, %r11 + jne .Lsecond_is_float + mov %rdx, 16(%rsp) + jmp .Lthird +.Lsecond_is_float: + movlpd %xmm1, 16(%rsp) + +.Lthird: + test $4, %r11 + jne .Lthird_is_float + mov %r8,24(%rsp) + jmp .Lfourth +.Lthird_is_float: + movlpd %xmm2, 24(%rsp) + +.Lfourth: + test $8, %r11 + jne .Lfourth_is_float + mov %r9, 32(%rsp) + jmp .Ldone +.Lfourth_is_float: + movlpd %xmm3, 32(%rsp) + +.Ldone: + + sub $40, %rsp + + mov %rax, %rcx + mov %rsp, %rdx + add $48, %rdx + mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax + callq *%rax + add $40, %rsp + movq %rax, %xmm0 + + retq +.ffi_closure_win64_end: + + .balign 16 + .globl ffi_call_win64 +ffi_call_win64: + + mov %r9,32(%rsp) + mov %r8,24(%rsp) + mov %rdx,16(%rsp) + mov %rcx,8(%rsp) + + push %rbp + + sub $48,%rsp + + lea 32(%rsp),%rbp + + + mov 48(%rbp),%eax + add $15, %rax + and $-16, %rax + cmpq $0x1000, %rax + jb Lch_done +Lch_probe: + subq $0x1000,%rsp + orl $0x0, (%rsp) + subq $0x1000,%rax + cmpq $0x1000,%rax + ja Lch_probe +Lch_done: + subq %rax, %rsp + orl $0x0, (%rsp) + lea 32(%rsp), %rax + mov %rax, 0(%rbp) + + mov 40(%rbp), %rdx + mov 0(%rbp), %rcx + callq *32(%rbp) + + mov 0(%rbp), %rsp + + movlpd 24(%rsp), %xmm3 + movd %xmm3, %r9 + + movlpd 16(%rsp), %xmm2 + movd %xmm2, %r8 + + movlpd 8(%rsp), %xmm1 + movd %xmm1, %rdx + + movlpd (%rsp), %xmm0 + movd %xmm0, %rcx + + callq *72(%rbp) +.Lret_struct4b: + cmpl $FFI_TYPE_SMALL_STRUCT_4B, 56(%rbp) + jne .Lret_struct2b + + mov 64(%rbp), %rcx + mov %eax, (%rcx) + jmp .Lret_void + +.Lret_struct2b: + cmpl $FFI_TYPE_SMALL_STRUCT_2B, 56(%rbp) + jne .Lret_struct1b + + mov 64(%rbp), %rcx + mov %ax, (%rcx) + jmp .Lret_void + +.Lret_struct1b: + cmpl $FFI_TYPE_SMALL_STRUCT_1B, 56(%rbp) + jne .Lret_uint8 + + mov 64(%rbp), %rcx + mov %al, (%rcx) + jmp .Lret_void + +.Lret_uint8: + cmpl $FFI_TYPE_UINT8, 56(%rbp) + jne .Lret_sint8 + + mov 64(%rbp), %rcx + movzbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint8: + cmpl $FFI_TYPE_SINT8, 56(%rbp) + jne .Lret_uint16 + + mov 64(%rbp), %rcx + movsbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint16: + cmpl $FFI_TYPE_UINT16, 56(%rbp) + jne .Lret_sint16 + + mov 64(%rbp), %rcx + movzwq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint16: + cmpl $FFI_TYPE_SINT16, 56(%rbp) + jne .Lret_uint32 + + mov 64(%rbp), %rcx + movswq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint32: + cmpl $9, 56(%rbp) + jne .Lret_sint32 + + mov 64(%rbp), %rcx + movl %eax, %eax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint32: + cmpl $10, 56(%rbp) + jne .Lret_float + + mov 64(%rbp), %rcx + cltq + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_float: + cmpl $2, 56(%rbp) + jne .Lret_double + + mov 64(%rbp), %rax + movss %xmm0, (%rax) + jmp .Lret_void + +.Lret_double: + cmpl $3, 56(%rbp) + jne .Lret_sint64 + + mov 64(%rbp), %rax + movlpd %xmm0, (%rax) + jmp .Lret_void + +.Lret_sint64: + cmpl $12, 56(%rbp) + jne .Lret_void + + mov 64(%rbp), %rcx + mov %rax, (%rcx) + jmp .Lret_void + +.Lret_void: + xor %rax, %rax + + lea 16(%rbp), %rsp + pop %rbp + retq +.ffi_call_win64_end: diff --git a/lib/wrappers/libffi.nim b/lib/wrappers/libffi/libffi.nim index 514ce024f..1b6130103 100644 --- a/lib/wrappers/libffi.nim +++ b/lib/wrappers/libffi/libffi.nim @@ -26,12 +26,36 @@ {.deadCodeElim: on.} -when defined(windows): - const libffidll* = "libffi.dll" -elif defined(macosx): - const libffidll* = "libffi.dylib" -else: - const libffidll* = "libffi.so" +when defined(windows): + # on Windows we don't use a DLL but instead embed libffi directly: + {.pragma: mylib, header: r"ffi.h".} + + #{.compile: r"common\malloc_closure.c".} + {.compile: r"common\raw_api.c".} + when defined(vcc): + {.compile: r"msvc\ffi.c".} + {.compile: r"msvc\prep_cif.c".} + {.compile: r"msvc\win32.c".} + {.compile: r"msvc\types.c".} + when defined(cpu64): + {.compile: r"msvc\win64_asm.asm".} + else: + {.compile: r"msvc\win32_asm.asm".} + else: + {.compile: r"gcc\ffi.c".} + {.compile: r"gcc\prep_cif.c".} + {.compile: r"gcc\types.c".} + {.compile: r"gcc\closures.c".} + when defined(cpu64): + {.compile: r"gcc\ffi64.c".} + {.compile: r"gcc\win64_asm.S".} + else: + {.compile: r"gcc\win32_asm.S".} + +elif defined(macosx): + {.pragma: mylib, dynlib: "libffi.dylib".} +else: + {.pragma: mylib, dynlib: "libffi.so".} type TArg* = int @@ -88,19 +112,19 @@ type elements*: ptr ptr TType var - type_void* {.importc: "ffi_type_void", dynlib: libffidll.}: TType - type_uint8* {.importc: "ffi_type_uint8", dynlib: libffidll.}: TType - type_sint8* {.importc: "ffi_type_sint8", dynlib: libffidll.}: TType - type_uint16* {.importc: "ffi_type_uint16", dynlib: libffidll.}: TType - type_sint16* {.importc: "ffi_type_sint16", dynlib: libffidll.}: TType - type_uint32* {.importc: "ffi_type_uint32", dynlib: libffidll.}: TType - type_sint32* {.importc: "ffi_type_sint32", dynlib: libffidll.}: TType - type_uint64* {.importc: "ffi_type_uint64", dynlib: libffidll.}: TType - type_sint64* {.importc: "ffi_type_sint64", dynlib: libffidll.}: TType - type_float* {.importc: "ffi_type_float", dynlib: libffidll.}: TType - type_double* {.importc: "ffi_type_double", dynlib: libffidll.}: TType - type_pointer* {.importc: "ffi_type_pointer", dynlib: libffidll.}: TType - type_longdouble* {.importc: "ffi_type_longdouble", dynlib: libffidll.}: TType + type_void* {.importc: "ffi_type_void", mylib.}: TType + type_uint8* {.importc: "ffi_type_uint8", mylib.}: TType + type_sint8* {.importc: "ffi_type_sint8", mylib.}: TType + type_uint16* {.importc: "ffi_type_uint16", mylib.}: TType + type_sint16* {.importc: "ffi_type_sint16", mylib.}: TType + type_uint32* {.importc: "ffi_type_uint32", mylib.}: TType + type_sint32* {.importc: "ffi_type_sint32", mylib.}: TType + type_uint64* {.importc: "ffi_type_uint64", mylib.}: TType + type_sint64* {.importc: "ffi_type_sint64", mylib.}: TType + type_float* {.importc: "ffi_type_float", mylib.}: TType + type_double* {.importc: "ffi_type_double", mylib.}: TType + type_pointer* {.importc: "ffi_type_pointer", mylib.}: TType + type_longdouble* {.importc: "ffi_type_longdouble", mylib.}: TType type Tstatus* {.size: sizeof(cint).} = enum @@ -119,20 +143,18 @@ type sint*: TSArg proc raw_call*(cif: var Tcif; fn: proc () {.cdecl.}; rvalue: pointer; - avalue: ptr TRaw) {.cdecl, importc: "ffi_raw_call", - dynlib: libffidll.} + avalue: ptr TRaw) {.cdecl, importc: "ffi_raw_call", mylib.} proc ptrarray_to_raw*(cif: var Tcif; args: ptr pointer; raw: ptr TRaw) {.cdecl, - importc: "ffi_ptrarray_to_raw", dynlib: libffidll.} + importc: "ffi_ptrarray_to_raw", mylib.} proc raw_to_ptrarray*(cif: var Tcif; raw: ptr TRaw; args: ptr pointer) {.cdecl, - importc: "ffi_raw_to_ptrarray", dynlib: libffidll.} -proc raw_size*(cif: var Tcif): int {.cdecl, importc: "ffi_raw_size", - dynlib: libffidll.} + importc: "ffi_raw_to_ptrarray", mylib.} +proc raw_size*(cif: var Tcif): int {.cdecl, importc: "ffi_raw_size", mylib.} proc prep_cif*(cif: var Tcif; abi: TABI; nargs: cuint; rtype: ptr TType; atypes: ptr ptr TType): TStatus {.cdecl, importc: "ffi_prep_cif", - dynlib: libffidll.} + mylib.} proc call*(cif: var Tcif; fn: proc () {.cdecl.}; rvalue: pointer; - avalue: ptr pointer) {.cdecl, importc: "ffi_call", dynlib: libffidll.} + avalue: ptr pointer) {.cdecl, importc: "ffi_call", mylib.} # the same with an easier interface: type @@ -141,9 +163,9 @@ type proc prep_cif*(cif: var Tcif; abi: TABI; nargs: cuint; rtype: ptr TType; atypes: TParamList): TStatus {.cdecl, importc: "ffi_prep_cif", - dynlib: libffidll.} + mylib.} proc call*(cif: var Tcif; fn, rvalue: pointer; - avalue: TArgList) {.cdecl, importc: "ffi_call", dynlib: libffidll.} + avalue: TArgList) {.cdecl, importc: "ffi_call", mylib.} # Useful for eliminating compiler warnings ##define FFI_FN(f) ((void (*)(void))f) diff --git a/lib/wrappers/libffi/msvc/ffi.c b/lib/wrappers/libffi/msvc/ffi.c new file mode 100644 index 000000000..6e595e9fe --- /dev/null +++ b/lib/wrappers/libffi/msvc/ffi.c @@ -0,0 +1,457 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1996, 1998, 1999, 2001 Red Hat, Inc. + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2002 Bo Thorsen + Copyright (c) 2002 Roger Sayle + + x86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include <ffi.h> +#include <ffi_common.h> + +#include <stdlib.h> + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +extern void Py_FatalError(const char *msg); + +/*@-exportheader@*/ +void ffi_prep_args(char *stack, extended_cif *ecif) +/*@=exportheader@*/ +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += sizeof(void *); + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + i != 0; + i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(void *) - 1) & (size_t) argp) + argp = (char *) ALIGN(argp, sizeof(void *)); + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } + + if (argp >= stack && (unsigned)(argp - stack) > ecif->cif->bytes) + { + Py_FatalError("FFI BUG: not enough stack space for arguments"); + } + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_STRUCT: + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_LONGDOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_UINT64: +#ifdef _WIN64 + case FFI_TYPE_POINTER: +#endif + cif->flags = FFI_TYPE_SINT64; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +#ifdef _WIN32 +extern int +ffi_call_x86(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, + void (*fn)()); +#endif + +#ifdef _WIN64 +extern int +ffi_call_AMD64(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, + void (*fn)()); +#endif + +int +ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + /*@-sysunrecog@*/ + ecif.rvalue = alloca(cif->rtype->size); + /*@=sysunrecog@*/ + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { +#if !defined(_WIN64) + case FFI_SYSV: + case FFI_STDCALL: + return ffi_call_x86(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; +#else + case FFI_SYSV: + /*@-usedef@*/ + /* Function call needs at least 40 bytes stack size, on win64 AMD64 */ + return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes ? cif->bytes : 40, + cif->flags, ecif.rvalue, fn); + /*@=usedef@*/ + break; +#endif + + default: + FFI_ASSERT(0); + break; + } + return -1; /* theller: Hrm. */ +} + + +/** private members **/ + +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif); +/* This function is jumped to by the trampoline */ + +#ifdef _WIN64 +void * +#else +static void __fastcall +#endif +ffi_closure_SYSV (ffi_closure *closure, int *argp) +{ + // this is our return value storage + long double res; + + // our various things... + ffi_cif *cif; + void **arg_area; + unsigned short rtype; + void *resp = (void*)&res; + void *args = &argp[1]; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, (void**)&resp, arg_area, cif); + + (closure->fun) (cif, resp, arg_area, closure->user_data); + + rtype = cif->flags; + +#if defined(_WIN32) && !defined(_WIN64) +#ifdef _MSC_VER + /* now, do a generic return based on the value of rtype */ + if (rtype == FFI_TYPE_INT) + { + _asm mov eax, resp ; + _asm mov eax, [eax] ; + } + else if (rtype == FFI_TYPE_FLOAT) + { + _asm mov eax, resp ; + _asm fld DWORD PTR [eax] ; +// asm ("flds (%0)" : : "r" (resp) : "st" ); + } + else if (rtype == FFI_TYPE_DOUBLE) + { + _asm mov eax, resp ; + _asm fld QWORD PTR [eax] ; +// asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" ); + } + else if (rtype == FFI_TYPE_LONGDOUBLE) + { +// asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" ); + } + else if (rtype == FFI_TYPE_SINT64) + { + _asm mov edx, resp ; + _asm mov eax, [edx] ; + _asm mov edx, [edx + 4] ; +// asm ("movl 0(%0),%%eax;" +// "movl 4(%0),%%edx" +// : : "r"(resp) +// : "eax", "edx"); + } +#else + /* now, do a generic return based on the value of rtype */ + if (rtype == FFI_TYPE_INT) + { + asm ("movl (%0),%%eax" : : "r" (resp) : "eax"); + } + else if (rtype == FFI_TYPE_FLOAT) + { + asm ("flds (%0)" : : "r" (resp) : "st" ); + } + else if (rtype == FFI_TYPE_DOUBLE) + { + asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" ); + } + else if (rtype == FFI_TYPE_LONGDOUBLE) + { + asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" ); + } + else if (rtype == FFI_TYPE_SINT64) + { + asm ("movl 0(%0),%%eax;" + "movl 4(%0),%%edx" + : : "r"(resp) + : "eax", "edx"); + } +#endif +#endif + +#ifdef _WIN64 + /* The result is returned in rax. This does the right thing for + result types except for floats; we have to 'mov xmm0, rax' in the + caller to correct this. + */ + return *(void **)resp; +#endif +} + +/*@-exportheader@*/ +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif) +/*@=exportheader@*/ +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( cif->rtype->type == FFI_TYPE_STRUCT ) { + *rvalue = *(void **) argp; + argp += 4; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(char *) - 1) & (size_t) argp) { + argp = (char *) ALIGN(argp, sizeof(char*)); + } + + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + + p_argv++; + argp += z; + } + + return; +} + +/* the cif must already be prep'ed */ +extern void ffi_closure_OUTER(); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + short bytes; + char *tramp; +#ifdef _WIN64 + int mask = 0; +#endif + FFI_ASSERT (cif->abi == FFI_SYSV); + + if (cif->abi == FFI_SYSV) + bytes = 0; +#if !defined(_WIN64) + else if (cif->abi == FFI_STDCALL) + bytes = cif->bytes; +#endif + else + return FFI_BAD_ABI; + + tramp = &closure->tramp[0]; + +#define BYTES(text) memcpy(tramp, text, sizeof(text)), tramp += sizeof(text)-1 +#define POINTER(x) *(void**)tramp = (void*)(x), tramp += sizeof(void*) +#define SHORT(x) *(short*)tramp = x, tramp += sizeof(short) +#define INT(x) *(int*)tramp = x, tramp += sizeof(int) + +#ifdef _WIN64 + if (cif->nargs >= 1 && + (cif->arg_types[0]->type == FFI_TYPE_FLOAT + || cif->arg_types[0]->type == FFI_TYPE_DOUBLE)) + mask |= 1; + if (cif->nargs >= 2 && + (cif->arg_types[1]->type == FFI_TYPE_FLOAT + || cif->arg_types[1]->type == FFI_TYPE_DOUBLE)) + mask |= 2; + if (cif->nargs >= 3 && + (cif->arg_types[2]->type == FFI_TYPE_FLOAT + || cif->arg_types[2]->type == FFI_TYPE_DOUBLE)) + mask |= 4; + if (cif->nargs >= 4 && + (cif->arg_types[3]->type == FFI_TYPE_FLOAT + || cif->arg_types[3]->type == FFI_TYPE_DOUBLE)) + mask |= 8; + + /* 41 BB ---- mov r11d,mask */ + BYTES("\x41\xBB"); INT(mask); + + /* 48 B8 -------- mov rax, closure */ + BYTES("\x48\xB8"); POINTER(closure); + + /* 49 BA -------- mov r10, ffi_closure_OUTER */ + BYTES("\x49\xBA"); POINTER(ffi_closure_OUTER); + + /* 41 FF E2 jmp r10 */ + BYTES("\x41\xFF\xE2"); + +#else + + /* mov ecx, closure */ + BYTES("\xb9"); POINTER(closure); + + /* mov edx, esp */ + BYTES("\x8b\xd4"); + + /* call ffi_closure_SYSV */ + BYTES("\xe8"); POINTER((char*)&ffi_closure_SYSV - (tramp + 4)); + + /* ret bytes */ + BYTES("\xc2"); + SHORT(bytes); + +#endif + + if (tramp - &closure->tramp[0] > FFI_TRAMPOLINE_SIZE) + Py_FatalError("FFI_TRAMPOLINE_SIZE too small in " __FILE__); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + return FFI_OK; +} diff --git a/lib/wrappers/libffi/msvc/prep_cif.c b/lib/wrappers/libffi/msvc/prep_cif.c new file mode 100644 index 000000000..2650fa052 --- /dev/null +++ b/lib/wrappers/libffi/msvc/prep_cif.c @@ -0,0 +1,175 @@ +/* ----------------------------------------------------------------------- + prep_cif.c - Copyright (c) 1996, 1998 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include <ffi.h> +#include <ffi_common.h> +#include <stdlib.h> + + +/* Round up to FFI_SIZEOF_ARG. */ + +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) + +/* Perform machine independent initialization of aggregate type + specifications. */ + +static ffi_status initialize_aggregate(/*@out@*/ ffi_type *arg) +{ + ffi_type **ptr; + + FFI_ASSERT(arg != NULL); + + /*@-usedef@*/ + + FFI_ASSERT(arg->elements != NULL); + FFI_ASSERT(arg->size == 0); + FFI_ASSERT(arg->alignment == 0); + + ptr = &(arg->elements[0]); + + while ((*ptr) != NULL) + { + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type */ + FFI_ASSERT_VALID_TYPE(*ptr); + + arg->size = ALIGN(arg->size, (*ptr)->alignment); + arg->size += (*ptr)->size; + + arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment : (*ptr)->alignment; + + ptr++; + } + + /* Structure size includes tail padding. This is important for + structures that fit in one register on ABIs like the PowerPC64 + Linux ABI that right justify small structs in a register. + It's also needed for nested structure layout, for example + struct A { long a; char b; }; struct B { struct A x; char y; }; + should find y at an offset of 2*sizeof(long) and result in a + total size of 3*sizeof(long). */ + arg->size = ALIGN (arg->size, arg->alignment); + + if (arg->size == 0) + return FFI_BAD_TYPEDEF; + else + return FFI_OK; + + /*@=usedef@*/ +} + +/* Perform machine independent ffi_cif preparation, then call + machine dependent routine. */ + +ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif, + ffi_abi abi, unsigned int nargs, + /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type *rtype, + /*@dependent@*/ ffi_type **atypes) +{ + unsigned bytes = 0; + unsigned int i; + ffi_type **ptr; + + FFI_ASSERT(cif != NULL); + FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + + cif->abi = abi; + cif->arg_types = atypes; + cif->nargs = nargs; + cif->rtype = rtype; + + cif->flags = 0; + + /* Initialize the return type if necessary */ + /*@-usedef@*/ + if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) + return FFI_BAD_TYPEDEF; + /*@=usedef@*/ + + /* Perform a sanity check on the return type */ + FFI_ASSERT_VALID_TYPE(cif->rtype); + + /* x86-64 and s390 stack space allocation is handled in prep_machdep. */ +#if !defined M68K && !defined __x86_64__ && !defined S390 + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT + /* MSVC returns small structures in registers. But we have a different + workaround: pretend int32 or int64 return type, and converting to + structure afterwards. */ +#ifdef SPARC + && (cif->abi != FFI_V9 || cif->rtype->size > 32) +#endif + ) + bytes = STACK_ARG_SIZE(sizeof(void*)); +#endif + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + + /* Initialize any uninitialized aggregate type definitions */ + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + +#if !defined __x86_64__ && !defined S390 +#ifdef SPARC + if (((*ptr)->type == FFI_TYPE_STRUCT + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) + || ((*ptr)->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_V9)) + bytes += sizeof(void*); + else +#endif + { +#if !defined(_MSC_VER) && !defined(__MINGW32__) + /* Don't know if this is a libffi bug or not. At least on + Windows with MSVC, function call parameters are *not* + aligned in the same way as structure fields are, they are + only aligned in integer boundaries. + + This doesn't do any harm for cdecl functions and closures, + since the caller cleans up the stack, but it is wrong for + stdcall functions where the callee cleans. + */ + + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + +#endif + bytes += STACK_ARG_SIZE((*ptr)->size); + } +#endif + } + + cif->bytes = bytes; + + /* Perform machine dependent cif processing */ + return ffi_prep_cif_machdep(cif); +} diff --git a/lib/wrappers/libffi/msvc/types.c b/lib/wrappers/libffi/msvc/types.c new file mode 100644 index 000000000..df32190d1 --- /dev/null +++ b/lib/wrappers/libffi/msvc/types.c @@ -0,0 +1,104 @@ +/* ----------------------------------------------------------------------- + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. + + Predefined ffi_types needed by libffi. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include <ffi.h> +#include <ffi_common.h> + +/* Type definitions */ + +#define FFI_INTEGRAL_TYPEDEF(n, s, a, t) ffi_type ffi_type_##n = { s, a, t, NULL } +#define FFI_AGGREGATE_TYPEDEF(n, e) ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e } + +/* Size and alignment are fake here. They must not be 0. */ +FFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID); + +FFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8); +FFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8); +FFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16); +FFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16); +FFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32); +FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32); +FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT); + +#if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \ + || defined IA64 + +FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER); + +#else + +FFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER); + +#endif + +#if defined X86 || defined X86_WIN32 || defined ARM || defined M68K + +FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); +FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); + +#elif defined SH + +FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); +FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); + +#else + +FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64); +FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64); + +#endif + + +#if defined X86 || defined X86_WIN32 || defined M68K + +FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); +FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); + +#elif defined ARM || defined SH || defined POWERPC_AIX || defined POWERPC_DARWIN + +FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); +FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE); + +#elif defined SPARC + +FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); +#ifdef SPARC64 +FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); +#else +FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE); +#endif + +#elif defined X86_64 + +FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); +FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); + +#else + +FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); +FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE); + +#endif + diff --git a/lib/wrappers/libffi/msvc/win32.c b/lib/wrappers/libffi/msvc/win32.c new file mode 100644 index 000000000..d1149a85e --- /dev/null +++ b/lib/wrappers/libffi/msvc/win32.c @@ -0,0 +1,162 @@ +/* ----------------------------------------------------------------------- + win32.S - Copyright (c) 1996, 1998, 2001, 2002 Red Hat, Inc. + Copyright (c) 2001 John Beniton + Copyright (c) 2002 Ranjit Mathew + + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* theller: almost verbatim translation from gas syntax to MSVC inline + assembler code. */ + +/* theller: ffi_call_x86 now returns an integer - the difference of the stack + pointer before and after the function call. If everything is ok, zero is + returned. If stdcall functions are passed the wrong number of arguments, + the difference will be nonzero. */ + +#include <ffi.h> +#include <ffi_common.h> + +__declspec(naked) int +ffi_call_x86(void (* prepfunc)(char *, extended_cif *), /* 8 */ + extended_cif *ecif, /* 12 */ + unsigned bytes, /* 16 */ + unsigned flags, /* 20 */ + unsigned *rvalue, /* 24 */ + void (*fn)()) /* 28 */ +{ + _asm { + push ebp + mov ebp, esp + + push esi // NEW: this register must be preserved across function calls +// XXX SAVE ESP NOW! + mov esi, esp // save stack pointer before the call + +// Make room for all of the new args. + mov ecx, [ebp+16] + sub esp, ecx // sub esp, bytes + + mov eax, esp + +// Place all of the ffi_prep_args in position + push [ebp + 12] // ecif + push eax + call [ebp + 8] // prepfunc + +// Return stack to previous state and call the function + add esp, 8 +// FIXME: Align the stack to a 128-bit boundary to avoid +// potential performance hits. + call [ebp + 28] + +// Load ecif->cif->abi + mov ecx, [ebp + 12] + mov ecx, [ecx]ecif.cif + mov ecx, [ecx]ecif.cif.abi + + cmp ecx, FFI_STDCALL + je noclean +// STDCALL: Remove the space we pushed for the args + mov ecx, [ebp + 16] + add esp, ecx +// CDECL: Caller has already cleaned the stack +noclean: +// Check that esp has the same value as before! + sub esi, esp + +// Load %ecx with the return type code + mov ecx, [ebp + 20] + +// If the return value pointer is NULL, assume no return value. +/* + Intel asm is weird. We have to explicitely specify 'DWORD PTR' in the nexr instruction, + otherwise only one BYTE will be compared (instead of a DWORD)! + */ + cmp DWORD PTR [ebp + 24], 0 + jne sc_retint + +// Even if there is no space for the return value, we are +// obliged to handle floating-point values. + cmp ecx, FFI_TYPE_FLOAT + jne sc_noretval +// fstp %st(0) + fstp st(0) + + jmp sc_epilogue + +sc_retint: + cmp ecx, FFI_TYPE_INT + jne sc_retfloat +// # Load %ecx with the pointer to storage for the return value + mov ecx, [ebp + 24] + mov [ecx + 0], eax + jmp sc_epilogue + +sc_retfloat: + cmp ecx, FFI_TYPE_FLOAT + jne sc_retdouble +// Load %ecx with the pointer to storage for the return value + mov ecx, [ebp+24] +// fstps (%ecx) + fstp DWORD PTR [ecx] + jmp sc_epilogue + +sc_retdouble: + cmp ecx, FFI_TYPE_DOUBLE + jne sc_retlongdouble +// movl 24(%ebp),%ecx + mov ecx, [ebp+24] + fstp QWORD PTR [ecx] + jmp sc_epilogue + + jmp sc_retlongdouble // avoid warning about unused label +sc_retlongdouble: + cmp ecx, FFI_TYPE_LONGDOUBLE + jne sc_retint64 +// Load %ecx with the pointer to storage for the return value + mov ecx, [ebp+24] +// fstpt (%ecx) + fstp QWORD PTR [ecx] /* XXX ??? */ + jmp sc_epilogue + +sc_retint64: + cmp ecx, FFI_TYPE_SINT64 + jne sc_retstruct +// Load %ecx with the pointer to storage for the return value + mov ecx, [ebp+24] + mov [ecx+0], eax + mov [ecx+4], edx + +sc_retstruct: +// Nothing to do! + +sc_noretval: +sc_epilogue: + mov eax, esi + pop esi // NEW restore: must be preserved across function calls + mov esp, ebp + pop ebp + ret + } +} diff --git a/lib/wrappers/libffi/msvc/win32_asm.asm b/lib/wrappers/libffi/msvc/win32_asm.asm new file mode 100644 index 000000000..407185e6a --- /dev/null +++ b/lib/wrappers/libffi/msvc/win32_asm.asm @@ -0,0 +1,470 @@ +/* ----------------------------------------------------------------------- + win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. + Copyright (c) 2001 John Beniton + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2009 Daniel Witte + + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- + */ + +#define LIBFFI_ASM +#include <fficonfig.h> +#include <ffi.h> + +.386 +.MODEL FLAT, C + +EXTRN ffi_closure_SYSV_inner:NEAR + +_TEXT SEGMENT + +ffi_call_win32 PROC NEAR, + ffi_prep_args : NEAR PTR DWORD, + ecif : NEAR PTR DWORD, + cif_abi : DWORD, + cif_bytes : DWORD, + cif_flags : DWORD, + rvalue : NEAR PTR DWORD, + fn : NEAR PTR DWORD + + ;; Make room for all of the new args. + mov ecx, cif_bytes + sub esp, ecx + + mov eax, esp + + ;; Place all of the ffi_prep_args in position + push ecif + push eax + call ffi_prep_args + + ;; Return stack to previous state and call the function + add esp, 8 + + ;; Handle thiscall and fastcall + cmp cif_abi, 3 ;; FFI_THISCALL + jz do_thiscall + cmp cif_abi, 4 ;; FFI_FASTCALL + jnz do_stdcall + mov ecx, DWORD PTR [esp] + mov edx, DWORD PTR [esp+4] + add esp, 8 + jmp do_stdcall +do_thiscall: + mov ecx, DWORD PTR [esp] + add esp, 4 +do_stdcall: + call fn + + ;; cdecl: we restore esp in the epilogue, so there's no need to + ;; remove the space we pushed for the args. + ;; stdcall: the callee has already cleaned the stack. + + ;; Load ecx with the return type code + mov ecx, cif_flags + + ;; If the return value pointer is NULL, assume no return value. + cmp rvalue, 0 + jne ca_jumptable + + ;; Even if there is no space for the return value, we are + ;; obliged to handle floating-point values. + cmp ecx, FFI_TYPE_FLOAT + jne ca_epilogue + fstp st(0) + + jmp ca_epilogue + +ca_jumptable: + jmp [ca_jumpdata + 4 * ecx] +ca_jumpdata: + ;; Do not insert anything here between label and jump table. + dd offset ca_epilogue ;; FFI_TYPE_VOID + dd offset ca_retint ;; FFI_TYPE_INT + dd offset ca_retfloat ;; FFI_TYPE_FLOAT + dd offset ca_retdouble ;; FFI_TYPE_DOUBLE + dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset ca_retuint8 ;; FFI_TYPE_UINT8 + dd offset ca_retsint8 ;; FFI_TYPE_SINT8 + dd offset ca_retuint16 ;; FFI_TYPE_UINT16 + dd offset ca_retsint16 ;; FFI_TYPE_SINT16 + dd offset ca_retint ;; FFI_TYPE_UINT32 + dd offset ca_retint ;; FFI_TYPE_SINT32 + dd offset ca_retint64 ;; FFI_TYPE_UINT64 + dd offset ca_retint64 ;; FFI_TYPE_SINT64 + dd offset ca_epilogue ;; FFI_TYPE_STRUCT + dd offset ca_retint ;; FFI_TYPE_POINTER + dd offset ca_retstruct1b ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset ca_retstruct2b ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset ca_epilogue ;; FFI_TYPE_MS_STRUCT + + /* Sign/zero extend as appropriate. */ +ca_retuint8: + movzx eax, al + jmp ca_retint + +ca_retsint8: + movsx eax, al + jmp ca_retint + +ca_retuint16: + movzx eax, ax + jmp ca_retint + +ca_retsint16: + movsx eax, ax + jmp ca_retint + +ca_retint: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], eax + jmp ca_epilogue + +ca_retint64: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], eax + mov [ecx + 4], edx + jmp ca_epilogue + +ca_retfloat: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + fstp DWORD PTR [ecx] + jmp ca_epilogue + +ca_retdouble: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + fstp QWORD PTR [ecx] + jmp ca_epilogue + +ca_retlongdouble: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + fstp TBYTE PTR [ecx] + jmp ca_epilogue + +ca_retstruct1b: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], al + jmp ca_epilogue + +ca_retstruct2b: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], ax + jmp ca_epilogue + +ca_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_call_win32 ENDP + +ffi_closure_THISCALL PROC NEAR FORCEFRAME + sub esp, 40 + lea edx, [ebp -24] + mov [ebp - 12], edx /* resp */ + lea edx, [ebp + 12] /* account for stub return address on stack */ + jmp stub +ffi_closure_THISCALL ENDP + +ffi_closure_SYSV PROC NEAR FORCEFRAME + ;; the ffi_closure ctx is passed in eax by the trampoline. + + sub esp, 40 + lea edx, [ebp - 24] + mov [ebp - 12], edx ;; resp + lea edx, [ebp + 8] +stub:: + mov [esp + 8], edx ;; args + lea edx, [ebp - 12] + mov [esp + 4], edx ;; &resp + mov [esp], eax ;; closure + call ffi_closure_SYSV_inner + mov ecx, [ebp - 12] + +cs_jumptable: + jmp [cs_jumpdata + 4 * eax] +cs_jumpdata: + ;; Do not insert anything here between the label and jump table. + dd offset cs_epilogue ;; FFI_TYPE_VOID + dd offset cs_retint ;; FFI_TYPE_INT + dd offset cs_retfloat ;; FFI_TYPE_FLOAT + dd offset cs_retdouble ;; FFI_TYPE_DOUBLE + dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset cs_retuint8 ;; FFI_TYPE_UINT8 + dd offset cs_retsint8 ;; FFI_TYPE_SINT8 + dd offset cs_retuint16 ;; FFI_TYPE_UINT16 + dd offset cs_retsint16 ;; FFI_TYPE_SINT16 + dd offset cs_retint ;; FFI_TYPE_UINT32 + dd offset cs_retint ;; FFI_TYPE_SINT32 + dd offset cs_retint64 ;; FFI_TYPE_UINT64 + dd offset cs_retint64 ;; FFI_TYPE_SINT64 + dd offset cs_retstruct ;; FFI_TYPE_STRUCT + dd offset cs_retint ;; FFI_TYPE_POINTER + dd offset cs_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cs_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset cs_retmsstruct ;; FFI_TYPE_MS_STRUCT + +cs_retuint8: + movzx eax, BYTE PTR [ecx] + jmp cs_epilogue + +cs_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cs_epilogue + +cs_retuint16: + movzx eax, WORD PTR [ecx] + jmp cs_epilogue + +cs_retsint16: + movsx eax, WORD PTR [ecx] + jmp cs_epilogue + +cs_retint: + mov eax, [ecx] + jmp cs_epilogue + +cs_retint64: + mov eax, [ecx + 0] + mov edx, [ecx + 4] + jmp cs_epilogue + +cs_retfloat: + fld DWORD PTR [ecx] + jmp cs_epilogue + +cs_retdouble: + fld QWORD PTR [ecx] + jmp cs_epilogue + +cs_retlongdouble: + fld TBYTE PTR [ecx] + jmp cs_epilogue + +cs_retstruct: + ;; Caller expects us to pop struct return value pointer hidden arg. + ;; Epilogue code is autogenerated. + ret 4 + +cs_retmsstruct: + ;; Caller expects us to return a pointer to the real return value. + mov eax, ecx + ;; Caller doesn't expects us to pop struct return value pointer hidden arg. + jmp cs_epilogue + +cs_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_closure_SYSV ENDP + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + +ffi_closure_raw_THISCALL PROC NEAR USES esi FORCEFRAME + sub esp, 36 + mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif + mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data + mov [esp + 12], edx + lea edx, [ebp + 12] + jmp stubraw +ffi_closure_raw_THISCALL ENDP + +ffi_closure_raw_SYSV PROC NEAR USES esi FORCEFRAME + ;; the ffi_closure ctx is passed in eax by the trampoline. + + sub esp, 40 + mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif + mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data + mov [esp + 12], edx ;; user_data + lea edx, [ebp + 8] +stubraw:: + mov [esp + 8], edx ;; raw_args + lea edx, [ebp - 24] + mov [esp + 4], edx ;; &res + mov [esp], esi ;; cif + call DWORD PTR [eax + RAW_CLOSURE_FUN_OFFSET] ;; closure->fun + mov eax, [esi + CIF_FLAGS_OFFSET] ;; cif->flags + lea ecx, [ebp - 24] + +cr_jumptable: + jmp [cr_jumpdata + 4 * eax] +cr_jumpdata: + ;; Do not insert anything here between the label and jump table. + dd offset cr_epilogue ;; FFI_TYPE_VOID + dd offset cr_retint ;; FFI_TYPE_INT + dd offset cr_retfloat ;; FFI_TYPE_FLOAT + dd offset cr_retdouble ;; FFI_TYPE_DOUBLE + dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset cr_retuint8 ;; FFI_TYPE_UINT8 + dd offset cr_retsint8 ;; FFI_TYPE_SINT8 + dd offset cr_retuint16 ;; FFI_TYPE_UINT16 + dd offset cr_retsint16 ;; FFI_TYPE_SINT16 + dd offset cr_retint ;; FFI_TYPE_UINT32 + dd offset cr_retint ;; FFI_TYPE_SINT32 + dd offset cr_retint64 ;; FFI_TYPE_UINT64 + dd offset cr_retint64 ;; FFI_TYPE_SINT64 + dd offset cr_epilogue ;; FFI_TYPE_STRUCT + dd offset cr_retint ;; FFI_TYPE_POINTER + dd offset cr_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cr_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B + dd offset cr_epilogue ;; FFI_TYPE_MS_STRUCT + +cr_retuint8: + movzx eax, BYTE PTR [ecx] + jmp cr_epilogue + +cr_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cr_epilogue + +cr_retuint16: + movzx eax, WORD PTR [ecx] + jmp cr_epilogue + +cr_retsint16: + movsx eax, WORD PTR [ecx] + jmp cr_epilogue + +cr_retint: + mov eax, [ecx] + jmp cr_epilogue + +cr_retint64: + mov eax, [ecx + 0] + mov edx, [ecx + 4] + jmp cr_epilogue + +cr_retfloat: + fld DWORD PTR [ecx] + jmp cr_epilogue + +cr_retdouble: + fld QWORD PTR [ecx] + jmp cr_epilogue + +cr_retlongdouble: + fld TBYTE PTR [ecx] + jmp cr_epilogue + +cr_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_closure_raw_SYSV ENDP + +#endif /* !FFI_NO_RAW_API */ + +ffi_closure_STDCALL PROC NEAR FORCEFRAME + ;; the ffi_closure ctx is passed in eax by the trampoline. + + sub esp, 40 + lea edx, [ebp - 24] + mov [ebp - 12], edx ;; resp + lea edx, [ebp + 12] ;; account for stub return address on stack + mov [esp + 8], edx ;; args + lea edx, [ebp - 12] + mov [esp + 4], edx ;; &resp + mov [esp], eax ;; closure + call ffi_closure_SYSV_inner + mov ecx, [ebp - 12] + +cd_jumptable: + jmp [cd_jumpdata + 4 * eax] +cd_jumpdata: + ;; Do not insert anything here between the label and jump table. + dd offset cd_epilogue ;; FFI_TYPE_VOID + dd offset cd_retint ;; FFI_TYPE_INT + dd offset cd_retfloat ;; FFI_TYPE_FLOAT + dd offset cd_retdouble ;; FFI_TYPE_DOUBLE + dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset cd_retuint8 ;; FFI_TYPE_UINT8 + dd offset cd_retsint8 ;; FFI_TYPE_SINT8 + dd offset cd_retuint16 ;; FFI_TYPE_UINT16 + dd offset cd_retsint16 ;; FFI_TYPE_SINT16 + dd offset cd_retint ;; FFI_TYPE_UINT32 + dd offset cd_retint ;; FFI_TYPE_SINT32 + dd offset cd_retint64 ;; FFI_TYPE_UINT64 + dd offset cd_retint64 ;; FFI_TYPE_SINT64 + dd offset cd_epilogue ;; FFI_TYPE_STRUCT + dd offset cd_retint ;; FFI_TYPE_POINTER + dd offset cd_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cd_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B + +cd_retuint8: + movzx eax, BYTE PTR [ecx] + jmp cd_epilogue + +cd_retsint8: + movsx eax, BYTE PTR [ecx] + jmp cd_epilogue + +cd_retuint16: + movzx eax, WORD PTR [ecx] + jmp cd_epilogue + +cd_retsint16: + movsx eax, WORD PTR [ecx] + jmp cd_epilogue + +cd_retint: + mov eax, [ecx] + jmp cd_epilogue + +cd_retint64: + mov eax, [ecx + 0] + mov edx, [ecx + 4] + jmp cd_epilogue + +cd_retfloat: + fld DWORD PTR [ecx] + jmp cd_epilogue + +cd_retdouble: + fld QWORD PTR [ecx] + jmp cd_epilogue + +cd_retlongdouble: + fld TBYTE PTR [ecx] + jmp cd_epilogue + +cd_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_closure_STDCALL ENDP + +_TEXT ENDS +END diff --git a/lib/wrappers/libffi/msvc/win64_asm.asm b/lib/wrappers/libffi/msvc/win64_asm.asm new file mode 100644 index 000000000..301188bc9 --- /dev/null +++ b/lib/wrappers/libffi/msvc/win64_asm.asm @@ -0,0 +1,156 @@ +PUBLIC ffi_call_AMD64 + +EXTRN __chkstk:NEAR +EXTRN ffi_closure_SYSV:NEAR + +_TEXT SEGMENT + +;;; ffi_closure_OUTER will be called with these registers set: +;;; rax points to 'closure' +;;; r11 contains a bit mask that specifies which of the +;;; first four parameters are float or double +;;; +;;; It must move the parameters passed in registers to their stack location, +;;; call ffi_closure_SYSV for the actual work, then return the result. +;;; +ffi_closure_OUTER PROC FRAME + ;; save actual arguments to their stack space. + test r11, 1 + jne first_is_float + mov QWORD PTR [rsp+8], rcx + jmp second +first_is_float: + movlpd QWORD PTR [rsp+8], xmm0 + +second: + test r11, 2 + jne second_is_float + mov QWORD PTR [rsp+16], rdx + jmp third +second_is_float: + movlpd QWORD PTR [rsp+16], xmm1 + +third: + test r11, 4 + jne third_is_float + mov QWORD PTR [rsp+24], r8 + jmp forth +third_is_float: + movlpd QWORD PTR [rsp+24], xmm2 + +forth: + test r11, 8 + jne forth_is_float + mov QWORD PTR [rsp+32], r9 + jmp done +forth_is_float: + movlpd QWORD PTR [rsp+32], xmm3 + +done: +.ALLOCSTACK 40 + sub rsp, 40 +.ENDPROLOG + mov rcx, rax ; context is first parameter + mov rdx, rsp ; stack is second parameter + add rdx, 40 ; correct our own area + mov rax, ffi_closure_SYSV + call rax ; call the real closure function + ;; Here, code is missing that handles float return values + add rsp, 40 + movd xmm0, rax ; In case the closure returned a float. + ret 0 +ffi_closure_OUTER ENDP + + +;;; ffi_call_AMD64 + +stack$ = 0 +prepfunc$ = 32 +ecif$ = 40 +bytes$ = 48 +flags$ = 56 +rvalue$ = 64 +fn$ = 72 + +ffi_call_AMD64 PROC FRAME + + mov QWORD PTR [rsp+32], r9 + mov QWORD PTR [rsp+24], r8 + mov QWORD PTR [rsp+16], rdx + mov QWORD PTR [rsp+8], rcx +.PUSHREG rbp + push rbp +.ALLOCSTACK 48 + sub rsp, 48 ; 00000030H +.SETFRAME rbp, 32 + lea rbp, QWORD PTR [rsp+32] +.ENDPROLOG + + mov eax, DWORD PTR bytes$[rbp] + add rax, 15 + and rax, -16 + call __chkstk + sub rsp, rax + lea rax, QWORD PTR [rsp+32] + mov QWORD PTR stack$[rbp], rax + + mov rdx, QWORD PTR ecif$[rbp] + mov rcx, QWORD PTR stack$[rbp] + call QWORD PTR prepfunc$[rbp] + + mov rsp, QWORD PTR stack$[rbp] + + movlpd xmm3, QWORD PTR [rsp+24] + movd r9, xmm3 + + movlpd xmm2, QWORD PTR [rsp+16] + movd r8, xmm2 + + movlpd xmm1, QWORD PTR [rsp+8] + movd rdx, xmm1 + + movlpd xmm0, QWORD PTR [rsp] + movd rcx, xmm0 + + call QWORD PTR fn$[rbp] +ret_int$: + cmp DWORD PTR flags$[rbp], 1 ; FFI_TYPE_INT + jne ret_float$ + + mov rcx, QWORD PTR rvalue$[rbp] + mov DWORD PTR [rcx], eax + jmp SHORT ret_nothing$ + +ret_float$: + cmp DWORD PTR flags$[rbp], 2 ; FFI_TYPE_FLOAT + jne SHORT ret_double$ + + mov rax, QWORD PTR rvalue$[rbp] + movlpd QWORD PTR [rax], xmm0 + jmp SHORT ret_nothing$ + +ret_double$: + cmp DWORD PTR flags$[rbp], 3 ; FFI_TYPE_DOUBLE + jne SHORT ret_int64$ + + mov rax, QWORD PTR rvalue$[rbp] + movlpd QWORD PTR [rax], xmm0 + jmp SHORT ret_nothing$ + +ret_int64$: + cmp DWORD PTR flags$[rbp], 12 ; FFI_TYPE_SINT64 + jne ret_nothing$ + + mov rcx, QWORD PTR rvalue$[rbp] + mov QWORD PTR [rcx], rax + jmp SHORT ret_nothing$ + +ret_nothing$: + xor eax, eax + + lea rsp, QWORD PTR [rbp+16] + pop rbp + ret 0 +ffi_call_AMD64 ENDP +_TEXT ENDS +END diff --git a/lib/wrappers/lua/lauxlib.nim b/lib/wrappers/lua/lauxlib.nim deleted file mode 100644 index b985858d3..000000000 --- a/lib/wrappers/lua/lauxlib.nim +++ /dev/null @@ -1,208 +0,0 @@ -#***************************************************************************** -# * * -# * File: lauxlib.pas * -# * Authors: TeCGraf (C headers + actual Lua libraries) * -# * Lavergne Thomas (original translation to Pascal) * -# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) * -# * Description: Lua auxiliary library * -# * * -# ***************************************************************************** -# -#** $Id: lauxlib.h,v 1.59 2003/03/18 12:25:32 roberto Exp $ -#** Auxiliary functions for building Lua libraries -#** See Copyright Notice in lua.h -# -# -#** Translated to pascal by Lavergne Thomas -#** Notes : -#** - Pointers type was prefixed with 'P' -#** Bug reports : -#** - thomas.lavergne@laposte.net -#** In french or in english -# - -import - lua - -proc pushstring*(L: PState, s: string) - # compatibilty macros -proc getn*(L: PState, n: cint): cint - # calls lua_objlen -proc setn*(L: PState, t, n: cint) - # does nothing! -type - Treg*{.final.} = object - name*: cstring - func*: CFunction - - Preg* = ptr Treg - - -{.push callConv: cdecl, dynlib: lua.LIB_NAME.} -{.push importc: "luaL_$1".} - -proc openlib*(L: PState, libname: cstring, lr: Preg, nup: cint) -proc register*(L: PState, libname: cstring, lr: Preg) - -proc getmetafield*(L: PState, obj: cint, e: cstring): cint -proc callmeta*(L: PState, obj: cint, e: cstring): cint -proc typerror*(L: PState, narg: cint, tname: cstring): cint -proc argerror*(L: PState, numarg: cint, extramsg: cstring): cint -proc checklstring*(L: PState, numArg: cint, len: ptr int): cstring -proc optlstring*(L: PState, numArg: cint, def: cstring, len: ptr cint): cstring -proc checknumber*(L: PState, numArg: cint): Number -proc optnumber*(L: PState, nArg: cint, def: Number): Number -proc checkinteger*(L: PState, numArg: cint): Integer -proc optinteger*(L: PState, nArg: cint, def: Integer): Integer -proc checkstack*(L: PState, sz: cint, msg: cstring) -proc checktype*(L: PState, narg, t: cint) - -proc checkany*(L: PState, narg: cint) -proc newmetatable*(L: PState, tname: cstring): cint - -proc checkudata*(L: PState, ud: cint, tname: cstring): Pointer -proc where*(L: PState, lvl: cint) -proc error*(L: PState, fmt: cstring): cint{.varargs.} -proc checkoption*(L: PState, narg: cint, def: cstring, lst: cstringArray): cint - -proc unref*(L: PState, t, theref: cint) -proc loadfile*(L: PState, filename: cstring): cint -proc loadbuffer*(L: PState, buff: cstring, size: cint, name: cstring): cint -proc loadstring*(L: PState, s: cstring): cint -proc newstate*(): PState - -{.pop.} -proc reference*(L: PState, t: cint): cint{.importc: "luaL_ref".} - -{.pop.} - -proc open*(): PState - # compatibility; moved from unit lua to lauxlib because it needs luaL_newstate - # - #** =============================================================== - #** some useful macros - #** =============================================================== - # -proc argcheck*(L: PState, cond: bool, numarg: cint, extramsg: cstring) -proc checkstring*(L: PState, n: cint): cstring -proc optstring*(L: PState, n: cint, d: cstring): cstring -proc checkint*(L: PState, n: cint): cint -proc checklong*(L: PState, n: cint): clong -proc optint*(L: PState, n: cint, d: float64): cint -proc optlong*(L: PState, n: cint, d: float64): clong -proc dofile*(L: PState, filename: cstring): cint -proc dostring*(L: PState, str: cstring): cint -proc getmetatable*(L: PState, tname: cstring) - # not translated: - # #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) - # - #** ======================================================= - #** Generic Buffer manipulation - #** ======================================================= - # -const # note: this is just arbitrary, as it related to the BUFSIZ defined in stdio.h ... - BUFFERSIZE* = 4096 - -type - Buffer*{.final.} = object - p*: cstring # current position in buffer - lvl*: cint # number of strings in the stack (level) - L*: PState - buffer*: array[0..BUFFERSIZE - 1, Char] # warning: see note above about LUAL_BUFFERSIZE - - PBuffer* = ptr Buffer - -proc addchar*(B: PBuffer, c: Char) - # warning: see note above about LUAL_BUFFERSIZE - # compatibility only (alias for luaL_addchar) -proc putchar*(B: PBuffer, c: Char) - # warning: see note above about LUAL_BUFFERSIZE -proc addsize*(B: PBuffer, n: cint) - -{.push callConv: cdecl, dynlib: lua.LIB_NAME, importc: "luaL_$1".} -proc buffinit*(L: PState, B: PBuffer) -proc prepbuffer*(B: PBuffer): cstring -proc addlstring*(B: PBuffer, s: cstring, L: cint) -proc addstring*(B: PBuffer, s: cstring) -proc addvalue*(B: PBuffer) -proc pushresult*(B: PBuffer) -proc gsub*(L: PState, s, p, r: cstring): cstring -proc findtable*(L: PState, idx: cint, fname: cstring, szhint: cint): cstring - # compatibility with ref system - # pre-defined references -{.pop.} - -const - NOREF* = - 2 - REFNIL* = - 1 - -proc unref*(L: PState, theref: cint) -proc getref*(L: PState, theref: cint) - # - #** Compatibility macros and functions - # -# implementation - -proc pushstring(L: PState, s: string) = - pushlstring(L, cstring(s), s.len.cint) - -proc getn(L: PState, n: cint): cint = - Result = objlen(L, n) - -proc setn(L: PState, t, n: cint) = - # does nothing as this operation is deprecated - nil - -proc open(): PState = - Result = newstate() - -proc dofile(L: PState, filename: cstring): cint = - Result = loadfile(L, filename) - if Result == 0: Result = pcall(L, 0, MULTRET, 0) - -proc dostring(L: PState, str: cstring): cint = - Result = loadstring(L, str) - if Result == 0: Result = pcall(L, 0, MULTRET, 0) - -proc getmetatable(L: PState, tname: cstring) = - getfield(L, REGISTRYINDEX, tname) - -proc argcheck(L: PState, cond: bool, numarg: cint, extramsg: cstring) = - if not cond: - discard argerror(L, numarg, extramsg) - -proc checkstring(L: PState, n: cint): cstring = - Result = checklstring(L, n, nil) - -proc optstring(L: PState, n: cint, d: cstring): cstring = - Result = optlstring(L, n, d, nil) - -proc checkint(L: PState, n: cint): cint = - Result = cint(checknumber(L, n)) - -proc checklong(L: PState, n: cint): clong = - Result = int32(ToInt(checknumber(L, n))) - -proc optint(L: PState, n: cint, d: float64): cint = - Result = optnumber(L, n, d).cint - -proc optlong(L: PState, n: cint, d: float64): clong = - Result = int32(ToInt(optnumber(L, n, d))) - -proc addchar(B: PBuffer, c: Char) = - if cast[int](addr((B.p))) < (cast[int](addr((B.buffer[0]))) + BUFFERSIZE): - discard prepbuffer(B) - B.p[1] = c - B.p = cast[cstring](cast[int](B.p) + 1) - -proc putchar(B: PBuffer, c: Char) = - addchar(B, c) - -proc addsize(B: PBuffer, n: cint) = - B.p = cast[cstring](cast[int](B.p) + n) - -proc unref(L: PState, theref: cint) = - unref(L, REGISTRYINDEX, theref) - -proc getref(L: PState, theref: cint) = - rawgeti(L, REGISTRYINDEX, theref) diff --git a/lib/wrappers/lua/lua.nim b/lib/wrappers/lua/lua.nim deleted file mode 100644 index 153714cee..000000000 --- a/lib/wrappers/lua/lua.nim +++ /dev/null @@ -1,364 +0,0 @@ -#***************************************************************************** -# * * -# * File: lua.pas * -# * Authors: TeCGraf (C headers + actual Lua libraries) * -# * Lavergne Thomas (original translation to Pascal) * -# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) * -# * Description: Basic Lua library * -# * * -# ***************************************************************************** -# -#** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $ -#** Lua - An Extensible Extension Language -#** TeCGraf: Computer Graphics Technology Group, PUC-Rio, Brazil -#** http://www.lua.org mailto:info@lua.org -#** See Copyright Notice at the end of this file -# -# -#** Updated to Lua 5.1.1 by Bram Kuijvenhoven (bram at kuijvenhoven dot net), -#** Hexis BV (http://www.hexis.nl), the Netherlands -#** Notes: -#** - Only tested with FPC (FreePascal Compiler) -#** - Using LuaBinaries styled DLL/SO names, which include version names -#** - LUA_YIELD was suffixed by '_' for avoiding name collision -# -# -#** Translated to pascal by Lavergne Thomas -#** Notes : -#** - Pointers type was prefixed with 'P' -#** - lua_upvalueindex constant was transformed to function -#** - Some compatibility function was isolated because with it you must have -#** lualib. -#** - LUA_VERSION was suffixed by '_' for avoiding name collision. -#** Bug reports : -#** - thomas.lavergne@laposte.net -#** In french or in english -# - -when defined(useLuajit): - when defined(MACOSX): - const - NAME* = "libluajit.dylib" - LIB_NAME* = "libluajit.dylib" - elif defined(UNIX): - const - NAME* = "libluajit.so(|.0)" - LIB_NAME* = "libluajit.so(|.0)" - else: - const - NAME* = "luajit.dll" - LIB_NAME* = "luajit.dll" -else: - when defined(MACOSX): - const - NAME* = "liblua(|5.1|5.0).dylib" - LIB_NAME* = "liblua(|5.1|5.0).dylib" - elif defined(UNIX): - const - NAME* = "liblua(|5.1|5.0).so(|.0)" - LIB_NAME* = "liblua(|5.1|5.0).so(|.0)" - else: - const - NAME* = "lua(|5.1|5.0).dll" - LIB_NAME* = "lua(|5.1|5.0).dll" - -const - VERSION* = "Lua 5.1" - RELEASE* = "Lua 5.1.1" - VERSION_NUM* = 501 - COPYRIGHT* = "Copyright (C) 1994-2006 Lua.org, PUC-Rio" - AUTHORS* = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" - # option for multiple returns in `lua_pcall' and `lua_call' - MULTRET* = - 1 # - #** pseudo-indices - # - REGISTRYINDEX* = - 10000 - ENVIRONINDEX* = - 10001 - GLOBALSINDEX* = - 10002 - -proc upvalueindex*(I: cint): cint -const # thread status; 0 is OK - constYIELD* = 1 - ERRRUN* = 2 - ERRSYNTAX* = 3 - ERRMEM* = 4 - ERRERR* = 5 - -type - PState* = Pointer - CFunction* = proc (L: PState): cint{.cdecl.} - -# -#** functions that read/write blocks when loading/dumping Lua chunks -# - -type - Reader* = proc (L: PState, ud: Pointer, sz: ptr cint): cstring{.cdecl.} - Writer* = proc (L: PState, p: Pointer, sz: cint, ud: Pointer): cint{.cdecl.} - Alloc* = proc (ud, theptr: Pointer, osize, nsize: cint){.cdecl.} - -const - TNONE* = - 1 - TNIL* = 0 - TBOOLEAN* = 1 - TLIGHTUSERDATA* = 2 - TNUMBER* = 3 - TSTRING* = 4 - TTABLE* = 5 - TFUNCTION* = 6 - TUSERDATA* = 7 - TTHREAD* = 8 # minimum Lua stack available to a C function - MINSTACK* = 20 - -type # Type of Numbers in Lua - Number* = float - Integer* = cint - -{.pragma: ilua, importc: "lua_$1".} - -{.push callConv: cdecl, dynlib: LibName.} -#{.push importc: "lua_$1".} - -proc newstate*(f: Alloc, ud: Pointer): PState {.ilua.} - -proc close*(L: PState){.ilua.} -proc newthread*(L: PState): PState{.ilua.} -proc atpanic*(L: PState, panicf: CFunction): CFunction{.ilua.} - -proc gettop*(L: PState): cint{.ilua.} -proc settop*(L: PState, idx: cint){.ilua.} -proc pushvalue*(L: PState, Idx: cint){.ilua.} -proc remove*(L: PState, idx: cint){.ilua.} -proc insert*(L: PState, idx: cint){.ilua.} -proc replace*(L: PState, idx: cint){.ilua.} -proc checkstack*(L: PState, sz: cint): cint{.ilua.} -proc xmove*(`from`, `to`: PState, n: cint){.ilua.} -proc isnumber*(L: PState, idx: cint): cint{.ilua.} -proc isstring*(L: PState, idx: cint): cint{.ilua.} -proc iscfunction*(L: PState, idx: cint): cint{.ilua.} -proc isuserdata*(L: PState, idx: cint): cint{.ilua.} -proc luatype*(L: PState, idx: cint): cint{.importc: "lua_type".} -proc typename*(L: PState, tp: cint): cstring{.ilua.} -proc equal*(L: PState, idx1, idx2: cint): cint{.ilua.} -proc rawequal*(L: PState, idx1, idx2: cint): cint{.ilua.} -proc lessthan*(L: PState, idx1, idx2: cint): cint{.ilua.} -proc tonumber*(L: PState, idx: cint): Number{.ilua.} -proc tointeger*(L: PState, idx: cint): Integer{.ilua.} -proc toboolean*(L: PState, idx: cint): cint{.ilua.} -proc tolstring*(L: PState, idx: cint, length: ptr cint): cstring{.ilua.} -proc objlen*(L: PState, idx: cint): cint{.ilua.} -proc tocfunction*(L: PState, idx: cint): CFunction{.ilua.} -proc touserdata*(L: PState, idx: cint): Pointer{.ilua.} -proc tothread*(L: PState, idx: cint): PState{.ilua.} -proc topointer*(L: PState, idx: cint): Pointer{.ilua.} -proc pushnil*(L: PState){.ilua.} -proc pushnumber*(L: PState, n: Number){.ilua.} -proc pushinteger*(L: PState, n: Integer){.ilua.} -proc pushlstring*(L: PState, s: cstring, len: cint){.ilua.} -proc pushstring*(L: PState, s: cstring){.ilua.} -proc pushvfstring*(L: PState, fmt: cstring, argp: Pointer): cstring{.ilua.} -proc pushfstring*(L: PState, fmt: cstring): cstring{.varargs,ilua.} -proc pushcclosure*(L: PState, fn: CFunction, n: cint){.ilua.} -proc pushboolean*(L: PState, b: cint){.ilua.} -proc pushlightuserdata*(L: PState, p: Pointer){.ilua.} -proc pushthread*(L: PState){.ilua.} -proc gettable*(L: PState, idx: cint){.ilua.} -proc getfield*(L: Pstate, idx: cint, k: cstring){.ilua.} -proc rawget*(L: PState, idx: cint){.ilua.} -proc rawgeti*(L: PState, idx, n: cint){.ilua.} -proc createtable*(L: PState, narr, nrec: cint){.ilua.} -proc newuserdata*(L: PState, sz: cint): Pointer{.ilua.} -proc getmetatable*(L: PState, objindex: cint): cint{.ilua.} -proc getfenv*(L: PState, idx: cint){.ilua.} -proc settable*(L: PState, idx: cint){.ilua.} -proc setfield*(L: PState, idx: cint, k: cstring){.ilua.} -proc rawset*(L: PState, idx: cint){.ilua.} -proc rawseti*(L: PState, idx, n: cint){.ilua.} -proc setmetatable*(L: PState, objindex: cint): cint{.ilua.} -proc setfenv*(L: PState, idx: cint): cint{.ilua.} -proc call*(L: PState, nargs, nresults: cint){.ilua.} -proc pcall*(L: PState, nargs, nresults, errf: cint): cint{.ilua.} -proc cpcall*(L: PState, func: CFunction, ud: Pointer): cint{.ilua.} -proc load*(L: PState, reader: Reader, dt: Pointer, chunkname: cstring): cint{.ilua.} -proc dump*(L: PState, writer: Writer, data: Pointer): cint{.ilua.} -proc luayield*(L: PState, nresults: cint): cint{.importc: "lua_yield".} -proc resume*(L: PState, narg: cint): cint{.ilua.} -proc status*(L: PState): cint{.ilua.} -proc gc*(L: PState, what, data: cint): cint{.ilua.} -proc error*(L: PState): cint{.ilua.} -proc next*(L: PState, idx: cint): cint{.ilua.} -proc concat*(L: PState, n: cint){.ilua.} -proc getallocf*(L: PState, ud: ptr Pointer): Alloc{.ilua.} -proc setallocf*(L: PState, f: Alloc, ud: Pointer){.ilua.} -{.pop.} - -# -#** Garbage-collection functions and options -# - -const - GCSTOP* = 0 - GCRESTART* = 1 - GCCOLLECT* = 2 - GCCOUNT* = 3 - GCCOUNTB* = 4 - GCSTEP* = 5 - GCSETPAUSE* = 6 - GCSETSTEPMUL* = 7 - -# -#** =============================================================== -#** some useful macros -#** =============================================================== -# - -proc pop*(L: PState, n: cint) -proc newtable*(L: Pstate) -proc register*(L: PState, n: cstring, f: CFunction) -proc pushcfunction*(L: PState, f: CFunction) -proc strlen*(L: Pstate, i: cint): cint -proc isfunction*(L: PState, n: cint): bool -proc istable*(L: PState, n: cint): bool -proc islightuserdata*(L: PState, n: cint): bool -proc isnil*(L: PState, n: cint): bool -proc isboolean*(L: PState, n: cint): bool -proc isthread*(L: PState, n: cint): bool -proc isnone*(L: PState, n: cint): bool -proc isnoneornil*(L: PState, n: cint): bool -proc pushliteral*(L: PState, s: cstring) -proc setglobal*(L: PState, s: cstring) -proc getglobal*(L: PState, s: cstring) -proc tostring*(L: PState, i: cint): cstring -# -#** compatibility macros and functions -# - -proc getregistry*(L: PState) -proc getgccount*(L: PState): cint -type - Chunkreader* = Reader - Chunkwriter* = Writer - -# -#** ====================================================================== -#** Debug API -#** ====================================================================== -# - -const - HOOKCALL* = 0 - HOOKRET* = 1 - HOOKLINE* = 2 - HOOKCOUNT* = 3 - HOOKTAILRET* = 4 - -const - MASKCALL* = 1 shl Ord(HOOKCALL) - MASKRET* = 1 shl Ord(HOOKRET) - MASKLINE* = 1 shl Ord(HOOKLINE) - MASKCOUNT* = 1 shl Ord(HOOKCOUNT) - -const - IDSIZE* = 60 - -type - TDebug*{.final.} = object # activation record - event*: cint - name*: cstring # (n) - namewhat*: cstring # (n) `global', `local', `field', `method' - what*: cstring # (S) `Lua', `C', `main', `tail' - source*: cstring # (S) - currentline*: cint # (l) - nups*: cint # (u) number of upvalues - linedefined*: cint # (S) - lastlinedefined*: cint # (S) - short_src*: array[0.. <IDSIZE, Char] # (S) \ - # private part - i_ci*: cint # active function - - PDebug* = ptr TDebug - Hook* = proc (L: PState, ar: PDebug){.cdecl.} - -# -#** ====================================================================== -#** Debug API -#** ====================================================================== -# - -{.push callConv: cdecl, dynlib: lua.LIB_NAME.} - -proc getstack*(L: PState, level: cint, ar: PDebug): cint{.ilua.} -proc getinfo*(L: PState, what: cstring, ar: PDebug): cint{.ilua.} -proc getlocal*(L: PState, ar: PDebug, n: cint): cstring{.ilua.} -proc setlocal*(L: PState, ar: PDebug, n: cint): cstring{.ilua.} -proc getupvalue*(L: PState, funcindex: cint, n: cint): cstring{.ilua.} -proc setupvalue*(L: PState, funcindex: cint, n: cint): cstring{.ilua.} -proc sethook*(L: PState, func: Hook, mask: cint, count: cint): cint{.ilua.} -proc gethook*(L: PState): Hook{.ilua.} -proc gethookmask*(L: PState): cint{.ilua.} -proc gethookcount*(L: PState): cint{.ilua.} - -{.pop.} - -# implementation - -proc upvalueindex(I: cint): cint = - Result = GLOBALSINDEX - i - -proc pop(L: PState, n: cint) = - settop(L, - n - 1) - -proc newtable(L: PState) = - createtable(L, 0, 0) - -proc register(L: PState, n: cstring, f: CFunction) = - pushcfunction(L, f) - setglobal(L, n) - -proc pushcfunction(L: PState, f: CFunction) = - pushcclosure(L, f, 0) - -proc strlen(L: PState, i: cint): cint = - Result = objlen(L, i) - -proc isfunction(L: PState, n: cint): bool = - Result = luatype(L, n) == TFUNCTION - -proc istable(L: PState, n: cint): bool = - Result = luatype(L, n) == TTABLE - -proc islightuserdata(L: PState, n: cint): bool = - Result = luatype(L, n) == TLIGHTUSERDATA - -proc isnil(L: PState, n: cint): bool = - Result = luatype(L, n) == TNIL - -proc isboolean(L: PState, n: cint): bool = - Result = luatype(L, n) == TBOOLEAN - -proc isthread(L: PState, n: cint): bool = - Result = luatype(L, n) == TTHREAD - -proc isnone(L: PState, n: cint): bool = - Result = luatype(L, n) == TNONE - -proc isnoneornil(L: PState, n: cint): bool = - Result = luatype(L, n) <= 0 - -proc pushliteral(L: PState, s: cstring) = - pushlstring(L, s, s.len.cint) - -proc setglobal(L: PState, s: cstring) = - setfield(L, GLOBALSINDEX, s) - -proc getglobal(L: PState, s: cstring) = - getfield(L, GLOBALSINDEX, s) - -proc tostring(L: PState, i: cint): cstring = - Result = tolstring(L, i, nil) - -proc getregistry(L: PState) = - pushvalue(L, REGISTRYINDEX) - -proc getgccount(L: PState): cint = - Result = gc(L, GCCOUNT, 0) diff --git a/lib/wrappers/lua/lualib.nim b/lib/wrappers/lua/lualib.nim deleted file mode 100644 index 8c1237dde..000000000 --- a/lib/wrappers/lua/lualib.nim +++ /dev/null @@ -1,64 +0,0 @@ -#***************************************************************************** -# * * -# * File: lualib.pas * -# * Authors: TeCGraf (C headers + actual Lua libraries) * -# * Lavergne Thomas (original translation to Pascal) * -# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) * -# * Description: Standard Lua libraries * -# * * -# ***************************************************************************** -# -#** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $ -#** Lua standard libraries -#** See Copyright Notice in lua.h -# -# -#** Translated to pascal by Lavergne Thomas -#** Bug reports : -#** - thomas.lavergne@laposte.net -#** In french or in english -# - -import - lua - -const - COLIBNAME* = "coroutine" - TABLIBNAME* = "table" - IOLIBNAME* = "io" - OSLIBNAME* = "os" - STRLINAME* = "string" - MATHLIBNAME* = "math" - DBLIBNAME* = "debug" - LOADLIBNAME* = "package" - -{.pragma: ilua, importc: "lua$1".} - -{.push callConv: cdecl, dynlib: lua.LIB_NAME.} -proc open_base*(L: PState): cint{.ilua.} -proc open_table*(L: PState): cint{.ilua.} -proc open_io*(L: PState): cint{.ilua.} -proc open_string*(L: PState): cint{.ilua.} -proc open_math*(L: PState): cint{.ilua.} -proc open_debug*(L: PState): cint{.ilua.} -proc open_package*(L: PState): cint{.ilua.} -proc openlibs*(L: PState){.importc: "luaL_openlibs".} -{.pop.} - -proc baselibopen*(L: PState): Bool = - open_base(L) != 0'i32 - -proc tablibopen*(L: PState): Bool = - open_table(L) != 0'i32 - -proc iolibopen*(L: PState): Bool = - open_io(L) != 0'i32 - -proc strlibopen*(L: PState): Bool = - open_string(L) != 0'i32 - -proc mathlibopen*(L: PState): Bool = - open_math(L) != 0'i32 - -proc dblibopen*(L: PState): Bool = - open_debug(L) != 0'i32 diff --git a/lib/wrappers/mongo.nim b/lib/wrappers/mongo.nim index 6673e8ddf..098b4f4d3 100644 --- a/lib/wrappers/mongo.nim +++ b/lib/wrappers/mongo.nim @@ -109,11 +109,12 @@ type cur*: cstring dataSize*: cint finished*: TBsonBool - stack*: array[0..32 - 1, cint] + ownsData*: TBsonBool + err*: cint + stackSize*: cint stackPos*: cint - err*: cint ## Bitfield representing errors or warnings on this buffer - errstr*: cstring ## A string representation of the most recent error - ## or warning. + stackPtr*: ptr csize + stack*: array[0..32 - 1, csize] TDate* = int64 @@ -141,6 +142,7 @@ proc print*(TBson: cstring, depth: cint) {.stdcall, importc: "bson_print_raw", dynlib: bsondll.} ## Print a string representation of a BSON object up to `depth`. + proc data*(b: var TBson): cstring{.stdcall, importc: "bson_data", dynlib: bsondll.} ## Return a pointer to the raw buffer stored by this bson object. @@ -590,19 +592,30 @@ type hosts*: ptr THostPort ## List of host/ports given by the replica set name*: cstring ## Name of the replica set. primary_connected*: TBsonBool ## Primary node connection status. + + TWriteConcern*{.pure, final.} = object ## mongo_write_concern + w*: cint + wtimeout*: cint + j*: cint + fsync*: cint + mode*: cstring + cmd*: TBSon TMongo*{.pure, final.} = object ## mongo - primary*: ptr THostPort ## Primary connection info. - replset*: ptr TReplSet ## replset object if connected to a replica set. - sock*: cint ## Socket file descriptor. - flags*: cint ## Flags on this connection object. - conn_timeout_ms*: cint ## Connection timeout in milliseconds. - op_timeout_ms*: cint ## Read and write timeout in milliseconds. - connected*: TBsonBool ## Connection status. - err*: TError ## Most recent driver error code. - errstr*: array[0..128 - 1, char] ## String version of most recent driver error code. - lasterrcode*: cint ## getlasterror code given by the server on error. - lasterrstr*: cstring ## getlasterror string generated by server. + primary*: ptr THostPort ## Primary connection info. + replset*: ptr TReplSet ## replset object if connected to a replica set. + sock*: cint ## Socket file descriptor. + flags*: cint ## Flags on this connection object. + conn_timeout_ms*: cint ## Connection timeout in milliseconds. + op_timeout_ms*: cint ## Read and write timeout in milliseconds. + max_bson_size*: cint ## Largest BSON object allowed on this connection. + connected*: TBsonBool ## Connection status. + write_concern*: TWriteConcern ## The default write concern. + err*: TError ## Most recent driver error code. + errcode*: cint ## Most recent errno or WSAGetLastError(). + errstr*: array[0..128 - 1, char] ## String version of most recent driver error code. + lasterrcode*: cint ## getlasterror code given by the server on error. + lasterrstr*: array[0..128 - 1, char] ## getlasterror string generated by server. TCursor*{.pure, final.} = object ## cursor reply*: ptr TReply ## reply is owned by cursor @@ -654,7 +667,11 @@ proc init*(conn: var TMongo){.stdcall, importc: "mongo_init", dynlib: mongodll.} proc connect*(conn: var TMongo, host: cstring = defaultHost, port: cint = defaultPort): cint {.stdcall, - importc: "mongo_connect", dynlib: mongodll.} + importc: "mongo_connect", dynlib: mongodll, deprecated.} + ## Connect to a single MongoDB server. +proc client*(conn: var TMongo, host: cstring = defaultHost, + port: cint = defaultPort): cint {.stdcall, + importc: "mongo_client", dynlib: mongodll.} ## Connect to a single MongoDB server. proc replsetInit*(conn: var TMongo, name: cstring){.stdcall, @@ -714,7 +731,8 @@ proc destroy*(conn: var TMongo){.stdcall, importc: "mongo_destroy", ## You must always call this function when finished with the connection ## object. -proc insert*(conn: var TMongo, ns: cstring, data: var TBson): cint{.stdcall, +proc insert*(conn: var TMongo, ns: cstring, data: var TBson, + custom_write_concern: ptr TWriteConcern): cint{.stdcall, importc: "mongo_insert", dynlib: mongodll, discardable.} ## Insert a BSON document into a MongoDB server. This function ## will fail if the supplied BSON struct is not UTF-8 or if diff --git a/lib/wrappers/mysql.nim b/lib/wrappers/mysql.nim index 5a8d4c98b..84d70287f 100644 --- a/lib/wrappers/mysql.nim +++ b/lib/wrappers/mysql.nim @@ -19,7 +19,7 @@ when defined(Windows): type my_bool* = bool Pmy_bool* = ptr my_bool - PVIO* = Pointer + PVIO* = pointer Pgptr* = ptr gptr gptr* = cstring Pmy_socket* = ptr my_socket @@ -645,7 +645,7 @@ type next_slave*: Pst_mysql last_used_slave*: Pst_mysql # needed for round-robin slave pick last_used_con*: Pst_mysql # needed for send/read/store/use result to work correctly with replication - stmts*: Pointer # was PList, list of all statements + stmts*: pointer # was PList, list of all statements methods*: Pst_mysql_methods thd*: pointer # Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag # from mysql_stmt_close if close had to cancel result set of this object. diff --git a/lib/wrappers/opengl/gl.nim b/lib/wrappers/opengl/gl.nim deleted file mode 100644 index 9387b5bc9..000000000 --- a/lib/wrappers/opengl/gl.nim +++ /dev/null @@ -1,1536 +0,0 @@ -# -# -# Adaption of the delphi3d.net OpenGL units to FreePascal -# Sebastian Guenther (sg@freepascal.org) in 2002 -# These units are free to use -# -#****************************************************************************** -# Converted to Delphi by Tom Nuydens (tom@delphi3d.net) -# For the latest updates, visit Delphi3D: http://www.delphi3d.net -#****************************************************************************** - -when defined(windows): - {.push, callconv: stdcall.} -else: - {.push, callconv: cdecl.} -when defined(windows): - const - dllname* = "opengl32.dll" -elif defined(macosx): - const - dllname* = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" -else: - const - dllname* = "libGL.so.1" -type - PGLenum* = ptr TGLenum - PGLboolean* = ptr TGLboolean - PGLbitfield* = ptr TGLbitfield - TGLbyte* = int8 - PGLbyte* = ptr TGlbyte - PGLshort* = ptr TGLshort - PGLint* = ptr TGLint - PGLsizei* = ptr TGLsizei - PGLubyte* = ptr TGLubyte - PGLushort* = ptr TGLushort - PGLuint* = ptr TGLuint - PGLfloat* = ptr TGLfloat - PGLclampf* = ptr TGLclampf - PGLdouble* = ptr TGLdouble - PGLclampd* = ptr TGLclampd - PGLvoid* = Pointer - PPGLvoid* = ptr PGLvoid - TGLenum* = cint - TGLboolean* = bool - TGLbitfield* = cint - TGLshort* = int16 - TGLint* = cint - TGLsizei* = int - TGLubyte* = int8 - TGLushort* = int16 - TGLuint* = cint - TGLfloat* = float32 - TGLclampf* = float32 - TGLdouble* = float - TGLclampd* = float - -const # Version - GL_VERSION_1_1* = 1 # AccumOp - constGL_ACCUM* = 0x00000100 - GL_LOAD* = 0x00000101 - GL_RETURN* = 0x00000102 - GL_MULT* = 0x00000103 - GL_ADD* = 0x00000104 # AlphaFunction - GL_NEVER* = 0x00000200 - GL_LESS* = 0x00000201 - GL_EQUAL* = 0x00000202 - GL_LEQUAL* = 0x00000203 - GL_GREATER* = 0x00000204 - GL_NOTEQUAL* = 0x00000205 - GL_GEQUAL* = 0x00000206 - GL_ALWAYS* = 0x00000207 # AttribMask - GL_CURRENT_BIT* = 0x00000001 - GL_POINT_BIT* = 0x00000002 - GL_LINE_BIT* = 0x00000004 - GL_POLYGON_BIT* = 0x00000008 - GL_POLYGON_STIPPLE_BIT* = 0x00000010 - GL_PIXEL_MODE_BIT* = 0x00000020 - GL_LIGHTING_BIT* = 0x00000040 - GL_FOG_BIT* = 0x00000080 - GL_DEPTH_BUFFER_BIT* = 0x00000100 - GL_ACCUM_BUFFER_BIT* = 0x00000200 - GL_STENCIL_BUFFER_BIT* = 0x00000400 - GL_VIEWPORT_BIT* = 0x00000800 - GL_TRANSFORM_BIT* = 0x00001000 - GL_ENABLE_BIT* = 0x00002000 - GL_COLOR_BUFFER_BIT* = 0x00004000 - GL_HINT_BIT* = 0x00008000 - GL_EVAL_BIT* = 0x00010000 - GL_LIST_BIT* = 0x00020000 - GL_TEXTURE_BIT* = 0x00040000 - GL_SCISSOR_BIT* = 0x00080000 - GL_ALL_ATTRIB_BITS* = 0x000FFFFF # BeginMode - GL_POINTS* = 0x00000000 - GL_LINES* = 0x00000001 - GL_LINE_LOOP* = 0x00000002 - GL_LINE_STRIP* = 0x00000003 - GL_TRIANGLES* = 0x00000004 - GL_TRIANGLE_STRIP* = 0x00000005 - GL_TRIANGLE_FAN* = 0x00000006 - GL_QUADS* = 0x00000007 - GL_QUAD_STRIP* = 0x00000008 - GL_POLYGON* = 0x00000009 # BlendingFactorDest - GL_ZERO* = 0 - GL_ONE* = 1 - GL_SRC_COLOR* = 0x00000300 - GL_ONE_MINUS_SRC_COLOR* = 0x00000301 - GL_SRC_ALPHA* = 0x00000302 - GL_ONE_MINUS_SRC_ALPHA* = 0x00000303 - GL_DST_ALPHA* = 0x00000304 - GL_ONE_MINUS_DST_ALPHA* = 0x00000305 # BlendingFactorSrc - # GL_ZERO - # GL_ONE - GL_DST_COLOR* = 0x00000306 - GL_ONE_MINUS_DST_COLOR* = 0x00000307 - GL_SRC_ALPHA_SATURATE* = 0x00000308 # 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* = 0x00003000 - GL_CLIP_PLANE1* = 0x00003001 - GL_CLIP_PLANE2* = 0x00003002 - GL_CLIP_PLANE3* = 0x00003003 - GL_CLIP_PLANE4* = 0x00003004 - GL_CLIP_PLANE5* = 0x00003005 # 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* = 0x00001400 - GL_UNSIGNED_BYTE* = 0x00001401 - GL_SHORT* = 0x00001402 - GL_UNSIGNED_SHORT* = 0x00001403 - GL_INT* = 0x00001404 - GL_UNSIGNED_INT* = 0x00001405 - GL_FLOAT* = 0x00001406 - GL_2_BYTES* = 0x00001407 - GL_3_BYTES* = 0x00001408 - GL_4_BYTES* = 0x00001409 - GL_DOUBLE* = 0x0000140A # DepthFunction - # GL_NEVER - # GL_LESS - # GL_EQUAL - # GL_LEQUAL - # GL_GREATER - # GL_NOTEQUAL - # GL_GEQUAL - # GL_ALWAYS - # DrawBufferMode - GL_NONE* = 0 - GL_FRONT_LEFT* = 0x00000400 - GL_FRONT_RIGHT* = 0x00000401 - GL_BACK_LEFT* = 0x00000402 - GL_BACK_RIGHT* = 0x00000403 - GL_FRONT* = 0x00000404 - GL_BACK* = 0x00000405 - GL_LEFT* = 0x00000406 - GL_RIGHT* = 0x00000407 - GL_FRONT_AND_BACK* = 0x00000408 - GL_AUX0* = 0x00000409 - GL_AUX1* = 0x0000040A - GL_AUX2* = 0x0000040B - GL_AUX3* = 0x0000040C # 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* = 0x00000500 - GL_INVALID_VALUE* = 0x00000501 - GL_INVALID_OPERATION* = 0x00000502 - GL_STACK_OVERFLOW* = 0x00000503 - GL_STACK_UNDERFLOW* = 0x00000504 - GL_OUT_OF_MEMORY* = 0x00000505 # FeedBackMode - GL_2D* = 0x00000600 - GL_3D* = 0x00000601 - GL_3D_COLOR* = 0x00000602 - GL_3D_COLOR_TEXTURE* = 0x00000603 - GL_4D_COLOR_TEXTURE* = 0x00000604 # FeedBackToken - GL_PASS_THROUGH_TOKEN* = 0x00000700 - GL_POINT_TOKEN* = 0x00000701 - GL_LINE_TOKEN* = 0x00000702 - GL_POLYGON_TOKEN* = 0x00000703 - GL_BITMAP_TOKEN* = 0x00000704 - GL_DRAW_PIXEL_TOKEN* = 0x00000705 - GL_COPY_PIXEL_TOKEN* = 0x00000706 - GL_LINE_RESET_TOKEN* = 0x00000707 # FogMode - # GL_LINEAR - GL_EXP* = 0x00000800 - GL_EXP2* = 0x00000801 # FogParameter - # GL_FOG_COLOR - # GL_FOG_DENSITY - # GL_FOG_END - # GL_FOG_INDEX - # GL_FOG_MODE - # GL_FOG_START - # FrontFaceDirection - GL_CW* = 0x00000900 - GL_CCW* = 0x00000901 # GetMapTarget - GL_COEFF* = 0x00000A00 - GL_ORDER* = 0x00000A01 - GL_DOMAIN* = 0x00000A02 # 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* = 0x00000B00 - GL_CURRENT_INDEX* = 0x00000B01 - GL_CURRENT_NORMAL* = 0x00000B02 - GL_CURRENT_TEXTURE_COORDS* = 0x00000B03 - GL_CURRENT_RASTER_COLOR* = 0x00000B04 - GL_CURRENT_RASTER_INDEX* = 0x00000B05 - GL_CURRENT_RASTER_TEXTURE_COORDS* = 0x00000B06 - GL_CURRENT_RASTER_POSITION* = 0x00000B07 - GL_CURRENT_RASTER_POSITION_VALID* = 0x00000B08 - GL_CURRENT_RASTER_DISTANCE* = 0x00000B09 - GL_POINT_SMOOTH* = 0x00000B10 - constGL_POINT_SIZE* = 0x00000B11 - GL_POINT_SIZE_RANGE* = 0x00000B12 - GL_POINT_SIZE_GRANULARITY* = 0x00000B13 - GL_LINE_SMOOTH* = 0x00000B20 - constGL_LINE_WIDTH* = 0x00000B21 - GL_LINE_WIDTH_RANGE* = 0x00000B22 - GL_LINE_WIDTH_GRANULARITY* = 0x00000B23 - constGL_LINE_STIPPLE* = 0x00000B24 - GL_LINE_STIPPLE_PATTERN* = 0x00000B25 - GL_LINE_STIPPLE_REPEAT* = 0x00000B26 - GL_LIST_MODE* = 0x00000B30 - GL_MAX_LIST_NESTING* = 0x00000B31 - constGL_LIST_BASE* = 0x00000B32 - GL_LIST_INDEX* = 0x00000B33 - constGL_POLYGON_MODE* = 0x00000B40 - GL_POLYGON_SMOOTH* = 0x00000B41 - constGL_POLYGON_STIPPLE* = 0x00000B42 - constGL_EDGE_FLAG* = 0x00000B43 - constGL_CULL_FACE* = 0x00000B44 - GL_CULL_FACE_MODE* = 0x00000B45 - constGL_FRONT_FACE* = 0x00000B46 - GL_LIGHTING* = 0x00000B50 - GL_LIGHT_MODEL_LOCAL_VIEWER* = 0x00000B51 - GL_LIGHT_MODEL_TWO_SIDE* = 0x00000B52 - GL_LIGHT_MODEL_AMBIENT* = 0x00000B53 - constGL_SHADE_MODEL* = 0x00000B54 - GL_COLOR_MATERIAL_FACE* = 0x00000B55 - GL_COLOR_MATERIAL_PARAMETER* = 0x00000B56 - constGL_COLOR_MATERIAL* = 0x00000B57 - GL_FOG* = 0x00000B60 - GL_FOG_INDEX* = 0x00000B61 - GL_FOG_DENSITY* = 0x00000B62 - GL_FOG_START* = 0x00000B63 - GL_FOG_END* = 0x00000B64 - GL_FOG_MODE* = 0x00000B65 - GL_FOG_COLOR* = 0x00000B66 - constGL_DEPTH_RANGE* = 0x00000B70 - GL_DEPTH_TEST* = 0x00000B71 - GL_DEPTH_WRITEMASK* = 0x00000B72 - GL_DEPTH_CLEAR_VALUE* = 0x00000B73 - constGL_DEPTH_FUNC* = 0x00000B74 - GL_ACCUM_CLEAR_VALUE* = 0x00000B80 - GL_STENCIL_TEST* = 0x00000B90 - GL_STENCIL_CLEAR_VALUE* = 0x00000B91 - constGL_STENCIL_FUNC* = 0x00000B92 - GL_STENCIL_VALUE_MASK* = 0x00000B93 - GL_STENCIL_FAIL* = 0x00000B94 - GL_STENCIL_PASS_DEPTH_FAIL* = 0x00000B95 - GL_STENCIL_PASS_DEPTH_PASS* = 0x00000B96 - GL_STENCIL_REF* = 0x00000B97 - GL_STENCIL_WRITEMASK* = 0x00000B98 - constGL_MATRIX_MODE* = 0x00000BA0 - GL_NORMALIZE* = 0x00000BA1 - constGL_VIEWPORT* = 0x00000BA2 - GL_MODELVIEW_STACK_DEPTH* = 0x00000BA3 - GL_PROJECTION_STACK_DEPTH* = 0x00000BA4 - GL_TEXTURE_STACK_DEPTH* = 0x00000BA5 - GL_MODELVIEW_MATRIX* = 0x00000BA6 - GL_PROJECTION_MATRIX* = 0x00000BA7 - GL_TEXTURE_MATRIX* = 0x00000BA8 - GL_ATTRIB_STACK_DEPTH* = 0x00000BB0 - GL_CLIENT_ATTRIB_STACK_DEPTH* = 0x00000BB1 - GL_ALPHA_TEST* = 0x00000BC0 - GL_ALPHA_TEST_FUNC* = 0x00000BC1 - GL_ALPHA_TEST_REF* = 0x00000BC2 - GL_DITHER* = 0x00000BD0 - GL_BLEND_DST* = 0x00000BE0 - GL_BLEND_SRC* = 0x00000BE1 - GL_BLEND* = 0x00000BE2 - GL_LOGIC_OP_MODE* = 0x00000BF0 - GL_INDEX_LOGIC_OP* = 0x00000BF1 - GL_COLOR_LOGIC_OP* = 0x00000BF2 - GL_AUX_BUFFERS* = 0x00000C00 - constGL_DRAW_BUFFER* = 0x00000C01 - constGL_READ_BUFFER* = 0x00000C02 - GL_SCISSOR_BOX* = 0x00000C10 - GL_SCISSOR_TEST* = 0x00000C11 - GL_INDEX_CLEAR_VALUE* = 0x00000C20 - GL_INDEX_WRITEMASK* = 0x00000C21 - GL_COLOR_CLEAR_VALUE* = 0x00000C22 - GL_COLOR_WRITEMASK* = 0x00000C23 - GL_INDEX_MODE* = 0x00000C30 - GL_RGBA_MODE* = 0x00000C31 - GL_DOUBLEBUFFER* = 0x00000C32 - GL_STEREO* = 0x00000C33 - constGL_RENDER_MODE* = 0x00000C40 - GL_PERSPECTIVE_CORRECTION_HINT* = 0x00000C50 - GL_POINT_SMOOTH_HINT* = 0x00000C51 - GL_LINE_SMOOTH_HINT* = 0x00000C52 - GL_POLYGON_SMOOTH_HINT* = 0x00000C53 - GL_FOG_HINT* = 0x00000C54 - GL_TEXTURE_GEN_S* = 0x00000C60 - GL_TEXTURE_GEN_T* = 0x00000C61 - GL_TEXTURE_GEN_R* = 0x00000C62 - GL_TEXTURE_GEN_Q* = 0x00000C63 - GL_PIXEL_MAP_I_TO_I* = 0x00000C70 - GL_PIXEL_MAP_S_TO_S* = 0x00000C71 - GL_PIXEL_MAP_I_TO_R* = 0x00000C72 - GL_PIXEL_MAP_I_TO_G* = 0x00000C73 - GL_PIXEL_MAP_I_TO_B* = 0x00000C74 - GL_PIXEL_MAP_I_TO_A* = 0x00000C75 - GL_PIXEL_MAP_R_TO_R* = 0x00000C76 - GL_PIXEL_MAP_G_TO_G* = 0x00000C77 - GL_PIXEL_MAP_B_TO_B* = 0x00000C78 - GL_PIXEL_MAP_A_TO_A* = 0x00000C79 - GL_PIXEL_MAP_I_TO_I_SIZE* = 0x00000CB0 - GL_PIXEL_MAP_S_TO_S_SIZE* = 0x00000CB1 - GL_PIXEL_MAP_I_TO_R_SIZE* = 0x00000CB2 - GL_PIXEL_MAP_I_TO_G_SIZE* = 0x00000CB3 - GL_PIXEL_MAP_I_TO_B_SIZE* = 0x00000CB4 - GL_PIXEL_MAP_I_TO_A_SIZE* = 0x00000CB5 - GL_PIXEL_MAP_R_TO_R_SIZE* = 0x00000CB6 - GL_PIXEL_MAP_G_TO_G_SIZE* = 0x00000CB7 - GL_PIXEL_MAP_B_TO_B_SIZE* = 0x00000CB8 - GL_PIXEL_MAP_A_TO_A_SIZE* = 0x00000CB9 - GL_UNPACK_SWAP_BYTES* = 0x00000CF0 - GL_UNPACK_LSB_FIRST* = 0x00000CF1 - GL_UNPACK_ROW_LENGTH* = 0x00000CF2 - GL_UNPACK_SKIP_ROWS* = 0x00000CF3 - GL_UNPACK_SKIP_PIXELS* = 0x00000CF4 - GL_UNPACK_ALIGNMENT* = 0x00000CF5 - GL_PACK_SWAP_BYTES* = 0x00000D00 - GL_PACK_LSB_FIRST* = 0x00000D01 - GL_PACK_ROW_LENGTH* = 0x00000D02 - GL_PACK_SKIP_ROWS* = 0x00000D03 - GL_PACK_SKIP_PIXELS* = 0x00000D04 - GL_PACK_ALIGNMENT* = 0x00000D05 - GL_MAP_COLOR* = 0x00000D10 - GL_MAP_STENCIL* = 0x00000D11 - GL_INDEX_SHIFT* = 0x00000D12 - GL_INDEX_OFFSET* = 0x00000D13 - GL_RED_SCALE* = 0x00000D14 - GL_RED_BIAS* = 0x00000D15 - GL_ZOOM_X* = 0x00000D16 - GL_ZOOM_Y* = 0x00000D17 - GL_GREEN_SCALE* = 0x00000D18 - GL_GREEN_BIAS* = 0x00000D19 - GL_BLUE_SCALE* = 0x00000D1A - GL_BLUE_BIAS* = 0x00000D1B - GL_ALPHA_SCALE* = 0x00000D1C - GL_ALPHA_BIAS* = 0x00000D1D - GL_DEPTH_SCALE* = 0x00000D1E - GL_DEPTH_BIAS* = 0x00000D1F - GL_MAX_EVAL_ORDER* = 0x00000D30 - GL_MAX_LIGHTS* = 0x00000D31 - GL_MAX_CLIP_PLANES* = 0x00000D32 - GL_MAX_TEXTURE_SIZE* = 0x00000D33 - GL_MAX_PIXEL_MAP_TABLE* = 0x00000D34 - GL_MAX_ATTRIB_STACK_DEPTH* = 0x00000D35 - GL_MAX_MODELVIEW_STACK_DEPTH* = 0x00000D36 - GL_MAX_NAME_STACK_DEPTH* = 0x00000D37 - GL_MAX_PROJECTION_STACK_DEPTH* = 0x00000D38 - GL_MAX_TEXTURE_STACK_DEPTH* = 0x00000D39 - GL_MAX_VIEWPORT_DIMS* = 0x00000D3A - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH* = 0x00000D3B - GL_SUBPIXEL_BITS* = 0x00000D50 - GL_INDEX_BITS* = 0x00000D51 - GL_RED_BITS* = 0x00000D52 - GL_GREEN_BITS* = 0x00000D53 - GL_BLUE_BITS* = 0x00000D54 - GL_ALPHA_BITS* = 0x00000D55 - GL_DEPTH_BITS* = 0x00000D56 - GL_STENCIL_BITS* = 0x00000D57 - GL_ACCUM_RED_BITS* = 0x00000D58 - GL_ACCUM_GREEN_BITS* = 0x00000D59 - GL_ACCUM_BLUE_BITS* = 0x00000D5A - GL_ACCUM_ALPHA_BITS* = 0x00000D5B - GL_NAME_STACK_DEPTH* = 0x00000D70 - GL_AUTO_NORMAL* = 0x00000D80 - GL_MAP1_COLOR_4* = 0x00000D90 - GL_MAP1_INDEX* = 0x00000D91 - GL_MAP1_NORMAL* = 0x00000D92 - GL_MAP1_TEXTURE_COORD_1* = 0x00000D93 - GL_MAP1_TEXTURE_COORD_2* = 0x00000D94 - GL_MAP1_TEXTURE_COORD_3* = 0x00000D95 - GL_MAP1_TEXTURE_COORD_4* = 0x00000D96 - GL_MAP1_VERTEX_3* = 0x00000D97 - GL_MAP1_VERTEX_4* = 0x00000D98 - GL_MAP2_COLOR_4* = 0x00000DB0 - GL_MAP2_INDEX* = 0x00000DB1 - GL_MAP2_NORMAL* = 0x00000DB2 - GL_MAP2_TEXTURE_COORD_1* = 0x00000DB3 - GL_MAP2_TEXTURE_COORD_2* = 0x00000DB4 - GL_MAP2_TEXTURE_COORD_3* = 0x00000DB5 - GL_MAP2_TEXTURE_COORD_4* = 0x00000DB6 - GL_MAP2_VERTEX_3* = 0x00000DB7 - GL_MAP2_VERTEX_4* = 0x00000DB8 - GL_MAP1_GRID_DOMAIN* = 0x00000DD0 - GL_MAP1_GRID_SEGMENTS* = 0x00000DD1 - GL_MAP2_GRID_DOMAIN* = 0x00000DD2 - GL_MAP2_GRID_SEGMENTS* = 0x00000DD3 - GL_TEXTURE_1D* = 0x00000DE0 - GL_TEXTURE_2D* = 0x00000DE1 - GL_FEEDBACK_BUFFER_POINTER* = 0x00000DF0 - GL_FEEDBACK_BUFFER_SIZE* = 0x00000DF1 - GL_FEEDBACK_BUFFER_TYPE* = 0x00000DF2 - GL_SELECTION_BUFFER_POINTER* = 0x00000DF3 - GL_SELECTION_BUFFER_SIZE* = 0x00000DF4 # 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* = 0x00001000 - GL_TEXTURE_HEIGHT* = 0x00001001 - GL_TEXTURE_INTERNAL_FORMAT* = 0x00001003 - GL_TEXTURE_BORDER_COLOR* = 0x00001004 - GL_TEXTURE_BORDER* = 0x00001005 # 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* = 0x00001100 - GL_FASTEST* = 0x00001101 - GL_NICEST* = 0x00001102 # 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* = 0x00004000 - GL_LIGHT1* = 0x00004001 - GL_LIGHT2* = 0x00004002 - GL_LIGHT3* = 0x00004003 - GL_LIGHT4* = 0x00004004 - GL_LIGHT5* = 0x00004005 - GL_LIGHT6* = 0x00004006 - GL_LIGHT7* = 0x00004007 # LightParameter - GL_AMBIENT* = 0x00001200 - GL_DIFFUSE* = 0x00001201 - GL_SPECULAR* = 0x00001202 - GL_POSITION* = 0x00001203 - GL_SPOT_DIRECTION* = 0x00001204 - GL_SPOT_EXPONENT* = 0x00001205 - GL_SPOT_CUTOFF* = 0x00001206 - GL_CONSTANT_ATTENUATION* = 0x00001207 - GL_LINEAR_ATTENUATION* = 0x00001208 - GL_QUADRATIC_ATTENUATION* = 0x00001209 # 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* = 0x00001300 - GL_COMPILE_AND_EXECUTE* = 0x00001301 # 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 - constGL_CLEAR* = 0x00001500 - GL_AND* = 0x00001501 - GL_AND_REVERSE* = 0x00001502 - GL_COPY* = 0x00001503 - GL_AND_INVERTED* = 0x00001504 - GL_NOOP* = 0x00001505 - GL_XOR* = 0x00001506 - GL_OR* = 0x00001507 - GL_NOR* = 0x00001508 - GL_EQUIV* = 0x00001509 - GL_INVERT* = 0x0000150A - GL_OR_REVERSE* = 0x0000150B - GL_COPY_INVERTED* = 0x0000150C - GL_OR_INVERTED* = 0x0000150D - GL_NAND* = 0x0000150E - GL_SET* = 0x0000150F # 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* = 0x00001600 - GL_SHININESS* = 0x00001601 - GL_AMBIENT_AND_DIFFUSE* = 0x00001602 - GL_COLOR_INDEXES* = 0x00001603 # GL_AMBIENT - # GL_DIFFUSE - # GL_SPECULAR - # MatrixMode - GL_MODELVIEW* = 0x00001700 - GL_PROJECTION* = 0x00001701 - GL_TEXTURE* = 0x00001702 # 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* = 0x00001800 - GL_DEPTH* = 0x00001801 - GL_STENCIL* = 0x00001802 # PixelFormat - GL_COLOR_INDEX* = 0x00001900 - GL_STENCIL_INDEX* = 0x00001901 - GL_DEPTH_COMPONENT* = 0x00001902 - GL_RED* = 0x00001903 - GL_GREEN* = 0x00001904 - GL_BLUE* = 0x00001905 - GL_ALPHA* = 0x00001906 - GL_RGB* = 0x00001907 - GL_RGBA* = 0x00001908 - GL_LUMINANCE* = 0x00001909 - GL_LUMINANCE_ALPHA* = 0x0000190A # 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 - constGL_BITMAP* = 0x00001A00 - GL_POINT* = 0x00001B00 - GL_LINE* = 0x00001B01 - GL_FILL* = 0x00001B02 # 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* = 0x00001C00 - GL_FEEDBACK* = 0x00001C01 - GL_SELECT* = 0x00001C02 # ShadingModel - GL_FLAT* = 0x00001D00 - GL_SMOOTH* = 0x00001D01 # StencilFunction - # GL_NEVER - # GL_LESS - # GL_EQUAL - # GL_LEQUAL - # GL_GREATER - # GL_NOTEQUAL - # GL_GEQUAL - # GL_ALWAYS - # StencilOp - # GL_ZERO - GL_KEEP* = 0x00001E00 - GL_REPLACE* = 0x00001E01 - GL_INCR* = 0x00001E02 - GL_DECR* = 0x00001E03 # GL_INVERT - # StringName - GL_VENDOR* = 0x00001F00 - GL_RENDERER* = 0x00001F01 - GL_VERSION* = 0x00001F02 - GL_EXTENSIONS* = 0x00001F03 # TextureCoordName - GL_S* = 0x00002000 - GL_T* = 0x00002001 - GL_R* = 0x00002002 - GL_Q* = 0x00002003 # TexCoordPointerType - # GL_SHORT - # GL_INT - # GL_FLOAT - # GL_DOUBLE - # TextureEnvMode - GL_MODULATE* = 0x00002100 - GL_DECAL* = 0x00002101 # GL_BLEND - # GL_REPLACE - # TextureEnvParameter - GL_TEXTURE_ENV_MODE* = 0x00002200 - GL_TEXTURE_ENV_COLOR* = 0x00002201 # TextureEnvTarget - GL_TEXTURE_ENV* = 0x00002300 # TextureGenMode - GL_EYE_LINEAR* = 0x00002400 - GL_OBJECT_LINEAR* = 0x00002401 - GL_SPHERE_MAP* = 0x00002402 # TextureGenParameter - GL_TEXTURE_GEN_MODE* = 0x00002500 - GL_OBJECT_PLANE* = 0x00002501 - GL_EYE_PLANE* = 0x00002502 # TextureMagFilter - GL_NEAREST* = 0x00002600 - GL_LINEAR* = 0x00002601 # TextureMinFilter - # GL_NEAREST - # GL_LINEAR - GL_NEAREST_MIPMAP_NEAREST* = 0x00002700 - GL_LINEAR_MIPMAP_NEAREST* = 0x00002701 - GL_NEAREST_MIPMAP_LINEAR* = 0x00002702 - GL_LINEAR_MIPMAP_LINEAR* = 0x00002703 # TextureParameterName - GL_TEXTURE_MAG_FILTER* = 0x00002800 - GL_TEXTURE_MIN_FILTER* = 0x00002801 - GL_TEXTURE_WRAP_S* = 0x00002802 - GL_TEXTURE_WRAP_T* = 0x00002803 # 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* = 0x00002900 - GL_REPEAT* = 0x00002901 # VertexPointerType - # GL_SHORT - # GL_INT - # GL_FLOAT - # GL_DOUBLE - # ClientAttribMask - GL_CLIENT_PIXEL_STORE_BIT* = 0x00000001 - GL_CLIENT_VERTEX_ARRAY_BIT* = 0x00000002 - GL_CLIENT_ALL_ATTRIB_BITS* = 0xFFFFFFFF # polygon_offset - GL_POLYGON_OFFSET_FACTOR* = 0x00008038 - GL_POLYGON_OFFSET_UNITS* = 0x00002A00 - GL_POLYGON_OFFSET_POINT* = 0x00002A01 - GL_POLYGON_OFFSET_LINE* = 0x00002A02 - GL_POLYGON_OFFSET_FILL* = 0x00008037 # texture - GL_ALPHA4* = 0x0000803B - GL_ALPHA8* = 0x0000803C - GL_ALPHA12* = 0x0000803D - GL_ALPHA16* = 0x0000803E - GL_LUMINANCE4* = 0x0000803F - GL_LUMINANCE8* = 0x00008040 - GL_LUMINANCE12* = 0x00008041 - GL_LUMINANCE16* = 0x00008042 - GL_LUMINANCE4_ALPHA4* = 0x00008043 - GL_LUMINANCE6_ALPHA2* = 0x00008044 - GL_LUMINANCE8_ALPHA8* = 0x00008045 - GL_LUMINANCE12_ALPHA4* = 0x00008046 - GL_LUMINANCE12_ALPHA12* = 0x00008047 - GL_LUMINANCE16_ALPHA16* = 0x00008048 - GL_INTENSITY* = 0x00008049 - GL_INTENSITY4* = 0x0000804A - GL_INTENSITY8* = 0x0000804B - GL_INTENSITY12* = 0x0000804C - GL_INTENSITY16* = 0x0000804D - GL_R3_G3_B2* = 0x00002A10 - GL_RGB4* = 0x0000804F - GL_RGB5* = 0x00008050 - GL_RGB8* = 0x00008051 - GL_RGB10* = 0x00008052 - GL_RGB12* = 0x00008053 - GL_RGB16* = 0x00008054 - GL_RGBA2* = 0x00008055 - GL_RGBA4* = 0x00008056 - GL_RGB5_A1* = 0x00008057 - GL_RGBA8* = 0x00008058 - GL_RGB10_A2* = 0x00008059 - GL_RGBA12* = 0x0000805A - GL_RGBA16* = 0x0000805B - GL_TEXTURE_RED_SIZE* = 0x0000805C - GL_TEXTURE_GREEN_SIZE* = 0x0000805D - GL_TEXTURE_BLUE_SIZE* = 0x0000805E - GL_TEXTURE_ALPHA_SIZE* = 0x0000805F - GL_TEXTURE_LUMINANCE_SIZE* = 0x00008060 - GL_TEXTURE_INTENSITY_SIZE* = 0x00008061 - GL_PROXY_TEXTURE_1D* = 0x00008063 - GL_PROXY_TEXTURE_2D* = 0x00008064 # texture_object - GL_TEXTURE_PRIORITY* = 0x00008066 - GL_TEXTURE_RESIDENT* = 0x00008067 - GL_TEXTURE_BINDING_1D* = 0x00008068 - GL_TEXTURE_BINDING_2D* = 0x00008069 # vertex_array - GL_VERTEX_ARRAY* = 0x00008074 - GL_NORMAL_ARRAY* = 0x00008075 - GL_COLOR_ARRAY* = 0x00008076 - GL_INDEX_ARRAY* = 0x00008077 - GL_TEXTURE_COORD_ARRAY* = 0x00008078 - GL_EDGE_FLAG_ARRAY* = 0x00008079 - GL_VERTEX_ARRAY_SIZE* = 0x0000807A - GL_VERTEX_ARRAY_TYPE* = 0x0000807B - GL_VERTEX_ARRAY_STRIDE* = 0x0000807C - GL_NORMAL_ARRAY_TYPE* = 0x0000807E - GL_NORMAL_ARRAY_STRIDE* = 0x0000807F - GL_COLOR_ARRAY_SIZE* = 0x00008081 - GL_COLOR_ARRAY_TYPE* = 0x00008082 - GL_COLOR_ARRAY_STRIDE* = 0x00008083 - GL_INDEX_ARRAY_TYPE* = 0x00008085 - GL_INDEX_ARRAY_STRIDE* = 0x00008086 - GL_TEXTURE_COORD_ARRAY_SIZE* = 0x00008088 - GL_TEXTURE_COORD_ARRAY_TYPE* = 0x00008089 - GL_TEXTURE_COORD_ARRAY_STRIDE* = 0x0000808A - GL_EDGE_FLAG_ARRAY_STRIDE* = 0x0000808C - GL_VERTEX_ARRAY_POINTER* = 0x0000808E - GL_NORMAL_ARRAY_POINTER* = 0x0000808F - GL_COLOR_ARRAY_POINTER* = 0x00008090 - GL_INDEX_ARRAY_POINTER* = 0x00008091 - GL_TEXTURE_COORD_ARRAY_POINTER* = 0x00008092 - GL_EDGE_FLAG_ARRAY_POINTER* = 0x00008093 - GL_V2F* = 0x00002A20 - GL_V3F* = 0x00002A21 - GL_C4UB_V2F* = 0x00002A22 - GL_C4UB_V3F* = 0x00002A23 - GL_C3F_V3F* = 0x00002A24 - GL_N3F_V3F* = 0x00002A25 - GL_C4F_N3F_V3F* = 0x00002A26 - GL_T2F_V3F* = 0x00002A27 - GL_T4F_V4F* = 0x00002A28 - GL_T2F_C4UB_V3F* = 0x00002A29 - GL_T2F_C3F_V3F* = 0x00002A2A - GL_T2F_N3F_V3F* = 0x00002A2B - GL_T2F_C4F_N3F_V3F* = 0x00002A2C - GL_T4F_C4F_N3F_V4F* = 0x00002A2D # 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* = 0x00008074 - GL_NORMAL_ARRAY_EXT* = 0x00008075 - GL_COLOR_ARRAY_EXT* = 0x00008076 - GL_INDEX_ARRAY_EXT* = 0x00008077 - GL_TEXTURE_COORD_ARRAY_EXT* = 0x00008078 - GL_EDGE_FLAG_ARRAY_EXT* = 0x00008079 - GL_VERTEX_ARRAY_SIZE_EXT* = 0x0000807A - GL_VERTEX_ARRAY_TYPE_EXT* = 0x0000807B - GL_VERTEX_ARRAY_STRIDE_EXT* = 0x0000807C - GL_VERTEX_ARRAY_COUNT_EXT* = 0x0000807D - GL_NORMAL_ARRAY_TYPE_EXT* = 0x0000807E - GL_NORMAL_ARRAY_STRIDE_EXT* = 0x0000807F - GL_NORMAL_ARRAY_COUNT_EXT* = 0x00008080 - GL_COLOR_ARRAY_SIZE_EXT* = 0x00008081 - GL_COLOR_ARRAY_TYPE_EXT* = 0x00008082 - GL_COLOR_ARRAY_STRIDE_EXT* = 0x00008083 - GL_COLOR_ARRAY_COUNT_EXT* = 0x00008084 - GL_INDEX_ARRAY_TYPE_EXT* = 0x00008085 - GL_INDEX_ARRAY_STRIDE_EXT* = 0x00008086 - GL_INDEX_ARRAY_COUNT_EXT* = 0x00008087 - GL_TEXTURE_COORD_ARRAY_SIZE_EXT* = 0x00008088 - GL_TEXTURE_COORD_ARRAY_TYPE_EXT* = 0x00008089 - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT* = 0x0000808A - GL_TEXTURE_COORD_ARRAY_COUNT_EXT* = 0x0000808B - GL_EDGE_FLAG_ARRAY_STRIDE_EXT* = 0x0000808C - GL_EDGE_FLAG_ARRAY_COUNT_EXT* = 0x0000808D - GL_VERTEX_ARRAY_POINTER_EXT* = 0x0000808E - GL_NORMAL_ARRAY_POINTER_EXT* = 0x0000808F - GL_COLOR_ARRAY_POINTER_EXT* = 0x00008090 - GL_INDEX_ARRAY_POINTER_EXT* = 0x00008091 - GL_TEXTURE_COORD_ARRAY_POINTER_EXT* = 0x00008092 - GL_EDGE_FLAG_ARRAY_POINTER_EXT* = 0x00008093 - GL_DOUBLE_EXT* = GL_DOUBLE # EXT_bgra - GL_BGR_EXT* = 0x000080E0 - GL_BGRA_EXT* = 0x000080E1 # EXT_paletted_texture - # These must match the GL_COLOR_TABLE_*_SGI enumerants - GL_COLOR_TABLE_FORMAT_EXT* = 0x000080D8 - GL_COLOR_TABLE_WIDTH_EXT* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE_EXT* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE_EXT* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE_EXT* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE_EXT* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE_EXT* = 0x000080DF - GL_COLOR_INDEX1_EXT* = 0x000080E2 - GL_COLOR_INDEX2_EXT* = 0x000080E3 - GL_COLOR_INDEX4_EXT* = 0x000080E4 - GL_COLOR_INDEX8_EXT* = 0x000080E5 - GL_COLOR_INDEX12_EXT* = 0x000080E6 - GL_COLOR_INDEX16_EXT* = 0x000080E7 # For compatibility with OpenGL v1.0 - constGL_LOGIC_OP* = GL_INDEX_LOGIC_OP - GL_TEXTURE_COMPONENTS* = GL_TEXTURE_INTERNAL_FORMAT - -proc glAccum*(op: TGLenum, value: TGLfloat){.dynlib: dllname, importc: "glAccum".} -proc glAlphaFunc*(func: TGLenum, theref: TGLclampf){.dynlib: dllname, - importc: "glAlphaFunc".} -proc glAreTexturesResident*(n: TGLsizei, textures: PGLuint, - residences: PGLboolean): TGLboolean{. - dynlib: dllname, importc: "glAreTexturesResident".} -proc glArrayElement*(i: TGLint){.dynlib: dllname, importc: "glArrayElement".} -proc glBegin*(mode: TGLenum){.dynlib: dllname, importc: "glBegin".} -proc glBindTexture*(target: TGLenum, texture: TGLuint){.dynlib: dllname, - importc: "glBindTexture".} -proc glBitmap*(width, height: TGLsizei, xorig, yorig: TGLfloat, - xmove, ymove: TGLfloat, bitmap: PGLubyte){.dynlib: dllname, - importc: "glBitmap".} -proc glBlendFunc*(sfactor, dfactor: TGLenum){.dynlib: dllname, - importc: "glBlendFunc".} -proc glCallList*(list: TGLuint){.dynlib: dllname, importc: "glCallList".} -proc glCallLists*(n: TGLsizei, atype: TGLenum, lists: Pointer){.dynlib: dllname, - importc: "glCallLists".} -proc glClear*(mask: TGLbitfield){.dynlib: dllname, importc: "glClear".} -proc glClearAccum*(red, green, blue, alpha: TGLfloat){.dynlib: dllname, - importc: "glClearAccum".} -proc glClearColor*(red, green, blue, alpha: TGLclampf){.dynlib: dllname, - importc: "glClearColor".} -proc glClearDepth*(depth: TGLclampd){.dynlib: dllname, importc: "glClearDepth".} -proc glClearIndex*(c: TGLfloat){.dynlib: dllname, importc: "glClearIndex".} -proc glClearStencil*(s: TGLint){.dynlib: dllname, importc: "glClearStencil".} -proc glClipPlane*(plane: TGLenum, equation: PGLdouble){.dynlib: dllname, - importc: "glClipPlane".} -proc glColor3b*(red, green, blue: TGlbyte){.dynlib: dllname, - importc: "glColor3b".} -proc glColor3bv*(v: PGLbyte){.dynlib: dllname, importc: "glColor3bv".} -proc glColor3d*(red, green, blue: TGLdouble){.dynlib: dllname, - importc: "glColor3d".} -proc glColor3dv*(v: PGLdouble){.dynlib: dllname, importc: "glColor3dv".} -proc glColor3f*(red, green, blue: TGLfloat){.dynlib: dllname, - importc: "glColor3f".} -proc glColor3fv*(v: PGLfloat){.dynlib: dllname, importc: "glColor3fv".} -proc glColor3i*(red, green, blue: TGLint){.dynlib: dllname, importc: "glColor3i".} -proc glColor3iv*(v: PGLint){.dynlib: dllname, importc: "glColor3iv".} -proc glColor3s*(red, green, blue: TGLshort){.dynlib: dllname, - importc: "glColor3s".} -proc glColor3sv*(v: PGLshort){.dynlib: dllname, importc: "glColor3sv".} -proc glColor3ub*(red, green, blue: TGLubyte){.dynlib: dllname, - importc: "glColor3ub".} -proc glColor3ubv*(v: PGLubyte){.dynlib: dllname, importc: "glColor3ubv".} -proc glColor3ui*(red, green, blue: TGLuint){.dynlib: dllname, - importc: "glColor3ui".} -proc glColor3uiv*(v: PGLuint){.dynlib: dllname, importc: "glColor3uiv".} -proc glColor3us*(red, green, blue: TGLushort){.dynlib: dllname, - importc: "glColor3us".} -proc glColor3usv*(v: PGLushort){.dynlib: dllname, importc: "glColor3usv".} -proc glColor4b*(red, green, blue, alpha: TGlbyte){.dynlib: dllname, - importc: "glColor4b".} -proc glColor4bv*(v: PGLbyte){.dynlib: dllname, importc: "glColor4bv".} -proc glColor4d*(red, green, blue, alpha: TGLdouble){.dynlib: dllname, - importc: "glColor4d".} -proc glColor4dv*(v: PGLdouble){.dynlib: dllname, importc: "glColor4dv".} -proc glColor4f*(red, green, blue, alpha: TGLfloat){.dynlib: dllname, - importc: "glColor4f".} -proc glColor4fv*(v: PGLfloat){.dynlib: dllname, importc: "glColor4fv".} -proc glColor4i*(red, green, blue, alpha: TGLint){.dynlib: dllname, - importc: "glColor4i".} -proc glColor4iv*(v: PGLint){.dynlib: dllname, importc: "glColor4iv".} -proc glColor4s*(red, green, blue, alpha: TGLshort){.dynlib: dllname, - importc: "glColor4s".} -proc glColor4sv*(v: PGLshort){.dynlib: dllname, importc: "glColor4sv".} -proc glColor4ub*(red, green, blue, alpha: TGLubyte){.dynlib: dllname, - importc: "glColor4ub".} -proc glColor4ubv*(v: PGLubyte){.dynlib: dllname, importc: "glColor4ubv".} -proc glColor4ui*(red, green, blue, alpha: TGLuint){.dynlib: dllname, - importc: "glColor4ui".} -proc glColor4uiv*(v: PGLuint){.dynlib: dllname, importc: "glColor4uiv".} -proc glColor4us*(red, green, blue, alpha: TGLushort){.dynlib: dllname, - importc: "glColor4us".} -proc glColor4usv*(v: PGLushort){.dynlib: dllname, importc: "glColor4usv".} -proc glColorMask*(red, green, blue, alpha: TGLboolean){.dynlib: dllname, - importc: "glColorMask".} -proc glColorMaterial*(face, mode: TGLenum){.dynlib: dllname, - importc: "glColorMaterial".} -proc glColorPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, - pointer: Pointer){.dynlib: dllname, - importc: "glColorPointer".} -proc glCopyPixels*(x, y: TGLint, width, height: TGLsizei, atype: TGLenum){. - dynlib: dllname, importc: "glCopyPixels".} -proc glCopyTexImage1D*(target: TGLenum, level: TGLint, internalFormat: TGLenum, - x, y: TGLint, width: TGLsizei, border: TGLint){. - dynlib: dllname, importc: "glCopyTexImage1D".} -proc glCopyTexImage2D*(target: TGLenum, level: TGLint, internalFormat: TGLenum, - x, y: TGLint, width, height: TGLsizei, border: TGLint){. - dynlib: dllname, importc: "glCopyTexImage2D".} -proc glCopyTexSubImage1D*(target: TGLenum, level, xoffset, x, y: TGLint, - width: TGLsizei){.dynlib: dllname, - importc: "glCopyTexSubImage1D".} -proc glCopyTexSubImage2D*(target: TGLenum, - level, xoffset, yoffset, x, y: TGLint, - width, height: TGLsizei){.dynlib: dllname, - importc: "glCopyTexSubImage2D".} -proc glCullFace*(mode: TGLenum){.dynlib: dllname, importc: "glCullFace".} -proc glDeleteLists*(list: TGLuint, range: TGLsizei){.dynlib: dllname, - importc: "glDeleteLists".} -proc glDeleteTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, - importc: "glDeleteTextures".} -proc glDepthFunc*(func: TGLenum){.dynlib: dllname, importc: "glDepthFunc".} -proc glDepthMask*(flag: TGLboolean){.dynlib: dllname, importc: "glDepthMask".} -proc glDepthRange*(zNear, zFar: TGLclampd){.dynlib: dllname, - importc: "glDepthRange".} -proc glDisable*(cap: TGLenum){.dynlib: dllname, importc: "glDisable".} -proc glDisableClientState*(aarray: TGLenum){.dynlib: dllname, - importc: "glDisableClientState".} -proc glDrawArrays*(mode: TGLenum, first: TGLint, count: TGLsizei){. - dynlib: dllname, importc: "glDrawArrays".} -proc glDrawBuffer*(mode: TGLenum){.dynlib: dllname, importc: "glDrawBuffer".} -proc glDrawElements*(mode: TGLenum, count: TGLsizei, atype: TGLenum, - indices: Pointer){.dynlib: dllname, - importc: "glDrawElements".} -proc glDrawPixels*(width, height: TGLsizei, format, atype: TGLenum, - pixels: Pointer){.dynlib: dllname, importc: "glDrawPixels".} -proc glEdgeFlag*(flag: TGLboolean){.dynlib: dllname, importc: "glEdgeFlag".} -proc glEdgeFlagPointer*(stride: TGLsizei, pointer: Pointer){.dynlib: dllname, - importc: "glEdgeFlagPointer".} -proc glEdgeFlagv*(flag: PGLboolean){.dynlib: dllname, importc: "glEdgeFlagv".} -proc glEnable*(cap: TGLenum){.dynlib: dllname, importc: "glEnable".} -proc glEnableClientState*(aarray: TGLenum){.dynlib: dllname, - importc: "glEnableClientState".} -proc glEnd*(){.dynlib: dllname, importc: "glEnd".} -proc glEndList*(){.dynlib: dllname, importc: "glEndList".} -proc glEvalCoord1d*(u: TGLdouble){.dynlib: dllname, importc: "glEvalCoord1d".} -proc glEvalCoord1dv*(u: PGLdouble){.dynlib: dllname, importc: "glEvalCoord1dv".} -proc glEvalCoord1f*(u: TGLfloat){.dynlib: dllname, importc: "glEvalCoord1f".} -proc glEvalCoord1fv*(u: PGLfloat){.dynlib: dllname, importc: "glEvalCoord1fv".} -proc glEvalCoord2d*(u, v: TGLdouble){.dynlib: dllname, importc: "glEvalCoord2d".} -proc glEvalCoord2dv*(u: PGLdouble){.dynlib: dllname, importc: "glEvalCoord2dv".} -proc glEvalCoord2f*(u, v: TGLfloat){.dynlib: dllname, importc: "glEvalCoord2f".} -proc glEvalCoord2fv*(u: PGLfloat){.dynlib: dllname, importc: "glEvalCoord2fv".} -proc glEvalMesh1*(mode: TGLenum, i1, i2: TGLint){.dynlib: dllname, - importc: "glEvalMesh1".} -proc glEvalMesh2*(mode: TGLenum, i1, i2, j1, j2: TGLint){.dynlib: dllname, - importc: "glEvalMesh2".} -proc glEvalPoint1*(i: TGLint){.dynlib: dllname, importc: "glEvalPoint1".} -proc glEvalPoint2*(i, j: TGLint){.dynlib: dllname, importc: "glEvalPoint2".} -proc glFeedbackBuffer*(size: TGLsizei, atype: TGLenum, buffer: PGLfloat){. - dynlib: dllname, importc: "glFeedbackBuffer".} -proc glFinish*(){.dynlib: dllname, importc: "glFinish".} -proc glFlush*(){.dynlib: dllname, importc: "glFlush".} -proc glFogf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glFogf".} -proc glFogfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glFogfv".} -proc glFogi*(pname: TGLenum, param: TGLint){.dynlib: dllname, importc: "glFogi".} -proc glFogiv*(pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glFogiv".} -proc glFrontFace*(mode: TGLenum){.dynlib: dllname, importc: "glFrontFace".} -proc glFrustum*(left, right, bottom, top, zNear, zFar: TGLdouble){. - dynlib: dllname, importc: "glFrustum".} -proc glGenLists*(range: TGLsizei): TGLuint{.dynlib: dllname, - importc: "glGenLists".} -proc glGenTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, - importc: "glGenTextures".} -proc glGetBooleanv*(pname: TGLenum, params: PGLboolean){.dynlib: dllname, - importc: "glGetBooleanv".} -proc glGetClipPlane*(plane: TGLenum, equation: PGLdouble){.dynlib: dllname, - importc: "glGetClipPlane".} -proc glGetDoublev*(pname: TGLenum, params: PGLdouble){.dynlib: dllname, - importc: "glGetDoublev".} -proc glGetError*(): TGLenum{.dynlib: dllname, importc: "glGetError".} -proc glGetFloatv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glGetFloatv".} -proc glGetIntegerv*(pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glGetIntegerv".} -proc glGetLightfv*(light, pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glGetLightfv".} -proc glGetLightiv*(light, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glGetLightiv".} -proc glGetMapdv*(target, query: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glGetMapdv".} -proc glGetMapfv*(target, query: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glGetMapfv".} -proc glGetMapiv*(target, query: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glGetMapiv".} -proc glGetMaterialfv*(face, pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glGetMaterialfv".} -proc glGetMaterialiv*(face, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glGetMaterialiv".} -proc glGetPixelMapfv*(map: TGLenum, values: PGLfloat){.dynlib: dllname, - importc: "glGetPixelMapfv".} -proc glGetPixelMapuiv*(map: TGLenum, values: PGLuint){.dynlib: dllname, - importc: "glGetPixelMapuiv".} -proc glGetPixelMapusv*(map: TGLenum, values: PGLushort){.dynlib: dllname, - importc: "glGetPixelMapusv".} -proc glGetPointerv*(pname: TGLenum, params: Pointer){.dynlib: dllname, - importc: "glGetPointerv".} -proc glGetPolygonStipple*(mask: PGLubyte){.dynlib: dllname, - importc: "glGetPolygonStipple".} -proc glGetString*(name: TGLenum): cstring{.dynlib: dllname, - importc: "glGetString".} -proc glGetTexEnvfv*(target, pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glGetTexEnvfv".} -proc glGetTexEnviv*(target, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glGetTexEnviv".} -proc glGetTexGendv*(coord, pname: TGLenum, params: PGLdouble){.dynlib: dllname, - importc: "glGetTexGendv".} -proc glGetTexGenfv*(coord, pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glGetTexGenfv".} -proc glGetTexGeniv*(coord, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glGetTexGeniv".} -proc glGetTexImage*(target: TGLenum, level: TGLint, format: TGLenum, - atype: TGLenum, pixels: Pointer){.dynlib: dllname, - importc: "glGetTexImage".} -proc glGetTexLevelParameterfv*(target: TGLenum, level: TGLint, pname: TGLenum, - params: Pointer){.dynlib: dllname, - importc: "glGetTexLevelParameterfv".} -proc glGetTexLevelParameteriv*(target: TGLenum, level: TGLint, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetTexLevelParameteriv".} -proc glGetTexParameterfv*(target, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetTexParameterfv".} -proc glGetTexParameteriv*(target, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetTexParameteriv".} -proc glHint*(target, mode: TGLenum){.dynlib: dllname, importc: "glHint".} -proc glIndexMask*(mask: TGLuint){.dynlib: dllname, importc: "glIndexMask".} -proc glIndexPointer*(atype: TGLenum, stride: TGLsizei, pointer: Pointer){. - dynlib: dllname, importc: "glIndexPointer".} -proc glIndexd*(c: TGLdouble){.dynlib: dllname, importc: "glIndexd".} -proc glIndexdv*(c: PGLdouble){.dynlib: dllname, importc: "glIndexdv".} -proc glIndexf*(c: TGLfloat){.dynlib: dllname, importc: "glIndexf".} -proc glIndexfv*(c: PGLfloat){.dynlib: dllname, importc: "glIndexfv".} -proc glIndexi*(c: TGLint){.dynlib: dllname, importc: "glIndexi".} -proc glIndexiv*(c: PGLint){.dynlib: dllname, importc: "glIndexiv".} -proc glIndexs*(c: TGLshort){.dynlib: dllname, importc: "glIndexs".} -proc glIndexsv*(c: PGLshort){.dynlib: dllname, importc: "glIndexsv".} -proc glIndexub*(c: TGLubyte){.dynlib: dllname, importc: "glIndexub".} -proc glIndexubv*(c: PGLubyte){.dynlib: dllname, importc: "glIndexubv".} -proc glInitNames*(){.dynlib: dllname, importc: "glInitNames".} -proc glInterleavedArrays*(format: TGLenum, stride: TGLsizei, pointer: Pointer){. - dynlib: dllname, importc: "glInterleavedArrays".} -proc glIsEnabled*(cap: TGLenum): TGLboolean{.dynlib: dllname, - importc: "glIsEnabled".} -proc glIsList*(list: TGLuint): TGLboolean{.dynlib: dllname, importc: "glIsList".} -proc glIsTexture*(texture: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsTexture".} -proc glLightModelf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glLightModelf".} -proc glLightModelfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glLightModelfv".} -proc glLightModeli*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glLightModeli".} -proc glLightModeliv*(pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glLightModeliv".} -proc glLightf*(light, pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glLightf".} -proc glLightfv*(light, pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glLightfv".} -proc glLighti*(light, pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glLighti".} -proc glLightiv*(light, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glLightiv".} -proc glLineStipple*(factor: TGLint, pattern: TGLushort){.dynlib: dllname, - importc: "glLineStipple".} -proc glLineWidth*(width: TGLfloat){.dynlib: dllname, importc: "glLineWidth".} -proc glListBase*(base: TGLuint){.dynlib: dllname, importc: "glListBase".} -proc glLoadIdentity*(){.dynlib: dllname, importc: "glLoadIdentity".} -proc glLoadMatrixd*(m: PGLdouble){.dynlib: dllname, importc: "glLoadMatrixd".} -proc glLoadMatrixf*(m: PGLfloat){.dynlib: dllname, importc: "glLoadMatrixf".} -proc glLoadName*(name: TGLuint){.dynlib: dllname, importc: "glLoadName".} -proc glLogicOp*(opcode: TGLenum){.dynlib: dllname, importc: "glLogicOp".} -proc glMap1d*(target: TGLenum, u1, u2: TGLdouble, stride, order: TGLint, - points: PGLdouble){.dynlib: dllname, importc: "glMap1d".} -proc glMap1f*(target: TGLenum, u1, u2: TGLfloat, stride, order: TGLint, - points: PGLfloat){.dynlib: dllname, importc: "glMap1f".} -proc glMap2d*(target: TGLenum, u1, u2: TGLdouble, ustride, uorder: TGLint, - v1, v2: TGLdouble, vstride, vorder: TGLint, points: PGLdouble){. - dynlib: dllname, importc: "glMap2d".} -proc glMap2f*(target: TGLenum, u1, u2: TGLfloat, ustride, uorder: TGLint, - v1, v2: TGLfloat, vstride, vorder: TGLint, points: PGLfloat){. - dynlib: dllname, importc: "glMap2f".} -proc glMapGrid1d*(un: TGLint, u1, u2: TGLdouble){.dynlib: dllname, - importc: "glMapGrid1d".} -proc glMapGrid1f*(un: TGLint, u1, u2: TGLfloat){.dynlib: dllname, - importc: "glMapGrid1f".} -proc glMapGrid2d*(un: TGLint, u1, u2: TGLdouble, vn: TGLint, v1, v2: TGLdouble){. - dynlib: dllname, importc: "glMapGrid2d".} -proc glMapGrid2f*(un: TGLint, u1, u2: TGLfloat, vn: TGLint, v1, v2: TGLfloat){. - dynlib: dllname, importc: "glMapGrid2f".} -proc glMaterialf*(face, pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glMaterialf".} -proc glMaterialfv*(face, pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glMaterialfv".} -proc glMateriali*(face, pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glMateriali".} -proc glMaterialiv*(face, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glMaterialiv".} -proc glMatrixMode*(mode: TGLenum){.dynlib: dllname, importc: "glMatrixMode".} -proc glMultMatrixd*(m: PGLdouble){.dynlib: dllname, importc: "glMultMatrixd".} -proc glMultMatrixf*(m: PGLfloat){.dynlib: dllname, importc: "glMultMatrixf".} -proc glNewList*(list: TGLuint, mode: TGLenum){.dynlib: dllname, - importc: "glNewList".} -proc glNormal3b*(nx, ny, nz: TGlbyte){.dynlib: dllname, importc: "glNormal3b".} -proc glNormal3bv*(v: PGLbyte){.dynlib: dllname, importc: "glNormal3bv".} -proc glNormal3d*(nx, ny, nz: TGLdouble){.dynlib: dllname, importc: "glNormal3d".} -proc glNormal3dv*(v: PGLdouble){.dynlib: dllname, importc: "glNormal3dv".} -proc glNormal3f*(nx, ny, nz: TGLfloat){.dynlib: dllname, importc: "glNormal3f".} -proc glNormal3fv*(v: PGLfloat){.dynlib: dllname, importc: "glNormal3fv".} -proc glNormal3i*(nx, ny, nz: TGLint){.dynlib: dllname, importc: "glNormal3i".} -proc glNormal3iv*(v: PGLint){.dynlib: dllname, importc: "glNormal3iv".} -proc glNormal3s*(nx, ny, nz: TGLshort){.dynlib: dllname, importc: "glNormal3s".} -proc glNormal3sv*(v: PGLshort){.dynlib: dllname, importc: "glNormal3sv".} -proc glNormalPointer*(atype: TGLenum, stride: TGLsizei, pointer: Pointer){. - dynlib: dllname, importc: "glNormalPointer".} -proc glOrtho*(left, right, bottom, top, zNear, zFar: TGLdouble){. - dynlib: dllname, importc: "glOrtho".} -proc glPassThrough*(token: TGLfloat){.dynlib: dllname, importc: "glPassThrough".} -proc glPixelMapfv*(map: TGLenum, mapsize: TGLsizei, values: PGLfloat){. - dynlib: dllname, importc: "glPixelMapfv".} -proc glPixelMapuiv*(map: TGLenum, mapsize: TGLsizei, values: PGLuint){. - dynlib: dllname, importc: "glPixelMapuiv".} -proc glPixelMapusv*(map: TGLenum, mapsize: TGLsizei, values: PGLushort){. - dynlib: dllname, importc: "glPixelMapusv".} -proc glPixelStoref*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glPixelStoref".} -proc glPixelStorei*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glPixelStorei".} -proc glPixelTransferf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glPixelTransferf".} -proc glPixelTransferi*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glPixelTransferi".} -proc glPixelZoom*(xfactor, yfactor: TGLfloat){.dynlib: dllname, - importc: "glPixelZoom".} -proc glPointSize*(size: TGLfloat){.dynlib: dllname, importc: "glPointSize".} -proc glPolygonMode*(face, mode: TGLenum){.dynlib: dllname, - importc: "glPolygonMode".} -proc glPolygonOffset*(factor, units: TGLfloat){.dynlib: dllname, - importc: "glPolygonOffset".} -proc glPolygonStipple*(mask: PGLubyte){.dynlib: dllname, - importc: "glPolygonStipple".} -proc glPopAttrib*(){.dynlib: dllname, importc: "glPopAttrib".} -proc glPopClientAttrib*(){.dynlib: dllname, importc: "glPopClientAttrib".} -proc glPopMatrix*(){.dynlib: dllname, importc: "glPopMatrix".} -proc glPopName*(){.dynlib: dllname, importc: "glPopName".} -proc glPrioritizeTextures*(n: TGLsizei, textures: PGLuint, priorities: PGLclampf){. - dynlib: dllname, importc: "glPrioritizeTextures".} -proc glPushAttrib*(mask: TGLbitfield){.dynlib: dllname, importc: "glPushAttrib".} -proc glPushClientAttrib*(mask: TGLbitfield){.dynlib: dllname, - importc: "glPushClientAttrib".} -proc glPushMatrix*(){.dynlib: dllname, importc: "glPushMatrix".} -proc glPushName*(name: TGLuint){.dynlib: dllname, importc: "glPushName".} -proc glRasterPos2d*(x, y: TGLdouble){.dynlib: dllname, importc: "glRasterPos2d".} -proc glRasterPos2dv*(v: PGLdouble){.dynlib: dllname, importc: "glRasterPos2dv".} -proc glRasterPos2f*(x, y: TGLfloat){.dynlib: dllname, importc: "glRasterPos2f".} -proc glRasterPos2fv*(v: PGLfloat){.dynlib: dllname, importc: "glRasterPos2fv".} -proc glRasterPos2i*(x, y: TGLint){.dynlib: dllname, importc: "glRasterPos2i".} -proc glRasterPos2iv*(v: PGLint){.dynlib: dllname, importc: "glRasterPos2iv".} -proc glRasterPos2s*(x, y: TGLshort){.dynlib: dllname, importc: "glRasterPos2s".} -proc glRasterPos2sv*(v: PGLshort){.dynlib: dllname, importc: "glRasterPos2sv".} -proc glRasterPos3d*(x, y, z: TGLdouble){.dynlib: dllname, - importc: "glRasterPos3d".} -proc glRasterPos3dv*(v: PGLdouble){.dynlib: dllname, importc: "glRasterPos3dv".} -proc glRasterPos3f*(x, y, z: TGLfloat){.dynlib: dllname, - importc: "glRasterPos3f".} -proc glRasterPos3fv*(v: PGLfloat){.dynlib: dllname, importc: "glRasterPos3fv".} -proc glRasterPos3i*(x, y, z: TGLint){.dynlib: dllname, importc: "glRasterPos3i".} -proc glRasterPos3iv*(v: PGLint){.dynlib: dllname, importc: "glRasterPos3iv".} -proc glRasterPos3s*(x, y, z: TGLshort){.dynlib: dllname, - importc: "glRasterPos3s".} -proc glRasterPos3sv*(v: PGLshort){.dynlib: dllname, importc: "glRasterPos3sv".} -proc glRasterPos4d*(x, y, z, w: TGLdouble){.dynlib: dllname, - importc: "glRasterPos4d".} -proc glRasterPos4dv*(v: PGLdouble){.dynlib: dllname, importc: "glRasterPos4dv".} -proc glRasterPos4f*(x, y, z, w: TGLfloat){.dynlib: dllname, - importc: "glRasterPos4f".} -proc glRasterPos4fv*(v: PGLfloat){.dynlib: dllname, importc: "glRasterPos4fv".} -proc glRasterPos4i*(x, y, z, w: TGLint){.dynlib: dllname, - importc: "glRasterPos4i".} -proc glRasterPos4iv*(v: PGLint){.dynlib: dllname, importc: "glRasterPos4iv".} -proc glRasterPos4s*(x, y, z, w: TGLshort){.dynlib: dllname, - importc: "glRasterPos4s".} -proc glRasterPos4sv*(v: PGLshort){.dynlib: dllname, importc: "glRasterPos4sv".} -proc glReadBuffer*(mode: TGLenum){.dynlib: dllname, importc: "glReadBuffer".} -proc glReadPixels*(x, y: TGLint, width, height: TGLsizei, - format, atype: TGLenum, pixels: Pointer){.dynlib: dllname, - importc: "glReadPixels".} -proc glRectd*(x1, y1, x2, y2: TGLdouble){.dynlib: dllname, importc: "glRectd".} -proc glRectdv*(v1: PGLdouble, v2: PGLdouble){.dynlib: dllname, - importc: "glRectdv".} -proc glRectf*(x1, y1, x2, y2: TGLfloat){.dynlib: dllname, importc: "glRectf".} -proc glRectfv*(v1: PGLfloat, v2: PGLfloat){.dynlib: dllname, importc: "glRectfv".} -proc glRecti*(x1, y1, x2, y2: TGLint){.dynlib: dllname, importc: "glRecti".} -proc glRectiv*(v1: PGLint, v2: PGLint){.dynlib: dllname, importc: "glRectiv".} -proc glRects*(x1, y1, x2, y2: TGLshort){.dynlib: dllname, importc: "glRects".} -proc glRectsv*(v1: PGLshort, v2: PGLshort){.dynlib: dllname, importc: "glRectsv".} -proc glRenderMode*(mode: TGLint): TGLint{.dynlib: dllname, - importc: "glRenderMode".} -proc glRotated*(angle, x, y, z: TGLdouble){.dynlib: dllname, - importc: "glRotated".} -proc glRotatef*(angle, x, y, z: TGLfloat){.dynlib: dllname, importc: "glRotatef".} -proc glScaled*(x, y, z: TGLdouble){.dynlib: dllname, importc: "glScaled".} -proc glScalef*(x, y, z: TGLfloat){.dynlib: dllname, importc: "glScalef".} -proc glScissor*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname, - importc: "glScissor".} -proc glSelectBuffer*(size: TGLsizei, buffer: PGLuint){.dynlib: dllname, - importc: "glSelectBuffer".} -proc glShadeModel*(mode: TGLenum){.dynlib: dllname, importc: "glShadeModel".} -proc glStencilFunc*(func: TGLenum, theref: TGLint, mask: TGLuint){. - dynlib: dllname, importc: "glStencilFunc".} -proc glStencilMask*(mask: TGLuint){.dynlib: dllname, importc: "glStencilMask".} -proc glStencilOp*(fail, zfail, zpass: TGLenum){.dynlib: dllname, - importc: "glStencilOp".} -proc glTexCoord1d*(s: TGLdouble){.dynlib: dllname, importc: "glTexCoord1d".} -proc glTexCoord1dv*(v: PGLdouble){.dynlib: dllname, importc: "glTexCoord1dv".} -proc glTexCoord1f*(s: TGLfloat){.dynlib: dllname, importc: "glTexCoord1f".} -proc glTexCoord1fv*(v: PGLfloat){.dynlib: dllname, importc: "glTexCoord1fv".} -proc glTexCoord1i*(s: TGLint){.dynlib: dllname, importc: "glTexCoord1i".} -proc glTexCoord1iv*(v: PGLint){.dynlib: dllname, importc: "glTexCoord1iv".} -proc glTexCoord1s*(s: TGLshort){.dynlib: dllname, importc: "glTexCoord1s".} -proc glTexCoord1sv*(v: PGLshort){.dynlib: dllname, importc: "glTexCoord1sv".} -proc glTexCoord2d*(s, t: TGLdouble){.dynlib: dllname, importc: "glTexCoord2d".} -proc glTexCoord2dv*(v: PGLdouble){.dynlib: dllname, importc: "glTexCoord2dv".} -proc glTexCoord2f*(s, t: TGLfloat){.dynlib: dllname, importc: "glTexCoord2f".} -proc glTexCoord2fv*(v: PGLfloat){.dynlib: dllname, importc: "glTexCoord2fv".} -proc glTexCoord2i*(s, t: TGLint){.dynlib: dllname, importc: "glTexCoord2i".} -proc glTexCoord2iv*(v: PGLint){.dynlib: dllname, importc: "glTexCoord2iv".} -proc glTexCoord2s*(s, t: TGLshort){.dynlib: dllname, importc: "glTexCoord2s".} -proc glTexCoord2sv*(v: PGLshort){.dynlib: dllname, importc: "glTexCoord2sv".} -proc glTexCoord3d*(s, t, r: TGLdouble){.dynlib: dllname, importc: "glTexCoord3d".} -proc glTexCoord3dv*(v: PGLdouble){.dynlib: dllname, importc: "glTexCoord3dv".} -proc glTexCoord3f*(s, t, r: TGLfloat){.dynlib: dllname, importc: "glTexCoord3f".} -proc glTexCoord3fv*(v: PGLfloat){.dynlib: dllname, importc: "glTexCoord3fv".} -proc glTexCoord3i*(s, t, r: TGLint){.dynlib: dllname, importc: "glTexCoord3i".} -proc glTexCoord3iv*(v: PGLint){.dynlib: dllname, importc: "glTexCoord3iv".} -proc glTexCoord3s*(s, t, r: TGLshort){.dynlib: dllname, importc: "glTexCoord3s".} -proc glTexCoord3sv*(v: PGLshort){.dynlib: dllname, importc: "glTexCoord3sv".} -proc glTexCoord4d*(s, t, r, q: TGLdouble){.dynlib: dllname, - importc: "glTexCoord4d".} -proc glTexCoord4dv*(v: PGLdouble){.dynlib: dllname, importc: "glTexCoord4dv".} -proc glTexCoord4f*(s, t, r, q: TGLfloat){.dynlib: dllname, - importc: "glTexCoord4f".} -proc glTexCoord4fv*(v: PGLfloat){.dynlib: dllname, importc: "glTexCoord4fv".} -proc glTexCoord4i*(s, t, r, q: TGLint){.dynlib: dllname, importc: "glTexCoord4i".} -proc glTexCoord4iv*(v: PGLint){.dynlib: dllname, importc: "glTexCoord4iv".} -proc glTexCoord4s*(s, t, r, q: TGLshort){.dynlib: dllname, - importc: "glTexCoord4s".} -proc glTexCoord4sv*(v: PGLshort){.dynlib: dllname, importc: "glTexCoord4sv".} -proc glTexCoordPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, - pointer: Pointer){.dynlib: dllname, - importc: "glTexCoordPointer".} -proc glTexEnvf*(target: TGLenum, pname: TGLenum, param: TGLfloat){. - dynlib: dllname, importc: "glTexEnvf".} -proc glTexEnvfv*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glTexEnvfv".} -proc glTexEnvi*(target: TGLenum, pname: TGLenum, param: TGLint){. - dynlib: dllname, importc: "glTexEnvi".} -proc glTexEnviv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glTexEnviv".} -proc glTexGend*(coord: TGLenum, pname: TGLenum, param: TGLdouble){. - dynlib: dllname, importc: "glTexGend".} -proc glTexGendv*(coord: TGLenum, pname: TGLenum, params: PGLdouble){. - dynlib: dllname, importc: "glTexGendv".} -proc glTexGenf*(coord: TGLenum, pname: TGLenum, param: TGLfloat){. - dynlib: dllname, importc: "glTexGenf".} -proc glTexGenfv*(coord: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glTexGenfv".} -proc glTexGeni*(coord: TGLenum, pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glTexGeni".} -proc glTexGeniv*(coord: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glTexGeniv".} -proc glTexImage1D*(target: TGLenum, level, internalformat: TGLint, - width: TGLsizei, border: TGLint, format, atype: TGLenum, - pixels: Pointer){.dynlib: dllname, importc: "glTexImage1D".} -proc glTexImage2D*(target: TGLenum, level, internalformat: TGLint, - width, height: TGLsizei, border: TGLint, - format, atype: TGLenum, pixels: Pointer){.dynlib: dllname, - importc: "glTexImage2D".} -proc glTexParameterf*(target: TGLenum, pname: TGLenum, param: TGLfloat){. - dynlib: dllname, importc: "glTexParameterf".} -proc glTexParameterfv*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glTexParameterfv".} -proc glTexParameteri*(target: TGLenum, pname: TGLenum, param: TGLint){. - dynlib: dllname, importc: "glTexParameteri".} -proc glTexParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glTexParameteriv".} -proc glTexSubImage1D*(target: TGLenum, level, xoffset: TGLint, width: TGLsizei, - format, atype: TGLenum, pixels: Pointer){.dynlib: dllname, - importc: "glTexSubImage1D".} -proc glTexSubImage2D*(target: TGLenum, level, xoffset, yoffset: TGLint, - width, height: TGLsizei, format, atype: TGLenum, - pixels: Pointer){.dynlib: dllname, - importc: "glTexSubImage2D".} -proc glTranslated*(x, y, z: TGLdouble){.dynlib: dllname, importc: "glTranslated".} -proc glTranslatef*(x, y, z: TGLfloat){.dynlib: dllname, importc: "glTranslatef".} -proc glVertex2d*(x, y: TGLdouble){.dynlib: dllname, importc: "glVertex2d".} -proc glVertex2dv*(v: PGLdouble){.dynlib: dllname, importc: "glVertex2dv".} -proc glVertex2f*(x, y: TGLfloat){.dynlib: dllname, importc: "glVertex2f".} -proc glVertex2fv*(v: PGLfloat){.dynlib: dllname, importc: "glVertex2fv".} -proc glVertex2i*(x, y: TGLint){.dynlib: dllname, importc: "glVertex2i".} -proc glVertex2iv*(v: PGLint){.dynlib: dllname, importc: "glVertex2iv".} -proc glVertex2s*(x, y: TGLshort){.dynlib: dllname, importc: "glVertex2s".} -proc glVertex2sv*(v: PGLshort){.dynlib: dllname, importc: "glVertex2sv".} -proc glVertex3d*(x, y, z: TGLdouble){.dynlib: dllname, importc: "glVertex3d".} -proc glVertex3dv*(v: PGLdouble){.dynlib: dllname, importc: "glVertex3dv".} -proc glVertex3f*(x, y, z: TGLfloat){.dynlib: dllname, importc: "glVertex3f".} -proc glVertex3fv*(v: PGLfloat){.dynlib: dllname, importc: "glVertex3fv".} -proc glVertex3i*(x, y, z: TGLint){.dynlib: dllname, importc: "glVertex3i".} -proc glVertex3iv*(v: PGLint){.dynlib: dllname, importc: "glVertex3iv".} -proc glVertex3s*(x, y, z: TGLshort){.dynlib: dllname, importc: "glVertex3s".} -proc glVertex3sv*(v: PGLshort){.dynlib: dllname, importc: "glVertex3sv".} -proc glVertex4d*(x, y, z, w: TGLdouble){.dynlib: dllname, importc: "glVertex4d".} -proc glVertex4dv*(v: PGLdouble){.dynlib: dllname, importc: "glVertex4dv".} -proc glVertex4f*(x, y, z, w: TGLfloat){.dynlib: dllname, importc: "glVertex4f".} -proc glVertex4fv*(v: PGLfloat){.dynlib: dllname, importc: "glVertex4fv".} -proc glVertex4i*(x, y, z, w: TGLint){.dynlib: dllname, importc: "glVertex4i".} -proc glVertex4iv*(v: PGLint){.dynlib: dllname, importc: "glVertex4iv".} -proc glVertex4s*(x, y, z, w: TGLshort){.dynlib: dllname, importc: "glVertex4s".} -proc glVertex4sv*(v: PGLshort){.dynlib: dllname, importc: "glVertex4sv".} -proc glVertexPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, - pointer: Pointer){.dynlib: dllname, - importc: "glVertexPointer".} -proc glViewport*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname, - importc: "glViewport".} -type - PFN_GLARRAY_ELEMENT_EXTPROC* = proc (i: TGLint) - PFN_GLDRAW_ARRAYS_EXTPROC* = proc (mode: TGLenum, first: TGLint, - count: TGLsizei) - PFN_GLVERTEX_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, - stride, count: TGLsizei, - pointer: Pointer) - PFN_GLNORMAL_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei, - pointer: Pointer) - PFN_GLCOLOR_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, - stride, count: TGLsizei, pointer: Pointer) - PFN_GLINDEX_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei, - pointer: Pointer) - PFN_GLTEXCOORD_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, - stride, count: TGLsizei, pointer: Pointer) - PFN_GLEDGEFLAG_POINTER_EXTPROC* = proc (stride, count: TGLsizei, - pointer: PGLboolean) - PFN_GLGET_POINTER_VEXT_PROC* = proc (pname: TGLenum, params: Pointer) - PFN_GLARRAY_ELEMENT_ARRAY_EXTPROC* = proc (mode: TGLenum, count: TGLsizei, - pi: Pointer) # WIN_swap_hint - PFN_GLADDSWAPHINT_RECT_WINPROC* = proc (x, y: TGLint, width, height: TGLsizei) - PFN_GLCOLOR_TABLE_EXTPROC* = proc (target, internalFormat: TGLenum, - width: TGLsizei, format, atype: TGLenum, - data: Pointer) - PFN_GLCOLOR_SUBTABLE_EXTPROC* = proc (target: TGLenum, start, count: TGLsizei, - format, atype: TGLenum, data: Pointer) - PFN_GLGETCOLOR_TABLE_EXTPROC* = proc (target, format, atype: TGLenum, - data: Pointer) - PFN_GLGETCOLOR_TABLE_PARAMETER_IVEXTPROC* = proc (target, pname: TGLenum, - params: PGLint) - PFN_GLGETCOLOR_TABLE_PARAMETER_FVEXTPROC* = proc (target, pname: TGLenum, - params: PGLfloat) - -{.pop.} -# implementation diff --git a/lib/wrappers/opengl/glext.nim b/lib/wrappers/opengl/glext.nim deleted file mode 100644 index 32871df0e..000000000 --- a/lib/wrappers/opengl/glext.nim +++ /dev/null @@ -1,4673 +0,0 @@ -# -# -# Adaption of the delphi3d.net OpenGL units to FreePascal -# Sebastian Guenther (sg@freepascal.org) in 2002 -# These units are free to use -# -# - -#************************************************* -# * OpenGL extension loading library * -# * Generated by MetaGLext, written by Tom Nuydens * -# * (tom@delphi3d.net -- http://www.delphi3d.net * -# ************************************************* -#*** Generated on 10/11/2002 - -when defined(windows): - {.push, callconv: stdcall.} -else: - {.push, callconv: cdecl.} -import - gl - -type - GLcharARB* = Char - TGLcharARB* = GLcharARB - PGLcharARB* = ptr GLcharARB - GLhandleARB* = int - TGLhandleARB* = GLhandleARB - PGLhandleARB* = ptr GLhandleARB - GLintptr* = int - TGLintptr* = GLintptr - PGLintptr* = ptr GLintptr - GLsizeiptr* = int - TGLsizeiptr* = GLsizeiptr - PGLsizeiptr* = ptr GLsizeiptr - GLchar* = Char - TGLchar* = GLchar - PGLchar* = cstring #***** GL_version_1_2 *****// - -const - GL_UNSIGNED_BYTE_3_3_2* = 0x00008032 - GL_UNSIGNED_SHORT_4_4_4_4* = 0x00008033 - GL_UNSIGNED_SHORT_5_5_5_1* = 0x00008034 - GL_UNSIGNED_INT_8_8_8_8* = 0x00008035 - GL_UNSIGNED_INT_10_10_10_2* = 0x00008036 - GL_RESCALE_NORMAL* = 0x0000803A - GL_UNSIGNED_BYTE_2_3_3_REV* = 0x00008362 - GL_UNSIGNED_SHORT_5_6_5* = 0x00008363 - GL_UNSIGNED_SHORT_5_6_5_REV* = 0x00008364 - GL_UNSIGNED_SHORT_4_4_4_4_REV* = 0x00008365 - GL_UNSIGNED_SHORT_1_5_5_5_REV* = 0x00008366 - GL_UNSIGNED_INT_8_8_8_8_REV* = 0x00008367 - GL_UNSIGNED_INT_2_10_10_10_REV* = 0x00008368 - GL_BGR* = 0x000080E0 - GL_BGRA* = 0x000080E1 - GL_MAX_ELEMENTS_VERTICES* = 0x000080E8 - GL_MAX_ELEMENTS_INDICES* = 0x000080E9 - GL_CLAMP_TO_EDGE* = 0x0000812F - GL_TEXTURE_MIN_LOD* = 0x0000813A - GL_TEXTURE_MAX_LOD* = 0x0000813B - GL_TEXTURE_BASE_LEVEL* = 0x0000813C - GL_TEXTURE_MAX_LEVEL* = 0x0000813D - GL_LIGHT_MODEL_COLOR_CONTROL* = 0x000081F8 - GL_SINGLE_COLOR* = 0x000081F9 - GL_SEPARATE_SPECULAR_COLOR* = 0x000081FA - GL_SMOOTH_POINT_SIZE_RANGE* = 0x00000B12 - GL_SMOOTH_POINT_SIZE_GRANULARITY* = 0x00000B13 - GL_SMOOTH_LINE_WIDTH_RANGE* = 0x00000B22 - GL_SMOOTH_LINE_WIDTH_GRANULARITY* = 0x00000B23 - GL_ALIASED_POINT_SIZE_RANGE* = 0x0000846D - GL_ALIASED_LINE_WIDTH_RANGE* = 0x0000846E - GL_PACK_SKIP_IMAGES* = 0x0000806B - GL_PACK_IMAGE_HEIGHT* = 0x0000806C - GL_UNPACK_SKIP_IMAGES* = 0x0000806D - GL_UNPACK_IMAGE_HEIGHT* = 0x0000806E - GL_TEXTURE_3D* = 0x0000806F - GL_PROXY_TEXTURE_3D* = 0x00008070 - GL_TEXTURE_DEPTH* = 0x00008071 - GL_TEXTURE_WRAP_R* = 0x00008072 - GL_MAX_3D_TEXTURE_SIZE* = 0x00008073 - -proc glBlendColor*(red: TGLclampf, green: TGLclampf, blue: TGLclampf, - alpha: TGLclampf){.dynlib: dllname, importc: "glBlendColor".} -proc glBlendEquation*(mode: TGLenum){.dynlib: dllname, - importc: "glBlendEquation".} -proc glDrawRangeElements*(mode: TGLenum, start: TGLuint, theend: TGLuint, - count: TGLsizei, thetype: TGLenum, indices: PGLvoid){. - dynlib: dllname, importc: "glDrawRangeElements".} -proc glColorTable*(target: TGLenum, internalformat: TGLenum, width: TGLsizei, - format: TGLenum, thetype: TGLenum, table: PGLvoid){. - dynlib: dllname, importc: "glColorTable".} -proc glColorTableParameterfv*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glColorTableParameterfv".} -proc glColorTableParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glColorTableParameteriv".} -proc glCopyColorTable*(target: TGLenum, internalformat: TGLenum, x: TGLint, - y: TGLint, width: TGLsizei){.dynlib: dllname, - importc: "glCopyColorTable".} -proc glGetColorTable*(target: TGLenum, format: TGLenum, thetype: TGLenum, - table: PGLvoid){.dynlib: dllname, - importc: "glGetColorTable".} -proc glGetColorTableParameterfv*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetColorTableParameterfv".} -proc glGetColorTableParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetColorTableParameteriv".} -proc glColorSubTable*(target: TGLenum, start: TGLsizei, count: TGLsizei, - format: TGLenum, thetype: TGLenum, data: PGLvoid){. - dynlib: dllname, importc: "glColorSubTable".} -proc glCopyColorSubTable*(target: TGLenum, start: TGLsizei, x: TGLint, - y: TGLint, width: TGLsizei){.dynlib: dllname, - importc: "glCopyColorSubTable".} -proc glConvolutionFilter1D*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, format: TGLenum, thetype: TGLenum, - image: PGLvoid){.dynlib: dllname, - importc: "glConvolutionFilter1D".} -proc glConvolutionFilter2D*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, height: TGLsizei, format: TGLenum, - thetype: TGLenum, image: PGLvoid){.dynlib: dllname, - importc: "glConvolutionFilter2D".} -proc glConvolutionParameterf*(target: TGLenum, pname: TGLenum, params: TGLfloat){. - dynlib: dllname, importc: "glConvolutionParameterf".} -proc glConvolutionParameterfv*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glConvolutionParameterfv".} -proc glConvolutionParameteri*(target: TGLenum, pname: TGLenum, params: TGLint){. - dynlib: dllname, importc: "glConvolutionParameteri".} -proc glConvolutionParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glConvolutionParameteriv".} -proc glCopyConvolutionFilter1D*(target: TGLenum, internalformat: TGLenum, - x: TGLint, y: TGLint, width: TGLsizei){. - dynlib: dllname, importc: "glCopyConvolutionFilter1D".} -proc glCopyConvolutionFilter2D*(target: TGLenum, internalformat: TGLenum, - x: TGLint, y: TGLint, width: TGLsizei, - height: TGLsizei){.dynlib: dllname, - importc: "glCopyConvolutionFilter2D".} -proc glGetConvolutionFilter*(target: TGLenum, format: TGLenum, thetype: TGLenum, - image: PGLvoid){.dynlib: dllname, - importc: "glGetConvolutionFilter".} -proc glGetConvolutionParameterfv*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetConvolutionParameterfv".} -proc glGetConvolutionParameteriv*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetConvolutionParameteriv".} -proc glGetSeparableFilter*(target: TGLenum, format: TGLenum, thetype: TGLenum, - row: PGLvoid, column: PGLvoid, span: PGLvoid){. - dynlib: dllname, importc: "glGetSeparableFilter".} -proc glSeparableFilter2D*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, height: TGLsizei, format: TGLenum, - thetype: TGLenum, row: PGLvoid, column: PGLvoid){. - dynlib: dllname, importc: "glSeparableFilter2D".} -proc glGetHistogram*(target: TGLenum, reset: TGLboolean, format: TGLenum, - thetype: TGLenum, values: PGLvoid){.dynlib: dllname, - importc: "glGetHistogram".} -proc glGetHistogramParameterfv*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetHistogramParameterfv".} -proc glGetHistogramParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetHistogramParameteriv".} -proc glGetMinmax*(target: TGLenum, reset: TGLboolean, format: TGLenum, - thetype: TGLenum, values: PGLvoid){.dynlib: dllname, - importc: "glGetMinmax".} -proc glGetMinmaxParameterfv*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetMinmaxParameterfv".} -proc glGetMinmaxParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetMinmaxParameteriv".} -proc glHistogram*(target: TGLenum, width: TGLsizei, internalformat: TGLenum, - sink: TGLboolean){.dynlib: dllname, importc: "glHistogram".} -proc glMinmax*(target: TGLenum, internalformat: TGLenum, sink: TGLboolean){. - dynlib: dllname, importc: "glMinmax".} -proc glResetHistogram*(target: TGLenum){.dynlib: dllname, - importc: "glResetHistogram".} -proc glResetMinmax*(target: TGLenum){.dynlib: dllname, importc: "glResetMinmax".} -proc glTexImage3D*(target: TGLenum, level: TGLint, internalformat: TGLint, - width: TGLsizei, height: TGLsizei, depth: TGLsizei, - border: TGLint, format: TGLenum, thetype: TGLenum, - pixels: PGLvoid){.dynlib: dllname, importc: "glTexImage3D".} -proc glTexSubImage3D*(target: TGLenum, level: TGLint, xoffset: TGLint, - yoffset: TGLint, zoffset: TGLint, width: TGLsizei, - height: TGLsizei, depth: TGLsizei, format: TGLenum, - thetype: TGLenum, pixels: PGLvoid){.dynlib: dllname, - importc: "glTexSubImage3D".} -proc glCopyTexSubImage3D*(target: TGLenum, level: TGLint, xoffset: TGLint, - yoffset: TGLint, zoffset: TGLint, x: TGLint, - y: TGLint, width: TGLsizei, height: TGLsizei){. - dynlib: dllname, importc: "glCopyTexSubImage3D".} -proc glActiveTextureARB*(texture: TGLenum){.dynlib: dllname, - importc: "glActiveTextureARB".} -proc glClientActiveTextureARB*(texture: TGLenum){.dynlib: dllname, - importc: "glClientActiveTextureARB".} -proc glMultiTexCoord1dARB*(target: TGLenum, s: TGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord1dARB".} -proc glMultiTexCoord1dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord1dvARB".} -proc glMultiTexCoord1fARB*(target: TGLenum, s: TGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord1fARB".} -proc glMultiTexCoord1fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord1fvARB".} -proc glMultiTexCoord1iARB*(target: TGLenum, s: TGLint){.dynlib: dllname, - importc: "glMultiTexCoord1iARB".} -proc glMultiTexCoord1ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord1ivARB".} -proc glMultiTexCoord1sARB*(target: TGLenum, s: TGLshort){.dynlib: dllname, - importc: "glMultiTexCoord1sARB".} -proc glMultiTexCoord1svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord1svARB".} -proc glMultiTexCoord2dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble){. - dynlib: dllname, importc: "glMultiTexCoord2dARB".} -proc glMultiTexCoord2dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord2dvARB".} -proc glMultiTexCoord2fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat){. - dynlib: dllname, importc: "glMultiTexCoord2fARB".} -proc glMultiTexCoord2fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord2fvARB".} -proc glMultiTexCoord2iARB*(target: TGLenum, s: TGLint, t: TGLint){. - dynlib: dllname, importc: "glMultiTexCoord2iARB".} -proc glMultiTexCoord2ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord2ivARB".} -proc glMultiTexCoord2sARB*(target: TGLenum, s: TGLshort, t: TGLshort){. - dynlib: dllname, importc: "glMultiTexCoord2sARB".} -proc glMultiTexCoord2svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord2svARB".} -proc glMultiTexCoord3dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble, - r: TGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord3dARB".} -proc glMultiTexCoord3dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord3dvARB".} -proc glMultiTexCoord3fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat, - r: TGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord3fARB".} -proc glMultiTexCoord3fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord3fvARB".} -proc glMultiTexCoord3iARB*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint){. - dynlib: dllname, importc: "glMultiTexCoord3iARB".} -proc glMultiTexCoord3ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord3ivARB".} -proc glMultiTexCoord3sARB*(target: TGLenum, s: TGLshort, t: TGLshort, - r: TGLshort){.dynlib: dllname, - importc: "glMultiTexCoord3sARB".} -proc glMultiTexCoord3svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord3svARB".} -proc glMultiTexCoord4dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble, - r: TGLdouble, q: TGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord4dARB".} -proc glMultiTexCoord4dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord4dvARB".} -proc glMultiTexCoord4fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat, - r: TGLfloat, q: TGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord4fARB".} -proc glMultiTexCoord4fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord4fvARB".} -proc glMultiTexCoord4iARB*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint, - q: TGLint){.dynlib: dllname, - importc: "glMultiTexCoord4iARB".} -proc glMultiTexCoord4ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord4ivARB".} -proc glMultiTexCoord4sARB*(target: TGLenum, s: TGLshort, t: TGLshort, - r: TGLshort, q: TGLshort){.dynlib: dllname, - importc: "glMultiTexCoord4sARB".} -proc glMultiTexCoord4svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord4svARB".} -proc glSampleCoverageARB*(value: TGLclampf, invert: TGLboolean){. - dynlib: dllname, importc: "glSampleCoverageARB".} - #***** GL_ARB_texture_env_add *****// -proc glWeightbvARB*(size: TGLint, weights: PGLbyte){.dynlib: dllname, - importc: "glWeightbvARB".} -proc glWeightsvARB*(size: TGLint, weights: PGLshort){.dynlib: dllname, - importc: "glWeightsvARB".} -proc glWeightivARB*(size: TGLint, weights: PGLint){.dynlib: dllname, - importc: "glWeightivARB".} -proc glWeightfvARB*(size: TGLint, weights: PGLfloat){.dynlib: dllname, - importc: "glWeightfvARB".} -proc glWeightdvARB*(size: TGLint, weights: PGLdouble){.dynlib: dllname, - importc: "glWeightdvARB".} -proc glWeightvARB*(size: TGLint, weights: PGLdouble){.dynlib: dllname, - importc: "glWeightvARB".} -proc glWeightubvARB*(size: TGLint, weights: PGLubyte){.dynlib: dllname, - importc: "glWeightubvARB".} -proc glWeightusvARB*(size: TGLint, weights: PGLushort){.dynlib: dllname, - importc: "glWeightusvARB".} -proc glWeightuivARB*(size: TGLint, weights: PGLuint){.dynlib: dllname, - importc: "glWeightuivARB".} -proc glWeightPointerARB*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glWeightPointerARB".} -proc glVertexBlendARB*(count: TGLint){.dynlib: dllname, - importc: "glVertexBlendARB".} -proc glVertexAttrib1sARB*(index: TGLuint, x: TGLshort){.dynlib: dllname, - importc: "glVertexAttrib1sARB".} -proc glVertexAttrib1fARB*(index: TGLuint, x: TGLfloat){.dynlib: dllname, - importc: "glVertexAttrib1fARB".} -proc glVertexAttrib1dARB*(index: TGLuint, x: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib1dARB".} -proc glVertexAttrib2sARB*(index: TGLuint, x: TGLshort, y: TGLshort){. - dynlib: dllname, importc: "glVertexAttrib2sARB".} -proc glVertexAttrib2fARB*(index: TGLuint, x: TGLfloat, y: TGLfloat){. - dynlib: dllname, importc: "glVertexAttrib2fARB".} -proc glVertexAttrib2dARB*(index: TGLuint, x: TGLdouble, y: TGLdouble){. - dynlib: dllname, importc: "glVertexAttrib2dARB".} -proc glVertexAttrib3sARB*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort){. - dynlib: dllname, importc: "glVertexAttrib3sARB".} -proc glVertexAttrib3fARB*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glVertexAttrib3fARB".} -proc glVertexAttrib3dARB*(index: TGLuint, x: TGLdouble, y: TGLdouble, - z: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib3dARB".} -proc glVertexAttrib4sARB*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort, - w: TGLshort){.dynlib: dllname, - importc: "glVertexAttrib4sARB".} -proc glVertexAttrib4fARB*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat, - w: TGLfloat){.dynlib: dllname, - importc: "glVertexAttrib4fARB".} -proc glVertexAttrib4dARB*(index: TGLuint, x: TGLdouble, y: TGLdouble, - z: TGLdouble, w: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib4dARB".} -proc glVertexAttrib4NubARB*(index: TGLuint, x: TGLubyte, y: TGLubyte, - z: TGLubyte, w: TGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4NubARB".} -proc glVertexAttrib1svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib1svARB".} -proc glVertexAttrib1fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib1fvARB".} -proc glVertexAttrib1dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib1dvARB".} -proc glVertexAttrib2svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib2svARB".} -proc glVertexAttrib2fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib2fvARB".} -proc glVertexAttrib2dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib2dvARB".} -proc glVertexAttrib3svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib3svARB".} -proc glVertexAttrib3fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib3fvARB".} -proc glVertexAttrib3dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib3dvARB".} -proc glVertexAttrib4bvARB*(index: TGLuint, v: PGLbyte){.dynlib: dllname, - importc: "glVertexAttrib4bvARB".} -proc glVertexAttrib4svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib4svARB".} -proc glVertexAttrib4ivARB*(index: TGLuint, v: PGLint){.dynlib: dllname, - importc: "glVertexAttrib4ivARB".} -proc glVertexAttrib4ubvARB*(index: TGLuint, v: PGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4ubvARB".} -proc glVertexAttrib4usvARB*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib4usvARB".} -proc glVertexAttrib4uivARB*(index: TGLuint, v: PGLuint){.dynlib: dllname, - importc: "glVertexAttrib4uivARB".} -proc glVertexAttrib4fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib4fvARB".} -proc glVertexAttrib4dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib4dvARB".} -proc glVertexAttrib4NbvARB*(index: TGLuint, v: PGLbyte){.dynlib: dllname, - importc: "glVertexAttrib4NbvARB".} -proc glVertexAttrib4NsvARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib4NsvARB".} -proc glVertexAttrib4NivARB*(index: TGLuint, v: PGLint){.dynlib: dllname, - importc: "glVertexAttrib4NivARB".} -proc glVertexAttrib4NubvARB*(index: TGLuint, v: PGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4NubvARB".} -proc glVertexAttrib4NusvARB*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib4NusvARB".} -proc glVertexAttrib4NuivARB*(index: TGLuint, v: PGLuint){.dynlib: dllname, - importc: "glVertexAttrib4NuivARB".} -proc glVertexAttribPointerARB*(index: TGLuint, size: TGLint, thetype: TGLenum, - normalized: TGLboolean, stride: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glVertexAttribPointerARB".} -proc glEnableVertexAttribArrayARB*(index: TGLuint){.dynlib: dllname, - importc: "glEnableVertexAttribArrayARB".} -proc glDisableVertexAttribArrayARB*(index: TGLuint){.dynlib: dllname, - importc: "glDisableVertexAttribArrayARB".} -proc glProgramStringARB*(target: TGLenum, format: TGLenum, length: TGLsizei, - str: PGLvoid){.dynlib: dllname, - importc: "glProgramStringARB".} -proc glBindProgramARB*(target: TGLenum, theProgram: TGLuint){.dynlib: dllname, - importc: "glBindProgramARB".} -proc glDeleteProgramsARB*(n: TGLsizei, programs: PGLuint){.dynlib: dllname, - importc: "glDeleteProgramsARB".} -proc glGenProgramsARB*(n: TGLsizei, programs: PGLuint){.dynlib: dllname, - importc: "glGenProgramsARB".} -proc glProgramEnvParameter4dARB*(target: TGLenum, index: TGLuint, x: TGLdouble, - y: TGLdouble, z: TGLdouble, w: TGLdouble){. - dynlib: dllname, importc: "glProgramEnvParameter4dARB".} -proc glProgramEnvParameter4dvARB*(target: TGLenum, index: TGLuint, - params: PGLdouble){.dynlib: dllname, - importc: "glProgramEnvParameter4dvARB".} -proc glProgramEnvParameter4fARB*(target: TGLenum, index: TGLuint, x: TGLfloat, - y: TGLfloat, z: TGLfloat, w: TGLfloat){. - dynlib: dllname, importc: "glProgramEnvParameter4fARB".} -proc glProgramEnvParameter4fvARB*(target: TGLenum, index: TGLuint, - params: PGLfloat){.dynlib: dllname, - importc: "glProgramEnvParameter4fvARB".} -proc glProgramLocalParameter4dARB*(target: TGLenum, index: TGLuint, - x: TGLdouble, y: TGLdouble, z: TGLdouble, - w: TGLdouble){.dynlib: dllname, - importc: "glProgramLocalParameter4dARB".} -proc glProgramLocalParameter4dvARB*(target: TGLenum, index: TGLuint, - params: PGLdouble){.dynlib: dllname, - importc: "glProgramLocalParameter4dvARB".} -proc glProgramLocalParameter4fARB*(target: TGLenum, index: TGLuint, x: TGLfloat, - y: TGLfloat, z: TGLfloat, w: TGLfloat){. - dynlib: dllname, importc: "glProgramLocalParameter4fARB".} -proc glProgramLocalParameter4fvARB*(target: TGLenum, index: TGLuint, - params: PGLfloat){.dynlib: dllname, - importc: "glProgramLocalParameter4fvARB".} -proc glGetProgramEnvParameterdvARB*(target: TGLenum, index: TGLuint, - params: PGLdouble){.dynlib: dllname, - importc: "glGetProgramEnvParameterdvARB".} -proc glGetProgramEnvParameterfvARB*(target: TGLenum, index: TGLuint, - params: PGLfloat){.dynlib: dllname, - importc: "glGetProgramEnvParameterfvARB".} -proc glGetProgramLocalParameterdvARB*(target: TGLenum, index: TGLuint, - params: PGLdouble){.dynlib: dllname, - importc: "glGetProgramLocalParameterdvARB".} -proc glGetProgramLocalParameterfvARB*(target: TGLenum, index: TGLuint, - params: PGLfloat){.dynlib: dllname, - importc: "glGetProgramLocalParameterfvARB".} -proc glGetProgramivARB*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetProgramivARB".} -proc glGetProgramStringARB*(target: TGLenum, pname: TGLenum, str: PGLvoid){. - dynlib: dllname, importc: "glGetProgramStringARB".} -proc glGetVertexAttribdvARB*(index: TGLuint, pname: TGLenum, params: PGLdouble){. - dynlib: dllname, importc: "glGetVertexAttribdvARB".} -proc glGetVertexAttribfvARB*(index: TGLuint, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetVertexAttribfvARB".} -proc glGetVertexAttribivARB*(index: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetVertexAttribivARB".} -proc glGetVertexAttribPointervARB*(index: TGLuint, pname: TGLenum, - pointer: PGLvoid){.dynlib: dllname, - importc: "glGetVertexAttribPointervARB".} -proc glIsProgramARB*(theProgram: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsProgramARB".} - #***** GL_ARB_window_pos *****// -proc glWindowPos2dARB*(x: TGLdouble, y: TGLdouble){.dynlib: dllname, - importc: "glWindowPos2dARB".} -proc glWindowPos2fARB*(x: TGLfloat, y: TGLfloat){.dynlib: dllname, - importc: "glWindowPos2fARB".} -proc glWindowPos2iARB*(x: TGLint, y: TGLint){.dynlib: dllname, - importc: "glWindowPos2iARB".} -proc glWindowPos2sARB*(x: TGLshort, y: TGLshort){.dynlib: dllname, - importc: "glWindowPos2sARB".} -proc glWindowPos2dvARB*(p: PGLdouble){.dynlib: dllname, - importc: "glWindowPos2dvARB".} -proc glWindowPos2fvARB*(p: PGLfloat){.dynlib: dllname, - importc: "glWindowPos2fvARB".} -proc glWindowPos2ivARB*(p: PGLint){.dynlib: dllname, - importc: "glWindowPos2ivARB".} -proc glWindowPos2svARB*(p: PGLshort){.dynlib: dllname, - importc: "glWindowPos2svARB".} -proc glWindowPos3dARB*(x: TGLdouble, y: TGLdouble, z: TGLdouble){. - dynlib: dllname, importc: "glWindowPos3dARB".} -proc glWindowPos3fARB*(x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glWindowPos3fARB".} -proc glWindowPos3iARB*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname, - importc: "glWindowPos3iARB".} -proc glWindowPos3sARB*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname, - importc: "glWindowPos3sARB".} -proc glWindowPos3dvARB*(p: PGLdouble){.dynlib: dllname, - importc: "glWindowPos3dvARB".} -proc glWindowPos3fvARB*(p: PGLfloat){.dynlib: dllname, - importc: "glWindowPos3fvARB".} -proc glWindowPos3ivARB*(p: PGLint){.dynlib: dllname, - importc: "glWindowPos3ivARB".} -proc glWindowPos3svARB*(p: PGLshort){.dynlib: dllname, - importc: "glWindowPos3svARB".} -proc glBlendEquationSeparate*(modeRGB: TGLenum, modeAlpha: TGLenum){. - dynlib: dllname, importc: "glBlendEquationSeparate".} -proc glDrawBuffers*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname, - importc: "glDrawBuffers".} -proc glStencilOpSeparate*(face: TGLenum, sfail: TGLenum, dpfail: TGLenum, - dppass: TGLenum){.dynlib: dllname, - importc: "glStencilOpSeparate".} -proc glStencilFuncSeparate*(frontfunc: TGLenum, backfunc: TGLenum, - theRef: TGLint, mask: TGLuint){.dynlib: dllname, - importc: "glStencilFuncSeparate".} -proc glStencilMaskSeparate*(face: TGLenum, mask: TGLuint){.dynlib: dllname, - importc: "glStencilMaskSeparate".} -proc glAttachShader*(theProgram: TGLuint, shader: TGLuint){.dynlib: dllname, - importc: "glAttachShader".} -proc glBindAttribLocation*(theProgram: TGLuint, index: TGLuint, name: PGLchar){. - dynlib: dllname, importc: "glBindAttribLocation".} -proc glCompileShader*(shader: TGLuint){.dynlib: dllname, - importc: "glCompileShader".} -proc glCreateProgram*(): TGLuint{.dynlib: dllname, importc: "glCreateProgram".} -proc glCreateShader*(thetype: TGLenum): TGLuint{.dynlib: dllname, - importc: "glCreateShader".} -proc glDeleteProgram*(theProgram: TGLuint){.dynlib: dllname, - importc: "glDeleteProgram".} -proc glDeleteShader*(shader: TGLuint){.dynlib: dllname, - importc: "glDeleteShader".} -proc glDetachShader*(theProgram: TGLuint, shader: TGLuint){.dynlib: dllname, - importc: "glDetachShader".} -proc glDisableVertexAttribArray*(index: TGLuint){.dynlib: dllname, - importc: "glDisableVertexAttribArray".} -proc glEnableVertexAttribArray*(index: TGLuint){.dynlib: dllname, - importc: "glEnableVertexAttribArray".} -proc glGetActiveAttrib*(theProgram: TGLuint, index: TGLuint, bufSize: TGLsizei, - len: PGLsizei, size: PGLint, thetype: PGLenum, - name: PGLchar){.dynlib: dllname, - importc: "glGetActiveAttrib".} -proc glGetActiveUniform*(theProgram: TGLuint, index: TGLuint, bufSize: TGLsizei, - len: PGLsizei, size: PGLint, thetype: PGLenum, - name: PGLchar){.dynlib: dllname, - importc: "glGetActiveUniform".} -proc glGetAttachedShaders*(theProgram: TGLuint, maxCount: TGLsizei, - count: PGLsizei, obj: PGLuint){.dynlib: dllname, - importc: "glGetAttachedShaders".} -proc glGetAttribLocation*(theProgram: TGLuint, name: PGLchar): TGLint{. - dynlib: dllname, importc: "glGetAttribLocation".} -proc glGetProgramiv*(theProgram: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetProgramiv".} -proc glGetProgramInfoLog*(theProgram: TGLuint, bufSize: TGLsizei, len: PGLsizei, - infoLog: PGLchar){.dynlib: dllname, - importc: "glGetProgramInfoLog".} -proc glGetShaderiv*(shader: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetShaderiv".} -proc glGetShaderInfoLog*(shader: TGLuint, bufSize: TGLsizei, len: PGLsizei, - infoLog: PGLchar){.dynlib: dllname, - importc: "glGetShaderInfoLog".} -proc glGetShaderSource*(shader: TGLuint, bufSize: TGLsizei, len: PGLsizei, - source: PGLchar){.dynlib: dllname, - importc: "glGetShaderSource".} -proc glGetUniformLocation*(theProgram: TGLuint, name: PGLchar): TGLint{. - dynlib: dllname, importc: "glGetUniformLocation".} -proc glGetUniformfv*(theProgram: TGLuint, location: TGLint, params: PGLfloat){. - dynlib: dllname, importc: "glGetUniformfv".} -proc glGetUniformiv*(theProgram: TGLuint, location: TGLint, params: PGLint){. - dynlib: dllname, importc: "glGetUniformiv".} -proc glGetVertexAttribdv*(index: TGLuint, pname: TGLenum, params: PGLdouble){. - dynlib: dllname, importc: "glGetVertexAttribdv".} -proc glGetVertexAttribfv*(index: TGLuint, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetVertexAttribfv".} -proc glGetVertexAttribiv*(index: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetVertexAttribiv".} -proc glGetVertexAttribPointerv*(index: TGLuint, pname: TGLenum, pointer: PGLvoid){. - dynlib: dllname, importc: "glGetVertexAttribPointerv".} -proc glIsProgram*(theProgram: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsProgram".} -proc glIsShader*(shader: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsShader".} -proc glLinkProgram*(theProgram: TGLuint){.dynlib: dllname, - importc: "glLinkProgram".} -proc glShaderSource*(shader: TGLuint, count: TGLsizei, str: PGLchar, len: PGLint){. - dynlib: dllname, importc: "glShaderSource".} -proc glUseProgram*(theProgram: TGLuint){.dynlib: dllname, - importc: "glUseProgram".} -proc glUniform1f*(location: TGLint, v0: TGLfloat){.dynlib: dllname, - importc: "glUniform1f".} -proc glUniform2f*(location: TGLint, v0: TGLfloat, v1: TGLfloat){. - dynlib: dllname, importc: "glUniform2f".} -proc glUniform3f*(location: TGLint, v0: TGLfloat, v1: TGLfloat, v2: TGLfloat){. - dynlib: dllname, importc: "glUniform3f".} -proc glUniform4f*(location: TGLint, v0: TGLfloat, v1: TGLfloat, v2: TGLfloat, - v3: TGLfloat){.dynlib: dllname, importc: "glUniform4f".} -proc glUniform1i*(location: TGLint, v0: TGLint){.dynlib: dllname, - importc: "glUniform1i".} -proc glUniform2i*(location: TGLint, v0: TGLint, v1: TGLint){.dynlib: dllname, - importc: "glUniform2i".} -proc glUniform3i*(location: TGLint, v0: TGLint, v1: TGLint, v2: TGLint){. - dynlib: dllname, importc: "glUniform3i".} -proc glUniform4i*(location: TGLint, v0: TGLint, v1: TGLint, v2: TGLint, - v3: TGLint){.dynlib: dllname, importc: "glUniform4i".} -proc glUniform1fv*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform1fv".} -proc glUniform2fv*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform2fv".} -proc glUniform3fv*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform3fv".} -proc glUniform4fv*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform4fv".} -proc glUniform1iv*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform1iv".} -proc glUniform2iv*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform2iv".} -proc glUniform3iv*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform3iv".} -proc glUniform4iv*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform4iv".} -proc glUniformMatrix2fv*(location: TGLint, count: TGLsizei, - transpose: TGLboolean, value: PGLfloat){. - dynlib: dllname, importc: "glUniformMatrix2fv".} -proc glUniformMatrix3fv*(location: TGLint, count: TGLsizei, - transpose: TGLboolean, value: PGLfloat){. - dynlib: dllname, importc: "glUniformMatrix3fv".} -proc glUniformMatrix4fv*(location: TGLint, count: TGLsizei, - transpose: TGLboolean, value: PGLfloat){. - dynlib: dllname, importc: "glUniformMatrix4fv".} -proc glValidateProgram*(theProgram: TGLuint){.dynlib: dllname, - importc: "glValidateProgram".} -proc glVertexAttrib1d*(index: TGLuint, x: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib1d".} -proc glVertexAttrib1dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib1dv".} -proc glVertexAttrib1f*(index: TGLuint, x: TGLfloat){.dynlib: dllname, - importc: "glVertexAttrib1f".} -proc glVertexAttrib1fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib1fv".} -proc glVertexAttrib1s*(index: TGLuint, x: TGLshort){.dynlib: dllname, - importc: "glVertexAttrib1s".} -proc glVertexAttrib1sv*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib1sv".} -proc glVertexAttrib2d*(index: TGLuint, x: TGLdouble, y: TGLdouble){. - dynlib: dllname, importc: "glVertexAttrib2d".} -proc glVertexAttrib2dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib2dv".} -proc glVertexAttrib2f*(index: TGLuint, x: TGLfloat, y: TGLfloat){. - dynlib: dllname, importc: "glVertexAttrib2f".} -proc glVertexAttrib2fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib2fv".} -proc glVertexAttrib2s*(index: TGLuint, x: TGLshort, y: TGLshort){. - dynlib: dllname, importc: "glVertexAttrib2s".} -proc glVertexAttrib2sv*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib2sv".} -proc glVertexAttrib3d*(index: TGLuint, x: TGLdouble, y: TGLdouble, z: TGLdouble){. - dynlib: dllname, importc: "glVertexAttrib3d".} -proc glVertexAttrib3dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib3dv".} -proc glVertexAttrib3f*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glVertexAttrib3f".} -proc glVertexAttrib3fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib3fv".} -proc glVertexAttrib3s*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort){. - dynlib: dllname, importc: "glVertexAttrib3s".} -proc glVertexAttrib3sv*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib3sv".} -proc glVertexAttrib4Nbv*(index: TGLuint, v: PGLbyte){.dynlib: dllname, - importc: "glVertexAttrib4Nbv".} -proc glVertexAttrib4Niv*(index: TGLuint, v: PGLint){.dynlib: dllname, - importc: "glVertexAttrib4Niv".} -proc glVertexAttrib4Nsv*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib4Nsv".} -proc glVertexAttrib4Nub*(index: TGLuint, x: TGLubyte, y: TGLubyte, z: TGLubyte, - w: TGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4Nub".} -proc glVertexAttrib4Nubv*(index: TGLuint, v: PGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4Nubv".} -proc glVertexAttrib4Nuiv*(index: TGLuint, v: PGLuint){.dynlib: dllname, - importc: "glVertexAttrib4Nuiv".} -proc glVertexAttrib4Nusv*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib4Nusv".} -proc glVertexAttrib4bv*(index: TGLuint, v: PGLbyte){.dynlib: dllname, - importc: "glVertexAttrib4bv".} -proc glVertexAttrib4d*(index: TGLuint, x: TGLdouble, y: TGLdouble, z: TGLdouble, - w: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib4d".} -proc glVertexAttrib4dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib4dv".} -proc glVertexAttrib4f*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat, - w: TGLfloat){.dynlib: dllname, - importc: "glVertexAttrib4f".} -proc glVertexAttrib4fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib4fv".} -proc glVertexAttrib4iv*(index: TGLuint, v: PGLint){.dynlib: dllname, - importc: "glVertexAttrib4iv".} -proc glVertexAttrib4s*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort, - w: TGLshort){.dynlib: dllname, - importc: "glVertexAttrib4s".} -proc glVertexAttrib4sv*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib4sv".} -proc glVertexAttrib4ubv*(index: TGLuint, v: PGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4ubv".} -proc glVertexAttrib4uiv*(index: TGLuint, v: PGLuint){.dynlib: dllname, - importc: "glVertexAttrib4uiv".} -proc glVertexAttrib4usv*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib4usv".} -proc glVertexAttribPointer*(index: TGLuint, size: TGLint, thetype: TGLenum, - normalized: TGLboolean, stride: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glVertexAttribPointer".} -const - GL_CONSTANT_COLOR* = 0x00008001 - GL_ONE_MINUS_CONSTANT_COLOR* = 0x00008002 - GL_CONSTANT_ALPHA* = 0x00008003 - GL_ONE_MINUS_CONSTANT_ALPHA* = 0x00008004 - constGL_BLEND_COLOR* = 0x00008005 - GL_FUNC_ADD* = 0x00008006 - GL_MIN* = 0x00008007 - GL_MAX* = 0x00008008 - constGL_BLEND_EQUATION* = 0x00008009 - GL_FUNC_SUBTRACT* = 0x0000800A - GL_FUNC_REVERSE_SUBTRACT* = 0x0000800B - GL_CONVOLUTION_1D* = 0x00008010 - GL_CONVOLUTION_2D* = 0x00008011 - GL_SEPARABLE_2D* = 0x00008012 - GL_CONVOLUTION_BORDER_MODE* = 0x00008013 - GL_CONVOLUTION_FILTER_SCALE* = 0x00008014 - GL_CONVOLUTION_FILTER_BIAS* = 0x00008015 - GL_REDUCE* = 0x00008016 - GL_CONVOLUTION_FORMAT* = 0x00008017 - GL_CONVOLUTION_WIDTH* = 0x00008018 - GL_CONVOLUTION_HEIGHT* = 0x00008019 - GL_MAX_CONVOLUTION_WIDTH* = 0x0000801A - GL_MAX_CONVOLUTION_HEIGHT* = 0x0000801B - GL_POST_CONVOLUTION_RED_SCALE* = 0x0000801C - GL_POST_CONVOLUTION_GREEN_SCALE* = 0x0000801D - GL_POST_CONVOLUTION_BLUE_SCALE* = 0x0000801E - GL_POST_CONVOLUTION_ALPHA_SCALE* = 0x0000801F - GL_POST_CONVOLUTION_RED_BIAS* = 0x00008020 - GL_POST_CONVOLUTION_GREEN_BIAS* = 0x00008021 - GL_POST_CONVOLUTION_BLUE_BIAS* = 0x00008022 - GL_POST_CONVOLUTION_ALPHA_BIAS* = 0x00008023 - constGL_HISTOGRAM* = 0x00008024 - GL_PROXY_HISTOGRAM* = 0x00008025 - GL_HISTOGRAM_WIDTH* = 0x00008026 - GL_HISTOGRAM_FORMAT* = 0x00008027 - GL_HISTOGRAM_RED_SIZE* = 0x00008028 - GL_HISTOGRAM_GREEN_SIZE* = 0x00008029 - GL_HISTOGRAM_BLUE_SIZE* = 0x0000802A - GL_HISTOGRAM_ALPHA_SIZE* = 0x0000802B - GL_HISTOGRAM_LUMINANCE_SIZE* = 0x0000802C - GL_HISTOGRAM_SINK* = 0x0000802D - constGL_MINMAX* = 0x0000802E - GL_MINMAX_FORMAT* = 0x0000802F - GL_MINMAX_SINK* = 0x00008030 - GL_TABLE_TOO_LARGE* = 0x00008031 - GL_COLOR_MATRIX* = 0x000080B1 - GL_COLOR_MATRIX_STACK_DEPTH* = 0x000080B2 - GL_MAX_COLOR_MATRIX_STACK_DEPTH* = 0x000080B3 - GL_POST_COLOR_MATRIX_RED_SCALE* = 0x000080B4 - GL_POST_COLOR_MATRIX_GREEN_SCALE* = 0x000080B5 - GL_POST_COLOR_MATRIX_BLUE_SCALE* = 0x000080B6 - GL_POST_COLOR_MATRIX_ALPHA_SCALE* = 0x000080B7 - GL_POST_COLOR_MATRIX_RED_BIAS* = 0x000080B8 - GL_POST_COLOR_MATRIX_GREEN_BIAS* = 0x000080B9 - GL_POST_COLOR_MATRIX_BLUE_BIAS* = 0x000080BA - GL_POST_COLOR_MATIX_ALPHA_BIAS* = 0x000080BB - constGL_COLOR_TABLE* = 0x000080D0 - GL_POST_CONVOLUTION_COLOR_TABLE* = 0x000080D1 - GL_POST_COLOR_MATRIX_COLOR_TABLE* = 0x000080D2 - GL_PROXY_COLOR_TABLE* = 0x000080D3 - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE* = 0x000080D4 - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE* = 0x000080D5 - GL_COLOR_TABLE_SCALE* = 0x000080D6 - GL_COLOR_TABLE_BIAS* = 0x000080D7 - GL_COLOR_TABLE_FORMAT* = 0x000080D8 - GL_COLOR_TABLE_WIDTH* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE* = 0x000080DF - GL_IGNORE_BORDER* = 0x00008150 - GL_CONSTANT_BORDER* = 0x00008151 - GL_WRAP_BORDER* = 0x00008152 - GL_REPLICATE_BORDER* = 0x00008153 - GL_CONVOLUTION_BORDER_COLOR* = 0x00008154 - -proc glActiveTexture*(texture: TGLenum){.dynlib: dllname, - importc: "glActiveTexture".} -proc glClientActiveTexture*(texture: TGLenum){.dynlib: dllname, - importc: "glClientActiveTexture".} -proc glMultiTexCoord1d*(target: TGLenum, s: TGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord1d".} -proc glMultiTexCoord1dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord1dv".} -proc glMultiTexCoord1f*(target: TGLenum, s: TGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord1f".} -proc glMultiTexCoord1fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord1fv".} -proc glMultiTexCoord1i*(target: TGLenum, s: TGLint){.dynlib: dllname, - importc: "glMultiTexCoord1i".} -proc glMultiTexCoord1iv*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord1iv".} -proc glMultiTexCoord1s*(target: TGLenum, s: TGLshort){.dynlib: dllname, - importc: "glMultiTexCoord1s".} -proc glMultiTexCoord1sv*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord1sv".} -proc glMultiTexCoord2d*(target: TGLenum, s: TGLdouble, t: TGLdouble){. - dynlib: dllname, importc: "glMultiTexCoord2d".} -proc glMultiTexCoord2dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord2dv".} -proc glMultiTexCoord2f*(target: TGLenum, s: TGLfloat, t: TGLfloat){. - dynlib: dllname, importc: "glMultiTexCoord2f".} -proc glMultiTexCoord2fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord2fv".} -proc glMultiTexCoord2i*(target: TGLenum, s: TGLint, t: TGLint){.dynlib: dllname, - importc: "glMultiTexCoord2i".} -proc glMultiTexCoord2iv*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord2iv".} -proc glMultiTexCoord2s*(target: TGLenum, s: TGLshort, t: TGLshort){. - dynlib: dllname, importc: "glMultiTexCoord2s".} -proc glMultiTexCoord2sv*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord2sv".} -proc glMultiTexCoord3d*(target: TGLenum, s: TGLdouble, t: TGLdouble, - r: TGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord3d".} -proc glMultiTexCoord3dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord3dv".} -proc glMultiTexCoord3f*(target: TGLenum, s: TGLfloat, t: TGLfloat, r: TGLfloat){. - dynlib: dllname, importc: "glMultiTexCoord3f".} -proc glMultiTexCoord3fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord3fv".} -proc glMultiTexCoord3i*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint){. - dynlib: dllname, importc: "glMultiTexCoord3i".} -proc glMultiTexCoord3iv*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord3iv".} -proc glMultiTexCoord3s*(target: TGLenum, s: TGLshort, t: TGLshort, r: TGLshort){. - dynlib: dllname, importc: "glMultiTexCoord3s".} -proc glMultiTexCoord3sv*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord3sv".} -proc glMultiTexCoord4d*(target: TGLenum, s: TGLdouble, t: TGLdouble, - r: TGLdouble, q: TGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord4d".} -proc glMultiTexCoord4dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, - importc: "glMultiTexCoord4dv".} -proc glMultiTexCoord4f*(target: TGLenum, s: TGLfloat, t: TGLfloat, r: TGLfloat, - q: TGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord4f".} -proc glMultiTexCoord4fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname, - importc: "glMultiTexCoord4fv".} -proc glMultiTexCoord4i*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint, - q: TGLint){.dynlib: dllname, - importc: "glMultiTexCoord4i".} -proc glMultiTexCoord4iv*(target: TGLenum, v: PGLint){.dynlib: dllname, - importc: "glMultiTexCoord4iv".} -proc glMultiTexCoord4s*(target: TGLenum, s: TGLshort, t: TGLshort, r: TGLshort, - q: TGLshort){.dynlib: dllname, - importc: "glMultiTexCoord4s".} -proc glMultiTexCoord4sv*(target: TGLenum, v: PGLshort){.dynlib: dllname, - importc: "glMultiTexCoord4sv".} -proc glLoadTransposeMatrixf*(m: PGLfloat){.dynlib: dllname, - importc: "glLoadTransposeMatrixf".} -proc glLoadTransposeMatrixd*(m: PGLdouble){.dynlib: dllname, - importc: "glLoadTransposeMatrixd".} -proc glMultTransposeMatrixf*(m: PGLfloat){.dynlib: dllname, - importc: "glMultTransposeMatrixf".} -proc glMultTransposeMatrixd*(m: PGLdouble){.dynlib: dllname, - importc: "glMultTransposeMatrixd".} -proc glSampleCoverage*(value: TGLclampf, invert: TGLboolean){.dynlib: dllname, - importc: "glSampleCoverage".} -proc glCompressedTexImage3D*(target: TGLenum, level: TGLint, - internalformat: TGLenum, width: TGLsizei, - height: TGLsizei, depth: TGLsizei, border: TGLint, - imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexImage3D".} -proc glCompressedTexImage2D*(target: TGLenum, level: TGLint, - internalformat: TGLenum, width: TGLsizei, - height: TGLsizei, border: TGLint, - imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexImage2D".} -proc glCompressedTexImage1D*(target: TGLenum, level: TGLint, - internalformat: TGLenum, width: TGLsizei, - border: TGLint, imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexImage1D".} -proc glCompressedTexSubImage3D*(target: TGLenum, level: TGLint, xoffset: TGLint, - yoffset: TGLint, zoffset: TGLint, - width: TGLsizei, height: TGLsizei, - depth: TGLsizei, format: TGLenum, - imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexSubImage3D".} -proc glCompressedTexSubImage2D*(target: TGLenum, level: TGLint, xoffset: TGLint, - yoffset: TGLint, width: TGLsizei, - height: TGLsizei, format: TGLenum, - imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexSubImage2D".} -proc glCompressedTexSubImage1D*(target: TGLenum, level: TGLint, xoffset: TGLint, - width: TGLsizei, format: TGLenum, - imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexSubImage1D".} -proc glGetCompressedTexImage*(target: TGLenum, level: TGLint, img: PGLvoid){. - dynlib: dllname, importc: "glGetCompressedTexImage".} - #***** GL_version_1_3 *****// -const - GL_TEXTURE0* = 0x000084C0 - GL_TEXTURE1* = 0x000084C1 - GL_TEXTURE2* = 0x000084C2 - GL_TEXTURE3* = 0x000084C3 - GL_TEXTURE4* = 0x000084C4 - GL_TEXTURE5* = 0x000084C5 - GL_TEXTURE6* = 0x000084C6 - GL_TEXTURE7* = 0x000084C7 - GL_TEXTURE8* = 0x000084C8 - GL_TEXTURE9* = 0x000084C9 - GL_TEXTURE10* = 0x000084CA - GL_TEXTURE11* = 0x000084CB - GL_TEXTURE12* = 0x000084CC - GL_TEXTURE13* = 0x000084CD - GL_TEXTURE14* = 0x000084CE - GL_TEXTURE15* = 0x000084CF - GL_TEXTURE16* = 0x000084D0 - GL_TEXTURE17* = 0x000084D1 - GL_TEXTURE18* = 0x000084D2 - GL_TEXTURE19* = 0x000084D3 - GL_TEXTURE20* = 0x000084D4 - GL_TEXTURE21* = 0x000084D5 - GL_TEXTURE22* = 0x000084D6 - GL_TEXTURE23* = 0x000084D7 - GL_TEXTURE24* = 0x000084D8 - GL_TEXTURE25* = 0x000084D9 - GL_TEXTURE26* = 0x000084DA - GL_TEXTURE27* = 0x000084DB - GL_TEXTURE28* = 0x000084DC - GL_TEXTURE29* = 0x000084DD - GL_TEXTURE30* = 0x000084DE - GL_TEXTURE31* = 0x000084DF - constGL_ACTIVE_TEXTURE* = 0x000084E0 - constGL_CLIENT_ACTIVE_TEXTURE* = 0x000084E1 - GL_MAX_TEXTURE_UNITS* = 0x000084E2 - GL_TRANSPOSE_MODELVIEW_MATRIX* = 0x000084E3 - GL_TRANSPOSE_PROJECTION_MATRIX* = 0x000084E4 - GL_TRANSPOSE_TEXTURE_MATRIX* = 0x000084E5 - GL_TRANSPOSE_COLOR_MATRIX* = 0x000084E6 - GL_MULTISAMPLE* = 0x0000809D - GL_SAMPLE_ALPHA_TO_COVERAGE* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE* = 0x0000809F - constGL_SAMPLE_COVERAGE* = 0x000080A0 - GL_SAMPLE_BUFFERS* = 0x000080A8 - GL_SAMPLES* = 0x000080A9 - GL_SAMPLE_COVERAGE_VALUE* = 0x000080AA - GL_SAMPLE_COVERAGE_INVERT* = 0x000080AB - GL_MULTISAMPLE_BIT* = 0x20000000 - GL_NORMAL_MAP* = 0x00008511 - GL_REFLECTION_MAP* = 0x00008512 - GL_TEXTURE_CUBE_MAP* = 0x00008513 - GL_TEXTURE_BINDING_CUBE_MAP* = 0x00008514 - GL_TEXTURE_CUBE_MAP_POSITIVE_X* = 0x00008515 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X* = 0x00008516 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y* = 0x00008517 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y* = 0x00008518 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z* = 0x00008519 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z* = 0x0000851A - GL_PROXY_TEXTURE_CUBE_MAP* = 0x0000851B - GL_MAX_CUBE_MAP_TEXTURE_SIZE* = 0x0000851C - GL_COMPRESSED_ALPHA* = 0x000084E9 - GL_COMPRESSED_LUMINANCE* = 0x000084EA - GL_COMPRESSED_LUMINANCE_ALPHA* = 0x000084EB - GL_COMPRESSED_INTENSITY* = 0x000084EC - GL_COMPRESSED_RGB* = 0x000084ED - GL_COMPRESSED_RGBA* = 0x000084EE - GL_TEXTURE_COMPRESSION_HINT* = 0x000084EF - GL_TEXTURE_COMPRESSED_IMAGE_SIZE* = 0x000086A0 - GL_TEXTURE_COMPRESSED* = 0x000086A1 - GL_NUM_COMPRESSED_TEXTURE_FORMATS* = 0x000086A2 - GL_COMPRESSED_TEXTURE_FORMATS* = 0x000086A3 - GL_CLAMP_TO_BORDER* = 0x0000812D - GL_CLAMP_TO_BORDER_SGIS* = 0x0000812D - GL_COMBINE* = 0x00008570 - GL_COMBINE_RGB* = 0x00008571 - GL_COMBINE_ALPHA* = 0x00008572 - GL_SOURCE0_RGB* = 0x00008580 - GL_SOURCE1_RGB* = 0x00008581 - GL_SOURCE2_RGB* = 0x00008582 - GL_SOURCE0_ALPHA* = 0x00008588 - GL_SOURCE1_ALPHA* = 0x00008589 - GL_SOURCE2_ALPHA* = 0x0000858A - GL_OPERAND0_RGB* = 0x00008590 - GL_OPERAND1_RGB* = 0x00008591 - GL_OPERAND2_RGB* = 0x00008592 - GL_OPERAND0_ALPHA* = 0x00008598 - GL_OPERAND1_ALPHA* = 0x00008599 - GL_OPERAND2_ALPHA* = 0x0000859A - GL_RGB_SCALE* = 0x00008573 - GL_ADD_SIGNED* = 0x00008574 - GL_INTERPOLATE* = 0x00008575 - GL_SUBTRACT* = 0x000084E7 - GL_CONSTANT* = 0x00008576 - GL_PRIMARY_COLOR* = 0x00008577 - GL_PREVIOUS* = 0x00008578 - GL_DOT3_RGB* = 0x000086AE - GL_DOT3_RGBA* = 0x000086AF - -const - GL_TEXTURE0_ARB* = 0x000084C0 - GL_TEXTURE1_ARB* = 0x000084C1 - GL_TEXTURE2_ARB* = 0x000084C2 - GL_TEXTURE3_ARB* = 0x000084C3 - GL_TEXTURE4_ARB* = 0x000084C4 - GL_TEXTURE5_ARB* = 0x000084C5 - GL_TEXTURE6_ARB* = 0x000084C6 - GL_TEXTURE7_ARB* = 0x000084C7 - GL_TEXTURE8_ARB* = 0x000084C8 - GL_TEXTURE9_ARB* = 0x000084C9 - GL_TEXTURE10_ARB* = 0x000084CA - GL_TEXTURE11_ARB* = 0x000084CB - GL_TEXTURE12_ARB* = 0x000084CC - GL_TEXTURE13_ARB* = 0x000084CD - GL_TEXTURE14_ARB* = 0x000084CE - GL_TEXTURE15_ARB* = 0x000084CF - GL_TEXTURE16_ARB* = 0x000084D0 - GL_TEXTURE17_ARB* = 0x000084D1 - GL_TEXTURE18_ARB* = 0x000084D2 - GL_TEXTURE19_ARB* = 0x000084D3 - GL_TEXTURE20_ARB* = 0x000084D4 - GL_TEXTURE21_ARB* = 0x000084D5 - GL_TEXTURE22_ARB* = 0x000084D6 - GL_TEXTURE23_ARB* = 0x000084D7 - GL_TEXTURE24_ARB* = 0x000084D8 - GL_TEXTURE25_ARB* = 0x000084D9 - GL_TEXTURE26_ARB* = 0x000084DA - GL_TEXTURE27_ARB* = 0x000084DB - GL_TEXTURE28_ARB* = 0x000084DC - GL_TEXTURE29_ARB* = 0x000084DD - GL_TEXTURE30_ARB* = 0x000084DE - GL_TEXTURE31_ARB* = 0x000084DF - constGL_ACTIVE_TEXTURE_ARB* = 0x000084E0 - constGL_CLIENT_ACTIVE_TEXTURE_ARB* = 0x000084E1 - GL_MAX_TEXTURE_UNITS_ARB* = 0x000084E2 - #***** GL_ARB_transpose_matrix *****// - -const - GL_TRANSPOSE_MODELVIEW_MATRIX_ARB* = 0x000084E3 - GL_TRANSPOSE_PROJECTION_MATRIX_ARB* = 0x000084E4 - GL_TRANSPOSE_TEXTURE_MATRIX_ARB* = 0x000084E5 - GL_TRANSPOSE_COLOR_MATRIX_ARB* = 0x000084E6 - -proc glLoadTransposeMatrixfARB*(m: PGLfloat){.dynlib: dllname, - importc: "glLoadTransposeMatrixfARB".} -proc glLoadTransposeMatrixdARB*(m: PGLdouble){.dynlib: dllname, - importc: "glLoadTransposeMatrixdARB".} -proc glMultTransposeMatrixfARB*(m: PGLfloat){.dynlib: dllname, - importc: "glMultTransposeMatrixfARB".} -proc glMultTransposeMatrixdARB*(m: PGLdouble){.dynlib: dllname, - importc: "glMultTransposeMatrixdARB".} -const - WGL_SAMPLE_BUFFERS_ARB* = 0x00002041 - WGL_SAMPLES_ARB* = 0x00002042 - GL_MULTISAMPLE_ARB* = 0x0000809D - GL_SAMPLE_ALPHA_TO_COVERAGE_ARB* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE_ARB* = 0x0000809F - constGL_SAMPLE_COVERAGE_ARB* = 0x000080A0 - GL_MULTISAMPLE_BIT_ARB* = 0x20000000 - GL_SAMPLE_BUFFERS_ARB* = 0x000080A8 - GL_SAMPLES_ARB* = 0x000080A9 - GL_SAMPLE_COVERAGE_VALUE_ARB* = 0x000080AA - GL_SAMPLE_COVERAGE_INVERT_ARB* = 0x000080AB - -const - GL_NORMAL_MAP_ARB* = 0x00008511 - GL_REFLECTION_MAP_ARB* = 0x00008512 - GL_TEXTURE_CUBE_MAP_ARB* = 0x00008513 - GL_TEXTURE_BINDING_CUBE_MAP_ARB* = 0x00008514 - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB* = 0x00008515 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB* = 0x00008516 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB* = 0x00008517 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB* = 0x00008518 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB* = 0x00008519 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB* = 0x0000851A - GL_PROXY_TEXTURE_CUBE_MAP_ARB* = 0x0000851B - GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB* = 0x0000851C - -const - GL_DEPTH_COMPONENT16_ARB* = 0x000081A5 - GL_DEPTH_COMPONENT24_ARB* = 0x000081A6 - GL_DEPTH_COMPONENT32_ARB* = 0x000081A7 - GL_TEXTURE_DEPTH_SIZE_ARB* = 0x0000884A - GL_DEPTH_TEXTURE_MODE_ARB* = 0x0000884B - #***** GL_ARB_point_parameters *****// - -const - GL_POINT_SIZE_MIN_ARB* = 0x00008126 - GL_POINT_SIZE_MAX_ARB* = 0x00008127 - GL_POINT_FADE_THRESHOLD_SIZE_ARB* = 0x00008128 - GL_POINT_DISTANCE_ATTENUATION_ARB* = 0x00008129 - -proc glPointParameterfARB*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glPointParameterfARB".} -proc glPointParameterfvARB*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glPointParameterfvARB".} -const - GL_TEXTURE_COMPARE_MODE_ARB* = 0x0000884C - GL_TEXTURE_COMPARE_FUNC_ARB* = 0x0000884D - GL_COMPARE_R_TO_TEXTURE_ARB* = 0x0000884E - -const - GL_TEXTURE_COMPARE_FAIL_VALUE_ARB* = 0x000080BF - GL_CLAMP_TO_BORDER_ARB* = 0x0000812D - -const - GL_COMPRESSED_ALPHA_ARB* = 0x000084E9 - GL_COMPRESSED_LUMINANCE_ARB* = 0x000084EA - GL_COMPRESSED_LUMINANCE_ALPHA_ARB* = 0x000084EB - GL_COMPRESSED_INTENSITY_ARB* = 0x000084EC - GL_COMPRESSED_RGB_ARB* = 0x000084ED - GL_COMPRESSED_RGBA_ARB* = 0x000084EE - GL_TEXTURE_COMPRESSION_HINT_ARB* = 0x000084EF - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB* = 0x000086A0 - GL_TEXTURE_COMPRESSED_ARB* = 0x000086A1 - GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB* = 0x000086A2 - GL_COMPRESSED_TEXTURE_FORMATS_ARB* = 0x000086A3 - -proc glCompressedTexImage3DARB*(target: TGLenum, level: TGLint, - internalformat: TGLenum, width: TGLsizei, - height: TGLsizei, depth: TGLsizei, - border: TGLint, imageSize: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glCompressedTexImage3DARB".} -proc glCompressedTexImage2DARB*(target: TGLenum, level: TGLint, - internalformat: TGLenum, width: TGLsizei, - height: TGLsizei, border: TGLint, - imageSize: TGLsizei, data: PGLvoid){. - dynlib: dllname, importc: "glCompressedTexImage2DARB".} -proc glCompressedTexImage1DARB*(target: TGLenum, level: TGLint, - internalformat: TGLenum, width: TGLsizei, - border: TGLint, imageSize: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glCompressedTexImage1DARB".} -proc glCompressedTexSubImage3DARB*(target: TGLenum, level: TGLint, - xoffset: TGLint, yoffset: TGLint, - zoffset: TGLint, width: TGLsizei, - height: TGLsizei, depth: TGLsizei, - format: TGLenum, imageSize: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glCompressedTexSubImage3DARB".} -proc glCompressedTexSubImage2DARB*(target: TGLenum, level: TGLint, - xoffset: TGLint, yoffset: TGLint, - width: TGLsizei, height: TGLsizei, - format: TGLenum, imageSize: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glCompressedTexSubImage2DARB".} -proc glCompressedTexSubImage1DARB*(target: TGLenum, level: TGLint, - xoffset: TGLint, width: TGLsizei, - format: TGLenum, imageSize: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glCompressedTexSubImage1DARB".} -proc glGetCompressedTexImageARB*(target: TGLenum, lod: TGLint, img: PGLvoid){. - dynlib: dllname, importc: "glGetCompressedTexImageARB".} - #***** GL_ARB_texture_env_combine *****// -const - GL_COMBINE_ARB* = 0x00008570 - GL_COMBINE_RGB_ARB* = 0x00008571 - GL_COMBINE_ALPHA_ARB* = 0x00008572 - GL_SOURCE0_RGB_ARB* = 0x00008580 - GL_SOURCE1_RGB_ARB* = 0x00008581 - GL_SOURCE2_RGB_ARB* = 0x00008582 - GL_SOURCE0_ALPHA_ARB* = 0x00008588 - GL_SOURCE1_ALPHA_ARB* = 0x00008589 - GL_SOURCE2_ALPHA_ARB* = 0x0000858A - GL_OPERAND0_RGB_ARB* = 0x00008590 - GL_OPERAND1_RGB_ARB* = 0x00008591 - GL_OPERAND2_RGB_ARB* = 0x00008592 - GL_OPERAND0_ALPHA_ARB* = 0x00008598 - GL_OPERAND1_ALPHA_ARB* = 0x00008599 - GL_OPERAND2_ALPHA_ARB* = 0x0000859A - GL_RGB_SCALE_ARB* = 0x00008573 - GL_ADD_SIGNED_ARB* = 0x00008574 - GL_INTERPOLATE_ARB* = 0x00008575 - GL_SUBTRACT_ARB* = 0x000084E7 - GL_CONSTANT_ARB* = 0x00008576 - GL_PRIMARY_COLOR_ARB* = 0x00008577 - GL_PREVIOUS_ARB* = 0x00008578 - #***** GL_ARB_texture_env_crossbar *****// - #***** GL_ARB_texture_env_dot3 *****// - -const - GL_DOT3_RGB_ARB* = 0x000086AE - GL_DOT3_RGBA_ARB* = 0x000086AF - #***** GL_ARB_texture_mirrored_repeat *****// - -const - GL_MIRRORED_REPEAT_ARB* = 0x00008370 - #***** GL_ARB_vertex_blend *****// - -const - GL_MAX_VERTEX_UNITS_ARB* = 0x000086A4 - GL_ACTIVE_VERTEX_UNITS_ARB* = 0x000086A5 - GL_WEIGHT_SUM_UNITY_ARB* = 0x000086A6 - constGL_VERTEX_BLEND_ARB* = 0x000086A7 - GL_MODELVIEW0_ARB* = 0x00001700 - GL_MODELVIEW1_ARB* = 0x0000850A - GL_MODELVIEW2_ARB* = 0x00008722 - GL_MODELVIEW3_ARB* = 0x00008723 - GL_MODELVIEW4_ARB* = 0x00008724 - GL_MODELVIEW5_ARB* = 0x00008725 - GL_MODELVIEW6_ARB* = 0x00008726 - GL_MODELVIEW7_ARB* = 0x00008727 - GL_MODELVIEW8_ARB* = 0x00008728 - GL_MODELVIEW9_ARB* = 0x00008729 - GL_MODELVIEW10_ARB* = 0x0000872A - GL_MODELVIEW11_ARB* = 0x0000872B - GL_MODELVIEW12_ARB* = 0x0000872C - GL_MODELVIEW13_ARB* = 0x0000872D - GL_MODELVIEW14_ARB* = 0x0000872E - GL_MODELVIEW15_ARB* = 0x0000872F - GL_MODELVIEW16_ARB* = 0x00008730 - GL_MODELVIEW17_ARB* = 0x00008731 - GL_MODELVIEW18_ARB* = 0x00008732 - GL_MODELVIEW19_ARB* = 0x00008733 - GL_MODELVIEW20_ARB* = 0x00008734 - GL_MODELVIEW21_ARB* = 0x00008735 - GL_MODELVIEW22_ARB* = 0x00008736 - GL_MODELVIEW23_ARB* = 0x00008737 - GL_MODELVIEW24_ARB* = 0x00008738 - GL_MODELVIEW25_ARB* = 0x00008739 - GL_MODELVIEW26_ARB* = 0x0000873A - GL_MODELVIEW27_ARB* = 0x0000873B - GL_MODELVIEW28_ARB* = 0x0000873C - GL_MODELVIEW29_ARB* = 0x0000873D - GL_MODELVIEW30_ARB* = 0x0000873E - GL_MODELVIEW31_ARB* = 0x0000873F - GL_CURRENT_WEIGHT_ARB* = 0x000086A8 - GL_WEIGHT_ARRAY_TYPE_ARB* = 0x000086A9 - GL_WEIGHT_ARRAY_STRIDE_ARB* = 0x000086AA - GL_WEIGHT_ARRAY_SIZE_ARB* = 0x000086AB - GL_WEIGHT_ARRAY_POINTER_ARB* = 0x000086AC - GL_WEIGHT_ARRAY_ARB* = 0x000086AD - -const - GL_VERTEX_PROGRAM_ARB* = 0x00008620 - GL_VERTEX_PROGRAM_POINT_SIZE_ARB* = 0x00008642 - GL_VERTEX_PROGRAM_TWO_SIDE_ARB* = 0x00008643 - GL_COLOR_SUM_ARB* = 0x00008458 - GL_PROGRAM_FORMAT_ASCII_ARB* = 0x00008875 - GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB* = 0x00008622 - GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB* = 0x00008623 - GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB* = 0x00008624 - GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB* = 0x00008625 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB* = 0x0000886A - GL_CURRENT_VERTEX_ATTRIB_ARB* = 0x00008626 - GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB* = 0x00008645 - GL_PROGRAM_LENGTH_ARB* = 0x00008627 - GL_PROGRAM_FORMAT_ARB* = 0x00008876 - GL_PROGRAM_BINDING_ARB* = 0x00008677 - GL_PROGRAM_INSTRUCTIONS_ARB* = 0x000088A0 - GL_MAX_PROGRAM_INSTRUCTIONS_ARB* = 0x000088A1 - GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB* = 0x000088A2 - GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB* = 0x000088A3 - GL_PROGRAM_TEMPORARIES_ARB* = 0x000088A4 - GL_MAX_PROGRAM_TEMPORARIES_ARB* = 0x000088A5 - GL_PROGRAM_NATIVE_TEMPORARIES_ARB* = 0x000088A6 - GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB* = 0x000088A7 - GL_PROGRAM_PARAMETERS_ARB* = 0x000088A8 - GL_MAX_PROGRAM_PARAMETERS_ARB* = 0x000088A9 - GL_PROGRAM_NATIVE_PARAMETERS_ARB* = 0x000088AA - GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB* = 0x000088AB - GL_PROGRAM_ATTRIBS_ARB* = 0x000088AC - GL_MAX_PROGRAM_ATTRIBS_ARB* = 0x000088AD - GL_PROGRAM_NATIVE_ATTRIBS_ARB* = 0x000088AE - GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB* = 0x000088AF - GL_PROGRAM_ADDRESS_REGISTERS_ARB* = 0x000088B0 - GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB* = 0x000088B1 - GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB* = 0x000088B2 - GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB* = 0x000088B3 - GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB* = 0x000088B4 - GL_MAX_PROGRAM_ENV_PARAMETERS_ARB* = 0x000088B5 - GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB* = 0x000088B6 - constGL_PROGRAM_STRING_ARB* = 0x00008628 - GL_PROGRAM_ERROR_POSITION_ARB* = 0x0000864B - GL_CURRENT_MATRIX_ARB* = 0x00008641 - GL_TRANSPOSE_CURRENT_MATRIX_ARB* = 0x000088B7 - GL_CURRENT_MATRIX_STACK_DEPTH_ARB* = 0x00008640 - GL_MAX_VERTEX_ATTRIBS_ARB* = 0x00008869 - GL_MAX_PROGRAM_MATRICES_ARB* = 0x0000862F - GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB* = 0x0000862E - GL_PROGRAM_ERROR_STRING_ARB* = 0x00008874 - GL_MATRIX0_ARB* = 0x000088C0 - GL_MATRIX1_ARB* = 0x000088C1 - GL_MATRIX2_ARB* = 0x000088C2 - GL_MATRIX3_ARB* = 0x000088C3 - GL_MATRIX4_ARB* = 0x000088C4 - GL_MATRIX5_ARB* = 0x000088C5 - GL_MATRIX6_ARB* = 0x000088C6 - GL_MATRIX7_ARB* = 0x000088C7 - GL_MATRIX8_ARB* = 0x000088C8 - GL_MATRIX9_ARB* = 0x000088C9 - GL_MATRIX10_ARB* = 0x000088CA - GL_MATRIX11_ARB* = 0x000088CB - GL_MATRIX12_ARB* = 0x000088CC - GL_MATRIX13_ARB* = 0x000088CD - GL_MATRIX14_ARB* = 0x000088CE - GL_MATRIX15_ARB* = 0x000088CF - GL_MATRIX16_ARB* = 0x000088D0 - GL_MATRIX17_ARB* = 0x000088D1 - GL_MATRIX18_ARB* = 0x000088D2 - GL_MATRIX19_ARB* = 0x000088D3 - GL_MATRIX20_ARB* = 0x000088D4 - GL_MATRIX21_ARB* = 0x000088D5 - GL_MATRIX22_ARB* = 0x000088D6 - GL_MATRIX23_ARB* = 0x000088D7 - GL_MATRIX24_ARB* = 0x000088D8 - GL_MATRIX25_ARB* = 0x000088D9 - GL_MATRIX26_ARB* = 0x000088DA - GL_MATRIX27_ARB* = 0x000088DB - GL_MATRIX28_ARB* = 0x000088DC - GL_MATRIX29_ARB* = 0x000088DD - GL_MATRIX30_ARB* = 0x000088DE - GL_MATRIX31_ARB* = 0x000088DF - -const - GL_422_EXT* = 0x000080CC - GL_422_REV_EXT* = 0x000080CD - GL_422_AVERAGE_EXT* = 0x000080CE - GL_422_REV_AVERAGE_EXT* = 0x000080CF - #***** GL_EXT_abgr *****// - -const - GL_ABGR_EXT* = 0x00008000 - #***** GL_EXT_bgra *****// - -const - GL_BGR_EXT* = 0x000080E0 - GL_BGRA_EXT* = 0x000080E1 - #***** GL_EXT_blend_color *****// - -const - GL_CONSTANT_COLOR_EXT* = 0x00008001 - GL_ONE_MINUS_CONSTANT_COLOR_EXT* = 0x00008002 - GL_CONSTANT_ALPHA_EXT* = 0x00008003 - GL_ONE_MINUS_CONSTANT_ALPHA_EXT* = 0x00008004 - constGL_BLEND_COLOR_EXT* = 0x00008005 - -proc glBlendColorEXT*(red: TGLclampf, green: TGLclampf, blue: TGLclampf, - alpha: TGLclampf){.dynlib: dllname, - importc: "glBlendColorEXT".} - #***** GL_EXT_blend_func_separate *****// -const - GL_BLEND_DST_RGB_EXT* = 0x000080C8 - GL_BLEND_SRC_RGB_EXT* = 0x000080C9 - GL_BLEND_DST_ALPHA_EXT* = 0x000080CA - GL_BLEND_SRC_ALPHA_EXT* = 0x000080CB - -proc glBlendFuncSeparateEXT*(sfactorRGB: TGLenum, dfactorRGB: TGLenum, - sfactorAlpha: TGLenum, dfactorAlpha: TGLenum){. - dynlib: dllname, importc: "glBlendFuncSeparateEXT".} - #***** GL_EXT_blend_logic_op *****// - #***** GL_EXT_blend_minmax *****// -const - GL_FUNC_ADD_EXT* = 0x00008006 - GL_MIN_EXT* = 0x00008007 - GL_MAX_EXT* = 0x00008008 - constGL_BLEND_EQUATION_EXT* = 0x00008009 - -proc glBlendEquationEXT*(mode: TGLenum){.dynlib: dllname, - importc: "glBlendEquationEXT".} - #***** GL_EXT_blend_subtract *****// -const - GL_FUNC_SUBTRACT_EXT* = 0x0000800A - GL_FUNC_REVERSE_SUBTRACT_EXT* = 0x0000800B - #***** GL_EXT_clip_volume_hint *****// - -const - GL_CLIP_VOLUME_CLIPPING_HINT_EXT* = 0x000080F0 - #***** GL_EXT_color_subtable *****// - -proc glColorSubTableEXT*(target: TGLenum, start: TGLsizei, count: TGLsizei, - format: TGLenum, thetype: TGLenum, data: PGLvoid){. - dynlib: dllname, importc: "glColorSubTableEXT".} -proc glCopyColorSubTableEXT*(target: TGLenum, start: TGLsizei, x: TGLint, - y: TGLint, width: TGLsizei){.dynlib: dllname, - importc: "glCopyColorSubTableEXT".} - #***** GL_EXT_compiled_vertex_array *****// -const - GL_ARRAY_ELEMENT_LOCK_FIRST_EXT* = 0x000081A8 - GL_ARRAY_ELEMENT_LOCK_COUNT_EXT* = 0x000081A9 - -proc glLockArraysEXT*(first: TGLint, count: TGLsizei){.dynlib: dllname, - importc: "glLockArraysEXT".} -proc glUnlockArraysEXT*(){.dynlib: dllname, importc: "glUnlockArraysEXT".} - #***** GL_EXT_convolution *****// -const - GL_CONVOLUTION_1D_EXT* = 0x00008010 - GL_CONVOLUTION_2D_EXT* = 0x00008011 - GL_SEPARABLE_2D_EXT* = 0x00008012 - GL_CONVOLUTION_BORDER_MODE_EXT* = 0x00008013 - GL_CONVOLUTION_FILTER_SCALE_EXT* = 0x00008014 - GL_CONVOLUTION_FILTER_BIAS_EXT* = 0x00008015 - GL_REDUCE_EXT* = 0x00008016 - GL_CONVOLUTION_FORMAT_EXT* = 0x00008017 - GL_CONVOLUTION_WIDTH_EXT* = 0x00008018 - GL_CONVOLUTION_HEIGHT_EXT* = 0x00008019 - GL_MAX_CONVOLUTION_WIDTH_EXT* = 0x0000801A - GL_MAX_CONVOLUTION_HEIGHT_EXT* = 0x0000801B - GL_POST_CONVOLUTION_RED_SCALE_EXT* = 0x0000801C - GL_POST_CONVOLUTION_GREEN_SCALE_EXT* = 0x0000801D - GL_POST_CONVOLUTION_BLUE_SCALE_EXT* = 0x0000801E - GL_POST_CONVOLUTION_ALPHA_SCALE_EXT* = 0x0000801F - GL_POST_CONVOLUTION_RED_BIAS_EXT* = 0x00008020 - GL_POST_CONVOLUTION_GREEN_BIAS_EXT* = 0x00008021 - GL_POST_CONVOLUTION_BLUE_BIAS_EXT* = 0x00008022 - GL_POST_CONVOLUTION_ALPHA_BIAS_EXT* = 0x00008023 - -proc glConvolutionFilter1DEXT*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, format: TGLenum, - thetype: TGLenum, image: PGLvoid){. - dynlib: dllname, importc: "glConvolutionFilter1DEXT".} -proc glConvolutionFilter2DEXT*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, height: TGLsizei, - format: TGLenum, thetype: TGLenum, image: PGLvoid){. - dynlib: dllname, importc: "glConvolutionFilter2DEXT".} -proc glCopyConvolutionFilter1DEXT*(target: TGLenum, internalformat: TGLenum, - x: TGLint, y: TGLint, width: TGLsizei){. - dynlib: dllname, importc: "glCopyConvolutionFilter1DEXT".} -proc glCopyConvolutionFilter2DEXT*(target: TGLenum, internalformat: TGLenum, - x: TGLint, y: TGLint, width: TGLsizei, - height: TGLsizei){.dynlib: dllname, - importc: "glCopyConvolutionFilter2DEXT".} -proc glGetConvolutionFilterEXT*(target: TGLenum, format: TGLenum, - thetype: TGLenum, image: PGLvoid){. - dynlib: dllname, importc: "glGetConvolutionFilterEXT".} -proc glSeparableFilter2DEXT*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, height: TGLsizei, format: TGLenum, - thetype: TGLenum, row: PGLvoid, column: PGLvoid){. - dynlib: dllname, importc: "glSeparableFilter2DEXT".} -proc glGetSeparableFilterEXT*(target: TGLenum, format: TGLenum, - thetype: TGLenum, row: PGLvoid, column: PGLvoid, - span: PGLvoid){.dynlib: dllname, - importc: "glGetSeparableFilterEXT".} -proc glConvolutionParameteriEXT*(target: TGLenum, pname: TGLenum, param: TGLint){. - dynlib: dllname, importc: "glConvolutionParameteriEXT".} -proc glConvolutionParameterivEXT*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glConvolutionParameterivEXT".} -proc glConvolutionParameterfEXT*(target: TGLenum, pname: TGLenum, - param: TGLfloat){.dynlib: dllname, - importc: "glConvolutionParameterfEXT".} -proc glConvolutionParameterfvEXT*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glConvolutionParameterfvEXT".} -proc glGetConvolutionParameterivEXT*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetConvolutionParameterivEXT".} -proc glGetConvolutionParameterfvEXT*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetConvolutionParameterfvEXT".} - #***** GL_EXT_fog_coord *****// -const - GL_FOG_COORDINATE_SOURCE_EXT* = 0x00008450 - GL_FOG_COORDINATE_EXT* = 0x00008451 - GL_FRAGMENT_DEPTH_EXT* = 0x00008452 - GL_CURRENT_FOG_COORDINATE_EXT* = 0x00008453 - GL_FOG_COORDINATE_ARRAY_TYPE_EXT* = 0x00008454 - GL_FOG_COORDINATE_ARRAY_STRIDE_EXT* = 0x00008455 - GL_FOG_COORDINATE_ARRAY_POINTER_EXT* = 0x00008456 - GL_FOG_COORDINATE_ARRAY_EXT* = 0x00008457 - -proc glFogCoordfEXfloat*(coord: TGLfloat){.dynlib: dllname, - importc: "glFogCoordfEXfloat".} -proc glFogCoorddEXdouble*(coord: TGLdouble){.dynlib: dllname, - importc: "glFogCoorddEXdouble".} -proc glFogCoordfvEXfloat*(coord: TGLfloat){.dynlib: dllname, - importc: "glFogCoordfvEXfloat".} -proc glFogCoorddvEXdouble*(coord: TGLdouble){.dynlib: dllname, - importc: "glFogCoorddvEXdouble".} -proc glFogCoordPointerEXT*(thetype: TGLenum, stride: TGLsizei, pointer: PGLvoid){. - dynlib: dllname, importc: "glFogCoordPointerEXT".} - #***** GL_EXT_histogram *****// -const - constGL_HISTOGRAM_EXT* = 0x00008024 - GL_PROXY_HISTOGRAM_EXT* = 0x00008025 - GL_HISTOGRAM_WIDTH_EXT* = 0x00008026 - GL_HISTOGRAM_FORMAT_EXT* = 0x00008027 - GL_HISTOGRAM_RED_SIZE_EXT* = 0x00008028 - GL_HISTOGRAM_GREEN_SIZE_EXT* = 0x00008029 - GL_HISTOGRAM_BLUE_SIZE_EXT* = 0x0000802A - GL_HISTOGRAM_ALPHA_SIZE_EXT* = 0x0000802B - GL_HISTOGRAM_LUMINANCE_SIZE_EXT* = 0x0000802C - GL_HISTOGRAM_SINK_EXT* = 0x0000802D - constGL_MINMAX_EXT* = 0x0000802E - GL_MINMAX_FORMAT_EXT* = 0x0000802F - GL_MINMAX_SINK_EXT* = 0x00008030 - -proc glHistogramEXT*(target: TGLenum, width: TGLsizei, internalformat: TGLenum, - sink: TGLboolean){.dynlib: dllname, - importc: "glHistogramEXT".} -proc glResetHistogramEXT*(target: TGLenum){.dynlib: dllname, - importc: "glResetHistogramEXT".} -proc glGetHistogramEXT*(target: TGLenum, reset: TGLboolean, format: TGLenum, - thetype: TGLenum, values: PGLvoid){.dynlib: dllname, - importc: "glGetHistogramEXT".} -proc glGetHistogramParameterivEXT*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetHistogramParameterivEXT".} -proc glGetHistogramParameterfvEXT*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetHistogramParameterfvEXT".} -proc glMinmaxEXT*(target: TGLenum, internalformat: TGLenum, sink: TGLboolean){. - dynlib: dllname, importc: "glMinmaxEXT".} -proc glResetMinmaxEXT*(target: TGLenum){.dynlib: dllname, - importc: "glResetMinmaxEXT".} -proc glGetMinmaxEXT*(target: TGLenum, reset: TGLboolean, format: TGLenum, - thetype: TGLenum, values: PGLvoid){.dynlib: dllname, - importc: "glGetMinmaxEXT".} -proc glGetMinmaxParameterivEXT*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetMinmaxParameterivEXT".} -proc glGetMinmaxParameterfvEXT*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetMinmaxParameterfvEXT".} - #***** GL_EXT_multi_draw_arrays *****// -proc glMultiDrawArraysEXT*(mode: TGLenum, first: PGLint, count: PGLsizei, - primcount: TGLsizei){.dynlib: dllname, - importc: "glMultiDrawArraysEXT".} -proc glMultiDrawElementsEXT*(mode: TGLenum, count: PGLsizei, thetype: TGLenum, - indices: PGLvoid, primcount: TGLsizei){. - dynlib: dllname, importc: "glMultiDrawElementsEXT".} - #***** GL_EXT_packed_pixels *****// -const - GL_UNSIGNED_BYTE_3_3_2_EXT* = 0x00008032 - GL_UNSIGNED_SHORT_4_4_4_4_EXT* = 0x00008033 - GL_UNSIGNED_SHORT_5_5_5_1_EXT* = 0x00008034 - GL_UNSIGNED_INT_8_8_8_8_EXT* = 0x00008035 - GL_UNSIGNED_INT_10_10_10_2_EXT* = 0x00008036 - #***** GL_EXT_paletted_texture *****// - -const - GL_COLOR_INDEX1_EXT* = 0x000080E2 - GL_COLOR_INDEX2_EXT* = 0x000080E3 - GL_COLOR_INDEX4_EXT* = 0x000080E4 - GL_COLOR_INDEX8_EXT* = 0x000080E5 - GL_COLOR_INDEX12_EXT* = 0x000080E6 - GL_COLOR_INDEX16_EXT* = 0x000080E7 - GL_COLOR_TABLE_FORMAT_EXT* = 0x000080D8 - GL_COLOR_TABLE_WIDTH_EXT* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE_EXT* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE_EXT* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE_EXT* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE_EXT* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE_EXT* = 0x000080DF - GL_TEXTURE_INDEX_SIZE_EXT* = 0x000080ED - GL_TEXTURE_1D* = 0x00000DE0 - GL_TEXTURE_2D* = 0x00000DE1 - GL_TEXTURE_3D_EXT* = 0x0000806F # GL_TEXTURE_CUBE_MAP_ARB { already defined } - GL_PROXY_TEXTURE_1D* = 0x00008063 - GL_PROXY_TEXTURE_2D* = 0x00008064 - GL_PROXY_TEXTURE_3D_EXT* = 0x00008070 # 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 } - -proc glColorTableEXT*(target: TGLenum, internalFormat: TGLenum, width: TGLsizei, - format: TGLenum, thetype: TGLenum, data: PGLvoid){. - dynlib: dllname, importc: "glColorTableEXT".} - # glColorSubTableEXT { already defined } -proc glGetColorTableEXT*(target: TGLenum, format: TGLenum, thetype: TGLenum, - data: PGLvoid){.dynlib: dllname, - importc: "glGetColorTableEXT".} -proc glGetColorTableParameterivEXT*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetColorTableParameterivEXT".} -proc glGetColorTableParameterfvEXT*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetColorTableParameterfvEXT".} - #***** GL_EXT_point_parameters *****// -const - GL_POINT_SIZE_MIN_EXT* = 0x00008126 - GL_POINT_SIZE_MAX_EXT* = 0x00008127 - GL_POINT_FADE_THRESHOLD_SIZE_EXT* = 0x00008128 - GL_DISTANCE_ATTENUATION_EXT* = 0x00008129 - -proc glPointParameterfEXT*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glPointParameterfEXT".} -proc glPointParameterfvEXT*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glPointParameterfvEXT".} - #***** GL_EXT_polygon_offset *****// -const - constGL_POLYGON_OFFSET_EXT* = 0x00008037 - GL_POLYGON_OFFSET_FACTOR_EXT* = 0x00008038 - GL_POLYGON_OFFSET_BIAS_EXT* = 0x00008039 - -proc glPolygonOffsetEXT*(factor: TGLfloat, bias: TGLfloat){.dynlib: dllname, - importc: "glPolygonOffsetEXT".} - #***** GL_EXT_secondary_color *****// -const - GL_COLOR_SUM_EXT* = 0x00008458 - GL_CURRENT_SECONDARY_COLOR_EXT* = 0x00008459 - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT* = 0x0000845A - GL_SECONDARY_COLOR_ARRAY_TYPE_EXT* = 0x0000845B - GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT* = 0x0000845C - GL_SECONDARY_COLOR_ARRAY_POINTER_EXT* = 0x0000845D - GL_SECONDARY_COLOR_ARRAY_EXT* = 0x0000845E - -proc glSecondaryColor3bEXT*(components: TGLbyte){.dynlib: dllname, - importc: "glSecondaryColor3bEXT".} -proc glSecondaryColor3sEXT*(components: TGLshort){.dynlib: dllname, - importc: "glSecondaryColor3sEXT".} -proc glSecondaryColor3iEXT*(components: TGLint){.dynlib: dllname, - importc: "glSecondaryColor3iEXT".} -proc glSecondaryColor3fEXT*(components: TGLfloat){.dynlib: dllname, - importc: "glSecondaryColor3fEXT".} -proc glSecondaryColor3dEXT*(components: TGLdouble){.dynlib: dllname, - importc: "glSecondaryColor3dEXT".} -proc glSecondaryColor3ubEXT*(components: TGLubyte){.dynlib: dllname, - importc: "glSecondaryColor3ubEXT".} -proc glSecondaryColor3usEXT*(components: TGLushort){.dynlib: dllname, - importc: "glSecondaryColor3usEXT".} -proc glSecondaryColor3uiEXT*(components: TGLuint){.dynlib: dllname, - importc: "glSecondaryColor3uiEXT".} -proc glSecondaryColor3bvEXT*(components: TGLbyte){.dynlib: dllname, - importc: "glSecondaryColor3bvEXT".} -proc glSecondaryColor3svEXT*(components: TGLshort){.dynlib: dllname, - importc: "glSecondaryColor3svEXT".} -proc glSecondaryColor3ivEXT*(components: TGLint){.dynlib: dllname, - importc: "glSecondaryColor3ivEXT".} -proc glSecondaryColor3fvEXT*(components: TGLfloat){.dynlib: dllname, - importc: "glSecondaryColor3fvEXT".} -proc glSecondaryColor3dvEXT*(components: TGLdouble){.dynlib: dllname, - importc: "glSecondaryColor3dvEXT".} -proc glSecondaryColor3ubvEXT*(components: TGLubyte){.dynlib: dllname, - importc: "glSecondaryColor3ubvEXT".} -proc glSecondaryColor3usvEXT*(components: TGLushort){.dynlib: dllname, - importc: "glSecondaryColor3usvEXT".} -proc glSecondaryColor3uivEXT*(components: TGLuint){.dynlib: dllname, - importc: "glSecondaryColor3uivEXT".} -proc glSecondaryColorPointerEXT*(size: TGLint, thetype: TGLenum, - stride: TGLsizei, pointer: PGLvoid){. - dynlib: dllname, importc: "glSecondaryColorPointerEXT".} - #***** GL_EXT_separate_specular_color *****// -const - GL_LIGHT_MODEL_COLOR_CONTROL_EXT* = 0x000081F8 - GL_SINGLE_COLOR_EXT* = 0x000081F9 - GL_SEPARATE_SPECULAR_COLOR_EXT* = 0x000081FA - #***** GL_EXT_shadow_funcs *****// - #***** GL_EXT_shared_texture_palette *****// - -const - GL_SHARED_TEXTURE_PALETTE_EXT* = 0x000081FB - #***** GL_EXT_stencil_two_side *****// - -const - GL_STENCIL_TEST_TWO_SIDE_EXT* = 0x00008910 - constGL_ACTIVE_STENCIL_FACE_EXT* = 0x00008911 - -proc glActiveStencilFaceEXT*(face: TGLenum){.dynlib: dllname, - importc: "glActiveStencilFaceEXT".} - #***** GL_EXT_stencil_wrap *****// -const - GL_INCR_WRAP_EXT* = 0x00008507 - GL_DECR_WRAP_EXT* = 0x00008508 - #***** GL_EXT_subtexture *****// - -proc glTexSubImage1DEXT*(target: TGLenum, level: TGLint, xoffset: TGLint, - width: TGLsizei, format: TGLenum, thetype: TGLenum, - pixels: PGLvoid){.dynlib: dllname, - importc: "glTexSubImage1DEXT".} -proc glTexSubImage2DEXT*(target: TGLenum, level: TGLint, xoffset: TGLint, - yoffset: TGLint, width: TGLsizei, height: TGLsizei, - format: TGLenum, thetype: TGLenum, pixels: PGLvoid){. - dynlib: dllname, importc: "glTexSubImage2DEXT".} -proc glTexSubImage3DEXT*(target: TGLenum, level: TGLint, xoffset: TGLint, - yoffset: TGLint, zoffset: TGLint, width: TGLsizei, - height: TGLsizei, depth: TGLsizei, format: TGLenum, - thetype: TGLenum, pixels: PGLvoid){.dynlib: dllname, - importc: "glTexSubImage3DEXT".} - #***** GL_EXT_texture3D *****// -const - GL_PACK_SKIP_IMAGES_EXT* = 0x0000806B - GL_PACK_IMAGE_HEIGHT_EXT* = 0x0000806C - GL_UNPACK_SKIP_IMAGES_EXT* = 0x0000806D - GL_UNPACK_IMAGE_HEIGHT_EXT* = 0x0000806E # GL_TEXTURE_3D_EXT { already defined } - # GL_PROXY_TEXTURE_3D_EXT { already defined } - GL_TEXTURE_DEPTH_EXT* = 0x00008071 - GL_TEXTURE_WRAP_R_EXT* = 0x00008072 - GL_MAX_3D_TEXTURE_SIZE_EXT* = 0x00008073 - -proc glTexImage3DEXT*(target: TGLenum, level: TGLint, internalformat: TGLenum, - width: TGLsizei, height: TGLsizei, depth: TGLsizei, - border: TGLint, format: TGLenum, thetype: TGLenum, - pixels: PGLvoid){.dynlib: dllname, - importc: "glTexImage3DEXT".} - #***** GL_EXT_texture_compression_s3tc *****// -const - GL_COMPRESSED_RGB_S3TC_DXT1_EXT* = 0x000083F0 - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT* = 0x000083F1 - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT* = 0x000083F2 - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT* = 0x000083F3 - #***** GL_EXT_texture_env_add *****// - #***** GL_EXT_texture_env_combine *****// - -const - GL_COMBINE_EXT* = 0x00008570 - GL_COMBINE_RGB_EXT* = 0x00008571 - GL_COMBINE_ALPHA_EXT* = 0x00008572 - GL_SOURCE0_RGB_EXT* = 0x00008580 - GL_SOURCE1_RGB_EXT* = 0x00008581 - GL_SOURCE2_RGB_EXT* = 0x00008582 - GL_SOURCE0_ALPHA_EXT* = 0x00008588 - GL_SOURCE1_ALPHA_EXT* = 0x00008589 - GL_SOURCE2_ALPHA_EXT* = 0x0000858A - GL_OPERAND0_RGB_EXT* = 0x00008590 - GL_OPERAND1_RGB_EXT* = 0x00008591 - GL_OPERAND2_RGB_EXT* = 0x00008592 - GL_OPERAND0_ALPHA_EXT* = 0x00008598 - GL_OPERAND1_ALPHA_EXT* = 0x00008599 - GL_OPERAND2_ALPHA_EXT* = 0x0000859A - GL_RGB_SCALE_EXT* = 0x00008573 - GL_ADD_SIGNED_EXT* = 0x00008574 - GL_INTERPOLATE_EXT* = 0x00008575 - GL_CONSTANT_EXT* = 0x00008576 - GL_PRIMARY_COLOR_EXT* = 0x00008577 - GL_PREVIOUS_EXT* = 0x00008578 - #***** GL_EXT_texture_env_dot3 *****// - -const - GL_DOT3_RGB_EXT* = 0x00008740 - GL_DOT3_RGBA_EXT* = 0x00008741 - #***** GL_EXT_texture_filter_anisotropic *****// - -const - GL_TEXTURE_MAX_ANISOTROPY_EXT* = 0x000084FE - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT* = 0x000084FF - #***** GL_EXT_texture_lod_bias *****// - -const - GL_TEXTURE_FILTER_CONTROL_EXT* = 0x00008500 - GL_TEXTURE_LOD_BIAS_EXT* = 0x00008501 - GL_MAX_TEXTURE_LOD_BIAS_EXT* = 0x000084FD - #***** GL_EXT_texture_object *****// - -const - GL_TEXTURE_PRIORITY_EXT* = 0x00008066 - GL_TEXTURE_RESIDENT_EXT* = 0x00008067 - GL_TEXTURE_1D_BINDING_EXT* = 0x00008068 - GL_TEXTURE_2D_BINDING_EXT* = 0x00008069 - GL_TEXTURE_3D_BINDING_EXT* = 0x0000806A - -proc glGenTexturesEXT*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, - importc: "glGenTexturesEXT".} -proc glDeleteTexturesEXT*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, - importc: "glDeleteTexturesEXT".} -proc glBindTextureEXT*(target: TGLenum, texture: TGLuint){.dynlib: dllname, - importc: "glBindTextureEXT".} -proc glPrioritizeTexturesEXT*(n: TGLsizei, textures: PGLuint, - priorities: PGLclampf){.dynlib: dllname, - importc: "glPrioritizeTexturesEXT".} -proc glAreTexturesResidentEXT*(n: TGLsizei, textures: PGLuint, - residences: PGLboolean): TGLboolean{. - dynlib: dllname, importc: "glAreTexturesResidentEXT".} -proc glIsTextureEXT*(texture: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsTextureEXT".} - #***** GL_EXT_vertex_array *****// -const - GL_VERTEX_ARRAY_EXT* = 0x00008074 - GL_NORMAL_ARRAY_EXT* = 0x00008075 - GL_COLOR_ARRAY_EXT* = 0x00008076 - GL_INDEX_ARRAY_EXT* = 0x00008077 - GL_TEXTURE_COORD_ARRAY_EXT* = 0x00008078 - GL_EDGE_FLAG_ARRAY_EXT* = 0x00008079 - GL_DOUBLE_EXT* = 0x0000140A - GL_VERTEX_ARRAY_SIZE_EXT* = 0x0000807A - GL_VERTEX_ARRAY_TYPE_EXT* = 0x0000807B - GL_VERTEX_ARRAY_STRIDE_EXT* = 0x0000807C - GL_VERTEX_ARRAY_COUNT_EXT* = 0x0000807D - GL_NORMAL_ARRAY_TYPE_EXT* = 0x0000807E - GL_NORMAL_ARRAY_STRIDE_EXT* = 0x0000807F - GL_NORMAL_ARRAY_COUNT_EXT* = 0x00008080 - GL_COLOR_ARRAY_SIZE_EXT* = 0x00008081 - GL_COLOR_ARRAY_TYPE_EXT* = 0x00008082 - GL_COLOR_ARRAY_STRIDE_EXT* = 0x00008083 - GL_COLOR_ARRAY_COUNT_EXT* = 0x00008084 - GL_INDEX_ARRAY_TYPE_EXT* = 0x00008085 - GL_INDEX_ARRAY_STRIDE_EXT* = 0x00008086 - GL_INDEX_ARRAY_COUNT_EXT* = 0x00008087 - GL_TEXTURE_COORD_ARRAY_SIZE_EXT* = 0x00008088 - GL_TEXTURE_COORD_ARRAY_TYPE_EXT* = 0x00008089 - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT* = 0x0000808A - GL_TEXTURE_COORD_ARRAY_COUNT_EXT* = 0x0000808B - GL_EDGE_FLAG_ARRAY_STRIDE_EXT* = 0x0000808C - GL_EDGE_FLAG_ARRAY_COUNT_EXT* = 0x0000808D - GL_VERTEX_ARRAY_POINTER_EXT* = 0x0000808E - GL_NORMAL_ARRAY_POINTER_EXT* = 0x0000808F - GL_COLOR_ARRAY_POINTER_EXT* = 0x00008090 - GL_INDEX_ARRAY_POINTER_EXT* = 0x00008091 - GL_TEXTURE_COORD_ARRAY_POINTER_EXT* = 0x00008092 - GL_EDGE_FLAG_ARRAY_POINTER_EXT* = 0x00008093 - -proc glArrayElementEXT*(i: TGLint){.dynlib: dllname, - importc: "glArrayElementEXT".} -proc glDrawArraysEXT*(mode: TGLenum, first: TGLint, count: TGLsizei){. - dynlib: dllname, importc: "glDrawArraysEXT".} -proc glVertexPointerEXT*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - count: TGLsizei, pointer: PGLvoid){.dynlib: dllname, - importc: "glVertexPointerEXT".} -proc glNormalPointerEXT*(thetype: TGLenum, stride: TGLsizei, count: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glNormalPointerEXT".} -proc glColorPointerEXT*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - count: TGLsizei, pointer: PGLvoid){.dynlib: dllname, - importc: "glColorPointerEXT".} -proc glIndexPointerEXT*(thetype: TGLenum, stride: TGLsizei, count: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glIndexPointerEXT".} -proc glTexCoordPointerEXT*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - count: TGLsizei, pointer: PGLvoid){.dynlib: dllname, - importc: "glTexCoordPointerEXT".} -proc glEdgeFlagPointerEXT*(stride: TGLsizei, count: TGLsizei, - pointer: PGLboolean){.dynlib: dllname, - importc: "glEdgeFlagPointerEXT".} -proc glGetPointervEXT*(pname: TGLenum, params: PGLvoid){.dynlib: dllname, - importc: "glGetPointervEXT".} - #***** GL_EXT_vertex_shader *****// -const - GL_VERTEX_SHADER_EXT* = 0x00008780 - GL_VARIANT_VALUE_EXT* = 0x000087E4 - GL_VARIANT_DATATYPE_EXT* = 0x000087E5 - GL_VARIANT_ARRAY_STRIDE_EXT* = 0x000087E6 - GL_VARIANT_ARRAY_TYPE_EXT* = 0x000087E7 - GL_VARIANT_ARRAY_EXT* = 0x000087E8 - GL_VARIANT_ARRAY_POINTER_EXT* = 0x000087E9 - GL_INVARIANT_VALUE_EXT* = 0x000087EA - GL_INVARIANT_DATATYPE_EXT* = 0x000087EB - GL_LOCAL_CONSTANT_VALUE_EXT* = 0x000087EC - GL_LOCAL_CONSTANT_DATATYPE_EXT* = 0x000087ED - GL_OP_INDEX_EXT* = 0x00008782 - GL_OP_NEGATE_EXT* = 0x00008783 - GL_OP_DOT3_EXT* = 0x00008784 - GL_OP_DOT4_EXT* = 0x00008785 - GL_OP_MUL_EXT* = 0x00008786 - GL_OP_ADD_EXT* = 0x00008787 - GL_OP_MADD_EXT* = 0x00008788 - GL_OP_FRAC_EXT* = 0x00008789 - GL_OP_MAX_EXT* = 0x0000878A - GL_OP_MIN_EXT* = 0x0000878B - GL_OP_SET_GE_EXT* = 0x0000878C - GL_OP_SET_LT_EXT* = 0x0000878D - GL_OP_CLAMP_EXT* = 0x0000878E - GL_OP_FLOOR_EXT* = 0x0000878F - GL_OP_ROUND_EXT* = 0x00008790 - GL_OP_EXP_BASE_2_EXT* = 0x00008791 - GL_OP_LOG_BASE_2_EXT* = 0x00008792 - GL_OP_POWER_EXT* = 0x00008793 - GL_OP_RECIP_EXT* = 0x00008794 - GL_OP_RECIP_SQRT_EXT* = 0x00008795 - GL_OP_SUB_EXT* = 0x00008796 - GL_OP_CROSS_PRODUCT_EXT* = 0x00008797 - GL_OP_MULTIPLY_MATRIX_EXT* = 0x00008798 - GL_OP_MOV_EXT* = 0x00008799 - GL_OUTPUT_VERTEX_EXT* = 0x0000879A - GL_OUTPUT_COLOR0_EXT* = 0x0000879B - GL_OUTPUT_COLOR1_EXT* = 0x0000879C - GL_OUTPUT_TEXTURE_COORD0_EXT* = 0x0000879D - GL_OUTPUT_TEXTURE_COORD1_EXT* = 0x0000879E - GL_OUTPUT_TEXTURE_COORD2_EXT* = 0x0000879F - GL_OUTPUT_TEXTURE_COORD3_EXT* = 0x000087A0 - GL_OUTPUT_TEXTURE_COORD4_EXT* = 0x000087A1 - GL_OUTPUT_TEXTURE_COORD5_EXT* = 0x000087A2 - GL_OUTPUT_TEXTURE_COORD6_EXT* = 0x000087A3 - GL_OUTPUT_TEXTURE_COORD7_EXT* = 0x000087A4 - GL_OUTPUT_TEXTURE_COORD8_EXT* = 0x000087A5 - GL_OUTPUT_TEXTURE_COORD9_EXT* = 0x000087A6 - GL_OUTPUT_TEXTURE_COORD10_EXT* = 0x000087A7 - GL_OUTPUT_TEXTURE_COORD11_EXT* = 0x000087A8 - GL_OUTPUT_TEXTURE_COORD12_EXT* = 0x000087A9 - GL_OUTPUT_TEXTURE_COORD13_EXT* = 0x000087AA - GL_OUTPUT_TEXTURE_COORD14_EXT* = 0x000087AB - GL_OUTPUT_TEXTURE_COORD15_EXT* = 0x000087AC - GL_OUTPUT_TEXTURE_COORD16_EXT* = 0x000087AD - GL_OUTPUT_TEXTURE_COORD17_EXT* = 0x000087AE - GL_OUTPUT_TEXTURE_COORD18_EXT* = 0x000087AF - GL_OUTPUT_TEXTURE_COORD19_EXT* = 0x000087B0 - GL_OUTPUT_TEXTURE_COORD20_EXT* = 0x000087B1 - GL_OUTPUT_TEXTURE_COORD21_EXT* = 0x000087B2 - GL_OUTPUT_TEXTURE_COORD22_EXT* = 0x000087B3 - GL_OUTPUT_TEXTURE_COORD23_EXT* = 0x000087B4 - GL_OUTPUT_TEXTURE_COORD24_EXT* = 0x000087B5 - GL_OUTPUT_TEXTURE_COORD25_EXT* = 0x000087B6 - GL_OUTPUT_TEXTURE_COORD26_EXT* = 0x000087B7 - GL_OUTPUT_TEXTURE_COORD27_EXT* = 0x000087B8 - GL_OUTPUT_TEXTURE_COORD28_EXT* = 0x000087B9 - GL_OUTPUT_TEXTURE_COORD29_EXT* = 0x000087BA - GL_OUTPUT_TEXTURE_COORD30_EXT* = 0x000087BB - GL_OUTPUT_TEXTURE_COORD31_EXT* = 0x000087BC - GL_OUTPUT_FOG_EXT* = 0x000087BD - GL_SCALAR_EXT* = 0x000087BE - GL_VECTOR_EXT* = 0x000087BF - GL_MATRIX_EXT* = 0x000087C0 - GL_VARIANT_EXT* = 0x000087C1 - GL_INVARIANT_EXT* = 0x000087C2 - GL_LOCAL_CONSTANT_EXT* = 0x000087C3 - GL_LOCAL_EXT* = 0x000087C4 - GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT* = 0x000087C5 - GL_MAX_VERTEX_SHADER_VARIANTS_EXT* = 0x000087C6 - GL_MAX_VERTEX_SHADER_INVARIANTS_EXT* = 0x000087C7 - GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT* = 0x000087C8 - GL_MAX_VERTEX_SHADER_LOCALS_EXT* = 0x000087C9 - GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT* = 0x000087CA - GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT* = 0x000087CB - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT* = 0x000087CC - GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT* = 0x000087CD - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT* = 0x000087CE - GL_VERTEX_SHADER_INSTRUCTIONS_EXT* = 0x000087CF - GL_VERTEX_SHADER_VARIANTS_EXT* = 0x000087D0 - GL_VERTEX_SHADER_INVARIANTS_EXT* = 0x000087D1 - GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT* = 0x000087D2 - GL_VERTEX_SHADER_LOCALS_EXT* = 0x000087D3 - GL_VERTEX_SHADER_BINDING_EXT* = 0x00008781 - GL_VERTEX_SHADER_OPTIMIZED_EXT* = 0x000087D4 - GL_X_EXT* = 0x000087D5 - GL_Y_EXT* = 0x000087D6 - GL_Z_EXT* = 0x000087D7 - GL_W_EXT* = 0x000087D8 - GL_NEGATIVE_X_EXT* = 0x000087D9 - GL_NEGATIVE_Y_EXT* = 0x000087DA - GL_NEGATIVE_Z_EXT* = 0x000087DB - GL_NEGATIVE_W_EXT* = 0x000087DC - GL_ZERO_EXT* = 0x000087DD - GL_ONE_EXT* = 0x000087DE - GL_NEGATIVE_ONE_EXT* = 0x000087DF - GL_NORMALIZED_RANGE_EXT* = 0x000087E0 - GL_FULL_RANGE_EXT* = 0x000087E1 - GL_CURRENT_VERTEX_EXT* = 0x000087E2 - GL_MVP_MATRIX_EXT* = 0x000087E3 - -proc glBeginVertexShaderEXT*(){.dynlib: dllname, - importc: "glBeginVertexShaderEXT".} -proc glEndVertexShaderEXT*(){.dynlib: dllname, importc: "glEndVertexShaderEXT".} -proc glBindVertexShaderEXT*(id: TGLuint){.dynlib: dllname, - importc: "glBindVertexShaderEXT".} -proc glGenVertexShadersEXT*(range: TGLuint): TGLuint{.dynlib: dllname, - importc: "glGenVertexShadersEXT".} -proc glDeleteVertexShaderEXT*(id: TGLuint){.dynlib: dllname, - importc: "glDeleteVertexShaderEXT".} -proc glShaderOp1EXT*(op: TGLenum, res: TGLuint, arg1: TGLuint){.dynlib: dllname, - importc: "glShaderOp1EXT".} -proc glShaderOp2EXT*(op: TGLenum, res: TGLuint, arg1: TGLuint, arg2: TGLuint){. - dynlib: dllname, importc: "glShaderOp2EXT".} -proc glShaderOp3EXT*(op: TGLenum, res: TGLuint, arg1: TGLuint, arg2: TGLuint, - arg3: TGLuint){.dynlib: dllname, importc: "glShaderOp3EXT".} -proc glSwizzleEXT*(res: TGLuint, theIn: TGLuint, outX: TGLenum, outY: TGLenum, - outZ: TGLenum, outW: TGLenum){.dynlib: dllname, - importc: "glSwizzleEXT".} -proc glWriteMaskEXT*(res: TGLuint, theIn: TGLuint, outX: TGLenum, outY: TGLenum, - outZ: TGLenum, outW: TGLenum){.dynlib: dllname, - importc: "glWriteMaskEXT".} -proc glInsertComponentEXT*(res: TGLuint, src: TGLuint, num: TGLuint){. - dynlib: dllname, importc: "glInsertComponentEXT".} -proc glExtractComponentEXT*(res: TGLuint, src: TGLuint, num: TGLuint){. - dynlib: dllname, importc: "glExtractComponentEXT".} -proc glGenSymbolsEXT*(datatype: TGLenum, storagetype: TGLenum, range: TGLenum, - components: TGLuint): TGLuint{.dynlib: dllname, - importc: "glGenSymbolsEXT".} -proc glSetInvariantEXT*(id: TGLuint, thetype: TGLenum, address: PGLvoid){. - dynlib: dllname, importc: "glSetInvariantEXT".} -proc glSetLocalConstantEXT*(id: TGLuint, thetype: TGLenum, address: PGLvoid){. - dynlib: dllname, importc: "glSetLocalConstantEXT".} -proc glVariantbvEXT*(id: TGLuint, address: PGLbyte){.dynlib: dllname, - importc: "glVariantbvEXT".} -proc glVariantsvEXT*(id: TGLuint, address: PGLshort){.dynlib: dllname, - importc: "glVariantsvEXT".} -proc glVariantivEXT*(id: TGLuint, address: PGLint){.dynlib: dllname, - importc: "glVariantivEXT".} -proc glVariantfvEXT*(id: TGLuint, address: PGLfloat){.dynlib: dllname, - importc: "glVariantfvEXT".} -proc glVariantdvEXT*(id: TGLuint, address: PGLdouble){.dynlib: dllname, - importc: "glVariantdvEXT".} -proc glVariantubvEXT*(id: TGLuint, address: PGLubyte){.dynlib: dllname, - importc: "glVariantubvEXT".} -proc glVariantusvEXT*(id: TGLuint, address: PGLushort){.dynlib: dllname, - importc: "glVariantusvEXT".} -proc glVariantuivEXT*(id: TGLuint, address: PGLuint){.dynlib: dllname, - importc: "glVariantuivEXT".} -proc glVariantPointerEXT*(id: TGLuint, thetype: TGLenum, stride: TGLuint, - address: PGLvoid){.dynlib: dllname, - importc: "glVariantPointerEXT".} -proc glEnableVariantClientStateEXT*(id: TGLuint){.dynlib: dllname, - importc: "glEnableVariantClientStateEXT".} -proc glDisableVariantClientStateEXT*(id: TGLuint){.dynlib: dllname, - importc: "glDisableVariantClientStateEXT".} -proc glBindLightParameterEXT*(light: TGLenum, value: TGLenum): TGLuint{. - dynlib: dllname, importc: "glBindLightParameterEXT".} -proc glBindMaterialParameterEXT*(face: TGLenum, value: TGLenum): TGLuint{. - dynlib: dllname, importc: "glBindMaterialParameterEXT".} -proc glBindTexGenParameterEXT*(theunit: TGLenum, coord: TGLenum, value: TGLenum): TGLuint{. - dynlib: dllname, importc: "glBindTexGenParameterEXT".} -proc glBindTextureUnitParameterEXT*(theunit: TGLenum, value: TGLenum): TGLuint{. - dynlib: dllname, importc: "glBindTextureUnitParameterEXT".} -proc glBindParameterEXT*(value: TGLenum): TGLuint{.dynlib: dllname, - importc: "glBindParameterEXT".} -proc glIsVariantEnabledEXT*(id: TGLuint, cap: TGLenum): TGLboolean{. - dynlib: dllname, importc: "glIsVariantEnabledEXT".} -proc glGetVariantBooleanvEXT*(id: TGLuint, value: TGLenum, data: PGLboolean){. - dynlib: dllname, importc: "glGetVariantBooleanvEXT".} -proc glGetVariantIntegervEXT*(id: TGLuint, value: TGLenum, data: PGLint){. - dynlib: dllname, importc: "glGetVariantIntegervEXT".} -proc glGetVariantFloatvEXT*(id: TGLuint, value: TGLenum, data: PGLfloat){. - dynlib: dllname, importc: "glGetVariantFloatvEXT".} -proc glGetVariantPointervEXT*(id: TGLuint, value: TGLenum, data: PGLvoid){. - dynlib: dllname, importc: "glGetVariantPointervEXT".} -proc glGetInvariantBooleanvEXT*(id: TGLuint, value: TGLenum, data: PGLboolean){. - dynlib: dllname, importc: "glGetInvariantBooleanvEXT".} -proc glGetInvariantIntegervEXT*(id: TGLuint, value: TGLenum, data: PGLint){. - dynlib: dllname, importc: "glGetInvariantIntegervEXT".} -proc glGetInvariantFloatvEXT*(id: TGLuint, value: TGLenum, data: PGLfloat){. - dynlib: dllname, importc: "glGetInvariantFloatvEXT".} -proc glGetLocalConstantBooleanvEXT*(id: TGLuint, value: TGLenum, - data: PGLboolean){.dynlib: dllname, - importc: "glGetLocalConstantBooleanvEXT".} -proc glGetLocalConstantIntegervEXT*(id: TGLuint, value: TGLenum, data: PGLint){. - dynlib: dllname, importc: "glGetLocalConstantIntegervEXT".} -proc glGetLocalConstantFloatvEXT*(id: TGLuint, value: TGLenum, data: PGLfloat){. - dynlib: dllname, importc: "glGetLocalConstantFloatvEXT".} - #***** GL_EXT_vertex_weighting *****// -const - GL_VERTEX_WEIGHTING_EXT* = 0x00008509 - GL_MODELVIEW0_EXT* = 0x00001700 - GL_MODELVIEW1_EXT* = 0x0000850A - GL_MODELVIEW0_MATRIX_EXT* = 0x00000BA6 - GL_MODELVIEW1_MATRIX_EXT* = 0x00008506 - GL_CURRENT_VERTEX_WEIGHT_EXT* = 0x0000850B - GL_VERTEX_WEIGHT_ARRAY_EXT* = 0x0000850C - GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT* = 0x0000850D - GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT* = 0x0000850E - GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT* = 0x0000850F - GL_MODELVIEW0_STACK_DEPTH_EXT* = 0x00000BA3 - GL_MODELVIEW1_STACK_DEPTH_EXT* = 0x00008502 - GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT* = 0x00008510 - -proc glVertexWeightfEXT*(weight: TGLfloat){.dynlib: dllname, - importc: "glVertexWeightfEXT".} -proc glVertexWeightfvEXT*(weight: PGLfloat){.dynlib: dllname, - importc: "glVertexWeightfvEXT".} -proc glVertexWeightPointerEXT*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glVertexWeightPointerEXT".} - #***** GL_HP_occlusion_test *****// -const - GL_OCCLUSION_TEST_HP* = 0x00008165 - GL_OCCLUSION_TEST_RESULT_HP* = 0x00008166 - #***** GL_NV_blend_square *****// - #***** GL_NV_copy_depth_to_color *****// - -const - GL_DEPTH_STENCIL_TO_RGBA_NV* = 0x0000886E - GL_DEPTH_STENCIL_TO_BGRA_NV* = 0x0000886F - #***** GL_NV_depth_clamp *****// - -const - GL_DEPTH_CLAMP_NV* = 0x0000864F - #***** GL_NV_evaluators *****// - -const - GL_EVAL_2D_NV* = 0x000086C0 - GL_EVAL_TRIANGULAR_2D_NV* = 0x000086C1 - GL_MAP_TESSELLATION_NV* = 0x000086C2 - GL_MAP_ATTRIB_U_ORDER_NV* = 0x000086C3 - GL_MAP_ATTRIB_V_ORDER_NV* = 0x000086C4 - GL_EVAL_FRACTIONAL_TESSELLATION_NV* = 0x000086C5 - GL_EVAL_VERTEX_ATTRIB0_NV* = 0x000086C6 - GL_EVAL_VERTEX_ATTRIB1_NV* = 0x000086C7 - GL_EVAL_VERTEX_ATTRIB2_NV* = 0x000086C8 - GL_EVAL_VERTEX_ATTRIB3_NV* = 0x000086C9 - GL_EVAL_VERTEX_ATTRIB4_NV* = 0x000086CA - GL_EVAL_VERTEX_ATTRIB5_NV* = 0x000086CB - GL_EVAL_VERTEX_ATTRIB6_NV* = 0x000086CC - GL_EVAL_VERTEX_ATTRIB7_NV* = 0x000086CD - GL_EVAL_VERTEX_ATTRIB8_NV* = 0x000086CE - GL_EVAL_VERTEX_ATTRIB9_NV* = 0x000086CF - GL_EVAL_VERTEX_ATTRIB10_NV* = 0x000086D0 - GL_EVAL_VERTEX_ATTRIB11_NV* = 0x000086D1 - GL_EVAL_VERTEX_ATTRIB12_NV* = 0x000086D2 - GL_EVAL_VERTEX_ATTRIB13_NV* = 0x000086D3 - GL_EVAL_VERTEX_ATTRIB14_NV* = 0x000086D4 - GL_EVAL_VERTEX_ATTRIB15_NV* = 0x000086D5 - GL_MAX_MAP_TESSELLATION_NV* = 0x000086D6 - GL_MAX_RATIONAL_EVAL_ORDER_NV* = 0x000086D7 - -proc glMapControlPointsNV*(target: TGLenum, index: TGLuint, thetype: TGLenum, - ustride: TGLsizei, vstride: TGLsizei, uorder: TGLint, - vorder: TGLint, thepacked: TGLboolean, - points: PGLvoid){.dynlib: dllname, - importc: "glMapControlPointsNV".} -proc glMapParameterivNV*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glMapParameterivNV".} -proc glMapParameterfvNV*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glMapParameterfvNV".} -proc glGetMapControlPointsNV*(target: TGLenum, index: TGLuint, thetype: TGLenum, - ustride: TGLsizei, vstride: TGLsizei, - thepacked: TGLboolean, points: PGLvoid){. - dynlib: dllname, importc: "glGetMapControlPointsNV".} -proc glGetMapParameterivNV*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetMapParameterivNV".} -proc glGetMapParameterfvNV*(target: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetMapParameterfvNV".} -proc glGetMapAttribParameterivNV*(target: TGLenum, index: TGLuint, - pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetMapAttribParameterivNV".} -proc glGetMapAttribParameterfvNV*(target: TGLenum, index: TGLuint, - pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetMapAttribParameterfvNV".} -proc glEvalMapsNV*(target: TGLenum, mode: TGLenum){.dynlib: dllname, - importc: "glEvalMapsNV".} - #***** GL_NV_fence *****// -const - GL_ALL_COMPLETED_NV* = 0x000084F2 - GL_FENCE_STATUS_NV* = 0x000084F3 - GL_FENCE_CONDITION_NV* = 0x000084F4 - -proc glGenFencesNV*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, - importc: "glGenFencesNV".} -proc glDeleteFencesNV*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, - importc: "glDeleteFencesNV".} -proc glSetFenceNV*(fence: TGLuint, condition: TGLenum){.dynlib: dllname, - importc: "glSetFenceNV".} -proc glTestFenceNV*(fence: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glTestFenceNV".} -proc glFinishFenceNV*(fence: TGLuint){.dynlib: dllname, - importc: "glFinishFenceNV".} -proc glIsFenceNV*(fence: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsFenceNV".} -proc glGetFenceivNV*(fence: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetFenceivNV".} - #***** GL_NV_fog_distance *****// -const - GL_FOG_DISTANCE_MODE_NV* = 0x0000855A - GL_EYE_RADIAL_NV* = 0x0000855B - GL_EYE_PLANE_ABSOLUTE_NV* = 0x0000855C - #***** GL_NV_light_max_exponent *****// - -const - GL_MAX_SHININESS_NV* = 0x00008504 - GL_MAX_SPOT_EXPONENT_NV* = 0x00008505 - #***** GL_NV_multisample_filter_hint *****// - -const - GL_MULTISAMPLE_FILTER_HINT_NV* = 0x00008534 - #***** GL_NV_occlusion_query *****// - # GL_OCCLUSION_TEST_HP { already defined } - # GL_OCCLUSION_TEST_RESULT_HP { already defined } - -const - GL_PIXEL_COUNTER_BITS_NV* = 0x00008864 - GL_CURRENT_OCCLUSION_QUERY_ID_NV* = 0x00008865 - GL_PIXEL_COUNT_NV* = 0x00008866 - GL_PIXEL_COUNT_AVAILABLE_NV* = 0x00008867 - -proc glGenOcclusionQueriesNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glGenOcclusionQueriesNV".} -proc glDeleteOcclusionQueriesNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glDeleteOcclusionQueriesNV".} -proc glIsOcclusionQueryNV*(id: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsOcclusionQueryNV".} -proc glBeginOcclusionQueryNV*(id: TGLuint){.dynlib: dllname, - importc: "glBeginOcclusionQueryNV".} -proc glEndOcclusionQueryNV*(){.dynlib: dllname, importc: "glEndOcclusionQueryNV".} -proc glGetOcclusionQueryivNV*(id: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetOcclusionQueryivNV".} -proc glGetOcclusionQueryuivNV*(id: TGLuint, pname: TGLenum, params: PGLuint){. - dynlib: dllname, importc: "glGetOcclusionQueryuivNV".} - #***** GL_NV_packed_depth_stencil *****// -const - GL_DEPTH_STENCIL_NV* = 0x000084F9 - GL_UNSIGNED_INT_24_8_NV* = 0x000084FA - #***** GL_NV_point_sprite *****// - -const - GL_POINT_SPRITE_NV* = 0x00008861 - GL_COORD_REPLACE_NV* = 0x00008862 - GL_POINT_SPRITE_R_MODE_NV* = 0x00008863 - -proc glPointParameteriNV*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glPointParameteriNV".} -proc glPointParameterivNV*(pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glPointParameterivNV".} - #***** GL_NV_register_combiners *****// -const - GL_REGISTER_COMBINERS_NV* = 0x00008522 - GL_COMBINER0_NV* = 0x00008550 - GL_COMBINER1_NV* = 0x00008551 - GL_COMBINER2_NV* = 0x00008552 - GL_COMBINER3_NV* = 0x00008553 - GL_COMBINER4_NV* = 0x00008554 - GL_COMBINER5_NV* = 0x00008555 - GL_COMBINER6_NV* = 0x00008556 - GL_COMBINER7_NV* = 0x00008557 - GL_VARIABLE_A_NV* = 0x00008523 - GL_VARIABLE_B_NV* = 0x00008524 - GL_VARIABLE_C_NV* = 0x00008525 - GL_VARIABLE_D_NV* = 0x00008526 - GL_VARIABLE_E_NV* = 0x00008527 - GL_VARIABLE_F_NV* = 0x00008528 - GL_VARIABLE_G_NV* = 0x00008529 - GL_CONSTANT_COLOR0_NV* = 0x0000852A - GL_CONSTANT_COLOR1_NV* = 0x0000852B - GL_PRIMARY_COLOR_NV* = 0x0000852C - GL_SECONDARY_COLOR_NV* = 0x0000852D - GL_SPARE0_NV* = 0x0000852E - GL_SPARE1_NV* = 0x0000852F - GL_UNSIGNED_IDENTITY_NV* = 0x00008536 - GL_UNSIGNED_INVERT_NV* = 0x00008537 - GL_EXPAND_NORMAL_NV* = 0x00008538 - GL_EXPAND_NEGATE_NV* = 0x00008539 - GL_HALF_BIAS_NORMAL_NV* = 0x0000853A - GL_HALF_BIAS_NEGATE_NV* = 0x0000853B - GL_SIGNED_IDENTITY_NV* = 0x0000853C - GL_SIGNED_NEGATE_NV* = 0x0000853D - GL_E_TIMES_F_NV* = 0x00008531 - GL_SPARE0_PLUS_SECONDARY_COLOR_NV* = 0x00008532 - GL_SCALE_BY_TWO_NV* = 0x0000853E - GL_SCALE_BY_FOUR_NV* = 0x0000853F - GL_SCALE_BY_ONE_HALF_NV* = 0x00008540 - GL_BIAS_BY_NEGATIVE_ONE_HALF_NV* = 0x00008541 - GL_DISCARD_NV* = 0x00008530 - constGL_COMBINER_INPUT_NV* = 0x00008542 - GL_COMBINER_MAPPING_NV* = 0x00008543 - GL_COMBINER_COMPONENT_USAGE_NV* = 0x00008544 - GL_COMBINER_AB_DOT_PRODUCT_NV* = 0x00008545 - GL_COMBINER_CD_DOT_PRODUCT_NV* = 0x00008546 - GL_COMBINER_MUX_SUM_NV* = 0x00008547 - GL_COMBINER_SCALE_NV* = 0x00008548 - GL_COMBINER_BIAS_NV* = 0x00008549 - GL_COMBINER_AB_OUTPUT_NV* = 0x0000854A - GL_COMBINER_CD_OUTPUT_NV* = 0x0000854B - GL_COMBINER_SUM_OUTPUT_NV* = 0x0000854C - GL_NUM_GENERAL_COMBINERS_NV* = 0x0000854E - GL_COLOR_SUM_CLAMP_NV* = 0x0000854F - GL_MAX_GENERAL_COMBINERS_NV* = 0x0000854D - -proc glCombinerParameterfvNV*(pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glCombinerParameterfvNV".} -proc glCombinerParameterivNV*(pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glCombinerParameterivNV".} -proc glCombinerParameterfNV*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glCombinerParameterfNV".} -proc glCombinerParameteriNV*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glCombinerParameteriNV".} -proc glCombinerInputNV*(stage: TGLenum, portion: TGLenum, variable: TGLenum, - input: TGLenum, mapping: TGLenum, - componentUsage: TGLenum){.dynlib: dllname, - importc: "glCombinerInputNV".} -proc glCombinerOutputNV*(stage: TGLenum, portion: TGLenum, abOutput: TGLenum, - cdOutput: TGLenum, sumOutput: TGLenum, scale: TGLenum, - bias: TGLenum, abDotProduct: TGLboolean, - cdDotProduct: TGLboolean, muxSum: TGLboolean){. - dynlib: dllname, importc: "glCombinerOutputNV".} -proc glFinalCombinerInputNV*(variable: TGLenum, input: TGLenum, - mapping: TGLenum, componentUsage: TGLenum){. - dynlib: dllname, importc: "glFinalCombinerInputNV".} -proc glGetCombinerInputParameterfvNV*(stage: TGLenum, portion: TGLenum, - variable: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetCombinerInputParameterfvNV".} -proc glGetCombinerInputParameterivNV*(stage: TGLenum, portion: TGLenum, - variable: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetCombinerInputParameterivNV".} -proc glGetCombinerOutputParameterfvNV*(stage: TGLenum, portion: TGLenum, - pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetCombinerOutputParameterfvNV".} -proc glGetCombinerOutputParameterivNV*(stage: TGLenum, portion: TGLenum, - pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetCombinerOutputParameterivNV".} -proc glGetFinalCombinerInputParameterfvNV*(variable: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetFinalCombinerInputParameterfvNV".} -proc glGetFinalCombinerInputParameterivNV*(variable: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetFinalCombinerInputParameterivNV".} - #***** GL_NV_register_combiners2 *****// -const - GL_PER_STAGE_CONSTANTS_NV* = 0x00008535 - -proc glCombinerStageParameterfvNV*(stage: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glCombinerStageParameterfvNV".} -proc glGetCombinerStageParameterfvNV*(stage: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetCombinerStageParameterfvNV".} - #***** GL_NV_texgen_emboss *****// -const - GL_EMBOSS_MAP_NV* = 0x0000855F - GL_EMBOSS_LIGHT_NV* = 0x0000855D - GL_EMBOSS_CONSTANT_NV* = 0x0000855E - #***** GL_NV_texgen_reflection *****// - -const - GL_NORMAL_MAP_NV* = 0x00008511 - GL_REFLECTION_MAP_NV* = 0x00008512 - #***** 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 } - #***** GL_NV_texture_env_combine4 *****// - -const - GL_COMBINE4_NV* = 0x00008503 - GL_SOURCE3_RGB_NV* = 0x00008583 - GL_SOURCE3_ALPHA_NV* = 0x0000858B - GL_OPERAND3_RGB_NV* = 0x00008593 - GL_OPERAND3_ALPHA_NV* = 0x0000859B - #***** GL_NV_texture_rectangle *****// - -const - GL_TEXTURE_RECTANGLE_NV* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE_NV* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE_NV* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE_NV* = 0x000084F8 - #***** GL_NV_texture_shader *****// - -const - GL_TEXTURE_SHADER_NV* = 0x000086DE - GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV* = 0x000086D9 - GL_SHADER_OPERATION_NV* = 0x000086DF - GL_CULL_MODES_NV* = 0x000086E0 - GL_OFFSET_TEXTURE_MATRIX_NV* = 0x000086E1 - GL_OFFSET_TEXTURE_SCALE_NV* = 0x000086E2 - GL_OFFSET_TEXTURE_BIAS_NV* = 0x000086E3 - GL_PREVIOUS_TEXTURE_INPUT_NV* = 0x000086E4 - GL_CONST_EYE_NV* = 0x000086E5 - GL_SHADER_CONSISTENT_NV* = 0x000086DD - GL_PASS_THROUGH_NV* = 0x000086E6 - GL_CULL_FRAGMENT_NV* = 0x000086E7 - GL_OFFSET_TEXTURE_2D_NV* = 0x000086E8 - GL_OFFSET_TEXTURE_RECTANGLE_NV* = 0x0000864C - GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV* = 0x0000864D - GL_DEPENDENT_AR_TEXTURE_2D_NV* = 0x000086E9 - GL_DEPENDENT_GB_TEXTURE_2D_NV* = 0x000086EA - GL_DOT_PRODUCT_NV* = 0x000086EC - GL_DOT_PRODUCT_DEPTH_REPLACE_NV* = 0x000086ED - GL_DOT_PRODUCT_TEXTURE_2D_NV* = 0x000086EE - GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV* = 0x0000864E - GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV* = 0x000086F0 - GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV* = 0x000086F1 - GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV* = 0x000086F2 - GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV* = 0x000086F3 - GL_HILO_NV* = 0x000086F4 - GL_DSDT_NV* = 0x000086F5 - GL_DSDT_MAG_NV* = 0x000086F6 - GL_DSDT_MAG_VIB_NV* = 0x000086F7 - GL_UNSIGNED_INT_S8_S8_8_8_NV* = 0x000086DA - GL_UNSIGNED_INT_8_8_S8_S8_REV_NV* = 0x000086DB - GL_SIGNED_RGBA_NV* = 0x000086FB - GL_SIGNED_RGBA8_NV* = 0x000086FC - GL_SIGNED_RGB_NV* = 0x000086FE - GL_SIGNED_RGB8_NV* = 0x000086FF - GL_SIGNED_LUMINANCE_NV* = 0x00008701 - GL_SIGNED_LUMINANCE8_NV* = 0x00008702 - GL_SIGNED_LUMINANCE_ALPHA_NV* = 0x00008703 - GL_SIGNED_LUMINANCE8_ALPHA8_NV* = 0x00008704 - GL_SIGNED_ALPHA_NV* = 0x00008705 - GL_SIGNED_ALPHA8_NV* = 0x00008706 - GL_SIGNED_INTENSITY_NV* = 0x00008707 - GL_SIGNED_INTENSITY8_NV* = 0x00008708 - GL_SIGNED_RGB_UNSIGNED_ALPHA_NV* = 0x0000870C - GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV* = 0x0000870D - GL_HILO16_NV* = 0x000086F8 - GL_SIGNED_HILO_NV* = 0x000086F9 - GL_SIGNED_HILO16_NV* = 0x000086FA - GL_DSDT8_NV* = 0x00008709 - GL_DSDT8_MAG8_NV* = 0x0000870A - GL_DSDT_MAG_INTENSITY_NV* = 0x000086DC - GL_DSDT8_MAG8_INTENSITY8_NV* = 0x0000870B - GL_HI_SCALE_NV* = 0x0000870E - GL_LO_SCALE_NV* = 0x0000870F - GL_DS_SCALE_NV* = 0x00008710 - GL_DT_SCALE_NV* = 0x00008711 - GL_MAGNITUDE_SCALE_NV* = 0x00008712 - GL_VIBRANCE_SCALE_NV* = 0x00008713 - GL_HI_BIAS_NV* = 0x00008714 - GL_LO_BIAS_NV* = 0x00008715 - GL_DS_BIAS_NV* = 0x00008716 - GL_DT_BIAS_NV* = 0x00008717 - GL_MAGNITUDE_BIAS_NV* = 0x00008718 - GL_VIBRANCE_BIAS_NV* = 0x00008719 - GL_TEXTURE_BORDER_VALUES_NV* = 0x0000871A - GL_TEXTURE_HI_SIZE_NV* = 0x0000871B - GL_TEXTURE_LO_SIZE_NV* = 0x0000871C - GL_TEXTURE_DS_SIZE_NV* = 0x0000871D - GL_TEXTURE_DT_SIZE_NV* = 0x0000871E - GL_TEXTURE_MAG_SIZE_NV* = 0x0000871F - #***** GL_NV_texture_shader2 *****// - -const - GL_DOT_PRODUCT_TEXTURE_3D_NV* = 0x000086EF # 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 } - #***** GL_NV_texture_shader3 *****// - -const - GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV* = 0x00008850 - GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV* = 0x00008851 - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV* = 0x00008852 - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV* = 0x00008853 - GL_OFFSET_HILO_TEXTURE_2D_NV* = 0x00008854 - GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV* = 0x00008855 - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV* = 0x00008856 - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV* = 0x00008857 - GL_DEPENDENT_HILO_TEXTURE_2D_NV* = 0x00008858 - GL_DEPENDENT_RGB_TEXTURE_3D_NV* = 0x00008859 - GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV* = 0x0000885A - GL_DOT_PRODUCT_PASS_THROUGH_NV* = 0x0000885B - GL_DOT_PRODUCT_TEXTURE_1D_NV* = 0x0000885C - GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV* = 0x0000885D - GL_HILO8_NV* = 0x0000885E - GL_SIGNED_HILO8_NV* = 0x0000885F - GL_FORCE_BLUE_TO_ONE_NV* = 0x00008860 - #***** GL_NV_vertex_array_range *****// - -const - constGL_VERTEX_ARRAY_RANGE_NV* = 0x0000851D - GL_VERTEX_ARRAY_RANGE_LENGTH_NV* = 0x0000851E - GL_VERTEX_ARRAY_RANGE_VALID_NV* = 0x0000851F - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV* = 0x00008520 - GL_VERTEX_ARRAY_RANGE_POINTER_NV* = 0x00008521 - -proc glVertexArrayRangeNV*(len: TGLsizei, pointer: PGLvoid){.dynlib: dllname, - importc: "glVertexArrayRangeNV".} -proc glFlushVertexArrayRangeNV*(){.dynlib: dllname, - importc: "glFlushVertexArrayRangeNV".} - #***** GL_NV_vertex_array_range2 *****// -const - GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV* = 0x00008533 - #***** GL_NV_vertex_program *****// - -const - GL_VERTEX_PROGRAM_NV* = 0x00008620 - GL_VERTEX_PROGRAM_POINT_SIZE_NV* = 0x00008642 - GL_VERTEX_PROGRAM_TWO_SIDE_NV* = 0x00008643 - GL_VERTEX_STATE_PROGRAM_NV* = 0x00008621 - GL_ATTRIB_ARRAY_SIZE_NV* = 0x00008623 - GL_ATTRIB_ARRAY_STRIDE_NV* = 0x00008624 - GL_ATTRIB_ARRAY_TYPE_NV* = 0x00008625 - GL_CURRENT_ATTRIB_NV* = 0x00008626 - GL_PROGRAM_PARAMETER_NV* = 0x00008644 - GL_ATTRIB_ARRAY_POINTER_NV* = 0x00008645 - GL_PROGRAM_TARGET_NV* = 0x00008646 - GL_PROGRAM_LENGTH_NV* = 0x00008627 - GL_PROGRAM_RESIDENT_NV* = 0x00008647 - GL_PROGRAM_STRING_NV* = 0x00008628 - constGL_TRACK_MATRIX_NV* = 0x00008648 - GL_TRACK_MATRIX_TRANSFORM_NV* = 0x00008649 - GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV* = 0x0000862E - GL_MAX_TRACK_MATRICES_NV* = 0x0000862F - GL_CURRENT_MATRIX_STACK_DEPTH_NV* = 0x00008640 - GL_CURRENT_MATRIX_NV* = 0x00008641 - GL_VERTEX_PROGRAM_BINDING_NV* = 0x0000864A - GL_PROGRAM_ERROR_POSITION_NV* = 0x0000864B - GL_MODELVIEW_PROJECTION_NV* = 0x00008629 - GL_MATRIX0_NV* = 0x00008630 - GL_MATRIX1_NV* = 0x00008631 - GL_MATRIX2_NV* = 0x00008632 - GL_MATRIX3_NV* = 0x00008633 - GL_MATRIX4_NV* = 0x00008634 - GL_MATRIX5_NV* = 0x00008635 - GL_MATRIX6_NV* = 0x00008636 - GL_MATRIX7_NV* = 0x00008637 - GL_IDENTITY_NV* = 0x0000862A - GL_INVERSE_NV* = 0x0000862B - GL_TRANSPOSE_NV* = 0x0000862C - GL_INVERSE_TRANSPOSE_NV* = 0x0000862D - GL_VERTEX_ATTRIB_ARRAY0_NV* = 0x00008650 - GL_VERTEX_ATTRIB_ARRAY1_NV* = 0x00008651 - GL_VERTEX_ATTRIB_ARRAY2_NV* = 0x00008652 - GL_VERTEX_ATTRIB_ARRAY3_NV* = 0x00008653 - GL_VERTEX_ATTRIB_ARRAY4_NV* = 0x00008654 - GL_VERTEX_ATTRIB_ARRAY5_NV* = 0x00008655 - GL_VERTEX_ATTRIB_ARRAY6_NV* = 0x00008656 - GL_VERTEX_ATTRIB_ARRAY7_NV* = 0x00008657 - GL_VERTEX_ATTRIB_ARRAY8_NV* = 0x00008658 - GL_VERTEX_ATTRIB_ARRAY9_NV* = 0x00008659 - GL_VERTEX_ATTRIB_ARRAY10_NV* = 0x0000865A - GL_VERTEX_ATTRIB_ARRAY11_NV* = 0x0000865B - GL_VERTEX_ATTRIB_ARRAY12_NV* = 0x0000865C - GL_VERTEX_ATTRIB_ARRAY13_NV* = 0x0000865D - GL_VERTEX_ATTRIB_ARRAY14_NV* = 0x0000865E - GL_VERTEX_ATTRIB_ARRAY15_NV* = 0x0000865F - GL_MAP1_VERTEX_ATTRIB0_4_NV* = 0x00008660 - GL_MAP1_VERTEX_ATTRIB1_4_NV* = 0x00008661 - GL_MAP1_VERTEX_ATTRIB2_4_NV* = 0x00008662 - GL_MAP1_VERTEX_ATTRIB3_4_NV* = 0x00008663 - GL_MAP1_VERTEX_ATTRIB4_4_NV* = 0x00008664 - GL_MAP1_VERTEX_ATTRIB5_4_NV* = 0x00008665 - GL_MAP1_VERTEX_ATTRIB6_4_NV* = 0x00008666 - GL_MAP1_VERTEX_ATTRIB7_4_NV* = 0x00008667 - GL_MAP1_VERTEX_ATTRIB8_4_NV* = 0x00008668 - GL_MAP1_VERTEX_ATTRIB9_4_NV* = 0x00008669 - GL_MAP1_VERTEX_ATTRIB10_4_NV* = 0x0000866A - GL_MAP1_VERTEX_ATTRIB11_4_NV* = 0x0000866B - GL_MAP1_VERTEX_ATTRIB12_4_NV* = 0x0000866C - GL_MAP1_VERTEX_ATTRIB13_4_NV* = 0x0000866D - GL_MAP1_VERTEX_ATTRIB14_4_NV* = 0x0000866E - GL_MAP1_VERTEX_ATTRIB15_4_NV* = 0x0000866F - GL_MAP2_VERTEX_ATTRIB0_4_NV* = 0x00008670 - GL_MAP2_VERTEX_ATTRIB1_4_NV* = 0x00008671 - GL_MAP2_VERTEX_ATTRIB2_4_NV* = 0x00008672 - GL_MAP2_VERTEX_ATTRIB3_4_NV* = 0x00008673 - GL_MAP2_VERTEX_ATTRIB4_4_NV* = 0x00008674 - GL_MAP2_VERTEX_ATTRIB5_4_NV* = 0x00008675 - GL_MAP2_VERTEX_ATTRIB6_4_NV* = 0x00008676 - GL_MAP2_VERTEX_ATTRIB7_4_NV* = 0x00008677 - GL_MAP2_VERTEX_ATTRIB8_4_NV* = 0x00008678 - GL_MAP2_VERTEX_ATTRIB9_4_NV* = 0x00008679 - GL_MAP2_VERTEX_ATTRIB10_4_NV* = 0x0000867A - GL_MAP2_VERTEX_ATTRIB11_4_NV* = 0x0000867B - GL_MAP2_VERTEX_ATTRIB12_4_NV* = 0x0000867C - GL_MAP2_VERTEX_ATTRIB13_4_NV* = 0x0000867D - GL_MAP2_VERTEX_ATTRIB14_4_NV* = 0x0000867E - GL_MAP2_VERTEX_ATTRIB15_4_NV* = 0x0000867F - -proc glBindProgramNV*(target: TGLenum, id: TGLuint){.dynlib: dllname, - importc: "glBindProgramNV".} -proc glDeleteProgramsNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glDeleteProgramsNV".} -proc glExecuteProgramNV*(target: TGLenum, id: TGLuint, params: PGLfloat){. - dynlib: dllname, importc: "glExecuteProgramNV".} -proc glGenProgramsNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glGenProgramsNV".} -proc glAreProgramsResidentNV*(n: TGLsizei, ids: PGLuint, residences: PGLboolean): TGLboolean{. - dynlib: dllname, importc: "glAreProgramsResidentNV".} -proc glRequestResidentProgramsNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glRequestResidentProgramsNV".} -proc glGetProgramParameterfvNV*(target: TGLenum, index: TGLuint, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetProgramParameterfvNV".} -proc glGetProgramParameterdvNV*(target: TGLenum, index: TGLuint, pname: TGLenum, - params: PGLdouble){.dynlib: dllname, - importc: "glGetProgramParameterdvNV".} -proc glGetProgramivNV*(id: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetProgramivNV".} -proc glGetProgramStringNV*(id: TGLuint, pname: TGLenum, theProgram: PGLubyte){. - dynlib: dllname, importc: "glGetProgramStringNV".} -proc glGetTrackMatrixivNV*(target: TGLenum, address: TGLuint, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetTrackMatrixivNV".} -proc glGetVertexAttribdvNV*(index: TGLuint, pname: TGLenum, params: PGLdouble){. - dynlib: dllname, importc: "glGetVertexAttribdvNV".} -proc glGetVertexAttribfvNV*(index: TGLuint, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetVertexAttribfvNV".} -proc glGetVertexAttribivNV*(index: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetVertexAttribivNV".} -proc glGetVertexAttribPointervNV*(index: TGLuint, pname: TGLenum, - pointer: PGLvoid){.dynlib: dllname, - importc: "glGetVertexAttribPointervNV".} -proc glIsProgramNV*(id: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsProgramNV".} -proc glLoadProgramNV*(target: TGLenum, id: TGLuint, length: TGLsizei, - theProgram: PGLubyte){.dynlib: dllname, - importc: "glLoadProgramNV".} -proc glProgramParameter4fNV*(target: TGLenum, index: TGLuint, x: TGLfloat, - y: TGLfloat, z: TGLfloat, w: TGLfloat){. - dynlib: dllname, importc: "glProgramParameter4fNV".} -proc glProgramParameter4fvNV*(target: TGLenum, index: TGLuint, params: PGLfloat){. - dynlib: dllname, importc: "glProgramParameter4fvNV".} -proc glProgramParameters4dvNV*(target: TGLenum, index: TGLuint, num: TGLuint, - params: PGLdouble){.dynlib: dllname, - importc: "glProgramParameters4dvNV".} -proc glProgramParameters4fvNV*(target: TGLenum, index: TGLuint, num: TGLuint, - params: PGLfloat){.dynlib: dllname, - importc: "glProgramParameters4fvNV".} -proc glTrackMatrixNV*(target: TGLenum, address: TGLuint, matrix: TGLenum, - transform: TGLenum){.dynlib: dllname, - importc: "glTrackMatrixNV".} -proc glVertexAttribPointerNV*(index: TGLuint, size: TGLint, thetype: TGLenum, - stride: TGLsizei, pointer: PGLvoid){. - dynlib: dllname, importc: "glVertexAttribPointerNV".} -proc glVertexAttrib1sNV*(index: TGLuint, x: TGLshort){.dynlib: dllname, - importc: "glVertexAttrib1sNV".} -proc glVertexAttrib1fNV*(index: TGLuint, x: TGLfloat){.dynlib: dllname, - importc: "glVertexAttrib1fNV".} -proc glVertexAttrib1dNV*(index: TGLuint, x: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib1dNV".} -proc glVertexAttrib2sNV*(index: TGLuint, x: TGLshort, y: TGLshort){. - dynlib: dllname, importc: "glVertexAttrib2sNV".} -proc glVertexAttrib2fNV*(index: TGLuint, x: TGLfloat, y: TGLfloat){. - dynlib: dllname, importc: "glVertexAttrib2fNV".} -proc glVertexAttrib2dNV*(index: TGLuint, x: TGLdouble, y: TGLdouble){. - dynlib: dllname, importc: "glVertexAttrib2dNV".} -proc glVertexAttrib3sNV*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort){. - dynlib: dllname, importc: "glVertexAttrib3sNV".} -proc glVertexAttrib3fNV*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glVertexAttrib3fNV".} -proc glVertexAttrib3dNV*(index: TGLuint, x: TGLdouble, y: TGLdouble, - z: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib3dNV".} -proc glVertexAttrib4sNV*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort, - w: TGLshort){.dynlib: dllname, - importc: "glVertexAttrib4sNV".} -proc glVertexAttrib4fNV*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat, - w: TGLfloat){.dynlib: dllname, - importc: "glVertexAttrib4fNV".} -proc glVertexAttrib4dNV*(index: TGLuint, x: TGLdouble, y: TGLdouble, - z: TGLdouble, w: TGLdouble){.dynlib: dllname, - importc: "glVertexAttrib4dNV".} -proc glVertexAttrib4ubNV*(index: TGLuint, x: TGLubyte, y: TGLubyte, z: TGLubyte, - w: TGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4ubNV".} -proc glVertexAttrib1svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib1svNV".} -proc glVertexAttrib1fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib1fvNV".} -proc glVertexAttrib1dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib1dvNV".} -proc glVertexAttrib2svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib2svNV".} -proc glVertexAttrib2fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib2fvNV".} -proc glVertexAttrib2dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib2dvNV".} -proc glVertexAttrib3svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib3svNV".} -proc glVertexAttrib3fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib3fvNV".} -proc glVertexAttrib3dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib3dvNV".} -proc glVertexAttrib4svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, - importc: "glVertexAttrib4svNV".} -proc glVertexAttrib4fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, - importc: "glVertexAttrib4fvNV".} -proc glVertexAttrib4dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, - importc: "glVertexAttrib4dvNV".} -proc glVertexAttrib4ubvNV*(index: TGLuint, v: PGLubyte){.dynlib: dllname, - importc: "glVertexAttrib4ubvNV".} -proc glVertexAttribs1svNV*(index: TGLuint, n: TGLsizei, v: PGLshort){. - dynlib: dllname, importc: "glVertexAttribs1svNV".} -proc glVertexAttribs1fvNV*(index: TGLuint, n: TGLsizei, v: PGLfloat){. - dynlib: dllname, importc: "glVertexAttribs1fvNV".} -proc glVertexAttribs1dvNV*(index: TGLuint, n: TGLsizei, v: PGLdouble){. - dynlib: dllname, importc: "glVertexAttribs1dvNV".} -proc glVertexAttribs2svNV*(index: TGLuint, n: TGLsizei, v: PGLshort){. - dynlib: dllname, importc: "glVertexAttribs2svNV".} -proc glVertexAttribs2fvNV*(index: TGLuint, n: TGLsizei, v: PGLfloat){. - dynlib: dllname, importc: "glVertexAttribs2fvNV".} -proc glVertexAttribs2dvNV*(index: TGLuint, n: TGLsizei, v: PGLdouble){. - dynlib: dllname, importc: "glVertexAttribs2dvNV".} -proc glVertexAttribs3svNV*(index: TGLuint, n: TGLsizei, v: PGLshort){. - dynlib: dllname, importc: "glVertexAttribs3svNV".} -proc glVertexAttribs3fvNV*(index: TGLuint, n: TGLsizei, v: PGLfloat){. - dynlib: dllname, importc: "glVertexAttribs3fvNV".} -proc glVertexAttribs3dvNV*(index: TGLuint, n: TGLsizei, v: PGLdouble){. - dynlib: dllname, importc: "glVertexAttribs3dvNV".} -proc glVertexAttribs4svNV*(index: TGLuint, n: TGLsizei, v: PGLshort){. - dynlib: dllname, importc: "glVertexAttribs4svNV".} -proc glVertexAttribs4fvNV*(index: TGLuint, n: TGLsizei, v: PGLfloat){. - dynlib: dllname, importc: "glVertexAttribs4fvNV".} -proc glVertexAttribs4dvNV*(index: TGLuint, n: TGLsizei, v: PGLdouble){. - dynlib: dllname, importc: "glVertexAttribs4dvNV".} -proc glVertexAttribs4ubvNV*(index: TGLuint, n: TGLsizei, v: PGLubyte){. - dynlib: dllname, importc: "glVertexAttribs4ubvNV".} - #***** GL_NV_vertex_program1_1 *****// - #***** GL_ATI_element_array *****// -const - GL_ELEMENT_ARRAY_ATI* = 0x00008768 - GL_ELEMENT_ARRAY_TYPE_ATI* = 0x00008769 - GL_ELEMENT_ARRAY_POINTER_ATI* = 0x0000876A - -proc glElementPointerATI*(thetype: TGLenum, pointer: PGLvoid){.dynlib: dllname, - importc: "glElementPointerATI".} -proc glDrawElementArrayATI*(mode: TGLenum, count: TGLsizei){.dynlib: dllname, - importc: "glDrawElementArrayATI".} -proc glDrawRangeElementArrayATI*(mode: TGLenum, start: TGLuint, theend: TGLuint, - count: TGLsizei){.dynlib: dllname, - importc: "glDrawRangeElementArrayATI".} - #***** GL_ATI_envmap_bumpmap *****// -const - GL_BUMP_ROT_MATRIX_ATI* = 0x00008775 - GL_BUMP_ROT_MATRIX_SIZE_ATI* = 0x00008776 - GL_BUMP_NUM_TEX_UNITS_ATI* = 0x00008777 - GL_BUMP_TEX_UNITS_ATI* = 0x00008778 - GL_DUDV_ATI* = 0x00008779 - GL_DU8DV8_ATI* = 0x0000877A - GL_BUMP_ENVMAP_ATI* = 0x0000877B - GL_BUMP_TARGET_ATI* = 0x0000877C - -proc glTexBumpParameterivATI*(pname: TGLenum, param: PGLint){.dynlib: dllname, - importc: "glTexBumpParameterivATI".} -proc glTexBumpParameterfvATI*(pname: TGLenum, param: PGLfloat){.dynlib: dllname, - importc: "glTexBumpParameterfvATI".} -proc glGetTexBumpParameterivATI*(pname: TGLenum, param: PGLint){. - dynlib: dllname, importc: "glGetTexBumpParameterivATI".} -proc glGetTexBumpParameterfvATI*(pname: TGLenum, param: PGLfloat){. - dynlib: dllname, importc: "glGetTexBumpParameterfvATI".} - #***** GL_ATI_fragment_shader *****// -const - GL_FRAGMENT_SHADER_ATI* = 0x00008920 - GL_REG_0_ATI* = 0x00008921 - GL_REG_1_ATI* = 0x00008922 - GL_REG_2_ATI* = 0x00008923 - GL_REG_3_ATI* = 0x00008924 - GL_REG_4_ATI* = 0x00008925 - GL_REG_5_ATI* = 0x00008926 - GL_CON_0_ATI* = 0x00008941 - GL_CON_1_ATI* = 0x00008942 - GL_CON_2_ATI* = 0x00008943 - GL_CON_3_ATI* = 0x00008944 - GL_CON_4_ATI* = 0x00008945 - GL_CON_5_ATI* = 0x00008946 - GL_CON_6_ATI* = 0x00008947 - GL_CON_7_ATI* = 0x00008948 - GL_MOV_ATI* = 0x00008961 - GL_ADD_ATI* = 0x00008963 - GL_MUL_ATI* = 0x00008964 - GL_SUB_ATI* = 0x00008965 - GL_DOT3_ATI* = 0x00008966 - GL_DOT4_ATI* = 0x00008967 - GL_MAD_ATI* = 0x00008968 - GL_LERP_ATI* = 0x00008969 - GL_CND_ATI* = 0x0000896A - GL_CND0_ATI* = 0x0000896B - GL_DOT2_ADD_ATI* = 0x0000896C - GL_SECONDARY_INTERPOLATOR_ATI* = 0x0000896D - GL_SWIZZLE_STR_ATI* = 0x00008976 - GL_SWIZZLE_STQ_ATI* = 0x00008977 - GL_SWIZZLE_STR_DR_ATI* = 0x00008978 - GL_SWIZZLE_STQ_DQ_ATI* = 0x00008979 - GL_RED_BIT_ATI* = 0x00000001 - GL_GREEN_BIT_ATI* = 0x00000002 - GL_BLUE_BIT_ATI* = 0x00000004 - GL_2X_BIT_ATI* = 0x00000001 - GL_4X_BIT_ATI* = 0x00000002 - GL_8X_BIT_ATI* = 0x00000004 - GL_HALF_BIT_ATI* = 0x00000008 - GL_QUARTER_BIT_ATI* = 0x00000010 - GL_EIGHTH_BIT_ATI* = 0x00000020 - GL_SATURATE_BIT_ATI* = 0x00000040 # GL_2X_BIT_ATI { already defined } - GL_COMP_BIT_ATI* = 0x00000002 - GL_NEGATE_BIT_ATI* = 0x00000004 - GL_BIAS_BIT_ATI* = 0x00000008 - -proc glGenFragmentShadersATI*(range: TGLuint): TGLuint{.dynlib: dllname, - importc: "glGenFragmentShadersATI".} -proc glBindFragmentShaderATI*(id: TGLuint){.dynlib: dllname, - importc: "glBindFragmentShaderATI".} -proc glDeleteFragmentShaderATI*(id: TGLuint){.dynlib: dllname, - importc: "glDeleteFragmentShaderATI".} -proc glBeginFragmentShaderATI*(){.dynlib: dllname, - importc: "glBeginFragmentShaderATI".} -proc glEndFragmentShaderATI*(){.dynlib: dllname, - importc: "glEndFragmentShaderATI".} -proc glPassTexCoordATI*(dst: TGLuint, coord: TGLuint, swizzle: TGLenum){. - dynlib: dllname, importc: "glPassTexCoordATI".} -proc glSampleMapATI*(dst: TGLuint, interp: TGLuint, swizzle: TGLenum){. - dynlib: dllname, importc: "glSampleMapATI".} -proc glColorFragmentOp1ATI*(op: TGLenum, dst: TGLuint, dstMask: TGLuint, - dstMod: TGLuint, arg1: TGLuint, arg1Rep: TGLuint, - arg1Mod: TGLuint){.dynlib: dllname, - importc: "glColorFragmentOp1ATI".} -proc glColorFragmentOp2ATI*(op: TGLenum, dst: TGLuint, dstMask: TGLuint, - dstMod: TGLuint, arg1: TGLuint, arg1Rep: TGLuint, - arg1Mod: TGLuint, arg2: TGLuint, arg2Rep: TGLuint, - arg2Mod: TGLuint){.dynlib: dllname, - importc: "glColorFragmentOp2ATI".} -proc glColorFragmentOp3ATI*(op: TGLenum, dst: TGLuint, dstMask: TGLuint, - dstMod: TGLuint, arg1: TGLuint, arg1Rep: TGLuint, - arg1Mod: TGLuint, arg2: TGLuint, arg2Rep: TGLuint, - arg2Mod: TGLuint, arg3: TGLuint, arg3Rep: TGLuint, - arg3Mod: TGLuint){.dynlib: dllname, - importc: "glColorFragmentOp3ATI".} -proc glAlphaFragmentOp1ATI*(op: TGLenum, dst: TGLuint, dstMod: TGLuint, - arg1: TGLuint, arg1Rep: TGLuint, arg1Mod: TGLuint){. - dynlib: dllname, importc: "glAlphaFragmentOp1ATI".} -proc glAlphaFragmentOp2ATI*(op: TGLenum, dst: TGLuint, dstMod: TGLuint, - arg1: TGLuint, arg1Rep: TGLuint, arg1Mod: TGLuint, - arg2: TGLuint, arg2Rep: TGLuint, arg2Mod: TGLuint){. - dynlib: dllname, importc: "glAlphaFragmentOp2ATI".} -proc glAlphaFragmentOp3ATI*(op: TGLenum, dst: TGLuint, dstMod: TGLuint, - arg1: TGLuint, arg1Rep: TGLuint, arg1Mod: TGLuint, - arg2: TGLuint, arg2Rep: TGLuint, arg2Mod: TGLuint, - arg3: TGLuint, arg3Rep: TGLuint, arg3Mod: TGLuint){. - dynlib: dllname, importc: "glAlphaFragmentOp3ATI".} -proc glSetFragmentShaderConstantATI*(dst: TGLuint, value: PGLfloat){. - dynlib: dllname, importc: "glSetFragmentShaderConstantATI".} - #***** GL_ATI_pn_triangles *****// -const - GL_PN_TRIANGLES_ATI* = 0x000087F0 - GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI* = 0x000087F1 - GL_PN_TRIANGLES_POINT_MODE_ATI* = 0x000087F2 - GL_PN_TRIANGLES_NORMAL_MODE_ATI* = 0x000087F3 - GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI* = 0x000087F4 - GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI* = 0x000087F5 - GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI* = 0x000087F6 - GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI* = 0x000087F7 - GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI* = 0x000087F8 - -proc glPNTrianglesiATI*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glPNTrianglesiATI".} -proc glPNTrianglesfATI*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glPNTrianglesfATI".} - #***** GL_ATI_texture_mirror_once *****// -const - GL_MIRROR_CLAMP_ATI* = 0x00008742 - GL_MIRROR_CLAMP_TO_EDGE_ATI* = 0x00008743 - #***** GL_ATI_vertex_array_object *****// - -const - GL_STATIC_ATI* = 0x00008760 - GL_DYNAMIC_ATI* = 0x00008761 - GL_PRESERVE_ATI* = 0x00008762 - GL_DISCARD_ATI* = 0x00008763 - GL_OBJECT_BUFFER_SIZE_ATI* = 0x00008764 - GL_OBJECT_BUFFER_USAGE_ATI* = 0x00008765 - GL_ARRAY_OBJECT_BUFFER_ATI* = 0x00008766 - GL_ARRAY_OBJECT_OFFSET_ATI* = 0x00008767 - -proc glNewObjectBufferATI*(size: TGLsizei, pointer: PGLvoid, usage: TGLenum): TGLuint{. - dynlib: dllname, importc: "glNewObjectBufferATI".} -proc glIsObjectBufferATI*(buffer: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsObjectBufferATI".} -proc glUpdateObjectBufferATI*(buffer: TGLuint, offset: TGLuint, size: TGLsizei, - pointer: PGLvoid, preserve: TGLenum){. - dynlib: dllname, importc: "glUpdateObjectBufferATI".} -proc glGetObjectBufferfvATI*(buffer: TGLuint, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetObjectBufferfvATI".} -proc glGetObjectBufferivATI*(buffer: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetObjectBufferivATI".} -proc glDeleteObjectBufferATI*(buffer: TGLuint){.dynlib: dllname, - importc: "glDeleteObjectBufferATI".} -proc glArrayObjectATI*(thearray: TGLenum, size: TGLint, thetype: TGLenum, - stride: TGLsizei, buffer: TGLuint, offset: TGLuint){. - dynlib: dllname, importc: "glArrayObjectATI".} -proc glGetArrayObjectfvATI*(thearray: TGLenum, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetArrayObjectfvATI".} -proc glGetArrayObjectivATI*(thearray: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetArrayObjectivATI".} -proc glVariantArrayObjectATI*(id: TGLuint, thetype: TGLenum, stride: TGLsizei, - buffer: TGLuint, offset: TGLuint){. - dynlib: dllname, importc: "glVariantArrayObjectATI".} -proc glGetVariantArrayObjectfvATI*(id: TGLuint, pname: TGLenum, params: PGLfloat){. - dynlib: dllname, importc: "glGetVariantArrayObjectfvATI".} -proc glGetVariantArrayObjectivATI*(id: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetVariantArrayObjectivATI".} - #***** GL_ATI_vertex_streams *****// -const - GL_MAX_VERTEX_STREAMS_ATI* = 0x0000876B - GL_VERTEX_STREAM0_ATI* = 0x0000876C - GL_VERTEX_STREAM1_ATI* = 0x0000876D - GL_VERTEX_STREAM2_ATI* = 0x0000876E - GL_VERTEX_STREAM3_ATI* = 0x0000876F - GL_VERTEX_STREAM4_ATI* = 0x00008770 - GL_VERTEX_STREAM5_ATI* = 0x00008771 - GL_VERTEX_STREAM6_ATI* = 0x00008772 - GL_VERTEX_STREAM7_ATI* = 0x00008773 - GL_VERTEX_SOURCE_ATI* = 0x00008774 - -proc glVertexStream1s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream1s".} -proc glVertexStream1i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream1i".} -proc glVertexStream1f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream1f".} -proc glVertexStream1d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream1d".} -proc glVertexStream1sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream1sv".} -proc glVertexStream1iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream1iv".} -proc glVertexStream1fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream1fv".} -proc glVertexStream1dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream1dv".} -proc glVertexStream2s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream2s".} -proc glVertexStream2i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream2i".} -proc glVertexStream2f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream2f".} -proc glVertexStream2d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream2d".} -proc glVertexStream2sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream2sv".} -proc glVertexStream2iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream2iv".} -proc glVertexStream2fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream2fv".} -proc glVertexStream2dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream2dv".} -proc glVertexStream3s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream3s".} -proc glVertexStream3i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream3i".} -proc glVertexStream3f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream3f".} -proc glVertexStream3d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream3d".} -proc glVertexStream3sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream3sv".} -proc glVertexStream3iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream3iv".} -proc glVertexStream3fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream3fv".} -proc glVertexStream3dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream3dv".} -proc glVertexStream4s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream4s".} -proc glVertexStream4i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream4i".} -proc glVertexStream4f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream4f".} -proc glVertexStream4d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream4d".} -proc glVertexStream4sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glVertexStream4sv".} -proc glVertexStream4iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glVertexStream4iv".} -proc glVertexStream4fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glVertexStream4fv".} -proc glVertexStream4dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glVertexStream4dv".} -proc glNormalStream3b*(stream: TGLenum, coords: TGLByte){.dynlib: dllname, - importc: "glNormalStream3b".} -proc glNormalStream3s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glNormalStream3s".} -proc glNormalStream3i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glNormalStream3i".} -proc glNormalStream3f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glNormalStream3f".} -proc glNormalStream3d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glNormalStream3d".} -proc glNormalStream3bv*(stream: TGLenum, coords: TGLByte){.dynlib: dllname, - importc: "glNormalStream3bv".} -proc glNormalStream3sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, - importc: "glNormalStream3sv".} -proc glNormalStream3iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, - importc: "glNormalStream3iv".} -proc glNormalStream3fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, - importc: "glNormalStream3fv".} -proc glNormalStream3dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, - importc: "glNormalStream3dv".} -proc glClientActiveVertexStream*(stream: TGLenum){.dynlib: dllname, - importc: "glClientActiveVertexStream".} -proc glVertexBlendEnvi*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glVertexBlendEnvi".} -proc glVertexBlendEnvf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glVertexBlendEnvf".} - #***** GL_3DFX_texture_compression_FXT1 *****// -const - GL_COMPRESSED_RGB_FXT1_3DFX* = 0x000086B0 - GL_COMPRESSED_RGBA_FXT1_3DFX* = 0x000086B1 - #***** GL_IBM_cull_vertex *****// - -const - GL_CULL_VERTEX_IBM* = 0x0001928A - #***** GL_IBM_multimode_draw_arrays *****// - -proc glMultiModeDrawArraysIBM*(mode: PGLenum, first: PGLint, count: PGLsizei, - primcount: TGLsizei, modestride: TGLint){. - dynlib: dllname, importc: "glMultiModeDrawArraysIBM".} -proc glMultiModeDrawElementsIBM*(mode: PGLenum, count: PGLsizei, - thetype: TGLenum, indices: PGLvoid, - primcount: TGLsizei, modestride: TGLint){. - dynlib: dllname, importc: "glMultiModeDrawElementsIBM".} - #***** GL_IBM_raster_pos_clip *****// -const - GL_RASTER_POSITION_UNCLIPPED_IBM* = 0x00019262 - #***** GL_IBM_texture_mirrored_repeat *****// - -const - GL_MIRRORED_REPEAT_IBM* = 0x00008370 - #***** GL_IBM_vertex_array_lists *****// - -const - GL_VERTEX_ARRAY_LIST_IBM* = 0x0001929E - GL_NORMAL_ARRAY_LIST_IBM* = 0x0001929F - GL_COLOR_ARRAY_LIST_IBM* = 0x000192A0 - GL_INDEX_ARRAY_LIST_IBM* = 0x000192A1 - GL_TEXTURE_COORD_ARRAY_LIST_IBM* = 0x000192A2 - GL_EDGE_FLAG_ARRAY_LIST_IBM* = 0x000192A3 - GL_FOG_COORDINATE_ARRAY_LIST_IBM* = 0x000192A4 - GL_SECONDARY_COLOR_ARRAY_LIST_IBM* = 0x000192A5 - GL_VERTEX_ARRAY_LIST_STRIDE_IBM* = 0x000192A8 - GL_NORMAL_ARRAY_LIST_STRIDE_IBM* = 0x000192A9 - GL_COLOR_ARRAY_LIST_STRIDE_IBM* = 0x000192AA - GL_INDEX_ARRAY_LIST_STRIDE_IBM* = 0x000192AB - GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM* = 0x000192AC - GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM* = 0x000192AD - GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM* = 0x000192AE - GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM* = 0x000192AF - -proc glColorPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint, - pointer: PGLvoid, ptrstride: TGLint){. - dynlib: dllname, importc: "glColorPointerListIBM".} -proc glSecondaryColorPointerListIBM*(size: TGLint, thetype: TGLenum, - stride: TGLint, pointer: PGLvoid, - ptrstride: TGLint){.dynlib: dllname, - importc: "glSecondaryColorPointerListIBM".} -proc glEdgeFlagPointerListIBM*(stride: TGLint, pointer: PGLboolean, - ptrstride: TGLint){.dynlib: dllname, - importc: "glEdgeFlagPointerListIBM".} -proc glFogCoordPointerListIBM*(thetype: TGLenum, stride: TGLint, - pointer: PGLvoid, ptrstride: TGLint){. - dynlib: dllname, importc: "glFogCoordPointerListIBM".} -proc glNormalPointerListIBM*(thetype: TGLenum, stride: TGLint, pointer: PGLvoid, - ptrstride: TGLint){.dynlib: dllname, - importc: "glNormalPointerListIBM".} -proc glTexCoordPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint, - pointer: PGLvoid, ptrstride: TGLint){. - dynlib: dllname, importc: "glTexCoordPointerListIBM".} -proc glVertexPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint, - pointer: PGLvoid, ptrstride: TGLint){. - dynlib: dllname, importc: "glVertexPointerListIBM".} - #***** GL_MESA_resize_buffers *****// -proc glResizeBuffersMESA*(){.dynlib: dllname, importc: "glResizeBuffersMESA".} - #***** GL_MESA_window_pos *****// -proc glWindowPos2dMESA*(x: TGLdouble, y: TGLdouble){.dynlib: dllname, - importc: "glWindowPos2dMESA".} -proc glWindowPos2fMESA*(x: TGLfloat, y: TGLfloat){.dynlib: dllname, - importc: "glWindowPos2fMESA".} -proc glWindowPos2iMESA*(x: TGLint, y: TGLint){.dynlib: dllname, - importc: "glWindowPos2iMESA".} -proc glWindowPos2sMESA*(x: TGLshort, y: TGLshort){.dynlib: dllname, - importc: "glWindowPos2sMESA".} -proc glWindowPos2ivMESA*(p: PGLint){.dynlib: dllname, - importc: "glWindowPos2ivMESA".} -proc glWindowPos2svMESA*(p: PGLshort){.dynlib: dllname, - importc: "glWindowPos2svMESA".} -proc glWindowPos2fvMESA*(p: PGLfloat){.dynlib: dllname, - importc: "glWindowPos2fvMESA".} -proc glWindowPos2dvMESA*(p: PGLdouble){.dynlib: dllname, - importc: "glWindowPos2dvMESA".} -proc glWindowPos3iMESA*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname, - importc: "glWindowPos3iMESA".} -proc glWindowPos3sMESA*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname, - importc: "glWindowPos3sMESA".} -proc glWindowPos3fMESA*(x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glWindowPos3fMESA".} -proc glWindowPos3dMESA*(x: TGLdouble, y: TGLdouble, z: TGLdouble){. - dynlib: dllname, importc: "glWindowPos3dMESA".} -proc glWindowPos3ivMESA*(p: PGLint){.dynlib: dllname, - importc: "glWindowPos3ivMESA".} -proc glWindowPos3svMESA*(p: PGLshort){.dynlib: dllname, - importc: "glWindowPos3svMESA".} -proc glWindowPos3fvMESA*(p: PGLfloat){.dynlib: dllname, - importc: "glWindowPos3fvMESA".} -proc glWindowPos3dvMESA*(p: PGLdouble){.dynlib: dllname, - importc: "glWindowPos3dvMESA".} -proc glWindowPos4iMESA*(x: TGLint, y: TGLint, z: TGLint, w: TGLint){. - dynlib: dllname, importc: "glWindowPos4iMESA".} -proc glWindowPos4sMESA*(x: TGLshort, y: TGLshort, z: TGLshort, w: TGLshort){. - dynlib: dllname, importc: "glWindowPos4sMESA".} -proc glWindowPos4fMESA*(x: TGLfloat, y: TGLfloat, z: TGLfloat, w: TGLfloat){. - dynlib: dllname, importc: "glWindowPos4fMESA".} -proc glWindowPos4dMESA*(x: TGLdouble, y: TGLdouble, z: TGLdouble, w: TGLdouble){. - dynlib: dllname, importc: "glWindowPos4dMESA".} -proc glWindowPos4ivMESA*(p: PGLint){.dynlib: dllname, - importc: "glWindowPos4ivMESA".} -proc glWindowPos4svMESA*(p: PGLshort){.dynlib: dllname, - importc: "glWindowPos4svMESA".} -proc glWindowPos4fvMESA*(p: PGLfloat){.dynlib: dllname, - importc: "glWindowPos4fvMESA".} -proc glWindowPos4dvMESA*(p: PGLdouble){.dynlib: dllname, - importc: "glWindowPos4dvMESA".} - #***** GL_OML_interlace *****// -const - GL_INTERLACE_OML* = 0x00008980 - GL_INTERLACE_READ_OML* = 0x00008981 - #***** GL_OML_resample *****// - -const - GL_PACK_RESAMPLE_OML* = 0x00008984 - GL_UNPACK_RESAMPLE_OML* = 0x00008985 - GL_RESAMPLE_REPLICATE_OML* = 0x00008986 - GL_RESAMPLE_ZERO_FILL_OML* = 0x00008987 - GL_RESAMPLE_AVERAGE_OML* = 0x00008988 - GL_RESAMPLE_DECIMATE_OML* = 0x00008989 # GL_RESAMPLE_AVERAGE_OML { already defined } - #***** GL_OML_subsample *****// - -const - GL_FORMAT_SUBSAMPLE_24_24_OML* = 0x00008982 - GL_FORMAT_SUBSAMPLE_244_244_OML* = 0x00008983 - #***** GL_SGIS_generate_mipmap *****// - -const - GL_GENERATE_MIPMAP_SGIS* = 0x00008191 - GL_GENERATE_MIPMAP_HINT_SGIS* = 0x00008192 - #***** GL_SGIS_multisample *****// - -const - GLX_SAMPLE_BUFFERS_SGIS* = 0x000186A0 - GLX_SAMPLES_SGIS* = 0x000186A1 - GL_MULTISAMPLE_SGIS* = 0x0000809D - GL_SAMPLE_ALPHA_TO_MASK_SGIS* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE_SGIS* = 0x0000809F - constGL_SAMPLE_MASK_SGIS* = 0x000080A0 - GL_MULTISAMPLE_BIT_EXT* = 0x20000000 - GL_1PASS_SGIS* = 0x000080A1 - GL_2PASS_0_SGIS* = 0x000080A2 - GL_2PASS_1_SGIS* = 0x000080A3 - GL_4PASS_0_SGIS* = 0x000080A4 - GL_4PASS_1_SGIS* = 0x000080A5 - GL_4PASS_2_SGIS* = 0x000080A6 - GL_4PASS_3_SGIS* = 0x000080A7 - GL_SAMPLE_BUFFERS_SGIS* = 0x000080A8 - GL_SAMPLES_SGIS* = 0x000080A9 - GL_SAMPLE_MASK_VALUE_SGIS* = 0x000080AA - GL_SAMPLE_MASK_INVERT_SGIS* = 0x000080AB - constGL_SAMPLE_PATTERN_SGIS* = 0x000080AC - -proc glSampleMaskSGIS*(value: TGLclampf, invert: TGLboolean){.dynlib: dllname, - importc: "glSampleMaskSGIS".} -proc glSamplePatternSGIS*(pattern: TGLenum){.dynlib: dllname, - importc: "glSamplePatternSGIS".} - #***** GL_SGIS_pixel_texture *****// -const - GL_PIXEL_TEXTURE_SGIS* = 0x00008353 - GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS* = 0x00008354 - GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS* = 0x00008355 - GL_PIXEL_GROUP_COLOR_SGIS* = 0x00008356 - -proc glPixelTexGenParameteriSGIS*(pname: TGLenum, param: TGLint){. - dynlib: dllname, importc: "glPixelTexGenParameteriSGIS".} -proc glPixelTexGenParameterfSGIS*(pname: TGLenum, param: TGLfloat){. - dynlib: dllname, importc: "glPixelTexGenParameterfSGIS".} -proc glGetPixelTexGenParameterivSGIS*(pname: TGLenum, params: TGLint){. - dynlib: dllname, importc: "glGetPixelTexGenParameterivSGIS".} -proc glGetPixelTexGenParameterfvSGIS*(pname: TGLenum, params: TGLfloat){. - dynlib: dllname, importc: "glGetPixelTexGenParameterfvSGIS".} - #***** GL_SGIS_texture_border_clamp *****// - # GL_CLAMP_TO_BORDER_SGIS { already defined } - #***** GL_SGIS_texture_color_mask *****// -const - GL_TEXTURE_COLOR_WRITEMASK_SGIS* = 0x000081EF - -proc glTextureColorMaskSGIS*(r: TGLboolean, g: TGLboolean, b: TGLboolean, - a: TGLboolean){.dynlib: dllname, - importc: "glTextureColorMaskSGIS".} - #***** GL_SGIS_texture_edge_clamp *****// -const - GL_CLAMP_TO_EDGE_SGIS* = 0x0000812F - #***** GL_SGIS_texture_lod *****// - -const - GL_TEXTURE_MIN_LOD_SGIS* = 0x0000813A - GL_TEXTURE_MAX_LOD_SGIS* = 0x0000813B - GL_TEXTURE_BASE_LEVEL_SGIS* = 0x0000813C - GL_TEXTURE_MAX_LEVEL_SGIS* = 0x0000813D - #***** GL_SGIS_depth_texture *****// - -const - GL_DEPTH_COMPONENT16_SGIX* = 0x000081A5 - GL_DEPTH_COMPONENT24_SGIX* = 0x000081A6 - GL_DEPTH_COMPONENT32_SGIX* = 0x000081A7 - #***** GL_SGIX_fog_offset *****// - -const - GL_FOG_OFFSET_SGIX* = 0x00008198 - GL_FOG_OFFSET_VALUE_SGIX* = 0x00008199 - #***** GL_SGIX_interlace *****// - -const - GL_INTERLACE_SGIX* = 0x00008094 - #***** GL_SGIX_shadow_ambient *****// - -const - GL_SHADOW_AMBIENT_SGIX* = 0x000080BF - #***** GL_SGI_color_matrix *****// - -const - GL_COLOR_MATRIX_SGI* = 0x000080B1 - GL_COLOR_MATRIX_STACK_DEPTH_SGI* = 0x000080B2 - GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI* = 0x000080B3 - GL_POST_COLOR_MATRIX_RED_SCALE_SGI* = 0x000080B4 - GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI* = 0x000080B5 - GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI* = 0x000080B6 - GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI* = 0x000080B7 - GL_POST_COLOR_MATRIX_RED_BIAS_SGI* = 0x000080B8 - GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI* = 0x000080B9 - GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI* = 0x000080BA - GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI* = 0x000080BB - #***** GL_SGI_color_table *****// - -const - constGL_COLOR_TABLE_SGI* = 0x000080D0 - GL_POST_CONVOLUTION_COLOR_TABLE_SGI* = 0x000080D1 - GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI* = 0x000080D2 - GL_PROXY_COLOR_TABLE_SGI* = 0x000080D3 - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI* = 0x000080D4 - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI* = 0x000080D5 - GL_COLOR_TABLE_SCALE_SGI* = 0x000080D6 - GL_COLOR_TABLE_BIAS_SGI* = 0x000080D7 - GL_COLOR_TABLE_FORMAT_SGI* = 0x000080D8 - GL_COLOR_TABLE_WIDTH_SGI* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE_SGI* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE_SGI* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE_SGI* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE_SGI* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE_SGI* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE_SGI* = 0x000080DF - -proc glColorTableSGI*(target: TGLenum, internalformat: TGLenum, width: TGLsizei, - format: TGLenum, thetype: TGLenum, table: PGLvoid){. - dynlib: dllname, importc: "glColorTableSGI".} -proc glCopyColorTableSGI*(target: TGLenum, internalformat: TGLenum, x: TGLint, - y: TGLint, width: TGLsizei){.dynlib: dllname, - importc: "glCopyColorTableSGI".} -proc glColorTableParameterivSGI*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glColorTableParameterivSGI".} -proc glColorTableParameterfvSGI*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glColorTableParameterfvSGI".} -proc glGetColorTableSGI*(target: TGLenum, format: TGLenum, thetype: TGLenum, - table: PGLvoid){.dynlib: dllname, - importc: "glGetColorTableSGI".} -proc glGetColorTableParameterivSGI*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetColorTableParameterivSGI".} -proc glGetColorTableParameterfvSGI*(target: TGLenum, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetColorTableParameterfvSGI".} - #***** GL_SGI_texture_color_table *****// -const - GL_TEXTURE_COLOR_TABLE_SGI* = 0x000080BC - GL_PROXY_TEXTURE_COLOR_TABLE_SGI* = 0x000080BD - #***** GL_SUN_vertex *****// - -proc glColor4ubVertex2fSUN*(r: TGLubyte, g: TGLubyte, b: TGLubyte, a: TGLubyte, - x: TGLfloat, y: TGLfloat){.dynlib: dllname, - importc: "glColor4ubVertex2fSUN".} -proc glColor4ubVertex2fvSUN*(c: PGLubyte, v: PGLfloat){.dynlib: dllname, - importc: "glColor4ubVertex2fvSUN".} -proc glColor4ubVertex3fSUN*(r: TGLubyte, g: TGLubyte, b: TGLubyte, a: TGLubyte, - x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glColor4ubVertex3fSUN".} -proc glColor4ubVertex3fvSUN*(c: PGLubyte, v: PGLfloat){.dynlib: dllname, - importc: "glColor4ubVertex3fvSUN".} -proc glColor3fVertex3fSUN*(r: TGLfloat, g: TGLfloat, b: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glColor3fVertex3fSUN".} -proc glColor3fVertex3fvSUN*(c: PGLfloat, v: PGLfloat){.dynlib: dllname, - importc: "glColor3fVertex3fvSUN".} -proc glNormal3fVertex3fSUN*(nx: TGLfloat, ny: TGLfloat, nz: TGLfloat, - x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glNormal3fVertex3fSUN".} -proc glNormal3fVertex3fvSUN*(n: PGLfloat, v: PGLfloat){.dynlib: dllname, - importc: "glNormal3fVertex3fvSUN".} -proc glColor4fNormal3fVertex3fSUN*(r: TGLfloat, g: TGLfloat, b: TGLfloat, - a: TGLfloat, nx: TGLfloat, ny: TGLfloat, - nz: TGLfloat, x: TGLfloat, y: TGLfloat, - z: TGLfloat){.dynlib: dllname, - importc: "glColor4fNormal3fVertex3fSUN".} -proc glColor4fNormal3fVertex3fvSUN*(c: PGLfloat, n: PGLfloat, v: PGLfloat){. - dynlib: dllname, importc: "glColor4fNormal3fVertex3fvSUN".} -proc glTexCoord2fVertex3fSUN*(s: TGLfloat, t: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glTexCoord2fVertex3fSUN".} -proc glTexCoord2fVertex3fvSUN*(tc: PGLfloat, v: PGLfloat){.dynlib: dllname, - importc: "glTexCoord2fVertex3fvSUN".} -proc glTexCoord4fVertex4fSUN*(s: TGLfloat, t: TGLfloat, p: TGLfloat, - q: TGLfloat, x: TGLfloat, y: TGLfloat, - z: TGLfloat, w: TGLfloat){.dynlib: dllname, - importc: "glTexCoord4fVertex4fSUN".} -proc glTexCoord4fVertex4fvSUN*(tc: PGLfloat, v: PGLfloat){.dynlib: dllname, - importc: "glTexCoord4fVertex4fvSUN".} -proc glTexCoord2fColor4ubVertex3fSUN*(s: TGLfloat, t: TGLfloat, r: TGLubyte, - g: TGLubyte, b: TGLubyte, a: TGLubyte, - x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glTexCoord2fColor4ubVertex3fSUN".} -proc glTexCoord2fColor4ubVertex3fvSUN*(tc: PGLfloat, c: PGLubyte, v: PGLfloat){. - dynlib: dllname, importc: "glTexCoord2fColor4ubVertex3fvSUN".} -proc glTexCoord2fColor3fVertex3fSUN*(s: TGLfloat, t: TGLfloat, r: TGLfloat, - g: TGLfloat, b: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glTexCoord2fColor3fVertex3fSUN".} -proc glTexCoord2fColor3fVertex3fvSUN*(tc: PGLfloat, c: PGLfloat, v: PGLfloat){. - dynlib: dllname, importc: "glTexCoord2fColor3fVertex3fvSUN".} -proc glTexCoord2fNormal3fVertex3fSUN*(s: TGLfloat, t: TGLfloat, nx: TGLfloat, - ny: TGLfloat, nz: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glTexCoord2fNormal3fVertex3fSUN".} -proc glTexCoord2fNormal3fVertex3fvSUN*(tc: PGLfloat, n: PGLfloat, v: PGLfloat){. - dynlib: dllname, importc: "glTexCoord2fNormal3fVertex3fvSUN".} -proc glTexCoord2fColor4fNormal3fVertex3fSUN*(s: TGLfloat, t: TGLfloat, - r: TGLfloat, g: TGLfloat, b: TGLfloat, a: TGLfloat, nx: TGLfloat, - ny: TGLfloat, nz: TGLfloat, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glTexCoord2fColor4fNormal3fVertex3fSUN".} -proc glTexCoord2fColor4fNormal3fVertex3fvSUN*(tc: PGLfloat, c: PGLfloat, - n: PGLfloat, v: PGLfloat){.dynlib: dllname, importc: "glTexCoord2fColor4fNormal3fVertex3fvSUN".} -proc glTexCoord4fColor4fNormal3fVertex4fSUN*(s: TGLfloat, t: TGLfloat, - p: TGLfloat, q: TGLfloat, r: TGLfloat, g: TGLfloat, b: TGLfloat, - a: TGLfloat, nx: TGLfloat, ny: TGLfloat, nz: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat, w: TGLfloat){.dynlib: dllname, - importc: "glTexCoord4fColor4fNormal3fVertex4fSUN".} -proc glTexCoord4fColor4fNormal3fVertex4fvSUN*(tc: PGLfloat, c: PGLfloat, - n: PGLfloat, v: PGLfloat){.dynlib: dllname, importc: "glTexCoord4fColor4fNormal3fVertex4fvSUN".} -proc glReplacementCodeuiVertex3fSUN*(rc: TGLuint, x: TGLfloat, y: TGLfloat, - z: TGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiVertex3fSUN".} -proc glReplacementCodeuiVertex3fvSUN*(rc: PGLuint, v: PGLfloat){. - dynlib: dllname, importc: "glReplacementCodeuiVertex3fvSUN".} -proc glReplacementCodeuiColor4ubVertex3fSUN*(rc: TGLuint, r: TGLubyte, - g: TGLubyte, b: TGLubyte, a: TGLubyte, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glReplacementCodeuiColor4ubVertex3fSUN".} -proc glReplacementCodeuiColor4ubVertex3fvSUN*(rc: PGLuint, c: PGLubyte, - v: PGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiColor4ubVertex3fvSUN".} -proc glReplacementCodeuiColor3fVertex3fSUN*(rc: TGLuint, r: TGLfloat, - g: TGLfloat, b: TGLfloat, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glReplacementCodeuiColor3fVertex3fSUN".} -proc glReplacementCodeuiColor3fVertex3fvSUN*(rc: PGLuint, c: PGLfloat, - v: PGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiColor3fVertex3fvSUN".} -proc glReplacementCodeuiNormal3fVertex3fSUN*(rc: TGLuint, nx: TGLfloat, - ny: TGLfloat, nz: TGLfloat, x: TGLfloat, y: TGLfloat, z: TGLfloat){. - dynlib: dllname, importc: "glReplacementCodeuiNormal3fVertex3fSUN".} -proc glReplacementCodeuiNormal3fVertex3fvSUN*(rc: PGLuint, n: PGLfloat, - v: PGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiNormal3fVertex3fvSUN".} -proc glReplacementCodeuiColor4fNormal3fVertex3fSUN*(rc: TGLuint, r: TGLfloat, - g: TGLfloat, b: TGLfloat, a: TGLfloat, nx: TGLfloat, ny: TGLfloat, - nz: TGLfloat, x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiColor4fNormal3fVertex3fSUN".} -proc glReplacementCodeuiColor4fNormal3fVertex3fvSUN*(rc: PGLuint, c: PGLfloat, - n: PGLfloat, v: PGLfloat){.dynlib: dllname, importc: "glReplacementCodeuiColor4fNormal3fVertex3fvSUN".} -proc glReplacementCodeuiTexCoord2fVertex3fSUN*(rc: TGLuint, s: TGLfloat, - t: TGLfloat, x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiTexCoord2fVertex3fSUN".} -proc glReplacementCodeuiTexCoord2fVertex3fvSUN*(rc: PGLuint, tc: PGLfloat, - v: PGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiTexCoord2fVertex3fvSUN".} -proc glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN*(rc: TGLuint, s: TGLfloat, - t: TGLfloat, nx: TGLfloat, ny: TGLfloat, nz: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat){.dynlib: dllname, importc: "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN".} -proc glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN*(rc: PGLuint, - tc: PGLfloat, n: PGLfloat, v: PGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN".} -proc glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN*(rc: TGLuint, - s: TGLfloat, t: TGLfloat, r: TGLfloat, g: TGLfloat, b: TGLfloat, - a: TGLfloat, nx: TGLfloat, ny: TGLfloat, nz: TGLfloat, x: TGLfloat, - y: TGLfloat, z: TGLfloat){.dynlib: dllname, importc: "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN".} -proc glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN*(rc: PGLuint, - tc: PGLfloat, c: PGLfloat, n: PGLfloat, v: PGLfloat){.dynlib: dllname, - importc: "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN".} - #***** GL_ARB_fragment_program *****// -const - GL_FRAGMENT_PROGRAM_ARB* = 0x00008804 # 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* = 0x00008805 - GL_PROGRAM_TEX_INSTRUCTIONS_ARB* = 0x00008806 - GL_PROGRAM_TEX_INDIRECTIONS_ARB* = 0x00008807 - GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB* = 0x00008808 - GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB* = 0x00008809 - GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB* = 0x0000880A - GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB* = 0x0000880B - GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB* = 0x0000880C - GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB* = 0x0000880D - GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB* = 0x0000880E - GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB* = 0x0000880F - GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB* = 0x00008810 # 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* = 0x00008871 - GL_MAX_TEXTURE_IMAGE_UNITS_ARB* = 0x00008872 # 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 } - #***** GL_ATI_text_fragment_shader ***** - -const - GL_TEXT_FRAGMENT_SHADER_ATI* = 0x00008200 #***** GL_ARB_vertex_buffer_object ***** - -const - GL_BUFFER_SIZE_ARB* = 0x00008764 - GL_BUFFER_USAGE_ARB* = 0x00008765 - GL_ARRAY_BUFFER_ARB* = 0x00008892 - GL_ELEMENT_ARRAY_BUFFER_ARB* = 0x00008893 - GL_ARRAY_BUFFER_BINDING_ARB* = 0x00008894 - GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB* = 0x00008895 - GL_VERTEX_ARRAY_BUFFER_BINDING_ARB* = 0x00008896 - GL_NORMAL_ARRAY_BUFFER_BINDING_ARB* = 0x00008897 - GL_COLOR_ARRAY_BUFFER_BINDING_ARB* = 0x00008898 - GL_INDEX_ARRAY_BUFFER_BINDING_ARB* = 0x00008899 - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB* = 0x0000889A - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB* = 0x0000889B - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB* = 0x0000889C - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB* = 0x0000889D - GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB* = 0x0000889E - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB* = 0x0000889F - GL_READ_ONLY_ARB* = 0x000088B8 - GL_WRITE_ONLY_ARB* = 0x000088B9 - GL_READ_WRITE_ARB* = 0x000088BA - GL_BUFFER_ACCESS_ARB* = 0x000088BB - GL_BUFFER_MAPPED_ARB* = 0x000088BC - GL_BUFFER_MAP_POINTER_ARB* = 0x000088BD - GL_STREAM_DRAW_ARB* = 0x000088E0 - GL_STREAM_READ_ARB* = 0x000088E1 - GL_STREAM_COPY_ARB* = 0x000088E2 - GL_STATIC_DRAW_ARB* = 0x000088E4 - GL_STATIC_READ_ARB* = 0x000088E5 - GL_STATIC_COPY_ARB* = 0x000088E6 - GL_DYNAMIC_DRAW_ARB* = 0x000088E8 - GL_DYNAMIC_READ_ARB* = 0x000088E9 - GL_DYNAMIC_COPY_ARB* = 0x000088EA - -proc glBindBufferARB*(target: TGLenum, buffer: TGLuint){.dynlib: dllname, - importc: "glBindBufferARB".} -proc glDeleteBuffersARB*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, - importc: "glDeleteBuffersARB".} -proc glGenBuffersARB*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, - importc: "glGenBuffersARB".} -proc glIsBufferARB*(buffer: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsBufferARB".} -proc glBufferDataARB*(target: TGLenum, size: TGLsizei, data: PGLvoid, - usage: TGLenum){.dynlib: dllname, - importc: "glBufferDataARB".} -proc glBufferSubDataARB*(target: TGLenum, offset: TGLint, size: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glBufferSubDataARB".} -proc glGetBufferSubDataARB*(target: TGLenum, offset: TGLint, size: TGLsizei, - data: PGLvoid){.dynlib: dllname, - importc: "glGetBufferSubDataARB".} -proc glMapBufferARB*(target: TGLenum, access: TGLenum): PGLvoid{. - dynlib: dllname, importc: "glMapBufferARB".} -proc glUnmapBufferARB*(target: TGLenum): TGLboolean{.dynlib: dllname, - importc: "glUnmapBufferARB".} -proc glGetBufferParameterivARB*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetBufferParameterivARB".} -proc glGetBufferPointervARB*(target: TGLenum, pname: TGLenum, params: PPGLvoid){. - dynlib: dllname, importc: "glGetBufferPointervARB".} - #***** GL_APPLE_client_storage *****// -const - GL_UNPACK_CLIENT_STORAGE_APPLE* = 0x000085B2 - #***** GL_APPLE_element_array *****// - -const - GL_ELEMENT_ARRAY_APPLE* = 0x00008768 - GL_ELEMENT_ARRAY_TYPE_APPLE* = 0x00008769 - GL_ELEMENT_ARRAY_POINTER_APPLE* = 0x0000876A - -proc glElementPointerAPPLE*(thetype: TGLenum, pointer: PGLvoid){. - dynlib: dllname, importc: "glElementPointerAPPLE".} -proc glDrawElementArrayAPPLE*(mode: TGLenum, first: TGLint, count: TGLsizei){. - dynlib: dllname, importc: "glDrawElementArrayAPPLE".} -proc glDrawRangeElementArrayAPPLE*(mode: TGLenum, start: TGLuint, - theend: TGLuint, first: TGLint, - count: TGLsizei){.dynlib: dllname, - importc: "glDrawRangeElementArrayAPPLE".} -proc glMultiDrawElementArrayAPPLE*(mode: TGLenum, first: PGLint, - count: PGLsizei, primcount: TGLsizei){. - dynlib: dllname, importc: "glMultiDrawElementArrayAPPLE".} -proc glMultiDrawRangeElementArrayAPPLE*(mode: TGLenum, start: TGLuint, - theend: TGLuint, first: PGLint, - count: PGLsizei, primcount: TGLsizei){. - dynlib: dllname, importc: "glMultiDrawRangeElementArrayAPPLE".} - #***** GL_APPLE_fence *****// -const - GL_DRAW_PIXELS_APPLE* = 0x00008A0A - GL_FENCE_APPLE* = 0x00008A0B - -proc glGenFencesAPPLE*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, - importc: "glGenFencesAPPLE".} -proc glDeleteFencesAPPLE*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, - importc: "glDeleteFencesAPPLE".} -proc glSetFenceAPPLE*(fence: TGLuint){.dynlib: dllname, - importc: "glSetFenceAPPLE".} -proc glIsFenceAPPLE*(fence: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsFenceAPPLE".} -proc glTestFenceAPPLE*(fence: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glTestFenceAPPLE".} -proc glFinishFenceAPPLE*(fence: TGLuint){.dynlib: dllname, - importc: "glFinishFenceAPPLE".} -proc glTestObjectAPPLE*(theobject: TGLenum, name: TGLuint): TGLboolean{. - dynlib: dllname, importc: "glTestObjectAPPLE".} -proc glFinishObjectAPPLE*(theobject: TGLenum, name: TGLint){.dynlib: dllname, - importc: "glFinishObjectAPPLE".} - #***** GL_APPLE_vertex_array_object *****// -const - GL_VERTEX_ARRAY_BINDING_APPLE* = 0x000085B5 - -proc glBindVertexArrayAPPLE*(thearray: TGLuint){.dynlib: dllname, - importc: "glBindVertexArrayAPPLE".} -proc glDeleteVertexArraysAPPLE*(n: TGLsizei, arrays: PGLuint){.dynlib: dllname, - importc: "glDeleteVertexArraysAPPLE".} -proc glGenVertexArraysAPPLE*(n: TGLsizei, arrays: PGLuint){.dynlib: dllname, - importc: "glGenVertexArraysAPPLE".} -proc glIsVertexArrayAPPLE*(thearray: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsVertexArrayAPPLE".} - #***** GL_APPLE_vertex_array_range *****// -const - constGL_VERTEX_ARRAY_RANGE_APPLE* = 0x0000851D - GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE* = 0x0000851E - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE* = 0x00008520 - GL_VERTEX_ARRAY_RANGE_POINTER_APPLE* = 0x00008521 - GL_VERTEX_ARRAY_STORAGE_HINT_APPLE* = 0x0000851F - GL_STORAGE_CACHED_APPLE* = 0x000085BE - GL_STORAGE_SHARED_APPLE* = 0x000085BF - -proc glVertexArrayRangeAPPLE*(len: TGLsizei, pointer: PGLvoid){.dynlib: dllname, - importc: "glVertexArrayRangeAPPLE".} -proc glFlushVertexArrayRangeAPPLE*(len: TGLsizei, pointer: PGLvoid){. - dynlib: dllname, importc: "glFlushVertexArrayRangeAPPLE".} -proc glVertexArrayParameteriAPPLE*(pname: TGLenum, param: TGLint){. - dynlib: dllname, importc: "glVertexArrayParameteriAPPLE".} - #***** GL_ARB_matrix_palette *****// -const - GL_MATRIX_PALETTE_ARB* = 0x00008840 - GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB* = 0x00008841 - GL_MAX_PALETTE_MATRICES_ARB* = 0x00008842 - constGL_CURRENT_PALETTE_MATRIX_ARB* = 0x00008843 - GL_MATRIX_INDEX_ARRAY_ARB* = 0x00008844 - GL_CURRENT_MATRIX_INDEX_ARB* = 0x00008845 - GL_MATRIX_INDEX_ARRAY_SIZE_ARB* = 0x00008846 - GL_MATRIX_INDEX_ARRAY_TYPE_ARB* = 0x00008847 - GL_MATRIX_INDEX_ARRAY_STRIDE_ARB* = 0x00008848 - GL_MATRIX_INDEX_ARRAY_POINTER_ARB* = 0x00008849 - -proc glCurrentPaletteMatrixARB*(index: TGLint){.dynlib: dllname, - importc: "glCurrentPaletteMatrixARB".} -proc glMatrixIndexubvARB*(size: TGLint, indices: PGLubyte){.dynlib: dllname, - importc: "glMatrixIndexubvARB".} -proc glMatrixIndexusvARB*(size: TGLint, indices: PGLushort){.dynlib: dllname, - importc: "glMatrixIndexusvARB".} -proc glMatrixIndexuivARB*(size: TGLint, indices: PGLuint){.dynlib: dllname, - importc: "glMatrixIndexuivARB".} -proc glMatrixIndexPointerARB*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glMatrixIndexPointerARB".} - #***** GL_NV_element_array *****// -const - GL_ELEMENT_ARRAY_TYPE_NV* = 0x00008769 - GL_ELEMENT_ARRAY_POINTER_NV* = 0x0000876A - -proc glElementPointerNV*(thetype: TGLenum, pointer: PGLvoid){.dynlib: dllname, - importc: "glElementPointerNV".} -proc glDrawElementArrayNV*(mode: TGLenum, first: TGLint, count: TGLsizei){. - dynlib: dllname, importc: "glDrawElementArrayNV".} -proc glDrawRangeElementArrayNV*(mode: TGLenum, start: TGLuint, theend: TGLuint, - first: TGLint, count: TGLsizei){. - dynlib: dllname, importc: "glDrawRangeElementArrayNV".} -proc glMultiDrawElementArrayNV*(mode: TGLenum, first: PGLint, count: PGLsizei, - primcount: TGLsizei){.dynlib: dllname, - importc: "glMultiDrawElementArrayNV".} -proc glMultiDrawRangeElementArrayNV*(mode: TGLenum, start: TGLuint, - theend: TGLuint, first: PGLint, - count: PGLsizei, primcount: TGLsizei){. - dynlib: dllname, importc: "glMultiDrawRangeElementArrayNV".} - #***** GL_NV_float_buffer *****// -const - GL_FLOAT_R_NV* = 0x00008880 - GL_FLOAT_RG_NV* = 0x00008881 - GL_FLOAT_RGB_NV* = 0x00008882 - GL_FLOAT_RGBA_NV* = 0x00008883 - GL_FLOAT_R16_NV* = 0x00008884 - GL_FLOAT_R32_NV* = 0x00008885 - GL_FLOAT_RG16_NV* = 0x00008886 - GL_FLOAT_RG32_NV* = 0x00008887 - GL_FLOAT_RGB16_NV* = 0x00008888 - GL_FLOAT_RGB32_NV* = 0x00008889 - GL_FLOAT_RGBA16_NV* = 0x0000888A - GL_FLOAT_RGBA32_NV* = 0x0000888B - GL_TEXTURE_FLOAT_COMPONENTS_NV* = 0x0000888C - GL_FLOAT_CLEAR_COLOR_VALUE_NV* = 0x0000888D - GL_FLOAT_RGBA_MODE_NV* = 0x0000888E - #***** GL_NV_fragment_program *****// - -const - GL_FRAGMENT_PROGRAM_NV* = 0x00008870 - GL_MAX_TEXTURE_COORDS_NV* = 0x00008871 - GL_MAX_TEXTURE_IMAGE_UNITS_NV* = 0x00008872 - GL_FRAGMENT_PROGRAM_BINDING_NV* = 0x00008873 - GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV* = 0x00008868 - GL_PROGRAM_ERROR_STRING_NV* = 0x00008874 - -proc glProgramNamedParameter4fNV*(id: TGLuint, length: TGLsizei, name: PGLubyte, - x: TGLfloat, y: TGLfloat, z: TGLfloat, - w: TGLfloat){.dynlib: dllname, - importc: "glProgramNamedParameter4fNV".} -proc glProgramNamedParameter4dNV*(id: TGLuint, length: TGLsizei, name: PGLubyte, - x: TGLdouble, y: TGLdouble, z: TGLdouble, - w: TGLdouble){.dynlib: dllname, - importc: "glProgramNamedParameter4dNV".} -proc glGetProgramNamedParameterfvNV*(id: TGLuint, length: TGLsizei, - name: PGLubyte, params: PGLfloat){. - dynlib: dllname, importc: "glGetProgramNamedParameterfvNV".} -proc glGetProgramNamedParameterdvNV*(id: TGLuint, length: TGLsizei, - name: PGLubyte, params: PGLdouble){. - dynlib: dllname, importc: "glGetProgramNamedParameterdvNV".} - # glProgramLocalParameter4dARB { already defined } - # glProgramLocalParameter4dvARB { already defined } - # glProgramLocalParameter4fARB { already defined } - # glProgramLocalParameter4fvARB { already defined } - # glGetProgramLocalParameterdvARB { already defined } - # glGetProgramLocalParameterfvARB { already defined } - #***** GL_NV_primitive_restart *****// -const - constGL_PRIMITIVE_RESTART_NV* = 0x00008558 - constGL_PRIMITIVE_RESTART_INDEX_NV* = 0x00008559 - -proc glPrimitiveRestartNV*(){.dynlib: dllname, importc: "glPrimitiveRestartNV".} -proc glPrimitiveRestartIndexNV*(index: TGLuint){.dynlib: dllname, - importc: "glPrimitiveRestartIndexNV".} - #***** GL_NV_vertex_program2 *****// - #***** GL_NV_pixel_data_range *****// -const - GL_WRITE_PIXEL_DATA_RANGE_NV* = 0x00008878 - GL_READ_PIXEL_DATA_RANGE_NV* = 0x00008879 - GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV* = 0x0000887A - GL_READ_PIXEL_DATA_RANGE_LENGTH_NV* = 0x0000887B - GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV* = 0x0000887C - GL_READ_PIXEL_DATA_RANGE_POINTER_NV* = 0x0000887D - -proc glPixelDataRangeNV*(target: TGLenum, len: TGLsizei, pointer: PGLvoid){. - dynlib: dllname, importc: "glPixelDataRangeNV".} -proc glFlushPixelDataRangeNV*(target: TGLenum){.dynlib: dllname, - importc: "glFlushPixelDataRangeNV".} - # wglAllocateMemoryNV { already defined } - # wglFreeMemoryNV { already defined } - #***** GL_EXT_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_EXT* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE_EXT* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE_EXT* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT* = 0x000084F8 - #***** GL_S3_s3tc *****// - -const - GL_RGB_S3TC* = 0x000083A0 - GL_RGB4_S3TC* = 0x000083A1 - GL_RGBA_S3TC* = 0x000083A2 - GL_RGBA4_S3TC* = 0x000083A3 - #***** GL_ATI_draw_buffers *****// - -const - GL_MAX_DRAW_BUFFERS_ATI* = 0x00008824 - GL_DRAW_BUFFER0_ATI* = 0x00008825 - GL_DRAW_BUFFER1_ATI* = 0x00008826 - GL_DRAW_BUFFER2_ATI* = 0x00008827 - GL_DRAW_BUFFER3_ATI* = 0x00008828 - GL_DRAW_BUFFER4_ATI* = 0x00008829 - GL_DRAW_BUFFER5_ATI* = 0x0000882A - GL_DRAW_BUFFER6_ATI* = 0x0000882B - GL_DRAW_BUFFER7_ATI* = 0x0000882C - GL_DRAW_BUFFER8_ATI* = 0x0000882D - GL_DRAW_BUFFER9_ATI* = 0x0000882E - GL_DRAW_BUFFER10_ATI* = 0x0000882F - GL_DRAW_BUFFER11_ATI* = 0x00008830 - GL_DRAW_BUFFER12_ATI* = 0x00008831 - GL_DRAW_BUFFER13_ATI* = 0x00008832 - GL_DRAW_BUFFER14_ATI* = 0x00008833 - GL_DRAW_BUFFER15_ATI* = 0x00008834 - -proc glDrawBuffersATI*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname, - importc: "glDrawBuffersATI".} - #***** GL_ATI_texture_env_combine3 *****// -const - GL_MODULATE_ADD_ATI* = 0x00008744 - GL_MODULATE_SIGNED_ADD_ATI* = 0x00008745 - GL_MODULATE_SUBTRACT_ATI* = 0x00008746 - #***** GL_ATI_texture_float *****// - -const - GL_RGBA_FLOAT32_ATI* = 0x00008814 - GL_RGB_FLOAT32_ATI* = 0x00008815 - GL_ALPHA_FLOAT32_ATI* = 0x00008816 - GL_INTENSITY_FLOAT32_ATI* = 0x00008817 - GL_LUMINANCE_FLOAT32_ATI* = 0x00008818 - GL_LUMINANCE_ALPHA_FLOAT32_ATI* = 0x00008819 - GL_RGBA_FLOAT16_ATI* = 0x0000881A - GL_RGB_FLOAT16_ATI* = 0x0000881B - GL_ALPHA_FLOAT16_ATI* = 0x0000881C - GL_INTENSITY_FLOAT16_ATI* = 0x0000881D - GL_LUMINANCE_FLOAT16_ATI* = 0x0000881E - GL_LUMINANCE_ALPHA_FLOAT16_ATI* = 0x0000881F - #***** GL_NV_texture_expand_normal *****// - -const - GL_TEXTURE_UNSIGNED_REMAP_MODE_NV* = 0x0000888F - #***** GL_NV_half_float *****// - -const - GL_HALF_FLOAT_NV* = 0x0000140B - -proc glVertex2hNV*(x: TGLushort, y: TGLushort){.dynlib: dllname, - importc: "glVertex2hNV".} -proc glVertex2hvNV*(v: PGLushort){.dynlib: dllname, importc: "glVertex2hvNV".} -proc glVertex3hNV*(x: TGLushort, y: TGLushort, z: TGLushort){.dynlib: dllname, - importc: "glVertex3hNV".} -proc glVertex3hvNV*(v: PGLushort){.dynlib: dllname, importc: "glVertex3hvNV".} -proc glVertex4hNV*(x: TGLushort, y: TGLushort, z: TGLushort, w: TGLushort){. - dynlib: dllname, importc: "glVertex4hNV".} -proc glVertex4hvNV*(v: PGLushort){.dynlib: dllname, importc: "glVertex4hvNV".} -proc glNormal3hNV*(nx: TGLushort, ny: TGLushort, nz: TGLushort){. - dynlib: dllname, importc: "glNormal3hNV".} -proc glNormal3hvNV*(v: PGLushort){.dynlib: dllname, importc: "glNormal3hvNV".} -proc glColor3hNV*(red: TGLushort, green: TGLushort, blue: TGLushort){. - dynlib: dllname, importc: "glColor3hNV".} -proc glColor3hvNV*(v: PGLushort){.dynlib: dllname, importc: "glColor3hvNV".} -proc glColor4hNV*(red: TGLushort, green: TGLushort, blue: TGLushort, - alpha: TGLushort){.dynlib: dllname, importc: "glColor4hNV".} -proc glColor4hvNV*(v: PGLushort){.dynlib: dllname, importc: "glColor4hvNV".} -proc glTexCoord1hNV*(s: TGLushort){.dynlib: dllname, importc: "glTexCoord1hNV".} -proc glTexCoord1hvNV*(v: PGLushort){.dynlib: dllname, importc: "glTexCoord1hvNV".} -proc glTexCoord2hNV*(s: TGLushort, t: TGLushort){.dynlib: dllname, - importc: "glTexCoord2hNV".} -proc glTexCoord2hvNV*(v: PGLushort){.dynlib: dllname, importc: "glTexCoord2hvNV".} -proc glTexCoord3hNV*(s: TGLushort, t: TGLushort, r: TGLushort){.dynlib: dllname, - importc: "glTexCoord3hNV".} -proc glTexCoord3hvNV*(v: PGLushort){.dynlib: dllname, importc: "glTexCoord3hvNV".} -proc glTexCoord4hNV*(s: TGLushort, t: TGLushort, r: TGLushort, q: TGLushort){. - dynlib: dllname, importc: "glTexCoord4hNV".} -proc glTexCoord4hvNV*(v: PGLushort){.dynlib: dllname, importc: "glTexCoord4hvNV".} -proc glMultiTexCoord1hNV*(target: TGLenum, s: TGLushort){.dynlib: dllname, - importc: "glMultiTexCoord1hNV".} -proc glMultiTexCoord1hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, - importc: "glMultiTexCoord1hvNV".} -proc glMultiTexCoord2hNV*(target: TGLenum, s: TGLushort, t: TGLushort){. - dynlib: dllname, importc: "glMultiTexCoord2hNV".} -proc glMultiTexCoord2hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, - importc: "glMultiTexCoord2hvNV".} -proc glMultiTexCoord3hNV*(target: TGLenum, s: TGLushort, t: TGLushort, - r: TGLushort){.dynlib: dllname, - importc: "glMultiTexCoord3hNV".} -proc glMultiTexCoord3hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, - importc: "glMultiTexCoord3hvNV".} -proc glMultiTexCoord4hNV*(target: TGLenum, s: TGLushort, t: TGLushort, - r: TGLushort, q: TGLushort){.dynlib: dllname, - importc: "glMultiTexCoord4hNV".} -proc glMultiTexCoord4hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, - importc: "glMultiTexCoord4hvNV".} -proc glFogCoordhNV*(fog: TGLushort){.dynlib: dllname, importc: "glFogCoordhNV".} -proc glFogCoordhvNV*(fog: PGLushort){.dynlib: dllname, importc: "glFogCoordhvNV".} -proc glSecondaryColor3hNV*(red: TGLushort, green: TGLushort, blue: TGLushort){. - dynlib: dllname, importc: "glSecondaryColor3hNV".} -proc glSecondaryColor3hvNV*(v: PGLushort){.dynlib: dllname, - importc: "glSecondaryColor3hvNV".} -proc glVertexWeighthNV*(weight: TGLushort){.dynlib: dllname, - importc: "glVertexWeighthNV".} -proc glVertexWeighthvNV*(weight: PGLushort){.dynlib: dllname, - importc: "glVertexWeighthvNV".} -proc glVertexAttrib1hNV*(index: TGLuint, x: TGLushort){.dynlib: dllname, - importc: "glVertexAttrib1hNV".} -proc glVertexAttrib1hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib1hvNV".} -proc glVertexAttrib2hNV*(index: TGLuint, x: TGLushort, y: TGLushort){. - dynlib: dllname, importc: "glVertexAttrib2hNV".} -proc glVertexAttrib2hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib2hvNV".} -proc glVertexAttrib3hNV*(index: TGLuint, x: TGLushort, y: TGLushort, - z: TGLushort){.dynlib: dllname, - importc: "glVertexAttrib3hNV".} -proc glVertexAttrib3hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib3hvNV".} -proc glVertexAttrib4hNV*(index: TGLuint, x: TGLushort, y: TGLushort, - z: TGLushort, w: TGLushort){.dynlib: dllname, - importc: "glVertexAttrib4hNV".} -proc glVertexAttrib4hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, - importc: "glVertexAttrib4hvNV".} -proc glVertexAttribs1hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){. - dynlib: dllname, importc: "glVertexAttribs1hvNV".} -proc glVertexAttribs2hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){. - dynlib: dllname, importc: "glVertexAttribs2hvNV".} -proc glVertexAttribs3hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){. - dynlib: dllname, importc: "glVertexAttribs3hvNV".} -proc glVertexAttribs4hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){. - dynlib: dllname, importc: "glVertexAttribs4hvNV".} - #***** GL_ATI_map_object_buffer *****// -proc glMapObjectBufferATI*(buffer: TGLuint): PGLvoid{.dynlib: dllname, - importc: "glMapObjectBufferATI".} -proc glUnmapObjectBufferATI*(buffer: TGLuint){.dynlib: dllname, - importc: "glUnmapObjectBufferATI".} - #***** GL_ATI_separate_stencil *****// -const - GL_KEEP* = 0x00001E00 - GL_ZERO* = 0x00000000 - GL_REPLACE* = 0x00001E01 - GL_INCR* = 0x00001E02 - GL_DECR* = 0x00001E03 - GL_INVERT* = 0x0000150A - GL_NEVER* = 0x00000200 - GL_LESS* = 0x00000201 - GL_LEQUAL* = 0x00000203 - GL_GREATER* = 0x00000204 - GL_GEQUAL* = 0x00000206 - GL_EQUAL* = 0x00000202 - GL_NOTEQUAL* = 0x00000205 - GL_ALWAYS* = 0x00000207 - GL_FRONT* = 0x00000404 - GL_BACK* = 0x00000405 - GL_FRONT_AND_BACK* = 0x00000408 - GL_STENCIL_BACK_FUNC_ATI* = 0x00008800 - GL_STENCIL_BACK_FAIL_ATI* = 0x00008801 - GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI* = 0x00008802 - GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI* = 0x00008803 - -proc glStencilOpSeparateATI*(face: TGLenum, sfail: TGLenum, dpfail: TGLenum, - dppass: TGLenum){.dynlib: dllname, - importc: "glStencilOpSeparateATI".} -proc glStencilFuncSeparateATI*(frontfunc: TGLenum, backfunc: TGLenum, - theRef: TGLint, mask: TGLuint){.dynlib: dllname, - importc: "glStencilFuncSeparateATI".} - #***** GL_ATI_vertex_attrib_array_object *****// -proc glVertexAttribArrayObjectATI*(index: TGLuint, size: TGLint, - thetype: TGLenum, normalized: TGLboolean, - stride: TGLsizei, buffer: TGLuint, - offset: TGLuint){.dynlib: dllname, - importc: "glVertexAttribArrayObjectATI".} -proc glGetVertexAttribArrayObjectfvATI*(index: TGLuint, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetVertexAttribArrayObjectfvATI".} -proc glGetVertexAttribArrayObjectivATI*(index: TGLuint, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetVertexAttribArrayObjectivATI".} - #***** GL_ARB_occlusion_query *****// -const - GL_SAMPLES_PASSED_ARB* = 0x00008914 - GL_QUERY_COUNTER_BITS_ARB* = 0x00008864 - GL_CURRENT_QUERY_ARB* = 0x00008865 - GL_QUERY_RESULT_ARB* = 0x00008866 - GL_QUERY_RESULT_AVAILABLE_ARB* = 0x00008867 - -proc glGenQueriesARB*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glGenQueriesARB".} -proc glDeleteQueriesARB*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glDeleteQueriesARB".} -proc glIsQueryARB*(id: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsQueryARB".} -proc glBeginQueryARB*(target: TGLenum, id: TGLuint){.dynlib: dllname, - importc: "glBeginQueryARB".} -proc glEndQueryARB*(target: TGLenum){.dynlib: dllname, importc: "glEndQueryARB".} -proc glGetQueryivARB*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetQueryivARB".} -proc glGetQueryObjectivARB*(id: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetQueryObjectivARB".} -proc glGetQueryObjectuivARB*(id: TGLuint, pname: TGLenum, params: PGLuint){. - dynlib: dllname, importc: "glGetQueryObjectuivARB".} - #***** GL_ARB_shader_objects *****// -const - GL_PROGRAM_OBJECT_ARB* = 0x00008B40 - GL_OBJECT_TYPE_ARB* = 0x00008B4E - GL_OBJECT_SUBTYPE_ARB* = 0x00008B4F - GL_OBJECT_DELETE_STATUS_ARB* = 0x00008B80 - GL_OBJECT_COMPILE_STATUS_ARB* = 0x00008B81 - GL_OBJECT_LINK_STATUS_ARB* = 0x00008B82 - GL_OBJECT_VALIDATE_STATUS_ARB* = 0x00008B83 - GL_OBJECT_INFO_LOG_LENGTH_ARB* = 0x00008B84 - GL_OBJECT_ATTACHED_OBJECTS_ARB* = 0x00008B85 - GL_OBJECT_ACTIVE_UNIFORMS_ARB* = 0x00008B86 - GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB* = 0x00008B87 - GL_OBJECT_SHADER_SOURCE_LENGTH_ARB* = 0x00008B88 - GL_SHADER_OBJECT_ARB* = 0x00008B48 - GL_FLOAT* = 0x00001406 - GL_FLOAT_VEC2_ARB* = 0x00008B50 - GL_FLOAT_VEC3_ARB* = 0x00008B51 - GL_FLOAT_VEC4_ARB* = 0x00008B52 - GL_INT* = 0x00001404 - GL_INT_VEC2_ARB* = 0x00008B53 - GL_INT_VEC3_ARB* = 0x00008B54 - GL_INT_VEC4_ARB* = 0x00008B55 - GL_BOOL_ARB* = 0x00008B56 - GL_BOOL_VEC2_ARB* = 0x00008B57 - GL_BOOL_VEC3_ARB* = 0x00008B58 - GL_BOOL_VEC4_ARB* = 0x00008B59 - GL_FLOAT_MAT2_ARB* = 0x00008B5A - GL_FLOAT_MAT3_ARB* = 0x00008B5B - GL_FLOAT_MAT4_ARB* = 0x00008B5C - -proc glDeleteObjectARB*(obj: GLhandleARB){.dynlib: dllname, - importc: "glDeleteObjectARB".} -proc glGetHandleARB*(pname: TGLenum): GLhandleARB{.dynlib: dllname, - importc: "glGetHandleARB".} -proc glDetachObjectARB*(containerObj: GLhandleARB, attachedObj: GLhandleARB){. - dynlib: dllname, importc: "glDetachObjectARB".} -proc glCreateShaderObjectARB*(shaderType: TGLenum): GLhandleARB{. - dynlib: dllname, importc: "glCreateShaderObjectARB".} -proc glShaderSourceARB*(shaderObj: GLhandleARB, count: TGLsizei, str: PGLvoid, - len: PGLint){.dynlib: dllname, - importc: "glShaderSourceARB".} -proc glCompileShaderARB*(shaderObj: GLhandleARB){.dynlib: dllname, - importc: "glCompileShaderARB".} -proc glCreateProgramObjectARB*(): GLhandleARB{.dynlib: dllname, - importc: "glCreateProgramObjectARB".} -proc glAttachObjectARB*(containerObj: GLhandleARB, obj: GLhandleARB){. - dynlib: dllname, importc: "glAttachObjectARB".} -proc glLinkProgramARB*(programObj: GLhandleARB){.dynlib: dllname, - importc: "glLinkProgramARB".} -proc glUseProgramObjectARB*(programObj: GLhandleARB){.dynlib: dllname, - importc: "glUseProgramObjectARB".} -proc glValidateProgramARB*(programObj: GLhandleARB){.dynlib: dllname, - importc: "glValidateProgramARB".} -proc glUniform1fARB*(location: TGLint, v0: TGLfloat){.dynlib: dllname, - importc: "glUniform1fARB".} -proc glUniform2fARB*(location: TGLint, v0: TGLfloat, v1: TGLfloat){. - dynlib: dllname, importc: "glUniform2fARB".} -proc glUniform3fARB*(location: TGLint, v0: TGLfloat, v1: TGLfloat, v2: TGLfloat){. - dynlib: dllname, importc: "glUniform3fARB".} -proc glUniform4fARB*(location: TGLint, v0: TGLfloat, v1: TGLfloat, v2: TGLfloat, - v3: TGLfloat){.dynlib: dllname, importc: "glUniform4fARB".} -proc glUniform1iARB*(location: TGLint, v0: TGLint){.dynlib: dllname, - importc: "glUniform1iARB".} -proc glUniform2iARB*(location: TGLint, v0: TGLint, v1: TGLint){.dynlib: dllname, - importc: "glUniform2iARB".} -proc glUniform3iARB*(location: TGLint, v0: TGLint, v1: TGLint, v2: TGLint){. - dynlib: dllname, importc: "glUniform3iARB".} -proc glUniform4iARB*(location: TGLint, v0: TGLint, v1: TGLint, v2: TGLint, - v3: TGLint){.dynlib: dllname, importc: "glUniform4iARB".} -proc glUniform1fvARB*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform1fvARB".} -proc glUniform2fvARB*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform2fvARB".} -proc glUniform3fvARB*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform3fvARB".} -proc glUniform4fvARB*(location: TGLint, count: TGLsizei, value: PGLfloat){. - dynlib: dllname, importc: "glUniform4fvARB".} -proc glUniform1ivARB*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform1ivARB".} -proc glUniform2ivARB*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform2ivARB".} -proc glUniform3ivARB*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform3ivARB".} -proc glUniform4ivARB*(location: TGLint, count: TGLsizei, value: PGLint){. - dynlib: dllname, importc: "glUniform4ivARB".} -proc glUniformMatrix2fvARB*(location: TGLint, count: TGLsizei, - transpose: TGLboolean, value: PGLfloat){. - dynlib: dllname, importc: "glUniformMatrix2fvARB".} -proc glUniformMatrix3fvARB*(location: TGLint, count: TGLsizei, - transpose: TGLboolean, value: PGLfloat){. - dynlib: dllname, importc: "glUniformMatrix3fvARB".} -proc glUniformMatrix4fvARB*(location: TGLint, count: TGLsizei, - transpose: TGLboolean, value: PGLfloat){. - dynlib: dllname, importc: "glUniformMatrix4fvARB".} -proc glGetObjectParameterfvARB*(obj: GLhandleARB, pname: TGLenum, - params: PGLfloat){.dynlib: dllname, - importc: "glGetObjectParameterfvARB".} -proc glGetObjectParameterivARB*(obj: GLhandleARB, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetObjectParameterivARB".} -proc glGetInfoLogARB*(obj: GLhandleARB, maxLength: TGLsizei, len: PGLsizei, - infoLog: PGLcharARB){.dynlib: dllname, - importc: "glGetInfoLogARB".} -proc glGetAttachedObjectsARB*(containerObj: GLhandleARB, maxCount: TGLsizei, - count: PGLsizei, obj: PGLhandleARB){. - dynlib: dllname, importc: "glGetAttachedObjectsARB".} -proc glGetUniformLocationARB*(programObj: GLhandleARB, name: PGLcharARB): TGLint{. - dynlib: dllname, importc: "glGetUniformLocationARB".} -proc glGetActiveUniformARB*(programObj: GLhandleARB, index: TGLuint, - maxLength: TGLsizei, len: PGLsizei, size: PGLint, - thetype: PGLenum, name: PGLcharARB){. - dynlib: dllname, importc: "glGetActiveUniformARB".} -proc glGetUniformfvARB*(programObj: GLhandleARB, location: TGLint, - params: PGLfloat){.dynlib: dllname, - importc: "glGetUniformfvARB".} -proc glGetUniformivARB*(programObj: GLhandleARB, location: TGLint, - params: PGLint){.dynlib: dllname, - importc: "glGetUniformivARB".} -proc glGetShaderSourceARB*(obj: GLhandleARB, maxLength: TGLsizei, len: PGLsizei, - source: PGLcharARB){.dynlib: dllname, - importc: "glGetShaderSourceARB".} -const - GL_VERTEX_SHADER_ARB* = 0x00008B31 - GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB* = 0x00008B4A - GL_MAX_VARYING_FLOATS_ARB* = 0x00008B4B # GL_MAX_VERTEX_ATTRIBS_ARB { already defined } - # GL_MAX_TEXTURE_IMAGE_UNITS_ARB { already defined } - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB* = 0x00008B4C - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB* = 0x00008B4D # - # - # 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* = 0x00008B89 - GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB* = 0x00008B8A # 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 } - -proc glBindAttribLocationARB*(programObj: GLhandleARB, index: TGLuint, - name: PGLcharARB){.dynlib: dllname, - importc: "glBindAttribLocationARB".} -proc glGetActiveAttribARB*(programObj: GLhandleARB, index: TGLuint, - maxLength: TGLsizei, len: PGLsizei, size: PGLint, - thetype: PGLenum, name: PGLcharARB){.dynlib: dllname, - importc: "glGetActiveAttribARB".} -proc glGetAttribLocationARB*(programObj: GLhandleARB, name: PGLcharARB): TGLint{. - dynlib: dllname, importc: "glGetAttribLocationARB".} - # glGetVertexAttribdvARB { already defined } - # glGetVertexAttribfvARB { already defined } - # glGetVertexAttribivARB { already defined } - # glGetVertexAttribPointervARB { already defined } - #***** GL_ARB_fragment_shader *****// -const - GL_FRAGMENT_SHADER_ARB* = 0x00008B30 - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB* = 0x00008B49 # 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 } - #***** GL_ARB_shading_language_100 *****// - #***** GL_ARB_texture_non_power_of_two *****// - #***** GL_ARB_point_sprite *****// - -const - GL_POINT_SPRITE_ARB* = 0x00008861 - GL_COORD_REPLACE_ARB* = 0x00008862 - #***** GL_EXT_depth_bounds_test *****// - -const - constGL_DEPTH_BOUNDS_TEST_EXT* = 0x00008890 - constGL_DEPTH_BOUNDS_EXT* = 0x00008891 - -proc glDepthBoundsEXT*(zmin: TGLclampd, zmax: TGLclampd){.dynlib: dllname, - importc: "glDepthBoundsEXT".} - #***** GL_EXT_texture_mirror_clamp *****// -const - GL_MIRROR_CLAMP_EXT* = 0x00008742 - GL_MIRROR_CLAMP_TO_EDGE_EXT* = 0x00008743 - GL_MIRROR_CLAMP_TO_BORDER_EXT* = 0x00008912 - #***** GL_EXT_blend_equation_separate *****// - -const - GL_BLEND_EQUATION_RGB_EXT* = 0x00008009 - GL_BLEND_EQUATION_ALPHA_EXT* = 0x0000883D - -proc glBlendEquationSeparateEXT*(modeRGB: TGLenum, modeAlpha: TGLenum){. - dynlib: dllname, importc: "glBlendEquationSeparateEXT".} - #***** GL_MESA_pack_invert *****// -const - GL_PACK_INVERT_MESA* = 0x00008758 - #***** GL_MESA_ycbcr_texture *****// - -const - GL_YCBCR_MESA* = 0x00008757 - GL_UNSIGNED_SHORT_8_8_MESA* = 0x000085BA - GL_UNSIGNED_SHORT_8_8_REV_MESA* = 0x000085BB - #***** GL_ARB_fragment_program_shadow *****// - #***** GL_NV_fragment_program_option *****// - #***** GL_EXT_pixel_buffer_object *****// - -const - GL_PIXEL_PACK_BUFFER_EXT* = 0x000088EB - GL_PIXEL_UNPACK_BUFFER_EXT* = 0x000088EC - GL_PIXEL_PACK_BUFFER_BINDING_EXT* = 0x000088ED - GL_PIXEL_UNPACK_BUFFER_BINDING_EXT* = 0x000088EF - #***** GL_NV_fragment_program2 *****// - -const - GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV* = 0x000088F4 - GL_MAX_PROGRAM_CALL_DEPTH_NV* = 0x000088F5 - GL_MAX_PROGRAM_IF_DEPTH_NV* = 0x000088F6 - GL_MAX_PROGRAM_LOOP_DEPTH_NV* = 0x000088F7 - GL_MAX_PROGRAM_LOOP_COUNT_NV* = 0x000088F8 - #***** GL_NV_vertex_program2_option *****// - # GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV { already defined } - # GL_MAX_PROGRAM_CALL_DEPTH_NV { already defined } - #***** GL_NV_vertex_program3 *****// - # GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB { already defined } - #***** GL_ARB_draw_buffers *****// - -const - GL_MAX_DRAW_BUFFERS_ARB* = 0x00008824 - GL_DRAW_BUFFER0_ARB* = 0x00008825 - GL_DRAW_BUFFER1_ARB* = 0x00008826 - GL_DRAW_BUFFER2_ARB* = 0x00008827 - GL_DRAW_BUFFER3_ARB* = 0x00008828 - GL_DRAW_BUFFER4_ARB* = 0x00008829 - GL_DRAW_BUFFER5_ARB* = 0x0000882A - GL_DRAW_BUFFER6_ARB* = 0x0000882B - GL_DRAW_BUFFER7_ARB* = 0x0000882C - GL_DRAW_BUFFER8_ARB* = 0x0000882D - GL_DRAW_BUFFER9_ARB* = 0x0000882E - GL_DRAW_BUFFER10_ARB* = 0x0000882F - GL_DRAW_BUFFER11_ARB* = 0x00008830 - GL_DRAW_BUFFER12_ARB* = 0x00008831 - GL_DRAW_BUFFER13_ARB* = 0x00008832 - GL_DRAW_BUFFER14_ARB* = 0x00008833 - GL_DRAW_BUFFER15_ARB* = 0x00008834 - -proc glDrawBuffersARB*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname, - importc: "glDrawBuffersARB".} - #***** GL_ARB_texture_rectangle *****// -const - GL_TEXTURE_RECTANGLE_ARB* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE_ARB* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE_ARB* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB* = 0x000084F8 - #***** GL_ARB_color_buffer_float *****// - -const - GL_RGBA_FLOAT_MODE_ARB* = 0x00008820 - GL_CLAMP_VERTEX_COLOR_ARB* = 0x0000891A - GL_CLAMP_FRAGMENT_COLOR_ARB* = 0x0000891B - GL_CLAMP_READ_COLOR_ARB* = 0x0000891C - GL_FIXED_ONLY_ARB* = 0x0000891D - WGL_TYPE_RGBA_FLOAT_ARB* = 0x000021A0 - -proc glClampColorARB*(target: TGLenum, clamp: TGLenum){.dynlib: dllname, - importc: "glClampColorARB".} - #***** GL_ARB_half_float_pixel *****// -const - GL_HALF_FLOAT_ARB* = 0x0000140B - #***** GL_ARB_texture_float *****// - -const - GL_TEXTURE_RED_TYPE_ARB* = 0x00008C10 - GL_TEXTURE_GREEN_TYPE_ARB* = 0x00008C11 - GL_TEXTURE_BLUE_TYPE_ARB* = 0x00008C12 - GL_TEXTURE_ALPHA_TYPE_ARB* = 0x00008C13 - GL_TEXTURE_LUMINANCE_TYPE_ARB* = 0x00008C14 - GL_TEXTURE_INTENSITY_TYPE_ARB* = 0x00008C15 - GL_TEXTURE_DEPTH_TYPE_ARB* = 0x00008C16 - GL_UNSIGNED_NORMALIZED_ARB* = 0x00008C17 - GL_RGBA32F_ARB* = 0x00008814 - GL_RGB32F_ARB* = 0x00008815 - GL_ALPHA32F_ARB* = 0x00008816 - GL_INTENSITY32F_ARB* = 0x00008817 - GL_LUMINANCE32F_ARB* = 0x00008818 - GL_LUMINANCE_ALPHA32F_ARB* = 0x00008819 - GL_RGBA16F_ARB* = 0x0000881A - GL_RGB16F_ARB* = 0x0000881B - GL_ALPHA16F_ARB* = 0x0000881C - GL_INTENSITY16F_ARB* = 0x0000881D - GL_LUMINANCE16F_ARB* = 0x0000881E - GL_LUMINANCE_ALPHA16F_ARB* = 0x0000881F - #***** GL_EXT_texture_compression_dxt1 *****// - # GL_COMPRESSED_RGB_S3TC_DXT1_EXT { already defined } - # GL_COMPRESSED_RGBA_S3TC_DXT1_EXT { already defined } - #***** GL_ARB_pixel_buffer_object *****// - -const - GL_PIXEL_PACK_BUFFER_ARB* = 0x000088EB - GL_PIXEL_UNPACK_BUFFER_ARB* = 0x000088EC - GL_PIXEL_PACK_BUFFER_BINDING_ARB* = 0x000088ED - GL_PIXEL_UNPACK_BUFFER_BINDING_ARB* = 0x000088EF - #***** GL_EXT_framebuffer_object *****// - -const - GL_FRAMEBUFFER_EXT* = 0x00008D40 - GL_RENDERBUFFER_EXT* = 0x00008D41 - GL_STENCIL_INDEX_EXT* = 0x00008D45 - GL_STENCIL_INDEX1_EXT* = 0x00008D46 - GL_STENCIL_INDEX4_EXT* = 0x00008D47 - GL_STENCIL_INDEX8_EXT* = 0x00008D48 - GL_STENCIL_INDEX16_EXT* = 0x00008D49 - GL_RENDERBUFFER_WIDTH_EXT* = 0x00008D42 - GL_RENDERBUFFER_HEIGHT_EXT* = 0x00008D43 - GL_RENDERBUFFER_INTERNAL_FORMAT_EXT* = 0x00008D44 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT* = 0x00008CD0 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT* = 0x00008CD1 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT* = 0x00008CD2 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT* = 0x00008CD3 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT* = 0x00008CD4 - GL_COLOR_ATTACHMENT0_EXT* = 0x00008CE0 - GL_COLOR_ATTACHMENT1_EXT* = 0x00008CE1 - GL_COLOR_ATTACHMENT2_EXT* = 0x00008CE2 - GL_COLOR_ATTACHMENT3_EXT* = 0x00008CE3 - GL_COLOR_ATTACHMENT4_EXT* = 0x00008CE4 - GL_COLOR_ATTACHMENT5_EXT* = 0x00008CE5 - GL_COLOR_ATTACHMENT6_EXT* = 0x00008CE6 - GL_COLOR_ATTACHMENT7_EXT* = 0x00008CE7 - GL_COLOR_ATTACHMENT8_EXT* = 0x00008CE8 - GL_COLOR_ATTACHMENT9_EXT* = 0x00008CE9 - GL_COLOR_ATTACHMENT10_EXT* = 0x00008CEA - GL_COLOR_ATTACHMENT11_EXT* = 0x00008CEB - GL_COLOR_ATTACHMENT12_EXT* = 0x00008CEC - GL_COLOR_ATTACHMENT13_EXT* = 0x00008CED - GL_COLOR_ATTACHMENT14_EXT* = 0x00008CEE - GL_COLOR_ATTACHMENT15_EXT* = 0x00008CEF - GL_DEPTH_ATTACHMENT_EXT* = 0x00008D00 - GL_STENCIL_ATTACHMENT_EXT* = 0x00008D20 - GL_FRAMEBUFFER_COMPLETE_EXT* = 0x00008CD5 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT* = 0x00008CD6 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT* = 0x00008CD7 - GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT* = 0x00008CD8 - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT* = 0x00008CD9 - GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT* = 0x00008CDA - GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT* = 0x00008CDB - GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT* = 0x00008CDC - GL_FRAMEBUFFER_UNSUPPORTED_EXT* = 0x00008CDD - GL_FRAMEBUFFER_STATUS_ERROR_EXT* = 0x00008CDE - GL_FRAMEBUFFER_BINDING_EXT* = 0x00008CA6 - GL_RENDERBUFFER_BINDING_EXT* = 0x00008CA7 - GL_MAX_COLOR_ATTACHMENTS_EXT* = 0x00008CDF - GL_MAX_RENDERBUFFER_SIZE_EXT* = 0x000084E8 - GL_INVALID_FRAMEBUFFER_OPERATION_EXT* = 0x00000506 - -proc glIsRenderbufferEXT*(renderbuffer: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsRenderbufferEXT".} -proc glBindRenderbufferEXT*(target: TGLenum, renderbuffer: TGLuint){. - dynlib: dllname, importc: "glBindRenderbufferEXT".} -proc glDeleteRenderbuffersEXT*(n: TGLsizei, renderbuffers: PGLuint){. - dynlib: dllname, importc: "glDeleteRenderbuffersEXT".} -proc glGenRenderbuffersEXT*(n: TGLsizei, renderbuffers: PGLuint){. - dynlib: dllname, importc: "glGenRenderbuffersEXT".} -proc glRenderbufferStorageEXT*(target: TGLenum, internalformat: TGLenum, - width: TGLsizei, height: TGLsizei){. - dynlib: dllname, importc: "glRenderbufferStorageEXT".} -proc glGetRenderbufferParameterivEXT*(target: TGLenum, pname: TGLenum, - params: PGLint){.dynlib: dllname, - importc: "glGetRenderbufferParameterivEXT".} -proc glIsFramebufferEXT*(framebuffer: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsFramebufferEXT".} -proc glBindFramebufferEXT*(target: TGLenum, framebuffer: TGLuint){. - dynlib: dllname, importc: "glBindFramebufferEXT".} -proc glDeleteFramebuffersEXT*(n: TGLsizei, framebuffers: PGLuint){. - dynlib: dllname, importc: "glDeleteFramebuffersEXT".} -proc glGenFramebuffersEXT*(n: TGLsizei, framebuffers: PGLuint){.dynlib: dllname, - importc: "glGenFramebuffersEXT".} -proc glCheckFramebufferStatusEXT*(target: TGLenum): TGLenum{.dynlib: dllname, - importc: "glCheckFramebufferStatusEXT".} -proc glFramebufferTexture1DEXT*(target: TGLenum, attachment: TGLenum, - textarget: TGLenum, texture: TGLuint, - level: TGLint){.dynlib: dllname, - importc: "glFramebufferTexture1DEXT".} -proc glFramebufferTexture2DEXT*(target: TGLenum, attachment: TGLenum, - textarget: TGLenum, texture: TGLuint, - level: TGLint){.dynlib: dllname, - importc: "glFramebufferTexture2DEXT".} -proc glFramebufferTexture3DEXT*(target: TGLenum, attachment: TGLenum, - textarget: TGLenum, texture: TGLuint, - level: TGLint, zoffset: TGLint){. - dynlib: dllname, importc: "glFramebufferTexture3DEXT".} -proc glFramebufferRenderbufferEXT*(target: TGLenum, attachment: TGLenum, - renderbuffertarget: TGLenum, - renderbuffer: TGLuint){.dynlib: dllname, - importc: "glFramebufferRenderbufferEXT".} -proc glGetFramebufferAttachmentParameterivEXT*(target: TGLenum, - attachment: TGLenum, pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glGetFramebufferAttachmentParameterivEXT".} -proc glGenerateMipmapEXT*(target: TGLenum){.dynlib: dllname, - importc: "glGenerateMipmapEXT".} - #***** GL_version_1_4 *****// -const - GL_BLEND_DST_RGB* = 0x000080C8 - GL_BLEND_SRC_RGB* = 0x000080C9 - GL_BLEND_DST_ALPHA* = 0x000080CA - GL_BLEND_SRC_ALPHA* = 0x000080CB - GL_POINT_SIZE_MIN* = 0x00008126 - GL_POINT_SIZE_MAX* = 0x00008127 - GL_POINT_FADE_THRESHOLD_SIZE* = 0x00008128 - GL_POINT_DISTANCE_ATTENUATION* = 0x00008129 - GL_GENERATE_MIPMAP* = 0x00008191 - GL_GENERATE_MIPMAP_HINT* = 0x00008192 - GL_DEPTH_COMPONENT16* = 0x000081A5 - GL_DEPTH_COMPONENT24* = 0x000081A6 - GL_DEPTH_COMPONENT32* = 0x000081A7 - GL_MIRRORED_REPEAT* = 0x00008370 - GL_FOG_COORDINATE_SOURCE* = 0x00008450 - GL_FOG_COORDINATE* = 0x00008451 - GL_FRAGMENT_DEPTH* = 0x00008452 - GL_CURRENT_FOG_COORDINATE* = 0x00008453 - GL_FOG_COORDINATE_ARRAY_TYPE* = 0x00008454 - GL_FOG_COORDINATE_ARRAY_STRIDE* = 0x00008455 - GL_FOG_COORDINATE_ARRAY_POINTER* = 0x00008456 - GL_FOG_COORDINATE_ARRAY* = 0x00008457 - GL_COLOR_SUM* = 0x00008458 - GL_CURRENT_SECONDARY_COLOR* = 0x00008459 - GL_SECONDARY_COLOR_ARRAY_SIZE* = 0x0000845A - GL_SECONDARY_COLOR_ARRAY_TYPE* = 0x0000845B - GL_SECONDARY_COLOR_ARRAY_STRIDE* = 0x0000845C - GL_SECONDARY_COLOR_ARRAY_POINTER* = 0x0000845D - GL_SECONDARY_COLOR_ARRAY* = 0x0000845E - GL_MAX_TEXTURE_LOD_BIAS* = 0x000084FD - GL_TEXTURE_FILTER_CONTROL* = 0x00008500 - GL_TEXTURE_LOD_BIAS* = 0x00008501 - GL_INCR_WRAP* = 0x00008507 - GL_DECR_WRAP* = 0x00008508 - GL_TEXTURE_DEPTH_SIZE* = 0x0000884A - GL_DEPTH_TEXTURE_MODE* = 0x0000884B - GL_TEXTURE_COMPARE_MODE* = 0x0000884C - GL_TEXTURE_COMPARE_FUNC* = 0x0000884D - GL_COMPARE_R_TO_TEXTURE* = 0x0000884E - -proc glBlendFuncSeparate*(sfactorRGB: TGLenum, dfactorRGB: TGLenum, - sfactorAlpha: TGLenum, dfactorAlpha: TGLenum){. - dynlib: dllname, importc: "glBlendFuncSeparate".} -proc glFogCoordf*(coord: TGLfloat){.dynlib: dllname, importc: "glFogCoordf".} -proc glFogCoordfv*(coord: PGLfloat){.dynlib: dllname, importc: "glFogCoordfv".} -proc glFogCoordd*(coord: TGLdouble){.dynlib: dllname, importc: "glFogCoordd".} -proc glFogCoorddv*(coord: PGLdouble){.dynlib: dllname, importc: "glFogCoorddv".} -proc glFogCoordPointer*(thetype: TGLenum, stride: TGLsizei, pointer: PGLvoid){. - dynlib: dllname, importc: "glFogCoordPointer".} -proc glMultiDrawArrays*(mode: TGLenum, first: PGLint, count: PGLsizei, - primcount: TGLsizei){.dynlib: dllname, - importc: "glMultiDrawArrays".} -proc glMultiDrawElements*(mode: TGLenum, count: PGLsizei, thetype: TGLenum, - indices: PGLvoid, primcount: TGLsizei){. - dynlib: dllname, importc: "glMultiDrawElements".} -proc glPointParameterf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, - importc: "glPointParameterf".} -proc glPointParameterfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, - importc: "glPointParameterfv".} -proc glPointParameteri*(pname: TGLenum, param: TGLint){.dynlib: dllname, - importc: "glPointParameteri".} -proc glPointParameteriv*(pname: TGLenum, params: PGLint){.dynlib: dllname, - importc: "glPointParameteriv".} -proc glSecondaryColor3b*(red: TGLByte, green: TGLByte, blue: TGLByte){. - dynlib: dllname, importc: "glSecondaryColor3b".} -proc glSecondaryColor3bv*(v: PGLbyte){.dynlib: dllname, - importc: "glSecondaryColor3bv".} -proc glSecondaryColor3d*(red: TGLdouble, green: TGLdouble, blue: TGLdouble){. - dynlib: dllname, importc: "glSecondaryColor3d".} -proc glSecondaryColor3dv*(v: PGLdouble){.dynlib: dllname, - importc: "glSecondaryColor3dv".} -proc glSecondaryColor3f*(red: TGLfloat, green: TGLfloat, blue: TGLfloat){. - dynlib: dllname, importc: "glSecondaryColor3f".} -proc glSecondaryColor3fv*(v: PGLfloat){.dynlib: dllname, - importc: "glSecondaryColor3fv".} -proc glSecondaryColor3i*(red: TGLint, green: TGLint, blue: TGLint){. - dynlib: dllname, importc: "glSecondaryColor3i".} -proc glSecondaryColor3iv*(v: PGLint){.dynlib: dllname, - importc: "glSecondaryColor3iv".} -proc glSecondaryColor3s*(red: TGLshort, green: TGLshort, blue: TGLshort){. - dynlib: dllname, importc: "glSecondaryColor3s".} -proc glSecondaryColor3sv*(v: PGLshort){.dynlib: dllname, - importc: "glSecondaryColor3sv".} -proc glSecondaryColor3ub*(red: TGLubyte, green: TGLubyte, blue: TGLubyte){. - dynlib: dllname, importc: "glSecondaryColor3ub".} -proc glSecondaryColor3ubv*(v: PGLubyte){.dynlib: dllname, - importc: "glSecondaryColor3ubv".} -proc glSecondaryColor3ui*(red: TGLuint, green: TGLuint, blue: TGLuint){. - dynlib: dllname, importc: "glSecondaryColor3ui".} -proc glSecondaryColor3uiv*(v: PGLuint){.dynlib: dllname, - importc: "glSecondaryColor3uiv".} -proc glSecondaryColor3us*(red: TGLushort, green: TGLushort, blue: TGLushort){. - dynlib: dllname, importc: "glSecondaryColor3us".} -proc glSecondaryColor3usv*(v: PGLushort){.dynlib: dllname, - importc: "glSecondaryColor3usv".} -proc glSecondaryColorPointer*(size: TGLint, thetype: TGLenum, stride: TGLsizei, - pointer: PGLvoid){.dynlib: dllname, - importc: "glSecondaryColorPointer".} -proc glWindowPos2d*(x: TGLdouble, y: TGLdouble){.dynlib: dllname, - importc: "glWindowPos2d".} -proc glWindowPos2dv*(v: PGLdouble){.dynlib: dllname, importc: "glWindowPos2dv".} -proc glWindowPos2f*(x: TGLfloat, y: TGLfloat){.dynlib: dllname, - importc: "glWindowPos2f".} -proc glWindowPos2fv*(v: PGLfloat){.dynlib: dllname, importc: "glWindowPos2fv".} -proc glWindowPos2i*(x: TGLint, y: TGLint){.dynlib: dllname, - importc: "glWindowPos2i".} -proc glWindowPos2iv*(v: PGLint){.dynlib: dllname, importc: "glWindowPos2iv".} -proc glWindowPos2s*(x: TGLshort, y: TGLshort){.dynlib: dllname, - importc: "glWindowPos2s".} -proc glWindowPos2sv*(v: PGLshort){.dynlib: dllname, importc: "glWindowPos2sv".} -proc glWindowPos3d*(x: TGLdouble, y: TGLdouble, z: TGLdouble){.dynlib: dllname, - importc: "glWindowPos3d".} -proc glWindowPos3dv*(v: PGLdouble){.dynlib: dllname, importc: "glWindowPos3dv".} -proc glWindowPos3f*(x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname, - importc: "glWindowPos3f".} -proc glWindowPos3fv*(v: PGLfloat){.dynlib: dllname, importc: "glWindowPos3fv".} -proc glWindowPos3i*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname, - importc: "glWindowPos3i".} -proc glWindowPos3iv*(v: PGLint){.dynlib: dllname, importc: "glWindowPos3iv".} -proc glWindowPos3s*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname, - importc: "glWindowPos3s".} -proc glWindowPos3sv*(v: PGLshort){.dynlib: dllname, importc: "glWindowPos3sv".} - #***** GL_version_1_5 *****// -const - GL_BUFFER_SIZE* = 0x00008764 - GL_BUFFER_USAGE* = 0x00008765 - GL_QUERY_COUNTER_BITS* = 0x00008864 - GL_CURRENT_QUERY* = 0x00008865 - GL_QUERY_RESULT* = 0x00008866 - GL_QUERY_RESULT_AVAILABLE* = 0x00008867 - GL_ARRAY_BUFFER* = 0x00008892 - GL_ELEMENT_ARRAY_BUFFER* = 0x00008893 - GL_ARRAY_BUFFER_BINDING* = 0x00008894 - GL_ELEMENT_ARRAY_BUFFER_BINDING* = 0x00008895 - GL_VERTEX_ARRAY_BUFFER_BINDING* = 0x00008896 - GL_NORMAL_ARRAY_BUFFER_BINDING* = 0x00008897 - GL_COLOR_ARRAY_BUFFER_BINDING* = 0x00008898 - GL_INDEX_ARRAY_BUFFER_BINDING* = 0x00008899 - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING* = 0x0000889A - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING* = 0x0000889B - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING* = 0x0000889C - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING* = 0x0000889D - GL_WEIGHT_ARRAY_BUFFER_BINDING* = 0x0000889E - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING* = 0x0000889F - GL_READ_ONLY* = 0x000088B8 - GL_WRITE_ONLY* = 0x000088B9 - GL_READ_WRITE* = 0x000088BA - GL_BUFFER_ACCESS* = 0x000088BB - GL_BUFFER_MAPPED* = 0x000088BC - GL_BUFFER_MAP_POINTER* = 0x000088BD - GL_STREAM_DRAW* = 0x000088E0 - GL_STREAM_READ* = 0x000088E1 - GL_STREAM_COPY* = 0x000088E2 - GL_STATIC_DRAW* = 0x000088E4 - GL_STATIC_READ* = 0x000088E5 - GL_STATIC_COPY* = 0x000088E6 - GL_DYNAMIC_DRAW* = 0x000088E8 - GL_DYNAMIC_READ* = 0x000088E9 - GL_DYNAMIC_COPY* = 0x000088EA - GL_SAMPLES_PASSED* = 0x00008914 - GL_FOG_COORD_SRC* = 0x00008450 - GL_FOG_COORD* = 0x00008451 - GL_CURRENT_FOG_COORD* = 0x00008453 - GL_FOG_COORD_ARRAY_TYPE* = 0x00008454 - GL_FOG_COORD_ARRAY_STRIDE* = 0x00008455 - GL_FOG_COORD_ARRAY_POINTER* = 0x00008456 - GL_FOG_COORD_ARRAY* = 0x00008457 - GL_FOG_COORD_ARRAY_BUFFER_BINDING* = 0x0000889D - GL_SRC0_RGB* = 0x00008580 - GL_SRC1_RGB* = 0x00008581 - GL_SRC2_RGB* = 0x00008582 - GL_SRC0_ALPHA* = 0x00008588 - GL_SRC1_ALPHA* = 0x00008589 - GL_SRC2_ALPHA* = 0x0000858A - -proc glGenQueries*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glGenQueries".} -proc glDeleteQueries*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, - importc: "glDeleteQueries".} -proc glIsQuery*(id: TGLuint): TGLboolean{.dynlib: dllname, importc: "glIsQuery".} -proc glBeginQuery*(target: TGLenum, id: TGLuint){.dynlib: dllname, - importc: "glBeginQuery".} -proc glEndQuery*(target: TGLenum){.dynlib: dllname, importc: "glEndQuery".} -proc glGetQueryiv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetQueryiv".} -proc glGetQueryObjectiv*(id: TGLuint, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetQueryObjectiv".} -proc glGetQueryObjectuiv*(id: TGLuint, pname: TGLenum, params: PGLuint){. - dynlib: dllname, importc: "glGetQueryObjectuiv".} -proc glBindBuffer*(target: TGLenum, buffer: TGLuint){.dynlib: dllname, - importc: "glBindBuffer".} -proc glDeleteBuffers*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, - importc: "glDeleteBuffers".} -proc glGenBuffers*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, - importc: "glGenBuffers".} -proc glIsBuffer*(buffer: TGLuint): TGLboolean{.dynlib: dllname, - importc: "glIsBuffer".} -proc glBufferData*(target: TGLenum, size: GLsizeiptr, data: PGLvoid, - usage: TGLenum){.dynlib: dllname, importc: "glBufferData".} -proc glBufferSubData*(target: TGLenum, offset: GLintptr, size: GLsizeiptr, - data: PGLvoid){.dynlib: dllname, - importc: "glBufferSubData".} -proc glGetBufferSubData*(target: TGLenum, offset: GLintptr, size: GLsizeiptr, - data: PGLvoid){.dynlib: dllname, - importc: "glGetBufferSubData".} -proc glMapBuffer*(target: TGLenum, access: TGLenum): PGLvoid{.dynlib: dllname, - importc: "glMapBuffer".} -proc glUnmapBuffer*(target: TGLenum): TGLboolean{.dynlib: dllname, - importc: "glUnmapBuffer".} -proc glGetBufferParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. - dynlib: dllname, importc: "glGetBufferParameteriv".} -proc glGetBufferPointerv*(target: TGLenum, pname: TGLenum, params: PGLvoid){. - dynlib: dllname, importc: "glGetBufferPointerv".} - #***** GL_version_2_0 *****// -const - GL_BLEND_EQUATION_RGB* = 0x00008009 - GL_VERTEX_ATTRIB_ARRAY_ENABLED* = 0x00008622 - GL_VERTEX_ATTRIB_ARRAY_SIZE* = 0x00008623 - GL_VERTEX_ATTRIB_ARRAY_STRIDE* = 0x00008624 - GL_VERTEX_ATTRIB_ARRAY_TYPE* = 0x00008625 - GL_CURRENT_VERTEX_ATTRIB* = 0x00008626 - GL_VERTEX_PROGRAM_POINT_SIZE* = 0x00008642 - GL_VERTEX_PROGRAM_TWO_SIDE* = 0x00008643 - GL_VERTEX_ATTRIB_ARRAY_POINTER* = 0x00008645 - GL_STENCIL_BACK_FUNC* = 0x00008800 - GL_STENCIL_BACK_FAIL* = 0x00008801 - GL_STENCIL_BACK_PASS_DEPTH_FAIL* = 0x00008802 - GL_STENCIL_BACK_PASS_DEPTH_PASS* = 0x00008803 - GL_MAX_DRAW_BUFFERS* = 0x00008824 - GL_DRAW_BUFFER0* = 0x00008825 - GL_DRAW_BUFFER1* = 0x00008826 - GL_DRAW_BUFFER2* = 0x00008827 - GL_DRAW_BUFFER3* = 0x00008828 - GL_DRAW_BUFFER4* = 0x00008829 - GL_DRAW_BUFFER5* = 0x0000882A - GL_DRAW_BUFFER6* = 0x0000882B - GL_DRAW_BUFFER7* = 0x0000882C - GL_DRAW_BUFFER8* = 0x0000882D - GL_DRAW_BUFFER9* = 0x0000882E - GL_DRAW_BUFFER10* = 0x0000882F - GL_DRAW_BUFFER11* = 0x00008830 - GL_DRAW_BUFFER12* = 0x00008831 - GL_DRAW_BUFFER13* = 0x00008832 - GL_DRAW_BUFFER14* = 0x00008833 - GL_DRAW_BUFFER15* = 0x00008834 - GL_BLEND_EQUATION_ALPHA* = 0x0000883D - GL_POINT_SPRITE* = 0x00008861 - GL_COORD_REPLACE* = 0x00008862 - GL_MAX_VERTEX_ATTRIBS* = 0x00008869 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED* = 0x0000886A - GL_MAX_TEXTURE_COORDS* = 0x00008871 - GL_MAX_TEXTURE_IMAGE_UNITS* = 0x00008872 - GL_FRAGMENT_SHADER* = 0x00008B30 - GL_VERTEX_SHADER* = 0x00008B31 - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS* = 0x00008B49 - GL_MAX_VERTEX_UNIFORM_COMPONENTS* = 0x00008B4A - GL_MAX_VARYING_FLOATS* = 0x00008B4B - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS* = 0x00008B4C - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS* = 0x00008B4D - GL_SHADER_TYPE* = 0x00008B4F - GL_FLOAT_VEC2* = 0x00008B50 - GL_FLOAT_VEC3* = 0x00008B51 - GL_FLOAT_VEC4* = 0x00008B52 - GL_INT_VEC2* = 0x00008B53 - GL_INT_VEC3* = 0x00008B54 - GL_INT_VEC4* = 0x00008B55 - GL_BOOL* = 0x00008B56 - GL_BOOL_VEC2* = 0x00008B57 - GL_BOOL_VEC3* = 0x00008B58 - GL_BOOL_VEC4* = 0x00008B59 - GL_FLOAT_MAT2* = 0x00008B5A - GL_FLOAT_MAT3* = 0x00008B5B - GL_FLOAT_MAT4* = 0x00008B5C - GL_SAMPLER_1D* = 0x00008B5D - GL_SAMPLER_2D* = 0x00008B5E - GL_SAMPLER_3D* = 0x00008B5F - GL_SAMPLER_CUBE* = 0x00008B60 - GL_SAMPLER_1D_SHADOW* = 0x00008B61 - GL_SAMPLER_2D_SHADOW* = 0x00008B62 - GL_DELETE_STATUS* = 0x00008B80 - GL_COMPILE_STATUS* = 0x00008B81 - GL_LINK_STATUS* = 0x00008B82 - GL_VALIDATE_STATUS* = 0x00008B83 - GL_INFO_LOG_LENGTH* = 0x00008B84 - GL_ATTACHED_SHADERS* = 0x00008B85 - GL_ACTIVE_UNIFORMS* = 0x00008B86 - GL_ACTIVE_UNIFORM_MAX_LENGTH* = 0x00008B87 - GL_SHADER_SOURCE_LENGTH* = 0x00008B88 - GL_ACTIVE_ATTRIBUTES* = 0x00008B89 - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH* = 0x00008B8A - GL_FRAGMENT_SHADER_DERIVATIVE_HINT* = 0x00008B8B - GL_SHADING_LANGUAGE_VERSION* = 0x00008B8C - GL_CURRENT_PROGRAM* = 0x00008B8D - GL_POINT_SPRITE_COORD_ORIGIN* = 0x00008CA0 - GL_LOWER_LEFT* = 0x00008CA1 - GL_UPPER_LEFT* = 0x00008CA2 - GL_STENCIL_BACK_REF* = 0x00008CA3 - GL_STENCIL_BACK_VALUE_MASK* = 0x00008CA4 - GL_STENCIL_BACK_WRITEMASK* = 0x00008CA5 - -{.pop.} \ No newline at end of file diff --git a/lib/wrappers/opengl/glu.nim b/lib/wrappers/opengl/glu.nim deleted file mode 100644 index e00120d83..000000000 --- a/lib/wrappers/opengl/glu.nim +++ /dev/null @@ -1,335 +0,0 @@ -# -# -# Adaption of the delphi3d.net OpenGL units to FreePascal -# Sebastian Guenther (sg@freepascal.org) in 2002 -# These units are free to use -#****************************************************************************** -# Converted to Delphi by Tom Nuydens (tom@delphi3d.net) -# For the latest updates, visit Delphi3D: http://www.delphi3d.net -#****************************************************************************** - -import - GL - -when defined(windows): - {.push, callconv: stdcall.} -else: - {.push, callconv: cdecl.} - -when defined(windows): - const - dllname = "glu32.dll" -elif defined(macosx): - const - dllname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib" -else: - const - dllname = "libGLU.so.1" -type - TViewPortArray* = array[0..3, TGLint] - T16dArray* = array[0..15, TGLdouble] - TCallBack* = proc () - T3dArray* = array[0..2, TGLdouble] - T4pArray* = array[0..3, Pointer] - T4fArray* = array[0..3, TGLfloat] - PPointer* = ptr Pointer - -type - GLUnurbs*{.final.} = object - PGLUnurbs* = ptr GLUnurbs - GLUquadric*{.final.} = object - PGLUquadric* = ptr GLUquadric - GLUtesselator*{.final.} = object - PGLUtesselator* = ptr 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 - -proc gluErrorString*(errCode: TGLenum): cstring{.dynlib: dllname, - importc: "gluErrorString".} -proc gluErrorUnicodeStringEXT*(errCode: TGLenum): ptr int16{.dynlib: dllname, - importc: "gluErrorUnicodeStringEXT".} -proc gluGetString*(name: TGLenum): cstring{.dynlib: dllname, - importc: "gluGetString".} -proc gluOrtho2D*(left, right, bottom, top: TGLdouble){.dynlib: dllname, - importc: "gluOrtho2D".} -proc gluPerspective*(fovy, aspect, zNear, zFar: TGLdouble){.dynlib: dllname, - importc: "gluPerspective".} -proc gluPickMatrix*(x, y, width, height: TGLdouble, viewport: var TViewPortArray){. - dynlib: dllname, importc: "gluPickMatrix".} -proc gluLookAt*(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: TGLdouble){. - dynlib: dllname, importc: "gluLookAt".} -proc gluProject*(objx, objy, objz: TGLdouble, - modelMatrix, projMatrix: var T16dArray, - viewport: var TViewPortArray, winx, winy, winz: PGLdouble): int{. - dynlib: dllname, importc: "gluProject".} -proc gluUnProject*(winx, winy, winz: TGLdouble, - modelMatrix, projMatrix: var T16dArray, - viewport: var TViewPortArray, objx, objy, objz: PGLdouble): int{. - dynlib: dllname, importc: "gluUnProject".} -proc gluScaleImage*(format: TGLenum, widthin, heightin: TGLint, typein: TGLenum, - datain: Pointer, widthout, heightout: TGLint, - typeout: TGLenum, dataout: Pointer): int{.dynlib: dllname, - importc: "gluScaleImage".} -proc gluBuild1DMipmaps*(target: TGLenum, components, width: TGLint, - format, atype: TGLenum, data: Pointer): int{. - dynlib: dllname, importc: "gluBuild1DMipmaps".} -proc gluBuild2DMipmaps*(target: TGLenum, components, width, height: TGLint, - format, atype: TGLenum, data: Pointer): int{. - dynlib: dllname, importc: "gluBuild2DMipmaps".} -proc gluNewQuadric*(): PGLUquadric{.dynlib: dllname, importc: "gluNewQuadric".} -proc gluDeleteQuadric*(state: PGLUquadric){.dynlib: dllname, - importc: "gluDeleteQuadric".} -proc gluQuadricNormals*(quadObject: PGLUquadric, normals: TGLenum){. - dynlib: dllname, importc: "gluQuadricNormals".} -proc gluQuadricTexture*(quadObject: PGLUquadric, textureCoords: TGLboolean){. - dynlib: dllname, importc: "gluQuadricTexture".} -proc gluQuadricOrientation*(quadObject: PGLUquadric, orientation: TGLenum){. - dynlib: dllname, importc: "gluQuadricOrientation".} -proc gluQuadricDrawStyle*(quadObject: PGLUquadric, drawStyle: TGLenum){. - dynlib: dllname, importc: "gluQuadricDrawStyle".} -proc gluCylinder*(qobj: PGLUquadric, baseRadius, topRadius, height: TGLdouble, - slices, stacks: TGLint){.dynlib: dllname, - importc: "gluCylinder".} -proc gluDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble, - slices, loops: TGLint){.dynlib: dllname, importc: "gluDisk".} -proc gluPartialDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble, - slices, loops: TGLint, startAngle, sweepAngle: TGLdouble){. - dynlib: dllname, importc: "gluPartialDisk".} -proc gluSphere*(qobj: PGLuquadric, radius: TGLdouble, slices, stacks: TGLint){. - dynlib: dllname, importc: "gluSphere".} -proc gluQuadricCallback*(qobj: PGLUquadric, which: TGLenum, fn: TCallBack){. - dynlib: dllname, importc: "gluQuadricCallback".} -proc gluNewTess*(): PGLUtesselator{.dynlib: dllname, importc: "gluNewTess".} -proc gluDeleteTess*(tess: PGLUtesselator){.dynlib: dllname, - importc: "gluDeleteTess".} -proc gluTessBeginPolygon*(tess: PGLUtesselator, polygon_data: Pointer){. - dynlib: dllname, importc: "gluTessBeginPolygon".} -proc gluTessBeginContour*(tess: PGLUtesselator){.dynlib: dllname, - importc: "gluTessBeginContour".} -proc gluTessVertex*(tess: PGLUtesselator, coords: var T3dArray, data: Pointer){. - dynlib: dllname, importc: "gluTessVertex".} -proc gluTessEndContour*(tess: PGLUtesselator){.dynlib: dllname, - importc: "gluTessEndContour".} -proc gluTessEndPolygon*(tess: PGLUtesselator){.dynlib: dllname, - importc: "gluTessEndPolygon".} -proc gluTessProperty*(tess: PGLUtesselator, which: TGLenum, value: TGLdouble){. - dynlib: dllname, importc: "gluTessProperty".} -proc gluTessNormal*(tess: PGLUtesselator, x, y, z: TGLdouble){.dynlib: dllname, - importc: "gluTessNormal".} -proc gluTessCallback*(tess: PGLUtesselator, which: TGLenum, fn: TCallBack){. - dynlib: dllname, importc: "gluTessCallback".} -proc gluGetTessProperty*(tess: PGLUtesselator, which: TGLenum, value: PGLdouble){. - dynlib: dllname, importc: "gluGetTessProperty".} -proc gluNewNurbsRenderer*(): PGLUnurbs{.dynlib: dllname, - importc: "gluNewNurbsRenderer".} -proc gluDeleteNurbsRenderer*(nobj: PGLUnurbs){.dynlib: dllname, - importc: "gluDeleteNurbsRenderer".} -proc gluBeginSurface*(nobj: PGLUnurbs){.dynlib: dllname, - importc: "gluBeginSurface".} -proc gluBeginCurve*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluBeginCurve".} -proc gluEndCurve*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluEndCurve".} -proc gluEndSurface*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluEndSurface".} -proc gluBeginTrim*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluBeginTrim".} -proc gluEndTrim*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluEndTrim".} -proc gluPwlCurve*(nobj: PGLUnurbs, count: TGLint, aarray: PGLfloat, - stride: TGLint, atype: TGLenum){.dynlib: dllname, - importc: "gluPwlCurve".} -proc gluNurbsCurve*(nobj: PGLUnurbs, nknots: TGLint, knot: PGLfloat, - stride: TGLint, ctlarray: PGLfloat, order: TGLint, - atype: TGLenum){.dynlib: dllname, importc: "gluNurbsCurve".} -proc gluNurbsSurface*(nobj: PGLUnurbs, sknot_count: TGLint, sknot: PGLfloat, - tknot_count: TGLint, tknot: PGLfloat, - s_stride, t_stride: TGLint, ctlarray: PGLfloat, - sorder, torder: TGLint, atype: TGLenum){.dynlib: dllname, - importc: "gluNurbsSurface".} -proc gluLoadSamplingMatrices*(nobj: PGLUnurbs, - modelMatrix, projMatrix: var T16dArray, - viewport: var TViewPortArray){.dynlib: dllname, - importc: "gluLoadSamplingMatrices".} -proc gluNurbsProperty*(nobj: PGLUnurbs, aproperty: TGLenum, value: TGLfloat){. - dynlib: dllname, importc: "gluNurbsProperty".} -proc gluGetNurbsProperty*(nobj: PGLUnurbs, aproperty: TGLenum, value: PGLfloat){. - dynlib: dllname, importc: "gluGetNurbsProperty".} -proc gluNurbsCallback*(nobj: PGLUnurbs, which: TGLenum, fn: TCallBack){. - dynlib: dllname, importc: "gluNurbsCallback".} - #*** Callback function prototypes *** -type # gluQuadricCallback - GLUquadricErrorProc* = proc (p: TGLenum) # gluTessCallback - GLUtessBeginProc* = proc (p: TGLenum) - GLUtessEdgeFlagProc* = proc (p: TGLboolean) - GLUtessVertexProc* = proc (p: Pointer) - GLUtessEndProc* = proc () - GLUtessErrorProc* = proc (p: TGLenum) - GLUtessCombineProc* = proc (p1: var T3dArray, p2: T4pArray, p3: T4fArray, - p4: PPointer) - GLUtessBeginDataProc* = proc (p1: TGLenum, p2: Pointer) - GLUtessEdgeFlagDataProc* = proc (p1: TGLboolean, p2: Pointer) - GLUtessVertexDataProc* = proc (p1, p2: Pointer) - GLUtessEndDataProc* = proc (p: Pointer) - GLUtessErrorDataProc* = proc (p1: TGLenum, p2: Pointer) - GLUtessCombineDataProc* = proc (p1: var T3dArray, p2: var T4pArray, - p3: var T4fArray, p4: PPointer, p5: Pointer) # - # - # gluNurbsCallback - GLUnurbsErrorProc* = proc (p: TGLenum) #*** 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.00000e+150 # 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*)(TGLenum type) - constGLU_TESS_VERTEX* = 100101 # void (CALLBACK*)(void *data) - GLU_TESS_END* = 100102 # void (CALLBACK*)(void) - GLU_TESS_ERROR* = 100103 # void (CALLBACK*)(TGLenum errno) - GLU_TESS_EDGE_FLAG* = 100104 # void (CALLBACK*)(TGLboolean boundaryEdge) - GLU_TESS_COMBINE* = 100105 # void (CALLBACK*)(TGLdouble coords[3], - # void *data[4], - # TGLfloat weight[4], - # void **dataOut) - GLU_TESS_BEGIN_DATA* = 100106 # void (CALLBACK*)(TGLenum 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*)(TGLenum errno, - # void *polygon_data) - GLU_TESS_EDGE_FLAG_DATA* = 100110 # void (CALLBACK*)(TGLboolean boundaryEdge, - # void *polygon_data) - GLU_TESS_COMBINE_DATA* = 100111 # void (CALLBACK*)(TGLdouble coords[3], - # void *data[4], - # TGLfloat 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 ****/ - -proc gluBeginPolygon*(tess: PGLUtesselator){.dynlib: dllname, - importc: "gluBeginPolygon".} -proc gluNextContour*(tess: PGLUtesselator, atype: TGLenum){.dynlib: dllname, - importc: "gluNextContour".} -proc gluEndPolygon*(tess: PGLUtesselator){.dynlib: dllname, - importc: "gluEndPolygon".} -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* = constGLU_TESS_VERTEX - GLU_END* = GLU_TESS_END - GLU_ERROR* = GLU_TESS_ERROR - GLU_EDGE_FLAG* = GLU_TESS_EDGE_FLAG - -{.pop.} -# implementation diff --git a/lib/wrappers/opengl/glut.nim b/lib/wrappers/opengl/glut.nim deleted file mode 100644 index ff157c327..000000000 --- a/lib/wrappers/opengl/glut.nim +++ /dev/null @@ -1,438 +0,0 @@ -# -# -# Adaption of the delphi3d.net OpenGL units to FreePascal -# Sebastian Guenther (sg@freepascal.org) in 2002 -# These units are free to use -# - -# 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 -#****************************************************************************** - -import - GL - -when defined(windows): - const - dllname = "glut32.dll" -elif defined(macosx): - const - dllname = "/System/Library/Frameworks/GLUT.framework/GLUT" -else: - const - dllname = "libglut.so.3" -type - TGlutVoidCallback* = proc (){.cdecl.} - TGlut1IntCallback* = proc (value: cint){.cdecl.} - TGlut2IntCallback* = proc (v1, v2: cint){.cdecl.} - TGlut3IntCallback* = proc (v1, v2, v3: cint){.cdecl.} - TGlut4IntCallback* = proc (v1, v2, v3, v4: cint){.cdecl.} - TGlut1Char2IntCallback* = proc (c: int8, v1, v2: cint){.cdecl.} - TGlut1UInt3IntCallback* = proc (u, v1, v2, v3: cint){.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 - -when defined(Windows): - const # Stroke font constants (use these in GLUT program). - GLUT_STROKE_ROMAN* = cast[Pointer](0) - GLUT_STROKE_MONO_ROMAN* = cast[Pointer](1) # Bitmap font constants (use these in GLUT program). - GLUT_BITMAP_9_BY_15* = cast[Pointer](2) - GLUT_BITMAP_8_BY_13* = cast[Pointer](3) - GLUT_BITMAP_TIMES_ROMAN_10* = cast[Pointer](4) - GLUT_BITMAP_TIMES_ROMAN_24* = cast[Pointer](5) - GLUT_BITMAP_HELVETICA_10* = cast[Pointer](6) - GLUT_BITMAP_HELVETICA_12* = cast[Pointer](7) - GLUT_BITMAP_HELVETICA_18* = cast[Pointer](8) -else: - 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 -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 - constGLUT_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. - -proc glutInit*(argcp: ptr cint, argv: pointer){.dynlib: dllname, - importc: "glutInit".} - -proc glutInit*() = - ## version that passes `argc` and `argc` implicitely. - var - cmdLine {.importc: "cmdLine".}: array[0..255, cstring] - cmdCount {.importc: "cmdCount".}: cint - glutInit(addr(cmdCount), addr(cmdLine)) - -proc glutInitDisplayMode*(mode: int16){.dynlib: dllname, - importc: "glutInitDisplayMode".} -proc glutInitDisplayString*(str: cstring){.dynlib: dllname, - importc: "glutInitDisplayString".} -proc glutInitWindowPosition*(x, y: int){.dynlib: dllname, - importc: "glutInitWindowPosition".} -proc glutInitWindowSize*(width, height: int){.dynlib: dllname, - importc: "glutInitWindowSize".} -proc glutMainLoop*(){.dynlib: dllname, importc: "glutMainLoop".} - # GLUT window sub-API. -proc glutCreateWindow*(title: cstring): int{.dynlib: dllname, - importc: "glutCreateWindow".} -proc glutCreateSubWindow*(win, x, y, width, height: int): int{.dynlib: dllname, - importc: "glutCreateSubWindow".} -proc glutDestroyWindow*(win: int){.dynlib: dllname, importc: "glutDestroyWindow".} -proc glutPostRedisplay*(){.dynlib: dllname, importc: "glutPostRedisplay".} -proc glutPostWindowRedisplay*(win: int){.dynlib: dllname, - importc: "glutPostWindowRedisplay".} -proc glutSwapBuffers*(){.dynlib: dllname, importc: "glutSwapBuffers".} -proc glutGetWindow*(): int{.dynlib: dllname, importc: "glutGetWindow".} -proc glutSetWindow*(win: int){.dynlib: dllname, importc: "glutSetWindow".} -proc glutSetWindowTitle*(title: cstring){.dynlib: dllname, - importc: "glutSetWindowTitle".} -proc glutSetIconTitle*(title: cstring){.dynlib: dllname, - importc: "glutSetIconTitle".} -proc glutPositionWindow*(x, y: int){.dynlib: dllname, - importc: "glutPositionWindow".} -proc glutReshapeWindow*(width, height: int){.dynlib: dllname, - importc: "glutReshapeWindow".} -proc glutPopWindow*(){.dynlib: dllname, importc: "glutPopWindow".} -proc glutPushWindow*(){.dynlib: dllname, importc: "glutPushWindow".} -proc glutIconifyWindow*(){.dynlib: dllname, importc: "glutIconifyWindow".} -proc glutShowWindow*(){.dynlib: dllname, importc: "glutShowWindow".} -proc glutHideWindow*(){.dynlib: dllname, importc: "glutHideWindow".} -proc glutFullScreen*(){.dynlib: dllname, importc: "glutFullScreen".} -proc glutSetCursor*(cursor: int){.dynlib: dllname, importc: "glutSetCursor".} -proc glutWarpPointer*(x, y: int){.dynlib: dllname, importc: "glutWarpPointer".} - # GLUT overlay sub-API. -proc glutEstablishOverlay*(){.dynlib: dllname, importc: "glutEstablishOverlay".} -proc glutRemoveOverlay*(){.dynlib: dllname, importc: "glutRemoveOverlay".} -proc glutUseLayer*(layer: TGLenum){.dynlib: dllname, importc: "glutUseLayer".} -proc glutPostOverlayRedisplay*(){.dynlib: dllname, - importc: "glutPostOverlayRedisplay".} -proc glutPostWindowOverlayRedisplay*(win: int){.dynlib: dllname, - importc: "glutPostWindowOverlayRedisplay".} -proc glutShowOverlay*(){.dynlib: dllname, importc: "glutShowOverlay".} -proc glutHideOverlay*(){.dynlib: dllname, importc: "glutHideOverlay".} - # GLUT menu sub-API. -proc glutCreateMenu*(callback: TGlut1IntCallback): int{.dynlib: dllname, - importc: "glutCreateMenu".} -proc glutDestroyMenu*(menu: int){.dynlib: dllname, importc: "glutDestroyMenu".} -proc glutGetMenu*(): int{.dynlib: dllname, importc: "glutGetMenu".} -proc glutSetMenu*(menu: int){.dynlib: dllname, importc: "glutSetMenu".} -proc glutAddMenuEntry*(caption: cstring, value: int){.dynlib: dllname, - importc: "glutAddMenuEntry".} -proc glutAddSubMenu*(caption: cstring, submenu: int){.dynlib: dllname, - importc: "glutAddSubMenu".} -proc glutChangeToMenuEntry*(item: int, caption: cstring, value: int){. - dynlib: dllname, importc: "glutChangeToMenuEntry".} -proc glutChangeToSubMenu*(item: int, caption: cstring, submenu: int){. - dynlib: dllname, importc: "glutChangeToSubMenu".} -proc glutRemoveMenuItem*(item: int){.dynlib: dllname, - importc: "glutRemoveMenuItem".} -proc glutAttachMenu*(button: int){.dynlib: dllname, importc: "glutAttachMenu".} -proc glutDetachMenu*(button: int){.dynlib: dllname, importc: "glutDetachMenu".} - # GLUT window callback sub-API. -proc glutDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname, - importc: "glutDisplayFunc".} -proc glutReshapeFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutReshapeFunc".} -proc glutKeyboardFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname, - importc: "glutKeyboardFunc".} -proc glutMouseFunc*(f: TGlut4IntCallback){.dynlib: dllname, - importc: "glutMouseFunc".} -proc glutMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutMotionFunc".} -proc glutPassiveMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutPassiveMotionFunc".} -proc glutEntryFunc*(f: TGlut1IntCallback){.dynlib: dllname, - importc: "glutEntryFunc".} -proc glutVisibilityFunc*(f: TGlut1IntCallback){.dynlib: dllname, - importc: "glutVisibilityFunc".} -proc glutIdleFunc*(f: TGlutVoidCallback){.dynlib: dllname, - importc: "glutIdleFunc".} -proc glutTimerFunc*(millis: int16, f: TGlut1IntCallback, value: int){. - dynlib: dllname, importc: "glutTimerFunc".} -proc glutMenuStateFunc*(f: TGlut1IntCallback){.dynlib: dllname, - importc: "glutMenuStateFunc".} -proc glutSpecialFunc*(f: TGlut3IntCallback){.dynlib: dllname, - importc: "glutSpecialFunc".} -proc glutSpaceballMotionFunc*(f: TGlut3IntCallback){.dynlib: dllname, - importc: "glutSpaceballMotionFunc".} -proc glutSpaceballRotateFunc*(f: TGlut3IntCallback){.dynlib: dllname, - importc: "glutSpaceballRotateFunc".} -proc glutSpaceballButtonFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutSpaceballButtonFunc".} -proc glutButtonBoxFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutButtonBoxFunc".} -proc glutDialsFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutDialsFunc".} -proc glutTabletMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, - importc: "glutTabletMotionFunc".} -proc glutTabletButtonFunc*(f: TGlut4IntCallback){.dynlib: dllname, - importc: "glutTabletButtonFunc".} -proc glutMenuStatusFunc*(f: TGlut3IntCallback){.dynlib: dllname, - importc: "glutMenuStatusFunc".} -proc glutOverlayDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname, - importc: "glutOverlayDisplayFunc".} -proc glutWindowStatusFunc*(f: TGlut1IntCallback){.dynlib: dllname, - importc: "glutWindowStatusFunc".} -proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname, - importc: "glutKeyboardUpFunc".} -proc glutSpecialUpFunc*(f: TGlut3IntCallback){.dynlib: dllname, - importc: "glutSpecialUpFunc".} -proc glutJoystickFunc*(f: TGlut1UInt3IntCallback, pollInterval: int){. - dynlib: dllname, importc: "glutJoystickFunc".} - # GLUT color index sub-API. -proc glutSetColor*(cell: int, red, green, blue: TGLfloat){.dynlib: dllname, - importc: "glutSetColor".} -proc glutGetColor*(ndx, component: int): TGLfloat{.dynlib: dllname, - importc: "glutGetColor".} -proc glutCopyColormap*(win: int){.dynlib: dllname, importc: "glutCopyColormap".} - # GLUT state retrieval sub-API. -proc glutGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutGet".} -proc glutDeviceGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutDeviceGet".} - # GLUT extension support sub-API -proc glutExtensionSupported*(name: cstring): int{.dynlib: dllname, - importc: "glutExtensionSupported".} -proc glutGetModifiers*(): int{.dynlib: dllname, importc: "glutGetModifiers".} -proc glutLayerGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutLayerGet".} - # GLUT font sub-API -proc glutBitmapCharacter*(font: pointer, character: int){.dynlib: dllname, - importc: "glutBitmapCharacter".} -proc glutBitmapWidth*(font: pointer, character: int): int{.dynlib: dllname, - importc: "glutBitmapWidth".} -proc glutStrokeCharacter*(font: pointer, character: int){.dynlib: dllname, - importc: "glutStrokeCharacter".} -proc glutStrokeWidth*(font: pointer, character: int): int{.dynlib: dllname, - importc: "glutStrokeWidth".} -proc glutBitmapLength*(font: pointer, str: cstring): int{.dynlib: dllname, - importc: "glutBitmapLength".} -proc glutStrokeLength*(font: pointer, str: cstring): int{.dynlib: dllname, - importc: "glutStrokeLength".} - # GLUT pre-built models sub-API -proc glutWireSphere*(radius: TGLdouble, slices, stacks: TGLint){. - dynlib: dllname, importc: "glutWireSphere".} -proc glutSolidSphere*(radius: TGLdouble, slices, stacks: TGLint){. - dynlib: dllname, importc: "glutSolidSphere".} -proc glutWireCone*(base, height: TGLdouble, slices, stacks: TGLint){. - dynlib: dllname, importc: "glutWireCone".} -proc glutSolidCone*(base, height: TGLdouble, slices, stacks: TGLint){. - dynlib: dllname, importc: "glutSolidCone".} -proc glutWireCube*(size: TGLdouble){.dynlib: dllname, importc: "glutWireCube".} -proc glutSolidCube*(size: TGLdouble){.dynlib: dllname, importc: "glutSolidCube".} -proc glutWireTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){. - dynlib: dllname, importc: "glutWireTorus".} -proc glutSolidTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){. - dynlib: dllname, importc: "glutSolidTorus".} -proc glutWireDodecahedron*(){.dynlib: dllname, importc: "glutWireDodecahedron".} -proc glutSolidDodecahedron*(){.dynlib: dllname, importc: "glutSolidDodecahedron".} -proc glutWireTeapot*(size: TGLdouble){.dynlib: dllname, - importc: "glutWireTeapot".} -proc glutSolidTeapot*(size: TGLdouble){.dynlib: dllname, - importc: "glutSolidTeapot".} -proc glutWireOctahedron*(){.dynlib: dllname, importc: "glutWireOctahedron".} -proc glutSolidOctahedron*(){.dynlib: dllname, importc: "glutSolidOctahedron".} -proc glutWireTetrahedron*(){.dynlib: dllname, importc: "glutWireTetrahedron".} -proc glutSolidTetrahedron*(){.dynlib: dllname, importc: "glutSolidTetrahedron".} -proc glutWireIcosahedron*(){.dynlib: dllname, importc: "glutWireIcosahedron".} -proc glutSolidIcosahedron*(){.dynlib: dllname, importc: "glutSolidIcosahedron".} - # GLUT video resize sub-API. -proc glutVideoResizeGet*(param: TGLenum): int{.dynlib: dllname, - importc: "glutVideoResizeGet".} -proc glutSetupVideoResizing*(){.dynlib: dllname, - importc: "glutSetupVideoResizing".} -proc glutStopVideoResizing*(){.dynlib: dllname, importc: "glutStopVideoResizing".} -proc glutVideoResize*(x, y, width, height: int){.dynlib: dllname, - importc: "glutVideoResize".} -proc glutVideoPan*(x, y, width, height: int){.dynlib: dllname, - importc: "glutVideoPan".} - # GLUT debugging sub-API. -proc glutReportErrors*(){.dynlib: dllname, importc: "glutReportErrors".} - # GLUT device control sub-API. -proc glutIgnoreKeyRepeat*(ignore: int){.dynlib: dllname, - importc: "glutIgnoreKeyRepeat".} -proc glutSetKeyRepeat*(repeatMode: int){.dynlib: dllname, - importc: "glutSetKeyRepeat".} -proc glutForceJoystickFunc*(){.dynlib: dllname, importc: "glutForceJoystickFunc".} - # GLUT game mode sub-API. - #example glutGameModeString('1280x1024:32@75'); -proc glutGameModeString*(AString: cstring){.dynlib: dllname, - importc: "glutGameModeString".} -proc glutEnterGameMode*(): int{.dynlib: dllname, importc: "glutEnterGameMode".} -proc glutLeaveGameMode*(){.dynlib: dllname, importc: "glutLeaveGameMode".} -proc glutGameModeGet*(mode: TGLenum): int{.dynlib: dllname, - importc: "glutGameModeGet".} -# implementation diff --git a/lib/wrappers/opengl/glx.nim b/lib/wrappers/opengl/glx.nim deleted file mode 100644 index ae5ca75b5..000000000 --- a/lib/wrappers/opengl/glx.nim +++ /dev/null @@ -1,153 +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. -# - -import - X, XLib, XUtil, gl - -when defined(windows): - const - dllname = "GL.dll" -elif defined(macosx): - const - dllname = "/usr/X11R6/lib/libGL.dylib" -else: - const - dllname = "libGL.so" -const - GLX_USE_GL* = 1'i32 - GLX_BUFFER_SIZE* = 2'i32 - GLX_LEVEL* = 3'i32 - GLX_RGBA* = 4'i32 - GLX_DOUBLEBUFFER* = 5'i32 - GLX_STEREO* = 6'i32 - GLX_AUX_BUFFERS* = 7'i32 - GLX_RED_SIZE* = 8'i32 - GLX_GREEN_SIZE* = 9'i32 - GLX_BLUE_SIZE* = 10'i32 - GLX_ALPHA_SIZE* = 11'i32 - GLX_DEPTH_SIZE* = 12'i32 - GLX_STENCIL_SIZE* = 13'i32 - GLX_ACCUM_RED_SIZE* = 14'i32 - GLX_ACCUM_GREEN_SIZE* = 15'i32 - GLX_ACCUM_BLUE_SIZE* = 16'i32 - GLX_ACCUM_ALPHA_SIZE* = 17'i32 # GLX_EXT_visual_info extension - GLX_X_VISUAL_TYPE_EXT* = 0x00000022 - GLX_TRANSPARENT_TYPE_EXT* = 0x00000023 - GLX_TRANSPARENT_INDEX_VALUE_EXT* = 0x00000024 - GLX_TRANSPARENT_RED_VALUE_EXT* = 0x00000025 - GLX_TRANSPARENT_GREEN_VALUE_EXT* = 0x00000026 - GLX_TRANSPARENT_BLUE_VALUE_EXT* = 0x00000027 - GLX_TRANSPARENT_ALPHA_VALUE_EXT* = 0x00000028 # 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* = 0x00008002 - GLX_DIRECT_COLOR_EXT* = 0x00008003 - GLX_PSEUDO_COLOR_EXT* = 0x00008004 - GLX_STATIC_COLOR_EXT* = 0x00008005 - GLX_GRAY_SCALE_EXT* = 0x00008006 - GLX_STATIC_GRAY_EXT* = 0x00008007 - GLX_NONE_EXT* = 0x00008000 - GLX_TRANSPARENT_RGB_EXT* = 0x00008008 - GLX_TRANSPARENT_INDEX_EXT* = 0x00008009 - -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 - -proc glXChooseVisual*(dpy: PDisplay, screen: int, attribList: ptr int32): PXVisualInfo{. - cdecl, dynlib: dllname, importc: "glXChooseVisual".} -proc glXCreateContext*(dpy: PDisplay, vis: PXVisualInfo, shareList: GLXContext, - direct: bool): GLXContext{.cdecl, dynlib: dllname, - importc: "glXCreateContext".} -proc glXDestroyContext*(dpy: PDisplay, ctx: GLXContext){.cdecl, dynlib: dllname, - importc: "glXDestroyContext".} -proc glXMakeCurrent*(dpy: PDisplay, drawable: GLXDrawable, ctx: GLXContext): bool{. - cdecl, dynlib: dllname, importc: "glXMakeCurrent".} -proc glXCopyContext*(dpy: PDisplay, src, dst: GLXContext, mask: int32){.cdecl, - dynlib: dllname, importc: "glXCopyContext".} -proc glXSwapBuffers*(dpy: PDisplay, drawable: GLXDrawable){.cdecl, - dynlib: dllname, importc: "glXSwapBuffers".} -proc glXCreateGLXPixmap*(dpy: PDisplay, visual: PXVisualInfo, pixmap: XPixmap): GLXPixmap{. - cdecl, dynlib: dllname, importc: "glXCreateGLXPixmap".} -proc glXDestroyGLXPixmap*(dpy: PDisplay, pixmap: GLXPixmap){.cdecl, - dynlib: dllname, importc: "glXDestroyGLXPixmap".} -proc glXQueryExtension*(dpy: PDisplay, errorb, event: var int): bool{.cdecl, - dynlib: dllname, importc: "glXQueryExtension".} -proc glXQueryVersion*(dpy: PDisplay, maj, min: var int): bool{.cdecl, - dynlib: dllname, importc: "glXQueryVersion".} -proc glXIsDirect*(dpy: PDisplay, ctx: GLXContext): bool{.cdecl, dynlib: dllname, - importc: "glXIsDirect".} -proc glXGetConfig*(dpy: PDisplay, visual: PXVisualInfo, attrib: int, - value: var int): int{.cdecl, dynlib: dllname, - importc: "glXGetConfig".} -proc glXGetCurrentContext*(): GLXContext{.cdecl, dynlib: dllname, - importc: "glXGetCurrentContext".} -proc glXGetCurrentDrawable*(): GLXDrawable{.cdecl, dynlib: dllname, - importc: "glXGetCurrentDrawable".} -proc glXWaitGL*(){.cdecl, dynlib: dllname, importc: "glXWaitGL".} -proc glXWaitX*(){.cdecl, dynlib: dllname, importc: "glXWaitX".} -proc glXUseXFont*(font: XFont, first, count, list: int){.cdecl, dynlib: dllname, - importc: "glXUseXFont".} - # GLX 1.1 and later -proc glXQueryExtensionsString*(dpy: PDisplay, screen: int): cstring{.cdecl, - dynlib: dllname, importc: "glXQueryExtensionsString".} -proc glXQueryServerString*(dpy: PDisplay, screen, name: int): cstring{.cdecl, - dynlib: dllname, importc: "glXQueryServerString".} -proc glXGetClientString*(dpy: PDisplay, name: int): cstring{.cdecl, - dynlib: dllname, importc: "glXGetClientString".} - # Mesa GLX Extensions -proc glXCreateGLXPixmapMESA*(dpy: PDisplay, visual: PXVisualInfo, - pixmap: XPixmap, cmap: XColormap): GLXPixmap{. - cdecl, dynlib: dllname, importc: "glXCreateGLXPixmapMESA".} -proc glXReleaseBufferMESA*(dpy: PDisplay, d: GLXDrawable): bool{.cdecl, - dynlib: dllname, importc: "glXReleaseBufferMESA".} -proc glXCopySubBufferMESA*(dpy: PDisplay, drawbale: GLXDrawable, - x, y, width, height: int){.cdecl, dynlib: dllname, - importc: "glXCopySubBufferMESA".} -proc glXGetVideoSyncSGI*(counter: var int32): int{.cdecl, dynlib: dllname, - importc: "glXGetVideoSyncSGI".} -proc glXWaitVideoSyncSGI*(divisor, remainder: int, count: var int32): int{. - cdecl, dynlib: dllname, importc: "glXWaitVideoSyncSGI".} -# implementation diff --git a/lib/wrappers/opengl/opengl.nim b/lib/wrappers/opengl/opengl.nim deleted file mode 100644 index 6549cc6f9..000000000 --- a/lib/wrappers/opengl/opengl.nim +++ /dev/null @@ -1,9708 +0,0 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2012 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module is a wrapper around `opengl`:idx:. If you define the symbol -## ``useGlew`` this wrapper does not use Nimrod's ``dynlib`` mechanism, -## but `glew`:idx: instead. However, this shouldn't be necessary anymore; even -## extension loading for the different operating systems is handled here. -## -## You need to call ``loadExtensions`` after a rendering context has been -## created to load any extension proc that your code uses. - -when defined(linux): - import X, XLib, XUtil -elif defined(windows): - import winlean, os - -when defined(windows): - const - ogldll* = "OpenGL32.dll" - gludll* = "GLU32.dll" -elif defined(macosx): - const - ogldll* = "libGL.dylib" - gludll* = "libGLU.dylib" -else: - const - ogldll* = "libGL.so.1" - gludll* = "libGLU.so.1" - -when defined(useGlew): - {.pragma: ogl, header: "<GL/glew.h>".} - {.pragma: oglx, header: "<GL/glxew.h>".} - {.pragma: wgl, header: "<GL/wglew.h>".} - {.pragma: glu, dynlib: gludll.} -else: - # quite complex ... thanks to extension support for various platforms: - import dynlib - - let oglHandle = LoadLib(ogldll) - if isNil(oglHandle): quit("could not load: " & ogldll) - - when defined(windows): - var wglGetProcAddress = cast[proc (s: cstring): pointer {.stdcall.}]( - symAddr(oglHandle, "wglGetProcAddress")) - elif defined(linux): - var glXGetProcAddress = cast[proc (s: cstring): pointer {.cdecl.}]( - symAddr(oglHandle, "glXGetProcAddress")) - var glXGetProcAddressARB = cast[proc (s: cstring): pointer {.cdecl.}]( - symAddr(oglHandle, "glXGetProcAddressARB")) - - proc glGetProc(h: TLibHandle; procName: cstring): pointer = - when defined(windows): - result = symAddr(h, procname) - if result != nil: return - if not isNil(wglGetProcAddress): result = wglGetProcAddress(ProcName) - elif defined(linux): - if not isNil(glXGetProcAddress): result = glXGetProcAddress(ProcName) - if result != nil: return - if not isNil(glXGetProcAddressARB): - result = glXGetProcAddressARB(ProcName) - if result != nil: return - result = symAddr(h, procname) - else: - result = symAddr(h, procName) - if result == nil: raiseInvalidLibrary(procName) - - var gluHandle: TLibHandle - - proc gluGetProc(procname: cstring): pointer = - if gluHandle == nil: - gluHandle = LoadLib(gludll) - if gluHandle == nil: quit("could not load: " & gludll) - result = glGetProc(gluHandle, procname) - - # undocumented 'dynlib' feature: the string literal is replaced by - # the imported proc name: - {.pragma: ogl, dynlib: glGetProc(oglHandle, "0").} - {.pragma: oglx, dynlib: glGetProc(oglHandle, "0").} - {.pragma: wgl, dynlib: glGetProc(oglHandle, "0").} - {.pragma: glu, dynlib: gluGetProc("").} - - proc nimLoadProcs0() {.importc.} - - template loadExtensions*() = - ## call this after your rendering context has been setup if you use - ## extensions. - bind nimLoadProcs0 - nimLoadProcs0() - -#============================================================================== -# -# OpenGL 4.2 - Headertranslation -# Version 4.2a -# Date : 26.11.2011 -# -# Works with : -# - Delphi 3 and up -# - FreePascal (1.9.3 and up) -# -#============================================================================== -# -# Containts the translations of glext.h, gl_1_1.h, glu.h and weglext.h. -# It also contains some helperfunctions that were inspired by those -# found in Mike Lischke's OpenGL12.pas. -# -# Copyright (C) DGL-OpenGL2-Portteam -# All Rights Reserved -# -# Obtained through: -# Delphi OpenGL Community(DGL) - www.delphigl.com -# -# Converted and maintained by DGL's GL2.0-Team : -# - Sascha Willems - http://www.saschawillems.de -# - Steffen Xonna (Lossy eX) - http://www.dev-center.de -# Additional input : -# - Andrey Gruzdev (Mac OS X patch for XE2 / FPC) -# - Lars Middendorf -# - Martin Waldegger (Mars) -# - Benjamin Rosseaux (BeRo) - http://www.0ok.de -# Additional thanks: -# sigsegv (libdl.so) -# -# -#============================================================================== -# You may retrieve the latest version of this file at the Delphi OpenGL -# Community home page, located at http://www.delphigl.com/ -# -# The contents of this file are used with permission, subject to -# the Mozilla Public License Version 1.1 (the "License"); you may -# not use this file except in compliance with the License. You may -# obtain a copy of the License at -# http://www.mozilla.org/MPL/MPL-1.1.html -# -# Software distributed under the License is distributed on an -# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -#============================================================================== -# History : -# Version 1.0 Initial Release -# Version 1.1 Added PPointer in Tpyessection for compatiblity with Delphi -# versions lower than 7 (SW) -# Added a function named RaiseLastOSError including a comment -# on how to make it run under Delphi versions lower than 7 (SW) -# Added some data types according to the GL-Syntax (SW) -# Version 1.2 Fixed some problems with getting the addresses of some -# Extensions (e.g. glTexImage3D) where the EXT/ARB did work -# but not the core-functions (SW) -# Version 1.3 A second call to ReadimplementationProperties won't -# revert to the default libs anymore (MW) -# Libraries now will be released if necessary (MW) -# Version 1.3a Small fixes for glSlang-functions (SW) -# Version 1.3b Fixed a small bug with GL_ARB_shader_objects, that lead -# lead to that extension not loaded correctly (SW) -# Version 1.3c more GL 1.5 compliance by FOG_COORD_xx and -# ARB less VBO and occlusion query routines (MW) -# Version 1.3d Fixed linebreaks (should now be corrected under D5) (SW) -# Version 1.4 Changed header to correspond to the OpenGL-Shading -# Language specification 1.10 : -# - Added new GL_SAMPLER*-Constants -# - Added Constant GL_SHADING_LANGUAGE_VERSION_ARB -# - Added Constant GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB -# - Added Constant GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB (SW) -# Version 1.4a Fixed a missing stdcall for glBindAttribLocationARB (SW) -# Version 1.4b Fixed declaration for glUniform*(f/i)vARB (added count) (MW) -# glCompileShaderARB changed from function to procedure (MW) -# Version 1.5 Added support for FreePascal (BR) -# Added type TGLVectorf3/TGLVector3f (SW) -# Version 1.6 Added Extension GL_EXT_framebuffer_object (SX) -# Version 1.7 Added Extension GL_ARB_fragment_program_shadow (SX) -# Added Extension GL_ARB_draw_buffers (SX) -# Added Extension GL_ARB_texture_rectangle (SX) -# Added Extension GL_ARB_color_buffer_float (SX) -# Added Extension GL_ARB_half_float_pixel (SX) -# Added Extension GL_ARB_texture_float (SX) -# Added Extension GL_ARB_pixel_buffer_object (SX) -# Added Extension GL_EXT_depth_bounds_test (SX) -# Added Extension GL_EXT_texture_mirror_clamp (SX) -# Added Extension GL_EXT_blend_equation_separate (SX) -# Added Extension GL_EXT_pixel_buffer_object (SX) -# Added Extension GL_EXT_texture_compression_dxt1 (SX) -# Added Extension GL_NV_fragment_program_option (SX) -# Added Extension GL_NV_fragment_program2 (SX) -# Added Extension GL_NV_vertex_program2_option (SX) -# Added Extension GL_NV_vertex_program3 (SX) -# Version 1.8 Added explicit delegate type definitions (LM) -# Added .Net 1.1 Support (LM) -# Added .Net overloaded functions (LM) -# Added delayed extension loading and stubs (LM) -# Added automatic InitOpenGL call in CreateRenderingContext(LM) -# Added extra Read* function (LM) -# Version 2.0 fixed some Problem with version string and damn drivers. -# String 1.15 identified as OpenGL 1.5 not as OpenGL 1.1 (SX) -# Removed unexisting extension GL_ARB_texture_mirror_repeat(SX) -# Added Extension WGL_ARB_pixel_format_float (SX) -# Added Extension GL_EXT_stencil_clear_tag (SX) -# Added Extension GL_EXT_texture_rectangle (SX) -# Added Extension GL_EXT_texture_edge_clamp (SX) -# Some 1.5 Core Consts added (now completed) (SX) -# gluProject need pointer for not .net (SX) -# gluUnProject need pointer for not .net (SX) -# wglUseFontOutlines* need pointer for not .net (SX) -# wglSwapMultipleBuffers need pointer for not .net (SX) -# Bug with wglGetExtensionsStringEXT removed -# different type for .net (SX) -# Added OpenGL 2.0 Core (SX) -# Version 2.0.1 fixed some problems with glGetActiveAttrib in 2.0 Core (SX) -# fixes some problems with gluProject (SX) -# fixes some problems with gluUnProject (SX) -# fixes some problems with gluTessVertex (SX) -# fixes some problems with gluLoadSamplingMatrices (SX) -# Version 2.1 Removed .NET Support (SX) -# Better support for Linux (SX) -# Better Codeformation (SX) -# Added some more Vector/Matrix types (SX) -# Added OpenGL 2.1 Core (SX) -# Added Extension GL_EXT_packed_depth_stencil (SX) -# Added Extension GL_EXT_texture_sRGB (SX) -# Added Extension GL_EXT_framebuffer_blit (SX) -# Added Extension GL_EXT_framebuffer_multisample (SX) -# Added Extension GL_EXT_timer_query (SX) -# Added Extension GL_EXT_gpu_program_parameters (SX) -# Added Extension GL_EXT_bindable_uniform (SX) -# Added Extension GL_EXT_draw_buffers2 (SX) -# Added Extension GL_EXT_draw_instanced (SX) -# Added Extension GL_EXT_framebuffer_sRGB (SX) -# Added Extension GL_EXT_geometry_shader4 (SX) -# Added Extension GL_EXT_gpu_shader4 (SX) -# Added Extension GL_EXT_packed_float (SX) -# Added Extension GL_EXT_texture_array (SX) -# Added Extension GL_EXT_texture_buffer_object (SX) -# Added Extension GL_EXT_texture_compression_latc (SX) -# Added Extension GL_EXT_texture_compression_rgtc (SX) -# Added Extension GL_EXT_texture_integer (SX) -# Added Extension GL_EXT_texture_shared_exponent (SX) -# Added Extension GL_NV_depth_buffer_float (SX) -# Added Extension GL_NV_fragment_program4 (SX) -# Added Extension GL_NV_framebuffer_multisample_coverage (SX) -# Added Extension GL_NV_geometry_program4 (SX) -# Added Extension GL_NV_gpu_program4 (SX) -# Added Extension GL_NV_parameter_buffer_object (SX) -# Added Extension GL_NV_transform_feedback (SX) -# Added Extension GL_NV_vertex_program4 (SX) -# Version 3.0 fixed some const of GL_EXT_texture_shared_exponent (SX) -# possible better support for mac (SX) -# Added OpenGL 3.0 Core (SX) -# Added Extension GL_ARB_depth_buffer_float (SX) -# Added Extension GL_ARB_draw_instanced (SX) -# Added Extension GL_ARB_framebuffer_object (SX) -# Added Extension GL_ARB_framebuffer_sRGB (SX) -# Added Extension GL_ARB_geometry_shader4 (SX) -# Added Extension GL_ARB_half_float_vertex (SX) -# Added Extension GL_ARB_instanced_arrays (SX) -# Added Extension GL_ARB_map_buffer_range (SX) -# Added Extension GL_ARB_texture_buffer_object (SX) -# Added Extension GL_ARB_texture_compression_rgtc (SX) -# Added Extension GL_ARB_texture_rg (SX) -# Added Extension GL_ARB_vertex_array_object (SX) -# Added Extension GL_NV_conditional_render (SX) -# Added Extension GL_NV_present_video (SX) -# Added Extension GL_EXT_transform_feedback (SX) -# Added Extension GL_EXT_direct_state_access (SX) -# Added Extension GL_EXT_vertex_array_bgra (SX) -# Added Extension GL_EXT_texture_swizzle (SX) -# Added Extension GL_NV_explicit_multisample (SX) -# Added Extension GL_NV_transform_feedback2 (SX) -# Added Extension WGL_ARB_create_context (SX) -# Added Extension WGL_NV_present_video (SX) -# Added Extension WGL_NV_video_out (SX) -# Added Extension WGL_NV_swap_group (SX) -# Added Extension WGL_NV_gpu_affinity (SX) -# Added define DGL_TINY_HEADER to suppress automatic -# function loading (SX) -# glProcedure renamed to dglGetProcAddress and now it's -# visible from outside the unit to custom load functions (SX) -# dglCheckExtension added to check if an extension exists (SX) -# Read_GL_ARB_buffer_object renamed to -# Read_GL_ARB_vertex_buffer_object (SX) -# Version 3.0.1 fixed an problem with fpc (SX) -# Version 3.0.2 fixed an problem with WGL_ARB_create_context (SX) -# Version 3.2 Functions from GL_VERSION_3_0 where updated (SX) -# Functions from GL_ARB_map_buffer_range where updated (SX) -# Functions from GL_NV_present_video where added (SX) -# Added consts of GL_ARB_instanced_arrays (SX) -# Defines to identify Delphi was changed (prevent for -# feature maintenance) (SX) -# Added Extension GL_ATI_meminfo (SX) -# Added Extension GL_AMD_performance_monitor (SX) -# Added Extension GL_AMD_texture_texture4 (SX) -# Added Extension GL_AMD_vertex_shader_tesselator (SX) -# Added Extension GL_EXT_provoking_vertex (SX) -# Added Extension WGL_AMD_gpu_association (SX) -# Added OpenGL 3.1 Core (SX) -# All deprecated stuff can be disabled if you undef the -# define DGL_DEPRECATED (SX) -# Added Extension GL_ARB_uniform_buffer_object (SX) -# Added Extension GL_ARB_compatibility (SX) -# Added Extension GL_ARB_copy_buffer (SX) -# Added Extension GL_ARB_shader_texture_lod (SX) -# Remove function from GL_NV_present_video (SX) -# Added Extension WGL_3DL_stereo_control (SX) -# Added Extension GL_EXT_texture_snorm (SX) -# Added Extension GL_AMD_draw_buffers_blend (SX) -# Added Extension GL_APPLE_texture_range (SX) -# Added Extension GL_APPLE_float_pixels (SX) -# Added Extension GL_APPLE_vertex_program_evaluators (SX) -# Added Extension GL_APPLE_aux_depth_stencil (SX) -# Added Extension GL_APPLE_object_purgeable (SX) -# Added Extension GL_APPLE_row_bytes (SX) -# Added OpenGL 3.2 Core (SX) -# Added Extension GL_ARB_depth_clamp (SX) -# Added Extension GL_ARB_draw_elements_base_vertex (SX) -# Added Extension GL_ARB_fragment_coord_conventions (SX) -# Added Extension GL_ARB_provoking_vertex (SX) -# Added Extension GL_ARB_seamless_cube_map (SX) -# Added Extension GL_ARB_sync (SX) -# Added Extension GL_ARB_texture_multisample (SX) -# Added Extension GL_ARB_vertex_array_bgra (SX) -# Added Extension GL_ARB_draw_buffers_blend (SX) -# Added Extension GL_ARB_sample_shading (SX) -# Added Extension GL_ARB_texture_cube_map_array (SX) -# Added Extension GL_ARB_texture_gather (SX) -# Added Extension GL_ARB_texture_query_lod (SX) -# Added Extension WGL_ARB_create_context_profile (SX) -# Added GLX Core up to Version 1.4 (SX) -# Added Extension GLX_ARB_multisample (SX) -# Added Extension GLX_ARB_fbconfig_float (SX) -# Added Extension GLX_ARB_get_proc_address (SX) -# Added Extension GLX_ARB_create_context (SX) -# Added Extension GLX_ARB_create_context_profile (SX) -# Added Extension GLX_EXT_visual_info (SX) -# Added Extension GLX_EXT_visual_rating (SX) -# Added Extension GLX_EXT_import_context (SX) -# Added Extension GLX_EXT_fbconfig_packed_float (SX) -# Added Extension GLX_EXT_framebuffer_sRGB (SX) -# Added Extension GLX_EXT_texture_from_pixmap (SX) -# Version 3.2.1 Fixed some problems with Delphi < 6 (SX) -# Version 3.2.2 Added Extension GL_APPLE_rgb_422 (SX) -# Added Extension GL_EXT_separate_shader_objects (SX) -# Added Extension GL_NV_video_capture (SX) -# Added Extension GL_NV_copy_image (SX) -# Added Extension GL_NV_parameter_buffer_object2 (SX) -# Added Extension GL_NV_shader_buffer_load (SX) -# Added Extension GL_NV_vertex_buffer_unified_memory (SX) -# Added Extension GL_NV_texture_barrier (SX) -# Variable GL_EXT_texture_snorm will be filled (SX) -# Variable GL_APPLE_row_bytes will be filled (SX) -# Added Extension WGL_NV_video_capture (SX) -# Added Extension WGL_NV_copy_image (SX) -# WGL_NV_video_out now named WGL_NV_video_output (SX) -# Added Extension GLX_EXT_swap_control (SX) -# Version 3.2.3 Fixed an Problem with glGetAttribLocation (SX) -# Added const GL_UNIFORM_BUFFER_EXT (SX) -# Functions of GL_NV_texture_barrier now will be loaded (SX) -# Version 4.0 Changes on Extension GL_ARB_texture_gather (SX) -# Changes on Extension GL_NV_shader_buffer_load (SX) -# Added OpenGL 3.3 Core (SX) -# Added OpenGL 4.0 Core (SX) -# Added Extension GL_AMD_shader_stencil_export (SX) -# Added Extension GL_AMD_seamless_cubemap_per_texture (SX) -# Added Extension GL_ARB_shading_language_include (SX) -# Added Extension GL_ARB_texture_compression_bptc (SX) -# Added Extension GL_ARB_blend_func_extended (SX) -# Added Extension GL_ARB_explicit_attrib_location (SX) -# Added Extension GL_ARB_occlusion_query2 (SX) -# Added Extension GL_ARB_sampler_objects (SX) -# Added Extension GL_ARB_shader_bit_encoding (SX) -# Added Extension GL_ARB_texture_rgb10_a2ui (SX) -# Added Extension GL_ARB_texture_swizzle (SX) -# Added Extension GL_ARB_timer_query (SX) -# Added Extension GL_ARB_vertextyp_2_10_10_10_rev (SX) -# Added Extension GL_ARB_draw_indirect (SX) -# Added Extension GL_ARB_gpu_shader5 (SX) -# Added Extension GL_ARB_gpu_shader_fp64 (SX) -# Added Extension GL_ARB_shader_subroutine (SX) -# Added Extension GL_ARB_tessellation_shader (SX) -# Added Extension GL_ARB_texture_buffer_object_rgb32 (SX) -# Added Extension GL_ARB_transform_feedback2 (SX) -# Added Extension GL_ARB_transform_feedback3 (SX) -# Version 4.1 Possible fix some strange linux behavior (SX) -# All function uses GL instead of TGL types (SX) -# GL_AMD_vertex_shader_tesselator will be read now (SX) -# GL_AMD_draw_buffers_blend will be read now (SX) -# Changes on glStencilFuncSeparate (GL_2_0) (SX) -# Changes on GL_VERSION_3_2 (SX) -# Changes on GL_VERSION_3_3 (SX) -# Changes on GL_VERSION_4_0 (SX) -# Changes on GL_ARB_sample_shading (SX) -# Changes on GL_ARB_texture_cube_map_array (SX) -# Changes on GL_ARB_gpu_shader5 (SX) -# Changes on GL_ARB_transform_feedback3 (SX) -# Changes on GL_ARB_sampler_objects (SX) -# Changes on GL_ARB_gpu_shader_fp64 (SX) -# Changes on GL_APPLE_element_array (SX) -# Changes on GL_APPLE_vertex_array_range (SX) -# Changes on GL_NV_transform_feedback (SX) -# Changes on GL_NV_vertex_buffer_unified_memory (SX) -# Changes on GL_EXT_multi_draw_arrays (SX) -# Changes on GL_EXT_direct_state_access (SX) -# Changes on GL_AMD_performance_monitor (SX) -# Changes on GL_AMD_seamless_cubemap_per_texture (SX) -# Changes on GL_EXT_geometry_shader4 (SX) -# Added OpenGL 4.1 Core (SX) -# Added Extension GL_ARB_ES2_compatibility (SX) -# Added Extension GL_ARB_get_program_binary (SX) -# Added Extension GL_ARB_separate_shader_objects (SX) -# Added Extension GL_ARB_shader_precision (SX) -# Added Extension GL_ARB_vertex_attrib_64bit (SX) -# Added Extension GL_ARB_viewport_array (SX) -# Added Extension GL_ARB_cl_event (SX) -# Added Extension GL_ARB_debug_output (SX) -# Added Extension GL_ARB_robustness (SX) -# Added Extension GL_ARB_shader_stencil_export (SX) -# Added Extension GL_AMD_conservative_depth (SX) -# Added Extension GL_EXT_shader_image_load_store (SX) -# Added Extension GL_EXT_vertex_attrib_64bit (SX) -# Added Extension GL_NV_gpu_program5 (SX) -# Added Extension GL_NV_gpu_shader5 (SX) -# Added Extension GL_NV_shader_buffer_store (SX) -# Added Extension GL_NV_tessellation_program5 (SX) -# Added Extension GL_NV_vertex_attrib_integer_64bit (SX) -# Added Extension GL_NV_multisample_coverage (SX) -# Added Extension GL_AMD_name_gen_delete (SX) -# Added Extension GL_AMD_debug_output (SX) -# Added Extension GL_NV_vdpau_interop (SX) -# Added Extension GL_AMD_transform_feedback3_lines_triangles (SX) -# Added Extension GL_AMD_depth_clamp_separate (SX) -# Added Extension GL_EXT_texture_sRGB_decode (SX) -# Added Extension WGL_ARB_framebuffer_sRGB (SX) -# Added Extension WGL_ARB_create_context_robustness (SX) -# Added Extension WGL_EXT_create_context_es2_profile (SX) -# Added Extension WGL_NV_multisample_coverage (SX) -# Added Extension GLX_ARB_vertex_buffer_object (SX) -# Added Extension GLX_ARB_framebuffer_sRGB (SX) -# Added Extension GLX_ARB_create_context_robustness (SX) -# Added Extension GLX_EXT_create_context_es2_profile (SX) -# Version 4.1a Fix for dglGetProcAddress with FPC and linux (def param) (SW) -# Version 4.2 Added OpenGL 4.2 Core (SW) -# Added Extension GL_ARB_base_instance (SW) -# Added Extension GL_ARB_shading_language_420pack (SW) -# Added Extension GL_ARB_transform_feedback_instanced (SW) -# Added Extension GL_ARB_compressed_texture_pixel_storage (SW) -# Added Extension GL_ARB_conservative_depth (SW) -# Added Extension GL_ARB_internalformat_query (SW) -# Added Extension GL_ARB_map_buffer_alignment (SW) -# Added Extension GL_ARB_shader_atomic_counters (SW) -# Added Extension GL_ARB_shader_image_load_store (SW) -# Added Extension GL_ARB_shading_language_packing (SW) -# Added Extension GL_ARB_texture_storage (SW) -# Added Extension WGL_NV_DX_interop (SW) -# Added Define for WGL_EXT_create_context_es2_profile (SW) -# Version 4.2a Added Mac OS X patch by Andrey Gruzdev (SW) -#============================================================================== -# Header based on glext.h rev 72 (2011/08/08) -# Header based on wglext.h rev 23 (2011/04/13) -# Header based on glxext.h rev 32 (2010/08/06) (only Core/ARB/EXT) -# -# This is an important notice for maintaining. Dont remove it. And make sure -# to keep it up to date -#============================================================================== - -{.deadCodeElim: on.} - -type - PPointer* = ptr Pointer - GLenum* = uint32 - GLboolean* = bool - GLbitfield* = uint32 - GLbyte* = int8 - GLshort* = int16 - GLint* = int32 - GLsizei* = int32 - GLubyte* = uint8 - GLushort* = uint16 - GLuint* = uint32 - GLfloat* = float32 - GLclampf* = float32 - GLdouble* = float64 - GLclampd* = float64 - GLvoid* = Pointer - GLint64* = Int64 - GLuint64* = uint64 - 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 - TGLvoid* = GLvoid - TGLint64* = GLint64 - TGLuint64* = GLuint64 - PGLboolean* = ptr GLboolean - PGLbyte* = ptr GLbyte - PGLshort* = ptr GLshort - PGLint* = ptr GLint - PGLsizei* = ptr GLsizei - PGLubyte* = ptr GLubyte - PGLushort* = ptr GLushort - PGLuint* = ptr GLuint - PGLclampf* = ptr GLclampf - PGLfloat* = ptr GLfloat - PGLdouble* = ptr GLdouble - PGLclampd* = ptr GLclampd - PGLenum* = ptr GLenum - PGLvoid* = Pointer - PPGLvoid* = ptr PGLvoid - PGLint64* = ptr GLint64 - PGLuint64* = ptr GLuint64 # GL_NV_half_float - GLhalfNV* = int16 - TGLhalfNV* = GLhalfNV - PGLhalfNV* = ptr GLhalfNV # GL_ARB_shader_objects - PGLHandleARB* = ptr GLHandleARB - GLHandleARB* = int - GLcharARB* = Char - PGLcharARB* = cstring - PPGLcharARB* = ptr PGLcharARB # GL_VERSION_1_5 - GLintptr* = GLint - GLsizeiptr* = GLsizei # GL_ARB_vertex_buffer_object - GLintptrARB* = GLint - GLsizeiptrARB* = GLsizei # GL_VERSION_2_0 - GLHandle* = int - PGLchar* = cstring - PPGLchar* = ptr PGLChar # GL_EXT_timer_query - GLint64EXT* = Int64 - TGLint64EXT* = GLint64EXT - PGLint64EXT* = ptr GLint64EXT - GLuint64EXT* = GLuint64 - TGLuint64EXT* = GLuint64EXT - PGLuint64EXT* = ptr GLuint64EXT # WGL_ARB_pbuffer - - GLsync* = Pointer # GL_ARB_cl_event - # These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event - Tcl_context*{.final.} = object - Tcl_event*{.final.} = object - p_cl_context* = ptr Tcl_context - p_cl_event* = ptr Tcl_event # GL_ARB_debug_output - TglDebugProcARB* = proc (source: GLenum, typ: GLenum, id: GLuint, - severity: GLenum, len: GLsizei, message: PGLchar, - userParam: PGLvoid){.stdcall.} # GL_AMD_debug_output - TglDebugProcAMD* = proc (id: GLuint, category: GLenum, severity: GLenum, - len: GLsizei, message: PGLchar, userParam: PGLvoid){. - stdcall.} # GL_NV_vdpau_interop - GLvdpauSurfaceNV* = GLintptr - PGLvdpauSurfaceNV* = ptr GLvdpauSurfaceNV # GLX - -when defined(windows): - type - HPBUFFERARB* = THandle # WGL_EXT_pbuffer - HPBUFFEREXT* = THandle # WGL_NV_present_video - PHVIDEOOUTPUTDEVICENV* = ptr HVIDEOOUTPUTDEVICENV - HVIDEOOUTPUTDEVICENV* = THandle # WGL_NV_video_output - PHPVIDEODEV* = ptr HPVIDEODEV - HPVIDEODEV* = THandle # WGL_NV_gpu_affinity - PHPGPUNV* = ptr HPGPUNV - PHGPUNV* = ptr HGPUNV # WGL_NV_video_capture - HVIDEOINPUTDEVICENV* = THandle - PHVIDEOINPUTDEVICENV* = ptr HVIDEOINPUTDEVICENV - HPGPUNV* = THandle - HGPUNV* = THandle # GL_ARB_sync - -when defined(LINUX): - type - GLXContext* = Pointer - GLXContextID* = TXID - GLXDrawable* = TXID - GLXFBConfig* = Pointer - GLXPbuffer* = TXID - GLXPixmap* = TXID - GLXWindow* = TXID - Window* = TXID - Colormap* = TXID - Pixmap* = TXID - Font* = TXID -type # Datatypes corresponding to GL's types TGL(name)(type)(count) - TGLVectorub2* = array[0..1, GLubyte] - TGLVectori2* = array[0..1, GLint] - TGLVectorf2* = array[0..1, GLfloat] - TGLVectord2* = array[0..1, GLdouble] - TGLVectorp2* = array[0..1, Pointer] - TGLVectorb3* = array[0..2, GLbyte] - TGLVectorub3* = array[0..2, GLubyte] - TGLVectori3* = array[0..2, GLint] - TGLVectorui3* = array[0..2, GLuint] - TGLVectorf3* = array[0..2, GLfloat] - TGLVectord3* = array[0..2, GLdouble] - TGLVectorp3* = array[0..2, Pointer] - TGLVectors3* = array[0..2, GLshort] - TGLVectorus3* = array[0..2, GLushort] - TGLVectorb4* = array[0..3, GLbyte] - TGLVectorub4* = array[0..3, GLubyte] - TGLVectori4* = array[0..3, GLint] - TGLVectorui4* = array[0..3, GLuint] - TGLVectorf4* = array[0..3, GLfloat] - TGLVectord4* = array[0..3, GLdouble] - TGLVectorp4* = array[0..3, Pointer] - TGLVectors4* = array[0..3, GLshort] - TGLVectorus4* = array[0..3, GLshort] - TGLArrayf4* = TGLVectorf4 - TGLArrayf3* = TGLVectorf3 - TGLArrayd3* = TGLVectord3 - TGLArrayi4* = TGLVectori4 - TGLArrayp4* = TGLVectorp4 - TGlMatrixub3* = array[0..2, array[0..2, GLubyte]] - TGlMatrixi3* = array[0..2, array[0..2, GLint]] - TGLMatrixf3* = array[0..2, array[0..2, GLfloat]] - TGLMatrixd3* = array[0..2, array[0..2, GLdouble]] - TGlMatrixub4* = array[0..3, array[0..3, GLubyte]] - TGlMatrixi4* = array[0..3, array[0..3, GLint]] - TGLMatrixf4* = array[0..3, array[0..3, GLfloat]] - TGLMatrixd4* = array[0..3, array[0..3, GLdouble]] - TGLVector3f* = TGLVectorf3 # Datatypes corresponding to OpenGL12.pas for easy porting - TVector3d* = TGLVectord3 - TVector4i* = TGLVectori4 - TVector4f* = TGLVectorf4 - TVector4p* = TGLVectorp4 - TMatrix4f* = TGLMatrixf4 - TMatrix4d* = TGLMatrixd4 - PGLMatrixd4* = ptr TGLMatrixd4 - PVector4i* = ptr TVector4i - TRect*{.final.} = object - Left*, Top*, Right*, Bottom*: int32 - - PGPU_DEVICE* = ptr GPU_DEVICE - GPU_DEVICE*{.final.} = object - cb*: int32 - DeviceName*: array[0..31, Char] - DeviceString*: array[0..127, Char] - Flags*: int32 - rcVirtualScreen*: TRect - - -when defined(windows): - type - PWGLSwap* = ptr TWGLSwap - TWGLSWAP*{.final.} = object - hdc*: HDC - uiFlags*: int32 - -type - TGLUNurbs*{.final.} = object - TGLUQuadric*{.final.} = object - TGLUTesselator*{.final.} = object - PGLUNurbs* = ptr TGLUNurbs - PGLUQuadric* = ptr TGLUQuadric - PGLUTesselator* = ptr TGLUTesselator # backwards compatibility - TGLUNurbsObj* = TGLUNurbs - TGLUQuadricObj* = TGLUQuadric - TGLUTesselatorObj* = TGLUTesselator - TGLUTriangulatorObj* = TGLUTesselator - PGLUNurbsObj* = PGLUNurbs - PGLUQuadricObj* = PGLUQuadric - PGLUTesselatorObj* = PGLUTesselator - PGLUTriangulatorObj* = PGLUTesselator # GLUQuadricCallback - - TGLUQuadricErrorProc* = proc(errorCode: GLenum){.stdcall.} - TGLUTessBeginProc* = proc(AType: GLenum){.stdcall.} - TGLUTessEdgeFlagProc* = proc(Flag: GLboolean){.stdcall.} - TGLUTessVertexProc* = proc(VertexData: Pointer){.stdcall.} - TGLUTessEndProc* = proc(){.stdcall.} - TGLUTessErrorProc* = proc(ErrNo: GLenum){.stdcall.} - TGLUTessCombineProc* = proc(Coords: TGLArrayd3, VertexData: TGLArrayp4, - Weight: TGLArrayf4, OutData: PPointer){.stdcall.} - TGLUTessBeginDataProc* = proc(AType: GLenum, UserData: Pointer){.stdcall.} - TGLUTessEdgeFlagDataProc* = proc(Flag: GLboolean, UserData: Pointer){.stdcall.} - TGLUTessVertexDataProc* = proc(VertexData: Pointer, UserData: Pointer){.stdcall.} - TGLUTessEndDataProc* = proc(UserData: Pointer){.stdcall.} - TGLUTessErrorDataProc* = proc(ErrNo: GLenum, UserData: Pointer){.stdcall.} - TGLUTessCombineDataProc* = proc(Coords: TGLArrayd3, VertexData: TGLArrayp4, - Weight: TGLArrayf4, OutData: PPointer, - UserData: Pointer){.stdcall.} - # GLUNurbsCallback - TGLUNurbsErrorProc* = proc(ErrorCode: GLEnum){.stdcall.} - -const # GL_VERSION_1_1 - # AttribMask - GL_DEPTH_BUFFER_BIT* = 0x00000100 - GL_STENCIL_BUFFER_BIT* = 0x00000400 - GL_COLOR_BUFFER_BIT* = 0x00004000 # Boolean - GL_TRUE* = 1 - GL_FALSE* = 0 # BeginMode - GL_POINTS* = 0x00000000 - GL_LINES* = 0x00000001 - GL_LINE_LOOP* = 0x00000002 - GL_LINE_STRIP* = 0x00000003 - GL_TRIANGLES* = 0x00000004 - GL_TRIANGLE_STRIP* = 0x00000005 - GL_TRIANGLE_FAN* = 0x00000006 # AlphaFunction - GL_NEVER* = 0x00000200 - GL_LESS* = 0x00000201 - GL_EQUAL* = 0x00000202 - GL_LEQUAL* = 0x00000203 - GL_GREATER* = 0x00000204 - GL_NOTEQUAL* = 0x00000205 - GL_GEQUAL* = 0x00000206 - GL_ALWAYS* = 0x00000207 # BlendingFactorDest - GL_ZERO* = 0 - GL_ONE* = 1 - GL_SRC_COLOR* = 0x00000300 - GL_ONE_MINUS_SRC_COLOR* = 0x00000301 - GL_SRC_ALPHA* = 0x00000302 - GL_ONE_MINUS_SRC_ALPHA* = 0x00000303 - GL_DST_ALPHA* = 0x00000304 - GL_ONE_MINUS_DST_ALPHA* = 0x00000305 # BlendingFactorSrc - GL_DST_COLOR* = 0x00000306 - GL_ONE_MINUS_DST_COLOR* = 0x00000307 - GL_SRC_ALPHA_SATURATE* = 0x00000308 # DrawBufferMode - GL_NONE* = 0 - GL_FRONT_LEFT* = 0x00000400 - GL_FRONT_RIGHT* = 0x00000401 - GL_BACK_LEFT* = 0x00000402 - GL_BACK_RIGHT* = 0x00000403 - GL_FRONT* = 0x00000404 - GL_BACK* = 0x00000405 - GL_LEFT* = 0x00000406 - GL_RIGHT* = 0x00000407 - GL_FRONT_AND_BACK* = 0x00000408 # ErrorCode - GL_NO_ERROR* = 0 - GL_INVALID_ENUM* = 0x00000500 - GL_INVALID_VALUE* = 0x00000501 - GL_INVALID_OPERATION* = 0x00000502 - GL_OUT_OF_MEMORY* = 0x00000505 # FrontFaceDirection - GL_CW* = 0x00000900 - GL_CCW* = 0x00000901 # GetPName - cGL_POINT_SIZE* = 0x00000B11 - GL_POINT_SIZE_RANGE* = 0x00000B12 - GL_POINT_SIZE_GRANULARITY* = 0x00000B13 - GL_LINE_SMOOTH* = 0x00000B20 - cGL_LINE_WIDTH* = 0x00000B21 - GL_LINE_WIDTH_RANGE* = 0x00000B22 - GL_LINE_WIDTH_GRANULARITY* = 0x00000B23 - GL_POLYGON_SMOOTH* = 0x00000B41 - cGL_CULL_FACE* = 0x00000B44 - GL_CULL_FACE_MODE* = 0x00000B45 - cGL_FRONT_FACE* = 0x00000B46 - cGL_DEPTH_RANGE* = 0x00000B70 - GL_DEPTH_TEST* = 0x00000B71 - GL_DEPTH_WRITEMASK* = 0x00000B72 - GL_DEPTH_CLEAR_VALUE* = 0x00000B73 - cGL_DEPTH_FUNC* = 0x00000B74 - GL_STENCIL_TEST* = 0x00000B90 - GL_STENCIL_CLEAR_VALUE* = 0x00000B91 - cGL_STENCIL_FUNC* = 0x00000B92 - GL_STENCIL_VALUE_MASK* = 0x00000B93 - GL_STENCIL_FAIL* = 0x00000B94 - GL_STENCIL_PASS_DEPTH_FAIL* = 0x00000B95 - GL_STENCIL_PASS_DEPTH_PASS* = 0x00000B96 - GL_STENCIL_REF* = 0x00000B97 - GL_STENCIL_WRITEMASK* = 0x00000B98 - cGL_VIEWPORT* = 0x00000BA2 - GL_DITHER* = 0x00000BD0 - GL_BLEND_DST* = 0x00000BE0 - GL_BLEND_SRC* = 0x00000BE1 - GL_BLEND* = 0x00000BE2 - GL_LOGIC_OP_MODE* = 0x00000BF0 - GL_COLOR_LOGIC_OP* = 0x00000BF2 - cGL_DRAW_BUFFER* = 0x00000C01 - cGL_READ_BUFFER* = 0x00000C02 - GL_SCISSOR_BOX* = 0x00000C10 - GL_SCISSOR_TEST* = 0x00000C11 - GL_COLOR_CLEAR_VALUE* = 0x00000C22 - GL_COLOR_WRITEMASK* = 0x00000C23 - GL_DOUBLEBUFFER* = 0x00000C32 - GL_STEREO* = 0x00000C33 - GL_LINE_SMOOTH_HINT* = 0x00000C52 - GL_POLYGON_SMOOTH_HINT* = 0x00000C53 - GL_UNPACK_SWAP_BYTES* = 0x00000CF0 - GL_UNPACK_LSB_FIRST* = 0x00000CF1 - GL_UNPACK_ROW_LENGTH* = 0x00000CF2 - GL_UNPACK_SKIP_ROWS* = 0x00000CF3 - GL_UNPACK_SKIP_PIXELS* = 0x00000CF4 - GL_UNPACK_ALIGNMENT* = 0x00000CF5 - GL_PACK_SWAP_BYTES* = 0x00000D00 - GL_PACK_LSB_FIRST* = 0x00000D01 - GL_PACK_ROW_LENGTH* = 0x00000D02 - GL_PACK_SKIP_ROWS* = 0x00000D03 - GL_PACK_SKIP_PIXELS* = 0x00000D04 - GL_PACK_ALIGNMENT* = 0x00000D05 - GL_MAX_TEXTURE_SIZE* = 0x00000D33 - GL_MAX_VIEWPORT_DIMS* = 0x00000D3A - GL_SUBPIXEL_BITS* = 0x00000D50 - GL_TEXTURE_1D* = 0x00000DE0 - GL_TEXTURE_2D* = 0x00000DE1 - GL_POLYGON_OFFSET_UNITS* = 0x00002A00 - GL_POLYGON_OFFSET_POINT* = 0x00002A01 - GL_POLYGON_OFFSET_LINE* = 0x00002A02 - GL_POLYGON_OFFSET_FILL* = 0x00008037 - GL_POLYGON_OFFSET_FACTOR* = 0x00008038 - GL_TEXTURE_BINDING_1D* = 0x00008068 - GL_TEXTURE_BINDING_2D* = 0x00008069 # GetTextureParameter - GL_TEXTURE_WIDTH* = 0x00001000 - GL_TEXTURE_HEIGHT* = 0x00001001 - GL_TEXTURE_INTERNAL_FORMAT* = 0x00001003 - GL_TEXTURE_BORDER_COLOR* = 0x00001004 - GL_TEXTURE_BORDER* = 0x00001005 - GL_TEXTURE_RED_SIZE* = 0x0000805C - GL_TEXTURE_GREEN_SIZE* = 0x0000805D - GL_TEXTURE_BLUE_SIZE* = 0x0000805E - GL_TEXTURE_ALPHA_SIZE* = 0x0000805F # HintMode - GL_DONT_CARE* = 0x00001100 - GL_FASTEST* = 0x00001101 - GL_NICEST* = 0x00001102 # DataType - cGL_BYTE* = 0x00001400 - cGL_UNSIGNED_BYTE* = 0x00001401 - cGL_SHORT* = 0x00001402 - cGL_UNSIGNED_SHORT* = 0x00001403 - cGL_INT* = 0x00001404 - cGL_UNSIGNED_INT* = 0x00001405 - cGL_FLOAT* = 0x00001406 - cGL_DOUBLE* = 0x0000140A # LogicOp - cGL_CLEAR* = 0x00001500 - GL_AND* = 0x00001501 - GL_AND_REVERSE* = 0x00001502 - GL_COPY* = 0x00001503 - GL_AND_INVERTED* = 0x00001504 - GL_NOOP* = 0x00001505 - GL_XOR* = 0x00001506 - GL_OR* = 0x00001507 - GL_NOR* = 0x00001508 - GL_EQUIV* = 0x00001509 - GL_INVERT* = 0x0000150A - GL_OR_REVERSE* = 0x0000150B - GL_COPY_INVERTED* = 0x0000150C - GL_OR_INVERTED* = 0x0000150D - GL_NAND* = 0x0000150E - GL_SET* = 0x0000150F # MatrixMode (for gl3.h, FBO attachment type) - GL_TEXTURE* = 0x00001702 # PixelCopyType - GL_COLOR* = 0x00001800 - GL_DEPTH* = 0x00001801 - GL_STENCIL* = 0x00001802 # PixelFormat - GL_STENCIL_INDEX* = 0x00001901 - GL_DEPTH_COMPONENT* = 0x00001902 - GL_RED* = 0x00001903 - GL_GREEN* = 0x00001904 - GL_BLUE* = 0x00001905 - GL_ALPHA* = 0x00001906 - GL_RGB* = 0x00001907 - GL_RGBA* = 0x00001908 # PolygonMode - GL_POINT* = 0x00001B00 - GL_LINE* = 0x00001B01 - GL_FILL* = 0x00001B02 # StencilOp - GL_KEEP* = 0x00001E00 - GL_REPLACE* = 0x00001E01 - GL_INCR* = 0x00001E02 - GL_DECR* = 0x00001E03 # StringName - GL_VENDOR* = 0x00001F00 - GL_RENDERER* = 0x00001F01 - GL_VERSION* = 0x00001F02 - GL_EXTENSIONS* = 0x00001F03 # TextureMagFilter - GL_NEAREST* = 0x00002600 - GL_LINEAR* = 0x00002601 # TextureMinFilter - GL_NEAREST_MIPMAP_NEAREST* = 0x00002700 - GL_LINEAR_MIPMAP_NEAREST* = 0x00002701 - GL_NEAREST_MIPMAP_LINEAR* = 0x00002702 - GL_LINEAR_MIPMAP_LINEAR* = 0x00002703 # TextureParameterName - GL_TEXTURE_MAG_FILTER* = 0x00002800 - GL_TEXTURE_MIN_FILTER* = 0x00002801 - GL_TEXTURE_WRAP_S* = 0x00002802 - GL_TEXTURE_WRAP_T* = 0x00002803 # TextureTarget - GL_PROXY_TEXTURE_1D* = 0x00008063 - GL_PROXY_TEXTURE_2D* = 0x00008064 # TextureWrapMode - GL_REPEAT* = 0x00002901 # PixelInternalFormat - GL_R3_G3_B2* = 0x00002A10 - GL_RGB4* = 0x0000804F - GL_RGB5* = 0x00008050 - GL_RGB8* = 0x00008051 - GL_RGB10* = 0x00008052 - GL_RGB12* = 0x00008053 - GL_RGB16* = 0x00008054 - GL_RGBA2* = 0x00008055 - GL_RGBA4* = 0x00008056 - GL_RGB5_A1* = 0x00008057 - GL_RGBA8* = 0x00008058 - GL_RGB10_A2* = 0x00008059 - GL_RGBA12* = 0x0000805A - GL_RGBA16* = 0x0000805B - cGL_ACCUM* = 0x00000100 - GL_LOAD* = 0x00000101 - GL_RETURN* = 0x00000102 - GL_MULT* = 0x00000103 - GL_ADD* = 0x00000104 - GL_CURRENT_BIT* = 0x00000001 - GL_POINT_BIT* = 0x00000002 - GL_LINE_BIT* = 0x00000004 - GL_POLYGON_BIT* = 0x00000008 - GL_POLYGON_STIPPLE_BIT* = 0x00000010 - GL_PIXEL_MODE_BIT* = 0x00000020 - GL_LIGHTING_BIT* = 0x00000040 - GL_FOG_BIT* = 0x00000080 - GL_ACCUM_BUFFER_BIT* = 0x00000200 - GL_VIEWPORT_BIT* = 0x00000800 - GL_TRANSFORM_BIT* = 0x00001000 - GL_ENABLE_BIT* = 0x00002000 - GL_HINT_BIT* = 0x00008000 - GL_EVAL_BIT* = 0x00010000 - GL_LIST_BIT* = 0x00020000 - GL_TEXTURE_BIT* = 0x00040000 - GL_SCISSOR_BIT* = 0x00080000 - GL_ALL_ATTRIB_BITS* = 0x000FFFFF - GL_QUADS* = 0x00000007 - GL_QUAD_STRIP* = 0x00000008 - GL_POLYGON* = 0x00000009 - GL_CLIP_PLANE0* = 0x00003000 - GL_CLIP_PLANE1* = 0x00003001 - GL_CLIP_PLANE2* = 0x00003002 - GL_CLIP_PLANE3* = 0x00003003 - GL_CLIP_PLANE4* = 0x00003004 - GL_CLIP_PLANE5* = 0x00003005 - GL_2_BYTES* = 0x00001407 - GL_3_BYTES* = 0x00001408 - GL_4_BYTES* = 0x00001409 - GL_AUX0* = 0x00000409 - GL_AUX1* = 0x0000040A - GL_AUX2* = 0x0000040B - GL_AUX3* = 0x0000040C - GL_STACK_OVERFLOW* = 0x00000503 - GL_STACK_UNDERFLOW* = 0x00000504 - GL_2D* = 0x00000600 - GL_3D* = 0x00000601 - GL_3D_COLOR* = 0x00000602 - GL_3D_COLOR_TEXTURE* = 0x00000603 - GL_4D_COLOR_TEXTURE* = 0x00000604 - GL_PASS_THROUGH_TOKEN* = 0x00000700 - GL_POINT_TOKEN* = 0x00000701 - GL_LINE_TOKEN* = 0x00000702 - GL_POLYGON_TOKEN* = 0x00000703 - GL_BITMAP_TOKEN* = 0x00000704 - GL_DRAW_PIXEL_TOKEN* = 0x00000705 - GL_COPY_PIXEL_TOKEN* = 0x00000706 - GL_LINE_RESET_TOKEN* = 0x00000707 - GL_EXP* = 0x00000800 - GL_EXP2* = 0x00000801 - GL_COEFF* = 0x00000A00 - GL_ORDER* = 0x00000A01 - GL_DOMAIN* = 0x00000A02 - GL_CURRENT_COLOR* = 0x00000B00 - GL_CURRENT_INDEX* = 0x00000B01 - GL_CURRENT_NORMAL* = 0x00000B02 - GL_CURRENT_TEXTURE_COORDS* = 0x00000B03 - GL_CURRENT_RASTER_COLOR* = 0x00000B04 - GL_CURRENT_RASTER_INDEX* = 0x00000B05 - GL_CURRENT_RASTER_TEXTURE_COORDS* = 0x00000B06 - GL_CURRENT_RASTER_POSITION* = 0x00000B07 - GL_CURRENT_RASTER_POSITION_VALID* = 0x00000B08 - GL_CURRENT_RASTER_DISTANCE* = 0x00000B09 - GL_POINT_SMOOTH* = 0x00000B10 - cGL_LINE_STIPPLE* = 0x00000B24 - GL_LINE_STIPPLE_PATTERN* = 0x00000B25 - GL_LINE_STIPPLE_REPEAT* = 0x00000B26 - GL_LIST_MODE* = 0x00000B30 - GL_MAX_LIST_NESTING* = 0x00000B31 - cGL_LIST_BASE* = 0x00000B32 - GL_LIST_INDEX* = 0x00000B33 - cGL_POLYGON_MODE* = 0x00000B40 - cGL_POLYGON_STIPPLE* = 0x00000B42 - cGL_EDGE_FLAG* = 0x00000B43 - GL_LIGHTING* = 0x00000B50 - GL_LIGHT_MODEL_LOCAL_VIEWER* = 0x00000B51 - GL_LIGHT_MODEL_TWO_SIDE* = 0x00000B52 - GL_LIGHT_MODEL_AMBIENT* = 0x00000B53 - cGL_SHADE_MODEL* = 0x00000B54 - GL_COLOR_MATERIAL_FACE* = 0x00000B55 - GL_COLOR_MATERIAL_PARAMETER* = 0x00000B56 - cGL_COLOR_MATERIAL* = 0x00000B57 - GL_FOG* = 0x00000B60 - GL_FOG_INDEX* = 0x00000B61 - GL_FOG_DENSITY* = 0x00000B62 - GL_FOG_START* = 0x00000B63 - GL_FOG_END* = 0x00000B64 - GL_FOG_MODE* = 0x00000B65 - GL_FOG_COLOR* = 0x00000B66 - GL_ACCUM_CLEAR_VALUE* = 0x00000B80 - cGL_MATRIX_MODE* = 0x00000BA0 - GL_NORMALIZE* = 0x00000BA1 - GL_MODELVIEW_STACK_DEPTH* = 0x00000BA3 - GL_PROJECTION_STACK_DEPTH* = 0x00000BA4 - GL_TEXTURE_STACK_DEPTH* = 0x00000BA5 - GL_MODELVIEW_MATRIX* = 0x00000BA6 - GL_PROJECTION_MATRIX* = 0x00000BA7 - GL_TEXTURE_MATRIX* = 0x00000BA8 - GL_ATTRIB_STACK_DEPTH* = 0x00000BB0 - GL_CLIENT_ATTRIB_STACK_DEPTH* = 0x00000BB1 - GL_ALPHA_TEST* = 0x00000BC0 - GL_ALPHA_TEST_FUNC* = 0x00000BC1 - GL_ALPHA_TEST_REF* = 0x00000BC2 - GL_INDEX_LOGIC_OP* = 0x00000BF1 - GL_AUX_BUFFERS* = 0x00000C00 - GL_INDEX_CLEAR_VALUE* = 0x00000C20 - GL_INDEX_WRITEMASK* = 0x00000C21 - GL_INDEX_MODE* = 0x00000C30 - GL_RGBA_MODE* = 0x00000C31 - cGL_RENDER_MODE* = 0x00000C40 - GL_PERSPECTIVE_CORRECTION_HINT* = 0x00000C50 - GL_POINT_SMOOTH_HINT* = 0x00000C51 - GL_FOG_HINT* = 0x00000C54 - GL_TEXTURE_GEN_S* = 0x00000C60 - GL_TEXTURE_GEN_T* = 0x00000C61 - GL_TEXTURE_GEN_R* = 0x00000C62 - GL_TEXTURE_GEN_Q* = 0x00000C63 - GL_PIXEL_MAP_I_TO_I* = 0x00000C70 - GL_PIXEL_MAP_S_TO_S* = 0x00000C71 - GL_PIXEL_MAP_I_TO_R* = 0x00000C72 - GL_PIXEL_MAP_I_TO_G* = 0x00000C73 - GL_PIXEL_MAP_I_TO_B* = 0x00000C74 - GL_PIXEL_MAP_I_TO_A* = 0x00000C75 - GL_PIXEL_MAP_R_TO_R* = 0x00000C76 - GL_PIXEL_MAP_G_TO_G* = 0x00000C77 - GL_PIXEL_MAP_B_TO_B* = 0x00000C78 - GL_PIXEL_MAP_A_TO_A* = 0x00000C79 - GL_PIXEL_MAP_I_TO_I_SIZE* = 0x00000CB0 - GL_PIXEL_MAP_S_TO_S_SIZE* = 0x00000CB1 - GL_PIXEL_MAP_I_TO_R_SIZE* = 0x00000CB2 - GL_PIXEL_MAP_I_TO_G_SIZE* = 0x00000CB3 - GL_PIXEL_MAP_I_TO_B_SIZE* = 0x00000CB4 - GL_PIXEL_MAP_I_TO_A_SIZE* = 0x00000CB5 - GL_PIXEL_MAP_R_TO_R_SIZE* = 0x00000CB6 - GL_PIXEL_MAP_G_TO_G_SIZE* = 0x00000CB7 - GL_PIXEL_MAP_B_TO_B_SIZE* = 0x00000CB8 - GL_PIXEL_MAP_A_TO_A_SIZE* = 0x00000CB9 - GL_MAP_COLOR* = 0x00000D10 - GL_MAP_STENCIL* = 0x00000D11 - GL_INDEX_SHIFT* = 0x00000D12 - GL_INDEX_OFFSET* = 0x00000D13 - GL_RED_SCALE* = 0x00000D14 - GL_RED_BIAS* = 0x00000D15 - GL_ZOOM_X* = 0x00000D16 - GL_ZOOM_Y* = 0x00000D17 - GL_GREEN_SCALE* = 0x00000D18 - GL_GREEN_BIAS* = 0x00000D19 - GL_BLUE_SCALE* = 0x00000D1A - GL_BLUE_BIAS* = 0x00000D1B - GL_ALPHA_SCALE* = 0x00000D1C - GL_ALPHA_BIAS* = 0x00000D1D - GL_DEPTH_SCALE* = 0x00000D1E - GL_DEPTH_BIAS* = 0x00000D1F - GL_MAX_EVAL_ORDER* = 0x00000D30 - GL_MAX_LIGHTS* = 0x00000D31 - GL_MAX_CLIP_PLANES* = 0x00000D32 - GL_MAX_PIXEL_MAP_TABLE* = 0x00000D34 - GL_MAX_ATTRIB_STACK_DEPTH* = 0x00000D35 - GL_MAX_MODELVIEW_STACK_DEPTH* = 0x00000D36 - GL_MAX_NAME_STACK_DEPTH* = 0x00000D37 - GL_MAX_PROJECTION_STACK_DEPTH* = 0x00000D38 - GL_MAX_TEXTURE_STACK_DEPTH* = 0x00000D39 - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH* = 0x00000D3B - GL_INDEX_BITS* = 0x00000D51 - GL_RED_BITS* = 0x00000D52 - GL_GREEN_BITS* = 0x00000D53 - GL_BLUE_BITS* = 0x00000D54 - GL_ALPHA_BITS* = 0x00000D55 - GL_DEPTH_BITS* = 0x00000D56 - GL_STENCIL_BITS* = 0x00000D57 - GL_ACCUM_RED_BITS* = 0x00000D58 - GL_ACCUM_GREEN_BITS* = 0x00000D59 - GL_ACCUM_BLUE_BITS* = 0x00000D5A - GL_ACCUM_ALPHA_BITS* = 0x00000D5B - GL_NAME_STACK_DEPTH* = 0x00000D70 - GL_AUTO_NORMAL* = 0x00000D80 - GL_MAP1_COLOR_4* = 0x00000D90 - GL_MAP1_INDEX* = 0x00000D91 - GL_MAP1_NORMAL* = 0x00000D92 - GL_MAP1_TEXTURE_COORD_1* = 0x00000D93 - GL_MAP1_TEXTURE_COORD_2* = 0x00000D94 - GL_MAP1_TEXTURE_COORD_3* = 0x00000D95 - GL_MAP1_TEXTURE_COORD_4* = 0x00000D96 - GL_MAP1_VERTEX_3* = 0x00000D97 - GL_MAP1_VERTEX_4* = 0x00000D98 - GL_MAP2_COLOR_4* = 0x00000DB0 - GL_MAP2_INDEX* = 0x00000DB1 - GL_MAP2_NORMAL* = 0x00000DB2 - GL_MAP2_TEXTURE_COORD_1* = 0x00000DB3 - GL_MAP2_TEXTURE_COORD_2* = 0x00000DB4 - GL_MAP2_TEXTURE_COORD_3* = 0x00000DB5 - GL_MAP2_TEXTURE_COORD_4* = 0x00000DB6 - GL_MAP2_VERTEX_3* = 0x00000DB7 - GL_MAP2_VERTEX_4* = 0x00000DB8 - GL_MAP1_GRID_DOMAIN* = 0x00000DD0 - GL_MAP1_GRID_SEGMENTS* = 0x00000DD1 - GL_MAP2_GRID_DOMAIN* = 0x00000DD2 - GL_MAP2_GRID_SEGMENTS* = 0x00000DD3 - GL_FEEDBACK_BUFFER_POINTER* = 0x00000DF0 - GL_FEEDBACK_BUFFER_SIZE* = 0x00000DF1 - GL_FEEDBACK_BUFFERtyp* = 0x00000DF2 - GL_SELECTION_BUFFER_POINTER* = 0x00000DF3 - GL_SELECTION_BUFFER_SIZE* = 0x00000DF4 - GL_LIGHT0* = 0x00004000 - GL_LIGHT1* = 0x00004001 - GL_LIGHT2* = 0x00004002 - GL_LIGHT3* = 0x00004003 - GL_LIGHT4* = 0x00004004 - GL_LIGHT5* = 0x00004005 - GL_LIGHT6* = 0x00004006 - GL_LIGHT7* = 0x00004007 - GL_AMBIENT* = 0x00001200 - GL_DIFFUSE* = 0x00001201 - GL_SPECULAR* = 0x00001202 - GL_POSITION* = 0x00001203 - GL_SPOT_DIRECTION* = 0x00001204 - GL_SPOT_EXPONENT* = 0x00001205 - GL_SPOT_CUTOFF* = 0x00001206 - GL_CONSTANT_ATTENUATION* = 0x00001207 - GL_LINEAR_ATTENUATION* = 0x00001208 - GL_QUADRATIC_ATTENUATION* = 0x00001209 - GL_COMPILE* = 0x00001300 - GL_COMPILE_AND_EXECUTE* = 0x00001301 - GL_EMISSION* = 0x00001600 - GL_SHININESS* = 0x00001601 - GL_AMBIENT_AND_DIFFUSE* = 0x00001602 - GL_COLOR_INDEXES* = 0x00001603 - GL_MODELVIEW* = 0x00001700 - GL_PROJECTION* = 0x00001701 - GL_COLOR_INDEX* = 0x00001900 - GL_LUMINANCE* = 0x00001909 - GL_LUMINANCE_ALPHA* = 0x0000190A - cGL_BITMAP* = 0x00001A00 - GL_RENDER* = 0x00001C00 - GL_FEEDBACK* = 0x00001C01 - GL_SELECT* = 0x00001C02 - GL_FLAT* = 0x00001D00 - GL_SMOOTH* = 0x00001D01 - GL_S* = 0x00002000 - GL_T* = 0x00002001 - GL_R* = 0x00002002 - GL_Q* = 0x00002003 - GL_MODULATE* = 0x00002100 - GL_DECAL* = 0x00002101 - GL_TEXTURE_ENV_MODE* = 0x00002200 - GL_TEXTURE_ENV_COLOR* = 0x00002201 - GL_TEXTURE_ENV* = 0x00002300 - GL_EYE_LINEAR* = 0x00002400 - GL_OBJECT_LINEAR* = 0x00002401 - GL_SPHERE_MAP* = 0x00002402 - GL_TEXTURE_GEN_MODE* = 0x00002500 - GL_OBJECT_PLANE* = 0x00002501 - GL_EYE_PLANE* = 0x00002502 - GL_CLAMP* = 0x00002900 - GL_CLIENT_PIXEL_STORE_BIT* = 0x00000001 - GL_CLIENT_VERTEX_ARRAY_BIT* = 0x00000002 - GL_CLIENT_ALL_ATTRIB_BITS* = 0xFFFFFFFF - GL_ALPHA4* = 0x0000803B - GL_ALPHA8* = 0x0000803C - GL_ALPHA12* = 0x0000803D - GL_ALPHA16* = 0x0000803E - GL_LUMINANCE4* = 0x0000803F - GL_LUMINANCE8* = 0x00008040 - GL_LUMINANCE12* = 0x00008041 - GL_LUMINANCE16* = 0x00008042 - GL_LUMINANCE4_ALPHA4* = 0x00008043 - GL_LUMINANCE6_ALPHA2* = 0x00008044 - GL_LUMINANCE8_ALPHA8* = 0x00008045 - GL_LUMINANCE12_ALPHA4* = 0x00008046 - GL_LUMINANCE12_ALPHA12* = 0x00008047 - GL_LUMINANCE16_ALPHA16* = 0x00008048 - GL_INTENSITY* = 0x00008049 - GL_INTENSITY4* = 0x0000804A - GL_INTENSITY8* = 0x0000804B - GL_INTENSITY12* = 0x0000804C - GL_INTENSITY16* = 0x0000804D - GL_TEXTURE_LUMINANCE_SIZE* = 0x00008060 - GL_TEXTURE_INTENSITY_SIZE* = 0x00008061 - GL_TEXTURE_PRIORITY* = 0x00008066 - GL_TEXTURE_RESIDENT* = 0x00008067 - GL_VERTEX_ARRAY* = 0x00008074 - GL_NORMAL_ARRAY* = 0x00008075 - GL_COLOR_ARRAY* = 0x00008076 - GL_INDEX_ARRAY* = 0x00008077 - GL_TEXTURE_COORD_ARRAY* = 0x00008078 - GL_EDGE_FLAG_ARRAY* = 0x00008079 - GL_VERTEX_ARRAY_SIZE* = 0x0000807A - GL_VERTEX_ARRAYtyp* = 0x0000807B - GL_VERTEX_ARRAY_STRIDE* = 0x0000807C - GL_NORMAL_ARRAYtyp* = 0x0000807E - GL_NORMAL_ARRAY_STRIDE* = 0x0000807F - GL_COLOR_ARRAY_SIZE* = 0x00008081 - GL_COLOR_ARRAYtyp* = 0x00008082 - GL_COLOR_ARRAY_STRIDE* = 0x00008083 - GL_INDEX_ARRAYtyp* = 0x00008085 - GL_INDEX_ARRAY_STRIDE* = 0x00008086 - GL_TEXTURE_COORD_ARRAY_SIZE* = 0x00008088 - GL_TEXTURE_COORD_ARRAYtyp* = 0x00008089 - GL_TEXTURE_COORD_ARRAY_STRIDE* = 0x0000808A - GL_EDGE_FLAG_ARRAY_STRIDE* = 0x0000808C - GL_VERTEX_ARRAY_POINTER* = 0x0000808E - GL_NORMAL_ARRAY_POINTER* = 0x0000808F - GL_COLOR_ARRAY_POINTER* = 0x00008090 - GL_INDEX_ARRAY_POINTER* = 0x00008091 - GL_TEXTURE_COORD_ARRAY_POINTER* = 0x00008092 - GL_EDGE_FLAG_ARRAY_POINTER* = 0x00008093 - GL_V2F* = 0x00002A20 - GL_V3F* = 0x00002A21 - GL_C4UB_V2F* = 0x00002A22 - GL_C4UB_V3F* = 0x00002A23 - GL_C3F_V3F* = 0x00002A24 - GL_N3F_V3F* = 0x00002A25 - GL_C4F_N3F_V3F* = 0x00002A26 - GL_T2F_V3F* = 0x00002A27 - GL_T4F_V4F* = 0x00002A28 - GL_T2F_C4UB_V3F* = 0x00002A29 - GL_T2F_C3F_V3F* = 0x00002A2A - GL_T2F_N3F_V3F* = 0x00002A2B - GL_T2F_C4F_N3F_V3F* = 0x00002A2C - GL_T4F_C4F_N3F_V4F* = 0x00002A2D - GL_COLOR_TABLE_FORMAT_EXT* = 0x000080D8 - GL_COLOR_TABLE_WIDTH_EXT* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE_EXT* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE_EXT* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE_EXT* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE_EXT* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE_EXT* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE_EXT* = 0x000080DF - cGL_LOGIC_OP* = GL_INDEX_LOGIC_OP - GL_TEXTURE_COMPONENTS* = GL_TEXTURE_INTERNAL_FORMAT # GL_VERSION_1_2 - GL_UNSIGNED_BYTE_3_3_2* = 0x00008032 - GL_UNSIGNED_SHORT_4_4_4_4* = 0x00008033 - GL_UNSIGNED_SHORT_5_5_5_1* = 0x00008034 - GL_UNSIGNED_INT_8_8_8_8* = 0x00008035 - GL_UNSIGNED_INT_10_10_10_2* = 0x00008036 - GL_TEXTURE_BINDING_3D* = 0x0000806A - GL_PACK_SKIP_IMAGES* = 0x0000806B - GL_PACK_IMAGE_HEIGHT* = 0x0000806C - GL_UNPACK_SKIP_IMAGES* = 0x0000806D - GL_UNPACK_IMAGE_HEIGHT* = 0x0000806E - GL_TEXTURE_3D* = 0x0000806F - GL_PROXY_TEXTURE_3D* = 0x00008070 - GL_TEXTURE_DEPTH* = 0x00008071 - GL_TEXTURE_WRAP_R* = 0x00008072 - GL_MAX_3D_TEXTURE_SIZE* = 0x00008073 - GL_UNSIGNED_BYTE_2_3_3_REV* = 0x00008362 - GL_UNSIGNED_SHORT_5_6_5* = 0x00008363 - GL_UNSIGNED_SHORT_5_6_5_REV* = 0x00008364 - GL_UNSIGNED_SHORT_4_4_4_4_REV* = 0x00008365 - GL_UNSIGNED_SHORT_1_5_5_5_REV* = 0x00008366 - GL_UNSIGNED_INT_8_8_8_8_REV* = 0x00008367 - GL_UNSIGNED_INT_2_10_10_10_REV* = 0x00008368 - GL_BGR* = 0x000080E0 - GL_BGRA* = 0x000080E1 - GL_MAX_ELEMENTS_VERTICES* = 0x000080E8 - GL_MAX_ELEMENTS_INDICES* = 0x000080E9 - GL_CLAMP_TO_EDGE* = 0x0000812F - GL_TEXTURE_MIN_LOD* = 0x0000813A - GL_TEXTURE_MAX_LOD* = 0x0000813B - GL_TEXTURE_BASE_LEVEL* = 0x0000813C - GL_TEXTURE_MAX_LEVEL* = 0x0000813D - GL_SMOOTH_POINT_SIZE_RANGE* = 0x00000B12 - GL_SMOOTH_POINT_SIZE_GRANULARITY* = 0x00000B13 - GL_SMOOTH_LINE_WIDTH_RANGE* = 0x00000B22 - GL_SMOOTH_LINE_WIDTH_GRANULARITY* = 0x00000B23 - GL_ALIASED_LINE_WIDTH_RANGE* = 0x0000846E - GL_RESCALE_NORMAL* = 0x0000803A - GL_LIGHT_MODEL_COLOR_CONTROL* = 0x000081F8 - GL_SINGLE_COLOR* = 0x000081F9 - GL_SEPARATE_SPECULAR_COLOR* = 0x000081FA - GL_ALIASED_POINT_SIZE_RANGE* = 0x0000846D # GL_VERSION_1_3 - GL_TEXTURE0* = 0x000084C0 - GL_TEXTURE1* = 0x000084C1 - GL_TEXTURE2* = 0x000084C2 - GL_TEXTURE3* = 0x000084C3 - GL_TEXTURE4* = 0x000084C4 - GL_TEXTURE5* = 0x000084C5 - GL_TEXTURE6* = 0x000084C6 - GL_TEXTURE7* = 0x000084C7 - GL_TEXTURE8* = 0x000084C8 - GL_TEXTURE9* = 0x000084C9 - GL_TEXTURE10* = 0x000084CA - GL_TEXTURE11* = 0x000084CB - GL_TEXTURE12* = 0x000084CC - GL_TEXTURE13* = 0x000084CD - GL_TEXTURE14* = 0x000084CE - GL_TEXTURE15* = 0x000084CF - GL_TEXTURE16* = 0x000084D0 - GL_TEXTURE17* = 0x000084D1 - GL_TEXTURE18* = 0x000084D2 - GL_TEXTURE19* = 0x000084D3 - GL_TEXTURE20* = 0x000084D4 - GL_TEXTURE21* = 0x000084D5 - GL_TEXTURE22* = 0x000084D6 - GL_TEXTURE23* = 0x000084D7 - GL_TEXTURE24* = 0x000084D8 - GL_TEXTURE25* = 0x000084D9 - GL_TEXTURE26* = 0x000084DA - GL_TEXTURE27* = 0x000084DB - GL_TEXTURE28* = 0x000084DC - GL_TEXTURE29* = 0x000084DD - GL_TEXTURE30* = 0x000084DE - GL_TEXTURE31* = 0x000084DF - cGL_ACTIVE_TEXTURE* = 0x000084E0 - GL_MULTISAMPLE* = 0x0000809D - GL_SAMPLE_ALPHA_TO_COVERAGE* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE* = 0x0000809F - cGL_SAMPLE_COVERAGE* = 0x000080A0 - GL_SAMPLE_BUFFERS* = 0x000080A8 - GL_SAMPLES* = 0x000080A9 - GL_SAMPLE_COVERAGE_VALUE* = 0x000080AA - GL_SAMPLE_COVERAGE_INVERT* = 0x000080AB - GL_TEXTURE_CUBE_MAP* = 0x00008513 - GL_TEXTURE_BINDING_CUBE_MAP* = 0x00008514 - GL_TEXTURE_CUBE_MAP_POSITIVE_X* = 0x00008515 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X* = 0x00008516 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y* = 0x00008517 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y* = 0x00008518 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z* = 0x00008519 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z* = 0x0000851A - GL_PROXY_TEXTURE_CUBE_MAP* = 0x0000851B - GL_MAX_CUBE_MAP_TEXTURE_SIZE* = 0x0000851C - GL_COMPRESSED_RGB* = 0x000084ED - GL_COMPRESSED_RGBA* = 0x000084EE - GL_TEXTURE_COMPRESSION_HINT* = 0x000084EF - GL_TEXTURE_COMPRESSED_IMAGE_SIZE* = 0x000086A0 - GL_TEXTURE_COMPRESSED* = 0x000086A1 - GL_NUM_COMPRESSED_TEXTURE_FORMATS* = 0x000086A2 - GL_COMPRESSED_TEXTURE_FORMATS* = 0x000086A3 - GL_CLAMP_TO_BORDER* = 0x0000812D - cGL_CLIENT_ACTIVE_TEXTURE* = 0x000084E1 - GL_MAX_TEXTURE_UNITS* = 0x000084E2 - GL_TRANSPOSE_MODELVIEW_MATRIX* = 0x000084E3 - GL_TRANSPOSE_PROJECTION_MATRIX* = 0x000084E4 - GL_TRANSPOSE_TEXTURE_MATRIX* = 0x000084E5 - GL_TRANSPOSE_COLOR_MATRIX* = 0x000084E6 - GL_MULTISAMPLE_BIT* = 0x20000000 - GL_NORMAL_MAP* = 0x00008511 - GL_REFLECTION_MAP* = 0x00008512 - GL_COMPRESSED_ALPHA* = 0x000084E9 - GL_COMPRESSED_LUMINANCE* = 0x000084EA - GL_COMPRESSED_LUMINANCE_ALPHA* = 0x000084EB - GL_COMPRESSED_INTENSITY* = 0x000084EC - GL_COMBINE* = 0x00008570 - GL_COMBINE_RGB* = 0x00008571 - GL_COMBINE_ALPHA* = 0x00008572 - GL_SOURCE0_RGB* = 0x00008580 - GL_SOURCE1_RGB* = 0x00008581 - GL_SOURCE2_RGB* = 0x00008582 - GL_SOURCE0_ALPHA* = 0x00008588 - GL_SOURCE1_ALPHA* = 0x00008589 - GL_SOURCE2_ALPHA* = 0x0000858A - GL_OPERAND0_RGB* = 0x00008590 - GL_OPERAND1_RGB* = 0x00008591 - GL_OPERAND2_RGB* = 0x00008592 - GL_OPERAND0_ALPHA* = 0x00008598 - GL_OPERAND1_ALPHA* = 0x00008599 - GL_OPERAND2_ALPHA* = 0x0000859A - GL_RGB_SCALE* = 0x00008573 - GL_ADD_SIGNED* = 0x00008574 - GL_INTERPOLATE* = 0x00008575 - GL_SUBTRACT* = 0x000084E7 - GL_CONSTANT* = 0x00008576 - GL_PRIMARY_COLOR* = 0x00008577 - GL_PREVIOUS* = 0x00008578 - GL_DOT3_RGB* = 0x000086AE - GL_DOT3_RGBA* = 0x000086AF # GL_VERSION_1_4 - GL_BLEND_DST_RGB* = 0x000080C8 - GL_BLEND_SRC_RGB* = 0x000080C9 - GL_BLEND_DST_ALPHA* = 0x000080CA - GL_BLEND_SRC_ALPHA* = 0x000080CB - GL_POINT_FADE_THRESHOLD_SIZE* = 0x00008128 - GL_DEPTH_COMPONENT16* = 0x000081A5 - GL_DEPTH_COMPONENT24* = 0x000081A6 - GL_DEPTH_COMPONENT32* = 0x000081A7 - GL_MIRRORED_REPEAT* = 0x00008370 - GL_MAX_TEXTURE_LOD_BIAS* = 0x000084FD - GL_TEXTURE_LOD_BIAS* = 0x00008501 - GL_INCR_WRAP* = 0x00008507 - GL_DECR_WRAP* = 0x00008508 - GL_TEXTURE_DEPTH_SIZE* = 0x0000884A - GL_TEXTURE_COMPARE_MODE* = 0x0000884C - GL_TEXTURE_COMPARE_FUNC* = 0x0000884D - GL_POINT_SIZE_MIN* = 0x00008126 - GL_POINT_SIZE_MAX* = 0x00008127 - GL_POINT_DISTANCE_ATTENUATION* = 0x00008129 - cGL_GENERATE_MIPMAP* = 0x00008191 - GL_GENERATE_MIPMAP_HINT* = 0x00008192 - GL_FOG_COORDINATE_SOURCE* = 0x00008450 - GL_FOG_COORDINATE* = 0x00008451 - GL_FRAGMENT_DEPTH* = 0x00008452 - GL_CURRENT_FOG_COORDINATE* = 0x00008453 - GL_FOG_COORDINATE_ARRAYtyp* = 0x00008454 - GL_FOG_COORDINATE_ARRAY_STRIDE* = 0x00008455 - GL_FOG_COORDINATE_ARRAY_POINTER* = 0x00008456 - GL_FOG_COORDINATE_ARRAY* = 0x00008457 - GL_COLOR_SUM* = 0x00008458 - GL_CURRENT_SECONDARY_COLOR* = 0x00008459 - GL_SECONDARY_COLOR_ARRAY_SIZE* = 0x0000845A - GL_SECONDARY_COLOR_ARRAYtyp* = 0x0000845B - GL_SECONDARY_COLOR_ARRAY_STRIDE* = 0x0000845C - GL_SECONDARY_COLOR_ARRAY_POINTER* = 0x0000845D - GL_SECONDARY_COLOR_ARRAY* = 0x0000845E - GL_TEXTURE_FILTER_CONTROL* = 0x00008500 - GL_DEPTH_TEXTURE_MODE* = 0x0000884B - GL_COMPARE_R_TO_TEXTURE* = 0x0000884E # GL_VERSION_1_5 - GL_BUFFER_SIZE* = 0x00008764 - GL_BUFFER_USAGE* = 0x00008765 - GL_QUERY_COUNTER_BITS* = 0x00008864 - GL_CURRENT_QUERY* = 0x00008865 - GL_QUERY_RESULT* = 0x00008866 - GL_QUERY_RESULT_AVAILABLE* = 0x00008867 - GL_ARRAY_BUFFER* = 0x00008892 - GL_ELEMENT_ARRAY_BUFFER* = 0x00008893 - GL_ARRAY_BUFFER_BINDING* = 0x00008894 - GL_ELEMENT_ARRAY_BUFFER_BINDING* = 0x00008895 - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING* = 0x0000889F - GL_READ_ONLY* = 0x000088B8 - GL_WRITE_ONLY* = 0x000088B9 - GL_READ_WRITE* = 0x000088BA - GL_BUFFER_ACCESS* = 0x000088BB - GL_BUFFER_MAPPED* = 0x000088BC - GL_BUFFER_MAP_POINTER* = 0x000088BD - GL_STREAM_DRAW* = 0x000088E0 - GL_STREAM_READ* = 0x000088E1 - GL_STREAM_COPY* = 0x000088E2 - GL_STATIC_DRAW* = 0x000088E4 - GL_STATIC_READ* = 0x000088E5 - GL_STATIC_COPY* = 0x000088E6 - GL_DYNAMIC_DRAW* = 0x000088E8 - GL_DYNAMIC_READ* = 0x000088E9 - GL_DYNAMIC_COPY* = 0x000088EA - GL_SAMPLES_PASSED* = 0x00008914 - GL_VERTEX_ARRAY_BUFFER_BINDING* = 0x00008896 - GL_NORMAL_ARRAY_BUFFER_BINDING* = 0x00008897 - GL_COLOR_ARRAY_BUFFER_BINDING* = 0x00008898 - GL_INDEX_ARRAY_BUFFER_BINDING* = 0x00008899 - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING* = 0x0000889A - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING* = 0x0000889B - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING* = 0x0000889C - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING* = 0x0000889D - GL_WEIGHT_ARRAY_BUFFER_BINDING* = 0x0000889E - GL_FOG_COORD_SRC* = 0x00008450 - GL_FOG_COORD* = 0x00008451 - GL_CURRENT_FOG_COORD* = 0x00008453 - GL_FOG_COORD_ARRAYtyp* = 0x00008454 - GL_FOG_COORD_ARRAY_STRIDE* = 0x00008455 - GL_FOG_COORD_ARRAY_POINTER* = 0x00008456 - GL_FOG_COORD_ARRAY* = 0x00008457 - GL_FOG_COORD_ARRAY_BUFFER_BINDING* = 0x0000889D - GL_SRC0_RGB* = 0x00008580 - GL_SRC1_RGB* = 0x00008581 - GL_SRC2_RGB* = 0x00008582 - GL_SRC0_ALPHA* = 0x00008588 - GL_SRC1_ALPHA* = 0x00008589 - GL_SRC2_ALPHA* = 0x0000858A # GL_VERSION_2_0 - GL_BLEND_EQUATION_RGB* = 0x00008009 - GL_VERTEX_ATTRIB_ARRAY_ENABLED* = 0x00008622 - GL_VERTEX_ATTRIB_ARRAY_SIZE* = 0x00008623 - GL_VERTEX_ATTRIB_ARRAY_STRIDE* = 0x00008624 - GL_VERTEX_ATTRIB_ARRAYtyp* = 0x00008625 - GL_CURRENT_VERTEX_ATTRIB* = 0x00008626 - GL_VERTEX_PROGRAM_POINT_SIZE* = 0x00008642 - GL_VERTEX_ATTRIB_ARRAY_POINTER* = 0x00008645 - GL_STENCIL_BACK_FUNC* = 0x00008800 - GL_STENCIL_BACK_FAIL* = 0x00008801 - GL_STENCIL_BACK_PASS_DEPTH_FAIL* = 0x00008802 - GL_STENCIL_BACK_PASS_DEPTH_PASS* = 0x00008803 - GL_MAX_DRAW_BUFFERS* = 0x00008824 - GL_DRAW_BUFFER0* = 0x00008825 - GL_DRAW_BUFFER1* = 0x00008826 - GL_DRAW_BUFFER2* = 0x00008827 - GL_DRAW_BUFFER3* = 0x00008828 - GL_DRAW_BUFFER4* = 0x00008829 - GL_DRAW_BUFFER5* = 0x0000882A - GL_DRAW_BUFFER6* = 0x0000882B - GL_DRAW_BUFFER7* = 0x0000882C - GL_DRAW_BUFFER8* = 0x0000882D - GL_DRAW_BUFFER9* = 0x0000882E - GL_DRAW_BUFFER10* = 0x0000882F - GL_DRAW_BUFFER11* = 0x00008830 - GL_DRAW_BUFFER12* = 0x00008831 - GL_DRAW_BUFFER13* = 0x00008832 - GL_DRAW_BUFFER14* = 0x00008833 - GL_DRAW_BUFFER15* = 0x00008834 - GL_BLEND_EQUATION_ALPHA* = 0x0000883D - GL_MAX_VERTEX_ATTRIBS* = 0x00008869 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED* = 0x0000886A - GL_MAX_TEXTURE_IMAGE_UNITS* = 0x00008872 - GL_FRAGMENT_SHADER* = 0x00008B30 - GL_VERTEX_SHADER* = 0x00008B31 - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS* = 0x00008B49 - GL_MAX_VERTEX_UNIFORM_COMPONENTS* = 0x00008B4A - GL_MAX_VARYING_FLOATS* = 0x00008B4B - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS* = 0x00008B4C - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS* = 0x00008B4D - GL_SHADERtyp* = 0x00008B4F - GL_FLOAT_VEC2* = 0x00008B50 - GL_FLOAT_VEC3* = 0x00008B51 - GL_FLOAT_VEC4* = 0x00008B52 - GL_INT_VEC2* = 0x00008B53 - GL_INT_VEC3* = 0x00008B54 - GL_INT_VEC4* = 0x00008B55 - GL_BOOL* = 0x00008B56 - GL_BOOL_VEC2* = 0x00008B57 - GL_BOOL_VEC3* = 0x00008B58 - GL_BOOL_VEC4* = 0x00008B59 - GL_FLOAT_MAT2* = 0x00008B5A - GL_FLOAT_MAT3* = 0x00008B5B - GL_FLOAT_MAT4* = 0x00008B5C - GL_SAMPLER_1D* = 0x00008B5D - GL_SAMPLER_2D* = 0x00008B5E - GL_SAMPLER_3D* = 0x00008B5F - GL_SAMPLER_CUBE* = 0x00008B60 - GL_SAMPLER_1D_SHADOW* = 0x00008B61 - GL_SAMPLER_2D_SHADOW* = 0x00008B62 - GL_DELETE_STATUS* = 0x00008B80 - GL_COMPILE_STATUS* = 0x00008B81 - GL_LINK_STATUS* = 0x00008B82 - GL_VALIDATE_STATUS* = 0x00008B83 - GL_INFO_LOG_LENGTH* = 0x00008B84 - GL_ATTACHED_SHADERS* = 0x00008B85 - GL_ACTIVE_UNIFORMS* = 0x00008B86 - GL_ACTIVE_UNIFORM_MAX_LENGTH* = 0x00008B87 - GL_SHADER_SOURCE_LENGTH* = 0x00008B88 - GL_ACTIVE_ATTRIBUTES* = 0x00008B89 - GL_ACTIVE_ATTRIBUTE_MAX_LENGTH* = 0x00008B8A - GL_FRAGMENT_SHADER_DERIVATIVE_HINT* = 0x00008B8B - GL_SHADING_LANGUAGE_VERSION* = 0x00008B8C - GL_CURRENT_PROGRAM* = 0x00008B8D - GL_POINT_SPRITE_COORD_ORIGIN* = 0x00008CA0 - GL_LOWER_LEFT* = 0x00008CA1 - GL_UPPER_LEFT* = 0x00008CA2 - GL_STENCIL_BACK_REF* = 0x00008CA3 - GL_STENCIL_BACK_VALUE_MASK* = 0x00008CA4 - GL_STENCIL_BACK_WRITEMASK* = 0x00008CA5 - GL_VERTEX_PROGRAM_TWO_SIDE* = 0x00008643 - GL_POINT_SPRITE* = 0x00008861 - GL_COORD_REPLACE* = 0x00008862 - GL_MAX_TEXTURE_COORDS* = 0x00008871 # GL_VERSION_2_1 - GL_PIXEL_PACK_BUFFER* = 0x000088EB - GL_PIXEL_UNPACK_BUFFER* = 0x000088EC - GL_PIXEL_PACK_BUFFER_BINDING* = 0x000088ED - GL_PIXEL_UNPACK_BUFFER_BINDING* = 0x000088EF - GL_FLOAT_MAT2x3* = 0x00008B65 - GL_FLOAT_MAT2x4* = 0x00008B66 - GL_FLOAT_MAT3x2* = 0x00008B67 - GL_FLOAT_MAT3x4* = 0x00008B68 - GL_FLOAT_MAT4x2* = 0x00008B69 - GL_FLOAT_MAT4x3* = 0x00008B6A - GL_SRGB* = 0x00008C40 - GL_SRGB8* = 0x00008C41 - GL_SRGB_ALPHA* = 0x00008C42 - GL_SRGB8_ALPHA8* = 0x00008C43 - GL_COMPRESSED_SRGB* = 0x00008C48 - GL_COMPRESSED_SRGB_ALPHA* = 0x00008C49 - GL_CURRENT_RASTER_SECONDARY_COLOR* = 0x0000845F - GL_SLUMINANCE_ALPHA* = 0x00008C44 - GL_SLUMINANCE8_ALPHA8* = 0x00008C45 - GL_SLUMINANCE* = 0x00008C46 - GL_SLUMINANCE8* = 0x00008C47 - GL_COMPRESSED_SLUMINANCE* = 0x00008C4A - GL_COMPRESSED_SLUMINANCE_ALPHA* = 0x00008C4B # GL_VERSION_3_0 - GL_COMPARE_REF_TO_TEXTURE* = 0x0000884E - GL_CLIP_DISTANCE0* = 0x00003000 - GL_CLIP_DISTANCE1* = 0x00003001 - GL_CLIP_DISTANCE2* = 0x00003002 - GL_CLIP_DISTANCE3* = 0x00003003 - GL_CLIP_DISTANCE4* = 0x00003004 - GL_CLIP_DISTANCE5* = 0x00003005 - GL_CLIP_DISTANCE6* = 0x00003006 - GL_CLIP_DISTANCE7* = 0x00003007 - GL_MAX_CLIP_DISTANCES* = 0x00000D32 - GL_MAJOR_VERSION* = 0x0000821B - GL_MINOR_VERSION* = 0x0000821C - GL_NUM_EXTENSIONS* = 0x0000821D - GL_CONTEXT_FLAGS* = 0x0000821E - GL_DEPTH_BUFFER* = 0x00008223 - GL_STENCIL_BUFFER* = 0x00008224 - GL_COMPRESSED_RED* = 0x00008225 - GL_COMPRESSED_RG* = 0x00008226 - GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT* = 0x00000001 - GL_RGBA32F* = 0x00008814 - GL_RGB32F* = 0x00008815 - GL_RGBA16F* = 0x0000881A - GL_RGB16F* = 0x0000881B - GL_VERTEX_ATTRIB_ARRAY_INTEGER* = 0x000088FD - GL_MAX_ARRAY_TEXTURE_LAYERS* = 0x000088FF - GL_MIN_PROGRAM_TEXEL_OFFSET* = 0x00008904 - GL_MAX_PROGRAM_TEXEL_OFFSET* = 0x00008905 - GL_CLAMP_READ_COLOR* = 0x0000891C - GL_FIXED_ONLY* = 0x0000891D - GL_MAX_VARYING_COMPONENTS* = 0x00008B4B - GL_TEXTURE_1D_ARRAY* = 0x00008C18 - GL_PROXY_TEXTURE_1D_ARRAY* = 0x00008C19 - GL_TEXTURE_2D_ARRAY* = 0x00008C1A - GL_PROXY_TEXTURE_2D_ARRAY* = 0x00008C1B - GL_TEXTURE_BINDING_1D_ARRAY* = 0x00008C1C - GL_TEXTURE_BINDING_2D_ARRAY* = 0x00008C1D - GL_R11F_G11F_B10F* = 0x00008C3A - GL_UNSIGNED_INT_10F_11F_11F_REV* = 0x00008C3B - GL_RGB9_E5* = 0x00008C3D - GL_UNSIGNED_INT_5_9_9_9_REV* = 0x00008C3E - GL_TEXTURE_SHARED_SIZE* = 0x00008C3F - GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH* = 0x00008C76 - GL_TRANSFORM_FEEDBACK_BUFFER_MODE* = 0x00008C7F - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS* = 0x00008C80 - cGL_TRANSFORM_FEEDBACK_VARYINGS* = 0x00008C83 - GL_TRANSFORM_FEEDBACK_BUFFER_START* = 0x00008C84 - GL_TRANSFORM_FEEDBACK_BUFFER_SIZE* = 0x00008C85 - GL_PRIMITIVES_GENERATED* = 0x00008C87 - GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN* = 0x00008C88 - GL_RASTERIZER_DISCARD* = 0x00008C89 - GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS* = 0x00008C8A - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS* = 0x00008C8B - GL_INTERLEAVED_ATTRIBS* = 0x00008C8C - GL_SEPARATE_ATTRIBS* = 0x00008C8D - GL_TRANSFORM_FEEDBACK_BUFFER* = 0x00008C8E - GL_TRANSFORM_FEEDBACK_BUFFER_BINDING* = 0x00008C8F - GL_RGBA32UI* = 0x00008D70 - GL_RGB32UI* = 0x00008D71 - GL_RGBA16UI* = 0x00008D76 - GL_RGB16UI* = 0x00008D77 - GL_RGBA8UI* = 0x00008D7C - GL_RGB8UI* = 0x00008D7D - GL_RGBA32I* = 0x00008D82 - GL_RGB32I* = 0x00008D83 - GL_RGBA16I* = 0x00008D88 - GL_RGB16I* = 0x00008D89 - GL_RGBA8I* = 0x00008D8E - GL_RGB8I* = 0x00008D8F - GL_RED_INTEGER* = 0x00008D94 - GL_GREEN_INTEGER* = 0x00008D95 - GL_BLUE_INTEGER* = 0x00008D96 - GL_RGB_INTEGER* = 0x00008D98 - GL_RGBA_INTEGER* = 0x00008D99 - GL_BGR_INTEGER* = 0x00008D9A - GL_BGRA_INTEGER* = 0x00008D9B - GL_SAMPLER_1D_ARRAY* = 0x00008DC0 - GL_SAMPLER_2D_ARRAY* = 0x00008DC1 - GL_SAMPLER_1D_ARRAY_SHADOW* = 0x00008DC3 - GL_SAMPLER_2D_ARRAY_SHADOW* = 0x00008DC4 - GL_SAMPLER_CUBE_SHADOW* = 0x00008DC5 - GL_UNSIGNED_INT_VEC2* = 0x00008DC6 - GL_UNSIGNED_INT_VEC3* = 0x00008DC7 - GL_UNSIGNED_INT_VEC4* = 0x00008DC8 - GL_INT_SAMPLER_1D* = 0x00008DC9 - GL_INT_SAMPLER_2D* = 0x00008DCA - GL_INT_SAMPLER_3D* = 0x00008DCB - GL_INT_SAMPLER_CUBE* = 0x00008DCC - GL_INT_SAMPLER_1D_ARRAY* = 0x00008DCE - GL_INT_SAMPLER_2D_ARRAY* = 0x00008DCF - GL_UNSIGNED_INT_SAMPLER_1D* = 0x00008DD1 - GL_UNSIGNED_INT_SAMPLER_2D* = 0x00008DD2 - GL_UNSIGNED_INT_SAMPLER_3D* = 0x00008DD3 - GL_UNSIGNED_INT_SAMPLER_CUBE* = 0x00008DD4 - GL_UNSIGNED_INT_SAMPLER_1D_ARRAY* = 0x00008DD6 - GL_UNSIGNED_INT_SAMPLER_2D_ARRAY* = 0x00008DD7 - GL_QUERY_WAIT* = 0x00008E13 - GL_QUERY_NO_WAIT* = 0x00008E14 - GL_QUERY_BY_REGION_WAIT* = 0x00008E15 - GL_QUERY_BY_REGION_NO_WAIT* = 0x00008E16 - GL_BUFFER_ACCESS_FLAGS* = 0x0000911F - GL_BUFFER_MAP_LENGTH* = 0x00009120 - GL_BUFFER_MAP_OFFSET* = 0x00009121 - GL_CLAMP_VERTEX_COLOR* = 0x0000891A - GL_CLAMP_FRAGMENT_COLOR* = 0x0000891B - GL_ALPHA_INTEGER* = 0x00008D97 # GL_VERSION_3_1 - GL_SAMPLER_2D_RECT* = 0x00008B63 - GL_SAMPLER_2D_RECT_SHADOW* = 0x00008B64 - GL_SAMPLER_BUFFER* = 0x00008DC2 - GL_INT_SAMPLER_2D_RECT* = 0x00008DCD - GL_INT_SAMPLER_BUFFER* = 0x00008DD0 - GL_UNSIGNED_INT_SAMPLER_2D_RECT* = 0x00008DD5 - GL_UNSIGNED_INT_SAMPLER_BUFFER* = 0x00008DD8 - GL_TEXTURE_BUFFER* = 0x00008C2A - GL_MAX_TEXTURE_BUFFER_SIZE* = 0x00008C2B - GL_TEXTURE_BINDING_BUFFER* = 0x00008C2C - GL_TEXTURE_BUFFER_DATA_STORE_BINDING* = 0x00008C2D - GL_TEXTURE_BUFFER_FORMAT* = 0x00008C2E - GL_TEXTURE_RECTANGLE* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE* = 0x000084F8 - GL_RED_SNORM* = 0x00008F90 - GL_RG_SNORM* = 0x00008F91 - GL_RGB_SNORM* = 0x00008F92 - GL_RGBA_SNORM* = 0x00008F93 - GL_R8_SNORM* = 0x00008F94 - GL_RG8_SNORM* = 0x00008F95 - GL_RGB8_SNORM* = 0x00008F96 - GL_RGBA8_SNORM* = 0x00008F97 - GL_R16_SNORM* = 0x00008F98 - GL_RG16_SNORM* = 0x00008F99 - GL_RGB16_SNORM* = 0x00008F9A - GL_RGBA16_SNORM* = 0x00008F9B - GL_SIGNED_NORMALIZED* = 0x00008F9C - GL_PRIMITIVE_RESTART* = 0x00008F9D - cGL_PRIMITIVE_RESTART_INDEX* = 0x00008F9E - GL_CONTEXT_CORE_PROFILE_BIT* = 0x00000001 - GL_CONTEXT_COMPATIBILITY_PROFILE_BIT* = 0x00000002 - GL_LINES_ADJACENCY* = 0x0000000A - GL_LINE_STRIP_ADJACENCY* = 0x0000000B - GL_TRIANGLES_ADJACENCY* = 0x0000000C - GL_TRIANGLE_STRIP_ADJACENCY* = 0x0000000D - GL_PROGRAM_POINT_SIZE* = 0x00008642 - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS* = 0x00008C29 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED* = 0x00008DA7 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS* = 0x00008DA8 - GL_GEOMETRY_SHADER* = 0x00008DD9 - GL_GEOMETRY_VERTICES_OUT* = 0x00008916 - GL_GEOMETRY_INPUTtyp* = 0x00008917 - GL_GEOMETRY_OUTPUTtyp* = 0x00008918 - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS* = 0x00008DDF - GL_MAX_GEOMETRY_OUTPUT_VERTICES* = 0x00008DE0 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS* = 0x00008DE1 - GL_MAX_VERTEX_OUTPUT_COMPONENTS* = 0x00009122 - GL_MAX_GEOMETRY_INPUT_COMPONENTS* = 0x00009123 - GL_MAX_GEOMETRY_OUTPUT_COMPONENTS* = 0x00009124 - GL_MAX_FRAGMENT_INPUT_COMPONENTS* = 0x00009125 - GL_CONTEXT_PROFILE_MASK* = 0x00009126 # GL_VERSION_3_3 - GL_VERTEX_ATTRIB_ARRAY_DIVISOR* = 0x000088FE # GL_VERSION_4_0 - GL_SAMPLE_SHADING* = 0x00008C36 - GL_MIN_SAMPLE_SHADING_VALUE* = 0x00008C37 - GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET* = 0x00008E5E - GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET* = 0x00008E5F - GL_TEXTURE_CUBE_MAP_ARRAY* = 0x00009009 - GL_TEXTURE_BINDING_CUBE_MAP_ARRAY* = 0x0000900A - GL_PROXY_TEXTURE_CUBE_MAP_ARRAY* = 0x0000900B - GL_SAMPLER_CUBE_MAP_ARRAY* = 0x0000900C - GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW* = 0x0000900D - GL_INT_SAMPLER_CUBE_MAP_ARRAY* = 0x0000900E - GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY* = 0x0000900F # GL_3DFX_multisample - GL_MULTISAMPLE_3DFX* = 0x000086B2 - GL_SAMPLE_BUFFERS_3DFX* = 0x000086B3 - GL_SAMPLES_3DFX* = 0x000086B4 - GL_MULTISAMPLE_BIT_3DFX* = 0x20000000 # GL_3DFX_texture_compression_FXT1 - GL_COMPRESSED_RGB_FXT1_3DFX* = 0x000086B0 - GL_COMPRESSED_RGBA_FXT1_3DFX* = 0x000086B1 # GL_APPLE_client_storage - GL_UNPACK_CLIENT_STORAGE_APPLE* = 0x000085B2 # GL_APPLE_element_array - GL_ELEMENT_ARRAY_APPLE* = 0x00008A0C - GL_ELEMENT_ARRAYtyp_APPLE* = 0x00008A0D - GL_ELEMENT_ARRAY_POINTER_APPLE* = 0x00008A0E # GL_APPLE_fence - GL_DRAW_PIXELS_APPLE* = 0x00008A0A - GL_FENCE_APPLE* = 0x00008A0B # GL_APPLE_specular_vector - GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE* = 0x000085B0 # GL_APPLE_transform_hint - GL_TRANSFORM_HINT_APPLE* = 0x000085B1 # GL_APPLE_vertex_array_object - GL_VERTEX_ARRAY_BINDING_APPLE* = 0x000085B5 # GL_APPLE_vertex_array_range - cGL_VERTEX_ARRAY_RANGE_APPLE* = 0x0000851D - GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE* = 0x0000851E - GL_VERTEX_ARRAY_STORAGE_HINT_APPLE* = 0x0000851F - GL_VERTEX_ARRAY_RANGE_POINTER_APPLE* = 0x00008521 - GL_STORAGE_CLIENT_APPLE* = 0x000085B4 - GL_STORAGE_CACHED_APPLE* = 0x000085BE - GL_STORAGE_SHARED_APPLE* = 0x000085BF # GL_APPLE_ycbcr_422 - GL_YCBCR_422_APPLE* = 0x000085B9 - GL_UNSIGNED_SHORT_8_8_APPLE* = 0x000085BA - GL_UNSIGNED_SHORT_8_8_REV_APPLE* = 0x000085BB # GL_APPLE_texture_range - GL_TEXTURE_RANGE_LENGTH_APPLE* = 0x000085B7 - GL_TEXTURE_RANGE_POINTER_APPLE* = 0x000085B8 - GL_TEXTURE_STORAGE_HINT_APPLE* = 0x000085BC - GL_STORAGE_PRIVATE_APPLE* = 0x000085BD # reuse GL_STORAGE_CACHED_APPLE - # reuse GL_STORAGE_SHARED_APPLE - # GL_APPLE_float_pixels - GL_HALF_APPLE* = 0x0000140B - GL_RGBA_FLOAT32_APPLE* = 0x00008814 - GL_RGB_FLOAT32_APPLE* = 0x00008815 - GL_ALPHA_FLOAT32_APPLE* = 0x00008816 - GL_INTENSITY_FLOAT32_APPLE* = 0x00008817 - GL_LUMINANCE_FLOAT32_APPLE* = 0x00008818 - GL_LUMINANCE_ALPHA_FLOAT32_APPLE* = 0x00008819 - GL_RGBA_FLOAT16_APPLE* = 0x0000881A - GL_RGB_FLOAT16_APPLE* = 0x0000881B - GL_ALPHA_FLOAT16_APPLE* = 0x0000881C - GL_INTENSITY_FLOAT16_APPLE* = 0x0000881D - GL_LUMINANCE_FLOAT16_APPLE* = 0x0000881E - GL_LUMINANCE_ALPHA_FLOAT16_APPLE* = 0x0000881F - GL_COLOR_FLOAT_APPLE* = 0x00008A0F # GL_APPLE_vertex_program_evaluators - GL_VERTEX_ATTRIB_MAP1_APPLE* = 0x00008A00 - GL_VERTEX_ATTRIB_MAP2_APPLE* = 0x00008A01 - GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE* = 0x00008A02 - GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE* = 0x00008A03 - GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE* = 0x00008A04 - GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE* = 0x00008A05 - GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE* = 0x00008A06 - GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE* = 0x00008A07 - GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE* = 0x00008A08 - GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE* = 0x00008A09 # GL_APPLE_aux_depth_stencil - GL_AUX_DEPTH_STENCIL_APPLE* = 0x00008A14 # GL_APPLE_object_purgeable - GL_BUFFER_OBJECT_APPLE* = 0x000085B3 - GL_RELEASED_APPLE* = 0x00008A19 - GL_VOLATILE_APPLE* = 0x00008A1A - GL_RETAINED_APPLE* = 0x00008A1B - GL_UNDEFINED_APPLE* = 0x00008A1C - GL_PURGEABLE_APPLE* = 0x00008A1D # GL_APPLE_row_bytes - GL_PACK_ROW_BYTES_APPLE* = 0x00008A15 - GL_UNPACK_ROW_BYTES_APPLE* = 0x00008A16 # GL_APPLE_rgb_422 - # reuse GL_UNSIGNED_SHORT_8_8_APPLE - # reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE - # GL_ARB_depth_texture - GL_DEPTH_COMPONENT16_ARB* = 0x000081A5 - GL_DEPTH_COMPONENT24_ARB* = 0x000081A6 - GL_DEPTH_COMPONENT32_ARB* = 0x000081A7 - GL_TEXTURE_DEPTH_SIZE_ARB* = 0x0000884A - GL_DEPTH_TEXTURE_MODE_ARB* = 0x0000884B # GL_ARB_fragment_program - GL_FRAGMENT_PROGRAM_ARB* = 0x00008804 - GL_PROGRAM_ALU_INSTRUCTIONS_ARB* = 0x00008805 - GL_PROGRAM_TEX_INSTRUCTIONS_ARB* = 0x00008806 - GL_PROGRAM_TEX_INDIRECTIONS_ARB* = 0x00008807 - GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB* = 0x00008808 - GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB* = 0x00008809 - GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB* = 0x0000880A - GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB* = 0x0000880B - GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB* = 0x0000880C - GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB* = 0x0000880D - GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB* = 0x0000880E - GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB* = 0x0000880F - GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB* = 0x00008810 - GL_MAX_TEXTURE_COORDS_ARB* = 0x00008871 - GL_MAX_TEXTURE_IMAGE_UNITS_ARB* = 0x00008872 # GL_ARB_imaging - GL_CONSTANT_COLOR_ARB* = 0x00008001 - GL_ONE_MINUS_CONSTANT_COLOR* = 0x00008002 - GL_CONSTANT_ALPHA* = 0x00008003 - GL_ONE_MINUS_CONSTANT_ALPHA* = 0x00008004 - cGL_BLEND_COLOR* = 0x00008005 - GL_FUNC_ADD* = 0x00008006 - GL_MIN* = 0x00008007 - GL_MAX* = 0x00008008 - cGL_BLEND_EQUATION* = 0x00008009 - GL_FUNC_SUBTRACT* = 0x0000800A - GL_FUNC_REVERSE_SUBTRACT* = 0x0000800B - GL_CONVOLUTION_1D* = 0x00008010 - GL_CONVOLUTION_2D* = 0x00008011 - GL_SEPARABLE_2D* = 0x00008012 - GL_CONVOLUTION_BORDER_MODE* = 0x00008013 - GL_CONVOLUTION_FILTER_SCALE* = 0x00008014 - GL_CONVOLUTION_FILTER_BIAS* = 0x00008015 - GL_REDUCE* = 0x00008016 - GL_CONVOLUTION_FORMAT* = 0x00008017 - GL_CONVOLUTION_WIDTH* = 0x00008018 - GL_CONVOLUTION_HEIGHT* = 0x00008019 - GL_MAX_CONVOLUTION_WIDTH* = 0x0000801A - GL_MAX_CONVOLUTION_HEIGHT* = 0x0000801B - GL_POST_CONVOLUTION_RED_SCALE* = 0x0000801C - GL_POST_CONVOLUTION_GREEN_SCALE* = 0x0000801D - GL_POST_CONVOLUTION_BLUE_SCALE* = 0x0000801E - GL_POST_CONVOLUTION_ALPHA_SCALE* = 0x0000801F - GL_POST_CONVOLUTION_RED_BIAS* = 0x00008020 - GL_POST_CONVOLUTION_GREEN_BIAS* = 0x00008021 - GL_POST_CONVOLUTION_BLUE_BIAS* = 0x00008022 - GL_POST_CONVOLUTION_ALPHA_BIAS* = 0x00008023 - cGL_HISTOGRAM* = 0x00008024 - GL_PROXY_HISTOGRAM* = 0x00008025 - GL_HISTOGRAM_WIDTH* = 0x00008026 - GL_HISTOGRAM_FORMAT* = 0x00008027 - GL_HISTOGRAM_RED_SIZE* = 0x00008028 - GL_HISTOGRAM_GREEN_SIZE* = 0x00008029 - GL_HISTOGRAM_BLUE_SIZE* = 0x0000802A - GL_HISTOGRAM_ALPHA_SIZE* = 0x0000802B - GL_HISTOGRAM_LUMINANCE_SIZE* = 0x0000802C - GL_HISTOGRAM_SINK* = 0x0000802D - cGL_MINMAX* = 0x0000802E - GL_MINMAX_FORMAT* = 0x0000802F - GL_MINMAX_SINK* = 0x00008030 - GL_TABLE_TOO_LARGE* = 0x00008031 - GL_COLOR_MATRIX* = 0x000080B1 - GL_COLOR_MATRIX_STACK_DEPTH* = 0x000080B2 - GL_MAX_COLOR_MATRIX_STACK_DEPTH* = 0x000080B3 - GL_POST_COLOR_MATRIX_RED_SCALE* = 0x000080B4 - GL_POST_COLOR_MATRIX_GREEN_SCALE* = 0x000080B5 - GL_POST_COLOR_MATRIX_BLUE_SCALE* = 0x000080B6 - GL_POST_COLOR_MATRIX_ALPHA_SCALE* = 0x000080B7 - GL_POST_COLOR_MATRIX_RED_BIAS* = 0x000080B8 - GL_POST_COLOR_MATRIX_GREEN_BIAS* = 0x000080B9 - GL_POST_COLOR_MATRIX_BLUE_BIAS* = 0x000080BA - GL_POST_COLOR_MATRIX_ALPHA_BIAS* = 0x000080BB - cGL_COLOR_TABLE* = 0x000080D0 - GL_POST_CONVOLUTION_COLOR_TABLE* = 0x000080D1 - GL_POST_COLOR_MATRIX_COLOR_TABLE* = 0x000080D2 - GL_PROXY_COLOR_TABLE* = 0x000080D3 - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE* = 0x000080D4 - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE* = 0x000080D5 - GL_COLOR_TABLE_SCALE* = 0x000080D6 - GL_COLOR_TABLE_BIAS* = 0x000080D7 - GL_COLOR_TABLE_FORMAT* = 0x000080D8 - GL_COLOR_TABLE_WIDTH* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE* = 0x000080DF - GL_CONSTANT_BORDER* = 0x00008151 - GL_REPLICATE_BORDER* = 0x00008153 - GL_CONVOLUTION_BORDER_COLOR* = 0x00008154 # GL_ARB_matrix_palette - GL_MATRIX_PALETTE_ARB* = 0x00008840 - GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB* = 0x00008841 - GL_MAX_PALETTE_MATRICES_ARB* = 0x00008842 - cGL_CURRENT_PALETTE_MATRIX_ARB* = 0x00008843 - GL_MATRIX_INDEX_ARRAY_ARB* = 0x00008844 - GL_CURRENT_MATRIX_INDEX_ARB* = 0x00008845 - GL_MATRIX_INDEX_ARRAY_SIZE_ARB* = 0x00008846 - GL_MATRIX_INDEX_ARRAYtyp_ARB* = 0x00008847 - GL_MATRIX_INDEX_ARRAY_STRIDE_ARB* = 0x00008848 - GL_MATRIX_INDEX_ARRAY_POINTER_ARB* = 0x00008849 # GL_ARB_multisample - GL_MULTISAMPLE_ARB* = 0x0000809D - GL_SAMPLE_ALPHA_TO_COVERAGE_ARB* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE_ARB* = 0x0000809F - cGL_SAMPLE_COVERAGE_ARB* = 0x000080A0 - GL_SAMPLE_BUFFERS_ARB* = 0x000080A8 - GL_SAMPLES_ARB* = 0x000080A9 - GL_SAMPLE_COVERAGE_VALUE_ARB* = 0x000080AA - GL_SAMPLE_COVERAGE_INVERT_ARB* = 0x000080AB - GL_MULTISAMPLE_BIT_ARB* = 0x20000000 # GL_ARB_multitexture - GL_TEXTURE0_ARB* = 0x000084C0 - GL_TEXTURE1_ARB* = 0x000084C1 - GL_TEXTURE2_ARB* = 0x000084C2 - GL_TEXTURE3_ARB* = 0x000084C3 - GL_TEXTURE4_ARB* = 0x000084C4 - GL_TEXTURE5_ARB* = 0x000084C5 - GL_TEXTURE6_ARB* = 0x000084C6 - GL_TEXTURE7_ARB* = 0x000084C7 - GL_TEXTURE8_ARB* = 0x000084C8 - GL_TEXTURE9_ARB* = 0x000084C9 - GL_TEXTURE10_ARB* = 0x000084CA - GL_TEXTURE11_ARB* = 0x000084CB - GL_TEXTURE12_ARB* = 0x000084CC - GL_TEXTURE13_ARB* = 0x000084CD - GL_TEXTURE14_ARB* = 0x000084CE - GL_TEXTURE15_ARB* = 0x000084CF - GL_TEXTURE16_ARB* = 0x000084D0 - GL_TEXTURE17_ARB* = 0x000084D1 - GL_TEXTURE18_ARB* = 0x000084D2 - GL_TEXTURE19_ARB* = 0x000084D3 - GL_TEXTURE20_ARB* = 0x000084D4 - GL_TEXTURE21_ARB* = 0x000084D5 - GL_TEXTURE22_ARB* = 0x000084D6 - GL_TEXTURE23_ARB* = 0x000084D7 - GL_TEXTURE24_ARB* = 0x000084D8 - GL_TEXTURE25_ARB* = 0x000084D9 - GL_TEXTURE26_ARB* = 0x000084DA - GL_TEXTURE27_ARB* = 0x000084DB - GL_TEXTURE28_ARB* = 0x000084DC - GL_TEXTURE29_ARB* = 0x000084DD - GL_TEXTURE30_ARB* = 0x000084DE - GL_TEXTURE31_ARB* = 0x000084DF - cGL_ACTIVE_TEXTURE_ARB* = 0x000084E0 - cGL_CLIENT_ACTIVE_TEXTURE_ARB* = 0x000084E1 - GL_MAX_TEXTURE_UNITS_ARB* = 0x000084E2 # GL_ARB_point_parameters - GL_POINT_SIZE_MIN_ARB* = 0x00008126 - GL_POINT_SIZE_MAX_ARB* = 0x00008127 - GL_POINT_FADE_THRESHOLD_SIZE_ARB* = 0x00008128 - GL_POINT_DISTANCE_ATTENUATION_ARB* = 0x00008129 # GL_ARB_shadow - GL_TEXTURE_COMPARE_MODE_ARB* = 0x0000884C - GL_TEXTURE_COMPARE_FUNC_ARB* = 0x0000884D - GL_COMPARE_R_TO_TEXTURE_ARB* = 0x0000884E # GL_ARB_shadow_ambient - GL_TEXTURE_COMPARE_FAIL_VALUE_ARB* = 0x000080BF # GL_ARB_texture_border_clamp - GL_CLAMP_TO_BORDER_ARB* = 0x0000812D # GL_ARB_texture_compression - GL_COMPRESSED_ALPHA_ARB* = 0x000084E9 - GL_COMPRESSED_LUMINANCE_ARB* = 0x000084EA - GL_COMPRESSED_LUMINANCE_ALPHA_ARB* = 0x000084EB - GL_COMPRESSED_INTENSITY_ARB* = 0x000084EC - GL_COMPRESSED_RGB_ARB* = 0x000084ED - GL_COMPRESSED_RGBA_ARB* = 0x000084EE - GL_TEXTURE_COMPRESSION_HINT_ARB* = 0x000084EF - GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB* = 0x000086A0 - GL_TEXTURE_COMPRESSED_ARB* = 0x000086A1 - GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB* = 0x000086A2 - GL_COMPRESSED_TEXTURE_FORMATS_ARB* = 0x000086A3 # GL_ARB_texture_cube_map - GL_NORMAL_MAP_ARB* = 0x00008511 - GL_REFLECTION_MAP_ARB* = 0x00008512 - GL_TEXTURE_CUBE_MAP_ARB* = 0x00008513 - GL_TEXTURE_BINDING_CUBE_MAP_ARB* = 0x00008514 - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB* = 0x00008515 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB* = 0x00008516 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB* = 0x00008517 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB* = 0x00008518 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB* = 0x00008519 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB* = 0x0000851A - GL_PROXY_TEXTURE_CUBE_MAP_ARB* = 0x0000851B - GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB* = 0x0000851C # GL_ARB_texture_env_combine - GL_COMBINE_ARB* = 0x00008570 - GL_COMBINE_RGB_ARB* = 0x00008571 - GL_COMBINE_ALPHA_ARB* = 0x00008572 - GL_SOURCE0_RGB_ARB* = 0x00008580 - GL_SOURCE1_RGB_ARB* = 0x00008581 - GL_SOURCE2_RGB_ARB* = 0x00008582 - GL_SOURCE0_ALPHA_ARB* = 0x00008588 - GL_SOURCE1_ALPHA_ARB* = 0x00008589 - GL_SOURCE2_ALPHA_ARB* = 0x0000858A - GL_OPERAND0_RGB_ARB* = 0x00008590 - GL_OPERAND1_RGB_ARB* = 0x00008591 - GL_OPERAND2_RGB_ARB* = 0x00008592 - GL_OPERAND0_ALPHA_ARB* = 0x00008598 - GL_OPERAND1_ALPHA_ARB* = 0x00008599 - GL_OPERAND2_ALPHA_ARB* = 0x0000859A - GL_RGB_SCALE_ARB* = 0x00008573 - GL_ADD_SIGNED_ARB* = 0x00008574 - GL_INTERPOLATE_ARB* = 0x00008575 - GL_SUBTRACT_ARB* = 0x000084E7 - GL_CONSTANT_ARB* = 0x00008576 - GL_PRIMARY_COLOR_ARB* = 0x00008577 - GL_PREVIOUS_ARB* = 0x00008578 # GL_ARB_texture_env_dot3 - GL_DOT3_RGB_ARB* = 0x000086AE - GL_DOT3_RGBA_ARB* = 0x000086AF # GL_ARB_texture_mirrored_repeat - GL_MIRRORED_REPEAT_ARB* = 0x00008370 # GL_ARB_transpose_matrix - GL_TRANSPOSE_MODELVIEW_MATRIX_ARB* = 0x000084E3 - GL_TRANSPOSE_PROJECTION_MATRIX_ARB* = 0x000084E4 - GL_TRANSPOSE_TEXTURE_MATRIX_ARB* = 0x000084E5 - GL_TRANSPOSE_COLOR_MATRIX_ARB* = 0x000084E6 # GL_ARB_vertex_blend - GL_MAX_VERTEX_UNITS_ARB* = 0x000086A4 - GL_ACTIVE_VERTEX_UNITS_ARB* = 0x000086A5 - GL_WEIGHT_SUM_UNITY_ARB* = 0x000086A6 - cGL_VERTEX_BLEND_ARB* = 0x000086A7 - GL_CURRENT_WEIGHT_ARB* = 0x000086A8 - GL_WEIGHT_ARRAYtyp_ARB* = 0x000086A9 - GL_WEIGHT_ARRAY_STRIDE_ARB* = 0x000086AA - GL_WEIGHT_ARRAY_SIZE_ARB* = 0x000086AB - GL_WEIGHT_ARRAY_POINTER_ARB* = 0x000086AC - GL_WEIGHT_ARRAY_ARB* = 0x000086AD - GL_MODELVIEW0_ARB* = 0x00001700 - GL_MODELVIEW1_ARB* = 0x0000850A - GL_MODELVIEW2_ARB* = 0x00008722 - GL_MODELVIEW3_ARB* = 0x00008723 - GL_MODELVIEW4_ARB* = 0x00008724 - GL_MODELVIEW5_ARB* = 0x00008725 - GL_MODELVIEW6_ARB* = 0x00008726 - GL_MODELVIEW7_ARB* = 0x00008727 - GL_MODELVIEW8_ARB* = 0x00008728 - GL_MODELVIEW9_ARB* = 0x00008729 - GL_MODELVIEW10_ARB* = 0x0000872A - GL_MODELVIEW11_ARB* = 0x0000872B - GL_MODELVIEW12_ARB* = 0x0000872C - GL_MODELVIEW13_ARB* = 0x0000872D - GL_MODELVIEW14_ARB* = 0x0000872E - GL_MODELVIEW15_ARB* = 0x0000872F - GL_MODELVIEW16_ARB* = 0x00008730 - GL_MODELVIEW17_ARB* = 0x00008731 - GL_MODELVIEW18_ARB* = 0x00008732 - GL_MODELVIEW19_ARB* = 0x00008733 - GL_MODELVIEW20_ARB* = 0x00008734 - GL_MODELVIEW21_ARB* = 0x00008735 - GL_MODELVIEW22_ARB* = 0x00008736 - GL_MODELVIEW23_ARB* = 0x00008737 - GL_MODELVIEW24_ARB* = 0x00008738 - GL_MODELVIEW25_ARB* = 0x00008739 - GL_MODELVIEW26_ARB* = 0x0000873A - GL_MODELVIEW27_ARB* = 0x0000873B - GL_MODELVIEW28_ARB* = 0x0000873C - GL_MODELVIEW29_ARB* = 0x0000873D - GL_MODELVIEW30_ARB* = 0x0000873E - GL_MODELVIEW31_ARB* = 0x0000873F # GL_ARB_vertex_buffer_object - GL_BUFFER_SIZE_ARB* = 0x00008764 - GL_BUFFER_USAGE_ARB* = 0x00008765 - GL_ARRAY_BUFFER_ARB* = 0x00008892 - GL_ELEMENT_ARRAY_BUFFER_ARB* = 0x00008893 - GL_ARRAY_BUFFER_BINDING_ARB* = 0x00008894 - GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB* = 0x00008895 - GL_VERTEX_ARRAY_BUFFER_BINDING_ARB* = 0x00008896 - GL_NORMAL_ARRAY_BUFFER_BINDING_ARB* = 0x00008897 - GL_COLOR_ARRAY_BUFFER_BINDING_ARB* = 0x00008898 - GL_INDEX_ARRAY_BUFFER_BINDING_ARB* = 0x00008899 - GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB* = 0x0000889A - GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB* = 0x0000889B - GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB* = 0x0000889C - GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB* = 0x0000889D - GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB* = 0x0000889E - GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB* = 0x0000889F - GL_READ_ONLY_ARB* = 0x000088B8 - GL_WRITE_ONLY_ARB* = 0x000088B9 - GL_READ_WRITE_ARB* = 0x000088BA - GL_BUFFER_ACCESS_ARB* = 0x000088BB - GL_BUFFER_MAPPED_ARB* = 0x000088BC - GL_BUFFER_MAP_POINTER_ARB* = 0x000088BD - GL_STREAM_DRAW_ARB* = 0x000088E0 - GL_STREAM_READ_ARB* = 0x000088E1 - GL_STREAM_COPY_ARB* = 0x000088E2 - GL_STATIC_DRAW_ARB* = 0x000088E4 - GL_STATIC_READ_ARB* = 0x000088E5 - GL_STATIC_COPY_ARB* = 0x000088E6 - GL_DYNAMIC_DRAW_ARB* = 0x000088E8 - GL_DYNAMIC_READ_ARB* = 0x000088E9 - GL_DYNAMIC_COPY_ARB* = 0x000088EA # GL_ARB_vertex_program - GL_COLOR_SUM_ARB* = 0x00008458 - GL_VERTEX_PROGRAM_ARB* = 0x00008620 - GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB* = 0x00008622 - GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB* = 0x00008623 - GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB* = 0x00008624 - GL_VERTEX_ATTRIB_ARRAYtyp_ARB* = 0x00008625 - GL_CURRENT_VERTEX_ATTRIB_ARB* = 0x00008626 - GL_PROGRAM_LENGTH_ARB* = 0x00008627 - cGL_PROGRAM_STRING_ARB* = 0x00008628 - GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB* = 0x0000862E - GL_MAX_PROGRAM_MATRICES_ARB* = 0x0000862F - GL_CURRENT_MATRIX_STACK_DEPTH_ARB* = 0x00008640 - GL_CURRENT_MATRIX_ARB* = 0x00008641 - GL_VERTEX_PROGRAM_POINT_SIZE_ARB* = 0x00008642 - GL_VERTEX_PROGRAM_TWO_SIDE_ARB* = 0x00008643 - GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB* = 0x00008645 - GL_PROGRAM_ERROR_POSITION_ARB* = 0x0000864B - GL_PROGRAM_BINDING_ARB* = 0x00008677 - GL_MAX_VERTEX_ATTRIBS_ARB* = 0x00008869 - GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB* = 0x0000886A - GL_PROGRAM_ERROR_STRING_ARB* = 0x00008874 - GL_PROGRAM_FORMAT_ASCII_ARB* = 0x00008875 - GL_PROGRAM_FORMAT_ARB* = 0x00008876 - GL_PROGRAM_INSTRUCTIONS_ARB* = 0x000088A0 - GL_MAX_PROGRAM_INSTRUCTIONS_ARB* = 0x000088A1 - GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB* = 0x000088A2 - GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB* = 0x000088A3 - GL_PROGRAM_TEMPORARIES_ARB* = 0x000088A4 - GL_MAX_PROGRAM_TEMPORARIES_ARB* = 0x000088A5 - GL_PROGRAM_NATIVE_TEMPORARIES_ARB* = 0x000088A6 - GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB* = 0x000088A7 - GL_PROGRAM_PARAMETERS_ARB* = 0x000088A8 - GL_MAX_PROGRAM_PARAMETERS_ARB* = 0x000088A9 - GL_PROGRAM_NATIVE_PARAMETERS_ARB* = 0x000088AA - GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB* = 0x000088AB - GL_PROGRAM_ATTRIBS_ARB* = 0x000088AC - GL_MAX_PROGRAM_ATTRIBS_ARB* = 0x000088AD - GL_PROGRAM_NATIVE_ATTRIBS_ARB* = 0x000088AE - GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB* = 0x000088AF - GL_PROGRAM_ADDRESS_REGISTERS_ARB* = 0x000088B0 - GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB* = 0x000088B1 - GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB* = 0x000088B2 - GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB* = 0x000088B3 - GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB* = 0x000088B4 - GL_MAX_PROGRAM_ENV_PARAMETERS_ARB* = 0x000088B5 - GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB* = 0x000088B6 - GL_TRANSPOSE_CURRENT_MATRIX_ARB* = 0x000088B7 - GL_MATRIX0_ARB* = 0x000088C0 - GL_MATRIX1_ARB* = 0x000088C1 - GL_MATRIX2_ARB* = 0x000088C2 - GL_MATRIX3_ARB* = 0x000088C3 - GL_MATRIX4_ARB* = 0x000088C4 - GL_MATRIX5_ARB* = 0x000088C5 - GL_MATRIX6_ARB* = 0x000088C6 - GL_MATRIX7_ARB* = 0x000088C7 - GL_MATRIX8_ARB* = 0x000088C8 - GL_MATRIX9_ARB* = 0x000088C9 - GL_MATRIX10_ARB* = 0x000088CA - GL_MATRIX11_ARB* = 0x000088CB - GL_MATRIX12_ARB* = 0x000088CC - GL_MATRIX13_ARB* = 0x000088CD - GL_MATRIX14_ARB* = 0x000088CE - GL_MATRIX15_ARB* = 0x000088CF - GL_MATRIX16_ARB* = 0x000088D0 - GL_MATRIX17_ARB* = 0x000088D1 - GL_MATRIX18_ARB* = 0x000088D2 - GL_MATRIX19_ARB* = 0x000088D3 - GL_MATRIX20_ARB* = 0x000088D4 - GL_MATRIX21_ARB* = 0x000088D5 - GL_MATRIX22_ARB* = 0x000088D6 - GL_MATRIX23_ARB* = 0x000088D7 - GL_MATRIX24_ARB* = 0x000088D8 - GL_MATRIX25_ARB* = 0x000088D9 - GL_MATRIX26_ARB* = 0x000088DA - GL_MATRIX27_ARB* = 0x000088DB - GL_MATRIX28_ARB* = 0x000088DC - GL_MATRIX29_ARB* = 0x000088DD - GL_MATRIX30_ARB* = 0x000088DE - GL_MATRIX31_ARB* = 0x000088DF # GL_ARB_draw_buffers - GL_MAX_DRAW_BUFFERS_ARB* = 0x00008824 - GL_DRAW_BUFFER0_ARB* = 0x00008825 - GL_DRAW_BUFFER1_ARB* = 0x00008826 - GL_DRAW_BUFFER2_ARB* = 0x00008827 - GL_DRAW_BUFFER3_ARB* = 0x00008828 - GL_DRAW_BUFFER4_ARB* = 0x00008829 - GL_DRAW_BUFFER5_ARB* = 0x0000882A - GL_DRAW_BUFFER6_ARB* = 0x0000882B - GL_DRAW_BUFFER7_ARB* = 0x0000882C - GL_DRAW_BUFFER8_ARB* = 0x0000882D - GL_DRAW_BUFFER9_ARB* = 0x0000882E - GL_DRAW_BUFFER10_ARB* = 0x0000882F - GL_DRAW_BUFFER11_ARB* = 0x00008830 - GL_DRAW_BUFFER12_ARB* = 0x00008831 - GL_DRAW_BUFFER13_ARB* = 0x00008832 - GL_DRAW_BUFFER14_ARB* = 0x00008833 - GL_DRAW_BUFFER15_ARB* = 0x00008834 # GL_ARB_texture_rectangle - GL_TEXTURE_RECTANGLE_ARB* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE_ARB* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE_ARB* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB* = 0x000084F8 # GL_ARB_color_buffer_float - GL_RGBA_FLOAT_MODE_ARB* = 0x00008820 - GL_CLAMP_VERTEX_COLOR_ARB* = 0x0000891A - GL_CLAMP_FRAGMENT_COLOR_ARB* = 0x0000891B - GL_CLAMP_READ_COLOR_ARB* = 0x0000891C - GL_FIXED_ONLY_ARB* = 0x0000891D - WGLtyp_RGBA_FLOAT_ARB* = 0x000021A0 - GLX_RGBA_FLOATtyp* = 0x000020B9 - GLX_RGBA_FLOAT_BIT* = 0x00000004 # GL_ARB_half_float_pixel - GL_HALF_FLOAT_ARB* = 0x0000140B # GL_ARB_texture_float - GL_TEXTURE_REDtyp_ARB* = 0x00008C10 - GL_TEXTURE_GREENtyp_ARB* = 0x00008C11 - GL_TEXTURE_BLUEtyp_ARB* = 0x00008C12 - GL_TEXTURE_ALPHAtyp_ARB* = 0x00008C13 - GL_TEXTURE_LUMINANCEtyp_ARB* = 0x00008C14 - GL_TEXTURE_INTENSITYtyp_ARB* = 0x00008C15 - GL_TEXTURE_DEPTHtyp_ARB* = 0x00008C16 - GL_UNSIGNED_NORMALIZED_ARB* = 0x00008C17 - GL_RGBA32F_ARB* = 0x00008814 - GL_RGB32F_ARB* = 0x00008815 - GL_ALPHA32F_ARB* = 0x00008816 - GL_INTENSITY32F_ARB* = 0x00008817 - GL_LUMINANCE32F_ARB* = 0x00008818 - GL_LUMINANCE_ALPHA32F_ARB* = 0x00008819 - GL_RGBA16F_ARB* = 0x0000881A - GL_RGB16F_ARB* = 0x0000881B - GL_ALPHA16F_ARB* = 0x0000881C - GL_INTENSITY16F_ARB* = 0x0000881D - GL_LUMINANCE16F_ARB* = 0x0000881E - GL_LUMINANCE_ALPHA16F_ARB* = 0x0000881F # GL_ARB_pixel_buffer_object - GL_PIXEL_PACK_BUFFER_ARB* = 0x000088EB - GL_PIXEL_UNPACK_BUFFER_ARB* = 0x000088EC - GL_PIXEL_PACK_BUFFER_BINDING_ARB* = 0x000088ED - GL_PIXEL_UNPACK_BUFFER_BINDING_ARB* = 0x000088EF # GL_ARB_depth_buffer_float - GL_DEPTH_COMPONENT32F* = 0x00008CAC - GL_DEPTH32F_STENCIL8* = 0x00008CAD - GL_FLOAT_32_UNSIGNED_INT_24_8_REV* = 0x00008DAD # GL_ARB_framebuffer_object - GL_INVALID_FRAMEBUFFER_OPERATION* = 0x00000506 - GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING* = 0x00008210 - GL_FRAMEBUFFER_ATTACHMENT_COMPONENTtyp* = 0x00008211 - GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE* = 0x00008212 - GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE* = 0x00008213 - GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE* = 0x00008214 - GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE* = 0x00008215 - GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE* = 0x00008216 - GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE* = 0x00008217 - GL_FRAMEBUFFER_DEFAULT* = 0x00008218 - GL_FRAMEBUFFER_UNDEFINED* = 0x00008219 - GL_DEPTH_STENCIL_ATTACHMENT* = 0x0000821A - GL_MAX_RENDERBUFFER_SIZE* = 0x000084E8 - GL_DEPTH_STENCIL* = 0x000084F9 - GL_UNSIGNED_INT_24_8* = 0x000084FA - GL_DEPTH24_STENCIL8* = 0x000088F0 - GL_TEXTURE_STENCIL_SIZE* = 0x000088F1 - GL_TEXTURE_REDtyp* = 0x00008C10 - GL_TEXTURE_GREENtyp* = 0x00008C11 - GL_TEXTURE_BLUEtyp* = 0x00008C12 - GL_TEXTURE_ALPHAtyp* = 0x00008C13 - GL_TEXTURE_DEPTHtyp* = 0x00008C16 - GL_UNSIGNED_NORMALIZED* = 0x00008C17 - GL_FRAMEBUFFER_BINDING* = 0x00008CA6 - GL_DRAW_FRAMEBUFFER_BINDING* = GL_FRAMEBUFFER_BINDING - GL_RENDERBUFFER_BINDING* = 0x00008CA7 - GL_READ_FRAMEBUFFER* = 0x00008CA8 - GL_DRAW_FRAMEBUFFER* = 0x00008CA9 - GL_READ_FRAMEBUFFER_BINDING* = 0x00008CAA - GL_RENDERBUFFER_SAMPLES* = 0x00008CAB - GL_FRAMEBUFFER_ATTACHMENT_OBJECTtyp* = 0x00008CD0 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME* = 0x00008CD1 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL* = 0x00008CD2 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE* = 0x00008CD3 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER* = 0x00008CD4 - GL_FRAMEBUFFER_COMPLETE* = 0x00008CD5 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT* = 0x00008CD6 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT* = 0x00008CD7 - GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER* = 0x00008CDB - GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER* = 0x00008CDC - GL_FRAMEBUFFER_UNSUPPORTED* = 0x00008CDD - GL_MAX_COLOR_ATTACHMENTS* = 0x00008CDF - GL_COLOR_ATTACHMENT0* = 0x00008CE0 - GL_COLOR_ATTACHMENT1* = 0x00008CE1 - GL_COLOR_ATTACHMENT2* = 0x00008CE2 - GL_COLOR_ATTACHMENT3* = 0x00008CE3 - GL_COLOR_ATTACHMENT4* = 0x00008CE4 - GL_COLOR_ATTACHMENT5* = 0x00008CE5 - GL_COLOR_ATTACHMENT6* = 0x00008CE6 - GL_COLOR_ATTACHMENT7* = 0x00008CE7 - GL_COLOR_ATTACHMENT8* = 0x00008CE8 - GL_COLOR_ATTACHMENT9* = 0x00008CE9 - GL_COLOR_ATTACHMENT10* = 0x00008CEA - GL_COLOR_ATTACHMENT11* = 0x00008CEB - GL_COLOR_ATTACHMENT12* = 0x00008CEC - GL_COLOR_ATTACHMENT13* = 0x00008CED - GL_COLOR_ATTACHMENT14* = 0x00008CEE - GL_COLOR_ATTACHMENT15* = 0x00008CEF - GL_DEPTH_ATTACHMENT* = 0x00008D00 - GL_STENCIL_ATTACHMENT* = 0x00008D20 - GL_FRAMEBUFFER* = 0x00008D40 - GL_RENDERBUFFER* = 0x00008D41 - GL_RENDERBUFFER_WIDTH* = 0x00008D42 - GL_RENDERBUFFER_HEIGHT* = 0x00008D43 - GL_RENDERBUFFER_INTERNAL_FORMAT* = 0x00008D44 - GL_STENCIL_INDEX1* = 0x00008D46 - GL_STENCIL_INDEX4* = 0x00008D47 - GL_STENCIL_INDEX8* = 0x00008D48 - GL_STENCIL_INDEX16* = 0x00008D49 - GL_RENDERBUFFER_RED_SIZE* = 0x00008D50 - GL_RENDERBUFFER_GREEN_SIZE* = 0x00008D51 - GL_RENDERBUFFER_BLUE_SIZE* = 0x00008D52 - GL_RENDERBUFFER_ALPHA_SIZE* = 0x00008D53 - GL_RENDERBUFFER_DEPTH_SIZE* = 0x00008D54 - GL_RENDERBUFFER_STENCIL_SIZE* = 0x00008D55 - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE* = 0x00008D56 - GL_MAX_SAMPLES* = 0x00008D57 - GL_INDEX* = 0x00008222 - GL_TEXTURE_LUMINANCEtyp* = 0x00008C14 - GL_TEXTURE_INTENSITYtyp* = 0x00008C15 # GL_ARB_framebuffer_sRGB - GL_FRAMEBUFFER_SRGB* = 0x00008DB9 # GL_ARB_geometry_shader4 - GL_LINES_ADJACENCY_ARB* = 0x0000000A - GL_LINE_STRIP_ADJACENCY_ARB* = 0x0000000B - GL_TRIANGLES_ADJACENCY_ARB* = 0x0000000C - GL_TRIANGLE_STRIP_ADJACENCY_ARB* = 0x0000000D - GL_PROGRAM_POINT_SIZE_ARB* = 0x00008642 - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB* = 0x00008C29 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB* = 0x00008DA7 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB* = 0x00008DA8 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB* = 0x00008DA9 - GL_GEOMETRY_SHADER_ARB* = 0x00008DD9 - GL_GEOMETRY_VERTICES_OUT_ARB* = 0x00008DDA - GL_GEOMETRY_INPUTtyp_ARB* = 0x00008DDB - GL_GEOMETRY_OUTPUTtyp_ARB* = 0x00008DDC - GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB* = 0x00008DDD - GL_MAX_VERTEX_VARYING_COMPONENTS_ARB* = 0x00008DDE - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB* = 0x00008DDF - GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB* = 0x00008DE0 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB* = 0x00008DE1 # reuse - # GL_MAX_VARYING_COMPONENTS - # reuse - # GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER - # - # GL_ARB_half_float_vertex - GL_HALF_FLOAT* = 0x0000140B # GL_ARB_instanced_arrays - GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB* = 0x000088FE # GL_ARB_map_buffer_range - GL_MAP_READ_BIT* = 0x00000001 - GL_MAP_WRITE_BIT* = 0x00000002 - GL_MAP_INVALIDATE_RANGE_BIT* = 0x00000004 - GL_MAP_INVALIDATE_BUFFER_BIT* = 0x00000008 - GL_MAP_FLUSH_EXPLICIT_BIT* = 0x00000010 - GL_MAP_UNSYNCHRONIZED_BIT* = 0x00000020 # GL_ARB_texture_buffer_object - GL_TEXTURE_BUFFER_ARB* = 0x00008C2A - GL_MAX_TEXTURE_BUFFER_SIZE_ARB* = 0x00008C2B - GL_TEXTURE_BINDING_BUFFER_ARB* = 0x00008C2C - GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB* = 0x00008C2D - GL_TEXTURE_BUFFER_FORMAT_ARB* = 0x00008C2E # GL_ARB_texture_compression_rgtc - GL_COMPRESSED_RED_RGTC1* = 0x00008DBB - GL_COMPRESSED_SIGNED_RED_RGTC1* = 0x00008DBC - GL_COMPRESSED_RG_RGTC2* = 0x00008DBD - GL_COMPRESSED_SIGNED_RG_RGTC2* = 0x00008DBE # GL_ARB_texture_rg - GL_RG* = 0x00008227 - GL_RG_INTEGER* = 0x00008228 - GL_R8* = 0x00008229 - GL_R16* = 0x0000822A - GL_RG8* = 0x0000822B - GL_RG16* = 0x0000822C - GL_R16F* = 0x0000822D - GL_R32F* = 0x0000822E - GL_RG16F* = 0x0000822F - GL_RG32F* = 0x00008230 - GL_R8I* = 0x00008231 - GL_R8UI* = 0x00008232 - GL_R16I* = 0x00008233 - GL_R16UI* = 0x00008234 - GL_R32I* = 0x00008235 - GL_R32UI* = 0x00008236 - GL_RG8I* = 0x00008237 - GL_RG8UI* = 0x00008238 - GL_RG16I* = 0x00008239 - GL_RG16UI* = 0x0000823A - GL_RG32I* = 0x0000823B - GL_RG32UI* = 0x0000823C # GL_ARB_vertex_array_object - GL_VERTEX_ARRAY_BINDING* = 0x000085B5 # GL_ARB_uniform_buffer_object - GL_UNIFORM_BUFFER* = 0x00008A11 - GL_UNIFORM_BUFFER_BINDING* = 0x00008A28 - GL_UNIFORM_BUFFER_START* = 0x00008A29 - GL_UNIFORM_BUFFER_SIZE* = 0x00008A2A - GL_MAX_VERTEX_UNIFORM_BLOCKS* = 0x00008A2B - GL_MAX_GEOMETRY_UNIFORM_BLOCKS* = 0x00008A2C - GL_MAX_FRAGMENT_UNIFORM_BLOCKS* = 0x00008A2D - GL_MAX_COMBINED_UNIFORM_BLOCKS* = 0x00008A2E - GL_MAX_UNIFORM_BUFFER_BINDINGS* = 0x00008A2F - GL_MAX_UNIFORM_BLOCK_SIZE* = 0x00008A30 - GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS* = 0x00008A31 - GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS* = 0x00008A32 - GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS* = 0x00008A33 - GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT* = 0x00008A34 - GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH* = 0x00008A35 - GL_ACTIVE_UNIFORM_BLOCKS* = 0x00008A36 - GL_UNIFORMtyp* = 0x00008A37 - GL_UNIFORM_SIZE* = 0x00008A38 - GL_UNIFORM_NAME_LENGTH* = 0x00008A39 - GL_UNIFORM_BLOCK_INDEX* = 0x00008A3A - GL_UNIFORM_OFFSET* = 0x00008A3B - GL_UNIFORM_ARRAY_STRIDE* = 0x00008A3C - GL_UNIFORM_MATRIX_STRIDE* = 0x00008A3D - GL_UNIFORM_IS_ROW_MAJOR* = 0x00008A3E - cGL_UNIFORM_BLOCK_BINDING* = 0x00008A3F - GL_UNIFORM_BLOCK_DATA_SIZE* = 0x00008A40 - GL_UNIFORM_BLOCK_NAME_LENGTH* = 0x00008A41 - GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS* = 0x00008A42 - GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES* = 0x00008A43 - GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER* = 0x00008A44 - GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER* = 0x00008A45 - GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER* = 0x00008A46 - GL_INVALID_INDEX* = 0xFFFFFFFF # GL_ARB_compatibility - # ARB_compatibility just defines tokens from core 3.0 - # GL_ARB_copy_buffer - GL_COPY_READ_BUFFER* = 0x00008F36 - GL_COPY_WRITE_BUFFER* = 0x00008F37 # GL_ARB_depth_clamp - GL_DEPTH_CLAMP* = 0x0000864F # GL_ARB_provoking_vertex - GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION* = 0x00008E4C - GL_FIRST_VERTEX_CONVENTION* = 0x00008E4D - GL_LAST_VERTEX_CONVENTION* = 0x00008E4E - cGL_PROVOKING_VERTEX* = 0x00008E4F # GL_ARB_seamless_cube_map - GL_TEXTURE_CUBE_MAP_SEAMLESS* = 0x0000884F # GL_ARB_sync - GL_MAX_SERVER_WAIT_TIMEOUT* = 0x00009111 - GL_OBJECTtyp* = 0x00009112 - GL_SYNC_CONDITION* = 0x00009113 - GL_SYNC_STATUS* = 0x00009114 - GL_SYNC_FLAGS* = 0x00009115 - GL_SYNC_FENCE* = 0x00009116 - GL_SYNC_GPU_COMMANDS_COMPLETE* = 0x00009117 - GL_UNSIGNALED* = 0x00009118 - GL_SIGNALED* = 0x00009119 - GL_ALREADY_SIGNALED* = 0x0000911A - GL_TIMEOUT_EXPIRED* = 0x0000911B - GL_CONDITION_SATISFIED* = 0x0000911C - GL_WAIT_FAILED* = 0x0000911D - GL_SYNC_FLUSH_COMMANDS_BIT* = 0x00000001 - GL_TIMEOUT_IGNORED* = int64(- 1) # GL_ARB_texture_multisample - GL_SAMPLE_POSITION* = 0x00008E50 - GL_SAMPLE_MASK* = 0x00008E51 - GL_SAMPLE_MASK_VALUE* = 0x00008E52 - GL_MAX_SAMPLE_MASK_WORDS* = 0x00008E59 - GL_TEXTURE_2D_MULTISAMPLE* = 0x00009100 - GL_PROXY_TEXTURE_2D_MULTISAMPLE* = 0x00009101 - GL_TEXTURE_2D_MULTISAMPLE_ARRAY* = 0x00009102 - GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY* = 0x00009103 - GL_TEXTURE_BINDING_2D_MULTISAMPLE* = 0x00009104 - GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY* = 0x00009105 - GL_TEXTURE_SAMPLES* = 0x00009106 - GL_TEXTURE_FIXED_SAMPLE_LOCATIONS* = 0x00009107 - GL_SAMPLER_2D_MULTISAMPLE* = 0x00009108 - GL_INT_SAMPLER_2D_MULTISAMPLE* = 0x00009109 - GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE* = 0x0000910A - GL_SAMPLER_2D_MULTISAMPLE_ARRAY* = 0x0000910B - GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY* = 0x0000910C - GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY* = 0x0000910D - GL_MAX_COLOR_TEXTURE_SAMPLES* = 0x0000910E - GL_MAX_DEPTH_TEXTURE_SAMPLES* = 0x0000910F - GL_MAX_INTEGER_SAMPLES* = 0x00009110 # GL_ARB_vertex_array_bgra - # reuse GL_BGRA - # GL_ARB_sample_shading - GL_SAMPLE_SHADING_ARB* = 0x00008C36 - GL_MIN_SAMPLE_SHADING_VALUE_ARB* = 0x00008C37 # GL_ARB_texture_cube_map_array - GL_TEXTURE_CUBE_MAP_ARRAY_ARB* = 0x00009009 - GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB* = 0x0000900A - GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB* = 0x0000900B - GL_SAMPLER_CUBE_MAP_ARRAY_ARB* = 0x0000900C - GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB* = 0x0000900D - GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB* = 0x0000900E - GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB* = 0x0000900F # GL_ARB_texture_gather - GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB* = 0x00008E5E - GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB* = 0x00008E5F # - # GL_ARB_shading_language_include - GL_SHADER_INCLUDE_ARB* = 0x00008DAE - GL_NAMED_STRING_LENGTH_ARB* = 0x00008DE9 - GL_NAMED_STRINGtyp_ARB* = 0x00008DEA # GL_ARB_texture_compression_bptc - GL_COMPRESSED_RGBA_BPTC_UNORM_ARB* = 0x00008E8C - GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB* = 0x00008E8D - GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB* = 0x00008E8E - GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB* = 0x00008E8F # - # GL_ARB_blend_func_extended - GL_SRC1_COLOR* = 0x000088F9 # reuse GL_SRC1_ALPHA - GL_ONE_MINUS_SRC1_COLOR* = 0x000088FA - GL_ONE_MINUS_SRC1_ALPHA* = 0x000088FB - GL_MAX_DUAL_SOURCE_DRAW_BUFFERS* = 0x000088FC # GL_ARB_occlusion_query2 - GL_ANY_SAMPLES_PASSED* = 0x00008C2F # GL_ARB_sampler_objects - GL_SAMPLER_BINDING* = 0x00008919 # GL_ARB_texture_rgb10_a2ui - GL_RGB10_A2UI* = 0x0000906F # GL_ARB_texture_swizzle - GL_TEXTURE_SWIZZLE_R* = 0x00008E42 - GL_TEXTURE_SWIZZLE_G* = 0x00008E43 - GL_TEXTURE_SWIZZLE_B* = 0x00008E44 - GL_TEXTURE_SWIZZLE_A* = 0x00008E45 - GL_TEXTURE_SWIZZLE_RGBA* = 0x00008E46 # GL_ARB_timer_query - GL_TIME_ELAPSED* = 0x000088BF - GL_TIMESTAMP* = 0x00008E28 # GL_ARB_vertextyp_2_10_10_10_rev - # reuse GL_UNSIGNED_INT_2_10_10_10_REV - GL_INT_2_10_10_10_REV* = 0x00008D9F # GL_ARB_draw_indirect - GL_DRAW_INDIRECT_BUFFER* = 0x00008F3F - GL_DRAW_INDIRECT_BUFFER_BINDING* = 0x00008F43 # GL_ARB_gpu_shader5 - GL_GEOMETRY_SHADER_INVOCATIONS* = 0x0000887F - GL_MAX_GEOMETRY_SHADER_INVOCATIONS* = 0x00008E5A - GL_MIN_FRAGMENT_INTERPOLATION_OFFSET* = 0x00008E5B - GL_MAX_FRAGMENT_INTERPOLATION_OFFSET* = 0x00008E5C - GL_FRAGMENT_INTERPOLATION_OFFSET_BITS* = 0x00008E5D # reuse GL_MAX_VERTEX_STREAMS - # GL_ARB_gpu_shader_fp64 - # reuse GL_DOUBLE - GL_DOUBLE_VEC2* = 0x00008FFC - GL_DOUBLE_VEC3* = 0x00008FFD - GL_DOUBLE_VEC4* = 0x00008FFE - GL_DOUBLE_MAT2* = 0x00008F46 - GL_DOUBLE_MAT3* = 0x00008F47 - GL_DOUBLE_MAT4* = 0x00008F48 - GL_DOUBLE_MAT2x3* = 0x00008F49 - GL_DOUBLE_MAT2x4* = 0x00008F4A - GL_DOUBLE_MAT3x2* = 0x00008F4B - GL_DOUBLE_MAT3x4* = 0x00008F4C - GL_DOUBLE_MAT4x2* = 0x00008F4D - GL_DOUBLE_MAT4x3* = 0x00008F4E # GL_ARB_shader_subroutine - GL_ACTIVE_SUBROUTINES* = 0x00008DE5 - GL_ACTIVE_SUBROUTINE_UNIFORMS* = 0x00008DE6 - GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS* = 0x00008E47 - GL_ACTIVE_SUBROUTINE_MAX_LENGTH* = 0x00008E48 - GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH* = 0x00008E49 - GL_MAX_SUBROUTINES* = 0x00008DE7 - GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS* = 0x00008DE8 - GL_NUM_COMPATIBLE_SUBROUTINES* = 0x00008E4A - GL_COMPATIBLE_SUBROUTINES* = 0x00008E4B # GL_ARB_tessellation_shader - GL_PATCHES* = 0x0000000E - GL_PATCH_VERTICES* = 0x00008E72 - GL_PATCH_DEFAULT_INNER_LEVEL* = 0x00008E73 - GL_PATCH_DEFAULT_OUTER_LEVEL* = 0x00008E74 - GL_TESS_CONTROL_OUTPUT_VERTICES* = 0x00008E75 - GL_TESS_GEN_MODE* = 0x00008E76 - GL_TESS_GEN_SPACING* = 0x00008E77 - GL_TESS_GEN_VERTEX_ORDER* = 0x00008E78 - GL_TESS_GEN_POINT_MODE* = 0x00008E79 - GL_ISOLINES* = 0x00008E7A # reuse GL_EQUAL - GL_FRACTIONAL_ODD* = 0x00008E7B - GL_FRACTIONAL_EVEN* = 0x00008E7C - GL_MAX_PATCH_VERTICES* = 0x00008E7D - GL_MAX_TESS_GEN_LEVEL* = 0x00008E7E - GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS* = 0x00008E7F - GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS* = 0x00008E80 - GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS* = 0x00008E81 - GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS* = 0x00008E82 - GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS* = 0x00008E83 - GL_MAX_TESS_PATCH_COMPONENTS* = 0x00008E84 - GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS* = 0x00008E85 - GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS* = 0x00008E86 - GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS* = 0x00008E89 - GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS* = 0x00008E8A - GL_MAX_TESS_CONTROL_INPUT_COMPONENTS* = 0x0000886C - GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS* = 0x0000886D - GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS* = 0x00008E1E - GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS* = 0x00008E1F - GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER* = 0x000084F0 - GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER* = 0x000084F1 - GL_TESS_EVALUATION_SHADER* = 0x00008E87 - GL_TESS_CONTROL_SHADER* = 0x00008E88 # GL_ARB_texture_buffer_object_rgb32 - # GL_ARB_transform_feedback2 - GL_TRANSFORM_FEEDBACK* = 0x00008E22 - GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED* = 0x00008E23 - GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE* = 0x00008E24 - GL_TRANSFORM_FEEDBACK_BINDING* = 0x00008E25 # GL_ARB_transform_feedback3 - GL_MAX_TRANSFORM_FEEDBACK_BUFFERS* = 0x00008E70 - GL_MAX_VERTEX_STREAMS* = 0x00008E71 # GL_ARB_ES2_compatibility - GL_FIXED* = 0x0000140C - GL_IMPLEMENTATION_COLOR_READtyp* = 0x00008B9A - GL_IMPLEMENTATION_COLOR_READ_FORMAT* = 0x00008B9B - GL_LOW_FLOAT* = 0x00008DF0 - GL_MEDIUM_FLOAT* = 0x00008DF1 - GL_HIGH_FLOAT* = 0x00008DF2 - GL_LOW_INT* = 0x00008DF3 - GL_MEDIUM_INT* = 0x00008DF4 - GL_HIGH_INT* = 0x00008DF5 - GL_SHADER_COMPILER* = 0x00008DFA - GL_NUM_SHADER_BINARY_FORMATS* = 0x00008DF9 - GL_MAX_VERTEX_UNIFORM_VECTORS* = 0x00008DFB - GL_MAX_VARYING_VECTORS* = 0x00008DFC - GL_MAX_FRAGMENT_UNIFORM_VECTORS* = 0x00008DFD # GL_ARB_get_program_binary - GL_PROGRAM_BINARY_RETRIEVABLE_HINT* = 0x00008257 - GL_PROGRAM_BINARY_LENGTH* = 0x00008741 - GL_NUM_PROGRAM_BINARY_FORMATS* = 0x000087FE - GL_PROGRAM_BINARY_FORMATS* = 0x000087FF # GL_ARB_separate_shader_objects - GL_VERTEX_SHADER_BIT* = 0x00000001 - GL_FRAGMENT_SHADER_BIT* = 0x00000002 - GL_GEOMETRY_SHADER_BIT* = 0x00000004 - GL_TESS_CONTROL_SHADER_BIT* = 0x00000008 - GL_TESS_EVALUATION_SHADER_BIT* = 0x00000010 - GL_ALL_SHADER_BITS* = 0xFFFFFFFF - GL_PROGRAM_SEPARABLE* = 0x00008258 - GL_ACTIVE_PROGRAM* = 0x00008259 - GL_PROGRAM_PIPELINE_BINDING* = 0x0000825A # GL_ARB_vertex_attrib_64bit - GL_MAX_VIEWPORTS* = 0x0000825B - GL_VIEWPORT_SUBPIXEL_BITS* = 0x0000825C - GL_VIEWPORT_BOUNDS_RANGE* = 0x0000825D - GL_LAYER_PROVOKING_VERTEX* = 0x0000825E - GL_VIEWPORT_INDEX_PROVOKING_VERTEX* = 0x0000825F - GL_UNDEFINED_VERTEX* = 0x00008260 # GL_ARB_cl_event - GL_SYNC_CL_EVENT_ARB* = 0x00008240 - GL_SYNC_CL_EVENT_COMPLETE_ARB* = 0x00008241 # GL_ARB_debug_output - GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB* = 0x00008242 - GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB* = 0x00008243 - GL_DEBUG_CALLBACK_FUNCTION_ARB* = 0x00008244 - GL_DEBUG_CALLBACK_USER_PARAM_ARB* = 0x00008245 - GL_DEBUG_SOURCE_API_ARB* = 0x00008246 - GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB* = 0x00008247 - GL_DEBUG_SOURCE_SHADER_COMPILER_ARB* = 0x00008248 - GL_DEBUG_SOURCE_THIRD_PARTY_ARB* = 0x00008249 - GL_DEBUG_SOURCE_APPLICATION_ARB* = 0x0000824A - GL_DEBUG_SOURCE_OTHER_ARB* = 0x0000824B - GL_DEBUGtyp_ERROR_ARB* = 0x0000824C - GL_DEBUGtyp_DEPRECATED_BEHAVIOR_ARB* = 0x0000824D - GL_DEBUGtyp_UNDEFINED_BEHAVIOR_ARB* = 0x0000824E - GL_DEBUGtyp_PORTABILITY_ARB* = 0x0000824F - GL_DEBUGtyp_PERFORMANCE_ARB* = 0x00008250 - GL_DEBUGtyp_OTHER_ARB* = 0x00008251 - GL_MAX_DEBUG_MESSAGE_LENGTH_ARB* = 0x00009143 - GL_MAX_DEBUG_LOGGED_MESSAGES_ARB* = 0x00009144 - GL_DEBUG_LOGGED_MESSAGES_ARB* = 0x00009145 - GL_DEBUG_SEVERITY_HIGH_ARB* = 0x00009146 - GL_DEBUG_SEVERITY_MEDIUM_ARB* = 0x00009147 - GL_DEBUG_SEVERITY_LOW_ARB* = 0x00009148 # GL_ARB_robustness - # reuse GL_NO_ERROR - GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB* = 0x00000004 - GL_LOSE_CONTEXT_ON_RESET_ARB* = 0x00008252 - GL_GUILTY_CONTEXT_RESET_ARB* = 0x00008253 - GL_INNOCENT_CONTEXT_RESET_ARB* = 0x00008254 - GL_UNKNOWN_CONTEXT_RESET_ARB* = 0x00008255 - GL_RESET_NOTIFICATION_STRATEGY_ARB* = 0x00008256 - GL_NO_RESET_NOTIFICATION_ARB* = 0x00008261 # - # GL_ARB_compressed_texture_pixel_storage - GL_UNPACK_COMPRESSED_BLOCK_WIDTH* = 0x00009127 - GL_UNPACK_COMPRESSED_BLOCK_HEIGHT* = 0x00009128 - GL_UNPACK_COMPRESSED_BLOCK_DEPTH* = 0x00009129 - GL_UNPACK_COMPRESSED_BLOCK_SIZE* = 0x0000912A - GL_PACK_COMPRESSED_BLOCK_WIDTH* = 0x0000912B - GL_PACK_COMPRESSED_BLOCK_HEIGHT* = 0x0000912C - GL_PACK_COMPRESSED_BLOCK_DEPTH* = 0x0000912D - GL_PACK_COMPRESSED_BLOCK_SIZE* = 0x0000912E # GL_ARB_internalformat_query - GL_NUM_SAMPLE_COUNTS* = 0x00009380 # GL_ARB_map_buffer_alignment - GL_MIN_MAP_BUFFER_ALIGNMENT* = 0x000090BC # GL_ARB_shader_atomic_counters - GL_ATOMIC_COUNTER_BUFFER* = 0x000092C0 - GL_ATOMIC_COUNTER_BUFFER_BINDING* = 0x000092C1 - GL_ATOMIC_COUNTER_BUFFER_START* = 0x000092C2 - GL_ATOMIC_COUNTER_BUFFER_SIZE* = 0x000092C3 - GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE* = 0x000092C4 - GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS* = 0x000092C5 - GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES* = 0x000092C6 - GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER* = 0x000092C7 - GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER* = 0x000092C8 - GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER* = 0x000092C9 - GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER* = 0x000092CA - GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER* = 0x000092CB - GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS* = 0x000092CC - GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS* = 0x000092CD - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS* = 0x000092CE - GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS* = 0x000092CF - GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS* = 0x000092D0 - GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS* = 0x000092D1 - GL_MAX_VERTEX_ATOMIC_COUNTERS* = 0x000092D2 - GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS* = 0x000092D3 - GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS* = 0x000092D4 - GL_MAX_GEOMETRY_ATOMIC_COUNTERS* = 0x000092D5 - GL_MAX_FRAGMENT_ATOMIC_COUNTERS* = 0x000092D6 - GL_MAX_COMBINED_ATOMIC_COUNTERS* = 0x000092D7 - GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE* = 0x000092D8 - GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS* = 0x000092DC - GL_ACTIVE_ATOMIC_COUNTER_BUFFERS* = 0x000092D9 - GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX* = 0x000092DA - GL_UNSIGNED_INT_ATOMIC_COUNTER* = 0x000092DB # GL_ARB_shader_image_load_store - GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT* = 0x00000001 - GL_ELEMENT_ARRAY_BARRIER_BIT* = 0x00000002 - GL_UNIFORM_BARRIER_BIT* = 0x00000004 - GL_TEXTURE_FETCH_BARRIER_BIT* = 0x00000008 - GL_SHADER_IMAGE_ACCESS_BARRIER_BIT* = 0x00000020 - GL_COMMAND_BARRIER_BIT* = 0x00000040 - GL_PIXEL_BUFFER_BARRIER_BIT* = 0x00000080 - GL_TEXTURE_UPDATE_BARRIER_BIT* = 0x00000100 - GL_BUFFER_UPDATE_BARRIER_BIT* = 0x00000200 - GL_FRAMEBUFFER_BARRIER_BIT* = 0x00000400 - GL_TRANSFORM_FEEDBACK_BARRIER_BIT* = 0x00000800 - GL_ATOMIC_COUNTER_BARRIER_BIT* = 0x00001000 - GL_ALL_BARRIER_BITS* = 0xFFFFFFFF - GL_MAX_IMAGE_UNITS* = 0x00008F38 - GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS* = 0x00008F39 - GL_IMAGE_BINDING_NAME* = 0x00008F3A - GL_IMAGE_BINDING_LEVEL* = 0x00008F3B - GL_IMAGE_BINDING_LAYERED* = 0x00008F3C - GL_IMAGE_BINDING_LAYER* = 0x00008F3D - GL_IMAGE_BINDING_ACCESS* = 0x00008F3E - GL_IMAGE_1D* = 0x0000904C - GL_IMAGE_2D* = 0x0000904D - GL_IMAGE_3D* = 0x0000904E - GL_IMAGE_2D_RECT* = 0x0000904F - GL_IMAGE_CUBE* = 0x00009050 - GL_IMAGE_BUFFER* = 0x00009051 - GL_IMAGE_1D_ARRAY* = 0x00009052 - GL_IMAGE_2D_ARRAY* = 0x00009053 - GL_IMAGE_CUBE_MAP_ARRAY* = 0x00009054 - GL_IMAGE_2D_MULTISAMPLE* = 0x00009055 - GL_IMAGE_2D_MULTISAMPLE_ARRAY* = 0x00009056 - GL_INT_IMAGE_1D* = 0x00009057 - GL_INT_IMAGE_2D* = 0x00009058 - GL_INT_IMAGE_3D* = 0x00009059 - GL_INT_IMAGE_2D_RECT* = 0x0000905A - GL_INT_IMAGE_CUBE* = 0x0000905B - GL_INT_IMAGE_BUFFER* = 0x0000905C - GL_INT_IMAGE_1D_ARRAY* = 0x0000905D - GL_INT_IMAGE_2D_ARRAY* = 0x0000905E - GL_INT_IMAGE_CUBE_MAP_ARRAY* = 0x0000905F - GL_INT_IMAGE_2D_MULTISAMPLE* = 0x00009060 - GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY* = 0x00009061 - GL_UNSIGNED_INT_IMAGE_1D* = 0x00009062 - GL_UNSIGNED_INT_IMAGE_2D* = 0x00009063 - GL_UNSIGNED_INT_IMAGE_3D* = 0x00009064 - GL_UNSIGNED_INT_IMAGE_2D_RECT* = 0x00009065 - GL_UNSIGNED_INT_IMAGE_CUBE* = 0x00009066 - GL_UNSIGNED_INT_IMAGE_BUFFER* = 0x00009067 - GL_UNSIGNED_INT_IMAGE_1D_ARRAY* = 0x00009068 - GL_UNSIGNED_INT_IMAGE_2D_ARRAY* = 0x00009069 - GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY* = 0x0000906A - GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE* = 0x0000906B - GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY* = 0x0000906C - GL_MAX_IMAGE_SAMPLES* = 0x0000906D - GL_IMAGE_BINDING_FORMAT* = 0x0000906E - GL_IMAGE_FORMAT_COMPATIBILITYtyp* = 0x000090C7 - GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE* = 0x000090C8 - GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS* = 0x000090C9 - GL_MAX_VERTEX_IMAGE_UNIFORMS* = 0x000090CA - GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS* = 0x000090CB - GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS* = 0x000090CC - GL_MAX_GEOMETRY_IMAGE_UNIFORMS* = 0x000090CD - GL_MAX_FRAGMENT_IMAGE_UNIFORMS* = 0x000090CE - GL_MAX_COMBINED_IMAGE_UNIFORMS* = 0x000090CF # GL_ARB_texture_storage - GL_TEXTURE_IMMUTABLE_FORMAT* = 0x0000912F # GL_ATI_draw_buffers - GL_MAX_DRAW_BUFFERS_ATI* = 0x00008824 - GL_DRAW_BUFFER0_ATI* = 0x00008825 - GL_DRAW_BUFFER1_ATI* = 0x00008826 - GL_DRAW_BUFFER2_ATI* = 0x00008827 - GL_DRAW_BUFFER3_ATI* = 0x00008828 - GL_DRAW_BUFFER4_ATI* = 0x00008829 - GL_DRAW_BUFFER5_ATI* = 0x0000882A - GL_DRAW_BUFFER6_ATI* = 0x0000882B - GL_DRAW_BUFFER7_ATI* = 0x0000882C - GL_DRAW_BUFFER8_ATI* = 0x0000882D - GL_DRAW_BUFFER9_ATI* = 0x0000882E - GL_DRAW_BUFFER10_ATI* = 0x0000882F - GL_DRAW_BUFFER11_ATI* = 0x00008830 - GL_DRAW_BUFFER12_ATI* = 0x00008831 - GL_DRAW_BUFFER13_ATI* = 0x00008832 - GL_DRAW_BUFFER14_ATI* = 0x00008833 - GL_DRAW_BUFFER15_ATI* = 0x00008834 # GL_ATI_element_array - GL_ELEMENT_ARRAY_ATI* = 0x00008768 - GL_ELEMENT_ARRAYtyp_ATI* = 0x00008769 - GL_ELEMENT_ARRAY_POINTER_ATI* = 0x0000876A # GL_ATI_envmap_bumpmap - GL_BUMP_ROT_MATRIX_ATI* = 0x00008775 - GL_BUMP_ROT_MATRIX_SIZE_ATI* = 0x00008776 - GL_BUMP_NUM_TEX_UNITS_ATI* = 0x00008777 - GL_BUMP_TEX_UNITS_ATI* = 0x00008778 - GL_DUDV_ATI* = 0x00008779 - GL_DU8DV8_ATI* = 0x0000877A - GL_BUMP_ENVMAP_ATI* = 0x0000877B - GL_BUMP_TARGET_ATI* = 0x0000877C # GL_ATI_fragment_shader - GL_FRAGMENT_SHADER_ATI* = 0x00008920 - GL_REG_0_ATI* = 0x00008921 - GL_REG_1_ATI* = 0x00008922 - GL_REG_2_ATI* = 0x00008923 - GL_REG_3_ATI* = 0x00008924 - GL_REG_4_ATI* = 0x00008925 - GL_REG_5_ATI* = 0x00008926 - GL_REG_6_ATI* = 0x00008927 - GL_REG_7_ATI* = 0x00008928 - GL_REG_8_ATI* = 0x00008929 - GL_REG_9_ATI* = 0x0000892A - GL_REG_10_ATI* = 0x0000892B - GL_REG_11_ATI* = 0x0000892C - GL_REG_12_ATI* = 0x0000892D - GL_REG_13_ATI* = 0x0000892E - GL_REG_14_ATI* = 0x0000892F - GL_REG_15_ATI* = 0x00008930 - GL_REG_16_ATI* = 0x00008931 - GL_REG_17_ATI* = 0x00008932 - GL_REG_18_ATI* = 0x00008933 - GL_REG_19_ATI* = 0x00008934 - GL_REG_20_ATI* = 0x00008935 - GL_REG_21_ATI* = 0x00008936 - GL_REG_22_ATI* = 0x00008937 - GL_REG_23_ATI* = 0x00008938 - GL_REG_24_ATI* = 0x00008939 - GL_REG_25_ATI* = 0x0000893A - GL_REG_26_ATI* = 0x0000893B - GL_REG_27_ATI* = 0x0000893C - GL_REG_28_ATI* = 0x0000893D - GL_REG_29_ATI* = 0x0000893E - GL_REG_30_ATI* = 0x0000893F - GL_REG_31_ATI* = 0x00008940 - GL_CON_0_ATI* = 0x00008941 - GL_CON_1_ATI* = 0x00008942 - GL_CON_2_ATI* = 0x00008943 - GL_CON_3_ATI* = 0x00008944 - GL_CON_4_ATI* = 0x00008945 - GL_CON_5_ATI* = 0x00008946 - GL_CON_6_ATI* = 0x00008947 - GL_CON_7_ATI* = 0x00008948 - GL_CON_8_ATI* = 0x00008949 - GL_CON_9_ATI* = 0x0000894A - GL_CON_10_ATI* = 0x0000894B - GL_CON_11_ATI* = 0x0000894C - GL_CON_12_ATI* = 0x0000894D - GL_CON_13_ATI* = 0x0000894E - GL_CON_14_ATI* = 0x0000894F - GL_CON_15_ATI* = 0x00008950 - GL_CON_16_ATI* = 0x00008951 - GL_CON_17_ATI* = 0x00008952 - GL_CON_18_ATI* = 0x00008953 - GL_CON_19_ATI* = 0x00008954 - GL_CON_20_ATI* = 0x00008955 - GL_CON_21_ATI* = 0x00008956 - GL_CON_22_ATI* = 0x00008957 - GL_CON_23_ATI* = 0x00008958 - GL_CON_24_ATI* = 0x00008959 - GL_CON_25_ATI* = 0x0000895A - GL_CON_26_ATI* = 0x0000895B - GL_CON_27_ATI* = 0x0000895C - GL_CON_28_ATI* = 0x0000895D - GL_CON_29_ATI* = 0x0000895E - GL_CON_30_ATI* = 0x0000895F - GL_CON_31_ATI* = 0x00008960 - GL_MOV_ATI* = 0x00008961 - GL_ADD_ATI* = 0x00008963 - GL_MUL_ATI* = 0x00008964 - GL_SUB_ATI* = 0x00008965 - GL_DOT3_ATI* = 0x00008966 - GL_DOT4_ATI* = 0x00008967 - GL_MAD_ATI* = 0x00008968 - GL_LERP_ATI* = 0x00008969 - GL_CND_ATI* = 0x0000896A - GL_CND0_ATI* = 0x0000896B - GL_DOT2_ADD_ATI* = 0x0000896C - GL_SECONDARY_INTERPOLATOR_ATI* = 0x0000896D - GL_NUM_FRAGMENT_REGISTERS_ATI* = 0x0000896E - GL_NUM_FRAGMENT_CONSTANTS_ATI* = 0x0000896F - GL_NUM_PASSES_ATI* = 0x00008970 - GL_NUM_INSTRUCTIONS_PER_PASS_ATI* = 0x00008971 - GL_NUM_INSTRUCTIONS_TOTAL_ATI* = 0x00008972 - GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI* = 0x00008973 - GL_NUM_LOOPBACK_COMPONENTS_ATI* = 0x00008974 - GL_COLOR_ALPHA_PAIRING_ATI* = 0x00008975 - GL_SWIZZLE_STR_ATI* = 0x00008976 - GL_SWIZZLE_STQ_ATI* = 0x00008977 - GL_SWIZZLE_STR_DR_ATI* = 0x00008978 - GL_SWIZZLE_STQ_DQ_ATI* = 0x00008979 - GL_SWIZZLE_STRQ_ATI* = 0x0000897A - GL_SWIZZLE_STRQ_DQ_ATI* = 0x0000897B - GL_RED_BIT_ATI* = 0x00000001 - GL_GREEN_BIT_ATI* = 0x00000002 - GL_BLUE_BIT_ATI* = 0x00000004 - GL_2X_BIT_ATI* = 0x00000001 - GL_4X_BIT_ATI* = 0x00000002 - GL_8X_BIT_ATI* = 0x00000004 - GL_HALF_BIT_ATI* = 0x00000008 - GL_QUARTER_BIT_ATI* = 0x00000010 - GL_EIGHTH_BIT_ATI* = 0x00000020 - GL_SATURATE_BIT_ATI* = 0x00000040 - GL_COMP_BIT_ATI* = 0x00000002 - GL_NEGATE_BIT_ATI* = 0x00000004 - GL_BIAS_BIT_ATI* = 0x00000008 # GL_ATI_pn_triangles - GL_PN_TRIANGLES_ATI* = 0x000087F0 - GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI* = 0x000087F1 - GL_PN_TRIANGLES_POINT_MODE_ATI* = 0x000087F2 - GL_PN_TRIANGLES_NORMAL_MODE_ATI* = 0x000087F3 - GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI* = 0x000087F4 - GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI* = 0x000087F5 - GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI* = 0x000087F6 - GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI* = 0x000087F7 - GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI* = 0x000087F8 # - # GL_ATI_separate_stencil - GL_STENCIL_BACK_FUNC_ATI* = 0x00008800 - GL_STENCIL_BACK_FAIL_ATI* = 0x00008801 - GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI* = 0x00008802 - GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI* = 0x00008803 # GL_ATI_text_fragment_shader - GL_TEXT_FRAGMENT_SHADER_ATI* = 0x00008200 # GL_ATI_texture_env_combine3 - GL_MODULATE_ADD_ATI* = 0x00008744 - GL_MODULATE_SIGNED_ADD_ATI* = 0x00008745 - GL_MODULATE_SUBTRACT_ATI* = 0x00008746 # GL_ATI_texture_float - GL_RGBA_FLOAT32_ATI* = 0x00008814 - GL_RGB_FLOAT32_ATI* = 0x00008815 - GL_ALPHA_FLOAT32_ATI* = 0x00008816 - GL_INTENSITY_FLOAT32_ATI* = 0x00008817 - GL_LUMINANCE_FLOAT32_ATI* = 0x00008818 - GL_LUMINANCE_ALPHA_FLOAT32_ATI* = 0x00008819 - GL_RGBA_FLOAT16_ATI* = 0x0000881A - GL_RGB_FLOAT16_ATI* = 0x0000881B - GL_ALPHA_FLOAT16_ATI* = 0x0000881C - GL_INTENSITY_FLOAT16_ATI* = 0x0000881D - GL_LUMINANCE_FLOAT16_ATI* = 0x0000881E - GL_LUMINANCE_ALPHA_FLOAT16_ATI* = 0x0000881F # GL_ATI_texture_mirror_once - GL_MIRROR_CLAMP_ATI* = 0x00008742 - GL_MIRROR_CLAMP_TO_EDGE_ATI* = 0x00008743 # GL_ATI_vertex_array_object - GL_STATIC_ATI* = 0x00008760 - GL_DYNAMIC_ATI* = 0x00008761 - GL_PRESERVE_ATI* = 0x00008762 - GL_DISCARD_ATI* = 0x00008763 - GL_OBJECT_BUFFER_SIZE_ATI* = 0x00008764 - GL_OBJECT_BUFFER_USAGE_ATI* = 0x00008765 - GL_ARRAY_OBJECT_BUFFER_ATI* = 0x00008766 - GL_ARRAY_OBJECT_OFFSET_ATI* = 0x00008767 # GL_ATI_vertex_streams - GL_MAX_VERTEX_STREAMS_ATI* = 0x0000876B - GL_VERTEX_STREAM0_ATI* = 0x0000876C - GL_VERTEX_STREAM1_ATI* = 0x0000876D - GL_VERTEX_STREAM2_ATI* = 0x0000876E - GL_VERTEX_STREAM3_ATI* = 0x0000876F - GL_VERTEX_STREAM4_ATI* = 0x00008770 - GL_VERTEX_STREAM5_ATI* = 0x00008771 - GL_VERTEX_STREAM6_ATI* = 0x00008772 - GL_VERTEX_STREAM7_ATI* = 0x00008773 - GL_VERTEX_SOURCE_ATI* = 0x00008774 # GL_ATI_meminfo - GL_VBO_FREE_MEMORY_ATI* = 0x000087FB - GL_TEXTURE_FREE_MEMORY_ATI* = 0x000087FC - GL_RENDERBUFFER_FREE_MEMORY_ATI* = 0x000087FD # GL_AMD_performance_monitor - GL_COUNTERtyp_AMD* = 0x00008BC0 - GL_COUNTER_RANGE_AMD* = 0x00008BC1 - GL_UNSIGNED_INT64_AMD* = 0x00008BC2 - GL_PERCENTAGE_AMD* = 0x00008BC3 - GL_PERFMON_RESULT_AVAILABLE_AMD* = 0x00008BC4 - GL_PERFMON_RESULT_SIZE_AMD* = 0x00008BC5 - GL_PERFMON_RESULT_AMD* = 0x00008BC6 # GL_AMD_vertex_shader_tesselator - GL_SAMPLER_BUFFER_AMD* = 0x00009001 - GL_INT_SAMPLER_BUFFER_AMD* = 0x00009002 - GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD* = 0x00009003 - cGL_TESSELLATION_MODE_AMD* = 0x00009004 - cGL_TESSELLATION_FACTOR_AMD* = 0x00009005 - GL_DISCRETE_AMD* = 0x00009006 - GL_CONTINUOUS_AMD* = 0x00009007 # GL_AMD_seamless_cubemap_per_texture - # reuse GL_TEXTURE_CUBE_MAP_SEAMLESS - # GL_AMD_name_gen_delete - GL_DATA_BUFFER_AMD* = 0x00009151 - GL_PERFORMANCE_MONITOR_AMD* = 0x00009152 - GL_QUERY_OBJECT_AMD* = 0x00009153 - GL_VERTEX_ARRAY_OBJECT_AMD* = 0x00009154 - GL_SAMPLER_OBJECT_AMD* = 0x00009155 # GL_AMD_debug_output - GL_MAX_DEBUG_LOGGED_MESSAGES_AMD* = 0x00009144 - GL_DEBUG_LOGGED_MESSAGES_AMD* = 0x00009145 - GL_DEBUG_SEVERITY_HIGH_AMD* = 0x00009146 - GL_DEBUG_SEVERITY_MEDIUM_AMD* = 0x00009147 - GL_DEBUG_SEVERITY_LOW_AMD* = 0x00009148 - GL_DEBUG_CATEGORY_API_ERROR_AMD* = 0x00009149 - GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD* = 0x0000914A - GL_DEBUG_CATEGORY_DEPRECATION_AMD* = 0x0000914B - GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD* = 0x0000914C - GL_DEBUG_CATEGORY_PERFORMANCE_AMD* = 0x0000914D - GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD* = 0x0000914E - GL_DEBUG_CATEGORY_APPLICATION_AMD* = 0x0000914F - GL_DEBUG_CATEGORY_OTHER_AMD* = 0x00009150 # GL_AMD_depth_clamp_separate - GL_DEPTH_CLAMP_NEAR_AMD* = 0x0000901E - GL_DEPTH_CLAMP_FAR_AMD* = 0x0000901F # GL_EXT_422_pixels - GL_422_EXT* = 0x000080CC - GL_422_REV_EXT* = 0x000080CD - GL_422_AVERAGE_EXT* = 0x000080CE - GL_422_REV_AVERAGE_EXT* = 0x000080CF # GL_EXT_abgr - GL_ABGR_EXT* = 0x00008000 # GL_EXT_bgra - GL_BGR_EXT* = 0x000080E0 - GL_BGRA_EXT* = 0x000080E1 # GL_EXT_blend_color - GL_CONSTANT_COLOR_EXT* = 0x00008001 - GL_ONE_MINUS_CONSTANT_COLOR_EXT* = 0x00008002 - GL_CONSTANT_ALPHA_EXT* = 0x00008003 - GL_ONE_MINUS_CONSTANT_ALPHA_EXT* = 0x00008004 - cGL_BLEND_COLOR_EXT* = 0x00008005 # GL_EXT_blend_func_separate - GL_BLEND_DST_RGB_EXT* = 0x000080C8 - GL_BLEND_SRC_RGB_EXT* = 0x000080C9 - GL_BLEND_DST_ALPHA_EXT* = 0x000080CA - GL_BLEND_SRC_ALPHA_EXT* = 0x000080CB # GL_EXT_blend_minmax - GL_FUNC_ADD_EXT* = 0x00008006 - GL_MIN_EXT* = 0x00008007 - GL_MAX_EXT* = 0x00008008 - cGL_BLEND_EQUATION_EXT* = 0x00008009 # GL_EXT_blend_subtract - GL_FUNC_SUBTRACT_EXT* = 0x0000800A - GL_FUNC_REVERSE_SUBTRACT_EXT* = 0x0000800B # GL_EXT_clip_volume_hint - GL_CLIP_VOLUME_CLIPPING_HINT_EXT* = 0x000080F0 # GL_EXT_cmyka - GL_CMYK_EXT* = 0x0000800C - GL_CMYKA_EXT* = 0x0000800D - GL_PACK_CMYK_HINT_EXT* = 0x0000800E - GL_UNPACK_CMYK_HINT_EXT* = 0x0000800F # GL_EXT_compiled_vertex_array - GL_ARRAY_ELEMENT_LOCK_FIRST_EXT* = 0x000081A8 - GL_ARRAY_ELEMENT_LOCK_COUNT_EXT* = 0x000081A9 # GL_EXT_convolution - GL_CONVOLUTION_1D_EXT* = 0x00008010 - GL_CONVOLUTION_2D_EXT* = 0x00008011 - GL_SEPARABLE_2D_EXT* = 0x00008012 - GL_CONVOLUTION_BORDER_MODE_EXT* = 0x00008013 - GL_CONVOLUTION_FILTER_SCALE_EXT* = 0x00008014 - GL_CONVOLUTION_FILTER_BIAS_EXT* = 0x00008015 - GL_REDUCE_EXT* = 0x00008016 - GL_CONVOLUTION_FORMAT_EXT* = 0x00008017 - GL_CONVOLUTION_WIDTH_EXT* = 0x00008018 - GL_CONVOLUTION_HEIGHT_EXT* = 0x00008019 - GL_MAX_CONVOLUTION_WIDTH_EXT* = 0x0000801A - GL_MAX_CONVOLUTION_HEIGHT_EXT* = 0x0000801B - GL_POST_CONVOLUTION_RED_SCALE_EXT* = 0x0000801C - GL_POST_CONVOLUTION_GREEN_SCALE_EXT* = 0x0000801D - GL_POST_CONVOLUTION_BLUE_SCALE_EXT* = 0x0000801E - GL_POST_CONVOLUTION_ALPHA_SCALE_EXT* = 0x0000801F - GL_POST_CONVOLUTION_RED_BIAS_EXT* = 0x00008020 - GL_POST_CONVOLUTION_GREEN_BIAS_EXT* = 0x00008021 - GL_POST_CONVOLUTION_BLUE_BIAS_EXT* = 0x00008022 - GL_POST_CONVOLUTION_ALPHA_BIAS_EXT* = 0x00008023 # GL_EXT_coordinate_frame - GL_TANGENT_ARRAY_EXT* = 0x00008439 - GL_BINORMAL_ARRAY_EXT* = 0x0000843A - GL_CURRENT_TANGENT_EXT* = 0x0000843B - GL_CURRENT_BINORMAL_EXT* = 0x0000843C - GL_TANGENT_ARRAYtyp_EXT* = 0x0000843E - GL_TANGENT_ARRAY_STRIDE_EXT* = 0x0000843F - GL_BINORMAL_ARRAYtyp_EXT* = 0x00008440 - GL_BINORMAL_ARRAY_STRIDE_EXT* = 0x00008441 - GL_TANGENT_ARRAY_POINTER_EXT* = 0x00008442 - GL_BINORMAL_ARRAY_POINTER_EXT* = 0x00008443 - GL_MAP1_TANGENT_EXT* = 0x00008444 - GL_MAP2_TANGENT_EXT* = 0x00008445 - GL_MAP1_BINORMAL_EXT* = 0x00008446 - GL_MAP2_BINORMAL_EXT* = 0x00008447 # GL_EXT_cull_vertex - GL_CULL_VERTEX_EXT* = 0x000081AA - GL_CULL_VERTEX_EYE_POSITION_EXT* = 0x000081AB - GL_CULL_VERTEX_OBJECT_POSITION_EXT* = 0x000081AC # GL_EXT_draw_range_elements - GL_MAX_ELEMENTS_VERTICES_EXT* = 0x000080E8 - GL_MAX_ELEMENTS_INDICES_EXT* = 0x000080E9 # GL_EXT_fog_coord - GL_FOG_COORDINATE_SOURCE_EXT* = 0x00008450 - GL_FOG_COORDINATE_EXT* = 0x00008451 - GL_FRAGMENT_DEPTH_EXT* = 0x00008452 - GL_CURRENT_FOG_COORDINATE_EXT* = 0x00008453 - GL_FOG_COORDINATE_ARRAYtyp_EXT* = 0x00008454 - GL_FOG_COORDINATE_ARRAY_STRIDE_EXT* = 0x00008455 - GL_FOG_COORDINATE_ARRAY_POINTER_EXT* = 0x00008456 - GL_FOG_COORDINATE_ARRAY_EXT* = 0x00008457 # GL_EXT_framebuffer_object - GL_FRAMEBUFFER_EXT* = 0x00008D40 - GL_RENDERBUFFER_EXT* = 0x00008D41 - GL_STENCIL_INDEX_EXT* = 0x00008D45 - GL_STENCIL_INDEX1_EXT* = 0x00008D46 - GL_STENCIL_INDEX4_EXT* = 0x00008D47 - GL_STENCIL_INDEX8_EXT* = 0x00008D48 - GL_STENCIL_INDEX16_EXT* = 0x00008D49 - GL_RENDERBUFFER_WIDTH_EXT* = 0x00008D42 - GL_RENDERBUFFER_HEIGHT_EXT* = 0x00008D43 - GL_RENDERBUFFER_INTERNAL_FORMAT_EXT* = 0x00008D44 - GL_FRAMEBUFFER_ATTACHMENT_OBJECTtyp_EXT* = 0x00008CD0 - GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT* = 0x00008CD1 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT* = 0x00008CD2 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT* = 0x00008CD3 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT* = 0x00008CD4 - GL_COLOR_ATTACHMENT0_EXT* = 0x00008CE0 - GL_COLOR_ATTACHMENT1_EXT* = 0x00008CE1 - GL_COLOR_ATTACHMENT2_EXT* = 0x00008CE2 - GL_COLOR_ATTACHMENT3_EXT* = 0x00008CE3 - GL_COLOR_ATTACHMENT4_EXT* = 0x00008CE4 - GL_COLOR_ATTACHMENT5_EXT* = 0x00008CE5 - GL_COLOR_ATTACHMENT6_EXT* = 0x00008CE6 - GL_COLOR_ATTACHMENT7_EXT* = 0x00008CE7 - GL_COLOR_ATTACHMENT8_EXT* = 0x00008CE8 - GL_COLOR_ATTACHMENT9_EXT* = 0x00008CE9 - GL_COLOR_ATTACHMENT10_EXT* = 0x00008CEA - GL_COLOR_ATTACHMENT11_EXT* = 0x00008CEB - GL_COLOR_ATTACHMENT12_EXT* = 0x00008CEC - GL_COLOR_ATTACHMENT13_EXT* = 0x00008CED - GL_COLOR_ATTACHMENT14_EXT* = 0x00008CEE - GL_COLOR_ATTACHMENT15_EXT* = 0x00008CEF - GL_DEPTH_ATTACHMENT_EXT* = 0x00008D00 - GL_STENCIL_ATTACHMENT_EXT* = 0x00008D20 - GL_FRAMEBUFFER_COMPLETE_EXT* = 0x00008CD5 - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT* = 0x00008CD6 - GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT* = 0x00008CD7 - GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT* = 0x00008CD8 - GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT* = 0x00008CD9 - GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT* = 0x00008CDA - GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT* = 0x00008CDB - GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT* = 0x00008CDC - GL_FRAMEBUFFER_UNSUPPORTED_EXT* = 0x00008CDD - GL_FRAMEBUFFER_STATUS_ERROR_EXT* = 0x00008CDE - GL_FRAMEBUFFER_BINDING_EXT* = 0x00008CA6 - GL_RENDERBUFFER_BINDING_EXT* = 0x00008CA7 - GL_MAX_COLOR_ATTACHMENTS_EXT* = 0x00008CDF - GL_MAX_RENDERBUFFER_SIZE_EXT* = 0x000084E8 - GL_INVALID_FRAMEBUFFER_OPERATION_EXT* = 0x00000506 # GL_EXT_histogram - cGL_HISTOGRAM_EXT* = 0x00008024 - GL_PROXY_HISTOGRAM_EXT* = 0x00008025 - GL_HISTOGRAM_WIDTH_EXT* = 0x00008026 - GL_HISTOGRAM_FORMAT_EXT* = 0x00008027 - GL_HISTOGRAM_RED_SIZE_EXT* = 0x00008028 - GL_HISTOGRAM_GREEN_SIZE_EXT* = 0x00008029 - GL_HISTOGRAM_BLUE_SIZE_EXT* = 0x0000802A - GL_HISTOGRAM_ALPHA_SIZE_EXT* = 0x0000802B - GL_HISTOGRAM_LUMINANCE_SIZE_EXT* = 0x0000802C - GL_HISTOGRAM_SINK_EXT* = 0x0000802D - cGL_MINMAX_EXT* = 0x0000802E - GL_MINMAX_FORMAT_EXT* = 0x0000802F - GL_MINMAX_SINK_EXT* = 0x00008030 - GL_TABLE_TOO_LARGE_EXT* = 0x00008031 # GL_EXT_index_array_formats - GL_IUI_V2F_EXT* = 0x000081AD - GL_IUI_V3F_EXT* = 0x000081AE - GL_IUI_N3F_V2F_EXT* = 0x000081AF - GL_IUI_N3F_V3F_EXT* = 0x000081B0 - GL_T2F_IUI_V2F_EXT* = 0x000081B1 - GL_T2F_IUI_V3F_EXT* = 0x000081B2 - GL_T2F_IUI_N3F_V2F_EXT* = 0x000081B3 - GL_T2F_IUI_N3F_V3F_EXT* = 0x000081B4 # GL_EXT_index_func - GL_INDEX_TEST_EXT* = 0x000081B5 - GL_INDEX_TEST_FUNC_EXT* = 0x000081B6 - GL_INDEX_TEST_REF_EXT* = 0x000081B7 # GL_EXT_index_material - cGL_INDEX_MATERIAL_EXT* = 0x000081B8 - GL_INDEX_MATERIAL_PARAMETER_EXT* = 0x000081B9 - GL_INDEX_MATERIAL_FACE_EXT* = 0x000081BA # GL_EXT_light_texture - GL_FRAGMENT_MATERIAL_EXT* = 0x00008349 - GL_FRAGMENT_NORMAL_EXT* = 0x0000834A - GL_FRAGMENT_COLOR_EXT* = 0x0000834C - GL_ATTENUATION_EXT* = 0x0000834D - GL_SHADOW_ATTENUATION_EXT* = 0x0000834E - GL_TEXTURE_APPLICATION_MODE_EXT* = 0x0000834F - cGL_TEXTURE_LIGHT_EXT* = 0x00008350 - GL_TEXTURE_MATERIAL_FACE_EXT* = 0x00008351 - GL_TEXTURE_MATERIAL_PARAMETER_EXT* = 0x00008352 # GL_EXT_multisample - GL_MULTISAMPLE_EXT* = 0x0000809D - GL_SAMPLE_ALPHA_TO_MASK_EXT* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE_EXT* = 0x0000809F - cGL_SAMPLE_MASK_EXT* = 0x000080A0 - GL_1PASS_EXT* = 0x000080A1 - GL_2PASS_0_EXT* = 0x000080A2 - GL_2PASS_1_EXT* = 0x000080A3 - GL_4PASS_0_EXT* = 0x000080A4 - GL_4PASS_1_EXT* = 0x000080A5 - GL_4PASS_2_EXT* = 0x000080A6 - GL_4PASS_3_EXT* = 0x000080A7 - GL_SAMPLE_BUFFERS_EXT* = 0x000080A8 - GL_SAMPLES_EXT* = 0x000080A9 - GL_SAMPLE_MASK_VALUE_EXT* = 0x000080AA - GL_SAMPLE_MASK_INVERT_EXT* = 0x000080AB - cGL_SAMPLE_PATTERN_EXT* = 0x000080AC - GL_MULTISAMPLE_BIT_EXT* = 0x20000000 # GL_EXT_packed_pixels - GL_UNSIGNED_BYTE_3_3_2_EXT* = 0x00008032 - GL_UNSIGNED_SHORT_4_4_4_4_EXT* = 0x00008033 - GL_UNSIGNED_SHORT_5_5_5_1_EXT* = 0x00008034 - GL_UNSIGNED_INT_8_8_8_8_EXT* = 0x00008035 - GL_UNSIGNED_INT_10_10_10_2_EXT* = 0x00008036 # GL_EXT_paletted_texture - GL_COLOR_INDEX1_EXT* = 0x000080E2 - GL_COLOR_INDEX2_EXT* = 0x000080E3 - GL_COLOR_INDEX4_EXT* = 0x000080E4 - GL_COLOR_INDEX8_EXT* = 0x000080E5 - GL_COLOR_INDEX12_EXT* = 0x000080E6 - GL_COLOR_INDEX16_EXT* = 0x000080E7 - GL_TEXTURE_INDEX_SIZE_EXT* = 0x000080ED # GL_EXT_pixel_transform - GL_PIXEL_TRANSFORM_2D_EXT* = 0x00008330 - GL_PIXEL_MAG_FILTER_EXT* = 0x00008331 - GL_PIXEL_MIN_FILTER_EXT* = 0x00008332 - GL_PIXEL_CUBIC_WEIGHT_EXT* = 0x00008333 - GL_CUBIC_EXT* = 0x00008334 - GL_AVERAGE_EXT* = 0x00008335 - GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT* = 0x00008336 - GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT* = 0x00008337 - GL_PIXEL_TRANSFORM_2D_MATRIX_EXT* = 0x00008338 # GL_EXT_point_parameters - GL_POINT_SIZE_MIN_EXT* = 0x00008126 - GL_POINT_SIZE_MAX_EXT* = 0x00008127 - GL_POINT_FADE_THRESHOLD_SIZE_EXT* = 0x00008128 - GL_DISTANCE_ATTENUATION_EXT* = 0x00008129 # GL_EXT_polygon_offset - cGL_POLYGON_OFFSET_EXT* = 0x00008037 - GL_POLYGON_OFFSET_FACTOR_EXT* = 0x00008038 - GL_POLYGON_OFFSET_BIAS_EXT* = 0x00008039 # GL_EXT_rescale_normal - GL_RESCALE_NORMAL_EXT* = 0x0000803A # GL_EXT_secondary_color - GL_COLOR_SUM_EXT* = 0x00008458 - GL_CURRENT_SECONDARY_COLOR_EXT* = 0x00008459 - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT* = 0x0000845A - GL_SECONDARY_COLOR_ARRAYtyp_EXT* = 0x0000845B - GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT* = 0x0000845C - GL_SECONDARY_COLOR_ARRAY_POINTER_EXT* = 0x0000845D - GL_SECONDARY_COLOR_ARRAY_EXT* = 0x0000845E # GL_EXT_separate_specular_color - GL_LIGHT_MODEL_COLOR_CONTROL_EXT* = 0x000081F8 - GL_SINGLE_COLOR_EXT* = 0x000081F9 - GL_SEPARATE_SPECULAR_COLOR_EXT* = 0x000081FA # GL_EXT_shared_texture_palette - GL_SHARED_TEXTURE_PALETTE_EXT* = 0x000081FB # GL_EXT_stencil_two_side - GL_STENCIL_TEST_TWO_SIDE_EXT* = 0x00008910 - cGL_ACTIVE_STENCIL_FACE_EXT* = 0x00008911 # GL_EXT_stencil_wrap - GL_INCR_WRAP_EXT* = 0x00008507 - GL_DECR_WRAP_EXT* = 0x00008508 # GL_EXT_texture - GL_ALPHA4_EXT* = 0x0000803B - GL_ALPHA8_EXT* = 0x0000803C - GL_ALPHA12_EXT* = 0x0000803D - GL_ALPHA16_EXT* = 0x0000803E - GL_LUMINANCE4_EXT* = 0x0000803F - GL_LUMINANCE8_EXT* = 0x00008040 - GL_LUMINANCE12_EXT* = 0x00008041 - GL_LUMINANCE16_EXT* = 0x00008042 - GL_LUMINANCE4_ALPHA4_EXT* = 0x00008043 - GL_LUMINANCE6_ALPHA2_EXT* = 0x00008044 - GL_LUMINANCE8_ALPHA8_EXT* = 0x00008045 - GL_LUMINANCE12_ALPHA4_EXT* = 0x00008046 - GL_LUMINANCE12_ALPHA12_EXT* = 0x00008047 - GL_LUMINANCE16_ALPHA16_EXT* = 0x00008048 - GL_INTENSITY_EXT* = 0x00008049 - GL_INTENSITY4_EXT* = 0x0000804A - GL_INTENSITY8_EXT* = 0x0000804B - GL_INTENSITY12_EXT* = 0x0000804C - GL_INTENSITY16_EXT* = 0x0000804D - GL_RGB2_EXT* = 0x0000804E - GL_RGB4_EXT* = 0x0000804F - GL_RGB5_EXT* = 0x00008050 - GL_RGB8_EXT* = 0x00008051 - GL_RGB10_EXT* = 0x00008052 - GL_RGB12_EXT* = 0x00008053 - GL_RGB16_EXT* = 0x00008054 - GL_RGBA2_EXT* = 0x00008055 - GL_RGBA4_EXT* = 0x00008056 - GL_RGB5_A1_EXT* = 0x00008057 - GL_RGBA8_EXT* = 0x00008058 - GL_RGB10_A2_EXT* = 0x00008059 - GL_RGBA12_EXT* = 0x0000805A - GL_RGBA16_EXT* = 0x0000805B - GL_TEXTURE_RED_SIZE_EXT* = 0x0000805C - GL_TEXTURE_GREEN_SIZE_EXT* = 0x0000805D - GL_TEXTURE_BLUE_SIZE_EXT* = 0x0000805E - GL_TEXTURE_ALPHA_SIZE_EXT* = 0x0000805F - GL_TEXTURE_LUMINANCE_SIZE_EXT* = 0x00008060 - GL_TEXTURE_INTENSITY_SIZE_EXT* = 0x00008061 - GL_REPLACE_EXT* = 0x00008062 - GL_PROXY_TEXTURE_1D_EXT* = 0x00008063 - GL_PROXY_TEXTURE_2D_EXT* = 0x00008064 - GL_TEXTURE_TOO_LARGE_EXT* = 0x00008065 # GL_EXT_texture3D - GL_PACK_SKIP_IMAGES_EXT* = 0x0000806B - GL_PACK_IMAGE_HEIGHT_EXT* = 0x0000806C - GL_UNPACK_SKIP_IMAGES_EXT* = 0x0000806D - GL_UNPACK_IMAGE_HEIGHT_EXT* = 0x0000806E - GL_TEXTURE_3D_EXT* = 0x0000806F - GL_PROXY_TEXTURE_3D_EXT* = 0x00008070 - GL_TEXTURE_DEPTH_EXT* = 0x00008071 - GL_TEXTURE_WRAP_R_EXT* = 0x00008072 - GL_MAX_3D_TEXTURE_SIZE_EXT* = 0x00008073 # GL_EXT_texture_compression_s3tc - GL_COMPRESSED_RGB_S3TC_DXT1_EXT* = 0x000083F0 - GL_COMPRESSED_RGBA_S3TC_DXT1_EXT* = 0x000083F1 - GL_COMPRESSED_RGBA_S3TC_DXT3_EXT* = 0x000083F2 - GL_COMPRESSED_RGBA_S3TC_DXT5_EXT* = 0x000083F3 # GL_EXT_texture_cube_map - GL_NORMAL_MAP_EXT* = 0x00008511 - GL_REFLECTION_MAP_EXT* = 0x00008512 - GL_TEXTURE_CUBE_MAP_EXT* = 0x00008513 - GL_TEXTURE_BINDING_CUBE_MAP_EXT* = 0x00008514 - GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT* = 0x00008515 - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT* = 0x00008516 - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT* = 0x00008517 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT* = 0x00008518 - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT* = 0x00008519 - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT* = 0x0000851A - GL_PROXY_TEXTURE_CUBE_MAP_EXT* = 0x0000851B - GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT* = 0x0000851C # GL_EXT_texture_edge_clamp - GL_CLAMP_TO_EDGE_EXT* = 0x0000812F # GL_EXT_texture_env_combine - GL_COMBINE_EXT* = 0x00008570 - GL_COMBINE_RGB_EXT* = 0x00008571 - GL_COMBINE_ALPHA_EXT* = 0x00008572 - GL_RGB_SCALE_EXT* = 0x00008573 - GL_ADD_SIGNED_EXT* = 0x00008574 - GL_INTERPOLATE_EXT* = 0x00008575 - GL_CONSTANT_EXT* = 0x00008576 - GL_PRIMARY_COLOR_EXT* = 0x00008577 - GL_PREVIOUS_EXT* = 0x00008578 - GL_SOURCE0_RGB_EXT* = 0x00008580 - GL_SOURCE1_RGB_EXT* = 0x00008581 - GL_SOURCE2_RGB_EXT* = 0x00008582 - GL_SOURCE0_ALPHA_EXT* = 0x00008588 - GL_SOURCE1_ALPHA_EXT* = 0x00008589 - GL_SOURCE2_ALPHA_EXT* = 0x0000858A - GL_OPERAND0_RGB_EXT* = 0x00008590 - GL_OPERAND1_RGB_EXT* = 0x00008591 - GL_OPERAND2_RGB_EXT* = 0x00008592 - GL_OPERAND0_ALPHA_EXT* = 0x00008598 - GL_OPERAND1_ALPHA_EXT* = 0x00008599 - GL_OPERAND2_ALPHA_EXT* = 0x0000859A # GL_EXT_texture_env_dot3 - GL_DOT3_RGB_EXT* = 0x00008740 - GL_DOT3_RGBA_EXT* = 0x00008741 # GL_EXT_texture_filter_anisotropic - GL_TEXTURE_MAX_ANISOTROPY_EXT* = 0x000084FE - GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT* = 0x000084FF # GL_EXT_texture_lod_bias - GL_MAX_TEXTURE_LOD_BIAS_EXT* = 0x000084FD - GL_TEXTURE_FILTER_CONTROL_EXT* = 0x00008500 - GL_TEXTURE_LOD_BIAS_EXT* = 0x00008501 # GL_EXT_texture_object - GL_TEXTURE_PRIORITY_EXT* = 0x00008066 - GL_TEXTURE_RESIDENT_EXT* = 0x00008067 - GL_TEXTURE_1D_BINDING_EXT* = 0x00008068 - GL_TEXTURE_2D_BINDING_EXT* = 0x00008069 - GL_TEXTURE_3D_BINDING_EXT* = 0x0000806A # GL_EXT_texture_perturb_normal - GL_PERTURB_EXT* = 0x000085AE - cGL_TEXTURE_NORMAL_EXT* = 0x000085AF # GL_EXT_texture_rectangle - GL_TEXTURE_RECTANGLE_EXT* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE_EXT* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE_EXT* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT* = 0x000084F8 # GL_EXT_vertex_array - GL_VERTEX_ARRAY_EXT* = 0x00008074 - GL_NORMAL_ARRAY_EXT* = 0x00008075 - GL_COLOR_ARRAY_EXT* = 0x00008076 - GL_INDEX_ARRAY_EXT* = 0x00008077 - GL_TEXTURE_COORD_ARRAY_EXT* = 0x00008078 - GL_EDGE_FLAG_ARRAY_EXT* = 0x00008079 - GL_VERTEX_ARRAY_SIZE_EXT* = 0x0000807A - GL_VERTEX_ARRAYtyp_EXT* = 0x0000807B - GL_VERTEX_ARRAY_STRIDE_EXT* = 0x0000807C - GL_VERTEX_ARRAY_COUNT_EXT* = 0x0000807D - GL_NORMAL_ARRAYtyp_EXT* = 0x0000807E - GL_NORMAL_ARRAY_STRIDE_EXT* = 0x0000807F - GL_NORMAL_ARRAY_COUNT_EXT* = 0x00008080 - GL_COLOR_ARRAY_SIZE_EXT* = 0x00008081 - GL_COLOR_ARRAYtyp_EXT* = 0x00008082 - GL_COLOR_ARRAY_STRIDE_EXT* = 0x00008083 - GL_COLOR_ARRAY_COUNT_EXT* = 0x00008084 - GL_INDEX_ARRAYtyp_EXT* = 0x00008085 - GL_INDEX_ARRAY_STRIDE_EXT* = 0x00008086 - GL_INDEX_ARRAY_COUNT_EXT* = 0x00008087 - GL_TEXTURE_COORD_ARRAY_SIZE_EXT* = 0x00008088 - GL_TEXTURE_COORD_ARRAYtyp_EXT* = 0x00008089 - GL_TEXTURE_COORD_ARRAY_STRIDE_EXT* = 0x0000808A - GL_TEXTURE_COORD_ARRAY_COUNT_EXT* = 0x0000808B - GL_EDGE_FLAG_ARRAY_STRIDE_EXT* = 0x0000808C - GL_EDGE_FLAG_ARRAY_COUNT_EXT* = 0x0000808D - GL_VERTEX_ARRAY_POINTER_EXT* = 0x0000808E - GL_NORMAL_ARRAY_POINTER_EXT* = 0x0000808F - GL_COLOR_ARRAY_POINTER_EXT* = 0x00008090 - GL_INDEX_ARRAY_POINTER_EXT* = 0x00008091 - GL_TEXTURE_COORD_ARRAY_POINTER_EXT* = 0x00008092 - GL_EDGE_FLAG_ARRAY_POINTER_EXT* = 0x00008093 # GL_EXT_vertex_shader - GL_VERTEX_SHADER_EXT* = 0x00008780 - GL_VERTEX_SHADER_BINDING_EXT* = 0x00008781 - GL_OP_INDEX_EXT* = 0x00008782 - GL_OP_NEGATE_EXT* = 0x00008783 - GL_OP_DOT3_EXT* = 0x00008784 - GL_OP_DOT4_EXT* = 0x00008785 - GL_OP_MUL_EXT* = 0x00008786 - GL_OP_ADD_EXT* = 0x00008787 - GL_OP_MADD_EXT* = 0x00008788 - GL_OP_FRAC_EXT* = 0x00008789 - GL_OP_MAX_EXT* = 0x0000878A - GL_OP_MIN_EXT* = 0x0000878B - GL_OP_SET_GE_EXT* = 0x0000878C - GL_OP_SET_LT_EXT* = 0x0000878D - GL_OP_CLAMP_EXT* = 0x0000878E - GL_OP_FLOOR_EXT* = 0x0000878F - GL_OP_ROUND_EXT* = 0x00008790 - GL_OP_EXP_BASE_2_EXT* = 0x00008791 - GL_OP_LOG_BASE_2_EXT* = 0x00008792 - GL_OP_POWER_EXT* = 0x00008793 - GL_OP_RECIP_EXT* = 0x00008794 - GL_OP_RECIP_SQRT_EXT* = 0x00008795 - GL_OP_SUB_EXT* = 0x00008796 - GL_OP_CROSS_PRODUCT_EXT* = 0x00008797 - GL_OP_MULTIPLY_MATRIX_EXT* = 0x00008798 - GL_OP_MOV_EXT* = 0x00008799 - GL_OUTPUT_VERTEX_EXT* = 0x0000879A - GL_OUTPUT_COLOR0_EXT* = 0x0000879B - GL_OUTPUT_COLOR1_EXT* = 0x0000879C - GL_OUTPUT_TEXTURE_COORD0_EXT* = 0x0000879D - GL_OUTPUT_TEXTURE_COORD1_EXT* = 0x0000879E - GL_OUTPUT_TEXTURE_COORD2_EXT* = 0x0000879F - GL_OUTPUT_TEXTURE_COORD3_EXT* = 0x000087A0 - GL_OUTPUT_TEXTURE_COORD4_EXT* = 0x000087A1 - GL_OUTPUT_TEXTURE_COORD5_EXT* = 0x000087A2 - GL_OUTPUT_TEXTURE_COORD6_EXT* = 0x000087A3 - GL_OUTPUT_TEXTURE_COORD7_EXT* = 0x000087A4 - GL_OUTPUT_TEXTURE_COORD8_EXT* = 0x000087A5 - GL_OUTPUT_TEXTURE_COORD9_EXT* = 0x000087A6 - GL_OUTPUT_TEXTURE_COORD10_EXT* = 0x000087A7 - GL_OUTPUT_TEXTURE_COORD11_EXT* = 0x000087A8 - GL_OUTPUT_TEXTURE_COORD12_EXT* = 0x000087A9 - GL_OUTPUT_TEXTURE_COORD13_EXT* = 0x000087AA - GL_OUTPUT_TEXTURE_COORD14_EXT* = 0x000087AB - GL_OUTPUT_TEXTURE_COORD15_EXT* = 0x000087AC - GL_OUTPUT_TEXTURE_COORD16_EXT* = 0x000087AD - GL_OUTPUT_TEXTURE_COORD17_EXT* = 0x000087AE - GL_OUTPUT_TEXTURE_COORD18_EXT* = 0x000087AF - GL_OUTPUT_TEXTURE_COORD19_EXT* = 0x000087B0 - GL_OUTPUT_TEXTURE_COORD20_EXT* = 0x000087B1 - GL_OUTPUT_TEXTURE_COORD21_EXT* = 0x000087B2 - GL_OUTPUT_TEXTURE_COORD22_EXT* = 0x000087B3 - GL_OUTPUT_TEXTURE_COORD23_EXT* = 0x000087B4 - GL_OUTPUT_TEXTURE_COORD24_EXT* = 0x000087B5 - GL_OUTPUT_TEXTURE_COORD25_EXT* = 0x000087B6 - GL_OUTPUT_TEXTURE_COORD26_EXT* = 0x000087B7 - GL_OUTPUT_TEXTURE_COORD27_EXT* = 0x000087B8 - GL_OUTPUT_TEXTURE_COORD28_EXT* = 0x000087B9 - GL_OUTPUT_TEXTURE_COORD29_EXT* = 0x000087BA - GL_OUTPUT_TEXTURE_COORD30_EXT* = 0x000087BB - GL_OUTPUT_TEXTURE_COORD31_EXT* = 0x000087BC - GL_OUTPUT_FOG_EXT* = 0x000087BD - GL_SCALAR_EXT* = 0x000087BE - GL_VECTOR_EXT* = 0x000087BF - GL_MATRIX_EXT* = 0x000087C0 - GL_VARIANT_EXT* = 0x000087C1 - GL_INVARIANT_EXT* = 0x000087C2 - GL_LOCAL_CONSTANT_EXT* = 0x000087C3 - GL_LOCAL_EXT* = 0x000087C4 - GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT* = 0x000087C5 - GL_MAX_VERTEX_SHADER_VARIANTS_EXT* = 0x000087C6 - GL_MAX_VERTEX_SHADER_INVARIANTS_EXT* = 0x000087C7 - GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT* = 0x000087C8 - GL_MAX_VERTEX_SHADER_LOCALS_EXT* = 0x000087C9 - GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT* = 0x000087CA - GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT* = 0x000087CB - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT* = 0x000087CC - GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT* = 0x000087CD - GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT* = 0x000087CE - GL_VERTEX_SHADER_INSTRUCTIONS_EXT* = 0x000087CF - GL_VERTEX_SHADER_VARIANTS_EXT* = 0x000087D0 - GL_VERTEX_SHADER_INVARIANTS_EXT* = 0x000087D1 - GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT* = 0x000087D2 - GL_VERTEX_SHADER_LOCALS_EXT* = 0x000087D3 - GL_VERTEX_SHADER_OPTIMIZED_EXT* = 0x000087D4 - GL_X_EXT* = 0x000087D5 - GL_Y_EXT* = 0x000087D6 - GL_Z_EXT* = 0x000087D7 - GL_W_EXT* = 0x000087D8 - GL_NEGATIVE_X_EXT* = 0x000087D9 - GL_NEGATIVE_Y_EXT* = 0x000087DA - GL_NEGATIVE_Z_EXT* = 0x000087DB - GL_NEGATIVE_W_EXT* = 0x000087DC - GL_ZERO_EXT* = 0x000087DD - GL_ONE_EXT* = 0x000087DE - GL_NEGATIVE_ONE_EXT* = 0x000087DF - GL_NORMALIZED_RANGE_EXT* = 0x000087E0 - GL_FULL_RANGE_EXT* = 0x000087E1 - GL_CURRENT_VERTEX_EXT* = 0x000087E2 - GL_MVP_MATRIX_EXT* = 0x000087E3 - GL_VARIANT_VALUE_EXT* = 0x000087E4 - GL_VARIANT_DATAtypEXT* = 0x000087E5 - GL_VARIANT_ARRAY_STRIDE_EXT* = 0x000087E6 - GL_VARIANT_ARRAYtyp_EXT* = 0x000087E7 - GL_VARIANT_ARRAY_EXT* = 0x000087E8 - GL_VARIANT_ARRAY_POINTER_EXT* = 0x000087E9 - GL_INVARIANT_VALUE_EXT* = 0x000087EA - GL_INVARIANT_DATAtypEXT* = 0x000087EB - GL_LOCAL_CONSTANT_VALUE_EXT* = 0x000087EC - GL_LOCAL_CONSTANT_DATAtypEXT* = 0x000087ED # GL_EXT_vertex_weighting - GL_MODELVIEW0_STACK_DEPTH_EXT* = 0x00000BA3 - GL_MODELVIEW1_STACK_DEPTH_EXT* = 0x00008502 - GL_MODELVIEW0_MATRIX_EXT* = 0x00000BA6 - GL_MODELVIEW1_MATRIX_EXT* = 0x00008506 - GL_VERTEX_WEIGHTING_EXT* = 0x00008509 - GL_MODELVIEW0_EXT* = 0x00001700 - GL_MODELVIEW1_EXT* = 0x0000850A - GL_CURRENT_VERTEX_WEIGHT_EXT* = 0x0000850B - GL_VERTEX_WEIGHT_ARRAY_EXT* = 0x0000850C - GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT* = 0x0000850D - GL_VERTEX_WEIGHT_ARRAYtyp_EXT* = 0x0000850E - GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT* = 0x0000850F - GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT* = 0x00008510 # GL_EXT_depth_bounds_test - GL_DEPTH_BOUNDS_TEST_EXT* = 0x00008890 - cGL_DEPTH_BOUNDS_EXT* = 0x00008891 # GL_EXT_texture_mirror_clamp - GL_MIRROR_CLAMP_EXT* = 0x00008742 - GL_MIRROR_CLAMP_TO_EDGE_EXT* = 0x00008743 - GL_MIRROR_CLAMP_TO_BORDER_EXT* = 0x00008912 # GL_EXT_blend_equation_separate - GL_BLEND_EQUATION_RGB_EXT* = 0x00008009 - GL_BLEND_EQUATION_ALPHA_EXT* = 0x0000883D # GL_EXT_pixel_buffer_object - GL_PIXEL_PACK_BUFFER_EXT* = 0x000088EB - GL_PIXEL_UNPACK_BUFFER_EXT* = 0x000088EC - GL_PIXEL_PACK_BUFFER_BINDING_EXT* = 0x000088ED - GL_PIXEL_UNPACK_BUFFER_BINDING_EXT* = 0x000088EF # GL_EXT_stencil_clear_tag - GL_STENCIL_TAG_BITS_EXT* = 0x000088F2 - GL_STENCIL_CLEAR_TAG_VALUE_EXT* = 0x000088F3 # GL_EXT_packed_depth_stencil - GL_DEPTH_STENCIL_EXT* = 0x000084F9 - GL_UNSIGNED_INT_24_8_EXT* = 0x000084FA - GL_DEPTH24_STENCIL8_EXT* = 0x000088F0 - GL_TEXTURE_STENCIL_SIZE_EXT* = 0x000088F1 # GL_EXT_texture_sRGB - GL_SRGB_EXT* = 0x00008C40 - GL_SRGB8_EXT* = 0x00008C41 - GL_SRGB_ALPHA_EXT* = 0x00008C42 - GL_SRGB8_ALPHA8_EXT* = 0x00008C43 - GL_SLUMINANCE_ALPHA_EXT* = 0x00008C44 - GL_SLUMINANCE8_ALPHA8_EXT* = 0x00008C45 - GL_SLUMINANCE_EXT* = 0x00008C46 - GL_SLUMINANCE8_EXT* = 0x00008C47 - GL_COMPRESSED_SRGB_EXT* = 0x00008C48 - GL_COMPRESSED_SRGB_ALPHA_EXT* = 0x00008C49 - GL_COMPRESSED_SLUMINANCE_EXT* = 0x00008C4A - GL_COMPRESSED_SLUMINANCE_ALPHA_EXT* = 0x00008C4B - GL_COMPRESSED_SRGB_S3TC_DXT1_EXT* = 0x00008C4C - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT* = 0x00008C4D - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT* = 0x00008C4E - GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT* = 0x00008C4F # GL_EXT_framebuffer_blit - GL_READ_FRAMEBUFFER_EXT* = 0x00008CA8 - GL_DRAW_FRAMEBUFFER_EXT* = 0x00008CA9 - GL_READ_FRAMEBUFFER_BINDING_EXT* = GL_FRAMEBUFFER_BINDING_EXT - GL_DRAW_FRAMEBUFFER_BINDING_EXT* = 0x00008CAA # GL_EXT_framebuffer_multisample - GL_RENDERBUFFER_SAMPLES_EXT* = 0x00008CAB - GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT* = 0x00008D56 - GL_MAX_SAMPLES_EXT* = 0x00008D57 # GL_EXT_timer_query - GL_TIME_ELAPSED_EXT* = 0x000088BF # GL_EXT_bindable_uniform - GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT* = 0x00008DE2 - GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT* = 0x00008DE3 - GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT* = 0x00008DE4 - GL_MAX_BINDABLE_UNIFORM_SIZE_EXT* = 0x00008DED - cGL_UNIFORM_BUFFER_EXT* = 0x00008DEE - GL_UNIFORM_BUFFER_BINDING_EXT* = 0x00008DEF # GL_EXT_framebuffer_sRGB - GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT* = 0x000020B2 - WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT* = 0x000020A9 - GL_FRAMEBUFFER_SRGB_EXT* = 0x00008DB9 - GL_FRAMEBUFFER_SRGB_CAPABLE_EXT* = 0x00008DBA # GL_EXT_geometry_shader4 - GL_GEOMETRY_SHADER_EXT* = 0x00008DD9 - GL_GEOMETRY_VERTICES_OUT_EXT* = 0x00008DDA - GL_GEOMETRY_INPUTtyp_EXT* = 0x00008DDB - GL_GEOMETRY_OUTPUTtyp_EXT* = 0x00008DDC - GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT* = 0x00008C29 - GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT* = 0x00008DDD - GL_MAX_VERTEX_VARYING_COMPONENTS_EXT* = 0x00008DDE - GL_MAX_VARYING_COMPONENTS_EXT* = 0x00008B4B - GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT* = 0x00008DDF - GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT* = 0x00008DE0 - GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT* = 0x00008DE1 - GL_LINES_ADJACENCY_EXT* = 0x0000000A - GL_LINE_STRIP_ADJACENCY_EXT* = 0x0000000B - GL_TRIANGLES_ADJACENCY_EXT* = 0x0000000C - GL_TRIANGLE_STRIP_ADJACENCY_EXT* = 0x0000000D - GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT* = 0x00008DA8 - GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT* = 0x00008DA9 - GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT* = 0x00008DA7 - GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT* = 0x00008CD4 - GL_PROGRAM_POINT_SIZE_EXT* = 0x00008642 # GL_EXT_gpu_shader4 - GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT* = 0x000088FD - GL_SAMPLER_1D_ARRAY_EXT* = 0x00008DC0 - GL_SAMPLER_2D_ARRAY_EXT* = 0x00008DC1 - GL_SAMPLER_BUFFER_EXT* = 0x00008DC2 - GL_SAMPLER_1D_ARRAY_SHADOW_EXT* = 0x00008DC3 - GL_SAMPLER_2D_ARRAY_SHADOW_EXT* = 0x00008DC4 - GL_SAMPLER_CUBE_SHADOW_EXT* = 0x00008DC5 - GL_UNSIGNED_INT_VEC2_EXT* = 0x00008DC6 - GL_UNSIGNED_INT_VEC3_EXT* = 0x00008DC7 - GL_UNSIGNED_INT_VEC4_EXT* = 0x00008DC8 - GL_INT_SAMPLER_1D_EXT* = 0x00008DC9 - GL_INT_SAMPLER_2D_EXT* = 0x00008DCA - GL_INT_SAMPLER_3D_EXT* = 0x00008DCB - GL_INT_SAMPLER_CUBE_EXT* = 0x00008DCC - GL_INT_SAMPLER_2D_RECT_EXT* = 0x00008DCD - GL_INT_SAMPLER_1D_ARRAY_EXT* = 0x00008DCE - GL_INT_SAMPLER_2D_ARRAY_EXT* = 0x00008DCF - GL_INT_SAMPLER_BUFFER_EXT* = 0x00008DD0 - GL_UNSIGNED_INT_SAMPLER_1D_EXT* = 0x00008DD1 - GL_UNSIGNED_INT_SAMPLER_2D_EXT* = 0x00008DD2 - GL_UNSIGNED_INT_SAMPLER_3D_EXT* = 0x00008DD3 - GL_UNSIGNED_INT_SAMPLER_CUBE_EXT* = 0x00008DD4 - GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT* = 0x00008DD5 - GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT* = 0x00008DD6 - GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT* = 0x00008DD7 - GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT* = 0x00008DD8 - GL_MIN_PROGRAM_TEXEL_OFFSET_EXT* = 0x00008904 - GL_MAX_PROGRAM_TEXEL_OFFSET_EXT* = 0x00008905 # GL_EXT_packed_float - GL_R11F_G11F_B10F_EXT* = 0x00008C3A - GL_UNSIGNED_INT_10F_11F_11F_REV_EXT* = 0x00008C3B - RGBA_SIGNED_COMPONENTS_EXT* = 0x00008C3C - WGLtyp_RGBA_UNSIGNED_FLOAT_EXT* = 0x000020A8 - GLX_RGBA_UNSIGNED_FLOATtyp_EXT* = 0x000020B1 - GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT* = 0x00000008 # GL_EXT_texture_array - GL_TEXTURE_1D_ARRAY_EXT* = 0x00008C18 - GL_TEXTURE_2D_ARRAY_EXT* = 0x00008C1A - GL_PROXY_TEXTURE_2D_ARRAY_EXT* = 0x00008C1B - GL_PROXY_TEXTURE_1D_ARRAY_EXT* = 0x00008C19 - GL_TEXTURE_BINDING_1D_ARRAY_EXT* = 0x00008C1C - GL_TEXTURE_BINDING_2D_ARRAY_EXT* = 0x00008C1D - GL_MAX_ARRAY_TEXTURE_LAYERS_EXT* = 0x000088FF - GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT* = 0x0000884E # GL_EXT_texture_buffer_object - cGL_TEXTURE_BUFFER_EXT* = 0x00008C2A - GL_MAX_TEXTURE_BUFFER_SIZE_EXT* = 0x00008C2B - GL_TEXTURE_BINDING_BUFFER_EXT* = 0x00008C2C - GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT* = 0x00008C2D - GL_TEXTURE_BUFFER_FORMAT_EXT* = 0x00008C2E # GL_EXT_texture_compression_latc - GL_COMPRESSED_LUMINANCE_LATC1_EXT* = 0x00008C70 - GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT* = 0x00008C71 - GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT* = 0x00008C72 - GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT* = 0x00008C73 # - # GL_EXT_texture_compression_rgtc - GL_COMPRESSED_RED_RGTC1_EXT* = 0x00008DBB - GL_COMPRESSED_SIGNED_RED_RGTC1_EXT* = 0x00008DBC - GL_COMPRESSED_RED_GREEN_RGTC2_EXT* = 0x00008DBD - GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT* = 0x00008DBE # GL_EXT_texture_integer - GL_RGBA_INTEGER_MODE_EXT* = 0x00008D9E - GL_RGBA32UI_EXT* = 0x00008D70 - GL_RGB32UI_EXT* = 0x00008D71 - GL_ALPHA32UI_EXT* = 0x00008D72 - GL_INTENSITY32UI_EXT* = 0x00008D73 - GL_LUMINANCE32UI_EXT* = 0x00008D74 - GL_LUMINANCE_ALPHA32UI_EXT* = 0x00008D75 - GL_RGBA16UI_EXT* = 0x00008D76 - GL_RGB16UI_EXT* = 0x00008D77 - GL_ALPHA16UI_EXT* = 0x00008D78 - GL_INTENSITY16UI_EXT* = 0x00008D79 - GL_LUMINANCE16UI_EXT* = 0x00008D7A - GL_LUMINANCE_ALPHA16UI_EXT* = 0x00008D7B - GL_RGBA8UI_EXT* = 0x00008D7C - GL_RGB8UI_EXT* = 0x00008D7D - GL_ALPHA8UI_EXT* = 0x00008D7E - GL_INTENSITY8UI_EXT* = 0x00008D7F - GL_LUMINANCE8UI_EXT* = 0x00008D80 - GL_LUMINANCE_ALPHA8UI_EXT* = 0x00008D81 - GL_RGBA32I_EXT* = 0x00008D82 - GL_RGB32I_EXT* = 0x00008D83 - GL_ALPHA32I_EXT* = 0x00008D84 - GL_INTENSITY32I_EXT* = 0x00008D85 - GL_LUMINANCE32I_EXT* = 0x00008D86 - GL_LUMINANCE_ALPHA32I_EXT* = 0x00008D87 - GL_RGBA16I_EXT* = 0x00008D88 - GL_RGB16I_EXT* = 0x00008D89 - GL_ALPHA16I_EXT* = 0x00008D8A - GL_INTENSITY16I_EXT* = 0x00008D8B - GL_LUMINANCE16I_EXT* = 0x00008D8C - GL_LUMINANCE_ALPHA16I_EXT* = 0x00008D8D - GL_RGBA8I_EXT* = 0x00008D8E - GL_RGB8I_EXT* = 0x00008D8F - GL_ALPHA8I_EXT* = 0x00008D90 - GL_INTENSITY8I_EXT* = 0x00008D91 - GL_LUMINANCE8I_EXT* = 0x00008D92 - GL_LUMINANCE_ALPHA8I_EXT* = 0x00008D93 - GL_RED_INTEGER_EXT* = 0x00008D94 - GL_GREEN_INTEGER_EXT* = 0x00008D95 - GL_BLUE_INTEGER_EXT* = 0x00008D96 - GL_ALPHA_INTEGER_EXT* = 0x00008D97 - GL_RGB_INTEGER_EXT* = 0x00008D98 - GL_RGBA_INTEGER_EXT* = 0x00008D99 - GL_BGR_INTEGER_EXT* = 0x00008D9A - GL_BGRA_INTEGER_EXT* = 0x00008D9B - GL_LUMINANCE_INTEGER_EXT* = 0x00008D9C - GL_LUMINANCE_ALPHA_INTEGER_EXT* = 0x00008D9D # GL_EXT_texture_shared_exponent - GL_RGB9_E5_EXT* = 0x00008C3D - GL_UNSIGNED_INT_5_9_9_9_REV_EXT* = 0x00008C3E - GL_TEXTURE_SHARED_SIZE_EXT* = 0x00008C3F # GL_EXT_transform_feedback - GL_TRANSFORM_FEEDBACK_BUFFER_EXT* = 0x00008C8E - GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT* = 0x00008C84 - GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT* = 0x00008C85 - GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT* = 0x00008C8F - GL_INTERLEAVED_ATTRIBS_EXT* = 0x00008C8C - GL_SEPARATE_ATTRIBS_EXT* = 0x00008C8D - GL_PRIMITIVES_GENERATED_EXT* = 0x00008C87 - GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT* = 0x00008C88 - GL_RASTERIZER_DISCARD_EXT* = 0x00008C89 - GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT* = 0x00008C8A - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT* = 0x00008C8B - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT* = 0x00008C80 - cGL_TRANSFORM_FEEDBACK_VARYINGS_EXT* = 0x00008C83 - GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT* = 0x00008C7F - GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT* = 0x00008C76 # - # GL_EXT_direct_state_access - GL_PROGRAM_MATRIX_EXT* = 0x00008E2D - GL_TRANSPOSE_PROGRAM_MATRIX_EXT* = 0x00008E2E - GL_PROGRAM_MATRIX_STACK_DEPTH_EXT* = 0x00008E2F # GL_EXT_texture_swizzle - GL_TEXTURE_SWIZZLE_R_EXT* = 0x00008E42 - GL_TEXTURE_SWIZZLE_G_EXT* = 0x00008E43 - GL_TEXTURE_SWIZZLE_B_EXT* = 0x00008E44 - GL_TEXTURE_SWIZZLE_A_EXT* = 0x00008E45 - GL_TEXTURE_SWIZZLE_RGBA_EXT* = 0x00008E46 # GL_EXT_provoking_vertex - GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT* = 0x00008E4C - GL_FIRST_VERTEX_CONVENTION_EXT* = 0x00008E4D - GL_LAST_VERTEX_CONVENTION_EXT* = 0x00008E4E - GL_PROVOKING_VERTEX_EXT* = 0x00008E4F # GL_EXT_texture_snorm - GL_ALPHA_SNORM* = 0x00009010 - GL_LUMINANCE_SNORM* = 0x00009011 - GL_LUMINANCE_ALPHA_SNORM* = 0x00009012 - GL_INTENSITY_SNORM* = 0x00009013 - GL_ALPHA8_SNORM* = 0x00009014 - GL_LUMINANCE8_SNORM* = 0x00009015 - GL_LUMINANCE8_ALPHA8_SNORM* = 0x00009016 - GL_INTENSITY8_SNORM* = 0x00009017 - GL_ALPHA16_SNORM* = 0x00009018 - GL_LUMINANCE16_SNORM* = 0x00009019 - GL_LUMINANCE16_ALPHA16_SNORM* = 0x0000901A - GL_INTENSITY16_SNORM* = 0x0000901B # GL_EXT_separate_shader_objects - cGL_ACTIVE_PROGRAM_EXT* = 0x00008B8D # GL_EXT_shader_image_load_store - GL_MAX_IMAGE_UNITS_EXT* = 0x00008F38 - GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT* = 0x00008F39 - GL_IMAGE_BINDING_NAME_EXT* = 0x00008F3A - GL_IMAGE_BINDING_LEVEL_EXT* = 0x00008F3B - GL_IMAGE_BINDING_LAYERED_EXT* = 0x00008F3C - GL_IMAGE_BINDING_LAYER_EXT* = 0x00008F3D - GL_IMAGE_BINDING_ACCESS_EXT* = 0x00008F3E - GL_IMAGE_1D_EXT* = 0x0000904C - GL_IMAGE_2D_EXT* = 0x0000904D - GL_IMAGE_3D_EXT* = 0x0000904E - GL_IMAGE_2D_RECT_EXT* = 0x0000904F - GL_IMAGE_CUBE_EXT* = 0x00009050 - GL_IMAGE_BUFFER_EXT* = 0x00009051 - GL_IMAGE_1D_ARRAY_EXT* = 0x00009052 - GL_IMAGE_2D_ARRAY_EXT* = 0x00009053 - GL_IMAGE_CUBE_MAP_ARRAY_EXT* = 0x00009054 - GL_IMAGE_2D_MULTISAMPLE_EXT* = 0x00009055 - GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT* = 0x00009056 - GL_INT_IMAGE_1D_EXT* = 0x00009057 - GL_INT_IMAGE_2D_EXT* = 0x00009058 - GL_INT_IMAGE_3D_EXT* = 0x00009059 - GL_INT_IMAGE_2D_RECT_EXT* = 0x0000905A - GL_INT_IMAGE_CUBE_EXT* = 0x0000905B - GL_INT_IMAGE_BUFFER_EXT* = 0x0000905C - GL_INT_IMAGE_1D_ARRAY_EXT* = 0x0000905D - GL_INT_IMAGE_2D_ARRAY_EXT* = 0x0000905E - GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT* = 0x0000905F - GL_INT_IMAGE_2D_MULTISAMPLE_EXT* = 0x00009060 - GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT* = 0x00009061 - GL_UNSIGNED_INT_IMAGE_1D_EXT* = 0x00009062 - GL_UNSIGNED_INT_IMAGE_2D_EXT* = 0x00009063 - GL_UNSIGNED_INT_IMAGE_3D_EXT* = 0x00009064 - GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT* = 0x00009065 - GL_UNSIGNED_INT_IMAGE_CUBE_EXT* = 0x00009066 - GL_UNSIGNED_INT_IMAGE_BUFFER_EXT* = 0x00009067 - GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT* = 0x00009068 - GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT* = 0x00009069 - GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT* = 0x0000906A - GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT* = 0x0000906B - GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT* = 0x0000906C - GL_MAX_IMAGE_SAMPLES_EXT* = 0x0000906D - GL_IMAGE_BINDING_FORMAT_EXT* = 0x0000906E - GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT* = 0x00000001 - GL_ELEMENT_ARRAY_BARRIER_BIT_EXT* = 0x00000002 - GL_UNIFORM_BARRIER_BIT_EXT* = 0x00000004 - GL_TEXTURE_FETCH_BARRIER_BIT_EXT* = 0x00000008 - GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT* = 0x00000020 - GL_COMMAND_BARRIER_BIT_EXT* = 0x00000040 - GL_PIXEL_BUFFER_BARRIER_BIT_EXT* = 0x00000080 - GL_TEXTURE_UPDATE_BARRIER_BIT_EXT* = 0x00000100 - GL_BUFFER_UPDATE_BARRIER_BIT_EXT* = 0x00000200 - GL_FRAMEBUFFER_BARRIER_BIT_EXT* = 0x00000400 - GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT* = 0x00000800 - GL_ATOMIC_COUNTER_BARRIER_BIT_EXT* = 0x00001000 - GL_ALL_BARRIER_BITS_EXT* = 0xFFFFFFFF # GL_EXT_vertex_attrib_64bit - # reuse GL_DOUBLE - GL_DOUBLE_VEC2_EXT* = 0x00008FFC - GL_DOUBLE_VEC3_EXT* = 0x00008FFD - GL_DOUBLE_VEC4_EXT* = 0x00008FFE - GL_DOUBLE_MAT2_EXT* = 0x00008F46 - GL_DOUBLE_MAT3_EXT* = 0x00008F47 - GL_DOUBLE_MAT4_EXT* = 0x00008F48 - GL_DOUBLE_MAT2x3_EXT* = 0x00008F49 - GL_DOUBLE_MAT2x4_EXT* = 0x00008F4A - GL_DOUBLE_MAT3x2_EXT* = 0x00008F4B - GL_DOUBLE_MAT3x4_EXT* = 0x00008F4C - GL_DOUBLE_MAT4x2_EXT* = 0x00008F4D - GL_DOUBLE_MAT4x3_EXT* = 0x00008F4E # GL_EXT_texture_sRGB_decode - GL_TEXTURE_SRGB_DECODE_EXT* = 0x00008A48 - GL_DECODE_EXT* = 0x00008A49 - GL_SKIP_DECODE_EXT* = 0x00008A4A # GL_NV_texture_multisample - GL_TEXTURE_COVERAGE_SAMPLES_NV* = 0x00009045 - GL_TEXTURE_COLOR_SAMPLES_NV* = 0x00009046 # GL_AMD_blend_minmax_factor - GL_FACTOR_MIN_AMD* = 0x0000901C - GL_FACTOR_MAX_AMD* = 0x0000901D # GL_AMD_sample_positions - GL_SUBSAMPLE_DISTANCE_AMD* = 0x0000883F # GL_EXT_x11_sync_object - GL_SYNC_X11_FENCE_EXT* = 0x000090E1 # GL_EXT_framebuffer_multisample_blit_scaled - GL_SCALED_RESOLVE_FASTEST_EXT* = 0x000090BA - GL_SCALED_RESOLVE_NICEST_EXT* = 0x000090BB # GL_FfdMaskSGIX - GL_TEXTURE_DEFORMATION_BIT_SGIX* = 0x00000001 - GL_GEOMETRY_DEFORMATION_BIT_SGIX* = 0x00000002 # GL_HP_convolution_border_modes - GL_IGNORE_BORDER_HP* = 0x00008150 - GL_CONSTANT_BORDER_HP* = 0x00008151 - GL_REPLICATE_BORDER_HP* = 0x00008153 - GL_CONVOLUTION_BORDER_COLOR_HP* = 0x00008154 # GL_HP_image_transform - GL_IMAGE_SCALE_X_HP* = 0x00008155 - GL_IMAGE_SCALE_Y_HP* = 0x00008156 - GL_IMAGE_TRANSLATE_X_HP* = 0x00008157 - GL_IMAGE_TRANSLATE_Y_HP* = 0x00008158 - GL_IMAGE_ROTATE_ANGLE_HP* = 0x00008159 - GL_IMAGE_ROTATE_ORIGIN_X_HP* = 0x0000815A - GL_IMAGE_ROTATE_ORIGIN_Y_HP* = 0x0000815B - GL_IMAGE_MAG_FILTER_HP* = 0x0000815C - GL_IMAGE_MIN_FILTER_HP* = 0x0000815D - GL_IMAGE_CUBIC_WEIGHT_HP* = 0x0000815E - GL_CUBIC_HP* = 0x0000815F - GL_AVERAGE_HP* = 0x00008160 - GL_IMAGE_TRANSFORM_2D_HP* = 0x00008161 - GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP* = 0x00008162 - GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP* = 0x00008163 # - # GL_HP_occlusion_test - GL_OCCLUSION_TEST_HP* = 0x00008165 - GL_OCCLUSION_TEST_RESULT_HP* = 0x00008166 # GL_HP_texture_lighting - GL_TEXTURE_LIGHTING_MODE_HP* = 0x00008167 - GL_TEXTURE_POST_SPECULAR_HP* = 0x00008168 - GL_TEXTURE_PRE_SPECULAR_HP* = 0x00008169 # GL_IBM_cull_vertex - GL_CULL_VERTEX_IBM* = 103050 # GL_IBM_rasterpos_clip - GL_RASTER_POSITION_UNCLIPPED_IBM* = 0x00019262 # GL_IBM_texture_mirrored_repeat - GL_MIRRORED_REPEAT_IBM* = 0x00008370 # GL_IBM_vertex_array_lists - GL_VERTEX_ARRAY_LIST_IBM* = 103070 - GL_NORMAL_ARRAY_LIST_IBM* = 103071 - GL_COLOR_ARRAY_LIST_IBM* = 103072 - GL_INDEX_ARRAY_LIST_IBM* = 103073 - GL_TEXTURE_COORD_ARRAY_LIST_IBM* = 103074 - GL_EDGE_FLAG_ARRAY_LIST_IBM* = 103075 - GL_FOG_COORDINATE_ARRAY_LIST_IBM* = 103076 - GL_SECONDARY_COLOR_ARRAY_LIST_IBM* = 103077 - GL_VERTEX_ARRAY_LIST_STRIDE_IBM* = 103080 - GL_NORMAL_ARRAY_LIST_STRIDE_IBM* = 103081 - GL_COLOR_ARRAY_LIST_STRIDE_IBM* = 103082 - GL_INDEX_ARRAY_LIST_STRIDE_IBM* = 103083 - GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM* = 103084 - GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM* = 103085 - GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM* = 103086 - GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM* = 103087 # GL_INGR_color_clamp - GL_RED_MIN_CLAMP_INGR* = 0x00008560 - GL_GREEN_MIN_CLAMP_INGR* = 0x00008561 - GL_BLUE_MIN_CLAMP_INGR* = 0x00008562 - GL_ALPHA_MIN_CLAMP_INGR* = 0x00008563 - GL_RED_MAX_CLAMP_INGR* = 0x00008564 - GL_GREEN_MAX_CLAMP_INGR* = 0x00008565 - GL_BLUE_MAX_CLAMP_INGR* = 0x00008566 - GL_ALPHA_MAX_CLAMP_INGR* = 0x00008567 # GL_INGR_interlace_read - GL_INTERLACE_READ_INGR* = 0x00008568 # GL_INTEL_parallel_arrays - GL_PARALLEL_ARRAYS_INTEL* = 0x000083F4 - GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL* = 0x000083F5 - GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL* = 0x000083F6 - GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL* = 0x000083F7 - GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL* = 0x000083F8 # - # GL_NV_copy_depth_to_color - GL_DEPTH_STENCIL_TO_RGBA_NV* = 0x0000886E - GL_DEPTH_STENCIL_TO_BGRA_NV* = 0x0000886F # GL_NV_depth_clamp - GL_DEPTH_CLAMP_NV* = 0x0000864F # GL_NV_evaluators - GL_EVAL_2D_NV* = 0x000086C0 - GL_EVAL_TRIANGULAR_2D_NV* = 0x000086C1 - GL_MAP_TESSELLATION_NV* = 0x000086C2 - GL_MAP_ATTRIB_U_ORDER_NV* = 0x000086C3 - GL_MAP_ATTRIB_V_ORDER_NV* = 0x000086C4 - GL_EVAL_FRACTIONAL_TESSELLATION_NV* = 0x000086C5 - GL_EVAL_VERTEX_ATTRIB0_NV* = 0x000086C6 - GL_EVAL_VERTEX_ATTRIB1_NV* = 0x000086C7 - GL_EVAL_VERTEX_ATTRIB2_NV* = 0x000086C8 - GL_EVAL_VERTEX_ATTRIB3_NV* = 0x000086C9 - GL_EVAL_VERTEX_ATTRIB4_NV* = 0x000086CA - GL_EVAL_VERTEX_ATTRIB5_NV* = 0x000086CB - GL_EVAL_VERTEX_ATTRIB6_NV* = 0x000086CC - GL_EVAL_VERTEX_ATTRIB7_NV* = 0x000086CD - GL_EVAL_VERTEX_ATTRIB8_NV* = 0x000086CE - GL_EVAL_VERTEX_ATTRIB9_NV* = 0x000086CF - GL_EVAL_VERTEX_ATTRIB10_NV* = 0x000086D0 - GL_EVAL_VERTEX_ATTRIB11_NV* = 0x000086D1 - GL_EVAL_VERTEX_ATTRIB12_NV* = 0x000086D2 - GL_EVAL_VERTEX_ATTRIB13_NV* = 0x000086D3 - GL_EVAL_VERTEX_ATTRIB14_NV* = 0x000086D4 - GL_EVAL_VERTEX_ATTRIB15_NV* = 0x000086D5 - GL_MAX_MAP_TESSELLATION_NV* = 0x000086D6 - GL_MAX_RATIONAL_EVAL_ORDER_NV* = 0x000086D7 # GL_NV_fence - GL_ALL_COMPLETED_NV* = 0x000084F2 - GL_FENCE_STATUS_NV* = 0x000084F3 - GL_FENCE_CONDITION_NV* = 0x000084F4 # GL_NV_float_buffer - GL_FLOAT_R_NV* = 0x00008880 - GL_FLOAT_RG_NV* = 0x00008881 - GL_FLOAT_RGB_NV* = 0x00008882 - GL_FLOAT_RGBA_NV* = 0x00008883 - GL_FLOAT_R16_NV* = 0x00008884 - GL_FLOAT_R32_NV* = 0x00008885 - GL_FLOAT_RG16_NV* = 0x00008886 - GL_FLOAT_RG32_NV* = 0x00008887 - GL_FLOAT_RGB16_NV* = 0x00008888 - GL_FLOAT_RGB32_NV* = 0x00008889 - GL_FLOAT_RGBA16_NV* = 0x0000888A - GL_FLOAT_RGBA32_NV* = 0x0000888B - GL_TEXTURE_FLOAT_COMPONENTS_NV* = 0x0000888C - GL_FLOAT_CLEAR_COLOR_VALUE_NV* = 0x0000888D - GL_FLOAT_RGBA_MODE_NV* = 0x0000888E # GL_NV_fog_distance - GL_FOG_DISTANCE_MODE_NV* = 0x0000855A - GL_EYE_RADIAL_NV* = 0x0000855B - GL_EYE_PLANE_ABSOLUTE_NV* = 0x0000855C # GL_NV_fragment_program - GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV* = 0x00008868 - GL_FRAGMENT_PROGRAM_NV* = 0x00008870 - GL_MAX_TEXTURE_COORDS_NV* = 0x00008871 - GL_MAX_TEXTURE_IMAGE_UNITS_NV* = 0x00008872 - GL_FRAGMENT_PROGRAM_BINDING_NV* = 0x00008873 - GL_PROGRAM_ERROR_STRING_NV* = 0x00008874 # GL_NV_half_float - GL_HALF_FLOAT_NV* = 0x0000140B # GL_NV_light_max_exponent - GL_MAX_SHININESS_NV* = 0x00008504 - GL_MAX_SPOT_EXPONENT_NV* = 0x00008505 # GL_NV_multisample_filter_hint - GL_MULTISAMPLE_FILTER_HINT_NV* = 0x00008534 # GL_NV_occlusion_query - GL_PIXEL_COUNTER_BITS_NV* = 0x00008864 - GL_CURRENT_OCCLUSION_QUERY_ID_NV* = 0x00008865 - GL_PIXEL_COUNT_NV* = 0x00008866 - GL_PIXEL_COUNT_AVAILABLE_NV* = 0x00008867 # GL_NV_packed_depth_stencil - GL_DEPTH_STENCIL_NV* = 0x000084F9 - GL_UNSIGNED_INT_24_8_NV* = 0x000084FA # GL_NV_pixel_data_range - GL_WRITE_PIXEL_DATA_RANGE_NV* = 0x00008878 - GL_READ_PIXEL_DATA_RANGE_NV* = 0x00008879 - GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV* = 0x0000887A - GL_READ_PIXEL_DATA_RANGE_LENGTH_NV* = 0x0000887B - GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV* = 0x0000887C - GL_READ_PIXEL_DATA_RANGE_POINTER_NV* = 0x0000887D # GL_NV_point_sprite - GL_POINT_SPRITE_NV* = 0x00008861 - GL_COORD_REPLACE_NV* = 0x00008862 - GL_POINT_SPRITE_R_MODE_NV* = 0x00008863 # GL_NV_primitive_restart - cGL_PRIMITIVE_RESTART_NV* = 0x00008558 - cGL_PRIMITIVE_RESTART_INDEX_NV* = 0x00008559 # GL_NV_register_combiners - GL_REGISTER_COMBINERS_NV* = 0x00008522 - GL_VARIABLE_A_NV* = 0x00008523 - GL_VARIABLE_B_NV* = 0x00008524 - GL_VARIABLE_C_NV* = 0x00008525 - GL_VARIABLE_D_NV* = 0x00008526 - GL_VARIABLE_E_NV* = 0x00008527 - GL_VARIABLE_F_NV* = 0x00008528 - GL_VARIABLE_G_NV* = 0x00008529 - GL_CONSTANT_COLOR0_NV* = 0x0000852A - GL_CONSTANT_COLOR1_NV* = 0x0000852B - GL_PRIMARY_COLOR_NV* = 0x0000852C - GL_SECONDARY_COLOR_NV* = 0x0000852D - GL_SPARE0_NV* = 0x0000852E - GL_SPARE1_NV* = 0x0000852F - GL_DISCARD_NV* = 0x00008530 - GL_E_TIMES_F_NV* = 0x00008531 - GL_SPARE0_PLUS_SECONDARY_COLOR_NV* = 0x00008532 - GL_UNSIGNED_IDENTITY_NV* = 0x00008536 - GL_UNSIGNED_INVERT_NV* = 0x00008537 - GL_EXPAND_NORMAL_NV* = 0x00008538 - GL_EXPAND_NEGATE_NV* = 0x00008539 - GL_HALF_BIAS_NORMAL_NV* = 0x0000853A - GL_HALF_BIAS_NEGATE_NV* = 0x0000853B - GL_SIGNED_IDENTITY_NV* = 0x0000853C - GL_SIGNED_NEGATE_NV* = 0x0000853D - GL_SCALE_BY_TWO_NV* = 0x0000853E - GL_SCALE_BY_FOUR_NV* = 0x0000853F - GL_SCALE_BY_ONE_HALF_NV* = 0x00008540 - GL_BIAS_BY_NEGATIVE_ONE_HALF_NV* = 0x00008541 - cGL_COMBINER_INPUT_NV* = 0x00008542 - GL_COMBINER_MAPPING_NV* = 0x00008543 - GL_COMBINER_COMPONENT_USAGE_NV* = 0x00008544 - GL_COMBINER_AB_DOT_PRODUCT_NV* = 0x00008545 - GL_COMBINER_CD_DOT_PRODUCT_NV* = 0x00008546 - GL_COMBINER_MUX_SUM_NV* = 0x00008547 - GL_COMBINER_SCALE_NV* = 0x00008548 - GL_COMBINER_BIAS_NV* = 0x00008549 - GL_COMBINER_AB_OUTPUT_NV* = 0x0000854A - GL_COMBINER_CD_OUTPUT_NV* = 0x0000854B - GL_COMBINER_SUM_OUTPUT_NV* = 0x0000854C - GL_MAX_GENERAL_COMBINERS_NV* = 0x0000854D - GL_NUM_GENERAL_COMBINERS_NV* = 0x0000854E - GL_COLOR_SUM_CLAMP_NV* = 0x0000854F - GL_COMBINER0_NV* = 0x00008550 - GL_COMBINER1_NV* = 0x00008551 - GL_COMBINER2_NV* = 0x00008552 - GL_COMBINER3_NV* = 0x00008553 - GL_COMBINER4_NV* = 0x00008554 - GL_COMBINER5_NV* = 0x00008555 - GL_COMBINER6_NV* = 0x00008556 - GL_COMBINER7_NV* = 0x00008557 # GL_NV_register_combiners2 - GL_PER_STAGE_CONSTANTS_NV* = 0x00008535 # GL_NV_texgen_emboss - GL_EMBOSS_LIGHT_NV* = 0x0000855D - GL_EMBOSS_CONSTANT_NV* = 0x0000855E - GL_EMBOSS_MAP_NV* = 0x0000855F # GL_NV_texgen_reflection - GL_NORMAL_MAP_NV* = 0x00008511 - GL_REFLECTION_MAP_NV* = 0x00008512 # GL_NV_texture_env_combine4 - GL_COMBINE4_NV* = 0x00008503 - GL_SOURCE3_RGB_NV* = 0x00008583 - GL_SOURCE3_ALPHA_NV* = 0x0000858B - GL_OPERAND3_RGB_NV* = 0x00008593 - GL_OPERAND3_ALPHA_NV* = 0x0000859B # GL_NV_texture_expand_normal - GL_TEXTURE_UNSIGNED_REMAP_MODE_NV* = 0x0000888F # GL_NV_texture_rectangle - GL_TEXTURE_RECTANGLE_NV* = 0x000084F5 - GL_TEXTURE_BINDING_RECTANGLE_NV* = 0x000084F6 - GL_PROXY_TEXTURE_RECTANGLE_NV* = 0x000084F7 - GL_MAX_RECTANGLE_TEXTURE_SIZE_NV* = 0x000084F8 # GL_NV_texture_shader - GL_OFFSET_TEXTURE_RECTANGLE_NV* = 0x0000864C - GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV* = 0x0000864D - GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV* = 0x0000864E - GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV* = 0x000086D9 - GL_UNSIGNED_INT_S8_S8_8_8_NV* = 0x000086DA - GL_UNSIGNED_INT_8_8_S8_S8_REV_NV* = 0x000086DB - GL_DSDT_MAG_INTENSITY_NV* = 0x000086DC - GL_SHADER_CONSISTENT_NV* = 0x000086DD - GL_TEXTURE_SHADER_NV* = 0x000086DE - GL_SHADER_OPERATION_NV* = 0x000086DF - GL_CULL_MODES_NV* = 0x000086E0 - GL_OFFSET_TEXTURE_MATRIX_NV* = 0x000086E1 - GL_OFFSET_TEXTURE_SCALE_NV* = 0x000086E2 - GL_OFFSET_TEXTURE_BIAS_NV* = 0x000086E3 - GL_OFFSET_TEXTURE_2D_MATRIX_NV* = GL_OFFSET_TEXTURE_MATRIX_NV - GL_OFFSET_TEXTURE_2D_SCALE_NV* = GL_OFFSET_TEXTURE_SCALE_NV - GL_OFFSET_TEXTURE_2D_BIAS_NV* = GL_OFFSET_TEXTURE_BIAS_NV - GL_PREVIOUS_TEXTURE_INPUT_NV* = 0x000086E4 - GL_CONST_EYE_NV* = 0x000086E5 - GL_PASS_THROUGH_NV* = 0x000086E6 - GL_CULL_FRAGMENT_NV* = 0x000086E7 - GL_OFFSET_TEXTURE_2D_NV* = 0x000086E8 - GL_DEPENDENT_AR_TEXTURE_2D_NV* = 0x000086E9 - GL_DEPENDENT_GB_TEXTURE_2D_NV* = 0x000086EA - GL_DOT_PRODUCT_NV* = 0x000086EC - GL_DOT_PRODUCT_DEPTH_REPLACE_NV* = 0x000086ED - GL_DOT_PRODUCT_TEXTURE_2D_NV* = 0x000086EE - GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV* = 0x000086F0 - GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV* = 0x000086F1 - GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV* = 0x000086F2 - GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV* = 0x000086F3 - GL_HILO_NV* = 0x000086F4 - GL_DSDT_NV* = 0x000086F5 - GL_DSDT_MAG_NV* = 0x000086F6 - GL_DSDT_MAG_VIB_NV* = 0x000086F7 - GL_HILO16_NV* = 0x000086F8 - GL_SIGNED_HILO_NV* = 0x000086F9 - GL_SIGNED_HILO16_NV* = 0x000086FA - GL_SIGNED_RGBA_NV* = 0x000086FB - GL_SIGNED_RGBA8_NV* = 0x000086FC - GL_SIGNED_RGB_NV* = 0x000086FE - GL_SIGNED_RGB8_NV* = 0x000086FF - GL_SIGNED_LUMINANCE_NV* = 0x00008701 - GL_SIGNED_LUMINANCE8_NV* = 0x00008702 - GL_SIGNED_LUMINANCE_ALPHA_NV* = 0x00008703 - GL_SIGNED_LUMINANCE8_ALPHA8_NV* = 0x00008704 - GL_SIGNED_ALPHA_NV* = 0x00008705 - GL_SIGNED_ALPHA8_NV* = 0x00008706 - GL_SIGNED_INTENSITY_NV* = 0x00008707 - GL_SIGNED_INTENSITY8_NV* = 0x00008708 - GL_DSDT8_NV* = 0x00008709 - GL_DSDT8_MAG8_NV* = 0x0000870A - GL_DSDT8_MAG8_INTENSITY8_NV* = 0x0000870B - GL_SIGNED_RGB_UNSIGNED_ALPHA_NV* = 0x0000870C - GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV* = 0x0000870D - GL_HI_SCALE_NV* = 0x0000870E - GL_LO_SCALE_NV* = 0x0000870F - GL_DS_SCALE_NV* = 0x00008710 - GL_DT_SCALE_NV* = 0x00008711 - GL_MAGNITUDE_SCALE_NV* = 0x00008712 - GL_VIBRANCE_SCALE_NV* = 0x00008713 - GL_HI_BIAS_NV* = 0x00008714 - GL_LO_BIAS_NV* = 0x00008715 - GL_DS_BIAS_NV* = 0x00008716 - GL_DT_BIAS_NV* = 0x00008717 - GL_MAGNITUDE_BIAS_NV* = 0x00008718 - GL_VIBRANCE_BIAS_NV* = 0x00008719 - GL_TEXTURE_BORDER_VALUES_NV* = 0x0000871A - GL_TEXTURE_HI_SIZE_NV* = 0x0000871B - GL_TEXTURE_LO_SIZE_NV* = 0x0000871C - GL_TEXTURE_DS_SIZE_NV* = 0x0000871D - GL_TEXTURE_DT_SIZE_NV* = 0x0000871E - GL_TEXTURE_MAG_SIZE_NV* = 0x0000871F # GL_NV_texture_shader2 - GL_DOT_PRODUCT_TEXTURE_3D_NV* = 0x000086EF # GL_NV_texture_shader3 - GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV* = 0x00008850 - GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV* = 0x00008851 - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV* = 0x00008852 - GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV* = 0x00008853 - GL_OFFSET_HILO_TEXTURE_2D_NV* = 0x00008854 - GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV* = 0x00008855 - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV* = 0x00008856 - GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV* = 0x00008857 - GL_DEPENDENT_HILO_TEXTURE_2D_NV* = 0x00008858 - GL_DEPENDENT_RGB_TEXTURE_3D_NV* = 0x00008859 - GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV* = 0x0000885A - GL_DOT_PRODUCT_PASS_THROUGH_NV* = 0x0000885B - GL_DOT_PRODUCT_TEXTURE_1D_NV* = 0x0000885C - GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV* = 0x0000885D - GL_HILO8_NV* = 0x0000885E - GL_SIGNED_HILO8_NV* = 0x0000885F - GL_FORCE_BLUE_TO_ONE_NV* = 0x00008860 # GL_NV_vertex_array_range - cGL_VERTEX_ARRAY_RANGE_NV* = 0x0000851D - GL_VERTEX_ARRAY_RANGE_LENGTH_NV* = 0x0000851E - GL_VERTEX_ARRAY_RANGE_VALID_NV* = 0x0000851F - GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV* = 0x00008520 - GL_VERTEX_ARRAY_RANGE_POINTER_NV* = 0x00008521 # GL_NV_vertex_array_range2 - GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV* = 0x00008533 # GL_NV_vertex_program - GL_VERTEX_PROGRAM_NV* = 0x00008620 - GL_VERTEX_STATE_PROGRAM_NV* = 0x00008621 - GL_ATTRIB_ARRAY_SIZE_NV* = 0x00008623 - GL_ATTRIB_ARRAY_STRIDE_NV* = 0x00008624 - GL_ATTRIB_ARRAYtyp_NV* = 0x00008625 - GL_CURRENT_ATTRIB_NV* = 0x00008626 - GL_PROGRAM_LENGTH_NV* = 0x00008627 - GL_PROGRAM_STRING_NV* = 0x00008628 - GL_MODELVIEW_PROJECTION_NV* = 0x00008629 - GL_IDENTITY_NV* = 0x0000862A - GL_INVERSE_NV* = 0x0000862B - GL_TRANSPOSE_NV* = 0x0000862C - GL_INVERSE_TRANSPOSE_NV* = 0x0000862D - GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV* = 0x0000862E - GL_MAX_TRACK_MATRICES_NV* = 0x0000862F - GL_MATRIX0_NV* = 0x00008630 - GL_MATRIX1_NV* = 0x00008631 - GL_MATRIX2_NV* = 0x00008632 - GL_MATRIX3_NV* = 0x00008633 - GL_MATRIX4_NV* = 0x00008634 - GL_MATRIX5_NV* = 0x00008635 - GL_MATRIX6_NV* = 0x00008636 - GL_MATRIX7_NV* = 0x00008637 - GL_CURRENT_MATRIX_STACK_DEPTH_NV* = 0x00008640 - GL_CURRENT_MATRIX_NV* = 0x00008641 - GL_VERTEX_PROGRAM_POINT_SIZE_NV* = 0x00008642 - GL_VERTEX_PROGRAM_TWO_SIDE_NV* = 0x00008643 - GL_PROGRAM_PARAMETER_NV* = 0x00008644 - GL_ATTRIB_ARRAY_POINTER_NV* = 0x00008645 - GL_PROGRAM_TARGET_NV* = 0x00008646 - GL_PROGRAM_RESIDENT_NV* = 0x00008647 - cGL_TRACK_MATRIX_NV* = 0x00008648 - GL_TRACK_MATRIX_TRANSFORM_NV* = 0x00008649 - GL_VERTEX_PROGRAM_BINDING_NV* = 0x0000864A - GL_PROGRAM_ERROR_POSITION_NV* = 0x0000864B - GL_VERTEX_ATTRIB_ARRAY0_NV* = 0x00008650 - GL_VERTEX_ATTRIB_ARRAY1_NV* = 0x00008651 - GL_VERTEX_ATTRIB_ARRAY2_NV* = 0x00008652 - GL_VERTEX_ATTRIB_ARRAY3_NV* = 0x00008653 - GL_VERTEX_ATTRIB_ARRAY4_NV* = 0x00008654 - GL_VERTEX_ATTRIB_ARRAY5_NV* = 0x00008655 - GL_VERTEX_ATTRIB_ARRAY6_NV* = 0x00008656 - GL_VERTEX_ATTRIB_ARRAY7_NV* = 0x00008657 - GL_VERTEX_ATTRIB_ARRAY8_NV* = 0x00008658 - GL_VERTEX_ATTRIB_ARRAY9_NV* = 0x00008659 - GL_VERTEX_ATTRIB_ARRAY10_NV* = 0x0000865A - GL_VERTEX_ATTRIB_ARRAY11_NV* = 0x0000865B - GL_VERTEX_ATTRIB_ARRAY12_NV* = 0x0000865C - GL_VERTEX_ATTRIB_ARRAY13_NV* = 0x0000865D - GL_VERTEX_ATTRIB_ARRAY14_NV* = 0x0000865E - GL_VERTEX_ATTRIB_ARRAY15_NV* = 0x0000865F - GL_MAP1_VERTEX_ATTRIB0_4_NV* = 0x00008660 - GL_MAP1_VERTEX_ATTRIB1_4_NV* = 0x00008661 - GL_MAP1_VERTEX_ATTRIB2_4_NV* = 0x00008662 - GL_MAP1_VERTEX_ATTRIB3_4_NV* = 0x00008663 - GL_MAP1_VERTEX_ATTRIB4_4_NV* = 0x00008664 - GL_MAP1_VERTEX_ATTRIB5_4_NV* = 0x00008665 - GL_MAP1_VERTEX_ATTRIB6_4_NV* = 0x00008666 - GL_MAP1_VERTEX_ATTRIB7_4_NV* = 0x00008667 - GL_MAP1_VERTEX_ATTRIB8_4_NV* = 0x00008668 - GL_MAP1_VERTEX_ATTRIB9_4_NV* = 0x00008669 - GL_MAP1_VERTEX_ATTRIB10_4_NV* = 0x0000866A - GL_MAP1_VERTEX_ATTRIB11_4_NV* = 0x0000866B - GL_MAP1_VERTEX_ATTRIB12_4_NV* = 0x0000866C - GL_MAP1_VERTEX_ATTRIB13_4_NV* = 0x0000866D - GL_MAP1_VERTEX_ATTRIB14_4_NV* = 0x0000866E - GL_MAP1_VERTEX_ATTRIB15_4_NV* = 0x0000866F - GL_MAP2_VERTEX_ATTRIB0_4_NV* = 0x00008670 - GL_MAP2_VERTEX_ATTRIB1_4_NV* = 0x00008671 - GL_MAP2_VERTEX_ATTRIB2_4_NV* = 0x00008672 - GL_MAP2_VERTEX_ATTRIB3_4_NV* = 0x00008673 - GL_MAP2_VERTEX_ATTRIB4_4_NV* = 0x00008674 - GL_MAP2_VERTEX_ATTRIB5_4_NV* = 0x00008675 - GL_MAP2_VERTEX_ATTRIB6_4_NV* = 0x00008676 - GL_MAP2_VERTEX_ATTRIB7_4_NV* = 0x00008677 - GL_MAP2_VERTEX_ATTRIB8_4_NV* = 0x00008678 - GL_MAP2_VERTEX_ATTRIB9_4_NV* = 0x00008679 - GL_MAP2_VERTEX_ATTRIB10_4_NV* = 0x0000867A - GL_MAP2_VERTEX_ATTRIB11_4_NV* = 0x0000867B - GL_MAP2_VERTEX_ATTRIB12_4_NV* = 0x0000867C - GL_MAP2_VERTEX_ATTRIB13_4_NV* = 0x0000867D - GL_MAP2_VERTEX_ATTRIB14_4_NV* = 0x0000867E - GL_MAP2_VERTEX_ATTRIB15_4_NV* = 0x0000867F # GL_NV_fragment_program2 and GL_NV_vertex_program2_option - GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV* = 0x000088F4 - GL_MAX_PROGRAM_CALL_DEPTH_NV* = 0x000088F5 # GL_NV_fragment_program2 - GL_MAX_PROGRAM_IF_DEPTH_NV* = 0x000088F6 - GL_MAX_PROGRAM_LOOP_DEPTH_NV* = 0x000088F7 - GL_MAX_PROGRAM_LOOP_COUNT_NV* = 0x000088F8 # GL_NV_vertex_program3 - MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB* = 0x00008B4C # GL_NV_depth_buffer_float - GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV* = 0x00008DAD - GL_DEPTH_BUFFER_FLOAT_MODE_NV* = 0x00008DAF # - # GL_NV_framebuffer_multisample_coverage - GL_RENDERBUFFER_COVERAGE_SAMPLES_NV* = 0x00008CAB - GL_RENDERBUFFER_COLOR_SAMPLES_NV* = 0x00008E10 # GL_NV_geometry_program4 - GL_GEOMETRY_PROGRAM_NV* = 0x00008C26 - GL_MAX_PROGRAM_OUTPUT_VERTICES_NV* = 0x00008C27 - GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV* = 0x00008C28 # GL_NV_gpu_program4 - GL_PROGRAM_ATTRIB_COMPONENTS_NV* = 0x00008906 - GL_PROGRAM_RESULT_COMPONENTS_NV* = 0x00008907 - GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV* = 0x00008908 - GL_MAX_PROGRAM_RESULT_COMPONENTS_NV* = 0x00008909 - GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV* = 0x00008DA5 - GL_MAX_PROGRAM_GENERIC_RESULTS_NV* = 0x00008DA6 # GL_NV_parameter_buffer_object - GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV* = 0x00008DA0 - GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV* = 0x00008DA1 - GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV* = 0x00008DA2 - GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV* = 0x00008DA3 - GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV* = 0x00008DA4 # GL_NV_transform_feedback - GL_TRANSFORM_FEEDBACK_BUFFER_NV* = 0x00008C8E - GL_TRANSFORM_FEEDBACK_BUFFER_START_NV* = 0x00008C84 - GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV* = 0x00008C85 - GL_TRANSFORM_FEEDBACK_RECORD_NV* = 0x00008C86 - GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV* = 0x00008C8F - GL_INTERLEAVED_ATTRIBS_NV* = 0x00008C8C - GL_SEPARATE_ATTRIBS_NV* = 0x00008C8D - GL_PRIMITIVES_GENERATED_NV* = 0x00008C87 - GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV* = 0x00008C88 - GL_RASTERIZER_DISCARD_NV* = 0x00008C89 - GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV* = 0x00008C8A - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV* = 0x00008C8B - GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV* = 0x00008C80 - cGL_TRANSFORM_FEEDBACK_ATTRIBS_NV* = 0x00008C7E - GL_ACTIVE_VARYINGS_NV* = 0x00008C81 - GL_ACTIVE_VARYING_MAX_LENGTH_NV* = 0x00008C82 - cGL_TRANSFORM_FEEDBACK_VARYINGS_NV* = 0x00008C83 - GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV* = 0x00008C7F - GL_BACK_PRIMARY_COLOR_NV* = 0x00008C77 - GL_BACK_SECONDARY_COLOR_NV* = 0x00008C78 - GL_TEXTURE_COORD_NV* = 0x00008C79 - GL_CLIP_DISTANCE_NV* = 0x00008C7A - GL_VERTEX_ID_NV* = 0x00008C7B - GL_PRIMITIVE_ID_NV* = 0x00008C7C - GL_GENERIC_ATTRIB_NV* = 0x00008C7D - GL_LAYER_NV* = 0x00008DAA - GL_NEXT_BUFFER_NV* = - 2 - GL_SKIP_COMPONENTS4_NV* = - 3 - GL_SKIP_COMPONENTS3_NV* = - 4 - GL_SKIP_COMPONENTS2_NV* = - 5 - GL_SKIP_COMPONENTS1_NV* = - 6 # GL_NV_conditional_render - GL_QUERY_WAIT_NV* = 0x00008E13 - GL_QUERY_NO_WAIT_NV* = 0x00008E14 - GL_QUERY_BY_REGION_WAIT_NV* = 0x00008E15 - GL_QUERY_BY_REGION_NO_WAIT_NV* = 0x00008E16 # GL_NV_present_video - GL_FRAME_NV* = 0x00008E26 - GL_FIELDS_NV* = 0x00008E27 - GL_CURRENT_TIME_NV* = 0x00008E28 - GL_NUM_FILL_STREAMS_NV* = 0x00008E29 - GL_PRESENT_TIME_NV* = 0x00008E2A - GL_PRESENT_DURATION_NV* = 0x00008E2B # GL_NV_explicit_multisample - GL_SAMPLE_POSITION_NV* = 0x00008E50 - GL_SAMPLE_MASK_NV* = 0x00008E51 - GL_SAMPLE_MASK_VALUE_NV* = 0x00008E52 - GL_TEXTURE_BINDING_RENDERBUFFER_NV* = 0x00008E53 - GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV* = 0x00008E54 - GL_TEXTURE_RENDERBUFFER_NV* = 0x00008E55 - GL_SAMPLER_RENDERBUFFER_NV* = 0x00008E56 - GL_INT_SAMPLER_RENDERBUFFER_NV* = 0x00008E57 - GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV* = 0x00008E58 - GL_MAX_SAMPLE_MASK_WORDS_NV* = 0x00008E59 # GL_NV_transform_feedback2 - GL_TRANSFORM_FEEDBACK_NV* = 0x00008E22 - GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV* = 0x00008E23 - GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV* = 0x00008E24 - GL_TRANSFORM_FEEDBACK_BINDING_NV* = 0x00008E25 # GL_NV_video_capture - GL_VIDEO_BUFFER_NV* = 0x00009020 - GL_VIDEO_BUFFER_BINDING_NV* = 0x00009021 - GL_FIELD_UPPER_NV* = 0x00009022 - GL_FIELD_LOWER_NV* = 0x00009023 - GL_NUM_VIDEO_CAPTURE_STREAMS_NV* = 0x00009024 - GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV* = 0x00009025 - GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV* = 0x00009026 - GL_LAST_VIDEO_CAPTURE_STATUS_NV* = 0x00009027 - GL_VIDEO_BUFFER_PITCH_NV* = 0x00009028 - GL_VIDEO_COLOR_CONVERSION_MATRIX_NV* = 0x00009029 - GL_VIDEO_COLOR_CONVERSION_MAX_NV* = 0x0000902A - GL_VIDEO_COLOR_CONVERSION_MIN_NV* = 0x0000902B - GL_VIDEO_COLOR_CONVERSION_OFFSET_NV* = 0x0000902C - GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV* = 0x0000902D - GL_PARTIAL_SUCCESS_NV* = 0x0000902E - GL_SUCCESS_NV* = 0x0000902F - GL_FAILURE_NV* = 0x00009030 - GL_YCBYCR8_422_NV* = 0x00009031 - GL_YCBAYCR8A_4224_NV* = 0x00009032 - GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV* = 0x00009033 - GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV* = 0x00009034 - GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV* = 0x00009035 - GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV* = 0x00009036 - GL_Z4Y12Z4CB12Z4CR12_444_NV* = 0x00009037 - GL_VIDEO_CAPTURE_FRAME_WIDTH_NV* = 0x00009038 - GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV* = 0x00009039 - GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV* = 0x0000903A - GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV* = 0x0000903B - GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV* = 0x0000903C # GL_NV_shader_buffer_load - GL_BUFFER_GPU_ADDRESS_NV* = 0x00008F1D - GL_GPU_ADDRESS_NV* = 0x00008F34 - GL_MAX_SHADER_BUFFER_ADDRESS_NV* = 0x00008F35 # - # GL_NV_vertex_buffer_unified_memory - GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV* = 0x00008F1E - GL_ELEMENT_ARRAY_UNIFIED_NV* = 0x00008F1F - GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV* = 0x00008F20 - GL_VERTEX_ARRAY_ADDRESS_NV* = 0x00008F21 - GL_NORMAL_ARRAY_ADDRESS_NV* = 0x00008F22 - GL_COLOR_ARRAY_ADDRESS_NV* = 0x00008F23 - GL_INDEX_ARRAY_ADDRESS_NV* = 0x00008F24 - GL_TEXTURE_COORD_ARRAY_ADDRESS_NV* = 0x00008F25 - GL_EDGE_FLAG_ARRAY_ADDRESS_NV* = 0x00008F26 - GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV* = 0x00008F27 - GL_FOG_COORD_ARRAY_ADDRESS_NV* = 0x00008F28 - GL_ELEMENT_ARRAY_ADDRESS_NV* = 0x00008F29 - GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV* = 0x00008F2A - GL_VERTEX_ARRAY_LENGTH_NV* = 0x00008F2B - GL_NORMAL_ARRAY_LENGTH_NV* = 0x00008F2C - GL_COLOR_ARRAY_LENGTH_NV* = 0x00008F2D - GL_INDEX_ARRAY_LENGTH_NV* = 0x00008F2E - GL_TEXTURE_COORD_ARRAY_LENGTH_NV* = 0x00008F2F - GL_EDGE_FLAG_ARRAY_LENGTH_NV* = 0x00008F30 - GL_SECONDARY_COLOR_ARRAY_LENGTH_NV* = 0x00008F31 - GL_FOG_COORD_ARRAY_LENGTH_NV* = 0x00008F32 - GL_ELEMENT_ARRAY_LENGTH_NV* = 0x00008F33 - GL_DRAW_INDIRECT_UNIFIED_NV* = 0x00008F40 - GL_DRAW_INDIRECT_ADDRESS_NV* = 0x00008F41 - GL_DRAW_INDIRECT_LENGTH_NV* = 0x00008F42 # GL_NV_gpu_program5 - GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV* = 0x00008E5A - GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV* = 0x00008E5B - GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV* = 0x00008E5C - GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV* = 0x00008E5D - GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV* = 0x00008E5E - GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV* = 0x00008E5F - GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV* = 0x00008F44 - GL_MAX_PROGRAM_SUBROUTINE_NUM_NV* = 0x00008F45 # GL_NV_gpu_shader5 - GL_INT64_NV* = 0x0000140E - GL_UNSIGNED_INT64_NV* = 0x0000140F - GL_INT8_NV* = 0x00008FE0 - GL_INT8_VEC2_NV* = 0x00008FE1 - GL_INT8_VEC3_NV* = 0x00008FE2 - GL_INT8_VEC4_NV* = 0x00008FE3 - GL_INT16_NV* = 0x00008FE4 - GL_INT16_VEC2_NV* = 0x00008FE5 - GL_INT16_VEC3_NV* = 0x00008FE6 - GL_INT16_VEC4_NV* = 0x00008FE7 - GL_INT64_VEC2_NV* = 0x00008FE9 - GL_INT64_VEC3_NV* = 0x00008FEA - GL_INT64_VEC4_NV* = 0x00008FEB - GL_UNSIGNED_INT8_NV* = 0x00008FEC - GL_UNSIGNED_INT8_VEC2_NV* = 0x00008FED - GL_UNSIGNED_INT8_VEC3_NV* = 0x00008FEE - GL_UNSIGNED_INT8_VEC4_NV* = 0x00008FEF - GL_UNSIGNED_INT16_NV* = 0x00008FF0 - GL_UNSIGNED_INT16_VEC2_NV* = 0x00008FF1 - GL_UNSIGNED_INT16_VEC3_NV* = 0x00008FF2 - GL_UNSIGNED_INT16_VEC4_NV* = 0x00008FF3 - GL_UNSIGNED_INT64_VEC2_NV* = 0x00008FF5 - GL_UNSIGNED_INT64_VEC3_NV* = 0x00008FF6 - GL_UNSIGNED_INT64_VEC4_NV* = 0x00008FF7 - GL_FLOAT16_NV* = 0x00008FF8 - GL_FLOAT16_VEC2_NV* = 0x00008FF9 - GL_FLOAT16_VEC3_NV* = 0x00008FFA - GL_FLOAT16_VEC4_NV* = 0x00008FFB # reuse GL_PATCHES - # GL_NV_shader_buffer_store - GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV* = 0x00000010 # reuse GL_READ_WRITE - # reuse GL_WRITE_ONLY - # - # GL_NV_tessellation_program5 - GL_MAX_PROGRAM_PATCH_ATTRIBS_NV* = 0x000086D8 - GL_TESS_CONTROL_PROGRAM_NV* = 0x0000891E - GL_TESS_EVALUATION_PROGRAM_NV* = 0x0000891F - GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV* = 0x00008C74 - GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV* = 0x00008C75 # - # GL_NV_vertex_attrib_integer_64bit - # reuse GL_INT64_NV - # reuse - # GL_UNSIGNED_INT64_NV - # - # GL_NV_multisample_coverage - GL_COVERAGE_SAMPLES_NV* = 0x000080A9 - GL_COLOR_SAMPLES_NV* = 0x00008E20 # GL_NV_vdpau_interop - GL_SURFACE_STATE_NV* = 0x000086EB - GL_SURFACE_REGISTERED_NV* = 0x000086FD - GL_SURFACE_MAPPED_NV* = 0x00008700 - GL_WRITE_DISCARD_NV* = 0x000088BE # GL_OML_interlace - GL_INTERLACE_OML* = 0x00008980 - GL_INTERLACE_READ_OML* = 0x00008981 # GL_OML_resample - GL_PACK_RESAMPLE_OML* = 0x00008984 - GL_UNPACK_RESAMPLE_OML* = 0x00008985 - GL_RESAMPLE_REPLICATE_OML* = 0x00008986 - GL_RESAMPLE_ZERO_FILL_OML* = 0x00008987 - GL_RESAMPLE_AVERAGE_OML* = 0x00008988 - GL_RESAMPLE_DECIMATE_OML* = 0x00008989 # GL_OML_subsample - GL_FORMAT_SUBSAMPLE_24_24_OML* = 0x00008982 - GL_FORMAT_SUBSAMPLE_244_244_OML* = 0x00008983 # GL_PGI_misc_hints - GL_PREFER_DOUBLEBUFFER_HINT_PGI* = 0x0001A1F8 - GL_CONSERVE_MEMORY_HINT_PGI* = 0x0001A1FD - GL_RECLAIM_MEMORY_HINT_PGI* = 0x0001A1FE - GL_NATIVE_GRAPHICS_HANDLE_PGI* = 0x0001A202 - GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI* = 0x0001A203 - GL_NATIVE_GRAPHICS_END_HINT_PGI* = 0x0001A204 - GL_ALWAYS_FAST_HINT_PGI* = 0x0001A20C - GL_ALWAYS_SOFT_HINT_PGI* = 0x0001A20D - GL_ALLOW_DRAW_OBJ_HINT_PGI* = 0x0001A20E - GL_ALLOW_DRAW_WIN_HINT_PGI* = 0x0001A20F - GL_ALLOW_DRAW_FRG_HINT_PGI* = 0x0001A210 - GL_ALLOW_DRAW_MEM_HINT_PGI* = 0x0001A211 - GL_STRICT_DEPTHFUNC_HINT_PGI* = 0x0001A216 - GL_STRICT_LIGHTING_HINT_PGI* = 0x0001A217 - GL_STRICT_SCISSOR_HINT_PGI* = 0x0001A218 - GL_FULL_STIPPLE_HINT_PGI* = 0x0001A219 - GL_CLIP_NEAR_HINT_PGI* = 0x0001A220 - GL_CLIP_FAR_HINT_PGI* = 0x0001A221 - GL_WIDE_LINE_HINT_PGI* = 0x0001A222 - GL_BACK_NORMALS_HINT_PGI* = 0x0001A223 # GL_PGI_vertex_hints - GL_VERTEX_DATA_HINT_PGI* = 0x0001A22A - GL_VERTEX_CONSISTENT_HINT_PGI* = 0x0001A22B - GL_MATERIAL_SIDE_HINT_PGI* = 0x0001A22C - GL_MAX_VERTEX_HINT_PGI* = 0x0001A22D - GL_COLOR3_BIT_PGI* = 0x00010000 - GL_COLOR4_BIT_PGI* = 0x00020000 - GL_EDGEFLAG_BIT_PGI* = 0x00040000 - GL_INDEX_BIT_PGI* = 0x00080000 - GL_MAT_AMBIENT_BIT_PGI* = 0x00100000 - GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI* = 0x00200000 - GL_MAT_DIFFUSE_BIT_PGI* = 0x00400000 - GL_MAT_EMISSION_BIT_PGI* = 0x00800000 - GL_MAT_COLOR_INDEXES_BIT_PGI* = 0x01000000 - GL_MAT_SHININESS_BIT_PGI* = 0x02000000 - GL_MAT_SPECULAR_BIT_PGI* = 0x04000000 - GL_NORMAL_BIT_PGI* = 0x08000000 - GL_TEXCOORD1_BIT_PGI* = 0x10000000 - GL_TEXCOORD2_BIT_PGI* = 0x20000000 - GL_TEXCOORD3_BIT_PGI* = 0x40000000 - GL_TEXCOORD4_BIT_PGI* = 0x80000000 - GL_VERTEX23_BIT_PGI* = 0x00000004 - GL_VERTEX4_BIT_PGI* = 0x00000008 # GL_REND_screen_coordinates - GL_SCREEN_COORDINATES_REND* = 0x00008490 - GL_INVERTED_SCREEN_W_REND* = 0x00008491 # GL_S3_s3tc - GL_RGB_S3TC* = 0x000083A0 - GL_RGB4_S3TC* = 0x000083A1 - GL_RGBA_S3TC* = 0x000083A2 - GL_RGBA4_S3TC* = 0x000083A3 # GL_SGIS_detail_texture - GL_DETAIL_TEXTURE_2D_SGIS* = 0x00008095 - GL_DETAIL_TEXTURE_2D_BINDING_SGIS* = 0x00008096 - GL_LINEAR_DETAIL_SGIS* = 0x00008097 - GL_LINEAR_DETAIL_ALPHA_SGIS* = 0x00008098 - GL_LINEAR_DETAIL_COLOR_SGIS* = 0x00008099 - GL_DETAIL_TEXTURE_LEVEL_SGIS* = 0x0000809A - GL_DETAIL_TEXTURE_MODE_SGIS* = 0x0000809B - GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS* = 0x0000809C # GL_SGIS_fog_function - cGL_FOG_FUNC_SGIS* = 0x0000812A - GL_FOG_FUNC_POINTS_SGIS* = 0x0000812B - GL_MAX_FOG_FUNC_POINTS_SGIS* = 0x0000812C # GL_SGIS_generate_mipmap - GL_GENERATE_MIPMAP_SGIS* = 0x00008191 - GL_GENERATE_MIPMAP_HINT_SGIS* = 0x00008192 # GL_SGIS_multisample - GL_MULTISAMPLE_SGIS* = 0x0000809D - GL_SAMPLE_ALPHA_TO_MASK_SGIS* = 0x0000809E - GL_SAMPLE_ALPHA_TO_ONE_SGIS* = 0x0000809F - cGL_SAMPLE_MASK_SGIS* = 0x000080A0 - GL_1PASS_SGIS* = 0x000080A1 - GL_2PASS_0_SGIS* = 0x000080A2 - GL_2PASS_1_SGIS* = 0x000080A3 - GL_4PASS_0_SGIS* = 0x000080A4 - GL_4PASS_1_SGIS* = 0x000080A5 - GL_4PASS_2_SGIS* = 0x000080A6 - GL_4PASS_3_SGIS* = 0x000080A7 - GL_SAMPLE_BUFFERS_SGIS* = 0x000080A8 - GL_SAMPLES_SGIS* = 0x000080A9 - GL_SAMPLE_MASK_VALUE_SGIS* = 0x000080AA - GL_SAMPLE_MASK_INVERT_SGIS* = 0x000080AB - cGL_SAMPLE_PATTERN_SGIS* = 0x000080AC # GL_SGIS_pixel_texture - GL_PIXEL_TEXTURE_SGIS* = 0x00008353 - GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS* = 0x00008354 - GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS* = 0x00008355 - GL_PIXEL_GROUP_COLOR_SGIS* = 0x00008356 # GL_SGIS_point_line_texgen - GL_EYE_DISTANCE_TO_POINT_SGIS* = 0x000081F0 - GL_OBJECT_DISTANCE_TO_POINT_SGIS* = 0x000081F1 - GL_EYE_DISTANCE_TO_LINE_SGIS* = 0x000081F2 - GL_OBJECT_DISTANCE_TO_LINE_SGIS* = 0x000081F3 - GL_EYE_POINT_SGIS* = 0x000081F4 - GL_OBJECT_POINT_SGIS* = 0x000081F5 - GL_EYE_LINE_SGIS* = 0x000081F6 - GL_OBJECT_LINE_SGIS* = 0x000081F7 # GL_SGIS_point_parameters - GL_POINT_SIZE_MIN_SGIS* = 0x00008126 - GL_POINT_SIZE_MAX_SGIS* = 0x00008127 - GL_POINT_FADE_THRESHOLD_SIZE_SGIS* = 0x00008128 - GL_DISTANCE_ATTENUATION_SGIS* = 0x00008129 # GL_SGIS_sharpen_texture - GL_LINEAR_SHARPEN_SGIS* = 0x000080AD - GL_LINEAR_SHARPEN_ALPHA_SGIS* = 0x000080AE - GL_LINEAR_SHARPEN_COLOR_SGIS* = 0x000080AF - GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS* = 0x000080B0 # GL_SGIS_texture4D - GL_PACK_SKIP_VOLUMES_SGIS* = 0x00008130 - GL_PACK_IMAGE_DEPTH_SGIS* = 0x00008131 - GL_UNPACK_SKIP_VOLUMES_SGIS* = 0x00008132 - GL_UNPACK_IMAGE_DEPTH_SGIS* = 0x00008133 - GL_TEXTURE_4D_SGIS* = 0x00008134 - GL_PROXY_TEXTURE_4D_SGIS* = 0x00008135 - GL_TEXTURE_4DSIZE_SGIS* = 0x00008136 - GL_TEXTURE_WRAP_Q_SGIS* = 0x00008137 - GL_MAX_4D_TEXTURE_SIZE_SGIS* = 0x00008138 - GL_TEXTURE_4D_BINDING_SGIS* = 0x0000814F # GL_SGIS_texture_color_mask - GL_TEXTURE_COLOR_WRITEMASK_SGIS* = 0x000081EF # GL_SGIS_texture_edge_clamp - GL_CLAMP_TO_EDGE_SGIS* = 0x0000812F # GL_SGIS_texture_filter4 - GL_FILTER4_SGIS* = 0x00008146 - GL_TEXTURE_FILTER4_SIZE_SGIS* = 0x00008147 # GL_SGIS_texture_lod - GL_TEXTURE_MIN_LOD_SGIS* = 0x0000813A - GL_TEXTURE_MAX_LOD_SGIS* = 0x0000813B - GL_TEXTURE_BASE_LEVEL_SGIS* = 0x0000813C - GL_TEXTURE_MAX_LEVEL_SGIS* = 0x0000813D # GL_SGIS_texture_select - GL_DUAL_ALPHA4_SGIS* = 0x00008110 - GL_DUAL_ALPHA8_SGIS* = 0x00008111 - GL_DUAL_ALPHA12_SGIS* = 0x00008112 - GL_DUAL_ALPHA16_SGIS* = 0x00008113 - GL_DUAL_LUMINANCE4_SGIS* = 0x00008114 - GL_DUAL_LUMINANCE8_SGIS* = 0x00008115 - GL_DUAL_LUMINANCE12_SGIS* = 0x00008116 - GL_DUAL_LUMINANCE16_SGIS* = 0x00008117 - GL_DUAL_INTENSITY4_SGIS* = 0x00008118 - GL_DUAL_INTENSITY8_SGIS* = 0x00008119 - GL_DUAL_INTENSITY12_SGIS* = 0x0000811A - GL_DUAL_INTENSITY16_SGIS* = 0x0000811B - GL_DUAL_LUMINANCE_ALPHA4_SGIS* = 0x0000811C - GL_DUAL_LUMINANCE_ALPHA8_SGIS* = 0x0000811D - GL_QUAD_ALPHA4_SGIS* = 0x0000811E - GL_QUAD_ALPHA8_SGIS* = 0x0000811F - GL_QUAD_LUMINANCE4_SGIS* = 0x00008120 - GL_QUAD_LUMINANCE8_SGIS* = 0x00008121 - GL_QUAD_INTENSITY4_SGIS* = 0x00008122 - GL_QUAD_INTENSITY8_SGIS* = 0x00008123 - GL_DUAL_TEXTURE_SELECT_SGIS* = 0x00008124 - GL_QUAD_TEXTURE_SELECT_SGIS* = 0x00008125 # GL_SGIX_async - cGL_ASYNC_MARKER_SGIX* = 0x00008329 # GL_SGIX_async_histogram - GL_ASYNC_HISTOGRAM_SGIX* = 0x0000832C - GL_MAX_ASYNC_HISTOGRAM_SGIX* = 0x0000832D # GL_SGIX_async_pixel - GL_ASYNC_TEX_IMAGE_SGIX* = 0x0000835C - GL_ASYNC_DRAW_PIXELS_SGIX* = 0x0000835D - GL_ASYNC_READ_PIXELS_SGIX* = 0x0000835E - GL_MAX_ASYNC_TEX_IMAGE_SGIX* = 0x0000835F - GL_MAX_ASYNC_DRAW_PIXELS_SGIX* = 0x00008360 - GL_MAX_ASYNC_READ_PIXELS_SGIX* = 0x00008361 # GL_SGIX_blend_alpha_minmax - GL_ALPHA_MIN_SGIX* = 0x00008320 - GL_ALPHA_MAX_SGIX* = 0x00008321 # GL_SGIX_calligraphic_fragment - GL_CALLIGRAPHIC_FRAGMENT_SGIX* = 0x00008183 # GL_SGIX_clipmap - GL_LINEAR_CLIPMAP_LINEAR_SGIX* = 0x00008170 - GL_TEXTURE_CLIPMAP_CENTER_SGIX* = 0x00008171 - GL_TEXTURE_CLIPMAP_FRAME_SGIX* = 0x00008172 - GL_TEXTURE_CLIPMAP_OFFSET_SGIX* = 0x00008173 - GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX* = 0x00008174 - GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX* = 0x00008175 - GL_TEXTURE_CLIPMAP_DEPTH_SGIX* = 0x00008176 - GL_MAX_CLIPMAP_DEPTH_SGIX* = 0x00008177 - GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX* = 0x00008178 - GL_NEAREST_CLIPMAP_NEAREST_SGIX* = 0x0000844D - GL_NEAREST_CLIPMAP_LINEAR_SGIX* = 0x0000844E - GL_LINEAR_CLIPMAP_NEAREST_SGIX* = 0x0000844F # GL_SGIX_convolution_accuracy - GL_CONVOLUTION_HINT_SGIX* = 0x00008316 # GL_SGIX_depth_texture - GL_DEPTH_COMPONENT16_SGIX* = 0x000081A5 - GL_DEPTH_COMPONENT24_SGIX* = 0x000081A6 - GL_DEPTH_COMPONENT32_SGIX* = 0x000081A7 # GL_SGIX_fog_offset - GL_FOG_OFFSET_SGIX* = 0x00008198 - GL_FOG_OFFSET_VALUE_SGIX* = 0x00008199 # GL_SGIX_fog_scale - GL_FOG_SCALE_SGIX* = 0x000081FC - GL_FOG_SCALE_VALUE_SGIX* = 0x000081FD # GL_SGIX_fragment_lighting - GL_FRAGMENT_LIGHTING_SGIX* = 0x00008400 - cGL_FRAGMENT_COLOR_MATERIAL_SGIX* = 0x00008401 - GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX* = 0x00008402 - GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX* = 0x00008403 - GL_MAX_FRAGMENT_LIGHTS_SGIX* = 0x00008404 - GL_MAX_ACTIVE_LIGHTS_SGIX* = 0x00008405 - GL_CURRENT_RASTER_NORMAL_SGIX* = 0x00008406 - GL_LIGHT_ENV_MODE_SGIX* = 0x00008407 - GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX* = 0x00008408 - GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX* = 0x00008409 - GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX* = 0x0000840A - GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX* = 0x0000840B - GL_FRAGMENT_LIGHT0_SGIX* = 0x0000840C - GL_FRAGMENT_LIGHT1_SGIX* = 0x0000840D - GL_FRAGMENT_LIGHT2_SGIX* = 0x0000840E - GL_FRAGMENT_LIGHT3_SGIX* = 0x0000840F - GL_FRAGMENT_LIGHT4_SGIX* = 0x00008410 - GL_FRAGMENT_LIGHT5_SGIX* = 0x00008411 - GL_FRAGMENT_LIGHT6_SGIX* = 0x00008412 - GL_FRAGMENT_LIGHT7_SGIX* = 0x00008413 # GL_SGIX_framezoom - cGL_FRAMEZOOM_SGIX* = 0x0000818B - GL_FRAMEZOOM_FACTOR_SGIX* = 0x0000818C - GL_MAX_FRAMEZOOM_FACTOR_SGIX* = 0x0000818D # GL_SGIX_impact_pixel_texture - GL_PIXEL_TEX_GEN_Q_CEILING_SGIX* = 0x00008184 - GL_PIXEL_TEX_GEN_Q_ROUND_SGIX* = 0x00008185 - GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX* = 0x00008186 - GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX* = 0x00008187 - GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX* = 0x00008188 - GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX* = 0x00008189 - GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX* = 0x0000818A # GL_SGIX_instruments - GL_INSTRUMENT_BUFFER_POINTER_SGIX* = 0x00008180 - GL_INSTRUMENT_MEASUREMENTS_SGIX* = 0x00008181 # GL_SGIX_interlace - GL_INTERLACE_SGIX* = 0x00008094 # GL_SGIX_ir_instrument1 - GL_IR_INSTRUMENT1_SGIX* = 0x0000817F # GL_SGIX_list_priority - GL_LIST_PRIORITY_SGIX* = 0x00008182 # GL_SGIX_pixel_texture - cGL_PIXEL_TEX_GEN_SGIX* = 0x00008139 - GL_PIXEL_TEX_GEN_MODE_SGIX* = 0x0000832B # GL_SGIX_pixel_tiles - GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX* = 0x0000813E - GL_PIXEL_TILE_CACHE_INCREMENT_SGIX* = 0x0000813F - GL_PIXEL_TILE_WIDTH_SGIX* = 0x00008140 - GL_PIXEL_TILE_HEIGHT_SGIX* = 0x00008141 - GL_PIXEL_TILE_GRID_WIDTH_SGIX* = 0x00008142 - GL_PIXEL_TILE_GRID_HEIGHT_SGIX* = 0x00008143 - GL_PIXEL_TILE_GRID_DEPTH_SGIX* = 0x00008144 - GL_PIXEL_TILE_CACHE_SIZE_SGIX* = 0x00008145 # GL_SGIX_polynomial_ffd - GL_GEOMETRY_DEFORMATION_SGIX* = 0x00008194 - GL_TEXTURE_DEFORMATION_SGIX* = 0x00008195 - GL_DEFORMATIONS_MASK_SGIX* = 0x00008196 - GL_MAX_DEFORMATION_ORDER_SGIX* = 0x00008197 # GL_SGIX_reference_plane - cGL_REFERENCE_PLANE_SGIX* = 0x0000817D - GL_REFERENCE_PLANE_EQUATION_SGIX* = 0x0000817E # GL_SGIX_resample - GL_PACK_RESAMPLE_SGIX* = 0x0000842C - GL_UNPACK_RESAMPLE_SGIX* = 0x0000842D - GL_RESAMPLE_REPLICATE_SGIX* = 0x0000842E - GL_RESAMPLE_ZERO_FILL_SGIX* = 0x0000842F - GL_RESAMPLE_DECIMATE_SGIX* = 0x00008430 # GL_SGIX_scalebias_hint - GL_SCALEBIAS_HINT_SGIX* = 0x00008322 # GL_SGIX_shadow - GL_TEXTURE_COMPARE_SGIX* = 0x0000819A - GL_TEXTURE_COMPARE_OPERATOR_SGIX* = 0x0000819B - GL_TEXTURE_LEQUAL_R_SGIX* = 0x0000819C - GL_TEXTURE_GEQUAL_R_SGIX* = 0x0000819D # GL_SGIX_shadow_ambient - GL_SHADOW_AMBIENT_SGIX* = 0x000080BF # GL_SGIX_sprite - GL_SPRITE_SGIX* = 0x00008148 - GL_SPRITE_MODE_SGIX* = 0x00008149 - GL_SPRITE_AXIS_SGIX* = 0x0000814A - GL_SPRITE_TRANSLATION_SGIX* = 0x0000814B - GL_SPRITE_AXIAL_SGIX* = 0x0000814C - GL_SPRITE_OBJECT_ALIGNED_SGIX* = 0x0000814D - GL_SPRITE_EYE_ALIGNED_SGIX* = 0x0000814E # GL_SGIX_subsample - GL_PACK_SUBSAMPLE_RATE_SGIX* = 0x000085A0 - GL_UNPACK_SUBSAMPLE_RATE_SGIX* = 0x000085A1 - GL_PIXEL_SUBSAMPLE_4444_SGIX* = 0x000085A2 - GL_PIXEL_SUBSAMPLE_2424_SGIX* = 0x000085A3 - GL_PIXEL_SUBSAMPLE_4242_SGIX* = 0x000085A4 # GL_SGIX_texture_add_env - GL_TEXTURE_ENV_BIAS_SGIX* = 0x000080BE # GL_SGIX_texture_coordinate_clamp - GL_TEXTURE_MAX_CLAMP_S_SGIX* = 0x00008369 - GL_TEXTURE_MAX_CLAMP_T_SGIX* = 0x0000836A - GL_TEXTURE_MAX_CLAMP_R_SGIX* = 0x0000836B # GL_SGIX_texture_lod_bias - GL_TEXTURE_LOD_BIAS_S_SGIX* = 0x0000818E - GL_TEXTURE_LOD_BIAS_T_SGIX* = 0x0000818F - GL_TEXTURE_LOD_BIAS_R_SGIX* = 0x00008190 # GL_SGIX_texture_multi_buffer - GL_TEXTURE_MULTI_BUFFER_HINT_SGIX* = 0x0000812E # GL_SGIX_texture_scale_bias - GL_POST_TEXTURE_FILTER_BIAS_SGIX* = 0x00008179 - GL_POST_TEXTURE_FILTER_SCALE_SGIX* = 0x0000817A - GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX* = 0x0000817B - GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX* = 0x0000817C # GL_SGIX_vertex_preclip - GL_VERTEX_PRECLIP_SGIX* = 0x000083EE - GL_VERTEX_PRECLIP_HINT_SGIX* = 0x000083EF # GL_SGIX_ycrcb - GL_YCRCB_422_SGIX* = 0x000081BB - GL_YCRCB_444_SGIX* = 0x000081BC # GL_SGIX_ycrcba - GL_YCRCB_SGIX* = 0x00008318 - GL_YCRCBA_SGIX* = 0x00008319 # GL_SGI_color_matrix - GL_COLOR_MATRIX_SGI* = 0x000080B1 - GL_COLOR_MATRIX_STACK_DEPTH_SGI* = 0x000080B2 - GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI* = 0x000080B3 - GL_POST_COLOR_MATRIX_RED_SCALE_SGI* = 0x000080B4 - GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI* = 0x000080B5 - GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI* = 0x000080B6 - GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI* = 0x000080B7 - GL_POST_COLOR_MATRIX_RED_BIAS_SGI* = 0x000080B8 - GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI* = 0x000080B9 - GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI* = 0x000080BA - GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI* = 0x000080BB # GL_SGI_color_table - cGL_COLOR_TABLE_SGI* = 0x000080D0 - GL_POST_CONVOLUTION_COLOR_TABLE_SGI* = 0x000080D1 - GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI* = 0x000080D2 - GL_PROXY_COLOR_TABLE_SGI* = 0x000080D3 - GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI* = 0x000080D4 - GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI* = 0x000080D5 - GL_COLOR_TABLE_SCALE_SGI* = 0x000080D6 - GL_COLOR_TABLE_BIAS_SGI* = 0x000080D7 - GL_COLOR_TABLE_FORMAT_SGI* = 0x000080D8 - GL_COLOR_TABLE_WIDTH_SGI* = 0x000080D9 - GL_COLOR_TABLE_RED_SIZE_SGI* = 0x000080DA - GL_COLOR_TABLE_GREEN_SIZE_SGI* = 0x000080DB - GL_COLOR_TABLE_BLUE_SIZE_SGI* = 0x000080DC - GL_COLOR_TABLE_ALPHA_SIZE_SGI* = 0x000080DD - GL_COLOR_TABLE_LUMINANCE_SIZE_SGI* = 0x000080DE - GL_COLOR_TABLE_INTENSITY_SIZE_SGI* = 0x000080DF # GL_SGI_depth_pass_instrument - GL_DEPTH_PASS_INSTRUMENT_SGIX* = 0x00008310 - GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX* = 0x00008311 - GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX* = 0x00008312 # GL_SGI_texture_color_table - GL_TEXTURE_COLOR_TABLE_SGI* = 0x000080BC - GL_PROXY_TEXTURE_COLOR_TABLE_SGI* = 0x000080BD # GL_SUNX_constant_data - GL_UNPACK_CONSTANT_DATA_SUNX* = 0x000081D5 - GL_TEXTURE_CONSTANT_DATA_SUNX* = 0x000081D6 # GL_SUN_convolution_border_modes - GL_WRAP_BORDER_SUN* = 0x000081D4 # GL_SUN_global_alpha - GL_GLOBAL_ALPHA_SUN* = 0x000081D9 - GL_GLOBAL_ALPHA_FACTOR_SUN* = 0x000081DA # GL_SUN_mesh_array - GL_QUAD_MESH_SUN* = 0x00008614 - GL_TRIANGLE_MESH_SUN* = 0x00008615 # GL_SUN_slice_accum - GL_SLICE_ACCUM_SUN* = 0x000085CC # GL_SUN_triangle_list - GL_RESTART_SUN* = 0x00000001 - GL_REPLACE_MIDDLE_SUN* = 0x00000002 - GL_REPLACE_OLDEST_SUN* = 0x00000003 - GL_TRIANGLE_LIST_SUN* = 0x000081D7 - GL_REPLACEMENT_CODE_SUN* = 0x000081D8 - GL_REPLACEMENT_CODE_ARRAY_SUN* = 0x000085C0 - GL_REPLACEMENT_CODE_ARRAYtyp_SUN* = 0x000085C1 - GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN* = 0x000085C2 - GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN* = 0x000085C3 - GL_R1UI_V3F_SUN* = 0x000085C4 - GL_R1UI_C4UB_V3F_SUN* = 0x000085C5 - GL_R1UI_C3F_V3F_SUN* = 0x000085C6 - GL_R1UI_N3F_V3F_SUN* = 0x000085C7 - GL_R1UI_C4F_N3F_V3F_SUN* = 0x000085C8 - GL_R1UI_T2F_V3F_SUN* = 0x000085C9 - GL_R1UI_T2F_N3F_V3F_SUN* = 0x000085CA - GL_R1UI_T2F_C4F_N3F_V3F_SUN* = 0x000085CB # GL_WIN_phong_shading - GL_PHONG_WIN* = 0x000080EA - GL_PHONG_HINT_WIN* = 0x000080EB # GL_WIN_specular_fog - GL_FOG_SPECULAR_TEXTURE_WIN* = 0x000080EC # GL_ARB_vertex_shader - GL_VERTEX_SHADER_ARB* = 0x00008B31 - GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB* = 0x00008B4A - GL_MAX_VARYING_FLOATS_ARB* = 0x00008B4B - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB* = 0x00008B4C - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB* = 0x00008B4D - GL_OBJECT_ACTIVE_ATTRIBUTES_ARB* = 0x00008B89 - GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB* = 0x00008B8A # GL_ARB_fragment_shader - GL_FRAGMENT_SHADER_ARB* = 0x00008B30 - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB* = 0x00008B49 # 1.4 - GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB* = 0x00008B8B # 1.4 - # GL_ARB_occlusion_query - GL_SAMPLES_PASSED_ARB* = 0x00008914 - GL_QUERY_COUNTER_BITS_ARB* = 0x00008864 - GL_CURRENT_QUERY_ARB* = 0x00008865 - GL_QUERY_RESULT_ARB* = 0x00008866 - GL_QUERY_RESULT_AVAILABLE_ARB* = 0x00008867 # GL_ARB_point_sprite - GL_POINT_SPRITE_ARB* = 0x00008861 - GL_COORD_REPLACE_ARB* = 0x00008862 # GL_ARB_shading_language_100 - GL_SHADING_LANGUAGE_VERSION_ARB* = 0x00008B8C # 1.4 - # GL_ARB_shader_objects - GL_PROGRAM_OBJECT_ARB* = 0x00008B40 - GL_OBJECTtyp_ARB* = 0x00008B4E - GL_OBJECT_SUBtypARB* = 0x00008B4F - GL_OBJECT_DELETE_STATUS_ARB* = 0x00008B80 - GL_OBJECT_COMPILE_STATUS_ARB* = 0x00008B81 - GL_OBJECT_LINK_STATUS_ARB* = 0x00008B82 - GL_OBJECT_VALIDATE_STATUS_ARB* = 0x00008B83 - GL_OBJECT_INFO_LOG_LENGTH_ARB* = 0x00008B84 - GL_OBJECT_ATTACHED_OBJECTS_ARB* = 0x00008B85 - GL_OBJECT_ACTIVE_UNIFORMS_ARB* = 0x00008B86 - GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB* = 0x00008B87 - GL_OBJECT_SHADER_SOURCE_LENGTH_ARB* = 0x00008B88 - GL_SHADER_OBJECT_ARB* = 0x00008B48 - GL_FLOAT_VEC2_ARB* = 0x00008B50 - GL_FLOAT_VEC3_ARB* = 0x00008B51 - GL_FLOAT_VEC4_ARB* = 0x00008B52 - GL_INT_VEC2_ARB* = 0x00008B53 - GL_INT_VEC3_ARB* = 0x00008B54 - GL_INT_VEC4_ARB* = 0x00008B55 - GL_BOOL_ARB* = 0x00008B56 - GL_BOOL_VEC2_ARB* = 0x00008B57 - GL_BOOL_VEC3_ARB* = 0x00008B58 - GL_BOOL_VEC4_ARB* = 0x00008B59 - GL_FLOAT_MAT2_ARB* = 0x00008B5A - GL_FLOAT_MAT3_ARB* = 0x00008B5B - GL_FLOAT_MAT4_ARB* = 0x00008B5C - GL_SAMPLER_1D_ARB* = 0x00008B5D - GL_SAMPLER_2D_ARB* = 0x00008B5E - GL_SAMPLER_3D_ARB* = 0x00008B5F - GL_SAMPLER_CUBE_ARB* = 0x00008B60 - GL_SAMPLER_1D_SHADOW_ARB* = 0x00008B61 - GL_SAMPLER_2D_SHADOW_ARB* = 0x00008B62 - GL_SAMPLER_2D_RECT_ARB* = 0x00008B63 - GL_SAMPLER_2D_RECT_SHADOW_ARB* = 0x00008B64 # WGL_3DFX_multisample - WGL_SAMPLE_BUFFERS_3DFX* = 0x00002060 - WGL_SAMPLES_3DFX* = 0x00002061 # WGL_ARB_buffer_region - WGL_FRONT_COLOR_BUFFER_BIT_ARB* = 0x00000001 - WGL_BACK_COLOR_BUFFER_BIT_ARB* = 0x00000002 - WGL_DEPTH_BUFFER_BIT_ARB* = 0x00000004 - WGL_STENCIL_BUFFER_BIT_ARB* = 0x00000008 # WGL_ARB_make_current_read - ERROR_INVALID_PIXELtyp_ARB* = 0x00002043 - ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB* = 0x00002054 # WGL_ARB_multisample - WGL_SAMPLE_BUFFERS_ARB* = 0x00002041 - WGL_SAMPLES_ARB* = 0x00002042 # WGL_ARB_pbuffer - WGL_DRAW_TO_PBUFFER_ARB* = 0x0000202D - WGL_MAX_PBUFFER_PIXELS_ARB* = 0x0000202E - WGL_MAX_PBUFFER_WIDTH_ARB* = 0x0000202F - WGL_MAX_PBUFFER_HEIGHT_ARB* = 0x00002030 - WGL_PBUFFER_LARGEST_ARB* = 0x00002033 - WGL_PBUFFER_WIDTH_ARB* = 0x00002034 - WGL_PBUFFER_HEIGHT_ARB* = 0x00002035 - WGL_PBUFFER_LOST_ARB* = 0x00002036 # WGL_ARB_pixel_format - WGL_NUMBER_PIXEL_FORMATS_ARB* = 0x00002000 - WGL_DRAW_TO_WINDOW_ARB* = 0x00002001 - WGL_DRAW_TO_BITMAP_ARB* = 0x00002002 - WGL_ACCELERATION_ARB* = 0x00002003 - WGL_NEED_PALETTE_ARB* = 0x00002004 - WGL_NEED_SYSTEM_PALETTE_ARB* = 0x00002005 - WGL_SWAP_LAYER_BUFFERS_ARB* = 0x00002006 - WGL_SWAP_METHOD_ARB* = 0x00002007 - WGL_NUMBER_OVERLAYS_ARB* = 0x00002008 - WGL_NUMBER_UNDERLAYS_ARB* = 0x00002009 - WGL_TRANSPARENT_ARB* = 0x0000200A - WGL_TRANSPARENT_RED_VALUE_ARB* = 0x00002037 - WGL_TRANSPARENT_GREEN_VALUE_ARB* = 0x00002038 - WGL_TRANSPARENT_BLUE_VALUE_ARB* = 0x00002039 - WGL_TRANSPARENT_ALPHA_VALUE_ARB* = 0x0000203A - WGL_TRANSPARENT_INDEX_VALUE_ARB* = 0x0000203B - WGL_SHARE_DEPTH_ARB* = 0x0000200C - WGL_SHARE_STENCIL_ARB* = 0x0000200D - WGL_SHARE_ACCUM_ARB* = 0x0000200E - WGL_SUPPORT_GDI_ARB* = 0x0000200F - WGL_SUPPORT_OPENGL_ARB* = 0x00002010 - WGL_DOUBLE_BUFFER_ARB* = 0x00002011 - WGL_STEREO_ARB* = 0x00002012 - WGL_PIXELtyp_ARB* = 0x00002013 - WGL_COLOR_BITS_ARB* = 0x00002014 - WGL_RED_BITS_ARB* = 0x00002015 - WGL_RED_SHIFT_ARB* = 0x00002016 - WGL_GREEN_BITS_ARB* = 0x00002017 - WGL_GREEN_SHIFT_ARB* = 0x00002018 - WGL_BLUE_BITS_ARB* = 0x00002019 - WGL_BLUE_SHIFT_ARB* = 0x0000201A - WGL_ALPHA_BITS_ARB* = 0x0000201B - WGL_ALPHA_SHIFT_ARB* = 0x0000201C - WGL_ACCUM_BITS_ARB* = 0x0000201D - WGL_ACCUM_RED_BITS_ARB* = 0x0000201E - WGL_ACCUM_GREEN_BITS_ARB* = 0x0000201F - WGL_ACCUM_BLUE_BITS_ARB* = 0x00002020 - WGL_ACCUM_ALPHA_BITS_ARB* = 0x00002021 - WGL_DEPTH_BITS_ARB* = 0x00002022 - WGL_STENCIL_BITS_ARB* = 0x00002023 - WGL_AUX_BUFFERS_ARB* = 0x00002024 - WGL_NO_ACCELERATION_ARB* = 0x00002025 - WGL_GENERIC_ACCELERATION_ARB* = 0x00002026 - WGL_FULL_ACCELERATION_ARB* = 0x00002027 - WGL_SWAP_EXCHANGE_ARB* = 0x00002028 - WGL_SWAP_COPY_ARB* = 0x00002029 - WGL_SWAP_UNDEFINED_ARB* = 0x0000202A - WGLtyp_RGBA_ARB* = 0x0000202B - WGLtyp_COLORINDEX_ARB* = 0x0000202C # WGL_ARB_pixel_format_float - WGL_RGBA_FLOAT_MODE_ARB* = 0x00008820 - WGL_CLAMP_VERTEX_COLOR_ARB* = 0x0000891A - WGL_CLAMP_FRAGMENT_COLOR_ARB* = 0x0000891B - WGL_CLAMP_READ_COLOR_ARB* = 0x0000891C - WGL_FIXED_ONLY_ARB* = 0x0000891D # WGL_ARB_render_texture - WGL_BIND_TO_TEXTURE_RGB_ARB* = 0x00002070 - WGL_BIND_TO_TEXTURE_RGBA_ARB* = 0x00002071 - WGL_TEXTURE_FORMAT_ARB* = 0x00002072 - WGL_TEXTURE_TARGET_ARB* = 0x00002073 - WGL_MIPMAP_TEXTURE_ARB* = 0x00002074 - WGL_TEXTURE_RGB_ARB* = 0x00002075 - WGL_TEXTURE_RGBA_ARB* = 0x00002076 - WGL_NO_TEXTURE_ARB* = 0x00002077 - WGL_TEXTURE_CUBE_MAP_ARB* = 0x00002078 - WGL_TEXTURE_1D_ARB* = 0x00002079 - WGL_TEXTURE_2D_ARB* = 0x0000207A - WGL_MIPMAP_LEVEL_ARB* = 0x0000207B - WGL_CUBE_MAP_FACE_ARB* = 0x0000207C - WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB* = 0x0000207D - WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB* = 0x0000207E - WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB* = 0x0000207F - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB* = 0x00002080 - WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB* = 0x00002081 - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB* = 0x00002082 - WGL_FRONT_LEFT_ARB* = 0x00002083 - WGL_FRONT_RIGHT_ARB* = 0x00002084 - WGL_BACK_LEFT_ARB* = 0x00002085 - WGL_BACK_RIGHT_ARB* = 0x00002086 - WGL_AUX0_ARB* = 0x00002087 - WGL_AUX1_ARB* = 0x00002088 - WGL_AUX2_ARB* = 0x00002089 - WGL_AUX3_ARB* = 0x0000208A - WGL_AUX4_ARB* = 0x0000208B - WGL_AUX5_ARB* = 0x0000208C - WGL_AUX6_ARB* = 0x0000208D - WGL_AUX7_ARB* = 0x0000208E - WGL_AUX8_ARB* = 0x0000208F - WGL_AUX9_ARB* = 0x00002090 # WGL_ARB_create_context - WGL_CONTEXT_DEBUG_BIT_ARB* = 0x00000001 - WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB* = 0x00000002 - WGL_CONTEXT_MAJOR_VERSION_ARB* = 0x00002091 - WGL_CONTEXT_MINOR_VERSION_ARB* = 0x00002092 - WGL_CONTEXT_LAYER_PLANE_ARB* = 0x00002093 - WGL_CONTEXT_FLAGS_ARB* = 0x00002094 - ERROR_INVALID_VERSION_ARB* = 0x00002095 # WGL_ARB_create_context_profile - WGL_CONTEXT_PROFILE_MASK_ARB* = 0x00009126 - WGL_CONTEXT_CORE_PROFILE_BIT_ARB* = 0x00000001 - WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB* = 0x00000002 - ERROR_INVALID_PROFILE_ARB* = 0x00002096 # WGL_ARB_framebuffer_sRGB - WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB* = 0x000020A9 # - # WGL_ARB_create_context_robustness - WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB* = 0x00000004 - WGL_LOSE_CONTEXT_ON_RESET_ARB* = 0x00008252 - WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB* = 0x00008256 - WGL_NO_RESET_NOTIFICATION_ARB* = 0x00008261 # WGL_ATI_pixel_format_float - WGLtyp_RGBA_FLOAT_ATI* = 0x000021A0 - GLtyp_RGBA_FLOAT_ATI* = 0x00008820 - GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI* = 0x00008835 # WGL_AMD_gpu_association - WGL_GPU_VENDOR_AMD* = 0x00001F00 - WGL_GPU_RENDERER_STRING_AMD* = 0x00001F01 - WGL_GPU_OPENGL_VERSION_STRING_AMD* = 0x00001F02 - WGL_GPU_FASTEST_TARGET_GPUS_AMD* = 0x000021A2 - WGL_GPU_RAM_AMD* = 0x000021A3 - WGL_GPU_CLOCK_AMD* = 0x000021A4 - WGL_GPU_NUM_PIPES_AMD* = 0x000021A5 - WGL_GPU_NUM_SIMD_AMD* = 0x000021A6 - WGL_GPU_NUM_RB_AMD* = 0x000021A7 - WGL_GPU_NUM_SPI_AMD* = 0x000021A8 # WGL_EXT_depth_float - WGL_DEPTH_FLOAT_EXT* = 0x00002040 # WGL_EXT_make_current_read - ERROR_INVALID_PIXELtyp_EXT* = 0x00002043 # WGL_EXT_multisample - WGL_SAMPLE_BUFFERS_EXT* = 0x00002041 - WGL_SAMPLES_EXT* = 0x00002042 # WGL_EXT_pbuffer - WGL_DRAW_TO_PBUFFER_EXT* = 0x0000202D - WGL_MAX_PBUFFER_PIXELS_EXT* = 0x0000202E - WGL_MAX_PBUFFER_WIDTH_EXT* = 0x0000202F - WGL_MAX_PBUFFER_HEIGHT_EXT* = 0x00002030 - WGL_OPTIMAL_PBUFFER_WIDTH_EXT* = 0x00002031 - WGL_OPTIMAL_PBUFFER_HEIGHT_EXT* = 0x00002032 - WGL_PBUFFER_LARGEST_EXT* = 0x00002033 - WGL_PBUFFER_WIDTH_EXT* = 0x00002034 - WGL_PBUFFER_HEIGHT_EXT* = 0x00002035 # WGL_EXT_pixel_format - WGL_NUMBER_PIXEL_FORMATS_EXT* = 0x00002000 - WGL_DRAW_TO_WINDOW_EXT* = 0x00002001 - WGL_DRAW_TO_BITMAP_EXT* = 0x00002002 - WGL_ACCELERATION_EXT* = 0x00002003 - WGL_NEED_PALETTE_EXT* = 0x00002004 - WGL_NEED_SYSTEM_PALETTE_EXT* = 0x00002005 - WGL_SWAP_LAYER_BUFFERS_EXT* = 0x00002006 - WGL_SWAP_METHOD_EXT* = 0x00002007 - WGL_NUMBER_OVERLAYS_EXT* = 0x00002008 - WGL_NUMBER_UNDERLAYS_EXT* = 0x00002009 - WGL_TRANSPARENT_EXT* = 0x0000200A - WGL_TRANSPARENT_VALUE_EXT* = 0x0000200B - WGL_SHARE_DEPTH_EXT* = 0x0000200C - WGL_SHARE_STENCIL_EXT* = 0x0000200D - WGL_SHARE_ACCUM_EXT* = 0x0000200E - WGL_SUPPORT_GDI_EXT* = 0x0000200F - WGL_SUPPORT_OPENGL_EXT* = 0x00002010 - WGL_DOUBLE_BUFFER_EXT* = 0x00002011 - WGL_STEREO_EXT* = 0x00002012 - WGL_PIXELtyp_EXT* = 0x00002013 - WGL_COLOR_BITS_EXT* = 0x00002014 - WGL_RED_BITS_EXT* = 0x00002015 - WGL_RED_SHIFT_EXT* = 0x00002016 - WGL_GREEN_BITS_EXT* = 0x00002017 - WGL_GREEN_SHIFT_EXT* = 0x00002018 - WGL_BLUE_BITS_EXT* = 0x00002019 - WGL_BLUE_SHIFT_EXT* = 0x0000201A - WGL_ALPHA_BITS_EXT* = 0x0000201B - WGL_ALPHA_SHIFT_EXT* = 0x0000201C - WGL_ACCUM_BITS_EXT* = 0x0000201D - WGL_ACCUM_RED_BITS_EXT* = 0x0000201E - WGL_ACCUM_GREEN_BITS_EXT* = 0x0000201F - WGL_ACCUM_BLUE_BITS_EXT* = 0x00002020 - WGL_ACCUM_ALPHA_BITS_EXT* = 0x00002021 - WGL_DEPTH_BITS_EXT* = 0x00002022 - WGL_STENCIL_BITS_EXT* = 0x00002023 - WGL_AUX_BUFFERS_EXT* = 0x00002024 - WGL_NO_ACCELERATION_EXT* = 0x00002025 - WGL_GENERIC_ACCELERATION_EXT* = 0x00002026 - WGL_FULL_ACCELERATION_EXT* = 0x00002027 - WGL_SWAP_EXCHANGE_EXT* = 0x00002028 - WGL_SWAP_COPY_EXT* = 0x00002029 - WGL_SWAP_UNDEFINED_EXT* = 0x0000202A - WGLtyp_RGBA_EXT* = 0x0000202B - WGLtyp_COLORINDEX_EXT* = 0x0000202C # WGL_I3D_digital_video_control - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D* = 0x00002050 - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D* = 0x00002051 - WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D* = 0x00002052 - WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D* = 0x00002053 # WGL_I3D_gamma - WGL_GAMMA_TABLE_SIZE_I3D* = 0x0000204E - WGL_GAMMA_EXCLUDE_DESKTOP_I3D* = 0x0000204F # WGL_I3D_genlock - WGL_GENLOCK_SOURCE_MULTIVIEW_I3D* = 0x00002044 - WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D* = 0x00002045 - WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D* = 0x00002046 - WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D* = 0x00002047 - WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D* = 0x00002048 - WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D* = 0x00002049 - WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D* = 0x0000204A - WGL_GENLOCK_SOURCE_EDGE_RISING_I3D* = 0x0000204B - WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D* = 0x0000204C # WGL_I3D_image_buffer - WGL_IMAGE_BUFFER_MIN_ACCESS_I3D* = 0x00000001 - WGL_IMAGE_BUFFER_LOCK_I3D* = 0x00000002 # WGL_NV_float_buffer - WGL_FLOAT_COMPONENTS_NV* = 0x000020B0 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV* = 0x000020B1 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV* = 0x000020B2 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV* = 0x000020B3 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV* = 0x000020B4 - WGL_TEXTURE_FLOAT_R_NV* = 0x000020B5 - WGL_TEXTURE_FLOAT_RG_NV* = 0x000020B6 - WGL_TEXTURE_FLOAT_RGB_NV* = 0x000020B7 - WGL_TEXTURE_FLOAT_RGBA_NV* = 0x000020B8 # WGL_NV_render_depth_texture - WGL_BIND_TO_TEXTURE_DEPTH_NV* = 0x000020A3 - WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV* = 0x000020A4 - WGL_DEPTH_TEXTURE_FORMAT_NV* = 0x000020A5 - WGL_TEXTURE_DEPTH_COMPONENT_NV* = 0x000020A6 - WGL_DEPTH_COMPONENT_NV* = 0x000020A7 # WGL_NV_render_texture_rectangle - WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV* = 0x000020A0 - WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV* = 0x000020A1 - WGL_TEXTURE_RECTANGLE_NV* = 0x000020A2 # WGL_NV_present_video - WGL_NUM_VIDEO_SLOTS_NV* = 0x000020F0 # WGL_NV_video_output - WGL_BIND_TO_VIDEO_RGB_NV* = 0x000020C0 - WGL_BIND_TO_VIDEO_RGBA_NV* = 0x000020C1 - WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV* = 0x000020C2 - WGL_VIDEO_OUT_COLOR_NV* = 0x000020C3 - WGL_VIDEO_OUT_ALPHA_NV* = 0x000020C4 - WGL_VIDEO_OUT_DEPTH_NV* = 0x000020C5 - WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV* = 0x000020C6 - WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV* = 0x000020C7 - WGL_VIDEO_OUT_FRAME* = 0x000020C8 - WGL_VIDEO_OUT_FIELD_1* = 0x000020C9 - WGL_VIDEO_OUT_FIELD_2* = 0x000020CA - WGL_VIDEO_OUT_STACKED_FIELDS_1_2* = 0x000020CB - WGL_VIDEO_OUT_STACKED_FIELDS_2_1* = 0x000020CC # WGL_NV_gpu_affinity - WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV* = 0x000020D0 - WGL_ERROR_MISSING_AFFINITY_MASK_NV* = 0x000020D1 # WGL_NV_video_capture - WGL_UNIQUE_ID_NV* = 0x000020CE - WGL_NUM_VIDEO_CAPTURE_SLOTS_NV* = 0x000020CF # WGL_NV_multisample_coverage - WGL_COVERAGE_SAMPLES_NV* = 0x00002042 - WGL_COLOR_SAMPLES_NV* = 0x000020B9 # WGL_EXT_create_context_es2_profile - WGL_CONTEXT_ES2_PROFILE_BIT_EXT* = 0x00000004 # WGL_NV_DX_interop - WGL_ACCESS_READ_ONLY_NV* = 0x00000000 - WGL_ACCESS_READ_WRITE_NV* = 0x00000001 - WGL_ACCESS_WRITE_DISCARD_NV* = 0x00000002 # WIN_draw_range_elements - GL_MAX_ELEMENTS_VERTICES_WIN* = 0x000080E8 - GL_MAX_ELEMENTS_INDICES_WIN* = 0x000080E9 # GLX 1.1 and later: - GLX_VENDOR* = 1 - GLX_VERSION* = 2 - GLX_EXTENSIONS* = 3 - 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_VERSION_1_3 - GLX_WINDOW_BIT* = 0x00000001 - GLX_PIXMAP_BIT* = 0x00000002 - GLX_PBUFFER_BIT* = 0x00000004 - GLX_RGBA_BIT* = 0x00000001 - GLX_COLOR_INDEX_BIT* = 0x00000002 - GLX_PBUFFER_CLOBBER_MASK* = 0x08000000 - GLX_FRONT_LEFT_BUFFER_BIT* = 0x00000001 - GLX_FRONT_RIGHT_BUFFER_BIT* = 0x00000002 - GLX_BACK_LEFT_BUFFER_BIT* = 0x00000004 - GLX_BACK_RIGHT_BUFFER_BIT* = 0x00000008 - GLX_AUX_BUFFERS_BIT* = 0x00000010 - GLX_DEPTH_BUFFER_BIT* = 0x00000020 - GLX_STENCIL_BUFFER_BIT* = 0x00000040 - GLX_ACCUM_BUFFER_BIT* = 0x00000080 - GLX_CONFIG_CAVEAT* = 0x00000020 - GLX_X_VISUALtyp* = 0x00000022 - GLX_TRANSPARENTtyp* = 0x00000023 - GLX_TRANSPARENT_INDEX_VALUE* = 0x00000024 - GLX_TRANSPARENT_RED_VALUE* = 0x00000025 - GLX_TRANSPARENT_GREEN_VALUE* = 0x00000026 - GLX_TRANSPARENT_BLUE_VALUE* = 0x00000027 - GLX_TRANSPARENT_ALPHA_VALUE* = 0x00000028 - GLX_DONT_CARE* = 0xFFFFFFFF - GLX_NONE* = 0x00008000 - GLX_SLOW_CONFIG* = 0x00008001 - GLX_TRUE_COLOR* = 0x00008002 - GLX_DIRECT_COLOR* = 0x00008003 - GLX_PSEUDO_COLOR* = 0x00008004 - GLX_STATIC_COLOR* = 0x00008005 - GLX_GRAY_SCALE* = 0x00008006 - GLX_STATIC_GRAY* = 0x00008007 - GLX_TRANSPARENT_RGB* = 0x00008008 - GLX_TRANSPARENT_INDEX* = 0x00008009 - GLX_VISUAL_ID* = 0x0000800B - GLX_SCREEN* = 0x0000800C - GLX_NON_CONFORMANT_CONFIG* = 0x0000800D - GLX_DRAWABLEtyp* = 0x00008010 - GLX_RENDERtyp* = 0x00008011 - GLX_X_RENDERABLE* = 0x00008012 - GLX_FBCONFIG_ID* = 0x00008013 - GLX_RGBAtyp* = 0x00008014 - GLX_COLOR_INDEXtyp* = 0x00008015 - GLX_MAX_PBUFFER_WIDTH* = 0x00008016 - GLX_MAX_PBUFFER_HEIGHT* = 0x00008017 - GLX_MAX_PBUFFER_PIXELS* = 0x00008018 - GLX_PRESERVED_CONTENTS* = 0x0000801B - GLX_LARGEST_PBUFFER* = 0x0000801C - GLX_WIDTH* = 0x0000801D - GLX_HEIGHT* = 0x0000801E - GLX_EVENT_MASK* = 0x0000801F - GLX_DAMAGED* = 0x00008020 - GLX_SAVED* = 0x00008021 - cGLX_WINDOW* = 0x00008022 - cGLX_PBUFFER* = 0x00008023 - GLX_PBUFFER_HEIGHT* = 0x00008040 - GLX_PBUFFER_WIDTH* = 0x00008041 # GLX_VERSION_1_4 - GLX_SAMPLE_BUFFERS* = 100000 - GLX_SAMPLES* = 100001 # GLX_ARB_multisample - GLX_SAMPLE_BUFFERS_ARB* = 100000 - GLX_SAMPLES_ARB* = 100001 # GLX_ARB_fbconfig_float - GLX_RGBA_FLOATtyp_ARB* = 0x000020B9 - GLX_RGBA_FLOAT_BIT_ARB* = 0x00000004 # GLX_ARB_create_context - GLX_CONTEXT_DEBUG_BIT_ARB* = 0x00000001 - GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB* = 0x00000002 - GLX_CONTEXT_MAJOR_VERSION_ARB* = 0x00002091 - GLX_CONTEXT_MINOR_VERSION_ARB* = 0x00002092 - GLX_CONTEXT_FLAGS_ARB* = 0x00002094 # GLX_ARB_create_context_profile - GLX_CONTEXT_CORE_PROFILE_BIT_ARB* = 0x00000001 - GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB* = 0x00000002 - GLX_CONTEXT_PROFILE_MASK_ARB* = 0x00009126 # GLX_ARB_vertex_buffer_object - GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB* = 0x00002095 # - # GLX_ARB_framebuffer_sRGB - GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB* = 0x000020B2 # - # GLX_ARB_create_context_robustness - GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB* = 0x00000004 - GLX_LOSE_CONTEXT_ON_RESET_ARB* = 0x00008252 - GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB* = 0x00008256 - GLX_NO_RESET_NOTIFICATION_ARB* = 0x00008261 # GLX_EXT_visual_info - GLX_X_VISUALtyp_EXT* = 0x00000022 - GLX_TRANSPARENTtyp_EXT* = 0x00000023 - GLX_TRANSPARENT_INDEX_VALUE_EXT* = 0x00000024 - GLX_TRANSPARENT_RED_VALUE_EXT* = 0x00000025 - GLX_TRANSPARENT_GREEN_VALUE_EXT* = 0x00000026 - GLX_TRANSPARENT_BLUE_VALUE_EXT* = 0x00000027 - GLX_TRANSPARENT_ALPHA_VALUE_EXT* = 0x00000028 - GLX_NONE_EXT* = 0x00008000 - GLX_TRUE_COLOR_EXT* = 0x00008002 - GLX_DIRECT_COLOR_EXT* = 0x00008003 - GLX_PSEUDO_COLOR_EXT* = 0x00008004 - GLX_STATIC_COLOR_EXT* = 0x00008005 - GLX_GRAY_SCALE_EXT* = 0x00008006 - GLX_STATIC_GRAY_EXT* = 0x00008007 - GLX_TRANSPARENT_RGB_EXT* = 0x00008008 - GLX_TRANSPARENT_INDEX_EXT* = 0x00008009 # GLX_EXT_visual_rating - GLX_VISUAL_CAVEAT_EXT* = 0x00000020 - GLX_SLOW_VISUAL_EXT* = 0x00008001 - GLX_NON_CONFORMANT_VISUAL_EXT* = 0x0000800D # reuse GLX_NONE_EXT - # GLX_EXT_import_context - GLX_SHARE_CONTEXT_EXT* = 0x0000800A - GLX_VISUAL_ID_EXT* = 0x0000800B - GLX_SCREEN_EXT* = 0x0000800C # GLX_EXT_fbconfig_packed_float - # GLX_RGBA_UNSIGNED_FLOATtyp_EXT = $20B1; - # GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT = $00000008; - # GLX_EXT_framebuffer_sRGB - # GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT = $20B2; - # GLX_EXT_texture_from_pixmap - GLX_TEXTURE_1D_BIT_EXT* = 0x00000001 - GLX_TEXTURE_2D_BIT_EXT* = 0x00000002 - GLX_TEXTURE_RECTANGLE_BIT_EXT* = 0x00000004 - GLX_BIND_TO_TEXTURE_RGB_EXT* = 0x000020D0 - GLX_BIND_TO_TEXTURE_RGBA_EXT* = 0x000020D1 - GLX_BIND_TO_MIPMAP_TEXTURE_EXT* = 0x000020D2 - GLX_BIND_TO_TEXTURE_TARGETS_EXT* = 0x000020D3 - GLX_Y_INVERTED_EXT* = 0x000020D4 - GLX_TEXTURE_FORMAT_EXT* = 0x000020D5 - GLX_TEXTURE_TARGET_EXT* = 0x000020D6 - GLX_MIPMAP_TEXTURE_EXT* = 0x000020D7 - GLX_TEXTURE_FORMAT_NONE_EXT* = 0x000020D8 - GLX_TEXTURE_FORMAT_RGB_EXT* = 0x000020D9 - GLX_TEXTURE_FORMAT_RGBA_EXT* = 0x000020DA - GLX_TEXTURE_1D_EXT* = 0x000020DB - GLX_TEXTURE_2D_EXT* = 0x000020DC - GLX_TEXTURE_RECTANGLE_EXT* = 0x000020DD - GLX_FRONT_LEFT_EXT* = 0x000020DE - GLX_FRONT_RIGHT_EXT* = 0x000020DF - GLX_BACK_LEFT_EXT* = 0x000020E0 - GLX_BACK_RIGHT_EXT* = 0x000020E1 - GLX_FRONT_EXT* = GLX_FRONT_LEFT_EXT - GLX_BACK_EXT* = GLX_BACK_LEFT_EXT - GLX_AUX0_EXT* = 0x000020E2 - GLX_AUX1_EXT* = 0x000020E3 - GLX_AUX2_EXT* = 0x000020E4 - GLX_AUX3_EXT* = 0x000020E5 - GLX_AUX4_EXT* = 0x000020E6 - GLX_AUX5_EXT* = 0x000020E7 - GLX_AUX6_EXT* = 0x000020E8 - GLX_AUX7_EXT* = 0x000020E9 - GLX_AUX8_EXT* = 0x000020EA - GLX_AUX9_EXT* = 0x000020EB # GLX_EXT_swap_control - GLX_SWAP_INTERVAL_EXT* = 0x000020F1 - GLX_MAX_SWAP_INTERVAL_EXT* = 0x000020F2 # GLX_EXT_create_context_es2_profile - GLX_CONTEXT_ES2_PROFILE_BIT_EXT* = 0x00000004 # GLU - GLU_INVALID_ENUM* = 100900 - GLU_INVALID_VALUE* = 100901 - GLU_OUT_OF_MEMORY* = 100902 - GLU_INCOMPATIBLE_GL_VERSION* = 100903 - GLU_VERSION* = 100800 - GLU_EXTENSIONS* = 100801 - GLU_TRUE* = GL_TRUE - GLU_FALSE* = GL_FALSE - GLU_SMOOTH* = 100000 - GLU_FLAT* = 100001 - GLU_NONE* = 100002 - GLU_POINT* = 100010 - GLU_LINE* = 100011 - GLU_FILL* = 100012 - GLU_SILHOUETTE* = 100013 - GLU_OUTSIDE* = 100020 - GLU_INSIDE* = 100021 - GLU_TESS_MAX_COORD* = 1.0000000000000005e+150 - GLU_TESS_WINDING_RULE* = 100140 - GLU_TESS_BOUNDARY_ONLY* = 100141 - GLU_TESS_TOLERANCE* = 100142 - 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 - GLU_TESS_BEGIN* = 100100 # TGLUTessBeginProc - cGLU_TESS_VERTEX* = 100101 # TGLUTessVertexProc - GLU_TESS_END* = 100102 # TGLUTessEndProc - GLU_TESS_ERROR* = 100103 # TGLUTessErrorProc - GLU_TESS_EDGE_FLAG* = 100104 # TGLUTessEdgeFlagProc - GLU_TESS_COMBINE* = 100105 # TGLUTessCombineProc - GLU_TESS_BEGIN_DATA* = 100106 # TGLUTessBeginDataProc - GLU_TESS_VERTEX_DATA* = 100107 # TGLUTessVertexDataProc - GLU_TESS_END_DATA* = 100108 # TGLUTessEndDataProc - GLU_TESS_ERROR_DATA* = 100109 # TGLUTessErrorDataProc - GLU_TESS_EDGE_FLAG_DATA* = 100110 # TGLUTessEdgeFlagDataProc - GLU_TESS_COMBINE_DATA* = 100111 # TGLUTessCombineDataProc - 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 - 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 - GLU_PATH_LENGTH* = 100215 - GLU_PARAMETRIC_ERROR* = 100216 - GLU_DOMAIN_DISTANCE* = 100217 - GLU_MAP1_TRIM_2* = 100210 - GLU_MAP1_TRIM_3* = 100211 - GLU_OUTLINE_POLYGON* = 100240 - GLU_OUTLINE_PATCH* = 100241 - 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 - GLU_CW* = 100120 - GLU_CCW* = 100121 - GLU_INTERIOR* = 100122 - GLU_EXTERIOR* = 100123 - GLU_UNKNOWN* = 100124 - GLU_BEGIN* = GLU_TESS_BEGIN - GLU_VERTEX* = cGLU_TESS_VERTEX - GLU_END* = GLU_TESS_END - GLU_ERROR* = GLU_TESS_ERROR - GLU_EDGE_FLAG* = GLU_TESS_EDGE_FLAG - -proc glCullFace*(mode: GLenum){.stdcall, importc, ogl.} -proc glFrontFace*(mode: GLenum){.stdcall, importc, ogl.} -proc glHint*(target: GLenum, mode: GLenum){.stdcall, importc, ogl.} -proc glLineWidth*(width: GLfloat){.stdcall, importc, ogl.} -proc glPointSize*(size: GLfloat){.stdcall, importc, ogl.} -proc glPolygonMode*(face: GLenum, mode: GLenum){.stdcall, importc, ogl.} -proc glScissor*(x: GLint, y: GLint, width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glTexParameterf*(target: GLenum, pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glTexParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glTexParameteri*(target: GLenum, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glTexParameteriv*(target: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glTexImage1D*(target: GLenum, level: GLint, internalformat: GLint, - width: GLsizei, border: GLint, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTexImage2D*(target: GLenum, level: GLint, internalformat: GLint, - width: GLsizei, height: GLsizei, border: GLint, - format: GLenum, typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glDrawBuffer*(mode: GLenum){.stdcall, importc, ogl.} -proc glClear*(mask: GLbitfield){.stdcall, importc, ogl.} -proc glClearColor*(red: GLclampf, green: GLclampf, blue: GLclampf, - alpha: GLclampf){.stdcall, importc, ogl.} -proc glClearStencil*(s: GLint){.stdcall, importc, ogl.} -proc glClearDepth*(depth: GLclampd){.stdcall, importc, ogl.} -proc glStencilMask*(mask: GLuint){.stdcall, importc, ogl.} -proc glColorMask*(red: GLboolean, green: GLboolean, blue: GLboolean, - alpha: GLboolean){.stdcall, importc, ogl.} -proc glDepthMask*(flag: GLboolean){.stdcall, importc, ogl.} -proc glDisable*(cap: GLenum){.stdcall, importc, ogl.} -proc glEnable*(cap: GLenum){.stdcall, importc, ogl.} -proc glFinish*(){.stdcall, importc, ogl.} -proc glFlush*(){.stdcall, importc, ogl.} -proc glBlendFunc*(sfactor: GLenum, dfactor: GLenum){.stdcall, importc, ogl.} -proc glLogicOp*(opcode: GLenum){.stdcall, importc, ogl.} -proc glStencilFunc*(func: GLenum, theRef: GLint, mask: GLuint){.stdcall, importc, ogl.} -proc glStencilOp*(fail: GLenum, zfail: GLenum, zpass: GLenum){.stdcall, importc, ogl.} -proc glDepthFunc*(func: GLenum){.stdcall, importc, ogl.} -proc glPixelStoref*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPixelStorei*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glReadBuffer*(mode: GLenum){.stdcall, importc, ogl.} -proc glReadPixels*(x: GLint, y: GLint, width: GLsizei, height: GLsizei, - format: GLenum, typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glGetBooleanv*(pname: GLenum, params: PGLboolean){.stdcall, importc, ogl.} -proc glGetDoublev*(pname: GLenum, params: PGLdouble){.stdcall, importc, ogl.} -proc glGetError*(): GLenum{.stdcall, importc, ogl.} -proc glGetFloatv*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetIntegerv*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetString*(name: GLenum): cstring{.stdcall, importc, ogl.} -proc glGetTexImage*(target: GLenum, level: GLint, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glGetTexParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetTexParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetTexLevelParameterfv*(target: GLenum, level: GLint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetTexLevelParameteriv*(target: GLenum, level: GLint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glIsEnabled*(cap: GLenum): GLboolean{.stdcall, importc, ogl.} -proc glDepthRange*(zNear: GLclampd, zFar: GLclampd){.stdcall, importc, ogl.} -proc glViewport*(x: GLint, y: GLint, width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} - # GL_VERSION_1_1 -proc glDrawArrays*(mode: GLenum, first: GLint, count: GLsizei){.stdcall, importc, ogl.} -proc glDrawElements*(mode: GLenum, count: GLsizei, typ: GLenum, indices: PGLvoid){. - stdcall, importc, ogl.} -proc glGetPointerv*(pname: GLenum, params: PGLvoid){.stdcall, importc, ogl.} -proc glPolygonOffset*(factor: GLfloat, units: GLfloat){.stdcall, importc, ogl.} -proc glCopyTexImage1D*(target: GLenum, level: GLint, internalFormat: GLenum, - x: GLint, y: GLint, width: GLsizei, border: GLint){. - stdcall, importc, ogl.} -proc glCopyTexImage2D*(target: GLenum, level: GLint, internalFormat: GLenum, - x: GLint, y: GLint, width: GLsizei, height: GLsizei, - border: GLint){.stdcall, importc, ogl.} -proc glCopyTexSubImage1D*(target: GLenum, level: GLint, xoffset: GLint, - x: GLint, y: GLint, width: GLsizei){.stdcall, importc, ogl.} -proc glCopyTexSubImage2D*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, x: GLint, y: GLint, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glTexSubImage1D*(target: GLenum, level: GLint, xoffset: GLint, - width: GLsizei, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTexSubImage2D*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, width: GLsizei, height: GLsizei, - format: GLenum, typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glBindTexture*(target: GLenum, texture: GLuint){.stdcall, importc, ogl.} -proc glDeleteTextures*(n: GLsizei, textures: PGLuint){.stdcall, importc, ogl.} -proc glGenTextures*(n: GLsizei, textures: PGLuint){.stdcall, importc, ogl.} -proc glAccum*(op: GLenum, value: GLfloat){.stdcall, importc, ogl.} -proc glAlphaFunc*(func: GLenum, theRef: GLclampf){.stdcall, importc, ogl.} -proc glAreTexturesResident*(n: GLsizei, textures: PGLuint, - residences: PGLboolean): GLboolean{.stdcall, importc, ogl.} -proc glArrayElement*(i: GLint){.stdcall, importc, ogl.} -proc glBegin*(mode: GLenum){.stdcall, importc, ogl.} -proc glBitmap*(width: GLsizei, height: GLsizei, xorig: GLfloat, yorig: GLfloat, - xmove: GLfloat, ymove: GLfloat, bitmap: PGLubyte){.stdcall, importc, ogl.} -proc glCallList*(list: GLuint){.stdcall, importc, ogl.} -proc glCallLists*(n: GLsizei, typ: GLenum, lists: PGLvoid){.stdcall, importc, ogl.} -proc glClearAccum*(red: GLfloat, green: GLfloat, blue: GLfloat, alpha: GLfloat){. - stdcall, importc, ogl.} -proc glClearIndex*(c: GLfloat){.stdcall, importc, ogl.} -proc glClipPlane*(plane: GLenum, equation: PGLdouble){.stdcall, importc, ogl.} -proc glColor3b*(red: GLbyte, green: GLbyte, blue: GLbyte){.stdcall, importc, ogl.} -proc glColor3bv*(v: PGLbyte){.stdcall, importc, ogl.} -proc glColor3bv*(v: TGLVectorb3){.stdcall, importc, ogl.} -proc glColor3d*(red: GLdouble, green: GLdouble, blue: GLdouble){.stdcall, importc, ogl.} -proc glColor3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glColor3dv*(v: TGLVectord3){.stdcall, importc, ogl.} -proc glColor3f*(red: GLfloat, green: GLfloat, blue: GLfloat){.stdcall, importc, ogl.} -proc glColor3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glColor3fv*(v: TGLVectorf3){.stdcall, importc, ogl.} -proc glColor3i*(red: GLint, green: GLint, blue: GLint){.stdcall, importc, ogl.} -proc glColor3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glColor3iv*(v: TGLVectori3){.stdcall, importc, ogl.} -proc glColor3s*(red: GLshort, green: GLshort, blue: GLshort){.stdcall, importc, ogl.} -proc glColor3sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glColor3sv*(v: TGLVectors3){.stdcall, importc, ogl.} -proc glColor3ub*(red: GLubyte, green: GLubyte, blue: GLubyte){.stdcall, importc, ogl.} -proc glColor3ubv*(v: PGLubyte){.stdcall, importc, ogl.} -proc glColor3ubv*(v: TGLVectorub3){.stdcall, importc, ogl.} -proc glColor3ui*(red: GLuint, green: GLuint, blue: GLuint){.stdcall, importc, ogl.} -proc glColor3uiv*(v: PGLuint){.stdcall, importc, ogl.} -proc glColor3uiv*(v: TGLVectorui3){.stdcall, importc, ogl.} -proc glColor3us*(red: GLushort, green: GLushort, blue: GLushort){.stdcall, importc, ogl.} -proc glColor3usv*(v: PGLushort){.stdcall, importc, ogl.} -proc glColor3usv*(v: TGLVectorus3){.stdcall, importc, ogl.} -proc glColor4b*(red: GLbyte, green: GLbyte, blue: GLbyte, alpha: GLbyte){. - stdcall, importc, ogl.} -proc glColor4bv*(v: PGLbyte){.stdcall, importc, ogl.} -proc glColor4bv*(v: TGLVectorb4){.stdcall, importc, ogl.} -proc glColor4d*(red: GLdouble, green: GLdouble, blue: GLdouble, alpha: GLdouble){. - stdcall, importc, ogl.} -proc glColor4dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glColor4dv*(v: TGLVectord4){.stdcall, importc, ogl.} -proc glColor4f*(red: GLfloat, green: GLfloat, blue: GLfloat, alpha: GLfloat){. - stdcall, importc, ogl.} -proc glColor4fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glColor4fv*(v: TGLVectorf4){.stdcall, importc, ogl.} -proc glColor4i*(red: GLint, green: GLint, blue: GLint, alpha: GLint){.stdcall, importc, ogl.} -proc glColor4iv*(v: PGLint){.stdcall, importc, ogl.} -proc glColor4iv*(v: TGLVectori4){.stdcall, importc, ogl.} -proc glColor4s*(red: GLshort, green: GLshort, blue: GLshort, alpha: GLshort){. - stdcall, importc, ogl.} -proc glColor4sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glColor4sv*(v: TGLVectors4){.stdcall, importc, ogl.} -proc glColor4ub*(red: GLubyte, green: GLubyte, blue: GLubyte, alpha: GLubyte){. - stdcall, importc, ogl.} -proc glColor4ubv*(v: PGLubyte){.stdcall, importc, ogl.} -proc glColor4ubv*(v: TGLVectorub4){.stdcall, importc, ogl.} -proc glColor4ui*(red: GLuint, green: GLuint, blue: GLuint, alpha: GLuint){. - stdcall, importc, ogl.} -proc glColor4uiv*(v: PGLuint){.stdcall, importc, ogl.} -proc glColor4uiv*(v: TGLVectorui4){.stdcall, importc, ogl.} -proc glColor4us*(red: GLushort, green: GLushort, blue: GLushort, alpha: GLushort){. - stdcall, importc, ogl.} -proc glColor4usv*(v: PGLushort){.stdcall, importc, ogl.} -proc glColorMaterial*(face: GLenum, mode: GLenum){.stdcall, importc, ogl.} -proc glColorPointer*(size: GLint, typ: GLenum, stride: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glCopyPixels*(x: GLint, y: GLint, width: GLsizei, height: GLsizei, - typ: GLenum){.stdcall, importc, ogl.} -proc glDeleteLists*(list: GLuint, range: GLsizei){.stdcall, importc, ogl.} -proc glDisableClientState*(arr: GLenum){.stdcall, importc, ogl.} -proc glDrawPixels*(width: GLsizei, height: GLsizei, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glEdgeFlag*(flag: GLboolean){.stdcall, importc, ogl.} -proc glEdgeFlagPointer*(stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glEdgeFlagv*(flag: PGLboolean){.stdcall, importc, ogl.} -proc glEnableClientState*(arr: GLenum){.stdcall, importc, ogl.} -proc glEnd*(){.stdcall, importc, ogl.} -proc glEndList*(){.stdcall, importc, ogl.} -proc glEvalCoord1d*(u: GLdouble){.stdcall, importc, ogl.} -proc glEvalCoord1dv*(u: PGLdouble){.stdcall, importc, ogl.} -proc glEvalCoord1f*(u: GLfloat){.stdcall, importc, ogl.} -proc glEvalCoord1fv*(u: PGLfloat){.stdcall, importc, ogl.} -proc glEvalCoord2d*(u: GLdouble, v: GLdouble){.stdcall, importc, ogl.} -proc glEvalCoord2dv*(u: PGLdouble){.stdcall, importc, ogl.} -proc glEvalCoord2f*(u: GLfloat, v: GLfloat){.stdcall, importc, ogl.} -proc glEvalCoord2fv*(u: PGLfloat){.stdcall, importc, ogl.} -proc glEvalMesh1*(mode: GLenum, i1: GLint, i2: GLint){.stdcall, importc, ogl.} -proc glEvalMesh2*(mode: GLenum, i1: GLint, i2: GLint, j1: GLint, j2: GLint){. - stdcall, importc, ogl.} -proc glEvalPoint1*(i: GLint){.stdcall, importc, ogl.} -proc glEvalPoint2*(i: GLint, j: GLint){.stdcall, importc, ogl.} -proc glFeedbackBuffer*(size: GLsizei, typ: GLenum, buffer: PGLfloat){.stdcall, importc, ogl.} -proc glFogf*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glFogfv*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glFogi*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glFogiv*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glFrustum*(left: GLdouble, right: GLdouble, bottom: GLdouble, - top: GLdouble, zNear: GLdouble, zFar: GLdouble){.stdcall, importc, ogl.} -proc glGenLists*(range: GLsizei): GLuint{.stdcall, importc, ogl.} -proc glGetClipPlane*(plane: GLenum, equation: PGLdouble){.stdcall, importc, ogl.} -proc glGetLightfv*(light: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetLightiv*(light: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetMapdv*(target: GLenum, query: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glGetMapfv*(target: GLenum, query: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glGetMapiv*(target: GLenum, query: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glGetMaterialfv*(face: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetMaterialiv*(face: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetPixelMapfv*(map: GLenum, values: PGLfloat){.stdcall, importc, ogl.} -proc glGetPixelMapuiv*(map: GLenum, values: PGLuint){.stdcall, importc, ogl.} -proc glGetPixelMapusv*(map: GLenum, values: PGLushort){.stdcall, importc, ogl.} -proc glGetPolygonStipple*(mask: PGLubyte){.stdcall, importc, ogl.} -proc glGetTexEnvfv*(target: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetTexEnviv*(target: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetTexGendv*(coord: GLenum, pname: GLenum, params: PGLdouble){.stdcall, importc, ogl.} -proc glGetTexGenfv*(coord: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetTexGeniv*(coord: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glIndexMask*(mask: GLuint){.stdcall, importc, ogl.} -proc glIndexPointer*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glIndexd*(c: GLdouble){.stdcall, importc, ogl.} -proc glIndexdv*(c: PGLdouble){.stdcall, importc, ogl.} -proc glIndexf*(c: GLfloat){.stdcall, importc, ogl.} -proc glIndexfv*(c: PGLfloat){.stdcall, importc, ogl.} -proc glIndexi*(c: GLint){.stdcall, importc, ogl.} -proc glIndexiv*(c: PGLint){.stdcall, importc, ogl.} -proc glIndexs*(c: GLshort){.stdcall, importc, ogl.} -proc glIndexsv*(c: PGLshort){.stdcall, importc, ogl.} -proc glIndexub*(c: GLubyte){.stdcall, importc, ogl.} -proc glIndexubv*(c: PGLubyte){.stdcall, importc, ogl.} -proc glInitNames*(){.stdcall, importc, ogl.} -proc glInterleavedArrays*(format: GLenum, stride: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glIsList*(list: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glIsTexture*(texture: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glLightModelf*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glLightModelfv*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glLightModeli*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glLightModeliv*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glLightf*(light: GLenum, pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glLightfv*(light: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glLighti*(light: GLenum, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glLightiv*(light: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glLineStipple*(factor: GLint, pattern: GLushort){.stdcall, importc, ogl.} -proc glListBase*(base: GLuint){.stdcall, importc, ogl.} -proc glLoadIdentity*(){.stdcall, importc, ogl.} -proc glLoadMatrixd*(m: PGLdouble){.stdcall, importc, ogl.} -proc glLoadMatrixf*(m: PGLfloat){.stdcall, importc, ogl.} -proc glLoadName*(name: GLuint){.stdcall, importc, ogl.} -proc glMap1d*(target: GLenum, u1: GLdouble, u2: GLdouble, stride: GLint, - order: GLint, points: PGLdouble){.stdcall, importc, ogl.} -proc glMap1f*(target: GLenum, u1: GLfloat, u2: GLfloat, stride: GLint, - order: GLint, points: PGLfloat){.stdcall, importc, ogl.} -proc glMap2d*(target: GLenum, u1: GLdouble, u2: GLdouble, ustride: GLint, - uorder: GLint, v1: GLdouble, v2: GLdouble, vstride: GLint, - vorder: GLint, points: PGLdouble){.stdcall, importc, ogl.} -proc glMap2f*(target: GLenum, u1: GLfloat, u2: GLfloat, ustride: GLint, - uorder: GLint, v1: GLfloat, v2: GLfloat, vstride: GLint, - vorder: GLint, points: PGLfloat){.stdcall, importc, ogl.} -proc glMapGrid1d*(un: GLint, u1: GLdouble, u2: GLdouble){.stdcall, importc, ogl.} -proc glMapGrid1f*(un: GLint, u1: GLfloat, u2: GLfloat){.stdcall, importc, ogl.} -proc glMapGrid2d*(un: GLint, u1: GLdouble, u2: GLdouble, vn: GLint, - v1: GLdouble, v2: GLdouble){.stdcall, importc, ogl.} -proc glMapGrid2f*(un: GLint, u1: GLfloat, u2: GLfloat, vn: GLint, v1: GLfloat, - v2: GLfloat){.stdcall, importc, ogl.} -proc glMaterialf*(face: GLenum, pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glMaterialfv*(face: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glMateriali*(face: GLenum, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glMaterialiv*(face: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glMatrixMode*(mode: GLenum){.stdcall, importc, ogl.} -proc glMultMatrixd*(m: PGLdouble){.stdcall, importc, ogl.} -proc glMultMatrixf*(m: PGLfloat){.stdcall, importc, ogl.} -proc glNewList*(list: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glNormal3b*(nx: GLbyte, ny: GLbyte, nz: GLbyte){.stdcall, importc, ogl.} -proc glNormal3bv*(v: PGLbyte){.stdcall, importc, ogl.} -proc glNormal3d*(nx: GLdouble, ny: GLdouble, nz: GLdouble){.stdcall, importc, ogl.} -proc glNormal3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glNormal3f*(nx: GLfloat, ny: GLfloat, nz: GLfloat){.stdcall, importc, ogl.} -proc glNormal3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glNormal3i*(nx: GLint, ny: GLint, nz: GLint){.stdcall, importc, ogl.} -proc glNormal3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glNormal3s*(nx: GLshort, ny: GLshort, nz: GLshort){.stdcall, importc, ogl.} -proc glNormal3sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glNormalPointer*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glOrtho*(left: GLdouble, right: GLdouble, bottom: GLdouble, top: GLdouble, - zNear: GLdouble, zFar: GLdouble){.stdcall, importc, ogl.} -proc glPassThrough*(token: GLfloat){.stdcall, importc, ogl.} -proc glPixelMapfv*(map: GLenum, mapsize: GLsizei, values: PGLfloat){.stdcall, importc, ogl.} -proc glPixelMapuiv*(map: GLenum, mapsize: GLsizei, values: PGLuint){.stdcall, importc, ogl.} -proc glPixelMapusv*(map: GLenum, mapsize: GLsizei, values: PGLushort){.stdcall, importc, ogl.} -proc glPixelTransferf*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPixelTransferi*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glPixelZoom*(xfactor: GLfloat, yfactor: GLfloat){.stdcall, importc, ogl.} -proc glPolygonStipple*(mask: PGLubyte){.stdcall, importc, ogl.} -proc glPopAttrib*(){.stdcall, importc, ogl.} -proc glPopClientAttrib*(){.stdcall, importc, ogl.} -proc glPopMatrix*(){.stdcall, importc, ogl.} -proc glPopName*(){.stdcall, importc, ogl.} -proc glPrioritizeTextures*(n: GLsizei, textures: PGLuint, priorities: PGLclampf){. - stdcall, importc, ogl.} -proc glPushAttrib*(mask: GLbitfield){.stdcall, importc, ogl.} -proc glPushClientAttrib*(mask: GLbitfield){.stdcall, importc, ogl.} -proc glPushMatrix*(){.stdcall, importc, ogl.} -proc glPushName*(name: GLuint){.stdcall, importc, ogl.} -proc glRasterPos2d*(x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glRasterPos2dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glRasterPos2f*(x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glRasterPos2fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glRasterPos2i*(x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glRasterPos2iv*(v: PGLint){.stdcall, importc, ogl.} -proc glRasterPos2s*(x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glRasterPos2sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glRasterPos3d*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glRasterPos3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glRasterPos3f*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glRasterPos3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glRasterPos3i*(x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glRasterPos3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glRasterPos3s*(x: GLshort, y: GLshort, z: GLshort){.stdcall, importc, ogl.} -proc glRasterPos3sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glRasterPos4d*(x: GLdouble, y: GLdouble, z: GLdouble, w: GLdouble){.stdcall, importc, ogl.} -proc glRasterPos4dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glRasterPos4f*(x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glRasterPos4fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glRasterPos4i*(x: GLint, y: GLint, z: GLint, w: GLint){.stdcall, importc, ogl.} -proc glRasterPos4iv*(v: PGLint){.stdcall, importc, ogl.} -proc glRasterPos4s*(x: GLshort, y: GLshort, z: GLshort, w: GLshort){.stdcall, importc, ogl.} -proc glRasterPos4sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glRectd*(x1: GLdouble, y1: GLdouble, x2: GLdouble, y2: GLdouble){.stdcall, importc, ogl.} -proc glRectdv*(v1: PGLdouble, v2: PGLdouble){.stdcall, importc, ogl.} -proc glRectf*(x1: GLfloat, y1: GLfloat, x2: GLfloat, y2: GLfloat){.stdcall, importc, ogl.} -proc glRectfv*(v1: PGLfloat, v2: PGLfloat){.stdcall, importc, ogl.} -proc glRecti*(x1: GLint, y1: GLint, x2: GLint, y2: GLint){.stdcall, importc, ogl.} -proc glRectiv*(v1: PGLint, v2: PGLint){.stdcall, importc, ogl.} -proc glRects*(x1: GLshort, y1: GLshort, x2: GLshort, y2: GLshort){.stdcall, importc, ogl.} -proc glRectsv*(v1: PGLshort, v2: PGLshort){.stdcall, importc, ogl.} -proc glRenderMode*(mode: GLenum): GLint{.stdcall, importc, ogl.} -proc glRotated*(angle: GLdouble, x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glRotatef*(angle: GLfloat, x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glScaled*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glScalef*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glSelectBuffer*(size: GLsizei, buffer: PGLuint){.stdcall, importc, ogl.} -proc glShadeModel*(mode: GLenum){.stdcall, importc, ogl.} -proc glTexCoord1d*(s: GLdouble){.stdcall, importc, ogl.} -proc glTexCoord1dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glTexCoord1f*(s: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord1fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glTexCoord1i*(s: GLint){.stdcall, importc, ogl.} -proc glTexCoord1iv*(v: PGLint){.stdcall, importc, ogl.} -proc glTexCoord1s*(s: GLshort){.stdcall, importc, ogl.} -proc glTexCoord1sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glTexCoord2d*(s: GLdouble, t: GLdouble){.stdcall, importc, ogl.} -proc glTexCoord2dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glTexCoord2f*(s: GLfloat, t: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord2fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glTexCoord2i*(s: GLint, t: GLint){.stdcall, importc, ogl.} -proc glTexCoord2iv*(v: PGLint){.stdcall, importc, ogl.} -proc glTexCoord2s*(s: GLshort, t: GLshort){.stdcall, importc, ogl.} -proc glTexCoord2sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glTexCoord3d*(s: GLdouble, t: GLdouble, r: GLdouble){.stdcall, importc, ogl.} -proc glTexCoord3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glTexCoord3f*(s: GLfloat, t: GLfloat, r: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glTexCoord3i*(s: GLint, t: GLint, r: GLint){.stdcall, importc, ogl.} -proc glTexCoord3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glTexCoord3s*(s: GLshort, t: GLshort, r: GLshort){.stdcall, importc, ogl.} -proc glTexCoord3sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glTexCoord4d*(s: GLdouble, t: GLdouble, r: GLdouble, q: GLdouble){.stdcall, importc, ogl.} -proc glTexCoord4dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glTexCoord4f*(s: GLfloat, t: GLfloat, r: GLfloat, q: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord4fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glTexCoord4i*(s: GLint, t: GLint, r: GLint, q: GLint){.stdcall, importc, ogl.} -proc glTexCoord4iv*(v: PGLint){.stdcall, importc, ogl.} -proc glTexCoord4s*(s: GLshort, t: GLshort, r: GLshort, q: GLshort){.stdcall, importc, ogl.} -proc glTexCoord4sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glTexCoordPointer*(size: GLint, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glTexEnvf*(target: GLenum, pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glTexEnvfv*(target: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glTexEnvi*(target: GLenum, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glTexEnviv*(target: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glTexGend*(coord: GLenum, pname: GLenum, param: GLdouble){.stdcall, importc, ogl.} -proc glTexGendv*(coord: GLenum, pname: GLenum, params: PGLdouble){.stdcall, importc, ogl.} -proc glTexGenf*(coord: GLenum, pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glTexGenfv*(coord: GLenum, pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glTexGeni*(coord: GLenum, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glTexGeniv*(coord: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glTranslated*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glTranslatef*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glVertex2d*(x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertex2dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glVertex2f*(x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glVertex2fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glVertex2i*(x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glVertex2iv*(v: PGLint){.stdcall, importc, ogl.} -proc glVertex2s*(x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glVertex2sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glVertex3d*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glVertex3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glVertex3f*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glVertex3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glVertex3i*(x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glVertex3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glVertex3s*(x: GLshort, y: GLshort, z: GLshort){.stdcall, importc, ogl.} -proc glVertex3sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glVertex4d*(x: GLdouble, y: GLdouble, z: GLdouble, w: GLdouble){.stdcall, importc, ogl.} -proc glVertex4dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glVertex4f*(x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glVertex4fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glVertex4i*(x: GLint, y: GLint, z: GLint, w: GLint){.stdcall, importc, ogl.} -proc glVertex4iv*(v: PGLint){.stdcall, importc, ogl.} -proc glVertex4s*(x: GLshort, y: GLshort, z: GLshort, w: GLshort){.stdcall, importc, ogl.} -proc glVertex4sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glVertexPointer*(size: GLint, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_VERSION_1_2 -proc glBlendColor*(red: GLclampf, green: GLclampf, blue: GLclampf, - alpha: GLclampf){.stdcall, importc, ogl.} -proc glBlendEquation*(mode: GLenum){.stdcall, importc, ogl.} -proc glDrawRangeElements*(mode: GLenum, start: GLuint, ending: GLuint, - count: GLsizei, typ: GLenum, indices: PGLvoid){. - stdcall, importc, ogl.} -proc glTexImage3D*(target: GLenum, level: GLint, internalformat: GLint, - width: GLsizei, height: GLsizei, depth: GLsizei, - border: GLint, format: GLenum, typ: GLenum, pixels: PGLvoid){. - stdcall, importc, ogl.} -proc glTexSubImage3D*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, width: GLsizei, - height: GLsizei, depth: GLsizei, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glCopyTexSubImage3D*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glColorTable*(target: GLenum, internalformat: GLenum, width: GLsizei, - format: GLenum, typ: GLenum, table: PGLvoid){.stdcall, importc, ogl.} -proc glColorTableParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glColorTableParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glCopyColorTable*(target: GLenum, internalformat: GLenum, x: GLint, - y: GLint, width: GLsizei){.stdcall, importc, ogl.} -proc glGetColorTable*(target: GLenum, format: GLenum, typ: GLenum, - table: PGLvoid){.stdcall, importc, ogl.} -proc glGetColorTableParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetColorTableParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glColorSubTable*(target: GLenum, start: GLsizei, count: GLsizei, - format: GLenum, typ: GLenum, data: PGLvoid){.stdcall, importc, ogl.} -proc glCopyColorSubTable*(target: GLenum, start: GLsizei, x: GLint, y: GLint, - width: GLsizei){.stdcall, importc, ogl.} -proc glConvolutionFilter1D*(target: GLenum, internalformat: GLenum, - width: GLsizei, format: GLenum, typ: GLenum, - image: PGLvoid){.stdcall, importc, ogl.} -proc glConvolutionFilter2D*(target: GLenum, internalformat: GLenum, - width: GLsizei, height: GLsizei, format: GLenum, - typ: GLenum, image: PGLvoid){.stdcall, importc, ogl.} -proc glConvolutionParameterf*(target: GLenum, pname: GLenum, params: GLfloat){. - stdcall, importc, ogl.} -proc glConvolutionParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glConvolutionParameteri*(target: GLenum, pname: GLenum, params: GLint){. - stdcall, importc, ogl.} -proc glConvolutionParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glCopyConvolutionFilter1D*(target: GLenum, internalformat: GLenum, - x: GLint, y: GLint, width: GLsizei){.stdcall, importc, ogl.} -proc glCopyConvolutionFilter2D*(target: GLenum, internalformat: GLenum, - x: GLint, y: GLint, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glGetConvolutionFilter*(target: GLenum, format: GLenum, typ: GLenum, - image: PGLvoid){.stdcall, importc, ogl.} -proc glGetConvolutionParameterfv*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetConvolutionParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetSeparableFilter*(target: GLenum, format: GLenum, typ: GLenum, - row: PGLvoid, column: PGLvoid, span: PGLvoid){. - stdcall, importc, ogl.} -proc glSeparableFilter2D*(target: GLenum, internalformat: GLenum, - width: GLsizei, height: GLsizei, format: GLenum, - typ: GLenum, row: PGLvoid, column: PGLvoid){.stdcall, importc, ogl.} -proc glGetHistogram*(target: GLenum, reset: GLboolean, format: GLenum, - typ: GLenum, values: PGLvoid){.stdcall, importc, ogl.} -proc glGetHistogramParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetHistogramParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetMinmax*(target: GLenum, reset: GLboolean, format: GLenum, typ: GLenum, - values: PGLvoid){.stdcall, importc, ogl.} -proc glGetMinmaxParameterfv*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetMinmaxParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glHistogram*(target: GLenum, width: GLsizei, internalformat: GLenum, - sink: GLboolean){.stdcall, importc, ogl.} -proc glMinmax*(target: GLenum, internalformat: GLenum, sink: GLboolean){.stdcall, importc, ogl.} -proc glResetHistogram*(target: GLenum){.stdcall, importc, ogl.} -proc glResetMinmax*(target: GLenum){.stdcall, importc, ogl.} - # GL_VERSION_1_3 -proc glActiveTexture*(texture: GLenum){.stdcall, importc, ogl.} -proc glSampleCoverage*(value: GLclampf, invert: GLboolean){.stdcall, importc, ogl.} -proc glCompressedTexImage3D*(target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, depth: GLsizei, border: GLint, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexImage2D*(target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, border: GLint, imageSize: GLsizei, - data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexImage1D*(target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - border: GLint, imageSize: GLsizei, data: PGLvoid){. - stdcall, importc, ogl.} -proc glCompressedTexSubImage3D*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, width: GLsizei, - height: GLsizei, depth: GLsizei, format: GLenum, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexSubImage2D*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, width: GLsizei, height: GLsizei, - format: GLenum, imageSize: GLsizei, - data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexSubImage1D*(target: GLenum, level: GLint, xoffset: GLint, - width: GLsizei, format: GLenum, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glGetCompressedTexImage*(target: GLenum, level: GLint, img: PGLvoid){. - stdcall, importc, ogl.} -proc glClientActiveTexture*(texture: GLenum){.stdcall, importc, ogl.} -proc glMultiTexCoord1d*(target: GLenum, s: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord1dv*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord1f*(target: GLenum, s: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord1fv*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord1i*(target: GLenum, s: GLint){.stdcall, importc, ogl.} -proc glMultiTexCoord1iv*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord1s*(target: GLenum, s: GLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord1sv*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord2d*(target: GLenum, s: GLdouble, t: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord2dv*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord2f*(target: GLenum, s: GLfloat, t: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord2fv*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord2i*(target: GLenum, s: GLint, t: GLint){.stdcall, importc, ogl.} -proc glMultiTexCoord2iv*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord2s*(target: GLenum, s: GLshort, t: GLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord2sv*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord3d*(target: GLenum, s: GLdouble, t: GLdouble, r: GLdouble){. - stdcall, importc, ogl.} -proc glMultiTexCoord3dv*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord3f*(target: GLenum, s: GLfloat, t: GLfloat, r: GLfloat){. - stdcall, importc, ogl.} -proc glMultiTexCoord3fv*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord3i*(target: GLenum, s: GLint, t: GLint, r: GLint){.stdcall, importc, ogl.} -proc glMultiTexCoord3iv*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord3s*(target: GLenum, s: GLshort, t: GLshort, r: GLshort){. - stdcall, importc, ogl.} -proc glMultiTexCoord3sv*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord4d*(target: GLenum, s: GLdouble, t: GLdouble, r: GLdouble, - q: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord4dv*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord4f*(target: GLenum, s: GLfloat, t: GLfloat, r: GLfloat, - q: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord4fv*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord4i*(target: GLenum, s: GLint, t: GLint, r: GLint, q: GLint){. - stdcall, importc, ogl.} -proc glMultiTexCoord4iv*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord4s*(target: GLenum, s: GLshort, t: GLshort, r: GLshort, - q: GLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord4sv*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glLoadTransposeMatrixf*(m: PGLfloat){.stdcall, importc, ogl.} -proc glLoadTransposeMatrixd*(m: PGLdouble){.stdcall, importc, ogl.} -proc glMultTransposeMatrixf*(m: PGLfloat){.stdcall, importc, ogl.} -proc glMultTransposeMatrixd*(m: PGLdouble){.stdcall, importc, ogl.} - # GL_VERSION_1_4 -proc glBlendFuncSeparate*(sfactorRGB: GLenum, dfactorRGB: GLenum, - sfactorAlpha: GLenum, dfactorAlpha: GLenum){.stdcall, importc, ogl.} -proc glMultiDrawArrays*(mode: GLenum, first: PGLint, count: PGLsizei, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glMultiDrawElements*(mode: GLenum, count: PGLsizei, typ: GLenum, - indices: PGLvoid, primcount: GLsizei){.stdcall, importc, ogl.} -proc glPointParameterf*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPointParameterfv*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glPointParameteri*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glPointParameteriv*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glFogCoordf*(coord: GLfloat){.stdcall, importc, ogl.} -proc glFogCoordfv*(coord: PGLfloat){.stdcall, importc, ogl.} -proc glFogCoordd*(coord: GLdouble){.stdcall, importc, ogl.} -proc glFogCoorddv*(coord: PGLdouble){.stdcall, importc, ogl.} -proc glFogCoordPointer*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glSecondaryColor3b*(red: GLbyte, green: GLbyte, blue: GLbyte){.stdcall, importc, ogl.} -proc glSecondaryColor3bv*(v: PGLbyte){.stdcall, importc, ogl.} -proc glSecondaryColor3d*(red: GLdouble, green: GLdouble, blue: GLdouble){. - stdcall, importc, ogl.} -proc glSecondaryColor3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glSecondaryColor3f*(red: GLfloat, green: GLfloat, blue: GLfloat){.stdcall, importc, ogl.} -proc glSecondaryColor3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glSecondaryColor3i*(red: GLint, green: GLint, blue: GLint){.stdcall, importc, ogl.} -proc glSecondaryColor3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glSecondaryColor3s*(red: GLshort, green: GLshort, blue: GLshort){.stdcall, importc, ogl.} -proc glSecondaryColor3sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glSecondaryColor3ub*(red: GLubyte, green: GLubyte, blue: GLubyte){.stdcall, importc, ogl.} -proc glSecondaryColor3ubv*(v: PGLubyte){.stdcall, importc, ogl.} -proc glSecondaryColor3ui*(red: GLuint, green: GLuint, blue: GLuint){.stdcall, importc, ogl.} -proc glSecondaryColor3uiv*(v: PGLuint){.stdcall, importc, ogl.} -proc glSecondaryColor3us*(red: GLushort, green: GLushort, blue: GLushort){. - stdcall, importc, ogl.} -proc glSecondaryColor3usv*(v: PGLushort){.stdcall, importc, ogl.} -proc glSecondaryColorPointer*(size: GLint, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glWindowPos2d*(x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glWindowPos2dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos2f*(x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos2fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos2i*(x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glWindowPos2iv*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos2s*(x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glWindowPos2sv*(v: PGLshort){.stdcall, importc, ogl.} -proc glWindowPos3d*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glWindowPos3dv*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos3f*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos3fv*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos3i*(x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glWindowPos3iv*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos3s*(x: GLshort, y: GLshort, z: GLshort){.stdcall, importc, ogl.} -proc glWindowPos3sv*(v: PGLshort){.stdcall, importc, ogl.} - # GL_VERSION_1_5 -proc glGenQueries*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glDeleteQueries*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glIsQuery*(id: GLuint): bool{.stdcall, importc, ogl.} -proc glBeginQuery*(target: GLenum, id: GLuint){.stdcall, importc, ogl.} -proc glEndQuery*(target: GLenum){.stdcall, importc, ogl.} -proc glGetQueryiv*(target, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetQueryObjectiv*(id: GLuint, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetQueryObjectuiv*(id: GLuint, pname: GLenum, params: PGLuint){.stdcall, importc, ogl.} -proc glBindBuffer*(target: GLenum, buffer: GLuint){.stdcall, importc, ogl.} -proc glDeleteBuffers*(n: GLsizei, buffers: PGLuint){.stdcall, importc, ogl.} -proc glGenBuffers*(n: GLsizei, buffers: PGLuint){.stdcall, importc, ogl.} -proc glIsBuffer*(buffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBufferData*(target: GLenum, size: GLsizeiptr, data: PGLvoid, - usage: GLenum){.stdcall, importc, ogl.} -proc glBufferSubData*(target: GLenum, offset: GLintptr, size: GLsizeiptr, - data: PGLvoid){.stdcall, importc, ogl.} -proc glGetBufferSubData*(target: GLenum, offset: GLintptr, size: GLsizeiptr, - data: PGLvoid){.stdcall, importc, ogl.} -proc glMapBuffer*(target: GLenum, access: GLenum): PGLvoid{.stdcall, importc, ogl.} -proc glUnmapBuffer*(target: GLenum): GLboolean{.stdcall, importc, ogl.} -proc glGetBufferParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetBufferPointerv*(target: GLenum, pname: GLenum, params: PGLvoid){. - stdcall, importc, ogl.} - # GL_VERSION_2_0 -proc glBlendEquationSeparate*(modeRGB: GLenum, modeAlpha: GLenum){.stdcall, importc, ogl.} -proc glDrawBuffers*(n: GLsizei, bufs: PGLenum){.stdcall, importc, ogl.} -proc glStencilOpSeparate*(face: GLenum, sfail: GLenum, dpfail: GLenum, - dppass: GLenum){.stdcall, importc, ogl.} -proc glStencilFuncSeparate*(face: GLenum, func: GLenum, theRef: GLint, mask: GLuint){. - stdcall, importc, ogl.} -proc glStencilMaskSeparate*(face: GLenum, mask: GLuint){.stdcall, importc, ogl.} -proc glAttachShader*(programObj, shaderObj: GLhandle){.stdcall, importc, ogl.} -proc glBindAttribLocation*(programObj: GLhandle, index: GLuint, name: PGLChar){. - stdcall, importc, ogl.} -proc glCompileShader*(shaderObj: GLhandle){.stdcall, importc, ogl.} -proc glCreateProgram*(): GLhandle{.stdcall, importc, ogl.} -proc glCreateShader*(shaderType: GLenum): GLhandle{.stdcall, importc, ogl.} -proc glDeleteProgram*(programObj: GLhandle){.stdcall, importc, ogl.} -proc glDeleteShader*(shaderObj: GLhandle){.stdcall, importc, ogl.} -proc glDetachShader*(programObj, shaderObj: GLhandle){.stdcall, importc, ogl.} -proc glDisableVertexAttribArray*(index: GLuint){.stdcall, importc, ogl.} -proc glEnableVertexAttribArray*(index: GLuint){.stdcall, importc, ogl.} -proc glGetActiveAttrib*(programObj: GLhandle, index: GLuint, maxlength: GLsizei, - len: var GLint, size: var GLint, typ: var GLenum, - name: PGLChar){.stdcall, importc, ogl.} -proc glGetActiveUniform*(programObj: GLhandle, index: GLuint, - maxLength: GLsizei, len: var GLsizei, size: var GLint, - typ: var GLenum, name: PGLChar){.stdcall, importc, ogl.} -proc glGetAttachedShaders*(programObj: GLhandle, MaxCount: GLsizei, - Count: var GLint, shaders: PGLuint){.stdcall, importc, ogl.} -proc glGetAttribLocation*(programObj: GLhandle, char: PGLChar): glint{.stdcall, importc, ogl.} -proc glGetProgramiv*(programObj: GLhandle, pname: GLenum, params: PGLInt){. - stdcall, importc, ogl.} -proc glGetProgramInfoLog*(programObj: GLHandle, maxLength: glsizei, - len: var GLint, infoLog: PGLChar){.stdcall, importc, ogl.} -proc glGetShaderiv*(shaderObj: GLhandle, pname: GLenum, params: PGLInt){.stdcall, importc, ogl.} -proc glGetShaderInfoLog*(shaderObj: GLHandle, maxLength: glsizei, - len: var glint, infoLog: PGLChar){.stdcall, importc, ogl.} -proc glGetShaderSource*(shaderObj: GLhandle, maxlength: GLsizei, - len: var GLsizei, source: PGLChar){.stdcall, importc, ogl.} -proc glGetUniformLocation*(programObj: GLhandle, char: PGLChar): glint{.stdcall, importc, ogl.} -proc glGetUniformfv*(programObj: GLhandle, location: GLint, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetUniformiv*(programObj: GLhandle, location: GLint, params: PGLInt){. - stdcall, importc, ogl.} -proc glGetVertexAttribfv*(index: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetVertexAttribiv*(index: GLuint, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetVertexAttribPointerv*(index: GLuint, pname: GLenum, pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glIsProgram*(programObj: GLhandle): GLboolean{.stdcall, importc, ogl.} -proc glIsShader*(shaderObj: GLhandle): GLboolean{.stdcall, importc, ogl.} -proc glLinkProgram*(programObj: GLHandle){.stdcall, importc, ogl.} -proc glShaderSource*(shaderObj: GLHandle, count: glsizei, string: cstringArray, - lengths: pglint){.stdcall, importc, ogl.} -proc glUseProgram*(programObj: GLhandle){.stdcall, importc, ogl.} -proc glUniform1f*(location: GLint, v0: GLfloat){.stdcall, importc, ogl.} -proc glUniform2f*(location: GLint, v0, v1: GLfloat){.stdcall, importc, ogl.} -proc glUniform3f*(location: GLint, v0, v1, v2: GLfloat){.stdcall, importc, ogl.} -proc glUniform4f*(location: GLint, v0, v1, v2, v3: GLfloat){.stdcall, importc, ogl.} -proc glUniform1i*(location: GLint, v0: GLint){.stdcall, importc, ogl.} -proc glUniform2i*(location: GLint, v0, v1: GLint){.stdcall, importc, ogl.} -proc glUniform3i*(location: GLint, v0, v1, v2: GLint){.stdcall, importc, ogl.} -proc glUniform4i*(location: GLint, v0, v1, v2, v3: GLint){.stdcall, importc, ogl.} -proc glUniform1fv*(location: GLint, count: GLsizei, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniform2fv*(location: GLint, count: GLsizei, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniform3fv*(location: GLint, count: GLsizei, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniform4fv*(location: GLint, count: GLsizei, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniform1iv*(location: GLint, count: GLsizei, value: PGLint){.stdcall, importc, ogl.} -proc glUniform2iv*(location: GLint, count: GLsizei, value: PGLint){.stdcall, importc, ogl.} -proc glUniform3iv*(location: GLint, count: GLsizei, value: PGLint){.stdcall, importc, ogl.} -proc glUniform4iv*(location: GLint, count: GLsizei, value: PGLint){.stdcall, importc, ogl.} -proc glUniformMatrix2fv*(location: GLint, count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix3fv*(location: GLint, count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix4fv*(location: GLint, count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glValidateProgram*(programObj: GLhandle){.stdcall, importc, ogl.} -proc glVertexAttrib1d*(index: GLuint, x: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib1dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib1f*(index: GLuint, x: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib1fv*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib1s*(index: GLuint, x: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib1sv*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib2d*(index: GLuint, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib2dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib2f*(index: GLuint, x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib2fv*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib2s*(index: GLuint, x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib2sv*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib3d*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glVertexAttrib3dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib3f*(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glVertexAttrib3fv*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib3s*(index: GLuint, x: GLshort, y: GLshort, z: GLshort){. - stdcall, importc, ogl.} -proc glVertexAttrib3sv*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4Nbv*(index: GLuint, v: PGLbyte){.stdcall, importc, ogl.} -proc glVertexAttrib4Niv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttrib4Nsv*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4Nub*(index: GLuint, x: GLubyte, y: GLubyte, z: GLubyte, - w: GLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4Nubv*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4Nuiv*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttrib4Nusv*(index: GLuint, v: PGLushort){.stdcall, importc, ogl.} -proc glVertexAttrib4bv*(index: GLuint, v: PGLbyte){.stdcall, importc, ogl.} -proc glVertexAttrib4d*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib4dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib4f*(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, - w: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib4fv*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib4iv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttrib4s*(index: GLuint, x: GLshort, y: GLshort, z: GLshort, - w: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4sv*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4ubv*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4uiv*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttrib4usv*(index: GLuint, v: PGLushort){.stdcall, importc, ogl.} -proc glVertexAttribPointer*(index: GLuint, size: GLint, typ: GLenum, - normalized: GLboolean, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_VERSION_2_1 -proc glUniformMatrix2x3fv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix3x2fv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix2x4fv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix4x2fv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix3x4fv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glUniformMatrix4x3fv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} - # GL_VERSION_3_0 - # OpenGL 3.0 also reuses entry points from these extensions: - # ARB_framebuffer_object - # ARB_map_buffer_range - # ARB_vertex_array_object -proc glColorMaski*(index: GLuint, r: GLboolean, g: GLboolean, b: GLboolean, - a: GLboolean){.stdcall, importc, ogl.} -proc glGetBooleani_v*(target: GLenum, index: GLuint, data: PGLboolean){.stdcall, importc, ogl.} -proc glGetIntegeri_v*(target: GLenum, index: GLuint, data: PGLint){.stdcall, importc, ogl.} -proc glEnablei*(target: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glDisablei*(target: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glIsEnabledi*(target: GLenum, index: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBeginTransformFeedback*(primitiveMode: GLenum){.stdcall, importc, ogl.} -proc glEndTransformFeedback*(){.stdcall, importc, ogl.} -proc glBindBufferRange*(target: GLenum, index: GLuint, buffer: GLuint, - offset: GLintptr, size: GLsizeiptr){.stdcall, importc, ogl.} -proc glBindBufferBase*(target: GLenum, index: GLuint, buffer: GLuint){.stdcall, importc, ogl.} -proc glTransformFeedbackVaryings*(prog: GLuint, count: GLsizei, - varyings: cstringArray, bufferMode: GLenum){. - stdcall, importc, ogl.} -proc glGetTransformFeedbackVarying*(prog: GLuint, index: GLuint, - bufSize: GLsizei, len: PGLsizei, - size: PGLsizei, typ: PGLsizei, name: PGLchar){. - stdcall, importc, ogl.} -proc glClampColor*(targe: GLenum, clamp: GLenum){.stdcall, importc, ogl.} -proc glBeginConditionalRender*(id: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glEndConditionalRender*(){.stdcall, importc, ogl.} -proc glVertexAttribIPointer*(index: GLuint, size: GLint, typ: GLenum, - stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glGetVertexAttribIiv*(index: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetVertexAttribIuiv*(index: GLuint, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} -proc glVertexAttribI1i*(index: GLuint, x: GLint){.stdcall, importc, ogl.} -proc glVertexAttribI2i*(index: GLuint, x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glVertexAttribI3i*(index: GLuint, x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glVertexAttribI4i*(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint){. - stdcall, importc, ogl.} -proc glVertexAttribI1ui*(index: GLuint, x: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribI2ui*(index: GLuint, x: GLuint, y: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribI3ui*(index: GLuint, x: GLuint, y: GLuint, z: GLuint){. - stdcall, importc, ogl.} -proc glVertexAttribI4ui*(index: GLuint, x: GLuint, y: GLuint, z: GLuint, - w: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribI1iv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI2iv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI3iv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI4iv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI1uiv*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI2uiv*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI3uiv*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI4uiv*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI4bv*(index: GLuint, v: PGLbyte){.stdcall, importc, ogl.} -proc glVertexAttribI4sv*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttribI4ubv*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttribI4usv*(index: GLuint, v: PGLushort){.stdcall, importc, ogl.} -proc glGetUniformuiv*(prog: GLuint, location: GLint, params: PGLuint){.stdcall, importc, ogl.} -proc glBindFragDataLocation*(prog: GLuint, color: GLuint, name: PGLChar){. - stdcall, importc, ogl.} -proc glGetFragDataLocation*(prog: GLuint, name: PGLChar): GLint{.stdcall, importc, ogl.} -proc glUniform1ui*(location: GLint, v0: GLuint){.stdcall, importc, ogl.} -proc glUniform2ui*(location: GLint, v0: GLuint, v1: GLuint){.stdcall, importc, ogl.} -proc glUniform3ui*(location: GLint, v0: GLuint, v1: GLuint, v2: GLuint){.stdcall, importc, ogl.} -proc glUniform4ui*(location: GLint, v0: GLuint, v1: GLuint, v2: GLuint, - v3: GLuint){.stdcall, importc, ogl.} -proc glUniform1uiv*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glUniform2uiv*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glUniform3uiv*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glUniform4uiv*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glTexParameterIiv*(target: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glTexParameterIuiv*(target: GLenum, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} -proc glGetTexParameterIiv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetTexParameterIuiv*(target: GLenum, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} -proc glClearBufferiv*(buffer: GLenum, drawbuffer: GLint, value: PGLint){.stdcall, importc, ogl.} -proc glClearBufferuiv*(buffer: GLenum, drawbuffer: GLint, value: PGLuint){. - stdcall, importc, ogl.} -proc glClearBufferfv*(buffer: GLenum, drawbuffer: GLint, value: PGLfloat){. - stdcall, importc, ogl.} -proc glClearBufferfi*(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, - stencil: GLint){.stdcall, importc, ogl.} -proc glGetStringi*(name: GLenum, index: GLuint): PGLubyte{.stdcall, importc, ogl.} - # GL_VERSION_3_1 - # OpenGL 3.1 also reuses entry points from these extensions: - # ARB_copy_buffer - # ARB_uniform_buffer_object -proc glDrawArraysInstanced*(mode: GLenum, first: GLint, count: GLsizei, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glDrawElementsInstanced*(mode: GLenum, count: GLsizei, typ: GLenum, - indices: PGLvoid, primcount: GLsizei){.stdcall, importc, ogl.} -proc glTexBuffer*(target: GLenum, internalformat: GLenum, buffer: GLuint){. - stdcall, importc, ogl.} -proc glPrimitiveRestartIndex*(index: GLuint){.stdcall, importc, ogl.} - # GL_VERSION_3_2 - # OpenGL 3.2 also reuses entry points from these extensions: - # ARB_draw_elements_base_vertex - # ARB_provoking_vertex - # ARB_sync - # ARB_texture_multisample -proc glGetInteger64i_v*(target: GLenum, index: GLuint, data: PGLint64){.stdcall, importc, ogl.} -proc glGetBufferParameteri64v*(target: GLenum, pname: GLenum, params: PGLint64){. - stdcall, importc, ogl.} -proc glFramebufferTexture*(target: GLenum, attachment: GLenum, texture: GLuint, - level: GLint){.stdcall, importc, ogl.} - #procedure glFramebufferTextureFace(target: GLenum; attachment: GLenum; texture: GLuint; level: GLint; face: GLenum); stdcall, importc, ogl; - # GL_VERSION_3_3 - # OpenGL 3.3 also reuses entry points from these extensions: - # ARB_blend_func_extended - # ARB_sampler_objects - # ARB_explicit_attrib_location, but it has none - # ARB_occlusion_query2 (no entry points) - # ARB_shader_bit_encoding (no entry points) - # ARB_texture_rgb10_a2ui (no entry points) - # ARB_texture_swizzle (no entry points) - # ARB_timer_query - # ARB_vertextyp_2_10_10_10_rev -proc glVertexAttribDivisor*(index: GLuint, divisor: GLuint){.stdcall, importc, ogl.} - # GL_VERSION_4_0 - # OpenGL 4.0 also reuses entry points from these extensions: - # ARB_texture_query_lod (no entry points) - # ARB_draw_indirect - # ARB_gpu_shader5 (no entry points) - # ARB_gpu_shader_fp64 - # ARB_shader_subroutine - # ARB_tessellation_shader - # ARB_texture_buffer_object_rgb32 (no entry points) - # ARB_texture_cube_map_array (no entry points) - # ARB_texture_gather (no entry points) - # ARB_transform_feedback2 - # ARB_transform_feedback3 -proc glMinSampleShading*(value: GLclampf){.stdcall, importc, ogl.} -proc glBlendEquationi*(buf: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glBlendEquationSeparatei*(buf: GLuint, modeRGB: GLenum, modeAlpha: GLenum){. - stdcall, importc, ogl.} -proc glBlendFunci*(buf: GLuint, src: GLenum, dst: GLenum){.stdcall, importc, ogl.} -proc glBlendFuncSeparatei*(buf: GLuint, srcRGB: GLenum, dstRGB: GLenum, - srcAlpha: GLenum, dstAlpha: GLenum){.stdcall, importc, ogl.} - # GL_VERSION_4_1 - # OpenGL 4.1 also reuses entry points from these extensions: - # ARB_ES2_compatibility - # ARB_get_program_binary - # ARB_separate_shader_objects - # ARB_shader_precision (no entry points) - # ARB_vertex_attrib_64bit - # ARB_viewport_array - # GL_3DFX_tbuffer -proc glTbufferMask3DFX*(mask: GLuint){.stdcall, importc, ogl.} - # GL_APPLE_element_array -proc glElementPointerAPPLE*(typ: GLenum, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glDrawElementArrayAPPLE*(mode: GLenum, first: GLint, count: GLsizei){. - stdcall, importc, ogl.} -proc glDrawRangeElementArrayAPPLE*(mode: GLenum, start: GLuint, ending: GLuint, - first: GLint, count: GLsizei){.stdcall, importc, ogl.} -proc glMultiDrawElementArrayAPPLE*(mode: GLenum, first: PGLint, count: PGLsizei, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glMultiDrawRangeElementArrayAPPLE*(mode: GLenum, start: GLuint, - ending: GLuint, first: PGLint, - count: PGLsizei, primcount: GLsizei){. - stdcall, importc, ogl.} - # GL_APPLE_fence -proc glGenFencesAPPLE*(n: GLsizei, fences: PGLuint){.stdcall, importc, ogl.} -proc glDeleteFencesAPPLE*(n: GLsizei, fences: PGLuint){.stdcall, importc, ogl.} -proc glSetFenceAPPLE*(fence: GLuint){.stdcall, importc, ogl.} -proc glIsFenceAPPLE*(fence: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glTestFenceAPPLE*(fence: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glFinishFenceAPPLE*(fence: GLuint){.stdcall, importc, ogl.} -proc glTestObjectAPPLE*(obj: GLenum, name: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glFinishObjectAPPLE*(obj: GLenum, name: GLint){.stdcall, importc, ogl.} - # GL_APPLE_vertex_array_object -proc glBindVertexArrayAPPLE*(arr: GLuint){.stdcall, importc, ogl.} -proc glDeleteVertexArraysAPPLE*(n: GLsizei, arrays: PGLuint){.stdcall, importc, ogl.} -proc glGenVertexArraysAPPLE*(n: GLsizei, arrays: PGLuint){.stdcall, importc, ogl.} -proc glIsVertexArrayAPPLE*(arr: GLuint): GLboolean{.stdcall, importc, ogl.} - # GL_APPLE_vertex_array_range -proc glVertexArrayRangeAPPLE*(len: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glFlushVertexArrayRangeAPPLE*(len: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glVertexArrayParameteriAPPLE*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} - # GL_APPLE_texture_range -proc glTextureRangeAPPLE*(target: GLenum, len: GLsizei, Pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glGetTexParameterPointervAPPLE*(target: GLenum, pname: GLenum, - params: PPGLvoid){.stdcall, importc, ogl.} - # GL_APPLE_vertex_program_evaluators -proc glEnableVertexAttribAPPLE*(index: GLuint, pname: GLenum){.stdcall, importc, ogl.} -proc glDisableVertexAttribAPPLE*(index: GLuint, pname: GLenum){.stdcall, importc, ogl.} -proc glIsVertexAttribEnabledAPPLE*(index: GLuint, pname: GLenum): GLboolean{. - stdcall, importc, ogl.} -proc glMapVertexAttrib1dAPPLE*(index: GLuint, size: GLuint, u1: GLdouble, - u2: GLdouble, stride: GLint, order: GLint, - points: PGLdouble){.stdcall, importc, ogl.} -proc glMapVertexAttrib1fAPPLE*(index: GLuint, size: GLuint, u1: GLfloat, - u2: GLfloat, stride: GLint, order: GLint, - points: PGLfloat){.stdcall, importc, ogl.} -proc glMapVertexAttrib2dAPPLE*(index: GLuint, size: GLuint, u1: GLdouble, - u2: GLdouble, ustride: GLint, uorder: GLint, - v1: GLdouble, v2: GLdouble, vstride: GLint, - vorder: GLint, points: PGLdouble){.stdcall, importc, ogl.} -proc glMapVertexAttrib2fAPPLE*(index: GLuint, size: GLuint, u1: GLfloat, - u2: GLfloat, ustride: GLint, order: GLint, - v1: GLfloat, v2: GLfloat, vstride: GLint, - vorder: GLint, points: GLfloat){.stdcall, importc, ogl.} - # GL_APPLE_object_purgeable -proc glObjectPurgeableAPPLE*(objectType: GLenum, name: GLuint, option: GLenum): GLenum{. - stdcall, importc, ogl.} -proc glObjectUnpurgeableAPPLE*(objectType: GLenum, name: GLuint, option: GLenum): GLenum{. - stdcall, importc, ogl.} -proc glGetObjectParameterivAPPLE*(objectType: GLenum, name: GLuint, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} - # GL_ARB_matrix_palette -proc glCurrentPaletteMatrixARB*(index: GLint){.stdcall, importc, ogl.} -proc glMatrixIndexubvARB*(size: GLint, indices: PGLubyte){.stdcall, importc, ogl.} -proc glMatrixIndexusvARB*(size: GLint, indices: PGLushort){.stdcall, importc, ogl.} -proc glMatrixIndexuivARB*(size: GLint, indices: PGLuint){.stdcall, importc, ogl.} -proc glMatrixIndexPointerARB*(size: GLint, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_ARB_multisample -proc glSampleCoverageARB*(value: GLclampf, invert: GLboolean){.stdcall, importc, ogl.} - # GL_ARB_multitexture -proc glActiveTextureARB*(texture: GLenum){.stdcall, importc, ogl.} -proc glClientActiveTextureARB*(texture: GLenum){.stdcall, importc, ogl.} -proc glMultiTexCoord1dARB*(target: GLenum, s: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord1dvARB*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord1fARB*(target: GLenum, s: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord1fvARB*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord1iARB*(target: GLenum, s: GLint){.stdcall, importc, ogl.} -proc glMultiTexCoord1ivARB*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord1sARB*(target: GLenum, s: GLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord1svARB*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord2dARB*(target: GLenum, s: GLdouble, t: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord2dvARB*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord2fARB*(target: GLenum, s: GLfloat, t: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord2fvARB*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord2iARB*(target: GLenum, s: GLint, t: GLint){.stdcall, importc, ogl.} -proc glMultiTexCoord2ivARB*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord2sARB*(target: GLenum, s: GLshort, t: GLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord2svARB*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord3dARB*(target: GLenum, s: GLdouble, t: GLdouble, r: GLdouble){. - stdcall, importc, ogl.} -proc glMultiTexCoord3dvARB*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord3fARB*(target: GLenum, s: GLfloat, t: GLfloat, r: GLfloat){. - stdcall, importc, ogl.} -proc glMultiTexCoord3fvARB*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord3iARB*(target: GLenum, s: GLint, t: GLint, r: GLint){. - stdcall, importc, ogl.} -proc glMultiTexCoord3ivARB*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord3sARB*(target: GLenum, s: GLshort, t: GLshort, r: GLshort){. - stdcall, importc, ogl.} -proc glMultiTexCoord3svARB*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord4dARB*(target: GLenum, s: GLdouble, t: GLdouble, - r: GLdouble, q: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord4dvARB*(target: GLenum, v: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexCoord4fARB*(target: GLenum, s: GLfloat, t: GLfloat, r: GLfloat, - q: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord4fvARB*(target: GLenum, v: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexCoord4iARB*(target: GLenum, s: GLint, t: GLint, r: GLint, - q: GLint){.stdcall, importc, ogl.} -proc glMultiTexCoord4ivARB*(target: GLenum, v: PGLint){.stdcall, importc, ogl.} -proc glMultiTexCoord4sARB*(target: GLenum, s: GLshort, t: GLshort, r: GLshort, - q: GLshort){.stdcall, importc, ogl.} -proc glMultiTexCoord4svARB*(target: GLenum, v: PGLshort){.stdcall, importc, ogl.} - # GL_ARB_point_parameters -proc glPointParameterfARB*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPointParameterfvARB*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} - # GL_ARB_texture_compression -proc glCompressedTexImage3DARB*(target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, depth: GLsizei, border: GLint, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexImage2DARB*(target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, border: GLint, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexImage1DARB*(target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - border: GLint, imageSize: GLsizei, data: PGLvoid){. - stdcall, importc, ogl.} -proc glCompressedTexSubImage3DARB*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, - width: GLsizei, height: GLsizei, - depth: GLsizei, format: GLenum, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexSubImage2DARB*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, width: GLsizei, - height: GLsizei, format: GLenum, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTexSubImage1DARB*(target: GLenum, level: GLint, xoffset: GLint, - width: GLsizei, format: GLenum, - imageSize: GLsizei, data: PGLvoid){.stdcall, importc, ogl.} -proc glGetCompressedTexImageARB*(target: GLenum, level: GLint, img: PGLvoid){. - stdcall, importc, ogl.} - # GL_ARB_transpose_matrix -proc glLoadTransposeMatrixfARB*(m: PGLfloat){.stdcall, importc, ogl.} -proc glLoadTransposeMatrixdARB*(m: PGLdouble){.stdcall, importc, ogl.} -proc glMultTransposeMatrixfARB*(m: PGLfloat){.stdcall, importc, ogl.} -proc glMultTransposeMatrixdARB*(m: PGLdouble){.stdcall, importc, ogl.} - # GL_ARB_vertex_blend -proc glWeightbvARB*(size: GLint, weights: PGLbyte){.stdcall, importc, ogl.} -proc glWeightsvARB*(size: GLint, weights: PGLshort){.stdcall, importc, ogl.} -proc glWeightivARB*(size: GLint, weights: PGLint){.stdcall, importc, ogl.} -proc glWeightfvARB*(size: GLint, weights: PGLfloat){.stdcall, importc, ogl.} -proc glWeightdvARB*(size: GLint, weights: PGLdouble){.stdcall, importc, ogl.} -proc glWeightubvARB*(size: GLint, weights: PGLubyte){.stdcall, importc, ogl.} -proc glWeightusvARB*(size: GLint, weights: PGLushort){.stdcall, importc, ogl.} -proc glWeightuivARB*(size: GLint, weights: PGLuint){.stdcall, importc, ogl.} -proc glWeightPointerARB*(size: GLint, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glVertexBlendARB*(count: GLint){.stdcall, importc, ogl.} - # GL_ARB_vertex_buffer_object -proc glBindBufferARB*(target: GLenum, buffer: GLuint){.stdcall, importc, ogl.} -proc glDeleteBuffersARB*(n: GLsizei, buffers: PGLuint){.stdcall, importc, ogl.} -proc glGenBuffersARB*(n: GLsizei, buffers: PGLuint){.stdcall, importc, ogl.} -proc glIsBufferARB*(buffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBufferDataARB*(target: GLenum, size: GLsizeiptrARB, data: PGLvoid, - usage: GLenum){.stdcall, importc, ogl.} -proc glBufferSubDataARB*(target: GLenum, offset: GLintptrARB, - size: GLsizeiptrARB, data: PGLvoid){.stdcall, importc, ogl.} -proc glGetBufferSubDataARB*(target: GLenum, offset: GLintptrARB, - size: GLsizeiptrARB, data: PGLvoid){.stdcall, importc, ogl.} -proc glMapBufferARB*(target: GLenum, access: GLenum): PGLvoid{.stdcall, importc, ogl.} -proc glUnmapBufferARB*(target: GLenum): GLboolean{.stdcall, importc, ogl.} -proc glGetBufferParameterivARB*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetBufferPointervARB*(target: GLenum, pname: GLenum, params: PGLvoid){. - stdcall, importc, ogl.} - # GL_ARB_vertex_program -proc glVertexAttrib1dARB*(index: GLuint, x: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib1dvARB*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib1fARB*(index: GLuint, x: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib1fvARB*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib1sARB*(index: GLuint, x: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib1svARB*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib2dARB*(index: GLuint, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib2dvARB*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib2fARB*(index: GLuint, x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib2fvARB*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib2sARB*(index: GLuint, x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib2svARB*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib3dARB*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glVertexAttrib3dvARB*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib3fARB*(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glVertexAttrib3fvARB*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib3sARB*(index: GLuint, x: GLshort, y: GLshort, z: GLshort){. - stdcall, importc, ogl.} -proc glVertexAttrib3svARB*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4NbvARB*(index: GLuint, v: PGLbyte){.stdcall, importc, ogl.} -proc glVertexAttrib4NivARB*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttrib4NsvARB*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4NubARB*(index: GLuint, x: GLubyte, y: GLubyte, z: GLubyte, - w: GLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4NubvARB*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4NuivARB*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttrib4NusvARB*(index: GLuint, v: PGLushort){.stdcall, importc, ogl.} -proc glVertexAttrib4bvARB*(index: GLuint, v: PGLbyte){.stdcall, importc, ogl.} -proc glVertexAttrib4dARB*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib4dvARB*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib4fARB*(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, - w: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib4fvARB*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib4ivARB*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttrib4sARB*(index: GLuint, x: GLshort, y: GLshort, z: GLshort, - w: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4svARB*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4ubvARB*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4uivARB*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttrib4usvARB*(index: GLuint, v: PGLushort){.stdcall, importc, ogl.} -proc glVertexAttribPointerARB*(index: GLuint, size: GLint, typ: GLenum, - normalized: GLboolean, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glEnableVertexAttribArrayARB*(index: GLuint){.stdcall, importc, ogl.} -proc glDisableVertexAttribArrayARB*(index: GLuint){.stdcall, importc, ogl.} -proc glProgramStringARB*(target: GLenum, format: GLenum, length: GLsizei, - string: PGLvoid){.stdcall, importc, ogl.} -proc glBindProgramARB*(target: GLenum, prog: GLuint){.stdcall, importc, ogl.} -proc glDeleteProgramsARB*(n: GLsizei, programs: PGLuint){.stdcall, importc, ogl.} -proc glGenProgramsARB*(n: GLsizei, programs: PGLuint){.stdcall, importc, ogl.} -proc glProgramEnvParameter4dARB*(target: GLenum, index: GLuint, x: GLdouble, - y: GLdouble, z: GLdouble, w: GLdouble){.stdcall, importc, ogl.} -proc glProgramEnvParameter4dvARB*(target: GLenum, index: GLuint, - params: PGLdouble){.stdcall, importc, ogl.} -proc glProgramEnvParameter4fARB*(target: GLenum, index: GLuint, x: GLfloat, - y: GLfloat, z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glProgramEnvParameter4fvARB*(target: GLenum, index: GLuint, - params: PGLfloat){.stdcall, importc, ogl.} -proc glProgramLocalParameter4dARB*(target: GLenum, index: GLuint, x: GLdouble, - y: GLdouble, z: GLdouble, w: GLdouble){. - stdcall, importc, ogl.} -proc glProgramLocalParameter4dvARB*(target: GLenum, index: GLuint, - params: PGLdouble){.stdcall, importc, ogl.} -proc glProgramLocalParameter4fARB*(target: GLenum, index: GLuint, x: GLfloat, - y: GLfloat, z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glProgramLocalParameter4fvARB*(target: GLenum, index: GLuint, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetProgramEnvParameterdvARB*(target: GLenum, index: GLuint, - params: PGLdouble){.stdcall, importc, ogl.} -proc glGetProgramEnvParameterfvARB*(target: GLenum, index: GLuint, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetProgramLocalParameterdvARB*(target: GLenum, index: GLuint, - params: PGLdouble){.stdcall, importc, ogl.} -proc glGetProgramLocalParameterfvARB*(target: GLenum, index: GLuint, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetProgramivARB*(target: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetProgramStringARB*(target: GLenum, pname: GLenum, string: PGLvoid){. - stdcall, importc, ogl.} -proc glGetVertexAttribdvARB*(index: GLuint, pname: GLenum, params: PGLdouble){. - stdcall, importc, ogl.} -proc glGetVertexAttribfvARB*(index: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetVertexAttribivARB*(index: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetVertexAttribPointervARB*(index: GLuint, pname: GLenum, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glIsProgramARB*(prog: GLuint): GLboolean{.stdcall, importc, ogl.} - # GL_ARB_window_pos -proc glWindowPos2dARB*(x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glWindowPos2dvARB*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos2fARB*(x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos2fvARB*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos2iARB*(x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glWindowPos2ivARB*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos2sARB*(x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glWindowPos2svARB*(v: PGLshort){.stdcall, importc, ogl.} -proc glWindowPos3dARB*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glWindowPos3dvARB*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos3fARB*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos3fvARB*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos3iARB*(x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glWindowPos3ivARB*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos3sARB*(x: GLshort, y: GLshort, z: GLshort){.stdcall, importc, ogl.} -proc glWindowPos3svARB*(v: PGLshort){.stdcall, importc, ogl.} - # GL_ARB_draw_buffers -proc glDrawBuffersARB*(n: GLsizei, bufs: PGLenum){.stdcall, importc, ogl.} - # GL_ARB_color_buffer_float -proc glClampColorARB*(target: GLenum, clamp: GLenum){.stdcall, importc, ogl.} - # GL_ARB_vertex_shader -proc glGetActiveAttribARB*(programobj: GLhandleARB, index: GLuint, - maxLength: GLsizei, len: var GLsizei, - size: var GLint, typ: var GLenum, name: PGLcharARB){. - stdcall, importc, ogl.} -proc glGetAttribLocationARB*(programObj: GLhandleARB, char: PGLcharARB): glint{. - stdcall, importc, ogl.} -proc glBindAttribLocationARB*(programObj: GLhandleARB, index: GLuint, - name: PGLcharARB){.stdcall, importc, ogl.} - # GL_ARB_shader_objects -proc glDeleteObjectARB*(Obj: GLHandleARB){.stdcall, importc, ogl.} -proc glGetHandleARB*(pname: GlEnum): GLHandleARB{.stdcall, importc, ogl.} -proc glDetachObjectARB*(container, attached: GLHandleARB){.stdcall, importc, ogl.} -proc glCreateShaderObjectARB*(shaderType: glenum): GLHandleARB{.stdcall, importc, ogl.} -proc glShaderSourceARB*(shaderObj: GLHandleARB, count: glsizei, - string: cstringArray, lengths: pglint){.stdcall, importc, ogl.} -proc glCompileShaderARB*(shaderObj: GLHandleARB){.stdcall, importc, ogl.} -proc glCreateProgramObjectARB*(): GLHandleARB{.stdcall, importc, ogl.} -proc glAttachObjectARB*(programObj, shaderObj: GLhandleARB){.stdcall, importc, ogl.} -proc glLinkProgramARB*(programObj: GLHandleARB){.stdcall, importc, ogl.} -proc glUseProgramObjectARB*(programObj: GLHandleARB){.stdcall, importc, ogl.} -proc glValidateProgramARB*(programObj: GLhandleARB){.stdcall, importc, ogl.} -proc glUniform1fARB*(location: glint, v0: glfloat){.stdcall, importc, ogl.} -proc glUniform2fARB*(location: glint, v0, v1: glfloat){.stdcall, importc, ogl.} -proc glUniform3fARB*(location: glint, v0, v1, v2: glfloat){.stdcall, importc, ogl.} -proc glUniform4fARB*(location: glint, v0, v1, v2, v3: glfloat){.stdcall, importc, ogl.} -proc glUniform1iARB*(location: glint, v0: glint){.stdcall, importc, ogl.} -proc glUniform2iARB*(location: glint, v0, v1: glint){.stdcall, importc, ogl.} -proc glUniform3iARB*(location: glint, v0, v1, v2: glint){.stdcall, importc, ogl.} -proc glUniform4iARB*(location: glint, v0, v1, v2, v3: glint){.stdcall, importc, ogl.} -proc glUniform1fvARB*(location: glint, count: GLsizei, value: pglfloat){.stdcall, importc, ogl.} -proc glUniform2fvARB*(location: glint, count: GLsizei, value: pglfloat){.stdcall, importc, ogl.} -proc glUniform3fvARB*(location: glint, count: GLsizei, value: pglfloat){.stdcall, importc, ogl.} -proc glUniform4fvARB*(location: glint, count: GLsizei, value: pglfloat){.stdcall, importc, ogl.} -proc glUniform1ivARB*(location: glint, count: GLsizei, value: pglint){.stdcall, importc, ogl.} -proc glUniform2ivARB*(location: glint, count: GLsizei, value: pglint){.stdcall, importc, ogl.} -proc glUniform3ivARB*(location: glint, count: GLsizei, value: pglint){.stdcall, importc, ogl.} -proc glUniform4ivARB*(location: glint, count: GLsizei, value: pglint){.stdcall, importc, ogl.} -proc glUniformMatrix2fvARB*(location: glint, count: glsizei, - transpose: glboolean, value: pglfloat){.stdcall, importc, ogl.} -proc glUniformMatrix3fvARB*(location: glint, count: glsizei, - transpose: glboolean, value: pglfloat){.stdcall, importc, ogl.} -proc glUniformMatrix4fvARB*(location: glint, count: glsizei, - transpose: glboolean, value: pglfloat){.stdcall, importc, ogl.} -proc glGetObjectParameterfvARB*(Obj: GLHandleARB, pname: GLEnum, - params: PGLFloat){.stdcall, importc, ogl.} -proc glGetObjectParameterivARB*(Obj: GLHandleARB, pname: GLEnum, params: PGLInt){. - stdcall, importc, ogl.} -proc glGetInfoLogARB*(shaderObj: GLHandleARB, maxLength: glsizei, - len: var glint, infoLog: PGLcharARB){.stdcall, importc, ogl.} -proc glGetAttachedObjectsARB*(programobj: GLhandleARB, maxCount: GLsizei, - count: var GLsizei, objects: PGLhandleARB){. - stdcall, importc, ogl.} -proc glGetUniformLocationARB*(programObj: GLhandleARB, char: PGLcharARB): glint{. - stdcall, importc, ogl.} -proc glGetActiveUniformARB*(programobj: GLhandleARB, index: GLuint, - maxLength: GLsizei, len: var GLsizei, - size: var GLint, typ: var GLenum, name: PGLcharARB){. - stdcall, importc, ogl.} -proc glGetUniformfvARB*(programObj: GLhandleARB, location: GLint, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetUniformivARB*(programObj: GLhandleARB, location: GLint, params: PGLInt){. - stdcall, importc, ogl.} -proc glGetShaderSourceARB*(shader: GLhandleARB, maxLength: GLsizei, - len: var GLsizei, source: PGLcharARB){.stdcall, importc, ogl.} - # GL_ARB_Occlusion_Query -proc glGenQueriesARB*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glDeleteQueriesARB*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glIsQueryARB*(id: GLuint): bool{.stdcall, importc, ogl.} -proc glBeginQueryARB*(target: GLenum, id: GLuint){.stdcall, importc, ogl.} -proc glEndQueryARB*(target: GLenum){.stdcall, importc, ogl.} -proc glGetQueryivARB*(target, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetQueryObjectivARB*(id: GLuint, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetQueryObjectuivARB*(id: GLuint, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} - # GL_ARB_draw_instanced -proc glDrawArraysInstancedARB*(mode: GLenum, first: GLint, count: GLsizei, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glDrawElementsInstancedARB*(mode: GLenum, count: GLsizei, typ: GLenum, - indices: PGLvoid, primcount: GLsizei){.stdcall, importc, ogl.} - # GL_ARB_framebuffer_object -proc glIsRenderbuffer*(renderbuffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBindRenderbuffer*(target: GLenum, renderbuffer: GLuint){.stdcall, importc, ogl.} -proc glDeleteRenderbuffers*(n: GLsizei, renderbuffers: PGLuint){.stdcall, importc, ogl.} -proc glGenRenderbuffers*(n: GLsizei, renderbuffers: PGLuint){.stdcall, importc, ogl.} -proc glRenderbufferStorage*(target: GLenum, internalformat: GLenum, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glGetRenderbufferParameteriv*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glIsFramebuffer*(framebuffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBindFramebuffer*(target: GLenum, framebuffer: GLuint){.stdcall, importc, ogl.} -proc glDeleteFramebuffers*(n: GLsizei, framebuffers: PGLuint){.stdcall, importc, ogl.} -proc glGenFramebuffers*(n: GLsizei, framebuffers: PGLuint){.stdcall, importc, ogl.} -proc glCheckFramebufferStatus*(target: GLenum): GLenum{.stdcall, importc, ogl.} -proc glFramebufferTexture1D*(target: GLenum, attachment: GLenum, - textarget: GLenum, texture: GLuint, level: GLint){. - stdcall, importc, ogl.} -proc glFramebufferTexture2D*(target: GLenum, attachment: GLenum, - textarget: GLenum, texture: GLuint, level: GLint){. - stdcall, importc, ogl.} -proc glFramebufferTexture3D*(target: GLenum, attachment: GLenum, - textarget: GLenum, texture: GLuint, level: GLint, - zoffset: GLint){.stdcall, importc, ogl.} -proc glFramebufferRenderbuffer*(target: GLenum, attachment: GLenum, - renderbuffertarget: GLenum, renderbuffer: GLuint){. - stdcall, importc, ogl.} -proc glGetFramebufferAttachmentParameteriv*(target: GLenum, attachment: GLenum, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGenerateMipmap*(target: GLenum){.stdcall, importc, ogl.} -proc glBlitFramebuffer*(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, - dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, - mask: GLbitfield, filter: GLenum){.stdcall, importc, ogl.} -proc glRenderbufferStorageMultisample*(target: GLenum, samples: GLsizei, - internalformat: GLenum, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glFramebufferTextureLayer*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint, layer: GLint){. - stdcall, importc, ogl.} - # GL_ARB_geometry_shader4 -proc glProgramParameteriARB*(prog: GLuint, pname: GLenum, value: GLint){.stdcall, importc, ogl.} -proc glFramebufferTextureARB*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint){.stdcall, importc, ogl.} -proc glFramebufferTextureLayerARB*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint, layer: GLint){. - stdcall, importc, ogl.} -proc glFramebufferTextureFaceARB*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint, face: GLenum){. - stdcall, importc, ogl.} - # GL_ARB_instanced_arrays -proc glVertexAttribDivisorARB*(index: GLuint, divisor: GLuint){.stdcall, importc, ogl.} - # GL_ARB_map_buffer_range -proc glMapBufferRange*(target: GLenum, offset: GLintptr, len: GLsizeiptr, - access: GLbitfield): PGLvoid{.stdcall, importc, ogl.} -proc glFlushMappedBufferRange*(target: GLenum, offset: GLintptr, len: GLsizeiptr){. - stdcall, importc, ogl.} - # GL_ARB_texture_buffer_object -proc glTexBufferARB*(target: GLenum, internalformat: GLenum, buffer: GLuint){. - stdcall, importc, ogl.} - # GL_ARB_vertex_array_object -proc glBindVertexArray*(arr: GLuint){.stdcall, importc, ogl.} -proc glDeleteVertexArrays*(n: GLsizei, arrays: PGLuint){.stdcall, importc, ogl.} -proc glGenVertexArrays*(n: GLsizei, arrays: PGLuint){.stdcall, importc, ogl.} -proc glIsVertexArray*(arr: GLuint): GLboolean{.stdcall, importc, ogl.} - # GL_ARB_uniform_buffer_object -proc glGetUniformIndices*(prog: GLuint, uniformCount: GLsizei, - uniformNames: cstringArray, uniformIndices: PGLuint){. - stdcall, importc, ogl.} -proc glGetActiveUniformsiv*(prog: GLuint, uniformCount: GLsizei, - uniformIndices: PGLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetActiveUniformName*(prog: GLuint, uniformIndex: GLuint, - bufSize: GLsizei, len: PGLsizei, - uniformName: PGLchar){.stdcall, importc, ogl.} -proc glGetUniformBlockIndex*(prog: GLuint, uniformBlockName: PGLchar): GLuint{. - stdcall, importc, ogl.} -proc glGetActiveUniformBlockiv*(prog: GLuint, uniformBlockIndex: GLuint, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetActiveUniformBlockName*(prog: GLuint, uniformBlockIndex: GLuint, - bufSize: GLsizei, len: PGLsizei, - uniformBlockName: PGLchar){.stdcall, importc, ogl.} -proc glUniformBlockBinding*(prog: GLuint, uniformBlockIndex: GLuint, - uniformBlockBinding: GLuint){.stdcall, importc, ogl.} - # GL_ARB_copy_buffer -proc glCopyBufferSubData*(readTarget: GLenum, writeTarget: GLenum, - readOffset: GLintptr, writeOffset: GLintptr, - size: GLsizeiptr){.stdcall, importc, ogl.} - # GL_ARB_draw_elements_base_vertex -proc glDrawElementsBaseVertex*(mode: GLenum, count: GLsizei, typ: GLenum, - indices: PGLvoid, basevertex: GLint){.stdcall, importc, ogl.} -proc glDrawRangeElementsBaseVertex*(mode: GLenum, start: GLuint, ending: GLuint, - count: GLsizei, typ: GLenum, - indices: PGLvoid, basevertex: GLint){. - stdcall, importc, ogl.} -proc glDrawElementsInstancedBaseVertex*(mode: GLenum, count: GLsizei, - typ: GLenum, indices: PGLvoid, - primcount: GLsizei, basevertex: GLint){. - stdcall, importc, ogl.} -proc glMultiDrawElementsBaseVertex*(mode: GLenum, count: PGLsizei, typ: GLenum, - indices: PPGLvoid, primcount: GLsizei, - basevertex: PGLint){.stdcall, importc, ogl.} - # GL_ARB_provoking_vertex -proc glProvokingVertex*(mode: GLenum){.stdcall, importc, ogl.} - # GL_ARB_sync -proc glFenceSync*(condition: GLenum, flags: GLbitfield): GLsync{.stdcall, importc, ogl.} -proc glIsSync*(sync: GLsync): GLboolean{.stdcall, importc, ogl.} -proc glDeleteSync*(sync: GLsync){.stdcall, importc, ogl.} -proc glClientWaitSync*(sync: GLsync, flags: GLbitfield, timeout: GLuint64): GLenum{. - stdcall, importc, ogl.} -proc glWaitSync*(sync: GLsync, flags: GLbitfield, timeout: GLuint64){.stdcall, importc, ogl.} -proc glGetInteger64v*(pname: GLenum, params: PGLint64){.stdcall, importc, ogl.} -proc glGetSynciv*(sync: GLsync, pname: GLenum, butSize: GLsizei, len: PGLsizei, - values: PGLint){.stdcall, importc, ogl.} - # GL_ARB_texture_multisample -proc glTexImage2DMultisample*(target: GLenum, samples: GLsizei, - internalformat: GLint, width: GLsizei, - height: GLsizei, fixedsamplelocations: GLboolean){. - stdcall, importc, ogl.} -proc glTexImage3DMultisample*(target: GLenum, samples: GLsizei, - internalformat: GLint, width: GLsizei, - height: GLsizei, depth: GLsizei, - fixedsamplelocations: GLboolean){.stdcall, importc, ogl.} -proc glGetMultisamplefv*(pname: GLenum, index: GLuint, val: PGLfloat){.stdcall, importc, ogl.} -proc glSampleMaski*(index: GLuint, mask: GLbitfield){.stdcall, importc, ogl.} - # GL_ARB_draw_buffers_blend -proc glBlendEquationiARB*(buf: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glBlendEquationSeparateiARB*(buf: GLuint, modeRGB: GLenum, - modeAlpha: GLenum){.stdcall, importc, ogl.} -proc glBlendFunciARB*(buf: GLuint, src: GLenum, dst: GLenum){.stdcall, importc, ogl.} -proc glBlendFuncSeparateiARB*(buf: GLuint, srcRGB: GLenum, dstRGB: GLenum, - srcAlpha: GLenum, dstAlpha: GLenum){.stdcall, importc, ogl.} - # GL_ARB_sample_shading -proc glMinSampleShadingARB*(value: GLclampf){.stdcall, importc, ogl.} - # GL_ARB_shading_language_include -proc glNamedStringARB*(typ: GLenum, namelen: GLint, name: PGLchar, - stringlen: GLint, string: PGLchar){.stdcall, importc, ogl.} -proc glDeleteNamedStringARB*(namelen: GLint, name: PGLchar){.stdcall, importc, ogl.} -proc glCompileShaderIncludeARB*(shader: GLuint, count: GLsizei, path: PPGLchar, - len: PGLint){.stdcall, importc, ogl.} -proc glIsNamedStringARB*(namelen: GLint, name: PGLchar): GLboolean{.stdcall, importc, ogl.} -proc glGetNamedStringARB*(namelen: GLint, name: PGLchar, bufSize: GLsizei, - stringlen: GLint, string: PGLchar){.stdcall, importc, ogl.} -proc glGetNamedStringivARB*(namelen: GLint, name: PGLchar, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} - # GL_ARB_blend_func_extended -proc glBindFragDataLocationIndexed*(prog: GLuint, colorNumber: GLuint, - index: GLuint, name: PGLchar){.stdcall, importc, ogl.} -proc glGetFragDataIndex*(prog: GLuint, name: PGLchar): GLint{.stdcall, importc, ogl.} - # GL_ARB_sampler_objects -proc glGenSamplers*(count: GLsizei, samplers: PGLuint){.stdcall, importc, ogl.} -proc glDeleteSamplers*(count: GLsizei, samplers: PGLuint){.stdcall, importc, ogl.} -proc glIsSampler*(sampler: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBindSampler*(theUnit: GLuint, sampler: GLuint){.stdcall, importc, ogl.} -proc glSamplerParameteri*(sampler: GLuint, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glSamplerParameteriv*(sampler: GLuint, pname: GLenum, param: PGLint){. - stdcall, importc, ogl.} -proc glSamplerParameterf*(sampler: GLuint, pname: GLenum, param: GLfloat){. - stdcall, importc, ogl.} -proc glSamplerParameterfv*(sampler: GLuint, pname: GLenum, param: PGLfloat){. - stdcall, importc, ogl.} -proc glSamplerParameterIiv*(sampler: GLuint, pname: GLenum, param: PGLint){. - stdcall, importc, ogl.} -proc glSamplerParameterIuiv*(sampler: GLuint, pname: GLenum, param: PGLuint){. - stdcall, importc, ogl.} -proc glGetSamplerParameteriv*(sampler: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetSamplerParameterIiv*(sampler: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetSamplerParameterfv*(sampler: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetSamplerParameterIuiv*(sampler: GLuint, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} - # GL_ARB_timer_query -proc glQueryCounter*(id: GLuint, target: GLenum){.stdcall, importc, ogl.} -proc glGetQueryObjecti64v*(id: GLuint, pname: GLenum, params: PGLint64){.stdcall, importc, ogl.} -proc glGetQueryObjectui64v*(id: GLuint, pname: GLenum, params: PGLuint64){. - stdcall, importc, ogl.} - # GL_ARB_vertextyp_2_10_10_10_rev -proc glVertexP2ui*(typ: GLenum, value: GLuint){.stdcall, importc, ogl.} -proc glVertexP2uiv*(typ: GLenum, value: PGLuint){.stdcall, importc, ogl.} -proc glVertexP3ui*(typ: GLenum, value: GLuint){.stdcall, importc, ogl.} -proc glVertexP3uiv*(typ: GLenum, value: PGLuint){.stdcall, importc, ogl.} -proc glVertexP4ui*(typ: GLenum, value: GLuint){.stdcall, importc, ogl.} -proc glVertexP4uiv*(typ: GLenum, value: PGLuint){.stdcall, importc, ogl.} -proc glTexCoordP1ui*(typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glTexCoordP1uiv*(typ: GLenum, coords: PGLuint){.stdcall, importc, ogl.} -proc glTexCoordP2ui*(typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glTexCoordP2uiv*(typ: GLenum, coords: PGLuint){.stdcall, importc, ogl.} -proc glTexCoordP3ui*(typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glTexCoordP3uiv*(typ: GLenum, coords: PGLuint){.stdcall, importc, ogl.} -proc glTexCoordP4ui*(typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glTexCoordP4uiv*(typ: GLenum, coords: PGLuint){.stdcall, importc, ogl.} -proc glMultiTexCoordP1ui*(texture: GLenum, typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glMultiTexCoordP1uiv*(texture: GLenum, typ: GLenum, coords: GLuint){. - stdcall, importc, ogl.} -proc glMultiTexCoordP2ui*(texture: GLenum, typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glMultiTexCoordP2uiv*(texture: GLenum, typ: GLenum, coords: PGLuint){. - stdcall, importc, ogl.} -proc glMultiTexCoordP3ui*(texture: GLenum, typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glMultiTexCoordP3uiv*(texture: GLenum, typ: GLenum, coords: PGLuint){. - stdcall, importc, ogl.} -proc glMultiTexCoordP4ui*(texture: GLenum, typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glMultiTexCoordP4uiv*(texture: GLenum, typ: GLenum, coords: PGLuint){. - stdcall, importc, ogl.} -proc glNormalP3ui*(typ: GLenum, coords: GLuint){.stdcall, importc, ogl.} -proc glNormalP3uiv*(typ: GLenum, coords: PGLuint){.stdcall, importc, ogl.} -proc glColorP3ui*(typ: GLenum, color: GLuint){.stdcall, importc, ogl.} -proc glColorP3uiv*(typ: GLenum, color: PGLuint){.stdcall, importc, ogl.} -proc glColorP4ui*(typ: GLenum, color: GLuint){.stdcall, importc, ogl.} -proc glColorP4uiv*(typ: GLenum, color: GLuint){.stdcall, importc, ogl.} -proc glSecondaryColorP3ui*(typ: GLenum, color: GLuint){.stdcall, importc, ogl.} -proc glSecondaryColorP3uiv*(typ: GLenum, color: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribP1ui*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribP1uiv*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribP2ui*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribP2uiv*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribP3ui*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribP3uiv*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribP4ui*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribP4uiv*(index: GLuint, typ: GLenum, normalized: GLboolean, - value: PGLuint){.stdcall, importc, ogl.} - # GL_ARB_draw_indirect -proc glDrawArraysIndirect*(mode: GLenum, indirect: PGLvoid){.stdcall, importc, ogl.} -proc glDrawElementsIndirect*(mode: GLenum, typ: GLenum, indirect: PGLvoid){. - stdcall, importc, ogl.} - # GL_ARB_gpu_shader_fp64 -proc glUniform1d*(location: GLint, x: GLdouble){.stdcall, importc, ogl.} -proc glUniform2d*(location: GLint, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glUniform3d*(location: GLint, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glUniform4d*(location: GLint, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glUniform1dv*(location: GLint, count: GLsizei, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniform2dv*(location: GLint, count: GLsizei, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniform3dv*(location: GLint, count: GLsizei, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniform4dv*(location: GLint, count: GLsizei, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix2dv*(location: GLint, count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix3dv*(location: GLint, count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix4dv*(location: GLint, count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix2x3dv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix2x4dv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix3x2dv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix3x4dv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix4x2dv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glUniformMatrix4x3dv*(location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glGetUniformdv*(prog: GLuint, location: GLint, params: PGLdouble){.stdcall, importc, ogl.} - # GL_ARB_shader_subroutine -proc glGetSubroutineUniformLocation*(prog: GLuint, shadertype: GLenum, - name: PGLchar): GLint{.stdcall, importc, ogl.} -proc glGetSubroutineIndex*(prog: GLuint, shadertype: GLenum, name: PGLchar): GLuint{. - stdcall, importc, ogl.} -proc glGetActiveSubroutineUniformiv*(prog: GLuint, shadertype: GLenum, - index: GLuint, pname: GLenum, - values: PGLint){.stdcall, importc, ogl.} -proc glGetActiveSubroutineUniformName*(prog: GLuint, shadertype: GLenum, - index: GLuint, bufsize: GLsizei, - len: PGLsizei, name: PGLchar){.stdcall, importc, ogl.} -proc glGetActiveSubroutineName*(prog: GLuint, shadertype: GLenum, index: GLuint, - bufsize: GLsizei, len: PGLsizei, name: PGLchar){. - stdcall, importc, ogl.} -proc glUniformSubroutinesuiv*(shadertype: GLenum, count: GLsizei, - indices: PGLuint){.stdcall, importc, ogl.} -proc glGetUniformSubroutineuiv*(shadertype: GLenum, location: GLint, - params: PGLuint){.stdcall, importc, ogl.} -proc glGetProgramStageiv*(prog: GLuint, shadertype: GLenum, pname: GLenum, - values: PGLint){.stdcall, importc, ogl.} - # GL_ARB_tessellation_shader -proc glPatchParameteri*(pname: GLenum, value: GLint){.stdcall, importc, ogl.} -proc glPatchParameterfv*(pname: GLenum, values: PGLfloat){.stdcall, importc, ogl.} - # GL_ARB_transform_feedback2 -proc glBindTransformFeedback*(target: GLenum, id: GLuint){.stdcall, importc, ogl.} -proc glDeleteTransformFeedbacks*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glGenTransformFeedbacks*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glIsTransformFeedback*(id: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glPauseTransformFeedback*(){.stdcall, importc, ogl.} -proc glResumeTransformFeedback*(){.stdcall, importc, ogl.} -proc glDrawTransformFeedback*(mode: GLenum, id: GLuint){.stdcall, importc, ogl.} - # GL_ARB_transform_feedback3 -proc glDrawTransformFeedbackStream*(mode: GLenum, id: GLuint, stream: GLuint){. - stdcall, importc, ogl.} -proc glBeginQueryIndexed*(target: GLenum, index: GLuint, id: GLuint){.stdcall, importc, ogl.} -proc glEndQueryIndexed*(target: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glGetQueryIndexediv*(target: GLenum, index: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} - # GL_ARB_ES2_compatibility -proc glReleaseShaderCompiler*(){.stdcall, importc, ogl.} -proc glShaderBinary*(count: GLsizei, shaders: PGLuint, binaryformat: GLenum, - binary: PGLvoid, len: GLsizei){.stdcall, importc, ogl.} -proc glGetShaderPrecisionFormat*(shadertype: GLenum, precisiontype: GLenum, - range: PGLint, precision: PGLint){.stdcall, importc, ogl.} -proc glDepthRangef*(n: GLclampf, f: GLclampf){.stdcall, importc, ogl.} -proc glClearDepthf*(d: GLclampf){.stdcall, importc, ogl.} - # GL_ARB_get_prog_binary -proc glGetProgramBinary*(prog: GLuint, bufSize: GLsizei, len: PGLsizei, - binaryFormat: PGLenum, binary: PGLvoid){.stdcall, importc, ogl.} -proc glProgramBinary*(prog: GLuint, binaryFormat: GLenum, binary: PGLvoid, - len: GLsizei){.stdcall, importc, ogl.} -proc glProgramParameteri*(prog: GLuint, pname: GLenum, value: GLint){.stdcall, importc, ogl.} - # GL_ARB_separate_shader_objects -proc glUseProgramStages*(pipeline: GLuint, stages: GLbitfield, prog: GLuint){. - stdcall, importc, ogl.} -proc glActiveShaderProgram*(pipeline: GLuint, prog: GLuint){.stdcall, importc, ogl.} -proc glCreateShaderProgramv*(typ: GLenum, count: GLsizei, strings: cstringArray): GLuint{. - stdcall, importc, ogl.} -proc glBindProgramPipeline*(pipeline: GLuint){.stdcall, importc, ogl.} -proc glDeleteProgramPipelines*(n: GLsizei, pipelines: PGLuint){.stdcall, importc, ogl.} -proc glGenProgramPipelines*(n: GLsizei, pipelines: PGLuint){.stdcall, importc, ogl.} -proc glIsProgramPipeline*(pipeline: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glGetProgramPipelineiv*(pipeline: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glProgramUniform1i*(prog: GLuint, location: GLint, v0: GLint){.stdcall, importc, ogl.} -proc glProgramUniform1iv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform1f*(prog: GLuint, location: GLint, v0: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform1fv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform1d*(prog: GLuint, location: GLint, v0: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform1dv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform1ui*(prog: GLuint, location: GLint, v0: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform1uiv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform2i*(prog: GLuint, location: GLint, v0: GLint, v1: GLint){. - stdcall, importc, ogl.} -proc glProgramUniform2iv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform2f*(prog: GLuint, location: GLint, v0: GLfloat, v1: GLfloat){. - stdcall, importc, ogl.} -proc glProgramUniform2fv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform2d*(prog: GLuint, location: GLint, v0: GLdouble, - v1: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform2dv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform2ui*(prog: GLuint, location: GLint, v0: GLuint, v1: GLuint){. - stdcall, importc, ogl.} -proc glProgramUniform2uiv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform3i*(prog: GLuint, location: GLint, v0: GLint, v1: GLint, - v2: GLint){.stdcall, importc, ogl.} -proc glProgramUniform3iv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform3f*(prog: GLuint, location: GLint, v0: GLfloat, - v1: GLfloat, v2: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform3fv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform3d*(prog: GLuint, location: GLint, v0: GLdouble, - v1: GLdouble, v2: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform3dv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform3ui*(prog: GLuint, location: GLint, v0: GLuint, v1: GLuint, - v2: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform3uiv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform4i*(prog: GLuint, location: GLint, v0: GLint, v1: GLint, - v2: GLint, v3: GLint){.stdcall, importc, ogl.} -proc glProgramUniform4iv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform4f*(prog: GLuint, location: GLint, v0: GLfloat, - v1: GLfloat, v2: GLfloat, v3: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform4fv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform4d*(prog: GLuint, location: GLint, v0: GLdouble, - v1: GLdouble, v2: GLdouble, v3: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform4dv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform4ui*(prog: GLuint, location: GLint, v0: GLuint, v1: GLuint, - v2: GLuint, v3: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform4uiv*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2x3fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix3x2fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix2x4fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix4x2fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix3x4fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix4x3fv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix2x3dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix3x2dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix2x4dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix4x2dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix3x4dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){. - stdcall, importc, ogl.} -proc glProgramUniformMatrix4x3dv*(prog: GLuint, location: GLint, count: GLsizei, - transpose: GLboolean, value: PGLdouble){. - stdcall, importc, ogl.} -proc glValidateProgramPipeline*(pipeline: GLuint){.stdcall, importc, ogl.} -proc glGetProgramPipelineInfoLog*(pipeline: GLuint, bufSize: GLsizei, - len: PGLsizei, infoLog: PGLchar){.stdcall, importc, ogl.} - # GL_ARB_vertex_attrib_64bit -proc glVertexAttribL1d*(index: GLuint, x: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL2d*(index: GLuint, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL3d*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glVertexAttribL4d*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL1dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL2dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL3dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL4dv*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribLPointer*(index: GLuint, size: GLint, typ: GLenum, - stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glGetVertexAttribLdv*(index: GLuint, pname: GLenum, params: PGLdouble){. - stdcall, importc, ogl.} - # GL_ARB_viewport_array -proc glViewportArrayv*(first: GLuint, count: GLsizei, v: PGLfloat){.stdcall, importc, ogl.} -proc glViewportIndexedf*(index: GLuint, x: GLfloat, y: GLfloat, w: GLfloat, - h: GLfloat){.stdcall, importc, ogl.} -proc glViewportIndexedfv*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glScissorArrayv*(first: GLuint, count: GLsizei, v: PGLint){.stdcall, importc, ogl.} -proc glScissorIndexed*(index: GLuint, left: GLint, bottom: GLint, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glScissorIndexedv*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glDepthRangeArrayv*(first: GLuint, count: GLsizei, v: PGLclampd){.stdcall, importc, ogl.} -proc glDepthRangeIndexed*(index: GLuint, n: GLclampd, f: GLclampd){.stdcall, importc, ogl.} -proc glGetFloati_v*(target: GLenum, index: GLuint, data: PGLfloat){.stdcall, importc, ogl.} -proc glGetDoublei_v*(target: GLenum, index: GLuint, data: PGLdouble){.stdcall, importc, ogl.} - # GL 4.2 - # GL_ARB_base_instance -proc glDrawArraysInstancedBaseInstance*(mode: GLenum, first: GLint, - count: GLsizei, primcount: GLsizei, - baseinstance: GLUint){.stdcall, importc, ogl.} -proc glDrawElementsInstancedBaseInstance*(mode: GLEnum, count: GLsizei, - typ: GLenum, indices: PGLVoid, primcount: GLsizei, baseinstance: GLUInt){. - stdcall, importc, ogl.} -proc glDrawElementsInstancedBaseVertexBaseInstance*(mode: GLEnum, - count: GLsizei, typ: GLenum, indices: PGLVoid, primcount: GLsizei, - basevertex: GLint, baseinstance: GLuint){.stdcall, importc, ogl.} - # GL_ARB_transform_feedback_instanced -proc glDrawTransformFeedbackInstanced*(mode: GLenum, id: GLuint, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glDrawTransformFeedbackStreamInstanced*(mode: GLenum, id: GLUInt, - stream: GLUint, primcount: GLsizei){.stdcall, importc, ogl.} - # GL_ARB_internalformat_query -proc glGetInternalformativ*(target: GLenum, internalformat: GLenum, - pname: GLenum, bufSize: GLsizei, params: PGLint){. - stdcall, importc, ogl.} - # GL_ARB_shader_atomic_counters -proc glGetActiveAtomicCounterBufferiv*(prog: GLuint, bufferIndex: GLuint, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} - #/ GL_ARB_shader_image_load_store -proc glBindImageTexture*(theUnit: GLuint, texture: GLuint, level: GLint, - layered: GLboolean, layer: GLint, access: GLenum, - format: GLenum){.stdcall, importc, ogl.} -proc glMemoryBarrier*(barriers: GLbitfield){.stdcall, importc, ogl.} - # GL_ARB_texture_storage -proc glTexStorage1D*(target: GLenum, levels: GLsizei, internalformat: GLenum, - width: GLsizei){.stdcall, importc, ogl.} -proc glTexStorage2D*(target: GLenum, levels: GLsizei, internalformat: GLenum, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glTexStorage3D*(target: GLenum, levels: GLsizei, internalformat: GLenum, - width: GLsizei, height: GLsizei, depth: GLsizei){.stdcall, importc, ogl.} -proc glTextureStorage1DEXT*(texture: GLuint, target: GLenum, levels: GLsizei, - internalformat: GLenum, width: GLsizei){.stdcall, importc, ogl.} -proc glTextureStorage2DEXT*(texture: GLuint, target: GLenum, levels: GLsizei, - internalformat: GLenum, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glTextureStorage3DEXT*(texture: GLuint, target: GLenum, levels: GLsizei, - internalformat: GLenum, width: GLsizei, - height: GLsizei, depth: GLsizei){.stdcall, importc, ogl.} - # - # GL_ARB_cl_event -proc glCreateSyncFromCLeventARB*(context: p_cl_context, event: p_cl_event, - flags: GLbitfield): GLsync{.stdcall, importc, ogl.} - # GL_ARB_debug_output -proc glDebugMessageControlARB*(source: GLenum, typ: GLenum, severity: GLenum, - count: GLsizei, ids: PGLuint, enabled: GLboolean){. - stdcall, importc, ogl.} -proc glDebugMessageInsertARB*(source: GLenum, typ: GLenum, id: GLuint, - severity: GLenum, len: GLsizei, buf: PGLchar){. - stdcall, importc, ogl.} -proc glDebugMessageCallbackARB*(callback: TglDebugProcARB, userParam: PGLvoid){. - stdcall, importc, ogl.} -proc glGetDebugMessageLogARB*(count: GLuint, bufsize: GLsizei, sources: PGLenum, - types: PGLenum, ids: PGLuint, severities: PGLenum, - lengths: PGLsizei, messageLog: PGLchar): GLuint{. - stdcall, importc, ogl.} - # GL_ARB_robustness -proc glGetGraphicsResetStatusARB*(): GLenum{.stdcall, importc, ogl.} -proc glGetnMapdvARB*(target: GLenum, query: GLenum, bufSize: GLsizei, - v: PGLdouble){.stdcall, importc, ogl.} -proc glGetnMapfvARB*(target: GLenum, query: GLenum, bufSize: GLsizei, - v: PGLfloat){.stdcall, importc, ogl.} -proc glGetnMapivARB*(target: GLenum, query: GLenum, bufSize: GLsizei, v: PGLint){. - stdcall, importc, ogl.} -proc glGetnPixelMapfvARB*(map: GLenum, bufSize: GLsizei, values: PGLfloat){. - stdcall, importc, ogl.} -proc glGetnPixelMapuivARB*(map: GLenum, bufSize: GLsizei, values: PGLuint){. - stdcall, importc, ogl.} -proc glGetnPixelMapusvARB*(map: GLenum, bufSize: GLsizei, values: PGLushort){. - stdcall, importc, ogl.} -proc glGetnPolygonStippleARB*(bufSize: GLsizei, pattern: PGLubyte){.stdcall, importc, ogl.} -proc glGetnColorTableARB*(target: GLenum, format: GLenum, typ: GLenum, - bufSize: GLsizei, table: PGLvoid){.stdcall, importc, ogl.} -proc glGetnConvolutionFilterARB*(target: GLenum, format: GLenum, typ: GLenum, - bufSize: GLsizei, image: PGLvoid){.stdcall, importc, ogl.} -proc glGetnSeparableFilterARB*(target: GLenum, format: GLenum, typ: GLenum, - rowBufSize: GLsizei, row: PGLvoid, - columnBufSize: GLsizei, column: PGLvoid, - span: PGLvoid){.stdcall, importc, ogl.} -proc glGetnHistogramARB*(target: GLenum, reset: GLboolean, format: GLenum, - typ: GLenum, bufSize: GLsizei, values: PGLvoid){. - stdcall, importc, ogl.} -proc glGetnMinmaxARB*(target: GLenum, reset: GLboolean, format: GLenum, - typ: GLenum, bufSize: GLsizei, values: PGLvoid){.stdcall, importc, ogl.} -proc glGetnTexImageARB*(target: GLenum, level: GLint, format: GLenum, - typ: GLenum, bufSize: GLsizei, img: PGLvoid){.stdcall, importc, ogl.} -proc glReadnPixelsARB*(x: GLint, y: GLint, width: GLsizei, height: GLsizei, - format: GLenum, typ: GLenum, bufSize: GLsizei, - data: PGLvoid){.stdcall, importc, ogl.} -proc glGetnCompressedTexImageARB*(target: GLenum, lod: GLint, bufSize: GLsizei, - img: PGLvoid){.stdcall, importc, ogl.} -proc glGetnUniformfvARB*(prog: GLuint, location: GLint, bufSize: GLsizei, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetnUniformivARB*(prog: GLuint, location: GLint, bufSize: GLsizei, - params: PGLint){.stdcall, importc, ogl.} -proc glGetnUniformuivARB*(prog: GLuint, location: GLint, bufSize: GLsizei, - params: PGLuint){.stdcall, importc, ogl.} -proc glGetnUniformdvARB*(prog: GLuint, location: GLint, bufSize: GLsizei, - params: PGLdouble){.stdcall, importc, ogl.} - # GL_ATI_draw_buffers -proc glDrawBuffersATI*(n: GLsizei, bufs: PGLenum){.stdcall, importc, ogl.} - # GL_ATI_element_array -proc glElementPointerATI*(typ: GLenum, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glDrawElementArrayATI*(mode: GLenum, count: GLsizei){.stdcall, importc, ogl.} -proc glDrawRangeElementArrayATI*(mode: GLenum, start: GLuint, ending: GLuint, - count: GLsizei){.stdcall, importc, ogl.} - # GL_ATI_envmap_bumpmap -proc glTexBumpParameterivATI*(pname: GLenum, param: PGLint){.stdcall, importc, ogl.} -proc glTexBumpParameterfvATI*(pname: GLenum, param: PGLfloat){.stdcall, importc, ogl.} -proc glGetTexBumpParameterivATI*(pname: GLenum, param: PGLint){.stdcall, importc, ogl.} -proc glGetTexBumpParameterfvATI*(pname: GLenum, param: PGLfloat){.stdcall, importc, ogl.} - # GL_ATI_fragment_shader -proc glGenFragmentShadersATI*(range: GLuint): GLuint{.stdcall, importc, ogl.} -proc glBindFragmentShaderATI*(id: GLuint){.stdcall, importc, ogl.} -proc glDeleteFragmentShaderATI*(id: GLuint){.stdcall, importc, ogl.} -proc glBeginFragmentShaderATI*(){.stdcall, importc, ogl.} -proc glEndFragmentShaderATI*(){.stdcall, importc, ogl.} -proc glPassTexCoordATI*(dst: GLuint, coord: GLuint, swizzle: GLenum){.stdcall, importc, ogl.} -proc glSampleMapATI*(dst: GLuint, interp: GLuint, swizzle: GLenum){.stdcall, importc, ogl.} -proc glColorFragmentOp1ATI*(op: GLenum, dst: GLuint, dstMask: GLuint, - dstMod: GLuint, arg1: GLuint, arg1Rep: GLuint, - arg1Mod: GLuint){.stdcall, importc, ogl.} -proc glColorFragmentOp2ATI*(op: GLenum, dst: GLuint, dstMask: GLuint, - dstMod: GLuint, arg1: GLuint, arg1Rep: GLuint, - arg1Mod: GLuint, arg2: GLuint, arg2Rep: GLuint, - arg2Mod: GLuint){.stdcall, importc, ogl.} -proc 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){.stdcall, importc, ogl.} -proc glAlphaFragmentOp1ATI*(op: GLenum, dst: GLuint, dstMod: GLuint, - arg1: GLuint, arg1Rep: GLuint, arg1Mod: GLuint){. - stdcall, importc, ogl.} -proc glAlphaFragmentOp2ATI*(op: GLenum, dst: GLuint, dstMod: GLuint, - arg1: GLuint, arg1Rep: GLuint, arg1Mod: GLuint, - arg2: GLuint, arg2Rep: GLuint, arg2Mod: GLuint){. - stdcall, importc, ogl.} -proc 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){. - stdcall, importc, ogl.} -proc glSetFragmentShaderConstantATI*(dst: GLuint, value: PGLfloat){.stdcall, importc, ogl.} - # GL_ATI_map_object_buffer -proc glMapObjectBufferATI*(buffer: GLuint): PGLvoid{.stdcall, importc, ogl.} -proc glUnmapObjectBufferATI*(buffer: GLuint){.stdcall, importc, ogl.} - # GL_ATI_pn_triangles -proc glPNTrianglesiATI*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glPNTrianglesfATI*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} - # GL_ATI_separate_stencil -proc glStencilOpSeparateATI*(face: GLenum, sfail: GLenum, dpfail: GLenum, - dppass: GLenum){.stdcall, importc, ogl.} -proc glStencilFuncSeparateATI*(frontfunc: GLenum, backfunc: GLenum, theRef: GLint, - mask: GLuint){.stdcall, importc, ogl.} - # GL_ATI_vertex_array_object -proc glNewObjectBufferATI*(size: GLsizei, pointer: PGLvoid, usage: GLenum): GLuint{. - stdcall, importc, ogl.} -proc glIsObjectBufferATI*(buffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glUpdateObjectBufferATI*(buffer: GLuint, offset: GLuint, size: GLsizei, - pointer: PGLvoid, preserve: GLenum){.stdcall, importc, ogl.} -proc glGetObjectBufferfvATI*(buffer: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetObjectBufferivATI*(buffer: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glFreeObjectBufferATI*(buffer: GLuint){.stdcall, importc, ogl.} -proc glArrayObjectATI*(arr: GLenum, size: GLint, typ: GLenum, stride: GLsizei, - buffer: GLuint, offset: GLuint){.stdcall, importc, ogl.} -proc glGetArrayObjectfvATI*(arr: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetArrayObjectivATI*(arr: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glVariantArrayObjectATI*(id: GLuint, typ: GLenum, stride: GLsizei, - buffer: GLuint, offset: GLuint){.stdcall, importc, ogl.} -proc glGetVariantArrayObjectfvATI*(id: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetVariantArrayObjectivATI*(id: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} - # GL_ATI_vertex_attrib_array_object -proc glVertexAttribArrayObjectATI*(index: GLuint, size: GLint, typ: GLenum, - normalized: GLboolean, stride: GLsizei, - buffer: GLuint, offset: GLuint){.stdcall, importc, ogl.} -proc glGetVertexAttribArrayObjectfvATI*(index: GLuint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetVertexAttribArrayObjectivATI*(index: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} - # GL_ATI_vertex_streams -proc glVertexStream1sATI*(stream: GLenum, x: GLshort){.stdcall, importc, ogl.} -proc glVertexStream1svATI*(stream: GLenum, coords: PGLshort){.stdcall, importc, ogl.} -proc glVertexStream1iATI*(stream: GLenum, x: GLint){.stdcall, importc, ogl.} -proc glVertexStream1ivATI*(stream: GLenum, coords: PGLint){.stdcall, importc, ogl.} -proc glVertexStream1fATI*(stream: GLenum, x: GLfloat){.stdcall, importc, ogl.} -proc glVertexStream1fvATI*(stream: GLenum, coords: PGLfloat){.stdcall, importc, ogl.} -proc glVertexStream1dATI*(stream: GLenum, x: GLdouble){.stdcall, importc, ogl.} -proc glVertexStream1dvATI*(stream: GLenum, coords: PGLdouble){.stdcall, importc, ogl.} -proc glVertexStream2sATI*(stream: GLenum, x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glVertexStream2svATI*(stream: GLenum, coords: PGLshort){.stdcall, importc, ogl.} -proc glVertexStream2iATI*(stream: GLenum, x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glVertexStream2ivATI*(stream: GLenum, coords: PGLint){.stdcall, importc, ogl.} -proc glVertexStream2fATI*(stream: GLenum, x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glVertexStream2fvATI*(stream: GLenum, coords: PGLfloat){.stdcall, importc, ogl.} -proc glVertexStream2dATI*(stream: GLenum, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertexStream2dvATI*(stream: GLenum, coords: PGLdouble){.stdcall, importc, ogl.} -proc glVertexStream3sATI*(stream: GLenum, x: GLshort, y: GLshort, z: GLshort){. - stdcall, importc, ogl.} -proc glVertexStream3svATI*(stream: GLenum, coords: PGLshort){.stdcall, importc, ogl.} -proc glVertexStream3iATI*(stream: GLenum, x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glVertexStream3ivATI*(stream: GLenum, coords: PGLint){.stdcall, importc, ogl.} -proc glVertexStream3fATI*(stream: GLenum, x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glVertexStream3fvATI*(stream: GLenum, coords: PGLfloat){.stdcall, importc, ogl.} -proc glVertexStream3dATI*(stream: GLenum, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glVertexStream3dvATI*(stream: GLenum, coords: PGLdouble){.stdcall, importc, ogl.} -proc glVertexStream4sATI*(stream: GLenum, x: GLshort, y: GLshort, z: GLshort, - w: GLshort){.stdcall, importc, ogl.} -proc glVertexStream4svATI*(stream: GLenum, coords: PGLshort){.stdcall, importc, ogl.} -proc glVertexStream4iATI*(stream: GLenum, x: GLint, y: GLint, z: GLint, w: GLint){. - stdcall, importc, ogl.} -proc glVertexStream4ivATI*(stream: GLenum, coords: PGLint){.stdcall, importc, ogl.} -proc glVertexStream4fATI*(stream: GLenum, x: GLfloat, y: GLfloat, z: GLfloat, - w: GLfloat){.stdcall, importc, ogl.} -proc glVertexStream4fvATI*(stream: GLenum, coords: PGLfloat){.stdcall, importc, ogl.} -proc glVertexStream4dATI*(stream: GLenum, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glVertexStream4dvATI*(stream: GLenum, coords: PGLdouble){.stdcall, importc, ogl.} -proc glNormalStream3bATI*(stream: GLenum, nx: GLbyte, ny: GLbyte, nz: GLbyte){. - stdcall, importc, ogl.} -proc glNormalStream3bvATI*(stream: GLenum, coords: PGLbyte){.stdcall, importc, ogl.} -proc glNormalStream3sATI*(stream: GLenum, nx: GLshort, ny: GLshort, nz: GLshort){. - stdcall, importc, ogl.} -proc glNormalStream3svATI*(stream: GLenum, coords: PGLshort){.stdcall, importc, ogl.} -proc glNormalStream3iATI*(stream: GLenum, nx: GLint, ny: GLint, nz: GLint){. - stdcall, importc, ogl.} -proc glNormalStream3ivATI*(stream: GLenum, coords: PGLint){.stdcall, importc, ogl.} -proc glNormalStream3fATI*(stream: GLenum, nx: GLfloat, ny: GLfloat, nz: GLfloat){. - stdcall, importc, ogl.} -proc glNormalStream3fvATI*(stream: GLenum, coords: PGLfloat){.stdcall, importc, ogl.} -proc glNormalStream3dATI*(stream: GLenum, nx: GLdouble, ny: GLdouble, - nz: GLdouble){.stdcall, importc, ogl.} -proc glNormalStream3dvATI*(stream: GLenum, coords: PGLdouble){.stdcall, importc, ogl.} -proc glClientActiveVertexStreamATI*(stream: GLenum){.stdcall, importc, ogl.} -proc glVertexBlendEnviATI*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glVertexBlendEnvfATI*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} - # GL_AMD_performance_monitor -proc glGetPerfMonitorGroupsAMD*(numGroups: PGLint, groupsSize: GLsizei, - groups: PGLuint){.stdcall, importc, ogl.} -proc glGetPerfMonitorCountersAMD*(group: GLuint, numCounters: PGLint, - maxActiveCouters: PGLint, - counterSize: GLsizei, counters: PGLuint){. - stdcall, importc, ogl.} -proc glGetPerfMonitorGroupStringAMD*(group: GLuint, bufSize: GLsizei, - len: PGLsizei, groupString: PGLchar){. - stdcall, importc, ogl.} -proc glGetPerfMonitorCounterStringAMD*(group: GLuint, counter: GLuint, - bufSize: GLsizei, len: PGLsizei, - counterString: PGLchar){.stdcall, importc, ogl.} -proc glGetPerfMonitorCounterInfoAMD*(group: GLuint, counter: GLuint, - pname: GLenum, data: PGLvoid){.stdcall, importc, ogl.} -proc glGenPerfMonitorsAMD*(n: GLsizei, monitors: PGLuint){.stdcall, importc, ogl.} -proc glDeletePerfMonitorsAMD*(n: GLsizei, monitors: PGLuint){.stdcall, importc, ogl.} -proc glSelectPerfMonitorCountersAMD*(monitor: GLuint, enable: GLboolean, - group: GLuint, numCounters: GLint, - counterList: PGLuint){.stdcall, importc, ogl.} -proc glBeginPerfMonitorAMD*(monitor: GLuint){.stdcall, importc, ogl.} -proc glEndPerfMonitorAMD*(monitor: GLuint){.stdcall, importc, ogl.} -proc glGetPerfMonitorCounterDataAMD*(monitor: GLuint, pname: GLenum, - dataSize: GLsizei, data: PGLuint, - bytesWritten: PGLint){.stdcall, importc, ogl.} - # GL_AMD_vertex_shader_tesselator -proc glTessellationFactorAMD*(factor: GLfloat){.stdcall, importc, ogl.} -proc glTessellationModeAMD*(mode: GLenum){.stdcall, importc, ogl.} - # GL_AMD_draw_buffers_blend -proc glBlendFuncIndexedAMD*(buf: GLuint, src: GLenum, dst: GLenum){.stdcall, importc, ogl.} -proc glBlendFuncSeparateIndexedAMD*(buf: GLuint, srcRGB: GLenum, dstRGB: GLenum, - srcAlpha: GLenum, dstAlpha: GLenum){.stdcall, importc, ogl.} -proc glBlendEquationIndexedAMD*(buf: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glBlendEquationSeparateIndexedAMD*(buf: GLuint, modeRGB: GLenum, - modeAlpha: GLenum){.stdcall, importc, ogl.} - # GL_AMD_name_gen_delete -proc glGenNamesAMD*(identifier: GLenum, num: GLuint, names: PGLuint){.stdcall, importc, ogl.} -proc glDeleteNamesAMD*(identifier: GLenum, num: GLuint, names: PGLuint){.stdcall, importc, ogl.} -proc glIsNameAMD*(identifier: GLenum, name: GLuint): GLboolean{.stdcall, importc, ogl.} - # GL_AMD_debug_output -proc glDebugMessageEnableAMD*(category: GLenum, severity: GLenum, - count: GLsizei, ids: PGLuint, enabled: GLboolean){. - stdcall, importc, ogl.} -proc glDebugMessageInsertAMD*(category: GLenum, severity: GLenum, id: GLuint, - len: GLsizei, buf: PGLchar){.stdcall, importc, ogl.} -proc glDebugMessageCallbackAMD*(callback: TGLDebugProcAMD, userParam: PGLvoid){. - stdcall, importc, ogl.} -proc glGetDebugMessageLogAMD*(count: GLuint, bufsize: GLsizei, - categories: PGLenum, severities: PGLuint, - ids: PGLuint, lengths: PGLsizei, message: PGLchar): GLuint{. - stdcall, importc, ogl.} - # GL_EXT_blend_color -proc glBlendColorEXT*(red: GLclampf, green: GLclampf, blue: GLclampf, - alpha: GLclampf){.stdcall, importc, ogl.} - # GL_EXT_blend_func_separate -proc glBlendFuncSeparateEXT*(sfactorRGB: GLenum, dfactorRGB: GLenum, - sfactorAlpha: GLenum, dfactorAlpha: GLenum){. - stdcall, importc, ogl.} - # GL_EXT_blend_minmax -proc glBlendEquationEXT*(mode: GLenum){.stdcall, importc, ogl.} - # GL_EXT_color_subtable -proc glColorSubTableEXT*(target: GLenum, start: GLsizei, count: GLsizei, - format: GLenum, typ: GLenum, data: PGLvoid){.stdcall, importc, ogl.} -proc glCopyColorSubTableEXT*(target: GLenum, start: GLsizei, x: GLint, y: GLint, - width: GLsizei){.stdcall, importc, ogl.} - # GL_EXT_compiled_vertex_array -proc glLockArraysEXT*(first: GLint, count: GLsizei){.stdcall, importc, ogl.} -proc glUnlockArraysEXT*(){.stdcall, importc, ogl.} - # GL_EXT_convolution -proc glConvolutionFilter1DEXT*(target: GLenum, internalformat: GLenum, - width: GLsizei, format: GLenum, typ: GLenum, - image: PGLvoid){.stdcall, importc, ogl.} -proc glConvolutionFilter2DEXT*(target: GLenum, internalformat: GLenum, - width: GLsizei, height: GLsizei, format: GLenum, - typ: GLenum, image: PGLvoid){.stdcall, importc, ogl.} -proc glConvolutionParameterfEXT*(target: GLenum, pname: GLenum, params: GLfloat){. - stdcall, importc, ogl.} -proc glConvolutionParameterfvEXT*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glConvolutionParameteriEXT*(target: GLenum, pname: GLenum, params: GLint){. - stdcall, importc, ogl.} -proc glConvolutionParameterivEXT*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glCopyConvolutionFilter1DEXT*(target: GLenum, internalformat: GLenum, - x: GLint, y: GLint, width: GLsizei){.stdcall, importc, ogl.} -proc glCopyConvolutionFilter2DEXT*(target: GLenum, internalformat: GLenum, - x: GLint, y: GLint, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glGetConvolutionFilterEXT*(target: GLenum, format: GLenum, typ: GLenum, - image: PGLvoid){.stdcall, importc, ogl.} -proc glGetConvolutionParameterfvEXT*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetConvolutionParameterivEXT*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetSeparableFilterEXT*(target: GLenum, format: GLenum, typ: GLenum, - row: PGLvoid, column: PGLvoid, span: PGLvoid){. - stdcall, importc, ogl.} -proc glSeparableFilter2DEXT*(target: GLenum, internalformat: GLenum, - width: GLsizei, height: GLsizei, format: GLenum, - typ: GLenum, row: PGLvoid, column: PGLvoid){. - stdcall, importc, ogl.} - # GL_EXT_coordinate_frame -proc glTangent3bEXT*(tx: GLbyte, ty: GLbyte, tz: GLbyte){.stdcall, importc, ogl.} -proc glTangent3bvEXT*(v: PGLbyte){.stdcall, importc, ogl.} -proc glTangent3dEXT*(tx: GLdouble, ty: GLdouble, tz: GLdouble){.stdcall, importc, ogl.} -proc glTangent3dvEXT*(v: PGLdouble){.stdcall, importc, ogl.} -proc glTangent3fEXT*(tx: GLfloat, ty: GLfloat, tz: GLfloat){.stdcall, importc, ogl.} -proc glTangent3fvEXT*(v: PGLfloat){.stdcall, importc, ogl.} -proc glTangent3iEXT*(tx: GLint, ty: GLint, tz: GLint){.stdcall, importc, ogl.} -proc glTangent3ivEXT*(v: PGLint){.stdcall, importc, ogl.} -proc glTangent3sEXT*(tx: GLshort, ty: GLshort, tz: GLshort){.stdcall, importc, ogl.} -proc glTangent3svEXT*(v: PGLshort){.stdcall, importc, ogl.} -proc glBinormal3bEXT*(bx: GLbyte, by: GLbyte, bz: GLbyte){.stdcall, importc, ogl.} -proc glBinormal3bvEXT*(v: PGLbyte){.stdcall, importc, ogl.} -proc glBinormal3dEXT*(bx: GLdouble, by: GLdouble, bz: GLdouble){.stdcall, importc, ogl.} -proc glBinormal3dvEXT*(v: PGLdouble){.stdcall, importc, ogl.} -proc glBinormal3fEXT*(bx: GLfloat, by: GLfloat, bz: GLfloat){.stdcall, importc, ogl.} -proc glBinormal3fvEXT*(v: PGLfloat){.stdcall, importc, ogl.} -proc glBinormal3iEXT*(bx: GLint, by: GLint, bz: GLint){.stdcall, importc, ogl.} -proc glBinormal3ivEXT*(v: PGLint){.stdcall, importc, ogl.} -proc glBinormal3sEXT*(bx: GLshort, by: GLshort, bz: GLshort){.stdcall, importc, ogl.} -proc glBinormal3svEXT*(v: PGLshort){.stdcall, importc, ogl.} -proc glTangentPointerEXT*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glBinormalPointerEXT*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} - # GL_EXT_copy_texture -proc glCopyTexImage1DEXT*(target: GLenum, level: GLint, internalformat: GLenum, - x: GLint, y: GLint, width: GLsizei, border: GLint){. - stdcall, importc, ogl.} -proc glCopyTexImage2DEXT*(target: GLenum, level: GLint, internalformat: GLenum, - x: GLint, y: GLint, width: GLsizei, height: GLsizei, - border: GLint){.stdcall, importc, ogl.} -proc glCopyTexSubImage1DEXT*(target: GLenum, level: GLint, xoffset: GLint, - x: GLint, y: GLint, width: GLsizei){.stdcall, importc, ogl.} -proc glCopyTexSubImage2DEXT*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, x: GLint, y: GLint, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glCopyTexSubImage3DEXT*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} - # GL_EXT_cull_vertex -proc glCullParameterdvEXT*(pname: GLenum, params: PGLdouble){.stdcall, importc, ogl.} -proc glCullParameterfvEXT*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} - # GL_EXT_draw_range_elements -proc glDrawRangeElementsEXT*(mode: GLenum, start: GLuint, ending: GLuint, - count: GLsizei, typ: GLenum, indices: PGLvoid){. - stdcall, importc, ogl.} - # GL_EXT_fog_coord -proc glFogCoordfEXT*(coord: GLfloat){.stdcall, importc, ogl.} -proc glFogCoordfvEXT*(coord: PGLfloat){.stdcall, importc, ogl.} -proc glFogCoorddEXT*(coord: GLdouble){.stdcall, importc, ogl.} -proc glFogCoorddvEXT*(coord: PGLdouble){.stdcall, importc, ogl.} -proc glFogCoordPointerEXT*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} - # GL_EXT_framebuffer_object -proc glIsRenderbufferEXT*(renderbuffer: GLuint): bool{.stdcall, importc, ogl.} -proc glBindRenderbufferEXT*(target: GLenum, renderbuffer: GLuint){.stdcall, importc, ogl.} -proc glDeleteRenderbuffersEXT*(n: GLsizei, renderbuffers: PGLuint){.stdcall, importc, ogl.} -proc glGenRenderbuffersEXT*(n: GLsizei, renderbuffers: PGLuint){.stdcall, importc, ogl.} -proc glRenderbufferStorageEXT*(target: GLenum, internalformat: GLenum, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glGetRenderbufferParameterivEXT*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glIsFramebufferEXT*(framebuffer: GLuint): bool{.stdcall, importc, ogl.} -proc glBindFramebufferEXT*(target: GLenum, framebuffer: GLuint){.stdcall, importc, ogl.} -proc glDeleteFramebuffersEXT*(n: GLsizei, framebuffers: PGLuint){.stdcall, importc, ogl.} -proc glGenFramebuffersEXT*(n: GLsizei, framebuffers: PGLuint){.stdcall, importc, ogl.} -proc glCheckFramebufferStatusEXT*(target: GLenum): GLenum{.stdcall, importc, ogl.} -proc glFramebufferTexture1DEXT*(target: GLenum, attachment: GLenum, - textarget: GLenum, texture: GLuint, level: GLint){. - stdcall, importc, ogl.} -proc glFramebufferTexture2DEXT*(target: GLenum, attachment: GLenum, - textarget: GLenum, texture: GLuint, level: GLint){. - stdcall, importc, ogl.} -proc glFramebufferTexture3DEXT*(target: GLenum, attachment: GLenum, - textarget: GLenum, texture: GLuint, - level: GLint, zoffset: GLint){.stdcall, importc, ogl.} -proc glFramebufferRenderbufferEXT*(target: GLenum, attachment: GLenum, - renderbuffertarget: GLenum, - renderbuffer: GLuint){.stdcall, importc, ogl.} -proc glGetFramebufferAttachmentParameterivEXT*(target: GLenum, - attachment: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGenerateMipmapEXT*(target: GLenum){.stdcall, importc, ogl.} - # GL_EXT_histogram -proc glGetHistogramEXT*(target: GLenum, reset: GLboolean, format: GLenum, - typ: GLenum, values: PGLvoid){.stdcall, importc, ogl.} -proc glGetHistogramParameterfvEXT*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetHistogramParameterivEXT*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetMinmaxEXT*(target: GLenum, reset: GLboolean, format: GLenum, - typ: GLenum, values: PGLvoid){.stdcall, importc, ogl.} -proc glGetMinmaxParameterfvEXT*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetMinmaxParameterivEXT*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glHistogramEXT*(target: GLenum, width: GLsizei, internalformat: GLenum, - sink: GLboolean){.stdcall, importc, ogl.} -proc glMinmaxEXT*(target: GLenum, internalformat: GLenum, sink: GLboolean){. - stdcall, importc, ogl.} -proc glResetHistogramEXT*(target: GLenum){.stdcall, importc, ogl.} -proc glResetMinmaxEXT*(target: GLenum){.stdcall, importc, ogl.} - # GL_EXT_index_func -proc glIndexFuncEXT*(func: GLenum, theRef: GLclampf){.stdcall, importc, ogl.} - # GL_EXT_index_material -proc glIndexMaterialEXT*(face: GLenum, mode: GLenum){.stdcall, importc, ogl.} - # GL_EXT_light_texture -proc glApplyTextureEXT*(mode: GLenum){.stdcall, importc, ogl.} -proc glTextureLightEXT*(pname: GLenum){.stdcall, importc, ogl.} -proc glTextureMaterialEXT*(face: GLenum, mode: GLenum){.stdcall, importc, ogl.} - # GL_EXT_multi_draw_arrays -proc glMultiDrawArraysEXT*(mode: GLenum, first: PGLint, count: PGLsizei, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glMultiDrawElementsEXT*(mode: GLenum, count: PGLsizei, typ: GLenum, - indices: PGLvoid, primcount: GLsizei){.stdcall, importc, ogl.} - # GL_EXT_multisample -proc glSampleMaskEXT*(value: GLclampf, invert: GLboolean){.stdcall, importc, ogl.} -proc glSamplePatternEXT*(pattern: GLenum){.stdcall, importc, ogl.} - # GL_EXT_paletted_texture -proc glColorTableEXT*(target: GLenum, internalFormat: GLenum, width: GLsizei, - format: GLenum, typ: GLenum, table: PGLvoid){.stdcall, importc, ogl.} -proc glGetColorTableEXT*(target: GLenum, format: GLenum, typ: GLenum, - data: PGLvoid){.stdcall, importc, ogl.} -proc glGetColorTableParameterivEXT*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetColorTableParameterfvEXT*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} - # GL_EXT_pixel_transform -proc glPixelTransformParameteriEXT*(target: GLenum, pname: GLenum, param: GLint){. - stdcall, importc, ogl.} -proc glPixelTransformParameterfEXT*(target: GLenum, pname: GLenum, - param: GLfloat){.stdcall, importc, ogl.} -proc glPixelTransformParameterivEXT*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glPixelTransformParameterfvEXT*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} - # GL_EXT_point_parameters -proc glPointParameterfEXT*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPointParameterfvEXT*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} - # GL_EXT_polygon_offset -proc glPolygonOffsetEXT*(factor: GLfloat, bias: GLfloat){.stdcall, importc, ogl.} - # GL_EXT_secondary_color -proc glSecondaryColor3bEXT*(red: GLbyte, green: GLbyte, blue: GLbyte){.stdcall, importc, ogl.} -proc glSecondaryColor3bvEXT*(v: PGLbyte){.stdcall, importc, ogl.} -proc glSecondaryColor3dEXT*(red: GLdouble, green: GLdouble, blue: GLdouble){. - stdcall, importc, ogl.} -proc glSecondaryColor3dvEXT*(v: PGLdouble){.stdcall, importc, ogl.} -proc glSecondaryColor3fEXT*(red: GLfloat, green: GLfloat, blue: GLfloat){. - stdcall, importc, ogl.} -proc glSecondaryColor3fvEXT*(v: PGLfloat){.stdcall, importc, ogl.} -proc glSecondaryColor3iEXT*(red: GLint, green: GLint, blue: GLint){.stdcall, importc, ogl.} -proc glSecondaryColor3ivEXT*(v: PGLint){.stdcall, importc, ogl.} -proc glSecondaryColor3sEXT*(red: GLshort, green: GLshort, blue: GLshort){. - stdcall, importc, ogl.} -proc glSecondaryColor3svEXT*(v: PGLshort){.stdcall, importc, ogl.} -proc glSecondaryColor3ubEXT*(red: GLubyte, green: GLubyte, blue: GLubyte){. - stdcall, importc, ogl.} -proc glSecondaryColor3ubvEXT*(v: PGLubyte){.stdcall, importc, ogl.} -proc glSecondaryColor3uiEXT*(red: GLuint, green: GLuint, blue: GLuint){.stdcall, importc, ogl.} -proc glSecondaryColor3uivEXT*(v: PGLuint){.stdcall, importc, ogl.} -proc glSecondaryColor3usEXT*(red: GLushort, green: GLushort, blue: GLushort){. - stdcall, importc, ogl.} -proc glSecondaryColor3usvEXT*(v: PGLushort){.stdcall, importc, ogl.} -proc glSecondaryColorPointerEXT*(size: GLint, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_EXT_stencil_two_side -proc glActiveStencilFaceEXT*(face: GLenum){.stdcall, importc, ogl.} - # GL_EXT_subtexture -proc glTexSubImage1DEXT*(target: GLenum, level: GLint, xoffset: GLint, - width: GLsizei, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTexSubImage2DEXT*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, width: GLsizei, height: GLsizei, - format: GLenum, typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} - # GL_EXT_texture3D -proc glTexImage3DEXT*(target: GLenum, level: GLint, internalformat: GLenum, - width: GLsizei, height: GLsizei, depth: GLsizei, - border: GLint, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTexSubImage3DEXT*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, width: GLsizei, - height: GLsizei, depth: GLsizei, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} - # GL_EXT_texture_object -proc glAreTexturesResidentEXT*(n: GLsizei, textures: PGLuint, - residences: PGLboolean): GLboolean{.stdcall, importc, ogl.} -proc glBindTextureEXT*(target: GLenum, texture: GLuint){.stdcall, importc, ogl.} -proc glDeleteTexturesEXT*(n: GLsizei, textures: PGLuint){.stdcall, importc, ogl.} -proc glGenTexturesEXT*(n: GLsizei, textures: PGLuint){.stdcall, importc, ogl.} -proc glIsTextureEXT*(texture: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glPrioritizeTexturesEXT*(n: GLsizei, textures: PGLuint, - priorities: PGLclampf){.stdcall, importc, ogl.} - # GL_EXT_texture_perturb_normal -proc glTextureNormalEXT*(mode: GLenum){.stdcall, importc, ogl.} - # GL_EXT_vertex_array -proc glArrayElementEXT*(i: GLint){.stdcall, importc, ogl.} -proc glColorPointerEXT*(size: GLint, typ: GLenum, stride: GLsizei, - count: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glDrawArraysEXT*(mode: GLenum, first: GLint, count: GLsizei){.stdcall, importc, ogl.} -proc glEdgeFlagPointerEXT*(stride: GLsizei, count: GLsizei, pointer: PGLboolean){. - stdcall, importc, ogl.} -proc glGetPointervEXT*(pname: GLenum, params: PGLvoid){.stdcall, importc, ogl.} -proc glIndexPointerEXT*(typ: GLenum, stride: GLsizei, count: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glNormalPointerEXT*(typ: GLenum, stride: GLsizei, count: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} -proc glTexCoordPointerEXT*(size: GLint, typ: GLenum, stride: GLsizei, - count: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glVertexPointerEXT*(size: GLint, typ: GLenum, stride: GLsizei, - count: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_EXT_vertex_shader -proc glBeginVertexShaderEXT*(){.stdcall, importc, ogl.} -proc glEndVertexShaderEXT*(){.stdcall, importc, ogl.} -proc glBindVertexShaderEXT*(id: GLuint){.stdcall, importc, ogl.} -proc glGenVertexShadersEXT*(range: GLuint): GLuint{.stdcall, importc, ogl.} -proc glDeleteVertexShaderEXT*(id: GLuint){.stdcall, importc, ogl.} -proc glShaderOp1EXT*(op: GLenum, res: GLuint, arg1: GLuint){.stdcall, importc, ogl.} -proc glShaderOp2EXT*(op: GLenum, res: GLuint, arg1: GLuint, arg2: GLuint){. - stdcall, importc, ogl.} -proc glShaderOp3EXT*(op: GLenum, res: GLuint, arg1: GLuint, arg2: GLuint, - arg3: GLuint){.stdcall, importc, ogl.} -proc glSwizzleEXT*(res: GLuint, ain: GLuint, outX: GLenum, outY: GLenum, - outZ: GLenum, outW: GLenum){.stdcall, importc, ogl.} -proc glWriteMaskEXT*(res: GLuint, ain: GLuint, outX: GLenum, outY: GLenum, - outZ: GLenum, outW: GLenum){.stdcall, importc, ogl.} -proc glInsertComponentEXT*(res: GLuint, src: GLuint, num: GLuint){.stdcall, importc, ogl.} -proc glExtractComponentEXT*(res: GLuint, src: GLuint, num: GLuint){.stdcall, importc, ogl.} -proc glGenSymbolsEXT*(datatype: GLenum, storagetype: GLenum, range: GLenum, - components: GLuint): GLuint{.stdcall, importc, ogl.} -proc glSetInvariantEXT*(id: GLuint, typ: GLenum, theAddr: PGLvoid){.stdcall, importc, ogl.} -proc glSetLocalConstantEXT*(id: GLuint, typ: GLenum, theAddr: PGLvoid){.stdcall, importc, ogl.} -proc glVariantbvEXT*(id: GLuint, theAddr: PGLbyte){.stdcall, importc, ogl.} -proc glVariantsvEXT*(id: GLuint, theAddr: PGLshort){.stdcall, importc, ogl.} -proc glVariantivEXT*(id: GLuint, theAddr: PGLint){.stdcall, importc, ogl.} -proc glVariantfvEXT*(id: GLuint, theAddr: PGLfloat){.stdcall, importc, ogl.} -proc glVariantdvEXT*(id: GLuint, theAddr: PGLdouble){.stdcall, importc, ogl.} -proc glVariantubvEXT*(id: GLuint, theAddr: PGLubyte){.stdcall, importc, ogl.} -proc glVariantusvEXT*(id: GLuint, theAddr: PGLushort){.stdcall, importc, ogl.} -proc glVariantuivEXT*(id: GLuint, theAddr: PGLuint){.stdcall, importc, ogl.} -proc glVariantPointerEXT*(id: GLuint, typ: GLenum, stride: GLuint, theAddr: PGLvoid){. - stdcall, importc, ogl.} -proc glEnableVariantClientStateEXT*(id: GLuint){.stdcall, importc, ogl.} -proc glDisableVariantClientStateEXT*(id: GLuint){.stdcall, importc, ogl.} -proc glBindLightParameterEXT*(light: GLenum, value: GLenum): GLuint{.stdcall, importc, ogl.} -proc glBindMaterialParameterEXT*(face: GLenum, value: GLenum): GLuint{.stdcall, importc, ogl.} -proc glBindTexGenParameterEXT*(theUnit: GLenum, coord: GLenum, value: GLenum): GLuint{. - stdcall, importc, ogl.} -proc glBindTextureUnitParameterEXT*(theUnit: GLenum, value: GLenum): GLuint{. - stdcall, importc, ogl.} -proc glBindParameterEXT*(value: GLenum): GLuint{.stdcall, importc, ogl.} -proc glIsVariantEnabledEXT*(id: GLuint, cap: GLenum): GLboolean{.stdcall, importc, ogl.} -proc glGetVariantBooleanvEXT*(id: GLuint, value: GLenum, data: PGLboolean){. - stdcall, importc, ogl.} -proc glGetVariantIntegervEXT*(id: GLuint, value: GLenum, data: PGLint){.stdcall, importc, ogl.} -proc glGetVariantFloatvEXT*(id: GLuint, value: GLenum, data: PGLfloat){.stdcall, importc, ogl.} -proc glGetVariantPointervEXT*(id: GLuint, value: GLenum, data: PGLvoid){.stdcall, importc, ogl.} -proc glGetInvariantBooleanvEXT*(id: GLuint, value: GLenum, data: PGLboolean){. - stdcall, importc, ogl.} -proc glGetInvariantIntegervEXT*(id: GLuint, value: GLenum, data: PGLint){. - stdcall, importc, ogl.} -proc glGetInvariantFloatvEXT*(id: GLuint, value: GLenum, data: PGLfloat){. - stdcall, importc, ogl.} -proc glGetLocalConstantBooleanvEXT*(id: GLuint, value: GLenum, data: PGLboolean){. - stdcall, importc, ogl.} -proc glGetLocalConstantIntegervEXT*(id: GLuint, value: GLenum, data: PGLint){. - stdcall, importc, ogl.} -proc glGetLocalConstantFloatvEXT*(id: GLuint, value: GLenum, data: PGLfloat){. - stdcall, importc, ogl.} - # GL_EXT_vertex_weighting -proc glVertexWeightfEXT*(weight: GLfloat){.stdcall, importc, ogl.} -proc glVertexWeightfvEXT*(weight: PGLfloat){.stdcall, importc, ogl.} -proc glVertexWeightPointerEXT*(size: GLsizei, typ: GLenum, stride: GLsizei, - pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_EXT_stencil_clear_tag -proc glStencilClearTagEXT*(stencilTagBits: GLsizei, stencilClearTag: GLuint){. - stdcall, importc, ogl.} - # GL_EXT_framebuffer_blit -proc glBlitFramebufferEXT*(srcX0: GLint, srcY0: GLint, srcX1: GLint, - srcY1: GLint, dstX0: GLint, dstY0: GLint, - dstX1: GLint, dstY1: GLint, mask: GLbitfield, - filter: GLenum){.stdcall, importc, ogl.} - # GL_EXT_framebuffer_multisample -proc glRenderbufferStorageMultisampleEXT*(target: GLenum, samples: GLsizei, - internalformat: GLenum, width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} - # GL_EXT_timer_query -proc glGetQueryObjecti64vEXT*(id: GLuint, pname: GLenum, params: PGLint64EXT){. - stdcall, importc, ogl.} -proc glGetQueryObjectui64vEXT*(id: GLuint, pname: GLenum, params: PGLuint64EXT){. - stdcall, importc, ogl.} - # GL_EXT_gpu_program_parameters -proc glProgramEnvParameters4fvEXT*(target: GLenum, index: GLuint, - count: GLsizei, params: PGLfloat){.stdcall, importc, ogl.} -proc glProgramLocalParameters4fvEXT*(target: GLenum, index: GLuint, - count: GLsizei, params: PGLfloat){.stdcall, importc, ogl.} - # GL_EXT_bindable_uniform -proc glUniformBufferEXT*(prog: GLuint, location: GLint, buffer: GLuint){.stdcall, importc, ogl.} -proc glGetUniformBufferSizeEXT*(prog: GLuint, location: GLint): GLint{.stdcall, importc, ogl.} -proc glGetUniformOffsetEXT*(prog: GLuint, location: GLint): GLintptr{.stdcall, importc, ogl.} - # GL_EXT_draw_buffers2 -proc glColorMaskIndexedEXT*(buf: GLuint, r: GLboolean, g: GLboolean, - b: GLboolean, a: GLboolean){.stdcall, importc, ogl.} -proc glGetBooleanIndexedvEXT*(value: GLenum, index: GLuint, data: PGLboolean){. - stdcall, importc, ogl.} -proc glGetIntegerIndexedvEXT*(value: GLenum, index: GLuint, data: PGLint){. - stdcall, importc, ogl.} -proc glEnableIndexedEXT*(target: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glDisableIndexedEXT*(target: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glIsEnabledIndexedEXT*(target: GLenum, index: GLuint): GLboolean{.stdcall, importc, ogl.} - # GL_EXT_draw_instanced -proc glDrawArraysInstancedEXT*(mode: GLenum, first: GLint, count: GLsizei, - primcount: GLsizei){.stdcall, importc, ogl.} -proc glDrawElementsInstancedEXT*(mode: GLenum, count: GLsizei, typ: GLenum, - indices: Pointer, primcount: GLsizei){.stdcall, importc, ogl.} - # GL_EXT_geometry_shader4 -proc glProgramParameteriEXT*(prog: GLuint, pname: GLenum, value: GLint){.stdcall, importc, ogl.} -proc glFramebufferTextureEXT*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint){.stdcall, importc, ogl.} - #procedure glFramebufferTextureLayerEXT(target: GLenum; attachment: GLenum; texture: GLuint; level: GLint; layer: GLint); stdcall, importc, ogl; -proc glFramebufferTextureFaceEXT*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint, face: GLenum){. - stdcall, importc, ogl.} - # GL_EXT_gpu_shader4 -proc glVertexAttribI1iEXT*(index: GLuint, x: GLint){.stdcall, importc, ogl.} -proc glVertexAttribI2iEXT*(index: GLuint, x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glVertexAttribI3iEXT*(index: GLuint, x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glVertexAttribI4iEXT*(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint){. - stdcall, importc, ogl.} -proc glVertexAttribI1uiEXT*(index: GLuint, x: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribI2uiEXT*(index: GLuint, x: GLuint, y: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribI3uiEXT*(index: GLuint, x: GLuint, y: GLuint, z: GLuint){. - stdcall, importc, ogl.} -proc glVertexAttribI4uiEXT*(index: GLuint, x: GLuint, y: GLuint, z: GLuint, - w: GLuint){.stdcall, importc, ogl.} -proc glVertexAttribI1ivEXT*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI2ivEXT*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI3ivEXT*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI4ivEXT*(index: GLuint, v: PGLint){.stdcall, importc, ogl.} -proc glVertexAttribI1uivEXT*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI2uivEXT*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI3uivEXT*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI4uivEXT*(index: GLuint, v: PGLuint){.stdcall, importc, ogl.} -proc glVertexAttribI4bvEXT*(index: GLuint, v: PGLbyte){.stdcall, importc, ogl.} -proc glVertexAttribI4svEXT*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttribI4ubvEXT*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttribI4usvEXT*(index: GLuint, v: PGLushort){.stdcall, importc, ogl.} -proc glVertexAttribIPointerEXT*(index: GLuint, size: GLint, typ: GLenum, - stride: GLsizei, pointer: Pointer){.stdcall, importc, ogl.} -proc glGetVertexAttribIivEXT*(index: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetVertexAttribIuivEXT*(index: GLuint, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} -proc glUniform1uiEXT*(location: GLint, v0: GLuint){.stdcall, importc, ogl.} -proc glUniform2uiEXT*(location: GLint, v0: GLuint, v1: GLuint){.stdcall, importc, ogl.} -proc glUniform3uiEXT*(location: GLint, v0: GLuint, v1: GLuint, v2: GLuint){. - stdcall, importc, ogl.} -proc glUniform4uiEXT*(location: GLint, v0: GLuint, v1: GLuint, v2: GLuint, - v3: GLuint){.stdcall, importc, ogl.} -proc glUniform1uivEXT*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glUniform2uivEXT*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glUniform3uivEXT*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glUniform4uivEXT*(location: GLint, count: GLsizei, value: PGLuint){.stdcall, importc, ogl.} -proc glGetUniformuivEXT*(prog: GLuint, location: GLint, params: PGLuint){. - stdcall, importc, ogl.} -proc glBindFragDataLocationEXT*(prog: GLuint, colorNumber: GLuint, name: PGLchar){. - stdcall, importc, ogl.} -proc glGetFragDataLocationEXT*(prog: GLuint, name: PGLchar): GLint{.stdcall, importc, ogl.} - # GL_EXT_texture_array -proc glFramebufferTextureLayerEXT*(target: GLenum, attachment: GLenum, - texture: GLuint, level: GLint, layer: GLint){. - stdcall, importc, ogl.} - # GL_EXT_texture_buffer_object -proc glTexBufferEXT*(target: GLenum, internalformat: GLenum, buffer: GLuint){. - stdcall, importc, ogl.} - # GL_EXT_texture_integer -proc glClearColorIiEXT*(r: GLint, g: GLint, b: GLint, a: GLint){.stdcall, importc, ogl.} -proc glClearColorIuiEXT*(r: GLuint, g: GLuint, b: GLuint, a: GLuint){.stdcall, importc, ogl.} -proc glTexParameterIivEXT*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glTexParameterIuivEXT*(target: GLenum, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} -proc glGetTexParameterIivEXT*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetTexParameterIiuvEXT*(target: GLenum, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} - # GL_HP_image_transform -proc glImageTransformParameteriHP*(target: GLenum, pname: GLenum, param: GLint){. - stdcall, importc, ogl.} -proc glImageTransformParameterfHP*(target: GLenum, pname: GLenum, param: GLfloat){. - stdcall, importc, ogl.} -proc glImageTransformParameterivHP*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glImageTransformParameterfvHP*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetImageTransformParameterivHP*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetImageTransformParameterfvHP*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} - # GL_EXT_depth_bounds_test -proc glDepthBoundsEXT*(zmin: GLclampd, zmax: GLclampd){.stdcall, importc, ogl.} - # GL_EXT_blend_equation_separate -proc glBlendEquationSeparateEXT*(modeRGB: GLenum, modeAlpha: GLenum){.stdcall, importc, ogl.} - # GL_EXT_transform_feedback -proc glBeginTransformFeedbackEXT*(primitiveMode: GLenum){.stdcall, importc, ogl.} -proc glEndTransformFeedbackEXT*(){.stdcall, importc, ogl.} -proc glBindBufferRangeEXT*(target: GLenum, index: GLuint, buffer: GLuint, - offset: GLintptr, size: GLsizeiptr){.stdcall, importc, ogl.} -proc glBindBufferOffsetEXT*(target: GLenum, index: GLuint, buffer: GLuint, - offset: GLintptr){.stdcall, importc, ogl.} -proc glBindBufferBaseEXT*(target: GLenum, index: GLuint, buffer: GLuint){. - stdcall, importc, ogl.} -proc glTransformFeedbackVaryingsEXT*(prog: GLuint, count: GLsizei, - locations: PGLint, bufferMode: GLenum){. - stdcall, importc, ogl.} -proc glGetTransformFeedbackVaryingEXT*(prog: GLuint, index: GLuint, - location: PGLint){.stdcall, importc, ogl.} - # GL_EXT_direct_state_access -proc glClientAttribDefaultEXT*(mask: GLbitfield){.stdcall, importc, ogl.} -proc glPushClientAttribDefaultEXT*(mask: GLbitfield){.stdcall, importc, ogl.} -proc glMatrixLoadfEXT*(mode: GLenum, m: PGLfloat){.stdcall, importc, ogl.} -proc glMatrixLoaddEXT*(mode: GLenum, m: PGLdouble){.stdcall, importc, ogl.} -proc glMatrixMultfEXT*(mode: GLenum, m: PGLfloat){.stdcall, importc, ogl.} -proc glMatrixMultdEXT*(mode: GLenum, m: PGLdouble){.stdcall, importc, ogl.} -proc glMatrixLoadIdentityEXT*(mode: GLenum){.stdcall, importc, ogl.} -proc glMatrixRotatefEXT*(mode: GLenum, angle: GLfloat, x: GLfloat, y: GLfloat, - z: GLfloat){.stdcall, importc, ogl.} -proc glMatrixRotatedEXT*(mode: GLenum, angle: GLdouble, x: GLdouble, - y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glMatrixScalefEXT*(mode: GLenum, x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glMatrixScaledEXT*(mode: GLenum, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glMatrixTranslatefEXT*(mode: GLenum, x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glMatrixTranslatedEXT*(mode: GLenum, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glMatrixFrustumEXT*(mode: GLenum, left: GLdouble, right: GLdouble, - bottom: GLdouble, top: GLdouble, zNear: GLdouble, - zFar: GLdouble){.stdcall, importc, ogl.} -proc glMatrixOrthoEXT*(mode: GLenum, left: GLdouble, right: GLdouble, - bottom: GLdouble, top: GLdouble, zNear: GLdouble, - zFar: GLdouble){.stdcall, importc, ogl.} -proc glMatrixPopEXT*(mode: GLenum){.stdcall, importc, ogl.} -proc glMatrixPushEXT*(mode: GLenum){.stdcall, importc, ogl.} -proc glMatrixLoadTransposefEXT*(mode: GLenum, m: PGLfloat){.stdcall, importc, ogl.} -proc glMatrixLoadTransposedEXT*(mode: GLenum, m: PGLdouble){.stdcall, importc, ogl.} -proc glMatrixMultTransposefEXT*(mode: GLenum, m: PGLfloat){.stdcall, importc, ogl.} -proc glMatrixMultTransposedEXT*(mode: GLenum, m: PGLdouble){.stdcall, importc, ogl.} -proc glTextureParameterfEXT*(texture: GLuint, target: GLenum, pname: GLenum, - param: GLfloat){.stdcall, importc, ogl.} -proc glTextureParameterfvEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glTextureParameteriEXT*(texture: GLuint, target: GLenum, pname: GLenum, - param: GLint){.stdcall, importc, ogl.} -proc glTextureParameterivEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glTextureImage1DEXT*(texture: GLuint, target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, border: GLint, - format: GLenum, typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTextureImage2DEXT*(texture: GLuint, target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, border: GLint, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTextureSubImage1DEXT*(texture: GLuint, target: GLenum, level: GLint, - xoffset: GLint, width: GLsizei, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTextureSubImage2DEXT*(texture: GLuint, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, width: GLsizei, - height: GLsizei, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glCopyTextureImage1DEXT*(texture: GLuint, target: GLenum, level: GLint, - internalformat: GLenum, x: GLint, y: GLint, - width: GLsizei, border: GLint){.stdcall, importc, ogl.} -proc glCopyTextureImage2DEXT*(texture: GLuint, target: GLenum, level: GLint, - internalformat: GLenum, x: GLint, y: GLint, - width: GLsizei, height: GLsizei, border: GLint){. - stdcall, importc, ogl.} -proc glCopyTextureSubImage1DEXT*(texture: GLuint, target: GLenum, level: GLint, - xoffset: GLint, x: GLint, y: GLint, - width: GLsizei){.stdcall, importc, ogl.} -proc glCopyTextureSubImage2DEXT*(texture: GLuint, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, x: GLint, - y: GLint, width: GLsizei, height: GLsizei){. - stdcall, importc, ogl.} -proc glGetTextureImageEXT*(texture: GLuint, target: GLenum, level: GLint, - format: GLenum, typ: GLenum, pixels: PGLvoid){. - stdcall, importc, ogl.} -proc glGetTextureParameterfvEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetTextureParameterivEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetTextureLevelParameterfvEXT*(texture: GLuint, target: GLenum, - level: GLint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetTextureLevelParameterivEXT*(texture: GLuint, target: GLenum, - level: GLint, pname: GLenum, params: GLint){. - stdcall, importc, ogl.} -proc glTextureImage3DEXT*(texture: GLuint, target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, depth: GLsizei, border: GLint, - format: GLenum, typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTextureSubImage3DEXT*(texture: GLuint, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, zoffset: GLint, - width: GLsizei, height: GLsizei, depth: GLsizei, - format: GLenum, typ: GLenum, pixels: PGLvoid){. - stdcall, importc, ogl.} -proc glCopyTextureSubImage3DEXT*(texture: GLuint, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, zoffset: GLint, - x: GLint, y: GLint, width: GLsizei, - height: GLsizei){.stdcall, importc, ogl.} -proc glMultiTexParameterfEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexParameterfvEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexParameteriEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLint){.stdcall, importc, ogl.} -proc glMultiTexParameterivEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glMultiTexImage1DEXT*(texunit: GLenum, target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - border: GLint, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glMultiTexImage2DEXT*(texunit: GLenum, target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, border: GLint, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glMultiTexSubImage1DEXT*(texunit: GLenum, target: GLenum, level: GLint, - xoffset: GLint, width: GLsizei, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glMultiTexSubImage2DEXT*(texunit: GLenum, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, width: GLsizei, - height: GLsizei, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} -proc glCopyMultiTexImage1DEXT*(texunit: GLenum, target: GLenum, level: GLint, - internalformat: GLenum, x: GLint, y: GLint, - width: GLsizei, border: GLint){.stdcall, importc, ogl.} -proc glCopyMultiTexImage2DEXT*(texunit: GLenum, target: GLenum, level: GLint, - internalformat: GLenum, x: GLint, y: GLint, - width: GLsizei, height: GLsizei, border: GLint){. - stdcall, importc, ogl.} -proc glCopyMultiTexSubImage1DEXT*(texunit: GLenum, target: GLenum, level: GLint, - xoffset: GLint, x: GLint, y: GLint, - width: GLsizei){.stdcall, importc, ogl.} -proc glCopyMultiTexSubImage2DEXT*(texunit: GLenum, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, x: GLint, - y: GLint, width: GLsizei, height: GLsizei){. - stdcall, importc, ogl.} -proc glGetMultiTexImageEXT*(texunit: GLenum, target: GLenum, level: GLint, - format: GLenum, typ: GLenum, pixels: PGLvoid){. - stdcall, importc, ogl.} -proc glGetMultiTexParameterfvEXT*(texunit: GLenum, target: GLenum, - pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetMultiTexParameterivEXT*(texunit: GLenum, target: GLenum, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetMultiTexLevelParameterfvEXT*(texunit: GLenum, target: GLenum, - level: GLint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetMultiTexLevelParameterivEXT*(texunit: GLenum, target: GLenum, - level: GLint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glMultiTexImage3DEXT*(texunit: GLenum, target: GLenum, level: GLint, - internalformat: GLenum, width: GLsizei, - height: GLsizei, depth: GLsizei, border: GLint, - format: GLenum, typ: GLenum, pixels: PGLvoid){. - stdcall, importc, ogl.} -proc glMultiTexSubImage3DEXT*(texunit: GLenum, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, zoffset: GLint, - width: GLsizei, height: GLsizei, depth: GLsizei, - format: GLenum, typ: GLenum, pixels: PGLvoid){. - stdcall, importc, ogl.} -proc glCopyMultiTexSubImage3DEXT*(texunit: GLenum, target: GLenum, level: GLint, - xoffset: GLint, yoffset: GLint, - zoffset: GLint, x: GLint, y: GLint, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glBindMultiTextureEXT*(texunit: GLenum, target: GLenum, texture: GLuint){. - stdcall, importc, ogl.} -proc glEnableClientStateIndexedEXT*(arr: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glDisableClientStateIndexedEXT*(arr: GLenum, index: GLuint){.stdcall, importc, ogl.} -proc glMultiTexCoordPointerEXT*(texunit: GLenum, size: GLint, typ: GLenum, - stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glMultiTexEnvfEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexEnvfvEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexEnviEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLint){.stdcall, importc, ogl.} -proc glMultiTexEnvivEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glMultiTexGendEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLdouble){.stdcall, importc, ogl.} -proc glMultiTexGendvEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLdouble){.stdcall, importc, ogl.} -proc glMultiTexGenfEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLfloat){.stdcall, importc, ogl.} -proc glMultiTexGenfvEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glMultiTexGeniEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - param: GLint){.stdcall, importc, ogl.} -proc glMultiTexGenivEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetMultiTexEnvfvEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetMultiTexEnvivEXT*(texunit: GLenum, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetMultiTexGendvEXT*(texunit: GLenum, coord: GLenum, pname: GLenum, - params: PGLdouble){.stdcall, importc, ogl.} -proc glGetMultiTexGenfvEXT*(texunit: GLenum, coord: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetMultiTexGenivEXT*(texunit: GLenum, coord: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetFloatIndexedvEXT*(target: GLenum, index: GLuint, data: PGLfloat){. - stdcall, importc, ogl.} -proc glGetDoubleIndexedvEXT*(target: GLenum, index: GLuint, data: PGLdouble){. - stdcall, importc, ogl.} -proc glGetPointerIndexedvEXT*(target: GLenum, index: GLuint, data: PPGLvoid){. - stdcall, importc, ogl.} -proc glCompressedTextureImage3DEXT*(texture: GLuint, target: GLenum, - level: GLint, internalformat: GLenum, - width: GLsizei, height: GLsizei, - depth: GLsizei, border: GLint, - imageSize: GLsizei, bits: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTextureImage2DEXT*(texture: GLuint, target: GLenum, - level: GLint, internalformat: GLenum, - width: GLsizei, height: GLsizei, - border: GLint, imageSize: GLsizei, - bits: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTextureImage1DEXT*(texture: GLuint, target: GLenum, - level: GLint, internalformat: GLenum, - width: GLsizei, border: GLint, - imageSize: GLsizei, bits: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedTextureSubImage3DEXT*(texture: GLuint, target: GLenum, - level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, - width: GLsizei, height: GLsizei, - depth: GLsizei, format: GLenum, - imageSize: GLsizei, bits: PGLvoid){. - stdcall, importc, ogl.} -proc glCompressedTextureSubImage2DEXT*(texture: GLuint, target: GLenum, - level: GLint, xoffset: GLint, - yoffset: GLint, width: GLsizei, - height: GLsizei, format: GLenum, - imageSize: GLsizei, bits: PGLvoid){. - stdcall, importc, ogl.} -proc glCompressedTextureSubImage1DEXT*(texture: GLuint, target: GLenum, - level: GLint, xoffset: GLint, - width: GLsizei, format: GLenum, - imageSize: GLsizei, bits: PGLvoid){. - stdcall, importc, ogl.} -proc glGetCompressedTextureImageEXT*(texture: GLuint, target: GLenum, - lod: GLint, img: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedMultiTexImage3DEXT*(texunit: GLenum, target: GLenum, - level: GLint, internalformat: GLenum, - width: GLsizei, height: GLsizei, - depth: GLsizei, border: GLint, - imageSize: GLsizei, bits: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedMultiTexImage2DEXT*(texunit: GLenum, target: GLenum, - level: GLint, internalformat: GLenum, - width: GLsizei, height: GLsizei, - border: GLint, imageSize: GLsizei, - bits: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedMultiTexImage1DEXT*(texunit: GLenum, target: GLenum, - level: GLint, internalformat: GLenum, - width: GLsizei, border: GLint, - imageSize: GLsizei, bits: PGLvoid){.stdcall, importc, ogl.} -proc glCompressedMultiTexSubImage3DEXT*(texunit: GLenum, target: GLenum, - level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, - width: GLsizei, height: GLsizei, - depth: GLsizei, format: GLenum, - imageSize: GLsizei, bits: PGLvoid){. - stdcall, importc, ogl.} -proc glCompressedMultiTexSubImage2DEXT*(texunit: GLenum, target: GLenum, - level: GLint, xoffset: GLint, - yoffset: GLint, width: GLsizei, - height: GLsizei, format: GLenum, - imageSize: GLsizei, bits: PGLvoid){. - stdcall, importc, ogl.} -proc glCompressedMultiTexSubImage1DEXT*(texunit: GLenum, target: GLenum, - level: GLint, xoffset: GLint, - width: GLsizei, format: GLenum, - imageSize: GLsizei, bits: PGLvoid){. - stdcall, importc, ogl.} -proc glGetCompressedMultiTexImageEXT*(texunit: GLenum, target: GLenum, - lod: GLint, img: PGLvoid){.stdcall, importc, ogl.} -proc glNamedProgramStringEXT*(prog: GLuint, target: GLenum, format: GLenum, - length: GLsizei, string: PGLvoid){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameter4dEXT*(prog: GLuint, target: GLenum, - index: GLuint, x: GLdouble, y: GLdouble, - z: GLdouble, w: GLdouble){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameter4dvEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLdouble){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameter4fEXT*(prog: GLuint, target: GLenum, - index: GLuint, x: GLfloat, y: GLfloat, - z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameter4fvEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetNamedProgramLocalParameterdvEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLdouble){.stdcall, importc, ogl.} -proc glGetNamedProgramLocalParameterfvEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetNamedProgramivEXT*(prog: GLuint, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetNamedProgramStringEXT*(prog: GLuint, target: GLenum, pname: GLenum, - string: PGLvoid){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameters4fvEXT*(prog: GLuint, target: GLenum, - index: GLuint, count: GLsizei, params: PGLfloat){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameterI4iEXT*(prog: GLuint, target: GLenum, - index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameterI4ivEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLint){.stdcall, importc, ogl.} -proc glNamedProgramLocalParametersI4ivEXT*(prog: GLuint, target: GLenum, - index: GLuint, count: GLsizei, params: PGLint){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameterI4uiEXT*(prog: GLuint, target: GLenum, - index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint){.stdcall, importc, ogl.} -proc glNamedProgramLocalParameterI4uivEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLuint){.stdcall, importc, ogl.} -proc glNamedProgramLocalParametersI4uivEXT*(prog: GLuint, target: GLenum, - index: GLuint, count: GLsizei, params: PGLuint){.stdcall, importc, ogl.} -proc glGetNamedProgramLocalParameterIivEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLint){.stdcall, importc, ogl.} -proc glGetNamedProgramLocalParameterIuivEXT*(prog: GLuint, target: GLenum, - index: GLuint, params: PGLuint){.stdcall, importc, ogl.} -proc glTextureParameterIivEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glTextureParameterIuivEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLuint){.stdcall, importc, ogl.} -proc glGetTextureParameterIivEXT*(texture: GLuint, target: GLenum, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetTextureParameterIuivEXT*(texture: GLuint, target: GLenum, - pname: GLenum, params: PGLuint){.stdcall, importc, ogl.} -proc glMultiTexParameterIivEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glMultiTexParameterIuivEXT*(texture: GLuint, target: GLenum, pname: GLenum, - params: PGLuint){.stdcall, importc, ogl.} -proc glGetMultiTexParameterIivEXT*(texture: GLuint, target: GLenum, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetMultiTexParameterIuivEXT*(texture: GLuint, target: GLenum, - pname: GLenum, params: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform1fEXT*(prog: GLuint, location: GLint, v0: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform2fEXT*(prog: GLuint, location: GLint, v0: GLfloat, - v1: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform3fEXT*(prog: GLuint, location: GLint, v0: GLfloat, - v1: GLfloat, v2: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform4fEXT*(prog: GLuint, location: GLint, v0: GLfloat, - v1: GLfloat, v2: GLfloat, v3: GLfloat){.stdcall, importc, ogl.} -proc glProgramUniform1iEXT*(prog: GLuint, location: GLint, v0: GLint){.stdcall, importc, ogl.} -proc glProgramUniform2iEXT*(prog: GLuint, location: GLint, v0: GLint, v1: GLint){. - stdcall, importc, ogl.} -proc glProgramUniform3iEXT*(prog: GLuint, location: GLint, v0: GLint, v1: GLint, - v2: GLint){.stdcall, importc, ogl.} -proc glProgramUniform4iEXT*(prog: GLuint, location: GLint, v0: GLint, v1: GLint, - v2: GLint, v3: GLint){.stdcall, importc, ogl.} -proc glProgramUniform1fvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform2fvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform3fvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform4fvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform1ivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform2ivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform3ivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniform4ivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2x3fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3x2fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2x4fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4x2fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3x4fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4x3fvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLfloat){.stdcall, importc, ogl.} -proc glProgramUniform1uiEXT*(prog: GLuint, location: GLint, v0: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform2uiEXT*(prog: GLuint, location: GLint, v0: GLuint, - v1: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform3uiEXT*(prog: GLuint, location: GLint, v0: GLuint, - v1: GLuint, v2: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform4uiEXT*(prog: GLuint, location: GLint, v0: GLuint, - v1: GLuint, v2: GLuint, v3: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform1uivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform2uivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform3uivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glProgramUniform4uivEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint){.stdcall, importc, ogl.} -proc glNamedBufferDataEXT*(buffer: GLuint, size: GLsizei, data: PGLvoid, - usage: GLenum){.stdcall, importc, ogl.} -proc glNamedBufferSubDataEXT*(buffer: GLuint, offset: GLintptr, - size: GLsizeiptr, data: PGLvoid){.stdcall, importc, ogl.} -proc glMapNamedBufferEXT*(buffer: GLuint, access: GLenum): PGLvoid{.stdcall, importc, ogl.} -proc glUnmapNamedBufferEXT*(buffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glMapNamedBufferRangeEXT*(buffer: GLuint, offset: GLintptr, - len: GLsizeiptr, access: GLbitfield): PGLvoid{. - stdcall, importc, ogl.} -proc glFlushMappedNamedBufferRangeEXT*(buffer: GLuint, offset: GLintptr, - len: GLsizeiptr){.stdcall, importc, ogl.} -proc glNamedCopyBufferSubDataEXT*(readBuffer: GLuint, writeBuffer: GLuint, - readOffset: GLintptr, writeOffset: GLintptr, - size: GLsizeiptr){.stdcall, importc, ogl.} -proc glGetNamedBufferParameterivEXT*(buffer: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetNamedBufferPointervEXT*(buffer: GLuint, pname: GLenum, - params: PPGLvoid){.stdcall, importc, ogl.} -proc glGetNamedBufferSubDataEXT*(buffer: GLuint, offset: GLintptr, - size: GLsizeiptr, data: PGLvoid){.stdcall, importc, ogl.} -proc glTextureBufferEXT*(texture: GLuint, target: GLenum, - internalformat: GLenum, buffer: GLuint){.stdcall, importc, ogl.} -proc glMultiTexBufferEXT*(texunit: GLenum, target: GLenum, interformat: GLenum, - buffer: GLuint){.stdcall, importc, ogl.} -proc glNamedRenderbufferStorageEXT*(renderbuffer: GLuint, interformat: GLenum, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glGetNamedRenderbufferParameterivEXT*(renderbuffer: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glCheckNamedFramebufferStatusEXT*(framebuffer: GLuint, target: GLenum): GLenum{. - stdcall, importc, ogl.} -proc glNamedFramebufferTexture1DEXT*(framebuffer: GLuint, attachment: GLenum, - textarget: GLenum, texture: GLuint, - level: GLint){.stdcall, importc, ogl.} -proc glNamedFramebufferTexture2DEXT*(framebuffer: GLuint, attachment: GLenum, - textarget: GLenum, texture: GLuint, - level: GLint){.stdcall, importc, ogl.} -proc glNamedFramebufferTexture3DEXT*(framebuffer: GLuint, attachment: GLenum, - textarget: GLenum, texture: GLuint, - level: GLint, zoffset: GLint){.stdcall, importc, ogl.} -proc glNamedFramebufferRenderbufferEXT*(framebuffer: GLuint, attachment: GLenum, - renderbuffertarget: GLenum, - renderbuffer: GLuint){.stdcall, importc, ogl.} -proc glGetNamedFramebufferAttachmentParameterivEXT*(framebuffer: GLuint, - attachment: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGenerateTextureMipmapEXT*(texture: GLuint, target: GLenum){.stdcall, importc, ogl.} -proc glGenerateMultiTexMipmapEXT*(texunit: GLenum, target: GLenum){.stdcall, importc, ogl.} -proc glFramebufferDrawBufferEXT*(framebuffer: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glFramebufferDrawBuffersEXT*(framebuffer: GLuint, n: GLsizei, bufs: PGLenum){. - stdcall, importc, ogl.} -proc glFramebufferReadBufferEXT*(framebuffer: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glGetFramebufferParameterivEXT*(framebuffer: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glNamedRenderbufferStorageMultisampleEXT*(renderbuffer: GLuint, - samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei){. - stdcall, importc, ogl.} -proc glNamedRenderbufferStorageMultisampleCoverageEXT*(renderbuffer: GLuint, - coverageSamples: GLsizei, colorSamples: GLsizei, internalformat: GLenum, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} -proc glNamedFramebufferTextureEXT*(framebuffer: GLuint, attachment: GLenum, - texture: GLuint, level: GLint){.stdcall, importc, ogl.} -proc glNamedFramebufferTextureLayerEXT*(framebuffer: GLuint, attachment: GLenum, - texture: GLuint, level: GLint, - layer: GLint){.stdcall, importc, ogl.} -proc glNamedFramebufferTextureFaceEXT*(framebuffer: GLuint, attachment: GLenum, - texture: GLuint, level: GLint, - face: GLenum){.stdcall, importc, ogl.} -proc glTextureRenderbufferEXT*(texture: GLuint, target: GLenum, - renderbuffer: GLuint){.stdcall, importc, ogl.} -proc glMultiTexRenderbufferEXT*(texunit: GLenum, target: GLenum, - renderbuffer: GLuint){.stdcall, importc, ogl.} -proc glProgramUniform1dEXT*(prog: GLuint, location: GLint, x: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform2dEXT*(prog: GLuint, location: GLint, x: GLdouble, - y: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform3dEXT*(prog: GLuint, location: GLint, x: GLdouble, - y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform4dEXT*(prog: GLuint, location: GLint, x: GLdouble, - y: GLdouble, z: GLdouble, w: GLdouble){.stdcall, importc, ogl.} -proc glProgramUniform1dvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform2dvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform3dvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniform4dvEXT*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2x3dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix2x4dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3x2dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix3x4dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4x2dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} -proc glProgramUniformMatrix4x3dvEXT*(prog: GLuint, location: GLint, - count: GLsizei, transpose: GLboolean, - value: PGLdouble){.stdcall, importc, ogl.} - # GL_EXT_separate_shader_objects -proc glUseShaderProgramEXT*(typ: GLenum, prog: GLuint){.stdcall, importc, ogl.} -proc glActiveProgramEXT*(prog: GLuint){.stdcall, importc, ogl.} -proc glCreateShaderProgramEXT*(typ: GLenum, string: PGLchar): GLuint{.stdcall, importc, ogl.} - # GL_EXT_shader_image_load_store -proc glBindImageTextureEXT*(index: GLuint, texture: GLuint, level: GLint, - layered: GLboolean, layer: GLint, access: GLenum, - format: GLint){.stdcall, importc, ogl.} -proc glMemoryBarrierEXT*(barriers: GLbitfield){.stdcall, importc, ogl.} - # GL_EXT_vertex_attrib_64bit -proc glVertexAttribL1dEXT*(index: GLuint, x: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL2dEXT*(index: GLuint, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL3dEXT*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glVertexAttribL4dEXT*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL1dvEXT*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL2dvEXT*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL3dvEXT*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribL4dvEXT*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribLPointerEXT*(index: GLuint, size: GLint, typ: GLenum, - stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glGetVertexAttribLdvEXT*(index: GLuint, pname: GLenum, params: PGLdouble){. - stdcall, importc, ogl.} -proc glVertexArrayVertexAttribLOffsetEXT*(vaobj: GLuint, buffer: GLuint, - index: GLuint, size: GLint, typ: GLenum, stride: GLsizei, offset: GLintptr){. - stdcall, importc, ogl.} - # GL_IBM_multimode_draw_arrays -proc glMultiModeDrawArraysIBM*(mode: GLenum, first: PGLint, count: PGLsizei, - primcount: GLsizei, modestride: GLint){.stdcall, importc, ogl.} -proc glMultiModeDrawElementsIBM*(mode: PGLenum, count: PGLsizei, typ: GLenum, - indices: PGLvoid, primcount: GLsizei, - modestride: GLint){.stdcall, importc, ogl.} - # GL_IBM_vertex_array_lists -proc glColorPointerListIBM*(size: GLint, typ: GLenum, stride: GLint, - pointer: PGLvoid, ptrstride: GLint){.stdcall, importc, ogl.} -proc glSecondaryColorPointerListIBM*(size: GLint, typ: GLenum, stride: GLint, - pointer: PGLvoid, ptrstride: GLint){. - stdcall, importc, ogl.} -proc glEdgeFlagPointerListIBM*(stride: GLint, pointer: PGLboolean, - ptrstride: GLint){.stdcall, importc, ogl.} -proc glFogCoordPointerListIBM*(typ: GLenum, stride: GLint, pointer: PGLvoid, - ptrstride: GLint){.stdcall, importc, ogl.} -proc glIndexPointerListIBM*(typ: GLenum, stride: GLint, pointer: PGLvoid, - ptrstride: GLint){.stdcall, importc, ogl.} -proc glNormalPointerListIBM*(typ: GLenum, stride: GLint, pointer: PGLvoid, - ptrstride: GLint){.stdcall, importc, ogl.} -proc glTexCoordPointerListIBM*(size: GLint, typ: GLenum, stride: GLint, - pointer: PGLvoid, ptrstride: GLint){.stdcall, importc, ogl.} -proc glVertexPointerListIBM*(size: GLint, typ: GLenum, stride: GLint, - pointer: PGLvoid, ptrstride: GLint){.stdcall, importc, ogl.} - # GL_INGR_blend_func_separate -proc glBlendFuncSeparateINGR*(sfactorRGB: GLenum, dfactorRGB: GLenum, - sfactorAlpha: GLenum, dfactorAlpha: GLenum){. - stdcall, importc, ogl.} - # GL_INTEL_parallel_arrays -proc glVertexPointervINTEL*(size: GLint, typ: GLenum, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glNormalPointervINTEL*(typ: GLenum, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glColorPointervINTEL*(size: GLint, typ: GLenum, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glTexCoordPointervINTEL*(size: GLint, typ: GLenum, pointer: PGLvoid){. - stdcall, importc, ogl.} - # GL_MESA_resize_buffers -proc glResizeBuffersMESA*(){.stdcall, importc, ogl.} - # GL_MESA_window_pos -proc glWindowPos2dMESA*(x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glWindowPos2dvMESA*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos2fMESA*(x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos2fvMESA*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos2iMESA*(x: GLint, y: GLint){.stdcall, importc, ogl.} -proc glWindowPos2ivMESA*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos2sMESA*(x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glWindowPos2svMESA*(v: PGLshort){.stdcall, importc, ogl.} -proc glWindowPos3dMESA*(x: GLdouble, y: GLdouble, z: GLdouble){.stdcall, importc, ogl.} -proc glWindowPos3dvMESA*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos3fMESA*(x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos3fvMESA*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos3iMESA*(x: GLint, y: GLint, z: GLint){.stdcall, importc, ogl.} -proc glWindowPos3ivMESA*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos3sMESA*(x: GLshort, y: GLshort, z: GLshort){.stdcall, importc, ogl.} -proc glWindowPos3svMESA*(v: PGLshort){.stdcall, importc, ogl.} -proc glWindowPos4dMESA*(x: GLdouble, y: GLdouble, z: GLdouble, w: GLdouble){. - stdcall, importc, ogl.} -proc glWindowPos4dvMESA*(v: PGLdouble){.stdcall, importc, ogl.} -proc glWindowPos4fMESA*(x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glWindowPos4fvMESA*(v: PGLfloat){.stdcall, importc, ogl.} -proc glWindowPos4iMESA*(x: GLint, y: GLint, z: GLint, w: GLint){.stdcall, importc, ogl.} -proc glWindowPos4ivMESA*(v: PGLint){.stdcall, importc, ogl.} -proc glWindowPos4sMESA*(x: GLshort, y: GLshort, z: GLshort, w: GLshort){.stdcall, importc, ogl.} -proc glWindowPos4svMESA*(v: PGLshort){.stdcall, importc, ogl.} - # GL_NV_evaluators -proc glMapControlPointsNV*(target: GLenum, index: GLuint, typ: GLenum, - ustride: GLsizei, vstride: GLsizei, uorder: GLint, - vorder: GLint, pack: GLboolean, points: PGLvoid){. - stdcall, importc, ogl.} -proc glMapParameterivNV*(target: GLenum, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glMapParameterfvNV*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetMapControlPointsNV*(target: GLenum, index: GLuint, typ: GLenum, - ustride: GLsizei, vstride: GLsizei, - pack: GLboolean, points: PGLvoid){.stdcall, importc, ogl.} -proc glGetMapParameterivNV*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetMapParameterfvNV*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetMapAttribParameterivNV*(target: GLenum, index: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetMapAttribParameterfvNV*(target: GLenum, index: GLuint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glEvalMapsNV*(target: GLenum, mode: GLenum){.stdcall, importc, ogl.} - # GL_NV_fence -proc glDeleteFencesNV*(n: GLsizei, fences: PGLuint){.stdcall, importc, ogl.} -proc glGenFencesNV*(n: GLsizei, fences: PGLuint){.stdcall, importc, ogl.} -proc glIsFenceNV*(fence: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glTestFenceNV*(fence: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glGetFenceivNV*(fence: GLuint, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glFinishFenceNV*(fence: GLuint){.stdcall, importc, ogl.} -proc glSetFenceNV*(fence: GLuint, condition: GLenum){.stdcall, importc, ogl.} - # GL_NV_fragment_prog -proc glProgramNamedParameter4fNV*(id: GLuint, length: GLsizei, name: PGLubyte, - x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat){. - stdcall, importc, ogl.} -proc glProgramNamedParameter4dNV*(id: GLuint, length: GLsizei, name: PGLubyte, - x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glProgramNamedParameter4fvNV*(id: GLuint, length: GLsizei, name: PGLubyte, - v: PGLfloat){.stdcall, importc, ogl.} -proc glProgramNamedParameter4dvNV*(id: GLuint, length: GLsizei, name: PGLubyte, - v: PGLdouble){.stdcall, importc, ogl.} -proc glGetProgramNamedParameterfvNV*(id: GLuint, length: GLsizei, - name: PGLubyte, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetProgramNamedParameterdvNV*(id: GLuint, length: GLsizei, - name: PGLubyte, params: PGLdouble){.stdcall, importc, ogl.} - # GL_NV_half_float -proc glVertex2hNV*(x: GLhalfNV, y: GLhalfNV){.stdcall, importc, ogl.} -proc glVertex2hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertex3hNV*(x: GLhalfNV, y: GLhalfNV, z: GLhalfNV){.stdcall, importc, ogl.} -proc glVertex3hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertex4hNV*(x: GLhalfNV, y: GLhalfNV, z: GLhalfNV, w: GLhalfNV){.stdcall, importc, ogl.} -proc glVertex4hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glNormal3hNV*(nx: GLhalfNV, ny: GLhalfNV, nz: GLhalfNV){.stdcall, importc, ogl.} -proc glNormal3hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glColor3hNV*(red: GLhalfNV, green: GLhalfNV, blue: GLhalfNV){.stdcall, importc, ogl.} -proc glColor3hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glColor4hNV*(red: GLhalfNV, green: GLhalfNV, blue: GLhalfNV, - alpha: GLhalfNV){.stdcall, importc, ogl.} -proc glColor4hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord1hNV*(s: GLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord1hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord2hNV*(s: GLhalfNV, t: GLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord2hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord3hNV*(s: GLhalfNV, t: GLhalfNV, r: GLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord3hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glTexCoord4hNV*(s: GLhalfNV, t: GLhalfNV, r: GLhalfNV, q: GLhalfNV){. - stdcall, importc, ogl.} -proc glTexCoord4hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord1hNV*(target: GLenum, s: GLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord1hvNV*(target: GLenum, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord2hNV*(target: GLenum, s: GLhalfNV, t: GLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord2hvNV*(target: GLenum, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord3hNV*(target: GLenum, s: GLhalfNV, t: GLhalfNV, r: GLhalfNV){. - stdcall, importc, ogl.} -proc glMultiTexCoord3hvNV*(target: GLenum, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord4hNV*(target: GLenum, s: GLhalfNV, t: GLhalfNV, r: GLhalfNV, - q: GLhalfNV){.stdcall, importc, ogl.} -proc glMultiTexCoord4hvNV*(target: GLenum, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glFogCoordhNV*(fog: GLhalfNV){.stdcall, importc, ogl.} -proc glFogCoordhvNV*(fog: PGLhalfNV){.stdcall, importc, ogl.} -proc glSecondaryColor3hNV*(red: GLhalfNV, green: GLhalfNV, blue: GLhalfNV){. - stdcall, importc, ogl.} -proc glSecondaryColor3hvNV*(v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexWeighthNV*(weight: GLhalfNV){.stdcall, importc, ogl.} -proc glVertexWeighthvNV*(weight: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib1hNV*(index: GLuint, x: GLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib1hvNV*(index: GLuint, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib2hNV*(index: GLuint, x: GLhalfNV, y: GLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib2hvNV*(index: GLuint, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib3hNV*(index: GLuint, x: GLhalfNV, y: GLhalfNV, z: GLhalfNV){. - stdcall, importc, ogl.} -proc glVertexAttrib3hvNV*(index: GLuint, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib4hNV*(index: GLuint, x: GLhalfNV, y: GLhalfNV, z: GLhalfNV, - w: GLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttrib4hvNV*(index: GLuint, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttribs1hvNV*(index: GLuint, n: GLsizei, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttribs2hvNV*(index: GLuint, n: GLsizei, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttribs3hvNV*(index: GLuint, n: GLsizei, v: PGLhalfNV){.stdcall, importc, ogl.} -proc glVertexAttribs4hvNV*(index: GLuint, n: GLsizei, v: PGLhalfNV){.stdcall, importc, ogl.} - # GL_NV_occlusion_query -proc glGenOcclusionQueriesNV*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glDeleteOcclusionQueriesNV*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glIsOcclusionQueryNV*(id: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glBeginOcclusionQueryNV*(id: GLuint){.stdcall, importc, ogl.} -proc glEndOcclusionQueryNV*(){.stdcall, importc, ogl.} -proc glGetOcclusionQueryivNV*(id: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetOcclusionQueryuivNV*(id: GLuint, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} - # GL_NV_pixel_data_range -proc glPixelDataRangeNV*(target: GLenum, len: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glFlushPixelDataRangeNV*(target: GLenum){.stdcall, importc, ogl.} - # GL_NV_point_sprite -proc glPointParameteriNV*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glPointParameterivNV*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} - # GL_NV_primitive_restart -proc glPrimitiveRestartNV*(){.stdcall, importc, ogl.} -proc glPrimitiveRestartIndexNV*(index: GLuint){.stdcall, importc, ogl.} - # GL_NV_register_combiners -proc glCombinerParameterfvNV*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glCombinerParameterfNV*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glCombinerParameterivNV*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glCombinerParameteriNV*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glCombinerInputNV*(stage: GLenum, portion: GLenum, variable: GLenum, - input: GLenum, mapping: GLenum, componentUsage: GLenum){. - stdcall, importc, ogl.} -proc glCombinerOutputNV*(stage: GLenum, portion: GLenum, abOutput: GLenum, - cdOutput: GLenum, sumOutput: GLenum, scale: GLenum, - bias: GLenum, abDotProduct: GLboolean, - cdDotProduct: GLboolean, muxSum: GLboolean){.stdcall, importc, ogl.} -proc glFinalCombinerInputNV*(variable: GLenum, input: GLenum, mapping: GLenum, - componentUsage: GLenum){.stdcall, importc, ogl.} -proc glGetCombinerInputParameterfvNV*(stage: GLenum, portion: GLenum, - variable: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetCombinerInputParameterivNV*(stage: GLenum, portion: GLenum, - variable: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetCombinerOutputParameterfvNV*(stage: GLenum, portion: GLenum, - pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetCombinerOutputParameterivNV*(stage: GLenum, portion: GLenum, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetFinalCombinerInputParameterfvNV*(variable: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetFinalCombinerInputParameterivNV*(variable: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} - # GL_NV_register_combiners2 -proc glCombinerStageParameterfvNV*(stage: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetCombinerStageParameterfvNV*(stage: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} - # GL_NV_vertex_array_range -proc glFlushVertexArrayRangeNV*(){.stdcall, importc, ogl.} -proc glVertexArrayRangeNV*(len: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} - # GL_NV_vertex_prog -proc glAreProgramsResidentNV*(n: GLsizei, programs: PGLuint, - residences: PGLboolean): GLboolean{.stdcall, importc, ogl.} -proc glBindProgramNV*(target: GLenum, id: GLuint){.stdcall, importc, ogl.} -proc glDeleteProgramsNV*(n: GLsizei, programs: PGLuint){.stdcall, importc, ogl.} -proc glExecuteProgramNV*(target: GLenum, id: GLuint, params: PGLfloat){.stdcall, importc, ogl.} -proc glGenProgramsNV*(n: GLsizei, programs: PGLuint){.stdcall, importc, ogl.} -proc glGetProgramParameterdvNV*(target: GLenum, index: GLuint, pname: GLenum, - params: PGLdouble){.stdcall, importc, ogl.} -proc glGetProgramParameterfvNV*(target: GLenum, index: GLuint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetProgramivNV*(id: GLuint, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetProgramStringNV*(id: GLuint, pname: GLenum, prog: PGLubyte){.stdcall, importc, ogl.} -proc glGetTrackMatrixivNV*(target: GLenum, address: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetVertexAttribdvNV*(index: GLuint, pname: GLenum, params: PGLdouble){. - stdcall, importc, ogl.} -proc glGetVertexAttribfvNV*(index: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetVertexAttribivNV*(index: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetVertexAttribPointervNV*(index: GLuint, pname: GLenum, pointer: PGLvoid){. - stdcall, importc, ogl.} -proc glIsProgramNV*(id: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glLoadProgramNV*(target: GLenum, id: GLuint, length: GLsizei, - prog: PGLubyte){.stdcall, importc, ogl.} -proc glProgramParameter4dNV*(target: GLenum, index: GLuint, x: GLdouble, - y: GLdouble, z: GLdouble, w: GLdouble){.stdcall, importc, ogl.} -proc glProgramParameter4dvNV*(target: GLenum, index: GLuint, v: PGLdouble){. - stdcall, importc, ogl.} -proc glProgramParameter4fNV*(target: GLenum, index: GLuint, x: GLfloat, - y: GLfloat, z: GLfloat, w: GLfloat){.stdcall, importc, ogl.} -proc glProgramParameter4fvNV*(target: GLenum, index: GLuint, v: PGLfloat){. - stdcall, importc, ogl.} -proc glProgramParameters4dvNV*(target: GLenum, index: GLuint, count: GLuint, - v: PGLdouble){.stdcall, importc, ogl.} -proc glProgramParameters4fvNV*(target: GLenum, index: GLuint, count: GLuint, - v: PGLfloat){.stdcall, importc, ogl.} -proc glRequestResidentProgramsNV*(n: GLsizei, programs: PGLuint){.stdcall, importc, ogl.} -proc glTrackMatrixNV*(target: GLenum, address: GLuint, matrix: GLenum, - transform: GLenum){.stdcall, importc, ogl.} -proc glVertexAttribPointerNV*(index: GLuint, fsize: GLint, typ: GLenum, - stride: GLsizei, pointer: PGLvoid){.stdcall, importc, ogl.} -proc glVertexAttrib1dNV*(index: GLuint, x: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib1dvNV*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib1fNV*(index: GLuint, x: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib1fvNV*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib1sNV*(index: GLuint, x: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib1svNV*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib2dNV*(index: GLuint, x: GLdouble, y: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib2dvNV*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib2fNV*(index: GLuint, x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib2fvNV*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib2sNV*(index: GLuint, x: GLshort, y: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib2svNV*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib3dNV*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble){. - stdcall, importc, ogl.} -proc glVertexAttrib3dvNV*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib3fNV*(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glVertexAttrib3fvNV*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib3sNV*(index: GLuint, x: GLshort, y: GLshort, z: GLshort){. - stdcall, importc, ogl.} -proc glVertexAttrib3svNV*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4dNV*(index: GLuint, x: GLdouble, y: GLdouble, z: GLdouble, - w: GLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib4dvNV*(index: GLuint, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttrib4fNV*(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, - w: GLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib4fvNV*(index: GLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttrib4sNV*(index: GLuint, x: GLshort, y: GLshort, z: GLshort, - w: GLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4svNV*(index: GLuint, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttrib4ubNV*(index: GLuint, x: GLubyte, y: GLubyte, z: GLubyte, - w: GLubyte){.stdcall, importc, ogl.} -proc glVertexAttrib4ubvNV*(index: GLuint, v: PGLubyte){.stdcall, importc, ogl.} -proc glVertexAttribs1dvNV*(index: GLuint, count: GLsizei, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribs1fvNV*(index: GLuint, count: GLsizei, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttribs1svNV*(index: GLuint, count: GLsizei, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttribs2dvNV*(index: GLuint, count: GLsizei, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribs2fvNV*(index: GLuint, count: GLsizei, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttribs2svNV*(index: GLuint, count: GLsizei, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttribs3dvNV*(index: GLuint, count: GLsizei, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribs3fvNV*(index: GLuint, count: GLsizei, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttribs3svNV*(index: GLuint, count: GLsizei, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttribs4dvNV*(index: GLuint, count: GLsizei, v: PGLdouble){.stdcall, importc, ogl.} -proc glVertexAttribs4fvNV*(index: GLuint, count: GLsizei, v: PGLfloat){.stdcall, importc, ogl.} -proc glVertexAttribs4svNV*(index: GLuint, count: GLsizei, v: PGLshort){.stdcall, importc, ogl.} -proc glVertexAttribs4ubvNV*(index: GLuint, count: GLsizei, v: PGLubyte){.stdcall, importc, ogl.} - # GL_NV_depth_buffer_float -proc glDepthRangedNV*(n: GLdouble, f: GLdouble){.stdcall, importc, ogl.} -proc glClearDepthdNV*(d: GLdouble){.stdcall, importc, ogl.} -proc glDepthBoundsdNV*(zmin: GLdouble, zmax: GLdouble){.stdcall, importc, ogl.} - # GL_NV_framebuffer_multisample_coverage -proc glRenderbufferStorageMultsampleCoverageNV*(target: GLenum, - coverageSamples: GLsizei, colorSamples: GLsizei, internalformat: GLenum, - width: GLsizei, height: GLsizei){.stdcall, importc, ogl.} - # GL_NV_geometry_program4 -proc glProgramVertexLimitNV*(target: GLenum, limit: GLint){.stdcall, importc, ogl.} - # GL_NV_gpu_program4 -proc glProgramLocalParameterI4iNV*(target: GLenum, index: GLuint, x: GLint, - y: GLint, z: GLint, w: GLint){.stdcall, importc, ogl.} -proc glProgramLocalParameterI4ivNV*(target: GLenum, index: GLuint, - params: PGLint){.stdcall, importc, ogl.} -proc glProgramLocalParametersI4ivNV*(target: GLenum, index: GLuint, - count: GLsizei, params: PGLint){.stdcall, importc, ogl.} -proc glProgramLocalParameterI4uiNV*(target: GLenum, index: GLuint, x: GLuint, - y: GLuint, z: GLuint, w: GLuint){.stdcall, importc, ogl.} -proc glProgramLocalParameterI4uivNV*(target: GLenum, index: GLuint, - params: PGLuint){.stdcall, importc, ogl.} -proc glProgramLocalParametersI4uivNV*(target: GLenum, index: GLuint, - count: GLsizei, params: PGLuint){.stdcall, importc, ogl.} -proc glProgramEnvParameterI4iNV*(target: GLenum, index: GLuint, x: GLint, - y: GLint, z: GLint, w: GLint){.stdcall, importc, ogl.} -proc glProgramEnvParameterI4ivNV*(target: GLenum, index: GLuint, params: PGLint){. - stdcall, importc, ogl.} -proc glProgramEnvParametersI4ivNV*(target: GLenum, index: GLuint, - count: GLsizei, params: PGLint){.stdcall, importc, ogl.} -proc glProgramEnvParameterI4uiNV*(target: GLenum, index: GLuint, x: GLuint, - y: GLuint, z: GLuint, w: GLuint){.stdcall, importc, ogl.} -proc glProgramEnvParameterI4uivNV*(target: GLenum, index: GLuint, - params: PGLuint){.stdcall, importc, ogl.} -proc glProgramEnvParametersI4uivNV*(target: GLenum, index: GLuint, - count: GLsizei, params: PGLuint){.stdcall, importc, ogl.} -proc glGetProgramLocalParameterIivNV*(target: GLenum, index: GLuint, - params: PGLint){.stdcall, importc, ogl.} -proc glGetProgramLocalParameterIuivNV*(target: GLenum, index: GLuint, - params: PGLuint){.stdcall, importc, ogl.} -proc glGetProgramEnvParameterIivNV*(target: GLenum, index: GLuint, - params: PGLint){.stdcall, importc, ogl.} -proc glGetProgramEnvParameterIuivNV*(target: GLenum, index: GLuint, - params: PGLuint){.stdcall, importc, ogl.} - # GL_NV_parameter_buffer_object -proc glProgramBufferParametersfvNV*(target: GLenum, buffer: GLuint, - index: GLuint, count: GLsizei, - params: PGLfloat){.stdcall, importc, ogl.} -proc glProgramBufferParametersIivNV*(target: GLenum, buffer: GLuint, - index: GLuint, count: GLsizei, - params: GLint){.stdcall, importc, ogl.} -proc glProgramBufferParametersIuivNV*(target: GLenum, buffer: GLuint, - index: GLuint, count: GLuint, - params: PGLuint){.stdcall, importc, ogl.} - # GL_NV_transform_feedback -proc glBeginTransformFeedbackNV*(primitiveMode: GLenum){.stdcall, importc, ogl.} -proc glEndTransformFeedbackNV*(){.stdcall, importc, ogl.} -proc glTransformFeedbackAttribsNV*(count: GLsizei, attribs: GLint, - bufferMode: GLenum){.stdcall, importc, ogl.} -proc glBindBufferRangeNV*(target: GLenum, index: GLuint, buffer: GLuint, - offset: GLintptr, size: GLsizeiptr){.stdcall, importc, ogl.} -proc glBindBufferOffsetNV*(target: GLenum, index: GLuint, buffer: GLuint, - offset: GLintptr){.stdcall, importc, ogl.} -proc glBindBufferBaseNV*(target: GLenum, index: GLuint, buffer: GLuint){.stdcall, importc, ogl.} -proc glTransformFeedbackVaryingsNV*(prog: GLuint, count: GLsizei, - locations: PGLint, bufferMode: GLenum){. - stdcall, importc, ogl.} -proc glActiveVaryingNV*(prog: GLuint, name: PGLchar){.stdcall, importc, ogl.} -proc glGetVaryingLocationNV*(prog: GLuint, name: PGLchar): GLint{.stdcall, importc, ogl.} -proc glGetActiveVaryingNV*(prog: GLuint, index: GLuint, bufSize: GLsizei, - len: PGLsizei, size: PGLsizei, typ: PGLenum, - name: PGLchar){.stdcall, importc, ogl.} -proc glGetTransformFeedbackVaryingNV*(prog: GLuint, index: GLuint, - location: PGLint){.stdcall, importc, ogl.} -proc glTransformFeedbackStreamAttribsNV*(count: GLsizei, attribs: PGLint, - nbuffers: GLsizei, bufstreams: PGLint, bufferMode: GLenum){.stdcall, importc, ogl.} - # GL_NV_conditional_render -proc glBeginConditionalRenderNV*(id: GLuint, mode: GLenum){.stdcall, importc, ogl.} -proc glEndConditionalRenderNV*(){.stdcall, importc, ogl.} - # GL_NV_present_video -proc glPresentFrameKeyedNV*(video_slot: GLuint, minPresentTime: GLuint64EXT, - beginPresentTimeId: GLuint, - presentDuratioId: GLuint, typ: GLenum, - target0: GLenum, fill0: GLuint, key0: GLuint, - target1: GLenum, fill1: GLuint, key1: GLuint){. - stdcall, importc, ogl.} -proc glPresentFrameDualFillNV*(video_slot: GLuint, minPresentTime: GLuint64EXT, - beginPresentTimeId: GLuint, - presentDurationId: GLuint, typ: GLenum, - target0: GLenum, fill0: GLuint, target1: GLenum, - fill1: GLuint, target2: GLenum, fill2: GLuint, - target3: GLenum, fill3: GLuint){.stdcall, importc, ogl.} -proc glGetVideoivNV*(video_slot: GLuint, pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetVideouivNV*(video_slot: GLuint, pname: GLenum, params: PGLuint){. - stdcall, importc, ogl.} -proc glGetVideoi64vNV*(video_slot: GLuint, pname: GLenum, params: PGLint64EXT){. - stdcall, importc, ogl.} -proc glGetVideoui64vNV*(video_slot: GLuint, pname: GLenum, params: PGLuint64EXT){. - stdcall, importc, ogl.} - #procedure glVideoParameterivNV(video_slot: GLuint; pname: GLenum; const params: PGLint); stdcall, importc, ogl; - # GL_NV_explicit_multisample -proc glGetMultisamplefvNV*(pname: GLenum, index: GLuint, val: PGLfloat){.stdcall, importc, ogl.} -proc glSampleMaskIndexedNV*(index: GLuint, mask: GLbitfield){.stdcall, importc, ogl.} -proc glTexRenderbufferNV*(target: GLenum, renderbuffer: GLuint){.stdcall, importc, ogl.} - # GL_NV_transform_feedback2 -proc glBindTransformFeedbackNV*(target: GLenum, id: GLuint){.stdcall, importc, ogl.} -proc glDeleteTransformFeedbacksNV*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glGenTransformFeedbacksNV*(n: GLsizei, ids: PGLuint){.stdcall, importc, ogl.} -proc glIsTransformFeedbackNV*(id: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glPauseTransformFeedbackNV*(){.stdcall, importc, ogl.} -proc glResumeTransformFeedbackNV*(){.stdcall, importc, ogl.} -proc glDrawTransformFeedbackNV*(mode: GLenum, id: GLuint){.stdcall, importc, ogl.} - # GL_NV_video_capture -proc glBeginVideoCaptureNV*(video_capture_slot: GLuint){.stdcall, importc, ogl.} -proc glBindVideoCaptureStreamBufferNV*(video_capture_slot: GLuint, - stream: GLuint, frame_region: GLenum, - offset: GLintptrARB){.stdcall, importc, ogl.} -proc glBindVideoCaptureStreamTextureNV*(video_capture_slot: GLuint, - stream: GLuint, frame_region: GLenum, - target: GLenum, texture: GLuint){. - stdcall, importc, ogl.} -proc glEndVideoCaptureNV*(video_capture_slot: GLuint){.stdcall, importc, ogl.} -proc glGetVideoCaptureivNV*(video_capture_slot: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glGetVideoCaptureStreamivNV*(video_capture_slot: GLuint, stream: GLuint, - pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetVideoCaptureStreamfvNV*(video_capture_slot: GLuint, stream: GLuint, - pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetVideoCaptureStreamdvNV*(video_capture_slot: GLuint, stream: GLuint, - pname: GLenum, params: PGLdouble){.stdcall, importc, ogl.} -proc glVideoCaptureNV*(video_capture_slot: GLuint, sequence_num: PGLuint, - capture_time: PGLuint64EXT): GLenum{.stdcall, importc, ogl.} -proc glVideoCaptureStreamParameterivNV*(video_capture_slot: GLuint, - stream: GLuint, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} -proc glVideoCaptureStreamParameterfvNV*(video_capture_slot: GLuint, - stream: GLuint, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glVideoCaptureStreamParameterdvNV*(video_capture_slot: GLuint, - stream: GLuint, pname: GLenum, - params: PGLdouble){.stdcall, importc, ogl.} - # GL_NV_copy_image -proc glCopyImageSubDataNV*(srcName: GLuint, srcTarget: GLenum, srcLevel: GLint, - srcX: GLint, srcY: GLint, srcZ: GLint, - dstName: GLuint, dstTarget: GLenum, dstLevel: GLint, - dstX: GLint, dstY: GLint, dstZ: GLint, - width: GLsizei, height: GLsizei, depth: GLsizei){. - stdcall, importc, ogl.} - # GL_NV_shader_buffer_load -proc glMakeBufferResidentNV*(target: GLenum, access: GLenum){.stdcall, importc, ogl.} -proc glMakeBufferNonResidentNV*(target: GLenum){.stdcall, importc, ogl.} -proc glIsBufferResidentNV*(target: GLenum): GLboolean{.stdcall, importc, ogl.} -proc glMakeNamedBufferResidentNV*(buffer: GLuint, access: GLenum){.stdcall, importc, ogl.} -proc glMakeNamedBufferNonResidentNV*(buffer: GLuint){.stdcall, importc, ogl.} -proc glIsNamedBufferResidentNV*(buffer: GLuint): GLboolean{.stdcall, importc, ogl.} -proc glGetBufferParameterui64vNV*(target: GLenum, pname: GLenum, - params: PGLuint64EXT){.stdcall, importc, ogl.} -proc glGetNamedBufferParameterui64vNV*(buffer: GLuint, pname: GLenum, - params: PGLuint64EXT){.stdcall, importc, ogl.} -proc glGetIntegerui64vNV*(value: GLenum, result: PGLuint64EXT){.stdcall, importc, ogl.} -proc glUniformui64NV*(location: GLint, value: GLuint64EXT){.stdcall, importc, ogl.} -proc glUniformui64vNV*(location: GLint, count: GLsizei, value: PGLuint64EXT){. - stdcall, importc, ogl.} -proc glGetUniformui64vNV*(prog: GLuint, location: GLint, params: PGLuint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniformui64NV*(prog: GLuint, location: GLint, value: GLuint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniformui64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint64EXT){.stdcall, importc, ogl.} - # GL_NV_vertex_buffer_unified_memory -proc glBufferAddressRangeNV*(pname: GLenum, index: GLuint, adress: GLuint64EXT, - len: GLsizeiptr){.stdcall, importc, ogl.} -proc glVertexFormatNV*(size: GLint, typ: GLenum, stride: GLsizei){.stdcall, importc, ogl.} -proc glNormalFormatNV*(typ: GLenum, stride: GLsizei){.stdcall, importc, ogl.} -proc glColorFormatNV*(size: GLint, typ: GLenum, stride: GLsizei){.stdcall, importc, ogl.} -proc glIndexFormatNV*(typ: GLenum, stride: GLsizei){.stdcall, importc, ogl.} -proc glTexCoordFormatNV*(size: GLint, typ: GLenum, stride: GLsizei){.stdcall, importc, ogl.} -proc glEdgeFlagFormatNV*(stride: GLsizei){.stdcall, importc, ogl.} -proc glSecondaryColorFormatNV*(size: GLint, typ: GLenum, stride: GLsizei){. - stdcall, importc, ogl.} -proc glFogCoordFormatNV*(typ: GLenum, stride: GLsizei){.stdcall, importc, ogl.} -proc glVertexAttribFormatNV*(index: GLuint, size: GLint, typ: GLenum, - normalized: GLboolean, stride: GLsizei){.stdcall, importc, ogl.} -proc glVertexAttribIFormatNV*(index: GLuint, size: GLint, typ: GLenum, - stride: GLsizei){.stdcall, importc, ogl.} -proc glGetIntegerui64i_vNV*(value: GLenum, index: GLuint, Result: PGLuint64EXT){. - stdcall, importc, ogl.} - # GL_NV_gpu_program5 -proc glProgramSubroutineParametersuivNV*(target: GLenum, count: GLsizei, - params: PGLuint){.stdcall, importc, ogl.} -proc glGetProgramSubroutineParameteruivNV*(target: GLenum, index: GLuint, - param: PGLuint){.stdcall, importc, ogl.} - # GL_NV_gpu_shader5 -proc glUniform1i64NV*(location: GLint, x: GLint64EXT){.stdcall, importc, ogl.} -proc glUniform2i64NV*(location: GLint, x: GLint64EXT, y: GLint64EXT){.stdcall, importc, ogl.} -proc glUniform3i64NV*(location: GLint, x: GLint64EXT, y: GLint64EXT, - z: GLint64EXT){.stdcall, importc, ogl.} -proc glUniform4i64NV*(location: GLint, x: GLint64EXT, y: GLint64EXT, - z: GLint64EXT, w: GLint64EXT){.stdcall, importc, ogl.} -proc glUniform1i64vNV*(location: GLint, count: GLsizei, value: PGLint64EXT){. - stdcall, importc, ogl.} -proc glUniform2i64vNV*(location: GLint, count: GLsizei, value: PGLint64EXT){. - stdcall, importc, ogl.} -proc glUniform3i64vNV*(location: GLint, count: GLsizei, value: PGLint64EXT){. - stdcall, importc, ogl.} -proc glUniform4i64vNV*(location: GLint, count: GLsizei, value: PGLint64EXT){. - stdcall, importc, ogl.} -proc glUniform1ui64NV*(location: GLint, x: GLuint64EXT){.stdcall, importc, ogl.} -proc glUniform2ui64NV*(location: GLint, x: GLuint64EXT, y: GLuint64EXT){.stdcall, importc, ogl.} -proc glUniform3ui64NV*(location: GLint, x: GLuint64EXT, y: GLuint64EXT, - z: GLuint64EXT){.stdcall, importc, ogl.} -proc glUniform4ui64NV*(location: GLint, x: GLuint64EXT, y: GLuint64EXT, - z: GLuint64EXT, w: GLuint64EXT){.stdcall, importc, ogl.} -proc glUniform1ui64vNV*(location: GLint, count: GLsizei, value: PGLuint64EXT){. - stdcall, importc, ogl.} -proc glUniform2ui64vNV*(location: GLint, count: GLsizei, value: PGLuint64EXT){. - stdcall, importc, ogl.} -proc glUniform3ui64vNV*(location: GLint, count: GLsizei, value: PGLuint64EXT){. - stdcall, importc, ogl.} -proc glUniform4ui64vNV*(location: GLint, count: GLsizei, value: PGLuint64EXT){. - stdcall, importc, ogl.} -proc glGetUniformi64vNV*(prog: GLuint, location: GLint, params: PGLint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniform1i64NV*(prog: GLuint, location: GLint, x: GLint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniform2i64NV*(prog: GLuint, location: GLint, x: GLint64EXT, - y: GLint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform3i64NV*(prog: GLuint, location: GLint, x: GLint64EXT, - y: GLint64EXT, z: GLint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform4i64NV*(prog: GLuint, location: GLint, x: GLint64EXT, - y: GLint64EXT, z: GLint64EXT, w: GLint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniform1i64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform2i64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform3i64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform4i64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform1ui64NV*(prog: GLuint, location: GLint, x: GLuint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniform2ui64NV*(prog: GLuint, location: GLint, x: GLuint64EXT, - y: GLuint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform3ui64NV*(prog: GLuint, location: GLint, x: GLuint64EXT, - y: GLuint64EXT, z: GLuint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform4ui64NV*(prog: GLuint, location: GLint, x: GLuint64EXT, - y: GLuint64EXT, z: GLuint64EXT, w: GLuint64EXT){. - stdcall, importc, ogl.} -proc glProgramUniform1ui64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform2ui64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform3ui64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint64EXT){.stdcall, importc, ogl.} -proc glProgramUniform4ui64vNV*(prog: GLuint, location: GLint, count: GLsizei, - value: PGLuint64EXT){.stdcall, importc, ogl.} - # GL_NV_vertex_attrib_integer_64bit -proc glVertexAttribL1i64NV*(index: GLuint, x: GLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL2i64NV*(index: GLuint, x: GLint64EXT, y: GLint64EXT){. - stdcall, importc, ogl.} -proc glVertexAttribL3i64NV*(index: GLuint, x: GLint64EXT, y: GLint64EXT, - z: GLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL4i64NV*(index: GLuint, x: GLint64EXT, y: GLint64EXT, - z: GLint64EXT, w: GLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL1i64vNV*(index: GLuint, v: PGLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL2i64vNV*(index: GLuint, v: PGLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL3i64vNV*(index: GLuint, v: PGLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL4i64vNV*(index: GLuint, v: PGLint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL1ui64NV*(index: GLuint, x: GLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL2ui64NV*(index: GLuint, x: GLuint64EXT, y: GLuint64EXT){. - stdcall, importc, ogl.} -proc glVertexAttribL3ui64NV*(index: GLuint, x: GLuint64EXT, y: GLuint64EXT, - z: GLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL4ui64NV*(index: GLuint, x: GLuint64EXT, y: GLuint64EXT, - z: GLuint64EXT, w: GLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL1ui64vNV*(index: GLuint, v: PGLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL2ui64vNV*(index: GLuint, v: PGLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL3ui64vNV*(index: GLuint, v: PGLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribL4ui64vNV*(index: GLuint, v: PGLuint64EXT){.stdcall, importc, ogl.} -proc glGetVertexAttribLi64vNV*(index: GLuint, pname: GLenum, params: PGLint64EXT){. - stdcall, importc, ogl.} -proc glGetVertexAttribLui64vNV*(index: GLuint, pname: GLenum, - params: PGLuint64EXT){.stdcall, importc, ogl.} -proc glVertexAttribLFormatNV*(index: GLuint, size: GLint, typ: GLenum, - stride: GLsizei){.stdcall, importc, ogl.} - # GL_NV_vdpau_interop -proc glVDPAUInitNV*(vdpDevice: PGLvoid, getProcAddress: PGLvoid){.stdcall, importc, ogl.} -proc glVDPAUFiniNV*(){.stdcall, importc, ogl.} -proc glVDPAURegisterVideoSurfaceNV*(vdpSurface: PGLvoid, target: GLenum, - numTextureNames: GLsizei, - textureNames: PGLuint): GLvdpauSurfaceNV{. - stdcall, importc, ogl.} -proc glVDPAURegisterOutputSurfaceNV*(vdpSurface: PGLvoid, target: GLenum, - numTextureNames: GLsizei, - textureNames: PGLuint): GLvdpauSurfaceNV{. - stdcall, importc, ogl.} -proc glVDPAUIsSurfaceNV*(surface: GLvdpauSurfaceNV){.stdcall, importc, ogl.} -proc glVDPAUUnregisterSurfaceNV*(surface: GLvdpauSurfaceNV){.stdcall, importc, ogl.} -proc glVDPAUGetSurfaceivNV*(surface: GLvdpauSurfaceNV, pname: GLenum, - bufSize: GLsizei, len: PGLsizei, values: PGLint){. - stdcall, importc, ogl.} -proc glVDPAUSurfaceAccessNV*(surface: GLvdpauSurfaceNV, access: GLenum){.stdcall, importc, ogl.} -proc glVDPAUMapSurfacesNV*(numSurfaces: GLsizei, surfaces: PGLvdpauSurfaceNV){. - stdcall, importc, ogl.} -proc glVDPAUUnmapSurfacesNV*(numSurface: GLsizei, surfaces: PGLvdpauSurfaceNV){. - stdcall, importc, ogl.} - # GL_NV_texture_barrier -proc glTextureBarrierNV*(){.stdcall, importc, ogl.} - # GL_PGI_misc_hints -proc glHintPGI*(target: GLenum, mode: GLint){.stdcall, importc, ogl.} - # GL_SGIS_detail_texture -proc glDetailTexFuncSGIS*(target: GLenum, n: GLsizei, points: PGLfloat){.stdcall, importc, ogl.} -proc glGetDetailTexFuncSGIS*(target: GLenum, points: PGLfloat){.stdcall, importc, ogl.} - # GL_SGIS_fog_function -proc glFogFuncSGIS*(n: GLsizei, points: PGLfloat){.stdcall, importc, ogl.} -proc glGetFogFuncSGIS*(points: PGLfloat){.stdcall, importc, ogl.} - # GL_SGIS_multisample -proc glSampleMaskSGIS*(value: GLclampf, invert: GLboolean){.stdcall, importc, ogl.} -proc glSamplePatternSGIS*(pattern: GLenum){.stdcall, importc, ogl.} - # GL_SGIS_pixel_texture -proc glPixelTexGenParameteriSGIS*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glPixelTexGenParameterivSGIS*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glPixelTexGenParameterfSGIS*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPixelTexGenParameterfvSGIS*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glGetPixelTexGenParameterivSGIS*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glGetPixelTexGenParameterfvSGIS*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} - # GL_SGIS_point_parameters -proc glPointParameterfSGIS*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glPointParameterfvSGIS*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} - # GL_SGIS_sharpen_texture -proc glSharpenTexFuncSGIS*(target: GLenum, n: GLsizei, points: PGLfloat){. - stdcall, importc, ogl.} -proc glGetSharpenTexFuncSGIS*(target: GLenum, points: PGLfloat){.stdcall, importc, ogl.} - # GL_SGIS_texture4D -proc glTexImage4DSGIS*(target: GLenum, level: GLint, internalformat: GLenum, - width: GLsizei, height: GLsizei, depth: GLsizei, - size4d: GLsizei, border: GLint, format: GLenum, - typ: GLenum, pixels: PGLvoid){.stdcall, importc, ogl.} -proc glTexSubImage4DSGIS*(target: GLenum, level: GLint, xoffset: GLint, - yoffset: GLint, zoffset: GLint, woffset: GLint, - width: GLsizei, height: GLsizei, depth: GLsizei, - size4d: GLsizei, format: GLenum, typ: GLenum, - pixels: PGLvoid){.stdcall, importc, ogl.} - # GL_SGIS_texture_color_mask -proc glTextureColorMaskSGIS*(red: GLboolean, green: GLboolean, blue: GLboolean, - alpha: GLboolean){.stdcall, importc, ogl.} - # GL_SGIS_texture_filter4 -proc glGetTexFilterFuncSGIS*(target: GLenum, filter: GLenum, weights: PGLfloat){. - stdcall, importc, ogl.} -proc glTexFilterFuncSGIS*(target: GLenum, filter: GLenum, n: GLsizei, - weights: PGLfloat){.stdcall, importc, ogl.} - # GL_SGIX_async -proc glAsyncMarkerSGIX*(marker: GLuint){.stdcall, importc, ogl.} -proc glFinishAsyncSGIX*(markerp: PGLuint): GLint{.stdcall, importc, ogl.} -proc glPollAsyncSGIX*(markerp: PGLuint): GLint{.stdcall, importc, ogl.} -proc glGenAsyncMarkersSGIX*(range: GLsizei): GLuint{.stdcall, importc, ogl.} -proc glDeleteAsyncMarkersSGIX*(marker: GLuint, range: GLsizei){.stdcall, importc, ogl.} -proc glIsAsyncMarkerSGIX*(marker: GLuint): GLboolean{.stdcall, importc, ogl.} - # GL_SGIX_flush_raster -proc glFlushRasterSGIX*(){.stdcall, importc, ogl.} - # GL_SGIX_fragment_lighting -proc glFragmentColorMaterialSGIX*(face: GLenum, mode: GLenum){.stdcall, importc, ogl.} -proc glFragmentLightfSGIX*(light: GLenum, pname: GLenum, param: GLfloat){. - stdcall, importc, ogl.} -proc glFragmentLightfvSGIX*(light: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glFragmentLightiSGIX*(light: GLenum, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glFragmentLightivSGIX*(light: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glFragmentLightModelfSGIX*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glFragmentLightModelfvSGIX*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glFragmentLightModeliSGIX*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glFragmentLightModelivSGIX*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} -proc glFragmentMaterialfSGIX*(face: GLenum, pname: GLenum, param: GLfloat){. - stdcall, importc, ogl.} -proc glFragmentMaterialfvSGIX*(face: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glFragmentMaterialiSGIX*(face: GLenum, pname: GLenum, param: GLint){. - stdcall, importc, ogl.} -proc glFragmentMaterialivSGIX*(face: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetFragmentLightfvSGIX*(light: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetFragmentLightivSGIX*(light: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glGetFragmentMaterialfvSGIX*(face: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetFragmentMaterialivSGIX*(face: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glLightEnviSGIX*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} - # GL_SGIX_framezoom -proc glFrameZoomSGIX*(factor: GLint){.stdcall, importc, ogl.} - # GL_SGIX_igloo_interface -proc glIglooInterfaceSGIX*(pname: GLenum, params: PGLvoid){.stdcall, importc, ogl.} - # GL_SGIX_instruments -proc glGetInstrumentsSGIX*(): GLint{.stdcall, importc, ogl.} -proc glInstrumentsBufferSGIX*(size: GLsizei, buffer: PGLint){.stdcall, importc, ogl.} -proc glPollInstrumentsSGIX*(marker_p: PGLint): GLint{.stdcall, importc, ogl.} -proc glReadInstrumentsSGIX*(marker: GLint){.stdcall, importc, ogl.} -proc glStartInstrumentsSGIX*(){.stdcall, importc, ogl.} -proc glStopInstrumentsSGIX*(marker: GLint){.stdcall, importc, ogl.} - # GL_SGIX_list_priority -proc glGetListParameterfvSGIX*(list: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glGetListParameterivSGIX*(list: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glListParameterfSGIX*(list: GLuint, pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glListParameterfvSGIX*(list: GLuint, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glListParameteriSGIX*(list: GLuint, pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glListParameterivSGIX*(list: GLuint, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} - # GL_SGIX_pixel_texture -proc glPixelTexGenSGIX*(mode: GLenum){.stdcall, importc, ogl.} - # GL_SGIX_polynomial_ffd -proc glDeformationMap3dSGIX*(target: GLenum, u1: GLdouble, u2: GLdouble, - ustride: GLint, uorder: GLint, v1: GLdouble, - v2: GLdouble, vstride: GLint, vorder: GLint, - w1: GLdouble, w2: GLdouble, wstride: GLint, - worder: GLint, points: PGLdouble){.stdcall, importc, ogl.} -proc glDeformationMap3fSGIX*(target: GLenum, u1: GLfloat, u2: GLfloat, - ustride: GLint, uorder: GLint, v1: GLfloat, - v2: GLfloat, vstride: GLint, vorder: GLint, - w1: GLfloat, w2: GLfloat, wstride: GLint, - worder: GLint, points: PGLfloat){.stdcall, importc, ogl.} -proc glDeformSGIX*(mask: GLbitfield){.stdcall, importc, ogl.} -proc glLoadIdentityDeformationMapSGIX*(mask: GLbitfield){.stdcall, importc, ogl.} - # GL_SGIX_reference_plane -proc glReferencePlaneSGIX*(equation: PGLdouble){.stdcall, importc, ogl.} - # GL_SGIX_sprite -proc glSpriteParameterfSGIX*(pname: GLenum, param: GLfloat){.stdcall, importc, ogl.} -proc glSpriteParameterfvSGIX*(pname: GLenum, params: PGLfloat){.stdcall, importc, ogl.} -proc glSpriteParameteriSGIX*(pname: GLenum, param: GLint){.stdcall, importc, ogl.} -proc glSpriteParameterivSGIX*(pname: GLenum, params: PGLint){.stdcall, importc, ogl.} - # GL_SGIX_tag_sample_buffer -proc glTagSampleBufferSGIX*(){.stdcall, importc, ogl.} - # GL_SGI_color_table -proc glColorTableSGI*(target: GLenum, internalformat: GLenum, width: GLsizei, - format: GLenum, typ: GLenum, table: PGLvoid){.stdcall, importc, ogl.} -proc glColorTableParameterfvSGI*(target: GLenum, pname: GLenum, params: PGLfloat){. - stdcall, importc, ogl.} -proc glColorTableParameterivSGI*(target: GLenum, pname: GLenum, params: PGLint){. - stdcall, importc, ogl.} -proc glCopyColorTableSGI*(target: GLenum, internalformat: GLenum, x: GLint, - y: GLint, width: GLsizei){.stdcall, importc, ogl.} -proc glGetColorTableSGI*(target: GLenum, format: GLenum, typ: GLenum, - table: PGLvoid){.stdcall, importc, ogl.} -proc glGetColorTableParameterfvSGI*(target: GLenum, pname: GLenum, - params: PGLfloat){.stdcall, importc, ogl.} -proc glGetColorTableParameterivSGI*(target: GLenum, pname: GLenum, - params: PGLint){.stdcall, importc, ogl.} - # GL_SUNX_constant_data -proc glFinishTextureSUNX*(){.stdcall, importc, ogl.} - # GL_SUN_global_alpha -proc glGlobalAlphaFactorbSUN*(factor: GLbyte){.stdcall, importc, ogl.} -proc glGlobalAlphaFactorsSUN*(factor: GLshort){.stdcall, importc, ogl.} -proc glGlobalAlphaFactoriSUN*(factor: GLint){.stdcall, importc, ogl.} -proc glGlobalAlphaFactorfSUN*(factor: GLfloat){.stdcall, importc, ogl.} -proc glGlobalAlphaFactordSUN*(factor: GLdouble){.stdcall, importc, ogl.} -proc glGlobalAlphaFactorubSUN*(factor: GLubyte){.stdcall, importc, ogl.} -proc glGlobalAlphaFactorusSUN*(factor: GLushort){.stdcall, importc, ogl.} -proc glGlobalAlphaFactoruiSUN*(factor: GLuint){.stdcall, importc, ogl.} - # GL_SUN_mesh_array -proc glDrawMeshArraysSUN*(mode: GLenum, first: GLint, count: GLsizei, - width: GLsizei){.stdcall, importc, ogl.} - # GL_SUN_triangle_list -proc glReplacementCodeuiSUN*(code: GLuint){.stdcall, importc, ogl.} -proc glReplacementCodeusSUN*(code: GLushort){.stdcall, importc, ogl.} -proc glReplacementCodeubSUN*(code: GLubyte){.stdcall, importc, ogl.} -proc glReplacementCodeuivSUN*(code: PGLuint){.stdcall, importc, ogl.} -proc glReplacementCodeusvSUN*(code: PGLushort){.stdcall, importc, ogl.} -proc glReplacementCodeubvSUN*(code: PGLubyte){.stdcall, importc, ogl.} -proc glReplacementCodePointerSUN*(typ: GLenum, stride: GLsizei, pointer: PGLvoid){. - stdcall, importc, ogl.} - # GL_SUN_vertex -proc glColor4ubVertex2fSUN*(r: GLubyte, g: GLubyte, b: GLubyte, a: GLubyte, - x: GLfloat, y: GLfloat){.stdcall, importc, ogl.} -proc glColor4ubVertex2fvSUN*(c: PGLubyte, v: PGLfloat){.stdcall, importc, ogl.} -proc glColor4ubVertex3fSUN*(r: GLubyte, g: GLubyte, b: GLubyte, a: GLubyte, - x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glColor4ubVertex3fvSUN*(c: PGLubyte, v: PGLfloat){.stdcall, importc, ogl.} -proc glColor3fVertex3fSUN*(r: GLfloat, g: GLfloat, b: GLfloat, x: GLfloat, - y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glColor3fVertex3fvSUN*(c: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc glNormal3fVertex3fSUN*(nx: GLfloat, ny: GLfloat, nz: GLfloat, x: GLfloat, - y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glNormal3fVertex3fvSUN*(n: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc glColor4fNormal3fVertex3fSUN*(r: GLfloat, g: GLfloat, b: GLfloat, - a: GLfloat, nx: GLfloat, ny: GLfloat, - nz: GLfloat, x: GLfloat, y: GLfloat, - z: GLfloat){.stdcall, importc, ogl.} -proc glColor4fNormal3fVertex3fvSUN*(c: PGLfloat, n: PGLfloat, v: PGLfloat){. - stdcall, importc, ogl.} -proc glTexCoord2fVertex3fSUN*(s: GLfloat, t: GLfloat, x: GLfloat, y: GLfloat, - z: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord2fVertex3fvSUN*(tc: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc glTexCoord4fVertex4fSUN*(s: GLfloat, t: GLfloat, p: GLfloat, q: GLfloat, - x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat){. - stdcall, importc, ogl.} -proc glTexCoord4fVertex4fvSUN*(tc: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc glTexCoord2fColor4ubVertex3fSUN*(s: GLfloat, t: GLfloat, r: GLubyte, - g: GLubyte, b: GLubyte, a: GLubyte, - x: GLfloat, y: GLfloat, z: GLfloat){. - stdcall, importc, ogl.} -proc glTexCoord2fColor4ubVertex3fvSUN*(tc: PGLfloat, c: PGLubyte, v: PGLfloat){. - stdcall, importc, ogl.} -proc glTexCoord2fColor3fVertex3fSUN*(s: GLfloat, t: GLfloat, r: GLfloat, - g: GLfloat, b: GLfloat, x: GLfloat, - y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord2fColor3fVertex3fvSUN*(tc: PGLfloat, c: PGLfloat, v: PGLfloat){. - stdcall, importc, ogl.} -proc glTexCoord2fNormal3fVertex3fSUN*(s: GLfloat, t: GLfloat, nx: GLfloat, - ny: GLfloat, nz: GLfloat, x: GLfloat, - y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glTexCoord2fNormal3fVertex3fvSUN*(tc: PGLfloat, n: PGLfloat, v: PGLfloat){. - stdcall, importc, ogl.} -proc 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){.stdcall, importc, ogl.} -proc glTexCoord2fColor4fNormal3fVertex3fvSUN*(tc: PGLfloat, c: PGLfloat, - n: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc 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){. - stdcall, importc, ogl.} -proc glTexCoord4fColor4fNormal3fVertex4fvSUN*(tc: PGLfloat, c: PGLfloat, - n: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiVertex3fSUN*(rc: GLuint, x: GLfloat, y: GLfloat, - z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiVertex3fvSUN*(rc: PGLuint, v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiColor4ubVertex3fSUN*(rc: GLuint, r: GLubyte, g: GLubyte, - b: GLubyte, a: GLubyte, x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiColor4ubVertex3fvSUN*(rc: PGLuint, c: PGLubyte, - v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiColor3fVertex3fSUN*(rc: GLuint, r: GLfloat, g: GLfloat, - b: GLfloat, x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiColor3fVertex3fvSUN*(rc: PGLuint, c: PGLfloat, - v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiNormal3fVertex3fSUN*(rc: GLuint, nx: GLfloat, - ny: GLfloat, nz: GLfloat, x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiNormal3fVertex3fvSUN*(rc: PGLuint, n: PGLfloat, - v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiColor4fNormal3fVertex3fSUN*(rc: GLuint, r: GLfloat, - g: GLfloat, b: GLfloat, a: GLfloat, nx: GLfloat, ny: GLfloat, nz: GLfloat, - x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiColor4fNormal3fVertex3fvSUN*(rc: PGLuint, c: PGLfloat, - n: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiTexCoord2fVertex3fSUN*(rc: GLuint, s: GLfloat, - t: GLfloat, x: GLfloat, y: GLfloat, z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiTexCoord2fVertex3fvSUN*(rc: PGLuint, tc: PGLfloat, - v: PGLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN*(rc: GLuint, s: GLfloat, - t: GLfloat, nx: GLfloat, ny: GLfloat, nz: GLfloat, x: GLfloat, y: GLfloat, - z: GLfloat){.stdcall, importc, ogl.} -proc glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN*(rc: PGLuint, - tc: PGLfloat, n: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} -proc 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){. - stdcall, importc, ogl.} -proc glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN*(rc: PGLuint, - tc: PGLfloat, c: PGLfloat, n: PGLfloat, v: PGLfloat){.stdcall, importc, ogl.} - # window support functions -when defined(windows): - when not defined(wglGetProcAddress): - proc wglGetProcAddress*(ProcName: cstring): Pointer{.stdcall, importc, wgl.} - proc wglCopyContext*(p1: HGLRC, p2: HGLRC, p3: int): BOOL{.stdcall, importc, wgl.} - proc wglCreateContext*(DC: HDC): HGLRC{.stdcall, importc, wgl.} - proc wglCreateLayerContext*(p1: HDC, p2: int): HGLRC{.stdcall, importc, wgl.} - proc wglDeleteContext*(p1: HGLRC): BOOL{.stdcall, importc, wgl.} - proc wglDescribeLayerPlane*(p1: HDC, p2, p3: int, p4: int, - LayerPlaneDescriptor: pointer): BOOL{.stdcall, importc, wgl.} - proc wglGetCurrentContext*(): HGLRC{.stdcall, importc, wgl.} - proc wglGetCurrentDC*(): HDC{.stdcall, importc, wgl.} - proc wglGetLayerPaletteEntries*(p1: HDC, p2, p3, p4: int, pcr: pointer): int{. - stdcall, importc, wgl.} - proc wglMakeCurrent*(DC: HDC, p2: HGLRC): BOOL{.stdcall, importc, wgl.} - proc wglRealizeLayerPalette*(p1: HDC, p2: int, p3: BOOL): BOOL{.stdcall, importc, wgl.} - proc wglSetLayerPaletteEntries*(p1: HDC, p2, p3, p4: int, pcr: pointer): int{. - stdcall, importc, wgl.} - proc wglShareLists*(p1, p2: HGLRC): BOOL{.stdcall, importc, wgl.} - proc wglSwapLayerBuffers*(p1: HDC, p2: int): BOOL{.stdcall, importc, wgl.} - proc wglSwapMultipleBuffers*(p1: int32, p2: PWGLSWAP): int32{.stdcall, importc, wgl.} - proc wglUseFontBitmapsA*(DC: HDC, p2, p3, p4: int32): BOOL{.stdcall, importc, wgl.} - proc wglUseFontBitmapsW*(DC: HDC, p2, p3, p4: int32): BOOL{.stdcall, importc, wgl.} - proc wglUseFontBitmaps*(DC: HDC, p2, p3, p4: int32): BOOL{.stdcall, importc, wgl.} - proc wglUseFontOutlinesA*(p1: HDC, p2, p3, p4: int32, p5, p6: float32, - p7: int, GlyphMetricsFloat: pointer): BOOL{.stdcall, importc, wgl.} - proc wglUseFontOutlinesW*(p1: HDC, p2, p3, p4: int32, p5, p6: float32, - p7: int, GlyphMetricsFloat: pointer): BOOL{.stdcall, importc, wgl.} - proc wglUseFontOutlines*(p1: HDC, p2, p3, p4: int32, p5, p6: float32, p7: int, - GlyphMetricsFloat: pointer): BOOL{.stdcall, importc, wgl.} - # WGL_ARB_buffer_region - proc wglCreateBufferRegionARB*(hDC: HDC, iLayerPlane: GLint, uType: GLuint): THandle{. - stdcall, importc, wgl.} - proc wglDeleteBufferRegionARB*(hRegion: THandle){.stdcall, importc, wgl.} - proc wglSaveBufferRegionARB*(hRegion: THandle, x: GLint, y: GLint, - width: GLint, height: GLint): bool{.stdcall, importc, wgl.} - proc wglRestoreBufferRegionARB*(hRegion: THandle, x: GLint, y: GLint, - width: GLint, height: GLint, xSrc: GLint, - ySrc: GLint): bool{.stdcall, importc, wgl.} - # WGL_ARB_extensions_string - proc wglGetExtensionsStringARB*(hdc: HDC): cstring{.stdcall, importc, wgl.} - # WGL_ARB_make_current_read - proc wglMakeContextCurrentARB*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): bool{. - stdcall, importc, wgl.} - proc wglGetCurrentReadDCARB*(): HDC{.stdcall, importc, wgl.} - # WGL_ARB_pbuffer - proc wglCreatePbufferARB*(hDC: HDC, iPixelFormat: GLint, iWidth: GLint, - iHeight: GLint, piAttribList: PGLint): HPBUFFERARB{. - stdcall, importc, wgl.} - proc wglGetPbufferDCARB*(hPbuffer: HPBUFFERARB): HDC{.stdcall, importc, wgl.} - proc wglReleasePbufferDCARB*(hPbuffer: HPBUFFERARB, hDC: HDC): GLint{.stdcall, importc, wgl.} - proc wglDestroyPbufferARB*(hPbuffer: HPBUFFERARB): bool{.stdcall, importc, wgl.} - proc wglQueryPbufferARB*(hPbuffer: HPBUFFERARB, iAttribute: GLint, - piValue: PGLint): bool{.stdcall, importc, wgl.} - # WGL_ARB_pixel_format - proc wglGetPixelFormatAttribivARB*(hdc: HDC, iPixelFormat: GLint, - iLayerPlane: GLint, nAttributes: GLuint, - piAttributes: PGLint, piValues: PGLint): bool{. - stdcall, importc, wgl.} - proc wglGetPixelFormatAttribfvARB*(hdc: HDC, iPixelFormat: GLint, - iLayerPlane: GLint, nAttributes: GLuint, - piAttributes: PGLint, pfValues: PGLfloat): bool{. - stdcall, importc, wgl.} - proc wglChoosePixelFormatARB*(hdc: HDC, piAttribIList: PGLint, - pfAttribFList: PGLfloat, nMaxFormats: GLuint, - piFormats: PGLint, nNumFormats: PGLuint): BOOL{. - stdcall, importc, wgl.} - # WGL_ARB_color_buffer_float - proc wglClampColorARB*(target: GLenum, clamp: GLenum){.stdcall, importc, wgl.} - # WGL_ARB_render_texture - proc wglBindTexImageARB*(hPbuffer: HPBUFFERARB, iBuffer: GLint): bool{.stdcall, importc, wgl.} - proc wglReleaseTexImageARB*(hPbuffer: HPBUFFERARB, iBuffer: GLint): bool{. - stdcall, importc, wgl.} - proc wglSetPbufferAttribARB*(hPbuffer: HPBUFFERARB, piAttribList: PGLint): bool{. - stdcall, importc, wgl.} - # WGL_ARB_create_context - proc wglCreateContextAttribsARB*(hDC: HDC, hShareContext: HGLRC, - attribList: PGLint): HGLRC{.stdcall, importc, wgl.} - # WGL_AMD_gpu_association - proc wglGetGPUIDsAMD*(maxCount: int, ids: ptr int): int{.stdcall, importc, wgl.} - proc wglGetGPUInfoAMD*(id: int, prop: int, dataType: GLenum, size: int, - data: Pointer): int{.stdcall, importc, wgl.} - proc wglGetContextGPUIDAMD*(hglrc: HGLRC): int{.stdcall, importc, wgl.} - proc wglCreateAssociatedContextAMD*(id: int): HGLRC{.stdcall, importc, wgl.} - proc wglCreateAssociatedContextAttribsAMD*(id: int, hShareContext: HGLRC, - attribList: ptr int32): HGLRC{.stdcall, importc, wgl.} - proc wglDeleteAssociatedContextAMD*(hglrc: HGLRC): bool{.stdcall, importc, wgl.} - proc wglMakeAssociatedContextCurrentAMD*(hglrc: HGLRC): bool{.stdcall, importc, wgl.} - proc wglGetCurrentAssociatedContextAMD*(): HGLRC{.stdcall, importc, wgl.} - proc wglBlitContextFramebufferAMD*(dstCtx: HGLRC, srcX0: GLint, srcY0: GLint, - srcX1: GLint, srcY1: GLint, dstX0: GLint, - dstY0: GLint, dstX1: GLint, dstY1: GLint, - mask: GLbitfield, filter: GLenum){.stdcall, importc, wgl.} - # WGL_EXT_display_color_table - proc wglCreateDisplayColorTableEXT*(id: GLushort): GLboolean{.stdcall, importc, wgl.} - proc wglLoadDisplayColorTableEXT*(table: PGLushort, len: GLuint): GLboolean{. - stdcall, importc, wgl.} - proc wglBindDisplayColorTableEXT*(id: GLushort): GLboolean{.stdcall, importc, wgl.} - proc wglDestroyDisplayColorTableEXT*(id: GLushort){.stdcall, importc, wgl.} - # WGL_EXT_extensions_string - proc wglGetExtensionsStringEXT*(): cstring{.stdcall, importc, wgl.} - # WGL_EXT_make_current_read - proc wglMakeContextCurrentEXT*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): bool{. - stdcall, importc, wgl.} - proc wglGetCurrentReadDCEXT*(): HDC{.stdcall, importc, wgl.} - # WGL_EXT_pbuffer - proc wglCreatePbufferEXT*(hDC: HDC, iPixelFormat: GLint, iWidth: GLint, - iHeight: GLint, piAttribList: PGLint): HPBUFFEREXT{. - stdcall, importc, wgl.} - proc wglGetPbufferDCEXT*(hPbuffer: HPBUFFEREXT): HDC{.stdcall, importc, wgl.} - proc wglReleasePbufferDCEXT*(hPbuffer: HPBUFFEREXT, hDC: HDC): GLint{.stdcall, importc, wgl.} - proc wglDestroyPbufferEXT*(hPbuffer: HPBUFFEREXT): bool{.stdcall, importc, wgl.} - proc wglQueryPbufferEXT*(hPbuffer: HPBUFFEREXT, iAttribute: GLint, - piValue: PGLint): bool{.stdcall, importc, wgl.} - # WGL_EXT_pixel_format - proc wglGetPixelFormatAttribivEXT*(hdc: HDC, iPixelFormat: GLint, - iLayerPlane: GLint, nAttributes: GLuint, - piAttributes: PGLint, piValues: PGLint): bool{. - stdcall, importc, wgl.} - proc wglGetPixelFormatAttribfvEXT*(hdc: HDC, iPixelFormat: GLint, - iLayerPlane: GLint, nAttributes: GLuint, - piAttributes: PGLint, pfValues: PGLfloat): bool{. - stdcall, importc, wgl.} - proc wglChoosePixelFormatEXT*(hdc: HDC, piAttribIList: PGLint, - pfAttribFList: PGLfloat, nMaxFormats: GLuint, - piFormats: PGLint, nNumFormats: PGLuint): bool{. - stdcall, importc, wgl.} - # WGL_EXT_swap_control - proc wglSwapIntervalEXT*(interval: GLint): bool{.stdcall, importc, wgl.} - proc wglGetSwapIntervalEXT*(): GLint{.stdcall, importc, wgl.} - # WGL_I3D_digital_video_control - proc wglGetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: GLint, - piValue: PGLint): bool{.stdcall, importc, wgl.} - proc wglSetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: GLint, - piValue: PGLint): bool{.stdcall, importc, wgl.} - # WGL_I3D_gamma - proc wglGetGammaTableParametersI3D*(hDC: HDC, iAttribute: GLint, - piValue: PGLint): bool{.stdcall, importc, wgl.} - proc wglSetGammaTableParametersI3D*(hDC: HDC, iAttribute: GLint, - piValue: PGLint): bool{.stdcall, importc, wgl.} - proc wglGetGammaTableI3D*(hDC: HDC, iEntries: GLint, puRed: PGLushort, - puGreen: PGLushort, puBlue: PGLushort): bool{. - stdcall, importc, wgl.} - proc wglSetGammaTableI3D*(hDC: HDC, iEntries: GLint, puRed: PGLushort, - puGreen: PGLushort, puBlue: PGLushort): bool{. - stdcall, importc, wgl.} - # WGL_I3D_genlock - proc wglEnableGenlockI3D*(hDC: HDC): bool{.stdcall, importc, wgl.} - proc wglDisableGenlockI3D*(hDC: HDC): bool{.stdcall, importc, wgl.} - proc wglIsEnabledGenlockI3D*(hDC: HDC, pFlag: bool): bool{.stdcall, importc, wgl.} - proc wglGenlockSourceI3D*(hDC: HDC, uSource: GLuint): bool{.stdcall, importc, wgl.} - proc wglGetGenlockSourceI3D*(hDC: HDC, uSource: PGLuint): bool{.stdcall, importc, wgl.} - proc wglGenlockSourceEdgeI3D*(hDC: HDC, uEdge: GLuint): bool{.stdcall, importc, wgl.} - proc wglGetGenlockSourceEdgeI3D*(hDC: HDC, uEdge: PGLuint): bool{.stdcall, importc, wgl.} - proc wglGenlockSampleRateI3D*(hDC: HDC, uRate: GLuint): bool{.stdcall, importc, wgl.} - proc wglGetGenlockSampleRateI3D*(hDC: HDC, uRate: PGLuint): bool{.stdcall, importc, wgl.} - proc wglGenlockSourceDelayI3D*(hDC: HDC, uDelay: GLuint): bool{.stdcall, importc, wgl.} - proc wglGetGenlockSourceDelayI3D*(hDC: HDC, uDelay: PGLuint): bool{.stdcall, importc, wgl.} - proc wglQueryGenlockMaxSourceDelayI3D*(hDC: HDC, uMaxLineDelay: PGLuint, - uMaxPixelDelay: PGLuint): bool{.stdcall, importc, wgl.} - # WGL_I3D_image_buffer - proc wglCreateImageBufferI3D*(hDC: HDC, dwSize: GLuint, uFlags: GLuint): GLvoid{. - stdcall, importc, wgl.} - proc wglDestroyImageBufferI3D*(hDC: HDC, pAddress: GLvoid): bool{.stdcall, importc, wgl.} - proc wglAssociateImageBufferEventsI3D*(hDC: HDC, pEvent: THandle, - pAddress: PGLvoid, pSize: PGLuint, count: GLuint): bool{.stdcall, importc, wgl.} - proc wglReleaseImageBufferEventsI3D*(hDC: HDC, pAddress: PGLvoid, - count: GLuint): bool{.stdcall, importc, wgl.} - # WGL_I3D_swap_frame_lock - proc wglEnableFrameLockI3D*(): bool{.stdcall, importc, wgl.} - proc wglDisableFrameLockI3D*(): bool{.stdcall, importc, wgl.} - proc wglIsEnabledFrameLockI3D*(pFlag: bool): bool{.stdcall, importc, wgl.} - proc wglQueryFrameLockMasterI3D*(pFlag: bool): bool{.stdcall, importc, wgl.} - # WGL_I3D_swap_frame_usage - proc wglGetFrameUsageI3D*(pUsage: PGLfloat): bool{.stdcall, importc, wgl.} - proc wglBeginFrameTrackingI3D*(): bool{.stdcall, importc, wgl.} - proc wglEndFrameTrackingI3D*(): bool{.stdcall, importc, wgl.} - proc wglQueryFrameTrackingI3D*(pFrameCount: PGLuint, pMissedFrames: PGLuint, - pLastMissedUsage: PGLfloat): bool{.stdcall, importc, wgl.} - # WGL_NV_vertex_array_range - proc wglAllocateMemoryNV*(size: GLsizei, readfreq: GLfloat, - writefreq: GLfloat, priority: GLfloat){.stdcall, importc, wgl.} - proc wglFreeMemoryNV*(pointer: Pointer){.stdcall, importc, wgl.} - # WGL_NV_present_video - proc wglEnumerateVideoDevicesNV*(hdc: HDC, phDeviceList: PHVIDEOOUTPUTDEVICENV): int{. - stdcall, importc, wgl.} - proc wglBindVideoDeviceNV*(hd: HDC, uVideoSlot: int, - hVideoDevice: HVIDEOOUTPUTDEVICENV, - piAttribList: ptr int32): bool{.stdcall, importc, wgl.} - proc wglQueryCurrentContextNV*(iAttribute: int, piValue: ptr int32): bool{. - stdcall, importc, wgl.} - # WGL_NV_video_output - proc wglGetVideoDeviceNV*(hDC: HDC, numDevices: int, hVideoDevice: PHPVIDEODEV): bool{. - stdcall, importc, wgl.} - proc wglReleaseVideoDeviceNV*(hVideoDevice: HPVIDEODEV): bool{.stdcall, importc, wgl.} - proc wglBindVideoImageNV*(hVideoDevice: HPVIDEODEV, hPbuffer: HPBUFFERARB, - iVideoBuffer: int): bool{.stdcall, importc, wgl.} - proc wglReleaseVideoImageNV*(hPbuffer: HPBUFFERARB, iVideoBuffer: int): bool{. - stdcall, importc, wgl.} - proc wglSendPbufferToVideoNV*(hPbuffer: HPBUFFERARB, iBufferType: int, - pulCounterPbuffer: ptr int, bBlock: bool): bool{. - stdcall, importc, wgl.} - proc wglGetVideoInfoNV*(hpVideoDevice: HPVIDEODEV, - pulCounterOutputPbuffer: ptr int, - pulCounterOutputVideo: ptr int): bool{.stdcall, importc, wgl.} - # WGL_NV_swap_group - proc wglJoinSwapGroupNV*(hDC: HDC, group: GLuint): bool{.stdcall, importc, wgl.} - proc wglBindSwapBarrierNV*(group: GLuint, barrier: GLuint): bool{.stdcall, importc, wgl.} - proc wglQuerySwapGroupNV*(hDC: HDC, group: PGLuint, barrier: PGLuint): bool{. - stdcall, importc, wgl.} - proc wglQueryMaxSwapGroupsNV*(hDC: HDC, mxGroups: PGLuint, - maxBarriers: PGLuint): bool{.stdcall, importc, wgl.} - proc wglQueryFrameCountNV*(hDC: HDC, count: PGLuint): bool{.stdcall, importc, wgl.} - proc wglResetFrameCountNV*(hDC: HDC): bool{.stdcall, importc, wgl.} - # WGL_NV_gpu_affinity - proc wglEnumGpusNV*(iGpuIndex: int, phGpu: PHGPUNV): bool{.stdcall, importc, wgl.} - proc wglEnumGpuDevicesNV*(hGpu: HGPUNV, iDeviceIndex: int, - lpGpuDevice: PGPU_DEVICE): bool{.stdcall, importc, wgl.} - proc wglCreateAffinityDCNV*(phGpuList: PHGPUNV): HDC{.stdcall, importc, wgl.} - proc wglEnumGpusFromAffinityDCNV*(hAffinityDC: HDC, iGpuIndex: int, - hGpu: PHGPUNV): bool{.stdcall, importc, wgl.} - proc wglDeleteDCNV*(hDC: HDC): bool{.stdcall, importc, wgl.} - # WGL_NV_video_capture - proc wglBindVideoCaptureDeviceNV*(uVideoSlot: int, - hDevice: HVIDEOINPUTDEVICENV): bool{.stdcall, importc, wgl.} - proc wglEnumerateVideoCaptureDevicesNV*(hDc: HDC, - phDeviceList: PHVIDEOINPUTDEVICENV): int{.stdcall, importc, wgl.} - proc wglLockVideoCaptureDeviceNV*(hDc: HDC, hDevice: HVIDEOINPUTDEVICENV): bool{. - stdcall, importc, wgl.} - proc wglQueryVideoCaptureDeviceNV*(hDc: HDC, hDevice: HVIDEOINPUTDEVICENV, - iAttribute: int, piValue: ptr int32): bool{. - stdcall, importc, wgl.} - proc wglReleaseVideoCaptureDeviceNV*(hDc: HDC, hDevice: HVIDEOINPUTDEVICENV): bool{. - stdcall, importc, wgl.} - # WGL_NV_copy_image - proc wglCopyImageSubDataNV*(hSrcRc: HGLRC, srcName: GLuint, srcTarget: GLenum, - srcLevel: GLint, srcX: GLint, srcY: GLint, - srcZ: GLint, hDstRC: HGLRC, dstName: GLuint, - dstTarget: GLenum, dstLevel: GLint, dstX: GLint, - dstY: GLint, dstZ: GLint, width: GLsizei, - height: GLsizei, depth: GLsizei): bool{.stdcall, importc, wgl.} - # WGL_NV_DX_interop - proc wglDXSetResourceShareHandleNV*(dxObject: PGLVoid, hareHandle: int): bool{. - stdcall, importc, wgl.} - proc wglDXOpenDeviceNV*(dxDevice: PGLVoid): int{.stdcall, importc, wgl.} - proc wglDXCloseDeviceNV*(hDevice: int): bool{.stdcall, importc, wgl.} - proc wglDXRegisterObjectNV*(hDevice: int, dxObject: PGLVoid, name: GLUInt, - typ: TGLEnum, access: TGLenum): int{.stdcall, importc, wgl.} - proc wglDXUnregisterObjectNV*(hDevice: int, hObject: int): bool{.stdcall, importc, wgl.} - proc wglDXObjectAccessNV*(hObject: int, access: GLenum): bool{.stdcall, importc, wgl.} - proc wglDXLockObjectsNV*(hDevice: int, count: GLint, hObjects: ptr int): bool{. - stdcall, importc, wgl.} - proc wglDXUnlockObjectsNV*(hDevice: int, count: GLint, hObjects: ptr int): bool{. - stdcall, importc, wgl.} - # WGL_OML_sync_control - proc wglGetSyncValuesOML*(hdc: HDC, ust: PGLint64, msc: PGLint64, - sbc: PGLint64): bool{.stdcall, importc, wgl.} - proc wglGetMscRateOML*(hdc: HDC, numerator: PGLint, denominator: PGLint): bool{. - stdcall, importc, wgl.} - proc wglSwapBuffersMscOML*(hdc: HDC, target_msc: GLint64, divisor: GLint64, - remainder: GLint64): GLint64{.stdcall, importc, wgl.} - proc wglSwapLayerBuffersMscOML*(hdc: HDC, fuPlanes: GLint, - target_msc: GLint64, divisor: GLint64, - remainder: GLint64): GLint64{.stdcall, importc, wgl.} - proc wglWaitForMscOML*(hdc: HDC, target_msc: GLint64, divisor: GLint64, - remainder: GLint64, ust: PGLint64, msc: PGLint64, - sbc: PGLint64): bool{.stdcall, importc, wgl.} - proc wglWaitForSbcOML*(hdc: HDC, target_sbc: GLint64, ust: PGLint64, - msc: PGLint64, sbc: PGLint64): bool{.stdcall, importc, wgl.} - # WGL_3DL_stereo_control - proc wglSetStereoEmitterState3DL*(hDC: HDC, uState: int32): bool{.stdcall, importc, wgl.} - # WIN_draw_range_elements - proc glDrawRangeElementsWIN*(mode: GLenum, start: GLuint, ending: GLuint, - count: GLsizei, typ: GLenum, indices: PGLvoid){. - stdcall, importc, wgl.} - # WIN_swap_hint - proc glAddSwapHintRectWIN*(x: GLint, y: GLint, width: GLsizei, height: GLsizei){. - stdcall, importc, wgl.} -when defined(LINUX): - proc glXChooseVisual*(dpy: PDisplay, screen: GLint, attribList: PGLint): PXVisualInfo{. - stdcall, importc, oglx.} - proc glXCopyContext*(dpy: PDisplay, src: GLXContext, dst: GLXContext, - mask: GLuint){.stdcall, importc, oglx.} - proc glXCreateContext*(dpy: PDisplay, vis: PXVisualInfo, - shareList: GLXContext, direct: GLboolean): GLXContext{. - stdcall, importc, oglx.} - proc glXCreateGLXPixmap*(dpy: PDisplay, vis: PXVisualInfo, pixmap: Pixmap): GLXPixmap{. - stdcall, importc, oglx.} - proc glXDestroyContext*(dpy: PDisplay, ctx: GLXContext){.stdcall, importc, oglx.} - proc glXDestroyGLXPixmap*(dpy: PDisplay, pix: GLXPixmap){.stdcall, importc, oglx.} - proc glXGetConfig*(dpy: PDisplay, vis: PXVisualInfo, attrib: GLint, - value: PGLint): GLint{.stdcall, importc, oglx.} - proc glXGetCurrentContext*(): GLXContext{.stdcall, importc, oglx.} - proc glXGetCurrentDrawable*(): GLXDrawable{.stdcall, importc, oglx.} - proc glXIsDirect*(dpy: PDisplay, ctx: GLXContext): glboolean{.stdcall, importc, oglx.} - proc glXMakeCurrent*(dpy: PDisplay, drawable: GLXDrawable, ctx: GLXContext): GLboolean{. - stdcall, importc, oglx.} - proc glXQueryExtension*(dpy: PDisplay, errorBase: PGLint, eventBase: PGLint): GLboolean{. - stdcall, importc, oglx.} - proc glXQueryVersion*(dpy: PDisplay, major: PGLint, minor: PGLint): GLboolean{. - stdcall, importc, oglx.} - proc glXSwapBuffers*(dpy: PDisplay, drawable: GLXDrawable){.stdcall, importc, oglx.} - proc glXUseXFont*(font: Font, first: GLint, count: GLint, listBase: GLint){. - stdcall, importc, oglx.} - proc glXWaitGL*(){.stdcall, importc, oglx.} - proc glXWaitX*(){.stdcall, importc, oglx.} - proc glXGetClientString*(dpy: PDisplay, name: GLint): PGLchar{.stdcall, importc, oglx.} - proc glXQueryServerString*(dpy: PDisplay, screen: GLint, name: GLint): PGLchar{. - stdcall, importc, oglx.} - proc glXQueryExtensionsString*(dpy: PDisplay, screen: GLint): PGLchar{.stdcall, importc, oglx.} - # GLX_VERSION_1_3 - proc glXGetFBConfigs*(dpy: PDisplay, screen: GLint, nelements: PGLint): GLXFBConfig{. - stdcall, importc, oglx.} - proc glXChooseFBConfig*(dpy: PDisplay, screen: GLint, attrib_list: PGLint, - nelements: PGLint): GLXFBConfig{.stdcall, importc, oglx.} - proc glXGetFBConfigAttrib*(dpy: PDisplay, config: GLXFBConfig, - attribute: GLint, value: PGLint): glint{.stdcall, importc, oglx.} - proc glXGetVisualFromFBConfig*(dpy: PDisplay, config: GLXFBConfig): PXVisualInfo{.stdcall, importc, oglx.} - proc glXCreateWindow*(dpy: PDisplay, config: GLXFBConfig, win: Window, - attrib_list: PGLint): GLXWindow{.stdcall, importc, oglx.} - proc glXDestroyWindow*(dpy: PDisplay, win: GLXWindow){.stdcall, importc, oglx.} - proc glXCreatePixmap*(dpy: PDisplay, config: GLXFBConfig, pixmap: Pixmap, - attrib_list: PGLint): GLXPixmap{.stdcall, importc, oglx.} - proc glXDestroyPixmap*(dpy: PDisplay, pixmap: GLXPixmap){.stdcall, importc, oglx.} - proc glXCreatePbuffer*(dpy: PDisplay, config: GLXFBConfig, attrib_list: PGLint): GLXPbuffer{. - stdcall, importc, oglx.} - proc glXDestroyPbuffer*(dpy: PDisplay, pbuf: GLXPbuffer){.stdcall, importc, oglx.} - proc glXQueryDrawable*(dpy: PDisplay, draw: GLXDrawable, attribute: GLint, - value: PGLuint){.stdcall, importc, oglx.} - proc glXCreateNewContext*(dpy: PDisplay, config: GLXFBConfig, - rendertyp: GLint, share_list: GLXContext, - direct: GLboolean): GLXContext{.stdcall, importc, oglx.} - proc glXMakeContextCurrent*(display: PDisplay, draw: GLXDrawable, - read: GLXDrawable, ctx: GLXContext): GLboolean{. - stdcall, importc, oglx.} - proc glXGetCurrentReadDrawable*(): GLXDrawable{.stdcall, importc, oglx.} - proc glXGetCurreentDisplay*(): PDisplay{.stdcall, importc, oglx.} - proc glXQueryContext*(dpy: PDisplay, ctx: GLXContext, attribute: GLint, - value: PGLint): GLint{.stdcall, importc, oglx.} - proc glXSelectEvent*(dpy: PDisplay, draw: GLXDrawable, event_mask: GLuint){. - stdcall, importc, oglx.} - proc glXGetSelectedEvent*(dpy: PDisplay, draw: GLXDrawable, - event_mask: PGLuint){.stdcall, importc, oglx.} - # GLX_VERSION_1_4 - when not defined(glXGetProcAddress): - proc glXGetProcAddress*(name: cstring): pointer{.stdcall, importc, oglx.} - # GLX_ARB_get_proc_address - when not defined(glXGetProcAddressARB): - proc glXGetProcAddressARB*(name: cstring): pointer{.stdcall, importc, oglx.} - # GLX_ARB_create_context - proc glXCreateContextAttribsARB*(dpy: PDisplay, config: GLXFBConfig, - share_context: GLXContext, direct: GLboolean, - attrib_list: PGLint): GLXContext{.stdcall, importc, oglx.} - # GLX_EXT_import_context - proc glXGetCurrentDisplayEXT*(): PDisplay{.stdcall, importc, oglx.} - proc glXQueryContextInfoEXT*(dpy: PDisplay, context: GLXContext, - attribute: GLint, value: PGLint): GLint{.stdcall, importc, oglx.} - proc glXGetContextIDEXT*(context: GLXContext): GLXContextID{.stdcall, importc, oglx.} - proc glXImportContextEXT*(dpy: PDisplay, contextID: GLXContextID): GLXContext{. - stdcall, importc, oglx.} - proc glXFreeContextEXT*(dpy: PDisplay, context: GLXContext){.stdcall, importc, oglx.} - # GLX_EXT_texture_from_pixmap - proc glXBindTexImageEXT*(dpy: PDisplay, drawable: GLXDrawable, buffer: GLint, - attrib_list: PGLint){.stdcall, importc, oglx.} - proc glXReleaseTexImageEXT*(dpy: PDisplay, drawable: GLXDrawable, - buffer: GLint){.stdcall, importc, oglx.} -# GL utility functions and procedures - -proc gluErrorString*(errCode: GLEnum): cstring{.stdcall, importc, glu.} -proc gluGetString*(name: GLEnum): cstring{.stdcall, importc, glu.} -proc gluOrtho2D*(left, right, bottom, top: GLdouble){.stdcall, importc, glu.} -proc gluPerspective*(fovy, aspect, zNear, zFar: GLdouble){.stdcall, importc, glu.} -proc gluPickMatrix*(x, y, width, height: GLdouble, viewport: TVector4i){.stdcall, importc, glu.} -proc gluLookAt*(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble){. - stdcall, importc, glu.} -proc gluProject*(objx, objy, objz: GLdouble, modelMatrix: TGLMatrixd4, - projMatrix: TGLMatrixd4, viewport: TVector4i, - winx, winy, winz: PGLdouble): GLint{.stdcall, importc, glu.} -proc gluUnProject*(winx, winy, winz: GLdouble, modelMatrix: TGLMatrixd4, - projMatrix: TGLMatrixd4, viewport: TVector4i, - objx, objy, objz: PGLdouble): GLint{.stdcall, importc, glu.} -proc gluScaleImage*(format: GLEnum, widthin, heightin: GLint, typein: GLEnum, - datain: Pointer, widthout, heightout: GLint, - typeout: GLEnum, dataout: Pointer): GLint{.stdcall, importc, glu.} -proc gluBuild1DMipmaps*(target: GLEnum, components, width: GLint, - format, atype: GLEnum, data: Pointer): GLint{.stdcall, importc, glu.} -proc gluBuild2DMipmaps*(target: GLEnum, components, width, height: GLint, - format, atype: GLEnum, Data: Pointer): GLint{.stdcall, importc, glu.} -proc gluNewQuadric*(): PGLUquadric{.stdcall, importc, glu.} -proc gluDeleteQuadric*(state: PGLUquadric){.stdcall, importc, glu.} -proc gluQuadricNormals*(quadObject: PGLUquadric, normals: GLEnum){.stdcall, importc, glu.} -proc gluQuadricTexture*(quadObject: PGLUquadric, textureCoords: GLboolean){. - stdcall, importc, glu.} -proc gluQuadricOrientation*(quadObject: PGLUquadric, orientation: GLEnum){. - stdcall, importc, glu.} -proc gluQuadricDrawStyle*(quadObject: PGLUquadric, drawStyle: GLEnum){.stdcall, importc, glu.} -proc gluCylinder*(quadObject: PGLUquadric, - baseRadius, topRadius, height: GLdouble, slices, stacks: GLint){. - stdcall, importc, glu.} -proc gluDisk*(quadObject: PGLUquadric, innerRadius, outerRadius: GLdouble, - slices, loops: GLint){.stdcall, importc, glu.} -proc gluPartialDisk*(quadObject: PGLUquadric, - innerRadius, outerRadius: GLdouble, slices, loops: GLint, - startAngle, sweepAngle: GLdouble){.stdcall, importc, glu.} -proc gluSphere*(quadObject: PGLUquadric, radius: GLdouble, slices, stacks: GLint){. - stdcall, importc, glu.} -proc gluQuadricCallback*(quadObject: PGLUquadric, which: GLEnum, - fn: TGLUQuadricErrorProc){.stdcall, importc, glu.} -proc gluNewTess*(): PGLUtesselator{.stdcall, importc, glu.} -proc gluDeleteTess*(tess: PGLUtesselator){.stdcall, importc, glu.} -proc gluTessBeginPolygon*(tess: PGLUtesselator, polygon_data: Pointer){.stdcall, importc, glu.} -proc gluTessBeginContour*(tess: PGLUtesselator){.stdcall, importc, glu.} -proc gluTessVertex*(tess: PGLUtesselator, coords: TGLArrayd3, data: Pointer){. - stdcall, importc, glu.} -proc gluTessEndContour*(tess: PGLUtesselator){.stdcall, importc, glu.} -proc gluTessEndPolygon*(tess: PGLUtesselator){.stdcall, importc, glu.} -proc gluTessProperty*(tess: PGLUtesselator, which: GLEnum, value: GLdouble){. - stdcall, importc, glu.} -proc gluTessNormal*(tess: PGLUtesselator, x, y, z: GLdouble){.stdcall, importc, glu.} -proc gluTessCallback*(tess: PGLUtesselator, which: GLEnum, fn: Pointer){.stdcall, importc, glu.} -proc gluGetTessProperty*(tess: PGLUtesselator, which: GLEnum, value: PGLdouble){. - stdcall, importc, glu.} -proc gluNewNurbsRenderer*(): PGLUnurbs{.stdcall, importc, glu.} -proc gluDeleteNurbsRenderer*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluBeginSurface*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluBeginCurve*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluEndCurve*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluEndSurface*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluBeginTrim*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluEndTrim*(nobj: PGLUnurbs){.stdcall, importc, glu.} -proc gluPwlCurve*(nobj: PGLUnurbs, count: GLint, points: PGLfloat, - stride: GLint, atype: GLEnum){.stdcall, importc, glu.} -proc gluNurbsCurve*(nobj: PGLUnurbs, nknots: GLint, knot: PGLfloat, - stride: GLint, ctlarray: PGLfloat, order: GLint, - atype: GLEnum){.stdcall, importc, glu.} -proc 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){.stdcall, importc, glu.} -proc gluLoadSamplingMatrices*(nobj: PGLUnurbs, - modelMatrix, projMatrix: TGLMatrixf4, - viewport: TVector4i){.stdcall, importc, glu.} -proc gluNurbsProperty*(nobj: PGLUnurbs, aproperty: GLEnum, value: GLfloat){. - stdcall, importc, glu.} -proc gluGetNurbsProperty*(nobj: PGLUnurbs, aproperty: GLEnum, value: PGLfloat){. - stdcall, importc, glu.} -proc gluNurbsCallback*(nobj: PGLUnurbs, which: GLEnum, fn: TGLUNurbsErrorProc){. - stdcall, importc, glu.} -proc gluBeginPolygon*(tess: PGLUtesselator){.stdcall, importc, glu.} -proc gluNextContour*(tess: PGLUtesselator, atype: GLEnum){.stdcall, importc, glu.} -proc gluEndPolygon*(tess: PGLUtesselator){.stdcall, importc, glu.} - -type - TRCOption* = enum - opDoubleBuffered, opGDI, opStereo - TRCOptions* = set[TRCOption] - -var LastPixelFormat*: int - -when defined(windows): - proc CreateRenderingContext*(DC: HDC, Options: TRCOptions, ColorBits, ZBits, - StencilBits, AccumBits, AuxBuffers: int, Layer: int): HGLRC - proc DestroyRenderingContext*(RC: HGLRC) - proc ActivateRenderingContext*(DC: HDC, RC: HGLRC) - proc DeactivateRenderingContext*() -# implementation - -proc GetExtensionString*(): string = - when defined(windows): - result = $glGetString(GL_EXTENSIONS) & ' ' & $wglGetExtensionsStringEXT() & - ' ' & $wglGetExtensionsStringARB(wglGetCurrentDC()) - else: - result = $glGetString(GL_EXTENSIONS) - -when defined(windows): - proc CreateRenderingContext(DC: HDC, Options: TRCOptions, ColorBits, ZBits, - StencilBits, AccumBits, AuxBuffers: int, Layer: int): HGLRC = - type - TPIXELFORMATDESCRIPTOR {.final, pure.} = object - nSize: int16 - nVersion: int16 - dwFlags: DWORD - iPixelType: int8 - cColorBits: int8 - cRedBits: int8 - cRedShift: int8 - cGreenBits: int8 - cGreenShift: int8 - cBlueBits: int8 - cBlueShift: int8 - cAlphaBits: int8 - cAlphaShift: int8 - cAccumBits: int8 - cAccumRedBits: int8 - cAccumGreenBits: int8 - cAccumBlueBits: int8 - cAccumAlphaBits: int8 - cDepthBits: int8 - cStencilBits: int8 - cAuxBuffers: int8 - iLayerType: int8 - bReserved: int8 - dwLayerMask: DWORD - dwVisibleMask: DWORD - dwDamageMask: DWORD - - proc GetObjectType(h: HDC): DWORD{.stdcall, dynlib: "gdi32", - importc: "GetObjectType".} - proc ChoosePixelFormat(para1: HDC, para2: ptr TPIXELFORMATDESCRIPTOR): int32{. - stdcall, dynlib: "gdi32", importc: "ChoosePixelFormat".} - proc GetPixelFormat(para1: HDC): int32{.stdcall, dynlib: "gdi32", - importc: "GetPixelFormat".} - proc SetPixelFormat(para1: HDC, para2: int32, - para3: ptr TPIXELFORMATDESCRIPTOR): WINBOOL{. - stdcall, dynlib: "gdi32", importc: "SetPixelFormat".} - proc DescribePixelFormat(para1: HDC, para2, para3: int32, - para4: ptr TPIXELFORMATDESCRIPTOR) {.stdcall, - dynlib: "gdi32", importc: "DescribePixelFormat".} - - const - OBJ_MEMDC = 10'i32 - OBJ_ENHMETADC = 12'i32 - OBJ_METADC = 4'i32 - PFD_DOUBLEBUFFER = 0x00000001 - PFD_STEREO = 0x00000002 - PFD_DRAW_TO_WINDOW = 0x00000004 - PFD_DRAW_TO_BITMAP = 0x00000008 - PFD_SUPPORT_GDI = 0x00000010 - PFD_SUPPORT_OPENGL = 0x00000020 - PFDtyp_RGBA = 0'i8 - PFD_MAIN_PLANE = 0'i8 - PFD_OVERLAY_PLANE = 1'i8 - PFD_UNDERLAY_PLANE = int32(- 1) - var - PFDescriptor: TPixelFormatDescriptor - PixelFormat: int32 - AType: int32 - PFDescriptor.nSize = SizeOf(PFDescriptor).int16 - PFDescriptor.nVersion = 1'i16 - PFDescriptor.dwFlags = PFD_SUPPORT_OPENGL - AType = GetObjectType(DC) - if AType == 0: OSError() - if AType == OBJ_MEMDC or AType == OBJ_METADC or AType == OBJ_ENHMETADC: - PFDescriptor.dwFlags = PFDescriptor.dwFlags or PFD_DRAW_TO_BITMAP - else: - PFDescriptor.dwFlags = PFDescriptor.dwFlags or PFD_DRAW_TO_WINDOW - if opDoubleBuffered in Options: - PFDescriptor.dwFlags = PFDescriptor.dwFlags or PFD_DOUBLEBUFFER - if opGDI in Options: - PFDescriptor.dwFlags = PFDescriptor.dwFlags or PFD_SUPPORT_GDI - if opStereo in Options: - PFDescriptor.dwFlags = PFDescriptor.dwFlags or PFD_STEREO - PFDescriptor.iPixelType = PFDtyp_RGBA - PFDescriptor.cColorBits = ColorBits.toU8 - PFDescriptor.cDepthBits = zBits.toU8 - PFDescriptor.cStencilBits = StencilBits.toU8 - PFDescriptor.cAccumBits = AccumBits.toU8 - PFDescriptor.cAuxBuffers = AuxBuffers.toU8 - if Layer == 0: PFDescriptor.iLayerType = PFD_MAIN_PLANE - elif Layer > 0: PFDescriptor.iLayerType = PFD_OVERLAY_PLANE - else: PFDescriptor.iLayerType = int8(PFD_UNDERLAY_PLANE) - PixelFormat = ChoosePixelFormat(DC, addr(PFDescriptor)) - if PixelFormat == 0: OSError() - if GetPixelFormat(DC) != PixelFormat: - if SetPixelFormat(DC, PixelFormat, addr(PFDescriptor)) == 0'i32: - OSError() - DescribePixelFormat(DC, PixelFormat.int32, SizeOf(PFDescriptor).int32, - addr(PFDescriptor)) - Result = wglCreateContext(DC) - if Result == 0: OSError() - else: LastPixelFormat = 0 - - proc DestroyRenderingContext(RC: HGLRC) = - discard wglDeleteContext(RC) - - proc ActivateRenderingContext(DC: HDC, RC: HGLRC) = - discard wglMakeCurrent(DC, RC) - - proc DeactivateRenderingContext() = - discard wglMakeCurrent(0, 0) diff --git a/lib/wrappers/opengl/wingl.nim b/lib/wrappers/opengl/wingl.nim deleted file mode 100644 index 7ed78f970..000000000 --- a/lib/wrappers/opengl/wingl.nim +++ /dev/null @@ -1,368 +0,0 @@ -import - gl, windows - -proc wglGetExtensionsStringARB*(hdc: HDC): cstring{.dynlib: dllname, - importc: "wglGetExtensionsStringARB".} -const - WGL_FRONT_COLOR_BUFFER_BIT_ARB* = 0x00000001 - WGL_BACK_COLOR_BUFFER_BIT_ARB* = 0x00000002 - WGL_DEPTH_BUFFER_BIT_ARB* = 0x00000004 - WGL_STENCIL_BUFFER_BIT_ARB* = 0x00000008 - -proc WinChoosePixelFormat*(DC: HDC, p2: PPixelFormatDescriptor): int{. - dynlib: "gdi32", importc: "ChoosePixelFormat".} -proc wglCreateBufferRegionARB*(hDC: HDC, iLayerPlane: TGLint, uType: TGLuint): THandle{. - dynlib: dllname, importc: "wglCreateBufferRegionARB".} -proc wglDeleteBufferRegionARB*(hRegion: THandle){.dynlib: dllname, - importc: "wglDeleteBufferRegionARB".} -proc wglSaveBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint, - width: TGLint, height: TGLint): BOOL{. - dynlib: dllname, importc: "wglSaveBufferRegionARB".} -proc wglRestoreBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint, - width: TGLint, height: TGLint, xSrc: TGLint, - ySrc: TGLint): BOOL{.dynlib: dllname, - importc: "wglRestoreBufferRegionARB".} -proc wglAllocateMemoryNV*(size: TGLsizei, readFrequency: TGLfloat, - writeFrequency: TGLfloat, priority: TGLfloat): PGLvoid{. - dynlib: dllname, importc: "wglAllocateMemoryNV".} -proc wglFreeMemoryNV*(pointer: PGLvoid){.dynlib: dllname, - importc: "wglFreeMemoryNV".} -const - WGL_IMAGE_BUFFER_MIN_ACCESS_I3D* = 0x00000001 - WGL_IMAGE_BUFFER_LOCK_I3D* = 0x00000002 - -proc wglCreateImageBufferI3D*(hDC: HDC, dwSize: DWORD, uFlags: UINT): PGLvoid{. - dynlib: dllname, importc: "wglCreateImageBufferI3D".} -proc wglDestroyImageBufferI3D*(hDC: HDC, pAddress: PGLvoid): BOOL{. - dynlib: dllname, importc: "wglDestroyImageBufferI3D".} -proc wglAssociateImageBufferEventsI3D*(hdc: HDC, pEvent: PHandle, - pAddress: PGLvoid, pSize: PDWORD, - count: UINT): BOOL{.dynlib: dllname, - importc: "wglAssociateImageBufferEventsI3D".} -proc wglReleaseImageBufferEventsI3D*(hdc: HDC, pAddress: PGLvoid, count: UINT): BOOL{. - dynlib: dllname, importc: "wglReleaseImageBufferEventsI3D".} -proc wglEnableFrameLockI3D*(): BOOL{.dynlib: dllname, - importc: "wglEnableFrameLockI3D".} -proc wglDisableFrameLockI3D*(): BOOL{.dynlib: dllname, - importc: "wglDisableFrameLockI3D".} -proc wglIsEnabledFrameLockI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname, - importc: "wglIsEnabledFrameLockI3D".} -proc wglQueryFrameLockMasterI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname, - importc: "wglQueryFrameLockMasterI3D".} -proc wglGetFrameUsageI3D*(pUsage: PGLfloat): BOOL{.dynlib: dllname, - importc: "wglGetFrameUsageI3D".} -proc wglBeginFrameTrackingI3D*(): BOOL{.dynlib: dllname, - importc: "wglBeginFrameTrackingI3D".} -proc wglEndFrameTrackingI3D*(): BOOL{.dynlib: dllname, - importc: "wglEndFrameTrackingI3D".} -proc wglQueryFrameTrackingI3D*(pFrameCount: PDWORD, pMissedFrames: PDWORD, - pLastMissedUsage: PGLfloat): BOOL{. - dynlib: dllname, importc: "wglQueryFrameTrackingI3D".} -const - WGL_NUMBER_PIXEL_FORMATS_ARB* = 0x00002000 - WGL_DRAW_TO_WINDOW_ARB* = 0x00002001 - WGL_DRAW_TO_BITMAP_ARB* = 0x00002002 - WGL_ACCELERATION_ARB* = 0x00002003 - WGL_NEED_PALETTE_ARB* = 0x00002004 - WGL_NEED_SYSTEM_PALETTE_ARB* = 0x00002005 - WGL_SWAP_LAYER_BUFFERS_ARB* = 0x00002006 - WGL_SWAP_METHOD_ARB* = 0x00002007 - WGL_NUMBER_OVERLAYS_ARB* = 0x00002008 - WGL_NUMBER_UNDERLAYS_ARB* = 0x00002009 - WGL_TRANSPARENT_ARB* = 0x0000200A - WGL_TRANSPARENT_RED_VALUE_ARB* = 0x00002037 - WGL_TRANSPARENT_GREEN_VALUE_ARB* = 0x00002038 - WGL_TRANSPARENT_BLUE_VALUE_ARB* = 0x00002039 - WGL_TRANSPARENT_ALPHA_VALUE_ARB* = 0x0000203A - WGL_TRANSPARENT_INDEX_VALUE_ARB* = 0x0000203B - WGL_SHARE_DEPTH_ARB* = 0x0000200C - WGL_SHARE_STENCIL_ARB* = 0x0000200D - WGL_SHARE_ACCUM_ARB* = 0x0000200E - WGL_SUPPORT_GDI_ARB* = 0x0000200F - WGL_SUPPORT_OPENGL_ARB* = 0x00002010 - WGL_DOUBLE_BUFFER_ARB* = 0x00002011 - WGL_STEREO_ARB* = 0x00002012 - WGL_PIXEL_TYPE_ARB* = 0x00002013 - WGL_COLOR_BITS_ARB* = 0x00002014 - WGL_RED_BITS_ARB* = 0x00002015 - WGL_RED_SHIFT_ARB* = 0x00002016 - WGL_GREEN_BITS_ARB* = 0x00002017 - WGL_GREEN_SHIFT_ARB* = 0x00002018 - WGL_BLUE_BITS_ARB* = 0x00002019 - WGL_BLUE_SHIFT_ARB* = 0x0000201A - WGL_ALPHA_BITS_ARB* = 0x0000201B - WGL_ALPHA_SHIFT_ARB* = 0x0000201C - WGL_ACCUM_BITS_ARB* = 0x0000201D - WGL_ACCUM_RED_BITS_ARB* = 0x0000201E - WGL_ACCUM_GREEN_BITS_ARB* = 0x0000201F - WGL_ACCUM_BLUE_BITS_ARB* = 0x00002020 - WGL_ACCUM_ALPHA_BITS_ARB* = 0x00002021 - WGL_DEPTH_BITS_ARB* = 0x00002022 - WGL_STENCIL_BITS_ARB* = 0x00002023 - WGL_AUX_BUFFERS_ARB* = 0x00002024 - WGL_NO_ACCELERATION_ARB* = 0x00002025 - WGL_GENERIC_ACCELERATION_ARB* = 0x00002026 - WGL_FULL_ACCELERATION_ARB* = 0x00002027 - WGL_SWAP_EXCHANGE_ARB* = 0x00002028 - WGL_SWAP_COPY_ARB* = 0x00002029 - WGL_SWAP_UNDEFINED_ARB* = 0x0000202A - WGL_TYPE_RGBA_ARB* = 0x0000202B - WGL_TYPE_COLORINDEX_ARB* = 0x0000202C - -proc wglGetPixelFormatAttribivARB*(hdc: HDC, iPixelFormat: TGLint, - iLayerPlane: TGLint, nAttributes: TGLuint, - piAttributes: PGLint, piValues: PGLint): BOOL{. - dynlib: dllname, importc: "wglGetPixelFormatAttribivARB".} -proc wglGetPixelFormatAttribfvARB*(hdc: HDC, iPixelFormat: TGLint, - iLayerPlane: TGLint, nAttributes: TGLuint, - piAttributes: PGLint, pfValues: PGLfloat): BOOL{. - dynlib: dllname, importc: "wglGetPixelFormatAttribfvARB".} -proc wglChoosePixelFormatARB*(hdc: HDC, piAttribIList: PGLint, - pfAttribFList: PGLfloat, nMaxFormats: TGLuint, - piFormats: PGLint, nNumFormats: PGLuint): BOOL{. - dynlib: dllname, importc: "wglChoosePixelFormatARB".} -const - WGL_ERROR_INVALID_PIXEL_TYPE_ARB* = 0x00002043 - WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB* = 0x00002054 - -proc wglMakeContextCurrentARB*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): BOOL{. - dynlib: dllname, importc: "wglMakeContextCurrentARB".} -proc wglGetCurrentReadDCARB*(): HDC{.dynlib: dllname, - importc: "wglGetCurrentReadDCARB".} -const - WGL_DRAW_TO_PBUFFER_ARB* = 0x0000202D # WGL_DRAW_TO_PBUFFER_ARB { already defined } - WGL_MAX_PBUFFER_PIXELS_ARB* = 0x0000202E - WGL_MAX_PBUFFER_WIDTH_ARB* = 0x0000202F - WGL_MAX_PBUFFER_HEIGHT_ARB* = 0x00002030 - WGL_PBUFFER_LARGEST_ARB* = 0x00002033 - WGL_PBUFFER_WIDTH_ARB* = 0x00002034 - WGL_PBUFFER_HEIGHT_ARB* = 0x00002035 - WGL_PBUFFER_LOST_ARB* = 0x00002036 - -proc wglCreatePbufferARB*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint, - iHeight: TGLint, piAttribList: PGLint): THandle{. - dynlib: dllname, importc: "wglCreatePbufferARB".} -proc wglGetPbufferDCARB*(hPbuffer: THandle): HDC{.dynlib: dllname, - importc: "wglGetPbufferDCARB".} -proc wglReleasePbufferDCARB*(hPbuffer: THandle, hDC: HDC): TGLint{. - dynlib: dllname, importc: "wglReleasePbufferDCARB".} -proc wglDestroyPbufferARB*(hPbuffer: THandle): BOOL{.dynlib: dllname, - importc: "wglDestroyPbufferARB".} -proc wglQueryPbufferARB*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{. - dynlib: dllname, importc: "wglQueryPbufferARB".} -proc wglSwapIntervalEXT*(interval: TGLint): BOOL{.dynlib: dllname, - importc: "wglSwapIntervalEXT".} -proc wglGetSwapIntervalEXT*(): TGLint{.dynlib: dllname, - importc: "wglGetSwapIntervalEXT".} -const - WGL_BIND_TO_TEXTURE_RGB_ARB* = 0x00002070 - WGL_BIND_TO_TEXTURE_RGBA_ARB* = 0x00002071 - WGL_TEXTURE_FORMAT_ARB* = 0x00002072 - WGL_TEXTURE_TARGET_ARB* = 0x00002073 - WGL_MIPMAP_TEXTURE_ARB* = 0x00002074 - WGL_TEXTURE_RGB_ARB* = 0x00002075 - WGL_TEXTURE_RGBA_ARB* = 0x00002076 - WGL_NO_TEXTURE_ARB* = 0x00002077 - WGL_TEXTURE_CUBE_MAP_ARB* = 0x00002078 - WGL_TEXTURE_1D_ARB* = 0x00002079 - WGL_TEXTURE_2D_ARB* = 0x0000207A # WGL_NO_TEXTURE_ARB { already defined } - WGL_MIPMAP_LEVEL_ARB* = 0x0000207B - WGL_CUBE_MAP_FACE_ARB* = 0x0000207C - WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB* = 0x0000207D - WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB* = 0x0000207E - WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB* = 0x0000207F - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB* = 0x00002080 - WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB* = 0x00002081 - WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB* = 0x00002082 - WGL_FRONT_LEFT_ARB* = 0x00002083 - WGL_FRONT_RIGHT_ARB* = 0x00002084 - WGL_BACK_LEFT_ARB* = 0x00002085 - WGL_BACK_RIGHT_ARB* = 0x00002086 - WGL_AUX0_ARB* = 0x00002087 - WGL_AUX1_ARB* = 0x00002088 - WGL_AUX2_ARB* = 0x00002089 - WGL_AUX3_ARB* = 0x0000208A - WGL_AUX4_ARB* = 0x0000208B - WGL_AUX5_ARB* = 0x0000208C - WGL_AUX6_ARB* = 0x0000208D - WGL_AUX7_ARB* = 0x0000208E - WGL_AUX8_ARB* = 0x0000208F - WGL_AUX9_ARB* = 0x00002090 - -proc wglBindTexImageARB*(hPbuffer: THandle, iBuffer: TGLint): BOOL{. - dynlib: dllname, importc: "wglBindTexImageARB".} -proc wglReleaseTexImageARB*(hPbuffer: THandle, iBuffer: TGLint): BOOL{. - dynlib: dllname, importc: "wglReleaseTexImageARB".} -proc wglSetPbufferAttribARB*(hPbuffer: THandle, piAttribList: PGLint): BOOL{. - dynlib: dllname, importc: "wglSetPbufferAttribARB".} -proc wglGetExtensionsStringEXT*(): cstring{.dynlib: dllname, - importc: "wglGetExtensionsStringEXT".} -proc wglMakeContextCurrentEXT*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): BOOL{. - dynlib: dllname, importc: "wglMakeContextCurrentEXT".} -proc wglGetCurrentReadDCEXT*(): HDC{.dynlib: dllname, - importc: "wglGetCurrentReadDCEXT".} -const - WGL_DRAW_TO_PBUFFER_EXT* = 0x0000202D - WGL_MAX_PBUFFER_PIXELS_EXT* = 0x0000202E - WGL_MAX_PBUFFER_WIDTH_EXT* = 0x0000202F - WGL_MAX_PBUFFER_HEIGHT_EXT* = 0x00002030 - WGL_OPTIMAL_PBUFFER_WIDTH_EXT* = 0x00002031 - WGL_OPTIMAL_PBUFFER_HEIGHT_EXT* = 0x00002032 - WGL_PBUFFER_LARGEST_EXT* = 0x00002033 - WGL_PBUFFER_WIDTH_EXT* = 0x00002034 - WGL_PBUFFER_HEIGHT_EXT* = 0x00002035 - -proc wglCreatePbufferEXT*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint, - iHeight: TGLint, piAttribList: PGLint): THandle{. - dynlib: dllname, importc: "wglCreatePbufferEXT".} -proc wglGetPbufferDCEXT*(hPbuffer: THandle): HDC{.dynlib: dllname, - importc: "wglGetPbufferDCEXT".} -proc wglReleasePbufferDCEXT*(hPbuffer: THandle, hDC: HDC): TGLint{. - dynlib: dllname, importc: "wglReleasePbufferDCEXT".} -proc wglDestroyPbufferEXT*(hPbuffer: THandle): BOOL{.dynlib: dllname, - importc: "wglDestroyPbufferEXT".} -proc wglQueryPbufferEXT*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{. - dynlib: dllname, importc: "wglQueryPbufferEXT".} -const - WGL_NUMBER_PIXEL_FORMATS_EXT* = 0x00002000 - WGL_DRAW_TO_WINDOW_EXT* = 0x00002001 - WGL_DRAW_TO_BITMAP_EXT* = 0x00002002 - WGL_ACCELERATION_EXT* = 0x00002003 - WGL_NEED_PALETTE_EXT* = 0x00002004 - WGL_NEED_SYSTEM_PALETTE_EXT* = 0x00002005 - WGL_SWAP_LAYER_BUFFERS_EXT* = 0x00002006 - WGL_SWAP_METHOD_EXT* = 0x00002007 - WGL_NUMBER_OVERLAYS_EXT* = 0x00002008 - WGL_NUMBER_UNDERLAYS_EXT* = 0x00002009 - WGL_TRANSPARENT_EXT* = 0x0000200A - WGL_TRANSPARENT_VALUE_EXT* = 0x0000200B - WGL_SHARE_DEPTH_EXT* = 0x0000200C - WGL_SHARE_STENCIL_EXT* = 0x0000200D - WGL_SHARE_ACCUM_EXT* = 0x0000200E - WGL_SUPPORT_GDI_EXT* = 0x0000200F - WGL_SUPPORT_OPENGL_EXT* = 0x00002010 - WGL_DOUBLE_BUFFER_EXT* = 0x00002011 - WGL_STEREO_EXT* = 0x00002012 - WGL_PIXEL_TYPE_EXT* = 0x00002013 - WGL_COLOR_BITS_EXT* = 0x00002014 - WGL_RED_BITS_EXT* = 0x00002015 - WGL_RED_SHIFT_EXT* = 0x00002016 - WGL_GREEN_BITS_EXT* = 0x00002017 - WGL_GREEN_SHIFT_EXT* = 0x00002018 - WGL_BLUE_BITS_EXT* = 0x00002019 - WGL_BLUE_SHIFT_EXT* = 0x0000201A - WGL_ALPHA_BITS_EXT* = 0x0000201B - WGL_ALPHA_SHIFT_EXT* = 0x0000201C - WGL_ACCUM_BITS_EXT* = 0x0000201D - WGL_ACCUM_RED_BITS_EXT* = 0x0000201E - WGL_ACCUM_GREEN_BITS_EXT* = 0x0000201F - WGL_ACCUM_BLUE_BITS_EXT* = 0x00002020 - WGL_ACCUM_ALPHA_BITS_EXT* = 0x00002021 - WGL_DEPTH_BITS_EXT* = 0x00002022 - WGL_STENCIL_BITS_EXT* = 0x00002023 - WGL_AUX_BUFFERS_EXT* = 0x00002024 - WGL_NO_ACCELERATION_EXT* = 0x00002025 - WGL_GENERIC_ACCELERATION_EXT* = 0x00002026 - WGL_FULL_ACCELERATION_EXT* = 0x00002027 - WGL_SWAP_EXCHANGE_EXT* = 0x00002028 - WGL_SWAP_COPY_EXT* = 0x00002029 - WGL_SWAP_UNDEFINED_EXT* = 0x0000202A - WGL_TYPE_RGBA_EXT* = 0x0000202B - WGL_TYPE_COLORINDEX_EXT* = 0x0000202C - -proc wglGetPixelFormatAttribivEXT*(hdc: HDC, iPixelFormat: TGLint, - iLayerPlane: TGLint, nAttributes: TGLuint, - piAttributes: PGLint, piValues: PGLint): BOOL{. - dynlib: dllname, importc: "wglGetPixelFormatAttribivEXT".} -proc wglGetPixelFormatAttribfvEXT*(hdc: HDC, iPixelFormat: TGLint, - iLayerPlane: TGLint, nAttributes: TGLuint, - piAttributes: PGLint, pfValues: PGLfloat): BOOL{. - dynlib: dllname, importc: "wglGetPixelFormatAttribfvEXT".} -proc wglChoosePixelFormatEXT*(hdc: HDC, piAttribIList: PGLint, - pfAttribFList: PGLfloat, nMaxFormats: TGLuint, - piFormats: PGLint, nNumFormats: PGLuint): BOOL{. - dynlib: dllname, importc: "wglChoosePixelFormatEXT".} -const - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D* = 0x00002050 - WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D* = 0x00002051 - WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D* = 0x00002052 - WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D* = 0x00002053 - -proc wglGetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint, - piValue: PGLint): BOOL{.dynlib: dllname, - importc: "wglGetDigitalVideoParametersI3D".} -proc wglSetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint, - piValue: PGLint): BOOL{.dynlib: dllname, - importc: "wglSetDigitalVideoParametersI3D".} -const - WGL_GAMMA_TABLE_SIZE_I3D* = 0x0000204E - WGL_GAMMA_EXCLUDE_DESKTOP_I3D* = 0x0000204F - -proc wglGetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint, - piValue: PGLint): BOOL{.dynlib: dllname, - importc: "wglGetGammaTableParametersI3D".} -proc wglSetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint, - piValue: PGLint): BOOL{.dynlib: dllname, - importc: "wglSetGammaTableParametersI3D".} -proc wglGetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT, - puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{. - dynlib: dllname, importc: "wglGetGammaTableI3D".} -proc wglSetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT, - puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{. - dynlib: dllname, importc: "wglSetGammaTableI3D".} -const - WGL_GENLOCK_SOURCE_MULTIVIEW_I3D* = 0x00002044 - WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D* = 0x00002045 - WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D* = 0x00002046 - WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D* = 0x00002047 - WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D* = 0x00002048 - WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D* = 0x00002049 - WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D* = 0x0000204A - WGL_GENLOCK_SOURCE_EDGE_RISING_I3D* = 0x0000204B - WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D* = 0x0000204C - WGL_FLOAT_COMPONENTS_NV* = 0x000020B0 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV* = 0x000020B1 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV* = 0x000020B2 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV* = 0x000020B3 - WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV* = 0x000020B4 - WGL_TEXTURE_FLOAT_R_NV* = 0x000020B5 - WGL_TEXTURE_FLOAT_RG_NV* = 0x000020B6 - WGL_TEXTURE_FLOAT_RGB_NV* = 0x000020B7 - WGL_TEXTURE_FLOAT_RGBA_NV* = 0x000020B8 - -proc wglEnableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname, - importc: "wglEnableGenlockI3D".} -proc wglDisableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname, - importc: "wglDisableGenlockI3D".} -proc wglIsEnabledGenlockI3D*(hDC: HDC, pFlag: PBOOL): BOOL{.dynlib: dllname, - importc: "wglIsEnabledGenlockI3D".} -proc wglGenlockSourceI3D*(hDC: HDC, uSource: TGLuint): BOOL{.dynlib: dllname, - importc: "wglGenlockSourceI3D".} -proc wglGetGenlockSourceI3D*(hDC: HDC, uSource: PGLUINT): BOOL{.dynlib: dllname, - importc: "wglGetGenlockSourceI3D".} -proc wglGenlockSourceEdgeI3D*(hDC: HDC, uEdge: TGLuint): BOOL{.dynlib: dllname, - importc: "wglGenlockSourceEdgeI3D".} -proc wglGetGenlockSourceEdgeI3D*(hDC: HDC, uEdge: PGLUINT): BOOL{. - dynlib: dllname, importc: "wglGetGenlockSourceEdgeI3D".} -proc wglGenlockSampleRateI3D*(hDC: HDC, uRate: TGLuint): BOOL{.dynlib: dllname, - importc: "wglGenlockSampleRateI3D".} -proc wglGetGenlockSampleRateI3D*(hDC: HDC, uRate: PGLUINT): BOOL{. - dynlib: dllname, importc: "wglGetGenlockSampleRateI3D".} -proc wglGenlockSourceDelayI3D*(hDC: HDC, uDelay: TGLuint): BOOL{. - dynlib: dllname, importc: "wglGenlockSourceDelayI3D".} -proc wglGetGenlockSourceDelayI3D*(hDC: HDC, uDelay: PGLUINT): BOOL{. - dynlib: dllname, importc: "wglGetGenlockSourceDelayI3D".} -proc wglQueryGenlockMaxSourceDelayI3D*(hDC: HDC, uMaxLineDelay: PGLUINT, - uMaxPixelDelay: PGLUINT): BOOL{. - dynlib: dllname, importc: "wglQueryGenlockMaxSourceDelayI3D".} -const - WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV* = 0x000020A0 - WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV* = 0x000020A1 - WGL_TEXTURE_RECTANGLE_NV* = 0x000020A2 - -const - WGL_RGBA_FLOAT_MODE_ATI* = 0x00008820 - WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI* = 0x00008835 - WGL_TYPE_RGBA_FLOAT_ATI* = 0x000021A0 - -# implementation diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim index af72d04eb..90c398dce 100644 --- a/lib/wrappers/openssl.nim +++ b/lib/wrappers/openssl.nim @@ -268,14 +268,22 @@ proc OpenSSL_add_all_algorithms*(){.cdecl, dynlib: DLLUtilName, importc: "OPENSS proc OPENSSL_config*(configName: cstring){.cdecl, dynlib: DLLSSLName, importc.} -proc CRYPTO_set_mem_functions(a,b,c: pointer){.cdecl, dynlib: DLLSSLName, importc.} +when not defined(windows): + proc CRYPTO_set_mem_functions(a,b,c: pointer){.cdecl, + dynlib: DLLSSLName, importc.} proc CRYPTO_malloc_init*() = when not defined(windows): CRYPTO_set_mem_functions(alloc, realloc, dealloc) -when True: - nil +proc SSL_CTX_ctrl*(ctx: PSSL_CTX, cmd: cInt, larg: int, parg: pointer): int{. + cdecl, dynlib: DLLSSLName, importc.} + +proc SSLCTXSetMode*(ctx: PSSL_CTX, mode: int): int = + result = SSL_CTX_ctrl(ctx, SSL_CTRL_MODE, mode, nil) + +when true: + discard else: proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cInt{.cdecl, dynlib: DLLSSLName, importc.} @@ -288,7 +296,6 @@ else: proc SslCTXCtrl*(ctx: PSSL_CTX, cmd: cInt, larg: int, parg: Pointer): int{. cdecl, dynlib: DLLSSLName, importc.} - proc SSLCTXSetMode*(ctx: PSSL_CTX, mode: int): int proc SSLSetMode*(s: PSSL, mode: int): int proc SSLCTXGetMode*(ctx: PSSL_CTX): int proc SSLGetMode*(s: PSSL): int @@ -417,15 +424,12 @@ else: enc: cInt){.cdecl, dynlib: DLLUtilName, importc.} # implementation - proc SSLCTXSetMode(ctx: PSSL_CTX, mode: int): int = - Result = SslCTXCtrl(ctx, SSL_CTRL_MODE, mode, nil) - proc SSLSetMode(s: PSSL, mode: int): int = - Result = SSLctrl(s, SSL_CTRL_MODE, mode, nil) + result = SSLctrl(s, SSL_CTRL_MODE, mode, nil) proc SSLCTXGetMode(ctx: PSSL_CTX): int = - Result = SSLCTXctrl(ctx, SSL_CTRL_MODE, 0, nil) + result = SSLCTXctrl(ctx, SSL_CTRL_MODE, 0, nil) proc SSLGetMode(s: PSSL): int = - Result = SSLctrl(s, SSL_CTRL_MODE, 0, nil) + result = SSLctrl(s, SSL_CTRL_MODE, 0, nil) diff --git a/lib/wrappers/pcre.nim b/lib/wrappers/pcre.nim index 46248dde5..afa8f447a 100644 --- a/lib/wrappers/pcre.nim +++ b/lib/wrappers/pcre.nim @@ -243,7 +243,7 @@ type # remain compatible. type - Textra*{.pure, final.} = object + TExtra*{.pure, final.} = object flags*: int ## Bits for which fields are set study_data*: pointer ## Opaque data from pcre_study() match_limit*: int ## Maximum number of calls to match() @@ -260,7 +260,7 @@ type # without modification. type - Tcallout_block*{.pure, final.} = object + TCalloutBlock*{.pure, final.} = object version*: cint ## Identifies version of block callout_number*: cint ## Number compiled into pattern offset_vector*: ptr cint ## The offset vector @@ -284,7 +284,7 @@ type # User defined callback which provides a stack just before the match starts. type - Tjit_callback* = proc(p: pointer): ptr Tjit_stack{.cdecl.} + TJitCallback* = proc(p: pointer): ptr Tjit_stack{.cdecl.} # Exported PCRE functions @@ -303,18 +303,18 @@ proc copy_substring*(a2: cstring, a3: ptr cint, a4: cint, a5: cint, a6: cstring, a7: cint): cint{.cdecl, importc: "pcre_copy_substring", pcreImport.} -proc dfa_exec*(a2: ptr TPcre, a3: ptr Textra, a4: cstring, a5: cint, +proc dfa_exec*(a2: ptr TPcre, a3: ptr TExtra, a4: cstring, a5: cint, a6: cint, a7: cint, a8: ptr cint, a9: cint, a10: ptr cint, a11: cint): cint{.cdecl, importc: "pcre_dfa_exec", pcreImport.} -proc exec*(a2: ptr TPcre, a3: ptr Textra, a4: cstring, a5: cint, a6: cint, +proc exec*(a2: ptr TPcre, a3: ptr TExtra, a4: cstring, a5: cint, a6: cint, a7: cint, a8: ptr cint, a9: cint): cint {. cdecl, importc: "pcre_exec", pcreImport.} proc free_substring*(a2: cstring){.cdecl, importc: "pcre_free_substring", pcreImport.} proc free_substring_list*(a2: cstringArray){.cdecl, importc: "pcre_free_substring_list", pcreImport.} -proc fullinfo*(a2: ptr TPcre, a3: ptr Textra, a4: cint, a5: pointer): cint{. +proc fullinfo*(a2: ptr TPcre, a3: ptr TExtra, a4: cint, a5: pointer): cint{. cdecl, importc: "pcre_fullinfo", pcreImport.} proc get_named_substring*(a2: ptr TPcre, a3: cstring, a4: ptr cint, a5: cint, a6: cstring, a7: cstringArray): cint{.cdecl, @@ -334,13 +334,13 @@ proc maketables*(): ptr char{.cdecl, importc: "pcre_maketables", pcreImport.} proc refcount*(a2: ptr TPcre, a3: cint): cint{.cdecl, importc: "pcre_refcount", pcreImport.} -proc study*(a2: ptr TPcre, a3: cint, a4: var cstring): ptr Textra{.cdecl, +proc study*(a2: ptr TPcre, a3: cint, a4: var cstring): ptr TExtra{.cdecl, importc: "pcre_study", pcreImport.} proc version*(): cstring{.cdecl, importc: "pcre_version", pcreImport.} # Utility functions for byte order swaps. -proc pattern_to_host_byte_order*(a2: ptr TPcre, a3: ptr Textra, +proc pattern_to_host_byte_order*(a2: ptr TPcre, a3: ptr TExtra, a4: ptr char): cint{.cdecl, importc: "pcre_pattern_to_host_byte_order", pcreImport.} @@ -350,7 +350,7 @@ proc jit_stack_alloc*(a2: cint, a3: cint): ptr Tjit_stack{.cdecl, importc: "pcre_jit_stack_alloc", pcreImport.} proc jit_stack_free*(a2: ptr Tjit_stack){.cdecl, importc: "pcre_jit_stack_free", pcreImport.} -proc assign_jit_stack*(a2: ptr Textra, a3: Tjit_callback, a4: pointer){.cdecl, +proc assign_jit_stack*(a2: ptr TExtra, a3: TJitCallback, a4: pointer){.cdecl, importc: "pcre_assign_jit_stack", pcreImport.} var diff --git a/lib/wrappers/python.nim b/lib/wrappers/python.nim deleted file mode 100644 index 3e6543765..000000000 --- a/lib/wrappers/python.nim +++ /dev/null @@ -1,1587 +0,0 @@ -# -# Light-weight binding for the Python interpreter -# (c) 2010 Andreas Rumpf -# Based on 'PythonEngine' module by Dr. Dietmar Budelsky -# -# -#************************************************************************ -# -# Module: Unit 'PythonEngine' Copyright (c) 1997 -# -# Version: 3.0 Dr. Dietmar Budelsky -# Sub-Version: 0.25 dbudelsky@web.de -# Germany -# -# Morgan Martinet -# 4721 rue Brebeuf -# H2J 3L2 MONTREAL (QC) -# CANADA -# e-mail: mmm@free.fr -# -# look our page at: http://www.multimania.com/marat -#************************************************************************ -# Functionality: Delphi Components that provide an interface to the -# Python language (see python.txt for more infos on -# Python itself). -# -#************************************************************************ -# Contributors: -# Grzegorz Makarewicz (mak@mikroplan.com.pl) -# Andrew Robinson (andy@hps1.demon.co.uk) -# Mark Watts(mark_watts@hotmail.com) -# Olivier Deckmyn (olivier.deckmyn@mail.dotcom.fr) -# Sigve Tjora (public@tjora.no) -# Mark Derricutt (mark@talios.com) -# Igor E. Poteryaev (jah@mail.ru) -# Yuri Filimonov (fil65@mail.ru) -# Stefan Hoffmeister (Stefan.Hoffmeister@Econos.de) -#************************************************************************ -# This source code is distributed with no WARRANTY, for no reason or use. -# Everyone is allowed to use and change this code free for his own tasks -# and projects, as long as this header and its copyright text is intact. -# For changed versions of this code, which are public distributed the -# following additional conditions have to be fullfilled: -# 1) The header has to contain a comment on the change and the author of -# it. -# 2) A copy of the changed source has to be sent to the above E-Mail -# address or my then valid address, if this is possible to the -# author. -# The second condition has the target to maintain an up to date central -# version of the component. If this condition is not acceptable for -# confidential or legal reasons, everyone is free to derive a component -# or to generate a diff file to my or other original sources. -# Dr. Dietmar Budelsky, 1997-11-17 -#************************************************************************ - -{.deadCodeElim: on.} - -import - dynlib - - -when defined(windows): - const dllname = "python(27|26|25|24|23|22|21|20|16|15).dll" -elif defined(macosx): - const dllname = "libpython(2.7|2.6|2.5|2.4|2.3|2.2|2.1|2.0|1.6|1.5).dylib" -else: - const dllver = ".1" - const dllname = "libpython(2.7|2.6|2.5|2.4|2.3|2.2|2.1|2.0|1.6|1.5).so" & - dllver - - -const - PYT_METHOD_BUFFER_INCREASE* = 10 - PYT_MEMBER_BUFFER_INCREASE* = 10 - PYT_GETSET_BUFFER_INCREASE* = 10 - METH_VARARGS* = 0x0001 - METH_KEYWORDS* = 0x0002 # Masks for the co_flags field of PyCodeObject - CO_OPTIMIZED* = 0x0001 - CO_NEWLOCALS* = 0x0002 - CO_VARARGS* = 0x0004 - CO_VARKEYWORDS* = 0x0008 - -type # Rich comparison opcodes introduced in version 2.1 - TRichComparisonOpcode* = enum - pyLT, pyLE, pyEQ, pyNE, pyGT, pyGE - -const - Py_TPFLAGS_HAVE_GETCHARBUFFER* = (1 shl 0) # PySequenceMethods contains sq_contains - Py_TPFLAGS_HAVE_SEQUENCE_IN* = (1 shl 1) # Objects which participate in garbage collection (see objimp.h) - Py_TPFLAGS_GC* = (1 shl 2) # PySequenceMethods and PyNumberMethods contain in-place operators - Py_TPFLAGS_HAVE_INPLACEOPS* = (1 shl 3) # PyNumberMethods do their own coercion */ - Py_TPFLAGS_CHECKTYPES* = (1 shl 4) - Py_TPFLAGS_HAVE_RICHCOMPARE* = (1 shl 5) # Objects which are weakly referencable if their tp_weaklistoffset is >0 - # XXX Should this have the same value as Py_TPFLAGS_HAVE_RICHCOMPARE? - # These both indicate a feature that appeared in the same alpha release. - Py_TPFLAGS_HAVE_WEAKREFS* = (1 shl 6) # tp_iter is defined - Py_TPFLAGS_HAVE_ITER* = (1 shl 7) # New members introduced by Python 2.2 exist - Py_TPFLAGS_HAVE_CLASS* = (1 shl 8) # Set if the type object is dynamically allocated - Py_TPFLAGS_HEAPTYPE* = (1 shl 9) # Set if the type allows subclassing - Py_TPFLAGS_BASETYPE* = (1 shl 10) # Set if the type is 'ready' -- fully initialized - Py_TPFLAGS_READY* = (1 shl 12) # Set while the type is being 'readied', to prevent recursive ready calls - Py_TPFLAGS_READYING* = (1 shl 13) # Objects support garbage collection (see objimp.h) - Py_TPFLAGS_HAVE_GC* = (1 shl 14) - Py_TPFLAGS_DEFAULT* = Py_TPFLAGS_HAVE_GETCHARBUFFER or - Py_TPFLAGS_HAVE_SEQUENCE_IN or Py_TPFLAGS_HAVE_INPLACEOPS or - Py_TPFLAGS_HAVE_RICHCOMPARE or Py_TPFLAGS_HAVE_WEAKREFS or - Py_TPFLAGS_HAVE_ITER or Py_TPFLAGS_HAVE_CLASS - -type - TPFlag* = enum - tpfHaveGetCharBuffer, tpfHaveSequenceIn, tpfGC, tpfHaveInplaceOps, - tpfCheckTypes, tpfHaveRichCompare, tpfHaveWeakRefs, tpfHaveIter, - tpfHaveClass, tpfHeapType, tpfBaseType, tpfReady, tpfReadying, tpfHaveGC - TPFlags* = set[TPFlag] - -const - TPFLAGS_DEFAULT* = {tpfHaveGetCharBuffer, tpfHaveSequenceIn, - tpfHaveInplaceOps, tpfHaveRichCompare, tpfHaveWeakRefs, tpfHaveIter, - tpfHaveClass} - -const # Python opcodes - single_input* = 256 - file_input* = 257 - eval_input* = 258 - funcdef* = 259 - parameters* = 260 - varargslist* = 261 - fpdef* = 262 - fplist* = 263 - stmt* = 264 - simple_stmt* = 265 - small_stmt* = 266 - expr_stmt* = 267 - augassign* = 268 - print_stmt* = 269 - del_stmt* = 270 - pass_stmt* = 271 - flow_stmt* = 272 - break_stmt* = 273 - continue_stmt* = 274 - return_stmt* = 275 - raise_stmt* = 276 - import_stmt* = 277 - import_as_name* = 278 - dotted_as_name* = 279 - dotted_name* = 280 - global_stmt* = 281 - exec_stmt* = 282 - assert_stmt* = 283 - compound_stmt* = 284 - if_stmt* = 285 - while_stmt* = 286 - for_stmt* = 287 - try_stmt* = 288 - except_clause* = 289 - suite* = 290 - test* = 291 - and_test* = 291 - not_test* = 293 - comparison* = 294 - comp_op* = 295 - expr* = 296 - xor_expr* = 297 - and_expr* = 298 - shift_expr* = 299 - arith_expr* = 300 - term* = 301 - factor* = 302 - power* = 303 - atom* = 304 - listmaker* = 305 - lambdef* = 306 - trailer* = 307 - subscriptlist* = 308 - subscript* = 309 - sliceop* = 310 - exprlist* = 311 - testlist* = 312 - dictmaker* = 313 - classdef* = 314 - arglist* = 315 - argument* = 316 - list_iter* = 317 - list_for* = 318 - list_if* = 319 - -const - T_SHORT* = 0 - T_INT* = 1 - T_LONG* = 2 - T_FLOAT* = 3 - T_DOUBLE* = 4 - T_STRING* = 5 - T_OBJECT* = 6 - T_CHAR* = 7 # 1-character string - T_BYTE* = 8 # 8-bit signed int - T_UBYTE* = 9 - T_USHORT* = 10 - T_UINT* = 11 - T_ULONG* = 12 - T_STRING_INPLACE* = 13 - T_OBJECT_EX* = 16 - READONLY* = 1 - RO* = READONLY # Shorthand - READ_RESTRICTED* = 2 - WRITE_RESTRICTED* = 4 - RESTRICTED* = (READ_RESTRICTED or WRITE_RESTRICTED) - -type - TPyMemberType* = enum - mtShort, mtInt, mtLong, mtFloat, mtDouble, mtString, mtObject, mtChar, - mtByte, mtUByte, mtUShort, mtUInt, mtULong, mtStringInplace, mtObjectEx - TPyMemberFlag* = enum - mfDefault, mfReadOnly, mfReadRestricted, mfWriteRestricted, mfRestricted - -type - PInt* = ptr int - -# PLong* = ptr int32 -# PFloat* = ptr float32 -# PShort* = ptr int8 - -type - PP_frozen* = ptr Pfrozen - P_frozen* = ptr Tfrozen - PPyObject* = ptr TPyObject - PPPyObject* = ptr PPyObject - PPPPyObject* = ptr PPPyObject - PPyIntObject* = ptr TPyIntObject - PPyTypeObject* = ptr TPyTypeObject - PPySliceObject* = ptr TPySliceObject - TPyCFunction* = proc (self, args: PPyObject): PPyObject{.cdecl.} - Tunaryfunc* = proc (ob1: PPyObject): PPyObject{.cdecl.} - Tbinaryfunc* = proc (ob1, ob2: PPyObject): PPyObject{.cdecl.} - Tternaryfunc* = proc (ob1, ob2, ob3: PPyObject): PPyObject{.cdecl.} - Tinquiry* = proc (ob1: PPyObject): int{.cdecl.} - Tcoercion* = proc (ob1, ob2: PPPyObject): int{.cdecl.} - Tintargfunc* = proc (ob1: PPyObject, i: int): PPyObject{.cdecl.} - Tintintargfunc* = proc (ob1: PPyObject, i1, i2: int): PPyObject{.cdecl.} - Tintobjargproc* = proc (ob1: PPyObject, i: int, ob2: PPyObject): int{.cdecl.} - Tintintobjargproc* = proc (ob1: PPyObject, i1, i2: int, ob2: PPyObject): int{. - cdecl.} - Tobjobjargproc* = proc (ob1, ob2, ob3: PPyObject): int{.cdecl.} - Tpydestructor* = proc (ob: PPyObject){.cdecl.} - Tprintfunc* = proc (ob: PPyObject, f: TFile, i: int): int{.cdecl.} - Tgetattrfunc* = proc (ob1: PPyObject, name: cstring): PPyObject{.cdecl.} - Tsetattrfunc* = proc (ob1: PPyObject, name: cstring, ob2: PPyObject): int{. - cdecl.} - Tcmpfunc* = proc (ob1, ob2: PPyObject): int{.cdecl.} - Treprfunc* = proc (ob: PPyObject): PPyObject{.cdecl.} - Thashfunc* = proc (ob: PPyObject): int32{.cdecl.} - Tgetattrofunc* = proc (ob1, ob2: PPyObject): PPyObject{.cdecl.} - Tsetattrofunc* = proc (ob1, ob2, ob3: PPyObject): int{.cdecl.} - Tgetreadbufferproc* = proc (ob1: PPyObject, i: int, p: Pointer): int{.cdecl.} - Tgetwritebufferproc* = proc (ob1: PPyObject, i: int, p: Pointer): int{.cdecl.} - Tgetsegcountproc* = proc (ob1: PPyObject, i: int): int{.cdecl.} - Tgetcharbufferproc* = proc (ob1: PPyObject, i: int, pstr: cstring): int{.cdecl.} - Tobjobjproc* = proc (ob1, ob2: PPyObject): int{.cdecl.} - Tvisitproc* = proc (ob1: PPyObject, p: Pointer): int{.cdecl.} - Ttraverseproc* = proc (ob1: PPyObject, prc: TVisitproc, p: Pointer): int{. - cdecl.} - Trichcmpfunc* = proc (ob1, ob2: PPyObject, i: int): PPyObject{.cdecl.} - Tgetiterfunc* = proc (ob1: PPyObject): PPyObject{.cdecl.} - Titernextfunc* = proc (ob1: PPyObject): PPyObject{.cdecl.} - Tdescrgetfunc* = proc (ob1, ob2, ob3: PPyObject): PPyObject{.cdecl.} - Tdescrsetfunc* = proc (ob1, ob2, ob3: PPyObject): int{.cdecl.} - Tinitproc* = proc (self, args, kwds: PPyObject): int{.cdecl.} - Tnewfunc* = proc (subtype: PPyTypeObject, args, kwds: PPyObject): PPyObject{. - cdecl.} - Tallocfunc* = proc (self: PPyTypeObject, nitems: int): PPyObject{.cdecl.} - TPyNumberMethods*{.final.} = object - nb_add*: Tbinaryfunc - nb_substract*: Tbinaryfunc - nb_multiply*: Tbinaryfunc - nb_divide*: Tbinaryfunc - nb_remainder*: Tbinaryfunc - nb_divmod*: Tbinaryfunc - nb_power*: Tternaryfunc - nb_negative*: Tunaryfunc - nb_positive*: Tunaryfunc - nb_absolute*: Tunaryfunc - nb_nonzero*: Tinquiry - nb_invert*: Tunaryfunc - nb_lshift*: Tbinaryfunc - nb_rshift*: Tbinaryfunc - nb_and*: Tbinaryfunc - nb_xor*: Tbinaryfunc - nb_or*: Tbinaryfunc - nb_coerce*: Tcoercion - nb_int*: Tunaryfunc - nb_long*: Tunaryfunc - nb_float*: Tunaryfunc - nb_oct*: Tunaryfunc - nb_hex*: Tunaryfunc #/ jah 29-sep-2000: updated for python 2.0 - #/ added from .h - nb_inplace_add*: Tbinaryfunc - nb_inplace_subtract*: Tbinaryfunc - nb_inplace_multiply*: Tbinaryfunc - nb_inplace_divide*: Tbinaryfunc - nb_inplace_remainder*: Tbinaryfunc - nb_inplace_power*: Tternaryfunc - nb_inplace_lshift*: Tbinaryfunc - nb_inplace_rshift*: Tbinaryfunc - nb_inplace_and*: Tbinaryfunc - nb_inplace_xor*: Tbinaryfunc - nb_inplace_or*: Tbinaryfunc # Added in release 2.2 - # The following require the Py_TPFLAGS_HAVE_CLASS flag - nb_floor_divide*: Tbinaryfunc - nb_true_divide*: Tbinaryfunc - nb_inplace_floor_divide*: Tbinaryfunc - nb_inplace_true_divide*: Tbinaryfunc - - PPyNumberMethods* = ptr TPyNumberMethods - TPySequenceMethods*{.final.} = object - sq_length*: Tinquiry - sq_concat*: Tbinaryfunc - sq_repeat*: Tintargfunc - sq_item*: Tintargfunc - sq_slice*: Tintintargfunc - sq_ass_item*: Tintobjargproc - sq_ass_slice*: Tintintobjargproc - sq_contains*: Tobjobjproc - sq_inplace_concat*: Tbinaryfunc - sq_inplace_repeat*: Tintargfunc - - PPySequenceMethods* = ptr TPySequenceMethods - TPyMappingMethods*{.final.} = object - mp_length*: Tinquiry - mp_subscript*: Tbinaryfunc - mp_ass_subscript*: Tobjobjargproc - - PPyMappingMethods* = ptr TPyMappingMethods - TPyBufferProcs*{.final.} = object - bf_getreadbuffer*: Tgetreadbufferproc - bf_getwritebuffer*: Tgetwritebufferproc - bf_getsegcount*: Tgetsegcountproc - bf_getcharbuffer*: Tgetcharbufferproc - - PPyBufferProcs* = ptr TPyBufferProcs - TPy_complex*{.final.} = object - float*: float64 - imag*: float64 - - TPyObject*{.pure, inheritable.} = object - ob_refcnt*: int - ob_type*: PPyTypeObject - - TPyIntObject* = object of TPyObject - ob_ival*: int32 - - PByte* = ptr int8 - Tfrozen*{.final.} = object - name*: cstring - code*: PByte - size*: int - - TPySliceObject* = object of TPyObject - start*, stop*, step*: PPyObject - - PPyMethodDef* = ptr TPyMethodDef - TPyMethodDef*{.final.} = object # structmember.h - ml_name*: cstring - ml_meth*: TPyCFunction - ml_flags*: int - ml_doc*: cstring - - PPyMemberDef* = ptr TPyMemberDef - TPyMemberDef*{.final.} = object # descrobject.h - # Descriptors - name*: cstring - theType*: int - offset*: int - flags*: int - doc*: cstring - - Tgetter* = proc (obj: PPyObject, context: Pointer): PPyObject{.cdecl.} - Tsetter* = proc (obj, value: PPyObject, context: Pointer): int{.cdecl.} - PPyGetSetDef* = ptr TPyGetSetDef - TPyGetSetDef*{.final.} = object - name*: cstring - get*: Tgetter - setter*: Tsetter - doc*: cstring - closure*: Pointer - - Twrapperfunc* = proc (self, args: PPyObject, wrapped: Pointer): PPyObject{. - cdecl.} - pwrapperbase* = ptr Twrapperbase - Twrapperbase*{.final.} = object # Various kinds of descriptor objects - ##define PyDescr_COMMON \ - # PyObject_HEAD \ - # PyTypeObject *d_type; \ - # PyObject *d_name - # - name*: cstring - wrapper*: Twrapperfunc - doc*: cstring - - PPyDescrObject* = ptr TPyDescrObject - TPyDescrObject* = object of TPyObject - d_type*: PPyTypeObject - d_name*: PPyObject - - PPyMethodDescrObject* = ptr TPyMethodDescrObject - TPyMethodDescrObject* = object of TPyDescrObject - d_method*: PPyMethodDef - - PPyMemberDescrObject* = ptr TPyMemberDescrObject - TPyMemberDescrObject* = object of TPyDescrObject - d_member*: PPyMemberDef - - PPyGetSetDescrObject* = ptr TPyGetSetDescrObject - TPyGetSetDescrObject* = object of TPyDescrObject - d_getset*: PPyGetSetDef - - PPyWrapperDescrObject* = ptr TPyWrapperDescrObject - TPyWrapperDescrObject* = object of TPyDescrObject # object.h - d_base*: pwrapperbase - d_wrapped*: Pointer # This can be any function pointer - - TPyTypeObject* = object of TPyObject - ob_size*: int # Number of items in variable part - tp_name*: cstring # For printing - tp_basicsize*, tp_itemsize*: int # For allocation - # Methods to implement standard operations - tp_dealloc*: Tpydestructor - tp_print*: Tprintfunc - tp_getattr*: Tgetattrfunc - tp_setattr*: Tsetattrfunc - tp_compare*: Tcmpfunc - tp_repr*: Treprfunc # Method suites for standard classes - tp_as_number*: PPyNumberMethods - tp_as_sequence*: PPySequenceMethods - tp_as_mapping*: PPyMappingMethods # More standard operations (here for binary compatibility) - tp_hash*: Thashfunc - tp_call*: Tternaryfunc - tp_str*: Treprfunc - tp_getattro*: Tgetattrofunc - tp_setattro*: Tsetattrofunc #/ jah 29-sep-2000: updated for python 2.0 - # Functions to access object as input/output buffer - tp_as_buffer*: PPyBufferProcs # Flags to define presence of optional/expanded features - tp_flags*: int32 - tp_doc*: cstring # Documentation string - # call function for all accessible objects - tp_traverse*: Ttraverseproc # delete references to contained objects - tp_clear*: Tinquiry # rich comparisons - tp_richcompare*: Trichcmpfunc # weak reference enabler - tp_weaklistoffset*: int32 # Iterators - tp_iter*: Tgetiterfunc - tp_iternext*: Titernextfunc # Attribute descriptor and subclassing stuff - tp_methods*: PPyMethodDef - tp_members*: PPyMemberDef - tp_getset*: PPyGetSetDef - tp_base*: PPyTypeObject - tp_dict*: PPyObject - tp_descr_get*: Tdescrgetfunc - tp_descr_set*: Tdescrsetfunc - tp_dictoffset*: int32 - tp_init*: Tinitproc - tp_alloc*: Tallocfunc - tp_new*: Tnewfunc - tp_free*: Tpydestructor # Low-level free-memory routine - tp_is_gc*: Tinquiry # For PyObject_IS_GC - tp_bases*: PPyObject - tp_mro*: PPyObject # method resolution order - tp_cache*: PPyObject - tp_subclasses*: PPyObject - tp_weaklist*: PPyObject #More spares - tp_xxx7*: pointer - tp_xxx8*: pointer - - PPyMethodChain* = ptr TPyMethodChain - TPyMethodChain*{.final.} = object - methods*: PPyMethodDef - link*: PPyMethodChain - - PPyClassObject* = ptr TPyClassObject - TPyClassObject* = object of TPyObject - cl_bases*: PPyObject # A tuple of class objects - cl_dict*: PPyObject # A dictionary - cl_name*: PPyObject # A string - # The following three are functions or NULL - cl_getattr*: PPyObject - cl_setattr*: PPyObject - cl_delattr*: PPyObject - - PPyInstanceObject* = ptr TPyInstanceObject - TPyInstanceObject* = object of TPyObject - in_class*: PPyClassObject # The class object - in_dict*: PPyObject # A dictionary - - PPyMethodObject* = ptr TPyMethodObject - TPyMethodObject* = object of TPyObject # Bytecode object, compile.h - im_func*: PPyObject # The function implementing the method - im_self*: PPyObject # The instance it is bound to, or NULL - im_class*: PPyObject # The class that defined the method - - PPyCodeObject* = ptr TPyCodeObject - TPyCodeObject* = object of TPyObject # from pystate.h - co_argcount*: int # #arguments, except *args - co_nlocals*: int # #local variables - co_stacksize*: int # #entries needed for evaluation stack - co_flags*: int # CO_..., see below - co_code*: PPyObject # instruction opcodes (it hides a PyStringObject) - co_consts*: PPyObject # list (constants used) - co_names*: PPyObject # list of strings (names used) - co_varnames*: PPyObject # tuple of strings (local variable names) - co_freevars*: PPyObject # tuple of strings (free variable names) - co_cellvars*: PPyObject # tuple of strings (cell variable names) - # The rest doesn't count for hash/cmp - co_filename*: PPyObject # string (where it was loaded from) - co_name*: PPyObject # string (name, for reference) - co_firstlineno*: int # first source line number - co_lnotab*: PPyObject # string (encoding addr<->lineno mapping) - - PPyInterpreterState* = ptr TPyInterpreterState - PPyThreadState* = ptr TPyThreadState - PPyFrameObject* = ptr TPyFrameObject # Interpreter environments - TPyInterpreterState*{.final.} = object # Thread specific information - next*: PPyInterpreterState - tstate_head*: PPyThreadState - modules*: PPyObject - sysdict*: PPyObject - builtins*: PPyObject - checkinterval*: int - - TPyThreadState*{.final.} = object # from frameobject.h - next*: PPyThreadState - interp*: PPyInterpreterState - frame*: PPyFrameObject - recursion_depth*: int - ticker*: int - tracing*: int - sys_profilefunc*: PPyObject - sys_tracefunc*: PPyObject - curexc_type*: PPyObject - curexc_value*: PPyObject - curexc_traceback*: PPyObject - exc_type*: PPyObject - exc_value*: PPyObject - exc_traceback*: PPyObject - dict*: PPyObject - - PPyTryBlock* = ptr TPyTryBlock - TPyTryBlock*{.final.} = object - b_type*: int # what kind of block this is - b_handler*: int # where to jump to find handler - b_level*: int # value stack level to pop to - - CO_MAXBLOCKS* = range[0..19] - TPyFrameObject* = object of TPyObject # start of the VAR_HEAD of an object - # From traceback.c - ob_size*: int # Number of items in variable part - # End of the Head of an object - f_back*: PPyFrameObject # previous frame, or NULL - f_code*: PPyCodeObject # code segment - f_builtins*: PPyObject # builtin symbol table (PyDictObject) - f_globals*: PPyObject # global symbol table (PyDictObject) - f_locals*: PPyObject # local symbol table (PyDictObject) - f_valuestack*: PPPyObject # points after the last local - # Next free slot in f_valuestack. Frame creation sets to f_valuestack. - # Frame evaluation usually NULLs it, but a frame that yields sets it - # to the current stack top. - f_stacktop*: PPPyObject - f_trace*: PPyObject # Trace function - f_exc_type*, f_exc_value*, f_exc_traceback*: PPyObject - f_tstate*: PPyThreadState - f_lasti*: int # Last instruction if called - f_lineno*: int # Current line number - f_restricted*: int # Flag set if restricted operations - # in this scope - f_iblock*: int # index in f_blockstack - f_blockstack*: array[CO_MAXBLOCKS, TPyTryBlock] # for try and loop blocks - f_nlocals*: int # number of locals - f_ncells*: int - f_nfreevars*: int - f_stacksize*: int # size of value stack - f_localsplus*: array[0..0, PPyObject] # locals+stack, dynamically sized - - PPyTraceBackObject* = ptr TPyTraceBackObject - TPyTraceBackObject* = object of TPyObject # Parse tree node interface - tb_next*: PPyTraceBackObject - tb_frame*: PPyFrameObject - tb_lasti*: int - tb_lineno*: int - - PNode* = ptr Tnode - Tnode*{.final.} = object # From weakrefobject.h - n_type*: int16 - n_str*: cstring - n_lineno*: int16 - n_nchildren*: int16 - n_child*: PNode - - PPyWeakReference* = ptr TPyWeakReference - TPyWeakReference* = object of TPyObject - wr_object*: PPyObject - wr_callback*: PPyObject - hash*: int32 - wr_prev*: PPyWeakReference - wr_next*: PPyWeakReference - - -const - PyDateTime_DATE_DATASIZE* = 4 # # of bytes for year, month, and day - PyDateTime_TIME_DATASIZE* = 6 # # of bytes for hour, minute, second, and usecond - PyDateTime_DATETIME_DATASIZE* = 10 # # of bytes for year, month, - # day, hour, minute, second, and usecond. - -type - TPyDateTime_Delta* = object of TPyObject - hashcode*: int # -1 when unknown - days*: int # -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS - seconds*: int # 0 <= seconds < 24*3600 is invariant - microseconds*: int # 0 <= microseconds < 1000000 is invariant - - PPyDateTime_Delta* = ptr TPyDateTime_Delta - TPyDateTime_TZInfo* = object of TPyObject # a pure abstract base clase - PPyDateTime_TZInfo* = ptr TPyDateTime_TZInfo - TPyDateTime_BaseTZInfo* = object of TPyObject - hashcode*: int - hastzinfo*: bool # boolean flag - - PPyDateTime_BaseTZInfo* = ptr TPyDateTime_BaseTZInfo - TPyDateTime_BaseTime* = object of TPyDateTime_BaseTZInfo - data*: array[0..Pred(PyDateTime_TIME_DATASIZE), int8] - - PPyDateTime_BaseTime* = ptr TPyDateTime_BaseTime - TPyDateTime_Time* = object of TPyDateTime_BaseTime # hastzinfo true - tzinfo*: PPyObject - - PPyDateTime_Time* = ptr TPyDateTime_Time - TPyDateTime_Date* = object of TPyDateTime_BaseTZInfo - data*: array[0..Pred(PyDateTime_DATE_DATASIZE), int8] - - PPyDateTime_Date* = ptr TPyDateTime_Date - TPyDateTime_BaseDateTime* = object of TPyDateTime_BaseTZInfo - data*: array[0..Pred(PyDateTime_DATETIME_DATASIZE), int8] - - PPyDateTime_BaseDateTime* = ptr TPyDateTime_BaseDateTime - TPyDateTime_DateTime* = object of TPyDateTime_BaseTZInfo - data*: array[0..Pred(PyDateTime_DATETIME_DATASIZE), int8] - tzinfo*: PPyObject - - PPyDateTime_DateTime* = ptr TPyDateTime_DateTime - -#----------------------------------------------------# -# # -# New exception classes # -# # -#----------------------------------------------------# - -# -# // Python's exceptions -# EPythonError = object(Exception) -# EName: String; -# EValue: String; -# end; -# EPyExecError = object(EPythonError) -# end; -# -# // Standard exception classes of Python -# -#/// jah 29-sep-2000: updated for python 2.0 -#/// base classes updated according python documentation -# -#{ Hierarchy of Python exceptions, Python 2.3, copied from <INSTALL>\Python\exceptions.c -# -#Exception\n\ -# |\n\ -# +-- SystemExit\n\ -# +-- StopIteration\n\ -# +-- StandardError\n\ -# | |\n\ -# | +-- KeyboardInterrupt\n\ -# | +-- ImportError\n\ -# | +-- EnvironmentError\n\ -# | | |\n\ -# | | +-- IOError\n\ -# | | +-- OSError\n\ -# | | |\n\ -# | | +-- WindowsError\n\ -# | | +-- VMSError\n\ -# | |\n\ -# | +-- EOFError\n\ -# | +-- RuntimeError\n\ -# | | |\n\ -# | | +-- NotImplementedError\n\ -# | |\n\ -# | +-- NameError\n\ -# | | |\n\ -# | | +-- UnboundLocalError\n\ -# | |\n\ -# | +-- AttributeError\n\ -# | +-- SyntaxError\n\ -# | | |\n\ -# | | +-- IndentationError\n\ -# | | |\n\ -# | | +-- TabError\n\ -# | |\n\ -# | +-- TypeError\n\ -# | +-- AssertionError\n\ -# | +-- LookupError\n\ -# | | |\n\ -# | | +-- IndexError\n\ -# | | +-- KeyError\n\ -# | |\n\ -# | +-- ArithmeticError\n\ -# | | |\n\ -# | | +-- OverflowError\n\ -# | | +-- ZeroDivisionError\n\ -# | | +-- FloatingPointError\n\ -# | |\n\ -# | +-- ValueError\n\ -# | | |\n\ -# | | +-- UnicodeError\n\ -# | | |\n\ -# | | +-- UnicodeEncodeError\n\ -# | | +-- UnicodeDecodeError\n\ -# | | +-- UnicodeTranslateError\n\ -# | |\n\ -# | +-- ReferenceError\n\ -# | +-- SystemError\n\ -# | +-- MemoryError\n\ -# |\n\ -# +---Warning\n\ -# |\n\ -# +-- UserWarning\n\ -# +-- DeprecationWarning\n\ -# +-- PendingDeprecationWarning\n\ -# +-- SyntaxWarning\n\ -# +-- OverflowWarning\n\ -# +-- RuntimeWarning\n\ -# +-- FutureWarning" -#} -# EPyException = class (EPythonError); -# EPyStandardError = class (EPyException); -# EPyArithmeticError = class (EPyStandardError); -# EPyLookupError = class (EPyStandardError); -# EPyAssertionError = class (EPyStandardError); -# EPyAttributeError = class (EPyStandardError); -# EPyEOFError = class (EPyStandardError); -# EPyFloatingPointError = class (EPyArithmeticError); -# EPyEnvironmentError = class (EPyStandardError); -# EPyIOError = class (EPyEnvironmentError); -# EPyOSError = class (EPyEnvironmentError); -# EPyImportError = class (EPyStandardError); -# EPyIndexError = class (EPyLookupError); -# EPyKeyError = class (EPyLookupError); -# EPyKeyboardInterrupt = class (EPyStandardError); -# EPyMemoryError = class (EPyStandardError); -# EPyNameError = class (EPyStandardError); -# EPyOverflowError = class (EPyArithmeticError); -# EPyRuntimeError = class (EPyStandardError); -# EPyNotImplementedError = class (EPyRuntimeError); -# EPySyntaxError = class (EPyStandardError) -# public -# EFileName: string; -# ELineStr: string; -# ELineNumber: Integer; -# EOffset: Integer; -# end; -# EPyIndentationError = class (EPySyntaxError); -# EPyTabError = class (EPyIndentationError); -# EPySystemError = class (EPyStandardError); -# EPySystemExit = class (EPyException); -# EPyTypeError = class (EPyStandardError); -# EPyUnboundLocalError = class (EPyNameError); -# EPyValueError = class (EPyStandardError); -# EPyUnicodeError = class (EPyValueError); -# UnicodeEncodeError = class (EPyUnicodeError); -# UnicodeDecodeError = class (EPyUnicodeError); -# UnicodeTranslateError = class (EPyUnicodeError); -# EPyZeroDivisionError = class (EPyArithmeticError); -# EPyStopIteration = class(EPyException); -# EPyWarning = class (EPyException); -# EPyUserWarning = class (EPyWarning); -# EPyDeprecationWarning = class (EPyWarning); -# PendingDeprecationWarning = class (EPyWarning); -# FutureWarning = class (EPyWarning); -# EPySyntaxWarning = class (EPyWarning); -# EPyOverflowWarning = class (EPyWarning); -# EPyRuntimeWarning = class (EPyWarning); -# EPyReferenceError = class (EPyStandardError); -# - -var - PyArg_Parse*: proc (args: PPyObject, format: cstring): int{.cdecl, varargs.} - PyArg_ParseTuple*: proc (args: PPyObject, format: cstring, x1: Pointer = nil, - x2: Pointer = nil, x3: Pointer = nil): int{.cdecl, varargs.} - Py_BuildValue*: proc (format: cstring): PPyObject{.cdecl, varargs.} - PyCode_Addr2Line*: proc (co: PPyCodeObject, addrq: int): int{.cdecl.} - DLL_Py_GetBuildInfo*: proc (): cstring{.cdecl.} - -var - Py_DebugFlag*: PInt - Py_VerboseFlag*: PInt - Py_InteractiveFlag*: PInt - Py_OptimizeFlag*: PInt - Py_NoSiteFlag*: PInt - Py_UseClassExceptionsFlag*: PInt - Py_FrozenFlag*: PInt - Py_TabcheckFlag*: PInt - Py_UnicodeFlag*: PInt - Py_IgnoreEnvironmentFlag*: PInt - Py_DivisionWarningFlag*: PInt - #_PySys_TraceFunc: PPPyObject; - #_PySys_ProfileFunc: PPPPyObject; - PyImport_FrozenModules*: PP_frozen - Py_None*: PPyObject - Py_Ellipsis*: PPyObject - Py_False*: PPyIntObject - Py_True*: PPyIntObject - Py_NotImplemented*: PPyObject - PyExc_AttributeError*: PPPyObject - PyExc_EOFError*: PPPyObject - PyExc_IOError*: PPPyObject - PyExc_ImportError*: PPPyObject - PyExc_IndexError*: PPPyObject - PyExc_KeyError*: PPPyObject - PyExc_KeyboardInterrupt*: PPPyObject - PyExc_MemoryError*: PPPyObject - PyExc_NameError*: PPPyObject - PyExc_OverflowError*: PPPyObject - PyExc_RuntimeError*: PPPyObject - PyExc_SyntaxError*: PPPyObject - PyExc_SystemError*: PPPyObject - PyExc_SystemExit*: PPPyObject - PyExc_TypeError*: PPPyObject - PyExc_ValueError*: PPPyObject - PyExc_ZeroDivisionError*: PPPyObject - PyExc_ArithmeticError*: PPPyObject - PyExc_Exception*: PPPyObject - PyExc_FloatingPointError*: PPPyObject - PyExc_LookupError*: PPPyObject - PyExc_StandardError*: PPPyObject - PyExc_AssertionError*: PPPyObject - PyExc_EnvironmentError*: PPPyObject - PyExc_IndentationError*: PPPyObject - PyExc_MemoryErrorInst*: PPPyObject - PyExc_NotImplementedError*: PPPyObject - PyExc_OSError*: PPPyObject - PyExc_TabError*: PPPyObject - PyExc_UnboundLocalError*: PPPyObject - PyExc_UnicodeError*: PPPyObject - PyExc_Warning*: PPPyObject - PyExc_DeprecationWarning*: PPPyObject - PyExc_RuntimeWarning*: PPPyObject - PyExc_SyntaxWarning*: PPPyObject - PyExc_UserWarning*: PPPyObject - PyExc_OverflowWarning*: PPPyObject - PyExc_ReferenceError*: PPPyObject - PyExc_StopIteration*: PPPyObject - PyExc_FutureWarning*: PPPyObject - PyExc_PendingDeprecationWarning*: PPPyObject - PyExc_UnicodeDecodeError*: PPPyObject - PyExc_UnicodeEncodeError*: PPPyObject - PyExc_UnicodeTranslateError*: PPPyObject - PyType_Type*: PPyTypeObject - PyCFunction_Type*: PPyTypeObject - PyCObject_Type*: PPyTypeObject - PyClass_Type*: PPyTypeObject - PyCode_Type*: PPyTypeObject - PyComplex_Type*: PPyTypeObject - PyDict_Type*: PPyTypeObject - PyFile_Type*: PPyTypeObject - PyFloat_Type*: PPyTypeObject - PyFrame_Type*: PPyTypeObject - PyFunction_Type*: PPyTypeObject - PyInstance_Type*: PPyTypeObject - PyInt_Type*: PPyTypeObject - PyList_Type*: PPyTypeObject - PyLong_Type*: PPyTypeObject - PyMethod_Type*: PPyTypeObject - PyModule_Type*: PPyTypeObject - PyObject_Type*: PPyTypeObject - PyRange_Type*: PPyTypeObject - PySlice_Type*: PPyTypeObject - PyString_Type*: PPyTypeObject - PyTuple_Type*: PPyTypeObject - PyBaseObject_Type*: PPyTypeObject - PyBuffer_Type*: PPyTypeObject - PyCallIter_Type*: PPyTypeObject - PyCell_Type*: PPyTypeObject - PyClassMethod_Type*: PPyTypeObject - PyProperty_Type*: PPyTypeObject - PySeqIter_Type*: PPyTypeObject - PyStaticMethod_Type*: PPyTypeObject - PySuper_Type*: PPyTypeObject - PySymtableEntry_Type*: PPyTypeObject - PyTraceBack_Type*: PPyTypeObject - PyUnicode_Type*: PPyTypeObject - PyWrapperDescr_Type*: PPyTypeObject - PyBaseString_Type*: PPyTypeObject - PyBool_Type*: PPyTypeObject - PyEnum_Type*: PPyTypeObject - - #PyArg_GetObject: proc(args: PPyObject; nargs, i: integer; p_a: PPPyObject): integer; cdecl; - #PyArg_GetLong: proc(args: PPyObject; nargs, i: integer; p_a: PLong): integer; cdecl; - #PyArg_GetShort: proc(args: PPyObject; nargs, i: integer; p_a: PShort): integer; cdecl; - #PyArg_GetFloat: proc(args: PPyObject; nargs, i: integer; p_a: PFloat): integer; cdecl; - #PyArg_GetString: proc(args: PPyObject; nargs, i: integer; p_a: PString): integer; cdecl; - #PyArgs_VaParse: proc (args: PPyObject; format: PChar; - # va_list: array of const): integer; cdecl; - # Does not work! - # Py_VaBuildValue: proc (format: PChar; va_list: array of const): PPyObject; cdecl; - #PyBuiltin_Init: proc; cdecl; -proc PyComplex_FromCComplex*(c: TPy_complex): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyComplex_FromDoubles*(realv, imag: float64): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyComplex_RealAsDouble*(op: PPyObject): float64{.cdecl, importc, dynlib: dllname.} -proc PyComplex_ImagAsDouble*(op: PPyObject): float64{.cdecl, importc, dynlib: dllname.} -proc PyComplex_AsCComplex*(op: PPyObject): TPy_complex{.cdecl, importc, dynlib: dllname.} -proc PyCFunction_GetFunction*(ob: PPyObject): Pointer{.cdecl, importc, dynlib: dllname.} -proc PyCFunction_GetSelf*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyCallable_Check*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} -proc PyCObject_FromVoidPtr*(cobj, destruct: Pointer): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyCObject_AsVoidPtr*(ob: PPyObject): Pointer{.cdecl, importc, dynlib: dllname.} -proc PyClass_New*(ob1, ob2, ob3: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyClass_IsSubclass*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} -proc Py_InitModule4*(name: cstring, methods: PPyMethodDef, doc: cstring, - passthrough: PPyObject, Api_Version: int): PPyObject{. - cdecl, importc, dynlib: dllname.} -proc PyErr_BadArgument*(): int{.cdecl, importc, dynlib: dllname.} -proc PyErr_BadInternalCall*(){.cdecl, importc, dynlib: dllname.} -proc PyErr_CheckSignals*(): int{.cdecl, importc, dynlib: dllname.} -proc PyErr_Clear*(){.cdecl, importc, dynlib: dllname.} -proc PyErr_Fetch*(errtype, errvalue, errtraceback: PPPyObject){.cdecl, importc, dynlib: dllname.} -proc PyErr_NoMemory*(): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyErr_Occurred*(): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyErr_Print*(){.cdecl, importc, dynlib: dllname.} -proc PyErr_Restore*(errtype, errvalue, errtraceback: PPyObject){.cdecl, importc, dynlib: dllname.} -proc PyErr_SetFromErrno*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyErr_SetNone*(value: PPyObject){.cdecl, importc, dynlib: dllname.} -proc PyErr_SetObject*(ob1, ob2: PPyObject){.cdecl, importc, dynlib: dllname.} -proc PyErr_SetString*(ErrorObject: PPyObject, text: cstring){.cdecl, importc, dynlib: dllname.} -proc PyImport_GetModuleDict*(): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyInt_FromLong*(x: int32): PPyObject{.cdecl, importc, dynlib: dllname.} -proc Py_Initialize*(){.cdecl, importc, dynlib: dllname.} -proc Py_Exit*(RetVal: int){.cdecl, importc, dynlib: dllname.} -proc PyEval_GetBuiltins*(): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_GetItem*(mp, key: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_SetItem*(mp, key, item: PPyObject): int{.cdecl, importc, dynlib: dllname.} -proc PyDict_DelItem*(mp, key: PPyObject): int{.cdecl, importc, dynlib: dllname.} -proc PyDict_Clear*(mp: PPyObject){.cdecl, importc, dynlib: dllname.} -proc PyDict_Next*(mp: PPyObject, pos: PInt, key, value: PPPyObject): int{. - cdecl, importc, dynlib: dllname.} -proc PyDict_Keys*(mp: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_Values*(mp: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_Items*(mp: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_Size*(mp: PPyObject): int{.cdecl, importc, dynlib: dllname.} -proc PyDict_DelItemString*(dp: PPyObject, key: cstring): int{.cdecl, importc, dynlib: dllname.} -proc PyDict_New*(): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_GetItemString*(dp: PPyObject, key: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyDict_SetItemString*(dp: PPyObject, key: cstring, item: PPyObject): int{. - cdecl, importc, dynlib: dllname.} -proc PyDictProxy_New*(obj: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyModule_GetDict*(module: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyObject_Str*(v: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyRun_String*(str: cstring, start: int, globals: PPyObject, - locals: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyRun_SimpleString*(str: cstring): int{.cdecl, importc, dynlib: dllname.} -proc PyString_AsString*(ob: PPyObject): cstring{.cdecl, importc, dynlib: dllname.} -proc PyString_FromString*(str: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PySys_SetArgv*(argc: int, argv: cstringArray){.cdecl, importc, dynlib: dllname.} - #+ means, Grzegorz or me has tested his non object version of this function - #+ -proc PyCFunction_New*(md: PPyMethodDef, ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyEval_CallObject*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyEval_CallObjectWithKeywords*(ob1, ob2, ob3: PPyObject): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc PyEval_GetFrame*(): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyEval_GetGlobals*(): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyEval_GetLocals*(): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyEval_GetOwner*(): PPyObject {.cdecl, importc, dynlib: dllname.} -proc PyEval_GetRestricted*(): int{.cdecl, importc, dynlib: dllname.} #- -proc PyEval_InitThreads*(){.cdecl, importc, dynlib: dllname.} #- -proc PyEval_RestoreThread*(tstate: PPyThreadState){.cdecl, importc, dynlib: dllname.} #- -proc PyEval_SaveThread*(): PPyThreadState{.cdecl, importc, dynlib: dllname.} #- -proc PyFile_FromString*(pc1, pc2: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyFile_GetLine*(ob: PPyObject, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyFile_Name*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyFile_SetBufSize*(ob: PPyObject, i: int){.cdecl, importc, dynlib: dllname.} #- -proc PyFile_SoftSpace*(ob: PPyObject, i: int): int{.cdecl, importc, dynlib: dllname.} #- -proc PyFile_WriteObject*(ob1, ob2: PPyObject, i: int): int{.cdecl, importc, dynlib: dllname.} #- -proc PyFile_WriteString*(s: cstring, ob: PPyObject){.cdecl, importc, dynlib: dllname.} #+ -proc PyFloat_AsDouble*(ob: PPyObject): float64{.cdecl, importc, dynlib: dllname.} #+ -proc PyFloat_FromDouble*(db: float64): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyFunction_GetCode*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyFunction_GetGlobals*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyFunction_New*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyImport_AddModule*(name: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyImport_Cleanup*(){.cdecl, importc, dynlib: dllname.} #- -proc PyImport_GetMagicNumber*(): int32{.cdecl, importc, dynlib: dllname.} #+ -proc PyImport_ImportFrozenModule*(key: cstring): int{.cdecl, importc, dynlib: dllname.} #+ -proc PyImport_ImportModule*(name: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyImport_Import*(name: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- - -proc PyImport_Init*() {.cdecl, importc, dynlib: dllname.} -proc PyImport_ReloadModule*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyInstance_New*(obClass, obArg, obKW: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyInt_AsLong*(ob: PPyObject): int32{.cdecl, importc, dynlib: dllname.} #- -proc PyList_Append*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyList_AsTuple*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyList_GetItem*(ob: PPyObject, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyList_GetSlice*(ob: PPyObject, i1, i2: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyList_Insert*(dp: PPyObject, idx: int, item: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyList_New*(size: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyList_Reverse*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyList_SetItem*(dp: PPyObject, idx: int, item: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyList_SetSlice*(ob: PPyObject, i1, i2: int, ob2: PPyObject): int{. - cdecl, importc, dynlib: dllname.} #+ -proc PyList_Size*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyList_Sort*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyLong_AsDouble*(ob: PPyObject): float64{.cdecl, importc, dynlib: dllname.} #+ -proc PyLong_AsLong*(ob: PPyObject): int32{.cdecl, importc, dynlib: dllname.} #+ -proc PyLong_FromDouble*(db: float64): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyLong_FromLong*(L: int32): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyLong_FromString*(pc: cstring, ppc: var cstring, i: int): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc PyLong_FromUnsignedLong*(val: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyLong_AsUnsignedLong*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyLong_FromUnicode*(ob: PPyObject, a, b: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyLong_FromLongLong*(val: Int64): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyLong_AsLongLong*(ob: PPyObject): Int64{.cdecl, importc, dynlib: dllname.} #- -proc PyMapping_Check*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyMapping_GetItemString*(ob: PPyObject, key: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyMapping_HasKey*(ob, key: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyMapping_HasKeyString*(ob: PPyObject, key: cstring): int{.cdecl, importc, dynlib: dllname.} #- -proc PyMapping_Length*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyMapping_SetItemString*(ob: PPyObject, key: cstring, value: PPyObject): int{. - cdecl, importc, dynlib: dllname.} #- -proc PyMethod_Class*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyMethod_Function*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyMethod_New*(ob1, ob2, ob3: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyMethod_Self*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyModule_GetName*(ob: PPyObject): cstring{.cdecl, importc, dynlib: dllname.} #- -proc PyModule_New*(key: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Absolute*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Add*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_And*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Check*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Coerce*(ob1, ob2: var PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Divide*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_FloorDivide*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_TrueDivide*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Divmod*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Float*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Int*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Invert*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Long*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Lshift*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Multiply*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Negative*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Or*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Positive*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Power*(ob1, ob2, ob3: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Remainder*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Rshift*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Subtract*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyNumber_Xor*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyOS_InitInterrupts*(){.cdecl, importc, dynlib: dllname.} #- -proc PyOS_InterruptOccurred*(): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_CallObject*(ob, args: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_Compare*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GetAttr*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyObject_GetAttrString*(ob: PPyObject, c: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GetItem*(ob, key: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_DelItem*(ob, key: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_HasAttrString*(ob: PPyObject, key: cstring): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_Hash*(ob: PPyObject): int32{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_IsTrue*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_Length*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_Repr*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_SetAttr*(ob1, ob2, ob3: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_SetAttrString*(ob: PPyObject, key: cstring, value: PPyObject): int{. - cdecl, importc, dynlib: dllname.} #- -proc PyObject_SetItem*(ob1, ob2, ob3: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_Init*(ob: PPyObject, t: PPyTypeObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_InitVar*(ob: PPyObject, t: PPyTypeObject, size: int): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc PyObject_New*(t: PPyTypeObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_NewVar*(t: PPyTypeObject, size: int): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyObject_Free*(ob: PPyObject){.cdecl, importc, dynlib: dllname.} #- -proc PyObject_IsInstance*(inst, cls: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_IsSubclass*(derived, cls: PPyObject): int{.cdecl, importc, dynlib: dllname.} -proc PyObject_GenericGetAttr*(obj, name: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyObject_GenericSetAttr*(obj, name, value: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_Malloc*(size: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_New*(t: PPyTypeObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_NewVar*(t: PPyTypeObject, size: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_Resize*(t: PPyObject, newsize: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_Del*(ob: PPyObject){.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_Track*(ob: PPyObject){.cdecl, importc, dynlib: dllname.} #- -proc PyObject_GC_UnTrack*(ob: PPyObject){.cdecl, importc, dynlib: dllname.} #- -proc PyRange_New*(l1, l2, l3: int32, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Check*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Concat*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Count*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_GetItem*(ob: PPyObject, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_GetSlice*(ob: PPyObject, i1, i2: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_In*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Index*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Length*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Repeat*(ob: PPyObject, count: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_SetItem*(ob: PPyObject, i: int, value: PPyObject): int{. - cdecl, importc, dynlib: dllname.} #- -proc PySequence_SetSlice*(ob: PPyObject, i1, i2: int, value: PPyObject): int{. - cdecl, importc, dynlib: dllname.} #- -proc PySequence_DelSlice*(ob: PPyObject, i1, i2: int): int{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Tuple*(ob: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PySequence_Contains*(ob, value: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySlice_GetIndices*(ob: PPySliceObject, len: int, - start, stop, step: var int): int{.cdecl, importc, dynlib: dllname.} #- -proc PySlice_GetIndicesEx*(ob: PPySliceObject, len: int, - start, stop, step, slicelength: var int): int{. - cdecl, importc, dynlib: dllname.} #- -proc PySlice_New*(start, stop, step: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyString_Concat*(ob1: var PPyObject, ob2: PPyObject){.cdecl, importc, dynlib: dllname.} #- -proc PyString_ConcatAndDel*(ob1: var PPyObject, ob2: PPyObject){.cdecl, importc, dynlib: dllname.} #- -proc PyString_Format*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyString_FromStringAndSize*(s: cstring, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyString_Size*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyString_DecodeEscape*(s: cstring, length: int, errors: cstring, - unicode: int, recode_encoding: cstring): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc PyString_Repr*(ob: PPyObject, smartquotes: int): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PySys_GetObject*(s: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} -#- -#PySys_Init:procedure; cdecl, importc, dynlib: dllname; -#- -proc PySys_SetObject*(s: cstring, ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PySys_SetPath*(path: cstring){.cdecl, importc, dynlib: dllname.} #- -#PyTraceBack_Fetch:function:PPyObject; cdecl, importc, dynlib: dllname; -#- -proc PyTraceBack_Here*(p: pointer): int{.cdecl, importc, dynlib: dllname.} #- -proc PyTraceBack_Print*(ob1, ob2: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -#PyTraceBack_Store:function (ob:PPyObject):integer; cdecl, importc, dynlib: dllname; -#+ -proc PyTuple_GetItem*(ob: PPyObject, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc PyTuple_GetSlice*(ob: PPyObject, i1, i2: int): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyTuple_New*(size: int): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyTuple_SetItem*(ob: PPyObject, key: int, value: PPyObject): int{.cdecl, importc, dynlib: dllname.} #+ -proc PyTuple_Size*(ob: PPyObject): int{.cdecl, importc, dynlib: dllname.} #+ -proc PyType_IsSubtype*(a, b: PPyTypeObject): int{.cdecl, importc, dynlib: dllname.} -proc PyType_GenericAlloc*(atype: PPyTypeObject, nitems: int): PPyObject{. - cdecl, importc, dynlib: dllname.} -proc PyType_GenericNew*(atype: PPyTypeObject, args, kwds: PPyObject): PPyObject{. - cdecl, importc, dynlib: dllname.} -proc PyType_Ready*(atype: PPyTypeObject): int{.cdecl, importc, dynlib: dllname.} #+ -proc PyUnicode_FromWideChar*(w: pointer, size: int): PPyObject{.cdecl, importc, dynlib: dllname.} #+ -proc PyUnicode_AsWideChar*(unicode: PPyObject, w: pointer, size: int): int{. - cdecl, importc, dynlib: dllname.} #- -proc PyUnicode_FromOrdinal*(ordinal: int): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyWeakref_GetObject*(theRef: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyWeakref_NewProxy*(ob, callback: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyWeakref_NewRef*(ob, callback: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyWrapper_New*(ob1, ob2: PPyObject): PPyObject{.cdecl, importc, dynlib: dllname.} -proc PyBool_FromLong*(ok: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc Py_AtExit*(prc: proc () {.cdecl.}): int{.cdecl, importc, dynlib: dllname.} #- -#Py_Cleanup:procedure; cdecl, importc, dynlib: dllname; -#- -proc Py_CompileString*(s1, s2: cstring, i: int): PPyObject{.cdecl, importc, dynlib: dllname.} #- -proc Py_FatalError*(s: cstring){.cdecl, importc, dynlib: dllname.} #- -proc Py_FindMethod*(md: PPyMethodDef, ob: PPyObject, key: cstring): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc Py_FindMethodInChain*(mc: PPyMethodChain, ob: PPyObject, key: cstring): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc Py_FlushLine*(){.cdecl, importc, dynlib: dllname.} #+ -proc Py_Finalize*(){.cdecl, importc, dynlib: dllname.} #- -proc PyErr_ExceptionMatches*(exc: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyErr_GivenExceptionMatches*(raised_exc, exc: PPyObject): int{.cdecl, importc, dynlib: dllname.} #- -proc PyEval_EvalCode*(co: PPyCodeObject, globals, locals: PPyObject): PPyObject{. - cdecl, importc, dynlib: dllname.} #+ -proc Py_GetVersion*(): cstring{.cdecl, importc, dynlib: dllname.} #+ -proc Py_GetCopyright*(): cstring{.cdecl, importc, dynlib: dllname.} #+ -proc Py_GetExecPrefix*(): cstring{.cdecl, importc, dynlib: dllname.} #+ -proc Py_GetPath*(): cstring{.cdecl, importc, dynlib: dllname.} #+ -proc Py_GetPrefix*(): cstring{.cdecl, importc, dynlib: dllname.} #+ -proc Py_GetProgramName*(): cstring{.cdecl, importc, dynlib: dllname.} #- -proc PyParser_SimpleParseString*(str: cstring, start: int): PNode{.cdecl, importc, dynlib: dllname.} #- -proc PyNode_Free*(n: PNode){.cdecl, importc, dynlib: dllname.} #- -proc PyErr_NewException*(name: cstring, base, dict: PPyObject): PPyObject{. - cdecl, importc, dynlib: dllname.} #- -proc Py_Malloc*(size: int): Pointer {.cdecl, importc, dynlib: dllname.} -proc PyMem_Malloc*(size: int): Pointer {.cdecl, importc, dynlib: dllname.} -proc PyObject_CallMethod*(obj: PPyObject, theMethod, - format: cstring): PPyObject{.cdecl, importc, dynlib: dllname.} -proc Py_SetProgramName*(name: cstring){.cdecl, importc, dynlib: dllname.} -proc Py_IsInitialized*(): int{.cdecl, importc, dynlib: dllname.} -proc Py_GetProgramFullPath*(): cstring{.cdecl, importc, dynlib: dllname.} -proc Py_NewInterpreter*(): PPyThreadState{.cdecl, importc, dynlib: dllname.} -proc Py_EndInterpreter*(tstate: PPyThreadState){.cdecl, importc, dynlib: dllname.} -proc PyEval_AcquireLock*(){.cdecl, importc, dynlib: dllname.} -proc PyEval_ReleaseLock*(){.cdecl, importc, dynlib: dllname.} -proc PyEval_AcquireThread*(tstate: PPyThreadState){.cdecl, importc, dynlib: dllname.} -proc PyEval_ReleaseThread*(tstate: PPyThreadState){.cdecl, importc, dynlib: dllname.} -proc PyInterpreterState_New*(): PPyInterpreterState{.cdecl, importc, dynlib: dllname.} -proc PyInterpreterState_Clear*(interp: PPyInterpreterState){.cdecl, importc, dynlib: dllname.} -proc PyInterpreterState_Delete*(interp: PPyInterpreterState){.cdecl, importc, dynlib: dllname.} -proc PyThreadState_New*(interp: PPyInterpreterState): PPyThreadState{.cdecl, importc, dynlib: dllname.} -proc PyThreadState_Clear*(tstate: PPyThreadState){.cdecl, importc, dynlib: dllname.} -proc PyThreadState_Delete*(tstate: PPyThreadState){.cdecl, importc, dynlib: dllname.} -proc PyThreadState_Get*(): PPyThreadState{.cdecl, importc, dynlib: dllname.} -proc PyThreadState_Swap*(tstate: PPyThreadState): PPyThreadState{.cdecl, importc, dynlib: dllname.} - -#Further exported Objects, may be implemented later -# -# PyCode_New: Pointer; -# PyErr_SetInterrupt: Pointer; -# PyFile_AsFile: Pointer; -# PyFile_FromFile: Pointer; -# PyFloat_AsString: Pointer; -# PyFrame_BlockPop: Pointer; -# PyFrame_BlockSetup: Pointer; -# PyFrame_ExtendStack: Pointer; -# PyFrame_FastToLocals: Pointer; -# PyFrame_LocalsToFast: Pointer; -# PyFrame_New: Pointer; -# PyGrammar_AddAccelerators: Pointer; -# PyGrammar_FindDFA: Pointer; -# PyGrammar_LabelRepr: Pointer; -# PyInstance_DoBinOp: Pointer; -# PyInt_GetMax: Pointer; -# PyMarshal_Init: Pointer; -# PyMarshal_ReadLongFromFile: Pointer; -# PyMarshal_ReadObjectFromFile: Pointer; -# PyMarshal_ReadObjectFromString: Pointer; -# PyMarshal_WriteLongToFile: Pointer; -# PyMarshal_WriteObjectToFile: Pointer; -# PyMember_Get: Pointer; -# PyMember_Set: Pointer; -# PyNode_AddChild: Pointer; -# PyNode_Compile: Pointer; -# PyNode_New: Pointer; -# PyOS_GetLastModificationTime: Pointer; -# PyOS_Readline: Pointer; -# PyOS_strtol: Pointer; -# PyOS_strtoul: Pointer; -# PyObject_CallFunction: Pointer; -# PyObject_CallMethod: Pointer; -# PyObject_Print: Pointer; -# PyParser_AddToken: Pointer; -# PyParser_Delete: Pointer; -# PyParser_New: Pointer; -# PyParser_ParseFile: Pointer; -# PyParser_ParseString: Pointer; -# PyParser_SimpleParseFile: Pointer; -# PyRun_AnyFile: Pointer; -# PyRun_File: Pointer; -# PyRun_InteractiveLoop: Pointer; -# PyRun_InteractiveOne: Pointer; -# PyRun_SimpleFile: Pointer; -# PySys_GetFile: Pointer; -# PyToken_OneChar: Pointer; -# PyToken_TwoChars: Pointer; -# PyTokenizer_Free: Pointer; -# PyTokenizer_FromFile: Pointer; -# PyTokenizer_FromString: Pointer; -# PyTokenizer_Get: Pointer; -# Py_Main: Pointer; -# _PyObject_NewVar: Pointer; -# _PyParser_Grammar: Pointer; -# _PyParser_TokenNames: Pointer; -# _PyThread_Started: Pointer; -# _Py_c_diff: Pointer; -# _Py_c_neg: Pointer; -# _Py_c_pow: Pointer; -# _Py_c_prod: Pointer; -# _Py_c_quot: Pointer; -# _Py_c_sum: Pointer; -# - -# This function handles all cardinals, pointer types (with no adjustment of pointers!) -# (Extended) floats, which are handled as Python doubles and currencies, handled -# as (normalized) Python doubles. -proc PyImport_ExecCodeModule*(name: String, codeobject: PPyObject): PPyObject -proc PyString_Check*(obj: PPyObject): bool -proc PyString_CheckExact*(obj: PPyObject): bool -proc PyFloat_Check*(obj: PPyObject): bool -proc PyFloat_CheckExact*(obj: PPyObject): bool -proc PyInt_Check*(obj: PPyObject): bool -proc PyInt_CheckExact*(obj: PPyObject): bool -proc PyLong_Check*(obj: PPyObject): bool -proc PyLong_CheckExact*(obj: PPyObject): bool -proc PyTuple_Check*(obj: PPyObject): bool -proc PyTuple_CheckExact*(obj: PPyObject): bool -proc PyInstance_Check*(obj: PPyObject): bool -proc PyClass_Check*(obj: PPyObject): bool -proc PyMethod_Check*(obj: PPyObject): bool -proc PyList_Check*(obj: PPyObject): bool -proc PyList_CheckExact*(obj: PPyObject): bool -proc PyDict_Check*(obj: PPyObject): bool -proc PyDict_CheckExact*(obj: PPyObject): bool -proc PyModule_Check*(obj: PPyObject): bool -proc PyModule_CheckExact*(obj: PPyObject): bool -proc PySlice_Check*(obj: PPyObject): bool -proc PyFunction_Check*(obj: PPyObject): bool -proc PyUnicode_Check*(obj: PPyObject): bool -proc PyUnicode_CheckExact*(obj: PPyObject): bool -proc PyType_IS_GC*(t: PPyTypeObject): bool -proc PyObject_IS_GC*(obj: PPyObject): bool -proc PyBool_Check*(obj: PPyObject): bool -proc PyBaseString_Check*(obj: PPyObject): bool -proc PyEnum_Check*(obj: PPyObject): bool -proc PyObject_TypeCheck*(obj: PPyObject, t: PPyTypeObject): bool -proc Py_InitModule*(name: cstring, md: PPyMethodDef): PPyObject -proc PyType_HasFeature*(AType: PPyTypeObject, AFlag: int): bool -# implementation - -proc Py_INCREF*(op: PPyObject) {.inline.} = - Inc(op.ob_refcnt) - -proc Py_DECREF*(op: PPyObject) {.inline.} = - Dec(op.ob_refcnt) - if op.ob_refcnt == 0: - op.ob_type.tp_dealloc(op) - -proc Py_XINCREF*(op: PPyObject) {.inline.} = - if op != nil: Py_INCREF(op) - -proc Py_XDECREF*(op: PPyObject) {.inline.} = - if op != nil: Py_DECREF(op) - -proc PyImport_ExecCodeModule(name: string, codeobject: PPyObject): PPyObject = - var m, d, v, modules: PPyObject - m = PyImport_AddModule(cstring(name)) - if m == nil: - return nil - d = PyModule_GetDict(m) - if PyDict_GetItemString(d, "__builtins__") == nil: - if PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins()) != 0: - return nil - if PyDict_SetItemString(d, "__file__", - PPyCodeObject(codeobject).co_filename) != 0: - PyErr_Clear() # Not important enough to report - v = PyEval_EvalCode(PPyCodeObject(codeobject), d, d) # XXX owner ? - if v == nil: - return nil - Py_XDECREF(v) - modules = PyImport_GetModuleDict() - if PyDict_GetItemString(modules, cstring(name)) == nil: - PyErr_SetString(PyExc_ImportError[] , cstring( - "Loaded module " & name & "not found in sys.modules")) - return nil - Py_XINCREF(m) - Result = m - -proc PyString_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyString_Type) - -proc PyString_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyString_Type) - -proc PyFloat_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyFloat_Type) - -proc PyFloat_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyFloat_Type) - -proc PyInt_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyInt_Type) - -proc PyInt_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyInt_Type) - -proc PyLong_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyLong_Type) - -proc PyLong_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyLong_Type) - -proc PyTuple_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyTuple_Type) - -proc PyTuple_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyTuple_Type) - -proc PyInstance_Check(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyInstance_Type) - -proc PyClass_Check(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyClass_Type) - -proc PyMethod_Check(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyMethod_Type) - -proc PyList_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyList_Type) - -proc PyList_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyList_Type) - -proc PyDict_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyDict_Type) - -proc PyDict_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyDict_Type) - -proc PyModule_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyModule_Type) - -proc PyModule_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PyModule_Type) - -proc PySlice_Check(obj: PPyObject): bool = - Result = (obj != nil) and (obj[].ob_type == PySlice_Type) - -proc PyFunction_Check(obj: PPyObject): bool = - Result = (obj != nil) and - ((obj.ob_type == PyCFunction_Type) or - (obj.ob_type == PyFunction_Type)) - -proc PyUnicode_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyUnicode_Type) - -proc PyUnicode_CheckExact(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyUnicode_Type) - -proc PyType_IS_GC(t: PPyTypeObject): bool = - Result = PyType_HasFeature(t, Py_TPFLAGS_HAVE_GC) - -proc PyObject_IS_GC(obj: PPyObject): bool = - Result = PyType_IS_GC(obj.ob_type) and - ((obj.ob_type.tp_is_gc == nil) or (obj.ob_type.tp_is_gc(obj) == 1)) - -proc PyBool_Check(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyBool_Type) - -proc PyBaseString_Check(obj: PPyObject): bool = - Result = PyObject_TypeCheck(obj, PyBaseString_Type) - -proc PyEnum_Check(obj: PPyObject): bool = - Result = (obj != nil) and (obj.ob_type == PyEnum_Type) - -proc PyObject_TypeCheck(obj: PPyObject, t: PPyTypeObject): bool = - Result = (obj != nil) and (obj.ob_type == t) - if not Result and (obj != nil) and (t != nil): - Result = PyType_IsSubtype(obj.ob_type, t) == 1 - -proc Py_InitModule(name: cstring, md: PPyMethodDef): PPyObject = - result = Py_InitModule4(name, md, nil, nil, 1012) - -proc PyType_HasFeature(AType: PPyTypeObject, AFlag: int): bool = - #(((t)->tp_flags & (f)) != 0) - Result = (AType.tp_flags and AFlag) != 0 - -proc init(lib: TLibHandle) = - Py_DebugFlag = cast[PInt](symAddr(lib, "Py_DebugFlag")) - Py_VerboseFlag = cast[PInt](symAddr(lib, "Py_VerboseFlag")) - Py_InteractiveFlag = cast[PInt](symAddr(lib, "Py_InteractiveFlag")) - Py_OptimizeFlag = cast[PInt](symAddr(lib, "Py_OptimizeFlag")) - Py_NoSiteFlag = cast[PInt](symAddr(lib, "Py_NoSiteFlag")) - Py_UseClassExceptionsFlag = cast[PInt](symAddr(lib, "Py_UseClassExceptionsFlag")) - Py_FrozenFlag = cast[PInt](symAddr(lib, "Py_FrozenFlag")) - Py_TabcheckFlag = cast[PInt](symAddr(lib, "Py_TabcheckFlag")) - Py_UnicodeFlag = cast[PInt](symAddr(lib, "Py_UnicodeFlag")) - Py_IgnoreEnvironmentFlag = cast[PInt](symAddr(lib, "Py_IgnoreEnvironmentFlag")) - Py_DivisionWarningFlag = cast[PInt](symAddr(lib, "Py_DivisionWarningFlag")) - Py_None = cast[PPyObject](symAddr(lib, "_Py_NoneStruct")) - Py_Ellipsis = cast[PPyObject](symAddr(lib, "_Py_EllipsisObject")) - Py_False = cast[PPyIntObject](symAddr(lib, "_Py_ZeroStruct")) - Py_True = cast[PPyIntObject](symAddr(lib, "_Py_TrueStruct")) - Py_NotImplemented = cast[PPyObject](symAddr(lib, "_Py_NotImplementedStruct")) - PyImport_FrozenModules = cast[PP_frozen](symAddr(lib, "PyImport_FrozenModules")) - PyExc_AttributeError = cast[PPPyObject](symAddr(lib, "PyExc_AttributeError")) - PyExc_EOFError = cast[PPPyObject](symAddr(lib, "PyExc_EOFError")) - PyExc_IOError = cast[PPPyObject](symAddr(lib, "PyExc_IOError")) - PyExc_ImportError = cast[PPPyObject](symAddr(lib, "PyExc_ImportError")) - PyExc_IndexError = cast[PPPyObject](symAddr(lib, "PyExc_IndexError")) - PyExc_KeyError = cast[PPPyObject](symAddr(lib, "PyExc_KeyError")) - PyExc_KeyboardInterrupt = cast[PPPyObject](symAddr(lib, "PyExc_KeyboardInterrupt")) - PyExc_MemoryError = cast[PPPyObject](symAddr(lib, "PyExc_MemoryError")) - PyExc_NameError = cast[PPPyObject](symAddr(lib, "PyExc_NameError")) - PyExc_OverflowError = cast[PPPyObject](symAddr(lib, "PyExc_OverflowError")) - PyExc_RuntimeError = cast[PPPyObject](symAddr(lib, "PyExc_RuntimeError")) - PyExc_SyntaxError = cast[PPPyObject](symAddr(lib, "PyExc_SyntaxError")) - PyExc_SystemError = cast[PPPyObject](symAddr(lib, "PyExc_SystemError")) - PyExc_SystemExit = cast[PPPyObject](symAddr(lib, "PyExc_SystemExit")) - PyExc_TypeError = cast[PPPyObject](symAddr(lib, "PyExc_TypeError")) - PyExc_ValueError = cast[PPPyObject](symAddr(lib, "PyExc_ValueError")) - PyExc_ZeroDivisionError = cast[PPPyObject](symAddr(lib, "PyExc_ZeroDivisionError")) - PyExc_ArithmeticError = cast[PPPyObject](symAddr(lib, "PyExc_ArithmeticError")) - PyExc_Exception = cast[PPPyObject](symAddr(lib, "PyExc_Exception")) - PyExc_FloatingPointError = cast[PPPyObject](symAddr(lib, "PyExc_FloatingPointError")) - PyExc_LookupError = cast[PPPyObject](symAddr(lib, "PyExc_LookupError")) - PyExc_StandardError = cast[PPPyObject](symAddr(lib, "PyExc_StandardError")) - PyExc_AssertionError = cast[PPPyObject](symAddr(lib, "PyExc_AssertionError")) - PyExc_EnvironmentError = cast[PPPyObject](symAddr(lib, "PyExc_EnvironmentError")) - PyExc_IndentationError = cast[PPPyObject](symAddr(lib, "PyExc_IndentationError")) - PyExc_MemoryErrorInst = cast[PPPyObject](symAddr(lib, "PyExc_MemoryErrorInst")) - PyExc_NotImplementedError = cast[PPPyObject](symAddr(lib, "PyExc_NotImplementedError")) - PyExc_OSError = cast[PPPyObject](symAddr(lib, "PyExc_OSError")) - PyExc_TabError = cast[PPPyObject](symAddr(lib, "PyExc_TabError")) - PyExc_UnboundLocalError = cast[PPPyObject](symAddr(lib, "PyExc_UnboundLocalError")) - PyExc_UnicodeError = cast[PPPyObject](symAddr(lib, "PyExc_UnicodeError")) - PyExc_Warning = cast[PPPyObject](symAddr(lib, "PyExc_Warning")) - PyExc_DeprecationWarning = cast[PPPyObject](symAddr(lib, "PyExc_DeprecationWarning")) - PyExc_RuntimeWarning = cast[PPPyObject](symAddr(lib, "PyExc_RuntimeWarning")) - PyExc_SyntaxWarning = cast[PPPyObject](symAddr(lib, "PyExc_SyntaxWarning")) - PyExc_UserWarning = cast[PPPyObject](symAddr(lib, "PyExc_UserWarning")) - PyExc_OverflowWarning = cast[PPPyObject](symAddr(lib, "PyExc_OverflowWarning")) - PyExc_ReferenceError = cast[PPPyObject](symAddr(lib, "PyExc_ReferenceError")) - PyExc_StopIteration = cast[PPPyObject](symAddr(lib, "PyExc_StopIteration")) - PyExc_FutureWarning = cast[PPPyObject](symAddr(lib, "PyExc_FutureWarning")) - PyExc_PendingDeprecationWarning = cast[PPPyObject](symAddr(lib, - "PyExc_PendingDeprecationWarning")) - PyExc_UnicodeDecodeError = cast[PPPyObject](symAddr(lib, "PyExc_UnicodeDecodeError")) - PyExc_UnicodeEncodeError = cast[PPPyObject](symAddr(lib, "PyExc_UnicodeEncodeError")) - PyExc_UnicodeTranslateError = cast[PPPyObject](symAddr(lib, "PyExc_UnicodeTranslateError")) - PyType_Type = cast[PPyTypeObject](symAddr(lib, "PyType_Type")) - PyCFunction_Type = cast[PPyTypeObject](symAddr(lib, "PyCFunction_Type")) - PyCObject_Type = cast[PPyTypeObject](symAddr(lib, "PyCObject_Type")) - PyClass_Type = cast[PPyTypeObject](symAddr(lib, "PyClass_Type")) - PyCode_Type = cast[PPyTypeObject](symAddr(lib, "PyCode_Type")) - PyComplex_Type = cast[PPyTypeObject](symAddr(lib, "PyComplex_Type")) - PyDict_Type = cast[PPyTypeObject](symAddr(lib, "PyDict_Type")) - PyFile_Type = cast[PPyTypeObject](symAddr(lib, "PyFile_Type")) - PyFloat_Type = cast[PPyTypeObject](symAddr(lib, "PyFloat_Type")) - PyFrame_Type = cast[PPyTypeObject](symAddr(lib, "PyFrame_Type")) - PyFunction_Type = cast[PPyTypeObject](symAddr(lib, "PyFunction_Type")) - PyInstance_Type = cast[PPyTypeObject](symAddr(lib, "PyInstance_Type")) - PyInt_Type = cast[PPyTypeObject](symAddr(lib, "PyInt_Type")) - PyList_Type = cast[PPyTypeObject](symAddr(lib, "PyList_Type")) - PyLong_Type = cast[PPyTypeObject](symAddr(lib, "PyLong_Type")) - PyMethod_Type = cast[PPyTypeObject](symAddr(lib, "PyMethod_Type")) - PyModule_Type = cast[PPyTypeObject](symAddr(lib, "PyModule_Type")) - PyObject_Type = cast[PPyTypeObject](symAddr(lib, "PyObject_Type")) - PyRange_Type = cast[PPyTypeObject](symAddr(lib, "PyRange_Type")) - PySlice_Type = cast[PPyTypeObject](symAddr(lib, "PySlice_Type")) - PyString_Type = cast[PPyTypeObject](symAddr(lib, "PyString_Type")) - PyTuple_Type = cast[PPyTypeObject](symAddr(lib, "PyTuple_Type")) - PyUnicode_Type = cast[PPyTypeObject](symAddr(lib, "PyUnicode_Type")) - PyBaseObject_Type = cast[PPyTypeObject](symAddr(lib, "PyBaseObject_Type")) - PyBuffer_Type = cast[PPyTypeObject](symAddr(lib, "PyBuffer_Type")) - PyCallIter_Type = cast[PPyTypeObject](symAddr(lib, "PyCallIter_Type")) - PyCell_Type = cast[PPyTypeObject](symAddr(lib, "PyCell_Type")) - PyClassMethod_Type = cast[PPyTypeObject](symAddr(lib, "PyClassMethod_Type")) - PyProperty_Type = cast[PPyTypeObject](symAddr(lib, "PyProperty_Type")) - PySeqIter_Type = cast[PPyTypeObject](symAddr(lib, "PySeqIter_Type")) - PyStaticMethod_Type = cast[PPyTypeObject](symAddr(lib, "PyStaticMethod_Type")) - PySuper_Type = cast[PPyTypeObject](symAddr(lib, "PySuper_Type")) - PySymtableEntry_Type = cast[PPyTypeObject](symAddr(lib, "PySymtableEntry_Type")) - PyTraceBack_Type = cast[PPyTypeObject](symAddr(lib, "PyTraceBack_Type")) - PyWrapperDescr_Type = cast[PPyTypeObject](symAddr(lib, "PyWrapperDescr_Type")) - PyBaseString_Type = cast[PPyTypeObject](symAddr(lib, "PyBaseString_Type")) - PyBool_Type = cast[PPyTypeObject](symAddr(lib, "PyBool_Type")) - PyEnum_Type = cast[PPyTypeObject](symAddr(lib, "PyEnum_Type")) - -# Unfortunately we have to duplicate the loading mechanism here, because Nimrod -# used to not support variables from dynamic libraries. Well designed API's -# don't require this anyway. Python is an exception. - -var - lib: TLibHandle - -when defined(windows): - const - LibNames = ["python27.dll", "python26.dll", "python25.dll", - "python24.dll", "python23.dll", "python22.dll", "python21.dll", - "python20.dll", "python16.dll", "python15.dll"] -elif defined(macosx): - const - LibNames = ["libpython2.7.dylib", "libpython2.6.dylib", - "libpython2.5.dylib", "libpython2.4.dylib", "libpython2.3.dylib", - "libpython2.2.dylib", "libpython2.1.dylib", "libpython2.0.dylib", - "libpython1.6.dylib", "libpython1.5.dylib"] -else: - const - LibNames = [ - "libpython2.7.so" & dllver, - "libpython2.6.so" & dllver, - "libpython2.5.so" & dllver, - "libpython2.4.so" & dllver, - "libpython2.3.so" & dllver, - "libpython2.2.so" & dllver, - "libpython2.1.so" & dllver, - "libpython2.0.so" & dllver, - "libpython1.6.so" & dllver, - "libpython1.5.so" & dllver] - -for libName in items(libNames): - lib = loadLib(libName) - if lib != nil: break - -if lib == nil: quit("could not load python library") -init(lib) - diff --git a/lib/wrappers/tcl.nim b/lib/wrappers/tcl.nim deleted file mode 100644 index 8cd715838..000000000 --- a/lib/wrappers/tcl.nim +++ /dev/null @@ -1,865 +0,0 @@ -# -# -# Nimrod's Runtime Library -# (c) Copyright 2010 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This module is a wrapper for the TCL programming language. - -# -# tcl.h -- -# -# This header file describes the externally-visible facilities of the Tcl -# interpreter. -# -# Translated to Pascal Copyright (c) 2002 by Max Artemev -# aka Bert Raccoon (bert@furry.ru, bert_raccoon@freemail.ru) -# -# -# Copyright (c) 1998-2000 by Scriptics Corporation. -# Copyright (c) 1994-1998 Sun Microsystems, Inc. -# Copyright (c) 1993-1996 Lucent Technologies. -# Copyright (c) 1987-1994 John Ousterhout, The Regents of the -# University of California, Berkeley. -# -# *********************************************************************** -# This program 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. -# *********************************************************************** -# - -{.deadCodeElim: on.} - -when defined(WIN32): - const - dllName = "tcl(85|84|83|82|81|80).dll" -elif defined(macosx): - const - dllName = "libtcl(8.5|8.4|8.3|8.2|8.1).dylib" -else: - const - dllName = "libtcl(8.5|8.4|8.3|8.2|8.1).so(|.1|.0)" -const - TCL_DESTROYED* = 0xDEADDEAD - TCL_OK* = 0 - TCL_ERROR* = 1 - TCL_RETURN* = 2 - TCL_BREAK* = 3 - TCL_CONTINUE* = 4 - RESULT_SIZE* = 200 - MAX_ARGV* = 0x00007FFF - VERSION_MAJOR* = 0 - VERSION_MINOR* = 0 - NO_EVAL* = 0x00010000 - EVAL_GLOBAL* = 0x00020000 # Flag values passed to variable-related proc - GLOBAL_ONLY* = 1 - NAMESPACE_ONLY* = 2 - APPEND_VALUE* = 4 - LIST_ELEMENT* = 8 - TRACE_READS* = 0x00000010 - TRACE_WRITES* = 0x00000020 - TRACE_UNSETS* = 0x00000040 - TRACE_DESTROYED* = 0x00000080 - INTERP_DESTROYED* = 0x00000100 - LEAVE_ERR_MSG* = 0x00000200 - PARSE_PART1* = 0x00000400 # Types for linked variables: * - LINK_INT* = 1 - LINK_DOUBLE* = 2 - LINK_BOOLEAN* = 3 - LINK_STRING* = 4 - LINK_READ_ONLY* = 0x00000080 - SMALL_HASH_TABLE* = 4 # Hash Table * - STRING_KEYS* = 0 - ONE_WORD_KEYS* = 1 # Const/enums Tcl_QueuePosition * - - QUEUE_TAIL* = 0 - QUEUE_HEAD* = 1 - QUEUE_MARK* = 2 # Tcl_QueuePosition; - # Event Flags - DONT_WAIT* = 1 shl 1 - WINDOW_EVENTS* = 1 shl 2 - FILE_EVENTS* = 1 shl 3 - TIMER_EVENTS* = 1 shl 4 - IDLE_EVENTS* = 1 shl 5 # WAS 0x10 ???? * - ALL_EVENTS* = not DONT_WAIT - VOLATILE* = 1 - TCL_STATIC* = 0 - DYNAMIC* = 3 # Channel - TCL_STDIN* = 1 shl 1 - TCL_STDOUT* = 1 shl 2 - TCL_STDERR* = 1 shl 3 - ENFORCE_MODE* = 1 shl 4 - READABLE* = 1 shl 1 - WRITABLE* = 1 shl 2 - EXCEPTION* = 1 shl 3 # POSIX * - EPERM* = 1 # Operation not permitted; only the owner of the file (or other - # resource) or processes with special privileges can perform the - # operation. - # - ENOENT* = 2 # No such file or directory. This is a "file doesn't exist" error - # for ordinary files that are referenced in contexts where they are - # expected to already exist. - # - ESRCH* = 3 # No process matches the specified process ID. * - EINTR* = 4 # Interrupted function call; an asynchronous signal occurred and - # prevented completion of the call. When this happens, you should - # try the call again. - # - EIO* = 5 # Input/output error; usually used for physical read or write errors. * - ENXIO* = 6 # No such device or address. The system tried to use the device - # represented by a file you specified, and it couldn't find the - # device. This can mean that the device file was installed - # incorrectly, or that the physical device is missing or not - # correctly attached to the computer. - # - E2BIG* = 7 # Argument list too long; used when the arguments passed to a new - # program being executed with one of the `exec' functions (*note - # Executing a File::.) occupy too much memory space. This condition - # never arises in the GNU system. - # - ENOEXEC* = 8 # Invalid executable file format. This condition is detected by the - # `exec' functions; see *Note Executing a File::. - # - EBADF* = 9 # Bad file descriptor; for example, I/O on a descriptor that has been - # closed or reading from a descriptor open only for writing (or vice - # versa). - # - ECHILD* = 10 # There are no child processes. This error happens on operations - # that are supposed to manipulate child processes, when there aren't - # any processes to manipulate. - # - EDEADLK* = 11 # Deadlock avoided; allocating a system resource would have resulted - # in a deadlock situation. The system does not guarantee that it - # will notice all such situations. This error means you got lucky - # and the system noticed; it might just hang. *Note File Locks::, - # for an example. - # - ENOMEM* = 12 # No memory available. The system cannot allocate more virtual - # memory because its capacity is full. - # - EACCES* = 13 # Permission denied; the file permissions do not allow the attempted - # operation. - # - EFAULT* = 14 # Bad address; an invalid pointer was detected. In the GNU system, - # this error never happens; you get a signal instead. - # - ENOTBLK* = 15 # A file that isn't a block special file was given in a situation - # that requires one. For example, trying to mount an ordinary file - # as a file system in Unix gives this error. - # - EBUSY* = 16 # Resource busy; a system resource that can't be shared is already - # in use. For example, if you try to delete a file that is the root - # of a currently mounted filesystem, you get this error. - # - EEXIST* = 17 # File exists; an existing file was specified in a context where it - # only makes sense to specify a new file. - # - EXDEV* = 18 # An attempt to make an improper link across file systems was - # detected. This happens not only when you use `link' (*note Hard - # Links::.) but also when you rename a file with `rename' (*note - # Renaming Files::.). - # - ENODEV* = 19 # The wrong type of device was given to a function that expects a - # particular sort of device. - # - ENOTDIR* = 20 # A file that isn't a directory was specified when a directory is - # required. - # - EISDIR* = 21 # File is a directory; you cannot open a directory for writing, or - # create or remove hard links to it. - # - EINVAL* = 22 # Invalid argument. This is used to indicate various kinds of - # problems with passing the wrong argument to a library function. - # - EMFILE* = 24 # The current process has too many files open and can't open any - # more. Duplicate descriptors do count toward this limit. - # - # In BSD and GNU, the number of open files is controlled by a - # resource limit that can usually be increased. If you get this - # error, you might want to increase the `RLIMIT_NOFILE' limit or - # make it unlimited; *note Limits on Resources::.. - # - ENFILE* = 23 # There are too many distinct file openings in the entire system. - # Note that any number of linked channels count as just one file - # opening; see *Note Linked Channels::. This error never occurs in - # the GNU system. - # - ENOTTY* = 25 # Inappropriate I/O control operation, such as trying to set terminal - # modes on an ordinary file. - # - ETXTBSY* = 26 # An attempt to execute a file that is currently open for writing, or - # write to a file that is currently being executed. Often using a - # debugger to run a program is considered having it open for writing - # and will cause this error. (The name stands for "text file - # busy".) This is not an error in the GNU system; the text is - # copied as necessary. - # - EFBIG* = 27 # File too big; the size of a file would be larger than allowed by - # the system. - # - ENOSPC* = 28 # No space left on device; write operation on a file failed because - # the disk is full. - # - ESPIPE* = 29 # Invalid seek operation (such as on a pipe). * - EROFS* = 30 # An attempt was made to modify something on a read-only file system. * - EMLINK* = 31 # Too many links; the link count of a single file would become too - # large. `rename' can cause this error if the file being renamed - # already has as many links as it can take (*note Renaming Files::.). - # - EPIPE* = 32 # Broken pipe; there is no process reading from the other end of a - # pipe. Every library function that returns this error code also - # generates a `SIGPIPE' signal; this signal terminates the program - # if not handled or blocked. Thus, your program will never actually - # see `EPIPE' unless it has handled or blocked `SIGPIPE'. - # - EDOM* = 33 # Domain error; used by mathematical functions when an argument - # value does not fall into the domain over which the function is - # defined. - # - ERANGE* = 34 # Range error; used by mathematical functions when the result value - # is not representable because of overflow or underflow. - # - EAGAIN* = 35 # Resource temporarily unavailable; the call might work if you try - # again later. The macro `EWOULDBLOCK' is another name for `EAGAIN'; - # they are always the same in the GNU C library. - # - EWOULDBLOCK* = EAGAIN # In the GNU C library, this is another name for `EAGAIN' (above). - # The values are always the same, on every operating system. - # C libraries in many older Unix systems have `EWOULDBLOCK' as a - # separate error code. - # - EINPROGRESS* = 36 # An operation that cannot complete immediately was initiated on an - # object that has non-blocking mode selected. Some functions that - # must always block (such as `connect'; *note Connecting::.) never - # return `EAGAIN'. Instead, they return `EINPROGRESS' to indicate - # that the operation has begun and will take some time. Attempts to - # manipulate the object before the call completes return `EALREADY'. - # You can use the `select' function to find out when the pending - # operation has completed; *note Waiting for I/O::.. - # - EALREADY* = 37 # An operation is already in progress on an object that has - # non-blocking mode selected. - # - ENOTSOCK* = 38 # A file that isn't a socket was specified when a socket is required. * - EDESTADDRREQ* = 39 # No default destination address was set for the socket. You get - # this error when you try to transmit data over a connectionless - # socket, without first specifying a destination for the data with - # `connect'. - # - EMSGSIZE* = 40 # The size of a message sent on a socket was larger than the - # supported maximum size. - # - EPROTOTYPE* = 41 # The socket type does not support the requested communications - # protocol. - # - ENOPROTOOPT* = 42 # You specified a socket option that doesn't make sense for the - # particular protocol being used by the socket. *Note Socket - # Options::. - # - EPROTONOSUPPORT* = 43 # The socket domain does not support the requested communications - # protocol (perhaps because the requested protocol is completely - # invalid.) *Note Creating a Socket::. - # - ESOCKTNOSUPPORT* = 44 # The socket type is not supported. * - EOPNOTSUPP* = 45 # The operation you requested is not supported. Some socket - # functions don't make sense for all types of sockets, and others - # may not be implemented for all communications protocols. In the - # GNU system, this error can happen for many calls when the object - # does not support the particular operation; it is a generic - # indication that the server knows nothing to do for that call. - # - EPFNOSUPPORT* = 46 # The socket communications protocol family you requested is not - # supported. - # - EAFNOSUPPORT* = 47 # The address family specified for a socket is not supported; it is - # inconsistent with the protocol being used on the socket. *Note - # Sockets::. - # - EADDRINUSE* = 48 # The requested socket address is already in use. *Note Socket - # Addresses::. - # - EADDRNOTAVAIL* = 49 # The requested socket address is not available; for example, you - # tried to give a socket a name that doesn't match the local host - # name. *Note Socket Addresses::. - # - ENETDOWN* = 50 # A socket operation failed because the network was down. * - ENETUNREACH* = 51 # A socket operation failed because the subnet containing the remote - # host was unreachable. - # - ENETRESET* = 52 # A network connection was reset because the remote host crashed. * - ECONNABORTED* = 53 # A network connection was aborted locally. * - ECONNRESET* = 54 # A network connection was closed for reasons outside the control of - # the local host, such as by the remote machine rebooting or an - # unrecoverable protocol violation. - # - ENOBUFS* = 55 # The kernel's buffers for I/O operations are all in use. In GNU, - # this error is always synonymous with `ENOMEM'; you may get one or - # the other from network operations. - # - EISCONN* = 56 # You tried to connect a socket that is already connected. *Note - # Connecting::. - # - ENOTCONN* = 57 # The socket is not connected to anything. You get this error when - # you try to transmit data over a socket, without first specifying a - # destination for the data. For a connectionless socket (for - # datagram protocols, such as UDP), you get `EDESTADDRREQ' instead. - # - ESHUTDOWN* = 58 # The socket has already been shut down. * - ETOOMANYREFS* = 59 # ??? * - ETIMEDOUT* = 60 # A socket operation with a specified timeout received no response - # during the timeout period. - # - ECONNREFUSED* = 61 # A remote host refused to allow the network connection (typically - # because it is not running the requested service). - # - ELOOP* = 62 # Too many levels of symbolic links were encountered in looking up a - # file name. This often indicates a cycle of symbolic links. - # - ENAMETOOLONG* = 63 # Filename too long (longer than `PATH_MAX'; *note Limits for - # Files::.) or host name too long (in `gethostname' or - # `sethostname'; *note Host Identification::.). - # - EHOSTDOWN* = 64 # The remote host for a requested network connection is down. * - EHOSTUNREACH* = 65 # The remote host for a requested network connection is not - # reachable. - # - ENOTEMPTY* = 66 # Directory not empty, where an empty directory was expected. - # Typically, this error occurs when you are trying to delete a - # directory. - # - EPROCLIM* = 67 # This means that the per-user limit on new process would be - # exceeded by an attempted `fork'. *Note Limits on Resources::, for - # details on the `RLIMIT_NPROC' limit. - # - EUSERS* = 68 # The file quota system is confused because there are too many users. * - EDQUOT* = 69 # The user's disk quota was exceeded. * - ESTALE* = 70 # Stale NFS file handle. This indicates an internal confusion in - # the NFS system which is due to file system rearrangements on the - # server host. Repairing this condition usually requires unmounting - # and remounting the NFS file system on the local host. - # - EREMOTE* = 71 # An attempt was made to NFS-mount a remote file system with a file - # name that already specifies an NFS-mounted file. (This is an - # error on some operating systems, but we expect it to work properly - # on the GNU system, making this error code impossible.) - # - EBADRPC* = 72 # ??? * - ERPCMISMATCH* = 73 # ??? * - EPROGUNAVAIL* = 74 # ??? * - EPROGMISMATCH* = 75 # ??? * - EPROCUNAVAIL* = 76 # ??? * - ENOLCK* = 77 # No locks available. This is used by the file locking facilities; - # see *Note File Locks::. This error is never generated by the GNU - # system, but it can result from an operation to an NFS server - # running another operating system. - # - ENOSYS* = 78 # Function not implemented. Some functions have commands or options - # defined that might not be supported in all implementations, and - # this is the kind of error you get if you request them and they are - # not supported. - # - EFTYPE* = 79 # Inappropriate file type or format. The file was the wrong type - # for the operation, or a data file had the wrong format. - # On some systems `chmod' returns this error if you try to set the - # sticky bit on a non-directory file; *note Setting Permissions::.. - # - -type - TArgv* = cstringArray - TClientData* = pointer - TFreeProc* = proc (theBlock: pointer){.cdecl.} - PInterp* = ptr TInterp - TInterp*{.final.} = object # Event Definitions - result*: cstring # Do not access this directly. Use - # Tcl_GetStringResult since result - # may be pointing to an object - freeProc*: TFreeProc - errorLine*: int - - TEventSetupProc* = proc (clientData: TClientData, flags: int){.cdecl.} - TEventCheckProc* = TEventSetupProc - PEvent* = ptr TEvent - TEventProc* = proc (evPtr: PEvent, flags: int): int{.cdecl.} - TEvent*{.final.} = object - prc*: TEventProc - nextPtr*: PEvent - ClientData*: TObject # ClientData is just pointer.* - - PTime* = ptr TTime - TTime*{.final.} = object - sec*: int32 # Seconds. * - usec*: int32 # Microseconds. * - - TTimerToken* = pointer - PInteger* = ptr int - PHashTable* = ptr THashTable - PHashEntry* = ptr THashEntry - PPHashEntry* = ptr PHashEntry - THashEntry*{.final.} = object - nextPtr*: PHashEntry - tablePtr*: PHashTable - bucketPtr*: PPHashEntry - clientData*: TClientData - key*: cstring - - THashFindProc* = proc (tablePtr: PHashTable, key: cstring): PHashEntry{. - cdecl.} - THashCreateProc* = proc (tablePtr: PHashTable, key: cstring, - newPtr: PInteger): PHashEntry{.cdecl.} - THashTable*{.final.} = object - buckets*: ppHashEntry - staticBuckets*: array[0..SMALL_HASH_TABLE - 1, PHashEntry] - numBuckets*: int - numEntries*: int - rebuildSize*: int - downShift*: int - mask*: int - keyType*: int - findProc*: THashFindProc - createProc*: THashCreateProc - - PHashSearch* = ptr THashSearch - THashSearch*{.final.} = object - tablePtr*: PHashTable - nextIndex*: int - nextEntryPtr*: PHashEntry - - TAppInitProc* = proc (interp: pInterp): int{.cdecl.} - TPackageInitProc* = proc (interp: pInterp): int{.cdecl.} - TCmdProc* = proc (clientData: TClientData, interp: pInterp, argc: int, - argv: TArgv): int{.cdecl.} - TVarTraceProc* = proc (clientData: TClientData, interp: pInterp, - varName: cstring, elemName: cstring, flags: int): cstring{. - cdecl.} - TInterpDeleteProc* = proc (clientData: TClientData, interp: pInterp){.cdecl.} - TCmdDeleteProc* = proc (clientData: TClientData){.cdecl.} - TNamespaceDeleteProc* = proc (clientData: TClientData){.cdecl.} - -const - DSTRING_STATIC_SIZE* = 200 - -type - PDString* = ptr TDString - TDString*{.final.} = object - str*: cstring - len*: int - spaceAvl*: int - staticSpace*: array[0..DSTRING_STATIC_SIZE - 1, char] - - PChannel* = ptr TChannel - TChannel*{.final.} = object - TDriverBlockModeProc* = proc (instanceData: TClientData, mode: int): int{. - cdecl.} - TDriverCloseProc* = proc (instanceData: TClientData, interp: PInterp): int{. - cdecl.} - TDriverInputProc* = proc (instanceData: TClientData, buf: cstring, - toRead: int, errorCodePtr: PInteger): int{.cdecl.} - TDriverOutputProc* = proc (instanceData: TClientData, buf: cstring, - toWrite: int, errorCodePtr: PInteger): int{.cdecl.} - TDriverSeekProc* = proc (instanceData: TClientData, offset: int32, - mode: int, errorCodePtr: PInteger): int{.cdecl.} - TDriverSetOptionProc* = proc (instanceData: TClientData, interp: PInterp, - optionName: cstring, value: cstring): int{.cdecl.} - TDriverGetOptionProc* = proc (instanceData: TClientData, interp: pInterp, - optionName: cstring, dsPtr: PDString): int{. - cdecl.} - TDriverWatchProc* = proc (instanceData: TClientData, mask: int){.cdecl.} - TDriverGetHandleProc* = proc (instanceData: TClientData, direction: int, - handlePtr: var TClientData): int{.cdecl.} - PChannelType* = ptr TChannelType - TChannelType*{.final.} = object - typeName*: cstring - blockModeProc*: TDriverBlockModeProc - closeProc*: TDriverCloseProc - inputProc*: TDriverInputProc - ouputProc*: TDriverOutputProc - seekProc*: TDriverSeekProc - setOptionProc*: TDriverSetOptionProc - getOptionProc*: TDriverGetOptionProc - watchProc*: TDriverWatchProc - getHandleProc*: TDriverGetHandleProc - - TChannelProc* = proc (clientData: TClientData, mask: int){.cdecl.} - PObj* = ptr TObj - PPObj* = ptr PObj - TObj*{.final.} = object - refCount*: int # ... - - TObjCmdProc* = proc (clientData: TClientData, interp: PInterp, objc: int, - PPObj: PPObj): int{.cdecl.} - PNamespace* = ptr TNamespace - TNamespace*{.final.} = object - name*: cstring - fullName*: cstring - clientData*: TClientData - deleteProc*: TNamespaceDeleteProc - parentPtr*: PNamespace - - PCallFrame* = ptr TCallFrame - TCallFrame*{.final.} = object - nsPtr*: PNamespace - dummy1*: int - dummy2*: int - dummy3*: cstring - dummy4*: cstring - dummy5*: cstring - dummy6*: int - dummy7*: cstring - dummy8*: cstring - dummy9*: int - dummy10*: cstring - - PCmdInfo* = ptr TCmdInfo - TCmdInfo*{.final.} = object - isNativeObjectProc*: int - objProc*: TObjCmdProc - objClientData*: TClientData - prc*: TCmdProc - clientData*: TClientData - deleteProc*: TCmdDeleteProc - deleteData*: TClientData - namespacePtr*: pNamespace - - pCommand* = ptr TCommand - TCommand*{.final.} = object # hPtr : pTcl_HashEntry; - # nsPtr : pTcl_Namespace; - # refCount : integer; - # isCmdEpoch : integer; - # compileProc : pointer; - # objProc : pointer; - # objClientData : Tcl_ClientData; - # proc : pointer; - # clientData : Tcl_ClientData; - # deleteProc : TTclCmdDeleteProc; - # deleteData : Tcl_ClientData; - # deleted : integer; - # importRefPtr : pointer; - # - -type - TPanicProc* = proc (fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8: cstring){. - cdecl.} # 1/15/97 orig. Tcl style - TClientDataProc* = proc (clientData: TClientData){.cdecl.} - TIdleProc* = proc (clientData: TClientData){.cdecl.} - TTimerProc* = TIdleProc - TCreateCloseHandler* = proc (channel: pChannel, prc: TClientDataProc, - clientData: TClientData){.cdecl.} - TDeleteCloseHandler* = TCreateCloseHandler - TEventDeleteProc* = proc (evPtr: pEvent, clientData: TClientData): int{. - cdecl.} - -proc Alloc*(size: int): cstring{.cdecl, dynlib: dllName, - importc: "Tcl_Alloc".} -proc CreateInterp*(): pInterp{.cdecl, dynlib: dllName, - importc: "Tcl_CreateInterp".} -proc DeleteInterp*(interp: pInterp){.cdecl, dynlib: dllName, - importc: "Tcl_DeleteInterp".} -proc ResetResult*(interp: pInterp){.cdecl, dynlib: dllName, - importc: "Tcl_ResetResult".} -proc Eval*(interp: pInterp, script: cstring): int{.cdecl, dynlib: dllName, - importc: "Tcl_Eval".} -proc EvalFile*(interp: pInterp, filename: cstring): int{.cdecl, - dynlib: dllName, importc: "Tcl_EvalFile".} -proc AddErrorInfo*(interp: pInterp, message: cstring){.cdecl, - dynlib: dllName, importc: "Tcl_AddErrorInfo".} -proc BackgroundError*(interp: pInterp){.cdecl, dynlib: dllName, - importc: "Tcl_BackgroundError".} -proc CreateCommand*(interp: pInterp, name: cstring, cmdProc: TCmdProc, - clientData: TClientData, deleteProc: TCmdDeleteProc): pCommand{. - cdecl, dynlib: dllName, importc: "Tcl_CreateCommand".} -proc DeleteCommand*(interp: pInterp, name: cstring): int{.cdecl, - dynlib: dllName, importc: "Tcl_DeleteCommand".} -proc CallWhenDeleted*(interp: pInterp, prc: TInterpDeleteProc, - clientData: TClientData){.cdecl, dynlib: dllName, - importc: "Tcl_CallWhenDeleted".} -proc DontCallWhenDeleted*(interp: pInterp, prc: TInterpDeleteProc, - clientData: TClientData){.cdecl, - dynlib: dllName, importc: "Tcl_DontCallWhenDeleted".} -proc CommandComplete*(cmd: cstring): int{.cdecl, dynlib: dllName, - importc: "Tcl_CommandComplete".} -proc LinkVar*(interp: pInterp, varName: cstring, varAddr: pointer, typ: int): int{. - cdecl, dynlib: dllName, importc: "Tcl_LinkVar".} -proc UnlinkVar*(interp: pInterp, varName: cstring){.cdecl, dynlib: dllName, - importc: "Tcl_UnlinkVar".} -proc TraceVar*(interp: pInterp, varName: cstring, flags: int, - prc: TVarTraceProc, clientData: TClientData): int{.cdecl, - dynlib: dllName, importc: "Tcl_TraceVar".} -proc TraceVar2*(interp: pInterp, varName: cstring, elemName: cstring, - flags: int, prc: TVarTraceProc, clientData: TClientData): int{. - cdecl, dynlib: dllName, importc: "Tcl_TraceVar2".} -proc UntraceVar*(interp: pInterp, varName: cstring, flags: int, - prc: TVarTraceProc, clientData: TClientData){.cdecl, - dynlib: dllName, importc: "Tcl_UntraceVar".} -proc UntraceVar2*(interp: pInterp, varName: cstring, elemName: cstring, - flags: int, prc: TVarTraceProc, clientData: TClientData){. - cdecl, dynlib: dllName, importc: "Tcl_UntraceVar2".} -proc GetVar*(interp: pInterp, varName: cstring, flags: int): cstring{.cdecl, - dynlib: dllName, importc: "Tcl_GetVar".} -proc GetVar2*(interp: pInterp, varName: cstring, elemName: cstring, - flags: int): cstring{.cdecl, dynlib: dllName, - importc: "Tcl_GetVar2".} -proc SetVar*(interp: pInterp, varName: cstring, newValue: cstring, - flags: int): cstring{.cdecl, dynlib: dllName, - importc: "Tcl_SetVar".} -proc SetVar2*(interp: pInterp, varName: cstring, elemName: cstring, - newValue: cstring, flags: int): cstring{.cdecl, - dynlib: dllName, importc: "Tcl_SetVar2".} -proc UnsetVar*(interp: pInterp, varName: cstring, flags: int): int{.cdecl, - dynlib: dllName, importc: "Tcl_UnsetVar".} -proc UnsetVar2*(interp: pInterp, varName: cstring, elemName: cstring, - flags: int): int{.cdecl, dynlib: dllName, - importc: "Tcl_UnsetVar2".} -proc SetResult*(interp: pInterp, newValue: cstring, freeProc: TFreeProc){. - cdecl, dynlib: dllName, importc: "Tcl_SetResult".} -proc FirstHashEntry*(hashTbl: pHashTable, searchInfo: var THashSearch): pHashEntry{. - cdecl, dynlib: dllName, importc: "Tcl_FirstHashEntry".} -proc NextHashEntry*(searchInfo: var THashSearch): pHashEntry{.cdecl, - dynlib: dllName, importc: "Tcl_NextHashEntry".} -proc InitHashTable*(hashTbl: pHashTable, keyType: int){.cdecl, - dynlib: dllName, importc: "Tcl_InitHashTable".} -proc StringMatch*(str: cstring, pattern: cstring): int{.cdecl, - dynlib: dllName, importc: "Tcl_StringMatch".} -proc GetErrno*(): int{.cdecl, dynlib: dllName, importc: "Tcl_GetErrno".} -proc SetErrno*(val: int){.cdecl, dynlib: dllName, importc: "Tcl_SetErrno".} -proc SetPanicProc*(prc: TPanicProc){.cdecl, dynlib: dllName, - importc: "Tcl_SetPanicProc".} -proc PkgProvide*(interp: pInterp, name: cstring, version: cstring): int{. - cdecl, dynlib: dllName, importc: "Tcl_PkgProvide".} -proc StaticPackage*(interp: pInterp, pkgName: cstring, - initProc: TPackageInitProc, - safeInitProc: TPackageInitProc){.cdecl, dynlib: dllName, - importc: "Tcl_StaticPackage".} -proc CreateEventSource*(setupProc: TEventSetupProc, - checkProc: TEventCheckProc, - clientData: TClientData){.cdecl, dynlib: dllName, - importc: "Tcl_CreateEventSource".} -proc DeleteEventSource*(setupProc: TEventSetupProc, - checkProc: TEventCheckProc, - clientData: TClientData){.cdecl, dynlib: dllName, - importc: "Tcl_DeleteEventSource".} -proc QueueEvent*(evPtr: pEvent, pos: int){.cdecl, dynlib: dllName, - importc: "Tcl_QueueEvent".} -proc SetMaxBlockTime*(timePtr: pTime){.cdecl, dynlib: dllName, - importc: "Tcl_SetMaxBlockTime".} -proc DeleteEvents*(prc: TEventDeleteProc, clientData: TClientData){. - cdecl, dynlib: dllName, importc: "Tcl_DeleteEvents".} -proc DoOneEvent*(flags: int): int{.cdecl, dynlib: dllName, - importc: "Tcl_DoOneEvent".} -proc DoWhenIdle*(prc: TIdleProc, clientData: TClientData){.cdecl, - dynlib: dllName, importc: "Tcl_DoWhenIdle".} -proc CancelIdleCall*(prc: TIdleProc, clientData: TClientData){.cdecl, - dynlib: dllName, importc: "Tcl_CancelIdleCall".} -proc CreateTimerHandler*(milliseconds: int, prc: TTimerProc, - clientData: TClientData): TTimerToken{.cdecl, - dynlib: dllName, importc: "Tcl_CreateTimerHandler".} -proc DeleteTimerHandler*(token: TTimerToken){.cdecl, dynlib: dllName, - importc: "Tcl_DeleteTimerHandler".} - # procedure Tcl_CreateModalTimeout(milliseconds: integer; prc: TTclTimerProc; clientData: Tcl_ClientData); cdecl; external dllName; - # procedure Tcl_DeleteModalTimeout(prc: TTclTimerProc; clientData: Tcl_ClientData); cdecl; external dllName; -proc SplitList*(interp: pInterp, list: cstring, argcPtr: var int, - argvPtr: var TArgv): int{.cdecl, dynlib: dllName, - importc: "Tcl_SplitList".} -proc Merge*(argc: int, argv: TArgv): cstring{.cdecl, dynlib: dllName, - importc: "Tcl_Merge".} -proc Free*(p: cstring){.cdecl, dynlib: dllName, importc: "Tcl_Free".} -proc Init*(interp: pInterp): int{.cdecl, dynlib: dllName, - importc: "Tcl_Init".} - # procedure Tcl_InterpDeleteProc(clientData: Tcl_ClientData; interp: pTcl_Interp); cdecl; external dllName; -proc GetAssocData*(interp: pInterp, key: cstring, prc: var TInterpDeleteProc): TClientData{. - cdecl, dynlib: dllName, importc: "Tcl_GetAssocData".} -proc DeleteAssocData*(interp: pInterp, key: cstring){.cdecl, - dynlib: dllName, importc: "Tcl_DeleteAssocData".} -proc SetAssocData*(interp: pInterp, key: cstring, prc: TInterpDeleteProc, - clientData: TClientData){.cdecl, dynlib: dllName, - importc: "Tcl_SetAssocData".} -proc IsSafe*(interp: pInterp): int{.cdecl, dynlib: dllName, - importc: "Tcl_IsSafe".} -proc MakeSafe*(interp: pInterp): int{.cdecl, dynlib: dllName, - importc: "Tcl_MakeSafe".} -proc CreateSlave*(interp: pInterp, slaveName: cstring, isSafe: int): pInterp{. - cdecl, dynlib: dllName, importc: "Tcl_CreateSlave".} -proc GetSlave*(interp: pInterp, slaveName: cstring): pInterp{.cdecl, - dynlib: dllName, importc: "Tcl_GetSlave".} -proc GetMaster*(interp: pInterp): pInterp{.cdecl, dynlib: dllName, - importc: "Tcl_GetMaster".} -proc GetInterpPath*(askingInterp: pInterp, slaveInterp: pInterp): int{. - cdecl, dynlib: dllName, importc: "Tcl_GetInterpPath".} -proc CreateAlias*(slaveInterp: pInterp, srcCmd: cstring, - targetInterp: pInterp, targetCmd: cstring, argc: int, - argv: TArgv): int{.cdecl, dynlib: dllName, - importc: "Tcl_CreateAlias".} -proc GetAlias*(interp: pInterp, srcCmd: cstring, targetInterp: var pInterp, - targetCmd: var cstring, argc: var int, argv: var TArgv): int{. - cdecl, dynlib: dllName, importc: "Tcl_GetAlias".} -proc ExposeCommand*(interp: pInterp, hiddenCmdName: cstring, - cmdName: cstring): int{.cdecl, dynlib: dllName, - importc: "Tcl_ExposeCommand".} -proc HideCommand*(interp: pInterp, cmdName: cstring, hiddenCmdName: cstring): int{. - cdecl, dynlib: dllName, importc: "Tcl_HideCommand".} -proc EventuallyFree*(clientData: TClientData, freeProc: TFreeProc){. - cdecl, dynlib: dllName, importc: "Tcl_EventuallyFree".} -proc Preserve*(clientData: TClientData){.cdecl, dynlib: dllName, - importc: "Tcl_Preserve".} -proc Release*(clientData: TClientData){.cdecl, dynlib: dllName, - importc: "Tcl_Release".} -proc InterpDeleted*(interp: pInterp): int{.cdecl, dynlib: dllName, - importc: "Tcl_InterpDeleted".} -proc GetCommandInfo*(interp: pInterp, cmdName: cstring, - info: var TCmdInfo): int{.cdecl, dynlib: dllName, - importc: "Tcl_GetCommandInfo".} -proc SetCommandInfo*(interp: pInterp, cmdName: cstring, - info: var TCmdInfo): int{.cdecl, dynlib: dllName, - importc: "Tcl_SetCommandInfo".} -proc FindExecutable*(path: cstring){.cdecl, dynlib: dllName, - importc: "Tcl_FindExecutable".} -proc GetStringResult*(interp: pInterp): cstring{.cdecl, dynlib: dllName, - importc: "Tcl_GetStringResult".} - #v1.0 -proc FindCommand*(interp: pInterp, cmdName: cstring, - contextNsPtr: pNamespace, flags: int): TCommand{.cdecl, - dynlib: dllName, importc: "Tcl_FindCommand".} - #v1.0 -proc DeleteCommandFromToken*(interp: pInterp, cmd: pCommand): int{.cdecl, - dynlib: dllName, importc: "Tcl_DeleteCommandFromToken".} -proc CreateNamespace*(interp: pInterp, name: cstring, - clientData: TClientData, - deleteProc: TNamespaceDeleteProc): pNamespace{.cdecl, - dynlib: dllName, importc: "Tcl_CreateNamespace".} - #v1.0 -proc DeleteNamespace*(namespacePtr: pNamespace){.cdecl, dynlib: dllName, - importc: "Tcl_DeleteNamespace".} -proc FindNamespace*(interp: pInterp, name: cstring, - contextNsPtr: pNamespace, flags: int): pNamespace{. - cdecl, dynlib: dllName, importc: "Tcl_FindNamespace".} -proc Tcl_Export*(interp: pInterp, namespacePtr: pNamespace, pattern: cstring, - resetListFirst: int): int{.cdecl, dynlib: dllName, - importc: "Tcl_Export".} -proc Tcl_Import*(interp: pInterp, namespacePtr: pNamespace, pattern: cstring, - allowOverwrite: int): int{.cdecl, dynlib: dllName, - importc: "Tcl_Import".} -proc GetCurrentNamespace*(interp: pInterp): pNamespace{.cdecl, - dynlib: dllName, importc: "Tcl_GetCurrentNamespace".} -proc GetGlobalNamespace*(interp: pInterp): pNamespace{.cdecl, - dynlib: dllName, importc: "Tcl_GetGlobalNamespace".} -proc PushCallFrame*(interp: pInterp, callFramePtr: var TCallFrame, - namespacePtr: pNamespace, isProcCallFrame: int): int{. - cdecl, dynlib: dllName, importc: "Tcl_PushCallFrame".} -proc PopCallFrame*(interp: pInterp){.cdecl, dynlib: dllName, - importc: "Tcl_PopCallFrame".} -proc VarEval*(interp: pInterp): int{.cdecl, varargs, dynlib: dllName, - importc: "Tcl_VarEval".} - # For TkConsole.c * -proc RecordAndEval*(interp: pInterp, cmd: cstring, flags: int): int{.cdecl, - dynlib: dllName, importc: "Tcl_RecordAndEval".} -proc GlobalEval*(interp: pInterp, command: cstring): int{.cdecl, - dynlib: dllName, importc: "Tcl_GlobalEval".} -proc DStringFree*(dsPtr: pDString){.cdecl, dynlib: dllName, - importc: "Tcl_DStringFree".} -proc DStringAppend*(dsPtr: pDString, str: cstring, length: int): cstring{. - cdecl, dynlib: dllName, importc: "Tcl_DStringAppend".} -proc DStringAppendElement*(dsPtr: pDString, str: cstring): cstring{.cdecl, - dynlib: dllName, importc: "Tcl_DStringAppendElement".} -proc DStringInit*(dsPtr: pDString){.cdecl, dynlib: dllName, - importc: "Tcl_DStringInit".} -proc AppendResult*(interp: pInterp){.cdecl, varargs, dynlib: dllName, - importc: "Tcl_AppendResult".} - # actually a "C" var array -proc SetStdChannel*(channel: pChannel, typ: int){.cdecl, dynlib: dllName, - importc: "Tcl_SetStdChannel".} -proc SetChannelOption*(interp: pInterp, chan: pChannel, optionName: cstring, - newValue: cstring): int{.cdecl, dynlib: dllName, - importc: "Tcl_SetChannelOption".} -proc GetChannelOption*(interp: pInterp, chan: pChannel, optionName: cstring, - dsPtr: pDString): int{.cdecl, dynlib: dllName, - importc: "Tcl_GetChannelOption".} -proc CreateChannel*(typePtr: pChannelType, chanName: cstring, - instanceData: TClientData, mask: int): pChannel{. - cdecl, dynlib: dllName, importc: "Tcl_CreateChannel".} -proc RegisterChannel*(interp: pInterp, channel: pChannel){.cdecl, - dynlib: dllName, importc: "Tcl_RegisterChannel".} -proc UnregisterChannel*(interp: pInterp, channel: pChannel): int{.cdecl, - dynlib: dllName, importc: "Tcl_UnregisterChannel".} -proc CreateChannelHandler*(chan: pChannel, mask: int, prc: TChannelProc, - clientData: TClientData){.cdecl, - dynlib: dllName, importc: "Tcl_CreateChannelHandler".} -proc GetChannel*(interp: pInterp, chanName: cstring, modePtr: pInteger): pChannel{. - cdecl, dynlib: dllName, importc: "Tcl_GetChannel".} -proc GetStdChannel*(typ: int): pChannel{.cdecl, dynlib: dllName, - importc: "Tcl_GetStdChannel".} -proc Gets*(chan: pChannel, dsPtr: pDString): int{.cdecl, dynlib: dllName, - importc: "Tcl_Gets".} -proc Write*(chan: pChannel, s: cstring, slen: int): int{.cdecl, - dynlib: dllName, importc: "Tcl_Write".} -proc Flush*(chan: pChannel): int{.cdecl, dynlib: dllName, - importc: "Tcl_Flush".} - # TclWinLoadLibrary = function(name: PChar): HMODULE; cdecl; external dllName; -proc CreateExitHandler*(prc: TClientDataProc, clientData: TClientData){. - cdecl, dynlib: dllName, importc: "Tcl_CreateExitHandler".} -proc DeleteExitHandler*(prc: TClientDataProc, clientData: TClientData){. - cdecl, dynlib: dllName, importc: "Tcl_DeleteExitHandler".} -proc GetStringFromObj*(pObj: pObj, pLen: pInteger): cstring{.cdecl, - dynlib: dllName, importc: "Tcl_GetStringFromObj".} -proc CreateObjCommand*(interp: pInterp, name: cstring, cmdProc: TObjCmdProc, - clientData: TClientData, - deleteProc: TCmdDeleteProc): pCommand{.cdecl, - dynlib: dllName, importc: "Tcl_CreateObjCommand".} -proc NewStringObj*(bytes: cstring, length: int): pObj{.cdecl, - dynlib: dllName, importc: "Tcl_NewStringObj".} - # procedure TclFreeObj(pObj: pTcl_Obj); cdecl; external dllName; -proc EvalObj*(interp: pInterp, pObj: pObj): int{.cdecl, dynlib: dllName, - importc: "Tcl_EvalObj".} -proc GlobalEvalObj*(interp: pInterp, pObj: pObj): int{.cdecl, - dynlib: dllName, importc: "Tcl_GlobalEvalObj".} -proc RegComp*(exp: cstring): pointer{.cdecl, dynlib: dllName, - importc: "TclRegComp".} - -proc RegExec*(prog: pointer, str: cstring, start: cstring): int{.cdecl, - dynlib: dllName, importc: "TclRegExec".} - -proc RegError*(msg: cstring){.cdecl, dynlib: dllName, importc: "TclRegError".} - -proc GetRegError*(): cstring{.cdecl, dynlib: dllName, - importc: "TclGetRegError".} - -proc RegExpRange*(prog: pointer, index: int, head: var cstring, - tail: var cstring){.cdecl, dynlib: dllName, - importc: "Tcl_RegExpRange".} - -proc GetCommandTable*(interp: pInterp): pHashTable = - if interp != nil: - result = cast[pHashTable](cast[int](interp) + sizeof(Interp) + - sizeof(pointer)) - -proc CreateHashEntry*(tablePtr: pHashTable, key: cstring, - newPtr: pInteger): pHashEntry = - result = cast[pHashTable](tablePtr).createProc(tablePtr, key, newPtr) - -proc FindHashEntry*(tablePtr: pHashTable, key: cstring): pHashEntry = - result = cast[pHashTable](tablePtr).findProc(tablePtr, key) - -proc SetHashValue*(h: pHashEntry, clientData: TClientData) = - h.clientData = clientData - -proc GetHashValue*(h: pHashEntry): TClientData = - result = h.clientData - -proc IncrRefCount*(pObj: pObj) = - inc(pObj.refCount) - -proc DecrRefCount*(pObj: pObj) = - dec(pObj.refCount) - if pObj.refCount <= 0: - dealloc(pObj) - -proc IsShared*(pObj: pObj): bool = - return pObj.refCount > 1 - -proc GetHashKey*(hashTbl: pHashTable, hashEntry: pHashEntry): cstring = - if hashTbl == nil or hashEntry == nil: - result = nil - else: - result = hashEntry.key diff --git a/lib/wrappers/x11/cursorfont.nim b/lib/wrappers/x11/cursorfont.nim deleted file mode 100644 index b262ad7c1..000000000 --- a/lib/wrappers/x11/cursorfont.nim +++ /dev/null @@ -1,110 +0,0 @@ -# $Xorg: cursorfont.h,v 1.4 2001/02/09 02:03:39 xorgcvs Exp $ -# -# -#Copyright 1987, 1998 The Open Group -# -#Permission to use, copy, modify, distribute, and sell this software and its -#documentation for any purpose is hereby granted without fee, provided that -#the above copyright notice appear in all copies and that both that -#copyright notice and this permission notice appear in supporting -#documentation. -# -#The above copyright notice and this permission notice shall be included -#in all copies or substantial portions of the Software. -# -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -#OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -#IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -#OTHER DEALINGS IN THE SOFTWARE. -# -#Except as contained in this notice, the name of The Open Group shall -#not be used in advertising or otherwise to promote the sale, use or -#other dealings in this Software without prior written authorization -#from The Open Group. -# -# - -const - XC_num_glyphs* = 154 - XC_X_cursor* = 0 - XC_arrow* = 2 - XC_based_arrow_down* = 4 - XC_based_arrow_up* = 6 - XC_boat* = 8 - XC_bogosity* = 10 - XC_bottom_left_corner* = 12 - XC_bottom_right_corner* = 14 - XC_bottom_side* = 16 - XC_bottom_tee* = 18 - XC_box_spiral* = 20 - XC_center_ptr* = 22 - XC_circle* = 24 - XC_clock* = 26 - XC_coffee_mug* = 28 - XC_cross* = 30 - XC_cross_reverse* = 32 - XC_crosshair* = 34 - XC_diamond_cross* = 36 - XC_dot* = 38 - XC_dotbox* = 40 - XC_double_arrow* = 42 - XC_draft_large* = 44 - XC_draft_small* = 46 - XC_draped_box* = 48 - XC_exchange* = 50 - XC_fleur* = 52 - XC_gobbler* = 54 - XC_gumby* = 56 - XC_hand1* = 58 - XC_hand2* = 60 - XC_heart* = 62 - XC_icon* = 64 - XC_iron_cross* = 66 - XC_left_ptr* = 68 - XC_left_side* = 70 - XC_left_tee* = 72 - XC_leftbutton* = 74 - XC_ll_angle* = 76 - XC_lr_angle* = 78 - XC_man* = 80 - XC_middlebutton* = 82 - XC_mouse* = 84 - XC_pencil* = 86 - XC_pirate* = 88 - XC_plus* = 90 - XC_question_arrow* = 92 - XC_right_ptr* = 94 - XC_right_side* = 96 - XC_right_tee* = 98 - XC_rightbutton* = 100 - XC_rtl_logo* = 102 - XC_sailboat* = 104 - XC_sb_down_arrow* = 106 - XC_sb_h_double_arrow* = 108 - XC_sb_left_arrow* = 110 - XC_sb_right_arrow* = 112 - XC_sb_up_arrow* = 114 - XC_sb_v_double_arrow* = 116 - XC_shuttle* = 118 - XC_sizing* = 120 - XC_spider* = 122 - XC_spraycan* = 124 - XC_star* = 126 - XC_target* = 128 - XC_tcross* = 130 - XC_top_left_arrow* = 132 - XC_top_left_corner* = 134 - XC_top_right_corner* = 136 - XC_top_side* = 138 - XC_top_tee* = 140 - XC_trek* = 142 - XC_ul_angle* = 144 - XC_umbrella* = 146 - XC_ur_angle* = 148 - XC_watch* = 150 - XC_xterm* = 152 - -# implementation diff --git a/lib/wrappers/x11/keysym.nim b/lib/wrappers/x11/keysym.nim deleted file mode 100644 index c001ab622..000000000 --- a/lib/wrappers/x11/keysym.nim +++ /dev/null @@ -1,1926 +0,0 @@ -# -#Converted from X11/keysym.h and X11/keysymdef.h -# -#Capital letter consts renamed from XK_... to XKc_... -# (since Pascal isn't case-sensitive) -# -#i.e. -#C Pascal -#XK_a XK_a -#XK_A XKc_A -# - -#* default keysyms * -import x - -const - XK_VoidSymbol*: TKeySym = 0x00FFFFFF # void symbol - -when defined(XK_MISCELLANY) or true: - const - #* - # * TTY Functions, cleverly chosen to map to ascii, for convenience of - # * programming, but could have been arbitrary (at the cost of lookup - # * tables in client code. - # * - XK_BackSpace*: TKeySym = 0x0000FF08 # back space, back char - XK_Tab*: TKeySym = 0x0000FF09 - XK_Linefeed*: TKeySym = 0x0000FF0A # Linefeed, LF - XK_Clear*: TKeySym = 0x0000FF0B - XK_Return*: TKeySym = 0x0000FF0D # Return, enter - XK_Pause*: TKeySym = 0x0000FF13 # Pause, hold - XK_Scroll_Lock*: TKeySym = 0x0000FF14 - XK_Sys_Req*: TKeySym = 0x0000FF15 - XK_Escape*: TKeySym = 0x0000FF1B - XK_Delete*: TKeySym = 0x0000FFFF # Delete, rubout \ - # International & multi-key character composition - XK_Multi_key*: TKeySym = 0x0000FF20 # Multi-key character compose - XK_Codeinput*: TKeySym = 0x0000FF37 - XK_SingleCandidate*: TKeySym = 0x0000FF3C - XK_MultipleCandidate*: TKeySym = 0x0000FF3D - XK_PreviousCandidate*: TKeySym = 0x0000FF3E # Japanese keyboard support - XK_Kanji*: TKeySym = 0x0000FF21 # Kanji, Kanji convert - XK_Muhenkan*: TKeySym = 0x0000FF22 # Cancel Conversion - XK_Henkan_Mode*: TKeySym = 0x0000FF23 # Start/Stop Conversion - XK_Henkan*: TKeySym = 0x0000FF23 # Alias for Henkan_Mode - XK_Romaji*: TKeySym = 0x0000FF24 # to Romaji - XK_Hiragana*: TKeySym = 0x0000FF25 # to Hiragana - XK_Katakana*: TKeySym = 0x0000FF26 # to Katakana - XK_Hiragana_Katakana*: TKeySym = 0x0000FF27 # Hiragana/Katakana toggle - XK_Zenkaku*: TKeySym = 0x0000FF28 # to Zenkaku - XK_Hankaku*: TKeySym = 0x0000FF29 # to Hankaku - XK_Zenkaku_Hankaku*: TKeySym = 0x0000FF2A # Zenkaku/Hankaku toggle - XK_Touroku*: TKeySym = 0x0000FF2B # Add to Dictionary - XK_Massyo*: TKeySym = 0x0000FF2C # Delete from Dictionary - XK_Kana_Lock*: TKeySym = 0x0000FF2D # Kana Lock - XK_Kana_Shift*: TKeySym = 0x0000FF2E # Kana Shift - XK_Eisu_Shift*: TKeySym = 0x0000FF2F # Alphanumeric Shift - XK_Eisu_toggle*: TKeySym = 0x0000FF30 # Alphanumeric toggle - XK_Kanji_Bangou*: TKeySym = 0x0000FF37 # Codeinput - XK_Zen_Koho*: TKeySym = 0x0000FF3D # Multiple/All Candidate(s) - XK_Mae_Koho*: TKeySym = 0x0000FF3E # Previous Candidate \ - # = $FF31 thru = $FF3F are under XK_KOREAN - # Cursor control & motion - XK_Home*: TKeySym = 0x0000FF50 - XK_Left*: TKeySym = 0x0000FF51 # Move left, left arrow - XK_Up*: TKeySym = 0x0000FF52 # Move up, up arrow - XK_Right*: TKeySym = 0x0000FF53 # Move right, right arrow - XK_Down*: TKeySym = 0x0000FF54 # Move down, down arrow - XK_Prior*: TKeySym = 0x0000FF55 # Prior, previous - XK_Page_Up*: TKeySym = 0x0000FF55 - XK_Next*: TKeySym = 0x0000FF56 # Next - XK_Page_Down*: TKeySym = 0x0000FF56 - XK_End*: TKeySym = 0x0000FF57 # EOL - XK_Begin*: TKeySym = 0x0000FF58 # BOL \ - # Misc Functions - XK_Select*: TKeySym = 0x0000FF60 # Select, mark - XK_Print*: TKeySym = 0x0000FF61 - XK_Execute*: TKeySym = 0x0000FF62 # Execute, run, do - XK_Insert*: TKeySym = 0x0000FF63 # Insert, insert here - XK_Undo*: TKeySym = 0x0000FF65 # Undo, oops - XK_Redo*: TKeySym = 0x0000FF66 # redo, again - XK_Menu*: TKeySym = 0x0000FF67 - XK_Find*: TKeySym = 0x0000FF68 # Find, search - XK_Cancel*: TKeySym = 0x0000FF69 # Cancel, stop, abort, exit - XK_Help*: TKeySym = 0x0000FF6A # Help - XK_Break*: TKeySym = 0x0000FF6B - XK_Mode_switch*: TKeySym = 0x0000FF7E # Character set switch - XK_script_switch*: TKeySym = 0x0000FF7E # Alias for mode_switch - XK_Num_Lock*: TKeySym = 0x0000FF7F # Keypad Functions, keypad numbers cleverly chosen to map to ascii - XK_KP_Space*: TKeySym = 0x0000FF80 # space - XK_KP_Tab*: TKeySym = 0x0000FF89 - XK_KP_Enter*: TKeySym = 0x0000FF8D # enter - XK_KP_F1*: TKeySym = 0x0000FF91 # PF1, KP_A, ... - XK_KP_F2*: TKeySym = 0x0000FF92 - XK_KP_F3*: TKeySym = 0x0000FF93 - XK_KP_F4*: TKeySym = 0x0000FF94 - XK_KP_Home*: TKeySym = 0x0000FF95 - XK_KP_Left*: TKeySym = 0x0000FF96 - XK_KP_Up*: TKeySym = 0x0000FF97 - XK_KP_Right*: TKeySym = 0x0000FF98 - XK_KP_Down*: TKeySym = 0x0000FF99 - XK_KP_Prior*: TKeySym = 0x0000FF9A - XK_KP_Page_Up*: TKeySym = 0x0000FF9A - XK_KP_Next*: TKeySym = 0x0000FF9B - XK_KP_Page_Down*: TKeySym = 0x0000FF9B - XK_KP_End*: TKeySym = 0x0000FF9C - XK_KP_Begin*: TKeySym = 0x0000FF9D - XK_KP_Insert*: TKeySym = 0x0000FF9E - XK_KP_Delete*: TKeySym = 0x0000FF9F - XK_KP_Equal*: TKeySym = 0x0000FFBD # equals - XK_KP_Multiply*: TKeySym = 0x0000FFAA - XK_KP_Add*: TKeySym = 0x0000FFAB - XK_KP_Separator*: TKeySym = 0x0000FFAC # separator, often comma - XK_KP_Subtract*: TKeySym = 0x0000FFAD - XK_KP_Decimal*: TKeySym = 0x0000FFAE - XK_KP_Divide*: TKeySym = 0x0000FFAF - XK_KP_0*: TKeySym = 0x0000FFB0 - XK_KP_1*: TKeySym = 0x0000FFB1 - XK_KP_2*: TKeySym = 0x0000FFB2 - XK_KP_3*: TKeySym = 0x0000FFB3 - XK_KP_4*: TKeySym = 0x0000FFB4 - XK_KP_5*: TKeySym = 0x0000FFB5 - XK_KP_6*: TKeySym = 0x0000FFB6 - XK_KP_7*: TKeySym = 0x0000FFB7 - XK_KP_8*: TKeySym = 0x0000FFB8 - XK_KP_9*: TKeySym = 0x0000FFB9 #*\ - # * Auxilliary Functions; note the duplicate definitions for left and right - # * function keys; Sun keyboards and a few other manufactures have such - # * function key groups on the left and/or right sides of the keyboard. - # * We've not found a keyboard with more than 35 function keys total. - # * - XK_F1*: TKeySym = 0x0000FFBE - XK_F2*: TKeySym = 0x0000FFBF - XK_F3*: TKeySym = 0x0000FFC0 - XK_F4*: TKeySym = 0x0000FFC1 - XK_F5*: TKeySym = 0x0000FFC2 - XK_F6*: TKeySym = 0x0000FFC3 - XK_F7*: TKeySym = 0x0000FFC4 - XK_F8*: TKeySym = 0x0000FFC5 - XK_F9*: TKeySym = 0x0000FFC6 - XK_F10*: TKeySym = 0x0000FFC7 - XK_F11*: TKeySym = 0x0000FFC8 - XK_L1*: TKeySym = 0x0000FFC8 - XK_F12*: TKeySym = 0x0000FFC9 - XK_L2*: TKeySym = 0x0000FFC9 - XK_F13*: TKeySym = 0x0000FFCA - XK_L3*: TKeySym = 0x0000FFCA - XK_F14*: TKeySym = 0x0000FFCB - XK_L4*: TKeySym = 0x0000FFCB - XK_F15*: TKeySym = 0x0000FFCC - XK_L5*: TKeySym = 0x0000FFCC - XK_F16*: TKeySym = 0x0000FFCD - XK_L6*: TKeySym = 0x0000FFCD - XK_F17*: TKeySym = 0x0000FFCE - XK_L7*: TKeySym = 0x0000FFCE - XK_F18*: TKeySym = 0x0000FFCF - XK_L8*: TKeySym = 0x0000FFCF - XK_F19*: TKeySym = 0x0000FFD0 - XK_L9*: TKeySym = 0x0000FFD0 - XK_F20*: TKeySym = 0x0000FFD1 - XK_L10*: TKeySym = 0x0000FFD1 - XK_F21*: TKeySym = 0x0000FFD2 - XK_R1*: TKeySym = 0x0000FFD2 - XK_F22*: TKeySym = 0x0000FFD3 - XK_R2*: TKeySym = 0x0000FFD3 - XK_F23*: TKeySym = 0x0000FFD4 - XK_R3*: TKeySym = 0x0000FFD4 - XK_F24*: TKeySym = 0x0000FFD5 - XK_R4*: TKeySym = 0x0000FFD5 - XK_F25*: TKeySym = 0x0000FFD6 - XK_R5*: TKeySym = 0x0000FFD6 - XK_F26*: TKeySym = 0x0000FFD7 - XK_R6*: TKeySym = 0x0000FFD7 - XK_F27*: TKeySym = 0x0000FFD8 - XK_R7*: TKeySym = 0x0000FFD8 - XK_F28*: TKeySym = 0x0000FFD9 - XK_R8*: TKeySym = 0x0000FFD9 - XK_F29*: TKeySym = 0x0000FFDA - XK_R9*: TKeySym = 0x0000FFDA - XK_F30*: TKeySym = 0x0000FFDB - XK_R10*: TKeySym = 0x0000FFDB - XK_F31*: TKeySym = 0x0000FFDC - XK_R11*: TKeySym = 0x0000FFDC - XK_F32*: TKeySym = 0x0000FFDD - XK_R12*: TKeySym = 0x0000FFDD - XK_F33*: TKeySym = 0x0000FFDE - XK_R13*: TKeySym = 0x0000FFDE - XK_F34*: TKeySym = 0x0000FFDF - XK_R14*: TKeySym = 0x0000FFDF - XK_F35*: TKeySym = 0x0000FFE0 - XK_R15*: TKeySym = 0x0000FFE0 # Modifiers - XK_Shift_L*: TKeySym = 0x0000FFE1 # Left shift - XK_Shift_R*: TKeySym = 0x0000FFE2 # Right shift - XK_Control_L*: TKeySym = 0x0000FFE3 # Left control - XK_Control_R*: TKeySym = 0x0000FFE4 # Right control - XK_Caps_Lock*: TKeySym = 0x0000FFE5 # Caps lock - XK_Shift_Lock*: TKeySym = 0x0000FFE6 # Shift lock - XK_Meta_L*: TKeySym = 0x0000FFE7 # Left meta - XK_Meta_R*: TKeySym = 0x0000FFE8 # Right meta - XK_Alt_L*: TKeySym = 0x0000FFE9 # Left alt - XK_Alt_R*: TKeySym = 0x0000FFEA # Right alt - XK_Super_L*: TKeySym = 0x0000FFEB # Left super - XK_Super_R*: TKeySym = 0x0000FFEC # Right super - XK_Hyper_L*: TKeySym = 0x0000FFED # Left hyper - XK_Hyper_R*: TKeySym = 0x0000FFEE # Right hyper -# XK_MISCELLANY -#* -# * ISO 9995 Function and Modifier Keys -# * Byte 3 = = $FE -# * - -when defined(XK_XKB_KEYS) or true: - const - XK_ISO_Lock*: TKeySym = 0x0000FE01 - XK_ISO_Level2_Latch*: TKeySym = 0x0000FE02 - XK_ISO_Level3_Shift*: TKeySym = 0x0000FE03 - XK_ISO_Level3_Latch*: TKeySym = 0x0000FE04 - XK_ISO_Level3_Lock*: TKeySym = 0x0000FE05 - XK_ISO_Group_Shift*: TKeySym = 0x0000FF7E # Alias for mode_switch - XK_ISO_Group_Latch*: TKeySym = 0x0000FE06 - XK_ISO_Group_Lock*: TKeySym = 0x0000FE07 - XK_ISO_Next_Group*: TKeySym = 0x0000FE08 - XK_ISO_Next_Group_Lock*: TKeySym = 0x0000FE09 - XK_ISO_Prev_Group*: TKeySym = 0x0000FE0A - XK_ISO_Prev_Group_Lock*: TKeySym = 0x0000FE0B - XK_ISO_First_Group*: TKeySym = 0x0000FE0C - XK_ISO_First_Group_Lock*: TKeySym = 0x0000FE0D - XK_ISO_Last_Group*: TKeySym = 0x0000FE0E - XK_ISO_Last_Group_Lock*: TKeySym = 0x0000FE0F - XK_ISO_Left_Tab*: TKeySym = 0x0000FE20 - XK_ISO_Move_Line_Up*: TKeySym = 0x0000FE21 - XK_ISO_Move_Line_Down*: TKeySym = 0x0000FE22 - XK_ISO_Partial_Line_Up*: TKeySym = 0x0000FE23 - XK_ISO_Partial_Line_Down*: TKeySym = 0x0000FE24 - XK_ISO_Partial_Space_Left*: TKeySym = 0x0000FE25 - XK_ISO_Partial_Space_Right*: TKeySym = 0x0000FE26 - XK_ISO_Set_Margin_Left*: TKeySym = 0x0000FE27 - XK_ISO_Set_Margin_Right*: TKeySym = 0x0000FE28 - XK_ISO_Release_Margin_Left*: TKeySym = 0x0000FE29 - XK_ISO_Release_Margin_Right*: TKeySym = 0x0000FE2A - XK_ISO_Release_Both_Margins*: TKeySym = 0x0000FE2B - XK_ISO_Fast_Cursor_Left*: TKeySym = 0x0000FE2C - XK_ISO_Fast_Cursor_Right*: TKeySym = 0x0000FE2D - XK_ISO_Fast_Cursor_Up*: TKeySym = 0x0000FE2E - XK_ISO_Fast_Cursor_Down*: TKeySym = 0x0000FE2F - XK_ISO_Continuous_Underline*: TKeySym = 0x0000FE30 - XK_ISO_Discontinuous_Underline*: TKeySym = 0x0000FE31 - XK_ISO_Emphasize*: TKeySym = 0x0000FE32 - XK_ISO_Center_Object*: TKeySym = 0x0000FE33 - XK_ISO_Enter*: TKeySym = 0x0000FE34 - XK_dead_grave*: TKeySym = 0x0000FE50 - XK_dead_acute*: TKeySym = 0x0000FE51 - XK_dead_circumflex*: TKeySym = 0x0000FE52 - XK_dead_tilde*: TKeySym = 0x0000FE53 - XK_dead_macron*: TKeySym = 0x0000FE54 - XK_dead_breve*: TKeySym = 0x0000FE55 - XK_dead_abovedot*: TKeySym = 0x0000FE56 - XK_dead_diaeresis*: TKeySym = 0x0000FE57 - XK_dead_abovering*: TKeySym = 0x0000FE58 - XK_dead_doubleacute*: TKeySym = 0x0000FE59 - XK_dead_caron*: TKeySym = 0x0000FE5A - XK_dead_cedilla*: TKeySym = 0x0000FE5B - XK_dead_ogonek*: TKeySym = 0x0000FE5C - XK_dead_iota*: TKeySym = 0x0000FE5D - XK_dead_voiced_sound*: TKeySym = 0x0000FE5E - XK_dead_semivoiced_sound*: TKeySym = 0x0000FE5F - XK_dead_belowdot*: TKeySym = 0x0000FE60 - XK_dead_hook*: TKeySym = 0x0000FE61 - XK_dead_horn*: TKeySym = 0x0000FE62 - XK_First_Virtual_Screen*: TKeySym = 0x0000FED0 - XK_Prev_Virtual_Screen*: TKeySym = 0x0000FED1 - XK_Next_Virtual_Screen*: TKeySym = 0x0000FED2 - XK_Last_Virtual_Screen*: TKeySym = 0x0000FED4 - XK_Terminate_Server*: TKeySym = 0x0000FED5 - XK_AccessX_Enable*: TKeySym = 0x0000FE70 - XK_AccessX_Feedback_Enable*: TKeySym = 0x0000FE71 - XK_RepeatKeys_Enable*: TKeySym = 0x0000FE72 - XK_SlowKeys_Enable*: TKeySym = 0x0000FE73 - XK_BounceKeys_Enable*: TKeySym = 0x0000FE74 - XK_StickyKeys_Enable*: TKeySym = 0x0000FE75 - XK_MouseKeys_Enable*: TKeySym = 0x0000FE76 - XK_MouseKeys_Accel_Enable*: TKeySym = 0x0000FE77 - XK_Overlay1_Enable*: TKeySym = 0x0000FE78 - XK_Overlay2_Enable*: TKeySym = 0x0000FE79 - XK_AudibleBell_Enable*: TKeySym = 0x0000FE7A - XK_Pointer_Left*: TKeySym = 0x0000FEE0 - XK_Pointer_Right*: TKeySym = 0x0000FEE1 - XK_Pointer_Up*: TKeySym = 0x0000FEE2 - XK_Pointer_Down*: TKeySym = 0x0000FEE3 - XK_Pointer_UpLeft*: TKeySym = 0x0000FEE4 - XK_Pointer_UpRight*: TKeySym = 0x0000FEE5 - XK_Pointer_DownLeft*: TKeySym = 0x0000FEE6 - XK_Pointer_DownRight*: TKeySym = 0x0000FEE7 - XK_Pointer_Button_Dflt*: TKeySym = 0x0000FEE8 - XK_Pointer_Button1*: TKeySym = 0x0000FEE9 - XK_Pointer_Button2*: TKeySym = 0x0000FEEA - XK_Pointer_Button3*: TKeySym = 0x0000FEEB - XK_Pointer_Button4*: TKeySym = 0x0000FEEC - XK_Pointer_Button5*: TKeySym = 0x0000FEED - XK_Pointer_DblClick_Dflt*: TKeySym = 0x0000FEEE - XK_Pointer_DblClick1*: TKeySym = 0x0000FEEF - XK_Pointer_DblClick2*: TKeySym = 0x0000FEF0 - XK_Pointer_DblClick3*: TKeySym = 0x0000FEF1 - XK_Pointer_DblClick4*: TKeySym = 0x0000FEF2 - XK_Pointer_DblClick5*: TKeySym = 0x0000FEF3 - XK_Pointer_Drag_Dflt*: TKeySym = 0x0000FEF4 - XK_Pointer_Drag1*: TKeySym = 0x0000FEF5 - XK_Pointer_Drag2*: TKeySym = 0x0000FEF6 - XK_Pointer_Drag3*: TKeySym = 0x0000FEF7 - XK_Pointer_Drag4*: TKeySym = 0x0000FEF8 - XK_Pointer_Drag5*: TKeySym = 0x0000FEFD - XK_Pointer_EnableKeys*: TKeySym = 0x0000FEF9 - XK_Pointer_Accelerate*: TKeySym = 0x0000FEFA - XK_Pointer_DfltBtnNext*: TKeySym = 0x0000FEFB - XK_Pointer_DfltBtnPrev*: TKeySym = 0x0000FEFC - #* - # * 3270 Terminal Keys - # * Byte 3 = = $FD - # * - -when defined(XK_3270) or true: - const - XK_3270_Duplicate*: TKeySym = 0x0000FD01 - XK_3270_FieldMark*: TKeySym = 0x0000FD02 - XK_3270_Right2*: TKeySym = 0x0000FD03 - XK_3270_Left2*: TKeySym = 0x0000FD04 - XK_3270_BackTab*: TKeySym = 0x0000FD05 - XK_3270_EraseEOF*: TKeySym = 0x0000FD06 - XK_3270_EraseInput*: TKeySym = 0x0000FD07 - XK_3270_Reset*: TKeySym = 0x0000FD08 - XK_3270_Quit*: TKeySym = 0x0000FD09 - XK_3270_PA1*: TKeySym = 0x0000FD0A - XK_3270_PA2*: TKeySym = 0x0000FD0B - XK_3270_PA3*: TKeySym = 0x0000FD0C - XK_3270_Test*: TKeySym = 0x0000FD0D - XK_3270_Attn*: TKeySym = 0x0000FD0E - XK_3270_CursorBlink*: TKeySym = 0x0000FD0F - XK_3270_AltCursor*: TKeySym = 0x0000FD10 - XK_3270_KeyClick*: TKeySym = 0x0000FD11 - XK_3270_Jump*: TKeySym = 0x0000FD12 - XK_3270_Ident*: TKeySym = 0x0000FD13 - XK_3270_Rule*: TKeySym = 0x0000FD14 - XK_3270_Copy*: TKeySym = 0x0000FD15 - XK_3270_Play*: TKeySym = 0x0000FD16 - XK_3270_Setup*: TKeySym = 0x0000FD17 - XK_3270_Record*: TKeySym = 0x0000FD18 - XK_3270_ChangeScreen*: TKeySym = 0x0000FD19 - XK_3270_DeleteWord*: TKeySym = 0x0000FD1A - XK_3270_ExSelect*: TKeySym = 0x0000FD1B - XK_3270_CursorSelect*: TKeySym = 0x0000FD1C - XK_3270_PrintScreen*: TKeySym = 0x0000FD1D - XK_3270_Enter*: TKeySym = 0x0000FD1E -#* -# * Latin 1 -# * Byte 3 = 0 -# * - -when defined(XK_LATIN1) or true: - const - XK_space*: TKeySym = 0x00000020 - XK_exclam*: TKeySym = 0x00000021 - XK_quotedbl*: TKeySym = 0x00000022 - XK_numbersign*: TKeySym = 0x00000023 - XK_dollar*: TKeySym = 0x00000024 - XK_percent*: TKeySym = 0x00000025 - XK_ampersand*: TKeySym = 0x00000026 - XK_apostrophe*: TKeySym = 0x00000027 - XK_quoteright*: TKeySym = 0x00000027 # deprecated - XK_parenleft*: TKeySym = 0x00000028 - XK_parenright*: TKeySym = 0x00000029 - XK_asterisk*: TKeySym = 0x0000002A - XK_plus*: TKeySym = 0x0000002B - XK_comma*: TKeySym = 0x0000002C - XK_minus*: TKeySym = 0x0000002D - XK_period*: TKeySym = 0x0000002E - XK_slash*: TKeySym = 0x0000002F - XK_0*: TKeySym = 0x00000030 - XK_1*: TKeySym = 0x00000031 - XK_2*: TKeySym = 0x00000032 - XK_3*: TKeySym = 0x00000033 - XK_4*: TKeySym = 0x00000034 - XK_5*: TKeySym = 0x00000035 - XK_6*: TKeySym = 0x00000036 - XK_7*: TKeySym = 0x00000037 - XK_8*: TKeySym = 0x00000038 - XK_9*: TKeySym = 0x00000039 - XK_colon*: TKeySym = 0x0000003A - XK_semicolon*: TKeySym = 0x0000003B - XK_less*: TKeySym = 0x0000003C - XK_equal*: TKeySym = 0x0000003D - XK_greater*: TKeySym = 0x0000003E - XK_question*: TKeySym = 0x0000003F - XK_at*: TKeySym = 0x00000040 - XKc_A*: TKeySym = 0x00000041 - XKc_B*: TKeySym = 0x00000042 - XKc_C*: TKeySym = 0x00000043 - XKc_D*: TKeySym = 0x00000044 - XKc_E*: TKeySym = 0x00000045 - XKc_F*: TKeySym = 0x00000046 - XKc_G*: TKeySym = 0x00000047 - XKc_H*: TKeySym = 0x00000048 - XKc_I*: TKeySym = 0x00000049 - XKc_J*: TKeySym = 0x0000004A - XKc_K*: TKeySym = 0x0000004B - XKc_L*: TKeySym = 0x0000004C - XKc_M*: TKeySym = 0x0000004D - XKc_N*: TKeySym = 0x0000004E - XKc_O*: TKeySym = 0x0000004F - XKc_P*: TKeySym = 0x00000050 - XKc_Q*: TKeySym = 0x00000051 - XKc_R*: TKeySym = 0x00000052 - XKc_S*: TKeySym = 0x00000053 - XKc_T*: TKeySym = 0x00000054 - XKc_U*: TKeySym = 0x00000055 - XKc_V*: TKeySym = 0x00000056 - XKc_W*: TKeySym = 0x00000057 - XKc_X*: TKeySym = 0x00000058 - XKc_Y*: TKeySym = 0x00000059 - XKc_Z*: TKeySym = 0x0000005A - XK_bracketleft*: TKeySym = 0x0000005B - XK_backslash*: TKeySym = 0x0000005C - XK_bracketright*: TKeySym = 0x0000005D - XK_asciicircum*: TKeySym = 0x0000005E - XK_underscore*: TKeySym = 0x0000005F - XK_grave*: TKeySym = 0x00000060 - XK_quoteleft*: TKeySym = 0x00000060 # deprecated - XK_a*: TKeySym = 0x00000061 - XK_b*: TKeySym = 0x00000062 - XK_c*: TKeySym = 0x00000063 - XK_d*: TKeySym = 0x00000064 - XK_e*: TKeySym = 0x00000065 - XK_f*: TKeySym = 0x00000066 - XK_g*: TKeySym = 0x00000067 - XK_h*: TKeySym = 0x00000068 - XK_i*: TKeySym = 0x00000069 - XK_j*: TKeySym = 0x0000006A - XK_k*: TKeySym = 0x0000006B - XK_l*: TKeySym = 0x0000006C - XK_m*: TKeySym = 0x0000006D - XK_n*: TKeySym = 0x0000006E - XK_o*: TKeySym = 0x0000006F - XK_p*: TKeySym = 0x00000070 - XK_q*: TKeySym = 0x00000071 - XK_r*: TKeySym = 0x00000072 - XK_s*: TKeySym = 0x00000073 - XK_t*: TKeySym = 0x00000074 - XK_u*: TKeySym = 0x00000075 - XK_v*: TKeySym = 0x00000076 - XK_w*: TKeySym = 0x00000077 - XK_x*: TKeySym = 0x00000078 - XK_y*: TKeySym = 0x00000079 - XK_z*: TKeySym = 0x0000007A - XK_braceleft*: TKeySym = 0x0000007B - XK_bar*: TKeySym = 0x0000007C - XK_braceright*: TKeySym = 0x0000007D - XK_asciitilde*: TKeySym = 0x0000007E - XK_nobreakspace*: TKeySym = 0x000000A0 - XK_exclamdown*: TKeySym = 0x000000A1 - XK_cent*: TKeySym = 0x000000A2 - XK_sterling*: TKeySym = 0x000000A3 - XK_currency*: TKeySym = 0x000000A4 - XK_yen*: TKeySym = 0x000000A5 - XK_brokenbar*: TKeySym = 0x000000A6 - XK_section*: TKeySym = 0x000000A7 - XK_diaeresis*: TKeySym = 0x000000A8 - XK_copyright*: TKeySym = 0x000000A9 - XK_ordfeminine*: TKeySym = 0x000000AA - XK_guillemotleft*: TKeySym = 0x000000AB # left angle quotation mark - XK_notsign*: TKeySym = 0x000000AC - XK_hyphen*: TKeySym = 0x000000AD - XK_registered*: TKeySym = 0x000000AE - XK_macron*: TKeySym = 0x000000AF - XK_degree*: TKeySym = 0x000000B0 - XK_plusminus*: TKeySym = 0x000000B1 - XK_twosuperior*: TKeySym = 0x000000B2 - XK_threesuperior*: TKeySym = 0x000000B3 - XK_acute*: TKeySym = 0x000000B4 - XK_mu*: TKeySym = 0x000000B5 - XK_paragraph*: TKeySym = 0x000000B6 - XK_periodcentered*: TKeySym = 0x000000B7 - XK_cedilla*: TKeySym = 0x000000B8 - XK_onesuperior*: TKeySym = 0x000000B9 - XK_masculine*: TKeySym = 0x000000BA - XK_guillemotright*: TKeySym = 0x000000BB # right angle quotation mark - XK_onequarter*: TKeySym = 0x000000BC - XK_onehalf*: TKeySym = 0x000000BD - XK_threequarters*: TKeySym = 0x000000BE - XK_questiondown*: TKeySym = 0x000000BF - XKc_Agrave*: TKeySym = 0x000000C0 - XKc_Aacute*: TKeySym = 0x000000C1 - XKc_Acircumflex*: TKeySym = 0x000000C2 - XKc_Atilde*: TKeySym = 0x000000C3 - XKc_Adiaeresis*: TKeySym = 0x000000C4 - XKc_Aring*: TKeySym = 0x000000C5 - XKc_AE*: TKeySym = 0x000000C6 - XKc_Ccedilla*: TKeySym = 0x000000C7 - XKc_Egrave*: TKeySym = 0x000000C8 - XKc_Eacute*: TKeySym = 0x000000C9 - XKc_Ecircumflex*: TKeySym = 0x000000CA - XKc_Ediaeresis*: TKeySym = 0x000000CB - XKc_Igrave*: TKeySym = 0x000000CC - XKc_Iacute*: TKeySym = 0x000000CD - XKc_Icircumflex*: TKeySym = 0x000000CE - XKc_Idiaeresis*: TKeySym = 0x000000CF - XKc_ETH*: TKeySym = 0x000000D0 - XKc_Ntilde*: TKeySym = 0x000000D1 - XKc_Ograve*: TKeySym = 0x000000D2 - XKc_Oacute*: TKeySym = 0x000000D3 - XKc_Ocircumflex*: TKeySym = 0x000000D4 - XKc_Otilde*: TKeySym = 0x000000D5 - XKc_Odiaeresis*: TKeySym = 0x000000D6 - XK_multiply*: TKeySym = 0x000000D7 - XKc_Ooblique*: TKeySym = 0x000000D8 - XKc_Oslash*: TKeySym = XKc_Ooblique - XKc_Ugrave*: TKeySym = 0x000000D9 - XKc_Uacute*: TKeySym = 0x000000DA - XKc_Ucircumflex*: TKeySym = 0x000000DB - XKc_Udiaeresis*: TKeySym = 0x000000DC - XKc_Yacute*: TKeySym = 0x000000DD - XKc_THORN*: TKeySym = 0x000000DE - XK_ssharp*: TKeySym = 0x000000DF - XK_agrave*: TKeySym = 0x000000E0 - XK_aacute*: TKeySym = 0x000000E1 - XK_acircumflex*: TKeySym = 0x000000E2 - XK_atilde*: TKeySym = 0x000000E3 - XK_adiaeresis*: TKeySym = 0x000000E4 - XK_aring*: TKeySym = 0x000000E5 - XK_ae*: TKeySym = 0x000000E6 - XK_ccedilla*: TKeySym = 0x000000E7 - XK_egrave*: TKeySym = 0x000000E8 - XK_eacute*: TKeySym = 0x000000E9 - XK_ecircumflex*: TKeySym = 0x000000EA - XK_ediaeresis*: TKeySym = 0x000000EB - XK_igrave*: TKeySym = 0x000000EC - XK_iacute*: TKeySym = 0x000000ED - XK_icircumflex*: TKeySym = 0x000000EE - XK_idiaeresis*: TKeySym = 0x000000EF - XK_eth*: TKeySym = 0x000000F0 - XK_ntilde*: TKeySym = 0x000000F1 - XK_ograve*: TKeySym = 0x000000F2 - XK_oacute*: TKeySym = 0x000000F3 - XK_ocircumflex*: TKeySym = 0x000000F4 - XK_otilde*: TKeySym = 0x000000F5 - XK_odiaeresis*: TKeySym = 0x000000F6 - XK_division*: TKeySym = 0x000000F7 - XK_oslash*: TKeySym = 0x000000F8 - XK_ooblique*: TKeySym = XK_oslash - XK_ugrave*: TKeySym = 0x000000F9 - XK_uacute*: TKeySym = 0x000000FA - XK_ucircumflex*: TKeySym = 0x000000FB - XK_udiaeresis*: TKeySym = 0x000000FC - XK_yacute*: TKeySym = 0x000000FD - XK_thorn*: TKeySym = 0x000000FE - XK_ydiaeresis*: TKeySym = 0x000000FF -# XK_LATIN1 -#* -# * Latin 2 -# * Byte 3 = 1 -# * - -when defined(XK_LATIN2) or true: - const - XKc_Aogonek*: TKeySym = 0x000001A1 - XK_breve*: TKeySym = 0x000001A2 - XKc_Lstroke*: TKeySym = 0x000001A3 - XKc_Lcaron*: TKeySym = 0x000001A5 - XKc_Sacute*: TKeySym = 0x000001A6 - XKc_Scaron*: TKeySym = 0x000001A9 - XKc_Scedilla*: TKeySym = 0x000001AA - XKc_Tcaron*: TKeySym = 0x000001AB - XKc_Zacute*: TKeySym = 0x000001AC - XKc_Zcaron*: TKeySym = 0x000001AE - XKc_Zabovedot*: TKeySym = 0x000001AF - XK_aogonek*: TKeySym = 0x000001B1 - XK_ogonek*: TKeySym = 0x000001B2 - XK_lstroke*: TKeySym = 0x000001B3 - XK_lcaron*: TKeySym = 0x000001B5 - XK_sacute*: TKeySym = 0x000001B6 - XK_caron*: TKeySym = 0x000001B7 - XK_scaron*: TKeySym = 0x000001B9 - XK_scedilla*: TKeySym = 0x000001BA - XK_tcaron*: TKeySym = 0x000001BB - XK_zacute*: TKeySym = 0x000001BC - XK_doubleacute*: TKeySym = 0x000001BD - XK_zcaron*: TKeySym = 0x000001BE - XK_zabovedot*: TKeySym = 0x000001BF - XKc_Racute*: TKeySym = 0x000001C0 - XKc_Abreve*: TKeySym = 0x000001C3 - XKc_Lacute*: TKeySym = 0x000001C5 - XKc_Cacute*: TKeySym = 0x000001C6 - XKc_Ccaron*: TKeySym = 0x000001C8 - XKc_Eogonek*: TKeySym = 0x000001CA - XKc_Ecaron*: TKeySym = 0x000001CC - XKc_Dcaron*: TKeySym = 0x000001CF - XKc_Dstroke*: TKeySym = 0x000001D0 - XKc_Nacute*: TKeySym = 0x000001D1 - XKc_Ncaron*: TKeySym = 0x000001D2 - XKc_Odoubleacute*: TKeySym = 0x000001D5 - XKc_Rcaron*: TKeySym = 0x000001D8 - XKc_Uring*: TKeySym = 0x000001D9 - XKc_Udoubleacute*: TKeySym = 0x000001DB - XKc_Tcedilla*: TKeySym = 0x000001DE - XK_racute*: TKeySym = 0x000001E0 - XK_abreve*: TKeySym = 0x000001E3 - XK_lacute*: TKeySym = 0x000001E5 - XK_cacute*: TKeySym = 0x000001E6 - XK_ccaron*: TKeySym = 0x000001E8 - XK_eogonek*: TKeySym = 0x000001EA - XK_ecaron*: TKeySym = 0x000001EC - XK_dcaron*: TKeySym = 0x000001EF - XK_dstroke*: TKeySym = 0x000001F0 - XK_nacute*: TKeySym = 0x000001F1 - XK_ncaron*: TKeySym = 0x000001F2 - XK_odoubleacute*: TKeySym = 0x000001F5 - XK_udoubleacute*: TKeySym = 0x000001FB - XK_rcaron*: TKeySym = 0x000001F8 - XK_uring*: TKeySym = 0x000001F9 - XK_tcedilla*: TKeySym = 0x000001FE - XK_abovedot*: TKeySym = 0x000001FF -# XK_LATIN2 -#* -# * Latin 3 -# * Byte 3 = 2 -# * - -when defined(XK_LATIN3) or true: - const - XKc_Hstroke*: TKeySym = 0x000002A1 - XKc_Hcircumflex*: TKeySym = 0x000002A6 - XKc_Iabovedot*: TKeySym = 0x000002A9 - XKc_Gbreve*: TKeySym = 0x000002AB - XKc_Jcircumflex*: TKeySym = 0x000002AC - XK_hstroke*: TKeySym = 0x000002B1 - XK_hcircumflex*: TKeySym = 0x000002B6 - XK_idotless*: TKeySym = 0x000002B9 - XK_gbreve*: TKeySym = 0x000002BB - XK_jcircumflex*: TKeySym = 0x000002BC - XKc_Cabovedot*: TKeySym = 0x000002C5 - XKc_Ccircumflex*: TKeySym = 0x000002C6 - XKc_Gabovedot*: TKeySym = 0x000002D5 - XKc_Gcircumflex*: TKeySym = 0x000002D8 - XKc_Ubreve*: TKeySym = 0x000002DD - XKc_Scircumflex*: TKeySym = 0x000002DE - XK_cabovedot*: TKeySym = 0x000002E5 - XK_ccircumflex*: TKeySym = 0x000002E6 - XK_gabovedot*: TKeySym = 0x000002F5 - XK_gcircumflex*: TKeySym = 0x000002F8 - XK_ubreve*: TKeySym = 0x000002FD - XK_scircumflex*: TKeySym = 0x000002FE -# XK_LATIN3 -#* -# * Latin 4 -# * Byte 3 = 3 -# * - -when defined(XK_LATIN4) or true: - const - XK_kra*: TKeySym = 0x000003A2 - XK_kappa*: TKeySym = 0x000003A2 # deprecated - XKc_Rcedilla*: TKeySym = 0x000003A3 - XKc_Itilde*: TKeySym = 0x000003A5 - XKc_Lcedilla*: TKeySym = 0x000003A6 - XKc_Emacron*: TKeySym = 0x000003AA - XKc_Gcedilla*: TKeySym = 0x000003AB - XKc_Tslash*: TKeySym = 0x000003AC - XK_rcedilla*: TKeySym = 0x000003B3 - XK_itilde*: TKeySym = 0x000003B5 - XK_lcedilla*: TKeySym = 0x000003B6 - XK_emacron*: TKeySym = 0x000003BA - XK_gcedilla*: TKeySym = 0x000003BB - XK_tslash*: TKeySym = 0x000003BC - XKc_ENG*: TKeySym = 0x000003BD - XK_eng*: TKeySym = 0x000003BF - XKc_Amacron*: TKeySym = 0x000003C0 - XKc_Iogonek*: TKeySym = 0x000003C7 - XKc_Eabovedot*: TKeySym = 0x000003CC - XKc_Imacron*: TKeySym = 0x000003CF - XKc_Ncedilla*: TKeySym = 0x000003D1 - XKc_Omacron*: TKeySym = 0x000003D2 - XKc_Kcedilla*: TKeySym = 0x000003D3 - XKc_Uogonek*: TKeySym = 0x000003D9 - XKc_Utilde*: TKeySym = 0x000003DD - XKc_Umacron*: TKeySym = 0x000003DE - XK_amacron*: TKeySym = 0x000003E0 - XK_iogonek*: TKeySym = 0x000003E7 - XK_eabovedot*: TKeySym = 0x000003EC - XK_imacron*: TKeySym = 0x000003EF - XK_ncedilla*: TKeySym = 0x000003F1 - XK_omacron*: TKeySym = 0x000003F2 - XK_kcedilla*: TKeySym = 0x000003F3 - XK_uogonek*: TKeySym = 0x000003F9 - XK_utilde*: TKeySym = 0x000003FD - XK_umacron*: TKeySym = 0x000003FE -# XK_LATIN4 -#* -# * Latin-8 -# * Byte 3 = 18 -# * - -when defined(XK_LATIN8) or true: - const - XKc_Babovedot*: TKeySym = 0x000012A1 - XK_babovedot*: TKeySym = 0x000012A2 - XKc_Dabovedot*: TKeySym = 0x000012A6 - XKc_Wgrave*: TKeySym = 0x000012A8 - XKc_Wacute*: TKeySym = 0x000012AA - XK_dabovedot*: TKeySym = 0x000012AB - XKc_Ygrave*: TKeySym = 0x000012AC - XKc_Fabovedot*: TKeySym = 0x000012B0 - XK_fabovedot*: TKeySym = 0x000012B1 - XKc_Mabovedot*: TKeySym = 0x000012B4 - XK_mabovedot*: TKeySym = 0x000012B5 - XKc_Pabovedot*: TKeySym = 0x000012B7 - XK_wgrave*: TKeySym = 0x000012B8 - XK_pabovedot*: TKeySym = 0x000012B9 - XK_wacute*: TKeySym = 0x000012BA - XKc_Sabovedot*: TKeySym = 0x000012BB - XK_ygrave*: TKeySym = 0x000012BC - XKc_Wdiaeresis*: TKeySym = 0x000012BD - XK_wdiaeresis*: TKeySym = 0x000012BE - XK_sabovedot*: TKeySym = 0x000012BF - XKc_Wcircumflex*: TKeySym = 0x000012D0 - XKc_Tabovedot*: TKeySym = 0x000012D7 - XKc_Ycircumflex*: TKeySym = 0x000012DE - XK_wcircumflex*: TKeySym = 0x000012F0 - XK_tabovedot*: TKeySym = 0x000012F7 - XK_ycircumflex*: TKeySym = 0x000012FE -# XK_LATIN8 -#* -# * Latin-9 (a.k.a. Latin-0) -# * Byte 3 = 19 -# * - -when defined(XK_LATIN9) or true: - const - XKc_OE*: TKeySym = 0x000013BC - XK_oe*: TKeySym = 0x000013BD - XKc_Ydiaeresis*: TKeySym = 0x000013BE -# XK_LATIN9 -#* -# * Katakana -# * Byte 3 = 4 -# * - -when defined(XK_KATAKANA) or true: - const - XK_overline*: TKeySym = 0x0000047E - XK_kana_fullstop*: TKeySym = 0x000004A1 - XK_kana_openingbracket*: TKeySym = 0x000004A2 - XK_kana_closingbracket*: TKeySym = 0x000004A3 - XK_kana_comma*: TKeySym = 0x000004A4 - XK_kana_conjunctive*: TKeySym = 0x000004A5 - XK_kana_middledot*: TKeySym = 0x000004A5 # deprecated - XKc_kana_WO*: TKeySym = 0x000004A6 - XK_kana_a*: TKeySym = 0x000004A7 - XK_kana_i*: TKeySym = 0x000004A8 - XK_kana_u*: TKeySym = 0x000004A9 - XK_kana_e*: TKeySym = 0x000004AA - XK_kana_o*: TKeySym = 0x000004AB - XK_kana_ya*: TKeySym = 0x000004AC - XK_kana_yu*: TKeySym = 0x000004AD - XK_kana_yo*: TKeySym = 0x000004AE - XK_kana_tsu*: TKeySym = 0x000004AF - XK_kana_tu*: TKeySym = 0x000004AF # deprecated - XK_prolongedsound*: TKeySym = 0x000004B0 - XKc_kana_A*: TKeySym = 0x000004B1 - XKc_kana_I*: TKeySym = 0x000004B2 - XKc_kana_U*: TKeySym = 0x000004B3 - XKc_kana_E*: TKeySym = 0x000004B4 - XKc_kana_O*: TKeySym = 0x000004B5 - XKc_kana_KA*: TKeySym = 0x000004B6 - XKc_kana_KI*: TKeySym = 0x000004B7 - XKc_kana_KU*: TKeySym = 0x000004B8 - XKc_kana_KE*: TKeySym = 0x000004B9 - XKc_kana_KO*: TKeySym = 0x000004BA - XKc_kana_SA*: TKeySym = 0x000004BB - XKc_kana_SHI*: TKeySym = 0x000004BC - XKc_kana_SU*: TKeySym = 0x000004BD - XKc_kana_SE*: TKeySym = 0x000004BE - XKc_kana_SO*: TKeySym = 0x000004BF - XKc_kana_TA*: TKeySym = 0x000004C0 - XKc_kana_CHI*: TKeySym = 0x000004C1 - XKc_kana_TI*: TKeySym = 0x000004C1 # deprecated - XKc_kana_TSU*: TKeySym = 0x000004C2 - XKc_kana_TU*: TKeySym = 0x000004C2 # deprecated - XKc_kana_TE*: TKeySym = 0x000004C3 - XKc_kana_TO*: TKeySym = 0x000004C4 - XKc_kana_NA*: TKeySym = 0x000004C5 - XKc_kana_NI*: TKeySym = 0x000004C6 - XKc_kana_NU*: TKeySym = 0x000004C7 - XKc_kana_NE*: TKeySym = 0x000004C8 - XKc_kana_NO*: TKeySym = 0x000004C9 - XKc_kana_HA*: TKeySym = 0x000004CA - XKc_kana_HI*: TKeySym = 0x000004CB - XKc_kana_FU*: TKeySym = 0x000004CC - XKc_kana_HU*: TKeySym = 0x000004CC # deprecated - XKc_kana_HE*: TKeySym = 0x000004CD - XKc_kana_HO*: TKeySym = 0x000004CE - XKc_kana_MA*: TKeySym = 0x000004CF - XKc_kana_MI*: TKeySym = 0x000004D0 - XKc_kana_MU*: TKeySym = 0x000004D1 - XKc_kana_ME*: TKeySym = 0x000004D2 - XKc_kana_MO*: TKeySym = 0x000004D3 - XKc_kana_YA*: TKeySym = 0x000004D4 - XKc_kana_YU*: TKeySym = 0x000004D5 - XKc_kana_YO*: TKeySym = 0x000004D6 - XKc_kana_RA*: TKeySym = 0x000004D7 - XKc_kana_RI*: TKeySym = 0x000004D8 - XKc_kana_RU*: TKeySym = 0x000004D9 - XKc_kana_RE*: TKeySym = 0x000004DA - XKc_kana_RO*: TKeySym = 0x000004DB - XKc_kana_WA*: TKeySym = 0x000004DC - XKc_kana_N*: TKeySym = 0x000004DD - XK_voicedsound*: TKeySym = 0x000004DE - XK_semivoicedsound*: TKeySym = 0x000004DF - XK_kana_switch*: TKeySym = 0x0000FF7E # Alias for mode_switch -# XK_KATAKANA -#* -# * Arabic -# * Byte 3 = 5 -# * - -when defined(XK_ARABIC) or true: - const - XK_Farsi_0*: TKeySym = 0x00000590 - XK_Farsi_1*: TKeySym = 0x00000591 - XK_Farsi_2*: TKeySym = 0x00000592 - XK_Farsi_3*: TKeySym = 0x00000593 - XK_Farsi_4*: TKeySym = 0x00000594 - XK_Farsi_5*: TKeySym = 0x00000595 - XK_Farsi_6*: TKeySym = 0x00000596 - XK_Farsi_7*: TKeySym = 0x00000597 - XK_Farsi_8*: TKeySym = 0x00000598 - XK_Farsi_9*: TKeySym = 0x00000599 - XK_Arabic_percent*: TKeySym = 0x000005A5 - XK_Arabic_superscript_alef*: TKeySym = 0x000005A6 - XK_Arabic_tteh*: TKeySym = 0x000005A7 - XK_Arabic_peh*: TKeySym = 0x000005A8 - XK_Arabic_tcheh*: TKeySym = 0x000005A9 - XK_Arabic_ddal*: TKeySym = 0x000005AA - XK_Arabic_rreh*: TKeySym = 0x000005AB - XK_Arabic_comma*: TKeySym = 0x000005AC - XK_Arabic_fullstop*: TKeySym = 0x000005AE - XK_Arabic_0*: TKeySym = 0x000005B0 - XK_Arabic_1*: TKeySym = 0x000005B1 - XK_Arabic_2*: TKeySym = 0x000005B2 - XK_Arabic_3*: TKeySym = 0x000005B3 - XK_Arabic_4*: TKeySym = 0x000005B4 - XK_Arabic_5*: TKeySym = 0x000005B5 - XK_Arabic_6*: TKeySym = 0x000005B6 - XK_Arabic_7*: TKeySym = 0x000005B7 - XK_Arabic_8*: TKeySym = 0x000005B8 - XK_Arabic_9*: TKeySym = 0x000005B9 - XK_Arabic_semicolon*: TKeySym = 0x000005BB - XK_Arabic_question_mark*: TKeySym = 0x000005BF - XK_Arabic_hamza*: TKeySym = 0x000005C1 - XK_Arabic_maddaonalef*: TKeySym = 0x000005C2 - XK_Arabic_hamzaonalef*: TKeySym = 0x000005C3 - XK_Arabic_hamzaonwaw*: TKeySym = 0x000005C4 - XK_Arabic_hamzaunderalef*: TKeySym = 0x000005C5 - XK_Arabic_hamzaonyeh*: TKeySym = 0x000005C6 - XK_Arabic_alef*: TKeySym = 0x000005C7 - XK_Arabic_beh*: TKeySym = 0x000005C8 - XK_Arabic_tehmarbuta*: TKeySym = 0x000005C9 - XK_Arabic_teh*: TKeySym = 0x000005CA - XK_Arabic_theh*: TKeySym = 0x000005CB - XK_Arabic_jeem*: TKeySym = 0x000005CC - XK_Arabic_hah*: TKeySym = 0x000005CD - XK_Arabic_khah*: TKeySym = 0x000005CE - XK_Arabic_dal*: TKeySym = 0x000005CF - XK_Arabic_thal*: TKeySym = 0x000005D0 - XK_Arabic_ra*: TKeySym = 0x000005D1 - XK_Arabic_zain*: TKeySym = 0x000005D2 - XK_Arabic_seen*: TKeySym = 0x000005D3 - XK_Arabic_sheen*: TKeySym = 0x000005D4 - XK_Arabic_sad*: TKeySym = 0x000005D5 - XK_Arabic_dad*: TKeySym = 0x000005D6 - XK_Arabic_tah*: TKeySym = 0x000005D7 - XK_Arabic_zah*: TKeySym = 0x000005D8 - XK_Arabic_ain*: TKeySym = 0x000005D9 - XK_Arabic_ghain*: TKeySym = 0x000005DA - XK_Arabic_tatweel*: TKeySym = 0x000005E0 - XK_Arabic_feh*: TKeySym = 0x000005E1 - XK_Arabic_qaf*: TKeySym = 0x000005E2 - XK_Arabic_kaf*: TKeySym = 0x000005E3 - XK_Arabic_lam*: TKeySym = 0x000005E4 - XK_Arabic_meem*: TKeySym = 0x000005E5 - XK_Arabic_noon*: TKeySym = 0x000005E6 - XK_Arabic_ha*: TKeySym = 0x000005E7 - XK_Arabic_heh*: TKeySym = 0x000005E7 # deprecated - XK_Arabic_waw*: TKeySym = 0x000005E8 - XK_Arabic_alefmaksura*: TKeySym = 0x000005E9 - XK_Arabic_yeh*: TKeySym = 0x000005EA - XK_Arabic_fathatan*: TKeySym = 0x000005EB - XK_Arabic_dammatan*: TKeySym = 0x000005EC - XK_Arabic_kasratan*: TKeySym = 0x000005ED - XK_Arabic_fatha*: TKeySym = 0x000005EE - XK_Arabic_damma*: TKeySym = 0x000005EF - XK_Arabic_kasra*: TKeySym = 0x000005F0 - XK_Arabic_shadda*: TKeySym = 0x000005F1 - XK_Arabic_sukun*: TKeySym = 0x000005F2 - XK_Arabic_madda_above*: TKeySym = 0x000005F3 - XK_Arabic_hamza_above*: TKeySym = 0x000005F4 - XK_Arabic_hamza_below*: TKeySym = 0x000005F5 - XK_Arabic_jeh*: TKeySym = 0x000005F6 - XK_Arabic_veh*: TKeySym = 0x000005F7 - XK_Arabic_keheh*: TKeySym = 0x000005F8 - XK_Arabic_gaf*: TKeySym = 0x000005F9 - XK_Arabic_noon_ghunna*: TKeySym = 0x000005FA - XK_Arabic_heh_doachashmee*: TKeySym = 0x000005FB - XK_Farsi_yeh*: TKeySym = 0x000005FC - XK_Arabic_farsi_yeh*: TKeySym = XK_Farsi_yeh - XK_Arabic_yeh_baree*: TKeySym = 0x000005FD - XK_Arabic_heh_goal*: TKeySym = 0x000005FE - XK_Arabic_switch*: TKeySym = 0x0000FF7E # Alias for mode_switch -# XK_ARABIC -#* -# * Cyrillic -# * Byte 3 = 6 -# * - -when defined(XK_CYRILLIC) or true: - const - XKc_Cyrillic_GHE_bar*: TKeySym = 0x00000680 - XK_Cyrillic_ghe_bar*: TKeySym = 0x00000690 - XKc_Cyrillic_ZHE_descender*: TKeySym = 0x00000681 - XK_Cyrillic_zhe_descender*: TKeySym = 0x00000691 - XKc_Cyrillic_KA_descender*: TKeySym = 0x00000682 - XK_Cyrillic_ka_descender*: TKeySym = 0x00000692 - XKc_Cyrillic_KA_vertstroke*: TKeySym = 0x00000683 - XK_Cyrillic_ka_vertstroke*: TKeySym = 0x00000693 - XKc_Cyrillic_EN_descender*: TKeySym = 0x00000684 - XK_Cyrillic_en_descender*: TKeySym = 0x00000694 - XKc_Cyrillic_U_straight*: TKeySym = 0x00000685 - XK_Cyrillic_u_straight*: TKeySym = 0x00000695 - XKc_Cyrillic_U_straight_bar*: TKeySym = 0x00000686 - XK_Cyrillic_u_straight_bar*: TKeySym = 0x00000696 - XKc_Cyrillic_HA_descender*: TKeySym = 0x00000687 - XK_Cyrillic_ha_descender*: TKeySym = 0x00000697 - XKc_Cyrillic_CHE_descender*: TKeySym = 0x00000688 - XK_Cyrillic_che_descender*: TKeySym = 0x00000698 - XKc_Cyrillic_CHE_vertstroke*: TKeySym = 0x00000689 - XK_Cyrillic_che_vertstroke*: TKeySym = 0x00000699 - XKc_Cyrillic_SHHA*: TKeySym = 0x0000068A - XK_Cyrillic_shha*: TKeySym = 0x0000069A - XKc_Cyrillic_SCHWA*: TKeySym = 0x0000068C - XK_Cyrillic_schwa*: TKeySym = 0x0000069C - XKc_Cyrillic_I_macron*: TKeySym = 0x0000068D - XK_Cyrillic_i_macron*: TKeySym = 0x0000069D - XKc_Cyrillic_O_bar*: TKeySym = 0x0000068E - XK_Cyrillic_o_bar*: TKeySym = 0x0000069E - XKc_Cyrillic_U_macron*: TKeySym = 0x0000068F - XK_Cyrillic_u_macron*: TKeySym = 0x0000069F - XK_Serbian_dje*: TKeySym = 0x000006A1 - XK_Macedonia_gje*: TKeySym = 0x000006A2 - XK_Cyrillic_io*: TKeySym = 0x000006A3 - XK_Ukrainian_ie*: TKeySym = 0x000006A4 - XK_Ukranian_je*: TKeySym = 0x000006A4 # deprecated - XK_Macedonia_dse*: TKeySym = 0x000006A5 - XK_Ukrainian_i*: TKeySym = 0x000006A6 - XK_Ukranian_i*: TKeySym = 0x000006A6 # deprecated - XK_Ukrainian_yi*: TKeySym = 0x000006A7 - XK_Ukranian_yi*: TKeySym = 0x000006A7 # deprecated - XK_Cyrillic_je*: TKeySym = 0x000006A8 - XK_Serbian_je*: TKeySym = 0x000006A8 # deprecated - XK_Cyrillic_lje*: TKeySym = 0x000006A9 - XK_Serbian_lje*: TKeySym = 0x000006A9 # deprecated - XK_Cyrillic_nje*: TKeySym = 0x000006AA - XK_Serbian_nje*: TKeySym = 0x000006AA # deprecated - XK_Serbian_tshe*: TKeySym = 0x000006AB - XK_Macedonia_kje*: TKeySym = 0x000006AC - XK_Ukrainian_ghe_with_upturn*: TKeySym = 0x000006AD - XK_Byelorussian_shortu*: TKeySym = 0x000006AE - XK_Cyrillic_dzhe*: TKeySym = 0x000006AF - XK_Serbian_dze*: TKeySym = 0x000006AF # deprecated - XK_numerosign*: TKeySym = 0x000006B0 - XKc_Serbian_DJE*: TKeySym = 0x000006B1 - XKc_Macedonia_GJE*: TKeySym = 0x000006B2 - XKc_Cyrillic_IO*: TKeySym = 0x000006B3 - XKc_Ukrainian_IE*: TKeySym = 0x000006B4 - XKc_Ukranian_JE*: TKeySym = 0x000006B4 # deprecated - XKc_Macedonia_DSE*: TKeySym = 0x000006B5 - XKc_Ukrainian_I*: TKeySym = 0x000006B6 - XKc_Ukranian_I*: TKeySym = 0x000006B6 # deprecated - XKc_Ukrainian_YI*: TKeySym = 0x000006B7 - XKc_Ukranian_YI*: TKeySym = 0x000006B7 # deprecated - XKc_Cyrillic_JE*: TKeySym = 0x000006B8 - XKc_Serbian_JE*: TKeySym = 0x000006B8 # deprecated - XKc_Cyrillic_LJE*: TKeySym = 0x000006B9 - XKc_Serbian_LJE*: TKeySym = 0x000006B9 # deprecated - XKc_Cyrillic_NJE*: TKeySym = 0x000006BA - XKc_Serbian_NJE*: TKeySym = 0x000006BA # deprecated - XKc_Serbian_TSHE*: TKeySym = 0x000006BB - XKc_Macedonia_KJE*: TKeySym = 0x000006BC - XKc_Ukrainian_GHE_WITH_UPTURN*: TKeySym = 0x000006BD - XKc_Byelorussian_SHORTU*: TKeySym = 0x000006BE - XKc_Cyrillic_DZHE*: TKeySym = 0x000006BF - XKc_Serbian_DZE*: TKeySym = 0x000006BF # deprecated - XK_Cyrillic_yu*: TKeySym = 0x000006C0 - XK_Cyrillic_a*: TKeySym = 0x000006C1 - XK_Cyrillic_be*: TKeySym = 0x000006C2 - XK_Cyrillic_tse*: TKeySym = 0x000006C3 - XK_Cyrillic_de*: TKeySym = 0x000006C4 - XK_Cyrillic_ie*: TKeySym = 0x000006C5 - XK_Cyrillic_ef*: TKeySym = 0x000006C6 - XK_Cyrillic_ghe*: TKeySym = 0x000006C7 - XK_Cyrillic_ha*: TKeySym = 0x000006C8 - XK_Cyrillic_i*: TKeySym = 0x000006C9 - XK_Cyrillic_shorti*: TKeySym = 0x000006CA - XK_Cyrillic_ka*: TKeySym = 0x000006CB - XK_Cyrillic_el*: TKeySym = 0x000006CC - XK_Cyrillic_em*: TKeySym = 0x000006CD - XK_Cyrillic_en*: TKeySym = 0x000006CE - XK_Cyrillic_o*: TKeySym = 0x000006CF - XK_Cyrillic_pe*: TKeySym = 0x000006D0 - XK_Cyrillic_ya*: TKeySym = 0x000006D1 - XK_Cyrillic_er*: TKeySym = 0x000006D2 - XK_Cyrillic_es*: TKeySym = 0x000006D3 - XK_Cyrillic_te*: TKeySym = 0x000006D4 - XK_Cyrillic_u*: TKeySym = 0x000006D5 - XK_Cyrillic_zhe*: TKeySym = 0x000006D6 - XK_Cyrillic_ve*: TKeySym = 0x000006D7 - XK_Cyrillic_softsign*: TKeySym = 0x000006D8 - XK_Cyrillic_yeru*: TKeySym = 0x000006D9 - XK_Cyrillic_ze*: TKeySym = 0x000006DA - XK_Cyrillic_sha*: TKeySym = 0x000006DB - XK_Cyrillic_e*: TKeySym = 0x000006DC - XK_Cyrillic_shcha*: TKeySym = 0x000006DD - XK_Cyrillic_che*: TKeySym = 0x000006DE - XK_Cyrillic_hardsign*: TKeySym = 0x000006DF - XKc_Cyrillic_YU*: TKeySym = 0x000006E0 - XKc_Cyrillic_A*: TKeySym = 0x000006E1 - XKc_Cyrillic_BE*: TKeySym = 0x000006E2 - XKc_Cyrillic_TSE*: TKeySym = 0x000006E3 - XKc_Cyrillic_DE*: TKeySym = 0x000006E4 - XKc_Cyrillic_IE*: TKeySym = 0x000006E5 - XKc_Cyrillic_EF*: TKeySym = 0x000006E6 - XKc_Cyrillic_GHE*: TKeySym = 0x000006E7 - XKc_Cyrillic_HA*: TKeySym = 0x000006E8 - XKc_Cyrillic_I*: TKeySym = 0x000006E9 - XKc_Cyrillic_SHORTI*: TKeySym = 0x000006EA - XKc_Cyrillic_KA*: TKeySym = 0x000006EB - XKc_Cyrillic_EL*: TKeySym = 0x000006EC - XKc_Cyrillic_EM*: TKeySym = 0x000006ED - XKc_Cyrillic_EN*: TKeySym = 0x000006EE - XKc_Cyrillic_O*: TKeySym = 0x000006EF - XKc_Cyrillic_PE*: TKeySym = 0x000006F0 - XKc_Cyrillic_YA*: TKeySym = 0x000006F1 - XKc_Cyrillic_ER*: TKeySym = 0x000006F2 - XKc_Cyrillic_ES*: TKeySym = 0x000006F3 - XKc_Cyrillic_TE*: TKeySym = 0x000006F4 - XKc_Cyrillic_U*: TKeySym = 0x000006F5 - XKc_Cyrillic_ZHE*: TKeySym = 0x000006F6 - XKc_Cyrillic_VE*: TKeySym = 0x000006F7 - XKc_Cyrillic_SOFTSIGN*: TKeySym = 0x000006F8 - XKc_Cyrillic_YERU*: TKeySym = 0x000006F9 - XKc_Cyrillic_ZE*: TKeySym = 0x000006FA - XKc_Cyrillic_SHA*: TKeySym = 0x000006FB - XKc_Cyrillic_E*: TKeySym = 0x000006FC - XKc_Cyrillic_SHCHA*: TKeySym = 0x000006FD - XKc_Cyrillic_CHE*: TKeySym = 0x000006FE - XKc_Cyrillic_HARDSIGN*: TKeySym = 0x000006FF -# XK_CYRILLIC -#* -# * Greek -# * Byte 3 = 7 -# * - -when defined(XK_GREEK) or true: - const - XKc_Greek_ALPHAaccent*: TKeySym = 0x000007A1 - XKc_Greek_EPSILONaccent*: TKeySym = 0x000007A2 - XKc_Greek_ETAaccent*: TKeySym = 0x000007A3 - XKc_Greek_IOTAaccent*: TKeySym = 0x000007A4 - XKc_Greek_IOTAdieresis*: TKeySym = 0x000007A5 - XKc_Greek_IOTAdiaeresis*: TKeySym = XKc_Greek_IOTAdieresis # old typo - XKc_Greek_OMICRONaccent*: TKeySym = 0x000007A7 - XKc_Greek_UPSILONaccent*: TKeySym = 0x000007A8 - XKc_Greek_UPSILONdieresis*: TKeySym = 0x000007A9 - XKc_Greek_OMEGAaccent*: TKeySym = 0x000007AB - XK_Greek_accentdieresis*: TKeySym = 0x000007AE - XK_Greek_horizbar*: TKeySym = 0x000007AF - XK_Greek_alphaaccent*: TKeySym = 0x000007B1 - XK_Greek_epsilonaccent*: TKeySym = 0x000007B2 - XK_Greek_etaaccent*: TKeySym = 0x000007B3 - XK_Greek_iotaaccent*: TKeySym = 0x000007B4 - XK_Greek_iotadieresis*: TKeySym = 0x000007B5 - XK_Greek_iotaaccentdieresis*: TKeySym = 0x000007B6 - XK_Greek_omicronaccent*: TKeySym = 0x000007B7 - XK_Greek_upsilonaccent*: TKeySym = 0x000007B8 - XK_Greek_upsilondieresis*: TKeySym = 0x000007B9 - XK_Greek_upsilonaccentdieresis*: TKeySym = 0x000007BA - XK_Greek_omegaaccent*: TKeySym = 0x000007BB - XKc_Greek_ALPHA*: TKeySym = 0x000007C1 - XKc_Greek_BETA*: TKeySym = 0x000007C2 - XKc_Greek_GAMMA*: TKeySym = 0x000007C3 - XKc_Greek_DELTA*: TKeySym = 0x000007C4 - XKc_Greek_EPSILON*: TKeySym = 0x000007C5 - XKc_Greek_ZETA*: TKeySym = 0x000007C6 - XKc_Greek_ETA*: TKeySym = 0x000007C7 - XKc_Greek_THETA*: TKeySym = 0x000007C8 - XKc_Greek_IOTA*: TKeySym = 0x000007C9 - XKc_Greek_KAPPA*: TKeySym = 0x000007CA - XKc_Greek_LAMDA*: TKeySym = 0x000007CB - XKc_Greek_LAMBDA*: TKeySym = 0x000007CB - XKc_Greek_MU*: TKeySym = 0x000007CC - XKc_Greek_NU*: TKeySym = 0x000007CD - XKc_Greek_XI*: TKeySym = 0x000007CE - XKc_Greek_OMICRON*: TKeySym = 0x000007CF - XKc_Greek_PI*: TKeySym = 0x000007D0 - XKc_Greek_RHO*: TKeySym = 0x000007D1 - XKc_Greek_SIGMA*: TKeySym = 0x000007D2 - XKc_Greek_TAU*: TKeySym = 0x000007D4 - XKc_Greek_UPSILON*: TKeySym = 0x000007D5 - XKc_Greek_PHI*: TKeySym = 0x000007D6 - XKc_Greek_CHI*: TKeySym = 0x000007D7 - XKc_Greek_PSI*: TKeySym = 0x000007D8 - XKc_Greek_OMEGA*: TKeySym = 0x000007D9 - XK_Greek_alpha*: TKeySym = 0x000007E1 - XK_Greek_beta*: TKeySym = 0x000007E2 - XK_Greek_gamma*: TKeySym = 0x000007E3 - XK_Greek_delta*: TKeySym = 0x000007E4 - XK_Greek_epsilon*: TKeySym = 0x000007E5 - XK_Greek_zeta*: TKeySym = 0x000007E6 - XK_Greek_eta*: TKeySym = 0x000007E7 - XK_Greek_theta*: TKeySym = 0x000007E8 - XK_Greek_iota*: TKeySym = 0x000007E9 - XK_Greek_kappa*: TKeySym = 0x000007EA - XK_Greek_lamda*: TKeySym = 0x000007EB - XK_Greek_lambda*: TKeySym = 0x000007EB - XK_Greek_mu*: TKeySym = 0x000007EC - XK_Greek_nu*: TKeySym = 0x000007ED - XK_Greek_xi*: TKeySym = 0x000007EE - XK_Greek_omicron*: TKeySym = 0x000007EF - XK_Greek_pi*: TKeySym = 0x000007F0 - XK_Greek_rho*: TKeySym = 0x000007F1 - XK_Greek_sigma*: TKeySym = 0x000007F2 - XK_Greek_finalsmallsigma*: TKeySym = 0x000007F3 - XK_Greek_tau*: TKeySym = 0x000007F4 - XK_Greek_upsilon*: TKeySym = 0x000007F5 - XK_Greek_phi*: TKeySym = 0x000007F6 - XK_Greek_chi*: TKeySym = 0x000007F7 - XK_Greek_psi*: TKeySym = 0x000007F8 - XK_Greek_omega*: TKeySym = 0x000007F9 - XK_Greek_switch*: TKeySym = 0x0000FF7E # Alias for mode_switch -# XK_GREEK -#* -# * Technical -# * Byte 3 = 8 -# * - -when defined(XK_TECHNICAL) or true: - const - XK_leftradical*: TKeySym = 0x000008A1 - XK_topleftradical*: TKeySym = 0x000008A2 - XK_horizconnector*: TKeySym = 0x000008A3 - XK_topintegral*: TKeySym = 0x000008A4 - XK_botintegral*: TKeySym = 0x000008A5 - XK_vertconnector*: TKeySym = 0x000008A6 - XK_topleftsqbracket*: TKeySym = 0x000008A7 - XK_botleftsqbracket*: TKeySym = 0x000008A8 - XK_toprightsqbracket*: TKeySym = 0x000008A9 - XK_botrightsqbracket*: TKeySym = 0x000008AA - XK_topleftparens*: TKeySym = 0x000008AB - XK_botleftparens*: TKeySym = 0x000008AC - XK_toprightparens*: TKeySym = 0x000008AD - XK_botrightparens*: TKeySym = 0x000008AE - XK_leftmiddlecurlybrace*: TKeySym = 0x000008AF - XK_rightmiddlecurlybrace*: TKeySym = 0x000008B0 - XK_topleftsummation*: TKeySym = 0x000008B1 - XK_botleftsummation*: TKeySym = 0x000008B2 - XK_topvertsummationconnector*: TKeySym = 0x000008B3 - XK_botvertsummationconnector*: TKeySym = 0x000008B4 - XK_toprightsummation*: TKeySym = 0x000008B5 - XK_botrightsummation*: TKeySym = 0x000008B6 - XK_rightmiddlesummation*: TKeySym = 0x000008B7 - XK_lessthanequal*: TKeySym = 0x000008BC - XK_notequal*: TKeySym = 0x000008BD - XK_greaterthanequal*: TKeySym = 0x000008BE - XK_integral*: TKeySym = 0x000008BF - XK_therefore*: TKeySym = 0x000008C0 - XK_variation*: TKeySym = 0x000008C1 - XK_infinity*: TKeySym = 0x000008C2 - XK_nabla*: TKeySym = 0x000008C5 - XK_approximate*: TKeySym = 0x000008C8 - XK_similarequal*: TKeySym = 0x000008C9 - XK_ifonlyif*: TKeySym = 0x000008CD - XK_implies*: TKeySym = 0x000008CE - XK_identical*: TKeySym = 0x000008CF - XK_radical*: TKeySym = 0x000008D6 - XK_includedin*: TKeySym = 0x000008DA - XK_includes*: TKeySym = 0x000008DB - XK_intersection*: TKeySym = 0x000008DC - XK_union*: TKeySym = 0x000008DD - XK_logicaland*: TKeySym = 0x000008DE - XK_logicalor*: TKeySym = 0x000008DF - XK_partialderivative*: TKeySym = 0x000008EF - XK_function*: TKeySym = 0x000008F6 - XK_leftarrow*: TKeySym = 0x000008FB - XK_uparrow*: TKeySym = 0x000008FC - XK_rightarrow*: TKeySym = 0x000008FD - XK_downarrow*: TKeySym = 0x000008FE -# XK_TECHNICAL -#* -# * Special -# * Byte 3 = 9 -# * - -when defined(XK_SPECIAL): - const - XK_blank*: TKeySym = 0x000009DF - XK_soliddiamond*: TKeySym = 0x000009E0 - XK_checkerboard*: TKeySym = 0x000009E1 - XK_ht*: TKeySym = 0x000009E2 - XK_ff*: TKeySym = 0x000009E3 - XK_cr*: TKeySym = 0x000009E4 - XK_lf*: TKeySym = 0x000009E5 - XK_nl*: TKeySym = 0x000009E8 - XK_vt*: TKeySym = 0x000009E9 - XK_lowrightcorner*: TKeySym = 0x000009EA - XK_uprightcorner*: TKeySym = 0x000009EB - XK_upleftcorner*: TKeySym = 0x000009EC - XK_lowleftcorner*: TKeySym = 0x000009ED - XK_crossinglines*: TKeySym = 0x000009EE - XK_horizlinescan1*: TKeySym = 0x000009EF - XK_horizlinescan3*: TKeySym = 0x000009F0 - XK_horizlinescan5*: TKeySym = 0x000009F1 - XK_horizlinescan7*: TKeySym = 0x000009F2 - XK_horizlinescan9*: TKeySym = 0x000009F3 - XK_leftt*: TKeySym = 0x000009F4 - XK_rightt*: TKeySym = 0x000009F5 - XK_bott*: TKeySym = 0x000009F6 - XK_topt*: TKeySym = 0x000009F7 - XK_vertbar*: TKeySym = 0x000009F8 -# XK_SPECIAL -#* -# * Publishing -# * Byte 3 = a -# * - -when defined(XK_PUBLISHING) or true: - const - XK_emspace*: TKeySym = 0x00000AA1 - XK_enspace*: TKeySym = 0x00000AA2 - XK_em3space*: TKeySym = 0x00000AA3 - XK_em4space*: TKeySym = 0x00000AA4 - XK_digitspace*: TKeySym = 0x00000AA5 - XK_punctspace*: TKeySym = 0x00000AA6 - XK_thinspace*: TKeySym = 0x00000AA7 - XK_hairspace*: TKeySym = 0x00000AA8 - XK_emdash*: TKeySym = 0x00000AA9 - XK_endash*: TKeySym = 0x00000AAA - XK_signifblank*: TKeySym = 0x00000AAC - XK_ellipsis*: TKeySym = 0x00000AAE - XK_doubbaselinedot*: TKeySym = 0x00000AAF - XK_onethird*: TKeySym = 0x00000AB0 - XK_twothirds*: TKeySym = 0x00000AB1 - XK_onefifth*: TKeySym = 0x00000AB2 - XK_twofifths*: TKeySym = 0x00000AB3 - XK_threefifths*: TKeySym = 0x00000AB4 - XK_fourfifths*: TKeySym = 0x00000AB5 - XK_onesixth*: TKeySym = 0x00000AB6 - XK_fivesixths*: TKeySym = 0x00000AB7 - XK_careof*: TKeySym = 0x00000AB8 - XK_figdash*: TKeySym = 0x00000ABB - XK_leftanglebracket*: TKeySym = 0x00000ABC - XK_decimalpoint*: TKeySym = 0x00000ABD - XK_rightanglebracket*: TKeySym = 0x00000ABE - XK_marker*: TKeySym = 0x00000ABF - XK_oneeighth*: TKeySym = 0x00000AC3 - XK_threeeighths*: TKeySym = 0x00000AC4 - XK_fiveeighths*: TKeySym = 0x00000AC5 - XK_seveneighths*: TKeySym = 0x00000AC6 - XK_trademark*: TKeySym = 0x00000AC9 - XK_signaturemark*: TKeySym = 0x00000ACA - XK_trademarkincircle*: TKeySym = 0x00000ACB - XK_leftopentriangle*: TKeySym = 0x00000ACC - XK_rightopentriangle*: TKeySym = 0x00000ACD - XK_emopencircle*: TKeySym = 0x00000ACE - XK_emopenrectangle*: TKeySym = 0x00000ACF - XK_leftsinglequotemark*: TKeySym = 0x00000AD0 - XK_rightsinglequotemark*: TKeySym = 0x00000AD1 - XK_leftdoublequotemark*: TKeySym = 0x00000AD2 - XK_rightdoublequotemark*: TKeySym = 0x00000AD3 - XK_prescription*: TKeySym = 0x00000AD4 - XK_minutes*: TKeySym = 0x00000AD6 - XK_seconds*: TKeySym = 0x00000AD7 - XK_latincross*: TKeySym = 0x00000AD9 - XK_hexagram*: TKeySym = 0x00000ADA - XK_filledrectbullet*: TKeySym = 0x00000ADB - XK_filledlefttribullet*: TKeySym = 0x00000ADC - XK_filledrighttribullet*: TKeySym = 0x00000ADD - XK_emfilledcircle*: TKeySym = 0x00000ADE - XK_emfilledrect*: TKeySym = 0x00000ADF - XK_enopencircbullet*: TKeySym = 0x00000AE0 - XK_enopensquarebullet*: TKeySym = 0x00000AE1 - XK_openrectbullet*: TKeySym = 0x00000AE2 - XK_opentribulletup*: TKeySym = 0x00000AE3 - XK_opentribulletdown*: TKeySym = 0x00000AE4 - XK_openstar*: TKeySym = 0x00000AE5 - XK_enfilledcircbullet*: TKeySym = 0x00000AE6 - XK_enfilledsqbullet*: TKeySym = 0x00000AE7 - XK_filledtribulletup*: TKeySym = 0x00000AE8 - XK_filledtribulletdown*: TKeySym = 0x00000AE9 - XK_leftpointer*: TKeySym = 0x00000AEA - XK_rightpointer*: TKeySym = 0x00000AEB - XK_club*: TKeySym = 0x00000AEC - XK_diamond*: TKeySym = 0x00000AED - XK_heart*: TKeySym = 0x00000AEE - XK_maltesecross*: TKeySym = 0x00000AF0 - XK_dagger*: TKeySym = 0x00000AF1 - XK_doubledagger*: TKeySym = 0x00000AF2 - XK_checkmark*: TKeySym = 0x00000AF3 - XK_ballotcross*: TKeySym = 0x00000AF4 - XK_musicalsharp*: TKeySym = 0x00000AF5 - XK_musicalflat*: TKeySym = 0x00000AF6 - XK_malesymbol*: TKeySym = 0x00000AF7 - XK_femalesymbol*: TKeySym = 0x00000AF8 - XK_telephone*: TKeySym = 0x00000AF9 - XK_telephonerecorder*: TKeySym = 0x00000AFA - XK_phonographcopyright*: TKeySym = 0x00000AFB - XK_caret*: TKeySym = 0x00000AFC - XK_singlelowquotemark*: TKeySym = 0x00000AFD - XK_doublelowquotemark*: TKeySym = 0x00000AFE - XK_cursor*: TKeySym = 0x00000AFF -# XK_PUBLISHING -#* -# * APL -# * Byte 3 = b -# * - -when defined(XK_APL) or true: - const - XK_leftcaret*: TKeySym = 0x00000BA3 - XK_rightcaret*: TKeySym = 0x00000BA6 - XK_downcaret*: TKeySym = 0x00000BA8 - XK_upcaret*: TKeySym = 0x00000BA9 - XK_overbar*: TKeySym = 0x00000BC0 - XK_downtack*: TKeySym = 0x00000BC2 - XK_upshoe*: TKeySym = 0x00000BC3 - XK_downstile*: TKeySym = 0x00000BC4 - XK_underbar*: TKeySym = 0x00000BC6 - XK_jot*: TKeySym = 0x00000BCA - XK_quad*: TKeySym = 0x00000BCC - XK_uptack*: TKeySym = 0x00000BCE - XK_circle*: TKeySym = 0x00000BCF - XK_upstile*: TKeySym = 0x00000BD3 - XK_downshoe*: TKeySym = 0x00000BD6 - XK_rightshoe*: TKeySym = 0x00000BD8 - XK_leftshoe*: TKeySym = 0x00000BDA - XK_lefttack*: TKeySym = 0x00000BDC - XK_righttack*: TKeySym = 0x00000BFC -# XK_APL -#* -# * Hebrew -# * Byte 3 = c -# * - -when defined(XK_HEBREW) or true: - const - XK_hebrew_doublelowline*: TKeySym = 0x00000CDF - XK_hebrew_aleph*: TKeySym = 0x00000CE0 - XK_hebrew_bet*: TKeySym = 0x00000CE1 - XK_hebrew_beth*: TKeySym = 0x00000CE1 # deprecated - XK_hebrew_gimel*: TKeySym = 0x00000CE2 - XK_hebrew_gimmel*: TKeySym = 0x00000CE2 # deprecated - XK_hebrew_dalet*: TKeySym = 0x00000CE3 - XK_hebrew_daleth*: TKeySym = 0x00000CE3 # deprecated - XK_hebrew_he*: TKeySym = 0x00000CE4 - XK_hebrew_waw*: TKeySym = 0x00000CE5 - XK_hebrew_zain*: TKeySym = 0x00000CE6 - XK_hebrew_zayin*: TKeySym = 0x00000CE6 # deprecated - XK_hebrew_chet*: TKeySym = 0x00000CE7 - XK_hebrew_het*: TKeySym = 0x00000CE7 # deprecated - XK_hebrew_tet*: TKeySym = 0x00000CE8 - XK_hebrew_teth*: TKeySym = 0x00000CE8 # deprecated - XK_hebrew_yod*: TKeySym = 0x00000CE9 - XK_hebrew_finalkaph*: TKeySym = 0x00000CEA - XK_hebrew_kaph*: TKeySym = 0x00000CEB - XK_hebrew_lamed*: TKeySym = 0x00000CEC - XK_hebrew_finalmem*: TKeySym = 0x00000CED - XK_hebrew_mem*: TKeySym = 0x00000CEE - XK_hebrew_finalnun*: TKeySym = 0x00000CEF - XK_hebrew_nun*: TKeySym = 0x00000CF0 - XK_hebrew_samech*: TKeySym = 0x00000CF1 - XK_hebrew_samekh*: TKeySym = 0x00000CF1 # deprecated - XK_hebrew_ayin*: TKeySym = 0x00000CF2 - XK_hebrew_finalpe*: TKeySym = 0x00000CF3 - XK_hebrew_pe*: TKeySym = 0x00000CF4 - XK_hebrew_finalzade*: TKeySym = 0x00000CF5 - XK_hebrew_finalzadi*: TKeySym = 0x00000CF5 # deprecated - XK_hebrew_zade*: TKeySym = 0x00000CF6 - XK_hebrew_zadi*: TKeySym = 0x00000CF6 # deprecated - XK_hebrew_qoph*: TKeySym = 0x00000CF7 - XK_hebrew_kuf*: TKeySym = 0x00000CF7 # deprecated - XK_hebrew_resh*: TKeySym = 0x00000CF8 - XK_hebrew_shin*: TKeySym = 0x00000CF9 - XK_hebrew_taw*: TKeySym = 0x00000CFA - XK_hebrew_taf*: TKeySym = 0x00000CFA # deprecated - XK_Hebrew_switch*: TKeySym = 0x0000FF7E # Alias for mode_switch -# XK_HEBREW -#* -# * Thai -# * Byte 3 = d -# * - -when defined(XK_THAI) or true: - const - XK_Thai_kokai*: TKeySym = 0x00000DA1 - XK_Thai_khokhai*: TKeySym = 0x00000DA2 - XK_Thai_khokhuat*: TKeySym = 0x00000DA3 - XK_Thai_khokhwai*: TKeySym = 0x00000DA4 - XK_Thai_khokhon*: TKeySym = 0x00000DA5 - XK_Thai_khorakhang*: TKeySym = 0x00000DA6 - XK_Thai_ngongu*: TKeySym = 0x00000DA7 - XK_Thai_chochan*: TKeySym = 0x00000DA8 - XK_Thai_choching*: TKeySym = 0x00000DA9 - XK_Thai_chochang*: TKeySym = 0x00000DAA - XK_Thai_soso*: TKeySym = 0x00000DAB - XK_Thai_chochoe*: TKeySym = 0x00000DAC - XK_Thai_yoying*: TKeySym = 0x00000DAD - XK_Thai_dochada*: TKeySym = 0x00000DAE - XK_Thai_topatak*: TKeySym = 0x00000DAF - XK_Thai_thothan*: TKeySym = 0x00000DB0 - XK_Thai_thonangmontho*: TKeySym = 0x00000DB1 - XK_Thai_thophuthao*: TKeySym = 0x00000DB2 - XK_Thai_nonen*: TKeySym = 0x00000DB3 - XK_Thai_dodek*: TKeySym = 0x00000DB4 - XK_Thai_totao*: TKeySym = 0x00000DB5 - XK_Thai_thothung*: TKeySym = 0x00000DB6 - XK_Thai_thothahan*: TKeySym = 0x00000DB7 - XK_Thai_thothong*: TKeySym = 0x00000DB8 - XK_Thai_nonu*: TKeySym = 0x00000DB9 - XK_Thai_bobaimai*: TKeySym = 0x00000DBA - XK_Thai_popla*: TKeySym = 0x00000DBB - XK_Thai_phophung*: TKeySym = 0x00000DBC - XK_Thai_fofa*: TKeySym = 0x00000DBD - XK_Thai_phophan*: TKeySym = 0x00000DBE - XK_Thai_fofan*: TKeySym = 0x00000DBF - XK_Thai_phosamphao*: TKeySym = 0x00000DC0 - XK_Thai_moma*: TKeySym = 0x00000DC1 - XK_Thai_yoyak*: TKeySym = 0x00000DC2 - XK_Thai_rorua*: TKeySym = 0x00000DC3 - XK_Thai_ru*: TKeySym = 0x00000DC4 - XK_Thai_loling*: TKeySym = 0x00000DC5 - XK_Thai_lu*: TKeySym = 0x00000DC6 - XK_Thai_wowaen*: TKeySym = 0x00000DC7 - XK_Thai_sosala*: TKeySym = 0x00000DC8 - XK_Thai_sorusi*: TKeySym = 0x00000DC9 - XK_Thai_sosua*: TKeySym = 0x00000DCA - XK_Thai_hohip*: TKeySym = 0x00000DCB - XK_Thai_lochula*: TKeySym = 0x00000DCC - XK_Thai_oang*: TKeySym = 0x00000DCD - XK_Thai_honokhuk*: TKeySym = 0x00000DCE - XK_Thai_paiyannoi*: TKeySym = 0x00000DCF - XK_Thai_saraa*: TKeySym = 0x00000DD0 - XK_Thai_maihanakat*: TKeySym = 0x00000DD1 - XK_Thai_saraaa*: TKeySym = 0x00000DD2 - XK_Thai_saraam*: TKeySym = 0x00000DD3 - XK_Thai_sarai*: TKeySym = 0x00000DD4 - XK_Thai_saraii*: TKeySym = 0x00000DD5 - XK_Thai_saraue*: TKeySym = 0x00000DD6 - XK_Thai_sarauee*: TKeySym = 0x00000DD7 - XK_Thai_sarau*: TKeySym = 0x00000DD8 - XK_Thai_sarauu*: TKeySym = 0x00000DD9 - XK_Thai_phinthu*: TKeySym = 0x00000DDA - XK_Thai_maihanakat_maitho*: TKeySym = 0x00000DDE - XK_Thai_baht*: TKeySym = 0x00000DDF - XK_Thai_sarae*: TKeySym = 0x00000DE0 - XK_Thai_saraae*: TKeySym = 0x00000DE1 - XK_Thai_sarao*: TKeySym = 0x00000DE2 - XK_Thai_saraaimaimuan*: TKeySym = 0x00000DE3 - XK_Thai_saraaimaimalai*: TKeySym = 0x00000DE4 - XK_Thai_lakkhangyao*: TKeySym = 0x00000DE5 - XK_Thai_maiyamok*: TKeySym = 0x00000DE6 - XK_Thai_maitaikhu*: TKeySym = 0x00000DE7 - XK_Thai_maiek*: TKeySym = 0x00000DE8 - XK_Thai_maitho*: TKeySym = 0x00000DE9 - XK_Thai_maitri*: TKeySym = 0x00000DEA - XK_Thai_maichattawa*: TKeySym = 0x00000DEB - XK_Thai_thanthakhat*: TKeySym = 0x00000DEC - XK_Thai_nikhahit*: TKeySym = 0x00000DED - XK_Thai_leksun*: TKeySym = 0x00000DF0 - XK_Thai_leknung*: TKeySym = 0x00000DF1 - XK_Thai_leksong*: TKeySym = 0x00000DF2 - XK_Thai_leksam*: TKeySym = 0x00000DF3 - XK_Thai_leksi*: TKeySym = 0x00000DF4 - XK_Thai_lekha*: TKeySym = 0x00000DF5 - XK_Thai_lekhok*: TKeySym = 0x00000DF6 - XK_Thai_lekchet*: TKeySym = 0x00000DF7 - XK_Thai_lekpaet*: TKeySym = 0x00000DF8 - XK_Thai_lekkao*: TKeySym = 0x00000DF9 -# XK_THAI -#* -# * Korean -# * Byte 3 = e -# * - -when defined(XK_KOREAN) or true: - const - XK_Hangul*: TKeySym = 0x0000FF31 # Hangul start/stop(toggle) - XK_Hangul_Start*: TKeySym = 0x0000FF32 # Hangul start - XK_Hangul_End*: TKeySym = 0x0000FF33 # Hangul end, English start - XK_Hangul_Hanja*: TKeySym = 0x0000FF34 # Start Hangul->Hanja Conversion - XK_Hangul_Jamo*: TKeySym = 0x0000FF35 # Hangul Jamo mode - XK_Hangul_Romaja*: TKeySym = 0x0000FF36 # Hangul Romaja mode - XK_Hangul_Codeinput*: TKeySym = 0x0000FF37 # Hangul code input mode - XK_Hangul_Jeonja*: TKeySym = 0x0000FF38 # Jeonja mode - XK_Hangul_Banja*: TKeySym = 0x0000FF39 # Banja mode - XK_Hangul_PreHanja*: TKeySym = 0x0000FF3A # Pre Hanja conversion - XK_Hangul_PostHanja*: TKeySym = 0x0000FF3B # Post Hanja conversion - XK_Hangul_SingleCandidate*: TKeySym = 0x0000FF3C # Single candidate - XK_Hangul_MultipleCandidate*: TKeySym = 0x0000FF3D # Multiple candidate - XK_Hangul_PreviousCandidate*: TKeySym = 0x0000FF3E # Previous candidate - XK_Hangul_Special*: TKeySym = 0x0000FF3F # Special symbols - XK_Hangul_switch*: TKeySym = 0x0000FF7E # Alias for mode_switch \ - # Hangul Consonant Characters - XK_Hangul_Kiyeog*: TKeySym = 0x00000EA1 - XK_Hangul_SsangKiyeog*: TKeySym = 0x00000EA2 - XK_Hangul_KiyeogSios*: TKeySym = 0x00000EA3 - XK_Hangul_Nieun*: TKeySym = 0x00000EA4 - XK_Hangul_NieunJieuj*: TKeySym = 0x00000EA5 - XK_Hangul_NieunHieuh*: TKeySym = 0x00000EA6 - XK_Hangul_Dikeud*: TKeySym = 0x00000EA7 - XK_Hangul_SsangDikeud*: TKeySym = 0x00000EA8 - XK_Hangul_Rieul*: TKeySym = 0x00000EA9 - XK_Hangul_RieulKiyeog*: TKeySym = 0x00000EAA - XK_Hangul_RieulMieum*: TKeySym = 0x00000EAB - XK_Hangul_RieulPieub*: TKeySym = 0x00000EAC - XK_Hangul_RieulSios*: TKeySym = 0x00000EAD - XK_Hangul_RieulTieut*: TKeySym = 0x00000EAE - XK_Hangul_RieulPhieuf*: TKeySym = 0x00000EAF - XK_Hangul_RieulHieuh*: TKeySym = 0x00000EB0 - XK_Hangul_Mieum*: TKeySym = 0x00000EB1 - XK_Hangul_Pieub*: TKeySym = 0x00000EB2 - XK_Hangul_SsangPieub*: TKeySym = 0x00000EB3 - XK_Hangul_PieubSios*: TKeySym = 0x00000EB4 - XK_Hangul_Sios*: TKeySym = 0x00000EB5 - XK_Hangul_SsangSios*: TKeySym = 0x00000EB6 - XK_Hangul_Ieung*: TKeySym = 0x00000EB7 - XK_Hangul_Jieuj*: TKeySym = 0x00000EB8 - XK_Hangul_SsangJieuj*: TKeySym = 0x00000EB9 - XK_Hangul_Cieuc*: TKeySym = 0x00000EBA - XK_Hangul_Khieuq*: TKeySym = 0x00000EBB - XK_Hangul_Tieut*: TKeySym = 0x00000EBC - XK_Hangul_Phieuf*: TKeySym = 0x00000EBD - XK_Hangul_Hieuh*: TKeySym = 0x00000EBE # Hangul Vowel Characters - XK_Hangul_A*: TKeySym = 0x00000EBF - XK_Hangul_AE*: TKeySym = 0x00000EC0 - XK_Hangul_YA*: TKeySym = 0x00000EC1 - XK_Hangul_YAE*: TKeySym = 0x00000EC2 - XK_Hangul_EO*: TKeySym = 0x00000EC3 - XK_Hangul_E*: TKeySym = 0x00000EC4 - XK_Hangul_YEO*: TKeySym = 0x00000EC5 - XK_Hangul_YE*: TKeySym = 0x00000EC6 - XK_Hangul_O*: TKeySym = 0x00000EC7 - XK_Hangul_WA*: TKeySym = 0x00000EC8 - XK_Hangul_WAE*: TKeySym = 0x00000EC9 - XK_Hangul_OE*: TKeySym = 0x00000ECA - XK_Hangul_YO*: TKeySym = 0x00000ECB - XK_Hangul_U*: TKeySym = 0x00000ECC - XK_Hangul_WEO*: TKeySym = 0x00000ECD - XK_Hangul_WE*: TKeySym = 0x00000ECE - XK_Hangul_WI*: TKeySym = 0x00000ECF - XK_Hangul_YU*: TKeySym = 0x00000ED0 - XK_Hangul_EU*: TKeySym = 0x00000ED1 - XK_Hangul_YI*: TKeySym = 0x00000ED2 - XK_Hangul_I*: TKeySym = 0x00000ED3 # Hangul syllable-final (JongSeong) Characters - XK_Hangul_J_Kiyeog*: TKeySym = 0x00000ED4 - XK_Hangul_J_SsangKiyeog*: TKeySym = 0x00000ED5 - XK_Hangul_J_KiyeogSios*: TKeySym = 0x00000ED6 - XK_Hangul_J_Nieun*: TKeySym = 0x00000ED7 - XK_Hangul_J_NieunJieuj*: TKeySym = 0x00000ED8 - XK_Hangul_J_NieunHieuh*: TKeySym = 0x00000ED9 - XK_Hangul_J_Dikeud*: TKeySym = 0x00000EDA - XK_Hangul_J_Rieul*: TKeySym = 0x00000EDB - XK_Hangul_J_RieulKiyeog*: TKeySym = 0x00000EDC - XK_Hangul_J_RieulMieum*: TKeySym = 0x00000EDD - XK_Hangul_J_RieulPieub*: TKeySym = 0x00000EDE - XK_Hangul_J_RieulSios*: TKeySym = 0x00000EDF - XK_Hangul_J_RieulTieut*: TKeySym = 0x00000EE0 - XK_Hangul_J_RieulPhieuf*: TKeySym = 0x00000EE1 - XK_Hangul_J_RieulHieuh*: TKeySym = 0x00000EE2 - XK_Hangul_J_Mieum*: TKeySym = 0x00000EE3 - XK_Hangul_J_Pieub*: TKeySym = 0x00000EE4 - XK_Hangul_J_PieubSios*: TKeySym = 0x00000EE5 - XK_Hangul_J_Sios*: TKeySym = 0x00000EE6 - XK_Hangul_J_SsangSios*: TKeySym = 0x00000EE7 - XK_Hangul_J_Ieung*: TKeySym = 0x00000EE8 - XK_Hangul_J_Jieuj*: TKeySym = 0x00000EE9 - XK_Hangul_J_Cieuc*: TKeySym = 0x00000EEA - XK_Hangul_J_Khieuq*: TKeySym = 0x00000EEB - XK_Hangul_J_Tieut*: TKeySym = 0x00000EEC - XK_Hangul_J_Phieuf*: TKeySym = 0x00000EED - XK_Hangul_J_Hieuh*: TKeySym = 0x00000EEE # Ancient Hangul Consonant Characters - XK_Hangul_RieulYeorinHieuh*: TKeySym = 0x00000EEF - XK_Hangul_SunkyeongeumMieum*: TKeySym = 0x00000EF0 - XK_Hangul_SunkyeongeumPieub*: TKeySym = 0x00000EF1 - XK_Hangul_PanSios*: TKeySym = 0x00000EF2 - XK_Hangul_KkogjiDalrinIeung*: TKeySym = 0x00000EF3 - XK_Hangul_SunkyeongeumPhieuf*: TKeySym = 0x00000EF4 - XK_Hangul_YeorinHieuh*: TKeySym = 0x00000EF5 # Ancient Hangul Vowel Characters - XK_Hangul_AraeA*: TKeySym = 0x00000EF6 - XK_Hangul_AraeAE*: TKeySym = 0x00000EF7 # Ancient Hangul syllable-final (JongSeong) Characters - XK_Hangul_J_PanSios*: TKeySym = 0x00000EF8 - XK_Hangul_J_KkogjiDalrinIeung*: TKeySym = 0x00000EF9 - XK_Hangul_J_YeorinHieuh*: TKeySym = 0x00000EFA # Korean currency symbol - XK_Korean_Won*: TKeySym = 0x00000EFF -# XK_KOREAN -#* -# * Armenian -# * Byte 3 = = $14 -# * - -when defined(XK_ARMENIAN) or true: - const - XK_Armenian_eternity*: TKeySym = 0x000014A1 - XK_Armenian_ligature_ew*: TKeySym = 0x000014A2 - XK_Armenian_full_stop*: TKeySym = 0x000014A3 - XK_Armenian_verjaket*: TKeySym = 0x000014A3 - XK_Armenian_parenright*: TKeySym = 0x000014A4 - XK_Armenian_parenleft*: TKeySym = 0x000014A5 - XK_Armenian_guillemotright*: TKeySym = 0x000014A6 - XK_Armenian_guillemotleft*: TKeySym = 0x000014A7 - XK_Armenian_em_dash*: TKeySym = 0x000014A8 - XK_Armenian_dot*: TKeySym = 0x000014A9 - XK_Armenian_mijaket*: TKeySym = 0x000014A9 - XK_Armenian_separation_mark*: TKeySym = 0x000014AA - XK_Armenian_but*: TKeySym = 0x000014AA - XK_Armenian_comma*: TKeySym = 0x000014AB - XK_Armenian_en_dash*: TKeySym = 0x000014AC - XK_Armenian_hyphen*: TKeySym = 0x000014AD - XK_Armenian_yentamna*: TKeySym = 0x000014AD - XK_Armenian_ellipsis*: TKeySym = 0x000014AE - XK_Armenian_exclam*: TKeySym = 0x000014AF - XK_Armenian_amanak*: TKeySym = 0x000014AF - XK_Armenian_accent*: TKeySym = 0x000014B0 - XK_Armenian_shesht*: TKeySym = 0x000014B0 - XK_Armenian_question*: TKeySym = 0x000014B1 - XK_Armenian_paruyk*: TKeySym = 0x000014B1 - XKc_Armenian_AYB*: TKeySym = 0x000014B2 - XK_Armenian_ayb*: TKeySym = 0x000014B3 - XKc_Armenian_BEN*: TKeySym = 0x000014B4 - XK_Armenian_ben*: TKeySym = 0x000014B5 - XKc_Armenian_GIM*: TKeySym = 0x000014B6 - XK_Armenian_gim*: TKeySym = 0x000014B7 - XKc_Armenian_DA*: TKeySym = 0x000014B8 - XK_Armenian_da*: TKeySym = 0x000014B9 - XKc_Armenian_YECH*: TKeySym = 0x000014BA - XK_Armenian_yech*: TKeySym = 0x000014BB - XKc_Armenian_ZA*: TKeySym = 0x000014BC - XK_Armenian_za*: TKeySym = 0x000014BD - XKc_Armenian_E*: TKeySym = 0x000014BE - XK_Armenian_e*: TKeySym = 0x000014BF - XKc_Armenian_AT*: TKeySym = 0x000014C0 - XK_Armenian_at*: TKeySym = 0x000014C1 - XKc_Armenian_TO*: TKeySym = 0x000014C2 - XK_Armenian_to*: TKeySym = 0x000014C3 - XKc_Armenian_ZHE*: TKeySym = 0x000014C4 - XK_Armenian_zhe*: TKeySym = 0x000014C5 - XKc_Armenian_INI*: TKeySym = 0x000014C6 - XK_Armenian_ini*: TKeySym = 0x000014C7 - XKc_Armenian_LYUN*: TKeySym = 0x000014C8 - XK_Armenian_lyun*: TKeySym = 0x000014C9 - XKc_Armenian_KHE*: TKeySym = 0x000014CA - XK_Armenian_khe*: TKeySym = 0x000014CB - XKc_Armenian_TSA*: TKeySym = 0x000014CC - XK_Armenian_tsa*: TKeySym = 0x000014CD - XKc_Armenian_KEN*: TKeySym = 0x000014CE - XK_Armenian_ken*: TKeySym = 0x000014CF - XKc_Armenian_HO*: TKeySym = 0x000014D0 - XK_Armenian_ho*: TKeySym = 0x000014D1 - XKc_Armenian_DZA*: TKeySym = 0x000014D2 - XK_Armenian_dza*: TKeySym = 0x000014D3 - XKc_Armenian_GHAT*: TKeySym = 0x000014D4 - XK_Armenian_ghat*: TKeySym = 0x000014D5 - XKc_Armenian_TCHE*: TKeySym = 0x000014D6 - XK_Armenian_tche*: TKeySym = 0x000014D7 - XKc_Armenian_MEN*: TKeySym = 0x000014D8 - XK_Armenian_men*: TKeySym = 0x000014D9 - XKc_Armenian_HI*: TKeySym = 0x000014DA - XK_Armenian_hi*: TKeySym = 0x000014DB - XKc_Armenian_NU*: TKeySym = 0x000014DC - XK_Armenian_nu*: TKeySym = 0x000014DD - XKc_Armenian_SHA*: TKeySym = 0x000014DE - XK_Armenian_sha*: TKeySym = 0x000014DF - XKc_Armenian_VO*: TKeySym = 0x000014E0 - XK_Armenian_vo*: TKeySym = 0x000014E1 - XKc_Armenian_CHA*: TKeySym = 0x000014E2 - XK_Armenian_cha*: TKeySym = 0x000014E3 - XKc_Armenian_PE*: TKeySym = 0x000014E4 - XK_Armenian_pe*: TKeySym = 0x000014E5 - XKc_Armenian_JE*: TKeySym = 0x000014E6 - XK_Armenian_je*: TKeySym = 0x000014E7 - XKc_Armenian_RA*: TKeySym = 0x000014E8 - XK_Armenian_ra*: TKeySym = 0x000014E9 - XKc_Armenian_SE*: TKeySym = 0x000014EA - XK_Armenian_se*: TKeySym = 0x000014EB - XKc_Armenian_VEV*: TKeySym = 0x000014EC - XK_Armenian_vev*: TKeySym = 0x000014ED - XKc_Armenian_TYUN*: TKeySym = 0x000014EE - XK_Armenian_tyun*: TKeySym = 0x000014EF - XKc_Armenian_RE*: TKeySym = 0x000014F0 - XK_Armenian_re*: TKeySym = 0x000014F1 - XKc_Armenian_TSO*: TKeySym = 0x000014F2 - XK_Armenian_tso*: TKeySym = 0x000014F3 - XKc_Armenian_VYUN*: TKeySym = 0x000014F4 - XK_Armenian_vyun*: TKeySym = 0x000014F5 - XKc_Armenian_PYUR*: TKeySym = 0x000014F6 - XK_Armenian_pyur*: TKeySym = 0x000014F7 - XKc_Armenian_KE*: TKeySym = 0x000014F8 - XK_Armenian_ke*: TKeySym = 0x000014F9 - XKc_Armenian_O*: TKeySym = 0x000014FA - XK_Armenian_o*: TKeySym = 0x000014FB - XKc_Armenian_FE*: TKeySym = 0x000014FC - XK_Armenian_fe*: TKeySym = 0x000014FD - XK_Armenian_apostrophe*: TKeySym = 0x000014FE - XK_Armenian_section_sign*: TKeySym = 0x000014FF -# XK_ARMENIAN -#* -# * Georgian -# * Byte 3 = = $15 -# * - -when defined(XK_GEORGIAN) or true: - const - XK_Georgian_an*: TKeySym = 0x000015D0 - XK_Georgian_ban*: TKeySym = 0x000015D1 - XK_Georgian_gan*: TKeySym = 0x000015D2 - XK_Georgian_don*: TKeySym = 0x000015D3 - XK_Georgian_en*: TKeySym = 0x000015D4 - XK_Georgian_vin*: TKeySym = 0x000015D5 - XK_Georgian_zen*: TKeySym = 0x000015D6 - XK_Georgian_tan*: TKeySym = 0x000015D7 - XK_Georgian_in*: TKeySym = 0x000015D8 - XK_Georgian_kan*: TKeySym = 0x000015D9 - XK_Georgian_las*: TKeySym = 0x000015DA - XK_Georgian_man*: TKeySym = 0x000015DB - XK_Georgian_nar*: TKeySym = 0x000015DC - XK_Georgian_on*: TKeySym = 0x000015DD - XK_Georgian_par*: TKeySym = 0x000015DE - XK_Georgian_zhar*: TKeySym = 0x000015DF - XK_Georgian_rae*: TKeySym = 0x000015E0 - XK_Georgian_san*: TKeySym = 0x000015E1 - XK_Georgian_tar*: TKeySym = 0x000015E2 - XK_Georgian_un*: TKeySym = 0x000015E3 - XK_Georgian_phar*: TKeySym = 0x000015E4 - XK_Georgian_khar*: TKeySym = 0x000015E5 - XK_Georgian_ghan*: TKeySym = 0x000015E6 - XK_Georgian_qar*: TKeySym = 0x000015E7 - XK_Georgian_shin*: TKeySym = 0x000015E8 - XK_Georgian_chin*: TKeySym = 0x000015E9 - XK_Georgian_can*: TKeySym = 0x000015EA - XK_Georgian_jil*: TKeySym = 0x000015EB - XK_Georgian_cil*: TKeySym = 0x000015EC - XK_Georgian_char*: TKeySym = 0x000015ED - XK_Georgian_xan*: TKeySym = 0x000015EE - XK_Georgian_jhan*: TKeySym = 0x000015EF - XK_Georgian_hae*: TKeySym = 0x000015F0 - XK_Georgian_he*: TKeySym = 0x000015F1 - XK_Georgian_hie*: TKeySym = 0x000015F2 - XK_Georgian_we*: TKeySym = 0x000015F3 - XK_Georgian_har*: TKeySym = 0x000015F4 - XK_Georgian_hoe*: TKeySym = 0x000015F5 - XK_Georgian_fi*: TKeySym = 0x000015F6 -# XK_GEORGIAN -#* -# * Azeri (and other Turkic or Caucasian languages of ex-USSR) -# * Byte 3 = = $16 -# * - -when defined(XK_CAUCASUS) or true: - # latin - const - XKc_Ccedillaabovedot*: TKeySym = 0x000016A2 - XKc_Xabovedot*: TKeySym = 0x000016A3 - XKc_Qabovedot*: TKeySym = 0x000016A5 - XKc_Ibreve*: TKeySym = 0x000016A6 - XKc_IE*: TKeySym = 0x000016A7 - XKc_UO*: TKeySym = 0x000016A8 - XKc_Zstroke*: TKeySym = 0x000016A9 - XKc_Gcaron*: TKeySym = 0x000016AA - XKc_Obarred*: TKeySym = 0x000016AF - XK_ccedillaabovedot*: TKeySym = 0x000016B2 - XK_xabovedot*: TKeySym = 0x000016B3 - XKc_Ocaron*: TKeySym = 0x000016B4 - XK_qabovedot*: TKeySym = 0x000016B5 - XK_ibreve*: TKeySym = 0x000016B6 - XK_ie*: TKeySym = 0x000016B7 - XK_uo*: TKeySym = 0x000016B8 - XK_zstroke*: TKeySym = 0x000016B9 - XK_gcaron*: TKeySym = 0x000016BA - XK_ocaron*: TKeySym = 0x000016BD - XK_obarred*: TKeySym = 0x000016BF - XKc_SCHWA*: TKeySym = 0x000016C6 - XK_schwa*: TKeySym = 0x000016F6 # those are not really Caucasus, but I put them here for now\ - # For Inupiak - XKc_Lbelowdot*: TKeySym = 0x000016D1 - XKc_Lstrokebelowdot*: TKeySym = 0x000016D2 - XK_lbelowdot*: TKeySym = 0x000016E1 - XK_lstrokebelowdot*: TKeySym = 0x000016E2 # For Guarani - XKc_Gtilde*: TKeySym = 0x000016D3 - XK_gtilde*: TKeySym = 0x000016E3 -# XK_CAUCASUS -#* -# * Vietnamese -# * Byte 3 = = $1e -# * - -when defined(XK_VIETNAMESE) or true: - const - XKc_Abelowdot*: TKeySym = 0x00001EA0 - XK_abelowdot*: TKeySym = 0x00001EA1 - XKc_Ahook*: TKeySym = 0x00001EA2 - XK_ahook*: TKeySym = 0x00001EA3 - XKc_Acircumflexacute*: TKeySym = 0x00001EA4 - XK_acircumflexacute*: TKeySym = 0x00001EA5 - XKc_Acircumflexgrave*: TKeySym = 0x00001EA6 - XK_acircumflexgrave*: TKeySym = 0x00001EA7 - XKc_Acircumflexhook*: TKeySym = 0x00001EA8 - XK_acircumflexhook*: TKeySym = 0x00001EA9 - XKc_Acircumflextilde*: TKeySym = 0x00001EAA - XK_acircumflextilde*: TKeySym = 0x00001EAB - XKc_Acircumflexbelowdot*: TKeySym = 0x00001EAC - XK_acircumflexbelowdot*: TKeySym = 0x00001EAD - XKc_Abreveacute*: TKeySym = 0x00001EAE - XK_abreveacute*: TKeySym = 0x00001EAF - XKc_Abrevegrave*: TKeySym = 0x00001EB0 - XK_abrevegrave*: TKeySym = 0x00001EB1 - XKc_Abrevehook*: TKeySym = 0x00001EB2 - XK_abrevehook*: TKeySym = 0x00001EB3 - XKc_Abrevetilde*: TKeySym = 0x00001EB4 - XK_abrevetilde*: TKeySym = 0x00001EB5 - XKc_Abrevebelowdot*: TKeySym = 0x00001EB6 - XK_abrevebelowdot*: TKeySym = 0x00001EB7 - XKc_Ebelowdot*: TKeySym = 0x00001EB8 - XK_ebelowdot*: TKeySym = 0x00001EB9 - XKc_Ehook*: TKeySym = 0x00001EBA - XK_ehook*: TKeySym = 0x00001EBB - XKc_Etilde*: TKeySym = 0x00001EBC - XK_etilde*: TKeySym = 0x00001EBD - XKc_Ecircumflexacute*: TKeySym = 0x00001EBE - XK_ecircumflexacute*: TKeySym = 0x00001EBF - XKc_Ecircumflexgrave*: TKeySym = 0x00001EC0 - XK_ecircumflexgrave*: TKeySym = 0x00001EC1 - XKc_Ecircumflexhook*: TKeySym = 0x00001EC2 - XK_ecircumflexhook*: TKeySym = 0x00001EC3 - XKc_Ecircumflextilde*: TKeySym = 0x00001EC4 - XK_ecircumflextilde*: TKeySym = 0x00001EC5 - XKc_Ecircumflexbelowdot*: TKeySym = 0x00001EC6 - XK_ecircumflexbelowdot*: TKeySym = 0x00001EC7 - XKc_Ihook*: TKeySym = 0x00001EC8 - XK_ihook*: TKeySym = 0x00001EC9 - XKc_Ibelowdot*: TKeySym = 0x00001ECA - XK_ibelowdot*: TKeySym = 0x00001ECB - XKc_Obelowdot*: TKeySym = 0x00001ECC - XK_obelowdot*: TKeySym = 0x00001ECD - XKc_Ohook*: TKeySym = 0x00001ECE - XK_ohook*: TKeySym = 0x00001ECF - XKc_Ocircumflexacute*: TKeySym = 0x00001ED0 - XK_ocircumflexacute*: TKeySym = 0x00001ED1 - XKc_Ocircumflexgrave*: TKeySym = 0x00001ED2 - XK_ocircumflexgrave*: TKeySym = 0x00001ED3 - XKc_Ocircumflexhook*: TKeySym = 0x00001ED4 - XK_ocircumflexhook*: TKeySym = 0x00001ED5 - XKc_Ocircumflextilde*: TKeySym = 0x00001ED6 - XK_ocircumflextilde*: TKeySym = 0x00001ED7 - XKc_Ocircumflexbelowdot*: TKeySym = 0x00001ED8 - XK_ocircumflexbelowdot*: TKeySym = 0x00001ED9 - XKc_Ohornacute*: TKeySym = 0x00001EDA - XK_ohornacute*: TKeySym = 0x00001EDB - XKc_Ohorngrave*: TKeySym = 0x00001EDC - XK_ohorngrave*: TKeySym = 0x00001EDD - XKc_Ohornhook*: TKeySym = 0x00001EDE - XK_ohornhook*: TKeySym = 0x00001EDF - XKc_Ohorntilde*: TKeySym = 0x00001EE0 - XK_ohorntilde*: TKeySym = 0x00001EE1 - XKc_Ohornbelowdot*: TKeySym = 0x00001EE2 - XK_ohornbelowdot*: TKeySym = 0x00001EE3 - XKc_Ubelowdot*: TKeySym = 0x00001EE4 - XK_ubelowdot*: TKeySym = 0x00001EE5 - XKc_Uhook*: TKeySym = 0x00001EE6 - XK_uhook*: TKeySym = 0x00001EE7 - XKc_Uhornacute*: TKeySym = 0x00001EE8 - XK_uhornacute*: TKeySym = 0x00001EE9 - XKc_Uhorngrave*: TKeySym = 0x00001EEA - XK_uhorngrave*: TKeySym = 0x00001EEB - XKc_Uhornhook*: TKeySym = 0x00001EEC - XK_uhornhook*: TKeySym = 0x00001EED - XKc_Uhorntilde*: TKeySym = 0x00001EEE - XK_uhorntilde*: TKeySym = 0x00001EEF - XKc_Uhornbelowdot*: TKeySym = 0x00001EF0 - XK_uhornbelowdot*: TKeySym = 0x00001EF1 - XKc_Ybelowdot*: TKeySym = 0x00001EF4 - XK_ybelowdot*: TKeySym = 0x00001EF5 - XKc_Yhook*: TKeySym = 0x00001EF6 - XK_yhook*: TKeySym = 0x00001EF7 - XKc_Ytilde*: TKeySym = 0x00001EF8 - XK_ytilde*: TKeySym = 0x00001EF9 - XKc_Ohorn*: TKeySym = 0x00001EFA # U+01a0 - XK_ohorn*: TKeySym = 0x00001EFB # U+01a1 - XKc_Uhorn*: TKeySym = 0x00001EFC # U+01af - XK_uhorn*: TKeySym = 0x00001EFD # U+01b0 - XK_combining_tilde*: TKeySym = 0x00001E9F # U+0303 - XK_combining_grave*: TKeySym = 0x00001EF2 # U+0300 - XK_combining_acute*: TKeySym = 0x00001EF3 # U+0301 - XK_combining_hook*: TKeySym = 0x00001EFE # U+0309 - XK_combining_belowdot*: TKeySym = 0x00001EFF # U+0323 -# XK_VIETNAMESE - -when defined(XK_CURRENCY) or true: - const - XK_EcuSign*: TKeySym = 0x000020A0 - XK_ColonSign*: TKeySym = 0x000020A1 - XK_CruzeiroSign*: TKeySym = 0x000020A2 - XK_FFrancSign*: TKeySym = 0x000020A3 - XK_LiraSign*: TKeySym = 0x000020A4 - XK_MillSign*: TKeySym = 0x000020A5 - XK_NairaSign*: TKeySym = 0x000020A6 - XK_PesetaSign*: TKeySym = 0x000020A7 - XK_RupeeSign*: TKeySym = 0x000020A8 - XK_WonSign*: TKeySym = 0x000020A9 - XK_NewSheqelSign*: TKeySym = 0x000020AA - XK_DongSign*: TKeySym = 0x000020AB - XK_EuroSign*: TKeySym = 0x000020AC -# implementation diff --git a/lib/wrappers/x11/x.nim b/lib/wrappers/x11/x.nim deleted file mode 100644 index 2eefe311f..000000000 --- a/lib/wrappers/x11/x.nim +++ /dev/null @@ -1,401 +0,0 @@ - -# -# Automatically converted by H2Pas 0.99.15 from x.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# x.h -# -# Pointers to basic pascal types, inserted by h2pas conversion program. -import unsigned - -const - X_PROTOCOL* = 11 - X_PROTOCOL_REVISION* = 0 - -type - PXID* = ptr TXID - TXID* = culong - PMask* = ptr TMask - TMask* = culong - PPAtom* = ptr PAtom - PAtom* = ptr TAtom - TAtom* = culong - PVisualID* = ptr TVisualID - TVisualID* = culong - PTime* = ptr TTime - TTime* = culong - PPWindow* = ptr PWindow - PWindow* = ptr TWindow - TWindow* = TXID - PDrawable* = ptr TDrawable - TDrawable* = TXID - PFont* = ptr TFont - TFont* = TXID - PPixmap* = ptr TPixmap - TPixmap* = TXID - PCursor* = ptr TCursor - TCursor* = TXID - PColormap* = ptr TColormap - TColormap* = TXID - PGContext* = ptr TGContext - TGContext* = TXID - PKeySym* = ptr TKeySym - TKeySym* = TXID - PKeyCode* = ptr TKeyCode - TKeyCode* = cuchar - -proc `==`*(a, b: TAtom): bool = - return unsigned.`==`(a,b) - -const - None* = 0 - ParentRelative* = 1 - CopyFromParent* = 0 - PointerWindow* = 0 - InputFocus* = 1 - PointerRoot* = 1 - AnyPropertyType* = 0 - AnyKey* = 0 - AnyButton* = 0 - AllTemporary* = 0 - CurrentTime* = 0 - NoSymbol* = 0 - NoEventMask* = 0 - KeyPressMask* = 1 shl 0 - KeyReleaseMask* = 1 shl 1 - ButtonPressMask* = 1 shl 2 - ButtonReleaseMask* = 1 shl 3 - EnterWindowMask* = 1 shl 4 - LeaveWindowMask* = 1 shl 5 - PointerMotionMask* = 1 shl 6 - PointerMotionHintMask* = 1 shl 7 - Button1MotionMask* = 1 shl 8 - Button2MotionMask* = 1 shl 9 - Button3MotionMask* = 1 shl 10 - Button4MotionMask* = 1 shl 11 - Button5MotionMask* = 1 shl 12 - ButtonMotionMask* = 1 shl 13 - KeymapStateMask* = 1 shl 14 - ExposureMask* = 1 shl 15 - VisibilityChangeMask* = 1 shl 16 - StructureNotifyMask* = 1 shl 17 - ResizeRedirectMask* = 1 shl 18 - SubstructureNotifyMask* = 1 shl 19 - SubstructureRedirectMask* = 1 shl 20 - FocusChangeMask* = 1 shl 21 - PropertyChangeMask* = 1 shl 22 - ColormapChangeMask* = 1 shl 23 - OwnerGrabButtonMask* = 1 shl 24 - KeyPress* = 2 - KeyRelease* = 3 - ButtonPress* = 4 - ButtonRelease* = 5 - MotionNotify* = 6 - EnterNotify* = 7 - LeaveNotify* = 8 - FocusIn* = 9 - FocusOut* = 10 - KeymapNotify* = 11 - Expose* = 12 - GraphicsExpose* = 13 - NoExpose* = 14 - VisibilityNotify* = 15 - CreateNotify* = 16 - DestroyNotify* = 17 - UnmapNotify* = 18 - MapNotify* = 19 - MapRequest* = 20 - ReparentNotify* = 21 - ConfigureNotify* = 22 - ConfigureRequest* = 23 - GravityNotify* = 24 - ResizeRequest* = 25 - CirculateNotify* = 26 - CirculateRequest* = 27 - PropertyNotify* = 28 - SelectionClear* = 29 - SelectionRequest* = 30 - SelectionNotify* = 31 - ColormapNotify* = 32 - ClientMessage* = 33 - MappingNotify* = 34 - LASTEvent* = 35 - ShiftMask* = 1 shl 0 - LockMask* = 1 shl 1 - ControlMask* = 1 shl 2 - Mod1Mask* = 1 shl 3 - Mod2Mask* = 1 shl 4 - Mod3Mask* = 1 shl 5 - Mod4Mask* = 1 shl 6 - Mod5Mask* = 1 shl 7 - ShiftMapIndex* = 0 - LockMapIndex* = 1 - ControlMapIndex* = 2 - Mod1MapIndex* = 3 - Mod2MapIndex* = 4 - Mod3MapIndex* = 5 - Mod4MapIndex* = 6 - Mod5MapIndex* = 7 - Button1Mask* = 1 shl 8 - Button2Mask* = 1 shl 9 - Button3Mask* = 1 shl 10 - Button4Mask* = 1 shl 11 - Button5Mask* = 1 shl 12 - AnyModifier* = 1 shl 15 - Button1* = 1 - Button2* = 2 - Button3* = 3 - Button4* = 4 - Button5* = 5 - NotifyNormal* = 0 - NotifyGrab* = 1 - NotifyUngrab* = 2 - NotifyWhileGrabbed* = 3 - NotifyHint* = 1 - NotifyAncestor* = 0 - NotifyVirtual* = 1 - NotifyInferior* = 2 - NotifyNonlinear* = 3 - NotifyNonlinearVirtual* = 4 - NotifyPointer* = 5 - NotifyPointerRoot* = 6 - NotifyDetailNone* = 7 - VisibilityUnobscured* = 0 - VisibilityPartiallyObscured* = 1 - VisibilityFullyObscured* = 2 - PlaceOnTop* = 0 - PlaceOnBottom* = 1 - FamilyInternet* = 0 - FamilyDECnet* = 1 - FamilyChaos* = 2 - FamilyInternet6* = 6 - FamilyServerInterpreted* = 5 - PropertyNewValue* = 0 - PropertyDelete* = 1 - ColormapUninstalled* = 0 - ColormapInstalled* = 1 - GrabModeSync* = 0 - GrabModeAsync* = 1 - GrabSuccess* = 0 - AlreadyGrabbed* = 1 - GrabInvalidTime* = 2 - GrabNotViewable* = 3 - GrabFrozen* = 4 - AsyncPointer* = 0 - SyncPointer* = 1 - ReplayPointer* = 2 - AsyncKeyboard* = 3 - SyncKeyboard* = 4 - ReplayKeyboard* = 5 - AsyncBoth* = 6 - SyncBoth* = 7 - RevertToNone* = None - RevertToPointerRoot* = PointerRoot - RevertToParent* = 2 - Success* = 0 - BadRequest* = 1 - BadValue* = 2 - BadWindow* = 3 - BadPixmap* = 4 - BadAtom* = 5 - BadCursor* = 6 - BadFont* = 7 - BadMatch* = 8 - BadDrawable* = 9 - BadAccess* = 10 - BadAlloc* = 11 - BadColor* = 12 - BadGC* = 13 - BadIDChoice* = 14 - BadName* = 15 - BadLength* = 16 - BadImplementation* = 17 - FirstExtensionError* = 128 - LastExtensionError* = 255 - InputOutput* = 1 - InputOnly* = 2 - CWBackPixmap* = 1 shl 0 - CWBackPixel* = 1 shl 1 - CWBorderPixmap* = 1 shl 2 - CWBorderPixel* = 1 shl 3 - CWBitGravity* = 1 shl 4 - CWWinGravity* = 1 shl 5 - CWBackingStore* = 1 shl 6 - CWBackingPlanes* = 1 shl 7 - CWBackingPixel* = 1 shl 8 - CWOverrideRedirect* = 1 shl 9 - CWSaveUnder* = 1 shl 10 - CWEventMask* = 1 shl 11 - CWDontPropagate* = 1 shl 12 - CWColormap* = 1 shl 13 - CWCursor* = 1 shl 14 - CWX* = 1 shl 0 - CWY* = 1 shl 1 - CWWidth* = 1 shl 2 - CWHeight* = 1 shl 3 - CWBorderWidth* = 1 shl 4 - CWSibling* = 1 shl 5 - CWStackMode* = 1 shl 6 - ForgetGravity* = 0 - NorthWestGravity* = 1 - NorthGravity* = 2 - NorthEastGravity* = 3 - WestGravity* = 4 - CenterGravity* = 5 - EastGravity* = 6 - SouthWestGravity* = 7 - SouthGravity* = 8 - SouthEastGravity* = 9 - StaticGravity* = 10 - UnmapGravity* = 0 - NotUseful* = 0 - WhenMapped* = 1 - Always* = 2 - IsUnmapped* = 0 - IsUnviewable* = 1 - IsViewable* = 2 - SetModeInsert* = 0 - SetModeDelete* = 1 - DestroyAll* = 0 - RetainPermanent* = 1 - RetainTemporary* = 2 - Above* = 0 - Below* = 1 - TopIf* = 2 - BottomIf* = 3 - Opposite* = 4 - RaiseLowest* = 0 - LowerHighest* = 1 - PropModeReplace* = 0 - PropModePrepend* = 1 - PropModeAppend* = 2 - GXclear* = 0x00000000 - GXand* = 0x00000001 - GXandReverse* = 0x00000002 - GXcopy* = 0x00000003 - GXandInverted* = 0x00000004 - GXnoop* = 0x00000005 - GXxor* = 0x00000006 - GXor* = 0x00000007 - GXnor* = 0x00000008 - GXequiv* = 0x00000009 - GXinvert* = 0x0000000A - GXorReverse* = 0x0000000B - GXcopyInverted* = 0x0000000C - GXorInverted* = 0x0000000D - GXnand* = 0x0000000E - GXset* = 0x0000000F - LineSolid* = 0 - LineOnOffDash* = 1 - LineDoubleDash* = 2 - CapNotLast* = 0 - CapButt* = 1 - CapRound* = 2 - CapProjecting* = 3 - JoinMiter* = 0 - JoinRound* = 1 - JoinBevel* = 2 - FillSolid* = 0 - FillTiled* = 1 - FillStippled* = 2 - FillOpaqueStippled* = 3 - EvenOddRule* = 0 - WindingRule* = 1 - ClipByChildren* = 0 - IncludeInferiors* = 1 - Unsorted* = 0 - YSorted* = 1 - YXSorted* = 2 - YXBanded* = 3 - CoordModeOrigin* = 0 - CoordModePrevious* = 1 - Complex* = 0 - Nonconvex* = 1 - Convex* = 2 - ArcChord* = 0 - ArcPieSlice* = 1 - GCFunction* = 1 shl 0 - GCPlaneMask* = 1 shl 1 - GCForeground* = 1 shl 2 - GCBackground* = 1 shl 3 - GCLineWidth* = 1 shl 4 - GCLineStyle* = 1 shl 5 - GCCapStyle* = 1 shl 6 - GCJoinStyle* = 1 shl 7 - GCFillStyle* = 1 shl 8 - GCFillRule* = 1 shl 9 - GCTile* = 1 shl 10 - GCStipple* = 1 shl 11 - GCTileStipXOrigin* = 1 shl 12 - GCTileStipYOrigin* = 1 shl 13 - GCFont* = 1 shl 14 - GCSubwindowMode* = 1 shl 15 - GCGraphicsExposures* = 1 shl 16 - GCClipXOrigin* = 1 shl 17 - GCClipYOrigin* = 1 shl 18 - GCClipMask* = 1 shl 19 - GCDashOffset* = 1 shl 20 - GCDashList* = 1 shl 21 - GCArcMode* = 1 shl 22 - GCLastBit* = 22 - FontLeftToRight* = 0 - FontRightToLeft* = 1 - FontChange* = 255 - XYBitmap* = 0 - XYPixmap* = 1 - ZPixmap* = 2 - AllocNone* = 0 - AllocAll* = 1 - DoRed* = 1 shl 0 - DoGreen* = 1 shl 1 - DoBlue* = 1 shl 2 - CursorShape* = 0 - TileShape* = 1 - StippleShape* = 2 - AutoRepeatModeOff* = 0 - AutoRepeatModeOn* = 1 - AutoRepeatModeDefault* = 2 - LedModeOff* = 0 - LedModeOn* = 1 - KBKeyClickPercent* = 1 shl 0 - KBBellPercent* = 1 shl 1 - KBBellPitch* = 1 shl 2 - KBBellDuration* = 1 shl 3 - KBLed* = 1 shl 4 - KBLedMode* = 1 shl 5 - KBKey* = 1 shl 6 - KBAutoRepeatMode* = 1 shl 7 - MappingSuccess* = 0 - MappingBusy* = 1 - MappingFailed* = 2 - MappingModifier* = 0 - MappingKeyboard* = 1 - MappingPointer* = 2 - DontPreferBlanking* = 0 - PreferBlanking* = 1 - DefaultBlanking* = 2 - DisableScreenSaver* = 0 - DisableScreenInterval* = 0 - DontAllowExposures* = 0 - AllowExposures* = 1 - DefaultExposures* = 2 - ScreenSaverReset* = 0 - ScreenSaverActive* = 1 - HostInsert* = 0 - HostDelete* = 1 - EnableAccess* = 1 - DisableAccess* = 0 - StaticGray* = 0 - GrayScale* = 1 - StaticColor* = 2 - PseudoColor* = 3 - TrueColor* = 4 - DirectColor* = 5 - LSBFirst* = 0 - MSBFirst* = 1 - -# implementation diff --git a/lib/wrappers/x11/x11pragma.nim b/lib/wrappers/x11/x11pragma.nim deleted file mode 100644 index bc88fb004..000000000 --- a/lib/wrappers/x11/x11pragma.nim +++ /dev/null @@ -1,20 +0,0 @@ -# included from xlib bindings - - -when defined(use_pkg_config) or defined(use_pkg_config_static): - {.pragma: libx11, cdecl, importc.} - {.pragma: libx11c, cdecl.} - when defined(use_pkg_config_static): - {.passl: gorge("pkg-config x11 --static --libs").} - else: - {.passl: gorge("pkg-config x11 --libs").} -else: - when defined(macosx): - const - libX11* = "libX11.dylib" - else: - const - libX11* = "libX11.so" - - {.pragma: libx11, cdecl, dynlib: libX11, importc.} - {.pragma: libx11c, cdecl, dynlib: libX11.} diff --git a/lib/wrappers/x11/xatom.nim b/lib/wrappers/x11/xatom.nim deleted file mode 100644 index b2e1dca91..000000000 --- a/lib/wrappers/x11/xatom.nim +++ /dev/null @@ -1,81 +0,0 @@ -# -# THIS IS A GENERATED FILE -# -# Do not change! Changing this file implies a protocol change! -# - -import - X - -const - XA_PRIMARY* = TAtom(1) - XA_SECONDARY* = TAtom(2) - XA_ARC* = TAtom(3) - XA_ATOM* = TAtom(4) - XA_BITMAP* = TAtom(5) - XA_CARDINAL* = TAtom(6) - XA_COLORMAP* = TAtom(7) - XA_CURSOR* = TAtom(8) - XA_CUT_BUFFER0* = TAtom(9) - XA_CUT_BUFFER1* = TAtom(10) - XA_CUT_BUFFER2* = TAtom(11) - XA_CUT_BUFFER3* = TAtom(12) - XA_CUT_BUFFER4* = TAtom(13) - XA_CUT_BUFFER5* = TAtom(14) - XA_CUT_BUFFER6* = TAtom(15) - XA_CUT_BUFFER7* = TAtom(16) - XA_DRAWABLE* = TAtom(17) - XA_FONT* = TAtom(18) - XA_INTEGER* = TAtom(19) - XA_PIXMAP* = TAtom(20) - XA_POINT* = TAtom(21) - XA_RECTANGLE* = TAtom(22) - XA_RESOURCE_MANAGER* = TAtom(23) - XA_RGB_COLOR_MAP* = TAtom(24) - XA_RGB_BEST_MAP* = TAtom(25) - XA_RGB_BLUE_MAP* = TAtom(26) - XA_RGB_DEFAULT_MAP* = TAtom(27) - XA_RGB_GRAY_MAP* = TAtom(28) - XA_RGB_GREEN_MAP* = TAtom(29) - XA_RGB_RED_MAP* = TAtom(30) - XA_STRING* = TAtom(31) - XA_VISUALID* = TAtom(32) - XA_WINDOW* = TAtom(33) - XA_WM_COMMAND* = TAtom(34) - XA_WM_HINTS* = TAtom(35) - XA_WM_CLIENT_MACHINE* = TAtom(36) - XA_WM_ICON_NAME* = TAtom(37) - XA_WM_ICON_SIZE* = TAtom(38) - XA_WM_NAME* = TAtom(39) - XA_WM_NORMAL_HINTS* = TAtom(40) - XA_WM_SIZE_HINTS* = TAtom(41) - XA_WM_ZOOM_HINTS* = TAtom(42) - XA_MIN_SPACE* = TAtom(43) - XA_NORM_SPACE* = TAtom(44) - XA_MAX_SPACE* = TAtom(45) - XA_END_SPACE* = TAtom(46) - XA_SUPERSCRIPT_X* = TAtom(47) - XA_SUPERSCRIPT_Y* = TAtom(48) - XA_SUBSCRIPT_X* = TAtom(49) - XA_SUBSCRIPT_Y* = TAtom(50) - XA_UNDERLINE_POSITION* = TAtom(51) - XA_UNDERLINE_THICKNESS* = TAtom(52) - XA_STRIKEOUT_ASCENT* = TAtom(53) - XA_STRIKEOUT_DESCENT* = TAtom(54) - XA_ITALIC_ANGLE* = TAtom(55) - XA_X_HEIGHT* = TAtom(56) - XA_QUAD_WIDTH* = TAtom(57) - XA_WEIGHT* = TAtom(58) - XA_POINT_SIZE* = TAtom(59) - XA_RESOLUTION* = TAtom(60) - XA_COPYRIGHT* = TAtom(61) - XA_NOTICE* = TAtom(62) - XA_FONT_NAME* = TAtom(63) - XA_FAMILY_NAME* = TAtom(64) - XA_FULL_NAME* = TAtom(65) - XA_CAP_HEIGHT* = TAtom(66) - XA_WM_CLASS* = TAtom(67) - XA_WM_TRANSIENT_FOR* = TAtom(68) - XA_LAST_PREDEFINED* = TAtom(68) - -# implementation diff --git a/lib/wrappers/x11/xcms.nim b/lib/wrappers/x11/xcms.nim deleted file mode 100644 index 57aad6ae0..000000000 --- a/lib/wrappers/x11/xcms.nim +++ /dev/null @@ -1,396 +0,0 @@ - -import - x, xlib - -#const -# libX11* = "X11" - -# -# Automatically converted by H2Pas 0.99.15 from xcms.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# xcms.h -# - -const - XcmsFailure* = 0 - XcmsSuccess* = 1 - XcmsSuccessWithCompression* = 2 - -type - PXcmsColorFormat* = ptr TXcmsColorFormat - TXcmsColorFormat* = int32 - -proc XcmsUndefinedFormat*(): TXcmsColorFormat -proc XcmsCIEXYZFormat*(): TXcmsColorFormat -proc XcmsCIEuvYFormat*(): TXcmsColorFormat -proc XcmsCIExyYFormat*(): TXcmsColorFormat -proc XcmsCIELabFormat*(): TXcmsColorFormat -proc XcmsCIELuvFormat*(): TXcmsColorFormat -proc XcmsTekHVCFormat*(): TXcmsColorFormat -proc XcmsRGBFormat*(): TXcmsColorFormat -proc XcmsRGBiFormat*(): TXcmsColorFormat -const - XcmsInitNone* = 0x00000000 - XcmsInitSuccess* = 0x00000001 - XcmsInitFailure* = 0x000000FF - -when defined(MACROS): - proc DisplayOfCCC*(ccc: int32): int32 - proc ScreenNumberOfCCC*(ccc: int32): int32 - proc VisualOfCCC*(ccc: int32): int32 - proc ClientWhitePointOfCCC*(ccc: int32): int32 - proc ScreenWhitePointOfCCC*(ccc: int32): int32 - proc FunctionSetOfCCC*(ccc: int32): int32 -type - PXcmsFloat* = ptr TXcmsFloat - TXcmsFloat* = float64 - PXcmsRGB* = ptr TXcmsRGB - TXcmsRGB*{.final.} = object - red*: int16 - green*: int16 - blue*: int16 - - PXcmsRGBi* = ptr TXcmsRGBi - TXcmsRGBi*{.final.} = object - red*: TXcmsFloat - green*: TXcmsFloat - blue*: TXcmsFloat - - PXcmsCIEXYZ* = ptr TXcmsCIEXYZ - TXcmsCIEXYZ*{.final.} = object - X*: TXcmsFloat - Y*: TXcmsFloat - Z*: TXcmsFloat - - PXcmsCIEuvY* = ptr TXcmsCIEuvY - TXcmsCIEuvY*{.final.} = object - u_prime*: TXcmsFloat - v_prime*: TXcmsFloat - Y*: TXcmsFloat - - PXcmsCIExyY* = ptr TXcmsCIExyY - TXcmsCIExyY*{.final.} = object - x*: TXcmsFloat - y*: TXcmsFloat - theY*: TXcmsFloat - - PXcmsCIELab* = ptr TXcmsCIELab - TXcmsCIELab*{.final.} = object - L_star*: TXcmsFloat - a_star*: TXcmsFloat - b_star*: TXcmsFloat - - PXcmsCIELuv* = ptr TXcmsCIELuv - TXcmsCIELuv*{.final.} = object - L_star*: TXcmsFloat - u_star*: TXcmsFloat - v_star*: TXcmsFloat - - PXcmsTekHVC* = ptr TXcmsTekHVC - TXcmsTekHVC*{.final.} = object - H*: TXcmsFloat - V*: TXcmsFloat - C*: TXcmsFloat - - PXcmsPad* = ptr TXcmsPad - TXcmsPad*{.final.} = object - pad0*: TXcmsFloat - pad1*: TXcmsFloat - pad2*: TXcmsFloat - pad3*: TXcmsFloat - - PXcmsColor* = ptr TXcmsColor - TXcmsColor*{.final.} = object # spec : record - # case longint of - # 0 : ( RGB : TXcmsRGB ); - # 1 : ( RGBi : TXcmsRGBi ); - # 2 : ( CIEXYZ : TXcmsCIEXYZ ); - # 3 : ( CIEuvY : TXcmsCIEuvY ); - # 4 : ( CIExyY : TXcmsCIExyY ); - # 5 : ( CIELab : TXcmsCIELab ); - # 6 : ( CIELuv : TXcmsCIELuv ); - # 7 : ( TekHVC : TXcmsTekHVC ); - # 8 : ( Pad : TXcmsPad ); - # end; - pad*: TXcmsPad - pixel*: int32 - format*: TXcmsColorFormat - - PXcmsPerScrnInfo* = ptr TXcmsPerScrnInfo - TXcmsPerScrnInfo*{.final.} = object - screenWhitePt*: TXcmsColor - functionSet*: TXPointer - screenData*: TXPointer - state*: int8 - pad*: array[0..2, char] - - PXcmsCCC* = ptr TXcmsCCC - TXcmsCompressionProc* = proc (para1: PXcmsCCC, para2: PXcmsColor, - para3: int32, para4: int32, para5: PBool): TStatus{. - cdecl.} - TXcmsWhiteAdjustProc* = proc (para1: PXcmsCCC, para2: PXcmsColor, - para3: PXcmsColor, para4: TXcmsColorFormat, - para5: PXcmsColor, para6: int32, para7: PBool): TStatus{. - cdecl.} - TXcmsCCC*{.final.} = object - dpy*: PDisplay - screenNumber*: int32 - visual*: PVisual - clientWhitePt*: TXcmsColor - gamutCompProc*: TXcmsCompressionProc - gamutCompClientData*: TXPointer - whitePtAdjProc*: TXcmsWhiteAdjustProc - whitePtAdjClientData*: TXPointer - pPerScrnInfo*: PXcmsPerScrnInfo - - TXcmsCCCRec* = TXcmsCCC - PXcmsCCCRec* = ptr TXcmsCCCRec - TXcmsScreenInitProc* = proc (para1: PDisplay, para2: int32, - para3: PXcmsPerScrnInfo): TStatus{.cdecl.} - TXcmsScreenFreeProc* = proc (para1: TXPointer){.cdecl.} - TXcmsConversionProc* = proc (){.cdecl.} - PXcmsFuncListPtr* = ptr TXcmsFuncListPtr - TXcmsFuncListPtr* = TXcmsConversionProc - TXcmsParseStringProc* = proc (para1: cstring, para2: PXcmsColor): int32{.cdecl.} - PXcmsColorSpace* = ptr TXcmsColorSpace - TXcmsColorSpace*{.final.} = object - prefix*: cstring - id*: TXcmsColorFormat - parseString*: TXcmsParseStringProc - to_CIEXYZ*: TXcmsFuncListPtr - from_CIEXYZ*: TXcmsFuncListPtr - inverse_flag*: int32 - - PXcmsFunctionSet* = ptr TXcmsFunctionSet - TXcmsFunctionSet*{.final.} = object # error - #extern Status XcmsAddColorSpace ( - #in declaration at line 323 - DDColorSpaces*: ptr PXcmsColorSpace - screenInitProc*: TXcmsScreenInitProc - screenFreeProc*: TXcmsScreenFreeProc - - -proc XcmsAddFunctionSet*(para1: PXcmsFunctionSet): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsAllocColor*(para1: PDisplay, para2: TColormap, para3: PXcmsColor, - para4: TXcmsColorFormat): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsAllocNamedColor*(para1: PDisplay, para2: TColormap, para3: cstring, - para4: PXcmsColor, para5: PXcmsColor, - para6: TXcmsColorFormat): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCCCOfColormap*(para1: PDisplay, para2: TColormap): TXcmsCCC{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELabClipab*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELabClipL*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELabClipLab*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELabQueryMaxC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsCIELabQueryMaxL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsCIELabQueryMaxLC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsCIELabQueryMinL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsCIELabToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIELabWhiteShiftColors*(para1: TXcmsCCC, para2: PXcmsColor, - para3: PXcmsColor, para4: TXcmsColorFormat, - para5: PXcmsColor, para6: int32, para7: PBool): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsCIELuvClipL*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELuvClipLuv*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELuvClipuv*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCIELuvQueryMaxC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsCIELuvQueryMaxL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsCIELuvQueryMaxLC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsCIELuvQueryMinL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsCIELuvToCIEuvY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIELuvWhiteShiftColors*(para1: TXcmsCCC, para2: PXcmsColor, - para3: PXcmsColor, para4: TXcmsColorFormat, - para5: PXcmsColor, para6: int32, para7: PBool): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsCIEXYZToCIELab*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIEXYZToCIEuvY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIEXYZToCIExyY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIEXYZToRGBi*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIEuvYToCIELuv*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIEuvYToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIEuvYToTekHVC*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsCIExyYToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsClientWhitePointOfCCC*(para1: TXcmsCCC): PXcmsColor{.cdecl, - dynlib: libX11, importc.} -proc XcmsConvertColors*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: TXcmsColorFormat, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsCreateCCC*(para1: PDisplay, para2: int32, para3: PVisual, - para4: PXcmsColor, para5: TXcmsCompressionProc, - para6: TXPointer, para7: TXcmsWhiteAdjustProc, - para8: TXPointer): TXcmsCCC{.cdecl, dynlib: libX11, importc.} -proc XcmsDefaultCCC*(para1: PDisplay, para2: int32): TXcmsCCC{.cdecl, - dynlib: libX11, importc.} -proc XcmsDisplayOfCCC*(para1: TXcmsCCC): PDisplay{.cdecl, dynlib: libX11, - importc.} -proc XcmsFormatOfPrefix*(para1: cstring): TXcmsColorFormat{.cdecl, - dynlib: libX11, importc.} -proc XcmsFreeCCC*(para1: TXcmsCCC){.cdecl, dynlib: libX11, importc.} -proc XcmsLookupColor*(para1: PDisplay, para2: TColormap, para3: cstring, - para4: PXcmsColor, para5: PXcmsColor, - para6: TXcmsColorFormat): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsPrefixOfFormat*(para1: TXcmsColorFormat): cstring{.cdecl, - dynlib: libX11, importc.} -proc XcmsQueryBlack*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsQueryBlue*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsQueryColor*(para1: PDisplay, para2: TColormap, para3: PXcmsColor, - para4: TXcmsColorFormat): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsQueryColors*(para1: PDisplay, para2: TColormap, para3: PXcmsColor, - para4: int32, para5: TXcmsColorFormat): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsQueryGreen*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsQueryRed*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsQueryWhite*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsRGBiToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsRGBiToRGB*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsRGBToRGBi*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsScreenNumberOfCCC*(para1: TXcmsCCC): int32{.cdecl, dynlib: libX11, - importc.} -proc XcmsScreenWhitePointOfCCC*(para1: TXcmsCCC): PXcmsColor{.cdecl, - dynlib: libX11, importc.} -proc XcmsSetCCCOfColormap*(para1: PDisplay, para2: TColormap, para3: TXcmsCCC): TXcmsCCC{. - cdecl, dynlib: libX11, importc.} -proc XcmsSetCompressionProc*(para1: TXcmsCCC, para2: TXcmsCompressionProc, - para3: TXPointer): TXcmsCompressionProc{.cdecl, - dynlib: libX11, importc.} -proc XcmsSetWhiteAdjustProc*(para1: TXcmsCCC, para2: TXcmsWhiteAdjustProc, - para3: TXPointer): TXcmsWhiteAdjustProc{.cdecl, - dynlib: libX11, importc.} -proc XcmsSetWhitePoint*(para1: TXcmsCCC, para2: PXcmsColor): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsStoreColor*(para1: PDisplay, para2: TColormap, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsStoreColors*(para1: PDisplay, para2: TColormap, para3: PXcmsColor, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsTekHVCClipC*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsTekHVCClipV*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsTekHVCClipVC*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32, - para4: int32, para5: PBool): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XcmsTekHVCQueryMaxC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsTekHVCQueryMaxV*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsTekHVCQueryMaxVC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: PXcmsColor): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsTekHVCQueryMaxVSamples*(para1: TXcmsCCC, para2: TXcmsFloat, - para3: PXcmsColor, para4: int32): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsTekHVCQueryMinV*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat, - para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XcmsTekHVCToCIEuvY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor, - para4: int32): TStatus{.cdecl, dynlib: libX11, importc.} -proc XcmsTekHVCWhiteShiftColors*(para1: TXcmsCCC, para2: PXcmsColor, - para3: PXcmsColor, para4: TXcmsColorFormat, - para5: PXcmsColor, para6: int32, para7: PBool): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XcmsVisualOfCCC*(para1: TXcmsCCC): PVisual{.cdecl, dynlib: libX11, importc.} -# implementation - -proc XcmsUndefinedFormat(): TXcmsColorFormat = - result = 0x00000000'i32 - -proc XcmsCIEXYZFormat(): TXcmsColorFormat = - result = 0x00000001'i32 - -proc XcmsCIEuvYFormat(): TXcmsColorFormat = - result = 0x00000002'i32 - -proc XcmsCIExyYFormat(): TXcmsColorFormat = - result = 0x00000003'i32 - -proc XcmsCIELabFormat(): TXcmsColorFormat = - result = 0x00000004'i32 - -proc XcmsCIELuvFormat(): TXcmsColorFormat = - result = 0x00000005'i32 - -proc XcmsTekHVCFormat(): TXcmsColorFormat = - result = 0x00000006'i32 - -proc XcmsRGBFormat(): TXcmsColorFormat = - result = 0x80000000'i32 - -proc XcmsRGBiFormat(): TXcmsColorFormat = - result = 0x80000001'i32 - -when defined(MACROS): - proc DisplayOfCCC(ccc: int32): int32 = - result = ccc.dpy - - proc ScreenNumberOfCCC(ccc: int32): int32 = - result = ccc.screenNumber - - proc VisualOfCCC(ccc: int32): int32 = - result = ccc.visual - - proc ClientWhitePointOfCCC(ccc: int32): int32 = - result = addr(ccc.clientWhitePt) - - proc ScreenWhitePointOfCCC(ccc: int32): int32 = - result = addr(ccc.pPerScrnInfo.screenWhitePt) - - proc FunctionSetOfCCC(ccc: int32): int32 = - result = ccc.pPerScrnInfo.functionSet diff --git a/lib/wrappers/x11/xf86dga.nim b/lib/wrappers/x11/xf86dga.nim deleted file mode 100644 index 376f11861..000000000 --- a/lib/wrappers/x11/xf86dga.nim +++ /dev/null @@ -1,235 +0,0 @@ -# -# Copyright (c) 1999 XFree86 Inc -# -# $XFree86: xc/include/extensions/xf86dga.h,v 3.20 1999/10/13 04:20:48 dawes Exp $ - -import - x, xlib - -const - libXxf86dga* = "libXxf86dga.so" - -#type -# cfloat* = float32 - -# $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $ -# -# -#Copyright (c) 1995 Jon Tombs -#Copyright (c) 1995 XFree86 Inc -# -# -#************************************************************************ -# -# THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE -# -#************************************************************************ - -type - PPcchar* = ptr ptr cstring - -const - X_XF86DGAQueryVersion* = 0 - X_XF86DGAGetVideoLL* = 1 - X_XF86DGADirectVideo* = 2 - X_XF86DGAGetViewPortSize* = 3 - X_XF86DGASetViewPort* = 4 - X_XF86DGAGetVidPage* = 5 - X_XF86DGASetVidPage* = 6 - X_XF86DGAInstallColormap* = 7 - X_XF86DGAQueryDirectVideo* = 8 - X_XF86DGAViewPortChanged* = 9 - XF86DGADirectPresent* = 0x00000001 - XF86DGADirectGraphics* = 0x00000002 - XF86DGADirectMouse* = 0x00000004 - XF86DGADirectKeyb* = 0x00000008 - XF86DGAHasColormap* = 0x00000100 - XF86DGADirectColormap* = 0x00000200 - -proc XF86DGAQueryVersion*(dpy: PDisplay, majorVersion: Pcint, - minorVersion: Pcint): TBool{.CDecl, - dynlib: libXxf86dga, importc.} -proc XF86DGAQueryExtension*(dpy: PDisplay, event_base: Pcint, error_base: Pcint): TBool{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAGetVideoLL*(dpy: PDisplay, screen: cint, base_addr: Pcint, - width: Pcint, bank_size: Pcint, ram_size: Pcint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAGetVideo*(dpy: PDisplay, screen: cint, base_addr: PPcchar, - width: Pcint, bank_size: Pcint, ram_size: Pcint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGADirectVideo*(dpy: PDisplay, screen: cint, enable: cint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGADirectVideoLL*(dpy: PDisplay, screen: cint, enable: cint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAGetViewPortSize*(dpy: PDisplay, screen: cint, width: Pcint, - height: Pcint): TStatus{.CDecl, - dynlib: libXxf86dga, importc.} -proc XF86DGASetViewPort*(dpy: PDisplay, screen: cint, x: cint, y: cint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAGetVidPage*(dpy: PDisplay, screen: cint, vid_page: Pcint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGASetVidPage*(dpy: PDisplay, screen: cint, vid_page: cint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAInstallColormap*(dpy: PDisplay, screen: cint, Colormap: TColormap): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAForkApp*(screen: cint): cint{.CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAQueryDirectVideo*(dpy: PDisplay, screen: cint, flags: Pcint): TStatus{. - CDecl, dynlib: libXxf86dga, importc.} -proc XF86DGAViewPortChanged*(dpy: PDisplay, screen: cint, n: cint): TBool{. - CDecl, dynlib: libXxf86dga, importc.} -const - X_XDGAQueryVersion* = 0 # 1 through 9 are in xf86dga1.pp - # 10 and 11 are reserved to avoid conflicts with rogue DGA extensions - X_XDGAQueryModes* = 12 - X_XDGASetMode* = 13 - X_XDGASetViewport* = 14 - X_XDGAInstallColormap* = 15 - X_XDGASelectInput* = 16 - X_XDGAFillRectangle* = 17 - X_XDGACopyArea* = 18 - X_XDGACopyTransparentArea* = 19 - X_XDGAGetViewportStatus* = 20 - X_XDGASync* = 21 - X_XDGAOpenFramebuffer* = 22 - X_XDGACloseFramebuffer* = 23 - X_XDGASetClientVersion* = 24 - X_XDGAChangePixmapMode* = 25 - X_XDGACreateColormap* = 26 - XDGAConcurrentAccess* = 0x00000001 - XDGASolidFillRect* = 0x00000002 - XDGABlitRect* = 0x00000004 - XDGABlitTransRect* = 0x00000008 - XDGAPixmap* = 0x00000010 - XDGAInterlaced* = 0x00010000 - XDGADoublescan* = 0x00020000 - XDGAFlipImmediate* = 0x00000001 - XDGAFlipRetrace* = 0x00000002 - XDGANeedRoot* = 0x00000001 - XF86DGANumberEvents* = 7 - XDGAPixmapModeLarge* = 0 - XDGAPixmapModeSmall* = 1 - XF86DGAClientNotLocal* = 0 - XF86DGANoDirectVideoMode* = 1 - XF86DGAScreenNotActive* = 2 - XF86DGADirectNotActivated* = 3 - XF86DGAOperationNotSupported* = 4 - XF86DGANumberErrors* = (XF86DGAOperationNotSupported + 1) - -type - PXDGAMode* = ptr TXDGAMode - TXDGAMode*{.final.} = object - num*: cint # A unique identifier for the mode (num > 0) - name*: cstring # name of mode given in the XF86Config - verticalRefresh*: cfloat - flags*: cint # DGA_CONCURRENT_ACCESS, etc... - imageWidth*: cint # linear accessible portion (pixels) - imageHeight*: cint - pixmapWidth*: cint # Xlib accessible portion (pixels) - pixmapHeight*: cint # both fields ignored if no concurrent access - bytesPerScanline*: cint - byteOrder*: cint # MSBFirst, LSBFirst - depth*: cint - bitsPerPixel*: cint - redMask*: culong - greenMask*: culong - blueMask*: culong - visualClass*: cshort - viewportWidth*: cint - viewportHeight*: cint - xViewportStep*: cint # viewport position granularity - yViewportStep*: cint - maxViewportX*: cint # max viewport origin - maxViewportY*: cint - viewportFlags*: cint # types of page flipping possible - reserved1*: cint - reserved2*: cint - - PXDGADevice* = ptr TXDGADevice - TXDGADevice*{.final.} = object - mode*: TXDGAMode - data*: Pcuchar - pixmap*: TPixmap - - PXDGAButtonEvent* = ptr TXDGAButtonEvent - TXDGAButtonEvent*{.final.} = object - theType*: cint - serial*: culong - display*: PDisplay - screen*: cint - time*: TTime - state*: cuint - button*: cuint - - PXDGAKeyEvent* = ptr TXDGAKeyEvent - TXDGAKeyEvent*{.final.} = object - theType*: cint - serial*: culong - display*: PDisplay - screen*: cint - time*: TTime - state*: cuint - keycode*: cuint - - PXDGAMotionEvent* = ptr TXDGAMotionEvent - TXDGAMotionEvent*{.final.} = object - theType*: cint - serial*: culong - display*: PDisplay - screen*: cint - time*: TTime - state*: cuint - dx*: cint - dy*: cint - - PXDGAEvent* = ptr TXDGAEvent - TXDGAEvent*{.final.} = object - pad*: array[0..23, clong] # sorry you have to cast if you want access - #Case LongInt Of - # 0 : (_type : cint); - # 1 : (xbutton : TXDGAButtonEvent); - # 2 : (xkey : TXDGAKeyEvent); - # 3 : (xmotion : TXDGAMotionEvent); - # 4 : (pad : Array[0..23] Of clong); - - -proc XDGAQueryExtension*(dpy: PDisplay, eventBase: Pcint, erroBase: Pcint): TBool{. - CDecl, dynlib: libXxf86dga, importc.} -proc XDGAQueryVersion*(dpy: PDisplay, majorVersion: Pcint, minorVersion: Pcint): TBool{. - CDecl, dynlib: libXxf86dga, importc.} -proc XDGAQueryModes*(dpy: PDisplay, screen: cint, num: Pcint): PXDGAMode{.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGASetMode*(dpy: PDisplay, screen: cint, mode: cint): PXDGADevice{.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGAOpenFramebuffer*(dpy: PDisplay, screen: cint): TBool{.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGACloseFramebuffer*(dpy: PDisplay, screen: cint){.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGASetViewport*(dpy: PDisplay, screen: cint, x: cint, y: cint, flags: cint){. - CDecl, dynlib: libXxf86dga, importc.} -proc XDGAInstallColormap*(dpy: PDisplay, screen: cint, cmap: TColormap){.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGACreateColormap*(dpy: PDisplay, screen: cint, device: PXDGADevice, - alloc: cint): TColormap{.CDecl, dynlib: libXxf86dga, - importc.} -proc XDGASelectInput*(dpy: PDisplay, screen: cint, event_mask: clong){.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGAFillRectangle*(dpy: PDisplay, screen: cint, x: cint, y: cint, - width: cuint, height: cuint, color: culong){.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGACopyArea*(dpy: PDisplay, screen: cint, srcx: cint, srcy: cint, - width: cuint, height: cuint, dstx: cint, dsty: cint){.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGACopyTransparentArea*(dpy: PDisplay, screen: cint, srcx: cint, - srcy: cint, width: cuint, height: cuint, - dstx: cint, dsty: cint, key: culong){.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGAGetViewportStatus*(dpy: PDisplay, screen: cint): cint{.CDecl, - dynlib: libXxf86dga, importc.} -proc XDGASync*(dpy: PDisplay, screen: cint){.CDecl, dynlib: libXxf86dga, importc.} -proc XDGASetClientVersion*(dpy: PDisplay): TBool{.CDecl, dynlib: libXxf86dga, - importc.} -proc XDGAChangePixmapMode*(dpy: PDisplay, screen: cint, x: Pcint, y: Pcint, - mode: cint){.CDecl, dynlib: libXxf86dga, importc.} -proc XDGAKeyEventToXKeyEvent*(dk: PXDGAKeyEvent, xk: PXKeyEvent){.CDecl, - dynlib: libXxf86dga, importc.} -# implementation diff --git a/lib/wrappers/x11/xf86vmode.nim b/lib/wrappers/x11/xf86vmode.nim deleted file mode 100644 index 18a922cab..000000000 --- a/lib/wrappers/x11/xf86vmode.nim +++ /dev/null @@ -1,229 +0,0 @@ -# $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $ -# -# -#Copyright 1995 Kaleb S. KEITHLEY -# -#Permission is hereby granted, free of charge, to any person obtaining -#a copy of this software and associated documentation files (the -#"Software"), to deal in the Software without restriction, including -#without limitation the rights to use, copy, modify, merge, publish, -#distribute, sublicense, and/or sell copies of the Software, and to -#permit persons to whom the Software is furnished to do so, subject to -#the following conditions: -# -#The above copyright notice and this permission notice shall be -#included in all copies or substantial portions of the Software. -# -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -#IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES -#OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -#OTHER DEALINGS IN THE SOFTWARE. -# -#Except as contained in this notice, the name of Kaleb S. KEITHLEY -#shall not be used in advertising or otherwise to promote the sale, use -#or other dealings in this Software without prior written authorization -#from Kaleb S. KEITHLEY -# -# -# $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ -# THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION - -import - x, xlib - -const - libXxf86vm* = "libXxf86vm.so" - -type - PINT32* = ptr int32 - -const - X_XF86VidModeQueryVersion* = 0 - X_XF86VidModeGetModeLine* = 1 - X_XF86VidModeModModeLine* = 2 - X_XF86VidModeSwitchMode* = 3 - X_XF86VidModeGetMonitor* = 4 - X_XF86VidModeLockModeSwitch* = 5 - X_XF86VidModeGetAllModeLines* = 6 - X_XF86VidModeAddModeLine* = 7 - X_XF86VidModeDeleteModeLine* = 8 - X_XF86VidModeValidateModeLine* = 9 - X_XF86VidModeSwitchToMode* = 10 - X_XF86VidModeGetViewPort* = 11 - X_XF86VidModeSetViewPort* = 12 # new for version 2.x of this extension - X_XF86VidModeGetDotClocks* = 13 - X_XF86VidModeSetClientVersion* = 14 - X_XF86VidModeSetGamma* = 15 - X_XF86VidModeGetGamma* = 16 - X_XF86VidModeGetGammaRamp* = 17 - X_XF86VidModeSetGammaRamp* = 18 - X_XF86VidModeGetGammaRampSize* = 19 - X_XF86VidModeGetPermissions* = 20 - CLKFLAG_PROGRAMABLE* = 1 - -when defined(XF86VIDMODE_EVENTS): - const - XF86VidModeNotify* = 0 - XF86VidModeNumberEvents* = (XF86VidModeNotify + 1) - XF86VidModeNotifyMask* = 0x00000001 - XF86VidModeNonEvent* = 0 - XF86VidModeModeChange* = 1 -else: - const - XF86VidModeNumberEvents* = 0 -const - XF86VidModeBadClock* = 0 - XF86VidModeBadHTimings* = 1 - XF86VidModeBadVTimings* = 2 - XF86VidModeModeUnsuitable* = 3 - XF86VidModeExtensionDisabled* = 4 - XF86VidModeClientNotLocal* = 5 - XF86VidModeZoomLocked* = 6 - XF86VidModeNumberErrors* = (XF86VidModeZoomLocked + 1) - XF86VM_READ_PERMISSION* = 1 - XF86VM_WRITE_PERMISSION* = 2 - -type - PXF86VidModeModeLine* = ptr TXF86VidModeModeLine - TXF86VidModeModeLine*{.final.} = object - hdisplay*: cushort - hsyncstart*: cushort - hsyncend*: cushort - htotal*: cushort - hskew*: cushort - vdisplay*: cushort - vsyncstart*: cushort - vsyncend*: cushort - vtotal*: cushort - flags*: cuint - privsize*: cint - c_private*: PINT32 - - PPPXF86VidModeModeInfo* = ptr PPXF86VidModeModeInfo - PPXF86VidModeModeInfo* = ptr PXF86VidModeModeInfo - PXF86VidModeModeInfo* = ptr TXF86VidModeModeInfo - TXF86VidModeModeInfo*{.final.} = object - dotclock*: cuint - hdisplay*: cushort - hsyncstart*: cushort - hsyncend*: cushort - htotal*: cushort - hskew*: cushort - vdisplay*: cushort - vsyncstart*: cushort - vsyncend*: cushort - vtotal*: cushort - flags*: cuint - privsize*: cint - c_private*: PINT32 - - PXF86VidModeSyncRange* = ptr TXF86VidModeSyncRange - TXF86VidModeSyncRange*{.final.} = object - hi*: cfloat - lo*: cfloat - - PXF86VidModeMonitor* = ptr TXF86VidModeMonitor - TXF86VidModeMonitor*{.final.} = object - vendor*: cstring - model*: cstring - EMPTY*: cfloat - nhsync*: cuchar - hsync*: PXF86VidModeSyncRange - nvsync*: cuchar - vsync*: PXF86VidModeSyncRange - - PXF86VidModeNotifyEvent* = ptr TXF86VidModeNotifyEvent - TXF86VidModeNotifyEvent*{.final.} = object - theType*: cint # of event - serial*: culong # # of last request processed by server - send_event*: TBool # true if this came from a SendEvent req - display*: PDisplay # Display the event was read from - root*: TWindow # root window of event screen - state*: cint # What happened - kind*: cint # What happened - forced*: TBool # extents of new region - time*: TTime # event timestamp - - PXF86VidModeGamma* = ptr TXF86VidModeGamma - TXF86VidModeGamma*{.final.} = object - red*: cfloat # Red Gamma value - green*: cfloat # Green Gamma value - blue*: cfloat # Blue Gamma value - - -when defined(MACROS): - proc XF86VidModeSelectNextMode*(disp: PDisplay, scr: cint): TBool - proc XF86VidModeSelectPrevMode*(disp: PDisplay, scr: cint): TBool -proc XF86VidModeQueryVersion*(dpy: PDisplay, majorVersion: Pcint, - minorVersion: Pcint): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeQueryExtension*(dpy: PDisplay, event_base: Pcint, - error_base: Pcint): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeSetClientVersion*(dpy: PDisplay): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeGetModeLine*(dpy: PDisplay, screen: cint, dotclock: Pcint, - modeline: PXF86VidModeModeLine): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeGetAllModeLines*(dpy: PDisplay, screen: cint, modecount: Pcint, - modelinesPtr: PPPXF86VidModeModeInfo): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeAddModeLine*(dpy: PDisplay, screen: cint, - new_modeline: PXF86VidModeModeInfo, - after_modeline: PXF86VidModeModeInfo): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeDeleteModeLine*(dpy: PDisplay, screen: cint, - modeline: PXF86VidModeModeInfo): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeModModeLine*(dpy: PDisplay, screen: cint, - modeline: PXF86VidModeModeLine): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeValidateModeLine*(dpy: PDisplay, screen: cint, - modeline: PXF86VidModeModeInfo): TStatus{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeSwitchMode*(dpy: PDisplay, screen: cint, zoom: cint): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeSwitchToMode*(dpy: PDisplay, screen: cint, - modeline: PXF86VidModeModeInfo): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeLockModeSwitch*(dpy: PDisplay, screen: cint, lock: cint): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeGetMonitor*(dpy: PDisplay, screen: cint, - monitor: PXF86VidModeMonitor): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeGetViewPort*(dpy: PDisplay, screen: cint, x_return: Pcint, - y_return: Pcint): TBool{.CDecl, dynlib: libXxf86vm, - importc.} -proc XF86VidModeSetViewPort*(dpy: PDisplay, screen: cint, x: cint, y: cint): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeGetDotClocks*(dpy: PDisplay, screen: cint, flags_return: Pcint, - number_of_clocks_return: Pcint, - max_dot_clock_return: Pcint, clocks_return: PPcint): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeGetGamma*(dpy: PDisplay, screen: cint, Gamma: PXF86VidModeGamma): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeSetGamma*(dpy: PDisplay, screen: cint, Gamma: PXF86VidModeGamma): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeSetGammaRamp*(dpy: PDisplay, screen: cint, size: cint, - red_array: Pcushort, green_array: Pcushort, - blue_array: Pcushort): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeGetGammaRamp*(dpy: PDisplay, screen: cint, size: cint, - red_array: Pcushort, green_array: Pcushort, - blue_array: Pcushort): TBool{.CDecl, - dynlib: libXxf86vm, importc.} -proc XF86VidModeGetGammaRampSize*(dpy: PDisplay, screen: cint, size: Pcint): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -proc XF86VidModeGetPermissions*(dpy: PDisplay, screen: cint, permissions: Pcint): TBool{. - CDecl, dynlib: libXxf86vm, importc.} -# implementation - -when defined(MACROS): - proc XF86VidModeSelectNextMode(disp: PDisplay, scr: cint): TBool = - XF86VidModeSelectNextMode = XF86VidModeSwitchMode(disp, scr, 1) - - proc XF86VidModeSelectPrevMode(disp: PDisplay, scr: cint): TBool = - XF86VidModeSelectPrevMode = XF86VidModeSwitchMode(disp, scr, - 1) diff --git a/lib/wrappers/x11/xi.nim b/lib/wrappers/x11/xi.nim deleted file mode 100644 index d1b9f7846..000000000 --- a/lib/wrappers/x11/xi.nim +++ /dev/null @@ -1,307 +0,0 @@ -# -# $Xorg: XI.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $ -# -#************************************************************ -# -#Copyright 1989, 1998 The Open Group -# -#Permission to use, copy, modify, distribute, and sell this software and its -#documentation for any purpose is hereby granted without fee, provided that -#the above copyright notice appear in all copies and that both that -#copyright notice and this permission notice appear in supporting -#documentation. -# -#The above copyright notice and this permission notice shall be included in -#all copies or substantial portions of the Software. -# -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -#OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -#AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -#CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -#Except as contained in this notice, the name of The Open Group shall not be -#used in advertising or otherwise to promote the sale, use or other dealings -#in this Software without prior written authorization from The Open Group. -# -#Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. -# -# All Rights Reserved -# -#Permission to use, copy, modify, and distribute this software and its -#documentation for any purpose and without fee is hereby granted, -#provided that the above copyright notice appear in all copies and that -#both that copyright notice and this permission notice appear in -#supporting documentation, and that the name of Hewlett-Packard not be -#used in advertising or publicity pertaining to distribution of the -#software without specific, written prior permission. -# -#HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -#ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -#HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -#ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -#WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -#ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -#SOFTWARE. -# -#********************************************************/ -# $XFree86: xc/include/extensions/XI.h,v 1.5 2001/12/14 19:53:28 dawes Exp $ -# -# Definitions used by the server, library and client -# -# Pascal Convertion was made by Ido Kannner - kanerido@actcom.net.il -# -#Histroy: -# 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and chnaged it to -# "reocrd" only. -# 2004/10/07 - Removed the "uses X;" line. The unit does not need it. -# 2004/10/03 - Conversion from C header to Pascal unit. -# - -const - sz_xGetExtensionVersionReq* = 8 - sz_xGetExtensionVersionReply* = 32 - sz_xListInputDevicesReq* = 4 - sz_xListInputDevicesReply* = 32 - sz_xOpenDeviceReq* = 8 - sz_xOpenDeviceReply* = 32 - sz_xCloseDeviceReq* = 8 - sz_xSetDeviceModeReq* = 8 - sz_xSetDeviceModeReply* = 32 - sz_xSelectExtensionEventReq* = 12 - sz_xGetSelectedExtensionEventsReq* = 8 - sz_xGetSelectedExtensionEventsReply* = 32 - sz_xChangeDeviceDontPropagateListReq* = 12 - sz_xGetDeviceDontPropagateListReq* = 8 - sz_xGetDeviceDontPropagateListReply* = 32 - sz_xGetDeviceMotionEventsReq* = 16 - sz_xGetDeviceMotionEventsReply* = 32 - sz_xChangeKeyboardDeviceReq* = 8 - sz_xChangeKeyboardDeviceReply* = 32 - sz_xChangePointerDeviceReq* = 8 - sz_xChangePointerDeviceReply* = 32 - sz_xGrabDeviceReq* = 20 - sz_xGrabDeviceReply* = 32 - sz_xUngrabDeviceReq* = 12 - sz_xGrabDeviceKeyReq* = 20 - sz_xGrabDeviceKeyReply* = 32 - sz_xUngrabDeviceKeyReq* = 16 - sz_xGrabDeviceButtonReq* = 20 - sz_xGrabDeviceButtonReply* = 32 - sz_xUngrabDeviceButtonReq* = 16 - sz_xAllowDeviceEventsReq* = 12 - sz_xGetDeviceFocusReq* = 8 - sz_xGetDeviceFocusReply* = 32 - sz_xSetDeviceFocusReq* = 16 - sz_xGetFeedbackControlReq* = 8 - sz_xGetFeedbackControlReply* = 32 - sz_xChangeFeedbackControlReq* = 12 - sz_xGetDeviceKeyMappingReq* = 8 - sz_xGetDeviceKeyMappingReply* = 32 - sz_xChangeDeviceKeyMappingReq* = 8 - sz_xGetDeviceModifierMappingReq* = 8 - sz_xSetDeviceModifierMappingReq* = 8 - sz_xSetDeviceModifierMappingReply* = 32 - sz_xGetDeviceButtonMappingReq* = 8 - sz_xGetDeviceButtonMappingReply* = 32 - sz_xSetDeviceButtonMappingReq* = 8 - sz_xSetDeviceButtonMappingReply* = 32 - sz_xQueryDeviceStateReq* = 8 - sz_xQueryDeviceStateReply* = 32 - sz_xSendExtensionEventReq* = 16 - sz_xDeviceBellReq* = 8 - sz_xSetDeviceValuatorsReq* = 8 - sz_xSetDeviceValuatorsReply* = 32 - sz_xGetDeviceControlReq* = 8 - sz_xGetDeviceControlReply* = 32 - sz_xChangeDeviceControlReq* = 8 - sz_xChangeDeviceControlReply* = 32 - -const - INAME* = "XInputExtension" - -const - XI_KEYBOARD* = "KEYBOARD" - XI_MOUSE* = "MOUSE" - XI_TABLET* = "TABLET" - XI_TOUCHSCREEN* = "TOUCHSCREEN" - XI_TOUCHPAD* = "TOUCHPAD" - XI_BARCODE* = "BARCODE" - XI_BUTTONBOX* = "BUTTONBOX" - XI_KNOB_BOX* = "KNOB_BOX" - XI_ONE_KNOB* = "ONE_KNOB" - XI_NINE_KNOB* = "NINE_KNOB" - XI_TRACKBALL* = "TRACKBALL" - XI_QUADRATURE* = "QUADRATURE" - XI_ID_MODULE* = "ID_MODULE" - XI_SPACEBALL* = "SPACEBALL" - XI_DATAGLOVE* = "DATAGLOVE" - XI_EYETRACKER* = "EYETRACKER" - XI_CURSORKEYS* = "CURSORKEYS" - XI_FOOTMOUSE* = "FOOTMOUSE" - -const - Dont_Check* = 0 - XInput_Initial_Release* = 1 - XInput_Add_XDeviceBell* = 2 - XInput_Add_XSetDeviceValuators* = 3 - XInput_Add_XChangeDeviceControl* = 4 - -const - XI_Absent* = 0 - XI_Present* = 1 - -const - XI_Initial_Release_Major* = 1 - XI_Initial_Release_Minor* = 0 - -const - XI_Add_XDeviceBell_Major* = 1 - XI_Add_XDeviceBell_Minor* = 1 - -const - XI_Add_XSetDeviceValuators_Major* = 1 - XI_Add_XSetDeviceValuators_Minor* = 2 - -const - XI_Add_XChangeDeviceControl_Major* = 1 - XI_Add_XChangeDeviceControl_Minor* = 3 - -const - DEVICE_RESOLUTION* = 1 - -const - NoSuchExtension* = 1 - -const - COUNT* = 0 - CREATE* = 1 - -const - NewPointer* = 0 - NewKeyboard* = 1 - -const - XPOINTER* = 0 - XKEYBOARD* = 1 - -const - UseXKeyboard* = 0x000000FF - -const - IsXPointer* = 0 - IsXKeyboard* = 1 - IsXExtensionDevice* = 2 - -const - AsyncThisDevice* = 0 - SyncThisDevice* = 1 - ReplayThisDevice* = 2 - AsyncOtherDevices* = 3 - AsyncAll* = 4 - SyncAll* = 5 - -const - FollowKeyboard* = 3 - RevertToFollowKeyboard* = 3 - -const - DvAccelNum* = int(1) shl 0 - DvAccelDenom* = int(1) shl 1 - DvThreshold* = int(1) shl 2 - -const - DvKeyClickPercent* = int(1) shl 0 - DvPercent* = int(1) shl 1 - DvPitch* = int(1) shl 2 - DvDuration* = int(1) shl 3 - DvLed* = int(1) shl 4 - DvLedMode* = int(1) shl 5 - DvKey* = int(1) shl 6 - DvAutoRepeatMode* = 1 shl 7 - -const - DvString* = int(1) shl 0 - -const - DvInteger* = int(1) shl 0 - -const - DeviceMode* = int(1) shl 0 - Relative* = 0 - Absolute* = 1 # Merged from Metrolink tree for XINPUT stuff - TS_Raw* = 57 - TS_Scaled* = 58 - SendCoreEvents* = 59 - DontSendCoreEvents* = 60 # End of merged section - -const - ProximityState* = int(1) shl 1 - InProximity* = int(0) shl 1 - OutOfProximity* = int(1) shl 1 - -const - AddToList* = 0 - DeleteFromList* = 1 - -const - KeyClass* = 0 - ButtonClass* = 1 - ValuatorClass* = 2 - FeedbackClass* = 3 - ProximityClass* = 4 - FocusClass* = 5 - OtherClass* = 6 - -const - KbdFeedbackClass* = 0 - PtrFeedbackClass* = 1 - StringFeedbackClass* = 2 - IntegerFeedbackClass* = 3 - LedFeedbackClass* = 4 - BellFeedbackClass* = 5 - -const - devicePointerMotionHint* = 0 - deviceButton1Motion* = 1 - deviceButton2Motion* = 2 - deviceButton3Motion* = 3 - deviceButton4Motion* = 4 - deviceButton5Motion* = 5 - deviceButtonMotion* = 6 - deviceButtonGrab* = 7 - deviceOwnerGrabButton* = 8 - noExtensionEvent* = 9 - -const - XI_BadDevice* = 0 - XI_BadEvent* = 1 - XI_BadMode* = 2 - XI_DeviceBusy* = 3 - XI_BadClass* = 4 # Make XEventClass be a CARD32 for 64 bit servers. Don't affect client - # definition of XEventClass since that would be a library interface change. - # See the top of X.h for more _XSERVER64 magic. - # - -when defined(XSERVER64): - type - XEventClass* = CARD32 -else: - type - XEventClass* = int32 -#****************************************************************** -# * -# * Extension version structure. -# * -# - -type - PXExtensionVersion* = ptr TXExtensionVersion - TXExtensionVersion*{.final.} = object - present*: int16 - major_version*: int16 - minor_version*: int16 - - -# implementation diff --git a/lib/wrappers/x11/xinerama.nim b/lib/wrappers/x11/xinerama.nim deleted file mode 100644 index 96f5d7da3..000000000 --- a/lib/wrappers/x11/xinerama.nim +++ /dev/null @@ -1,25 +0,0 @@ -# Converted from X11/Xinerama.h -import - xlib - -const - xineramaLib = "libXinerama.so" - -type - PXineramaScreenInfo* = ptr TXineramaScreenInfo - TXineramaScreenInfo*{.final.} = object - screen_number*: cint - x_org*: int16 - y_org*: int16 - width*: int16 - height*: int16 - - -proc XineramaQueryExtension*(dpy: PDisplay, event_base: Pcint, error_base: Pcint): TBool{. - cdecl, dynlib: xineramaLib, importc.} -proc XineramaQueryVersion*(dpy: PDisplay, major: Pcint, minor: Pcint): TStatus{. - cdecl, dynlib: xineramaLib, importc.} -proc XineramaIsActive*(dpy: PDisplay): TBool{.cdecl, dynlib: xineramaLib, importc.} -proc XineramaQueryScreens*(dpy: PDisplay, number: Pcint): PXineramaScreenInfo{. - cdecl, dynlib: xineramaLib, importc.} - diff --git a/lib/wrappers/x11/xkb.nim b/lib/wrappers/x11/xkb.nim deleted file mode 100644 index 86296430a..000000000 --- a/lib/wrappers/x11/xkb.nim +++ /dev/null @@ -1,2387 +0,0 @@ -# -# $Xorg: XKB.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ -#************************************************************ -# $Xorg: XKBstr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ -#************************************************************ -# $Xorg: XKBgeom.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ -#************************************************************ -# -#Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. -# -#Permission to use, copy, modify, and distribute this -#software and its documentation for any purpose and without -#fee is hereby granted, provided that the above copyright -#notice appear in all copies and that both that copyright -#notice and this permission notice appear in supporting -#documentation, and that the name of Silicon Graphics not be -#used in advertising or publicity pertaining to distribution -#of the software without specific prior written permission. -#Silicon Graphics makes no representation about the suitability -#of this software for any purpose. It is provided "as is" -#without any express or implied warranty. -# -#SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -#SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -#AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -#GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -#DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -#DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -#OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -#THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -#******************************************************** -# $XFree86: xc/include/extensions/XKB.h,v 1.5 2002/11/20 04:49:01 dawes Exp $ -# $XFree86: xc/include/extensions/XKBgeom.h,v 3.9 2002/09/18 17:11:40 tsi Exp $ -# -# Pascal Convertion was made by Ido Kannner - kanerido@actcom.net.il -# -#Thanks: -# I want to thanks to oliebol for putting up with all of the problems that was found -# while translating this code. ;) -# -# I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my -# wierd questions ;) -# -# Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to -# understanding some of the problems I had converting this headers and pointing me to resources -# that helped translating this headers. -# -# Ido -# -#History: -# 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and -# chnaged it to "reocrd" only. -# 2004/10/04 - 06 - Convertion from the c header of XKBgeom.h. -# 2004/10/03 - Removed the XKBstr_UNIT compiler decleration. Afther the joined files, -# There is no need for it anymore. -# - There is a need to define (for now) XKBgeom (compiler define) in order -# to use the code of it. At this moment, I did not yet converted it to Pascal. -# -# 2004/09/17 - 10/04 - Convertion from the c header of XKBstr. -# -# 2004/10/03 - Joined xkbstr.pas into xkb.pas because of the circular calls problems. -# - Added the history of xkbstr.pas above this addition. -# -# 2004/09/17 - Fixed a wrong convertion number of XkbPerKeyBitArraySize, insted -# of float, it's now converted into integer (as it should have been). -# -# 2004/09/15 - 16 - Convertion from the c header of XKB.h. -# - -import - X, Xlib - -include "x11pragma.nim" - -proc XkbCharToInt*(v: int8): int16 -proc XkbIntTo2Chars*(i: int16, h, L: var int8) -proc Xkb2CharsToInt*(h, L: int8): int16 - # - # Common data structures and access macros - # -type - PWord* = ptr array[0..64_000, int16] - PByte* = ptr byte - PXkbStatePtr* = ptr TXkbStateRec - TXkbStateRec*{.final.} = object - group*: int8 - locked_group*: int8 - base_group*: int16 - latched_group*: int16 - mods*: int8 - base_mods*: int8 - latched_mods*: int8 - locked_mods*: int8 - compat_state*: int8 - grab_mods*: int8 - compat_grab_mods*: int8 - lookup_mods*: int8 - compat_lookup_mods*: int8 - ptr_buttons*: int16 - - -proc XkbModLocks*(s: PXkbStatePtr): int8 -proc XkbStateMods*(s: PXkbStatePtr): int16 -proc XkbGroupLock*(s: PXkbStatePtr): int8 -proc XkbStateGroup*(s: PXkbStatePtr): int16 -proc XkbStateFieldFromRec*(s: PXkbStatePtr): int -proc XkbGrabStateFromRec*(s: PXkbStatePtr): int -type - PXkbModsPtr* = ptr TXkbModsRec - TXkbModsRec*{.final.} = object - mask*: int8 # effective mods - real_mods*: int8 - vmods*: int16 - - -type - PXkbKTMapEntryPtr* = ptr TXkbKTMapEntryRec - TXkbKTMapEntryRec*{.final.} = object - active*: bool - level*: int8 - mods*: TXkbModsRec - - -type - PXkbKeyTypePtr* = ptr TXkbKeyTypeRec - TXkbKeyTypeRec*{.final.} = object - mods*: TXkbModsRec - num_levels*: int8 - map_count*: int8 - map*: PXkbKTMapEntryPtr - preserve*: PXkbModsPtr - name*: TAtom - level_names*: TAtom - - -proc XkbNumGroups*(g: int16): int16 -proc XkbOutOfRangeGroupInfo*(g: int16): int16 -proc XkbOutOfRangeGroupAction*(g: int16): int16 -proc XkbOutOfRangeGroupNumber*(g: int16): int16 -proc XkbSetGroupInfo*(g, w, n: int16): int16 -proc XkbSetNumGroups*(g, n: int16): int16 - # - # Structures and access macros used primarily by the server - # -type - PXkbBehavior* = ptr TXkbBehavior - TXkbBehavior*{.final.} = object - theType*: int8 - data*: int8 - - -type - PXkbModAction* = ptr TXkbModAction - TXkbModAction*{.final.} = object - theType*: int8 - flags*: int8 - mask*: int8 - real_mods*: int8 - vmods1*: int8 - vmods2*: int8 - - -proc XkbModActionVMods*(a: PXkbModAction): int16 -proc XkbSetModActionVMods*(a: PXkbModAction, v: int8) -type - PXkbGroupAction* = ptr TXkbGroupAction - TXkbGroupAction*{.final.} = object - theType*: int8 - flags*: int8 - group_XXX*: int8 - - -proc XkbSAGroup*(a: PXkbGroupAction): int8 -proc XkbSASetGroupProc*(a: PXkbGroupAction, g: int8) -type - PXkbISOAction* = ptr TXkbISOAction - TXkbISOAction*{.final.} = object - theType*: int8 - flags*: int8 - mask*: int8 - real_mods*: int8 - group_XXX*: int8 - affect*: int8 - vmods1*: int8 - vmods2*: int8 - - -type - PXkbPtrAction* = ptr TXkbPtrAction - TXkbPtrAction*{.final.} = object - theType*: int8 - flags*: int8 - high_XXX*: int8 - low_XXX*: int8 - high_YYY*: int8 - low_YYY*: int8 - - -proc XkbPtrActionX*(a: PXkbPtrAction): int16 -proc XkbPtrActionY*(a: PXkbPtrAction): int16 -proc XkbSetPtrActionX*(a: PXkbPtrAction, x: int8) -proc XkbSetPtrActionY*(a: PXkbPtrAction, y: int8) -type - PXkbPtrBtnAction* = ptr TXkbPtrBtnAction - TXkbPtrBtnAction*{.final.} = object - theType*: int8 - flags*: int8 - count*: int8 - button*: int8 - - -type - PXkbPtrDfltAction* = ptr TXkbPtrDfltAction - TXkbPtrDfltAction*{.final.} = object - theType*: int8 - flags*: int8 - affect*: int8 - valueXXX*: int8 - - -proc XkbSAPtrDfltValue*(a: PXkbPtrDfltAction): int8 -proc XkbSASetPtrDfltValue*(a: PXkbPtrDfltAction, c: pointer) -type - PXkbSwitchScreenAction* = ptr TXkbSwitchScreenAction - TXkbSwitchScreenAction*{.final.} = object - theType*: int8 - flags*: int8 - screenXXX*: int8 - - -proc XkbSAScreen*(a: PXkbSwitchScreenAction): int8 -proc XkbSASetScreen*(a: PXkbSwitchScreenAction, s: pointer) -type - PXkbCtrlsAction* = ptr TXkbCtrlsAction - TXkbCtrlsAction*{.final.} = object - theType*: int8 - flags*: int8 - ctrls3*: int8 - ctrls2*: int8 - ctrls1*: int8 - ctrls0*: int8 - - -proc XkbActionSetCtrls*(a: PXkbCtrlsAction, c: int8) -proc XkbActionCtrls*(a: PXkbCtrlsAction): int16 -type - PXkbMessageAction* = ptr TXkbMessageAction - TXkbMessageAction*{.final.} = object - theType*: int8 - flags*: int8 - message*: array[0..5, char] - - -type - PXkbRedirectKeyAction* = ptr TXkbRedirectKeyAction - TXkbRedirectKeyAction*{.final.} = object - theType*: int8 - new_key*: int8 - mods_mask*: int8 - mods*: int8 - vmods_mask0*: int8 - vmods_mask1*: int8 - vmods0*: int8 - vmods1*: int8 - - -proc XkbSARedirectVMods*(a: PXkbRedirectKeyAction): int16 -proc XkbSARedirectSetVMods*(a: PXkbRedirectKeyAction, m: int8) -proc XkbSARedirectVModsMask*(a: PXkbRedirectKeyAction): int16 -proc XkbSARedirectSetVModsMask*(a: PXkbRedirectKeyAction, m: int8) -type - PXkbDeviceBtnAction* = ptr TXkbDeviceBtnAction - TXkbDeviceBtnAction*{.final.} = object - theType*: int8 - flags*: int8 - count*: int8 - button*: int8 - device*: int8 - - -type - PXkbDeviceValuatorAction* = ptr TXkbDeviceValuatorAction - TXkbDeviceValuatorAction*{.final.} = object # - # Macros to classify key actions - # - theType*: int8 - device*: int8 - v1_what*: int8 - v1_ndx*: int8 - v1_value*: int8 - v2_what*: int8 - v2_ndx*: int8 - v2_value*: int8 - - -const - XkbAnyActionDataSize* = 7 - -type - PXkbAnyAction* = ptr TXkbAnyAction - TXkbAnyAction*{.final.} = object - theType*: int8 - data*: array[0..XkbAnyActionDataSize - 1, int8] - - -proc XkbIsModAction*(a: PXkbAnyAction): bool -proc XkbIsGroupAction*(a: PXkbAnyAction): bool -proc XkbIsPtrAction*(a: PXkbAnyAction): bool -type - PXkbAction* = ptr TXkbAction - TXkbAction*{.final.} = object # - # XKB request codes, used in: - # - xkbReqType field of all requests - # - requestMinor field of some events - # - any*: TXkbAnyAction - mods*: TXkbModAction - group*: TXkbGroupAction - iso*: TXkbISOAction - thePtr*: TXkbPtrAction - btn*: TXkbPtrBtnAction - dflt*: TXkbPtrDfltAction - screen*: TXkbSwitchScreenAction - ctrls*: TXkbCtrlsAction - msg*: TXkbMessageAction - redirect*: TXkbRedirectKeyAction - devbtn*: TXkbDeviceBtnAction - devval*: TXkbDeviceValuatorAction - theType*: int8 - - -const - X_kbUseExtension* = 0 - X_kbSelectEvents* = 1 - X_kbBell* = 3 - X_kbGetState* = 4 - X_kbLatchLockState* = 5 - X_kbGetControls* = 6 - X_kbSetControls* = 7 - X_kbGetMap* = 8 - X_kbSetMap* = 9 - X_kbGetCompatMap* = 10 - X_kbSetCompatMap* = 11 - X_kbGetIndicatorState* = 12 - X_kbGetIndicatorMap* = 13 - X_kbSetIndicatorMap* = 14 - X_kbGetNamedIndicator* = 15 - X_kbSetNamedIndicator* = 16 - X_kbGetNames* = 17 - X_kbSetNames* = 18 - X_kbGetGeometry* = 19 - X_kbSetGeometry* = 20 - X_kbPerClientFlags* = 21 - X_kbListComponents* = 22 - X_kbGetKbdByName* = 23 - X_kbGetDeviceInfo* = 24 - X_kbSetDeviceInfo* = 25 - X_kbSetDebuggingFlags* = 101 # - # In the X sense, XKB reports only one event. - # The type field of all XKB events is XkbEventCode - # - -const - XkbEventCode* = 0 - XkbNumberEvents* = XkbEventCode + 1 # - # XKB has a minor event code so it can use one X event code for - # multiple purposes. - # - reported in the xkbType field of all XKB events. - # - XkbSelectEventDetails: Indicates the event for which event details - # are being changed - # - -const - XkbNewKeyboardNotify* = 0 - XkbMapNotify* = 1 - XkbStateNotify* = 2 - XkbControlsNotify* = 3 - XkbIndicatorStateNotify* = 4 - XkbIndicatorMapNotify* = 5 - XkbNamesNotify* = 6 - XkbCompatMapNotify* = 7 - XkbBellNotify* = 8 - XkbActionMessage* = 9 - XkbAccessXNotify* = 10 - XkbExtensionDeviceNotify* = 11 # - # Event Mask: - # - XkbSelectEvents: Specifies event interest. - # - -const - XkbNewKeyboardNotifyMask* = int(1) shl 0 - XkbMapNotifyMask* = int(1) shl 1 - XkbStateNotifyMask* = int(1) shl 2 - XkbControlsNotifyMask* = int(1) shl 3 - XkbIndicatorStateNotifyMask* = int(1) shl 4 - XkbIndicatorMapNotifyMask* = int(1) shl 5 - XkbNamesNotifyMask* = int(1) shl 6 - XkbCompatMapNotifyMask* = int(1) shl 7 - XkbBellNotifyMask* = int(1) shl 8 - XkbActionMessageMask* = int(1) shl 9 - XkbAccessXNotifyMask* = int(1) shl 10 - XkbExtensionDeviceNotifyMask* = int(1) shl 11 - XkbAllEventsMask* = 0x00000FFF # - # NewKeyboardNotify event details: - # - -const - XkbNKN_KeycodesMask* = int(1) shl 0 - XkbNKN_GeometryMask* = int(1) shl 1 - XkbNKN_DeviceIDMask* = int(1) shl 2 - XkbAllNewKeyboardEventsMask* = 0x00000007 # - # AccessXNotify event types: - # - The 'what' field of AccessXNotify events reports the - # reason that the event was generated. - # - -const - XkbAXN_SKPress* = 0 - XkbAXN_SKAccept* = 1 - XkbAXN_SKReject* = 2 - XkbAXN_SKRelease* = 3 - XkbAXN_BKAccept* = 4 - XkbAXN_BKReject* = 5 - XkbAXN_AXKWarning* = 6 # - # AccessXNotify details: - # - Used as an event detail mask to limit the conditions under which - # AccessXNotify events are reported - # - -const - XkbAXN_SKPressMask* = int(1) shl 0 - XkbAXN_SKAcceptMask* = int(1) shl 1 - XkbAXN_SKRejectMask* = int(1) shl 2 - XkbAXN_SKReleaseMask* = int(1) shl 3 - XkbAXN_BKAcceptMask* = int(1) shl 4 - XkbAXN_BKRejectMask* = int(1) shl 5 - XkbAXN_AXKWarningMask* = int(1) shl 6 - XkbAllAccessXEventsMask* = 0x0000000F # - # State detail mask: - # - The 'changed' field of StateNotify events reports which of - # the keyboard state components have changed. - # - Used as an event detail mask to limit the conditions under - # which StateNotify events are reported. - # - -const - XkbModifierStateMask* = int(1) shl 0 - XkbModifierBaseMask* = int(1) shl 1 - XkbModifierLatchMask* = int(1) shl 2 - XkbModifierLockMask* = int(1) shl 3 - XkbGroupStateMask* = int(1) shl 4 - XkbGroupBaseMask* = int(1) shl 5 - XkbGroupLatchMask* = int(1) shl 6 - XkbGroupLockMask* = int(1) shl 7 - XkbCompatStateMask* = int(1) shl 8 - XkbGrabModsMask* = int(1) shl 9 - XkbCompatGrabModsMask* = int(1) shl 10 - XkbLookupModsMask* = int(1) shl 11 - XkbCompatLookupModsMask* = int(1) shl 12 - XkbPointerButtonMask* = int(1) shl 13 - XkbAllStateComponentsMask* = 0x00003FFF # - # Controls detail masks: - # The controls specified in XkbAllControlsMask: - # - The 'changed' field of ControlsNotify events reports which of - # the keyboard controls have changed. - # - The 'changeControls' field of the SetControls request specifies - # the controls for which values are to be changed. - # - Used as an event detail mask to limit the conditions under - # which ControlsNotify events are reported. - # - # The controls specified in the XkbAllBooleanCtrlsMask: - # - The 'enabledControls' field of ControlsNotify events reports the - # current status of the boolean controls. - # - The 'enabledControlsChanges' field of ControlsNotify events reports - # any boolean controls that have been turned on or off. - # - The 'affectEnabledControls' and 'enabledControls' fields of the - # kbSetControls request change the set of enabled controls. - # - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of - # an XkbControlsRec specify the controls to be changed if the keyboard - # times out and the values to which they should be changed. - # - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags - # request specifies the specify the controls to be reset when the - # client exits and the values to which they should be reset. - # - The 'ctrls' field of an indicator map specifies the controls - # that drive the indicator. - # - Specifies the boolean controls affected by the SetControls and - # LockControls key actions. - # - -const - XkbRepeatKeysMask* = int(1) shl 0 - XkbSlowKeysMask* = int(1) shl 1 - XkbBounceKeysMask* = int(1) shl 2 - XkbStickyKeysMask* = int(1) shl 3 - XkbMouseKeysMask* = int(1) shl 4 - XkbMouseKeysAccelMask* = int(1) shl 5 - XkbAccessXKeysMask* = int(1) shl 6 - XkbAccessXTimeoutMask* = int(1) shl 7 - XkbAccessXFeedbackMask* = int(1) shl 8 - XkbAudibleBellMask* = int(1) shl 9 - XkbOverlay1Mask* = int(1) shl 10 - XkbOverlay2Mask* = int(1) shl 11 - XkbIgnoreGroupLockMask* = int(1) shl 12 - XkbGroupsWrapMask* = int(1) shl 27 - XkbInternalModsMask* = int(1) shl 28 - XkbIgnoreLockModsMask* = int(1) shl 29 - XkbPerKeyRepeatMask* = int(1) shl 30 - XkbControlsEnabledMask* = int(1) shl 31 - XkbAccessXOptionsMask* = XkbStickyKeysMask or XkbAccessXFeedbackMask - XkbAllBooleanCtrlsMask* = 0x00001FFF - XkbAllControlsMask* = 0xF8001FFF # - # Compatibility Map Compontents: - # - Specifies the components to be allocated in XkbAllocCompatMap. - # - -const - XkbSymInterpMask* = 1 shl 0 - XkbGroupCompatMask* = 1 shl 1 - XkbAllCompatMask* = 0x00000003 # - # Assorted constants and limits. - # - -const - XkbAllIndicatorsMask* = 0xFFFFFFFF # - # Map components masks: - # Those in AllMapComponentsMask: - # - Specifies the individual fields to be loaded or changed for the - # GetMap and SetMap requests. - # Those in ClientInfoMask: - # - Specifies the components to be allocated by XkbAllocClientMap. - # Those in ServerInfoMask: - # - Specifies the components to be allocated by XkbAllocServerMap. - # - -const - XkbKeyTypesMask* = 1 shl 0 - XkbKeySymsMask* = 1 shl 1 - XkbModifierMapMask* = 1 shl 2 - XkbExplicitComponentsMask* = 1 shl 3 - XkbKeyActionsMask* = 1 shl 4 - XkbKeyBehaviorsMask* = 1 shl 5 - XkbVirtualModsMask* = 1 shl 6 - XkbVirtualModMapMask* = 1 shl 7 - XkbAllClientInfoMask* = XkbKeyTypesMask or XkbKeySymsMask or - XkbModifierMapMask - XkbAllServerInfoMask* = XkbExplicitComponentsMask or XkbKeyActionsMask or - XkbKeyBehaviorsMask or XkbVirtualModsMask or XkbVirtualModMapMask - XkbAllMapComponentsMask* = XkbAllClientInfoMask or XkbAllServerInfoMask # - # Names component mask: - # - Specifies the names to be loaded or changed for the GetNames and - # SetNames requests. - # - Specifies the names that have changed in a NamesNotify event. - # - Specifies the names components to be allocated by XkbAllocNames. - # - -const - XkbKeycodesNameMask* = 1 shl 0 - XkbGeometryNameMask* = 1 shl 1 - XkbSymbolsNameMask* = 1 shl 2 - XkbPhysSymbolsNameMask* = 1 shl 3 - XkbTypesNameMask* = 1 shl 4 - XkbCompatNameMask* = 1 shl 5 - XkbKeyTypeNamesMask* = 1 shl 6 - XkbKTLevelNamesMask* = 1 shl 7 - XkbIndicatorNamesMask* = 1 shl 8 - XkbKeyNamesMask* = 1 shl 9 - XkbKeyAliasesMask* = 1 shl 10 - XkbVirtualModNamesMask* = 1 shl 11 - XkbGroupNamesMask* = 1 shl 12 - XkbRGNamesMask* = 1 shl 13 - XkbComponentNamesMask* = 0x0000003F - XkbAllNamesMask* = 0x00003FFF # - # Miscellaneous event details: - # - event detail masks for assorted events that don't reall - # have any details. - # - -const - XkbAllStateEventsMask* = XkbAllStateComponentsMask - XkbAllMapEventsMask* = XkbAllMapComponentsMask - XkbAllControlEventsMask* = XkbAllControlsMask - XkbAllIndicatorEventsMask* = XkbAllIndicatorsMask - XkbAllNameEventsMask* = XkbAllNamesMask - XkbAllCompatMapEventsMask* = XkbAllCompatMask - XkbAllBellEventsMask* = int(1) shl 0 - XkbAllActionMessagesMask* = int(1) shl 0 # - # XKB reports one error: BadKeyboard - # A further reason for the error is encoded into to most significant - # byte of the resourceID for the error: - # XkbErr_BadDevice - the device in question was not found - # XkbErr_BadClass - the device was found but it doesn't belong to - # the appropriate class. - # XkbErr_BadId - the device was found and belongs to the right - # class, but not feedback with a matching id was - # found. - # The low byte of the resourceID for this error contains the device - # id, class specifier or feedback id that failed. - # - -const - XkbKeyboard* = 0 - XkbNumberErrors* = 1 - XkbErr_BadDevice* = 0x000000FF - XkbErr_BadClass* = 0x000000FE - XkbErr_BadId* = 0x000000FD # - # Keyboard Components Mask: - # - Specifies the components that follow a GetKeyboardByNameReply - # - -const - XkbClientMapMask* = int(1) shl 0 - XkbServerMapMask* = int(1) shl 1 - XkbCompatMapMask* = int(1) shl 2 - XkbIndicatorMapMask* = int(1) shl 3 - XkbNamesMask* = int(1) shl 4 - XkbGeometryMask* = int(1) shl 5 - XkbControlsMask* = int(1) shl 6 - XkbAllComponentsMask* = 0x0000007F # - # AccessX Options Mask - # - The 'accessXOptions' field of an XkbControlsRec specifies the - # AccessX options that are currently in effect. - # - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' - # fields of an XkbControlsRec specify the Access X options to be - # changed if the keyboard times out and the values to which they - # should be changed. - # - -const - XkbAX_SKPressFBMask* = int(1) shl 0 - XkbAX_SKAcceptFBMask* = int(1) shl 1 - XkbAX_FeatureFBMask* = int(1) shl 2 - XkbAX_SlowWarnFBMask* = int(1) shl 3 - XkbAX_IndicatorFBMask* = int(1) shl 4 - XkbAX_StickyKeysFBMask* = int(1) shl 5 - XkbAX_TwoKeysMask* = int(1) shl 6 - XkbAX_LatchToLockMask* = int(1) shl 7 - XkbAX_SKReleaseFBMask* = int(1) shl 8 - XkbAX_SKRejectFBMask* = int(1) shl 9 - XkbAX_BKRejectFBMask* = int(1) shl 10 - XkbAX_DumbBellFBMask* = int(1) shl 11 - XkbAX_FBOptionsMask* = 0x00000F3F - XkbAX_SKOptionsMask* = 0x000000C0 - XkbAX_AllOptionsMask* = 0x00000FFF # - # XkbUseCoreKbd is used to specify the core keyboard without having - # to look up its X input extension identifier. - # XkbUseCorePtr is used to specify the core pointer without having - # to look up its X input extension identifier. - # XkbDfltXIClass is used to specify "don't care" any place that the - # XKB protocol is looking for an X Input Extension - # device class. - # XkbDfltXIId is used to specify "don't care" any place that the - # XKB protocol is looking for an X Input Extension - # feedback identifier. - # XkbAllXIClasses is used to get information about all device indicators, - # whether they're part of the indicator feedback class - # or the keyboard feedback class. - # XkbAllXIIds is used to get information about all device indicator - # feedbacks without having to list them. - # XkbXINone is used to indicate that no class or id has been specified. - # XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs - # XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells - # XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device - # XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class - # XkbExplicitXIId(c) True if 'i' explicitly specifies a device id - # XkbSingleXIClass(c) True if 'c' specifies exactly one device class, - # including the default. - # XkbSingleXIId(i) True if 'i' specifies exactly one device - # identifier, including the default. - # - -const - XkbUseCoreKbd* = 0x00000100 - XkbUseCorePtr* = 0x00000200 - XkbDfltXIClass* = 0x00000300 - XkbDfltXIId* = 0x00000400 - XkbAllXIClasses* = 0x00000500 - XkbAllXIIds* = 0x00000600 - XkbXINone* = 0x0000FF00 - -proc XkbLegalXILedClass*(c: int): bool -proc XkbLegalXIBellClass*(c: int): bool -proc XkbExplicitXIDevice*(c: int): bool -proc XkbExplicitXIClass*(c: int): bool -proc XkbExplicitXIId*(c: int): bool -proc XkbSingleXIClass*(c: int): bool -proc XkbSingleXIId*(c: int): bool -const - XkbNoModifier* = 0x000000FF - XkbNoShiftLevel* = 0x000000FF - XkbNoShape* = 0x000000FF - XkbNoIndicator* = 0x000000FF - XkbNoModifierMask* = 0 - XkbAllModifiersMask* = 0x000000FF - XkbAllVirtualModsMask* = 0x0000FFFF - XkbNumKbdGroups* = 4 - XkbMaxKbdGroup* = XkbNumKbdGroups - 1 - XkbMaxMouseKeysBtn* = 4 # - # Group Index and Mask: - # - Indices into the kt_index array of a key type. - # - Mask specifies types to be changed for XkbChangeTypesOfKey - # - -const - XkbGroup1Index* = 0 - XkbGroup2Index* = 1 - XkbGroup3Index* = 2 - XkbGroup4Index* = 3 - XkbAnyGroup* = 254 - XkbAllGroups* = 255 - XkbGroup1Mask* = 1 shl 0 - XkbGroup2Mask* = 1 shl 1 - XkbGroup3Mask* = 1 shl 2 - XkbGroup4Mask* = 1 shl 3 - XkbAnyGroupMask* = 1 shl 7 - XkbAllGroupsMask* = 0x0000000F # - # BuildCoreState: Given a keyboard group and a modifier state, - # construct the value to be reported an event. - # GroupForCoreState: Given the state reported in an event, - # determine the keyboard group. - # IsLegalGroup: Returns TRUE if 'g' is a valid group index. - # - -proc XkbBuildCoreState*(m, g: int): int -proc XkbGroupForCoreState*(s: int): int -proc XkbIsLegalGroup*(g: int): bool - # - # GroupsWrap values: - # - The 'groupsWrap' field of an XkbControlsRec specifies the - # treatment of out of range groups. - # - Bits 6 and 7 of the group info field of a key symbol map - # specify the interpretation of out of range groups for the - # corresponding key. - # -const - XkbWrapIntoRange* = 0x00000000 - XkbClampIntoRange* = 0x00000040 - XkbRedirectIntoRange* = 0x00000080 # - # Action flags: Reported in the 'flags' field of most key actions. - # Interpretation depends on the type of the action; not all actions - # accept all flags. - # - # Option Used for Actions - # ------ ---------------- - # ClearLocks SetMods, LatchMods, SetGroup, LatchGroup - # LatchToLock SetMods, LatchMods, SetGroup, LatchGroup - # LockNoLock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn - # LockNoUnlock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn - # UseModMapMods SetMods, LatchMods, LockMods, ISOLock - # GroupAbsolute SetGroup, LatchGroup, LockGroup, ISOLock - # UseDfltButton PtrBtn, LockPtrBtn - # NoAcceleration MovePtr - # MoveAbsoluteX MovePtr - # MoveAbsoluteY MovePtr - # ISODfltIsGroup ISOLock - # ISONoAffectMods ISOLock - # ISONoAffectGroup ISOLock - # ISONoAffectPtr ISOLock - # ISONoAffectCtrls ISOLock - # MessageOnPress ActionMessage - # MessageOnRelease ActionMessage - # MessageGenKeyEvent ActionMessage - # AffectDfltBtn SetPtrDflt - # DfltBtnAbsolute SetPtrDflt - # SwitchApplication SwitchScreen - # SwitchAbsolute SwitchScreen - # - -const - XkbSA_ClearLocks* = int(1) shl 0 - XkbSA_LatchToLock* = int(1) shl 1 - XkbSA_LockNoLock* = int(1) shl 0 - XkbSA_LockNoUnlock* = int(1) shl 1 - XkbSA_UseModMapMods* = int(1) shl 2 - XkbSA_GroupAbsolute* = int(1) shl 2 - XkbSA_UseDfltButton* = 0 - XkbSA_NoAcceleration* = int(1) shl 0 - XkbSA_MoveAbsoluteX* = int(1) shl 1 - XkbSA_MoveAbsoluteY* = int(1) shl 2 - XkbSA_ISODfltIsGroup* = int(1) shl 7 - XkbSA_ISONoAffectMods* = int(1) shl 6 - XkbSA_ISONoAffectGroup* = int(1) shl 5 - XkbSA_ISONoAffectPtr* = int(1) shl 4 - XkbSA_ISONoAffectCtrls* = int(1) shl 3 - XkbSA_ISOAffectMask* = 0x00000078 - XkbSA_MessageOnPress* = int(1) shl 0 - XkbSA_MessageOnRelease* = int(1) shl 1 - XkbSA_MessageGenKeyEvent* = int(1) shl 2 - XkbSA_AffectDfltBtn* = 1 - XkbSA_DfltBtnAbsolute* = int(1) shl 2 - XkbSA_SwitchApplication* = int(1) shl 0 - XkbSA_SwitchAbsolute* = int(1) shl 2 # - # The following values apply to the SA_DeviceValuator - # action only. Valuator operations specify the action - # to be taken. Values specified in the action are - # multiplied by 2^scale before they are applied. - # - -const - XkbSA_IgnoreVal* = 0x00000000 - XkbSA_SetValMin* = 0x00000010 - XkbSA_SetValCenter* = 0x00000020 - XkbSA_SetValMax* = 0x00000030 - XkbSA_SetValRelative* = 0x00000040 - XkbSA_SetValAbsolute* = 0x00000050 - XkbSA_ValOpMask* = 0x00000070 - XkbSA_ValScaleMask* = 0x00000007 - -proc XkbSA_ValOp*(a: int): int -proc XkbSA_ValScale*(a: int): int - # - # Action types: specifies the type of a key action. Reported in the - # type field of all key actions. - # -const - XkbSA_NoAction* = 0x00000000 - XkbSA_SetMods* = 0x00000001 - XkbSA_LatchMods* = 0x00000002 - XkbSA_LockMods* = 0x00000003 - XkbSA_SetGroup* = 0x00000004 - XkbSA_LatchGroup* = 0x00000005 - XkbSA_LockGroup* = 0x00000006 - XkbSA_MovePtr* = 0x00000007 - XkbSA_PtrBtn* = 0x00000008 - XkbSA_LockPtrBtn* = 0x00000009 - XkbSA_SetPtrDflt* = 0x0000000A - XkbSA_ISOLock* = 0x0000000B - XkbSA_Terminate* = 0x0000000C - XkbSA_SwitchScreen* = 0x0000000D - XkbSA_SetControls* = 0x0000000E - XkbSA_LockControls* = 0x0000000F - XkbSA_ActionMessage* = 0x00000010 - XkbSA_RedirectKey* = 0x00000011 - XkbSA_DeviceBtn* = 0x00000012 - XkbSA_LockDeviceBtn* = 0x00000013 - XkbSA_DeviceValuator* = 0x00000014 - XkbSA_LastAction* = XkbSA_DeviceValuator - XkbSA_NumActions* = XkbSA_LastAction + 1 - -const - XkbSA_XFree86Private* = 0x00000086 -# -# Specifies the key actions that clear latched groups or modifiers. -# - -const ##define XkbSA_BreakLatch \ - # ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\ - # (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\ - # (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\ - # (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn)) - # - XkbSA_BreakLatch* = (1 shl XkbSA_PtrBtn) or (1 shl XkbSA_LockPtrBtn) or - (1 shl XkbSA_Terminate) or (1 shl XkbSA_SwitchScreen) or - (1 shl XkbSA_SetControls) or (1 shl XkbSA_LockControls) or - (1 shl XkbSA_ActionMessage) or (1 shl XkbSA_RedirectKey) or - (1 shl XkbSA_DeviceBtn) or (1 shl XkbSA_LockDeviceBtn) # - # Key Behavior Qualifier: - # KB_Permanent indicates that the behavior describes an unalterable - # characteristic of the keyboard, not an XKB software-simulation of - # the listed behavior. - # Key Behavior Types: - # Specifies the behavior of the underlying key. - # - -const - XkbKB_Permanent* = 0x00000080 - XkbKB_OpMask* = 0x0000007F - XkbKB_Default* = 0x00000000 - XkbKB_Lock* = 0x00000001 - XkbKB_RadioGroup* = 0x00000002 - XkbKB_Overlay1* = 0x00000003 - XkbKB_Overlay2* = 0x00000004 - XkbKB_RGAllowNone* = 0x00000080 # - # Various macros which describe the range of legal keycodes. - # - -const - XkbMinLegalKeyCode* = 8 - XkbMaxLegalKeyCode* = 255 - XkbMaxKeyCount* = XkbMaxLegalKeyCode - XkbMinLegalKeyCode + 1 - XkbPerKeyBitArraySize* = (XkbMaxLegalKeyCode + 1) div 8 - -proc XkbIsLegalKeycode*(k: int): bool -type - PXkbControlsPtr* = ptr TXkbControlsRec - TXkbControlsRec*{.final.} = object - mk_dflt_btn*: int8 - num_groups*: int8 - groups_wrap*: int8 - internal*: TXkbModsRec - ignore_lock*: TXkbModsRec - enabled_ctrls*: int16 - repeat_delay*: int16 - repeat_interval*: int16 - slow_keys_delay*: int16 - debounce_delay*: int16 - mk_delay*: int16 - mk_interval*: int16 - mk_time_to_max*: int16 - mk_max_speed*: int16 - mk_curve*: int16 - ax_options*: int16 - ax_timeout*: int16 - axt_opts_mask*: int16 - axt_opts_values*: int16 - axt_ctrls_mask*: int16 - axt_ctrls_values*: int16 - per_key_repeat*: array[0..XkbPerKeyBitArraySize - 1, int8] - - -proc XkbAX_AnyFeedback*(c: PXkbControlsPtr): int16 -proc XkbAX_NeedOption*(c: PXkbControlsPtr, w: int16): int16 -proc XkbAX_NeedFeedback*(c: PXkbControlsPtr, w: int16): bool - # - # Assorted constants and limits. - # -const - XkbNumModifiers* = 8 - XkbNumVirtualMods* = 16 - XkbNumIndicators* = 32 - XkbMaxRadioGroups* = 32 - XkbAllRadioGroupsMask* = 0xFFFFFFFF - XkbMaxShiftLevel* = 63 - XkbMaxSymsPerKey* = XkbMaxShiftLevel * XkbNumKbdGroups - XkbRGMaxMembers* = 12 - XkbActionMessageLength* = 6 - XkbKeyNameLength* = 4 - XkbMaxRedirectCount* = 8 - XkbGeomPtsPerMM* = 10 - XkbGeomMaxColors* = 32 - XkbGeomMaxLabelColors* = 3 - XkbGeomMaxPriority* = 255 - -type - PXkbServerMapPtr* = ptr TXkbServerMapRec - TXkbServerMapRec*{.final.} = object - num_acts*: int16 - size_acts*: int16 - acts*: ptr array[0..0xfff, TXkbAction] - behaviors*: PXkbBehavior - key_acts*: PWord - explicit*: PByte - vmods*: array[0..XkbNumVirtualMods - 1, int8] - vmodmap*: PWord - - -proc XkbSMKeyActionsPtr*(m: PXkbServerMapPtr, k: int16): PXkbAction - # - # Structures and access macros used primarily by clients - # -type - PXkbSymMapPtr* = ptr TXkbSymMapRec - TXkbSymMapRec*{.final.} = object - kt_index*: array[0..XkbNumKbdGroups - 1, int8] - group_info*: int8 - width*: int8 - offset*: int8 - - -type - PXkbClientMapPtr* = ptr TXkbClientMapRec - TXkbClientMapRec*{.final.} = object - size_types*: int8 - num_types*: int8 - types*: ptr array[0..0xffff, TXkbKeyTypeRec] - size_syms*: int16 - num_syms*: int16 - syms*: ptr array[0..0xffff, TKeySym] - key_sym_map*: ptr array[0..0xffff, TXkbSymMapRec] - modmap*: PByte - - -proc XkbCMKeyGroupInfo*(m: PXkbClientMapPtr, k: int16): int8 -proc XkbCMKeyNumGroups*(m: PXkbClientMapPtr, k: int16): int8 -proc XkbCMKeyGroupWidth*(m: PXkbClientMapPtr, k: int16, g: int8): int8 -proc XkbCMKeyGroupsWidth*(m: PXkbClientMapPtr, k: int16): int8 -proc XkbCMKeyTypeIndex*(m: PXkbClientMapPtr, k: int16, g: int8): int8 -proc XkbCMKeyType*(m: PXkbClientMapPtr, k: int16, g: int8): PXkbKeyTypePtr -proc XkbCMKeyNumSyms*(m: PXkbClientMapPtr, k: int16): int16 -proc XkbCMKeySymsOffset*(m: PXkbClientMapPtr, k: int16): int8 - # - # Compatibility structures and access macros - # -type - PXkbSymInterpretPtr* = ptr TXkbSymInterpretRec - TXkbSymInterpretRec*{.final.} = object - sym*: TKeySym - flags*: int8 - match*: int8 - mods*: int8 - virtual_mod*: int8 - act*: TXkbAnyAction - - -type - PXkbCompatMapPtr* = ptr TXkbCompatMapRec - TXkbCompatMapRec*{.final.} = object - sym_interpret*: PXkbSymInterpretPtr - groups*: array[0..XkbNumKbdGroups - 1, TXkbModsRec] - num_si*: int16 - size_si*: int16 - - -type - PXkbIndicatorMapPtr* = ptr TXkbIndicatorMapRec - TXkbIndicatorMapRec*{.final.} = object - flags*: int8 - which_groups*: int8 - groups*: int8 - which_mods*: int8 - mods*: TXkbModsRec - ctrls*: int16 - - -proc XkbIM_IsAuto*(i: PXkbIndicatorMapPtr): bool -proc XkbIM_InUse*(i: PXkbIndicatorMapPtr): bool -type - PXkbIndicatorPtr* = ptr TXkbIndicatorRec - TXkbIndicatorRec*{.final.} = object - phys_indicators*: int32 - maps*: array[0..XkbNumIndicators - 1, TXkbIndicatorMapRec] - - -type - PXkbKeyNamePtr* = ptr TXkbKeyNameRec - TXkbKeyNameRec*{.final.} = object - name*: array[0..XkbKeyNameLength - 1, Char] - - -type - PXkbKeyAliasPtr* = ptr TXkbKeyAliasRec - TXkbKeyAliasRec*{.final.} = object # - # Names for everything - # - float*: array[0..XkbKeyNameLength - 1, Char] - alias*: array[0..XkbKeyNameLength - 1, Char] - - -type - PXkbNamesPtr* = ptr TXkbNamesRec - TXkbNamesRec*{.final.} = object # - # Key Type index and mask for the four standard key types. - # - keycodes*: TAtom - geometry*: TAtom - symbols*: TAtom - types*: TAtom - compat*: TAtom - vmods*: array[0..XkbNumVirtualMods - 1, TAtom] - indicators*: array[0..XkbNumIndicators - 1, TAtom] - groups*: array[0..XkbNumKbdGroups - 1, TAtom] - keys*: PXkbKeyNamePtr - key_aliases*: PXkbKeyAliasPtr - radio_groups*: PAtom - phys_symbols*: TAtom - num_keys*: int8 - num_key_aliases*: int8 - num_rg*: int16 - - -const - XkbOneLevelIndex* = 0 - XkbTwoLevelIndex* = 1 - XkbAlphabeticIndex* = 2 - XkbKeypadIndex* = 3 - XkbLastRequiredType* = XkbKeypadIndex - XkbNumRequiredTypes* = XkbLastRequiredType + 1 - XkbMaxKeyTypes* = 255 - XkbOneLevelMask* = 1 shl 0 - XkbTwoLevelMask* = 1 shl 1 - XkbAlphabeticMask* = 1 shl 2 - XkbKeypadMask* = 1 shl 3 - XkbAllRequiredTypes* = 0x0000000F - -proc XkbShiftLevel*(n: int8): int8 -proc XkbShiftLevelMask*(n: int8): int8 - # - # Extension name and version information - # -const - XkbName* = "XKEYBOARD" - XkbMajorVersion* = 1 - XkbMinorVersion* = 0 # - # Explicit map components: - # - Used in the 'explicit' field of an XkbServerMap. Specifies - # the keyboard components that should _not_ be updated automatically - # in response to core protocol keyboard mapping requests. - # - -const - XkbExplicitKeyTypesMask* = 0x0000000F - XkbExplicitKeyType1Mask* = 1 shl 0 - XkbExplicitKeyType2Mask* = 1 shl 1 - XkbExplicitKeyType3Mask* = 1 shl 2 - XkbExplicitKeyType4Mask* = 1 shl 3 - XkbExplicitInterpretMask* = 1 shl 4 - XkbExplicitAutoRepeatMask* = 1 shl 5 - XkbExplicitBehaviorMask* = 1 shl 6 - XkbExplicitVModMapMask* = 1 shl 7 - XkbAllExplicitMask* = 0x000000FF # - # Symbol interpretations flags: - # - Used in the flags field of a symbol interpretation - # - -const - XkbSI_AutoRepeat* = 1 shl 0 - XkbSI_LockingKey* = 1 shl 1 # - # Symbol interpretations match specification: - # - Used in the match field of a symbol interpretation to specify - # the conditions under which an interpretation is used. - # - -const - XkbSI_LevelOneOnly* = 0x00000080 - XkbSI_OpMask* = 0x0000007F - XkbSI_NoneOf* = 0 - XkbSI_AnyOfOrNone* = 1 - XkbSI_AnyOf* = 2 - XkbSI_AllOf* = 3 - XkbSI_Exactly* = 4 # - # Indicator map flags: - # - Used in the flags field of an indicator map to indicate the - # conditions under which and indicator can be changed and the - # effects of changing the indicator. - # - -const - XkbIM_NoExplicit* = int(1) shl 7 - XkbIM_NoAutomatic* = int(1) shl 6 - XkbIM_LEDDrivesKB* = int(1) shl 5 # - # Indicator map component specifications: - # - Used by the 'which_groups' and 'which_mods' fields of an indicator - # map to specify which keyboard components should be used to drive - # the indicator. - # - -const - XkbIM_UseBase* = int(1) shl 0 - XkbIM_UseLatched* = int(1) shl 1 - XkbIM_UseLocked* = int(1) shl 2 - XkbIM_UseEffective* = int(1) shl 3 - XkbIM_UseCompat* = int(1) shl 4 - XkbIM_UseNone* = 0 - XkbIM_UseAnyGroup* = XkbIM_UseBase or XkbIM_UseLatched or XkbIM_UseLocked or - XkbIM_UseEffective - XkbIM_UseAnyMods* = XkbIM_UseAnyGroup or XkbIM_UseCompat # - # GetByName components: - # - Specifies desired or necessary components to GetKbdByName request. - # - Reports the components that were found in a GetKbdByNameReply - # - -const - XkbGBN_TypesMask* = int(1) shl 0 - XkbGBN_CompatMapMask* = int(1) shl 1 - XkbGBN_ClientSymbolsMask* = int(1) shl 2 - XkbGBN_ServerSymbolsMask* = int(1) shl 3 - XkbGBN_SymbolsMask* = XkbGBN_ClientSymbolsMask or XkbGBN_ServerSymbolsMask - XkbGBN_IndicatorMapMask* = int(1) shl 4 - XkbGBN_KeyNamesMask* = int(1) shl 5 - XkbGBN_GeometryMask* = int(1) shl 6 - XkbGBN_OtherNamesMask* = int(1) shl 7 - XkbGBN_AllComponentsMask* = 0x000000FF # - # ListComponents flags - # - -const - XkbLC_Hidden* = int(1) shl 0 - XkbLC_Default* = int(1) shl 1 - XkbLC_Partial* = int(1) shl 2 - XkbLC_AlphanumericKeys* = int(1) shl 8 - XkbLC_ModifierKeys* = int(1) shl 9 - XkbLC_KeypadKeys* = int(1) shl 10 - XkbLC_FunctionKeys* = int(1) shl 11 - XkbLC_AlternateGroup* = int(1) shl 12 # - # X Input Extension Interactions - # - Specifies the possible interactions between XKB and the X input - # extension - # - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) - # XKB information about an extension device. - # - Reports the list of supported optional features in the reply to - # XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. - # XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify - # events to indicate an attempt to use an unsupported feature. - # - -const - XkbXI_KeyboardsMask* = int(1) shl 0 - XkbXI_ButtonActionsMask* = int(1) shl 1 - XkbXI_IndicatorNamesMask* = int(1) shl 2 - XkbXI_IndicatorMapsMask* = int(1) shl 3 - XkbXI_IndicatorStateMask* = int(1) shl 4 - XkbXI_UnsupportedFeatureMask* = int(1) shl 15 - XkbXI_AllFeaturesMask* = 0x0000001F - XkbXI_AllDeviceFeaturesMask* = 0x0000001E - XkbXI_IndicatorsMask* = 0x0000001C - XkbAllExtensionDeviceEventsMask* = 0x0000801F # - # Per-Client Flags: - # - Specifies flags to be changed by the PerClientFlags request. - # - -const - XkbPCF_DetectableAutoRepeatMask* = int(1) shl 0 - XkbPCF_GrabsUseXKBStateMask* = int(1) shl 1 - XkbPCF_AutoResetControlsMask* = int(1) shl 2 - XkbPCF_LookupStateWhenGrabbed* = int(1) shl 3 - XkbPCF_SendEventUsesXKBState* = int(1) shl 4 - XkbPCF_AllFlagsMask* = 0x0000001F # - # Debugging flags and controls - # - -const - XkbDF_DisableLocks* = 1 shl 0 - -type - PXkbPropertyPtr* = ptr TXkbPropertyRec - TXkbPropertyRec*{.final.} = object - name*: cstring - value*: cstring - - -type - PXkbColorPtr* = ptr TXkbColorRec - TXkbColorRec*{.final.} = object - pixel*: int16 - spec*: cstring - - -type - PXkbPointPtr* = ptr TXkbPointRec - TXkbPointRec*{.final.} = object - x*: int16 - y*: int16 - - -type - PXkbBoundsPtr* = ptr TXkbBoundsRec - TXkbBoundsRec*{.final.} = object - x1*: int16 - y1*: int16 - x2*: int16 - y2*: int16 - - -proc XkbBoundsWidth*(b: PXkbBoundsPtr): int16 -proc XkbBoundsHeight*(b: PXkbBoundsPtr): int16 -type - PXkbOutlinePtr* = ptr TXkbOutlineRec - TXkbOutlineRec*{.final.} = object - num_points*: int16 - sz_points*: int16 - corner_radius*: int16 - points*: PXkbPointPtr - - -type - PXkbShapePtr* = ptr TXkbShapeRec - TXkbShapeRec*{.final.} = object - name*: TAtom - num_outlines*: int16 - sz_outlines*: int16 - outlines*: ptr array [0..0xffff, TXkbOutlineRec] - approx*: ptr array[0..0xffff, TXkbOutlineRec] - primary*: ptr array[0..0xffff, TXkbOutlineRec] - bounds*: TXkbBoundsRec - - -proc XkbOutlineIndex*(s: PXkbShapePtr, o: PXkbOutlinePtr): int32 -type - PXkbShapeDoodadPtr* = ptr TXkbShapeDoodadRec - TXkbShapeDoodadRec*{.final.} = object - name*: TAtom - theType*: int8 - priority*: int8 - top*: int16 - left*: int16 - angle*: int16 - color_ndx*: int16 - shape_ndx*: int16 - - -type - PXkbTextDoodadPtr* = ptr TXkbTextDoodadRec - TXkbTextDoodadRec*{.final.} = object - name*: TAtom - theType*: int8 - priority*: int8 - top*: int16 - left*: int16 - angle*: int16 - width*: int16 - height*: int16 - color_ndx*: int16 - text*: cstring - font*: cstring - - -type - PXkbIndicatorDoodadPtr* = ptr TXkbIndicatorDoodadRec - TXkbIndicatorDoodadRec*{.final.} = object - name*: TAtom - theType*: int8 - priority*: int8 - top*: int16 - left*: int16 - angle*: int16 - shape_ndx*: int16 - on_color_ndx*: int16 - off_color_ndx*: int16 - - -type - PXkbLogoDoodadPtr* = ptr TXkbLogoDoodadRec - TXkbLogoDoodadRec*{.final.} = object - name*: TAtom - theType*: int8 - priority*: int8 - top*: int16 - left*: int16 - angle*: int16 - color_ndx*: int16 - shape_ndx*: int16 - logo_name*: cstring - - -type - PXkbAnyDoodadPtr* = ptr TXkbAnyDoodadRec - TXkbAnyDoodadRec*{.final.} = object - name*: TAtom - theType*: int8 - priority*: int8 - top*: int16 - left*: int16 - angle*: int16 - - -type - PXkbDoodadPtr* = ptr TXkbDoodadRec - TXkbDoodadRec*{.final.} = object - any*: TXkbAnyDoodadRec - shape*: TXkbShapeDoodadRec - text*: TXkbTextDoodadRec - indicator*: TXkbIndicatorDoodadRec - logo*: TXkbLogoDoodadRec - - -const - XkbUnknownDoodad* = 0 - XkbOutlineDoodad* = 1 - XkbSolidDoodad* = 2 - XkbTextDoodad* = 3 - XkbIndicatorDoodad* = 4 - XkbLogoDoodad* = 5 - -type - PXkbKeyPtr* = ptr TXkbKeyRec - TXkbKeyRec*{.final.} = object - name*: TXkbKeyNameRec - gap*: int16 - shape_ndx*: int8 - color_ndx*: int8 - - -type - PXkbRowPtr* = ptr TXkbRowRec - TXkbRowRec*{.final.} = object - top*: int16 - left*: int16 - num_keys*: int16 - sz_keys*: int16 - vertical*: int16 - Keys*: PXkbKeyPtr - bounds*: TXkbBoundsRec - - -type - PXkbOverlayPtr* = ptr TXkbOverlayRec #forward for TXkbSectionRec use. - #Do not add more "type" - PXkbSectionPtr* = ptr TXkbSectionRec - TXkbSectionRec*{.final.} = object #Do not add more "type" - name*: TAtom - priority*: int8 - top*: int16 - left*: int16 - width*: int16 - height*: int16 - angle*: int16 - num_rows*: int16 - num_doodads*: int16 - num_overlays*: int16 - rows*: PXkbRowPtr - doodads*: PXkbDoodadPtr - bounds*: TXkbBoundsRec - overlays*: PXkbOverlayPtr - - PXkbOverlayKeyPtr* = ptr TXkbOverlayKeyRec - TXkbOverlayKeyRec*{.final.} = object #Do not add more "type" - over*: TXkbKeyNameRec - under*: TXkbKeyNameRec - - PXkbOverlayRowPtr* = ptr TXkbOverlayRowRec - TXkbOverlayRowRec*{.final.} = object #Do not add more "type" - row_under*: int16 - num_keys*: int16 - sz_keys*: int16 - keys*: PXkbOverlayKeyPtr - - TXkbOverlayRec*{.final.} = object - name*: TAtom - section_under*: PXkbSectionPtr - num_rows*: int16 - sz_rows*: int16 - rows*: PXkbOverlayRowPtr - bounds*: PXkbBoundsPtr - - -type - PXkbGeometryRec* = ptr TXkbGeometryRec - PXkbGeometryPtr* = PXkbGeometryRec - TXkbGeometryRec*{.final.} = object - name*: TAtom - width_mm*: int16 - height_mm*: int16 - label_font*: cstring - label_color*: PXkbColorPtr - base_color*: PXkbColorPtr - sz_properties*: int16 - sz_colors*: int16 - sz_shapes*: int16 - sz_sections*: int16 - sz_doodads*: int16 - sz_key_aliases*: int16 - num_properties*: int16 - num_colors*: int16 - num_shapes*: int16 - num_sections*: int16 - num_doodads*: int16 - num_key_aliases*: int16 - properties*: ptr array[0..0xffff, TXkbPropertyRec] - colors*: ptr array[0..0xffff, TXkbColorRec] - shapes*: ptr array[0..0xffff, TXkbShapeRec] - sections*: ptr array[0..0xffff, TXkbSectionRec] - key_aliases*: ptr array[0..0xffff, TXkbKeyAliasRec] - - -const - XkbGeomPropertiesMask* = 1 shl 0 - XkbGeomColorsMask* = 1 shl 1 - XkbGeomShapesMask* = 1 shl 2 - XkbGeomSectionsMask* = 1 shl 3 - XkbGeomDoodadsMask* = 1 shl 4 - XkbGeomKeyAliasesMask* = 1 shl 5 - XkbGeomAllMask* = 0x0000003F - -type - PXkbGeometrySizesPtr* = ptr TXkbGeometrySizesRec - TXkbGeometrySizesRec*{.final.} = object # - # Tie it all together into one big keyboard description - # - which*: int16 - num_properties*: int16 - num_colors*: int16 - num_shapes*: int16 - num_sections*: int16 - num_doodads*: int16 - num_key_aliases*: int16 - - -type - PXkbDescPtr* = ptr TXkbDescRec - TXkbDescRec*{.final.} = object - dpy*: PDisplay - flags*: int16 - device_spec*: int16 - min_key_code*: TKeyCode - max_key_code*: TKeyCode - ctrls*: PXkbControlsPtr - server*: PXkbServerMapPtr - map*: PXkbClientMapPtr - indicators*: PXkbIndicatorPtr - names*: PXkbNamesPtr - compat*: PXkbCompatMapPtr - geom*: PXkbGeometryPtr - - -proc XkbKeyKeyTypeIndex*(d: PXkbDescPtr, k: int16, g: int8): int8 -proc XkbKeyKeyType*(d: PXkbDescPtr, k: int16, g: int8): PXkbKeyTypePtr -proc XkbKeyGroupWidth*(d: PXkbDescPtr, k: int16, g: int8): int8 -proc XkbKeyGroupsWidth*(d: PXkbDescPtr, k: int16): int8 -proc XkbKeyGroupInfo*(d: PXkbDescPtr, k: int16): int8 -proc XkbKeyNumGroups*(d: PXkbDescPtr, k: int16): int8 -proc XkbKeyNumSyms*(d: PXkbDescPtr, k: int16): int16 -proc XkbKeySym*(d: PXkbDescPtr, k: int16, n: int16): TKeySym -proc XkbKeySymEntry*(d: PXkbDescPtr, k: int16, sl: int16, g: int8): TKeySym -proc XkbKeyAction*(d: PXkbDescPtr, k: int16, n: int16): PXkbAction -proc XkbKeyActionEntry*(d: PXkbDescPtr, k: int16, sl: int16, g: int8): int8 -proc XkbKeyHasActions*(d: PXkbDescPtr, k: int16): bool -proc XkbKeyNumActions*(d: PXkbDescPtr, k: int16): int16 -proc XkbKeyActionsPtr*(d: PXkbDescPtr, k: int16): PXkbAction -proc XkbKeycodeInRange*(d: PXkbDescPtr, k: int16): bool -proc XkbNumKeys*(d: PXkbDescPtr): int8 - # - # The following structures can be used to track changes - # to a keyboard device - # -type - PXkbMapChangesPtr* = ptr TXkbMapChangesRec - TXkbMapChangesRec*{.final.} = object - changed*: int16 - min_key_code*: TKeyCode - max_key_code*: TKeyCode - first_type*: int8 - num_types*: int8 - first_key_sym*: TKeyCode - num_key_syms*: int8 - first_key_act*: TKeyCode - num_key_acts*: int8 - first_key_behavior*: TKeyCode - num_key_behaviors*: int8 - first_key_explicit*: TKeyCode - num_key_explicit*: int8 - first_modmap_key*: TKeyCode - num_modmap_keys*: int8 - first_vmodmap_key*: TKeyCode - num_vmodmap_keys*: int8 - pad*: int8 - vmods*: int16 - - -type - PXkbControlsChangesPtr* = ptr TXkbControlsChangesRec - TXkbControlsChangesRec*{.final.} = object - changed_ctrls*: int16 - enabled_ctrls_changes*: int16 - num_groups_changed*: bool - - -type - PXkbIndicatorChangesPtr* = ptr TXkbIndicatorChangesRec - TXkbIndicatorChangesRec*{.final.} = object - state_changes*: int16 - map_changes*: int16 - - -type - PXkbNameChangesPtr* = ptr TXkbNameChangesRec - TXkbNameChangesRec*{.final.} = object - changed*: int16 - first_type*: int8 - num_types*: int8 - first_lvl*: int8 - num_lvls*: int8 - num_aliases*: int8 - num_rg*: int8 - first_key*: int8 - num_keys*: int8 - changed_vmods*: int16 - changed_indicators*: int32 - changed_groups*: int8 - - -type - PXkbCompatChangesPtr* = ptr TXkbCompatChangesRec - TXkbCompatChangesRec*{.final.} = object - changed_groups*: int8 - first_si*: int16 - num_si*: int16 - - -type - PXkbChangesPtr* = ptr TXkbChangesRec - TXkbChangesRec*{.final.} = object # - # These data structures are used to construct a keymap from - # a set of components or to list components in the server - # database. - # - device_spec*: int16 - state_changes*: int16 - map*: TXkbMapChangesRec - ctrls*: TXkbControlsChangesRec - indicators*: TXkbIndicatorChangesRec - names*: TXkbNameChangesRec - compat*: TXkbCompatChangesRec - - -type - PXkbComponentNamesPtr* = ptr TXkbComponentNamesRec - TXkbComponentNamesRec*{.final.} = object - keymap*: ptr int16 - keycodes*: ptr int16 - types*: ptr int16 - compat*: ptr int16 - symbols*: ptr int16 - geometry*: ptr int16 - - -type - PXkbComponentNamePtr* = ptr TXkbComponentNameRec - TXkbComponentNameRec*{.final.} = object - flags*: int16 - name*: cstring - - -type - PXkbComponentListPtr* = ptr TXkbComponentListRec - TXkbComponentListRec*{.final.} = object # - # The following data structures describe and track changes to a - # non-keyboard extension device - # - num_keymaps*: int16 - num_keycodes*: int16 - num_types*: int16 - num_compat*: int16 - num_symbols*: int16 - num_geometry*: int16 - keymaps*: PXkbComponentNamePtr - keycodes*: PXkbComponentNamePtr - types*: PXkbComponentNamePtr - compat*: PXkbComponentNamePtr - symbols*: PXkbComponentNamePtr - geometry*: PXkbComponentNamePtr - - -type - PXkbDeviceLedInfoPtr* = ptr TXkbDeviceLedInfoRec - TXkbDeviceLedInfoRec*{.final.} = object - led_class*: int16 - led_id*: int16 - phys_indicators*: int16 - maps_present*: int16 - names_present*: int16 - state*: int16 - names*: array[0..XkbNumIndicators - 1, TAtom] - maps*: array[0..XkbNumIndicators - 1, TXkbIndicatorMapRec] - - -type - PXkbDeviceInfoPtr* = ptr TXkbDeviceInfoRec - TXkbDeviceInfoRec*{.final.} = object - name*: cstring - theType*: TAtom - device_spec*: int16 - has_own_state*: bool - supported*: int16 - unsupported*: int16 - num_btns*: int16 - btn_acts*: PXkbAction - sz_leds*: int16 - num_leds*: int16 - dflt_kbd_fb*: int16 - dflt_led_fb*: int16 - leds*: PXkbDeviceLedInfoPtr - - -proc XkbXI_DevHasBtnActs*(d: PXkbDeviceInfoPtr): bool -proc XkbXI_LegalDevBtn*(d: PXkbDeviceInfoPtr, b: int16): bool -proc XkbXI_DevHasLeds*(d: PXkbDeviceInfoPtr): bool -type - PXkbDeviceLedChangesPtr* = ptr TXkbDeviceLedChangesRec - TXkbDeviceLedChangesRec*{.final.} = object - led_class*: int16 - led_id*: int16 - defined*: int16 #names or maps changed - next*: PXkbDeviceLedChangesPtr - - -type - PXkbDeviceChangesPtr* = ptr TXkbDeviceChangesRec - TXkbDeviceChangesRec*{.final.} = object - changed*: int16 - first_btn*: int16 - num_btns*: int16 - leds*: TXkbDeviceLedChangesRec - - -proc XkbShapeDoodadColor*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbColorPtr -proc XkbShapeDoodadShape*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbShapePtr -proc XkbSetShapeDoodadColor*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr, - c: PXkbColorPtr) -proc XkbSetShapeDoodadShape*(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr, - s: PXkbShapePtr) -proc XkbTextDoodadColor*(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr): PXkbColorPtr -proc XkbSetTextDoodadColor*(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr, - c: PXkbColorPtr) -proc XkbIndicatorDoodadShape*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbShapeDoodadPtr -proc XkbIndicatorDoodadOnColor*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr -proc XkbIndicatorDoodadOffColor*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr -proc XkbSetIndicatorDoodadOnColor*(g: PXkbGeometryPtr, - d: PXkbIndicatorDoodadPtr, c: PXkbColorPtr) -proc XkbSetIndicatorDoodadOffColor*(g: PXkbGeometryPtr, - d: PXkbIndicatorDoodadPtr, c: PXkbColorPtr) -proc XkbSetIndicatorDoodadShape*(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr, - s: PXkbShapeDoodadPtr) -proc XkbLogoDoodadColor*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbColorPtr -proc XkbLogoDoodadShape*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbShapeDoodadPtr -proc XkbSetLogoDoodadColor*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr, - c: PXkbColorPtr) -proc XkbSetLogoDoodadShape*(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr, - s: PXkbShapeDoodadPtr) -proc XkbKeyShape*(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbShapeDoodadPtr -proc XkbKeyColor*(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbColorPtr -proc XkbSetKeyShape*(g: PXkbGeometryPtr, k: PXkbKeyPtr, s: PXkbShapeDoodadPtr) -proc XkbSetKeyColor*(g: PXkbGeometryPtr, k: PXkbKeyPtr, c: PXkbColorPtr) -proc XkbGeomColorIndex*(g: PXkbGeometryPtr, c: PXkbColorPtr): int32 -proc XkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring, value: cstring): PXkbPropertyPtr{. - libx11c, importc: "XkbAddGeomProperty".} -proc XkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{. - libx11c, importc: "XkbAddGeomKeyAlias".} -proc XkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{. - libx11c, importc: "XkbAddGeomColor".} -proc XkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{. - libx11c, importc: "XkbAddGeomOutline".} -proc XkbAddGeomShape*(geom: PXkbGeometryPtr, name: TAtom, sz_outlines: int16): PXkbShapePtr{. - libx11c, importc: "XkbAddGeomShape".} -proc XkbAddGeomKey*(row: PXkbRowPtr): PXkbKeyPtr{.libx11c, - importc: "XkbAddGeomKey".} -proc XkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.libx11c, importc: "XkbAddGeomRow".} -proc XkbAddGeomSection*(geom: PXkbGeometryPtr, name: TAtom, sz_rows: int16, - sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{. - libx11c, importc: "XkbAddGeomSection".} -proc XkbAddGeomOverlay*(section: PXkbSectionPtr, name: TAtom, sz_rows: int16): PXkbOverlayPtr{. - libx11c, importc: "XkbAddGeomOverlay".} -proc XkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16, - sz_keys: int16): PXkbOverlayRowPtr{.libx11c, importc: "XkbAddGeomOverlayRow".} -proc XkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr, - over: cstring, under: cstring): PXkbOverlayKeyPtr{. - libx11c, importc: "XkbAddGeomOverlayKey".} -proc XkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr, - name: TAtom): PXkbDoodadPtr{.libx11c, - importc: "XkbAddGeomDoodad".} -proc XkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomKeyAliases".} -proc XkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomColors".} -proc XkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16, freeAll: bool){. - libx11c, importc: "XkbFreeGeomDoodads".} -proc XkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomProperties".} -proc XkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomOverlayKeys".} -proc XkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayRows".} -proc XkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomOverlays".} -proc XkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16, freeAll: bool){. - libx11c, importc: "XkbFreeGeomKeys".} -proc XkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomRows".} -proc XkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomSections".} -proc XkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomPoints".} -proc XkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomOutlines".} -proc XkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomShapes".} -proc XkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){. - libx11c, importc: "XkbFreeGeometry".} -proc XkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): TStatus{.libx11c, importc: "XkbAllocGeomProps".} -proc XkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): TStatus{. - libx11c, importc: "XkbAllocGeomKeyAliases".} -proc XkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): TStatus{.libx11c, importc: "XkbAllocGeomColors".} -proc XkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): TStatus{.libx11c, importc: "XkbAllocGeomShapes".} -proc XkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): TStatus{. - libx11c, importc: "XkbAllocGeomSections".} -proc XkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOverlays".} -proc XkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOverlayRows".} -proc XkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOverlayKeys".} -proc XkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): TStatus{. - libx11c, importc: "XkbAllocGeomDoodads".} -proc XkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): TStatus{. - libx11c, importc: "XkbAllocGeomSectionDoodads".} -proc XkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): TStatus{.libx11c, importc: "XkbAllocGeomOutlines".} -proc XkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): TStatus{.libx11c, importc: "XkbAllocGeomRows".} -proc XkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): TStatus{.libx11c, importc: "XkbAllocGeomPoints".} -proc XkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): TStatus{.libx11c, importc: "XkbAllocGeomKeys".} -proc XkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): TStatus{. - libx11c, importc: "XkbAllocGeometry".} -proc XkbSetGeometryProc*(dpy: PDisplay, deviceSpec: int16, geom: PXkbGeometryPtr): TStatus{. - libx11c, importc: "XkbSetGeometry".} -proc XkbComputeShapeTop*(shape: PXkbShapePtr, bounds: PXkbBoundsPtr): bool{. - libx11c, importc: "XkbComputeShapeTop".} -proc XkbComputeShapeBounds*(shape: PXkbShapePtr): bool{.libx11c, - importc: "XkbComputeShapeBounds".} -proc XkbComputeRowBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr, - row: PXkbRowPtr): bool{.libx11c, - importc: "XkbComputeRowBounds".} -proc XkbComputeSectionBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr): bool{. - libx11c, importc: "XkbComputeSectionBounds".} -proc XkbFindOverlayForKey*(geom: PXkbGeometryPtr, wanted: PXkbSectionPtr, - under: cstring): cstring{.libx11c, - importc: "XkbFindOverlayForKey".} -proc XkbGetGeometryProc*(dpy: PDisplay, xkb: PXkbDescPtr): TStatus{.libx11c, importc: "XkbGetGeometry".} -proc XkbGetNamedGeometry*(dpy: PDisplay, xkb: PXkbDescPtr, name: TAtom): TStatus{. - libx11c, importc: "XkbGetNamedGeometry".} -when defined(XKB_IN_SERVER): - proc SrvXkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring, - float: cstring): PXkbKeyAliasPtr{.libx11c, importc: "XkbAddGeomKeyAlias".} - proc SrvXkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{. - libx11c, importc: "XkbAddGeomColor".} - proc SrvXkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr, - name: TAtom): PXkbDoodadPtr{.libx11c, - importc: "XkbAddGeomDoodad".} - proc SrvXkbAddGeomKey*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{. - libx11c, importc: "XkbAddGeomKeyAlias".} - proc SrvXkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{. - libx11c, importc: "XkbAddGeomOutline".} - proc SrvXkbAddGeomOverlay*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr, - over: cstring, under: cstring): PXkbOverlayKeyPtr{. - libx11c, importc: "XkbAddGeomOverlayKey".} - proc SrvXkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16, - sz_keys: int16): PXkbOverlayRowPtr{.libx11c, importc: "XkbAddGeomOverlayRow".} - proc SrvXkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr, - over: cstring, under: cstring): PXkbOverlayKeyPtr{. - libx11c, importc: "XkbAddGeomOverlayKey".} - proc SrvXkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring, - value: cstring): PXkbPropertyPtr{.libx11c, importc: "XkbAddGeomProperty".} - proc SrvXkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{. - libx11c, importc: "XkbAddGeomRow".} - proc SrvXkbAddGeomSection*(geom: PXkbGeometryPtr, name: TAtom, sz_rows: int16, - sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{. - libx11c, importc: "XkbAddGeomSection".} - proc SrvXkbAddGeomShape*(geom: PXkbGeometryPtr, name: TAtom, - sz_outlines: int16): PXkbShapePtr{.libx11c, importc: "XkbAddGeomShape".} - proc SrvXkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): TStatus{. - libx11c, importc: "XkbAllocGeomKeyAliases".} - proc SrvXkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): TStatus{. - libx11c, importc: "XkbAllocGeomColors".} - proc SrvXkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): TStatus{. - libx11c, importc: "XkbAllocGeomDoodads".} - proc SrvXkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): TStatus{.libx11c, importc: "XkbAllocGeomKeys".} - proc SrvXkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOutlines".} - proc SrvXkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): TStatus{.libx11c, importc: "XkbAllocGeomPoints".} - proc SrvXkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): TStatus{. - libx11c, importc: "XkbAllocGeomProps".} - proc SrvXkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): TStatus{. - libx11c, importc: "XkbAllocGeomRows".} - proc SrvXkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): TStatus{. - libx11c, importc: "XkbAllocGeomSectionDoodads".} - proc SrvXkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): TStatus{. - libx11c, importc: "XkbAllocGeomSections".} - proc SrvXkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOverlays".} - proc SrvXkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOverlayRows".} - proc SrvXkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): TStatus{. - libx11c, importc: "XkbAllocGeomOverlayKeys".} - proc SrvXkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): TStatus{. - libx11c, importc: "XkbAllocGeomShapes".} - proc SrvXkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): TStatus{. - libx11c, importc: "XkbAllocGeometry".} - proc SrvXkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomKeyAliases".} - proc SrvXkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomColors".} - proc SrvXkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomDoodads".} - proc SrvXkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomProperties".} - proc SrvXkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayKeys".} - proc SrvXkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayRows".} - proc SrvXkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlays".} - proc SrvXkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomKeys".} - proc SrvXkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomRows".} - proc SrvXkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomSections".} - proc SrvXkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16, - count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomPoints".} - proc SrvXkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomOutlines".} - proc SrvXkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16, - freeAll: bool){.libx11c, - importc: "XkbFreeGeomShapes".} - proc SrvXkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){. - libx11c, importc: "XkbFreeGeometry".} -# implementation - -import #************************************ xkb ************************************ - xi - -proc XkbLegalXILedClass(c: int): bool = - ##define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||((c)==LedFeedbackClass)|| - # ((c)==XkbDfltXIClass)||((c)==XkbAllXIClasses)) - Result = (c == KbdFeedbackClass) or (c == LedFeedbackClass) or - (c == XkbDfltXIClass) or (c == XkbAllXIClasses) - -proc XkbLegalXIBellClass(c: int): bool = - ##define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||((c)==BellFeedbackClass)|| - # ((c)==XkbDfltXIClass)||((c)==XkbAllXIClasses)) - Result = (c == KbdFeedbackClass) or (c == BellFeedbackClass) or - (c == XkbDfltXIClass) or (c == XkbAllXIClasses) - -proc XkbExplicitXIDevice(c: int): bool = - ##define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) - Result = (c and (not 0x000000FF)) == 0 - -proc XkbExplicitXIClass(c: int): bool = - ##define XkbExplicitXIClass(c) (((c)&(~0xff))==0) - Result = (c and (not 0x000000FF)) == 0 - -proc XkbExplicitXIId(c: int): bool = - ##define XkbExplicitXIId(c) (((c)&(~0xff))==0) - Result = (c and (not 0x000000FF)) == 0 - -proc XkbSingleXIClass(c: int): bool = - ##define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) - Result = ((c and (not 0x000000FF)) == 0) or (c == XkbDfltXIClass) - -proc XkbSingleXIId(c: int): bool = - ##define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) - Result = ((c and (not 0x000000FF)) == 0) or (c == XkbDfltXIId) - -proc XkbBuildCoreState(m, g: int): int = - ##define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) - Result = ((g and 0x00000003) shl 13) or (m and 0x000000FF) - -proc XkbGroupForCoreState(s: int): int = - ##define XkbGroupForCoreState(s) (((s)>>13)&0x3) - Result = (s shr 13) and 0x00000003 - -proc XkbIsLegalGroup(g: int): bool = - ##define XkbIsLegalGroup(g) (((g)>=0)&&((g)<XkbNumKbdGroups)) - Result = (g >= 0) and (g < XkbNumKbdGroups) - -proc XkbSA_ValOp(a: int): int = - ##define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask) - Result = a and XkbSA_ValOpMask - -proc XkbSA_ValScale(a: int): int = - ##define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask) - Result = a and XkbSA_ValScaleMask - -proc XkbIsModAction(a: PXkbAnyAction): bool = - ##define XkbIsModAction(a) (((a)->type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) - Result = (ze(a.theType) >= XkbSA_SetMods) and (ze(a.theType) <= XkbSA_LockMods) - -proc XkbIsGroupAction(a: PXkbAnyAction): bool = - ##define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) - Result = (ze(a.theType) >= XkbSA_SetGroup) or (ze(a.theType) <= XkbSA_LockGroup) - -proc XkbIsPtrAction(a: PXkbAnyAction): bool = - ##define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) - Result = (ze(a.theType) >= XkbSA_MovePtr) and - (ze(a.theType) <= XkbSA_SetPtrDflt) - -proc XkbIsLegalKeycode(k: int): bool = - ##define XkbIsLegalKeycode(k) (((k)>=XkbMinLegalKeyCode)&&((k)<=XkbMaxLegalKeyCode)) - Result = (k >= XkbMinLegalKeyCode) and (k <= XkbMaxLegalKeyCode) - -proc XkbShiftLevel(n: int8): int8 = - ##define XkbShiftLevel(n) ((n)-1) - Result = n - 1'i8 - -proc XkbShiftLevelMask(n: int8): int8 = - ##define XkbShiftLevelMask(n) (1<<((n)-1)) - Result = 1'i8 shl (n - 1'i8) - -proc XkbCharToInt(v: int8): int16 = - ##define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) - if ((v and 0x80'i8) != 0'i8): Result = v or (not 0xFF'i16) - else: Result = int16(v and 0x7F'i8) - -proc XkbIntTo2Chars(i: int16, h, L: var int8) = - ##define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) - h = toU8((i shr 8'i16) and 0x00FF'i16) - L = toU8(i and 0xFF'i16) - -proc Xkb2CharsToInt(h, L: int8): int16 = - when defined(cpu64): - ##define Xkb2CharsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)): (int)(((h)<<8)|(l)&0x7fff)) - if (h and 0x80'i8) != 0'i8: - Result = toU16((ze(h) shl 8) or ze(L) or not 0x0000FFFF) - else: - Result = toU16((ze(h) shl 8) or ze(L) and 0x00007FFF) - else: - ##define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) - Result = toU16(ze(h) shl 8 or ze(L)) - -proc XkbModLocks(s: PXkbStatePtr): int8 = - ##define XkbModLocks(s) ((s)->locked_mods) - Result = s.locked_mods - -proc XkbStateMods(s: PXkbStatePtr): int16 = - ##define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) - Result = s.base_mods or s.latched_mods or XkbModLocks(s) - -proc XkbGroupLock(s: PXkbStatePtr): int8 = - ##define XkbGroupLock(s) ((s)->locked_group) - Result = s.locked_group - -proc XkbStateGroup(s: PXkbStatePtr): int16 = - ##define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) - Result = S.base_group + (s.latched_group) + XkbGroupLock(s) - -proc XkbStateFieldFromRec(s: PXkbStatePtr): int = - ##define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) - Result = XkbBuildCoreState(s.lookup_mods, s.group) - -proc XkbGrabStateFromRec(s: PXkbStatePtr): int = - ##define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) - Result = XkbBuildCoreState(s.grab_mods, s.group) - -proc XkbNumGroups(g: int16): int16 = - ##define XkbNumGroups(g) ((g)&0x0f) - Result = g and 0x0000000F'i16 - -proc XkbOutOfRangeGroupInfo(g: int16): int16 = - ##define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) - Result = g and 0x000000F0'i16 - -proc XkbOutOfRangeGroupAction(g: int16): int16 = - ##define XkbOutOfRangeGroupAction(g) ((g)&0xc0) - Result = g and 0x000000C0'i16 - -proc XkbOutOfRangeGroupNumber(g: int16): int16 = - ##define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) - Result = (g and 0x00000030'i16) shr 4'i16 - -proc XkbSetGroupInfo(g, w, n: int16): int16 = - ##define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) - Result = (w and 0x000000C0'i16) or - ((n and 3'i16) shl 4'i16) or (g and 0x0000000F'i16) - -proc XkbSetNumGroups(g, n: int16): int16 = - ##define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) - Result = (g and 0x000000F0'i16) or (n and 0x0000000F'i16) - -proc XkbModActionVMods(a: PXkbModAction): int16 = - ##define XkbModActionVMods(a) ((short)(((a)->vmods1<<8)|((a)->vmods2))) - Result = toU16((ze(a.vmods1) shl 8) or ze(a.vmods2)) - -proc XkbSetModActionVMods(a: PXkbModAction, v: int8) = - ##define XkbSetModActionVMods(a,v) (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) - a.vmods1 = toU8((ze(v) shr 8) and 0x000000FF) - a.vmods2 = toU8(ze(v) and 0x000000FF) - -proc XkbSAGroup(a: PXkbGroupAction): int8 = - ##define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) - Result = int8(XkbCharToInt(a.group_XXX)) - -proc XkbSASetGroupProc(a: PXkbGroupAction, g: int8) = - ##define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) - a.group_XXX = g - -proc XkbPtrActionX(a: PXkbPtrAction): int16 = - ##define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) - Result = int16(Xkb2CharsToInt(a.high_XXX, a.low_XXX)) - -proc XkbPtrActionY(a: PXkbPtrAction): int16 = - ##define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) - Result = int16(Xkb2CharsToInt(a.high_YYY, a.low_YYY)) - -proc XkbSetPtrActionX(a: PXkbPtrAction, x: int8) = - ##define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) - XkbIntTo2Chars(x, a.high_XXX, a.low_XXX) - -proc XkbSetPtrActionY(a: PXkbPtrAction, y: int8) = - ##define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) - XkbIntTo2Chars(y, a.high_YYY, a.low_YYY) - -proc XkbSAPtrDfltValue(a: PXkbPtrDfltAction): int8 = - ##define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) - Result = int8(XkbCharToInt(a.valueXXX)) - -proc XkbSASetPtrDfltValue(a: PXkbPtrDfltAction, c: pointer) = - ##define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) - a.valueXXX = toU8(cast[int](c)) - -proc XkbSAScreen(a: PXkbSwitchScreenAction): int8 = - ##define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) - Result = toU8(XkbCharToInt(a.screenXXX)) - -proc XkbSASetScreen(a: PXkbSwitchScreenAction, s: pointer) = - ##define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) - a.screenXXX = toU8(cast[int](s)) - -proc XkbActionSetCtrls(a: PXkbCtrlsAction, c: int8) = - ##define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),((a)->ctrls2=(((c)>>16)&0xff)), - # ((a)->ctrls1=(((c)>>8)&0xff)),((a)->ctrls0=((c)&0xff))) - a.ctrls3 = toU8((ze(c) shr 24) and 0x000000FF) - a.ctrls2 = toU8((ze(c) shr 16) and 0x000000FF) - a.ctrls1 = toU8((ze(c) shr 8) and 0x000000FF) - a.ctrls0 = toU8(ze(c) and 0x000000FF) - -proc XkbActionCtrls(a: PXkbCtrlsAction): int16 = - ##define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|(((unsigned int)(a)->ctrls2)<<16)| - # (((unsigned int)(a)->ctrls1)<<8)|((unsigned int)((a)->ctrls0))) - Result = toU16((ze(a.ctrls3) shl 24) or (ze(a.ctrls2) shl 16) or - (ze(a.ctrls1) shl 8) or ze(a.ctrls0)) - -proc XkbSARedirectVMods(a: PXkbRedirectKeyAction): int16 = - ##define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|((unsigned int)(a)->vmods0)) - Result = toU16((ze(a.vmods1) shl 8) or ze(a.vmods0)) - -proc XkbSARedirectSetVMods(a: PXkbRedirectKeyAction, m: int8) = - ##define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),((a)->vmods_mask0=((m)&0xff))) - a.vmods_mask1 = toU8((ze(m) shr 8) and 0x000000FF) - a.vmods_mask0 = toU8(ze(m) or 0x000000FF) - -proc XkbSARedirectVModsMask(a: PXkbRedirectKeyAction): int16 = - ##define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)| - # ((unsigned int)(a)->vmods_mask0)) - Result = toU16((ze(a.vmods_mask1) shl 8) or ze(a.vmods_mask0)) - -proc XkbSARedirectSetVModsMask(a: PXkbRedirectKeyAction, m: int8) = - ##define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),((a)->vmods_mask0=((m)&0xff))) - a.vmods_mask1 = toU8(ze(m) shr 8 and 0x000000FF) - a.vmods_mask0 = toU8(ze(m) and 0x000000FF) - -proc XkbAX_AnyFeedback(c: PXkbControlsPtr): int16 = - ##define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) - Result = toU16(ze(c.enabled_ctrls) and XkbAccessXFeedbackMask) - -proc XkbAX_NeedOption(c: PXkbControlsPtr, w: int16): int16 = - ##define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) - Result = toU16(ze(c.ax_options) and ze(w)) - -proc XkbAX_NeedFeedback(c: PXkbControlsPtr, w: int16): bool = - ##define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) - Result = (XkbAX_AnyFeedback(c) > 0'i16) and (XkbAX_NeedOption(c, w) > 0'i16) - -proc XkbSMKeyActionsPtr(m: PXkbServerMapPtr, k: int16): PXkbAction = - ##define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) - Result = addr(m.acts[ze(m.key_acts[ze(k)])]) - -proc XkbCMKeyGroupInfo(m: PXkbClientMapPtr, k: int16): int8 = - ##define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) - Result = m.key_sym_map[ze(k)].group_info - -proc XkbCMKeyNumGroups(m: PXkbClientMapPtr, k: int16): int8 = - ##define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) - Result = toU8(XkbNumGroups(m.key_sym_map[ze(k)].group_info)) - -proc XkbCMKeyGroupWidth(m: PXkbClientMapPtr, k: int16, g: int8): int8 = - ##define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) - Result = XkbCMKeyType(m, k, g).num_levels - -proc XkbCMKeyGroupsWidth(m: PXkbClientMapPtr, K: int16): int8 = - ##define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) - Result = m.key_sym_map[ze(k)].width - -proc XkbCMKeyTypeIndex(m: PXkbClientMapPtr, k: int16, g: int8): int8 = - ##define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) - Result = m.key_sym_map[ze(k)].kt_index[ze(g) and 0x00000003] - -proc XkbCMKeyType(m: PXkbClientMapPtr, k: int16, g: int8): PXkbKeyTypePtr = - ##define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) - Result = addr(m.types[ze(XkbCMKeyTypeIndex(m, k, g))]) - -proc XkbCMKeyNumSyms(m: PXkbClientMapPtr, k: int16): int16 = - ##define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) - Result = toU16(ze(XkbCMKeyGroupsWidth(m, k)) or ze(XkbCMKeyNumGroups(m, k))) - -proc XkbCMKeySymsOffset(m: PXkbClientMapPtr, k: int16): int8 = - ##define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) - Result = m.key_sym_map[ze(k)].offset - -proc XkbCMKeySymsPtr*(m: PXkbClientMapPtr, k: int16): PKeySym = - ##define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) - Result = addr(m.syms[ze(XkbCMKeySymsOffset(m, k))]) - -proc XkbIM_IsAuto(i: PXkbIndicatorMapPtr): bool = - ##define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&(((i)->which_groups&&(i)->groups)|| - # ((i)->which_mods&&(i)->mods.mask)|| ((i)->ctrls))) - Result = ((ze(i.flags) and XkbIM_NoAutomatic) == 0) and - (((i.which_groups > 0'i8) and (i.groups > 0'i8)) or - ((i.which_mods > 0'i8) and (i.mods.mask > 0'i8)) or (i.ctrls > 0'i8)) - -proc XkbIM_InUse(i: PXkbIndicatorMapPtr): bool = - ##define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||((i)->which_mods)||((i)->ctrls)) - Result = (i.flags > 0'i8) or (i.which_groups > 0'i8) or (i.which_mods > 0'i8) or - (i.ctrls > 0'i8) - -proc XkbKeyKeyTypeIndex(d: PXkbDescPtr, k: int16, g: int8): int8 = - ##define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) - Result = XkbCMKeyTypeIndex(d.map, k, g) - -proc XkbKeyKeyType(d: PXkbDescPtr, k: int16, g: int8): PXkbKeyTypePtr = - ##define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) - Result = XkbCMKeyType(d.map, k, g) - -proc XkbKeyGroupWidth(d: PXkbDescPtr, k: int16, g: int8): int8 = - ##define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) - Result = XkbCMKeyGroupWidth(d.map, k, g) - -proc XkbKeyGroupsWidth(d: PXkbDescPtr, k: int16): int8 = - ##define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) - Result = XkbCMKeyGroupsWidth(d.map, k) - -proc XkbKeyGroupInfo(d: PXkbDescPtr, k: int16): int8 = - ##define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) - Result = XkbCMKeyGroupInfo(d.map, k) - -proc XkbKeyNumGroups(d: PXkbDescPtr, k: int16): int8 = - ##define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) - Result = XkbCMKeyNumGroups(d.map, k) - -proc XkbKeyNumSyms(d: PXkbDescPtr, k: int16): int16 = - ##define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) - Result = XkbCMKeyNumSyms(d.map, k) - -proc XkbKeySymsPtr*(d: PXkbDescPtr, k: int16): PKeySym = - ##define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) - Result = XkbCMKeySymsPtr(d.map, k) - -proc XkbKeySym(d: PXkbDescPtr, k: int16, n: int16): TKeySym = - ##define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) - Result = cast[ptr array[0..0xffff, TKeySym]](XkbKeySymsPtr(d, k))[ze(n)] # XXX: this seems strange! - -proc XkbKeySymEntry(d: PXkbDescPtr, k: int16, sl: int16, g: int8): TKeySym = - ##define XkbKeySymEntry(d,k,sl,g) (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) - Result = XkbKeySym(d, k, toU16(ze(XkbKeyGroupsWidth(d, k)) * ze(g) + ze(sl))) - -proc XkbKeyAction(d: PXkbDescPtr, k: int16, n: int16): PXkbAction = - ##define XkbKeyAction(d,k,n) (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) - #if (XkbKeyHasActions(d, k)): - # Result = XkbKeyActionsPtr(d, k)[ze(n)] #Buggy !!! - assert(false) - result = nil - -proc XkbKeyActionEntry(d: PXkbDescPtr, k: int16, sl: int16, g: int8): int8 = - ##define XkbKeyActionEntry(d,k,sl,g) (XkbKeyHasActions(d,k) ? - # XkbKeyAction(d, k, ((XkbKeyGroupsWidth(d, k) * (g))+(sl))):NULL) - if XkbKeyHasActions(d, k): - Result = XkbKeyGroupsWidth(d, k) *% g +% toU8(sl) - else: - Result = 0'i8 - -proc XkbKeyHasActions(d: PXkbDescPtr, k: int16): bool = - ##define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) - Result = d.server.key_acts[ze(k)] != 0'i16 - -proc XkbKeyNumActions(d: PXkbDescPtr, k: int16): int16 = - ##define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) - if (XkbKeyHasActions(d, k)): Result = XkbKeyNumSyms(d, k) - else: Result = 1'i16 - -proc XkbKeyActionsPtr(d: PXkbDescPtr, k: int16): PXkbAction = - ##define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) - Result = XkbSMKeyActionsPtr(d.server, k) - -proc XkbKeycodeInRange(d: PXkbDescPtr, k: int16): bool = - ##define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&& ((k)<=(d)->max_key_code)) - Result = (char(toU8(k)) >= d.min_key_code) and (char(toU8(k)) <= d.max_key_code) - -proc XkbNumKeys(d: PXkbDescPtr): int8 = - ##define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) - Result = toU8(ord(d.max_key_code) - ord(d.min_key_code) + 1) - -proc XkbXI_DevHasBtnActs(d: PXkbDeviceInfoPtr): bool = - ##define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) - Result = (d.num_btns > 0'i16) and (not (d.btn_acts == nil)) - -proc XkbXI_LegalDevBtn(d: PXkbDeviceInfoPtr, b: int16): bool = - ##define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) - Result = XkbXI_DevHasBtnActs(d) and (b <% d.num_btns) - -proc XkbXI_DevHasLeds(d: PXkbDeviceInfoPtr): bool = - ##define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) - Result = (d.num_leds > 0'i16) and (not (d.leds == nil)) - -proc XkbBoundsWidth(b: PXkbBoundsPtr): int16 = - ##define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) - Result = (b.x2) - b.x1 - -proc XkbBoundsHeight(b: PXkbBoundsPtr): int16 = - ##define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) - Result = (b.y2) - b.y1 - -proc XkbOutlineIndex(s: PXkbShapePtr, o: PXkbOutlinePtr): int32 = - ##define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) - Result = int32((cast[TAddress](o) - cast[TAddress](addr(s.outlines[0]))) div sizeof(PXkbOutlinePtr)) - -proc XkbShapeDoodadColor(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbColorPtr = - ##define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) - Result = addr((g.colors[ze(d.color_ndx)])) - -proc XkbShapeDoodadShape(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr): PXkbShapePtr = - ##define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) - Result = addr(g.shapes[ze(d.shape_ndx)]) - -proc XkbSetShapeDoodadColor(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr, - c: PXkbColorPtr) = - ##define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) - d.color_ndx = toU16((cast[TAddress](c) - cast[TAddress](addr(g.colors[0]))) div sizeof(TXkbColorRec)) - -proc XkbSetShapeDoodadShape(g: PXkbGeometryPtr, d: PXkbShapeDoodadPtr, - s: PXkbShapePtr) = - ##define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) - d.shape_ndx = toU16((cast[TAddress](s) - cast[TAddress](addr(g.shapes[0]))) div sizeof(TXkbShapeRec)) - -proc XkbTextDoodadColor(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr): PXkbColorPtr = - ##define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) - Result = addr(g.colors[ze(d.color_ndx)]) - -proc XkbSetTextDoodadColor(g: PXkbGeometryPtr, d: PXkbTextDoodadPtr, - c: PXkbColorPtr) = - ##define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) - d.color_ndx = toU16((cast[TAddress](c) - cast[TAddress](addr(g.colors[0]))) div sizeof(TXkbColorRec)) - -proc XkbIndicatorDoodadShape(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbShapeDoodadPtr = - ##define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) - Result = cast[PXkbShapeDoodadPtr](addr(g.shapes[ze(d.shape_ndx)])) - -proc XkbIndicatorDoodadOnColor(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr = - ##define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) - Result = addr(g.colors[ze(d.on_color_ndx)]) - -proc XkbIndicatorDoodadOffColor(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr): PXkbColorPtr = - ##define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) - Result = addr(g.colors[ze(d.off_color_ndx)]) - -proc XkbSetIndicatorDoodadOnColor(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr, - c: PXkbColorPtr) = - ##define XkbSetIndicatorDoodadOnColor(g,d,c) ((d)->on_color_ndx= (c)-&(g)->colors[0]) - d.on_color_ndx = toU16((cast[TAddress](c) - cast[TAddress](addr(g.colors[0]))) div sizeof(TXkbColorRec)) - -proc XkbSetIndicatorDoodadOffColor(g: PXkbGeometryPtr, - d: PXkbIndicatorDoodadPtr, c: PXkbColorPtr) = - ##define XkbSetIndicatorDoodadOffColor(g,d,c) ((d)->off_color_ndx= (c)-&(g)->colors[0]) - d.off_color_ndx = toU16((cast[TAddress](c) - cast[TAddress](addr(g.colors[0]))) div sizeof(TxkbColorRec)) - -proc XkbSetIndicatorDoodadShape(g: PXkbGeometryPtr, d: PXkbIndicatorDoodadPtr, - s: PXkbShapeDoodadPtr) = - ##define XkbSetIndicatorDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) - d.shape_ndx = toU16((cast[TAddress](s) - (cast[TAddress](addr(g.shapes[0])))) div sizeof(TXkbShapeRec)) - -proc XkbLogoDoodadColor(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbColorPtr = - ##define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) - Result = addr(g.colors[ze(d.color_ndx)]) - -proc XkbLogoDoodadShape(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr): PXkbShapeDoodadPtr = - ##define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) - Result = cast[PXkbShapeDoodadPtr](addr(g.shapes[ze(d.shape_ndx)])) - -proc XkbSetLogoDoodadColor(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr, - c: PXkbColorPtr) = - ##define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) - d.color_ndx = toU16((cast[TAddress](c) - cast[TAddress](addr(g.colors[0]))) div sizeof(TXkbColorRec)) - -proc XkbSetLogoDoodadShape(g: PXkbGeometryPtr, d: PXkbLogoDoodadPtr, - s: PXkbShapeDoodadPtr) = - ##define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) - d.shape_ndx = toU16((cast[TAddress](s) - cast[TAddress](addr(g.shapes[0]))) div sizeof(TXkbShapeRec)) - -proc XkbKeyShape(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbShapeDoodadPtr = - ##define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) - Result = cast[PXkbShapeDoodadPtr](addr(g.shapes[ze(k.shape_ndx)])) - -proc XkbKeyColor(g: PXkbGeometryPtr, k: PXkbKeyPtr): PXkbColorPtr = - ##define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) - Result = addr(g.colors[ze(k.color_ndx)]) - -proc XkbSetKeyShape(g: PXkbGeometryPtr, k: PXkbKeyPtr, s: PXkbShapeDoodadPtr) = - ##define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) - k.shape_ndx = toU8((cast[TAddress](s) - cast[TAddress](addr(g.shapes[0]))) div sizeof(TXkbShapeRec)) - -proc XkbSetKeyColor(g: PXkbGeometryPtr, k: PXkbKeyPtr, c: PXkbColorPtr) = - ##define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) - k.color_ndx = toU8((cast[TAddress](c) - cast[TAddress](addr(g.colors[0]))) div sizeof(TxkbColorRec)) - -proc XkbGeomColorIndex(g: PXkbGeometryPtr, c: PXkbColorPtr): int32 = - ##define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) - Result = toU16((cast[TAddress](c) - (cast[TAddress](addr(g.colors[0])))) div sizeof(TxkbColorRec)) diff --git a/lib/wrappers/x11/xkblib.nim b/lib/wrappers/x11/xkblib.nim deleted file mode 100644 index 1b450f289..000000000 --- a/lib/wrappers/x11/xkblib.nim +++ /dev/null @@ -1,661 +0,0 @@ -# $Xorg: XKBlib.h,v 1.6 2000/08/17 19:45:03 cpqbld Exp $ -#************************************************************ -#Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. -# -#Permission to use, copy, modify, and distribute this -#software and its documentation for any purpose and without -#fee is hereby granted, provided that the above copyright -#notice appear in all copies and that both that copyright -#notice and this permission notice appear in supporting -#documentation, and that the name of Silicon Graphics not be -#used in advertising or publicity pertaining to distribution -#of the software without specific prior written permission. -#Silicon Graphics makes no representation about the suitability -#of this software for any purpose. It is provided "as is" -#without any express or implied warranty. -# -#SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -#SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -#AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -#GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -#DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING `from` LOSS OF USE, -#DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -#OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -#THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -#********************************************************/ -# $XFree86: xc/lib/X11/XKBlib.h,v 3.3 2001/08/01 00:44:38 tsi Exp $ -# -# Pascal Convertion was made by Ido Kannner - kanerido@actcom.net.il -# -#Thanks: -# I want to thanks to oliebol for putting up with all of the problems that was found -# while translating this code. ;) -# -# I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my -# wierd questions ;) -# -# Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to -# understanding some of the problems I had converting this headers and pointing me to resources -# that helped translating this headers. -# -# Ido -# -#History: -# 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and -# chnaged it to "reocrd" only. -# 2004/10/10 - Added to TXkbGetAtomNameFunc and TXkbInternAtomFunc the cdecl call. -# 2004/10/06 - 09 - Convertion `from` the c header of XKBlib.h -# -# - -import - X, Xlib, XKB - - -include "x11pragma.nim" - - -type - PXkbAnyEvent* = ptr TXkbAnyEvent - TXkbAnyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds; - xkb_type*: int16 # XKB event minor code - device*: int16 # device ID - - -type - PXkbNewKeyboardNotifyEvent* = ptr TXkbNewKeyboardNotifyEvent - TXkbNewKeyboardNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbNewKeyboardNotify - device*: int16 # device ID - old_device*: int16 # device ID of previous keyboard - min_key_code*: int16 # minimum key code - max_key_code*: int16 # maximum key code - old_min_key_code*: int16 # min key code of previous kbd - old_max_key_code*: int16 # max key code of previous kbd - changed*: int16 # changed aspects of the keyboard - req_major*: int8 # major and minor opcode of req - req_minor*: int8 # that caused change, if applicable - - -type - PXkbMapNotifyEvent* = ptr TXkbMapNotifyEvent - TXkbMapNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbMapNotify - device*: int16 # device ID - changed*: int16 # fields which have been changed - flags*: int16 # reserved - first_type*: int16 # first changed key type - num_types*: int16 # number of changed key types - min_key_code*: TKeyCode - max_key_code*: TKeyCode - first_key_sym*: TKeyCode - first_key_act*: TKeyCode - first_key_behavior*: TKeyCode - first_key_explicit*: TKeyCode - first_modmap_key*: TKeyCode - first_vmodmap_key*: TKeyCode - num_key_syms*: int16 - num_key_acts*: int16 - num_key_behaviors*: int16 - num_key_explicit*: int16 - num_modmap_keys*: int16 - num_vmodmap_keys*: int16 - vmods*: int16 # mask of changed virtual mods - - -type - PXkbStateNotifyEvent* = ptr TXkbStateNotifyEvent - TXkbStateNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbStateNotify - device*: int16 # device ID - changed*: int16 # mask of changed state components - group*: int16 # keyboard group - base_group*: int16 # base keyboard group - latched_group*: int16 # latched keyboard group - locked_group*: int16 # locked keyboard group - mods*: int16 # modifier state - base_mods*: int16 # base modifier state - latched_mods*: int16 # latched modifiers - locked_mods*: int16 # locked modifiers - compat_state*: int16 # compatibility state - grab_mods*: int8 # mods used for grabs - compat_grab_mods*: int8 # grab mods for non-XKB clients - lookup_mods*: int8 # mods sent to clients - compat_lookup_mods*: int8 # mods sent to non-XKB clients - ptr_buttons*: int16 # pointer button state - keycode*: TKeyCode # keycode that caused the change - event_type*: int8 # KeyPress or KeyRelease - req_major*: int8 # Major opcode of request - req_minor*: int8 # Minor opcode of request - - -type - PXkbControlsNotifyEvent* = ptr TXkbControlsNotifyEvent - TXkbControlsNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbControlsNotify - device*: int16 # device ID - changed_ctrls*: int16 # controls with changed sub-values - enabled_ctrls*: int16 # controls currently enabled - enabled_ctrl_changes*: int16 # controls just {en,dis}abled - num_groups*: int16 # total groups on keyboard - keycode*: TKeyCode # key that caused change or 0 - event_type*: int8 # type of event that caused change - req_major*: int8 # if keycode==0, major and minor - req_minor*: int8 # opcode of req that caused change - - -type - PXkbIndicatorNotifyEvent* = ptr TXkbIndicatorNotifyEvent - TXkbIndicatorNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbIndicatorNotify - device*: int16 # device - changed*: int16 # indicators with new state or map - state*: int16 # current state of all indicators - - -type - PXkbNamesNotifyEvent* = ptr TXkbNamesNotifyEvent - TXkbNamesNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbNamesNotify - device*: int16 # device ID - changed*: int32 # names that have changed - first_type*: int16 # first key type with new name - num_types*: int16 # number of key types with new names - first_lvl*: int16 # first key type new new level names - num_lvls*: int16 # # of key types w/new level names - num_aliases*: int16 # total number of key aliases - num_radio_groups*: int16 # total number of radio groups - changed_vmods*: int16 # virtual modifiers with new names - changed_groups*: int16 # groups with new names - changed_indicators*: int16 # indicators with new names - first_key*: int16 # first key with new name - num_keys*: int16 # number of keys with new names - - -type - PXkbCompatMapNotifyEvent* = ptr TXkbCompatMapNotifyEvent - TXkbCompatMapNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbCompatMapNotify - device*: int16 # device ID - changed_groups*: int16 # groups with new compat maps - first_si*: int16 # first new symbol interp - num_si*: int16 # number of new symbol interps - num_total_si*: int16 # total # of symbol interps - - -type - PXkbBellNotifyEvent* = ptr TXkbBellNotifyEvent - TXkbBellNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbBellNotify - device*: int16 # device ID - percent*: int16 # requested volume as a % of maximum - pitch*: int16 # requested pitch in Hz - duration*: int16 # requested duration in useconds - bell_class*: int16 # (input extension) feedback class - bell_id*: int16 # (input extension) ID of feedback - name*: TAtom # "name" of requested bell - window*: TWindow # window associated with event - event_only*: bool # "event only" requested - - -type - PXkbActionMessageEvent* = ptr TXkbActionMessageEvent - TXkbActionMessageEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbActionMessage - device*: int16 # device ID - keycode*: TKeyCode # key that generated the event - press*: bool # true if act caused by key press - key_event_follows*: bool # true if key event also generated - group*: int16 # effective group - mods*: int16 # effective mods - message*: array[0..XkbActionMessageLength, Char] # message -- leave space for NUL - - -type - PXkbAccessXNotifyEvent* = ptr TXkbAccessXNotifyEvent - TXkbAccessXNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbAccessXNotify - device*: int16 # device ID - detail*: int16 # XkbAXN_* - keycode*: int16 # key of event - sk_delay*: int16 # current slow keys delay - debounce_delay*: int16 # current debounce delay - - -type - PXkbExtensionDeviceNotifyEvent* = ptr TXkbExtensionDeviceNotifyEvent - TXkbExtensionDeviceNotifyEvent*{.final.} = object - theType*: int16 # XkbAnyEvent - serial*: int32 # of last req processed by server - send_event*: bool # is this `from` a SendEvent request? - display*: PDisplay # Display the event was read `from` - time*: TTime # milliseconds - xkb_type*: int16 # XkbExtensionDeviceNotify - device*: int16 # device ID - reason*: int16 # reason for the event - supported*: int16 # mask of supported features - unsupported*: int16 # mask of unsupported features - # that some app tried to use - first_btn*: int16 # first button that changed - num_btns*: int16 # range of buttons changed - leds_defined*: int16 # indicators with names or maps - led_state*: int16 # current state of the indicators - led_class*: int16 # feedback class for led changes - led_id*: int16 # feedback id for led changes - - -type - PXkbEvent* = ptr TXkbEvent - TXkbEvent*{.final.} = object - theType*: int16 - any*: TXkbAnyEvent - new_kbd*: TXkbNewKeyboardNotifyEvent - map*: TXkbMapNotifyEvent - state*: TXkbStateNotifyEvent - ctrls*: TXkbControlsNotifyEvent - indicators*: TXkbIndicatorNotifyEvent - names*: TXkbNamesNotifyEvent - compat*: TXkbCompatMapNotifyEvent - bell*: TXkbBellNotifyEvent - message*: TXkbActionMessageEvent - accessx*: TXkbAccessXNotifyEvent - device*: TXkbExtensionDeviceNotifyEvent - core*: TXEvent - - -type - PXkbKbdDpyStatePtr* = ptr TXkbKbdDpyStateRec - TXkbKbdDpyStateRec*{.final.} = object # XkbOpenDisplay error codes - -const - XkbOD_Success* = 0 - XkbOD_BadLibraryVersion* = 1 - XkbOD_ConnectionRefused* = 2 - XkbOD_NonXkbServer* = 3 - XkbOD_BadServerVersion* = 4 # Values for XlibFlags - -const - XkbLC_ForceLatin1Lookup* = 1 shl 0 - XkbLC_ConsumeLookupMods* = 1 shl 1 - XkbLC_AlwaysConsumeShiftAndLock* = 1 shl 2 - XkbLC_IgnoreNewKeyboards* = 1 shl 3 - XkbLC_ControlFallback* = 1 shl 4 - XkbLC_ConsumeKeysOnComposeFail* = 1 shl 29 - XkbLC_ComposeLED* = 1 shl 30 - XkbLC_BeepOnComposeFail* = 1 shl 31 - XkbLC_AllComposeControls* = 0xC0000000 - XkbLC_AllControls* = 0xC000001F - -proc XkbIgnoreExtension*(ignore: bool): bool{.libx11c, - importc: "XkbIgnoreExtension".} -proc XkbOpenDisplay*(name: cstring, ev_rtrn, err_rtrn, major_rtrn, minor_rtrn, - reason: ptr int16): PDisplay{.libx11c, importc: "XkbOpenDisplay".} -proc XkbQueryExtension*(dpy: PDisplay, opcodeReturn, eventBaseReturn, - errorBaseReturn, majorRtrn, minorRtrn: ptr int16): bool{. - libx11c, importc: "XkbQueryExtension".} -proc XkbUseExtension*(dpy: PDisplay, major_rtrn, minor_rtrn: ptr int16): bool{. - libx11c, importc: "XkbUseExtension".} -proc XkbLibraryVersion*(libMajorRtrn, libMinorRtrn: ptr int16): bool{.libx11c, importc: "XkbLibraryVersion".} -proc XkbSetXlibControls*(dpy: PDisplay, affect, values: int16): int16{.libx11c, importc: "XkbSetXlibControls".} -proc XkbGetXlibControls*(dpy: PDisplay): int16{.libx11c, - importc: "XkbGetXlibControls".} -type - TXkbInternAtomFunc* = proc (dpy: PDisplay, name: cstring, only_if_exists: bool): TAtom{. - cdecl.} - -type - TXkbGetAtomNameFunc* = proc (dpy: PDisplay, atom: TAtom): cstring{.cdecl.} - -proc XkbSetAtomFuncs*(getAtom: TXkbInternAtomFunc, getName: TXkbGetAtomNameFunc){. - libx11c, importc: "XkbSetAtomFuncs".} -proc XkbKeycodeToKeysym*(dpy: PDisplay, kc: TKeyCode, group, level: int16): TKeySym{. - libx11c, importc: "XkbKeycodeToKeysym".} -proc XkbKeysymToModifiers*(dpy: PDisplay, ks: TKeySym): int16{.libx11c, importc: "XkbKeysymToModifiers".} -proc XkbLookupKeySym*(dpy: PDisplay, keycode: TKeyCode, - modifiers, modifiers_return: int16, keysym_return: PKeySym): bool{. - libx11c, importc: "XkbLookupKeySym".} -proc XkbLookupKeyBinding*(dpy: PDisplay, sym_rtrn: TKeySym, mods: int16, - buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{. - libx11c, importc: "XkbLookupKeyBinding".} -proc XkbTranslateKeyCode*(xkb: PXkbDescPtr, keycode: TKeyCode, - modifiers, modifiers_return: int16, - keysym_return: PKeySym): bool{.libx11c, - importc: "XkbTranslateKeyCode".} -proc XkbTranslateKeySym*(dpy: PDisplay, sym_return: TKeySym, modifiers: int16, - buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{. - libx11c, importc: "XkbTranslateKeySym".} -proc XkbSetAutoRepeatRate*(dpy: PDisplay, deviceSpec, delay, interval: int16): bool{. - libx11c, importc: "XkbSetAutoRepeatRate".} -proc XkbGetAutoRepeatRate*(dpy: PDisplay, deviceSpec: int16, - delayRtrn, intervalRtrn: PWord): bool{.libx11c, importc: "XkbGetAutoRepeatRate".} -proc XkbChangeEnabledControls*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{. - libx11c, importc: "XkbChangeEnabledControls".} -proc XkbDeviceBell*(dpy: PDisplay, win: TWindow, - deviceSpec, bellClass, bellID, percent: int16, name: TAtom): bool{. - libx11c, importc: "XkbDeviceBell".} -proc XkbForceDeviceBell*(dpy: PDisplay, - deviceSpec, bellClass, bellID, percent: int16): bool{. - libx11c, importc: "XkbForceDeviceBell".} -proc XkbDeviceBellEvent*(dpy: PDisplay, win: TWindow, - deviceSpec, bellClass, bellID, percent: int16, - name: TAtom): bool{.libx11c, - importc: "XkbDeviceBellEvent".} -proc XkbBell*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{. - libx11c, importc: "XkbBell".} -proc XkbForceBell*(dpy: PDisplay, percent: int16): bool{.libx11c, - importc: "XkbForceBell".} -proc XkbBellEvent*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{. - libx11c, importc: "XkbBellEvent".} -proc XkbSelectEvents*(dpy: PDisplay, deviceID, affect, values: int16): bool{. - libx11c, importc: "XkbSelectEvents".} -proc XkbSelectEventDetails*(dpy: PDisplay, deviceID, eventType: int16, - affect, details: int32): bool{.libx11c, importc: "XkbSelectEventDetails".} -proc XkbNoteMapChanges*(old: PXkbMapChangesPtr, new: PXkbMapNotifyEvent, - wanted: int16){.libx11c, - importc: "XkbNoteMapChanges".} -proc XkbNoteNameChanges*(old: PXkbNameChangesPtr, new: PXkbNamesNotifyEvent, - wanted: int16){.libx11c, - importc: "XkbNoteNameChanges".} -proc XkbGetIndicatorState*(dpy: PDisplay, deviceSpec: int16, pStateRtrn: PWord): TStatus{. - libx11c, importc: "XkbGetIndicatorState".} -proc XkbGetDeviceIndicatorState*(dpy: PDisplay, - deviceSpec, ledClass, ledID: int16, - pStateRtrn: PWord): TStatus{.libx11c, importc: "XkbGetDeviceIndicatorState".} -proc XkbGetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetIndicatorMap".} -proc XkbSetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{. - libx11c, importc: "XkbSetIndicatorMap".} -proc XkbNoteIndicatorMapChanges*(o, n: PXkbIndicatorChangesPtr, w: int16) -proc XkbNoteIndicatorStateChanges*(o, n: PXkbIndicatorChangesPtr, w: int16) -proc XkbGetIndicatorMapChanges*(d: PDisplay, x: PXkbDescPtr, - c: PXkbIndicatorChangesPtr): TStatus -proc XkbChangeIndicatorMaps*(d: PDisplay, x: PXkbDescPtr, - c: PXkbIndicatorChangesPtr): bool -proc XkbGetNamedIndicator*(dpy: PDisplay, name: TAtom, pNdxRtrn: ptr int16, - pStateRtrn: ptr bool, pMapRtrn: PXkbIndicatorMapPtr, - pRealRtrn: ptr bool): bool{.libx11c, - importc: "XkbGetNamedIndicator".} -proc XkbGetNamedDeviceIndicator*(dpy: PDisplay, - deviceSpec, ledClass, ledID: int16, - name: TAtom, pNdxRtrn: ptr int16, - pStateRtrn: ptr bool, - pMapRtrn: PXkbIndicatorMapPtr, - pRealRtrn: ptr bool): bool{.libx11c, importc: "XkbGetNamedDeviceIndicator".} -proc XkbSetNamedIndicator*(dpy: PDisplay, name: TAtom, - changeState, state, createNewMap: bool, - pMap: PXkbIndicatorMapPtr): bool{.libx11c, importc: "XkbSetNamedIndicator".} -proc XkbSetNamedDeviceIndicator*(dpy: PDisplay, - deviceSpec, ledClass, ledID: int16, - name: TAtom, - changeState, state, createNewMap: bool, - pMap: PXkbIndicatorMapPtr): bool{.libx11c, importc: "XkbSetNamedDeviceIndicator".} -proc XkbLockModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{. - libx11c, importc: "XkbLockModifiers".} -proc XkbLatchModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{. - libx11c, importc: "XkbLatchModifiers".} -proc XkbLockGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.libx11c, importc: "XkbLockGroup".} -proc XkbLatchGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.libx11c, importc: "XkbLatchGroup".} -proc XkbSetServerInternalMods*(dpy: PDisplay, deviceSpec, affectReal, - realValues, affectVirtual, virtualValues: int16): bool{.libx11c, importc: "XkbSetServerInternalMods".} -proc XkbSetIgnoreLockMods*(dpy: PDisplay, deviceSpec, affectReal, realValues, - affectVirtual, virtualValues: int16): bool{.libx11c, - importc: "XkbSetIgnoreLockMods".} -proc XkbVirtualModsToReal*(dpy: PDisplay, virtual_mask: int16, mask_rtrn: PWord): bool{. - libx11c, importc: "XkbVirtualModsToReal".} -proc XkbComputeEffectiveMap*(xkb: PXkbDescPtr, theType: PXkbKeyTypePtr, - map_rtrn: PByte): bool{.libx11c, - importc: "XkbComputeEffectiveMap".} -proc XkbInitCanonicalKeyTypes*(xkb: PXkbDescPtr, which: int16, keypadVMod: int16): TStatus{. - libx11c, importc: "XkbInitCanonicalKeyTypes".} -proc XkbAllocKeyboard*(): PXkbDescPtr{.libx11c, - importc: "XkbAllocKeyboard".} -proc XkbFreeKeyboard*(xkb: PXkbDescPtr, which: int16, freeDesc: bool){.libx11c, importc: "XkbFreeKeyboard".} -proc XkbAllocClientMap*(xkb: PXkbDescPtr, which, nTypes: int16): TStatus{.libx11c, importc: "XkbAllocClientMap".} -proc XkbAllocServerMap*(xkb: PXkbDescPtr, which, nActions: int16): TStatus{. - libx11c, importc: "XkbAllocServerMap".} -proc XkbFreeClientMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.libx11c, importc: "XkbFreeClientMap".} -proc XkbFreeServerMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.libx11c, importc: "XkbFreeServerMap".} -proc XkbAddKeyType*(xkb: PXkbDescPtr, name: TAtom, map_count: int16, - want_preserve: bool, num_lvls: int16): PXkbKeyTypePtr{. - libx11c, importc: "XkbAddKeyType".} -proc XkbAllocIndicatorMaps*(xkb: PXkbDescPtr): TStatus{.libx11c, - importc: "XkbAllocIndicatorMaps".} -proc XkbFreeIndicatorMaps*(xkb: PXkbDescPtr){.libx11c, - importc: "XkbFreeIndicatorMaps".} -proc XkbGetMap*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.libx11c, importc: "XkbGetMap".} -proc XkbGetUpdatedMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetUpdatedMap".} -proc XkbGetMapChanges*(dpy: PDisplay, xkb: PXkbDescPtr, - changes: PXkbMapChangesPtr): TStatus{.libx11c, importc: "XkbGetMapChanges".} -proc XkbRefreshKeyboardMapping*(event: PXkbMapNotifyEvent): TStatus{.libx11c, importc: "XkbRefreshKeyboardMapping".} -proc XkbGetKeyTypes*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetKeyTypes".} -proc XkbGetKeySyms*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetKeySyms".} -proc XkbGetKeyActions*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetKeyActions".} -proc XkbGetKeyBehaviors*(dpy: PDisplay, firstKey, nKeys: int16, - desc: PXkbDescPtr): TStatus{.libx11c, - importc: "XkbGetKeyBehaviors".} -proc XkbGetVirtualMods*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetVirtualMods".} -proc XkbGetKeyExplicitComponents*(dpy: PDisplay, firstKey, nKeys: int16, - desc: PXkbDescPtr): TStatus{.libx11c, importc: "XkbGetKeyExplicitComponents".} -proc XkbGetKeyModifierMap*(dpy: PDisplay, firstKey, nKeys: int16, - desc: PXkbDescPtr): TStatus{.libx11c, - importc: "XkbGetKeyModifierMap".} -proc XkbAllocControls*(xkb: PXkbDescPtr, which: int16): TStatus{.libx11c, importc: "XkbAllocControls".} -proc XkbFreeControls*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeControls".} -proc XkbGetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetControls".} -proc XkbSetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{. - libx11c, importc: "XkbSetControls".} -proc XkbNoteControlsChanges*(old: PXkbControlsChangesPtr, - new: PXkbControlsNotifyEvent, wanted: int16){. - libx11c, importc: "XkbNoteControlsChanges".} -proc XkbGetControlsChanges*(d: PDisplay, x: PXkbDescPtr, - c: PXkbControlsChangesPtr): TStatus -proc XkbChangeControls*(d: PDisplay, x: PXkbDescPtr, c: PXkbControlsChangesPtr): bool -proc XkbAllocCompatMap*(xkb: PXkbDescPtr, which, nInterpret: int16): TStatus{. - libx11c, importc: "XkbAllocCompatMap".} -proc XkbFreeCompatMap*(xkib: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeCompatMap".} -proc XkbGetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetCompatMap".} -proc XkbSetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr, - updateActions: bool): bool{.libx11c, - importc: "XkbSetCompatMap".} -proc XkbAddSymInterpret*(xkb: PXkbDescPtr, si: PXkbSymInterpretPtr, - updateMap: bool, changes: PXkbChangesPtr): PXkbSymInterpretPtr{. - libx11c, importc: "XkbAddSymInterpret".} -proc XkbAllocNames*(xkb: PXkbDescPtr, which: int16, - nTotalRG, nTotalAliases: int16): TStatus{.libx11c, importc: "XkbAllocNames".} -proc XkbGetNames*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{. - libx11c, importc: "XkbGetNames".} -proc XkbSetNames*(dpy: PDisplay, which, firstType, nTypes: int16, - desc: PXkbDescPtr): bool{.libx11c, - importc: "XkbSetNames".} -proc XkbChangeNames*(dpy: PDisplay, xkb: PXkbDescPtr, - changes: PXkbNameChangesPtr): bool{.libx11c, - importc: "XkbChangeNames".} -proc XkbFreeNames*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeNames".} -proc XkbGetState*(dpy: PDisplay, deviceSpec: int16, rtrnState: PXkbStatePtr): TStatus{. - libx11c, importc: "XkbGetState".} -proc XkbSetMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): bool{.libx11c, importc: "XkbSetMap".} -proc XkbChangeMap*(dpy: PDisplay, desc: PXkbDescPtr, changes: PXkbMapChangesPtr): bool{. - libx11c, importc: "XkbChangeMap".} -proc XkbSetDetectableAutoRepeat*(dpy: PDisplay, detectable: bool, - supported: ptr bool): bool{.libx11c, importc: "XkbSetDetectableAutoRepeat".} -proc XkbGetDetectableAutoRepeat*(dpy: PDisplay, supported: ptr bool): bool{. - libx11c, importc: "XkbGetDetectableAutoRepeat".} -proc XkbSetAutoResetControls*(dpy: PDisplay, changes: int16, - auto_ctrls, auto_values: PWord): bool{.libx11c, importc: "XkbSetAutoResetControls".} -proc XkbGetAutoResetControls*(dpy: PDisplay, auto_ctrls, auto_ctrl_values: PWord): bool{. - libx11c, importc: "XkbGetAutoResetControls".} -proc XkbSetPerClientControls*(dpy: PDisplay, change: int16, values: PWord): bool{. - libx11c, importc: "XkbSetPerClientControls".} -proc XkbGetPerClientControls*(dpy: PDisplay, ctrls: PWord): bool{.libx11c, importc: "XkbGetPerClientControls".} -proc XkbCopyKeyType*(`from`, into: PXkbKeyTypePtr): TStatus{.libx11c, importc: "XkbCopyKeyType".} -proc XkbCopyKeyTypes*(`from`, into: PXkbKeyTypePtr, num_types: int16): TStatus{. - libx11c, importc: "XkbCopyKeyTypes".} -proc XkbResizeKeyType*(xkb: PXkbDescPtr, type_ndx, map_count: int16, - want_preserve: bool, new_num_lvls: int16): TStatus{. - libx11c, importc: "XkbResizeKeyType".} -proc XkbResizeKeySyms*(desc: PXkbDescPtr, forKey, symsNeeded: int16): PKeySym{. - libx11c, importc: "XkbResizeKeySyms".} -proc XkbResizeKeyActions*(desc: PXkbDescPtr, forKey, actsNeeded: int16): PXkbAction{. - libx11c, importc: "XkbResizeKeyActions".} -proc XkbChangeTypesOfKey*(xkb: PXkbDescPtr, key, num_groups: int16, - groups: int16, newTypes: ptr int16, - pChanges: PXkbMapChangesPtr): TStatus{.libx11c, importc: "XkbChangeTypesOfKey".} - -proc XkbListComponents*(dpy: PDisplay, deviceSpec: int16, - ptrns: PXkbComponentNamesPtr, max_inout: ptr int16): PXkbComponentListPtr{. - libx11c, importc: "XkbListComponents".} -proc XkbFreeComponentList*(list: PXkbComponentListPtr){.libx11c, - importc: "XkbFreeComponentList".} -proc XkbGetKeyboard*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{. - libx11c, importc: "XkbGetKeyboard".} -proc XkbGetKeyboardByName*(dpy: PDisplay, deviceSpec: int16, - names: PXkbComponentNamesPtr, want, need: int16, - load: bool): PXkbDescPtr{.libx11c, - importc: "XkbGetKeyboardByName".} - -proc XkbKeyTypesForCoreSymbols*(xkb: PXkbDescPtr, - map_width: int16, # keyboard device - core_syms: PKeySym, # always mapWidth symbols - protected: int16, # explicit key types - types_inout: ptr int16, # always four type indices - xkb_syms_rtrn: PKeySym): int16{.libx11c, importc: "XkbKeyTypesForCoreSymbols".} - # must have enough space -proc XkbApplyCompatMapToKey*(xkb: PXkbDescPtr, - key: TKeyCode, # key to be updated - changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbApplyCompatMapToKey".} - # resulting changes to map -proc XkbUpdateMapFromCore*(xkb: PXkbDescPtr, - first_key: TKeyCode, # first changed key - num_keys, - map_width: int16, - core_keysyms: PKeySym, # symbols `from` core keymap - changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbUpdateMapFromCore".} - -proc XkbAddDeviceLedInfo*(devi: PXkbDeviceInfoPtr, ledClass, ledId: int16): PXkbDeviceLedInfoPtr{. - libx11c, importc: "XkbAddDeviceLedInfo".} -proc XkbResizeDeviceButtonActions*(devi: PXkbDeviceInfoPtr, newTotal: int16): TStatus{. - libx11c, importc: "XkbResizeDeviceButtonActions".} -proc XkbAllocDeviceInfo*(deviceSpec, nButtons, szLeds: int16): PXkbDeviceInfoPtr{. - libx11c, importc: "XkbAllocDeviceInfo".} -proc XkbFreeDeviceInfo*(devi: PXkbDeviceInfoPtr, which: int16, freeDevI: bool){. - libx11c, importc: "XkbFreeDeviceInfo".} -proc XkbNoteDeviceChanges*(old: PXkbDeviceChangesPtr, - new: PXkbExtensionDeviceNotifyEvent, wanted: int16){. - libx11c, importc: "XkbNoteDeviceChanges".} -proc XkbGetDeviceInfo*(dpy: PDisplay, which, deviceSpec, ledClass, ledID: int16): PXkbDeviceInfoPtr{. - libx11c, importc: "XkbGetDeviceInfo".} -proc XkbGetDeviceInfoChanges*(dpy: PDisplay, devi: PXkbDeviceInfoPtr, - changes: PXkbDeviceChangesPtr): TStatus{.libx11c, importc: "XkbGetDeviceInfoChanges".} -proc XkbGetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr, - all: bool, first, nBtns: int16): TStatus{.libx11c, importc: "XkbGetDeviceButtonActions".} -proc XkbGetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr, - ledClass, ledId, which: int16): TStatus{.libx11c, importc: "XkbGetDeviceLedInfo".} -proc XkbSetDeviceInfo*(dpy: PDisplay, which: int16, devi: PXkbDeviceInfoPtr): bool{. - libx11c, importc: "XkbSetDeviceInfo".} -proc XkbChangeDeviceInfo*(dpy: PDisplay, desc: PXkbDeviceInfoPtr, - changes: PXkbDeviceChangesPtr): bool{.libx11c, importc: "XkbChangeDeviceInfo".} -proc XkbSetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr, - ledClass, ledID, which: int16): bool{.libx11c, importc: "XkbSetDeviceLedInfo".} -proc XkbSetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr, - first, nBtns: int16): bool{.libx11c, importc: "XkbSetDeviceButtonActions".} - -proc XkbToControl*(c: int8): int8{.libx11c, - importc: "XkbToControl".} - -proc XkbSetDebuggingFlags*(dpy: PDisplay, mask, flags: int16, msg: cstring, - ctrls_mask, ctrls, rtrn_flags, rtrn_ctrls: int16): bool{. - libx11c, importc: "XkbSetDebuggingFlags".} -proc XkbApplyVirtualModChanges*(xkb: PXkbDescPtr, changed: int16, - changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbApplyVirtualModChanges".} - -# implementation - -proc XkbNoteIndicatorMapChanges(o, n: PXkbIndicatorChangesPtr, w: int16) = - ##define XkbNoteIndicatorMapChanges(o,n,w) ((o)->map_changes|=((n)->map_changes&(w))) - o.map_changes = o.map_changes or (n.map_changes and w) - -proc XkbNoteIndicatorStateChanges(o, n: PXkbIndicatorChangesPtr, w: int16) = - ##define XkbNoteIndicatorStateChanges(o,n,w) ((o)->state_changes|=((n)->state_changes&(w))) - o.state_changes = o.state_changes or (n.state_changes and (w)) - -proc XkbGetIndicatorMapChanges(d: PDisplay, x: PXkbDescPtr, - c: PXkbIndicatorChangesPtr): TStatus = - ##define XkbGetIndicatorMapChanges(d,x,c) (XkbGetIndicatorMap((d),(c)->map_changes,x) - Result = XkbGetIndicatorMap(d, c.map_changes, x) - -proc XkbChangeIndicatorMaps(d: PDisplay, x: PXkbDescPtr, - c: PXkbIndicatorChangesPtr): bool = - ##define XkbChangeIndicatorMaps(d,x,c) (XkbSetIndicatorMap((d),(c)->map_changes,x)) - Result = XkbSetIndicatorMap(d, c.map_changes, x) - -proc XkbGetControlsChanges(d: PDisplay, x: PXkbDescPtr, - c: PXkbControlsChangesPtr): TStatus = - ##define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) - Result = XkbGetControls(d, c.changed_ctrls, x) - -proc XkbChangeControls(d: PDisplay, x: PXkbDescPtr, c: PXkbControlsChangesPtr): bool = - ##define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) - Result = XkbSetControls(d, c.changed_ctrls, x) diff --git a/lib/wrappers/x11/xlib.nim b/lib/wrappers/x11/xlib.nim deleted file mode 100644 index 5ccacdd45..000000000 --- a/lib/wrappers/x11/xlib.nim +++ /dev/null @@ -1,2027 +0,0 @@ - -import - x - -include "x11pragma.nim" - -type - cunsigned* = cint - Pcint* = ptr cint - PPcint* = ptr Pcint - PPcuchar* = ptr ptr cuchar - PWideChar* = ptr int16 - PPChar* = ptr cstring - PPPChar* = ptr ptr cstring - Pculong* = ptr culong - Pcuchar* = cstring - Pcuint* = ptr cuint - Pcushort* = ptr uint16 -# Automatically converted by H2Pas 0.99.15 from xlib.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# xlib.h - -const - XlibSpecificationRelease* = 6 - -type - PXPointer* = ptr TXPointer - TXPointer* = ptr char - PBool* = ptr TBool - TBool* = int #cint? - PStatus* = ptr TStatus - TStatus* = cint - -const - QueuedAlready* = 0 - QueuedAfterReading* = 1 - QueuedAfterFlush* = 2 - -type - PPXExtData* = ptr PXExtData - PXExtData* = ptr TXExtData - TXExtData*{.final.} = object - number*: cint - next*: PXExtData - free_private*: proc (extension: PXExtData): cint{.cdecl.} - private_data*: TXPointer - - PXExtCodes* = ptr TXExtCodes - TXExtCodes*{.final.} = object - extension*: cint - major_opcode*: cint - first_event*: cint - first_error*: cint - - PXPixmapFormatValues* = ptr TXPixmapFormatValues - TXPixmapFormatValues*{.final.} = object - depth*: cint - bits_per_pixel*: cint - scanline_pad*: cint - - PXGCValues* = ptr TXGCValues - TXGCValues*{.final.} = object - function*: cint - plane_mask*: culong - foreground*: culong - background*: culong - line_width*: cint - line_style*: cint - cap_style*: cint - join_style*: cint - fill_style*: cint - fill_rule*: cint - arc_mode*: cint - tile*: TPixmap - stipple*: TPixmap - ts_x_origin*: cint - ts_y_origin*: cint - font*: TFont - subwindow_mode*: cint - graphics_exposures*: TBool - clip_x_origin*: cint - clip_y_origin*: cint - clip_mask*: TPixmap - dash_offset*: cint - dashes*: cchar - - PXGC* = ptr TXGC - TXGC*{.final.} = object - TGC* = PXGC - PGC* = ptr TGC - PVisual* = ptr TVisual - TVisual*{.final.} = object - ext_data*: PXExtData - visualid*: TVisualID - c_class*: cint - red_mask*, green_mask*, blue_mask*: culong - bits_per_rgb*: cint - map_entries*: cint - - PDepth* = ptr TDepth - TDepth*{.final.} = object - depth*: cint - nvisuals*: cint - visuals*: PVisual - - PXDisplay* = ptr TXDisplay - TXDisplay*{.final.} = object - PScreen* = ptr TScreen - TScreen*{.final.} = object - ext_data*: PXExtData - display*: PXDisplay - root*: TWindow - width*, height*: cint - mwidth*, mheight*: cint - ndepths*: cint - depths*: PDepth - root_depth*: cint - root_visual*: PVisual - default_gc*: TGC - cmap*: TColormap - white_pixel*: culong - black_pixel*: culong - max_maps*, min_maps*: cint - backing_store*: cint - save_unders*: TBool - root_input_mask*: clong - - PScreenFormat* = ptr TScreenFormat - TScreenFormat*{.final.} = object - ext_data*: PXExtData - depth*: cint - bits_per_pixel*: cint - scanline_pad*: cint - - PXSetWindowAttributes* = ptr TXSetWindowAttributes - TXSetWindowAttributes*{.final.} = object - background_pixmap*: TPixmap - background_pixel*: culong - border_pixmap*: TPixmap - border_pixel*: culong - bit_gravity*: cint - win_gravity*: cint - backing_store*: cint - backing_planes*: culong - backing_pixel*: culong - save_under*: TBool - event_mask*: clong - do_not_propagate_mask*: clong - override_redirect*: TBool - colormap*: TColormap - cursor*: TCursor - - PXWindowAttributes* = ptr TXWindowAttributes - TXWindowAttributes*{.final.} = object - x*, y*: cint - width*, height*: cint - border_width*: cint - depth*: cint - visual*: PVisual - root*: TWindow - c_class*: cint - bit_gravity*: cint - win_gravity*: cint - backing_store*: cint - backing_planes*: culong - backing_pixel*: culong - save_under*: TBool - colormap*: TColormap - map_installed*: TBool - map_state*: cint - all_event_masks*: clong - your_event_mask*: clong - do_not_propagate_mask*: clong - override_redirect*: TBool - screen*: PScreen - - PXHostAddress* = ptr TXHostAddress - TXHostAddress*{.final.} = object - family*: cint - len*: cint - address*: cstring - - PXServerInterpretedAddress* = ptr TXServerInterpretedAddress - TXServerInterpretedAddress*{.final.} = object - typelength*: cint - valuelength*: cint - theType*: cstring - value*: cstring - - PXImage* = ptr TXImage - TF*{.final.} = object - create_image*: proc (para1: PXDisplay, para2: PVisual, para3: cuint, - para4: cint, para5: cint, para6: cstring, para7: cuint, - para8: cuint, para9: cint, para10: cint): PXImage{. - cdecl.} - destroy_image*: proc (para1: PXImage): cint{.cdecl.} - get_pixel*: proc (para1: PXImage, para2: cint, para3: cint): culong{.cdecl.} - put_pixel*: proc (para1: PXImage, para2: cint, para3: cint, para4: culong): cint{. - cdecl.} - sub_image*: proc (para1: PXImage, para2: cint, para3: cint, para4: cuint, - para5: cuint): PXImage{.cdecl.} - add_pixel*: proc (para1: PXImage, para2: clong): cint{.cdecl.} - - TXImage*{.final.} = object - width*, height*: cint - xoffset*: cint - format*: cint - data*: cstring - byte_order*: cint - bitmap_unit*: cint - bitmap_bit_order*: cint - bitmap_pad*: cint - depth*: cint - bytes_per_line*: cint - bits_per_pixel*: cint - red_mask*: culong - green_mask*: culong - blue_mask*: culong - obdata*: TXPointer - f*: TF - - PXWindowChanges* = ptr TXWindowChanges - TXWindowChanges*{.final.} = object - x*, y*: cint - width*, height*: cint - border_width*: cint - sibling*: TWindow - stack_mode*: cint - - PXColor* = ptr TXColor - TXColor*{.final.} = object - pixel*: culong - red*, green*, blue*: cushort - flags*: cchar - pad*: cchar - - PXSegment* = ptr TXSegment - TXSegment*{.final.} = object - x1*, y1*, x2*, y2*: cshort - - PXPoint* = ptr TXPoint - TXPoint*{.final.} = object - x*, y*: cshort - - PXRectangle* = ptr TXRectangle - TXRectangle*{.final.} = object - x*, y*: cshort - width*, height*: cushort - - PXArc* = ptr TXArc - TXArc*{.final.} = object - x*, y*: cshort - width*, height*: cushort - angle1*, angle2*: cshort - - PXKeyboardControl* = ptr TXKeyboardControl - TXKeyboardControl*{.final.} = object - key_click_percent*: cint - bell_percent*: cint - bell_pitch*: cint - bell_duration*: cint - led*: cint - led_mode*: cint - key*: cint - auto_repeat_mode*: cint - - PXKeyboardState* = ptr TXKeyboardState - TXKeyboardState*{.final.} = object - key_click_percent*: cint - bell_percent*: cint - bell_pitch*, bell_duration*: cuint - led_mask*: culong - global_auto_repeat*: cint - auto_repeats*: array[0..31, cchar] - - PXTimeCoord* = ptr TXTimeCoord - TXTimeCoord*{.final.} = object - time*: TTime - x*, y*: cshort - - PXModifierKeymap* = ptr TXModifierKeymap - TXModifierKeymap*{.final.} = object - max_keypermod*: cint - modifiermap*: PKeyCode - - PDisplay* = ptr TDisplay - TDisplay* = TXDisplay - PXPrivate* = ptr TXPrivate - TXPrivate*{.final.} = object - PXrmHashBucketRec* = ptr TXrmHashBucketRec - TXrmHashBucketRec*{.final.} = object - PXPrivDisplay* = ptr TXPrivDisplay - TXPrivDisplay*{.final.} = object - ext_data*: PXExtData - private1*: PXPrivate - fd*: cint - private2*: cint - proto_major_version*: cint - proto_minor_version*: cint - vendor*: cstring - private3*: TXID - private4*: TXID - private5*: TXID - private6*: cint - resource_alloc*: proc (para1: PXDisplay): TXID{.cdecl.} - byte_order*: cint - bitmap_unit*: cint - bitmap_pad*: cint - bitmap_bit_order*: cint - nformats*: cint - pixmap_format*: PScreenFormat - private8*: cint - release*: cint - private9*, private10*: PXPrivate - qlen*: cint - last_request_read*: culong - request*: culong - private11*: TXPointer - private12*: TXPointer - private13*: TXPointer - private14*: TXPointer - max_request_size*: cunsigned - db*: PXrmHashBucketRec - private15*: proc (para1: PXDisplay): cint{.cdecl.} - display_name*: cstring - default_screen*: cint - nscreens*: cint - screens*: PScreen - motion_buffer*: culong - private16*: culong - min_keycode*: cint - max_keycode*: cint - private17*: TXPointer - private18*: TXPointer - private19*: cint - xdefaults*: cstring - - PXKeyEvent* = ptr TXKeyEvent - TXKeyEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - root*: TWindow - subwindow*: TWindow - time*: TTime - x*, y*: cint - x_root*, y_root*: cint - state*: cuint - keycode*: cuint - same_screen*: TBool - - PXKeyPressedEvent* = ptr TXKeyPressedEvent - TXKeyPressedEvent* = TXKeyEvent - PXKeyReleasedEvent* = ptr TXKeyReleasedEvent - TXKeyReleasedEvent* = TXKeyEvent - PXButtonEvent* = ptr TXButtonEvent - TXButtonEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - root*: TWindow - subwindow*: TWindow - time*: TTime - x*, y*: cint - x_root*, y_root*: cint - state*: cuint - button*: cuint - same_screen*: TBool - - PXButtonPressedEvent* = ptr TXButtonPressedEvent - TXButtonPressedEvent* = TXButtonEvent - PXButtonReleasedEvent* = ptr TXButtonReleasedEvent - TXButtonReleasedEvent* = TXButtonEvent - PXMotionEvent* = ptr TXMotionEvent - TXMotionEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - root*: TWindow - subwindow*: TWindow - time*: TTime - x*, y*: cint - x_root*, y_root*: cint - state*: cuint - is_hint*: cchar - same_screen*: TBool - - PXPointerMovedEvent* = ptr TXPointerMovedEvent - TXPointerMovedEvent* = TXMotionEvent - PXCrossingEvent* = ptr TXCrossingEvent - TXCrossingEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - root*: TWindow - subwindow*: TWindow - time*: TTime - x*, y*: cint - x_root*, y_root*: cint - mode*: cint - detail*: cint - same_screen*: TBool - focus*: TBool - state*: cuint - - PXEnterWindowEvent* = ptr TXEnterWindowEvent - TXEnterWindowEvent* = TXCrossingEvent - PXLeaveWindowEvent* = ptr TXLeaveWindowEvent - TXLeaveWindowEvent* = TXCrossingEvent - PXFocusChangeEvent* = ptr TXFocusChangeEvent - TXFocusChangeEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - mode*: cint - detail*: cint - - PXFocusInEvent* = ptr TXFocusInEvent - TXFocusInEvent* = TXFocusChangeEvent - PXFocusOutEvent* = ptr TXFocusOutEvent - TXFocusOutEvent* = TXFocusChangeEvent - PXKeymapEvent* = ptr TXKeymapEvent - TXKeymapEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - key_vector*: array[0..31, cchar] - - PXExposeEvent* = ptr TXExposeEvent - TXExposeEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - x*, y*: cint - width*, height*: cint - count*: cint - - PXGraphicsExposeEvent* = ptr TXGraphicsExposeEvent - TXGraphicsExposeEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - drawable*: TDrawable - x*, y*: cint - width*, height*: cint - count*: cint - major_code*: cint - minor_code*: cint - - PXNoExposeEvent* = ptr TXNoExposeEvent - TXNoExposeEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - drawable*: TDrawable - major_code*: cint - minor_code*: cint - - PXVisibilityEvent* = ptr TXVisibilityEvent - TXVisibilityEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - state*: cint - - PXCreateWindowEvent* = ptr TXCreateWindowEvent - TXCreateWindowEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - parent*: TWindow - window*: TWindow - x*, y*: cint - width*, height*: cint - border_width*: cint - override_redirect*: TBool - - PXDestroyWindowEvent* = ptr TXDestroyWindowEvent - TXDestroyWindowEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - - PXUnmapEvent* = ptr TXUnmapEvent - TXUnmapEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - from_configure*: TBool - - PXMapEvent* = ptr TXMapEvent - TXMapEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - override_redirect*: TBool - - PXMapRequestEvent* = ptr TXMapRequestEvent - TXMapRequestEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - parent*: TWindow - window*: TWindow - - PXReparentEvent* = ptr TXReparentEvent - TXReparentEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - parent*: TWindow - x*, y*: cint - override_redirect*: TBool - - PXConfigureEvent* = ptr TXConfigureEvent - TXConfigureEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - x*, y*: cint - width*, height*: cint - border_width*: cint - above*: TWindow - override_redirect*: TBool - - PXGravityEvent* = ptr TXGravityEvent - TXGravityEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - x*, y*: cint - - PXResizeRequestEvent* = ptr TXResizeRequestEvent - TXResizeRequestEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - width*, height*: cint - - PXConfigureRequestEvent* = ptr TXConfigureRequestEvent - TXConfigureRequestEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - parent*: TWindow - window*: TWindow - x*, y*: cint - width*, height*: cint - border_width*: cint - above*: TWindow - detail*: cint - value_mask*: culong - - PXCirculateEvent* = ptr TXCirculateEvent - TXCirculateEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - event*: TWindow - window*: TWindow - place*: cint - - PXCirculateRequestEvent* = ptr TXCirculateRequestEvent - TXCirculateRequestEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - parent*: TWindow - window*: TWindow - place*: cint - - PXPropertyEvent* = ptr TXPropertyEvent - TXPropertyEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - atom*: TAtom - time*: TTime - state*: cint - - PXSelectionClearEvent* = ptr TXSelectionClearEvent - TXSelectionClearEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - selection*: TAtom - time*: TTime - - PXSelectionRequestEvent* = ptr TXSelectionRequestEvent - TXSelectionRequestEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - owner*: TWindow - requestor*: TWindow - selection*: TAtom - target*: TAtom - property*: TAtom - time*: TTime - - PXSelectionEvent* = ptr TXSelectionEvent - TXSelectionEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - requestor*: TWindow - selection*: TAtom - target*: TAtom - property*: TAtom - time*: TTime - - PXColormapEvent* = ptr TXColormapEvent - TXColormapEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - colormap*: TColormap - c_new*: TBool - state*: cint - - PXClientMessageEvent* = ptr TXClientMessageEvent - TXClientMessageEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - message_type*: TAtom - format*: cint - data*: array[0..4, clong] # using clong here to be 32/64-bit dependent - # as the original C union - - PXMappingEvent* = ptr TXMappingEvent - TXMappingEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - request*: cint - first_keycode*: cint - count*: cint - - PXErrorEvent* = ptr TXErrorEvent - TXErrorEvent*{.final.} = object - theType*: cint - display*: PDisplay - resourceid*: TXID - serial*: culong - error_code*: cuchar - request_code*: cuchar - minor_code*: cuchar - - PXAnyEvent* = ptr TXAnyEvent - TXAnyEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - window*: TWindow - - PXEvent* = ptr TXEvent - TXEvent*{.final.} = object - theType*: cint - pad*: array[0..22, clong] # - # case longint of - # 0 : ( theType : cint ); - # 1 : ( xany : TXAnyEvent ); - # 2 : ( xkey : TXKeyEvent ); - # 3 : ( xbutton : TXButtonEvent ); - # 4 : ( xmotion : TXMotionEvent ); - # 5 : ( xcrossing : TXCrossingEvent ); - # 6 : ( xfocus : TXFocusChangeEvent ); - # 7 : ( xexpose : TXExposeEvent ); - # 8 : ( xgraphicsexpose : TXGraphicsExposeEvent ); - # 9 : ( xnoexpose : TXNoExposeEvent ); - # 10 : ( xvisibility : TXVisibilityEvent ); - # 11 : ( xcreatewindow : TXCreateWindowEvent ); - # 12 : ( xdestroywindow : TXDestroyWindowEvent ); - # 13 : ( xunmap : TXUnmapEvent ); - # 14 : ( xmap : TXMapEvent ); - # 15 : ( xmaprequest : TXMapRequestEvent ); - # 16 : ( xreparent : TXReparentEvent ); - # 17 : ( xconfigure : TXConfigureEvent ); - # 18 : ( xgravity : TXGravityEvent ); - # 19 : ( xresizerequest : TXResizeRequestEvent ); - # 20 : ( xconfigurerequest : TXConfigureRequestEvent ); - # 21 : ( xcirculate : TXCirculateEvent ); - # 22 : ( xcirculaterequest : TXCirculateRequestEvent ); - # 23 : ( xproperty : TXPropertyEvent ); - # 24 : ( xselectionclear : TXSelectionClearEvent ); - # 25 : ( xselectionrequest : TXSelectionRequestEvent ); - # 26 : ( xselection : TXSelectionEvent ); - # 27 : ( xcolormap : TXColormapEvent ); - # 28 : ( xclient : TXClientMessageEvent ); - # 29 : ( xmapping : TXMappingEvent ); - # 30 : ( xerror : TXErrorEvent ); - # 31 : ( xkeymap : TXKeymapEvent ); - # 32 : ( pad : array[0..23] of clong ); - # - - -proc xclient*(e: PXEvent): PXClientMessageEvent = - ## Treats XEvent as XClientMessageEvent - return cast[PXClientMessageEvent](e) - -proc xclient*(e: var TXEvent): PXClientMessageEvent = - return xclient(PXEvent(e.addr)) - -type - PXCharStruct* = ptr TXCharStruct - TXCharStruct*{.final.} = object - lbearing*: cshort - rbearing*: cshort - width*: cshort - ascent*: cshort - descent*: cshort - attributes*: cushort - - PXFontProp* = ptr TXFontProp - TXFontProp*{.final.} = object - name*: TAtom - card32*: culong - - PPPXFontStruct* = ptr PPXFontStruct - PPXFontStruct* = ptr PXFontStruct - PXFontStruct* = ptr TXFontStruct - TXFontStruct*{.final.} = object - ext_data*: PXExtData - fid*: TFont - direction*: cunsigned - min_char_or_byte2*: cunsigned - max_char_or_byte2*: cunsigned - min_byte1*: cunsigned - max_byte1*: cunsigned - all_chars_exist*: TBool - default_char*: cunsigned - n_properties*: cint - properties*: PXFontProp - min_bounds*: TXCharStruct - max_bounds*: TXCharStruct - per_char*: PXCharStruct - ascent*: cint - descent*: cint - - PXTextItem* = ptr TXTextItem - TXTextItem*{.final.} = object - chars*: cstring - nchars*: cint - delta*: cint - font*: TFont - - PXChar2b* = ptr TXChar2b - TXChar2b*{.final.} = object - byte1*: cuchar - byte2*: cuchar - - PXTextItem16* = ptr TXTextItem16 - TXTextItem16*{.final.} = object - chars*: PXChar2b - nchars*: cint - delta*: cint - font*: TFont - - PXEDataObject* = ptr TXEDataObject - TXEDataObject*{.final.} = object - display*: PDisplay #case longint of - # 0 : ( display : PDisplay ); - # 1 : ( gc : TGC ); - # 2 : ( visual : PVisual ); - # 3 : ( screen : PScreen ); - # 4 : ( pixmap_format : PScreenFormat ); - # 5 : ( font : PXFontStruct ); - - PXFontSetExtents* = ptr TXFontSetExtents - TXFontSetExtents*{.final.} = object - max_ink_extent*: TXRectangle - max_logical_extent*: TXRectangle - - PXOM* = ptr TXOM - TXOM*{.final.} = object - PXOC* = ptr TXOC - TXOC*{.final.} = object - TXFontSet* = PXOC - PXFontSet* = ptr TXFontSet - PXmbTextItem* = ptr TXmbTextItem - TXmbTextItem*{.final.} = object - chars*: cstring - nchars*: cint - delta*: cint - font_set*: TXFontSet - - PXwcTextItem* = ptr TXwcTextItem - TXwcTextItem*{.final.} = object - chars*: PWideChar #wchar_t* - nchars*: cint - delta*: cint - font_set*: TXFontSet - - -const - XNRequiredCharSet* = "requiredCharSet" - XNQueryOrientation* = "queryOrientation" - XNBaseFontName* = "baseFontName" - XNOMAutomatic* = "omAutomatic" - XNMissingCharSet* = "missingCharSet" - XNDefaultString* = "defaultString" - XNOrientation* = "orientation" - XNDirectionalDependentDrawing* = "directionalDependentDrawing" - XNContextualDrawing* = "contextualDrawing" - XNFontInfo* = "fontInfo" - -type - PXOMCharSetList* = ptr TXOMCharSetList - TXOMCharSetList*{.final.} = object - charset_count*: cint - charset_list*: PPChar - - PXOrientation* = ptr TXOrientation - TXOrientation* = enum - XOMOrientation_LTR_TTB, XOMOrientation_RTL_TTB, XOMOrientation_TTB_LTR, - XOMOrientation_TTB_RTL, XOMOrientation_Context - PXOMOrientation* = ptr TXOMOrientation - TXOMOrientation*{.final.} = object - num_orientation*: cint - orientation*: PXOrientation - - PXOMFontInfo* = ptr TXOMFontInfo - TXOMFontInfo*{.final.} = object - num_font*: cint - font_struct_list*: ptr PXFontStruct - font_name_list*: PPChar - - PXIM* = ptr TXIM - TXIM*{.final.} = object - PXIC* = ptr TXIC - TXIC*{.final.} = object - TXIMProc* = proc (para1: TXIM, para2: TXPointer, para3: TXPointer){.cdecl.} - TXICProc* = proc (para1: TXIC, para2: TXPointer, para3: TXPointer): TBool{. - cdecl.} - TXIDProc* = proc (para1: PDisplay, para2: TXPointer, para3: TXPointer){.cdecl.} - PXIMStyle* = ptr TXIMStyle - TXIMStyle* = culong - PXIMStyles* = ptr TXIMStyles - TXIMStyles*{.final.} = object - count_styles*: cushort - supported_styles*: PXIMStyle - - -const - XIMPreeditArea* = 0x00000001 - XIMPreeditCallbacks* = 0x00000002 - XIMPreeditPosition* = 0x00000004 - XIMPreeditNothing* = 0x00000008 - XIMPreeditNone* = 0x00000010 - XIMStatusArea* = 0x00000100 - XIMStatusCallbacks* = 0x00000200 - XIMStatusNothing* = 0x00000400 - XIMStatusNone* = 0x00000800 - XNVaNestedList* = "XNVaNestedList" - XNQueryInputStyle* = "queryInputStyle" - XNClientWindow* = "clientWindow" - XNInputStyle* = "inputStyle" - XNFocusWindow* = "focusWindow" - XNResourceName* = "resourceName" - XNResourceClass* = "resourceClass" - XNGeometryCallback* = "geometryCallback" - XNDestroyCallback* = "destroyCallback" - XNFilterEvents* = "filterEvents" - XNPreeditStartCallback* = "preeditStartCallback" - XNPreeditDoneCallback* = "preeditDoneCallback" - XNPreeditDrawCallback* = "preeditDrawCallback" - XNPreeditCaretCallback* = "preeditCaretCallback" - XNPreeditStateNotifyCallback* = "preeditStateNotifyCallback" - XNPreeditAttributes* = "preeditAttributes" - XNStatusStartCallback* = "statusStartCallback" - XNStatusDoneCallback* = "statusDoneCallback" - XNStatusDrawCallback* = "statusDrawCallback" - XNStatusAttributes* = "statusAttributes" - XNArea* = "area" - XNAreaNeeded* = "areaNeeded" - XNSpotLocation* = "spotLocation" - XNColormap* = "colorMap" - XNStdColormap* = "stdColorMap" - XNForeground* = "foreground" - XNBackground* = "background" - XNBackgroundPixmap* = "backgroundPixmap" - XNFontSet* = "fontSet" - XNLineSpace* = "lineSpace" - XNCursor* = "cursor" - XNQueryIMValuesList* = "queryIMValuesList" - XNQueryICValuesList* = "queryICValuesList" - XNVisiblePosition* = "visiblePosition" - XNR6PreeditCallback* = "r6PreeditCallback" - XNStringConversionCallback* = "stringConversionCallback" - XNStringConversion* = "stringConversion" - XNResetState* = "resetState" - XNHotKey* = "hotKey" - XNHotKeyState* = "hotKeyState" - XNPreeditState* = "preeditState" - XNSeparatorofNestedList* = "separatorofNestedList" - XBufferOverflow* = - (1) - XLookupNone* = 1 - XLookupChars* = 2 - XLookupKeySymVal* = 3 - XLookupBoth* = 4 - -type - PXVaNestedList* = ptr TXVaNestedList - TXVaNestedList* = pointer - PXIMCallback* = ptr TXIMCallback - TXIMCallback*{.final.} = object - client_data*: TXPointer - callback*: TXIMProc - - PXICCallback* = ptr TXICCallback - TXICCallback*{.final.} = object - client_data*: TXPointer - callback*: TXICProc - - PXIMFeedback* = ptr TXIMFeedback - TXIMFeedback* = culong - -const - XIMReverse* = 1 - XIMUnderline* = 1 shl 1 - XIMHighlight* = 1 shl 2 - XIMPrimary* = 1 shl 5 - XIMSecondary* = 1 shl 6 - XIMTertiary* = 1 shl 7 - XIMVisibleToForward* = 1 shl 8 - XIMVisibleToBackword* = 1 shl 9 - XIMVisibleToCenter* = 1 shl 10 - -type - PXIMText* = ptr TXIMText - TXIMText*{.final.} = object - len*: cushort - feedback*: PXIMFeedback - encoding_is_wchar*: TBool - multi_byte*: cstring - - PXIMPreeditState* = ptr TXIMPreeditState - TXIMPreeditState* = culong - -const - XIMPreeditUnKnown* = 0 - XIMPreeditEnable* = 1 - XIMPreeditDisable* = 1 shl 1 - -type - PXIMPreeditStateNotifyCallbackStruct* = ptr TXIMPreeditStateNotifyCallbackStruct - TXIMPreeditStateNotifyCallbackStruct*{.final.} = object - state*: TXIMPreeditState - - PXIMResetState* = ptr TXIMResetState - TXIMResetState* = culong - -const - XIMInitialState* = 1 - XIMPreserveState* = 1 shl 1 - -type - PXIMStringConversionFeedback* = ptr TXIMStringConversionFeedback - TXIMStringConversionFeedback* = culong - -const - XIMStringConversionLeftEdge* = 0x00000001 - XIMStringConversionRightEdge* = 0x00000002 - XIMStringConversionTopEdge* = 0x00000004 - XIMStringConversionBottomEdge* = 0x00000008 - XIMStringConversionConcealed* = 0x00000010 - XIMStringConversionWrapped* = 0x00000020 - -type - PXIMStringConversionText* = ptr TXIMStringConversionText - TXIMStringConversionText*{.final.} = object - len*: cushort - feedback*: PXIMStringConversionFeedback - encoding_is_wchar*: TBool - mbs*: cstring - - PXIMStringConversionPosition* = ptr TXIMStringConversionPosition - TXIMStringConversionPosition* = cushort - PXIMStringConversionType* = ptr TXIMStringConversionType - TXIMStringConversionType* = cushort - -const - XIMStringConversionBuffer* = 0x00000001 - XIMStringConversionLine* = 0x00000002 - XIMStringConversionWord* = 0x00000003 - XIMStringConversionChar* = 0x00000004 - -type - PXIMStringConversionOperation* = ptr TXIMStringConversionOperation - TXIMStringConversionOperation* = cushort - -const - XIMStringConversionSubstitution* = 0x00000001 - XIMStringConversionRetrieval* = 0x00000002 - -type - PXIMCaretDirection* = ptr TXIMCaretDirection - TXIMCaretDirection* = enum - XIMForwardChar, XIMBackwardChar, XIMForwardWord, XIMBackwardWord, - XIMCaretUp, XIMCaretDown, XIMNextLine, XIMPreviousLine, XIMLineStart, - XIMLineEnd, XIMAbsolutePosition, XIMDontChange - PXIMStringConversionCallbackStruct* = ptr TXIMStringConversionCallbackStruct - TXIMStringConversionCallbackStruct*{.final.} = object - position*: TXIMStringConversionPosition - direction*: TXIMCaretDirection - operation*: TXIMStringConversionOperation - factor*: cushort - text*: PXIMStringConversionText - - PXIMPreeditDrawCallbackStruct* = ptr TXIMPreeditDrawCallbackStruct - TXIMPreeditDrawCallbackStruct*{.final.} = object - caret*: cint - chg_first*: cint - chg_length*: cint - text*: PXIMText - - PXIMCaretStyle* = ptr TXIMCaretStyle - TXIMCaretStyle* = enum - XIMIsInvisible, XIMIsPrimary, XIMIsSecondary - PXIMPreeditCaretCallbackStruct* = ptr TXIMPreeditCaretCallbackStruct - TXIMPreeditCaretCallbackStruct*{.final.} = object - position*: cint - direction*: TXIMCaretDirection - style*: TXIMCaretStyle - - PXIMStatusDataType* = ptr TXIMStatusDataType - TXIMStatusDataType* = enum - XIMTextType, XIMBitmapType - PXIMStatusDrawCallbackStruct* = ptr TXIMStatusDrawCallbackStruct - TXIMStatusDrawCallbackStruct*{.final.} = object - theType*: TXIMStatusDataType - bitmap*: TPixmap - - PXIMHotKeyTrigger* = ptr TXIMHotKeyTrigger - TXIMHotKeyTrigger*{.final.} = object - keysym*: TKeySym - modifier*: cint - modifier_mask*: cint - - PXIMHotKeyTriggers* = ptr TXIMHotKeyTriggers - TXIMHotKeyTriggers*{.final.} = object - num_hot_key*: cint - key*: PXIMHotKeyTrigger - - PXIMHotKeyState* = ptr TXIMHotKeyState - TXIMHotKeyState* = culong - -const - XIMHotKeyStateON* = 0x00000001 - XIMHotKeyStateOFF* = 0x00000002 - -type - PXIMValuesList* = ptr TXIMValuesList - TXIMValuesList*{.final.} = object - count_values*: cushort - supported_values*: PPChar - - -type - funcdisp* = proc (display: PDisplay): cint{.cdecl.} - funcifevent* = proc (display: PDisplay, event: PXEvent, p: TXPointer): TBool{. - cdecl.} - chararr32* = array[0..31, char] - -const - AllPlanes*: culong = culong(not 0) - -proc XLoadQueryFont*(para1: PDisplay, para2: cstring): PXFontStruct{.libx11.} -proc XQueryFont*(para1: PDisplay, para2: TXID): PXFontStruct{.libx11.} -proc XGetMotionEvents*(para1: PDisplay, para2: TWindow, para3: TTime, - para4: TTime, para5: Pcint): PXTimeCoord{.libx11.} -proc XDeleteModifiermapEntry*(para1: PXModifierKeymap, para2: TKeyCode, - para3: cint): PXModifierKeymap{.libx11.} -proc XGetModifierMapping*(para1: PDisplay): PXModifierKeymap{.libx11.} -proc XInsertModifiermapEntry*(para1: PXModifierKeymap, para2: TKeyCode, - para3: cint): PXModifierKeymap{.libx11.} -proc XNewModifiermap*(para1: cint): PXModifierKeymap{.libx11.} -proc XCreateImage*(para1: PDisplay, para2: PVisual, para3: cuint, para4: cint, - para5: cint, para6: cstring, para7: cuint, para8: cuint, - para9: cint, para10: cint): PXImage{.libx11.} -proc XInitImage*(para1: PXImage): TStatus{.libx11.} -proc XGetImage*(para1: PDisplay, para2: TDrawable, para3: cint, para4: cint, - para5: cuint, para6: cuint, para7: culong, para8: cint): PXImage{. - libx11.} -proc XGetSubImage*(para1: PDisplay, para2: TDrawable, para3: cint, para4: cint, - para5: cuint, para6: cuint, para7: culong, para8: cint, - para9: PXImage, para10: cint, para11: cint): PXImage{.libx11.} -proc XOpenDisplay*(para1: cstring): PDisplay{.libx11.} -proc XrmInitialize*(){.libx11.} -proc XFetchBytes*(para1: PDisplay, para2: Pcint): cstring{.libx11.} -proc XFetchBuffer*(para1: PDisplay, para2: Pcint, para3: cint): cstring{.libx11.} -proc XGetAtomName*(para1: PDisplay, para2: TAtom): cstring{.libx11.} -proc XGetAtomNames*(para1: PDisplay, para2: PAtom, para3: cint, para4: PPchar): TStatus{. - libx11.} -proc XGetDefault*(para1: PDisplay, para2: cstring, para3: cstring): cstring{. - libx11.} -proc XDisplayName*(para1: cstring): cstring{.libx11.} -proc XKeysymToString*(para1: TKeySym): cstring{.libx11.} -proc XSynchronize*(para1: PDisplay, para2: TBool): funcdisp{.libx11.} -proc XSetAfterFunction*(para1: PDisplay, para2: funcdisp): funcdisp{.libx11.} -proc XInternAtom*(para1: PDisplay, para2: cstring, para3: TBool): TAtom{.libx11.} -proc XInternAtoms*(para1: PDisplay, para2: PPchar, para3: cint, para4: TBool, - para5: PAtom): TStatus{.libx11.} -proc XCopyColormapAndFree*(para1: PDisplay, para2: TColormap): TColormap{.libx11.} -proc XCreateColormap*(para1: PDisplay, para2: TWindow, para3: PVisual, - para4: cint): TColormap{.libx11.} -proc XCreatePixmapCursor*(para1: PDisplay, para2: TPixmap, para3: TPixmap, - para4: PXColor, para5: PXColor, para6: cuint, - para7: cuint): TCursor{.libx11.} -proc XCreateGlyphCursor*(para1: PDisplay, para2: TFont, para3: TFont, - para4: cuint, para5: cuint, para6: PXColor, - para7: PXColor): TCursor{.libx11.} -proc XCreateFontCursor*(para1: PDisplay, para2: cuint): TCursor{.libx11.} -proc XLoadFont*(para1: PDisplay, para2: cstring): TFont{.libx11.} -proc XCreateGC*(para1: PDisplay, para2: TDrawable, para3: culong, - para4: PXGCValues): TGC{.libx11.} -proc XGContextFromGC*(para1: TGC): TGContext{.libx11.} -proc XFlushGC*(para1: PDisplay, para2: TGC){.libx11.} -proc XCreatePixmap*(para1: PDisplay, para2: TDrawable, para3: cuint, - para4: cuint, para5: cuint): TPixmap{.libx11.} -proc XCreateBitmapFromData*(para1: PDisplay, para2: TDrawable, para3: cstring, - para4: cuint, para5: cuint): TPixmap{.libx11.} -proc XCreatePixmapFromBitmapData*(para1: PDisplay, para2: TDrawable, - para3: cstring, para4: cuint, para5: cuint, - para6: culong, para7: culong, para8: cuint): TPixmap{. - libx11.} -proc XCreateSimpleWindow*(para1: PDisplay, para2: TWindow, para3: cint, - para4: cint, para5: cuint, para6: cuint, para7: cuint, - para8: culong, para9: culong): TWindow{.libx11.} -proc XGetSelectionOwner*(para1: PDisplay, para2: TAtom): TWindow{.libx11.} -proc XCreateWindow*(para1: PDisplay, para2: TWindow, para3: cint, para4: cint, - para5: cuint, para6: cuint, para7: cuint, para8: cint, - para9: cuint, para10: PVisual, para11: culong, - para12: PXSetWindowAttributes): TWindow{.libx11.} -proc XListInstalledColormaps*(para1: PDisplay, para2: TWindow, para3: Pcint): PColormap{. - libx11.} -proc XListFonts*(para1: PDisplay, para2: cstring, para3: cint, para4: Pcint): PPChar{. - libx11.} -proc XListFontsWithInfo*(para1: PDisplay, para2: cstring, para3: cint, - para4: Pcint, para5: PPXFontStruct): PPChar{.libx11.} -proc XGetFontPath*(para1: PDisplay, para2: Pcint): PPChar{.libx11.} -proc XListExtensions*(para1: PDisplay, para2: Pcint): PPChar{.libx11.} -proc XListProperties*(para1: PDisplay, para2: TWindow, para3: Pcint): PAtom{. - libx11.} -proc XListHosts*(para1: PDisplay, para2: Pcint, para3: PBool): PXHostAddress{. - libx11.} -proc XKeycodeToKeysym*(para1: PDisplay, para2: TKeyCode, para3: cint): TKeySym{. - libx11.} -proc XLookupKeysym*(para1: PXKeyEvent, para2: cint): TKeySym{.libx11.} -proc XGetKeyboardMapping*(para1: PDisplay, para2: TKeyCode, para3: cint, - para4: Pcint): PKeySym{.libx11.} -proc XStringToKeysym*(para1: cstring): TKeySym{.libx11.} -proc XMaxRequestSize*(para1: PDisplay): clong{.libx11.} -proc XExtendedMaxRequestSize*(para1: PDisplay): clong{.libx11.} -proc XResourceManagerString*(para1: PDisplay): cstring{.libx11.} -proc XScreenResourceString*(para1: PScreen): cstring{.libx11.} -proc XDisplayMotionBufferSize*(para1: PDisplay): culong{.libx11.} -proc XVisualIDFromVisual*(para1: PVisual): TVisualID{.libx11.} -proc XInitThreads*(): TStatus{.libx11.} -proc XLockDisplay*(para1: PDisplay){.libx11.} -proc XUnlockDisplay*(para1: PDisplay){.libx11.} -proc XInitExtension*(para1: PDisplay, para2: cstring): PXExtCodes{.libx11.} -proc XAddExtension*(para1: PDisplay): PXExtCodes{.libx11.} -proc XFindOnExtensionList*(para1: PPXExtData, para2: cint): PXExtData{.libx11.} -proc XEHeadOfExtensionList*(para1: TXEDataObject): PPXExtData{.libx11.} -proc XRootWindow*(para1: PDisplay, para2: cint): TWindow{.libx11.} -proc XDefaultRootWindow*(para1: PDisplay): TWindow{.libx11.} -proc XRootWindowOfScreen*(para1: PScreen): TWindow{.libx11.} -proc XDefaultVisual*(para1: PDisplay, para2: cint): PVisual{.libx11.} -proc XDefaultVisualOfScreen*(para1: PScreen): PVisual{.libx11.} -proc XDefaultGC*(para1: PDisplay, para2: cint): TGC{.libx11.} -proc XDefaultGCOfScreen*(para1: PScreen): TGC{.libx11.} -proc XBlackPixel*(para1: PDisplay, para2: cint): culong{.libx11.} -proc XWhitePixel*(para1: PDisplay, para2: cint): culong{.libx11.} -proc XAllPlanes*(): culong{.libx11.} -proc XBlackPixelOfScreen*(para1: PScreen): culong{.libx11.} -proc XWhitePixelOfScreen*(para1: PScreen): culong{.libx11.} -proc XNextRequest*(para1: PDisplay): culong{.libx11.} -proc XLastKnownRequestProcessed*(para1: PDisplay): culong{.libx11.} -proc XServerVendor*(para1: PDisplay): cstring{.libx11.} -proc XDisplayString*(para1: PDisplay): cstring{.libx11.} -proc XDefaultColormap*(para1: PDisplay, para2: cint): TColormap{.libx11.} -proc XDefaultColormapOfScreen*(para1: PScreen): TColormap{.libx11.} -proc XDisplayOfScreen*(para1: PScreen): PDisplay{.libx11.} -proc XScreenOfDisplay*(para1: PDisplay, para2: cint): PScreen{.libx11.} -proc XDefaultScreenOfDisplay*(para1: PDisplay): PScreen{.libx11.} -proc XEventMaskOfScreen*(para1: PScreen): clong{.libx11.} -proc XScreenNumberOfScreen*(para1: PScreen): cint{.libx11.} -type - TXErrorHandler* = proc (para1: PDisplay, para2: PXErrorEvent): cint{.cdecl.} - -proc XSetErrorHandler*(para1: TXErrorHandler): TXErrorHandler{.libx11.} -type - TXIOErrorHandler* = proc (para1: PDisplay): cint{.cdecl.} - -proc XSetIOErrorHandler*(para1: TXIOErrorHandler): TXIOErrorHandler{.libx11.} -proc XListPixmapFormats*(para1: PDisplay, para2: Pcint): PXPixmapFormatValues{. - libx11.} -proc XListDepths*(para1: PDisplay, para2: cint, para3: Pcint): Pcint{.libx11.} -proc XReconfigureWMWindow*(para1: PDisplay, para2: TWindow, para3: cint, - para4: cuint, para5: PXWindowChanges): TStatus{. - libx11.} -proc XGetWMProtocols*(para1: PDisplay, para2: TWindow, para3: PPAtom, - para4: Pcint): TStatus{.libx11.} -proc XSetWMProtocols*(para1: PDisplay, para2: TWindow, para3: PAtom, para4: cint): TStatus{. - libx11.} -proc XIconifyWindow*(para1: PDisplay, para2: TWindow, para3: cint): TStatus{. - libx11.} -proc XWithdrawWindow*(para1: PDisplay, para2: TWindow, para3: cint): TStatus{. - libx11.} -proc XGetCommand*(para1: PDisplay, para2: TWindow, para3: PPPchar, para4: Pcint): TStatus{. - libx11.} -proc XGetWMColormapWindows*(para1: PDisplay, para2: TWindow, para3: PPWindow, - para4: Pcint): TStatus{.libx11.} -proc XSetWMColormapWindows*(para1: PDisplay, para2: TWindow, para3: PWindow, - para4: cint): TStatus{.libx11.} -proc XFreeStringList*(para1: PPchar){.libx11.} -proc XSetTransientForHint*(para1: PDisplay, para2: TWindow, para3: TWindow): cint{. - libx11.} -proc XActivateScreenSaver*(para1: PDisplay): cint{.libx11.} -proc XAddHost*(para1: PDisplay, para2: PXHostAddress): cint{.libx11.} -proc XAddHosts*(para1: PDisplay, para2: PXHostAddress, para3: cint): cint{. - libx11.} -proc XAddToExtensionList*(para1: PPXExtData, para2: PXExtData): cint{.libx11.} -proc XAddToSaveSet*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XAllocColor*(para1: PDisplay, para2: TColormap, para3: PXColor): TStatus{. - libx11.} -proc XAllocColorCells*(para1: PDisplay, para2: TColormap, para3: TBool, - para4: Pculong, para5: cuint, para6: Pculong, - para7: cuint): TStatus{.libx11.} -proc XAllocColorPlanes*(para1: PDisplay, para2: TColormap, para3: TBool, - para4: Pculong, para5: cint, para6: cint, para7: cint, - para8: cint, para9: Pculong, para10: Pculong, - para11: Pculong): TStatus{.libx11.} -proc XAllocNamedColor*(para1: PDisplay, para2: TColormap, para3: cstring, - para4: PXColor, para5: PXColor): TStatus{.libx11.} -proc XAllowEvents*(para1: PDisplay, para2: cint, para3: TTime): cint{.libx11.} -proc XAutoRepeatOff*(para1: PDisplay): cint{.libx11.} -proc XAutoRepeatOn*(para1: PDisplay): cint{.libx11.} -proc XBell*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XBitmapBitOrder*(para1: PDisplay): cint{.libx11.} -proc XBitmapPad*(para1: PDisplay): cint{.libx11.} -proc XBitmapUnit*(para1: PDisplay): cint{.libx11.} -proc XCellsOfScreen*(para1: PScreen): cint{.libx11.} -proc XChangeActivePointerGrab*(para1: PDisplay, para2: cuint, para3: TCursor, - para4: TTime): cint{.libx11.} -proc XChangeGC*(para1: PDisplay, para2: TGC, para3: culong, para4: PXGCValues): cint{. - libx11.} -proc XChangeKeyboardControl*(para1: PDisplay, para2: culong, - para3: PXKeyboardControl): cint{.libx11.} -proc XChangeKeyboardMapping*(para1: PDisplay, para2: cint, para3: cint, - para4: PKeySym, para5: cint): cint{.libx11.} -proc XChangePointerControl*(para1: PDisplay, para2: TBool, para3: TBool, - para4: cint, para5: cint, para6: cint): cint{.libx11.} -proc XChangeProperty*(para1: PDisplay, para2: TWindow, para3: TAtom, - para4: TAtom, para5: cint, para6: cint, para7: Pcuchar, - para8: cint): cint{.libx11.} -proc XChangeSaveSet*(para1: PDisplay, para2: TWindow, para3: cint): cint{.libx11.} -proc XChangeWindowAttributes*(para1: PDisplay, para2: TWindow, para3: culong, - para4: PXSetWindowAttributes): cint{.libx11.} -proc XCheckIfEvent*(para1: PDisplay, para2: PXEvent, para3: funcifevent, - para4: TXPointer): TBool{.libx11.} -proc XCheckMaskEvent*(para1: PDisplay, para2: clong, para3: PXEvent): TBool{. - libx11.} -proc XCheckTypedEvent*(para1: PDisplay, para2: cint, para3: PXEvent): TBool{. - libx11.} -proc XCheckTypedWindowEvent*(para1: PDisplay, para2: TWindow, para3: cint, - para4: PXEvent): TBool{.libx11.} -proc XCheckWindowEvent*(para1: PDisplay, para2: TWindow, para3: clong, - para4: PXEvent): TBool{.libx11.} -proc XCirculateSubwindows*(para1: PDisplay, para2: TWindow, para3: cint): cint{. - libx11.} -proc XCirculateSubwindowsDown*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XCirculateSubwindowsUp*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XClearArea*(para1: PDisplay, para2: TWindow, para3: cint, para4: cint, - para5: cuint, para6: cuint, para7: TBool): cint{.libx11.} -proc XClearWindow*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XCloseDisplay*(para1: PDisplay): cint{.libx11.} -proc XConfigureWindow*(para1: PDisplay, para2: TWindow, para3: cuint, - para4: PXWindowChanges): cint{.libx11.} -proc XConnectionNumber*(para1: PDisplay): cint{.libx11.} -proc XConvertSelection*(para1: PDisplay, para2: TAtom, para3: TAtom, - para4: TAtom, para5: TWindow, para6: TTime): cint{. - libx11.} -proc XCopyArea*(para1: PDisplay, para2: TDrawable, para3: TDrawable, para4: TGC, - para5: cint, para6: cint, para7: cuint, para8: cuint, - para9: cint, para10: cint): cint{.libx11.} -proc XCopyGC*(para1: PDisplay, para2: TGC, para3: culong, para4: TGC): cint{. - libx11.} -proc XCopyPlane*(para1: PDisplay, para2: TDrawable, para3: TDrawable, - para4: TGC, para5: cint, para6: cint, para7: cuint, - para8: cuint, para9: cint, para10: cint, para11: culong): cint{. - libx11.} -proc XDefaultDepth*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDefaultDepthOfScreen*(para1: PScreen): cint{.libx11.} -proc XDefaultScreen*(para1: PDisplay): cint{.libx11.} -proc XDefineCursor*(para1: PDisplay, para2: TWindow, para3: TCursor): cint{. - libx11.} -proc XDeleteProperty*(para1: PDisplay, para2: TWindow, para3: TAtom): cint{. - libx11.} -proc XDestroyWindow*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XDestroySubwindows*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XDoesBackingStore*(para1: PScreen): cint{.libx11.} -proc XDoesSaveUnders*(para1: PScreen): TBool{.libx11.} -proc XDisableAccessControl*(para1: PDisplay): cint{.libx11.} -proc XDisplayCells*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDisplayHeight*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDisplayHeightMM*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDisplayKeycodes*(para1: PDisplay, para2: Pcint, para3: Pcint): cint{. - libx11.} -proc XDisplayPlanes*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDisplayWidth*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDisplayWidthMM*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XDrawArc*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: cuint, para7: cuint, para8: cint, para9: cint): cint{. - libx11.} -proc XDrawArcs*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: PXArc, - para5: cint): cint{.libx11.} -proc XDrawImageString*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: cint, para5: cint, para6: cstring, para7: cint): cint{. - libx11.} -proc XDrawImageString16*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: cint, para5: cint, para6: PXChar2b, para7: cint): cint{. - libx11.} -proc XDrawLine*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: cint, para7: cint): cint{.libx11.} -proc XDrawLines*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: PXPoint, - para5: cint, para6: cint): cint{.libx11.} -proc XDrawPoint*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint): cint{.libx11.} -proc XDrawPoints*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: PXPoint, - para5: cint, para6: cint): cint{.libx11.} -proc XDrawRectangle*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: cuint, para7: cuint): cint{.libx11.} -proc XDrawRectangles*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: PXRectangle, para5: cint): cint{.libx11.} -proc XDrawSegments*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: PXSegment, para5: cint): cint{.libx11.} -proc XDrawString*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: cstring, para7: cint): cint{.libx11.} -proc XDrawString16*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: PXChar2b, para7: cint): cint{.libx11.} -proc XDrawText*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: PXTextItem, para7: cint): cint{.libx11.} -proc XDrawText16*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: PXTextItem16, para7: cint): cint{.libx11.} -proc XEnableAccessControl*(para1: PDisplay): cint{.libx11.} -proc XEventsQueued*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XFetchName*(para1: PDisplay, para2: TWindow, para3: PPchar): TStatus{. - libx11.} -proc XFillArc*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: cuint, para7: cuint, para8: cint, para9: cint): cint{. - libx11.} -proc XFillArcs*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: PXArc, - para5: cint): cint{.libx11.} -proc XFillPolygon*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: PXPoint, para5: cint, para6: cint, para7: cint): cint{. - libx11.} -proc XFillRectangle*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: cuint, para7: cuint): cint{.libx11.} -proc XFillRectangles*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: PXRectangle, para5: cint): cint{.libx11.} -proc XFlush*(para1: PDisplay): cint{.libx11.} -proc XForceScreenSaver*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XFree*(para1: pointer): cint{.libx11.} -proc XFreeColormap*(para1: PDisplay, para2: TColormap): cint{.libx11.} -proc XFreeColors*(para1: PDisplay, para2: TColormap, para3: Pculong, - para4: cint, para5: culong): cint{.libx11.} -proc XFreeCursor*(para1: PDisplay, para2: TCursor): cint{.libx11.} -proc XFreeExtensionList*(para1: PPchar): cint{.libx11.} -proc XFreeFont*(para1: PDisplay, para2: PXFontStruct): cint{.libx11.} -proc XFreeFontInfo*(para1: PPchar, para2: PXFontStruct, para3: cint): cint{. - libx11.} -proc XFreeFontNames*(para1: PPchar): cint{.libx11.} -proc XFreeFontPath*(para1: PPchar): cint{.libx11.} -proc XFreeGC*(para1: PDisplay, para2: TGC): cint{.libx11.} -proc XFreeModifiermap*(para1: PXModifierKeymap): cint{.libx11.} -proc XFreePixmap*(para1: PDisplay, para2: TPixmap): cint{.libx11.} -proc XGeometry*(para1: PDisplay, para2: cint, para3: cstring, para4: cstring, - para5: cuint, para6: cuint, para7: cuint, para8: cint, - para9: cint, para10: Pcint, para11: Pcint, para12: Pcint, - para13: Pcint): cint{.libx11.} -proc XGetErrorDatabaseText*(para1: PDisplay, para2: cstring, para3: cstring, - para4: cstring, para5: cstring, para6: cint): cint{. - libx11.} -proc XGetErrorText*(para1: PDisplay, para2: cint, para3: cstring, para4: cint): cint{. - libx11.} -proc XGetFontProperty*(para1: PXFontStruct, para2: TAtom, para3: Pculong): TBool{. - libx11.} -proc XGetGCValues*(para1: PDisplay, para2: TGC, para3: culong, para4: PXGCValues): TStatus{. - libx11.} -proc XGetGeometry*(para1: PDisplay, para2: TDrawable, para3: PWindow, - para4: Pcint, para5: Pcint, para6: Pcuint, para7: Pcuint, - para8: Pcuint, para9: Pcuint): TStatus{.libx11.} -proc XGetIconName*(para1: PDisplay, para2: TWindow, para3: PPchar): TStatus{. - libx11.} -proc XGetInputFocus*(para1: PDisplay, para2: PWindow, para3: Pcint): cint{. - libx11.} -proc XGetKeyboardControl*(para1: PDisplay, para2: PXKeyboardState): cint{.libx11.} -proc XGetPointerControl*(para1: PDisplay, para2: Pcint, para3: Pcint, - para4: Pcint): cint{.libx11.} -proc XGetPointerMapping*(para1: PDisplay, para2: Pcuchar, para3: cint): cint{. - libx11.} -proc XGetScreenSaver*(para1: PDisplay, para2: Pcint, para3: Pcint, para4: Pcint, - para5: Pcint): cint{.libx11.} -proc XGetTransientForHint*(para1: PDisplay, para2: TWindow, para3: PWindow): TStatus{. - libx11.} -proc XGetWindowProperty*(para1: PDisplay, para2: TWindow, para3: TAtom, - para4: clong, para5: clong, para6: TBool, para7: TAtom, - para8: PAtom, para9: Pcint, para10: Pculong, - para11: Pculong, para12: PPcuchar): cint{.libx11.} -proc XGetWindowAttributes*(para1: PDisplay, para2: TWindow, - para3: PXWindowAttributes): TStatus{.libx11.} -proc XGrabButton*(para1: PDisplay, para2: cuint, para3: cuint, para4: TWindow, - para5: TBool, para6: cuint, para7: cint, para8: cint, - para9: TWindow, para10: TCursor): cint{.libx11.} -proc XGrabKey*(para1: PDisplay, para2: cint, para3: cuint, para4: TWindow, - para5: TBool, para6: cint, para7: cint): cint{.libx11.} -proc XGrabKeyboard*(para1: PDisplay, para2: TWindow, para3: TBool, para4: cint, - para5: cint, para6: TTime): cint{.libx11.} -proc XGrabPointer*(para1: PDisplay, para2: TWindow, para3: TBool, para4: cuint, - para5: cint, para6: cint, para7: TWindow, para8: TCursor, - para9: TTime): cint{.libx11.} -proc XGrabServer*(para1: PDisplay): cint{.libx11.} -proc XHeightMMOfScreen*(para1: PScreen): cint{.libx11.} -proc XHeightOfScreen*(para1: PScreen): cint{.libx11.} -proc XIfEvent*(para1: PDisplay, para2: PXEvent, para3: funcifevent, - para4: TXPointer): cint{.libx11.} -proc XImageByteOrder*(para1: PDisplay): cint{.libx11.} -proc XInstallColormap*(para1: PDisplay, para2: TColormap): cint{.libx11.} -proc XKeysymToKeycode*(para1: PDisplay, para2: TKeySym): TKeyCode{.libx11.} -proc XKillClient*(para1: PDisplay, para2: TXID): cint{.libx11.} -proc XLookupColor*(para1: PDisplay, para2: TColormap, para3: cstring, - para4: PXColor, para5: PXColor): TStatus{.libx11.} -proc XLowerWindow*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XMapRaised*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XMapSubwindows*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XMapWindow*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XMaskEvent*(para1: PDisplay, para2: clong, para3: PXEvent): cint{.libx11.} -proc XMaxCmapsOfScreen*(para1: PScreen): cint{.libx11.} -proc XMinCmapsOfScreen*(para1: PScreen): cint{.libx11.} -proc XMoveResizeWindow*(para1: PDisplay, para2: TWindow, para3: cint, - para4: cint, para5: cuint, para6: cuint): cint{.libx11.} -proc XMoveWindow*(para1: PDisplay, para2: TWindow, para3: cint, para4: cint): cint{. - libx11.} -proc XNextEvent*(para1: PDisplay, para2: PXEvent): cint{.libx11.} -proc XNoOp*(para1: PDisplay): cint{.libx11.} -proc XParseColor*(para1: PDisplay, para2: TColormap, para3: cstring, - para4: PXColor): TStatus{.libx11.} -proc XParseGeometry*(para1: cstring, para2: Pcint, para3: Pcint, para4: Pcuint, - para5: Pcuint): cint{.libx11.} -proc XPeekEvent*(para1: PDisplay, para2: PXEvent): cint{.libx11.} -proc XPeekIfEvent*(para1: PDisplay, para2: PXEvent, para3: funcifevent, - para4: TXPointer): cint{.libx11.} -proc XPending*(para1: PDisplay): cint{.libx11.} -proc XPlanesOfScreen*(para1: PScreen): cint{.libx11.} -proc XProtocolRevision*(para1: PDisplay): cint{.libx11.} -proc XProtocolVersion*(para1: PDisplay): cint{.libx11.} -proc XPutBackEvent*(para1: PDisplay, para2: PXEvent): cint{.libx11.} -proc XPutImage*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: PXImage, - para5: cint, para6: cint, para7: cint, para8: cint, - para9: cuint, para10: cuint): cint{.libx11.} -proc XQLength*(para1: PDisplay): cint{.libx11.} -proc XQueryBestCursor*(para1: PDisplay, para2: TDrawable, para3: cuint, - para4: cuint, para5: Pcuint, para6: Pcuint): TStatus{. - libx11.} -proc XQueryBestSize*(para1: PDisplay, para2: cint, para3: TDrawable, - para4: cuint, para5: cuint, para6: Pcuint, para7: Pcuint): TStatus{. - libx11.} -proc XQueryBestStipple*(para1: PDisplay, para2: TDrawable, para3: cuint, - para4: cuint, para5: Pcuint, para6: Pcuint): TStatus{. - libx11.} -proc XQueryBestTile*(para1: PDisplay, para2: TDrawable, para3: cuint, - para4: cuint, para5: Pcuint, para6: Pcuint): TStatus{. - libx11.} -proc XQueryColor*(para1: PDisplay, para2: TColormap, para3: PXColor): cint{. - libx11.} -proc XQueryColors*(para1: PDisplay, para2: TColormap, para3: PXColor, - para4: cint): cint{.libx11.} -proc XQueryExtension*(para1: PDisplay, para2: cstring, para3: Pcint, - para4: Pcint, para5: Pcint): TBool{.libx11.} - #? -proc XQueryKeymap*(para1: PDisplay, para2: chararr32): cint{.libx11.} -proc XQueryPointer*(para1: PDisplay, para2: TWindow, para3: PWindow, - para4: PWindow, para5: Pcint, para6: Pcint, para7: Pcint, - para8: Pcint, para9: Pcuint): TBool{.libx11.} -proc XQueryTextExtents*(para1: PDisplay, para2: TXID, para3: cstring, - para4: cint, para5: Pcint, para6: Pcint, para7: Pcint, - para8: PXCharStruct): cint{.libx11.} -proc XQueryTextExtents16*(para1: PDisplay, para2: TXID, para3: PXChar2b, - para4: cint, para5: Pcint, para6: Pcint, para7: Pcint, - para8: PXCharStruct): cint{.libx11.} -proc XQueryTree*(para1: PDisplay, para2: TWindow, para3: PWindow, - para4: PWindow, para5: PPWindow, para6: Pcuint): TStatus{. - libx11.} -proc XRaiseWindow*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XReadBitmapFile*(para1: PDisplay, para2: TDrawable, para3: cstring, - para4: Pcuint, para5: Pcuint, para6: PPixmap, - para7: Pcint, para8: Pcint): cint{.libx11.} -proc XReadBitmapFileData*(para1: cstring, para2: Pcuint, para3: Pcuint, - para4: PPcuchar, para5: Pcint, para6: Pcint): cint{. - libx11.} -proc XRebindKeysym*(para1: PDisplay, para2: TKeySym, para3: PKeySym, - para4: cint, para5: Pcuchar, para6: cint): cint{.libx11.} -proc XRecolorCursor*(para1: PDisplay, para2: TCursor, para3: PXColor, - para4: PXColor): cint{.libx11.} -proc XRefreshKeyboardMapping*(para1: PXMappingEvent): cint{.libx11.} -proc XRemoveFromSaveSet*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XRemoveHost*(para1: PDisplay, para2: PXHostAddress): cint{.libx11.} -proc XRemoveHosts*(para1: PDisplay, para2: PXHostAddress, para3: cint): cint{. - libx11.} -proc XReparentWindow*(para1: PDisplay, para2: TWindow, para3: TWindow, - para4: cint, para5: cint): cint{.libx11.} -proc XResetScreenSaver*(para1: PDisplay): cint{.libx11.} -proc XResizeWindow*(para1: PDisplay, para2: TWindow, para3: cuint, para4: cuint): cint{. - libx11.} -proc XRestackWindows*(para1: PDisplay, para2: PWindow, para3: cint): cint{. - libx11.} -proc XRotateBuffers*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XRotateWindowProperties*(para1: PDisplay, para2: TWindow, para3: PAtom, - para4: cint, para5: cint): cint{.libx11.} -proc XScreenCount*(para1: PDisplay): cint{.libx11.} -proc XSelectInput*(para1: PDisplay, para2: TWindow, para3: clong): cint{.libx11.} -proc XSendEvent*(para1: PDisplay, para2: TWindow, para3: TBool, para4: clong, - para5: PXEvent): TStatus{.libx11.} -proc XSetAccessControl*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XSetArcMode*(para1: PDisplay, para2: TGC, para3: cint): cint{.libx11.} -proc XSetBackground*(para1: PDisplay, para2: TGC, para3: culong): cint{.libx11.} -proc XSetClipMask*(para1: PDisplay, para2: TGC, para3: TPixmap): cint{.libx11.} -proc XSetClipOrigin*(para1: PDisplay, para2: TGC, para3: cint, para4: cint): cint{. - libx11.} -proc XSetClipRectangles*(para1: PDisplay, para2: TGC, para3: cint, para4: cint, - para5: PXRectangle, para6: cint, para7: cint): cint{. - libx11.} -proc XSetCloseDownMode*(para1: PDisplay, para2: cint): cint{.libx11.} -proc XSetCommand*(para1: PDisplay, para2: TWindow, para3: PPchar, para4: cint): cint{. - libx11.} -proc XSetDashes*(para1: PDisplay, para2: TGC, para3: cint, para4: cstring, - para5: cint): cint{.libx11.} -proc XSetFillRule*(para1: PDisplay, para2: TGC, para3: cint): cint{.libx11.} -proc XSetFillStyle*(para1: PDisplay, para2: TGC, para3: cint): cint{.libx11.} -proc XSetFont*(para1: PDisplay, para2: TGC, para3: TFont): cint{.libx11.} -proc XSetFontPath*(para1: PDisplay, para2: PPchar, para3: cint): cint{.libx11.} -proc XSetForeground*(para1: PDisplay, para2: TGC, para3: culong): cint{.libx11.} -proc XSetFunction*(para1: PDisplay, para2: TGC, para3: cint): cint{.libx11.} -proc XSetGraphicsExposures*(para1: PDisplay, para2: TGC, para3: TBool): cint{. - libx11.} -proc XSetIconName*(para1: PDisplay, para2: TWindow, para3: cstring): cint{. - libx11.} -proc XSetInputFocus*(para1: PDisplay, para2: TWindow, para3: cint, para4: TTime): cint{. - libx11.} -proc XSetLineAttributes*(para1: PDisplay, para2: TGC, para3: cuint, para4: cint, - para5: cint, para6: cint): cint{.libx11.} -proc XSetModifierMapping*(para1: PDisplay, para2: PXModifierKeymap): cint{. - libx11.} -proc XSetPlaneMask*(para1: PDisplay, para2: TGC, para3: culong): cint{.libx11.} -proc XSetPointerMapping*(para1: PDisplay, para2: Pcuchar, para3: cint): cint{. - libx11.} -proc XSetScreenSaver*(para1: PDisplay, para2: cint, para3: cint, para4: cint, - para5: cint): cint{.libx11.} -proc XSetSelectionOwner*(para1: PDisplay, para2: TAtom, para3: TWindow, - para4: TTime): cint{.libx11.} -proc XSetState*(para1: PDisplay, para2: TGC, para3: culong, para4: culong, - para5: cint, para6: culong): cint{.libx11.} -proc XSetStipple*(para1: PDisplay, para2: TGC, para3: TPixmap): cint{.libx11.} -proc XSetSubwindowMode*(para1: PDisplay, para2: TGC, para3: cint): cint{.libx11.} -proc XSetTSOrigin*(para1: PDisplay, para2: TGC, para3: cint, para4: cint): cint{. - libx11.} -proc XSetTile*(para1: PDisplay, para2: TGC, para3: TPixmap): cint{.libx11.} -proc XSetWindowBackground*(para1: PDisplay, para2: TWindow, para3: culong): cint{. - libx11.} -proc XSetWindowBackgroundPixmap*(para1: PDisplay, para2: TWindow, para3: TPixmap): cint{. - libx11.} -proc XSetWindowBorder*(para1: PDisplay, para2: TWindow, para3: culong): cint{. - libx11.} -proc XSetWindowBorderPixmap*(para1: PDisplay, para2: TWindow, para3: TPixmap): cint{. - libx11.} -proc XSetWindowBorderWidth*(para1: PDisplay, para2: TWindow, para3: cuint): cint{. - libx11.} -proc XSetWindowColormap*(para1: PDisplay, para2: TWindow, para3: TColormap): cint{. - libx11.} -proc XStoreBuffer*(para1: PDisplay, para2: cstring, para3: cint, para4: cint): cint{. - libx11.} -proc XStoreBytes*(para1: PDisplay, para2: cstring, para3: cint): cint{.libx11.} -proc XStoreColor*(para1: PDisplay, para2: TColormap, para3: PXColor): cint{. - libx11.} -proc XStoreColors*(para1: PDisplay, para2: TColormap, para3: PXColor, - para4: cint): cint{.libx11.} -proc XStoreName*(para1: PDisplay, para2: TWindow, para3: cstring): cint{.libx11.} -proc XStoreNamedColor*(para1: PDisplay, para2: TColormap, para3: cstring, - para4: culong, para5: cint): cint{.libx11.} -proc XSync*(para1: PDisplay, para2: TBool): cint{.libx11.} -proc XTextExtents*(para1: PXFontStruct, para2: cstring, para3: cint, - para4: Pcint, para5: Pcint, para6: Pcint, para7: PXCharStruct): cint{. - libx11.} -proc XTextExtents16*(para1: PXFontStruct, para2: PXChar2b, para3: cint, - para4: Pcint, para5: Pcint, para6: Pcint, - para7: PXCharStruct): cint{.libx11.} -proc XTextWidth*(para1: PXFontStruct, para2: cstring, para3: cint): cint{.libx11.} -proc XTextWidth16*(para1: PXFontStruct, para2: PXChar2b, para3: cint): cint{. - libx11.} -proc XTranslateCoordinates*(para1: PDisplay, para2: TWindow, para3: TWindow, - para4: cint, para5: cint, para6: Pcint, - para7: Pcint, para8: PWindow): TBool{.libx11.} -proc XUndefineCursor*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XUngrabButton*(para1: PDisplay, para2: cuint, para3: cuint, para4: TWindow): cint{. - libx11.} -proc XUngrabKey*(para1: PDisplay, para2: cint, para3: cuint, para4: TWindow): cint{. - libx11.} -proc XUngrabKeyboard*(para1: PDisplay, para2: TTime): cint{.libx11.} -proc XUngrabPointer*(para1: PDisplay, para2: TTime): cint{.libx11.} -proc XUngrabServer*(para1: PDisplay): cint{.libx11.} -proc XUninstallColormap*(para1: PDisplay, para2: TColormap): cint{.libx11.} -proc XUnloadFont*(para1: PDisplay, para2: TFont): cint{.libx11.} -proc XUnmapSubwindows*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XUnmapWindow*(para1: PDisplay, para2: TWindow): cint{.libx11.} -proc XVendorRelease*(para1: PDisplay): cint{.libx11.} -proc XWarpPointer*(para1: PDisplay, para2: TWindow, para3: TWindow, para4: cint, - para5: cint, para6: cuint, para7: cuint, para8: cint, - para9: cint): cint{.libx11.} -proc XWidthMMOfScreen*(para1: PScreen): cint{.libx11.} -proc XWidthOfScreen*(para1: PScreen): cint{.libx11.} -proc XWindowEvent*(para1: PDisplay, para2: TWindow, para3: clong, para4: PXEvent): cint{. - libx11.} -proc XWriteBitmapFile*(para1: PDisplay, para2: cstring, para3: TPixmap, - para4: cuint, para5: cuint, para6: cint, para7: cint): cint{. - libx11.} -proc XSupportsLocale*(): TBool{.libx11.} -proc XSetLocaleModifiers*(para1: cstring): cstring{.libx11.} -proc XOpenOM*(para1: PDisplay, para2: PXrmHashBucketRec, para3: cstring, - para4: cstring): TXOM{.libx11.} -proc XCloseOM*(para1: TXOM): TStatus{.libx11.} -proc XSetOMValues*(para1: TXOM): cstring{.varargs, libx11.} -proc XGetOMValues*(para1: TXOM): cstring{.varargs, libx11.} -proc XDisplayOfOM*(para1: TXOM): PDisplay{.libx11.} -proc XLocaleOfOM*(para1: TXOM): cstring{.libx11.} -proc XCreateOC*(para1: TXOM): TXOC{.varargs, libx11.} -proc XDestroyOC*(para1: TXOC){.libx11.} -proc XOMOfOC*(para1: TXOC): TXOM{.libx11.} -proc XSetOCValues*(para1: TXOC): cstring{.varargs, libx11.} -proc XGetOCValues*(para1: TXOC): cstring{.varargs, libx11.} -proc XCreateFontSet*(para1: PDisplay, para2: cstring, para3: PPPchar, - para4: Pcint, para5: PPchar): TXFontSet{.libx11.} -proc XFreeFontSet*(para1: PDisplay, para2: TXFontSet){.libx11.} -proc XFontsOfFontSet*(para1: TXFontSet, para2: PPPXFontStruct, para3: PPPchar): cint{. - libx11.} -proc XBaseFontNameListOfFontSet*(para1: TXFontSet): cstring{.libx11.} -proc XLocaleOfFontSet*(para1: TXFontSet): cstring{.libx11.} -proc XContextDependentDrawing*(para1: TXFontSet): TBool{.libx11.} -proc XDirectionalDependentDrawing*(para1: TXFontSet): TBool{.libx11.} -proc XContextualDrawing*(para1: TXFontSet): TBool{.libx11.} -proc XExtentsOfFontSet*(para1: TXFontSet): PXFontSetExtents{.libx11.} -proc XmbTextEscapement*(para1: TXFontSet, para2: cstring, para3: cint): cint{. - libx11.} -proc XwcTextEscapement*(para1: TXFontSet, para2: PWideChar, para3: cint): cint{. - libx11.} -proc Xutf8TextEscapement*(para1: TXFontSet, para2: cstring, para3: cint): cint{. - libx11.} -proc XmbTextExtents*(para1: TXFontSet, para2: cstring, para3: cint, - para4: PXRectangle, para5: PXRectangle): cint{.libx11.} -proc XwcTextExtents*(para1: TXFontSet, para2: PWideChar, para3: cint, - para4: PXRectangle, para5: PXRectangle): cint{.libx11.} -proc Xutf8TextExtents*(para1: TXFontSet, para2: cstring, para3: cint, - para4: PXRectangle, para5: PXRectangle): cint{.libx11.} -proc XmbTextPerCharExtents*(para1: TXFontSet, para2: cstring, para3: cint, - para4: PXRectangle, para5: PXRectangle, para6: cint, - para7: Pcint, para8: PXRectangle, para9: PXRectangle): TStatus{. - libx11.} -proc XwcTextPerCharExtents*(para1: TXFontSet, para2: PWideChar, para3: cint, - para4: PXRectangle, para5: PXRectangle, para6: cint, - para7: Pcint, para8: PXRectangle, para9: PXRectangle): TStatus{. - libx11.} -proc Xutf8TextPerCharExtents*(para1: TXFontSet, para2: cstring, para3: cint, - para4: PXRectangle, para5: PXRectangle, - para6: cint, para7: Pcint, para8: PXRectangle, - para9: PXRectangle): TStatus{.libx11.} -proc XmbDrawText*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: PXmbTextItem, para7: cint){.libx11.} -proc XwcDrawText*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: PXwcTextItem, para7: cint){.libx11.} -proc Xutf8DrawText*(para1: PDisplay, para2: TDrawable, para3: TGC, para4: cint, - para5: cint, para6: PXmbTextItem, para7: cint){.libx11.} -proc XmbDrawString*(para1: PDisplay, para2: TDrawable, para3: TXFontSet, - para4: TGC, para5: cint, para6: cint, para7: cstring, - para8: cint){.libx11.} -proc XwcDrawString*(para1: PDisplay, para2: TDrawable, para3: TXFontSet, - para4: TGC, para5: cint, para6: cint, para7: PWideChar, - para8: cint){.libx11.} -proc Xutf8DrawString*(para1: PDisplay, para2: TDrawable, para3: TXFontSet, - para4: TGC, para5: cint, para6: cint, para7: cstring, - para8: cint){.libx11.} -proc XmbDrawImageString*(para1: PDisplay, para2: TDrawable, para3: TXFontSet, - para4: TGC, para5: cint, para6: cint, para7: cstring, - para8: cint){.libx11.} -proc XwcDrawImageString*(para1: PDisplay, para2: TDrawable, para3: TXFontSet, - para4: TGC, para5: cint, para6: cint, para7: PWideChar, - para8: cint){.libx11.} -proc Xutf8DrawImageString*(para1: PDisplay, para2: TDrawable, para3: TXFontSet, - para4: TGC, para5: cint, para6: cint, para7: cstring, - para8: cint){.libx11.} -proc XOpenIM*(para1: PDisplay, para2: PXrmHashBucketRec, para3: cstring, - para4: cstring): TXIM{.libx11.} -proc XCloseIM*(para1: TXIM): TStatus{.libx11.} -proc XGetIMValues*(para1: TXIM): cstring{.varargs, libx11.} -proc XSetIMValues*(para1: TXIM): cstring{.varargs, libx11.} -proc XDisplayOfIM*(para1: TXIM): PDisplay{.libx11.} -proc XLocaleOfIM*(para1: TXIM): cstring{.libx11.} -proc XCreateIC*(para1: TXIM): TXIC{.varargs, libx11.} -proc XDestroyIC*(para1: TXIC){.libx11.} -proc XSetICFocus*(para1: TXIC){.libx11.} -proc XUnsetICFocus*(para1: TXIC){.libx11.} -proc XwcResetIC*(para1: TXIC): PWideChar{.libx11.} -proc XmbResetIC*(para1: TXIC): cstring{.libx11.} -proc Xutf8ResetIC*(para1: TXIC): cstring{.libx11.} -proc XSetICValues*(para1: TXIC): cstring{.varargs, libx11.} -proc XGetICValues*(para1: TXIC): cstring{.varargs, libx11.} -proc XIMOfIC*(para1: TXIC): TXIM{.libx11.} -proc XFilterEvent*(para1: PXEvent, para2: TWindow): TBool{.libx11.} -proc XmbLookupString*(para1: TXIC, para2: PXKeyPressedEvent, para3: cstring, - para4: cint, para5: PKeySym, para6: PStatus): cint{.libx11.} -proc XwcLookupString*(para1: TXIC, para2: PXKeyPressedEvent, para3: PWideChar, - para4: cint, para5: PKeySym, para6: PStatus): cint{.libx11.} -proc Xutf8LookupString*(para1: TXIC, para2: PXKeyPressedEvent, para3: cstring, - para4: cint, para5: PKeySym, para6: PStatus): cint{. - libx11.} -proc XVaCreateNestedList*(unused: cint): TXVaNestedList{.varargs, libx11.} -proc XRegisterIMInstantiateCallback*(para1: PDisplay, para2: PXrmHashBucketRec, - para3: cstring, para4: cstring, - para5: TXIDProc, para6: TXPointer): TBool{. - libx11.} -proc XUnregisterIMInstantiateCallback*(para1: PDisplay, - para2: PXrmHashBucketRec, para3: cstring, - para4: cstring, para5: TXIDProc, - para6: TXPointer): TBool{.libx11.} -type - TXConnectionWatchProc* = proc (para1: PDisplay, para2: TXPointer, para3: cint, - para4: TBool, para5: PXPointer){.cdecl.} - -proc XInternalConnectionNumbers*(para1: PDisplay, para2: PPcint, para3: Pcint): TStatus{. - libx11.} -proc XProcessInternalConnection*(para1: PDisplay, para2: cint){.libx11.} -proc XAddConnectionWatch*(para1: PDisplay, para2: TXConnectionWatchProc, - para3: TXPointer): TStatus{.libx11.} -proc XRemoveConnectionWatch*(para1: PDisplay, para2: TXConnectionWatchProc, - para3: TXPointer){.libx11.} -proc XSetAuthorization*(para1: cstring, para2: cint, para3: cstring, para4: cint){. - libx11.} - # - # _Xmbtowc? - # _Xwctomb? - # -#when defined(MACROS): -proc ConnectionNumber*(dpy: PDisplay): cint -proc RootWindow*(dpy: PDisplay, scr: cint): TWindow -proc DefaultScreen*(dpy: PDisplay): cint -proc DefaultRootWindow*(dpy: PDisplay): TWindow -proc DefaultVisual*(dpy: PDisplay, scr: cint): PVisual -proc DefaultGC*(dpy: PDisplay, scr: cint): TGC -proc BlackPixel*(dpy: PDisplay, scr: cint): culong -proc WhitePixel*(dpy: PDisplay, scr: cint): culong -proc QLength*(dpy: PDisplay): cint -proc DisplayWidth*(dpy: PDisplay, scr: cint): cint -proc DisplayHeight*(dpy: PDisplay, scr: cint): cint -proc DisplayWidthMM*(dpy: PDisplay, scr: cint): cint -proc DisplayHeightMM*(dpy: PDisplay, scr: cint): cint -proc DisplayPlanes*(dpy: PDisplay, scr: cint): cint -proc DisplayCells*(dpy: PDisplay, scr: cint): cint -proc ScreenCount*(dpy: PDisplay): cint -proc ServerVendor*(dpy: PDisplay): cstring -proc ProtocolVersion*(dpy: PDisplay): cint -proc ProtocolRevision*(dpy: PDisplay): cint -proc VendorRelease*(dpy: PDisplay): cint -proc DisplayString*(dpy: PDisplay): cstring -proc DefaultDepth*(dpy: PDisplay, scr: cint): cint -proc DefaultColormap*(dpy: PDisplay, scr: cint): TColormap -proc BitmapUnit*(dpy: PDisplay): cint -proc BitmapBitOrder*(dpy: PDisplay): cint -proc BitmapPad*(dpy: PDisplay): cint -proc ImageByteOrder*(dpy: PDisplay): cint -proc NextRequest*(dpy: PDisplay): culong -proc LastKnownRequestProcessed*(dpy: PDisplay): culong -proc ScreenOfDisplay*(dpy: PDisplay, scr: cint): PScreen -proc DefaultScreenOfDisplay*(dpy: PDisplay): PScreen -proc DisplayOfScreen*(s: PScreen): PDisplay -proc RootWindowOfScreen*(s: PScreen): TWindow -proc BlackPixelOfScreen*(s: PScreen): culong -proc WhitePixelOfScreen*(s: PScreen): culong -proc DefaultColormapOfScreen*(s: PScreen): TColormap -proc DefaultDepthOfScreen*(s: PScreen): cint -proc DefaultGCOfScreen*(s: PScreen): TGC -proc DefaultVisualOfScreen*(s: PScreen): PVisual -proc WidthOfScreen*(s: PScreen): cint -proc HeightOfScreen*(s: PScreen): cint -proc WidthMMOfScreen*(s: PScreen): cint -proc HeightMMOfScreen*(s: PScreen): cint -proc PlanesOfScreen*(s: PScreen): cint -proc CellsOfScreen*(s: PScreen): cint -proc MinCmapsOfScreen*(s: PScreen): cint -proc MaxCmapsOfScreen*(s: PScreen): cint -proc DoesSaveUnders*(s: PScreen): TBool -proc DoesBackingStore*(s: PScreen): cint -proc EventMaskOfScreen*(s: PScreen): clong -proc XAllocID*(dpy: PDisplay): TXID -# implementation - -#when defined(MACROS): -template privDisp : expr = cast[PXPrivDisplay](dpy) - -proc ConnectionNumber(dpy: PDisplay): cint = - privDisp.fd - -proc RootWindow(dpy: PDisplay, scr: cint): TWindow = - ScreenOfDisplay(dpy, scr).root - -proc DefaultScreen(dpy: PDisplay): cint = - privDisp.default_screen - -proc DefaultRootWindow(dpy: PDisplay): TWindow = - ScreenOfDisplay(dpy, DefaultScreen(dpy)).root - -proc DefaultVisual(dpy: PDisplay, scr: cint): PVisual = - ScreenOfDisplay(dpy, scr).root_visual - -proc DefaultGC(dpy: PDisplay, scr: cint): TGC = - ScreenOfDisplay(dpy, scr).default_gc - -proc BlackPixel(dpy: PDisplay, scr: cint): culong = - ScreenOfDisplay(dpy, scr).black_pixel - -proc WhitePixel(dpy: PDisplay, scr: cint): culong = - ScreenOfDisplay(dpy, scr).white_pixel - -proc QLength(dpy: PDisplay): cint = - privDisp.qlen - -proc DisplayWidth(dpy: PDisplay, scr: cint): cint = - ScreenOfDisplay(dpy, scr).width - -proc DisplayHeight(dpy: PDisplay, scr: cint): cint = - ScreenOfDisplay(dpy, scr).height - -proc DisplayWidthMM(dpy: PDisplay, scr: cint): cint = - ScreenOfDisplay(dpy, scr).mwidth - -proc DisplayHeightMM(dpy: PDisplay, scr: cint): cint = - ScreenOfDisplay(dpy, scr).mheight - -proc DisplayPlanes(dpy: PDisplay, scr: cint): cint = - ScreenOfDisplay(dpy, scr).root_depth - -proc DisplayCells(dpy: PDisplay, scr: cint): cint = - DefaultVisual(dpy, scr).map_entries - -proc ScreenCount(dpy: PDisplay): cint = - privDisp.nscreens - -proc ServerVendor(dpy: PDisplay): cstring = - privDisp.vendor - -proc ProtocolVersion(dpy: PDisplay): cint = - privDisp.proto_major_version - -proc ProtocolRevision(dpy: PDisplay): cint = - privDisp.proto_minor_version - -proc VendorRelease(dpy: PDisplay): cint = - privDisp.release - -proc DisplayString(dpy: PDisplay): cstring = - privDisp.display_name - -proc DefaultDepth(dpy: PDisplay, scr: cint): cint = - ScreenOfDisplay(dpy, scr).root_depth - -proc DefaultColormap(dpy: PDisplay, scr: cint): TColormap = - ScreenOfDisplay(dpy, scr).cmap - -proc BitmapUnit(dpy: PDisplay): cint = - privDisp.bitmap_unit - -proc BitmapBitOrder(dpy: PDisplay): cint = - privDisp.bitmap_bit_order - -proc BitmapPad(dpy: PDisplay): cint = - privDisp.bitmap_pad - -proc ImageByteOrder(dpy: PDisplay): cint = - privDisp.byte_order - -import unsigned -proc NextRequest(dpy: PDisplay): culong = - privDisp.request + 1.culong - -proc LastKnownRequestProcessed(dpy: PDisplay): culong = - privDisp.last_request_read - -# from fowltek/pointer_arithm, required for ScreenOfDisplay() -proc offset[A] (some: ptr A; b: int): ptr A = - cast[ptr A](cast[int](some) + (b * sizeof(A))) -proc ScreenOfDisplay(dpy: PDisplay, scr: cint): PScreen = - #addr(((privDisp.screens)[scr])) - privDisp.screens.offset(scr.int) - -proc DefaultScreenOfDisplay(dpy: PDisplay): PScreen = - ScreenOfDisplay(dpy, DefaultScreen(dpy)) - -proc DisplayOfScreen(s: PScreen): PDisplay = - s.display - -proc RootWindowOfScreen(s: PScreen): TWindow = - s.root - -proc BlackPixelOfScreen(s: PScreen): culong = - s.black_pixel - -proc WhitePixelOfScreen(s: PScreen): culong = - s.white_pixel - -proc DefaultColormapOfScreen(s: PScreen): TColormap = - s.cmap - -proc DefaultDepthOfScreen(s: PScreen): cint = - s.root_depth - -proc DefaultGCOfScreen(s: PScreen): TGC = - s.default_gc - -proc DefaultVisualOfScreen(s: PScreen): PVisual = - s.root_visual - -proc WidthOfScreen(s: PScreen): cint = - s.width - -proc HeightOfScreen(s: PScreen): cint = - s.height - -proc WidthMMOfScreen(s: PScreen): cint = - s.mwidth - -proc HeightMMOfScreen(s: PScreen): cint = - s.mheight - -proc PlanesOfScreen(s: PScreen): cint = - s.root_depth - -proc CellsOfScreen(s: PScreen): cint = - DefaultVisualOfScreen(s).map_entries - -proc MinCmapsOfScreen(s: PScreen): cint = - s.min_maps - -proc MaxCmapsOfScreen(s: PScreen): cint = - s.max_maps - -proc DoesSaveUnders(s: PScreen): TBool = - s.save_unders - -proc DoesBackingStore(s: PScreen): cint = - s.backing_store - -proc EventMaskOfScreen(s: PScreen): clong = - s.root_input_mask - -proc XAllocID(dpy: PDisplay): TXID = - privDisp.resource_alloc(dpy) diff --git a/lib/wrappers/x11/xrandr.nim b/lib/wrappers/x11/xrandr.nim deleted file mode 100644 index ee6f1705b..000000000 --- a/lib/wrappers/x11/xrandr.nim +++ /dev/null @@ -1,194 +0,0 @@ -# -# $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $ -# -# Copyright (C) 2000 Compaq Computer Corporation, Inc. -# Copyright (C) 2002 Hewlett-Packard Company, Inc. -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of Compaq not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. HP makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# Author: Jim Gettys, HP Labs, HP. -# - -import - x, xlib - -const - libXrandr* = "libXrandr.so" - -# * $XFree86: xc/include/extensions/randr.h,v 1.4 2001/11/24 07:24:58 keithp Exp $ -# * -# * Copyright (C) 2000, Compaq Computer Corporation, -# * Copyright (C) 2002, Hewlett Packard, Inc. -# * -# * Permission to use, copy, modify, distribute, and sell this software and its -# * documentation for any purpose is hereby granted without fee, provided that -# * the above copyright notice appear in all copies and that both that -# * copyright notice and this permission notice appear in supporting -# * documentation, and that the name of Compaq or HP not be used in advertising -# * or publicity pertaining to distribution of the software without specific, -# * written prior permission. HP makes no representations about the -# * suitability of this software for any purpose. It is provided "as is" -# * without express or implied warranty. -# * -# * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL -# * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP -# * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# * -# * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. -# * - -type - PRotation* = ptr TRotation - TRotation* = cushort - PSizeID* = ptr TSizeID - TSizeID* = cushort - PSubpixelOrder* = ptr TSubpixelOrder - TSubpixelOrder* = cushort - -const - RANDR_NAME* = "RANDR" - RANDR_MAJOR* = 1 - RANDR_MINOR* = 1 - RRNumberErrors* = 0 - RRNumberEvents* = 1 - constX_RRQueryVersion* = 0 # we skip 1 to make old clients fail pretty immediately - X_RROldGetScreenInfo* = 1 - X_RR1_0SetScreenConfig* = 2 # V1.0 apps share the same set screen config request id - constX_RRSetScreenConfig* = 2 - X_RROldScreenChangeSelectInput* = 3 # 3 used to be ScreenChangeSelectInput; deprecated - constX_RRSelectInput* = 4 - constX_RRGetScreenInfo* = 5 # used in XRRSelectInput - RRScreenChangeNotifyMask* = 1 shl 0 - RRScreenChangeNotify* = 0 # used in the rotation field; rotation and reflection in 0.1 proto. - RR_Rotate_0* = 1 - RR_Rotate_90* = 2 - RR_Rotate_180* = 4 - RR_Rotate_270* = 8 # new in 1.0 protocol, to allow reflection of screen - RR_Reflect_X* = 16 - RR_Reflect_Y* = 32 - RRSetConfigSuccess* = 0 - RRSetConfigInvalidConfigTime* = 1 - RRSetConfigInvalidTime* = 2 - RRSetConfigFailed* = 3 - -type - PXRRScreenSize* = ptr TXRRScreenSize - TXRRScreenSize*{.final.} = object # - # Events. - # - width*, height*: cint - mwidth*, mheight*: cint - - TXRRScreenChangeNotifyEvent*{.final.} = object # internal representation is private to the library - typ*: cint # event base - serial*: culong # # of last request processed by server - send_event*: TBool # true if this came from a SendEvent request - display*: PDisplay # Display the event was read from - window*: TWindow # window which selected for this event - root*: TWindow # Root window for changed screen - timestamp*: TTime # when the screen change occurred - config_timestamp*: TTime # when the last configuration change - size_index*: TSizeID - subpixel_order*: TSubpixelOrder - rotation*: TRotation - width*: cint - height*: cint - mwidth*: cint - mheight*: cint - - PXRRScreenConfiguration* = ptr TXRRScreenConfiguration - TXRRScreenConfiguration*{.final.} = object - -proc XRRQueryExtension*(dpy: PDisplay, event_basep, error_basep: Pcint): TBool{. - cdecl, dynlib: libXrandr, importc.} -proc XRRQueryVersion*(dpy: PDisplay, major_versionp: Pcint, - minor_versionp: Pcint): TStatus{.cdecl, dynlib: libXrandr, - importc.} -proc XRRGetScreenInfo*(dpy: PDisplay, draw: TDrawable): PXRRScreenConfiguration{. - cdecl, dynlib: libXrandr, importc.} -proc XRRFreeScreenConfigInfo*(config: PXRRScreenConfiguration){.cdecl, - dynlib: libXrandr, importc.} - # - # Note that screen configuration changes are only permitted if the client can - # prove it has up to date configuration information. We are trying to - # insist that it become possible for screens to change dynamically, so - # we want to ensure the client knows what it is talking about when requesting - # changes. - # -proc XRRSetScreenConfig*(dpy: PDisplay, config: PXRRScreenConfiguration, - draw: TDrawable, size_index: cint, rotation: TRotation, - timestamp: TTime): TStatus{.cdecl, dynlib: libXrandr, - importc.} - # added in v1.1, sorry for the lame name -proc XRRSetScreenConfigAndRate*(dpy: PDisplay, config: PXRRScreenConfiguration, - draw: TDrawable, size_index: cint, - rotation: TRotation, rate: cshort, - timestamp: TTime): TStatus{.cdecl, - dynlib: libXrandr, importc.} -proc XRRConfigRotations*(config: PXRRScreenConfiguration, - current_rotation: PRotation): TRotation{.cdecl, - dynlib: libXrandr, importc.} -proc XRRConfigTimes*(config: PXRRScreenConfiguration, config_timestamp: PTime): TTime{. - cdecl, dynlib: libXrandr, importc.} -proc XRRConfigSizes*(config: PXRRScreenConfiguration, nsizes: Pcint): PXRRScreenSize{. - cdecl, dynlib: libXrandr, importc.} -proc XRRConfigRates*(config: PXRRScreenConfiguration, sizeID: cint, - nrates: Pcint): ptr int16{.cdecl, dynlib: libXrandr, importc.} -proc XRRConfigCurrentConfiguration*(config: PXRRScreenConfiguration, - rotation: PRotation): TSizeID{.cdecl, - dynlib: libXrandr, importc.} -proc XRRConfigCurrentRate*(config: PXRRScreenConfiguration): cshort{.cdecl, - dynlib: libXrandr, importc.} -proc XRRRootToScreen*(dpy: PDisplay, root: TWindow): cint{.cdecl, - dynlib: libXrandr, importc.} - # - # returns the screen configuration for the specified screen; does a lazy - # evalution to delay getting the information, and caches the result. - # These routines should be used in preference to XRRGetScreenInfo - # to avoid unneeded round trips to the X server. These are new - # in protocol version 0.1. - # -proc XRRScreenConfig*(dpy: PDisplay, screen: cint): PXRRScreenConfiguration{. - cdecl, dynlib: libXrandr, importc.} -proc XRRConfig*(screen: PScreen): PXRRScreenConfiguration{.cdecl, - dynlib: libXrandr, importc.} -proc XRRSelectInput*(dpy: PDisplay, window: TWindow, mask: cint){.cdecl, - dynlib: libXrandr, importc.} - # - # the following are always safe to call, even if RandR is not implemented - # on a screen - # -proc XRRRotations*(dpy: PDisplay, screen: cint, current_rotation: PRotation): TRotation{. - cdecl, dynlib: libXrandr, importc.} -proc XRRSizes*(dpy: PDisplay, screen: cint, nsizes: Pcint): PXRRScreenSize{. - cdecl, dynlib: libXrandr, importc.} -proc XRRRates*(dpy: PDisplay, screen: cint, sizeID: cint, nrates: Pcint): ptr int16{. - cdecl, dynlib: libXrandr, importc.} -proc XRRTimes*(dpy: PDisplay, screen: cint, config_timestamp: PTime): TTime{. - cdecl, dynlib: libXrandr, importc.} - # - # intended to take RRScreenChangeNotify, or - # ConfigureNotify (on the root window) - # returns 1 if it is an event type it understands, 0 if not - # -proc XRRUpdateConfiguration*(event: PXEvent): cint{.cdecl, dynlib: libXrandr, - importc.} -# implementation diff --git a/lib/wrappers/x11/xrender.nim b/lib/wrappers/x11/xrender.nim deleted file mode 100644 index c4b2b364d..000000000 --- a/lib/wrappers/x11/xrender.nim +++ /dev/null @@ -1,241 +0,0 @@ - -import - x, xlib - -when defined(use_pkg_config) or defined(use_pkg_config_static): - {.pragma: libxrender, cdecl, importc.} - when defined(use_pkg_config): - {.passl: gorge("pkg-config xrender --libs").} - else: - {.passl: gorge("pkg-config xrender --static --libs").} -else: - when defined(macosx): - const - libXrender* = "libXrender.dylib" - else: - const - libXrender* = "libXrender.so" - - - {.pragma: libxrender, dynlib: libXrender, cdecl, importc.} -#const -# libXrender* = "libXrender.so" - -# -# Automatically converted by H2Pas 0.99.15 from xrender.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# xrender.h -# - -type - PGlyph* = ptr TGlyph - TGlyph* = int32 - PGlyphSet* = ptr TGlyphSet - TGlyphSet* = int32 - PPicture* = ptr TPicture - TPicture* = int32 - PPictFormat* = ptr TPictFormat - TPictFormat* = int32 - -const - RENDER_NAME* = "RENDER" - RENDER_MAJOR* = 0 - RENDER_MINOR* = 0 - constX_RenderQueryVersion* = 0 - X_RenderQueryPictFormats* = 1 - X_RenderQueryPictIndexValues* = 2 - X_RenderQueryDithers* = 3 - constX_RenderCreatePicture* = 4 - constX_RenderChangePicture* = 5 - X_RenderSetPictureClipRectangles* = 6 - constX_RenderFreePicture* = 7 - constX_RenderComposite* = 8 - X_RenderScale* = 9 - X_RenderTrapezoids* = 10 - X_RenderTriangles* = 11 - X_RenderTriStrip* = 12 - X_RenderTriFan* = 13 - X_RenderColorTrapezoids* = 14 - X_RenderColorTriangles* = 15 - X_RenderTransform* = 16 - constX_RenderCreateGlyphSet* = 17 - constX_RenderReferenceGlyphSet* = 18 - constX_RenderFreeGlyphSet* = 19 - constX_RenderAddGlyphs* = 20 - constX_RenderAddGlyphsFromPicture* = 21 - constX_RenderFreeGlyphs* = 22 - constX_RenderCompositeGlyphs8* = 23 - constX_RenderCompositeGlyphs16* = 24 - constX_RenderCompositeGlyphs32* = 25 - BadPictFormat* = 0 - BadPicture* = 1 - BadPictOp* = 2 - BadGlyphSet* = 3 - BadGlyph* = 4 - RenderNumberErrors* = BadGlyph + 1 - PictTypeIndexed* = 0 - PictTypeDirect* = 1 - PictOpClear* = 0 - PictOpSrc* = 1 - PictOpDst* = 2 - PictOpOver* = 3 - PictOpOverReverse* = 4 - PictOpIn* = 5 - PictOpInReverse* = 6 - PictOpOut* = 7 - PictOpOutReverse* = 8 - PictOpAtop* = 9 - PictOpAtopReverse* = 10 - PictOpXor* = 11 - PictOpAdd* = 12 - PictOpSaturate* = 13 - PictOpMaximum* = 13 - PolyEdgeSharp* = 0 - PolyEdgeSmooth* = 1 - PolyModePrecise* = 0 - PolyModeImprecise* = 1 - CPRepeat* = 1 shl 0 - CPAlphaMap* = 1 shl 1 - CPAlphaXOrigin* = 1 shl 2 - CPAlphaYOrigin* = 1 shl 3 - CPClipXOrigin* = 1 shl 4 - CPClipYOrigin* = 1 shl 5 - CPClipMask* = 1 shl 6 - CPGraphicsExposure* = 1 shl 7 - CPSubwindowMode* = 1 shl 8 - CPPolyEdge* = 1 shl 9 - CPPolyMode* = 1 shl 10 - CPDither* = 1 shl 11 - CPLastBit* = 11 - -type - PXRenderDirectFormat* = ptr TXRenderDirectFormat - TXRenderDirectFormat*{.final.} = object - red*: int16 - redMask*: int16 - green*: int16 - greenMask*: int16 - blue*: int16 - blueMask*: int16 - alpha*: int16 - alphaMask*: int16 - - PXRenderPictFormat* = ptr TXRenderPictFormat - TXRenderPictFormat*{.final.} = object - id*: TPictFormat - thetype*: int32 - depth*: int32 - direct*: TXRenderDirectFormat - colormap*: TColormap - - -const - PictFormatID* = 1 shl 0 - PictFormatType* = 1 shl 1 - PictFormatDepth* = 1 shl 2 - PictFormatRed* = 1 shl 3 - PictFormatRedMask* = 1 shl 4 - PictFormatGreen* = 1 shl 5 - PictFormatGreenMask* = 1 shl 6 - PictFormatBlue* = 1 shl 7 - PictFormatBlueMask* = 1 shl 8 - PictFormatAlpha* = 1 shl 9 - PictFormatAlphaMask* = 1 shl 10 - PictFormatColormap* = 1 shl 11 - -type - PXRenderVisual* = ptr TXRenderVisual - TXRenderVisual*{.final.} = object - visual*: PVisual - format*: PXRenderPictFormat - - PXRenderDepth* = ptr TXRenderDepth - TXRenderDepth*{.final.} = object - depth*: int32 - nvisuals*: int32 - visuals*: PXRenderVisual - - PXRenderScreen* = ptr TXRenderScreen - TXRenderScreen*{.final.} = object - depths*: PXRenderDepth - ndepths*: int32 - fallback*: PXRenderPictFormat - - PXRenderInfo* = ptr TXRenderInfo - TXRenderInfo*{.final.} = object - format*: PXRenderPictFormat - nformat*: int32 - screen*: PXRenderScreen - nscreen*: int32 - depth*: PXRenderDepth - ndepth*: int32 - visual*: PXRenderVisual - nvisual*: int32 - - PXRenderPictureAttributes* = ptr TXRenderPictureAttributes - TXRenderPictureAttributes*{.final.} = object - repeat*: TBool - alpha_map*: TPicture - alpha_x_origin*: int32 - alpha_y_origin*: int32 - clip_x_origin*: int32 - clip_y_origin*: int32 - clip_mask*: TPixmap - graphics_exposures*: TBool - subwindow_mode*: int32 - poly_edge*: int32 - poly_mode*: int32 - dither*: TAtom - - PXGlyphInfo* = ptr TXGlyphInfo - TXGlyphInfo*{.final.} = object - width*: int16 - height*: int16 - x*: int16 - y*: int16 - xOff*: int16 - yOff*: int16 - - -proc XRenderQueryExtension*(dpy: PDisplay, event_basep: ptr int32, - error_basep: ptr int32): TBool{.libxrender.} -proc XRenderQueryVersion*(dpy: PDisplay, major_versionp: ptr int32, - minor_versionp: ptr int32): TStatus{.libxrender.} -proc XRenderQueryFormats*(dpy: PDisplay): TStatus{.libxrender.} -proc XRenderFindVisualFormat*(dpy: PDisplay, visual: PVisual): PXRenderPictFormat{. - libxrender.} -proc XRenderFindFormat*(dpy: PDisplay, mask: int32, - `template`: PXRenderPictFormat, count: int32): PXRenderPictFormat{. - libxrender.} -proc XRenderCreatePicture*(dpy: PDisplay, drawable: TDrawable, - format: PXRenderPictFormat, valuemask: int32, - attributes: PXRenderPictureAttributes): TPicture{. - libxrender.} -proc XRenderChangePicture*(dpy: PDisplay, picture: TPicture, valuemask: int32, - attributes: PXRenderPictureAttributes){.libxrender.} -proc XRenderFreePicture*(dpy: PDisplay, picture: TPicture){.libxrender.} -proc XRenderComposite*(dpy: PDisplay, op: int32, src: TPicture, mask: TPicture, - dst: TPicture, src_x: int32, src_y: int32, mask_x: int32, - mask_y: int32, dst_x: int32, dst_y: int32, width: int32, - height: int32){.libxrender.} -proc XRenderCreateGlyphSet*(dpy: PDisplay, format: PXRenderPictFormat): TGlyphSet{. - libxrender.} -proc XRenderReferenceGlyphSet*(dpy: PDisplay, existing: TGlyphSet): TGlyphSet{. - libxrender.} -proc XRenderFreeGlyphSet*(dpy: PDisplay, glyphset: TGlyphSet){.libxrender.} -proc XRenderAddGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph, - glyphs: PXGlyphInfo, nglyphs: int32, images: cstring, - nbyte_images: int32){.libxrender.} -proc XRenderFreeGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph, - nglyphs: int32){.libxrender.} -proc XRenderCompositeString8*(dpy: PDisplay, op: int32, src: TPicture, - dst: TPicture, maskFormat: PXRenderPictFormat, - glyphset: TGlyphSet, xSrc: int32, ySrc: int32, - xDst: int32, yDst: int32, str: cstring, - nchar: int32){.libxrender.} -# implementation diff --git a/lib/wrappers/x11/xresource.nim b/lib/wrappers/x11/xresource.nim deleted file mode 100644 index f553b4413..000000000 --- a/lib/wrappers/x11/xresource.nim +++ /dev/null @@ -1,200 +0,0 @@ - -import - x, xlib - -#const -# libX11* = "libX11.so" - -# -# Automatically converted by H2Pas 0.99.15 from xresource.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# xresource.h -# - -proc Xpermalloc*(para1: int32): cstring{.cdecl, dynlib: libX11, importc.} -type - PXrmQuark* = ptr TXrmQuark - TXrmQuark* = int32 - TXrmQuarkList* = PXrmQuark - PXrmQuarkList* = ptr TXrmQuarkList - -proc NULLQUARK*(): TXrmQuark -type - PXrmString* = ptr TXrmString - TXrmString* = ptr char - -proc NULLSTRING*(): TXrmString -proc XrmStringToQuark*(para1: cstring): TXrmQuark{.cdecl, dynlib: libX11, - importc.} -proc XrmPermStringToQuark*(para1: cstring): TXrmQuark{.cdecl, dynlib: libX11, - importc.} -proc XrmQuarkToString*(para1: TXrmQuark): TXrmString{.cdecl, dynlib: libX11, - importc.} -proc XrmUniqueQuark*(): TXrmQuark{.cdecl, dynlib: libX11, importc.} -when defined(MACROS): - proc XrmStringsEqual*(a1, a2: cstring): bool -type - PXrmBinding* = ptr TXrmBinding - TXrmBinding* = enum - XrmBindTightly, XrmBindLoosely - TXrmBindingList* = PXrmBinding - PXrmBindingList* = ptr TXrmBindingList - -proc XrmStringToQuarkList*(para1: cstring, para2: TXrmQuarkList){.cdecl, - dynlib: libX11, importc.} -proc XrmStringToBindingQuarkList*(para1: cstring, para2: TXrmBindingList, - para3: TXrmQuarkList){.cdecl, dynlib: libX11, - importc.} -type - PXrmName* = ptr TXrmName - TXrmName* = TXrmQuark - PXrmNameList* = ptr TXrmNameList - TXrmNameList* = TXrmQuarkList - -when defined(MACROS): - proc XrmNameToString*(name: int32): TXrmString - proc XrmStringToName*(str: cstring): int32 - proc XrmStringToNameList*(str: cstring, name: PXrmQuark) -type - PXrmClass* = ptr TXrmClass - TXrmClass* = TXrmQuark - PXrmClassList* = ptr TXrmClassList - TXrmClassList* = TXrmQuarkList - -when defined(MACROS): - proc XrmClassToString*(c_class: int32): TXrmString - proc XrmStringToClass*(c_class: cstring): int32 - proc XrmStringToClassList*(str: cstring, c_class: PXrmQuark) -type - PXrmRepresentation* = ptr TXrmRepresentation - TXrmRepresentation* = TXrmQuark - -when defined(MACROS): - proc XrmStringToRepresentation*(str: cstring): int32 - proc XrmRepresentationToString*(thetype: int32): TXrmString -type - PXrmValue* = ptr TXrmValue - TXrmValue*{.final.} = object - size*: int32 - address*: TXPointer - - TXrmValuePtr* = PXrmValue - PXrmValuePtr* = ptr TXrmValuePtr - PXrmHashBucketRec* = ptr TXrmHashBucketRec - TXrmHashBucketRec*{.final.} = object - TXrmHashBucket* = PXrmHashBucketRec - PXrmHashBucket* = ptr TXrmHashBucket - PXrmHashTable* = ptr TXrmHashTable - TXrmHashTable* = ptr TXrmHashBucket - TXrmDatabase* = PXrmHashBucketRec - PXrmDatabase* = ptr TXrmDatabase - -proc XrmDestroyDatabase*(para1: TXrmDatabase){.cdecl, dynlib: libX11, importc.} -proc XrmQPutResource*(para1: PXrmDatabase, para2: TXrmBindingList, - para3: TXrmQuarkList, para4: TXrmRepresentation, - para5: PXrmValue){.cdecl, dynlib: libX11, importc.} -proc XrmPutResource*(para1: PXrmDatabase, para2: cstring, para3: cstring, - para4: PXrmValue){.cdecl, dynlib: libX11, importc.} -proc XrmQPutStringResource*(para1: PXrmDatabase, para2: TXrmBindingList, - para3: TXrmQuarkList, para4: cstring){.cdecl, - dynlib: libX11, importc.} -proc XrmPutStringResource*(para1: PXrmDatabase, para2: cstring, para3: cstring){. - cdecl, dynlib: libX11, importc.} -proc XrmPutLineResource*(para1: PXrmDatabase, para2: cstring){.cdecl, - dynlib: libX11, importc.} -proc XrmQGetResource*(para1: TXrmDatabase, para2: TXrmNameList, - para3: TXrmClassList, para4: PXrmRepresentation, - para5: PXrmValue): TBool{.cdecl, dynlib: libX11, importc.} -proc XrmGetResource*(para1: TXrmDatabase, para2: cstring, para3: cstring, - para4: PPchar, para5: PXrmValue): TBool{.cdecl, - dynlib: libX11, importc.} - # There is no definition of TXrmSearchList - #function XrmQGetSearchList(para1:TXrmDatabase; para2:TXrmNameList; para3:TXrmClassList; para4:TXrmSearchList; para5:longint):TBool;cdecl;external libX11; - #function XrmQGetSearchResource(para1:TXrmSearchList; para2:TXrmName; para3:TXrmClass; para4:PXrmRepresentation; para5:PXrmValue):TBool;cdecl;external libX11; -proc XrmSetDatabase*(para1: PDisplay, para2: TXrmDatabase){.cdecl, - dynlib: libX11, importc.} -proc XrmGetDatabase*(para1: PDisplay): TXrmDatabase{.cdecl, dynlib: libX11, - importc.} -proc XrmGetFileDatabase*(para1: cstring): TXrmDatabase{.cdecl, dynlib: libX11, - importc.} -proc XrmCombineFileDatabase*(para1: cstring, para2: PXrmDatabase, para3: TBool): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XrmGetStringDatabase*(para1: cstring): TXrmDatabase{.cdecl, dynlib: libX11, - importc.} -proc XrmPutFileDatabase*(para1: TXrmDatabase, para2: cstring){.cdecl, - dynlib: libX11, importc.} -proc XrmMergeDatabases*(para1: TXrmDatabase, para2: PXrmDatabase){.cdecl, - dynlib: libX11, importc.} -proc XrmCombineDatabase*(para1: TXrmDatabase, para2: PXrmDatabase, para3: TBool){. - cdecl, dynlib: libX11, importc.} -const - XrmEnumAllLevels* = 0 - XrmEnumOneLevel* = 1 - -type - funcbool* = proc (): TBool {.cdecl.} - -proc XrmEnumerateDatabase*(para1: TXrmDatabase, para2: TXrmNameList, - para3: TXrmClassList, para4: int32, para5: funcbool, - para6: TXPointer): TBool{.cdecl, dynlib: libX11, - importc.} -proc XrmLocaleOfDatabase*(para1: TXrmDatabase): cstring{.cdecl, dynlib: libX11, - importc.} -type - PXrmOptionKind* = ptr TXrmOptionKind - TXrmOptionKind* = enum - XrmoptionNoArg, XrmoptionIsArg, XrmoptionStickyArg, XrmoptionSepArg, - XrmoptionResArg, XrmoptionSkipArg, XrmoptionSkipLine, XrmoptionSkipNArgs - PXrmOptionDescRec* = ptr TXrmOptionDescRec - TXrmOptionDescRec*{.final.} = object - option*: cstring - specifier*: cstring - argKind*: TXrmOptionKind - value*: TXPointer - - TXrmOptionDescList* = PXrmOptionDescRec - PXrmOptionDescList* = ptr TXrmOptionDescList - -proc XrmParseCommand*(para1: PXrmDatabase, para2: TXrmOptionDescList, - para3: int32, para4: cstring, para5: ptr int32, - para6: PPchar){.cdecl, dynlib: libX11, importc.} -# implementation - -proc NULLQUARK(): TXrmQuark = - result = TXrmQuark(0) - -proc NULLSTRING(): TXrmString = - result = nil - -when defined(MACROS): - proc XrmStringsEqual(a1, a2: cstring): bool = - result = (strcomp(a1, a2)) == 0 - - proc XrmNameToString(name: int32): TXrmString = - result = XrmQuarkToString(name) - - proc XrmStringToName(str: cstring): int32 = - result = XrmStringToQuark(str) - - proc XrmStringToNameList(str: cstring, name: PXrmQuark) = - XrmStringToQuarkList(str, name) - - proc XrmClassToString(c_class: int32): TXrmString = - result = XrmQuarkToString(c_class) - - proc XrmStringToClass(c_class: cstring): int32 = - result = XrmStringToQuark(c_class) - - proc XrmStringToClassList(str: cstring, c_class: PXrmQuark) = - XrmStringToQuarkList(str, c_class) - - proc XrmStringToRepresentation(str: cstring): int32 = - result = XrmStringToQuark(str) - - proc XrmRepresentationToString(thetype: int32): TXrmString = - result = XrmQuarkToString(thetype) diff --git a/lib/wrappers/x11/xshm.nim b/lib/wrappers/x11/xshm.nim deleted file mode 100644 index e56bd87b1..000000000 --- a/lib/wrappers/x11/xshm.nim +++ /dev/null @@ -1,77 +0,0 @@ - -import - x, xlib - -#const -# libX11* = "libX11.so" - -# -# Automatically converted by H2Pas 0.99.15 from xshm.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# xshm.h -# - -const - constX_ShmQueryVersion* = 0 - constX_ShmAttach* = 1 - constX_ShmDetach* = 2 - constX_ShmPutImage* = 3 - constX_ShmGetImage* = 4 - constX_ShmCreatePixmap* = 5 - ShmCompletion* = 0 - ShmNumberEvents* = ShmCompletion + 1 - BadShmSeg* = 0 - ShmNumberErrors* = BadShmSeg + 1 - -type - PShmSeg* = ptr TShmSeg - TShmSeg* = culong - PXShmCompletionEvent* = ptr TXShmCompletionEvent - TXShmCompletionEvent*{.final.} = object - theType*: cint - serial*: culong - send_event*: TBool - display*: PDisplay - drawable*: TDrawable - major_code*: cint - minor_code*: cint - shmseg*: TShmSeg - offset*: culong - - PXShmSegmentInfo* = ptr TXShmSegmentInfo - TXShmSegmentInfo*{.final.} = object - shmseg*: TShmSeg - shmid*: cint - shmaddr*: cstring - readOnly*: TBool - - -proc XShmQueryExtension*(para1: PDisplay): TBool{.cdecl, dynlib: libX11, importc.} -proc XShmGetEventBase*(para1: PDisplay): cint{.cdecl, dynlib: libX11, importc.} -proc XShmQueryVersion*(para1: PDisplay, para2: Pcint, para3: Pcint, para4: PBool): TBool{. - cdecl, dynlib: libX11, importc.} -proc XShmPixmapFormat*(para1: PDisplay): cint{.cdecl, dynlib: libX11, importc.} -proc XShmAttach*(para1: PDisplay, para2: PXShmSegmentInfo): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XShmDetach*(para1: PDisplay, para2: PXShmSegmentInfo): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XShmPutImage*(para1: PDisplay, para2: TDrawable, para3: TGC, - para4: PXImage, para5: cint, para6: cint, para7: cint, - para8: cint, para9: cuint, para10: cuint, para11: TBool): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XShmGetImage*(para1: PDisplay, para2: TDrawable, para3: PXImage, - para4: cint, para5: cint, para6: culong): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XShmCreateImage*(para1: PDisplay, para2: PVisual, para3: cuint, - para4: cint, para5: cstring, para6: PXShmSegmentInfo, - para7: cuint, para8: cuint): PXImage{.cdecl, - dynlib: libX11, importc.} -proc XShmCreatePixmap*(para1: PDisplay, para2: TDrawable, para3: cstring, - para4: PXShmSegmentInfo, para5: cuint, para6: cuint, - para7: cuint): TPixmap{.cdecl, dynlib: libX11, importc.} -# implementation diff --git a/lib/wrappers/x11/xutil.nim b/lib/wrappers/x11/xutil.nim deleted file mode 100644 index 9a3435aa5..000000000 --- a/lib/wrappers/x11/xutil.nim +++ /dev/null @@ -1,412 +0,0 @@ - -import - x, xlib, keysym, unsigned - -#const -# libX11* = "libX11.so" - -# -# Automatically converted by H2Pas 0.99.15 from xutil.h -# The following command line parameters were used: -# -p -# -T -# -S -# -d -# -c -# xutil.h -# - -const - NoValue* = 0x00000000 - XValue* = 0x00000001 - YValue* = 0x00000002 - WidthValue* = 0x00000004 - HeightValue* = 0x00000008 - AllValues* = 0x0000000F - XNegative* = 0x00000010 - YNegative* = 0x00000020 - -type - TCPoint*{.final.} = object - x*: cint - y*: cint - - PXSizeHints* = ptr TXSizeHints - TXSizeHints*{.final.} = object - flags*: clong - x*, y*: cint - width*, height*: cint - min_width*, min_height*: cint - max_width*, max_height*: cint - width_inc*, height_inc*: cint - min_aspect*, max_aspect*: TCPoint - base_width*, base_height*: cint - win_gravity*: cint - - -const - USPosition* = 1 shl 0 - USSize* = 1 shl 1 - PPosition* = 1 shl 2 - PSize* = 1 shl 3 - PMinSize* = 1 shl 4 - PMaxSize* = 1 shl 5 - PResizeInc* = 1 shl 6 - PAspect* = 1 shl 7 - PBaseSize* = 1 shl 8 - PWinGravity* = 1 shl 9 - PAllHints* = PPosition or PSize or PMinSize or PMaxSize or PResizeInc or - PAspect - -type - PXWMHints* = ptr TXWMHints - TXWMHints*{.final.} = object - flags*: clong - input*: TBool - initial_state*: cint - icon_pixmap*: TPixmap - icon_window*: TWindow - icon_x*, icon_y*: cint - icon_mask*: TPixmap - window_group*: TXID - - -const - InputHint* = 1 shl 0 - StateHint* = 1 shl 1 - IconPixmapHint* = 1 shl 2 - IconWindowHint* = 1 shl 3 - IconPositionHint* = 1 shl 4 - IconMaskHint* = 1 shl 5 - WindowGroupHint* = 1 shl 6 - AllHints* = InputHint or StateHint or IconPixmapHint or IconWindowHint or - IconPositionHint or IconMaskHint or WindowGroupHint - XUrgencyHint* = 1 shl 8 - WithdrawnState* = 0 - NormalState* = 1 - IconicState* = 3 - DontCareState* = 0 - ZoomState* = 2 - InactiveState* = 4 - -type - PXTextProperty* = ptr TXTextProperty - TXTextProperty*{.final.} = object - value*: pcuchar - encoding*: TAtom - format*: cint - nitems*: culong - - -const - XNoMemory* = - 1 - XLocaleNotSupported* = - 2 - XConverterNotFound* = - 3 - -type - PXICCEncodingStyle* = ptr TXICCEncodingStyle - TXICCEncodingStyle* = enum - XStringStyle, XCompoundTextStyle, XTextStyle, XStdICCTextStyle, - XUTF8StringStyle - PPXIconSize* = ptr PXIconSize - PXIconSize* = ptr TXIconSize - TXIconSize*{.final.} = object - min_width*, min_height*: cint - max_width*, max_height*: cint - width_inc*, height_inc*: cint - - PXClassHint* = ptr TXClassHint - TXClassHint*{.final.} = object - res_name*: cstring - res_class*: cstring - - -type - PXComposeStatus* = ptr TXComposeStatus - TXComposeStatus*{.final.} = object - compose_ptr*: TXPointer - chars_matched*: cint - - -type - PXRegion* = ptr TXRegion - TXRegion*{.final.} = object - TRegion* = PXRegion - PRegion* = ptr TRegion - -const - RectangleOut* = 0 - RectangleIn* = 1 - RectanglePart* = 2 - -type - PXVisualInfo* = ptr TXVisualInfo - TXVisualInfo*{.final.} = object - visual*: PVisual - visualid*: TVisualID - screen*: cint - depth*: cint - class*: cint - red_mask*: culong - green_mask*: culong - blue_mask*: culong - colormap_size*: cint - bits_per_rgb*: cint - - -const - VisualNoMask* = 0x00000000 - VisualIDMask* = 0x00000001 - VisualScreenMask* = 0x00000002 - VisualDepthMask* = 0x00000004 - VisualClassMask* = 0x00000008 - VisualRedMaskMask* = 0x00000010 - VisualGreenMaskMask* = 0x00000020 - VisualBlueMaskMask* = 0x00000040 - VisualColormapSizeMask* = 0x00000080 - VisualBitsPerRGBMask* = 0x00000100 - VisualAllMask* = 0x000001FF - -type - PPXStandardColormap* = ptr PXStandardColormap - PXStandardColormap* = ptr TXStandardColormap - TXStandardColormap*{.final.} = object - colormap*: TColormap - red_max*: culong - red_mult*: culong - green_max*: culong - green_mult*: culong - blue_max*: culong - blue_mult*: culong - base_pixel*: culong - visualid*: TVisualID - killid*: TXID - - -const - BitmapSuccess* = 0 - BitmapOpenFailed* = 1 - BitmapFileInvalid* = 2 - BitmapNoMemory* = 3 - XCSUCCESS* = 0 - XCNOMEM* = 1 - XCNOENT* = 2 - ReleaseByFreeingColormap*: TXID = TXID(1) - -type - PXContext* = ptr TXContext - TXContext* = cint - -proc XAllocClassHint*(): PXClassHint{.cdecl, dynlib: libX11, importc.} -proc XAllocIconSize*(): PXIconSize{.cdecl, dynlib: libX11, importc.} -proc XAllocSizeHints*(): PXSizeHints{.cdecl, dynlib: libX11, importc.} -proc XAllocStandardColormap*(): PXStandardColormap{.cdecl, dynlib: libX11, - importc.} -proc XAllocWMHints*(): PXWMHints{.cdecl, dynlib: libX11, importc.} -proc XClipBox*(para1: TRegion, para2: PXRectangle): cint{.cdecl, dynlib: libX11, - importc.} -proc XCreateRegion*(): TRegion{.cdecl, dynlib: libX11, importc.} -proc XDefaultString*(): cstring{.cdecl, dynlib: libX11, importc.} -proc XDeleteContext*(para1: PDisplay, para2: TXID, para3: TXContext): cint{. - cdecl, dynlib: libX11, importc.} -proc XDestroyRegion*(para1: TRegion): cint{.cdecl, dynlib: libX11, importc.} -proc XEmptyRegion*(para1: TRegion): cint{.cdecl, dynlib: libX11, importc.} -proc XEqualRegion*(para1: TRegion, para2: TRegion): cint{.cdecl, dynlib: libX11, - importc.} -proc XFindContext*(para1: PDisplay, para2: TXID, para3: TXContext, - para4: PXPointer): cint{.cdecl, dynlib: libX11, importc.} -proc XGetClassHint*(para1: PDisplay, para2: TWindow, para3: PXClassHint): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetIconSizes*(para1: PDisplay, para2: TWindow, para3: PPXIconSize, - para4: Pcint): TStatus{.cdecl, dynlib: libX11, importc.} -proc XGetNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetRGBColormaps*(para1: PDisplay, para2: TWindow, - para3: PPXStandardColormap, para4: Pcint, para5: TAtom): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints, - para4: TAtom): TStatus{.cdecl, dynlib: libX11, importc.} -proc XGetStandardColormap*(para1: PDisplay, para2: TWindow, - para3: PXStandardColormap, para4: TAtom): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetTextProperty*(para1: PDisplay, para2: TWindow, para3: PXTextProperty, - para4: TAtom): TStatus{.cdecl, dynlib: libX11, importc.} -proc XGetVisualInfo*(para1: PDisplay, para2: clong, para3: PXVisualInfo, - para4: Pcint): PXVisualInfo{.cdecl, dynlib: libX11, importc.} -proc XGetWMClientMachine*(para1: PDisplay, para2: TWindow, para3: PXTextProperty): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetWMHints*(para1: PDisplay, para2: TWindow): PXWMHints{.cdecl, - dynlib: libX11, importc.} -proc XGetWMIconName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetWMName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XGetWMNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints, - para4: ptr int): TStatus{.cdecl, dynlib: libX11, importc.} -proc XGetWMSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints, - para4: ptr int, para5: TAtom): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XGetZoomHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): TStatus{. - cdecl, dynlib: libX11, importc.} -proc XIntersectRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{. - cdecl, dynlib: libX11, importc.} -proc XConvertCase*(para1: TKeySym, para2: PKeySym, para3: PKeySym){.cdecl, - dynlib: libX11, importc.} -proc XLookupString*(para1: PXKeyEvent, para2: cstring, para3: cint, - para4: PKeySym, para5: PXComposeStatus): cint{.cdecl, - dynlib: libX11, importc.} -proc XMatchVisualInfo*(para1: PDisplay, para2: cint, para3: cint, para4: cint, - para5: PXVisualInfo): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XOffsetRegion*(para1: TRegion, para2: cint, para3: cint): cint{.cdecl, - dynlib: libX11, importc.} -proc XPointInRegion*(para1: TRegion, para2: cint, para3: cint): TBool{.cdecl, - dynlib: libX11, importc.} -proc XPolygonRegion*(para1: PXPoint, para2: cint, para3: cint): TRegion{.cdecl, - dynlib: libX11, importc.} -proc XRectInRegion*(para1: TRegion, para2: cint, para3: cint, para4: cuint, - para5: cuint): cint{.cdecl, dynlib: libX11, importc.} -proc XSaveContext*(para1: PDisplay, para2: TXID, para3: TXContext, - para4: cstring): cint{.cdecl, dynlib: libX11, importc.} -proc XSetClassHint*(para1: PDisplay, para2: TWindow, para3: PXClassHint): cint{. - cdecl, dynlib: libX11, importc.} -proc XSetIconSizes*(para1: PDisplay, para2: TWindow, para3: PXIconSize, - para4: cint): cint{.cdecl, dynlib: libX11, importc.} -proc XSetNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): cint{. - cdecl, dynlib: libX11, importc.} -proc XSetRGBColormaps*(para1: PDisplay, para2: TWindow, - para3: PXStandardColormap, para4: cint, para5: TAtom){. - cdecl, dynlib: libX11, importc.} -proc XSetSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints, - para4: TAtom): cint{.cdecl, dynlib: libX11, importc.} -proc XSetStandardProperties*(para1: PDisplay, para2: TWindow, para3: cstring, - para4: cstring, para5: TPixmap, para6: PPchar, - para7: cint, para8: PXSizeHints): cint{.cdecl, - dynlib: libX11, importc.} -proc XSetTextProperty*(para1: PDisplay, para2: TWindow, para3: PXTextProperty, - para4: TAtom){.cdecl, dynlib: libX11, importc.} -proc XSetWMClientMachine*(para1: PDisplay, para2: TWindow, para3: PXTextProperty){. - cdecl, dynlib: libX11, importc.} -proc XSetWMHints*(para1: PDisplay, para2: TWindow, para3: PXWMHints): cint{. - cdecl, dynlib: libX11, importc.} -proc XSetWMIconName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty){. - cdecl, dynlib: libX11, importc.} -proc XSetWMName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty){.cdecl, - dynlib: libX11, importc.} -proc XSetWMNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints){. - cdecl, dynlib: libX11, importc.} -proc XSetWMProperties*(para1: PDisplay, para2: TWindow, para3: PXTextProperty, - para4: PXTextProperty, para5: PPchar, para6: cint, - para7: PXSizeHints, para8: PXWMHints, para9: PXClassHint){. - cdecl, dynlib: libX11, importc.} -proc XmbSetWMProperties*(para1: PDisplay, para2: TWindow, para3: cstring, - para4: cstring, para5: PPchar, para6: cint, - para7: PXSizeHints, para8: PXWMHints, - para9: PXClassHint){.cdecl, dynlib: libX11, importc.} -proc Xutf8SetWMProperties*(para1: PDisplay, para2: TWindow, para3: cstring, - para4: cstring, para5: PPchar, para6: cint, - para7: PXSizeHints, para8: PXWMHints, - para9: PXClassHint){.cdecl, dynlib: libX11, importc.} -proc XSetWMSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints, - para4: TAtom){.cdecl, dynlib: libX11, importc.} -proc XSetRegion*(para1: PDisplay, para2: TGC, para3: TRegion): cint{.cdecl, - dynlib: libX11, importc.} -proc XSetStandardColormap*(para1: PDisplay, para2: TWindow, - para3: PXStandardColormap, para4: TAtom){.cdecl, - dynlib: libX11, importc.} -proc XSetZoomHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): cint{. - cdecl, dynlib: libX11, importc.} -proc XShrinkRegion*(para1: TRegion, para2: cint, para3: cint): cint{.cdecl, - dynlib: libX11, importc.} -proc XStringListToTextProperty*(para1: PPchar, para2: cint, - para3: PXTextProperty): TStatus{.cdecl, - dynlib: libX11, importc.} -proc XSubtractRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{. - cdecl, dynlib: libX11, importc.} -proc XmbTextListToTextProperty*(para1: PDisplay, para2: PPchar, para3: cint, - para4: TXICCEncodingStyle, para5: PXTextProperty): cint{. - cdecl, dynlib: libX11, importc.} -proc XwcTextListToTextProperty*(para1: PDisplay, para2: ptr ptr int16, para3: cint, - para4: TXICCEncodingStyle, para5: PXTextProperty): cint{. - cdecl, dynlib: libX11, importc.} -proc Xutf8TextListToTextProperty*(para1: PDisplay, para2: PPchar, para3: cint, - para4: TXICCEncodingStyle, - para5: PXTextProperty): cint{.cdecl, - dynlib: libX11, importc.} -proc XwcFreeStringList*(para1: ptr ptr int16){.cdecl, dynlib: libX11, importc.} -proc XTextPropertyToStringList*(para1: PXTextProperty, para2: PPPchar, - para3: Pcint): TStatus{.cdecl, dynlib: libX11, - importc.} -proc XmbTextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty, - para3: PPPchar, para4: Pcint): cint{.cdecl, - dynlib: libX11, importc.} -proc XwcTextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty, - para3: ptr ptr ptr int16, para4: Pcint): cint{.cdecl, - dynlib: libX11, importc.} -proc Xutf8TextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty, - para3: PPPchar, para4: Pcint): cint{.cdecl, - dynlib: libX11, importc.} -proc XUnionRectWithRegion*(para1: PXRectangle, para2: TRegion, para3: TRegion): cint{. - cdecl, dynlib: libX11, importc.} -proc XUnionRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{.cdecl, - dynlib: libX11, importc.} -proc XWMGeometry*(para1: PDisplay, para2: cint, para3: cstring, para4: cstring, - para5: cuint, para6: PXSizeHints, para7: Pcint, para8: Pcint, - para9: Pcint, para10: Pcint, para11: Pcint): cint{.cdecl, - dynlib: libX11, importc.} -proc XXorRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{.cdecl, - dynlib: libX11, importc.} -#when defined(MACROS): -proc XDestroyImage*(ximage: PXImage): cint -proc XGetPixel*(ximage: PXImage, x, y: cint): culong -proc XPutPixel*(ximage: PXImage, x, y: cint, pixel: culong): cint -proc XSubImage*(ximage: PXImage, x, y: cint, width, height: cuint): PXImage -proc XAddPixel*(ximage: PXImage, value: clong): cint -proc IsKeypadKey*(keysym: TKeySym): bool -proc IsPrivateKeypadKey*(keysym: TKeySym): bool -proc IsCursorKey*(keysym: TKeySym): bool -proc IsPFKey*(keysym: TKeySym): bool -proc IsFunctionKey*(keysym: TKeySym): bool -proc IsMiscFunctionKey*(keysym: TKeySym): bool -proc IsModifierKey*(keysym: TKeySym): bool - #function XUniqueContext : TXContext; - #function XStringToContext(_string : Pchar) : TXContext; -# implementation - -#when defined(MACROS): -proc XDestroyImage(ximage: PXImage): cint = - ximage.f.destroy_image(ximage) - -proc XGetPixel(ximage: PXImage, x, y: cint): culong = - ximage.f.get_pixel(ximage, x, y) - -proc XPutPixel(ximage: PXImage, x, y: cint, pixel: culong): cint = - ximage.f.put_pixel(ximage, x, y, pixel) - -proc XSubImage(ximage: PXImage, x, y: cint, width, height: cuint): PXImage = - ximage.f.sub_image(ximage, x, y, width, height) - -proc XAddPixel(ximage: PXImage, value: clong): cint = - ximage.f.add_pixel(ximage, value) - -proc IsKeypadKey(keysym: TKeySym): bool = - (keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal) - -proc IsPrivateKeypadKey(keysym: TKeySym): bool = - (keysym >= 0x11000000.TKeySym) and (keysym <= 0x1100FFFF.TKeySym) - -proc IsCursorKey(keysym: TKeySym): bool = - (keysym >= XK_Home) and (keysym < XK_Select) - -proc IsPFKey(keysym: TKeySym): bool = - (keysym >= XK_KP_F1) and (keysym <= XK_KP_F4) - -proc IsFunctionKey(keysym: TKeySym): bool = - (keysym >= XK_F1) and (keysym <= XK_F35) - -proc IsMiscFunctionKey(keysym: TKeySym): bool = - (keysym >= XK_Select) and (keysym <= XK_Break) - -proc IsModifierKey(keysym: TKeySym): bool = - ((keysym >= XK_Shift_L) And (keysym <= XK_Hyper_R)) Or - (keysym == XK_Mode_switch) Or (keysym == XK_Num_Lock) diff --git a/lib/wrappers/x11/xv.nim b/lib/wrappers/x11/xv.nim deleted file mode 100644 index 45ab61418..000000000 --- a/lib/wrappers/x11/xv.nim +++ /dev/null @@ -1,84 +0,0 @@ -#*********************************************************** -#Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, -#and the Massachusetts Institute of Technology, Cambridge, Massachusetts. -# -# All Rights Reserved -# -#Permission to use, copy, modify, and distribute this software and its -#documentation for any purpose and without fee is hereby granted, -#provided that the above copyright notice appear in all copies and that -#both that copyright notice and this permission notice appear in -#supporting documentation, and that the names of Digital or MIT not be -#used in advertising or publicity pertaining to distribution of the -#software without specific, written prior permission. -# -#DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -#ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -#DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -#ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -#WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -#ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -#SOFTWARE. -# -#****************************************************************** -# $XFree86: xc/include/extensions/Xv.h,v 1.3 1999/05/23 06:33:22 dawes Exp $ - -import - x - -const - XvName* = "libXVideo.so" - XvVersion* = 2 - XvRevision* = 2 # Symbols - -type - TXvPortID* = TXID - TXvEncodingID* = TXID - -const - XvNone* = 0 - XvInput* = 0 - XvOutput* = 1 - XvInputMask* = 1 shl XvInput - XvOutputMask* = 1 shl XvOutput - XvVideoMask* = 0x00000004 - XvStillMask* = 0x00000008 - XvImageMask* = 0x00000010 # These two are not client viewable - XvPixmapMask* = 0x00010000 - XvWindowMask* = 0x00020000 - XvGettable* = 0x00000001 - XvSettable* = 0x00000002 - XvRGB* = 0 - XvYUV* = 1 - XvPacked* = 0 - XvPlanar* = 1 - XvTopToBottom* = 0 - XvBottomToTop* = 1 # Events - XvVideoNotify* = 0 - XvPortNotify* = 1 - XvNumEvents* = 2 # Video Notify Reasons - XvStarted* = 0 - XvStopped* = 1 - XvBusy* = 2 - XvPreempted* = 3 - XvHardError* = 4 - XvLastReason* = 4 - XvNumReasons* = XvLastReason + 1 - XvStartedMask* = 1 shl XvStarted - XvStoppedMask* = 1 shl XvStopped - XvBusyMask* = 1 shl XvBusy - XvPreemptedMask* = 1 shl XvPreempted - XvHardErrorMask* = 1 shl XvHardError - XvAnyReasonMask* = (1 shl XvNumReasons) - 1 - XvNoReasonMask* = 0 # Errors - XvBadPort* = 0 - XvBadEncoding* = 1 - XvBadControl* = 2 - XvNumErrors* = 3 # Status - XvBadExtension* = 1 - XvAlreadyGrabbed* = 2 - XvInvalidTime* = 3 - XvBadReply* = 4 - XvBadAlloc* = 5 - -# implementation diff --git a/lib/wrappers/x11/xvlib.nim b/lib/wrappers/x11/xvlib.nim deleted file mode 100644 index 19fd0d000..000000000 --- a/lib/wrappers/x11/xvlib.nim +++ /dev/null @@ -1,234 +0,0 @@ -#*********************************************************** -#Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, -#and the Massachusetts Institute of Technology, Cambridge, Massachusetts. -# -# All Rights Reserved -# -#Permission to use, copy, modify, and distribute this software and its -#documentation for any purpose and without fee is hereby granted, -#provided that the above copyright notice appear in all copies and that -#both that copyright notice and this permission notice appear in -#supporting documentation, and that the names of Digital or MIT not be -#used in advertising or publicity pertaining to distribution of the -#software without specific, written prior permission. -# -#DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -#ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -#DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -#ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -#WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -#ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -#SOFTWARE. -# -#****************************************************************** -# $XFree86: xc/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $ -#* -#** File: -#** -#** Xvlib.h --- Xv library public header file -#** -#** Author: -#** -#** David Carver (Digital Workstation Engineering/Project Athena) -#** -#** Revisions: -#** -#** 26.06.91 Carver -#** - changed XvFreeAdaptors to XvFreeAdaptorInfo -#** - changed XvFreeEncodings to XvFreeEncodingInfo -#** -#** 11.06.91 Carver -#** - changed SetPortControl to SetPortAttribute -#** - changed GetPortControl to GetPortAttribute -#** - changed QueryBestSize -#** -#** 05.15.91 Carver -#** - version 2.0 upgrade -#** -#** 01.24.91 Carver -#** - version 1.4 upgrade -#** -#* - -import - x, xlib, xshm, xv - -const - libXv* = "libXv.so" - -type - PXvRational* = ptr TXvRational - TXvRational*{.final.} = object - numerator*: cint - denominator*: cint - - PXvAttribute* = ptr TXvAttribute - TXvAttribute*{.final.} = object - flags*: cint # XvGettable, XvSettable - min_value*: cint - max_value*: cint - name*: cstring - - PPXvEncodingInfo* = ptr PXvEncodingInfo - PXvEncodingInfo* = ptr TXvEncodingInfo - TXvEncodingInfo*{.final.} = object - encoding_id*: TXvEncodingID - name*: cstring - width*: culong - height*: culong - rate*: TXvRational - num_encodings*: culong - - PXvFormat* = ptr TXvFormat - TXvFormat*{.final.} = object - depth*: cchar - visual_id*: culong - - PPXvAdaptorInfo* = ptr PXvAdaptorInfo - PXvAdaptorInfo* = ptr TXvAdaptorInfo - TXvAdaptorInfo*{.final.} = object - base_id*: TXvPortID - num_ports*: culong - thetype*: cchar - name*: cstring - num_formats*: culong - formats*: PXvFormat - num_adaptors*: culong - - PXvVideoNotifyEvent* = ptr TXvVideoNotifyEvent - TXvVideoNotifyEvent*{.final.} = object - theType*: cint - serial*: culong # # of last request processed by server - send_event*: TBool # true if this came from a SendEvent request - display*: PDisplay # Display the event was read from - drawable*: TDrawable # drawable - reason*: culong # what generated this event - port_id*: TXvPortID # what port - time*: TTime # milliseconds - - PXvPortNotifyEvent* = ptr TXvPortNotifyEvent - TXvPortNotifyEvent*{.final.} = object - theType*: cint - serial*: culong # # of last request processed by server - send_event*: TBool # true if this came from a SendEvent request - display*: PDisplay # Display the event was read from - port_id*: TXvPortID # what port - time*: TTime # milliseconds - attribute*: TAtom # atom that identifies attribute - value*: clong # value of attribute - - PXvEvent* = ptr TXvEvent - TXvEvent*{.final.} = object - pad*: array[0..23, clong] #case longint of - # 0 : ( - # theType : cint; - # ); - # 1 : ( - # xvvideo : TXvVideoNotifyEvent; - # ); - # 2 : ( - # xvport : TXvPortNotifyEvent; - # ); - # 3 : ( - # - # ); - - PXvImageFormatValues* = ptr TXvImageFormatValues - TXvImageFormatValues*{.final.} = object - id*: cint # Unique descriptor for the format - theType*: cint # XvRGB, XvYUV - byte_order*: cint # LSBFirst, MSBFirst - guid*: array[0..15, cchar] # Globally Unique IDentifier - bits_per_pixel*: cint - format*: cint # XvPacked, XvPlanar - num_planes*: cint # for RGB formats only - depth*: cint - red_mask*: cuint - green_mask*: cuint - blue_mask*: cuint # for YUV formats only - y_sample_bits*: cuint - u_sample_bits*: cuint - v_sample_bits*: cuint - horz_y_period*: cuint - horz_u_period*: cuint - horz_v_period*: cuint - vert_y_period*: cuint - vert_u_period*: cuint - vert_v_period*: cuint - component_order*: array[0..31, char] # eg. UYVY - scanline_order*: cint # XvTopToBottom, XvBottomToTop - - PXvImage* = ptr TXvImage - TXvImage*{.final.} = object - id*: cint - width*, height*: cint - data_size*: cint # bytes - num_planes*: cint - pitches*: pcint # bytes - offsets*: pcint # bytes - data*: pointer - obdata*: TXPointer - - -proc XvQueryExtension*(display: PDisplay, p_version, p_revision, p_requestBase, - p_eventBase, p_errorBase: pcuint): cint{.cdecl, dynlib: libXv, importc.} -proc XvQueryAdaptors*(display: PDisplay, window: TWindow, p_nAdaptors: pcuint, - p_pAdaptors: PPXvAdaptorInfo): cint{.cdecl, dynlib: libXv, - importc.} -proc XvQueryEncodings*(display: PDisplay, port: TXvPortID, p_nEncoding: pcuint, - p_pEncoding: PPXvEncodingInfo): cint{.cdecl, - dynlib: libXv, importc.} -proc XvPutVideo*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC, - vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{. - cdecl, dynlib: libXv, importc.} -proc XvPutStill*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC, - vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{. - cdecl, dynlib: libXv, importc.} -proc XvGetVideo*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC, - vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{. - cdecl, dynlib: libXv, importc.} -proc XvGetStill*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC, - vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{. - cdecl, dynlib: libXv, importc.} -proc XvStopVideo*(display: PDisplay, port: TXvPortID, drawable: TDrawable): cint{. - cdecl, dynlib: libXv, importc.} -proc XvGrabPort*(display: PDisplay, port: TXvPortID, time: TTime): cint{.cdecl, - dynlib: libXv, importc.} -proc XvUngrabPort*(display: PDisplay, port: TXvPortID, time: TTime): cint{. - cdecl, dynlib: libXv, importc.} -proc XvSelectVideoNotify*(display: PDisplay, drawable: TDrawable, onoff: TBool): cint{. - cdecl, dynlib: libXv, importc.} -proc XvSelectPortNotify*(display: PDisplay, port: TXvPortID, onoff: TBool): cint{. - cdecl, dynlib: libXv, importc.} -proc XvSetPortAttribute*(display: PDisplay, port: TXvPortID, attribute: TAtom, - value: cint): cint{.cdecl, dynlib: libXv, importc.} -proc XvGetPortAttribute*(display: PDisplay, port: TXvPortID, attribute: TAtom, - p_value: pcint): cint{.cdecl, dynlib: libXv, importc.} -proc XvQueryBestSize*(display: PDisplay, port: TXvPortID, motion: TBool, - vid_w, vid_h, drw_w, drw_h: cuint, - p_actual_width, p_actual_height: pcuint): cint{.cdecl, - dynlib: libXv, importc.} -proc XvQueryPortAttributes*(display: PDisplay, port: TXvPortID, number: pcint): PXvAttribute{. - cdecl, dynlib: libXv, importc.} -proc XvFreeAdaptorInfo*(adaptors: PXvAdaptorInfo){.cdecl, dynlib: libXv, importc.} -proc XvFreeEncodingInfo*(encodings: PXvEncodingInfo){.cdecl, dynlib: libXv, - importc.} -proc XvListImageFormats*(display: PDisplay, port_id: TXvPortID, - count_return: pcint): PXvImageFormatValues{.cdecl, - dynlib: libXv, importc.} -proc XvCreateImage*(display: PDisplay, port: TXvPortID, id: cint, data: pointer, - width, height: cint): PXvImage{.cdecl, dynlib: libXv, - importc.} -proc XvPutImage*(display: PDisplay, id: TXvPortID, d: TDrawable, gc: TGC, - image: PXvImage, src_x, src_y: cint, src_w, src_h: cuint, - dest_x, dest_y: cint, dest_w, dest_h: cuint): cint{.cdecl, - dynlib: libXv, importc.} -proc XvShmPutImage*(display: PDisplay, id: TXvPortID, d: TDrawable, gc: TGC, - image: PXvImage, src_x, src_y: cint, src_w, src_h: cuint, - dest_x, dest_y: cint, dest_w, dest_h: cuint, - send_event: TBool): cint{.cdecl, dynlib: libXv, importc.} -proc XvShmCreateImage*(display: PDisplay, port: TXvPortID, id: cint, - data: pointer, width, height: cint, - shminfo: PXShmSegmentInfo): PXvImage{.cdecl, - dynlib: libXv, importc.} -# implementation diff --git a/lib/wrappers/zip/libzip.nim b/lib/wrappers/zip/libzip.nim index c3d1784a5..0b8d2b3ec 100644 --- a/lib/wrappers/zip/libzip.nim +++ b/lib/wrappers/zip/libzip.nim @@ -59,28 +59,28 @@ else: {.pragma: mydll.} type - Tzip_source_cmd* = int32 + TZipSourceCmd* = int32 - Tzip_source_callback* = proc (state: pointer, data: pointer, length: int, - cmd: Tzip_source_cmd): int {.cdecl.} - Pzip_stat* = ptr Tzip_stat - Tzip_stat* = object ## the 'zip_stat' struct + TZipSourceCallback* = proc (state: pointer, data: pointer, length: int, + cmd: TZipSourceCmd): int {.cdecl.} + PZipStat* = ptr TZipStat + TZipStat* = object ## the 'zip_stat' struct name*: cstring ## name of the file index*: int32 ## index within archive crc*: int32 ## crc of file data mtime*: TTime ## modification time size*: int ## size of file (uncompressed) - comp_size*: int ## size of file (compressed) - comp_method*: int16 ## compression method used - encryption_method*: int16 ## encryption method used + compSize*: int ## size of file (compressed) + compMethod*: int16 ## compression method used + encryptionMethod*: int16 ## encryption method used - Tzip = object - Tzip_source = object - Tzip_file = object + TZip = object + TZipSource = object + TZipFile = object - Pzip* = ptr Tzip ## represents a zip archive - Pzip_file* = ptr Tzip_file ## represents a file within an archive - Pzip_source* = ptr Tzip_source ## represents a source for an archive + PZip* = ptr TZip ## represents a zip archive + PZipFile* = ptr TZipFile ## represents a file within an archive + PZipSource* = ptr TZipSource ## represents a source for an archive # flags for zip_name_locate, zip_fopen, zip_stat, ... @@ -166,84 +166,84 @@ const ZIP_SOURCE_ERROR* = 4'i32 ## get error information constZIP_SOURCE_FREE* = 5'i32 ## cleanup and free resources -proc zip_add*(para1: Pzip, para2: cstring, para3: Pzip_source): int32 {.cdecl, +proc zip_add*(para1: PZip, para2: cstring, para3: PZipSource): int32 {.cdecl, importc: "zip_add", mydll.} -proc zip_add_dir*(para1: Pzip, para2: cstring): int32 {.cdecl, +proc zip_add_dir*(para1: PZip, para2: cstring): int32 {.cdecl, importc: "zip_add_dir", mydll.} -proc zip_close*(para1: Pzip) {.cdecl, importc: "zip_close", mydll.} -proc zip_delete*(para1: Pzip, para2: int32): int32 {.cdecl, mydll, +proc zip_close*(para1: PZip) {.cdecl, importc: "zip_close", mydll.} +proc zip_delete*(para1: PZip, para2: int32): int32 {.cdecl, mydll, importc: "zip_delete".} -proc zip_error_clear*(para1: Pzip) {.cdecl, importc: "zip_error_clear", mydll.} -proc zip_error_get*(para1: Pzip, para2: ptr int32, para3: ptr int32) {.cdecl, +proc zip_error_clear*(para1: PZip) {.cdecl, importc: "zip_error_clear", mydll.} +proc zip_error_get*(para1: PZip, para2: ptr int32, para3: ptr int32) {.cdecl, importc: "zip_error_get", mydll.} proc zip_error_get_sys_type*(para1: int32): int32 {.cdecl, mydll, importc: "zip_error_get_sys_type".} proc zip_error_to_str*(para1: cstring, para2: int, para3: int32, para4: int32): int32 {.cdecl, mydll, importc: "zip_error_to_str".} -proc zip_fclose*(para1: Pzip_file) {.cdecl, mydll, +proc zip_fclose*(para1: PZipFile) {.cdecl, mydll, importc: "zip_fclose".} -proc zip_file_error_clear*(para1: Pzip_file) {.cdecl, mydll, +proc zip_file_error_clear*(para1: PZipFile) {.cdecl, mydll, importc: "zip_file_error_clear".} -proc zip_file_error_get*(para1: Pzip_file, para2: ptr int32, para3: ptr int32) {. +proc zip_file_error_get*(para1: PZipFile, para2: ptr int32, para3: ptr int32) {. cdecl, mydll, importc: "zip_file_error_get".} -proc zip_file_strerror*(para1: Pzip_file): cstring {.cdecl, mydll, +proc zip_file_strerror*(para1: PZipFile): cstring {.cdecl, mydll, importc: "zip_file_strerror".} -proc zip_fopen*(para1: Pzip, para2: cstring, para3: int32): Pzip_file {.cdecl, +proc zip_fopen*(para1: PZip, para2: cstring, para3: int32): PZipFile {.cdecl, mydll, importc: "zip_fopen".} -proc zip_fopen_index*(para1: Pzip, para2: int32, para3: int32): Pzip_file {. +proc zip_fopen_index*(para1: PZip, para2: int32, para3: int32): PZipFile {. cdecl, mydll, importc: "zip_fopen_index".} -proc zip_fread*(para1: Pzip_file, para2: pointer, para3: int): int {. +proc zip_fread*(para1: PZipFile, para2: pointer, para3: int): int {. cdecl, mydll, importc: "zip_fread".} -proc zip_get_archive_comment*(para1: Pzip, para2: ptr int32, para3: int32): cstring {. +proc zip_get_archive_comment*(para1: PZip, para2: ptr int32, para3: int32): cstring {. cdecl, mydll, importc: "zip_get_archive_comment".} -proc zip_get_archive_flag*(para1: Pzip, para2: int32, para3: int32): int32 {. +proc zip_get_archive_flag*(para1: PZip, para2: int32, para3: int32): int32 {. cdecl, mydll, importc: "zip_get_archive_flag".} -proc zip_get_file_comment*(para1: Pzip, para2: int32, para3: ptr int32, +proc zip_get_file_comment*(para1: PZip, para2: int32, para3: ptr int32, para4: int32): cstring {.cdecl, mydll, importc: "zip_get_file_comment".} -proc zip_get_name*(para1: Pzip, para2: int32, para3: int32): cstring {.cdecl, +proc zip_get_name*(para1: PZip, para2: int32, para3: int32): cstring {.cdecl, mydll, importc: "zip_get_name".} -proc zip_get_num_files*(para1: Pzip): int32 {.cdecl, +proc zip_get_num_files*(para1: PZip): int32 {.cdecl, mydll, importc: "zip_get_num_files".} -proc zip_name_locate*(para1: Pzip, para2: cstring, para3: int32): int32 {.cdecl, +proc zip_name_locate*(para1: PZip, para2: cstring, para3: int32): int32 {.cdecl, mydll, importc: "zip_name_locate".} -proc zip_open*(para1: cstring, para2: int32, para3: ptr int32): Pzip {.cdecl, +proc zip_open*(para1: cstring, para2: int32, para3: ptr int32): PZip {.cdecl, mydll, importc: "zip_open".} -proc zip_rename*(para1: Pzip, para2: int32, para3: cstring): int32 {.cdecl, +proc zip_rename*(para1: PZip, para2: int32, para3: cstring): int32 {.cdecl, mydll, importc: "zip_rename".} -proc zip_replace*(para1: Pzip, para2: int32, para3: Pzip_source): int32 {.cdecl, +proc zip_replace*(para1: PZip, para2: int32, para3: PZipSource): int32 {.cdecl, mydll, importc: "zip_replace".} -proc zip_set_archive_comment*(para1: Pzip, para2: cstring, para3: int32): int32 {. +proc zip_set_archive_comment*(para1: PZip, para2: cstring, para3: int32): int32 {. cdecl, mydll, importc: "zip_set_archive_comment".} -proc zip_set_archive_flag*(para1: Pzip, para2: int32, para3: int32): int32 {. +proc zip_set_archive_flag*(para1: PZip, para2: int32, para3: int32): int32 {. cdecl, mydll, importc: "zip_set_archive_flag".} -proc zip_set_file_comment*(para1: Pzip, para2: int32, para3: cstring, +proc zip_set_file_comment*(para1: PZip, para2: int32, para3: cstring, para4: int32): int32 {.cdecl, mydll, importc: "zip_set_file_comment".} -proc zip_source_buffer*(para1: Pzip, para2: pointer, para3: int, para4: int32): Pzip_source {. +proc zip_source_buffer*(para1: PZip, para2: pointer, para3: int, para4: int32): PZipSource {. cdecl, mydll, importc: "zip_source_buffer".} -proc zip_source_file*(para1: Pzip, para2: cstring, para3: int, para4: int): Pzip_source {. +proc zip_source_file*(para1: PZip, para2: cstring, para3: int, para4: int): PZipSource {. cdecl, mydll, importc: "zip_source_file".} -proc zip_source_filep*(para1: Pzip, para2: TFile, para3: int, para4: int): Pzip_source {. +proc zip_source_filep*(para1: PZip, para2: TFile, para3: int, para4: int): PZipSource {. cdecl, mydll, importc: "zip_source_filep".} -proc zip_source_free*(para1: Pzip_source) {.cdecl, mydll, +proc zip_source_free*(para1: PZipSource) {.cdecl, mydll, importc: "zip_source_free".} -proc zip_source_function*(para1: Pzip, para2: Tzip_source_callback, - para3: pointer): Pzip_source {.cdecl, mydll, +proc zip_source_function*(para1: PZip, para2: TZipSourceCallback, + para3: pointer): PZipSource {.cdecl, mydll, importc: "zip_source_function".} -proc zip_source_zip*(para1: Pzip, para2: Pzip, para3: int32, para4: int32, - para5: int, para6: int): Pzip_source {.cdecl, mydll, +proc zip_source_zip*(para1: PZip, para2: PZip, para3: int32, para4: int32, + para5: int, para6: int): PZipSource {.cdecl, mydll, importc: "zip_source_zip".} -proc zip_stat*(para1: Pzip, para2: cstring, para3: int32, para4: Pzip_stat): int32 {. +proc zip_stat*(para1: PZip, para2: cstring, para3: int32, para4: PZipStat): int32 {. cdecl, mydll, importc: "zip_stat".} -proc zip_stat_index*(para1: Pzip, para2: int32, para3: int32, para4: Pzip_stat): int32 {. +proc zip_stat_index*(para1: PZip, para2: int32, para3: int32, para4: PZipStat): int32 {. cdecl, mydll, importc: "zip_stat_index".} -proc zip_stat_init*(para1: Pzip_stat) {.cdecl, mydll, importc: "zip_stat_init".} -proc zip_strerror*(para1: Pzip): cstring {.cdecl, mydll, importc: "zip_strerror".} -proc zip_unchange*(para1: Pzip, para2: int32): int32 {.cdecl, mydll, +proc zip_stat_init*(para1: PZipStat) {.cdecl, mydll, importc: "zip_stat_init".} +proc zip_strerror*(para1: PZip): cstring {.cdecl, mydll, importc: "zip_strerror".} +proc zip_unchange*(para1: PZip, para2: int32): int32 {.cdecl, mydll, importc: "zip_unchange".} -proc zip_unchange_all*(para1: Pzip): int32 {.cdecl, mydll, +proc zip_unchange_all*(para1: PZip): int32 {.cdecl, mydll, importc: "zip_unchange_all".} -proc zip_unchange_archive*(para1: Pzip): int32 {.cdecl, mydll, +proc zip_unchange_archive*(para1: PZip): int32 {.cdecl, mydll, importc: "zip_unchange_archive".} diff --git a/readme.md b/readme.md index f74f81283..3eaef0b35 100644 --- a/readme.md +++ b/readme.md @@ -9,7 +9,7 @@ the C source of an older version of the compiler are needed to bootstrap the latest version. The C sources are available in a separate repo [here](http://github.com/nimrod-code/csources). Pre-compiled snapshots of the compiler are also available on -[Nimbuild](http://build.nimrod-code.org/). Your platform however may not +[Nimbuild](http://build.nimrod-lang.org/). Your platform however may not currently be built for. The compiler currently supports the following platform and architecture @@ -47,9 +47,11 @@ The above steps can be performed on Windows in a similar fashion, the instead of ``build.sh``. ## Getting help -A [forum](http://forum.nimrod-code.org/) is available if you have any questions, -and you can also get help in the IRC channel -on [Freenode](irc://irc.freenode.net/nimrod) in #nimrod. +A [forum](http://forum.nimrod-lang.org/) is available if you have any +questions, and you can also get help in the IRC channel on +[Freenode](irc://irc.freenode.net/nimrod) in #nimrod. If you ask questions on +[StackOverflow use the nimrod +tag](http://stackoverflow.com/questions/tagged/nimrod). ## License The compiler and the standard library are licensed under the MIT license, @@ -59,5 +61,5 @@ allowing you to create commercial applications. Read copying.txt for more details. -Copyright (c) 2004-2013 Andreas Rumpf. +Copyright (c) 2004-2014 Andreas Rumpf. All rights reserved. diff --git a/readme.txt b/readme.txt index f74f81283..3eaef0b35 100644 --- a/readme.txt +++ b/readme.txt @@ -9,7 +9,7 @@ the C source of an older version of the compiler are needed to bootstrap the latest version. The C sources are available in a separate repo [here](http://github.com/nimrod-code/csources). Pre-compiled snapshots of the compiler are also available on -[Nimbuild](http://build.nimrod-code.org/). Your platform however may not +[Nimbuild](http://build.nimrod-lang.org/). Your platform however may not currently be built for. The compiler currently supports the following platform and architecture @@ -47,9 +47,11 @@ The above steps can be performed on Windows in a similar fashion, the instead of ``build.sh``. ## Getting help -A [forum](http://forum.nimrod-code.org/) is available if you have any questions, -and you can also get help in the IRC channel -on [Freenode](irc://irc.freenode.net/nimrod) in #nimrod. +A [forum](http://forum.nimrod-lang.org/) is available if you have any +questions, and you can also get help in the IRC channel on +[Freenode](irc://irc.freenode.net/nimrod) in #nimrod. If you ask questions on +[StackOverflow use the nimrod +tag](http://stackoverflow.com/questions/tagged/nimrod). ## License The compiler and the standard library are licensed under the MIT license, @@ -59,5 +61,5 @@ allowing you to create commercial applications. Read copying.txt for more details. -Copyright (c) 2004-2013 Andreas Rumpf. +Copyright (c) 2004-2014 Andreas Rumpf. All rights reserved. diff --git a/tests/run/tactiontable.nim b/tests/actiontable/tactiontable.nim index e2f19a099..e2f19a099 100644 --- a/tests/run/tactiontable.nim +++ b/tests/actiontable/tactiontable.nim diff --git a/tests/reject/tactiontable2.nim b/tests/actiontable/tactiontable2.nim index dbfa42f18..00b427603 100644 --- a/tests/reject/tactiontable2.nim +++ b/tests/actiontable/tactiontable2.nim @@ -5,23 +5,23 @@ discard """ import tables -proc action1(arg: string) = +proc action1(arg: string) = echo "action 1 ", arg -proc action2(arg: string) = +proc action2(arg: string) = echo "action 2 ", arg -proc action3(arg: string) = +proc action3(arg: string) = echo "action 3 ", arg -proc action4(arg: string) = +proc action4(arg: string) = echo "action 4 ", arg const actionTable = { - "A": action1, - "B": action2, - "C": action3, + "A": action1, + "B": action2, + "C": action3, "D": action4}.toTable actionTable["C"]("arg") diff --git a/tests/compile/talias.nim b/tests/alias/talias.nim index 819289c2e..819289c2e 100644 --- a/tests/compile/talias.nim +++ b/tests/alias/talias.nim diff --git a/tests/reject/mambsym1.nim b/tests/ambsym/mambsym1.nim index cf8ac5242..cf8ac5242 100644 --- a/tests/reject/mambsym1.nim +++ b/tests/ambsym/mambsym1.nim diff --git a/tests/reject/mambsym2.nim b/tests/ambsym/mambsym2.nim index eac8de6ba..eac8de6ba 100644 --- a/tests/reject/mambsym2.nim +++ b/tests/ambsym/mambsym2.nim diff --git a/tests/run/mambsys1.nim b/tests/ambsym/mambsys1.nim index 5472b5ae4..5472b5ae4 100644 --- a/tests/run/mambsys1.nim +++ b/tests/ambsym/mambsys1.nim diff --git a/tests/run/mambsys2.nim b/tests/ambsym/mambsys2.nim index 395425b86..395425b86 100644 --- a/tests/run/mambsys2.nim +++ b/tests/ambsym/mambsys2.nim diff --git a/tests/reject/tambsym.nim b/tests/ambsym/tambsym.nim index 902274648..902274648 100644 --- a/tests/reject/tambsym.nim +++ b/tests/ambsym/tambsym.nim diff --git a/tests/run/tambsym2.nim b/tests/ambsym/tambsym2.nim index 745427c54..745427c54 100644 --- a/tests/run/tambsym2.nim +++ b/tests/ambsym/tambsym2.nim diff --git a/tests/reject/tambsym3.nim b/tests/ambsym/tambsym3.nim index 0155f258c..0155f258c 100644 --- a/tests/reject/tambsym3.nim +++ b/tests/ambsym/tambsym3.nim diff --git a/tests/run/tambsys.nim b/tests/ambsym/tambsys.nim index 67522d7c9..67522d7c9 100644 --- a/tests/run/tambsys.nim +++ b/tests/ambsym/tambsys.nim diff --git a/tests/run/tarray.nim b/tests/array/tarray.nim index 16ef558d1..16ef558d1 100644 --- a/tests/run/tarray.nim +++ b/tests/array/tarray.nim diff --git a/tests/run/tarray2.nim b/tests/array/tarray2.nim index b6adabb45..b6adabb45 100644 --- a/tests/run/tarray2.nim +++ b/tests/array/tarray2.nim diff --git a/tests/run/tarray3.nim b/tests/array/tarray3.nim index d28778357..d28778357 100644 --- a/tests/run/tarray3.nim +++ b/tests/array/tarray3.nim diff --git a/tests/reject/tarraycons.nim b/tests/array/tarraycons.nim index 7de518b6e..7de518b6e 100644 --- a/tests/reject/tarraycons.nim +++ b/tests/array/tarraycons.nim diff --git a/tests/run/tarraycons.nim b/tests/array/tarraycons2.nim index 0b2a42c2f..0b2a42c2f 100644 --- a/tests/run/tarraycons.nim +++ b/tests/array/tarraycons2.nim diff --git a/tests/reject/tarrayplus.nim b/tests/array/tarrayplus.nim index 8c7452e85..8c7452e85 100644 --- a/tests/reject/tarrayplus.nim +++ b/tests/array/tarrayplus.nim diff --git a/tests/compile/tarrindx.nim b/tests/array/tarrindx.nim index 13919cc2c..13919cc2c 100644 --- a/tests/compile/tarrindx.nim +++ b/tests/array/tarrindx.nim diff --git a/tests/run/tassert.nim b/tests/assert/tassert.nim index 0ea8d2034..0ea8d2034 100644 --- a/tests/run/tassert.nim +++ b/tests/assert/tassert.nim diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim new file mode 100644 index 000000000..263893767 --- /dev/null +++ b/tests/assert/tfailedassert.nim @@ -0,0 +1,51 @@ +discard """ + output: ''' +WARNING: false first asseertion from bar +ERROR: false second assertion from bar +-1 +tests/assert/tfailedassert.nim:27 false assertion from foo +''' +""" + +type + TLineInfo = tuple[filename: string, line: int] + + TMyError = object of E_Base + lineinfo: TLineInfo + + EMyError = ref TMyError + +# module-wide policy to change the failed assert +# exception type in order to include a lineinfo +onFailedAssert(msg): + var e = new(TMyError) + e.msg = msg + e.lineinfo = instantiationInfo(-2) + raise e + +proc foo = + assert(false, "assertion from foo") + +proc bar: int = + # local overrides that are active only + # in this proc + onFailedAssert(msg): echo "WARNING: " & msg + + assert(false, "first asseertion from bar") + + onFailedAssert(msg): + echo "ERROR: " & msg + return -1 + + assert(false, "second assertion from bar") + return 10 + +echo("") +echo(bar()) + +try: + foo() +except: + let e = EMyError(getCurrentException()) + echo e.lineinfo.filename, ":", e.lineinfo.line, " ", e.msg + diff --git a/tests/assert/tunittests.nim b/tests/assert/tunittests.nim new file mode 100644 index 000000000..cbbfe63c6 --- /dev/null +++ b/tests/assert/tunittests.nim @@ -0,0 +1 @@ +import "../template/utemplates", "../closure/uclosures" diff --git a/tests/run/tuserassert.nim b/tests/assert/tuserassert.nim index 8710ee486..8710ee486 100644 --- a/tests/run/tuserassert.nim +++ b/tests/assert/tuserassert.nim diff --git a/tests/compile/tassign.nim b/tests/assign/tassign.nim index f51c20783..f51c20783 100644 --- a/tests/compile/tassign.nim +++ b/tests/assign/tassign.nim diff --git a/tests/run/tcopy.nim b/tests/assign/tcopy.nim index 5feb0d6b3..5feb0d6b3 100644 --- a/tests/run/tcopy.nim +++ b/tests/assign/tcopy.nim diff --git a/tests/run/tgenericassign.nim b/tests/assign/tgenericassign.nim index 654b0ab8f..654b0ab8f 100644 --- a/tests/run/tgenericassign.nim +++ b/tests/assign/tgenericassign.nim diff --git a/tests/run/tgenericassigntuples.nim b/tests/assign/tgenericassigntuples.nim index 6dd63a984..6dd63a984 100644 --- a/tests/run/tgenericassigntuples.nim +++ b/tests/assign/tgenericassigntuples.nim diff --git a/tests/run/tobjasgn.nim b/tests/assign/tobjasgn.nim index 5f411063f..5f411063f 100644 --- a/tests/run/tobjasgn.nim +++ b/tests/assign/tobjasgn.nim diff --git a/tests/run/tvariantasgn.nim b/tests/assign/tvariantasgn.nim index 46cc23dd1..46cc23dd1 100644 --- a/tests/run/tvariantasgn.nim +++ b/tests/assign/tvariantasgn.nim diff --git a/tests/run/tastoverload1.nim b/tests/astoverload/tastoverload1.nim index c8705547a..c8705547a 100644 --- a/tests/run/tastoverload1.nim +++ b/tests/astoverload/tastoverload1.nim diff --git a/tests/run/tasynciossl.nim b/tests/async/tasynciossl.nim index fbed46efb..fbed46efb 100644 --- a/tests/run/tasynciossl.nim +++ b/tests/async/tasynciossl.nim diff --git a/tests/run/tasyncudp.nim b/tests/async/tasyncudp.nim index fd7f3d568..fd7f3d568 100644 --- a/tests/run/tasyncudp.nim +++ b/tests/async/tasyncudp.nim diff --git a/tests/run/mbind3.nim b/tests/bind/mbind3.nim index d02bc79d0..d02bc79d0 100644 --- a/tests/run/mbind3.nim +++ b/tests/bind/mbind3.nim diff --git a/tests/run/tbind1.nim b/tests/bind/tbind1.nim index 6593b2307..6593b2307 100644 --- a/tests/run/tbind1.nim +++ b/tests/bind/tbind1.nim diff --git a/tests/reject/tbind2.nim b/tests/bind/tbind2.nim index 72a9844bb..e8e21ad02 100644 --- a/tests/reject/tbind2.nim +++ b/tests/bind/tbind2.nim @@ -1,6 +1,6 @@ discard """ file: "tbind2.nim" - line: 12 + line: 14 errormsg: "ambiguous call" """ # Test the new ``bind`` keyword for templates diff --git a/tests/run/tbind3.nim b/tests/bind/tbind3.nim index 551acc10f..551acc10f 100644 --- a/tests/run/tbind3.nim +++ b/tests/bind/tbind3.nim diff --git a/tests/compile/tbindoverload.nim b/tests/bind/tbindoverload.nim index 6f5bb339e..6f5bb339e 100644 --- a/tests/compile/tbindoverload.nim +++ b/tests/bind/tbindoverload.nim diff --git a/tests/reject/tbindtypedesc.nim b/tests/bind/tbindtypedesc.nim index d6fbae537..d6fbae537 100644 --- a/tests/reject/tbindtypedesc.nim +++ b/tests/bind/tbindtypedesc.nim diff --git a/tests/compile/tdatabind.nim b/tests/bind/tdatabind.nim index afa8aa47b..afa8aa47b 100644 --- a/tests/compile/tdatabind.nim +++ b/tests/bind/tdatabind.nim diff --git a/tests/run/tmixin.nim b/tests/bind/tmixin.nim index d841326a5..d841326a5 100644 --- a/tests/run/tmixin.nim +++ b/tests/bind/tmixin.nim diff --git a/tests/reject/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim index bc271dcab..bc271dcab 100644 --- a/tests/reject/tnicerrorforsymchoice.nim +++ b/tests/bind/tnicerrorforsymchoice.nim diff --git a/tests/run/tborrow.nim b/tests/borrow/tborrow.nim index 8e6aeba74..8e6aeba74 100644 --- a/tests/run/tborrow.nim +++ b/tests/borrow/tborrow.nim diff --git a/tests/reject/tinvalidborrow.nim b/tests/borrow/tinvalidborrow.nim index 9ab9e8d64..9ab9e8d64 100644 --- a/tests/reject/tinvalidborrow.nim +++ b/tests/borrow/tinvalidborrow.nim diff --git a/tests/run/tcase_setconstr.nim b/tests/casestmt/tcase_setconstr.nim index 21f657c2b..21f657c2b 100644 --- a/tests/run/tcase_setconstr.nim +++ b/tests/casestmt/tcase_setconstr.nim diff --git a/tests/reject/tcaseexpr1.nim b/tests/casestmt/tcaseexpr1.nim index e5e08e25e..e5e08e25e 100644 --- a/tests/reject/tcaseexpr1.nim +++ b/tests/casestmt/tcaseexpr1.nim diff --git a/tests/reject/tcaseoverlaprange.nim b/tests/casestmt/tcaseoverlaprange.nim index 5f24c3ca9..5f24c3ca9 100644 --- a/tests/reject/tcaseoverlaprange.nim +++ b/tests/casestmt/tcaseoverlaprange.nim diff --git a/tests/reject/tcaseoverlaprange2.nim b/tests/casestmt/tcaseoverlaprange2.nim index d6e301508..d6e301508 100644 --- a/tests/reject/tcaseoverlaprange2.nim +++ b/tests/casestmt/tcaseoverlaprange2.nim diff --git a/tests/run/tcasestm.nim b/tests/casestmt/tcasestm.nim index 003ec6e50..003ec6e50 100644 --- a/tests/run/tcasestm.nim +++ b/tests/casestmt/tcasestm.nim diff --git a/tests/compile/tcomputedgoto.nim b/tests/casestmt/tcomputedgoto.nim index 2c3b4bbd4..b21fc07a3 100644 --- a/tests/compile/tcomputedgoto.nim +++ b/tests/casestmt/tcomputedgoto.nim @@ -1,16 +1,16 @@ discard """ - output: '''yeah A -yeah A -yeah CD -yeah CD -yeah A -yeah CD -yeah CD -yeah A -yeah B -yeah A -yeah A -yeah A''' + output: '''yeah A enumB +yeah A enumB +yeah CD enumD +yeah CD enumE +yeah A enumB +yeah CD enumE +yeah CD enumD +yeah A enumB +yeah B enumC +yeah A enumB +yeah A enumB +yeah A enumB''' """ type @@ -32,13 +32,14 @@ proc vm() = while true: {.computedGoto.} let instr = instructions[pc] + let ra = instr.succ # instr.regA case instr of enumA: - echo "yeah A" + echo "yeah A ", ra of enumC, enumD: - echo "yeah CD" + echo "yeah CD ", ra of enumB: - echo "yeah B" + echo "yeah B ", ra of enumE: break inc(pc) diff --git a/tests/compile/tlinearscanend.nim b/tests/casestmt/tlinearscanend.nim index 15fd0c70a..15fd0c70a 100644 --- a/tests/compile/tlinearscanend.nim +++ b/tests/casestmt/tlinearscanend.nim diff --git a/tests/compile/tccgen1.nim b/tests/ccgbugs/tccgen1.nim index 137dd545d..137dd545d 100644 --- a/tests/compile/tccgen1.nim +++ b/tests/ccgbugs/tccgen1.nim diff --git a/tests/run/tcgbug.nim b/tests/ccgbugs/tcgbug.nim index 417b909ae..417b909ae 100644 --- a/tests/run/tcgbug.nim +++ b/tests/ccgbugs/tcgbug.nim diff --git a/tests/compile/tcodegenbug1.nim b/tests/ccgbugs/tcodegenbug1.nim index 7d0fc4ad5..7d0fc4ad5 100644 --- a/tests/compile/tcodegenbug1.nim +++ b/tests/ccgbugs/tcodegenbug1.nim diff --git a/tests/run/tclosure.nim b/tests/closure/tclosure.nim index d9e7b8ee4..d9e7b8ee4 100644 --- a/tests/run/tclosure.nim +++ b/tests/closure/tclosure.nim diff --git a/tests/run/tclosure2.nim b/tests/closure/tclosure2.nim index d2c16eac9..d2c16eac9 100644 --- a/tests/run/tclosure2.nim +++ b/tests/closure/tclosure2.nim diff --git a/tests/run/tclosure3.nim b/tests/closure/tclosure3.nim index bb217387f..bb217387f 100644 --- a/tests/run/tclosure3.nim +++ b/tests/closure/tclosure3.nim diff --git a/tests/compile/tclosure4.nim b/tests/closure/tclosure4.nim index 8e08376b6..8e08376b6 100644 --- a/tests/compile/tclosure4.nim +++ b/tests/closure/tclosure4.nim diff --git a/tests/compile/tclosurebug2.nim b/tests/closure/tclosurebug2.nim index ec4f0045b..ec4f0045b 100644 --- a/tests/compile/tclosurebug2.nim +++ b/tests/closure/tclosurebug2.nim diff --git a/tests/run/tinterf.nim b/tests/closure/tinterf.nim index 726fac9f6..726fac9f6 100644 --- a/tests/run/tinterf.nim +++ b/tests/closure/tinterf.nim diff --git a/tests/reject/tinvalidclosure.nim b/tests/closure/tinvalidclosure.nim index c06270bfa..c06270bfa 100644 --- a/tests/reject/tinvalidclosure.nim +++ b/tests/closure/tinvalidclosure.nim diff --git a/tests/reject/tinvalidclosure2.nim b/tests/closure/tinvalidclosure2.nim index 20e465c12..20e465c12 100644 --- a/tests/reject/tinvalidclosure2.nim +++ b/tests/closure/tinvalidclosure2.nim diff --git a/tests/compile/tnamedparamanonproc.nim b/tests/closure/tnamedparamanonproc.nim index 272b84e91..94e32894f 100644 --- a/tests/compile/tnamedparamanonproc.nim +++ b/tests/closure/tnamedparamanonproc.nim @@ -4,8 +4,8 @@ type TButtonClicked = proc(button: PButton) {.nimcall.} proc newButton*(onClick: TButtonClicked) = - nil - + discard + proc main() = newButton(onClick = proc(b: PButton) = var requestomat = 12 diff --git a/tests/compile/tnestedproc.nim b/tests/closure/tnestedproc.nim index 49ec6f9a7..49ec6f9a7 100644 --- a/tests/compile/tnestedproc.nim +++ b/tests/closure/tnestedproc.nim diff --git a/tests/run/uclosures.nim b/tests/closure/uclosures.nim index 6eea29ca1..6eea29ca1 100644 --- a/tests/run/uclosures.nim +++ b/tests/closure/uclosures.nim diff --git a/tests/run/tcnstseq.nim b/tests/cnstseq/tcnstseq.nim index e7d2333b4..e7d2333b4 100644 --- a/tests/run/tcnstseq.nim +++ b/tests/cnstseq/tcnstseq.nim diff --git a/tests/run/tcnstseq2.nim b/tests/cnstseq/tcnstseq2.nim index 1a27b2ba7..1a27b2ba7 100644 --- a/tests/run/tcnstseq2.nim +++ b/tests/cnstseq/tcnstseq2.nim diff --git a/tests/run/tcnstseq3.nim b/tests/cnstseq/tcnstseq3.nim index e59516e85..e59516e85 100644 --- a/tests/run/tcnstseq3.nim +++ b/tests/cnstseq/tcnstseq3.nim diff --git a/tests/collections/ttables.nim b/tests/collections/ttables.nim new file mode 100644 index 000000000..f374d5504 --- /dev/null +++ b/tests/collections/ttables.nim @@ -0,0 +1,22 @@ +import tables + +doAssert indexBy(newSeq[int](), proc(x: int):int = x) == initTable[int, int](), "empty int table" + +var tbl1 = initTable[int, int]() +tbl1.add(1,1) +tbl1.add(2,2) +doAssert indexBy(@[1,2], proc(x: int):int = x) == tbl1, "int table" + +type + TElem = object + foo: int + bar: string + +let + elem1 = TElem(foo: 1, bar: "bar") + elem2 = TElem(foo: 2, bar: "baz") + +var tbl2 = initTable[string, TElem]() +tbl2.add("bar", elem1) +tbl2.add("baz", elem2) +doAssert indexBy(@[elem1,elem2], proc(x: TElem): string = x.bar) == tbl2, "element table" diff --git a/tests/compile/mvarious.nim b/tests/compile/mvarious.nim deleted file mode 100644 index 333b34d33..000000000 --- a/tests/compile/mvarious.nim +++ /dev/null @@ -1,6 +0,0 @@ -# Test a submodule - -#type -# TStringArr = array [0.. *] of string - -proc exportme* = nil diff --git a/tests/compile/sunset.tmpl b/tests/compile/sunset.tmpl deleted file mode 100644 index 6475bac4e..000000000 --- a/tests/compile/sunset.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -#! stdtmpl -#proc sunsetTemplate*(current, ticker, content: string, -# tabs: openarray[array[0..1, string]]): string = -# result = "" -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - -<head> - <title>Nimrod Programming System</title> - <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> - <link rel="stylesheet" type="text/css" href="style/style.css" /> -</head> - -<body> - <div id="main"> - <div id="links"> - <!-- **** INSERT LINKS HERE **** --> - </div> - <div id="logo"><h1>Nimrod Programming System</h1></div> - <div id="content"> - <div id="menu"> - <ul> - #for item in items(tabs): - #var name = item[0] - #var t = item[1] - #if t == current: - <li><a id="selected" href="${t}.html" title = "Nimrod - $name">$name</a></li> - #else: - <li><a href="${t}.html" title = "Nimrod - $name">$name</a></li> - #end if - #end for - </ul> - </div> - <div id="column1"> - <div class="sidebaritem"> - <div class="sbihead"> - <h1>latest news</h1> - </div> - <div class="sbicontent"> - $ticker - </div> - </div> - <div class="sidebaritem"> - <div class="sbihead"> - <h1>additional links</h1> - </div> - <div class="sbilinks"> - <!-- **** INSERT ADDITIONAL LINKS HERE **** --> - <ul> - <li><a class="reference" href="http://llvm.org">LLVM</a></li> - <li><a class="reference" href="http://gcc.gnu.org">GCC</a></li> - </ul> - </div> - </div> - </div> - <div id="column2"> - $content - </div> - </div> - <div id="footer"> - copyright © 2008 Andreas Rumpf | Last update: ${getDateStr()} - | <a class="reference" href="http://validator.w3.org/check?uri=referer">XHTML 1.1</a> - | <a class="reference" href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> - | <a class="reference" href="http://www.dcarter.co.uk">design by dcarter</a> - </div> - </div> -</body> -</html> diff --git a/tests/compile/tambsym2.nim b/tests/compile/tambsym2.nim deleted file mode 100644 index 7758cc31a..000000000 --- a/tests/compile/tambsym2.nim +++ /dev/null @@ -1,6 +0,0 @@ - -from sdl import PSurface - -discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34, - 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000'i32) - diff --git a/tests/compile/tbindtypedesc.nim b/tests/compile/tbindtypedesc.nim deleted file mode 100644 index dd4ef854c..000000000 --- a/tests/compile/tbindtypedesc.nim +++ /dev/null @@ -1,87 +0,0 @@ -discard """ - msg: ''' -int -float -TFoo -TFoo -''' -""" - -import typetraits - -type - TFoo = object - x, y: int - - TBar = tuple - x, y: int - -template good(e: expr) = - static: assert(compiles(e)) - -template bad(e: expr) = - static: assert(not compiles(e)) - -proc genericParamRepeated[T: typedesc](a: T, b: T) = - static: - echo a.name - echo b.name - -good(genericParamRepeated(int, int)) -good(genericParamRepeated(float, float)) - -bad(genericParamRepeated(string, int)) -bad(genericParamRepeated(int, float)) - -proc genericParamOnce[T: typedesc](a, b: T) = - static: - echo a.name - echo b.name - -good(genericParamOnce(int, int)) -good(genericParamOnce(TFoo, TFoo)) - -bad(genericParamOnce(string, int)) -bad(genericParamOnce(TFoo, float)) - -proc typePairs(A, B: type1; C, D: type2) = nil - -good(typePairs(int, int, TFoo, TFOO)) -good(typePairs(TBAR, TBar, TBAR, TBAR)) -good(typePairs(int, int, string, string)) - -bad(typePairs(TBAR, TBar, TBar, TFoo)) -bad(typePairs(string, int, TBAR, TBAR)) - -proc typePairs2[T: typedesc, U: typedesc](A, B: T; C, D: U) = nil - -good(typePairs2(int, int, TFoo, TFOO)) -good(typePairs2(TBAR, TBar, TBAR, TBAR)) -good(typePairs2(int, int, string, string)) - -bad(typePairs2(TBAR, TBar, TBar, TFoo)) -bad(typePairs2(string, int, TBAR, TBAR)) - -proc dontBind(a: typedesc, b: typedesc) = - static: - echo a.name - echo b.name - -good(dontBind(int, float)) -good(dontBind(TFoo, TFoo)) - -proc dontBind2(a, b: typedesc) = nil - -good(dontBind2(int, float)) -good(dontBind2(TBar, int)) - -proc bindArg(T: typedesc, U: typedesc, a, b: T, c, d: U) = nil - -good(bindArg(int, string, 10, 20, "test", "nest")) -good(bindArg(int, int, 10, 20, 30, 40)) - -bad(bindArg(int, string, 10, "test", "test", "nest")) -bad(bindArg(int, int, 10, 20, 30, "test")) -bad(bindArg(int, string, 10.0, 20, "test", "nest")) -bad(bindArg(int, string, "test", "nest", 10, 20)) - diff --git a/tests/compile/tcmdline.nim b/tests/compile/tcmdline.nim deleted file mode 100644 index f4ee20d31..000000000 --- a/tests/compile/tcmdline.nim +++ /dev/null @@ -1,14 +0,0 @@ -# Test the command line - -import - os, strutils - -var - i: int - params = paramCount() -i = 0 -writeln(stdout, "This exe: " & getAppFilename()) -writeln(stdout, "Number of parameters: " & $params) -while i <= params: - writeln(stdout, paramStr(i)) - i = i + 1 diff --git a/tests/compile/tcolonisproc.nim b/tests/compile/tcolonisproc.nim deleted file mode 100644 index e55587dfc..000000000 --- a/tests/compile/tcolonisproc.nim +++ /dev/null @@ -1,12 +0,0 @@ - -proc p(a, b: int, c: proc ()) = - c() - - -p(1, 3): - echo 1 - echo 3 - -p(1, 1, proc() = - echo 1 - echo 2) diff --git a/tests/compile/tdllvar.nim b/tests/compile/tdllvar.nim deleted file mode 100644 index ab767770c..000000000 --- a/tests/compile/tdllvar.nim +++ /dev/null @@ -1,16 +0,0 @@ -import os - -proc getDllName: string = - result = "mylib.dll" - if ExistsFile(result): return - result = "mylib2.dll" - if ExistsFile(result): return - quit("could not load dynamic library") - -proc myImport(s: cstring) {.cdecl, importc, dynlib: getDllName().} -proc myImport2(s: int) {.cdecl, importc, dynlib: getDllName().} - -myImport("test2") -myImport2(12) - - diff --git a/tests/compile/temptyecho.nim b/tests/compile/temptyecho.nim deleted file mode 100644 index 5f1aa6515..000000000 --- a/tests/compile/temptyecho.nim +++ /dev/null @@ -1,2 +0,0 @@ -echo() - diff --git a/tests/compile/tendian.nim b/tests/compile/tendian.nim deleted file mode 100644 index 256e2653c..000000000 --- a/tests/compile/tendian.nim +++ /dev/null @@ -1,3 +0,0 @@ -# test the new endian magic - -writeln(stdout, repr(system.cpuEndian)) diff --git a/tests/compile/tfib.nim b/tests/compile/tfib.nim deleted file mode 100644 index 09a4d5038..000000000 --- a/tests/compile/tfib.nim +++ /dev/null @@ -1,11 +0,0 @@ - -iterator fibonacci(): int = - var a = 0 - var b = 1 - while true: - yield a - var c = b - b = a - a = a + c - - diff --git a/tests/compile/tgenericshardcases.nim b/tests/compile/tgenericshardcases.nim deleted file mode 100644 index 90981c701..000000000 --- a/tests/compile/tgenericshardcases.nim +++ /dev/null @@ -1,30 +0,0 @@ -discard """ - file: "tgenericshardcases.nim" - output: "int\nfloat\nint\nstring" -""" - -import typetraits - -proc typeNameLen(x: typedesc): int {.compileTime.} = - result = x.name.len - -macro selectType(a, b: typedesc): typedesc = - result = a - -type - Foo[T] = object - data1: array[high(T), int] - data2: array[1..typeNameLen(T), selectType(float, string)] - - MyEnum = enum A, B, C,D - -var f1: Foo[MyEnum] -var f2: Foo[int8] - -static: - assert high(f1.data1) == D - assert high(f1.data2) == 6 # length of MyEnum - - assert high(f2.data1) == 127 - assert high(f2.data2) == 4 # length of int8 - diff --git a/tests/compile/tgetstartmilsecs.nim b/tests/compile/tgetstartmilsecs.nim deleted file mode 100644 index 5a3368e0f..000000000 --- a/tests/compile/tgetstartmilsecs.nim +++ /dev/null @@ -1,7 +0,0 @@ -# -import times, os - -var start = epochTime() -os.sleep(1000) - -echo epochTime() - start #OUT 1000 diff --git a/tests/compile/tgtk.nim b/tests/compile/tgtk.nim deleted file mode 100644 index 7febb0ab8..000000000 --- a/tests/compile/tgtk.nim +++ /dev/null @@ -1,51 +0,0 @@ - -import - gtk2, glib2, atk, gdk2, gdk2pixbuf, libglade2, pango, - pangoutils - -proc hello(widget: PWidget, data: pointer) {.cdecl.} = - write(stdout, "Hello World\n") - -proc delete_event(widget: PWidget, event: PEvent, - data: pointer): bool {.cdecl.} = - # If you return FALSE in the "delete_event" signal handler, - # GTK will emit the "destroy" signal. Returning TRUE means - # you don't want the window to be destroyed. - # This is useful for popping up 'are you sure you want to quit?' - # type dialogs. - write(stdout, "delete event occurred\n") - # Change TRUE to FALSE and the main window will be destroyed with - # a "delete_event". - return false - -# Another callback -proc mydestroy(widget: PWidget, data: pointer) {.cdecl.} = - gtk2.main_quit() - -proc mymain() = - # GtkWidget is the storage type for widgets - gtk2.nimrod_init() - var window = window_new(gtk2.WINDOW_TOPLEVEL) - discard g_signal_connect(window, "delete_event", - Gcallback(delete_event), nil) - discard g_signal_connect(window, "destroy", Gcallback(mydestroy), nil) - # Sets the border width of the window. - set_border_width(window, 10) - - # Creates a new button with the label "Hello World". - var button = button_new("Hello World") - - discard g_signal_connect(button, "clicked", Gcallback(hello), nil) - - # This packs the button into the window (a gtk container). - add(window, button) - - # The final step is to display this newly created widget. - show(button) - - # and the window - show(window) - - gtk2.main() - -mymain() diff --git a/tests/compile/thallo.nim b/tests/compile/thallo.nim deleted file mode 100644 index 7244c27a1..000000000 --- a/tests/compile/thallo.nim +++ /dev/null @@ -1,85 +0,0 @@ -# Hallo - -import - os, strutils, macros - -type - TMyEnum = enum - meA, meB, meC, meD - -when isMainModule: - {.hint: "this is the main file".} - -proc fac[T](x: T): T = - # test recursive generic procs - if x <= 1: return 1 - else: return x.`*`(fac(x-1)) - -macro macrotest(n: expr): stmt {.immediate.} = - let n = callsite() - expectKind(n, nnkCall) - expectMinLen(n, 2) - result = newNimNode(nnkStmtList, n) - for i in 2..n.len-1: - result.add(newCall("write", n[1], n[i])) - result.add(newCall("writeln", n[1], newStrLitNode(""))) - -macro debug(n: expr): stmt {.immediate.} = - let n = callsite() - result = newNimNode(nnkStmtList, n) - for i in 1..n.len-1: - result.add(newCall("write", newIdentNode("stdout"), toStrLit(n[i]))) - result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": "))) - result.add(newCall("writeln", newIdentNode("stdout"), n[i])) - -macrotest(stdout, "finally", 4, 5, "variable", "argument lists") -macrotest(stdout) - -#GC_disable() - -echo("This was compiled by Nimrod version " & system.nimrodVersion) -writeln(stdout, "Hello", " World", "!") - -echo(["a", "b", "c", "d"].len) -for x in items(["What's", "your", "name", "?", ]): - echo(x) -var `name` = readLine(stdin) -{.breakpoint.} -echo("Hi " & thallo.name & "!\n") -debug(name) - -var testseq: seq[string] = @[ - "a", "b", "c", "d", "e" -] -echo(repr(testseq)) - -var dummy = "hello" -echo(substr(dummy, 2, 3)) - -echo($meC) - -# test tuples: -for x, y in items([(1, 2), (3, 4), (6, 1), (5, 2)]): - echo x - echo y - -proc simpleConst(): int = return 34 - -# test constant evaluation: -const - constEval3 = simpleConst() - constEval = "abc".contains('b') - constEval2 = fac(7) - -echo(constEval3) -echo(constEval) -echo(constEval2) -echo(1.`+`(2)) - -for i in 2..6: - for j in countdown(i+4, 2): - echo(fac(i * j)) - -when isMainModule: - {.hint: "this is the main file".} - diff --git a/tests/compile/theaproots.nim b/tests/compile/theaproots.nim deleted file mode 100644 index aec140f42..000000000 --- a/tests/compile/theaproots.nim +++ /dev/null @@ -1,71 +0,0 @@ -type - Bar = object - x: int - - Foo = object - rheap: ref Bar - rmaybe: ref Bar - rstack: ref Bar - list: seq[ref Bar] - listarr: array[0..5, ref Bar] - nestedtup: Tup - inner: TInner - inref: ref TInner - - TInner = object - inref: ref Bar - - Tup = tuple - tupbar: ref Bar - inner: TInner - -proc acc(x: var Foo): var ref Bar = - result = x.rheap - -proc test(maybeFoo: var Foo, - maybeSeq: var seq[ref Bar], - bars: var openarray[ref Bar], - maybeTup: var Tup) = - var bb: ref Bar - maybeFoo.rmaybe = bb - maybeFoo.list[3] = bb - maybeFoo.listarr[3] = bb - acc(maybeFoo) = bb - - var localFoo: Foo - localFoo.rstack = bb - localFoo.list[3] = bb - localFoo.listarr[3] = bb - acc(localFoo) = bb - - var heapFoo: ref Foo - heapFoo.rheap = bb - heapFoo.list[3] = bb - heapFoo.listarr[3] = bb - acc(heapFoo[]) = bb - - heapFoo.nestedtup.tupbar = bb - heapFoo.nestedtup.inner.inref = bb - heapFoo.inner.inref = bb - heapFoo.inref.inref = bb - - var locseq: seq[ref Bar] - locseq[3] = bb - - var locarr: array[0..4, ref Bar] - locarr[3] = bb - - maybeSeq[3] = bb - - bars[3] = bb - - maybeTup[0] = bb - -var - ff: ref Foo - tt: Tup - gseq: seq[ref Bar] - -new(ff) - -test(ff[], gseq, gseq, tt) diff --git a/tests/compile/tlastmod.nim b/tests/compile/tlastmod.nim deleted file mode 100644 index 75b047fc8..000000000 --- a/tests/compile/tlastmod.nim +++ /dev/null @@ -1,18 +0,0 @@ -# test the new LastModificationTime() proc - -import - os, times, strutils - -proc main() = - var - a, b: TTime - a = getLastModificationTime(ParamStr(1)) - b = getLastModificationTime(ParamStr(2)) - writeln(stdout, $a) - writeln(stdout, $b) - if a < b: - Write(stdout, "$2 is newer than $1\n" % [ParamStr(1), ParamStr(2)]) - else: - Write(stdout, "$1 is newer than $2\n" % [ParamStr(1), ParamStr(2)]) - -main() diff --git a/tests/compile/tlibs.nim b/tests/compile/tlibs.nim deleted file mode 100644 index 971b2b836..000000000 --- a/tests/compile/tlibs.nim +++ /dev/null @@ -1,24 +0,0 @@ -# Test wether the bindings at least compile... - -import - unicode, cgi, terminal, libcurl, - parsexml, parseopt, parsecfg, - osproc, complex, - sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf, - sdl_image, sdl_mixer_nosmpeg, - cursorfont, xatom, xf86vmode, xkb, xrandr, xshm, xvlib, keysym, xcms, xi, - xkblib, xrender, xutil, x, xf86dga, xinerama, xlib, xresource, xv, - gtk2, glib2, pango, gdk2, - cairowin32, cairoxlib, - odbcsql, - gl, glut, glu, glx, glext, wingl, - lua, lualib, lauxlib, mysql, sqlite3, python, tcl, - db_postgres, db_mysql, db_sqlite, ropes, sockets, browsers, httpserver, - httpclient, parseutils, unidecode, xmldom, xmldomparser, xmltree, xmlparser, - htmlparser, re, graphics, colors, pegs, subexes, dialogs - -when defined(linux): - import - zlib, zipfiles - -writeln(stdout, "test compilation of binding modules") diff --git a/tests/compile/tloops.nim b/tests/compile/tloops.nim deleted file mode 100644 index 2b1765b00..000000000 --- a/tests/compile/tloops.nim +++ /dev/null @@ -1,87 +0,0 @@ -# Test nested loops and some other things - -proc andTest() = - var a = 0 == 5 and 6 == 6 - -proc incx(x: var int) = # is built-in proc - x = x + 1 - -proc decx(x: var int) = - x = x - 1 - -proc First(y: var int) = - var x: int - i_ncx(x) - if x == 10: - y = 0 - else: - if x == 0: - incx(x) - else: - x=11 - -proc TestLoops() = - var i, j: int - while i >= 0: - if i mod 3 == 0: - break - i = i + 1 - while j == 13: - j = 13 - break - break - - while True: - break - - -proc Foo(n: int): int = - var - a, old: int - b, c: bool - F_irst(a) - if a == 10: - a = 30 - elif a == 11: - a = 22 - elif a == 12: - a = 23 - elif b: - old = 12 - else: - a = 40 - - # - b = false or 2 == 0 and 3 == 9 - a = 0 + 3 * 5 + 6 + 7 + +8 # 36 - while b: - a = a + 3 - a = a + 5 - write(stdout, "Hello!") - - -# We should come till here :-) -discard Foo(345) - -# test the new type symbol lookup feature: - -type - MyType[T] = tuple[ - x, y, z: T] - MyType2 = tuple[x, y: float] - -proc main[T]() = - var myType: MyType[T] - var b: MyType[T] - b = (1, 2, 3) - myType = b - echo myType - - var myType2: MyType2 - var c: MyType2 - c = (1.0, 2.0) - myType2 = c - echo myType2 - -main[int]() - diff --git a/tests/compile/tmandelbrot.nim b/tests/compile/tmandelbrot.nim deleted file mode 100644 index 1e39c8756..000000000 --- a/tests/compile/tmandelbrot.nim +++ /dev/null @@ -1,57 +0,0 @@ -discard """ - cmd: "nimrod cc --hints:on -d:release $# $#" -""" - -# -*- nimrod -*- - -import math -import os -import strutils - -type TComplex = tuple[re, im: float] - -proc `+` (a, b: TComplex): TComplex = - return (a.re + b.re, a.im + b.im) - -proc `*` (a, b: TComplex): TComplex = - result.re = a.re * b.re - a.im * b.im - result.im = a.re * b.im + a.im * b.re - -proc abs2 (a: TComplex): float = - return a.re * a.re + a.im * a.im - -var size = parseInt (paramStr (1)) -var bit = 128 -var byteAcc = 0 - -stdout.writeln ("P4") -stdout.write ($size) -stdout.write (" ") -stdout.writeln ($size) - -var fsize = float (size) -for y in 0 .. size-1: - var fy = 2.0 * float (y) / fsize - 1.0 - for x in 0 .. size-1: - var z = (0.0, 0.0) - var c = (float (2*x) / fsize - 1.5, fy) - - block iter: - for i in 0 .. 49: - z = z*z + c - if abs2 (z) >= 4.0: - break iter - byteAcc = byteAcc + bit - - if bit > 1: - bit = bit div 2 - else: - stdout.write (chr (byteAcc)) - bit = 128 - byteAcc = 0 - - if bit != 128: - stdout.write (chr (byteAcc)) - bit = 128 - byteAcc = 0 - diff --git a/tests/compile/tnew.nim b/tests/compile/tnew.nim deleted file mode 100644 index 6527541a2..000000000 --- a/tests/compile/tnew.nim +++ /dev/null @@ -1,49 +0,0 @@ -# Test the implementation of the new operator -# and the code generation for gc walkers -# (and the garbage collector): - -type - PNode = ref TNode - TNode = object - data: int - str: string - le, ri: PNode - - TStressTest = ref array [0..45, array [1..45, TNode]] - -proc finalizer(n: PNode) = - write(stdout, n.data) - write(stdout, " is now freed\n") - -proc newNode(data: int, le, ri: PNode): PNode = - new(result, finalizer) - result.le = le - result.ri = ri - result.data = data - -# now loop and build a tree -proc main() = - var - i = 0 - p: TStressTest - while i < 1000: - var n: PNode - - n = newNode(i, nil, newNode(i + 10000, nil, nil)) - inc(i) - new(p) - - write(stdout, "Simple tree node allocation worked!\n") - i = 0 - while i < 1000: - var m = newNode(i + 20000, nil, nil) - var k = newNode(i + 30000, nil, nil) - m.le = m - m.ri = k - k.le = m - k.ri = k - inc(i) - - write(stdout, "Simple cycle allocation worked!\n") - -main() diff --git a/tests/compile/tnewlibs.nim b/tests/compile/tnewlibs.nim deleted file mode 100644 index bdb53ae0b..000000000 --- a/tests/compile/tnewlibs.nim +++ /dev/null @@ -1,17 +0,0 @@ -# Test wether the bindings at least compile... - -import - tcl, - sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf, - sdl_image, sdl_mixer_nosmpeg, - gtk2, glib2, pango, gdk2, - unicode, cgi, terminal, libcurl, - parsexml, parseopt, parsecfg, - osproc, - cairowin32, cairoxlib, - gl, glut, glu, glx, glext, wingl, - lua, lualib, lauxlib, mysql, sqlite3, db_mongo, md5, asyncio, mimetypes, - cookies, events, ftpclient, scgi, irc - - -writeln(stdout, "test compilation of binding modules") diff --git a/tests/compile/tnewsets.nim b/tests/compile/tnewsets.nim deleted file mode 100644 index 415fe8f7e..000000000 --- a/tests/compile/tnewsets.nim +++ /dev/null @@ -1,6 +0,0 @@ -# new test for sets: - -const elem = ' ' - -var s: set[char] = {elem} -assert(elem in s and 'a' not_in s and 'c' not_in s ) diff --git a/tests/compile/tnewuns.nim b/tests/compile/tnewuns.nim deleted file mode 100644 index 5181e467c..000000000 --- a/tests/compile/tnewuns.nim +++ /dev/null @@ -1,12 +0,0 @@ -# test the new unsigned operations: - -import - strutils - -var - x, y: int - -x = 1 -y = high(int) - -writeln(stdout, $ ( x +% y ) ) diff --git a/tests/compile/tnoforward.nim b/tests/compile/tnoforward.nim deleted file mode 100644 index 0359ff348..000000000 --- a/tests/compile/tnoforward.nim +++ /dev/null @@ -1,10 +0,0 @@ -{. noforward: on .} - -proc foo(x: int) = - bar x - -proc bar(x: int) = - echo x - -foo(10) - diff --git a/tests/compile/tparedef.nim b/tests/compile/tparedef.nim deleted file mode 100644 index dedebf6b7..000000000 --- a/tests/compile/tparedef.nim +++ /dev/null @@ -1,4 +0,0 @@ -# This test is now superfluous: - -proc a(a: int) = - return diff --git a/tests/compile/tprep.nim b/tests/compile/tprep.nim deleted file mode 100644 index 4ef9e2543..000000000 --- a/tests/compile/tprep.nim +++ /dev/null @@ -1,30 +0,0 @@ -# Test the features that used to belong to the preprocessor - -import - times - -#{.warning: "This is only a test warning!".} - -const - case2 = true - case3 = true - -when defined(case1): - {.hint: "Case 1".} - when case3: - {.hint: "Case 1.3".} -elif case2: - {.hint: "Case 2".} - when case3: - {.hint: "Case 2.3".} -elif case3: - {.hint: "Case 3".} -else: - {.hint: "unknown case".} - -var - s: string -write(stdout, "compiled at " & system.compileDate & - " " & compileTime & "\n") -echo getDateStr() -echo getClockStr() diff --git a/tests/compile/tquicksort.nim b/tests/compile/tquicksort.nim deleted file mode 100644 index 6706a185e..000000000 --- a/tests/compile/tquicksort.nim +++ /dev/null @@ -1,26 +0,0 @@ -proc QuickSort(list: seq[int]): seq[int] = - if len(list) == 0: - return @[] - var pivot = list[0] - var left: seq[int] = @[] - var right: seq[int] = @[] - for i in low(list)..high(list): - if list[i] < pivot: - left.add(list[i]) - elif list[i] > pivot: - right.add(list[i]) - result = QuickSort(left) & - pivot & - QuickSort(right) - -proc echoSeq(a: seq[int]) = - for i in low(a)..high(a): - echo(a[i]) - -var - list: seq[int] - -list = QuickSort(@[89,23,15,23,56,123,356,12,7,1,6,2,9,4,3]) -echoSeq(list) - - diff --git a/tests/compile/tradix.nim b/tests/compile/tradix.nim deleted file mode 100644 index e5998ee12..000000000 --- a/tests/compile/tradix.nim +++ /dev/null @@ -1,319 +0,0 @@ -# implements and tests an efficient radix tree - -## another method to store an efficient array of pointers: -## We use a radix tree with node compression. -## There are two node kinds: - -const bitsPerUnit = 8*sizeof(int) - -type - TRadixNodeKind = enum rnLinear, rnFull, rnLeafBits, rnLeafLinear - PRadixNode = ptr TRadixNode - TRadixNode {.pure, inheritable.} = object - kind: TRadixNodeKind - TRadixNodeLinear = object of TRadixNode - len: int8 - keys: array [0..31, int8] - vals: array [0..31, PRadixNode] - - TRadixNodeFull = object of TRadixNode - b: array [0..255, PRadixNode] - TRadixNodeLeafBits = object of TRadixNode - b: array [0..7, int] - TRadixNodeLeafLinear = object of TRadixNode - len: int8 - keys: array [0..31, int8] - -var - root: PRadixNode - -proc searchInner(r: PRadixNode, a: int): PRadixNode = - case r.kind - of rnLinear: - var x = cast[ptr TRadixNodeLinear](r) - for i in 0..ze(x.len)-1: - if ze(x.keys[i]) == a: return x.vals[i] - of rnFull: - var x = cast[ptr TRadixNodeFull](r) - return x.b[a] - else: assert(false) - -proc testBit(w, i: int): bool {.inline.} = - result = (w and (1 shl (i %% BitsPerUnit))) != 0 - -proc setBit(w: var int, i: int) {.inline.} = - w = w or (1 shl (i %% bitsPerUnit)) - -proc resetBit(w: var int, i: int) {.inline.} = - w = w and not (1 shl (i %% bitsPerUnit)) - -proc testOrSetBit(w: var int, i: int): bool {.inline.} = - var x = (1 shl (i %% bitsPerUnit)) - if (w and x) != 0: return true - w = w or x - -proc searchLeaf(r: PRadixNode, a: int): bool = - case r.kind - of rnLeafBits: - var x = cast[ptr TRadixNodeLeafBits](r) - return testBit(x.b[a /% BitsPerUnit], a) - of rnLeafLinear: - var x = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..ze(x.len)-1: - if ze(x.keys[i]) == a: return true - else: assert(false) - -proc exclLeaf(r: PRadixNode, a: int) = - case r.kind - of rnLeafBits: - var x = cast[ptr TRadixNodeLeafBits](r) - resetBit(x.b[a /% BitsPerUnit], a) - of rnLeafLinear: - var x = cast[ptr TRadixNodeLeafLinear](r) - var L = ze(x.len) - for i in 0..L-1: - if ze(x.keys[i]) == a: - x.keys[i] = x.keys[L-1] - dec(x.len) - return - else: assert(false) - -proc contains*(r: PRadixNode, a: TAddress): bool = - if r == nil: return false - var x = searchInner(r, a shr 24 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 16 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 8 and 0xff) - if x == nil: return false - return searchLeaf(x, a and 0xff) - -proc excl*(r: PRadixNode, a: TAddress): bool = - if r == nil: return false - var x = searchInner(r, a shr 24 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 16 and 0xff) - if x == nil: return false - x = searchInner(x, a shr 8 and 0xff) - if x == nil: return false - exclLeaf(x, a and 0xff) - -proc addLeaf(r: var PRadixNode, a: int): bool = - if r == nil: - # a linear node: - var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear))) - x.kind = rnLeafLinear - x.len = 1'i8 - x.keys[0] = toU8(a) - r = x - return false # not already in set - case r.kind - of rnLeafBits: - var x = cast[ptr TRadixNodeLeafBits](r) - return testOrSetBit(x.b[a /% BitsPerUnit], a) - of rnLeafLinear: - var x = cast[ptr TRadixNodeLeafLinear](r) - var L = ze(x.len) - for i in 0..L-1: - if ze(x.keys[i]) == a: return true - if L <= high(x.keys): - x.keys[L] = toU8(a) - inc(x.len) - else: - # transform into a full node: - var y = cast[ptr TRadixNodeLeafBits](alloc0(sizeof(TRadixNodeLeafBits))) - y.kind = rnLeafBits - for i in 0..ze(x.len)-1: - var u = ze(x.keys[i]) - setBit(y.b[u /% BitsPerUnit], u) - setBit(y.b[a /% BitsPerUnit], a) - dealloc(r) - r = y - else: assert(false) - -proc addInner(r: var PRadixNode, a: int, d: int): bool = - if d == 0: - return addLeaf(r, a and 0xff) - var k = a shr d and 0xff - if r == nil: - # a linear node: - var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear))) - x.kind = rnLinear - x.len = 1'i8 - x.keys[0] = toU8(k) - r = x - return addInner(x.vals[0], a, d-8) - case r.kind - of rnLinear: - var x = cast[ptr TRadixNodeLinear](r) - var L = ze(x.len) - for i in 0..L-1: - if ze(x.keys[i]) == k: # already exists - return addInner(x.vals[i], a, d-8) - if L <= high(x.keys): - x.keys[L] = toU8(k) - inc(x.len) - return addInner(x.vals[L], a, d-8) - else: - # transform into a full node: - var y = cast[ptr TRadixNodeFull](alloc0(sizeof(TRadixNodeFull))) - y.kind = rnFull - for i in 0..L-1: y.b[ze(x.keys[i])] = x.vals[i] - dealloc(r) - r = y - return addInner(y.b[k], a, d-8) - of rnFull: - var x = cast[ptr TRadixNodeFull](r) - return addInner(x.b[k], a, d-8) - else: assert(false) - -proc incl*(r: var PRadixNode, a: TAddress) {.inline.} = - discard addInner(r, a, 24) - -proc testOrIncl*(r: var PRadixNode, a: TAddress): bool {.inline.} = - return addInner(r, a, 24) - -iterator innerElements(r: PRadixNode): tuple[prefix: int, n: PRadixNode] = - if r != nil: - case r.kind - of rnFull: - var r = cast[ptr TRadixNodeFull](r) - for i in 0..high(r.b): - if r.b[i] != nil: - yield (i, r.b[i]) - of rnLinear: - var r = cast[ptr TRadixNodeLinear](r) - for i in 0..ze(r.len)-1: - yield (ze(r.keys[i]), r.vals[i]) - else: assert(false) - -iterator leafElements(r: PRadixNode): int = - if r != nil: - case r.kind - of rnLeafBits: - var r = cast[ptr TRadixNodeLeafBits](r) - # iterate over any bit: - for i in 0..high(r.b): - if r.b[i] != 0: # test all bits for zero - for j in 0..BitsPerUnit-1: - if testBit(r.b[i], j): - yield i*BitsPerUnit+j - of rnLeafLinear: - var r = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..ze(r.len)-1: - yield ze(r.keys[i]) - else: assert(false) - -iterator elements*(r: PRadixNode): TAddress {.inline.} = - for p1, n1 in innerElements(r): - for p2, n2 in innerElements(n1): - for p3, n3 in innerElements(n2): - for p4 in leafElements(n3): - yield p1 shl 24 or p2 shl 16 or p3 shl 8 or p4 - -proc main() = - const - numbers = [128, 1, 2, 3, 4, 255, 17, -8, 45, 19_000] - var - r: PRadixNode = nil - for x in items(numbers): - echo testOrIncl(r, x) - for x in elements(r): echo(x) - -main() - - -when false: - proc traverse(r: PRadixNode, prefix: int, d: int) = - if r == nil: return - case r.kind - of rnLeafBits: - assert(d == 0) - var x = cast[ptr TRadixNodeLeafBits](r) - # iterate over any bit: - for i in 0..high(x.b): - if x.b[i] != 0: # test all bits for zero - for j in 0..BitsPerUnit-1: - if testBit(x.b[i], j): - visit(prefix or i*BitsPerUnit+j) - of rnLeafLinear: - assert(d == 0) - var x = cast[ptr TRadixNodeLeafLinear](r) - for i in 0..ze(x.len)-1: - visit(prefix or ze(x.keys[i])) - of rnFull: - var x = cast[ptr TRadixNodeFull](r) - for i in 0..high(r.b): - if r.b[i] != nil: - traverse(r.b[i], prefix or (i shl d), d-8) - of rnLinear: - var x = cast[ptr TRadixNodeLinear](r) - for i in 0..ze(x.len)-1: - traverse(x.vals[i], prefix or (ze(x.keys[i]) shl d), d-8) - - type - TRadixIter {.final.} = object - r: PRadixNode - p: int - x: int - - proc init(i: var TRadixIter, r: PRadixNode) = - i.r = r - i.x = 0 - i.p = 0 - - proc nextr(i: var TRadixIter): PRadixNode = - if i.r == nil: return nil - case i.r.kind - of rnFull: - var r = cast[ptr TRadixNodeFull](i.r) - while i.x <= high(r.b): - if r.b[i.x] != nil: - i.p = i.x - return r.b[i.x] - inc(i.x) - of rnLinear: - var r = cast[ptr TRadixNodeLinear](i.r) - if i.x < ze(r.len): - i.p = ze(r.keys[i.x]) - result = r.vals[i.x] - inc(i.x) - else: assert(false) - - proc nexti(i: var TRadixIter): int = - result = -1 - case i.r.kind - of rnLeafBits: - var r = cast[ptr TRadixNodeLeafBits](i.r) - # iterate over any bit: - for i in 0..high(r.b): - if x.b[i] != 0: # test all bits for zero - for j in 0..BitsPerUnit-1: - if testBit(x.b[i], j): - visit(prefix or i*BitsPerUnit+j) - of rnLeafLinear: - var r = cast[ptr TRadixNodeLeafLinear](i.r) - if i.x < ze(r.len): - result = ze(r.keys[i.x]) - inc(i.x) - - iterator elements(r: PRadixNode): TAddress {.inline.} = - var - a, b, c, d: TRadixIter - init(a, r) - while true: - var x = nextr(a) - if x != nil: - init(b, x) - while true: - var y = nextr(b) - if y != nil: - init(c, y) - while true: - var z = nextr(c) - if z != nil: - init(d, z) - while true: - var q = nexti(d) - if q != -1: - yield a.p shl 24 or b.p shl 16 or c.p shl 8 or q diff --git a/tests/compile/treadln.nim b/tests/compile/treadln.nim deleted file mode 100644 index 1117ab5f9..000000000 --- a/tests/compile/treadln.nim +++ /dev/null @@ -1,12 +0,0 @@ -# test the improved readline handling that does not care whether its -# Macintosh, Unix or Windows text format. - -var - inp: TFile - line: string - -if open(inp, "readme.txt"): - while not EndOfFile(inp): - line = readLine(inp) - echo("#" & line & "#") - close(inp) diff --git a/tests/compile/treadx.nim b/tests/compile/treadx.nim deleted file mode 100644 index 49b6ad691..000000000 --- a/tests/compile/treadx.nim +++ /dev/null @@ -1,14 +0,0 @@ - -when not defined(windows): - import posix - - var inp = "" - var buf: array[0..10, char] - while true: - var r = read(0, addr(buf), sizeof(buf)-1) - add inp, $buf - if r != sizeof(buf)-1: break - - echo inp - #dafkladskölklödsaf ölksdakölfölksfklwe4iojr389wr 89uweokf sdlkf jweklr jweflksdj fioewjfsdlfsd - diff --git a/tests/compile/tshadow_magic_type.nim b/tests/compile/tshadow_magic_type.nim deleted file mode 100644 index 5cd27435e..000000000 --- a/tests/compile/tshadow_magic_type.nim +++ /dev/null @@ -1,24 +0,0 @@ -type - TListItemType* = enum - RedisNil, RedisString - - TListItem* = object - case kind*: TListItemType - of RedisString: - str*: string - else: nil - TRedisList* = seq[TListItem] - -# Caused by this. -proc seq*() = - nil - -proc lrange*(key: string): TRedisList = - var foo: TListItem - foo.kind = RedisNil - result = @[foo] - -when isMainModule: - var p = lrange("mylist") - for i in items(p): - echo(i.str) diff --git a/tests/compile/tsizeof.nim b/tests/compile/tsizeof.nim deleted file mode 100644 index f7b70dd4d..000000000 --- a/tests/compile/tsizeof.nim +++ /dev/null @@ -1,10 +0,0 @@ -# Test the sizeof proc - -type - TMyRecord {.final.} = object - x, y: int - b: bool - r: float - s: string - -write(stdout, sizeof(TMyRecord)) diff --git a/tests/compile/tstrace.nim b/tests/compile/tstrace.nim deleted file mode 100644 index 3032a34a3..000000000 --- a/tests/compile/tstrace.nim +++ /dev/null @@ -1,16 +0,0 @@ -# Test the new stacktraces (great for debugging!) - -{.push stack_trace: on.} - -proc recTest(i: int) = - # enter - if i < 10: - recTest(i+1) - else: # should printStackTrace() - var p: ptr int = nil - p[] = 12 - # leave - -{.pop.} - -recTest(0) diff --git a/tests/compile/tstrdesc.nim b/tests/compile/tstrdesc.nim deleted file mode 100644 index 1c2e85b4b..000000000 --- a/tests/compile/tstrdesc.nim +++ /dev/null @@ -1,14 +0,0 @@ -var - x: array [0..2, int] - -x = [0, 1, 2] - -type - TStringDesc {.final.} = object - len, space: int # len and space without counting the terminating zero - data: array [0..0, char] # for the '\0' character - -var - emptyString {.exportc: "emptyString".}: TStringDesc - - diff --git a/tests/compile/tstrdist.nim b/tests/compile/tstrdist.nim deleted file mode 100644 index 3e1939e73..000000000 --- a/tests/compile/tstrdist.nim +++ /dev/null @@ -1,26 +0,0 @@ -# compute the edit distance between two strings - -proc editDistance(a, b: string): int = - var - c: seq[int] - n = a.len - m = b.len - newSeq(c, (n+1)*(m+1)) - for i in 0..n: - c[i*n] = i # [i,0] - for j in 0..m: - c[j] = j # [0,j] - - for i in 1..n: - for j in 1..m: - var x = c[(i-1)*n + j]+1 - var y = c[i*n + j-1]+1 - var z: int - if a[i-1] == b[j-1]: - z = c[(i-1)*n + j-1] - else: - z = c[(i-1)*n + j-1]+1 - c[(i-1)*n + (j-1)] = min(x,min(y,z)) - return c[n*m] - -write(stdout, editDistance("abc", "abd")) diff --git a/tests/compile/tvarious.nim b/tests/compile/tvarious.nim deleted file mode 100644 index 5883ba62f..000000000 --- a/tests/compile/tvarious.nim +++ /dev/null @@ -1,63 +0,0 @@ -# Test various aspects - -# bug #572 -var a=12345678901'u64 - -var x = (x: 42, y: (a: 8, z: 10)) -echo x.y - -import - mvarious - -type - PA = ref TA - PB = ref TB - - TB = object - a: PA - - TA = object - b: TB - x: int - -proc getPA(): PA = - var - b: bool - b = not false - return nil - -# bug #501 -proc f(): int = 54 - -var - global: int - -var - s: string - i: int - r: TA - -r.b.a.x = 0 -global = global + 1 -exportme() -write(stdout, "Hallo wie heißt du? ") -write(stdout, getPA().x) -s = readLine(stdin) -i = 0 -while i < s.len: - if s[i] == 'c': write(stdout, "'c' in deinem Namen gefunden\n") - i = i + 1 - -write(stdout, "Du heißt " & s) - -# bug #544 - -type Bar [T; I:range] = array[I, T] -proc foo*[T; I:range](a, b: Bar[T, I]): Bar[T, I] = - when len(a) != 3: - # Error: constant expression expected - {.fatal:"Dimensions have to be 3".} - #... -block: - var a, b: Bar[int, 0..2] - discard foo(a, b) diff --git a/tests/compile/tcompiles.nim b/tests/compiles/tcompiles.nim index d0fccdaff..d0fccdaff 100644 --- a/tests/compile/tcompiles.nim +++ b/tests/compiles/tcompiles.nim diff --git a/tests/run/tconcat.nim b/tests/concat/tconcat.nim index fdce3ea00..fdce3ea00 100644 --- a/tests/run/tconcat.nim +++ b/tests/concat/tconcat.nim diff --git a/tests/run/tnodeadlocks.nim b/tests/concurrency/tnodeadlocks.nim index 18fdca3e9..18fdca3e9 100644 --- a/tests/run/tnodeadlocks.nim +++ b/tests/concurrency/tnodeadlocks.nim diff --git a/tests/reject/tconstr1.nim b/tests/constr/tconstr1.nim index cb6594213..cb6594213 100644 --- a/tests/reject/tconstr1.nim +++ b/tests/constr/tconstr1.nim diff --git a/tests/run/tconstr2.nim b/tests/constr/tconstr2.nim index 30cec5cb8..30cec5cb8 100644 --- a/tests/run/tconstr2.nim +++ b/tests/constr/tconstr2.nim diff --git a/tests/reject/tconstraints.nim b/tests/constraints/tconstraints.nim index e61095fff..e61095fff 100644 --- a/tests/reject/tconstraints.nim +++ b/tests/constraints/tconstraints.nim diff --git a/tests/reject/tblock1.nim b/tests/controlflow/tblock1.nim index 5c41aaf82..5c41aaf82 100644 --- a/tests/reject/tblock1.nim +++ b/tests/controlflow/tblock1.nim diff --git a/tests/run/tcontinue.nim b/tests/controlflow/tcontinue.nim index 092026e8c..092026e8c 100644 --- a/tests/run/tcontinue.nim +++ b/tests/controlflow/tcontinue.nim diff --git a/tests/run/tnestif.nim b/tests/controlflow/tnestif.nim index bfcd8751c..bfcd8751c 100644 --- a/tests/run/tnestif.nim +++ b/tests/controlflow/tnestif.nim diff --git a/tests/reject/tstatret.nim b/tests/controlflow/tstatret.nim index bf90255a0..bf90255a0 100644 --- a/tests/reject/tstatret.nim +++ b/tests/controlflow/tstatret.nim diff --git a/tests/compile/tconvcolors.nim b/tests/converter/tconvcolors.nim index 07e829550..07e829550 100644 --- a/tests/compile/tconvcolors.nim +++ b/tests/converter/tconvcolors.nim diff --git a/tests/compile/tconvert.nim b/tests/converter/tconvert.nim index a8ddcf119..a8ddcf119 100644 --- a/tests/compile/tconvert.nim +++ b/tests/converter/tconvert.nim diff --git a/tests/run/tgenericconverter.nim b/tests/converter/tgenericconverter.nim index e1c9f7c4c..e1c9f7c4c 100644 --- a/tests/run/tgenericconverter.nim +++ b/tests/converter/tgenericconverter.nim diff --git a/tests/compile/ttypeconverter1.nim b/tests/converter/ttypeconverter1.nim index b9a5e88ae..b9a5e88ae 100644 --- a/tests/compile/ttypeconverter1.nim +++ b/tests/converter/ttypeconverter1.nim diff --git a/tests/compile/mdefaultprocparam.nim b/tests/defaultprocparam/mdefaultprocparam.nim index 4a17277c0..4a17277c0 100644 --- a/tests/compile/mdefaultprocparam.nim +++ b/tests/defaultprocparam/mdefaultprocparam.nim diff --git a/tests/compile/tdefaultprocparam.nim b/tests/defaultprocparam/tdefaultprocparam.nim index 23ecf72e9..23ecf72e9 100644 --- a/tests/compile/tdefaultprocparam.nim +++ b/tests/defaultprocparam/tdefaultprocparam.nim diff --git a/tests/reject/tdeprecated.nim b/tests/deprecated/tdeprecated.nim index f41f0a72f..f41f0a72f 100644 --- a/tests/reject/tdeprecated.nim +++ b/tests/deprecated/tdeprecated.nim diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim new file mode 100644 index 000000000..bb1410d92 --- /dev/null +++ b/tests/destructor/tdestructor.nim @@ -0,0 +1,84 @@ +discard """ + output: '''---- +myobj constructed +myobj destroyed +---- +mygeneric1 constructed +mygeneric1 destroyed +---- +mygeneric2 constructed +mygeneric2 destroyed +myobj destroyed +---- +mygeneric3 constructed +mygeneric1 destroyed +''' +""" + +type + TMyObj = object + x, y: int + p: pointer + + TMyGeneric1[T] = object + x: T + + TMyGeneric2[A, B] = object + x: A + y: B + + TMyGeneric3[A, B, C] = object + x: A + y: B + z: C + +proc destruct(o: var TMyObj) {.destructor.} = + if o.p != nil: dealloc o.p + echo "myobj destroyed" + +proc destroy(o: var TMyGeneric1) {.destructor.} = + echo "mygeneric1 destroyed" + +proc destroy[A, B](o: var TMyGeneric2[A, B]) {.destructor.} = + echo "mygeneric2 destroyed" + +proc open: TMyObj = + # allow for superfluous () + result = (TMyObj(x: 1, y: 2, p: alloc(3))) + +proc `$`(x: TMyObj): string = $x.y + +proc myobj() = + var x = open() + echo "myobj constructed" + +proc mygeneric1() = + var x = TMyGeneric1[int](x: 10) + echo "mygeneric1 constructed" + +proc mygeneric2[T](val: T) = + var + a = open() + b = TMyGeneric2[int, T](x: 10, y: val) + c = TMyGeneric3[int, int, string](x: 10, y: 20, z: "test") + + echo "mygeneric2 constructed" + +proc mygeneric3 = + var x = TMyGeneric3[int, string, TMyGeneric1[int]]( + x: 10, y: "test", z: TMyGeneric1[int](x: 10)) + + echo "mygeneric3 constructed" + +echo "----" +myobj() + +echo "----" +mygeneric1() + +echo "----" +mygeneric2[int](10) + +echo "----" +mygeneric3() + diff --git a/tests/reject/tdestructor.nim b/tests/destructor/tdestructor2.nim index da9192a3f..da9192a3f 100644 --- a/tests/reject/tdestructor.nim +++ b/tests/destructor/tdestructor2.nim diff --git a/tests/compile/tdictdestruct.nim b/tests/destructor/tdictdestruct.nim index ec1084105..ec1084105 100644 --- a/tests/compile/tdictdestruct.nim +++ b/tests/destructor/tdictdestruct.nim diff --git a/tests/compile/tdiscardable.nim b/tests/discard/tdiscardable.nim index c0551ba2f..c0551ba2f 100644 --- a/tests/compile/tdiscardable.nim +++ b/tests/discard/tdiscardable.nim diff --git a/tests/reject/tneedsdiscard.nim b/tests/discard/tneedsdiscard.nim index 24f5b2eee..24f5b2eee 100644 --- a/tests/reject/tneedsdiscard.nim +++ b/tests/discard/tneedsdiscard.nim diff --git a/tests/run/tcurrncy.nim b/tests/distinct/tcurrncy.nim index 78dbc2a89..78dbc2a89 100644 --- a/tests/run/tcurrncy.nim +++ b/tests/distinct/tcurrncy.nim diff --git a/tests/reject/teffects1.nim b/tests/effects/teffects1.nim index 1c6c4bed8..b72e8b00c 100644 --- a/tests/reject/teffects1.nim +++ b/tests/effects/teffects1.nim @@ -1,5 +1,5 @@ discard """ - line: 1804 + line: 1855 file: "system.nim" errormsg: "can raise an unlisted exception: ref EIO" """ diff --git a/tests/reject/teffects2.nim b/tests/effects/teffects2.nim index 7e6b17c36..7e6b17c36 100644 --- a/tests/reject/teffects2.nim +++ b/tests/effects/teffects2.nim diff --git a/tests/reject/teffects3.nim b/tests/effects/teffects3.nim index 78543a929..78543a929 100644 --- a/tests/reject/teffects3.nim +++ b/tests/effects/teffects3.nim diff --git a/tests/reject/teffects4.nim b/tests/effects/teffects4.nim index 4584e6dc8..4584e6dc8 100644 --- a/tests/reject/teffects4.nim +++ b/tests/effects/teffects4.nim diff --git a/tests/reject/teffects5.nim b/tests/effects/teffects5.nim index d630a6fc4..d630a6fc4 100644 --- a/tests/reject/teffects5.nim +++ b/tests/effects/teffects5.nim diff --git a/tests/compile/teffects1.nim b/tests/effects/teffects6.nim index 54200f2c3..54200f2c3 100644 --- a/tests/compile/teffects1.nim +++ b/tests/effects/teffects6.nim diff --git a/tests/reject/tsidee1.nim b/tests/effects/tsidee1.nim index bd5b32dd7..bd5b32dd7 100644 --- a/tests/reject/tsidee1.nim +++ b/tests/effects/tsidee1.nim diff --git a/tests/run/tsidee2.nim b/tests/effects/tsidee2.nim index e73c89608..e73c89608 100644 --- a/tests/run/tsidee2.nim +++ b/tests/effects/tsidee2.nim diff --git a/tests/run/tsidee3.nim b/tests/effects/tsidee3.nim index e0c427ab6..e0c427ab6 100644 --- a/tests/run/tsidee3.nim +++ b/tests/effects/tsidee3.nim diff --git a/tests/reject/tsidee4.nim b/tests/effects/tsidee4.nim index cbebfbd36..cbebfbd36 100644 --- a/tests/reject/tsidee4.nim +++ b/tests/effects/tsidee4.nim diff --git a/tests/compile/tenum.nim b/tests/enum/tenum.nim index 6e53b9c08..6e53b9c08 100644 --- a/tests/compile/tenum.nim +++ b/tests/enum/tenum.nim diff --git a/tests/compile/tenum2.nim b/tests/enum/tenum2.nim index feba36dd6..feba36dd6 100644 --- a/tests/compile/tenum2.nim +++ b/tests/enum/tenum2.nim diff --git a/tests/compile/tenum3.nim b/tests/enum/tenum3.nim index 09a516932..09a516932 100644 --- a/tests/compile/tenum3.nim +++ b/tests/enum/tenum3.nim diff --git a/tests/run/tenumhole.nim b/tests/enum/tenumhole.nim index a35526378..a35526378 100644 --- a/tests/run/tenumhole.nim +++ b/tests/enum/tenumhole.nim diff --git a/tests/reject/tenumitems.nim b/tests/enum/tenumitems.nim index b6eee5ba8..b6eee5ba8 100644 --- a/tests/reject/tenumitems.nim +++ b/tests/enum/tenumitems.nim diff --git a/tests/run/tenumitems.nim b/tests/enum/tenumitems2.nim index db4c6b554..db4c6b554 100644 --- a/tests/run/tenumitems.nim +++ b/tests/enum/tenumitems2.nim diff --git a/tests/reject/tenummix.nim b/tests/enum/tenummix.nim index f58e7989d..aaf0be2cb 100644 --- a/tests/reject/tenummix.nim +++ b/tests/enum/tenummix.nim @@ -1,6 +1,6 @@ discard """ - file: "system.nim" - line: 696 + file: "tenummix.nim" + line: 11 errormsg: "type mismatch" """ diff --git a/tests/run/tnamedenumfields.nim b/tests/enum/tnamedenumfields.nim index e9ac88a42..e9ac88a42 100644 --- a/tests/run/tnamedenumfields.nim +++ b/tests/enum/tnamedenumfields.nim diff --git a/tests/compile/toptions.nim b/tests/enum/toptions.nim index 95bb5cfbc..3c841de2c 100644 --- a/tests/compile/toptions.nim +++ b/tests/enum/toptions.nim @@ -1,7 +1,3 @@ -# Converted by Pas2mor v1.54 -# Used command line arguments: -# -m -q -o bootstrap\options.mor options.pas -# type # please make sure we have under 32 options (improves code efficiency!) diff --git a/tests/run/tcontinuexc.nim b/tests/exception/tcontinuexc.nim index f618abc14..f618abc14 100644 --- a/tests/run/tcontinuexc.nim +++ b/tests/exception/tcontinuexc.nim diff --git a/tests/run/texceptions.nim b/tests/exception/texceptions.nim index 69b2d0f6a..69b2d0f6a 100644 --- a/tests/run/texceptions.nim +++ b/tests/exception/texceptions.nim diff --git a/tests/run/texcpt1.nim b/tests/exception/texcpt1.nim index ec74c9470..ec74c9470 100644 --- a/tests/run/texcpt1.nim +++ b/tests/exception/texcpt1.nim diff --git a/tests/run/texcsub.nim b/tests/exception/texcsub.nim index 3dba357f9..3dba357f9 100644 --- a/tests/run/texcsub.nim +++ b/tests/exception/texcsub.nim diff --git a/tests/run/tfinally.nim b/tests/exception/tfinally.nim index 16fb3e7da..16fb3e7da 100644 --- a/tests/run/tfinally.nim +++ b/tests/exception/tfinally.nim diff --git a/tests/run/tfinally2.nim b/tests/exception/tfinally2.nim index e1e8d4c7e..e1e8d4c7e 100644 --- a/tests/run/tfinally2.nim +++ b/tests/exception/tfinally2.nim diff --git a/tests/run/tfinally3.nim b/tests/exception/tfinally3.nim index e65661cd0..e65661cd0 100644 --- a/tests/run/tfinally3.nim +++ b/tests/exception/tfinally3.nim diff --git a/tests/run/tonraise.nim b/tests/exception/tonraise.nim index 1a555dd94..1a555dd94 100644 --- a/tests/run/tonraise.nim +++ b/tests/exception/tonraise.nim diff --git a/tests/run/treraise.nim b/tests/exception/treraise.nim index cbd0b5f8a..cbd0b5f8a 100644 --- a/tests/run/treraise.nim +++ b/tests/exception/treraise.nim diff --git a/tests/run/tunhandledexc.nim b/tests/exception/tunhandledexc.nim index f24881aef..f24881aef 100644 --- a/tests/run/tunhandledexc.nim +++ b/tests/exception/tunhandledexc.nim diff --git a/tests/run/twrongexc.nim b/tests/exception/twrongexc.nim index 755f7d979..755f7d979 100644 --- a/tests/run/twrongexc.nim +++ b/tests/exception/twrongexc.nim diff --git a/tests/reject/texprstmt.nim b/tests/exprs/texprstmt.nim index b32394d8d..b32394d8d 100644 --- a/tests/reject/texprstmt.nim +++ b/tests/exprs/texprstmt.nim diff --git a/tests/reject/tstmtexp.nim b/tests/exprs/tstmtexp.nim index 7cbf2eb3d..7cbf2eb3d 100644 --- a/tests/reject/tstmtexp.nim +++ b/tests/exprs/tstmtexp.nim diff --git a/tests/run/tstmtexprs.nim b/tests/exprs/tstmtexprs.nim index 497a2f6d0..816e58cb1 100644 --- a/tests/run/tstmtexprs.nim +++ b/tests/exprs/tstmtexprs.nim @@ -1,5 +1,6 @@ discard """ - output: '''(bar: bar) + output: '''24 +(bar: bar) 1244 6 abcdefghijklmnopqrstuvwxyz @@ -8,6 +9,10 @@ abcdefghijklmnopqrstuvwxyz import strutils +const fac4 = (var x = 1; for i in 1..4: x *= i; x) + +echo fac4 + when true: proc test(foo: proc (x, y: int): bool) = echo foo(5, 5) @@ -69,3 +74,15 @@ proc semiProblem() = if false: echo "aye"; echo "indeed" semiProblem() + + +# bug #844 + +import json +proc parseResponse(): PJsonNode = + result = % { "key1": % { "key2": % "value" } } + for key, val in result["key1"]: + var excMsg = key & "(" + if (var n=result["key2"]; n != nil): + excMsg &= n.str + raise newException(ESynch, excMsg) diff --git a/tests/run/tfieldindex.nim b/tests/fields/tfieldindex.nim index f0674af54..f0674af54 100644 --- a/tests/run/tfieldindex.nim +++ b/tests/fields/tfieldindex.nim diff --git a/tests/run/tfielditerator.nim b/tests/fields/tfielditerator.nim index 2919aab41..2919aab41 100644 --- a/tests/run/tfielditerator.nim +++ b/tests/fields/tfielditerator.nim diff --git a/tests/run/tfielditerator2.nim b/tests/fields/tfielditerator2.nim index 76fa568f2..76fa568f2 100644 --- a/tests/run/tfielditerator2.nim +++ b/tests/fields/tfielditerator2.nim diff --git a/tests/run/tfloat1.nim b/tests/float/tfloat1.nim index f290fdb57..f290fdb57 100644 --- a/tests/run/tfloat1.nim +++ b/tests/float/tfloat1.nim diff --git a/tests/run/tfloat2.nim b/tests/float/tfloat2.nim index 51883674f..51883674f 100644 --- a/tests/run/tfloat2.nim +++ b/tests/float/tfloat2.nim diff --git a/tests/run/tfloat3.nim b/tests/float/tfloat3.nim index 4382dd3ed..4382dd3ed 100644 --- a/tests/run/tfloat3.nim +++ b/tests/float/tfloat3.nim diff --git a/tests/run/mfriends.nim b/tests/friends/mfriends.nim index f1c663655..f1c663655 100644 --- a/tests/run/mfriends.nim +++ b/tests/friends/mfriends.nim diff --git a/tests/run/tfriends.nim b/tests/friends/tfriends.nim index 1e70d50a5..1e70d50a5 100644 --- a/tests/run/tfriends.nim +++ b/tests/friends/tfriends.nim diff --git a/tests/gc/gcleak4.nim b/tests/gc/gcleak4.nim index bd7bded28..6f2b8a1fe 100644 --- a/tests/gc/gcleak4.nim +++ b/tests/gc/gcleak4.nim @@ -6,7 +6,7 @@ when defined(GC_setMaxPause): GC_setMaxPause 2_000 type - TExpr = object ## abstract base class for an expression + TExpr = object {.inheritable.} ## abstract base class for an expression PLiteral = ref TLiteral TLiteral = object of TExpr x: int diff --git a/tests/gc/gcleak5.nim b/tests/gc/gcleak5.nim new file mode 100644 index 000000000..9e2948729 --- /dev/null +++ b/tests/gc/gcleak5.nim @@ -0,0 +1,25 @@ +discard """ + output: "success" +""" + +import os, times + +proc main = + var i = 0 + for ii in 0..50_000: + #while true: + var t = getTime() + var g = t.getGMTime() + #echo isOnStack(addr g) + + if i mod 100 == 0: + let om = getOccupiedMem() + #echo "memory: ", om + if om > 100_000: quit "leak" + + inc(i) + sleep(1) + + echo "success" + +main() diff --git a/tests/run/tbintre2.nim b/tests/generics/tbintre2.nim index 2a7225411..2a7225411 100644 --- a/tests/run/tbintre2.nim +++ b/tests/generics/tbintre2.nim diff --git a/tests/run/tbintree.nim b/tests/generics/tbintree.nim index 8cc8acb82..8cc8acb82 100644 --- a/tests/run/tbintree.nim +++ b/tests/generics/tbintree.nim diff --git a/tests/compile/tcan_alias_generic.nim b/tests/generics/tcan_alias_generic.nim index e90bdc6d2..e90bdc6d2 100644 --- a/tests/compile/tcan_alias_generic.nim +++ b/tests/generics/tcan_alias_generic.nim diff --git a/tests/compile/tcan_alias_specialised_generic.nim b/tests/generics/tcan_alias_specialised_generic.nim index 8d4a29abd..8d4a29abd 100644 --- a/tests/compile/tcan_alias_specialised_generic.nim +++ b/tests/generics/tcan_alias_specialised_generic.nim diff --git a/tests/compile/tcan_inherit_generic.nim b/tests/generics/tcan_inherit_generic.nim index a6f4d946b..a6f4d946b 100644 --- a/tests/compile/tcan_inherit_generic.nim +++ b/tests/generics/tcan_inherit_generic.nim diff --git a/tests/compile/tcan_specialise_generic.nim b/tests/generics/tcan_specialise_generic.nim index 64d5f56e3..64d5f56e3 100644 --- a/tests/compile/tcan_specialise_generic.nim +++ b/tests/generics/tcan_specialise_generic.nim diff --git a/tests/run/texplicitgeneric1.nim b/tests/generics/texplicitgeneric1.nim index 6cca71ac0..6cca71ac0 100644 --- a/tests/run/texplicitgeneric1.nim +++ b/tests/generics/texplicitgeneric1.nim diff --git a/tests/run/texplicitgeneric2.nim b/tests/generics/texplicitgeneric2.nim index 95461d023..95461d023 100644 --- a/tests/run/texplicitgeneric2.nim +++ b/tests/generics/texplicitgeneric2.nim diff --git a/tests/compile/tforwardgeneric.nim b/tests/generics/tforwardgeneric.nim index c5943b966..c5943b966 100644 --- a/tests/compile/tforwardgeneric.nim +++ b/tests/generics/tforwardgeneric.nim diff --git a/tests/compile/tgeneric.nim b/tests/generics/tgeneric0.nim index 8bda15c42..9292b729f 100644 --- a/tests/compile/tgeneric.nim +++ b/tests/generics/tgeneric0.nim @@ -8,4 +8,12 @@ proc foo(models: seq[TTable[string, float]]): seq[float] = for model in models.items: result.add model["foobar"] +# bug #686 +type TType[T; A] = array[A, T] + +proc foo[T](p: TType[T, range[0..1]]) = + echo "foo" +proc foo[T](p: TType[T, range[0..2]]) = + echo "bar" + diff --git a/tests/run/tgenerics1.nim b/tests/generics/tgeneric1.nim index 5d20a864b..5d20a864b 100644 --- a/tests/run/tgenerics1.nim +++ b/tests/generics/tgeneric1.nim diff --git a/tests/compile/tgeneric2.nim b/tests/generics/tgeneric2.nim index 56803017a..56803017a 100644 --- a/tests/compile/tgeneric2.nim +++ b/tests/generics/tgeneric2.nim diff --git a/tests/compile/tgeneric3.nim b/tests/generics/tgeneric3.nim index 3c543ecfa..3c543ecfa 100644 --- a/tests/compile/tgeneric3.nim +++ b/tests/generics/tgeneric3.nim diff --git a/tests/compile/tgeneric4.nim b/tests/generics/tgeneric4.nim index f79096636..f79096636 100644 --- a/tests/compile/tgeneric4.nim +++ b/tests/generics/tgeneric4.nim diff --git a/tests/compile/tgenericdefaults.nim b/tests/generics/tgenericdefaults.nim index ad96f1851..ad96f1851 100644 --- a/tests/compile/tgenericdefaults.nim +++ b/tests/generics/tgenericdefaults.nim diff --git a/tests/compile/tgenericmatcher.nim b/tests/generics/tgenericmatcher.nim index edd0c4cf1..edd0c4cf1 100644 --- a/tests/compile/tgenericmatcher.nim +++ b/tests/generics/tgenericmatcher.nim diff --git a/tests/compile/tgenericmatcher2.nim b/tests/generics/tgenericmatcher2.nim index aa2f9dbb3..aa2f9dbb3 100644 --- a/tests/compile/tgenericmatcher2.nim +++ b/tests/generics/tgenericmatcher2.nim diff --git a/tests/run/tgenericprocvar.nim b/tests/generics/tgenericprocvar.nim index 1eba81fec..1eba81fec 100644 --- a/tests/run/tgenericprocvar.nim +++ b/tests/generics/tgenericprocvar.nim diff --git a/tests/compile/tgenericprop.nim b/tests/generics/tgenericprop.nim index 7cddf5617..7cddf5617 100644 --- a/tests/compile/tgenericprop.nim +++ b/tests/generics/tgenericprop.nim diff --git a/tests/compile/tgenericrefs.nim b/tests/generics/tgenericrefs.nim index ef931dfa7..ef931dfa7 100644 --- a/tests/compile/tgenericrefs.nim +++ b/tests/generics/tgenericrefs.nim diff --git a/tests/generics/tgenericshardcases.nim b/tests/generics/tgenericshardcases.nim new file mode 100644 index 000000000..2ef63bc20 --- /dev/null +++ b/tests/generics/tgenericshardcases.nim @@ -0,0 +1,36 @@ +discard """ + file: "tgenericshardcases.nim" + output: "2\n5\n126\n3" +""" + +import typetraits + +proc typeNameLen(x: typedesc): int {.compileTime.} = + result = x.name.len + +macro selectType(a, b: typedesc): typedesc = + result = a + +type + Foo[T] = object + data1: array[T.high, int] + data2: array[typeNameLen(T), float] # data3: array[0..T.typeNameLen, selectType(float, int)] + + MyEnum = enum A, B, C, D + +var f1: Foo[MyEnum] +var f2: Foo[int8] + +echo high(f1.data1) # (D = 3) - 1 == 2 +echo high(f1.data2) # (MyEnum.len = 6) - 1 == 5 + +echo high(f2.data1) # 127 - 1 == 126 +echo high(f2.data2) # int8.len - 1 == 3 + +#static: +# assert high(f1.data1) == ord(D) +# assert high(f1.data2) == 6 # length of MyEnum + +# assert high(f2.data1) == 127 +# assert high(f2.data2) == 4 # length of int8 + diff --git a/tests/compile/tgenerictmpl.nim b/tests/generics/tgenerictmpl.nim index a749e6570..a749e6570 100644 --- a/tests/compile/tgenerictmpl.nim +++ b/tests/generics/tgenerictmpl.nim diff --git a/tests/compile/tgenericvariant.nim b/tests/generics/tgenericvariant.nim index 51d01355a..51d01355a 100644 --- a/tests/compile/tgenericvariant.nim +++ b/tests/generics/tgenericvariant.nim diff --git a/tests/compile/tspecialised_is_equivalent.nim b/tests/generics/tspecialised_is_equivalent.nim index 60b976e90..60b976e90 100644 --- a/tests/compile/tspecialised_is_equivalent.nim +++ b/tests/generics/tspecialised_is_equivalent.nim diff --git a/tests/compile/tthread_generic.nim b/tests/generics/tthread_generic.nim index beae4b652..beae4b652 100644 --- a/tests/compile/tthread_generic.nim +++ b/tests/generics/tthread_generic.nim diff --git a/tests/run/tvarargs_vs_generic.nim b/tests/generics/tvarargs_vs_generic.nim index 122f3e453..122f3e453 100644 --- a/tests/run/tvarargs_vs_generic.nim +++ b/tests/generics/tvarargs_vs_generic.nim diff --git a/tests/run/tgensym.nim b/tests/gensym/tgensym.nim index 3c85b0b83..3c85b0b83 100644 --- a/tests/run/tgensym.nim +++ b/tests/gensym/tgensym.nim diff --git a/tests/compile/tgensymgeneric.nim b/tests/gensym/tgensymgeneric.nim index 54390a4ef..54390a4ef 100644 --- a/tests/compile/tgensymgeneric.nim +++ b/tests/gensym/tgensymgeneric.nim diff --git a/tests/run/tglobal.nim b/tests/global/tglobal.nim index 84c4510c1..84c4510c1 100644 --- a/tests/run/tglobal.nim +++ b/tests/global/tglobal.nim diff --git a/tests/compile/tglobalforvar.nim b/tests/global/tglobalforvar.nim index af75df5c8..af75df5c8 100644 --- a/tests/compile/tglobalforvar.nim +++ b/tests/global/tglobalforvar.nim diff --git a/tests/compile/timplicititems.nim b/tests/implicit/timplicititems.nim index dbe321cb6..dbe321cb6 100644 --- a/tests/compile/timplicititems.nim +++ b/tests/implicit/timplicititems.nim diff --git a/tests/compile/timplictderef.nim b/tests/implicit/timplictderef.nim index 99b0b645b..99b0b645b 100644 --- a/tests/compile/timplictderef.nim +++ b/tests/implicit/timplictderef.nim diff --git a/tests/reject/tuninit1.nim b/tests/init/tuninit1.nim index 2a994b187..2a994b187 100644 --- a/tests/reject/tuninit1.nim +++ b/tests/init/tuninit1.nim diff --git a/tests/run/tzeroarray.nim b/tests/init/tzeroarray.nim index b784b601e..b784b601e 100644 --- a/tests/run/tzeroarray.nim +++ b/tests/init/tzeroarray.nim diff --git a/tests/iter/tanoniter1.nim b/tests/iter/tanoniter1.nim new file mode 100644 index 000000000..9db5ab8ec --- /dev/null +++ b/tests/iter/tanoniter1.nim @@ -0,0 +1,32 @@ +discard """ + output: '''1 +2 +3 +4 +1 +2''' +""" + +proc factory(a, b: int): iterator (): int = + iterator foo(): int = + var x = a + while x <= b: + yield x + inc x + return foo + +proc factory2(a, b: int): iterator (): int = + return iterator (): int = + var x = a + while x <= b: + yield x + inc x + +let foo = factory 1, 4 + +for f in foo(): + echo f + +let foo2 = factory2 1,2 + +for f in foo2(): echo f diff --git a/tests/run/tcountup.nim b/tests/iter/tcountup.nim index e68a614b0..e68a614b0 100644 --- a/tests/run/tcountup.nim +++ b/tests/iter/tcountup.nim diff --git a/tests/compile/titer.nim b/tests/iter/titer.nim index 19a11dc4e..19a11dc4e 100644 --- a/tests/compile/titer.nim +++ b/tests/iter/titer.nim diff --git a/tests/compile/titer2.nim b/tests/iter/titer2.nim index dab2713e8..f8967109e 100644 --- a/tests/compile/titer2.nim +++ b/tests/iter/titer2.nim @@ -1,6 +1,6 @@ discard """ output: '''true''' - cmd: "nimrod cc --gc:none --hints:on $# $#" + cmd: "nimrod cc --gc:none --hints:on --warnings:off $# $#" """ import hashes diff --git a/tests/run/titer3.nim b/tests/iter/titer3.nim index ab95dd7bd..ab95dd7bd 100644 --- a/tests/run/titer3.nim +++ b/tests/iter/titer3.nim diff --git a/tests/reject/titer4.nim b/tests/iter/titer4.nim index 9b52f8055..9b52f8055 100644 --- a/tests/reject/titer4.nim +++ b/tests/iter/titer4.nim diff --git a/tests/run/titer5.nim b/tests/iter/titer5.nim index bbd50fcb1..bbd50fcb1 100644 --- a/tests/run/titer5.nim +++ b/tests/iter/titer5.nim diff --git a/tests/run/titer6.nim b/tests/iter/titer6.nim index dceace0e0..dceace0e0 100644 --- a/tests/run/titer6.nim +++ b/tests/iter/titer6.nim diff --git a/tests/run/titer7.nim b/tests/iter/titer7.nim index d0337b7bd..d0337b7bd 100644 --- a/tests/run/titer7.nim +++ b/tests/iter/titer7.nim diff --git a/tests/run/titer8.nim b/tests/iter/titer8.nim index af0e643f1..af0e643f1 100644 --- a/tests/run/titer8.nim +++ b/tests/iter/titer8.nim diff --git a/tests/run/titer9.nim b/tests/iter/titer9.nim index 99874e70a..99874e70a 100644 --- a/tests/run/titer9.nim +++ b/tests/iter/titer9.nim diff --git a/tests/compile/titer_no_tuple_unpack.nim b/tests/iter/titer_no_tuple_unpack.nim index da5e1bc46..da5e1bc46 100644 --- a/tests/compile/titer_no_tuple_unpack.nim +++ b/tests/iter/titer_no_tuple_unpack.nim diff --git a/tests/compile/titerovl.nim b/tests/iter/titerovl.nim index be665b2b7..be665b2b7 100644 --- a/tests/compile/titerovl.nim +++ b/tests/iter/titerovl.nim diff --git a/tests/run/titerslice.nim b/tests/iter/titerslice.nim index e5d2e14a3..e5d2e14a3 100644 --- a/tests/run/titerslice.nim +++ b/tests/iter/titerslice.nim diff --git a/tests/run/titervaropenarray.nim b/tests/iter/titervaropenarray.nim index 1e70ce247..1e70ce247 100644 --- a/tests/run/titervaropenarray.nim +++ b/tests/iter/titervaropenarray.nim diff --git a/tests/run/tmoditer.nim b/tests/iter/tmoditer.nim index 1e6be37e4..1e6be37e4 100644 --- a/tests/run/tmoditer.nim +++ b/tests/iter/tmoditer.nim diff --git a/tests/reject/treciter.nim b/tests/iter/treciter.nim index dacdbdfd7..dacdbdfd7 100644 --- a/tests/reject/treciter.nim +++ b/tests/iter/treciter.nim diff --git a/tests/iter/twrongiter.nim b/tests/iter/twrongiter.nim new file mode 100644 index 000000000..33394219b --- /dev/null +++ b/tests/iter/twrongiter.nim @@ -0,0 +1,13 @@ +discard """ +line: 12 +errormsg: "type mismatch" +""" + +proc first(it: iterator(): int): seq[int] = + return @[] + +iterator primes(): int = + yield 1 + +for i in first(primes): + break diff --git a/tests/reject/tlet.nim b/tests/let/tlet.nim index 3d36432fb..3d36432fb 100644 --- a/tests/reject/tlet.nim +++ b/tests/let/tlet.nim diff --git a/tests/reject/tlet2.nim b/tests/let/tlet2.nim index 8b1ddf940..8b1ddf940 100644 --- a/tests/reject/tlet2.nim +++ b/tests/let/tlet2.nim diff --git a/tests/run/thexlit.nim b/tests/lexer/thexlit.nim index 04a530c9c..04a530c9c 100644 --- a/tests/run/thexlit.nim +++ b/tests/lexer/thexlit.nim diff --git a/tests/compile/thexrange.nim b/tests/lexer/thexrange.nim index e5e4c10c6..e5e4c10c6 100644 --- a/tests/compile/thexrange.nim +++ b/tests/lexer/thexrange.nim diff --git a/tests/compile/tident.nim b/tests/lexer/tident.nim index 1ed9894c6..1ed9894c6 100644 --- a/tests/compile/tident.nim +++ b/tests/lexer/tident.nim diff --git a/tests/reject/tind1.nim b/tests/lexer/tind1.nim index f3fd952cc..f3fd952cc 100644 --- a/tests/reject/tind1.nim +++ b/tests/lexer/tind1.nim diff --git a/tests/run/tindent1.nim b/tests/lexer/tindent1.nim index 78a303783..78a303783 100644 --- a/tests/run/tindent1.nim +++ b/tests/lexer/tindent1.nim diff --git a/tests/compile/tlexer.nim b/tests/lexer/tlexer.nim index 10a8ab51d..10a8ab51d 100644 --- a/tests/compile/tlexer.nim +++ b/tests/lexer/tlexer.nim diff --git a/tests/reject/tmissingnl.nim b/tests/lexer/tmissingnl.nim index 33b7debf1..33b7debf1 100644 --- a/tests/reject/tmissingnl.nim +++ b/tests/lexer/tmissingnl.nim diff --git a/tests/run/tstrlits.nim b/tests/lexer/tstrlits.nim index 1cd43975a..1cd43975a 100644 --- a/tests/run/tstrlits.nim +++ b/tests/lexer/tstrlits.nim diff --git a/tests/reject/tunderscores.nim b/tests/lexer/tunderscores.nim index 8075fdae4..8075fdae4 100644 --- a/tests/reject/tunderscores.nim +++ b/tests/lexer/tunderscores.nim diff --git a/tests/run/tkoeniglookup.nim b/tests/lookups/tkoeniglookup.nim index e6f5c0112..e6f5c0112 100644 --- a/tests/run/tkoeniglookup.nim +++ b/tests/lookups/tkoeniglookup.nim diff --git a/tests/compile/tredef.nim b/tests/lookups/tredef.nim index 02d1f7776..02d1f7776 100644 --- a/tests/compile/tredef.nim +++ b/tests/lookups/tredef.nim diff --git a/tests/macros/tdebugstmt.nim b/tests/macros/tdebugstmt.nim new file mode 100644 index 000000000..865dc436a --- /dev/null +++ b/tests/macros/tdebugstmt.nim @@ -0,0 +1,29 @@ +discard """ + output: '''a[0]: 42 +a[1]: 45 +x: some string''' +""" + +import macros + +macro debug(n: varargs[expr]): stmt = + # `n` is a Nimrod AST that contains the whole macro invocation + # this macro returns a list of statements: + result = newNimNode(nnkStmtList, n) + # iterate over any argument that is passed to this macro: + for i in 0..n.len-1: + # add a call to the statement list that writes the expression; + # `toStrLit` converts an AST to its string representation: + add(result, newCall("write", newIdentNode("stdout"), toStrLit(n[i]))) + # add a call to the statement list that writes ": " + add(result, newCall("write", newIdentNode("stdout"), newStrLitNode(": "))) + # add a call to the statement list that writes the expressions value: + add(result, newCall("writeln", newIdentNode("stdout"), n[i])) + +var + a: array [0..10, int] + x = "some string" +a[0] = 42 +a[1] = 45 + +debug(a[0], a[1], x) diff --git a/tests/compile/tdumpast.nim b/tests/macros/tdumpast.nim index 55a964327..160e4e194 100644 --- a/tests/compile/tdumpast.nim +++ b/tests/macros/tdumpast.nim @@ -2,7 +2,7 @@ import macros -template plus(a, b: expr): expr = +template plus(a, b: expr): expr {.dirty} = a + b macro call(e: expr): expr = diff --git a/tests/compile/tdumpast2.nim b/tests/macros/tdumpast2.nim index c6eab39a9..2a7024a01 100644 --- a/tests/compile/tdumpast2.nim +++ b/tests/macros/tdumpast2.nim @@ -7,7 +7,7 @@ proc dumpit(n: PNimrodNode): string {.compileTime.} = result = $n.kind add(result, "(") case n.kind - of nnkEmpty: nil # same as nil node in this representation + of nnkEmpty: discard # same as nil node in this representation of nnkNilLit: add(result, "nil") of nnkCharLit..nnkInt64Lit: add(result, $n.intVal) of nnkFloatLit..nnkFloat64Lit: add(result, $n.floatVal) diff --git a/tests/run/tdumptree.nim b/tests/macros/tdumptree.nim index 5299a94e3..5299a94e3 100644 --- a/tests/run/tdumptree.nim +++ b/tests/macros/tdumptree.nim diff --git a/tests/run/tidgen.nim b/tests/macros/tidgen.nim index 2fe9e0f82..2fe9e0f82 100644 --- a/tests/run/tidgen.nim +++ b/tests/macros/tidgen.nim diff --git a/tests/compile/tmacro1.nim b/tests/macros/tmacro1.nim index 3a67c2611..3a67c2611 100644 --- a/tests/compile/tmacro1.nim +++ b/tests/macros/tmacro1.nim diff --git a/tests/run/tmacro2.nim b/tests/macros/tmacro2.nim index 8515322d5..8515322d5 100644 --- a/tests/run/tmacro2.nim +++ b/tests/macros/tmacro2.nim diff --git a/tests/run/tmacro3.nim b/tests/macros/tmacro3.nim index 162212326..162212326 100644 --- a/tests/run/tmacro3.nim +++ b/tests/macros/tmacro3.nim diff --git a/tests/run/tmacro4.nim b/tests/macros/tmacro4.nim index 10a23b159..10a23b159 100644 --- a/tests/run/tmacro4.nim +++ b/tests/macros/tmacro4.nim diff --git a/tests/compile/tmacro2.nim b/tests/macros/tmacro5.nim index e7bc648db..39324e497 100644 --- a/tests/compile/tmacro2.nim +++ b/tests/macros/tmacro5.nim @@ -26,7 +26,7 @@ macro importImpl_forward(name, returns): stmt {.immediate.} = p2.add newIdentNode("errors") p2.add newNimNode(nnkVarTy) p2.add newNimNode(nnkEmpty) - p2[1].add newNimNOde(nnkBracketExpr) + p2[1].add newNimNode(nnkBracketExpr) p2[1][0].add newIdentNode("seq") p2[1][0].add newIdentNode("string") res[3].add p2 diff --git a/tests/compile/tmacroaspragma.nim b/tests/macros/tmacroaspragma.nim index 0e5c352b3..0e5c352b3 100644 --- a/tests/compile/tmacroaspragma.nim +++ b/tests/macros/tmacroaspragma.nim diff --git a/tests/run/tmacrogenerics.nim b/tests/macros/tmacrogenerics.nim index 5ae59e0da..b886f4fa5 100644 --- a/tests/run/tmacrogenerics.nim +++ b/tests/macros/tmacrogenerics.nim @@ -1,10 +1,8 @@ discard """ file: "tmacrogenerics.nim" msg: ''' -instantiation 1 with int and float -instantiation 2 with float and string -instantiation 3 with string and string -counter: 3 +instantiation 1 with typedesc and typedesc +counter: 1 ''' output: "int\nfloat\nint\nstring" """ diff --git a/tests/run/tmacros1.nim b/tests/macros/tmacros1.nim index 3c814ad6d..3c814ad6d 100644 --- a/tests/run/tmacros1.nim +++ b/tests/macros/tmacros1.nim diff --git a/tests/compile/tmacrostmt.nim b/tests/macros/tmacrostmt.nim index d9c70197d..d9c70197d 100644 --- a/tests/compile/tmacrostmt.nim +++ b/tests/macros/tmacrostmt.nim diff --git a/tests/compile/tmacrotypes.nim b/tests/macros/tmacrotypes.nim index 7697dba27..f19aa2ddb 100644 --- a/tests/compile/tmacrotypes.nim +++ b/tests/macros/tmacrotypes.nim @@ -1,3 +1,7 @@ +discard """ + disabled: true +""" + import macros, typetraits macro checkType(ex, expected: expr): stmt {.immediate.} = diff --git a/tests/macros/tmemit.nim b/tests/macros/tmemit.nim new file mode 100644 index 000000000..6fb2f3b65 --- /dev/null +++ b/tests/macros/tmemit.nim @@ -0,0 +1,7 @@ +discard """ + output: '''HELLO WORLD''' +""" + +import macros, strutils + +emit("echo " & '"' & "hello world".toUpper & '"') diff --git a/tests/compile/tnimrodnode_for_runtime.nim b/tests/macros/tnimrodnode_for_runtime.nim index e73c8430f..e73c8430f 100644 --- a/tests/compile/tnimrodnode_for_runtime.nim +++ b/tests/macros/tnimrodnode_for_runtime.nim diff --git a/tests/run/tprintf.nim b/tests/macros/tprintf.nim index c8fb51cdc..c8fb51cdc 100644 --- a/tests/run/tprintf.nim +++ b/tests/macros/tprintf.nim diff --git a/tests/run/tquotewords.nim b/tests/macros/tquotewords.nim index 76b8d8af7..76b8d8af7 100644 --- a/tests/run/tquotewords.nim +++ b/tests/macros/tquotewords.nim diff --git a/tests/reject/trecmacro.nim b/tests/macros/trecmacro.nim index 28b6db530..28b6db530 100644 --- a/tests/reject/trecmacro.nim +++ b/tests/macros/trecmacro.nim diff --git a/tests/run/tstringinterp.nim b/tests/macros/tstringinterp.nim index f030213e0..a500ed56e 100644 --- a/tests/run/tstringinterp.nim +++ b/tests/macros/tstringinterp.nim @@ -9,7 +9,7 @@ proc concat(strings: varargs[string]): string = result = newString(0) for s in items(strings): result.add(s) -template ProcessInterpolations(e: expr) = +template processInterpolations(e: expr) = var s = e[1].strVal for f in interpolatedFragments(s): case f.kind @@ -35,7 +35,7 @@ macro formatStyleInterpolation(e: expr): expr = proc addDollar() = formatString.add("$$") - ProcessInterpolations(e) + processInterpolations(e) result = parseExpr("\"x\" % [y]") result[1].strVal = formatString @@ -50,7 +50,7 @@ macro concatStyleInterpolation(e: expr): expr = proc addExpr(e: PNimrodNode) = args.add(e) proc addDollar() = args.add(newStrLitNode"$") - ProcessInterpolations(e) + processInterpolations(e) result = newCall("concat", args) diff --git a/tests/run/tvtable.nim b/tests/macros/tvtable.nim index 51894618c..51894618c 100644 --- a/tests/run/tvtable.nim +++ b/tests/macros/tvtable.nim diff --git a/tests/run/tlowhigh.nim b/tests/magics/tlowhigh.nim index d1cbd3272..d1cbd3272 100644 --- a/tests/run/tlowhigh.nim +++ b/tests/magics/tlowhigh.nim diff --git a/tests/run/tmatrix.nim b/tests/matrix/tmatrix.nim index 90dfde959..90dfde959 100644 --- a/tests/run/tmatrix.nim +++ b/tests/matrix/tmatrix.nim diff --git a/tests/compile/tmatrix1.nim b/tests/matrix/tmatrix1.nim index 0adf30b57..0adf30b57 100644 --- a/tests/compile/tmatrix1.nim +++ b/tests/matrix/tmatrix1.nim diff --git a/tests/compile/tmatrix2.nim b/tests/matrix/tmatrix2.nim index 442096e93..442096e93 100644 --- a/tests/compile/tmatrix2.nim +++ b/tests/matrix/tmatrix2.nim diff --git a/tests/metatype/tbindtypedesc.nim b/tests/metatype/tbindtypedesc.nim new file mode 100644 index 000000000..5ea8cf063 --- /dev/null +++ b/tests/metatype/tbindtypedesc.nim @@ -0,0 +1,91 @@ +discard """ + msg: ''' +int +float +TFoo +TFoo +''' +""" + +import typetraits + +type + TFoo = object + x, y: int + + TBar = tuple + x, y: int + +template accept(e: expr) = + static: assert(compiles(e)) + +template reject(e: expr) = + static: assert(not compiles(e)) + +proc genericParamRepeated[T: typedesc](a: T, b: T) = + static: + echo a.name + echo b.name + +accept genericParamRepeated(int, int) +accept genericParamRepeated(float, float) + +reject genericParamRepeated(string, int) +reject genericParamRepeated(int, float) + +proc genericParamOnce[T: typedesc](a, b: T) = + static: + echo a.name + echo b.name + +accept genericParamOnce(int, int) +accept genericParamOnce(TFoo, TFoo) + +reject genericParamOnce(string, int) +reject genericParamOnce(TFoo, float) + +type + type1 = typedesc + type2 = typedesc + +proc typePairs(A, B: type1; C, D: type2) = nil + +accept typePairs(int, int, TFoo, TFOO) +accept typePairs(TBAR, TBar, TBAR, TBAR) +accept typePairs(int, int, string, string) + +reject typePairs(TBAR, TBar, TBar, TFoo) +reject typePairs(string, int, TBAR, TBAR) + +proc typePairs2[T: typedesc, U: typedesc](A, B: T; C, D: U) = nil + +accept typePairs2(int, int, TFoo, TFOO) +accept typePairs2(TBAR, TBar, TBAR, TBAR) +accept typePairs2(int, int, string, string) + +reject typePairs2(TBAR, TBar, TBar, TFoo) +reject typePairs2(string, int, TBAR, TBAR) + +proc dontBind(a: typedesc, b: typedesc) = + static: + echo a.name + echo b.name + +accept dontBind(int, float) +accept dontBind(TFoo, TFoo) + +proc dontBind2(a, b: typedesc) = nil + +accept dontBind2(int, float) +accept dontBind2(TBar, int) + +proc bindArg(T: typedesc, U: typedesc, a, b: T, c, d: U) = nil + +accept bindArg(int, string, 10, 20, "test", "nest") +accept bindArg(int, int, 10, 20, 30, 40) + +reject bindArg(int, string, 10, "test", "test", "nest") +reject bindArg(int, int, 10, 20, 30, "test") +reject bindArg(int, string, 10.0, 20, "test", "nest") +reject bindArg(int, string, "test", "nest", 10, 20) + diff --git a/tests/metatype/tcompositetypeclasses.nim b/tests/metatype/tcompositetypeclasses.nim new file mode 100644 index 000000000..a2db73769 --- /dev/null +++ b/tests/metatype/tcompositetypeclasses.nim @@ -0,0 +1,59 @@ +template accept(e) = + static: assert(compiles(e)) + +template reject(e) = + static: assert(not compiles(e)) + +type + TFoo[T, U] = tuple + x: T + y: U + + TBar[K] = TFoo[K, K] + + TUserClass = int|string + + TBaz = TBar[TUserClass] + +var + vfoo: TFoo[int, string] + vbar: TFoo[string, string] + vbaz: TFoo[int, int] + vnotbaz: TFoo[TObject, TObject] + +proc foo(x: TFoo) = echo "foo" +proc bar(x: TBar) = echo "bar" +proc baz(x: TBaz) = echo "baz" + +accept foo(vfoo) +accept bar(vbar) +accept baz(vbar) +accept baz(vbaz) + +reject baz(vnotbaz) +reject bar(vfoo) + +# https://github.com/Araq/Nimrod/issues/517 +type + TVecT*[T] = array[0..1, T]|array[0..2, T]|array[0..3, T] + TVec2* = array[0..1, float32] + +proc f[T](a: TVecT[T], b: TVecT[T]): T = discard + +var x: float = f([0.0'f32, 0.0'f32], [0.0'f32, 0.0'f32]) +var y = f(TVec2([0.0'f32, 0.0'f32]), TVec2([0.0'f32, 0.0'f32])) + +# https://github.com/Araq/Nimrod/issues/602 +type + TTest = object + TTest2* = object + TUnion = TTest | TTest2 + +proc f(src: ptr TUnion, dst: ptr TUnion) = + echo("asd") + +var tx: TTest +var ty: TTest2 + +accept f(addr tx, addr tx) +reject f(addr tx, addr ty) diff --git a/tests/compile/tconstraints.nim b/tests/metatype/tconstraints.nim index 7aef0d645..7aef0d645 100644 --- a/tests/compile/tconstraints.nim +++ b/tests/metatype/tconstraints.nim diff --git a/tests/metatype/tsemistatic.nim b/tests/metatype/tsemistatic.nim new file mode 100644 index 000000000..d187f153c --- /dev/null +++ b/tests/metatype/tsemistatic.nim @@ -0,0 +1,24 @@ +discard """ + msg: "static 10\ndynamic\nstatic 20\n" + output: "s\nd\nd\ns" +""" + +proc foo(x: semistatic[int]) = + when isStatic(x): + static: echo "static ", x + echo "s" + else: + static: echo "dynamic" + echo "d" + +foo 10 + +var + x = 10 + y: int + +foo x +foo y + +foo 20 + diff --git a/tests/metatype/tstaticparams.nim b/tests/metatype/tstaticparams.nim new file mode 100644 index 000000000..b1377443b --- /dev/null +++ b/tests/metatype/tstaticparams.nim @@ -0,0 +1,31 @@ +discard """ + file: "tstaticparams.nim" + output: "abracadabra\ntest\n3" +""" + +type + TFoo[T; Val: static[string]] = object + data: array[4, T] + + TBar[T; I: static[int]] = object + data: array[I, T] + + TA1[T; I: static[int]] = array[I, T] + # TA2[T; I: static[int]] = array[0..I, T] + # TA3[T; I: static[int]] = array[I-1, T] + +proc takeFoo(x: TFoo) = + echo "abracadabra" + echo TFoo.Val + +var x: TFoo[int, "test"] +takeFoo(x) + +var y: TBar[float, 4] +echo high(y.data) + +var + t1: TA1[float, 1] + # t2: TA2[string, 4] + # t3: TA3[int, 10] + diff --git a/tests/metatype/ttypebar.nim b/tests/metatype/ttypebar.nim new file mode 100644 index 000000000..304dfffcb --- /dev/null +++ b/tests/metatype/ttypebar.nim @@ -0,0 +1,14 @@ + +# bug #602 + +type + TTest = object + TTest2* = object + TFoo = TTest | TTest2 + +proc f(src: ptr TFoo, dst: ptr TFoo) = + echo("asd") + +var x: TTest +f(addr x, addr x) + diff --git a/tests/compile/ttypeclasses.nim b/tests/metatype/ttypeclasses.nim index 677229868..677229868 100644 --- a/tests/compile/ttypeclasses.nim +++ b/tests/metatype/ttypeclasses.nim diff --git a/tests/run/ttypedesc1.nim b/tests/metatype/ttypedesc1.nim index 0c6f5dce4..0c6f5dce4 100644 --- a/tests/run/ttypedesc1.nim +++ b/tests/metatype/ttypedesc1.nim diff --git a/tests/compile/ttypeselectors.nim b/tests/metatype/ttypeselectors.nim index cca643e1f..cca643e1f 100644 --- a/tests/compile/ttypeselectors.nim +++ b/tests/metatype/ttypeselectors.nim diff --git a/tests/run/ttypetraits.nim b/tests/metatype/ttypetraits.nim index 9a4a7d0d3..4344855eb 100644 --- a/tests/run/ttypetraits.nim +++ b/tests/metatype/ttypetraits.nim @@ -1,6 +1,6 @@ discard """ msg: "int\nstring\nTBar[int]" - output: "int\nstring\nTBar[int]\nint\nrange 0..2\nstring" + output: "int\nstring\nTBar[int]\nint\nrange 0..2(int)\nstring" """ import typetraits diff --git a/tests/metatype/tusertypeclasses.nim b/tests/metatype/tusertypeclasses.nim new file mode 100644 index 000000000..4c2f07b85 --- /dev/null +++ b/tests/metatype/tusertypeclasses.nim @@ -0,0 +1,28 @@ +discard """ + output: "Sortable\nSortable\nContainer" +""" + +import typetraits + +type + TObj = object + x: int + + Sortable = generic x, y + (x < y) is bool + + ObjectContainer = generic C + C.len is ordinal + for v in items(C): + v.type is tuple|object + +proc foo(c: ObjectContainer) = + echo "Container" + +proc foo(x: Sortable) = + echo "Sortable" + +foo 10 +foo "test" +foo(@[TObj(x: 10), TObj(x: 20)]) + diff --git a/tests/run/utypeclasses.nim b/tests/metatype/utypeclasses.nim index 06bab375e..06bab375e 100644 --- a/tests/run/utypeclasses.nim +++ b/tests/metatype/utypeclasses.nim diff --git a/tests/run/mmultim3.nim b/tests/method/mmultim3.nim index 3139a8089..3139a8089 100644 --- a/tests/run/mmultim3.nim +++ b/tests/method/mmultim3.nim diff --git a/tests/reject/tmethod.nim b/tests/method/tmethod.nim index 0cfe24c70..0cfe24c70 100644 --- a/tests/reject/tmethod.nim +++ b/tests/method/tmethod.nim diff --git a/tests/run/tmethods1.nim b/tests/method/tmethods1.nim index f4add6af4..f4add6af4 100644 --- a/tests/run/tmethods1.nim +++ b/tests/method/tmethods1.nim diff --git a/tests/run/tmultim1.nim b/tests/method/tmultim1.nim index 7f551aa64..7f551aa64 100644 --- a/tests/run/tmultim1.nim +++ b/tests/method/tmultim1.nim diff --git a/tests/run/tmultim2.nim b/tests/method/tmultim2.nim index 75f652137..75f652137 100644 --- a/tests/run/tmultim2.nim +++ b/tests/method/tmultim2.nim diff --git a/tests/run/tmultim3.nim b/tests/method/tmultim3.nim index 373c84c0e..373c84c0e 100644 --- a/tests/run/tmultim3.nim +++ b/tests/method/tmultim3.nim diff --git a/tests/run/tmultim4.nim b/tests/method/tmultim4.nim index d824086b2..d824086b2 100644 --- a/tests/run/tmultim4.nim +++ b/tests/method/tmultim4.nim diff --git a/tests/run/tmultim6.nim b/tests/method/tmultim6.nim index 5f45f572a..5f45f572a 100644 --- a/tests/run/tmultim6.nim +++ b/tests/method/tmultim6.nim diff --git a/tests/run/tsimmeth.nim b/tests/method/tsimmeth.nim index 11ff2674f..11ff2674f 100644 --- a/tests/run/tsimmeth.nim +++ b/tests/method/tsimmeth.nim diff --git a/tests/reject/mopaque.nim b/tests/module/mopaque.nim index 7eee4bd96..7eee4bd96 100644 --- a/tests/reject/mopaque.nim +++ b/tests/module/mopaque.nim diff --git a/tests/compile/mrecmod.nim b/tests/module/mrecmod.nim index fab9654d5..fab9654d5 100644 --- a/tests/compile/mrecmod.nim +++ b/tests/module/mrecmod.nim diff --git a/tests/compile/mrecmod2.nim b/tests/module/mrecmod2.nim index 9557ce729..9557ce729 100644 --- a/tests/compile/mrecmod2.nim +++ b/tests/module/mrecmod2.nim diff --git a/tests/reject/topaque.nim b/tests/module/topaque.nim index f0587c959..f0587c959 100644 --- a/tests/reject/topaque.nim +++ b/tests/module/topaque.nim diff --git a/tests/reject/trecinca.nim b/tests/module/trecinca.nim index 73a0ec937..73a0ec937 100644 --- a/tests/reject/trecinca.nim +++ b/tests/module/trecinca.nim diff --git a/tests/reject/trecincb.nim b/tests/module/trecincb.nim index 9dd7d51de..9dd7d51de 100644 --- a/tests/reject/trecincb.nim +++ b/tests/module/trecincb.nim diff --git a/tests/compile/trecmod.nim b/tests/module/trecmod.nim index 9d39d3ff7..9d39d3ff7 100644 --- a/tests/compile/trecmod.nim +++ b/tests/module/trecmod.nim diff --git a/tests/compile/trecmod2.nim b/tests/module/trecmod2.nim index 85fe2215f..85fe2215f 100644 --- a/tests/compile/trecmod2.nim +++ b/tests/module/trecmod2.nim diff --git a/tests/compile/mexporta.nim b/tests/modules/mexporta.nim index b7d4ddec9..b7d4ddec9 100644 --- a/tests/compile/mexporta.nim +++ b/tests/modules/mexporta.nim diff --git a/tests/compile/mexportb.nim b/tests/modules/mexportb.nim index 10d89f388..10d89f388 100644 --- a/tests/compile/mexportb.nim +++ b/tests/modules/mexportb.nim diff --git a/tests/compile/texport.nim b/tests/modules/texport.nim index 99228dfce..99228dfce 100644 --- a/tests/compile/texport.nim +++ b/tests/modules/texport.nim diff --git a/tests/reject/timportexcept.nim b/tests/modules/timportexcept.nim index 93a7fd642..93a7fd642 100644 --- a/tests/reject/timportexcept.nim +++ b/tests/modules/timportexcept.nim diff --git a/tests/reject/tnamedparams.nim b/tests/namedparams/tnamedparams.nim index 9397fea4a..9397fea4a 100644 --- a/tests/reject/tnamedparams.nim +++ b/tests/namedparams/tnamedparams.nim diff --git a/tests/compile/tnamedparams.nim b/tests/namedparams/tnamedparams2.nim index 4b0cd5361..4b0cd5361 100644 --- a/tests/compile/tnamedparams.nim +++ b/tests/namedparams/tnamedparams2.nim diff --git a/tests/reject/mnamspc1.nim b/tests/namspc/mnamspc1.nim index da13c5f24..da13c5f24 100644 --- a/tests/reject/mnamspc1.nim +++ b/tests/namspc/mnamspc1.nim diff --git a/tests/reject/mnamspc2.nim b/tests/namspc/mnamspc2.nim index 84ef8533e..84ef8533e 100644 --- a/tests/reject/mnamspc2.nim +++ b/tests/namspc/mnamspc2.nim diff --git a/tests/reject/tnamspc.nim b/tests/namspc/tnamspc.nim index 1e2049cec..1e2049cec 100644 --- a/tests/reject/tnamspc.nim +++ b/tests/namspc/tnamspc.nim diff --git a/tests/reject/tnotnil.nim b/tests/notnil/tnotnil.nim index fba7fa917..fba7fa917 100644 --- a/tests/reject/tnotnil.nim +++ b/tests/notnil/tnotnil.nim diff --git a/tests/reject/tnotnil1.nim b/tests/notnil/tnotnil1.nim index 863fe45f8..863fe45f8 100644 --- a/tests/reject/tnotnil1.nim +++ b/tests/notnil/tnotnil1.nim diff --git a/tests/reject/tnotnil2.nim b/tests/notnil/tnotnil2.nim index bd6b8b675..bd6b8b675 100644 --- a/tests/reject/tnotnil2.nim +++ b/tests/notnil/tnotnil2.nim diff --git a/tests/run/tobjconstr.nim b/tests/objects/tobjconstr.nim index 3bd785728..3bd785728 100644 --- a/tests/run/tobjconstr.nim +++ b/tests/objects/tobjconstr.nim diff --git a/tests/compile/tobjconstr2.nim b/tests/objects/tobjconstr2.nim index cb47e146d..cb47e146d 100644 --- a/tests/compile/tobjconstr2.nim +++ b/tests/objects/tobjconstr2.nim diff --git a/tests/compile/tobjcov.nim b/tests/objects/tobjcov.nim index fc44edf8e..fc44edf8e 100644 --- a/tests/compile/tobjcov.nim +++ b/tests/objects/tobjcov.nim diff --git a/tests/run/tobject.nim b/tests/objects/tobject.nim index 5fec84441..5fec84441 100644 --- a/tests/run/tobject.nim +++ b/tests/objects/tobject.nim diff --git a/tests/compile/tobject2.nim b/tests/objects/tobject2.nim index 0f1869695..0f1869695 100644 --- a/tests/compile/tobject2.nim +++ b/tests/objects/tobject2.nim diff --git a/tests/compile/tobject3.nim b/tests/objects/tobject3.nim index 935e6ca8c..935e6ca8c 100644 --- a/tests/compile/tobject3.nim +++ b/tests/objects/tobject3.nim diff --git a/tests/compile/tobjects.nim b/tests/objects/tobjects.nim index 06fa15583..06fa15583 100644 --- a/tests/compile/tobjects.nim +++ b/tests/objects/tobjects.nim diff --git a/tests/run/tofopr.nim b/tests/objects/tofopr.nim index 961d81bd3..961d81bd3 100644 --- a/tests/run/tofopr.nim +++ b/tests/objects/tofopr.nim diff --git a/tests/compile/toop.nim b/tests/objects/toop.nim index 0b42c2c22..0b42c2c22 100644 --- a/tests/compile/toop.nim +++ b/tests/objects/toop.nim diff --git a/tests/run/toop1.nim b/tests/objects/toop1.nim index 350799f51..350799f51 100644 --- a/tests/run/toop1.nim +++ b/tests/objects/toop1.nim diff --git a/tests/reject/tadrdisc.nim b/tests/objvariant/tadrdisc.nim index 0e0324562..0e0324562 100644 --- a/tests/reject/tadrdisc.nim +++ b/tests/objvariant/tadrdisc.nim diff --git a/tests/reject/tcheckedfield1.nim b/tests/objvariant/tcheckedfield1.nim index 5ade3a13a..5ade3a13a 100644 --- a/tests/reject/tcheckedfield1.nim +++ b/tests/objvariant/tcheckedfield1.nim diff --git a/tests/reject/temptycaseobj.nim b/tests/objvariant/temptycaseobj.nim index 5c012746e..5c012746e 100644 --- a/tests/reject/temptycaseobj.nim +++ b/tests/objvariant/temptycaseobj.nim diff --git a/tests/run/tvariantstack.nim b/tests/objvariant/tvariantstack.nim index d81f6e001..d81f6e001 100644 --- a/tests/run/tvariantstack.nim +++ b/tests/objvariant/tvariantstack.nim diff --git a/tests/reject/topena1.nim b/tests/openarray/topena1.nim index 0dbc5506a..0dbc5506a 100644 --- a/tests/reject/topena1.nim +++ b/tests/openarray/topena1.nim diff --git a/tests/run/topenarrayrepr.nim b/tests/openarray/topenarrayrepr.nim index d276756bc..d276756bc 100644 --- a/tests/run/topenarrayrepr.nim +++ b/tests/openarray/topenarrayrepr.nim diff --git a/tests/run/topenlen.nim b/tests/openarray/topenlen.nim index fec8e87b7..fec8e87b7 100644 --- a/tests/run/topenlen.nim +++ b/tests/openarray/topenlen.nim diff --git a/tests/run/toverflw.nim b/tests/overflw/toverflw.nim index cd7b65acf..cd7b65acf 100644 --- a/tests/run/toverflw.nim +++ b/tests/overflw/toverflw.nim diff --git a/tests/run/toverflw2.nim b/tests/overflw/toverflw2.nim index f7fe3d574..f7fe3d574 100644 --- a/tests/run/toverflw2.nim +++ b/tests/overflw/toverflw2.nim diff --git a/tests/run/tovfint.nim b/tests/overflw/tovfint.nim index f0b1ccaa6..f0b1ccaa6 100644 --- a/tests/run/tovfint.nim +++ b/tests/overflw/tovfint.nim diff --git a/tests/reject/toverl.nim b/tests/overload/toverl.nim index 807b643a4..807b643a4 100644 --- a/tests/reject/toverl.nim +++ b/tests/overload/toverl.nim diff --git a/tests/run/toverl2.nim b/tests/overload/toverl2.nim index ea0249e9f..ea0249e9f 100644 --- a/tests/run/toverl2.nim +++ b/tests/overload/toverl2.nim diff --git a/tests/run/toverl3.nim b/tests/overload/toverl3.nim index b3e0f2fa7..b3e0f2fa7 100644 --- a/tests/run/toverl3.nim +++ b/tests/overload/toverl3.nim diff --git a/tests/compile/toverprc.nim b/tests/overload/toverprc.nim index 22b64ed48..22b64ed48 100644 --- a/tests/compile/toverprc.nim +++ b/tests/overload/toverprc.nim diff --git a/tests/run/toverwr.nim b/tests/overload/toverwr.nim index ef25e8913..ef25e8913 100644 --- a/tests/run/toverwr.nim +++ b/tests/overload/toverwr.nim diff --git a/tests/parser/tcommand_as_expr.nim b/tests/parser/tcommand_as_expr.nim new file mode 100644 index 000000000..22c49ab3f --- /dev/null +++ b/tests/parser/tcommand_as_expr.nim @@ -0,0 +1,23 @@ +discard """ + output: '''140 +5-120-120 +359''' +""" +#import math + +proc optarg(x:int, y:int = 0):int = x + 3 * y +proc singlearg(x:int):int = 20*x +echo optarg 1, singlearg 2 + + +proc foo(x: int): int = x-1 +proc foo(x, y: int): int = x-y + +let x = optarg foo 7.foo +let y = singlearg foo(1, foo 8) +let z = singlearg 1.foo foo 8 + +echo x, y, z + +let a = [2,4,8].map do (d:int) -> int: d + 1 +echo a[0], a[1], a[2] \ No newline at end of file diff --git a/tests/run/tdomulttest.nim b/tests/parser/tdomulttest.nim index 4ee6de128..4ee6de128 100644 --- a/tests/run/tdomulttest.nim +++ b/tests/parser/tdomulttest.nim diff --git a/tests/reject/tinvwhen.nim b/tests/parser/tinvwhen.nim index ea8a7ddf0..5ff94cc6c 100644 --- a/tests/reject/tinvwhen.nim +++ b/tests/parser/tinvwhen.nim @@ -5,9 +5,9 @@ discard """ """ # This was parsed even though it should not! -proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".} +proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".} -proc getcwd(buf: CString, buflen: cint): CString +proc getcwd(buf: cstring, buflen: cint): cstring when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation elif defined(windows): {.importc: "getcwd", header: "<direct.h>"} else: {.error: "os library not ported to your OS. Please help!".} diff --git a/tests/run/toprprec.nim b/tests/parser/toprprec.nim index ce33934b5..ce33934b5 100644 --- a/tests/run/toprprec.nim +++ b/tests/parser/toprprec.nim diff --git a/tests/run/tprecedence.nim b/tests/parser/tprecedence.nim index 6b1b250a2..6b1b250a2 100644 --- a/tests/run/tprecedence.nim +++ b/tests/parser/tprecedence.nim diff --git a/tests/patterns/tor.nim b/tests/patterns/tor.nim index 7de1a7fa1..833418919 100644 --- a/tests/patterns/tor.nim +++ b/tests/patterns/tor.nim @@ -1,5 +1,5 @@ discard """ - output: '''110 + output: '''3060 true''' """ diff --git a/tests/run/tpatterns.nim b/tests/patterns/tpatterns.nim index 6bc8772e3..6bc8772e3 100644 --- a/tests/run/tpatterns.nim +++ b/tests/patterns/tpatterns.nim diff --git a/tests/compile/tpush.nim b/tests/pragmas/tpush.nim index 5fb411a79..5fb411a79 100644 --- a/tests/compile/tpush.nim +++ b/tests/pragmas/tpush.nim diff --git a/tests/compile/tuserpragma.nim b/tests/pragmas/tuserpragma.nim index 784baa176..784baa176 100644 --- a/tests/compile/tuserpragma.nim +++ b/tests/pragmas/tuserpragma.nim diff --git a/tests/run/tnestprc.nim b/tests/proc/tnestprc.nim index c10ad6abf..c10ad6abf 100644 --- a/tests/run/tnestprc.nim +++ b/tests/proc/tnestprc.nim diff --git a/tests/reject/tprocredef.nim b/tests/proc/tprocredef.nim index 86ed92b62..86ed92b62 100644 --- a/tests/reject/tprocredef.nim +++ b/tests/proc/tprocredef.nim diff --git a/tests/compile/tgenericprocvar.nim b/tests/procvar/tgenericprocvar.nim index e642e3577..e642e3577 100644 --- a/tests/compile/tgenericprocvar.nim +++ b/tests/procvar/tgenericprocvar.nim diff --git a/tests/reject/tprocvar.nim b/tests/procvar/tprocvar.nim index 56f76c613..56f76c613 100644 --- a/tests/reject/tprocvar.nim +++ b/tests/procvar/tprocvar.nim diff --git a/tests/run/tprocvar.nim b/tests/procvar/tprocvar2.nim index 237e2ef7a..237e2ef7a 100644 --- a/tests/run/tprocvar.nim +++ b/tests/procvar/tprocvar2.nim diff --git a/tests/compile/tprocvars.nim b/tests/procvar/tprocvars.nim index dc7592526..dc7592526 100644 --- a/tests/compile/tprocvars.nim +++ b/tests/procvar/tprocvars.nim diff --git a/tests/range/compilehelpers.nim b/tests/range/compilehelpers.nim new file mode 100644 index 000000000..cb26ca5b5 --- /dev/null +++ b/tests/range/compilehelpers.nim @@ -0,0 +1,6 @@ +template accept(e: expr) = + static: assert(compiles(e)) + +template reject(e: expr) = + static: assert(not compiles(e)) + diff --git a/tests/run/tbug499771.nim b/tests/range/tbug499771.nim index 682148422..682148422 100644 --- a/tests/run/tbug499771.nim +++ b/tests/range/tbug499771.nim diff --git a/tests/compile/tcolors.nim b/tests/range/tcolors.nim index 9d1034405..9d1034405 100644 --- a/tests/compile/tcolors.nim +++ b/tests/range/tcolors.nim diff --git a/tests/range/tmatrix3.nim b/tests/range/tmatrix3.nim new file mode 100644 index 000000000..900404524 --- /dev/null +++ b/tests/range/tmatrix3.nim @@ -0,0 +1,41 @@ +discard """ + output: '''0.0000000000000000e+00 +0.0000000000000000e+00 +0 +0 +0 +''' +""" + +include compilehelpers + +type + Matrix*[M, N, T] = object + aij*: array[M, array[N, T]] + + Matrix2*[T] = Matrix[range[0..1], range[0..1], T] + + Matrix3*[T] = Matrix[range[0..2], range[0..2], T] + +proc mn(x: Matrix): Matrix.T = x.aij[0][0] + +proc m2(x: Matrix2): Matrix2.T = x.aij[0][0] + +proc m3(x: Matrix3): auto = x.aij[0][0] + +var + matn: Matrix[range[0..3], range[0..2], int] + mat2: Matrix2[int] + mat3: Matrix3[float] + +echo m3(mat3) +echo mn(mat3) +echo m2(mat2) +echo mn(mat2) +echo mn(matn) + +reject m3(mat2) +reject m3(matn) +reject m2(mat3) +reject m2(matn) + diff --git a/tests/reject/tsubrange.nim b/tests/range/tsubrange.nim index b4a333bf3..b4a333bf3 100644 --- a/tests/reject/tsubrange.nim +++ b/tests/range/tsubrange.nim diff --git a/tests/run/tsubrange2.nim b/tests/range/tsubrange2.nim index 51598713b..51598713b 100644 --- a/tests/run/tsubrange2.nim +++ b/tests/range/tsubrange2.nim diff --git a/tests/run/tsubrange.nim b/tests/range/tsubrange3.nim index b3e02fd29..b3e02fd29 100644 --- a/tests/run/tsubrange.nim +++ b/tests/range/tsubrange3.nim diff --git a/tests/reject/99bottles.nim b/tests/reject/99bottles.nim deleted file mode 100644 index 14904ac0f..000000000 --- a/tests/reject/99bottles.nim +++ /dev/null @@ -1 +0,0 @@ -# Test if the compiler detects invalid module names diff --git a/tests/reject/mbind4.nim b/tests/reject/mbind4.nim deleted file mode 100644 index 53b8331cd..000000000 --- a/tests/reject/mbind4.nim +++ /dev/null @@ -1,9 +0,0 @@ -# Module A -var - lastId = 0 - -template genId*: expr = - inc(lastId) - lastId - - diff --git a/tests/reject/t99bott.nim b/tests/reject/t99bott.nim deleted file mode 100644 index 7ebfd61e9..000000000 --- a/tests/reject/t99bott.nim +++ /dev/null @@ -1,36 +0,0 @@ -discard """ - file: "t99bott.nim" - line: 26 - errormsg: "constant expression expected" - disabled: false -""" -## 99 Bottles of Beer -## http://www.99-bottles-of-beer.net/ -## Nimrod version - -## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr -# 2012-11-25 -# Loosely based on my old Lua version... Updated to current official lyrics. - -proc GetBottleNumber(n: int): string = - var bs: string - if n == 0: - bs = "No more bottles" - elif n == 1: - bs = "1 bottle" - else: - bs = $n & " bottles" - return bs & " of beer" - -for bn in countdown(99, 1): - const cur = GetBottleNumber(bn) - echo(cur, " on the wall, ", cur, ".") - echo("Take one down and pass it around, ", GetBottleNumber(bn-1), - " on the wall.\n") - -echo "No more bottles of beer on the wall, no more bottles of beer." -echo "Go to the store and buy some more, 99 bottles of beer on the wall." - - - - diff --git a/tests/reject/tatomic.nim b/tests/reject/tatomic.nim deleted file mode 100644 index 1fa0cff8d..000000000 --- a/tests/reject/tatomic.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tatomic.nim" - line: 7 - errormsg: "identifier expected, but found 'keyword atomic'" -""" -var - atomic: int - -echo atomic - - - diff --git a/tests/reject/tbind4.nim b/tests/reject/tbind4.nim deleted file mode 100644 index a0ba88e7c..000000000 --- a/tests/reject/tbind4.nim +++ /dev/null @@ -1,13 +0,0 @@ -discard """ - file: "mbind4.nim" - line: 6 - errormsg: "undeclared identifier: \'lastId\'" -""" -# Module B -import mbind4 - -echo genId() - - - - diff --git a/tests/reject/tgenconstraints.nim b/tests/reject/tgenconstraints.nim deleted file mode 100644 index e32aa877b..000000000 --- a/tests/reject/tgenconstraints.nim +++ /dev/null @@ -1,30 +0,0 @@ -discard """ - file: "tgenconstraints.nim" - line: 25 - errormsg: "cannot instantiate T2" -""" - -type - T1[T: int|string] = object - x: T - - T2[T: Ordinal] = object - x: T - -var x1: T1[int] -var x2: T1[string] -var x3: T2[int] - -proc foo[T](x: T): T2[T] {.discardable.} = - var o: T1[T] - -foo(10) - -proc bar(x: string|TNumber): T1[type(x)] {.discardable.} = - when type(x) is TNumber: - var o: T2[type(x)] - -bar "test" -bar 100 -bar 1.1 - diff --git a/tests/reject/tinc.nim b/tests/reject/tinc.nim deleted file mode 100644 index 8038a2a01..000000000 --- a/tests/reject/tinc.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tinc.nim" - line: 8 - errormsg: "for a \'var\' type a variable needs to be passed" -""" -var x = 0 - -inc(x+1) - - - - diff --git a/tests/reject/tinout.nim b/tests/reject/tinout.nim deleted file mode 100644 index 034c496f5..000000000 --- a/tests/reject/tinout.nim +++ /dev/null @@ -1,16 +0,0 @@ -discard """ - file: "tinout.nim" - line: 12 - errormsg: "for a \'var\' type a variable needs to be passed" -""" -# Test in out checking for parameters - -proc abc(x: var int) = - x = 0 - -proc b() = - abc(3) #ERROR - -b() - - diff --git a/tests/reject/tinvalidarrayaccess.nim b/tests/reject/tinvalidarrayaccess.nim deleted file mode 100644 index 03105b41b..000000000 --- a/tests/reject/tinvalidarrayaccess.nim +++ /dev/null @@ -1,14 +0,0 @@ -discard """ - errormsg: "index out of bounds" - line: 11 -""" - - -type TTestArr = array[0..1, int16] -var f: TTestArr -f[0] = 30 -f[1] = 40 -f[2] = 50 -f[3] = 60 - -echo(repr(f)) diff --git a/tests/reject/tinvalidnewseq.nim b/tests/reject/tinvalidnewseq.nim deleted file mode 100644 index 957a25560..000000000 --- a/tests/reject/tinvalidnewseq.nim +++ /dev/null @@ -1,27 +0,0 @@ -discard """ - file: "tinvalidnewseq.nim" - line: 15 - errormsg: "type mismatch: got (array[0..6, string], int literal(7))" -""" -import re, strutils - -type - TURL = tuple[protocol, subdomain, domain, port: string, path: seq[string]] - -proc parseURL(url: string): TURL = - #([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)? - var pattern: string = r"([a-zA-Z]+://)?(\w+?\.)?(\w+)(\.\w+)(:[0-9]+)?(/.+)?" - var m: array[0..6, string] #Array with the matches - newSeq(m, 7) #ERROR - discard regexprs.match(url, re(pattern), m) - - result = (protocol: m[1], subdomain: m[2], domain: m[3] & m[4], - port: m[5], path: m[6].split('/')) - -var r: TUrl - -r = parseUrl(r"http://google.com/search?var=bleahdhsad") -echo(r.domain) - - - diff --git a/tests/reject/tnoinst.nim b/tests/reject/tnoinst.nim deleted file mode 100644 index 23a4145e0..000000000 --- a/tests/reject/tnoinst.nim +++ /dev/null @@ -1,16 +0,0 @@ -discard """ - line: 12 - errormsg: "instantiate 'notConcrete' explicitely" -""" - -proc wrap[T]() = - proc notConcrete[T](x, y: int): int = - var dummy: T - result = x - y - - var x: proc (x, y: T): int - x = notConcrete - - -wrap[int]() - diff --git a/tests/reject/tnolen.nim b/tests/reject/tnolen.nim deleted file mode 100644 index e33086536..000000000 --- a/tests/reject/tnolen.nim +++ /dev/null @@ -1,9 +0,0 @@ -discard """ - line: 8 - msg: "type mismatch: got (int literal(3))" -""" - -# please finally disallow Len(3) - -echo len(3) - diff --git a/tests/reject/tnoop.nim b/tests/reject/tnoop.nim deleted file mode 100644 index c79403e11..000000000 --- a/tests/reject/tnoop.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tnoop.nim" - line: 11 - errormsg: "expression \'a()\' cannot be called" -""" -# Tests the new check in the semantic pass - -var - a: int - -a() #ERROR_MSG expression 'a()' cannot be called - diff --git a/tests/reject/tnot.nim b/tests/reject/tnot.nim deleted file mode 100644 index 1985ef666..000000000 --- a/tests/reject/tnot.nim +++ /dev/null @@ -1,21 +0,0 @@ -discard """ - file: "system.nim" - errormsg: "type mismatch" -""" -# BUG: following compiles, but should not: - -proc nodeOfDegree(x: Int): bool = - result = false - -proc main = - for j in 0..2: - for i in 0..10: - if not nodeOfDegree(1) >= 0: #ERROR_MSG type mismatch - Echo "Yes" - else: - Echo "No" - -main() - - - diff --git a/tests/reject/trawstr.nim b/tests/reject/trawstr.nim deleted file mode 100644 index ab2aae159..000000000 --- a/tests/reject/trawstr.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "trawstr.nim" - line: 10 - errormsg: "closing \" expected" -""" -# Test the new raw strings: - -const - xxx = r"This is a raw string!" - yyy = "This not\" #ERROR - - diff --git a/tests/reject/tsimtych.nim b/tests/reject/tsimtych.nim deleted file mode 100644 index dd969958c..000000000 --- a/tests/reject/tsimtych.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tsimtych.nim" - line: 10 - errormsg: "type mismatch: got (bool) but expected \'string\'" -""" -# Test 2 -# Simple type checking - -var a: string -a = false #ERROR - - diff --git a/tests/run/globalaux.nim b/tests/run/globalaux.nim deleted file mode 100644 index 5f6f72721..000000000 --- a/tests/run/globalaux.nim +++ /dev/null @@ -1,15 +0,0 @@ -type - TObj*[T] = object - val*: T - -var - totalGlobals* = 0 - -proc makeObj[T](x: T): TObj[T] = - totalGlobals += 1 - result.val = x - -proc globalInstance*[T]: var TObj[T] = - var g {.global.} = when T is int: makeObj(10) else: makeObj("hello") - result = g - diff --git a/tests/run/globalaux2.nim b/tests/run/globalaux2.nim deleted file mode 100644 index 6c77f1f48..000000000 --- a/tests/run/globalaux2.nim +++ /dev/null @@ -1,4 +0,0 @@ -import globalaux - -echo "in globalaux2: ", globalInstance[int]().val - diff --git a/tests/run/minit.nim b/tests/run/minit.nim deleted file mode 100644 index 75fcebb77..000000000 --- a/tests/run/minit.nim +++ /dev/null @@ -1,2 +0,0 @@ -# Test the new initialization for modules -write(stdout, "Hello from module! ") diff --git a/tests/run/tack.nim b/tests/run/tack.nim deleted file mode 100644 index 680ff567e..000000000 --- a/tests/run/tack.nim +++ /dev/null @@ -1,21 +0,0 @@ -discard """ - file: "tack.nim" - output: "125" -""" -# the Ackermann function - -proc ack(x, y: int): int = - if x != 0: - if y != 0: - return ack(x-1, ack(x, y-1)) - return ack(x-1, 1) - else: - return y + 1 -# if x == 0: return y + 1 -# elif y == 0: return ack(x-1, 1) -# else: return ack(x-1, ack(x, y-1)) - -# echo(ack(0, 0)) -write(stdout, ack(3, 4)) #OUT 125 - - diff --git a/tests/run/tbug511622.nim b/tests/run/tbug511622.nim deleted file mode 100644 index a5360423d..000000000 --- a/tests/run/tbug511622.nim +++ /dev/null @@ -1,16 +0,0 @@ -discard """ - file: "tbug511622.nim" - output: "3" -""" -import StrUtils, Math - -proc FibonacciA(n: int): int64 = - var fn = float64(n) - var p: float64 = (1.0 + sqrt(5.0)) / 2.0 - var q: float64 = 1.0 / p - return int64((pow(p, fn) + pow(q, fn)) / sqrt(5.0)) - -echo FibonacciA(4) #OUT 3 - - - diff --git a/tests/run/tdestructor.nim b/tests/run/tdestructor.nim deleted file mode 100644 index 8aae2fce2..000000000 --- a/tests/run/tdestructor.nim +++ /dev/null @@ -1,26 +0,0 @@ -discard """ - output: '''some text -Destructor called!''' -""" - -type - TMyObj = object - x, y: int - p: pointer - -proc destruct(o: var TMyObj) {.destructor.} = - if o.p != nil: dealloc o.p - echo "Destructor called!" - -proc open: TMyObj = - # allow for superfluous () - result = (TMyObj(x: 1, y: 2, p: alloc(3))) - - -proc `$`(x: TMyObj): string = $x.y - -proc main() = - var x = open() - echo "some text" - -main() diff --git a/tests/run/temit.nim b/tests/run/temit.nim deleted file mode 100644 index ff8df0585..000000000 --- a/tests/run/temit.nim +++ /dev/null @@ -1,20 +0,0 @@ -discard """ - file: "temit.nim" - output: "509" -""" -# Test the new ``emit`` pragma: - -{.emit: """ -static int cvariable = 420; - -""".} - -proc embedsC() = - var nimrodVar = 89 - {.emit: """printf("%d\n", cvariable + (int)`nimrodVar`);""".} - -embedsC() - - - - diff --git a/tests/run/teventemitter.nim b/tests/run/teventemitter.nim deleted file mode 100644 index 9ecf72ea2..000000000 --- a/tests/run/teventemitter.nim +++ /dev/null @@ -1,33 +0,0 @@ -discard """ - output: "pie" -""" - -import tables, lists - -type - TEventArgs = object of TObject - TEventEmitter = object of TObject - events*: TTable[string, TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]] - -proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) = - for func in nodes(emitter.events[event]): - func.value(args) #call function with args. - -proc on*(emitter: var TEventEmitter, event: string, - func: proc(e: TEventArgs) {.nimcall.}) = - if not hasKey(emitter.events, event): - var list: TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}] - add(emitter.events, event, list) #if not, add it. - append(emitter.events.mget(event), func) - -proc initEmitter(emitter: var TEventEmitter) = - emitter.events = initTable[string, - TDoublyLinkedList[proc(e: TEventArgs) {.nimcall.}]]() - -var - ee: TEventEmitter - args: TEventArgs -initEmitter(ee) -ee.on("print", proc(e: TEventArgs) = echo("pie")) -ee.emit("print", args) - diff --git a/tests/run/tevents.nim b/tests/run/tevents.nim deleted file mode 100644 index fb94b1f79..000000000 --- a/tests/run/tevents.nim +++ /dev/null @@ -1,48 +0,0 @@ -discard """ -file: "tevents.nim" -output: '''HandlePrintEvent: Output -> Handled print event -HandlePrintEvent2: Output -> printing for ME -HandlePrintEvent2: Output -> printing for ME''' -""" - -import events - -type - TPrintEventArgs = object of TEventArgs - user*: string - -proc handleprintevent*(e: TEventArgs) = - write(stdout, "HandlePrintEvent: Output -> Handled print event\n") - -proc handleprintevent2*(e: TEventArgs) = - var args: TPrintEventArgs = TPrintEventArgs(e) - write(stdout, "HandlePrintEvent2: Output -> printing for " & args.user) - -var ee = initEventEmitter() - -var eventargs: TPrintEventArgs -eventargs.user = "ME\n" - -##method one test - -ee.on("print", handleprintevent) -ee.on("print", handleprintevent2) - -ee.emit("print", eventargs) - -##method two test - -type - TSomeObject = object of TObject - PrintEvent: TEventHandler - -var obj: TSomeObject -obj.PrintEvent = initEventHandler("print") -obj.PrintEvent.addHandler(handleprintevent2) - -ee.emit(obj.PrintEvent, eventargs) - -obj.PrintEvent.removeHandler(handleprintevent2) - -ee.emit(obj.PrintEvent, eventargs) - diff --git a/tests/run/tfilter.nim b/tests/run/tfilter.nim deleted file mode 100644 index 5846d0efb..000000000 --- a/tests/run/tfilter.nim +++ /dev/null @@ -1,41 +0,0 @@ -discard """ - output: "02468101214161820\n15" -""" - -proc filter[T](list: seq[T], f: proc (item: T): bool {.closure.}): seq[T] = - result = @[] - for i in items(list): - if f(i): - result.add(i) - -let nums = @[0, 1, 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] - -when true: - let nums2 = filter(nums, - (proc (item: int): bool = - result = (item mod 2) == 0) - ) - -proc outer = - # lets use a proper closure this time: - var modulo = 2 - let nums2 = filter(nums, - (proc (item: int): bool = result = (item mod modulo) == 0) - ) - - for n in nums2: stdout.write(n) - stdout.write("\n") - -outer() - -import math -proc compose[T](f1, f2: proc (x: T): T {.closure.}): proc (x: T): T {.closure.} = - result = (proc (x: T): T = - result = f1(f2(x))) - - -proc add5(x: int): int = result = x + 5 - -var test = compose(add5, add5) -echo test(5) - diff --git a/tests/run/thintoff.nim b/tests/run/thintoff.nim deleted file mode 100644 index 807ff44f3..000000000 --- a/tests/run/thintoff.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "thintoff.nim" - output: "0" -""" - -{.hint[XDeclaredButNotUsed]: off.} -var - x: int - -echo x #OUT 0 - - diff --git a/tests/run/tinit.nim b/tests/run/tinit.nim deleted file mode 100644 index 5c75567ec..000000000 --- a/tests/run/tinit.nim +++ /dev/null @@ -1,12 +0,0 @@ -discard """ - file: "tinit.nim" - output: "Hello from module! Hello from main module!" -""" -# Test the new init section in modules - -import minit - -write(stdout, "Hello from main module!\n") -#OUT Hello from module! Hello from main module! - - diff --git a/tests/run/tints.nim b/tests/run/tints.nim deleted file mode 100644 index fb2852af9..000000000 --- a/tests/run/tints.nim +++ /dev/null @@ -1,45 +0,0 @@ -discard """ - file: "tints.nim" - output: "Success" -""" -# Test the different integer operations - -var testNumber = 0 - -template test(opr, a, b, c: expr): stmt {.immediate.} = - # test the expression at compile and runtime - block: - const constExpr = opr(a, b) - when constExpr != c: - {.error: "Test failed " & $constExpr & " " & $c.} - inc(testNumber) - #Echo("Test: " & $testNumber) - var aa = a - var bb = b - var varExpr = opr(aa, bb) - assert(varExpr == c) - -test(`+`, 12'i8, -13'i16, -1'i16) -test(`shl`, 0b11, 0b100, 0b110000) -test(`shl`, 0b11'i32, 0b100'i64, 0b110000'i64) -test(`shl`, 0b11'i32, 0b100'i32, 0b110000'i32) - -test(`or`, 0xf0f0'i16, 0x0d0d'i16, 0xfdfd'i16) -test(`and`, 0xf0f0'i16, 0xfdfd'i16, 0xf0f0'i16) - -test(`shr`, 0xffffffffffffffff'i64, 0x4'i64, 0x0fffffffffffffff'i64) -test(`shr`, 0xffff'i16, 0x4'i16, 0x0fff'i16) -test(`shr`, 0xff'i8, 0x4'i8, 0x0f'i8) - -test(`shr`, 0xffffffff'i64, 0x4'i64, 0x0fffffff'i64) -test(`shr`, 0xffffffff'i32, 0x4'i32, 0x0fffffff'i32) - -test(`shl`, 0xffffffffffffffff'i64, 0x4'i64, 0xfffffffffffffff0'i64) -test(`shl`, 0xffff'i16, 0x4'i16, 0xfff0'i16) -test(`shl`, 0xff'i8, 0x4'i8, 0xf0'i8) - -test(`shl`, 0xffffffff'i64, 0x4'i64, 0xffffffff0'i64) -test(`shl`, 0xffffffff'i32, 0x4'i32, 0xfffffff0'i32) - -Echo("Success") #OUT Success - diff --git a/tests/run/tlocals.nim b/tests/run/tlocals.nim deleted file mode 100644 index 94a34139b..000000000 --- a/tests/run/tlocals.nim +++ /dev/null @@ -1,11 +0,0 @@ -discard """ - output: "(x: string here, a: 1, b: 3)" -""" - -proc simple[T](a, b: T) = - var - x = "string here" - echo locals() - -simple(1, 3) - diff --git a/tests/run/tmemoization.nim b/tests/run/tmemoization.nim deleted file mode 100644 index 78f0515f3..000000000 --- a/tests/run/tmemoization.nim +++ /dev/null @@ -1,17 +0,0 @@ -discard """ - msg: "test 1\ntest 2" - output: "TEST 1\nTEST 2\nTEST 2" -""" - -import strutils - -proc foo(s: expr[string]): string = - static: echo s - - const R = s.toUpper - return R - -echo foo("test 1") -echo foo("test 2") -echo foo("test " & $2) - diff --git a/tests/run/tnewderef.nim b/tests/run/tnewderef.nim deleted file mode 100644 index 89dc4c8d1..000000000 --- a/tests/run/tnewderef.nim +++ /dev/null @@ -1,11 +0,0 @@ -discard """ - output: 3 - -""" - -var x: ref int -new(x) -x[] = 3 - -echo x[] - diff --git a/tests/run/tpos.nim b/tests/run/tpos.nim deleted file mode 100644 index 3d72536dd..000000000 --- a/tests/run/tpos.nim +++ /dev/null @@ -1,35 +0,0 @@ -discard """ - file: "tpos.nim" - output: "6" -""" -# test this particular function - -proc mypos(sub, s: string, start: int = 0): int = - var - i, j, M, N: int - M = sub.len - N = s.len - i = start - j = 0 - if i >= N: - result = -1 - else: - while True: - if s[i] == sub[j]: - Inc(i) - Inc(j) - else: - i = i - j + 1 - j = 0 - if (j >= M) or (i >= N): break - if j >= M: - result = i - M - else: - result = -1 - -var sub = "hello" -var s = "world hello" -write(stdout, mypos(sub, s)) -#OUT 6 - - diff --git a/tests/run/tromans.nim b/tests/run/tromans.nim deleted file mode 100644 index fa6a63595..000000000 --- a/tests/run/tromans.nim +++ /dev/null @@ -1,71 +0,0 @@ -discard """ - file: "tromans.nim" - output: "success" -""" -import - strutils - -## Convert an integer to a Roman numeral -# See http://en.wikipedia.org/wiki/Roman_numerals for reference - -proc raiseInvalidValue(msg: string) {.noreturn.} = - # Yes, we really need a shorthand for this code... - var e: ref EInvalidValue - new(e) - e.msg = msg - raise e - -# I should use a class, perhaps. -# --> No. Why introduce additional state into such a simple and nice -# interface? State is evil. :D - -proc RomanToDecimal(romanVal: string): int = - result = 0 - var prevVal = 0 - for i in countdown(romanVal.len - 1, 0): - var val = 0 - case romanVal[i] - of 'I', 'i': val = 1 - of 'V', 'v': val = 5 - of 'X', 'x': val = 10 - of 'L', 'l': val = 50 - of 'C', 'c': val = 100 - of 'D', 'd': val = 500 - of 'M', 'm': val = 1000 - else: raiseInvalidValue("Incorrect character in roman numeral! (" & - $romanVal[i] & ")") - if val >= prevVal: - inc(result, val) - else: - dec(result, val) - prevVal = val - -proc DecimalToRoman(decValParam: int): string = - # Apparently numbers cannot be above 4000 - # Well, they can be (using overbar or parenthesis notation) - # but I see little interest (beside coding challenge) in coding them as - # we rarely use huge Roman numeral. - const romanComposites = [ - ("M", 1000), ("CM", 900), - ("D", 500), ("CD", 400), ("C", 100), - ("XC", 90), ("L", 50), ("XL", 40), ("X", 10), ("IX", 9), - ("V", 5), ("IV", 4), ("I", 1)] - if decValParam < 1 or decValParam > 3999: - raiseInvalidValue("number not representable") - result = "" - var decVal = decValParam - for key, val in items(romanComposites): - while decVal >= val: - dec(decVal, val) - result.add(key) - -for i in 1..100: - if RomanToDecimal(DecimalToRoman(i)) != i: quit "BUG" - -for i in items([1238, 1777, 3830, 2401, 379, 33, 940, 3973]): - if RomanToDecimal(DecimalToRoman(i)) != i: quit "BUG" - -echo "success" #OUT success - - - diff --git a/tests/run/tsimplesort.nim b/tests/run/tsimplesort.nim deleted file mode 100644 index 0167ca78a..000000000 --- a/tests/run/tsimplesort.nim +++ /dev/null @@ -1,313 +0,0 @@ -discard """ - output: '''true''' -""" - -import hashes, math - - -when defined(shallowADT): - {.pragma: myShallow, shallow.} -else: - {.pragma: myShallow.} - -type - TSlotEnum = enum seEmpty, seFilled, seDeleted - TKeyValuePair[A, B] = tuple[slot: TSlotEnum, key: A, val: B] - TKeyValuePairSeq[A, B] = seq[TKeyValuePair[A, B]] - TTable* {.final, myShallow.}[A, B] = object - data: TKeyValuePairSeq[A, B] - counter: int - -proc len*[A, B](t: TTable[A, B]): int = - ## returns the number of keys in `t`. - result = t.counter - -iterator pairs*[A, B](t: TTable[A, B]): tuple[key: A, val: B] = - ## iterates over any (key, value) pair in the table `t`. - for h in 0..high(t.data): - if t.data[h].slot == seFilled: yield (t.data[h].key, t.data[h].val) - -iterator keys*[A, B](t: TTable[A, B]): A = - ## iterates over any key in the table `t`. - for h in 0..high(t.data): - if t.data[h].slot == seFilled: yield t.data[h].key - -iterator values*[A, B](t: TTable[A, B]): B = - ## iterates over any value in the table `t`. - for h in 0..high(t.data): - if t.data[h].slot == seFilled: yield t.data[h].val - -const - growthFactor = 2 - -proc mustRehash(length, counter: int): bool {.inline.} = - assert(length > counter) - result = (length * 2 < counter * 3) or (length - counter < 4) - -proc nextTry(h, maxHash: THash): THash {.inline.} = - result = ((5 * h) + 1) and maxHash - -template rawGetImpl() = - var h: THash = hash(key) and high(t.data) # start with real hash value - while t.data[h].slot != seEmpty: - if t.data[h].key == key and t.data[h].slot == seFilled: - return h - h = nextTry(h, high(t.data)) - result = -1 - -template rawInsertImpl() = - var h: THash = hash(key) and high(data) - while data[h].slot == seFilled: - h = nextTry(h, high(data)) - data[h].key = key - data[h].val = val - data[h].slot = seFilled - -proc RawGet[A, B](t: TTable[A, B], key: A): int = - rawGetImpl() - -proc `[]`*[A, B](t: TTable[A, B], key: A): B = - ## retrieves the value at ``t[key]``. If `key` is not in `t`, - ## default empty value for the type `B` is returned - ## and no exception is raised. One can check with ``hasKey`` whether the key - ## exists. - var index = RawGet(t, key) - if index >= 0: result = t.data[index].val - -proc hasKey*[A, B](t: TTable[A, B], key: A): bool = - ## returns true iff `key` is in the table `t`. - result = rawGet(t, key) >= 0 - -proc RawInsert[A, B](t: var TTable[A, B], data: var TKeyValuePairSeq[A, B], - key: A, val: B) = - rawInsertImpl() - -proc Enlarge[A, B](t: var TTable[A, B]) = - var n: TKeyValuePairSeq[A, B] - newSeq(n, len(t.data) * growthFactor) - for i in countup(0, high(t.data)): - if t.data[i].slot == seFilled: RawInsert(t, n, t.data[i].key, t.data[i].val) - swap(t.data, n) - -template PutImpl() = - var index = RawGet(t, key) - if index >= 0: - t.data[index].val = val - else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) - inc(t.counter) - -proc `[]=`*[A, B](t: var TTable[A, B], key: A, val: B) = - ## puts a (key, value)-pair into `t`. - putImpl() - -proc del*[A, B](t: var TTable[A, B], key: A) = - ## deletes `key` from hash table `t`. - var index = RawGet(t, key) - if index >= 0: - t.data[index].slot = seDeleted - dec(t.counter) - -proc initTable*[A, B](initialSize=64): TTable[A, B] = - ## creates a new hash table that is empty. `initialSize` needs to be - ## a power of two. - assert isPowerOfTwo(initialSize) - result.counter = 0 - newSeq(result.data, initialSize) - -proc toTable*[A, B](pairs: openarray[tuple[key: A, - val: B]]): TTable[A, B] = - ## creates a new hash table that contains the given `pairs`. - result = initTable[A, B](nextPowerOfTwo(pairs.len+10)) - for key, val in items(pairs): result[key] = val - -template dollarImpl(): stmt = - if t.len == 0: - result = "{:}" - else: - result = "{" - for key, val in pairs(t): - if result.len > 1: result.add(", ") - result.add($key) - result.add(": ") - result.add($val) - result.add("}") - -proc `$`*[A, B](t: TTable[A, B]): string = - ## The `$` operator for hash tables. - dollarImpl() - -# ------------------------------ count tables ------------------------------- - -type - TCountTable* {.final, myShallow.}[ - A] = object ## table that counts the number of each key - data: seq[tuple[key: A, val: int]] - counter: int - -proc len*[A](t: TCountTable[A]): int = - ## returns the number of keys in `t`. - result = t.counter - -iterator pairs*[A](t: TCountTable[A]): tuple[key: A, val: int] = - ## iterates over any (key, value) pair in the table `t`. - for h in 0..high(t.data): - if t.data[h].val != 0: yield (t.data[h].key, t.data[h].val) - -iterator keys*[A](t: TCountTable[A]): A = - ## iterates over any key in the table `t`. - for h in 0..high(t.data): - if t.data[h].val != 0: yield t.data[h].key - -iterator values*[A](t: TCountTable[A]): int = - ## iterates over any value in the table `t`. - for h in 0..high(t.data): - if t.data[h].val != 0: yield t.data[h].val - -proc RawGet[A](t: TCountTable[A], key: A): int = - var h: THash = hash(key) and high(t.data) # start with real hash value - while t.data[h].val != 0: - if t.data[h].key == key: return h - h = nextTry(h, high(t.data)) - result = -1 - -proc `[]`*[A](t: TCountTable[A], key: A): int = - ## retrieves the value at ``t[key]``. If `key` is not in `t`, - ## 0 is returned. One can check with ``hasKey`` whether the key - ## exists. - var index = RawGet(t, key) - if index >= 0: result = t.data[index].val - -proc hasKey*[A](t: TCountTable[A], key: A): bool = - ## returns true iff `key` is in the table `t`. - result = rawGet(t, key) >= 0 - -proc RawInsert[A](t: TCountTable[A], data: var seq[tuple[key: A, val: int]], - key: A, val: int) = - var h: THash = hash(key) and high(data) - while data[h].val != 0: h = nextTry(h, high(data)) - data[h].key = key - data[h].val = val - -proc Enlarge[A](t: var TCountTable[A]) = - var n: seq[tuple[key: A, val: int]] - newSeq(n, len(t.data) * growthFactor) - for i in countup(0, high(t.data)): - if t.data[i].val != 0: RawInsert(t, n, t.data[i].key, t.data[i].val) - swap(t.data, n) - -proc `[]=`*[A](t: var TCountTable[A], key: A, val: int) = - ## puts a (key, value)-pair into `t`. `val` has to be positive. - assert val > 0 - PutImpl() - -proc initCountTable*[A](initialSize=64): TCountTable[A] = - ## creates a new count table that is empty. `initialSize` needs to be - ## a power of two. - assert isPowerOfTwo(initialSize) - result.counter = 0 - newSeq(result.data, initialSize) - -proc toCountTable*[A](keys: openArray[A]): TCountTable[A] = - ## creates a new count table with every key in `keys` having a count of 1. - result = initCountTable[A](nextPowerOfTwo(keys.len+10)) - for key in items(keys): result[key] = 1 - -proc `$`*[A](t: TCountTable[A]): string = - ## The `$` operator for count tables. - dollarImpl() - -proc inc*[A](t: var TCountTable[A], key: A, val = 1) = - ## increments `t[key]` by `val`. - var index = RawGet(t, key) - if index >= 0: - inc(t.data[index].val, val) - else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) - inc(t.counter) - -proc Smallest*[A](t: TCountTable[A]): tuple[key: A, val: int] = - ## returns the largest (key,val)-pair. Efficiency: O(n) - assert t.len > 0 - var minIdx = 0 - for h in 1..high(t.data): - if t.data[h].val > 0 and t.data[minIdx].val > t.data[h].val: minIdx = h - result.key = t.data[minIdx].key - result.val = t.data[minIdx].val - -proc Largest*[A](t: TCountTable[A]): tuple[key: A, val: int] = - ## returns the (key,val)-pair with the largest `val`. Efficiency: O(n) - assert t.len > 0 - var maxIdx = 0 - for h in 1..high(t.data): - if t.data[maxIdx].val < t.data[h].val: maxIdx = h - result.key = t.data[maxIdx].key - result.val = t.data[maxIdx].val - -proc sort*[A](t: var TCountTable[A]) = - ## sorts the count table so that the entry with the highest counter comes - ## first. This is destructive! You must not modify `t` afterwards! - ## You can use the iterators `pairs`, `keys`, and `values` to iterate over - ## `t` in the sorted order. - - # we use shellsort here; fast enough and simple - var h = 1 - while true: - h = 3 * h + 1 - if h >= high(t.data): break - while true: - h = h div 3 - for i in countup(h, high(t.data)): - var j = i - while t.data[j-h].val <= t.data[j].val: - var xyz = t.data[j] - t.data[j] = t.data[j-h] - t.data[j-h] = xyz - j = j-h - if j < h: break - if h == 1: break - - -const - data = { - "34": 123456, "12": 789, - "90": 343, "0": 34404, - "1": 344004, "2": 344774, - "3": 342244, "4": 3412344, - "5": 341232144, "6": 34214544, - "7": 3434544, "8": 344544, - "9": 34435644, "---00": 346677844, - "10": 34484, "11": 34474, "19": 34464, - "20": 34454, "30": 34141244, "40": 344114, - "50": 344490, "60": 344491, "70": 344492, - "80": 344497} - -proc countTableTest1 = - var s = initTable[string, int](64) - for key, val in items(data): s[key] = val - var w: tuple[key: string, val: int] #type(otherCountTable.data[0]) - - var t = initCountTable[string]() - for k, v in items(data): t.inc(k) - for k in t.keys: assert t[k] == 1 - t.inc("90", 3) - t.inc("12", 2) - t.inc("34", 1) - assert t.largest()[0] == "90" - t.sort() - - var i = 0 - for k, v in t.pairs: - case i - of 0: assert k == "90" and v == 4 - of 1: assert k == "12" and v == 3 - of 2: assert k == "34" and v == 2 - else: break - inc i - -countTableTest1() -echo true - - diff --git a/tests/run/tslices.nim b/tests/run/tslices.nim deleted file mode 100644 index 0de1171e3..000000000 --- a/tests/run/tslices.nim +++ /dev/null @@ -1,59 +0,0 @@ -discard """ - file: "tslices.nim" - output: '''456456 -456456 -456456 -Zugr5nd -egerichtetd -verichtetd -''' -""" - -# Test the new slices. - -import strutils - -var mystr = "Abgrund" -mystr[..1] = "Zu" - -mystr[4..4] = "5" - -type - TEnum = enum e1, e2, e3, e4, e5, e6 - -var myarr: array[TEnum, int] = [1, 2, 3, 4, 5, 6] -myarr[e1..e3] = myarr[e4..e6] -myarr[..e3] = myarr[e4..e6] - -for x in items(myarr): stdout.write(x) -echo() - -var myarr2: array[0..5, int] = [1, 2, 3, 4, 5, 6] -myarr2[0..2] = myarr2[3..5] - -for x in items(myarr2): stdout.write(x) -echo() - - -var myseq = @[1, 2, 3, 4, 5, 6] -myseq[0..2] = myseq[-3.. -1] - -for x in items(myseq): stdout.write(x) -echo() - -echo mystr - -mystr[4..4] = "u" - -# test full replacement -mystr[.. -2] = "egerichtet" - -echo mystr - -mystr[0..2] = "ve" -echo mystr - -var s = "abcdef" -s[1 .. -2] = "xyz" -assert s == "axyzf" - diff --git a/tests/run/tsortdev.nim b/tests/run/tsortdev.nim deleted file mode 100644 index d7d42d22c..000000000 --- a/tests/run/tsortdev.nim +++ /dev/null @@ -1,59 +0,0 @@ -discard """ - output: "done" -""" - -import algorithm, strutils - -proc cmpPlatforms(a, b: string): int = - if a == b: return 0 - var dashes = a.split('-') - var dashes2 = b.split('-') - if dashes[0] == dashes2[0]: - if dashes[1] == dashes2[1]: return system.cmp(a,b) - case dashes[1] - of "x86": - return 1 - of "x86_64": - if dashes2[1] == "x86": return -1 - else: return 1 - of "ppc64": - if dashes2[1] == "x86" or dashes2[1] == "x86_64": return -1 - else: return 1 - else: - return system.cmp(dashes[1], dashes2[1]) - else: - case dashes[0] - of "linux": - return 1 - of "windows": - if dashes2[0] == "linux": return -1 - else: return 1 - of "macosx": - if dashes2[0] == "linux" or dashes2[0] == "windows": return -1 - else: return 1 - else: - if dashes2[0] == "linux" or dashes2[0] == "windows" or - dashes2[0] == "macosx": return -1 - else: - return system.cmp(a, b) - -proc sorted[T](a: openArray[T]): bool = - result = true - for i in 0 .. < a.high: - if cmpPlatforms(a[i], a[i+1]) > 0: - echo "Out of order: ", a[i], " ", a[i+1] - result = false - -proc main() = - var testData = @["netbsd-x86_64", "windows-x86", "linux-x86_64", "linux-x86", - "linux-ppc64", "macosx-x86-1058", "macosx-x86-1068"] - - sort(testData, cmpPlatforms) - - doAssert sorted(testData) - -for i in 0..1_000: - main() - -echo "done" - diff --git a/tests/run/tstaticparams.nim b/tests/run/tstaticparams.nim deleted file mode 100644 index 232748356..000000000 --- a/tests/run/tstaticparams.nim +++ /dev/null @@ -1,22 +0,0 @@ -discard """ - file: "tstaticparams.nim" - output: "abracadabra\ntest\n3" -""" - -type - TFoo[T; Val: expr[string]] = object - data: array[4, T] - - TBar[T; I: expr[int]] = object - data: array[I, T] - -proc takeFoo(x: TFoo) = - echo "abracadabra" - echo TFoo.Val - -var x: TFoo[int, "test"] -takeFoo(x) - -var y: TBar[float, 4] -echo high(y.data) - diff --git a/tests/run/tstrange.nim b/tests/run/tstrange.nim deleted file mode 100644 index 3947755fc..000000000 --- a/tests/run/tstrange.nim +++ /dev/null @@ -1,23 +0,0 @@ -discard """ - file: "tstrange.nim" - output: "hallo4" -""" -# test for extremely strange bug - -proc ack(x: int, y: int): int = - if x != 0: - if y != 5: - return y - return x - return x+y - -proc gen[T](a: T) = - write(stdout, a) - - -gen("hallo") -write(stdout, ack(5, 4)) -#OUT hallo4 - - - diff --git a/tests/run/tunittests.nim b/tests/run/tunittests.nim deleted file mode 100644 index c77f691d9..000000000 --- a/tests/run/tunittests.nim +++ /dev/null @@ -1 +0,0 @@ -import utemplates, uclosures diff --git a/tests/run/tvarious1.nim b/tests/run/tvarious1.nim deleted file mode 100644 index 9dd4af606..000000000 --- a/tests/run/tvarious1.nim +++ /dev/null @@ -1,29 +0,0 @@ -discard """ - file: "tlenopenarray.nim" - output: '''1 -0 -Whopie''' -""" - -echo len([1_000_000]) #OUT 1 - -type - TArray = array[0..3, int] - TVector = distinct array[0..3, int] -proc `[]`(v: TVector; idx: int): int = TArray(v)[idx] -var v: TVector -echo v[2] - -# bug #569 - -import queues - -type - TWidget = object - names: TQueue[string] - -var w = TWidget(names: initQueue[string]()) - -add(w.names, "Whopie") - -for n in w.names: echo(n) diff --git a/tests/run/tvarnums.nim b/tests/run/tvarnums.nim deleted file mode 100644 index 4f99df8b9..000000000 --- a/tests/run/tvarnums.nim +++ /dev/null @@ -1,142 +0,0 @@ -discard """ - file: "tvarnums.nim" - output: "Success!" -""" -# Test variable length binary integers - -import - strutils - -type - TBuffer = array [0..10, int8] - -proc toVarNum(x: int32, b: var TBuffer) = - # encoding: first bit indicates end of number (0 if at end) - # second bit of the first byte denotes the sign (1 --> negative) - var a = x - if x != low(x): - # low(int) is a special case, - # because abs() does not work here! - # we leave x as it is and use the check >% instead of > - # for low(int) this is needed and positive numbers are not affected - # anyway - a = abs(x) - # first 6 bits: - b[0] = toU8(ord(a >% 63'i32) shl 7 or (ord(x < 0'i32) shl 6) or (int(a) and 63)) - a = a shr 6'i32 # skip first 6 bits - var i = 1 - while a != 0'i32: - b[i] = toU8(ord(a >% 127'i32) shl 7 or (int(a) and 127)) - inc(i) - a = a shr 7'i32 - -proc toVarNum64(x: int64, b: var TBuffer) = - # encoding: first bit indicates end of number (0 if at end) - # second bit of the first byte denotes the sign (1 --> negative) - var a = x - if x != low(x): - # low(int) is a special case, - # because abs() does not work here! - # we leave x as it is and use the check >% instead of > - # for low(int) this is needed and positive numbers are not affected - # anyway - a = abs(x) - # first 6 bits: - b[0] = toU8(ord(a >% 63'i64) shl 7 or (ord(x < 0'i64) shl 6) or int(a and 63)) - a = a shr 6 # skip first 6 bits - var i = 1 - while a != 0'i64: - b[i] = toU8(ord(a >% 127'i64) shl 7 or int(a and 127)) - inc(i) - a = a shr 7 - -proc toNum64(b: TBuffer): int64 = - # treat first byte different: - result = ze64(b[0]) and 63 - var - i = 0 - Shift = 6'i64 - while (ze(b[i]) and 128) != 0: - inc(i) - result = result or ((ze64(b[i]) and 127) shl Shift) - inc(Shift, 7) - if (ze(b[0]) and 64) != 0: # sign bit set? - result = not result +% 1 - # this is the same as ``- result`` - # but gives no overflow error for low(int) - -proc toNum(b: TBuffer): int32 = - # treat first byte different: - result = ze(b[0]) and 63 - var - i = 0 - Shift = 6'i32 - while (ze(b[i]) and 128) != 0: - inc(i) - result = result or ((int32(ze(b[i])) and 127'i32) shl Shift) - Shift = shift + 7'i32 - if (ze(b[0]) and (1 shl 6)) != 0: # sign bit set? - result = (not result) +% 1'i32 - # this is the same as ``- result`` - # but gives no overflow error for low(int) - -proc toBinary(x: int64): string = - result = newString(64) - for i in 0..63: - result[63-i] = chr((int(x shr i) and 1) + ord('0')) - -proc t64(i: int64) = - var - b: TBuffer - toVarNum64(i, b) - var x = toNum64(b) - if x != i: - writeln(stdout, $i) - writeln(stdout, toBinary(i)) - writeln(stdout, toBinary(x)) - -proc t32(i: int32) = - var - b: TBuffer - toVarNum(i, b) - var x = toNum(b) - if x != i: - writeln(stdout, toBinary(i)) - writeln(stdout, toBinary(x)) - -proc tm(i: int32) = - var - b: TBuffer - toVarNum64(i, b) - var x = toNum(b) - if x != i: - writeln(stdout, toBinary(i)) - writeln(stdout, toBinary(x)) - -t32(0) -t32(1) -t32(-1) -t32(-100_000) -t32(100_000) -t32(low(int32)) -t32(high(int32)) - -t64(low(int64)) -t64(high(int64)) -t64(0) -t64(-1) -t64(1) -t64(1000_000) -t64(-1000_000) - -tm(0) -tm(1) -tm(-1) -tm(-100_000) -tm(100_000) -tm(low(int32)) -tm(high(int32)) - -writeln(stdout, "Success!") #OUT Success! - - diff --git a/tests/compile/tseq2.nim b/tests/seq/tseq2.nim index e1271964c..e1271964c 100644 --- a/tests/compile/tseq2.nim +++ b/tests/seq/tseq2.nim diff --git a/tests/run/tseqcon.nim b/tests/seq/tseqcon.nim index 6e0a5b56d..6e0a5b56d 100644 --- a/tests/run/tseqcon.nim +++ b/tests/seq/tseqcon.nim diff --git a/tests/compile/tseqcon2.nim b/tests/seq/tseqcon2.nim index 4f2763ffe..4f2763ffe 100644 --- a/tests/compile/tseqcon2.nim +++ b/tests/seq/tseqcon2.nim diff --git a/tests/run/tseqtuple.nim b/tests/seq/tseqtuple.nim index 7ef92f7f1..7ef92f7f1 100644 --- a/tests/run/tseqtuple.nim +++ b/tests/seq/tseqtuple.nim diff --git a/tests/run/tsequtils.nim b/tests/seq/tsequtils.nim index 7bc15ef9c..7bc15ef9c 100644 --- a/tests/run/tsequtils.nim +++ b/tests/seq/tsequtils.nim diff --git a/tests/run/ttoseq.nim b/tests/seq/ttoseq.nim index 34cc4824b..34cc4824b 100644 --- a/tests/run/ttoseq.nim +++ b/tests/seq/ttoseq.nim diff --git a/tests/sets/testequivalence.nim b/tests/sets/testequivalence.nim new file mode 100644 index 000000000..7c5d9e3e9 --- /dev/null +++ b/tests/sets/testequivalence.nim @@ -0,0 +1,15 @@ +discard """ + output: '''''' +""" +import unittest +import sets + +doAssert(toSet(@[1,2,3]) <= toSet(@[1,2,3,4]), "equivalent or subset") +doAssert(toSet(@[1,2,3]) <= toSet(@[1,2,3]), "equivalent or subset") +doAssert((not(toSet(@[1,2,3]) <= toSet(@[1,2]))), "equivalent or subset") +doAssert(toSet(@[1,2,3]) <= toSet(@[1,2,3,4]), "strict subset") +doAssert((not(toSet(@[1,2,3]) < toSet(@[1,2,3]))), "strict subset") +doAssert((not(toSet(@[1,2,3]) < toSet(@[1,2]))), "strict subset") +doAssert((not(toSet(@[1,2,3]) == toSet(@[1,2,3,4]))), "==") +doAssert(toSet(@[1,2,3]) == toSet(@[1,2,3]), "==") +doAssert((not(toSet(@[1,2,3]) == toSet(@[1,2]))), "==") diff --git a/tests/run/tsets.nim b/tests/sets/tsets.nim index 7b806f15b..7b806f15b 100644 --- a/tests/run/tsets.nim +++ b/tests/sets/tsets.nim diff --git a/tests/run/tsets2.nim b/tests/sets/tsets2.nim index ac977096b..ac977096b 100644 --- a/tests/run/tsets2.nim +++ b/tests/sets/tsets2.nim diff --git a/tests/showoff/tdrdobbs_examples.nim b/tests/showoff/tdrdobbs_examples.nim new file mode 100644 index 000000000..d1e0585d2 --- /dev/null +++ b/tests/showoff/tdrdobbs_examples.nim @@ -0,0 +1,134 @@ +discard """ + output: '''108 +11 -1 1936 +4.000000000000002-e001 +true +truefalse''' +""" + +proc `++`(x: var int; y: int = 1; z: int = 0) = + x = x + y + z + +var g = 70 +++g +g ++ 7 +g.`++`(10, 20) +echo g + + +#let lv = stdin.readline +#var vv = stdin.readline +#vv = "abc" # valid, reassignment allowed +#lv = "abc" # fails at compile time + +#proc square(x: int): int = x*x + +template square(x: int): int = + # ensure 'x' is only evaluated once: + let y = x + y * y + +proc mostSignificantBit(n: int): int = + # naive algorithm: + var n = n + while n != 0: + n = n shr 1 + result += 1 + result -= 1 + +const msb3999 = mostSignificantBit(3999) + +echo msb3999, " ", mostSignificantBit(0), " ", square(44) + +proc filter[T](a: openarray[T], predicate: proc (x: T): bool): seq[T] = + result = @[] # @[] constructs the empty seq + for x in a: + if predicate(x): result.add(x) + +proc map[T, S](a: openarray[T], fn: proc (x: T): S): seq[S] = + newSeq(result, a.len) + for i in 0 .. <a.len: result[i] = fn(a[i]) + + +type + FormulaKind = enum + fkVar, ## element is a variable like 'X' + fkLit, ## element is a literal like 0.1 + fkAdd, ## element is an addition operation + fkMul, ## element is a multiplication operation + fkExp ## element is an exponentiation operation + +type + Formula = ref object + case kind: FormulaKind + of fkVar: name: string + of fkLit: value: float + of fkAdd, fkMul, fkExp: left, right: Formula + +from math import pow + +proc evaluate(n: Formula, varToVal: proc (name: string): float): float = + case n.kind + of fkVar: varToVal(n.name) + of fkLit: n.value + of fkAdd: evaluate(n.left, varToVal) + evaluate(n.right, varToVal) + of fkMul: evaluate(n.left, varToVal) * evaluate(n.right, varToVal) + of fkExp: pow(evaluate(n.left, varToVal), evaluate(n.right, varToVal)) + +echo evaluate(Formula(kind: fkLit, value: 0.4), nil) + +proc isPolyTerm(n: Formula): bool = + n.kind == fkMul and n.left.kind == fkLit and (let e = n.right; + e.kind == fkExp and e.left.kind == fkVar and e.right.kind == fkLit) + +proc isPolynomial(n: Formula): bool = + isPolyTerm(n) or + (n.kind == fkAdd and isPolynomial(n.left) and isPolynomial(n.right)) + +let myFormula = Formula(kind: fkMul, + left: Formula(kind: fkLit, value: 2.0), + right: Formula(kind: fkExp, + left: Formula(kind: fkVar, name: "x"), + right: Formula(kind: fkLit, value: 5.0))) + +echo isPolyTerm(myFormula) + +proc pat2kind(pattern: string): FormulaKind = + case pattern + of "^": fkExp + of "*": fkMul + of "+": fkAdd + of "x": fkVar + of "c": fkLit + else: fkVar # no error reporting for reasons of simplicity + +import macros + +proc matchAgainst(n, pattern: PNimrodNode): PNimrodNode {.compileTime.} = + template `@`(current, field: expr): expr = + newDotExpr(current, newIdentNode(astToStr(field))) + + template `==@`(n, pattern: expr): expr = + newCall("==", n@kind, newIdentNode($pat2kind($pattern.ident))) + + case pattern.kind + of CallNodes: + result = newCall("and", + n ==@ pattern[0], + matchAgainst(n@left, pattern[1])) + if pattern.len == 3: + result = newCall("and", result.copy, + matchAgainst(n@right, pattern[2])) + of nnkIdent: + result = n ==@ pattern + of nnkPar: + result = matchAgainst(n, pattern[0]) + else: + error "invalid pattern" + +macro `=~` (n: Formula, pattern: expr): bool = + result = matchAgainst(n, pattern) + +proc isPolyTerm2(n: Formula): bool = n =~ c * x^c + +echo isPolyTerm2(myFormula), isPolyTerm2(Formula(kind: fkLit, value: 0.7)) diff --git a/tests/showoff/tformatopt.nim b/tests/showoff/tformatopt.nim new file mode 100644 index 000000000..f33ed6921 --- /dev/null +++ b/tests/showoff/tformatopt.nim @@ -0,0 +1,57 @@ +discard """ + output: '''(a: 3 +b: 4 +s: abc +)''' +""" + +import macros + +proc invalidFormatString() = + echo "invalidFormatString" + +template formatImpl(handleChar: expr) = + var i = 0 + while i < f.len: + if f[i] == '$': + case f[i+1] + of '1'..'9': + var j = 0 + i += 1 + while f[i] in {'0'..'9'}: + j = j * 10 + ord(f[i]) - ord('0') + i += 1 + result.add(a[j-1]) + else: + invalidFormatString() + else: + result.add(handleChar(f[i])) + i += 1 + +proc `%`*(f: string, a: openArray[string]): string = + template identity(x: expr): expr = x + result = "" + formatImpl(identity) + +macro optFormat{`%`(f, a)}(f: string{lit}, a: openArray[string]): expr = + result = newNimNode(nnkBracket) + let f = f.strVal + formatImpl(newLit) + result = nestList(!"&", result) + +template optAdd1{x = y; add(x, z)}(x, y, z: string) = + x = y & z + +proc `/&` [T: object](x: T): string = + result = "(" + for name, value in fieldPairs(x): + result.add("$1: $2\n" % [name, $value]) + result.add(")") + +type + MyObject = object + a, b: int + s: string + +let obj = MyObject(a: 3, b: 4, s: "abc") +echo(/&obj) diff --git a/tests/showoff/thello2.nim b/tests/showoff/thello2.nim new file mode 100644 index 000000000..d2e2f6227 --- /dev/null +++ b/tests/showoff/thello2.nim @@ -0,0 +1,11 @@ +discard """ + output: '''(a: 3, b: 4, s: abc)''' +""" + +type + MyObject = object + a, b: int + s: string + +let obj = MyObject(a: 3, b: 4, s: "abc") +echo obj diff --git a/tests/showoff/thtml1.nim b/tests/showoff/thtml1.nim new file mode 100644 index 000000000..cd95c7971 --- /dev/null +++ b/tests/showoff/thtml1.nim @@ -0,0 +1,11 @@ +discard """ + output: "<br>" +""" + +template htmlTag(tag: expr) {.immediate.} = + proc tag(): string = "<" & astToStr(tag) & ">" + +htmlTag(br) +htmlTag(html) + +echo br() diff --git a/tests/showoff/thtml2.nim b/tests/showoff/thtml2.nim new file mode 100644 index 000000000..8a451ebf1 --- /dev/null +++ b/tests/showoff/thtml2.nim @@ -0,0 +1,37 @@ +discard """ + output: "<html><head><title>now look at this</title></head><body><ul><li>Nimrod is quite capable</li></ul></body></html>" +""" + +import strutils + +template html(name: expr, matter: stmt) {.immediate.} = + proc name(): string = + result = "<html>" + matter + result.add("</html>") + +template nestedTag(tag: expr) {.immediate.} = + template tag(matter: stmt) {.immediate.} = + result.add("<" & astToStr(tag) & ">") + matter + result.add("</" & astToStr(tag) & ">") + +template simpleTag(tag: expr) {.immediate.} = + template tag(matter: expr) {.immediate.} = + result.add("<$1>$2</$1>" % [astToStr(tag), matter]) + +nestedTag body +nestedTag head +nestedTag ul +simpleTag title +simpleTag li + + +html mainPage: + head: + title "now look at this" + body: + ul: + li "Nimrod is quite capable" + +echo mainPage() diff --git a/tests/showoff/tonce.nim b/tests/showoff/tonce.nim new file mode 100644 index 000000000..6fc372e87 --- /dev/null +++ b/tests/showoff/tonce.nim @@ -0,0 +1,22 @@ +discard """ + output: '''first call of p +some call of p +new instantiation +some call of p''' +""" + +template once(body: stmt) = + var x {.global.} = false + if not x: + x = true + body + +proc p() = + once: + echo "first call of p" + echo "some call of p" + +p() +once: + echo "new instantiation" +p() diff --git a/tests/showoff/tquasiquote.nim b/tests/showoff/tquasiquote.nim new file mode 100644 index 000000000..df7fccc33 --- /dev/null +++ b/tests/showoff/tquasiquote.nim @@ -0,0 +1,14 @@ +discard """ + outputsub: '''tquasiquote.nim(14,8): Check failed: 1 > 2''' +""" + +import macros + +macro check(ex: expr): stmt = + var info = ex.lineInfo + var expString = ex.toStrLit + result = quote do: + if not `ex`: + echo `info`, ": Check failed: ", `expString` + +check 1 > 2 diff --git a/tests/specials.nim b/tests/specials.nim deleted file mode 100644 index 9ced66bbb..000000000 --- a/tests/specials.nim +++ /dev/null @@ -1,238 +0,0 @@ -# -# -# Nimrod Tester -# (c) Copyright 2013 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## Include for the tester that contains test suites that test special features -## of the compiler. - -# included from tester.nim -# ---------------- ROD file tests --------------------------------------------- - -const - rodfilesDir = "tests/rodfiles" - nimcacheDir = rodfilesDir / "nimcache" - -proc delNimCache() = - try: - removeDir(nimcacheDir) - except EOS: - echo "[Warning] could not delete: ", nimcacheDir - -proc runRodFiles(r: var TResults, options: string) = - template test(filename: expr): stmt = - runSingleTest(r, rodfilesDir / filename, options) - - delNimCache() - - # test basic recompilation scheme: - test "hallo" - test "hallo" - # test incremental type information: - test "hallo2" - delNimCache() - - # test type converters: - test "aconv" - test "bconv" - delNimCache() - - # test G, A, B example from the documentation; test init sections: - test "deada" - test "deada2" - delNimCache() - - # test method generation: - test "bmethods" - test "bmethods2" - delNimCache() - - # test generics: - test "tgeneric1" - test "tgeneric2" - delNimCache() - -proc compileRodFiles(r: var TResults, options: string) = - template test(filename: expr): stmt = - compileSingleTest(r, rodfilesDir / filename, options) - - delNimCache() - # test DLL interfacing: - test "gtkex1" - test "gtkex2" - delNimCache() - -# --------------------- DLL generation tests ---------------------------------- - -proc safeCopyFile(src, dest: string) = - try: - copyFile(src, dest) - except EOS: - echo "[Warning] could not copy: ", src, " to ", dest - -proc runBasicDLLTest(c, r: var TResults, options: string) = - compileSingleTest c, "lib/nimrtl.nim", options & " --app:lib -d:createNimRtl" - compileSingleTest c, "tests/dll/server.nim", - options & " --app:lib -d:useNimRtl" - - when defined(Windows): - # windows looks in the dir of the exe (yay!): - var nimrtlDll = DynlibFormat % "nimrtl" - safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll) - else: - # posix relies on crappy LD_LIBRARY_PATH (ugh!): - var libpath = getenv"LD_LIBRARY_PATH".string - if peg"\i '/nimrod' (!'/')* '/lib'" notin libpath: - echo "[Warning] insufficient LD_LIBRARY_PATH" - var serverDll = DynlibFormat % "server" - safeCopyFile("tests/dll" / serverDll, "lib" / serverDll) - - runSingleTest r, "tests/dll/client.nim", options & " -d:useNimRtl" - -proc runDLLTests(r: var TResults, options: string) = - # dummy compile result: - var c = initResults() - - runBasicDLLTest c, r, options - runBasicDLLTest c, r, options & " -d:release" - runBasicDLLTest c, r, options & " --gc:boehm" - runBasicDLLTest c, r, options & " -d:release --gc:boehm" - -proc compileDLLTests(r: var TResults, options: string) = - # dummy run result: - var c = initResults() - - runBasicDLLTest r, c, options - runBasicDLLTest r, c, options & " -d:release" - runBasicDLLTest r, c, options & " --gc:boehm" - runBasicDLLTest r, c, options & " -d:release --gc:boehm" - -# ------------------------------ GC tests ------------------------------------- - -proc runGcTests(r: var TResults, options: string) = - template test(filename: expr): stmt = - runSingleTest(r, "tests/gc" / filename, options) - runSingleTest(r, "tests/gc" / filename, options & " -d:release") - runSingleTest(r, "tests/gc" / filename, options & - " -d:release -d:useRealtimeGC") - runSingleTest(r, "tests/gc" / filename, options & - " --gc:markAndSweep") - runSingleTest(r, "tests/gc" / filename, options & - " -d:release --gc:markAndSweep") - - test "gcbench" - test "gcleak" - test "gcleak2" - test "gctest" - test "gcleak3" - test "weakrefs" - test "cycleleak" - test "closureleak" - -# ------------------------- threading tests ----------------------------------- - -proc runThreadTests(r: var TResults, options: string) = - template test(filename: expr): stmt = - runSingleTest(r, "tests/threads" / filename, options) - runSingleTest(r, "tests/threads" / filename, options & " -d:release") - runSingleTest(r, "tests/threads" / filename, options & " --tlsEmulation:on") - - test "tactors" - test "tactors2" - test "threadex" - # deactivated because output capturing still causes problems sometimes: - #test "trecursive_actor" - #test "threadring" - #test "tthreadanalysis" - #test "tthreadsort" - -proc rejectThreadTests(r: var TResults, options: string) = - rejectSingleTest(r, "tests/threads/tthreadanalysis2", options) - rejectSingleTest(r, "tests/threads/tthreadanalysis3", options) - rejectSingleTest(r, "tests/threads/tthreadheapviolation1", options) - -# ------------------------- IO tests ------------------------------------------ - -proc runIOTests(r: var TResults, options: string) = - # We need readall_echo to be compiled for this test to run. - # dummy compile result: - var c = initResults() - compileSingleTest(c, "tests/system/helpers/readall_echo", options) - runSingleTest(r, "tests/system/io", options) - -# ------------------------- debugger tests ------------------------------------ - -proc compileDebuggerTests(r: var TResults, options: string) = - compileSingleTest(r, "tools/nimgrep", options & - " --debugger:on") - -# ------------------------- JS tests ------------------------------------------ - -proc runJsTests(r: var TResults, options: string) = - template test(filename: expr): stmt = - runSingleTest(r, filename, options & " -d:nodejs", targetJS) - runSingleTest(r, filename, options & " -d:nodejs -d:release", targetJS) - - for t in os.walkFiles("tests/js/t*.nim"): - test(t) - for testfile in ["texceptions", "texcpt1", "texcsub", "tfinally", - "tfinally2", "tfinally3", "tactiontable", "tmultim1", - "tmultim3", "tmultim4"]: - test "tests/run/" & testfile & ".nim" - -# ------------------------- register special tests here ----------------------- -proc runSpecialTests(r: var TResults, options: string) = - runRodFiles(r, options) - #runDLLTests(r, options) - runGCTests(r, options) - runThreadTests(r, options & " --threads:on") - runIOTests(r, options) - - for t in os.walkFiles("tests/patterns/t*.nim"): - runSingleTest(r, t, options) - for t in ["lib/packages/docutils/highlite"]: - runSingleTest(r, t, options) - -proc rejectSpecialTests(r: var TResults, options: string) = - rejectThreadTests(r, options) - -proc findMainFile(dir: string): string = - # finds the file belonging to ".nimrod.cfg"; if there is no such file - # it returns the some ".nim" file if there is only one: - const cfgExt = ".nimrod.cfg" - result = "" - var nimFiles = 0 - for kind, file in os.walkDir(dir): - if kind == pcFile: - if file.endsWith(cfgExt): return file[.. -(cfgExt.len+1)] & ".nim" - elif file.endsWith(".nim"): - if result.len == 0: result = file - inc nimFiles - if nimFiles != 1: result.setlen(0) - -proc compileManyLoc(r: var TResults, options: string) = - for kind, dir in os.walkDir("tests/manyloc"): - if kind == pcDir: - let mainfile = findMainFile(dir) - if mainfile != ".nim": - compileSingleTest(r, mainfile, options) - -proc compileSpecialTests(r: var TResults, options: string) = - compileRodFiles(r, options) - - compileSingleTest(r, "compiler/c2nim/c2nim.nim", options) - compileSingleTest(r, "compiler/pas2nim/pas2nim.nim", options) - - compileDLLTests(r, options) - compileDebuggerTests(r, options) - - compileManyLoc(r, options) - - #var given = callCompiler("nimrod i", "nimrod i", options) - #r.addResult("nimrod i", given.msg, if given.err: reFailure else: reSuccess) - #if not given.err: inc(r.passed) - diff --git a/tests/stdlib/talgorithm.nim b/tests/stdlib/talgorithm.nim new file mode 100644 index 000000000..7ab652c82 --- /dev/null +++ b/tests/stdlib/talgorithm.nim @@ -0,0 +1,8 @@ +import algorithm + +doAssert product[int](newSeq[seq[int]]()) == newSeq[seq[int]](), "empty input" +doAssert product[int](@[newSeq[int](), @[], @[]]) == newSeq[seq[int]](), "bit more empty input" +doAssert product(@[@[1,2]]) == @[@[1,2]], "a simple case of one element" +doAssert product(@[@[1,2], @[3,4]]) == @[@[2,4],@[1,4],@[2,3],@[1,3]], "two elements" +doAssert product(@[@[1,2], @[3,4], @[5,6]]) == @[@[2,4,6],@[1,4,6],@[2,3,6],@[1,3,6], @[2,4,5],@[1,4,5],@[2,3,5],@[1,3,5]], "three elements" +doAssert product(@[@[1,2], @[]]) == newSeq[seq[int]](), "two elements, but one empty" diff --git a/tests/compile/tcputime.nim b/tests/stdlib/tcputime.nim index 2fc46ee64..2fc46ee64 100644 --- a/tests/compile/tcputime.nim +++ b/tests/stdlib/tcputime.nim diff --git a/tests/run/tcritbits.nim b/tests/stdlib/tcritbits.nim index fb447b80b..fb447b80b 100644 --- a/tests/run/tcritbits.nim +++ b/tests/stdlib/tcritbits.nim diff --git a/tests/compile/tdialogs.nim b/tests/stdlib/tdialogs.nim index d161a976d..d161a976d 100644 --- a/tests/compile/tdialogs.nim +++ b/tests/stdlib/tdialogs.nim diff --git a/tests/compile/techo.nim b/tests/stdlib/techo.nim index 0fa4b5fe0..0fa4b5fe0 100644 --- a/tests/compile/techo.nim +++ b/tests/stdlib/techo.nim diff --git a/tests/run/tformat.nim b/tests/stdlib/tformat.nim index 92c0c16f5..92c0c16f5 100644 --- a/tests/run/tformat.nim +++ b/tests/stdlib/tformat.nim diff --git a/tests/run/thashes.nim b/tests/stdlib/thashes.nim index c442b43fb..c442b43fb 100644 --- a/tests/run/thashes.nim +++ b/tests/stdlib/thashes.nim diff --git a/tests/compile/tio.nim b/tests/stdlib/tio.nim index 5ae119f77..5ae119f77 100644 --- a/tests/compile/tio.nim +++ b/tests/stdlib/tio.nim diff --git a/tests/compile/tircbot.nim b/tests/stdlib/tircbot.nim index d16c99b69..6008838ff 100644 --- a/tests/compile/tircbot.nim +++ b/tests/stdlib/tircbot.nim @@ -257,7 +257,7 @@ proc limitCommitMsg(m: string): string = proc handleWebMessage(state: PState, line: string) = echo("Got message from hub: " & line) var json = parseJson(line) - if json.existsKey("payload"): + if json.hasKey("payload"): for i in 0..min(4, json["payload"]["commits"].len-1): var commit = json["payload"]["commits"][i] # Create the message @@ -273,8 +273,8 @@ proc handleWebMessage(state: PState, line: string) = # Send message to #nimrod. state.ircClient.privmsg(joinChans[0], message) - elif json.existsKey("redisinfo"): - assert json["redisinfo"].existsKey("port") + elif json.hasKey("redisinfo"): + assert json["redisinfo"].hasKey("port") #let redisPort = json["redisinfo"]["port"].num state.dbConnected = true diff --git a/tests/run/tlists.nim b/tests/stdlib/tlists.nim index 7d5379945..7d5379945 100644 --- a/tests/run/tlists.nim +++ b/tests/stdlib/tlists.nim diff --git a/tests/compile/tmarshal.nim b/tests/stdlib/tmarshal.nim index 5471d347a..5471d347a 100644 --- a/tests/compile/tmarshal.nim +++ b/tests/stdlib/tmarshal.nim diff --git a/tests/run/tmath.nim b/tests/stdlib/tmath.nim index a86a3b84c..a86a3b84c 100644 --- a/tests/run/tmath.nim +++ b/tests/stdlib/tmath.nim diff --git a/tests/compile/tmath.nim b/tests/stdlib/tmath2.nim index 6a1dae54d..6a1dae54d 100644 --- a/tests/compile/tmath.nim +++ b/tests/stdlib/tmath2.nim diff --git a/tests/compile/tmongo.nim b/tests/stdlib/tmongo.nim index 1c4c0f4e6..1c4c0f4e6 100644 --- a/tests/compile/tmongo.nim +++ b/tests/stdlib/tmongo.nim diff --git a/tests/compile/tos.nim b/tests/stdlib/tos.nim index fa9993cc9..fa9993cc9 100644 --- a/tests/compile/tos.nim +++ b/tests/stdlib/tos.nim diff --git a/tests/compile/tparscfg.nim b/tests/stdlib/tparscfg.nim index 618ecadd6..618ecadd6 100644 --- a/tests/compile/tparscfg.nim +++ b/tests/stdlib/tparscfg.nim diff --git a/tests/compile/tparsefloat.nim b/tests/stdlib/tparsefloat.nim index 38ed2db6d..38ed2db6d 100644 --- a/tests/compile/tparsefloat.nim +++ b/tests/stdlib/tparsefloat.nim diff --git a/tests/compile/tparsopt.nim b/tests/stdlib/tparsopt.nim index 2b2da7e51..2b2da7e51 100644 --- a/tests/compile/tparsopt.nim +++ b/tests/stdlib/tparsopt.nim diff --git a/tests/run/tpegs.nim b/tests/stdlib/tpegs.nim index bdd8db0f8..bdd8db0f8 100644 --- a/tests/run/tpegs.nim +++ b/tests/stdlib/tpegs.nim diff --git a/tests/compile/tposix.nim b/tests/stdlib/tposix.nim index bf0b49586..bf0b49586 100644 --- a/tests/compile/tposix.nim +++ b/tests/stdlib/tposix.nim diff --git a/tests/compile/tquit.nim b/tests/stdlib/tquit.nim index d4dc1522d..d4dc1522d 100644 --- a/tests/compile/tquit.nim +++ b/tests/stdlib/tquit.nim diff --git a/tests/run/tregex.nim b/tests/stdlib/tregex.nim index bb4695f02..bb4695f02 100644 --- a/tests/run/tregex.nim +++ b/tests/stdlib/tregex.nim diff --git a/tests/run/treguse.nim b/tests/stdlib/treguse.nim index a610ad725..a610ad725 100644 --- a/tests/run/treguse.nim +++ b/tests/stdlib/treguse.nim diff --git a/tests/run/trepr.nim b/tests/stdlib/trepr.nim index 41c830621..41c830621 100644 --- a/tests/run/trepr.nim +++ b/tests/stdlib/trepr.nim diff --git a/tests/compile/trepr.nim b/tests/stdlib/trepr2.nim index b15081e48..b15081e48 100644 --- a/tests/compile/trepr.nim +++ b/tests/stdlib/trepr2.nim diff --git a/tests/compile/tsockets.nim b/tests/stdlib/tsockets.nim index 6078504f5..6078504f5 100644 --- a/tests/compile/tsockets.nim +++ b/tests/stdlib/tsockets.nim diff --git a/tests/compile/tsortcall.nim b/tests/stdlib/tsortcall.nim index efe1d0b8b..efe1d0b8b 100644 --- a/tests/compile/tsortcall.nim +++ b/tests/stdlib/tsortcall.nim diff --git a/tests/run/tsplit.nim b/tests/stdlib/tsplit.nim index 25bad33e2..25bad33e2 100644 --- a/tests/run/tsplit.nim +++ b/tests/stdlib/tsplit.nim diff --git a/tests/compile/tstreams.nim b/tests/stdlib/tstreams.nim index 640565a27..640565a27 100644 --- a/tests/compile/tstreams.nim +++ b/tests/stdlib/tstreams.nim diff --git a/tests/compile/tstrset.nim b/tests/stdlib/tstrset.nim index 9cdb5ed35..9cdb5ed35 100644 --- a/tests/compile/tstrset.nim +++ b/tests/stdlib/tstrset.nim diff --git a/tests/compile/tstrtabs.nim b/tests/stdlib/tstrtabs.nim index 251ec77ef..251ec77ef 100644 --- a/tests/compile/tstrtabs.nim +++ b/tests/stdlib/tstrtabs.nim diff --git a/tests/run/tstrutil.nim b/tests/stdlib/tstrutil.nim index 80c2f3870..80c2f3870 100644 --- a/tests/run/tstrutil.nim +++ b/tests/stdlib/tstrutil.nim diff --git a/tests/compile/ttime.nim b/tests/stdlib/ttime.nim index bad818816..bad818816 100644 --- a/tests/compile/ttime.nim +++ b/tests/stdlib/ttime.nim diff --git a/tests/run/tunidecode.nim b/tests/stdlib/tunidecode.nim index cb6589d60..cb6589d60 100644 --- a/tests/run/tunidecode.nim +++ b/tests/stdlib/tunidecode.nim diff --git a/tests/compile/twalker.nim b/tests/stdlib/twalker.nim index 89e6c2b9d..89e6c2b9d 100644 --- a/tests/compile/twalker.nim +++ b/tests/stdlib/twalker.nim diff --git a/tests/run/txmlgen.nim b/tests/stdlib/txmlgen.nim index 917427abc..917427abc 100644 --- a/tests/run/txmlgen.nim +++ b/tests/stdlib/txmlgen.nim diff --git a/tests/run/txmltree.nim b/tests/stdlib/txmltree.nim index 931871f15..931871f15 100644 --- a/tests/run/txmltree.nim +++ b/tests/stdlib/txmltree.nim diff --git a/tests/system/params.nim b/tests/system/params.nim new file mode 100644 index 000000000..1358212f2 --- /dev/null +++ b/tests/system/params.nim @@ -0,0 +1,18 @@ +import os +import osproc +import parseopt2 +import sequtils + +let argv = commandLineParams() + +if argv == @[]: + # this won't work with spaces + assert execShellCmd(getAppFilename() & " \"foo bar\" --aa:bar=a --a=c:d --ab -c --a[baz]:doo") == 0 +else: + let f = toSeq(getopt()) + echo f.repr + assert f[0].kind == cmdArgument and f[0].key == "foo bar" and f[0].val == "" + assert f[1].kind == cmdLongOption and f[1].key == "aa" and f[1].val == "bar=a" + assert f[2].kind == cmdLongOption and f[2].key == "a=c" and f[2].val == "d" + assert f[3].kind == cmdLongOption and f[3].key == "ab" and f[3].val == "" + assert f[4].kind == cmdShortOption and f[4].key == "c" and f[4].val == "" diff --git a/tests/compile/ttableconstr.nim b/tests/table/ttableconstr.nim index c627e68e8..c627e68e8 100644 --- a/tests/compile/ttableconstr.nim +++ b/tests/table/ttableconstr.nim diff --git a/tests/run/ttables.nim b/tests/table/ttables.nim index 681ff5424..681ff5424 100644 --- a/tests/run/ttables.nim +++ b/tests/table/ttables.nim diff --git a/tests/run/ttables2.nim b/tests/table/ttables2.nim index b88c8dfbf..b88c8dfbf 100644 --- a/tests/run/ttables2.nim +++ b/tests/table/ttables2.nim diff --git a/tests/template/mcan_access_hidden_field.nim b/tests/template/mcan_access_hidden_field.nim new file mode 100644 index 000000000..bf3592701 --- /dev/null +++ b/tests/template/mcan_access_hidden_field.nim @@ -0,0 +1,9 @@ + +type + Foo* = object + fooa, foob: int + +proc createFoo*(a, b: int): Foo = Foo(fooa: a, foob: b) + +template geta*(f: Foo): expr = f.fooa + diff --git a/tests/compile/mtempl5.nim b/tests/template/mtempl5.nim index 51e8461b8..51e8461b8 100644 --- a/tests/compile/mtempl5.nim +++ b/tests/template/mtempl5.nim diff --git a/tests/template/tcan_access_hidden_field.nim b/tests/template/tcan_access_hidden_field.nim new file mode 100644 index 000000000..a6f6490cc --- /dev/null +++ b/tests/template/tcan_access_hidden_field.nim @@ -0,0 +1,9 @@ +discard """ + output: 33 +""" + +import mcan_access_hidden_field + +var myfoo = createFoo(33, 44) + +echo myfoo.geta diff --git a/tests/compile/thygienictempl.nim b/tests/template/thygienictempl.nim index 3cdbac40e..3cdbac40e 100644 --- a/tests/compile/thygienictempl.nim +++ b/tests/template/thygienictempl.nim diff --git a/tests/compile/tmodulealias.nim b/tests/template/tmodulealias.nim index a7d155e51..a7d155e51 100644 --- a/tests/compile/tmodulealias.nim +++ b/tests/template/tmodulealias.nim diff --git a/tests/template/tprefer_immediate.nim b/tests/template/tprefer_immediate.nim new file mode 100644 index 000000000..578f447b0 --- /dev/null +++ b/tests/template/tprefer_immediate.nim @@ -0,0 +1,17 @@ +discard """ + output: '''immediate''' +""" + +# Test that immediate templates are preferred over non-immediate templates + +template foo(a, b: expr) = echo "foo expr" + +template foo(a, b: int) = echo "foo int" +template foo(a, b: float) = echo "foo float" +template foo(a, b: string) = echo "foo string" +template foo(a, b: expr) {.immediate.} = echo "immediate" +template foo(a, b: bool) = echo "foo bool" +template foo(a, b: char) = echo "foo char" + +foo(undeclaredIdentifier, undeclaredIdentifier2) + diff --git a/tests/run/tstempl.nim b/tests/template/tstempl.nim index 2b4a8baa0..2b4a8baa0 100644 --- a/tests/run/tstempl.nim +++ b/tests/template/tstempl.nim diff --git a/tests/compile/ttempl.nim b/tests/template/ttempl.nim index 2c4785325..2c4785325 100644 --- a/tests/compile/ttempl.nim +++ b/tests/template/ttempl.nim diff --git a/tests/reject/ttempl2.nim b/tests/template/ttempl2.nim index 142bbb8c7..142bbb8c7 100644 --- a/tests/reject/ttempl2.nim +++ b/tests/template/ttempl2.nim diff --git a/tests/compile/ttempl3.nim b/tests/template/ttempl3.nim index 361d11f6e..59be24624 100644 --- a/tests/compile/ttempl3.nim +++ b/tests/template/ttempl3.nim @@ -2,7 +2,7 @@ template withOpenFile(f: expr, filename: string, mode: TFileMode, actions: stmt): stmt {.immediate.} = block: - # test that 'f' is implicitely 'injecting': + # test that 'f' is implicitly 'injecting': var f: TFile if open(f, filename, mode): try: diff --git a/tests/compile/ttempl4.nim b/tests/template/ttempl4.nim index 26c82e471..26c82e471 100644 --- a/tests/compile/ttempl4.nim +++ b/tests/template/ttempl4.nim diff --git a/tests/compile/ttempl5.nim b/tests/template/ttempl5.nim index 85692e97b..85692e97b 100644 --- a/tests/compile/ttempl5.nim +++ b/tests/template/ttempl5.nim diff --git a/tests/compile/ttemplreturntype.nim b/tests/template/ttemplreturntype.nim index 642fa1b72..642fa1b72 100644 --- a/tests/compile/ttemplreturntype.nim +++ b/tests/template/ttemplreturntype.nim diff --git a/tests/run/utemplates.nim b/tests/template/utemplates.nim index 68fbb23a6..38ad4f515 100644 --- a/tests/run/utemplates.nim +++ b/tests/template/utemplates.nim @@ -18,7 +18,7 @@ test "previous definitions can be further overloaded or hidden in local scopes": check t("test") == "string" test "templates can be redefined multiple times": - template customAssert(cond: bool, msg: string): stmt = + template customAssert(cond: bool, msg: string): stmt {.immediate, dirty.} = if not cond: fail(msg) template assertion_failed(body: stmt) {.immediate.} = diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim new file mode 100644 index 000000000..5199bb9d6 --- /dev/null +++ b/tests/testament/backend.nim @@ -0,0 +1,121 @@ +# +# +# The Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# Look at license.txt for more info. +# All rights reserved. + +import strutils, db_sqlite, os, osproc + +var db: TDbConn + +proc createDb() = + db.exec(sql""" + create table if not exists Machine( + id integer primary key, + name varchar(100) not null, + os varchar(20) not null, + cpu varchar(20) not null + );""") + + db.exec(sql""" + create table if not exists [Commit]( + id integer primary key, + hash varchar(256) not null, + branch varchar(50) not null + );""") + + db.exec(sql""" + create table if not exists TestResult( + id integer primary key, + name varchar(100) not null, + category varchar(100) not null, + target varchar(20) not null, + action varchar(10) not null, + result varchar(30) not null, + [commit] int not null, + machine int not null, + expected varchar(10000) not null, + given varchar(10000) not null, + created timestamp not null default (DATETIME('now')), + + foreign key ([commit]) references [commit](id), + foreign key (machine) references machine(id) + );""") + + #db.exec(sql""" + # --create unique index if not exists TsstNameIx on TestResult(name); + # """, []) + +type + MachineId* = distinct int64 + CommitId = distinct int64 + +proc `$`*(id: MachineId): string {.borrow.} +proc `$`(id: CommitId): string {.borrow.} + +var + thisMachine: MachineId + thisCommit: CommitId + +proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip + +proc getMachine*(db: TDbConn): MachineId = + var name = "hostname"() + if name.len == 0: + name = when defined(posix): getenv"HOSTNAME".string + else: getenv"COMPUTERNAME".string + if name.len == 0: + quit "cannot determine the machine name" + + let id = db.getValue(sql"select id from Machine where name = ?", name) + if id.len > 0: + result = id.parseInt.MachineId + else: + result = db.insertId(sql"insert into Machine(name, os, cpu) values (?,?,?)", + name, system.hostOS, system.hostCPU).MachineId + +proc getCommit(db: TDbConn): CommitId = + const commLen = "commit ".len + let hash = "git log -n 1"()[commLen..commLen+10] + let branch = "git symbolic-ref --short HEAD"() + if hash.len == 0 or branch.len == 0: quit "cannot determine git HEAD" + + let id = db.getValue(sql"select id from [Commit] where hash = ? and branch = ?", + hash, branch) + if id.len > 0: + result = id.parseInt.CommitId + else: + result = db.insertId(sql"insert into [Commit](hash, branch) values (?, ?)", + hash, branch).CommitId + +proc writeTestResult*(name, category, target, + action, result, expected, given: string) = + let id = db.getValue(sql"""select id from TestResult + where name = ? and category = ? and target = ? and + machine = ? and [commit] = ?""", + name, category, target, + thisMachine, thisCommit) + if id.len > 0: + db.exec(sql"""update TestResult + set action = ?, result = ?, expected = ?, given = ? + where id = ?""", action, result, expected, given, id) + else: + db.exec(sql"""insert into TestResult(name, category, target, + action, + result, expected, given, + [commit], machine) + values (?,?,?,?,?,?,?,?,?) """, name, category, target, + action, + result, expected, given, + thisCommit, thisMachine) + +proc open*() = + db = open(connection="testament.db", user="testament", password="", + database="testament") + createDb() + thisMachine = getMachine(db) + thisCommit = getCommit(db) + +proc close*() = close(db) diff --git a/tests/caasdriver.nim b/tests/testament/caasdriver.nim index 28f0bae9b..28f0bae9b 100644 --- a/tests/caasdriver.nim +++ b/tests/testament/caasdriver.nim diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim new file mode 100644 index 000000000..442dd1212 --- /dev/null +++ b/tests/testament/categories.nim @@ -0,0 +1,269 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## Include for the tester that contains test suites that test special features +## of the compiler. + +# included from tester.nim +# ---------------- ROD file tests --------------------------------------------- + +const + rodfilesDir = "tests/rodfiles" + nimcacheDir = rodfilesDir / "nimcache" + +proc delNimCache() = + try: + removeDir(nimcacheDir) + except EOS: + echo "[Warning] could not delete: ", nimcacheDir + +proc runRodFiles(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest(rodfilesDir / filename, options, cat, actionRun) + + delNimCache() + + # test basic recompilation scheme: + test "hallo" + test "hallo" + # test incremental type information: + test "hallo2" + delNimCache() + + # test type converters: + test "aconv" + test "bconv" + delNimCache() + + # test G, A, B example from the documentation; test init sections: + test "deada" + test "deada2" + delNimCache() + + # test method generation: + test "bmethods" + test "bmethods2" + delNimCache() + + # test generics: + test "tgeneric1" + test "tgeneric2" + delNimCache() + +proc compileRodFiles(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest(rodfilesDir / filename, options, cat) + + delNimCache() + # test DLL interfacing: + test "gtkex1" + test "gtkex2" + delNimCache() + +# --------------------- DLL generation tests ---------------------------------- + +proc safeCopyFile(src, dest: string) = + try: + copyFile(src, dest) + except EOS: + echo "[Warning] could not copy: ", src, " to ", dest + +proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) = + testSpec c, makeTest("lib/nimrtl.nim", + options & " --app:lib -d:createNimRtl", cat) + testSpec c, makeTest("tests/dll/server.nim", + options & " --app:lib -d:useNimRtl", cat) + + when defined(Windows): + # windows looks in the dir of the exe (yay!): + var nimrtlDll = DynlibFormat % "nimrtl" + safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll) + else: + # posix relies on crappy LD_LIBRARY_PATH (ugh!): + var libpath = getenv"LD_LIBRARY_PATH".string + if peg"\i '/nimrod' (!'/')* '/lib'" notin libpath: + echo "[Warning] insufficient LD_LIBRARY_PATH" + var serverDll = DynlibFormat % "server" + safeCopyFile("tests/dll" / serverDll, "lib" / serverDll) + + testSpec r, makeTest("tests/dll/client.nim", options & " -d:useNimRtl", + cat, actionRun) + +proc dllTests(r: var TResults, cat: Category, options: string) = + # dummy compile result: + var c = initResults() + + runBasicDLLTest c, r, cat, options + runBasicDLLTest c, r, cat, options & " -d:release" + runBasicDLLTest c, r, cat, options & " --gc:boehm" + runBasicDLLTest c, r, cat, options & " -d:release --gc:boehm" + +# ------------------------------ GC tests ------------------------------------- + +proc gcTests(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest("tests/gc" / filename, options, cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " -d:release", cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " -d:release -d:useRealtimeGC", cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " --gc:markAndSweep", cat, actionRun) + testSpec r, makeTest("tests/gc" / filename, options & + " -d:release --gc:markAndSweep", cat, actionRun) + + test "gcbench" + test "gcleak" + test "gcleak2" + test "gctest" + test "gcleak3" + test "gcleak4" + test "gcleak5" + test "weakrefs" + test "cycleleak" + test "closureleak" + test "refarrayleak" + test "stackrefleak" + + +# ------------------------- threading tests ----------------------------------- + +proc threadTests(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest("tests/threads" / filename, options, cat, actionRun) + testSpec r, makeTest("tests/threads" / filename, options & + " -d:release", cat, actionRun) + testSpec r, makeTest("tests/threads" / filename, options & + " --tlsEmulation:on", cat, actionRun) + + test "tactors" + test "tactors2" + test "threadex" + # deactivated because output capturing still causes problems sometimes: + #test "trecursive_actor" + #test "threadring" + #test "tthreadanalysis" + #test "tthreadsort" + test "tthreadanalysis2" + test "tthreadanalysis3" + test "tthreadheapviolation1" + +# ------------------------- IO tests ------------------------------------------ + +proc ioTests(r: var TResults, cat: Category, options: string) = + # We need readall_echo to be compiled for this test to run. + # dummy compile result: + var c = initResults() + testSpec c, makeTest("tests/system/helpers/readall_echo", options, cat) + testSpec r, makeTest("tests/system/io", options, cat) + +# ------------------------- debugger tests ------------------------------------ + +proc debuggerTests(r: var TResults, cat: Category, options: string) = + testNoSpec r, makeTest("tools/nimgrep", options & " --debugger:on", cat) + +# ------------------------- JS tests ------------------------------------------ + +proc jsTests(r: var TResults, cat: Category, options: string) = + template test(filename: expr): stmt = + testSpec r, makeTest(filename, options & " -d:nodejs", cat, + actionRun, targetJS) + testSpec r, makeTest(filename, options & " -d:nodejs -d:release", cat, + actionRun, targetJS) + + for t in os.walkFiles("tests/js/t*.nim"): + test(t) + for testfile in ["texceptions", "texcpt1", "texcsub", "tfinally", + "tfinally2", "tfinally3", "tactiontable", "tmultim1", + "tmultim3", "tmultim4"]: + test "tests/run/" & testfile & ".nim" + +# ------------------------- manyloc ------------------------------------------- +#proc runSpecialTests(r: var TResults, options: string) = +# for t in ["lib/packages/docutils/highlite"]: +# testSpec(r, t, options) + +proc findMainFile(dir: string): string = + # finds the file belonging to ".nimrod.cfg"; if there is no such file + # it returns the some ".nim" file if there is only one: + const cfgExt = ".nimrod.cfg" + result = "" + var nimFiles = 0 + for kind, file in os.walkDir(dir): + if kind == pcFile: + if file.endsWith(cfgExt): return file[.. -(cfgExt.len+1)] & ".nim" + elif file.endsWith(".nim"): + if result.len == 0: result = file + inc nimFiles + if nimFiles != 1: result.setlen(0) + +proc manyLoc(r: var TResults, cat: Category, options: string) = + for kind, dir in os.walkDir("tests/manyloc"): + if kind == pcDir: + let mainfile = findMainFile(dir) + if mainfile != ".nim": + testNoSpec r, makeTest(mainfile, options, cat) + +proc compileExample(r: var TResults, pattern, options: string, cat: Category) = + for test in os.walkFiles(pattern): + testNoSpec r, makeTest(test, options, cat) + +proc testStdlib(r: var TResults, pattern, options: string, cat: Category) = + for test in os.walkFiles(pattern): + let contents = readFile(test).string + if contents.contains("when isMainModule"): + testSpec r, makeTest(test, options, cat, actionRun) + else: + testNoSpec r, makeTest(test, options, cat, actionCompile) + +# ---------------------------------------------------------------------------- + +const AdditionalCategories = ["debugger", "tools", "examples", "stdlib"] + +proc `&.?`(a, b: string): string = + # candidate for the stdlib? + result = if b.startswith(a): b else: a & b + +proc `&?.`(a, b: string): string = + # candidate for the stdlib? + result = if a.endswith(b): a else: a & b + +proc processCategory(r: var TResults, cat: Category, options: string) = + case cat.string.normalize + of "rodfiles": + compileRodFiles(r, cat, options) + runRodFiles(r, cat, options) + of "js": + # XXX JS doesn't need to be special anymore + jsTests(r, cat, options) + of "dll": + dllTests(r, cat, options) + of "gc": + gcTests(r, cat, options) + of "debugger": + debuggerTests(r, cat, options) + of "tools": + testSpec r, makeTest("compiler/c2nim/c2nim.nim", options, cat) + testSpec r, makeTest("compiler/pas2nim/pas2nim.nim", options, cat) + of "manyloc": + manyLoc r, cat, options + of "threads": + threadTests r, cat, options & " --threads:on" + of "io": + ioTests r, cat, options + of "stdlib": + testStdlib(r, "lib/pure/*.nim", options, cat) + testStdlib(r, "lib/packages/docutils/highlite", options, cat) + of "examples": + compileExample(r, "examples/*.nim", options, cat) + compileExample(r, "examples/gtk/*.nim", options, cat) + compileExample(r, "examples/talk/*.nim", options, cat) + else: + for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"): + testSpec r, makeTest(name, options, cat) diff --git a/tests/css/boilerplate.css b/tests/testament/css/boilerplate.css index b209b5aa1..b209b5aa1 100644 --- a/tests/css/boilerplate.css +++ b/tests/testament/css/boilerplate.css diff --git a/tests/css/style.css b/tests/testament/css/style.css index 43a8add68..43a8add68 100644 --- a/tests/css/style.css +++ b/tests/testament/css/style.css diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim new file mode 100644 index 000000000..eb674a171 --- /dev/null +++ b/tests/testament/htmlgen.nim @@ -0,0 +1,180 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## HTML generator for the tester. + +import db_sqlite, cgi, backend, strutils + +const + TableHeader = """<table border="1"> + <tr><td>Test</td><td>Category</td><td>Target</td> + <td>Action</td> + <td>Expected</td> + <td>Given</td> + <td>Success</td></tr>""" + TableFooter = "</table>" + HtmlBegin = """<html> + <head> + <title>Test results</title> + <style type="text/css"> + <!--""" & slurp("css/boilerplate.css") & "\n" & + slurp("css/style.css") & + """ +ul#tabs { list-style-type: none; margin: 30px 0 0 0; padding: 0 0 0.3em 0; } +ul#tabs li { display: inline; } +ul#tabs li a { color: #42454a; background-color: #dedbde; + border: 1px solid #c9c3ba; border-bottom: none; + padding: 0.3em; text-decoration: none; } +ul#tabs li a:hover { background-color: #f1f0ee; } +ul#tabs li a.selected { color: #000; background-color: #f1f0ee; + font-weight: bold; padding: 0.7em 0.3em 0.38em 0.3em; } +div.tabContent { border: 1px solid #c9c3ba; + padding: 0.5em; background-color: #f1f0ee; } +div.tabContent.hide { display: none; } + --> + </style> + <script> + + var tabLinks = new Array(); + var contentDivs = new Array(); + + function init() { + // Grab the tab links and content divs from the page + var tabListItems = document.getElementById('tabs').childNodes; + for (var i = 0; i < tabListItems.length; i++) { + if (tabListItems[i].nodeName == "LI") { + var tabLink = getFirstChildWithTagName(tabListItems[i], 'A'); + var id = getHash(tabLink.getAttribute('href')); + tabLinks[id] = tabLink; + contentDivs[id] = document.getElementById(id); + } + } + // Assign onclick events to the tab links, and + // highlight the first tab + var i = 0; + for (var id in tabLinks) { + tabLinks[id].onclick = showTab; + tabLinks[id].onfocus = function() { this.blur() }; + if (i == 0) tabLinks[id].className = 'selected'; + i++; + } + // Hide all content divs except the first + var i = 0; + for (var id in contentDivs) { + if (i != 0) contentDivs[id].className = 'tabContent hide'; + i++; + } + } + + function showTab() { + var selectedId = getHash(this.getAttribute('href')); + + // Highlight the selected tab, and dim all others. + // Also show the selected content div, and hide all others. + for (var id in contentDivs) { + if (id == selectedId) { + tabLinks[id].className = 'selected'; + contentDivs[id].className = 'tabContent'; + } else { + tabLinks[id].className = ''; + contentDivs[id].className = 'tabContent hide'; + } + } + // Stop the browser following the link + return false; + } + + function getFirstChildWithTagName(element, tagName) { + for (var i = 0; i < element.childNodes.length; i++) { + if (element.childNodes[i].nodeName == tagName) return element.childNodes[i]; + } + } + function getHash(url) { + var hashPos = url.lastIndexOf('#'); + return url.substring(hashPos + 1); + } + </script> + + </head> + <body onload="init()">""" + + HtmlEnd = "</body></html>" + +proc td(s: string): string = + result = "<td>" & s.substr(0, 200).XMLEncode & "</td>" + +proc getCommit(db: TDbConn, c: int): string = + var commit = c + for thisCommit in db.rows(sql"select id from [Commit] order by id desc"): + if commit == 0: result = thisCommit[0] + inc commit + if result.isNil: + quit "cannot determine commit " & $c + +proc generateHtml*(filename: string, commit: int) = + const selRow = """select name, category, target, action, + expected, given, result + from TestResult + where [commit] = ? and machine = ? + order by category""" + var db = open(connection="testament.db", user="testament", password="", + database="testament") + # search for proper commit: + let lastCommit = db.getCommit(commit) + + var outfile = open(filename, fmWrite) + outfile.write(HtmlBegin) + + let commit = db.getValue(sql"select hash from [Commit] where id = ?", + lastCommit) + let branch = db.getValue(sql"select branch from [Commit] where id = ?", + lastCommit) + outfile.write("<p><b>$# $#</b></p>" % [branch, commit]) + + # generate navigation: + outfile.write("""<ul id="tabs">""") + for m in db.rows(sql"select id, name, os, cpu from Machine order by id"): + outfile.writeln """<li><a href="#$#">$#: $#, $#</a></li>""" % m + outfile.write("</ul>") + + for currentMachine in db.rows(sql"select id from Machine order by id"): + let m = currentMachine[0] + outfile.write("""<div class="tabContent" id="$#">""" % m) + + outfile.write(TableHeader) + for row in db.rows(sql(selRow), lastCommit, m): + outfile.write("<tr>") + for x in row: + outfile.write(x.td) + outfile.write("</tr>") + + outfile.write(TableFooter) + outfile.write("</div>") + outfile.write(HtmlEnd) + close(db) + close(outfile) + +proc generateJson*(filename: string, commit: int) = + const selRow = """select count(*), + sum(result = 'reSuccess'), + sum(result = 'reIgnored') + from TestResult + where [commit] = ? and machine = ? + order by category""" + var db = open(connection="testament.db", user="testament", password="", + database="testament") + let lastCommit = db.getCommit(commit) + + var outfile = open(filename, fmWrite) + + let data = db.getRow(sql(selRow), lastCommit, $backend.getMachine(db)) + + outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#}""" % data) + close(db) + close(outfile) diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim new file mode 100644 index 000000000..e97015946 --- /dev/null +++ b/tests/testament/specs.nim @@ -0,0 +1,130 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +import parseutils, strutils, os, osproc, streams, parsecfg + +const + cmdTemplate* = r"nimrod cc --hints:on $# $#" + +type + TTestAction* = enum + actionCompile = "compile" + actionRun = "run" + actionReject = "reject" + TResultEnum* = enum + reNimrodcCrash, # nimrod compiler seems to have crashed + reMsgsDiffer, # error messages differ + reFilesDiffer, # expected and given filenames differ + reLinesDiffer, # expected and given line numbers differ + reOutputsDiffer, + reExitcodesDiffer, + reInvalidPeg, + reCodegenFailure, + reCodeNotFound, + reExeNotFound, + reIgnored, # test is ignored + reSuccess # test was successful + TTarget* = enum + targetC = "C" + targetCpp = "C++" + targetObjC = "ObjC" + targetJS = "JS" + + TSpec* = object + action*: TTestAction + file*, cmd*: string + outp*: string + line*, exitCode*: int + msg*: string + ccodeCheck*: string + err*: TResultEnum + substr*: bool + targets*: set[TTarget] + +const + targetToExt*: array[TTarget, string] = ["c", "cpp", "m", "js"] + +when not defined(parseCfgBool): + # candidate for the stdlib: + proc parseCfgBool(s: string): bool = + case normalize(s) + of "y", "yes", "true", "1", "on": result = true + of "n", "no", "false", "0", "off": result = false + else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s) + +proc extractSpec(filename: string): string = + const tripleQuote = "\"\"\"" + var x = readFile(filename).string + var a = x.find(tripleQuote) + var b = x.find(tripleQuote, a+3) + # look for """ only in the first section + if a >= 0 and b > a and a < 40: + result = x.substr(a+3, b-1).replace("'''", tripleQuote) + else: + #echo "warning: file does not contain spec: " & filename + result = "" + +when not defined(nimhygiene): + {.pragma: inject.} + +template parseSpecAux(fillResult: stmt) {.immediate.} = + var ss = newStringStream(extractSpec(filename)) + var p {.inject.}: TCfgParser + open(p, ss, filename, 1) + while true: + var e {.inject.} = next(p) + case e.kind + of cfgEof: break + of cfgSectionStart, cfgOption, cfgError: + echo ignoreMsg(p, e) + of cfgKeyValuePair: + fillResult + close(p) + +proc parseSpec*(filename: string): TSpec = + result.file = filename + result.msg = "" + result.outp = "" + result.ccodeCheck = "" + result.cmd = cmdTemplate + parseSpecAux: + case normalize(e.key) + of "action": + case e.value.normalize + of "compile": result.action = actionCompile + of "run": result.action = actionRun + of "reject": result.action = actionReject + else: echo ignoreMsg(p, e) + of "file": result.file = e.value + of "line": discard parseInt(e.value, result.line) + of "output": + result.action = actionRun + result.outp = e.value + of "outputsub": + result.action = actionRun + result.outp = e.value + result.substr = true + of "exitcode": + discard parseInt(e.value, result.exitCode) + of "errormsg", "msg": + result.msg = e.value + result.action = actionReject + of "disabled": + if parseCfgBool(e.value): result.err = reIgnored + of "cmd": result.cmd = e.value + of "ccodecheck": result.ccodeCheck = e.value + of "target", "targets": + for v in e.value.normalize.split: + case v + of "c": result.targets.incl(targetC) + of "cpp", "c++": result.targets.incl(targetCpp) + of "objc": result.targets.incl(targetObjC) + of "js": result.targets.incl(targetJS) + else: echo ignoreMsg(p, e) + else: echo ignoreMsg(p, e) diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim new file mode 100644 index 000000000..fac97cf2a --- /dev/null +++ b/tests/testament/tester.nim @@ -0,0 +1,260 @@ +# +# +# Nimrod Tester +# (c) Copyright 2014 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## This program verifies Nimrod against the testcases. + +import + parseutils, strutils, pegs, os, osproc, streams, parsecfg, json, + marshal, backend, parseopt, specs, htmlgen, browsers + +const + resultsFile = "testresults.html" + jsonFile = "testresults.json" + Usage = """Usage: + tester [options] command [arguments] + +Command: + all run all tests + c|category <category> run all the tests of a certain category + html [commit] generate $1 from the database; uses the latest + commit or a specific one (use -1 for the commit + before latest etc) +Arguments: + arguments are passed to the compiler +Options: + --print also print results to the console +""" % resultsFile + +type + Category = distinct string + TResults = object + total, passed, skipped: int + data: string + + TTest = object + name: string + cat: Category + options: string + target: TTarget + action: TTestAction + +# ---------------------------------------------------------------------------- + +let + pegLineError = + peg"{[^(]*} '(' {\d+} ', ' \d+ ') ' ('Error'/'Warning') ':' \s* {.*}" + pegOtherError = peg"'Error:' \s* {.*}" + pegSuccess = peg"'Hint: operation successful'.*" + pegOfInterest = pegLineError / pegOtherError + +proc callCompiler(cmdTemplate, filename, options: string): TSpec = + let c = parseCmdLine(cmdTemplate % [options, filename]) + var p = startProcess(command=c[0], args=c[1.. -1], + options={poStdErrToStdOut, poUseShell}) + let outp = p.outputStream + var suc = "" + var err = "" + var x = newStringOfCap(120) + while outp.readLine(x.TaintedString) or running(p): + if x =~ pegOfInterest: + # `err` should contain the last error/warning message + err = x + elif x =~ pegSuccess: + suc = x + close(p) + result.msg = "" + result.file = "" + result.outp = "" + result.line = -1 + if err =~ pegLineError: + result.file = extractFilename(matches[0]) + result.line = parseInt(matches[1]) + result.msg = matches[2] + elif err =~ pegOtherError: + result.msg = matches[0] + elif suc =~ pegSuccess: + result.err = reSuccess + +proc initResults: TResults = + result.total = 0 + result.passed = 0 + result.skipped = 0 + result.data = "" + +proc readResults(filename: string): TResults = + result = marshal.to[TResults](readFile(filename).string) + +proc writeResults(filename: string, r: TResults) = + writeFile(filename, $$r) + +proc `$`(x: TResults): string = + result = ("Tests passed: $1 / $3 <br />\n" & + "Tests skipped: $2 / $3 <br />\n") % + [$x.passed, $x.skipped, $x.total] + +proc addResult(r: var TResults, test: TTest, + expected, given: string, success: TResultEnum) = + let name = test.name.extractFilename & test.options + backend.writeTestResult(name = name, + category = test.cat.string, + target = $test.target, + action = $test.action, + result = $success, + expected = expected, + given = given) + r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success) + +proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = + if strip(expected.msg) notin strip(given.msg): + r.addResult(test, expected.msg, given.msg, reMsgsDiffer) + elif extractFilename(expected.file) != extractFilename(given.file) and + "internal error:" notin expected.msg: + r.addResult(test, expected.file, given.file, reFilesDiffer) + elif expected.line != given.line and expected.line != 0: + r.addResult(test, $expected.line, $given.line, reLinesDiffer) + else: + r.addResult(test, expected.msg, given.msg, reSuccess) + inc(r.passed) + +proc generatedFile(path, name: string, target: TTarget): string = + let ext = targetToExt[target] + result = path / "nimcache" / + (if target == targetJS: path.splitPath.tail & "_" else: "") & + name.changeFileExt(ext) + +proc codegenCheck(test: TTest, check: string, given: var TSpec) = + if check.len > 0: + try: + let (path, name, ext2) = test.name.splitFile + let genFile = generatedFile(path, name, test.target) + echo genFile + let contents = readFile(genFile).string + if contents.find(check.peg) < 0: + given.err = reCodegenFailure + except EInvalidValue: + given.err = reInvalidPeg + except EIO: + given.err = reCodeNotFound + +proc testSpec(r: var TResults, test: TTest) = + # major entry point for a single test + let tname = test.name.addFileExt(".nim") + inc(r.total) + echo extractFilename(tname) + var expected = parseSpec(tname) + if expected.err == reIgnored: + r.addResult(test, "", "", reIgnored) + inc(r.skipped) + else: + case expected.action + of actionCompile: + var given = callCompiler(expected.cmd, test.name, test.options) + if given.err == reSuccess: + codegenCheck(test, expected.ccodeCheck, given) + r.addResult(test, "", given.msg, given.err) + if given.err == reSuccess: inc(r.passed) + of actionRun: + var given = callCompiler(expected.cmd, test.name, test.options) + if given.err != reSuccess: + r.addResult(test, "", given.msg, given.err) + else: + var exeFile: string + if test.target == targetJS: + let (dir, file, ext) = splitFile(tname) + exeFile = dir / "nimcache" / file & ".js" + else: + exeFile = changeFileExt(tname, ExeExt) + + if existsFile(exeFile): + var (buf, exitCode) = execCmdEx( + (if test.target==targetJS: "node " else: "") & exeFile) + if exitCode != expected.ExitCode: + r.addResult(test, "exitcode: " & $expected.exitCode, + "exitcode: " & $exitCode, reExitCodesDiffer) + else: + if strip(buf.string) != strip(expected.outp): + if not (expected.substr and expected.outp in buf.string): + given.err = reOutputsDiffer + if given.err == reSuccess: + codeGenCheck(test, expected.ccodeCheck, given) + if given.err == reSuccess: inc(r.passed) + r.addResult(test, expected.outp, buf.string, given.err) + else: + r.addResult(test, expected.outp, "executable not found", reExeNotFound) + of actionReject: + var given = callCompiler(expected.cmd, test.name, test.options) + cmpMsgs(r, expected, given, test) + +proc testNoSpec(r: var TResults, test: TTest) = + # does not extract the spec because the file is not supposed to have any + let tname = test.name.addFileExt(".nim") + inc(r.total) + echo extractFilename(tname) + let given = callCompiler(cmdTemplate, test.name, test.options) + r.addResult(test, "", given.msg, given.err) + if given.err == reSuccess: inc(r.passed) + +proc makeTest(test, options: string, cat: Category, action = actionCompile, + target = targetC): TTest = + # start with 'actionCompile', will be overwritten in the spec: + result = TTest(cat: cat, name: test, options: options, + target: target, action: action) + +include categories + +# proc runCaasTests(r: var TResults) = +# for test, output, status, mode in caasTestsRunner(): +# r.addResult(test, "", output & "-> " & $mode, +# if status: reSuccess else: reOutputsDiffer) + +proc main() = + os.putenv "NIMTEST_NO_COLOR", "1" + os.putenv "NIMTEST_OUTPUT_LVL", "PRINT_FAILURES" + + backend.open() + var optPrintResults = false + var p = initOptParser() + p.next() + if p.kind == cmdLongoption: + case p.key.string.normalize + of "print", "verbose": optPrintResults = true + else: quit usage + p.next() + if p.kind != cmdArgument: quit usage + var action = p.key.string.normalize + p.next() + var r = initResults() + case action + of "all": + for kind, dir in walkDir("tests"): + if kind == pcDir and dir notin ["testament", "testdata", "nimcache"]: + processCategory(r, Category(dir), p.cmdLineRest.string) + for a in AdditionalCategories: + processCategory(r, Category(a), p.cmdLineRest.string) + of "c", "cat", "category": + var cat = Category(p.key) + p.next + processCategory(r, cat, p.cmdLineRest.string) + of "html": + var commit = 0 + discard parseInt(p.cmdLineRest.string, commit) + generateHtml(resultsFile, commit) + generateJson(jsonFile, commit) + else: + quit usage + + if optPrintResults: + if action == "html": openDefaultBrowser(resultsFile) + else: echo r, r.data + backend.close() + +if paramCount() == 0: + quit usage +main() + diff --git a/tests/tester.nim b/tests/tester.nim deleted file mode 100644 index fe21fc9ee..000000000 --- a/tests/tester.nim +++ /dev/null @@ -1,457 +0,0 @@ -# -# -# Nimrod Tester -# (c) Copyright 2013 Andreas Rumpf -# -# See the file "copying.txt", included in this -# distribution, for details about the copyright. -# - -## This program verifies Nimrod against the testcases. - -import - parseutils, strutils, pegs, os, osproc, streams, parsecfg, browsers, json, - marshal, cgi, parseopt, caasdriver - -const - cmdTemplate = r"nimrod cc --hints:on $# $#" - resultsFile = "testresults.html" - jsonFile = "testresults.json" - Usage = "usage: tester [--print] " & - "reject|compile|run|" & - "merge|special|rodfiles| [nimrod options]\n" & - " or: tester test|comp|rej singleTest" - -type - TTestAction = enum - actionCompile, actionRun, actionReject - TResultEnum = enum - reNimrodcCrash, # nimrod compiler seems to have crashed - reMsgsDiffer, # error messages differ - reFilesDiffer, # expected and given filenames differ - reLinesDiffer, # expected and given line numbers differ - reOutputsDiffer, - reExitcodesDiffer, - reInvalidPeg, - reCodegenFailure, - reCodeNotFound, - reExeNotFound, - reIgnored, # test is ignored - reSuccess # test was successful - - TTarget = enum - targetC, targetCpp, targetObjC, targetJS - - TSpec = object - action: TTestAction - file, cmd: string - outp: string - line, exitCode: int - msg: string - ccodeCheck: string - err: TResultEnum - substr: bool - TResults = object - total, passed, skipped: int - data: string - -# ----------------------- Spec parser ---------------------------------------- - -when not defined(parseCfgBool): - # candidate for the stdlib: - proc parseCfgBool(s: string): bool = - case normalize(s) - of "y", "yes", "true", "1", "on": result = true - of "n", "no", "false", "0", "off": result = false - else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s) - -proc extractSpec(filename: string): string = - const tripleQuote = "\"\"\"" - var x = readFile(filename).string - var a = x.find(tripleQuote) - var b = x.find(tripleQuote, a+3) - # look for """ only in the first section - if a >= 0 and b > a and a < 40: - result = x.substr(a+3, b-1).replace("'''", tripleQuote) - else: - #echo "warning: file does not contain spec: " & filename - result = "" - -when not defined(nimhygiene): - {.pragma: inject.} - -template parseSpecAux(fillResult: stmt) {.immediate.} = - var ss = newStringStream(extractSpec(filename)) - var p {.inject.}: TCfgParser - open(p, ss, filename, 1) - while true: - var e {.inject.} = next(p) - case e.kind - of cfgEof: break - of cfgSectionStart, cfgOption, cfgError: - echo ignoreMsg(p, e) - of cfgKeyValuePair: - fillResult - close(p) - -proc parseSpec(filename: string): TSpec = - result.file = filename - result.msg = "" - result.outp = "" - result.ccodeCheck = "" - result.cmd = cmdTemplate - parseSpecAux: - case normalize(e.key) - of "action": - case e.value.normalize - of "compile": result.action = actionCompile - of "run": result.action = actionRun - of "reject": result.action = actionReject - else: echo ignoreMsg(p, e) - of "file": result.file = e.value - of "line": discard parseInt(e.value, result.line) - of "output": result.outp = e.value - of "outputsub": - result.outp = e.value - result.substr = true - of "exitcode": - discard parseInt(e.value, result.exitCode) - of "errormsg", "msg": result.msg = e.value - of "disabled": - if parseCfgBool(e.value): result.err = reIgnored - of "cmd": result.cmd = e.value - of "ccodecheck": result.ccodeCheck = e.value - else: echo ignoreMsg(p, e) - -# ---------------------------------------------------------------------------- - -let - pegLineError = - peg"{[^(]*} '(' {\d+} ', ' \d+ ') ' ('Error'/'Warning') ':' \s* {.*}" - pegOtherError = peg"'Error:' \s* {.*}" - pegSuccess = peg"'Hint: operation successful'.*" - pegOfInterest = pegLineError / pegOtherError - -proc callCompiler(cmdTemplate, filename, options: string): TSpec = - let c = parseCmdLine(cmdTemplate % [options, filename]) - var p = startProcess(command=c[0], args=c[1.. -1], - options={poStdErrToStdOut, poUseShell}) - let outp = p.outputStream - var suc = "" - var err = "" - var x = newStringOfCap(120) - while outp.readLine(x.TaintedString) or running(p): - if x =~ pegOfInterest: - # `err` should contain the last error/warning message - err = x - elif x =~ pegSuccess: - suc = x - close(p) - result.msg = "" - result.file = "" - result.outp = "" - result.line = -1 - if err =~ pegLineError: - result.file = extractFilename(matches[0]) - result.line = parseInt(matches[1]) - result.msg = matches[2] - elif err =~ pegOtherError: - result.msg = matches[0] - elif suc =~ pegSuccess: - result.err = reSuccess - -proc initResults: TResults = - result.total = 0 - result.passed = 0 - result.skipped = 0 - result.data = "" - -proc readResults(filename: string): TResults = - result = marshal.to[TResults](readFile(filename).string) - -proc writeResults(filename: string, r: TResults) = - writeFile(filename, $$r) - -proc `$`(x: TResults): string = - result = ("Tests passed: $1 / $3 <br />\n" & - "Tests skipped: $2 / $3 <br />\n") % - [$x.passed, $x.skipped, $x.total] - -proc colorResult(r: TResultEnum): string = - case r - of reIgnored: result = "<span style=\"color:fuchsia\">ignored</span>" - of reSuccess: result = "<span style=\"color:green\">yes</span>" - else: result = "<span style=\"color:red\">no</span>" - -const - TableHeader4 = "<table border=\"1\"><tr><td>Test</td><td>Expected</td>" & - "<td>Given</td><td>Success</td></tr>\n" - TableHeader3 = "<table border=\"1\"><tr><td>Test</td>" & - "<td>Given</td><td>Success</td></tr>\n" - TableFooter = "</table>\n" - HtmlBegin = """<html> - <head> - <title>Test results</title> - <style type="text/css"> - <!--""" & slurp("css/boilerplate.css") & "\n" & - slurp("css/style.css") & - """--> - </style> - - </head> - <body>""" - - HtmlEnd = "</body></html>" - -proc td(s: string): string = - result = s.substr(0, 200).XMLEncode - -proc addResult(r: var TResults, test, expected, given: string, - success: TResultEnum) = - r.data.addf("<tr><td>$#</td><td>$#</td><td>$#</td><td>$#</td></tr>\n", [ - XMLEncode(test), td(expected), td(given), success.colorResult]) - -proc addResult(r: var TResults, test, given: string, - success: TResultEnum) = - r.data.addf("<tr><td>$#</td><td>$#</td><td>$#</td></tr>\n", [ - XMLEncode(test), td(given), success.colorResult]) - -proc listResults(reject, compile, run: TResults) = - var s = HtmlBegin - s.add("<h1>Tests to Reject</h1>\n") - s.add($reject) - s.add(TableHeader4 & reject.data & TableFooter) - s.add("<br /><br /><br /><h1>Tests to Compile</h1>\n") - s.add($compile) - s.add(TableHeader3 & compile.data & TableFooter) - s.add("<br /><br /><br /><h1>Tests to Run</h1>\n") - s.add($run) - s.add(TableHeader4 & run.data & TableFooter) - s.add(HtmlEnd) - writeFile(resultsFile, s) - -proc cmpMsgs(r: var TResults, expected, given: TSpec, test: string) = - if strip(expected.msg) notin strip(given.msg): - r.addResult(test, expected.msg, given.msg, reMsgsDiffer) - elif extractFilename(expected.file) != extractFilename(given.file) and - "internal error:" notin expected.msg: - r.addResult(test, expected.file, given.file, reFilesDiffer) - elif expected.line != given.line and expected.line != 0: - r.addResult(test, $expected.line, $given.line, reLinesDiffer) - else: - r.addResult(test, expected.msg, given.msg, reSuccess) - inc(r.passed) - -proc rejectSingleTest(r: var TResults, test, options: string) = - let test = test.addFileExt(".nim") - var t = extractFilename(test) - inc(r.total) - echo t - var expected = parseSpec(test) - if expected.err == reIgnored: - r.addResult(t, "", "", reIgnored) - inc(r.skipped) - else: - var given = callCompiler(expected.cmd, test, options) - cmpMsgs(r, expected, given, t) - -proc reject(r: var TResults, dir, options: string) = - ## handle all the tests that the compiler should reject - for test in os.walkFiles(dir / "t*.nim"): rejectSingleTest(r, test, options) - -proc codegenCheck(test, check, ext: string, given: var TSpec) = - if check.len > 0: - try: - let (path, name, ext2) = test.splitFile - echo path / "nimcache" / name.changeFileExt(ext) - let contents = readFile(path / "nimcache" / name.changeFileExt(ext)).string - if contents.find(check.peg) < 0: - given.err = reCodegenFailure - except EInvalidValue: - given.err = reInvalidPeg - except EIO: - given.err = reCodeNotFound - -proc codegenChecks(test: string, expected: TSpec, given: var TSpec) = - codegenCheck(test, expected.ccodeCheck, ".c", given) - -proc compile(r: var TResults, pattern, options: string) = - for test in os.walkFiles(pattern): - let t = extractFilename(test) - echo t - inc(r.total) - let expected = parseSpec(test) - if expected.err == reIgnored: - r.addResult(t, "", reIgnored) - inc(r.skipped) - else: - var given = callCompiler(expected.cmd, test, options) - if given.err == reSuccess: - codegenChecks(test, expected, given) - r.addResult(t, given.msg, given.err) - if given.err == reSuccess: inc(r.passed) - -proc compileSingleTest(r: var TResults, test, options: string) = - # does not extract the spec because the file is not supposed to have any - let test = test.addFileExt(".nim") - let t = extractFilename(test) - inc(r.total) - echo t - let given = callCompiler(cmdTemplate, test, options) - r.addResult(t, given.msg, given.err) - if given.err == reSuccess: inc(r.passed) - -proc runSingleTest(r: var TResults, test, options: string, target: TTarget) = - var test = test.addFileExt(".nim") - var t = extractFilename(test) - echo t - inc(r.total) - var expected = parseSpec(test) - if expected.err == reIgnored: - r.addResult(t, "", "", reIgnored) - inc(r.skipped) - else: - var given = callCompiler(expected.cmd, test, options) - if given.err != reSuccess: - r.addResult(t, "", given.msg, given.err) - else: - var exeFile: string - if target == targetC: - exeFile = changeFileExt(test, ExeExt) - else: - let (dir, file, ext) = splitFile(test) - exeFile = dir / "nimcache" / file & ".js" - - if existsFile(exeFile): - var (buf, exitCode) = execCmdEx( - (if target==targetJS: "node " else: "") & exeFile) - if exitCode != expected.ExitCode: - r.addResult(t, "exitcode: " & $expected.ExitCode, - "exitcode: " & $exitCode, reExitCodesDiffer) - else: - if strip(buf.string) != strip(expected.outp): - if not (expected.substr and expected.outp in buf.string): - given.err = reOutputsDiffer - if given.err == reSuccess: - codeGenChecks(test, expected, given) - if given.err == reSuccess: inc(r.passed) - r.addResult(t, expected.outp, buf.string, given.err) - else: - r.addResult(t, expected.outp, "executable not found", reExeNotFound) - -proc runSingleTest(r: var TResults, test, options: string) = - runSingleTest(r, test, options, targetC) - -proc run(r: var TResults, dir, options: string) = - for test in os.walkFiles(dir / "t*.nim"): runSingleTest(r, test, options) - -include specials - -proc compileExample(r: var TResults, pattern, options: string) = - for test in os.walkFiles(pattern): compileSingleTest(r, test, options) - -proc toJson(res: TResults): PJsonNode = - result = newJObject() - result["total"] = newJInt(res.total) - result["passed"] = newJInt(res.passed) - result["skipped"] = newJInt(res.skipped) - -proc outputJSON(reject, compile, run: TResults) = - var doc = newJObject() - doc["reject"] = toJson(reject) - doc["compile"] = toJson(compile) - doc["run"] = toJson(run) - var s = pretty(doc) - writeFile(jsonFile, s) - -proc runCaasTests(r: var TResults) = - for test, output, status, mode in caasTestsRunner(): - r.addResult(test, "", output & "-> " & $mode, - if status: reSuccess else: reOutputsDiffer) - -proc main() = - os.putenv "NIMTEST_NO_COLOR", "1" - os.putenv "NIMTEST_OUTPUT_LVL", "PRINT_FAILURES" - - const - compileJson = "compile.json" - runJson = "run.json" - rejectJson = "reject.json" - - var optPrintResults = false - var p = initOptParser() - p.next() - if p.kind == cmdLongoption: - case p.key.string - of "print": optPrintResults = true - else: quit usage - p.next() - if p.kind != cmdArgument: quit usage - var action = p.key.string.normalize - p.next() - var r = initResults() - case action - of "reject": - reject(r, "tests/reject", p.cmdLineRest.string) - rejectSpecialTests(r, p.cmdLineRest.string) - writeResults(rejectJson, r) - of "compile": - compile(r, "tests/compile/t*.nim", p.cmdLineRest.string) - compile(r, "tests/ccg/t*.nim", p.cmdLineRest.string) - compile(r, "tests/js.nim", p.cmdLineRest.string) - compileExample(r, "lib/pure/*.nim", p.cmdLineRest.string) - compileExample(r, "examples/*.nim", p.cmdLineRest.string) - compileExample(r, "examples/gtk/*.nim", p.cmdLineRest.string) - compileExample(r, "examples/talk/*.nim", p.cmdLineRest.string) - compileSpecialTests(r, p.cmdLineRest.string) - writeResults(compileJson, r) - of "run": - run(r, "tests/run", p.cmdLineRest.string) - runSpecialTests(r, p.cmdLineRest.string) - writeResults(runJson, r) - of "special": - runSpecialTests(r, p.cmdLineRest.string) - runCaasTests(r) - writeResults(runJson, r) - of "rodfiles": - runRodFiles(r, p.cmdLineRest.string) - writeResults(runJson, r) - of "js": - if existsFile(runJSon): - r = readResults(runJson) - runJsTests(r, p.cmdLineRest.string) - writeResults(runJson, r) - of "merge": - var rejectRes = readResults(rejectJson) - var compileRes = readResults(compileJson) - var runRes = readResults(runJson) - listResults(rejectRes, compileRes, runRes) - outputJSON(rejectRes, compileRes, runRes) - of "dll": - runDLLTests r, p.cmdLineRest.string - of "gc": - runGCTests(r, p.cmdLineRest.string) - of "test": - if p.kind != cmdArgument: quit usage - var testFile = p.key.string - p.next() - runSingleTest(r, testFile, p.cmdLineRest.string) - of "comp", "rej": - if p.kind != cmdArgument: quit usage - var testFile = p.key.string - p.next() - if peg"'/reject/'" in testFile or action == "rej": - rejectSingleTest(r, testFile, p.cmdLineRest.string) - elif peg"'/compile/'" in testFile or action == "comp": - compileSingleTest(r, testFile, p.cmdLineRest.string) - else: - runSingleTest(r, testFile, p.cmdLineRest.string) - else: - quit usage - - if optPrintResults: echo r, r.data - -if paramCount() == 0: - quit usage -main() - diff --git a/tests/reject/tdisallowif.nim b/tests/trmacros/tdisallowif.nim index 10f54288a..18dfd1c82 100644 --- a/tests/reject/tdisallowif.nim +++ b/tests/trmacros/tdisallowif.nim @@ -1,6 +1,7 @@ discard """ line: 24 errormsg: "usage of 'disallowIf' is a user-defined error" + disabled: true """ template optZero{x+x}(x: int): int = x*3 @@ -25,4 +26,4 @@ if s[0] != "hi": echo "do it" echo "more branches" else: - nil + discard diff --git a/tests/run/tanontuples.nim b/tests/tuples/tanontuples.nim index a2babf038..a2babf038 100644 --- a/tests/run/tanontuples.nim +++ b/tests/tuples/tanontuples.nim diff --git a/tests/reject/twrongtupleaccess.nim b/tests/tuples/twrongtupleaccess.nim index 1a9ae64a2..1a9ae64a2 100644 --- a/tests/reject/twrongtupleaccess.nim +++ b/tests/tuples/twrongtupleaccess.nim diff --git a/tests/compile/tcommontype.nim b/tests/typerel/tcommontype.nim index 8215ebd5e..8215ebd5e 100644 --- a/tests/compile/tcommontype.nim +++ b/tests/typerel/tcommontype.nim diff --git a/tests/reject/tno_int_in_bool_context.nim b/tests/typerel/tno_int_in_bool_context.nim index 755a02c0c..755a02c0c 100644 --- a/tests/reject/tno_int_in_bool_context.nim +++ b/tests/typerel/tno_int_in_bool_context.nim diff --git a/tests/compile/tnoargopenarray.nim b/tests/typerel/tnoargopenarray.nim index 872ec86d2..872ec86d2 100644 --- a/tests/compile/tnoargopenarray.nim +++ b/tests/typerel/tnoargopenarray.nim diff --git a/tests/reject/tnocontains.nim b/tests/typerel/tnocontains.nim index 4f4951478..4f4951478 100644 --- a/tests/reject/tnocontains.nim +++ b/tests/typerel/tnocontains.nim diff --git a/tests/compile/trectuple.nim b/tests/typerel/trectuple.nim index 7c43ec5ba..7c43ec5ba 100644 --- a/tests/compile/trectuple.nim +++ b/tests/typerel/trectuple.nim diff --git a/tests/compile/trectuples.nim b/tests/typerel/trectuples.nim index c59cfe880..c59cfe880 100644 --- a/tests/compile/trectuples.nim +++ b/tests/typerel/trectuples.nim diff --git a/tests/reject/trectype.nim b/tests/typerel/trectype.nim index 7bb12a3b6..7bb12a3b6 100644 --- a/tests/reject/trectype.nim +++ b/tests/typerel/trectype.nim diff --git a/tests/reject/trefs.nim b/tests/typerel/trefs.nim index b157ca2b5..b157ca2b5 100644 --- a/tests/reject/trefs.nim +++ b/tests/typerel/trefs.nim diff --git a/tests/run/trettypeinference.nim b/tests/typerel/trettypeinference.nim index 41b4aa5ef..41b4aa5ef 100644 --- a/tests/run/trettypeinference.nim +++ b/tests/typerel/trettypeinference.nim diff --git a/tests/compile/tsecondarrayproperty.nim b/tests/typerel/tsecondarrayproperty.nim index 07fdac1c4..07fdac1c4 100644 --- a/tests/compile/tsecondarrayproperty.nim +++ b/tests/typerel/tsecondarrayproperty.nim diff --git a/tests/compile/ttuple1.nim b/tests/typerel/ttuple1.nim index 5787cc309..5787cc309 100644 --- a/tests/compile/ttuple1.nim +++ b/tests/typerel/ttuple1.nim diff --git a/tests/reject/ttypelessemptyset.nim b/tests/typerel/ttypelessemptyset.nim index 3e171387b..3e171387b 100644 --- a/tests/reject/ttypelessemptyset.nim +++ b/tests/typerel/ttypelessemptyset.nim diff --git a/tests/reject/ttypenoval.nim b/tests/typerel/ttypenoval.nim index 214b35e29..214b35e29 100644 --- a/tests/reject/ttypenoval.nim +++ b/tests/typerel/ttypenoval.nim diff --git a/tests/reject/ttypenovalue.nim b/tests/typerel/ttypenovalue.nim index b86baf8b4..b86baf8b4 100644 --- a/tests/reject/ttypenovalue.nim +++ b/tests/typerel/ttypenovalue.nim diff --git a/tests/compile/tvoid.nim b/tests/typerel/tvoid.nim index bb569e7f8..bb569e7f8 100644 --- a/tests/compile/tvoid.nim +++ b/tests/typerel/tvoid.nim diff --git a/tests/compile/typalias.nim b/tests/typerel/typalias.nim index ba9f38ed9..ba9f38ed9 100644 --- a/tests/compile/typalias.nim +++ b/tests/typerel/typalias.nim diff --git a/tests/reject/typredef.nim b/tests/typerel/typredef.nim index b2182d116..0b6aed875 100644 --- a/tests/reject/typredef.nim +++ b/tests/typerel/typredef.nim @@ -3,8 +3,6 @@ discard """ line: 7 errormsg: "illegal recursion in type \'Uint8\'" """ -type - Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8' - - +type + Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8' diff --git a/tests/run/tfinalobj.nim b/tests/types/tfinalobj.nim index 1cd7fae28..1cd7fae28 100644 --- a/tests/run/tfinalobj.nim +++ b/tests/types/tfinalobj.nim diff --git a/tests/compile/tforwty.nim b/tests/types/tforwty.nim index 0f1d3697f..0f1d3697f 100644 --- a/tests/compile/tforwty.nim +++ b/tests/types/tforwty.nim diff --git a/tests/compile/tforwty2.nim b/tests/types/tforwty2.nim index 5d15e112a..5d15e112a 100644 --- a/tests/compile/tforwty2.nim +++ b/tests/types/tforwty2.nim diff --git a/tests/reject/tillegaltyperecursion.nim b/tests/types/tillegaltyperecursion.nim index 711f458bf..711f458bf 100644 --- a/tests/reject/tillegaltyperecursion.nim +++ b/tests/types/tillegaltyperecursion.nim diff --git a/tests/reject/tillrec.nim b/tests/types/tillrec.nim index 3f8fe60fc..1d1ec0622 100644 --- a/tests/reject/tillrec.nim +++ b/tests/types/tillrec.nim @@ -3,15 +3,14 @@ discard """ line: 13 errormsg: "illegal recursion in type \'TIllegal\'" """ -# test illegal recursive types - -type - TLegal {.final.} = object - x: int - kids: seq[TLegal] - - TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal' - y: Int - x: array[0..3, TIllegal] +# test illegal recursive types +type + TLegal {.final.} = object + x: int + kids: seq[TLegal] + + TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal' + y: Int + x: array[0..3, TIllegal] diff --git a/tests/compile/tinheritref.nim b/tests/types/tinheritref.nim index e5de6a4be..e5de6a4be 100644 --- a/tests/compile/tinheritref.nim +++ b/tests/types/tinheritref.nim diff --git a/tests/compile/tisop.nim b/tests/types/tisop.nim index 509cc4e95..509cc4e95 100644 --- a/tests/compile/tisop.nim +++ b/tests/types/tisop.nim diff --git a/tests/run/tisopr.nim b/tests/types/tisopr.nim index 6d3c51749..6d3c51749 100644 --- a/tests/run/tisopr.nim +++ b/tests/types/tisopr.nim diff --git a/tests/run/tusingstatement.nim b/tests/usingstmt/tusingstatement.nim index b9d466377..a33aced4c 100644 --- a/tests/run/tusingstatement.nim +++ b/tests/usingstmt/tusingstatement.nim @@ -8,25 +8,11 @@ import # This macro mimics the using statement from C# # -# XXX: -# It doen't match the C# version exactly yet. -# In particular, it's not recursive, which prevents it from dealing -# with exceptions thrown from the variable initializers when multiple. -# variables are used. +# It's kept only as a test for the macro system +# Nimrod's destructors offer a mechanism for automatic +# disposal of resources. # -# Also, since nimrod relies less on exceptions in general, a more -# idiomatic definition could be: -# var x = init() -# if opened(x): -# try: -# body -# finally: -# close(x) -# -# `opened` here could be an overloaded proc which any type can define. -# A common practice can be returing an Optional[Resource] obj for which -# `opened` is defined to `optional.hasValue` -macro using(e: expr): stmt {.immediate.} = +macro autoClose(e: expr): stmt {.immediate.} = let e = callsite() if e.len != 3: error "Using statement: unexpected number of arguments. Got " & @@ -97,7 +83,7 @@ proc close(r: var TResource) = proc use(r: var TResource) = write(stdout, "Using " & r.field & ".") -using(r = openResource("test")): +autoClose(r = openResource("test")): use r diff --git a/tests/reject/tvarres1.nim b/tests/varres/tvarres1.nim index de4a505d3..de4a505d3 100644 --- a/tests/reject/tvarres1.nim +++ b/tests/varres/tvarres1.nim diff --git a/tests/reject/tvarres2.nim b/tests/varres/tvarres2.nim index 165e4a36e..165e4a36e 100644 --- a/tests/reject/tvarres2.nim +++ b/tests/varres/tvarres2.nim diff --git a/tests/run/tvarres1.nim b/tests/varres/tvarres3.nim index a48c961df..a48c961df 100644 --- a/tests/run/tvarres1.nim +++ b/tests/varres/tvarres3.nim diff --git a/tests/run/tvarres2.nim b/tests/varres/tvarres4.nim index 119560e7b..119560e7b 100644 --- a/tests/run/tvarres2.nim +++ b/tests/varres/tvarres4.nim diff --git a/tests/run/tvartup.nim b/tests/varres/tvartup.nim index f885cdf37..f885cdf37 100644 --- a/tests/run/tvartup.nim +++ b/tests/varres/tvartup.nim diff --git a/tests/run/tlet.nim b/tests/varstmt/tlet.nim index ba355c5d8..ba355c5d8 100644 --- a/tests/run/tlet.nim +++ b/tests/varstmt/tlet.nim diff --git a/tests/run/tvardecl.nim b/tests/varstmt/tvardecl.nim index 5cc6f4960..5cc6f4960 100644 --- a/tests/run/tvardecl.nim +++ b/tests/varstmt/tvardecl.nim diff --git a/tests/compile/tconsteval.nim b/tests/vm/tconsteval.nim index 16fd8f4b8..16fd8f4b8 100644 --- a/tests/compile/tconsteval.nim +++ b/tests/vm/tconsteval.nim diff --git a/tests/compile/teval1.nim b/tests/vm/teval1.nim index a02f26592..a02f26592 100644 --- a/tests/compile/teval1.nim +++ b/tests/vm/teval1.nim diff --git a/tests/compile/tslurp.nim b/tests/vm/tslurp.nim index f9456ce6b..f9456ce6b 100644 --- a/tests/compile/tslurp.nim +++ b/tests/vm/tslurp.nim diff --git a/tests/reject/twrongconst.nim b/tests/vm/twrongconst.nim index 16fe3bff6..e5b8a15bd 100644 --- a/tests/reject/twrongconst.nim +++ b/tests/vm/twrongconst.nim @@ -1,6 +1,6 @@ discard """ - output: "Error: constant expression expected" - line: 7 + output: "Error: cannot evaluate at compile time: x" + line: 10 """ var x: array[100, char] diff --git a/tinyc/tccgen.c b/tinyc/tccgen.c index 942c503c1..3135e7b37 100644 --- a/tinyc/tccgen.c +++ b/tinyc/tccgen.c @@ -1931,7 +1931,7 @@ static void gen_assign_cast(CType *dt) goto type_ok; } type1 = pointed_type(dt); - /* a function is implicitely a function pointer */ + /* a function is implicitly a function pointer */ if (sbt == VT_FUNC) { if ((type1->t & VT_BTYPE) != VT_VOID && !is_compatible_types(pointed_type(dt), st)) diff --git a/todo.txt b/todo.txt index da7585500..738e9b3fa 100644 --- a/todo.txt +++ b/todo.txt @@ -1,47 +1,56 @@ version 0.9.4 ============= -- new VM: - - implement the glue to replace evals.nim - - implement missing magics - - implement overflow checking - - implement the FFI - -- make 'bind' default for templates and introduce 'mixin' -- special rule for ``[]=`` -- ``=`` should be overloadable; requires specialization for ``=``; general - lift mechanism in the compiler is already implemented for 'fields' -- built-in 'getImpl' -- optimize 'genericReset'; 'newException' leads to code bloat -- stack-less GC +- fix GC issues +- fix macros\tstringinterp.nim +- test and fix showoff +- test C source code generation +- fix closures +- test and fix exception handling +- implement 'union' and 'bits' pragmas Bugs ==== +- new VM: + - implement overflow checking +- bug: 'type T = ref T' not recognized as illegal recursion +- bug: type conversions concerning proc types are weird - compilation of niminst takes way too long. looks like a regression -- simple closure iterator doesn't work - docgen: sometimes effects are listed twice - 'result' is not properly cleaned for NRVO --> use uninit checking instead -- sneaking with qualifiedLookup() is really broken! -- aporia.nim(968, 5) Error: ambiguous identifier: 'DELETE' -- - use a qualifier - blocks can "export" an identifier but the CCG generates {} for them ... - osproc execProcesses can deadlock if all processes fail (as experienced in c++ mode) -- result = result shr 8 for the "system()" wrapper version 0.9.x ============= -- macros as type pragmas +- ensure (ref T)(a, b) works as a type conversion and type constructor +- optimize 'genericReset'; 'newException' leads to code bloat +- stack-less GC +- implement strongSpaces:on +- make '--implicitStatic:on' the default - implicit deref for parameter matching + +- special rule for ``[]=`` +- ``=`` should be overloadable; requires specialization for ``=``; general + lift mechanism in the compiler is already implemented for 'fields' +- built-in 'getImpl' + +- change comment handling in the AST; that's lots of work as c2nim and pas2nim + make use of the fast every node can have a comment! + + +version 0.9.X +============= + +- macros as type pragmas - lazy overloading resolution: - * get rid of ``expr[typ]``, use perhaps ``static[typ]`` instead * special case ``tyStmt`` - FFI: - * test libffi on windows * test: times.format with the FFI - document NimMain and check whether it works for threading - 'quote' without 'do' doesn't work: parser/grammar issue; could be supported @@ -50,12 +59,9 @@ version 0.9.x version 0.9.X ============= -- test&finish first class iterators: - * nested iterators - implement the missing features wrt inheritance - better support for macros that rewrite procs - macros need access to types and symbols (partially implemented) -- perhaps: change comment handling in the AST - enforce 'simpleExpr' more often --> doesn't work; tkProc is part of primary! - the typeDesc/expr unification is weird and only necessary because of @@ -86,7 +92,6 @@ Concurrency/Effect system version 0.9.XX ============== -- document nimdoc properly finally - make 'clamp' a magic for the range stuff - better type syntax for functions and tuples: tuple(int, int); (int,int)->int diff --git a/tools/cmerge.nim b/tools/cmerge.nim index ca221014f..003b0e555 100644 --- a/tools/cmerge.nim +++ b/tools/cmerge.nim @@ -34,7 +34,7 @@ proc main(dir, outfile: string) = else: quit("Cannot open for writing: " & outfile) -if ParamCount() != 2: +if paramCount() != 2: quit "Usage: cmerge directory outfile" else: - main(ParamStr(1), addFileExt(ParamStr(2), "c")) + main(paramStr(1), addFileExt(paramStr(2), "c")) diff --git a/tools/detect/detect.nim b/tools/detect/detect.nim index cf61c2823..87b682ad5 100644 --- a/tools/detect/detect.nim +++ b/tools/detect/detect.nim @@ -10,7 +10,7 @@ import os, strutils const - cc = "gcc -o $1 $1.c" + cc = "gcc -o $# $#.c" cfile = """ /* Generated by detect.nim */ @@ -37,6 +37,7 @@ var tl = "" proc myExec(cmd: string): bool = + echo "CMD ", cmd return execShellCmd(cmd) == 0 proc header(s: string): bool = @@ -46,7 +47,7 @@ proc header(s: string): bool = f.write("#include $1\n" % s) f.write("int main() { return 0; }\n") close(f) - result = myExec(cc % testh) + result = myExec(cc % [testh.addFileExt(ExeExt), testh]) removeFile(addFileExt(testh, "c")) if result: addf(hd, "#include $1\n", s) @@ -60,13 +61,16 @@ proc main = if open(f, addFileExt(gen, "c"), fmWrite): f.write(cfile % [hd, tl, system.hostOS, system.hostCPU]) close(f) - if not myExec(cc % gen): quit(1) - if not myExec("./" & gen): quit(1) - removeFile(addFileExt(gen, "c")) + if not myExec(cc % [gen.addFileExt(ExeExt), gen]): quit(1) + when defined(windows): + if not myExec(gen.addFileExt(ExeExt)): quit(1) + else: + if not myExec("./" & gen): quit(1) + #removeFile(addFileExt(gen, "c")) echo("Success") proc v(name: string, typ: TTypeKind=cint) = - var n = if name[0] == '_': copy(name, 1) else: name + var n = if name[0] == '_': substr(name, 1) else: name var t = $typ case typ of pointer: @@ -369,7 +373,7 @@ if header("<pthread.h>"): #v("PTHREAD_MUTEX_INITIALIZER") v("PTHREAD_MUTEX_NORMAL") v("PTHREAD_MUTEX_RECURSIVE") #{.importc, header: "<pthread.h>".}: cint - v("PTHREAD_ONCE_INIT") #{.importc, header: "<pthread.h>".}: cint + #v("PTHREAD_ONCE_INIT") #{.importc, header: "<pthread.h>".}: cint v("PTHREAD_PRIO_INHERIT") #{.importc, header: "<pthread.h>".}: cint v("PTHREAD_PRIO_NONE") #{.importc, header: "<pthread.h>".}: cint v("PTHREAD_PRIO_PROTECT") #{.importc, header: "<pthread.h>".}: cint @@ -820,5 +824,8 @@ if header("<spawn.h>"): v("POSIX_SPAWN_SETSIGDEF") v("POSIX_SPAWN_SETSIGMASK") -main() +if header("<stdio.h>"): + v "_IOFBF" + v "_IONBF" +main() diff --git a/tools/detect/linux_amd64_consts.nim b/tools/detect/linux_amd64_consts.nim new file mode 100644 index 000000000..eb85da045 --- /dev/null +++ b/tools/detect/linux_amd64_consts.nim @@ -0,0 +1,631 @@ +# Generated by detect.nim +const + AIO_ALLDONE* = cint(2) + AIO_CANCELED* = cint(0) + AIO_NOTCANCELED* = cint(1) + LIO_NOP* = cint(2) + LIO_NOWAIT* = cint(1) + LIO_READ* = cint(0) + LIO_WAIT* = cint(0) + LIO_WRITE* = cint(1) + RTLD_LAZY* = cint(1) + RTLD_NOW* = cint(2) + RTLD_GLOBAL* = cint(256) + RTLD_LOCAL* = cint(0) + E2BIG* = cint(7) + EACCES* = cint(13) + EADDRINUSE* = cint(98) + EADDRNOTAVAIL* = cint(99) + EAFNOSUPPORT* = cint(97) + EAGAIN* = cint(11) + EALREADY* = cint(114) + EBADF* = cint(9) + EBADMSG* = cint(74) + EBUSY* = cint(16) + ECANCELED* = cint(125) + ECHILD* = cint(10) + ECONNABORTED* = cint(103) + ECONNREFUSED* = cint(111) + ECONNRESET* = cint(104) + EDEADLK* = cint(35) + EDESTADDRREQ* = cint(89) + EDOM* = cint(33) + EDQUOT* = cint(122) + EEXIST* = cint(17) + EFAULT* = cint(14) + EFBIG* = cint(27) + EHOSTUNREACH* = cint(113) + EIDRM* = cint(43) + EILSEQ* = cint(84) + EINPROGRESS* = cint(115) + EINTR* = cint(4) + EINVAL* = cint(22) + EIO* = cint(5) + EISCONN* = cint(106) + EISDIR* = cint(21) + ELOOP* = cint(40) + EMFILE* = cint(24) + EMLINK* = cint(31) + EMSGSIZE* = cint(90) + EMULTIHOP* = cint(72) + ENAMETOOLONG* = cint(36) + ENETDOWN* = cint(100) + ENETRESET* = cint(102) + ENETUNREACH* = cint(101) + ENFILE* = cint(23) + ENOBUFS* = cint(105) + ENODATA* = cint(61) + ENODEV* = cint(19) + ENOENT* = cint(2) + ENOEXEC* = cint(8) + ENOLCK* = cint(37) + ENOLINK* = cint(67) + ENOMEM* = cint(12) + ENOMSG* = cint(42) + ENOPROTOOPT* = cint(92) + ENOSPC* = cint(28) + ENOSR* = cint(63) + ENOSTR* = cint(60) + ENOSYS* = cint(38) + ENOTCONN* = cint(107) + ENOTDIR* = cint(20) + ENOTEMPTY* = cint(39) + ENOTSOCK* = cint(88) + ENOTSUP* = cint(95) + ENOTTY* = cint(25) + ENXIO* = cint(6) + EOPNOTSUPP* = cint(95) + EOVERFLOW* = cint(75) + EPERM* = cint(1) + EPIPE* = cint(32) + EPROTO* = cint(71) + EPROTONOSUPPORT* = cint(93) + EPROTOTYPE* = cint(91) + ERANGE* = cint(34) + EROFS* = cint(30) + ESPIPE* = cint(29) + ESRCH* = cint(3) + ESTALE* = cint(116) + ETIME* = cint(62) + ETIMEDOUT* = cint(110) + ETXTBSY* = cint(26) + EWOULDBLOCK* = cint(11) + EXDEV* = cint(18) + F_DUPFD* = cint(0) + F_GETFD* = cint(1) + F_SETFD* = cint(2) + F_GETFL* = cint(3) + F_SETFL* = cint(4) + F_GETLK* = cint(5) + F_SETLK* = cint(6) + F_SETLKW* = cint(7) + F_GETOWN* = cint(9) + F_SETOWN* = cint(8) + FD_CLOEXEC* = cint(1) + F_RDLCK* = cint(0) + F_UNLCK* = cint(2) + F_WRLCK* = cint(1) + O_CREAT* = cint(64) + O_EXCL* = cint(128) + O_NOCTTY* = cint(256) + O_TRUNC* = cint(512) + O_APPEND* = cint(1024) + O_DSYNC* = cint(4096) + O_NONBLOCK* = cint(2048) + O_RSYNC* = cint(1052672) + O_SYNC* = cint(1052672) + O_ACCMODE* = cint(3) + O_RDONLY* = cint(0) + O_RDWR* = cint(2) + O_WRONLY* = cint(1) + POSIX_FADV_NORMAL* = cint(0) + POSIX_FADV_SEQUENTIAL* = cint(2) + POSIX_FADV_RANDOM* = cint(1) + POSIX_FADV_WILLNEED* = cint(3) + POSIX_FADV_DONTNEED* = cint(4) + POSIX_FADV_NOREUSE* = cint(5) + FE_DIVBYZERO* = cint(4) + FE_INEXACT* = cint(32) + FE_INVALID* = cint(1) + FE_OVERFLOW* = cint(8) + FE_UNDERFLOW* = cint(16) + FE_ALL_EXCEPT* = cint(61) + FE_DOWNWARD* = cint(1024) + FE_TONEAREST* = cint(0) + FE_TOWARDZERO* = cint(3072) + FE_UPWARD* = cint(2048) + FE_DFL_ENV* = cast[pointer](0xffffffffffffffff) + MM_HARD* = cint(1) + MM_SOFT* = cint(2) + MM_FIRM* = cint(4) + MM_APPL* = cint(8) + MM_UTIL* = cint(16) + MM_OPSYS* = cint(32) + MM_RECOVER* = cint(64) + MM_NRECOV* = cint(128) + MM_HALT* = cint(1) + MM_ERROR* = cint(2) + MM_WARNING* = cint(3) + MM_INFO* = cint(4) + MM_NOSEV* = cint(0) + MM_PRINT* = cint(256) + MM_CONSOLE* = cint(512) + MM_OK* = cint(0) + MM_NOTOK* = cint(-1) + MM_NOMSG* = cint(1) + MM_NOCON* = cint(4) + FNM_NOMATCH* = cint(1) + FNM_PATHNAME* = cint(1) + FNM_PERIOD* = cint(4) + FNM_NOESCAPE* = cint(2) + FTW_F* = cint(0) + FTW_D* = cint(1) + FTW_DNR* = cint(2) + FTW_NS* = cint(3) + FTW_SL* = cint(4) + GLOB_APPEND* = cint(32) + GLOB_DOOFFS* = cint(8) + GLOB_ERR* = cint(1) + GLOB_MARK* = cint(2) + GLOB_NOCHECK* = cint(16) + GLOB_NOESCAPE* = cint(64) + GLOB_NOSORT* = cint(4) + GLOB_ABORTED* = cint(2) + GLOB_NOMATCH* = cint(3) + GLOB_NOSPACE* = cint(1) + GLOB_NOSYS* = cint(4) + CODESET* = cint(14) + D_T_FMT* = cint(131112) + D_FMT* = cint(131113) + T_FMT* = cint(131114) + T_FMT_AMPM* = cint(131115) + AM_STR* = cint(131110) + PM_STR* = cint(131111) + DAY_1* = cint(131079) + DAY_2* = cint(131080) + DAY_3* = cint(131081) + DAY_4* = cint(131082) + DAY_5* = cint(131083) + DAY_6* = cint(131084) + DAY_7* = cint(131085) + ABDAY_1* = cint(131072) + ABDAY_2* = cint(131073) + ABDAY_3* = cint(131074) + ABDAY_4* = cint(131075) + ABDAY_5* = cint(131076) + ABDAY_6* = cint(131077) + ABDAY_7* = cint(131078) + MON_1* = cint(131098) + MON_2* = cint(131099) + MON_3* = cint(131100) + MON_4* = cint(131101) + MON_5* = cint(131102) + MON_6* = cint(131103) + MON_7* = cint(131104) + MON_8* = cint(131105) + MON_9* = cint(131106) + MON_10* = cint(131107) + MON_11* = cint(131108) + MON_12* = cint(131109) + ABMON_1* = cint(131086) + ABMON_2* = cint(131087) + ABMON_3* = cint(131088) + ABMON_4* = cint(131089) + ABMON_5* = cint(131090) + ABMON_6* = cint(131091) + ABMON_7* = cint(131092) + ABMON_8* = cint(131093) + ABMON_9* = cint(131094) + ABMON_10* = cint(131095) + ABMON_11* = cint(131096) + ABMON_12* = cint(131097) + ERA* = cint(131116) + ERA_D_FMT* = cint(131118) + ERA_D_T_FMT* = cint(131120) + ERA_T_FMT* = cint(131121) + ALT_DIGITS* = cint(131119) + RADIXCHAR* = cint(65536) + THOUSEP* = cint(65537) + YESEXPR* = cint(327680) + NOEXPR* = cint(327681) + CRNCYSTR* = cint(262159) + LC_ALL* = cint(6) + LC_COLLATE* = cint(3) + LC_CTYPE* = cint(0) + LC_MESSAGES* = cint(5) + LC_MONETARY* = cint(4) + LC_NUMERIC* = cint(1) + LC_TIME* = cint(2) + PTHREAD_BARRIER_SERIAL_THREAD* = cint(-1) + PTHREAD_CANCEL_ASYNCHRONOUS* = cint(1) + PTHREAD_CANCEL_ENABLE* = cint(0) + PTHREAD_CANCEL_DEFERRED* = cint(0) + PTHREAD_CANCEL_DISABLE* = cint(1) + PTHREAD_CREATE_DETACHED* = cint(1) + PTHREAD_CREATE_JOINABLE* = cint(0) + PTHREAD_EXPLICIT_SCHED* = cint(1) + PTHREAD_INHERIT_SCHED* = cint(0) + PTHREAD_PROCESS_SHARED* = cint(1) + PTHREAD_PROCESS_PRIVATE* = cint(0) + PTHREAD_SCOPE_PROCESS* = cint(1) + PTHREAD_SCOPE_SYSTEM* = cint(0) + POSIX_ASYNC_IO* = cint(1) + F_OK* = cint(0) + R_OK* = cint(4) + W_OK* = cint(2) + X_OK* = cint(1) + CS_PATH* = cint(0) + CS_POSIX_V6_ILP32_OFF32_CFLAGS* = cint(1116) + CS_POSIX_V6_ILP32_OFF32_LDFLAGS* = cint(1117) + CS_POSIX_V6_ILP32_OFF32_LIBS* = cint(1118) + CS_POSIX_V6_ILP32_OFFBIG_CFLAGS* = cint(1120) + CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS* = cint(1121) + CS_POSIX_V6_ILP32_OFFBIG_LIBS* = cint(1122) + CS_POSIX_V6_LP64_OFF64_CFLAGS* = cint(1124) + CS_POSIX_V6_LP64_OFF64_LDFLAGS* = cint(1125) + CS_POSIX_V6_LP64_OFF64_LIBS* = cint(1126) + CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS* = cint(1128) + CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS* = cint(1129) + CS_POSIX_V6_LPBIG_OFFBIG_LIBS* = cint(1130) + CS_POSIX_V6_WIDTH_RESTRICTED_ENVS* = cint(1) + F_LOCK* = cint(1) + F_TEST* = cint(3) + F_TLOCK* = cint(2) + F_ULOCK* = cint(0) + PC_2_SYMLINKS* = cint(20) + PC_ALLOC_SIZE_MIN* = cint(18) + PC_ASYNC_IO* = cint(10) + PC_CHOWN_RESTRICTED* = cint(6) + PC_FILESIZEBITS* = cint(13) + PC_LINK_MAX* = cint(0) + PC_MAX_CANON* = cint(1) + PC_MAX_INPUT* = cint(2) + PC_NAME_MAX* = cint(3) + PC_NO_TRUNC* = cint(7) + PC_PATH_MAX* = cint(4) + PC_PIPE_BUF* = cint(5) + PC_PRIO_IO* = cint(11) + PC_REC_INCR_XFER_SIZE* = cint(14) + PC_REC_MIN_XFER_SIZE* = cint(16) + PC_REC_XFER_ALIGN* = cint(17) + PC_SYMLINK_MAX* = cint(19) + PC_SYNC_IO* = cint(9) + PC_VDISABLE* = cint(8) + SC_2_C_BIND* = cint(47) + SC_2_C_DEV* = cint(48) + SC_2_CHAR_TERM* = cint(95) + SC_2_FORT_DEV* = cint(49) + SC_2_FORT_RUN* = cint(50) + SC_2_LOCALEDEF* = cint(52) + SC_2_PBS* = cint(168) + SC_2_PBS_ACCOUNTING* = cint(169) + SC_2_PBS_CHECKPOINT* = cint(175) + SC_2_PBS_LOCATE* = cint(170) + SC_2_PBS_MESSAGE* = cint(171) + SC_2_PBS_TRACK* = cint(172) + SC_2_SW_DEV* = cint(51) + SC_2_UPE* = cint(97) + SC_2_VERSION* = cint(46) + SC_ADVISORY_INFO* = cint(132) + SC_AIO_LISTIO_MAX* = cint(23) + SC_AIO_MAX* = cint(24) + SC_AIO_PRIO_DELTA_MAX* = cint(25) + SC_ARG_MAX* = cint(0) + SC_ASYNCHRONOUS_IO* = cint(12) + SC_ATEXIT_MAX* = cint(87) + SC_BARRIERS* = cint(133) + SC_BC_BASE_MAX* = cint(36) + SC_BC_DIM_MAX* = cint(37) + SC_BC_SCALE_MAX* = cint(38) + SC_BC_STRING_MAX* = cint(39) + SC_CHILD_MAX* = cint(1) + SC_CLK_TCK* = cint(2) + SC_CLOCK_SELECTION* = cint(137) + SC_COLL_WEIGHTS_MAX* = cint(40) + SC_CPUTIME* = cint(138) + SC_DELAYTIMER_MAX* = cint(26) + SC_EXPR_NEST_MAX* = cint(42) + SC_FSYNC* = cint(15) + SC_GETGR_R_SIZE_MAX* = cint(69) + SC_GETPW_R_SIZE_MAX* = cint(70) + SC_HOST_NAME_MAX* = cint(180) + SC_IOV_MAX* = cint(60) + SC_IPV6* = cint(235) + SC_JOB_CONTROL* = cint(7) + SC_LINE_MAX* = cint(43) + SC_LOGIN_NAME_MAX* = cint(71) + SC_MAPPED_FILES* = cint(16) + SC_MEMLOCK* = cint(17) + SC_MEMLOCK_RANGE* = cint(18) + SC_MEMORY_PROTECTION* = cint(19) + SC_MESSAGE_PASSING* = cint(20) + SC_MONOTONIC_CLOCK* = cint(149) + SC_MQ_OPEN_MAX* = cint(27) + SC_MQ_PRIO_MAX* = cint(28) + SC_NGROUPS_MAX* = cint(3) + SC_OPEN_MAX* = cint(4) + SC_PAGE_SIZE* = cint(30) + SC_PRIORITIZED_IO* = cint(13) + SC_PRIORITY_SCHEDULING* = cint(10) + SC_RAW_SOCKETS* = cint(236) + SC_RE_DUP_MAX* = cint(44) + SC_READER_WRITER_LOCKS* = cint(153) + SC_REALTIME_SIGNALS* = cint(9) + SC_REGEXP* = cint(155) + SC_RTSIG_MAX* = cint(31) + SC_SAVED_IDS* = cint(8) + SC_SEM_NSEMS_MAX* = cint(32) + SC_SEM_VALUE_MAX* = cint(33) + SC_SEMAPHORES* = cint(21) + SC_SHARED_MEMORY_OBJECTS* = cint(22) + SC_SHELL* = cint(157) + SC_SIGQUEUE_MAX* = cint(34) + SC_SPAWN* = cint(159) + SC_SPIN_LOCKS* = cint(154) + SC_SPORADIC_SERVER* = cint(160) + SC_SS_REPL_MAX* = cint(241) + SC_STREAM_MAX* = cint(5) + SC_SYMLOOP_MAX* = cint(173) + SC_SYNCHRONIZED_IO* = cint(14) + SC_THREAD_ATTR_STACKADDR* = cint(77) + SC_THREAD_ATTR_STACKSIZE* = cint(78) + SC_THREAD_CPUTIME* = cint(139) + SC_THREAD_DESTRUCTOR_ITERATIONS* = cint(73) + SC_THREAD_KEYS_MAX* = cint(74) + SC_THREAD_PRIO_INHERIT* = cint(80) + SC_THREAD_PRIO_PROTECT* = cint(81) + SC_THREAD_PRIORITY_SCHEDULING* = cint(79) + SC_THREAD_PROCESS_SHARED* = cint(82) + SC_THREAD_SAFE_FUNCTIONS* = cint(68) + SC_THREAD_SPORADIC_SERVER* = cint(161) + SC_THREAD_STACK_MIN* = cint(75) + SC_THREAD_THREADS_MAX* = cint(76) + SC_THREADS* = cint(67) + SC_TIMEOUTS* = cint(164) + SC_TIMER_MAX* = cint(35) + SC_TIMERS* = cint(11) + SC_TRACE* = cint(181) + SC_TRACE_EVENT_FILTER* = cint(182) + SC_TRACE_EVENT_NAME_MAX* = cint(242) + SC_TRACE_INHERIT* = cint(183) + SC_TRACE_LOG* = cint(184) + SC_TRACE_NAME_MAX* = cint(243) + SC_TRACE_SYS_MAX* = cint(244) + SC_TRACE_USER_EVENT_MAX* = cint(245) + SC_TTY_NAME_MAX* = cint(72) + SC_TYPED_MEMORY_OBJECTS* = cint(165) + SC_TZNAME_MAX* = cint(6) + SC_V6_ILP32_OFF32* = cint(176) + SC_V6_ILP32_OFFBIG* = cint(177) + SC_V6_LP64_OFF64* = cint(178) + SC_V6_LPBIG_OFFBIG* = cint(179) + SC_VERSION* = cint(29) + SC_XBS5_ILP32_OFF32* = cint(125) + SC_XBS5_ILP32_OFFBIG* = cint(126) + SC_XBS5_LP64_OFF64* = cint(127) + SC_XBS5_LPBIG_OFFBIG* = cint(128) + SC_XOPEN_CRYPT* = cint(92) + SC_XOPEN_ENH_I18N* = cint(93) + SC_XOPEN_LEGACY* = cint(129) + SC_XOPEN_REALTIME* = cint(130) + SC_XOPEN_REALTIME_THREADS* = cint(131) + SC_XOPEN_SHM* = cint(94) + SC_XOPEN_STREAMS* = cint(246) + SC_XOPEN_UNIX* = cint(91) + SC_XOPEN_VERSION* = cint(89) + SEEK_SET* = cint(0) + SEEK_CUR* = cint(1) + SEEK_END* = cint(2) + SEM_FAILED* = cast[pointer]((nil)) + IPC_CREAT* = cint(512) + IPC_EXCL* = cint(1024) + IPC_NOWAIT* = cint(2048) + IPC_PRIVATE* = cint(0) + IPC_RMID* = cint(0) + IPC_SET* = cint(1) + IPC_STAT* = cint(2) + S_IFMT* = cint(61440) + S_IFBLK* = cint(24576) + S_IFCHR* = cint(8192) + S_IFIFO* = cint(4096) + S_IFREG* = cint(32768) + S_IFDIR* = cint(16384) + S_IFLNK* = cint(40960) + S_IFSOCK* = cint(49152) + S_IRWXU* = cint(448) + S_IRUSR* = cint(256) + S_IWUSR* = cint(128) + S_IXUSR* = cint(64) + S_IRWXG* = cint(56) + S_IRGRP* = cint(32) + S_IWGRP* = cint(16) + S_IXGRP* = cint(8) + S_IRWXO* = cint(7) + S_IROTH* = cint(4) + S_IWOTH* = cint(2) + S_IXOTH* = cint(1) + S_ISUID* = cint(2048) + S_ISGID* = cint(1024) + S_ISVTX* = cint(512) + ST_RDONLY* = cint(1) + ST_NOSUID* = cint(2) + PROT_READ* = cint(1) + PROT_WRITE* = cint(2) + PROT_EXEC* = cint(4) + PROT_NONE* = cint(0) + MAP_SHARED* = cint(1) + MAP_PRIVATE* = cint(2) + MAP_FIXED* = cint(16) + MS_ASYNC* = cint(1) + MS_SYNC* = cint(4) + MS_INVALIDATE* = cint(2) + MCL_CURRENT* = cint(1) + MCL_FUTURE* = cint(2) + MAP_FAILED* = cast[pointer](0xffffffffffffffff) + POSIX_MADV_NORMAL* = cint(0) + POSIX_MADV_SEQUENTIAL* = cint(2) + POSIX_MADV_RANDOM* = cint(1) + POSIX_MADV_WILLNEED* = cint(3) + POSIX_MADV_DONTNEED* = cint(4) + CLOCKS_PER_SEC* = clong(1000000) + CLOCK_PROCESS_CPUTIME_ID* = cint(2) + CLOCK_THREAD_CPUTIME_ID* = cint(3) + CLOCK_REALTIME* = cint(0) + TIMER_ABSTIME* = cint(1) + CLOCK_MONOTONIC* = cint(1) + WNOHANG* = cint(1) + WUNTRACED* = cint(2) + WEXITED* = cint(4) + WSTOPPED* = cint(2) + WCONTINUED* = cint(8) + WNOWAIT* = cint(16777216) + SIGEV_NONE* = cint(1) + SIGEV_SIGNAL* = cint(0) + SIGEV_THREAD* = cint(2) + SIGABRT* = cint(6) + SIGALRM* = cint(14) + SIGBUS* = cint(7) + SIGCHLD* = cint(17) + SIGCONT* = cint(18) + SIGFPE* = cint(8) + SIGHUP* = cint(1) + SIGILL* = cint(4) + SIGINT* = cint(2) + SIGKILL* = cint(9) + SIGPIPE* = cint(13) + SIGQUIT* = cint(3) + SIGSEGV* = cint(11) + SIGSTOP* = cint(19) + SIGTERM* = cint(15) + SIGTSTP* = cint(20) + SIGTTIN* = cint(21) + SIGTTOU* = cint(22) + SIGUSR1* = cint(10) + SIGUSR2* = cint(12) + SIGPOLL* = cint(29) + SIGPROF* = cint(27) + SIGSYS* = cint(31) + SIGTRAP* = cint(5) + SIGURG* = cint(23) + SIGVTALRM* = cint(26) + SIGXCPU* = cint(24) + SIGXFSZ* = cint(25) + SA_NOCLDSTOP* = cint(1) + SIG_BLOCK* = cint(0) + SIG_UNBLOCK* = cint(1) + SIG_SETMASK* = cint(2) + SA_ONSTACK* = cint(134217728) + SA_RESETHAND* = cint(-2147483648) + SA_RESTART* = cint(268435456) + SA_SIGINFO* = cint(4) + SA_NOCLDWAIT* = cint(2) + SA_NODEFER* = cint(1073741824) + SS_ONSTACK* = cint(1) + SS_DISABLE* = cint(2) + MINSIGSTKSZ* = cint(2048) + SIGSTKSZ* = cint(8192) + NL_SETD* = cint(1) + NL_CAT_LOCALE* = cint(1) + SCHED_FIFO* = cint(1) + SCHED_RR* = cint(2) + SCHED_OTHER* = cint(0) + FD_SETSIZE* = cint(1024) + IF_NAMESIZE* = cint(16) + SCM_RIGHTS* = cint(1) + SOCK_DGRAM* = cint(2) + SOCK_RAW* = cint(3) + SOCK_SEQPACKET* = cint(5) + SOCK_STREAM* = cint(1) + SOL_SOCKET* = cint(1) + SO_ACCEPTCONN* = cint(30) + SO_BROADCAST* = cint(6) + SO_DEBUG* = cint(1) + SO_DONTROUTE* = cint(5) + SO_ERROR* = cint(4) + SO_KEEPALIVE* = cint(9) + SO_LINGER* = cint(13) + SO_OOBINLINE* = cint(10) + SO_RCVBUF* = cint(8) + SO_RCVLOWAT* = cint(18) + SO_RCVTIMEO* = cint(20) + SO_REUSEADDR* = cint(2) + SO_SNDBUF* = cint(7) + SO_SNDLOWAT* = cint(19) + SO_SNDTIMEO* = cint(21) + SO_TYPE* = cint(3) + SOMAXCONN* = cint(128) + MSG_CTRUNC* = cint(8) + MSG_DONTROUTE* = cint(4) + MSG_EOR* = cint(128) + MSG_OOB* = cint(1) + MSG_PEEK* = cint(2) + MSG_TRUNC* = cint(32) + MSG_WAITALL* = cint(256) + AF_INET* = cint(2) + AF_INET6* = cint(10) + AF_UNIX* = cint(1) + AF_UNSPEC* = cint(0) + SHUT_RD* = cint(0) + SHUT_RDWR* = cint(2) + SHUT_WR* = cint(1) + IPPROTO_IP* = cint(0) + IPPROTO_IPV6* = cint(41) + IPPROTO_ICMP* = cint(1) + IPPROTO_RAW* = cint(255) + IPPROTO_TCP* = cint(6) + IPPROTO_UDP* = cint(17) + INADDR_ANY* = cint(0) + INADDR_BROADCAST* = cint(-1) + INET_ADDRSTRLEN* = cint(16) + IPV6_JOIN_GROUP* = cint(20) + IPV6_LEAVE_GROUP* = cint(21) + IPV6_MULTICAST_HOPS* = cint(18) + IPV6_MULTICAST_IF* = cint(17) + IPV6_MULTICAST_LOOP* = cint(19) + IPV6_UNICAST_HOPS* = cint(16) + IPV6_V6ONLY* = cint(26) + IPPORT_RESERVED* = cint(1024) + HOST_NOT_FOUND* = cint(1) + NO_DATA* = cint(4) + NO_RECOVERY* = cint(3) + TRY_AGAIN* = cint(2) + AI_PASSIVE* = cint(1) + AI_CANONNAME* = cint(2) + AI_NUMERICHOST* = cint(4) + AI_NUMERICSERV* = cint(1024) + AI_V4MAPPED* = cint(8) + AI_ALL* = cint(16) + AI_ADDRCONFIG* = cint(32) + NI_NOFQDN* = cint(4) + NI_NUMERICHOST* = cint(1) + NI_NAMEREQD* = cint(8) + NI_NUMERICSERV* = cint(2) + NI_DGRAM* = cint(16) + EAI_AGAIN* = cint(-3) + EAI_BADFLAGS* = cint(-1) + EAI_FAIL* = cint(-4) + EAI_FAMILY* = cint(-6) + EAI_MEMORY* = cint(-10) + EAI_NONAME* = cint(-2) + EAI_SERVICE* = cint(-8) + EAI_SOCKTYPE* = cint(-7) + EAI_SYSTEM* = cint(-11) + EAI_OVERFLOW* = cint(-12) + POLLIN* = cshort(1) + POLLRDNORM* = cshort(64) + POLLRDBAND* = cshort(128) + POLLPRI* = cshort(2) + POLLOUT* = cshort(4) + POLLWRNORM* = cshort(256) + POLLWRBAND* = cshort(512) + POLLERR* = cshort(8) + POLLHUP* = cshort(16) + POLLNVAL* = cshort(32) + POSIX_SPAWN_RESETIDS* = cint(1) + POSIX_SPAWN_SETPGROUP* = cint(2) + POSIX_SPAWN_SETSCHEDPARAM* = cint(16) + POSIX_SPAWN_SETSCHEDULER* = cint(32) + POSIX_SPAWN_SETSIGDEF* = cint(4) + POSIX_SPAWN_SETSIGMASK* = cint(8) + IOFBF* = cint(0) + IONBF* = cint(2) diff --git a/tools/detect/macosx_consts.nim b/tools/detect/macosx_consts.nim new file mode 100644 index 000000000..e8be56e5f --- /dev/null +++ b/tools/detect/macosx_consts.nim @@ -0,0 +1,629 @@ +# Generated by detect.nim +const + AIO_ALLDONE* = cint(1) + AIO_CANCELED* = cint(2) + AIO_NOTCANCELED* = cint(4) + LIO_NOP* = cint(0) + LIO_NOWAIT* = cint(1) + LIO_READ* = cint(1) + LIO_WAIT* = cint(2) + LIO_WRITE* = cint(2) + RTLD_LAZY* = cint(1) + RTLD_NOW* = cint(2) + RTLD_GLOBAL* = cint(8) + RTLD_LOCAL* = cint(4) + E2BIG* = cint(7) + EACCES* = cint(13) + EADDRINUSE* = cint(48) + EADDRNOTAVAIL* = cint(49) + EAFNOSUPPORT* = cint(47) + EAGAIN* = cint(35) + EALREADY* = cint(37) + EBADF* = cint(9) + EBADMSG* = cint(94) + EBUSY* = cint(16) + ECANCELED* = cint(89) + ECHILD* = cint(10) + ECONNABORTED* = cint(53) + ECONNREFUSED* = cint(61) + ECONNRESET* = cint(54) + EDEADLK* = cint(11) + EDESTADDRREQ* = cint(39) + EDOM* = cint(33) + EDQUOT* = cint(69) + EEXIST* = cint(17) + EFAULT* = cint(14) + EFBIG* = cint(27) + EHOSTUNREACH* = cint(65) + EIDRM* = cint(90) + EILSEQ* = cint(92) + EINPROGRESS* = cint(36) + EINTR* = cint(4) + EINVAL* = cint(22) + EIO* = cint(5) + EISCONN* = cint(56) + EISDIR* = cint(21) + ELOOP* = cint(62) + EMFILE* = cint(24) + EMLINK* = cint(31) + EMSGSIZE* = cint(40) + EMULTIHOP* = cint(95) + ENAMETOOLONG* = cint(63) + ENETDOWN* = cint(50) + ENETRESET* = cint(52) + ENETUNREACH* = cint(51) + ENFILE* = cint(23) + ENOBUFS* = cint(55) + ENODATA* = cint(96) + ENODEV* = cint(19) + ENOENT* = cint(2) + ENOEXEC* = cint(8) + ENOLCK* = cint(77) + ENOLINK* = cint(97) + ENOMEM* = cint(12) + ENOMSG* = cint(91) + ENOPROTOOPT* = cint(42) + ENOSPC* = cint(28) + ENOSR* = cint(98) + ENOSTR* = cint(99) + ENOSYS* = cint(78) + ENOTCONN* = cint(57) + ENOTDIR* = cint(20) + ENOTEMPTY* = cint(66) + ENOTSOCK* = cint(38) + ENOTSUP* = cint(45) + ENOTTY* = cint(25) + ENXIO* = cint(6) + EOPNOTSUPP* = cint(102) + EOVERFLOW* = cint(84) + EPERM* = cint(1) + EPIPE* = cint(32) + EPROTO* = cint(100) + EPROTONOSUPPORT* = cint(43) + EPROTOTYPE* = cint(41) + ERANGE* = cint(34) + EROFS* = cint(30) + ESPIPE* = cint(29) + ESRCH* = cint(3) + ESTALE* = cint(70) + ETIME* = cint(101) + ETIMEDOUT* = cint(60) + ETXTBSY* = cint(26) + EWOULDBLOCK* = cint(35) + EXDEV* = cint(18) + F_DUPFD* = cint(0) + F_GETFD* = cint(1) + F_SETFD* = cint(2) + F_GETFL* = cint(3) + F_SETFL* = cint(4) + F_GETLK* = cint(7) + F_SETLK* = cint(8) + F_SETLKW* = cint(9) + F_GETOWN* = cint(5) + F_SETOWN* = cint(6) + FD_CLOEXEC* = cint(1) + F_RDLCK* = cint(1) + F_UNLCK* = cint(2) + F_WRLCK* = cint(3) + O_CREAT* = cint(512) + O_EXCL* = cint(2048) + O_NOCTTY* = cint(131072) + O_TRUNC* = cint(1024) + O_APPEND* = cint(8) + O_DSYNC* = cint(4194304) + O_NONBLOCK* = cint(4) + O_SYNC* = cint(128) + O_ACCMODE* = cint(3) + O_RDONLY* = cint(0) + O_RDWR* = cint(2) + O_WRONLY* = cint(1) + FE_DIVBYZERO* = cint(4) + FE_INEXACT* = cint(32) + FE_INVALID* = cint(1) + FE_OVERFLOW* = cint(8) + FE_UNDERFLOW* = cint(16) + FE_ALL_EXCEPT* = cint(63) + FE_DOWNWARD* = cint(1024) + FE_TONEAREST* = cint(0) + FE_TOWARDZERO* = cint(3072) + FE_UPWARD* = cint(2048) + FE_DFL_ENV* = when defined(amd64): cast[pointer](0x7fff9533b1b4) + else: cast[pointer](0x904797f4) + MM_HARD* = cint(1) + MM_SOFT* = cint(2) + MM_FIRM* = cint(4) + MM_APPL* = cint(16) + MM_UTIL* = cint(32) + MM_OPSYS* = cint(64) + MM_RECOVER* = cint(4096) + MM_NRECOV* = cint(8192) + MM_HALT* = cint(1) + MM_ERROR* = cint(2) + MM_WARNING* = cint(3) + MM_INFO* = cint(4) + MM_NOSEV* = cint(0) + MM_PRINT* = cint(256) + MM_CONSOLE* = cint(512) + MM_OK* = cint(0) + MM_NOTOK* = cint(3) + MM_NOMSG* = cint(1) + MM_NOCON* = cint(2) + FNM_NOMATCH* = cint(1) + FNM_PATHNAME* = cint(2) + FNM_PERIOD* = cint(4) + FNM_NOESCAPE* = cint(1) + FNM_NOSYS* = cint(-1) + FTW_F* = cint(0) + FTW_D* = cint(1) + FTW_DNR* = cint(2) + FTW_DP* = cint(3) + FTW_NS* = cint(4) + FTW_SL* = cint(5) + FTW_SLN* = cint(6) + FTW_PHYS* = cint(1) + FTW_MOUNT* = cint(2) + FTW_DEPTH* = cint(4) + FTW_CHDIR* = cint(8) + GLOB_APPEND* = cint(1) + GLOB_DOOFFS* = cint(2) + GLOB_ERR* = cint(4) + GLOB_MARK* = cint(8) + GLOB_NOCHECK* = cint(16) + GLOB_NOESCAPE* = cint(8192) + GLOB_NOSORT* = cint(32) + GLOB_ABORTED* = cint(-2) + GLOB_NOMATCH* = cint(-3) + GLOB_NOSPACE* = cint(-1) + GLOB_NOSYS* = cint(-4) + CODESET* = cint(0) + D_T_FMT* = cint(1) + D_FMT* = cint(2) + T_FMT* = cint(3) + T_FMT_AMPM* = cint(4) + AM_STR* = cint(5) + PM_STR* = cint(6) + DAY_1* = cint(7) + DAY_2* = cint(8) + DAY_3* = cint(9) + DAY_4* = cint(10) + DAY_5* = cint(11) + DAY_6* = cint(12) + DAY_7* = cint(13) + ABDAY_1* = cint(14) + ABDAY_2* = cint(15) + ABDAY_3* = cint(16) + ABDAY_4* = cint(17) + ABDAY_5* = cint(18) + ABDAY_6* = cint(19) + ABDAY_7* = cint(20) + MON_1* = cint(21) + MON_2* = cint(22) + MON_3* = cint(23) + MON_4* = cint(24) + MON_5* = cint(25) + MON_6* = cint(26) + MON_7* = cint(27) + MON_8* = cint(28) + MON_9* = cint(29) + MON_10* = cint(30) + MON_11* = cint(31) + MON_12* = cint(32) + ABMON_1* = cint(33) + ABMON_2* = cint(34) + ABMON_3* = cint(35) + ABMON_4* = cint(36) + ABMON_5* = cint(37) + ABMON_6* = cint(38) + ABMON_7* = cint(39) + ABMON_8* = cint(40) + ABMON_9* = cint(41) + ABMON_10* = cint(42) + ABMON_11* = cint(43) + ABMON_12* = cint(44) + ERA* = cint(45) + ERA_D_FMT* = cint(46) + ERA_D_T_FMT* = cint(47) + ERA_T_FMT* = cint(48) + ALT_DIGITS* = cint(49) + RADIXCHAR* = cint(50) + THOUSEP* = cint(51) + YESEXPR* = cint(52) + NOEXPR* = cint(53) + CRNCYSTR* = cint(56) + LC_ALL* = cint(0) + LC_COLLATE* = cint(1) + LC_CTYPE* = cint(2) + LC_MESSAGES* = cint(6) + LC_MONETARY* = cint(3) + LC_NUMERIC* = cint(4) + LC_TIME* = cint(5) + PTHREAD_CANCEL_ASYNCHRONOUS* = cint(0) + PTHREAD_CANCEL_ENABLE* = cint(1) + PTHREAD_CANCEL_DEFERRED* = cint(2) + PTHREAD_CANCEL_DISABLE* = cint(0) + PTHREAD_CREATE_DETACHED* = cint(2) + PTHREAD_CREATE_JOINABLE* = cint(1) + PTHREAD_EXPLICIT_SCHED* = cint(2) + PTHREAD_INHERIT_SCHED* = cint(1) + PTHREAD_MUTEX_DEFAULT* = cint(0) + PTHREAD_MUTEX_ERRORCHECK* = cint(1) + PTHREAD_MUTEX_NORMAL* = cint(0) + PTHREAD_MUTEX_RECURSIVE* = cint(2) + PTHREAD_PRIO_INHERIT* = cint(1) + PTHREAD_PRIO_NONE* = cint(0) + PTHREAD_PRIO_PROTECT* = cint(2) + PTHREAD_PROCESS_SHARED* = cint(1) + PTHREAD_PROCESS_PRIVATE* = cint(2) + PTHREAD_SCOPE_PROCESS* = cint(2) + PTHREAD_SCOPE_SYSTEM* = cint(1) + F_OK* = cint(0) + R_OK* = cint(4) + W_OK* = cint(2) + X_OK* = cint(1) + CS_PATH* = cint(1) + CS_POSIX_V6_ILP32_OFF32_CFLAGS* = cint(2) + CS_POSIX_V6_ILP32_OFF32_LDFLAGS* = cint(3) + CS_POSIX_V6_ILP32_OFF32_LIBS* = cint(4) + CS_POSIX_V6_ILP32_OFFBIG_CFLAGS* = cint(5) + CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS* = cint(6) + CS_POSIX_V6_ILP32_OFFBIG_LIBS* = cint(7) + CS_POSIX_V6_LP64_OFF64_CFLAGS* = cint(8) + CS_POSIX_V6_LP64_OFF64_LDFLAGS* = cint(9) + CS_POSIX_V6_LP64_OFF64_LIBS* = cint(10) + CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS* = cint(11) + CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS* = cint(12) + CS_POSIX_V6_LPBIG_OFFBIG_LIBS* = cint(13) + CS_POSIX_V6_WIDTH_RESTRICTED_ENVS* = cint(14) + F_LOCK* = cint(1) + F_TEST* = cint(3) + F_TLOCK* = cint(2) + F_ULOCK* = cint(0) + PC_2_SYMLINKS* = cint(15) + PC_ALLOC_SIZE_MIN* = cint(16) + PC_ASYNC_IO* = cint(17) + PC_CHOWN_RESTRICTED* = cint(7) + PC_FILESIZEBITS* = cint(18) + PC_LINK_MAX* = cint(1) + PC_MAX_CANON* = cint(2) + PC_MAX_INPUT* = cint(3) + PC_NAME_MAX* = cint(4) + PC_NO_TRUNC* = cint(8) + PC_PATH_MAX* = cint(5) + PC_PIPE_BUF* = cint(6) + PC_PRIO_IO* = cint(19) + PC_REC_INCR_XFER_SIZE* = cint(20) + PC_REC_MIN_XFER_SIZE* = cint(22) + PC_REC_XFER_ALIGN* = cint(23) + PC_SYMLINK_MAX* = cint(24) + PC_SYNC_IO* = cint(25) + PC_VDISABLE* = cint(9) + SC_2_C_BIND* = cint(18) + SC_2_C_DEV* = cint(19) + SC_2_CHAR_TERM* = cint(20) + SC_2_FORT_DEV* = cint(21) + SC_2_FORT_RUN* = cint(22) + SC_2_LOCALEDEF* = cint(23) + SC_2_PBS* = cint(59) + SC_2_PBS_ACCOUNTING* = cint(60) + SC_2_PBS_CHECKPOINT* = cint(61) + SC_2_PBS_LOCATE* = cint(62) + SC_2_PBS_MESSAGE* = cint(63) + SC_2_PBS_TRACK* = cint(64) + SC_2_SW_DEV* = cint(24) + SC_2_UPE* = cint(25) + SC_2_VERSION* = cint(17) + SC_ADVISORY_INFO* = cint(65) + SC_AIO_LISTIO_MAX* = cint(42) + SC_AIO_MAX* = cint(43) + SC_AIO_PRIO_DELTA_MAX* = cint(44) + SC_ARG_MAX* = cint(1) + SC_ASYNCHRONOUS_IO* = cint(28) + SC_ATEXIT_MAX* = cint(107) + SC_BARRIERS* = cint(66) + SC_BC_BASE_MAX* = cint(9) + SC_BC_DIM_MAX* = cint(10) + SC_BC_SCALE_MAX* = cint(11) + SC_BC_STRING_MAX* = cint(12) + SC_CHILD_MAX* = cint(2) + SC_CLK_TCK* = cint(3) + SC_CLOCK_SELECTION* = cint(67) + SC_COLL_WEIGHTS_MAX* = cint(13) + SC_CPUTIME* = cint(68) + SC_DELAYTIMER_MAX* = cint(45) + SC_EXPR_NEST_MAX* = cint(14) + SC_FSYNC* = cint(38) + SC_GETGR_R_SIZE_MAX* = cint(70) + SC_GETPW_R_SIZE_MAX* = cint(71) + SC_HOST_NAME_MAX* = cint(72) + SC_IOV_MAX* = cint(56) + SC_IPV6* = cint(118) + SC_JOB_CONTROL* = cint(6) + SC_LINE_MAX* = cint(15) + SC_LOGIN_NAME_MAX* = cint(73) + SC_MAPPED_FILES* = cint(47) + SC_MEMLOCK* = cint(30) + SC_MEMLOCK_RANGE* = cint(31) + SC_MEMORY_PROTECTION* = cint(32) + SC_MESSAGE_PASSING* = cint(33) + SC_MONOTONIC_CLOCK* = cint(74) + SC_MQ_OPEN_MAX* = cint(46) + SC_MQ_PRIO_MAX* = cint(75) + SC_NGROUPS_MAX* = cint(4) + SC_OPEN_MAX* = cint(5) + SC_PAGE_SIZE* = cint(29) + SC_PRIORITIZED_IO* = cint(34) + SC_PRIORITY_SCHEDULING* = cint(35) + SC_RAW_SOCKETS* = cint(119) + SC_RE_DUP_MAX* = cint(16) + SC_READER_WRITER_LOCKS* = cint(76) + SC_REALTIME_SIGNALS* = cint(36) + SC_REGEXP* = cint(77) + SC_RTSIG_MAX* = cint(48) + SC_SAVED_IDS* = cint(7) + SC_SEM_NSEMS_MAX* = cint(49) + SC_SEM_VALUE_MAX* = cint(50) + SC_SEMAPHORES* = cint(37) + SC_SHARED_MEMORY_OBJECTS* = cint(39) + SC_SHELL* = cint(78) + SC_SIGQUEUE_MAX* = cint(51) + SC_SPAWN* = cint(79) + SC_SPIN_LOCKS* = cint(80) + SC_SPORADIC_SERVER* = cint(81) + SC_SS_REPL_MAX* = cint(126) + SC_STREAM_MAX* = cint(26) + SC_SYMLOOP_MAX* = cint(120) + SC_SYNCHRONIZED_IO* = cint(40) + SC_THREAD_ATTR_STACKADDR* = cint(82) + SC_THREAD_ATTR_STACKSIZE* = cint(83) + SC_THREAD_CPUTIME* = cint(84) + SC_THREAD_DESTRUCTOR_ITERATIONS* = cint(85) + SC_THREAD_KEYS_MAX* = cint(86) + SC_THREAD_PRIO_INHERIT* = cint(87) + SC_THREAD_PRIO_PROTECT* = cint(88) + SC_THREAD_PRIORITY_SCHEDULING* = cint(89) + SC_THREAD_PROCESS_SHARED* = cint(90) + SC_THREAD_SAFE_FUNCTIONS* = cint(91) + SC_THREAD_SPORADIC_SERVER* = cint(92) + SC_THREAD_STACK_MIN* = cint(93) + SC_THREAD_THREADS_MAX* = cint(94) + SC_THREADS* = cint(96) + SC_TIMEOUTS* = cint(95) + SC_TIMER_MAX* = cint(52) + SC_TIMERS* = cint(41) + SC_TRACE* = cint(97) + SC_TRACE_EVENT_FILTER* = cint(98) + SC_TRACE_EVENT_NAME_MAX* = cint(127) + SC_TRACE_INHERIT* = cint(99) + SC_TRACE_LOG* = cint(100) + SC_TRACE_NAME_MAX* = cint(128) + SC_TRACE_SYS_MAX* = cint(129) + SC_TRACE_USER_EVENT_MAX* = cint(130) + SC_TTY_NAME_MAX* = cint(101) + SC_TYPED_MEMORY_OBJECTS* = cint(102) + SC_TZNAME_MAX* = cint(27) + SC_V6_ILP32_OFF32* = cint(103) + SC_V6_ILP32_OFFBIG* = cint(104) + SC_V6_LP64_OFF64* = cint(105) + SC_V6_LPBIG_OFFBIG* = cint(106) + SC_VERSION* = cint(8) + SC_XBS5_ILP32_OFF32* = cint(122) + SC_XBS5_ILP32_OFFBIG* = cint(123) + SC_XBS5_LP64_OFF64* = cint(124) + SC_XBS5_LPBIG_OFFBIG* = cint(125) + SC_XOPEN_CRYPT* = cint(108) + SC_XOPEN_ENH_I18N* = cint(109) + SC_XOPEN_LEGACY* = cint(110) + SC_XOPEN_REALTIME* = cint(111) + SC_XOPEN_REALTIME_THREADS* = cint(112) + SC_XOPEN_SHM* = cint(113) + SC_XOPEN_STREAMS* = cint(114) + SC_XOPEN_UNIX* = cint(115) + SC_XOPEN_VERSION* = cint(116) + SEEK_SET* = cint(0) + SEEK_CUR* = cint(1) + SEEK_END* = cint(2) + SEM_FAILED* = cast[pointer](-1) + IPC_CREAT* = cint(512) + IPC_EXCL* = cint(1024) + IPC_NOWAIT* = cint(2048) + IPC_PRIVATE* = cint(0) + IPC_RMID* = cint(0) + IPC_SET* = cint(1) + IPC_STAT* = cint(2) + S_IFMT* = cint(61440) + S_IFBLK* = cint(24576) + S_IFCHR* = cint(8192) + S_IFIFO* = cint(4096) + S_IFREG* = cint(32768) + S_IFDIR* = cint(16384) + S_IFLNK* = cint(40960) + S_IFSOCK* = cint(49152) + S_IRWXU* = cint(448) + S_IRUSR* = cint(256) + S_IWUSR* = cint(128) + S_IXUSR* = cint(64) + S_IRWXG* = cint(56) + S_IRGRP* = cint(32) + S_IWGRP* = cint(16) + S_IXGRP* = cint(8) + S_IRWXO* = cint(7) + S_IROTH* = cint(4) + S_IWOTH* = cint(2) + S_IXOTH* = cint(1) + S_ISUID* = cint(2048) + S_ISGID* = cint(1024) + S_ISVTX* = cint(512) + ST_RDONLY* = cint(1) + ST_NOSUID* = cint(2) + PROT_READ* = cint(1) + PROT_WRITE* = cint(2) + PROT_EXEC* = cint(4) + PROT_NONE* = cint(0) + MAP_SHARED* = cint(1) + MAP_PRIVATE* = cint(2) + MAP_FIXED* = cint(16) + MS_ASYNC* = cint(1) + MS_SYNC* = cint(16) + MS_INVALIDATE* = cint(2) + MCL_CURRENT* = cint(1) + MCL_FUTURE* = cint(2) + MAP_FAILED* = cast[pointer](-1) + POSIX_MADV_NORMAL* = cint(0) + POSIX_MADV_SEQUENTIAL* = cint(2) + POSIX_MADV_RANDOM* = cint(1) + POSIX_MADV_WILLNEED* = cint(3) + POSIX_MADV_DONTNEED* = cint(4) + CLOCKS_PER_SEC* = clong(1000000) + WNOHANG* = cint(1) + WUNTRACED* = cint(2) + WEXITED* = cint(4) + WSTOPPED* = cint(8) + WCONTINUED* = cint(16) + WNOWAIT* = cint(32) + SIGEV_NONE* = cint(0) + SIGEV_SIGNAL* = cint(1) + SIGEV_THREAD* = cint(3) + SIGABRT* = cint(6) + SIGALRM* = cint(14) + SIGBUS* = cint(10) + SIGCHLD* = cint(20) + SIGCONT* = cint(19) + SIGFPE* = cint(8) + SIGHUP* = cint(1) + SIGILL* = cint(4) + SIGINT* = cint(2) + SIGKILL* = cint(9) + SIGPIPE* = cint(13) + SIGQUIT* = cint(3) + SIGSEGV* = cint(11) + SIGSTOP* = cint(17) + SIGTERM* = cint(15) + SIGTSTP* = cint(18) + SIGTTIN* = cint(21) + SIGTTOU* = cint(22) + SIGUSR1* = cint(30) + SIGUSR2* = cint(31) + SIGPROF* = cint(27) + SIGSYS* = cint(12) + SIGTRAP* = cint(5) + SIGURG* = cint(16) + SIGVTALRM* = cint(26) + SIGXCPU* = cint(24) + SIGXFSZ* = cint(25) + SA_NOCLDSTOP* = cint(8) + SIG_BLOCK* = cint(1) + SIG_UNBLOCK* = cint(2) + SIG_SETMASK* = cint(3) + SA_ONSTACK* = cint(1) + SA_RESETHAND* = cint(4) + SA_RESTART* = cint(2) + SA_SIGINFO* = cint(64) + SA_NOCLDWAIT* = cint(32) + SA_NODEFER* = cint(16) + SS_ONSTACK* = cint(1) + SS_DISABLE* = cint(4) + MINSIGSTKSZ* = cint(32768) + SIGSTKSZ* = cint(131072) + NL_SETD* = cint(1) + NL_CAT_LOCALE* = cint(1) + SCHED_FIFO* = cint(4) + SCHED_RR* = cint(2) + SCHED_OTHER* = cint(1) + FD_SETSIZE* = cint(1024) + SCM_RIGHTS* = cint(1) + SOCK_DGRAM* = cint(2) + SOCK_RAW* = cint(3) + SOCK_SEQPACKET* = cint(5) + SOCK_STREAM* = cint(1) + SOL_SOCKET* = cint(65535) + SO_ACCEPTCONN* = cint(2) + SO_BROADCAST* = cint(32) + SO_DEBUG* = cint(1) + SO_DONTROUTE* = cint(16) + SO_ERROR* = cint(4103) + SO_KEEPALIVE* = cint(8) + SO_LINGER* = cint(128) + SO_OOBINLINE* = cint(256) + SO_RCVBUF* = cint(4098) + SO_RCVLOWAT* = cint(4100) + SO_RCVTIMEO* = cint(4102) + SO_REUSEADDR* = cint(4) + SO_SNDBUF* = cint(4097) + SO_SNDLOWAT* = cint(4099) + SO_SNDTIMEO* = cint(4101) + SO_TYPE* = cint(4104) + SOMAXCONN* = cint(128) + MSG_CTRUNC* = cint(32) + MSG_DONTROUTE* = cint(4) + MSG_EOR* = cint(8) + MSG_OOB* = cint(1) + MSG_PEEK* = cint(2) + MSG_TRUNC* = cint(16) + MSG_WAITALL* = cint(64) + AF_INET* = cint(2) + AF_INET6* = cint(30) + AF_UNIX* = cint(1) + AF_UNSPEC* = cint(0) + SHUT_RD* = cint(0) + SHUT_RDWR* = cint(2) + SHUT_WR* = cint(1) + IPPROTO_IP* = cint(0) + IPPROTO_IPV6* = cint(41) + IPPROTO_ICMP* = cint(1) + IPPROTO_RAW* = cint(255) + IPPROTO_TCP* = cint(6) + IPPROTO_UDP* = cint(17) + INADDR_ANY* = cint(0) + INADDR_BROADCAST* = cint(-1) + INET_ADDRSTRLEN* = cint(16) + IPV6_JOIN_GROUP* = cint(12) + IPV6_LEAVE_GROUP* = cint(13) + IPV6_MULTICAST_HOPS* = cint(10) + IPV6_MULTICAST_IF* = cint(9) + IPV6_MULTICAST_LOOP* = cint(11) + IPV6_UNICAST_HOPS* = cint(4) + IPV6_V6ONLY* = cint(27) + IPPORT_RESERVED* = cint(1024) + HOST_NOT_FOUND* = cint(1) + NO_DATA* = cint(4) + NO_RECOVERY* = cint(3) + TRY_AGAIN* = cint(2) + AI_PASSIVE* = cint(1) + AI_CANONNAME* = cint(2) + AI_NUMERICHOST* = cint(4) + AI_NUMERICSERV* = cint(4096) + AI_V4MAPPED* = cint(2048) + AI_ALL* = cint(256) + AI_ADDRCONFIG* = cint(1024) + NI_NOFQDN* = cint(1) + NI_NUMERICHOST* = cint(2) + NI_NAMEREQD* = cint(4) + NI_NUMERICSERV* = cint(8) + NI_DGRAM* = cint(16) + EAI_AGAIN* = cint(2) + EAI_BADFLAGS* = cint(3) + EAI_FAIL* = cint(4) + EAI_FAMILY* = cint(5) + EAI_MEMORY* = cint(6) + EAI_NONAME* = cint(8) + EAI_SERVICE* = cint(9) + EAI_SOCKTYPE* = cint(10) + EAI_SYSTEM* = cint(11) + EAI_OVERFLOW* = cint(14) + POLLIN* = cshort(1) + POLLRDNORM* = cshort(64) + POLLRDBAND* = cshort(128) + POLLPRI* = cshort(2) + POLLOUT* = cshort(4) + POLLWRNORM* = cshort(4) + POLLWRBAND* = cshort(256) + POLLERR* = cshort(8) + POLLHUP* = cshort(16) + POLLNVAL* = cshort(32) + POSIX_SPAWN_RESETIDS* = cint(1) + POSIX_SPAWN_SETPGROUP* = cint(2) + POSIX_SPAWN_SETSIGDEF* = cint(4) + POSIX_SPAWN_SETSIGMASK* = cint(8) + IOFBF* = cint(0) + IONBF* = cint(2) + diff --git a/tools/detect/windows_amd64_consts.nim b/tools/detect/windows_amd64_consts.nim new file mode 100644 index 000000000..d72c9786d --- /dev/null +++ b/tools/detect/windows_amd64_consts.nim @@ -0,0 +1,152 @@ +# Generated by detect.nim +const + E2BIG* = cint(7) + EACCES* = cint(13) + EADDRINUSE* = cint(100) + EADDRNOTAVAIL* = cint(101) + EAFNOSUPPORT* = cint(102) + EAGAIN* = cint(11) + EALREADY* = cint(103) + EBADF* = cint(9) + EBUSY* = cint(16) + ECANCELED* = cint(105) + ECHILD* = cint(10) + ECONNABORTED* = cint(106) + ECONNREFUSED* = cint(107) + ECONNRESET* = cint(108) + EDEADLK* = cint(36) + EDESTADDRREQ* = cint(109) + EDOM* = cint(33) + EEXIST* = cint(17) + EFAULT* = cint(14) + EFBIG* = cint(27) + EHOSTUNREACH* = cint(110) + EILSEQ* = cint(42) + EINPROGRESS* = cint(112) + EINTR* = cint(4) + EINVAL* = cint(22) + EIO* = cint(5) + EISCONN* = cint(113) + EISDIR* = cint(21) + ELOOP* = cint(114) + EMFILE* = cint(24) + EMLINK* = cint(31) + EMSGSIZE* = cint(115) + ENAMETOOLONG* = cint(38) + ENETDOWN* = cint(116) + ENETRESET* = cint(117) + ENETUNREACH* = cint(118) + ENFILE* = cint(23) + ENOBUFS* = cint(119) + ENODEV* = cint(19) + ENOENT* = cint(2) + ENOEXEC* = cint(8) + ENOLCK* = cint(39) + ENOMEM* = cint(12) + ENOPROTOOPT* = cint(123) + ENOSPC* = cint(28) + ENOSYS* = cint(40) + ENOTCONN* = cint(126) + ENOTDIR* = cint(20) + ENOTEMPTY* = cint(41) + ENOTSOCK* = cint(128) + ENOTSUP* = cint(129) + ENOTTY* = cint(25) + ENXIO* = cint(6) + EOPNOTSUPP* = cint(130) + EOVERFLOW* = cint(132) + EPERM* = cint(1) + EPIPE* = cint(32) + EPROTO* = cint(134) + EPROTONOSUPPORT* = cint(135) + EPROTOTYPE* = cint(136) + ERANGE* = cint(34) + EROFS* = cint(30) + ESPIPE* = cint(29) + ESRCH* = cint(3) + ETIMEDOUT* = cint(138) + EWOULDBLOCK* = cint(140) + EXDEV* = cint(18) + O_CREAT* = cint(256) + O_EXCL* = cint(1024) + O_TRUNC* = cint(512) + O_APPEND* = cint(8) + O_ACCMODE* = cint(3) + O_RDONLY* = cint(0) + O_RDWR* = cint(2) + O_WRONLY* = cint(1) + FE_DIVBYZERO* = cint(4) + FE_INEXACT* = cint(32) + FE_INVALID* = cint(1) + FE_OVERFLOW* = cint(8) + FE_UNDERFLOW* = cint(16) + FE_ALL_EXCEPT* = cint(63) + FE_DOWNWARD* = cint(1024) + FE_TONEAREST* = cint(0) + FE_TOWARDZERO* = cint(3072) + FE_UPWARD* = cint(2048) + FE_DFL_ENV* = pointer(nil) + LC_ALL* = cint(0) + LC_COLLATE* = cint(1) + LC_CTYPE* = cint(2) + LC_MONETARY* = cint(3) + LC_NUMERIC* = cint(4) + LC_TIME* = cint(5) + PTHREAD_BARRIER_SERIAL_THREAD* = cint(1) + PTHREAD_CANCEL_ASYNCHRONOUS* = cint(2) + PTHREAD_CANCEL_ENABLE* = cint(1) + PTHREAD_CANCEL_DEFERRED* = cint(0) + PTHREAD_CANCEL_DISABLE* = cint(0) + PTHREAD_CREATE_DETACHED* = cint(4) + PTHREAD_CREATE_JOINABLE* = cint(0) + PTHREAD_EXPLICIT_SCHED* = cint(0) + PTHREAD_INHERIT_SCHED* = cint(8) + PTHREAD_MUTEX_DEFAULT* = cint(0) + PTHREAD_MUTEX_ERRORCHECK* = cint(1) + PTHREAD_MUTEX_NORMAL* = cint(0) + PTHREAD_MUTEX_RECURSIVE* = cint(2) + PTHREAD_PRIO_INHERIT* = cint(8) + PTHREAD_PRIO_NONE* = cint(0) + PTHREAD_PRIO_PROTECT* = cint(16) + PTHREAD_PROCESS_SHARED* = cint(1) + PTHREAD_PROCESS_PRIVATE* = cint(0) + PTHREAD_SCOPE_PROCESS* = cint(0) + PTHREAD_SCOPE_SYSTEM* = cint(16) + F_OK* = cint(0) + R_OK* = cint(4) + W_OK* = cint(2) + X_OK* = cint(1) + SEEK_SET* = cint(0) + SEEK_CUR* = cint(1) + SEEK_END* = cint(2) + SEM_FAILED* = pointer(nil) + S_IFMT* = cint(61440) + S_IFBLK* = cint(12288) + S_IFCHR* = cint(8192) + S_IFIFO* = cint(4096) + S_IFREG* = cint(32768) + S_IFDIR* = cint(16384) + S_IRWXU* = cint(448) + S_IRUSR* = cint(256) + S_IWUSR* = cint(128) + S_IXUSR* = cint(64) + CLOCKS_PER_SEC* = clong(1000) + CLOCK_PROCESS_CPUTIME_ID* = cint(2) + CLOCK_THREAD_CPUTIME_ID* = cint(3) + CLOCK_REALTIME* = cint(0) + TIMER_ABSTIME* = cint(1) + CLOCK_MONOTONIC* = cint(1) + SIGABRT* = cint(22) + SIGFPE* = cint(8) + SIGILL* = cint(4) + SIGINT* = cint(2) + SIGSEGV* = cint(11) + SIGTERM* = cint(15) + SIG_BLOCK* = cint(0) + SIG_UNBLOCK* = cint(1) + SIG_SETMASK* = cint(2) + SCHED_FIFO* = cint(1) + SCHED_RR* = cint(2) + SCHED_OTHER* = cint(0) + IOFBF* = cint(0) + IONBF* = cint(4) diff --git a/tools/detect/windows_i386_consts.nim b/tools/detect/windows_i386_consts.nim new file mode 100644 index 000000000..cd6c475f4 --- /dev/null +++ b/tools/detect/windows_i386_consts.nim @@ -0,0 +1,96 @@ +# Generated by detect.nim +const + E2BIG* = cint(7) + EACCES* = cint(13) + EAGAIN* = cint(11) + EBADF* = cint(9) + EBUSY* = cint(16) + ECHILD* = cint(10) + EDEADLK* = cint(36) + EDOM* = cint(33) + EEXIST* = cint(17) + EFAULT* = cint(14) + EFBIG* = cint(27) + EILSEQ* = cint(42) + EINTR* = cint(4) + EINVAL* = cint(22) + EIO* = cint(5) + EISDIR* = cint(21) + EMFILE* = cint(24) + EMLINK* = cint(31) + ENAMETOOLONG* = cint(38) + ENFILE* = cint(23) + ENODEV* = cint(19) + ENOENT* = cint(2) + ENOEXEC* = cint(8) + ENOLCK* = cint(39) + ENOMEM* = cint(12) + ENOSPC* = cint(28) + ENOSYS* = cint(40) + ENOTDIR* = cint(20) + ENOTEMPTY* = cint(41) + ENOTSUP* = cint(48) + ENOTTY* = cint(25) + ENXIO* = cint(6) + EPERM* = cint(1) + EPIPE* = cint(32) + ERANGE* = cint(34) + EROFS* = cint(30) + ESPIPE* = cint(29) + ESRCH* = cint(3) + ETIMEDOUT* = cint(10060) + EXDEV* = cint(18) + O_CREAT* = cint(256) + O_EXCL* = cint(1024) + O_TRUNC* = cint(512) + O_APPEND* = cint(8) + O_ACCMODE* = cint(3) + O_RDONLY* = cint(0) + O_RDWR* = cint(2) + O_WRONLY* = cint(1) + FE_DIVBYZERO* = cint(4) + FE_INEXACT* = cint(32) + FE_INVALID* = cint(1) + FE_OVERFLOW* = cint(8) + FE_UNDERFLOW* = cint(16) + FE_ALL_EXCEPT* = cint(63) + FE_DOWNWARD* = cint(1024) + FE_TONEAREST* = cint(0) + FE_TOWARDZERO* = cint(3072) + FE_UPWARD* = cint(2048) + FE_DFL_ENV* = pointer(nil) + LC_ALL* = cint(0) + LC_COLLATE* = cint(1) + LC_CTYPE* = cint(2) + LC_MONETARY* = cint(3) + LC_NUMERIC* = cint(4) + LC_TIME* = cint(5) + F_OK* = cint(0) + R_OK* = cint(4) + W_OK* = cint(2) + X_OK* = cint(1) + SEEK_SET* = cint(0) + SEEK_CUR* = cint(1) + SEEK_END* = cint(2) + S_IFMT* = cint(61440) + S_IFBLK* = cint(12288) + S_IFCHR* = cint(8192) + S_IFIFO* = cint(4096) + S_IFREG* = cint(32768) + S_IFDIR* = cint(16384) + S_IRWXU* = cint(448) + S_IRUSR* = cint(256) + S_IWUSR* = cint(128) + S_IXUSR* = cint(64) + CLOCKS_PER_SEC* = clong(1000) + SIGABRT* = cint(22) + SIGFPE* = cint(8) + SIGILL* = cint(4) + SIGINT* = cint(2) + SIGSEGV* = cint(11) + SIGTERM* = cint(15) + SIG_BLOCK* = cint(0) + SIG_UNBLOCK* = cint(1) + SIG_SETMASK* = cint(2) + IOFBF* = cint(0) + IONBF* = cint(4) diff --git a/tools/nimgrep.nim b/tools/nimgrep.nim index c7893fe78..b20e86a68 100644 --- a/tools/nimgrep.nim +++ b/tools/nimgrep.nim @@ -56,7 +56,7 @@ var proc ask(msg: string): string = stdout.write(msg) - result = stdin.readline() + result = stdin.readLine() proc Confirm: TConfirmEnum = while true: @@ -66,7 +66,7 @@ proc Confirm: TConfirmEnum = of "l", "all": return ceAll of "n", "no": return ceNo of "e", "none": return ceNone - else: nil + else: discard proc countLines(s: string, first, last: int): int = var i = first @@ -308,7 +308,7 @@ checkOptions({optIgnoreCase, optIgnoreStyle}, "ignore_case", "ignore_style") if optStdin in options: pattern = ask("pattern [ENTER to exit]: ") - if IsNil(pattern) or pattern.len == 0: quit(0) + if isNil(pattern) or pattern.len == 0: quit(0) if optReplace in options: replacement = ask("replacement [supports $1, $# notations]: ") diff --git a/tools/niminst/buildbat.tmpl b/tools/niminst/buildbat.tmpl index 36e1a3e79..9a19fc70b 100644 --- a/tools/niminst/buildbat.tmpl +++ b/tools/niminst/buildbat.tmpl @@ -1,5 +1,5 @@ #! stdtmpl(subsChar='?') | standard -#proc GenerateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string = +#proc generateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string = # result = "@echo off\nREM Generated by niminst\n" SET CC=gcc SET LINKER=gcc @@ -17,8 +17,8 @@ REM call the compiler: # var linkCmd = "" # for ff in items(c.cfiles[winIndex][cpuIndex]): # let f = ff.toWin -ECHO %CC% %COMP_FLAGS% -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")} -%CC% %COMP_FLAGS% -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")} +ECHO %CC% %COMP_FLAGS% -Ic_code -c ?{f} -o ?{changeFileExt(f, "o")} +%CC% %COMP_FLAGS% -Ic_code -c ?{f} -o ?{changeFileExt(f, "o")} # linkCmd.add(" " & changeFileExt(f, "o")) # end for diff --git a/tools/niminst/buildsh.tmpl b/tools/niminst/buildsh.tmpl index 0fb4907cf..4966af07a 100644 --- a/tools/niminst/buildsh.tmpl +++ b/tools/niminst/buildsh.tmpl @@ -1,5 +1,5 @@ #! stdtmpl(subsChar='?') | standard -#proc GenerateBuildShellScript(c: TConfigData): string = +#proc generateBuildShellScript(c: TConfigData): string = # result = "#! /bin/sh\n# Generated from niminst\n" & # "# Template is in tools/buildsh.tmpl\n" & # "# To regenerate run ``niminst csource`` or ``koch csource``\n" @@ -128,8 +128,8 @@ case $myos in # var linkCmd = "" # for ff in items(c.cfiles[osA][cpuA]): # let f = ff.toUnix - echo "$CC $COMP_FLAGS -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")}" - $CC $COMP_FLAGS -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")} + echo "$CC $COMP_FLAGS -Ic_code -c ?{f} -o ?{changeFileExt(f, "o")}" + $CC $COMP_FLAGS -Ic_code -c ?{f} -o ?{changeFileExt(f, "o")} # add(linkCmd, " \\\n" & changeFileExt(f, "o")) # end for echo "$LINKER -o ?{"$binDir/" & toLower(c.name)} ?linkCmd $LINK_FLAGS" diff --git a/tools/niminst/debcreation.nim b/tools/niminst/debcreation.nim index 982bfaf3d..1f4a8630e 100644 --- a/tools/niminst/debcreation.nim +++ b/tools/niminst/debcreation.nim @@ -101,7 +101,7 @@ proc createChangelog(pkgName, version, maintainer: string): string = addN(" * Initial release.") addN("") addN(" -- " & maintainer & " " & - formatDateTime(getGmTime(getTime()), "+0000")) + formatDateTime(getGMTime(getTime()), "+0000")) proc createRules(): string = ## Creates a nimrod application-agnostic rules file for building deb packages. diff --git a/tools/niminst/deinstall.tmpl b/tools/niminst/deinstall.tmpl index d9abf9228..15f912af6 100644 --- a/tools/niminst/deinstall.tmpl +++ b/tools/niminst/deinstall.tmpl @@ -1,5 +1,5 @@ #! stdtmpl(subsChar='?') | standard -#proc GenerateDeinstallScript(c: TConfigData): string = +#proc generateDeinstallScript(c: TConfigData): string = # result = "#! /bin/sh\n# Generated by niminst\n" # var proj = c.name.toLower diff --git a/tools/niminst/inno.tmpl b/tools/niminst/inno.tmpl index 40edcc790..b9d04755e 100644 --- a/tools/niminst/inno.tmpl +++ b/tools/niminst/inno.tmpl @@ -1,5 +1,5 @@ #! stdtmpl | standard -#proc GenerateInnoSetup(c: TConfigData): string = +#proc generateInnoSetup(c: TConfigData): string = # result = "" ; Default Template for NimInst [Setup] diff --git a/tools/niminst/install.tmpl b/tools/niminst/install.tmpl index fa61eea5e..437e13dfb 100644 --- a/tools/niminst/install.tmpl +++ b/tools/niminst/install.tmpl @@ -1,5 +1,5 @@ #! stdtmpl(subsChar = '?') | standard -#proc GenerateInstallScript(c: TConfigData): string = +#proc generateInstallScript(c: TConfigData): string = # result = "#! /bin/sh\n# Generated by niminst\n" # var proj = c.name.toLower diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index 25ec0d283..bf8a7a84f 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -14,7 +14,7 @@ when haveZipLib: import zipfiles import - os, strutils, parseopt, parsecfg, strtabs, streams, debcreation + os, osproc, strutils, parseopt, parsecfg, strtabs, streams, debcreation const maxOS = 20 # max number of OSes @@ -111,7 +111,7 @@ proc skipRoot(f: string): string = # "abc/def/xyz" --> "def/xyz" var i = 0 result = "" - for component in split(f, {dirsep, altsep}): + for component in split(f, {DirSep, AltSep}): if i > 0: result = result / component inc i if result.len == 0: result = f @@ -126,7 +126,7 @@ include "deinstall.tmpl" const Version = "0.9" - Usage = "niminst - Nimrod Installation Generator Version " & version & """ + Usage = "niminst - Nimrod Installation Generator Version " & Version & """ (c) 2013 Andreas Rumpf Usage: @@ -168,7 +168,7 @@ proc parseCmdLine(c: var TConfigData) = c.infile = addFileExt(key.string, "ini") c.nimrodArgs = cmdLineRest(p).string break - of cmdLongOption, cmdShortOption: + of cmdLongoption, cmdShortOption: case normalize(key.string) of "help", "h": stdout.write(Usage) @@ -188,7 +188,7 @@ proc parseCmdLine(c: var TConfigData) = proc walkDirRecursively(s: var seq[string], root: string) = for k, f in walkDir(root): case k - of pcFile, pcLinkToFile: add(s, UnixToNativePath(f)) + of pcFile, pcLinkToFile: add(s, unixToNativePath(f)) of pcDir: walkDirRecursively(s, f) of pcLinkToDir: nil @@ -199,7 +199,7 @@ proc addFiles(s: var seq[string], patterns: seq[string]) = else: var i = 0 for f in walkFiles(p): - add(s, UnixToNativePath(f)) + add(s, unixToNativePath(f)) inc(i) if i == 0: echo("[Warning] No file found that matches: " & p) @@ -286,7 +286,7 @@ proc parseIniFile(c: var TConfigData) = of "console": c.app = appConsole of "gui": c.app = appGUI else: quit(errorStr(p, "expected: console or gui")) - of "license": c.license = UnixToNativePath(k.value) + of "license": c.license = unixToNativePath(k.value) else: quit(errorStr(p, "unknown variable: " & k.key)) of "var": nil of "winbin": filesOnly(p, k.key, v, c.cat[fcWinBin]) @@ -312,7 +312,7 @@ proc parseIniFile(c: var TConfigData) = of "uninstallscript": c.uninstallScript = yesno(p, v) else: quit(errorStr(p, "unknown variable: " & k.key)) of "unixbin": filesOnly(p, k.key, v, c.cat[fcUnixBin]) - of "innosetup": pathFlags(p, k.key, v, c.innoSetup) + of "innosetup": pathFlags(p, k.key, v, c.innosetup) of "ccompiler": pathFlags(p, k.key, v, c.ccompiler) of "linker": pathFlags(p, k.key, v, c.linker) of "deb": @@ -392,7 +392,7 @@ proc readCFiles(c: var TConfigData, osA, cpuA: int) = quit("Cannot open: " & f) proc buildDir(os, cpu: int): string = - return "nimcache" / ($os & "_" & $cpu) + return "c_code" / ($os & "_" & $cpu) proc getOutputDir(c: var TConfigData): string = if c.outdir.len > 0: c.outdir else: "build" @@ -432,11 +432,11 @@ proc writeInstallScripts(c: var TConfigData) = writeFile(deinstallShFile, generateDeinstallScript(c), "\10") proc srcdist(c: var TConfigData) = - if not existsDir(getOutputDir(c) / "nimcache"): - createDir(getOutputDir(c) / "nimcache") + if not existsDir(getOutputDir(c) / "c_code"): + createDir(getOutputDir(c) / "c_code") for x in walkFiles(c.libpath / "lib/*.h"): - echo(getOutputDir(c) / "nimcache" / extractFilename(x)) - copyFile(dest=getOutputDir(c) / "nimcache" / extractFilename(x), source=x) + echo(getOutputDir(c) / "c_code" / extractFilename(x)) + copyFile(dest=getOutputDir(c) / "c_code" / extractFilename(x), source=x) var winIndex = -1 var intel32Index = -1 var intel64Index = -1 @@ -483,11 +483,11 @@ proc setupDist(c: var TConfigData) = var n = "build" / "install_$#_$#.iss" % [toLower(c.name), c.version] writeFile(n, scrpt, "\13\10") when defined(windows): - if c.innoSetup.path.len == 0: - c.innoSetup.path = "iscc.exe" + 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$# $#" % [quoteIfContainsWhite(c.innoSetup.path), - c.innoSetup.flags, outcmd, n] + var cmd = "$# $# /O$# $#" % [quoteShell(c.innosetup.path), + c.innosetup.flags, outcmd, n] echo(cmd) if execShellCmd(cmd) == 0: removeFile(n) @@ -582,9 +582,8 @@ if actionScripts in c.actions: writeInstallScripts(c) if actionZip in c.actions: when haveZipLib: - zipdist(c) + zipDist(c) else: quit("libzip is not installed") if actionDeb in c.actions: debDist(c) - diff --git a/tools/nimweb.nim b/tools/nimweb.nim index c5d510eac..56d6bcadb 100644 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -200,32 +200,44 @@ proc parseIniFile(c: var TConfigData) = # ------------------- main ---------------------------------------------------- -proc Exec(cmd: string) = +proc exec(cmd: string) = echo(cmd) if os.execShellCmd(cmd) != 0: quit("external program failed") +proc buildDocSamples(c: var TConfigData, destPath: string) = + ## Special case documentation sample proc. + ## + ## The docgen sample needs to be generated twice with different commands, so + ## it didn't make much sense to integrate into the existing generic + ## documentation builders. + const src = "doc"/"docgen_sample.nim" + Exec("nimrod doc $# -o:$# $#" % + [c.nimrodArgs, destPath / "docgen_sample.html", src]) + Exec("nimrod doc2 $# -o:$# $#" % + [c.nimrodArgs, destPath / "docgen_sample2.html", src]) + proc buildDoc(c: var TConfigData, destPath: string) = # call nim for the documentation: for d in items(c.doc): - Exec("nimrod rst2html $# -o:$# --index:on $#" % + exec("nimrod rst2html $# -o:$# --index:on $#" % [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d]) for d in items(c.srcdoc): - Exec("nimrod doc $# -o:$# --index:on $#" % + exec("nimrod doc $# -o:$# --index:on $#" % [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d]) for d in items(c.srcdoc2): - Exec("nimrod doc2 $# -o:$# --index:on $#" % + exec("nimrod doc2 $# -o:$# --index:on $#" % [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d]) - Exec("nimrod buildIndex -o:$1/theindex.html $1" % [destPath]) + exec("nimrod buildIndex -o:$1/theindex.html $1" % [destPath]) proc buildPdfDoc(c: var TConfigData, destPath: string) = if os.execShellCmd("pdflatex -version") != 0: echo "pdflatex not found; no PDF documentation generated" else: for d in items(c.pdf): - Exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d]) + exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d]) # call LaTeX twice to get cross references right: - Exec("pdflatex " & changeFileExt(d, "tex")) - Exec("pdflatex " & changeFileExt(d, "tex")) + exec("pdflatex " & changeFileExt(d, "tex")) + exec("pdflatex " & changeFileExt(d, "tex")) # delete all the crappy temporary files: var pdf = splitFile(d).name & ".pdf" moveFile(dest=destPath / pdf, source=pdf) @@ -239,7 +251,7 @@ proc buildPdfDoc(c: var TConfigData, destPath: string) = proc buildAddDoc(c: var TConfigData, destPath: string) = # build additional documentation (without the index): for d in items(c.webdoc): - Exec("nimrod doc $# -o:$# $#" % + exec("nimrod doc $# -o:$# $#" % [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d]) proc parseNewsTitles(inputFilename: string): seq[TRssItem] = @@ -253,7 +265,7 @@ proc parseNewsTitles(inputFilename: string): seq[TRssItem] = if not open(input, inputFilename): quit("Could not read $1 for rss generation" % [inputFilename]) finally: input.close() - while input.readline(line): + while input.readLine(line): if line =~ reYearMonthDayTitle: result.add(TRssItem(year: matches[0], month: matches[1], day: matches[2], title: matches[3])) @@ -332,7 +344,7 @@ proc main(c: var TConfigData) = for i in 0..c.tabs.len-1: var file = c.tabs[i].val let rss = if file in ["news", "index"]: extractFilename(rssUrl) else: "" - Exec(cmd % [c.nimrodArgs, file]) + exec(cmd % [c.nimrodArgs, file]) var temp = "web" / changeFileExt(file, "temp") var content: string try: @@ -352,7 +364,9 @@ proc main(c: var TConfigData) = copyDir("web/assets", "web/upload/assets") buildNewsRss(c, "web/upload") buildAddDoc(c, "web/upload") + buildDocSamples(c, "web/upload") buildDoc(c, "web/upload") + buildDocSamples(c, "doc") buildDoc(c, "doc") buildPdfDoc(c, "doc") diff --git a/tools/noprefix.nim b/tools/noprefix.nim index e7ec26c56..fe03a9efc 100644 --- a/tools/noprefix.nim +++ b/tools/noprefix.nim @@ -18,44 +18,12 @@ const ("mysql", "mysql"), ("postgres", ""), ("sqlite3", "sqlite3"), - ("tcl", "tcl"), - ("cairo/cairo", "cairo"), - ("cairo/cairoft", "cairo"), - ("cairo/cairowin32", "cairo"), - ("cairo/cairoxlib", "cairo"), - - ("gtk/atk", "atk"), - ("gtk/gdk2", "gdk"), - ("gtk/gdk2pixbuf", "gdk"), - ("gtk/gdkglext", "gdk"), - ("gtk/glib2", ""), - ("gtk/gtk2", "gtk"), - ("gtk/gtkglext", "gtk"), - ("gtk/gtkhtml", "gtk"), - ("gtk/libglade2", "glade"), - ("gtk/pango", "pango"), - ("gtk/pangoutils", "pango"), - - ("lua/lua", "lua"), - ("lua/lauxlib", "luaL"), - ("lua/lualib", "lua"), - - ("opengl/gl", ""), - ("opengl/glext", ""), - ("opengl/wingl", ""), - ("opengl/glu", ""), - ("opengl/glut", ""), - ("opengl/glx", ""), ("pcre/pcre", "pcre") ] proc createDirs = createDir("lib/newwrap/sdl") - createDir("lib/newwrap/cairo") - createDir("lib/newwrap/gtk") - createDir("lib/newwrap/lua") - createDir("lib/newwrap/opengl") createDir("lib/newwrap/pcre") for filename, prefix in items(filelist): diff --git a/web/community.txt b/web/community.txt index 6e2306f8f..b9a0a4196 100644 --- a/web/community.txt +++ b/web/community.txt @@ -9,6 +9,8 @@ Bug reports: http://github.com/Araq/Nimrod/issues. For quickest feedback, join our IRC channel: irc://irc.freenode.net/nimrod (logs at `<http://build.nimrod-code.org/irclogs/>`_). +Check out our Twitter account for latest news and announcements: `@nimrodlang <http://twitter.com/nimrodlang>`_. + How to help =========== diff --git a/web/news.txt b/web/news.txt index 1b492fa97..a045eb880 100644 --- a/web/news.txt +++ b/web/news.txt @@ -3,7 +3,7 @@ News ==== -2013-XX-XX Version 0.9.4 released +2014-XX-XX Version 0.9.4 released ================================= @@ -28,6 +28,18 @@ Changes affecting backwards compatibility require an error code to be passed to them. This error code can be retrieved using the new ``OSLastError`` proc. - ``os.parentDir`` now returns "" if there is no parent dir. +- In CGI scripts stacktraces are shown to the user only + if ``cgi.setStackTraceStdout`` is used. +- The symbol binding rules for clean templates changed: ``bind`` for any + symbol that's not a parameter is now the default. ``mixin`` can be used + to require instantiation scope for a symbol. +- ``quoteIfContainsWhite`` now escapes argument in such way that it can be safely + passed to shell, instead of just adding double quotes. +- ``macros.dumpTree`` and ``macros.dumpLisp`` have been made ``immediate``, + ``dumpTreeImm`` and ``dumpLispImm`` are now deprecated. +- The ``nil`` statement has been deprecated, use an empty ``discard`` instead. +- ``sockets.select`` now prunes sockets that are **not** ready from the list + of sockets given to it. Compiler Additions @@ -41,6 +53,10 @@ Compiler Additions over the generated code. - The compiler now supports a ``computedGoto`` pragma to support very fast dispatching for interpreters and the like. +- The old evaluation engine has been replaced by a proper register based + virtual machine. This fixes numerous bugs for ``nimrod i`` and for macro + evaluation. +- ``--gc:none`` produces warnings when code uses the GC. Language Additions @@ -48,14 +64,18 @@ Language Additions - Arrays can now be declared with a single integer literal ``N`` instead of a range; the range is then ``0..N-1``. -- ``macros.dumpTree`` and ``macros.dumpLisp`` have been made ``immediate``, - ``dumpTreeImm`` and ``dumpLispImm`` are now deprecated. - Added ``requiresInit`` pragma to enforce explicit initialization. -- Added ``using statement`` for better authoring domain-specific languages and - OOP-like syntactic sugar. -- Added ``delegator pragma`` for handling calls to missing procs and fields at - compile-time. -- Support for user-defined type classes have been added. +- Exported templates are allowed to access hidden fields. +- The ``using statement`` enables you to more easily author domain-specific + languages and libraries providing OOP-like syntactic sugar. +- Added a new ``delegator pragma`` for handling calls to missing procs and + fields at compile-time. +- The overload resolution now supports ``static[T]`` params that must be + evaluable at compile-time. +- Support for user-defined type classes has been added. +- The *command syntax* is supported in a lot more contexts. +- Anonymous iterators are now supported and iterators can capture variables + of an outer proc. Tools improvements @@ -309,7 +329,7 @@ Changes affecting backwards compatibility - The Nimrod type system now distinguishes ``openarray`` from ``varargs``. - Templates are now ``hygienic``. Use the ``dirty`` pragma to get the old behaviour. -- Objects that have no ancestor are now implicitely ``final``. Use +- Objects that have no ancestor are now implicitly ``final``. Use the ``inheritable`` pragma to introduce new object roots apart from ``TObject``. - Macros now receive parameters like templates do; use the ``callsite`` builtin @@ -439,7 +459,7 @@ Language Additions - The error pragma can now be used to mark symbols whose *usage* should trigger a compile-time error. - There is a new ``discardable`` pragma that can be used to mark a routine - so that its result can be discarded implicitely. + so that its result can be discarded implicitly. - Added a new ``noinit`` pragma to prevent automatic initialization to zero of variables. - Constants can now have the type ``seq``. diff --git a/web/nimrod.ini b/web/nimrod.ini index 94f196c64..71e36dcdc 100644 --- a/web/nimrod.ini +++ b/web/nimrod.ini @@ -37,7 +37,7 @@ UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson.""" [Documentation] doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros" -doc: "tools;c2nim;niminst;nimgrep;gc;estp;idetools" +doc: "tools;c2nim;niminst;nimgrep;gc;estp;idetools;docgen" pdf: "manual;lib;tut1;tut2;nimrodc;c2nim;niminst;gc" srcdoc2: "system.nim;impure/graphics;wrappers/sdl" srcdoc2: "core/macros;pure/marshal;core/typeinfo;core/unsigned" @@ -45,7 +45,7 @@ srcdoc2: "impure/re;pure/sockets" srcdoc: "system/threads.nim;system/channels.nim;js/dom" srcdoc2: "pure/os;pure/strutils;pure/math;pure/matchers;pure/algorithm" srcdoc2: "pure/complex;pure/times;pure/osproc;pure/pegs;pure/dynlib" -srcdoc2: "pure/parseopt;pure/hashes;pure/strtabs;pure/lexbase" +srcdoc2: "pure/parseopt;pure/parseopt2;pure/hashes;pure/strtabs;pure/lexbase" srcdoc2: "pure/parsecfg;pure/parsexml;pure/parsecsv;pure/parsesql" srcdoc2: "pure/streams;pure/terminal;pure/cgi;impure/web;pure/unicode" srcdoc2: "impure/zipfiles;pure/htmlgen;pure/parseutils;pure/browsers" @@ -62,21 +62,18 @@ srcdoc2: "pure/ftpclient;pure/memfiles;pure/subexes;pure/collections/critbits" srcdoc2: "pure/asyncio;pure/actors;core/locks;pure/oids;pure/endians;pure/uri" srcdoc2: "pure/nimprof;pure/unittest;packages/docutils/highlite" srcdoc2: "packages/docutils/rst;packages/docutils/rstast" -srcdoc2: "packages/docutils/rstgen" +srcdoc2: "packages/docutils/rstgen;pure/logging" webdoc: "wrappers/libcurl;pure/md5;wrappers/mysql;wrappers/iup" webdoc: "wrappers/sqlite3;wrappers/postgres;wrappers/tinyc" -webdoc: "wrappers/python;wrappers/tcl;wrappers/expat;wrappers/pcre" +webdoc: "wrappers/expat;wrappers/pcre" webdoc: "wrappers/tre;wrappers/openssl" webdoc: "wrappers/libuv;wrappers/joyent_http_parser" webdoc: "posix/posix;wrappers/odbcsql;impure/dialogs" webdoc: "wrappers/zip/zlib;wrappers/zip/libzip" -webdoc: "wrappers/cairo" -webdoc: "wrappers/gtk" webdoc: "wrappers/libsvm.nim;wrappers/mongo.nim" webdoc: "windows" -webdoc: "wrappers/x11;wrappers/opengl;wrappers/lua" webdoc: "wrappers/readline/readline;wrappers/readline/history" webdoc: "wrappers/readline/rltypedefs" |