tester uses same layout as nimbuild

This commit is contained in:
Araq 2011-11-12 12:17:44 +01:00
commit 395b05f911
5 changed files with 281 additions and 11 deletions

View file

@ -64,7 +64,7 @@ const
proc close(L: var TBaseLexer) =
dealloc(L.buf)
L.input.close(L.input)
close(L.input)
proc FillBuffer(L: var TBaseLexer) =
var
@ -80,8 +80,8 @@ proc FillBuffer(L: var TBaseLexer) =
if toCopy > 0:
MoveMem(L.buf, addr(L.buf[L.sentinel + 1]), toCopy * chrSize)
# "moveMem" handles overlapping regions
charsRead = L.input.readData(L.input, addr(L.buf[toCopy]),
(L.sentinel + 1) * chrSize) div chrSize
charsRead = readData(L.input, addr(L.buf[toCopy]),
(L.sentinel + 1) * chrSize) div chrSize
s = toCopy + charsRead
if charsRead < L.sentinel + 1:
L.buf[s] = EndOfFile # set end marker
@ -103,8 +103,8 @@ proc FillBuffer(L: var TBaseLexer) =
L.bufLen = L.BufLen * 2
L.buf = cast[cstring](realloc(L.buf, L.bufLen * chrSize))
assert(L.bufLen - oldBuflen == oldBufLen)
charsRead = L.input.ReadData(L.input, addr(L.buf[oldBufLen]),
oldBufLen * chrSize) div chrSize
charsRead = ReadData(L.input, addr(L.buf[oldBufLen]),
oldBufLen * chrSize) div chrSize
if charsRead < oldBufLen:
L.buf[oldBufLen + charsRead] = EndOfFile
L.sentinel = oldBufLen + charsRead

View file

@ -962,7 +962,9 @@ proc substr*(s: string, first, last: int): string {.
## copies a slice of `s` into a new string and returns this new
## string. The bounds `first` and `last` denote the indices of
## the first and last characters that shall be copied. If ``last``
## is omitted, it is treated as ``high(s)``.
## is omitted, it is treated as ``high(s)``. If ``last >= s.len``, ``s.len``
## is used instead: This means ``substr`` can also be used to `cut`:idx:
## or `limit`:idx: a string's length.
proc zeroMem*(p: Pointer, size: int) {.importc, noDecl.}
## overwrites the contents of the memory at ``p`` with the value 0.