Renamed writeln procs to writeLine
This commit is contained in:
parent
37ff086c86
commit
072688d06e
3 changed files with 8 additions and 5 deletions
|
|
@ -117,12 +117,14 @@ proc write*(s: Stream, x: string) =
|
||||||
## terminating zero is written.
|
## terminating zero is written.
|
||||||
writeData(s, cstring(x), x.len)
|
writeData(s, cstring(x), x.len)
|
||||||
|
|
||||||
proc writeln*(s: Stream, args: varargs[string, `$`]) =
|
proc writeLine*(s: Stream, args: varargs[string, `$`]) =
|
||||||
## writes one or more strings to the the stream `s` followed
|
## writes one or more strings to the the stream `s` followed
|
||||||
## by a new line. No length field or terminating zero is written.
|
## by a new line. No length field or terminating zero is written.
|
||||||
for str in args: write(s, str)
|
for str in args: write(s, str)
|
||||||
write(s, "\n")
|
write(s, "\n")
|
||||||
|
|
||||||
|
{.deprecated: [writeln:writeLine].}
|
||||||
|
|
||||||
proc read[T](s: Stream, result: var T) =
|
proc read[T](s: Stream, result: var T) =
|
||||||
## generic read procedure. Reads `result` from the stream `s`.
|
## generic read procedure. Reads `result` from the stream `s`.
|
||||||
if readData(s, addr(result), sizeof(T)) != sizeof(T):
|
if readData(s, addr(result), sizeof(T)) != sizeof(T):
|
||||||
|
|
|
||||||
|
|
@ -898,7 +898,7 @@ proc contains*[T](x: set[T], y: T): bool {.magic: "InSet", noSideEffect.}
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
## var s: set[range['a'..'z']] = {'a'..'c'}
|
## var s: set[range['a'..'z']] = {'a'..'c'}
|
||||||
## writeln(stdout, 'b' in s)
|
## writeLine(stdout, 'b' in s)
|
||||||
##
|
##
|
||||||
## If ``in`` had been declared as ``[T](elem: T, s: set[T])`` then ``T`` would
|
## If ``in`` had been declared as ``[T](elem: T, s: set[T])`` then ``T`` would
|
||||||
## have been bound to ``char``. But ``s`` is not compatible to type
|
## have been bound to ``char``. But ``s`` is not compatible to type
|
||||||
|
|
@ -2269,7 +2269,7 @@ proc echo*(x: varargs[expr, `$`]) {.magic: "Echo", tags: [WriteIOEffect],
|
||||||
## Special built-in that takes a variable number of arguments. Each argument
|
## Special built-in that takes a variable number of arguments. Each argument
|
||||||
## is converted to a string via ``$``, so it works for user-defined
|
## is converted to a string via ``$``, so it works for user-defined
|
||||||
## types that have an overloaded ``$`` operator.
|
## types that have an overloaded ``$`` operator.
|
||||||
## It is roughly equivalent to ``writeln(stdout, x); flushFile(stdout)``, but
|
## It is roughly equivalent to ``writeLine(stdout, x); flushFile(stdout)``, but
|
||||||
## available for the JavaScript target too.
|
## available for the JavaScript target too.
|
||||||
##
|
##
|
||||||
## Unlike other IO operations this is guaranteed to be thread-safe as
|
## Unlike other IO operations this is guaranteed to be thread-safe as
|
||||||
|
|
@ -2526,7 +2526,7 @@ when not defined(JS): #and not defined(NimrodVM):
|
||||||
## Returns ``false`` if the end of the file has been reached, ``true``
|
## Returns ``false`` if the end of the file has been reached, ``true``
|
||||||
## otherwise. If ``false`` is returned `line` contains no new data.
|
## otherwise. If ``false`` is returned `line` contains no new data.
|
||||||
|
|
||||||
proc writeln*[Ty](f: File, x: varargs[Ty, `$`]) {.inline,
|
proc writeLine*[Ty](f: File, x: varargs[Ty, `$`]) {.inline,
|
||||||
tags: [WriteIOEffect], benign.}
|
tags: [WriteIOEffect], benign.}
|
||||||
## writes the values `x` to `f` and then writes "\n".
|
## writes the values `x` to `f` and then writes "\n".
|
||||||
## May throw an IO exception.
|
## May throw an IO exception.
|
||||||
|
|
|
||||||
|
|
@ -208,9 +208,10 @@ proc endOfFile(f: File): bool =
|
||||||
ungetc(c, f)
|
ungetc(c, f)
|
||||||
return c < 0'i32
|
return c < 0'i32
|
||||||
|
|
||||||
proc writeln[Ty](f: File, x: varargs[Ty, `$`]) =
|
proc writeLine[Ty](f: File, x: varargs[Ty, `$`]) =
|
||||||
for i in items(x): write(f, i)
|
for i in items(x): write(f, i)
|
||||||
write(f, "\n")
|
write(f, "\n")
|
||||||
|
{.deprecated: [writeln:writeLine].}
|
||||||
|
|
||||||
proc rawEcho(x: string) {.inline, compilerproc.} = write(stdout, x)
|
proc rawEcho(x: string) {.inline, compilerproc.} = write(stdout, x)
|
||||||
proc rawEchoNL() {.inline, compilerproc.} = write(stdout, "\n")
|
proc rawEchoNL() {.inline, compilerproc.} = write(stdout, "\n")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue