Merge branch 'devel' into bigbreak

Conflicts:
	compiler/ast.nim
	compiler/nimfix/prettybase.nim
	compiler/pragmas.nim
	compiler/sempass2.nim
	doc/manual.txt
	koch.nim
	lib/pure/concurrency/threadpool.nim
	web/news.txt
This commit is contained in:
Araq 2014-10-13 08:26:24 +02:00
commit c7570dcd3e
7 changed files with 61 additions and 21 deletions

View file

@ -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)

View file

@ -18,15 +18,24 @@ when not defined(windows):
when defined(linux):
import linux
when defined(freebsd) or defined(macosx):
{.emit:"#include <sys/types.h>".}
when defined(openbsd) or defined(netbsd):
{.emit:"#include <sys/param.h>".}
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 <sys/sysctl.h>".}
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: "<sys/sysctl.h>".}
importc: "sysctl", nodecl.}
proc countProcessors*(): int {.rtl, extern: "ncpi$1".} =
## returns the numer of the processors/cores the machine has.