diff options
-rw-r--r-- | .travis.yml | 14 | ||||
-rw-r--r-- | compiler/scriptconfig.nim | 5 | ||||
-rw-r--r-- | lib/pure/streams.nim | 11 | ||||
-rw-r--r-- | lib/system.nim | 2 | ||||
-rw-r--r-- | tests/newconfig/tfoo.nim | 3 | ||||
-rw-r--r-- | tests/newconfig/tfoo.nims | 1 |
6 files changed, 27 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml index 2509c0b97..486feb127 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,20 @@ +sudo: false language: c -os: linux +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 && sh build.sh + - cd csources + - sh build.sh + - cd .. - ./bin/nim c koch - ./koch boot - ./koch boot -d:release after_script: + - export PATH=$(pwd)/bin:$PATH - ./koch test diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index aaa2486e5..22cd282fd 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/lib/pure/streams.nim b/lib/pure/streams.nim index 68f31e9fe..38e91fee4 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) + const 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.} = diff --git a/lib/system.nim b/lib/system.nim index 59d0d04b7..1d2ca6a9a 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") diff --git a/tests/newconfig/tfoo.nim b/tests/newconfig/tfoo.nim index 0ace7c88a..d593d4a75 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 90205cddb..a2166576d 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" |