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