From 243e66596554bdd318ff26f15b377403ea1fee6a Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 29 Sep 2015 15:42:45 -0700 Subject: [PATCH 01/10] fix current directory --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2509c0b97d..6a04c4c937 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,9 @@ language: c os: linux script: - git clone --depth 1 https://github.com/nim-lang/csources.git - - cd csources && sh build.sh + - cd csources + - sh build.sh + - cd .. - ./bin/nim c koch - ./koch boot - ./koch boot -d:release From 52230e2ae05a927ced6feb566440430760ce0545 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 29 Sep 2015 15:51:18 -0700 Subject: [PATCH 02/10] set PATH for tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6a04c4c937..c451586511 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,5 @@ script: - ./koch boot - ./koch boot -d:release after_script: + - export PATH=$(pwd)/bin:$PATH - ./koch test From dd1e0bd8366d96a8d7b800b5528880d0fe505489 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 29 Sep 2015 15:51:31 -0700 Subject: [PATCH 03/10] run in travisci containers --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index c451586511..8001b43554 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: c os: linux script: From 7f619c75e62cd615b0c4789d3e211718024e6eb8 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 29 Sep 2015 15:51:43 -0700 Subject: [PATCH 04/10] build on macosx too --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8001b43554..061dd8188d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ sudo: false language: c -os: linux +os: + - linux + - osx script: - git clone --depth 1 https://github.com/nim-lang/csources.git - cd csources From a90241b8c455f176f24e5866d20afea156ba92fc Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 29 Sep 2015 16:20:51 -0700 Subject: [PATCH 05/10] remove mac builds for now --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 061dd8188d..27daab34b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ sudo: false language: c os: - linux - - osx script: - git clone --depth 1 https://github.com/nim-lang/csources.git - cd csources From 517312467eb5be2406572384aaa3c75f7bb4a532 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 29 Sep 2015 16:22:47 -0700 Subject: [PATCH 06/10] add libcurl and libsdl1 headers --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 27daab34b1..486feb1274 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,11 @@ sudo: false language: c os: - linux +addons: + apt: + packages: + - libcurl4-openssl-dev + - libsdl1.2-dev script: - git clone --depth 1 https://github.com/nim-lang/csources.git - cd csources From d80f1633844597f3a8020fc156d2d889bf897d97 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 30 Sep 2015 11:02:23 +0200 Subject: [PATCH 07/10] NimScript: --define works as expected --- compiler/scriptconfig.nim | 5 ++++- tests/newconfig/tfoo.nim | 3 +++ tests/newconfig/tfoo.nims | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index aaa2486e5d..22cd282fda 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -140,4 +140,7 @@ proc runNimScript*(scriptName: string) = # ensure we load 'system.nim' again for the real non-config stuff! resetAllModulesHard() vm.globalCtx = nil - initDefines() + # do not remove the defined symbols + #initDefines() + undefSymbol("nimscript") + undefSymbol("nimconfig") diff --git a/tests/newconfig/tfoo.nim b/tests/newconfig/tfoo.nim index 0ace7c88a7..d593d4a756 100644 --- a/tests/newconfig/tfoo.nim +++ b/tests/newconfig/tfoo.nim @@ -4,4 +4,7 @@ discard """ 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 index 90205cddba..a2166576d0 100644 --- a/tests/newconfig/tfoo.nims +++ b/tests/newconfig/tfoo.nims @@ -10,5 +10,6 @@ task listDirs, "lists every subdirectory": echo "DIR ", x task default, "default target": + --define: definedefine setCommand "c" From 374b65289c258b2c33f6087b87b336dc5908b9d9 Mon Sep 17 00:00:00 2001 From: Radu Oana Date: Wed, 30 Sep 2015 08:20:24 -0400 Subject: [PATCH 08/10] Move magic numbers to const --- lib/pure/streams.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 68f31e9fea..88ac626a67 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -103,15 +103,16 @@ proc readData*(s: Stream, buffer: pointer, bufLen: int): int = proc readAll*(s: Stream): string = ## Reads all available data. - result = newString(1000) + let bufferSize = 1000 + result = newString(bufferSize) var r = 0 while true: - let readBytes = readData(s, addr(result[r]), 1000) - if readBytes < 1000: + let readBytes = readData(s, addr(result[r]), bufferSize) + if readBytes < bufferSize: setLen(result, r+readBytes) break - inc r, 1000 - setLen(result, r+1000) + inc r, bufferSize + setLen(result, r+bufferSize) proc readData*(s, unused: Stream, buffer: pointer, bufLen: int): int {.deprecated.} = From 4bba8e026a266dd7ab0622ce580b517078516cd9 Mon Sep 17 00:00:00 2001 From: Radu Oana Date: Wed, 30 Sep 2015 09:49:22 -0400 Subject: [PATCH 09/10] use const instead of let --- lib/pure/streams.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 88ac626a67..38e91fee48 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -103,7 +103,7 @@ proc readData*(s: Stream, buffer: pointer, bufLen: int): int = proc readAll*(s: Stream): string = ## Reads all available data. - let bufferSize = 1000 + const bufferSize = 1000 result = newString(bufferSize) var r = 0 while true: From dd2225fe073c51cee144a06745c9b3ef620b2bbd Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 30 Sep 2015 17:18:41 +0200 Subject: [PATCH 10/10] NimScript: --threads:on works in a nims file --- lib/system.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/system.nim b/lib/system.nim index 59d0d04b78..1d2ca6a9a5 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1256,7 +1256,7 @@ proc compileOption*(option, arg: string): bool {. ## echo "compiled with optimization for size and uses Boehm's GC" const - hasThreadSupport = compileOption("threads") + hasThreadSupport = compileOption("threads") and not defined(nimscript) hasSharedHeap = defined(boehmgc) or defined(gogc) # don't share heaps; every thread has its own taintMode = compileOption("taintmode")