doc2 support for nimweb; fixed graphics.withEvents

This commit is contained in:
Araq 2012-11-01 08:32:30 +01:00
commit f35b51c68f
4 changed files with 13 additions and 6 deletions

View file

@ -219,8 +219,8 @@ proc checkRaisesSpec(spec, real: PNode) =
for r in items(real): for r in items(real):
block search: block search:
for s in 0 .. <spec.len: for s in 0 .. <spec.len:
# r supertype of s? # s supertype of r?
if inheritanceDiff(r.excType, spec[s].typ) <= 0: if inheritanceDiff(spec[s].typ, r.excType) <= 0:
used.incl(s) used.incl(s)
break search break search
# XXX call graph analysis would be nice here! # XXX call graph analysis would be nice here!

View file

@ -487,7 +487,8 @@ proc fillSurface*(sur: PSurface, color: TColor) =
if sdl.FillRect(sur.s, nil, sur.createSdlColor(color)) == -1: if sdl.FillRect(sur.s, nil, sur.createSdlColor(color)) == -1:
raiseEGraphics() raiseEGraphics()
template withEvents*(surf: PSurface, event: expr, actions: stmt): stmt = template withEvents*(surf: PSurface, event: expr, actions: stmt): stmt {.
immediate.} =
## Simple template which creates an event loop. ``Event`` is the name of the ## Simple template which creates an event loop. ``Event`` is the name of the
## variable containing the TEvent object. ## variable containing the TEvent object.
while True: while True:

View file

@ -14,7 +14,7 @@ type
TKeyValPair = tuple[key, val: string] TKeyValPair = tuple[key, val: string]
TConfigData = object of TObject TConfigData = object of TObject
tabs, links: seq[TKeyValPair] tabs, links: seq[TKeyValPair]
doc, srcdoc, webdoc, pdf: seq[string] doc, srcdoc, srcdoc2, webdoc, pdf: seq[string]
authors, projectName, projectTitle, logo, infile, outdir, ticker: string authors, projectName, projectTitle, logo, infile, outdir, ticker: string
vars: PStringTable vars: PStringTable
nimrodArgs: string nimrodArgs: string
@ -24,6 +24,7 @@ proc initConfigData(c: var TConfigData) =
c.links = @[] c.links = @[]
c.doc = @[] c.doc = @[]
c.srcdoc = @[] c.srcdoc = @[]
c.srcdoc2 = @[]
c.webdoc = @[] c.webdoc = @[]
c.pdf = @[] c.pdf = @[]
c.infile = "" c.infile = ""
@ -139,6 +140,7 @@ proc parseIniFile(c: var TConfigData) =
of "doc": addFiles(c.doc, "doc", ".txt", split(v, {';'})) of "doc": addFiles(c.doc, "doc", ".txt", split(v, {';'}))
of "pdf": addFiles(c.pdf, "doc", ".txt", split(v, {';'})) of "pdf": addFiles(c.pdf, "doc", ".txt", split(v, {';'}))
of "srcdoc": addFiles(c.srcdoc, "lib", ".nim", split(v, {';'})) of "srcdoc": addFiles(c.srcdoc, "lib", ".nim", split(v, {';'}))
of "srcdoc2": addFiles(c.srcdoc2, "lib", ".nim", split(v, {';'}))
of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'})) of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'}))
else: quit(errorStr(p, "unknown variable: " & k.key)) else: quit(errorStr(p, "unknown variable: " & k.key))
else: nil else: nil
@ -167,6 +169,9 @@ proc buildDoc(c: var TConfigData, destPath: string) =
for d in items(c.srcdoc): for d in items(c.srcdoc):
Exec("nimrod doc $# -o:$# --index:on $#" % Exec("nimrod doc $# -o:$# --index:on $#" %
[c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d]) [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d])
for d in items(c.srcdoc2):
Exec("nimrod doc2 $# -o:$# --index:on $#" %
[c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), d])
Exec("nimrod buildIndex -o:$1/theindex.html $1" % [destPath]) Exec("nimrod buildIndex -o:$1/theindex.html $1" % [destPath])
proc buildPdfDoc(c: var TConfigData, destPath: string) = proc buildPdfDoc(c: var TConfigData, destPath: string) =

View file

@ -25,8 +25,9 @@ file: ticker
doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros" doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros"
doc: "tools;c2nim;niminst;nimgrep;gc;estp" doc: "tools;c2nim;niminst;nimgrep;gc;estp"
pdf: "manual;lib;tut1;tut2;nimrodc;c2nim;niminst;gc" pdf: "manual;lib;tut1;tut2;nimrodc;c2nim;niminst;gc"
srcdoc2: "impure/graphics;wrappers/sdl"
srcdoc: "core/macros;pure/marshal;core/typeinfo;core/unsigned" srcdoc: "core/macros;pure/marshal;core/typeinfo;core/unsigned"
srcdoc: "impure/graphics;impure/re;pure/sockets" srcdoc: "impure/re;pure/sockets"
srcdoc: "system.nim;system/threads.nim;system/channels.nim" srcdoc: "system.nim;system/threads.nim;system/channels.nim"
srcdoc: "pure/os;pure/strutils;pure/math;pure/matchers;pure/algorithm" srcdoc: "pure/os;pure/strutils;pure/math;pure/matchers;pure/algorithm"
srcdoc: "pure/complex;pure/times;pure/osproc;pure/pegs;pure/dynlib" srcdoc: "pure/complex;pure/times;pure/osproc;pure/pegs;pure/dynlib"
@ -59,7 +60,7 @@ webdoc: "wrappers/cairo"
webdoc: "wrappers/gtk" webdoc: "wrappers/gtk"
webdoc: "wrappers/libsvm.nim;wrappers/mongo.nim" webdoc: "wrappers/libsvm.nim;wrappers/mongo.nim"
webdoc: "windows" webdoc: "windows"
webdoc: "wrappers/x11;wrappers/opengl;wrappers/sdl;wrappers/lua" webdoc: "wrappers/x11;wrappers/opengl;wrappers/lua"
webdoc: "wrappers/readline/readline;wrappers/readline/history" webdoc: "wrappers/readline/readline;wrappers/readline/history"
webdoc: "wrappers/readline/rltypedefs" webdoc: "wrappers/readline/rltypedefs"