mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
renamed writeln to writeLine in lib
This commit is contained in:
@@ -369,7 +369,7 @@ iterator split*(s: string, sep: Regex): string =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for word in split("00232this02939is39an22example111", re"\d+"):
|
||||
## writeln(stdout, word)
|
||||
## writeLine(stdout, word)
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
|
||||
@@ -307,7 +307,7 @@ proc defaultMsgHandler*(filename: string, line, col: int, msgkind: MsgKind,
|
||||
let a = messages[msgkind] % arg
|
||||
let message = "$1($2, $3) $4: $5" % [filename, $line, $col, $mc, a]
|
||||
if mc == mcError: raise newException(EParseError, message)
|
||||
else: writeln(stdout, message)
|
||||
else: writeLine(stdout, message)
|
||||
|
||||
proc defaultFindFile*(filename: string): string {.procvar.} =
|
||||
if existsFile(filename): result = filename
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
## # generate content:
|
||||
## write(stdout, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n")
|
||||
## write(stdout, "<html><head><title>Test</title></head><body>\n")
|
||||
## writeln(stdout, "your name: " & myData["name"])
|
||||
## writeln(stdout, "your password: " & myData["password"])
|
||||
## writeln(stdout, "</body></html>")
|
||||
## writeLine(stdout, "your name: " & myData["name"])
|
||||
## writeLine(stdout, "your password: " & myData["password"])
|
||||
## writeLine(stdout, "</body></html>")
|
||||
|
||||
import strutils, os, strtabs, cookies
|
||||
|
||||
|
||||
@@ -132,12 +132,12 @@ method log*(logger: Logger, level: Level, args: varargs[string, `$`]) {.
|
||||
method log*(logger: ConsoleLogger, level: Level, args: varargs[string, `$`]) =
|
||||
## Logs to the console using ``logger`` only.
|
||||
if level >= logger.levelThreshold:
|
||||
writeln(stdout, substituteLog(logger.fmtStr, level, args))
|
||||
writeLine(stdout, substituteLog(logger.fmtStr, level, args))
|
||||
|
||||
method log*(logger: FileLogger, level: Level, args: varargs[string, `$`]) =
|
||||
## Logs to a file using ``logger`` only.
|
||||
if level >= logger.levelThreshold:
|
||||
writeln(logger.f, substituteLog(logger.fmtStr, level, args))
|
||||
writeLine(logger.f, substituteLog(logger.fmtStr, level, args))
|
||||
|
||||
proc defaultFilename*(): string =
|
||||
## Returns the default filename for a logger.
|
||||
@@ -228,7 +228,7 @@ method log*(logger: RollingFileLogger, level: Level, args: varargs[string, `$`])
|
||||
logger.curLine = 0
|
||||
logger.f = open(logger.baseName, logger.baseMode, bufSize = logger.bufSize)
|
||||
|
||||
writeln(logger.f, substituteLog(logger.fmtStr, level, args))
|
||||
writeLine(logger.f, substituteLog(logger.fmtStr, level, args))
|
||||
logger.curLine.inc
|
||||
|
||||
# --------
|
||||
|
||||
@@ -155,7 +155,7 @@ proc writeProfile() {.noconv.} =
|
||||
var f: File
|
||||
if open(f, filename, fmWrite):
|
||||
sort(profileData, cmpEntries)
|
||||
writeln(f, "total executions of each stack trace:")
|
||||
writeLine(f, "total executions of each stack trace:")
|
||||
var entries = 0
|
||||
for i in 0..high(profileData):
|
||||
if profileData[i] != nil: inc entries
|
||||
@@ -175,13 +175,13 @@ proc writeProfile() {.noconv.} =
|
||||
for i in 0..min(100, entries-1):
|
||||
if profileData[i].total > 1:
|
||||
inc sum, profileData[i].total
|
||||
writeln(f, "Entry: ", i+1, "/", entries, " Calls: ",
|
||||
writeLine(f, "Entry: ", i+1, "/", entries, " Calls: ",
|
||||
profileData[i].total // totalCalls, " [sum: ", sum, "; ",
|
||||
sum // totalCalls, "]")
|
||||
for ii in 0..high(StackTrace):
|
||||
let procname = profileData[i].st[ii]
|
||||
if isNil(procname): break
|
||||
writeln(f, " ", procname, " ", perProc[$procname] // totalCalls)
|
||||
writeLine(f, " ", procname, " ", perProc[$procname] // totalCalls)
|
||||
close(f)
|
||||
echo "... done"
|
||||
else:
|
||||
|
||||
@@ -1323,7 +1323,7 @@ proc ra(n: SqlNode, s: var string, indent: int) =
|
||||
# where: x.name == y.name
|
||||
#db.select(fromm = [t1, t2], where = t1.name == t2.name):
|
||||
#for x, y, z in db.select(fromm = a, b where = a.name == b.name):
|
||||
# writeln x, y, z
|
||||
# writeLine x, y, z
|
||||
|
||||
proc renderSQL*(n: SqlNode): string =
|
||||
## Converts an SQL abstract syntax tree to its string representation.
|
||||
|
||||
@@ -979,7 +979,7 @@ iterator split*(s: string, sep: Peg): string =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for word in split("00232this02939is39an22example111", peg"\d+"):
|
||||
## writeln(stdout, word)
|
||||
## writeLine(stdout, word)
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
|
||||
@@ -206,7 +206,7 @@ iterator split*(s: string, seps: set[char] = Whitespace): string =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for word in split(" this is an example "):
|
||||
## writeln(stdout, word)
|
||||
## writeLine(stdout, word)
|
||||
##
|
||||
## ...generates this output:
|
||||
##
|
||||
@@ -220,7 +220,7 @@ iterator split*(s: string, seps: set[char] = Whitespace): string =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for word in split(";;this;is;an;;example;;;", {';'}):
|
||||
## writeln(stdout, word)
|
||||
## writeLine(stdout, word)
|
||||
##
|
||||
## ...produces the same output as the first example. The code:
|
||||
##
|
||||
@@ -228,7 +228,7 @@ iterator split*(s: string, seps: set[char] = Whitespace): string =
|
||||
## let date = "2012-11-20T22:08:08.398990"
|
||||
## let separators = {' ', '-', ':', 'T'}
|
||||
## for number in split(date, separators):
|
||||
## writeln(stdout, number)
|
||||
## writeLine(stdout, number)
|
||||
##
|
||||
## ...results in:
|
||||
##
|
||||
@@ -259,7 +259,7 @@ iterator split*(s: string, sep: char): string =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for word in split(";;this;is;an;;example;;;", ';'):
|
||||
## writeln(stdout, word)
|
||||
## writeLine(stdout, word)
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
@@ -309,7 +309,7 @@ iterator splitLines*(s: string): string =
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for line in splitLines("\nthis\nis\nan\n\nexample\n"):
|
||||
## writeln(stdout, line)
|
||||
## writeLine(stdout, line)
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
@@ -571,7 +571,7 @@ iterator tokenize*(s: string, seps: set[char] = Whitespace): tuple[
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## for word in tokenize(" this is an example "):
|
||||
## writeln(stdout, word)
|
||||
## writeLine(stdout, word)
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
|
||||
@@ -430,8 +430,8 @@ macro styledEcho*(m: varargs[expr]): stmt =
|
||||
case item.kind
|
||||
of nnkStrLit..nnkTripleStrLit:
|
||||
if i == m.len - 1:
|
||||
# optimize if string literal is last, just call writeln
|
||||
result.add(newCall(bindSym"writeln", bindSym"stdout", item))
|
||||
# optimize if string literal is last, just call writeLine
|
||||
result.add(newCall(bindSym"writeLine", bindSym"stdout", item))
|
||||
if reset: result.add(newCall(bindSym"resetAttributes"))
|
||||
return
|
||||
else:
|
||||
@@ -470,7 +470,7 @@ when not defined(testing) and isMainModule:
|
||||
writeStyled("styled text ", {styleBright, styleBlink, styleUnderscore})
|
||||
setBackGroundColor(bgCyan, true)
|
||||
setForeGroundColor(fgBlue)
|
||||
writeln(stdout, "ordinary text")
|
||||
writeLine(stdout, "ordinary text")
|
||||
|
||||
styledEcho("styled text ", {styleBright, styleBlink, styleUnderscore})
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ proc dbgRepr(p: pointer, typ: PNimType): string =
|
||||
proc writeVariable(stream: File, slot: VarSlot) =
|
||||
write(stream, slot.name)
|
||||
write(stream, " = ")
|
||||
writeln(stream, dbgRepr(slot.address, slot.typ))
|
||||
writeLine(stream, dbgRepr(slot.address, slot.typ))
|
||||
|
||||
proc listFrame(stream: File, f: PFrame) =
|
||||
write(stream, EndbBeg)
|
||||
@@ -125,7 +125,7 @@ proc listFrame(stream: File, f: PFrame) =
|
||||
write(stream, f.len)
|
||||
write(stream, " slots):\n")
|
||||
for i in 0 .. f.len-1:
|
||||
writeln(stream, getLocal(f, i).name)
|
||||
writeLine(stream, getLocal(f, i).name)
|
||||
write(stream, EndbEnd)
|
||||
|
||||
proc listLocals(stream: File, f: PFrame) =
|
||||
@@ -141,7 +141,7 @@ proc listGlobals(stream: File) =
|
||||
write(stream, EndbBeg)
|
||||
write(stream, "| Globals:\n")
|
||||
for i in 0 .. getGlobalLen()-1:
|
||||
writeln(stream, getGlobal(i).name)
|
||||
writeLine(stream, getGlobal(i).name)
|
||||
write(stream, EndbEnd)
|
||||
|
||||
proc debugOut(msg: cstring) =
|
||||
|
||||
Reference in New Issue
Block a user