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

@ -9,6 +9,26 @@ first implementation to play with a language feature before a nicer syntax
to access the feature becomes available. 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 noSideEffect pragma
------------------- -------------------
The ``noSideEffect`` pragma is used to mark a proc/iterator to have no side The ``noSideEffect`` pragma is used to mark a proc/iterator to have no side

View file

@ -16,6 +16,11 @@ customize this style sheet.
Andreas Rumpf Andreas Rumpf
*/ */
body {
color: black;
background: white;
}
/* used to remove borders from tables and images */ /* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th { .borderless, table.borderless td, table.borderless th {
border: 0 } border: 0 }

View file

@ -85,9 +85,11 @@ proc csource(args: string) =
exec("$4 cc $1 -r $3 --var:version=$2 csource compiler/nim.ini $1" % exec("$4 cc $1 -r $3 --var:version=$2 csource compiler/nim.ini $1" %
[args, NimVersion, compileNimInst, findNim()]) [args, NimVersion, compileNimInst, findNim()])
proc zip(args: string) = proc zip(args: string) =
exec("$3 cc -r $2 --var:version=$1 zip compiler/nim.ini" % exec("$3 cc -r $2 --var:version=$1 scripts compiler/nim.ini" %
[NimVersion, compileNimInst, findNim()]) [NimVersion, compileNimInst, findNim()])
exec("$# --var:version=$# zip compiler/nim.ini" %
["tools/niminst/niminst".exe, NimVersion])
proc buildTool(toolname, args: string) = proc buildTool(toolname, args: string) =
exec("$# cc $# $#" % [findNim(), args, toolname]) exec("$# cc $# $#" % [findNim(), args, toolname])

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` ## Adds the file `src` to the archive `z` with the name `dest`. `dest`
## may contain a path that will be created. ## may contain a path that will be created.
assert(z.mode != fmRead) 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) var zipsrc = zip_source_file(z.w, src, 0, -1)
if zipsrc == nil: if zipsrc == nil:
#echo("Dest: " & dest) #echo("Dest: " & dest)

View file

@ -18,15 +18,24 @@ when not defined(windows):
when defined(linux): when defined(linux):
import 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): 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 const
CTL_HW = 6 CTL_HW = 6
HW_AVAILCPU = 25 HW_AVAILCPU = 25
HW_NCPU = 3 HW_NCPU = 3
proc sysctl(x: ptr array[0..3, cint], y: cint, z: pointer, proc sysctl(x: ptr array[0..3, cint], y: cint, z: pointer,
a: var csize, b: pointer, c: int): cint {. a: var csize, b: pointer, c: int): cint {.
importc: "sysctl", header: "<sys/sysctl.h>".} importc: "sysctl", nodecl.}
proc countProcessors*(): int {.rtl, extern: "ncpi$1".} = proc countProcessors*(): int {.rtl, extern: "ncpi$1".} =
## returns the numer of the processors/cores the machine has. ## returns the numer of the processors/cores the machine has.

View file

@ -503,9 +503,9 @@ when haveZipLib:
else: n = c.outdir / n else: n = c.outdir / n
var z: TZipArchive var z: TZipArchive
if open(z, n, fmWrite): if open(z, n, fmWrite):
addFile(z, proj / buildBatFile32, buildBatFile32) addFile(z, proj / buildBatFile32, "build" / buildBatFile32)
addFile(z, proj / buildBatFile64, buildBatFile64) addFile(z, proj / buildBatFile64, "build" / buildBatFile64)
addFile(z, proj / buildShFile, buildShFile) addFile(z, proj / buildShFile, "build" / buildShFile)
addFile(z, proj / installShFile, installShFile) addFile(z, proj / installShFile, installShFile)
addFile(z, proj / deinstallShFile, deinstallShFile) addFile(z, proj / deinstallShFile, deinstallShFile)
for f in walkFiles(c.libpath / "lib/*.h"): for f in walkFiles(c.libpath / "lib/*.h"):
@ -513,7 +513,7 @@ when haveZipLib:
for osA in 1..c.oses.len: for osA in 1..c.oses.len:
for cpuA in 1..c.cpus.len: for cpuA in 1..c.cpus.len:
var dir = buildDir(osA, cpuA) 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) if k == pcFile: addFile(z, proj / dir / extractFilename(f), f)
for cat in items({fcConfig..fcOther, fcUnix}): for cat in items({fcConfig..fcOther, fcUnix}):

View file

@ -63,11 +63,6 @@ News
The modules that use ``importCpp`` or ``importObjc`` are compiled to C++ The modules that use ``importCpp`` or ``importObjc`` are compiled to C++
or Objective C code, any other module is compiled to C code. This or Objective C code, any other module is compiled to C code. This
improves interoperability. improves interoperability.
Language Additions
------------------
- There is a new ``parallel`` statement for safe fork&join parallel computing. - There is a new ``parallel`` statement for safe fork&join parallel computing.
- ``guard`` and ``lock`` pragmas have been implemented to support safer - ``guard`` and ``lock`` pragmas have been implemented to support safer
concurrent programming. concurrent programming.
@ -81,16 +76,23 @@ News
system.writeFile system.writeFile
Library Additions Language Additions
----------------- ------------------
- Added module ``cpuinfo``. - This version introduces the new ``deprecated`` pragma statement that is used
- Added module ``threadpool``. to handle the upcoming massive amount of symbol renames.
- ``sequtils.distnct`` has been renamed to ``sequtils.deduplicate``.
- Added ``algorithm.reversed``
- Added ``uri.combine`` and ``uri.parseUri``. Library Additions
- Some sockets procedures now support a ``SafeDisconn`` flag which causes -----------------
them to handle disconnection errors and not raise them.
- 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 2014-04-21 Version 0.9.4 released