diff --git a/doc/manual/pragmas.txt b/doc/manual/pragmas.txt index 1a19cb1298..6181b3e1b3 100644 --- a/doc/manual/pragmas.txt +++ b/doc/manual/pragmas.txt @@ -9,6 +9,26 @@ first implementation to play with a language feature before a nicer syntax to access the feature becomes available. +deprecated pragma +----------------- + +The deprecated pragma is used to mark a symbol as deprecated: + +.. code-block:: nimrod + proc p() {.deprecated.} + var x {.deprecated.}: char + +It can also be used as a statement. Then it takes a list of *renamings*. The +upcoming ``nimfix`` tool can automatically update the code and perform these +renamings: + +.. code-block:: nimrod + type + File = object + Stream = ref object + {.deprecated: [TFile: File, PStream: Stream].} + + noSideEffect pragma ------------------- The ``noSideEffect`` pragma is used to mark a proc/iterator to have no side diff --git a/doc/nimdoc.css b/doc/nimdoc.css index 6154f0b2eb..e3bab07de3 100644 --- a/doc/nimdoc.css +++ b/doc/nimdoc.css @@ -16,6 +16,11 @@ customize this style sheet. Andreas Rumpf */ +body { + color: black; + background: white; +} + /* used to remove borders from tables and images */ .borderless, table.borderless td, table.borderless th { border: 0 } diff --git a/koch.nim b/koch.nim index 2cbfe01c56..3ea3475b94 100644 --- a/koch.nim +++ b/koch.nim @@ -85,9 +85,11 @@ proc csource(args: string) = exec("$4 cc $1 -r $3 --var:version=$2 csource compiler/nim.ini $1" % [args, NimVersion, compileNimInst, findNim()]) -proc zip(args: string) = - exec("$3 cc -r $2 --var:version=$1 zip compiler/nim.ini" % +proc zip(args: string) = + exec("$3 cc -r $2 --var:version=$1 scripts compiler/nim.ini" % [NimVersion, compileNimInst, findNim()]) + exec("$# --var:version=$# zip compiler/nim.ini" % + ["tools/niminst/niminst".exe, NimVersion]) proc buildTool(toolname, args: string) = exec("$# cc $# $#" % [findNim(), args, toolname]) diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim index fb687e6f1f..8e5c24b8b9 100644 --- a/lib/impure/zipfiles.nim +++ b/lib/impure/zipfiles.nim @@ -56,6 +56,8 @@ proc addFile*(z: var TZipArchive, dest, src: string) = ## Adds the file `src` to the archive `z` with the name `dest`. `dest` ## may contain a path that will be created. assert(z.mode != fmRead) + if not fileExists(src): + raise newException(EIO, "File '" & src & "' does not exist") var zipsrc = zip_source_file(z.w, src, 0, -1) if zipsrc == nil: #echo("Dest: " & dest) diff --git a/lib/pure/concurrency/cpuinfo.nim b/lib/pure/concurrency/cpuinfo.nim index e55786c3ec..ac5fa5dd95 100644 --- a/lib/pure/concurrency/cpuinfo.nim +++ b/lib/pure/concurrency/cpuinfo.nim @@ -18,15 +18,24 @@ when not defined(windows): when defined(linux): import linux + +when defined(freebsd) or defined(macosx): + {.emit:"#include ".} + +when defined(openbsd) or defined(netbsd): + {.emit:"#include ".} when defined(macosx) or defined(bsd): + # we HAVE to emit param.h before sysctl.h so we cannot use .header here + # either. The amount of archaic bullshit in Poonix based OSes is just insane. + {.emit:"#include ".} const CTL_HW = 6 HW_AVAILCPU = 25 HW_NCPU = 3 proc sysctl(x: ptr array[0..3, cint], y: cint, z: pointer, a: var csize, b: pointer, c: int): cint {. - importc: "sysctl", header: "".} + importc: "sysctl", nodecl.} proc countProcessors*(): int {.rtl, extern: "ncpi$1".} = ## returns the numer of the processors/cores the machine has. diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index 686a0bfa35..614009c241 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -503,9 +503,9 @@ when haveZipLib: else: n = c.outdir / n var z: TZipArchive if open(z, n, fmWrite): - addFile(z, proj / buildBatFile32, buildBatFile32) - addFile(z, proj / buildBatFile64, buildBatFile64) - addFile(z, proj / buildShFile, buildShFile) + addFile(z, proj / buildBatFile32, "build" / buildBatFile32) + addFile(z, proj / buildBatFile64, "build" / buildBatFile64) + addFile(z, proj / buildShFile, "build" / buildShFile) addFile(z, proj / installShFile, installShFile) addFile(z, proj / deinstallShFile, deinstallShFile) for f in walkFiles(c.libpath / "lib/*.h"): @@ -513,7 +513,7 @@ when haveZipLib: for osA in 1..c.oses.len: for cpuA in 1..c.cpus.len: var dir = buildDir(osA, cpuA) - for k, f in walkDir(dir): + for k, f in walkDir("build" / dir): if k == pcFile: addFile(z, proj / dir / extractFilename(f), f) for cat in items({fcConfig..fcOther, fcUnix}): diff --git a/web/news.txt b/web/news.txt index 8a28292e68..d57b3f83ae 100644 --- a/web/news.txt +++ b/web/news.txt @@ -63,11 +63,6 @@ News The modules that use ``importCpp`` or ``importObjc`` are compiled to C++ or Objective C code, any other module is compiled to C code. This improves interoperability. - - - Language Additions - ------------------ - - There is a new ``parallel`` statement for safe fork&join parallel computing. - ``guard`` and ``lock`` pragmas have been implemented to support safer concurrent programming. @@ -81,16 +76,23 @@ News system.writeFile - Library Additions - ----------------- +Language Additions +------------------ - - Added module ``cpuinfo``. - - Added module ``threadpool``. - - ``sequtils.distnct`` has been renamed to ``sequtils.deduplicate``. - - Added ``algorithm.reversed`` - - Added ``uri.combine`` and ``uri.parseUri``. - - Some sockets procedures now support a ``SafeDisconn`` flag which causes - them to handle disconnection errors and not raise them. +- This version introduces the new ``deprecated`` pragma statement that is used + to handle the upcoming massive amount of symbol renames. + + +Library Additions +----------------- + +- Added module ``cpuinfo``. +- Added module ``threadpool``. +- ``sequtils.distnct`` has been renamed to ``sequtils.deduplicate``. +- Added ``algorithm.reversed`` +- Added ``uri.combine`` and ``uri.parseUri``. +- Some sockets procedures now support a ``SafeDisconn`` flag which causes + them to handle disconnection errors and not raise them. 2014-04-21 Version 0.9.4 released