further steps for thread support; bootstrapping should require unzip C sources and ./build.sh

This commit is contained in:
Araq 2011-05-16 00:27:47 +02:00
commit 67a30d8371
21 changed files with 372 additions and 421 deletions

View file

@ -142,7 +142,7 @@ proc processFile(filename: string) =
if t.first <= 0: break
inc(line, countLines(buffer, i, t.first-1))
var wholeMatch = buffer.copy(t.first, t.last)
var wholeMatch = buffer.substr(t.first, t.last)
if optReplace notin options:
highlight(buffer, wholeMatch, "", t, line, showRepl=false)
@ -168,15 +168,15 @@ proc processFile(filename: string) =
else:
highlight(buffer, wholeMatch, r, t, line, showRepl=reallyReplace)
if reallyReplace:
result.add(buffer.copy(i, t.first-1))
result.add(buffer.substr(i, t.first-1))
result.add(r)
else:
result.add(buffer.copy(i, t.last))
result.add(buffer.substr(i, t.last))
inc(line, countLines(buffer, t.first, t.last))
i = t.last+1
if optReplace in options:
result.add(copy(buffer, i))
result.add(substr(buffer, i))
var f: TFile
if open(f, filename, fmWrite):
f.write(result)
@ -185,7 +185,7 @@ proc processFile(filename: string) =
quit "cannot open file for overwriting: " & filename
proc hasRightExt(filename: string, exts: seq[string]): bool =
var y = splitFile(filename).ext.copy(1) # skip leading '.'
var y = splitFile(filename).ext.substr(1) # skip leading '.'
for x in items(exts):
if os.cmpPaths(x, y) == 0: return true

View file

@ -148,7 +148,7 @@ proc parseCmdLine(c: var TConfigData) =
of "var":
var idx = val.find('=')
if idx < 0: quit("invalid command line")
c.vars[copy(val, 0, idx-1)] = copy(val, idx+1)
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
else: quit(Usage)
of cmdEnd: break
if c.infile.len == 0: quit(Usage)

View file

@ -76,7 +76,7 @@ proc parseCmdLine(c: var TConfigData) =
of "var":
var idx = val.find('=')
if idx < 0: quit("invalid command line")
c.vars[copy(val, 0, idx-1)] = copy(val, idx+1)
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
else: quit(Usage)
of cmdEnd: break
if c.infile.len == 0: quit(Usage)