Merge branch 'master' of github.com:Araq/Nimrod

This commit is contained in:
Araq 2013-04-08 00:10:53 +02:00
commit fb3cda551a
3 changed files with 17 additions and 13 deletions

View file

@ -18,5 +18,5 @@ const
VersionPatch* = 1 VersionPatch* = 1
VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch
RodFileVersion* = "1211" # modify this if the rod-format changes! RodFileVersion* = "1212" # modify this if the rod-format changes!

View file

@ -126,8 +126,8 @@ type
s: cstring # mmap'ed file contents s: cstring # mmap'ed file contents
options: TOptions options: TOptions
reason: TReasonForRecompile reason: TReasonForRecompile
modDeps: TStringSeq modDeps: seq[int32]
files: TStringSeq files: seq[int32]
dataIdx: int # offset of start of data section dataIdx: int # offset of start of data section
convertersIdx: int # offset of start of converters section convertersIdx: int # offset of start of converters section
initIdx, interfIdx, compilerProcsIdx, methodsIdx: int initIdx, interfIdx, compilerProcsIdx, methodsIdx: int
@ -586,9 +586,10 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
inc(r.pos, 2) # skip "(\10" inc(r.pos, 2) # skip "(\10"
inc(r.line) inc(r.line)
while r.s[r.pos] != ')': while r.s[r.pos] != ')':
var relativePath = decodeStr(r.s, r.pos) let relativePath = decodeStr(r.s, r.pos)
var resolvedPath = relativePath.findModule let resolvedPath = relativePath.findModule
r.files.add(if resolvedPath.len > 0: resolvedPath else: relativePath) let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath
r.files.add(finalPath.fileInfoIdx)
inc(r.pos) # skip #10 inc(r.pos) # skip #10
inc(r.line) inc(r.line)
if r.s[r.pos] == ')': inc(r.pos) if r.s[r.pos] == ')': inc(r.pos)
@ -596,7 +597,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
inc(r.pos, 2) # skip "(\10" inc(r.pos, 2) # skip "(\10"
inc(r.line) inc(r.line)
while r.s[r.pos] != ')': while r.s[r.pos] != ')':
w = r.files[decodeVInt(r.s, r.pos)] w = r.files[decodeVInt(r.s, r.pos)].toFullPath
inc(r.pos) # skip ' ' inc(r.pos) # skip ' '
inclCrc = decodeVInt(r.s, r.pos) inclCrc = decodeVInt(r.s, r.pos)
if r.reason == rrNone: if r.reason == rrNone:
@ -828,7 +829,7 @@ proc checkDep(fileIdx: int32): TReasonForRecompile =
var res = checkDep(SystemFileIdx) var res = checkDep(SystemFileIdx)
if res != rrNone: result = rrModDeps if res != rrNone: result = rrModDeps
for i in countup(0, high(r.modDeps)): for i in countup(0, high(r.modDeps)):
res = checkDep(r.modDeps[i].fileInfoIdx) res = checkDep(r.modDeps[i])
if res != rrNone: if res != rrNone:
result = rrModDeps result = rrModDeps
# we cannot break here, because of side-effects of `checkDep` # we cannot break here, because of side-effects of `checkDep`
@ -1062,11 +1063,11 @@ proc viewFile(rodfile: string) =
while r.s[r.pos] != ')': while r.s[r.pos] != ')':
let relativePath = decodeStr(r.s, r.pos) let relativePath = decodeStr(r.s, r.pos)
let resolvedPath = relativePath.findModule let resolvedPath = relativePath.findModule
let rr = if resolvedPath.len > 0: resolvedPath else: relativePath let finalPath = if resolvedPath.len > 0: resolvedPath else: relativePath
r.files.add(rr) r.files.add(finalPath.fileInfoIdx)
inc(r.pos) # skip #10 inc(r.pos) # skip #10
inc(r.line) inc(r.line)
outf.writeln(rr) outf.writeln finalPath
if r.s[r.pos] == ')': inc(r.pos) if r.s[r.pos] == ')': inc(r.pos)
outf.write(")\n") outf.write(")\n")
of "INCLUDES": of "INCLUDES":

View file

@ -238,7 +238,10 @@ type
TFileStream* = object of TStream TFileStream* = object of TStream
f: TFile f: TFile
proc fsClose(s: PStream) = close(PFileStream(s).f) proc fsClose(s: PStream) =
if PFileStream(s).f != nil:
close(PFileStream(s).f)
PFileStream(s).f = nil
proc fsFlush(s: PStream) = flushFile(PFileStream(s).f) proc fsFlush(s: PStream) = flushFile(PFileStream(s).f)
proc fsAtEnd(s: PStream): bool = return EndOfFile(PFileStream(s).f) proc fsAtEnd(s: PStream): bool = return EndOfFile(PFileStream(s).f)
proc fsSetPosition(s: PStream, pos: int) = setFilePos(PFileStream(s).f, pos) proc fsSetPosition(s: PStream, pos: int) = setFilePos(PFileStream(s).f, pos)