docgen should work again

This commit is contained in:
Araq 2014-10-05 03:06:19 +02:00
commit a9a5766c66
15 changed files with 120 additions and 106 deletions

View file

@ -69,6 +69,8 @@ const
reportMissedDeadlines avoidTimeMachine useClone ignoreAllocationSize reportMissedDeadlines avoidTimeMachine useClone ignoreAllocationSize
debugExecProcesses pcreDll useLipzipSrc debugExecProcesses pcreDll useLipzipSrc
preventDeadlocks UNICODE winUnicode trackGcHeaders posixRealtime preventDeadlocks UNICODE winUnicode trackGcHeaders posixRealtime
nimStdSetjmp nimRawSetjmp nimSigSetjmp
""".split """.split
proc initDefines*() = proc initDefines*() =

View file

@ -119,7 +119,7 @@ type
warnDifferentHeaps, warnWriteToForeignHeap, warnUnsafeCode, warnDifferentHeaps, warnWriteToForeignHeap, warnUnsafeCode,
warnEachIdentIsTuple, warnShadowIdent, warnEachIdentIsTuple, warnShadowIdent,
warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2, warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2,
warnUninit, warnGcMem, warnUnguardedAccess, warnUser, warnUninit, warnGcMem, warnLockLevel, warnUser,
hintSuccess, hintSuccessX, hintSuccess, hintSuccessX,
hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded, hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled, hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
@ -390,7 +390,7 @@ const
warnGcUnsafe2: "cannot prove '$1' is GC-safe. Does not compile with --threads:on.", warnGcUnsafe2: "cannot prove '$1' is GC-safe. Does not compile with --threads:on.",
warnUninit: "'$1' might not have been initialized [Uninit]", warnUninit: "'$1' might not have been initialized [Uninit]",
warnGcMem: "'$1' uses GC'ed memory [GcMem]", warnGcMem: "'$1' uses GC'ed memory [GcMem]",
warnUnguardedAccess: "'$1' is accessed without its guard [UnguardedAccess]", warnLockLevel: "$1 [LockLevel]",
warnUser: "$1 [User]", warnUser: "$1 [User]",
hintSuccess: "operation successful [Success]", hintSuccess: "operation successful [Success]",
hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#) [SuccessX]", hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#) [SuccessX]",
@ -420,7 +420,7 @@ const
"AnalysisLoophole", "DifferentHeaps", "WriteToForeignHeap", "AnalysisLoophole", "DifferentHeaps", "WriteToForeignHeap",
"UnsafeCode", "EachIdentIsTuple", "ShadowIdent", "UnsafeCode", "EachIdentIsTuple", "ShadowIdent",
"ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit", "ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
"GcMem", "UnguardedAccess", "User"] "GcMem", "LockLevel", "User"]
HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong", HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong",
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded", "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",

View file

@ -29,7 +29,7 @@ App: Console
License: "copying.txt" License: "copying.txt"
[Config] [Config]
Files: "config/nimrod.cfg" Files: "config/nim.cfg"
Files: "config/nimdoc.cfg" Files: "config/nimdoc.cfg"
Files: "config/nimdoc.tex.cfg" Files: "config/nimdoc.tex.cfg"
@ -59,7 +59,7 @@ Files: "icons/koch_icon.o"
Files: "compiler/readme.txt" Files: "compiler/readme.txt"
Files: "compiler/nim.ini" Files: "compiler/nim.ini"
Files: "compiler/nimrod.cfg" Files: "compiler/nim.nimrod.cfg"
Files: "compiler/*.nim" Files: "compiler/*.nim"
Files: "compiler/c2nim/*.nim" Files: "compiler/c2nim/*.nim"
Files: "compiler/c2nim/*.cfg" Files: "compiler/c2nim/*.cfg"

View file

@ -411,6 +411,7 @@ proc getLockLevel(s: PSym): TLockLevel =
result = 0.TLockLevel result = 0.TLockLevel
else: else:
result = UnknownLockLevel result = UnknownLockLevel
#message(s.info, warnUser, "FOR THIS " & s.name.s)
proc mergeLockLevels(tracked: PEffects, n: PNode, lockLevel: TLockLevel) = proc mergeLockLevels(tracked: PEffects, n: PNode, lockLevel: TLockLevel) =
if lockLevel >= tracked.currLockLevel: if lockLevel >= tracked.currLockLevel:
@ -757,9 +758,15 @@ proc checkMethodEffects*(disp, branch: PSym) =
localError(branch.info, "base method is GC-safe, but '$1' is not" % localError(branch.info, "base method is GC-safe, but '$1' is not" %
branch.name.s) branch.name.s)
if branch.typ.lockLevel > disp.typ.lockLevel: if branch.typ.lockLevel > disp.typ.lockLevel:
localError(branch.info, when true:
"base method has lock level $1, but dispatcher has $2" % message(branch.info, warnLockLevel,
[$branch.typ.lockLevel, $disp.typ.lockLevel]) "base method has lock level $1, but dispatcher has $2" %
[$branch.typ.lockLevel, $disp.typ.lockLevel])
else:
# XXX make this an error after bigbreak has been released:
localError(branch.info,
"base method has lock level $1, but dispatcher has $2" %
[$branch.typ.lockLevel, $disp.typ.lockLevel])
proc setEffectsForProcType*(t: PType, n: PNode) = proc setEffectsForProcType*(t: PType, n: PNode) =
var effects = t.n.sons[0] var effects = t.n.sons[0]

View file

@ -101,7 +101,7 @@ The compiler can ensure the location in ``location = spawn f(...)`` is not
read prematurely within a ``parallel`` section and so there is no need for read prematurely within a ``parallel`` section and so there is no need for
the overhead of an indirection via ``FlowVar[T]`` to ensure correctness. the overhead of an indirection via ``FlowVar[T]`` to ensure correctness.
**Note**: Currently exceptions are not propagated between ``spawn``ed tasks! **Note**: Currently exceptions are not propagated between ``spawn``'ed tasks!
Spawn statement Spawn statement

View file

@ -143,12 +143,12 @@ iterator fastRows*(db: TDbConn, stmtName: TSqlPrepared,
args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = args: varargs[string, `$`]): TRow {.tags: [FReadDB].} =
## executes the prepared query and iterates over the result dataset. ## executes the prepared query and iterates over the result dataset.
var res = setupQuery(db, stmtName, args) var res = setupQuery(db, stmtName, args)
var L = PQnfields(res) var L = pqNfields(res)
var result = newRow(L) var result = newRow(L)
for i in 0..PQntuples(res)-1: for i in 0..pqNtuples(res)-1:
setRow(res, result, i, L) setRow(res, result, i, L)
yield result yield result
PQclear(res) pqClear(res)
proc getRow*(db: TDbConn, query: TSqlQuery, proc getRow*(db: TDbConn, query: TSqlQuery,
args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = args: varargs[string, `$`]): TRow {.tags: [FReadDB].} =
@ -163,10 +163,10 @@ proc getRow*(db: TDbConn, query: TSqlQuery,
proc getRow*(db: TDbConn, stmtName: TSqlPrepared, proc getRow*(db: TDbConn, stmtName: TSqlPrepared,
args: varargs[string, `$`]): TRow {.tags: [FReadDB].} = args: varargs[string, `$`]): TRow {.tags: [FReadDB].} =
var res = setupQuery(db, stmtName, args) var res = setupQuery(db, stmtName, args)
var L = PQnfields(res) var L = pqNfields(res)
result = newRow(L) result = newRow(L)
setRow(res, result, 0, L) setRow(res, result, 0, L)
PQclear(res) pqClear(res)
proc getAllRows*(db: TDbConn, query: TSqlQuery, proc getAllRows*(db: TDbConn, query: TSqlQuery,
args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} = args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} =
@ -179,7 +179,7 @@ proc getAllRows*(db: TDbConn, stmtName: TSqlPrepared,
args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} = args: varargs[string, `$`]): seq[TRow] {.tags: [FReadDB].} =
## executes the prepared query and returns the whole result dataset. ## executes the prepared query and returns the whole result dataset.
result = @[] result = @[]
for r in FastRows(db, stmtName, args): for r in fastRows(db, stmtName, args):
result.add(r) result.add(r)
iterator rows*(db: TDbConn, query: TSqlQuery, iterator rows*(db: TDbConn, query: TSqlQuery,

View file

@ -14,7 +14,7 @@ when not defined(js) and not defined(Nimdoc):
{.error: "This module only works on the JavaScript platform".} {.error: "This module only works on the JavaScript platform".}
type type
TEventHandlers* {.importc.} = object of TObject TEventHandlers* {.importc.} = object of RootObj
onabort*: proc (event: ref TEvent) {.nimcall.} onabort*: proc (event: ref TEvent) {.nimcall.}
onblur*: proc (event: ref TEvent) {.nimcall.} onblur*: proc (event: ref TEvent) {.nimcall.}
onchange*: proc (event: ref TEvent) {.nimcall.} onchange*: proc (event: ref TEvent) {.nimcall.}
@ -124,14 +124,14 @@ type
embeds*: seq[ref TEmbed] embeds*: seq[ref TEmbed]
links*: seq[ref TLink] links*: seq[ref TLink]
TLink* {.importc.} = object of TObject TLink* {.importc.} = object of RootObj
name*: cstring name*: cstring
target*: cstring target*: cstring
text*: cstring text*: cstring
x*: int x*: int
y*: int y*: int
TEmbed* {.importc.} = object of TObject TEmbed* {.importc.} = object of RootObj
height*: int height*: int
hspace*: int hspace*: int
name*: cstring name*: cstring
@ -142,12 +142,12 @@ type
play*: proc () {.nimcall.} play*: proc () {.nimcall.}
stop*: proc () {.nimcall.} stop*: proc () {.nimcall.}
TAnchor* {.importc.} = object of TObject TAnchor* {.importc.} = object of RootObj
name*: cstring name*: cstring
text*: cstring text*: cstring
x*, y*: int x*, y*: int
TApplet* {.importc.} = object of TObject TApplet* {.importc.} = object of RootObj
TElement* {.importc.} = object of TEventHandlers TElement* {.importc.} = object of TEventHandlers
checked*: bool checked*: bool
@ -166,7 +166,7 @@ type
select*: proc () {.nimcall.} select*: proc () {.nimcall.}
options*: seq[ref TOption] options*: seq[ref TOption]
TOption* {.importc.} = object of TObject TOption* {.importc.} = object of RootObj
defaultSelected*: bool defaultSelected*: bool
selected*: bool selected*: bool
selectedIndex*: int selectedIndex*: int
@ -209,7 +209,7 @@ type
DocumentTypeNode, DocumentTypeNode,
DocumentFragmentNode, DocumentFragmentNode,
NotationNode NotationNode
TNode* {.importc.} = object of TObject TNode* {.importc.} = object of RootObj
attributes*: seq[ref TNode] attributes*: seq[ref TNode]
childNodes*: seq[ref TNode] childNodes*: seq[ref TNode]
data*: cstring data*: cstring
@ -241,7 +241,7 @@ type
setAttributeNode*: proc (attr: ref TNode) {.nimcall.} setAttributeNode*: proc (attr: ref TNode) {.nimcall.}
style*: ref TStyle style*: ref TStyle
TStyle* {.importc.} = object of TObject TStyle* {.importc.} = object of RootObj
background*: cstring background*: cstring
backgroundAttachment*: cstring backgroundAttachment*: cstring
backgroundColor*: cstring backgroundColor*: cstring
@ -335,7 +335,7 @@ type
removeAttribute*: proc (attr: cstring, caseSensitive=false) {.nimcall.} removeAttribute*: proc (attr: cstring, caseSensitive=false) {.nimcall.}
setAttribute*: proc (attr, value: cstring, caseSensitive=false) {.nimcall.} setAttribute*: proc (attr, value: cstring, caseSensitive=false) {.nimcall.}
TEvent* {.importc.} = object of TObject TEvent* {.importc.} = object of RootObj
altKey*, ctrlKey*, shiftKey*: bool altKey*, ctrlKey*, shiftKey*: bool
button*: int button*: int
clientX*, clientY*: int clientX*, clientY*: int
@ -373,7 +373,7 @@ type
SUBMIT*: int SUBMIT*: int
UNLOAD*: int UNLOAD*: int
TLocation* {.importc.} = object of TObject TLocation* {.importc.} = object of RootObj
hash*: cstring hash*: cstring
host*: cstring host*: cstring
hostname*: cstring hostname*: cstring
@ -385,13 +385,13 @@ type
reload*: proc () {.nimcall.} reload*: proc () {.nimcall.}
replace*: proc (s: cstring) {.nimcall.} replace*: proc (s: cstring) {.nimcall.}
THistory* {.importc.} = object of TObject THistory* {.importc.} = object of RootObj
length*: int length*: int
back*: proc () {.nimcall.} back*: proc () {.nimcall.}
forward*: proc () {.nimcall.} forward*: proc () {.nimcall.}
go*: proc (pagesToJump: int) {.nimcall.} go*: proc (pagesToJump: int) {.nimcall.}
TNavigator* {.importc.} = object of TObject TNavigator* {.importc.} = object of RootObj
appCodeName*: cstring appCodeName*: cstring
appName*: cstring appName*: cstring
appVersion*: cstring appVersion*: cstring
@ -402,18 +402,18 @@ type
javaEnabled*: proc (): bool {.nimcall.} javaEnabled*: proc (): bool {.nimcall.}
mimeTypes*: seq[ref TMimeType] mimeTypes*: seq[ref TMimeType]
TPlugin* {.importc.} = object of TObject TPlugin* {.importc.} = object of RootObj
description*: cstring description*: cstring
filename*: cstring filename*: cstring
name*: cstring name*: cstring
TMimeType* {.importc.} = object of TObject TMimeType* {.importc.} = object of RootObj
description*: cstring description*: cstring
enabledPlugin*: ref TPlugin enabledPlugin*: ref TPlugin
suffixes*: seq[cstring] suffixes*: seq[cstring]
`type`*: cstring `type`*: cstring
TLocationBar* {.importc.} = object of TObject TLocationBar* {.importc.} = object of RootObj
visible*: bool visible*: bool
TMenuBar* = TLocationBar TMenuBar* = TLocationBar
TPersonalBar* = TLocationBar TPersonalBar* = TLocationBar
@ -421,7 +421,7 @@ type
TToolBar* = TLocationBar TToolBar* = TLocationBar
TStatusBar* = TLocationBar TStatusBar* = TLocationBar
TScreen* {.importc.} = object of TObject TScreen* {.importc.} = object of RootObj
availHeight*: int availHeight*: int
availWidth*: int availWidth*: int
colorDepth*: int colorDepth*: int
@ -429,8 +429,8 @@ type
pixelDepth*: int pixelDepth*: int
width*: int width*: int
TTimeOut* {.importc.} = object of TObject TTimeOut* {.importc.} = object of RootObj
TInterval* {.importc.} = object of TObject TInterval* {.importc.} = object of RootObj
var var
window* {.importc, nodecl.}: ref TWindow window* {.importc, nodecl.}: ref TWindow

View file

@ -446,13 +446,14 @@ proc getFile[T](ftp: FtpBase[T], async = false): bool =
ftp.job.file.write(r2) ftp.job.file.write(r2)
elif returned and r2 == "": elif returned and r2 == "":
ftp.dsockConnected = false ftp.dsockConnected = false
if not async: when T is TSocket:
var readSocks: seq[TSocket] = @[ftp.csock] if not async:
blockingOperation(ftp.csock): var readSocks: seq[TSocket] = @[ftp.csock]
if readSocks.select(1) != 0 and ftp.csock in readSocks: blockingOperation(ftp.csock):
assertReply ftp.expectReply(), "226" if readSocks.select(1) != 0 and ftp.csock in readSocks:
return true assertReply ftp.expectReply(), "226"
return true
proc retrFile*[T](ftp: FtpBase[T], file, dest: string, async = false) = proc retrFile*[T](ftp: FtpBase[T], file, dest: string, async = false) =
## Downloads ``file`` and saves it to ``dest``. Usage of this function ## Downloads ``file`` and saves it to ``dest``. Usage of this function

View file

@ -542,7 +542,7 @@ proc raiseParseErr*(p: JsonParser, msg: string) {.noinline, noreturn.} =
raise newException(JsonParsingError, errorMsgExpected(p, msg)) raise newException(JsonParsingError, errorMsgExpected(p, msg))
proc newJString*(s: string): JsonNode = proc newJString*(s: string): JsonNode =
## Creates a new `JString PJsonNode`. ## Creates a new `JString JsonNode`.
new(result) new(result)
result.kind = JString result.kind = JString
result.str = s result.str = s
@ -553,73 +553,73 @@ proc newJStringMove(s: string): JsonNode =
shallowCopy(result.str, s) shallowCopy(result.str, s)
proc newJInt*(n: BiggestInt): JsonNode = proc newJInt*(n: BiggestInt): JsonNode =
## Creates a new `JInt PJsonNode`. ## Creates a new `JInt JsonNode`.
new(result) new(result)
result.kind = JInt result.kind = JInt
result.num = n result.num = n
proc newJFloat*(n: float): JsonNode = proc newJFloat*(n: float): JsonNode =
## Creates a new `JFloat PJsonNode`. ## Creates a new `JFloat JsonNode`.
new(result) new(result)
result.kind = JFloat result.kind = JFloat
result.fnum = n result.fnum = n
proc newJBool*(b: bool): JsonNode = proc newJBool*(b: bool): JsonNode =
## Creates a new `JBool PJsonNode`. ## Creates a new `JBool JsonNode`.
new(result) new(result)
result.kind = JBool result.kind = JBool
result.bval = b result.bval = b
proc newJNull*(): JsonNode = proc newJNull*(): JsonNode =
## Creates a new `JNull PJsonNode`. ## Creates a new `JNull JsonNode`.
new(result) new(result)
proc newJObject*(): JsonNode = proc newJObject*(): JsonNode =
## Creates a new `JObject PJsonNode` ## Creates a new `JObject JsonNode`
new(result) new(result)
result.kind = JObject result.kind = JObject
result.fields = @[] result.fields = @[]
proc newJArray*(): JsonNode = proc newJArray*(): JsonNode =
## Creates a new `JArray PJsonNode` ## Creates a new `JArray JsonNode`
new(result) new(result)
result.kind = JArray result.kind = JArray
result.elems = @[] result.elems = @[]
proc `%`*(s: string): JsonNode = proc `%`*(s: string): JsonNode =
## Generic constructor for JSON data. Creates a new `JString PJsonNode`. ## Generic constructor for JSON data. Creates a new `JString JsonNode`.
new(result) new(result)
result.kind = JString result.kind = JString
result.str = s result.str = s
proc `%`*(n: BiggestInt): JsonNode = proc `%`*(n: BiggestInt): JsonNode =
## Generic constructor for JSON data. Creates a new `JInt PJsonNode`. ## Generic constructor for JSON data. Creates a new `JInt JsonNode`.
new(result) new(result)
result.kind = JInt result.kind = JInt
result.num = n result.num = n
proc `%`*(n: float): JsonNode = proc `%`*(n: float): JsonNode =
## Generic constructor for JSON data. Creates a new `JFloat PJsonNode`. ## Generic constructor for JSON data. Creates a new `JFloat JsonNode`.
new(result) new(result)
result.kind = JFloat result.kind = JFloat
result.fnum = n result.fnum = n
proc `%`*(b: bool): JsonNode = proc `%`*(b: bool): JsonNode =
## Generic constructor for JSON data. Creates a new `JBool PJsonNode`. ## Generic constructor for JSON data. Creates a new `JBool JsonNode`.
new(result) new(result)
result.kind = JBool result.kind = JBool
result.bval = b result.bval = b
proc `%`*(keyVals: openArray[tuple[key: string, val: JsonNode]]): JsonNode = proc `%`*(keyVals: openArray[tuple[key: string, val: JsonNode]]): JsonNode =
## Generic constructor for JSON data. Creates a new `JObject PJsonNode` ## Generic constructor for JSON data. Creates a new `JObject JsonNode`
new(result) new(result)
result.kind = JObject result.kind = JObject
newSeq(result.fields, keyVals.len) newSeq(result.fields, keyVals.len)
for i, p in pairs(keyVals): result.fields[i] = p for i, p in pairs(keyVals): result.fields[i] = p
proc `%`*(elements: openArray[JsonNode]): JsonNode = proc `%`*(elements: openArray[JsonNode]): JsonNode =
## Generic constructor for JSON data. Creates a new `JArray PJsonNode` ## Generic constructor for JSON data. Creates a new `JArray JsonNode`
new(result) new(result)
result.kind = JArray result.kind = JArray
newSeq(result.elems, elements.len) newSeq(result.elems, elements.len)
@ -932,7 +932,7 @@ proc parseJson(p: var JsonParser): JsonNode =
when not defined(js): when not defined(js):
proc parseJson*(s: Stream, filename: string): JsonNode = proc parseJson*(s: Stream, filename: string): JsonNode =
## Parses from a stream `s` into a `PJsonNode`. `filename` is only needed ## Parses from a stream `s` into a `JsonNode`. `filename` is only needed
## for nice error messages. ## for nice error messages.
var p: JsonParser var p: JsonParser
p.open(s, filename) p.open(s, filename)
@ -945,7 +945,7 @@ when not defined(js):
result = parseJson(newStringStream(buffer), "input") result = parseJson(newStringStream(buffer), "input")
proc parseFile*(filename: string): JsonNode = proc parseFile*(filename: string): JsonNode =
## Parses `file` into a `PJsonNode`. ## Parses `file` into a `JsonNode`.
var stream = newFileStream(filename, fmRead) var stream = newFileStream(filename, fmRead)
if stream == nil: if stream == nil:
raise newException(IOError, "cannot read from file: " & filename) raise newException(IOError, "cannot read from file: " & filename)
@ -956,7 +956,7 @@ else:
TJSObject = object TJSObject = object
proc parseNativeJson(x: cstring): TJSObject {.importc: "JSON.parse".} proc parseNativeJson(x: cstring): TJSObject {.importc: "JSON.parse".}
proc getVarType(x): TJsonNodeKind = proc getVarType(x): JsonNodeKind =
result = JNull result = JNull
proc getProtoName(y): cstring proc getProtoName(y): cstring
{.importc: "Object.prototype.toString.call".} {.importc: "Object.prototype.toString.call".}
@ -991,7 +991,7 @@ else:
return `x`[`y`]; return `x`[`y`];
""" """
proc convertObject(x: TJSObject): PJsonNode = proc convertObject(x: TJSObject): JsonNode =
case getVarType(x) case getVarType(x)
of JArray: of JArray:
result = newJArray() result = newJArray()
@ -1018,15 +1018,15 @@ else:
of JNull: of JNull:
result = newJNull() result = newJNull()
proc parseJson*(buffer: string): PJsonNode = proc parseJson*(buffer: string): JsonNode =
return parseNativeJson(buffer).convertObject() return parseNativeJson(buffer).convertObject()
when false: when false:
import os import os
var s = newFileStream(ParamStr(1), fmRead) var s = newFileStream(paramStr(1), fmRead)
if s == nil: quit("cannot open the file" & ParamStr(1)) if s == nil: quit("cannot open the file" & paramStr(1))
var x: TJsonParser var x: JsonParser
open(x, s, ParamStr(1)) open(x, s, paramStr(1))
while true: while true:
next(x) next(x)
case x.kind case x.kind
@ -1035,13 +1035,13 @@ when false:
break break
of jsonEof: break of jsonEof: break
of jsonString, jsonInt, jsonFloat: echo(x.str) of jsonString, jsonInt, jsonFloat: echo(x.str)
of jsonTrue: Echo("!TRUE") of jsonTrue: echo("!TRUE")
of jsonFalse: Echo("!FALSE") of jsonFalse: echo("!FALSE")
of jsonNull: Echo("!NULL") of jsonNull: echo("!NULL")
of jsonObjectStart: Echo("{") of jsonObjectStart: echo("{")
of jsonObjectEnd: Echo("}") of jsonObjectEnd: echo("}")
of jsonArrayStart: Echo("[") of jsonArrayStart: echo("[")
of jsonArrayEnd: Echo("]") of jsonArrayEnd: echo("]")
close(x) close(x)

View file

@ -107,9 +107,12 @@ proc substituteLog(frmt: string): string =
of "app": result.add(app) of "app": result.add(app)
of "appdir": result.add(app.splitFile.dir) of "appdir": result.add(app.splitFile.dir)
of "appname": result.add(app.splitFile.name) of "appname": result.add(app.splitFile.name)
else: discard
method log*(logger: Logger, level: Level, method log*(logger: Logger, level: Level,
frmt: string, args: varargs[string, `$`]) {.raises: [Exception], tags: [FTime, FWriteIO, FReadIO].} = frmt: string, args: varargs[string, `$`]) {.
raises: [Exception],
tags: [TimeEffect, WriteIOEffect, ReadIOEffect].} =
## Override this method in custom loggers. Default implementation does ## Override this method in custom loggers. Default implementation does
## nothing. ## nothing.
discard discard

View file

@ -345,11 +345,12 @@ else:
node.appendChild(document.createTextNode(x)) node.appendChild(document.createTextNode(x))
node.appendChild(document.createElement("br")) node.appendChild(document.createElement("br"))
else: else:
raise newException(EInvalidValue, "<body> element does not exist yet!") raise newException(ValueError, "<body> element does not exist yet!")
proc rawEcho {.compilerproc.} = proc rawEcho {.compilerproc.} =
var node = document.getElementsByTagName("body")[0] var node = document.getElementsByTagName("body")[0]
if node == nil: raise newException(EIO, "<body> element does not exist yet!") if node == nil:
raise newException(IOError, "<body> element does not exist yet!")
asm """ asm """
for (var i = 0; i < arguments.length; ++i) { for (var i = 0; i < arguments.length; ++i) {
var x = `toJSStr`(arguments[i]); var x = `toJSStr`(arguments[i]);

View file

@ -35,7 +35,7 @@ type
GetAddrInfoProc* = proc (handle: PGetAddrInfo, status: cint, res: ptr TAddrInfo) GetAddrInfoProc* = proc (handle: PGetAddrInfo, status: cint, res: ptr TAddrInfo)
ExitProc* = proc (a2: PProcess, exit_status: cint, term_signal: cint) ExitProc* = proc (a2: PProcess, exit_status: cint, term_signal: cint)
FsProc* = proc (req: pFS) FsProc* = proc (req: PFS)
WorkProc* = proc (req: PWork) WorkProc* = proc (req: PWork)
AfterWorkProc* = proc (req: PWork) AfterWorkProc* = proc (req: PWork)
@ -338,7 +338,7 @@ type
FS_CHMOD, FS_FCHMOD, FS_FSYNC, FS_FDATASYNC, FS_UNLINK, FS_RMDIR, FS_MKDIR, FS_CHMOD, FS_FCHMOD, FS_FSYNC, FS_FDATASYNC, FS_UNLINK, FS_RMDIR, FS_MKDIR,
FS_RENAME, FS_READDIR, FS_LINK, FS_SYMLINK, FS_READLINK, FS_CHOWN, FS_FCHOWN FS_RENAME, FS_READDIR, FS_LINK, FS_SYMLINK, FS_READLINK, FS_CHOWN, FS_FCHOWN
tFS* {.pure, final, importc: "uv_fs_t", header: "uv.h".} = object TFS* {.pure, final, importc: "uv_fs_t", header: "uv.h".} = object
typ* {.importc: "type".}: TReqType typ* {.importc: "type".}: TReqType
data* {.importc: "data".}: pointer data* {.importc: "data".}: pointer
loop* {.importc: "loop".}: PLoop loop* {.importc: "loop".}: PLoop
@ -349,7 +349,7 @@ type
path* {.importc: "path".}: cstring path* {.importc: "path".}: cstring
errorno* {.importc: "errorno".}: cint errorno* {.importc: "errorno".}: cint
pFS* = ptr tFS PFS* = ptr TFS
TReq* {.pure, final, importc: "uv_req_t", header: "uv.h".} = object TReq* {.pure, final, importc: "uv_req_t", header: "uv.h".} = object
typ* {.importc: "type".}: TReqType typ* {.importc: "type".}: TReqType
@ -591,85 +591,85 @@ proc process_kill*(a2: PProcess, signum: cint): cint{.
proc queue_work*(loop: PLoop, req: PWork, work_cb: WorkProc, after_work_cb: AfterWorkProc): cint{. proc queue_work*(loop: PLoop, req: PWork, work_cb: WorkProc, after_work_cb: AfterWorkProc): cint{.
importc: "uv_queue_work", header: "uv.h".} importc: "uv_queue_work", header: "uv.h".}
proc req_cleanup*(req: pFS){. proc req_cleanup*(req: PFS){.
importc: "uv_fs_req_cleanup", header: "uv.h".} importc: "uv_fs_req_cleanup", header: "uv.h".}
proc close*(loop: PLoop, req: pFS, file: TFile, cb: FsProc): cint{. proc close*(loop: PLoop, req: PFS, file: TFile, cb: FsProc): cint{.
importc: "uv_fs_close", header: "uv.h".} importc: "uv_fs_close", header: "uv.h".}
proc open*(loop: PLoop, req: pFS, path: cstring, flags: cint, mode: cint, cb: FsProc): cint{. proc open*(loop: PLoop, req: PFS, path: cstring, flags: cint, mode: cint, cb: FsProc): cint{.
importc: "uv_fs_open", header: "uv.h".} importc: "uv_fs_open", header: "uv.h".}
proc read*(loop: PLoop, req: pFS, file: TFile, buf: pointer, length: csize, offset: coff, cb: FsProc): cint{. proc read*(loop: PLoop, req: PFS, file: TFile, buf: pointer, length: csize, offset: coff, cb: FsProc): cint{.
importc: "uv_fs_read", header: "uv.h".} importc: "uv_fs_read", header: "uv.h".}
proc unlink*(loop: PLoop, req: pFS, path: cstring, cb: FsProc): cint{. proc unlink*(loop: PLoop, req: PFS, path: cstring, cb: FsProc): cint{.
importc: "uv_fs_unlink", header: "uv.h".} importc: "uv_fs_unlink", header: "uv.h".}
proc write*(loop: PLoop, req: pFS, file: TFile, buf: pointer, length: csize, offset: coff, cb: FsProc): cint{. proc write*(loop: PLoop, req: PFS, file: TFile, buf: pointer, length: csize, offset: coff, cb: FsProc): cint{.
importc: "uv_fs_write", header: "uv.h".} importc: "uv_fs_write", header: "uv.h".}
proc mkdir*(loop: PLoop, req: pFS, path: cstring, mode: cint, cb: FsProc): cint{. proc mkdir*(loop: PLoop, req: PFS, path: cstring, mode: cint, cb: FsProc): cint{.
importc: "uv_fs_mkdir", header: "uv.h".} importc: "uv_fs_mkdir", header: "uv.h".}
proc rmdir*(loop: PLoop, req: pFS, path: cstring, cb: FsProc): cint{. proc rmdir*(loop: PLoop, req: PFS, path: cstring, cb: FsProc): cint{.
importc: "uv_fs_rmdir", header: "uv.h".} importc: "uv_fs_rmdir", header: "uv.h".}
proc readdir*(loop: PLoop, req: pFS, path: cstring, flags: cint, cb: FsProc): cint{. proc readdir*(loop: PLoop, req: PFS, path: cstring, flags: cint, cb: FsProc): cint{.
importc: "uv_fs_readdir", header: "uv.h".} importc: "uv_fs_readdir", header: "uv.h".}
proc stat*(loop: PLoop, req: pFS, path: cstring, cb: FsProc): cint{. proc stat*(loop: PLoop, req: PFS, path: cstring, cb: FsProc): cint{.
importc: "uv_fs_stat", header: "uv.h".} importc: "uv_fs_stat", header: "uv.h".}
proc fstat*(loop: PLoop, req: pFS, file: TFile, cb: FsProc): cint{. proc fstat*(loop: PLoop, req: PFS, file: TFile, cb: FsProc): cint{.
importc: "uv_fs_fstat", header: "uv.h".} importc: "uv_fs_fstat", header: "uv.h".}
proc rename*(loop: PLoop, req: pFS, path: cstring, new_path: cstring, cb: FsProc): cint{. proc rename*(loop: PLoop, req: PFS, path: cstring, new_path: cstring, cb: FsProc): cint{.
importc: "uv_fs_rename", header: "uv.h".} importc: "uv_fs_rename", header: "uv.h".}
proc fsync*(loop: PLoop, req: pFS, file: TFile, cb: FsProc): cint{. proc fsync*(loop: PLoop, req: PFS, file: TFile, cb: FsProc): cint{.
importc: "uv_fs_fsync", header: "uv.h".} importc: "uv_fs_fsync", header: "uv.h".}
proc fdatasync*(loop: PLoop, req: pFS, file: TFile, cb: FsProc): cint{. proc fdatasync*(loop: PLoop, req: PFS, file: TFile, cb: FsProc): cint{.
importc: "uv_fs_fdatasync", header: "uv.h".} importc: "uv_fs_fdatasync", header: "uv.h".}
proc ftruncate*(loop: PLoop, req: pFS, file: TFile, offset: coff, cb: FsProc): cint{. proc ftruncate*(loop: PLoop, req: PFS, file: TFile, offset: coff, cb: FsProc): cint{.
importc: "uv_fs_ftruncate", header: "uv.h".} importc: "uv_fs_ftruncate", header: "uv.h".}
proc sendfile*(loop: PLoop, req: pFS, out_fd: TFile, in_fd: TFile, in_offset: coff, length: csize, cb: FsProc): cint{. proc sendfile*(loop: PLoop, req: PFS, out_fd: TFile, in_fd: TFile, in_offset: coff, length: csize, cb: FsProc): cint{.
importc: "uv_fs_sendfile", header: "uv.h".} importc: "uv_fs_sendfile", header: "uv.h".}
proc chmod*(loop: PLoop, req: pFS, path: cstring, mode: cint, cb: FsProc): cint{. proc chmod*(loop: PLoop, req: PFS, path: cstring, mode: cint, cb: FsProc): cint{.
importc: "uv_fs_chmod", header: "uv.h".} importc: "uv_fs_chmod", header: "uv.h".}
proc utime*(loop: PLoop, req: pFS, path: cstring, atime: cdouble, mtime: cdouble, cb: FsProc): cint{. proc utime*(loop: PLoop, req: PFS, path: cstring, atime: cdouble, mtime: cdouble, cb: FsProc): cint{.
importc: "uv_fs_utime", header: "uv.h".} importc: "uv_fs_utime", header: "uv.h".}
proc futime*(loop: PLoop, req: pFS, file: TFile, atime: cdouble, mtime: cdouble, cb: FsProc): cint{. proc futime*(loop: PLoop, req: PFS, file: TFile, atime: cdouble, mtime: cdouble, cb: FsProc): cint{.
importc: "uv_fs_futime", header: "uv.h".} importc: "uv_fs_futime", header: "uv.h".}
proc lstat*(loop: PLoop, req: pFS, path: cstring, cb: FsProc): cint{. proc lstat*(loop: PLoop, req: PFS, path: cstring, cb: FsProc): cint{.
importc: "uv_fs_lstat", header: "uv.h".} importc: "uv_fs_lstat", header: "uv.h".}
proc link*(loop: PLoop, req: pFS, path: cstring, new_path: cstring, cb: FsProc): cint{. proc link*(loop: PLoop, req: PFS, path: cstring, new_path: cstring, cb: FsProc): cint{.
importc: "uv_fs_link", header: "uv.h".} importc: "uv_fs_link", header: "uv.h".}
proc symlink*(loop: PLoop, req: pFS, path: cstring, new_path: cstring, flags: cint, cb: FsProc): cint{. proc symlink*(loop: PLoop, req: PFS, path: cstring, new_path: cstring, flags: cint, cb: FsProc): cint{.
importc: "uv_fs_symlink", header: "uv.h".} importc: "uv_fs_symlink", header: "uv.h".}
proc readlink*(loop: PLoop, req: pFS, path: cstring, cb: FsProc): cint{. proc readlink*(loop: PLoop, req: PFS, path: cstring, cb: FsProc): cint{.
importc: "uv_fs_readlink", header: "uv.h".} importc: "uv_fs_readlink", header: "uv.h".}
proc fchmod*(loop: PLoop, req: pFS, file: TFile, mode: cint, cb: FsProc): cint{. proc fchmod*(loop: PLoop, req: PFS, file: TFile, mode: cint, cb: FsProc): cint{.
importc: "uv_fs_fchmod", header: "uv.h".} importc: "uv_fs_fchmod", header: "uv.h".}
proc chown*(loop: PLoop, req: pFS, path: cstring, uid: cint, gid: cint, cb: FsProc): cint{. proc chown*(loop: PLoop, req: PFS, path: cstring, uid: cint, gid: cint, cb: FsProc): cint{.
importc: "uv_fs_chown", header: "uv.h".} importc: "uv_fs_chown", header: "uv.h".}
proc fchown*(loop: PLoop, req: pFS, file: TFile, uid: cint, gid: cint, cb: FsProc): cint{. proc fchown*(loop: PLoop, req: PFS, file: TFile, uid: cint, gid: cint, cb: FsProc): cint{.
importc: "uv_fs_fchown", header: "uv.h".} importc: "uv_fs_fchown", header: "uv.h".}
proc event_init*(loop: PLoop, handle: PFsEvent, filename: cstring, cb: FsEventProc): cint{. proc event_init*(loop: PLoop, handle: PFSEvent, filename: cstring, cb: FsEventProc): cint{.
importc: "uv_fs_event_init", header: "uv.h".} importc: "uv_fs_event_init", header: "uv.h".}
proc ip4_addr*(ip: cstring, port: cint): TSockAddrIn{. proc ip4_addr*(ip: cstring, port: cint): TSockAddrIn{.

View file

@ -35,7 +35,7 @@ proc initConfigData(c: var TConfigData) =
c.pdf = @[] c.pdf = @[]
c.infile = "" c.infile = ""
c.outdir = "" c.outdir = ""
c.nimArgs = "--hint[Conf]:off " c.nimArgs = "--hint[Conf]:off --hint[Path]:off --hint[Processing]:off "
c.authors = "" c.authors = ""
c.projectTitle = "" c.projectTitle = ""
c.projectName = "" c.projectName = ""

View file

@ -10,7 +10,7 @@ proc decodeContent(content: string): string =
if line != "": if line != "":
result.add decode(line) result.add decode(line)
proc contains(x: seq[PJSonNode], s: string): bool = proc contains(x: seq[JSonNode], s: string): bool =
for i in x: for i in x:
assert i.kind == JString assert i.kind == JString
if i.str == s: return true if i.str == s: return true
@ -20,7 +20,7 @@ proc processContent(content: string) =
assert jsonDoc.kind == JArray assert jsonDoc.kind == JArray
var jsonArr = jsonDoc.elems var jsonArr = jsonDoc.elems
jsonArr.sort do (x, y: PJsonNode) -> int: jsonArr.sort do (x, y: JsonNode) -> int:
strutils.cmpIgnoreCase(x["name"].str, y["name"].str) strutils.cmpIgnoreCase(x["name"].str, y["name"].str)
var var

View file

@ -36,7 +36,7 @@ UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson."""
[Documentation] [Documentation]
doc: "endb;intern;apis;lib;manual;tut1;tut2;nimc;overview;filters" doc: "endb;intern;apis;lib;manual.txt;tut1;tut2;nimc;overview;filters"
doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt" doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt"
pdf: "manual;lib;tut1;tut2;nimc;niminst;gc" pdf: "manual;lib;tut1;tut2;nimc;niminst;gc"
srcdoc2: "system.nim" srcdoc2: "system.nim"