further steps for thread support; bootstrapping should require unzip C sources and ./build.sh
This commit is contained in:
parent
c7b3d828be
commit
67a30d8371
21 changed files with 372 additions and 421 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue