system.substr is not implemented with compilerProcs anymore
This commit is contained in:
parent
16d8fab310
commit
5b59852406
8 changed files with 157 additions and 67 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue