summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xbuild.bat26
-rwxr-xr-xinstall.sh20
-rw-r--r--tests/accept/compile/titer2.nim40
-rw-r--r--tests/accept/run/ttables.nim2
4 files changed, 68 insertions, 20 deletions
diff --git a/build.bat b/build.bat
index 221bc0b55..ee37dc429 100755
--- a/build.bat
+++ b/build.bat
@@ -31,10 +31,10 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/options.c -o build/1_1/options.o
 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/options.c -o build/1_1/options.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/lists.c -o build/1_1/lists.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/lists.c -o build/1_1/lists.o

-ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/nstrtabs.c -o build/1_1/nstrtabs.o

-%CC% %COMP_FLAGS% -Ibuild -c build/1_1/nstrtabs.c -o build/1_1/nstrtabs.o

-ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/nhashes.c -o build/1_1/nhashes.o

-%CC% %COMP_FLAGS% -Ibuild -c build/1_1/nhashes.c -o build/1_1/nhashes.o

+ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/strtabs.c -o build/1_1/strtabs.o

+%CC% %COMP_FLAGS% -Ibuild -c build/1_1/strtabs.c -o build/1_1/strtabs.o

+ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/hashes.c -o build/1_1/hashes.o

+%CC% %COMP_FLAGS% -Ibuild -c build/1_1/hashes.c -o build/1_1/hashes.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/nversion.c -o build/1_1/nversion.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/nversion.c -o build/1_1/nversion.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/condsyms.c -o build/1_1/condsyms.o

@@ -49,6 +49,10 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/platform.c -o build/1_1/platform.o
 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/platform.c -o build/1_1/platform.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/idents.c -o build/1_1/idents.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/idents.c -o build/1_1/idents.o

+ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/intsets.c -o build/1_1/intsets.o

+%CC% %COMP_FLAGS% -Ibuild -c build/1_1/intsets.c -o build/1_1/intsets.o

+ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/math.c -o build/1_1/math.o

+%CC% %COMP_FLAGS% -Ibuild -c build/1_1/math.c -o build/1_1/math.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/astalgo.c -o build/1_1/astalgo.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/astalgo.c -o build/1_1/astalgo.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/rodutils.c -o build/1_1/rodutils.o

@@ -57,10 +61,6 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/extccomp.c -o build/1_1/extccomp.o
 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/extccomp.c -o build/1_1/extccomp.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/osproc.c -o build/1_1/osproc.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/osproc.c -o build/1_1/osproc.o

-ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/strtabs.c -o build/1_1/strtabs.o

-%CC% %COMP_FLAGS% -Ibuild -c build/1_1/strtabs.c -o build/1_1/strtabs.o

-ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/hashes.c -o build/1_1/hashes.o

-%CC% %COMP_FLAGS% -Ibuild -c build/1_1/hashes.c -o build/1_1/hashes.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/streams.c -o build/1_1/streams.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/streams.c -o build/1_1/streams.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/wordrecg.c -o build/1_1/wordrecg.o

@@ -97,14 +97,16 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/types.c -o build/1_1/types.o
 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/types.c -o build/1_1/types.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/trees.c -o build/1_1/trees.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/trees.c -o build/1_1/trees.o

-ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/math.c -o build/1_1/math.o

-%CC% %COMP_FLAGS% -Ibuild -c build/1_1/math.c -o build/1_1/math.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/magicsys.c -o build/1_1/magicsys.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/magicsys.c -o build/1_1/magicsys.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/nimsets.c -o build/1_1/nimsets.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/nimsets.c -o build/1_1/nimsets.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/bitsets.c -o build/1_1/bitsets.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/bitsets.c -o build/1_1/bitsets.o

+ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/semthreads.c -o build/1_1/semthreads.o

+%CC% %COMP_FLAGS% -Ibuild -c build/1_1/semthreads.c -o build/1_1/semthreads.o

+ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/tables.c -o build/1_1/tables.o

+%CC% %COMP_FLAGS% -Ibuild -c build/1_1/tables.c -o build/1_1/tables.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/importer.c -o build/1_1/importer.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/importer.c -o build/1_1/importer.o

 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/lookups.c -o build/1_1/lookups.o

@@ -152,8 +154,8 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/depends.c -o build/1_1/depends.o
 ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/parseopt.c -o build/1_1/parseopt.o

 %CC% %COMP_FLAGS% -Ibuild -c build/1_1/parseopt.c -o build/1_1/parseopt.o

 

-ECHO %LINKER% %LINK_FLAGS% -o bin\nimrod.exe  build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/nstrtabs.o build/1_1/nhashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/math.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/sem.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o

-%LINKER% %LINK_FLAGS% -o bin\nimrod.exe  build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/nstrtabs.o build/1_1/nhashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/math.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/sem.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o

+ECHO %LINKER% %LINK_FLAGS% -o bin\nimrod.exe  build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/intsets.o build/1_1/math.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/semthreads.o build/1_1/tables.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/sem.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o

+%LINKER% %LINK_FLAGS% -o bin\nimrod.exe  build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/intsets.o build/1_1/math.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/semthreads.o build/1_1/tables.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/sem.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o

 

 ECHO SUCCESS

 

diff --git a/install.sh b/install.sh
index 4cc4c944c..3fe865df6 100755
--- a/install.sh
+++ b/install.sh
@@ -153,6 +153,8 @@ if [ $# -eq 1 ] ; then
   chmod 644 $libdir/cycle.h
   cp lib/nimrtl.nim $libdir/nimrtl.nim || exit 1
   chmod 644 $libdir/nimrtl.nim
+  cp lib/prelude.nim $libdir/prelude.nim || exit 1
+  chmod 644 $libdir/prelude.nim
   cp lib/system.nim $libdir/system.nim || exit 1
   chmod 644 $libdir/system.nim
   cp lib/nimrtl.cfg $libdir/nimrtl.cfg || exit 1
@@ -165,12 +167,12 @@ if [ $# -eq 1 ] ; then
   chmod 644 $libdir/system/arithm.nim
   cp lib/system/assign.nim $libdir/system/assign.nim || exit 1
   chmod 644 $libdir/system/assign.nim
+  cp lib/system/atomics.nim $libdir/system/atomics.nim || exit 1
+  chmod 644 $libdir/system/atomics.nim
   cp lib/system/cellsets.nim $libdir/system/cellsets.nim || exit 1
   chmod 644 $libdir/system/cellsets.nim
   cp lib/system/cgprocs.nim $libdir/system/cgprocs.nim || exit 1
   chmod 644 $libdir/system/cgprocs.nim
-  cp lib/system/cntbits.nim $libdir/system/cntbits.nim || exit 1
-  chmod 644 $libdir/system/cntbits.nim
   cp lib/system/debugger.nim $libdir/system/debugger.nim || exit 1
   chmod 644 $libdir/system/debugger.nim
   cp lib/system/dyncalls.nim $libdir/system/dyncalls.nim || exit 1
@@ -197,14 +199,14 @@ if [ $# -eq 1 ] ; then
   chmod 644 $libdir/system/sysio.nim
   cp lib/system/sysstr.nim $libdir/system/sysstr.nim || exit 1
   chmod 644 $libdir/system/sysstr.nim
-  cp lib/system/systhread.nim $libdir/system/systhread.nim || exit 1
-  chmod 644 $libdir/system/systhread.nim
+  cp lib/system/threads.nim $libdir/system/threads.nim || exit 1
+  chmod 644 $libdir/system/threads.nim
   cp lib/core/macros.nim $libdir/core/macros.nim || exit 1
   chmod 644 $libdir/core/macros.nim
   cp lib/core/marshal.nim $libdir/core/marshal.nim || exit 1
   chmod 644 $libdir/core/marshal.nim
-  cp lib/core/threads.nim $libdir/core/threads.nim || exit 1
-  chmod 644 $libdir/core/threads.nim
+  cp lib/core/typeinfo.nim $libdir/core/typeinfo.nim || exit 1
+  chmod 644 $libdir/core/typeinfo.nim
   cp lib/pure/algorithm.nim $libdir/pure/algorithm.nim || exit 1
   chmod 644 $libdir/pure/algorithm.nim
   cp lib/pure/base64.nim $libdir/pure/base64.nim || exit 1
@@ -305,6 +307,8 @@ if [ $# -eq 1 ] ; then
   chmod 644 $libdir/impure/db_sqlite.nim
   cp lib/impure/dialogs.nim $libdir/impure/dialogs.nim || exit 1
   chmod 644 $libdir/impure/dialogs.nim
+  cp lib/impure/encodings.nim $libdir/impure/encodings.nim || exit 1
+  chmod 644 $libdir/impure/encodings.nim
   cp lib/impure/graphics.nim $libdir/impure/graphics.nim || exit 1
   chmod 644 $libdir/impure/graphics.nim
   cp lib/impure/osinfo_posix.nim $libdir/impure/osinfo_posix.nim || exit 1
@@ -341,6 +345,8 @@ if [ $# -eq 1 ] ; then
   chmod 644 $libdir/wrappers/postgres.nim
   cp lib/wrappers/python.nim $libdir/wrappers/python.nim || exit 1
   chmod 644 $libdir/wrappers/python.nim
+  cp lib/wrappers/sphinx.nim $libdir/wrappers/sphinx.nim || exit 1
+  chmod 644 $libdir/wrappers/sphinx.nim
   cp lib/wrappers/sqlite3.nim $libdir/wrappers/sqlite3.nim || exit 1
   chmod 644 $libdir/wrappers/sqlite3.nim
   cp lib/wrappers/tcl.nim $libdir/wrappers/tcl.nim || exit 1
@@ -349,6 +355,8 @@ if [ $# -eq 1 ] ; then
   chmod 644 $libdir/wrappers/tinyc.nim
   cp lib/wrappers/tre.nim $libdir/wrappers/tre.nim || exit 1
   chmod 644 $libdir/wrappers/tre.nim
+  cp lib/wrappers/zmq.nim $libdir/wrappers/zmq.nim || exit 1
+  chmod 644 $libdir/wrappers/zmq.nim
   cp lib/wrappers/cairo/cairo.nim $libdir/wrappers/cairo/cairo.nim || exit 1
   chmod 644 $libdir/wrappers/cairo/cairo.nim
   cp lib/wrappers/cairo/cairoft.nim $libdir/wrappers/cairo/cairoft.nim || exit 1
diff --git a/tests/accept/compile/titer2.nim b/tests/accept/compile/titer2.nim
new file mode 100644
index 000000000..878ddf5e3
--- /dev/null
+++ b/tests/accept/compile/titer2.nim
@@ -0,0 +1,40 @@
+discard """
+  output: '''true'''
+  cmd: "nimrod cc --gc:none --hints:on $# $#"
+"""
+
+import hashes
+
+type
+  TSlotEnum = enum seEmpty, seFilled, seDeleted
+  TKeyValuePair[A, B] = tuple[slot: TSlotEnum, key: A, val: B]
+  TKeyValuePairSeq[A, B] = seq[TKeyValuePair[A, B]]
+  TTable* {.final.}[A, B] = object
+    data: TKeyValuePairSeq[A, B]
+    counter: int
+
+proc len*[A, B](t: TTable[A, B]): int = 
+  result = t.counter
+
+iterator pairs*[A, B](t: TTable[A, B]): tuple[key: A, val: B] =
+  ## iterates over any (key, value) pair in the table `t`.
+  for h in 0..high(t.data):
+    if t.data[h].slot == seFilled: yield (t.data[h].key, t.data[h].val)
+
+proc initTable*[A, B](initialSize=64): TTable[A, B] =
+  ## creates a new hash table that is empty. `initialSize` needs to be
+  ## a power of two.
+  result.counter = 0
+  newSeq(result.data, initialSize)
+
+block Test1:
+  # generic cache does not instantiate the same iterator[types] twice. This
+  # means we have only one instantiation of 'h'. However, this is the same for
+  # a non-generic iterator!
+
+  var t = initTable[int, string]()
+  for k, v in t.pairs: nil
+  for k, v in t.pairs: nil
+
+echo "true"
+
diff --git a/tests/accept/run/ttables.nim b/tests/accept/run/ttables.nim
index cdf017dd5..3c7c7bc3a 100644
--- a/tests/accept/run/ttables.nim
+++ b/tests/accept/run/ttables.nim
@@ -70,8 +70,6 @@ block countTableTest1:
   t.inc("34", 1)
   assert t.largest()[0] == "90"
 
-  for k, v in t.pairs:
-    echo k, v  
   t.sort()
   var i = 0
   for k, v in t.pairs: