diff options
author | Araq <rumpf_a@web.de> | 2011-12-12 19:11:31 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-12-12 19:11:31 +0100 |
commit | 4487b614e1926189bc3ae8cd6bf2fdda28022f15 (patch) | |
tree | 90189e9afd60fc104706cd2fec18ab573545d422 | |
parent | 3c53c4c2b0e0e65f94a36f4a0da624a52d89c61b (diff) | |
download | Nim-4487b614e1926189bc3ae8cd6bf2fdda28022f15.tar.gz |
c2nim compiles again
-rwxr-xr-x | compiler/c2nim/cpp.nim | 2 | ||||
-rwxr-xr-x | compiler/msgs.nim | 18 | ||||
-rwxr-xr-x | lib/system/gc.nim | 2 | ||||
-rwxr-xr-x | lib/system/sysstr.nim | 2 | ||||
-rwxr-xr-x | todo.txt | 1 |
5 files changed, 15 insertions, 10 deletions
diff --git a/compiler/c2nim/cpp.nim b/compiler/c2nim/cpp.nim index 61b91e4de..2ef0d9445 100755 --- a/compiler/c2nim/cpp.nim +++ b/compiler/c2nim/cpp.nim @@ -283,7 +283,7 @@ proc parsePegLit(p: var TParser): TPeg = try: result = parsePeg( pattern = if p.tok.xkind == pxStrLit: p.tok.s else: escapePeg(p.tok.s), - filename = p.lex.filename, + filename = p.lex.fileIdx.ToFilename, line = p.lex.linenumber, col = col) getTok(p) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index ac6e6e481..ff153c1c2 100755 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -410,23 +410,23 @@ proc newFileInfo(fullPath, projPath: string): TFileInfo = proc fileInfoIdx*(filename: string): int32 = var - canonical: string + canon: string pseudoPath = false try: - canonical = canonicalizePath(filename) + canon = canonicalizePath(filename) except: - canonical = filename + canon = filename # The compiler uses "filenames" such as `command line` or `stdin` # This flag indicates that we are working with such a path here pseudoPath = true - if filenameToIndexTbl.hasKey(canonical): - result = filenameToIndexTbl[canonical] + if filenameToIndexTbl.hasKey(canon): + result = filenameToIndexTbl[canon] else: result = fileInfos.len.int32 - fileInfos.add(newFileInfo(canonical, if pseudoPath: "" else: canonical.shortenDir)) - filenameToIndexTbl[canonical] = result + fileInfos.add(newFileInfo(canon, if pseudoPath: "" else: canon.shortenDir)) + filenameToIndexTbl[canon] = result proc newLineInfo*(fileInfoIdx: int32, line, col: int): TLineInfo = result.fileIndex = fileInfoIdx @@ -478,6 +478,10 @@ proc ToFilename*(info: TLineInfo): string = if info.fileIndex < 0: result = "???" else: result = fileInfos[info.fileIndex].projPath +proc ToFilename*(fileIdx: int32): string = + if fileIdx < 0: result = "???" + else: result = fileInfos[fileIdx].projPath + proc toFullPath*(info: TLineInfo): string = if info.fileIndex < 0: result = "???" else: result = fileInfos[info.fileIndex].fullPath diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 02782cdd0..b692732ca 100755 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -420,7 +420,7 @@ proc newObjRC1(typ: PNimType, size: int): pointer {.compilerRtl.} = if framePtr != nil and framePtr.prev != nil: res.filename = framePtr.prev.filename res.line = framePtr.prev.line - res.refcount = rcIncrement # refcount is 1 + res.refcount = rcIncrement # refcount is 1 sysAssert(isAllocatedPtr(gch.region, res), "newObj: 3") when logGC: writeCell("new cell", res) gcTrace(res, csAllocated) diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index b0843fc11..b8ce687e0 100755 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -52,7 +52,7 @@ proc copyStrLast(s: NimString, start, last: int): NimString {.compilerProc.} = c_memcpy(result.data, addr(s.data[start]), len * sizeof(Char)) result.data[len] = '\0' else: - result = mnewString(0) + result = rawNewString(len) proc copyStr(s: NimString, start: int): NimString {.compilerProc.} = result = copyStrLast(s, start, s.len-1) diff --git a/todo.txt b/todo.txt index eb87a3cb1..2af65eb46 100755 --- a/todo.txt +++ b/todo.txt @@ -5,6 +5,7 @@ version 0.8.14 - compiler should optimize string creation - marker procs for the GC - need to generate code to prevent tail call optimization + - write barrier specialization - warning for implicit openArray -> varargs convention - implement explicit varargs; **but** ``len(varargs)`` problem remains! --> solve by implicit conversion from varargs to openarray |