summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/alias/talias.nim19
-rw-r--r--tests/ambsym/mambsym1.nim20
-rw-r--r--tests/ambsym/mambsym2.nim6
-rw-r--r--tests/ambsym/mambsys1.nim14
-rw-r--r--tests/ambsym/mambsys2.nim8
-rw-r--r--tests/ambsym/tambsym.nim16
-rw-r--r--tests/ambsym/tambsym2.nim8
-rw-r--r--tests/ambsym/tambsym3.nim16
-rw-r--r--tests/array/tarray.nim54
-rw-r--r--tests/array/tarray2.nim2
-rw-r--r--tests/array/tarray3.nim4
-rw-r--r--tests/array/tarraycons.nim2
-rw-r--r--tests/array/tarraycons2.nim2
-rw-r--r--tests/array/tarrayplus.nim2
-rw-r--r--tests/array/tarrindx.nim26
-rw-r--r--tests/assert/tfailedassert.nim2
-rw-r--r--tests/assert/tuserassert.nim4
-rw-r--r--tests/assign/moverload_asgn2.nim10
-rw-r--r--tests/assign/tassign.nim62
-rw-r--r--tests/assign/tcopy.nim4
-rw-r--r--tests/assign/tgenericassign.nim2
-rw-r--r--tests/assign/tgenericassigntuples.nim2
-rw-r--r--tests/assign/tobjasgn.nim2
-rw-r--r--tests/assign/toverload_asgn1.nim75
-rw-r--r--tests/assign/toverload_asgn2.nim22
-rw-r--r--tests/async/tasyncawait.nim8
-rw-r--r--tests/async/tasyncconnect.nim34
-rw-r--r--tests/async/tasynceverror.nim66
-rw-r--r--tests/async/tasyncexceptions.nim2
-rw-r--r--tests/async/tasyncfile.nim6
-rw-r--r--tests/async/tasynciossl.nim4
-rw-r--r--tests/async/tasyncudp.nim10
-rw-r--r--tests/benchmark.nim2
-rw-r--r--tests/benchmarks/fannkuch.nim6
-rw-r--r--tests/benchmarks/quicksort.nim2
-rw-r--r--tests/bind/mbind3.nim2
-rw-r--r--tests/bind/tbind1.nim8
-rw-r--r--tests/bind/tbind2.nim4
-rw-r--r--tests/bind/tdatabind.nim12
-rw-r--r--tests/bind/tnicerrorforsymchoice.nim6
-rw-r--r--tests/borrow/tborrow.nim4
-rw-r--r--tests/casestmt/tcaseoverlaprange.nim4
-rw-r--r--tests/casestmt/tcaseoverlaprange2.nim2
-rw-r--r--tests/casestmt/tcasestm.nim2
-rw-r--r--tests/casestmt/tlinearscanend.nim8
-rw-r--r--tests/ccgbugs/taddhigh.nim16
-rw-r--r--tests/ccgbugs/tarray_equality.nim15
-rw-r--r--tests/ccgbugs/tccgen1.nim22
-rw-r--r--tests/ccgbugs/tcgbug.nim2
-rw-r--r--tests/ccgbugs/tcodegenbug1.nim4
-rw-r--r--tests/ccgbugs/tmissingderef.nim13
-rw-r--r--tests/ccgbugs/tnocodegen_for_compiletime.nim9
-rw-r--r--tests/ccgbugs/tpartialcs.nim20
-rw-r--r--tests/ccgbugs/trecursive_closure.nim6
-rw-r--r--tests/ccgbugs/tunsafeaddr.nim19
-rw-r--r--tests/ccgbugs/twrong_discriminant_check.nim30
-rw-r--r--tests/ccgbugs/twrong_setconstr.nim146
-rw-r--r--tests/ccgbugs/twrong_string_asgn.nim19
-rw-r--r--tests/closure/tclosure.nim2
-rw-r--r--tests/closure/tclosure2.nim16
-rw-r--r--tests/closure/tclosure3.nim2
-rw-r--r--tests/closure/tclosure4.nim2
-rw-r--r--tests/closure/tclosurebug2.nim12
-rw-r--r--tests/closure/tinterf.nim4
-rw-r--r--tests/closure/tinvalidclosure.nim2
-rw-r--r--tests/closure/tinvalidclosure2.nim4
-rw-r--r--tests/closure/tjester.nim2
-rw-r--r--tests/closure/tnestedclosure.nim2
-rw-r--r--tests/closure/tnestedproc.nim4
-rw-r--r--tests/closure/uclosures.nim2
-rw-r--r--tests/cnstseq/tcnstseq.nim4
-rw-r--r--tests/cnstseq/tcnstseq2.nim4
-rw-r--r--tests/collections/tapply.nim11
-rw-r--r--tests/collections/tcounttable.nim19
-rw-r--r--tests/collections/thashes.nim75
-rw-r--r--tests/collections/tindexby.nim4
-rw-r--r--tests/collections/tmapit.nim33
-rw-r--r--tests/collections/tsets.nim48
-rw-r--r--tests/collections/ttableconstr.nim2
-rw-r--r--tests/collections/ttables.nim3
-rw-r--r--tests/collections/ttablesref.nim1
-rw-r--r--tests/compiles/trecursive_generic_in_compiles.nim98
-rw-r--r--tests/constr/tconstr1.nim46
-rw-r--r--tests/constr/tconstr2.nim40
-rw-r--r--tests/constraints/tconstraints.nim2
-rw-r--r--tests/controlflow/tblock1.nim22
-rw-r--r--tests/controlflow/tcontinue.nim4
-rw-r--r--tests/controlflow/tnestif.nim36
-rw-r--r--tests/controlflow/tstatret.nim10
-rw-r--r--tests/converter/ttypeconverter1.nim2
-rw-r--r--tests/cpp/tcppraise.nim17
-rw-r--r--tests/cpp/tget_subsystem.nim23
-rw-r--r--tests/cpp/tnativesockets.nim (renamed from tests/cpp/trawsockets.nim)2
-rw-r--r--tests/cpp/tthread_createthread.nim2
-rw-r--r--tests/cpp/ttypeinfo2.nim6
-rw-r--r--tests/cpp/tvector_iterator.nim19
-rw-r--r--tests/cpp/tvectorseq.nim38
-rw-r--r--tests/destructor/tdestructor.nim16
-rw-r--r--tests/destructor/tdestructor2.nim8
-rw-r--r--tests/destructor/tdestructor3.nim47
-rw-r--r--tests/dir with space/tspace.nim2
-rw-r--r--tests/discard/tdiscardable.nim4
-rw-r--r--tests/discard/tneedsdiscard.nim4
-rw-r--r--tests/discard/tvoidcontext.nim12
-rw-r--r--tests/distinct/tcurrncy.nim4
-rw-r--r--tests/distinct/tdistinct_consts.nim20
-rw-r--r--tests/dll/client.nim6
-rw-r--r--tests/dll/server.nim10
-rw-r--r--tests/effects/teffects1.nim8
-rw-r--r--tests/effects/teffects2.nim6
-rw-r--r--tests/effects/teffects3.nim6
-rw-r--r--tests/effects/teffects4.nim6
-rw-r--r--tests/effects/teffects5.nim2
-rw-r--r--tests/effects/teffects6.nim4
-rw-r--r--tests/effects/tgcsafe.nim2
-rw-r--r--tests/effects/tsidee1.nim4
-rw-r--r--tests/effects/tsidee2.nim4
-rw-r--r--tests/effects/tsidee3.nim4
-rw-r--r--tests/effects/tsidee4.nim4
-rw-r--r--tests/enum/tenum.nim16
-rw-r--r--tests/enum/tenum2.nim6
-rw-r--r--tests/enum/tenum3.nim6
-rw-r--r--tests/enum/tenumhole.nim4
-rw-r--r--tests/enum/tenumitems.nim2
-rw-r--r--tests/enum/tenummix.nim6
-rw-r--r--tests/enum/toptions.nim36
-rw-r--r--tests/exception/tcontinuexc.nim2
-rw-r--r--tests/exception/tdefer1.nim27
-rw-r--r--tests/exception/texceptionbreak.nim20
-rw-r--r--tests/exception/texceptions.nim6
-rw-r--r--tests/exception/texcsub.nim8
-rw-r--r--tests/exception/tfinally.nim4
-rw-r--r--tests/exception/tfinally2.nim6
-rw-r--r--tests/exception/tfinally3.nim2
-rw-r--r--tests/exception/tfinally4.nim8
-rw-r--r--tests/exception/tnestedreturn.nim4
-rw-r--r--tests/exception/tnestedreturn2.nim2
-rw-r--r--tests/exception/tonraise.nim8
-rw-r--r--tests/exception/treraise.nim4
-rw-r--r--tests/exception/tunhandledexc.nim2
-rw-r--r--tests/exception/twrongexc.nim2
-rw-r--r--tests/exprs/tstmtexprs.nim8
-rw-r--r--tests/fields/tfieldindex.nim2
-rw-r--r--tests/fields/tfielditerator.nim2
-rw-r--r--tests/fields/tfielditerator2.nim4
-rw-r--r--tests/float/tfloat3.nim2
-rw-r--r--tests/friends/mfriends.nim6
-rw-r--r--tests/gc/closureleak.nim4
-rw-r--r--tests/gc/gcbench.nim330
-rw-r--r--tests/gc/gcemscripten.nim59
-rw-r--r--tests/gc/gcleak2.nim2
-rw-r--r--tests/gc/gcleak4.nim4
-rw-r--r--tests/gc/gcleak5.nim4
-rw-r--r--tests/gc/gctest.nim39
-rw-r--r--tests/gc/refarrayleak.nim2
-rw-r--r--tests/generics/mbind_bracket.nim17
-rw-r--r--tests/generics/mclosed_sym.nim10
-rw-r--r--tests/generics/mmodule_same_as_proc.nim2
-rw-r--r--tests/generics/moverloading_typedesc.nim11
-rw-r--r--tests/generics/t1056.nim2
-rw-r--r--tests/generics/t1789.nim2
-rw-r--r--tests/generics/tbind_bracket.nim20
-rw-r--r--tests/generics/tbintre2.nim2
-rw-r--r--tests/generics/tbintree.nim2
-rw-r--r--tests/generics/tcan_alias_generic.nim3
-rw-r--r--tests/generics/tcan_alias_specialised_generic.nim3
-rw-r--r--tests/generics/tcan_inherit_generic.nim3
-rw-r--r--tests/generics/tcan_specialise_generic.nim3
-rw-r--r--tests/generics/tclosed_sym.nim11
-rw-r--r--tests/generics/tconfusing_arrow.nim2
-rw-r--r--tests/generics/tdictdestruct.nim (renamed from tests/destructor/tdictdestruct.nim)4
-rw-r--r--tests/generics/tdont_use_inner_scope.nim27
-rw-r--r--tests/generics/texplicitgeneric1.nim24
-rw-r--r--tests/generics/texplicitgeneric2.nim20
-rw-r--r--tests/generics/tgeneric1.nim4
-rw-r--r--tests/generics/tgeneric3.nim60
-rw-r--r--tests/generics/tgenericdefaults.nim4
-rw-r--r--tests/generics/tgenericmatcher.nim2
-rw-r--r--tests/generics/tgenericmatcher2.nim2
-rw-r--r--tests/generics/tgenericrefs.nim8
-rw-r--r--tests/generics/tgenericshardcases.nim4
-rw-r--r--tests/generics/tgenericvariant.nim2
-rw-r--r--tests/generics/tinferredgenericprocs.nim3
-rw-r--r--tests/generics/tmap_auto.nim13
-rw-r--r--tests/generics/tmodule_same_as_proc.nim9
-rw-r--r--tests/generics/toverloading_typedesc.nim23
-rw-r--r--tests/generics/tspecialised_is_equivalent.nim1
-rw-r--r--tests/generics/tthread_generic.nim6
-rw-r--r--tests/generics/twrong_field_caching.nim10
-rw-r--r--tests/generics/twrong_floatlit_type.nim46
-rw-r--r--tests/generics/twrong_generic_object.nim21
-rw-r--r--tests/global/globalaux.nim2
-rw-r--r--tests/init/tuninit1.nim8
-rw-r--r--tests/iter/tcountup.nim6
-rw-r--r--tests/iter/titer.nim88
-rw-r--r--tests/iter/titer6.nim8
-rw-r--r--tests/iter/titer8.nim4
-rw-r--r--tests/iter/titer_no_tuple_unpack.nim14
-rw-r--r--tests/iter/tscheduler.nim1
-rw-r--r--tests/js.nim2
-rw-r--r--tests/js/taddr.nim38
-rw-r--r--tests/js/tbyvar.nim10
-rw-r--r--tests/js/tcopying.nim13
-rw-r--r--tests/js/test2.nim15
-rw-r--r--tests/js/testmagic.nim5
-rw-r--r--tests/js/testobjs.nim12
-rw-r--r--tests/js/tobjfieldbyvar.nim20
-rw-r--r--tests/js/trefbyvar.nim35
-rw-r--r--tests/js/tstringitems.nim24
-rw-r--r--tests/js/tunittests.nim4
-rw-r--r--tests/lexer/thexlit.nim2
-rw-r--r--tests/lexer/thexrange.nim2
-rw-r--r--tests/lexer/tident.nim18
-rw-r--r--tests/lexer/tind1.nim2
-rw-r--r--tests/lexer/tlexer.nim120
-rw-r--r--tests/lexer/tstrlits.nim4
-rw-r--r--tests/lexer/tunderscores.nim2
-rw-r--r--tests/lookups/tkoeniglookup.nim2
-rw-r--r--tests/lookups/tredef.nim4
-rw-r--r--tests/macros/tbugs.nim18
-rw-r--r--tests/macros/tclosuremacro.nim2
-rw-r--r--tests/macros/tdebugstmt.nim2
-rw-r--r--tests/macros/tgensym.nim4
-rw-r--r--tests/macros/tgetimpl.nim20
-rw-r--r--tests/macros/tgettype.nim20
-rw-r--r--tests/macros/tlexerex.nim16
-rw-r--r--tests/macros/tmacro2.nim4
-rw-r--r--tests/macros/tmacrogenerics.nim2
-rw-r--r--tests/macros/tmacrostmt.nim2
-rw-r--r--tests/macros/tnodecompare.nim39
-rw-r--r--tests/macros/tprintf.nim20
-rw-r--r--tests/macros/tquotewords.nim4
-rw-r--r--tests/macros/treturnsempty.nim12
-rw-r--r--tests/macros/tsametype.nim41
-rw-r--r--tests/macros/tstaticparamsmacro.nim74
-rw-r--r--tests/macros/ttryparseexpr.nim1
-rw-r--r--tests/macros/tvtable.nim2
-rw-r--r--tests/macros/typesapi2.nim4
-rw-r--r--tests/magics/tlowhigh.nim36
-rw-r--r--tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim336
-rw-r--r--tests/manyloc/keineschweine/dependencies/enet/enet.nim226
-rw-r--r--tests/manyloc/keineschweine/dependencies/enet/testserver.nim12
-rw-r--r--tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim12
-rw-r--r--tests/manyloc/keineschweine/dependencies/nake/nake.nim8
-rw-r--r--tests/manyloc/keineschweine/dependencies/sfml/sfml.nim76
-rw-r--r--tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim24
-rw-r--r--tests/manyloc/keineschweine/dependencies/sfml/sfml_colors.nim2
-rw-r--r--tests/manyloc/keineschweine/enet_server/enet_client.nim30
-rw-r--r--tests/manyloc/keineschweine/enet_server/enet_server.nim86
-rw-r--r--tests/manyloc/keineschweine/enet_server/server_utils.nim10
-rw-r--r--tests/manyloc/keineschweine/keineschweine.nim110
-rw-r--r--tests/manyloc/keineschweine/lib/client_helpers.nim10
-rw-r--r--tests/manyloc/keineschweine/lib/estreams.nim8
-rw-r--r--tests/manyloc/keineschweine/lib/gl.nim346
-rw-r--r--tests/manyloc/keineschweine/lib/glext.nim2334
-rw-r--r--tests/manyloc/keineschweine/lib/glu.nim134
-rw-r--r--tests/manyloc/keineschweine/lib/glut.nim140
-rw-r--r--tests/manyloc/keineschweine/lib/glx.nim60
-rw-r--r--tests/manyloc/keineschweine/lib/idgen.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/input_helpers.nim24
-rw-r--r--tests/manyloc/keineschweine/lib/map_filter.nim6
-rw-r--r--tests/manyloc/keineschweine/lib/math_helpers.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/sfml_stuff.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/sg_assets.nim70
-rw-r--r--tests/manyloc/keineschweine/lib/sg_gui.nim34
-rw-r--r--tests/manyloc/keineschweine/lib/sg_packets.nim10
-rw-r--r--tests/manyloc/keineschweine/lib/vehicles.nim2
-rw-r--r--tests/manyloc/keineschweine/lib/wingl.nim148
-rw-r--r--tests/manyloc/keineschweine/lib/zlib_helpers.nim6
-rw-r--r--tests/manyloc/keineschweine/server/old_dirserver.nim16
-rw-r--r--tests/manyloc/keineschweine/server/old_server_utils.nim4
-rw-r--r--tests/manyloc/keineschweine/server/old_sg_server.nim56
-rw-r--r--tests/manyloc/keineschweine/server/sg_lobby.nim48
-rw-r--r--tests/manyloc/nake/nake.nim8
-rw-r--r--tests/manyloc/nake/nakefile.nim16
-rw-r--r--tests/manyloc/standalone/barebone.nim.cfg1
-rw-r--r--tests/manyloc/standalone/panicoverride.nim6
-rw-r--r--tests/metatype/tautoproc.nim6
-rw-r--r--tests/metatype/tbindtypedesc.nim4
-rw-r--r--tests/metatype/tconstraints.nim2
-rw-r--r--tests/metatype/tmatrix.nim4
-rw-r--r--tests/metatype/tmatrix1.nim4
-rw-r--r--tests/metatype/tmatrix2.nim4
-rw-r--r--tests/metatype/tprocbothmeta.nim10
-rw-r--r--tests/metatype/tstatic_ones.nim28
-rw-r--r--tests/metatype/tstaticparammacro.nim4
-rw-r--r--tests/metatype/tstaticparams.nim4
-rw-r--r--tests/metatype/tstaticvector.nim36
-rw-r--r--tests/metatype/ttypedesc1.nim12
-rw-r--r--tests/metatype/ttypedesc3.nim19
-rw-r--r--tests/metatype/ttypeselectors.nim2
-rw-r--r--tests/metatype/ttypetraits.nim6
-rw-r--r--tests/metatype/tunresolved_return_type.nim20
-rw-r--r--tests/method/mmultim3.nim2
-rw-r--r--tests/method/temptybody.nim2
-rw-r--r--tests/method/tmapper.nim30
-rw-r--r--tests/method/tmethods1.nim8
-rw-r--r--tests/method/tmproto.nim2
-rw-r--r--tests/method/tmultim1.nim6
-rw-r--r--tests/method/tmultim2.nim6
-rw-r--r--tests/method/tmultim4.nim4
-rw-r--r--tests/method/tmultim6.nim6
-rw-r--r--tests/method/trecmeth.nim8
-rw-r--r--tests/misc/minit.nim4
-rw-r--r--tests/misc/mvarious.nim12
-rw-r--r--tests/misc/t99bott.nim2
-rw-r--r--tests/misc/tack.nim30
-rw-r--r--tests/misc/tatomic.nim4
-rw-r--r--tests/misc/tcmdline.nim6
-rw-r--r--tests/misc/tcolonisproc.nim2
-rw-r--r--tests/misc/tdllvar.nim2
-rw-r--r--tests/misc/temit.nim4
-rw-r--r--tests/misc/tendian.nim2
-rw-r--r--tests/misc/tevents.nim4
-rw-r--r--tests/misc/tfib.nim4
-rw-r--r--tests/misc/tgetstartmilsecs.nim2
-rw-r--r--tests/misc/thallo.nim6
-rw-r--r--tests/misc/theaproots.nim6
-rw-r--r--tests/misc/thintoff.nim2
-rw-r--r--tests/misc/tinit.nim12
-rw-r--r--tests/misc/tinout.nim18
-rw-r--r--tests/misc/tinvalidnewseq.nim8
-rw-r--r--tests/misc/tissue710.nim2
-rw-r--r--tests/misc/tlastmod.nim36
-rw-r--r--tests/misc/tlocals.nim4
-rw-r--r--tests/misc/tloops.nim2
-rw-r--r--tests/misc/tmandelbrot.nim4
-rw-r--r--tests/misc/tmissingnilcheck.nim2
-rw-r--r--tests/misc/tnew.nim98
-rw-r--r--tests/misc/tnewderef.nim2
-rw-r--r--tests/misc/tnewsets.nim12
-rw-r--r--tests/misc/tnewuns.nim24
-rw-r--r--tests/misc/tnoinst.nim2
-rw-r--r--tests/misc/tnoop.nim2
-rw-r--r--tests/misc/tnot.nim11
-rw-r--r--tests/misc/tparedef.nim8
-rw-r--r--tests/misc/tpos.nim58
-rw-r--r--tests/misc/tquicksort.nim8
-rw-r--r--tests/misc/tradix.nim168
-rw-r--r--tests/misc/trawstr.nim10
-rw-r--r--tests/misc/tromans.nim6
-rw-r--r--tests/misc/tsimplesort.nim6
-rw-r--r--tests/misc/tsimtych.nim10
-rw-r--r--tests/misc/tsizeof.nim20
-rw-r--r--tests/misc/tsortdev.nim8
-rw-r--r--tests/misc/tstrace.nim32
-rw-r--r--tests/misc/tstrange.nim34
-rw-r--r--tests/misc/tstrdesc.nim28
-rw-r--r--tests/misc/tunsigned64mod.nim14
-rw-r--r--tests/misc/tunsignedinc.nim14
-rw-r--r--tests/misc/tunsignedmisc.nim68
-rw-r--r--tests/misc/tvarious1.nim8
-rw-r--r--tests/misc/tvarnums.nim272
-rw-r--r--tests/mmaptest.nim18
-rw-r--r--tests/modules/mnamspc1.nim4
-rw-r--r--tests/modules/mnamspc2.nim6
-rw-r--r--tests/modules/mopaque.nim10
-rw-r--r--tests/modules/mrecmod.nim2
-rw-r--r--tests/modules/mrecmod2.nim4
-rw-r--r--tests/modules/texport.nim4
-rw-r--r--tests/modules/tnamspc.nim10
-rw-r--r--tests/modules/topaque.nim8
-rw-r--r--tests/modules/trecmod.nim4
-rw-r--r--tests/namedparams/tnamedparams.nim6
-rw-r--r--tests/namedparams/tnamedparams2.nim6
-rw-r--r--tests/namedparams/tnamedparams3.nim10
-rw-r--r--tests/newconfig/tfoo.nim10
-rw-r--r--tests/newconfig/tfoo.nims18
-rw-r--r--tests/notnil/tnotnil.nim2
-rw-r--r--tests/notnil/tnotnil1.nim4
-rw-r--r--tests/notnil/tnotnil_in_generic.nim6
-rw-r--r--tests/objects/tillegal_recursion.nim7
-rw-r--r--tests/objects/tobjcov.nim4
-rw-r--r--tests/objects/tobject.nim2
-rw-r--r--tests/objects/tobject2.nim2
-rw-r--r--tests/objects/tobject3.nim2
-rw-r--r--tests/objects/tobjects.nim2
-rw-r--r--tests/objects/tobjloop.nim15
-rw-r--r--tests/objects/tobjpragma.nim10
-rw-r--r--tests/objects/tofopr.nim8
-rw-r--r--tests/objects/toop.nim6
-rw-r--r--tests/objects/toop1.nim24
-rw-r--r--tests/objects/trefobjsyntax2.nim19
-rw-r--r--tests/objects/trefobjsyntax3.nim28
-rw-r--r--tests/objvariant/tcheckedfield1.nim4
-rw-r--r--tests/osproc/ta.nim2
-rw-r--r--tests/overflw/toverflw.nim30
-rw-r--r--tests/overflw/tovfint.nim34
-rw-r--r--tests/overload/toverl2.nim6
-rw-r--r--tests/overload/toverl3.nim6
-rw-r--r--tests/overload/toverl4.nim2
-rw-r--r--tests/overload/toverprc.nim2
-rw-r--r--tests/overload/toverwr.nim26
-rw-r--r--tests/overload/tspec.nim39
-rw-r--r--tests/overload/tstmtoverload.nim38
-rw-r--r--tests/parallel/nim.cfg1
-rw-r--r--tests/parallel/tgc_unsafe2.nim39
-rw-r--r--tests/parallel/tparfind.nim28
-rw-r--r--tests/parallel/tptr_to_ref.nim71
-rw-r--r--tests/parallel/treadafterwrite.nim2
-rw-r--r--tests/parallel/tuseafterdef.nim4
-rw-r--r--tests/parallel/twrong_refcounts.nim53
-rw-r--r--tests/parser/tcommand_as_expr.nim1
-rw-r--r--tests/parser/tdomulttest.nim2
-rw-r--r--tests/parser/tinvcolonlocation1.nim12
-rw-r--r--tests/parser/tinvcolonlocation2.nim15
-rw-r--r--tests/parser/tinvcolonlocation3.nim12
-rw-r--r--tests/parser/tinvwhen.nim16
-rw-r--r--tests/parser/toprprec.nim8
-rw-r--r--tests/parser/tstrongspaces.nim35
-rw-r--r--tests/parser/ttupleunpack.nim35
-rw-r--r--tests/pragmas/tbitsize.nim22
-rw-r--r--tests/pragmas/tpush.nim30
-rw-r--r--tests/pragmas/tsym_as_pragma.nim8
-rw-r--r--tests/proc/tnestprc.nim8
-rw-r--r--tests/procvar/tprocvar.nim2
-rw-r--r--tests/procvar/tprocvar2.nim28
-rw-r--r--tests/range/tbug499771.nim4
-rw-r--r--tests/range/tcolors.nim28
-rw-r--r--tests/range/tmatrix3.nim8
-rw-r--r--tests/range/tsubrange.nim6
-rw-r--r--tests/range/tsubrange2.nim6
-rw-r--r--tests/range/tsubrange3.nim4
-rw-r--r--tests/rational/trat_float.nim9
-rw-r--r--tests/rational/trat_init.nim10
-rw-r--r--tests/readme.txt23
-rw-r--r--tests/realtimeGC/cmain.c67
-rw-r--r--tests/realtimeGC/main.nim.cfg6
-rw-r--r--tests/realtimeGC/nmain.nim46
-rw-r--r--tests/realtimeGC/readme.txt21
-rw-r--r--tests/realtimeGC/shared.nim63
-rw-r--r--tests/realtimeGC/shared.nim.cfg5
-rw-r--r--tests/rectest.nim12
-rw-r--r--tests/rodfiles/amethods.nim2
-rw-r--r--tests/rodfiles/bmethods.nim2
-rw-r--r--tests/rodfiles/bmethods2.nim2
-rw-r--r--tests/rodfiles/deadg.nim4
-rw-r--r--tests/rodfiles/gtkex1.nim28
-rw-r--r--tests/rodfiles/gtkex2.nim8
-rw-r--r--tests/rodfiles/hallo2.nim2
-rw-r--r--tests/seq/tseq2.nim4
-rw-r--r--tests/seq/tseqcon.nim90
-rw-r--r--tests/seq/tseqtuple.nim2
-rw-r--r--tests/seq/ttoseq.nim4
-rw-r--r--tests/sets/tsets.nim268
-rw-r--r--tests/sets/tsets2.nim10
-rw-r--r--tests/showoff/thtml1.nim2
-rw-r--r--tests/stckovfl.nim4
-rw-r--r--tests/stdlib/nre/captures.nim59
-rw-r--r--tests/stdlib/nre/escape.nim7
-rw-r--r--tests/stdlib/nre/find.nim25
-rw-r--r--tests/stdlib/nre/init.nim36
-rw-r--r--tests/stdlib/nre/match.nim18
-rw-r--r--tests/stdlib/nre/misc.nim16
-rw-r--r--tests/stdlib/nre/optional_nonstrict.nim3
-rw-r--r--tests/stdlib/nre/replace.nim20
-rw-r--r--tests/stdlib/nre/split.nim53
-rw-r--r--tests/stdlib/talgorithm.nim2
-rw-r--r--tests/stdlib/tcritbits.nim2
-rw-r--r--tests/stdlib/tdialogs.nim17
-rw-r--r--tests/stdlib/tformat.nim12
-rw-r--r--tests/stdlib/thtmlparser2813.nim45
-rw-r--r--tests/stdlib/tio.nim14
-rw-r--r--tests/stdlib/tlists.nim12
-rw-r--r--tests/stdlib/tmarshal.nim2
-rw-r--r--tests/stdlib/tmath.nim6
-rw-r--r--tests/stdlib/tmath2.nim170
-rw-r--r--tests/stdlib/tmemfiles1.nim12
-rw-r--r--tests/stdlib/tmemfiles2.nim39
-rw-r--r--tests/stdlib/tmemlines.nim5
-rw-r--r--tests/stdlib/tmemlinesBuf.nim6
-rw-r--r--tests/stdlib/tmemslices.nim6
-rw-r--r--tests/stdlib/tmitems.nim4
-rw-r--r--tests/stdlib/tnre.nim9
-rw-r--r--tests/stdlib/tos.nim4
-rw-r--r--tests/stdlib/tosprocterminate.nim2
-rw-r--r--tests/stdlib/tparscfg.nim4
-rw-r--r--tests/stdlib/tparsopt.nim16
-rw-r--r--tests/stdlib/tpegs.nim346
-rw-r--r--tests/stdlib/tposix.nim8
-rw-r--r--tests/stdlib/tquit.nim12
-rw-r--r--tests/stdlib/tregex.nim40
-rw-r--r--tests/stdlib/treguse.nim42
-rw-r--r--tests/stdlib/treloop.nim9
-rw-r--r--tests/stdlib/trepr.nim4
-rw-r--r--tests/stdlib/trepr2.nim64
-rw-r--r--tests/stdlib/tsplit.nim2
-rw-r--r--tests/stdlib/tstreams2.nim13
-rw-r--r--tests/stdlib/tstrset.nim6
-rw-r--r--tests/stdlib/tstrtabs.nim10
-rw-r--r--tests/stdlib/tstrutil.nim48
-rw-r--r--tests/stdlib/ttime.nim12
-rw-r--r--tests/stdlib/tunittest.nim85
-rw-r--r--tests/stdlib/twalker.nim26
-rw-r--r--tests/stdlib/twchartoutf8.nim110
-rw-r--r--tests/system/io.nim2
-rw-r--r--tests/system/tfloatToString.nim22
-rw-r--r--tests/system/toString.nim35
-rw-r--r--tests/system/tsettostring.nim8
-rw-r--r--tests/template/annotate.nim2
-rw-r--r--tests/template/mtempl5.nim6
-rw-r--r--tests/template/otests.nim438
-rw-r--r--tests/template/sunset.tmpl2
-rw-r--r--tests/template/t_otemplates.nim678
-rw-r--r--tests/template/tdefault_nil.nim14
-rw-r--r--tests/template/thygienictempl.nim4
-rw-r--r--tests/template/tmodulealias.nim4
-rw-r--r--tests/template/tstempl.nim6
-rw-r--r--tests/template/tstmt_semchecked_twice.nim30
-rw-r--r--tests/template/ttempl.nim4
-rw-r--r--tests/template/ttempl2.nim8
-rw-r--r--tests/template/ttempl3.nim16
-rw-r--r--tests/template/twhen_gensym.nim13
-rw-r--r--tests/template/twrongmapit.nim8
-rw-r--r--tests/template/twrongopensymchoice.nim6
-rw-r--r--tests/template/twrongsymkind.nim20
-rw-r--r--tests/testament/backend.nim20
-rw-r--r--tests/testament/caasdriver.nim8
-rw-r--r--tests/testament/categories.nim41
-rw-r--r--tests/testament/htmlgen.nim12
-rw-r--r--tests/testament/specs.nim30
-rw-r--r--tests/testament/tester.nim238
-rw-r--r--tests/testdata/doc1.xml2
-rw-r--r--tests/testdata/string.txt2
-rw-r--r--tests/threads/tactors2.nim2
-rw-r--r--tests/threads/threadex.nim2
-rw-r--r--tests/threads/tthreadanalysis.nim4
-rw-r--r--tests/threads/tthreadanalysis2.nim4
-rw-r--r--tests/threads/tthreadheapviolation1.nim2
-rw-r--r--tests/threads/ttryrecv.nim2
-rw-r--r--tests/trmacros/targlist.nim4
-rw-r--r--tests/trmacros/tcse.nim2
-rw-r--r--tests/trmacros/tmatrix.nim2
-rw-r--r--tests/trmacros/tstar.nim2
-rw-r--r--tests/trmacros/tstmtlist.nim4
-rw-r--r--tests/tuples/tuint_tuple.nim10
-rw-r--r--tests/tuples/tunpack_asgn.nim32
-rw-r--r--tests/tuples/tuple_with_nil.nim766
-rw-r--r--tests/tuples/tuple_with_seq.nim46
-rw-r--r--tests/tuples/twrongtupleaccess.nim2
-rw-r--r--tests/typerel/t2plus.nim22
-rw-r--r--tests/typerel/tno_gcmem_in_shared.nim1
-rw-r--r--tests/typerel/tno_int_in_bool_context.nim4
-rw-r--r--tests/typerel/trectuples.nim2
-rw-r--r--tests/typerel/trefs.nim32
-rw-r--r--tests/typerel/tregionptrs.nim2
-rw-r--r--tests/typerel/tregionptrs2.nim4
-rw-r--r--tests/typerel/tsecondarrayproperty.nim2
-rw-r--r--tests/typerel/tstr_as_openarray.nim22
-rw-r--r--tests/typerel/ttuple1.nim2
-rw-r--r--tests/typerel/ttypedesc_as_genericparam1.nim6
-rw-r--r--tests/typerel/ttypedesc_as_genericparam2.nim9
-rw-r--r--tests/typerel/ttypenoval.nim4
-rw-r--r--tests/typerel/tvarargsexpr.nim14
-rw-r--r--tests/typerel/tvoid.nim4
-rw-r--r--tests/typerel/typalias.nim6
-rw-r--r--tests/typerel/typeof_in_template.nim16
-rw-r--r--tests/types/tauto_excessive.nim20
-rw-r--r--tests/types/temptyseqs.nim66
-rw-r--r--tests/types/tfinalobj.nim4
-rw-r--r--tests/types/tforwty.nim18
-rw-r--r--tests/types/tforwty2.nim44
-rw-r--r--tests/types/tillegaltyperecursion.nim16
-rw-r--r--tests/types/tinheritref.nim2
-rw-r--r--tests/types/tisop.nim2
-rw-r--r--tests/types/tisopr.nim41
-rw-r--r--tests/varres/tvarres1.nim4
-rw-r--r--tests/varres/tvarres2.nim4
-rw-r--r--tests/varres/tvarres3.nim4
-rw-r--r--tests/varres/tvartup.nim2
-rw-r--r--tests/varstmt/tlet.nim2
-rw-r--r--tests/varstmt/tvardecl.nim18
-rw-r--r--tests/vm/tarrayboundeval.nim4
-rw-r--r--tests/vm/tasmparser.nim12
-rw-r--r--tests/vm/tconsteval.nim2
-rw-r--r--tests/vm/tconstobj.nim36
-rw-r--r--tests/vm/tconsttable2.nim81
-rw-r--r--tests/vm/teval1.nim2
-rw-r--r--tests/vm/tforwardproc.nim17
-rw-r--r--tests/vm/tldconst.nim2
-rw-r--r--tests/vm/trgba.nim26
-rw-r--r--tests/vm/tsimpleglobals.nim16
-rw-r--r--tests/vm/tslurp.nim12
-rw-r--r--tests/vm/tstaticprintseq.nim12
-rw-r--r--tests/vm/tswap.nim24
-rw-r--r--tests/vm/twrongconst.nim2
-rw-r--r--tests/vm/tyaytypedesc.nim21
587 files changed, 10209 insertions, 5414 deletions
diff --git a/tests/alias/talias.nim b/tests/alias/talias.nim
index 819289c2e..810ea2095 100644
--- a/tests/alias/talias.nim
+++ b/tests/alias/talias.nim
@@ -6,7 +6,7 @@ type
 
 proc isPartOf*[S, T](a: S, b: T): TAnalysisResult {.
   magic: "IsPartOf", noSideEffect.}
-  ## not yet exported properly. 
+  ## not yet exported properly.
 
 template compileTimeAssert(cond: expr) =
   when not cond:
@@ -30,37 +30,38 @@ type
     c: char
     se: seq[TA]
 
-proc p(param1, param2: TC): TC =
+proc p(param1, param2: TC, param3: var TC): TC =
   var
     local: TC
     plocal: ptr TC
     plocal2: ptr TA
-    
+
   local.arr <| local
   local.arr[0] <| local
   local.arr[2] !<| local.arr[1]
-  
+
   plocal2[] ?<| local
 
   param1 ?<| param2
-  
+  local ?<| param3
+
   local.arr[0] !<| param1
   local.arr !<| param1
   local.le[] ?<| param1
-  
+
   param1 !<| local.arr[0]
   param1 !<| local.arr
   param1 ?<| local.le[]
-  
+
   result !<| local
   result <| result
 
 var
   a, b: int
   x: TC
-  
+
 a <| a
 a !<| b
 
-discard p(x, x)
+discard p(x, x, x)
 
diff --git a/tests/ambsym/mambsym1.nim b/tests/ambsym/mambsym1.nim
index d9d57b5e5..c4902b1b4 100644
--- a/tests/ambsym/mambsym1.nim
+++ b/tests/ambsym/mambsym1.nim
@@ -1,10 +1,10 @@
-import mambsym2 # import TExport

-

-type

-  TExport* = enum x, y, z

-  TOtherEnum* = enum mDec, mInc, mAssign

-

-proc ha() =

-  var

-    x: TExport # no error

-  discard

+import mambsym2 # import TExport
+
+type
+  TExport* = enum x, y, z
+  TOtherEnum* = enum mDec, mInc, mAssign
+
+proc ha() =
+  var
+    x: TExport # no error
+  discard
diff --git a/tests/ambsym/mambsym2.nim b/tests/ambsym/mambsym2.nim
index eac8de6ba..21d980073 100644
--- a/tests/ambsym/mambsym2.nim
+++ b/tests/ambsym/mambsym2.nim
@@ -1,3 +1,3 @@
-type

-  TExport* = enum a, b, c

-  

+type
+  TExport* = enum a, b, c
+
diff --git a/tests/ambsym/mambsys1.nim b/tests/ambsym/mambsys1.nim
index 04f9561d3..22e54cb94 100644
--- a/tests/ambsym/mambsys1.nim
+++ b/tests/ambsym/mambsys1.nim
@@ -1,7 +1,7 @@
-import mambsys2 # import TExport

-

-type

-  TExport* = enum x, y, z

-

-proc foo*(x: int) =

-  discard

+import mambsys2 # import TExport
+
+type
+  TExport* = enum x, y, z
+
+proc foo*(x: int) =
+  discard
diff --git a/tests/ambsym/mambsys2.nim b/tests/ambsym/mambsys2.nim
index d59706865..ef63e4f7e 100644
--- a/tests/ambsym/mambsys2.nim
+++ b/tests/ambsym/mambsys2.nim
@@ -1,4 +1,4 @@
-type

-  TExport* = enum x, y, z # exactly the same type!

-

-proc foo*(x: int) = discard

+type
+  TExport* = enum x, y, z # exactly the same type!
+
+proc foo*(x: int) = discard
diff --git a/tests/ambsym/tambsym.nim b/tests/ambsym/tambsym.nim
index 902274648..d9115e16d 100644
--- a/tests/ambsym/tambsym.nim
+++ b/tests/ambsym/tambsym.nim
@@ -3,13 +3,13 @@ discard """
   line: 11
   errormsg: "ambiguous identifier"
 """
-# Test ambiguous symbols

-

-import mambsym1, mambsym2

-

-var

-  v: TExport #ERROR_MSG ambiguous identifier

-

-v = y

+# Test ambiguous symbols
+
+import mambsym1, mambsym2
+
+var
+  v: TExport #ERROR_MSG ambiguous identifier
+
+v = y
 
 
diff --git a/tests/ambsym/tambsym2.nim b/tests/ambsym/tambsym2.nim
index 745427c54..8e288e73a 100644
--- a/tests/ambsym/tambsym2.nim
+++ b/tests/ambsym/tambsym2.nim
@@ -8,12 +8,12 @@ type
   TMyType = object
     len: int
     data: string
-    
+
 proc len(x: TMyType): int {.inline.} = return x.len
 
-proc x(s: TMyType, len: int) = 
-  writeln(stdout, len(s))
-  
+proc x(s: TMyType, len: int) =
+  writeLine(stdout, len(s))
+
 var
   m: TMyType
 m.len = 7
diff --git a/tests/ambsym/tambsym3.nim b/tests/ambsym/tambsym3.nim
index 0155f258c..b25dadfd6 100644
--- a/tests/ambsym/tambsym3.nim
+++ b/tests/ambsym/tambsym3.nim
@@ -3,13 +3,13 @@ discard """
   line: 11
   errormsg: "ambiguous identifier"
 """
-# Test ambiguous symbols

-

-import mambsym1, times

-

-var

-  v = mDec #ERROR_MSG ambiguous identifier

-

-writeln(stdout, ord(v))

+# Test ambiguous symbols
+
+import mambsym1, times
+
+var
+  v = mDec #ERROR_MSG ambiguous identifier
+
+writeLine(stdout, ord(v))
 
 
diff --git a/tests/array/tarray.nim b/tests/array/tarray.nim
index 01fbdf422..9cfb758e2 100644
--- a/tests/array/tarray.nim
+++ b/tests/array/tarray.nim
@@ -2,33 +2,33 @@ discard """
   file: "tarray.nim"
   output: "100124"
 """
-# simple check for one dimensional arrays

-

-type

-  TMyArray = array[0..2, int]

-  TMyRecord = tuple[x, y: int]

-

-proc sum(a: TMyarray): int =

-  result = 0

-  var i = 0

-  while i < len(a):

-    inc(result, a[i])

-    inc(i)

-

-proc sum(a: openarray[int]): int =

-  result = 0

-  var i = 0

-  while i < len(a):

-    inc(result, a[i])

-    inc(i)

-

-proc getPos(r: TMyRecord): int =

-  result = r.x + r.y

-

-write(stdout, sum([1, 2, 3, 4]))

-write(stdout, sum([]))

-write(stdout, getPos( (x: 5, y: 7) ))

-#OUT 10012

+# simple check for one dimensional arrays
+
+type
+  TMyArray = array[0..2, int]
+  TMyRecord = tuple[x, y: int]
+
+proc sum(a: TMyarray): int =
+  result = 0
+  var i = 0
+  while i < len(a):
+    inc(result, a[i])
+    inc(i)
+
+proc sum(a: openarray[int]): int =
+  result = 0
+  var i = 0
+  while i < len(a):
+    inc(result, a[i])
+    inc(i)
+
+proc getPos(r: TMyRecord): int =
+  result = r.x + r.y
+
+write(stdout, sum([1, 2, 3, 4]))
+write(stdout, sum([]))
+write(stdout, getPos( (x: 5, y: 7) ))
+#OUT 10012
 
 # bug #1669
 let filesToCreate = ["tempdir/fl1.a", "tempdir/fl2.b",
diff --git a/tests/array/tarray2.nim b/tests/array/tarray2.nim
index b6adabb45..1951e6e97 100644
--- a/tests/array/tarray2.nim
+++ b/tests/array/tarray2.nim
@@ -9,7 +9,7 @@ type
 
   TObj = object
     arr: TMyarray
-  
+
 proc mul(a, b: TMyarray): TMyArray =
   result = a
   for i in 0..len(a)-1:
diff --git a/tests/array/tarray3.nim b/tests/array/tarray3.nim
index d28778357..24bf26fda 100644
--- a/tests/array/tarray3.nim
+++ b/tests/array/tarray3.nim
@@ -2,9 +2,9 @@ discard """
   file: "tarray3.nim"
   output: "3"
 """
-# simple check for two dimensional arrays

+# simple check for two dimensional arrays
 
-const  
+const
   myData = [[1,2,3], [4, 5, 6]]
 
 echo myData[0][2] #OUT 3
diff --git a/tests/array/tarraycons.nim b/tests/array/tarraycons.nim
index 7de518b6e..9f09fd405 100644
--- a/tests/array/tarraycons.nim
+++ b/tests/array/tarraycons.nim
@@ -7,7 +7,7 @@ discard """
 type
   TEnum = enum
     eA, eB, eC, eD, eE, eF
-    
+
 const
   myMapping: array[TEnum, array[0..1, int]] = [
     eA: [1, 2],
diff --git a/tests/array/tarraycons2.nim b/tests/array/tarraycons2.nim
index 0b2a42c2f..72d9e374e 100644
--- a/tests/array/tarraycons2.nim
+++ b/tests/array/tarraycons2.nim
@@ -6,7 +6,7 @@ discard """
 type
   TEnum = enum
     eA, eB, eC, eD, eE, eF
-    
+
 const
   myMapping: array[TEnum, array[0..1, int]] = [
     eA: [1, 2],
diff --git a/tests/array/tarrayplus.nim b/tests/array/tarrayplus.nim
index 0ea349f4f..33921c0e1 100644
--- a/tests/array/tarrayplus.nim
+++ b/tests/array/tarrayplus.nim
@@ -6,7 +6,7 @@ proc `+`*[R, T] (v1, v2: array[R, T]): array[R, T] =
   for i in low(v1)..high(v1):
     result[i] = v1[i] + v2[i]
 
-var 
+var
   v1: array[0..2, float] = [3.0, 1.2, 3.0]
   v2: array[0..1, float] = [2.0, 1.0]
   v3 = v1 + v2
diff --git a/tests/array/tarrindx.nim b/tests/array/tarrindx.nim
index 13919cc2c..a8d72b338 100644
--- a/tests/array/tarrindx.nim
+++ b/tests/array/tarrindx.nim
@@ -1,13 +1,13 @@
-# test another strange bug ... (I hate this compiler; it is much too buggy!)

-

-proc putEnv(key, val: string) =

-  # XXX: we have to leak memory here, as we cannot

-  # free it before the program ends (says Borland's

-  # documentation)

-  var

-    env: ptr array[0..500000, char]

-  env = cast[ptr array[0..500000, char]](alloc(len(key) + len(val) + 2))

-  for i in 0..len(key)-1: env[i] = key[i]

-  env[len(key)] = '='

-  for i in 0..len(val)-1:

-    env[len(key)+1+i] = val[i]

+# test another strange bug ... (I hate this compiler; it is much too buggy!)
+
+proc putEnv(key, val: string) =
+  # XXX: we have to leak memory here, as we cannot
+  # free it before the program ends (says Borland's
+  # documentation)
+  var
+    env: ptr array[0..500000, char]
+  env = cast[ptr array[0..500000, char]](alloc(len(key) + len(val) + 2))
+  for i in 0..len(key)-1: env[i] = key[i]
+  env[len(key)] = '='
+  for i in 0..len(val)-1:
+    env[len(key)+1+i] = val[i]
diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim
index 729cdcac7..1e6764471 100644
--- a/tests/assert/tfailedassert.nim
+++ b/tests/assert/tfailedassert.nim
@@ -30,7 +30,7 @@ proc bar: int =
   # local overrides that are active only
   # in this proc
   onFailedAssert(msg): echo "WARNING: " & msg
-    
+
   assert(false, "first assertion from bar")
 
   onFailedAssert(msg):
diff --git a/tests/assert/tuserassert.nim b/tests/assert/tuserassert.nim
index 57b229ca9..7bb0a7fc0 100644
--- a/tests/assert/tuserassert.nim
+++ b/tests/assert/tuserassert.nim
@@ -2,12 +2,12 @@ discard """
   output: "x == 45ugh"
 """
 
-template myAssert(cond: expr) = 
+template myAssert(cond: expr) =
   when 3 <= 3:
     let c = cond.astToStr
     if not cond:
       echo c, "ugh"
-  
+
 var x = 454
 myAssert(x == 45)
 
diff --git a/tests/assign/moverload_asgn2.nim b/tests/assign/moverload_asgn2.nim
new file mode 100644
index 000000000..6620adbeb
--- /dev/null
+++ b/tests/assign/moverload_asgn2.nim
@@ -0,0 +1,10 @@
+type
+  Concrete* = object
+    a*, b*: string
+    rc*: int # refcount
+
+proc `=`(d: var Concrete; src: Concrete) =
+  shallowCopy(d.a, src.a)
+  shallowCopy(d.b, src.b)
+  dec d.rc
+  d.rc = src.rc + 1
diff --git a/tests/assign/tassign.nim b/tests/assign/tassign.nim
index f51c20783..4c173d04f 100644
--- a/tests/assign/tassign.nim
+++ b/tests/assign/tassign.nim
@@ -1,31 +1,31 @@
-# Test the assignment operator for complex types which need RTTI

-

-type

-  TRec = object

-    x, y: int

-    s: string

-    seq: seq[string]

-    arr: seq[seq[array[0..3, string]]]

-  TRecSeq = seq[TRec]

-

-proc test() =

-  var

-    a, b: TRec

-  a.x = 1

-  a.y = 2

-  a.s = "Hallo!"

-  a.seq = @["abc", "def", "ghi", "jkl"]

-  a.arr = @[]

-  setLen(a.arr, 4)

-  a.arr[0] = @[]

-  a.arr[1] = @[]

-

-  b = a # perform a deep copy here!

-  b.seq = @["xyz", "huch", "was", "soll"]

-  writeln(stdout, len(a.seq))

-  writeln(stdout, a.seq[3])

-  writeln(stdout, len(b.seq))

-  writeln(stdout, b.seq[3])

-  writeln(stdout, b.y)

-

-test()

+# Test the assignment operator for complex types which need RTTI
+
+type
+  TRec = object
+    x, y: int
+    s: string
+    seq: seq[string]
+    arr: seq[seq[array[0..3, string]]]
+  TRecSeq = seq[TRec]
+
+proc test() =
+  var
+    a, b: TRec
+  a.x = 1
+  a.y = 2
+  a.s = "Hallo!"
+  a.seq = @["abc", "def", "ghi", "jkl"]
+  a.arr = @[]
+  setLen(a.arr, 4)
+  a.arr[0] = @[]
+  a.arr[1] = @[]
+
+  b = a # perform a deep copy here!
+  b.seq = @["xyz", "huch", "was", "soll"]
+  writeLine(stdout, len(a.seq))
+  writeLine(stdout, a.seq[3])
+  writeLine(stdout, len(b.seq))
+  writeLine(stdout, b.seq[3])
+  writeLine(stdout, b.y)
+
+test()
diff --git a/tests/assign/tcopy.nim b/tests/assign/tcopy.nim
index 5feb0d6b3..1e5bc3cba 100644
--- a/tests/assign/tcopy.nim
+++ b/tests/assign/tcopy.nim
@@ -16,8 +16,8 @@ proc main() =
   p = find(example, "=")
   a = substr(example, 0, p-1)
   b = substr(example, p+1)
-  writeln(stdout, a & '=' & b)
-  #writeln(stdout, b)
+  writeLine(stdout, a & '=' & b)
+  #writeLine(stdout, b)
 
 main()
 #OUT TEMP=C:\Programs\xyz\bin
diff --git a/tests/assign/tgenericassign.nim b/tests/assign/tgenericassign.nim
index 654b0ab8f..bd9c6c21b 100644
--- a/tests/assign/tgenericassign.nim
+++ b/tests/assign/tgenericassign.nim
@@ -6,7 +6,7 @@ type
   TAny* = object {.pure.}
     value*: pointer
     rawType: pointer
-    
+
 proc newAny(value, rawType: pointer): TAny =
   result.value = value
   result.rawType = rawType
diff --git a/tests/assign/tgenericassigntuples.nim b/tests/assign/tgenericassigntuples.nim
index 6dd63a984..cca244577 100644
--- a/tests/assign/tgenericassigntuples.nim
+++ b/tests/assign/tgenericassigntuples.nim
@@ -4,7 +4,7 @@ discard """
 
 var t, s: tuple[x: string, c: int]
 
-proc ugh: seq[tuple[x: string, c: int]] = 
+proc ugh: seq[tuple[x: string, c: int]] =
   result = @[("abc", 232)]
 
 t = ugh()[0]
diff --git a/tests/assign/tobjasgn.nim b/tests/assign/tobjasgn.nim
index 23a31252d..e731d9e93 100644
--- a/tests/assign/tobjasgn.nim
+++ b/tests/assign/tobjasgn.nim
@@ -12,7 +12,7 @@ type
     a, b: int
   PSomeObj = ref object
     a, b: int
- 
+
 var a = TSomeObj(a: 8)
 var b = PSomeObj(a: 5)
 echo a.a, " ", b.a, " ", a.b, " ", b.b
diff --git a/tests/assign/toverload_asgn1.nim b/tests/assign/toverload_asgn1.nim
new file mode 100644
index 000000000..dbc3a71c4
--- /dev/null
+++ b/tests/assign/toverload_asgn1.nim
@@ -0,0 +1,75 @@
+discard """
+  output: '''Concrete '='
+Concrete '='
+Concrete '='
+Concrete '='
+Concrete '='
+GenericT[T] '=' int
+GenericT[T] '=' float
+GenericT[T] '=' float
+GenericT[T] '=' float
+GenericT[T] '=' string
+GenericT[T] '=' int8
+GenericT[T] '=' bool
+GenericT[T] '=' bool
+GenericT[T] '=' bool
+GenericT[T] '=' bool'''
+"""
+
+import typetraits
+
+type
+  Concrete = object
+    a, b: string
+
+proc `=`(d: var Concrete; src: Concrete) =
+  shallowCopy(d.a, src.a)
+  shallowCopy(d.b, src.b)
+  echo "Concrete '='"
+
+var x, y: array[0..2, Concrete]
+var cA, cB: Concrete
+
+var cATup, cBTup: tuple[x: int, ha: Concrete]
+
+x = y
+cA = cB
+cATup = cBTup
+
+type
+  GenericT[T] = object
+    a, b: T
+
+proc `=`[T](d: var GenericT[T]; src: GenericT[T]) =
+  shallowCopy(d.a, src.a)
+  shallowCopy(d.b, src.b)
+  echo "GenericT[T] '=' ", type(T).name
+
+var ag: GenericT[int]
+var bg: GenericT[int]
+
+ag = bg
+
+var xg, yg: array[0..2, GenericT[float]]
+var cAg, cBg: GenericT[string]
+
+var cATupg, cBTupg: tuple[x: int, ha: GenericT[int8]]
+
+xg = yg
+cAg = cBg
+cATupg = cBTupg
+
+var caSeqg, cbSeqg: seq[GenericT[bool]]
+newSeq(cbSeqg, 4)
+caSeqg = cbSeqg
+
+when false:
+  type
+    Foo = object
+      case b: bool
+      of false: xx: GenericT[int]
+      of true: yy: bool
+
+  var
+    a, b: Foo
+  a = b
diff --git a/tests/assign/toverload_asgn2.nim b/tests/assign/toverload_asgn2.nim
new file mode 100644
index 000000000..243c90494
--- /dev/null
+++ b/tests/assign/toverload_asgn2.nim
@@ -0,0 +1,22 @@
+discard """
+  output: '''i value 88
+2aa'''
+"""
+
+import moverload_asgn2
+
+proc passAround(i: int): Concrete =
+  echo "i value ", i
+  result = Concrete(a: "aa", b: "bb", rc: 0)
+
+proc main =
+  let
+    i = 88
+    v = passAround(i)
+    z = v.a
+  var
+    x: Concrete
+  x = v
+  echo x.rc, z # 2aa
+
+main()
diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim
index 13d531387..443f769cd 100644
--- a/tests/async/tasyncawait.nim
+++ b/tests/async/tasyncawait.nim
@@ -2,7 +2,7 @@ discard """
   file: "tasyncawait.nim"
   output: "5000"
 """
-import asyncdispatch, rawsockets, net, strutils, os
+import asyncdispatch, nativesockets, net, strutils, os
 
 var msgCount = 0
 
@@ -18,7 +18,7 @@ proc sendMessages(client: TAsyncFD) {.async.} =
 
 proc launchSwarm(port: TPort) {.async.} =
   for i in 0 .. <swarmSize:
-    var sock = newAsyncRawSocket()
+    var sock = newAsyncNativeSocket()
 
     await connect(sock, "localhost", port)
     await sendMessages(sock)
@@ -38,7 +38,7 @@ proc readMessages(client: TAsyncFD) {.async.} =
         doAssert false
 
 proc createServer(port: TPort) {.async.} =
-  var server = newAsyncRawSocket()
+  var server = newAsyncNativeSocket()
   block:
     var name: Sockaddr_in
     when defined(windows):
@@ -50,7 +50,7 @@ proc createServer(port: TPort) {.async.} =
     if bindAddr(server.SocketHandle, cast[ptr SockAddr](addr(name)),
                 sizeof(name).Socklen) < 0'i32:
       raiseOSError(osLastError())
-  
+
   discard server.SocketHandle.listen()
   while true:
     asyncCheck readMessages(await accept(server))
diff --git a/tests/async/tasyncconnect.nim b/tests/async/tasyncconnect.nim
new file mode 100644
index 000000000..3dac379b2
--- /dev/null
+++ b/tests/async/tasyncconnect.nim
@@ -0,0 +1,34 @@
+discard """
+  file: "tasyncconnect.nim"
+  exitcode: 1
+  outputsub: "Error: unhandled exception: Connection refused"
+"""
+
+import
+    asyncdispatch,
+    posix
+
+
+const
+    testHost = "127.0.0.1"
+    testPort = Port(17357)
+
+
+when defined(windows) or defined(nimdoc):
+    # TODO: just make it work on Windows for now.
+    quit("Error: unhandled exception: Connection refused")
+else:
+    proc testAsyncConnect() {.async.} =
+        var s = newAsyncNativeSocket()
+
+        await s.connect(testHost, testPort)
+
+        var peerAddr: SockAddr
+        var addrSize = Socklen(sizeof(peerAddr))
+        var ret = SocketHandle(s).getpeername(addr(peerAddr), addr(addrSize))
+
+        if ret < 0:
+            echo("`connect(...)` failed but no exception was raised.")
+            quit(2)
+
+    waitFor(testAsyncConnect())
diff --git a/tests/async/tasynceverror.nim b/tests/async/tasynceverror.nim
new file mode 100644
index 000000000..22b4fe9a7
--- /dev/null
+++ b/tests/async/tasynceverror.nim
@@ -0,0 +1,66 @@
+discard """
+  file: "tasynceverror.nim"
+  exitcode: 1
+  outputsub: "Error: unhandled exception: Connection reset by peer"
+"""
+
+import
+    asyncdispatch,
+    asyncnet,
+    nativesockets,
+    os
+
+
+const
+    testHost = "127.0.0.1"
+    testPort = Port(17357)
+
+
+when defined(windows) or defined(nimdoc):
+    # TODO: just make it work on Windows for now.
+    quit("Error: unhandled exception: Connection reset by peer")
+else:
+    proc createListenSocket(host: string, port: Port): TAsyncFD =
+        result = newAsyncNativeSocket()
+
+        SocketHandle(result).setSockOptInt(SOL_SOCKET, SO_REUSEADDR, 1)
+
+        var aiList = getAddrInfo(host, port, AF_INET)
+        if SocketHandle(result).bindAddr(aiList.ai_addr, aiList.ai_addrlen.Socklen) < 0'i32:
+          dealloc(aiList)
+          raiseOSError(osLastError())
+        dealloc(aiList)
+
+        if SocketHandle(result).listen(1) < 0'i32:
+            raiseOSError(osLastError())
+
+
+    proc testAsyncSend() {.async.} =
+        var
+            ls = createListenSocket(testHost, testPort)
+            s = newAsyncSocket()
+
+        await s.connect(testHost, testPort)
+
+        var ps = await ls.accept()
+        SocketHandle(ls).close()
+
+        await ps.send("test 1", flags={})
+        s.close()
+        # This send should raise EPIPE
+        await ps.send("test 2", flags={})
+        SocketHandle(ps).close()
+
+
+    # The bug was, when the poll function handled EvError for us,
+    # our callbacks may never get executed, thus making the event
+    # loop block indefinitely. This is a timer to keep everything
+    # rolling. 400 ms is an arbitrary value, should be enough though.
+    proc timer() {.async.} =
+        await sleepAsync(400)
+        echo("Timer expired.")
+        quit(2)
+
+
+    asyncCheck(testAsyncSend())
+    waitFor(timer())
diff --git a/tests/async/tasyncexceptions.nim b/tests/async/tasyncexceptions.nim
index c4379f7d8..aab08e30f 100644
--- a/tests/async/tasyncexceptions.nim
+++ b/tests/async/tasyncexceptions.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tasyncexceptions.nim"
   exitcode: 1
-  outputsub: "Error: unhandled exception: foobar [Exception]"
+  outputsub: "Error: unhandled exception: foobar"
 """
 import asyncdispatch
 
diff --git a/tests/async/tasyncfile.nim b/tests/async/tasyncfile.nim
index c3cf33512..05cda5e5f 100644
--- a/tests/async/tasyncfile.nim
+++ b/tests/async/tasyncfile.nim
@@ -18,7 +18,7 @@ proc main() {.async.} =
     let data = await file.readAll()
     doAssert data == "foot"
     file.close()
-  
+
   # Append test
   block:
     var file = openAsync(fn, fmAppend)
@@ -29,8 +29,8 @@ proc main() {.async.} =
     file.close()
     file = openAsync(fn, fmRead)
     let data = await file.readAll()
-    
+
     doAssert data == "foot\ntest2"
     file.close()
-  
+
 waitFor main()
diff --git a/tests/async/tasynciossl.nim b/tests/async/tasynciossl.nim
index 118b9e74d..ba856760e 100644
--- a/tests/async/tasynciossl.nim
+++ b/tests/async/tasynciossl.nim
@@ -10,12 +10,12 @@ disp = newDispatcher()
 var msgCount = 0
 
 when defined(ssl):
-  var ctx = newContext(verifyMode = CVerifyNone, 
+  var ctx = newContext(verifyMode = CVerifyNone,
       certFile = "tests/testdata/mycert.pem", keyFile = "tests/testdata/mycert.pem")
 
   var ctx1 = newContext(verifyMode = CVerifyNone)
 
-const 
+const
   swarmSize = 50
   messagesToSend = 100
 
diff --git a/tests/async/tasyncudp.nim b/tests/async/tasyncudp.nim
index 2a7ed40bf..57e2be85d 100644
--- a/tests/async/tasyncudp.nim
+++ b/tests/async/tasyncudp.nim
@@ -20,12 +20,12 @@ proc serverRead(s: PAsyncSocket) =
   if s.recvFromAsync(data, 9, address, port):
     assert address == "127.0.0.1"
     msgCount.inc()
-  
+
   discard """
-  
+
   var line = ""
   assert s.recvLine(line)
-  
+
   if line == "":
     assert(false)
   else:
@@ -66,11 +66,11 @@ while true:
 
   if not disp.poll():
     break
-  
+
   if (msgCount div messagesToSend) * serverCount == currentClient:
     createClient(disp, TPort(10335), false)
     createClient(disp, TPort(10336), true)
-  
+
   if msgCount == messagesToSend * serverCount * swarmSize:
     break
 
diff --git a/tests/benchmark.nim b/tests/benchmark.nim
index 0613d1bf9..69c9a3927 100644
--- a/tests/benchmark.nim
+++ b/tests/benchmark.nim
@@ -44,4 +44,4 @@ when isMainModule:
   var b = doBench()
   var output = genOutput(b)
   writeFile("benchmarkResults.json", pretty(output))
-  
\ No newline at end of file
+
diff --git a/tests/benchmarks/fannkuch.nim b/tests/benchmarks/fannkuch.nim
index 15f78f50c..55405b3c9 100644
--- a/tests/benchmarks/fannkuch.nim
+++ b/tests/benchmarks/fannkuch.nim
@@ -2,7 +2,7 @@ import os
 import strutils
 
 proc fannkuch (n: int): int =
-    var 
+    var
         count: seq[int]
         maxFlips = 0
         m        = n-1
@@ -58,7 +58,7 @@ proc fannkuch (n: int): int =
                 for i in 0 .. r-1:
                     perm1[i] = perm1[i+1]
                 perm1[r] = tmp
-                
+
                 dec (count[r])
                 if count[r] > 0:
                     break makePerm
@@ -66,4 +66,4 @@ proc fannkuch (n: int): int =
             return maxFlips
 
 var n = 10
-echo ("Pfannkuchen(" & $n & ") = " & $fannkuch (n))
\ No newline at end of file
+echo ("Pfannkuchen(" & $n & ") = " & $fannkuch (n))
diff --git a/tests/benchmarks/quicksort.nim b/tests/benchmarks/quicksort.nim
index 599e3674c..6a1222b9a 100644
--- a/tests/benchmarks/quicksort.nim
+++ b/tests/benchmarks/quicksort.nim
@@ -51,4 +51,4 @@ proc sort (start, stop: int) =
 sort (0, data.len)
 echo (data[n div 2 - 1] and 0xFFFF_FFFF'i64, ", ",
       data[n div 2] and 0xFFFF_FFFF'i64, ", ",
-      data[n div 2 + 1] and 0xFFFF_FFFF'i64)
\ No newline at end of file
+      data[n div 2 + 1] and 0xFFFF_FFFF'i64)
diff --git a/tests/bind/mbind3.nim b/tests/bind/mbind3.nim
index d02bc79d0..aad080223 100644
--- a/tests/bind/mbind3.nim
+++ b/tests/bind/mbind3.nim
@@ -1,5 +1,5 @@
 # Module A
-var 
+var
   lastId = 0
 
 template genId*: expr =
diff --git a/tests/bind/tbind1.nim b/tests/bind/tbind1.nim
index 6593b2307..2665d0b5c 100644
--- a/tests/bind/tbind1.nim
+++ b/tests/bind/tbind1.nim
@@ -6,14 +6,14 @@ discard """
 
 proc p1(x: int8, y: int): int = return x + y
 
-template tempBind(x, y: expr): expr = 
+template tempBind(x, y: expr): expr =
   bind p1
-  p1(x, y) 
+  p1(x, y)
 
 proc p1(x: int, y: int8): int = return x - y
 
-# This is tricky: the call to ``p1(1'i8, 2'i8)`` should not fail in line 6, 
-# because it is not ambiguous there. But it is ambiguous after line 8. 
+# This is tricky: the call to ``p1(1'i8, 2'i8)`` should not fail in line 6,
+# because it is not ambiguous there. But it is ambiguous after line 8.
 
 echo tempBind(1'i8, 2'i8) #OUT 3
 
diff --git a/tests/bind/tbind2.nim b/tests/bind/tbind2.nim
index e8e21ad02..0e0cbd788 100644
--- a/tests/bind/tbind2.nim
+++ b/tests/bind/tbind2.nim
@@ -1,6 +1,6 @@
 discard """
   file: "tbind2.nim"
-  line: 14
+  line: 12
   errormsg: "ambiguous call"
 """
 # Test the new ``bind`` keyword for templates
@@ -8,7 +8,7 @@ discard """
 proc p1(x: int8, y: int): int = return x + y
 proc p1(x: int, y: int8): int = return x - y
 
-template tempBind(x, y: expr): expr = 
+template tempBind(x, y: expr): expr =
   (bind p1(x, y))  #ERROR_MSG ambiguous call
 
 echo tempBind(1'i8, 2'i8)
diff --git a/tests/bind/tdatabind.nim b/tests/bind/tdatabind.nim
index afa8aa47b..124faee6f 100644
--- a/tests/bind/tdatabind.nim
+++ b/tests/bind/tdatabind.nim
@@ -31,14 +31,14 @@ proc newProperty*[T](value: T): TProperty[T] =
 
   proc setter(property: var TProperty[T], v: T) =
     property.value = v
-    
+
     # fire event here
     var args: TValueEventArgs[T]
     args.Property = property
     property.EEmitter.emit(property.ValueChanged, args)
-  
+
   prop.setProc = setter
-   
+
   return prop
 
 proc `prop`[T] (p: TProperty[T]): T =
@@ -56,7 +56,7 @@ proc `$`[T] (p: TProperty[T]): string =
 
 proc propertyBind*[T](p1: var TProperty[T], p2: var TProperty[T]) =
   p1.Binders.add(p2)
-  
+
   # make handler -> handler[T] so trigger even more generics bugs ...
   proc handler(e: TEventArgs) =
     type TEA = TValueEventArgs[T]
@@ -77,9 +77,9 @@ proc `->`[T](p1: var TProperty[T], p2: var TProperty[T]) =
 when isMainModule:
   # Initial value testing
   var myProp = newProperty(5)
-  
+
   echo(myProp)
-  
+
   myProp ~= 7 # Temp operator until overloading of '=' is implemented.
   echo(myProp)
 
diff --git a/tests/bind/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim
index bf6d92927..5145fdcff 100644
--- a/tests/bind/tnicerrorforsymchoice.nim
+++ b/tests/bind/tnicerrorforsymchoice.nim
@@ -1,17 +1,17 @@
 discard """
   line: 18
-  errormsg: "type mismatch: got (proc (TScgi) | proc (AsyncSocket, StringTableRef, string)"
+  errormsg: "type mismatch: got (proc (s: TScgi) | proc (client: AsyncSocket, headers: StringTableRef, input: string){.gcsafe, locks: 0.}"
 """
 
 #bug #442
 import scgi, sockets, asyncio, strtabs
 proc handleSCGIRequest[TScgi: ScgiState | AsyncScgiState](s: TScgi) =
   discard
-proc handleSCGIRequest(client: AsyncSocket, headers: StringTableRef, 
+proc handleSCGIRequest(client: AsyncSocket, headers: StringTableRef,
                        input: string) =
   discard
 
-proc test(handle: proc (client: AsyncSocket, headers: StringTableRef, 
+proc test(handle: proc (client: AsyncSocket, headers: StringTableRef,
                         input: string), b: int) =
   discard
 
diff --git a/tests/borrow/tborrow.nim b/tests/borrow/tborrow.nim
index d4df5f524..ee0d0194d 100644
--- a/tests/borrow/tborrow.nim
+++ b/tests/borrow/tborrow.nim
@@ -6,12 +6,12 @@ discard """
 
 proc `++`*[T: int | float](a, b: T): T =
   result = a + b
-  
+
 type
   DI = distinct int
   DF = distinct float
   DS = distinct string
-  
+
 proc `++`(x, y: DI): DI {.borrow.}
 proc `++`(x, y: DF): DF {.borrow.}
 
diff --git a/tests/casestmt/tcaseoverlaprange.nim b/tests/casestmt/tcaseoverlaprange.nim
index 5f24c3ca9..3527c9385 100644
--- a/tests/casestmt/tcaseoverlaprange.nim
+++ b/tests/casestmt/tcaseoverlaprange.nim
@@ -8,8 +8,8 @@ type
 
 var
   e: TE
-  
+
 case e
-of A..D, B..C: 
+of A..D, B..C:
   echo "redundant"
 else: nil
diff --git a/tests/casestmt/tcaseoverlaprange2.nim b/tests/casestmt/tcaseoverlaprange2.nim
index d6e301508..4a9479a5f 100644
--- a/tests/casestmt/tcaseoverlaprange2.nim
+++ b/tests/casestmt/tcaseoverlaprange2.nim
@@ -6,7 +6,7 @@ discard """
 
 
 
-proc checkDuplicates(myval: int32): bool = 
+proc checkDuplicates(myval: int32): bool =
   case myval
   of 0x7B:
     echo "this should not compile"
diff --git a/tests/casestmt/tcasestm.nim b/tests/casestmt/tcasestm.nim
index a21b6be0d..7ac20bf2f 100644
--- a/tests/casestmt/tcasestm.nim
+++ b/tests/casestmt/tcasestm.nim
@@ -25,7 +25,7 @@ of "will", "it", "finally", "be", "generated": discard
 var z = case i
   of 1..5, 8, 9: "aa"
   of 6, 7: "bb"
-  elif x == "Ha": 
+  elif x == "Ha":
     "cc"
   elif x == "yyy":
     write(stdout, x)
diff --git a/tests/casestmt/tlinearscanend.nim b/tests/casestmt/tlinearscanend.nim
index 15fd0c70a..9a984e039 100644
--- a/tests/casestmt/tlinearscanend.nim
+++ b/tests/casestmt/tlinearscanend.nim
@@ -4,13 +4,13 @@ import strutils
 var x = 343
 
 case stdin.readline.parseInt
-of 0: 
+of 0:
   echo "most common case"
-of 1: 
+of 1:
   {.linearScanEnd.}
   echo "second most common case"
 of 2: echo "unlikely: use branch table"
-else: 
+else:
   echo "unlikely too: use branch table"
 
 
@@ -18,7 +18,7 @@ case x
 of 23: echo "23"
 of 343: echo "343"
 of 21: echo "21"
-else: 
+else:
   {.linearScanEnd.}
   echo "default"
 
diff --git a/tests/ccgbugs/taddhigh.nim b/tests/ccgbugs/taddhigh.nim
new file mode 100644
index 000000000..d6ac8f650
--- /dev/null
+++ b/tests/ccgbugs/taddhigh.nim
@@ -0,0 +1,16 @@
+discard """
+  output: '''@[5, 5, 5]'''
+"""
+
+# bug #1832
+
+var s = @[5]
+
+# Works fine:
+let x = s[s.high]
+s.add x
+
+# Causes the 0 to appear:
+s.add s[s.high]
+
+echo s # @[5, 5, 0]
diff --git a/tests/ccgbugs/tarray_equality.nim b/tests/ccgbugs/tarray_equality.nim
new file mode 100644
index 000000000..66a953439
--- /dev/null
+++ b/tests/ccgbugs/tarray_equality.nim
@@ -0,0 +1,15 @@
+discard """
+  output: '''true
+true'''
+"""
+
+# bug #2489
+
+let a = [1]
+let b = [1]
+echo a == b
+
+# bug #2498
+var x: array[0, int]
+var y: array[0, int]
+echo x == y
diff --git a/tests/ccgbugs/tccgen1.nim b/tests/ccgbugs/tccgen1.nim
index 9234bbd6c..4917c9848 100644
--- a/tests/ccgbugs/tccgen1.nim
+++ b/tests/ccgbugs/tccgen1.nim
@@ -18,21 +18,21 @@ type
     FOwnerDocument: PDocument # Read-Only
     FParentNode: PNode # Read-Only
     prefix*: string # Setting this should change some values... TODO!
-  
+
   PElement* = ref Element
   Element = object of Node
     FTagName: string # Read-only
-  
+
   PCharacterData = ref CharacterData
   CharacterData = object of Node
     data*: string
-    
+
   PDocument* = ref Document
   Document = object of Node
     FImplementation: PDOMImplementation # Read-only
     FDocumentElement: PElement # Read-only
-    
-  PAttr* = ref Attr  
+
+  PAttr* = ref Attr
   Attr = object of Node
     FName: string # Read-only
     FSpecified: bool # Read-only
@@ -44,22 +44,22 @@ type
 
   PText* = ref Text
   Text = object of CharacterData
-  
+
   PComment* = ref Comment
   Comment = object of CharacterData
-  
+
   PCDataSection* = ref CDataSection
   CDataSection = object of Text
-    
+
   PProcessingInstruction* = ref ProcessingInstruction
   ProcessingInstruction = object of Node
     data*: string
     FTarget: string # Read-only
 
-proc `namespaceURI=`*(n: var PNode, value: string) = 
+proc `namespaceURI=`*(n: var PNode, value: string) =
   n.FNamespaceURI = value
-  
-proc main = 
+
+proc main =
   var n: PNode
   new(n)
   n.namespaceURI = "test"
diff --git a/tests/ccgbugs/tcgbug.nim b/tests/ccgbugs/tcgbug.nim
index 92e7b3a66..1c6466c87 100644
--- a/tests/ccgbugs/tcgbug.nim
+++ b/tests/ccgbugs/tcgbug.nim
@@ -14,7 +14,7 @@ proc p(a: PObj) =
 proc q(a: var PObj) =
   a.p()
 
-var 
+var
   a: PObj
 new(a)
 q(a)
diff --git a/tests/ccgbugs/tcodegenbug1.nim b/tests/ccgbugs/tcodegenbug1.nim
index 9b9771485..a5cfc77cc 100644
--- a/tests/ccgbugs/tcodegenbug1.nim
+++ b/tests/ccgbugs/tcodegenbug1.nim
@@ -11,7 +11,7 @@ type
     status*: TStatusEnum
     desc*: string
     hash*: string
-    
+
 proc initStatus*(): TStatus =
   result.status = sUnknown
   result.desc = ""
@@ -49,7 +49,7 @@ proc `$`*(status: TStatusEnum): string =
     return "csource generation succeeded"
   of sUnknown:
     return "unknown"
-    
+
 proc makeCommitPath*(platform, hash: string): string =
   return platform / "nim_" & hash.substr(0, 11) # 11 Chars.
 
diff --git a/tests/ccgbugs/tmissingderef.nim b/tests/ccgbugs/tmissingderef.nim
index edff1dd4e..26418800a 100644
--- a/tests/ccgbugs/tmissingderef.nim
+++ b/tests/ccgbugs/tmissingderef.nim
@@ -1,5 +1,7 @@
 discard """
-  output: '''255
+  output: '''[10, 0, 0, 0, 0, 0, 0, 0]
+
+255
 1 1
 0.5'''
 """
@@ -27,4 +29,13 @@ proc mainowar =
   var b = p[]
   echo b[0]
 
+
+# bug 2963
+var
+  a = [8, 7, 3, 10, 0, 0, 0, 1]
+  b = [10, 0, 0, 0, 0, 0, 0, 0]
+  ap = addr a
+ap[] = b
+echo repr(a)
+
 mainowar()
diff --git a/tests/ccgbugs/tnocodegen_for_compiletime.nim b/tests/ccgbugs/tnocodegen_for_compiletime.nim
new file mode 100644
index 000000000..a88ba4b32
--- /dev/null
+++ b/tests/ccgbugs/tnocodegen_for_compiletime.nim
@@ -0,0 +1,9 @@
+# bug #1679
+import macros, tables, hashes
+proc hash(v: NimNode): Hash = 4  # performance is for suckers
+macro test(body: stmt): stmt {.immediate.} =
+  var a = initCountTable[NimNode]()
+  a.inc(body)
+
+test:
+  1 + 1
diff --git a/tests/ccgbugs/tpartialcs.nim b/tests/ccgbugs/tpartialcs.nim
new file mode 100644
index 000000000..12ff65c37
--- /dev/null
+++ b/tests/ccgbugs/tpartialcs.nim
@@ -0,0 +1,20 @@
+
+# bug #2551
+
+type Tup = tuple
+  A, a: int
+
+type Obj = object
+  A, a: int
+
+var x: Tup # This works.
+var y: Obj # This doesn't.
+
+# bug #2212
+
+proc f() =
+  let
+    p = 1.0
+    P = 0.25 + 0.5
+
+f()
diff --git a/tests/ccgbugs/trecursive_closure.nim b/tests/ccgbugs/trecursive_closure.nim
index 50c363a4a..f64382a8c 100644
--- a/tests/ccgbugs/trecursive_closure.nim
+++ b/tests/ccgbugs/trecursive_closure.nim
@@ -6,3 +6,9 @@ proc f(x: proc: MalType) =
   discard x()
 
 f(nil)
+
+# bug #2823
+
+type A = object #of RootObj <-- Uncomment this to get no errors
+  test: proc(i: A): bool
+var a: proc(i: A): bool # Or comment this line to get no errors
diff --git a/tests/ccgbugs/tunsafeaddr.nim b/tests/ccgbugs/tunsafeaddr.nim
new file mode 100644
index 000000000..4f05c7c21
--- /dev/null
+++ b/tests/ccgbugs/tunsafeaddr.nim
@@ -0,0 +1,19 @@
+discard """
+  output: '''12'''
+"""
+
+{.emit: """
+long sum(long* a, long len) {
+  long i, result = 0;
+  for (i = 0; i < len; ++i) result += a[i];
+  return result;
+}
+""".}
+
+proc sum(a: ptr int; len: int): int {.importc, nodecl.}
+
+proc main =
+  let foo = [8, 3, 1]
+  echo sum(unsafeAddr foo[0], foo.len)
+
+main()
diff --git a/tests/ccgbugs/twrong_discriminant_check.nim b/tests/ccgbugs/twrong_discriminant_check.nim
new file mode 100644
index 000000000..a802f45ef
--- /dev/null
+++ b/tests/ccgbugs/twrong_discriminant_check.nim
@@ -0,0 +1,30 @@
+discard """
+  output: "(kind: None)"
+"""
+
+when true:
+  # bug #2637
+
+  type
+    OptionKind = enum
+      None,
+      Some
+
+    Option*[T] = object
+      case kind: OptionKind
+      of None:
+        discard
+      of Some:
+        value*: T
+
+  proc none*[T](): Option[T] =
+    Option[T](kind: None)
+
+  proc none*(T: typedesc): Option[T] = none[T]()
+
+
+  proc test(): Option[int] =
+    int.none
+
+  echo test()
+
diff --git a/tests/ccgbugs/twrong_setconstr.nim b/tests/ccgbugs/twrong_setconstr.nim
new file mode 100644
index 000000000..f03ffd928
--- /dev/null
+++ b/tests/ccgbugs/twrong_setconstr.nim
@@ -0,0 +1,146 @@
+discard """
+  output: ""
+"""
+
+# bug #2880
+
+type
+  TMsgKind* = enum
+    errUnknown, errIllFormedAstX, errInternal, errCannotOpenFile, errGenerated,
+    errXCompilerDoesNotSupportCpp, errStringLiteralExpected,
+    errIntLiteralExpected, errInvalidCharacterConstant,
+    errClosingTripleQuoteExpected, errClosingQuoteExpected,
+    errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
+    errInvalidNumber, errInvalidNumberOctalCode, errNumberOutOfRange,
+    errNnotAllowedInCharacter, errClosingBracketExpected, errMissingFinalQuote,
+    errIdentifierExpected, errNewlineExpected, errInvalidModuleName,
+    errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
+    errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
+    errInvalidPragma, errUnknownPragma, errInvalidDirectiveX,
+    errAtPopWithoutPush, errEmptyAsm, errInvalidIndentation,
+    errExceptionExpected, errExceptionAlreadyHandled,
+    errYieldNotAllowedHere, errYieldNotAllowedInTryStmt,
+    errInvalidNumberOfYieldExpr, errCannotReturnExpr, errAttemptToRedefine,
+    errStmtInvalidAfterReturn, errStmtExpected, errInvalidLabel,
+    errInvalidCmdLineOption, errCmdLineArgExpected, errCmdLineNoArgExpected,
+    errInvalidVarSubstitution, errUnknownVar, errUnknownCcompiler,
+    errOnOrOffExpectedButXFound, errOnOffOrListExpectedButXFound,
+    errNoneBoehmRefcExpectedButXFound,
+    errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound,
+    errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound,
+    errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected,
+    errExprExpected, errUndeclaredIdentifier, errUseQualifier, errTypeExpected,
+    errSystemNeeds, errExecutionOfProgramFailed, errNotOverloadable,
+    errInvalidArgForX, errStmtHasNoEffect, errXExpectsTypeOrValue,
+    errXExpectsArrayType, errIteratorCannotBeInstantiated, errExprXAmbiguous,
+    errConstantDivisionByZero, errOrdinalTypeExpected,
+    errOrdinalOrFloatTypeExpected, errOverOrUnderflow,
+    errCannotEvalXBecauseIncompletelyDefined, errChrExpectsRange0_255,
+    errDynlibRequiresExportc, errUndeclaredFieldX, errNilAccess,
+    errIndexOutOfBounds, errIndexTypesDoNotMatch, errBracketsInvalidForType,
+    errValueOutOfSetBounds, errFieldInitTwice, errFieldNotInit,
+    errExprXCannotBeCalled, errExprHasNoType, errExprXHasNoType,
+    errCastNotInSafeMode, errExprCannotBeCastedToX, errCommaOrParRiExpected,
+    errCurlyLeOrParLeExpected, errSectionExpected, errRangeExpected,
+    errMagicOnlyInSystem, errPowerOfTwoExpected,
+    errStringMayNotBeEmpty, errCallConvExpected, errProcOnlyOneCallConv,
+    errSymbolMustBeImported, errExprMustBeBool, errConstExprExpected,
+    errDuplicateCaseLabel, errRangeIsEmpty, errSelectorMustBeOfCertainTypes,
+    errSelectorMustBeOrdinal, errOrdXMustNotBeNegative, errLenXinvalid,
+    errWrongNumberOfVariables, errExprCannotBeRaised, errBreakOnlyInLoop,
+    errTypeXhasUnknownSize, errConstNeedsConstExpr, errConstNeedsValue,
+    errResultCannotBeOpenArray, errSizeTooBig, errSetTooBig,
+    errBaseTypeMustBeOrdinal, errInheritanceOnlyWithNonFinalObjects,
+    errInheritanceOnlyWithEnums, errIllegalRecursionInTypeX,
+    errCannotInstantiateX, errExprHasNoAddress, errXStackEscape,
+    errVarForOutParamNeeded,
+    errPureTypeMismatch, errTypeMismatch, errButExpected, errButExpectedX,
+    errAmbiguousCallXYZ, errWrongNumberOfArguments,
+    errXCannotBePassedToProcVar,
+    errXCannotBeInParamDecl, errPragmaOnlyInHeaderOfProc, errImplOfXNotAllowed,
+    errImplOfXexpected, errNoSymbolToBorrowFromFound, errDiscardValueX,
+    errInvalidDiscard, errIllegalConvFromXtoY, errCannotBindXTwice,
+    errInvalidOrderInArrayConstructor,
+    errInvalidOrderInEnumX, errEnumXHasHoles, errExceptExpected, errInvalidTry,
+    errOptionExpected, errXisNoLabel, errNotAllCasesCovered,
+    errUnknownSubstitionVar, errComplexStmtRequiresInd, errXisNotCallable,
+    errNoPragmasAllowedForX, errNoGenericParamsAllowedForX,
+    errInvalidParamKindX, errDefaultArgumentInvalid, errNamedParamHasToBeIdent,
+    errNoReturnTypeForX, errConvNeedsOneArg, errInvalidPragmaX,
+    errXNotAllowedHere, errInvalidControlFlowX,
+    errXisNoType, errCircumNeedsPointer, errInvalidExpression,
+    errInvalidExpressionX, errEnumHasNoValueX, errNamedExprExpected,
+    errNamedExprNotAllowed, errXExpectsOneTypeParam,
+    errArrayExpectsTwoTypeParams, errInvalidVisibilityX, errInitHereNotAllowed,
+    errXCannotBeAssignedTo, errIteratorNotAllowed, errXNeedsReturnType,
+    errNoReturnTypeDeclared,
+    errInvalidCommandX, errXOnlyAtModuleScope,
+    errXNeedsParamObjectType,
+    errTemplateInstantiationTooNested, errInstantiationFrom,
+    errInvalidIndexValueForTuple, errCommandExpectsFilename,
+    errMainModuleMustBeSpecified,
+    errXExpected,
+    errTIsNotAConcreteType,
+    errInvalidSectionStart, errGridTableNotImplemented, errGeneralParseError,
+    errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile,
+    errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitly,
+    errOnlyACallOpCanBeDelegator, errUsingNoSymbol,
+    errMacroBodyDependsOnGenericTypes,
+    errDestructorNotGenericEnough,
+    errInlineIteratorsAsProcParams,
+    errXExpectsTwoArguments,
+    errXExpectsObjectTypes, errXcanNeverBeOfThisSubtype, errTooManyIterations,
+    errCannotInterpretNodeX, errFieldXNotFound, errInvalidConversionFromTypeX,
+    errAssertionFailed, errCannotGenerateCodeForX, errXRequiresOneArgument,
+    errUnhandledExceptionX, errCyclicTree, errXisNoMacroOrTemplate,
+    errXhasSideEffects, errIteratorExpected, errLetNeedsInit,
+    errThreadvarCannotInit, errWrongSymbolX, errIllegalCaptureX,
+    errXCannotBeClosure, errXMustBeCompileTime,
+    errCannotInferTypeOfTheLiteral,
+    errCannotInferReturnType,
+    errGenericLambdaNotAllowed,
+    errCompilerDoesntSupportTarget,
+    errUser,
+    warnCannotOpenFile,
+    warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit,
+    warnDeprecated, warnConfigDeprecated,
+    warnSmallLshouldNotBeUsed, warnUnknownMagic, warnRedefinitionOfLabel,
+    warnUnknownSubstitutionX, warnLanguageXNotSupported,
+    warnFieldXNotSupported, warnCommentXIgnored,
+    warnNilStatement, warnTypelessParam,
+    warnDifferentHeaps, warnWriteToForeignHeap, warnUnsafeCode,
+    warnEachIdentIsTuple, warnShadowIdent,
+    warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2,
+    warnUninit, warnGcMem, warnDestructor, warnLockLevel, warnResultShadowed,
+    warnUser,
+    hintSuccess, hintSuccessX,
+    hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
+    hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
+    hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
+    hintConditionAlwaysTrue, hintName, hintPattern,
+    hintExecuting, hintLinking, hintDependency,
+    hintSource, hintStackTrace, hintGCStats,
+    hintUser
+
+const
+  warnMin = warnCannotOpenFile
+  hintMax = high(TMsgKind)
+
+type
+  TNoteKind = range[warnMin..hintMax] # "notes" are warnings or hints
+  TNoteKinds = set[TNoteKind]
+
+const
+  NotesVerbosityConst: array[0..0, TNoteKinds] = [
+    {low(TNoteKind)..high(TNoteKind)} - {hintGCStats}]
+  fuckyou = NotesVerbosityConst[0]
+
+var
+  gNotesFromConst: TNoteKinds = NotesVerbosityConst[0]
+  gNotesFromConst2: TNoteKinds = fuckyou
+
+if hintGCStats in gNotesFromConst:
+  echo "hintGCStats in gNotesFromConst A"
+
+if hintGCStats in gNotesFromConst2:
+  echo "hintGCStats in gNotesFromConst B"
diff --git a/tests/ccgbugs/twrong_string_asgn.nim b/tests/ccgbugs/twrong_string_asgn.nim
new file mode 100644
index 000000000..b62e70e7c
--- /dev/null
+++ b/tests/ccgbugs/twrong_string_asgn.nim
@@ -0,0 +1,19 @@
+discard """
+  output: "adf"
+"""
+
+import asyncdispatch
+const
+  test = ["adf"]
+
+proc foo() {.async.} =
+  for i in test:
+    echo(i)
+
+var finished = false
+let x = foo()
+x.callback =
+  proc () =
+    finished = true
+
+while not finished: discard
diff --git a/tests/closure/tclosure.nim b/tests/closure/tclosure.nim
index 445a99b6d..09d48436e 100644
--- a/tests/closure/tclosure.nim
+++ b/tests/closure/tclosure.nim
@@ -41,7 +41,7 @@ type
 
 proc getInterf(): ITest =
   var shared: int
-  
+
   return (setter: proc (x: int) = shared = x,
           getter: proc (): int = return shared)
 
diff --git a/tests/closure/tclosure2.nim b/tests/closure/tclosure2.nim
index d2c16eac9..d331388cf 100644
--- a/tests/closure/tclosure2.nim
+++ b/tests/closure/tclosure2.nim
@@ -33,13 +33,13 @@ when true:
     for xxxx in 0..9:
       var i = 0
       proc bx =
-        if i > 10: 
+        if i > 10:
           echo xxxx
           return
         i += 1
         #for j in 0 .. 0: echo i
         bx()
-      
+
       bx()
       echo i
 
@@ -50,11 +50,11 @@ when true:
     var x = start-1
     #let dummy = proc =
     #  discard start
-    
-    result = proc (): int = 
+
+    result = proc (): int =
       #var x = 9
       for i in 0 .. 0: x = x + 1
-      
+
       return x
 
   var a = accumulator(3)
@@ -69,7 +69,7 @@ when true:
       for i in 0..3: echo "py"
 
     py()
-    
+
   outer()
 
 
@@ -80,7 +80,7 @@ when true:
       if n < 0: result = errorValue
       elif n <= 1: result = 1
       else: result = n * fac(n-1)
-  
+
     proc px() {.closure.} =
       echo "px"
 
@@ -93,7 +93,7 @@ when true:
         "xyz": py
       }
     mapping[0][1]()
-    
+
     echo fac(3)
 
 
diff --git a/tests/closure/tclosure3.nim b/tests/closure/tclosure3.nim
index bb217387f..8f6f4a70f 100644
--- a/tests/closure/tclosure3.nim
+++ b/tests/closure/tclosure3.nim
@@ -13,7 +13,7 @@ proc main =
     for i in 0 .. n-1:
       let val = s[i]()
       if val != $(i*i): echo "bug  ", val
-    
+
     if getOccupiedMem() > 3000_000: quit("still a leak!")
   echo "success"
 
diff --git a/tests/closure/tclosure4.nim b/tests/closure/tclosure4.nim
index 8e08376b6..10c7cac54 100644
--- a/tests/closure/tclosure4.nim
+++ b/tests/closure/tclosure4.nim
@@ -1,5 +1,5 @@
 
-import json, tables
+import json, tables, sequtils
 
 proc run(json_params: TTable) =
   let json_elems = json_params["files"].elems
diff --git a/tests/closure/tclosurebug2.nim b/tests/closure/tclosurebug2.nim
index 12e4e3509..581b735bf 100644
--- a/tests/closure/tclosurebug2.nim
+++ b/tests/closure/tclosurebug2.nim
@@ -111,7 +111,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()
@@ -128,7 +128,7 @@ proc enlarge[A, B](t: var TOrderedTable[A, B]) =
   t.last = -1
   while h >= 0:
     var nxt = t.data[h].next
-    if t.data[h].slot == seFilled: 
+    if t.data[h].slot == seFilled:
       rawInsert(t, n, t.data[h].key, t.data[h].val)
     h = nxt
   swap(t.data, n)
@@ -150,16 +150,16 @@ 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))
   for key, val in items(pairs): result[key] = val
 
-proc sort*[A, B](t: var TOrderedTable[A,B], 
+proc sort*[A, B](t: var TOrderedTable[A,B],
                  cmp: proc (x, y: tuple[key: A, val: B]): int {.closure.}) =
   ## sorts the ordered table so that the entry with the highest counter comes
-  ## first. This is destructive (with the advantage of being efficient)! 
+  ## first. This is destructive (with the advantage of being efficient)!
   ## You must not modify `t` afterwards!
   ## You can use the iterators `pairs`,  `keys`, and `values` to iterate over
   ## `t` in the sorted order.
@@ -186,7 +186,7 @@ proc sort*[A, B](t: var TOrderedTable[A,B],
           let item1 = (x.key, x.val)
           let item2 = (y.key, y.val)
           return cmp(item1, item2)
-      
+
       while rawCmp(t.data[j-h], t.data[j]) <= 0:
         swap(t.data[j], t.data[j-h])
         j = j-h
diff --git a/tests/closure/tinterf.nim b/tests/closure/tinterf.nim
index 726fac9f6..1ac6da945 100644
--- a/tests/closure/tinterf.nim
+++ b/tests/closure/tinterf.nim
@@ -10,8 +10,8 @@ type
 
 proc getInterf(): ITest =
   var shared1, shared2: int
-  
-  return (setter: proc (x: int) = 
+
+  return (setter: proc (x: int) =
             shared1 = x
             shared2 = x + 10,
           getter1: proc (): int = result = shared1,
diff --git a/tests/closure/tinvalidclosure.nim b/tests/closure/tinvalidclosure.nim
index 18968a6c6..c9136a736 100644
--- a/tests/closure/tinvalidclosure.nim
+++ b/tests/closure/tinvalidclosure.nim
@@ -1,6 +1,6 @@
 discard """
   line: 12
-  errormsg: "type mismatch: got (proc (int){.closure, gcsafe, locks: 0.})"
+  errormsg: "type mismatch: got (proc (x: int){.closure, gcsafe, locks: 0.})"
 """
 
 proc ugh[T](x: T) {.closure.} =
diff --git a/tests/closure/tinvalidclosure2.nim b/tests/closure/tinvalidclosure2.nim
index 20e465c12..845559309 100644
--- a/tests/closure/tinvalidclosure2.nim
+++ b/tests/closure/tinvalidclosure2.nim
@@ -3,12 +3,12 @@ discard """
   errormsg: "illegal capture 'A'"
 """
 
-proc outer() = 
+proc outer() =
   var A: int
 
   proc ugh[T](x: T) {.cdecl.} =
     echo "ugha", A, x
-    
+
   ugh[int](12)
 
 outer()
diff --git a/tests/closure/tjester.nim b/tests/closure/tjester.nim
index 48e5186f0..3bd10120a 100644
--- a/tests/closure/tjester.nim
+++ b/tests/closure/tjester.nim
@@ -17,7 +17,7 @@ proc cbOuter(response: string) {.closure, discardable.} =
         var iterVar = fooIter
         iterVar().data
       yield Future[int](data: foo())
-      
+
   var iterVar2 = cbIter
   proc cb2() {.closure.} =
     try:
diff --git a/tests/closure/tnestedclosure.nim b/tests/closure/tnestedclosure.nim
index c8f1e231b..67e196f66 100644
--- a/tests/closure/tnestedclosure.nim
+++ b/tests/closure/tnestedclosure.nim
@@ -45,7 +45,7 @@ proc cbOuter() =
         proc fooIter() =
           echo response
         fooIter()
-        
+
     cbIter()
 
 cbOuter()
diff --git a/tests/closure/tnestedproc.nim b/tests/closure/tnestedproc.nim
index 49ec6f9a7..7eeeff198 100644
--- a/tests/closure/tnestedproc.nim
+++ b/tests/closure/tnestedproc.nim
@@ -2,10 +2,10 @@ discard """
   output: "11"
 """
 
-proc p(x, y: int): int = 
+proc p(x, y: int): int =
   result = x + y
 
-echo p((proc (): int = 
+echo p((proc (): int =
           var x = 7
           return x)(),
        (proc (): int = return 4)())
diff --git a/tests/closure/uclosures.nim b/tests/closure/uclosures.nim
index 6eea29ca1..817bfec6b 100644
--- a/tests/closure/uclosures.nim
+++ b/tests/closure/uclosures.nim
@@ -2,7 +2,7 @@ import unittest
 
 test "loop variables are captured by copy":
   var funcs: seq[proc (): int {.closure.}] = @[]
-  
+
   for i in 0..10:
     let ii = i
     funcs.add do -> int: return ii * ii
diff --git a/tests/cnstseq/tcnstseq.nim b/tests/cnstseq/tcnstseq.nim
index e7d2333b4..ad0527f10 100644
--- a/tests/cnstseq/tcnstseq.nim
+++ b/tests/cnstseq/tcnstseq.nim
@@ -9,8 +9,8 @@ import strutils
 
 const
   myWords = "Angelika Anne Anna Anka Anja".split()
-  
-for x in items(myWords): 
+
+for x in items(myWords):
   write(stdout, x) #OUT AngelikaAnneAnnaAnkaAnja
 
 
diff --git a/tests/cnstseq/tcnstseq2.nim b/tests/cnstseq/tcnstseq2.nim
index 1a27b2ba7..2f364d278 100644
--- a/tests/cnstseq/tcnstseq2.nim
+++ b/tests/cnstseq/tcnstseq2.nim
@@ -4,8 +4,8 @@ discard """
 
 const
   myWords = @["Angelika", "Anne", "Anna", "Anka", "Anja"]
-  
-for i in 0 .. high(myWords): 
+
+for i in 0 .. high(myWords):
   write(stdout, myWords[i]) #OUT AngelikaAnneAnnaAnkaAnja
 
 
diff --git a/tests/collections/tapply.nim b/tests/collections/tapply.nim
new file mode 100644
index 000000000..2b7464216
--- /dev/null
+++ b/tests/collections/tapply.nim
@@ -0,0 +1,11 @@
+discard """
+  output: '''true'''
+"""
+
+import sequtils
+
+var x = @[1, 2, 3]
+x.apply(proc(x: var int) = x = x+10)
+x.apply(proc(x: int): int = x+100)
+x.applyIt(it+5000)
+echo x == @[5111, 5112, 5113]
diff --git a/tests/collections/tcounttable.nim b/tests/collections/tcounttable.nim
new file mode 100644
index 000000000..ebbb1c8e5
--- /dev/null
+++ b/tests/collections/tcounttable.nim
@@ -0,0 +1,19 @@
+discard """
+  output: "And we get here"
+"""
+
+# bug #2625
+
+const s_len = 32
+
+import tables
+var substr_counts: CountTable[string] = initCountTable[string]()
+var my_string = "Hello, this is sadly broken for strings over 64 characters. Note that it *does* appear to work for short strings."
+for i in 0..(my_string.len - s_len):
+  let s = my_string[i..i+s_len-1]
+  substr_counts[s] = 1
+  # substr_counts[s] = substr_counts[s] + 1  # Also breaks, + 2 as well, etc.
+  # substr_counts.inc(s)  # This works
+  #echo "Iteration ", i
+
+echo "And we get here"
diff --git a/tests/collections/thashes.nim b/tests/collections/thashes.nim
new file mode 100644
index 000000000..b9c639414
--- /dev/null
+++ b/tests/collections/thashes.nim
@@ -0,0 +1,75 @@
+discard """
+  output: '''true'''
+"""
+
+import tables
+from hashes import THash
+
+# Test with int
+block:
+  var t = initTable[int,int]()
+  t[0] = 42
+  t[1] = t[0] + 1
+  assert(t[0] == 42)
+  assert(t[1] == 43)
+  let t2 = {1: 1, 2: 2}.toTable
+  assert(t2[2] == 2)
+
+# Test with char
+block:
+  var t = initTable[char,int]()
+  t['0'] = 42
+  t['1'] = t['0'] + 1
+  assert(t['0'] == 42)
+  assert(t['1'] == 43)
+  let t2 = {'1': 1, '2': 2}.toTable
+  assert(t2['2'] == 2)
+
+# Test with enum
+block:
+  type
+    E = enum eA, eB, eC
+  var t = initTable[E,int]()
+  t[eA] = 42
+  t[eB] = t[eA] + 1
+  assert(t[eA] == 42)
+  assert(t[eB] == 43)
+  let t2 = {eA: 1, eB: 2}.toTable
+  assert(t2[eB] == 2)
+
+# Test with range
+block:
+  type
+    R = range[1..10]
+  var t = initTable[R,int]() # causes warning, why?
+  t[1] = 42 # causes warning, why?
+  t[2] = t[1] + 1
+  assert(t[1] == 42)
+  assert(t[2] == 43)
+  let t2 = {1.R: 1, 2.R: 2}.toTable
+  assert(t2[2.R] == 2)
+
+# Test which combines the generics for tuples + ordinals
+block:
+  type
+    E = enum eA, eB, eC
+  var t = initTable[(string, E, int, char), int]()
+  t[("a", eA, 0, '0')] = 42
+  t[("b", eB, 1, '1')] = t[("a", eA, 0, '0')] + 1
+  assert(t[("a", eA, 0, '0')] == 42)
+  assert(t[("b", eB, 1, '1')] == 43)
+  let t2 = {("a", eA, 0, '0'): 1, ("b", eB, 1, '1'): 2}.toTable
+  assert(t2[("b", eB, 1, '1')] == 2)
+
+# Test to check if overloading is possible
+# Unfortunately, this does not seem to work for int
+# The same test with a custom hash(s: string) does
+# work though.
+block:
+  proc hash(x: int): THash {.inline.} =
+    echo "overloaded hash"
+    result = x
+  var t = initTable[int, int]()
+  t[0] = 0
+
+echo "true"
diff --git a/tests/collections/tindexby.nim b/tests/collections/tindexby.nim
index f374d5504..88c0b263e 100644
--- a/tests/collections/tindexby.nim
+++ b/tests/collections/tindexby.nim
@@ -11,11 +11,11 @@ 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)
diff --git a/tests/collections/tmapit.nim b/tests/collections/tmapit.nim
new file mode 100644
index 000000000..b2afa9429
--- /dev/null
+++ b/tests/collections/tmapit.nim
@@ -0,0 +1,33 @@
+discard """
+  output: '''true
+true'''
+"""
+
+import sequtils
+
+var x = @[1, 2, 3]
+# This mapIt call will run with preallocation because ``len`` is available.
+var y = x.mapIt($(it+10))
+echo y == @["11", "12", "13"]
+
+type structureWithoutLen = object
+  a: array[5, int]
+
+iterator items(s: structureWithoutLen): int {.inline.} =
+  yield s.a[0]
+  yield s.a[1]
+  yield s.a[2]
+  yield s.a[3]
+  yield s.a[4]
+
+var st: structureWithoutLen
+st.a[0] = 0
+st.a[1] = 1
+st.a[2] = 2
+st.a[3] = 3
+st.a[4] = 4
+
+# this will run without preallocating the result
+# since ``len`` is not available
+var r = st.mapIt($(it+10))
+echo r == @["10", "11", "12", "13", "14"]
diff --git a/tests/collections/tsets.nim b/tests/collections/tsets.nim
index 656c5b3f2..a5bbe8dbd 100644
--- a/tests/collections/tsets.nim
+++ b/tests/collections/tsets.nim
@@ -1,17 +1,37 @@
-discard """
-  output: '''true
-true'''
-"""
-
 import sets
-var
-  a = initSet[int]()
-  b = initSet[int]()
-  c = initSet[string]()
 
-for i in 0..5: a.incl(i)
-for i in 1..6: b.incl(i)
-for i in 0..5: c.incl($i)
+block setEquality:
+  var
+    a = initSet[int]()
+    b = initSet[int]()
+    c = initSet[string]()
+
+  for i in 0..5: a.incl(i)
+  for i in 1..6: b.incl(i)
+  for i in 0..5: c.incl($i)
+
+  doAssert map(a, proc(x: int): int = x + 1) == b
+  doAssert map(a, proc(x: int): string = $x) == c
+
+
+block setsContainingTuples:
+  var set = initSet[tuple[i: int, i64: int64, f: float]]()
+  set.incl( (i: 123, i64: 123'i64, f: 3.14) )
+  doAssert set.contains( (i: 123, i64: 123'i64, f: 3.14) )
+  doAssert( not set.contains( (i: 456, i64: 789'i64, f: 2.78) ) )
+
+
+block setWithTuplesWithSeqs:
+  var s = initSet[tuple[s: seq[int]]]()
+  s.incl( (s: @[1, 2, 3]) )
+  doAssert s.contains( (s: @[1, 2, 3]) )
+  doAssert( not s.contains((s: @[4, 5, 6])) )
+
+
+block setWithSequences:
+  var s = initSet[seq[int]]()
+  s.incl( @[1, 2, 3] )
+  doAssert s.contains(@[1, 2, 3])
+  doAssert( not s.contains(@[4, 5, 6]) )
+
 
-echo map(a, proc(x: int): int = x + 1) == b
-echo map(a, proc(x: int): string = $x) == c
diff --git a/tests/collections/ttableconstr.nim b/tests/collections/ttableconstr.nim
index 1a21a18d1..a9262e70e 100644
--- a/tests/collections/ttableconstr.nim
+++ b/tests/collections/ttableconstr.nim
@@ -3,7 +3,7 @@
 template ignoreExpr(e: expr): stmt {.immediate.} =
   discard
 
-# test first class '..' syntactical citizen:  
+# test first class '..' syntactical citizen:
 ignoreExpr x <> 2..4
 # test table constructor:
 ignoreExpr({:})
diff --git a/tests/collections/ttables.nim b/tests/collections/ttables.nim
index e4cff7c7e..a8a182a78 100644
--- a/tests/collections/ttables.nim
+++ b/tests/collections/ttables.nim
@@ -66,6 +66,9 @@ block tableTest2:
     discard
   assert(not hasKey(t, "111"))
 
+  assert "123" in t
+  assert("111" notin t)
+
   for key, val in items(data): t[key] = val.toFloat
   for key, val in items(data): assert t[key] == val.toFloat
 
diff --git a/tests/collections/ttablesref.nim b/tests/collections/ttablesref.nim
index 92bc65da3..32494f1f2 100644
--- a/tests/collections/ttablesref.nim
+++ b/tests/collections/ttablesref.nim
@@ -65,6 +65,7 @@ block tableTest2:
   except KeyError:
     discard
   assert(not hasKey(t, "111"))
+  assert "111" notin t
 
   for key, val in items(data): t[key] = val.toFloat
   for key, val in items(data): assert t[key] == val.toFloat
diff --git a/tests/compiles/trecursive_generic_in_compiles.nim b/tests/compiles/trecursive_generic_in_compiles.nim
new file mode 100644
index 000000000..77bf0bb02
--- /dev/null
+++ b/tests/compiles/trecursive_generic_in_compiles.nim
@@ -0,0 +1,98 @@
+# bug #3313
+import unittest, future
+
+type
+  ListNodeKind = enum
+    lnkNil, lnkCons
+  List*[T] = ref object
+    ## List ADT
+    case kind: ListNodeKind
+    of lnkNil:
+      discard
+    of lnkCons:
+      value: T
+      next: List[T] not nil
+
+proc Cons*[T](head: T, tail: List[T]): List[T] =
+  ## Constructs non empty list
+  List[T](kind: lnkCons, value: head, next: tail)
+
+proc Nil*[T](): List[T] =
+  ## Constructs empty list
+  List[T](kind: lnkNil)
+
+proc head*[T](xs: List[T]): T =
+  ## Returns list's head
+  xs.value
+
+# TODO
+# proc headOption*[T](xs: List[T]): Option[T] = ???
+
+proc tail*[T](xs: List[T]): List[T] =
+  ## Returns list's tail
+  case xs.kind
+  of lnkCons: xs.next
+  else: xs
+
+proc isEmpty*(xs: List): bool =
+  ## Checks  if list is empty
+  xs.kind == lnkNil
+
+proc `==`*[T](xs, ys: List[T]): bool =
+  ## Compares two lists
+  if (xs.isEmpty, ys.isEmpty) == (true, true): true
+  elif (xs.isEmpty, ys.isEmpty) == (false, false): xs.head == ys.head and xs.tail == ys.tail
+  else: false
+
+proc asList*[T](xs: varargs[T]): List[T] =
+  ## Creates list from varargs
+  proc initListImpl(i: int, xs: openarray[T]): List[T] =
+    if i > high(xs):
+      Nil[T]()
+    else:
+      Cons(xs[i], initListImpl(i+1, xs))
+  initListImpl(0, xs)
+
+proc foldRight*[T,U](xs: List[T], z: U, f: (T, U) -> U): U =
+  case xs.isEmpty
+  of true: z
+  else: f(xs.head, xs.tail.foldRight(z, f))
+
+proc dup*[T](xs: List[T]): List[T] =
+  ## Duplicates the list
+  xs.foldRight(Nil[T](), (x: T, xs: List[T]) => Cons(x, xs))
+
+type
+  ListFormat = enum
+    lfADT, lfSTD
+
+proc asString[T](xs: List[T], f = lfSTD): string =
+  proc asAdt(xs: List[T]): string =
+    case xs.isEmpty
+    of true: "Nil"
+    else: "Cons(" & $xs.head & ", " & xs.tail.asAdt & ")"
+
+  proc asStd(xs: List[T]): string =
+    "List(" & xs.foldLeft("", (s: string, v: T) =>
+      (if s == "": $v else: s & ", " & $v)) & ")"
+
+  case f
+  of lfADT: xs.asAdt
+  else: xs.asStd
+
+proc `$`*[T](xs: List[T]): string =
+  ## Converts list to string
+  result = xs.asString
+
+proc foldLeft*[T,U](xs: List[T], z: U, f: (U, T) -> U): U =
+  case xs.isEmpty
+  of true: z
+  else: foldLeft(xs.tail, f(z, xs.head), f)
+
+suite "unittest compilation error":
+
+  test "issue 3313":
+    let lst = lc[$x | (x <- 'a'..'z'), string].asList
+
+    let lstCopy = lst.dup
+    check: lstCopy == lst
diff --git a/tests/constr/tconstr1.nim b/tests/constr/tconstr1.nim
index 45e303554..28431287c 100644
--- a/tests/constr/tconstr1.nim
+++ b/tests/constr/tconstr1.nim
@@ -3,28 +3,28 @@ discard """
   line: 25
   errormsg: "type mismatch"
 """
-# Test array, record constructors

-

-type

-  TComplexRecord = tuple[

-    s: string,

-    x, y: int,

-    z: float,

-    chars: set[char]]

-

-proc testSem =

-  var

-    things: array [0..1, TComplexRecord] = [

-      (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-      (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})]

-  write(stdout, things[0].x)

-

-const

-  things: array [0..1, TComplexRecord] = [

-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-    (s: "hi", x: 69, y: 45, z: 1.0)] #ERROR

-  otherThings = [  # the same

-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]

+# Test array, record constructors
+
+type
+  TComplexRecord = tuple[
+    s: string,
+    x, y: int,
+    z: float,
+    chars: set[char]]
+
+proc testSem =
+  var
+    things: array [0..1, TComplexRecord] = [
+      (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
+      (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})]
+  write(stdout, things[0].x)
+
+const
+  things: array [0..1, TComplexRecord] = [
+    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
+    (s: "hi", x: 69, y: 45, z: 1.0)] #ERROR
+  otherThings = [  # the same
+    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
+    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
 
 
diff --git a/tests/constr/tconstr2.nim b/tests/constr/tconstr2.nim
index 30cec5cb8..cd00681b8 100644
--- a/tests/constr/tconstr2.nim
+++ b/tests/constr/tconstr2.nim
@@ -2,25 +2,25 @@ discard """
   file: "tconstr2.nim"
   output: "69"
 """
-# Test array, record constructors

-

-type

-  TComplexRecord = tuple[

-    s: string,

-    x, y: int,

-    z: float,

-    chars: set[char]]

-

-const

-  things: array [0..1, TComplexRecord] = [

-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {})] 

-  otherThings = [  # the same

-    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),

-    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]

-

-write(stdout, things[0].x)

-#OUT 69

-

+# Test array, record constructors
+
+type
+  TComplexRecord = tuple[
+    s: string,
+    x, y: int,
+    z: float,
+    chars: set[char]]
+
+const
+  things: array [0..1, TComplexRecord] = [
+    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
+    (s: "hi", x: 69, y: 45, z: 1.0, chars: {})]
+  otherThings = [  # the same
+    (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
+    (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
+
+write(stdout, things[0].x)
+#OUT 69
+
 
 
diff --git a/tests/constraints/tconstraints.nim b/tests/constraints/tconstraints.nim
index e61095fff..ea3f68fd4 100644
--- a/tests/constraints/tconstraints.nim
+++ b/tests/constraints/tconstraints.nim
@@ -3,7 +3,7 @@ discard """
   errormsg: "type mismatch: got (int literal(232))"
 """
 
-proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string = 
+proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string =
   result = $x
 
 type
diff --git a/tests/controlflow/tblock1.nim b/tests/controlflow/tblock1.nim
index 5c41aaf82..e3a780dfe 100644
--- a/tests/controlflow/tblock1.nim
+++ b/tests/controlflow/tblock1.nim
@@ -3,16 +3,16 @@ discard """
   line: 14
   errormsg: "undeclared identifier: \'ha\'"
 """
-# check for forward label and

-# for failure when label is not declared

-

-proc main =

-  block endLess:

-    write(stdout, "Muaahh!\N")

-    break endLess

-

-  break ha #ERROR

-

-main()

+# check for forward label and
+# for failure when label is not declared
+
+proc main =
+  block endLess:
+    write(stdout, "Muaahh!\N")
+    break endLess
+
+  break ha #ERROR
+
+main()
 
 
diff --git a/tests/controlflow/tcontinue.nim b/tests/controlflow/tcontinue.nim
index 092026e8c..ac4fdc2de 100644
--- a/tests/controlflow/tcontinue.nim
+++ b/tests/controlflow/tcontinue.nim
@@ -6,7 +6,7 @@ var i = 0
 while i < 400:
 
   if i == 10: break
-  elif i == 3: 
+  elif i == 3:
     inc i
     continue
   inc i
@@ -16,7 +16,7 @@ var j = 0
 while j < 300:
   for x in 0..34:
     if j < 300: continue
-    if x == 10: 
+    if x == 10:
       echo "failure: should never happen"
       break
   f = "came here"
diff --git a/tests/controlflow/tnestif.nim b/tests/controlflow/tnestif.nim
index bfcd8751c..3d8adb337 100644
--- a/tests/controlflow/tnestif.nim
+++ b/tests/controlflow/tnestif.nim
@@ -2,23 +2,23 @@ discard """
   file: "tnestif.nim"
   output: "i == 2"
 """
-# test nested ifs

-

-var

-    x, y: int

-x = 2

-if x == 0:

-    write(stdout, "i == 0")

-    if y == 0:

-        write(stdout, x)

-    else:

-        write(stdout, y)

-elif x == 1:

-    write(stdout, "i == 1")

-elif x == 2:

-    write(stdout, "i == 2")

-else:

-    write(stdout, "looks like Python")

-#OUT i == 2

+# test nested ifs
+
+var
+    x, y: int
+x = 2
+if x == 0:
+    write(stdout, "i == 0")
+    if y == 0:
+        write(stdout, x)
+    else:
+        write(stdout, y)
+elif x == 1:
+    write(stdout, "i == 1")
+elif x == 2:
+    write(stdout, "i == 2")
+else:
+    write(stdout, "looks like Python")
+#OUT i == 2
 
 
diff --git a/tests/controlflow/tstatret.nim b/tests/controlflow/tstatret.nim
index bf90255a0..d655f5595 100644
--- a/tests/controlflow/tstatret.nim
+++ b/tests/controlflow/tstatret.nim
@@ -3,10 +3,10 @@ discard """
   line: 9
   errormsg: "statement not allowed after"
 """
-# no statement after return

-proc main() =

-  return

-  echo("huch?") #ERROR_MSG statement not allowed after

-

+# no statement after return
+proc main() =
+  return
+  echo("huch?") #ERROR_MSG statement not allowed after
+
 
 
diff --git a/tests/converter/ttypeconverter1.nim b/tests/converter/ttypeconverter1.nim
index 510b84700..39eb6eff1 100644
--- a/tests/converter/ttypeconverter1.nim
+++ b/tests/converter/ttypeconverter1.nim
@@ -7,7 +7,7 @@ converter p(i: int): bool = return i != 0
 
 if 1:
   echo if 4: "foo" else: "barr"
-while 0: 
+while 0:
   echo "bar"
 
 var a: array[3, bool]
diff --git a/tests/cpp/tcppraise.nim b/tests/cpp/tcppraise.nim
new file mode 100644
index 000000000..a9ea8e6ce
--- /dev/null
+++ b/tests/cpp/tcppraise.nim
@@ -0,0 +1,17 @@
+discard """
+  cmd: "nim cpp $file"
+  output: '''foo
+bar
+Need odd and >= 3 digits##
+baz'''
+"""
+
+# bug #1888
+echo "foo"
+try:
+  echo "bar"
+  raise newException(ValueError, "Need odd and >= 3 digits")
+#  echo "baz"
+except ValueError:
+  echo getCurrentExceptionMsg(), "##"
+echo "baz"
diff --git a/tests/cpp/tget_subsystem.nim b/tests/cpp/tget_subsystem.nim
new file mode 100644
index 000000000..461914739
--- /dev/null
+++ b/tests/cpp/tget_subsystem.nim
@@ -0,0 +1,23 @@
+discard """
+  cmd: "nim cpp $file"
+"""
+
+{.emit: """
+
+namespace System {
+  struct Input {};
+}
+
+struct SystemManager {
+  template <class T>
+  static T* getSubsystem() { return new T; }
+};
+
+""".}
+
+type Input {.importcpp: "System::Input".} = object
+proc getSubsystem*[T](): ptr T {.
+  importcpp: "SystemManager::getSubsystem<'*0>()", nodecl.}
+
+let input: ptr Input = getSubsystem[Input]()
+
diff --git a/tests/cpp/trawsockets.nim b/tests/cpp/tnativesockets.nim
index bc129de57..6108380a8 100644
--- a/tests/cpp/trawsockets.nim
+++ b/tests/cpp/tnativesockets.nim
@@ -2,4 +2,4 @@ discard """
   cmd: "nim cpp $file"
 """
 
-import rawsockets
+import nativesockets
diff --git a/tests/cpp/tthread_createthread.nim b/tests/cpp/tthread_createthread.nim
index 0dc081268..2c239005f 100644
--- a/tests/cpp/tthread_createthread.nim
+++ b/tests/cpp/tthread_createthread.nim
@@ -11,4 +11,4 @@ proc main() =
     thread.createThread(threadMain, 0)
     thread.joinThreads()
 
-main()
\ No newline at end of file
+main()
diff --git a/tests/cpp/ttypeinfo2.nim b/tests/cpp/ttypeinfo2.nim
new file mode 100644
index 000000000..64bd43e96
--- /dev/null
+++ b/tests/cpp/ttypeinfo2.nim
@@ -0,0 +1,6 @@
+discard """
+  cmd: "nim cpp $file"
+"""
+# bug #2841
+import typeinfo
+var tt: Any
diff --git a/tests/cpp/tvector_iterator.nim b/tests/cpp/tvector_iterator.nim
new file mode 100644
index 000000000..cb5ab33af
--- /dev/null
+++ b/tests/cpp/tvector_iterator.nim
@@ -0,0 +1,19 @@
+discard """
+  cmd: "nim cpp $file"
+"""
+
+{.emit: """
+
+template <class T>
+struct Vector {
+  struct Iterator {};
+};
+
+""".}
+
+type
+  Vector {.importcpp: "Vector".} [T] = object
+  VectorIterator {.importcpp: "Vector<'0>::Iterator".} [T] = object
+
+var x: VectorIterator[void]
+
diff --git a/tests/cpp/tvectorseq.nim b/tests/cpp/tvectorseq.nim
new file mode 100644
index 000000000..6eb5dc9e4
--- /dev/null
+++ b/tests/cpp/tvectorseq.nim
@@ -0,0 +1,38 @@
+discard """
+  output: '''(x: 1.0)
+(x: 0.0)'''
+  cmd: "nim cpp $file"
+  disabled: "true"
+"""
+
+# This cannot work yet because we omit type information for importcpp'ed types.
+# Fixing this is not hard, but also requires fixing Urhonimo.
+
+# bug #2536
+
+{.emit: """/*TYPESECTION*/
+struct Vector3 {
+public:
+  Vector3(): x(5) {}
+  Vector3(float x_): x(x_) {}
+  float x;
+};
+""".}
+
+type Vector3 {.importcpp: "Vector3", nodecl} = object
+  x: cfloat
+
+proc constructVector3(a: cfloat): Vector3 {.importcpp: "Vector3(@)", nodecl}
+
+# hack around another codegen issue: Generics are attached to where they came
+# from:
+proc `$!`(v:  seq[Vector3]): string = "(x: " & $v[0].x & ")"
+
+proc vec3List*(): seq[Vector3] =
+  let s = @[constructVector3(cfloat(1))]
+  echo($!s)
+  result = s
+  echo($!result)
+
+let f = vec3List()
+#echo($!f)
diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim
index cbaba3154..639dba941 100644
--- a/tests/destructor/tdestructor.nim
+++ b/tests/destructor/tdestructor.nim
@@ -40,7 +40,7 @@ type
     x: A
     y: B
     z: C
-  
+
   TObjKind = enum A, B, C, D
 
   TCaseObj = object
@@ -57,14 +57,14 @@ type
         q: TMyGeneric3[TMyObj, int, int]
       r: string
 
-proc destroy(o: var TMyObj) {.override.} =
+proc `=destroy`(o: var TMyObj) =
   if o.p != nil: dealloc o.p
   echo "myobj destroyed"
 
-proc destroy(o: var TMyGeneric1) {.override.} =
+proc `=destroy`(o: var TMyGeneric1) =
   echo "mygeneric1 destroyed"
 
-proc destroy[A, B](o: var TMyGeneric2[A, B]) {.override.} =
+proc `=destroy`[A, B](o: var TMyGeneric2[A, B]) =
   echo "mygeneric2 destroyed"
 
 proc open: TMyObj =
@@ -83,12 +83,12 @@ proc mygeneric1() =
 
 proc mygeneric2[T](val: T) =
   var a = open()
-  
+
   var b = TMyGeneric2[int, T](x: 10, y: val)
   echo "mygeneric2 constructed"
 
   var c = TMyGeneric3[int, int, string](x: 10, y: 20, z: "test")
-  
+
 proc mygeneric3 =
   var x = TMyGeneric3[int, string, TMyGeneric1[int]](
     x: 10, y: "test", z: TMyGeneric1[int](x: 10))
@@ -111,11 +111,11 @@ proc caseobj =
   block:
     echo "----"
     var o1 = TCaseObj(kind: A, x: TMyGeneric1[int](x: 10))
-  
+
   block:
     echo "----"
     var o2 = TCaseObj(kind: B, y: open())
-  
+
   block:
     echo "----"
     var o3 = TCaseObj(kind: D, innerKind: B, r: "test",
diff --git a/tests/destructor/tdestructor2.nim b/tests/destructor/tdestructor2.nim
index 6f966d861..34fa466af 100644
--- a/tests/destructor/tdestructor2.nim
+++ b/tests/destructor/tdestructor2.nim
@@ -5,14 +5,14 @@ discard """
 
 {.experimental.}
 
-type  
+type
   TMyObj = object
     x, y: int
     p: pointer
-    
-proc destroy(o: var TMyObj) {.override.} =
+
+proc `=destroy`(o: var TMyObj) =
   if o.p != nil: dealloc o.p
-  
+
 proc open: TMyObj =
   result = TMyObj(x: 1, y: 2, p: alloc(3))
 
diff --git a/tests/destructor/tdestructor3.nim b/tests/destructor/tdestructor3.nim
new file mode 100644
index 000000000..0968f1fd7
--- /dev/null
+++ b/tests/destructor/tdestructor3.nim
@@ -0,0 +1,47 @@
+discard """
+  output: '''assign
+destroy
+destroy
+destroy Foo: 5
+5
+destroy Foo: 123
+123'''
+"""
+
+# bug #2821
+{.experimental.}
+
+type T = object
+
+proc `=`(lhs: var T, rhs: T) =
+    echo "assign"
+
+proc `=destroy`(v: var T) =
+    echo "destroy"
+
+block:
+    var v1 : T
+    var v2 : T = v1
+
+
+# bug #1632
+
+type
+  Foo = object of RootObj
+    x: int
+
+proc `=destroy`(a: var Foo) =
+  echo "destroy Foo: " & $a.x
+
+template toFooPtr(a: int{lit}): ptr Foo =
+  var temp = Foo(x:a)
+  temp.addr
+
+proc test(a: ptr Foo) =
+  echo a[].x
+
+proc main =
+  test(toFooPtr(5))
+  test(toFooPtr(123))
+
+main()
diff --git a/tests/dir with space/tspace.nim b/tests/dir with space/tspace.nim
index 8db4b52f2..2b74fa629 100644
--- a/tests/dir with space/tspace.nim
+++ b/tests/dir with space/tspace.nim
@@ -1,3 +1,3 @@
 # Test for the compiler to be able to compile a Nim file with spaces in it.
 
-echo("Successful")
\ No newline at end of file
+echo("Successful")
diff --git a/tests/discard/tdiscardable.nim b/tests/discard/tdiscardable.nim
index a806ccdce..99adcfd30 100644
--- a/tests/discard/tdiscardable.nim
+++ b/tests/discard/tdiscardable.nim
@@ -1,10 +1,10 @@
 # Test the discardable pragma
 
-proc p(x, y: int): int {.discardable.} = 
+proc p(x, y: int): int {.discardable.} =
   return x + y
 
 # test that it is inherited from generic procs too:
-proc q[T](x, y: T): T {.discardable.} = 
+proc q[T](x, y: T): T {.discardable.} =
   return x + y
 
 
diff --git a/tests/discard/tneedsdiscard.nim b/tests/discard/tneedsdiscard.nim
index 2a7856b4a..2df3531e7 100644
--- a/tests/discard/tneedsdiscard.nim
+++ b/tests/discard/tneedsdiscard.nim
@@ -6,7 +6,7 @@ discard """
 proc p =
   var f: TFile
   echo "hi"
-  
+
   open(f, "arg.txt")
-  
+
 p()
diff --git a/tests/discard/tvoidcontext.nim b/tests/discard/tvoidcontext.nim
new file mode 100644
index 000000000..c3ea68bae
--- /dev/null
+++ b/tests/discard/tvoidcontext.nim
@@ -0,0 +1,12 @@
+discard """
+  errormsg: "value of type 'string' has to be discarded"
+  line: 12
+"""
+
+proc valid*(): string =
+  let x = 317
+  "valid"
+
+proc invalid*(): string =
+  result = "foo"
+  "invalid"
diff --git a/tests/distinct/tcurrncy.nim b/tests/distinct/tcurrncy.nim
index 78dbc2a89..7ad4caea4 100644
--- a/tests/distinct/tcurrncy.nim
+++ b/tests/distinct/tcurrncy.nim
@@ -5,7 +5,7 @@ discard """
 template Additive(typ: typeDesc): stmt =
   proc `+` *(x, y: typ): typ {.borrow.}
   proc `-` *(x, y: typ): typ {.borrow.}
-  
+
   # unary operators:
   proc `+` *(x: typ): typ {.borrow.}
   proc `-` *(x: typ): typ {.borrow.}
@@ -27,7 +27,7 @@ template DefineCurrency(typ, base: expr): stmt {.immediate.} =
   Additive(typ)
   Multiplicative(typ, base)
   Comparable(typ)
-  
+
   proc `$` * (t: typ): string {.borrow.}
 
 DefineCurrency(TDollar, int)
diff --git a/tests/distinct/tdistinct_consts.nim b/tests/distinct/tdistinct_consts.nim
new file mode 100644
index 000000000..4f6ced2d2
--- /dev/null
+++ b/tests/distinct/tdistinct_consts.nim
@@ -0,0 +1,20 @@
+
+# bug #2641
+
+type MyChar = distinct char
+const c:MyChar = MyChar('a')
+
+type MyBool = distinct bool
+const b:MyBool = MyBool(true)
+
+type MyBoolSet = distinct set[bool]
+const bs:MyBoolSet = MyBoolSet({true})
+
+type MyCharSet= distinct set[char]
+const cs:MyCharSet = MyCharSet({'a'})
+
+type MyBoolSeq = distinct seq[bool]
+const bseq:MyBoolSeq = MyBoolSeq(@[true, false])
+
+type MyBoolArr = distinct array[3, bool]
+const barr:MyBoolArr = MyBoolArr([true, false, true])
diff --git a/tests/dll/client.nim b/tests/dll/client.nim
index d535e8750..150af3a17 100644
--- a/tests/dll/client.nim
+++ b/tests/dll/client.nim
@@ -22,8 +22,8 @@ else:
 
 proc newLit(x: int): PNode {.importc: "newLit", dynlib: dllname.}
 proc newOp(k: TNodeKind, a, b: PNode): PNode {.
-  importc: "newOp", dynlib: dllname.}  
-proc buildTree(x: int): PNode {.importc: "buildTree", dynlib: dllname.} 
+  importc: "newOp", dynlib: dllname.}
+proc buildTree(x: int): PNode {.importc: "buildTree", dynlib: dllname.}
 
 proc eval(n: PNode): int =
   case n.k
@@ -36,6 +36,6 @@ proc eval(n: PNode): int =
 # Test the GC:
 for i in 0..100_000:
   discard eval(buildTree(2))
-  
+
 echo "Done"
 
diff --git a/tests/dll/server.nim b/tests/dll/server.nim
index df3223444..e6b80df88 100644
--- a/tests/dll/server.nim
+++ b/tests/dll/server.nim
@@ -10,11 +10,11 @@ type
     else: a, b: ref TNode
 
   PNode = ref TNode
-    
+
 proc newLit(x: int): PNode {.exportc: "newLit", dynlib.} =
   new(result)
   result.x = x
-  
+
 proc newOp(k: TNodeKind, a, b: PNode): PNode {.exportc: "newOp", dynlib.} =
   assert a != nil
   assert b != nil
@@ -22,13 +22,13 @@ proc newOp(k: TNodeKind, a, b: PNode): PNode {.exportc: "newOp", dynlib.} =
   result.k = k
   result.a = a
   result.b = b
-  
-proc buildTree(x: int): PNode {.exportc: "buildTree", dynlib.} = 
+
+proc buildTree(x: int): PNode {.exportc: "buildTree", dynlib.} =
   result = newOp(nkMul, newOp(nkAdd, newLit(x), newLit(x)), newLit(x))
 
 when false:
   # Test the GC:
   for i in 0..100_000:
     discard buildTree(2)
-    
+
   echo "Done"
diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim
index ea1ea7b21..ef76c9130 100644
--- a/tests/effects/teffects1.nim
+++ b/tests/effects/teffects1.nim
@@ -7,13 +7,13 @@ type
   TObj = object {.pure, inheritable.}
   TObjB = object of TObj
     a, b, c: string
-  
+
   IO2Error = ref object of IOError
-  
+
 proc forw: int {. .}
-  
+
 proc lier(): int {.raises: [IO2Error].} =
-  writeln stdout, "arg"
+  writeLine stdout, "arg"
 
 proc forw: int =
   raise newException(IOError, "arg")
diff --git a/tests/effects/teffects2.nim b/tests/effects/teffects2.nim
index 89ad16edc..0fa789869 100644
--- a/tests/effects/teffects2.nim
+++ b/tests/effects/teffects2.nim
@@ -7,13 +7,13 @@ type
   TObj = object {.pure, inheritable.}
   TObjB = object of TObj
     a, b, c: string
-  
+
   EIO2 = ref object of IOError
-  
+
 proc forw: int {.raises: [].}
 
 proc lier(): int {.raises: [IOError].} =
-  writeln stdout, "arg"
+  writeLine stdout, "arg"
 
 proc forw: int =
   raise newException(IOError, "arg")
diff --git a/tests/effects/teffects3.nim b/tests/effects/teffects3.nim
index 78543a929..1b18f7b6d 100644
--- a/tests/effects/teffects3.nim
+++ b/tests/effects/teffects3.nim
@@ -8,11 +8,11 @@ type
   TObjB = object of TObj
     a, b, c: string
     fn: proc (): int {.tags: [].}
-  
+
   EIO2 = ref object of EIO
-  
+
 proc raiser(): int {.tags: [TObj, FWriteIO].} =
-  writeln stdout, "arg"
+  writeLine stdout, "arg"
 
 var o: TObjB
 o.fn = raiser
diff --git a/tests/effects/teffects4.nim b/tests/effects/teffects4.nim
index 4584e6dc8..fd5dd49e2 100644
--- a/tests/effects/teffects4.nim
+++ b/tests/effects/teffects4.nim
@@ -8,14 +8,14 @@ type
   TObjB = object of TObj
     a, b, c: string
     fn: proc (): int {.tags: [FReadIO].}
-  
+
   EIO2 = ref object of EIO
 
 proc q() {.tags: [FIO].} =
   nil
-  
+
 proc raiser(): int =
-  writeln stdout, "arg"
+  writeLine stdout, "arg"
   if true:
     q()
 
diff --git a/tests/effects/teffects5.nim b/tests/effects/teffects5.nim
index d630a6fc4..779b4662c 100644
--- a/tests/effects/teffects5.nim
+++ b/tests/effects/teffects5.nim
@@ -6,7 +6,7 @@ discard """
 proc p(q: proc() ): proc() {.tags: [], raises: [], closure.} =
   return proc () =
     q()
-  
+
 let yay = p(proc () = raise newException(EIO, "IO"))
 
 proc main() {.raises: [], tags: [].} = yay()
diff --git a/tests/effects/teffects6.nim b/tests/effects/teffects6.nim
index 47c85c160..e69fe73b6 100644
--- a/tests/effects/teffects6.nim
+++ b/tests/effects/teffects6.nim
@@ -3,7 +3,7 @@ type
   PMenu = ref object
   PMenuItem = ref object
 
-proc createMenuItem*(menu: PMenu, label: string, 
+proc createMenuItem*(menu: PMenu, label: string,
                     action: proc (i: PMenuItem, p: pointer) {.cdecl.}) = discard
 
 var s: PMenu
@@ -19,7 +19,7 @@ createMenuItem(s, "Go to definition...",
 proc noRaise(x: proc()) {.raises: [].} =
   # unknown call that might raise anything, but valid:
   x()
-  
+
 proc doRaise() {.raises: [EIO].} =
   raise newException(EIO, "IO")
 
diff --git a/tests/effects/tgcsafe.nim b/tests/effects/tgcsafe.nim
index 0d5109439..d146794b6 100644
--- a/tests/effects/tgcsafe.nim
+++ b/tests/effects/tgcsafe.nim
@@ -1,5 +1,5 @@
 discard """
-  line: 16
+  line: 17
   errormsg: "'mainUnsafe' is not GC-safe"
   cmd: "nim $target --hints:on --threads:on $options $file"
 """
diff --git a/tests/effects/tsidee1.nim b/tests/effects/tsidee1.nim
index bd5b32dd7..e486d32e7 100644
--- a/tests/effects/tsidee1.nim
+++ b/tests/effects/tsidee1.nim
@@ -11,8 +11,8 @@ proc dontcare(x: int): int = return x + global
 
 proc SideEffectLyer(x, y: int): int {.noSideEffect.} = #ERROR_MSG 'SideEffectLyer' can have side effects
   return x + y + dontcare(x)
-  
-echo SideEffectLyer(1, 3) 
+
+echo SideEffectLyer(1, 3)
 
 
 
diff --git a/tests/effects/tsidee2.nim b/tests/effects/tsidee2.nim
index e73c89608..5ed541300 100644
--- a/tests/effects/tsidee2.nim
+++ b/tests/effects/tsidee2.nim
@@ -8,9 +8,9 @@ var
 
 proc dontcare(x: int): int = return x
 
-proc SideEffectLyer(x, y: int): int {.noSideEffect.} = 
+proc SideEffectLyer(x, y: int): int {.noSideEffect.} =
   return x + y + dontcare(x)
-  
+
 echo SideEffectLyer(1, 3) #OUT 5
 
 
diff --git a/tests/effects/tsidee3.nim b/tests/effects/tsidee3.nim
index e0c427ab6..e15fbc3d1 100644
--- a/tests/effects/tsidee3.nim
+++ b/tests/effects/tsidee3.nim
@@ -8,9 +8,9 @@ var
 
 proc dontcare(x: int): int {.noSideEffect.} = return x
 
-proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} = 
+proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} =
   return x + y + dontcare(x)
-  
+
 echo noSideEffect(1, 3, dontcare) #OUT 5
 
 
diff --git a/tests/effects/tsidee4.nim b/tests/effects/tsidee4.nim
index cbebfbd36..2cb88a23e 100644
--- a/tests/effects/tsidee4.nim
+++ b/tests/effects/tsidee4.nim
@@ -9,9 +9,9 @@ var
 
 proc dontcare(x: int): int = return x
 
-proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} = 
+proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSideEffect.} =
   return x + y + dontcare(x)
-  
+
 echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch
 
 
diff --git a/tests/enum/tenum.nim b/tests/enum/tenum.nim
index 6e53b9c08..b081212e6 100644
--- a/tests/enum/tenum.nim
+++ b/tests/enum/tenum.nim
@@ -1,8 +1,8 @@
-# Test enums

-

-type

-  E = enum a, b, c, x, y, z

-

-var

-  en: E

-en = a

+# Test enums
+
+type
+  E = enum a, b, c, x, y, z
+
+var
+  en: E
+en = a
diff --git a/tests/enum/tenum2.nim b/tests/enum/tenum2.nim
index feba36dd6..3e34a21ce 100644
--- a/tests/enum/tenum2.nim
+++ b/tests/enum/tenum2.nim
@@ -1,14 +1,14 @@
 # Test that enum with holes is handled correctly by case statement
 
 type
-  TEnumHole = enum 
+  TEnumHole = enum
     eA = 0,
     eB = 4,
     eC = 5
-    
+
 var
   e: TEnumHole = eB
-  
+
 case e
 of eA: echo "A"
 of eB: echo "B"
diff --git a/tests/enum/tenum3.nim b/tests/enum/tenum3.nim
index 09a516932..49cbf04d5 100644
--- a/tests/enum/tenum3.nim
+++ b/tests/enum/tenum3.nim
@@ -1,14 +1,14 @@
 # Test enum with explicit size
 
 type
-  TEnumHole {.size: sizeof(int).} = enum 
+  TEnumHole {.size: sizeof(int).} = enum
     eA = 0,
     eB = 4,
     eC = 5
-    
+
 var
   e: TEnumHole = eB
-  
+
 case e
 of eA: echo "A"
 of eB: echo "B"
diff --git a/tests/enum/tenumhole.nim b/tests/enum/tenumhole.nim
index a35526378..68b82e283 100644
--- a/tests/enum/tenumhole.nim
+++ b/tests/enum/tenumhole.nim
@@ -12,10 +12,10 @@ type
     valueB = strValB & "conc",
     valueC,
     valueD = (4, "abc")
- 
+
 # test the new "proc body can be an expr" feature:
 proc getValue: TMyEnum = valueD
- 
+
 # trick the optimizer with a variable:
 var x = getValue()
 echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x
diff --git a/tests/enum/tenumitems.nim b/tests/enum/tenumitems.nim
index 04737fa9e..38233aad7 100644
--- a/tests/enum/tenumitems.nim
+++ b/tests/enum/tenumitems.nim
@@ -1,6 +1,6 @@
 discard """
   line: 7
-  errormsg: "undeclared identifier: 'items'"
+  errormsg: "attempting to call undeclared routine: 'items'"
 """
 
 type a = enum b,c,d
diff --git a/tests/enum/tenummix.nim b/tests/enum/tenummix.nim
index aaf0be2cb..c7db4e056 100644
--- a/tests/enum/tenummix.nim
+++ b/tests/enum/tenummix.nim
@@ -1,11 +1,11 @@
 discard """
-  file: "tenummix.nim"
-  line: 11
+  tfile: "tenummix.nim"
+  tline: 11
   errormsg: "type mismatch"
 """
 
 type
   TE1 = enum eA, eB
   TE2 = enum eC, eD
-  
+
 assert eA != eC
diff --git a/tests/enum/toptions.nim b/tests/enum/toptions.nim
index 3c841de2c..e53acb2b3 100644
--- a/tests/enum/toptions.nim
+++ b/tests/enum/toptions.nim
@@ -1,18 +1,18 @@
-

-type

-  # please make sure we have under 32 options (improves code efficiency!)

-  TOption = enum

-    optNone, optForceFullMake, optBoehmGC, optRefcGC, optRangeCheck,

-    optBoundsCheck, optOverflowCheck, optNilCheck, optAssert, optLineDir,

-    optWarns, optHints, optDeadCodeElim, optListCmd, optCompileOnly,

-    optSafeCode,             # only allow safe code

-    optStyleCheck, optOptimizeSpeed, optOptimizeSize, optGenDynLib,

-    optGenGuiApp, optStackTrace

-

-  TOptionset = set[TOption]

-

-var

-  gOptions: TOptionset = {optRefcGC, optRangeCheck, optBoundsCheck,

-    optOverflowCheck, optAssert, optWarns, optHints, optLineDir, optStackTrace}

-  compilerArgs: int

-  gExitcode: int8

+
+type
+  # please make sure we have under 32 options (improves code efficiency!)
+  TOption = enum
+    optNone, optForceFullMake, optBoehmGC, optRefcGC, optRangeCheck,
+    optBoundsCheck, optOverflowCheck, optNilCheck, optAssert, optLineDir,
+    optWarns, optHints, optDeadCodeElim, optListCmd, optCompileOnly,
+    optSafeCode,             # only allow safe code
+    optStyleCheck, optOptimizeSpeed, optOptimizeSize, optGenDynLib,
+    optGenGuiApp, optStackTrace
+
+  TOptionset = set[TOption]
+
+var
+  gOptions: TOptionset = {optRefcGC, optRangeCheck, optBoundsCheck,
+    optOverflowCheck, optAssert, optWarns, optHints, optLineDir, optStackTrace}
+  compilerArgs: int
+  gExitcode: int8
diff --git a/tests/exception/tcontinuexc.nim b/tests/exception/tcontinuexc.nim
index f618abc14..fb9b523d7 100644
--- a/tests/exception/tcontinuexc.nim
+++ b/tests/exception/tcontinuexc.nim
@@ -21,7 +21,7 @@ try:
       stdout.write("E")
     stdout.write("C")
     raise newException(EsomeotherErr, "bla")
-finally:  
+finally:
   echo "caught"
 
 #OUT ECcaught
diff --git a/tests/exception/tdefer1.nim b/tests/exception/tdefer1.nim
index 61439530a..cb3d09b01 100644
--- a/tests/exception/tdefer1.nim
+++ b/tests/exception/tdefer1.nim
@@ -1,6 +1,11 @@
 discard """
   output: '''hi
-hi'''
+hi
+1
+hi
+2
+B
+A'''
 """
 
 # bug #1742
@@ -16,3 +21,23 @@ import strutils
 let x = try: parseInt("133a")
         except: -1
         finally: echo "hi"
+
+
+template atFuncEnd =
+  defer:
+    echo "A"
+  defer:
+    echo "B"
+
+template testB(): expr =
+    let a = 0
+    defer: echo "hi" # Delete this line to make it work
+    a
+
+proc main =
+  atFuncEnd()
+  echo 1
+  let i = testB()
+  echo 2
+
+main()
diff --git a/tests/exception/texceptionbreak.nim b/tests/exception/texceptionbreak.nim
index 76e986787..00dd8ed9f 100644
--- a/tests/exception/texceptionbreak.nim
+++ b/tests/exception/texceptionbreak.nim
@@ -5,20 +5,20 @@ discard """
 
 # First variety
 try:
-  raise newException(EOS, "Problem")
-except EOS:
+  raise newException(OSError, "Problem")
+except OSError:
   for y in [1, 2, 3]:
     discard
   try:
     discard
-  except EOS:
+  except OSError:
     discard
 echo "1"
 
 # Second Variety
 try:
-  raise newException(EOS, "Problem")
-except EOS:
+  raise newException(OSError, "Problem")
+except OSError:
   for y in [1, 2, 3]:
     discard
   for y in [1, 2, 3]:
@@ -28,8 +28,8 @@ echo "2"
 
 # Third Variety
 try:
-  raise newException(EOS, "Problem")
-except EOS:
+  raise newException(OSError, "Problem")
+except OSError:
   block:
     break
 
@@ -38,8 +38,8 @@ echo "3"
 # Fourth Variety
 block:
   try:
-    raise newException(EOS, "Problem")
-  except EOS:
+    raise newException(OSError, "Problem")
+  except OSError:
     break
 
-echo "4"
\ No newline at end of file
+echo "4"
diff --git a/tests/exception/texceptions.nim b/tests/exception/texceptions.nim
index 69b2d0f6a..bdf338599 100644
--- a/tests/exception/texceptions.nim
+++ b/tests/exception/texceptions.nim
@@ -35,9 +35,9 @@ echo ""
 proc reraise_in_except =
   try:
     echo "BEFORE"
-    raise newException(EIO, "")
+    raise newException(IOError, "")
 
-  except EIO:
+  except IOError:
     echo "EXCEPT"
     raise
 
@@ -52,7 +52,7 @@ echo ""
 proc return_in_except =
   try:
     echo "BEFORE"
-    raise newException(EIO, "")
+    raise newException(IOError, "")
 
   except:
     echo "EXCEPT"
diff --git a/tests/exception/texcsub.nim b/tests/exception/texcsub.nim
index 3dba357f9..02125d2c0 100644
--- a/tests/exception/texcsub.nim
+++ b/tests/exception/texcsub.nim
@@ -5,12 +5,12 @@ discard """
 # Test inheritance for exception matching:
 
 try:
-  raise newException(EOS, "dummy message")
-except E_Base:
+  raise newException(OSError, "dummy message")
+except Exception:
   echo "caught!"
-except: 
+except:
   echo "wtf!?"
-  
+
 #OUT caught!
 
 
diff --git a/tests/exception/tfinally.nim b/tests/exception/tfinally.nim
index 16fb3e7da..aa469d9c0 100644
--- a/tests/exception/tfinally.nim
+++ b/tests/exception/tfinally.nim
@@ -4,14 +4,14 @@ discard """
 """
 # Test return in try statement:
 
-proc main: int = 
+proc main: int =
   try:
     try:
       return 1
     finally:
       echo("came")
       return 2
-  finally: 
+  finally:
     echo("here")
     return 3
 
diff --git a/tests/exception/tfinally2.nim b/tests/exception/tfinally2.nim
index e1e8d4c7e..f1acf2774 100644
--- a/tests/exception/tfinally2.nim
+++ b/tests/exception/tfinally2.nim
@@ -7,7 +7,7 @@ D'''
 """
 # Test break in try statement:
 
-proc main: int = 
+proc main: int =
   try:
     block AB:
       try:
@@ -16,14 +16,14 @@ proc main: int =
         finally:
           echo("A")
         echo("skipped")
-      finally: 
+      finally:
         block B:
           echo("B")
       echo("skipped")
     echo("C")
   finally:
     echo("D")
-    
+
 discard main() #OUT ABCD
 
 
diff --git a/tests/exception/tfinally3.nim b/tests/exception/tfinally3.nim
index e65661cd0..8bccd1a7f 100644
--- a/tests/exception/tfinally3.nim
+++ b/tests/exception/tfinally3.nim
@@ -4,7 +4,7 @@ discard """
 """
 # Test break in try statement:
 
-proc main: bool = 
+proc main: bool =
   while true:
     try:
       return true
diff --git a/tests/exception/tfinally4.nim b/tests/exception/tfinally4.nim
index 05c57c4f5..3aa707ff6 100644
--- a/tests/exception/tfinally4.nim
+++ b/tests/exception/tfinally4.nim
@@ -8,19 +8,19 @@ discard """
 var raiseEx = true
 var returnA = true
 var returnB = false
- 
-proc main: int = 
+
+proc main: int =
   try: #A
     try: #B
       if raiseEx:
-        raise newException(EOS, "")
+        raise newException(OSError, "")
       return 3
     finally: #B
       echo "B1"
       if returnB:
         return 2
       echo "B2"
-  except EOS: #A
+  except OSError: #A
     echo "catch"
   finally: #A
     echo "A1"
diff --git a/tests/exception/tnestedreturn.nim b/tests/exception/tnestedreturn.nim
index 591638f0e..1480764f1 100644
--- a/tests/exception/tnestedreturn.nim
+++ b/tests/exception/tnestedreturn.nim
@@ -7,7 +7,7 @@ discard """
 
 proc test1() =
 
-  finally: echo "A"
+  defer: echo "A"
 
   try:
     raise newException(OSError, "Problem")
@@ -19,7 +19,7 @@ test1()
 
 proc test2() =
 
-  finally: echo "B"
+  defer: echo "B"
 
   try:
     return
diff --git a/tests/exception/tnestedreturn2.nim b/tests/exception/tnestedreturn2.nim
index 4bd2d535d..79523a883 100644
--- a/tests/exception/tnestedreturn2.nim
+++ b/tests/exception/tnestedreturn2.nim
@@ -14,7 +14,7 @@ proc test4() =
     discard
 
 # Should cause unhandled exception error,
-# but could cause segmentation fault if 
+# but could cause segmentation fault if
 # exceptions are not handled properly.
 test4()
 raise newException(OSError, "Problem")
diff --git a/tests/exception/tonraise.nim b/tests/exception/tonraise.nim
index 1a555dd94..a155f0b8e 100644
--- a/tests/exception/tonraise.nim
+++ b/tests/exception/tonraise.nim
@@ -4,8 +4,8 @@ success'''
 """
 
 type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
+  ESomething = object of Exception
+  ESomeOtherErr = object of Exception
 
 proc genErrors(s: string) =
   if s == "error!":
@@ -17,14 +17,14 @@ proc foo() =
   var i = 0
   try:
     inc i
-    onRaise(proc (e: ref E_Base): bool =
+    onRaise(proc (e: ref Exception): bool =
       echo "i: ", i)
     genErrors("errssor!")
   except ESomething:
     echo("ESomething happened")
   except:
     echo("Some other error happened")
-    
+
   # test that raise handler is gone:
   try:
     genErrors("error!")
diff --git a/tests/exception/treraise.nim b/tests/exception/treraise.nim
index cbd0b5f8a..b2a11d34f 100644
--- a/tests/exception/treraise.nim
+++ b/tests/exception/treraise.nim
@@ -4,8 +4,8 @@ discard """
   exitcode: "1"
 """
 type
-  ESomething = object of E_Base
-  ESomeOtherErr = object of E_Base
+  ESomething = object of Exception
+  ESomeOtherErr = object of Exception
 
 proc genErrors(s: string) =
   if s == "error!":
diff --git a/tests/exception/tunhandledexc.nim b/tests/exception/tunhandledexc.nim
index aa9d61236..63a402414 100644
--- a/tests/exception/tunhandledexc.nim
+++ b/tests/exception/tunhandledexc.nim
@@ -18,6 +18,6 @@ when true:
     genErrors("errssor!")
   except ESomething:
     echo("Error happened")
-  
+
 
 
diff --git a/tests/exception/twrongexc.nim b/tests/exception/twrongexc.nim
index 4e921b8a3..b224d4c83 100644
--- a/tests/exception/twrongexc.nim
+++ b/tests/exception/twrongexc.nim
@@ -7,7 +7,7 @@ try:
   raise newException(ValueError, "")
 except OverflowError:
   echo("Error caught")
-  
+
 
 
 
diff --git a/tests/exprs/tstmtexprs.nim b/tests/exprs/tstmtexprs.nim
index d6b827b6d..b2d5db408 100644
--- a/tests/exprs/tstmtexprs.nim
+++ b/tests/exprs/tstmtexprs.nim
@@ -26,16 +26,16 @@ when true:
     result.bar = "bar"
 
   echo($newfoo())
-   
 
-  proc retInt(x, y: int): int = 
+
+  proc retInt(x, y: int): int =
     if (var yy = 0; yy != 0):
       echo yy
     else:
       echo(try: parseInt("1244") except EINvalidValue: -1)
     result = case x
              of 23: 3
-             of 64: 
+             of 64:
                     case y
                     of 1: 2
                     of 2: 3
@@ -79,7 +79,7 @@ semiProblem()
 
 # bug #844
 
-import json 
+import json
 proc parseResponse(): PJsonNode =
   result = % { "key1": % { "key2": % "value" } }
   for key, val in result["key1"]:
diff --git a/tests/fields/tfieldindex.nim b/tests/fields/tfieldindex.nim
index f0674af54..d11c1a8b2 100644
--- a/tests/fields/tfieldindex.nim
+++ b/tests/fields/tfieldindex.nim
@@ -14,7 +14,7 @@ proc indexOf*(t: typedesc, name: string): int =
   for n, x in fieldPairs(d):
     if n == name: return i
     i.inc
-  raise newException(EInvalidValue, "No field " & name & " in type " & 
+  raise newException(EInvalidValue, "No field " & name & " in type " &
     astToStr(t))
 
 echo TMyTuple.indexOf("b")
diff --git a/tests/fields/tfielditerator.nim b/tests/fields/tfielditerator.nim
index 2919aab41..6d15ea05d 100644
--- a/tests/fields/tfielditerator.nim
+++ b/tests/fields/tfielditerator.nim
@@ -28,7 +28,7 @@ proc p(x: string) = echo "a string: ", x
 var x: TMyTuple = ('a', 'b', 5, 6, "abc")
 var y: TMyTuple = ('A', 'b', 5, 9, "abc")
 
-for f in fields(x): 
+for f in fields(x):
   p f
 
 for a, b in fields(x, y):
diff --git a/tests/fields/tfielditerator2.nim b/tests/fields/tfielditerator2.nim
index 70ab9e2ab..c8e230cf5 100644
--- a/tests/fields/tfielditerator2.nim
+++ b/tests/fields/tfielditerator2.nim
@@ -32,7 +32,7 @@ type
     a, b: char
     x, y: int
     z: string
-    
+
   TEnum = enum enA, enB, enC
   TMyCaseObj = object
     case myDisc: TEnum
@@ -51,7 +51,7 @@ proc myobj(a, b: char, x, y: int, z: string): TMyObj =
 var x = myobj('a', 'b', 5, 6, "abc")
 var y = myobj('A', 'b', 5, 9, "abc")
 
-for f in fields(x): 
+for f in fields(x):
   p f
 
 for a, b in fields(x, y):
diff --git a/tests/float/tfloat3.nim b/tests/float/tfloat3.nim
index a3f5a2fc7..a14c6c396 100644
--- a/tests/float/tfloat3.nim
+++ b/tests/float/tfloat3.nim
@@ -8,7 +8,7 @@ import math, strutils
 {.emit: """
 void printFloats(void) {
     double y = 1.234567890123456789;
-    
+
     printf("C double: %.10f, %.10f ", exp(y), cos(y));
 }
 """.}
diff --git a/tests/friends/mfriends.nim b/tests/friends/mfriends.nim
index f1c663655..19672289e 100644
--- a/tests/friends/mfriends.nim
+++ b/tests/friends/mfriends.nim
@@ -1,9 +1,9 @@
 
 type
-  TMyObj = object 
+  TMyObj = object
     x: int
-    
-proc gen*[T](): T = 
+
+proc gen*[T](): T =
   var d: TMyObj
   # access private field here
   d.x = 3
diff --git a/tests/gc/closureleak.nim b/tests/gc/closureleak.nim
index 1c39f43d5..18d320bdf 100644
--- a/tests/gc/closureleak.nim
+++ b/tests/gc/closureleak.nim
@@ -16,7 +16,7 @@ proc free*(some: ref TFoo) =
   alive_foos.del alive_foos.find(some.id)
 proc newFoo*(): ref TFoo =
   new result, free
-  
+
   result.id = foo_counter
   alive_foos.add result.id
   inc foo_counter
@@ -26,7 +26,7 @@ for i in 0 .. <10:
 
 for i in 0 .. <10:
   let f = newFoo()
-  f.fn = proc = 
+  f.fn = proc =
     echo f.id
 
 GC_fullcollect()
diff --git a/tests/gc/gcbench.nim b/tests/gc/gcbench.nim
index 44d952baa..72337911d 100644
--- a/tests/gc/gcbench.nim
+++ b/tests/gc/gcbench.nim
@@ -1,168 +1,168 @@
-discard """

-  outputsub: "Success!"

-"""

-

-# This is adapted from a benchmark written by John Ellis and Pete Kovac

-# of Post Communications.

-# It was modified by Hans Boehm of Silicon Graphics.

-#

-# This is no substitute for real applications. No actual application

-# is likely to behave in exactly this way. However, this benchmark was

-# designed to be more representative of real applications than other

-# Java GC benchmarks of which we are aware.

-# It attempts to model those properties of allocation requests that

-# are important to current GC techniques.

-# It is designed to be used either to obtain a single overall performance

-# number, or to give a more detailed estimate of how collector

-# performance varies with object lifetimes. It prints the time

-# required to allocate and collect balanced binary trees of various

-# sizes. Smaller trees result in shorter object lifetimes. Each cycle

-# allocates roughly the same amount of memory.

-# Two data structures are kept around during the entire process, so

-# that the measured performance is representative of applications

-# that maintain some live in-memory data. One of these is a tree

-# containing many pointers. The other is a large array containing

-# double precision floating point numbers. Both should be of comparable

-# size.

-#

-# The results are only really meaningful together with a specification

-# of how much memory was used. It is possible to trade memory for

-# better time performance. This benchmark should be run in a 32 MB

-# heap, though we don't currently know how to enforce that uniformly.

-#

-# Unlike the original Ellis and Kovac benchmark, we do not attempt

-# measure pause times. This facility should eventually be added back

-# in. There are several reasons for omitting it for now.  The original

-# implementation depended on assumptions about the thread scheduler

-# that don't hold uniformly. The results really measure both the

-# scheduler and GC. Pause time measurements tend to not fit well with

-# current benchmark suites. As far as we know, none of the current

-# commercial Java implementations seriously attempt to minimize GC pause

-# times.

-#

-# Known deficiencies:

-# - No way to check on memory use

-# - No cyclic data structures

-# - No attempt to measure variation with object size

-# - Results are sensitive to locking cost, but we dont

-#   check for proper locking

-#

-

-import

-  strutils, times

-

-type

-  PNode = ref TNode

-  TNode {.final.} = object

-    left, right: PNode

-    i, j: int

-

-proc newNode(L, r: PNode): PNode =

-  new(result)

-  result.left = L

-  result.right = r

-

-const

-  kStretchTreeDepth = 18 # about 16Mb

-  kLongLivedTreeDepth = 16  # about 4Mb

-  kArraySize  = 500000  # about 4Mb

-  kMinTreeDepth = 4

-  kMaxTreeDepth = 16

-

-# Nodes used by a tree of a given size

-proc TreeSize(i: int): int = return ((1 shl (i + 1)) - 1)

-

-# Number of iterations to use for a given tree depth

-proc NumIters(i: int): int =

-  return 2 * TreeSize(kStretchTreeDepth) div TreeSize(i)

-

-# Build tree top down, assigning to older objects.

-proc Populate(iDepth: int, thisNode: PNode) =

-  if iDepth <= 0:

-    return

-  else:

-    new(thisNode.left)

-    new(thisNode.right)

-    Populate(iDepth-1, thisNode.left)

-    Populate(iDepth-1, thisNode.right)

-

-# Build tree bottom-up

-proc MakeTree(iDepth: int): PNode =

-  if iDepth <= 0:

-    new(result)

-  else:

-    return newNode(MakeTree(iDepth-1), MakeTree(iDepth-1))

-

-proc PrintDiagnostics() =

-  echo("Total memory available: " & $getTotalMem() & " bytes")

-  echo("Free memory: " & $getFreeMem() & " bytes")

-

-proc TimeConstruction(depth: int) =

-  var

-    root, tempTree: PNode

-    iNumIters: int

-

-  iNumIters = NumIters(depth)

-

-  echo("Creating " & $iNumIters & " trees of depth " & $depth)

-  var t = epochTime()

-  for i in 0..iNumIters-1:

-    new(tempTree)

-    Populate(depth, tempTree)

-    tempTree = nil

-  echo("\tTop down construction took " & $(epochTime() - t) & "msecs")

-  t = epochTime()

-  for i in 0..iNumIters-1:

-    tempTree = MakeTree(depth)

-    tempTree = nil

-  echo("\tBottom up construction took " & $(epochTime() - t) & "msecs")

-

-type

-  tMyArray = seq[float]

-

-proc main() =

-  var

-    root, longLivedTree, tempTree: PNode

-    myarray: tMyArray

-

-  echo("Garbage Collector Test")

-  echo(" Stretching memory with a binary tree of depth " & $kStretchTreeDepth)

-  PrintDiagnostics()

-  var t = epochTime()

-

-  # Stretch the memory space quickly

-  tempTree = MakeTree(kStretchTreeDepth)

-  tempTree = nil

-

-  # Create a long lived object

-  echo(" Creating a long-lived binary tree of depth " &

-        $kLongLivedTreeDepth)

-  new(longLivedTree)

-  Populate(kLongLivedTreeDepth, longLivedTree)

-

-  # Create long-lived array, filling half of it

-  echo(" Creating a long-lived array of " & $kArraySize & " doubles")

-  newSeq(myarray, kArraySize)

-  for i in 0..kArraySize div 2 -1:

-    myarray[i] = 1.0 / toFloat(i)

-

-  PrintDiagnostics()

-

-  var d = kMinTreeDepth

-  while d <= kMaxTreeDepth:

-    TimeConstruction(d)

-    inc(d, 2)

-

-  if longLivedTree == nil or myarray[1000] != 1.0/1000.0:

-    echo("Failed")

-    # fake reference to LongLivedTree

-    # and array to keep them from being optimized away

-

-  var elapsed = epochTime() - t

-  PrintDiagnostics()

-  echo("Completed in " & $elapsed & "ms. Success!")

+discard """
+  outputsub: "Success!"
+"""
+
+# This is adapted from a benchmark written by John Ellis and Pete Kovac
+# of Post Communications.
+# It was modified by Hans Boehm of Silicon Graphics.
+#
+# This is no substitute for real applications. No actual application
+# is likely to behave in exactly this way. However, this benchmark was
+# designed to be more representative of real applications than other
+# Java GC benchmarks of which we are aware.
+# It attempts to model those properties of allocation requests that
+# are important to current GC techniques.
+# It is designed to be used either to obtain a single overall performance
+# number, or to give a more detailed estimate of how collector
+# performance varies with object lifetimes. It prints the time
+# required to allocate and collect balanced binary trees of various
+# sizes. Smaller trees result in shorter object lifetimes. Each cycle
+# allocates roughly the same amount of memory.
+# Two data structures are kept around during the entire process, so
+# that the measured performance is representative of applications
+# that maintain some live in-memory data. One of these is a tree
+# containing many pointers. The other is a large array containing
+# double precision floating point numbers. Both should be of comparable
+# size.
+#
+# The results are only really meaningful together with a specification
+# of how much memory was used. It is possible to trade memory for
+# better time performance. This benchmark should be run in a 32 MB
+# heap, though we don't currently know how to enforce that uniformly.
+#
+# Unlike the original Ellis and Kovac benchmark, we do not attempt
+# measure pause times. This facility should eventually be added back
+# in. There are several reasons for omitting it for now.  The original
+# implementation depended on assumptions about the thread scheduler
+# that don't hold uniformly. The results really measure both the
+# scheduler and GC. Pause time measurements tend to not fit well with
+# current benchmark suites. As far as we know, none of the current
+# commercial Java implementations seriously attempt to minimize GC pause
+# times.
+#
+# Known deficiencies:
+# - No way to check on memory use
+# - No cyclic data structures
+# - No attempt to measure variation with object size
+# - Results are sensitive to locking cost, but we dont
+#   check for proper locking
+#
+
+import
+  strutils, times
+
+type
+  PNode = ref TNode
+  TNode {.final.} = object
+    left, right: PNode
+    i, j: int
+
+proc newNode(L, r: PNode): PNode =
+  new(result)
+  result.left = L
+  result.right = r
+
+const
+  kStretchTreeDepth = 18 # about 16Mb
+  kLongLivedTreeDepth = 16  # about 4Mb
+  kArraySize  = 500000  # about 4Mb
+  kMinTreeDepth = 4
+  kMaxTreeDepth = 16
+
+# Nodes used by a tree of a given size
+proc TreeSize(i: int): int = return ((1 shl (i + 1)) - 1)
+
+# Number of iterations to use for a given tree depth
+proc NumIters(i: int): int =
+  return 2 * TreeSize(kStretchTreeDepth) div TreeSize(i)
+
+# Build tree top down, assigning to older objects.
+proc Populate(iDepth: int, thisNode: PNode) =
+  if iDepth <= 0:
+    return
+  else:
+    new(thisNode.left)
+    new(thisNode.right)
+    Populate(iDepth-1, thisNode.left)
+    Populate(iDepth-1, thisNode.right)
+
+# Build tree bottom-up
+proc MakeTree(iDepth: int): PNode =
+  if iDepth <= 0:
+    new(result)
+  else:
+    return newNode(MakeTree(iDepth-1), MakeTree(iDepth-1))
+
+proc PrintDiagnostics() =
+  echo("Total memory available: " & $getTotalMem() & " bytes")
+  echo("Free memory: " & $getFreeMem() & " bytes")
+
+proc TimeConstruction(depth: int) =
+  var
+    root, tempTree: PNode
+    iNumIters: int
+
+  iNumIters = NumIters(depth)
+
+  echo("Creating " & $iNumIters & " trees of depth " & $depth)
+  var t = epochTime()
+  for i in 0..iNumIters-1:
+    new(tempTree)
+    Populate(depth, tempTree)
+    tempTree = nil
+  echo("\tTop down construction took " & $(epochTime() - t) & "msecs")
+  t = epochTime()
+  for i in 0..iNumIters-1:
+    tempTree = MakeTree(depth)
+    tempTree = nil
+  echo("\tBottom up construction took " & $(epochTime() - t) & "msecs")
+
+type
+  tMyArray = seq[float]
+
+proc main() =
+  var
+    root, longLivedTree, tempTree: PNode
+    myarray: tMyArray
+
+  echo("Garbage Collector Test")
+  echo(" Stretching memory with a binary tree of depth " & $kStretchTreeDepth)
+  PrintDiagnostics()
+  var t = epochTime()
+
+  # Stretch the memory space quickly
+  tempTree = MakeTree(kStretchTreeDepth)
+  tempTree = nil
+
+  # Create a long lived object
+  echo(" Creating a long-lived binary tree of depth " &
+        $kLongLivedTreeDepth)
+  new(longLivedTree)
+  Populate(kLongLivedTreeDepth, longLivedTree)
+
+  # Create long-lived array, filling half of it
+  echo(" Creating a long-lived array of " & $kArraySize & " doubles")
+  newSeq(myarray, kArraySize)
+  for i in 0..kArraySize div 2 -1:
+    myarray[i] = 1.0 / toFloat(i)
+
+  PrintDiagnostics()
+
+  var d = kMinTreeDepth
+  while d <= kMaxTreeDepth:
+    TimeConstruction(d)
+    inc(d, 2)
+
+  if longLivedTree == nil or myarray[1000] != 1.0/1000.0:
+    echo("Failed")
+    # fake reference to LongLivedTree
+    # and array to keep them from being optimized away
+
+  var elapsed = epochTime() - t
+  PrintDiagnostics()
+  echo("Completed in " & $elapsed & "ms. Success!")
 
 when defined(GC_setMaxPause):
   GC_setMaxPause 2_000
-

-main()

+
+main()
diff --git a/tests/gc/gcemscripten.nim b/tests/gc/gcemscripten.nim
new file mode 100644
index 000000000..bbef13d98
--- /dev/null
+++ b/tests/gc/gcemscripten.nim
@@ -0,0 +1,59 @@
+discard """
+  outputsub: "77\n77"
+"""
+
+## Check how GC/Alloc works in Emscripten
+import strutils
+
+type
+  X = ref XObj
+  XObj = object
+    name: string
+    value: int
+when defined(allow_print):
+  const print = true
+else:
+  const print = false
+
+proc myResult3*(i:int):X {.exportc.} =
+  if print: echo "3"
+  new(result)
+  if print: echo "3-2"
+  result.value = i
+
+proc myResult5*(i:int, x:X):X {.exportc.} =
+  if print: echo "5"
+  system.GC_fullCollect()
+  new(result)
+  if print: echo "5-2"
+  result.value = i
+  x.value = i+1
+  if result.value == x.value:
+    echo "This should not happen. Just allocated variable points to parameter"
+
+proc myResult2*(val: string, i: int): X {.exportc.} =
+  if print: echo "2-1"
+  result = myResult3(i)
+  if print: echo "2-2"
+  system.GC_fullCollect()
+  if print: echo "2-3"
+  var t = new(X)
+  if print: echo "2-4"
+  result.name = val
+  if t.name == "qwe":
+    echo "This should not happen. Variable is GC collected and new one on same place are allocated."
+  if print: echo "2-5"
+
+proc myResult4*(val: string, i: int): X {.exportc.} =
+  if print: echo "4-1"
+  result = myResult5(i, X())
+  if print: echo "4-2"
+
+var x = myResult2("qwe", 77)
+echo intToStr(x.value)
+
+var x2 = myResult4("qwe", 77)
+echo intToStr(x2.value)
+
+
+
diff --git a/tests/gc/gcleak2.nim b/tests/gc/gcleak2.nim
index 41d149bed..101421683 100644
--- a/tests/gc/gcleak2.nim
+++ b/tests/gc/gcleak2.nim
@@ -14,7 +14,7 @@ proc MakeObj(): TTestObj =
   result.x = "Hello"
   result.s = @[1,2,3]
 
-proc inProc() = 
+proc inProc() =
   for i in 1 .. 1_000_000:
     when defined(gcMarkAndSweep):
       GC_fullcollect()
diff --git a/tests/gc/gcleak4.nim b/tests/gc/gcleak4.nim
index 54e74ac7b..d93a13854 100644
--- a/tests/gc/gcleak4.nim
+++ b/tests/gc/gcleak4.nim
@@ -14,7 +14,7 @@ type
   TPlusExpr = object of TExpr
     a, b: ref TExpr
     op2: string
-    
+
 method eval(e: ref TExpr): int =
   # override this base method
   quit "to override!"
@@ -30,7 +30,7 @@ proc newLit(x: int): ref TLiteral =
   {.watchpoint: result.}
   result.x = x
   result.op1 = $getOccupiedMem()
-  
+
 proc newPlus(a, b: ref TExpr): ref TPlusExpr =
   new(result)
   {.watchpoint: result.}
diff --git a/tests/gc/gcleak5.nim b/tests/gc/gcleak5.nim
index 9e2948729..6ab50e19e 100644
--- a/tests/gc/gcleak5.nim
+++ b/tests/gc/gcleak5.nim
@@ -11,12 +11,12 @@ proc main =
     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)
 
diff --git a/tests/gc/gctest.nim b/tests/gc/gctest.nim
index 2213a83ac..b3b9af608 100644
--- a/tests/gc/gctest.nim
+++ b/tests/gc/gctest.nim
@@ -22,7 +22,7 @@ type
     data: string
     sons: seq[TBNode] # directly embedded!
     t: TTable
-    
+
   TCaseKind = enum nkStr, nkWhole, nkList
   PCaseNode = ref TCaseNode
   TCaseNode {.final.} = object
@@ -33,7 +33,7 @@ type
 
   TIdObj* = object of TObject
     id*: int  # unique id; use this for comparisons and not the pointers
-  
+
   PIdObj* = ref TIdObj
   PIdent* = ref TIdent
   TIdent*{.acyclic.} = object of TIdObj
@@ -53,22 +53,21 @@ proc newCaseNode(data: string): PCaseNode =
     result.kind = nkWhole
     result.unused = @["", "abc", "abdc"]
   flip = 1 - flip
-  
+
 proc newCaseNode(a, b: PCaseNode): PCaseNode =
   new(result)
   result.kind = nkList
   result.sons = @[a, b]
-  
+
 proc caseTree(lvl: int = 0): PCaseNode =
   if lvl == 3: result = newCaseNode("data item")
   else: result = newCaseNode(caseTree(lvl+1), caseTree(lvl+1))
 
-proc finalizeBNode(n: TBNode) = writeln(stdout, n.data)
 proc finalizeNode(n: PNode) =
   assert(n != nil)
   write(stdout, "finalizing: ")
-  if isNil(n.data): writeln(stdout, "nil!")
-  else: writeln(stdout, n.data)
+  if isNil(n.data): writeLine(stdout, "nil!")
+  else: writeLine(stdout, "not nil")
 
 var
   id: int = 1
@@ -82,7 +81,7 @@ proc buildTree(depth = 1): PNode =
   inc(id)
 
 proc returnTree(): PNode =
-  writeln(stdout, "creating id: " & $id)
+  writeLine(stdout, "creating id: " & $id)
   new(result, finalizeNode)
   result.data = $id
   new(result.le, finalizeNode)
@@ -92,26 +91,26 @@ proc returnTree(): PNode =
   inc(id)
 
   # now create a cycle:
-  writeln(stdout, "creating id (cyclic): " & $id)
+  writeLine(stdout, "creating id (cyclic): " & $id)
   var cycle: PNode
   new(cycle, finalizeNode)
   cycle.data = $id
   cycle.le = cycle
   cycle.ri = cycle
   inc(id)
-  #writeln(stdout, "refcount: " & $refcount(cycle))
-  #writeln(stdout, "refcount le: " & $refcount(cycle.le))
-  #writeln(stdout, "refcount ri: " & $refcount(cycle.ri))
+  #writeLine(stdout, "refcount: " & $refcount(cycle))
+  #writeLine(stdout, "refcount le: " & $refcount(cycle.le))
+  #writeLine(stdout, "refcount ri: " & $refcount(cycle.ri))
 
 proc printTree(t: PNode) =
   if t == nil: return
-  writeln(stdout, "printing")
-  writeln(stdout, t.data)
+  writeLine(stdout, "printing")
+  writeLine(stdout, t.data)
   printTree(t.le)
   printTree(t.ri)
 
 proc unsureNew(result: var PNode) =
-  writeln(stdout, "creating unsure id: " & $id)
+  writeLine(stdout, "creating unsure id: " & $id)
   new(result, finalizeNode)
   result.data = $id
   new(result.le, finalizeNode)
@@ -147,7 +146,7 @@ proc buildBTree(father: var TBNode) =
     father.t.data = @["ha", "lets", "stress", "it"]
   setSons(father)
 
-proc getIdent(identifier: cstring, length: int, h: int): PIdent = 
+proc getIdent(identifier: cstring, length: int, h: int): PIdent =
   new(result)
   result.h = h
   result.s = newString(length)
@@ -157,7 +156,7 @@ proc main() =
   discard getIdent("hall", 4, 0)
   discard getIdent("echo", 4, 0)
   discard getIdent("huch", 4, 0)
-  
+
   var
     father: TBNode
   for i in 1..1_00:
@@ -176,7 +175,7 @@ proc main() =
   var s: seq[string] = @[]
   for i in 1..100:
     add s, "hohoho" # test reallocation
-  writeln(stdout, s[89])
+  writeLine(stdout, s[89])
   write(stdout, "done!\n")
 
 var
@@ -184,7 +183,7 @@ var
     s: string
 s = ""
 s = ""
-writeln(stdout, repr(caseTree()))
+writeLine(stdout, repr(caseTree()))
 father.t.data = @["ha", "lets", "stress", "it"]
 father.t.data = @["ha", "lets", "stress", "it"]
 var t = buildTree()
@@ -199,5 +198,5 @@ GC_fullCollect()
 # the M&S GC fails with this call and it's unclear why. Definitely something
 # we need to fix!
 GC_fullCollect()
-writeln(stdout, GC_getStatistics())
+writeLine(stdout, GC_getStatistics())
 write(stdout, "finished\n")
diff --git a/tests/gc/refarrayleak.nim b/tests/gc/refarrayleak.nim
index 12c9145f8..57b489721 100644
--- a/tests/gc/refarrayleak.nim
+++ b/tests/gc/refarrayleak.nim
@@ -28,7 +28,7 @@ proc newArrayHolder: ref TArrayHolder =
 proc loop =
   for i in 0..10000:
     discard newArrayHolder()
-    
+
   if getOccupiedMem() > 300_000:
     echo "still a leak! ", getOccupiedMem()
     quit 1
diff --git a/tests/generics/mbind_bracket.nim b/tests/generics/mbind_bracket.nim
new file mode 100644
index 000000000..4bf18b471
--- /dev/null
+++ b/tests/generics/mbind_bracket.nim
@@ -0,0 +1,17 @@
+
+import tables
+
+type
+  UUIDObject* = ref object
+    uuid: string
+
+  Registry*[T] = ref object
+    objects: Table[string, T]
+
+proc newRegistry*[T](): Registry[T] =
+  result = Registry[T]()
+  result.objects = initTable[string, T](128)
+
+proc register*[T](self: Registry[T], obj: T) =
+  self.objects[obj.uuid] = obj
+
diff --git a/tests/generics/mclosed_sym.nim b/tests/generics/mclosed_sym.nim
new file mode 100644
index 000000000..bcccd9a85
--- /dev/null
+++ b/tests/generics/mclosed_sym.nim
@@ -0,0 +1,10 @@
+
+type R* = object
+
+type Data*[T] = object
+  d*: T
+
+proc same(r:R, d:int) = echo "TEST2"
+
+proc doIt*(d:Data, r:R) =
+  r.same(1)      # Expecting this to invoke the local `same()` method
diff --git a/tests/generics/mmodule_same_as_proc.nim b/tests/generics/mmodule_same_as_proc.nim
new file mode 100644
index 000000000..048b98336
--- /dev/null
+++ b/tests/generics/mmodule_same_as_proc.nim
@@ -0,0 +1,2 @@
+
+proc mmodule_same_as_proc*(x: string) = discard
diff --git a/tests/generics/moverloading_typedesc.nim b/tests/generics/moverloading_typedesc.nim
new file mode 100644
index 000000000..92805fb7b
--- /dev/null
+++ b/tests/generics/moverloading_typedesc.nim
@@ -0,0 +1,11 @@
+import tables
+
+type
+  FFoo* = object
+  FBar* = object
+
+proc new*(_: typedesc[FFoo]): int = 2
+proc new*[T](_: typedesc[T]): int = 3
+proc new*(_: typedesc): int = 4
+proc new*(_: typedesc[seq[Table[int, seq[Table[int, string]]]]]): int = 5
+proc new*(_: typedesc[seq[Table[int, seq[Table[int, typedesc]]]]]): int = 6
diff --git a/tests/generics/t1056.nim b/tests/generics/t1056.nim
index b1fe25894..de8bde8ef 100644
--- a/tests/generics/t1056.nim
+++ b/tests/generics/t1056.nim
@@ -17,7 +17,7 @@ proc echoMatrix(a: TMatrix) =
 
 proc echoMat2(a: TMat2) =
   echo TMat2.M
-  
+
 var m = TMatrix[3,3,int](data: [1,2,3,4,5,6,7,8,9])
 
 echoMatrix m
diff --git a/tests/generics/t1789.nim b/tests/generics/t1789.nim
index 188db88f6..c3fe336af 100644
--- a/tests/generics/t1789.nim
+++ b/tests/generics/t1789.nim
@@ -38,7 +38,7 @@ type
 proc `[]`*[N, T](f: Bar[N, T], n: range[0..(N - 1)]): T =
   assert high(n) == N-1
   result = f.bar[n]
-  
+
 var b: Bar[3, int]
 echo b[2]
 
diff --git a/tests/generics/tbind_bracket.nim b/tests/generics/tbind_bracket.nim
new file mode 100644
index 000000000..d0c5e2c6b
--- /dev/null
+++ b/tests/generics/tbind_bracket.nim
@@ -0,0 +1,20 @@
+discard """
+  output: "317"
+"""
+
+# bug #2599
+
+import mbind_bracket
+
+# also test that `[]` can be passed now as a first class construct:
+
+template takeBracket(x, a, i: untyped) =
+  echo x(a, i)
+
+var a: array[10, int]
+a[8] = 317
+
+takeBracket(`[]`, a, 8)
+
+let reg = newRegistry[UUIDObject]()
+reg.register(UUIDObject())
diff --git a/tests/generics/tbintre2.nim b/tests/generics/tbintre2.nim
index 2a7225411..eb46b5157 100644
--- a/tests/generics/tbintre2.nim
+++ b/tests/generics/tbintre2.nim
@@ -15,7 +15,7 @@ if find(root, "world"):
   for str in items(root):
     stdout.write(str)
 else:
-  stdout.writeln("BUG")
+  stdout.writeLine("BUG")
 
 var
   r2: PBinaryTree[int]
diff --git a/tests/generics/tbintree.nim b/tests/generics/tbintree.nim
index 8cc8acb82..13163f764 100644
--- a/tests/generics/tbintree.nim
+++ b/tests/generics/tbintree.nim
@@ -92,7 +92,7 @@ when isMainModule:
     for str in items(root):
       stdout.write(str)
   else:
-    stdout.writeln("BUG")
+    stdout.writeLine("BUG")
 
   var
     r2: PBinaryTree[int]
diff --git a/tests/generics/tcan_alias_generic.nim b/tests/generics/tcan_alias_generic.nim
index 780a47841..b357b33e9 100644
--- a/tests/generics/tcan_alias_generic.nim
+++ b/tests/generics/tcan_alias_generic.nim
@@ -2,10 +2,9 @@
 ## can_alias_generic Nim Module
 ##
 ## Created by Eric Doughty-Papassideris on 2011-02-16.
-## Copyright (c) 2011 FWA. All rights reserved.
 
 type
   TGen[T] = object
   TGen2[T] = TGen[T]
-  
+
 
diff --git a/tests/generics/tcan_alias_specialised_generic.nim b/tests/generics/tcan_alias_specialised_generic.nim
index a737d3580..c94edd611 100644
--- a/tests/generics/tcan_alias_specialised_generic.nim
+++ b/tests/generics/tcan_alias_specialised_generic.nim
@@ -6,12 +6,11 @@ discard """
 ## can_alias_specialised_generic Nim Module
 ##
 ## Created by Eric Doughty-Papassideris on 2011-02-16.
-## Copyright (c) 2011 FWA. All rights reserved.
 
 type
   TGen[T] = object
   TSpef = TGen[string]
-  
+
 var
   s: TSpef
 
diff --git a/tests/generics/tcan_inherit_generic.nim b/tests/generics/tcan_inherit_generic.nim
index ce2b6452f..331fcfd5c 100644
--- a/tests/generics/tcan_inherit_generic.nim
+++ b/tests/generics/tcan_inherit_generic.nim
@@ -2,12 +2,11 @@
 ## can_inherit_generic Nim Module
 ##
 ## Created by Eric Doughty-Papassideris on 2011-02-16.
-## Copyright (c) 2011 FWA. All rights reserved.
 
 type
   TGen[T] = object of TObject
     x, y: T
-  
+
   TSpef[T] = object of TGen[T]
 
 
diff --git a/tests/generics/tcan_specialise_generic.nim b/tests/generics/tcan_specialise_generic.nim
index c510910e8..78896db38 100644
--- a/tests/generics/tcan_specialise_generic.nim
+++ b/tests/generics/tcan_specialise_generic.nim
@@ -2,10 +2,9 @@
 ## can_specialise_generic Nim Module
 ##
 ## Created by Eric Doughty-Papassideris on 2011-02-16.
-## Copyright (c) 2011 FWA. All rights reserved.
 
 type
   TGen[T] = object {.inheritable.}
   TSpef = object of TGen[string]
-  
+
 
diff --git a/tests/generics/tclosed_sym.nim b/tests/generics/tclosed_sym.nim
new file mode 100644
index 000000000..ff620c267
--- /dev/null
+++ b/tests/generics/tclosed_sym.nim
@@ -0,0 +1,11 @@
+discard """
+  output: "TEST2"
+"""
+
+# bug #2664
+
+import mclosed_sym
+
+proc same(r:R, d:int) = echo "TEST1"
+
+doIt(Data[int](d:123), R())
diff --git a/tests/generics/tconfusing_arrow.nim b/tests/generics/tconfusing_arrow.nim
index 6a5a9d682..f63a874e0 100644
--- a/tests/generics/tconfusing_arrow.nim
+++ b/tests/generics/tconfusing_arrow.nim
@@ -5,7 +5,7 @@ type Deck = object
 
 proc sort(h: var seq[Deck]) =
   # works:
-  h.sort(proc (x, y: Deck): auto = 
+  h.sort(proc (x, y: Deck): auto =
     cmp(x.value, y.value))
   # fails:
   h.sort((x, y: Deck) => cmp(ord(x.value), ord(y.value)))
diff --git a/tests/destructor/tdictdestruct.nim b/tests/generics/tdictdestruct.nim
index 17ded4853..228d93e66 100644
--- a/tests/destructor/tdictdestruct.nim
+++ b/tests/generics/tdictdestruct.nim
@@ -13,8 +13,8 @@ proc destroyDict[TK, TV](a: PDict[TK, TV]) =
 proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] =
     fakeNew(result, destroyDict[TK, TV])
 
-# Problem: destroyDict is not instantiated when newDict is instantiated!    
+# Problem: destroyDict is not instantiated when newDict is instantiated!
 
-discard newDict("a", "b")    
+discard newDict("a", "b")
 
 
diff --git a/tests/generics/tdont_use_inner_scope.nim b/tests/generics/tdont_use_inner_scope.nim
new file mode 100644
index 000000000..45b11fc22
--- /dev/null
+++ b/tests/generics/tdont_use_inner_scope.nim
@@ -0,0 +1,27 @@
+
+# bug #2752
+
+import future, sequtils
+
+proc myFilter[T](it: (iterator(): T), f: (proc(anything: T):bool)): (iterator(): T) =
+  iterator aNameWhichWillConflict(): T {.closure.}=
+    for x in it():
+      if f(x):
+        yield x
+  result = aNameWhichWillConflict
+
+
+iterator testIt():int {.closure.}=
+  yield -1
+  yield 2
+
+#let unusedVariable = myFilter(testIt, (x: int) => x > 0)
+
+proc onlyPos(it: (iterator(): int)): (iterator(): int)=
+  iterator aNameWhichWillConflict(): int {.closure.}=
+    var filtered = onlyPos(myFilter(it, (x:int) => x > 0))
+    for x in filtered():
+      yield x
+  result = aNameWhichWillConflict
+
+let x = onlyPos(testIt)
diff --git a/tests/generics/texplicitgeneric1.nim b/tests/generics/texplicitgeneric1.nim
index d54044368..ac0197c1a 100644
--- a/tests/generics/texplicitgeneric1.nim
+++ b/tests/generics/texplicitgeneric1.nim
@@ -5,33 +5,33 @@ discard """
 # test explicit type instantiation
 
 type
-  TDict*[TKey, TValue] = object 
+  TDict*[TKey, TValue] = object
     data: seq[tuple[k: TKey, v: TValue]]
   PDict*[TKey, #with `==`(a, b: TKey): bool
-               #     hash(a: TKey): int, 
+               #     hash(a: TKey): int,
          TValue] = ref TDict[TKey, TValue]
-  
-proc newDict*[TKey, TValue](): PDict[TKey, TValue] = 
+
+proc newDict*[TKey, TValue](): PDict[TKey, TValue] =
   new(result)
   result.data = @[]
-  
-proc add*[TKey, TValue](d: PDict[TKey, TValue], k: TKey, v: TValue) = 
+
+proc add*[TKey, TValue](d: PDict[TKey, TValue], k: TKey, v: TValue) =
   d.data.add((k, v))
-  
-iterator items*[Tkey, TValue](d: PDict[TKey, TValue]): tuple[k: TKey, 
-               v: TValue] = 
+
+iterator items*[Tkey, TValue](d: PDict[TKey, TValue]): tuple[k: TKey,
+               v: TValue] =
   for k, v in items(d.data): yield (k, v)
-    
+
 var d = newDict[int, string]()
 d.add(12, "12")
 d.add(13, "13")
-for k, v in items(d): 
+for k, v in items(d):
   stdout.write("Key: ", $k, " value: ", v)
 
 var c = newDict[char, string]()
 c.add('A', "12")
 c.add('B', "13")
-for k, v in items(c): 
+for k, v in items(c):
   stdout.write(" Key: ", $k, " value: ", v)
 
 
diff --git a/tests/generics/texplicitgeneric2.nim b/tests/generics/texplicitgeneric2.nim
index 95461d023..c4af17b7b 100644
--- a/tests/generics/texplicitgeneric2.nim
+++ b/tests/generics/texplicitgeneric2.nim
@@ -6,30 +6,30 @@ discard """
 # test explicit type instantiation
 
 type
-  TDict*[TKey, TValue] = object 
+  TDict*[TKey, TValue] = object
     data: seq[tuple[k: TKey, v: TValue]]
   PDict*[TKey, TValue] = ref TDict[TKey, TValue]
-  
-proc newDict*[TKey, TValue](): PDict[TKey, TValue] = 
+
+proc newDict*[TKey, TValue](): PDict[TKey, TValue] =
   new(result)
   result.data = @[]
-  
-proc add*(d: PDict, k: TKey, v: TValue) = 
+
+proc add*(d: PDict, k: TKey, v: TValue) =
   d.data.add((k, v))
-  
 
-#iterator items*(d: PDict): tuple[k: TKey, v: TValue] = 
+
+#iterator items*(d: PDict): tuple[k: TKey, v: TValue] =
 #  for k, v in items(d.data): yield (k, v)
-    
+
 var d = newDict[int, string]()
 d.add(12, "12")
 d.add(13, "13")
-for k, v in items(d): 
+for k, v in items(d):
   stdout.write("Key: ", $k, " value: ", v)
 
 var c = newDict[char, string]()
 c.add('A', "12")
 c.add('B', "13")
-for k, v in items(c): 
+for k, v in items(c):
   stdout.write(" Key: ", $k, " value: ", v)
 
diff --git a/tests/generics/tgeneric1.nim b/tests/generics/tgeneric1.nim
index 5d20a864b..5349f8f1d 100644
--- a/tests/generics/tgeneric1.nim
+++ b/tests/generics/tgeneric1.nim
@@ -9,7 +9,7 @@ type
   TBinHeap[T] = object
     heap: seq[TNode[T]]
     last: int
-  
+
   PBinHeap[T] = ref TBinHeap[T]
 
 proc newBinHeap*[T](heap: var PBinHeap[T], size: int) =
@@ -17,7 +17,7 @@ proc newBinHeap*[T](heap: var PBinHeap[T], size: int) =
   heap.last = 0
   newSeq(heap.heap, size)
   #newSeq(heap.seq, size)
- 
+
 proc parent(elem: int): int {.inline.} =
   return (elem-1) div 2
 
diff --git a/tests/generics/tgeneric3.nim b/tests/generics/tgeneric3.nim
index 289bf1fd5..d4dac9385 100644
--- a/tests/generics/tgeneric3.nim
+++ b/tests/generics/tgeneric3.nim
@@ -37,25 +37,25 @@ proc clean[T: SomeOrdinal|SomeNumber](o: var T) {.inline.} = discard
 proc clean[T: string|seq](o: var T) {.inline.} =
   o = nil
 
-proc clean[T,D] (o: ref TItem[T,D]) {.inline.} = 
+proc clean[T,D] (o: ref TItem[T,D]) {.inline.} =
   when (D is string) :
     o.value = nil
   else :
     o.val_set = false
 
-proc isClean[T,D] (it: ref TItem[T,D]): bool {.inline.} = 
+proc isClean[T,D] (it: ref TItem[T,D]): bool {.inline.} =
   when (D is string) :
     return it.value == nil
   else :
     return not it.val_set
 
-proc isClean[T,D](n: PNode[T,D], x: int): bool {.inline.} = 
+proc isClean[T,D](n: PNode[T,D], x: int): bool {.inline.} =
   when (D is string):
     return n.slots[x].value == nil
   else:
     return not n.slots[x].val_set
 
-proc setItem[T,D](Akey: T, Avalue: D, ANode: PNode[T,D]): ref TItem[T,D] {.inline.} = 
+proc setItem[T,D](Akey: T, Avalue: D, ANode: PNode[T,D]): ref TItem[T,D] {.inline.} =
   new(result)
   result.key = Akey
   result.value = Avalue
@@ -72,8 +72,8 @@ template binSearchImpl *(docmp: expr) {.immediate.} =
   var H = haystack.len -1
   while result <= H :
     var I {.inject.} = (result + H) shr 1
-    var SW = docmp 
-    if SW < 0: result = I + 1 
+    var SW = docmp
+    if SW < 0: result = I + 1
     else:
       H = I - 1
       if SW == 0 : bFound = true
@@ -85,14 +85,14 @@ proc bSearch[T,D] (haystack: PNode[T,D], needle:T): int {.inline.} =
 
 proc DeleteItem[T,D] (n: PNode[T,D], x: int): PNode[T,D] {.inline.} =
   var w = n.slots[x]
-  if w.node != nil : 
+  if w.node != nil :
     clean(w)
     return n
   dec(n.count)
   if n.count > 0 :
     for i in countup(x, n.count -1) : n.slots[i] = n.slots[i + 1]
     n.slots[n.count] = nil
-    case n.count 
+    case n.count
     of cLen1 : setLen(n.slots, cLen1)
     of cLen2 : setLen(n.slots, cLen2)
     of cLen3 : setLen(n.slots, cLen3)
@@ -106,7 +106,7 @@ proc DeleteItem[T,D] (n: PNode[T,D], x: int): PNode[T,D] {.inline.} =
     n.slots = nil
     n.left = nil
 
-proc internalDelete[T,D] (ANode: PNode[T,D], key: T, Avalue: var D): PNode[T,D] = 
+proc internalDelete[T,D] (ANode: PNode[T,D], key: T, Avalue: var D): PNode[T,D] =
   var Path: array[0..20, RPath[T,D]]
   var n = ANode
   result = n
@@ -126,20 +126,20 @@ proc internalDelete[T,D] (ANode: PNode[T,D], key: T, Avalue: var D): PNode[T,D]
           n = n.slots[x].node
         else :
           n = nil
-    else : 
+    else :
       dec(x)
       if isClean(n, x) : return
       Avalue = n.slots[x].value
       var n2 = DeleteItem(n, x)
       dec(h)
       while (n2 != n) and (h >=0) :
-        n = n2 
+        n = n2
         var w = addr Path[h]
         x  = w.Xi -1
         if x >= 0 :
           if (n == nil) and isClean(w.Nd, x) :
             n = w.Nd
-            n.slots[x].node = nil 
+            n.slots[x].node = nil
             n2 = DeleteItem(n, x)
           else :
             w.Nd.slots[x].node = n
@@ -161,7 +161,7 @@ proc internalFind[T,D] (n: PNode[T,D], key: T): ref TItem[T,D] {.inline.} =
         wn = wn.left
       else :
         x = (-x) -1
-        if x < wn.count : 
+        if x < wn.count :
           wn = wn.slots[x].node
         else :
           return nil
@@ -171,7 +171,7 @@ proc internalFind[T,D] (n: PNode[T,D], key: T): ref TItem[T,D] {.inline.} =
   return nil
 
 proc traceTree[T,D](root: PNode[T,D]) =
-  proc traceX(x: int) = 
+  proc traceX(x: int) =
     write stdout, "("
     write stdout, x
     write stdout, ") "
@@ -184,7 +184,7 @@ proc traceTree[T,D](root: PNode[T,D]) =
 
 
   proc traceln(space: string) =
-    writeln stdout, ""
+    writeLine stdout, ""
     write stdout, space
 
   proc doTrace(n: PNode[T,D], level: int) =
@@ -192,7 +192,7 @@ proc traceTree[T,D](root: PNode[T,D]) =
     traceln(space)
     write stdout, "node: "
     if n == nil:
-      writeln stdout, "is empty"
+      writeLine stdout, "is empty"
       return
     write stdout, n.count
     write stdout, " elements: "
@@ -204,7 +204,7 @@ proc traceTree[T,D](root: PNode[T,D]) =
       if el != nil and not isClean(el):
         traceln(space)
         traceX(i)
-        if i >= n.count: 
+        if i >= n.count:
           write stdout, "error "
         else:
           traceEl(el)
@@ -219,14 +219,14 @@ proc traceTree[T,D](root: PNode[T,D]) =
         else : write stdout, el.key
         if el.node != nil: doTrace(el.node, level +1)
         else : write stdout, " empty "
-    writeln stdout,""
+    writeLine stdout,""
 
   doTrace(root, 0)
 
 proc InsertItem[T,D](APath: RPath[T,D], ANode:PNode[T,D], Akey: T, Avalue: D) =
   var x = - APath.Xi
   inc(APath.Nd.count)
-  case APath.Nd.count 
+  case APath.Nd.count
   of cLen1: setLen(APath.Nd.slots, cLen2)
   of cLen2: setLen(APath.Nd.slots, cLen3)
   of cLen3: setLen(APath.Nd.slots, cLenCenter)
@@ -286,7 +286,7 @@ proc internalPut[T,D](ANode: ref TNode[T,D], Akey: T, Avalue: D, Oldvalue: var D
     if x <= 0 :
       Path[h].Nd = n
       Path[h].Xi = x
-      inc(h) 
+      inc(h)
       if x == 0 :
         n = n.left
       else :
@@ -337,40 +337,40 @@ proc CleanTree[T,D](n: PNode[T,D]): PNode[T,D] =
 proc VisitAllNodes[T,D](n: PNode[T,D], visit: proc(n: PNode[T,D]): PNode[T,D] {.closure.} ): PNode[T,D] =
   if n != nil :
     if n.left != nil :
-      n.left = VisitAllNodes(n.left, visit)    
+      n.left = VisitAllNodes(n.left, visit)
     for i in 0 .. n.count - 1 :
       var w = n.slots[i]
       if w.node != nil :
-        w.node = VisitAllNodes(w.node, visit)    
+        w.node = VisitAllNodes(w.node, visit)
     return visit(n)
   return nil
 
 proc VisitAllNodes[T,D](n: PNode[T,D], visit: proc(n: PNode[T,D]) {.closure.} ) =
   if n != nil:
     if n.left != nil :
-      VisitAllNodes(n.left, visit)    
+      VisitAllNodes(n.left, visit)
     for i in 0 .. n.count - 1 :
       var w = n.slots[i]
       if w.node != nil :
-        VisitAllNodes(w.node, visit)    
+        VisitAllNodes(w.node, visit)
     visit(n)
 
 proc VisitAll[T,D](n: PNode[T,D], visit: proc(Akey: T, Avalue: D) {.closure.} ) =
   if n != nil:
     if n.left != nil :
-      VisitAll(n.left, visit) 
+      VisitAll(n.left, visit)
     for i in 0 .. n.count - 1 :
       var w = n.slots[i]
       if not w.isClean :
-        visit(w.key, w.value)   
+        visit(w.key, w.value)
       if w.node != nil :
-        VisitAll(w.node, visit)    
+        VisitAll(w.node, visit)
 
 proc VisitAll[T,D](n: PNode[T,D], visit: proc(Akey: T, Avalue: var D):bool {.closure.} ): PNode[T,D] =
   if n != nil:
     var n1 = n.left
     if n1 != nil :
-      var n2 = VisitAll(n1, visit) 
+      var n2 = VisitAll(n1, visit)
       if n1 != n2 :
         n.left = n2
     var i = 0
@@ -395,7 +395,7 @@ iterator keys* [T,D] (n: PNode[T,D]): T =
     var level = 0
     var nd = n
     var i = -1
-    while true : 
+    while true :
       if i < nd.count :
         Path[level].Nd = nd
         Path[level].Xi = i
@@ -471,4 +471,4 @@ when isMainModule:
 
 
 
-  test()  
\ No newline at end of file
+  test()
diff --git a/tests/generics/tgenericdefaults.nim b/tests/generics/tgenericdefaults.nim
index ad96f1851..a4c90a884 100644
--- a/tests/generics/tgenericdefaults.nim
+++ b/tests/generics/tgenericdefaults.nim
@@ -1,4 +1,4 @@
-type 
+type
   TFoo[T, U, R = int] = object
     x: T
     y: U
@@ -12,7 +12,7 @@ static:
   assert type(x1.x) is int
   assert type(x1.y) is float
   assert type(x1.z) is int
-  
+
 var x2: TFoo[string, R = float, U = seq[int]]
 
 static:
diff --git a/tests/generics/tgenericmatcher.nim b/tests/generics/tgenericmatcher.nim
index edd0c4cf1..2edf46187 100644
--- a/tests/generics/tgenericmatcher.nim
+++ b/tests/generics/tgenericmatcher.nim
@@ -16,7 +16,7 @@ type
       min, max: int
   PMatcher[T] = ref TMatcher[T]
 
-var 
+var
   m: PMatcher[int]
 
 
diff --git a/tests/generics/tgenericmatcher2.nim b/tests/generics/tgenericmatcher2.nim
index aa2f9dbb3..6832f80b7 100644
--- a/tests/generics/tgenericmatcher2.nim
+++ b/tests/generics/tgenericmatcher2.nim
@@ -12,7 +12,7 @@ type
       matcher: ref TMatcher[T]
       min, max: int
 
-var 
+var
   m: ref TMatcher[int]
 
 
diff --git a/tests/generics/tgenericrefs.nim b/tests/generics/tgenericrefs.nim
index a44b96af9..245789caf 100644
--- a/tests/generics/tgenericrefs.nim
+++ b/tests/generics/tgenericrefs.nim
@@ -1,4 +1,4 @@
-type 
+type
   PA[T] = ref TA[T]
   TA[T] = object
     field: T
@@ -20,18 +20,18 @@ foo 23
 
 when false:
   # Compiles unless you use var a: PA[string]
-  type 
+  type
     PA = ref TA
     TA[T] = object
 
 
   # Cannot instantiate:
-  type 
+  type
     TA[T] = object
       a: PA[T]
     PA[T] = ref TA[T]
 
-  type 
+  type
     PA[T] = ref TA[T]
     TA[T] = object
 
diff --git a/tests/generics/tgenericshardcases.nim b/tests/generics/tgenericshardcases.nim
index e3b805db6..72a2f4ec2 100644
--- a/tests/generics/tgenericshardcases.nim
+++ b/tests/generics/tgenericshardcases.nim
@@ -7,7 +7,7 @@ import typetraits
 
 proc typeNameLen(x: typedesc): int {.compileTime.} =
   result = x.name.len
-  
+
 macro selectType(a, b: typedesc): typedesc =
   result = a
 
@@ -33,7 +33,7 @@ static:
   assert high(f1.data2) == 5 # length of MyEnum minus one, because we used T.high
 
   assert high(f2.data1) == 126
-  assert high(f2.data2) == 3 
+  assert high(f2.data2) == 3
 
   assert high(f1.data3) == 6 # length of MyEnum
   assert high(f2.data3) == 4 # length of int8
diff --git a/tests/generics/tgenericvariant.nim b/tests/generics/tgenericvariant.nim
index 0150cda8d..348d3da6e 100644
--- a/tests/generics/tgenericvariant.nim
+++ b/tests/generics/tgenericvariant.nim
@@ -1,4 +1,4 @@
-type  
+type
   TMaybe[T] = object
     case empty: bool
     of false: value: T
diff --git a/tests/generics/tinferredgenericprocs.nim b/tests/generics/tinferredgenericprocs.nim
index 12adfe965..359c71ba8 100644
--- a/tests/generics/tinferredgenericprocs.nim
+++ b/tests/generics/tinferredgenericprocs.nim
@@ -5,10 +5,11 @@ discard """
 3'''
 """
 
+import sequtils
 # https://github.com/Araq/Nim/issues/797
 proc foo[T](s:T):string = $s
 
-type IntStringProc = proc(x: int): string 
+type IntStringProc = proc(x: int): string
 
 var f1 = IntStringProc(foo)
 var f2: proc(x: int): string = foo
diff --git a/tests/generics/tmap_auto.nim b/tests/generics/tmap_auto.nim
new file mode 100644
index 000000000..572556722
--- /dev/null
+++ b/tests/generics/tmap_auto.nim
@@ -0,0 +1,13 @@
+import future, sequtils
+
+let x = map(@[1, 2, 3], x => x+10)
+assert x == @[11, 12, 13]
+
+let y = map(@[(1,"a"), (2,"b"), (3,"c")], x => $x[0] & x[1])
+assert y == @["1a", "2b", "3c"]
+
+proc eatsTwoArgProc[T,S,U](a: T, b: S, f: proc(t: T, s: S): U): U =
+  f(a,b)
+
+let z = eatsTwoArgProc(1, "a", (t,s) => $t & s)
+assert z == "1a"
diff --git a/tests/generics/tmodule_same_as_proc.nim b/tests/generics/tmodule_same_as_proc.nim
new file mode 100644
index 000000000..113ca1bc3
--- /dev/null
+++ b/tests/generics/tmodule_same_as_proc.nim
@@ -0,0 +1,9 @@
+
+# bug #1965
+
+import mmodule_same_as_proc
+
+proc test[T](t: T) =
+  mmodule_same_as_proc"a"
+
+test(0)
diff --git a/tests/generics/toverloading_typedesc.nim b/tests/generics/toverloading_typedesc.nim
new file mode 100644
index 000000000..5882640f2
--- /dev/null
+++ b/tests/generics/toverloading_typedesc.nim
@@ -0,0 +1,23 @@
+discard """
+  exitcode: 0
+"""
+import moverloading_typedesc
+import tables
+
+type
+  LFoo = object
+  LBar = object
+
+
+when isMainModule:
+  doAssert FBar.new() == 3
+
+  proc new(_: typedesc[LFoo]): int = 0
+  proc new[T](_: typedesc[T]): int = 1
+  proc new*(_: typedesc[seq[Table[int, seq[Table[int, typedesc]]]]]): int = 7
+
+  doAssert LFoo.new() == 0     # Tests selecting more precise type
+  doAssert LBar.new() == 1     # Tests preferring function from local scope
+  doAssert FBar.new() == 1
+  doAssert FFoo.new() == 2     # Tests selecting more precise type from other module
+  doAssert seq[Table[int, seq[Table[int, string]]]].new() == 5     # Truly complex type test
diff --git a/tests/generics/tspecialised_is_equivalent.nim b/tests/generics/tspecialised_is_equivalent.nim
index ace562862..56fd72630 100644
--- a/tests/generics/tspecialised_is_equivalent.nim
+++ b/tests/generics/tspecialised_is_equivalent.nim
@@ -2,7 +2,6 @@
 ## specialised_is_equivalent Nim Module
 ##
 ## Created by Eric Doughty-Papassideris on 2011-02-16.
-## Copyright (c) 2011 FWA. All rights reserved.
 
 type
   TGen[T] = tuple[a: T]
diff --git a/tests/generics/tthread_generic.nim b/tests/generics/tthread_generic.nim
index fdd11d9d1..e8946caf6 100644
--- a/tests/generics/tthread_generic.nim
+++ b/tests/generics/tthread_generic.nim
@@ -3,7 +3,7 @@ discard """
 """
 
 type
-  TThreadFuncArgs[T] = object of TObject
+  TThreadFuncArgs[T] = object of RootObj
     a: proc(): T {.thread.}
     b: proc(val: T) {.thread.}
 
@@ -13,7 +13,7 @@ proc handleThreadFunc(arg: TThreadFuncArgs[int]){.thread.} =
   var output = fn()
   callback(output)
 
-proc `@||->`*[T](fn: proc(): T {.thread.}, 
+proc `@||->`*[T](fn: proc(): T {.thread.},
                  callback: proc(val: T){.thread.}): TThread[TThreadFuncArgs[T]] =
   var thr: TThread[TThreadFuncArgs[T]]
   var args: TThreadFuncArgs[T]
@@ -31,7 +31,7 @@ when isMainModule:
     return 1
   proc callbackFunc(val: int) {.thread.} =
     echo($(val))
-   
+
   var thr = (testFunc @||-> callbackFunc)
   echo("test")
   joinThread(thr)
diff --git a/tests/generics/twrong_field_caching.nim b/tests/generics/twrong_field_caching.nim
index 595c58eb7..667ffbbe5 100644
--- a/tests/generics/twrong_field_caching.nim
+++ b/tests/generics/twrong_field_caching.nim
@@ -13,10 +13,10 @@ x32: 3x2 (3x2)'''
 
 type
   RectArray*[R, C: static[int], T] = distinct array[R * C, T]
- 
+
 var a23: RectArray[2, 3, int]
 var a32: RectArray[3, 2, int]
- 
+
 echo "a23: ", a23.R, "x", a23.C
 echo "a32: ", a32.R, "x", a32.C
 
@@ -34,8 +34,8 @@ echo "t32: ", t32.R, "x", t32.C
 
 # Output:
 # t32: 3x2
- 
- 
+
+
 # Everything is still OK. Now let's use the rectangular array inside another
 # generic type:
 type
@@ -62,7 +62,7 @@ var x32 = x23.transpose
 
 echo "x23: ", x23.R, "x", x23.C, " (", x23.theArray.R, "x", x23.theArray.C, ")"
 echo "x32: ", x32.R, "x", x32.C, " (", x32.theArray.R, "x", x32.theArray.C, ")"
- 
+
 # Output:
 # x23: 2x3 (2x3)
 # x32: 3x2 (3x2)  <--- this is incorrect. R and C do not match!
diff --git a/tests/generics/twrong_floatlit_type.nim b/tests/generics/twrong_floatlit_type.nim
index 2db8b4353..c1830cd5a 100644
--- a/tests/generics/twrong_floatlit_type.nim
+++ b/tests/generics/twrong_floatlit_type.nim
@@ -35,48 +35,48 @@ proc translation*[T](p: Vector2D[T]): Matrix2x3[T] =
 proc scale*[T](v: Vector2D[T]): Matrix2x3[T] =
     Matrix2x3[T]([v.x, T(0.0), T(0.0), T(0.0), v.y, T(0.0)])
 
-proc rotation*[T](th: T): Matrix2x3[T] = 
-    let 
+proc rotation*[T](th: T): Matrix2x3[T] =
+    let
         c = T(cos(th.float))
         s = T(sin(th.float))
- 
+
     Matrix2x3[T]([c, -s, T(0.0),   s, c, T(0.0)])
- 
-proc `*`*[T](a, b: Matrix2x3[T]): Matrix2x3[T] = 
+
+proc `*`*[T](a, b: Matrix2x3[T]): Matrix2x3[T] =
     # Here we pretend that row 3 is [0,0,0,1] without
     # actually storing it in the matrix.
-    Matrix2x3[T]([a.M11*b.M11 + a.M12*b.M21, 
-                  a.M11*b.M12 + a.M12*b.M22, 
-                  a.M11*b.M13 + a.M12*b.M23 + a.M13, 
- 
+    Matrix2x3[T]([a.M11*b.M11 + a.M12*b.M21,
+                  a.M11*b.M12 + a.M12*b.M22,
+                  a.M11*b.M13 + a.M12*b.M23 + a.M13,
+
                   a.M21*b.M11 + a.M22*b.M21,
                   a.M21*b.M12 + a.M22*b.M22,
                   a.M21*b.M13 + a.M22*b.M23 + a.M23])
- 
-proc `*`*[T](a: Matrix2x3[T], p: Point2D[T]): Point2D[T] = 
-    let 
+
+proc `*`*[T](a: Matrix2x3[T], p: Point2D[T]): Point2D[T] =
+    let
         x = a.M11*p.x + a.M12*p.y + a.M13
         y = a.M21*p.x + a.M22*p.y + a.M23
- 
+
     Point2D[T](x: x, y: y)
- 
+
 # making these so things like "line" that need a constructor don't stick out.
 # 2x2 determinant:  |a b|
 #                   |c d|  = ad - bc
- 
+
 # String rendering
 #
-template ff[S](x: S): string = 
+template ff[S](x: S): string =
     formatFloat(float(x), ffDefault, 0)
- 
-proc `$`*[S](p: Point2D[S]): string = 
+
+proc `$`*[S](p: Point2D[S]): string =
     "P($1, $2)" % [ff(p.x), ff(p.y)]
- 
-proc `$`*[S](p: Vector2D[S]): string = 
+
+proc `$`*[S](p: Vector2D[S]): string =
     "V($1, $2)" % [ff(p.x), ff(p.y)]
- 
+
 proc `$`*[S](m: Matrix2x3[S]): string =
-    "M($1 $2 $3/$4 $5 $6)" % [ff(m.M11), ff(m.M12), ff(m.M13), 
+    "M($1 $2 $3/$4 $5 $6)" % [ff(m.M11), ff(m.M12), ff(m.M13),
                               ff(m.M21), ff(m.M22), ff(m.M23)]
 
 #
@@ -102,7 +102,7 @@ proc `/`*[S](v: Vector2D[S], sc: S): Vector2D[S] =
 proc `/`*[S](sc: S; v: Vector2D[S]): Vector2D[S] =
   Vector2D[S](x: sc/v.x, y: sc/v.y)
 
-proc `/`*[S](a, b: Vector2D[S]): Vector2D[S] = 
+proc `/`*[S](a, b: Vector2D[S]): Vector2D[S] =
   Vector2D[S](x: a.x/b.x, y: a.y/b.y)
 #proc vec[S](x, y: S): Vector2D[S]
 proc vec[S](x, y: S): Vector2D[S] =
diff --git a/tests/generics/twrong_generic_object.nim b/tests/generics/twrong_generic_object.nim
new file mode 100644
index 000000000..00d90c55e
--- /dev/null
+++ b/tests/generics/twrong_generic_object.nim
@@ -0,0 +1,21 @@
+discard """
+  errormsg: "cannot instantiate: 'GenericNodeObj'"
+  line: 21
+"""
+# bug #2509
+type
+  GenericNodeObj[T] = ref object
+    obj: T
+
+  Node* = ref object
+    children*: seq[Node]
+    parent*: Node
+
+    nodeObj*: GenericNodeObj # [int]
+
+proc newNode*(nodeObj: GenericNodeObj): Node =
+  result = Node(nodeObj: nodeObj)
+  newSeq(result.children, 10)
+
+var genericObj = GenericNodeObj[int]()
+var myNode = newNode(genericObj)
diff --git a/tests/global/globalaux.nim b/tests/global/globalaux.nim
index 5f6f72721..951472695 100644
--- a/tests/global/globalaux.nim
+++ b/tests/global/globalaux.nim
@@ -1,4 +1,4 @@
-type 
+type
   TObj*[T] = object
     val*: T
 
diff --git a/tests/init/tuninit1.nim b/tests/init/tuninit1.nim
index 57443a7d3..886a1d766 100644
--- a/tests/init/tuninit1.nim
+++ b/tests/init/tuninit1.nim
@@ -11,15 +11,15 @@ proc p =
   var x, y, z: int
   if stdin.readLine == "true":
     x = 34
-    
+
     while false:
       y = 999
       break
-      
+
     while true:
       if x == 12: break
       y = 9999
-      
+
     try:
       z = parseInt("1233")
     except E_Base:
@@ -32,5 +32,5 @@ proc p =
     x = 3111
     z = 0
   echo x, y, z
-  
+
 p()
diff --git a/tests/iter/tcountup.nim b/tests/iter/tcountup.nim
index e68a614b0..1559041aa 100644
--- a/tests/iter/tcountup.nim
+++ b/tests/iter/tcountup.nim
@@ -3,11 +3,11 @@ discard """
   output: "0123456789"
 """
 
-# Test new countup and unary < 
+# Test new countup and unary <
 
-for i in 0 .. < 10'i64: 
+for i in 0 .. < 10'i64:
   stdout.write(i)
-  
+
 #OUT 0123456789
 
 
diff --git a/tests/iter/titer.nim b/tests/iter/titer.nim
index 19a11dc4e..c4143ae4f 100644
--- a/tests/iter/titer.nim
+++ b/tests/iter/titer.nim
@@ -1,44 +1,44 @@
-# Test the new iterators

-

-iterator xrange(fromm, to: int, step = 1): int =

-  var a = fromm

-  while a <= to:

-    yield a

-    inc(a, step)

-

-iterator interval[T](a, b: T): T =

-  var x = a

-  while x <= b:

-    yield x

-    inc(x)

-

-#

-#iterator lines(filename: string): (line: string) =

-#  var

-#    f: tTextfile

-#    shouldClose = open(f, filename)

-#  if shouldClose:

-#    setSpace(line, 256)

-#    while readTextLine(f, line):

-#      yield line

-#  finally:

-#    if shouldClose: close(f)

-#

-

-for i in xrange(0, 5):

-  for k in xrange(1, 7):

-    write(stdout, "test")

-

-for j in interval(45, 45):

-  write(stdout, "test2!")

-  write(stdout, "test3?")

-

-for x in items(["hi", "what's", "your", "name"]):

-  echo(x)

-  

-const

-  stringArray = ["hi", "what's", "your", "name"]

-

-for i in 0..len(stringArray)-1:

-  echo(stringArray[i])

-

+# Test the new iterators
+
+iterator xrange(fromm, to: int, step = 1): int =
+  var a = fromm
+  while a <= to:
+    yield a
+    inc(a, step)
+
+iterator interval[T](a, b: T): T =
+  var x = a
+  while x <= b:
+    yield x
+    inc(x)
+
+#
+#iterator lines(filename: string): (line: string) =
+#  var
+#    f: tTextfile
+#    shouldClose = open(f, filename)
+#  if shouldClose:
+#    setSpace(line, 256)
+#    while readTextLine(f, line):
+#      yield line
+#  finally:
+#    if shouldClose: close(f)
+#
+
+for i in xrange(0, 5):
+  for k in xrange(1, 7):
+    write(stdout, "test")
+
+for j in interval(45, 45):
+  write(stdout, "test2!")
+  write(stdout, "test3?")
+
+for x in items(["hi", "what's", "your", "name"]):
+  echo(x)
+
+const
+  stringArray = ["hi", "what's", "your", "name"]
+
+for i in 0..len(stringArray)-1:
+  echo(stringArray[i])
+
diff --git a/tests/iter/titer6.nim b/tests/iter/titer6.nim
index 2abfa0860..b7c8fee80 100644
--- a/tests/iter/titer6.nim
+++ b/tests/iter/titer6.nim
@@ -22,16 +22,16 @@ iterator tokenize2(s: string, seps: set[char] = Whitespace): tuple[
     i = j
 
 for word, isSep in tokenize2("ta da", WhiteSpace):
-  var titer2TestVar = 0 
+  var titer2TestVar = 0
   stdout.write(titer2TestVar)
 
-proc wordWrap2(s: string, maxLineWidth = 80, 
+proc wordWrap2(s: string, maxLineWidth = 80,
                splitLongWords = true,
                seps: set[char] = Whitespace,
-               newLine = "\n"): string  = 
+               newLine = "\n"): string  =
   result = ""
   for word, isSep in tokenize2(s, seps):
-    var w = 0 
+    var w = 0
 
 
 
diff --git a/tests/iter/titer8.nim b/tests/iter/titer8.nim
index 3bc01122f..7b6d7b6de 100644
--- a/tests/iter/titer8.nim
+++ b/tests/iter/titer8.nim
@@ -55,7 +55,7 @@ echo ""
 proc inProc() =
   for c in count3():
     echo c
-  
+
   for word, isSep in tokenize2("ta da", WhiteSpace):
     stdout.write(word)
 
@@ -69,7 +69,7 @@ inProc()
 iterator count0(): int {.closure.} =
   # note: doesn't require anything in its closure (except 'state')
   yield 0
- 
+
 iterator count2(): int {.closure.} =
   # note: requires 'x' in its closure
   var x = 1
diff --git a/tests/iter/titer_no_tuple_unpack.nim b/tests/iter/titer_no_tuple_unpack.nim
index da5e1bc46..13ec11bd6 100644
--- a/tests/iter/titer_no_tuple_unpack.nim
+++ b/tests/iter/titer_no_tuple_unpack.nim
@@ -1,13 +1,13 @@
-

-iterator xrange(fromm, to: int, step = 1): tuple[x, y: int] =

-  var a = fromm

-  while a <= to:

-    yield (a, a+1)

-    inc(a, step)

+
+iterator xrange(fromm, to: int, step = 1): tuple[x, y: int] =
+  var a = fromm
+  while a <= to:
+    yield (a, a+1)
+    inc(a, step)
 
 for a, b in xrange(3, 7):
   echo a, " ", b
-  
+
 for tup in xrange(3, 7):
   echo tup
 
diff --git a/tests/iter/tscheduler.nim b/tests/iter/tscheduler.nim
index a267f15c4..f4b04f311 100644
--- a/tests/iter/tscheduler.nim
+++ b/tests/iter/tscheduler.nim
@@ -7,6 +7,7 @@ a2 8
 a2 6
 a2 4
 a2 2'''
+  disabled: "true"
 """
 
 import os, strutils, times, algorithm
diff --git a/tests/js.nim b/tests/js.nim
index e5e432366..92cb130bd 100644
--- a/tests/js.nim
+++ b/tests/js.nim
@@ -20,5 +20,5 @@ proc OnButtonClick() {.exportc.} =
     var x = parseInt(v)
     echo x*x
 
-proc OnLoad() {.exportc.} = 
+proc OnLoad() {.exportc.} =
   echo "Welcome! Please take your time to fill in this formular!"
diff --git a/tests/js/taddr.nim b/tests/js/taddr.nim
index 6a60aa902..1fba30d55 100644
--- a/tests/js/taddr.nim
+++ b/tests/js/taddr.nim
@@ -1,3 +1,7 @@
+discard """
+  action: run
+"""
+
 type T = object
   x: int
   s: string
@@ -29,8 +33,40 @@ doAssert objDeref.x == 42
 obj.s = "lorem ipsum dolor sit amet"
 var indexAddr = addr(obj.s[2])
 
-doAssert indexAddr[] == '4'
+doAssert indexAddr[] == 'r'
 
 indexAddr[] = 'd'
 
 doAssert indexAddr[] == 'd'
+
+doAssert obj.s == "lodem ipsum dolor sit amet"
+
+# Bug #2148
+var x: array[2, int]
+var y = addr x[1]
+
+y[] = 12
+doAssert(x[1] == 12)
+
+type
+  Foo = object
+    bar: int
+
+var foo: array[2, Foo]
+var z = addr foo[1]
+
+z[].bar = 12345
+doAssert(foo[1].bar == 12345)
+
+var t : tuple[a, b: int]
+var pt = addr t[1]
+pt[] = 123
+doAssert(t.b == 123)
+
+#block: # Test "untyped" pointer.
+proc testPtr(p: pointer, a: int) =
+  doAssert(a == 5)
+  (cast[ptr int](p))[] = 124
+var i = 123
+testPtr(addr i, 5)
+doAssert(i == 124)
diff --git a/tests/js/tbyvar.nim b/tests/js/tbyvar.nim
index 1269e6f66..9714cd56b 100644
--- a/tests/js/tbyvar.nim
+++ b/tests/js/tbyvar.nim
@@ -31,3 +31,13 @@ proc main =
   echo y
 
 main()
+
+# Test: pass var seq to var openarray
+var s = @[2, 1]
+proc foo(a: var openarray[int]) = a[0] = 123
+
+proc bar(s: var seq[int], a: int) =
+  doAssert(a == 5)
+  foo(s)
+s.bar(5)
+doAssert(s == @[123, 1])
diff --git a/tests/js/tcopying.nim b/tests/js/tcopying.nim
new file mode 100644
index 000000000..4f72d6ada
--- /dev/null
+++ b/tests/js/tcopying.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''123
+'''
+"""
+
+type MyArray = array[1, int]
+
+proc changeArray(a: var MyArray) =
+    a = [123]
+
+var a : MyArray
+changeArray(a)
+echo a[0]
diff --git a/tests/js/test2.nim b/tests/js/test2.nim
index 5a734358c..f6976d058 100644
--- a/tests/js/test2.nim
+++ b/tests/js/test2.nim
@@ -1,18 +1,19 @@
 discard """
   output: '''foo
-js 3.14'''
+js 3.14
+7'''
 """
 
 # This file tests the JavaScript generator
 
-#  #335 
+#  #335
 proc foo() =
   var bar = "foo"
   proc baz() =
     echo bar
   baz()
 foo()
-  
+
 # #376
 when not defined(JS):
   proc foo(val: float): string = "no js " & $val
@@ -20,3 +21,11 @@ else:
   proc foo(val: float): string = "js " & $val
 
 echo foo(3.14)
+
+# #2495
+type C = concept x
+
+proc test(x: C, T: typedesc): T =
+  cast[T](x)
+
+echo 7.test(int8)
diff --git a/tests/js/testmagic.nim b/tests/js/testmagic.nim
index 5f793ae05..8e06f1a9b 100644
--- a/tests/js/testmagic.nim
+++ b/tests/js/testmagic.nim
@@ -1,5 +1,7 @@
 discard """
-  output: '''true'''
+  output: '''true
+123
+'''
 """
 
 # This file tests some magic
@@ -7,3 +9,4 @@ discard """
 var foo = cstring("foo")
 var bar = cstring("foo")
 echo(foo == bar)
+echo "01234"[1 .. ^2]
diff --git a/tests/js/testobjs.nim b/tests/js/testobjs.nim
index 4fb9a83dc..0166c0f38 100644
--- a/tests/js/testobjs.nim
+++ b/tests/js/testobjs.nim
@@ -1,3 +1,7 @@
+discard """
+  action: run
+"""
+
 ## Tests javascript object generation
 
 type
@@ -28,7 +32,7 @@ var
   recurse1 = Recurse[int](data: 1, next: recurse2)
 
 
-assert(test.name == "Jorden")
-assert(knight.age == 19)
-assert(knight.item.price == 50)
-assert(recurse1.next.next.data == 3)
+doAssert test.name == "Jorden"
+doAssert knight.age == 19
+doAssert knight.item.price == 50
+doAssert recurse1.next.next.data == 3
diff --git a/tests/js/tobjfieldbyvar.nim b/tests/js/tobjfieldbyvar.nim
new file mode 100644
index 000000000..91a3c1315
--- /dev/null
+++ b/tests/js/tobjfieldbyvar.nim
@@ -0,0 +1,20 @@
+discard """
+  output: '''5
+'''
+"""
+
+# bug #2798
+
+type Inner = object
+  value: int
+
+type Outer = object
+  i: Inner
+
+proc test(i: var Inner) =
+  i.value += 5
+
+var o: Outer
+test(o.i)
+
+echo o.i.value
diff --git a/tests/js/trefbyvar.nim b/tests/js/trefbyvar.nim
new file mode 100644
index 000000000..68dd36543
--- /dev/null
+++ b/tests/js/trefbyvar.nim
@@ -0,0 +1,35 @@
+discard """
+  output: '''0
+5
+0
+5'''
+"""
+
+# bug #2476
+
+type A = ref object
+    m: int
+
+proc f(a: var A) =
+    var b: A
+    b.new()
+    b.m = 5
+    a = b
+
+var t: A
+t.new()
+
+echo t.m
+t.f()
+echo t.m
+
+proc main =
+  # now test the same for locals
+  var t: A
+  t.new()
+
+  echo t.m
+  t.f()
+  echo t.m
+
+main()
diff --git a/tests/js/tstringitems.nim b/tests/js/tstringitems.nim
new file mode 100644
index 000000000..f4ea02fec
--- /dev/null
+++ b/tests/js/tstringitems.nim
@@ -0,0 +1,24 @@
+discard """
+  output: '''Hello
+Hello'''
+"""
+
+# bug #2581
+
+const someVars = [ "Hello" ]
+var someVars2 = [ "Hello" ]
+
+proc getSomeVar: string =
+    for i in someVars:
+        if i == "Hello":
+            result = i
+            break
+
+proc getSomeVar2: string =
+    for i in someVars2:
+        if i == "Hello":
+            result = i
+            break
+
+echo getSomeVar()
+echo getSomeVar2()
diff --git a/tests/js/tunittests.nim b/tests/js/tunittests.nim
index af38cd9b9..4b09c99a9 100644
--- a/tests/js/tunittests.nim
+++ b/tests/js/tunittests.nim
@@ -1,3 +1,7 @@
+discard """
+  output: '''[OK] >:)'''
+"""
+
 import unittest
 
 suite "Bacon":
diff --git a/tests/lexer/thexlit.nim b/tests/lexer/thexlit.nim
index 04a530c9c..2b7f0a40e 100644
--- a/tests/lexer/thexlit.nim
+++ b/tests/lexer/thexlit.nim
@@ -9,4 +9,4 @@ if t==0x950412DE:
     echo "equal"
 else:
     echo "not equal"
-    
+
diff --git a/tests/lexer/thexrange.nim b/tests/lexer/thexrange.nim
index e5e4c10c6..461e41dfd 100644
--- a/tests/lexer/thexrange.nim
+++ b/tests/lexer/thexrange.nim
@@ -1,7 +1,7 @@
 
 type
   TArray = array[0x0012..0x0013, int]
-  
+
 var a: TArray
 
 echo a[0x0012] #OUT 0
diff --git a/tests/lexer/tident.nim b/tests/lexer/tident.nim
index 1ed9894c6..68cc01e70 100644
--- a/tests/lexer/tident.nim
+++ b/tests/lexer/tident.nim
@@ -1,12 +1,12 @@
 
 type
-  TIdObj* = object of TObject

-    id*: int                  # unique id; use this for comparisons and not the pointers

-  

-  PIdObj* = ref TIdObj

-  PIdent* = ref TIdent

-  TIdent*{.acyclic.} = object

-    s*: string

+  TIdObj* = object of TObject
+    id*: int                  # unique id; use this for comparisons and not the pointers
+
+  PIdObj* = ref TIdObj
+  PIdent* = ref TIdent
+  TIdent*{.acyclic.} = object
+    s*: string
 
 proc myNewString(L: int): string {.inline.} =
   result = newString(L)
@@ -15,8 +15,8 @@ proc myNewString(L: int): string {.inline.} =
   for i in 0..L-1:
     if result[i] == '\0':
       echo("Correct")
-    else: 
+    else:
       echo("Wrong")
-  
+
 var s = myNewString(8)
 
diff --git a/tests/lexer/tind1.nim b/tests/lexer/tind1.nim
index f3fd952cc..6a975d5be 100644
--- a/tests/lexer/tind1.nim
+++ b/tests/lexer/tind1.nim
@@ -17,7 +17,7 @@ mymacro:
   echo "test"
 else:
   echo "else part"
-  
+
 
 if 4 == 3:
   echo "bug"
diff --git a/tests/lexer/tlexer.nim b/tests/lexer/tlexer.nim
index 10a8ab51d..e36220e7a 100644
--- a/tests/lexer/tlexer.nim
+++ b/tests/lexer/tlexer.nim
@@ -1,60 +1,60 @@
-discard """

-  disabled: true

-"""

-

-# We start with a comment

-# This is the same comment

-

-# This is a new one!

-

-import

-  lexbase, os, strutils

-

-type

-  TMyRec {.final.} = object

-    x, y: int     # coordinates

-    c: char       # a character

-    a: int32      # an integer

-

-  PMyRec = ref TMyRec # a reference to `TMyRec`

-

-proc splitText(txt: string): seq[string] # splits a text into several lines

-                                         # the comment continues here

-                                         # this is not easy to parse!

-

-proc anotherSplit(txt: string): seq[string] =

-  # the comment should belong to `anotherSplit`!

-  # another problem: comments are statements!

-

-const

-  x = 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 # x ~~ 1.72826e35

-  myNan = 0B01111111100000101100000000001000'f32 # NAN

-  y = """

-    a rather long text.

-    Over many

-    lines.

-  """

-  s = "\xff"

-  a = {0..234}

-  b = {0..high(int)}

-  v = 0'i32

-  z = 6767566'f32

-

-# small test program for lexbase

-

-proc main*(infile: string, a, b: int, someverylongnamewithtype = 0,

-           anotherlongthingie = 3) =

-  var

-    myInt: int = 0

-    s: seq[string]

-  # this should be an error!

-  if initBaseLexer(L, infile, 30): nil

-  else:

-    writeln(stdout, "could not open: " & infile)

-  writeln(stdout, "Success!")

-  call(3, # we use 3

-       12, # we use 12

-       43) # we use 43

-       

-

-main(ParamStr(1), 9, 0)

+discard """
+  disabled: true
+"""
+
+# We start with a comment
+# This is the same comment
+
+# This is a new one!
+
+import
+  lexbase, os, strutils
+
+type
+  TMyRec {.final.} = object
+    x, y: int     # coordinates
+    c: char       # a character
+    a: int32      # an integer
+
+  PMyRec = ref TMyRec # a reference to `TMyRec`
+
+proc splitText(txt: string): seq[string] # splits a text into several lines
+                                         # the comment continues here
+                                         # this is not easy to parse!
+
+proc anotherSplit(txt: string): seq[string] =
+  # the comment should belong to `anotherSplit`!
+  # another problem: comments are statements!
+
+const
+  x = 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 # x ~~ 1.72826e35
+  myNan = 0B01111111100000101100000000001000'f32 # NAN
+  y = """
+    a rather long text.
+    Over many
+    lines.
+  """
+  s = "\xff"
+  a = {0..234}
+  b = {0..high(int)}
+  v = 0'i32
+  z = 6767566'f32
+
+# small test program for lexbase
+
+proc main*(infile: string, a, b: int, someverylongnamewithtype = 0,
+           anotherlongthingie = 3) =
+  var
+    myInt: int = 0
+    s: seq[string]
+  # this should be an error!
+  if initBaseLexer(L, infile, 30): nil
+  else:
+    writeLine(stdout, "could not open: " & infile)
+  writeLine(stdout, "Success!")
+  call(3, # we use 3
+       12, # we use 12
+       43) # we use 43
+
+
+main(ParamStr(1), 9, 0)
diff --git a/tests/lexer/tstrlits.nim b/tests/lexer/tstrlits.nim
index 1cd43975a..f5b7ce937 100644
--- a/tests/lexer/tstrlits.nim
+++ b/tests/lexer/tstrlits.nim
@@ -6,9 +6,9 @@ discard """
 
 const
   tripleEmpty = """"long string"""""""" # "long string """""
-  
+
   rawQuote = r"a"""
-  
+
   raw = r"abc""def"
 
 stdout.write(rawQuote)
diff --git a/tests/lexer/tunderscores.nim b/tests/lexer/tunderscores.nim
index 8075fdae4..e718fb40a 100644
--- a/tests/lexer/tunderscores.nim
+++ b/tests/lexer/tunderscores.nim
@@ -3,7 +3,7 @@ discard """
   line: 8
   errormsg: "invalid token: _"
 """
-# Bug #502670 
+# Bug #502670
 
 var ef_ = 3  #ERROR_MSG invalid token: _
 var a__b = 1
diff --git a/tests/lookups/tkoeniglookup.nim b/tests/lookups/tkoeniglookup.nim
index 6c42798ae..8b140cceb 100644
--- a/tests/lookups/tkoeniglookup.nim
+++ b/tests/lookups/tkoeniglookup.nim
@@ -9,7 +9,7 @@ type
   TMyObj = object
     x, y: int
 
-proc `$`*(a: TMyObj): string = 
+proc `$`*(a: TMyObj): string =
   result = "x: " & $a.x & " y: " & $a.y
 
 var a: TMyObj
diff --git a/tests/lookups/tredef.nim b/tests/lookups/tredef.nim
index a1647000c..8f1b38bd1 100644
--- a/tests/lookups/tredef.nim
+++ b/tests/lookups/tredef.nim
@@ -12,13 +12,13 @@ block:
   template foo(a: int, b: string) = discard
   foo(1, "test")
   bar(1, "test")
-  
+
 proc baz =
   proc foo(a: int, b: string) = discard
   proc foo(b: string) =
     template bar(a: int, b: string) = discard
     bar(1, "test")
-    
+
   foo("test")
 
   block:
diff --git a/tests/macros/tbugs.nim b/tests/macros/tbugs.nim
index 1ecb0d4cc..1bfce6bc4 100644
--- a/tests/macros/tbugs.nim
+++ b/tests/macros/tbugs.nim
@@ -9,7 +9,10 @@ TTaa
 TTaa
 true
 true
-nil'''
+nil
+42
+false
+true'''
 
 output: '''test
 2'''
@@ -88,3 +91,16 @@ proc calc(): array[1, int] =
 
 const c = calc()
 echo c[0]
+
+
+# bug #3046
+
+macro sampleMacroInt(i: int): stmt =
+  echo i.intVal
+
+macro sampleMacroBool(b: bool): stmt =
+  echo b.boolVal
+
+sampleMacroInt(42)
+sampleMacroBool(false)
+sampleMacroBool(system.true)
diff --git a/tests/macros/tclosuremacro.nim b/tests/macros/tclosuremacro.nim
index d5d9b656c..cf51949ed 100644
--- a/tests/macros/tclosuremacro.nim
+++ b/tests/macros/tclosuremacro.nim
@@ -29,7 +29,7 @@ proc doWithOneAndTwo(f: (int, int) -> int): int =
 echo twoParams(proc (a, b): auto = a + b)
 echo twoParams((x, y) => x + y)
 
-echo oneParam(x => x+5) 
+echo oneParam(x => x+5)
 
 echo noParams(() => 3)
 
diff --git a/tests/macros/tdebugstmt.nim b/tests/macros/tdebugstmt.nim
index 00c55ccd8..421f8fd14 100644
--- a/tests/macros/tdebugstmt.nim
+++ b/tests/macros/tdebugstmt.nim
@@ -18,7 +18,7 @@ macro debug(n: varargs[expr]): stmt =
     # 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]))
+    add(result, newCall("writeLine", newIdentNode("stdout"), n[i]))
 
 var
   a: array [0..10, int]
diff --git a/tests/macros/tgensym.nim b/tests/macros/tgensym.nim
index b3aef0a2c..a4d1a3606 100644
--- a/tests/macros/tgensym.nim
+++ b/tests/macros/tgensym.nim
@@ -1,6 +1,6 @@
-import rawsockets, asyncdispatch, macros
+import nativesockets, asyncdispatch, macros
 var p = newDispatcher()
-var sock = newAsyncRawSocket()
+var sock = newAsyncNativeSocket()
 
 proc convertReturns(node, retFutureSym: NimNode): NimNode {.compileTime.} =
   case node.kind
diff --git a/tests/macros/tgetimpl.nim b/tests/macros/tgetimpl.nim
new file mode 100644
index 000000000..d38492934
--- /dev/null
+++ b/tests/macros/tgetimpl.nim
@@ -0,0 +1,20 @@
+discard """
+  msg: '''"muhaha"
+proc poo(x, y: int) =
+  echo ["poo"]'''
+"""
+
+import macros
+
+const
+  foo = "muhaha"
+
+proc poo(x, y: int) =
+  echo "poo"
+
+macro m(x: typed): untyped =
+  echo repr x.symbol.getImpl
+  result = x
+
+discard m foo
+discard m poo
diff --git a/tests/macros/tgettype.nim b/tests/macros/tgettype.nim
new file mode 100644
index 000000000..0eab6c0a0
--- /dev/null
+++ b/tests/macros/tgettype.nim
@@ -0,0 +1,20 @@
+discard """
+msg: '''ObjectTy(Sym(Model), RecList(Sym(name), Sym(password)))
+BracketExpr(Sym(typeDesc), Sym(User))'''
+"""
+import strutils, macros
+
+type
+  Model = object of RootObj
+  User = object of Model
+    name : string
+    password : string
+
+macro testUser: expr =
+  return newLit(User.getType.lispRepr)
+
+macro testGeneric(T: typedesc[Model]): expr =
+  return newLit(T.getType.lispRepr)
+
+echo testUser
+echo User.testGeneric
diff --git a/tests/macros/tlexerex.nim b/tests/macros/tlexerex.nim
new file mode 100644
index 000000000..d348a4bcc
--- /dev/null
+++ b/tests/macros/tlexerex.nim
@@ -0,0 +1,16 @@
+
+import macros
+
+macro match*(s: cstring|string; pos: int; sections: untyped): untyped =
+  for sec in sections.children:
+    expectKind sec, nnkOfBranch
+    expectLen sec, 2
+  result = newStmtList()
+
+when isMainModule:
+  var input = "the input"
+  var pos = 0
+  match input, pos:
+  of r"[a-zA-Z_]\w+": echo "an identifier"
+  of r"\d+": echo "an integer"
+  of r".": echo "something else"
diff --git a/tests/macros/tmacro2.nim b/tests/macros/tmacro2.nim
index 8515322d5..17f312925 100644
--- a/tests/macros/tmacro2.nim
+++ b/tests/macros/tmacro2.nim
@@ -4,7 +4,7 @@ discard """
 
 import macros, strutils
 
-proc testBlock(): string {.compileTime.} = 
+proc testBlock(): string {.compileTime.} =
   block myBlock:
     while true:
       echo "inner block"
@@ -21,7 +21,7 @@ macro mac(n: expr): expr =
   s = s.replace("l", "!!")
   result = newStrLitNode("Your value sir: '$#'" % [s])
 
-const s = testBlock() 
+const s = testBlock()
 const t = mac("HEllo World")
 echo s, " ", t
 
diff --git a/tests/macros/tmacrogenerics.nim b/tests/macros/tmacrogenerics.nim
index b886f4fa5..919a15b46 100644
--- a/tests/macros/tmacrogenerics.nim
+++ b/tests/macros/tmacrogenerics.nim
@@ -16,7 +16,7 @@ macro makeBar(A, B: typedesc): typedesc =
   echo "instantiation ", counter, " with ", A.name, " and ", B.name
   result = A
 
-type 
+type
   Bar[T, U] = makeBar(T, U)
 
 var bb1: Bar[int, float]
diff --git a/tests/macros/tmacrostmt.nim b/tests/macros/tmacrostmt.nim
index d9c70197d..23e2f358c 100644
--- a/tests/macros/tmacrostmt.nim
+++ b/tests/macros/tmacrostmt.nim
@@ -13,7 +13,7 @@ of r"[\+\-\*\?]+":
   return tkOperator
 else:
   return tkUnknown
-  
+
 case_token: inc i
 
 #bug #488
diff --git a/tests/macros/tnodecompare.nim b/tests/macros/tnodecompare.nim
new file mode 100644
index 000000000..ef25ae370
--- /dev/null
+++ b/tests/macros/tnodecompare.nim
@@ -0,0 +1,39 @@
+discard """
+output: '''1
+0
+1
+0
+1
+0
+1
+0'''
+"""
+
+import macros
+
+macro test(a: typed, b: typed): expr =
+  newLit(a == b)
+
+echo test(1, 1)
+echo test(1, 2)
+
+type
+  Obj = object of RootObj
+  Other = object of RootObj
+
+echo test(Obj, Obj)
+echo test(Obj, Other)
+
+var a, b: int
+
+echo test(a, a)
+echo test(a, b)
+
+macro test2: expr =
+  newLit(bindSym"Obj" == bindSym"Obj")
+
+macro test3: expr =
+  newLit(bindSym"Obj" == bindSym"Other")
+
+echo test2()
+echo test3()
diff --git a/tests/macros/tprintf.nim b/tests/macros/tprintf.nim
index c8fb51cdc..94cbfbc2b 100644
--- a/tests/macros/tprintf.nim
+++ b/tests/macros/tprintf.nim
@@ -2,15 +2,15 @@ discard """
   file: "tprintf.nim"
   output: "Andreas Rumpf"
 """
-# Test a printf proc

-

-proc printf(file: TFile, args: openarray[string]) =

-  var i = 0

-  while i < args.len:

-    write(file, args[i])

-    inc(i)

-

-printf(stdout, ["Andreas ", "Rumpf\n"])

-#OUT Andreas Rumpf

+# Test a printf proc
+
+proc printf(file: TFile, args: openarray[string]) =
+  var i = 0
+  while i < args.len:
+    write(file, args[i])
+    inc(i)
+
+printf(stdout, ["Andreas ", "Rumpf\n"])
+#OUT Andreas Rumpf
 
 
diff --git a/tests/macros/tquotewords.nim b/tests/macros/tquotewords.nim
index 76b8d8af7..7a575f541 100644
--- a/tests/macros/tquotewords.nim
+++ b/tests/macros/tquotewords.nim
@@ -6,13 +6,13 @@ discard """
 
 import macros
 
-macro quoteWords(n: expr): expr {.immediate.} = 
+macro quoteWords(n: expr): expr {.immediate.} =
   let n = callsite()
   result = newNimNode(nnkBracket, n)
   for i in 1..n.len-1:
     expectKind(n[i], nnkIdent)
     result.add(toStrLit(n[i]))
-  
+
 const
   myWordList = quoteWords(this, an, example)
 
diff --git a/tests/macros/treturnsempty.nim b/tests/macros/treturnsempty.nim
new file mode 100644
index 000000000..7af26a747
--- /dev/null
+++ b/tests/macros/treturnsempty.nim
@@ -0,0 +1,12 @@
+discard """
+  errormsg: "type mismatch"
+  line: 11
+"""
+# bug #2372
+macro foo(dummy: int): stmt =
+  discard
+
+proc takeStr(s: string) = echo s
+
+takeStr foo(12)
+
diff --git a/tests/macros/tsametype.nim b/tests/macros/tsametype.nim
new file mode 100644
index 000000000..6baa34751
--- /dev/null
+++ b/tests/macros/tsametype.nim
@@ -0,0 +1,41 @@
+discard """
+output: '''1
+0
+1
+0
+1
+0
+1
+0
+1
+0'''
+"""
+
+import macros
+
+macro same(a: typedesc, b: typedesc): expr =
+  newLit(a.getType[1].sameType b.getType[1])
+
+echo same(int, int)
+echo same(int, float)
+
+type
+  SomeInt = int
+  DistinctInt = distinct int
+  SomeFloat = float
+  DistinctFloat = distinct float
+
+echo same(int, SomeInt)
+echo same(int, DistinctInt)
+echo same(float, SomeFloat)
+echo same(float, DistinctFloat)
+
+type
+  Obj = object of RootObj
+  SubObj = object of Obj
+  Other = object of RootObj
+
+echo same(Obj, Obj)
+echo same(int, Obj)
+echo same(SubObj, SubObj)
+echo same(Other, Obj)
diff --git a/tests/macros/tstaticparamsmacro.nim b/tests/macros/tstaticparamsmacro.nim
new file mode 100644
index 000000000..f6ecb3a9f
--- /dev/null
+++ b/tests/macros/tstaticparamsmacro.nim
@@ -0,0 +1,74 @@
+discard """
+  msg: '''letters
+aa
+bb
+numbers
+11
+22
+AST a
+[(11, 22), (33, 44)]
+AST b
+(e: [55, 66], f: [77, 88])
+55
+10
+20Test
+20
+'''
+"""
+
+import macros
+
+type
+  TConfig = tuple
+    letters: seq[string]
+    numbers:seq[int]
+
+const data: Tconfig = (@["aa", "bb"], @[11, 22])
+
+macro mymacro(data: static[TConfig]): stmt =
+  echo "letters"
+  for s in items(data.letters):
+    echo s
+  echo "numbers"
+  for n in items(data.numbers):
+    echo n
+
+mymacro(data)
+
+type
+  Ta = seq[tuple[c:int, d:int]]
+  Tb = tuple[e:seq[int], f:seq[int]]
+
+const
+  a : Ta = @[(11, 22), (33, 44)]
+  b : Tb = (@[55,66], @[77, 88])
+
+macro mA(data: static[Ta]): stmt =
+  echo "AST a \n", repr(data)
+
+macro mB(data: static[Tb]): stmt =
+  echo "AST b \n", repr(data)
+  echo data.e[0]
+
+mA(a)
+mB(b)
+
+type
+  Foo[N: static[int], Z: static[string]] = object
+
+macro staticIntMacro(f: static[int]): stmt = echo f
+staticIntMacro 10
+
+var
+  x: Foo[20, "Test"]
+
+macro genericMacro[N; Z: static[string]](f: Foo[N, Z], ll = 3, zz = 12): stmt =
+  echo N, Z
+
+genericMacro x
+
+template genericTemplate[N, Z](f: Foo[N, Z], ll = 3, zz = 12): int = N
+
+static:
+  echo genericTemplate(x)
+
diff --git a/tests/macros/ttryparseexpr.nim b/tests/macros/ttryparseexpr.nim
index af932eb7d..c7bbc8e5b 100644
--- a/tests/macros/ttryparseexpr.nim
+++ b/tests/macros/ttryparseexpr.nim
@@ -15,5 +15,6 @@ const
   valid = 45
   a = test("foo&&")
   b = test("valid")
+  c = test("\"") # bug #2504
 
 echo a, " ", b
diff --git a/tests/macros/tvtable.nim b/tests/macros/tvtable.nim
index 3e3b9c0e6..cc5d7a5d9 100644
--- a/tests/macros/tvtable.nim
+++ b/tests/macros/tvtable.nim
@@ -17,7 +17,7 @@ type
   # an untyped table to store the proc pointers
   # it's also possible to use a strongly typed tuple here
   VTable = array[0..1, pointer]
-  
+
   TBase = object {.inheritable.}
     vtbl: ptr VTable
 
diff --git a/tests/macros/typesapi2.nim b/tests/macros/typesapi2.nim
index 016295ba4..2e59d2154 100644
--- a/tests/macros/typesapi2.nim
+++ b/tests/macros/typesapi2.nim
@@ -1,4 +1,4 @@
-# tests to see if a symbol returned from macros.getType() can 
+# tests to see if a symbol returned from macros.getType() can
 # be used as a type
 import macros
 
@@ -20,7 +20,7 @@ static: assert iii is TestFN
 
 proc foo11 : testTypesym(void) =
     echo "HI!"
-static: assert foo11 is proc():void
+static: assert foo11 is (proc():void {.nimcall.})
 
 var sss: testTypesym(seq[int])
 static: assert sss is seq[int]
diff --git a/tests/magics/tlowhigh.nim b/tests/magics/tlowhigh.nim
index d1cbd3272..4998b73dc 100644
--- a/tests/magics/tlowhigh.nim
+++ b/tests/magics/tlowhigh.nim
@@ -2,23 +2,23 @@ discard """
   file: "tlowhigh.nim"
   output: "10"
 """
-# Test the magic low() and high() procs

-

-type

-  myEnum = enum e1, e2, e3, e4, e5

-

-var

-  a: array [myEnum, int]

-

-for i in low(a) .. high(a):

-  a[i] = 0

-

-proc sum(a: openarray[int]): int =

-  result = 0

-  for i in low(a)..high(a):

-    inc(result, a[i])

-

-write(stdout, sum([1, 2, 3, 4]))

-#OUT 10

+# Test the magic low() and high() procs
+
+type
+  myEnum = enum e1, e2, e3, e4, e5
+
+var
+  a: array [myEnum, int]
+
+for i in low(a) .. high(a):
+  a[i] = 0
+
+proc sum(a: openarray[int]): int =
+  result = 0
+  for i in low(a)..high(a):
+    inc(result, a[i])
+
+write(stdout, sum([1, 2, 3, 4]))
+#OUT 10
 
 
diff --git a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim
index 493a2106c..56d3edec4 100644
--- a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim
+++ b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim
@@ -1,15 +1,15 @@
 # Copyright (c) 2007 Scott Lembcke
-#  
+#
 #  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
@@ -17,7 +17,7 @@
 #  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.
-# 
+#
 
 const Lib = "libchipmunk.so.6.1.1"
 
@@ -30,12 +30,12 @@ when defined(CpUseFloat):
   type CpFloat* = cfloat
 else:
   type CpFloat* = cdouble
-const 
-  CP_BUFFER_BYTES* = (32 * 1024)  
+const
+  CP_BUFFER_BYTES* = (32 * 1024)
   CP_MAX_CONTACTS_PER_ARBITER* = 4
   CpInfinity*: CpFloat = 1.0/0
 {.pragma: pf, pure, final.}
-type 
+type
   Bool32* = cint  #replace one day with cint-compatible bool
   CpDataPointer* = pointer
   TVector* {.final, pure.} = object
@@ -44,12 +44,12 @@ type
   TBodyVelocityFunc* = proc(body: PBody, gravity: TVector,
                             damping: CpFloat; dt: CpFloat){.cdecl.}
   TBodyPositionFunc* = proc(body: PBody; dt: CpFloat){.cdecl.}
-  TComponentNode*{.pf.} = object 
+  TComponentNode*{.pf.} = object
     root*: PBody
     next*: PBody
     idleTime*: CpFloat
-  
-  THashValue = cuint  # uintptr_t 
+
+  THashValue = cuint  # uintptr_t
   TCollisionType* = cuint #uintptr_t
   TGroup * = cuint #uintptr_t
   TLayers* = cuint
@@ -60,9 +60,9 @@ type
   PContact* = ptr TContact
   TContact*{.pure,final.} = object
   PArbiter* = ptr TArbiter
-  TArbiter*{.pf.} = object 
+  TArbiter*{.pf.} = object
     e*: CpFloat
-    u*: CpFloat 
+    u*: CpFloat
     surface_vr*: TVector
     a*: PShape
     b*: PShape
@@ -77,7 +77,7 @@ type
     swappedColl*: Bool32
     state*: TArbiterState
   PCollisionHandler* = ptr TCollisionHandler
-  TCollisionHandler*{.pf.} = object 
+  TCollisionHandler*{.pf.} = object
     a*: TCollisionType
     b*: TCollisionType
     begin*: TCollisionBeginFunc
@@ -85,26 +85,26 @@ type
     postSolve*: TCollisionPostSolveFunc
     separate*: TCollisionSeparateFunc
     data*: pointer
-  TArbiterState*{.size: sizeof(cint).} = enum 
+  TArbiterState*{.size: sizeof(cint).} = enum
     ArbiterStateFirstColl,    # Arbiter is active and its not the first collision.
     ArbiterStateNormal,       # Collision has been explicitly ignored.
                               # Either by returning false from a begin collision handler or calling cpArbiterIgnore().
     ArbiterStateIgnore,       # Collison is no longer active. A space will cache an arbiter for up to cpSpace.collisionPersistence more steps.
     ArbiterStateCached
-  TArbiterThread*{.pf.} = object 
+  TArbiterThread*{.pf.} = object
     next*: PArbiter        # Links to next and previous arbiters in the contact graph.
     prev*: PArbiter
-  
-  TContactPoint*{.pf.} = object 
+
+  TContactPoint*{.pf.} = object
     point*: TVector    #/ The position of the contact point.
     normal*: TVector   #/ The normal of the contact point.
     dist*: CpFloat     #/ The depth of the contact point.
   #/ A struct that wraps up the important collision data for an arbiter.
   PContactPointSet* = ptr TContactPointSet
-  TContactPointSet*{.pf.} = object 
+  TContactPointSet*{.pf.} = object
     count*: cint              #/ The number of contact points in the set.
     points*: array[0..CP_MAX_CONTACTS_PER_ARBITER - 1, TContactPoint] #/ The array of contact points.
-  
+
   #/ Collision begin event function callback type.
   #/ Returning false from a begin callback causes the collision to be ignored until
   #/ the the separate callback is called when the objects stop colliding.
@@ -112,35 +112,35 @@ type
       cdecl.}
   #/ Collision pre-solve event function callback type.
   #/ Returning false from a pre-step callback causes the collision to be ignored until the next step.
-  TCollisionPreSolveFunc* = proc (arb: PArbiter; space: PSpace; 
+  TCollisionPreSolveFunc* = proc (arb: PArbiter; space: PSpace;
                                   data: pointer): bool {.cdecl.}
   #/ Collision post-solve event function callback type.
-  TCollisionPostSolveFunc* = proc (arb: PArbiter; space: PSpace; 
+  TCollisionPostSolveFunc* = proc (arb: PArbiter; space: PSpace;
                                    data: pointer){.cdecl.}
   #/ Collision separate event function callback type.
-  TCollisionSeparateFunc* = proc (arb: PArbiter; space: PSpace; 
+  TCollisionSeparateFunc* = proc (arb: PArbiter; space: PSpace;
                                   data: pointer){.cdecl.}
-  
+
   #/ Chipmunk's axis-aligned 2D bounding box type. (left, bottom, right, top)
   PBB* = ptr TBB
-  TBB* {.pf.} = object 
+  TBB* {.pf.} = object
     l*, b*, r*, t*: CpFloat
-  
+
   #/ Spatial index bounding box callback function type.
   #/ The spatial index calls this function and passes you a pointer to an object you added
   #/ when it needs to get the bounding box associated with that object.
   TSpatialIndexBBFunc* = proc (obj: pointer): TBB{.cdecl.}
   #/ Spatial index/object iterator callback function type.
   TSpatialIndexIteratorFunc* = proc (obj: pointer; data: pointer){.cdecl.}
-  #/ Spatial query callback function type. 
+  #/ Spatial query callback function type.
   TSpatialIndexQueryFunc* = proc (obj1: pointer; obj2: pointer; data: pointer){.
       cdecl.}
   #/ Spatial segment query callback function type.
-  TSpatialIndexSegmentQueryFunc* = proc (obj1: pointer; obj2: pointer; 
+  TSpatialIndexSegmentQueryFunc* = proc (obj1: pointer; obj2: pointer;
       data: pointer): CpFloat {.cdecl.}
   #/ private
   PSpatialIndex = ptr TSpatialIndex
-  TSpatialIndex{.pf.} = object 
+  TSpatialIndex{.pf.} = object
     klass: PSpatialIndexClass
     bbfun: TSpatialIndexBBFunc
     staticIndex: PSpatialIndex
@@ -148,31 +148,31 @@ type
 
   TSpatialIndexDestroyImpl* = proc (index: PSpatialIndex){.cdecl.}
   TSpatialIndexCountImpl* = proc (index: PSpatialIndex): cint{.cdecl.}
-  TSpatialIndexEachImpl* = proc (index: PSpatialIndex; 
+  TSpatialIndexEachImpl* = proc (index: PSpatialIndex;
                                  fun: TSpatialIndexIteratorFunc; data: pointer){.
       cdecl.}
-  TSpatialIndexContainsImpl* = proc (index: PSpatialIndex; obj: pointer; 
+  TSpatialIndexContainsImpl* = proc (index: PSpatialIndex; obj: pointer;
                                      hashid: THashValue): Bool32 {.cdecl.}
-  TSpatialIndexInsertImpl* = proc (index: PSpatialIndex; obj: pointer; 
+  TSpatialIndexInsertImpl* = proc (index: PSpatialIndex; obj: pointer;
                                    hashid: THashValue){.cdecl.}
-  TSpatialIndexRemoveImpl* = proc (index: PSpatialIndex; obj: pointer; 
+  TSpatialIndexRemoveImpl* = proc (index: PSpatialIndex; obj: pointer;
                                    hashid: THashValue){.cdecl.}
   TSpatialIndexReindexImpl* = proc (index: PSpatialIndex){.cdecl.}
-  TSpatialIndexReindexObjectImpl* = proc (index: PSpatialIndex; 
+  TSpatialIndexReindexObjectImpl* = proc (index: PSpatialIndex;
       obj: pointer; hashid: THashValue){.cdecl.}
-  TSpatialIndexReindexQueryImpl* = proc (index: PSpatialIndex; 
+  TSpatialIndexReindexQueryImpl* = proc (index: PSpatialIndex;
       fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.}
-  TSpatialIndexPointQueryImpl* = proc (index: PSpatialIndex; point: TVector; 
-                                       fun: TSpatialIndexQueryFunc; 
+  TSpatialIndexPointQueryImpl* = proc (index: PSpatialIndex; point: TVector;
+                                       fun: TSpatialIndexQueryFunc;
                                        data: pointer){.cdecl.}
-  TSpatialIndexSegmentQueryImpl* = proc (index: PSpatialIndex; obj: pointer; 
-      a: TVector; b: TVector; t_exit: CpFloat; fun: TSpatialIndexSegmentQueryFunc; 
+  TSpatialIndexSegmentQueryImpl* = proc (index: PSpatialIndex; obj: pointer;
+      a: TVector; b: TVector; t_exit: CpFloat; fun: TSpatialIndexSegmentQueryFunc;
       data: pointer){.cdecl.}
-  TSpatialIndexQueryImpl* = proc (index: PSpatialIndex; obj: pointer; 
-                                  bb: TBB; fun: TSpatialIndexQueryFunc; 
+  TSpatialIndexQueryImpl* = proc (index: PSpatialIndex; obj: pointer;
+                                  bb: TBB; fun: TSpatialIndexQueryFunc;
                                   data: pointer){.cdecl.}
   PSpatialIndexClass* = ptr TSpatialIndexClass
-  TSpatialIndexClass*{.pf.} = object 
+  TSpatialIndexClass*{.pf.} = object
     destroy*: TSpatialIndexDestroyImpl
     count*: TSpatialIndexCountImpl
     each*: TSpatialIndexEachImpl
@@ -185,32 +185,32 @@ type
     pointQuery*: TSpatialIndexPointQueryImpl
     segmentQuery*: TSpatialIndexSegmentQueryImpl
     query*: TSpatialIndexQueryImpl
-  
+
   PSpaceHash* = ptr TSpaceHash
   TSpaceHash* {.pf.} = object
   PBBTree* = ptr TBBTree
   TBBTree* {.pf.} = object
   PSweep1D* = ptr TSweep1D
   TSweep1D* {.pf.} = object
-  
+
   #/ Bounding box tree velocity callback function.
   #/ This function should return an estimate for the object's velocity.
   TBBTreeVelocityFunc* = proc (obj: pointer): TVector {.cdecl.}
-  
+
   PContactBufferHeader* = ptr TContentBufferHeader
   TContentBufferHeader* {.pf.} = object
   TSpaceArbiterApplyImpulseFunc* = proc (arb: PArbiter){.cdecl.}
-  
+
   PSpace* = ptr TSpace
   TSpace* {.pf.} = object
-    iterations*: cint 
+    iterations*: cint
     gravity*: TVector
     damping*: CpFloat
-    idleSpeedThreshold*: CpFloat 
-    sleepTimeThreshold*: CpFloat 
-    collisionSlop*: CpFloat 
+    idleSpeedThreshold*: CpFloat
+    sleepTimeThreshold*: CpFloat
+    collisionSlop*: CpFloat
     collisionBias*: CpFloat
-    collisionPersistence*: TTimestamp        
+    collisionPersistence*: TTimestamp
     enableContactGraph*: cint ##BOOL
     data*: pointer
     staticBody*: PBody
@@ -232,24 +232,24 @@ type
     defaultHandler: TCollisionHandler
     postStepCallbacks: PHashSet
     arbiterApplyImpulse: TSpaceArbiterApplyImpulseFunc
-    staticBody2: TBody  #_staticBody 
+    staticBody2: TBody  #_staticBody
   PBody* = ptr TBody
-  TBody*{.pf.} = object 
-    velocityFunc*: TBodyVelocityFunc 
-    positionFunc*: TBodyPositionFunc                                       
-    m*: CpFloat           
-    mInv*: CpFloat       
-    i*: CpFloat           
-    iInv*: CpFloat       
-    p*: TVector            
-    v*: TVector            
-    f*: TVector 
-    a*: CpFloat 
-    w*: CpFloat 
-    t*: CpFloat 
-    rot*: TVector 
+  TBody*{.pf.} = object
+    velocityFunc*: TBodyVelocityFunc
+    positionFunc*: TBodyPositionFunc
+    m*: CpFloat
+    mInv*: CpFloat
+    i*: CpFloat
+    iInv*: CpFloat
+    p*: TVector
+    v*: TVector
+    f*: TVector
+    a*: CpFloat
+    w*: CpFloat
+    t*: CpFloat
+    rot*: TVector
     data*: pointer
-    vLimit*: CpFloat   
+    vLimit*: CpFloat
     wLimit*: CpFloat
     vBias*: TVector
     wBias*: CpFloat
@@ -258,51 +258,51 @@ type
     arbiterList*: PArbiter
     constraintList*: PConstraint
     node*: TComponentNode
-  #/ Body/shape iterator callback function type. 
-  TBodyShapeIteratorFunc* = proc (body: PBody; shape: PShape; 
+  #/ Body/shape iterator callback function type.
+  TBodyShapeIteratorFunc* = proc (body: PBody; shape: PShape;
                                    data: pointer) {.cdecl.}
-  #/ Body/constraint iterator callback function type. 
-  TBodyConstraintIteratorFunc* = proc (body: PBody; 
-                                        constraint: PConstraint; 
+  #/ Body/constraint iterator callback function type.
+  TBodyConstraintIteratorFunc* = proc (body: PBody;
+                                        constraint: PConstraint;
                                         data: pointer) {.cdecl.}
-  #/ Body/arbiter iterator callback function type. 
-  TBodyArbiterIteratorFunc* = proc (body: PBody; arbiter: PArbiter; 
+  #/ Body/arbiter iterator callback function type.
+  TBodyArbiterIteratorFunc* = proc (body: PBody; arbiter: PArbiter;
                                      data: pointer) {.cdecl.}
-  
+
   PNearestPointQueryInfo* = ptr TNearestPointQueryInfo
   #/ Nearest point query info struct.
   TNearestPointQueryInfo*{.pf.} = object
     shape: PShape  #/ The nearest shape, NULL if no shape was within range.
     p: TVector     #/ The closest point on the shape's surface. (in world space coordinates)
     d: CpFloat      #/ The distance to the point. The distance is negative if the point is inside the shape.
-  
+
   PSegmentQueryInfo* = ptr TSegmentQueryInfo
   #/ Segment query info struct.
-  TSegmentQueryInfo*{.pf.} = object 
+  TSegmentQueryInfo*{.pf.} = object
     shape*: PShape         #/ The shape that was hit, NULL if no collision occurred.
     t*: CpFloat            #/ The normalized distance along the query segment in the range [0, 1].
     n*: TVector            #/ The normal of the surface hit.
-  TShapeType*{.size: sizeof(cint).} = enum 
+  TShapeType*{.size: sizeof(cint).} = enum
     CP_CIRCLE_SHAPE, CP_SEGMENT_SHAPE, CP_POLY_SHAPE, CP_NUM_SHAPES
   TShapeCacheDataImpl* = proc (shape: PShape; p: TVector; rot: TVector): TBB{.cdecl.}
   TShapeDestroyImpl* = proc (shape: PShape){.cdecl.}
   TShapePointQueryImpl* = proc (shape: PShape; p: TVector): Bool32 {.cdecl.}
-  TShapeSegmentQueryImpl* = proc (shape: PShape; a: TVector; b: TVector; 
+  TShapeSegmentQueryImpl* = proc (shape: PShape; a: TVector; b: TVector;
                                   info: PSegmentQueryInfo){.cdecl.}
   PShapeClass* = ptr TShapeClass
-  TShapeClass*{.pf.} = object 
+  TShapeClass*{.pf.} = object
     kind*: TShapeType
     cacheData*: TShapeCacheDataImpl
     destroy*: TShapeDestroyImpl
     pointQuery*: TShapePointQueryImpl
     segmentQuery*: TShapeSegmentQueryImpl
   PShape* = ptr TShape
-  TShape*{.pf.} = object 
+  TShape*{.pf.} = object
     klass: PShapeClass   #/ PRIVATE
     body*: PBody           #/ The rigid body this collision shape is attached to.
-    bb*: TBB               #/ The current bounding box of the shape.   
+    bb*: TBB               #/ The current bounding box of the shape.
     sensor*: Bool32        #/ Sensor flag.
-                           #/ Sensor shapes call collision callbacks but don't produce collisions.  
+                           #/ Sensor shapes call collision callbacks but don't produce collisions.
     e*: CpFloat            #/ Coefficient of restitution. (elasticity)
     u*: CpFloat            #/ Coefficient of friction.
     surface_v*: TVector    #/ Surface velocity used when solving for friction.
@@ -336,29 +336,29 @@ type
   TSplittingPlane*{.pf.} = object
     n: TVector
     d: CpFloat
-  
+
   #/ Post Step callback function type.
   TPostStepFunc* = proc (space: PSpace; obj: pointer; data: pointer){.cdecl.}
   #/ Point query callback function type.
   TSpacePointQueryFunc* = proc (shape: PShape; data: pointer){.cdecl.}
   #/ Segment query callback function type.
-  TSpaceSegmentQueryFunc* = proc (shape: PShape; t: CpFloat; n: TVector; 
+  TSpaceSegmentQueryFunc* = proc (shape: PShape; t: CpFloat; n: TVector;
                                   data: pointer){.cdecl.}
   #/ Rectangle Query callback function type.
   TSpaceBBQueryFunc* = proc (shape: PShape; data: pointer){.cdecl.}
   #/ Shape query callback function type.
-  TSpaceShapeQueryFunc* = proc (shape: PShape; points: PContactPointSet; 
+  TSpaceShapeQueryFunc* = proc (shape: PShape; points: PContactPointSet;
                                 data: pointer){.cdecl.}
   #/ Space/body iterator callback function type.
   TSpaceBodyIteratorFunc* = proc (body: PBody; data: pointer){.cdecl.}
   #/ Space/body iterator callback function type.
   TSpaceShapeIteratorFunc* = proc (shape: PShape; data: pointer){.cdecl.}
   #/ Space/constraint iterator callback function type.
-  TSpaceConstraintIteratorFunc* = proc (constraint: PConstraint; 
+  TSpaceConstraintIteratorFunc* = proc (constraint: PConstraint;
                                         data: pointer){.cdecl.}
   #/ Opaque cpConstraint struct.
   PConstraint* = ptr TConstraint
-  TConstraint*{.pf.} = object 
+  TConstraint*{.pf.} = object
     klass: PConstraintClass #/PRIVATE
     a*: PBody            #/ The first body connected to this constraint.
     b*: PBody              #/ The second body connected to this constraint.
@@ -367,7 +367,7 @@ type
     next_b: PConstraint #/PRIVATE
     maxForce*: CpFloat  #/ The maximum force that this constraint is allowed to use. Defaults to infinity.
     errorBias*: CpFloat #/ The rate at which joint error is corrected. Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.
-    maxBias*: CpFloat    #/ The maximum rate at which joint error is corrected. Defaults to infinity.       
+    maxBias*: CpFloat    #/ The maximum rate at which joint error is corrected. Defaults to infinity.
     preSolve*: TConstraintPreSolveFunc  #/ Function called before the solver runs. Animate your joint anchors, update your motor torque, etc.
     postSolve*: TConstraintPostSolveFunc #/ Function called after the solver runs. Use the applied impulse to perform effects like breakable joints.
     data*: CpDataPointer  # User definable data pointer. Generally this points to your the game object class so you can access it when given a cpConstraint reference in a callback.
@@ -376,7 +376,7 @@ type
   TConstraintApplyImpulseImpl = proc (constraint: PConstraint){.cdecl.}
   TConstraintGetImpulseImpl = proc (constraint: PConstraint): CpFloat{.cdecl.}
   PConstraintClass = ptr TConstraintClass
-  TConstraintClass{.pf.} = object 
+  TConstraintClass{.pf.} = object
     preStep*: TConstraintPreStepImpl
     applyCachedImpulse*: TConstraintApplyCachedImpulseImpl
     applyImpulse*: TConstraintApplyImpulseImpl
@@ -427,29 +427,29 @@ defGetter(PSpace, CpFloat, currDt, CurrentTimeStep)
 
 
 #/ returns true from inside a callback and objects cannot be added/removed.
-proc isLocked*(space: PSpace): bool{.inline.} = 
+proc isLocked*(space: PSpace): bool{.inline.} =
   result = space.locked.bool
 
 #/ Set a default collision handler for this space.
 #/ The default collision handler is invoked for each colliding pair of shapes
 #/ that isn't explicitly handled by a specific collision handler.
 #/ You can pass NULL for any function you don't want to implement.
-proc setDefaultCollisionHandler*(space: PSpace; begin: TCollisionBeginFunc; 
-                                  preSolve: TCollisionPreSolveFunc; 
-                                  postSolve: TCollisionPostSolveFunc; 
-                                  separate: TCollisionSeparateFunc; 
+proc setDefaultCollisionHandler*(space: PSpace; begin: TCollisionBeginFunc;
+                                  preSolve: TCollisionPreSolveFunc;
+                                  postSolve: TCollisionPostSolveFunc;
+                                  separate: TCollisionSeparateFunc;
                                   data: pointer){.
   cdecl, importc: "cpSpaceSetDefaultCollisionHandler", dynlib: Lib.}
 #/ Set a collision handler to be used whenever the two shapes with the given collision types collide.
 #/ You can pass NULL for any function you don't want to implement.
-proc addCollisionHandler*(space: PSpace; a, b: TCollisionType; 
-                           begin: TCollisionBeginFunc; 
-                           preSolve: TCollisionPreSolveFunc; 
-                           postSolve: TCollisionPostSolveFunc; 
+proc addCollisionHandler*(space: PSpace; a, b: TCollisionType;
+                           begin: TCollisionBeginFunc;
+                           preSolve: TCollisionPreSolveFunc;
+                           postSolve: TCollisionPostSolveFunc;
                            separate: TCollisionSeparateFunc; data: pointer){.
   cdecl, importc: "cpSpaceAddCollisionHandler", dynlib: Lib.}
 #/ Unset a collision handler.
-proc removeCollisionHandler*(space: PSpace; a: TCollisionType; 
+proc removeCollisionHandler*(space: PSpace; a: TCollisionType;
                                   b: TCollisionType){.
   cdecl, importc: "cpSpaceRemoveCollisionHandler", dynlib: Lib.}
 #/ Add a collision shape to the simulation.
@@ -489,34 +489,34 @@ proc containsConstraint*(space: PSpace; constraint: PConstraint): bool{.
   cdecl, importc: "cpSpaceContainsConstraint", dynlib: Lib.}
 #/ Schedule a post-step callback to be called when cpSpaceStep() finishes.
 #/ @c obj is used a key, you can only register one callback per unique value for @c obj
-proc addPostStepCallback*(space: PSpace; fun: TPostStepFunc; 
+proc addPostStepCallback*(space: PSpace; fun: TPostStepFunc;
                                obj: pointer; data: pointer){.
   cdecl, importc: "cpSpaceAddPostStepCallback", dynlib: Lib.}
-                                        
+
 #/ Query the space at a point and call @c func for each shape found.
-proc pointQuery*(space: PSpace; point: TVector; layers: TLayers; 
+proc pointQuery*(space: PSpace; point: TVector; layers: TLayers;
                       group: TGroup; fun: TSpacePointQueryFunc; data: pointer){.
   cdecl, importc: "cpSpacePointQuery", dynlib: Lib.}
 
 #/ Query the space at a point and return the first shape found. Returns NULL if no shapes were found.
-proc pointQueryFirst*(space: PSpace; point: TVector; layers: TLayers; 
+proc pointQueryFirst*(space: PSpace; point: TVector; layers: TLayers;
                        group: TGroup): PShape{.
   cdecl, importc: "cpSpacePointQueryFirst", dynlib: Lib.}
 
 #/ Perform a directed line segment query (like a raycast) against the space calling @c func for each shape intersected.
-proc segmentQuery*(space: PSpace; start: TVector; to: TVector; 
-                    layers: TLayers; group: TGroup; 
+proc segmentQuery*(space: PSpace; start: TVector; to: TVector;
+                    layers: TLayers; group: TGroup;
                     fun: TSpaceSegmentQueryFunc; data: pointer){.
   cdecl, importc: "cpSpaceSegmentQuery", dynlib: Lib.}
 #/ Perform a directed line segment query (like a raycast) against the space and return the first shape hit. Returns NULL if no shapes were hit.
-proc segmentQueryFirst*(space: PSpace; start: TVector; to: TVector; 
-                         layers: TLayers; group: TGroup; 
+proc segmentQueryFirst*(space: PSpace; start: TVector; to: TVector;
+                         layers: TLayers; group: TGroup;
                          res: PSegmentQueryInfo): PShape{.
   cdecl, importc: "cpSpaceSegmentQueryFirst", dynlib: Lib.}
 
 #/ Perform a fast rectangle query on the space calling @c func for each shape found.
 #/ Only the shape's bounding boxes are checked for overlap, not their full shape.
-proc BBQuery*(space: PSpace; bb: TBB; layers: TLayers; group: TGroup; 
+proc BBQuery*(space: PSpace; bb: TBB; layers: TLayers; group: TGroup;
                    fun: TSpaceBBQueryFunc; data: pointer){.
   cdecl, importc: "cpSpaceBBQuery", dynlib: Lib.}
 
@@ -532,11 +532,11 @@ proc eachBody*(space: PSpace; fun: TSpaceBodyIteratorFunc; data: pointer){.
   cdecl, importc: "cpSpaceEachBody", dynlib: Lib.}
 
 #/ Call @c func for each shape in the space.
-proc eachShape*(space: PSpace; fun: TSpaceShapeIteratorFunc; 
+proc eachShape*(space: PSpace; fun: TSpaceShapeIteratorFunc;
                      data: pointer){.
   cdecl, importc: "cpSpaceEachShape", dynlib: Lib.}
 #/ Call @c func for each shape in the space.
-proc eachConstraint*(space: PSpace; fun: TSpaceConstraintIteratorFunc; 
+proc eachConstraint*(space: PSpace; fun: TSpaceConstraintIteratorFunc;
                           data: pointer){.
   cdecl, importc: "cpSpaceEachConstraint", dynlib: Lib.}
 #/ Update the collision detection info for the static shapes in the space.
@@ -566,7 +566,7 @@ proc newVector*(x, y: CpFloat): TVector {.inline.} =
 var VectorZero* = newVector(0.0, 0.0)
 
 #/ Vector dot product.
-proc dot*(v1, v2: TVector): CpFloat {.inline.} = 
+proc dot*(v1, v2: TVector): CpFloat {.inline.} =
   result = v1.x * v2.x + v1.y * v2.y
 
 #/ Returns the length of v.
@@ -613,7 +613,7 @@ proc `-=`*(v1: var TVector; v2: TVector) =
   v1.y = v1.y - v2.y
 
 #/ Negate a vector.
-proc `-`*(v: TVector): TVector {.inline.} = 
+proc `-`*(v: TVector): TVector {.inline.} =
   result = newVector(- v.x, - v.y)
 
 #/ Scalar multiplication.
@@ -627,54 +627,54 @@ proc `*=`*(v: var TVector; s: CpFloat) =
 #/ 2D vector cross product analog.
 #/ The cross product of 2D vectors results in a 3D vector with only a z component.
 #/ This function returns the magnitude of the z value.
-proc cross*(v1, v2: TVector): CpFloat {.inline.} = 
+proc cross*(v1, v2: TVector): CpFloat {.inline.} =
   result = v1.x * v2.y - v1.y * v2.x
 
 #/ Returns a perpendicular vector. (90 degree rotation)
-proc perp*(v: TVector): TVector {.inline.} = 
+proc perp*(v: TVector): TVector {.inline.} =
   result = newVector(- v.y, v.x)
 
 #/ Returns a perpendicular vector. (-90 degree rotation)
-proc rperp*(v: TVector): TVector {.inline.} = 
+proc rperp*(v: TVector): TVector {.inline.} =
   result = newVector(v.y, - v.x)
 
 #/ Returns the vector projection of v1 onto v2.
-proc project*(v1,v2: TVector): TVector {.inline.} = 
+proc project*(v1,v2: TVector): TVector {.inline.} =
   result = v2 * (v1.dot(v2) / v2.dot(v2))
 
 #/ Uses complex number multiplication to rotate v1 by v2. Scaling will occur if v1 is not a unit vector.
 
-proc rotate*(v1, v2: TVector): TVector {.inline.} = 
+proc rotate*(v1, v2: TVector): TVector {.inline.} =
   result = newVector(v1.x * v2.x - v1.y * v2.y, v1.x * v2.y + v1.y * v2.x)
 #/ Inverse of cpvrotate().
-proc unrotate*(v1, v2: TVector): TVector {.inline.} = 
+proc unrotate*(v1, v2: TVector): TVector {.inline.} =
   result = newVector(v1.x * v2.x + v1.y * v2.y, v1.y * v2.x - v1.x * v2.y)
 #/ Returns the squared length of v. Faster than cpvlength() when you only need to compare lengths.
-proc lenSq*(v: TVector): CpFloat {.inline.} = 
+proc lenSq*(v: TVector): CpFloat {.inline.} =
   result = v.dot(v)
 #/ Linearly interpolate between v1 and v2.
-proc lerp*(v1, v2: TVector; t: CpFloat): TVector {.inline.} = 
+proc lerp*(v1, v2: TVector; t: CpFloat): TVector {.inline.} =
   result = (v1 * (1.0 - t)) + (v2 * t)
 #/ Returns a normalized copy of v.
-proc normalize*(v: TVector): TVector {.inline.} = 
+proc normalize*(v: TVector): TVector {.inline.} =
   result = v * (1.0 / v.len)
 #/ Returns a normalized copy of v or cpvzero if v was already cpvzero. Protects against divide by zero errors.
-proc normalizeSafe*(v: TVector): TVector {.inline.} = 
+proc normalizeSafe*(v: TVector): TVector {.inline.} =
   result = if v.x == 0.0 and v.y == 0.0: VectorZero else: v.normalize
 #/ Clamp v to length len.
-proc clamp*(v: TVector; len: CpFloat): TVector {.inline.} = 
+proc clamp*(v: TVector; len: CpFloat): TVector {.inline.} =
   result = if v.dot(v) > len * len: v.normalize * len else: v
 #/ Linearly interpolate between v1 towards v2 by distance d.
-proc lerpconst*(v1, v2: TVector; d: CpFloat): TVector {.inline.} = 
+proc lerpconst*(v1, v2: TVector; d: CpFloat): TVector {.inline.} =
   result = v1 + clamp(v2 - v1, d)             #vadd(v1 + vclamp(vsub(v2, v1), d))
 #/ Returns the distance between v1 and v2.
-proc dist*(v1, v2: TVector): CpFloat {.inline.} = 
+proc dist*(v1, v2: TVector): CpFloat {.inline.} =
   result = (v1 - v2).len #vlength(vsub(v1, v2))
 #/ Returns the squared distance between v1 and v2. Faster than cpvdist() when you only need to compare distances.
-proc distsq*(v1, v2: TVector): CpFloat {.inline.} = 
+proc distsq*(v1, v2: TVector): CpFloat {.inline.} =
   result = (v1 - v2).lenSq  #vlengthsq(vsub(v1, v2))
 #/ Returns true if the distance between v1 and v2 is less than dist.
-proc near*(v1, v2: TVector; dist: CpFloat): bool{.inline.} = 
+proc near*(v1, v2: TVector; dist: CpFloat): bool{.inline.} =
   result = v1.distSq(v2) < dist * dist
 
 
@@ -706,13 +706,13 @@ proc Sleep*(body: PBody){.importc: "cpBodySleep", dynlib: Lib.}
 proc SleepWithGroup*(body: PBody; group: PBody){.
     importc: "cpBodySleepWithGroup", dynlib: Lib.}
 #/ Returns true if the body is sleeping.
-proc isSleeping*(body: PBody): bool {.inline.} = 
+proc isSleeping*(body: PBody): bool {.inline.} =
   return body.node.root != nil
 #/ Returns true if the body is static.
-proc isStatic*(body: PBody): bool {.inline.} = 
+proc isStatic*(body: PBody): bool {.inline.} =
   return body.node.idleTime == CpInfinity
 #/ Returns true if the body has not been added to a space.
-proc isRogue*(body: PBody): bool {.inline.} = 
+proc isRogue*(body: PBody): bool {.inline.} =
   return body.space == nil
 
 # #define CP_DefineBodyStructGetter(type, member, name) \
@@ -740,7 +740,7 @@ defGetter(PBody, CpFloat, i, Moment)
 #/ Set the moment of a body.
 when defined(MoreNim):
   defSetter(PBody, CpFloat, i, Moment)
-else: 
+else:
   proc SetMoment*(body: PBody; i: CpFloat) {.
     cdecl, importc: "cpBodySetMoment", dynlib: Lib.}
 
@@ -775,10 +775,10 @@ proc UpdateVelocity*(body: PBody; gravity: TVector; damping: CpFloat; dt: CpFloa
 proc UpdatePosition*(body: PBody; dt: CpFloat){.
   cdecl, importc: "cpBodyUpdatePosition", dynlib: Lib.}
 #/ Convert body relative/local coordinates to absolute/world coordinates.
-proc Local2World*(body: PBody; v: TVector): TVector{.inline.} = 
+proc Local2World*(body: PBody; v: TVector): TVector{.inline.} =
   result = body.p + v.rotate(body.rot) ##return cpvadd(body.p, cpvrotate(v, body.rot))
 #/ Convert body absolute/world coordinates to  relative/local coordinates.
-proc world2Local*(body: PBody; v: TVector): TVector{.inline.} = 
+proc world2Local*(body: PBody; v: TVector): TVector{.inline.} =
   result = (v - body.p).unrotate(body.rot)
 #/ Set the forces and torque or a body to zero.
 proc resetForces*(body: PBody){.
@@ -808,26 +808,26 @@ proc kineticEnergy*(body: PBOdy): CpFloat =
   result = (body.v.dot(body.v) * body.m) + (body.w * body.w * body.i)
 
 #/ Call @c func once for each shape attached to @c body and added to the space.
-proc eachShape*(body: PBody; fun: TBodyShapeIteratorFunc; 
+proc eachShape*(body: PBody; fun: TBodyShapeIteratorFunc;
                       data: pointer){.
   cdecl, importc: "cpBodyEachShape", dynlib: Lib.}
 #/ Call @c func once for each constraint attached to @c body and added to the space.
-proc eachConstraint*(body: PBody; fun: TBodyConstraintIteratorFunc; 
+proc eachConstraint*(body: PBody; fun: TBodyConstraintIteratorFunc;
                            data: pointer) {.
   cdecl, importc: "cpBodyEachConstraint", dynlib: Lib.}
 #/ Call @c func once for each arbiter that is currently active on the body.
-proc eachArbiter*(body: PBody; fun: TBodyArbiterIteratorFunc; 
+proc eachArbiter*(body: PBody; fun: TBodyArbiterIteratorFunc;
                         data: pointer){.
   cdecl, importc: "cpBodyEachArbiter", dynlib: Lib.}
 #/ Allocate a spatial hash.
 proc SpaceHashAlloc*(): PSpaceHash{.
   cdecl, importc: "cpSpaceHashAlloc", dynlib: Lib.}
-#/ Initialize a spatial hash. 
-proc SpaceHashInit*(hash: PSpaceHash; celldim: CpFloat; numcells: cint; 
+#/ Initialize a spatial hash.
+proc SpaceHashInit*(hash: PSpaceHash; celldim: CpFloat; numcells: cint;
                     bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{.
   cdecl, importc: "cpSpaceHashInit", dynlib: Lib.}
 #/ Allocate and initialize a spatial hash.
-proc SpaceHashNew*(celldim: CpFloat; cells: cint; bbfun: TSpatialIndexBBFunc; 
+proc SpaceHashNew*(celldim: CpFloat; cells: cint; bbfun: TSpatialIndexBBFunc;
                    staticIndex: PSpatialIndex): PSpatialIndex{.
   cdecl, importc: "cpSpaceHashNew", dynlib: Lib.}
 #/ Change the cell dimensions and table size of the spatial hash to tune it.
@@ -842,8 +842,8 @@ proc SpaceHashResize*(hash: PSpaceHash; celldim: CpFloat; numcells: cint){.
 #/ Allocate a bounding box tree.
 proc BBTreeAlloc*(): PBBTree{.cdecl, importc: "cpBBTreeAlloc", dynlib: Lib.}
 #/ Initialize a bounding box tree.
-proc BBTreeInit*(tree: PBBTree; bbfun: TSpatialIndexBBFunc; 
-                 staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl, 
+proc BBTreeInit*(tree: PBBTree; bbfun: TSpatialIndexBBFunc;
+                 staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl,
     importc: "cpBBTreeInit", dynlib: Lib.}
 #/ Allocate and initialize a bounding box tree.
 proc BBTreeNew*(bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{.
@@ -860,12 +860,12 @@ proc BBTreeSetVelocityFunc*(index: PSpatialIndex; fun: TBBTreeVelocityFunc){.
 
 #/ Allocate a 1D sort and sweep broadphase.
 
-proc Sweep1DAlloc*(): ptr TSweep1D{.cdecl, importc: "cpSweep1DAlloc", 
+proc Sweep1DAlloc*(): ptr TSweep1D{.cdecl, importc: "cpSweep1DAlloc",
                                     dynlib: Lib.}
 #/ Initialize a 1D sort and sweep broadphase.
 
-proc Sweep1DInit*(sweep: ptr TSweep1D; bbfun: TSpatialIndexBBFunc; 
-                  staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl, 
+proc Sweep1DInit*(sweep: ptr TSweep1D; bbfun: TSpatialIndexBBFunc;
+                  staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl,
     importc: "cpSweep1DInit", dynlib: Lib.}
 #/ Allocate and initialize a 1D sort and sweep broadphase.
 
@@ -878,7 +878,7 @@ defProp(PArbiter, CpFloat, e, Elasticity)
 defProp(PArbiter, CpFloat, u, Friction)
 defProp(PArbiter, TVector, surface_vr, SurfaceVelocity)
 
-#/ Calculate the total impulse that was applied by this 
+#/ Calculate the total impulse that was applied by this
 #/ This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
 proc totalImpulse*(obj: PArbiter): TVector {.cdecl, importc: "cpArbiterTotalImpulse", dynlib: Lib.}
 
@@ -917,7 +917,7 @@ template getShapes*(arb: PArbiter, name1, name2: expr): stmt {.immediate.} =
 #/ Return the colliding bodies involved for this arbiter.
 #/ The order of the cpSpace.collision_type the bodies are associated with values will match
 #/ the order set when the collision handler was registered.
-#proc getBodies*(arb: PArbiter, a, b: var PBody) {.inline.} = 
+#proc getBodies*(arb: PArbiter, a, b: var PBody) {.inline.} =
 #  getShapes(arb, shape1, shape2)
 #  a = shape1.body
 #  b = shape2.body
@@ -981,7 +981,7 @@ proc segmentQuery*(shape: PShape, a, b: TVector, info: PSegmentQueryInfo): bool
   cdecl, importc: "cpShapeSegmentQuery", dynlib: Lib.}
 
 #/ Get the hit point for a segment query.
-## Possibly change; info to PSegmentQueryInfo 
+## Possibly change; info to PSegmentQueryInfo
 proc queryHitPoint*(start, to: TVector, info: TSegmentQueryInfo): TVector {.inline.} =
   result = start.lerp(to, info.t)
 
@@ -1035,7 +1035,7 @@ proc init*(poly: PPolyShape; body: PBody, numVerts: cint;
   cdecl, importc: "cpPolyShapeInit", dynlib: Lib.}
 #/ Allocate and initialize a polygon shape.
 #/ A convex hull will be created from the vertexes.
-proc newPolyShape*(body: PBody; numVerts: cint; verts: ptr TVector; 
+proc newPolyShape*(body: PBody; numVerts: cint; verts: ptr TVector;
                     offset: TVector): PShape {.
   cdecl, importc: "cpPolyShapeNew", dynlib: Lib.}
 #/ Initialize a box shaped polygon shape.
@@ -1129,11 +1129,11 @@ proc MomentForBox2*(m: CpFloat; box: TBB): CpFloat {.
 
 
 ##constraints
-type 
+type
   #TODO: all these are private
   #TODO: defConstraintProp()
   PPinJoint = ptr TPinJoint
-  TPinJoint{.pf.} = object 
+  TPinJoint{.pf.} = object
     constraint: PConstraint
     anchr1: TVector
     anchr2: TVector
@@ -1146,7 +1146,7 @@ type
     jnMax: CpFloat
     bias: CpFloat
   PSlideJoint = ptr TSlideJoint
-  TSlideJoint{.pf.} = object 
+  TSlideJoint{.pf.} = object
     constraint: PConstraint
     anchr1: TVector
     anchr2: TVector
@@ -1160,7 +1160,7 @@ type
     jnMax: CpFloat
     bias: CpFloat
   PPivotJoint = ptr TPivotJoint
-  TPivotJoint{.pf.} = object 
+  TPivotJoint{.pf.} = object
     constraint: PConstraint
     anchr1: TVector
     anchr2: TVector
@@ -1172,7 +1172,7 @@ type
     jMaxLen: CpFloat
     bias: TVector
   PGrooveJoint = ptr TGrooveJoint
-  TGrooveJoint{.pf.} = object 
+  TGrooveJoint{.pf.} = object
     constraint: PConstraint
     grv_n: TVector
     grv_a: TVector
@@ -1188,7 +1188,7 @@ type
     jMaxLen: CpFloat
     bias: TVector
   PDampedSpring = ptr TDampedSpring
-  TDampedSpring{.pf.} = object 
+  TDampedSpring{.pf.} = object
     constraint: PConstraint
     anchr1: TVector
     anchr2: TVector
@@ -1203,7 +1203,7 @@ type
     nMass: CpFloat
     n: TVector
   PDampedRotarySpring = ptr TDampedRotarySpring
-  TDampedRotarySpring{.pf.} = object 
+  TDampedRotarySpring{.pf.} = object
     constraint: PConstraint
     restAngle: CpFloat
     stiffness: CpFloat
@@ -1213,7 +1213,7 @@ type
     w_coef: CpFloat
     iSum: CpFloat
   PRotaryLimitJoint = ptr TRotaryLimitJoint
-  TRotaryLimitJoint{.pf.} = object 
+  TRotaryLimitJoint{.pf.} = object
     constraint: PConstraint
     min: CpFloat
     max: CpFloat
@@ -1222,7 +1222,7 @@ type
     jAcc: CpFloat
     jMax: CpFloat
   PRatchetJoint = ptr TRatchetJoint
-  TRatchetJoint{.pf.} = object 
+  TRatchetJoint{.pf.} = object
     constraint: PConstraint
     angle: CpFloat
     phase: CpFloat
@@ -1232,7 +1232,7 @@ type
     jAcc: CpFloat
     jMax: CpFloat
   PGearJoint = ptr TGearJoint
-  TGearJoint{.pf.} = object 
+  TGearJoint{.pf.} = object
     constraint: PConstraint
     phase: CpFloat
     ratio: CpFloat
@@ -1242,7 +1242,7 @@ type
     jAcc: CpFloat
     jMax: CpFloat
   PSimpleMotor = ptr TSimpleMotor
-  TSimpleMotor{.pf.} = object 
+  TSimpleMotor{.pf.} = object
     constraint: PConstraint
     rate: CpFloat
     iSum: CpFloat
@@ -1250,7 +1250,7 @@ type
     jMax: CpFloat
   TDampedSpringForceFunc* = proc (spring: PConstraint; dist: CpFloat): CpFloat{.
     cdecl.}
-  TDampedRotarySpringTorqueFunc* = proc (spring: PConstraint; 
+  TDampedRotarySpringTorqueFunc* = proc (spring: PConstraint;
       relativeAngle: CpFloat): CpFloat {.cdecl.}
 #/ Destroy a constraint.
 proc destroy*(constraint: PConstraint){.
@@ -1260,7 +1260,7 @@ proc free*(constraint: PConstraint){.
   cdecl, importc: "cpConstraintFree", dynlib: Lib.}
 
 #/ @private
-proc activateBodies(constraint: PConstraint) {.inline.} = 
+proc activateBodies(constraint: PConstraint) {.inline.} =
   if not constraint.a.isNil: constraint.a.activate()
   if not constraint.b.isNil: constraint.b.activate()
 
@@ -1291,7 +1291,7 @@ defGetter(PConstraint, TConstraintPreSolveFunc, preSolve, PreSolveFunc)
 defGetter(PConstraint, TConstraintPostSolveFunc, postSolve, PostSolveFunc)
 defGetter(PConstraint, CpDataPointer, data, UserData)
 # Get the last impulse applied by this constraint.
-proc getImpulse*(constraint: PConstraint): CpFloat {.inline.} = 
+proc getImpulse*(constraint: PConstraint): CpFloat {.inline.} =
   return constraint.klass.getImpulse(constraint)
 
 # #define cpConstraintCheckCast(constraint, struct) \
@@ -1309,7 +1309,7 @@ proc getImpulse*(constraint: PConstraint): CpFloat {.inline.} =
 # }
 template constraintCheckCast(constraint: PConstraint, ctype: expr): stmt {.immediate.} =
   assert(constraint.klass == `ctype getClass`(), "Constraint is the wrong class")
-template defCGetter(ctype: expr, memberType: typedesc, member: expr, name: expr): stmt {.immediate.} = 
+template defCGetter(ctype: expr, memberType: typedesc, member: expr, name: expr): stmt {.immediate.} =
   proc `get ctype name`*(constraint: PConstraint): memberType {.cdecl.} =
     constraintCheckCast(constraint, ctype)
     result = cast[`P ctype`](constraint).member
@@ -1330,7 +1330,7 @@ proc PinJointGetClass*(): PConstraintClass{.
 proc AllocPinJoint*(): PPinJoint{.
   cdecl, importc: "cpPinJointAlloc", dynlib: Lib.}
 #/ Initialize a pin joint.
-proc PinJointInit*(joint: PPinJoint; a: PBody; b: PBody; anchr1: TVector; 
+proc PinJointInit*(joint: PPinJoint; a: PBody; b: PBody; anchr1: TVector;
                    anchr2: TVector): PPinJoint{.
   cdecl, importc: "cpPinJointInit", dynlib: Lib.}
 #/ Allocate and initialize a pin joint.
@@ -1411,7 +1411,7 @@ proc init*(joint: PDampedSpring; a, b: PBody; anchr1, anchr2: TVector;
             restLength, stiffness, damping: CpFloat): PDampedSpring{.
   cdecl, importc: "cpDampedSpringInit", dynlib: Lib.}
 #/ Allocate and initialize a damped spring.
-proc newDampedSpring*(a, b: PBody; anchr1, anchr2: TVector; 
+proc newDampedSpring*(a, b: PBody; anchr1, anchr2: TVector;
                       restLength, stiffness, damping: CpFloat): PConstraint{.
   cdecl, importc: "cpDampedSpringNew", dynlib: Lib.}
 
@@ -1431,7 +1431,7 @@ proc DampedRotarySpringGetClass*(): PConstraintClass{.
 proc DampedRotarySpringAlloc*(): PDampedRotarySpring{.
   cdecl, importc: "cpDampedRotarySpringAlloc", dynlib: Lib.}
 #/ Initialize a damped rotary spring.
-proc init*(joint: PDampedRotarySpring; a, b: PBody; 
+proc init*(joint: PDampedRotarySpring; a, b: PBody;
             restAngle, stiffness, damping: CpFloat): PDampedRotarySpring{.
   cdecl, importc: "cpDampedRotarySpringInit", dynlib: Lib.}
 #/ Allocate and initialize a damped rotary spring.
@@ -1477,7 +1477,7 @@ defCProp(RatchetJoint, CpFloat, phase, Phase)
 defCProp(RatchetJoint, CpFloat, ratchet, Ratchet)
 
 
-proc GearJointGetClass*(): PConstraintClass{.cdecl, 
+proc GearJointGetClass*(): PConstraintClass{.cdecl,
     importc: "cpGearJointGetClass", dynlib: Lib.}
 #/ Allocate a gear joint.
 proc AllocGearJoint*(): PGearJoint{.
@@ -1502,7 +1502,7 @@ proc SimpleMotorGetClass*(): PConstraintClass{.
 proc AllocSimpleMotor*(): PSimpleMotor{.
   cdecl, importc: "cpSimpleMotorAlloc", dynlib: Lib.}
 #/ initialize a simple motor.
-proc init*(joint: PSimpleMotor; a, b: PBody; 
+proc init*(joint: PSimpleMotor; a, b: PBody;
                       rate: CpFloat): PSimpleMotor{.
   cdecl, importc: "cpSimpleMotorInit", dynlib: Lib.}
 #/ Allocate and initialize a simple motor.
diff --git a/tests/manyloc/keineschweine/dependencies/enet/enet.nim b/tests/manyloc/keineschweine/dependencies/enet/enet.nim
index 93857207a..3c4ce2017 100644
--- a/tests/manyloc/keineschweine/dependencies/enet/enet.nim
+++ b/tests/manyloc/keineschweine/dependencies/enet/enet.nim
@@ -1,52 +1,52 @@
 discard """Copyright (c) 2002-2012 Lee Salzman
 
-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 
+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 
+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 
+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 
+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.
 """
 
 const Lib = "libenet.so.1(|.0.3)"
 
 {.deadCodeElim: on.}
-const 
+const
   ENET_VERSION_MAJOR* = 1
   ENET_VERSION_MINOR* = 3
   ENET_VERSION_PATCH* = 3
-template ENET_VERSION_CREATE(major, minor, patch: expr): expr = 
+template ENET_VERSION_CREATE(major, minor, patch: expr): expr =
   (((major) shl 16) or ((minor) shl 8) or (patch))
 
-const 
-  ENET_VERSION* = ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, 
+const
+  ENET_VERSION* = ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR,
                                       ENET_VERSION_PATCH)
-type 
+type
   TVersion* = cuint
-  TSocketType*{.size: sizeof(cint).} = enum 
+  TSocketType*{.size: sizeof(cint).} = enum
     ENET_SOCKET_TYPE_STREAM = 1, ENET_SOCKET_TYPE_DATAGRAM = 2
-  TSocketWait*{.size: sizeof(cint).} = enum 
-    ENET_SOCKET_WAIT_NONE = 0, ENET_SOCKET_WAIT_SEND = (1 shl 0), 
+  TSocketWait*{.size: sizeof(cint).} = enum
+    ENET_SOCKET_WAIT_NONE = 0, ENET_SOCKET_WAIT_SEND = (1 shl 0),
     ENET_SOCKET_WAIT_RECEIVE = (1 shl 1)
-  TSocketOption*{.size: sizeof(cint).} = enum 
-    ENET_SOCKOPT_NONBLOCK = 1, ENET_SOCKOPT_BROADCAST = 2, 
-    ENET_SOCKOPT_RCVBUF = 3, ENET_SOCKOPT_SNDBUF = 4, 
+  TSocketOption*{.size: sizeof(cint).} = enum
+    ENET_SOCKOPT_NONBLOCK = 1, ENET_SOCKOPT_BROADCAST = 2,
+    ENET_SOCKOPT_RCVBUF = 3, ENET_SOCKOPT_SNDBUF = 4,
     ENET_SOCKOPT_REUSEADDR = 5
-const 
+const
   ENET_HOST_ANY* = 0
   ENET_HOST_BROADCAST* = 0xFFFFFFFF
   ENET_PORT_ANY* = 0
-  
+
   ENET_PROTOCOL_MINIMUM_MTU* = 576
   ENET_PROTOCOL_MAXIMUM_MTU* = 4096
   ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS* = 32
@@ -57,29 +57,29 @@ const
   ENET_PROTOCOL_MAXIMUM_PEER_ID* = 0x00000FFF
 type
   PAddress* = ptr TAddress
-  TAddress*{.pure, final.} = object 
+  TAddress*{.pure, final.} = object
     host*: cuint
     port*: cushort
-  
-  TPacketFlag*{.size: sizeof(cint).} = enum 
-    FlagReliable = (1 shl 0), 
-    FlagUnsequenced = (1 shl 1), 
-    NoAllocate = (1 shl 2), 
+
+  TPacketFlag*{.size: sizeof(cint).} = enum
+    FlagReliable = (1 shl 0),
+    FlagUnsequenced = (1 shl 1),
+    NoAllocate = (1 shl 2),
     UnreliableFragment = (1 shl 3)
-  
-  TENetListNode*{.pure, final.} = object 
+
+  TENetListNode*{.pure, final.} = object
       next*: ptr T_ENetListNode
       previous*: ptr T_ENetListNode
 
   PENetListIterator* = ptr TENetListNode
-  TENetList*{.pure, final.} = object 
+  TENetList*{.pure, final.} = object
     sentinel*: TENetListNode
-  
-  T_ENetPacket*{.pure, final.} = object 
+
+  T_ENetPacket*{.pure, final.} = object
   TPacketFreeCallback* = proc (a2: ptr T_ENetPacket){.cdecl.}
-  
+
   PPacket* = ptr TPacket
-  TPacket*{.pure, final.} = object 
+  TPacket*{.pure, final.} = object
     referenceCount: csize
     flags*: cint
     data*: cstring#ptr cuchar
@@ -87,13 +87,13 @@ type
     freeCallback*: TPacketFreeCallback
 
   PAcknowledgement* = ptr TAcknowledgement
-  TAcknowledgement*{.pure, final.} = object 
+  TAcknowledgement*{.pure, final.} = object
     acknowledgementList*: TEnetListNode
     sentTime*: cuint
     command*: TEnetProtocol
 
   POutgoingCommand* = ptr TOutgoingCommand
-  TOutgoingCommand*{.pure, final.} = object 
+  TOutgoingCommand*{.pure, final.} = object
     outgoingCommandList*: TEnetListNode
     reliableSequenceNumber*: cushort
     unreliableSequenceNumber*: cushort
@@ -107,7 +107,7 @@ type
     packet*: PPacket
 
   PIncomingCommand* = ptr TIncomingCommand
-  TIncomingCommand*{.pure, final.} = object 
+  TIncomingCommand*{.pure, final.} = object
     incomingCommandList*: TEnetListNode
     reliableSequenceNumber*: cushort
     unreliableSequenceNumber*: cushort
@@ -117,52 +117,52 @@ type
     fragments*: ptr cuint
     packet*: ptr TPacket
 
-  TPeerState*{.size: sizeof(cint).} = enum 
-    ENET_PEER_STATE_DISCONNECTED = 0, ENET_PEER_STATE_CONNECTING = 1, 
-    ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2, 
-    ENET_PEER_STATE_CONNECTION_PENDING = 3, 
-    ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4, ENET_PEER_STATE_CONNECTED = 5, 
-    ENET_PEER_STATE_DISCONNECT_LATER = 6, ENET_PEER_STATE_DISCONNECTING = 7, 
+  TPeerState*{.size: sizeof(cint).} = enum
+    ENET_PEER_STATE_DISCONNECTED = 0, ENET_PEER_STATE_CONNECTING = 1,
+    ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
+    ENET_PEER_STATE_CONNECTION_PENDING = 3,
+    ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4, ENET_PEER_STATE_CONNECTED = 5,
+    ENET_PEER_STATE_DISCONNECT_LATER = 6, ENET_PEER_STATE_DISCONNECTING = 7,
     ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8, ENET_PEER_STATE_ZOMBIE = 9
-  
-  TENetProtocolCommand*{.size: sizeof(cint).} = enum 
-    ENET_PROTOCOL_COMMAND_NONE = 0, ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1, 
-    ENET_PROTOCOL_COMMAND_CONNECT = 2, 
-    ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3, 
-    ENET_PROTOCOL_COMMAND_DISCONNECT = 4, ENET_PROTOCOL_COMMAND_PING = 5, 
-    ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6, 
-    ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7, 
-    ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8, 
-    ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9, 
-    ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10, 
-    ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11, 
-    ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12, 
+
+  TENetProtocolCommand*{.size: sizeof(cint).} = enum
+    ENET_PROTOCOL_COMMAND_NONE = 0, ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
+    ENET_PROTOCOL_COMMAND_CONNECT = 2,
+    ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
+    ENET_PROTOCOL_COMMAND_DISCONNECT = 4, ENET_PROTOCOL_COMMAND_PING = 5,
+    ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
+    ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
+    ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
+    ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9,
+    ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10,
+    ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
+    ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12,
     ENET_PROTOCOL_COMMAND_COUNT = 13, ENET_PROTOCOL_COMMAND_MASK = 0x0000000F
-  TENetProtocolFlag*{.size: sizeof(cint).} = enum 
+  TENetProtocolFlag*{.size: sizeof(cint).} = enum
     ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12,
-    ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 shl 6), 
-    ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 shl 7), 
-    ENET_PROTOCOL_HEADER_SESSION_MASK = (3 shl 12), 
-    ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 shl 14), 
+    ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 shl 6),
+    ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 shl 7),
+    ENET_PROTOCOL_HEADER_SESSION_MASK = (3 shl 12),
+    ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 shl 14),
     ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 shl 15),
     ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED.cint or
         ENET_PROTOCOL_HEADER_FLAG_SENT_TIME.cint
-  
-  TENetProtocolHeader*{.pure, final.} = object 
+
+  TENetProtocolHeader*{.pure, final.} = object
     peerID*: cushort
     sentTime*: cushort
 
-  TENetProtocolCommandHeader*{.pure, final.} = object 
+  TENetProtocolCommandHeader*{.pure, final.} = object
     command*: cuchar
     channelID*: cuchar
     reliableSequenceNumber*: cushort
 
-  TENetProtocolAcknowledge*{.pure, final.} = object 
+  TENetProtocolAcknowledge*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     receivedReliableSequenceNumber*: cushort
     receivedSentTime*: cushort
 
-  TENetProtocolConnect*{.pure, final.} = object 
+  TENetProtocolConnect*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     outgoingPeerID*: cushort
     incomingSessionID*: cuchar
@@ -178,7 +178,7 @@ type
     connectID*: cuint
     data*: cuint
 
-  TENetProtocolVerifyConnect*{.pure, final.} = object 
+  TENetProtocolVerifyConnect*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     outgoingPeerID*: cushort
     incomingSessionID*: cuchar
@@ -193,39 +193,39 @@ type
     packetThrottleDeceleration*: cuint
     connectID*: cuint
 
-  TENetProtocolBandwidthLimit*{.pure, final.} = object 
+  TENetProtocolBandwidthLimit*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     incomingBandwidth*: cuint
     outgoingBandwidth*: cuint
 
-  TENetProtocolThrottleConfigure*{.pure, final.} = object 
+  TENetProtocolThrottleConfigure*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     packetThrottleInterval*: cuint
     packetThrottleAcceleration*: cuint
     packetThrottleDeceleration*: cuint
 
-  TENetProtocolDisconnect*{.pure, final.} = object 
+  TENetProtocolDisconnect*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     data*: cuint
 
-  TENetProtocolPing*{.pure, final.} = object 
+  TENetProtocolPing*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
 
-  TENetProtocolSendReliable*{.pure, final.} = object 
+  TENetProtocolSendReliable*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     dataLength*: cushort
 
-  TENetProtocolSendUnreliable*{.pure, final.} = object 
+  TENetProtocolSendUnreliable*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     unreliableSequenceNumber*: cushort
     dataLength*: cushort
 
-  TENetProtocolSendUnsequenced*{.pure, final.} = object 
+  TENetProtocolSendUnsequenced*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     unsequencedGroup*: cushort
     dataLength*: cushort
 
-  TENetProtocolSendFragment*{.pure, final.} = object 
+  TENetProtocolSendFragment*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
     startSequenceNumber*: cushort
     dataLength*: cushort
@@ -233,12 +233,12 @@ type
     fragmentNumber*: cuint
     totalLength*: cuint
     fragmentOffset*: cuint
-  
+
   ## this is incomplete; need helper templates or something
   ## ENetProtocol
-  TENetProtocol*{.pure, final.} = object 
+  TENetProtocol*{.pure, final.} = object
     header*: TENetProtocolCommandHeader
-const 
+const
   ENET_BUFFER_MAXIMUM* = (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
   ENET_HOST_RECEIVE_BUFFER_SIZE          = 256 * 1024
   ENET_HOST_SEND_BUFFER_SIZE             = 256 * 1024
@@ -270,39 +270,39 @@ when defined(Linux) or true:
   import posix
   const
     ENET_SOCKET_NULL*: cint = -1
-  type 
+  type
     TENetSocket* = cint
     PEnetBuffer* = ptr object
-    TENetBuffer*{.pure, final.} = object 
+    TENetBuffer*{.pure, final.} = object
       data*: pointer
       dataLength*: csize
     TENetSocketSet* = Tfd_set
   ## see if these are different on win32, if not then get rid of these
-  template ENET_HOST_TO_NET_16*(value: expr): expr = 
+  template ENET_HOST_TO_NET_16*(value: expr): expr =
     (htons(value))
-  template ENET_HOST_TO_NET_32*(value: expr): expr = 
+  template ENET_HOST_TO_NET_32*(value: expr): expr =
     (htonl(value))
-  template ENET_NET_TO_HOST_16*(value: expr): expr = 
+  template ENET_NET_TO_HOST_16*(value: expr): expr =
     (ntohs(value))
-  template ENET_NET_TO_HOST_32*(value: expr): expr = 
+  template ENET_NET_TO_HOST_32*(value: expr): expr =
     (ntohl(value))
 
-  template ENET_SOCKETSET_EMPTY*(sockset: expr): expr = 
+  template ENET_SOCKETSET_EMPTY*(sockset: expr): expr =
     FD_ZERO(addr((sockset)))
-  template ENET_SOCKETSET_ADD*(sockset, socket: expr): expr = 
+  template ENET_SOCKETSET_ADD*(sockset, socket: expr): expr =
     FD_SET(socket, addr((sockset)))
-  template ENET_SOCKETSET_REMOVE*(sockset, socket: expr): expr = 
+  template ENET_SOCKETSET_REMOVE*(sockset, socket: expr): expr =
     FD_CLEAR(socket, addr((sockset)))
-  template ENET_SOCKETSET_CHECK*(sockset, socket: expr): expr = 
+  template ENET_SOCKETSET_CHECK*(sockset, socket: expr): expr =
     FD_ISSET(socket, addr((sockset)))
 
 when defined(Windows):
   ## put the content of win32.h in here
 
 
-type 
+type
   PChannel* = ptr TChannel
-  TChannel*{.pure, final.} = object 
+  TChannel*{.pure, final.} = object
     outgoingReliableSequenceNumber*: cushort
     outgoingUnreliableSequenceNumber*: cushort
     usedReliableWindows*: cushort
@@ -313,7 +313,7 @@ type
     incomingUnreliableCommands*: TENetList
 
   PPeer* = ptr TPeer
-  TPeer*{.pure, final.} = object 
+  TPeer*{.pure, final.} = object
     dispatchList*: TEnetListNode
     host*: ptr THost
     outgoingPeerID*: cushort
@@ -367,25 +367,25 @@ type
     needsDispatch*: cint
     incomingUnsequencedGroup*: cushort
     outgoingUnsequencedGroup*: cushort
-    unsequencedWindow*: array[0..ENET_PEER_UNSEQUENCED_WINDOW_SIZE div 32 - 1, 
+    unsequencedWindow*: array[0..ENET_PEER_UNSEQUENCED_WINDOW_SIZE div 32 - 1,
                               cuint]
     eventData*: cuint
 
   PCompressor* = ptr TCompressor
-  TCompressor*{.pure, final.} = object 
+  TCompressor*{.pure, final.} = object
     context*: pointer
-    compress*: proc (context: pointer; inBuffers: ptr TEnetBuffer; 
-                     inBufferCount: csize; inLimit: csize; 
+    compress*: proc (context: pointer; inBuffers: ptr TEnetBuffer;
+                     inBufferCount: csize; inLimit: csize;
                      outData: ptr cuchar; outLimit: csize): csize{.cdecl.}
-    decompress*: proc (context: pointer; inData: ptr cuchar; inLimit: csize; 
+    decompress*: proc (context: pointer; inData: ptr cuchar; inLimit: csize;
                        outData: ptr cuchar; outLimit: csize): csize{.cdecl.}
     destroy*: proc (context: pointer){.cdecl.}
 
   TChecksumCallback* = proc (buffers: ptr TEnetBuffer; bufferCount: csize): cuint{.
       cdecl.}
-  
+
   PHost* = ptr THost
-  THost*{.pure, final.} = object 
+  THost*{.pure, final.} = object
     socket*: TEnetSocket
     address*: TAddress
     incomingBandwidth*: cuint
@@ -402,14 +402,14 @@ type
     continueSending*: cint
     packetSize*: csize
     headerFlags*: cushort
-    commands*: array[0..ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS - 1, 
+    commands*: array[0..ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS - 1,
                      TEnetProtocol]
     commandCount*: csize
     buffers*: array[0..ENET_BUFFER_MAXIMUM - 1, TEnetBuffer]
     bufferCount*: csize
     checksum*: TChecksumCallback
     compressor*: TCompressor
-    packetData*: array[0..ENET_PROTOCOL_MAXIMUM_MTU - 1, 
+    packetData*: array[0..ENET_PROTOCOL_MAXIMUM_MTU - 1,
                        array[0..2 - 1, cuchar]]
     receivedAddress*: TAddress
     receivedData*: ptr cuchar
@@ -418,19 +418,19 @@ type
     totalSentPackets*: cuint
     totalReceivedData*: cuint
     totalReceivedPackets*: cuint
-  
-  TEventType*{.size: sizeof(cint).} = enum 
-    EvtNone = 0, EvtConnect = 1, 
+
+  TEventType*{.size: sizeof(cint).} = enum
+    EvtNone = 0, EvtConnect = 1,
     EvtDisconnect = 2, EvtReceive = 3
   PEvent* = ptr TEvent
-  TEvent*{.pure, final.} = object 
+  TEvent*{.pure, final.} = object
     kind*: TEventType
     peer*: ptr TPeer
     channelID*: cuchar
     data*: cuint
     packet*: ptr TPacket
 
-  TENetCallbacks*{.pure, final.} = object 
+  TENetCallbacks*{.pure, final.} = object
     malloc*: proc (size: csize): pointer{.cdecl.}
     free*: proc (memory: pointer){.cdecl.}
     no_memory*: proc (){.cdecl.}
@@ -473,10 +473,10 @@ proc send*(socket: TEnetSocket; address: var TAddress; buffer: ptr TEnetBuffer;
   importc: "enet_socket_send", dynlib: Lib.}
 proc send*(socket: TEnetSocket; address: ptr TAddress; buffer: ptr TEnetBuffer; size: csize): cint{.
   importc: "enet_socket_send", dynlib: Lib.}
-proc receive*(socket: TEnetSocket; address: var TAddress; 
+proc receive*(socket: TEnetSocket; address: var TAddress;
                buffer: ptr TEnetBuffer; size: csize): cint{.
   importc: "enet_socket_receive", dynlib: Lib.}
-proc receive*(socket: TEnetSocket; address: ptr TAddress; 
+proc receive*(socket: TEnetSocket; address: ptr TAddress;
                buffer: ptr TEnetBuffer; size: csize): cint{.
   importc: "enet_socket_receive", dynlib: Lib.}
 proc wait*(socket: TEnetSocket; a3: ptr cuint; a4: cuint): cint{.
@@ -485,7 +485,7 @@ proc setOption*(socket: TEnetSocket; a3: TSocketOption; a4: cint): cint{.
   importc: "enet_socket_set_option", dynlib: Lib.}
 proc destroy*(socket: TEnetSocket){.
   importc: "enet_socket_destroy", dynlib: Lib.}
-proc select*(socket: TEnetSocket; a3: ptr TENetSocketSet; 
+proc select*(socket: TEnetSocket; a3: ptr TENetSocketSet;
               a4: ptr TENetSocketSet; a5: cuint): cint{.
   importc: "enet_socketset_select", dynlib: Lib.}
 
@@ -578,13 +578,13 @@ proc resetQueues*(peer: PPeer){.
 proc setupOutgoingCommand*(peer: PPeer; outgoingCommand: POutgoingCommand){.
   importc: "enet_peer_setup_outgoing_command", dynlib: Lib.}
 
-proc queueOutgoingCommand*(peer: PPeer; command: ptr TEnetProtocol; 
+proc queueOutgoingCommand*(peer: PPeer; command: ptr TEnetProtocol;
           packet: PPacket; offset: cuint; length: cushort): POutgoingCommand{.
   importc: "enet_peer_queue_outgoing_command", dynlib: Lib.}
-proc queueIncomingCommand*(peer: PPeer; command: ptr TEnetProtocol; 
+proc queueIncomingCommand*(peer: PPeer; command: ptr TEnetProtocol;
                     packet: PPacket; fragmentCount: cuint): PIncomingCommand{.
   importc: "enet_peer_queue_incoming_command", dynlib: Lib.}
-proc queueAcknowledgement*(peer: PPeer; command: ptr TEnetProtocol; 
+proc queueAcknowledgement*(peer: PPeer; command: ptr TEnetProtocol;
                             sentTime: cushort): PAcknowledgement{.
   importc: "enet_peer_queue_acknowledgement", dynlib: Lib.}
 proc dispatchIncomingUnreliableCommands*(peer: PPeer; channel: PChannel){.
@@ -596,10 +596,10 @@ proc createRangeCoder*(): pointer{.
   importc: "enet_range_coder_create", dynlib: Lib.}
 proc rangeCoderDestroy*(context: pointer){.
   importc: "enet_range_coder_destroy", dynlib: Lib.}
-proc rangeCoderCompress*(context: pointer; inBuffers: PEnetBuffer; inLimit, 
+proc rangeCoderCompress*(context: pointer; inBuffers: PEnetBuffer; inLimit,
                bufferCount: csize; outData: cstring; outLimit: csize): csize{.
   importc: "enet_range_coder_compress", dynlib: Lib.}
-proc rangeCoderDecompress*(context: pointer; inData: cstring; inLimit: csize; 
+proc rangeCoderDecompress*(context: pointer; inData: cstring; inLimit: csize;
                             outData: cstring; outLimit: csize): csize{.
   importc: "enet_range_coder_decompress", dynlib: Lib.}
 proc protocolCommandSize*(commandNumber: cuchar): csize{.
diff --git a/tests/manyloc/keineschweine/dependencies/enet/testserver.nim b/tests/manyloc/keineschweine/dependencies/enet/testserver.nim
index 28a6bd1f7..6d6de90c1 100644
--- a/tests/manyloc/keineschweine/dependencies/enet/testserver.nim
+++ b/tests/manyloc/keineschweine/dependencies/enet/testserver.nim
@@ -19,11 +19,11 @@ while server.hostService(addr event, 2500) >= 0:
   case event.kind
   of EvtConnect:
     echo "New client from $1:$2".format(event.peer.address.host, event.peer.address.port)
-    
+
     var
-      msg = "hello" 
+      msg = "hello"
       resp = createPacket(cstring(msg), msg.len + 1, FlagReliable)
-      
+
     if event.peer.send(0.cuchar, resp) < 0:
       echo "FAILED"
     else:
@@ -32,9 +32,9 @@ while server.hostService(addr event, 2500) >= 0:
     echo "Recvd ($1) $2 ".format(
       event.packet.dataLength,
       event.packet.data)
-    
+
     destroy(event.packet)
-    
+
   of EvtDisconnect:
     echo "Disconnected"
     event.peer.data = nil
@@ -42,4 +42,4 @@ while server.hostService(addr event, 2500) >= 0:
     discard
 
 server.destroy()
-enetDeinit()
\ No newline at end of file
+enetDeinit()
diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim b/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim
index 3c5a7835c..5a1dffc93 100644
--- a/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim
+++ b/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim
@@ -1,7 +1,7 @@
 import streams
 from strutils import repeat
 
-proc readPaddedStr*(s: PStream, length: int, padChar = '\0'): TaintedString = 
+proc readPaddedStr*(s: PStream, length: int, padChar = '\0'): TaintedString =
   var lastChr = length
   result = s.readStr(length)
   while lastChr >= 0 and result[lastChr - 1] == padChar: dec(lastChr)
@@ -26,22 +26,22 @@ proc writeLEStr*(s: PStream, str: string) =
 
 when isMainModule:
   var testStream = newStringStream()
-  
+
   testStream.writeLEStr("Hello")
   doAssert testStream.data == "\5\0Hello"
-  
+
   testStream.setPosition 0
   var res = testStream.readLEStr()
   doAssert res == "Hello"
-  
+
   testStream.setPosition 0
   testStream.writePaddedStr("Sup", 10)
   echo(repr(testStream), testStream.data.len)
   doAssert testStream.data == "Sup"&repeat('\0', 7)
-  
+
   testStream.setPosition 0
   res = testStream.readPaddedStr(10)
   doAssert res == "Sup"
-  
+
   testStream.close()
 
diff --git a/tests/manyloc/keineschweine/dependencies/nake/nake.nim b/tests/manyloc/keineschweine/dependencies/nake/nake.nim
index 5828e400c..5341c1079 100644
--- a/tests/manyloc/keineschweine/dependencies/nake/nake.nim
+++ b/tests/manyloc/keineschweine/dependencies/nake/nake.nim
@@ -3,7 +3,7 @@ DO AS THOU WILST PUBLIC LICENSE
 
 Whoever should stumble upon this document is henceforth and forever
 entitled to DO AS THOU WILST with aforementioned document and the
-contents thereof. 
+contents thereof.
 
 As said in the Olde Country, `Keepe it Gangster'."""
 
@@ -14,7 +14,7 @@ type
     desc*: string
     action*: TTaskFunction
   TTaskFunction* = proc() {.closure.}
-var 
+var
   tasks* = initTable[string, PTask](16)
 
 proc newTask*(desc: string; action: TTaskFunction): PTask
@@ -61,7 +61,7 @@ when isMainModule:
   quit(shell("nim", "c", "-r", "nakefile.nim", args))
 else:
   addQuitProc(proc() {.noconv.} =
-    var 
+    var
       task: string
       printTaskList: bool
     for kind, key, val in getOpt():
@@ -70,7 +70,7 @@ else:
         case key.tolower
         of "tasks", "t":
           printTaskList = true
-        else: 
+        else:
           echo "Unknown option: ", key, ": ", val
       of cmdArgument:
         task = key
diff --git a/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim b/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim
index 1071ec767..1524f0eb4 100644
--- a/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim
+++ b/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim
@@ -1,4 +1,4 @@
-import 
+import
   strutils, math
 when defined(linux):
   const
@@ -27,7 +27,7 @@ type
     x*, y*, z*: cfloat
 
   PInputStream* = ptr TInputStream
-  TInputStream* {.pf.} = object 
+  TInputStream* {.pf.} = object
     read*: TInputStreamReadFunc
     seek*: TInputStreamSeekFunc
     tell*: TInputStreamTellFunc
@@ -52,14 +52,14 @@ type
     width*: cint
     height*: cint
     bitsPerPixel*: cint
-  TEventType*{.size: sizeof(cint).} = enum 
-    EvtClosed, EvtResized, EvtLostFocus, EvtGainedFocus, 
-    EvtTextEntered, EvtKeyPressed, EvtKeyReleased, EvtMouseWheelMoved, 
-    EvtMouseButtonPressed, EvtMouseButtonReleased, EvtMouseMoved, 
-    EvtMouseEntered, EvtMouseLeft, EvtJoystickButtonPressed, 
-    EvtJoystickButtonReleased, EvtJoystickMoved, EvtJoystickConnected, 
+  TEventType*{.size: sizeof(cint).} = enum
+    EvtClosed, EvtResized, EvtLostFocus, EvtGainedFocus,
+    EvtTextEntered, EvtKeyPressed, EvtKeyReleased, EvtMouseWheelMoved,
+    EvtMouseButtonPressed, EvtMouseButtonReleased, EvtMouseMoved,
+    EvtMouseEntered, EvtMouseLeft, EvtJoystickButtonPressed,
+    EvtJoystickButtonReleased, EvtJoystickMoved, EvtJoystickConnected,
     EvtJoystickDisconnected
-  TKeyEvent*{.pf.} = object 
+  TKeyEvent*{.pf.} = object
     code*: TKeyCode
     alt*    : bool
     control*: bool
@@ -74,7 +74,7 @@ type
     joystickId*: cint
     axis*: TJoystickAxis
     position*: cfloat
-  TMouseWheelEvent*{.pf.} = object 
+  TMouseWheelEvent*{.pf.} = object
     delta*: cint
     x*: cint
     y*: cint
@@ -90,7 +90,7 @@ type
   PEvent* = ptr TEvent
   TEvent*{.pf.} = object
     case kind*: TEventType
-    of EvtKeyPressed, EvtKeyReleased: 
+    of EvtKeyPressed, EvtKeyReleased:
       key*: TKeyEvent
     of EvtMouseButtonPressed, EvtMouseButtonReleased:
       mouseButton*: TMouseButtonEvent
@@ -109,16 +109,16 @@ type
     of EvtMouseWheelMoved:
       mouseWheel*: TMouseWheelEvent
     else: nil
-  TJoystickAxis*{.size: sizeof(cint).} = enum 
-    JoystickX, JoystickY, JoystickZ, JoystickR,      
+  TJoystickAxis*{.size: sizeof(cint).} = enum
+    JoystickX, JoystickY, JoystickZ, JoystickR,
     JoystickU, JoystickV, JoystickPovX, JoystickPovY
   TSizeEvent*{.pf.} = object
     width*: cint
     height*: cint
-  TMouseButton*{.size: sizeof(cint).} = enum 
-    MouseLeft, MouseRight, MouseMiddle,  
+  TMouseButton*{.size: sizeof(cint).} = enum
+    MouseLeft, MouseRight, MouseMiddle,
     MouseXButton1, MouseXButton2, MouseButtonCount
-  TKeyCode*{.size: sizeof(cint).} = enum 
+  TKeyCode*{.size: sizeof(cint).} = enum
     KeyUnknown = - 1, KeyA, KeyB, KeyC, KeyD, KeyE,
     KeyF, KeyG, KeyH, KeyI, KeyJ, KeyK, KeyL, KeyM,                 #/< The M key
     KeyN, KeyO, KeyP, KeyQ, KeyR, KeyS, KeyT, KeyU,                 #/< The U key
@@ -204,11 +204,11 @@ type
   PConvexShape* = ptr TConvexShape
   TConvexShape* {.pf.} = object
 
-  TTextStyle*{.size: sizeof(cint).} = enum 
-    TextRegular = 0, TextBold = 1 shl 0, TextItalic = 1 shl 1, 
+  TTextStyle*{.size: sizeof(cint).} = enum
+    TextRegular = 0, TextBold = 1 shl 0, TextItalic = 1 shl 1,
     TextUnderlined = 1 shl 2
 
-  TBlendMode*{.size: sizeof(cint).} = enum 
+  TBlendMode*{.size: sizeof(cint).} = enum
       BlendAlpha, BlendAdd, BlendMultiply, BlendNone
   PRenderStates* = ptr TRenderStates
   TRenderStates* {.pf.} = object
@@ -220,19 +220,19 @@ type
   PTransform* = ptr TTransform
   TTransform* {.pf.} = object
     matrix*: array[0..8, cfloat]
-  TColor* {.pf.} = object 
+  TColor* {.pf.} = object
     r*: uint8
     g*: uint8
     b*: uint8
     a*: uint8
   PFloatRect* = ptr TFloatRect
-  TFloatRect*{.pf.} = object 
+  TFloatRect*{.pf.} = object
     left*: cfloat
     top*: cfloat
     width*: cfloat
     height*: cfloat
   PIntRect* = ptr TIntRect
-  TIntRect*{.pf.} = object 
+  TIntRect*{.pf.} = object
     left*: cint
     top*: cint
     width*: cint
@@ -246,7 +246,7 @@ type
     position*: TVector2f
     color*: TColor
     texCoords*: TVector2f
-  TPrimitiveType*{.size: sizeof(cint).} = enum 
+  TPrimitiveType*{.size: sizeof(cint).} = enum
     Points,               #/< List of individual points
     Lines,                #/< List of individual lines
     LinesStrip,           #/< List of connected lines, a point uses the previous point to form a line
@@ -381,7 +381,7 @@ proc draw*(window: PRenderWindow, shape: PConvexShape, states: PRenderStates = n
   cdecl, importc: "sfRenderWindow_drawConvexShape", dynlib: LibG.}
 proc draw*(window: PRenderWindow, shape: PVertexArray, states: PRenderStates = nil) {.
   cdecl, importc: "sfRenderWindow_drawVertexArray", dynlib: LibG.}
-proc draw*(window: PRenderWindow, vertices: PVertex, vertexCount: cint, 
+proc draw*(window: PRenderWindow, vertices: PVertex, vertexCount: cint,
            vertexType: TPrimitiveType, states: PRenderStates = nil) {.
   cdecl, importc: "sfRenderWindow_drawPrimitives", dynlib: LibG.}
 
@@ -434,20 +434,20 @@ proc draw*(renderTexture: PRenderTexture; text: PText; states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawText", dynlib: LibG.}
 proc draw*(renderTexture: PRenderTexture; shape: PShape; states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawShape", dynlib: LibG.}
-proc draw*(renderTexture: PRenderTexture; shape: PCircleShape; 
+proc draw*(renderTexture: PRenderTexture; shape: PCircleShape;
             states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawCircleShape", dynlib: LibG.}
-proc draw*(renderTexture: PRenderTexture; shape: PConvexShape; 
+proc draw*(renderTexture: PRenderTexture; shape: PConvexShape;
             states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawConvexShape", dynlib: LibG.}
-proc draw*(renderTexture: PRenderTexture; shape: PRectangleShape; 
+proc draw*(renderTexture: PRenderTexture; shape: PRectangleShape;
             states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawRectangleShape", dynlib: LibG.}
-proc draw*(renderTexture: PRenderTexture; va: PVertexArray; 
+proc draw*(renderTexture: PRenderTexture; va: PVertexArray;
             states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawVertexArray", dynlib: LibG.}
 #Draw primitives defined by an array of vertices to a render texture
-proc draw*(renderTexture: PRenderTexture; vertices: PVertex; vertexCount: cint; 
+proc draw*(renderTexture: PRenderTexture; vertices: PVertex; vertexCount: cint;
             primitiveType: TPrimitiveType; states: PRenderStates){.
   cdecl, importc: "sfRenderTexture_drawPrimitives", dynlib: LibG.}
 #Save the current OpenGL render states and matrices
@@ -500,12 +500,12 @@ proc intRect*(left, top, width, height: cint): TIntRect =
   result.height = height
 proc floatRect*(left, top, width, height: cfloat): TFloatRect =
   result.left   = left
-  result.top    = top 
+  result.top    = top
   result.width  = width
   result.height = height
 proc contains*(rect: PFloatRect, x, y: cfloat): bool {.
   cdecl, importc: "sfFloatRect_contains", dynlib: LibG.}
-proc contains*(rect: PIntRect, x: cint, y: cint): bool{.cdecl, 
+proc contains*(rect: PIntRect, x: cint, y: cint): bool{.cdecl,
   importc: "sfIntRect_contains", dynlib: LibG.}
 proc intersects*(rect1, rect2, intersection: PFloatRect): bool {.
   cdecl, importc: "sfFloatRect_intersects", dynlib: LibG.}
@@ -894,7 +894,7 @@ proc setColor*(text: PText, color: TColor) {.
   cdecl, importc: "sfText_setColor", dynlib: LibG.}
 proc getString*(text: PText): cstring {.
   cdecl, importc: "sfText_getString", dynlib: LibG.}
-proc getUnicodeString*(text: PText): ptr uint32 {.cdecl, 
+proc getUnicodeString*(text: PText): ptr uint32 {.cdecl,
   importc: "sfText_getUnicodeString", dynlib: LibG.}
 proc getFont*(text: PText): PFont {.
   cdecl, importc: "sfText_getFont", dynlib: LibG.}
@@ -985,7 +985,7 @@ proc `*`*(color1, color2: TColor): TColor {.
   cdecl, importc: "sfColor_modulate", dynlib: LibG.}
 proc newColor*(r,g,b: int): TColor {.inline.} =
   return color(r,g,b)
-proc newColor*(r,g,b,a: int): TColor {.inline.} = 
+proc newColor*(r,g,b,a: int): TColor {.inline.} =
   return color(r,g,b,a)
 
 proc newClock*(): PClock {.
@@ -1022,7 +1022,7 @@ proc newContextSettings*(depthBits: cint = 0,
   result.majorVersion = majorVersion
   result.minorVersion = minorVersion
 
-proc newCircleShape*(radius: cfloat; pointCount: cint = 30): PCircleShape = 
+proc newCircleShape*(radius: cfloat; pointCount: cint = 30): PCircleShape =
   result = newCircleShape()
   result.setRadius radius
   result.setPointCount pointCount
@@ -1047,13 +1047,13 @@ proc `[]`*(a: PVertexArray, index: int): PVertex =
 proc `$` *(a: TContextSettings): string =
   return "<TContextSettings stencil=$1 aa=$2 major=$3 minor=$4 depth=$5>" % [
     $a.stencilBits, $a.antialiasingLevel, $a.majorVersion, $a.minorVersion, $a.depthBits]
-proc `$` *(a: TVideoMode): string = 
+proc `$` *(a: TVideoMode): string =
   return "<TVideoMode $1x$2 $3bpp>" % [$a.width, $a.height, $a.bitsPerPixel]
-proc `$` *(a: TFloatRect): string = 
+proc `$` *(a: TFloatRect): string =
   return "<TFloatRect $1,$2 $3x$4>" % [$a.left, $a.top, $a.width, $a.height]
-proc `$` *(a: PView): string = 
+proc `$` *(a: PView): string =
   return $a.getViewport()
-proc `$` *(a: TVector2f): string = 
+proc `$` *(a: TVector2f): string =
   return "<TVector2f $1,$2>" % [$a.x, $a.y]
 
 proc vec2i*(x, y: int): TVector2i =
diff --git a/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim b/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim
index 5aa017ac4..6f81e50a3 100644
--- a/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim
+++ b/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim
@@ -294,7 +294,7 @@ proc newSoundBuffer*(stream: PInputStream): PSoundBuffer{.
 #/ \return A new sfSoundBuffer object (NULL if failed)
 #/
 #//////////////////////////////////////////////////////////
-proc createFromSamples*(samples: ptr int16; sampleCount: cuint; 
+proc createFromSamples*(samples: ptr int16; sampleCount: cuint;
                          channelCount: cuint; sampleRate: cuint): PSoundBuffer{.
   cdecl, importc: "sfSoundBuffer_createFromSamples", dynlib: Lib.}
 #//////////////////////////////////////////////////////////
@@ -437,10 +437,10 @@ proc listenerSetDirection*(orientation: TVector3f){.
 proc listenerGetDirection*(): TVector3f{.
   cdecl, importc: "sfListener_getDirection", dynlib: Lib.}
 
-type 
+type
   TSoundRecorderStartCallback* = proc (a2: pointer): bool {.cdecl.}
-  #/< Type of the callback used when starting a capture 
-  TSoundRecorderProcessCallback* = proc(a2: ptr int16; a3: cuint; 
+  #/< Type of the callback used when starting a capture
+  TSoundRecorderProcessCallback* = proc(a2: ptr int16; a3: cuint;
     a4: pointer): bool {.cdecl.}
   #/< Type of the callback used to process audio data
   TSoundRecorderStopCallback* = proc (a2: pointer){.cdecl.}
@@ -456,9 +456,9 @@ type
 #/ \return A new sfSoundRecorder object (NULL if failed)
 #/
 #//////////////////////////////////////////////////////////
-proc newSoundRecorder*(onStart: TSoundRecorderStartCallback; 
-                        onProcess: TSoundRecorderProcessCallback; 
-                        onStop: TSoundRecorderStopCallback; 
+proc newSoundRecorder*(onStart: TSoundRecorderStartCallback;
+                        onProcess: TSoundRecorderProcessCallback;
+                        onStop: TSoundRecorderStopCallback;
                         userData: pointer = nil): PSoundRecorder{.
   cdecl, importc: "sfSoundRecorder_create", dynlib: Lib.}
 #//////////////////////////////////////////////////////////
@@ -595,13 +595,13 @@ proc getBuffer*(soundBufferRecorder: PSoundBufferRecorder): PSoundBuffer{.
 #/ \brief defines the data to fill by the OnGetData callback
 #/
 #//////////////////////////////////////////////////////////
-type 
+type
   PSoundStreamChunk* = ptr TSoundStreamChunk
-  TSoundStreamChunk*{.pure, final.} = object 
+  TSoundStreamChunk*{.pure, final.} = object
     samples*: ptr int16   #/< Pointer to the audio samples
     sampleCount*: cuint     #/< Number of samples pointed by Samples
-  
-  TSoundStreamGetDataCallback* = proc (a2: PSoundStreamChunk; 
+
+  TSoundStreamGetDataCallback* = proc (a2: PSoundStreamChunk;
       a3: pointer): bool{.cdecl.}
   #/< Type of the callback used to get a sound stream data
   TSoundStreamSeekCallback* = proc (a2: TTime; a3: pointer){.cdecl.}
@@ -618,7 +618,7 @@ type
 #/ \return A new sfSoundStream object
 #/
 #//////////////////////////////////////////////////////////
-proc create*(onGetData: TSoundStreamGetDataCallback; onSeek: TSoundStreamSeekCallback; 
+proc create*(onGetData: TSoundStreamGetDataCallback; onSeek: TSoundStreamSeekCallback;
               channelCount: cuint; sampleRate: cuint; userData: pointer): PSoundStream{.
   cdecl, importc: "sfSoundStream_create", dynlib: Lib.}
 #//////////////////////////////////////////////////////////
diff --git a/tests/manyloc/keineschweine/dependencies/sfml/sfml_colors.nim b/tests/manyloc/keineschweine/dependencies/sfml/sfml_colors.nim
index 31473b17a..95a760e1f 100644
--- a/tests/manyloc/keineschweine/dependencies/sfml/sfml_colors.nim
+++ b/tests/manyloc/keineschweine/dependencies/sfml/sfml_colors.nim
@@ -12,4 +12,4 @@ let
   Transparent*: TColor = color(0, 0, 0, 0)
   Gray* = color(84, 84, 84)
   RoyalBlue* = color(65, 105, 225)
-##todo: define more colors lul
\ No newline at end of file
+##todo: define more colors lul
diff --git a/tests/manyloc/keineschweine/enet_server/enet_client.nim b/tests/manyloc/keineschweine/enet_server/enet_client.nim
index 5ebbdb88b..ac600c0af 100644
--- a/tests/manyloc/keineschweine/enet_server/enet_client.nim
+++ b/tests/manyloc/keineschweine/enet_server/enet_client.nim
@@ -78,11 +78,11 @@ proc poll(serv: PServer; timeout: cuint = 30) =
       case event.kind
       of EvtReceive:
         var buf = newBuffer(event.packet)
-        
+
         serv.handlePackets(buf)
-        
+
         event.packet.destroy()
-      of EvtDisconnect:        
+      of EvtDisconnect:
         dispMessage "Disconnected"
         serv.connected = false
         event.peer.data = nil
@@ -111,8 +111,8 @@ proc tryConnect*(b: PButton) =
   if not dirServer.connected:
     var error: string
     if not dirServer.connect(
-            clientSettings.dirServer.host, 
-            clientSettings.dirServer.port, 
+            clientSettings.dirServer.host,
+            clientSettings.dirServer.port,
             error):
       dispError(error)
   else:
@@ -143,16 +143,16 @@ proc lobbyInit*() =
   clientSettings.website = s["website"].str
   zonelist.setPosition(vec2f(200.0, 100.0))
   connectionButtons = @[]
-  
+
   var pos = vec2f(10, 10)
   u_alias = gui.newTextEntry(
-    if s.hasKey("alias"): s["alias"].str else: "alias", 
+    if s.hasKey("alias"): s["alias"].str else: "alias",
     pos)
   pos.y += 20
   u_passwd = gui.newTextEntry("buzz", pos)
   pos.y += 20
   connectionButtons.add(gui.newButton(
-    text = "Login", 
+    text = "Login",
     position = pos,
     onClick = tryLogin,
     startEnabled = false))
@@ -171,16 +171,16 @@ proc lobbyInit*() =
   connectionButtons.add(gui.newButton(
     text = "Test Chat",
     position = pos,
-    onClick = (proc(b: PButton) = 
+    onClick = (proc(b: PButton) =
       var pkt = newCsChat(text = "ohai")
       dirServer.send HChat, pkt),
     startEnabled = false))
   pos.y += 20
-  downloadProgress.setPosition(pos) 
+  downloadProgress.setPosition(pos)
   downloadProgress.bg.setFillColor(color(34, 139, 34))
   downloadProgress.bg.setSize(vec2f(0, 0))
   gui.add(downloadProgress)
-  
+
   playBtn = gui.newButton(
     text = "Play",
     position = vec2f(680.0, 8.0),
@@ -193,20 +193,20 @@ proc lobbyInit*() =
   discard """gui.newButton(text = "Scrollback + 1", position = vec2f(185, 10), onClick = proc(b: PButton) =
     messageArea.scrollBack += 1
     update(messageArea))
-  gui.newButton(text = "Scrollback - 1", position = vec2f(185+160, 10), onClick = proc(b: PButton) = 
+  gui.newButton(text = "Scrollback - 1", position = vec2f(185+160, 10), onClick = proc(b: PButton) =
     messageArea.scrollBack -= 1
     update(messageArea))
   gui.newButton(text = "Flood msg area", position = vec2f(185, 30), onClick = proc(b: PButton) =
-    for i in 0.. <30: 
+    for i in 0.. <30:
       dispMessage($i))"""
-  dirServer = newServer() 
+  dirServer = newServer()
   dirServer.addHandler HChat, handleChat
   dirServer.addHandler HLogin, handlePlayerLogin
   dirServer.addHandler HFileTransfer, client_helpers.handleFilePartRecv
   dirServer.addHandler HChallengeResult, client_helpers.handleFileChallengeResult
   dirServer.addHandler HFileChallenge, client_helpers.handleFileChallenge
 
-proc lobbyReady*() = 
+proc lobbyReady*() =
   kc.setActive()
   gui.setActive(u_alias)
 
diff --git a/tests/manyloc/keineschweine/enet_server/enet_server.nim b/tests/manyloc/keineschweine/enet_server/enet_server.nim
index c2e893273..eae7c034e 100644
--- a/tests/manyloc/keineschweine/enet_server/enet_server.nim
+++ b/tests/manyloc/keineschweine/enet_server/enet_server.nim
@@ -1,4 +1,4 @@
-import enet, strutils, idgen, tables, math_helpers, 
+import enet, strutils, idgen, tables, math_helpers,
   estreams, sg_packets, server_utils, sg_assets, client_helpers
 when appType == "gui":
   import sfml, sfml_colors, sg_gui,
@@ -14,7 +14,7 @@ var
   event: enet.TEvent
   clientID = newIDGen[int32]()
   clients = initTable[int32, PClient](64)
-  handlers = initTable[char, TCallback](32) 
+  handlers = initTable[char, TCallback](32)
 
 when appType == "gui":
   var
@@ -67,7 +67,7 @@ proc flushPubChat() =
 
 handlers[HChat] = proc(client: PClient; buffer: PBuffer) =
   var chat = readCsChat(buffer)
-  
+
   if not client.auth:
     client.sendError("You are not logged in.")
     return
@@ -75,7 +75,7 @@ handlers[HChat] = proc(client: PClient; buffer: PBuffer) =
   #  if alias2client.hasKey(chat.target):
   #    alias2client[chat.target].forwardPrivate(client, chat.text)
   #else:
-  
+
   dispmessage("<", client.alias, "> ", chat.text)
   queuePub(client, chat)
 
@@ -104,20 +104,20 @@ handlers[HZoneJoinReq] = proc(client: PClient; buffer: PBuffer) =
 
 when isMainModule:
   import parseopt, matchers, os, json
-  
-  
+
+
   if enetInit() != 0:
     quit "Could not initialize ENet"
-  
+
   var address: enet.TAddress
-  
+
   block:
     var zoneCfgFile = "./server_settings.json"
     for kind, key, val in getOpt():
       case kind
       of cmdShortOption, cmdLongOption:
         case key
-        of "f", "file": 
+        of "f", "file":
           if existsFile(val):
             zoneCfgFile = val
           else:
@@ -127,45 +127,45 @@ when isMainModule:
       else:
         echo("Unknown option: ", key, " ", val)
     var jsonSettings = parseFile(zoneCfgFile)
-    let 
+    let
       port = uint16(jsonSettings["port"].num)
       zoneFile = jsonSettings["settings"].str
       dirServerInfo = jsonSettings["dirserver"]
-    
+
     address.host = EnetHostAny
     address.port = port
-    
+
     var path = getAppDir()/../"data"/zoneFile
     if not existsFile(path):
       echo("Zone settings file does not exist: ../data/", zoneFile)
       echo(path)
       quit(1)
-    
+
     discard """block:
-      var 
+      var
         TestFile: FileChallengePair
         contents = repeat("abcdefghijklmnopqrstuvwxyz", 2)
-      testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32) 
+      testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32)
       testFile.file = checksumStr(contents)
       myAssets.add testFile"""
-    
+
     setCurrentDir getAppDir().parentDir()
     let zonesettings = readFile(path)
-    var 
+    var
       errors: seq[string] = @[]
     if not loadSettings(zoneSettings, errors):
       echo("You have errors in your zone settings:")
       for e in errors: echo("**", e)
       quit(1)
     errors.setLen 0
-    
+
     var pair: FileChallengePair
     pair.challenge.file = zoneFile
     pair.challenge.assetType = FZoneCfg
     pair.challenge.fullLen = zoneSettings.len.int32
     pair.file = checksumStr(zoneSettings)
     myAssets.add pair
-    
+
     allAssets:
       if not load(asset):
         echo "Invalid or missing file ", file
@@ -177,11 +177,11 @@ when isMainModule:
           expandPath(assetType, file)).int32
         pair.file = asset.contents
         myAssets.add pair
-    
+
     echo "Zone has ", myAssets.len, " associated assets"
-    
+
     dirServer = newServer()
-    
+
     dirServer.addHandler HDsMsg, proc(serv: PServer; buffer: PBuffer) =
       var m = readDsMsg(buffer)
       dispMessage("<DirServer> ", m.msg)
@@ -189,20 +189,20 @@ when isMainModule:
       let loggedIn = readDsZoneLogin(buffer).status
       if loggedIn:
         #dirServerConnected = true
-    
+
     if dirServerInfo.kind == JArray:
       var error: string
       if not dirServer.connect(dirServerInfo[0].str, dirServerInfo[1].num.int16, error):
         dispError("<DirServer> "&error)
-    
-  
+
+
   server = enet.createHost(address, 32, 2,  0,  0)
   if server == nil:
     quit "Could not create the server!"
-  
+
   dispMessage("Listening on port ", address.port)
-  
-  var 
+
+  var
     serverRunning = true
   when appType == "gui":
     var frameRate = newClock()
@@ -210,11 +210,11 @@ when isMainModule:
   else:
     var frameRate = epochTime()
     var pubChatDelay = frameRate
-  
+
   while serverRunning:
     when appType == "gui":
       let dt = frameRate.restart.asMilliseconds().float / 1000.0
-      
+
       for event in window.filterEvents():
         case event.kind
         of sfml.EvtClosed:
@@ -225,7 +225,7 @@ when isMainModule:
     else:
       let dt = epochTime() - frameRate ##is this right? probably not
       frameRate = epochTime()
-    
+
     while server.hostService(event, 10) > 0:
       case event.kind
       of EvtConnect:
@@ -234,27 +234,27 @@ when isMainModule:
 
         event.peer.data = addr client.id
         client.peer = event.peer
-        
+
         dispMessage("New client connected ", client)
-        
+
         var
-          msg = "hello" 
+          msg = "hello"
           resp = createPacket(cstring(msg), msg.len + 1, FlagReliable)
-          
+
         if event.peer.send(0.cuchar, resp) < 0:
           echo "FAILED"
         else:
           echo "Replied"
       of EvtReceive:
-        let client = clients[cast[ptr int32](event.peer.data)[]] 
-        
+        let client = clients[cast[ptr int32](event.peer.data)[]]
+
         var buf = newBuffer(event.packet)
         let k = buf.readChar()
         if handlers.hasKey(k):
           handlers[k](client, buf)
         else:
           dispError("Unknown packet from ", client)
-        
+
         destroy(event.packet)
       of EvtDisconnect:
         var
@@ -267,11 +267,11 @@ when isMainModule:
           dispMessage(clients[id], " disconnected")
           GCUnref(clients[id])
           clients.del id
-        
+
         event.peer.data = nil
       else:
         discard
-    
+
     when appType == "gui":
       fpsText.setString(ff(1.0/dt))
       if pubChatDelay.getElapsedTime.asSeconds > 0.25:
@@ -281,14 +281,14 @@ when isMainModule:
       pubChatDelay -= dt
       if frameRate - pubChatDelay > 0.25:
         flushPubChat()
-    
+
     when appType == "gui":
       window.clear(Black)
       window.draw(GUI)
       window.draw chatbox
       window.draw mousePos
       window.draw fpstext
-      window.display()  
+      window.display()
 
   server.destroy()
-  enetDeinit()
\ No newline at end of file
+  enetDeinit()
diff --git a/tests/manyloc/keineschweine/enet_server/server_utils.nim b/tests/manyloc/keineschweine/enet_server/server_utils.nim
index 8e8141075..1fb8326ed 100644
--- a/tests/manyloc/keineschweine/enet_server/server_utils.nim
+++ b/tests/manyloc/keineschweine/enet_server/server_utils.nim
@@ -6,9 +6,9 @@ type
     auth*: bool
     alias*: string
     peer*: PPeer
-  
+
   FileChallengePair* = tuple[challenge: ScFileChallenge; file: TChecksumFile]
-  PFileChallengeSequence* = ref TFileChallengeSequence 
+  PFileChallengeSequence* = ref TFileChallengeSequence
   TFileChallengeSequence = object
     index: int  #which file is active
     transfer: ScFileTransfer
@@ -73,7 +73,7 @@ proc sendChunk*(challenge: PFileChallengeSequence, client: PClient) =
   let size = min(FileChunkSize, challenge.transfer.fileSize - challenge.transfer.pos)
   challenge.transfer.data.setLen size
   copyMem(
-    addr challenge.transfer.data[0], 
+    addr challenge.transfer.data[0],
     addr challenge.file.file.compressed[challenge.transfer.pos],
     size)
   client.send HFileTransfer, challenge.transfer
@@ -90,7 +90,7 @@ proc startSend*(challenge: PFileChallengeSequence, client: PClient) =
 ## HFileTransfer
 proc handleFilePartAck*(client: PClient; buffer: PBuffer) =
   echo "got filepartack"
-  var 
+  var
     ftrans = readCsFilepartAck(buffer)
     fcSeq = fileChallenges[client.id]
   fcSeq.transfer.pos = ftrans.lastPos
@@ -99,7 +99,7 @@ proc handleFilePartAck*(client: PClient; buffer: PBuffer) =
 ## HFileCHallenge
 proc handleFileChallengeResp*(client: PClient; buffer: PBuffer) =
   echo "got file challenge resp"
-  var 
+  var
     fcResp = readCsFileChallenge(buffer)
     fcSeq = fileChallenges[client.id]
   let index = $(fcSeq.index + 1) / $(myAssets.len)
diff --git a/tests/manyloc/keineschweine/keineschweine.nim b/tests/manyloc/keineschweine/keineschweine.nim
index 525d8a054..49c0a2476 100644
--- a/tests/manyloc/keineschweine/keineschweine.nim
+++ b/tests/manyloc/keineschweine/keineschweine.nim
@@ -1,4 +1,4 @@
-import 
+import
   os, math, strutils, gl, tables,
   sfml, sfml_audio, sfml_colors, chipmunk, math_helpers,
   input_helpers, animations, game_objects, sfml_stuff, map_filter,
@@ -29,7 +29,7 @@ type
       angle*:    float
   PItem* = ref object
     record: PItemRecord
-    cooldown: float 
+    cooldown: float
   PLiveBullet* = ref TLiveBullet ##represents a live bullet in the arena
   TLiveBullet* = object
     lifetime*: float
@@ -80,7 +80,7 @@ var
   delObjects: seq[int] = @[]
   showShipSelect = false
   myPosition: array[0..1, TVector3f] ##for audio positioning
-let 
+let
   nameTagOffset = vec2f(0.0, 1.0)
 when defined(escapeMenuTest):
   import browsers
@@ -100,10 +100,10 @@ when defined(escapeMenuTest):
 when defined(foo):
   var mouseSprite: sfml.PCircleShape
 when defined(recordMode):
-  var 
+  var
     snapshots: seq[PImage] = @[]
     isRecording = false
-  proc startRecording() = 
+  proc startRecording() =
     if snapshots.len > 100: return
     echo "Started recording"
     isRecording = true
@@ -142,26 +142,26 @@ proc mouseToSpace*(): TVector =
 
 proc explode*(b: PLiveBullet)
 ## TCollisionBeginFunc
-proc collisionBulletPlayer(arb: PArbiter; space: PSpace; 
+proc collisionBulletPlayer(arb: PArbiter; space: PSpace;
                             data: pointer): bool{.cdecl.} =
-  var 
+  var
     bullet = cast[PLiveBullet](arb.a.data)
     target = cast[PVehicle](arb.b.data)
   if target.occupant.isNil or target.occupant == bullet.fromPlayer: return
   bullet.explode()
 
 proc angularDampingSim(body: PBody, gravity: TVector, damping, dt: CpFloat){.cdecl.} =
-  body.w -= (body.w * 0.98 * dt) 
+  body.w -= (body.w * 0.98 * dt)
   body.UpdateVelocity(gravity, damping, dt)
 
 proc initLevel() =
   loadAllAssets()
-  
+
   if not space.isNil: space.destroy()
   space = newSpace()
   space.addCollisionHandler CTBullet, CTVehicle, collisionBulletPlayer,
     nil, nil, nil, nil
-  
+
   let levelSettings = getLevelSettings()
   levelArea.width = levelSettings.size.x
   levelArea.height= levelSettings.size.y
@@ -171,8 +171,8 @@ proc initLevel() =
   for i in 0..3:
     var seg = space.addShape(
       newSegmentShape(
-        space.staticBody, 
-        borderSeq[i], 
+        space.staticBody,
+        borderSeq[i],
         borderSeq[(i + 1) mod 4],
         8.0))
     seg.setElasticity 0.96
@@ -188,8 +188,8 @@ proc initLevel() =
   for veh in playableVehicles():
     shipSelect.newButton(
       veh.name,
-      position = pos, 
-      onClick = proc(b: PButton) = 
+      position = pos,
+      onClick = proc(b: PButton) =
         echo "-__-")
     pos.y += 18.0
 
@@ -199,7 +199,7 @@ proc newItem*(record: PItemRecord): PItem =
   result.record = record
 proc newItem*(name: string): PItem {.inline.} =
   return newItem(fetchItm(name))
-proc canUse*(itm: PItem): bool = 
+proc canUse*(itm: PItem): bool =
   if itm.cooldown > 0.0: return
   return true
 proc update*(itm: PItem; dt: float) =
@@ -252,7 +252,7 @@ proc newBullet*(record: PBulletRecord; fromPlayer: PPlayer): PLiveBullet =
     result.shape.setLayers(LEnemyFire)
   result.shape.setCollisionType CTBullet
   result.shape.setUserData(cast[ptr TLiveBullet](result))
-  let 
+  let
     fireAngle = fromPlayer.vehicle.body.getAngle()
     fireAngleV = vectorForAngle(fireAngle)
   result.body.setAngle fireAngle
@@ -341,14 +341,14 @@ proc update*(obj: PPlayer) =
     obj.nameTag.setPosition(obj.vehicle.body.getPos.floor + (nameTagOffset * (obj.vehicle.record.physics.radius + 5).cfloat))
 
 proc draw(window: PRenderWindow, player: PPlayer) {.inline.} =
-  if not player.spectator: 
+  if not player.spectator:
     if player.vehicle != nil:
       window.draw(player.vehicle.sprite)
     window.draw(player.nameTag)
 
-proc setVehicle(p: PPlayer; v: PVehicle) = 
+proc setVehicle(p: PPlayer; v: PVehicle) =
   p.vehicle = v  #sorry mom, this is just how things worked out ;(
-  if not v.isNil: 
+  if not v.isNil:
     v.occupant = p
 
 proc createBot() =
@@ -369,7 +369,7 @@ var inputCursor = newVertexArray(sfml.Lines, 2)
 inputCursor[0].position = vec2f(10.0, 10.0)
 inputCursor[1].position = vec2f(50.0, 90.0)
 
-proc hasVehicle(p: PPlayer): bool {.inline.} = 
+proc hasVehicle(p: PPlayer): bool {.inline.} =
   result = not p.spectator and not p.vehicle.isNil
 
 proc setMyVehicle(v: PVehicle) {.inline.} =
@@ -396,27 +396,27 @@ proc spec() =
   localPlayer.spectator = true
   specInputClient.setActive
 
-var 
+var
   specLimiter = newClock()
   timeBetweenSpeccing = 1.0 #seconds
 proc toggleSpec() {.inline.} =
   if specLimiter.getElapsedTime.asSeconds < timeBetweenSpeccing:
     return
   specLimiter.restart()
-  if localPlayer.isNil: 
+  if localPlayer.isNil:
     echo("OMG WTF PLAYER IS NILL!!")
   elif localPlayer.spectator: unspec()
   else: spec()
 
 proc addObject*(name: string) =
   var o = newObject(name)
-  if not o.isNil: 
+  if not o.isNil:
     echo "Adding object ", o
     discard space.addBody(o.body)
     discard space.addShape(o.shape)
     o.shape.setLayers(LGrabbable)
     objects.add(o)
-proc explode(obj: PGameObject) = 
+proc explode(obj: PGameObject) =
   echo obj, " exploded"
   let ind = objects.find(obj)
   if ind != -1:
@@ -428,7 +428,7 @@ proc update(obj: PGameObject; dt: float) =
     obj.anim.setPos(obj.body.getPos)
     obj.anim.setAngle(obj.body.getAngle)
 
-proc toggleShipSelect() = 
+proc toggleShipSelect() =
   showShipSelect = not showShipSelect
 proc handleLClick() =
   let pos = input_helpers.getMousePos()
@@ -459,9 +459,9 @@ when defined(recordMode):
         snapshots[i].destroy()
       snapshots.setLen 0)
 when defined(DebugKeys):
-  ingameClient.registerHandler MouseRight, down, proc() = 
+  ingameClient.registerHandler MouseRight, down, proc() =
     echo($activevehicle.body.getAngle.vectorForAngle())
-  ingameClient.registerHandler KeyBackslash, down, proc() = 
+  ingameClient.registerHandler KeyBackslash, down, proc() =
     createBot()
   ingameClient.registerHandler(KeyNum1, down, proc() =
     if localPlayer.items.len == 0:
@@ -493,7 +493,7 @@ when defined(DebugKeys):
     for i, o in pairs(objects):
       echo i, " ", o)
   ingameClient.registerHandler(KeyLBracket, down, sound_buffer.report)
-  var 
+  var
     mouseJoint: PConstraint
     mouseBody = space.addBody(newBody(CpInfinity, CpInfinity))
   ingameClient.registerHandler(MouseMiddle, down, proc() =
@@ -503,7 +503,7 @@ when defined(DebugKeys):
       space.removeConstraint mouseJoint
       mouseJoint.destroy()
       mouseJoint = nil
-    if shape.isNil: 
+    if shape.isNil:
       return
     let body = shape.getBody()
     mouseJoint = space.addConstraint(
@@ -564,42 +564,42 @@ proc mainUpdate(dt: float) =
     if keyPressed(KeyD):
       localPlayer.useItem 6
     worldView.setCenter(activeVehicle.body.getPos.floor)#cp2sfml)
-  
-  if localPlayer != nil: 
+
+  if localPlayer != nil:
     localPlayer.update()
     localPlayer.updateItems(dt)
   for b in localBots:
     b.update()
-  
+
   for o in items(objects):
     o.update(dt)
   for i in countdown(high(delObjects), 0):
     objects.del i
   delObjects.setLen 0
-  
+
   var i = 0
   while i < len(liveBullets):
     if liveBullets[i].update(dt):
       liveBullets.del i
-    else: 
+    else:
       inc i
   i = 0
   while i < len(explosions):
     if explosions[i].next(dt): inc i
     else: explosions.del i
-  
+
   when defined(DebugKeys):
     mouseBody.setPos(mouseToSpace())
-  
+
   space.step(dt)
   space.eachBody(resetForcesCB, nil)
-  
+
   when defined(foo):
     var coords = window.convertCoords(vec2i(getMousePos()), worldView)
     mouseSprite.setPosition(coords)
-  
+
   if localPlayer != nil and localPlayer.vehicle != nil:
-    let 
+    let
       pos = localPlayer.vehicle.body.getPos()
       ang = localPlayer.vehicle.body.getAngle.vectorForAngle()
     myPosition[0].x = pos.x
@@ -608,7 +608,7 @@ proc mainUpdate(dt: float) =
     myPosition[1].z = ang.y
     listenerSetPosition(myPosition[0])
     listenerSetDirection(myPosition[1])
-  
+
   inc frameCount
   when defined(showFPS):
     if frameCount mod 60 == 0:
@@ -620,25 +620,25 @@ proc mainUpdate(dt: float) =
 proc mainRender() =
   window.clear(Black)
   window.setView(worldView)
-  
+
   if showStars:
     for star in stars:
       window.draw(star.sprite)
   window.draw(localPlayer)
-  
+
   for b in localBots:
     window.draw(b)
   for o in objects:
     window.draw(o)
-  
+
   for b in explosions: window.draw(b)
   for b in liveBullets: window.draw(b)
-  
+
   when defined(Foo):
     window.draw(mouseSprite)
-  
+
   window.setView(guiView)
-  
+
   when defined(EscapeMenuTest):
     if escMenuOpen:
       window.draw escMenu
@@ -646,12 +646,12 @@ proc mainRender() =
     window.draw(fpsText)
   when defined(recordMode):
     window.draw(recordButton)
-  
+
   if localPlayer.spectator:
     window.draw(specGui)
   if showShipSelect: window.draw shipSelect
   window.display()
-  
+
   when defined(recordMode):
     if isRecording:
       if snapshots.len < 100:
@@ -664,30 +664,30 @@ proc readyMainState() =
 
 when isMainModule:
   import parseopt
-  
+
   localPlayer = newPlayer()
   lobbyInit()
-  
+
   videoMode = getClientSettings().resolution
   window = newRenderWindow(videoMode, "sup", sfDefaultStyle)
   window.setFrameRateLimit 60
-  
+
   worldView = window.getView.copy()
   guiView = worldView.copy()
   shipSelect.setPosition vec2f(665.0, 50.0)
-  
+
   when defined(foo):
     mouseSprite = sfml.newCircleShape(14)
     mouseSprite.setFillColor Transparent
     mouseSprite.setOutlineColor RoyalBlue
     mouseSprite.setOutlineThickness 1.4
     mouseSprite.setOrigin vec2f(14, 14)
-  
+
   lobbyReady()
   playBtn = specGui.newButton(
     "Unspec - F12", position = vec2f(680.0, 8.0), onClick = proc(b: PButton) =
       toggleSpec())
-  
+
   block:
     var bPlayOffline = false
     for kind, key, val in getOpt():
@@ -698,7 +698,7 @@ when isMainModule:
         echo "Invalid argument ", key, " ", val
     if bPlayOffline:
       playoffline(nil)
-  
+
   gameRunning = true
   while gameRunning:
     for event in window.filterEvents:
diff --git a/tests/manyloc/keineschweine/lib/client_helpers.nim b/tests/manyloc/keineschweine/lib/client_helpers.nim
index 84e42b62e..f2833fe14 100644
--- a/tests/manyloc/keineschweine/lib/client_helpers.nim
+++ b/tests/manyloc/keineschweine/lib/client_helpers.nim
@@ -1,4 +1,4 @@
-import  
+import
   tables, sg_packets, enet, estreams, sg_gui, sfml,
   zlib_helpers, md5, sg_assets, os
 type
@@ -17,7 +17,7 @@ type
     pos: int32
     data: string
     readyToSave: bool
-var 
+var
   currentFileTransfer: TFileTransfer
   downloadProgress* = newButton(nil, "", vec2f(0,0), nil)
 currentFileTransfer.data = ""
@@ -73,7 +73,7 @@ proc handleFilePartRecv*(serv: PServer; buffer: PBuffer) {.procvar.} =
   var
     f = readScFileTransfer(buffer)
   updateFileProgress()
-  if not(f.pos == currentFileTransfer.pos): 
+  if not(f.pos == currentFileTransfer.pos):
     echo "returning early from filepartrecv"
     return ##issues, probably
   if currentFileTransfer.data.len == 0:
@@ -100,7 +100,7 @@ proc handleFilePartRecv*(serv: PServer; buffer: PBuffer) {.procvar.} =
 
 proc saveCurrentFile() =
   if not currentFileTransfer.readyToSave: return
-  let 
+  let
     path = expandPath(currentFileTransfer.assetType, currentFileTransfer.fileName)
     parent = parentDir(path)
   if not existsDir(parent):
@@ -123,7 +123,7 @@ proc handleFileChallengeResult*(serv: PServer; buffer: PBuffer) {.procvar.} =
 
 ## HFileCHallenge
 proc handleFileChallenge*(serv: PServer; buffer: PBuffer) {.procvar.} =
-  var 
+  var
     challenge = readScFileChallenge(buffer)
     path = expandPath(challenge)
     resp: CsFileChallenge
diff --git a/tests/manyloc/keineschweine/lib/estreams.nim b/tests/manyloc/keineschweine/lib/estreams.nim
index ecafaed89..bdf9b2bf0 100644
--- a/tests/manyloc/keineschweine/lib/estreams.nim
+++ b/tests/manyloc/keineschweine/lib/estreams.nim
@@ -1,6 +1,6 @@
 import endians
 
-proc swapEndian16*(outp, inp: pointer) = 
+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)
@@ -113,10 +113,10 @@ when isMainModule:
   echo(repr(b))
   b.pos = 0
   echo(repr(b.readStr()))
-  
+
   b.flush()
   echo "flushed"
   b.writeC([1,2,3])
   echo(repr(b))
-  
-  
+
+
diff --git a/tests/manyloc/keineschweine/lib/gl.nim b/tests/manyloc/keineschweine/lib/gl.nim
index c577f3404..b634a96cf 100644
--- a/tests/manyloc/keineschweine/lib/gl.nim
+++ b/tests/manyloc/keineschweine/lib/gl.nim
@@ -5,24 +5,24 @@
 #  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              
+# Converted to Delphi by Tom Nuydens (tom@delphi3d.net)
+# For the latest updates, visit Delphi3D: http://www.delphi3d.net
 #******************************************************************************
 
-when defined(windows): 
+when defined(windows):
   {.push, callconv: stdcall.}
-else: 
+else:
   {.push, callconv: cdecl.}
-when defined(windows): 
-  const 
+when defined(windows):
+  const
     dllname* = "opengl32.dll"
-elif defined(macosx): 
-  const 
+elif defined(macosx):
+  const
     dllname* = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
-else: 
-  const 
+else:
+  const
     dllname* = "libGL.so.1"
-type 
+type
   PGLenum* = ptr TGLenum
   PGLboolean* = ptr TGLboolean
   PGLbitfield* = ptr TGLbitfield
@@ -983,128 +983,128 @@ const                         # Version
   GL_TEXTURE_COMPONENTS* = GL_TEXTURE_INTERNAL_FORMAT
 
 proc glAccum*(op: TGLenum, value: TGLfloat){.dynlib: dllname, importc: "glAccum".}
-proc glAlphaFunc*(fun: TGLenum, theref: TGLclampf){.dynlib: dllname, 
+proc glAlphaFunc*(fun: TGLenum, theref: TGLclampf){.dynlib: dllname,
     importc: "glAlphaFunc".}
-proc glAreTexturesResident*(n: TGLsizei, textures: PGLuint, 
+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, 
+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, 
+proc glBitmap*(width, height: TGLsizei, xorig, yorig: TGLfloat,
+               xmove, ymove: TGLfloat, bitmap: PGLubyte){.dynlib: dllname,
     importc: "glBitmap".}
-proc glBlendFunc*(sfactor, dfactor: TGLenum){.dynlib: dllname, 
+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, 
+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, 
+proc glClearAccum*(red, green, blue, alpha: TGLfloat){.dynlib: dllname,
     importc: "glClearAccum".}
-proc glClearColor*(red, green, blue, alpha: TGLclampf){.dynlib: dllname, 
+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, 
+proc glClipPlane*(plane: TGLenum, equation: PGLdouble){.dynlib: dllname,
     importc: "glClipPlane".}
-proc glColor3b*(red, green, blue: TGlbyte){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glColorMask*(red, green, blue, alpha: TGLboolean){.dynlib: dllname,
     importc: "glColorMask".}
-proc glColorMaterial*(face, mode: TGLenum){.dynlib: dllname, 
+proc glColorMaterial*(face, mode: TGLenum){.dynlib: dllname,
     importc: "glColorMaterial".}
-proc glColorPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, 
-                     p: pointer){.dynlib: dllname, 
+proc glColorPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei,
+                     p: 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, 
+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, 
+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, 
+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, 
+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, 
+proc glDeleteLists*(list: TGLuint, range: TGLsizei){.dynlib: dllname,
     importc: "glDeleteLists".}
-proc glDeleteTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, 
+proc glDeleteTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname,
     importc: "glDeleteTextures".}
 proc glDepthFunc*(fun: TGLenum){.dynlib: dllname, importc: "glDepthFunc".}
 proc glDepthMask*(flag: TGLboolean){.dynlib: dllname, importc: "glDepthMask".}
-proc glDepthRange*(zNear, zFar: TGLclampd){.dynlib: dllname, 
+proc glDepthRange*(zNear, zFar: TGLclampd){.dynlib: dllname,
     importc: "glDepthRange".}
 proc glDisable*(cap: TGLenum){.dynlib: dllname, importc: "glDisable".}
-proc glDisableClientState*(aarray: TGLenum){.dynlib: dllname, 
+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, 
+proc glDrawElements*(mode: TGLenum, count: TGLsizei, atype: TGLenum,
+                     indices: pointer){.dynlib: dllname,
                                         importc: "glDrawElements".}
-proc glDrawPixels*(width, height: TGLsizei, format, atype: TGLenum, 
+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, p: pointer){.dynlib: dllname, 
+proc glEdgeFlagPointer*(stride: TGLsizei, p: 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, 
+proc glEnableClientState*(aarray: TGLenum){.dynlib: dllname,
     importc: "glEnableClientState".}
 proc glEnd*(){.dynlib: dllname, importc: "glEnd".}
 proc glEndList*(){.dynlib: dllname, importc: "glEndList".}
@@ -1116,9 +1116,9 @@ 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, 
+proc glEvalMesh1*(mode: TGLenum, i1, i2: TGLint){.dynlib: dllname,
     importc: "glEvalMesh1".}
-proc glEvalMesh2*(mode: TGLenum, i1, i2, j1, j2: TGLint){.dynlib: dllname, 
+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".}
@@ -1126,75 +1126,75 @@ 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, 
+proc glFogf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glFogf".}
-proc glFogfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+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, 
+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, 
+proc glGenLists*(range: TGLsizei): TGLuint{.dynlib: dllname,
     importc: "glGenLists".}
-proc glGenTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, 
+proc glGenTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname,
     importc: "glGenTextures".}
-proc glGetBooleanv*(pname: TGLenum, params: PGLboolean){.dynlib: dllname, 
+proc glGetBooleanv*(pname: TGLenum, params: PGLboolean){.dynlib: dllname,
     importc: "glGetBooleanv".}
-proc glGetClipPlane*(plane: TGLenum, equation: PGLdouble){.dynlib: dllname, 
+proc glGetClipPlane*(plane: TGLenum, equation: PGLdouble){.dynlib: dllname,
     importc: "glGetClipPlane".}
-proc glGetDoublev*(pname: TGLenum, params: PGLdouble){.dynlib: dllname, 
+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, 
+proc glGetFloatv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glGetFloatv".}
-proc glGetIntegerv*(pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glGetIntegerv*(pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glGetIntegerv".}
-proc glGetLightfv*(light, pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glGetLightfv*(light, pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glGetLightfv".}
-proc glGetLightiv*(light, pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glGetLightiv*(light, pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glGetLightiv".}
-proc glGetMapdv*(target, query: TGLenum, v: PGLdouble){.dynlib: dllname, 
+proc glGetMapdv*(target, query: TGLenum, v: PGLdouble){.dynlib: dllname,
     importc: "glGetMapdv".}
-proc glGetMapfv*(target, query: TGLenum, v: PGLfloat){.dynlib: dllname, 
+proc glGetMapfv*(target, query: TGLenum, v: PGLfloat){.dynlib: dllname,
     importc: "glGetMapfv".}
-proc glGetMapiv*(target, query: TGLenum, v: PGLint){.dynlib: dllname, 
+proc glGetMapiv*(target, query: TGLenum, v: PGLint){.dynlib: dllname,
     importc: "glGetMapiv".}
-proc glGetMaterialfv*(face, pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glGetMaterialfv*(face, pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glGetMaterialfv".}
-proc glGetMaterialiv*(face, pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glGetMaterialiv*(face, pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glGetMaterialiv".}
-proc glGetPixelMapfv*(map: TGLenum, values: PGLfloat){.dynlib: dllname, 
+proc glGetPixelMapfv*(map: TGLenum, values: PGLfloat){.dynlib: dllname,
     importc: "glGetPixelMapfv".}
-proc glGetPixelMapuiv*(map: TGLenum, values: PGLuint){.dynlib: dllname, 
+proc glGetPixelMapuiv*(map: TGLenum, values: PGLuint){.dynlib: dllname,
     importc: "glGetPixelMapuiv".}
-proc glGetPixelMapusv*(map: TGLenum, values: PGLushort){.dynlib: dllname, 
+proc glGetPixelMapusv*(map: TGLenum, values: PGLushort){.dynlib: dllname,
     importc: "glGetPixelMapusv".}
-proc glGetPointerv*(pname: TGLenum, params: pointer){.dynlib: dllname, 
+proc glGetPointerv*(pname: TGLenum, params: pointer){.dynlib: dllname,
     importc: "glGetPointerv".}
-proc glGetPolygonStipple*(mask: PGLubyte){.dynlib: dllname, 
+proc glGetPolygonStipple*(mask: PGLubyte){.dynlib: dllname,
     importc: "glGetPolygonStipple".}
-proc glGetString*(name: TGLenum): cstring{.dynlib: dllname, 
+proc glGetString*(name: TGLenum): cstring{.dynlib: dllname,
     importc: "glGetString".}
-proc glGetTexEnvfv*(target, pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glGetTexEnvfv*(target, pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glGetTexEnvfv".}
-proc glGetTexEnviv*(target, pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glGetTexEnviv*(target, pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glGetTexEnviv".}
-proc glGetTexGendv*(coord, pname: TGLenum, params: PGLdouble){.dynlib: dllname, 
+proc glGetTexGendv*(coord, pname: TGLenum, params: PGLdouble){.dynlib: dllname,
     importc: "glGetTexGendv".}
-proc glGetTexGenfv*(coord, pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glGetTexGenfv*(coord, pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glGetTexGenfv".}
-proc glGetTexGeniv*(coord, pname: TGLenum, params: PGLint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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".}
@@ -1217,28 +1217,28 @@ proc glIndexubv*(c: PGLubyte){.dynlib: dllname, importc: "glIndexubv".}
 proc glInitNames*(){.dynlib: dllname, importc: "glInitNames".}
 proc glInterleavedArrays*(format: TGLenum, stride: TGLsizei, p: pointer){.
     dynlib: dllname, importc: "glInterleavedArrays".}
-proc glIsEnabled*(cap: TGLenum): TGLboolean{.dynlib: dllname, 
+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, 
+proc glIsTexture*(texture: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsTexture".}
-proc glLightModelf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glLightModelf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glLightModelf".}
-proc glLightModelfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glLightModelfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glLightModelfv".}
-proc glLightModeli*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glLightModeli*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glLightModeli".}
-proc glLightModeliv*(pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glLightModeliv*(pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glLightModeliv".}
-proc glLightf*(light, pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glLightf*(light, pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glLightf".}
-proc glLightfv*(light, pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glLightfv*(light, pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glLightfv".}
-proc glLighti*(light, pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glLighti*(light, pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glLighti".}
-proc glLightiv*(light, pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glLightiv*(light, pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glLightiv".}
-proc glLineStipple*(factor: TGLint, pattern: TGLushort){.dynlib: dllname, 
+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".}
@@ -1247,36 +1247,36 @@ 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, 
+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, 
+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, 
+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, 
+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, 
+proc glMapGrid1d*(un: TGLint, u1, u2: TGLdouble){.dynlib: dllname,
     importc: "glMapGrid1d".}
-proc glMapGrid1f*(un: TGLint, u1, u2: TGLfloat){.dynlib: dllname, 
+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, 
+proc glMaterialf*(face, pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glMaterialf".}
-proc glMaterialfv*(face, pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glMaterialfv*(face, pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glMaterialfv".}
-proc glMateriali*(face, pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glMateriali*(face, pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glMateriali".}
-proc glMaterialiv*(face, pname: TGLenum, params: PGLint){.dynlib: dllname, 
+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, 
+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".}
@@ -1299,22 +1299,22 @@ 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, 
+proc glPixelStoref*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glPixelStoref".}
-proc glPixelStorei*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glPixelStorei*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glPixelStorei".}
-proc glPixelTransferf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glPixelTransferf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glPixelTransferf".}
-proc glPixelTransferi*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glPixelTransferi*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glPixelTransferi".}
-proc glPixelZoom*(xfactor, yfactor: TGLfloat){.dynlib: dllname, 
+proc glPixelZoom*(xfactor, yfactor: TGLfloat){.dynlib: dllname,
     importc: "glPixelZoom".}
 proc glPointSize*(size: TGLfloat){.dynlib: dllname, importc: "glPointSize".}
-proc glPolygonMode*(face, mode: TGLenum){.dynlib: dllname, 
+proc glPolygonMode*(face, mode: TGLenum){.dynlib: dllname,
     importc: "glPolygonMode".}
-proc glPolygonOffset*(factor, units: TGLfloat){.dynlib: dllname, 
+proc glPolygonOffset*(factor, units: TGLfloat){.dynlib: dllname,
     importc: "glPolygonOffset".}
-proc glPolygonStipple*(mask: PGLubyte){.dynlib: dllname, 
+proc glPolygonStipple*(mask: PGLubyte){.dynlib: dllname,
                                         importc: "glPolygonStipple".}
 proc glPopAttrib*(){.dynlib: dllname, importc: "glPopAttrib".}
 proc glPopClientAttrib*(){.dynlib: dllname, importc: "glPopClientAttrib".}
@@ -1323,7 +1323,7 @@ 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, 
+proc glPushClientAttrib*(mask: TGLbitfield){.dynlib: dllname,
     importc: "glPushClientAttrib".}
 proc glPushMatrix*(){.dynlib: dllname, importc: "glPushMatrix".}
 proc glPushName*(name: TGLuint){.dynlib: dllname, importc: "glPushName".}
@@ -1335,35 +1335,35 @@ 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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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".}
@@ -1371,22 +1371,22 @@ 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, 
+proc glRenderMode*(mode: TGLint): TGLint{.dynlib: dllname,
     importc: "glRenderMode".}
-proc glRotated*(angle, x, y, z: TGLdouble){.dynlib: dllname, 
+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, 
+proc glScissor*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname,
     importc: "glScissor".}
-proc glSelectBuffer*(size: TGLsizei, buffer: PGLuint){.dynlib: dllname, 
+proc glSelectBuffer*(size: TGLsizei, buffer: PGLuint){.dynlib: dllname,
     importc: "glSelectBuffer".}
 proc glShadeModel*(mode: TGLenum){.dynlib: dllname, importc: "glShadeModel".}
 proc glStencilFunc*(fun: 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, 
+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".}
@@ -1412,19 +1412,19 @@ 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, 
+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, 
+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, 
+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, 
-                        p: pointer){.dynlib: dllname, 
+proc glTexCoordPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei,
+                        p: pointer){.dynlib: dllname,
     importc: "glTexCoordPointer".}
 proc glTexEnvf*(target: TGLenum, pname: TGLenum, param: TGLfloat){.
     dynlib: dllname, importc: "glTexEnvf".}
@@ -1442,16 +1442,16 @@ 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, 
+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, 
+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, 
+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".}
@@ -1461,12 +1461,12 @@ 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, 
+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, 
+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".}
@@ -1494,42 +1494,42 @@ 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, 
-                      p: pointer){.dynlib: dllname, 
+proc glVertexPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei,
+                      p: pointer){.dynlib: dllname,
     importc: "glVertexPointer".}
-proc glViewport*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname, 
+proc glViewport*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname,
     importc: "glViewport".}
-type 
+type
   PFN_GLARRAY_ELEMENT_EXTPROC* = proc (i: TGLint)
-  PFN_GLDRAW_ARRAYS_EXTPROC* = proc (mode: TGLenum, first: TGLint, 
+  PFN_GLDRAW_ARRAYS_EXTPROC* = proc (mode: TGLenum, first: TGLint,
                                      count: TGLsizei)
-  PFN_GLVERTEX_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, 
-                                        stride, count: TGLsizei, 
+  PFN_GLVERTEX_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum,
+                                        stride, count: TGLsizei,
                                         p: pointer)
-  PFN_GLNORMAL_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei, 
+  PFN_GLNORMAL_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei,
                                         p: pointer)
-  PFN_GLCOLOR_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, 
+  PFN_GLCOLOR_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum,
                                        stride, count: TGLsizei, p: pointer)
-  PFN_GLINDEX_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei, 
+  PFN_GLINDEX_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei,
                                        p: pointer)
-  PFN_GLTEXCOORD_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, 
+  PFN_GLTEXCOORD_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum,
       stride, count: TGLsizei, p: pointer)
-  PFN_GLEDGEFLAG_POINTER_EXTPROC* = proc (stride, count: TGLsizei, 
+  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, 
+  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, 
+  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, 
+  PFN_GLCOLOR_SUBTABLE_EXTPROC* = proc (target: TGLenum, start, count: TGLsizei,
                                         format, atype: TGLenum, data: pointer)
-  PFN_GLGETCOLOR_TABLE_EXTPROC* = proc (target, format, atype: TGLenum, 
+  PFN_GLGETCOLOR_TABLE_EXTPROC* = proc (target, format, atype: TGLenum,
                                         data: pointer)
-  PFN_GLGETCOLOR_TABLE_PARAMETER_IVEXTPROC* = proc (target, pname: TGLenum, 
+  PFN_GLGETCOLOR_TABLE_PARAMETER_IVEXTPROC* = proc (target, pname: TGLenum,
       params: PGLint)
-  PFN_GLGETCOLOR_TABLE_PARAMETER_FVEXTPROC* = proc (target, pname: TGLenum, 
+  PFN_GLGETCOLOR_TABLE_PARAMETER_FVEXTPROC* = proc (target, pname: TGLenum,
       params: PGLfloat)
 
 {.pop.}
diff --git a/tests/manyloc/keineschweine/lib/glext.nim b/tests/manyloc/keineschweine/lib/glext.nim
index 32871df0e..1e1bdb958 100644
--- a/tests/manyloc/keineschweine/lib/glext.nim
+++ b/tests/manyloc/keineschweine/lib/glext.nim
@@ -13,14 +13,14 @@
 # *************************************************
 #*** Generated on 10/11/2002
 
-when defined(windows): 
+when defined(windows):
   {.push, callconv: stdcall.}
-else: 
+else:
   {.push, callconv: cdecl.}
-import 
+import
   gl
 
-type 
+type
   GLcharARB* = Char
   TGLcharARB* = GLcharARB
   PGLcharARB* = ptr GLcharARB
@@ -37,7 +37,7 @@ type
   TGLchar* = GLchar
   PGLchar* = cstring          #***** GL_version_1_2 *****//
 
-const 
+const
   GL_UNSIGNED_BYTE_3_3_2* = 0x00008032
   GL_UNSIGNED_SHORT_4_4_4_4* = 0x00008033
   GL_UNSIGNED_SHORT_5_5_5_1* = 0x00008034
@@ -79,44 +79,44 @@ const
   GL_TEXTURE_WRAP_R* = 0x00008072
   GL_MAX_3D_TEXTURE_SIZE* = 0x00008073
 
-proc glBlendColor*(red: TGLclampf, green: TGLclampf, blue: TGLclampf, 
+proc glBlendColor*(red: TGLclampf, green: TGLclampf, blue: TGLclampf,
                    alpha: TGLclampf){.dynlib: dllname, importc: "glBlendColor".}
-proc glBlendEquation*(mode: TGLenum){.dynlib: dllname, 
+proc glBlendEquation*(mode: TGLenum){.dynlib: dllname,
                                       importc: "glBlendEquation".}
-proc glDrawRangeElements*(mode: TGLenum, start: TGLuint, theend: TGLuint, 
+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, 
+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, 
+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, 
+proc glGetColorTable*(target: TGLenum, format: TGLenum, thetype: TGLenum,
+                      table: PGLvoid){.dynlib: dllname,
                                        importc: "glGetColorTable".}
-proc glGetColorTableParameterfv*(target: TGLenum, pname: TGLenum, 
-                                 params: PGLfloat){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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".}
@@ -126,170 +126,170 @@ 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, 
+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, 
+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, 
+proc glGetConvolutionFilter*(target: TGLenum, format: TGLenum, thetype: TGLenum,
+                             image: PGLvoid){.dynlib: dllname,
     importc: "glGetConvolutionFilter".}
-proc glGetConvolutionParameterfv*(target: TGLenum, pname: TGLenum, 
-                                  params: PGLfloat){.dynlib: dllname, 
+proc glGetConvolutionParameterfv*(target: TGLenum, pname: TGLenum,
+                                  params: PGLfloat){.dynlib: dllname,
     importc: "glGetConvolutionParameterfv".}
-proc glGetConvolutionParameteriv*(target: TGLenum, pname: TGLenum, 
-                                  params: PGLint){.dynlib: dllname, 
+proc glGetConvolutionParameteriv*(target: TGLenum, pname: TGLenum,
+                                  params: PGLint){.dynlib: dllname,
     importc: "glGetConvolutionParameteriv".}
-proc glGetSeparableFilter*(target: TGLenum, format: TGLenum, thetype: TGLenum, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glActiveTextureARB*(texture: TGLenum){.dynlib: dllname,
     importc: "glActiveTextureARB".}
-proc glClientActiveTextureARB*(texture: TGLenum){.dynlib: dllname, 
+proc glClientActiveTextureARB*(texture: TGLenum){.dynlib: dllname,
     importc: "glClientActiveTextureARB".}
-proc glMultiTexCoord1dARB*(target: TGLenum, s: TGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord1dARB*(target: TGLenum, s: TGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord1dARB".}
-proc glMultiTexCoord1dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord1dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord1dvARB".}
-proc glMultiTexCoord1fARB*(target: TGLenum, s: TGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord1fARB*(target: TGLenum, s: TGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord1fARB".}
-proc glMultiTexCoord1fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord1fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord1fvARB".}
-proc glMultiTexCoord1iARB*(target: TGLenum, s: TGLint){.dynlib: dllname, 
+proc glMultiTexCoord1iARB*(target: TGLenum, s: TGLint){.dynlib: dllname,
     importc: "glMultiTexCoord1iARB".}
-proc glMultiTexCoord1ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname, 
+proc glMultiTexCoord1ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname,
     importc: "glMultiTexCoord1ivARB".}
-proc glMultiTexCoord1sARB*(target: TGLenum, s: TGLshort){.dynlib: dllname, 
+proc glMultiTexCoord1sARB*(target: TGLenum, s: TGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord1sARB".}
-proc glMultiTexCoord1svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+proc glMultiTexCoord2svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord2svARB".}
-proc glMultiTexCoord3dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble, 
-                           r: TGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord3dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble,
+                           r: TGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord3dARB".}
-proc glMultiTexCoord3dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord3dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord3dvARB".}
-proc glMultiTexCoord3fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat, 
-                           r: TGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord3fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat,
+                           r: TGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord3fARB".}
-proc glMultiTexCoord3fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, 
+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, 
+proc glMultiTexCoord3ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname,
     importc: "glMultiTexCoord3ivARB".}
-proc glMultiTexCoord3sARB*(target: TGLenum, s: TGLshort, t: TGLshort, 
-                           r: TGLshort){.dynlib: dllname, 
+proc glMultiTexCoord3sARB*(target: TGLenum, s: TGLshort, t: TGLshort,
+                           r: TGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord3sARB".}
-proc glMultiTexCoord3svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, 
+proc glMultiTexCoord3svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord3svARB".}
-proc glMultiTexCoord4dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble, 
-                           r: TGLdouble, q: TGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord4dARB*(target: TGLenum, s: TGLdouble, t: TGLdouble,
+                           r: TGLdouble, q: TGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord4dARB".}
-proc glMultiTexCoord4dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord4dvARB*(target: TGLenum, v: PGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord4dvARB".}
-proc glMultiTexCoord4fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat, 
-                           r: TGLfloat, q: TGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord4fARB*(target: TGLenum, s: TGLfloat, t: TGLfloat,
+                           r: TGLfloat, q: TGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord4fARB".}
-proc glMultiTexCoord4fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord4fvARB*(target: TGLenum, v: PGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord4fvARB".}
-proc glMultiTexCoord4iARB*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint, 
-                           q: TGLint){.dynlib: dllname, 
+proc glMultiTexCoord4iARB*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint,
+                           q: TGLint){.dynlib: dllname,
                                        importc: "glMultiTexCoord4iARB".}
-proc glMultiTexCoord4ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname, 
+proc glMultiTexCoord4ivARB*(target: TGLenum, v: PGLint){.dynlib: dllname,
     importc: "glMultiTexCoord4ivARB".}
-proc glMultiTexCoord4sARB*(target: TGLenum, s: TGLshort, t: TGLshort, 
-                           r: TGLshort, q: TGLshort){.dynlib: dllname, 
+proc glMultiTexCoord4sARB*(target: TGLenum, s: TGLshort, t: TGLshort,
+                           r: TGLshort, q: TGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord4sARB".}
-proc glMultiTexCoord4svARB*(target: TGLenum, v: PGLshort){.dynlib: dllname, 
+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, 
+proc glWeightbvARB*(size: TGLint, weights: PGLbyte){.dynlib: dllname,
     importc: "glWeightbvARB".}
-proc glWeightsvARB*(size: TGLint, weights: PGLshort){.dynlib: dllname, 
+proc glWeightsvARB*(size: TGLint, weights: PGLshort){.dynlib: dllname,
     importc: "glWeightsvARB".}
-proc glWeightivARB*(size: TGLint, weights: PGLint){.dynlib: dllname, 
+proc glWeightivARB*(size: TGLint, weights: PGLint){.dynlib: dllname,
     importc: "glWeightivARB".}
-proc glWeightfvARB*(size: TGLint, weights: PGLfloat){.dynlib: dllname, 
+proc glWeightfvARB*(size: TGLint, weights: PGLfloat){.dynlib: dllname,
     importc: "glWeightfvARB".}
-proc glWeightdvARB*(size: TGLint, weights: PGLdouble){.dynlib: dllname, 
+proc glWeightdvARB*(size: TGLint, weights: PGLdouble){.dynlib: dllname,
     importc: "glWeightdvARB".}
-proc glWeightvARB*(size: TGLint, weights: PGLdouble){.dynlib: dllname, 
+proc glWeightvARB*(size: TGLint, weights: PGLdouble){.dynlib: dllname,
     importc: "glWeightvARB".}
-proc glWeightubvARB*(size: TGLint, weights: PGLubyte){.dynlib: dllname, 
+proc glWeightubvARB*(size: TGLint, weights: PGLubyte){.dynlib: dllname,
     importc: "glWeightubvARB".}
-proc glWeightusvARB*(size: TGLint, weights: PGLushort){.dynlib: dllname, 
+proc glWeightusvARB*(size: TGLint, weights: PGLushort){.dynlib: dllname,
     importc: "glWeightusvARB".}
-proc glWeightuivARB*(size: TGLint, weights: PGLuint){.dynlib: dllname, 
+proc glWeightuivARB*(size: TGLint, weights: PGLuint){.dynlib: dllname,
     importc: "glWeightuivARB".}
-proc glWeightPointerARB*(size: TGLint, thetype: TGLenum, stride: TGLsizei, 
-                         pointer: PGLvoid){.dynlib: dllname, 
+proc glWeightPointerARB*(size: TGLint, thetype: TGLenum, stride: TGLsizei,
+                         pointer: PGLvoid){.dynlib: dllname,
     importc: "glWeightPointerARB".}
-proc glVertexBlendARB*(count: TGLint){.dynlib: dllname, 
+proc glVertexBlendARB*(count: TGLint){.dynlib: dllname,
                                        importc: "glVertexBlendARB".}
-proc glVertexAttrib1sARB*(index: TGLuint, x: TGLshort){.dynlib: dllname, 
+proc glVertexAttrib1sARB*(index: TGLuint, x: TGLshort){.dynlib: dllname,
     importc: "glVertexAttrib1sARB".}
-proc glVertexAttrib1fARB*(index: TGLuint, x: TGLfloat){.dynlib: dllname, 
+proc glVertexAttrib1fARB*(index: TGLuint, x: TGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib1fARB".}
-proc glVertexAttrib1dARB*(index: TGLuint, x: TGLdouble){.dynlib: dllname, 
+proc glVertexAttrib1dARB*(index: TGLuint, x: TGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib1dARB".}
 proc glVertexAttrib2sARB*(index: TGLuint, x: TGLshort, y: TGLshort){.
     dynlib: dllname, importc: "glVertexAttrib2sARB".}
@@ -301,120 +301,120 @@ 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, 
+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, 
+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, 
+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, 
+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, 
+proc glVertexAttrib4NubARB*(index: TGLuint, x: TGLubyte, y: TGLubyte,
+                            z: TGLubyte, w: TGLubyte){.dynlib: dllname,
     importc: "glVertexAttrib4NubARB".}
-proc glVertexAttrib1svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib1svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib1svARB".}
-proc glVertexAttrib1fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib1fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib1fvARB".}
-proc glVertexAttrib1dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib1dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib1dvARB".}
-proc glVertexAttrib2svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib2svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib2svARB".}
-proc glVertexAttrib2fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib2fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib2fvARB".}
-proc glVertexAttrib2dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib2dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib2dvARB".}
-proc glVertexAttrib3svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib3svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib3svARB".}
-proc glVertexAttrib3fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib3fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib3fvARB".}
-proc glVertexAttrib3dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib3dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib3dvARB".}
-proc glVertexAttrib4bvARB*(index: TGLuint, v: PGLbyte){.dynlib: dllname, 
+proc glVertexAttrib4bvARB*(index: TGLuint, v: PGLbyte){.dynlib: dllname,
     importc: "glVertexAttrib4bvARB".}
-proc glVertexAttrib4svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib4svARB*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib4svARB".}
-proc glVertexAttrib4ivARB*(index: TGLuint, v: PGLint){.dynlib: dllname, 
+proc glVertexAttrib4ivARB*(index: TGLuint, v: PGLint){.dynlib: dllname,
     importc: "glVertexAttrib4ivARB".}
-proc glVertexAttrib4ubvARB*(index: TGLuint, v: PGLubyte){.dynlib: dllname, 
+proc glVertexAttrib4ubvARB*(index: TGLuint, v: PGLubyte){.dynlib: dllname,
     importc: "glVertexAttrib4ubvARB".}
-proc glVertexAttrib4usvARB*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+proc glVertexAttrib4usvARB*(index: TGLuint, v: PGLushort){.dynlib: dllname,
     importc: "glVertexAttrib4usvARB".}
-proc glVertexAttrib4uivARB*(index: TGLuint, v: PGLuint){.dynlib: dllname, 
+proc glVertexAttrib4uivARB*(index: TGLuint, v: PGLuint){.dynlib: dllname,
     importc: "glVertexAttrib4uivARB".}
-proc glVertexAttrib4fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib4fvARB*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib4fvARB".}
-proc glVertexAttrib4dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib4dvARB*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib4dvARB".}
-proc glVertexAttrib4NbvARB*(index: TGLuint, v: PGLbyte){.dynlib: dllname, 
+proc glVertexAttrib4NbvARB*(index: TGLuint, v: PGLbyte){.dynlib: dllname,
     importc: "glVertexAttrib4NbvARB".}
-proc glVertexAttrib4NsvARB*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib4NsvARB*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib4NsvARB".}
-proc glVertexAttrib4NivARB*(index: TGLuint, v: PGLint){.dynlib: dllname, 
+proc glVertexAttrib4NivARB*(index: TGLuint, v: PGLint){.dynlib: dllname,
     importc: "glVertexAttrib4NivARB".}
-proc glVertexAttrib4NubvARB*(index: TGLuint, v: PGLubyte){.dynlib: dllname, 
+proc glVertexAttrib4NubvARB*(index: TGLuint, v: PGLubyte){.dynlib: dllname,
     importc: "glVertexAttrib4NubvARB".}
-proc glVertexAttrib4NusvARB*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+proc glVertexAttrib4NusvARB*(index: TGLuint, v: PGLushort){.dynlib: dllname,
     importc: "glVertexAttrib4NusvARB".}
-proc glVertexAttrib4NuivARB*(index: TGLuint, v: PGLuint){.dynlib: dllname, 
+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, 
+proc glVertexAttribPointerARB*(index: TGLuint, size: TGLint, thetype: TGLenum,
+                               normalized: TGLboolean, stride: TGLsizei,
+                               pointer: PGLvoid){.dynlib: dllname,
     importc: "glVertexAttribPointerARB".}
-proc glEnableVertexAttribArrayARB*(index: TGLuint){.dynlib: dllname, 
+proc glEnableVertexAttribArrayARB*(index: TGLuint){.dynlib: dllname,
     importc: "glEnableVertexAttribArrayARB".}
-proc glDisableVertexAttribArrayARB*(index: TGLuint){.dynlib: dllname, 
+proc glDisableVertexAttribArrayARB*(index: TGLuint){.dynlib: dllname,
     importc: "glDisableVertexAttribArrayARB".}
-proc glProgramStringARB*(target: TGLenum, format: TGLenum, length: TGLsizei, 
-                         str: PGLvoid){.dynlib: dllname, 
+proc glProgramStringARB*(target: TGLenum, format: TGLenum, length: TGLsizei,
+                         str: PGLvoid){.dynlib: dllname,
                                         importc: "glProgramStringARB".}
-proc glBindProgramARB*(target: TGLenum, theProgram: TGLuint){.dynlib: dllname, 
+proc glBindProgramARB*(target: TGLenum, theProgram: TGLuint){.dynlib: dllname,
     importc: "glBindProgramARB".}
-proc glDeleteProgramsARB*(n: TGLsizei, programs: PGLuint){.dynlib: dllname, 
+proc glDeleteProgramsARB*(n: TGLsizei, programs: PGLuint){.dynlib: dllname,
     importc: "glDeleteProgramsARB".}
-proc glGenProgramsARB*(n: TGLsizei, programs: PGLuint){.dynlib: dllname, 
+proc glGenProgramsARB*(n: TGLsizei, programs: PGLuint){.dynlib: dllname,
     importc: "glGenProgramsARB".}
-proc glProgramEnvParameter4dARB*(target: TGLenum, index: TGLuint, x: TGLdouble, 
+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, 
+proc glProgramEnvParameter4dvARB*(target: TGLenum, index: TGLuint,
+                                  params: PGLdouble){.dynlib: dllname,
     importc: "glProgramEnvParameter4dvARB".}
-proc glProgramEnvParameter4fARB*(target: TGLenum, index: TGLuint, x: TGLfloat, 
+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, 
+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, 
+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, 
+proc glProgramLocalParameter4dvARB*(target: TGLenum, index: TGLuint,
+                                    params: PGLdouble){.dynlib: dllname,
     importc: "glProgramLocalParameter4dvARB".}
-proc glProgramLocalParameter4fARB*(target: TGLenum, index: TGLuint, x: TGLfloat, 
+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, 
+proc glProgramLocalParameter4fvARB*(target: TGLenum, index: TGLuint,
+                                    params: PGLfloat){.dynlib: dllname,
     importc: "glProgramLocalParameter4fvARB".}
-proc glGetProgramEnvParameterdvARB*(target: TGLenum, index: TGLuint, 
-                                    params: PGLdouble){.dynlib: dllname, 
+proc glGetProgramEnvParameterdvARB*(target: TGLenum, index: TGLuint,
+                                    params: PGLdouble){.dynlib: dllname,
     importc: "glGetProgramEnvParameterdvARB".}
-proc glGetProgramEnvParameterfvARB*(target: TGLenum, index: TGLuint, 
-                                    params: PGLfloat){.dynlib: dllname, 
+proc glGetProgramEnvParameterfvARB*(target: TGLenum, index: TGLuint,
+                                    params: PGLfloat){.dynlib: dllname,
     importc: "glGetProgramEnvParameterfvARB".}
-proc glGetProgramLocalParameterdvARB*(target: TGLenum, index: TGLuint, 
-                                      params: PGLdouble){.dynlib: dllname, 
+proc glGetProgramLocalParameterdvARB*(target: TGLenum, index: TGLuint,
+                                      params: PGLdouble){.dynlib: dllname,
     importc: "glGetProgramLocalParameterdvARB".}
-proc glGetProgramLocalParameterfvARB*(target: TGLenum, index: TGLuint, 
-                                      params: PGLfloat){.dynlib: dllname, 
+proc glGetProgramLocalParameterfvARB*(target: TGLenum, index: TGLuint,
+                                      params: PGLfloat){.dynlib: dllname,
     importc: "glGetProgramLocalParameterfvARB".}
 proc glGetProgramivARB*(target: TGLenum, pname: TGLenum, params: PGLint){.
     dynlib: dllname, importc: "glGetProgramivARB".}
@@ -426,100 +426,100 @@ 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, 
+proc glGetVertexAttribPointervARB*(index: TGLuint, pname: TGLenum,
+                                   pointer: PGLvoid){.dynlib: dllname,
     importc: "glGetVertexAttribPointervARB".}
-proc glIsProgramARB*(theProgram: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsProgramARB*(theProgram: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsProgramARB".}
   #***** GL_ARB_window_pos *****//
-proc glWindowPos2dARB*(x: TGLdouble, y: TGLdouble){.dynlib: dllname, 
+proc glWindowPos2dARB*(x: TGLdouble, y: TGLdouble){.dynlib: dllname,
     importc: "glWindowPos2dARB".}
-proc glWindowPos2fARB*(x: TGLfloat, y: TGLfloat){.dynlib: dllname, 
+proc glWindowPos2fARB*(x: TGLfloat, y: TGLfloat){.dynlib: dllname,
     importc: "glWindowPos2fARB".}
-proc glWindowPos2iARB*(x: TGLint, y: TGLint){.dynlib: dllname, 
+proc glWindowPos2iARB*(x: TGLint, y: TGLint){.dynlib: dllname,
     importc: "glWindowPos2iARB".}
-proc glWindowPos2sARB*(x: TGLshort, y: TGLshort){.dynlib: dllname, 
+proc glWindowPos2sARB*(x: TGLshort, y: TGLshort){.dynlib: dllname,
     importc: "glWindowPos2sARB".}
-proc glWindowPos2dvARB*(p: PGLdouble){.dynlib: dllname, 
+proc glWindowPos2dvARB*(p: PGLdouble){.dynlib: dllname,
                                        importc: "glWindowPos2dvARB".}
-proc glWindowPos2fvARB*(p: PGLfloat){.dynlib: dllname, 
+proc glWindowPos2fvARB*(p: PGLfloat){.dynlib: dllname,
                                       importc: "glWindowPos2fvARB".}
-proc glWindowPos2ivARB*(p: PGLint){.dynlib: dllname, 
+proc glWindowPos2ivARB*(p: PGLint){.dynlib: dllname,
                                     importc: "glWindowPos2ivARB".}
-proc glWindowPos2svARB*(p: PGLshort){.dynlib: dllname, 
+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, 
+proc glWindowPos3fARB*(x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname,
     importc: "glWindowPos3fARB".}
-proc glWindowPos3iARB*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname, 
+proc glWindowPos3iARB*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname,
     importc: "glWindowPos3iARB".}
-proc glWindowPos3sARB*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname, 
+proc glWindowPos3sARB*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname,
     importc: "glWindowPos3sARB".}
-proc glWindowPos3dvARB*(p: PGLdouble){.dynlib: dllname, 
+proc glWindowPos3dvARB*(p: PGLdouble){.dynlib: dllname,
                                        importc: "glWindowPos3dvARB".}
-proc glWindowPos3fvARB*(p: PGLfloat){.dynlib: dllname, 
+proc glWindowPos3fvARB*(p: PGLfloat){.dynlib: dllname,
                                       importc: "glWindowPos3fvARB".}
-proc glWindowPos3ivARB*(p: PGLint){.dynlib: dllname, 
+proc glWindowPos3ivARB*(p: PGLint){.dynlib: dllname,
                                     importc: "glWindowPos3ivARB".}
-proc glWindowPos3svARB*(p: PGLshort){.dynlib: dllname, 
+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, 
+proc glDrawBuffers*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname,
     importc: "glDrawBuffers".}
-proc glStencilOpSeparate*(face: TGLenum, sfail: TGLenum, dpfail: TGLenum, 
-                          dppass: TGLenum){.dynlib: dllname, 
+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, 
+proc glStencilFuncSeparate*(frontfunc: TGLenum, backfunc: TGLenum,
+                            theRef: TGLint, mask: TGLuint){.dynlib: dllname,
     importc: "glStencilFuncSeparate".}
-proc glStencilMaskSeparate*(face: TGLenum, mask: TGLuint){.dynlib: dllname, 
+proc glStencilMaskSeparate*(face: TGLenum, mask: TGLuint){.dynlib: dllname,
     importc: "glStencilMaskSeparate".}
-proc glAttachShader*(theProgram: TGLuint, shader: TGLuint){.dynlib: dllname, 
+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, 
+proc glCompileShader*(shader: TGLuint){.dynlib: dllname,
                                         importc: "glCompileShader".}
 proc glCreateProgram*(): TGLuint{.dynlib: dllname, importc: "glCreateProgram".}
-proc glCreateShader*(thetype: TGLenum): TGLuint{.dynlib: dllname, 
+proc glCreateShader*(thetype: TGLenum): TGLuint{.dynlib: dllname,
     importc: "glCreateShader".}
-proc glDeleteProgram*(theProgram: TGLuint){.dynlib: dllname, 
+proc glDeleteProgram*(theProgram: TGLuint){.dynlib: dllname,
     importc: "glDeleteProgram".}
-proc glDeleteShader*(shader: TGLuint){.dynlib: dllname, 
+proc glDeleteShader*(shader: TGLuint){.dynlib: dllname,
                                        importc: "glDeleteShader".}
-proc glDetachShader*(theProgram: TGLuint, shader: TGLuint){.dynlib: dllname, 
+proc glDetachShader*(theProgram: TGLuint, shader: TGLuint){.dynlib: dllname,
     importc: "glDetachShader".}
-proc glDisableVertexAttribArray*(index: TGLuint){.dynlib: dllname, 
+proc glDisableVertexAttribArray*(index: TGLuint){.dynlib: dllname,
     importc: "glDisableVertexAttribArray".}
-proc glEnableVertexAttribArray*(index: TGLuint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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".}
@@ -535,31 +535,31 @@ 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, 
+proc glIsProgram*(theProgram: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsProgram".}
-proc glIsShader*(shader: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsShader*(shader: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsShader".}
-proc glLinkProgram*(theProgram: TGLuint){.dynlib: dllname, 
+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, 
+proc glUseProgram*(theProgram: TGLuint){.dynlib: dllname,
     importc: "glUseProgram".}
-proc glUniform1f*(location: TGLint, v0: TGLfloat){.dynlib: dllname, 
+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, 
+proc glUniform4f*(location: TGLint, v0: TGLfloat, v1: TGLfloat, v2: TGLfloat,
                   v3: TGLfloat){.dynlib: dllname, importc: "glUniform4f".}
-proc glUniform1i*(location: TGLint, v0: TGLint){.dynlib: dllname, 
+proc glUniform1i*(location: TGLint, v0: TGLint){.dynlib: dllname,
     importc: "glUniform1i".}
-proc glUniform2i*(location: TGLint, v0: TGLint, v1: TGLint){.dynlib: dllname, 
+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, 
+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".}
@@ -577,98 +577,98 @@ 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, 
+proc glUniformMatrix2fv*(location: TGLint, count: TGLsizei,
                          transpose: TGLboolean, value: PGLfloat){.
     dynlib: dllname, importc: "glUniformMatrix2fv".}
-proc glUniformMatrix3fv*(location: TGLint, count: TGLsizei, 
+proc glUniformMatrix3fv*(location: TGLint, count: TGLsizei,
                          transpose: TGLboolean, value: PGLfloat){.
     dynlib: dllname, importc: "glUniformMatrix3fv".}
-proc glUniformMatrix4fv*(location: TGLint, count: TGLsizei, 
+proc glUniformMatrix4fv*(location: TGLint, count: TGLsizei,
                          transpose: TGLboolean, value: PGLfloat){.
     dynlib: dllname, importc: "glUniformMatrix4fv".}
-proc glValidateProgram*(theProgram: TGLuint){.dynlib: dllname, 
+proc glValidateProgram*(theProgram: TGLuint){.dynlib: dllname,
     importc: "glValidateProgram".}
-proc glVertexAttrib1d*(index: TGLuint, x: TGLdouble){.dynlib: dllname, 
+proc glVertexAttrib1d*(index: TGLuint, x: TGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib1d".}
-proc glVertexAttrib1dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib1dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib1dv".}
-proc glVertexAttrib1f*(index: TGLuint, x: TGLfloat){.dynlib: dllname, 
+proc glVertexAttrib1f*(index: TGLuint, x: TGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib1f".}
-proc glVertexAttrib1fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib1fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib1fv".}
-proc glVertexAttrib1s*(index: TGLuint, x: TGLshort){.dynlib: dllname, 
+proc glVertexAttrib1s*(index: TGLuint, x: TGLshort){.dynlib: dllname,
     importc: "glVertexAttrib1s".}
-proc glVertexAttrib1sv*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glVertexAttrib3sv*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib3sv".}
-proc glVertexAttrib4Nbv*(index: TGLuint, v: PGLbyte){.dynlib: dllname, 
+proc glVertexAttrib4Nbv*(index: TGLuint, v: PGLbyte){.dynlib: dllname,
     importc: "glVertexAttrib4Nbv".}
-proc glVertexAttrib4Niv*(index: TGLuint, v: PGLint){.dynlib: dllname, 
+proc glVertexAttrib4Niv*(index: TGLuint, v: PGLint){.dynlib: dllname,
     importc: "glVertexAttrib4Niv".}
-proc glVertexAttrib4Nsv*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib4Nsv*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib4Nsv".}
-proc glVertexAttrib4Nub*(index: TGLuint, x: TGLubyte, y: TGLubyte, z: TGLubyte, 
-                         w: TGLubyte){.dynlib: dllname, 
+proc glVertexAttrib4Nub*(index: TGLuint, x: TGLubyte, y: TGLubyte, z: TGLubyte,
+                         w: TGLubyte){.dynlib: dllname,
                                        importc: "glVertexAttrib4Nub".}
-proc glVertexAttrib4Nubv*(index: TGLuint, v: PGLubyte){.dynlib: dllname, 
+proc glVertexAttrib4Nubv*(index: TGLuint, v: PGLubyte){.dynlib: dllname,
     importc: "glVertexAttrib4Nubv".}
-proc glVertexAttrib4Nuiv*(index: TGLuint, v: PGLuint){.dynlib: dllname, 
+proc glVertexAttrib4Nuiv*(index: TGLuint, v: PGLuint){.dynlib: dllname,
     importc: "glVertexAttrib4Nuiv".}
-proc glVertexAttrib4Nusv*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+proc glVertexAttrib4Nusv*(index: TGLuint, v: PGLushort){.dynlib: dllname,
     importc: "glVertexAttrib4Nusv".}
-proc glVertexAttrib4bv*(index: TGLuint, v: PGLbyte){.dynlib: dllname, 
+proc glVertexAttrib4bv*(index: TGLuint, v: PGLbyte){.dynlib: dllname,
     importc: "glVertexAttrib4bv".}
-proc glVertexAttrib4d*(index: TGLuint, x: TGLdouble, y: TGLdouble, z: TGLdouble, 
-                       w: TGLdouble){.dynlib: dllname, 
+proc glVertexAttrib4d*(index: TGLuint, x: TGLdouble, y: TGLdouble, z: TGLdouble,
+                       w: TGLdouble){.dynlib: dllname,
                                       importc: "glVertexAttrib4d".}
-proc glVertexAttrib4dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib4dv*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib4dv".}
-proc glVertexAttrib4f*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat, 
-                       w: TGLfloat){.dynlib: dllname, 
+proc glVertexAttrib4f*(index: TGLuint, x: TGLfloat, y: TGLfloat, z: TGLfloat,
+                       w: TGLfloat){.dynlib: dllname,
                                      importc: "glVertexAttrib4f".}
-proc glVertexAttrib4fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib4fv*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib4fv".}
-proc glVertexAttrib4iv*(index: TGLuint, v: PGLint){.dynlib: dllname, 
+proc glVertexAttrib4iv*(index: TGLuint, v: PGLint){.dynlib: dllname,
     importc: "glVertexAttrib4iv".}
-proc glVertexAttrib4s*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort, 
-                       w: TGLshort){.dynlib: dllname, 
+proc glVertexAttrib4s*(index: TGLuint, x: TGLshort, y: TGLshort, z: TGLshort,
+                       w: TGLshort){.dynlib: dllname,
                                      importc: "glVertexAttrib4s".}
-proc glVertexAttrib4sv*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib4sv*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib4sv".}
-proc glVertexAttrib4ubv*(index: TGLuint, v: PGLubyte){.dynlib: dllname, 
+proc glVertexAttrib4ubv*(index: TGLuint, v: PGLubyte){.dynlib: dllname,
     importc: "glVertexAttrib4ubv".}
-proc glVertexAttrib4uiv*(index: TGLuint, v: PGLuint){.dynlib: dllname, 
+proc glVertexAttrib4uiv*(index: TGLuint, v: PGLuint){.dynlib: dllname,
     importc: "glVertexAttrib4uiv".}
-proc glVertexAttrib4usv*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+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, 
+proc glVertexAttribPointer*(index: TGLuint, size: TGLint, thetype: TGLenum,
+                            normalized: TGLboolean, stride: TGLsizei,
+                            pointer: PGLvoid){.dynlib: dllname,
     importc: "glVertexAttribPointer".}
-const 
+const
   GL_CONSTANT_COLOR* = 0x00008001
   GL_ONE_MINUS_CONSTANT_COLOR* = 0x00008002
   GL_CONSTANT_ALPHA* = 0x00008003
@@ -747,122 +747,122 @@ const
   GL_REPLICATE_BORDER* = 0x00008153
   GL_CONVOLUTION_BORDER_COLOR* = 0x00008154
 
-proc glActiveTexture*(texture: TGLenum){.dynlib: dllname, 
+proc glActiveTexture*(texture: TGLenum){.dynlib: dllname,
     importc: "glActiveTexture".}
-proc glClientActiveTexture*(texture: TGLenum){.dynlib: dllname, 
+proc glClientActiveTexture*(texture: TGLenum){.dynlib: dllname,
     importc: "glClientActiveTexture".}
-proc glMultiTexCoord1d*(target: TGLenum, s: TGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord1d*(target: TGLenum, s: TGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord1d".}
-proc glMultiTexCoord1dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord1dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord1dv".}
-proc glMultiTexCoord1f*(target: TGLenum, s: TGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord1f*(target: TGLenum, s: TGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord1f".}
-proc glMultiTexCoord1fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord1fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord1fv".}
-proc glMultiTexCoord1i*(target: TGLenum, s: TGLint){.dynlib: dllname, 
+proc glMultiTexCoord1i*(target: TGLenum, s: TGLint){.dynlib: dllname,
     importc: "glMultiTexCoord1i".}
-proc glMultiTexCoord1iv*(target: TGLenum, v: PGLint){.dynlib: dllname, 
+proc glMultiTexCoord1iv*(target: TGLenum, v: PGLint){.dynlib: dllname,
     importc: "glMultiTexCoord1iv".}
-proc glMultiTexCoord1s*(target: TGLenum, s: TGLshort){.dynlib: dllname, 
+proc glMultiTexCoord1s*(target: TGLenum, s: TGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord1s".}
-proc glMultiTexCoord1sv*(target: TGLenum, v: PGLshort){.dynlib: dllname, 
+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, 
+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, 
+proc glMultiTexCoord2fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord2fv".}
-proc glMultiTexCoord2i*(target: TGLenum, s: TGLint, t: TGLint){.dynlib: dllname, 
+proc glMultiTexCoord2i*(target: TGLenum, s: TGLint, t: TGLint){.dynlib: dllname,
     importc: "glMultiTexCoord2i".}
-proc glMultiTexCoord2iv*(target: TGLenum, v: PGLint){.dynlib: dllname, 
+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, 
+proc glMultiTexCoord2sv*(target: TGLenum, v: PGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord2sv".}
-proc glMultiTexCoord3d*(target: TGLenum, s: TGLdouble, t: TGLdouble, 
-                        r: TGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord3d*(target: TGLenum, s: TGLdouble, t: TGLdouble,
+                        r: TGLdouble){.dynlib: dllname,
                                        importc: "glMultiTexCoord3d".}
-proc glMultiTexCoord3dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, 
+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, 
+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, 
+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, 
+proc glMultiTexCoord3sv*(target: TGLenum, v: PGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord3sv".}
-proc glMultiTexCoord4d*(target: TGLenum, s: TGLdouble, t: TGLdouble, 
-                        r: TGLdouble, q: TGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord4d*(target: TGLenum, s: TGLdouble, t: TGLdouble,
+                        r: TGLdouble, q: TGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord4d".}
-proc glMultiTexCoord4dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname, 
+proc glMultiTexCoord4dv*(target: TGLenum, v: PGLdouble){.dynlib: dllname,
     importc: "glMultiTexCoord4dv".}
-proc glMultiTexCoord4f*(target: TGLenum, s: TGLfloat, t: TGLfloat, r: TGLfloat, 
-                        q: TGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord4f*(target: TGLenum, s: TGLfloat, t: TGLfloat, r: TGLfloat,
+                        q: TGLfloat){.dynlib: dllname,
                                       importc: "glMultiTexCoord4f".}
-proc glMultiTexCoord4fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname, 
+proc glMultiTexCoord4fv*(target: TGLenum, v: PGLfloat){.dynlib: dllname,
     importc: "glMultiTexCoord4fv".}
-proc glMultiTexCoord4i*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint, 
-                        q: TGLint){.dynlib: dllname, 
+proc glMultiTexCoord4i*(target: TGLenum, s: TGLint, t: TGLint, r: TGLint,
+                        q: TGLint){.dynlib: dllname,
                                     importc: "glMultiTexCoord4i".}
-proc glMultiTexCoord4iv*(target: TGLenum, v: PGLint){.dynlib: dllname, 
+proc glMultiTexCoord4iv*(target: TGLenum, v: PGLint){.dynlib: dllname,
     importc: "glMultiTexCoord4iv".}
-proc glMultiTexCoord4s*(target: TGLenum, s: TGLshort, t: TGLshort, r: TGLshort, 
-                        q: TGLshort){.dynlib: dllname, 
+proc glMultiTexCoord4s*(target: TGLenum, s: TGLshort, t: TGLshort, r: TGLshort,
+                        q: TGLshort){.dynlib: dllname,
                                       importc: "glMultiTexCoord4s".}
-proc glMultiTexCoord4sv*(target: TGLenum, v: PGLshort){.dynlib: dllname, 
+proc glMultiTexCoord4sv*(target: TGLenum, v: PGLshort){.dynlib: dllname,
     importc: "glMultiTexCoord4sv".}
-proc glLoadTransposeMatrixf*(m: PGLfloat){.dynlib: dllname, 
+proc glLoadTransposeMatrixf*(m: PGLfloat){.dynlib: dllname,
     importc: "glLoadTransposeMatrixf".}
-proc glLoadTransposeMatrixd*(m: PGLdouble){.dynlib: dllname, 
+proc glLoadTransposeMatrixd*(m: PGLdouble){.dynlib: dllname,
     importc: "glLoadTransposeMatrixd".}
-proc glMultTransposeMatrixf*(m: PGLfloat){.dynlib: dllname, 
+proc glMultTransposeMatrixf*(m: PGLfloat){.dynlib: dllname,
     importc: "glMultTransposeMatrixf".}
-proc glMultTransposeMatrixd*(m: PGLdouble){.dynlib: dllname, 
+proc glMultTransposeMatrixd*(m: PGLdouble){.dynlib: dllname,
     importc: "glMultTransposeMatrixd".}
-proc glSampleCoverage*(value: TGLclampf, invert: TGLboolean){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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 
+const
   GL_TEXTURE0* = 0x000084C0
   GL_TEXTURE1* = 0x000084C1
   GL_TEXTURE2* = 0x000084C2
@@ -961,7 +961,7 @@ const
   GL_DOT3_RGB* = 0x000086AE
   GL_DOT3_RGBA* = 0x000086AF
 
-const 
+const
   GL_TEXTURE0_ARB* = 0x000084C0
   GL_TEXTURE1_ARB* = 0x000084C1
   GL_TEXTURE2_ARB* = 0x000084C2
@@ -999,21 +999,21 @@ const
   GL_MAX_TEXTURE_UNITS_ARB* = 0x000084E2
   #***** GL_ARB_transpose_matrix *****//
 
-const 
+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, 
+proc glLoadTransposeMatrixfARB*(m: PGLfloat){.dynlib: dllname,
     importc: "glLoadTransposeMatrixfARB".}
-proc glLoadTransposeMatrixdARB*(m: PGLdouble){.dynlib: dllname, 
+proc glLoadTransposeMatrixdARB*(m: PGLdouble){.dynlib: dllname,
     importc: "glLoadTransposeMatrixdARB".}
-proc glMultTransposeMatrixfARB*(m: PGLfloat){.dynlib: dllname, 
+proc glMultTransposeMatrixfARB*(m: PGLfloat){.dynlib: dllname,
     importc: "glMultTransposeMatrixfARB".}
-proc glMultTransposeMatrixdARB*(m: PGLdouble){.dynlib: dllname, 
+proc glMultTransposeMatrixdARB*(m: PGLdouble){.dynlib: dllname,
     importc: "glMultTransposeMatrixdARB".}
-const 
+const
   WGL_SAMPLE_BUFFERS_ARB* = 0x00002041
   WGL_SAMPLES_ARB* = 0x00002042
   GL_MULTISAMPLE_ARB* = 0x0000809D
@@ -1026,7 +1026,7 @@ const
   GL_SAMPLE_COVERAGE_VALUE_ARB* = 0x000080AA
   GL_SAMPLE_COVERAGE_INVERT_ARB* = 0x000080AB
 
-const 
+const
   GL_NORMAL_MAP_ARB* = 0x00008511
   GL_REFLECTION_MAP_ARB* = 0x00008512
   GL_TEXTURE_CUBE_MAP_ARB* = 0x00008513
@@ -1040,7 +1040,7 @@ const
   GL_PROXY_TEXTURE_CUBE_MAP_ARB* = 0x0000851B
   GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB* = 0x0000851C
 
-const 
+const
   GL_DEPTH_COMPONENT16_ARB* = 0x000081A5
   GL_DEPTH_COMPONENT24_ARB* = 0x000081A6
   GL_DEPTH_COMPONENT32_ARB* = 0x000081A7
@@ -1048,26 +1048,26 @@ const
   GL_DEPTH_TEXTURE_MODE_ARB* = 0x0000884B
   #***** GL_ARB_point_parameters *****//
 
-const 
+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, 
+proc glPointParameterfARB*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glPointParameterfARB".}
-proc glPointParameterfvARB*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glPointParameterfvARB*(pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glPointParameterfvARB".}
-const 
+const
   GL_TEXTURE_COMPARE_MODE_ARB* = 0x0000884C
   GL_TEXTURE_COMPARE_FUNC_ARB* = 0x0000884D
   GL_COMPARE_R_TO_TEXTURE_ARB* = 0x0000884E
 
-const 
+const
   GL_TEXTURE_COMPARE_FAIL_VALUE_ARB* = 0x000080BF
   GL_CLAMP_TO_BORDER_ARB* = 0x0000812D
 
-const 
+const
   GL_COMPRESSED_ALPHA_ARB* = 0x000084E9
   GL_COMPRESSED_LUMINANCE_ARB* = 0x000084EA
   GL_COMPRESSED_LUMINANCE_ALPHA_ARB* = 0x000084EB
@@ -1080,44 +1080,44 @@ const
   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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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 
+const
   GL_COMBINE_ARB* = 0x00008570
   GL_COMBINE_RGB_ARB* = 0x00008571
   GL_COMBINE_ALPHA_ARB* = 0x00008572
@@ -1143,16 +1143,16 @@ const
   #***** GL_ARB_texture_env_crossbar *****//
   #***** GL_ARB_texture_env_dot3 *****//
 
-const 
+const
   GL_DOT3_RGB_ARB* = 0x000086AE
   GL_DOT3_RGBA_ARB* = 0x000086AF
   #***** GL_ARB_texture_mirrored_repeat *****//
 
-const 
+const
   GL_MIRRORED_REPEAT_ARB* = 0x00008370
   #***** GL_ARB_vertex_blend *****//
 
-const 
+const
   GL_MAX_VERTEX_UNITS_ARB* = 0x000086A4
   GL_ACTIVE_VERTEX_UNITS_ARB* = 0x000086A5
   GL_WEIGHT_SUM_UNITY_ARB* = 0x000086A6
@@ -1196,7 +1196,7 @@ const
   GL_WEIGHT_ARRAY_POINTER_ARB* = 0x000086AC
   GL_WEIGHT_ARRAY_ARB* = 0x000086AD
 
-const 
+const
   GL_VERTEX_PROGRAM_ARB* = 0x00008620
   GL_VERTEX_PROGRAM_POINT_SIZE_ARB* = 0x00008642
   GL_VERTEX_PROGRAM_TWO_SIDE_ARB* = 0x00008643
@@ -1277,78 +1277,78 @@ const
   GL_MATRIX30_ARB* = 0x000088DE
   GL_MATRIX31_ARB* = 0x000088DF
 
-const 
+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 
+const
   GL_ABGR_EXT* = 0x00008000
   #***** GL_EXT_bgra *****//
 
-const 
+const
   GL_BGR_EXT* = 0x000080E0
   GL_BGRA_EXT* = 0x000080E1
   #***** GL_EXT_blend_color *****//
 
-const 
+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, 
+proc glBlendColorEXT*(red: TGLclampf, green: TGLclampf, blue: TGLclampf,
+                      alpha: TGLclampf){.dynlib: dllname,
     importc: "glBlendColorEXT".}
   #***** GL_EXT_blend_func_separate *****//
-const 
+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, 
+proc glBlendFuncSeparateEXT*(sfactorRGB: TGLenum, dfactorRGB: TGLenum,
                              sfactorAlpha: TGLenum, dfactorAlpha: TGLenum){.
     dynlib: dllname, importc: "glBlendFuncSeparateEXT".}
   #***** GL_EXT_blend_logic_op *****//
   #***** GL_EXT_blend_minmax *****//
-const 
+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, 
+proc glBlendEquationEXT*(mode: TGLenum){.dynlib: dllname,
     importc: "glBlendEquationEXT".}
   #***** GL_EXT_blend_subtract *****//
-const 
+const
   GL_FUNC_SUBTRACT_EXT* = 0x0000800A
   GL_FUNC_REVERSE_SUBTRACT_EXT* = 0x0000800B
   #***** GL_EXT_clip_volume_hint *****//
 
-const 
+const
   GL_CLIP_VOLUME_CLIPPING_HINT_EXT* = 0x000080F0
   #***** GL_EXT_color_subtable *****//
 
-proc glColorSubTableEXT*(target: TGLenum, start: TGLsizei, count: TGLsizei, 
+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, 
+proc glCopyColorSubTableEXT*(target: TGLenum, start: TGLsizei, x: TGLint,
+                             y: TGLint, width: TGLsizei){.dynlib: dllname,
     importc: "glCopyColorSubTableEXT".}
   #***** GL_EXT_compiled_vertex_array *****//
-const 
+const
   GL_ARRAY_ELEMENT_LOCK_FIRST_EXT* = 0x000081A8
   GL_ARRAY_ELEMENT_LOCK_COUNT_EXT* = 0x000081A9
 
-proc glLockArraysEXT*(first: TGLint, count: TGLsizei){.dynlib: dllname, 
+proc glLockArraysEXT*(first: TGLint, count: TGLsizei){.dynlib: dllname,
     importc: "glLockArraysEXT".}
 proc glUnlockArraysEXT*(){.dynlib: dllname, importc: "glUnlockArraysEXT".}
   #***** GL_EXT_convolution *****//
-const 
+const
   GL_CONVOLUTION_1D_EXT* = 0x00008010
   GL_CONVOLUTION_2D_EXT* = 0x00008011
   GL_SEPARABLE_2D_EXT* = 0x00008012
@@ -1370,51 +1370,51 @@ const
   GL_POST_CONVOLUTION_BLUE_BIAS_EXT* = 0x00008022
   GL_POST_CONVOLUTION_ALPHA_BIAS_EXT* = 0x00008023
 
-proc glConvolutionFilter1DEXT*(target: TGLenum, internalformat: TGLenum, 
-                               width: TGLsizei, format: TGLenum, 
+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, 
+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, 
+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, 
+proc glCopyConvolutionFilter2DEXT*(target: TGLenum, internalformat: TGLenum,
+                                   x: TGLint, y: TGLint, width: TGLsizei,
+                                   height: TGLsizei){.dynlib: dllname,
     importc: "glCopyConvolutionFilter2DEXT".}
-proc glGetConvolutionFilterEXT*(target: TGLenum, format: TGLenum, 
+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, 
+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, 
+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, 
+proc glConvolutionParameterivEXT*(target: TGLenum, pname: TGLenum,
+                                  params: PGLint){.dynlib: dllname,
     importc: "glConvolutionParameterivEXT".}
-proc glConvolutionParameterfEXT*(target: TGLenum, pname: TGLenum, 
-                                 param: TGLfloat){.dynlib: dllname, 
+proc glConvolutionParameterfEXT*(target: TGLenum, pname: TGLenum,
+                                 param: TGLfloat){.dynlib: dllname,
     importc: "glConvolutionParameterfEXT".}
-proc glConvolutionParameterfvEXT*(target: TGLenum, pname: TGLenum, 
-                                  params: PGLfloat){.dynlib: dllname, 
+proc glConvolutionParameterfvEXT*(target: TGLenum, pname: TGLenum,
+                                  params: PGLfloat){.dynlib: dllname,
     importc: "glConvolutionParameterfvEXT".}
-proc glGetConvolutionParameterivEXT*(target: TGLenum, pname: TGLenum, 
-                                     params: PGLint){.dynlib: dllname, 
+proc glGetConvolutionParameterivEXT*(target: TGLenum, pname: TGLenum,
+                                     params: PGLint){.dynlib: dllname,
     importc: "glGetConvolutionParameterivEXT".}
-proc glGetConvolutionParameterfvEXT*(target: TGLenum, pname: TGLenum, 
-                                     params: PGLfloat){.dynlib: dllname, 
+proc glGetConvolutionParameterfvEXT*(target: TGLenum, pname: TGLenum,
+                                     params: PGLfloat){.dynlib: dllname,
     importc: "glGetConvolutionParameterfvEXT".}
   #***** GL_EXT_fog_coord *****//
-const 
+const
   GL_FOG_COORDINATE_SOURCE_EXT* = 0x00008450
   GL_FOG_COORDINATE_EXT* = 0x00008451
   GL_FRAGMENT_DEPTH_EXT* = 0x00008452
@@ -1424,18 +1424,18 @@ const
   GL_FOG_COORDINATE_ARRAY_POINTER_EXT* = 0x00008456
   GL_FOG_COORDINATE_ARRAY_EXT* = 0x00008457
 
-proc glFogCoordfEXfloat*(coord: TGLfloat){.dynlib: dllname, 
+proc glFogCoordfEXfloat*(coord: TGLfloat){.dynlib: dllname,
     importc: "glFogCoordfEXfloat".}
-proc glFogCoorddEXdouble*(coord: TGLdouble){.dynlib: dllname, 
+proc glFogCoorddEXdouble*(coord: TGLdouble){.dynlib: dllname,
     importc: "glFogCoorddEXdouble".}
-proc glFogCoordfvEXfloat*(coord: TGLfloat){.dynlib: dllname, 
+proc glFogCoordfvEXfloat*(coord: TGLfloat){.dynlib: dllname,
     importc: "glFogCoordfvEXfloat".}
-proc glFogCoorddvEXdouble*(coord: TGLdouble){.dynlib: dllname, 
+proc glFogCoorddvEXdouble*(coord: TGLdouble){.dynlib: dllname,
     importc: "glFogCoorddvEXdouble".}
 proc glFogCoordPointerEXT*(thetype: TGLenum, stride: TGLsizei, pointer: PGLvoid){.
     dynlib: dllname, importc: "glFogCoordPointerEXT".}
   #***** GL_EXT_histogram *****//
-const 
+const
   constGL_HISTOGRAM_EXT* = 0x00008024
   GL_PROXY_HISTOGRAM_EXT* = 0x00008025
   GL_HISTOGRAM_WIDTH_EXT* = 0x00008026
@@ -1450,41 +1450,41 @@ const
   GL_MINMAX_FORMAT_EXT* = 0x0000802F
   GL_MINMAX_SINK_EXT* = 0x00008030
 
-proc glHistogramEXT*(target: TGLenum, width: TGLsizei, internalformat: TGLenum, 
-                     sink: TGLboolean){.dynlib: dllname, 
+proc glHistogramEXT*(target: TGLenum, width: TGLsizei, internalformat: TGLenum,
+                     sink: TGLboolean){.dynlib: dllname,
                                         importc: "glHistogramEXT".}
-proc glResetHistogramEXT*(target: TGLenum){.dynlib: dllname, 
+proc glResetHistogramEXT*(target: TGLenum){.dynlib: dllname,
     importc: "glResetHistogramEXT".}
-proc glGetHistogramEXT*(target: TGLenum, reset: TGLboolean, format: TGLenum, 
-                        thetype: TGLenum, values: PGLvoid){.dynlib: dllname, 
+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, 
+proc glGetHistogramParameterivEXT*(target: TGLenum, pname: TGLenum,
+                                   params: PGLint){.dynlib: dllname,
     importc: "glGetHistogramParameterivEXT".}
-proc glGetHistogramParameterfvEXT*(target: TGLenum, pname: TGLenum, 
-                                   params: PGLfloat){.dynlib: dllname, 
+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, 
+proc glResetMinmaxEXT*(target: TGLenum){.dynlib: dllname,
     importc: "glResetMinmaxEXT".}
-proc glGetMinmaxEXT*(target: TGLenum, reset: TGLboolean, format: TGLenum, 
-                     thetype: TGLenum, values: PGLvoid){.dynlib: dllname, 
+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, 
+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, 
+proc glMultiDrawArraysEXT*(mode: TGLenum, first: PGLint, count: PGLsizei,
+                           primcount: TGLsizei){.dynlib: dllname,
     importc: "glMultiDrawArraysEXT".}
-proc glMultiDrawElementsEXT*(mode: TGLenum, count: PGLsizei, thetype: TGLenum, 
+proc glMultiDrawElementsEXT*(mode: TGLenum, count: PGLsizei, thetype: TGLenum,
                              indices: PGLvoid, primcount: TGLsizei){.
     dynlib: dllname, importc: "glMultiDrawElementsEXT".}
   #***** GL_EXT_packed_pixels *****//
-const 
+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
@@ -1492,7 +1492,7 @@ const
   GL_UNSIGNED_INT_10_10_10_2_EXT* = 0x00008036
   #***** GL_EXT_paletted_texture *****//
 
-const 
+const
   GL_COLOR_INDEX1_EXT* = 0x000080E2
   GL_COLOR_INDEX2_EXT* = 0x000080E3
   GL_COLOR_INDEX4_EXT* = 0x000080E4
@@ -1519,40 +1519,40 @@ const
                                         # GL_TEXTURE_3D_EXT  { already defined }
                                         # GL_TEXTURE_CUBE_MAP_ARB  { already defined }
 
-proc glColorTableEXT*(target: TGLenum, internalFormat: TGLenum, width: TGLsizei, 
+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, 
+proc glGetColorTableEXT*(target: TGLenum, format: TGLenum, thetype: TGLenum,
+                         data: PGLvoid){.dynlib: dllname,
     importc: "glGetColorTableEXT".}
-proc glGetColorTableParameterivEXT*(target: TGLenum, pname: TGLenum, 
-                                    params: PGLint){.dynlib: dllname, 
+proc glGetColorTableParameterivEXT*(target: TGLenum, pname: TGLenum,
+                                    params: PGLint){.dynlib: dllname,
     importc: "glGetColorTableParameterivEXT".}
-proc glGetColorTableParameterfvEXT*(target: TGLenum, pname: TGLenum, 
-                                    params: PGLfloat){.dynlib: dllname, 
+proc glGetColorTableParameterfvEXT*(target: TGLenum, pname: TGLenum,
+                                    params: PGLfloat){.dynlib: dllname,
     importc: "glGetColorTableParameterfvEXT".}
   #***** GL_EXT_point_parameters *****//
-const 
+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, 
+proc glPointParameterfEXT*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glPointParameterfEXT".}
-proc glPointParameterfvEXT*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glPointParameterfvEXT*(pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glPointParameterfvEXT".}
   #***** GL_EXT_polygon_offset *****//
-const 
+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, 
+proc glPolygonOffsetEXT*(factor: TGLfloat, bias: TGLfloat){.dynlib: dllname,
     importc: "glPolygonOffsetEXT".}
   #***** GL_EXT_secondary_color *****//
-const 
+const
   GL_COLOR_SUM_EXT* = 0x00008458
   GL_CURRENT_SECONDARY_COLOR_EXT* = 0x00008459
   GL_SECONDARY_COLOR_ARRAY_SIZE_EXT* = 0x0000845A
@@ -1561,80 +1561,80 @@ const
   GL_SECONDARY_COLOR_ARRAY_POINTER_EXT* = 0x0000845D
   GL_SECONDARY_COLOR_ARRAY_EXT* = 0x0000845E
 
-proc glSecondaryColor3bEXT*(components: TGLbyte){.dynlib: dllname, 
+proc glSecondaryColor3bEXT*(components: TGLbyte){.dynlib: dllname,
     importc: "glSecondaryColor3bEXT".}
-proc glSecondaryColor3sEXT*(components: TGLshort){.dynlib: dllname, 
+proc glSecondaryColor3sEXT*(components: TGLshort){.dynlib: dllname,
     importc: "glSecondaryColor3sEXT".}
-proc glSecondaryColor3iEXT*(components: TGLint){.dynlib: dllname, 
+proc glSecondaryColor3iEXT*(components: TGLint){.dynlib: dllname,
     importc: "glSecondaryColor3iEXT".}
-proc glSecondaryColor3fEXT*(components: TGLfloat){.dynlib: dllname, 
+proc glSecondaryColor3fEXT*(components: TGLfloat){.dynlib: dllname,
     importc: "glSecondaryColor3fEXT".}
-proc glSecondaryColor3dEXT*(components: TGLdouble){.dynlib: dllname, 
+proc glSecondaryColor3dEXT*(components: TGLdouble){.dynlib: dllname,
     importc: "glSecondaryColor3dEXT".}
-proc glSecondaryColor3ubEXT*(components: TGLubyte){.dynlib: dllname, 
+proc glSecondaryColor3ubEXT*(components: TGLubyte){.dynlib: dllname,
     importc: "glSecondaryColor3ubEXT".}
-proc glSecondaryColor3usEXT*(components: TGLushort){.dynlib: dllname, 
+proc glSecondaryColor3usEXT*(components: TGLushort){.dynlib: dllname,
     importc: "glSecondaryColor3usEXT".}
-proc glSecondaryColor3uiEXT*(components: TGLuint){.dynlib: dllname, 
+proc glSecondaryColor3uiEXT*(components: TGLuint){.dynlib: dllname,
     importc: "glSecondaryColor3uiEXT".}
-proc glSecondaryColor3bvEXT*(components: TGLbyte){.dynlib: dllname, 
+proc glSecondaryColor3bvEXT*(components: TGLbyte){.dynlib: dllname,
     importc: "glSecondaryColor3bvEXT".}
-proc glSecondaryColor3svEXT*(components: TGLshort){.dynlib: dllname, 
+proc glSecondaryColor3svEXT*(components: TGLshort){.dynlib: dllname,
     importc: "glSecondaryColor3svEXT".}
-proc glSecondaryColor3ivEXT*(components: TGLint){.dynlib: dllname, 
+proc glSecondaryColor3ivEXT*(components: TGLint){.dynlib: dllname,
     importc: "glSecondaryColor3ivEXT".}
-proc glSecondaryColor3fvEXT*(components: TGLfloat){.dynlib: dllname, 
+proc glSecondaryColor3fvEXT*(components: TGLfloat){.dynlib: dllname,
     importc: "glSecondaryColor3fvEXT".}
-proc glSecondaryColor3dvEXT*(components: TGLdouble){.dynlib: dllname, 
+proc glSecondaryColor3dvEXT*(components: TGLdouble){.dynlib: dllname,
     importc: "glSecondaryColor3dvEXT".}
-proc glSecondaryColor3ubvEXT*(components: TGLubyte){.dynlib: dllname, 
+proc glSecondaryColor3ubvEXT*(components: TGLubyte){.dynlib: dllname,
     importc: "glSecondaryColor3ubvEXT".}
-proc glSecondaryColor3usvEXT*(components: TGLushort){.dynlib: dllname, 
+proc glSecondaryColor3usvEXT*(components: TGLushort){.dynlib: dllname,
     importc: "glSecondaryColor3usvEXT".}
-proc glSecondaryColor3uivEXT*(components: TGLuint){.dynlib: dllname, 
+proc glSecondaryColor3uivEXT*(components: TGLuint){.dynlib: dllname,
     importc: "glSecondaryColor3uivEXT".}
-proc glSecondaryColorPointerEXT*(size: TGLint, thetype: TGLenum, 
+proc glSecondaryColorPointerEXT*(size: TGLint, thetype: TGLenum,
                                  stride: TGLsizei, pointer: PGLvoid){.
     dynlib: dllname, importc: "glSecondaryColorPointerEXT".}
   #***** GL_EXT_separate_specular_color *****//
-const 
+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 
+const
   GL_SHARED_TEXTURE_PALETTE_EXT* = 0x000081FB
   #***** GL_EXT_stencil_two_side *****//
 
-const 
+const
   GL_STENCIL_TEST_TWO_SIDE_EXT* = 0x00008910
   constGL_ACTIVE_STENCIL_FACE_EXT* = 0x00008911
 
-proc glActiveStencilFaceEXT*(face: TGLenum){.dynlib: dllname, 
+proc glActiveStencilFaceEXT*(face: TGLenum){.dynlib: dllname,
     importc: "glActiveStencilFaceEXT".}
   #***** GL_EXT_stencil_wrap *****//
-const 
+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, 
+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, 
+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, 
+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 
+const
   GL_PACK_SKIP_IMAGES_EXT* = 0x0000806B
   GL_PACK_IMAGE_HEIGHT_EXT* = 0x0000806C
   GL_UNPACK_SKIP_IMAGES_EXT* = 0x0000806D
@@ -1644,13 +1644,13 @@ const
   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, 
+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 
+const
   GL_COMPRESSED_RGB_S3TC_DXT1_EXT* = 0x000083F0
   GL_COMPRESSED_RGBA_S3TC_DXT1_EXT* = 0x000083F1
   GL_COMPRESSED_RGBA_S3TC_DXT3_EXT* = 0x000083F2
@@ -1658,7 +1658,7 @@ const
   #***** GL_EXT_texture_env_add *****//
   #***** GL_EXT_texture_env_combine *****//
 
-const 
+const
   GL_COMBINE_EXT* = 0x00008570
   GL_COMBINE_RGB_EXT* = 0x00008571
   GL_COMBINE_ALPHA_EXT* = 0x00008572
@@ -1682,45 +1682,45 @@ const
   GL_PREVIOUS_EXT* = 0x00008578
   #***** GL_EXT_texture_env_dot3 *****//
 
-const 
+const
   GL_DOT3_RGB_EXT* = 0x00008740
   GL_DOT3_RGBA_EXT* = 0x00008741
   #***** GL_EXT_texture_filter_anisotropic *****//
 
-const 
+const
   GL_TEXTURE_MAX_ANISOTROPY_EXT* = 0x000084FE
   GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT* = 0x000084FF
   #***** GL_EXT_texture_lod_bias *****//
 
-const 
+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 
+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, 
+proc glGenTexturesEXT*(n: TGLsizei, textures: PGLuint){.dynlib: dllname,
     importc: "glGenTexturesEXT".}
-proc glDeleteTexturesEXT*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, 
+proc glDeleteTexturesEXT*(n: TGLsizei, textures: PGLuint){.dynlib: dllname,
     importc: "glDeleteTexturesEXT".}
-proc glBindTextureEXT*(target: TGLenum, texture: TGLuint){.dynlib: dllname, 
+proc glBindTextureEXT*(target: TGLenum, texture: TGLuint){.dynlib: dllname,
     importc: "glBindTextureEXT".}
-proc glPrioritizeTexturesEXT*(n: TGLsizei, textures: PGLuint, 
-                              priorities: PGLclampf){.dynlib: dllname, 
+proc glPrioritizeTexturesEXT*(n: TGLsizei, textures: PGLuint,
+                              priorities: PGLclampf){.dynlib: dllname,
     importc: "glPrioritizeTexturesEXT".}
-proc glAreTexturesResidentEXT*(n: TGLsizei, textures: PGLuint, 
+proc glAreTexturesResidentEXT*(n: TGLsizei, textures: PGLuint,
                                residences: PGLboolean): TGLboolean{.
     dynlib: dllname, importc: "glAreTexturesResidentEXT".}
-proc glIsTextureEXT*(texture: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsTextureEXT*(texture: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsTextureEXT".}
   #***** GL_EXT_vertex_array *****//
-const 
+const
   GL_VERTEX_ARRAY_EXT* = 0x00008074
   GL_NORMAL_ARRAY_EXT* = 0x00008075
   GL_COLOR_ARRAY_EXT* = 0x00008076
@@ -1755,32 +1755,32 @@ const
   GL_TEXTURE_COORD_ARRAY_POINTER_EXT* = 0x00008092
   GL_EDGE_FLAG_ARRAY_POINTER_EXT* = 0x00008093
 
-proc glArrayElementEXT*(i: TGLint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glEdgeFlagPointerEXT*(stride: TGLsizei, count: TGLsizei,
+                           pointer: PGLboolean){.dynlib: dllname,
     importc: "glEdgeFlagPointerEXT".}
-proc glGetPointervEXT*(pname: TGLenum, params: PGLvoid){.dynlib: dllname, 
+proc glGetPointervEXT*(pname: TGLenum, params: PGLvoid){.dynlib: dllname,
     importc: "glGetPointervEXT".}
   #***** GL_EXT_vertex_shader *****//
-const 
+const
   GL_VERTEX_SHADER_EXT* = 0x00008780
   GL_VARIANT_VALUE_EXT* = 0x000087E4
   GL_VARIANT_DATATYPE_EXT* = 0x000087E5
@@ -1892,60 +1892,60 @@ const
   GL_CURRENT_VERTEX_EXT* = 0x000087E2
   GL_MVP_MATRIX_EXT* = 0x000087E3
 
-proc glBeginVertexShaderEXT*(){.dynlib: dllname, 
+proc glBeginVertexShaderEXT*(){.dynlib: dllname,
                                 importc: "glBeginVertexShaderEXT".}
 proc glEndVertexShaderEXT*(){.dynlib: dllname, importc: "glEndVertexShaderEXT".}
-proc glBindVertexShaderEXT*(id: TGLuint){.dynlib: dllname, 
+proc glBindVertexShaderEXT*(id: TGLuint){.dynlib: dllname,
     importc: "glBindVertexShaderEXT".}
-proc glGenVertexShadersEXT*(range: TGLuint): TGLuint{.dynlib: dllname, 
+proc glGenVertexShadersEXT*(range: TGLuint): TGLuint{.dynlib: dllname,
     importc: "glGenVertexShadersEXT".}
-proc glDeleteVertexShaderEXT*(id: TGLuint){.dynlib: dllname, 
+proc glDeleteVertexShaderEXT*(id: TGLuint){.dynlib: dllname,
     importc: "glDeleteVertexShaderEXT".}
-proc glShaderOp1EXT*(op: TGLenum, res: TGLuint, arg1: TGLuint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glVariantbvEXT*(id: TGLuint, address: PGLbyte){.dynlib: dllname,
     importc: "glVariantbvEXT".}
-proc glVariantsvEXT*(id: TGLuint, address: PGLshort){.dynlib: dllname, 
+proc glVariantsvEXT*(id: TGLuint, address: PGLshort){.dynlib: dllname,
     importc: "glVariantsvEXT".}
-proc glVariantivEXT*(id: TGLuint, address: PGLint){.dynlib: dllname, 
+proc glVariantivEXT*(id: TGLuint, address: PGLint){.dynlib: dllname,
     importc: "glVariantivEXT".}
-proc glVariantfvEXT*(id: TGLuint, address: PGLfloat){.dynlib: dllname, 
+proc glVariantfvEXT*(id: TGLuint, address: PGLfloat){.dynlib: dllname,
     importc: "glVariantfvEXT".}
-proc glVariantdvEXT*(id: TGLuint, address: PGLdouble){.dynlib: dllname, 
+proc glVariantdvEXT*(id: TGLuint, address: PGLdouble){.dynlib: dllname,
     importc: "glVariantdvEXT".}
-proc glVariantubvEXT*(id: TGLuint, address: PGLubyte){.dynlib: dllname, 
+proc glVariantubvEXT*(id: TGLuint, address: PGLubyte){.dynlib: dllname,
     importc: "glVariantubvEXT".}
-proc glVariantusvEXT*(id: TGLuint, address: PGLushort){.dynlib: dllname, 
+proc glVariantusvEXT*(id: TGLuint, address: PGLushort){.dynlib: dllname,
     importc: "glVariantusvEXT".}
-proc glVariantuivEXT*(id: TGLuint, address: PGLuint){.dynlib: dllname, 
+proc glVariantuivEXT*(id: TGLuint, address: PGLuint){.dynlib: dllname,
     importc: "glVariantuivEXT".}
-proc glVariantPointerEXT*(id: TGLuint, thetype: TGLenum, stride: TGLuint, 
-                          address: PGLvoid){.dynlib: dllname, 
+proc glVariantPointerEXT*(id: TGLuint, thetype: TGLenum, stride: TGLuint,
+                          address: PGLvoid){.dynlib: dllname,
     importc: "glVariantPointerEXT".}
-proc glEnableVariantClientStateEXT*(id: TGLuint){.dynlib: dllname, 
+proc glEnableVariantClientStateEXT*(id: TGLuint){.dynlib: dllname,
     importc: "glEnableVariantClientStateEXT".}
-proc glDisableVariantClientStateEXT*(id: TGLuint){.dynlib: dllname, 
+proc glDisableVariantClientStateEXT*(id: TGLuint){.dynlib: dllname,
     importc: "glDisableVariantClientStateEXT".}
 proc glBindLightParameterEXT*(light: TGLenum, value: TGLenum): TGLuint{.
     dynlib: dllname, importc: "glBindLightParameterEXT".}
@@ -1955,7 +1955,7 @@ proc glBindTexGenParameterEXT*(theunit: TGLenum, coord: TGLenum, value: TGLenum)
     dynlib: dllname, importc: "glBindTexGenParameterEXT".}
 proc glBindTextureUnitParameterEXT*(theunit: TGLenum, value: TGLenum): TGLuint{.
     dynlib: dllname, importc: "glBindTextureUnitParameterEXT".}
-proc glBindParameterEXT*(value: TGLenum): TGLuint{.dynlib: dllname, 
+proc glBindParameterEXT*(value: TGLenum): TGLuint{.dynlib: dllname,
     importc: "glBindParameterEXT".}
 proc glIsVariantEnabledEXT*(id: TGLuint, cap: TGLenum): TGLboolean{.
     dynlib: dllname, importc: "glIsVariantEnabledEXT".}
@@ -1973,15 +1973,15 @@ 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, 
+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 
+const
   GL_VERTEX_WEIGHTING_EXT* = 0x00008509
   GL_MODELVIEW0_EXT* = 0x00001700
   GL_MODELVIEW1_EXT* = 0x0000850A
@@ -1996,30 +1996,30 @@ const
   GL_MODELVIEW1_STACK_DEPTH_EXT* = 0x00008502
   GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT* = 0x00008510
 
-proc glVertexWeightfEXT*(weight: TGLfloat){.dynlib: dllname, 
+proc glVertexWeightfEXT*(weight: TGLfloat){.dynlib: dllname,
     importc: "glVertexWeightfEXT".}
-proc glVertexWeightfvEXT*(weight: PGLfloat){.dynlib: dllname, 
+proc glVertexWeightfvEXT*(weight: PGLfloat){.dynlib: dllname,
     importc: "glVertexWeightfvEXT".}
-proc glVertexWeightPointerEXT*(size: TGLint, thetype: TGLenum, stride: TGLsizei, 
-                               pointer: PGLvoid){.dynlib: dllname, 
+proc glVertexWeightPointerEXT*(size: TGLint, thetype: TGLenum, stride: TGLsizei,
+                               pointer: PGLvoid){.dynlib: dllname,
     importc: "glVertexWeightPointerEXT".}
   #***** GL_HP_occlusion_test *****//
-const 
+const
   GL_OCCLUSION_TEST_HP* = 0x00008165
   GL_OCCLUSION_TEST_RESULT_HP* = 0x00008166
   #***** GL_NV_blend_square *****//
   #***** GL_NV_copy_depth_to_color *****//
 
-const 
+const
   GL_DEPTH_STENCIL_TO_RGBA_NV* = 0x0000886E
   GL_DEPTH_STENCIL_TO_BGRA_NV* = 0x0000886F
   #***** GL_NV_depth_clamp *****//
 
-const 
+const
   GL_DEPTH_CLAMP_NV* = 0x0000864F
   #***** GL_NV_evaluators *****//
 
-const 
+const
   GL_EVAL_2D_NV* = 0x000086C0
   GL_EVAL_TRIANGULAR_2D_NV* = 0x000086C1
   GL_MAP_TESSELLATION_NV* = 0x000086C2
@@ -2045,82 +2045,82 @@ const
   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, 
+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, 
+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, 
+proc glGetMapAttribParameterivNV*(target: TGLenum, index: TGLuint,
                                   pname: TGLenum, params: PGLint){.
     dynlib: dllname, importc: "glGetMapAttribParameterivNV".}
-proc glGetMapAttribParameterfvNV*(target: TGLenum, index: TGLuint, 
+proc glGetMapAttribParameterfvNV*(target: TGLenum, index: TGLuint,
                                   pname: TGLenum, params: PGLfloat){.
     dynlib: dllname, importc: "glGetMapAttribParameterfvNV".}
-proc glEvalMapsNV*(target: TGLenum, mode: TGLenum){.dynlib: dllname, 
+proc glEvalMapsNV*(target: TGLenum, mode: TGLenum){.dynlib: dllname,
     importc: "glEvalMapsNV".}
   #***** GL_NV_fence *****//
-const 
+const
   GL_ALL_COMPLETED_NV* = 0x000084F2
   GL_FENCE_STATUS_NV* = 0x000084F3
   GL_FENCE_CONDITION_NV* = 0x000084F4
 
-proc glGenFencesNV*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, 
+proc glGenFencesNV*(n: TGLsizei, fences: PGLuint){.dynlib: dllname,
     importc: "glGenFencesNV".}
-proc glDeleteFencesNV*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, 
+proc glDeleteFencesNV*(n: TGLsizei, fences: PGLuint){.dynlib: dllname,
     importc: "glDeleteFencesNV".}
-proc glSetFenceNV*(fence: TGLuint, condition: TGLenum){.dynlib: dllname, 
+proc glSetFenceNV*(fence: TGLuint, condition: TGLenum){.dynlib: dllname,
     importc: "glSetFenceNV".}
-proc glTestFenceNV*(fence: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glTestFenceNV*(fence: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glTestFenceNV".}
-proc glFinishFenceNV*(fence: TGLuint){.dynlib: dllname, 
+proc glFinishFenceNV*(fence: TGLuint){.dynlib: dllname,
                                        importc: "glFinishFenceNV".}
-proc glIsFenceNV*(fence: TGLuint): TGLboolean{.dynlib: dllname, 
+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 
+const
   GL_FOG_DISTANCE_MODE_NV* = 0x0000855A
   GL_EYE_RADIAL_NV* = 0x0000855B
   GL_EYE_PLANE_ABSOLUTE_NV* = 0x0000855C
   #***** GL_NV_light_max_exponent *****//
 
-const 
+const
   GL_MAX_SHININESS_NV* = 0x00008504
   GL_MAX_SPOT_EXPONENT_NV* = 0x00008505
   #***** GL_NV_multisample_filter_hint *****//
 
-const 
+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 
+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, 
+proc glGenOcclusionQueriesNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname,
     importc: "glGenOcclusionQueriesNV".}
-proc glDeleteOcclusionQueriesNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, 
+proc glDeleteOcclusionQueriesNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname,
     importc: "glDeleteOcclusionQueriesNV".}
-proc glIsOcclusionQueryNV*(id: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsOcclusionQueryNV*(id: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsOcclusionQueryNV".}
-proc glBeginOcclusionQueryNV*(id: TGLuint){.dynlib: dllname, 
+proc glBeginOcclusionQueryNV*(id: TGLuint){.dynlib: dllname,
     importc: "glBeginOcclusionQueryNV".}
 proc glEndOcclusionQueryNV*(){.dynlib: dllname, importc: "glEndOcclusionQueryNV".}
 proc glGetOcclusionQueryivNV*(id: TGLuint, pname: TGLenum, params: PGLint){.
@@ -2128,22 +2128,22 @@ proc glGetOcclusionQueryivNV*(id: TGLuint, pname: TGLenum, params: PGLint){.
 proc glGetOcclusionQueryuivNV*(id: TGLuint, pname: TGLenum, params: PGLuint){.
     dynlib: dllname, importc: "glGetOcclusionQueryuivNV".}
   #***** GL_NV_packed_depth_stencil *****//
-const 
+const
   GL_DEPTH_STENCIL_NV* = 0x000084F9
   GL_UNSIGNED_INT_24_8_NV* = 0x000084FA
   #***** GL_NV_point_sprite *****//
 
-const 
+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, 
+proc glPointParameteriNV*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glPointParameteriNV".}
-proc glPointParameterivNV*(pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glPointParameterivNV*(pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glPointParameterivNV".}
   #***** GL_NV_register_combiners *****//
-const 
+const
   GL_REGISTER_COMBINERS_NV* = 0x00008522
   GL_COMBINER0_NV* = 0x00008550
   GL_COMBINER1_NV* = 0x00008551
@@ -2198,62 +2198,62 @@ const
 
 proc glCombinerParameterfvNV*(pname: TGLenum, params: PGLfloat){.
     dynlib: dllname, importc: "glCombinerParameterfvNV".}
-proc glCombinerParameterivNV*(pname: TGLenum, params: PGLint){.dynlib: dllname, 
+proc glCombinerParameterivNV*(pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glCombinerParameterivNV".}
-proc glCombinerParameterfNV*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glCombinerParameterfNV*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glCombinerParameterfNV".}
-proc glCombinerParameteriNV*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glGetCombinerInputParameterivNV*(stage: TGLenum, portion: TGLenum,
+                                      variable: TGLenum, pname: TGLenum,
+                                      params: PGLint){.dynlib: dllname,
     importc: "glGetCombinerInputParameterivNV".}
-proc glGetCombinerOutputParameterfvNV*(stage: TGLenum, portion: TGLenum, 
+proc glGetCombinerOutputParameterfvNV*(stage: TGLenum, portion: TGLenum,
                                        pname: TGLenum, params: PGLfloat){.
     dynlib: dllname, importc: "glGetCombinerOutputParameterfvNV".}
-proc glGetCombinerOutputParameterivNV*(stage: TGLenum, portion: TGLenum, 
+proc glGetCombinerOutputParameterivNV*(stage: TGLenum, portion: TGLenum,
                                        pname: TGLenum, params: PGLint){.
     dynlib: dllname, importc: "glGetCombinerOutputParameterivNV".}
-proc glGetFinalCombinerInputParameterfvNV*(variable: TGLenum, pname: TGLenum, 
-    params: PGLfloat){.dynlib: dllname, 
+proc glGetFinalCombinerInputParameterfvNV*(variable: TGLenum, pname: TGLenum,
+    params: PGLfloat){.dynlib: dllname,
                        importc: "glGetFinalCombinerInputParameterfvNV".}
-proc glGetFinalCombinerInputParameterivNV*(variable: TGLenum, pname: TGLenum, 
-    params: PGLint){.dynlib: dllname, 
+proc glGetFinalCombinerInputParameterivNV*(variable: TGLenum, pname: TGLenum,
+    params: PGLint){.dynlib: dllname,
                      importc: "glGetFinalCombinerInputParameterivNV".}
   #***** GL_NV_register_combiners2 *****//
-const 
+const
   GL_PER_STAGE_CONSTANTS_NV* = 0x00008535
 
-proc glCombinerStageParameterfvNV*(stage: TGLenum, pname: TGLenum, 
-                                   params: PGLfloat){.dynlib: dllname, 
+proc glCombinerStageParameterfvNV*(stage: TGLenum, pname: TGLenum,
+                                   params: PGLfloat){.dynlib: dllname,
     importc: "glCombinerStageParameterfvNV".}
-proc glGetCombinerStageParameterfvNV*(stage: TGLenum, pname: TGLenum, 
-                                      params: PGLfloat){.dynlib: dllname, 
+proc glGetCombinerStageParameterfvNV*(stage: TGLenum, pname: TGLenum,
+                                      params: PGLfloat){.dynlib: dllname,
     importc: "glGetCombinerStageParameterfvNV".}
   #***** GL_NV_texgen_emboss *****//
-const 
+const
   GL_EMBOSS_MAP_NV* = 0x0000855F
   GL_EMBOSS_LIGHT_NV* = 0x0000855D
   GL_EMBOSS_CONSTANT_NV* = 0x0000855E
   #***** GL_NV_texgen_reflection *****//
 
-const 
+const
   GL_NORMAL_MAP_NV* = 0x00008511
   GL_REFLECTION_MAP_NV* = 0x00008512
   #***** GL_NV_texture_compression_vtc *****//
@@ -2263,7 +2263,7 @@ const
   # GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  { already defined }
   #***** GL_NV_texture_env_combine4 *****//
 
-const 
+const
   GL_COMBINE4_NV* = 0x00008503
   GL_SOURCE3_RGB_NV* = 0x00008583
   GL_SOURCE3_ALPHA_NV* = 0x0000858B
@@ -2271,14 +2271,14 @@ const
   GL_OPERAND3_ALPHA_NV* = 0x0000859B
   #***** GL_NV_texture_rectangle *****//
 
-const 
+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 
+const
   GL_TEXTURE_SHADER_NV* = 0x000086DE
   GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV* = 0x000086D9
   GL_SHADER_OPERATION_NV* = 0x000086DF
@@ -2351,7 +2351,7 @@ const
   GL_TEXTURE_MAG_SIZE_NV* = 0x0000871F
   #***** GL_NV_texture_shader2 *****//
 
-const 
+const
   GL_DOT_PRODUCT_TEXTURE_3D_NV* = 0x000086EF # GL_HILO_NV  { already defined }
                                              # GL_DSDT_NV  { already defined }
                                              # GL_DSDT_MAG_NV  { already defined }
@@ -2381,7 +2381,7 @@ const
                                              # GL_DSDT8_MAG8_INTENSITY8_NV  { already defined }
   #***** GL_NV_texture_shader3 *****//
 
-const 
+const
   GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV* = 0x00008850
   GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV* = 0x00008851
   GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV* = 0x00008852
@@ -2401,23 +2401,23 @@ const
   GL_FORCE_BLUE_TO_ONE_NV* = 0x00008860
   #***** GL_NV_vertex_array_range *****//
 
-const 
+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, 
+proc glVertexArrayRangeNV*(len: TGLsizei, pointer: PGLvoid){.dynlib: dllname,
     importc: "glVertexArrayRangeNV".}
-proc glFlushVertexArrayRangeNV*(){.dynlib: dllname, 
+proc glFlushVertexArrayRangeNV*(){.dynlib: dllname,
                                    importc: "glFlushVertexArrayRangeNV".}
   #***** GL_NV_vertex_array_range2 *****//
-const 
+const
   GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV* = 0x00008533
   #***** GL_NV_vertex_program *****//
 
-const 
+const
   GL_VERTEX_PROGRAM_NV* = 0x00008620
   GL_VERTEX_PROGRAM_POINT_SIZE_NV* = 0x00008642
   GL_VERTEX_PROGRAM_TWO_SIDE_NV* = 0x00008643
@@ -2502,30 +2502,30 @@ const
   GL_MAP2_VERTEX_ATTRIB14_4_NV* = 0x0000867E
   GL_MAP2_VERTEX_ATTRIB15_4_NV* = 0x0000867F
 
-proc glBindProgramNV*(target: TGLenum, id: TGLuint){.dynlib: dllname, 
+proc glBindProgramNV*(target: TGLenum, id: TGLuint){.dynlib: dllname,
     importc: "glBindProgramNV".}
-proc glDeleteProgramsNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, 
+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, 
+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, 
+proc glRequestResidentProgramsNV*(n: TGLsizei, ids: PGLuint){.dynlib: dllname,
     importc: "glRequestResidentProgramsNV".}
-proc glGetProgramParameterfvNV*(target: TGLenum, index: TGLuint, pname: TGLenum, 
-                                params: PGLfloat){.dynlib: dllname, 
+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, 
+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, 
+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".}
@@ -2533,36 +2533,36 @@ 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, 
+proc glGetVertexAttribPointervNV*(index: TGLuint, pname: TGLenum,
+                                  pointer: PGLvoid){.dynlib: dllname,
     importc: "glGetVertexAttribPointervNV".}
-proc glIsProgramNV*(id: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsProgramNV*(id: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsProgramNV".}
-proc glLoadProgramNV*(target: TGLenum, id: TGLuint, length: TGLsizei, 
-                      theProgram: PGLubyte){.dynlib: dllname, 
+proc glLoadProgramNV*(target: TGLenum, id: TGLuint, length: TGLsizei,
+                      theProgram: PGLubyte){.dynlib: dllname,
     importc: "glLoadProgramNV".}
-proc glProgramParameter4fNV*(target: TGLenum, index: TGLuint, x: TGLfloat, 
+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, 
+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, 
+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, 
+proc glTrackMatrixNV*(target: TGLenum, address: TGLuint, matrix: TGLenum,
+                      transform: TGLenum){.dynlib: dllname,
     importc: "glTrackMatrixNV".}
-proc glVertexAttribPointerNV*(index: TGLuint, size: TGLint, thetype: TGLenum, 
+proc glVertexAttribPointerNV*(index: TGLuint, size: TGLint, thetype: TGLenum,
                               stride: TGLsizei, pointer: PGLvoid){.
     dynlib: dllname, importc: "glVertexAttribPointerNV".}
-proc glVertexAttrib1sNV*(index: TGLuint, x: TGLshort){.dynlib: dllname, 
+proc glVertexAttrib1sNV*(index: TGLuint, x: TGLshort){.dynlib: dllname,
     importc: "glVertexAttrib1sNV".}
-proc glVertexAttrib1fNV*(index: TGLuint, x: TGLfloat){.dynlib: dllname, 
+proc glVertexAttrib1fNV*(index: TGLuint, x: TGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib1fNV".}
-proc glVertexAttrib1dNV*(index: TGLuint, x: TGLdouble){.dynlib: dllname, 
+proc glVertexAttrib1dNV*(index: TGLuint, x: TGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib1dNV".}
 proc glVertexAttrib2sNV*(index: TGLuint, x: TGLshort, y: TGLshort){.
     dynlib: dllname, importc: "glVertexAttrib2sNV".}
@@ -2574,46 +2574,46 @@ 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, 
+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, 
+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, 
+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, 
+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, 
+proc glVertexAttrib4ubNV*(index: TGLuint, x: TGLubyte, y: TGLubyte, z: TGLubyte,
+                          w: TGLubyte){.dynlib: dllname,
                                         importc: "glVertexAttrib4ubNV".}
-proc glVertexAttrib1svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib1svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib1svNV".}
-proc glVertexAttrib1fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib1fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib1fvNV".}
-proc glVertexAttrib1dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib1dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib1dvNV".}
-proc glVertexAttrib2svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib2svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib2svNV".}
-proc glVertexAttrib2fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib2fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib2fvNV".}
-proc glVertexAttrib2dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib2dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib2dvNV".}
-proc glVertexAttrib3svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib3svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib3svNV".}
-proc glVertexAttrib3fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib3fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib3fvNV".}
-proc glVertexAttrib3dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib3dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib3dvNV".}
-proc glVertexAttrib4svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname, 
+proc glVertexAttrib4svNV*(index: TGLuint, v: PGLshort){.dynlib: dllname,
     importc: "glVertexAttrib4svNV".}
-proc glVertexAttrib4fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname, 
+proc glVertexAttrib4fvNV*(index: TGLuint, v: PGLfloat){.dynlib: dllname,
     importc: "glVertexAttrib4fvNV".}
-proc glVertexAttrib4dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname, 
+proc glVertexAttrib4dvNV*(index: TGLuint, v: PGLdouble){.dynlib: dllname,
     importc: "glVertexAttrib4dvNV".}
-proc glVertexAttrib4ubvNV*(index: TGLuint, v: PGLubyte){.dynlib: dllname, 
+proc glVertexAttrib4ubvNV*(index: TGLuint, v: PGLubyte){.dynlib: dllname,
     importc: "glVertexAttrib4ubvNV".}
 proc glVertexAttribs1svNV*(index: TGLuint, n: TGLsizei, v: PGLshort){.
     dynlib: dllname, importc: "glVertexAttribs1svNV".}
@@ -2643,20 +2643,20 @@ proc glVertexAttribs4ubvNV*(index: TGLuint, n: TGLsizei, v: PGLubyte){.
     dynlib: dllname, importc: "glVertexAttribs4ubvNV".}
   #***** GL_NV_vertex_program1_1 *****//
   #***** GL_ATI_element_array *****//
-const 
+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, 
+proc glElementPointerATI*(thetype: TGLenum, pointer: PGLvoid){.dynlib: dllname,
     importc: "glElementPointerATI".}
-proc glDrawElementArrayATI*(mode: TGLenum, count: TGLsizei){.dynlib: dllname, 
+proc glDrawElementArrayATI*(mode: TGLenum, count: TGLsizei){.dynlib: dllname,
     importc: "glDrawElementArrayATI".}
-proc glDrawRangeElementArrayATI*(mode: TGLenum, start: TGLuint, theend: TGLuint, 
-                                 count: TGLsizei){.dynlib: dllname, 
+proc glDrawRangeElementArrayATI*(mode: TGLenum, start: TGLuint, theend: TGLuint,
+                                 count: TGLsizei){.dynlib: dllname,
     importc: "glDrawRangeElementArrayATI".}
   #***** GL_ATI_envmap_bumpmap *****//
-const 
+const
   GL_BUMP_ROT_MATRIX_ATI* = 0x00008775
   GL_BUMP_ROT_MATRIX_SIZE_ATI* = 0x00008776
   GL_BUMP_NUM_TEX_UNITS_ATI* = 0x00008777
@@ -2666,16 +2666,16 @@ const
   GL_BUMP_ENVMAP_ATI* = 0x0000877B
   GL_BUMP_TARGET_ATI* = 0x0000877C
 
-proc glTexBumpParameterivATI*(pname: TGLenum, param: PGLint){.dynlib: dllname, 
+proc glTexBumpParameterivATI*(pname: TGLenum, param: PGLint){.dynlib: dllname,
     importc: "glTexBumpParameterivATI".}
-proc glTexBumpParameterfvATI*(pname: TGLenum, param: PGLfloat){.dynlib: dllname, 
+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 
+const
   GL_FRAGMENT_SHADER_ATI* = 0x00008920
   GL_REG_0_ATI* = 0x00008921
   GL_REG_1_ATI* = 0x00008922
@@ -2721,51 +2721,51 @@ const
   GL_NEGATE_BIT_ATI* = 0x00000004
   GL_BIAS_BIT_ATI* = 0x00000008
 
-proc glGenFragmentShadersATI*(range: TGLuint): TGLuint{.dynlib: dllname, 
+proc glGenFragmentShadersATI*(range: TGLuint): TGLuint{.dynlib: dllname,
     importc: "glGenFragmentShadersATI".}
-proc glBindFragmentShaderATI*(id: TGLuint){.dynlib: dllname, 
+proc glBindFragmentShaderATI*(id: TGLuint){.dynlib: dllname,
     importc: "glBindFragmentShaderATI".}
-proc glDeleteFragmentShaderATI*(id: TGLuint){.dynlib: dllname, 
+proc glDeleteFragmentShaderATI*(id: TGLuint){.dynlib: dllname,
     importc: "glDeleteFragmentShaderATI".}
-proc glBeginFragmentShaderATI*(){.dynlib: dllname, 
+proc glBeginFragmentShaderATI*(){.dynlib: dllname,
                                   importc: "glBeginFragmentShaderATI".}
-proc glEndFragmentShaderATI*(){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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 
+const
   GL_PN_TRIANGLES_ATI* = 0x000087F0
   GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI* = 0x000087F1
   GL_PN_TRIANGLES_POINT_MODE_ATI* = 0x000087F2
@@ -2776,17 +2776,17 @@ const
   GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI* = 0x000087F7
   GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI* = 0x000087F8
 
-proc glPNTrianglesiATI*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glPNTrianglesiATI*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glPNTrianglesiATI".}
-proc glPNTrianglesfATI*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glPNTrianglesfATI*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glPNTrianglesfATI".}
   #***** GL_ATI_texture_mirror_once *****//
-const 
+const
   GL_MIRROR_CLAMP_ATI* = 0x00008742
   GL_MIRROR_CLAMP_TO_EDGE_ATI* = 0x00008743
   #***** GL_ATI_vertex_array_object *****//
 
-const 
+const
   GL_STATIC_ATI* = 0x00008760
   GL_DYNAMIC_ATI* = 0x00008761
   GL_PRESERVE_ATI* = 0x00008762
@@ -2798,25 +2798,25 @@ const
 
 proc glNewObjectBufferATI*(size: TGLsizei, pointer: PGLvoid, usage: TGLenum): TGLuint{.
     dynlib: dllname, importc: "glNewObjectBufferATI".}
-proc glIsObjectBufferATI*(buffer: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsObjectBufferATI*(buffer: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsObjectBufferATI".}
-proc glUpdateObjectBufferATI*(buffer: TGLuint, offset: TGLuint, size: TGLsizei, 
+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, 
+proc glDeleteObjectBufferATI*(buffer: TGLuint){.dynlib: dllname,
     importc: "glDeleteObjectBufferATI".}
-proc glArrayObjectATI*(thearray: TGLenum, size: TGLint, thetype: TGLenum, 
+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, 
+proc glVariantArrayObjectATI*(id: TGLuint, thetype: TGLenum, stride: TGLsizei,
                               buffer: TGLuint, offset: TGLuint){.
     dynlib: dllname, importc: "glVariantArrayObjectATI".}
 proc glGetVariantArrayObjectfvATI*(id: TGLuint, pname: TGLenum, params: PGLfloat){.
@@ -2824,7 +2824,7 @@ proc glGetVariantArrayObjectfvATI*(id: TGLuint, pname: TGLenum, params: PGLfloat
 proc glGetVariantArrayObjectivATI*(id: TGLuint, pname: TGLenum, params: PGLint){.
     dynlib: dllname, importc: "glGetVariantArrayObjectivATI".}
   #***** GL_ATI_vertex_streams *****//
-const 
+const
   GL_MAX_VERTEX_STREAMS_ATI* = 0x0000876B
   GL_VERTEX_STREAM0_ATI* = 0x0000876C
   GL_VERTEX_STREAM1_ATI* = 0x0000876D
@@ -2836,123 +2836,123 @@ const
   GL_VERTEX_STREAM7_ATI* = 0x00008773
   GL_VERTEX_SOURCE_ATI* = 0x00008774
 
-proc glVertexStream1s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream1s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream1s".}
-proc glVertexStream1i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream1i*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream1i".}
-proc glVertexStream1f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream1f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream1f".}
-proc glVertexStream1d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream1d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream1d".}
-proc glVertexStream1sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream1sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream1sv".}
-proc glVertexStream1iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream1iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream1iv".}
-proc glVertexStream1fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream1fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream1fv".}
-proc glVertexStream1dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream1dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream1dv".}
-proc glVertexStream2s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream2s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream2s".}
-proc glVertexStream2i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream2i*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream2i".}
-proc glVertexStream2f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream2f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream2f".}
-proc glVertexStream2d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream2d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream2d".}
-proc glVertexStream2sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream2sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream2sv".}
-proc glVertexStream2iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream2iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream2iv".}
-proc glVertexStream2fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream2fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream2fv".}
-proc glVertexStream2dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream2dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream2dv".}
-proc glVertexStream3s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream3s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream3s".}
-proc glVertexStream3i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream3i*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream3i".}
-proc glVertexStream3f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream3f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream3f".}
-proc glVertexStream3d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream3d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream3d".}
-proc glVertexStream3sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream3sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream3sv".}
-proc glVertexStream3iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream3iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream3iv".}
-proc glVertexStream3fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream3fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream3fv".}
-proc glVertexStream3dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream3dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream3dv".}
-proc glVertexStream4s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream4s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream4s".}
-proc glVertexStream4i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream4i*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream4i".}
-proc glVertexStream4f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream4f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream4f".}
-proc glVertexStream4d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream4d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream4d".}
-proc glVertexStream4sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glVertexStream4sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glVertexStream4sv".}
-proc glVertexStream4iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glVertexStream4iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glVertexStream4iv".}
-proc glVertexStream4fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glVertexStream4fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glVertexStream4fv".}
-proc glVertexStream4dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glVertexStream4dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glVertexStream4dv".}
-proc glNormalStream3b*(stream: TGLenum, coords: TGLByte){.dynlib: dllname, 
+proc glNormalStream3b*(stream: TGLenum, coords: TGLByte){.dynlib: dllname,
     importc: "glNormalStream3b".}
-proc glNormalStream3s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glNormalStream3s*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glNormalStream3s".}
-proc glNormalStream3i*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glNormalStream3i*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glNormalStream3i".}
-proc glNormalStream3f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glNormalStream3f*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glNormalStream3f".}
-proc glNormalStream3d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glNormalStream3d*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glNormalStream3d".}
-proc glNormalStream3bv*(stream: TGLenum, coords: TGLByte){.dynlib: dllname, 
+proc glNormalStream3bv*(stream: TGLenum, coords: TGLByte){.dynlib: dllname,
     importc: "glNormalStream3bv".}
-proc glNormalStream3sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname, 
+proc glNormalStream3sv*(stream: TGLenum, coords: TGLshort){.dynlib: dllname,
     importc: "glNormalStream3sv".}
-proc glNormalStream3iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname, 
+proc glNormalStream3iv*(stream: TGLenum, coords: TGLint){.dynlib: dllname,
     importc: "glNormalStream3iv".}
-proc glNormalStream3fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname, 
+proc glNormalStream3fv*(stream: TGLenum, coords: TGLfloat){.dynlib: dllname,
     importc: "glNormalStream3fv".}
-proc glNormalStream3dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname, 
+proc glNormalStream3dv*(stream: TGLenum, coords: TGLdouble){.dynlib: dllname,
     importc: "glNormalStream3dv".}
-proc glClientActiveVertexStream*(stream: TGLenum){.dynlib: dllname, 
+proc glClientActiveVertexStream*(stream: TGLenum){.dynlib: dllname,
     importc: "glClientActiveVertexStream".}
-proc glVertexBlendEnvi*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glVertexBlendEnvi*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glVertexBlendEnvi".}
-proc glVertexBlendEnvf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glVertexBlendEnvf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glVertexBlendEnvf".}
   #***** GL_3DFX_texture_compression_FXT1 *****//
-const 
+const
   GL_COMPRESSED_RGB_FXT1_3DFX* = 0x000086B0
   GL_COMPRESSED_RGBA_FXT1_3DFX* = 0x000086B1
   #***** GL_IBM_cull_vertex *****//
 
-const 
+const
   GL_CULL_VERTEX_IBM* = 0x0001928A
   #***** GL_IBM_multimode_draw_arrays *****//
 
-proc glMultiModeDrawArraysIBM*(mode: PGLenum, first: PGLint, count: PGLsizei, 
+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, 
+proc glMultiModeDrawElementsIBM*(mode: PGLenum, count: PGLsizei,
+                                 thetype: TGLenum, indices: PGLvoid,
                                  primcount: TGLsizei, modestride: TGLint){.
     dynlib: dllname, importc: "glMultiModeDrawElementsIBM".}
   #***** GL_IBM_raster_pos_clip *****//
-const 
+const
   GL_RASTER_POSITION_UNCLIPPED_IBM* = 0x00019262
   #***** GL_IBM_texture_mirrored_repeat *****//
 
-const 
+const
   GL_MIRRORED_REPEAT_IBM* = 0x00008370
   #***** GL_IBM_vertex_array_lists *****//
 
-const 
+const
   GL_VERTEX_ARRAY_LIST_IBM* = 0x0001929E
   GL_NORMAL_ARRAY_LIST_IBM* = 0x0001929F
   GL_COLOR_ARRAY_LIST_IBM* = 0x000192A0
@@ -2970,62 +2970,62 @@ const
   GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM* = 0x000192AE
   GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM* = 0x000192AF
 
-proc glColorPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint, 
+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, 
+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, 
+proc glEdgeFlagPointerListIBM*(stride: TGLint, pointer: PGLboolean,
+                               ptrstride: TGLint){.dynlib: dllname,
     importc: "glEdgeFlagPointerListIBM".}
-proc glFogCoordPointerListIBM*(thetype: TGLenum, stride: TGLint, 
+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, 
+proc glNormalPointerListIBM*(thetype: TGLenum, stride: TGLint, pointer: PGLvoid,
+                             ptrstride: TGLint){.dynlib: dllname,
     importc: "glNormalPointerListIBM".}
-proc glTexCoordPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint, 
+proc glTexCoordPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint,
                                pointer: PGLvoid, ptrstride: TGLint){.
     dynlib: dllname, importc: "glTexCoordPointerListIBM".}
-proc glVertexPointerListIBM*(size: TGLint, thetype: TGLenum, stride: TGLint, 
+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, 
+proc glWindowPos2dMESA*(x: TGLdouble, y: TGLdouble){.dynlib: dllname,
     importc: "glWindowPos2dMESA".}
-proc glWindowPos2fMESA*(x: TGLfloat, y: TGLfloat){.dynlib: dllname, 
+proc glWindowPos2fMESA*(x: TGLfloat, y: TGLfloat){.dynlib: dllname,
     importc: "glWindowPos2fMESA".}
-proc glWindowPos2iMESA*(x: TGLint, y: TGLint){.dynlib: dllname, 
+proc glWindowPos2iMESA*(x: TGLint, y: TGLint){.dynlib: dllname,
     importc: "glWindowPos2iMESA".}
-proc glWindowPos2sMESA*(x: TGLshort, y: TGLshort){.dynlib: dllname, 
+proc glWindowPos2sMESA*(x: TGLshort, y: TGLshort){.dynlib: dllname,
     importc: "glWindowPos2sMESA".}
-proc glWindowPos2ivMESA*(p: PGLint){.dynlib: dllname, 
+proc glWindowPos2ivMESA*(p: PGLint){.dynlib: dllname,
                                      importc: "glWindowPos2ivMESA".}
-proc glWindowPos2svMESA*(p: PGLshort){.dynlib: dllname, 
+proc glWindowPos2svMESA*(p: PGLshort){.dynlib: dllname,
                                        importc: "glWindowPos2svMESA".}
-proc glWindowPos2fvMESA*(p: PGLfloat){.dynlib: dllname, 
+proc glWindowPos2fvMESA*(p: PGLfloat){.dynlib: dllname,
                                        importc: "glWindowPos2fvMESA".}
-proc glWindowPos2dvMESA*(p: PGLdouble){.dynlib: dllname, 
+proc glWindowPos2dvMESA*(p: PGLdouble){.dynlib: dllname,
                                         importc: "glWindowPos2dvMESA".}
-proc glWindowPos3iMESA*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname, 
+proc glWindowPos3iMESA*(x: TGLint, y: TGLint, z: TGLint){.dynlib: dllname,
     importc: "glWindowPos3iMESA".}
-proc glWindowPos3sMESA*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname, 
+proc glWindowPos3sMESA*(x: TGLshort, y: TGLshort, z: TGLshort){.dynlib: dllname,
     importc: "glWindowPos3sMESA".}
-proc glWindowPos3fMESA*(x: TGLfloat, y: TGLfloat, z: TGLfloat){.dynlib: dllname, 
+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, 
+proc glWindowPos3ivMESA*(p: PGLint){.dynlib: dllname,
                                      importc: "glWindowPos3ivMESA".}
-proc glWindowPos3svMESA*(p: PGLshort){.dynlib: dllname, 
+proc glWindowPos3svMESA*(p: PGLshort){.dynlib: dllname,
                                        importc: "glWindowPos3svMESA".}
-proc glWindowPos3fvMESA*(p: PGLfloat){.dynlib: dllname, 
+proc glWindowPos3fvMESA*(p: PGLfloat){.dynlib: dllname,
                                        importc: "glWindowPos3fvMESA".}
-proc glWindowPos3dvMESA*(p: PGLdouble){.dynlib: dllname, 
+proc glWindowPos3dvMESA*(p: PGLdouble){.dynlib: dllname,
                                         importc: "glWindowPos3dvMESA".}
 proc glWindowPos4iMESA*(x: TGLint, y: TGLint, z: TGLint, w: TGLint){.
     dynlib: dllname, importc: "glWindowPos4iMESA".}
@@ -3035,21 +3035,21 @@ 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, 
+proc glWindowPos4ivMESA*(p: PGLint){.dynlib: dllname,
                                      importc: "glWindowPos4ivMESA".}
-proc glWindowPos4svMESA*(p: PGLshort){.dynlib: dllname, 
+proc glWindowPos4svMESA*(p: PGLshort){.dynlib: dllname,
                                        importc: "glWindowPos4svMESA".}
-proc glWindowPos4fvMESA*(p: PGLfloat){.dynlib: dllname, 
+proc glWindowPos4fvMESA*(p: PGLfloat){.dynlib: dllname,
                                        importc: "glWindowPos4fvMESA".}
-proc glWindowPos4dvMESA*(p: PGLdouble){.dynlib: dllname, 
+proc glWindowPos4dvMESA*(p: PGLdouble){.dynlib: dllname,
                                         importc: "glWindowPos4dvMESA".}
   #***** GL_OML_interlace *****//
-const 
+const
   GL_INTERLACE_OML* = 0x00008980
   GL_INTERLACE_READ_OML* = 0x00008981
   #***** GL_OML_resample *****//
 
-const 
+const
   GL_PACK_RESAMPLE_OML* = 0x00008984
   GL_UNPACK_RESAMPLE_OML* = 0x00008985
   GL_RESAMPLE_REPLICATE_OML* = 0x00008986
@@ -3058,17 +3058,17 @@ const
   GL_RESAMPLE_DECIMATE_OML* = 0x00008989 # GL_RESAMPLE_AVERAGE_OML  { already defined }
   #***** GL_OML_subsample *****//
 
-const 
+const
   GL_FORMAT_SUBSAMPLE_24_24_OML* = 0x00008982
   GL_FORMAT_SUBSAMPLE_244_244_OML* = 0x00008983
   #***** GL_SGIS_generate_mipmap *****//
 
-const 
+const
   GL_GENERATE_MIPMAP_SGIS* = 0x00008191
   GL_GENERATE_MIPMAP_HINT_SGIS* = 0x00008192
   #***** GL_SGIS_multisample *****//
 
-const 
+const
   GLX_SAMPLE_BUFFERS_SGIS* = 0x000186A0
   GLX_SAMPLES_SGIS* = 0x000186A1
   GL_MULTISAMPLE_SGIS* = 0x0000809D
@@ -3089,12 +3089,12 @@ const
   GL_SAMPLE_MASK_INVERT_SGIS* = 0x000080AB
   constGL_SAMPLE_PATTERN_SGIS* = 0x000080AC
 
-proc glSampleMaskSGIS*(value: TGLclampf, invert: TGLboolean){.dynlib: dllname, 
+proc glSampleMaskSGIS*(value: TGLclampf, invert: TGLboolean){.dynlib: dllname,
     importc: "glSampleMaskSGIS".}
-proc glSamplePatternSGIS*(pattern: TGLenum){.dynlib: dllname, 
+proc glSamplePatternSGIS*(pattern: TGLenum){.dynlib: dllname,
     importc: "glSamplePatternSGIS".}
   #***** GL_SGIS_pixel_texture *****//
-const 
+const
   GL_PIXEL_TEXTURE_SGIS* = 0x00008353
   GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS* = 0x00008354
   GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS* = 0x00008355
@@ -3111,44 +3111,44 @@ proc glGetPixelTexGenParameterfvSGIS*(pname: TGLenum, params: TGLfloat){.
   #***** GL_SGIS_texture_border_clamp *****//
   # GL_CLAMP_TO_BORDER_SGIS  { already defined }
   #***** GL_SGIS_texture_color_mask *****//
-const 
+const
   GL_TEXTURE_COLOR_WRITEMASK_SGIS* = 0x000081EF
 
-proc glTextureColorMaskSGIS*(r: TGLboolean, g: TGLboolean, b: TGLboolean, 
-                             a: TGLboolean){.dynlib: dllname, 
+proc glTextureColorMaskSGIS*(r: TGLboolean, g: TGLboolean, b: TGLboolean,
+                             a: TGLboolean){.dynlib: dllname,
     importc: "glTextureColorMaskSGIS".}
   #***** GL_SGIS_texture_edge_clamp *****//
-const 
+const
   GL_CLAMP_TO_EDGE_SGIS* = 0x0000812F
   #***** GL_SGIS_texture_lod *****//
 
-const 
+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 
+const
   GL_DEPTH_COMPONENT16_SGIX* = 0x000081A5
   GL_DEPTH_COMPONENT24_SGIX* = 0x000081A6
   GL_DEPTH_COMPONENT32_SGIX* = 0x000081A7
   #***** GL_SGIX_fog_offset *****//
 
-const 
+const
   GL_FOG_OFFSET_SGIX* = 0x00008198
   GL_FOG_OFFSET_VALUE_SGIX* = 0x00008199
   #***** GL_SGIX_interlace *****//
 
-const 
+const
   GL_INTERLACE_SGIX* = 0x00008094
   #***** GL_SGIX_shadow_ambient *****//
 
-const 
+const
   GL_SHADOW_AMBIENT_SGIX* = 0x000080BF
   #***** GL_SGI_color_matrix *****//
 
-const 
+const
   GL_COLOR_MATRIX_SGI* = 0x000080B1
   GL_COLOR_MATRIX_STACK_DEPTH_SGI* = 0x000080B2
   GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI* = 0x000080B3
@@ -3162,7 +3162,7 @@ const
   GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI* = 0x000080BB
   #***** GL_SGI_color_table *****//
 
-const 
+const
   constGL_COLOR_TABLE_SGI* = 0x000080D0
   GL_POST_CONVOLUTION_COLOR_TABLE_SGI* = 0x000080D1
   GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI* = 0x000080D2
@@ -3180,151 +3180,151 @@ const
   GL_COLOR_TABLE_LUMINANCE_SIZE_SGI* = 0x000080DE
   GL_COLOR_TABLE_INTENSITY_SIZE_SGI* = 0x000080DF
 
-proc glColorTableSGI*(target: TGLenum, internalformat: TGLenum, width: TGLsizei, 
+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, 
+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, 
+proc glColorTableParameterfvSGI*(target: TGLenum, pname: TGLenum,
+                                 params: PGLfloat){.dynlib: dllname,
     importc: "glColorTableParameterfvSGI".}
-proc glGetColorTableSGI*(target: TGLenum, format: TGLenum, thetype: TGLenum, 
-                         table: PGLvoid){.dynlib: dllname, 
+proc glGetColorTableSGI*(target: TGLenum, format: TGLenum, thetype: TGLenum,
+                         table: PGLvoid){.dynlib: dllname,
     importc: "glGetColorTableSGI".}
-proc glGetColorTableParameterivSGI*(target: TGLenum, pname: TGLenum, 
-                                    params: PGLint){.dynlib: dllname, 
+proc glGetColorTableParameterivSGI*(target: TGLenum, pname: TGLenum,
+                                    params: PGLint){.dynlib: dllname,
     importc: "glGetColorTableParameterivSGI".}
-proc glGetColorTableParameterfvSGI*(target: TGLenum, pname: TGLenum, 
-                                    params: PGLfloat){.dynlib: dllname, 
+proc glGetColorTableParameterfvSGI*(target: TGLenum, pname: TGLenum,
+                                    params: PGLfloat){.dynlib: dllname,
     importc: "glGetColorTableParameterfvSGI".}
   #***** GL_SGI_texture_color_table *****//
-const 
+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, 
+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, 
+proc glColor4ubVertex2fvSUN*(c: PGLubyte, v: PGLfloat){.dynlib: dllname,
     importc: "glColor4ubVertex2fvSUN".}
-proc glColor4ubVertex3fSUN*(r: TGLubyte, g: TGLubyte, b: TGLubyte, a: TGLubyte, 
+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, 
+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, 
+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, 
+proc glColor3fVertex3fvSUN*(c: PGLfloat, v: PGLfloat){.dynlib: dllname,
     importc: "glColor3fVertex3fvSUN".}
-proc glNormal3fVertex3fSUN*(nx: TGLfloat, ny: TGLfloat, nz: TGLfloat, 
+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, 
+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, 
+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, 
+proc glTexCoord2fVertex3fSUN*(s: TGLfloat, t: TGLfloat, x: TGLfloat,
+                              y: TGLfloat, z: TGLfloat){.dynlib: dllname,
     importc: "glTexCoord2fVertex3fSUN".}
-proc glTexCoord2fVertex3fvSUN*(tc: PGLfloat, v: PGLfloat){.dynlib: dllname, 
+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, 
+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, 
+proc glTexCoord4fVertex4fvSUN*(tc: PGLfloat, v: PGLfloat){.dynlib: dllname,
     importc: "glTexCoord4fVertex4fvSUN".}
-proc glTexCoord2fColor4ubVertex3fSUN*(s: TGLfloat, t: TGLfloat, r: TGLubyte, 
-                                      g: TGLubyte, b: TGLubyte, a: TGLubyte, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glReplacementCodeuiColor4ubVertex3fvSUN*(rc: PGLuint, c: PGLubyte,
+    v: PGLfloat){.dynlib: dllname,
                   importc: "glReplacementCodeuiColor4ubVertex3fvSUN".}
-proc glReplacementCodeuiColor3fVertex3fSUN*(rc: TGLuint, r: TGLfloat, 
+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, 
+proc glReplacementCodeuiColor3fVertex3fvSUN*(rc: PGLuint, c: PGLfloat,
+    v: PGLfloat){.dynlib: dllname,
                   importc: "glReplacementCodeuiColor3fVertex3fvSUN".}
-proc glReplacementCodeuiNormal3fVertex3fSUN*(rc: TGLuint, nx: TGLfloat, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN*(rc: PGLuint,
+    tc: PGLfloat, c: PGLfloat, n: PGLfloat, v: PGLfloat){.dynlib: dllname,
     importc: "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN".}
   #***** GL_ARB_fragment_program *****//
-const 
+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 }
@@ -3360,21 +3360,21 @@ const
   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 }
@@ -3431,10 +3431,10 @@ const
                                                # glIsProgramARB  { already defined }
   #***** GL_ATI_text_fragment_shader *****
 
-const 
+const
   GL_TEXT_FRAGMENT_SHADER_ATI* = 0x00008200 #***** GL_ARB_vertex_buffer_object *****
 
-const 
+const
   GL_BUFFER_SIZE_ARB* = 0x00008764
   GL_BUFFER_USAGE_ARB* = 0x00008765
   GL_ARRAY_BUFFER_ARB* = 0x00008892
@@ -3467,37 +3467,37 @@ const
   GL_DYNAMIC_READ_ARB* = 0x000088E9
   GL_DYNAMIC_COPY_ARB* = 0x000088EA
 
-proc glBindBufferARB*(target: TGLenum, buffer: TGLuint){.dynlib: dllname, 
+proc glBindBufferARB*(target: TGLenum, buffer: TGLuint){.dynlib: dllname,
     importc: "glBindBufferARB".}
-proc glDeleteBuffersARB*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, 
+proc glDeleteBuffersARB*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname,
     importc: "glDeleteBuffersARB".}
-proc glGenBuffersARB*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, 
+proc glGenBuffersARB*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname,
     importc: "glGenBuffersARB".}
-proc glIsBufferARB*(buffer: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsBufferARB*(buffer: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsBufferARB".}
-proc glBufferDataARB*(target: TGLenum, size: TGLsizei, data: PGLvoid, 
-                      usage: TGLenum){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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 
+const
   GL_UNPACK_CLIENT_STORAGE_APPLE* = 0x000085B2
   #***** GL_APPLE_element_array *****//
 
-const 
+const
   GL_ELEMENT_ARRAY_APPLE* = 0x00008768
   GL_ELEMENT_ARRAY_TYPE_APPLE* = 0x00008769
   GL_ELEMENT_ARRAY_POINTER_APPLE* = 0x0000876A
@@ -3506,52 +3506,52 @@ 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, 
+proc glDrawRangeElementArrayAPPLE*(mode: TGLenum, start: TGLuint,
+                                   theend: TGLuint, first: TGLint,
+                                   count: TGLsizei){.dynlib: dllname,
     importc: "glDrawRangeElementArrayAPPLE".}
-proc glMultiDrawElementArrayAPPLE*(mode: TGLenum, first: PGLint, 
+proc glMultiDrawElementArrayAPPLE*(mode: TGLenum, first: PGLint,
                                    count: PGLsizei, primcount: TGLsizei){.
     dynlib: dllname, importc: "glMultiDrawElementArrayAPPLE".}
-proc glMultiDrawRangeElementArrayAPPLE*(mode: TGLenum, start: TGLuint, 
-                                        theend: TGLuint, first: PGLint, 
+proc glMultiDrawRangeElementArrayAPPLE*(mode: TGLenum, start: TGLuint,
+                                        theend: TGLuint, first: PGLint,
                                         count: PGLsizei, primcount: TGLsizei){.
     dynlib: dllname, importc: "glMultiDrawRangeElementArrayAPPLE".}
   #***** GL_APPLE_fence *****//
-const 
+const
   GL_DRAW_PIXELS_APPLE* = 0x00008A0A
   GL_FENCE_APPLE* = 0x00008A0B
 
-proc glGenFencesAPPLE*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, 
+proc glGenFencesAPPLE*(n: TGLsizei, fences: PGLuint){.dynlib: dllname,
     importc: "glGenFencesAPPLE".}
-proc glDeleteFencesAPPLE*(n: TGLsizei, fences: PGLuint){.dynlib: dllname, 
+proc glDeleteFencesAPPLE*(n: TGLsizei, fences: PGLuint){.dynlib: dllname,
     importc: "glDeleteFencesAPPLE".}
-proc glSetFenceAPPLE*(fence: TGLuint){.dynlib: dllname, 
+proc glSetFenceAPPLE*(fence: TGLuint){.dynlib: dllname,
                                        importc: "glSetFenceAPPLE".}
-proc glIsFenceAPPLE*(fence: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsFenceAPPLE*(fence: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsFenceAPPLE".}
-proc glTestFenceAPPLE*(fence: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glTestFenceAPPLE*(fence: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glTestFenceAPPLE".}
-proc glFinishFenceAPPLE*(fence: TGLuint){.dynlib: dllname, 
+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, 
+proc glFinishObjectAPPLE*(theobject: TGLenum, name: TGLint){.dynlib: dllname,
     importc: "glFinishObjectAPPLE".}
   #***** GL_APPLE_vertex_array_object *****//
-const 
+const
   GL_VERTEX_ARRAY_BINDING_APPLE* = 0x000085B5
 
-proc glBindVertexArrayAPPLE*(thearray: TGLuint){.dynlib: dllname, 
+proc glBindVertexArrayAPPLE*(thearray: TGLuint){.dynlib: dllname,
     importc: "glBindVertexArrayAPPLE".}
-proc glDeleteVertexArraysAPPLE*(n: TGLsizei, arrays: PGLuint){.dynlib: dllname, 
+proc glDeleteVertexArraysAPPLE*(n: TGLsizei, arrays: PGLuint){.dynlib: dllname,
     importc: "glDeleteVertexArraysAPPLE".}
-proc glGenVertexArraysAPPLE*(n: TGLsizei, arrays: PGLuint){.dynlib: dllname, 
+proc glGenVertexArraysAPPLE*(n: TGLsizei, arrays: PGLuint){.dynlib: dllname,
     importc: "glGenVertexArraysAPPLE".}
-proc glIsVertexArrayAPPLE*(thearray: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsVertexArrayAPPLE*(thearray: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsVertexArrayAPPLE".}
   #***** GL_APPLE_vertex_array_range *****//
-const 
+const
   constGL_VERTEX_ARRAY_RANGE_APPLE* = 0x0000851D
   GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE* = 0x0000851E
   GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE* = 0x00008520
@@ -3560,14 +3560,14 @@ const
   GL_STORAGE_CACHED_APPLE* = 0x000085BE
   GL_STORAGE_SHARED_APPLE* = 0x000085BF
 
-proc glVertexArrayRangeAPPLE*(len: TGLsizei, pointer: PGLvoid){.dynlib: dllname, 
+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 
+const
   GL_MATRIX_PALETTE_ARB* = 0x00008840
   GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB* = 0x00008841
   GL_MAX_PALETTE_MATRICES_ARB* = 0x00008842
@@ -3579,38 +3579,38 @@ const
   GL_MATRIX_INDEX_ARRAY_STRIDE_ARB* = 0x00008848
   GL_MATRIX_INDEX_ARRAY_POINTER_ARB* = 0x00008849
 
-proc glCurrentPaletteMatrixARB*(index: TGLint){.dynlib: dllname, 
+proc glCurrentPaletteMatrixARB*(index: TGLint){.dynlib: dllname,
     importc: "glCurrentPaletteMatrixARB".}
-proc glMatrixIndexubvARB*(size: TGLint, indices: PGLubyte){.dynlib: dllname, 
+proc glMatrixIndexubvARB*(size: TGLint, indices: PGLubyte){.dynlib: dllname,
     importc: "glMatrixIndexubvARB".}
-proc glMatrixIndexusvARB*(size: TGLint, indices: PGLushort){.dynlib: dllname, 
+proc glMatrixIndexusvARB*(size: TGLint, indices: PGLushort){.dynlib: dllname,
     importc: "glMatrixIndexusvARB".}
-proc glMatrixIndexuivARB*(size: TGLint, indices: PGLuint){.dynlib: dllname, 
+proc glMatrixIndexuivARB*(size: TGLint, indices: PGLuint){.dynlib: dllname,
     importc: "glMatrixIndexuivARB".}
-proc glMatrixIndexPointerARB*(size: TGLint, thetype: TGLenum, stride: TGLsizei, 
-                              pointer: PGLvoid){.dynlib: dllname, 
+proc glMatrixIndexPointerARB*(size: TGLint, thetype: TGLenum, stride: TGLsizei,
+                              pointer: PGLvoid){.dynlib: dllname,
     importc: "glMatrixIndexPointerARB".}
   #***** GL_NV_element_array *****//
-const 
+const
   GL_ELEMENT_ARRAY_TYPE_NV* = 0x00008769
   GL_ELEMENT_ARRAY_POINTER_NV* = 0x0000876A
 
-proc glElementPointerNV*(thetype: TGLenum, pointer: PGLvoid){.dynlib: dllname, 
+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, 
+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, 
+proc glMultiDrawElementArrayNV*(mode: TGLenum, first: PGLint, count: PGLsizei,
+                                primcount: TGLsizei){.dynlib: dllname,
     importc: "glMultiDrawElementArrayNV".}
-proc glMultiDrawRangeElementArrayNV*(mode: TGLenum, start: TGLuint, 
-                                     theend: TGLuint, first: PGLint, 
+proc glMultiDrawRangeElementArrayNV*(mode: TGLenum, start: TGLuint,
+                                     theend: TGLuint, first: PGLint,
                                      count: PGLsizei, primcount: TGLsizei){.
     dynlib: dllname, importc: "glMultiDrawRangeElementArrayNV".}
   #***** GL_NV_float_buffer *****//
-const 
+const
   GL_FLOAT_R_NV* = 0x00008880
   GL_FLOAT_RG_NV* = 0x00008881
   GL_FLOAT_RGB_NV* = 0x00008882
@@ -3628,7 +3628,7 @@ const
   GL_FLOAT_RGBA_MODE_NV* = 0x0000888E
   #***** GL_NV_fragment_program *****//
 
-const 
+const
   GL_FRAGMENT_PROGRAM_NV* = 0x00008870
   GL_MAX_TEXTURE_COORDS_NV* = 0x00008871
   GL_MAX_TEXTURE_IMAGE_UNITS_NV* = 0x00008872
@@ -3636,18 +3636,18 @@ const
   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, 
+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, 
+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, 
+proc glGetProgramNamedParameterfvNV*(id: TGLuint, length: TGLsizei,
                                      name: PGLubyte, params: PGLfloat){.
     dynlib: dllname, importc: "glGetProgramNamedParameterfvNV".}
-proc glGetProgramNamedParameterdvNV*(id: TGLuint, length: TGLsizei, 
+proc glGetProgramNamedParameterdvNV*(id: TGLuint, length: TGLsizei,
                                      name: PGLubyte, params: PGLdouble){.
     dynlib: dllname, importc: "glGetProgramNamedParameterdvNV".}
   # glProgramLocalParameter4dARB  { already defined }
@@ -3657,16 +3657,16 @@ proc glGetProgramNamedParameterdvNV*(id: TGLuint, length: TGLsizei,
   # glGetProgramLocalParameterdvARB  { already defined }
   # glGetProgramLocalParameterfvARB  { already defined }
   #***** GL_NV_primitive_restart *****//
-const 
+const
   constGL_PRIMITIVE_RESTART_NV* = 0x00008558
   constGL_PRIMITIVE_RESTART_INDEX_NV* = 0x00008559
 
 proc glPrimitiveRestartNV*(){.dynlib: dllname, importc: "glPrimitiveRestartNV".}
-proc glPrimitiveRestartIndexNV*(index: TGLuint){.dynlib: dllname, 
+proc glPrimitiveRestartIndexNV*(index: TGLuint){.dynlib: dllname,
     importc: "glPrimitiveRestartIndexNV".}
   #***** GL_NV_vertex_program2 *****//
   #***** GL_NV_pixel_data_range *****//
-const 
+const
   GL_WRITE_PIXEL_DATA_RANGE_NV* = 0x00008878
   GL_READ_PIXEL_DATA_RANGE_NV* = 0x00008879
   GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV* = 0x0000887A
@@ -3676,26 +3676,26 @@ const
 
 proc glPixelDataRangeNV*(target: TGLenum, len: TGLsizei, pointer: PGLvoid){.
     dynlib: dllname, importc: "glPixelDataRangeNV".}
-proc glFlushPixelDataRangeNV*(target: TGLenum){.dynlib: dllname, 
+proc glFlushPixelDataRangeNV*(target: TGLenum){.dynlib: dllname,
     importc: "glFlushPixelDataRangeNV".}
   # wglAllocateMemoryNV  { already defined }
   # wglFreeMemoryNV  { already defined }
   #***** GL_EXT_texture_rectangle *****//
-const 
+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 
+const
   GL_RGB_S3TC* = 0x000083A0
   GL_RGB4_S3TC* = 0x000083A1
   GL_RGBA_S3TC* = 0x000083A2
   GL_RGBA4_S3TC* = 0x000083A3
   #***** GL_ATI_draw_buffers *****//
 
-const 
+const
   GL_MAX_DRAW_BUFFERS_ATI* = 0x00008824
   GL_DRAW_BUFFER0_ATI* = 0x00008825
   GL_DRAW_BUFFER1_ATI* = 0x00008826
@@ -3714,16 +3714,16 @@ const
   GL_DRAW_BUFFER14_ATI* = 0x00008833
   GL_DRAW_BUFFER15_ATI* = 0x00008834
 
-proc glDrawBuffersATI*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname, 
+proc glDrawBuffersATI*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname,
     importc: "glDrawBuffersATI".}
   #***** GL_ATI_texture_env_combine3 *****//
-const 
+const
   GL_MODULATE_ADD_ATI* = 0x00008744
   GL_MODULATE_SIGNED_ADD_ATI* = 0x00008745
   GL_MODULATE_SUBTRACT_ATI* = 0x00008746
   #***** GL_ATI_texture_float *****//
 
-const 
+const
   GL_RGBA_FLOAT32_ATI* = 0x00008814
   GL_RGB_FLOAT32_ATI* = 0x00008815
   GL_ALPHA_FLOAT32_ATI* = 0x00008816
@@ -3738,17 +3738,17 @@ const
   GL_LUMINANCE_ALPHA_FLOAT16_ATI* = 0x0000881F
   #***** GL_NV_texture_expand_normal *****//
 
-const 
+const
   GL_TEXTURE_UNSIGNED_REMAP_MODE_NV* = 0x0000888F
   #***** GL_NV_half_float *****//
 
-const 
+const
   GL_HALF_FLOAT_NV* = 0x0000140B
 
-proc glVertex2hNV*(x: TGLushort, y: TGLushort){.dynlib: dllname, 
+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, 
+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){.
@@ -3760,65 +3760,65 @@ 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, 
+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, 
+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, 
+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, 
+proc glMultiTexCoord1hNV*(target: TGLenum, s: TGLushort){.dynlib: dllname,
     importc: "glMultiTexCoord1hNV".}
-proc glMultiTexCoord1hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, 
+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, 
+proc glMultiTexCoord2hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname,
     importc: "glMultiTexCoord2hvNV".}
-proc glMultiTexCoord3hNV*(target: TGLenum, s: TGLushort, t: TGLushort, 
-                          r: TGLushort){.dynlib: dllname, 
+proc glMultiTexCoord3hNV*(target: TGLenum, s: TGLushort, t: TGLushort,
+                          r: TGLushort){.dynlib: dllname,
     importc: "glMultiTexCoord3hNV".}
-proc glMultiTexCoord3hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, 
+proc glMultiTexCoord3hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname,
     importc: "glMultiTexCoord3hvNV".}
-proc glMultiTexCoord4hNV*(target: TGLenum, s: TGLushort, t: TGLushort, 
-                          r: TGLushort, q: TGLushort){.dynlib: dllname, 
+proc glMultiTexCoord4hNV*(target: TGLenum, s: TGLushort, t: TGLushort,
+                          r: TGLushort, q: TGLushort){.dynlib: dllname,
     importc: "glMultiTexCoord4hNV".}
-proc glMultiTexCoord4hvNV*(target: TGLenum, v: PGLushort){.dynlib: dllname, 
+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, 
+proc glSecondaryColor3hvNV*(v: PGLushort){.dynlib: dllname,
     importc: "glSecondaryColor3hvNV".}
-proc glVertexWeighthNV*(weight: TGLushort){.dynlib: dllname, 
+proc glVertexWeighthNV*(weight: TGLushort){.dynlib: dllname,
     importc: "glVertexWeighthNV".}
-proc glVertexWeighthvNV*(weight: PGLushort){.dynlib: dllname, 
+proc glVertexWeighthvNV*(weight: PGLushort){.dynlib: dllname,
     importc: "glVertexWeighthvNV".}
-proc glVertexAttrib1hNV*(index: TGLuint, x: TGLushort){.dynlib: dllname, 
+proc glVertexAttrib1hNV*(index: TGLuint, x: TGLushort){.dynlib: dllname,
     importc: "glVertexAttrib1hNV".}
-proc glVertexAttrib1hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+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, 
+proc glVertexAttrib2hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname,
     importc: "glVertexAttrib2hvNV".}
-proc glVertexAttrib3hNV*(index: TGLuint, x: TGLushort, y: TGLushort, 
-                         z: TGLushort){.dynlib: dllname, 
+proc glVertexAttrib3hNV*(index: TGLuint, x: TGLushort, y: TGLushort,
+                         z: TGLushort){.dynlib: dllname,
                                         importc: "glVertexAttrib3hNV".}
-proc glVertexAttrib3hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+proc glVertexAttrib3hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname,
     importc: "glVertexAttrib3hvNV".}
-proc glVertexAttrib4hNV*(index: TGLuint, x: TGLushort, y: TGLushort, 
-                         z: TGLushort, w: TGLushort){.dynlib: dllname, 
+proc glVertexAttrib4hNV*(index: TGLuint, x: TGLushort, y: TGLushort,
+                         z: TGLushort, w: TGLushort){.dynlib: dllname,
     importc: "glVertexAttrib4hNV".}
-proc glVertexAttrib4hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname, 
+proc glVertexAttrib4hvNV*(index: TGLuint, v: PGLushort){.dynlib: dllname,
     importc: "glVertexAttrib4hvNV".}
 proc glVertexAttribs1hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){.
     dynlib: dllname, importc: "glVertexAttribs1hvNV".}
@@ -3829,12 +3829,12 @@ proc glVertexAttribs3hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){.
 proc glVertexAttribs4hvNV*(index: TGLuint, n: TGLsizei, v: PGLushort){.
     dynlib: dllname, importc: "glVertexAttribs4hvNV".}
   #***** GL_ATI_map_object_buffer *****//
-proc glMapObjectBufferATI*(buffer: TGLuint): PGLvoid{.dynlib: dllname, 
+proc glMapObjectBufferATI*(buffer: TGLuint): PGLvoid{.dynlib: dllname,
     importc: "glMapObjectBufferATI".}
-proc glUnmapObjectBufferATI*(buffer: TGLuint){.dynlib: dllname, 
+proc glUnmapObjectBufferATI*(buffer: TGLuint){.dynlib: dllname,
     importc: "glUnmapObjectBufferATI".}
   #***** GL_ATI_separate_stencil *****//
-const 
+const
   GL_KEEP* = 0x00001E00
   GL_ZERO* = 0x00000000
   GL_REPLACE* = 0x00001E01
@@ -3857,39 +3857,39 @@ const
   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, 
+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, 
+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, 
+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, 
+proc glGetVertexAttribArrayObjectfvATI*(index: TGLuint, pname: TGLenum,
+                                        params: PGLfloat){.dynlib: dllname,
     importc: "glGetVertexAttribArrayObjectfvATI".}
-proc glGetVertexAttribArrayObjectivATI*(index: TGLuint, pname: TGLenum, 
-                                        params: PGLint){.dynlib: dllname, 
+proc glGetVertexAttribArrayObjectivATI*(index: TGLuint, pname: TGLenum,
+                                        params: PGLint){.dynlib: dllname,
     importc: "glGetVertexAttribArrayObjectivATI".}
   #***** GL_ARB_occlusion_query *****//
-const 
+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, 
+proc glGenQueriesARB*(n: TGLsizei, ids: PGLuint){.dynlib: dllname,
     importc: "glGenQueriesARB".}
-proc glDeleteQueriesARB*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, 
+proc glDeleteQueriesARB*(n: TGLsizei, ids: PGLuint){.dynlib: dllname,
     importc: "glDeleteQueriesARB".}
-proc glIsQueryARB*(id: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsQueryARB*(id: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsQueryARB".}
-proc glBeginQueryARB*(target: TGLenum, id: TGLuint){.dynlib: dllname, 
+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){.
@@ -3899,7 +3899,7 @@ proc glGetQueryObjectivARB*(id: TGLuint, pname: TGLenum, params: PGLint){.
 proc glGetQueryObjectuivARB*(id: TGLuint, pname: TGLenum, params: PGLuint){.
     dynlib: dllname, importc: "glGetQueryObjectuivARB".}
   #***** GL_ARB_shader_objects *****//
-const 
+const
   GL_PROGRAM_OBJECT_ARB* = 0x00008B40
   GL_OBJECT_TYPE_ARB* = 0x00008B4E
   GL_OBJECT_SUBTYPE_ARB* = 0x00008B4F
@@ -3929,44 +3929,44 @@ const
   GL_FLOAT_MAT3_ARB* = 0x00008B5B
   GL_FLOAT_MAT4_ARB* = 0x00008B5C
 
-proc glDeleteObjectARB*(obj: GLhandleARB){.dynlib: dllname, 
+proc glDeleteObjectARB*(obj: GLhandleARB){.dynlib: dllname,
     importc: "glDeleteObjectARB".}
-proc glGetHandleARB*(pname: TGLenum): GLhandleARB{.dynlib: dllname, 
+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, 
+proc glShaderSourceARB*(shaderObj: GLhandleARB, count: TGLsizei, str: PGLvoid,
+                        len: PGLint){.dynlib: dllname,
                                       importc: "glShaderSourceARB".}
-proc glCompileShaderARB*(shaderObj: GLhandleARB){.dynlib: dllname, 
+proc glCompileShaderARB*(shaderObj: GLhandleARB){.dynlib: dllname,
     importc: "glCompileShaderARB".}
-proc glCreateProgramObjectARB*(): GLhandleARB{.dynlib: dllname, 
+proc glCreateProgramObjectARB*(): GLhandleARB{.dynlib: dllname,
     importc: "glCreateProgramObjectARB".}
 proc glAttachObjectARB*(containerObj: GLhandleARB, obj: GLhandleARB){.
     dynlib: dllname, importc: "glAttachObjectARB".}
-proc glLinkProgramARB*(programObj: GLhandleARB){.dynlib: dllname, 
+proc glLinkProgramARB*(programObj: GLhandleARB){.dynlib: dllname,
     importc: "glLinkProgramARB".}
-proc glUseProgramObjectARB*(programObj: GLhandleARB){.dynlib: dllname, 
+proc glUseProgramObjectARB*(programObj: GLhandleARB){.dynlib: dllname,
     importc: "glUseProgramObjectARB".}
-proc glValidateProgramARB*(programObj: GLhandleARB){.dynlib: dllname, 
+proc glValidateProgramARB*(programObj: GLhandleARB){.dynlib: dllname,
     importc: "glValidateProgramARB".}
-proc glUniform1fARB*(location: TGLint, v0: TGLfloat){.dynlib: dllname, 
+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, 
+proc glUniform4fARB*(location: TGLint, v0: TGLfloat, v1: TGLfloat, v2: TGLfloat,
                      v3: TGLfloat){.dynlib: dllname, importc: "glUniform4fARB".}
-proc glUniform1iARB*(location: TGLint, v0: TGLint){.dynlib: dllname, 
+proc glUniform1iARB*(location: TGLint, v0: TGLint){.dynlib: dllname,
     importc: "glUniform1iARB".}
-proc glUniform2iARB*(location: TGLint, v0: TGLint, v1: TGLint){.dynlib: dllname, 
+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, 
+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".}
@@ -3984,80 +3984,80 @@ 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, 
+proc glUniformMatrix2fvARB*(location: TGLint, count: TGLsizei,
                             transpose: TGLboolean, value: PGLfloat){.
     dynlib: dllname, importc: "glUniformMatrix2fvARB".}
-proc glUniformMatrix3fvARB*(location: TGLint, count: TGLsizei, 
+proc glUniformMatrix3fvARB*(location: TGLint, count: TGLsizei,
                             transpose: TGLboolean, value: PGLfloat){.
     dynlib: dllname, importc: "glUniformMatrix3fvARB".}
-proc glUniformMatrix4fvARB*(location: TGLint, count: TGLsizei, 
+proc glUniformMatrix4fvARB*(location: TGLint, count: TGLsizei,
                             transpose: TGLboolean, value: PGLfloat){.
     dynlib: dllname, importc: "glUniformMatrix4fvARB".}
-proc glGetObjectParameterfvARB*(obj: GLhandleARB, pname: TGLenum, 
-                                params: PGLfloat){.dynlib: dllname, 
+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, 
+proc glGetInfoLogARB*(obj: GLhandleARB, maxLength: TGLsizei, len: PGLsizei,
+                      infoLog: PGLcharARB){.dynlib: dllname,
     importc: "glGetInfoLogARB".}
-proc glGetAttachedObjectsARB*(containerObj: GLhandleARB, maxCount: TGLsizei, 
+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, 
+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, 
+proc glGetUniformfvARB*(programObj: GLhandleARB, location: TGLint,
+                        params: PGLfloat){.dynlib: dllname,
     importc: "glGetUniformfvARB".}
-proc glGetUniformivARB*(programObj: GLhandleARB, location: TGLint, 
-                        params: PGLint){.dynlib: dllname, 
+proc glGetUniformivARB*(programObj: GLhandleARB, location: TGLint,
+                        params: PGLint){.dynlib: dllname,
     importc: "glGetUniformivARB".}
-proc glGetShaderSourceARB*(obj: GLhandleARB, maxLength: TGLsizei, len: PGLsizei, 
-                           source: PGLcharARB){.dynlib: dllname, 
+proc glGetShaderSourceARB*(obj: GLhandleARB, maxLength: TGLsizei, len: PGLsizei,
+                           source: PGLcharARB){.dynlib: dllname,
     importc: "glGetShaderSourceARB".}
-const 
+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_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 }
@@ -4102,22 +4102,22 @@ const
                                                           # 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, 
+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, 
+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".}
@@ -4126,11 +4126,11 @@ proc glGetAttribLocationARB*(programObj: GLhandleARB, name: PGLcharARB): TGLint{
   # glGetVertexAttribivARB  { already defined }
   # glGetVertexAttribPointervARB  { already defined }
   #***** GL_ARB_fragment_shader *****//
-const 
+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 }
@@ -4139,36 +4139,36 @@ const
   #***** GL_ARB_texture_non_power_of_two *****//
   #***** GL_ARB_point_sprite *****//
 
-const 
+const
   GL_POINT_SPRITE_ARB* = 0x00008861
   GL_COORD_REPLACE_ARB* = 0x00008862
   #***** GL_EXT_depth_bounds_test *****//
 
-const 
+const
   constGL_DEPTH_BOUNDS_TEST_EXT* = 0x00008890
   constGL_DEPTH_BOUNDS_EXT* = 0x00008891
 
-proc glDepthBoundsEXT*(zmin: TGLclampd, zmax: TGLclampd){.dynlib: dllname, 
+proc glDepthBoundsEXT*(zmin: TGLclampd, zmax: TGLclampd){.dynlib: dllname,
     importc: "glDepthBoundsEXT".}
   #***** GL_EXT_texture_mirror_clamp *****//
-const 
+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 
+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 
+const
   GL_PACK_INVERT_MESA* = 0x00008758
   #***** GL_MESA_ycbcr_texture *****//
 
-const 
+const
   GL_YCBCR_MESA* = 0x00008757
   GL_UNSIGNED_SHORT_8_8_MESA* = 0x000085BA
   GL_UNSIGNED_SHORT_8_8_REV_MESA* = 0x000085BB
@@ -4176,14 +4176,14 @@ const
   #***** GL_NV_fragment_program_option *****//
   #***** GL_EXT_pixel_buffer_object *****//
 
-const 
+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 
+const
   GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV* = 0x000088F4
   GL_MAX_PROGRAM_CALL_DEPTH_NV* = 0x000088F5
   GL_MAX_PROGRAM_IF_DEPTH_NV* = 0x000088F6
@@ -4196,7 +4196,7 @@ const
   # GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB  { already defined }
   #***** GL_ARB_draw_buffers *****//
 
-const 
+const
   GL_MAX_DRAW_BUFFERS_ARB* = 0x00008824
   GL_DRAW_BUFFER0_ARB* = 0x00008825
   GL_DRAW_BUFFER1_ARB* = 0x00008826
@@ -4215,17 +4215,17 @@ const
   GL_DRAW_BUFFER14_ARB* = 0x00008833
   GL_DRAW_BUFFER15_ARB* = 0x00008834
 
-proc glDrawBuffersARB*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname, 
+proc glDrawBuffersARB*(n: TGLsizei, bufs: PGLenum){.dynlib: dllname,
     importc: "glDrawBuffersARB".}
   #***** GL_ARB_texture_rectangle *****//
-const 
+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 
+const
   GL_RGBA_FLOAT_MODE_ARB* = 0x00008820
   GL_CLAMP_VERTEX_COLOR_ARB* = 0x0000891A
   GL_CLAMP_FRAGMENT_COLOR_ARB* = 0x0000891B
@@ -4233,14 +4233,14 @@ const
   GL_FIXED_ONLY_ARB* = 0x0000891D
   WGL_TYPE_RGBA_FLOAT_ARB* = 0x000021A0
 
-proc glClampColorARB*(target: TGLenum, clamp: TGLenum){.dynlib: dllname, 
+proc glClampColorARB*(target: TGLenum, clamp: TGLenum){.dynlib: dllname,
     importc: "glClampColorARB".}
   #***** GL_ARB_half_float_pixel *****//
-const 
+const
   GL_HALF_FLOAT_ARB* = 0x0000140B
   #***** GL_ARB_texture_float *****//
 
-const 
+const
   GL_TEXTURE_RED_TYPE_ARB* = 0x00008C10
   GL_TEXTURE_GREEN_TYPE_ARB* = 0x00008C11
   GL_TEXTURE_BLUE_TYPE_ARB* = 0x00008C12
@@ -4266,14 +4266,14 @@ const
   # GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  { already defined }
   #***** GL_ARB_pixel_buffer_object *****//
 
-const 
+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 
+const
   GL_FRAMEBUFFER_EXT* = 0x00008D40
   GL_RENDERBUFFER_EXT* = 0x00008D41
   GL_STENCIL_INDEX_EXT* = 0x00008D45
@@ -4323,7 +4323,7 @@ const
   GL_MAX_RENDERBUFFER_SIZE_EXT* = 0x000084E8
   GL_INVALID_FRAMEBUFFER_OPERATION_EXT* = 0x00000506
 
-proc glIsRenderbufferEXT*(renderbuffer: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsRenderbufferEXT*(renderbuffer: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsRenderbufferEXT".}
 proc glBindRenderbufferEXT*(target: TGLenum, renderbuffer: TGLuint){.
     dynlib: dllname, importc: "glBindRenderbufferEXT".}
@@ -4331,45 +4331,45 @@ 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, 
+proc glRenderbufferStorageEXT*(target: TGLenum, internalformat: TGLenum,
                                width: TGLsizei, height: TGLsizei){.
     dynlib: dllname, importc: "glRenderbufferStorageEXT".}
-proc glGetRenderbufferParameterivEXT*(target: TGLenum, pname: TGLenum, 
-                                      params: PGLint){.dynlib: dllname, 
+proc glGetRenderbufferParameterivEXT*(target: TGLenum, pname: TGLenum,
+                                      params: PGLint){.dynlib: dllname,
     importc: "glGetRenderbufferParameterivEXT".}
-proc glIsFramebufferEXT*(framebuffer: TGLuint): TGLboolean{.dynlib: dllname, 
+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, 
+proc glGenFramebuffersEXT*(n: TGLsizei, framebuffers: PGLuint){.dynlib: dllname,
     importc: "glGenFramebuffersEXT".}
-proc glCheckFramebufferStatusEXT*(target: TGLenum): TGLenum{.dynlib: dllname, 
+proc glCheckFramebufferStatusEXT*(target: TGLenum): TGLenum{.dynlib: dllname,
     importc: "glCheckFramebufferStatusEXT".}
-proc glFramebufferTexture1DEXT*(target: TGLenum, attachment: TGLenum, 
-                                textarget: TGLenum, texture: TGLuint, 
-                                level: TGLint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+proc glGetFramebufferAttachmentParameterivEXT*(target: TGLenum,
+    attachment: TGLenum, pname: TGLenum, params: PGLint){.dynlib: dllname,
     importc: "glGetFramebufferAttachmentParameterivEXT".}
-proc glGenerateMipmapEXT*(target: TGLenum){.dynlib: dllname, 
+proc glGenerateMipmapEXT*(target: TGLenum){.dynlib: dllname,
     importc: "glGenerateMipmapEXT".}
   #***** GL_version_1_4 *****//
-const 
+const
   GL_BLEND_DST_RGB* = 0x000080C8
   GL_BLEND_SRC_RGB* = 0x000080C9
   GL_BLEND_DST_ALPHA* = 0x000080CA
@@ -4410,7 +4410,7 @@ const
   GL_TEXTURE_COMPARE_FUNC* = 0x0000884D
   GL_COMPARE_R_TO_TEXTURE* = 0x0000884E
 
-proc glBlendFuncSeparate*(sfactorRGB: TGLenum, dfactorRGB: TGLenum, 
+proc glBlendFuncSeparate*(sfactorRGB: TGLenum, dfactorRGB: TGLenum,
                           sfactorAlpha: TGLenum, dfactorAlpha: TGLenum){.
     dynlib: dllname, importc: "glBlendFuncSeparate".}
 proc glFogCoordf*(coord: TGLfloat){.dynlib: dllname, importc: "glFogCoordf".}
@@ -4419,81 +4419,81 @@ 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, 
+proc glMultiDrawArrays*(mode: TGLenum, first: PGLint, count: PGLsizei,
+                        primcount: TGLsizei){.dynlib: dllname,
     importc: "glMultiDrawArrays".}
-proc glMultiDrawElements*(mode: TGLenum, count: PGLsizei, thetype: TGLenum, 
+proc glMultiDrawElements*(mode: TGLenum, count: PGLsizei, thetype: TGLenum,
                           indices: PGLvoid, primcount: TGLsizei){.
     dynlib: dllname, importc: "glMultiDrawElements".}
-proc glPointParameterf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname, 
+proc glPointParameterf*(pname: TGLenum, param: TGLfloat){.dynlib: dllname,
     importc: "glPointParameterf".}
-proc glPointParameterfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname, 
+proc glPointParameterfv*(pname: TGLenum, params: PGLfloat){.dynlib: dllname,
     importc: "glPointParameterfv".}
-proc glPointParameteri*(pname: TGLenum, param: TGLint){.dynlib: dllname, 
+proc glPointParameteri*(pname: TGLenum, param: TGLint){.dynlib: dllname,
     importc: "glPointParameteri".}
-proc glPointParameteriv*(pname: TGLenum, params: PGLint){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc glSecondaryColor3usv*(v: PGLushort){.dynlib: dllname,
     importc: "glSecondaryColor3usv".}
-proc glSecondaryColorPointer*(size: TGLint, thetype: TGLenum, stride: TGLsizei, 
-                              pointer: PGLvoid){.dynlib: dllname, 
+proc glSecondaryColorPointer*(size: TGLint, thetype: TGLenum, stride: TGLsizei,
+                              pointer: PGLvoid){.dynlib: dllname,
     importc: "glSecondaryColorPointer".}
-proc glWindowPos2d*(x: TGLdouble, y: TGLdouble){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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 
+const
   GL_BUFFER_SIZE* = 0x00008764
   GL_BUFFER_USAGE* = 0x00008765
   GL_QUERY_COUNTER_BITS* = 0x00008864
@@ -4545,12 +4545,12 @@ const
   GL_SRC1_ALPHA* = 0x00008589
   GL_SRC2_ALPHA* = 0x0000858A
 
-proc glGenQueries*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, 
+proc glGenQueries*(n: TGLsizei, ids: PGLuint){.dynlib: dllname,
     importc: "glGenQueries".}
-proc glDeleteQueries*(n: TGLsizei, ids: PGLuint){.dynlib: dllname, 
+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, 
+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){.
@@ -4559,32 +4559,32 @@ 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, 
+proc glBindBuffer*(target: TGLenum, buffer: TGLuint){.dynlib: dllname,
     importc: "glBindBuffer".}
-proc glDeleteBuffers*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, 
+proc glDeleteBuffers*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname,
     importc: "glDeleteBuffers".}
-proc glGenBuffers*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname, 
+proc glGenBuffers*(n: TGLsizei, buffers: PGLuint){.dynlib: dllname,
     importc: "glGenBuffers".}
-proc glIsBuffer*(buffer: TGLuint): TGLboolean{.dynlib: dllname, 
+proc glIsBuffer*(buffer: TGLuint): TGLboolean{.dynlib: dllname,
     importc: "glIsBuffer".}
-proc glBufferData*(target: TGLenum, size: GLsizeiptr, data: PGLvoid, 
+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, 
+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, 
+proc glGetBufferSubData*(target: TGLenum, offset: GLintptr, size: GLsizeiptr,
+                         data: PGLvoid){.dynlib: dllname,
     importc: "glGetBufferSubData".}
-proc glMapBuffer*(target: TGLenum, access: TGLenum): PGLvoid{.dynlib: dllname, 
+proc glMapBuffer*(target: TGLenum, access: TGLenum): PGLvoid{.dynlib: dllname,
     importc: "glMapBuffer".}
-proc glUnmapBuffer*(target: TGLenum): TGLboolean{.dynlib: dllname, 
+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 
+const
   GL_BLEND_EQUATION_RGB* = 0x00008009
   GL_VERTEX_ATTRIB_ARRAY_ENABLED* = 0x00008622
   GL_VERTEX_ATTRIB_ARRAY_SIZE* = 0x00008623
@@ -4670,4 +4670,4 @@ const
   GL_STENCIL_BACK_VALUE_MASK* = 0x00008CA4
   GL_STENCIL_BACK_WRITEMASK* = 0x00008CA5
 
-{.pop.}
\ No newline at end of file
+{.pop.}
diff --git a/tests/manyloc/keineschweine/lib/glu.nim b/tests/manyloc/keineschweine/lib/glu.nim
index e00120d83..867d0e47f 100644
--- a/tests/manyloc/keineschweine/lib/glu.nim
+++ b/tests/manyloc/keineschweine/lib/glu.nim
@@ -4,28 +4,28 @@
 #  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              
+# Converted to Delphi by Tom Nuydens (tom@delphi3d.net)
+# For the latest updates, visit Delphi3D: http://www.delphi3d.net
 #******************************************************************************
 
-import 
+import
   GL
 
-when defined(windows): 
+when defined(windows):
   {.push, callconv: stdcall.}
-else: 
+else:
   {.push, callconv: cdecl.}
 
-when defined(windows): 
-  const 
+when defined(windows):
+  const
     dllname = "glu32.dll"
-elif defined(macosx): 
-  const 
+elif defined(macosx):
+  const
     dllname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"
-else: 
-  const 
+else:
+  const
     dllname = "libGLU.so.1"
-type 
+type
   TViewPortArray* = array[0..3, TGLint]
   T16dArray* = array[0..15, TGLdouble]
   TCallBack* = proc ()
@@ -34,12 +34,12 @@ type
   T4fArray* = array[0..3, TGLfloat]
   PPointer* = ptr Pointer
 
-type 
-  GLUnurbs*{.final.} = object 
+type
+  GLUnurbs*{.final.} = object
   PGLUnurbs* = ptr GLUnurbs
-  GLUquadric*{.final.} = object 
+  GLUquadric*{.final.} = object
   PGLUquadric* = ptr GLUquadric
-  GLUtesselator*{.final.} = object 
+  GLUtesselator*{.final.} = object
   PGLUtesselator* = ptr GLUtesselator # backwards compatibility:
   GLUnurbsObj* = GLUnurbs
   PGLUnurbsObj* = PGLUnurbs
@@ -57,40 +57,40 @@ type
   TGLUtesselatorObj* = GLUtesselatorObj
   TGLUtriangulatorObj* = GLUtriangulatorObj
 
-proc gluErrorString*(errCode: TGLenum): cstring{.dynlib: dllname, 
+proc gluErrorString*(errCode: TGLenum): cstring{.dynlib: dllname,
     importc: "gluErrorString".}
-proc gluErrorUnicodeStringEXT*(errCode: TGLenum): ptr int16{.dynlib: dllname, 
+proc gluErrorUnicodeStringEXT*(errCode: TGLenum): ptr int16{.dynlib: dllname,
     importc: "gluErrorUnicodeStringEXT".}
-proc gluGetString*(name: TGLenum): cstring{.dynlib: dllname, 
+proc gluGetString*(name: TGLenum): cstring{.dynlib: dllname,
     importc: "gluGetString".}
-proc gluOrtho2D*(left, right, bottom, top: TGLdouble){.dynlib: dllname, 
+proc gluOrtho2D*(left, right, bottom, top: TGLdouble){.dynlib: dllname,
     importc: "gluOrtho2D".}
-proc gluPerspective*(fovy, aspect, zNear, zFar: TGLdouble){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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, 
+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, 
+proc gluDeleteQuadric*(state: PGLUquadric){.dynlib: dllname,
     importc: "gluDeleteQuadric".}
 proc gluQuadricNormals*(quadObject: PGLUquadric, normals: TGLenum){.
     dynlib: dllname, importc: "gluQuadricNormals".}
@@ -100,12 +100,12 @@ 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, 
+proc gluCylinder*(qobj: PGLUquadric, baseRadius, topRadius, height: TGLdouble,
+                  slices, stacks: TGLint){.dynlib: dllname,
     importc: "gluCylinder".}
-proc gluDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble, 
+proc gluDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble,
               slices, loops: TGLint){.dynlib: dllname, importc: "gluDisk".}
-proc gluPartialDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble, 
+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){.
@@ -113,51 +113,51 @@ proc gluSphere*(qobj: PGLuquadric, radius: TGLdouble, slices, stacks: TGLint){.
 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, 
+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, 
+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, 
+proc gluTessEndContour*(tess: PGLUtesselator){.dynlib: dllname,
     importc: "gluTessEndContour".}
-proc gluTessEndPolygon*(tess: PGLUtesselator){.dynlib: dllname, 
+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, 
+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, 
+proc gluNewNurbsRenderer*(): PGLUnurbs{.dynlib: dllname,
                                         importc: "gluNewNurbsRenderer".}
-proc gluDeleteNurbsRenderer*(nobj: PGLUnurbs){.dynlib: dllname, 
+proc gluDeleteNurbsRenderer*(nobj: PGLUnurbs){.dynlib: dllname,
     importc: "gluDeleteNurbsRenderer".}
-proc gluBeginSurface*(nobj: PGLUnurbs){.dynlib: dllname, 
+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, 
+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, 
+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, 
+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, 
+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".}
@@ -173,16 +173,16 @@ type                          # gluQuadricCallback
   GLUtessVertexProc* = proc (p: Pointer)
   GLUtessEndProc* = proc ()
   GLUtessErrorProc* = proc (p: TGLenum)
-  GLUtessCombineProc* = proc (p1: var T3dArray, p2: T4pArray, p3: T4fArray, 
+  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) # 
-                                                                               # 
+  GLUtessCombineDataProc* = proc (p1: var T3dArray, p2: var T4pArray,
+                                  p3: var T4fArray, p4: PPointer, p5: Pointer) #
+                                                                               #
                                                                                # gluNurbsCallback
   GLUnurbsErrorProc* = proc (p: TGLenum) #***           Generic constants               ****/
 
@@ -226,21 +226,21 @@ const                         # Version
   GLU_TESS_COMBINE* = 100105 # void (CALLBACK*)(TGLdouble  coords[3],
                              #                                                            void      *data[4],
                              #                                                            TGLfloat   weight[4],
-                             #                                                            void      **dataOut) 
+                             #                                                            void      **dataOut)
   GLU_TESS_BEGIN_DATA* = 100106 # void (CALLBACK*)(TGLenum    type,
-                                #                                                            void      *polygon_data) 
+                                #                                                            void      *polygon_data)
   GLU_TESS_VERTEX_DATA* = 100107 # void (CALLBACK*)(void      *data,
-                                 #                                                            void      *polygon_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) 
+                                #                                                            void      *polygon_data)
   GLU_TESS_EDGE_FLAG_DATA* = 100110 # void (CALLBACK*)(TGLboolean boundaryEdge,
-                                    #                                                            void      *polygon_data) 
+                                    #                                                            void      *polygon_data)
   GLU_TESS_COMBINE_DATA* = 100111 # void (CALLBACK*)(TGLdouble  coords[3],
                                   #                                                            void      *data[4],
                                   #                                                            TGLfloat   weight[4],
                                   #                                                            void      **dataOut,
-                                  #                                                            void      *polygon_data) 
+                                  #                                                            void      *polygon_data)
                                   # TessError
   GLU_TESS_ERROR1* = 100151
   GLU_TESS_ERROR2* = 100152
@@ -313,11 +313,11 @@ const                         # Version
   GLU_NURBS_ERROR36* = 100286
   GLU_NURBS_ERROR37* = 100287 #***           Backwards compatibility for old tesselator           ****/
 
-proc gluBeginPolygon*(tess: PGLUtesselator){.dynlib: dllname, 
+proc gluBeginPolygon*(tess: PGLUtesselator){.dynlib: dllname,
     importc: "gluBeginPolygon".}
-proc gluNextContour*(tess: PGLUtesselator, atype: TGLenum){.dynlib: dllname, 
+proc gluNextContour*(tess: PGLUtesselator, atype: TGLenum){.dynlib: dllname,
     importc: "gluNextContour".}
-proc gluEndPolygon*(tess: PGLUtesselator){.dynlib: dllname, 
+proc gluEndPolygon*(tess: PGLUtesselator){.dynlib: dllname,
     importc: "gluEndPolygon".}
 const                         # Contours types -- obsolete!
   GLU_CW* = 100120
diff --git a/tests/manyloc/keineschweine/lib/glut.nim b/tests/manyloc/keineschweine/lib/glut.nim
index ff157c327..44a290728 100644
--- a/tests/manyloc/keineschweine/lib/glut.nim
+++ b/tests/manyloc/keineschweine/lib/glut.nim
@@ -15,17 +15,17 @@
 #   For the latest updates, visit Delphi3D: http://www.delphi3d.net
 #******************************************************************************
 
-import 
+import
   GL
 
-when defined(windows): 
-  const 
+when defined(windows):
+  const
     dllname = "glut32.dll"
-elif defined(macosx): 
-  const 
+elif defined(macosx):
+  const
     dllname = "/System/Library/Frameworks/GLUT.framework/GLUT"
-else: 
-  const 
+else:
+  const
     dllname = "libglut.so.3"
 type
   TGlutVoidCallback* = proc (){.cdecl.}
@@ -36,7 +36,7 @@ type
   TGlut1Char2IntCallback* = proc (c: int8, v1, v2: cint){.cdecl.}
   TGlut1UInt3IntCallback* = proc (u, v1, v2, v3: cint){.cdecl.}
 
-const 
+const
   GLUT_API_VERSION* = 3
   GLUT_XLIB_IMPLEMENTATION* = 12 # Display mode bit masks.
   GLUT_RGB* = 0
@@ -93,7 +93,7 @@ const
   GLUT_NORMAL* = 0
   GLUT_OVERLAY* = 1
 
-when defined(Windows): 
+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).
@@ -104,7 +104,7 @@ when defined(Windows):
     GLUT_BITMAP_HELVETICA_10* = cast[Pointer](6)
     GLUT_BITMAP_HELVETICA_12* = cast[Pointer](7)
     GLUT_BITMAP_HELVETICA_18* = cast[Pointer](8)
-else: 
+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).
@@ -229,7 +229,7 @@ const                         # glutGet parameters.
   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, 
+proc glutInit*(argcp: ptr cint, argv: pointer){.dynlib: dllname,
     importc: "glutInit".}
 
 proc glutInit*() =
@@ -239,34 +239,34 @@ proc glutInit*() =
     cmdCount {.importc: "cmdCount".}: cint
   glutInit(addr(cmdCount), addr(cmdLine))
 
-proc glutInitDisplayMode*(mode: int16){.dynlib: dllname, 
+proc glutInitDisplayMode*(mode: int16){.dynlib: dllname,
                                         importc: "glutInitDisplayMode".}
-proc glutInitDisplayString*(str: cstring){.dynlib: dllname, 
+proc glutInitDisplayString*(str: cstring){.dynlib: dllname,
     importc: "glutInitDisplayString".}
-proc glutInitWindowPosition*(x, y: int){.dynlib: dllname, 
+proc glutInitWindowPosition*(x, y: int){.dynlib: dllname,
     importc: "glutInitWindowPosition".}
-proc glutInitWindowSize*(width, height: int){.dynlib: dllname, 
+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, 
+proc glutCreateWindow*(title: cstring): int{.dynlib: dllname,
     importc: "glutCreateWindow".}
-proc glutCreateSubWindow*(win, x, y, width, height: int): int{.dynlib: dllname, 
+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, 
+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, 
+proc glutSetWindowTitle*(title: cstring){.dynlib: dllname,
     importc: "glutSetWindowTitle".}
-proc glutSetIconTitle*(title: cstring){.dynlib: dllname, 
+proc glutSetIconTitle*(title: cstring){.dynlib: dllname,
                                         importc: "glutSetIconTitle".}
-proc glutPositionWindow*(x, y: int){.dynlib: dllname, 
+proc glutPositionWindow*(x, y: int){.dynlib: dllname,
                                      importc: "glutPositionWindow".}
-proc glutReshapeWindow*(width, height: int){.dynlib: dllname, 
+proc glutReshapeWindow*(width, height: int){.dynlib: dllname,
     importc: "glutReshapeWindow".}
 proc glutPopWindow*(){.dynlib: dllname, importc: "glutPopWindow".}
 proc glutPushWindow*(){.dynlib: dllname, importc: "glutPushWindow".}
@@ -280,107 +280,107 @@ proc glutWarpPointer*(x, y: int){.dynlib: dllname, importc: "glutWarpPointer".}
 proc glutEstablishOverlay*(){.dynlib: dllname, importc: "glutEstablishOverlay".}
 proc glutRemoveOverlay*(){.dynlib: dllname, importc: "glutRemoveOverlay".}
 proc glutUseLayer*(layer: TGLenum){.dynlib: dllname, importc: "glutUseLayer".}
-proc glutPostOverlayRedisplay*(){.dynlib: dllname, 
+proc glutPostOverlayRedisplay*(){.dynlib: dllname,
                                   importc: "glutPostOverlayRedisplay".}
-proc glutPostWindowOverlayRedisplay*(win: int){.dynlib: dllname, 
+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, 
+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, 
+proc glutAddMenuEntry*(caption: cstring, value: int){.dynlib: dllname,
     importc: "glutAddMenuEntry".}
-proc glutAddSubMenu*(caption: cstring, submenu: int){.dynlib: dllname, 
+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, 
+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, 
+proc glutDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname,
     importc: "glutDisplayFunc".}
-proc glutReshapeFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutReshapeFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutReshapeFunc".}
-proc glutKeyboardFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname, 
+proc glutKeyboardFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname,
     importc: "glutKeyboardFunc".}
-proc glutMouseFunc*(f: TGlut4IntCallback){.dynlib: dllname, 
+proc glutMouseFunc*(f: TGlut4IntCallback){.dynlib: dllname,
     importc: "glutMouseFunc".}
-proc glutMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutMotionFunc".}
-proc glutPassiveMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutPassiveMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutPassiveMotionFunc".}
-proc glutEntryFunc*(f: TGlut1IntCallback){.dynlib: dllname, 
+proc glutEntryFunc*(f: TGlut1IntCallback){.dynlib: dllname,
     importc: "glutEntryFunc".}
-proc glutVisibilityFunc*(f: TGlut1IntCallback){.dynlib: dllname, 
+proc glutVisibilityFunc*(f: TGlut1IntCallback){.dynlib: dllname,
     importc: "glutVisibilityFunc".}
-proc glutIdleFunc*(f: TGlutVoidCallback){.dynlib: dllname, 
+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, 
+proc glutMenuStateFunc*(f: TGlut1IntCallback){.dynlib: dllname,
     importc: "glutMenuStateFunc".}
-proc glutSpecialFunc*(f: TGlut3IntCallback){.dynlib: dllname, 
+proc glutSpecialFunc*(f: TGlut3IntCallback){.dynlib: dllname,
     importc: "glutSpecialFunc".}
-proc glutSpaceballMotionFunc*(f: TGlut3IntCallback){.dynlib: dllname, 
+proc glutSpaceballMotionFunc*(f: TGlut3IntCallback){.dynlib: dllname,
     importc: "glutSpaceballMotionFunc".}
-proc glutSpaceballRotateFunc*(f: TGlut3IntCallback){.dynlib: dllname, 
+proc glutSpaceballRotateFunc*(f: TGlut3IntCallback){.dynlib: dllname,
     importc: "glutSpaceballRotateFunc".}
-proc glutSpaceballButtonFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutSpaceballButtonFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutSpaceballButtonFunc".}
-proc glutButtonBoxFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutButtonBoxFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutButtonBoxFunc".}
-proc glutDialsFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutDialsFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutDialsFunc".}
-proc glutTabletMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, 
+proc glutTabletMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
     importc: "glutTabletMotionFunc".}
-proc glutTabletButtonFunc*(f: TGlut4IntCallback){.dynlib: dllname, 
+proc glutTabletButtonFunc*(f: TGlut4IntCallback){.dynlib: dllname,
     importc: "glutTabletButtonFunc".}
-proc glutMenuStatusFunc*(f: TGlut3IntCallback){.dynlib: dllname, 
+proc glutMenuStatusFunc*(f: TGlut3IntCallback){.dynlib: dllname,
     importc: "glutMenuStatusFunc".}
-proc glutOverlayDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname, 
+proc glutOverlayDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname,
     importc: "glutOverlayDisplayFunc".}
-proc glutWindowStatusFunc*(f: TGlut1IntCallback){.dynlib: dllname, 
+proc glutWindowStatusFunc*(f: TGlut1IntCallback){.dynlib: dllname,
     importc: "glutWindowStatusFunc".}
-proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname, 
+proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname,
     importc: "glutKeyboardUpFunc".}
-proc glutSpecialUpFunc*(f: TGlut3IntCallback){.dynlib: dllname, 
+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, 
+proc glutSetColor*(cell: int, red, green, blue: TGLfloat){.dynlib: dllname,
     importc: "glutSetColor".}
-proc glutGetColor*(ndx, component: int): TGLfloat{.dynlib: dllname, 
+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, 
+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, 
+proc glutBitmapCharacter*(font: pointer, character: int){.dynlib: dllname,
     importc: "glutBitmapCharacter".}
-proc glutBitmapWidth*(font: pointer, character: int): int{.dynlib: dllname, 
+proc glutBitmapWidth*(font: pointer, character: int): int{.dynlib: dllname,
     importc: "glutBitmapWidth".}
-proc glutStrokeCharacter*(font: pointer, character: int){.dynlib: dllname, 
+proc glutStrokeCharacter*(font: pointer, character: int){.dynlib: dllname,
     importc: "glutStrokeCharacter".}
-proc glutStrokeWidth*(font: pointer, character: int): int{.dynlib: dllname, 
+proc glutStrokeWidth*(font: pointer, character: int): int{.dynlib: dllname,
     importc: "glutStrokeWidth".}
-proc glutBitmapLength*(font: pointer, str: cstring): int{.dynlib: dllname, 
+proc glutBitmapLength*(font: pointer, str: cstring): int{.dynlib: dllname,
     importc: "glutBitmapLength".}
-proc glutStrokeLength*(font: pointer, str: cstring): int{.dynlib: dllname, 
+proc glutStrokeLength*(font: pointer, str: cstring): int{.dynlib: dllname,
     importc: "glutStrokeLength".}
   # GLUT pre-built models sub-API
 proc glutWireSphere*(radius: TGLdouble, slices, stacks: TGLint){.
@@ -399,9 +399,9 @@ 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, 
+proc glutWireTeapot*(size: TGLdouble){.dynlib: dllname,
                                        importc: "glutWireTeapot".}
-proc glutSolidTeapot*(size: TGLdouble){.dynlib: dllname, 
+proc glutSolidTeapot*(size: TGLdouble){.dynlib: dllname,
                                         importc: "glutSolidTeapot".}
 proc glutWireOctahedron*(){.dynlib: dllname, importc: "glutWireOctahedron".}
 proc glutSolidOctahedron*(){.dynlib: dllname, importc: "glutSolidOctahedron".}
@@ -410,29 +410,29 @@ 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, 
+proc glutVideoResizeGet*(param: TGLenum): int{.dynlib: dllname,
     importc: "glutVideoResizeGet".}
-proc glutSetupVideoResizing*(){.dynlib: dllname, 
+proc glutSetupVideoResizing*(){.dynlib: dllname,
                                 importc: "glutSetupVideoResizing".}
 proc glutStopVideoResizing*(){.dynlib: dllname, importc: "glutStopVideoResizing".}
-proc glutVideoResize*(x, y, width, height: int){.dynlib: dllname, 
+proc glutVideoResize*(x, y, width, height: int){.dynlib: dllname,
     importc: "glutVideoResize".}
-proc glutVideoPan*(x, y, width, height: int){.dynlib: dllname, 
+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, 
+proc glutIgnoreKeyRepeat*(ignore: int){.dynlib: dllname,
                                         importc: "glutIgnoreKeyRepeat".}
-proc glutSetKeyRepeat*(repeatMode: int){.dynlib: dllname, 
+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, 
+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, 
+proc glutGameModeGet*(mode: TGLenum): int{.dynlib: dllname,
     importc: "glutGameModeGet".}
 # implementation
diff --git a/tests/manyloc/keineschweine/lib/glx.nim b/tests/manyloc/keineschweine/lib/glx.nim
index 76c052d70..ce02835bd 100644
--- a/tests/manyloc/keineschweine/lib/glx.nim
+++ b/tests/manyloc/keineschweine/lib/glx.nim
@@ -23,19 +23,19 @@
 #  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
-import 
+import
   X, XLib, XUtil, gl
 
-when defined(windows): 
-  const 
+when defined(windows):
+  const
     dllname = "GL.dll"
-elif defined(macosx): 
-  const 
+elif defined(macosx):
+  const
     dllname = "/usr/X11R6/lib/libGL.dylib"
-else: 
-  const 
+else:
+  const
     dllname = "libGL.so"
-const 
+const
   GLX_USE_GL* = 1
   GLX_BUFFER_SIZE* = 2
   GLX_LEVEL* = 3
@@ -98,55 +98,55 @@ type                          # From XLib:
 
 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, 
+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, 
+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, 
+proc glXCopyContext*(dpy: PDisplay, src, dst: GLXContext, mask: int32){.cdecl,
     dynlib: dllname, importc: "glXCopyContext".}
-proc glXSwapBuffers*(dpy: PDisplay, drawable: GLXDrawable){.cdecl, 
+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, 
+proc glXDestroyGLXPixmap*(dpy: PDisplay, pixmap: GLXPixmap){.cdecl,
     dynlib: dllname, importc: "glXDestroyGLXPixmap".}
-proc glXQueryExtension*(dpy: PDisplay, errorb, event: var int): bool{.cdecl, 
+proc glXQueryExtension*(dpy: PDisplay, errorb, event: var int): bool{.cdecl,
     dynlib: dllname, importc: "glXQueryExtension".}
-proc glXQueryVersion*(dpy: PDisplay, maj, min: var int): bool{.cdecl, 
+proc glXQueryVersion*(dpy: PDisplay, maj, min: var int): bool{.cdecl,
     dynlib: dllname, importc: "glXQueryVersion".}
-proc glXIsDirect*(dpy: PDisplay, ctx: GLXContext): bool{.cdecl, dynlib: dllname, 
+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, 
+proc glXGetConfig*(dpy: PDisplay, visual: PXVisualInfo, attrib: int,
+                   value: var int): int{.cdecl, dynlib: dllname,
     importc: "glXGetConfig".}
-proc glXGetCurrentContext*(): GLXContext{.cdecl, dynlib: dllname, 
+proc glXGetCurrentContext*(): GLXContext{.cdecl, dynlib: dllname,
     importc: "glXGetCurrentContext".}
-proc glXGetCurrentDrawable*(): GLXDrawable{.cdecl, dynlib: dllname, 
+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, 
+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, 
+proc glXQueryExtensionsString*(dpy: PDisplay, screen: int): cstring{.cdecl,
     dynlib: dllname, importc: "glXQueryExtensionsString".}
-proc glXQueryServerString*(dpy: PDisplay, screen, name: int): cstring{.cdecl, 
+proc glXQueryServerString*(dpy: PDisplay, screen, name: int): cstring{.cdecl,
     dynlib: dllname, importc: "glXQueryServerString".}
-proc glXGetClientString*(dpy: PDisplay, name: int): cstring{.cdecl, 
+proc glXGetClientString*(dpy: PDisplay, name: int): cstring{.cdecl,
     dynlib: dllname, importc: "glXGetClientString".}
   # Mesa GLX Extensions
-proc glXCreateGLXPixmapMESA*(dpy: PDisplay, visual: PXVisualInfo, 
+proc glXCreateGLXPixmapMESA*(dpy: PDisplay, visual: PXVisualInfo,
                              pixmap: XPixmap, cmap: XColormap): GLXPixmap{.
     cdecl, dynlib: dllname, importc: "glXCreateGLXPixmapMESA".}
-proc glXReleaseBufferMESA*(dpy: PDisplay, d: GLXDrawable): bool{.cdecl, 
+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, 
+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, 
+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".}
diff --git a/tests/manyloc/keineschweine/lib/idgen.nim b/tests/manyloc/keineschweine/lib/idgen.nim
index 8124ba9bd..1ed196d88 100644
--- a/tests/manyloc/keineschweine/lib/idgen.nim
+++ b/tests/manyloc/keineschweine/lib/idgen.nim
@@ -5,7 +5,7 @@ type
     freeIDs: seq[T]
   EOutOfIDs* = object of EInvalidKey
 
-#proc free[T](idg: PIDgen[T]) = 
+#proc free[T](idg: PIDgen[T]) =
 #  result.freeIDs = nil
 proc newIDGen*[T: Ordinal](): PIDGen[T] =
   new(result)#, free)
diff --git a/tests/manyloc/keineschweine/lib/input_helpers.nim b/tests/manyloc/keineschweine/lib/input_helpers.nim
index 120576dfb..1953cb58c 100644
--- a/tests/manyloc/keineschweine/lib/input_helpers.nim
+++ b/tests/manyloc/keineschweine/lib/input_helpers.nim
@@ -2,7 +2,7 @@ import
   sfml, tables, hashes
 type
   TKeyEventKind* = enum down, up
-  TInputFinishedProc* = proc() 
+  TInputFinishedProc* = proc()
   TKeyCallback = proc()
   PKeyClient* = ref object
     onKeyDown: TTable[int32, TKeyCallback]
@@ -18,7 +18,7 @@ var
   activeClient: PKeyClient = nil
   activeInput: PTextInput  = nil
 
-proc setActive*(client: PKeyClient) = 
+proc setActive*(client: PKeyClient) =
   activeClient = client
   echo("** set active client ", client.name)
 proc newKeyClient*(name: string = "unnamed", setactive = false): PKeyClient =
@@ -43,28 +43,28 @@ proc addKeyEvent*(key: TKeyCode, ev: TKeyEventKind) {.inline.} =
   if activeClient.isNil: return
   let k = key.int32
   case ev
-  of down: 
+  of down:
     keyState[k] = true
     if activeClient.onKeyDown.hasKey(k):
       activeClient.onKeyDown[k]()
-  else:    
+  else:
     keyState[k] = false
     if activeClient.onKeyUp.hasKey(k):
       activeClient.onKeyUp[k]()
 proc addButtonEvent*(btn: TMouseButton, ev: TKeyEventKind) {.inline.} =
-  if activeClient.isNil: return 
+  if activeClient.isNil: return
   let b = -btn.int32
   case ev
-  of down: 
-    keyState[b] = true 
+  of down:
+    keyState[b] = true
     if activeClient.onKeyDown.hasKey(b):
       activeClient.onKeyDown[b]()
-  else: 
+  else:
     keyState[b] = false
     if activeClient.onKeyUp.hasKey(b):
       activeClient.onKeyUp[b]()
 proc registerHandler*(client: PKeyClient; key: TKeyCode;
-                       ev: TKeyEventKind; fn: TKeyCallback) = 
+                       ev: TKeyEventKind; fn: TKeyCallback) =
   case ev
   of down: client.onKeyDown[key.int32] = fn
   of up:   client.onKeyUp[key.int32]   = fn
@@ -90,7 +90,7 @@ proc recordText*(i: PTextInput; c: cint) =
   if c > 127 or i.isNil: return
   if c in 32..126: ##printable
     if i.cursor == i.text.len: i.text.add(c.int.chr)
-    else: 
+    else:
       let rem = i.text.substr(i.cursor)
       i.text.setLen(i.cursor)
       i.text.add(chr(c.int))
@@ -104,7 +104,7 @@ proc recordText*(i: PTextInput; c: cint) =
       i.text.add(rem)
   elif c == 10 or c == 13:## \n, \r  enter
     if not i.onEnter.isNil: i.onEnter()
-proc recordText*(i: PTextInput; e: TTextEvent) {.inline.} = 
+proc recordText*(i: PTextInput; e: TTextEvent) {.inline.} =
   recordText(i, e.unicode)
 
 proc setMousePos*(x, y: cint) {.inline.} =
@@ -135,4 +135,4 @@ iterator pollEvents*(window: PRenderWindow): PEvent =
     of EvtTextEntered: recordText(activeInput, event.text)
     of EvtMouseMoved: setMousePos(event.mouseMove.x, event.mouseMove.y)
     else: nil
-    yield(addr event)
\ No newline at end of file
+    yield(addr event)
diff --git a/tests/manyloc/keineschweine/lib/map_filter.nim b/tests/manyloc/keineschweine/lib/map_filter.nim
index 5776c9225..42ef74ceb 100644
--- a/tests/manyloc/keineschweine/lib/map_filter.nim
+++ b/tests/manyloc/keineschweine/lib/map_filter.nim
@@ -19,7 +19,7 @@ template unless*(condition: expr; body: stmt): stmt {.dirty.} =
 
 when isMainModule:
   proc dumpSeq[T](x: seq[T]) =
-    for index, item in x.pairs: 
+    for index, item in x.pairs:
       echo index, " ", item
     echo "-------"
 
@@ -28,13 +28,13 @@ when isMainModule:
   dumpSeq res
 
   from strutils import toHex
-  var foocakes = t.map(proc(z: int): string = 
+  var foocakes = t.map(proc(z: int): string =
     result = toHex((z * 23).BiggestInt, 4))
   dumpSeq foocakes
 
   t.mapInPlace(proc(z: int): int = result = z * 30)
   dumpSeq t
-  
+
   var someSeq = @[9,8,7,6,5,4,3,2,1] ## numbers < 6 or even
   filterIt2 someSeq, it < 6 or (it and 1) == 0:
     echo(it)
diff --git a/tests/manyloc/keineschweine/lib/math_helpers.nim b/tests/manyloc/keineschweine/lib/math_helpers.nim
index 8af56d1ed..5427dd80e 100644
--- a/tests/manyloc/keineschweine/lib/math_helpers.nim
+++ b/tests/manyloc/keineschweine/lib/math_helpers.nim
@@ -6,5 +6,5 @@ proc radians*(deg: float): float =
   return deg * PI / 180.0
 
 ## V not math, sue me
-proc ff*(f: float, precision = 2): string {.inline.} = 
+proc ff*(f: float, precision = 2): string {.inline.} =
   return formatFloat(f, ffDecimal, precision)
diff --git a/tests/manyloc/keineschweine/lib/sfml_stuff.nim b/tests/manyloc/keineschweine/lib/sfml_stuff.nim
index a5ac91195..5ff80b295 100644
--- a/tests/manyloc/keineschweine/lib/sfml_stuff.nim
+++ b/tests/manyloc/keineschweine/lib/sfml_stuff.nim
@@ -1,4 +1,4 @@
-import 
+import
   math, strutils,
   sfml, input_helpers
 when not defined(NoChipmunk):
diff --git a/tests/manyloc/keineschweine/lib/sg_assets.nim b/tests/manyloc/keineschweine/lib/sg_assets.nim
index c5a39550a..3b9781649 100644
--- a/tests/manyloc/keineschweine/lib/sg_assets.nim
+++ b/tests/manyloc/keineschweine/lib/sg_assets.nim
@@ -1,5 +1,5 @@
 import
-  re, json, strutils, tables, math, os, math_helpers, 
+  re, json, strutils, tables, math, os, math_helpers,
   sg_packets, md5, zlib_helpers
 
 when defined(NoSFML):
@@ -56,9 +56,9 @@ type
     energyCost*: float
     useSound*: PSoundRecord
     case kind*: TItemKind
-    of Projectile: 
+    of Projectile:
       bullet*: PBulletRecord
-    else: 
+    else:
       nil
   PBulletRecord* = ref TBulletRecord
   TBulletRecord* = object
@@ -84,7 +84,7 @@ type
     health*: int
   TExplosionRecord* = object
     anim*: PAnimationRecord
-    sound*: PSoundRecord 
+    sound*: PSoundRecord
   PAnimationRecord* = ref TAnimationRecord
   TAnimationRecord* = object
     spriteSheet*: PSpriteSheet
@@ -96,9 +96,9 @@ type
     when defined(NoSFML):
       contents*: TChecksumFile
     else:
-      soundBuf*: PSoundBuffer 
+      soundBuf*: PSoundBuffer
   PSpriteSheet* = ref TSpriteSheet
-  TSpriteSheet* = object 
+  TSpriteSheet* = object
     file*: string
     framew*,frameh*: int
     rows*, cols*: int
@@ -112,7 +112,7 @@ type
 const
   TAU* = PI * 2.0
   MomentMult* = 0.62 ## global moment of inertia multiplier
-var 
+var
   cfg: PZoneSettings
   SpriteSheets* = initTable[string, PSpriteSheet](64)
   SoundCache  * = initTable[string, PSoundRecord](64)
@@ -151,7 +151,7 @@ proc importSound*(data: PJsonNode; errors: var seq[string]; fieldName: string =
 ## this is the only pipe between lobby and main.nim
 proc getActiveState*(): TGameState =
   result = activeState
-proc transition*() = 
+proc transition*() =
   assert activeState == Lobby, "Transition() called from a state other than lobby!"
   activeState = Transitioning
 proc doneWithSaidTransition*() =
@@ -179,7 +179,7 @@ proc free*(obj: PSoundRecord) =
   echo "Free'd ", obj.file
 
 proc loadAllAssets*() =
-  var 
+  var
     loaded = 0
     failed = 0
   for name, ss in SpriteSheets.pairs():
@@ -205,7 +205,7 @@ iterator playableVehicles*(): PVehicleRecord =
       yield v
 
 template allAssets*(body: stmt) {.dirty.}=
-  block: 
+  block:
     var assetType = FGraphics
     for file, asset in pairs(SpriteSheets):
       body
@@ -230,7 +230,7 @@ cacheImpl newSprite, SpriteSheets, PSpriteSheet:
   if filename =~ re"\S+_(\d+)x(\d+)\.\S\S\S":
     result.framew = strutils.parseInt(matches[0])
     result.frameh = strutils.parseInt(matches[1])
-    checkFile("data/gfx"/result.file)  
+    checkFile("data/gfx"/result.file)
   else:
     errors.add "Bad file: "&filename&" must be in format name_WxH.png"
     return
@@ -260,7 +260,7 @@ when defined(NoSFML):
     result = true
 else:
   proc load*(ss: PSpriteSheet): bool =
-    if not ss.sprite.isNil: 
+    if not ss.sprite.isNil:
       return
     var image = sfml.newImage("data/gfx/"/ss.file)
     if image == nil:
@@ -335,7 +335,7 @@ proc loadSettings*(rawJson: string, errors: var seq[string]): bool =
   except EJsonParsingError:
     errors.add("JSON parsing error: "& getCurrentExceptionMsg())
     return
-  except: 
+  except:
     errors.add("Unknown exception: "& getCurrentExceptionMsg())
     return
   if not validateSettings(settings, errors):
@@ -354,7 +354,7 @@ proc loadSettings*(rawJson: string, errors: var seq[string]): bool =
   nameToItemID = initTable[string, int](32)
   nameToObjID = initTable[string, int](32)
   nameToBulletID = initTable[string, int](32)
-  var 
+  var
     vID = 0'i16
     bID = 0'i16
   for vehicle in settings["vehicles"].items:
@@ -382,7 +382,7 @@ proc loadSettings*(rawJson: string, errors: var seq[string]): bool =
         errors.add("Projectile #$1 has no bullet!"% $vID)
       elif itm.bullet.id == -1:
         ## this item has an anonymous bullet, fix the ID and name
-        itm.bullet.id = bID 
+        itm.bullet.id = bID
         itm.bullet.name = itm.name
         cfg.bullets.add itm.bullet
         nameToBulletID[itm.bullet.name] = itm.bullet.id
@@ -448,7 +448,7 @@ proc importLevel(data: PJsonNode; errors: var seq[string]): PLevelSettings =
   new(result)
   result.size = vec2i(5000, 5000)
   result.starfield = @[]
-  
+
   checkKey(data, "level")
   var level = data["level"]
   if level.hasKey("size") and level["size"].kind == JArray and level["size"].len == 2:
@@ -460,7 +460,7 @@ proc importLevel(data: PJsonNode; errors: var seq[string]): PLevelSettings =
 proc importPhys(data: PJsonNode): TPhysicsRecord =
   result.radius = 20.0
   result.mass = 10.0
-  
+
   if data.hasKey("physics") and data["physics"].kind == JObject:
     let phys = data["physics"]
     phys.getField("radius", result.radius)
@@ -473,11 +473,11 @@ proc importHandling(data: PJsonNode): THandlingRecord =
   result.reverse = 30.0
   result.strafe = 30.0
   result.rotation = 2200.0
-  
+
   checkKey(data, "handling")
   if data["handling"].kind != JObject:
     return
-  
+
   let hand = data["handling"]
   hand.getField("thrust", result.thrust)
   hand.getField("top_speed", result.topSpeed)
@@ -489,19 +489,19 @@ proc importAnim(data: PJsonNode, errors: var seq[string]): PAnimationRecord =
   result.angle = 0.0
   result.delay = 1000.0
   result.spriteSheet = nil
-  
+
   if data.hasKey("anim"):
     let anim = data["anim"]
     if anim.kind == JObject:
       if anim.hasKey("file"):
         result.spriteSheet = newSprite(anim["file"].str, errors)
-      
+
       anim.getField "angle", result.angle
       anim.getField "delay", result.delay
     elif data["anim"].kind == JString:
       result.spriteSheet = newSprite(anim.str, errors)
-  
-  result.angle = radians(result.angle) ## comes in as degrees 
+
+  result.angle = radians(result.angle) ## comes in as degrees
   result.delay /= 1000 ## delay comes in as milliseconds
 proc importSoul(data: PJsonNode): TSoulRecord =
   result.energy = 10000
@@ -525,8 +525,8 @@ proc importSound*(data: PJsonNode; errors: var seq[string]; fieldName: string =
 proc importVeh(data: PJsonNode; errors: var seq[string]): PVehicleRecord =
   new(result)
   result.playable = false
-  if data.kind != JArray or data.len != 2 or 
-    (data.kind == JArray and 
+  if data.kind != JArray or data.len != 2 or
+    (data.kind == JArray and
       (data[0].kind != JString or data[1].kind != JObject)):
     result.name = "(broken)"
     errors.add "Vehicle record is malformed"
@@ -556,13 +556,13 @@ proc importItem(data: PJsonNode; errors: var seq[string]): PItemRecord =
   result.name = data[0].str
   result.anim = importAnim(data[2], errors)
   result.physics = importPhys(data[2])
-  
-  result.cooldown = 100.0 
+
+  result.cooldown = 100.0
   data[2].getField("cooldown", result.cooldown)
-  result.cooldown /= 1000.0  ##cooldown is stored in ms 
-  
+  result.cooldown /= 1000.0  ##cooldown is stored in ms
+
   result.useSound = importSound(data[2], errors, "useSound")
-  
+
   case data[1].str.toLower
   of "projectile":
     result.kind = Projectile
@@ -570,7 +570,7 @@ proc importItem(data: PJsonNode; errors: var seq[string]): PItemRecord =
       result.bullet = fetchBullet(data[2]["bullet"].str)
     elif data[2]["bullet"].kind == JInt:
       result.bullet = cfg.bullets[data[2]["bullet"].num.int]
-    elif data[2]["bullet"].kind == JObject: 
+    elif data[2]["bullet"].kind == JObject:
       result.bullet = importBullet(data[2]["bullet"], errors)
     else:
       errors.add "UNKNOWN BULLET TYPE for item "& result.name
@@ -584,20 +584,20 @@ proc importItem(data: PJsonNode; errors: var seq[string]): PItemRecord =
 proc importBullet(data: PJsonNode; errors: var seq[string]): PBulletRecord =
   new(result)
   result.id = -1
-  
+
   var bdata: PJsonNode
   if data.kind == JArray:
     result.name = data[0].str
     bdata = data[1]
   elif data.kind == JObject:
     bdata = data
-  else: 
+  else:
     errors.add "Malformed bullet record"
     return
-  
+
   result.anim = importAnim(bdata, errors)
   result.physics = importPhys(bdata)
-  
+
   result.lifetime = 2000.0
   result.inheritVelocity = 1000.0
   result.baseVelocity = 30.0
diff --git a/tests/manyloc/keineschweine/lib/sg_gui.nim b/tests/manyloc/keineschweine/lib/sg_gui.nim
index 6741fe55e..aae51baec 100644
--- a/tests/manyloc/keineschweine/lib/sg_gui.nim
+++ b/tests/manyloc/keineschweine/lib/sg_gui.nim
@@ -1,5 +1,5 @@
 import
-  sfml, sfml_colors, 
+  sfml, sfml_colors,
   input_helpers, sg_packets
 from strutils import countlines
 {.deadCodeElim: on.}
@@ -63,7 +63,7 @@ proc click*(b: PButton; p: TVector2f)
 proc setPosition*(b: PButton; p: TVector2f)
 proc setString*(b: PButton; s: string) {.inline.}
 
-proc newButton*(container: PGuiContainer; text: string; position: TVector2f; 
+proc newButton*(container: PGuiContainer; text: string; position: TVector2f;
   onClick: TButtonClicked; startEnabled: bool = true): PButton {.discardable.}
 proc init(b: PButton; text: string; position: TVector2f; onClick: TButtonClicked)
 proc setEnabled*(b: PButton; enabled: bool)
@@ -91,7 +91,7 @@ proc newGuiContainer*(): PGuiContainer =
 proc newGuiContainer*(pos: TVector2f): PGuiContainer =
   result = newGuiContainer()
   result.setPosition pos
-proc free*(container: PGuiContainer) = 
+proc free*(container: PGuiContainer) =
   container.widgets = nil
   container.buttons = nil
 proc add*(container: PGuiContainer; widget: PGuiObject) =
@@ -128,9 +128,9 @@ proc newButton*(container: PGuiContainer; text: string;
                  position: TVector2f; onClick: TButtonClicked;
                  startEnabled: bool = true): PButton =
   new(result, free)
-  init(result, 
-       text, 
-       if not container.isNil: position + container.position else: position, 
+  init(result,
+       text,
+       if not container.isNil: position + container.position else: position,
        onClick)
   container.add result
   if not startEnabled: disable(result)
@@ -168,13 +168,13 @@ proc setPosition*(b: PButton, p: TVector2f) =
   b.bounds = b.text.getGlobalBounds()
 proc setString*(b: PButton; s: string) =
   b.text.setString(s)
-proc click*(b: PButton, p: TVector2f) = 
-  if b.enabled and (addr b.bounds).contains(p.x, p.y): 
+proc click*(b: PButton, p: TVector2f) =
+  if b.enabled and (addr b.bounds).contains(p.x, p.y):
     b.onClick(b)
 
 proc free(obj: PTextEntry) =
   free(PButton(obj))
-proc newTextEntry*(container: PGuiContainer; text: string; 
+proc newTextEntry*(container: PGuiContainer; text: string;
                     position: TVector2F; onEnter: TInputFinishedProc = nil): PTextEntry =
   new(result, free)
   init(PButton(result), text, position + container.position, proc(b: PButton) =
@@ -210,7 +210,7 @@ proc add*(m: PMessageArea, text: string): PText =
     pos.y -= 16.0
 
 proc draw*(window: PRenderWindow; m: PMessageArea) =
-  let nmsgs = len(m.messages) 
+  let nmsgs = len(m.messages)
   if nmsgs == 0: return
   for i in countdown(nmsgs - 1, max(nmsgs - 30, 0)):
     window.draw(m.messages[i])
@@ -224,11 +224,11 @@ proc newMessageArea*(container: PGuiContainer; position: TVector2f): PMessageAre
   result.scrollBack = 0
   result.direction = -1 ## to push old messages up
   container.add(result)
-  
+
 proc add*(m: PMessageArea, msg: ScChat) =
   const prependName = {CPub, CPriv}
   var mmm: TMessage
-  if msg.kind in prependName: 
+  if msg.kind in prependName:
     mmm.text = "<"
     mmm.text.add msg.fromPlayer
     mmm.text.add "> "
@@ -239,9 +239,9 @@ proc add*(m: PMessageArea, msg: ScChat) =
   of CPub:  mmm.color = RoyalBlue
   of CPriv, CSystem: mmm.color = Green
   of CError: mmm.color = Red
-  
+
   mmm.lines = countLines(mmm.text)+1
-  
+
   m.messages.add mmm
   update m
 proc add*(m: PMessageArea, msg: string) {.inline.} =
@@ -249,7 +249,7 @@ proc add*(m: PMessageArea, msg: string) {.inline.} =
   add(m, chat)
 
 proc proctor*(m: PText; msg: ptr TMessage; pos: ptr TVector2f) =
-  m.setString msg.text 
+  m.setString msg.text
   m.setColor msg.color
   m.setPosition pos[]
 proc update*(m: PMessageArea) =
@@ -263,7 +263,7 @@ proc update*(m: PMessageArea) =
     for i in m.sizeVisible.. < m.texts.len:
       m.texts.pop().destroy()
   let nmsgs = m.messages.len()
-  if m.sizeVisible == 0 or nmsgs == 0: 
+  if m.sizeVisible == 0 or nmsgs == 0:
     echo "no messages? ", m.sizeVisible, ", ", nmsgs
     return
   var pos = vec2f(m.pos.x, m.pos.y)
@@ -271,7 +271,7 @@ proc update*(m: PMessageArea) =
     ##echo nmsgs - i - 1 - m.scrollBack
     let msg = addr m.messages[nmsgs - i - 1 - m.scrollBack]
     proctor(m.texts[i], msg, addr pos)
-    pos.y += (16 * m.direction * msg.lines).cfloat  
+    pos.y += (16 * m.direction * msg.lines).cfloat
 
 proc draw*(window: PRenderWindow; m: PMessageArea) =
   let nmsgs = len(m.texts)
diff --git a/tests/manyloc/keineschweine/lib/sg_packets.nim b/tests/manyloc/keineschweine/lib/sg_packets.nim
index 601054b47..d84bf72fc 100644
--- a/tests/manyloc/keineschweine/lib/sg_packets.nim
+++ b/tests/manyloc/keineschweine/lib/sg_packets.nim
@@ -33,7 +33,7 @@ defPacket(Poing, tuple[id: int32, time: float32])
 type ChatType* = enum
   CPub = 0'i8, CPriv, CSystem, CError
 forwardPacketT(ChatType, int8)
-idPacket(Chat, 'C', 
+idPacket(Chat, 'C',
   tuple[kind: ChatType = CPub; fromPlayer: string = ""; text: string = ""],
   tuple[target: string = ""; text: string = ""])
 
@@ -65,8 +65,8 @@ defPacket(ScSpawn, tuple[
 
 
 type TAssetType* = enum
-  FDummy, 
-  FZoneCfg, FGraphics, FSound 
+  FDummy,
+  FZoneCfg, FGraphics, FSound
 
 forwardPacketT(TAssetType, int8)
 forwardPacket(MD5Digest, array[0..15, int8])
@@ -93,7 +93,7 @@ let HVerifyClient* = 'v'
 defPacket(SdVerifyClient, tuple[session: ScLogin])
 
 when isMainModule:
-  
+
   var buf = newBuffer(100)
   var m = toMd5("hello there")
   echo(repr(m))
@@ -101,7 +101,7 @@ when isMainModule:
 
   echo(repr(buf.data))
   echo(len(buf.data))
-  
+
   buf.reset()
 
   var x = buf.readMD5Digest()
diff --git a/tests/manyloc/keineschweine/lib/vehicles.nim b/tests/manyloc/keineschweine/lib/vehicles.nim
index 4b11856c6..94ebf9f57 100644
--- a/tests/manyloc/keineschweine/lib/vehicles.nim
+++ b/tests/manyloc/keineschweine/lib/vehicles.nim
@@ -1,5 +1,5 @@
 import
-  sfml, chipmunk, 
+  sfml, chipmunk,
   sg_assets, sfml_stuff, keineschweine
 
 
diff --git a/tests/manyloc/keineschweine/lib/wingl.nim b/tests/manyloc/keineschweine/lib/wingl.nim
index 7ed78f970..5bd199911 100644
--- a/tests/manyloc/keineschweine/lib/wingl.nim
+++ b/tests/manyloc/keineschweine/lib/wingl.nim
@@ -1,9 +1,9 @@
-import 
+import
   gl, windows
 
-proc wglGetExtensionsStringARB*(hdc: HDC): cstring{.dynlib: dllname, 
+proc wglGetExtensionsStringARB*(hdc: HDC): cstring{.dynlib: dllname,
     importc: "wglGetExtensionsStringARB".}
-const 
+const
   WGL_FRONT_COLOR_BUFFER_BIT_ARB* = 0x00000001
   WGL_BACK_COLOR_BUFFER_BIT_ARB* = 0x00000002
   WGL_DEPTH_BUFFER_BIT_ARB* = 0x00000004
@@ -13,21 +13,21 @@ 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, 
+proc wglDeleteBufferRegionARB*(hRegion: THandle){.dynlib: dllname,
     importc: "wglDeleteBufferRegionARB".}
-proc wglSaveBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint, 
+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, 
+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, 
+proc wglAllocateMemoryNV*(size: TGLsizei, readFrequency: TGLfloat,
                           writeFrequency: TGLfloat, priority: TGLfloat): PGLvoid{.
     dynlib: dllname, importc: "wglAllocateMemoryNV".}
-proc wglFreeMemoryNV*(pointer: PGLvoid){.dynlib: dllname, 
+proc wglFreeMemoryNV*(pointer: PGLvoid){.dynlib: dllname,
     importc: "wglFreeMemoryNV".}
-const 
+const
   WGL_IMAGE_BUFFER_MIN_ACCESS_I3D* = 0x00000001
   WGL_IMAGE_BUFFER_LOCK_I3D* = 0x00000002
 
@@ -35,30 +35,30 @@ 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, 
+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, 
+proc wglEnableFrameLockI3D*(): BOOL{.dynlib: dllname,
                                      importc: "wglEnableFrameLockI3D".}
-proc wglDisableFrameLockI3D*(): BOOL{.dynlib: dllname, 
+proc wglDisableFrameLockI3D*(): BOOL{.dynlib: dllname,
                                       importc: "wglDisableFrameLockI3D".}
-proc wglIsEnabledFrameLockI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname, 
+proc wglIsEnabledFrameLockI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname,
     importc: "wglIsEnabledFrameLockI3D".}
-proc wglQueryFrameLockMasterI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname, 
+proc wglQueryFrameLockMasterI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname,
     importc: "wglQueryFrameLockMasterI3D".}
-proc wglGetFrameUsageI3D*(pUsage: PGLfloat): BOOL{.dynlib: dllname, 
+proc wglGetFrameUsageI3D*(pUsage: PGLfloat): BOOL{.dynlib: dllname,
     importc: "wglGetFrameUsageI3D".}
-proc wglBeginFrameTrackingI3D*(): BOOL{.dynlib: dllname, 
+proc wglBeginFrameTrackingI3D*(): BOOL{.dynlib: dllname,
                                         importc: "wglBeginFrameTrackingI3D".}
-proc wglEndFrameTrackingI3D*(): BOOL{.dynlib: dllname, 
+proc wglEndFrameTrackingI3D*(): BOOL{.dynlib: dllname,
                                       importc: "wglEndFrameTrackingI3D".}
-proc wglQueryFrameTrackingI3D*(pFrameCount: PDWORD, pMissedFrames: PDWORD, 
+proc wglQueryFrameTrackingI3D*(pFrameCount: PDWORD, pMissedFrames: PDWORD,
                                pLastMissedUsage: PGLfloat): BOOL{.
     dynlib: dllname, importc: "wglQueryFrameTrackingI3D".}
-const 
+const
   WGL_NUMBER_PIXEL_FORMATS_ARB* = 0x00002000
   WGL_DRAW_TO_WINDOW_ARB* = 0x00002001
   WGL_DRAW_TO_BITMAP_ARB* = 0x00002002
@@ -109,27 +109,27 @@ const
   WGL_TYPE_RGBA_ARB* = 0x0000202B
   WGL_TYPE_COLORINDEX_ARB* = 0x0000202C
 
-proc wglGetPixelFormatAttribivARB*(hdc: HDC, iPixelFormat: TGLint, 
-                                   iLayerPlane: TGLint, nAttributes: TGLuint, 
+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, 
+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, 
+proc wglChoosePixelFormatARB*(hdc: HDC, piAttribIList: PGLint,
+                              pfAttribFList: PGLfloat, nMaxFormats: TGLuint,
                               piFormats: PGLint, nNumFormats: PGLuint): BOOL{.
     dynlib: dllname, importc: "wglChoosePixelFormatARB".}
-const 
+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, 
+proc wglGetCurrentReadDCARB*(): HDC{.dynlib: dllname,
                                      importc: "wglGetCurrentReadDCARB".}
-const 
+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
@@ -139,22 +139,22 @@ const
   WGL_PBUFFER_HEIGHT_ARB* = 0x00002035
   WGL_PBUFFER_LOST_ARB* = 0x00002036
 
-proc wglCreatePbufferARB*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint, 
+proc wglCreatePbufferARB*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint,
                           iHeight: TGLint, piAttribList: PGLint): THandle{.
     dynlib: dllname, importc: "wglCreatePbufferARB".}
-proc wglGetPbufferDCARB*(hPbuffer: THandle): HDC{.dynlib: dllname, 
+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, 
+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, 
+proc wglSwapIntervalEXT*(interval: TGLint): BOOL{.dynlib: dllname,
     importc: "wglSwapIntervalEXT".}
-proc wglGetSwapIntervalEXT*(): TGLint{.dynlib: dllname, 
+proc wglGetSwapIntervalEXT*(): TGLint{.dynlib: dllname,
                                        importc: "wglGetSwapIntervalEXT".}
-const 
+const
   WGL_BIND_TO_TEXTURE_RGB_ARB* = 0x00002070
   WGL_BIND_TO_TEXTURE_RGBA_ARB* = 0x00002071
   WGL_TEXTURE_FORMAT_ARB* = 0x00002072
@@ -195,13 +195,13 @@ 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, 
+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, 
+proc wglGetCurrentReadDCEXT*(): HDC{.dynlib: dllname,
                                      importc: "wglGetCurrentReadDCEXT".}
-const 
+const
   WGL_DRAW_TO_PBUFFER_EXT* = 0x0000202D
   WGL_MAX_PBUFFER_PIXELS_EXT* = 0x0000202E
   WGL_MAX_PBUFFER_WIDTH_EXT* = 0x0000202F
@@ -212,18 +212,18 @@ const
   WGL_PBUFFER_WIDTH_EXT* = 0x00002034
   WGL_PBUFFER_HEIGHT_EXT* = 0x00002035
 
-proc wglCreatePbufferEXT*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint, 
+proc wglCreatePbufferEXT*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint,
                           iHeight: TGLint, piAttribList: PGLint): THandle{.
     dynlib: dllname, importc: "wglCreatePbufferEXT".}
-proc wglGetPbufferDCEXT*(hPbuffer: THandle): HDC{.dynlib: dllname, 
+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, 
+proc wglDestroyPbufferEXT*(hPbuffer: THandle): BOOL{.dynlib: dllname,
     importc: "wglDestroyPbufferEXT".}
 proc wglQueryPbufferEXT*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{.
     dynlib: dllname, importc: "wglQueryPbufferEXT".}
-const 
+const
   WGL_NUMBER_PIXEL_FORMATS_EXT* = 0x00002000
   WGL_DRAW_TO_WINDOW_EXT* = 0x00002001
   WGL_DRAW_TO_BITMAP_EXT* = 0x00002002
@@ -270,47 +270,47 @@ const
   WGL_TYPE_RGBA_EXT* = 0x0000202B
   WGL_TYPE_COLORINDEX_EXT* = 0x0000202C
 
-proc wglGetPixelFormatAttribivEXT*(hdc: HDC, iPixelFormat: TGLint, 
-                                   iLayerPlane: TGLint, nAttributes: TGLuint, 
+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, 
+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, 
+proc wglChoosePixelFormatEXT*(hdc: HDC, piAttribIList: PGLint,
+                              pfAttribFList: PGLfloat, nMaxFormats: TGLuint,
                               piFormats: PGLint, nNumFormats: PGLuint): BOOL{.
     dynlib: dllname, importc: "wglChoosePixelFormatEXT".}
-const 
+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, 
+proc wglGetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint,
+                                      piValue: PGLint): BOOL{.dynlib: dllname,
     importc: "wglGetDigitalVideoParametersI3D".}
-proc wglSetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint, 
-                                      piValue: PGLint): BOOL{.dynlib: dllname, 
+proc wglSetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint,
+                                      piValue: PGLint): BOOL{.dynlib: dllname,
     importc: "wglSetDigitalVideoParametersI3D".}
-const 
+const
   WGL_GAMMA_TABLE_SIZE_I3D* = 0x0000204E
   WGL_GAMMA_EXCLUDE_DESKTOP_I3D* = 0x0000204F
 
-proc wglGetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint, 
-                                    piValue: PGLint): BOOL{.dynlib: dllname, 
+proc wglGetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint,
+                                    piValue: PGLint): BOOL{.dynlib: dllname,
     importc: "wglGetGammaTableParametersI3D".}
-proc wglSetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint, 
-                                    piValue: PGLint): BOOL{.dynlib: dllname, 
+proc wglSetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint,
+                                    piValue: PGLint): BOOL{.dynlib: dllname,
     importc: "wglSetGammaTableParametersI3D".}
-proc wglGetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT, 
+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, 
+proc wglSetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT,
                           puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{.
     dynlib: dllname, importc: "wglSetGammaTableI3D".}
-const 
+const
   WGL_GENLOCK_SOURCE_MULTIVIEW_I3D* = 0x00002044
   WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D* = 0x00002045
   WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D* = 0x00002046
@@ -330,21 +330,21 @@ const
   WGL_TEXTURE_FLOAT_RGB_NV* = 0x000020B7
   WGL_TEXTURE_FLOAT_RGBA_NV* = 0x000020B8
 
-proc wglEnableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname, 
+proc wglEnableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname,
     importc: "wglEnableGenlockI3D".}
-proc wglDisableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname, 
+proc wglDisableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname,
     importc: "wglDisableGenlockI3D".}
-proc wglIsEnabledGenlockI3D*(hDC: HDC, pFlag: PBOOL): BOOL{.dynlib: dllname, 
+proc wglIsEnabledGenlockI3D*(hDC: HDC, pFlag: PBOOL): BOOL{.dynlib: dllname,
     importc: "wglIsEnabledGenlockI3D".}
-proc wglGenlockSourceI3D*(hDC: HDC, uSource: TGLuint): BOOL{.dynlib: dllname, 
+proc wglGenlockSourceI3D*(hDC: HDC, uSource: TGLuint): BOOL{.dynlib: dllname,
     importc: "wglGenlockSourceI3D".}
-proc wglGetGenlockSourceI3D*(hDC: HDC, uSource: PGLUINT): BOOL{.dynlib: dllname, 
+proc wglGetGenlockSourceI3D*(hDC: HDC, uSource: PGLUINT): BOOL{.dynlib: dllname,
     importc: "wglGetGenlockSourceI3D".}
-proc wglGenlockSourceEdgeI3D*(hDC: HDC, uEdge: TGLuint): BOOL{.dynlib: dllname, 
+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, 
+proc wglGenlockSampleRateI3D*(hDC: HDC, uRate: TGLuint): BOOL{.dynlib: dllname,
     importc: "wglGenlockSampleRateI3D".}
 proc wglGetGenlockSampleRateI3D*(hDC: HDC, uRate: PGLUINT): BOOL{.
     dynlib: dllname, importc: "wglGetGenlockSampleRateI3D".}
@@ -352,15 +352,15 @@ 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, 
+proc wglQueryGenlockMaxSourceDelayI3D*(hDC: HDC, uMaxLineDelay: PGLUINT,
                                        uMaxPixelDelay: PGLUINT): BOOL{.
     dynlib: dllname, importc: "wglQueryGenlockMaxSourceDelayI3D".}
-const 
+const
   WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV* = 0x000020A0
   WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV* = 0x000020A1
   WGL_TEXTURE_RECTANGLE_NV* = 0x000020A2
 
-const 
+const
   WGL_RGBA_FLOAT_MODE_ATI* = 0x00008820
   WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI* = 0x00008835
   WGL_TYPE_RGBA_FLOAT_ATI* = 0x000021A0
diff --git a/tests/manyloc/keineschweine/lib/zlib_helpers.nim b/tests/manyloc/keineschweine/lib/zlib_helpers.nim
index fcd0e8d24..076475964 100644
--- a/tests/manyloc/keineschweine/lib/zlib_helpers.nim
+++ b/tests/manyloc/keineschweine/lib/zlib_helpers.nim
@@ -1,4 +1,4 @@
-import zlib
+import zip/zlib
 
 proc compress*(source: string): string =
   var
@@ -18,7 +18,7 @@ proc uncompress*(source: string, destLen: var int): string =
   var res = zlib.uncompress(cstring(result), addr destLen, cstring(source), source.len)
   if res != Z_OK:
     echo "Error occurred: ", res
-    
+
 
 when isMainModule:
   import strutils
@@ -37,4 +37,4 @@ when isMainModule:
   ln = s.len
   rr = uncompress(r, ln)
   echo r.len, " -> ", rr.len
-  assert rr == s
\ No newline at end of file
+  assert rr == s
diff --git a/tests/manyloc/keineschweine/server/old_dirserver.nim b/tests/manyloc/keineschweine/server/old_dirserver.nim
index 897fc7d32..202dc6fe7 100644
--- a/tests/manyloc/keineschweine/server/old_dirserver.nim
+++ b/tests/manyloc/keineschweine/server/old_dirserver.nim
@@ -17,7 +17,7 @@ var
   ## I was high.
   clients = initTable[TupAddress, PClient](16)
   alias2client = initTable[string, PClient](32)
-  allClients: seq[PClient] = @[] 
+  allClients: seq[PClient] = @[]
 
 proc findClient*(host: string; port: int16): PClient =
   let addy: TupAddress = (host, port)
@@ -37,7 +37,7 @@ proc loginZone(client: PClient; login: SdZoneLogin): bool =
         result = true
         break
 
-proc sendZoneList(client: PClient) = 
+proc sendZoneList(client: PClient) =
   echo(">> zonelist ", client, ' ', HZoneList)
   client.send(HZonelist, zonelist)
 proc forwardPrivate(rcv: PClient; sender: PClient; txt: string) =
@@ -93,7 +93,7 @@ proc sendServMsg(client: PClient; msg: string) =
   var m = newDsMsg(msg)
   client.send HDsMsg, m
 handlers[HZoneLogin] = proc(client: PClient; stream: PStream) =
-  var 
+  var
     login = readSdZoneLogin(stream)
   if not client.loginZone(login):
     client.sendServMsg "Invalid login"
@@ -110,7 +110,7 @@ handlers[HFileChallenge] = proc(client: PClient; stream: PStream) =
       var chg = readScFileChallenge(stream)
 
 proc handlePkt(s: PClient; stream: PStream) =
-  while not stream.atEnd:  
+  while not stream.atEnd:
     var typ = readChar(stream)
     if not handlers.hasKey(typ):
       break
@@ -128,7 +128,7 @@ var clientIndex = 0
 var incoming = newIncomingBuffer()
 proc poll*(timeout: int = 250) =
   if server.isNil: return
-  var 
+  var
     reads = @[server]
     writes = @[server]
   if select(reads, timeout) > 0:
@@ -163,7 +163,7 @@ when isMainModule:
     case kind
     of cmdShortOption, cmdLongOption:
       case key
-      of "f", "file": 
+      of "f", "file":
         if existsFile(val):
           cfgFile = val
         else:
@@ -177,14 +177,14 @@ when isMainModule:
   zonelist.network = jsonSettings["network"].str
   for slot in jsonSettings["zones"].items:
     zoneSlots.add((slot["name"].str, slot["key"].str))
-  
+
   createServer(port)
   echo("Listening on port ", port, "...")
   var pubChatTimer = cpuTime() #newClock()
   const PubChatDelay = 1000/1000
   while true:
     poll(15)
-    ## TODO sort this type of thing VV into a queue api 
+    ## TODO sort this type of thing VV into a queue api
     if cpuTime() - pubChatTimer > PubChatDelay:       #.getElapsedTime.asMilliseconds > 100:
       pubChatTimer -= pubChatDelay
       if pubChatQueue.getPosition > 0:
diff --git a/tests/manyloc/keineschweine/server/old_server_utils.nim b/tests/manyloc/keineschweine/server/old_server_utils.nim
index af9a1b01e..d0fd39ae0 100644
--- a/tests/manyloc/keineschweine/server/old_server_utils.nim
+++ b/tests/manyloc/keineschweine/server/old_server_utils.nim
@@ -1,4 +1,4 @@
-import 
+import
   streams, md5, sockets, unsigned,
   sg_packets, zlib_helpers, idgen
 type
@@ -54,7 +54,7 @@ proc newClient*(addy: TupAddress): PClient =
   new(result, free)
   result.addy = addy
   result.outputBuf = newStringStream("")
-  result.outputBuf.flushImpl = proc(stream: PStream) = 
+  result.outputBuf.flushImpl = proc(stream: PStream) =
     stream.setPosition 0
     PStringStream(stream).data.setLen 0
 
diff --git a/tests/manyloc/keineschweine/server/old_sg_server.nim b/tests/manyloc/keineschweine/server/old_sg_server.nim
index 1e57c12a1..c326720fe 100644
--- a/tests/manyloc/keineschweine/server/old_sg_server.nim
+++ b/tests/manyloc/keineschweine/server/old_sg_server.nim
@@ -9,13 +9,13 @@ var
   ## I was high.
   clients = initTable[TupAddress, PClient](16)
   alias2client = initTable[string, PClient](32)
-  allClients: seq[PClient] = @[] 
-  zonePlayers: seq[PClient] = @[] 
+  allClients: seq[PClient] = @[]
+  zonePlayers: seq[PClient] = @[]
 const
   PubChatDelay = 100/1000 #100 ms
 
 import hashes
-proc hash*(x: uint16): THash {.inline.} = 
+proc hash*(x: uint16): THash {.inline.} =
   result = int32(x)
 
 proc findClient*(host: string; port: int16): PClient =
@@ -27,7 +27,7 @@ proc findClient*(host: string; port: int16): PClient =
   allClients.add(result)
 
 
-proc sendZoneList(client: PClient) = 
+proc sendZoneList(client: PClient) =
   echo(">> zonelist ", client)
   #client.send(HZonelist, zonelist)
 
@@ -83,7 +83,7 @@ handlers[HZoneQuery] = proc(client: PClient; stream: PStream) =
 
 handlers[HZoneJoinReq] = proc(client: PClient; stream: PStream) =
   var req = readCsZoneJoinReq(stream)
-  echo "Join zone request from (",req.session.id,") ", req.session.alias 
+  echo "Join zone request from (",req.session.id,") ", req.session.alias
   if client.auth and client.kind == CPlayer:
     echo "Client is authenticated, verifying filez"
     client.startVerifyingFiles()
@@ -97,7 +97,7 @@ handlers[HZoneJoinReq] = proc(client: PClient; stream: PStream) =
 
 
 proc handlePkt(s: PClient; stream: PStream) =
-  while not stream.atEnd:  
+  while not stream.atEnd:
     var typ = readChar(stream)
     if not handlers.hasKey(typ):
       break
@@ -114,7 +114,7 @@ var clientIndex = 0
 var incoming = newIncomingBuffer()
 proc poll*(timeout: int = 250) =
   if server.isNil: return
-  var 
+  var
     reads = @[server]
     writes = @[server]
   if select(reads, timeout) > 0:
@@ -148,7 +148,7 @@ when isMainModule:
     case kind
     of cmdShortOption, cmdLongOption:
       case key
-      of "f", "file": 
+      of "f", "file":
         if existsFile(val):
           zoneCfgFile = val
         else:
@@ -158,45 +158,45 @@ when isMainModule:
     else:
       echo("Unknown option: ", key, " ", val)
   var jsonSettings = parseFile(zoneCfgFile)
-  let 
+  let
     host = jsonSettings["host"].str
     port = TPort(jsonSettings["port"].num)
     zoneFile = jsonSettings["settings"].str
     dirServerInfo = jsonSettings["dirserver"]
-  
+
   var path = getAppDir()/../"data"/zoneFile
   if not existsFile(path):
     echo("Zone settings file does not exist: ../data/", zoneFile)
     echo(path)
     quit(1)
-  
+
   ## Test file
   block:
-    var 
+    var
       TestFile: FileChallengePair
       contents = repeat("abcdefghijklmnopqrstuvwxyz", 2)
-    testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32) 
+    testFile.challenge = newScFileChallenge("foobar.test", FZoneCfg, contents.len.int32)
     testFile.file = checksumStr(contents)
     myAssets.add testFile
-  
+
   setCurrentDir getAppDir().parentDir()
   block:
     let zonesettings = readFile(path)
-    var 
+    var
       errors: seq[string] = @[]
     if not loadSettings(zoneSettings, errors):
       echo("You have errors in your zone settings:")
       for e in errors: echo("**", e)
       quit(1)
     errors.setLen 0
-    
+
     var pair: FileChallengePair
     pair.challenge.file = zoneFile
     pair.challenge.assetType = FZoneCfg
     pair.challenge.fullLen = zoneSettings.len.int32
     pair.file = checksumStr(zoneSettings)
     myAssets.add pair
-    
+
     allAssets:
       if not load(asset):
         echo "Invalid or missing file ", file
@@ -208,10 +208,10 @@ when isMainModule:
           expandPath(assetType, file)).int32
         pair.file = asset.contents
         myAssets.add pair
-        
+
     echo "Zone has ", myAssets.len, " associated assets"
-    
-      
+
+
     dirServer = newServerConnection(dirServerInfo[0].str, dirServerInfo[1].num.TPort)
     dirServer.handlers[HDsMsg] = proc(serv: PServer; stream: PStream) =
       var m = readDsMsg(stream)
@@ -221,18 +221,18 @@ when isMainModule:
       if loggedIn:
         dirServerConnected = true
     dirServer.writePkt HZoneLogin, login
-  
+
   thisZone.name = jsonSettings["name"].str
   thisZone.desc = jsonSettings["desc"].str
   thisZone.ip = "localhost"
   thisZone.port = port
   var login = newSdZoneLogin(
     dirServerInfo[2].str, dirServerInfo[3].str,
-    thisZone)  
+    thisZone)
   #echo "MY LOGIN: ", $login
-  
-  
-  
+
+
+
   createServer(port)
   echo("Listening on port ", port, "...")
   var pubChatTimer = cpuTime()#newClock()
@@ -240,7 +240,7 @@ when isMainModule:
     discard dirServer.pollServer(15)
     poll(15)
     ## TODO sort this type of thing VV into a queue api
-    #let now = cpuTime() 
+    #let now = cpuTime()
     if cpuTime() - pubChatTimer > PubChatDelay:       #.getElapsedTime.asMilliseconds > 100:
       pubChatTimer -= pubChatDelay #.restart()
       if pubChatQueue.getPosition > 0:
@@ -250,5 +250,5 @@ when isMainModule:
           c.outputBuf.writeData(addr pubChatQueue.data[0], sizePubChat)
         pubChatQueue.flush()
 
-  
-  
\ No newline at end of file
+
+
diff --git a/tests/manyloc/keineschweine/server/sg_lobby.nim b/tests/manyloc/keineschweine/server/sg_lobby.nim
index 042d72337..f130e1b54 100644
--- a/tests/manyloc/keineschweine/server/sg_lobby.nim
+++ b/tests/manyloc/keineschweine/server/sg_lobby.nim
@@ -1,7 +1,7 @@
 
 import
-  sockets, streams, tables, times, math, strutils, json, os, md5, 
-  sfml, sfml_vector, sfml_colors, 
+  sockets, streams, tables, times, math, strutils, json, os, md5,
+  sfml, sfml_vector, sfml_colors,
   streams_enh, input_helpers, zlib_helpers, client_helpers, sg_packets, sg_assets, sg_gui
 type
   TClientSettings = object
@@ -33,7 +33,7 @@ var
   downloadProgress: PButton
   connectionButtons: seq[PButton] #buttons that depend on connection to function
 
-template dispmessage(m: expr): stmt = 
+template dispmessage(m: expr): stmt =
   messageArea.add(m)
 proc connectZone(host: string; port: TPort)
 proc connectToDirserv()
@@ -63,7 +63,7 @@ proc handleChat(serv: PServer; s: PStream) =
 proc connectToDirserv() =
   if dirServer.isNil:
     dirServer = newServerConnection(clientSettings.dirserver.host, clientSettings.dirserver.port)
-    dirServer.handlers[HHello] = proc(serv: PServer; s: PStream) = 
+    dirServer.handlers[HHello] = proc(serv: PServer; s: PStream) =
       let msg = readScHello(s)
       dispMessage(msg.resp)
       setConnected(true)
@@ -71,7 +71,7 @@ proc connectToDirserv() =
       mySession = readScLogin(s)
       ##do something here
     dirServer.handlers[HZonelist] = proc(serv: PServer; s: PStream) =
-      var 
+      var
         info = readScZonelist(s)
         zones = info.zones
       if zones.len > 0:
@@ -87,11 +87,11 @@ proc connectToDirserv() =
           var z = zones[i]
           zonelist.newButton(
             text = z.name, position = pos,
-            onClick = proc(b: PButton) = 
+            onClick = proc(b: PButton) =
               setActiveZone(i, z))
           pos.y += 20
         showZonelist = true
-    dirServer.handlers[HPoing] = proc(serv: PServer; s: PStream) = 
+    dirServer.handlers[HPoing] = proc(serv: PServer; s: PStream) =
       var ping = readPoing(s)
       dispmessage("Ping: "& $ping.time)
       ping.time = epochTime().float32
@@ -108,19 +108,19 @@ proc zoneListReq() =
   writePkt HZonelist, pkt
 
 ##key handlers
-keyClient.registerHandler(MouseMiddle, down, proc() = 
+keyClient.registerHandler(MouseMiddle, down, proc() =
   gui.setPosition(getMousePos()))
 
-keyClient.registerHandler(KeyO, down, proc() = 
+keyClient.registerHandler(KeyO, down, proc() =
   if keyPressed(KeyRShift): echo(repr(outgoing)))
 keyClient.registerHandler(KeyTab, down, proc() =
   activeInput = (activeInput + 1) mod 2) #does this work?
-keyClient.registerHandler(MouseLeft, down, proc() = 
+keyClient.registerHandler(MouseLeft, down, proc() =
   let p = getMousePos()
   gui.click(p)
   if showZonelist: zonelist.click(p))
 var mptext = newText("", guiFont, 16)
-keyClient.registerHandler(MouseRight, down, proc() = 
+keyClient.registerHandler(MouseRight, down, proc() =
   let p = getMousePos()
   mptext.setPosition(p)
   mptext.setString("($1,$2)"%[$p.x.int,$p.y.int]))
@@ -133,15 +133,15 @@ proc connectZone(host: string, port: TPort) =
     zone.handlers[HFileChallenge] = handleFileChallenge
     zone.handlers[HChallengeResult] = handleFileChallengeResult
     zone.handlers[HFileTransfer] = handleFileTransfer
-    zone.handlers[HChat] = handleChat 
+    zone.handlers[HChat] = handleChat
   else:
     zone.sock.connect(host, port)
   var hello = newCsHello()
   zone.writePkt HHello, hello
-  
 
 
-proc lobbyReady*() = 
+
+proc lobbyReady*() =
   keyClient.setActive()
   gui.setActive(u_alias)
 
@@ -186,27 +186,27 @@ proc lobbyInit*() =
   clientSettings.website = s["website"].str
   zonelist.setPosition(vec2f(200.0, 100.0))
   connectionButtons = @[]
-  
+
   downloadProgress = gui.newButton(
-    text = "", position = vec2f(10, 130), onClick = nil) 
+    text = "", position = vec2f(10, 130), onClick = nil)
   downloadProgress.bg.setFillColor(color(34, 139, 34))
   downloadProgress.bg.setSize(vec2f(0, 0))
-  
+
   var pos = vec2f(10, 10)
   u_alias = gui.newTextEntry(
-    if s.existsKey("alias"): s["alias"].str else: "alias", 
+    if s.existsKey("alias"): s["alias"].str else: "alias",
     pos)
   pos.y += 20
   u_passwd = gui.newTextEntry("buzz", pos)
   pos.y += 20
   connectionButtons.add(gui.newButton(
-    text = "Login", 
+    text = "Login",
     position = pos,
     onClick = tryLogin,
     startEnabled = false))
   pos.y += 20
   fpsText.setPosition(pos)
-  
+
   playBtn = gui.newButton(
     text = "Play",
     position = vec2f(680.0, 8.0),
@@ -227,7 +227,7 @@ proc lobbyInit*() =
   connectionButtons.add(gui.newButton(
     text = "Test Chat",
     position = vec2f(10.0, 110.0),
-    onClick = (proc(b: PButton) = 
+    onClick = (proc(b: PButton) =
       var pkt = newCsChat(text = "ohai")
       writePkt HChat, pkt),
     startEnabled = false))
@@ -239,15 +239,15 @@ proc lobbyInit*() =
   gui.newButton(text = "Scrollback + 1", position = vec2f(185, 10), onClick = proc(b: PButton) =
     messageArea.scrollBack += 1
     update(messageArea))
-  gui.newButton(text = "Scrollback - 1", position = vec2f(185+160, 10), onClick = proc(b: PButton) = 
+  gui.newButton(text = "Scrollback - 1", position = vec2f(185+160, 10), onClick = proc(b: PButton) =
     messageArea.scrollBack -= 1
     update(messageArea))
   gui.newButton(text = "Flood msg area", position = vec2f(185, 30), onClick = proc(b: PButton) =
-    for i in 0.. <30: 
+    for i in 0.. <30:
       dispMessage($i))
 
 var i = 0
-proc lobbyUpdate*(dt: float) = 
+proc lobbyUpdate*(dt: float) =
   #let res = disp.poll()
   gui.update(dt)
   i = (i + 1) mod 60
diff --git a/tests/manyloc/nake/nake.nim b/tests/manyloc/nake/nake.nim
index 04b745003..1e88fa73b 100644
--- a/tests/manyloc/nake/nake.nim
+++ b/tests/manyloc/nake/nake.nim
@@ -3,7 +3,7 @@ DO AS THOU WILST PUBLIC LICENSE
 
 Whoever should stumble upon this document is henceforth and forever
 entitled to DO AS THOU WILST with aforementioned document and the
-contents thereof. 
+contents thereof.
 
 As said in the Olde Country, `Keepe it Gangster'."""
 
@@ -14,7 +14,7 @@ type
     desc*: string
     action*: TTaskFunction
   TTaskFunction* = proc() {.closure.}
-var 
+var
   tasks* = initTable[string, PTask](16)
 
 proc newTask*(desc: string; action: TTaskFunction): PTask
@@ -61,7 +61,7 @@ when isMainModule:
   quit(shell("nim", "c", "-r", "nakefile.nim", args))
 else:
   addQuitProc(proc() {.noconv.} =
-    var 
+    var
       task: string
       printTaskList: bool
     for kind, key, val in getOpt():
@@ -70,7 +70,7 @@ else:
         case key.tolower
         of "tasks", "t":
           printTaskList = true
-        else: 
+        else:
           echo "Unknown option: ", key, ": ", val
       of cmdArgument:
         task = key
diff --git a/tests/manyloc/nake/nakefile.nim b/tests/manyloc/nake/nakefile.nim
index d1d712964..2fe07ec17 100644
--- a/tests/manyloc/nake/nakefile.nim
+++ b/tests/manyloc/nake/nakefile.nim
@@ -1,10 +1,10 @@
 import nake
-import httpclient, zipfiles, times, math
+import httpclient, zip/zipfiles, times, math
 nakeImports
 
 randomize()
 
-const 
+const
   GameAssets = "http://dl.dropbox.com/u/37533467/data-08-01-2012.7z"
   BinLibs = "http://dl.dropbox.com/u/37533467/libs-2012-09-12.zip"
   ExeName = "keineschweine"
@@ -60,7 +60,7 @@ task "release", "release build":
     quit 1
   else:
     runTask "clean"
-    ## zip up all the files and such or something useful here 
+    ## zip up all the files and such or something useful here
 
 task "testskel", "create skeleton test dir for testing":
   let dirname = "test-"& $random(5000)
@@ -103,7 +103,7 @@ task "download", "download game assets":
     echo "Downloading to ", path
     downloadFile GameAssets, path
     echo "Download finished"
-  
+
     let targetDir = parentDir(parentDir(path))
     when defined(linux):
       let z7 = findExe("7z")
@@ -117,7 +117,7 @@ task "download", "download game assets":
     else:
       echo "I do not know how to unpack the data on this system. Perhaps you could ",
         "fill this part in?"
-  
+
   echo "Download binary libs? Only libs for linux are available currently, enjoy the irony.\n",
     "[Y]es [N]o   Source: ", BinLibs
   case stdin.readline.toLower
@@ -126,11 +126,11 @@ task "download", "download game assets":
   else:
     return
   path = extractFilename(BinLibs)
-  downloadFile BinLibs, path 
+  downloadFile BinLibs, path
   echo "Downloaded dem libs ", path
   when true: echo "Unpack it yourself, sorry."
   else:  ## this crashes, dunno why
-    var 
+    var
       z: TZipArchive
       destDir = getCurrentDir()/("unzip"& $random(5000))
     if not z.open(path, fmRead):
@@ -152,4 +152,4 @@ task "zip-lib", "zip up the libs dir":
     echo "adding file ", file
     z.addFile(file)
   z.close()
-  echo "Great success!"
\ No newline at end of file
+  echo "Great success!"
diff --git a/tests/manyloc/standalone/barebone.nim.cfg b/tests/manyloc/standalone/barebone.nim.cfg
index 52ec64e3f..bb350ff55 100644
--- a/tests/manyloc/standalone/barebone.nim.cfg
+++ b/tests/manyloc/standalone/barebone.nim.cfg
@@ -1,2 +1,3 @@
 --os:standalone
 --deadCodeElim:on
+--gc:none
diff --git a/tests/manyloc/standalone/panicoverride.nim b/tests/manyloc/standalone/panicoverride.nim
index efd2b21f9..d9b3f4388 100644
--- a/tests/manyloc/standalone/panicoverride.nim
+++ b/tests/manyloc/standalone/panicoverride.nim
@@ -7,13 +7,13 @@ proc exit(code: int) {.importc, header: "<stdlib.h>", cdecl.}
 proc rawoutput(s: string) =
   printf("%s\n", s)
 
-proc panic(s: string) =
+proc panic(s: string) {.noreturn.} =
   rawoutput(s)
   exit(1)
 
 # Alternatively we also could implement these 2 here:
 #
-# template sysFatal(exceptn: typeDesc, message: string)
-# template sysFatal(exceptn: typeDesc, message, arg: string)
+# proc sysFatal(exceptn: typeDesc, message: string) {.noReturn.}
+# proc sysFatal(exceptn: typeDesc, message, arg: string) {.noReturn.}
 
 {.pop.}
diff --git a/tests/metatype/tautoproc.nim b/tests/metatype/tautoproc.nim
index 562f508fc..ef5377096 100644
--- a/tests/metatype/tautoproc.nim
+++ b/tests/metatype/tautoproc.nim
@@ -1,11 +1,13 @@
 discard """
-  errormsg: "expression 'generate(builder)' has no type (or is ambiguous)"
+  output: "empty"
 """
 
 # bug #898
 
+import typetraits
+
 proc measureTime(e: auto) =
-  discard
+  echo e.type.name
 
 proc generate(a: int): void =
   discard
diff --git a/tests/metatype/tbindtypedesc.nim b/tests/metatype/tbindtypedesc.nim
index 84527362f..4f027407b 100644
--- a/tests/metatype/tbindtypedesc.nim
+++ b/tests/metatype/tbindtypedesc.nim
@@ -9,7 +9,7 @@ TFoo TFoo'''
 
 import typetraits
 
-type 
+type
   TFoo = object
     x, y: int
 
@@ -25,7 +25,7 @@ template reject(e: expr) =
 proc genericParamRepeated[T: typedesc](a: T, b: T) =
   static:
     echo a.name, " ", b.name
-    
+
 accept genericParamRepeated(int, int)
 accept genericParamRepeated(float, float)
 
diff --git a/tests/metatype/tconstraints.nim b/tests/metatype/tconstraints.nim
index 7aef0d645..76e738a85 100644
--- a/tests/metatype/tconstraints.nim
+++ b/tests/metatype/tconstraints.nim
@@ -1,6 +1,6 @@
 
 
-proc myGenericProc[T: object|tuple|int|ptr|ref|distinct](x: T): string = 
+proc myGenericProc[T: object|tuple|int|ptr|ref|distinct](x: T): string =
   result = $x
 
 type
diff --git a/tests/metatype/tmatrix.nim b/tests/metatype/tmatrix.nim
index 90dfde959..5acd4389e 100644
--- a/tests/metatype/tmatrix.nim
+++ b/tests/metatype/tmatrix.nim
@@ -11,7 +11,7 @@ type
 
 template `|`(x, y: int): expr = y * m.fWidth + x
 
-proc createMatrix*(width, height: int): TMatrix = 
+proc createMatrix*(width, height: int): TMatrix =
   result.fWidth = width
   result.fHeight = height
   newSeq(result.data, width*height)
@@ -24,7 +24,7 @@ proc `[]`*(m: TMatrix, x, y: int): float {.inline.} =
 
 proc `[]=`*(m: var TMatrix, x, y: int, val: float) {.inline.} =
   m.data[x|y] = val
-  
+
 proc `-|`*(m: TMatrix): TMatrix =
   ## transposes a matrix
   result = createMatrix(m.height, m.width)
diff --git a/tests/metatype/tmatrix1.nim b/tests/metatype/tmatrix1.nim
index 0adf30b57..0f325a17b 100644
--- a/tests/metatype/tmatrix1.nim
+++ b/tests/metatype/tmatrix1.nim
@@ -3,7 +3,7 @@ discard """
 """
 
 type
-  TMatrixNM*[M, N, T] = object 
+  TMatrixNM*[M, N, T] = object
     aij*: array[M, array[N, T]]
   TMatrix2x2*[T] = TMatrixNM[range[0..1], range[0..1], T]
   TMatrix3x3*[T] = TMatrixNM[range[0..2], range[0..2], T]
@@ -12,7 +12,7 @@ proc test*[T] (matrix: TMatrix2x2[T]) =
   echo "wrong proc called"
 
 proc test*[T] (matrix: TMatrix3x3[T]) =
-  echo "right proc called"  
+  echo "right proc called"
 
 var matrix: TMatrix3x3[float]
 
diff --git a/tests/metatype/tmatrix2.nim b/tests/metatype/tmatrix2.nim
index 82990f1a5..bad021390 100644
--- a/tests/metatype/tmatrix2.nim
+++ b/tests/metatype/tmatrix2.nim
@@ -3,7 +3,7 @@ discard """
 """
 
 type
-  TMatrixNM*[M, N, T] = object 
+  TMatrixNM*[M, N, T] = object
     aij*: T
   TVectorN*[N, T] = TMatrixNM[range[0..0], N, T]
   TVector3*[T] = TVectorN[range[0..2], T]
@@ -13,7 +13,7 @@ proc coeffRef*[M, N, T] (matrix: var TMatrixNM[M, N, T], a: M, b: N): var T =
 
 proc coeffRef*[N, T] (vector: var TVectorN[N, T], i: N): var T = vector.aij
 
-var 
+var
   testVar: TVector3[float]
 
 testVar.aij = 2.0
diff --git a/tests/metatype/tprocbothmeta.nim b/tests/metatype/tprocbothmeta.nim
new file mode 100644
index 000000000..ba061dda2
--- /dev/null
+++ b/tests/metatype/tprocbothmeta.nim
@@ -0,0 +1,10 @@
+
+proc myFun[A](x: A): auto =
+  result = float(x+10)
+
+proc myMap[T,S](sIn: seq[T], f: proc (q: T): S): seq[S] =
+  result = newSeq[S](sIn.len)
+  for i in 0..<sIn.len:
+    result[i] = f(sIn[i])
+
+assert myMap(@[1,2,3], myFun) == @[11.0, 12.0, 13.0]
diff --git a/tests/metatype/tstatic_ones.nim b/tests/metatype/tstatic_ones.nim
new file mode 100644
index 000000000..73a88447d
--- /dev/null
+++ b/tests/metatype/tstatic_ones.nim
@@ -0,0 +1,28 @@
+discard """
+  output: "@[2, 2, 2, 2, 2]"
+"""
+
+# bug #3144
+
+type IntArray[N: static[int]] = array[N, int]
+
+proc `$`(a: IntArray): string = $(@(a))
+
+proc `+=`[N: static[int]](a: var IntArray[N], b: IntArray[N]) =
+  for i in 0 .. < N:
+    a[i] += b[i]
+
+proc zeros(N: static[int]): IntArray[N] =
+  for i in 0 .. < N:
+    result[i] = 0
+
+proc ones(N: static[int]): IntArray[N] =
+  for i in 0 .. < N:
+    result[i] = 1
+
+proc sum[N: static[int]](vs: seq[IntArray[N]]): IntArray[N] =
+  result = zeros(N)
+  for v in vs:
+    result += v
+
+echo sum(@[ones(5), ones(5)])
diff --git a/tests/metatype/tstaticparammacro.nim b/tests/metatype/tstaticparammacro.nim
index e577efc56..5c7c5e6af 100644
--- a/tests/metatype/tstaticparammacro.nim
+++ b/tests/metatype/tstaticparammacro.nim
@@ -5,9 +5,9 @@ bb
 numbers
 11
 22
-AST a 
+AST a
 [(11, 22), (33, 44)]
-AST b 
+AST b
 (e: [55, 66], f: [77, 88])
 55
 10
diff --git a/tests/metatype/tstaticparams.nim b/tests/metatype/tstaticparams.nim
index 7fc5f479b..11653e563 100644
--- a/tests/metatype/tstaticparams.nim
+++ b/tests/metatype/tstaticparams.nim
@@ -3,7 +3,7 @@ discard """
   output: "abracadabra\ntest\n3\n15\n4\n2\nfloat\n3\nfloat\nyin\nyang"
 """
 
-type 
+type
   TFoo[T; Val: static[string]] = object
     data: array[4, T]
 
@@ -121,7 +121,7 @@ foo_3.yinOrYang
 
 # bug 1859
 
-type 
+type
   TypeWith2Params[N, M: static[int]] = object
 
 proc bindBothParams[N](x: TypeWith2Params[N, N]) = discard
diff --git a/tests/metatype/tstaticvector.nim b/tests/metatype/tstaticvector.nim
index c9923f469..69ee0e935 100644
--- a/tests/metatype/tstaticvector.nim
+++ b/tests/metatype/tstaticvector.nim
@@ -1,17 +1,39 @@
+discard """
+  output: '''0
+0
+2
+100'''
+"""
 
 type
   RectArray*[R, C: static[int], T] = distinct array[R * C, T]
-   
+
   StaticMatrix*[R, C: static[int], T] = object
     elements*: RectArray[R, C, T]
-   
+
   StaticVector*[N: static[int], T] = StaticMatrix[N, 1, T]
- 
+
 proc foo*[N, T](a: StaticVector[N, T]): T = 0.T
 proc foobar*[N, T](a, b: StaticVector[N, T]): T = 0.T
- 
- 
+
+
 var a: StaticVector[3, int]
- 
+
 echo foo(a) # OK
-echo foobar(a, a) # <--- hangs compiler 
+echo foobar(a, a) # <--- hangs compiler
+
+# bug #3112
+
+type
+  Vector[N: static[int]] = array[N, float64]
+  TwoVectors[Na, Nb: static[int]] = tuple
+    a: Vector[Na]
+    b: Vector[Nb]
+
+when isMainModule:
+  var v: TwoVectors[2, 100]
+  echo v[0].len
+  echo v[1].len
+  #let xx = 50
+  v[1][50] = 0.0
+
diff --git a/tests/metatype/ttypedesc1.nim b/tests/metatype/ttypedesc1.nim
index 0c6f5dce4..d78c62a94 100644
--- a/tests/metatype/ttypedesc1.nim
+++ b/tests/metatype/ttypedesc1.nim
@@ -1,13 +1,13 @@
 import unittest, typetraits
 
-type 
+type
   TFoo[T, U] = object
     x: T
     y: U
 
 proc getTypeName(t: typedesc): string = t.name
 
-proc foo(T: typedesc[float], a: expr): string =
+proc foo(T: typedesc[float], a: auto): string =
   result = "float " & $(a.len > 5)
 
 proc foo(T: typedesc[TFoo], a: int): string =
@@ -21,17 +21,17 @@ proc foo(T: typedesc[int or bool]): string =
 template foo(T: typedesc[seq]): expr = "seq"
 
 test "types can be used as proc params":
-  # XXX: `check` needs to know that TFoo[int, float] is a type and 
+  # XXX: `check` needs to know that TFoo[int, float] is a type and
   # cannot be assigned for a local variable for later inspection
   check ((string.getTypeName == "string"))
   check ((getTypeName(int) == "int"))
-  
+
   check ((foo(TFoo[int, float], 1000) == "TFoo 1000"))
-  
+
   var f = 10.0
   check ((foo(float, "long string") == "float true"))
   check ((foo(type(f), [1, 2, 3]) == "float false"))
-  
+
   check ((foo(int) == "int or bool 10"))
 
   check ((foo(seq[int]) == "seq"))
diff --git a/tests/metatype/ttypedesc3.nim b/tests/metatype/ttypedesc3.nim
new file mode 100644
index 000000000..3d40b25b2
--- /dev/null
+++ b/tests/metatype/ttypedesc3.nim
@@ -0,0 +1,19 @@
+import typetraits
+
+type
+  Base = object of RootObj
+  Child = object of Base
+
+proc pr(T: typedesc[Base]) = echo "proc " & T.name
+method me(T: typedesc[Base]) = echo "method " & T.name
+iterator it(T: typedesc[Base]) = yield "yield " & T.name
+
+Base.pr
+Child.pr
+
+Base.me
+when false:
+  Child.me #<- bug #2710
+
+for s in Base.it: echo s
+for s in Child.it: echo s #<- bug #2662
diff --git a/tests/metatype/ttypeselectors.nim b/tests/metatype/ttypeselectors.nim
index cca643e1f..c29fd15ce 100644
--- a/tests/metatype/ttypeselectors.nim
+++ b/tests/metatype/ttypeselectors.nim
@@ -10,7 +10,7 @@ template simpleTypeTempl: typeDesc =
   string
 
 macro typeFromMacro: typedesc = string
-  
+
 proc t1*(x: int): simpleTypeTempl() =
   result = "test"
 
diff --git a/tests/metatype/ttypetraits.nim b/tests/metatype/ttypetraits.nim
index 4c3ad9e0b..106257828 100644
--- a/tests/metatype/ttypetraits.nim
+++ b/tests/metatype/ttypetraits.nim
@@ -42,18 +42,18 @@ const TypeList = [int, string, seq[int]]
 
 macro selectType(inType: typedesc): typedesc =
   var typeSeq = @[float, TBar[int]]
-  
+
   for t in TypeList:
     typeSeq.add(t)
 
   typeSeq.add(inType)
   typeSeq.add(type(10))
-  
+
   var typeSeq2: seq[typedesc] = @[]
   typeSeq2 = typeSeq
 
   result = typeSeq2[5]
-  
+
 var xvar: selectType(string)
 xvar = "proba"
 echo xvar.type.name
diff --git a/tests/metatype/tunresolved_return_type.nim b/tests/metatype/tunresolved_return_type.nim
new file mode 100644
index 000000000..f67e065ea
--- /dev/null
+++ b/tests/metatype/tunresolved_return_type.nim
@@ -0,0 +1,20 @@
+discard """
+  errormsg: "cannot instantiate: 'T'"
+  line: 12
+"""
+
+# bug #2594
+
+
+type
+  ResultValue* = int64
+
+proc toNumber[T: int|uint|int64|uint64](v: ResultValue): T =
+  if v < low(T) or v > high(T):
+    raise newException(RangeError, "protocol error")
+  return T(v)
+
+#proc toNumber[T](v: int32): T =
+#  return (v)
+
+echo toNumber(23)
diff --git a/tests/method/mmultim3.nim b/tests/method/mmultim3.nim
index 3139a8089..b391731be 100644
--- a/tests/method/mmultim3.nim
+++ b/tests/method/mmultim3.nim
@@ -3,7 +3,7 @@ type
 
 var myObj* : ref TObj
 
-method test123(a : ref TObj) =
+method test123(a : ref TObj) {.base.} =
     echo("Hi base!")
 
 proc testMyObj*() =
diff --git a/tests/method/temptybody.nim b/tests/method/temptybody.nim
index 26285d05b..aad945f81 100644
--- a/tests/method/temptybody.nim
+++ b/tests/method/temptybody.nim
@@ -2,7 +2,7 @@
 
 type MyClass = ref object of RootObj
 
-method HelloWorld*(obj: MyClass) =
+method HelloWorld*(obj: MyClass) {.base.} =
   when defined(myPragma):
     echo("Hello World")
   # discard # with this line enabled it works
diff --git a/tests/method/tmapper.nim b/tests/method/tmapper.nim
new file mode 100644
index 000000000..75b36e69a
--- /dev/null
+++ b/tests/method/tmapper.nim
@@ -0,0 +1,30 @@
+discard """
+  errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tests/method/tmapper.nim(22,7)"
+  line: 25
+"""
+
+# bug #2590
+
+type
+  Console* = ref object
+    mapper*: Mapper
+
+  Mapper* = ref object of RootObj
+
+  Mapper2* = ref object of Mapper
+
+proc newMapper2*: Mapper2 =
+  new result
+
+proc newMapper*: Mapper =
+  result = newMapper2()
+
+method step*(m: Mapper2) {.base.} =
+  echo "Mapper2"
+
+method step*(m: Mapper) {.base.} =
+  echo "Mapper"
+
+var console = Console()
+console.mapper = newMapper()
+console.mapper.step()
diff --git a/tests/method/tmethods1.nim b/tests/method/tmethods1.nim
index 43a260bca..cb4da5ef2 100644
--- a/tests/method/tmethods1.nim
+++ b/tests/method/tmethods1.nim
@@ -2,7 +2,7 @@ discard """
   output: "do nothing"
 """
 
-method somethin(obj: TObject) =
+method somethin(obj: RootObj) {.base.} =
   echo "do nothing"
 
 type
@@ -11,12 +11,12 @@ type
 
   PNodeFoo* = ref object of TNode
 
-  TSomethingElse = object 
+  TSomethingElse = object
   PSomethingElse = ref TSomethingElse
 
-method foo(a: PNode, b: PSomethingElse) = discard
+method foo(a: PNode, b: PSomethingElse) {.base.} = discard
 method foo(a: PNodeFoo, b: PSomethingElse) = discard
 
-var o: TObject
+var o: RootObj
 o.somethin()
 
diff --git a/tests/method/tmproto.nim b/tests/method/tmproto.nim
index 5d75cff1a..087666ea0 100644
--- a/tests/method/tmproto.nim
+++ b/tests/method/tmproto.nim
@@ -2,7 +2,7 @@ type
   Obj1 = ref object {.inheritable.}
   Obj2 = ref object of Obj1
 
-method beta(x: Obj1): int
+method beta(x: Obj1): int {.base.}
 
 proc delta(x: Obj2): int =
   beta(x)
diff --git a/tests/method/tmultim1.nim b/tests/method/tmultim1.nim
index 7f551aa64..010468a5b 100644
--- a/tests/method/tmultim1.nim
+++ b/tests/method/tmultim1.nim
@@ -10,15 +10,15 @@ type
     x: int
   PlusExpr = ref object of Expression
     a, b: Expression
-    
-method eval(e: Expression): int = quit "to override!"
+
+method eval(e: Expression): int {.base.} = quit "to override!"
 method eval(e: Literal): int = return e.x
 method eval(e: PlusExpr): int = return eval(e.a) + eval(e.b)
 
 proc newLit(x: int): Literal =
   new(result)
   result.x = x
-  
+
 proc newPlus(a, b: Expression): PlusExpr =
   new(result)
   result.a = a
diff --git a/tests/method/tmultim2.nim b/tests/method/tmultim2.nim
index c5fb568a0..98a08b1cb 100644
--- a/tests/method/tmultim2.nim
+++ b/tests/method/tmultim2.nim
@@ -13,10 +13,10 @@ type
     x: int
   TParticle = object of TThing
     a, b: int
-    
-method collide(a, b: TThing) {.inline.} =
+
+method collide(a, b: TThing) {.base, inline.} =
   echo "collide: thing, thing"
-  
+
 method collide(a: TThing, b: TUnit) {.inline.} =
   echo "collide: thing, unit"
 
diff --git a/tests/method/tmultim4.nim b/tests/method/tmultim4.nim
index d824086b2..eabf8d126 100644
--- a/tests/method/tmultim4.nim
+++ b/tests/method/tmultim4.nim
@@ -5,7 +5,7 @@ discard """
 type
   Test = object of TObject
 
-method doMethod(a: ref TObject) {.raises: [EIO].} =
+method doMethod(a: ref TObject) {.base, raises: [EIO].} =
   quit "override"
 
 method doMethod(a: ref Test) =
@@ -26,7 +26,7 @@ var s:ref Test = newTest()
 for z in 1..4:
   s.doMethod()
   break
- 
+
 #works
 #for z in 1..4:
 #  s.doProc()
diff --git a/tests/method/tmultim6.nim b/tests/method/tmultim6.nim
index 5f45f572a..97ed2845c 100644
--- a/tests/method/tmultim6.nim
+++ b/tests/method/tmultim6.nim
@@ -9,10 +9,10 @@ type
     x: T
   TParticle = object of TThing
     a, b: int
-    
-method collide(a, b: TThing) {.inline.} =
+
+method collide(a, b: TThing) {.base, inline.} =
   quit "to override!"
-  
+
 method collide[T](a: TThing, b: TUnit[T]) {.inline.} =
   write stdout, "collide: thing, unit | "
 
diff --git a/tests/method/trecmeth.nim b/tests/method/trecmeth.nim
index 32f620f15..ac0a1e977 100644
--- a/tests/method/trecmeth.nim
+++ b/tests/method/trecmeth.nim
@@ -2,12 +2,12 @@
 # for recursive methods works, no code is being executed
 
 type
-  Obj = ref object of TObject
+  Obj = ref object of RootObj
 
 # Mutual recursion
 
-method alpha(x: Obj)
-method beta(x: Obj)
+method alpha(x: Obj) {.base.}
+method beta(x: Obj) {.base.}
 
 method alpha(x: Obj) =
   beta(x)
@@ -17,6 +17,6 @@ method beta(x: Obj) =
 
 # Simple recursion
 
-method gamma(x: Obj) =
+method gamma(x: Obj) {.base.} =
   gamma(x)
 
diff --git a/tests/misc/minit.nim b/tests/misc/minit.nim
index 75fcebb77..513f46af5 100644
--- a/tests/misc/minit.nim
+++ b/tests/misc/minit.nim
@@ -1,2 +1,2 @@
-# Test the new initialization for modules

-write(stdout, "Hello from module! ")

+# Test the new initialization for modules
+write(stdout, "Hello from module! ")
diff --git a/tests/misc/mvarious.nim b/tests/misc/mvarious.nim
index c0a8add73..d1587faec 100644
--- a/tests/misc/mvarious.nim
+++ b/tests/misc/mvarious.nim
@@ -1,6 +1,6 @@
-# Test a submodule

-

-#type

-#  TStringArr = array [0.. *] of string

-

-proc exportme* = discard

+# Test a submodule
+
+#type
+#  TStringArr = array [0.. *] of string
+
+proc exportme* = discard
diff --git a/tests/misc/t99bott.nim b/tests/misc/t99bott.nim
index b3b30d296..62ccfbe16 100644
--- a/tests/misc/t99bott.nim
+++ b/tests/misc/t99bott.nim
@@ -25,7 +25,7 @@ proc GetBottleNumber(n: int): string =
 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), 
+  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."
diff --git a/tests/misc/tack.nim b/tests/misc/tack.nim
index 680ff567e..a0afab9e8 100644
--- a/tests/misc/tack.nim
+++ b/tests/misc/tack.nim
@@ -2,20 +2,20 @@ 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

+# 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/misc/tatomic.nim b/tests/misc/tatomic.nim
index 1fa0cff8d..f3c56ffe3 100644
--- a/tests/misc/tatomic.nim
+++ b/tests/misc/tatomic.nim
@@ -3,9 +3,9 @@ discard """
   line: 7
   errormsg: "identifier expected, but found 'keyword atomic'"
 """
-var 
+var
   atomic: int
-  
+
 echo atomic
 
 
diff --git a/tests/misc/tcmdline.nim b/tests/misc/tcmdline.nim
index f4ee20d31..cb8cb402c 100644
--- a/tests/misc/tcmdline.nim
+++ b/tests/misc/tcmdline.nim
@@ -7,8 +7,8 @@ var
   i: int
   params = paramCount()
 i = 0
-writeln(stdout, "This exe: " & getAppFilename())
-writeln(stdout, "Number of parameters: " & $params)
+writeLine(stdout, "This exe: " & getAppFilename())
+writeLine(stdout, "Number of parameters: " & $params)
 while i <= params:
-  writeln(stdout, paramStr(i))
+  writeLine(stdout, paramStr(i))
   i = i + 1
diff --git a/tests/misc/tcolonisproc.nim b/tests/misc/tcolonisproc.nim
index af4077284..665e9e604 100644
--- a/tests/misc/tcolonisproc.nim
+++ b/tests/misc/tcolonisproc.nim
@@ -7,7 +7,7 @@ when false:
   p(1, 3):
     echo 1
     echo 3
-    
+
 p(1, 1, proc() =
   echo 1
   echo 2)
diff --git a/tests/misc/tdllvar.nim b/tests/misc/tdllvar.nim
index 5a31dfbbb..1c1238e8d 100644
--- a/tests/misc/tdllvar.nim
+++ b/tests/misc/tdllvar.nim
@@ -1,6 +1,6 @@
 import os
 
-proc getDllName: string = 
+proc getDllName: string =
   result = "mylib.dll"
   if fileExists(result): return
   result = "mylib2.dll"
diff --git a/tests/misc/temit.nim b/tests/misc/temit.nim
index e2a9eaff1..c83235659 100644
--- a/tests/misc/temit.nim
+++ b/tests/misc/temit.nim
@@ -2,14 +2,14 @@ discard """
   file: "temit.nim"
   output: "509"
 """
-# Test the new ``emit`` pragma: 
+# Test the new ``emit`` pragma:
 
 {.emit: """
 static int cvariable = 420;
 
 """.}
 
-proc embedsC() = 
+proc embedsC() =
   var nimVar = 89
   {.emit: """printf("%d\n", cvariable + (int)`nimVar`);""".}
 
diff --git a/tests/misc/tendian.nim b/tests/misc/tendian.nim
index 256e2653c..91044f4d5 100644
--- a/tests/misc/tendian.nim
+++ b/tests/misc/tendian.nim
@@ -1,3 +1,3 @@
 # test the new endian magic
 
-writeln(stdout, repr(system.cpuEndian))
+writeLine(stdout, repr(system.cpuEndian))
diff --git a/tests/misc/tevents.nim b/tests/misc/tevents.nim
index fb94b1f79..5f2169f29 100644
--- a/tests/misc/tevents.nim
+++ b/tests/misc/tevents.nim
@@ -13,11 +13,11 @@ type
 
 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
diff --git a/tests/misc/tfib.nim b/tests/misc/tfib.nim
index 09a4d5038..34fe0dcf9 100644
--- a/tests/misc/tfib.nim
+++ b/tests/misc/tfib.nim
@@ -1,8 +1,8 @@
 
-iterator fibonacci(): int = 
+iterator fibonacci(): int =
   var a = 0
   var b = 1
-  while true: 
+  while true:
     yield a
     var c = b
     b = a
diff --git a/tests/misc/tgetstartmilsecs.nim b/tests/misc/tgetstartmilsecs.nim
index 5a3368e0f..bf508dd54 100644
--- a/tests/misc/tgetstartmilsecs.nim
+++ b/tests/misc/tgetstartmilsecs.nim
@@ -1,4 +1,4 @@
-# 
+#
 import times, os
 
 var start = epochTime()
diff --git a/tests/misc/thallo.nim b/tests/misc/thallo.nim
index cbeb45b97..17e955f03 100644
--- a/tests/misc/thallo.nim
+++ b/tests/misc/thallo.nim
@@ -22,7 +22,7 @@ macro macrotest(n: expr): stmt {.immediate.} =
   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("")))
+  result.add(newCall("writeLine", n[1], newStrLitNode("")))
 
 macro debug(n: expr): stmt {.immediate.} =
   let n = callsite()
@@ -30,7 +30,7 @@ macro debug(n: expr): stmt {.immediate.} =
   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]))
+    result.add(newCall("writeLine", newIdentNode("stdout"), n[i]))
 
 macrotest(stdout, "finally", 4, 5, "variable", "argument lists")
 macrotest(stdout)
@@ -38,7 +38,7 @@ macrotest(stdout)
 #GC_disable()
 
 echo("This was compiled by Nim version " & system.NimVersion)
-writeln(stdout, "Hello", " World", "!")
+writeLine(stdout, "Hello", " World", "!")
 
 echo(["a", "b", "c", "d"].len)
 for x in items(["What's", "your", "name", "?", ]):
diff --git a/tests/misc/theaproots.nim b/tests/misc/theaproots.nim
index aec140f42..77d0207b0 100644
--- a/tests/misc/theaproots.nim
+++ b/tests/misc/theaproots.nim
@@ -1,7 +1,7 @@
-type 
+type
   Bar = object
     x: int
-  
+
   Foo = object
     rheap: ref Bar
     rmaybe: ref Bar
@@ -31,7 +31,7 @@ proc test(maybeFoo: var Foo,
   maybeFoo.list[3] = bb
   maybeFoo.listarr[3] = bb
   acc(maybeFoo) = bb
-  
+
   var localFoo: Foo
   localFoo.rstack = bb
   localFoo.list[3] = bb
diff --git a/tests/misc/thintoff.nim b/tests/misc/thintoff.nim
index 807ff44f3..95318ce9b 100644
--- a/tests/misc/thintoff.nim
+++ b/tests/misc/thintoff.nim
@@ -6,7 +6,7 @@ discard """
 {.hint[XDeclaredButNotUsed]: off.}
 var
   x: int
-  
+
 echo x #OUT 0
 
 
diff --git a/tests/misc/tinit.nim b/tests/misc/tinit.nim
index 5c75567ec..02607909b 100644
--- a/tests/misc/tinit.nim
+++ b/tests/misc/tinit.nim
@@ -2,11 +2,11 @@ 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!

+# 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/misc/tinout.nim b/tests/misc/tinout.nim
index 4e5908428..0b2a54d9f 100644
--- a/tests/misc/tinout.nim
+++ b/tests/misc/tinout.nim
@@ -3,14 +3,14 @@ discard """
   line: 12
   errormsg: "type mismatch: got (int literal(3))"
 """
-# Test in out checking for parameters

-

-proc abc(x: var int) =

-    x = 0

-

-proc b() =

-    abc(3) #ERROR

-

-b()

+# Test in out checking for parameters
+
+proc abc(x: var int) =
+    x = 0
+
+proc b() =
+    abc(3) #ERROR
+
+b()
 
 
diff --git a/tests/misc/tinvalidnewseq.nim b/tests/misc/tinvalidnewseq.nim
index 957a25560..89083d8b2 100644
--- a/tests/misc/tinvalidnewseq.nim
+++ b/tests/misc/tinvalidnewseq.nim
@@ -14,12 +14,12 @@ proc parseURL(url: string): TURL =
   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], 
+
+  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/misc/tissue710.nim b/tests/misc/tissue710.nim
index ecfdf653e..3b6d3e5f3 100644
--- a/tests/misc/tissue710.nim
+++ b/tests/misc/tissue710.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tissue710.nim"
   line: 8
-  errorMsg: "undeclared identifier: '||'"
+  errorMsg: "attempting to call undeclared routine: '||'"
 """
 var sum = 0
 for x in 3..1000:
diff --git a/tests/misc/tlastmod.nim b/tests/misc/tlastmod.nim
index 92ac922f7..538b5e656 100644
--- a/tests/misc/tlastmod.nim
+++ b/tests/misc/tlastmod.nim
@@ -1,18 +1,18 @@
-# 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()

+# test the new LastModificationTime() proc
+
+import
+  os, times, strutils
+
+proc main() =
+  var
+    a, b: TTime
+  a = getLastModificationTime(paramStr(1))
+  b = getLastModificationTime(paramStr(2))
+  writeLine(stdout, $a)
+  writeLine(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/misc/tlocals.nim b/tests/misc/tlocals.nim
index af8a54946..3e240d3c8 100644
--- a/tests/misc/tlocals.nim
+++ b/tests/misc/tlocals.nim
@@ -2,10 +2,10 @@ discard """
   output: "(x: string here, a: 1)"
 """
 
-proc simple[T](a: T) = 
+proc simple[T](a: T) =
   var
     x = "string here"
   echo locals()
-  
+
 simple(1)
 
diff --git a/tests/misc/tloops.nim b/tests/misc/tloops.nim
index 1aada0298..b160500af 100644
--- a/tests/misc/tloops.nim
+++ b/tests/misc/tloops.nim
@@ -76,7 +76,7 @@ proc main[T]() =
   b = (1, 2, 3)
   myType = b
   echo myType
-  
+
   var myType2: MyType2
   var c: MyType2
   c = (1.0, 2.0)
diff --git a/tests/misc/tmandelbrot.nim b/tests/misc/tmandelbrot.nim
index 4228b0416..e9b7a3e5a 100644
--- a/tests/misc/tmandelbrot.nim
+++ b/tests/misc/tmandelbrot.nim
@@ -24,10 +24,10 @@ var size    = parseInt (paramStr (1))
 var bit     = 128
 var byteAcc = 0
 
-stdout.writeln ("P4")
+stdout.writeLine ("P4")
 stdout.write ($size)
 stdout.write (" ")
-stdout.writeln ($size)
+stdout.writeLine ($size)
 
 var fsize = float (size)
 for y in 0 .. size-1:
diff --git a/tests/misc/tmissingnilcheck.nim b/tests/misc/tmissingnilcheck.nim
index c2f23ae87..461fb18f4 100644
--- a/tests/misc/tmissingnilcheck.nim
+++ b/tests/misc/tmissingnilcheck.nim
@@ -14,7 +14,7 @@ proc newConnection =
 
   proc cb {.closure.} =
     discard
-  
+
   first.callback = cb
 
 newConnection()
diff --git a/tests/misc/tnew.nim b/tests/misc/tnew.nim
index 6527541a2..88e8bd02c 100644
--- a/tests/misc/tnew.nim
+++ b/tests/misc/tnew.nim
@@ -1,49 +1,49 @@
-# 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()

+# 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/misc/tnewderef.nim b/tests/misc/tnewderef.nim
index 89dc4c8d1..3394dbddf 100644
--- a/tests/misc/tnewderef.nim
+++ b/tests/misc/tnewderef.nim
@@ -7,5 +7,5 @@ var x: ref int
 new(x)
 x[] = 3
 
-echo x[] 
+echo x[]
 
diff --git a/tests/misc/tnewsets.nim b/tests/misc/tnewsets.nim
index 415fe8f7e..f239d4aa2 100644
--- a/tests/misc/tnewsets.nim
+++ b/tests/misc/tnewsets.nim
@@ -1,6 +1,6 @@
-# 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 )

+# 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/misc/tnewuns.nim b/tests/misc/tnewuns.nim
index 5181e467c..d6bae4fb1 100644
--- a/tests/misc/tnewuns.nim
+++ b/tests/misc/tnewuns.nim
@@ -1,12 +1,12 @@
-# test the new unsigned operations:

-

-import

-  strutils

-

-var

-  x, y: int

-

-x = 1

-y = high(int)

-

-writeln(stdout, $ ( x +% y ) )

+# test the new unsigned operations:
+
+import
+  strutils
+
+var
+  x, y: int
+
+x = 1
+y = high(int)
+
+writeLine(stdout, $ ( x +% y ) )
diff --git a/tests/misc/tnoinst.nim b/tests/misc/tnoinst.nim
index 4c8d9d1aa..25ebe8dfc 100644
--- a/tests/misc/tnoinst.nim
+++ b/tests/misc/tnoinst.nim
@@ -11,7 +11,7 @@ proc wrap[T]() =
 
   var x: proc (x, y: T): int
   x = notConcrete
-  
+
 
 wrap[int]()
 
diff --git a/tests/misc/tnoop.nim b/tests/misc/tnoop.nim
index 10c2eb2ec..1e3fbe6cf 100644
--- a/tests/misc/tnoop.nim
+++ b/tests/misc/tnoop.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tnoop.nim"
   line: 11
-  errormsg: "undeclared identifier: 'a'"
+  errormsg: "attempting to call undeclared routine: 'a'"
 """
 
 
diff --git a/tests/misc/tnot.nim b/tests/misc/tnot.nim
index 6193e21e1..8c75c6bc0 100644
--- a/tests/misc/tnot.nim
+++ b/tests/misc/tnot.nim
@@ -1,14 +1,14 @@
 discard """
-  file: "tnot.nim"
-  line: 14
+  tfile: "tnot.nim"
+  tline: 14
   errormsg: "type mismatch"
 """
 # BUG: following compiles, but should not:
 
-proc nodeOfDegree(x: int): bool = 
+proc nodeOfDegree(x: int): bool =
   result = false
 
-proc main = 
+proc main =
   for j in 0..2:
     for i in 0..10:
       if not nodeOfDegree(1) >= 0: #ERROR_MSG type mismatch
@@ -17,6 +17,3 @@ proc main =
         echo "No"
 
 main()
-
-
-
diff --git a/tests/misc/tparedef.nim b/tests/misc/tparedef.nim
index dedebf6b7..83c2651ff 100644
--- a/tests/misc/tparedef.nim
+++ b/tests/misc/tparedef.nim
@@ -1,4 +1,4 @@
-# This test is now superfluous:

-

-proc a(a: int) = 

-  return

+# This test is now superfluous:
+
+proc a(a: int) =
+  return
diff --git a/tests/misc/tpos.nim b/tests/misc/tpos.nim
index 5560ef050..bedb62e62 100644
--- a/tests/misc/tpos.nim
+++ b/tests/misc/tpos.nim
@@ -2,34 +2,34 @@ 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

+# 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/misc/tquicksort.nim b/tests/misc/tquicksort.nim
index 6706a185e..0867a3769 100644
--- a/tests/misc/tquicksort.nim
+++ b/tests/misc/tquicksort.nim
@@ -9,17 +9,17 @@ proc QuickSort(list: seq[int]): seq[int] =
             left.add(list[i])
         elif list[i] > pivot:
             right.add(list[i])
-    result = QuickSort(left) & 
-      pivot & 
+    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/misc/tradix.nim b/tests/misc/tradix.nim
index 311aa9ccd..36a4f39f6 100644
--- a/tests/misc/tradix.nim
+++ b/tests/misc/tradix.nim
@@ -1,7 +1,7 @@
 # implements and tests an efficient radix tree
 
-## another method to store an efficient array of pointers: 
-## We use a radix tree with node compression. 
+## 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)
@@ -15,7 +15,7 @@ type
     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
@@ -27,43 +27,43 @@ type
 var
   root: PRadixNode
 
-proc searchInner(r: PRadixNode, a: int): 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: 
+    for i in 0..ze(x.len)-1:
       if ze(x.keys[i]) == a: return x.vals[i]
-  of rnFull: 
+  of rnFull:
     var x = cast[ptr TRadixNodeFull](r)
     return x.b[a]
   else: assert(false)
 
-proc testBit(w, i: int): bool {.inline.} = 
+proc testBit(w, i: int): bool {.inline.} =
   result = (w and (1 shl (i %% BitsPerUnit))) != 0
 
-proc setBit(w: var int, i: int) {.inline.} = 
+proc setBit(w: var int, i: int) {.inline.} =
   w = w or (1 shl (i %% BitsPerUnit))
 
-proc resetBit(w: var int, i: int) {.inline.} = 
+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.} = 
+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 = 
+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: 
+    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) = 
+proc exclLeaf(r: PRadixNode, a: int) =
   case r.kind
   of rnLeafBits:
     var x = cast[ptr TRadixNodeLeafBits](r)
@@ -71,8 +71,8 @@ proc exclLeaf(r: PRadixNode, a: int) =
   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: 
+    for i in 0..L-1:
+      if ze(x.keys[i]) == a:
         x.keys[i] = x.keys[L-1]
         dec(x.len)
         return
@@ -98,7 +98,7 @@ proc excl*(r: PRadixNode, a: ByteAddress): bool =
   if x == nil: return false
   exclLeaf(x, a and 0xff)
 
-proc addLeaf(r: var PRadixNode, a: int): bool = 
+proc addLeaf(r: var PRadixNode, a: int): bool =
   if r == nil:
     # a linear node:
     var x = cast[ptr TRadixNodeLinear](alloc(sizeof(TRadixNodeLinear)))
@@ -107,23 +107,23 @@ proc addLeaf(r: var PRadixNode, a: int): bool =
     x.keys[0] = toU8(a)
     r = x
     return false # not already in set
-  case r.kind 
-  of rnLeafBits: 
+  case r.kind
+  of rnLeafBits:
     var x = cast[ptr TRadixNodeLeafBits](r)
     return testOrSetBit(x.b[a /% BitsPerUnit], a)
-  of rnLeafLinear: 
+  of rnLeafLinear:
     var x = cast[ptr TRadixNodeLeafLinear](r)
     var L = ze(x.len)
-    for i in 0..L-1: 
+    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: 
+    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: 
+      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)
@@ -131,8 +131,8 @@ proc addLeaf(r: var PRadixNode, a: int): bool =
       r = y
   else: assert(false)
 
-proc addInner(r: var PRadixNode, a: int, d: int): bool = 
-  if d == 0: 
+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:
@@ -147,14 +147,14 @@ proc addInner(r: var PRadixNode, a: int, d: int): bool =
   of rnLinear:
     var x = cast[ptr TRadixNodeLinear](r)
     var L = ze(x.len)
-    for i in 0..L-1: 
+    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: 
+    else:
       # transform into a full node:
       var y = cast[ptr TRadixNodeFull](alloc0(sizeof(TRadixNodeFull)))
       y.kind = rnFull
@@ -162,55 +162,55 @@ proc addInner(r: var PRadixNode, a: int, d: int): bool =
       dealloc(r)
       r = y
       return addInner(y.b[k], a, d-8)
-  of rnFull: 
+  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: ByteAddress) {.inline.} = 
+proc incl*(r: var PRadixNode, a: ByteAddress) {.inline.} =
   discard addInner(r, a, 24)
-  
-proc testOrIncl*(r: var PRadixNode, a: ByteAddress): bool {.inline.} = 
+
+proc testOrIncl*(r: var PRadixNode, a: ByteAddress): bool {.inline.} =
   return addInner(r, a, 24)
-      
-iterator innerElements(r: PRadixNode): tuple[prefix: int, n: PRadixNode] = 
+
+iterator innerElements(r: PRadixNode): tuple[prefix: int, n: PRadixNode] =
   if r != nil:
-    case r.kind 
-    of rnFull: 
+    case r.kind
+    of rnFull:
       var r = cast[ptr TRadixNodeFull](r)
       for i in 0..high(r.b):
-        if r.b[i] != nil: 
+        if r.b[i] != nil:
           yield (i, r.b[i])
-    of rnLinear: 
+    of rnLinear:
       var r = cast[ptr TRadixNodeLinear](r)
-      for i in 0..ze(r.len)-1: 
+      for i in 0..ze(r.len)-1:
         yield (ze(r.keys[i]), r.vals[i])
     else: assert(false)
 
-iterator leafElements(r: PRadixNode): int = 
+iterator leafElements(r: PRadixNode): int =
   if r != nil:
     case r.kind
-    of rnLeafBits: 
+    of rnLeafBits:
       var r = cast[ptr TRadixNodeLeafBits](r)
       # iterate over any bit:
-      for i in 0..high(r.b): 
+      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): 
+          for j in 0..BitsPerUnit-1:
+            if testBit(r.b[i], j):
               yield i*BitsPerUnit+j
-    of rnLeafLinear: 
+    of rnLeafLinear:
       var r = cast[ptr TRadixNodeLeafLinear](r)
-      for i in 0..ze(r.len)-1: 
+      for i in 0..ze(r.len)-1:
         yield ze(r.keys[i])
     else: assert(false)
-    
-iterator elements*(r: PRadixNode): ByteAddress {.inline.} = 
-  for p1, n1 in innerElements(r): 
+
+iterator elements*(r: PRadixNode): ByteAddress {.inline.} =
+  for p1, n1 in innerElements(r):
     for p2, n2 in innerElements(n1):
       for p3, n3 in innerElements(n2):
-        for p4 in leafElements(n3): 
+        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]
@@ -224,31 +224,31 @@ main()
 
 
 when false:
-  proc traverse(r: PRadixNode, prefix: int, d: int) = 
+  proc traverse(r: PRadixNode, prefix: int, d: int) =
     if r == nil: return
-    case r.kind 
-    of rnLeafBits: 
+    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): 
+      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): 
+          for j in 0..BitsPerUnit-1:
+            if testBit(x.b[i], j):
               visit(prefix or i*BitsPerUnit+j)
-    of rnLeafLinear: 
+    of rnLeafLinear:
       assert(d == 0)
       var x = cast[ptr TRadixNodeLeafLinear](r)
-      for i in 0..ze(x.len)-1: 
+      for i in 0..ze(x.len)-1:
         visit(prefix or ze(x.keys[i]))
-    of rnFull: 
+    of rnFull:
       var x = cast[ptr TRadixNodeFull](r)
       for i in 0..high(r.b):
-        if r.b[i] != nil: 
+        if r.b[i] != nil:
           traverse(r.b[i], prefix or (i shl d), d-8)
-    of rnLinear: 
+    of rnLinear:
       var x = cast[ptr TRadixNodeLinear](r)
-      for i in 0..ze(x.len)-1: 
+      for i in 0..ze(x.len)-1:
         traverse(x.vals[i], prefix or (ze(x.keys[i]) shl d), d-8)
 
   type
@@ -261,59 +261,59 @@ when false:
     i.r = r
     i.x = 0
     i.p = 0
-    
-  proc nextr(i: var TRadixIter): PRadixNode = 
+
+  proc nextr(i: var TRadixIter): PRadixNode =
     if i.r == nil: return nil
-    case i.r.kind 
-    of rnFull: 
+    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: 
+        if r.b[i.x] != nil:
           i.p = i.x
           return r.b[i.x]
         inc(i.x)
-    of rnLinear: 
+    of rnLinear:
       var r = cast[ptr TRadixNodeLinear](i.r)
-      if i.x < ze(r.len): 
+      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 = 
+  proc nexti(i: var TRadixIter): int =
     result = -1
-    case i.r.kind 
-    of rnLeafBits: 
+    case i.r.kind
+    of rnLeafBits:
       var r = cast[ptr TRadixNodeLeafBits](i.r)
-      # iterate over any bit:    
-      for i in 0..high(r.b): 
+      # 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): 
+          for j in 0..BitsPerUnit-1:
+            if testBit(x.b[i], j):
               visit(prefix or i*BitsPerUnit+j)
-    of rnLeafLinear: 
+    of rnLeafLinear:
       var r = cast[ptr TRadixNodeLeafLinear](i.r)
-      if i.x < ze(r.len): 
+      if i.x < ze(r.len):
         result = ze(r.keys[i.x])
         inc(i.x)
 
-  iterator elements(r: PRadixNode): ByteAddress {.inline.} = 
+  iterator elements(r: PRadixNode): ByteAddress {.inline.} =
     var
       a, b, c, d: TRadixIter
     init(a, r)
-    while true: 
+    while true:
       var x = nextr(a)
-      if x != nil: 
+      if x != nil:
         init(b, x)
-        while true: 
+        while true:
           var y = nextr(b)
-          if y != nil: 
+          if y != nil:
             init(c, y)
             while true:
               var z = nextr(c)
-              if z != nil: 
+              if z != nil:
                 init(d, z)
                 while true:
                   var q = nexti(d)
-                  if q != -1: 
+                  if q != -1:
                     yield a.p shl 24 or b.p shl 16 or c.p shl 8 or q
diff --git a/tests/misc/trawstr.nim b/tests/misc/trawstr.nim
index ab2aae159..55e508acc 100644
--- a/tests/misc/trawstr.nim
+++ b/tests/misc/trawstr.nim
@@ -3,10 +3,10 @@ discard """
   line: 10
   errormsg: "closing \" expected"
 """
-# Test the new raw strings:

-

-const

-  xxx = r"This is a raw string!"

-  yyy = "This not\" #ERROR

+# Test the new raw strings:
+
+const
+  xxx = r"This is a raw string!"
+  yyy = "This not\" #ERROR
 
 
diff --git a/tests/misc/tromans.nim b/tests/misc/tromans.nim
index fa6a63595..132c73ddd 100644
--- a/tests/misc/tromans.nim
+++ b/tests/misc/tromans.nim
@@ -32,7 +32,7 @@ proc RomanToDecimal(romanVal: string): int =
     of 'C', 'c': val = 100
     of 'D', 'd': val = 500
     of 'M', 'm': val = 1000
-    else: raiseInvalidValue("Incorrect character in roman numeral! (" & 
+    else: raiseInvalidValue("Incorrect character in roman numeral! (" &
                             $romanVal[i] & ")")
     if val >= prevVal:
       inc(result, val)
@@ -49,7 +49,7 @@ proc DecimalToRoman(decValParam: int): string =
     ("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)]     
+    ("V", 5), ("IV", 4), ("I", 1)]
   if decValParam < 1 or decValParam > 3999:
     raiseInvalidValue("number not representable")
   result = ""
@@ -64,7 +64,7 @@ for i in 1..100:
 
 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/misc/tsimplesort.nim b/tests/misc/tsimplesort.nim
index c282b3445..9c6ad1207 100644
--- a/tests/misc/tsimplesort.nim
+++ b/tests/misc/tsimplesort.nim
@@ -1,7 +1,7 @@
 discard """
   output: '''true'''
 """
-  
+
 import hashes, math
 
 {.pragma: myShallow.}
@@ -112,7 +112,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))
@@ -214,7 +214,7 @@ proc `$`*[A](t: TCountTable[A]): string =
   ## The `$` operator for count tables.
   dollarImpl()
 
-proc inc*[A](t: var TCountTable[A], key: A, val = 1) = 
+proc inc*[A](t: var TCountTable[A], key: A, val = 1) =
   ## increments `t[key]` by `val`.
   var index = RawGet(t, key)
   if index >= 0:
diff --git a/tests/misc/tsimtych.nim b/tests/misc/tsimtych.nim
index dd969958c..27a922f6a 100644
--- a/tests/misc/tsimtych.nim
+++ b/tests/misc/tsimtych.nim
@@ -3,10 +3,10 @@ discard """
   line: 10
   errormsg: "type mismatch: got (bool) but expected \'string\'"
 """
-# Test 2

-# Simple type checking

-

-var a: string

-a = false #ERROR

+# Test 2
+# Simple type checking
+
+var a: string
+a = false #ERROR
 
 
diff --git a/tests/misc/tsizeof.nim b/tests/misc/tsizeof.nim
index f7b70dd4d..4afd48472 100644
--- a/tests/misc/tsizeof.nim
+++ b/tests/misc/tsizeof.nim
@@ -1,10 +1,10 @@
-# Test the sizeof proc

-

-type

-  TMyRecord {.final.} = object

-    x, y: int

-    b: bool

-    r: float

-    s: string

-

-write(stdout, sizeof(TMyRecord))

+# 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/misc/tsortdev.nim b/tests/misc/tsortdev.nim
index d7d42d22c..f360d9646 100644
--- a/tests/misc/tsortdev.nim
+++ b/tests/misc/tsortdev.nim
@@ -37,17 +37,17 @@ proc cmpPlatforms(a, b: string): int =
       else:
         return system.cmp(a, b)
 
-proc sorted[T](a: openArray[T]): bool = 
+proc sorted[T](a: openArray[T]): bool =
   result = true
   for i in 0 .. < a.high:
-    if cmpPlatforms(a[i], a[i+1]) > 0: 
+    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", 
+  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)
diff --git a/tests/misc/tstrace.nim b/tests/misc/tstrace.nim
index 3032a34a3..23590d958 100644
--- a/tests/misc/tstrace.nim
+++ b/tests/misc/tstrace.nim
@@ -1,16 +1,16 @@
-# 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)

+# 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/misc/tstrange.nim b/tests/misc/tstrange.nim
index 8742011bb..fee0f44e4 100644
--- a/tests/misc/tstrange.nim
+++ b/tests/misc/tstrange.nim
@@ -4,23 +4,23 @@ discard """
 1
 2'''
 """
-# 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

-

+# 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
+
 # bug #1442
 let h=3
 for x in 0.. <h.int:
diff --git a/tests/misc/tstrdesc.nim b/tests/misc/tstrdesc.nim
index 1c2e85b4b..d23160315 100644
--- a/tests/misc/tstrdesc.nim
+++ b/tests/misc/tstrdesc.nim
@@ -1,14 +1,14 @@
-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 

-

-

+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/misc/tunsigned64mod.nim b/tests/misc/tunsigned64mod.nim
index 9ae0d535a..3007405a2 100644
--- a/tests/misc/tunsigned64mod.nim
+++ b/tests/misc/tunsigned64mod.nim
@@ -10,3 +10,17 @@ let t1 = v1 mod 2 # works
 let t2 = 7'u64 mod 2'u64 # works
 let t3 = v2 mod 2'u64 # Error: invalid type: 'range 0..1(uint64)
 let t4 = (v2 mod 2'u64).uint64 # works
+
+# bug #2550
+
+var x: uint # doesn't work
+echo x mod 2 == 0
+
+var y: uint64 # doesn't work
+echo y mod 2 == 0
+
+var z: uint32 # works
+echo z mod 2 == 0
+
+var a: int # works
+echo a mod 2 == 0
diff --git a/tests/misc/tunsignedinc.nim b/tests/misc/tunsignedinc.nim
new file mode 100644
index 000000000..95622156f
--- /dev/null
+++ b/tests/misc/tunsignedinc.nim
@@ -0,0 +1,14 @@
+discard """
+  output: '''253'''
+"""
+
+# bug #2427
+
+import unsigned
+
+var x = 0'u8
+dec x # OverflowError
+x -= 1 # OverflowError
+x = x - 1 # No error
+
+echo x
diff --git a/tests/misc/tunsignedmisc.nim b/tests/misc/tunsignedmisc.nim
new file mode 100644
index 000000000..e6a497a3d
--- /dev/null
+++ b/tests/misc/tunsignedmisc.nim
@@ -0,0 +1,68 @@
+import unsigned
+
+discard """
+  errormsg: "number 0x123'u8 out of valid range"
+"""
+
+# Bug #1179
+
+# Unsigneds
+
+# 8 bit
+let ref1 = 128'u8 shr 7
+let hex1 = 0x80'u8 shr 7
+let oct1 = 0c200'u8 shr 7
+let dig1 = 0b10000000'u8 shr 7
+
+doAssert(ref1 == 1)
+doAssert(ref1 == hex1)
+doAssert(ref1 == oct1)
+doAssert(ref1 == dig1)
+
+# 16 bit
+let ref2 = 32768'u16 shr 15
+let hex2 = 0x8000'u16 shr 15
+let oct2 = 0c100000'u16 shr 15
+let dig2 = 0b1000000000000000'u16 shr 15
+
+doAssert(ref2 == 1)
+doAssert(ref2 == hex2)
+doAssert(ref2 == oct2)
+doAssert(ref2 == dig2)
+
+# 32 bit
+let ref3 = 2147483648'u32 shr 31
+let hex3 = 0x80000000'u32 shr 31
+let oct3 = 0c20000000000'u32 shr 31
+let dig3 = 0b10000000000000000000000000000000'u32 shr 31
+
+doAssert(ref3 == 1)
+doAssert(ref3 == hex3)
+doAssert(ref3 == oct3)
+doAssert(ref3 == dig3)
+
+# Below doesn't work for lexer stage errors...
+# doAssert(compiles(0xFF'u8) == true)
+# doAssert(compiles(0xFFF'u16) == true)
+# doAssert(compiles(0x7FFF'i16) == true)
+
+# doAssert(compiles(0x123'u8) == false)
+# doAssert(compiles(0x123'i8) == false)
+# doAssert(compiles(0x123123'u16) == false)
+# doAssert(compiles(0x123123'i16) == false)
+
+# Should compile #
+let boundOkHex1 = 0xFF'u8
+let boundOkHex2 = 0xFFFF'u16
+let boundOkHex3 = 0x7FFF'i16
+
+let boundOkHex4 = 0x80'i8
+let boundOkHex5 = 0xFF'i8
+let boundOkHex6 = 0xFFFF'i16
+let boundOkHex7 = 0x7FFF'i16
+
+# Should _not_ compile #
+let boundBreakingHex1 = 0x123'u8
+let boundBreakingHex2 = 0x123'i8
+let boundBreakingHex3 = 0x123123'u16
+let boundBreakingHex4 = 0x123123'i16
diff --git a/tests/misc/tvarious1.nim b/tests/misc/tvarious1.nim
index 1f2da2ae5..1d5ad876a 100644
--- a/tests/misc/tvarious1.nim
+++ b/tests/misc/tvarious1.nim
@@ -9,7 +9,7 @@ Whopie
 
 echo len([1_000_000]) #OUT 1
 
-type 
+type
   TArray = array[0..3, int]
   TVector = distinct array[0..3, int]
 proc `[]`(v: TVector; idx: int): int = TArray(v)[idx]
@@ -22,7 +22,7 @@ import queues
 
 type
   TWidget = object
-    names: TQueue[string]
+    names: Queue[string]
 
 var w = TWidget(names: initQueue[string]())
 
@@ -43,6 +43,6 @@ echo value
 
 # bug #1334
 
-var ys = @[4.1, 5.6, 7.2, 1.7, 9.3, 4.4, 3.2] 
-#var x = int(ys.high / 2) #echo ys[x] # Works 
+var ys = @[4.1, 5.6, 7.2, 1.7, 9.3, 4.4, 3.2]
+#var x = int(ys.high / 2) #echo ys[x] # Works
 echo ys[int(ys.high / 2)] # Doesn't work
diff --git a/tests/misc/tvarnums.nim b/tests/misc/tvarnums.nim
index b880cf006..04a1ef53b 100644
--- a/tests/misc/tvarnums.nim
+++ b/tests/misc/tvarnums.nim
@@ -2,141 +2,141 @@ 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!

+# 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:
+    writeLine(stdout, $i)
+    writeLine(stdout, toBinary(i))
+    writeLine(stdout, toBinary(x))
+
+proc t32(i: int32) =
+  var
+    b: TBuffer
+  toVarNum(i, b)
+  var x = toNum(b)
+  if x != i:
+    writeLine(stdout, toBinary(i))
+    writeLine(stdout, toBinary(x))
+
+proc tm(i: int32) =
+  var
+    b: TBuffer
+  toVarNum64(i, b)
+  var x = toNum(b)
+  if x != i:
+    writeLine(stdout, toBinary(i))
+    writeLine(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))
+
+writeLine(stdout, "Success!") #OUT Success!
 
 
diff --git a/tests/mmaptest.nim b/tests/mmaptest.nim
index c304920af..84036cbf0 100644
--- a/tests/mmaptest.nim
+++ b/tests/mmaptest.nim
@@ -4,31 +4,31 @@ include "lib/system/ansi_c"
 
 const
   PageSize = 4096
-  PROT_READ  = 1             # page can be read 
-  PROT_WRITE = 2             # page can be written 
-  MAP_PRIVATE = 2            # Changes are private 
+  PROT_READ  = 1             # page can be read
+  PROT_WRITE = 2             # page can be written
+  MAP_PRIVATE = 2            # Changes are private
 
 when defined(macosx) or defined(bsd):
   const MAP_ANONYMOUS = 0x1000
-elif defined(solaris): 
+elif defined(solaris):
   const MAP_ANONYMOUS = 0x100
 else:
   var
     MAP_ANONYMOUS {.importc: "MAP_ANONYMOUS", header: "<sys/mman.h>".}: cint
-  
+
 proc mmap(adr: pointer, len: int, prot, flags, fildes: cint,
           off: int): pointer {.header: "<sys/mman.h>".}
 
 proc munmap(adr: pointer, len: int) {.header: "<sys/mman.h>".}
 
-proc osAllocPages(size: int): pointer {.inline.} = 
-  result = mmap(nil, size, PROT_READ or PROT_WRITE, 
+proc osAllocPages(size: int): pointer {.inline.} =
+  result = mmap(nil, size, PROT_READ or PROT_WRITE,
                          MAP_PRIVATE or MAP_ANONYMOUS, -1, 0)
   if result == nil or result == cast[pointer](-1):
     quit 1
-  cfprintf(c_stdout, "allocated pages %p..%p\n", result, 
+  cfprintf(c_stdout, "allocated pages %p..%p\n", result,
                      cast[int](result) + size)
-    
+
 proc osDeallocPages(p: pointer, size: int) {.inline} =
   cfprintf(c_stdout, "freed pages %p..%p\n", p, cast[int](p) + size)
   munmap(p, size-1)
diff --git a/tests/modules/mnamspc1.nim b/tests/modules/mnamspc1.nim
index da13c5f24..91f4d1566 100644
--- a/tests/modules/mnamspc1.nim
+++ b/tests/modules/mnamspc1.nim
@@ -1,2 +1,2 @@
-import mnamspc2

-

+import mnamspc2
+
diff --git a/tests/modules/mnamspc2.nim b/tests/modules/mnamspc2.nim
index 84ef8533e..899ef27ea 100644
--- a/tests/modules/mnamspc2.nim
+++ b/tests/modules/mnamspc2.nim
@@ -1,3 +1,3 @@
-# export an identifier:

-var

-  global*: int

+# export an identifier:
+var
+  global*: int
diff --git a/tests/modules/mopaque.nim b/tests/modules/mopaque.nim
index 7eee4bd96..2129bdaf2 100644
--- a/tests/modules/mopaque.nim
+++ b/tests/modules/mopaque.nim
@@ -1,7 +1,7 @@
-type

-  TLexer* {.final.} = object

-    line*: int

-    filename*: string

-    buffer: cstring

+type
+  TLexer* {.final.} = object
+    line*: int
+    filename*: string
+    buffer: cstring
 
 proc noProcVar*(): int = 18
diff --git a/tests/modules/mrecmod.nim b/tests/modules/mrecmod.nim
index fab9654d5..ce8fa3d64 100644
--- a/tests/modules/mrecmod.nim
+++ b/tests/modules/mrecmod.nim
@@ -1 +1 @@
-import trecmod

+import trecmod
diff --git a/tests/modules/mrecmod2.nim b/tests/modules/mrecmod2.nim
index 9557ce729..31fac6e4d 100644
--- a/tests/modules/mrecmod2.nim
+++ b/tests/modules/mrecmod2.nim
@@ -1,9 +1,9 @@
 # Module B
-import trecmod2  
+import trecmod2
 
 proc p*(x: trecmod2.T1): trecmod2.T1 =
   # this works because the compiler has already
   # added T1 to trecmod2's interface symbol table
   return x + 1
-  
+
 
diff --git a/tests/modules/texport.nim b/tests/modules/texport.nim
index 9515f9060..a8c217ab8 100644
--- a/tests/modules/texport.nim
+++ b/tests/modules/texport.nim
@@ -5,9 +5,9 @@ discard """
 import mexporta
 
 # bug #1029:
-from rawsockets import accept
+from nativesockets import accept
 
-# B.TMyObject has been imported implicitly here: 
+# B.TMyObject has been imported implicitly here:
 var x: TMyObject
 echo($x, q(0), q"0")
 
diff --git a/tests/modules/tnamspc.nim b/tests/modules/tnamspc.nim
index 1e2049cec..2f488644c 100644
--- a/tests/modules/tnamspc.nim
+++ b/tests/modules/tnamspc.nim
@@ -3,10 +3,10 @@ discard """
   line: 10
   errormsg: "undeclared identifier: \'global\'"
 """
-# Test17 - test correct handling of namespaces

-

-import mnamspc1

-

-global = 9 #ERROR

+# Test17 - test correct handling of namespaces
+
+import mnamspc1
+
+global = 9 #ERROR
 
 
diff --git a/tests/modules/topaque.nim b/tests/modules/topaque.nim
index f0587c959..84e2388bc 100644
--- a/tests/modules/topaque.nim
+++ b/tests/modules/topaque.nim
@@ -1,16 +1,16 @@
 discard """
   file: "topaque.nim"
   line: 16
-  errormsg: "undeclared identifier: \'buffer\'"
+  errormsg: "undeclared field: \'buffer\'"
 """
 # Test the new opaque types
 
-import 
+import
   mopaque
-  
+
 var
   L: TLexer
-  
+
 L.filename = "ha"
 L.line = 34
 L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer'
diff --git a/tests/modules/trecmod.nim b/tests/modules/trecmod.nim
index 9d39d3ff7..d567e293b 100644
--- a/tests/modules/trecmod.nim
+++ b/tests/modules/trecmod.nim
@@ -1,2 +1,2 @@
-# recursive module

-import mrecmod

+# recursive module
+import mrecmod
diff --git a/tests/namedparams/tnamedparams.nim b/tests/namedparams/tnamedparams.nim
index 9397fea4a..9a8bd0c2e 100644
--- a/tests/namedparams/tnamedparams.nim
+++ b/tests/namedparams/tnamedparams.nim
@@ -6,9 +6,9 @@ discard """
 import pegs
 
 discard parsePeg(
-      input = "input", 
-      filename = "filename", 
-      line = 1, 
+      input = "input",
+      filename = "filename",
+      line = 1,
       col = 23)
 
 
diff --git a/tests/namedparams/tnamedparams2.nim b/tests/namedparams/tnamedparams2.nim
index 4b0cd5361..fcbbd32da 100644
--- a/tests/namedparams/tnamedparams2.nim
+++ b/tests/namedparams/tnamedparams2.nim
@@ -1,8 +1,8 @@
 import pegs
 
 discard parsePeg(
-      pattern = "input", 
-      filename = "filename", 
-      line = 1, 
+      pattern = "input",
+      filename = "filename",
+      line = 1,
       col = 23)
 
diff --git a/tests/namedparams/tnamedparams3.nim b/tests/namedparams/tnamedparams3.nim
new file mode 100644
index 000000000..d9c79bf98
--- /dev/null
+++ b/tests/namedparams/tnamedparams3.nim
@@ -0,0 +1,10 @@
+discard """
+  errormsg: "type mismatch: got (int literal(5), b: bool)"
+  line: 10
+"""
+
+# bug #2993
+proc test(i: int, a, b: bool) = discard
+#test(5, b = false)             #Missing param a
+
+5.test(b = false)             #Missing param a
diff --git a/tests/newconfig/tfoo.nim b/tests/newconfig/tfoo.nim
new file mode 100644
index 000000000..d593d4a75
--- /dev/null
+++ b/tests/newconfig/tfoo.nim
@@ -0,0 +1,10 @@
+discard """
+  cmd: "nim default $file"
+  output: '''hello world!'''
+  msg: '''[NimScript] exec: gcc -v'''
+"""
+
+when not defined(definedefine):
+  {.fatal: "wrong nim script configuration".}
+
+echo "hello world!"
diff --git a/tests/newconfig/tfoo.nims b/tests/newconfig/tfoo.nims
new file mode 100644
index 000000000..519a868d5
--- /dev/null
+++ b/tests/newconfig/tfoo.nims
@@ -0,0 +1,18 @@
+
+mode = ScriptMode.Whatif
+
+exec "gcc -v"
+
+# test that ospaths actually compiles:
+import ospaths
+
+--forceBuild
+
+task listDirs, "lists every subdirectory":
+  for x in listDirs("."):
+    echo "DIR ", x
+
+task default, "default target":
+  --define: definedefine
+  setCommand "c"
+
diff --git a/tests/notnil/tnotnil.nim b/tests/notnil/tnotnil.nim
index fba7fa917..f65634ed6 100644
--- a/tests/notnil/tnotnil.nim
+++ b/tests/notnil/tnotnil.nim
@@ -7,7 +7,7 @@ type
   PObj = ref TObj not nil
   TObj = object
     x: int
-  
+
   MyString = string not nil
 
 #var x: PObj = nil
diff --git a/tests/notnil/tnotnil1.nim b/tests/notnil/tnotnil1.nim
index 863fe45f8..73472752c 100644
--- a/tests/notnil/tnotnil1.nim
+++ b/tests/notnil/tnotnil1.nim
@@ -18,7 +18,7 @@ proc q(s: superstring) =
   echo s
 
 proc p2() =
-  var  a: string = "I am not nil" 
+  var  a: string = "I am not nil"
   q(a) # but this should and does not
 
 p2()
@@ -30,7 +30,7 @@ proc p() =
   var x: pointer
   if not x.isNil:
     q(x)
-  
+
   let y = x
   if not y.isNil:
     q(y)
diff --git a/tests/notnil/tnotnil_in_generic.nim b/tests/notnil/tnotnil_in_generic.nim
index 1e2d8b940..357ab2c7c 100644
--- a/tests/notnil/tnotnil_in_generic.nim
+++ b/tests/notnil/tnotnil_in_generic.nim
@@ -9,14 +9,14 @@ type
         x: int
         ud: T
 
-proc good[T](p: A[T]) = 
+proc good[T](p: A[T]) =
     discard
 
-proc bad[T](p: A[T] not nil) = 
+proc bad[T](p: A[T] not nil) =
     discard
 
 
-proc go() = 
+proc go() =
     let s = A[int](x: 1)
 
     good(s)
diff --git a/tests/objects/tillegal_recursion.nim b/tests/objects/tillegal_recursion.nim
new file mode 100644
index 000000000..222139101
--- /dev/null
+++ b/tests/objects/tillegal_recursion.nim
@@ -0,0 +1,7 @@
+discard """
+  errormsg: "inheritance only works with non-final objects"
+  line: 7
+"""
+# bug #1691
+type
+  Foo = ref object of Foo
diff --git a/tests/objects/tobjcov.nim b/tests/objects/tobjcov.nim
index 8391727f2..cf2e5becf 100644
--- a/tests/objects/tobjcov.nim
+++ b/tests/objects/tobjcov.nim
@@ -5,10 +5,10 @@ type
     a: int
   TB = object of TA
     b: array[0..5000_000, int]
-    
+
 proc ap(x: var TA) = x.a = -1
 proc bp(x: var TB) = x.b[high(x.b)] = -1
-    
+
 # in Nim proc (x: TB) is compatible to proc (x: TA),
 # but this is not type safe:
 var f = cast[proc (x: var TA) {.nimcall.}](bp)
diff --git a/tests/objects/tobject.nim b/tests/objects/tobject.nim
index 5fec84441..cdb8f80db 100644
--- a/tests/objects/tobject.nim
+++ b/tests/objects/tobject.nim
@@ -3,7 +3,7 @@ import unittest
 type Obj = object
   foo: int
 
-proc makeObj(x: int): Obj = 
+proc makeObj(x: int): Obj =
   result.foo = x
 
 suite "object basic methods":
diff --git a/tests/objects/tobject2.nim b/tests/objects/tobject2.nim
index 0f1869695..a49296843 100644
--- a/tests/objects/tobject2.nim
+++ b/tests/objects/tobject2.nim
@@ -9,7 +9,7 @@ type
 
 proc getPoint( p: var TPoint2d) =
   {.breakpoint.}
-  writeln(stdout, p.x)
+  writeLine(stdout, p.x)
 
 var
   p: TPoint3d
diff --git a/tests/objects/tobject3.nim b/tests/objects/tobject3.nim
index 85cf1cfe3..2d9c8d023 100644
--- a/tests/objects/tobject3.nim
+++ b/tests/objects/tobject3.nim
@@ -4,7 +4,7 @@
 
 type
   TFoo = ref object of RootObj
-    Data: int  
+    Data: int
   TBar = ref object of TFoo
     nil
   TBar2 = ref object of TBar
diff --git a/tests/objects/tobjects.nim b/tests/objects/tobjects.nim
index 06fa15583..2f46b46b5 100644
--- a/tests/objects/tobjects.nim
+++ b/tests/objects/tobjects.nim
@@ -18,7 +18,7 @@ type
       of 0: arg: char
       of 1: s: string
       else: wtf: bool
-      
+
 var
   x: TMyObject
 
diff --git a/tests/objects/tobjloop.nim b/tests/objects/tobjloop.nim
new file mode 100644
index 000000000..9fea1e2fb
--- /dev/null
+++ b/tests/objects/tobjloop.nim
@@ -0,0 +1,15 @@
+discard """
+  output: "is Nil false"
+"""
+# bug #1658
+
+type
+  Loop* = ref object
+    onBeforeSelect*: proc (L: Loop)
+
+var L: Loop
+new L
+L.onBeforeSelect = proc (bar: Loop) =
+  echo "is Nil ", bar.isNil
+
+L.onBeforeSelect(L)
diff --git a/tests/objects/tobjpragma.nim b/tests/objects/tobjpragma.nim
index dda8057b6..0a6cc893b 100644
--- a/tests/objects/tobjpragma.nim
+++ b/tests/objects/tobjpragma.nim
@@ -12,7 +12,7 @@ discard """
 
 # Disabled since some versions of GCC ignore the 'packed' attribute
 
-# Test 
+# Test
 
 type
   Foo {.packed.} = object
@@ -21,12 +21,12 @@ type
 
   Bar {.packed.} = object
     a: int8
-    b: int16   
-    
+    b: int16
+
   Daz {.packed.} = object
     a: int32
-    b: int8 
-    c: int32  
+    b: int8
+    c: int32
 
 
 var f = Foo(a: 1, b: 1)
diff --git a/tests/objects/tofopr.nim b/tests/objects/tofopr.nim
index 961d81bd3..ab2854571 100644
--- a/tests/objects/tofopr.nim
+++ b/tests/objects/tofopr.nim
@@ -8,12 +8,12 @@ type
   TMyType = object {.inheritable.}
     len: int
     data: string
-    
+
   TOtherType = object of TMyType
-   
-proc p(x: TMyType): bool = 
+
+proc p(x: TMyType): bool =
   return x of TOtherType
-    
+
 var
   m: TMyType
   n: TOtherType
diff --git a/tests/objects/toop.nim b/tests/objects/toop.nim
index 0b42c2c22..ebc59f637 100644
--- a/tests/objects/toop.nim
+++ b/tests/objects/toop.nim
@@ -5,13 +5,13 @@ discard """
 type
   TA = object of TObject
     x, y: int
-  
+
   TB = object of TA
     z: int
-    
+
   TC = object of TB
     whatever: string
-  
+
 proc p(a: var TA) = echo "a"
 proc p(b: var TB) = echo "b"
 
diff --git a/tests/objects/toop1.nim b/tests/objects/toop1.nim
index 0d8ba124b..4727d146d 100644
--- a/tests/objects/toop1.nim
+++ b/tests/objects/toop1.nim
@@ -8,17 +8,17 @@ import macros
 type
   TFigure = object of RootObj    # abstract base class:
     draw: proc (my: var TFigure) {.nimcall.} # concrete classes implement this
-  
-proc init(f: var TFigure) = 
+
+proc init(f: var TFigure) =
   f.draw = nil
 
 type
   TCircle = object of TFigure
     radius: int
-  
-proc drawCircle(my: var TCircle) = stdout.writeln("o " & $my.radius)
 
-proc init(my: var TCircle) = 
+proc drawCircle(my: var TCircle) = stdout.writeLine("o " & $my.radius)
+
+proc init(my: var TCircle) =
   init(TFigure(my)) # call base constructor
   my.radius = 5
   my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawCircle)
@@ -29,13 +29,13 @@ type
 
 proc drawRectangle(my: var TRectangle) = stdout.write("[]")
 
-proc init(my: var TRectangle) = 
+proc init(my: var TRectangle) =
   init(TFigure(my)) # call base constructor
   my.width = 5
   my.height = 10
   my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawRectangle)
 
-macro `!` (n: expr): stmt {.immediate.} = 
+macro `!` (n: expr): stmt {.immediate.} =
   let n = callsite()
   result = newNimNode(nnkCall, n)
   var dot = newNimNode(nnkDotExpr, n)
@@ -60,16 +60,16 @@ type
     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.} = 
+
+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 
+
+var
   s: TSocket
 s.host = 34  # same as `host=`(s, 34)
 stdout.write(s.host)
@@ -81,6 +81,6 @@ var
 init(r)
 init(c)
 r!draw
-c!draw() 
+c!draw()
 
 #OUT 34[]o 5
diff --git a/tests/objects/trefobjsyntax2.nim b/tests/objects/trefobjsyntax2.nim
new file mode 100644
index 000000000..8ee209cc7
--- /dev/null
+++ b/tests/objects/trefobjsyntax2.nim
@@ -0,0 +1,19 @@
+# bug #2508
+
+type
+  GenericNodeObj[T] = ref object
+    obj: T
+
+  Node* = ref object
+    children*: seq[Node]
+    parent*: Node
+
+    nodeObj*: GenericNodeObj[int]
+
+proc newNode*(nodeObj: GenericNodeObj): Node =
+    result = Node(nodeObj: nodeObj)
+    newSeq(result.children, 10)
+
+var genericObj = GenericNodeObj[int]()
+
+var myNode = newNode(genericObj)
diff --git a/tests/objects/trefobjsyntax3.nim b/tests/objects/trefobjsyntax3.nim
new file mode 100644
index 000000000..2d466eeda
--- /dev/null
+++ b/tests/objects/trefobjsyntax3.nim
@@ -0,0 +1,28 @@
+# bug #2540
+
+type
+  BaseSceneNode[T] = ref object of RootObj
+    children*: seq[BaseSceneNode[T]]
+    parent*: BaseSceneNode[T]
+
+  SceneNode[T] = ref object of BaseSceneNode[T]
+
+  SomeObj = ref object
+
+proc newSceneNode[T](): SceneNode[T] =
+  new result
+  result.children = @[]
+
+var aNode = newSceneNode[SomeObj]()
+
+
+# bug #3038
+
+type
+  Data[T] = ref object of RootObj
+    data: T
+  Type = ref object of RootObj
+  SubType[T] = ref object of Type
+    data: Data[T]
+  SubSubType = ref object of SubType
+  SubSubSubType = ref object of SubSubType
diff --git a/tests/objvariant/tcheckedfield1.nim b/tests/objvariant/tcheckedfield1.nim
index 1963ceb8d..56d784a2b 100644
--- a/tests/objvariant/tcheckedfield1.nim
+++ b/tests/objvariant/tcheckedfield1.nim
@@ -15,7 +15,7 @@ type
     case k: TNodeKind
     of nkBinary, nkTernary: a, b: PNode
     of nkStr: s: string
-    
+
   PList = ref object
     data: string
     next: PList
@@ -52,7 +52,7 @@ proc toString3(x: PNode): string =
 
 proc p() =
   var x: PNode = PNode(k: nkStr, s: "abc")
-  
+
   let y = x
   if not y.isNil:
     echo toString(y), " ", toString2(y)
diff --git a/tests/osproc/ta.nim b/tests/osproc/ta.nim
index 6c1495590..5ebcc7f14 100644
--- a/tests/osproc/ta.nim
+++ b/tests/osproc/ta.nim
@@ -1,3 +1,3 @@
 import strutils
 let x = stdin.readLine()
-echo x.parseInt + 5
\ No newline at end of file
+echo x.parseInt + 5
diff --git a/tests/overflw/toverflw.nim b/tests/overflw/toverflw.nim
index fbe0d0a38..771a43303 100644
--- a/tests/overflw/toverflw.nim
+++ b/tests/overflw/toverflw.nim
@@ -2,20 +2,20 @@ discard """
   file: "toverflw.nim"
   output: "the computation overflowed"
 """
-# Tests nim's ability to detect overflows

-

-{.push overflowChecks: on.}

-

-var

-  a, b: int

-a = high(int)

-b = -2

-try:

-  writeln(stdout, b - a)

-except OverflowError:

-  writeln(stdout, "the computation overflowed")

-

-{.pop.} # overflow check

-#OUT the computation overflowed

+# Tests nim's ability to detect overflows
+
+{.push overflowChecks: on.}
+
+var
+  a, b: int
+a = high(int)
+b = -2
+try:
+  writeLine(stdout, b - a)
+except OverflowError:
+  writeLine(stdout, "the computation overflowed")
+
+{.pop.} # overflow check
+#OUT the computation overflowed
 
 
diff --git a/tests/overflw/tovfint.nim b/tests/overflw/tovfint.nim
index f0b1ccaa6..f775d2e1c 100644
--- a/tests/overflw/tovfint.nim
+++ b/tests/overflw/tovfint.nim
@@ -2,22 +2,22 @@ discard """
   file: "tovfint.nim"
   output: "works!"
 """
-# this tests the new overflow literals

-

-var

-  i: int

-i = int(0xffffffff'i32)

-when defined(cpu64):

-  if i == -1:

-    write(stdout, "works!\n")

-  else:

-    write(stdout, "broken!\n")

-else:

-  if i == -1:

-    write(stdout, "works!\n")

-  else:

-    write(stdout, "broken!\n")

-

-#OUT works!

+# this tests the new overflow literals
+
+var
+  i: int
+i = int(0xffffffff'i32)
+when defined(cpu64):
+  if i == -1:
+    write(stdout, "works!\n")
+  else:
+    write(stdout, "broken!\n")
+else:
+  if i == -1:
+    write(stdout, "works!\n")
+  else:
+    write(stdout, "broken!\n")
+
+#OUT works!
 
 
diff --git a/tests/overload/toverl2.nim b/tests/overload/toverl2.nim
index ea0249e9f..54714ac1b 100644
--- a/tests/overload/toverl2.nim
+++ b/tests/overload/toverl2.nim
@@ -9,9 +9,9 @@ import strutils
 proc toverl2(x: int): string = return $x
 proc toverl2(x: bool): string = return $x
 
-iterator toverl2(x: int): int = 
+iterator toverl2(x: int): int =
   var res = 0
-  while res < x: 
+  while res < x:
     yield res
     inc(res)
 
@@ -20,7 +20,7 @@ var
 
 stdout.write(pp(true))
 
-for x in toverl2(3): 
+for x in toverl2(3):
   stdout.write(toverl2(x))
 
 block:
diff --git a/tests/overload/toverl3.nim b/tests/overload/toverl3.nim
index b3e0f2fa7..92cfc150d 100644
--- a/tests/overload/toverl3.nim
+++ b/tests/overload/toverl3.nim
@@ -4,8 +4,8 @@ discard """
 tup1'''
 """
 
-# Tests more specific generic match:

-

+# Tests more specific generic match:
+
 proc m[T](x: T) = echo "m2"
 proc m[T](x: var ref T) = echo "m1"
 
@@ -15,6 +15,6 @@ proc tup[S, T](x: tuple[a: S, b: T]) = echo "tup2"
 var
   obj: ref int
   tu: tuple[a: int, b: ref bool]
-  
+
 m(obj)
 tup(tu)
diff --git a/tests/overload/toverl4.nim b/tests/overload/toverl4.nim
index 6bb3a53d1..b63265bdf 100644
--- a/tests/overload/toverl4.nim
+++ b/tests/overload/toverl4.nim
@@ -74,4 +74,4 @@ proc add*[TKey, TData](root: var PElement[TKey, TData], key: TKey, data: TData)
 
 var tree = PElement[int, int](kind: ElementKind.inner, key: 0, left: nil, right: nil)
 let result = add(tree, 1, 1)
-echo(result)
\ No newline at end of file
+echo(result)
diff --git a/tests/overload/toverprc.nim b/tests/overload/toverprc.nim
index 78831f744..112eae096 100644
--- a/tests/overload/toverprc.nim
+++ b/tests/overload/toverprc.nim
@@ -5,7 +5,7 @@ yay'''
 
 # Test overloading of procs when used as function pointers
 
-import strutils
+import strutils, sequtils
 
 proc parseInt(x: float): int {.noSideEffect.} = discard
 proc parseInt(x: bool): int {.noSideEffect.} = discard
diff --git a/tests/overload/toverwr.nim b/tests/overload/toverwr.nim
index 32d50faaa..5945a6149 100644
--- a/tests/overload/toverwr.nim
+++ b/tests/overload/toverwr.nim
@@ -1,13 +1,13 @@
-discard """

-  file: "toverwr.nim"

-  output: "hello"

-"""

-# Test the overloading resolution in connection with a qualifier

-

-proc write(t: TFile, s: string) =

-  discard # a nop

-

-system.write(stdout, "hello")

-#OUT hello

-

-

+discard """
+  file: "toverwr.nim"
+  output: "hello"
+"""
+# Test the overloading resolution in connection with a qualifier
+
+proc write(t: TFile, s: string) =
+  discard # a nop
+
+system.write(stdout, "hello")
+#OUT hello
+
+
diff --git a/tests/overload/tspec.nim b/tests/overload/tspec.nim
index 685df503a..f2002a390 100644
--- a/tests/overload/tspec.nim
+++ b/tests/overload/tspec.nim
@@ -11,7 +11,10 @@ ref T
 123
 2
 1
-@[123, 2, 1]'''
+@[123, 2, 1]
+Called!
+merge with var
+merge no var'''
 """
 
 # Things that's even in the spec now!
@@ -79,3 +82,37 @@ proc takeV[T](a: varargs[T]) =
 
 takeV([123, 2, 1]) # takeV's T is "int", not "array of int"
 echo(@[123, 2, 1])
+
+# bug #2600
+
+type
+  FutureBase* = ref object of RootObj ## Untyped future.
+
+  Future*[T] = ref object of FutureBase ## Typed future.
+    value: T ## Stored value
+
+  FutureVar*[T] = distinct Future[T]
+
+proc newFuture*[T](): Future[T] =
+  new(result)
+
+proc newFutureVar*[T](): FutureVar[T] =
+  result = FutureVar[T](newFuture[T]())
+
+proc mget*[T](future: FutureVar[T]): var T =
+  Future[T](future).value
+
+proc reset*[T](future: FutureVar[T]) =
+  echo "Called!"
+
+proc merge[T](x: Future[T]) = echo "merge no var"
+proc merge[T](x: var Future[T]) = echo "merge with var"
+
+when true:
+  var foo = newFutureVar[string]()
+  foo.mget() = ""
+  foo.mget.add("Foobar")
+  foo.reset()
+  var bar = newFuture[int]()
+  bar.merge # merge with var
+  merge(newFuture[int]()) # merge no var
diff --git a/tests/overload/tstmtoverload.nim b/tests/overload/tstmtoverload.nim
new file mode 100644
index 000000000..f1944b637
--- /dev/null
+++ b/tests/overload/tstmtoverload.nim
@@ -0,0 +1,38 @@
+
+# bug #2481
+import math
+
+template test(loopCount: int, extraI: int, testBody: stmt): stmt =
+  block:
+    for i in 0..loopCount-1:
+      testBody
+    echo "done extraI=", extraI
+
+template test(loopCount: int, extraF: float, testBody: stmt): stmt =
+  block:
+    test(loopCount, round(extraF), testBody)
+
+template test(loopCount: int, testBody: stmt): stmt =
+  block:
+    test(loopCount, 0, testBody)
+    echo "done extraI passed 0"
+
+when isMainModule:
+  var
+    loops = 0
+
+  test 0, 0:
+    loops += 1
+  echo "test 0 complete, loops=", loops
+
+  test 1, 1.0:
+    loops += 1
+  echo "test 1.0 complete, loops=", loops
+
+  when true:
+    # when true we get the following compile time error:
+    #   b.nim(35, 6) Error: expression 'loops += 1' has no type (or is ambiguous)
+    loops = 0
+    test 2:
+      loops += 1
+    echo "test no extra complete, loops=", loops
diff --git a/tests/parallel/nim.cfg b/tests/parallel/nim.cfg
index b81c89721..d0d2a9305 100644
--- a/tests/parallel/nim.cfg
+++ b/tests/parallel/nim.cfg
@@ -1 +1,2 @@
 threads:on
+--experimental
diff --git a/tests/parallel/tgc_unsafe2.nim b/tests/parallel/tgc_unsafe2.nim
new file mode 100644
index 000000000..ec4605fe9
--- /dev/null
+++ b/tests/parallel/tgc_unsafe2.nim
@@ -0,0 +1,39 @@
+discard """
+  line: 28
+  nimout: '''tgc_unsafe2.nim(22, 5) Warning: 'trick' is not GC-safe as it accesses 'global' which is a global using GC'ed memory
+tgc_unsafe2.nim(26, 5) Warning: 'track' is not GC-safe as it calls 'trick'
+tgc_unsafe2.nim(28, 5) Error: 'consumer' is not GC-safe as it calls 'track'
+'''
+  errormsg: "'consumer' is not GC-safe as it calls 'track'"
+"""
+
+import threadpool
+
+type StringChannel = TChannel[string]
+var channels: array[1..3, StringChannel]
+
+type
+  MyObject[T] = object
+    x: T
+
+var global: MyObject[string]
+var globalB: MyObject[float]
+
+proc trick(ix: int) =
+  echo global.x
+  echo channels[ix].recv()
+
+proc track(ix: int) = trick(ix)
+
+proc consumer(ix: int) {.thread.} =
+  track(ix)
+
+proc main =
+  for ix in 1..3: channels[ix].open()
+  for ix in 1..3: spawn consumer(ix)
+  for ix in 1..3: channels[ix].send("test")
+  sync()
+  for ix in 1..3: channels[ix].close()
+
+when isMainModule:
+  main()
diff --git a/tests/parallel/tparfind.nim b/tests/parallel/tparfind.nim
new file mode 100644
index 000000000..9de5012f5
--- /dev/null
+++ b/tests/parallel/tparfind.nim
@@ -0,0 +1,28 @@
+discard """
+  output: "500"
+"""
+
+import threadpool, sequtils
+
+{.experimental.}
+
+proc linearFind(a: openArray[int]; x, offset: int): int =
+  for i, y in a:
+    if y == x: return i+offset
+  result = -1
+
+proc parFind(a: seq[int]; x: int): int =
+  var results: array[4, int]
+  parallel:
+    if a.len >= 4:
+      let chunk = a.len div 4
+      results[0] = spawn linearFind(a[0 ..< chunk], x, 0)
+      results[1] = spawn linearFind(a[chunk ..< chunk*2], x, chunk)
+      results[2] = spawn linearFind(a[chunk*2 ..< chunk*3], x, chunk*2)
+      results[3] = spawn linearFind(a[chunk*3 ..< a.len], x, chunk*3)
+  result = max(results)
+
+
+let data = toSeq(0..1000)
+echo parFind(data, 500)
+
diff --git a/tests/parallel/tptr_to_ref.nim b/tests/parallel/tptr_to_ref.nim
new file mode 100644
index 000000000..229c247ce
--- /dev/null
+++ b/tests/parallel/tptr_to_ref.nim
@@ -0,0 +1,71 @@
+# bug #2854
+
+# Test case for the compiler correctly detecting if a type used by a shared
+# global is gcsafe.
+
+import locks, threadpool, osproc
+
+const MAX_WORKERS = 50
+
+type
+  Killer* = object
+    lock:                      Lock
+    bailed    {.guard: lock.}: bool
+    processes {.guard: lock.}: array[0..MAX_WORKERS-1, foreign ptr Process]
+
+# Hold a lock for a statement.
+template hold(lock: Lock, body: stmt) =
+  lock.acquire
+  defer: lock.release
+  {.locks: [lock].}:
+    body
+
+# Return an initialized Killer.
+proc initKiller*(): Killer =
+  initLock(result.lock)
+  result.lock.hold:
+    result.bailed = false
+    for i, _ in result.processes:
+      result.processes[i] = nil
+
+# Global Killer instance.
+var killer = initKiller()
+
+# remember that a process has been launched, killing it if we have bailed.
+proc launched*(process: foreign ptr Process): int {.gcsafe.} =
+  result = killer.processes.high + 1
+  killer.lock.hold:
+    if killer.bailed:
+      process[].terminate()
+    else:
+      for i, _ in killer.processes:
+        if killer.processes[i] == nil:
+          killer.processes[i] = process
+          result = i
+      assert(result <= killer.processes.high)
+
+
+# A process has been finished with - remove the process from death row.
+# Return true if the process was still present, which will be the
+# case unless we have bailed.
+proc completed*(index: int): bool {.gcsafe.} =
+  result = true
+  if index <= killer.processes.high:
+    killer.lock.hold:
+      result = false
+      if killer.processes[index] != nil:
+        result = true
+        killer.processes[index] = nil
+
+
+# Terminate all the processes killer knows about, doing nothing if
+# already bailed.
+proc bail(): bool {.gcsafe.} =
+  killer.lock.hold:
+    result = not killer.bailed
+    if not killer.bailed:
+      killer.bailed = true
+      for i, process in killer.processes:
+        if process != nil:
+          process[].terminate
+          killer.processes[i] = nil
diff --git a/tests/parallel/treadafterwrite.nim b/tests/parallel/treadafterwrite.nim
index f59ad5ae0..12eb31402 100644
--- a/tests/parallel/treadafterwrite.nim
+++ b/tests/parallel/treadafterwrite.nim
@@ -12,7 +12,7 @@ type
   BoxedFloat = object
     value: float
 
-proc term(k: float): ptr BoxedFloat = 
+proc term(k: float): ptr BoxedFloat =
   var temp = 4 * math.pow(-1, k) / (2*k + 1)
   result = cast[ptr BoxedFloat](allocShared(sizeof(BoxedFloat)))
   result.value = temp
diff --git a/tests/parallel/tuseafterdef.nim b/tests/parallel/tuseafterdef.nim
index 95123e886..833c72a0a 100644
--- a/tests/parallel/tuseafterdef.nim
+++ b/tests/parallel/tuseafterdef.nim
@@ -7,11 +7,11 @@ discard """
 
 import strutils, math, threadpool
 
-type 
+type
   BoxedFloat = object
     value: float
 
-proc term(k: float): ptr BoxedFloat = 
+proc term(k: float): ptr BoxedFloat =
   var temp = 4 * math.pow(-1, k) / (2*k + 1)
   result = cast[ptr BoxedFloat](allocShared(sizeof(BoxedFloat)))
   result.value = temp
diff --git a/tests/parallel/twrong_refcounts.nim b/tests/parallel/twrong_refcounts.nim
new file mode 100644
index 000000000..db32a96d8
--- /dev/null
+++ b/tests/parallel/twrong_refcounts.nim
@@ -0,0 +1,53 @@
+discard """
+  output: "Success"
+"""
+
+import math, threadPool
+
+# ---
+
+type
+  Person = object
+    age: int
+    friend: ref Person
+
+var
+  people: seq[ref Person] = @[]
+
+proc newPerson(age:int): ref Person =
+  result.new()
+  result.age = age
+
+proc greet(p:Person) =
+  #echo p.age, ", ", p.friend.age
+  p.friend.age += 1
+
+# ---
+
+proc setup =
+  for i in 0 .. <20:
+    people.add newPerson(i + 1)
+  for i in 0 .. <20:
+    people[i].friend = people[random(20)]
+
+proc update =
+  var countA: array[20, int]
+  var countB: array[20, int]
+
+  for i, p in people:
+    countA[i] = getRefCount(p)
+  parallel:
+    for i in 0 .. people.high:
+      spawn greet(people[i][])
+  for i, p in people:
+    countB[i] = getRefCount(p)
+
+  for i in 0 .. <20:
+    doAssert countA[i] == countB[i]
+  echo "Success"
+
+# ---
+
+when isMainModule:
+  setup()
+  update()
diff --git a/tests/parser/tcommand_as_expr.nim b/tests/parser/tcommand_as_expr.nim
index 730e9cbb7..a244c8767 100644
--- a/tests/parser/tcommand_as_expr.nim
+++ b/tests/parser/tcommand_as_expr.nim
@@ -5,6 +5,7 @@ discard """
 77'''
 """
 #import math
+import sequtils
 
 proc optarg(x:int, y:int = 0):int = x + 3 * y
 proc singlearg(x:int):int = 20*x
diff --git a/tests/parser/tdomulttest.nim b/tests/parser/tdomulttest.nim
index 4ee6de128..418192ac8 100644
--- a/tests/parser/tdomulttest.nim
+++ b/tests/parser/tdomulttest.nim
@@ -14,4 +14,4 @@ do (x: int) -> int:
   echo("multi lines")
   return x
 
-echo("end")
\ No newline at end of file
+echo("end")
diff --git a/tests/parser/tinvcolonlocation1.nim b/tests/parser/tinvcolonlocation1.nim
new file mode 100644
index 000000000..cacde48bd
--- /dev/null
+++ b/tests/parser/tinvcolonlocation1.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tinvcolonlocation1.nim"
+  line: 8
+  column: 3
+  errormsg: "':' expected"
+"""
+try #<- missing ':'
+  echo "try"
+except:
+  echo "except"
+finally:
+  echo "finally"
diff --git a/tests/parser/tinvcolonlocation2.nim b/tests/parser/tinvcolonlocation2.nim
new file mode 100644
index 000000000..2b6a92b9d
--- /dev/null
+++ b/tests/parser/tinvcolonlocation2.nim
@@ -0,0 +1,15 @@
+discard """
+  file: "tinvcolonlocation2.nim"
+  line: 11
+  column: 1
+  errormsg: "':' expected"
+"""
+try:
+  echo "try"
+except #<- missing ':'
+  echo "except"
+finally:
+#<-- error will be here above, at the beginning of finally,
+#    since compiler tries to consome echo and part of except
+#    expression
+  echo "finally"
diff --git a/tests/parser/tinvcolonlocation3.nim b/tests/parser/tinvcolonlocation3.nim
new file mode 100644
index 000000000..2b30b1dbe
--- /dev/null
+++ b/tests/parser/tinvcolonlocation3.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tinvcolonlocation3.nim"
+  line: 12
+  column: 3
+  errormsg: "':' expected"
+"""
+try:
+  echo "try"
+except:
+  echo "except"
+finally #<- missing ':'
+  echo "finally"
diff --git a/tests/parser/tinvwhen.nim b/tests/parser/tinvwhen.nim
index 5ff94cc6c..99701bdf5 100644
--- a/tests/parser/tinvwhen.nim
+++ b/tests/parser/tinvwhen.nim
@@ -3,13 +3,13 @@ discard """
   line: 11
   errormsg: "invalid indentation"
 """
-# This was parsed even though it should not!

-

-proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".}

-

-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!".}

+# This was parsed even though it should not!
+
+proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".}
+
+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/parser/toprprec.nim b/tests/parser/toprprec.nim
index ce33934b5..2c22f5b80 100644
--- a/tests/parser/toprprec.nim
+++ b/tests/parser/toprprec.nim
@@ -2,7 +2,7 @@ discard """
   file: "toprprec.nim"
   output: "done"
 """
-# Test operator precedence: 
+# Test operator precedence:
 
 template `@` (x: expr): expr {.immediate.} = self.x
 template `@!` (x: expr): expr {.immediate.} = x
@@ -12,7 +12,7 @@ type
   TO = object
     x: int
   TA = tuple[a, b: int, obj: TO]
-  
+
 proc init(self: var TA): string =
   @a = 3
   === @b = 4
@@ -22,10 +22,10 @@ proc init(self: var TA): string =
 
 assert 3+5*5-2 == 28- -26-28
 
-proc `^-` (x, y: int): int =  
+proc `^-` (x, y: int): int =
   # now right-associative!
   result = x - y
-  
+
 assert 34 ^- 6 ^- 2 == 30
 assert 34 - 6 - 2 == 26
 
diff --git a/tests/parser/tstrongspaces.nim b/tests/parser/tstrongspaces.nim
index 91506daf0..cb0219976 100644
--- a/tests/parser/tstrongspaces.nim
+++ b/tests/parser/tstrongspaces.nim
@@ -1,7 +1,13 @@
-#! strongSpaces
+#? strongSpaces
 
 discard """
   output: '''35
+true
+true
+4
+true
+1
+false
 77
 (Field0: 1, Field1: 2, Field2: 2)
 ha
@@ -9,11 +15,26 @@ true
 tester args
 all
 all args
+19
+-3
+false
+-2
 '''
 """
 
 echo 2+5 * 5
 
+# Keyword operators
+echo 1 + 16 shl 1 == 1 + (16 shl 1)
+echo 2 and 1  in  {0, 30}
+echo 2+2 * 2 shr 1
+echo false  or  2 and 1  in  {0, 30}
+
+proc `^`(a, b: int): int = a + b div 2
+echo 19 mod 16 ^ 4  +  2 and 1
+echo 18 mod 16 ^ 4 > 0
+
+# echo $foo gotcha
 let foo = 77
 echo $foo
 
@@ -27,7 +48,7 @@ when true:
   let b = 66
   let c = 90
   let bar = 8000
-  if foo+4 * 4 == 8 and b&c | 9  ++
+  if foo+4 * 4 == 8  and  b&c | 9  ++
       bar:
     echo "ho"
   else:
@@ -50,3 +71,13 @@ const
 echo tester & " " & args|"all"
 echo "all"  |  tester & " " & args
 echo "all"|tester & " " & args
+
+# Test arrow like operators. See also tests/macros/tclosuremacro.nim
+proc `+->`(a, b: int): int = a + b*4
+template `===>`(a, b: int): expr = a - b shr 1
+
+echo 3 +-> 2 + 2 and 4
+var arrowed = 3+->2 + 2 and 4  # arrowed = 4
+echo arrowed ===> 15
+echo (2 * 3+->2) == (2*3 +-> 2)
+echo arrowed ===> 2 + 3+->2
diff --git a/tests/parser/ttupleunpack.nim b/tests/parser/ttupleunpack.nim
new file mode 100644
index 000000000..aaa06f9f4
--- /dev/null
+++ b/tests/parser/ttupleunpack.nim
@@ -0,0 +1,35 @@
+discard """
+  file: "ttupleunpack.nim"
+  output: ""
+  exitcode: 0
+"""
+
+proc returnsTuple(): (int, int, int) = (4, 2, 3)
+
+proc main2 =
+  let (x, _, z) = returnsTuple()
+
+proc main() =
+
+  proc foo(): tuple[x, y, z: int] =
+    return (4, 2, 3)
+
+  var (x, _, y) = foo()
+  doAssert x == 4
+  doAssert y == 3
+
+  var (a, _, _) = foo()
+  doAssert a == 4
+
+  var (aa, _, _) = foo()
+  doAssert aa == 4
+
+  iterator bar(): tuple[x, y, z: int] =
+    yield (1,2,3)
+
+  for x, y, _ in bar():
+    doAssert x == 1
+    doAssert y == 2
+
+main()
+main2()
diff --git a/tests/pragmas/tbitsize.nim b/tests/pragmas/tbitsize.nim
new file mode 100644
index 000000000..7a44944d2
--- /dev/null
+++ b/tests/pragmas/tbitsize.nim
@@ -0,0 +1,22 @@
+discard """
+ccodeCheck: "\\i @'unsigned int flag:1;' .*"
+"""
+
+type
+  bits* = object
+    flag* {.bitsize: 1.}: cuint
+    opts* {.bitsize: 4.}: cint
+
+var
+  b: bits
+
+assert b.flag == 0
+b.flag = 1
+assert b.flag == 1
+b.flag = 2
+assert b.flag == 0
+
+b.opts = 7
+assert b.opts == 7
+b.opts = 9
+assert b.opts == -7
diff --git a/tests/pragmas/tpush.nim b/tests/pragmas/tpush.nim
index 5fb411a79..5ecfe9704 100644
--- a/tests/pragmas/tpush.nim
+++ b/tests/pragmas/tpush.nim
@@ -1,15 +1,15 @@
-# test the new pragmas

-

-{.push warnings: off, hints: off.}

-proc noWarning() =

-  var

-    x: int

-  echo(x)

-

-{.pop.}

-

-proc WarnMe() =

-  var

-    x: int

-  echo(x)

-

+# test the new pragmas
+
+{.push warnings: off, hints: off.}
+proc noWarning() =
+  var
+    x: int
+  echo(x)
+
+{.pop.}
+
+proc WarnMe() =
+  var
+    x: int
+  echo(x)
+
diff --git a/tests/pragmas/tsym_as_pragma.nim b/tests/pragmas/tsym_as_pragma.nim
new file mode 100644
index 000000000..f6ba44dc9
--- /dev/null
+++ b/tests/pragmas/tsym_as_pragma.nim
@@ -0,0 +1,8 @@
+
+# bug #3171
+
+template newDataWindow(): stmt =
+    let eventClosure = proc (closure: pointer): bool {.closure, cdecl.} =
+        discard
+
+newDataWindow()
diff --git a/tests/proc/tnestprc.nim b/tests/proc/tnestprc.nim
index c10ad6abf..9b3c33d5e 100644
--- a/tests/proc/tnestprc.nim
+++ b/tests/proc/tnestprc.nim
@@ -4,12 +4,12 @@ discard """
 """
 # Test nested procs without closures
 
-proc Add3(x: int): int = 
-  proc add(x, y: int): int {.noconv.} = 
+proc Add3(x: int): int =
+  proc add(x, y: int): int {.noconv.} =
     result = x + y
-    
+
   result = add(x, 3)
-  
+
 echo Add3(7) #OUT 10
 
 
diff --git a/tests/procvar/tprocvar.nim b/tests/procvar/tprocvar.nim
index 56f76c613..f523aa391 100644
--- a/tests/procvar/tprocvar.nim
+++ b/tests/procvar/tprocvar.nim
@@ -13,6 +13,6 @@ proc huh(x, y: var int) =
 
 proc so(c: TCallback) =
   c(2, 4)
-  
+
 so(huh)
 
diff --git a/tests/procvar/tprocvar2.nim b/tests/procvar/tprocvar2.nim
index 237e2ef7a..a590bc4bd 100644
--- a/tests/procvar/tprocvar2.nim
+++ b/tests/procvar/tprocvar2.nim
@@ -2,7 +2,7 @@ discard """
   file: "tprocvar.nim"
   output: "papbpcpdpe7"
 """
-# test variables of type proc

+# test variables of type proc
 
 proc pa() {.cdecl.} = write(stdout, "pa")
 proc pb() {.cdecl.} = write(stdout, "pb")
@@ -12,21 +12,21 @@ proc pe() {.cdecl.} = write(stdout, "pe")
 
 const
   algos = [pa, pb, pc, pd, pe]
-

-var

-  x: proc (a, b: int): int {.cdecl.}

-

-proc ha(c, d: int): int {.cdecl.} =

-  echo(c + d)

-  result = c + d

+
+var
+  x: proc (a, b: int): int {.cdecl.}
+
+proc ha(c, d: int): int {.cdecl.} =
+  echo(c + d)
+  result = c + d
 
 for a in items(algos):
   a()
-

-x = ha

-discard x(3, 4)

-

-#OUT papbpcpdpe7

-

+
+x = ha
+discard x(3, 4)
+
+#OUT papbpcpdpe7
+
 
 
diff --git a/tests/range/tbug499771.nim b/tests/range/tbug499771.nim
index 682148422..1504a2ad7 100644
--- a/tests/range/tbug499771.nim
+++ b/tests/range/tbug499771.nim
@@ -3,11 +3,11 @@ discard """
   output: '''TSubRange: 5 from 1 to 10
 true true true'''
 """
-type 
+type
   TSubRange = range[1 .. 10]
   TEnum = enum A, B, C
 var sr: TSubRange = 5
-echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " & 
+echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " &
      $high(TSubRange))
 
 const cset = {A} + {B}
diff --git a/tests/range/tcolors.nim b/tests/range/tcolors.nim
index 9d1034405..ab5b3e199 100644
--- a/tests/range/tcolors.nim
+++ b/tests/range/tcolors.nim
@@ -3,7 +3,7 @@ import strutils
 type
   TColor = distinct int32
 
-proc rgb(r, g, b: range[0..255]): TColor = 
+proc rgb(r, g, b: range[0..255]): TColor =
   result = TColor(r or g shl 8 or b shl 16)
 
 proc `$`(c: TColor): string =
@@ -15,25 +15,25 @@ when false:
   type
     TColor = distinct int32
     TColorComponent = distinct int8
-  
-  proc red(a: TColor): TColorComponent = 
+
+  proc red(a: TColor): TColorComponent =
     result = TColorComponent(int32(a) and 0xff'i32)
-  
-  proc green(a: TColor): TColorComponent = 
+
+  proc green(a: TColor): TColorComponent =
     result = TColorComponent(int32(a) shr 8'i32 and 0xff'i32)
-  
-  proc blue(a: TColor): TColorComponent = 
+
+  proc blue(a: TColor): TColorComponent =
     result = TColorComponent(int32(a) shr 16'i32 and 0xff'i32)
-  
-  proc rgb(r, g, b: range[0..255]): TColor = 
+
+  proc rgb(r, g, b: range[0..255]): TColor =
     result = TColor(r or g shl 8 or b shl 8)
-  
-  proc `+!` (a, b: TColorComponent): TColorComponent =  
+
+  proc `+!` (a, b: TColorComponent): TColorComponent =
     ## saturated arithmetic:
     result = TColorComponent(min(ze(int8(a)) + ze(int8(b)), 255))
-  
-  proc `+` (a, b: TColor): TColor = 
+
+  proc `+` (a, b: TColor): TColor =
     ## saturated arithmetic for colors makes sense, I think:
     return rgb(red(a) +! red(b), green(a) +! green(b), blue(a) +! blue(b))
-  
+
   rgb(34, 55, 255)
diff --git a/tests/range/tmatrix3.nim b/tests/range/tmatrix3.nim
index 80d38d63d..fe666b0d8 100644
--- a/tests/range/tmatrix3.nim
+++ b/tests/range/tmatrix3.nim
@@ -10,11 +10,11 @@ discard """
 include compilehelpers
 
 type
-  Matrix*[M, N, T] = object 
+  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]
@@ -23,7 +23,7 @@ proc m2(x: Matrix2): Matrix2.T = x.aij[0][0]
 
 proc m3(x: Matrix3): auto = x.aij[0][0]
 
-var 
+var
   matn: Matrix[range[0..3], range[0..2], int]
   mat2: Matrix2[int]
   mat3: Matrix3[float]
diff --git a/tests/range/tsubrange.nim b/tests/range/tsubrange.nim
index b4a333bf3..6f88c5a22 100644
--- a/tests/range/tsubrange.nim
+++ b/tests/range/tsubrange.nim
@@ -5,10 +5,10 @@ discard """
 
 type
   TRange = range[0..40]
-  
+
 proc p(r: TRange) =
   nil
-  
+
 var
   r: TRange
   y = 50
@@ -18,4 +18,4 @@ p y
 
 const
   myConst: TRange = 60
-  
+
diff --git a/tests/range/tsubrange2.nim b/tests/range/tsubrange2.nim
index 759d16b9c..7097faed2 100644
--- a/tests/range/tsubrange2.nim
+++ b/tests/range/tsubrange2.nim
@@ -6,12 +6,12 @@ discard """
 
 type
   TRange = range[0..40]
-  
+
 proc p(r: TRange) =
   discard
-  
+
 var
   r: TRange
   y = 50
 p y
-  
+
diff --git a/tests/range/tsubrange3.nim b/tests/range/tsubrange3.nim
index 600161cfd..f5bb2f161 100644
--- a/tests/range/tsubrange3.nim
+++ b/tests/range/tsubrange3.nim
@@ -6,10 +6,10 @@ discard """
 
 type
   TRange = range[0..40]
-  
+
 proc p(r: TRange) =
   discard
-  
+
 var
   r: TRange
   y = 50
diff --git a/tests/rational/trat_float.nim b/tests/rational/trat_float.nim
new file mode 100644
index 000000000..24797c4a0
--- /dev/null
+++ b/tests/rational/trat_float.nim
@@ -0,0 +1,9 @@
+discard """
+  file: "trat_float.nim"
+  line: "9,19"
+  errormsg: '''type mismatch: got'''
+"""
+import rationals
+var
+  # this fails - no floats as num or den
+  r = initRational(1.0'f, 1.0'f)
diff --git a/tests/rational/trat_init.nim b/tests/rational/trat_init.nim
new file mode 100644
index 000000000..df29ff6e3
--- /dev/null
+++ b/tests/rational/trat_init.nim
@@ -0,0 +1,10 @@
+discard """
+  file: "trat_init.nim"
+  exitcode: "1"
+"""
+import rationals
+var
+  z = Rational[int](num: 0, den: 1)
+  o = initRational(num=1, den=1)
+  a = initRational(1, 2)
+  r = initRational(1, 0)  # this fails - no zero denominator
diff --git a/tests/readme.txt b/tests/readme.txt
index 0d33a81c7..0ff9e11c6 100644
--- a/tests/readme.txt
+++ b/tests/readme.txt
@@ -1,10 +1,13 @@
-This directory contains the test cases.

-Each test must have a filename of the form: ``t*.nim``

-

-Each test can contain a spec in a ``discard """"""`` block.

-

-The folder ``rodfiles`` contains special tests that test incremental 

-compilation via symbol files.

-

-The folder ``dll`` contains simple DLL tests.

-

+This directory contains the test cases.
+Each test must have a filename of the form: ``t*.nim``
+
+Each test can contain a spec in a ``discard """"""`` block.
+
+The folder ``rodfiles`` contains special tests that test incremental
+compilation via symbol files.
+
+The folder ``dll`` contains simple DLL tests.
+
+The folder ``realtimeGC`` contains a test for validating that the realtime GC
+can run properly without linking against the nimrtl.dll/so. It includes a C
+client and platform specific build files for manual compilation.
diff --git a/tests/realtimeGC/cmain.c b/tests/realtimeGC/cmain.c
new file mode 100644
index 000000000..e9a46d7ce
--- /dev/null
+++ b/tests/realtimeGC/cmain.c
@@ -0,0 +1,67 @@
+
+#ifdef WIN
+#include <windows.h>
+#else
+#include <dlfcn.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+
+#define RUNTIME (15*60)
+
+
+typedef void (*pFunc)(void);
+
+int main(int argc, char* argv[])
+{
+    int i;
+    void* hndl;
+    pFunc status;
+    pFunc count;
+    pFunc checkOccupiedMem;
+
+#ifdef WIN
+    hndl = (void*) LoadLibrary((char const*)"./tests/realtimeGC/shared.dll");
+    status = (pFunc)GetProcAddress((HMODULE) hndl, (char const*)"status");
+    count = (pFunc)GetProcAddress((HMODULE) hndl, (char const*)"count");
+    checkOccupiedMem = (pFunc)GetProcAddress((HMODULE) hndl, (char const*)"checkOccupiedMem");
+#else /* OSX || NIX */
+    hndl = (void*) dlopen((char const*)"./tests/realtimeGC/libshared.so", RTLD_LAZY);
+    status = (pFunc) dlsym(hndl, (char const*)"status");
+    count = (pFunc) dlsym(hndl, (char const*)"count");
+    checkOccupiedMem = (pFunc) dlsym(hndl, (char const*)"checkOccupiedMem");
+#endif
+
+    assert(hndl);
+    assert(status);
+    assert(count);
+    assert(checkOccupiedMem);
+
+    time_t startTime = time((time_t*)0);
+    time_t runTime = (time_t)(RUNTIME);
+    time_t accumTime = 0;
+    while (accumTime < runTime) {
+        for (i = 0; i < 10; i++)
+            count();
+        /* printf("1. sleeping...\n"); */
+        sleep(1);
+        for (i = 0; i < 10; i++)
+            status();
+        /* printf("2. sleeping...\n"); */
+        sleep(1);
+        checkOccupiedMem();
+        accumTime = time((time_t*)0) - startTime;
+        /* printf("--- Minutes left to run: %d\n", (int)(runTime-accumTime)/60); */
+    }
+    printf("Cleaning up the shared object pointer...\n");
+#ifdef WIN
+    FreeLibrary((HMODULE)hndl);
+#else /* OSX || NIX */
+    dlclose(hndl);
+#endif
+    printf("Done\n");
+    return 0;
+}
diff --git a/tests/realtimeGC/main.nim.cfg b/tests/realtimeGC/main.nim.cfg
new file mode 100644
index 000000000..fed4fa471
--- /dev/null
+++ b/tests/realtimeGC/main.nim.cfg
@@ -0,0 +1,6 @@
+
+--app:console
+--threads:on
+
+-d:release
+-d:useRealtimeGC
diff --git a/tests/realtimeGC/nmain.nim b/tests/realtimeGC/nmain.nim
new file mode 100644
index 000000000..c9f558dbc
--- /dev/null
+++ b/tests/realtimeGC/nmain.nim
@@ -0,0 +1,46 @@
+discard """
+  cmd: "nim $target --debuginfo $options $file"
+  output: "Done"
+"""
+
+import times, os, threadpool
+
+const RUNTIME = 15 * 60 # 15 minutes
+
+when defined(windows):
+  const dllname = "./tests/realtimeGC/shared.dll"
+elif defined(macosx):
+  const dllname = "./tests/realtimeGC/libshared.dylib"
+else:
+  const dllname = "./tests/realtimeGC/libshared.so"
+
+proc status() {.importc: "status", dynlib: dllname.}
+proc count() {.importc: "count", dynlib: dllname.}
+proc checkOccupiedMem() {.importc: "checkOccupiedMem", dynlib: dllname.}
+
+proc process() =
+  let startTime = getTime()
+  let runTime = cast[Time](RUNTIME) #
+  var accumTime: Time
+  while accumTime < runTime:
+    for i in 0..10:
+      count()
+    # echo("1. sleeping... ")
+    sleep(500)
+    for i in 0..10:
+      status()
+    # echo("2. sleeping... ")
+    sleep(500)
+    checkOccupiedMem()
+    accumTime = cast[Time]((getTime() - startTime))
+    # echo("--- Minutes left to run: ", int(int(runTime-accumTime)/60))
+
+proc main() =
+  process()
+  # parallel:
+  #   for i in 0..0:
+  #     spawn process()
+  # sync()
+  echo("Done")
+
+main()
diff --git a/tests/realtimeGC/readme.txt b/tests/realtimeGC/readme.txt
new file mode 100644
index 000000000..17e18a5e5
--- /dev/null
+++ b/tests/realtimeGC/readme.txt
@@ -0,0 +1,21 @@
+Test the realtime GC without linking nimrtl.dll/so.
+
+Note, this is a long running test, default is 35 minutes. To change the
+the run time see RUNTIME in main.nim and main.c.
+
+You can build shared.nim, main.nim, and main.c by running make (nix systems)
+or maike.bat (Windows systems). They both assume GCC and that it's in your
+path. Output: shared.(dll/so), camin(.exe), nmain(.exe).
+
+To run the test: execute either nmain or cmain in a shell window.
+
+To build buy hand:
+
+  - build the shared object (shared.nim):
+
+    $ nim c shared.nim
+
+  - build the client executables:
+
+    $ nim c -o:nmain main.nim
+    $ gcc -o cmain main.c -ldl
diff --git a/tests/realtimeGC/shared.nim b/tests/realtimeGC/shared.nim
new file mode 100644
index 000000000..2d1dd6c3c
--- /dev/null
+++ b/tests/realtimeGC/shared.nim
@@ -0,0 +1,63 @@
+discard """
+  cmd: "nim $target --debuginfo --hints:on --app:lib $options $file"
+"""
+
+import strutils
+
+# Global state, accessing with threads, no locks. Don't do this at
+# home.
+var gCounter: uint64
+var gTxStatus: bool
+var gRxStatus: bool
+var gConnectStatus: bool
+var gPttStatus: bool
+var gComm1Status: bool
+var gComm2Status: bool
+
+proc getTxStatus(): string =
+  result = if gTxStatus: "On" else: "Off"
+  gTxStatus = not gTxStatus
+
+proc getRxStatus(): string =
+  result = if gRxStatus: "On" else: "Off"
+  gRxStatus = not gRxStatus
+
+proc getConnectStatus(): string =
+  result = if gConnectStatus: "Yes" else: "No"
+  gConnectStatus = not gConnectStatus
+
+proc getPttStatus(): string =
+  result = if gPttStatus: "PTT: On" else: "PTT: Off"
+  gPttStatus = not gPttStatus
+
+proc getComm1Status(): string =
+  result = if gComm1Status: "On" else: "Off"
+  gComm1Status = not gComm1Status
+
+proc getComm2Status(): string =
+  result = if gComm2Status: "On" else: "Off"
+  gComm2Status = not gComm2Status
+
+proc status() {.exportc: "status", dynlib.} =
+  var tx_status = getTxStatus()
+  var rx_status = getRxStatus()
+  var connected = getConnectStatus()
+  var ptt_status = getPttStatus()
+  var str1: string = "[PilotEdge] Connected: $1  TX: $2  RX: $3" % [connected, tx_status, rx_status]
+  var a = getComm1Status()
+  var b = getComm2Status()
+  var str2: string = "$1  COM1: $2  COM2: $3" % [ptt_status, a, b]
+  # echo(str1)
+  # echo(str2)
+
+proc count() {.exportc: "count", dynlib.} =
+  var temp: uint64
+  for i in 0..100_000:
+    temp += 1
+  gCounter += 1
+  # echo("gCounter: ", gCounter)
+
+proc checkOccupiedMem() {.exportc: "checkOccupiedMem", dynlib.} =
+  if getOccupiedMem() > 10_000_000:
+    quit 1
+  discard
diff --git a/tests/realtimeGC/shared.nim.cfg b/tests/realtimeGC/shared.nim.cfg
new file mode 100644
index 000000000..e153b26fa
--- /dev/null
+++ b/tests/realtimeGC/shared.nim.cfg
@@ -0,0 +1,5 @@
+--app:lib
+--threads:on
+
+-d:release
+-d:useRealtimeGC
diff --git a/tests/rectest.nim b/tests/rectest.nim
index f08306cfd..54815e1f6 100644
--- a/tests/rectest.nim
+++ b/tests/rectest.nim
@@ -1,6 +1,6 @@
-# Test the error message

-

-proc main() =

-  main()

-

-main()

+# Test the error message
+
+proc main() =
+  main()
+
+main()
diff --git a/tests/rodfiles/amethods.nim b/tests/rodfiles/amethods.nim
index c51d27d24..ecd36d491 100644
--- a/tests/rodfiles/amethods.nim
+++ b/tests/rodfiles/amethods.nim
@@ -4,7 +4,7 @@ type
 
 proc newBaseClass*: ref TBaseClass =
   new result
-  
+
 method echoType*(x: ref TBaseClass) =
   echo "base class"
 
diff --git a/tests/rodfiles/bmethods.nim b/tests/rodfiles/bmethods.nim
index 995942ad6..c77941e4a 100644
--- a/tests/rodfiles/bmethods.nim
+++ b/tests/rodfiles/bmethods.nim
@@ -12,7 +12,7 @@ type
 
 proc newDerivedClass: ref TDerivedClass =
   new result
-  
+
 method echoType*(x: ref TDerivedClass) =
   echo "derived class"
 
diff --git a/tests/rodfiles/bmethods2.nim b/tests/rodfiles/bmethods2.nim
index ac24a2201..c9d25eee4 100644
--- a/tests/rodfiles/bmethods2.nim
+++ b/tests/rodfiles/bmethods2.nim
@@ -12,7 +12,7 @@ type
 
 proc newDerivedClass: ref TDerivedClass =
   new result
-  
+
 method echoType*(x: ref TDerivedClass) =
   echo "derived class 2"
 
diff --git a/tests/rodfiles/deadg.nim b/tests/rodfiles/deadg.nim
index 97bfbed4f..587608e14 100644
--- a/tests/rodfiles/deadg.nim
+++ b/tests/rodfiles/deadg.nim
@@ -3,8 +3,8 @@
 
 proc p1*(x, y: int): int =
   result = x + y
-  
+
 proc p2*(x, y: string): string =
   result = x & y
-  
+
 
diff --git a/tests/rodfiles/gtkex1.nim b/tests/rodfiles/gtkex1.nim
index 8f4db4a40..156ba5322 100644
--- a/tests/rodfiles/gtkex1.nim
+++ b/tests/rodfiles/gtkex1.nim
@@ -1,14 +1,14 @@
-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(gtkex1.destroy), nil)

-show(window)

-main()

+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(gtkex1.destroy), nil)
+show(window)
+main()
diff --git a/tests/rodfiles/gtkex2.nim b/tests/rodfiles/gtkex2.nim
index 3d181ba12..70926bd50 100644
--- a/tests/rodfiles/gtkex2.nim
+++ b/tests/rodfiles/gtkex2.nim
@@ -1,11 +1,11 @@
 
-import 
+import
   glib2, gtk2
 
-proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = 
+proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
   main_quit()
 
-var 
+var
   window: PWidget
   button: PWidget
 
@@ -14,7 +14,7 @@ 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", 
+discard signal_connect(window, "destroy",
                            SIGNAL_FUNC(gtkex2.destroy), nil)
 show(button)
 show(window)
diff --git a/tests/rodfiles/hallo2.nim b/tests/rodfiles/hallo2.nim
index a4b3957ec..40fe64cfd 100644
--- a/tests/rodfiles/hallo2.nim
+++ b/tests/rodfiles/hallo2.nim
@@ -12,6 +12,6 @@ type
 proc newNode(data: string): ref TNode =
   new(result)
   result.data = data
-  
+
 echo newNode("Hello World").data
 
diff --git a/tests/seq/tseq2.nim b/tests/seq/tseq2.nim
index e1271964c..5de9402ec 100644
--- a/tests/seq/tseq2.nim
+++ b/tests/seq/tseq2.nim
@@ -1,10 +1,10 @@
-proc `*` *(a, b: seq[int]): seq[int] = 
+proc `*` *(a, b: seq[int]): seq[int] =
   # allocate a new sequence:
   newSeq(result, len(a))
   # multiply two int sequences:
   for i in 0..len(a)-1: result[i] = a[i] * b[i]
 
-when isMainModule: 
+when isMainModule:
   # test the new ``*`` operator for sequences:
   assert(@[1, 2, 3] * @[1, 2, 3] == @[1, 4, 9])
 
diff --git a/tests/seq/tseqcon.nim b/tests/seq/tseqcon.nim
index 6e0a5b56d..902ac3485 100644
--- a/tests/seq/tseqcon.nim
+++ b/tests/seq/tseqcon.nim
@@ -2,50 +2,50 @@ discard """
   file: "tseqcon.nim"
   output: "Hithere, what\'s your name?Hathere, what\'s your name?"
 """
-# Test the add proc for sequences and strings

-

-const

-  nestedFixed = true

-

-type

-  TRec {.final.} = object

-    x, y: int

-    s: string

-    seq: seq[string]

-  TRecSeq = seq[TRec]

-

-proc test() =

-  var s, b: seq[string]

-  s = @[]

-  add(s, "Hi")

-  add(s, "there, ")

-  add(s, "what's your name?")

-

-  b = s # deep copying here!

-  b[0][1] = 'a'

-

-  for i in 0 .. len(s)-1:

-    write(stdout, s[i])

-  for i in 0 .. len(b)-1:

-    write(stdout, b[i])

-

-

-when nestedFixed:

-  proc nested() =

-    var

-      s: seq[seq[string]]

-    for i in 0..10_000: # test if the garbage collector

-      # now works with sequences

-      s = @[

-        @["A", "B", "C", "D"],

-        @["E", "F", "G", "H"],

-        @["I", "J", "K", "L"],

-        @["M", "N", "O", "P"]]

-

-test()

-when nestedFixed:

-  nested()

-

-#OUT Hithere, what's your name?Hathere, what's your name?

+# Test the add proc for sequences and strings
+
+const
+  nestedFixed = true
+
+type
+  TRec {.final.} = object
+    x, y: int
+    s: string
+    seq: seq[string]
+  TRecSeq = seq[TRec]
+
+proc test() =
+  var s, b: seq[string]
+  s = @[]
+  add(s, "Hi")
+  add(s, "there, ")
+  add(s, "what's your name?")
+
+  b = s # deep copying here!
+  b[0][1] = 'a'
+
+  for i in 0 .. len(s)-1:
+    write(stdout, s[i])
+  for i in 0 .. len(b)-1:
+    write(stdout, b[i])
+
+
+when nestedFixed:
+  proc nested() =
+    var
+      s: seq[seq[string]]
+    for i in 0..10_000: # test if the garbage collector
+      # now works with sequences
+      s = @[
+        @["A", "B", "C", "D"],
+        @["E", "F", "G", "H"],
+        @["I", "J", "K", "L"],
+        @["M", "N", "O", "P"]]
+
+test()
+when nestedFixed:
+  nested()
+
+#OUT Hithere, what's your name?Hathere, what's your name?
 
 
diff --git a/tests/seq/tseqtuple.nim b/tests/seq/tseqtuple.nim
index 7ef92f7f1..a0102c9ef 100644
--- a/tests/seq/tseqtuple.nim
+++ b/tests/seq/tseqtuple.nim
@@ -6,7 +6,7 @@ discard """
 type
   TMsg = tuple[
     file: string,
-    line: int,       
+    line: int,
     msg: string,
     err: bool]
 
diff --git a/tests/seq/ttoseq.nim b/tests/seq/ttoseq.nim
index 34cc4824b..33de59538 100644
--- a/tests/seq/ttoseq.nim
+++ b/tests/seq/ttoseq.nim
@@ -4,9 +4,9 @@ discard """
 
 import sequtils
 
-for x in toSeq(countup(2, 6)): 
+for x in toSeq(countup(2, 6)):
   stdout.write(x)
-for x in items(toSeq(countup(2, 6))): 
+for x in items(toSeq(countup(2, 6))):
   stdout.write(x)
 
 import strutils
diff --git a/tests/sets/tsets.nim b/tests/sets/tsets.nim
index e370209ed..53a955af8 100644
--- a/tests/sets/tsets.nim
+++ b/tests/sets/tsets.nim
@@ -1,64 +1,204 @@
-discard """

-  file: "tsets.nim"

-  output: "Ha ein F ist in s!"

-"""

-# Test the handling of sets

-

-import

-  strutils

-

-proc testSets(s: var set[char]) =

-  s = {'A', 'B', 'C', 'E'..'G'} + {'Z'} + s

-

-# test sets if the first element is different from 0:

-type

-  TAZ = range['a'..'z']

-  TAZset = set[TAZ]

-

-  TTokType* = enum 

-    tkInvalid, tkEof,

-    tkSymbol,

-    tkAddr, tkAnd, tkAs, tkAsm, tkBlock, tkBreak, tkCase, tkCast, tkConst, 

-    tkContinue, tkConverter, tkDiscard, tkDiv, tkElif, tkElse, tkEnd, tkEnum, 

-    tkExcept, tkException, tkFinally, tkFor, tkFrom, tkGeneric, tkIf, tkImplies, 

-    tkImport, tkIn, tkInclude, tkIs, tkIsnot, tkIterator, tkLambda, tkMacro, 

-    tkMethod, tkMod, tkNil, tkNot, tkNotin, tkObject, tkOf, tkOr, tkOut, tkProc, 

-    tkPtr, tkRaise, tkRecord, tkRef, tkReturn, tkShl, tkShr, tkTemplate, tkTry, 

-    tkType, tkVar, tkWhen, tkWhere, tkWhile, tkWith, tkWithout, tkXor, tkYield,

-    tkIntLit, tkInt8Lit, tkInt16Lit, tkInt32Lit, tkInt64Lit, tkFloatLit, 

-    tkFloat32Lit, tkFloat64Lit, tkStrLit, tkRStrLit, tkTripleStrLit, tkCharLit, 

-    tkRCharLit, tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe, 

-    tkCurlyRi, tkBracketDotLe, tkBracketDotRi, 

-    tkCurlyDotLe, tkCurlyDotRi, 

-    tkParDotLe, tkParDotRi,

-    tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot, tkHat, tkOpr, 

-    tkComment, tkAccent, tkInd, tkSad, tkDed,

-    tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr

-  TTokTypeRange = range[tkSymbol..tkDed]

-  TTokTypes* = set[TTokTypeRange]

-

-const

-  toktypes: TTokTypes = {TTokTypeRange(tkSymbol)..pred(tkIntLit), 

-                         tkStrLit..tkTripleStrLit}

-

-var

-  s: set[char]

-  a: TAZset

-s = {'0'..'9'}

-testSets(s)

-if 'F' in s: write(stdout, "Ha ein F ist in s!\n")

-else: write(stdout, "BUG: F ist nicht in s!\n")

-a = {} #{'a'..'z'}

-for x in low(TAZ) .. high(TAZ):

-  incl(a, x)

-  if x in a: discard

-  else: write(stdout, "BUG: something not in a!\n")

-

-for x in low(TTokTypeRange) .. high(TTokTypeRange):

-  if x in tokTypes:

-    discard

-    #writeln(stdout, "the token '$1' is in the set" % repr(x))

-

-#OUT Ha ein F ist in s!

-

-

+discard """
+  file: "tsets.nim"
+  output: '''Ha ein F ist in s!
+false'''
+"""
+# Test the handling of sets
+
+import
+  strutils
+
+proc testSets(s: var set[char]) =
+  s = {'A', 'B', 'C', 'E'..'G'} + {'Z'} + s
+
+# test sets if the first element is different from 0:
+type
+  TAZ = range['a'..'z']
+  TAZset = set[TAZ]
+
+  TTokType* = enum
+    tkInvalid, tkEof,
+    tkSymbol,
+    tkAddr, tkAnd, tkAs, tkAsm, tkBlock, tkBreak, tkCase, tkCast, tkConst,
+    tkContinue, tkConverter, tkDiscard, tkDiv, tkElif, tkElse, tkEnd, tkEnum,
+    tkExcept, tkException, tkFinally, tkFor, tkFrom, tkGeneric, tkIf, tkImplies,
+    tkImport, tkIn, tkInclude, tkIs, tkIsnot, tkIterator, tkLambda, tkMacro,
+    tkMethod, tkMod, tkNil, tkNot, tkNotin, tkObject, tkOf, tkOr, tkOut, tkProc,
+    tkPtr, tkRaise, tkRecord, tkRef, tkReturn, tkShl, tkShr, tkTemplate, tkTry,
+    tkType, tkVar, tkWhen, tkWhere, tkWhile, tkWith, tkWithout, tkXor, tkYield,
+    tkIntLit, tkInt8Lit, tkInt16Lit, tkInt32Lit, tkInt64Lit, tkFloatLit,
+    tkFloat32Lit, tkFloat64Lit, tkStrLit, tkRStrLit, tkTripleStrLit, tkCharLit,
+    tkRCharLit, tkParLe, tkParRi, tkBracketLe, tkBracketRi, tkCurlyLe,
+    tkCurlyRi, tkBracketDotLe, tkBracketDotRi,
+    tkCurlyDotLe, tkCurlyDotRi,
+    tkParDotLe, tkParDotRi,
+    tkComma, tkSemiColon, tkColon, tkEquals, tkDot, tkDotDot, tkHat, tkOpr,
+    tkComment, tkAccent, tkInd, tkSad, tkDed,
+    tkSpaces, tkInfixOpr, tkPrefixOpr, tkPostfixOpr
+  TTokTypeRange = range[tkSymbol..tkDed]
+  TTokTypes* = set[TTokTypeRange]
+
+const
+  toktypes: TTokTypes = {TTokTypeRange(tkSymbol)..pred(tkIntLit),
+                         tkStrLit..tkTripleStrLit}
+
+var
+  s: set[char]
+  a: TAZset
+s = {'0'..'9'}
+testSets(s)
+if 'F' in s: write(stdout, "Ha ein F ist in s!\n")
+else: write(stdout, "BUG: F ist nicht in s!\n")
+a = {} #{'a'..'z'}
+for x in low(TAZ) .. high(TAZ):
+  incl(a, x)
+  if x in a: discard
+  else: write(stdout, "BUG: something not in a!\n")
+
+for x in low(TTokTypeRange) .. high(TTokTypeRange):
+  if x in tokTypes:
+    discard
+    #writeLine(stdout, "the token '$1' is in the set" % repr(x))
+
+#OUT Ha ein F ist in s!
+
+
+type
+  TMsgKind* = enum
+    errUnknown, errIllFormedAstX, errInternal, errCannotOpenFile, errGenerated,
+    errXCompilerDoesNotSupportCpp, errStringLiteralExpected,
+    errIntLiteralExpected, errInvalidCharacterConstant,
+    errClosingTripleQuoteExpected, errClosingQuoteExpected,
+    errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
+    errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter,
+    errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected,
+    errNewlineExpected,
+    errInvalidModuleName,
+    errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
+    errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
+    errInvalidPragma, errUnknownPragma, errInvalidDirectiveX,
+    errAtPopWithoutPush, errEmptyAsm, errInvalidIndentation,
+    errExceptionExpected, errExceptionAlreadyHandled,
+    errYieldNotAllowedHere, errYieldNotAllowedInTryStmt,
+    errInvalidNumberOfYieldExpr, errCannotReturnExpr, errAttemptToRedefine,
+    errStmtInvalidAfterReturn, errStmtExpected, errInvalidLabel,
+    errInvalidCmdLineOption, errCmdLineArgExpected, errCmdLineNoArgExpected,
+    errInvalidVarSubstitution, errUnknownVar, errUnknownCcompiler,
+    errOnOrOffExpectedButXFound, errNoneBoehmRefcExpectedButXFound,
+    errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound,
+    errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound,
+    errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected,
+    errExprExpected, errUndeclaredIdentifier, errUseQualifier, errTypeExpected,
+    errSystemNeeds, errExecutionOfProgramFailed, errNotOverloadable,
+    errInvalidArgForX, errStmtHasNoEffect, errXExpectsTypeOrValue,
+    errXExpectsArrayType, errIteratorCannotBeInstantiated, errExprXAmbiguous,
+    errConstantDivisionByZero, errOrdinalTypeExpected,
+    errOrdinalOrFloatTypeExpected, errOverOrUnderflow,
+    errCannotEvalXBecauseIncompletelyDefined, errChrExpectsRange0_255,
+    errDynlibRequiresExportc, errUndeclaredFieldX, errNilAccess,
+    errIndexOutOfBounds, errIndexTypesDoNotMatch, errBracketsInvalidForType,
+    errValueOutOfSetBounds, errFieldInitTwice, errFieldNotInit,
+    errExprXCannotBeCalled, errExprHasNoType, errExprXHasNoType,
+    errCastNotInSafeMode, errExprCannotBeCastedToX, errCommaOrParRiExpected,
+    errCurlyLeOrParLeExpected, errSectionExpected, errRangeExpected,
+    errMagicOnlyInSystem, errPowerOfTwoExpected,
+    errStringMayNotBeEmpty, errCallConvExpected, errProcOnlyOneCallConv,
+    errSymbolMustBeImported, errExprMustBeBool, errConstExprExpected,
+    errDuplicateCaseLabel, errRangeIsEmpty, errSelectorMustBeOfCertainTypes,
+    errSelectorMustBeOrdinal, errOrdXMustNotBeNegative, errLenXinvalid,
+    errWrongNumberOfVariables, errExprCannotBeRaised, errBreakOnlyInLoop,
+    errTypeXhasUnknownSize, errConstNeedsConstExpr, errConstNeedsValue,
+    errResultCannotBeOpenArray, errSizeTooBig, errSetTooBig,
+    errBaseTypeMustBeOrdinal, errInheritanceOnlyWithNonFinalObjects,
+    errInheritanceOnlyWithEnums, errIllegalRecursionInTypeX,
+    errCannotInstantiateX, errExprHasNoAddress, errXStackEscape,
+    errVarForOutParamNeeded,
+    errPureTypeMismatch, errTypeMismatch, errButExpected, errButExpectedX,
+    errAmbiguousCallXYZ, errWrongNumberOfArguments,
+    errXCannotBePassedToProcVar,
+    errXCannotBeInParamDecl, errPragmaOnlyInHeaderOfProc, errImplOfXNotAllowed,
+    errImplOfXexpected, errNoSymbolToBorrowFromFound, errDiscardValueX,
+    errInvalidDiscard, errIllegalConvFromXtoY, errCannotBindXTwice,
+    errInvalidOrderInArrayConstructor,
+    errInvalidOrderInEnumX, errEnumXHasHoles, errExceptExpected, errInvalidTry,
+    errOptionExpected, errXisNoLabel, errNotAllCasesCovered,
+    errUnknownSubstitionVar, errComplexStmtRequiresInd, errXisNotCallable,
+    errNoPragmasAllowedForX, errNoGenericParamsAllowedForX,
+    errInvalidParamKindX, errDefaultArgumentInvalid, errNamedParamHasToBeIdent,
+    errNoReturnTypeForX, errConvNeedsOneArg, errInvalidPragmaX,
+    errXNotAllowedHere, errInvalidControlFlowX,
+    errXisNoType, errCircumNeedsPointer, errInvalidExpression,
+    errInvalidExpressionX, errEnumHasNoValueX, errNamedExprExpected,
+    errNamedExprNotAllowed, errXExpectsOneTypeParam,
+    errArrayExpectsTwoTypeParams, errInvalidVisibilityX, errInitHereNotAllowed,
+    errXCannotBeAssignedTo, errIteratorNotAllowed, errXNeedsReturnType,
+    errNoReturnTypeDeclared,
+    errInvalidCommandX, errXOnlyAtModuleScope,
+    errXNeedsParamObjectType,
+    errTemplateInstantiationTooNested, errInstantiationFrom,
+    errInvalidIndexValueForTuple, errCommandExpectsFilename,
+    errMainModuleMustBeSpecified,
+    errXExpected,
+    errTIsNotAConcreteType,
+    errInvalidSectionStart, errGridTableNotImplemented, errGeneralParseError,
+    errNewSectionExpected, errWhitespaceExpected, errXisNoValidIndexFile,
+    errCannotRenderX, errVarVarTypeNotAllowed, errInstantiateXExplicitly,
+    errOnlyACallOpCanBeDelegator, errUsingNoSymbol,
+    errMacroBodyDependsOnGenericTypes,
+    errDestructorNotGenericEnough,
+    errInlineIteratorsAsProcParams,
+    errXExpectsTwoArguments,
+    errXExpectsObjectTypes, errXcanNeverBeOfThisSubtype, errTooManyIterations,
+    errCannotInterpretNodeX, errFieldXNotFound, errInvalidConversionFromTypeX,
+    errAssertionFailed, errCannotGenerateCodeForX, errXRequiresOneArgument,
+    errUnhandledExceptionX, errCyclicTree, errXisNoMacroOrTemplate,
+    errXhasSideEffects, errIteratorExpected, errLetNeedsInit,
+    errThreadvarCannotInit, errWrongSymbolX, errIllegalCaptureX,
+    errXCannotBeClosure, errXMustBeCompileTime,
+    errCannotInferTypeOfTheLiteral,
+    errCannotInferReturnType,
+    errGenericLambdaNotAllowed,
+    errCompilerDoesntSupportTarget,
+    errUser,
+    warnCannotOpenFile,
+    warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit,
+    warnDeprecated, warnConfigDeprecated,
+    warnSmallLshouldNotBeUsed, warnUnknownMagic, warnRedefinitionOfLabel,
+    warnUnknownSubstitutionX, warnLanguageXNotSupported,
+    warnFieldXNotSupported, warnCommentXIgnored,
+    warnNilStatement, warnTypelessParam,
+    warnDifferentHeaps, warnWriteToForeignHeap, warnUnsafeCode,
+    warnEachIdentIsTuple, warnShadowIdent,
+    warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2,
+    warnUninit, warnGcMem, warnDestructor, warnLockLevel, warnResultShadowed,
+    warnUser,
+    hintSuccess, hintSuccessX,
+    hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
+    hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
+    hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
+    hintConditionAlwaysTrue, hintName, hintPattern,
+    hintUser
+
+const
+  fatalMin* = errUnknown
+  fatalMax* = errInternal
+  errMin* = errUnknown
+  errMax* = errUser
+  warnMin* = warnCannotOpenFile
+  warnMax* = pred(hintSuccess)
+  hintMin* = hintSuccess
+  hintMax* = high(TMsgKind)
+
+type
+  TNoteKind* = range[warnMin..hintMax] # "notes" are warnings or hints
+  TNoteKinds* = set[TNoteKind]
+
+var
+  gNotes*: TNoteKinds = {low(TNoteKind)..high(TNoteKind)} -
+                        {warnShadowIdent, warnUninit,
+                         warnProveField, warnProveIndex, warnGcUnsafe}
+
+
+#import compiler.msgs
+
+echo warnUninit in gNotes
diff --git a/tests/sets/tsets2.nim b/tests/sets/tsets2.nim
index 7f313e14f..9c73dbe03 100644
--- a/tests/sets/tsets2.nim
+++ b/tests/sets/tsets2.nim
@@ -28,7 +28,7 @@ block tableTest1:
   for x in 0..1:
     for y in 0..1:
       assert((x,y) in t)
-  #assert($t == 
+  #assert($t ==
   #  "{(x: 0, y: 0), (x: 0, y: 1), (x: 1, y: 0), (x: 1, y: 1)}")
 
 block setTest2:
@@ -37,16 +37,16 @@ block setTest2:
   t.incl("111")
   t.incl("123")
   t.excl("111")
-  
+
   t.incl("012")
   t.incl("123") # test duplicates
-  
+
   assert "123" in t
   assert "111" notin t # deleted
-  
+
   for key in items(data): t.incl(key)
   for key in items(data): assert key in t
-  
+
 
 block orderedSetTest1:
   var t = data.toOrderedSet
diff --git a/tests/showoff/thtml1.nim b/tests/showoff/thtml1.nim
index cd95c7971..c7a083c21 100644
--- a/tests/showoff/thtml1.nim
+++ b/tests/showoff/thtml1.nim
@@ -4,7 +4,7 @@ discard """
 
 template htmlTag(tag: expr) {.immediate.} =
   proc tag(): string = "<" & astToStr(tag) & ">"
-  
+
 htmlTag(br)
 htmlTag(html)
 
diff --git a/tests/stckovfl.nim b/tests/stckovfl.nim
index eeb499bed..cbc893d2e 100644
--- a/tests/stckovfl.nim
+++ b/tests/stckovfl.nim
@@ -1,10 +1,10 @@
 # To test stack overflow message
 
-proc over(a: int): int = 
+proc over(a: int): int =
   if a >= 10:
     assert false
     return
   result = over(a+1)+5
-  
+
 Echo($over(0))
 
diff --git a/tests/stdlib/nre/captures.nim b/tests/stdlib/nre/captures.nim
new file mode 100644
index 000000000..19c344a8d
--- /dev/null
+++ b/tests/stdlib/nre/captures.nim
@@ -0,0 +1,59 @@
+import unittest, optional_nonstrict
+include nre
+
+suite "captures":
+  test "map capture names to numbers":
+    check(getNameToNumberTable(re("(?<v1>1(?<v2>2(?<v3>3))(?'v4'4))()")) ==
+      { "v1" : 0, "v2" : 1, "v3" : 2, "v4" : 3 }.toTable())
+
+  test "capture bounds are correct":
+    let ex1 = re("([0-9])")
+    check("1 23".find(ex1).matchBounds == 0 .. 0)
+    check("1 23".find(ex1).captureBounds[0].get == 0 .. 0)
+    check("1 23".find(ex1, 1).matchBounds == 2 .. 2)
+    check("1 23".find(ex1, 3).matchBounds == 3 .. 3)
+
+    let ex2 = re("()()()()()()()()()()([0-9])")
+    check("824".find(ex2).captureBounds[0].get == 0 .. -1)
+    check("824".find(ex2).captureBounds[10].get == 0 .. 0)
+
+    let ex3 = re("([0-9]+)")
+    check("824".find(ex3).captureBounds[0].get == 0 .. 2)
+
+  test "named captures":
+    let ex1 = "foobar".find(re("(?<foo>foo)(?<bar>bar)"))
+    check(ex1.captures["foo"] == "foo")
+    check(ex1.captures["bar"] == "bar")
+
+    let ex2 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
+    check(ex2.captures["foo"] == "foo")
+    check(ex2.captures["bar"] == nil)
+
+  test "named capture bounds":
+    let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
+    check(ex1.captureBounds["foo"] == some(0..2))
+    check(ex1.captureBounds["bar"] == none(Slice[int]))
+
+  test "capture count":
+    let ex1 = re("(?<foo>foo)(?<bar>bar)?")
+    check(ex1.captureCount == 2)
+    check(ex1.captureNameId == {"foo" : 0, "bar" : 1}.toTable())
+
+  test "named capture table":
+    let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
+    check(ex1.captures.toTable == {"foo" : "foo", "bar" : nil}.toTable())
+    check(ex1.captureBounds.toTable == {"foo" : some(0..2), "bar" : none(Slice[int])}.toTable())
+    check(ex1.captures.toTable("") == {"foo" : "foo", "bar" : ""}.toTable())
+
+    let ex2 = "foobar".find(re("(?<foo>foo)(?<bar>bar)?"))
+    check(ex2.captures.toTable == {"foo" : "foo", "bar" : "bar"}.toTable())
+
+  test "capture sequence":
+    let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
+    check(ex1.captures.toSeq == @["foo", nil])
+    check(ex1.captureBounds.toSeq == @[some(0..2), none(Slice[int])])
+    check(ex1.captures.toSeq("") == @["foo", ""])
+
+    let ex2 = "foobar".find(re("(?<foo>foo)(?<bar>bar)?"))
+    check(ex2.captures.toSeq == @["foo", "bar"])
+
diff --git a/tests/stdlib/nre/escape.nim b/tests/stdlib/nre/escape.nim
new file mode 100644
index 000000000..db5e8a001
--- /dev/null
+++ b/tests/stdlib/nre/escape.nim
@@ -0,0 +1,7 @@
+import nre, unittest
+
+suite "escape strings":
+  test "escape strings":
+    check("123".escapeRe() == "123")
+    check("[]".escapeRe() == r"\[\]")
+    check("()".escapeRe() == r"\(\)")
diff --git a/tests/stdlib/nre/find.nim b/tests/stdlib/nre/find.nim
new file mode 100644
index 000000000..05bfb848a
--- /dev/null
+++ b/tests/stdlib/nre/find.nim
@@ -0,0 +1,25 @@
+import unittest, sequtils, nre, optional_nonstrict
+
+suite "find":
+  test "find text":
+    check("3213a".find(re"[a-z]").match == "a")
+    check(toSeq(findIter("1 2 3 4 5 6 7 8 ", re" ")).map(
+      proc (a: RegexMatch): string = a.match
+    ) == @[" ", " ", " ", " ", " ", " ", " ", " "])
+
+  test "find bounds":
+    check(toSeq(findIter("1 2 3 4 5 ", re" ")).map(
+      proc (a: RegexMatch): Slice[int] = a.matchBounds
+    ) == @[1..1, 3..3, 5..5, 7..7, 9..9])
+
+  test "overlapping find":
+    check("222".findAll(re"22") == @["22"])
+    check("2222".findAll(re"22") == @["22", "22"])
+
+  test "len 0 find":
+    check("".findAll(re"\ ") == newSeq[string]())
+    check("".findAll(re"") == @[""])
+    check("abc".findAll(re"") == @["", "", "", ""])
+    check("word word".findAll(re"\b") == @["", "", "", ""])
+    check("word\r\lword".findAll(re"(*ANYCRLF)(?m)$") == @["", ""])
+    check("слово слово".findAll(re"(*U)\b") == @["", "", "", ""])
diff --git a/tests/stdlib/nre/init.nim b/tests/stdlib/nre/init.nim
new file mode 100644
index 000000000..1a1470842
--- /dev/null
+++ b/tests/stdlib/nre/init.nim
@@ -0,0 +1,36 @@
+import unittest
+include nre
+
+suite "Test NRE initialization":
+  test "correct intialization":
+    check(re("[0-9]+") != nil)
+    check(re("(?i)[0-9]+") != nil)
+
+  test "options":
+    check(extractOptions("(*NEVER_UTF)") ==
+          ("", pcre.NEVER_UTF, true))
+    check(extractOptions("(*UTF8)(*ANCHORED)(*UCP)z") ==
+          ("(*UTF8)(*UCP)z", pcre.ANCHORED, true))
+    check(extractOptions("(*ANCHORED)(*UTF8)(*JAVASCRIPT_COMPAT)z") ==
+          ("(*UTF8)z", pcre.ANCHORED or pcre.JAVASCRIPT_COMPAT, true))
+
+    check(extractOptions("(*NO_STUDY)(") == ("(", 0, false))
+
+    check(extractOptions("(*LIMIT_MATCH=6)(*ANCHORED)z") ==
+          ("(*LIMIT_MATCH=6)z", pcre.ANCHORED, true))
+
+  test "incorrect options":
+    for s in ["CR", "(CR", "(*CR", "(*abc)", "(*abc)CR",
+              "(?i)",
+              "(*LIMIT_MATCH=5", "(*NO_AUTO_POSSESS=5)"]:
+      let ss = s & "(*NEVER_UTF)"
+      check(extractOptions(ss) == (ss, 0, true))
+
+  test "invalid regex":
+    expect(SyntaxError): discard re("[0-9")
+    try:
+      discard re("[0-9")
+    except SyntaxError:
+      let ex = SyntaxError(getCurrentException())
+      check(ex.pos == 4)
+      check(ex.pattern == "[0-9")
diff --git a/tests/stdlib/nre/match.nim b/tests/stdlib/nre/match.nim
new file mode 100644
index 000000000..38ee5214b
--- /dev/null
+++ b/tests/stdlib/nre/match.nim
@@ -0,0 +1,18 @@
+include nre, unittest, optional_nonstrict
+
+suite "match":
+  test "upper bound must be inclusive":
+    check("abc".match(re"abc", endpos = -1) == none(RegexMatch))
+    check("abc".match(re"abc", endpos = 1) == none(RegexMatch))
+    check("abc".match(re"abc", endpos = 2) != none(RegexMatch))
+
+  test "match examples":
+    check("abc".match(re"(\w)").captures[0] == "a")
+    check("abc".match(re"(?<letter>\w)").captures["letter"] == "a")
+    check("abc".match(re"(\w)\w").captures[-1] == "ab")
+    check("abc".match(re"(\w)").captureBounds[0].get == 0 .. 0)
+    check("abc".match(re"").captureBounds[-1].get == 0 .. -1)
+    check("abc".match(re"abc").captureBounds[-1].get == 0 .. 2)
+
+  test "match test cases":
+    check("123".match(re"").matchBounds == 0 .. -1)
diff --git a/tests/stdlib/nre/misc.nim b/tests/stdlib/nre/misc.nim
new file mode 100644
index 000000000..f4a88b639
--- /dev/null
+++ b/tests/stdlib/nre/misc.nim
@@ -0,0 +1,16 @@
+import unittest, nre, strutils, optional_nonstrict
+
+suite "Misc tests":
+  test "unicode":
+    check("".find(re"(*UTF8)").match == "")
+    check("перевірка".replace(re"(*U)\w", "") == "")
+
+  test "empty or non-empty match":
+    check("abc".findall(re"|.").join(":") == ":a::b::c:")
+    check("abc".findall(re".|").join(":") == "a:b:c:")
+
+    check("abc".replace(re"|.", "x") == "xxxxxxx")
+    check("abc".replace(re".|", "x") == "xxxx")
+
+    check("abc".split(re"|.").join(":") == ":::::")
+    check("abc".split(re".|").join(":") == ":::")
diff --git a/tests/stdlib/nre/optional_nonstrict.nim b/tests/stdlib/nre/optional_nonstrict.nim
new file mode 100644
index 000000000..d13f4fab7
--- /dev/null
+++ b/tests/stdlib/nre/optional_nonstrict.nim
@@ -0,0 +1,3 @@
+import options
+converter option2val*[T](val: Option[T]): T =
+  return val.get()
diff --git a/tests/stdlib/nre/replace.nim b/tests/stdlib/nre/replace.nim
new file mode 100644
index 000000000..516fd4328
--- /dev/null
+++ b/tests/stdlib/nre/replace.nim
@@ -0,0 +1,20 @@
+include nre
+import unittest
+
+suite "replace":
+  test "replace with 0-length strings":
+    check("".replace(re"1", proc (v: RegexMatch): string = "1") == "")
+    check(" ".replace(re"", proc (v: RegexMatch): string = "1") == "1 1")
+    check("".replace(re"", proc (v: RegexMatch): string = "1") == "1")
+
+  test "regular replace":
+    check("123".replace(re"\d", "foo") == "foofoofoo")
+    check("123".replace(re"(\d)", "$1$1") == "112233")
+    check("123".replace(re"(\d)(\d)", "$1$2") == "123")
+    check("123".replace(re"(\d)(\d)", "$#$#") == "123")
+    check("123".replace(re"(?<foo>\d)(\d)", "$foo$#$#") == "1123")
+    check("123".replace(re"(?<foo>\d)(\d)", "${foo}$#$#") == "1123")
+
+  test "replacing missing captures should throw instead of segfaulting":
+    expect ValueError: discard "ab".replace(re"(a)|(b)", "$1$2")
+    expect ValueError: discard "b".replace(re"(a)?(b)", "$1$2")
diff --git a/tests/stdlib/nre/split.nim b/tests/stdlib/nre/split.nim
new file mode 100644
index 000000000..9d57ea7d8
--- /dev/null
+++ b/tests/stdlib/nre/split.nim
@@ -0,0 +1,53 @@
+import unittest, strutils
+include nre
+
+suite "string splitting":
+  test "splitting strings":
+    check("1 2 3 4 5 6 ".split(re" ") == @["1", "2", "3", "4", "5", "6", ""])
+    check("1  2  ".split(re(" ")) == @["1", "", "2", "", ""])
+    check("1 2".split(re(" ")) == @["1", "2"])
+    check("foo".split(re("foo")) == @["", ""])
+    check("".split(re"foo") == @[""])
+    check("9".split(re"\son\s") == @["9"])
+
+  test "captured patterns":
+    check("12".split(re"(\d)") == @["", "1", "", "2", ""])
+
+  test "maxsplit":
+    check("123".split(re"", maxsplit = 2) == @["1", "23"])
+    check("123".split(re"", maxsplit = 1) == @["123"])
+    check("123".split(re"", maxsplit = -1) == @["1", "2", "3"])
+
+  test "split with 0-length match":
+    check("12345".split(re("")) == @["1", "2", "3", "4", "5"])
+    check("".split(re"") == newSeq[string]())
+    check("word word".split(re"\b") == @["word", " ", "word"])
+    check("word\r\lword".split(re"(*ANYCRLF)(?m)$") == @["word", "\r\lword"])
+    check("слово слово".split(re"(*U)(\b)") == @["", "слово", "", " ", "", "слово", ""])
+
+  test "perl split tests":
+    check("forty-two"                    .split(re"")      .join(",") == "f,o,r,t,y,-,t,w,o")
+    check("forty-two"                    .split(re"", 3)   .join(",") == "f,o,rty-two")
+    check("split this string"            .split(re" ")     .join(",") == "split,this,string")
+    check("split this string"            .split(re" ", 2)  .join(",") == "split,this string")
+    check("try$this$string"              .split(re"\$")    .join(",") == "try,this,string")
+    check("try$this$string"              .split(re"\$", 2) .join(",") == "try,this$string")
+    check("comma, separated, values"     .split(re", ")    .join("|") == "comma|separated|values")
+    check("comma, separated, values"     .split(re", ", 2) .join("|") == "comma|separated, values")
+    check("Perl6::Camelia::Test"         .split(re"::")    .join(",") == "Perl6,Camelia,Test")
+    check("Perl6::Camelia::Test"         .split(re"::", 2) .join(",") == "Perl6,Camelia::Test")
+    check("split,me,please"              .split(re",")     .join("|") == "split|me|please")
+    check("split,me,please"              .split(re",", 2)  .join("|") == "split|me,please")
+    check("Hello World    Goodbye   Mars".split(re"\s+")   .join(",") == "Hello,World,Goodbye,Mars")
+    check("Hello World    Goodbye   Mars".split(re"\s+", 3).join(",") == "Hello,World,Goodbye   Mars")
+    check("Hello test"                   .split(re"(\s+)") .join(",") == "Hello, ,test")
+    check("this will be split"           .split(re" ")     .join(",") == "this,will,be,split")
+    check("this will be split"           .split(re" ", 3)  .join(",") == "this,will,be split")
+    check("a.b"                          .split(re"\.")    .join(",") == "a,b")
+    check(""                             .split(re"")      .len       == 0)
+    check(":"                            .split(re"")      .len       == 1)
+
+  test "start position":
+    check("abc".split(re"", start = 1) == @["b", "c"])
+    check("abc".split(re"", start = 2) == @["c"])
+    check("abc".split(re"", start = 3) == newSeq[string]())
diff --git a/tests/stdlib/talgorithm.nim b/tests/stdlib/talgorithm.nim
index 3ca425fbc..f200e54c5 100644
--- a/tests/stdlib/talgorithm.nim
+++ b/tests/stdlib/talgorithm.nim
@@ -8,4 +8,4 @@ doAssert product(@[@[1,2], @[3,4], @[5,6]]) == @[@[2,4,6],@[1,4,6],@[2,3,6],@[1,
 doAssert product(@[@[1,2], @[]]) == newSeq[seq[int]](), "two elements, but one empty"
 doAssert lowerBound([1,2,4], 3, system.cmp[int]) == 2
 doAssert lowerBound([1,2,2,3], 4, system.cmp[int]) == 4
-doAssert lowerBound([1,2,3,10], 11) == 4
\ No newline at end of file
+doAssert lowerBound([1,2,3,10], 11) == 4
diff --git a/tests/stdlib/tcritbits.nim b/tests/stdlib/tcritbits.nim
index fb447b80b..8280ec881 100644
--- a/tests/stdlib/tcritbits.nim
+++ b/tests/stdlib/tcritbits.nim
@@ -22,7 +22,7 @@ when isMainModule:
 
   for w in r.items:
     echo w
-    
+
   for w in r.itemsWithPrefix("de"):
     echo w
 
diff --git a/tests/stdlib/tdialogs.nim b/tests/stdlib/tdialogs.nim
deleted file mode 100644
index f0203d319..000000000
--- a/tests/stdlib/tdialogs.nim
+++ /dev/null
@@ -1,17 +0,0 @@
-# Test the dialogs module
-
-import dialogs, gtk2
-
-gtk2.nimrod_init()
-
-var x = chooseFilesToOpen(nil)
-for a in items(x):
-  writeln(stdout, a)
-
-info(nil, "start with an info box")
-warning(nil, "now a warning ...")
-error(nil, "... and an error!")
-
-writeln(stdout, chooseFileToOpen(nil))
-writeln(stdout, chooseFileToSave(nil))
-writeln(stdout, chooseDir(nil))
diff --git a/tests/stdlib/tformat.nim b/tests/stdlib/tformat.nim
index 92c0c16f5..160ab0fd5 100644
--- a/tests/stdlib/tformat.nim
+++ b/tests/stdlib/tformat.nim
@@ -2,11 +2,11 @@ discard """
   file: "tformat.nim"
   output: "Hi Andreas! How do you feel, Rumpf?"
 """
-# Tests the new format proc (including the & and &= operators)

-

-import strutils

-

-echo("Hi $1! How do you feel, $2?\n" % ["Andreas", "Rumpf"])

-#OUT Hi Andreas! How do you feel, Rumpf?

+# Tests the new format proc (including the & and &= operators)
+
+import strutils
+
+echo("Hi $1! How do you feel, $2?\n" % ["Andreas", "Rumpf"])
+#OUT Hi Andreas! How do you feel, Rumpf?
 
 
diff --git a/tests/stdlib/thtmlparser2813.nim b/tests/stdlib/thtmlparser2813.nim
new file mode 100644
index 000000000..4b04bc3f0
--- /dev/null
+++ b/tests/stdlib/thtmlparser2813.nim
@@ -0,0 +1,45 @@
+discard """
+  output: "@[]"
+"""
+import htmlparser
+import xmltree
+from streams import newStringStream
+
+const
+  html = """
+  <html>
+    <head>
+      <title>Test</title>
+    </head>
+    <body>
+      <table>
+        <thead>
+          <tr><td>A</td></tr>
+          <tr><td>B</td></tr>
+        </thead>
+        <tbody>
+          <tr><td></td>A<td></td></tr>
+          <tr><td></td>B<td></td></tr>
+          <tr><td></td>C<td></td></tr>
+        </tbody>
+        <tfoot>
+          <tr><td>A</td></tr>
+        </tfoot>
+      </table>
+    </body>
+  </html>
+  """
+var errors: seq[string] = @[]
+
+let tree = parseHtml(newStringStream(html), "test.html", errors)
+
+echo errors # Errors: </thead> expected,...
+
+var len = tree.findAll("tr").len # len = 6
+
+var rows: seq[XmlNode] = @[]
+for n in tree.findAll("table"):
+  n.findAll("tr", rows)  # len = 2
+  break
+
+assert tree.findAll("tr").len == rows.len
diff --git a/tests/stdlib/tio.nim b/tests/stdlib/tio.nim
index 5ae119f77..ebf2d70f3 100644
--- a/tests/stdlib/tio.nim
+++ b/tests/stdlib/tio.nim
@@ -1,7 +1,7 @@
-# test the file-IO

-

-proc main() =

-  for line in lines("thello.nim"):

-    writeln(stdout, line)

-

-main()

+# test the file-IO
+
+proc main() =
+  for line in lines("thello.nim"):
+    writeLine(stdout, line)
+
+main()
diff --git a/tests/stdlib/tlists.nim b/tests/stdlib/tlists.nim
index 7d5379945..4caa05c90 100644
--- a/tests/stdlib/tlists.nim
+++ b/tests/stdlib/tlists.nim
@@ -11,14 +11,14 @@ block SinglyLinkedListTest1:
   var L: TSinglyLinkedList[int]
   for d in items(data): L.prepend(d)
   assert($L == "[6, 5, 4, 3, 2, 1]")
-  
+
   assert(4 in L)
 
 block SinglyLinkedListTest2:
   var L: TSinglyLinkedList[string]
   for d in items(data): L.prepend($d)
   assert($L == "[6, 5, 4, 3, 2, 1]")
-  
+
   assert("4" in L)
 
 
@@ -28,7 +28,7 @@ block DoublyLinkedListTest1:
   for d in items(data): L.append(d)
   L.remove(L.find(1))
   assert($L == "[6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]")
-  
+
   assert(4 in L)
 
 block SinglyLinkedRingTest1:
@@ -39,7 +39,7 @@ block SinglyLinkedRingTest1:
 
   assert($L == "[4, 4]")
   assert(4 in L)
-  
+
 
 block DoublyLinkedRingTest1:
   var L: TDoublyLinkedRing[int]
@@ -49,7 +49,7 @@ block DoublyLinkedRingTest1:
 
   assert($L == "[4, 4]")
   assert(4 in L)
-  
+
   L.append(3)
   L.append(5)
   assert($L == "[4, 4, 3, 5]")
@@ -60,7 +60,7 @@ block DoublyLinkedRingTest1:
   L.remove(L.find(4))
   assert($L == "[]")
   assert(4 notin L)
-  
+
 
 echo "true"
 
diff --git a/tests/stdlib/tmarshal.nim b/tests/stdlib/tmarshal.nim
index a778d2f77..4c0c10360 100644
--- a/tests/stdlib/tmarshal.nim
+++ b/tests/stdlib/tmarshal.nim
@@ -25,7 +25,7 @@ type
       help: string
     else:
       discard
-      
+
   PNode = ref TNode
   TNode = object
     next, prev: PNode
diff --git a/tests/stdlib/tmath.nim b/tests/stdlib/tmath.nim
index fc9486093..1ac9c8092 100644
--- a/tests/stdlib/tmath.nim
+++ b/tests/stdlib/tmath.nim
@@ -23,13 +23,13 @@ suite "random int":
       rand = random(100..1000)
       check rand < 1000
       check rand >= 100
-  test "randomize() again gives new numbers":      
+  test "randomize() again gives new numbers":
     randomize()
     var rand1 = random(1000000)
     randomize()
     var rand2 = random(1000000)
     check rand1 != rand2
-    
+
 
 suite "random float":
   test "there might be some randomness":
@@ -52,7 +52,7 @@ suite "random float":
       rand = random(100.0..1000.0)
       check rand < 1000.0
       check rand >= 100.0
-  test "randomize() again gives new numbers":      
+  test "randomize() again gives new numbers":
     randomize()
     var rand1:float = random(1000000.0)
     randomize()
diff --git a/tests/stdlib/tmath2.nim b/tests/stdlib/tmath2.nim
index 88d96c80a..84a49efa9 100644
--- a/tests/stdlib/tmath2.nim
+++ b/tests/stdlib/tmath2.nim
@@ -1,85 +1,85 @@
-# tests for the interpreter

-

-proc loops(a: var int) =

-  discard

-  #var

-  #  b: int

-  #b = glob

-  #while b != 0:

-  #  b = b + 1

-  #a = b

-

-proc mymax(a, b: int): int =

-  #loops(result)

-  result = a

-  if b > a: result = b

-

-proc test(a, b: int) =

-  var

-    x, y: int

-  x = 0

-  y = 7

-  if x == a + b * 3 - 7 or

-      x == 8 or

-      x == y and y > -56 and y < 699:

-    y = 0

-  elif y == 78 and x == 0:

-    y = 1

-  elif y == 0 and x == 0:

-    y = 2

-  else:

-    y = 3

-

-type

-  TTokType = enum

-    tkNil, tkType, tkConst, tkVar, tkSymbol, tkIf,

-    tkWhile, tkFor, tkLoop, tkCase, tkLabel, tkGoto

-

-proc testCase(t: TTokType): int =

-  case t

-  of tkNil, tkType, tkConst: result = 0

-  of tkVar: result = 1

-  of tkSymbol: result = 2

-  of tkIf..tkFor: result = 3

-  of tkLoop: result = 56

-  else: result = -1

-  test(0, 9) # test the call

-

-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

-

-

-var

-  glob: int

-  a: array [0..5, int]

-

-proc main() =

-  #glob = 0

-  #loops( glob )

-  var

-    res: int

-    s: string

-  #write(stdout, mymax(23, 45))

-  write(stdout, "Hallo! Wie heisst du? ")

-  s = readLine(stdin)

-  # test the case statement

-  case s

-  of "Andreas": write(stdout, "Du bist mein Meister!\n")

-  of "Rumpf": write(stdout, "Du bist in der Familie meines Meisters!\n")

-  else: write(stdout, "ich kenne dich nicht!\n")

-  write(stdout, "Du heisst " & s & "\n")

-

-main()

+# tests for the interpreter
+
+proc loops(a: var int) =
+  discard
+  #var
+  #  b: int
+  #b = glob
+  #while b != 0:
+  #  b = b + 1
+  #a = b
+
+proc mymax(a, b: int): int =
+  #loops(result)
+  result = a
+  if b > a: result = b
+
+proc test(a, b: int) =
+  var
+    x, y: int
+  x = 0
+  y = 7
+  if x == a + b * 3 - 7 or
+      x == 8 or
+      x == y and y > -56 and y < 699:
+    y = 0
+  elif y == 78 and x == 0:
+    y = 1
+  elif y == 0 and x == 0:
+    y = 2
+  else:
+    y = 3
+
+type
+  TTokType = enum
+    tkNil, tkType, tkConst, tkVar, tkSymbol, tkIf,
+    tkWhile, tkFor, tkLoop, tkCase, tkLabel, tkGoto
+
+proc testCase(t: TTokType): int =
+  case t
+  of tkNil, tkType, tkConst: result = 0
+  of tkVar: result = 1
+  of tkSymbol: result = 2
+  of tkIf..tkFor: result = 3
+  of tkLoop: result = 56
+  else: result = -1
+  test(0, 9) # test the call
+
+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
+
+
+var
+  glob: int
+  a: array [0..5, int]
+
+proc main() =
+  #glob = 0
+  #loops( glob )
+  var
+    res: int
+    s: string
+  #write(stdout, mymax(23, 45))
+  write(stdout, "Hallo! Wie heisst du? ")
+  s = readLine(stdin)
+  # test the case statement
+  case s
+  of "Andreas": write(stdout, "Du bist mein Meister!\n")
+  of "Rumpf": write(stdout, "Du bist in der Familie meines Meisters!\n")
+  else: write(stdout, "ich kenne dich nicht!\n")
+  write(stdout, "Du heisst " & s & "\n")
+
+main()
diff --git a/tests/stdlib/tmemfiles1.nim b/tests/stdlib/tmemfiles1.nim
new file mode 100644
index 000000000..8b66dfcc1
--- /dev/null
+++ b/tests/stdlib/tmemfiles1.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tmemfiles1.nim"
+"""
+import memfiles, os
+var
+  mm: MemFile
+  fn = "test.mmap"
+# Create a new file
+mm = memfiles.open(fn, mode = fmReadWrite, newFileSize = 20)
+mm.close()
+mm.close()
+if fileExists(fn): removeFile(fn)
diff --git a/tests/stdlib/tmemfiles2.nim b/tests/stdlib/tmemfiles2.nim
new file mode 100644
index 000000000..026443e93
--- /dev/null
+++ b/tests/stdlib/tmemfiles2.nim
@@ -0,0 +1,39 @@
+discard """
+  file: "tmemfiles2.nim"
+  disabled: true
+  output: '''Full read size: 20
+Half read size: 10 Data: Hello'''
+"""
+# doesn't work on windows. fmReadWrite doesn't create a file.
+import memfiles, os
+var
+  mm, mm_full, mm_half: MemFile
+  fn = "test.mmap"
+  p: pointer
+
+if fileExists(fn): removeFile(fn)
+
+# Create a new file, data all zeros
+mm = memfiles.open(fn, mode = fmReadWrite, newFileSize = 20)
+mm.close()
+
+# read, change
+mm_full = memfiles.open(fn, mode = fmWrite, mappedSize = -1)
+echo "Full read size: ",mm_full.size
+p = mm_full.mapMem(fmReadWrite, 20, 0)
+var p2 = cast[cstring](p)
+p2[0] = 'H'
+p2[1] = 'e'
+p2[2] = 'l'
+p2[3] = 'l'
+p2[4] = 'o'
+p2[5] = '\0'
+mm_full.unmapMem(p, 20)
+mm_full.close()
+
+# read half, and verify data change
+mm_half = memfiles.open(fn, mode = fmRead, mappedSize = 10)
+echo "Half read size: ",mm_half.size, " Data: ", cast[cstring](mm_half.mem)
+mm_half.close()
+
+if fileExists(fn): removeFile(fn)
diff --git a/tests/stdlib/tmemlines.nim b/tests/stdlib/tmemlines.nim
new file mode 100644
index 000000000..19821ea26
--- /dev/null
+++ b/tests/stdlib/tmemlines.nim
@@ -0,0 +1,5 @@
+import memfiles
+var inp = memfiles.open("readme.txt")
+for line in lines(inp):
+  echo("#" & line & "#")
+close(inp)
diff --git a/tests/stdlib/tmemlinesBuf.nim b/tests/stdlib/tmemlinesBuf.nim
new file mode 100644
index 000000000..21edc2322
--- /dev/null
+++ b/tests/stdlib/tmemlinesBuf.nim
@@ -0,0 +1,6 @@
+import memfiles
+var inp = memfiles.open("readme.txt")
+var buffer: TaintedString = ""
+for line in lines(inp, buffer):
+  echo("#" & line & "#")
+close(inp)
diff --git a/tests/stdlib/tmemslices.nim b/tests/stdlib/tmemslices.nim
new file mode 100644
index 000000000..951807cc4
--- /dev/null
+++ b/tests/stdlib/tmemslices.nim
@@ -0,0 +1,6 @@
+import memfiles
+var inp = memfiles.open("readme.txt")
+for mem in memSlices(inp):
+  if mem.size > 3:
+    echo("#" & $mem & "#")
+close(inp)
diff --git a/tests/stdlib/tmitems.nim b/tests/stdlib/tmitems.nim
index f2307aeb3..27ff344e5 100644
--- a/tests/stdlib/tmitems.nim
+++ b/tests/stdlib/tmitems.nim
@@ -11,8 +11,8 @@ fpqeew
 [11, 12, 13]
 [11, 12, 13]
 [11, 12, 13]
-{"key1": 11, "key2": 12, "key3": 13}
-[11, 12, 13]
+{"key1":11,"key2":12,"key3":13}
+[11,12,13]
 <Students>
   <Student Name="Aprilfoo" />
   <Student Name="bar" />
diff --git a/tests/stdlib/tnre.nim b/tests/stdlib/tnre.nim
new file mode 100644
index 000000000..85792b81e
--- /dev/null
+++ b/tests/stdlib/tnre.nim
@@ -0,0 +1,9 @@
+import nre
+import nre.init
+import nre.captures
+import nre.find
+import nre.split
+import nre.match
+import nre.replace
+import nre.escape
+import nre.misc
diff --git a/tests/stdlib/tos.nim b/tests/stdlib/tos.nim
index ebe577b00..cae388792 100644
--- a/tests/stdlib/tos.nim
+++ b/tests/stdlib/tos.nim
@@ -2,9 +2,9 @@
 
 import os
 
-proc walkDirTree(root: string) = 
+proc walkDirTree(root: string) =
   for k, f in walkDir(root):
-    case k 
+    case k
     of pcFile, pcLinkToFile: echo(f)
     of pcDir: walkDirTree(f)
     of pcLinkToDir: discard
diff --git a/tests/stdlib/tosprocterminate.nim b/tests/stdlib/tosprocterminate.nim
index fd044414c..7fc6c5d85 100644
--- a/tests/stdlib/tosprocterminate.nim
+++ b/tests/stdlib/tosprocterminate.nim
@@ -14,7 +14,7 @@ var TimeToWait = 5000
 while process.running() and TimeToWait > 0:
   sleep(100)
   TimeToWait = TimeToWait - 100
-  
+
 if process.running():
   echo("FAILED")
 else:
diff --git a/tests/stdlib/tparscfg.nim b/tests/stdlib/tparscfg.nim
index 618ecadd6..4c11ccf61 100644
--- a/tests/stdlib/tparscfg.nim
+++ b/tests/stdlib/tparscfg.nim
@@ -1,7 +1,7 @@
 
 import
   os, parsecfg, strutils, streams
-  
+
 var f = newFileStream(paramStr(1), fmRead)
 if f != nil:
   var p: TCfgParser
@@ -9,7 +9,7 @@ if f != nil:
   while true:
     var e = next(p)
     case e.kind
-    of cfgEof: 
+    of cfgEof:
       echo("EOF!")
       break
     of cfgSectionStart:   ## a ``[section]`` has been parsed
diff --git a/tests/stdlib/tparsopt.nim b/tests/stdlib/tparsopt.nim
index 2b2da7e51..848fba2da 100644
--- a/tests/stdlib/tparsopt.nim
+++ b/tests/stdlib/tparsopt.nim
@@ -3,24 +3,24 @@
 import
   parseopt
 
-proc writeHelp() = 
-  writeln(stdout, "Usage: tparsopt [options] filename [options]")
+proc writeHelp() =
+  writeLine(stdout, "Usage: tparsopt [options] filename [options]")
+
+proc writeVersion() =
+  writeLine(stdout, "Version: 1.0.0")
 
-proc writeVersion() = 
-  writeln(stdout, "Version: 1.0.0")
-  
 var
   filename = ""
 for kind, key, val in getopt():
   case kind
-  of cmdArgument: 
+  of cmdArgument:
     filename = key
   of cmdLongOption, cmdShortOption:
     case key
     of "help", "h": writeHelp()
     of "version", "v": writeVersion()
-    else: 
-      writeln(stdout, "Unknown command line option: ", key, ": ", val)
+    else:
+      writeLine(stdout, "Unknown command line option: ", key, ": ", val)
   of cmdEnd: assert(false) # cannot happen
 if filename == "":
   # no filename has been given, so we show the help:
diff --git a/tests/stdlib/tpegs.nim b/tests/stdlib/tpegs.nim
index cceea1693..3fe964d82 100644
--- a/tests/stdlib/tpegs.nim
+++ b/tests/stdlib/tpegs.nim
@@ -24,7 +24,7 @@ when useUnicode:
 const
   InlineThreshold = 5  ## number of leaves; -1 to disable inlining
   MaxSubpatterns* = 10 ## defines the maximum number of subpatterns that
-                       ## can be captured. More subpatterns cannot be captured! 
+                       ## can be captured. More subpatterns cannot be captured!
 
 type
   TPegKind = enum
@@ -80,12 +80,12 @@ type
     of pkBackRef..pkBackRefIgnoreStyle: index: range[0..MaxSubpatterns]
     else: sons: seq[TNode]
   PNonTerminal* = ref TNonTerminal
-  
+
   TPeg* = TNode ## type that represents a PEG
 
 proc term*(t: string): TPeg {.rtl, extern: "npegs$1Str".} =
   ## constructs a PEG from a terminal string
-  if t.len != 1:  
+  if t.len != 1:
     result.kind = pkTerminal
     result.term = t
   else:
@@ -109,7 +109,7 @@ proc term*(t: char): TPeg {.rtl, extern: "npegs$1Char".} =
   assert t != '\0'
   result.kind = pkChar
   result.ch = t
-  
+
 proc charSet*(s: set[char]): TPeg {.rtl, extern: "npegs$1".} =
   ## constructs a PEG from a character set `s`
   assert '\0' notin s
@@ -120,31 +120,31 @@ proc charSet*(s: set[char]): TPeg {.rtl, extern: "npegs$1".} =
 proc len(a: TPeg): int {.inline.} = return a.sons.len
 proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s)
 
-proc copyPeg(a: TPeg): TPeg = 
+proc copyPeg(a: TPeg): TPeg =
   result.kind = a.kind
   case a.kind
   of pkEmpty..pkWhitespace: discard
-  of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: 
+  of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle:
     result.term = a.term
-  of pkChar, pkGreedyRepChar: 
+  of pkChar, pkGreedyRepChar:
     result.ch = a.ch
-  of pkCharChoice, pkGreedyRepSet: 
+  of pkCharChoice, pkGreedyRepSet:
     new(result.charChoice)
     result.charChoice[] = a.charChoice[]
   of pkNonTerminal: result.nt = a.nt
-  of pkBackRef..pkBackRefIgnoreStyle: 
+  of pkBackRef..pkBackRefIgnoreStyle:
     result.index = a.index
-  else: 
+  else:
     result.sons = a.sons
 
 proc addChoice(dest: var TPeg, elem: TPeg) =
   var L = dest.len-1
-  if L >= 0 and dest.sons[L].kind == pkCharChoice: 
+  if L >= 0 and dest.sons[L].kind == pkCharChoice:
     # caution! Do not introduce false aliasing here!
     case elem.kind
     of pkCharChoice:
       dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[])
-    of pkChar: 
+    of pkChar:
       dest.sons[L] = charSet(dest.sons[L].charChoice[] + {elem.ch})
     else: add(dest, elem)
   else: add(dest, elem)
@@ -168,12 +168,12 @@ proc `/`*(a: varargs[TPeg]): TPeg {.
 
 proc addSequence(dest: var TPeg, elem: TPeg) =
   var L = dest.len-1
-  if L >= 0 and dest.sons[L].kind == pkTerminal: 
+  if L >= 0 and dest.sons[L].kind == pkTerminal:
     # caution! Do not introduce false aliasing here!
     case elem.kind
-    of pkTerminal: 
+    of pkTerminal:
       dest.sons[L] = term(dest.sons[L].term & elem.term)
-    of pkChar: 
+    of pkChar:
       dest.sons[L] = term(dest.sons[L].term & elem.ch)
     else: add(dest, elem)
   else: add(dest, elem)
@@ -182,7 +182,7 @@ proc sequence*(a: varargs[TPeg]): TPeg {.
   rtl, extern: "npegs$1".} =
   ## constructs a sequence with all the PEGs from `a`
   multipleOp(pkSequence, addSequence)
- 
+
 proc `?`*(a: TPeg): TPeg {.rtl, extern: "npegsOptional".} =
   ## constructs an optional for the PEG `a`
   if a.kind in {pkOption, pkGreedyRep, pkGreedyAny, pkGreedyRepChar,
@@ -217,12 +217,12 @@ proc `!*`*(a: TPeg): TPeg {.rtl, extern: "npegsSearch".} =
   result.kind = pkSearch
   result.sons = @[a]
 
-proc `!*\`*(a: TPeg): TPeg {.rtl, 
+proc `!*\`*(a: TPeg): TPeg {.rtl,
                              extern: "npgegsCapturedSearch".} =
   ## constructs a "captured search" for the PEG `a`
   result.kind = pkCapturedSearch
   result.sons = @[a]
-  
+
 when false:
   proc contains(a: TPeg, k: TPegKind): bool =
     if a.kind == k: return true
@@ -238,7 +238,7 @@ when false:
 proc `+`*(a: TPeg): TPeg {.rtl, extern: "npegsGreedyPosRep".} =
   ## constructs a "greedy positive repetition" with the PEG `a`
   return sequence(a, *a)
-  
+
 proc `&`*(a: TPeg): TPeg {.rtl, extern: "npegsAndPredicate".} =
   ## constructs an "and predicate" with the PEG `a`
   result.kind = pkAndPredicate
@@ -261,33 +261,33 @@ 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 
+  result.kind = pkLower
 
-proc UnicodeUpper*: TPeg {.inline.} = 
+proc UnicodeUpper*: TPeg {.inline.} =
   ## constructs the PEG ``\upper`` which matches any Unicode lowercase letter.
-  result.kind = pkUpper 
-  
-proc UnicodeTitle*: TPeg {.inline.} = 
+  result.kind = pkUpper
+
+proc UnicodeTitle*: TPeg {.inline.} =
   ## constructs the PEG ``\title`` which matches any Unicode title letter.
   result.kind = pkTitle
 
-proc UnicodeWhitespace*: TPeg {.inline.} = 
-  ## constructs the PEG ``\white`` which matches any Unicode 
+proc UnicodeWhitespace*: TPeg {.inline.} =
+  ## constructs the PEG ``\white`` which matches any Unicode
   ## whitespace character.
   result.kind = pkWhitespace
 
-proc startAnchor*: TPeg {.inline.} = 
-  ## constructs the PEG ``^`` which matches the start of the input.  
+proc startAnchor*: TPeg {.inline.} =
+  ## constructs the PEG ``^`` which matches the start of the input.
   result.kind = pkStartAnchor
 
-proc endAnchor*: TPeg {.inline.} = 
-  ## constructs the PEG ``$`` which matches the end of the input.  
+proc endAnchor*: TPeg {.inline.} =
+  ## constructs the PEG ``$`` which matches the end of the input.
   result = !any()
 
 proc capture*(a: TPeg): TPeg {.rtl, extern: "npegsCapture".} =
@@ -296,21 +296,21 @@ proc capture*(a: TPeg): TPeg {.rtl, extern: "npegsCapture".} =
   result.sons = @[a]
 
 proc backref*(index: range[1..MaxSubPatterns]): TPeg {.
-  rtl, extern: "npegs$1".} = 
+  rtl, extern: "npegs$1".} =
   ## constructs a back reference of the given `index`. `index` starts counting
   ## from 1.
   result.kind = pkBackRef
   result.index = index-1
 
 proc backrefIgnoreCase*(index: range[1..MaxSubPatterns]): TPeg {.
-  rtl, extern: "npegs$1".} = 
+  rtl, extern: "npegs$1".} =
   ## constructs a back reference of the given `index`. `index` starts counting
   ## from 1. Ignores case for matching.
   result.kind = pkBackRefIgnoreCase
   result.index = index-1
 
 proc backrefIgnoreStyle*(index: range[1..MaxSubPatterns]): TPeg {.
-  rtl, extern: "npegs$1".}= 
+  rtl, extern: "npegs$1".}=
   ## constructs a back reference of the given `index`. `index` starts counting
   ## from 1. Ignores style for matching.
   result.kind = pkBackRefIgnoreStyle
@@ -320,7 +320,7 @@ proc spaceCost(n: TPeg): int =
   case n.kind
   of pkEmpty: discard
   of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle, pkChar,
-     pkGreedyRepChar, pkCharChoice, pkGreedyRepSet, 
+     pkGreedyRepChar, pkCharChoice, pkGreedyRepSet,
      pkAny..pkWhitespace, pkGreedyAny:
     result = 1
   of pkNonTerminal:
@@ -332,7 +332,7 @@ proc spaceCost(n: TPeg): int =
       if result >= InlineThreshold: break
 
 proc nonterminal*(n: PNonTerminal): TPeg {.
-  rtl, extern: "npegs$1".} = 
+  rtl, extern: "npegs$1".} =
   ## constructs a PEG that consists of the nonterminal symbol
   assert n != nil
   if ntDeclared in n.flags and spaceCost(n.rule) < InlineThreshold:
@@ -353,7 +353,7 @@ proc newNonTerminal*(name: string, line, column: int): PNonTerminal {.
 template letters*: expr =
   ## expands to ``charset({'A'..'Z', 'a'..'z'})``
   charset({'A'..'Z', 'a'..'z'})
-  
+
 template digits*: expr =
   ## expands to ``charset({'0'..'9'})``
   charset({'0'..'9'})
@@ -361,11 +361,11 @@ template digits*: expr =
 template whitespace*: expr =
   ## expands to ``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', '_'})
-  
+
 template identStartChars*: expr =
   ## expands to ``charset({'A'..'Z', 'a'..'z', '_'})``
   charset({'a'..'z', 'A'..'Z', '_'})
@@ -374,14 +374,14 @@ 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', '_'}))
-  
+
 template natural*: expr =
   ## same as ``\d+``
   +digits
 
 # ------------------------- debugging -----------------------------------------
 
-proc esc(c: char, reserved = {'\0'..'\255'}): string = 
+proc esc(c: char, reserved = {'\0'..'\255'}): string =
   case c
   of '\b': result = "\\b"
   of '\t': result = "\\t"
@@ -396,38 +396,38 @@ proc esc(c: char, reserved = {'\0'..'\255'}): string =
   elif c < ' ' or c >= '\128': result = '\\' & $ord(c)
   elif c in reserved: result = '\\' & c
   else: result = $c
-  
+
 proc singleQuoteEsc(c: char): string = return "'" & esc(c, {'\''}) & "'"
 
-proc singleQuoteEsc(str: string): string = 
+proc singleQuoteEsc(str: string): string =
   result = "'"
   for c in items(str): add result, esc(c, {'\''})
   add result, '\''
-  
-proc charSetEscAux(cc: set[char]): string = 
+
+proc charSetEscAux(cc: set[char]): string =
   const reserved = {'^', '-', ']'}
   result = ""
   var c1 = 0
-  while c1 <= 0xff: 
-    if chr(c1) in cc: 
+  while c1 <= 0xff:
+    if chr(c1) in cc:
       var c2 = c1
       while c2 < 0xff and chr(succ(c2)) in cc: inc(c2)
-      if c1 == c2: 
+      if c1 == c2:
         add result, esc(chr(c1), reserved)
-      elif c2 == succ(c1): 
+      elif c2 == succ(c1):
         add result, esc(chr(c1), reserved) & esc(chr(c2), reserved)
-      else: 
+      else:
         add result, esc(chr(c1), reserved) & '-' & esc(chr(c2), reserved)
       c1 = c2
     inc(c1)
-  
+
 proc charSetEsc(cc: set[char]): string =
-  if card(cc) >= 128+64: 
+  if card(cc) >= 128+64:
     result = "[^" & charSetEscAux({'\1'..'\xFF'} - cc) & ']'
-  else: 
+  else:
     result = '[' & charSetEscAux(cc) & ']'
-  
-proc toStrAux(r: TPeg, res: var string) = 
+
+proc toStrAux(r: TPeg, res: var string) =
   case r.kind
   of pkEmpty: add(res, "()")
   of pkAny: add(res, '.')
@@ -491,25 +491,25 @@ proc toStrAux(r: TPeg, res: var string) =
     toStrAux(r.sons[0], res)
   of pkCapture:
     add(res, '{')
-    toStrAux(r.sons[0], res)    
+    toStrAux(r.sons[0], res)
     add(res, '}')
-  of pkBackRef: 
+  of pkBackRef:
     add(res, '$')
     add(res, $r.index)
-  of pkBackRefIgnoreCase: 
+  of pkBackRefIgnoreCase:
     add(res, "i$")
     add(res, $r.index)
-  of pkBackRefIgnoreStyle: 
+  of pkBackRefIgnoreStyle:
     add(res, "y$")
     add(res, $r.index)
   of pkRule:
-    toStrAux(r.sons[0], res)    
+    toStrAux(r.sons[0], res)
     add(res, " <- ")
     toStrAux(r.sons[1], res)
   of pkList:
     for i in 0 .. high(r.sons):
       toStrAux(r.sons[i], res)
-      add(res, "\n")  
+      add(res, "\n")
   of pkStartAnchor:
     add(res, '^')
 
@@ -526,8 +526,8 @@ type
     ml: int
     origStart: int
 
-proc bounds*(c: TCaptures, 
-             i: range[0..MaxSubpatterns-1]): tuple[first, last: int] = 
+proc bounds*(c: TCaptures,
+             i: range[0..MaxSubpatterns-1]): tuple[first, last: int] =
   ## returns the bounds ``[first..last]`` of the `i`'th capture.
   result = c.matches[i]
 
@@ -547,7 +547,7 @@ when not useUnicode:
 
 proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
                rtl, extern: "npegs$1".} =
-  ## low-level matching proc that implements the PEG interpreter. Use this 
+  ## low-level matching proc that implements the PEG interpreter. Use this
   ## for maximum efficiency (every other PEG operation ends up calling this
   ## proc).
   ## Returns -1 if it does not match, else the length of the match
@@ -561,7 +561,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
       result = runeLenAt(s, start)
     else:
       result = -1
-  of pkLetter: 
+  of pkLetter:
     if s[start] != '\0':
       var a: Rune
       result = start
@@ -570,7 +570,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
       else: result = -1
     else:
       result = -1
-  of pkLower: 
+  of pkLower:
     if s[start] != '\0':
       var a: Rune
       result = start
@@ -579,7 +579,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
       else: result = -1
     else:
       result = -1
-  of pkUpper: 
+  of pkUpper:
     if s[start] != '\0':
       var a: Rune
       result = start
@@ -588,16 +588,16 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
       else: result = -1
     else:
       result = -1
-  of pkTitle: 
+  of pkTitle:
     if s[start] != '\0':
       var a: Rune
       result = start
       fastRuneAt(s, result, a)
-      if isTitle(a): dec(result, start) 
+      if isTitle(a): dec(result, start)
       else: result = -1
     else:
       result = -1
-  of pkWhitespace: 
+  of pkWhitespace:
     if s[start] != '\0':
       var a: Rune
       result = start
@@ -661,7 +661,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
     when false: echo "leave: ", p.nt.name
     if result < 0: c.ml = oldMl
   of pkSequence:
-    var oldMl = c.ml  
+    var oldMl = c.ml
     result = 0
     assert(not isNil(p.sons))
     for i in 0..high(p.sons):
@@ -744,11 +744,11 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
       #else: silently ignore the capture
     else:
       c.ml = idx
-  of pkBackRef..pkBackRefIgnoreStyle: 
+  of pkBackRef..pkBackRefIgnoreStyle:
     if p.index >= c.ml: return -1
     var (a, b) = c.matches[p.index]
     var n: TPeg
-    n.kind = succ(pkTerminal, ord(p.kind)-ord(pkBackRef)) 
+    n.kind = succ(pkTerminal, ord(p.kind)-ord(pkBackRef))
     n.term = s.substr(a, b)
     result = rawMatch(s, n, start, c)
   of pkStartAnchor:
@@ -769,7 +769,7 @@ proc match*(s: string, pattern: TPeg, matches: var openarray[string],
     for i in 0..c.ml-1:
       matches[i] = substr(s, c.matches[i][0], c.matches[i][1])
 
-proc match*(s: string, pattern: TPeg, 
+proc match*(s: string, pattern: TPeg,
             start = 0): bool {.rtl, extern: "npegs$1".} =
   ## returns ``true`` if ``s`` matches the ``pattern`` beginning from ``start``.
   var c: TCaptures
@@ -789,7 +789,7 @@ proc matchLen*(s: string, pattern: TPeg, matches: var openarray[string],
     for i in 0..c.ml-1:
       matches[i] = substr(s, c.matches[i][0], c.matches[i][1])
 
-proc matchLen*(s: string, pattern: TPeg, 
+proc matchLen*(s: string, pattern: TPeg,
                start = 0): int {.rtl, extern: "npegs$1".} =
   ## 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
@@ -808,11 +808,11 @@ proc find*(s: string, pattern: TPeg, matches: var openarray[string],
     if matchLen(s, pattern, matches, i) >= 0: return i
   return -1
   # could also use the pattern here: (!P .)* P
-  
+
 proc findBounds*(s: string, pattern: TPeg, matches: var openarray[string],
                  start = 0): tuple[first, last: int] {.
                  rtl, extern: "npegs$1Capture".} =
-  ## returns the starting position and end position of ``pattern`` in ``s`` 
+  ## returns the starting position and end position of ``pattern`` in ``s``
   ## and the captured
   ## substrings in the array ``matches``. If it does not match, nothing
   ## is written into ``matches`` and (-1,0) is returned.
@@ -820,40 +820,40 @@ proc findBounds*(s: string, pattern: TPeg, matches: var openarray[string],
     var L = matchLen(s, pattern, matches, i)
     if L >= 0: return (i, i+L-1)
   return (-1, 0)
-  
-proc find*(s: string, pattern: TPeg, 
+
+proc find*(s: string, pattern: TPeg,
            start = 0): int {.rtl, extern: "npegs$1".} =
   ## returns the starting position of ``pattern`` in ``s``. If it does not
   ## match, -1 is returned.
   for i in start .. s.len-1:
     if matchLen(s, pattern, i) >= 0: return i
   return -1
-  
-iterator findAll*(s: string, pattern: TPeg, start = 0): string = 
+
+iterator findAll*(s: string, pattern: TPeg, start = 0): string =
   ## yields all matching captures of pattern in `s`.
   var matches: array[0..MaxSubpatterns-1, string]
   var i = start
   while i < s.len:
     var L = matchLen(s, pattern, matches, i)
     if L < 0: break
-    for k in 0..MaxSubPatterns-1: 
+    for k in 0..MaxSubPatterns-1:
       if isNil(matches[k]): break
       yield matches[k]
     inc(i, L)
-    
+
 proc findAll*(s: string, pattern: TPeg, start = 0): seq[string] {.
-  rtl, extern: "npegs$1".} = 
+  rtl, extern: "npegs$1".} =
   ## returns all matching captures of pattern in `s`.
   ## If it does not match, @[] is returned.
   accumulateResult(findAll(s, pattern, start))
-  
+
 template `=~`*(s: string, pattern: TPeg): expr =
-  ## This calls ``match`` with an implicit declared ``matches`` array that 
-  ## can be used in the scope of the ``=~`` call: 
-  ## 
+  ## This calls ``match`` with an implicit declared ``matches`` array that
+  ## can be used in the scope of the ``=~`` call:
+  ##
   ## .. code-block:: nim
   ##
-  ##   if line =~ peg"\s* {\w+} \s* '=' \s* {\w+}": 
+  ##   if line =~ peg"\s* {\w+} \s* '=' \s* {\w+}":
   ##     # matches a key=value pair:
   ##     echo("Key: ", matches[0])
   ##     echo("Value: ", matches[1])
@@ -864,7 +864,7 @@ template `=~`*(s: string, pattern: TPeg): expr =
   ##     echo("comment: ", matches[0])
   ##   else:
   ##     echo("syntax error")
-  ##  
+  ##
   when not declaredInScope(matches):
     var matches {.inject.}: array[0..MaxSubpatterns-1, string]
   match(s, pattern, matches)
@@ -934,10 +934,10 @@ proc replace*(s: string, sub: TPeg, by = ""): string {.
       addf(result, by, caps)
       inc(i, x)
   add(result, substr(s, i))
-  
+
 proc parallelReplace*(s: string, subs: varargs[
                       tuple[pattern: TPeg, repl: string]]): string {.
-                      rtl, extern: "npegs$1".} = 
+                      rtl, extern: "npegs$1".} =
   ## Returns a modified copy of `s` with the substitutions in `subs`
   ## applied in parallel.
   result = ""
@@ -954,8 +954,8 @@ proc parallelReplace*(s: string, subs: varargs[
       add(result, s[i])
       inc(i)
   # copy the rest:
-  add(result, substr(s, i))  
-  
+  add(result, substr(s, i))
+
 proc transformFile*(infile, outfile: string,
                     subs: varargs[tuple[pattern: TPeg, repl: string]]) {.
                     rtl, extern: "npegs$1".} =
@@ -972,7 +972,7 @@ proc transformFile*(infile, outfile: string,
       quit("cannot open for writing: " & outfile)
   else:
     quit("cannot open for reading: " & infile)
-  
+
 iterator split*(s: string, sep: TPeg): string =
   ## Splits the string `s` into substrings.
   ##
@@ -981,7 +981,7 @@ iterator split*(s: string, sep: TPeg): string =
   ##
   ## .. code-block:: nim
   ##   for word in split("00232this02939is39an22example111", peg"\d+"):
-  ##     writeln(stdout, word)
+  ##     writeLine(stdout, word)
   ##
   ## Results in:
   ##
@@ -1044,14 +1044,14 @@ type
     tkBackref,          ## '$'
     tkDollar,           ## '$'
     tkHat               ## '^'
-  
+
   TToken {.final.} = object  ## a token
     kind: TTokKind           ## the type of the token
     modifier: TModifier
     literal: string          ## the parsed (string) literal
     charset: set[char]       ## if kind == tkCharSet
     index: int               ## if kind == tkBackref
-  
+
   TPegLexer {.inheritable.} = object          ## the lexer object.
     bufpos: int               ## the current position within the buffer
     buf: cstring              ## the buffer itself
@@ -1081,7 +1081,7 @@ proc HandleLF(L: var TPegLexer, pos: int): int =
   result = pos+1
   L.lineStart = result
 
-proc init(L: var TPegLexer, input, filename: string, line = 1, col = 0) = 
+proc init(L: var TPegLexer, input, filename: string, line = 1, col = 0) =
   L.buf = input
   L.bufpos = 0
   L.lineNumber = line
@@ -1089,69 +1089,69 @@ proc init(L: var TPegLexer, input, filename: string, line = 1, col = 0) =
   L.lineStart = 0
   L.filename = filename
 
-proc getColumn(L: TPegLexer): int {.inline.} = 
+proc getColumn(L: TPegLexer): int {.inline.} =
   result = abs(L.bufpos - L.lineStart) + L.colOffset
 
-proc getLine(L: TPegLexer): int {.inline.} = 
+proc getLine(L: TPegLexer): int {.inline.} =
   result = L.linenumber
-  
+
 proc errorStr(L: TPegLexer, msg: string, line = -1, col = -1): string =
   var line = if line < 0: getLine(L) else: line
   var col = if col < 0: getColumn(L) else: col
   result = "$1($2, $3) Error: $4" % [L.filename, $line, $col, msg]
 
-proc handleHexChar(c: var TPegLexer, xi: var int) = 
+proc handleHexChar(c: var TPegLexer, xi: var int) =
   case c.buf[c.bufpos]
-  of '0'..'9': 
+  of '0'..'9':
     xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('0'))
     inc(c.bufpos)
-  of 'a'..'f': 
+  of 'a'..'f':
     xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('a') + 10)
     inc(c.bufpos)
-  of 'A'..'F': 
+  of 'A'..'F':
     xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10)
     inc(c.bufpos)
   else: discard
 
-proc getEscapedChar(c: var TPegLexer, tok: var TToken) = 
+proc getEscapedChar(c: var TPegLexer, tok: var TToken) =
   inc(c.bufpos)
   case c.buf[c.bufpos]
-  of 'r', 'R', 'c', 'C': 
+  of 'r', 'R', 'c', 'C':
     add(tok.literal, '\c')
     inc(c.bufpos)
-  of 'l', 'L': 
+  of 'l', 'L':
     add(tok.literal, '\L')
     inc(c.bufpos)
-  of 'f', 'F': 
+  of 'f', 'F':
     add(tok.literal, '\f')
     inc(c.bufpos)
-  of 'e', 'E': 
+  of 'e', 'E':
     add(tok.literal, '\e')
     inc(c.bufpos)
-  of 'a', 'A': 
+  of 'a', 'A':
     add(tok.literal, '\a')
     inc(c.bufpos)
-  of 'b', 'B': 
+  of 'b', 'B':
     add(tok.literal, '\b')
     inc(c.bufpos)
-  of 'v', 'V': 
+  of 'v', 'V':
     add(tok.literal, '\v')
     inc(c.bufpos)
-  of 't', 'T': 
+  of 't', 'T':
     add(tok.literal, '\t')
     inc(c.bufpos)
-  of 'x', 'X': 
+  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))
-  of '0'..'9': 
+  of '0'..'9':
     var val = ord(c.buf[c.bufpos]) - ord('0')
     inc(c.bufpos)
     var i = 1
-    while (i <= 3) and (c.buf[c.bufpos] in {'0'..'9'}): 
+    while (i <= 3) and (c.buf[c.bufpos] in {'0'..'9'}):
       val = val * 10 + ord(c.buf[c.bufpos]) - ord('0')
       inc(c.bufpos)
       inc(i)
@@ -1164,32 +1164,32 @@ proc getEscapedChar(c: var TPegLexer, tok: var TToken) =
   else:
     add(tok.literal, c.buf[c.bufpos])
     inc(c.bufpos)
-  
-proc skip(c: var TPegLexer) = 
+
+proc skip(c: var TPegLexer) =
   var pos = c.bufpos
   var buf = c.buf
-  while true: 
+  while true:
     case buf[pos]
-    of ' ', '\t': 
+    of ' ', '\t':
       inc(pos)
     of '#':
       while not (buf[pos] in {'\c', '\L', '\0'}): inc(pos)
     of '\c':
       pos = HandleCR(c, pos)
       buf = c.buf
-    of '\L': 
+    of '\L':
       pos = HandleLF(c, pos)
       buf = c.buf
-    else: 
+    else:
       break                   # EndOfFile also leaves the loop
   c.bufpos = pos
-  
-proc getString(c: var TPegLexer, tok: var TToken) = 
+
+proc getString(c: var TPegLexer, tok: var TToken) =
   tok.kind = tkStringLit
   var pos = c.bufPos + 1
   var buf = c.buf
   var quote = buf[pos-1]
-  while true: 
+  while true:
     case buf[pos]
     of '\\':
       c.bufpos = pos
@@ -1200,13 +1200,13 @@ proc getString(c: var TPegLexer, tok: var TToken) =
       break
     elif buf[pos] == quote:
       inc(pos)
-      break      
+      break
     else:
       add(tok.literal, buf[pos])
       inc(pos)
   c.bufpos = pos
-  
-proc getDollar(c: var TPegLexer, tok: var TToken) = 
+
+proc getDollar(c: var TPegLexer, tok: var TToken) =
   var pos = c.bufPos + 1
   var buf = c.buf
   if buf[pos] in {'0'..'9'}:
@@ -1218,8 +1218,8 @@ proc getDollar(c: var TPegLexer, tok: var TToken) =
   else:
     tok.kind = tkDollar
   c.bufpos = pos
-  
-proc getCharSet(c: var TPegLexer, tok: var TToken) = 
+
+proc getCharSet(c: var TPegLexer, tok: var TToken) =
   tok.kind = tkCharSet
   tok.charset = {}
   var pos = c.bufPos + 1
@@ -1242,7 +1242,7 @@ proc getCharSet(c: var TPegLexer, tok: var TToken) =
     of '\C', '\L', '\0':
       tok.kind = tkInvalid
       break
-    else: 
+    else:
       ch = buf[pos]
       inc(pos)
     incl(tok.charset, ch)
@@ -1262,18 +1262,18 @@ proc getCharSet(c: var TPegLexer, tok: var TToken) =
         of '\C', '\L', '\0':
           tok.kind = tkInvalid
           break
-        else: 
+        else:
           ch2 = buf[pos]
           inc(pos)
         for i in ord(ch)+1 .. ord(ch2):
           incl(tok.charset, chr(i))
   c.bufpos = pos
   if caret: tok.charset = {'\1'..'\xFF'} - tok.charset
-  
-proc getSymbol(c: var TPegLexer, tok: var TToken) = 
+
+proc getSymbol(c: var TPegLexer, tok: var TToken) =
   var pos = c.bufpos
   var buf = c.buf
-  while true: 
+  while true:
     add(tok.literal, buf[pos])
     inc(pos)
     if buf[pos] notin strutils.IdentChars: break
@@ -1289,7 +1289,7 @@ proc getBuiltin(c: var TPegLexer, tok: var TToken) =
     tok.kind = tkEscaped
     getEscapedChar(c, tok) # may set tok.kind to tkInvalid
 
-proc getTok(c: var TPegLexer, tok: var TToken) = 
+proc getTok(c: var TPegLexer, tok: var TToken) =
   tok.kind = tkInvalid
   tok.modifier = modNone
   setlen(tok.literal, 0)
@@ -1304,11 +1304,11 @@ proc getTok(c: var TPegLexer, tok: var TToken) =
     else:
       tok.kind = tkCurlyLe
       add(tok.literal, '{')
-  of '}': 
+  of '}':
     tok.kind = tkCurlyRi
     inc(c.bufpos)
     add(tok.literal, '}')
-  of '[': 
+  of '[':
     getCharset(c, tok)
   of '(':
     tok.kind = tkParLe
@@ -1318,7 +1318,7 @@ proc getTok(c: var TPegLexer, tok: var TToken) =
     tok.kind = tkParRi
     inc(c.bufpos)
     add(tok.literal, ')')
-  of '.': 
+  of '.':
     tok.kind = tkAny
     inc(c.bufpos)
     add(tok.literal, '.')
@@ -1326,16 +1326,16 @@ proc getTok(c: var TPegLexer, tok: var TToken) =
     tok.kind = tkAnyRune
     inc(c.bufpos)
     add(tok.literal, '_')
-  of '\\': 
+  of '\\':
     getBuiltin(c, tok)
   of '\'', '"': getString(c, tok)
   of '$': getDollar(c, tok)
-  of '\0': 
+  of '\0':
     tok.kind = tkEof
     tok.literal = "[EOF]"
   of 'a'..'z', 'A'..'Z', '\128'..'\255':
     getSymbol(c, tok)
-    if c.buf[c.bufpos] in {'\'', '"'} or 
+    if c.buf[c.bufpos] in {'\'', '"'} or
         c.buf[c.bufpos] == '$' and c.buf[c.bufpos+1] in {'0'..'9'}:
       case tok.literal
       of "i": tok.modifier = modIgnoreCase
@@ -1383,7 +1383,7 @@ proc getTok(c: var TPegLexer, tok: var TToken) =
     tok.kind = tkAt
     inc(c.bufpos)
     add(tok.literal, '@')
-    if c.buf[c.bufpos] == '@': 
+    if c.buf[c.bufpos] == '@':
       tok.kind = tkCurlyAt
       inc(c.bufpos)
       add(tok.literal, '@')
@@ -1402,7 +1402,7 @@ proc arrowIsNextTok(c: TPegLexer): bool =
   result = c.buf[pos] == '<' and c.buf[pos+1] == '-'
 
 # ----------------------------- parser ----------------------------------------
-    
+
 type
   EInvalidPeg* = object of ValueError ## raised if an invalid
                                       ## PEG has been detected
@@ -1420,7 +1420,7 @@ proc pegError(p: TPegParser, msg: string, line = -1, col = -1) =
   e.msg = errorStr(p, msg, line, col)
   raise e
 
-proc getTok(p: var TPegParser) = 
+proc getTok(p: var TPegParser) =
   getTok(p, p.tok)
   if p.tok.kind == tkInvalid: pegError(p, "invalid token")
 
@@ -1470,7 +1470,7 @@ proc builtin(p: var TPegParser): TPeg =
   of "white": result = UnicodeWhitespace()
   else: pegError(p, "unknown built-in: " & p.tok.literal)
 
-proc token(terminal: TPeg, p: TPegParser): TPeg = 
+proc token(terminal: TPeg, p: TPegParser): TPeg =
   if p.skip.kind == pkEmpty: result = terminal
   else: result = sequence(p.skip, terminal)
 
@@ -1491,7 +1491,7 @@ proc primary(p: var TPegParser): TPeg =
   else: discard
   case p.tok.kind
   of tkIdentifier:
-    if p.identIsVerbatim: 
+    if p.identIsVerbatim:
       var m = p.tok.modifier
       if m == modNone: m = p.modifier
       result = modifiedTerm(p.tok.literal, m).token(p)
@@ -1534,17 +1534,17 @@ proc primary(p: var TPegParser): TPeg =
   of tkEscaped:
     result = term(p.tok.literal[0]).token(p)
     getTok(p)
-  of tkDollar: 
+  of tkDollar:
     result = endAnchor()
     getTok(p)
-  of tkHat: 
+  of tkHat:
     result = startAnchor()
     getTok(p)
   of tkBackref:
     var m = p.tok.modifier
     if m == modNone: m = p.modifier
     result = modifiedBackRef(p.tok.index, m).token(p)
-    if p.tok.index < 0 or p.tok.index > p.captures: 
+    if p.tok.index < 0 or p.tok.index > p.captures:
       pegError(p, "invalid back reference index: " & $p.tok.index)
     getTok(p)
   else:
@@ -1568,7 +1568,7 @@ proc seqExpr(p: var TPegParser): TPeg =
   while true:
     case p.tok.kind
     of tkAmp, tkNot, tkAt, tkStringLit, tkCharset, tkParLe, tkCurlyLe,
-       tkAny, tkAnyRune, tkBuiltin, tkEscaped, tkDollar, tkBackref, 
+       tkAny, tkAnyRune, tkBuiltin, tkEscaped, tkDollar, tkBackref,
        tkHat, tkCurlyAt:
       result = sequence(result, primary(p))
     of tkIdentifier:
@@ -1582,7 +1582,7 @@ proc parseExpr(p: var TPegParser): TPeg =
   while p.tok.kind == tkBar:
     getTok(p)
     result = result / seqExpr(p)
-  
+
 proc parseRule(p: var TPegParser): PNonTerminal =
   if p.tok.kind == tkIdentifier and arrowIsNextTok(p):
     result = getNonTerminal(p, p.tok.literal)
@@ -1596,7 +1596,7 @@ proc parseRule(p: var TPegParser): PNonTerminal =
     incl(result.flags, ntDeclared) # NOW inlining may be attempted
   else:
     pegError(p, "rule expected, but found: " & p.tok.literal)
-  
+
 proc rawParse(p: var TPegParser): TPeg =
   ## parses a rule or a PEG expression
   while p.tok.kind == tkBuiltin:
@@ -1649,20 +1649,20 @@ proc peg*(pattern: string): TPeg =
   ##   peg"{\ident} \s* '=' \s* {.*}"
   result = parsePeg(pattern, "pattern")
 
-proc escapePeg*(s: string): string = 
+proc escapePeg*(s: string): string =
   ## escapes `s` so that it is matched verbatim when used as a peg.
   result = ""
   var inQuote = false
-  for c in items(s):  
+  for c in items(s):
     case c
-    of '\0'..'\31', '\'', '"', '\\': 
-      if inQuote: 
+    of '\0'..'\31', '\'', '"', '\\':
+      if inQuote:
         result.add('\'')
         inQuote = false
       result.add("\\x")
       result.add(toHex(ord(c), 2))
     else:
-      if not inQuote: 
+      if not inQuote:
         result.add('\'')
         inQuote = true
       result.add(c)
@@ -1675,27 +1675,27 @@ when isMainModule:
   doAssert(not match("W_HI_L", peg"\y 'while'"))
   doAssert(not match("W_HI_Le", peg"\y v'while'"))
   doAssert match("W_HI_Le", peg"y'while'")
-  
+
   doAssert($ +digits == $peg"\d+")
   doAssert "0158787".match(peg"\d+")
   doAssert "ABC 0232".match(peg"\w+\s+\d+")
   doAssert "ABC".match(peg"\d+ / \w+")
 
   for word in split("00232this02939is39an22example111", peg"\d+"):
-    writeln(stdout, word)
+    writeLine(stdout, word)
 
   doAssert matchLen("key", ident) == 3
 
   var pattern = sequence(ident, *whitespace, term('='), *whitespace, ident)
   doAssert matchLen("key1=  cal9", pattern) == 11
-  
+
   var ws = newNonTerminal("ws", 1, 1)
   ws.rule = *whitespace
-  
+
   var expr = newNonTerminal("expr", 1, 1)
   expr.rule = sequence(capture(ident), *sequence(
                 nonterminal(ws), term('+'), nonterminal(ws), nonterminal(expr)))
-  
+
   var c: TCaptures
   var s = "a+b +  c +d+e+f"
   doAssert rawMatch(s, expr.rule, 0, c) == len(s)
@@ -1716,7 +1716,7 @@ when isMainModule:
     doAssert matches[0] == "abc"
   else:
     doAssert false
-  
+
   var g2 = peg"""S <- A B / C D
                  A <- 'a'+
                  B <- 'b'+
@@ -1733,10 +1733,10 @@ when isMainModule:
     doAssert matches[0] == "a"
   else:
     doAssert false
-  
+
   block:
     var matches: array[0..2, string]
-    if match("abcdefg", peg"c {d} ef {g}", matches, 2): 
+    if match("abcdefg", peg"c {d} ef {g}", matches, 2):
       doAssert matches[0] == "d"
       doAssert matches[1] == "g"
     else:
@@ -1744,13 +1744,13 @@ when isMainModule:
 
   for x in findAll("abcdef", peg"{.}", 3):
     echo x
-    
+
   if "f(a, b)" =~ peg"{[0-9]+} / ({\ident} '(' {@} ')')":
     doAssert matches[0] == "f"
     doAssert matches[1] == "a, b"
   else:
     doAssert false
-  
+
   doAssert match("eine übersicht und außerdem", peg"(\letter \white*)+")
   # ß is not a lower cased letter?!
   doAssert match("eine übersicht und auerdem", peg"(\lower \white*)+")
@@ -1762,7 +1762,7 @@ when isMainModule:
          "var1<-keykey;var2<-key2key2")
 
   doAssert match("prefix/start", peg"^start$", 7)
-  
+
   # tricky test to check for false aliasing:
   block:
     var a = term"key"
diff --git a/tests/stdlib/tposix.nim b/tests/stdlib/tposix.nim
index bf0b49586..229035d22 100644
--- a/tests/stdlib/tposix.nim
+++ b/tests/stdlib/tposix.nim
@@ -9,8 +9,8 @@ when not defined(windows):
 
   discard uname(u)
 
-  writeln(stdout, u.sysname)
-  writeln(stdout, u.nodename)
-  writeln(stdout, u.release)
-  writeln(stdout, u.machine)
+  writeLine(stdout, u.sysname)
+  writeLine(stdout, u.nodename)
+  writeLine(stdout, u.release)
+  writeLine(stdout, u.machine)
 
diff --git a/tests/stdlib/tquit.nim b/tests/stdlib/tquit.nim
index d4dc1522d..d18b468c8 100644
--- a/tests/stdlib/tquit.nim
+++ b/tests/stdlib/tquit.nim
@@ -1,6 +1,6 @@
-# Test the new beforeQuit variable: 

-

-proc myExit() {.noconv.} = 

-  write(stdout, "just exiting...\n")

-

-addQuitProc(myExit)

+# Test the new beforeQuit variable:
+
+proc myExit() {.noconv.} =
+  write(stdout, "just exiting...\n")
+
+addQuitProc(myExit)
diff --git a/tests/stdlib/tregex.nim b/tests/stdlib/tregex.nim
index bb4695f02..ae6714de1 100644
--- a/tests/stdlib/tregex.nim
+++ b/tests/stdlib/tregex.nim
@@ -2,30 +2,30 @@ discard """
   file: "tregex.nim"
   output: "key: keyAYes!"
 """
-# Test the new regular expression module

-# which is based on the PCRE library

+# Test the new regular expression module
+# which is based on the PCRE library
 
 when defined(powerpc64):
   # cheat as our powerpc test machine has no PCRE installed:
   echo "key: keyAYes!"
 
-else:

-  import

-    re

-

-  if "keyA = valueA" =~ re"\s*(\w+)\s*\=\s*(\w+)":

-    write(stdout, "key: ", matches[0])

-  elif "# comment!" =~ re.re"\s*(\#.*)": 

-    # test re.re"" syntax

-    echo("comment: ", matches[0])

-  else: 

-    echo("Bug!")

-

-  if "Username".match(re"[A-Za-z]+"):

-    echo("Yes!")

-  else:

-    echo("Bug!")

-

-  #OUT key: keyAYes!

+else:
+  import
+    re
+
+  if "keyA = valueA" =~ re"\s*(\w+)\s*\=\s*(\w+)":
+    write(stdout, "key: ", matches[0])
+  elif "# comment!" =~ re.re"\s*(\#.*)":
+    # test re.re"" syntax
+    echo("comment: ", matches[0])
+  else:
+    echo("Bug!")
+
+  if "Username".match(re"[A-Za-z]+"):
+    echo("Yes!")
+  else:
+    echo("Bug!")
+
+  #OUT key: keyAYes!
 
 
diff --git a/tests/stdlib/treguse.nim b/tests/stdlib/treguse.nim
index a610ad725..3d09eb731 100644
--- a/tests/stdlib/treguse.nim
+++ b/tests/stdlib/treguse.nim
@@ -2,26 +2,26 @@ discard """
   file: "treguse.nim"
   output: "055this should be the casehugh"
 """
-# Test the register usage of the virtual machine and

-# the blocks in var statements

-

-proc main(a, b: int) =

-  var x = 0

-  write(stdout, x)

-  if x == 0:

-    var y = 55

-    write(stdout, y)

-    write(stdout, "this should be the case")

-    var input = "<no input>"

-    if input == "Andreas":

-      write(stdout, "wow")

-    else:

-      write(stdout, "hugh")

-  else:

-    var z = 66

-    write(stdout, z) # "bug!")

-

-main(45, 1000)

-#OUT 055this should be the casehugh

+# Test the register usage of the virtual machine and
+# the blocks in var statements
+
+proc main(a, b: int) =
+  var x = 0
+  write(stdout, x)
+  if x == 0:
+    var y = 55
+    write(stdout, y)
+    write(stdout, "this should be the case")
+    var input = "<no input>"
+    if input == "Andreas":
+      write(stdout, "wow")
+    else:
+      write(stdout, "hugh")
+  else:
+    var z = 66
+    write(stdout, z) # "bug!")
+
+main(45, 1000)
+#OUT 055this should be the casehugh
 
 
diff --git a/tests/stdlib/treloop.nim b/tests/stdlib/treloop.nim
new file mode 100644
index 000000000..35236708c
--- /dev/null
+++ b/tests/stdlib/treloop.nim
@@ -0,0 +1,9 @@
+discard """
+  output: "@[(, +,  1,  2, )]"
+"""
+
+import re
+
+let str = "(+ 1 2)"
+var tokenRE = re"""[\s,]*(~@|[\[\]{}()'`~^@]|"(?:\\.|[^\\"])*"|;.*|[^\s\[\]{}('"`,;)]*)"""
+echo str.findAll(tokenRE)
diff --git a/tests/stdlib/trepr.nim b/tests/stdlib/trepr.nim
index 41c830621..18fe7e054 100644
--- a/tests/stdlib/trepr.nim
+++ b/tests/stdlib/trepr.nim
@@ -6,10 +6,10 @@ discard """
 type
   TEnum = enum
     a, b
-    
+
 var val = {a, b}
 stdout.write(repr(val))
-stdout.writeln(repr({'a'..'z', 'A'..'Z'}))
+stdout.writeLine(repr({'a'..'z', 'A'..'Z'}))
 
 type
   TObj {.pure, inheritable.} = object
diff --git a/tests/stdlib/trepr2.nim b/tests/stdlib/trepr2.nim
index b15081e48..a92024851 100644
--- a/tests/stdlib/trepr2.nim
+++ b/tests/stdlib/trepr2.nim
@@ -1,32 +1,32 @@
-# test the new "repr" built-in proc

-

-type

-  TEnum = enum

-    en1, en2, en3, en4, en5, en6

-

-  TPoint {.final.} = object

-    x, y, z: int

-    s: array [0..1, string]

-    e: TEnum

-

-var

-  p: TPoint

-  q: ref TPoint

-  s: seq[ref TPoint]

-

-p.x = 0

-p.y = 13

-p.z = 45

-p.s[0] = "abc"

-p.s[1] = "xyz"

-p.e = en6

-

-new(q)

-q[] = p

-

-s = @[q, q, q, q]

-

-writeln(stdout, repr(p))

-writeln(stdout, repr(q))

-writeln(stdout, repr(s))

-writeln(stdout, repr(en4))

+# test the new "repr" built-in proc
+
+type
+  TEnum = enum
+    en1, en2, en3, en4, en5, en6
+
+  TPoint {.final.} = object
+    x, y, z: int
+    s: array [0..1, string]
+    e: TEnum
+
+var
+  p: TPoint
+  q: ref TPoint
+  s: seq[ref TPoint]
+
+p.x = 0
+p.y = 13
+p.z = 45
+p.s[0] = "abc"
+p.s[1] = "xyz"
+p.e = en6
+
+new(q)
+q[] = p
+
+s = @[q, q, q, q]
+
+writeLine(stdout, repr(p))
+writeLine(stdout, repr(q))
+writeLine(stdout, repr(s))
+writeLine(stdout, repr(en4))
diff --git a/tests/stdlib/tsplit.nim b/tests/stdlib/tsplit.nim
index 25bad33e2..5a1cd2f5f 100644
--- a/tests/stdlib/tsplit.nim
+++ b/tests/stdlib/tsplit.nim
@@ -13,7 +13,7 @@ if s == "#abc#xy#z":
   echo "true"
 else:
   echo "false"
-  
+
 #OUT true
 
 
diff --git a/tests/stdlib/tstreams2.nim b/tests/stdlib/tstreams2.nim
new file mode 100644
index 000000000..90102d8e3
--- /dev/null
+++ b/tests/stdlib/tstreams2.nim
@@ -0,0 +1,13 @@
+discard """
+  file: "tstreams2.nim"
+  output: '''fs is: nil'''
+"""
+import streams
+var
+  fs = newFileStream("amissingfile.txt")
+  line = ""
+echo "fs is: ",repr(fs)
+if not isNil(fs):
+  while fs.readLine(line):
+    echo line
+  fs.close()
diff --git a/tests/stdlib/tstrset.nim b/tests/stdlib/tstrset.nim
index 9cdb5ed35..15024c3f1 100644
--- a/tests/stdlib/tstrset.nim
+++ b/tests/stdlib/tstrset.nim
@@ -8,7 +8,7 @@ type
   TRadixNodeLinear = object of TRadixNode
     len: int8
     keys: array [0..31, char]
-    vals: array [0..31, PRadixNode]  
+    vals: array [0..31, PRadixNode]
   TRadixNodeFull = object of TRadixNode
     b: array [char, PRadixNode]
   TRadixNodeLeaf = object of TRadixNode
@@ -16,7 +16,7 @@ type
   PRadixNodeLinear = ref TRadixNodeLinear
   PRadixNodeFull = ref TRadixNodeFull
   PRadixNodeLeaf = ref TRadixNodeLeaf
-    
+
 proc search(r: PRadixNode, s: string): PRadixNode =
   var r = r
   var i = 0
@@ -52,7 +52,7 @@ proc contains*(r: PRadixNode, s: string): bool =
 
 proc testOrincl*(r: var PRadixNode, s: string): bool =
   nil
-    
+
 proc incl*(r: var PRadixNode, s: string) = discard testOrIncl(r, s)
 
 proc excl*(r: var PRadixNode, s: string) =
diff --git a/tests/stdlib/tstrtabs.nim b/tests/stdlib/tstrtabs.nim
index 251ec77ef..a248cc3b2 100644
--- a/tests/stdlib/tstrtabs.nim
+++ b/tests/stdlib/tstrtabs.nim
@@ -1,12 +1,12 @@
 import strtabs
 
-var tab = newStringTable({"key1": "val1", "key2": "val2"}, 
+var tab = newStringTable({"key1": "val1", "key2": "val2"},
                          modeStyleInsensitive)
 for i in 0..80:
   tab["key_" & $i] = "value" & $i
-  
+
 for key, val in pairs(tab):
-  writeln(stdout, key, ": ", val)
-writeln(stdout, "length of table ", $tab.len)
+  writeLine(stdout, key, ": ", val)
+writeLine(stdout, "length of table ", $tab.len)
 
-writeln(stdout, `%`("$key1 = $key2; ${PATH}", tab, {useEnvironment}))
+writeLine(stdout, `%`("$key1 = $key2; ${PATH}", tab, {useEnvironment}))
diff --git a/tests/stdlib/tstrutil.nim b/tests/stdlib/tstrutil.nim
index 3db484faa..b15bf0e68 100644
--- a/tests/stdlib/tstrutil.nim
+++ b/tests/stdlib/tstrutil.nim
@@ -10,12 +10,52 @@ import
 proc testStrip() =
   write(stdout, strip("  ha  "))
 
-proc main() = 
+proc testRemoveSuffix =
+  var s = "hello\n\r"
+  s.removeSuffix
+  assert s == "hello\n"
+  s.removeSuffix
+  assert s == "hello"
+  s.removeSuffix
+  assert s == "hello"
+
+  s = "hello\n\n"
+  s.removeSuffix
+  assert s == "hello\n"
+
+  s = "hello\r"
+  s.removeSuffix
+  assert s == "hello"
+
+  s = "hello \n there"
+  s.removeSuffix
+  assert s == "hello \n there"
+
+  s = "hello"
+  s.removeSuffix("llo")
+  assert s == "he"
+  s.removeSuffix('e')
+  assert s == "h"
+
+  s = "hellos"
+  s.removeSuffix({'s','z'})
+  assert s == "hello"
+  s.removeSuffix({'l','o'})
+  assert s == "hell"
+
+  # Contrary to Chomp in other languages
+  # empty string does not change behaviour
+  s = "hello\r\n\r\n"
+  s.removeSuffix("")
+  assert s == "hello\r\n\r\n"
+
+proc main() =
   testStrip()
+  testRemoveSuffix()
   for p in split("/home/a1:xyz:/usr/bin", {':'}):
     write(stdout, p)
 
-proc testDelete = 
+proc testDelete =
   var s = "0123456789ABCDEFGH"
   delete(s, 4, 5)
   assert s == "01236789ABCDEFGH"
@@ -24,8 +64,8 @@ proc testDelete =
   delete(s, 0, 0)
   assert s == "1236789ABCDEFG"
 
-testDelete()  
-    
+testDelete()
+
 assert(insertSep($1000_000) == "1_000_000")
 assert(insertSep($232) == "232")
 assert(insertSep($12345, ',') == "12,345")
diff --git a/tests/stdlib/ttime.nim b/tests/stdlib/ttime.nim
index bad818816..859f0abdd 100644
--- a/tests/stdlib/ttime.nim
+++ b/tests/stdlib/ttime.nim
@@ -1,6 +1,6 @@
-# test the new time module

-

-import

-  times

-

-write(stdout, $getTime())

+# test the new time module
+
+import
+  times
+
+write(stdout, $getTime())
diff --git a/tests/stdlib/tunittest.nim b/tests/stdlib/tunittest.nim
new file mode 100644
index 000000000..4b210c23b
--- /dev/null
+++ b/tests/stdlib/tunittest.nim
@@ -0,0 +1,85 @@
+import unittest, sequtils
+
+
+proc doThings(spuds: var int): int =
+  spuds = 24
+  return 99
+test "#964":
+  var spuds = 0
+  check doThings(spuds) == 99
+  check spuds == 24
+
+
+from strutils import toUpper
+test "#1384":
+  check(@["hello", "world"].map(toUpper) == @["HELLO", "WORLD"])
+
+
+import options
+test "unittest typedescs":
+  check(none(int) == none(int))
+  check(none(int) != some(1))
+
+
+test "unittest multiple requires":
+  require(true)
+  require(true)
+
+
+import math
+from strutils import parseInt
+proc defectiveRobot() =
+  randomize()
+  case random(1..4)
+  of 1: raise newException(OSError, "CANNOT COMPUTE!")
+  of 2: discard parseInt("Hello World!")
+  of 3: raise newException(IOError, "I can't do that Dave.")
+  else: assert 2 + 2 == 5
+test "unittest expect":
+  expect IOError, OSError, ValueError, AssertionError:
+    defectiveRobot()
+
+var
+  a = 1
+  b = -1
+  c = 1
+
+#unittests are sequential right now
+suite "suite with only teardown":
+  teardown:
+    b = 2
+
+  test "unittest with only teardown 1":
+    check a == c
+
+  test "unittest with only teardown 2":
+    check b > a
+
+suite "suite with only setup":
+  setup:
+    var testVar = "from setup"
+
+  test "unittest with only setup 1":
+    check testVar == "from setup"
+    check b > a
+    b = -1
+
+  test "unittest with only setup 2":
+    check b < a
+
+suite "suite with none":
+  test "unittest with none":
+    check b < a
+
+suite "suite with both":
+  setup:
+    a = -2
+
+  teardown:
+    c = 2
+
+  test "unittest with both 1":
+    check b > a
+
+  test "unittest with both 2":
+    check c == 2
diff --git a/tests/stdlib/twalker.nim b/tests/stdlib/twalker.nim
index 89e6c2b9d..91c97df01 100644
--- a/tests/stdlib/twalker.nim
+++ b/tests/stdlib/twalker.nim
@@ -1,13 +1,13 @@
-# iterate over all files with a given filter:

-

-import

-  "../../lib/pure/os.nim", ../../ lib / pure / times

-

-proc main(filter: string) =

-  for filename in walkFiles(filter):

-    writeln(stdout, filename)

-

-  for key, val in envPairs():

-    writeln(stdout, key & '=' & val)

-

-main("*.nim")

+# iterate over all files with a given filter:
+
+import
+  "../../lib/pure/os.nim", ../../ lib / pure / times
+
+proc main(filter: string) =
+  for filename in walkFiles(filter):
+    writeLine(stdout, filename)
+
+  for key, val in envPairs():
+    writeLine(stdout, key & '=' & val)
+
+main("*.nim")
diff --git a/tests/stdlib/twchartoutf8.nim b/tests/stdlib/twchartoutf8.nim
new file mode 100644
index 000000000..b2f68ee32
--- /dev/null
+++ b/tests/stdlib/twchartoutf8.nim
@@ -0,0 +1,110 @@
+discard """
+  output: '''OK'''
+"""
+
+#assume WideCharToMultiByte always produce correct result
+#windows only
+
+when not defined(windows):
+  echo "OK"
+else:
+  {.push gcsafe.}
+
+  const CP_UTF8 = 65001'i32
+
+  type
+    LPBOOL = ptr int32
+    LPWCSTR = ptr uint16
+
+  proc WideCharToMultiByte*(CodePage: int32, dwFlags: int32,
+                            lpWideCharStr: LPWCSTR, cchWideChar: int32,
+                            lpMultiByteStr: cstring, cchMultiByte: int32,
+                            lpDefaultChar: cstring, lpUsedDefaultChar: LPBOOL): int32{.
+      stdcall, dynlib: "kernel32", importc: "WideCharToMultiByte".}
+
+  {.pop.}
+
+  proc convertToUTF8(wc: WideCString, wclen: int32): string =
+    let size = WideCharToMultiByte(CP_UTF8, 0'i32, cast[LPWCSTR](addr(wc[0])), wclen,
+      cstring(nil), 0'i32, cstring(nil), LPBOOL(nil))
+    result = newString(size)
+    let res = WideCharToMultiByte(CP_UTF8, 0'i32, cast[LPWCSTR](addr(wc[0])), wclen,
+      cstring(result), size, cstring(nil), LPBOOL(nil))
+    result[size] = chr(0)
+    doAssert size == res
+
+  proc testCP(wc: WideCString, lo, hi: int) =
+    var x = 0
+    let chunk = 1024
+    for i in lo..hi:
+      wc[x] = cast[Utf16Char](i)
+      if (x >= chunk) or (i >= hi):
+        wc[x] = Utf16Char(0)
+        var a = convertToUTF8(wc, int32(x))
+        var b = wc $ chunk
+        doAssert a == b
+        x = 0
+      inc x
+
+  proc testCP2(wc: WideCString, lo, hi: int) =
+    doAssert((lo >= 0x10000) and (hi <= 0x10FFFF))
+    var x = 0
+    let chunk = 1024
+    for i in lo..hi:
+      let ch = i - 0x10000
+      let W1 = 0xD800 or (ch shr 10)
+      let W2 = 0xDC00 or (0x3FF and ch)
+      wc[x] = cast[Utf16Char](W1)
+      wc[x+1] = cast[Utf16Char](W2)
+      inc(x, 2)
+
+      if (x >= chunk) or (i >= hi):
+        wc[x] = Utf16Char(0)
+        var a = convertToUTF8(wc, int32(x))
+        var b = wc $ chunk
+        doAssert a == b
+        x = 0
+
+  #RFC-2781 "UTF-16, an encoding of ISO 10646"
+
+  var wc: WideCString
+  unsafeNew(wc, 1024 * 4 + 2)
+
+  #U+0000 to U+D7FF
+  #skip the U+0000
+  wc.testCP(1, 0xD7FF)
+
+  #U+E000 to U+FFFF
+  wc.testCP(0xE000, 0xFFFF)
+
+  #U+10000 to U+10FFFF
+  wc.testCP2(0x10000, 0x10FFFF)
+
+  #invalid UTF-16
+  const
+    b = "\xEF\xBF\xBD"
+    c = "\xEF\xBF\xBF"
+
+  wc[0] = cast[Utf16Char](0xDC00)
+  wc[1] = Utf16Char(0)
+  var a = $wc
+  doAssert a == b
+
+  wc[0] = cast[Utf16Char](0xFFFF)
+  wc[1] = cast[Utf16Char](0xDC00)
+  wc[2] = Utf16Char(0)
+  a = $wc
+  doAssert a == c & b
+
+  wc[0] = cast[Utf16Char](0xD800)
+  wc[1] = Utf16Char(0)
+  a = $wc
+  doAssert a == b
+
+  wc[0] = cast[Utf16Char](0xD800)
+  wc[1] = cast[Utf16Char](0xFFFF)
+  wc[2] = Utf16Char(0)
+  a = $wc
+  doAssert a == b & c
+
+  echo "OK"
diff --git a/tests/system/io.nim b/tests/system/io.nim
index ec9a1ed70..b0ccfda9f 100644
--- a/tests/system/io.nim
+++ b/tests/system/io.nim
@@ -13,7 +13,7 @@ proc echoLoop(str: string): string =
   discard process.waitForExit
   while not output.atEnd:
     result.add(output.readLine)
-    
+
 suite "io":
   suite "readAll":
     test "stdin":
diff --git a/tests/system/tfloatToString.nim b/tests/system/tfloatToString.nim
deleted file mode 100644
index bb45a91d7..000000000
--- a/tests/system/tfloatToString.nim
+++ /dev/null
@@ -1,22 +0,0 @@
-discard """
-  output:'''2.3242
-2.982
-123912.1
-123912.1823
-5.0
-1e+100
-inf
--inf
-nan
-'''
-"""
-
-echo($(2.3242))
-echo($(2.982))
-echo($(123912.1))
-echo($(123912.1823))
-echo($(5.0))
-echo($(1e100))
-echo($(1e1000000))
-echo($(-1e1000000))
-echo($(0.0/0.0))
diff --git a/tests/system/toString.nim b/tests/system/toString.nim
index 52e7a4b92..a2337f5dd 100644
--- a/tests/system/toString.nim
+++ b/tests/system/toString.nim
@@ -1,9 +1,42 @@
 discard """
   output:'''@[23, 45]
-@[, foo, bar]'''
+@[, foo, bar]
+{a, b, c}
+2.3242
+2.982
+123912.1
+123912.1823
+5.0
+1e+100
+inf
+-inf
+nan
+nil
+nil'''
 """
 
 echo($(@[23, 45]))
 echo($(@["", "foo", "bar"]))
 #echo($(["", "foo", "bar"]))
 #echo($([23, 45]))
+
+# bug #2395
+
+let alphaSet: set[char] = {'a'..'c'}
+echo alphaSet
+
+echo($(2.3242))
+echo($(2.982))
+echo($(123912.1))
+echo($(123912.1823))
+echo($(5.0))
+echo($(1e100))
+echo($(1e1000000))
+echo($(-1e1000000))
+echo($(0.0/0.0))
+
+# nil tests
+var x: seq[string]
+var y: string
+echo(x)
+echo(y)
diff --git a/tests/system/tsettostring.nim b/tests/system/tsettostring.nim
deleted file mode 100644
index c6846ee99..000000000
--- a/tests/system/tsettostring.nim
+++ /dev/null
@@ -1,8 +0,0 @@
-discard """
-  output: "{a, b, c}"
-"""
-
-# bug #2395
-
-let alphaSet: set[char] = {'a'..'c'}
-echo alphaSet
diff --git a/tests/template/annotate.nim b/tests/template/annotate.nim
index fa58030dc..5f395557b 100644
--- a/tests/template/annotate.nim
+++ b/tests/template/annotate.nim
@@ -110,4 +110,4 @@ when isMainModule:
     echo styles
     echo body
     echo info
-    echo shader
\ No newline at end of file
+    echo shader
diff --git a/tests/template/mtempl5.nim b/tests/template/mtempl5.nim
index 51e8461b8..3c2881764 100644
--- a/tests/template/mtempl5.nim
+++ b/tests/template/mtempl5.nim
@@ -1,10 +1,10 @@
 
-var 
+var
   gx = 88
   gy = 44
-  
+
 template templ*(): int =
   bind gx, gy
   gx + gy
-  
+
 
diff --git a/tests/template/otests.nim b/tests/template/otests.nim
index c885e23df..120146343 100644
--- a/tests/template/otests.nim
+++ b/tests/template/otests.nim
@@ -1,219 +1,219 @@
-# Fields

-const x = 5

-

-

-# Test substring

-static:

-    assert "test".substring(3)   == "t"

-    assert "test".substring(2,1) == "s"

-    assert "test".substring(3,2) == "t"

-    assert "test".substring(1,2) == "es"

-

-

-# Various parsing tests

-when true:

-

-    block: #no_substitution

-        proc actual: string = tmpli html"""

-            <p>Test!</p>

-        """

-        const expected = html"""

-            <p>Test!</p>

-        """

-        doAssert actual() == expected

-

-    block: #basic

-        proc actual: string = tmpli html"""

-            <p>Test $$x</p>

-            $x

-        """

-        const expected = html"""

-            <p>Test $x</p>

-            5

-        """

-        doAssert actual() == expected

-

-    block: #expression

-        proc actual: string = tmpli html"""

-            <p>Test $$(x * 5)</p>

-            $(x * 5)

-        """

-        const expected = html"""

-            <p>Test $(x * 5)</p>

-            25

-        """

-        doAssert actual() == expected

-

-    block: #escape

-        proc actual: string = tmpli js"""

-            [{

-                "hello world"

-            }]

-        """

-        const expected = js"""

-            [{

-                "hello world"

-            }]

-        """

-        doAssert actual() == expected

-

-    block: #forIn

-        proc actual: string = tmpli html"""

-            <p>Test for</p>

-            <ul>

-                $for y in 0..2 {

-                    <li>$y</li>

-                }

-            </ul>

-        """

-        const expected = html"""

-            <p>Test for</p>

-            <ul>

-                <li>0</li>

-                <li>1</li>

-                <li>2</li>

-            </ul>

-        """

-        doAssert actual() == expected

-

-    block: #while

-        proc actual: string = tmpli html"""

-            <p>Test while/stmt</p>

-            <ul>

-                ${ var y = 0 }

-                $while y < 4 {

-                    <li>$y</li>

-                    ${ inc(y) }

-                }

-            </ul>

-        """

-        const expected = html"""

-            <p>Test while/stmt</p>

-            <ul>

-                <li>0</li>

-                <li>1</li>

-                <li>2</li>

-                <li>3</li>

-            </ul>

-        """

-        doAssert actual() == expected

-

-    block: #ifElifElse

-        proc actual: string = tmpli html"""

-            <p>Test if/elif/else</p>

-            $if x == 8 {

-                <div>x is 8!</div>

-            }

-            $elif x == 7 {

-                <div>x is 7!</div>

-            }

-            $else {

-                <div>x is neither!</div>

-            }

-        """

-        const expected = html"""

-            <p>Test if/elif/else</p>

-            <div>x is neither!</div>

-        """

-        doAssert actual() == expected

-

-    block: #multiLineStatements

-        proc actual: string = tmpli html"""

-            <p>Test multiline statements</p>

-            ${

-                var x = 5

-                var y = 7

-            }

-            <span>$x</span><span>$y</span>

-        """

-        const expected = html"""

-            <p>Test multiline statements</p>

-            <span>5</span><span>7</span>

-        """

-        doAssert actual() == expected

-

-    block: #caseOfElse

-        proc actual: string = tmpli html"""

-            <p>Test case</p>

-            $case x

-            $of 5 {

-                <div>x == 5</div>

-            }

-            $of 6 {

-                <div>x == 6</div>

-            }

-            $else {}

-        """

-        const expected = html"""

-            <p>Test case</p>

-            <div>x == 5</div>

-        """

-        doAssert actual() == expected

-

-

-

-when true: #embeddingTest

-    proc no_substitution: string = tmpli html"""

-        <h1>Template test!</h1>

-    """

-

-    # # Single variable substitution

-    proc substitution(who = "nobody"): string = tmpli html"""

-        <div id="greeting">hello $who!</div>

-    """

-

-    # Expression template

-    proc test_expression(nums: openarray[int] = []): string =

-        var i = 2

-        tmpli html"""

-            $(no_substitution())

-            $(substitution("Billy"))

-            <div id="age">Age: $($nums[i] & "!!")</div>

-        """

-

-    proc test_statements(nums: openarray[int] = []): string =

-        tmpli html"""

-            $(test_expression(nums))

-            $if true {

-                <ul>

-                    $for i in nums {

-                        <li>$(i * 2)</li>

-                    }

-                </ul>

-            }

-        """

-

-    var actual = test_statements([0,1,2])

-    const expected = html"""

-        <h1>Template test!</h1>

-        <div id="greeting">hello Billy!</div>

-        <div id="age">Age: 2!!</div>

-        <ul>

-            <li>0</li>

-            <li>2</li>

-            <li>4</li>

-        </ul>

-    """

-    doAssert actual == expected

-

-

-when defined(future):

-    block: #tryCatch

-        proc actual: string = tmpli html"""

-            <p>Test try/catch</p>

-            <div>

-                $try {

-                    <div>Lets try this!</div>

-                }

-                $except {

-                    <div>Uh oh!</div>

-                }

-            </div>

-        """

-        const expected = html"""

-            <p>Test try/catch</p>

-            <div>

-                    <div>Lets try this!</div>

-            </div>

-        """

-        doAssert actual() == expected
\ No newline at end of file
+# Fields
+const x = 5
+
+
+# Test substring
+static:
+    assert "test".substring(3)   == "t"
+    assert "test".substring(2,1) == "s"
+    assert "test".substring(3,2) == "t"
+    assert "test".substring(1,2) == "es"
+
+
+# Various parsing tests
+when true:
+
+    block: #no_substitution
+        proc actual: string = tmpli html"""
+            <p>Test!</p>
+        """
+        const expected = html"""
+            <p>Test!</p>
+        """
+        doAssert actual() == expected
+
+    block: #basic
+        proc actual: string = tmpli html"""
+            <p>Test $$x</p>
+            $x
+        """
+        const expected = html"""
+            <p>Test $x</p>
+            5
+        """
+        doAssert actual() == expected
+
+    block: #expression
+        proc actual: string = tmpli html"""
+            <p>Test $$(x * 5)</p>
+            $(x * 5)
+        """
+        const expected = html"""
+            <p>Test $(x * 5)</p>
+            25
+        """
+        doAssert actual() == expected
+
+    block: #escape
+        proc actual: string = tmpli js"""
+            [{
+                "hello world"
+            }]
+        """
+        const expected = js"""
+            [{
+                "hello world"
+            }]
+        """
+        doAssert actual() == expected
+
+    block: #forIn
+        proc actual: string = tmpli html"""
+            <p>Test for</p>
+            <ul>
+                $for y in 0..2 {
+                    <li>$y</li>
+                }
+            </ul>
+        """
+        const expected = html"""
+            <p>Test for</p>
+            <ul>
+                <li>0</li>
+                <li>1</li>
+                <li>2</li>
+            </ul>
+        """
+        doAssert actual() == expected
+
+    block: #while
+        proc actual: string = tmpli html"""
+            <p>Test while/stmt</p>
+            <ul>
+                ${ var y = 0 }
+                $while y < 4 {
+                    <li>$y</li>
+                    ${ inc(y) }
+                }
+            </ul>
+        """
+        const expected = html"""
+            <p>Test while/stmt</p>
+            <ul>
+                <li>0</li>
+                <li>1</li>
+                <li>2</li>
+                <li>3</li>
+            </ul>
+        """
+        doAssert actual() == expected
+
+    block: #ifElifElse
+        proc actual: string = tmpli html"""
+            <p>Test if/elif/else</p>
+            $if x == 8 {
+                <div>x is 8!</div>
+            }
+            $elif x == 7 {
+                <div>x is 7!</div>
+            }
+            $else {
+                <div>x is neither!</div>
+            }
+        """
+        const expected = html"""
+            <p>Test if/elif/else</p>
+            <div>x is neither!</div>
+        """
+        doAssert actual() == expected
+
+    block: #multiLineStatements
+        proc actual: string = tmpli html"""
+            <p>Test multiline statements</p>
+            ${
+                var x = 5
+                var y = 7
+            }
+            <span>$x</span><span>$y</span>
+        """
+        const expected = html"""
+            <p>Test multiline statements</p>
+            <span>5</span><span>7</span>
+        """
+        doAssert actual() == expected
+
+    block: #caseOfElse
+        proc actual: string = tmpli html"""
+            <p>Test case</p>
+            $case x
+            $of 5 {
+                <div>x == 5</div>
+            }
+            $of 6 {
+                <div>x == 6</div>
+            }
+            $else {}
+        """
+        const expected = html"""
+            <p>Test case</p>
+            <div>x == 5</div>
+        """
+        doAssert actual() == expected
+
+
+
+when true: #embeddingTest
+    proc no_substitution: string = tmpli html"""
+        <h1>Template test!</h1>
+    """
+
+    # # Single variable substitution
+    proc substitution(who = "nobody"): string = tmpli html"""
+        <div id="greeting">hello $who!</div>
+    """
+
+    # Expression template
+    proc test_expression(nums: openarray[int] = []): string =
+        var i = 2
+        tmpli html"""
+            $(no_substitution())
+            $(substitution("Billy"))
+            <div id="age">Age: $($nums[i] & "!!")</div>
+        """
+
+    proc test_statements(nums: openarray[int] = []): string =
+        tmpli html"""
+            $(test_expression(nums))
+            $if true {
+                <ul>
+                    $for i in nums {
+                        <li>$(i * 2)</li>
+                    }
+                </ul>
+            }
+        """
+
+    var actual = test_statements([0,1,2])
+    const expected = html"""
+        <h1>Template test!</h1>
+        <div id="greeting">hello Billy!</div>
+        <div id="age">Age: 2!!</div>
+        <ul>
+            <li>0</li>
+            <li>2</li>
+            <li>4</li>
+        </ul>
+    """
+    doAssert actual == expected
+
+
+when defined(future):
+    block: #tryCatch
+        proc actual: string = tmpli html"""
+            <p>Test try/catch</p>
+            <div>
+                $try {
+                    <div>Lets try this!</div>
+                }
+                $except {
+                    <div>Uh oh!</div>
+                }
+            </div>
+        """
+        const expected = html"""
+            <p>Test try/catch</p>
+            <div>
+                    <div>Lets try this!</div>
+            </div>
+        """
+        doAssert actual() == expected
diff --git a/tests/template/sunset.tmpl b/tests/template/sunset.tmpl
index 6475bac4e..465b12a5e 100644
--- a/tests/template/sunset.tmpl
+++ b/tests/template/sunset.tmpl
@@ -1,4 +1,4 @@
-#! stdtmpl
+#? stdtmpl
 #proc sunsetTemplate*(current, ticker, content: string,
 #                     tabs: openarray[array[0..1, string]]): string = 
 #  result = ""
diff --git a/tests/template/t_otemplates.nim b/tests/template/t_otemplates.nim
index db535d818..6c419f72f 100644
--- a/tests/template/t_otemplates.nim
+++ b/tests/template/t_otemplates.nim
@@ -2,344 +2,344 @@ discard """
   output: "Success"
 """
 
-# Ref:

-# http://nim-lang.org/macros.html

-# http://nim-lang.org/parseutils.html

-

-

-# Imports

-import tables, parseutils, macros, strutils

-import annotate

-export annotate

-

-

-# Fields

-const identChars = {'a'..'z', 'A'..'Z', '0'..'9', '_'}

-

-

-# Procedure Declarations

-proc parse_template(node: NimNode, value: string) {.compiletime.}

-

-

-# Procedure Definitions

-proc substring(value: string, index: int, length = -1): string {.compiletime.} =

-    ## Returns a string at most `length` characters long, starting at `index`.

-    return if length < 0:    value.substr(index)

-           elif length == 0: ""

-           else:             value.substr(index, index + length-1)

-

-

-proc parse_thru_eol(value: string, index: int): int {.compiletime.} =

-    ## Reads until and past the end of the current line, unless

-    ## a non-whitespace character is encountered first

-    var remainder: string

-    var read = value.parseUntil(remainder, {0x0A.char}, index)

-    if remainder.skipWhitespace() == read:

-        return read + 1

-

-

-proc trim_after_eol(value: var string) {.compiletime.} =

-    ## Trims any whitespace at end after \n

-    var toTrim = 0

-    for i in countdown(value.len-1, 0):

-        # If \n, return

-        if value[i] in [' ', '\t']: inc(toTrim)

-        else: break

-

-    if toTrim > 0:

-        value = value.substring(0, value.len - toTrim)

-

-

-proc trim_eol(value: var string) {.compiletime.} =

-    ## Removes everything after the last line if it contains nothing but whitespace

-    for i in countdown(value.len - 1, 0):

-        # If \n, trim and return

-        if value[i] == 0x0A.char:

-            value = value.substr(0, i)

-            break

-

-        # This is the first character

-        if i == 0:

-            value = ""

-            break

-

-        # Skip change

-        if not (value[i] in [' ', '\t']): break

-

-

-proc detect_indent(value: string, index: int): int {.compiletime.} =

-    ## Detects how indented the line at `index` is.

-    # Seek to the beginning of the line.

-    var lastChar = index

-    for i in countdown(index, 0):

-        if value[i] == 0x0A.char:

-            # if \n, return the indentation level

-            return lastChar - i

-        elif not (value[i] in [' ', '\t']):

-            # if non-whitespace char, decrement lastChar

-            dec(lastChar)

-

-

-proc parse_thru_string(value: string, i: var int, strType = '"') {.compiletime.} =

-    ## Parses until ending " or ' is reached.

-    inc(i)

-    if i < value.len-1:

-        inc(i, value.skipUntil({'\\', strType}, i))

-

-

-proc parse_to_close(value: string, index: int, open='(', close=')', opened=0): int {.compiletime.} =

-    ## Reads until all opened braces are closed

-    ## ignoring any strings "" or ''

-    var remainder   = value.substring(index)

-    var open_braces = opened

-    result = 0

-

-    while result < remainder.len:

-        var c = remainder[result]

-

-        if   c == open:  inc(open_braces)

-        elif c == close: dec(open_braces)

-        elif c == '"':   remainder.parse_thru_string(result)

-        elif c == '\'':  remainder.parse_thru_string(result, '\'')

-

-        if open_braces == 0: break

-        else: inc(result)

-

-

-iterator parse_stmt_list(value: string, index: var int): string =

-    ## Parses unguided ${..} block

-    var read        = value.parse_to_close(index, open='{', close='}')

-    var expressions = value.substring(index + 1, read - 1).split({ ';', 0x0A.char })

-

-    for expression in expressions:

-        let value = expression.strip

-        if value.len > 0:

-            yield value

-

-    #Increment index & parse thru EOL

-    inc(index, read + 1)

-    inc(index, value.parse_thru_eol(index))

-

-

-iterator parse_compound_statements(value, identifier: string, index: int): string =

-    ## Parses through several statements, i.e. if {} elif {} else {}

-    ## and returns the initialization of each as an empty statement

-    ## i.e. if x == 5 { ... } becomes if x == 5: nil.

-

-    template get_next_ident(expected): stmt =

-        var nextIdent: string

-        discard value.parseWhile(nextIdent, {'$'} + identChars, i)

-

-        var next: string

-        var read: int

-

-        if nextIdent == "case":

-            # We have to handle case a bit differently

-            read = value.parseUntil(next, '$', i)

-            inc(i, read)

-            yield next.strip(leading=false) & "\n"

-

-        else:

-            read = value.parseUntil(next, '{', i)

-

-            if nextIdent in expected:

-                inc(i, read)

-                # Parse until closing }, then skip whitespace afterwards

-                read = value.parse_to_close(i, open='{', close='}')

-                inc(i, read + 1)

-                inc(i, value.skipWhitespace(i))

-                yield next & ": nil\n"

-

-            else: break

-

-

-    var i = index

-    while true:

-        # Check if next statement would be valid, given the identifier

-        if identifier in ["if", "when"]:

-            get_next_ident([identifier, "$elif", "$else"])

-

-        elif identifier == "case":

-            get_next_ident(["case", "$of", "$elif", "$else"])

-

-        elif identifier == "try":

-            get_next_ident(["try", "$except", "$finally"])

-

-

-proc parse_complex_stmt(value, identifier: string, index: var int): NimNode {.compiletime.} =

-    ## Parses if/when/try /elif /else /except /finally statements

-

-    # Build up complex statement string

-    var stmtString = newString(0)

-    var numStatements = 0

-    for statement in value.parse_compound_statements(identifier, index):

-        if statement[0] == '$': stmtString.add(statement.substr(1))

-        else:                   stmtString.add(statement)

-        inc(numStatements)

-

-    # Parse stmt string

-    result = parseExpr(stmtString)

-

-    var resultIndex = 0

-

-    # Fast forward a bit if this is a case statement

-    if identifier == "case":

-        inc(resultIndex)

-

-    while resultIndex < numStatements:

-

-        # Detect indentation

-        let indent = detect_indent(value, index)

-

-        # Parse until an open brace `{`

-        var read = value.skipUntil('{', index)

-        inc(index, read + 1)

-

-        # Parse through EOL

-        inc(index, value.parse_thru_eol(index))

-

-        # Parse through { .. }

-        read = value.parse_to_close(index, open='{', close='}', opened=1)

-

-        # Add parsed sub-expression into body

-        var body       = newStmtList()

-        var stmtString = value.substring(index, read)

-        trim_after_eol(stmtString)

-        stmtString = reindent(stmtString, indent)

-        parse_template(body, stmtString)

-        inc(index, read + 1)

-

-        # Insert body into result

-        var stmtIndex = macros.high(result[resultIndex])

-        result[resultIndex][stmtIndex] = body

-

-        # Parse through EOL again & increment result index

-        inc(index, value.parse_thru_eol(index))

-        inc(resultIndex)

-

-

-proc parse_simple_statement(value: string, index: var int): NimNode {.compiletime.} =

-    ## Parses for/while

-

-    # Detect indentation

-    let indent = detect_indent(value, index)

-

-    # Parse until an open brace `{`

-    var splitValue: string

-    var read = value.parseUntil(splitValue, '{', index)

-    result   = parseExpr(splitValue & ":nil")

-    inc(index, read + 1)

-

-    # Parse through EOL

-    inc(index, value.parse_thru_eol(index))

-

-    # Parse through { .. }

-    read = value.parse_to_close(index, open='{', close='}', opened=1)

-

-    # Add parsed sub-expression into body

-    var body       = newStmtList()

-    var stmtString = value.substring(index, read)

-    trim_after_eol(stmtString)

-    stmtString = reindent(stmtString, indent)

-    parse_template(body, stmtString)

-    inc(index, read + 1)

-

-    # Insert body into result

-    var stmtIndex = macros.high(result)

-    result[stmtIndex] = body

-

-    # Parse through EOL again

-    inc(index, value.parse_thru_eol(index))

-

-

-proc parse_until_symbol(node: NimNode, value: string, index: var int): bool {.compiletime.} =

-    ## Parses a string until a $ symbol is encountered, if

-    ## two $$'s are encountered in a row, a split will happen

-    ## removing one of the $'s from the resulting output

-    var splitValue: string

-    var read = value.parseUntil(splitValue, '$', index)

-    var insertionPoint = node.len

-

-    inc(index, read + 1)

-    if index < value.len:

-

-        case value[index]

-        of '$':

-            # Check for duplicate `$`, meaning this is an escaped $

-            node.add newCall("add", ident("result"), newStrLitNode("$"))

-            inc(index)

-

-        of '(':

-            # Check for open `(`, which means parse as simple single-line expression.

-            trim_eol(splitValue)

-            read = value.parse_to_close(index) + 1

-            node.add newCall("add", ident("result"),

-                newCall(bindSym"strip", parseExpr("$" & value.substring(index, read)))

-            )

-            inc(index, read)

-

-        of '{':

-            # Check for open `{`, which means open statement list

-            trim_eol(splitValue)

-            for s in value.parse_stmt_list(index):

-                node.add parseExpr(s)

-

-        else:

-            # Otherwise parse while valid `identChars` and make expression w/ $

-            var identifier: string

-            read = value.parseWhile(identifier, identChars, index)

-

-            if identifier in ["for", "while"]:

-                ## for/while means open simple statement

-                trim_eol(splitValue)

-                node.add value.parse_simple_statement(index)

-

-            elif identifier in ["if", "when", "case", "try"]:

-                ## if/when/case/try means complex statement

-                trim_eol(splitValue)

-                node.add value.parse_complex_stmt(identifier, index)

-

-            elif identifier.len > 0:

-                ## Treat as simple variable

-                node.add newCall("add", ident("result"), newCall("$", ident(identifier)))

-                inc(index, read)

-

-        result = true

-

-    # Insert

-    if splitValue.len > 0:

-        node.insert insertionPoint, newCall("add", ident("result"), newStrLitNode(splitValue))

-

-

-proc parse_template(node: NimNode, value: string) =

-    ## Parses through entire template, outputing valid

-    ## Nim code into the input `node` AST.

-    var index = 0

-    while index < value.len and

-          parse_until_symbol(node, value, index): nil

-

-

-macro tmpli*(body: expr): stmt =

-    result = newStmtList()

-

-    result.add parseExpr("result = \"\"")

-

-    var value = if body.kind in nnkStrLit..nnkTripleStrLit: body.strVal

-                else: body[1].strVal

-

-    parse_template(result, reindent(value))

-

-

-macro tmpl*(body: expr): stmt =

-    result = newStmtList()

-

-    var value = if body.kind in nnkStrLit..nnkTripleStrLit: body.strVal

-                else: body[1].strVal

-

-    parse_template(result, reindent(value))

-

-

-# Run tests

-when isMainModule:

+# Ref:
+# http://nim-lang.org/macros.html
+# http://nim-lang.org/parseutils.html
+
+
+# Imports
+import tables, parseutils, macros, strutils
+import annotate
+export annotate
+
+
+# Fields
+const identChars = {'a'..'z', 'A'..'Z', '0'..'9', '_'}
+
+
+# Procedure Declarations
+proc parse_template(node: NimNode, value: string) {.compiletime.}
+
+
+# Procedure Definitions
+proc substring(value: string, index: int, length = -1): string {.compiletime.} =
+    ## Returns a string at most `length` characters long, starting at `index`.
+    return if length < 0:    value.substr(index)
+           elif length == 0: ""
+           else:             value.substr(index, index + length-1)
+
+
+proc parse_thru_eol(value: string, index: int): int {.compiletime.} =
+    ## Reads until and past the end of the current line, unless
+    ## a non-whitespace character is encountered first
+    var remainder: string
+    var read = value.parseUntil(remainder, {0x0A.char}, index)
+    if remainder.skipWhitespace() == read:
+        return read + 1
+
+
+proc trim_after_eol(value: var string) {.compiletime.} =
+    ## Trims any whitespace at end after \n
+    var toTrim = 0
+    for i in countdown(value.len-1, 0):
+        # If \n, return
+        if value[i] in [' ', '\t']: inc(toTrim)
+        else: break
+
+    if toTrim > 0:
+        value = value.substring(0, value.len - toTrim)
+
+
+proc trim_eol(value: var string) {.compiletime.} =
+    ## Removes everything after the last line if it contains nothing but whitespace
+    for i in countdown(value.len - 1, 0):
+        # If \n, trim and return
+        if value[i] == 0x0A.char:
+            value = value.substr(0, i)
+            break
+
+        # This is the first character
+        if i == 0:
+            value = ""
+            break
+
+        # Skip change
+        if not (value[i] in [' ', '\t']): break
+
+
+proc detect_indent(value: string, index: int): int {.compiletime.} =
+    ## Detects how indented the line at `index` is.
+    # Seek to the beginning of the line.
+    var lastChar = index
+    for i in countdown(index, 0):
+        if value[i] == 0x0A.char:
+            # if \n, return the indentation level
+            return lastChar - i
+        elif not (value[i] in [' ', '\t']):
+            # if non-whitespace char, decrement lastChar
+            dec(lastChar)
+
+
+proc parse_thru_string(value: string, i: var int, strType = '"') {.compiletime.} =
+    ## Parses until ending " or ' is reached.
+    inc(i)
+    if i < value.len-1:
+        inc(i, value.skipUntil({'\\', strType}, i))
+
+
+proc parse_to_close(value: string, index: int, open='(', close=')', opened=0): int {.compiletime.} =
+    ## Reads until all opened braces are closed
+    ## ignoring any strings "" or ''
+    var remainder   = value.substring(index)
+    var open_braces = opened
+    result = 0
+
+    while result < remainder.len:
+        var c = remainder[result]
+
+        if   c == open:  inc(open_braces)
+        elif c == close: dec(open_braces)
+        elif c == '"':   remainder.parse_thru_string(result)
+        elif c == '\'':  remainder.parse_thru_string(result, '\'')
+
+        if open_braces == 0: break
+        else: inc(result)
+
+
+iterator parse_stmt_list(value: string, index: var int): string =
+    ## Parses unguided ${..} block
+    var read        = value.parse_to_close(index, open='{', close='}')
+    var expressions = value.substring(index + 1, read - 1).split({ ';', 0x0A.char })
+
+    for expression in expressions:
+        let value = expression.strip
+        if value.len > 0:
+            yield value
+
+    #Increment index & parse thru EOL
+    inc(index, read + 1)
+    inc(index, value.parse_thru_eol(index))
+
+
+iterator parse_compound_statements(value, identifier: string, index: int): string =
+    ## Parses through several statements, i.e. if {} elif {} else {}
+    ## and returns the initialization of each as an empty statement
+    ## i.e. if x == 5 { ... } becomes if x == 5: nil.
+
+    template get_next_ident(expected): stmt =
+        var nextIdent: string
+        discard value.parseWhile(nextIdent, {'$'} + identChars, i)
+
+        var next: string
+        var read: int
+
+        if nextIdent == "case":
+            # We have to handle case a bit differently
+            read = value.parseUntil(next, '$', i)
+            inc(i, read)
+            yield next.strip(leading=false) & "\n"
+
+        else:
+            read = value.parseUntil(next, '{', i)
+
+            if nextIdent in expected:
+                inc(i, read)
+                # Parse until closing }, then skip whitespace afterwards
+                read = value.parse_to_close(i, open='{', close='}')
+                inc(i, read + 1)
+                inc(i, value.skipWhitespace(i))
+                yield next & ": nil\n"
+
+            else: break
+
+
+    var i = index
+    while true:
+        # Check if next statement would be valid, given the identifier
+        if identifier in ["if", "when"]:
+            get_next_ident([identifier, "$elif", "$else"])
+
+        elif identifier == "case":
+            get_next_ident(["case", "$of", "$elif", "$else"])
+
+        elif identifier == "try":
+            get_next_ident(["try", "$except", "$finally"])
+
+
+proc parse_complex_stmt(value, identifier: string, index: var int): NimNode {.compiletime.} =
+    ## Parses if/when/try /elif /else /except /finally statements
+
+    # Build up complex statement string
+    var stmtString = newString(0)
+    var numStatements = 0
+    for statement in value.parse_compound_statements(identifier, index):
+        if statement[0] == '$': stmtString.add(statement.substr(1))
+        else:                   stmtString.add(statement)
+        inc(numStatements)
+
+    # Parse stmt string
+    result = parseExpr(stmtString)
+
+    var resultIndex = 0
+
+    # Fast forward a bit if this is a case statement
+    if identifier == "case":
+        inc(resultIndex)
+
+    while resultIndex < numStatements:
+
+        # Detect indentation
+        let indent = detect_indent(value, index)
+
+        # Parse until an open brace `{`
+        var read = value.skipUntil('{', index)
+        inc(index, read + 1)
+
+        # Parse through EOL
+        inc(index, value.parse_thru_eol(index))
+
+        # Parse through { .. }
+        read = value.parse_to_close(index, open='{', close='}', opened=1)
+
+        # Add parsed sub-expression into body
+        var body       = newStmtList()
+        var stmtString = value.substring(index, read)
+        trim_after_eol(stmtString)
+        stmtString = reindent(stmtString, indent)
+        parse_template(body, stmtString)
+        inc(index, read + 1)
+
+        # Insert body into result
+        var stmtIndex = result[resultIndex].len-1
+        result[resultIndex][stmtIndex] = body
+
+        # Parse through EOL again & increment result index
+        inc(index, value.parse_thru_eol(index))
+        inc(resultIndex)
+
+
+proc parse_simple_statement(value: string, index: var int): NimNode {.compiletime.} =
+    ## Parses for/while
+
+    # Detect indentation
+    let indent = detect_indent(value, index)
+
+    # Parse until an open brace `{`
+    var splitValue: string
+    var read = value.parseUntil(splitValue, '{', index)
+    result   = parseExpr(splitValue & ":nil")
+    inc(index, read + 1)
+
+    # Parse through EOL
+    inc(index, value.parse_thru_eol(index))
+
+    # Parse through { .. }
+    read = value.parse_to_close(index, open='{', close='}', opened=1)
+
+    # Add parsed sub-expression into body
+    var body       = newStmtList()
+    var stmtString = value.substring(index, read)
+    trim_after_eol(stmtString)
+    stmtString = reindent(stmtString, indent)
+    parse_template(body, stmtString)
+    inc(index, read + 1)
+
+    # Insert body into result
+    var stmtIndex = result.len-1
+    result[stmtIndex] = body
+
+    # Parse through EOL again
+    inc(index, value.parse_thru_eol(index))
+
+
+proc parse_until_symbol(node: NimNode, value: string, index: var int): bool {.compiletime.} =
+    ## Parses a string until a $ symbol is encountered, if
+    ## two $$'s are encountered in a row, a split will happen
+    ## removing one of the $'s from the resulting output
+    var splitValue: string
+    var read = value.parseUntil(splitValue, '$', index)
+    var insertionPoint = node.len
+
+    inc(index, read + 1)
+    if index < value.len:
+
+        case value[index]
+        of '$':
+            # Check for duplicate `$`, meaning this is an escaped $
+            node.add newCall("add", ident("result"), newStrLitNode("$"))
+            inc(index)
+
+        of '(':
+            # Check for open `(`, which means parse as simple single-line expression.
+            trim_eol(splitValue)
+            read = value.parse_to_close(index) + 1
+            node.add newCall("add", ident("result"),
+                newCall(bindSym"strip", parseExpr("$" & value.substring(index, read)))
+            )
+            inc(index, read)
+
+        of '{':
+            # Check for open `{`, which means open statement list
+            trim_eol(splitValue)
+            for s in value.parse_stmt_list(index):
+                node.add parseExpr(s)
+
+        else:
+            # Otherwise parse while valid `identChars` and make expression w/ $
+            var identifier: string
+            read = value.parseWhile(identifier, identChars, index)
+
+            if identifier in ["for", "while"]:
+                ## for/while means open simple statement
+                trim_eol(splitValue)
+                node.add value.parse_simple_statement(index)
+
+            elif identifier in ["if", "when", "case", "try"]:
+                ## if/when/case/try means complex statement
+                trim_eol(splitValue)
+                node.add value.parse_complex_stmt(identifier, index)
+
+            elif identifier.len > 0:
+                ## Treat as simple variable
+                node.add newCall("add", ident("result"), newCall("$", ident(identifier)))
+                inc(index, read)
+
+        result = true
+
+    # Insert
+    if splitValue.len > 0:
+        node.insert insertionPoint, newCall("add", ident("result"), newStrLitNode(splitValue))
+
+
+proc parse_template(node: NimNode, value: string) =
+    ## Parses through entire template, outputing valid
+    ## Nim code into the input `node` AST.
+    var index = 0
+    while index < value.len and
+          parse_until_symbol(node, value, index): nil
+
+
+macro tmpli*(body: expr): stmt =
+    result = newStmtList()
+
+    result.add parseExpr("result = \"\"")
+
+    var value = if body.kind in nnkStrLit..nnkTripleStrLit: body.strVal
+                else: body[1].strVal
+
+    parse_template(result, reindent(value))
+
+
+macro tmpl*(body: expr): stmt =
+    result = newStmtList()
+
+    var value = if body.kind in nnkStrLit..nnkTripleStrLit: body.strVal
+                else: body[1].strVal
+
+    parse_template(result, reindent(value))
+
+
+# Run tests
+when isMainModule:
     include otests
     echo "Success"
diff --git a/tests/template/tdefault_nil.nim b/tests/template/tdefault_nil.nim
new file mode 100644
index 000000000..891166306
--- /dev/null
+++ b/tests/template/tdefault_nil.nim
@@ -0,0 +1,14 @@
+
+# bug #2629
+import sequtils, os
+
+template glob_rst(basedir: string = nil): expr =
+  if baseDir.isNil:
+    to_seq(walk_files("*.rst"))
+  else:
+    to_seq(walk_files(basedir/"*.rst"))
+
+let
+  rst_files = concat(glob_rst(), glob_rst("docs"))
+
+when isMainModule: echo rst_files
diff --git a/tests/template/thygienictempl.nim b/tests/template/thygienictempl.nim
index 3cdbac40e..5e4f534f8 100644
--- a/tests/template/thygienictempl.nim
+++ b/tests/template/thygienictempl.nim
@@ -1,7 +1,7 @@
-    
+
 var
   e = "abc"
-    
+
 raise newException(EIO, e & "ha!")
 
 template t() = echo(foo)
diff --git a/tests/template/tmodulealias.nim b/tests/template/tmodulealias.nim
index a7d155e51..6681379fb 100644
--- a/tests/template/tmodulealias.nim
+++ b/tests/template/tmodulealias.nim
@@ -8,10 +8,10 @@ else:
   import posix
 
 when defined(Windows):
-  template orig: expr = 
+  template orig: expr =
     winlean
 else:
-  template orig: expr = 
+  template orig: expr =
     posix
 
 proc socket(domain, typ, protocol: int): int =
diff --git a/tests/template/tstempl.nim b/tests/template/tstempl.nim
index 2b4a8baa0..649082041 100644
--- a/tests/template/tstempl.nim
+++ b/tests/template/tstempl.nim
@@ -6,7 +6,7 @@ levB'''
 # tstempl.nim
 import strutils
 
-type 
+type
   TLev = enum
     levA,
     levB
@@ -15,10 +15,10 @@ var abclev = levB
 
 template tstLev(abclev: TLev) =
   bind tstempl.abclev, `%`
-  writeln(stdout, "global = $1, arg = $2, test = $3" % [
+  writeLine(stdout, "global = $1, arg = $2, test = $3" % [
     $tstempl.abclev, $abclev, $(tstempl.abclev == abclev)])
   # evaluates to true, but must be false
 
 
 tstLev(levA)
-writeln(stdout, $abclev)
+writeLine(stdout, $abclev)
diff --git a/tests/template/tstmt_semchecked_twice.nim b/tests/template/tstmt_semchecked_twice.nim
new file mode 100644
index 000000000..05c16c3c9
--- /dev/null
+++ b/tests/template/tstmt_semchecked_twice.nim
@@ -0,0 +1,30 @@
+
+# bug #2585
+
+type
+    RenderPass = object
+       state: ref int
+
+    RenderData* = object
+        fb: int
+        walls: seq[RenderPass]
+
+    Mat2 = int
+    Vector2[T] = T
+    Pixels=int
+
+template use*(fb: int, st: stmt) : stmt =
+    echo "a ", $fb
+    st
+    echo "a ", $fb
+
+proc render(rdat: var RenderData; passes: var openarray[RenderPass]; proj: Mat2;
+            indexType = 1) =
+    for i in 0 .. <len(passes):
+        echo "blah ", repr(passes[i])
+
+
+
+proc render2*(rdat: var RenderData; screenSz: Vector2[Pixels]; proj: Mat2) =
+    use rdat.fb:
+        render(rdat, rdat.walls, proj, 1)
diff --git a/tests/template/ttempl.nim b/tests/template/ttempl.nim
index 2c4785325..5f1341990 100644
--- a/tests/template/ttempl.nim
+++ b/tests/template/ttempl.nim
@@ -15,10 +15,10 @@ const
 
 
 var i = 0
-for item in items(tabs): 
+for item in items(tabs):
   var content = $i
   var file: TFile
-  if open(file, changeFileExt(item[1], "html"), fmWrite): 
+  if open(file, changeFileExt(item[1], "html"), fmWrite):
     write(file, sunsetTemplate(current=item[1], ticker="", content=content,
                                tabs=tabs))
     close(file)
diff --git a/tests/template/ttempl2.nim b/tests/template/ttempl2.nim
index 142bbb8c7..aaa2f1344 100644
--- a/tests/template/ttempl2.nim
+++ b/tests/template/ttempl2.nim
@@ -3,12 +3,12 @@ discard """
   line: 18
   errormsg: "undeclared identifier: \'b\'"
 """
-template declareInScope(x: expr, t: typeDesc): stmt {.immediate.} =
+template declareInScope(x: untyped, t: typeDesc): untyped {.immediate.} =
   var x: t
-  
-template declareInNewScope(x: expr, t: typeDesc): stmt {.immediate.} =
+
+template declareInNewScope(x: untyped, t: typeDesc): untyped {.immediate.} =
   # open a new scope:
-  block: 
+  block:
     var x: t
 
 declareInScope(a, int)
diff --git a/tests/template/ttempl3.nim b/tests/template/ttempl3.nim
index 59be24624..56daf9fe6 100644
--- a/tests/template/ttempl3.nim
+++ b/tests/template/ttempl3.nim
@@ -11,18 +11,18 @@ template withOpenFile(f: expr, filename: string, mode: TFileMode,
         close(f)
     else:
       quit("cannot open for writing: " & filename)
-    
+
 withOpenFile(txt, "ttempl3.txt", fmWrite):
-  writeln(txt, "line 1")
-  txt.writeln("line 2")
-  
+  writeLine(txt, "line 1")
+  txt.writeLine("line 2")
+
 var
   myVar: array[0..1, int]
 
-# Test zero argument template: 
+# Test zero argument template:
 template ha: expr = myVar[0]
-  
-ha = 1  
+
+ha = 1
 echo(ha)
 
 
@@ -37,7 +37,7 @@ template typedef(name: expr, typ: typeDesc) {.immediate, dirty.} =
   type
     `T name`* = typ
     `P name`* = ref `T name`
-    
+
 typedef(myint, int)
 var x: PMyInt
 
diff --git a/tests/template/twhen_gensym.nim b/tests/template/twhen_gensym.nim
new file mode 100644
index 000000000..d84ee6f03
--- /dev/null
+++ b/tests/template/twhen_gensym.nim
@@ -0,0 +1,13 @@
+discard """
+  output: "hi"
+"""
+
+# bug #2670
+template testTemplate(b: bool): stmt =
+    when b:
+        var a = "hi"
+    else:
+        var a = 5
+    echo a
+
+testTemplate(true)
diff --git a/tests/template/twrongmapit.nim b/tests/template/twrongmapit.nim
index bca1292b8..df695fcd6 100644
--- a/tests/template/twrongmapit.nim
+++ b/tests/template/twrongmapit.nim
@@ -1,7 +1,5 @@
 discard """
-  errormsg: "'"
-  file: "sequtils.nim"
-  line: 435
+  output: "####"
 """
 # unfortunately our tester doesn't support multiple lines of compiler
 # error messages yet...
@@ -29,4 +27,6 @@ when ATTEMPT == 0:
 # bug #1543
 import sequtils
 
-(var i= @[""];i).mapIt(it)
+(var i = @[""];i).applyIt(it)
+# now works:
+echo "##", i[0], "##"
diff --git a/tests/template/twrongopensymchoice.nim b/tests/template/twrongopensymchoice.nim
index 5a02a813c..360c92037 100644
--- a/tests/template/twrongopensymchoice.nim
+++ b/tests/template/twrongopensymchoice.nim
@@ -4,11 +4,11 @@ discard """
 
 # bug #940
 
-type 
-  Foo* = ref object 
+type
+  Foo* = ref object
     b*: int
 
-proc new*(this: var Foo) = 
+proc new*(this: var Foo) =
   assert this != nil
   this.b = 10
 
diff --git a/tests/template/twrongsymkind.nim b/tests/template/twrongsymkind.nim
new file mode 100644
index 000000000..be3d8c652
--- /dev/null
+++ b/tests/template/twrongsymkind.nim
@@ -0,0 +1,20 @@
+discard """
+  errormsg: "cannot use symbol of kind 'var' as a 'param'"
+  line: 20
+"""
+
+# bug #3158
+
+type
+  MyData = object
+      x: int
+
+template newDataWindow(data: ref MyData): stmt =
+    proc testProc(data: ref MyData) =
+        echo "Hello, ", data.x
+    testProc(data)
+
+var d: ref MyData
+new(d)
+d.x = 10
+newDataWindow(d)
diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim
index 11743c337..e2e2e2dd5 100644
--- a/tests/testament/backend.nim
+++ b/tests/testament/backend.nim
@@ -81,34 +81,34 @@ proc getCommit(db: TDbConn): CommitId =
   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 (?, ?)", 
+    result = db.insertId(sql"insert into [Commit](hash, branch) values (?, ?)",
                          hash, branch).CommitId
 
-proc writeTestResult*(name, category, target, 
+proc writeTestResult*(name, category, target,
                       action, result, expected, given: string) =
-  let id = db.getValue(sql"""select id from TestResult 
+  let id = db.getValue(sql"""select id from TestResult
                              where name = ? and category = ? and target = ? and
-                                machine = ? and [commit] = ?""", 
+                                machine = ? and [commit] = ?""",
                                 name, category, target,
                                 thisMachine, thisCommit)
   if id.len > 0:
     db.exec(sql"""update TestResult
-                  set action = ?, result = ?, expected = ?, given = ? 
+                  set action = ?, result = ?, expected = ?, given = ?
                   where id = ?""", action, result, expected, given, id)
   else:
-    db.exec(sql"""insert into TestResult(name, category, target, 
-                                         action, 
+    db.exec(sql"""insert into TestResult(name, category, target,
+                                         action,
                                          result, expected, given,
                                          [commit], machine)
-                  values (?,?,?,?,?,?,?,?,?) """, name, category, target, 
+                  values (?,?,?,?,?,?,?,?,?) """, name, category, target,
                                         action,
-                                        result, expected, given, 
+                                        result, expected, given,
                                         thisCommit, thisMachine)
 
 proc open*() =
diff --git a/tests/testament/caasdriver.nim b/tests/testament/caasdriver.nim
index c61a9f108..30383bddb 100644
--- a/tests/testament/caasdriver.nim
+++ b/tests/testament/caasdriver.nim
@@ -137,11 +137,11 @@ proc doScenario(script: string, output: Stream, mode: TRunMode, verbose: bool):
       if line.strip.len == 0: continue
 
       if line.startsWith("#"):
-        output.writeln line
+        output.writeLine line
         continue
       elif line.startsWith(">"):
         s.doCommand(line.substr(1).strip)
-        output.writeln line, "\n", if verbose: s.lastOutput else: ""
+        output.writeLine line, "\n", if verbose: s.lastOutput else: ""
       else:
         var expectMatch = true
         var pattern = s.replaceVars(line)
@@ -153,9 +153,9 @@ proc doScenario(script: string, output: Stream, mode: TRunMode, verbose: bool):
           s.lastOutput.find(re(pattern, flags = {reStudy})) != -1
 
         if expectMatch == actualMatch:
-          output.writeln "SUCCESS ", line
+          output.writeLine "SUCCESS ", line
         else:
-          output.writeln "FAILURE ", line
+          output.writeLine "FAILURE ", line
           result = false
 
 iterator caasTestsRunner*(filter = "", verbose = false): tuple[test,
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index 4476fccf2..3166942ec 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -89,8 +89,11 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
     var libpath = getEnv"LD_LIBRARY_PATH".string
     # Temporarily add the lib directory to LD_LIBRARY_PATH:
     putEnv("LD_LIBRARY_PATH", "lib:" & libpath)
+    defer: putEnv("LD_LIBRARY_PATH", libpath)
     var serverDll = DynlibFormat % "server"
     safeCopyFile("tests/dll" / serverDll, "lib" / serverDll)
+    var nimrtlDll = DynlibFormat % "nimrtl"
+    safeCopyFile("tests/dll" / nimrtlDll, "lib" / nimrtlDll)
 
   testSpec r, makeTest("tests/dll/client.nim", options & " -d:useNimRtl",
                        cat, actionRun)
@@ -114,13 +117,23 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
     testSpec r, makeTest("tests/gc" / filename, options &
                   " -d:release -d:useRealtimeGC", cat, actionRun)
 
-  template test(filename: expr): stmt =
+  template testWithoutBoehm(filename: expr): stmt =
     testWithoutMs filename
     testSpec r, makeTest("tests/gc" / filename, options &
                   " --gc:markAndSweep", cat, actionRun)
     testSpec r, makeTest("tests/gc" / filename, options &
                   " -d:release --gc:markAndSweep", cat, actionRun)
-
+  template test(filename: expr): stmt =
+    testWithoutBoehm filename
+    when not defined(windows):
+      # AR: cannot find any boehm.dll on the net, right now, so disabled
+      # for windows:
+      testSpec r, makeTest("tests/gc" / filename, options &
+                    " --gc:boehm", cat, actionRun)
+      testSpec r, makeTest("tests/gc" / filename, options &
+                    " -d:release --gc:boehm", cat, actionRun)
+
+  test "gcemscripten"
   test "growobjcrash"
   test "gcbench"
   test "gcleak"
@@ -130,14 +143,26 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
   test "gcleak4"
   # Disabled because it works and takes too long to run:
   #test "gcleak5"
-  test "weakrefs"
+  testWithoutBoehm "weakrefs"
   test "cycleleak"
-  test "closureleak"
+  testWithoutBoehm "closureleak"
   testWithoutMs "refarrayleak"
 
   test "stackrefleak"
   test "cyclecollector"
 
+proc longGCTests(r: var TResults, cat: Category, options: string) =
+  when defined(windows):
+    let cOptions = "gcc -ldl -DWIN"
+  else:
+    let cOptions = "gcc -ldl"
+
+  var c = initResults()
+  # According to ioTests, this should compile the file
+  testNoSpec c, makeTest("tests/realtimeGC/shared", options, cat, actionCompile)
+  testC r, makeTest("tests/realtimeGC/cmain", cOptions, cat, actionRun)
+  testSpec r, makeTest("tests/realtimeGC/nmain", options & "--threads: on", cat, actionRun)
+
 # ------------------------- threading tests -----------------------------------
 
 proc threadTests(r: var TResults, cat: Category, options: string) =
@@ -226,7 +251,7 @@ 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)
+      testSpec r, makeTest(test, options, cat, actionRunNoSpec)
     else:
       testNoSpec r, makeTest(test, options, cat, actionCompile)
 
@@ -327,7 +352,7 @@ 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) =
+proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") =
   case cat.string.normalize
   of "rodfiles":
     discard # Disabled for now
@@ -340,6 +365,8 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
     dllTests(r, cat, options)
   of "gc":
     gcTests(r, cat, options)
+  of "longgc":
+    longGCTests(r, cat, options)
   of "debugger":
     debuggerTests(r, cat, options)
   of "manyloc":
@@ -362,5 +389,5 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
   of "nimble-all":
     testNimblePackages(r, cat, pfAll)
   else:
-    for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
+    for name in os.walkFiles("tests" & DirSep &.? cat.string / fileGlob):
       testSpec r, makeTest(name, options, cat)
diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim
index a9f739995..98ccf1170 100644
--- a/tests/testament/htmlgen.nim
+++ b/tests/testament/htmlgen.nim
@@ -138,7 +138,7 @@ proc generateHtml*(filename: string, commit: int; onlyFailing: bool) =
   # 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.writeLine """<li><a href="#$#">$#: $#, $#</a></li>""" % m
   outfile.write("</ul>")
 
   for currentMachine in db.rows(sql"select id from Machine order by id"):
@@ -195,7 +195,7 @@ proc generateJson*(filename: string, commit: int) =
   let machine = $backend.getMachine(db)
   let data = db.getRow(sql(selRow), lastCommit, machine)
 
-  outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#""" % data)
+  outfile.writeLine("""{"total": $#, "passed": $#, "skipped": $#""" % data)
 
   let results = newJArray()
   for row in db.rows(sql(selResults), lastCommit):
@@ -208,7 +208,7 @@ proc generateJson*(filename: string, commit: int) =
     obj["expected"] = %row[5]
     obj["given"] = %row[6]
     results.add(obj)
-  outfile.writeln(""", "results": """)
+  outfile.writeLine(""", "results": """)
   outfile.write(results.pretty)
 
   if not previousCommit.isNil:
@@ -220,9 +220,9 @@ proc generateJson*(filename: string, commit: int) =
       obj["old"] = %row[1]
       obj["new"] = %row[2]
       diff.add obj
-    outfile.writeln(""", "diff": """)
-    outfile.writeln(diff.pretty)
+    outfile.writeLine(""", "diff": """)
+    outfile.writeLine(diff.pretty)
 
-  outfile.writeln "}"
+  outfile.writeLine "}"
   close(db)
   close(outfile)
diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim
index 2a8a4ea24..bab17d2cd 100644
--- a/tests/testament/specs.nim
+++ b/tests/testament/specs.nim
@@ -10,13 +10,14 @@
 import parseutils, strutils, os, osproc, streams, parsecfg
 
 const
-  cmdTemplate* = r"nim $target --hints:on $options $file"
+  cmdTemplate* = r"compiler" / "nim $target --lib:lib --hints:on -d:testing $options $file"
 
 type
   TTestAction* = enum
     actionCompile = "compile"
     actionRun = "run"
     actionReject = "reject"
+    actionRunNoSpec = "runNoSpec"
   TResultEnum* = enum
     reNimcCrash,     # nim compiler seems to have crashed
     reMsgsDiffer,       # error messages differ
@@ -42,7 +43,10 @@ type
     action*: TTestAction
     file*, cmd*: string
     outp*: string
-    line*, exitCode*: int
+    line*, column*: int
+    tfile*: string
+    tline*, tcolumn*: int
+    exitCode*: int
     msg*: string
     ccodeCheck*: string
     err*: TResultEnum
@@ -77,7 +81,7 @@ proc extractSpec(filename: string): string =
 when not defined(nimhygiene):
   {.pragma: inject.}
 
-template parseSpecAux(fillResult: stmt) {.immediate.} =
+template parseSpecAux(fillResult: untyped) =
   var ss = newStringStream(extractSpec(filename))
   var p {.inject.}: CfgParser
   open(p, ss, filename, 1)
@@ -91,13 +95,21 @@ template parseSpecAux(fillResult: stmt) {.immediate.} =
       fillResult
   close(p)
 
-proc parseSpec*(filename: string): TSpec =
-  result.file = filename
+proc specDefaults*(result: var TSpec) =
   result.msg = ""
   result.outp = ""
   result.nimout = ""
   result.ccodeCheck = ""
   result.cmd = cmdTemplate
+  result.line = 0
+  result.column = 0
+  result.tfile = ""
+  result.tline = 0
+  result.tcolumn = 0
+
+proc parseSpec*(filename: string): TSpec =
+  specDefaults(result)
+  result.file = filename
   parseSpecAux:
     case normalize(e.key)
     of "action":
@@ -108,7 +120,11 @@ proc parseSpec*(filename: string): TSpec =
       else: echo ignoreMsg(p, e)
     of "file": result.file = e.value
     of "line": discard parseInt(e.value, result.line)
-    of "output": 
+    of "column": discard parseInt(e.value, result.column)
+    of "tfile": result.tfile = e.value
+    of "tline": discard parseInt(e.value, result.tline)
+    of "tcolumn": discard parseInt(e.value, result.tcolumn)
+    of "output":
       result.action = actionRun
       result.outp = e.value
     of "outputsub":
@@ -117,7 +133,7 @@ proc parseSpec*(filename: string): TSpec =
       result.substr = true
     of "sortoutput":
       result.sortoutput = parseCfgBool(e.value)
-    of "exitcode": 
+    of "exitcode":
       discard parseInt(e.value, result.exitCode)
     of "msg":
       result.msg = e.value
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index 7391b105e..636093a7f 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -12,7 +12,7 @@
 import
   parseutils, strutils, pegs, os, osproc, streams, parsecfg, json,
   marshal, backend, parseopt, specs, htmlgen, browsers, terminal,
-  algorithm, compiler/nodejs
+  algorithm, compiler/nodejs, re
 
 const
   resultsFile = "testresults.html"
@@ -23,6 +23,7 @@ const
 Command:
   all                         run all tests
   c|category <category>       run all the tests of a certain category
+  r|run <test>                run single test file
   html [commit]               generate $1 from the database; uses the latest
                               commit or a specific one (use -1 for the commit
                               before latest etc)
@@ -31,6 +32,7 @@ Arguments:
 Options:
   --print                   also print results to the console
   --failing                 only show failing/ignored tests
+  --pedantic                return non-zero status code if there are failures
 """ % resultsFile
 
 type
@@ -50,7 +52,9 @@ type
 
 let
   pegLineError =
-    peg"{[^(]*} '(' {\d+} ', ' \d+ ') ' ('Error') ':' \s* {.*}"
+    peg"{[^(]*} '(' {\d+} ', ' {\d+} ') ' ('Error') ':' \s* {.*}"
+  pegLineTemplate =
+    peg"{[^(]*} '(' {\d+} ', ' {\d+} ') ' 'template/generic instantiation from here'.*"
   pegOtherError = peg"'Error:' \s* {.*}"
   pegSuccess = peg"'Hint: operation successful'.*"
   pegOfInterest = pegLineError / pegOtherError
@@ -64,6 +68,7 @@ proc callCompiler(cmdTemplate, filename, options: string,
   let outp = p.outputStream
   var suc = ""
   var err = ""
+  var tmpl = ""
   var x = newStringOfCap(120)
   result.nimout = ""
   while outp.readLine(x.TaintedString) or running(p):
@@ -71,22 +76,53 @@ proc callCompiler(cmdTemplate, filename, options: string,
     if x =~ pegOfInterest:
       # `err` should contain the last error/warning message
       err = x
+    elif x =~ pegLineTemplate and err == "":
+      # `tmpl` contains the last template expansion before the error
+      tmpl = x
     elif x =~ pegSuccess:
       suc = x
   close(p)
   result.msg = ""
   result.file = ""
   result.outp = ""
-  result.line = -1
+  result.line = 0
+  result.column = 0
+  result.tfile = ""
+  result.tline = 0
+  result.tcolumn = 0
+  if tmpl =~ pegLineTemplate:
+    result.tfile = extractFilename(matches[0])
+    result.tline = parseInt(matches[1])
+    result.tcolumn = parseInt(matches[2])
   if err =~ pegLineError:
     result.file = extractFilename(matches[0])
     result.line = parseInt(matches[1])
-    result.msg = matches[2]
+    result.column = parseInt(matches[2])
+    result.msg = matches[3]
   elif err =~ pegOtherError:
     result.msg = matches[0]
   elif suc =~ pegSuccess:
     result.err = reSuccess
 
+proc callCCompiler(cmdTemplate, filename, options: string,
+                  target: TTarget): TSpec =
+  let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target],
+                       "options", options, "file", filename.quoteShell])
+  var p = startProcess(command="gcc", args=c[5.. ^1],
+                       options={poStdErrToStdOut, poUsePath})
+  let outp = p.outputStream
+  var x = newStringOfCap(120)
+  result.nimout = ""
+  result.msg = ""
+  result.file = ""
+  result.outp = ""
+  result.line = -1
+  while outp.readLine(x.TaintedString) or running(p):
+    result.nimout.add(x & "\n")
+  close(p)
+  if p.peekExitCode == 0:
+    result.err = reSuccess
+
 proc initResults: TResults =
   result.total = 0
   result.passed = 0
@@ -115,23 +151,38 @@ proc addResult(r: var TResults, test: TTest,
                           expected = expected,
                           given = given)
   r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
-  if success == reIgnored:
-    styledEcho styleBright, name, fgYellow, " [", $success, "]"
-  elif success != reSuccess:
-    styledEcho styleBright, name, fgRed, " [", $success, "]"
-    echo"Expected:"
-    styledEcho styleBright, expected
-    echo"Given:"
-    styledEcho styleBright, given
+  if success == reSuccess:
+    styledEcho fgGreen, "PASS: ", fgCyan, name
+  elif success == reIgnored:
+    styledEcho styleDim, fgYellow, "SKIP: ", styleBright, fgCyan, name
+  else:
+    styledEcho styleBright, fgRed, "FAIL: ", fgCyan, name
+    styledEcho styleBright, fgCyan, "Test \"", test.name, "\"", " in category \"", test.cat.string, "\""
+    styledEcho styleBright, fgRed, "Failure: ", $success
+    styledEcho fgYellow, "Expected:"
+    styledEcho styleBright, expected, "\n"
+    styledEcho fgYellow, "Gotten:"
+    styledEcho styleBright, given, "\n"
 
 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
+  elif expected.tfile == "" and 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)
+  elif expected.line   != given.line   and expected.line   != 0 or
+       expected.column != given.column and expected.column != 0:
+    r.addResult(test, $expected.line & ':' & $expected.column,
+                      $given.line    & ':' & $given.column,
+                      reLinesDiffer)
+  elif expected.tfile != "" and extractFilename(expected.tfile) != extractFilename(given.tfile) and
+      "internal error:" notin expected.msg:
+    r.addResult(test, expected.tfile, given.tfile, reFilesDiffer)
+  elif expected.tline   != given.tline   and expected.tline   != 0 or
+       expected.tcolumn != given.tcolumn and expected.tcolumn != 0:
+    r.addResult(test, $expected.tline & ':' & $expected.tcolumn,
+                      $given.tline    & ':' & $given.tcolumn,
+                      reLinesDiffer)
   else:
     r.addResult(test, expected.msg, given.msg, reSuccess)
     inc(r.passed)
@@ -183,72 +234,126 @@ proc compilerOutputTests(test: TTest, given: var TSpec, expected: TSpec;
       expectedmsg = expected.nimout
       givenmsg = given.nimout.strip
       nimoutCheck(test, expectedmsg, given)
+  else:
+    givenmsg = given.nimout.strip
   if given.err == reSuccess: inc(r.passed)
   r.addResult(test, expectedmsg, givenmsg, given.err)
 
+proc analyzeAndConsolidateOutput(s: string): string =
+  result = ""
+  let rows = s.splitLines
+  for i in 0 ..< rows.len:
+    if (let pos = find(rows[i], "Traceback (most recent call last)"); pos != -1):
+      result = substr(rows[i], pos) & "\n"
+      for i in i+1 ..< rows.len:
+        result.add rows[i] & "\n"
+        if not (rows[i] =~ re"^[^(]+\(\d+\)\s+"):
+          return
+    elif (let pos = find(rows[i], "SIGSEGV: Illegal storage access."); pos != -1):
+      result = substr(rows[i], pos)
+      return
+
 proc testSpec(r: var TResults, test: TTest) =
   # major entry point for a single test
   let tname = test.name.addFileExt(".nim")
   inc(r.total)
-  styledEcho "Processing ", fgCyan, extractFilename(tname)
-  var expected = parseSpec(tname)
+  var expected: TSpec
+  if test.action != actionRunNoSpec:
+    expected = parseSpec(tname)
+  else:
+    specDefaults expected
+    expected.action = actionRunNoSpec
+
   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 & " --hint[Path]:off --hint[Processing]:off", test.target)
-      compilerOutputTests(test, given, expected, r)
-    of actionRun:
-      var given = callCompiler(expected.cmd, test.name, test.options,
-                               test.target)
-      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):
-          let nodejs = findNodeJs()
-          if test.target == targetJS and nodejs == "":
-            r.addResult(test, expected.outp, "nodejs binary not in PATH",
-                        reExeNotFound)
-            return
-          var (buf, exitCode) = execCmdEx(
-            (if test.target == targetJS: nodejs & " " else: "") & exeFile)
-          if exitCode != expected.exitCode:
-            r.addResult(test, "exitcode: " & $expected.exitCode,
-                              "exitcode: " & $exitCode, reExitCodesDiffer)
-          else:
-            var bufB = strip(buf.string)
-            if expected.sortoutput: bufB = makeDeterministic(bufB)
-            if bufB != strip(expected.outp):
-              if not (expected.substr and expected.outp in bufB):
-                given.err = reOutputsDiffer
-            compilerOutputTests(test, given, expected, r)
-        else:
-          r.addResult(test, expected.outp, "executable not found", reExeNotFound)
-    of actionReject:
-      var given = callCompiler(expected.cmd, test.name, test.options,
-                               test.target)
-      cmpMsgs(r, expected, given, test)
+    return
+
+  case expected.action
+  of actionCompile:
+    var given = callCompiler(expected.cmd, test.name,
+      test.options & " --hint[Path]:off --hint[Processing]:off", test.target)
+    compilerOutputTests(test, given, expected, r)
+  of actionRun, actionRunNoSpec:
+    # In this branch of code "early return" pattern is clearer than deep
+    # nested conditionals - the empty rows in between to clarify the "danger"
+    var given = callCompiler(expected.cmd, test.name, test.options,
+                             test.target)
+
+    if given.err != reSuccess:
+      r.addResult(test, "", given.msg, given.err)
+      return
+
+    let isJsTarget = test.target == targetJS
+    var exeFile: string
+    if isJsTarget:
+      let (dir, file, ext) = splitFile(tname)
+      exeFile = dir / "nimcache" / file & ".js" # *TODO* hardcoded "nimcache"
+    else:
+      exeFile = changeFileExt(tname, ExeExt)
+
+    if not existsFile(exeFile):
+      r.addResult(test, expected.outp, "executable not found", reExeNotFound)
+      return
+
+    let nodejs = if isJsTarget: findNodeJs() else: ""
+    if isJsTarget and nodejs == "":
+      r.addResult(test, expected.outp, "nodejs binary not in PATH",
+                  reExeNotFound)
+      return
+
+    let exeCmd = (if isJsTarget: nodejs & " " else: "") & exeFile
+    var (buf, exitCode) = execCmdEx(exeCmd, options = {poStdErrToStdOut})
+    let bufB = if expected.sortoutput: makeDeterministic(strip(buf.string))
+               else: strip(buf.string)
+    let expectedOut = strip(expected.outp)
+
+    if exitCode != expected.exitCode:
+      r.addResult(test, "exitcode: " & $expected.exitCode,
+                        "exitcode: " & $exitCode & "\n\nOutput:\n" &
+                        analyzeAndConsolidateOutput(bufB),
+                        reExitCodesDiffer)
+      return
+
+    if bufB != expectedOut:
+      if not (expected.substr and expectedOut in bufB):
+        given.err = reOutputsDiffer
+        r.addResult(test, expected.outp, bufB, reOutputsDiffer)
+        return
+
+    compilerOutputTests(test, given, expected, r)
+    return
+
+  of actionReject:
+    var given = callCompiler(expected.cmd, test.name, test.options,
+                             test.target)
+    cmpMsgs(r, expected, given, test)
+    return
 
 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)
-  styledEcho "Processing ", fgCyan, extractFilename(tname)
   let given = callCompiler(cmdTemplate, test.name, test.options, test.target)
   r.addResult(test, "", given.msg, given.err)
   if given.err == reSuccess: inc(r.passed)
 
+proc testC(r: var TResults, test: TTest) =
+  # runs C code. Doesn't support any specs, just goes by exit code.
+  let tname = test.name.addFileExt(".c")
+  inc(r.total)
+  styledEcho "Processing ", fgCyan, extractFilename(tname)
+  var given = callCCompiler(cmdTemplate, test.name & ".c", test.options, test.target)
+  if given.err != reSuccess:
+    r.addResult(test, "", given.msg, given.err)
+  elif test.action == actionRun:
+    let exeFile = changeFileExt(test.name, ExeExt)
+    var (buf, exitCode) = execCmdEx(exeFile, options = {poStdErrToStdOut, poUseShell})
+    if exitCode != 0: given.err = reExitCodesDiffer
+  if given.err == reSuccess: inc(r.passed)
+
 proc makeTest(test, options: string, cat: Category, action = actionCompile,
-              target = targetC): TTest =
+              target = targetC, env: string = ""): TTest =
   # start with 'actionCompile', will be overwritten in the spec:
   result = TTest(cat: cat, name: test, options: options,
                  target: target, action: action)
@@ -267,12 +372,14 @@ proc main() =
   backend.open()
   var optPrintResults = false
   var optFailing = false
+  var optPedantic = false
   var p = initOptParser()
   p.next()
   while p.kind == cmdLongoption:
     case p.key.string.normalize
     of "print", "verbose": optPrintResults = true
     of "failing": optFailing = true
+    of "pedantic": optPedantic = true
     else: quit Usage
     p.next()
   if p.kind != cmdArgument: quit Usage
@@ -293,6 +400,11 @@ proc main() =
     var cat = Category(p.key)
     p.next
     processCategory(r, cat, p.cmdLineRest.string)
+  of "r", "run":
+    let (dir, file) = splitPath(p.key.string)
+    let (_, subdir) = splitPath(dir)
+    var cat = Category(subdir)
+    processCategory(r, cat, p.cmdLineRest.string, file)
   of "html":
     var commit = 0
     discard parseInt(p.cmdLineRest.string, commit)
@@ -305,8 +417,10 @@ proc main() =
     if action == "html": openDefaultBrowser(resultsFile)
     else: echo r, r.data
   backend.close()
+  if optPedantic:
+    var failed = r.total - r.passed - r.skipped
+    if failed > 0 : quit(QuitFailure)
 
 if paramCount() == 0:
   quit Usage
 main()
-
diff --git a/tests/testdata/doc1.xml b/tests/testdata/doc1.xml
index 2895cc32f..4e77481aa 100644
--- a/tests/testdata/doc1.xml
+++ b/tests/testdata/doc1.xml
@@ -3,7 +3,7 @@
   <tag>
     <test arg="blah" arg2="test"/>
     <test2>
-      bla ah absy hsh 
+      bla ah absy hsh
       hsh
       sjj
     </test2>
diff --git a/tests/testdata/string.txt b/tests/testdata/string.txt
index 41bfe81b8..102374bdb 100644
--- a/tests/testdata/string.txt
+++ b/tests/testdata/string.txt
@@ -1 +1 @@
-Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\ No newline at end of file
+Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
diff --git a/tests/threads/tactors2.nim b/tests/threads/tactors2.nim
index 5683f98ba..b011ef140 100644
--- a/tests/threads/tactors2.nim
+++ b/tests/threads/tactors2.nim
@@ -16,7 +16,7 @@ proc main() =
   createActorPool(actorPool, 1)
 
   var some_data: some_type
-  
+
   var inchannel = spawn(actorPool, some_data, thread_proc)
   var recv_data = ^inchannel
   close(inchannel[])
diff --git a/tests/threads/threadex.nim b/tests/threads/threadex.nim
index 0360c8c04..545d1f0cc 100644
--- a/tests/threads/threadex.nim
+++ b/tests/threads/threadex.nim
@@ -32,7 +32,7 @@ proc produce() {.thread.} =
   close(input)
   m.k = mEof
   chan.send(m)
-  
+
 open(chan)
 createThread[void](consumer, consume)
 createThread[void](producer, produce)
diff --git a/tests/threads/tthreadanalysis.nim b/tests/threads/tthreadanalysis.nim
index b222f15a9..6ef4de0bf 100644
--- a/tests/threads/tthreadanalysis.nim
+++ b/tests/threads/tthreadanalysis.nim
@@ -36,9 +36,9 @@ proc echoLeTree(n: PNode) =
     echo it.data
     it = it.le
 
-proc threadFunc(interval: tuple[a, b: int]) {.thread.} = 
+proc threadFunc(interval: tuple[a, b: int]) {.thread.} =
   doNothing()
-  for i in interval.a..interval.b: 
+  for i in interval.a..interval.b:
     var r = buildTree(i)
     echoLeTree(r) # for local data
   echoLeTree(root) # and the same for foreign data :-)
diff --git a/tests/threads/tthreadanalysis2.nim b/tests/threads/tthreadanalysis2.nim
index d5b2cd430..07d77028b 100644
--- a/tests/threads/tthreadanalysis2.nim
+++ b/tests/threads/tthreadanalysis2.nim
@@ -34,9 +34,9 @@ proc echoLeTree(n: PNode) =
     echo it.data
     it = it.le
 
-proc threadFunc(interval: tuple[a, b: int]) {.thread.} = 
+proc threadFunc(interval: tuple[a, b: int]) {.thread.} =
   doNothing()
-  for i in interval.a..interval.b: 
+  for i in interval.a..interval.b:
     var r = buildTree(i)
     echoLeTree(r) # for local data
   root = buildTree(2) # BAD!
diff --git a/tests/threads/tthreadheapviolation1.nim b/tests/threads/tthreadheapviolation1.nim
index 94e1b64db..02ce7878a 100644
--- a/tests/threads/tthreadheapviolation1.nim
+++ b/tests/threads/tthreadheapviolation1.nim
@@ -4,7 +4,7 @@ discard """
   cmd: "nim $target --hints:on --threads:on $options $file"
 """
 
-var 
+var
   global: string = "test string"
   t: TThread[void]
 
diff --git a/tests/threads/ttryrecv.nim b/tests/threads/ttryrecv.nim
index acccf182c..28529b5ac 100644
--- a/tests/threads/ttryrecv.nim
+++ b/tests/threads/ttryrecv.nim
@@ -31,5 +31,5 @@ while true:
 
 echo "Finished listening"
 
-joinThread(thr)                                                       
+joinThread(thr)
 close(chan)
diff --git a/tests/trmacros/targlist.nim b/tests/trmacros/targlist.nim
index 321b3d5d2..f9d2cb6c6 100644
--- a/tests/trmacros/targlist.nim
+++ b/tests/trmacros/targlist.nim
@@ -3,7 +3,7 @@ discard """
 """
 
 proc f(x: varargs[string, `$`]) = discard
-template optF{f(x)}(x: varargs[expr]) = 
-  writeln(stdout, x)
+template optF{f(x)}(x: varargs[expr]) =
+  writeLine(stdout, x)
 
 f 1, 2, false, 3, "ha"
diff --git a/tests/trmacros/tcse.nim b/tests/trmacros/tcse.nim
index ff04f7d83..023a8f298 100644
--- a/tests/trmacros/tcse.nim
+++ b/tests/trmacros/tcse.nim
@@ -6,7 +6,7 @@ template cse{f(a, a, x)}(a: expr{(nkDotExpr|call|nkBracketExpr)&noSideEffect},
                          f: expr, x: varargs[expr]): expr =
   let aa = a
   f(aa, aa, x)+4
-  
+
 var
   a: array[0..10, int]
   i = 3
diff --git a/tests/trmacros/tmatrix.nim b/tests/trmacros/tmatrix.nim
index c825a7792..f409434c5 100644
--- a/tests/trmacros/tmatrix.nim
+++ b/tests/trmacros/tmatrix.nim
@@ -24,6 +24,6 @@ macro optOps{ (`+`|`-`|`*`) ** a }(a: TMat): expr =
 
 var x, y, z: TMat
 
-echo x + y * z - x 
+echo x + y * z - x
 
 #echo x + y + z
diff --git a/tests/trmacros/tstar.nim b/tests/trmacros/tstar.nim
index 8443268f4..536289ff0 100644
--- a/tests/trmacros/tstar.nim
+++ b/tests/trmacros/tstar.nim
@@ -4,7 +4,7 @@ discard """
 
 var
   calls = 0
-  
+
 proc `&&`(s: varargs[string]): string =
   result = s[0]
   for i in 1..len(s)-1: result.add s[i]
diff --git a/tests/trmacros/tstmtlist.nim b/tests/trmacros/tstmtlist.nim
index 20cb5d688..5202f778b 100644
--- a/tests/trmacros/tstmtlist.nim
+++ b/tests/trmacros/tstmtlist.nim
@@ -7,13 +7,13 @@ discard """
 
 template optWrite{
   write(f, x)
-  ((write|writeln){w})(f, y)
+  ((write|writeLine){w})(f, y)
 }(x, y: varargs[expr], f, w: expr) =
   w(f, "|", x, y, "|")
 
 if true:
   echo "0"
   write stdout, "1"
-  writeln stdout, "2"
+  writeLine stdout, "2"
   write stdout, "3"
   echo "4"
diff --git a/tests/tuples/tuint_tuple.nim b/tests/tuples/tuint_tuple.nim
new file mode 100644
index 000000000..24bcead5e
--- /dev/null
+++ b/tests/tuples/tuint_tuple.nim
@@ -0,0 +1,10 @@
+# bug #1986 found by gdmoore
+
+proc test(): int64 =
+  return 0xdeadbeef.int64
+
+const items = [
+  (var1: test(), var2: 100'u32),
+  (var1: test(), var2: 192'u32)
+]
+
diff --git a/tests/tuples/tunpack_asgn.nim b/tests/tuples/tunpack_asgn.nim
new file mode 100644
index 000000000..a48fcff5d
--- /dev/null
+++ b/tests/tuples/tunpack_asgn.nim
@@ -0,0 +1,32 @@
+discard """
+  output: '''2 4
+4
+2 0'''
+"""
+
+proc foobar(): (int, int) = (2, 4)
+
+# test within a proc:
+proc pp(x: var int) =
+  var y: int
+  (y, x) = foobar()
+
+template pt(x) =
+  var y: int
+  (x, y) = foobar()
+
+# test within a generic:
+proc pg[T](x, y: var T) =
+  pt(x)
+
+# test as a top level statement:
+var x, y, a, b: int
+(x, y) = fooBar()
+
+echo x, " ", y
+
+pp(a)
+echo a
+
+pg(a, b)
+echo a, " ", b
diff --git a/tests/tuples/tuple_with_nil.nim b/tests/tuples/tuple_with_nil.nim
new file mode 100644
index 000000000..26e4ae85e
--- /dev/null
+++ b/tests/tuples/tuple_with_nil.nim
@@ -0,0 +1,766 @@
+import macros
+from strutils import IdentStartChars
+import parseutils
+import unicode
+import math
+import fenv
+import unsigned
+import pegs
+import streams
+
+type
+  FormatError = object of Exception ## Error in the format string.
+
+  Writer = concept W
+    ## Writer to output a character `c`.
+    when (NimMajor, NimMinor, NimPatch) > (0, 10, 2):
+      write(W, 'c')
+    else:
+      block:
+        var x: W
+        write(x, char)
+
+  FmtAlign = enum ## Format alignment
+    faDefault  ## default for given format type
+    faLeft     ## left aligned
+    faRight    ## right aligned
+    faCenter   ## centered
+    faPadding  ## right aligned, fill characters after sign (numbers only)
+
+  FmtSign = enum ## Format sign
+    fsMinus    ## only unary minus, no reservered sign space for positive numbers
+    fsPlus     ## unary minus and unary plus
+    fsSpace    ## unary minus and reserved space for positive numbers
+
+  FmtType = enum ## Format type
+    ftDefault  ## default format for given parameter type
+    ftStr      ## string
+    ftChar     ## character
+    ftDec      ## decimal integer
+    ftBin      ## binary integer
+    ftOct      ## octal integer
+    ftHex      ## hexadecimal integer
+    ftFix      ## real number in fixed point notation
+    ftSci      ## real number in scientific notation
+    ftGen      ## real number in generic form (either fixed point or scientific)
+    ftPercent  ## real number multiplied by 100 and % added
+
+  Format = tuple ## Formatting information.
+    typ: FmtType     ## format type
+    precision: int    ## floating point precision
+    width: int        ## minimal width
+    fill: string      ## the fill character, UTF8
+    align: FmtAlign  ## aligment
+    sign: FmtSign    ## sign notation
+    baseprefix: bool  ## whether binary, octal, hex should be prefixed by 0b, 0x, 0o
+    upcase: bool      ## upper case letters in hex or exponential formats
+    comma: bool       ##
+    arysep: string    ## separator for array elements
+
+  PartKind = enum pkStr, pkFmt
+
+  Part = object
+    ## Information of a part of the target string.
+    case kind: PartKind ## type of the part
+    of pkStr:
+      str: string ## literal string
+    of pkFmt:
+      arg: int ## position argument
+      fmt: string ## format string
+      field: string ## field of argument to be accessed
+      index: int ## array index of argument to be accessed
+      nested: bool ## true if the argument contains nested formats
+
+const
+  DefaultPrec = 6 ## Default precision for floating point numbers.
+  DefaultFmt: Format = (ftDefault, -1, -1, nil, faDefault, fsMinus, false, false, false, nil)
+    ## Default format corresponding to the empty format string, i.e.
+    ##   `x.format("") == x.format(DefaultFmt)`.
+  round_nums = [0.5, 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005]
+    ## Rounding offset for floating point numbers up to precision 8.
+
+proc write(s: var string; c: char) =
+  s.add(c)
+
+proc has(c: Captures; i: range[0..pegs.MaxSubpatterns-1]): bool {.nosideeffect, inline.} =
+  ## Tests whether `c` contains a non-empty capture `i`.
+  let b = c.bounds(i)
+  result = b.first <= b.last
+
+proc get(str: string; c: Captures; i: range[0..MaxSubpatterns-1]; def: char): char {.nosideeffect, inline.} =
+  ## If capture `i` is non-empty return that portion of `str` casted
+  ## to `char`, otherwise return `def`.
+  result = if c.has(i): str[c.bounds(i).first] else: def
+
+proc get(str: string; c: Captures; i: range[0..MaxSubpatterns-1]; def: string; begoff: int = 0): string {.nosideeffect, inline.} =
+  ## If capture `i` is non-empty return that portion of `str` as
+  ## string, otherwise return `def`.
+  let b = c.bounds(i)
+  result = if c.has(i): str.substr(b.first + begoff, b.last) else: def
+
+proc get(str: string; c: Captures; i: range[0..MaxSubpatterns-1]; def: int; begoff: int = 0): int {.nosideeffect, inline.} =
+  ## If capture `i` is non-empty return that portion of `str`
+  ## converted to int, otherwise return `def`.
+  if c.has(i):
+    discard str.parseInt(result, c.bounds(i).first + begoff)
+  else:
+    result = def
+
+proc parse(fmt: string): Format {.nosideeffect.} =
+  # Converts the format string `fmt` into a `Format` structure.
+  let p =
+    sequence(capture(?sequence(anyRune(), &charSet({'<', '>', '=', '^'}))),
+             capture(?charSet({'<', '>', '=', '^'})),
+             capture(?charSet({'-', '+', ' '})),
+             capture(?charSet({'#'})),
+             capture(?(+digits())),
+             capture(?charSet({','})),
+             capture(?sequence(charSet({'.'}), +digits())),
+             capture(?charSet({'b', 'c', 'd', 'e', 'E', 'f', 'F', 'g', 'G', 'n', 'o', 's', 'x', 'X', '%'})),
+             capture(?sequence(charSet({'a'}), *pegs.any())))
+  # let p=peg"{(_&[<>=^])?}{[<>=^]?}{[-+ ]?}{[#]?}{[0-9]+?}{[,]?}{([.][0-9]+)?}{[bcdeEfFgGnosxX%]?}{(a.*)?}"
+
+  var caps: Captures
+  if fmt.rawmatch(p, 0, caps) < 0:
+    raise newException(FormatError, "Invalid format string")
+
+  result.fill = fmt.get(caps, 0, nil)
+
+  case fmt.get(caps, 1, 0.char)
+  of '<': result.align = faLeft
+  of '>': result.align = faRight
+  of '^': result.align = faCenter
+  of '=': result.align = faPadding
+  else: result.align = faDefault
+
+  case fmt.get(caps, 2, '-')
+  of '-': result.sign = fsMinus
+  of '+': result.sign = fsPlus
+  of ' ': result.sign = fsSpace
+  else: result.sign = fsMinus
+
+  result.baseprefix = caps.has(3)
+
+  result.width = fmt.get(caps, 4, -1)
+
+  if caps.has(4) and fmt[caps.bounds(4).first] == '0':
+    if result.fill != nil:
+      raise newException(FormatError, "Leading 0 in with not allowed with explicit fill character")
+    if result.align != faDefault:
+      raise newException(FormatError, "Leading 0 in with not allowed with explicit alignment")
+    result.fill = "0"
+    result.align = faPadding
+
+  result.comma = caps.has(5)
+
+  result.precision = fmt.get(caps, 6, -1, 1)
+
+  case fmt.get(caps, 7, 0.char)
+  of 's': result.typ = ftStr
+  of 'c': result.typ = ftChar
+  of 'd', 'n': result.typ = ftDec
+  of 'b': result.typ = ftBin
+  of 'o': result.typ = ftOct
+  of 'x': result.typ = ftHex
+  of 'X': result.typ = ftHex; result.upcase = true
+  of 'f', 'F': result.typ = ftFix
+  of 'e': result.typ = ftSci
+  of 'E': result.typ = ftSci; result.upcase = true
+  of 'g': result.typ = ftGen
+  of 'G': result.typ = ftGen; result.upcase = true
+  of '%': result.typ = ftPercent
+  else: result.typ = ftDefault
+
+  result.arysep = fmt.get(caps, 8, nil, 1)
+
+proc getalign(fmt: Format; defalign: FmtAlign; slen: int) : tuple[left, right:int] {.nosideeffect.} =
+  ## Returns the number of left and right padding characters for a
+  ## given format alignment and width of the object to be printed.
+  ##
+  ## `fmt`
+  ##    the format data
+  ## `default`
+  ##    if `fmt.align == faDefault`, then this alignment is used
+  ## `slen`
+  ##    the width of the object to be printed.
+  ##
+  ## The returned values `(left, right)` will be as minimal as possible
+  ## so that `left + slen + right >= fmt.width`.
+  result.left = 0
+  result.right = 0
+  if (fmt.width >= 0) and (slen < fmt.width):
+    let alg = if fmt.align == faDefault: defalign else: fmt.align
+    case alg:
+    of faLeft: result.right = fmt.width - slen
+    of faRight, faPadding: result.left = fmt.width - slen
+    of faCenter:
+      result.left = (fmt.width - slen) div 2
+      result.right = fmt.width - slen - result.left
+    else: discard
+
+proc writefill(o: var Writer; fmt: Format; n: int; signum: int = 0) =
+  ## Write characters for filling. This function also writes the sign
+  ## of a numeric format and handles the padding alignment
+  ## accordingly.
+  ##
+  ## `o`
+  ##   output object
+  ## `add`
+  ##   output function
+  ## `fmt`
+  ##   format to be used (important for padding aligment)
+  ## `n`
+  ##   the number of filling characters to be written
+  ## `signum`
+  ##   the sign of the number to be written, < 0 negative, > 0 positive, = 0 zero
+  if fmt.align == faPadding and signum != 0:
+    if signum < 0: write(o, '-')
+    elif fmt.sign == fsPlus: write(o, '+')
+    elif fmt.sign == fsSpace: write(o, ' ')
+
+  if fmt.fill == nil:
+    for i in 1..n: write(o, ' ')
+  else:
+    for i in 1..n:
+      for c in fmt.fill:
+        write(o, c)
+
+  if fmt.align != faPadding and signum != 0:
+    if signum < 0: write(o, '-')
+    elif fmt.sign == fsPlus: write(o, '+')
+    elif fmt.sign == fsSpace: write(o, ' ')
+
+proc writeformat(o: var Writer; s: string; fmt: Format) =
+  ## Write string `s` according to format `fmt` using output object
+  ## `o` and output function `add`.
+  if fmt.typ notin {ftDefault, ftStr}:
+    raise newException(FormatError, "String variable must have 's' format type")
+
+  # compute alignment
+  let len = if fmt.precision < 0: runelen(s) else: min(runelen(s), fmt.precision)
+  var alg = getalign(fmt, faLeft, len)
+  writefill(o, fmt, alg.left)
+  var pos = 0
+  for i in 0..len-1:
+    let rlen = runeLenAt(s, pos)
+    for j in pos..pos+rlen-1: write(o, s[j])
+    pos += rlen
+  writefill(o, fmt, alg.right)
+
+proc writeformat(o: var Writer; c: char; fmt: Format) =
+  ## Write character `c` according to format `fmt` using output object
+  ## `o` and output function `add`.
+  if not (fmt.typ in {ftChar, ftDefault}):
+    raise newException(FormatError, "Character variable must have 'c' format type")
+
+  # compute alignment
+  var alg = getalign(fmt, faLeft, 1)
+  writefill(o, fmt, alg.left)
+  write(o, c)
+  writefill(o, fmt, alg.right)
+
+proc writeformat(o: var Writer; c: Rune; fmt: Format) =
+  ## Write rune `c` according to format `fmt` using output object
+  ## `o` and output function `add`.
+  if not (fmt.typ in {ftChar, ftDefault}):
+    raise newException(FormatError, "Character variable must have 'c' format type")
+
+  # compute alignment
+  var alg = getalign(fmt, faLeft, 1)
+  writefill(o, fmt, alg.left)
+  let s = c.toUTF8
+  for c in s: write(o, c)
+  writefill(o, fmt, alg.right)
+
+proc abs(x: SomeUnsignedInt): SomeUnsignedInt {.inline.} = x
+  ## Return the absolute value of the unsigned int `x`.
+
+proc writeformat(o: var Writer; i: SomeInteger; fmt: Format) =
+  ## Write integer `i` according to format `fmt` using output object
+  ## `o` and output function `add`.
+  var fmt = fmt
+  if fmt.typ == ftDefault:
+    fmt.typ = ftDec
+  if not (fmt.typ in {ftBin, ftOct, ftHex, ftDec}):
+    raise newException(FormatError, "Integer variable must of one of the following types: b,o,x,X,d,n")
+
+  var base: type(i)
+  var len = 0
+  case fmt.typ:
+  of ftDec:
+    base = 10
+  of ftBin:
+    base = 2
+    if fmt.baseprefix: len += 2
+  of ftOct:
+    base = 8
+    if fmt.baseprefix: len += 2
+  of ftHex:
+    base = 16
+    if fmt.baseprefix: len += 2
+  else: assert(false)
+
+  if fmt.sign != fsMinus or i < 0: len.inc
+
+  var x: type(i) = abs(i)
+  var irev: type(i) = 0
+  var ilen = 0
+  while x > 0.SomeInteger:
+    len.inc
+    ilen.inc
+    irev = irev * base + x mod base
+    x = x div base
+  if ilen == 0:
+    ilen.inc
+    len.inc
+
+  var alg = getalign(fmt, faRight, len)
+  writefill(o, fmt, alg.left, if i >= 0.SomeInteger: 1 else: -1)
+  if fmt.baseprefix:
+    case fmt.typ
+    of ftBin:
+      write(o, '0')
+      write(o, 'b')
+    of ftOct:
+      write(o, '0')
+      write(o, 'o')
+    of ftHex:
+      write(o, '0')
+      write(o, 'x')
+    else:
+      raise newException(FormatError, "# only allowed with b, o, x or X")
+  while ilen > 0:
+    ilen.dec
+    let c = irev mod base
+    irev = irev div base
+    if c < 10:
+      write(o, ('0'.int + c.int).char)
+    elif fmt.upcase:
+      write(o, ('A'.int + c.int - 10).char)
+    else:
+      write(o, ('a'.int + c.int - 10).char)
+  writefill(o, fmt, alg.right)
+
+proc writeformat(o: var Writer; p: pointer; fmt: Format) =
+  ## Write pointer `i` according to format `fmt` using output object
+  ## `o` and output function `add`.
+  ##
+  ## Pointers are casted to unsigned int and formated as hexadecimal
+  ## with prefix unless specified otherwise.
+  var f = fmt
+  if f.typ == 0.char:
+    f.typ = 'x'
+    f.baseprefix = true
+  writeformat(o, add, cast[uint](p), f)
+
+proc writeformat(o: var Writer; x: SomeReal; fmt: Format) =
+  ## Write real number `x` according to format `fmt` using output
+  ## object `o` and output function `add`.
+  var fmt = fmt
+  # handle default format
+  if fmt.typ == ftDefault:
+    fmt.typ = ftGen
+    if fmt.precision < 0: fmt.precision = DefaultPrec
+  if not (fmt.typ in {ftFix, ftSci, ftGen, ftPercent}):
+    raise newException(FormatError, "Integer variable must of one of the following types: f,F,e,E,g,G,%")
+
+  let positive = x >= 0 and classify(x) != fcNegZero
+  var len = 0
+
+  if fmt.sign != fsMinus or not positive: len.inc
+
+  var prec = if fmt.precision < 0: DefaultPrec else: fmt.precision
+  var y = abs(x)
+  var exp = 0
+  var numstr, frstr: array[0..31, char]
+  var numlen, frbeg, frlen = 0
+
+  if fmt.typ == ftPercent: y *= 100
+
+  case classify(x):
+  of fcNan:
+    numstr[0..2] = ['n', 'a', 'n']
+    numlen = 3
+  of fcInf, fcNegInf:
+    numstr[0..2] = ['f', 'n', 'i']
+    numlen = 3
+  of fcZero, fcNegZero:
+    numstr[0] = '0'
+    numlen = 1
+  else: # a usual fractional number
+    if not (fmt.typ in {ftFix, ftPercent}): # not fixed point
+      exp = int(floor(log10(y)))
+      if fmt.typ == ftGen:
+        if prec == 0: prec = 1
+        if -4 <= exp and exp < prec:
+          prec = prec-1-exp
+          exp = 0
+        else:
+          prec = prec - 1
+          len += 4 # exponent
+      else:
+        len += 4 # exponent
+      # shift y so that 1 <= abs(y) < 2
+      if exp > 0: y /= pow(10.SomeReal, abs(exp).SomeReal)
+      elif exp < 0: y *= pow(10.SomeReal, abs(exp).SomeReal)
+    elif fmt.typ == ftPercent:
+      len += 1 # percent sign
+
+    # handle rounding by adding +0.5 * LSB
+    if prec < len(round_nums): y += round_nums[prec]
+
+    # split into integer and fractional part
+    var mult = 1'i64
+    for i in 1..prec: mult *= 10
+    var num = y.int64
+    var fr = ((y - num.SomeReal) * mult.SomeReal).int64
+    # build integer part string
+    while num != 0:
+      numstr[numlen] = ('0'.int + (num mod 10)).char
+      numlen.inc
+      num = num div 10
+    if numlen == 0:
+      numstr[0] = '0'
+      numlen.inc
+    # build fractional part string
+    while fr != 0:
+      frstr[frlen] = ('0'.int + (fr mod 10)).char
+      frlen.inc
+      fr = fr div 10
+    while frlen < prec:
+      frstr[frlen] = '0'
+      frlen.inc
+    # possible remove trailing 0
+    if fmt.typ == ftGen:
+      while frbeg < frlen and frstr[frbeg] == '0': frbeg.inc
+  # update length of string
+  len += numlen;
+  if frbeg < frlen:
+    len += 1 + frlen - frbeg # decimal point and fractional string
+
+  let alg = getalign(fmt, faRight, len)
+  writefill(o, fmt, alg.left, if positive: 1 else: -1)
+  for i in (numlen-1).countdown(0): write(o, numstr[i])
+  if frbeg < frlen:
+    write(o, '.')
+    for i in (frlen-1).countdown(frbeg): write(o, frstr[i])
+  if fmt.typ == ftSci or (fmt.typ == ftGen and exp != 0):
+    write(o, if fmt.upcase: 'E' else: 'e')
+    if exp >= 0:
+      write(o, '+')
+    else:
+      write(o, '-')
+      exp = -exp
+    if exp < 10:
+      write(o, '0')
+      write(o, ('0'.int + exp).char)
+    else:
+      var i=0
+      while exp > 0:
+        numstr[i] = ('0'.int + exp mod 10).char
+        i+=1
+        exp = exp div 10
+      while i>0:
+        i-=1
+        write(o, numstr[i])
+  if fmt.typ == ftPercent: write(o, '%')
+  writefill(o, fmt, alg.right)
+
+proc writeformat(o: var Writer; b: bool; fmt: Format) =
+  ## Write boolean value `b` according to format `fmt` using output
+  ## object `o`. A boolean may be formatted numerically or as string.
+  ## In the former case true is written as 1 and false as 0, in the
+  ## latter the strings "true" and "false" are shown, respectively.
+  ## The default is string format.
+  if fmt.typ in {ftStr, ftDefault}:
+    writeformat(o,
+                if b: "true"
+                else: "false",
+                fmt)
+  elif fmt.typ in {ftBin, ftOct, ftHex, ftDec}:
+    writeformat(o,
+                if b: 1
+                else: 0,
+                fmt)
+  else:
+    raise newException(FormatError, "Boolean values must of one of the following types: s,b,o,x,X,d,n")
+
+proc writeformat(o: var Writer; ary: openarray[any]; fmt: Format) =
+  ## Write array `ary` according to format `fmt` using output object
+  ## `o` and output function `add`.
+  if ary.len == 0: return
+
+  var sep: string
+  var nxtfmt = fmt
+  if fmt.arysep == nil:
+    sep = "\t"
+  elif fmt.arysep.len == 0:
+    sep = ""
+  else:
+    let sepch = fmt.arysep[0]
+    let nxt = 1 + skipUntil(fmt.arysep, sepch, 1)
+    if nxt >= 1:
+      nxtfmt.arysep = fmt.arysep.substr(nxt)
+      sep = fmt.arysep.substr(1, nxt-1)
+    else:
+      nxtfmt.arysep = ""
+      sep = fmt.arysep.substr(1)
+  writeformat(o, ary[0], nxtfmt)
+  for i in 1..ary.len-1:
+    for c in sep: write(o, c)
+    writeformat(o, ary[i], nxtfmt)
+
+proc addformat[T](o: var Writer; x: T; fmt: Format = DefaultFmt) {.inline.} =
+  ## Write `x` formatted with `fmt` to `o`.
+  writeformat(o, x, fmt)
+
+proc addformat[T](o: var Writer; x: T; fmt: string) {.inline.} =
+  ## The same as `addformat(o, x, parse(fmt))`.
+  addformat(o, x, fmt.parse)
+
+proc addformat(s: var string; x: string) {.inline.} =
+  ## Write `x` to `s`. This is a fast specialized version for
+  ## appending unformatted strings.
+  add(s, x)
+
+proc addformat(f: File; x: string) {.inline.} =
+  ## Write `x` to `f`. This is a fast specialized version for
+  ## writing unformatted strings to a file.
+  write(f, x)
+
+proc addformat[T](f: File; x: T; fmt: Format = DefaultFmt) {.inline.} =
+  ## Write `x` to file `f` using format `fmt`.
+  var g = f
+  writeformat(g, x, fmt)
+
+proc addformat[T](f: File; x: T; fmt: string) {.inline.} =
+  ## Write `x` to file `f` using format string `fmt`. This is the same
+  ## as `addformat(f, x, parse(fmt))`
+  addformat(f, x, parse(fmt))
+
+proc addformat(s: Stream; x: string) {.inline.} =
+  ## Write `x` to `s`. This is a fast specialized version for
+  ## writing unformatted strings to a stream.
+  write(s, x)
+
+proc addformat[T](s: Stream; x: T; fmt: Format = DefaultFmt) {.inline.} =
+  ## Write `x` to stream `s` using format `fmt`.
+  var g = s
+  writeformat(g, x, fmt)
+
+proc addformat[T](s: Stream; x: T; fmt: string) {.inline.} =
+  ## Write `x` to stream `s` using format string `fmt`. This is the same
+  ## as `addformat(s, x, parse(fmt))`
+  addformat(s, x, parse(fmt))
+
+proc format[T](x: T; fmt: Format): string =
+  ## Return `x` formatted as a string according to format `fmt`.
+  result = ""
+  addformat(result, x, fmt)
+
+proc format[T](x: T; fmt: string): string =
+  ## Return `x` formatted as a string according to format string `fmt`.
+  result = format(x, fmt.parse)
+
+proc format[T](x: T): string {.inline.} =
+  ## Return `x` formatted as a string according to the default format.
+  ## The default format corresponds to an empty format string.
+  var fmt {.global.} : Format = DefaultFmt
+  result = format(x, fmt)
+
+proc unquoted(s: string): string {.compileTime.} =
+  ## Return `s` {{ and }} by single { and }, respectively.
+  result = ""
+  var pos = 0
+  while pos < s.len:
+    let nxt = pos + skipUntil(s, {'{', '}'})
+    result.add(s.substr(pos, nxt))
+    pos = nxt + 2
+
+proc splitfmt(s: string): seq[Part] {.compiletime, nosideeffect.} =
+  ## Split format string `s` into a sequence of "parts".
+  ##
+
+  ## Each part is either a literal string or a format specification. A
+  ## format specification is a substring of the form
+  ## "{[arg][:format]}" where `arg` is either empty or a number
+  ## refering to the arg-th argument and an additional field or array
+  ## index. The format string is a string accepted by `parse`.
+  let subpeg = sequence(capture(digits()),
+                          capture(?sequence(charSet({'.'}), *pegs.identStartChars(), *identChars())),
+                          capture(?sequence(charSet({'['}), +digits(), charSet({']'}))),
+                          capture(?sequence(charSet({':'}), *pegs.any())))
+  result = @[]
+  var pos = 0
+  while true:
+    let oppos = pos + skipUntil(s, {'{', '}'}, pos)
+    # reached the end
+    if oppos >= s.len:
+      if pos < s.len:
+        result.add(Part(kind: pkStr, str: s.substr(pos).unquoted))
+      return
+    # skip double
+    if oppos + 1 < s.len and s[oppos] == s[oppos+1]:
+      result.add(Part(kind: pkStr, str: s.substr(pos, oppos)))
+      pos = oppos + 2
+      continue
+    if s[oppos] == '}':
+      error("Single '}' encountered in format string")
+    if oppos > pos:
+      result.add(Part(kind: pkStr, str: s.substr(pos, oppos-1).unquoted))
+    # find matching closing }
+    var lvl = 1
+    var nested = false
+    pos = oppos
+    while lvl > 0:
+      pos.inc
+      pos = pos + skipUntil(s, {'{', '}'}, pos)
+      if pos >= s.len:
+        error("Single '{' encountered in format string")
+      if s[pos] == '{':
+        lvl.inc
+        if lvl == 2:
+          nested = true
+        if lvl > 2:
+          error("Too many nested format levels")
+      else:
+        lvl.dec
+    let clpos = pos
+    var fmtpart = Part(kind: pkFmt, arg: -1, fmt: s.substr(oppos+1, clpos-1), field: nil, index: int.high, nested: nested)
+    if fmtpart.fmt.len > 0:
+      var m: array[0..3, string]
+      if not fmtpart.fmt.match(subpeg, m):
+        error("invalid format string")
+
+      if m[1] != nil and m[1].len > 0:
+        fmtpart.field = m[1].substr(1)
+      if m[2] != nil and m[2].len > 0:
+        discard parseInt(m[2].substr(1, m[2].len-2), fmtpart.index)
+
+      if m[0].len > 0: discard parseInt(m[0], fmtpart.arg)
+      if m[3] == nil or m[3].len == 0:
+        fmtpart.fmt = ""
+      elif m[3][0] == ':':
+        fmtpart.fmt = m[3].substr(1)
+      else:
+        fmtpart.fmt = m[3]
+    result.add(fmtpart)
+    pos = clpos + 1
+
+proc literal(s: string): NimNode {.compiletime, nosideeffect.} =
+  ## Return the nim literal of string `s`. This handles the case if
+  ## `s` is nil.
+  result = if s == nil: newNilLit() else: newLit(s)
+
+proc literal(b: bool): NimNode {.compiletime, nosideeffect.} =
+  ## Return the nim literal of boolean `b`. This is either `true`
+  ## or `false` symbol.
+  result = if b: "true".ident else: "false".ident
+
+proc literal[T](x: T): NimNode {.compiletime, nosideeffect.} =
+  ## Return the nim literal of value `x`.
+  when type(x) is enum:
+    result = ($x).ident
+  else:
+    result = newLit(x)
+
+proc generatefmt(fmtstr: string;
+                 args: var openarray[tuple[arg:NimNode, cnt:int]];
+                 arg: var int;): seq[tuple[val, fmt:NimNode]] {.compiletime.} =
+  ## fmtstr
+  ##   the format string
+  ## args
+  ##   array of expressions for the arguments
+  ## arg
+  ##   the number of the next argument for automatic parsing
+  ##
+  ## If arg is < 0 then the functions assumes that explicit numbering
+  ## must be used, otherwise automatic numbering is used starting at
+  ## `arg`. The value of arg is updated according to the number of
+  ## arguments being used. If arg == 0 then automatic and manual
+  ## numbering is not decided (because no explicit manual numbering is
+  ## fixed und no automatically numbered argument has been used so
+  ## far).
+  ##
+  ## The function returns a list of pairs `(val, fmt)` where `val` is
+  ## an expression to be formatted and `fmt` is the format string (or
+  ## Format). Therefore, the resulting string can be generated by
+  ## concatenating expressions `val.format(fmt)`. If `fmt` is `nil`
+  ## then `val` is a (literal) string expression.
+  try:
+    result = @[]
+    for part in splitfmt(fmtstr):
+      case part.kind
+      of pkStr: result.add((newLit(part.str), nil))
+      of pkFmt:
+        # first compute the argument expression
+        # start with the correct index
+        var argexpr : NimNode
+        if part.arg >= 0:
+          if arg > 0:
+            error("Cannot switch from automatic field numbering to manual field specification")
+          if part.arg >= args.len:
+            error("Invalid explicit argument index: " & $part.arg)
+          argexpr = args[part.arg].arg
+          args[part.arg].cnt = args[part.arg].cnt + 1
+          arg = -1
+        else:
+          if arg < 0:
+            error("Cannot switch from manual field specification to automatic field numbering")
+          if arg >= args.len:
+            error("Too few arguments for format string")
+          argexpr = args[arg].arg
+          args[arg].cnt = args[arg].cnt + 1
+          arg.inc
+        # possible field access
+        if part.field != nil and part.field.len > 0:
+          argexpr = newDotExpr(argexpr, part.field.ident)
+        # possible array access
+        if part.index < int.high:
+          argexpr = newNimNode(nnkBracketExpr).add(argexpr, newLit(part.index))
+        # now the expression for the format data
+        var fmtexpr: NimNode
+        if part.nested:
+          # nested format string. Compute the format string by
+          # concatenating the parts of the substring.
+          for e in generatefmt(part.fmt, args, arg):
+            var newexpr = if part.fmt == nil: e.val else: newCall(bindsym"format", e.val, e.fmt)
+            if fmtexpr != nil and fmtexpr.kind != nnkNilLit:
+              fmtexpr = infix(fmtexpr, "&", newexpr)
+            else:
+              fmtexpr = newexpr
+        else:
+          # literal format string, precompute the format data
+          fmtexpr = newNimNode(nnkPar)
+          for field, val in part.fmt.parse.fieldPairs:
+            fmtexpr.add(newNimNode(nnkExprColonExpr).add(field.ident, literal(val)))
+        # add argument
+        result.add((argexpr, fmtexpr))
+  finally:
+    discard
+
+proc addfmtfmt(fmtstr: string; args: NimNode; retvar: NimNode): NimNode {.compileTime.} =
+  var argexprs = newseq[tuple[arg:NimNode; cnt:int]](args.len)
+  result = newNimNode(nnkStmtListExpr)
+  # generate let bindings for arguments
+  for i in 0..args.len-1:
+    let argsym = gensym(nskLet, "arg" & $i)
+    result.add(newLetStmt(argsym, args[i]))
+    argexprs[i].arg = argsym
+  # add result values
+  var arg = 0
+  for e in generatefmt(fmtstr, argexprs, arg):
+    if e.fmt == nil or e.fmt.kind == nnkNilLit:
+      result.add(newCall(bindsym"addformat", retvar, e.val))
+    else:
+      result.add(newCall(bindsym"addformat", retvar, e.val, e.fmt))
+  for i, arg in argexprs:
+    if arg.cnt == 0:
+      warning("Argument " & $(i+1) & " `" & args[i].repr & "` is not used in format string")
+
+macro addfmt(s: var string, fmtstr: string{lit}, args: varargs[expr]): expr =
+  ## The same as `s.add(fmtstr.fmt(args...))` but faster.
+  result = addfmtfmt($fmtstr, args, s)
+
+var s: string = ""
+s.addfmt("a:{}", 42)
diff --git a/tests/tuples/tuple_with_seq.nim b/tests/tuples/tuple_with_seq.nim
new file mode 100644
index 000000000..39edb500f
--- /dev/null
+++ b/tests/tuples/tuple_with_seq.nim
@@ -0,0 +1,46 @@
+discard """
+  output: '''it's nil
+@[1, 2, 3]'''
+"""
+
+template foo(s: string = nil) =
+  if isNil(s):
+    echo "it's nil"
+  else:
+    echo s
+
+foo
+
+
+# bug #2632
+
+proc takeTup(x: tuple[s: string;x: seq[int]]) =
+  discard
+
+takeTup(("foo", @[]))
+
+
+#proc foobar(): () =
+
+proc f(xs: seq[int]) =
+  discard
+
+proc g(t: tuple[n:int, xs:seq[int]]) =
+  discard
+
+when isMainModule:
+  f(@[]) # OK
+  g((1,@[1])) # OK
+  g((0,@[])) # NG
+
+
+# bug #2630
+type T = tuple[a: seq[int], b: int]
+
+var t: T = (@[1,2,3], 7)
+
+proc test(s: seq[int]): T =
+  echo s
+  (s, 7)
+
+t = test(t.a)
diff --git a/tests/tuples/twrongtupleaccess.nim b/tests/tuples/twrongtupleaccess.nim
index 1a9ae64a2..b1684b097 100644
--- a/tests/tuples/twrongtupleaccess.nim
+++ b/tests/tuples/twrongtupleaccess.nim
@@ -1,7 +1,7 @@
 discard """
   file: "twrongtupleaccess.nim"
   line: 9
-  errormsg: "undeclared identifier: \'setBLAH\'"
+  errormsg: "attempting to call undeclared routine: \'setBLAH\'"
 """
 # Bugfix
 
diff --git a/tests/typerel/t2plus.nim b/tests/typerel/t2plus.nim
new file mode 100644
index 000000000..08378b804
--- /dev/null
+++ b/tests/typerel/t2plus.nim
@@ -0,0 +1,22 @@
+discard """
+  output: "2.0"
+"""
+
+{.warning[TypelessParam]: off.}
+
+import future
+
+# bug #3329
+
+proc foldRight[T,U](lst: seq[T], v: U, f: (T, U) -> U): U =
+  result = v
+  for x in lst:
+    result = f(x, result)
+
+proc mean[T: SomeNumber](xs: seq[T]): T =
+  xs.foldRight(0.T, (xBAZ: auto, yBAZ: auto) => xBAZ + yBAZ) / T(xs.len)
+
+when isMainModule:
+  let x = mean(@[1.float, 2, 3])
+  echo x
+
diff --git a/tests/typerel/tno_gcmem_in_shared.nim b/tests/typerel/tno_gcmem_in_shared.nim
index 8c81e8db6..dd8a1cb94 100644
--- a/tests/typerel/tno_gcmem_in_shared.nim
+++ b/tests/typerel/tno_gcmem_in_shared.nim
@@ -1,6 +1,7 @@
 discard """
   errormsg: "shared memory may not refer to GC'ed thread local memory"
   line: 14
+  disabled: true
 """
 
 type
diff --git a/tests/typerel/tno_int_in_bool_context.nim b/tests/typerel/tno_int_in_bool_context.nim
index 755a02c0c..557759169 100644
--- a/tests/typerel/tno_int_in_bool_context.nim
+++ b/tests/typerel/tno_int_in_bool_context.nim
@@ -3,6 +3,6 @@ discard """
   errormsg: "type mismatch: got (int literal(1)) but expected 'bool'"
 """
 
-if 1: 
+if 1:
   echo "wtf?"
-  
+
diff --git a/tests/typerel/trectuples.nim b/tests/typerel/trectuples.nim
index a74e4859c..af9ba2dbb 100644
--- a/tests/typerel/trectuples.nim
+++ b/tests/typerel/trectuples.nim
@@ -7,7 +7,7 @@ type Node = tuple[left: ref Node]
 
 proc traverse(root: ref Node) =
   if root.left != nil: traverse(root.left)
-  
+
 type A = tuple[B: ptr A]
 proc C(D: ptr A) = C(D.B)
 
diff --git a/tests/typerel/trefs.nim b/tests/typerel/trefs.nim
index b157ca2b5..d4383c562 100644
--- a/tests/typerel/trefs.nim
+++ b/tests/typerel/trefs.nim
@@ -3,21 +3,21 @@ discard """
   line: 20
   errormsg: "type mismatch"
 """
-# test for ref types (including refs to procs)

-

-type

-  TProc = proc (a, b: int): int {.stdcall.}

-

-proc foo(c, d: int): int {.stdcall.} =

-  return 0

-

-proc wrongfoo(c, e: int): int {.inline.} =

-  return 0

-

-var p: TProc

-p = foo

-write(stdout, "success!")

-p = wrongfoo  #ERROR_MSG type mismatch

-

+# test for ref types (including refs to procs)
+
+type
+  TProc = proc (a, b: int): int {.stdcall.}
+
+proc foo(c, d: int): int {.stdcall.} =
+  return 0
+
+proc wrongfoo(c, e: int): int {.inline.} =
+  return 0
+
+var p: TProc
+p = foo
+write(stdout, "success!")
+p = wrongfoo  #ERROR_MSG type mismatch
+
 
 
diff --git a/tests/typerel/tregionptrs.nim b/tests/typerel/tregionptrs.nim
index 07387fed8..69a93a107 100644
--- a/tests/typerel/tregionptrs.nim
+++ b/tests/typerel/tregionptrs.nim
@@ -8,7 +8,7 @@ type
   APtr = RegionA ptr int
   RegionB = object
   BPtr = RegionB ptr int
-  
+
 var x,xx: APtr
 var y: BPtr
 x = nil
diff --git a/tests/typerel/tregionptrs2.nim b/tests/typerel/tregionptrs2.nim
index 3b32ff93d..7fe758c8e 100644
--- a/tests/typerel/tregionptrs2.nim
+++ b/tests/typerel/tregionptrs2.nim
@@ -8,14 +8,14 @@ type
         next: ThingyPtr
         name: string
 
-proc iname(t: ThingyPtr) = 
+proc iname(t: ThingyPtr) =
     var x = t
 
     while not x.isNil:
         echo x.name
         x = x.next
 
-proc go() = 
+proc go() =
     var athing : ThingyPtr
 
     iname(athing)
diff --git a/tests/typerel/tsecondarrayproperty.nim b/tests/typerel/tsecondarrayproperty.nim
index 07fdac1c4..3a6879b16 100644
--- a/tests/typerel/tsecondarrayproperty.nim
+++ b/tests/typerel/tsecondarrayproperty.nim
@@ -14,7 +14,7 @@ proc `[]=` (self: var TFoo, x, y: int) =
 proc second(self: var TFoo): var TSecond =
   return TSecond(self)
 
-proc `[]`(self: var TSecond, x: int): var int =  
+proc `[]`(self: var TSecond, x: int): var int =
   return TFoo(self).data[2*x]
 
 var f: TFoo
diff --git a/tests/typerel/tstr_as_openarray.nim b/tests/typerel/tstr_as_openarray.nim
new file mode 100644
index 000000000..fc28d6c93
--- /dev/null
+++ b/tests/typerel/tstr_as_openarray.nim
@@ -0,0 +1,22 @@
+discard """
+  output: '''success'''
+"""
+var s = "HI"
+
+proc x (zz: openarray[char]) =
+  discard
+
+x s
+
+proc z [T] (zz: openarray[T]) =
+  discard
+
+z s
+z([s,s,s])
+
+proc y [T] (arg: var openarray[T]) =
+  arg[0] = 'X'
+y s
+doAssert s == "XI"
+
+echo "success"
diff --git a/tests/typerel/ttuple1.nim b/tests/typerel/ttuple1.nim
index 5787cc309..d5c80800c 100644
--- a/tests/typerel/ttuple1.nim
+++ b/tests/typerel/ttuple1.nim
@@ -12,5 +12,5 @@ for key, val in items(romanNumbers):
 proc PrintBiTuple(t: tuple[k: string, v: int]): int =
   stdout.write(t.k & "=" & $t.v & ", ")
   return 0
-  
+
 
diff --git a/tests/typerel/ttypedesc_as_genericparam1.nim b/tests/typerel/ttypedesc_as_genericparam1.nim
new file mode 100644
index 000000000..677bf6fc8
--- /dev/null
+++ b/tests/typerel/ttypedesc_as_genericparam1.nim
@@ -0,0 +1,6 @@
+discard """
+  line: 6
+  errormsg: "type mismatch: got (typedesc[int])"
+"""
+# bug #3079, #1146
+echo repr(int)
diff --git a/tests/typerel/ttypedesc_as_genericparam2.nim b/tests/typerel/ttypedesc_as_genericparam2.nim
new file mode 100644
index 000000000..0b4281269
--- /dev/null
+++ b/tests/typerel/ttypedesc_as_genericparam2.nim
@@ -0,0 +1,9 @@
+discard """
+  line: 9
+  errormsg: "'repr' doesn't support 'void' type"
+"""
+
+# bug #2879
+
+var s: seq[int]
+echo repr(s.new_seq(3))
diff --git a/tests/typerel/ttypenoval.nim b/tests/typerel/ttypenoval.nim
index 214b35e29..d5b91fbca 100644
--- a/tests/typerel/ttypenoval.nim
+++ b/tests/typerel/ttypenoval.nim
@@ -11,7 +11,7 @@ type
   TBinHeap[T] = object
     heap: seq[TNode[T]]
     last: int
-  
+
   PBinHeap[T] = ref TBinHeap[T]
 
 proc newBinHeap*[T](heap: var PBinHeap[T], size: int) =
@@ -19,7 +19,7 @@ proc newBinHeap*[T](heap: var PBinHeap[T], size: int) =
   heap.last = 0
   newSeq(heap.heap, size)
   #newSeq(heap.seq, size)
- 
+
 proc parent(elem: int): int {.inline.} =
   return (elem-1) div 2
 
diff --git a/tests/typerel/tvarargsexpr.nim b/tests/typerel/tvarargsexpr.nim
index fcb49af61..c6a59fb20 100644
--- a/tests/typerel/tvarargsexpr.nim
+++ b/tests/typerel/tvarargsexpr.nim
@@ -1,12 +1,14 @@
 discard """
-  output: '''success'''
+  output: '''success
+true
+true'''
 """
 
 #bug #913
 
 import macros
 
-macro thirteen(args: varargs[expr]): expr = 
+macro thirteen(args: varargs[expr]): expr =
   result = newIntLitNode(13)
 
 doAssert(13==thirteen([1,2])) # works
@@ -16,3 +18,11 @@ doAssert(13==thirteen(1,[2])) # does not work
 doAssert(13==thirteen([1], 2)) # does not work
 
 echo "success"
+
+# bug #2545
+
+import macros
+macro test(e: varargs[untyped]): expr = bindSym"true"
+
+echo test(a)
+echo test(fake=90, arguments=80, also="false", possible=true)
diff --git a/tests/typerel/tvoid.nim b/tests/typerel/tvoid.nim
index d31936217..1e46d016e 100644
--- a/tests/typerel/tvoid.nim
+++ b/tests/typerel/tvoid.nim
@@ -16,14 +16,14 @@ proc nothing(x, y: void): void =
   echo "ha"
 
 proc callProc[T](p: proc (x: T) {.nimcall.}, x: T) =
-  when T is void: 
+  when T is void:
     p()
   else:
     p(x)
 
 proc intProc(x: int) =
   echo x
-  
+
 proc emptyProc() =
   echo "empty"
 
diff --git a/tests/typerel/typalias.nim b/tests/typerel/typalias.nim
index 55dcb9fa6..e85f1f664 100644
--- a/tests/typerel/typalias.nim
+++ b/tests/typerel/typalias.nim
@@ -3,13 +3,13 @@ type
   TMyObj = TYourObj
   TYourObj = object of RootObj
     x, y: int
-  
+
 proc init: TYourObj =
   result.x = 0
   result.y = -1
-  
+
 proc f(x: var TYourObj) =
   discard
-  
+
 var m: TMyObj = init()
 f(m)
diff --git a/tests/typerel/typeof_in_template.nim b/tests/typerel/typeof_in_template.nim
new file mode 100644
index 000000000..9ec06f2e3
--- /dev/null
+++ b/tests/typerel/typeof_in_template.nim
@@ -0,0 +1,16 @@
+discard """
+  output: '''@[a, c]'''
+"""
+
+# bug #3230
+
+import sequtils
+
+const
+  test_strings = ["a", "b", "c"]
+
+proc is_doc(x: string): bool = x == "b"
+
+let
+  tests = @test_strings.filter_it(not it.is_doc)
+echo tests
diff --git a/tests/types/tauto_excessive.nim b/tests/types/tauto_excessive.nim
new file mode 100644
index 000000000..2626b0cf4
--- /dev/null
+++ b/tests/types/tauto_excessive.nim
@@ -0,0 +1,20 @@
+discard """
+  output: '''10
+10.0
+1.0hiho'''
+"""
+
+# bug #3224
+proc f(x: auto): auto =
+  result = $(x+10)
+
+proc f(x, y: auto): auto =
+  result = $(x+y)
+
+
+echo f(0)     # prints 10
+echo f(0.0)  # prints 10.0
+
+proc `+`(a, b: string): string = a & b
+
+echo f(0.7, 0.3), f("hi", "ho")
diff --git a/tests/types/temptyseqs.nim b/tests/types/temptyseqs.nim
index 2b07ba679..834f63729 100644
--- a/tests/types/temptyseqs.nim
+++ b/tests/types/temptyseqs.nim
@@ -1,5 +1,13 @@
 discard """
-  output: "1"
+  output: '''1
+foo
+bar
+baz
+foo
+bar
+baz
+yes
+no'''
 """
 
 # bug #1708
@@ -24,3 +32,59 @@ when true:
 const foo2: seq[string] = @[]
 
 echo foo[0][0][0]
+
+proc takeEmpty(x: openArray[string] = []) = discard
+takeEmpty()
+takeEmpty([])
+
+proc takeEmpty2(x: openArray[string] = @[]) = discard
+takeEmpty2()
+takeEmpty2([])
+takeEmpty2(@[])
+
+#takeEmpty2([nil])
+
+#rawMessage(errExecutionOfProgramFailed, [])
+
+# bug #2470
+const
+  stuff: seq[string] = @[]
+
+for str in stuff:
+  echo "str=", str
+
+# bug #1354
+proc foo4[T](more: seq[T] = @[]) =
+  var more2 = more
+
+foo4[int]()
+
+proc maino: int =
+  var wd: cstring = nil
+  inc result
+
+discard maino()
+
+proc varargso(a: varargs[string]) =
+  for x in a:
+    echo x
+
+varargso(["foo", "bar", "baz"])
+varargso("foo", "bar", "baz")
+
+
+type
+  Flago = enum
+    tfNeedsInit, tfNotNil
+
+var s: set[Flago] = {tfNeedsInit}
+
+if {tfNeedsInit, tfNotNil} * s != {}:
+  echo "yes"
+else:
+  echo "no"
+
+if {tfNeedsInit, tfNotNil} * s <= {tfNotNil}:
+  echo "yes"
+else:
+  echo "no"
diff --git a/tests/types/tfinalobj.nim b/tests/types/tfinalobj.nim
index 1cd7fae28..2fda73363 100644
--- a/tests/types/tfinalobj.nim
+++ b/tests/types/tfinalobj.nim
@@ -3,9 +3,9 @@ discard """
 """
 
 type
-  TA = object {.pure, final.} 
+  TA = object {.pure, final.}
     x: string
-    
+
 var
   a: TA
 a.x = "abc"
diff --git a/tests/types/tforwty.nim b/tests/types/tforwty.nim
index 0f1d3697f..626abd5ef 100644
--- a/tests/types/tforwty.nim
+++ b/tests/types/tforwty.nim
@@ -1,9 +1,9 @@
-# Test 13: forward types

-

-type

-  PSym = ref TSym

-

-  TSym = object

-    next: PSym

-

-var s: PSym

+# Test 13: forward types
+
+type
+  PSym = ref TSym
+
+  TSym = object
+    next: PSym
+
+var s: PSym
diff --git a/tests/types/tforwty2.nim b/tests/types/tforwty2.nim
index 52af1c7dd..6449e25bc 100644
--- a/tests/types/tforwty2.nim
+++ b/tests/types/tforwty2.nim
@@ -1,22 +1,22 @@
-# Test for a hard to fix internal error

-# occurred in the SDL library

-

-{.push dynlib: "SDL.dll", callconv: cdecl.}

-

-type

-  PSDL_semaphore = ptr TSDL_semaphore

-  TSDL_semaphore {.final.} = object

-    sem: pointer             #PSem_t;

-    when not defined(USE_NAMED_SEMAPHORES):

-      sem_data: int

-    when defined(BROKEN_SEMGETVALUE):

-      # This is a little hack for MacOS X -

-      # It's not thread-safe, but it's better than nothing

-      sem_value: cint

-

-type

-  PSDL_Sem = ptr TSDL_Sem

-  TSDL_Sem = TSDL_Semaphore

-

-proc SDL_CreateSemaphore(initial_value: int32): PSDL_Sem {.

-  importc: "SDL_CreateSemaphore".}

+# Test for a hard to fix internal error
+# occurred in the SDL library
+
+{.push dynlib: "SDL.dll", callconv: cdecl.}
+
+type
+  PSDL_semaphore = ptr TSDL_semaphore
+  TSDL_semaphore {.final.} = object
+    sem: pointer             #PSem_t;
+    when not defined(USE_NAMED_SEMAPHORES):
+      sem_data: int
+    when defined(BROKEN_SEMGETVALUE):
+      # This is a little hack for MacOS X -
+      # It's not thread-safe, but it's better than nothing
+      sem_value: cint
+
+type
+  PSDL_Sem = ptr TSDL_Sem
+  TSDL_Sem = TSDL_Semaphore
+
+proc SDL_CreateSemaphore(initial_value: int32): PSDL_Sem {.
+  importc: "SDL_CreateSemaphore".}
diff --git a/tests/types/tillegaltyperecursion.nim b/tests/types/tillegaltyperecursion.nim
index ebdbc1d13..bace2dfc8 100644
--- a/tests/types/tillegaltyperecursion.nim
+++ b/tests/types/tillegaltyperecursion.nim
@@ -18,7 +18,7 @@ type
         MessageReceivedHandler*: TEventHandler
         Socket: TSocket
         Thread: TThread[TIRC]
-        
+
 proc initIRC*(): TIRC =
     result.Socket = socket()
     result.EventEmitter = initEventEmitter()
@@ -26,8 +26,8 @@ proc initIRC*(): TIRC =
 
 proc IsConnected*(irc: var TIRC): bool =
     return running(irc.Thread)
-  
-   
+
+
 proc sendRaw*(irc: var TIRC, message: string) =
     irc.Socket.send(message & "\r\L")
 proc handleData(irc: TIRC) {.thread.} =
@@ -40,14 +40,14 @@ proc handleData(irc: TIRC) {.thread.} =
         if len(tup) == 1:
             #Connected
             connected = True
-            
+
             #Parse data here
-            
+
         else:
             #Disconnected
             connected = False
             return
-   
+
 proc Connect*(irc: var TIRC, nick: string, host: string, port: int = 6667) =
     connect(irc.Socket ,host ,TPort(port),TDomain.AF_INET)
     send(irc.Socket,"USER " & nick & " " & nick & " " & nick & " " & nick &"\r\L")
@@ -57,8 +57,8 @@ proc Connect*(irc: var TIRC, nick: string, host: string, port: int = 6667) =
     irc.Thread = thread
 
 
-        
-        
+
+
 when isMainModule:
     var irc = initIRC()
     irc.Connect("AmryBot[Nim]","irc.freenode.net",6667)
diff --git a/tests/types/tinheritref.nim b/tests/types/tinheritref.nim
index e5de6a4be..ecd62a06f 100644
--- a/tests/types/tinheritref.nim
+++ b/tests/types/tinheritref.nim
@@ -21,7 +21,7 @@ type
   TTreeIterator* [T,D] = ref object {.inheritable.}
 
   TKeysIterator* [T,D] = ref object of TTreeIterator[T,D]  #this not
-  
+
 var
   it: TKeysIterator[int, string] = nil
 
diff --git a/tests/types/tisop.nim b/tests/types/tisop.nim
index 05c6a1a06..d0b7c32b2 100644
--- a/tests/types/tisop.nim
+++ b/tests/types/tisop.nim
@@ -6,7 +6,7 @@ import typetraits
 
 type
   TRecord = (tuple) or (object)
-  
+
   TFoo[T, U] = object
     x: int
 
diff --git a/tests/types/tisopr.nim b/tests/types/tisopr.nim
index 8b7fe4e46..b9acfa5fb 100644
--- a/tests/types/tisopr.nim
+++ b/tests/types/tisopr.nim
@@ -1,5 +1,11 @@
 discard """
-  output: '''true true false yes'''
+  output: '''true true false yes
+false
+false
+false
+true
+true
+no'''
 """
 
 proc IsVoid[T](): string =
@@ -28,7 +34,7 @@ no  s.items is iterator: float
 yes s.items is iterator: TNumber
 no  s.items is iterator: object
 
-type 
+type
   Iter[T] = iterator: T
 
 yes s.items is Iter[TNumber]
@@ -51,3 +57,34 @@ yes Foo[4, int] is Bar[int]
 no Foo[4, int] is Baz[4]
 yes Foo[4, float] is Baz[4]
 
+
+# bug #2505
+
+echo(8'i8 is int32)
+
+# bug #1853
+type SeqOrSet[E] = seq[E] or set[E]
+type SeqOfInt = seq[int]
+type SeqOrSetOfInt = SeqOrSet[int]
+
+# This prints "false", which seems less correct that (1) printing "true" or (2)
+# raising a compiler error.
+echo seq is SeqOrSet
+
+# This prints "false", as expected.
+echo seq is SeqOrSetOfInt
+
+# This prints "true", as expected.
+echo SeqOfInt is SeqOrSet
+
+# This causes an internal error (filename: compiler/semtypes.nim, line: 685).
+echo SeqOfInt is SeqOrSetOfInt
+
+# bug #2522
+proc test[T](x: T) =
+  when T is typedesc:
+    echo "yes"
+  else:
+    echo "no"
+
+test(7)
diff --git a/tests/varres/tvarres1.nim b/tests/varres/tvarres1.nim
index de4a505d3..849805768 100644
--- a/tests/varres/tvarres1.nim
+++ b/tests/varres/tvarres1.nim
@@ -7,10 +7,10 @@ discard """
 var
   g = 5
 
-proc p(): var int = 
+proc p(): var int =
   var bla: int
   result = bla
-  
+
 p() = 45
 
 echo g
diff --git a/tests/varres/tvarres2.nim b/tests/varres/tvarres2.nim
index 165e4a36e..53a57d882 100644
--- a/tests/varres/tvarres2.nim
+++ b/tests/varres/tvarres2.nim
@@ -7,9 +7,9 @@ discard """
 var
   g = 5
 
-proc p(): var int = 
+proc p(): var int =
   result = 89
-  
+
 p() = 45
 
 echo g
diff --git a/tests/varres/tvarres3.nim b/tests/varres/tvarres3.nim
index a48c961df..9fcd79bfc 100644
--- a/tests/varres/tvarres3.nim
+++ b/tests/varres/tvarres3.nim
@@ -5,10 +5,10 @@ discard """
 var
   g = 5
 
-proc p(): var int = 
+proc p(): var int =
   var bla = addr(g) #: array [0..7, int]
   result = bla[]
-  
+
 p() = 45
 
 echo g
diff --git a/tests/varres/tvartup.nim b/tests/varres/tvartup.nim
index f885cdf37..20a4156e6 100644
--- a/tests/varres/tvartup.nim
+++ b/tests/varres/tvartup.nim
@@ -6,7 +6,7 @@ discard """
 
 proc divmod(a, b: int): tuple[di, mo: int] =
   return (a div b, a mod b)
-  
+
 var (x, y) = divmod(15, 6)
 stdout.write(x)
 stdout.write(" ")
diff --git a/tests/varstmt/tlet.nim b/tests/varstmt/tlet.nim
index 138f34433..9c2d9706d 100644
--- a/tests/varstmt/tlet.nim
+++ b/tests/varstmt/tlet.nim
@@ -11,7 +11,7 @@ proc main =
     echo("Very funny, your name is name.")
   else:
     echo("Hi, ", name, "!")
-    
+
   let (x, y) = ("abc", name)
   echo y, x
 
diff --git a/tests/varstmt/tvardecl.nim b/tests/varstmt/tvardecl.nim
index 5cc6f4960..a6b508295 100644
--- a/tests/varstmt/tvardecl.nim
+++ b/tests/varstmt/tvardecl.nim
@@ -2,14 +2,14 @@ discard """
   file: "tvardecl.nim"
   output: "44"
 """
-# Test the new variable declaration syntax

-

-var

-  x = 0

-  s = "Hallo"

-  a, b: int = 4

-

-write(stdout, a)

-write(stdout, b) #OUT 44

+# Test the new variable declaration syntax
+
+var
+  x = 0
+  s = "Hallo"
+  a, b: int = 4
+
+write(stdout, a)
+write(stdout, b) #OUT 44
 
 
diff --git a/tests/vm/tarrayboundeval.nim b/tests/vm/tarrayboundeval.nim
index 07aac4c4e..af9e33339 100644
--- a/tests/vm/tarrayboundeval.nim
+++ b/tests/vm/tarrayboundeval.nim
@@ -15,12 +15,12 @@ type
 
 echo FU.high
 
-type 
+type
   PKeyboard* = ptr object
   TKeyboardState* = object
     display*: pointer
     internal: array[int((KeyMax + 31)/32), cuint]
-    
+
 echo myconst, " ", int((KeyMax + 31) / 32)
 
 #bug 1304 or something:
diff --git a/tests/vm/tasmparser.nim b/tests/vm/tasmparser.nim
index 67313c858..fbacdbc87 100644
--- a/tests/vm/tasmparser.nim
+++ b/tests/vm/tasmparser.nim
@@ -79,23 +79,23 @@ proc asmx64 () {.compileTime} =
 
     case state:
     of leading:
-      
+
       echo "b100 ", start
       start += code.skipWhile (leadingWhiteSpace, start)
       echo "b200 ", start
       let ch = code [start]
       if ch in endOfLine:
         inc (line)
-        #echo "c100 ", start, ' ', code 
+        #echo "c100 ", start, ' ', code
         start += code.skipWhile (endOfline, start)
-        #echo "c200 ", start, ' ', code 
+        #echo "c200 ", start, ' ', code
         continue
       elif ch in symbolStart:
         state = mnemonic
       elif ch in eolComment:
         state = skipToEndOfLine
       elif ch in passthrough_start:
-        get_passthrough ()        
+        get_passthrough ()
         echo "d100 ", start
         start += code.parseUntil (token, end_or_symbol_or_comment_or_passthrough, start)
         echo "d200 ", start
@@ -124,7 +124,7 @@ proc asmx64 () {.compileTime} =
       if codeLen <= start:
         state = endCmd
         continue
-        
+
       let ch = code [start]
       if ch in passthrough_start:
         get_passthrough ()
@@ -148,7 +148,7 @@ proc asmx64 () {.compileTime} =
     of endCmd:
       cpp.add ");\n"
       state = skipToEndOfLine
-    
+
     of skipToEndOfLine:
       echo "a100 ", start
       start += code.skipUntil (endOfLine, start)
diff --git a/tests/vm/tconsteval.nim b/tests/vm/tconsteval.nim
index 4459931c5..f4260495a 100644
--- a/tests/vm/tconsteval.nim
+++ b/tests/vm/tconsteval.nim
@@ -24,7 +24,7 @@ Possible Commands:
   csource [options]        builds the C sources for installation
   zip                      builds the installation ZIP package
   inno                     builds the Inno Setup installer
-""" % [NimVersion & spaces(44-len(NimVersion)), 
+""" % [NimVersion & spaces(44-len(NimVersion)),
        CompileDate, CompileTime]
 
 echo HelpText
diff --git a/tests/vm/tconstobj.nim b/tests/vm/tconstobj.nim
new file mode 100644
index 000000000..51f30fb78
--- /dev/null
+++ b/tests/vm/tconstobj.nim
@@ -0,0 +1,36 @@
+discard """
+  output: '''(name: hello)
+(-1, 0)'''
+"""
+
+# bug #2774, bug #3195
+
+type Foo = object
+  name: string
+
+const fooArray = [
+  Foo(name: "hello")
+]
+
+echo fooArray[0]
+
+
+type
+    Position = object
+        x, y: int
+
+proc `$`(pos: Position): string =
+    result = "(" & $pos.x & ", " & $pos.y & ")"
+
+proc newPos(x, y: int): Position =
+    result = Position(x: x, y: y)
+
+const
+     offset: array[1..4, Position] = [
+         newPos(-1, 0),
+         newPos(1, 0),
+         newPos(0, -1),
+         newPos(0, 1)
+     ]
+
+echo offset[1]
diff --git a/tests/vm/tconsttable2.nim b/tests/vm/tconsttable2.nim
new file mode 100644
index 000000000..e07734eb5
--- /dev/null
+++ b/tests/vm/tconsttable2.nim
@@ -0,0 +1,81 @@
+discard """
+  msg: '''61'''
+"""
+
+# bug #2297
+
+import tables
+
+proc html5tags*(): TableRef[string, string] =
+  var html5tagsCache: Table[string,string]
+  if true:
+    new(result)
+    html5tagsCache = initTable[string, string]()
+    html5tagsCache["a"] = "a"
+    html5tagsCache["abbr"] = "abbr"
+    html5tagsCache["b"] = "b"
+    html5tagsCache["element"] = "element"
+    html5tagsCache["embed"] = "embed"
+    html5tagsCache["fieldset"] = "fieldset"
+    html5tagsCache["figcaption"] = "figcaption"
+    html5tagsCache["figure"] = "figure"
+    html5tagsCache["footer"] = "footer"
+    html5tagsCache["header"] = "header"
+    html5tagsCache["form"] = "form"
+    html5tagsCache["head"] = "head"
+    html5tagsCache["hr"] = "hr"
+    html5tagsCache["html"] = "html"
+    html5tagsCache["iframe"] = "iframe"
+    html5tagsCache["img"] = "img"
+    html5tagsCache["input"] = "input"
+    html5tagsCache["keygen"] = "keygen"
+    html5tagsCache["label"] = "label"
+    html5tagsCache["legend"] = "legend"
+    html5tagsCache["li"] = "li"
+    html5tagsCache["link"] = "link"
+    html5tagsCache["main"] = "main"
+    html5tagsCache["map"] = "map"
+    html5tagsCache["menu"] = "menu"
+    html5tagsCache["menuitem"] = "menuitem"
+    html5tagsCache["meta"] = "meta"
+    html5tagsCache["meter"] = "master"
+    html5tagsCache["noscript"] = "noscript"
+    html5tagsCache["object"] = "object"
+    html5tagsCache["ol"] = "ol"
+    html5tagsCache["optgroup"] = "optgroup"
+    html5tagsCache["option"] = "option"
+    html5tagsCache["output"] = "output"
+    html5tagsCache["p"] = "p"
+    html5tagsCache["pre"] = "pre"
+    html5tagsCache["param"] = "param"
+    html5tagsCache["progress"] = "progress"
+    html5tagsCache["q"] = "q"
+    html5tagsCache["rp"] = "rp"
+    html5tagsCache["rt"] = "rt"
+    html5tagsCache["ruby"] = "ruby"
+    html5tagsCache["s"] = "s"
+    html5tagsCache["script"] = "script"
+    html5tagsCache["select"] = "select"
+    html5tagsCache["source"] = "source"
+    html5tagsCache["style"] = "style"
+    html5tagsCache["summary"] = "summary"
+    html5tagsCache["table"] = "table"
+    html5tagsCache["tbody"] = "tbody"
+    html5tagsCache["thead"] = "thead"
+    html5tagsCache["td"] = "td"
+    html5tagsCache["th"] = "th"
+    html5tagsCache["template"] = "template"
+    html5tagsCache["textarea"] = "textarea"
+    html5tagsCache["time"] = "time"
+    html5tagsCache["title"] = "title"
+    html5tagsCache["tr"] = "tr"
+    html5tagsCache["track"] = "track"
+    html5tagsCache["ul"] = "ul"
+    html5tagsCache["video"] = "video"
+  result[] = html5tagsCache
+
+static:
+  var i = 0
+  for key, value in html5tags().pairs():
+    inc i
+  echo i
diff --git a/tests/vm/teval1.nim b/tests/vm/teval1.nim
index cdb4ad8e2..1d3a68a0d 100644
--- a/tests/vm/teval1.nim
+++ b/tests/vm/teval1.nim
@@ -13,7 +13,7 @@ when true:
 
 const
   x = testProc()
-  
+
 echo "##", x, "##"
 
 # bug #1310
diff --git a/tests/vm/tforwardproc.nim b/tests/vm/tforwardproc.nim
new file mode 100644
index 000000000..727ac6641
--- /dev/null
+++ b/tests/vm/tforwardproc.nim
@@ -0,0 +1,17 @@
+discard """
+  errormsg: "cannot evaluate at compile time: initArray"
+  line: 11
+"""
+
+# bug #3066
+
+proc initArray(): array[10, int]
+
+const
+  someTable = initArray()
+
+proc initArray(): array[10, int] =
+  for f in 0..<10:
+    result[f] = 3
+
+when isMainModule: echo repr(someTable)
diff --git a/tests/vm/tldconst.nim b/tests/vm/tldconst.nim
index 9eabb7525..7df3143c9 100644
--- a/tests/vm/tldconst.nim
+++ b/tests/vm/tldconst.nim
@@ -11,4 +11,4 @@ proc foobar(): int =
         discard
     0
 
-const x = foobar()
\ No newline at end of file
+const x = foobar()
diff --git a/tests/vm/trgba.nim b/tests/vm/trgba.nim
index 22eec4d6e..da1a2d0c5 100644
--- a/tests/vm/trgba.nim
+++ b/tests/vm/trgba.nim
@@ -8,19 +8,19 @@ discard """
 type
   TAggRgba8* = array[4, byte]
 
-template R*(self: TAggRgba8): byte = self[0]   
-template G*(self: TAggRgba8): byte = self[1]   
-template B*(self: TAggRgba8): byte = self[2]   
-template A*(self: TAggRgba8): byte = self[3]   
+template R*(self: TAggRgba8): byte = self[0]
+template G*(self: TAggRgba8): byte = self[1]
+template B*(self: TAggRgba8): byte = self[2]
+template A*(self: TAggRgba8): byte = self[3]
 
-template `R=`*(self: TAggRgba8, val: byte) = 
-  self[0] = val   
-template `G=`*(self: TAggRgba8, val: byte) =   
-  self[1] = val   
-template `B=`*(self: TAggRgba8, val: byte) =   
-  self[2] = val   
-template `A=`*(self: TAggRgba8, val: byte) =   
-  self[3] = val   
+template `R=`*(self: TAggRgba8, val: byte) =
+  self[0] = val
+template `G=`*(self: TAggRgba8, val: byte) =
+  self[1] = val
+template `B=`*(self: TAggRgba8, val: byte) =
+  self[2] = val
+template `A=`*(self: TAggRgba8, val: byte) =
+  self[3] = val
 
 proc ABGR* (val: int| int64): TAggRgba8 =
   var V = val
@@ -32,5 +32,5 @@ proc ABGR* (val: int| int64): TAggRgba8 =
   result.A = (V shr 8) and 0xFF
 
 const
-  c1 = ABGR(0xFF007F7F) 
+  c1 = ABGR(0xFF007F7F)
 echo ABGR(0xFF007F7F).repr, c1.repr
diff --git a/tests/vm/tsimpleglobals.nim b/tests/vm/tsimpleglobals.nim
new file mode 100644
index 000000000..27bfdce50
--- /dev/null
+++ b/tests/vm/tsimpleglobals.nim
@@ -0,0 +1,16 @@
+discard """
+  msg: "abc xyz bb"
+"""
+
+# bug #2473
+type
+  Test = tuple[a,b: string]
+
+static:
+  var s:seq[Test] = @[(a:"a", b:"b")]
+  s[0] = (a:"aa", b:"bb")
+
+  var x: Test
+  x.a = "abc"
+  x.b = "xyz"
+  echo x.a, " ", x.b, " ", s[0].b
diff --git a/tests/vm/tslurp.nim b/tests/vm/tslurp.nim
index f9456ce6b..027db45d6 100644
--- a/tests/vm/tslurp.nim
+++ b/tests/vm/tslurp.nim
@@ -1,6 +1,12 @@
+import os
+
+template getScriptDir(): string =
+  parentDir(instantiationInfo(-1, true).filename)
 
 const
-  myRes = slurp"../../readme.txt"
-  
-echo myRes
+  relRes = slurp"../../readme.txt"
+  absRes = slurp(parentDir(parentDir(getScriptDir())) / "readme.txt")
+
+echo relRes
+echo absRes
 
diff --git a/tests/vm/tstaticprintseq.nim b/tests/vm/tstaticprintseq.nim
index b002d366c..e4a6aa081 100644
--- a/tests/vm/tstaticprintseq.nim
+++ b/tests/vm/tstaticprintseq.nim
@@ -18,7 +18,8 @@ bb
 aa
 bb
 24
-2147483647 2147483647'''
+2147483647 2147483647
+5'''
 """
 
 const s = @[1,2,3]
@@ -80,3 +81,12 @@ static:
 static:
   var foo2 = int32.high
   echo foo2, " ", int32.high
+
+# bug #1329
+
+static:
+    var a: ref int
+    new(a)
+    a[] = 5
+
+    echo a[]
diff --git a/tests/vm/tswap.nim b/tests/vm/tswap.nim
new file mode 100644
index 000000000..2219be9ca
--- /dev/null
+++ b/tests/vm/tswap.nim
@@ -0,0 +1,24 @@
+discard """
+msg: '''
+x.data = @[10]
+y = @[11]
+x.data = @[11]
+y = @[10]'''
+"""
+
+# bug #2946
+
+proc testSwap(): int {.compiletime.} =
+  type T = object
+    data: seq[int]
+  var x: T
+  x.data = @[10]
+  var y = @[11]
+  echo "x.data = ", x.data
+  echo "y = ", y
+  swap(y, x.data)
+  echo "x.data = ", x.data
+  echo "y = ", y
+  result = 99
+
+const something = testSwap()
diff --git a/tests/vm/twrongconst.nim b/tests/vm/twrongconst.nim
index 68ab2757c..424ed080e 100644
--- a/tests/vm/twrongconst.nim
+++ b/tests/vm/twrongconst.nim
@@ -1,6 +1,6 @@
 discard """
   errormsg: "cannot evaluate at compile time: x"
-  line: 9
+  line: 7
 """
 
 var x: array[100, char]
diff --git a/tests/vm/tyaytypedesc.nim b/tests/vm/tyaytypedesc.nim
new file mode 100644
index 000000000..a3ad9b707
--- /dev/null
+++ b/tests/vm/tyaytypedesc.nim
@@ -0,0 +1,21 @@
+discard """
+  output: "ntWhitespace"
+"""
+
+# bug #3357
+
+type NodeType* = enum
+  ntWhitespace
+
+type TokenType* = enum
+  ttWhitespace
+
+proc enumTable*[A, B, C](a: openarray[tuple[key: A, val: B]], ret: typedesc[C]): C =
+  for item in a:
+    result[item.key] = item.val
+
+const tokenTypeToNodeType = {
+  ttWhitespace: ntWhitespace,
+}.enumTable(array[ttWhitespace..ttWhitespace, NodeType])
+
+echo tokenTypeToNodeType[ttWhitespace]