disable StringStream for JS (needs copyMem)
This commit is contained in:
parent
9604444d09
commit
0d45c17388
2 changed files with 60 additions and 60 deletions
|
|
@ -306,6 +306,8 @@ proc peekLine*(s: Stream): TaintedString =
|
||||||
defer: setPosition(s, pos)
|
defer: setPosition(s, pos)
|
||||||
result = readLine(s)
|
result = readLine(s)
|
||||||
|
|
||||||
|
when not defined(js):
|
||||||
|
|
||||||
type
|
type
|
||||||
StringStream* = ref StringStreamObj ## a stream that encapsulates a string
|
StringStream* = ref StringStreamObj ## a stream that encapsulates a string
|
||||||
StringStreamObj* = object of StreamObj
|
StringStreamObj* = object of StreamObj
|
||||||
|
|
@ -365,8 +367,6 @@ proc newStringStream*(s: string = ""): StringStream =
|
||||||
result.peekDataImpl = ssPeekData
|
result.peekDataImpl = ssPeekData
|
||||||
result.writeDataImpl = ssWriteData
|
result.writeDataImpl = ssWriteData
|
||||||
|
|
||||||
when not defined(js):
|
|
||||||
|
|
||||||
type
|
type
|
||||||
FileStream* = ref FileStreamObj ## a stream that encapsulates a `File`
|
FileStream* = ref FileStreamObj ## a stream that encapsulates a `File`
|
||||||
FileStreamObj* = object of Stream
|
FileStreamObj* = object of Stream
|
||||||
|
|
|
||||||
|
|
@ -336,7 +336,7 @@ proc readLine(f: File, line: var StaticStr): bool =
|
||||||
if c == 10'i32: break # LF
|
if c == 10'i32: break # LF
|
||||||
if c == 13'i32: # CR
|
if c == 13'i32: # CR
|
||||||
c = c_fgetc(f) # is the next char LF?
|
c = c_fgetc(f) # is the next char LF?
|
||||||
if c != 10'i32: ungetc(c, f) # no, put the character back
|
if c != 10'i32: discard c_ungetc(c, f) # no, put the character back
|
||||||
break
|
break
|
||||||
add line, chr(int(c))
|
add line, chr(int(c))
|
||||||
result = true
|
result = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue