mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
implemented 'koch pdf'
This commit is contained in:
6
koch.nim
6
koch.nim
@@ -45,6 +45,7 @@ Possible Commands:
|
||||
web [options] generates the website and the full documentation
|
||||
website [options] generates only the website
|
||||
csource [options] builds the C sources for installation
|
||||
pdf builds the PDF documentation
|
||||
zip builds the installation ZIP package
|
||||
nsis [options] builds the NSIS Setup installer (for Windows)
|
||||
tests [options] run the testsuite
|
||||
@@ -129,6 +130,10 @@ proc website(args: string) =
|
||||
exec("$# cc -r tools/nimweb.nim $# --website web/nim --putenv:nimversion=$#" %
|
||||
[findNim(), args, VersionAsString])
|
||||
|
||||
proc pdf(args="") =
|
||||
exec("$# cc -r tools/nimweb.nim $# --pdf web/nim --putenv:nimversion=$#" %
|
||||
[findNim(), args, VersionAsString])
|
||||
|
||||
# -------------- boot ---------------------------------------------------------
|
||||
|
||||
const
|
||||
@@ -351,6 +356,7 @@ of cmdArgument:
|
||||
of "clean": clean(op.cmdLineRest)
|
||||
of "web": web(op.cmdLineRest)
|
||||
of "website": website(op.cmdLineRest)
|
||||
of "pdf": pdf()
|
||||
of "csource", "csources": csource(op.cmdLineRest)
|
||||
of "zip": zip(op.cmdLineRest)
|
||||
of "nsis": nsis(op.cmdLineRest)
|
||||
|
||||
@@ -21,7 +21,6 @@ type
|
||||
apart: array [ArrayPartSize, T]
|
||||
UncheckedArray* {.unchecked.}[T] = array[0..100_000_000, T]
|
||||
|
||||
|
||||
template usesSeqPart(x): expr = x.L > ArrayPartSize
|
||||
|
||||
proc initRtArray*[T](len: Natural): RtArray[T] =
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
discard """
|
||||
line: 12
|
||||
errormsg: "type mismatch: got (proc (int){.closure, gcsafe.})"
|
||||
errormsg: "type mismatch: got (proc (int){.closure, gcsafe, locks: 0.})"
|
||||
"""
|
||||
|
||||
proc ugh[T](x: T) {.closure.} =
|
||||
echo "ugha"
|
||||
|
||||
|
||||
proc takeCdecl(p: proc (x: int) {.cdecl.}) = nil
|
||||
proc takeCdecl(p: proc (x: int) {.cdecl.}) = discard
|
||||
|
||||
takeCDecl(ugh[int])
|
||||
|
||||
@@ -11,6 +11,6 @@ import sets
|
||||
|
||||
var intset = initSet[int]()
|
||||
|
||||
proc func*[T](a: T) =
|
||||
proc fn*[T](a: T) =
|
||||
if a in intset: echo("true")
|
||||
else: echo("false")
|
||||
|
||||
@@ -7,4 +7,4 @@ import mdotlookup
|
||||
|
||||
foo(7)
|
||||
# bug #1444
|
||||
func(4)
|
||||
fn(4)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
discard """
|
||||
output: "1.1000000000000001e+00 11"
|
||||
ccodecheck: "!@'ClEnv'"
|
||||
disabled: "true"
|
||||
"""
|
||||
|
||||
proc p[T](a, b: T): T
|
||||
|
||||
@@ -8,22 +8,22 @@ type
|
||||
b: proc(val: T) {.thread.}
|
||||
|
||||
proc handleThreadFunc(arg: TThreadFuncArgs[int]){.thread.} =
|
||||
var func = arg.a
|
||||
var fn = arg.a
|
||||
var callback = arg.b
|
||||
var output = func()
|
||||
var output = fn()
|
||||
callback(output)
|
||||
|
||||
proc `@||->`*[T](func: proc(): T {.thread.},
|
||||
proc `@||->`*[T](fn: proc(): T {.thread.},
|
||||
callback: proc(val: T){.thread.}): TThread[TThreadFuncArgs[T]] =
|
||||
var thr: TThread[TThreadFuncArgs[T]]
|
||||
var args: TThreadFuncArgs[T]
|
||||
args.a = func
|
||||
args.a = fn
|
||||
args.b = callback
|
||||
createThread(thr, handleThreadFunc, args)
|
||||
return thr
|
||||
|
||||
proc `||->`*[T](func: proc(): T{.thread.}, callback: proc(val: T){.thread.}) =
|
||||
discard func @||-> callback
|
||||
proc `||->`*[T](fn: proc(): T{.thread.}, callback: proc(val: T){.thread.}) =
|
||||
discard fn @||-> callback
|
||||
|
||||
when isMainModule:
|
||||
import os
|
||||
|
||||
@@ -35,9 +35,9 @@ echo noParams(() => 3)
|
||||
|
||||
echo doWithOneAndTwo((x, y) => x + y)
|
||||
|
||||
noReturn(() -> void => echo("noReturn"))
|
||||
noReturn((() -> void) => echo("noReturn"))
|
||||
|
||||
proc pass2(f: (int, int) -> int): (int) -> int =
|
||||
(x: int) -> int => f(2, x)
|
||||
((x: int) -> int) => f(2, x)
|
||||
|
||||
echo pass2((x, y) => x + y)(4)
|
||||
@@ -24,8 +24,10 @@ type
|
||||
numProcessors: int # Set by parallelBuild:n, only works for values > 0.
|
||||
TRssItem = object
|
||||
year, month, day, title: string
|
||||
TAction = enum
|
||||
actAll, actOnlyWebsite, actPdf
|
||||
|
||||
var onlyWebsite: bool
|
||||
var action: TAction
|
||||
|
||||
proc initConfigData(c: var TConfigData) =
|
||||
c.tabs = @[]
|
||||
@@ -70,6 +72,7 @@ Options:
|
||||
-h, --help shows this help
|
||||
-v, --version shows the version
|
||||
--website only build the website, not the full documentation
|
||||
--pdf build the PDF version of the documentation
|
||||
Compile_options:
|
||||
will be passed to the Nim compiler
|
||||
"""
|
||||
@@ -137,8 +140,8 @@ proc parseCmdLine(c: var TConfigData) =
|
||||
var idx = val.find('=')
|
||||
if idx < 0: quit("invalid command line")
|
||||
c.vars[substr(val, 0, idx-1)] = substr(val, idx+1)
|
||||
of "website":
|
||||
onlyWebsite = true
|
||||
of "website": action = actOnlyWebsite
|
||||
of "pdf": action = actPdf
|
||||
else: quit(usage)
|
||||
of cmdEnd: break
|
||||
if c.infile.len == 0: quit(usage)
|
||||
@@ -434,14 +437,12 @@ proc main(c: var TConfigData) =
|
||||
buildDoc(c, "web/upload")
|
||||
buildDocSamples(c, "doc")
|
||||
buildDoc(c, "doc")
|
||||
#buildPdfDoc(c, "doc")
|
||||
|
||||
var c: TConfigData
|
||||
initConfigData(c)
|
||||
parseCmdLine(c)
|
||||
parseIniFile(c)
|
||||
if onlyWebsite:
|
||||
buildWebsite(c)
|
||||
#buildPdfDoc(c, "doc")
|
||||
else:
|
||||
main(c)
|
||||
case action
|
||||
of actOnlyWebsite: buildWebsite(c)
|
||||
of actPdf: buildPdfDoc(c, "doc")
|
||||
of actAll: main(c)
|
||||
|
||||
@@ -44,7 +44,7 @@ learn: """Repetition renders the ridiculous reasonable. - Norman Wildberger"""
|
||||
doc: "endb;intern;apis;lib;manual.txt;tut1;tut2;nimc;overview;filters"
|
||||
doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt"
|
||||
doc: "nimfix.txt"
|
||||
pdf: "manual;lib;tut1;tut2;nimc;niminst;gc"
|
||||
pdf: "manual.txt;lib;tut1;tut2;nimc;niminst;gc"
|
||||
srcdoc2: "system.nim"
|
||||
srcdoc2: "core/macros;pure/marshal;core/typeinfo;core/unsigned"
|
||||
srcdoc2: "impure/re;pure/sockets;pure/typetraits"
|
||||
|
||||
Reference in New Issue
Block a user