diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-07-11 16:39:16 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-07-11 16:39:16 +0200 |
commit | 5b59852406e3d4a494186dddf9a5702062901668 (patch) | |
tree | 8ee1df69d4b5d47ca4154d90c54201b19e43af91 /lib/system/sysstr.nim | |
parent | 16d8fab3101a8dcec846d1208de40c2c10db0160 (diff) | |
download | Nim-5b59852406e3d4a494186dddf9a5702062901668.tar.gz |
system.substr is not implemented with compilerProcs anymore
Diffstat (limited to 'lib/system/sysstr.nim')
-rw-r--r-- | lib/system/sysstr.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index 24ba02af6..9a73d3f9d 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -63,6 +63,8 @@ proc mnewString(len: int): NimString {.compilerProc.} = result.len = len proc copyStrLast(s: NimString, start, last: int): NimString {.compilerProc.} = + # This is not used by most recent versions of the compiler anymore, but + # required for bootstrapping purposes. let start = max(start, 0) let len = min(last, s.len-1) - start + 1 if len > 0: @@ -73,13 +75,15 @@ proc copyStrLast(s: NimString, start, last: int): NimString {.compilerProc.} = else: result = rawNewString(len) +proc copyStr(s: NimString, start: int): NimString {.compilerProc.} = + # This is not used by most recent versions of the compiler anymore, but + # required for bootstrapping purposes. + result = copyStrLast(s, start, s.len-1) + proc nimToCStringConv(s: NimString): cstring {.compilerProc, inline.} = if s == nil or s.len == 0: result = cstring"" else: result = cstring(addr s.data) -proc copyStr(s: NimString, start: int): NimString {.compilerProc.} = - result = copyStrLast(s, start, s.len-1) - proc toNimStr(str: cstring, len: int): NimString {.compilerProc.} = result = rawNewStringNoInit(len) result.len = len |