diff options
-rwxr-xr-x | koch.nim | 22 | ||||
-rwxr-xr-x | lib/impure/zipfiles.nim | 2 | ||||
-rwxr-xr-x | lib/wrappers/lua/lua.nim | 8 | ||||
-rw-r--r-- | rod/ccgexprs.nim | 3 | ||||
-rw-r--r-- | rod/cgen.nim | 3 | ||||
-rwxr-xr-x | rod/expandimportc.nim | 1 | ||||
-rwxr-xr-x | rod/extccomp.nim | 1 | ||||
-rwxr-xr-x | rod/main.nim | 11 | ||||
-rwxr-xr-x | rod/platform.nim | 6 | ||||
-rwxr-xr-x | rod/scanner.nim | 8 | ||||
-rwxr-xr-x | tools/build.tmpl | 8 | ||||
-rwxr-xr-x | web/news.txt | 17 |
12 files changed, 39 insertions, 51 deletions
diff --git a/koch.nim b/koch.nim index 16efbb5ac..bb9d84d8e 100755 --- a/koch.nim +++ b/koch.nim @@ -41,7 +41,7 @@ proc tryExec(cmd: string): bool = result = execShellCmd(cmd) == 0 proc csource(args: string) = - exec("nimrod cc $# -r tools/niminst --var:version=$# csource rod/nimrod $2" % + exec("nimrod cc $1 -r tools/niminst --var:version=$2 csource rod/nimrod $1" % [args, NimrodVersion]) proc zip(args: string) = @@ -75,22 +75,8 @@ proc nim(args: string) = exec(compileNimCmd(args)) # -------------- boot --------------------------------------------------------- -proc writePlatdefC = - const - PlatdefCTmpl = """ - /* Generated by boot.nim */ - char* nimOS(void) { return "$#"; } - char* nimCPU(void) { return "$#"; } - """ - var f: TFile - if open(f, "build/platdef.c", fmWrite): - write(f, PlatdefcTmpl % [system.hostOS, system.hostCPU]) - close(f) - else: - quit("Cannot write 'build/platdef.c'\n") - const - bootOptions = "" # "--compile:build/platdef.c" + bootOptions = "" # options to pass to the bootstrap process proc findStartNimrod: string = const buildScript = "build.sh" @@ -118,10 +104,9 @@ proc findStartNimrod: string = proc bootIteration(args: string): bool = var nimrod1 = "rod" / "nimrod1".exe - if not ExistsFile("rod" / "nimrod".exe): - quit("no binary has been created! Failed! Try with --forcebuild") moveFile nimrod1, "rod" / "nimrod".exe exec "rod" / "nimrod1 cc $# $# rod/nimrod.nim" % [bootOptions, args] + # Nimrod does not produce an executable again if nothing changed. That's ok: result = sameFileContent("rod" / "nimrod".exe, nimrod1) if result: moveFile "bin" / "nimrod".exe, "rod" / "nimrod".exe @@ -129,7 +114,6 @@ proc bootIteration(args: string): bool = removeFile nimrod1 proc boot(args: string) = - #writePlatdefC() echo "iteration: 1" exec findStartNimrod() & " cc $# $# rod" / "nimrod.nim" % [bootOptions, args] echo "iteration: 2" diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim index 07fe41a04..09bf8f7cc 100755 --- a/lib/impure/zipfiles.nim +++ b/lib/impure/zipfiles.nim @@ -21,7 +21,7 @@ type proc zipError(z: var TZipArchive) = var e: ref EIO new(e) - e.msg = zip_strerror(z.w) + e.msg = $zip_strerror(z.w) raise e proc open*(z: var TZipArchive, filename: string, mode: TFileMode = fmRead): bool = diff --git a/lib/wrappers/lua/lua.nim b/lib/wrappers/lua/lua.nim index 7f419fa83..58c827b79 100755 --- a/lib/wrappers/lua/lua.nim +++ b/lib/wrappers/lua/lua.nim @@ -265,9 +265,9 @@ type lua_Chunkwriter* = lua_Writer # -#** {====================================================================== +#** ====================================================================== #** Debug API -#** ======================================================================= +#** ====================================================================== # const @@ -305,9 +305,9 @@ type lua_Hook* = proc (L: Plua_State, ar: Plua_Debug){.cdecl.} # -#** {====================================================================== +#** ====================================================================== #** Debug API -#** ======================================================================= +#** ====================================================================== # proc lua_getstack*(L: Plua_State, level: int, ar: Plua_Debug): int{.cdecl, diff --git a/rod/ccgexprs.nim b/rod/ccgexprs.nim index 905e3b115..62f8a267b 100644 --- a/rod/ccgexprs.nim +++ b/rod/ccgexprs.nim @@ -1622,8 +1622,7 @@ proc genComplexConst(p: BProc, sym: PSym, d: var TLoc) = putLocIntoDest(p, d, sym.loc) proc genStmtListExpr(p: BProc, n: PNode, d: var TLoc) = - var length: int - length = sonsLen(n) + var length = sonsLen(n) for i in countup(0, length - 2): genStmts(p, n.sons[i]) if length > 0: expr(p, n.sons[length - 1], d) diff --git a/rod/cgen.nim b/rod/cgen.nim index 1aaa56c81..5399cdccf 100644 --- a/rod/cgen.nim +++ b/rod/cgen.nim @@ -704,8 +704,7 @@ proc getInitName(m: PSym): PRope = result = ropeff("$1Init", "@$1Init", [toRope(m.name.s)]) proc registerModuleToMain(m: PSym) = - var initname: PRope - initname = getInitName(m) + var initname = getInitName(m) appff(mainModProcs, "N_NOINLINE(void, $1)(void);$n", "declare void $1() noinline$n", [initname]) if not (sfSystemModule in m.flags): diff --git a/rod/expandimportc.nim b/rod/expandimportc.nim index 82a0578ac..9613626f1 100755 --- a/rod/expandimportc.nim +++ b/rod/expandimportc.nim @@ -14,6 +14,7 @@ import os, ropes, idents, ast, pnimsyn, rnimsyn, msgs, wordrecg, syntaxes proc modifyPragmas(n: PNode, name: string) = + if n == nil: return for i in countup(0, sonsLen(n) - 1): var it = n.sons[i] if it.kind == nkIdent and whichKeyword(it.ident) == wImportc: diff --git a/rod/extccomp.nim b/rod/extccomp.nim index f9d3747b1..990466e1b 100755 --- a/rod/extccomp.nim +++ b/rod/extccomp.nim @@ -408,7 +408,6 @@ proc CallCCompiler(projectfile: string) = if (gGlobalOptions * {optCompileOnly, optGenScript} == {optCompileOnly}): return # speed up that call if only compiling and no script shall be # generated - if (toCompile.head == nil) and (externalToCompile.head == nil): return fileCounter = 0 var c = ccompiler var script: PRope = nil diff --git a/rod/main.nim b/rod/main.nim index c5390ba00..056c1dc40 100755 --- a/rod/main.nim +++ b/rod/main.nim @@ -109,9 +109,9 @@ proc CommandCheck(filename: string) = proc CommandCompileToC(filename: string) = semanticPasses() registerPass(cgen.cgenPass()) - registerPass(rodwrite.rodwritePass()) #registerPass(cleanupPass()); - compileProject(filename) #for i := low(TTypeKind) to high(TTypeKind) do - # MessageOut('kind: ' +{&} typeKindToStr[i] +{&} ' = ' +{&} toString(sameTypeA[i])); + registerPass(rodwrite.rodwritePass()) + #registerPass(cleanupPass()) + compileProject(filename) extccomp.CallCCompiler(changeFileExt(filename, "")) proc CommandCompileToEcmaScript(filename: string) = @@ -123,7 +123,6 @@ proc CommandCompileToEcmaScript(filename: string) = compileProject(filename) proc CommandInteractive() = - var m: PSym incl(gGlobalOptions, optSafeCode) setTarget(osNimrodVM, cpuNimrodVM) initDefines() @@ -133,7 +132,7 @@ proc CommandInteractive() = registerPass(evals.evalPass()) # load system module: discard CompileModule(JoinPath(options.libpath, addFileExt("system", nimExt)), false, true) - m = newModule("stdin") + var m = newModule("stdin") m.id = getID() incl(m.flags, sfMainModule) processModule(m, "stdin", LLStreamOpenStdIn(), nil) @@ -217,7 +216,7 @@ proc CommandScan(filename: string) = if stream != nil: openLexer(L, f, stream) while true: - rawGetTok(L, tok^ ) + rawGetTok(L, tok^) PrintTok(tok) if tok.tokType == tkEof: break CloseLexer(L) diff --git a/rod/platform.nim b/rod/platform.nim index c3a8a2837..4e2240a90 100755 --- a/rod/platform.nim +++ b/rod/platform.nim @@ -184,6 +184,7 @@ var proc setTarget*(o: TSystemOS, c: TSystemCPU) = assert(c != cpuNone) assert(o != osNone) + #echo "new Target: OS: ", o, " CPU: ", c targetCPU = c targetOS = o intSize = cpu[c].intSize div 8 @@ -203,11 +204,6 @@ proc NameToCPU(name: string): TSystemCPU = return i result = cpuNone -#proc nimCPU(): cstring{.importc, noconv.} -#proc nimOS(): cstring{.importc, noconv.} - -#hostCPU = nameToCPU($nimCPU()) -#hostOS = nameToOS($nimOS()) hostCPU = nameToCPU(system.hostCPU) hostOS = nameToOS(system.hostOS) diff --git a/rod/scanner.nim b/rod/scanner.nim index a2535cc5c..2036a4d4d 100755 --- a/rod/scanner.nim +++ b/rod/scanner.nim @@ -116,10 +116,10 @@ type # needs so much look-ahead -var gLinesCompiled*: int +var gLinesCompiled*: int # all lines that have been compiled proc pushInd*(L: var TLexer, indent: int) - # all lines that have been compiled + proc popInd*(L: var TLexer) proc isKeyword*(kind: TTokType): bool proc openLexer*(lex: var TLexer, filename: string, inputstream: PLLStream) @@ -130,7 +130,7 @@ proc getLineInfo*(L: TLexer): TLineInfo proc closeLexer*(lex: var TLexer) proc PrintTok*(tok: PToken) proc tokToStr*(tok: PToken): string - # auxiliary functions: + proc lexMessage*(L: TLexer, msg: TMsgKind, arg: string = "") # the Pascal scanner uses this too: proc fillToken*(L: var TToken) @@ -142,7 +142,7 @@ proc isKeyword(kind: TTokType): bool = proc isNimrodIdentifier*(s: string): bool = if s[0] in SymStartChars: for c in items(s): - if c notin SymChars: return + if c notin SymChars+{'_'}: return result = true proc pushInd(L: var TLexer, indent: int) = diff --git a/tools/build.tmpl b/tools/build.tmpl index d995ca8c9..a18831f95 100755 --- a/tools/build.tmpl +++ b/tools/build.tmpl @@ -65,11 +65,6 @@ case $ucpu in ;; esac -# add(result, "# write ``build/platdef.c`` file\n") -cat >build/platdef.c <<EOF -char* nimOS(void) { return "$myos"; } -char* nimCPU(void) { return "$mycpu"; } -EOF # add(result, "# call the compiler:\n") case $myos in @@ -78,13 +73,12 @@ case $myos in case $mycpu in # for cpuA in 1..c.cpus.len: ?{c.cpus[cpuA-1]}) -# var linkCmd = "build/platdef.o" +# var linkCmd = "" # for f in items(c.cfiles[osA][cpuA]): echo "$CC $COMP_FLAGS -Ibuild -c ?{f} -o ?{changeFileExt(f, "o")}" $CC $COMP_FLAGS -Ibuild -c ?{f} -o ?{changeFileExt(f, "o")} || exit 1 # add(linkCmd, " \\\n" & changeFileExt(f, "o")) # end for - $CC $COMP_FLAGS -Ibuild -c build/platdef.c -o build/platdef.o || exit 1 echo "$LINKER $LINK_FLAGS -o ?{c.binPaths[0]}/?{toLower(c.name)} ?linkCmd" $LINKER $LINK_FLAGS -o ?{c.binPaths[0]}/?{toLower(c.name)} ?linkCmd || exit 1 ;; diff --git a/web/news.txt b/web/news.txt index 9605f9f29..75df65a75 100755 --- a/web/news.txt +++ b/web/news.txt @@ -2,6 +2,23 @@ News ==== + +2009-XX-XX Version 0.8.6 released +================================= + +Bugfixes +-------- + +Additions +--------- + +Changes affecting backwards compatibility +----------------------------------------- +- The compiler does not skip the linking step anymore even if no file + has changed. + + + 2009-10-21 Version 0.8.2 released ================================= |