doc improvements; added lazarus example

This commit is contained in:
Araq 2011-07-24 23:07:40 +02:00
commit ef039a1325
12 changed files with 5556 additions and 58 deletions

View file

@ -594,7 +594,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
inc(r.pos, 2) # skip "(\10"
inc(r.line)
L = 0
while (r.s[r.pos] > '\x0A') and (r.s[r.pos] != ')'):
while r.s[r.pos] > '\x0A' and r.s[r.pos] != ')':
setlen(r.files, L + 1)
r.files[L] = decode(r)
inc(r.pos) # skip #10
@ -604,7 +604,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
of "INCLUDES":
inc(r.pos, 2) # skip "(\10"
inc(r.line)
while (r.s[r.pos] > '\x0A') and (r.s[r.pos] != ')'):
while r.s[r.pos] > '\x0A' and r.s[r.pos] != ')':
w = r.files[decodeInt(r)]
inc(r.pos) # skip ' '
inclCrc = decodeInt(r)
@ -618,7 +618,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
of "DEPS":
inc(r.pos) # skip ':'
L = 0
while (r.s[r.pos] > '\x0A'):
while r.s[r.pos] > '\x0A':
setlen(r.modDeps, L + 1)
r.modDeps[L] = r.files[decodeInt(r)]
inc(L)
@ -672,7 +672,7 @@ proc newRodReader(modfilename: string, crc: TCrc32,
initIITable(r.imports.tab) # looks like a ROD file
inc(r.pos, 4)
var version = ""
while not (r.s[r.pos] in {'\0', '\x0A'}):
while r.s[r.pos] notin {'\0', '\x0A'}:
add(version, r.s[r.pos])
inc(r.pos)
if r.s[r.pos] == '\x0A': inc(r.pos)
@ -728,8 +728,8 @@ proc rrGetSym(r: PRodReader, id: int, info: TLineInfo): PSym =
# find the reader with the correct moduleID:
for i in countup(0, high(gMods)):
var rd = gMods[i].rd
if (rd != nil):
if (rd.moduleID == moduleID):
if rd != nil:
if rd.moduleID == moduleID:
d = IITableGet(rd.index.tab, id)
if d != invalidKey:
result = decodeSymSafePos(rd, d, info)
@ -745,14 +745,14 @@ proc rrGetSym(r: PRodReader, id: int, info: TLineInfo): PSym =
else:
# own symbol:
result = decodeSymSafePos(r, d, info)
if (result != nil) and (result.kind == skStub): loadStub(result)
if result != nil and result.kind == skStub: loadStub(result)
proc loadInitSection(r: PRodReader): PNode =
if (r.initIdx == 0) or (r.dataIdx == 0): InternalError("loadInitSection")
if r.initIdx == 0 or r.dataIdx == 0: InternalError("loadInitSection")
var oldPos = r.pos
r.pos = r.initIdx
result = newNode(nkStmtList)
while (r.s[r.pos] > '\x0A') and (r.s[r.pos] != ')'):
while r.s[r.pos] > '\x0A' and r.s[r.pos] != ')':
var d = decodeInt(r)
inc(r.pos) # #10
var p = r.pos
@ -763,7 +763,7 @@ proc loadInitSection(r: PRodReader): PNode =
proc loadConverters(r: PRodReader) =
# We have to ensure that no exported converter is a stub anymore.
if (r.convertersIdx == 0) or (r.dataIdx == 0):
if r.convertersIdx == 0 or r.dataIdx == 0:
InternalError("importConverters")
r.pos = r.convertersIdx
while (r.s[r.pos] > '\x0A'):
@ -809,9 +809,9 @@ proc checkDep(filename: string): TReasonForRecompile =
# we cannot break here, because of side-effects of `checkDep`
else:
result = rrRodDoesNotExist
if (result != rrNone) and (gVerbosity > 0):
if result != rrNone and gVerbosity > 0:
MsgWriteln(`%`(reasonToFrmt[result], [filename]))
if (result != rrNone) or (optForceFullMake in gGlobalOptions):
if result != rrNone or optForceFullMake in gGlobalOptions:
# recompilation is necessary:
r = nil
gMods[idx].rd = r

View file

@ -117,12 +117,12 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode): PRope =
# we do not write comments for now
# Line information takes easily 20% or more of the filesize! Therefore we
# omit line information if it is the same as the father's line information:
if (finfo.fileIndex != n.info.fileIndex):
if finfo.fileIndex != n.info.fileIndex:
appf(result, "?$1,$2,$3", [encodeInt(n.info.col), encodeInt(n.info.line),
encodeInt(fileIdx(w, toFilename(n.info)))])
elif (finfo.line != n.info.line):
elif finfo.line != n.info.line:
appf(result, "?$1,$2", [encodeInt(n.info.col), encodeInt(n.info.line)])
elif (finfo.col != n.info.col):
elif finfo.col != n.info.col:
appf(result, "?$1", [encodeInt(n.info.col)])
# No need to output the file index, as this is the serialization of one
# file.
@ -135,7 +135,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode): PRope =
of nkCharLit..nkInt64Lit:
if n.intVal != 0: appf(result, "!$1", [encodeInt(n.intVal)])
of nkFloatLit..nkFloat64Lit:
if n.floatVal != 0.0: appf(result, "!$1", [encodeStr(w, $(n.floatVal))])
if n.floatVal != 0.0: appf(result, "!$1", [encodeStr(w, $n.floatVal)])
of nkStrLit..nkTripleStrLit:
if n.strVal != "": appf(result, "!$1", [encodeStr(w, n.strVal)])
of nkIdent:
@ -274,7 +274,7 @@ proc symStack(w: PRodWriter) =
if w.converters != nil: app(w.converters, " ")
app(w.converters, encodeInt(s.id))
elif IiTableGet(w.imports.tab, s.id) == invalidKey:
addToIndex(w.imports, s.id, m.id) #if not IntSetContains(debugWritten, s.id) then begin
addToIndex(w.imports, s.id, m.id) #if not Contains(debugWritten, s.id):
# MessageOut(w.filename);
# debug(s.owner);
# debug(s);