summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2009-06-24 17:13:22 +0200
committerAndreas Rumpf <rumpf_a@web.de>2009-06-24 17:13:22 +0200
commit300430fbba28b408f7ac86ca46b03d9d50839399 (patch)
treeb8a84f8efdccda7bfa909b3db911d9e2b9a4b39b
parent36818817bd61594ea6d106328bb8df0f5a25cfc4 (diff)
downloadNim-300430fbba28b408f7ac86ca46b03d9d50839399.tar.gz
overload resolution for proc vars
-rw-r--r--data/ast.yml7
-rw-r--r--data/keywords.txt4
-rw-r--r--data/messages.yml38
-rw-r--r--doc/grammar.txt6
-rw-r--r--doc/manual.txt98
-rw-r--r--doc/theindex.txt72
-rw-r--r--doc/tut1.txt17
-rw-r--r--doc/tut2.txt13
-rw-r--r--install.txt4
-rw-r--r--koch.py4
-rw-r--r--lib/posix/posix.nim3679
-rw-r--r--lib/pure/macros.nim42
-rw-r--r--lib/pure/os.nim22
-rw-r--r--lib/pure/osproc.nim6
-rw-r--r--lib/pure/regexprs.nim22
-rw-r--r--lib/pure/streams.nim4
-rw-r--r--lib/pure/strutils.nim68
-rw-r--r--lib/system.nim70
-rw-r--r--lib/system/ansi_c.nim7
-rw-r--r--lib/system/arithm.nim6
-rw-r--r--lib/system/debugger.nim6
-rw-r--r--lib/system/sysio.nim20
-rw-r--r--lib/wrappers/mysql.nim4
-rw-r--r--nim/ast.pas110
-rw-r--r--nim/ccgexprs.pas29
-rw-r--r--nim/docgen.pas18
-rw-r--r--nim/evals.pas132
-rw-r--r--nim/importer.pas4
-rw-r--r--nim/lookups.pas48
-rw-r--r--nim/msgs.pas62
-rw-r--r--nim/nimsets.pas5
-rw-r--r--nim/pasparse.pas13
-rw-r--r--nim/pnimsyn.pas23
-rw-r--r--nim/pragmas.pas13
-rw-r--r--nim/rnimsyn.pas23
-rw-r--r--nim/ropes.pas5
-rw-r--r--nim/scanner.pas16
-rw-r--r--nim/sem.pas11
-rw-r--r--nim/semdata.pas4
-rw-r--r--nim/semexprs.pas162
-rw-r--r--nim/semstmts.pas41
-rw-r--r--nim/semtempl.pas57
-rw-r--r--nim/sigmatch.pas72
-rw-r--r--nim/strutils.pas11
-rw-r--r--nim/transf.pas22
-rw-r--r--nim/types.pas10
-rw-r--r--nim/wordrecg.pas20
-rw-r--r--pycompab.py10
-rw-r--r--tests/tambsym.nim4
-rw-r--r--tests/tambsym3.nim4
-rw-r--r--tests/tambsys.nim2
-rw-r--r--tests/tclosure.nim15
-rw-r--r--tests/tlibs.nim8
-rw-r--r--tests/tnoop.nim2
-rw-r--r--tools/niminst.nim15
-rw-r--r--tools/nimweb.nim12
56 files changed, 2772 insertions, 2430 deletions
diff --git a/data/ast.yml b/data/ast.yml
index 82776a8f9..cedc039a0 100644
--- a/data/ast.yml
+++ b/data/ast.yml
@@ -8,7 +8,7 @@
 #
 
 {
-'SymFlag': [          # already 28 flags!
+'SymFlag': [          # already 29 flags!
   'sfUsed',           # read access of sym (for warnings) or simply used
   'sfStar',           # symbol has * visibility
   'sfMinus',          # symbol has - visibility
@@ -27,6 +27,7 @@
   
   'sfResult',         # variable is 'result' in proc
   'sfNoSideEffect',   # proc has no side effects
+  'sfSideEffect',     # proc may have side effects; cannot prove it has none
   'sfMainModule',     # module is the main module
   'sfSystemModule',   # module is the system module
   'sfNoReturn',       # proc never returns (an exit proc)
@@ -47,6 +48,7 @@
 
 'TypeFlag': [
   'tfVarargs',        # procedure has C styled varargs
+  'tfNoSideEffect',   # procedure type does not allow side effects
   'tfFinal',          # is the object final?
   'tfAcyclic',        # type is acyclic (for GC optimization)
   'tfEnumHasWholes'   # enum cannot be mapped into a range
@@ -146,10 +148,11 @@
   'nkElseExpr',
   'nkLambda',             # lambda expression
   'nkAccQuoted',          # `a` as a node
-  'nkHeaderQuoted',       # `a(x: int)` as a node
 
   'nkTableConstr',        # a table constructor {expr: expr}
   'nkQualified',          # describes a.b for qualified identifiers
+  'nkBind',               # ``bind expr`` node
+  'nkSymChoice',          # symbol choice node
   'nkHiddenStdConv',      # an implicit standard type conversion
   'nkHiddenSubConv',      # an implicit type conversion from a subtype
                           # to a supertype
diff --git a/data/keywords.txt b/data/keywords.txt
index d6cba0635..5d20e8aeb 100644
--- a/data/keywords.txt
+++ b/data/keywords.txt
@@ -1,8 +1,8 @@
 abstract addr and as asm
-block break
+bind block break
 case cast const continue converter
 discard div
-elif else end enum except exception
+elif else end enum except
 finally for from generic
 if implies import in include is isnot iterator
 lambda
diff --git a/data/messages.yml b/data/messages.yml
index 5cbfe60a7..83f591e0f 100644
--- a/data/messages.yml
+++ b/data/messages.yml
@@ -36,19 +36,15 @@
 {'errNoneSpeedOrSizeExpected': "'none', 'speed' or 'size' expected"},
 {'errInvalidPragma': 'invalid pragma'},
 {'errUnknownPragma': "unknown pragma: '$1'"},
-{'errPragmaXHereNotAllowed': "pragma '$1' here not allowed"},
 {'errUnknownDirective': "unknown directive: '$1'"},
 {'errInvalidDirective': 'invalid directive'},
 {'errAtPopWithoutPush': "'pop' without a 'push' pragma"},
 {'errEmptyAsm': 'empty asm statement makes no sense'},
-{'errAsgnInvalidInExpr': "'=' invalid in an expression; probably '==' meant"},
 {'errInvalidIndentation': 'invalid indentation'},
 {'errExceptionExpected': 'exception expected'},
 {'errExceptionAlreadyHandled': 'exception already handled'},
-{'errReturnNotAllowedHere': "'return' only allowed in routine"},
 {'errYieldNotAllowedHere': "'yield' only allowed in a loop of an iterator"},
 {'errInvalidNumberOfYieldExpr': "invalid number of 'yield' expresions"},
-{'errReturnInvalidInIterator': "'return' not allowed in iterator"},
 {'errCannotReturnExpr': 'current routine cannot return an expression'},
 {'errAttemptToRedefine': "attempt to redefine '$1'"},
 {'errStmtInvalidAfterReturn':
@@ -78,21 +74,18 @@
 {'errColonOrEqualsExpected': "':' or '=' expected, but found '$1'"},
 {'errExprExpected': "expression expected, but found '$1'"},
 {'errUndeclaredIdentifier': "undeclared identifier: '$1'"},
-{'errUseQualifier': "ambigious identifier: '$1' -- use a qualifier"},
-{'errTwiceForwarded': "'$1' is forwarded twice"},
+{'errUseQualifier': "ambiguous identifier: '$1' -- use a qualifier"},
 {'errTypeExpected': 'type expected'},
 {'errSystemNeeds': "system module needs '$1'"},
 {'errExecutionOfProgramFailed': 'execution of an external program failed'},
-{'errNotOverloadable': "overloaded '$1' leads to ambigious calls"},
+{'errNotOverloadable': "overloaded '$1' leads to ambiguous calls"},
 {'errInvalidArgForX': "invalid argument for '$1'"},
 {'errStmtHasNoEffect': 'statement has no effect'},
 {'errXExpectsTypeOrValue': "'$1' expects a type or value"},
 {'errXExpectsArrayType': "'$1' expects an array type"},
 {'errIteratorCannotBeInstantiated':
   "'$1' cannot be instantiated because its body has not been compiled yet"},
-{'errExprWithNoTypeCannotBeConverted':
-  'expression with no type cannot be converted'},
-{'errExprWithNoTypeCannotBeCasted': 'expression with no type cannot be casted'},
+{'errExprXAmbiguous': "expression '$1' ambiguous in this context"},
 {'errConstantDivisionByZero': 'constant division by zero'},
 {'errOrdinalTypeExpected': 'ordinal type expected'},
 {'errOrdinalOrFloatTypeExpected': 'ordinal or float type expected'},
@@ -112,21 +105,17 @@
 {'errValueOutOfSetBounds': 'value out of set bounds'},
 {'errFieldInitTwice': "field initialized twice: '$1'"},
 {'errFieldNotInit': "field '$1' not initialized"},
-{'errExprCannotBeCalled': 'expression cannot be called'},
+{'errExprXCannotBeCalled': "expression '$1' cannot be called"},
 {'errExprHasNoType': 'expression has no type'},
-{'errExprXHasNoType': "expression '$1' has no type"},
+{'errExprXHasNoType': "expression '$1' has no type (or is ambiguous)"},
 {'errCastNotInSafeMode': "'cast' not allowed in safe mode"},
 {'errExprCannotBeCastedToX': 'expression cannot be casted to $1'},
-{'errUndefinedPrefixOpr': 'undefined prefix operator: $1'},
 {'errCommaOrParRiExpected': "',' or ')' expected"},
 {'errCurlyLeOrParLeExpected': "'{' or '(' expected"},
 {'errSectionExpected': "section ('type', 'proc', etc.) expected"},
-{'errImplemenationExpected': "'implementation' or end of file expected"},
 {'errRangeExpected': 'range expected'},
-{'errInvalidTypeDescription': 'invalid type description'},
 {'errAttemptToRedefineX': "attempt to redefine '$1'"},
 {'errMagicOnlyInSystem': "'magic' only allowed in system module"},
-{'errUnknownOperatorX': "unkown operator: '$1'"},
 {'errPowerOfTwoExpected': 'power of two expected'},
 {'errStringMayNotBeEmpty': 'string literal may not be empty'},
 {'errCallConvExpected': 'calling convention expected'},
@@ -165,9 +154,8 @@
 {'errTypeMismatch': 'type mismatch: got ('},
 {'errButExpected': 'but expected one of: '},
 {'errButExpectedX': "but expected '$1'"},
-{'errAmbigiousCallXYZ': 'ambigious call; both $1 and $2 match for: $3'},
+{'errAmbiguousCallXYZ': 'ambiguous call; both $1 and $2 match for: $3'},
 {'errWrongNumberOfTypeParams': 'wrong number of type parameters'},
-{'errOutParamNoDefaultValue': 'out parameters cannot have default values'},
 {'errInlineProcHasNoAddress': 'an inline proc has no address'},
 {'errXCannotBeInParamDecl': '$1 cannot be declared in parameter declaration'},
 {'errPragmaOnlyInHeaderOfProc':
@@ -177,22 +165,15 @@
 {'errNoSymbolToBorrowFromFound': "no symbol to borrow from found"},
 {'errDiscardValue': 'value returned by statement has to be discarded'},
 {'errInvalidDiscard': 'statement returns no value that can be discarded'},
-{'errUnknownPrecedence':
-  "unknown precedence for operator; use 'infix: prec' pragma"},
 {'errIllegalConvFromXtoY': 'conversion from $1 to $2 is invalid'},
-{'errTypeMismatchExpectedXGotY': "type mismatch: expected '$1', but got '$2'"},
 {'errCannotBindXTwice': "cannot bind parameter '$1' twice"},
 {'errInvalidOrderInEnumX': "invalid order in enum '$1'"},
 {'errEnumXHasWholes': "enum '$1' has wholes"},
 {'errExceptExpected': "'except' or 'finally' expected"},
 {'errInvalidTry': "after catch all 'except' or 'finally' no section may follow"},
-{'errEofExpectedButXFound': "end of file expected, but found token '$1'"},
 {'errOptionExpected': "option expected, but found '$1'"},
-{'errCannotEvaluateForwardConst': 'cannot evaluate forwarded constant'},
 {'errXisNoLabel': "'$1' is not a label"},
-{'errXNeedsConcreteType': "'$1' needs to be of a non-generic type"},
 {'errNotAllCasesCovered': 'not all cases are covered'},
-{'errStringRange': 'string range in case statement not allowed'},
 {'errUnkownSubstitionVar': "unknown substitution variable: '$1'"},
 {'errComplexStmtRequiresInd': 'complex statement requires indentation'},
 {'errXisNotCallable': "'$1' is not callable"},
@@ -204,7 +185,7 @@
 {'errNoReturnTypeForX': 'no return type for $1 allowed'},
 {'errConvNeedsOneArg': 'a type conversion needs exactly one argument'},
 {'errInvalidPragmaX': 'invalid pragma: $1'},
-{'errXNotAllowedHere': '$1 here not allowed'},
+{'errXNotAllowedHere': '$1 not allowed here'},
 {'errInvalidControlFlowX': 'invalid control flow: $1'},
 {'errATypeHasNoValue': 'a type has no value'},
 {'errXisNoType': "invalid type: '$1'"},
@@ -214,11 +195,11 @@
 {'errInvalidExpressionX': "invalid expression: '$1'"},
 {'errEnumHasNoValueX': "enum has no value '$1'"},
 {'errNamedExprExpected': 'named expression expected'},
-{'errNamedExprNotAllowed': 'named expression here not allowed'},
+{'errNamedExprNotAllowed': 'named expression not allowed here'},
 {'errXExpectsOneTypeParam': "'$1' expects one type parameter"},
 {'errArrayExpectsTwoTypeParams': 'array expects two type parameters'},
 {'errInvalidVisibilityX': "invalid invisibility: '$1'"},
-{'errInitHereNotAllowed': 'initialization here not allowed'},
+{'errInitHereNotAllowed': 'initialization not allowed here'},
 {'errXCannotBeAssignedTo': "'$1' cannot be assigned to"},
 {'errIteratorNotAllowed':
   "iterators can only be defined at the module's top level"},
@@ -254,6 +235,7 @@
 {'errUnhandledExceptionX': "unhandled exception: $1"},
 {'errCyclicTree': "macro returned a cyclic abstract syntax tree"},
 {'errXisNoMacroOrTemplate': "'$1' is no macro or template"},
+{'errXhasSideEffects': "'$1' can have side effects"},
 
 # user error message:
 {'errUser': '$1'},
diff --git a/doc/grammar.txt b/doc/grammar.txt
index 91ce6a911..8c3966387 100644
--- a/doc/grammar.txt
+++ b/doc/grammar.txt
@@ -29,8 +29,8 @@ addrExpr ::= 'addr' '(' optInd expr ')'
 symbol ::= '`' (KEYWORD | IDENT | operator | '(' ')'
                | '[' ']' | '=' | literal)+ '`'
          | IDENT
-primary ::= (prefixOperator optInd)* (symbol | constructor |
-                                      castExpr | addrExpr) (
+primary ::= ((prefixOperator | 'bind') optInd)* (symbol | constructor |
+                                                 castExpr | addrExpr) (
                '.' optInd symbol
              | '(' optInd namedExprList [SAD] ')'
              | '[' optInd
@@ -42,7 +42,7 @@ primary ::= (prefixOperator optInd)* (symbol | constructor |
 literal ::= INT_LIT | INT8_LIT | INT16_LIT | INT32_LIT | INT64_LIT
           | FLOAT_LIT | FLOAT32_LIT | FLOAT64_LIT
           | STR_LIT | RSTR_LIT | TRIPLESTR_LIT
-          | CHAR_LIT | RCHAR_LIT
+          | CHAR_LIT
           | NIL
 
 constructor ::= literal
diff --git a/doc/manual.txt b/doc/manual.txt
index 8b7e264ad..1c7eb01b7 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -336,7 +336,7 @@ Precedence level    Operators                                     First characte
 
 
 The grammar's start symbol is ``module``. The grammar is LL(1) and therefore
-not ambigious.
+not ambiguous.
 
 .. include:: grammar.txt
    :literal:
@@ -920,6 +920,95 @@ each other:
 Most calling conventions exist only for the Windows 32-bit platform.
 
 
+Type relations
+--------------
+
+The following section defines several relations on types that are needed to
+describe the type checking done by the compiler.
+
+
+Type equality
+~~~~~~~~~~~~~
+Nimrod uses structural type equivalence for most types. Only for objects,
+enumerations and abstract types name equivalence is used. The following
+algorithm determines type equality:
+
+.. code-block:: nimrod
+  proc typeEqualsAux(a, b: PType,
+                     s: var set[tuple[PType, PType]]): bool =
+    if (a,b) in s: return true
+    incl(s, (a,b))
+    if a.kind == b.kind: 
+      case a.kind
+      of int, intXX, float, floatXX, char, string, cstring, pointer, bool, nil:
+        # leaf type: kinds identical; nothing more to check
+        result = true
+      of ref, ptr, var, set, seq, openarray:
+        result = typeEqualsAux(a.baseType, b.baseType, s)
+      of range:
+        result = typeEqualsAux(a.baseType, b.baseType, s) and
+          (a.rangeA == b.rangeA) and (a.rangeB == b.rangeB)
+      of array:
+        result = typeEqualsAux(a.baseType, b.baseType, s) and
+                 typeEqualsAux(a.indexType, b.indexType, s)
+      of tuple:
+        if a.tupleLen == b.tupleLen:
+          for i in 0..a.tupleLen-1:
+            if not typeEqualsAux(a[i], b[i], s): return false
+          result = true
+      of object, enum, abstract:
+        result = a == b
+      of proc:
+        result = typeEqualsAux(a.parameterTuple, b.parameterTuple, s) and
+                 typeEqualsAux(a.resultType, b.resultType, s) and
+                 a.callingConvention == b.callingConvention
+
+  proc typeEquals(a, b: PType): bool =
+    var s: set[tuple[PType, PType]] = {}
+    result = typeEqualsAux(a, b, s)
+
+Since types are graphs which can have cycles, the above algorithm needs an
+auxiliary set ``s`` to detect this case.
+
+
+Subtype relation
+~~~~~~~~~~~~~~~~
+If object ``b`` inherits from ``a``, ``b`` is a subtype of ``a``. This subtype
+relation is extended to the types ``var``, ``ref``, ``ptr``:
+
+.. code-block:: nimrod
+  proc isSubtype(a, b: PType): bool = 
+    if a.kind == b.kind:
+      case a.kind
+      of object:
+        var aa = a.baseType
+        while aa != nil and aa != b: aa = aa.baseType
+        result = aa == b
+      of var, ref, ptr:
+        result = isSubtype(a.baseType, b.baseType)
+
+XXX nil is a special value!
+
+
+Convertible relation
+~~~~~~~~~~~~~~~~~~~~
+A type ``a`` is convertible to type ``b`` iff the following algorithm returns
+true:
+
+.. code-block:: nimrod
+  proc isConvertible(a, b: PType): bool =
+    if a.kind == b.kind:
+      case a.kind
+      of proc:
+        var x = a.parameterTuple
+        var y = b.parameterTuple
+        if x.tupleLen == y.tupleLen:
+          for i in 0.. x.tupleLen-1:
+            if not isSubtype(x[i], y[i]): return false
+          result = isSubType(b.resultType, a.resultType)
+
+
+
 
 Statements and expressions
 --------------------------
@@ -927,8 +1016,7 @@ Nimrod uses the common statement/expression paradigm: `Statements`:idx: do not
 produce a value in contrast to expressions. Call expressions are statements.
 If the called procedure returns a value, it is not a valid statement
 as statements do not produce values. To evaluate an expression for
-side-effects and throwing its value away, one can use the ``discard``
-statement.
+side-effects and throw its value away, one can use the ``discard`` statement.
 
 Statements are separated into `simple statements`:idx: and
 `complex statements`:idx:.
@@ -1917,11 +2005,11 @@ iterator in which case the overloading resolution takes place:
 
   # Module C
   import A, B
-  write(stdout, x) # error: x is ambigious
+  write(stdout, x) # error: x is ambiguous
   write(stdout, A.x) # no error: qualifier used
 
   var x = 4
-  write(stdout, x) # not ambigious: uses the module C's x
+  write(stdout, x) # not ambiguous: uses the module C's x
 
 
 Messages
diff --git a/doc/theindex.txt b/doc/theindex.txt
index b5650e1be..81bcf9c67 100644
--- a/doc/theindex.txt
+++ b/doc/theindex.txt
@@ -155,6 +155,9 @@ Index
      * `system.html#314 <system.html#314>`_
 
    `<=`:idx:
+     `times.html#115 <times.html#115>`_
+
+   `<=`:idx:
      * `system.html#253 <system.html#253>`_
      * `system.html#254 <system.html#254>`_
      * `system.html#255 <system.html#255>`_
@@ -169,9 +172,6 @@ Index
      * `system.html#345 <system.html#345>`_
      * `system.html#346 <system.html#346>`_
 
-   `<=`:idx:
-     `times.html#115 <times.html#115>`_
-
    `<=%`:idx:
      * `system.html#305 <system.html#305>`_
      * `system.html#306 <system.html#306>`_
@@ -201,7 +201,7 @@ Index
      * `macros.html#117 <macros.html#117>`_
 
    `=~`:idx:
-     `regexprs.html#111 <regexprs.html#111>`_
+     `regexprs.html#108 <regexprs.html#108>`_
 
    `>`:idx:
      `system.html#357 <system.html#357>`_
@@ -219,16 +219,16 @@ Index
      `system.html#365 <system.html#365>`_
 
    `[]`:idx:
-     `strtabs.html#107 <strtabs.html#107>`_
+     `macros.html#113 <macros.html#113>`_
 
    `[]`:idx:
-     `macros.html#113 <macros.html#113>`_
+     `strtabs.html#107 <strtabs.html#107>`_
 
    `[]=`:idx:
-     `macros.html#114 <macros.html#114>`_
+     `strtabs.html#106 <strtabs.html#106>`_
 
    `[]=`:idx:
-     `strtabs.html#106 <strtabs.html#106>`_
+     `macros.html#114 <macros.html#114>`_
 
    `[ESC]`:idx:
      `manual.html#134 <manual.html#134>`_
@@ -366,8 +366,7 @@ Index
      `xmlgen.html#111 <xmlgen.html#111>`_
 
    `backslash`:idx:
-     * `manual.html#127 <manual.html#127>`_
-     * `regexprs.html#101 <regexprs.html#101>`_
+     `manual.html#127 <manual.html#127>`_
 
    `backspace`:idx:
      `manual.html#132 <manual.html#132>`_
@@ -1228,7 +1227,7 @@ Index
      `system.html#156 <system.html#156>`_
 
    `EInvalidRegEx`:idx:
-     `regexprs.html#104 <regexprs.html#104>`_
+     `regexprs.html#101 <regexprs.html#101>`_
 
    `EInvalidValue`:idx:
      `system.html#148 <system.html#148>`_
@@ -1265,12 +1264,12 @@ Index
    `enum_cursor_type`:idx:
      `mysql.html#237 <mysql.html#237>`_
 
-   `Enumeration`:idx:
-     `manual.html#148 <manual.html#148>`_
-
    `enumeration`:idx:
      `tut1.html#113 <tut1.html#113>`_
 
+   `Enumeration`:idx:
+     `manual.html#148 <manual.html#148>`_
+
    `enum_field_types`:idx:
      `mysql.html#202 <mysql.html#202>`_
 
@@ -1546,8 +1545,8 @@ Index
      * `strutils.html#124 <strutils.html#124>`_
      * `strutils.html#125 <strutils.html#125>`_
      * `strutils.html#126 <strutils.html#126>`_
-     * `regexprs.html#109 <regexprs.html#109>`_
-     * `regexprs.html#110 <regexprs.html#110>`_
+     * `regexprs.html#106 <regexprs.html#106>`_
+     * `regexprs.html#107 <regexprs.html#107>`_
 
    `findChars`:idx:
      `strutils.html#123 <strutils.html#123>`_
@@ -1631,9 +1630,6 @@ Index
      * `system.html#478 <system.html#478>`_
      * `system.html#479 <system.html#479>`_
 
-   `generic character types`:idx:
-     `regexprs.html#102 <regexprs.html#102>`_
-
    `Generics`:idx:
      * `manual.html#207 <manual.html#207>`_
      * `tut2.html#108 <tut2.html#108>`_
@@ -2258,11 +2254,11 @@ Index
      `xmlgen.html#150 <xmlgen.html#150>`_
 
    `match`:idx:
-     * `regexprs.html#106 <regexprs.html#106>`_
-     * `regexprs.html#107 <regexprs.html#107>`_
+     * `regexprs.html#103 <regexprs.html#103>`_
+     * `regexprs.html#104 <regexprs.html#104>`_
 
    `matchLen`:idx:
-     `regexprs.html#108 <regexprs.html#108>`_
+     `regexprs.html#105 <regexprs.html#105>`_
 
    `math`:idx:
      `nimrodc.html#118 <nimrodc.html#118>`_
@@ -2301,7 +2297,7 @@ Index
      `mysql.html#191 <mysql.html#191>`_
 
    `MaxSubpatterns`:idx:
-     `regexprs.html#105 <regexprs.html#105>`_
+     `regexprs.html#102 <regexprs.html#102>`_
 
    `MAX_TINYINT_WIDTH`:idx:
      `mysql.html#190 <mysql.html#190>`_
@@ -3095,12 +3091,12 @@ Index
    `ord`:idx:
      `system.html#172 <system.html#172>`_
 
-   `ordinal`:idx:
-     `tut1.html#114 <tut1.html#114>`_
-
    `Ordinal`:idx:
      `system.html#114 <system.html#114>`_
 
+   `ordinal`:idx:
+     `tut1.html#114 <tut1.html#114>`_
+
    `Ordinal types`:idx:
      `manual.html#141 <manual.html#141>`_
 
@@ -3623,16 +3619,16 @@ Index
      `system.html#419 <system.html#419>`_
 
    `reBinary`:idx:
-     `regexprs.html#116 <regexprs.html#116>`_
+     `regexprs.html#113 <regexprs.html#113>`_
 
    `Recursive module dependancies`:idx:
      `manual.html#216 <manual.html#216>`_
 
    `reEmail`:idx:
-     `regexprs.html#119 <regexprs.html#119>`_
+     `regexprs.html#116 <regexprs.html#116>`_
 
    `reFloat`:idx:
-     `regexprs.html#118 <regexprs.html#118>`_
+     `regexprs.html#115 <regexprs.html#115>`_
 
    `REFRESH_DES_KEY_FILE`:idx:
      `mysql.html#154 <mysql.html#154>`_
@@ -3680,13 +3676,13 @@ Index
      `nimrodc.html#112 <nimrodc.html#112>`_
 
    `reHex`:idx:
-     `regexprs.html#115 <regexprs.html#115>`_
+     `regexprs.html#112 <regexprs.html#112>`_
 
    `reIdentifier`:idx:
-     `regexprs.html#112 <regexprs.html#112>`_
+     `regexprs.html#109 <regexprs.html#109>`_
 
    `reInteger`:idx:
-     `regexprs.html#114 <regexprs.html#114>`_
+     `regexprs.html#111 <regexprs.html#111>`_
 
    `removeDir`:idx:
      `os.html#150 <os.html#150>`_
@@ -3695,10 +3691,10 @@ Index
      `os.html#141 <os.html#141>`_
 
    `reNatural`:idx:
-     `regexprs.html#113 <regexprs.html#113>`_
+     `regexprs.html#110 <regexprs.html#110>`_
 
    `reOctal`:idx:
-     `regexprs.html#117 <regexprs.html#117>`_
+     `regexprs.html#114 <regexprs.html#114>`_
 
    `repeatChar`:idx:
      `strutils.html#148 <strutils.html#148>`_
@@ -3724,7 +3720,7 @@ Index
      `manual.html#189 <manual.html#189>`_
 
    `reURL`:idx:
-     `regexprs.html#120 <regexprs.html#120>`_
+     `regexprs.html#117 <regexprs.html#117>`_
 
    `round`:idx:
      `math.html#121 <math.html#121>`_
@@ -3889,9 +3885,6 @@ Index
      * `system.html#226 <system.html#226>`_
      * `system.html#227 <system.html#227>`_
 
-   `simple assertions`:idx:
-     `regexprs.html#103 <regexprs.html#103>`_
-
    `simple statements`:idx:
      `manual.html#174 <manual.html#174>`_
 
@@ -5154,6 +5147,9 @@ Index
      * `manual.html#156 <manual.html#156>`_
      * `tut2.html#103 <tut2.html#103>`_
 
+   `verbose`:idx:
+     `regexprs.html#118 <regexprs.html#118>`_
+
    `vertical tabulator`:idx:
      `manual.html#126 <manual.html#126>`_
 
diff --git a/doc/tut1.txt b/doc/tut1.txt
index 237663cdc..bf744b885 100644
--- a/doc/tut1.txt
+++ b/doc/tut1.txt
@@ -264,7 +264,7 @@ For integers or other ordinal types value ranges are also possible:
 However, the above code does not compile: The reason is that you have to cover
 every value that ``n`` may contain, but the code only handles the values
 ``0..8``. Since it is not very practical to list every other possible integer
-(though it is possible thanks to the range notation!), we fix this by telling
+(though it is possible thanks to the range notation), we fix this by telling
 the compiler that for every other value nothing should be done:
 
 .. code-block:: nimrod
@@ -624,7 +624,8 @@ Nimrod provides the ability to overload procedures similar to C++:
 .. code-block:: nimrod
   proc toString(x: int): string = ...
   proc toString(x: bool): string =
-    if x: return "true" else: return "false"
+    if x: return "true" 
+    else: return "false"
 
   Echo(toString(13))   # calls the toString(x: int) proc
   Echo(toString(true)) # calls the toString(x: bool) proc
@@ -634,7 +635,7 @@ The compiler chooses the most appropriate proc for the ``toString`` calls. How
 this overloading resolution algorithm works exactly is not discussed here
 (it will be specified in the manual soon).
 However, it does not lead to nasty suprises and is based on a quite simple
-unification algorithm. Ambigious calls are reported as errors.
+unification algorithm. Ambiguous calls are reported as errors.
 
 
 Operators
@@ -643,7 +644,7 @@ The Nimrod library makes heavy use of overloading - one reason for this is that
 each operator like ``+`` is a just an overloaded proc. The parser lets you
 use operators in `infix notation` (``a + b``) or `prefix notation` (``+ a``).
 An infix operator always receives two arguments, a prefix operator always one.
-Postfix operators are not possible, because this would be ambigious: Does
+Postfix operators are not possible, because this would be ambiguous: Does
 ``a @ @ b`` mean ``(a) @ (@b)`` or ``(a@) @ (b)``? It always means
 ``(a) @ (@b)``, because there are no postfix operators in Nimrod.
 
@@ -1331,7 +1332,7 @@ This is best illustrated by an example:
 
 
 A symbol of a module *can* be *qualified* with the ``module.symbol`` syntax. If
-the symbol is ambigious, it even *has* to be qualified. A symbol is ambigious 
+the symbol is ambiguous, it even *has* to be qualified. A symbol is ambiguous 
 if it is defined in two (or more) different modules and both modules are 
 imported by a third one: 
 
@@ -1344,11 +1345,11 @@ imported by a third one:
 
   # Module C
   import A, B
-  write(stdout, x) # error: x is ambigious
+  write(stdout, x) # error: x is ambiguous
   write(stdout, A.x) # no error: qualifier used
 
   var x = 4
-  write(stdout, x) # not ambigious: uses the module C's x
+  write(stdout, x) # not ambiguous: uses the module C's x
 
 
 But this rule does not apply to procedures or iterators. Here the overloading
@@ -1367,7 +1368,7 @@ rules apply:
   write(stdout, x(""))  # no error: B.x is called
 
   proc x*(a: int): string = nil
-  write(stdout, x(3))   # ambigious: which `x` is to call?
+  write(stdout, x(3))   # ambiguous: which `x` is to call?
 
 
 From statement
diff --git a/doc/tut2.txt b/doc/tut2.txt
index bb0949659..df6cc1b51 100644
--- a/doc/tut2.txt
+++ b/doc/tut2.txt
@@ -34,7 +34,7 @@ While Nimrod's support for object oriented programming (OOP) is minimalistic,
 powerful OOP technics can be used. OOP is seen as *one* way to design a 
 program, not *the only* way. Often a procedural approach leads to simpler
 and more efficient code. In particular, prefering aggregation over inheritance
-often results in a better design.
+is often the better design.
 
 
 Objects
@@ -446,8 +446,7 @@ containers:
     # this uses an explicit stack (which is more efficient anyway):
     var stack: seq[PBinaryTree[T]] = @[root]
     while stack.len > 0:
-      var n = stack[stack.len-1]
-      setLen(stack, stack.len-1) # pop `n` of the stack
+      var n = stack.pop()
       while n != nil:
         yield n
         add(stack, n.ri)  # push right subtree onto the stack
@@ -562,11 +561,11 @@ via a special ``:`` syntax:
     block:
       var fn = filename
       var f: TFile
-      if openFile(f, fn, mode):
+      if open(f, fn, mode):
         try:
           actions
         finally:
-          closeFile(f)
+          close(f)
       else:
         quit("cannot open: " & fn)
       
@@ -593,9 +592,7 @@ Macros enable advanced compile-time code tranformations, but they
 cannot change Nimrod's syntax. However, this is no real restriction because
 Nimrod's syntax is flexible enough anyway. 
 
-`Macros`:idx: can be used to implement `domain specific languages`:idx:. 
-
-To write macros, one needs to know how the Nimrod concrete syntax is converted
+To write a macro, one needs to know how the Nimrod concrete syntax is converted
 to an abstract syntax tree (AST). The AST is documented in the 
 `macros <macros.html>`_ module.
 
diff --git a/install.txt b/install.txt
index 520b39935..d06236e24 100644
--- a/install.txt
+++ b/install.txt
@@ -66,6 +66,4 @@ Currently, the following C compilers are supported under Windows:
 - | Digital Mars C++
   | http://www.digitalmars.com/download/freecompiler.html
 
-For better compile times I recommend Digital Mars C++ -- it is easy to install
-and a small package.
-
+However, most testing is done with GCC.
diff --git a/koch.py b/koch.py
index 364a71d8a..593ee4984 100644
--- a/koch.py
+++ b/koch.py
@@ -253,8 +253,8 @@ class Changed:
       c = Changed("unique_name", "file1.pas file2.pas file3.pas")
       if c.check():
         Exec("fpc file1.pas")
-        # Exec raises an exception if it fails, thus if we get to here, it was
-        # a success:
+        # Exec raises an exception if it fails, thus if we reach the 
+        # next statement, it was a success:
         c.success()
   """
   def __init__(self, id, files, explain=false,
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index 42cbbba75..5c8103b9a 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -1,408 +1,408 @@
-#

-#

-#            Nimrod's Runtime Library

-#        (c) Copyright 2009 Andreas Rumpf

-#

-#    See the file "copying.txt", included in this

-#    distribution, for details about the copyright.

-#

-

-# Until std_arg!!

-# done: ipc, pwd, stat, semaphore, sys/types, sys/utsname, pthread, unistd,

+#
+#
+#            Nimrod's Runtime Library
+#        (c) Copyright 2009 Andreas Rumpf
+#
+#    See the file "copying.txt", included in this
+#    distribution, for details about the copyright.
+#
+
+# Until std_arg!!
+# done: ipc, pwd, stat, semaphore, sys/types, sys/utsname, pthread, unistd,
 # statvfs, mman, time, wait, signal, nl_types, sched, spawn, select, ucontext,
-# net/if, sys/socket, sys/uio, netinet/in, netinet/tcp, netdb

-

-## This is a raw POSIX interface module. It does not not provide any

-## convenience: cstrings are used instead of proper Nimrod strings and

-## return codes indicate errors. If you want exceptions 

-## and a proper Nimrod-like interface, use the OS module or write a wrapper.

-

-## Coding conventions:

-## ALL types are named the same as in the POSIX standard except that they start

-## with 'T' or 'P' (if they are pointers) and without the '_t' prefix to be

-## consistent with Nimrod conventions. If an identifier is a Nimrod keyword

-## the \`identifier\` notation is used.

-##

-## This library relies on the header files of your C compiler. Thus the

-## resulting C code will just include <XYZ.h> and *not* define the

-## symbols declared here.

+# net/if, sys/socket, sys/uio, netinet/in, netinet/tcp, netdb
+
+## This is a raw POSIX interface module. It does not not provide any
+## convenience: cstrings are used instead of proper Nimrod strings and
+## return codes indicate errors. If you want exceptions 
+## and a proper Nimrod-like interface, use the OS module or write a wrapper.
+
+## Coding conventions:
+## ALL types are named the same as in the POSIX standard except that they start
+## with 'T' or 'P' (if they are pointers) and without the '_t' prefix to be
+## consistent with Nimrod conventions. If an identifier is a Nimrod keyword
+## the \`identifier\` notation is used.
+##
+## This library relies on the header files of your C compiler. Thus the
+## resulting C code will just include <XYZ.h> and *not* define the
+## symbols declared here.
 
 from times import TTime
-

-const

-  hasSpawnH = defined(linux)

-  hasAioH = defined(linux)

-
-when false:

-  const

-    C_IRUSR = 0c000400 ## Read by owner.

-    C_IWUSR = 0c000200 ## Write by owner.

-    C_IXUSR = 0c000100 ## Execute by owner.

-    C_IRGRP = 0c000040 ## Read by group.

-    C_IWGRP = 0c000020 ## Write by group.

-    C_IXGRP = 0c000010 ## Execute by group.

-    C_IROTH = 0c000004 ## Read by others.

-    C_IWOTH = 0c000002 ## Write by others.

-    C_IXOTH = 0c000001 ## Execute by others.

-    C_ISUID = 0c004000 ## Set user ID.

-    C_ISGID = 0c002000 ## Set group ID.

-    C_ISVTX = 0c001000 ## On directories, restricted deletion flag.

-    C_ISDIR = 0c040000 ## Directory.

-    C_ISFIFO = 0c010000 ##FIFO.

-    C_ISREG = 0c100000 ## Regular file.

-    C_ISBLK = 0c060000 ## Block special.

-    C_ISCHR = 0c020000 ## Character special.

-    C_ISCTG = 0c110000 ## Reserved.

-    C_ISLNK = 0c120000 ## Symbolic link.</p>

-    C_ISSOCK = 0c140000 ## Socket.

-
-const

-  MM_NULLLBL* = nil

-  MM_NULLSEV* = 0

-  MM_NULLMC* = 0

-  MM_NULLTXT* = nil

-  MM_NULLACT* = nil

-  MM_NULLTAG* = nil

-  

-  STDERR_FILENO* = 2 ## File number of stderr;

-  STDIN_FILENO* = 0  ## File number of stdin;

-  STDOUT_FILENO* = 1 ## File number of stdout; 

-

-type

-  TDIR* {.importc: "DIR", header: "<dirent.h>", final, pure.} = object

-    ## A type representing a directory stream. 

-

+
+const
+  hasSpawnH = defined(linux)
+  hasAioH = defined(linux)
+
+when false:
+  const
+    C_IRUSR = 0c000400 ## Read by owner.
+    C_IWUSR = 0c000200 ## Write by owner.
+    C_IXUSR = 0c000100 ## Execute by owner.
+    C_IRGRP = 0c000040 ## Read by group.
+    C_IWGRP = 0c000020 ## Write by group.
+    C_IXGRP = 0c000010 ## Execute by group.
+    C_IROTH = 0c000004 ## Read by others.
+    C_IWOTH = 0c000002 ## Write by others.
+    C_IXOTH = 0c000001 ## Execute by others.
+    C_ISUID = 0c004000 ## Set user ID.
+    C_ISGID = 0c002000 ## Set group ID.
+    C_ISVTX = 0c001000 ## On directories, restricted deletion flag.
+    C_ISDIR = 0c040000 ## Directory.
+    C_ISFIFO = 0c010000 ##FIFO.
+    C_ISREG = 0c100000 ## Regular file.
+    C_ISBLK = 0c060000 ## Block special.
+    C_ISCHR = 0c020000 ## Character special.
+    C_ISCTG = 0c110000 ## Reserved.
+    C_ISLNK = 0c120000 ## Symbolic link.</p>
+    C_ISSOCK = 0c140000 ## Socket.
+
+const
+  MM_NULLLBL* = nil
+  MM_NULLSEV* = 0
+  MM_NULLMC* = 0
+  MM_NULLTXT* = nil
+  MM_NULLACT* = nil
+  MM_NULLTAG* = nil
+  
+  STDERR_FILENO* = 2 ## File number of stderr;
+  STDIN_FILENO* = 0  ## File number of stdin;
+  STDOUT_FILENO* = 1 ## File number of stdout; 
+
+type
+  TDIR* {.importc: "DIR", header: "<dirent.h>", final, pure.} = object
+    ## A type representing a directory stream. 
+
   Tdirent* {.importc: "struct dirent", 
-             header: "<dirent.h>", final, pure.} = object ## dirent_t struct

-    d_ino*: TIno  ## File serial number.

-    d_name*: array [0..255, char] ## Name of entry.

-

+             header: "<dirent.h>", final, pure.} = object ## dirent_t struct
+    d_ino*: TIno  ## File serial number.
+    d_name*: array [0..255, char] ## Name of entry.
+
   Tflock* {.importc: "flock", final, pure,
-            header: "<fcntl.h>".} = object ## flock type

-    l_type*: cshort   ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. 

-    l_whence*: cshort ## Flag for starting offset. 

-    l_start*: Toff    ## Relative offset in bytes. 

-    l_len*: Toff      ## Size; if 0 then until EOF. 

-    l_pid*: TPid      ## Process ID of the process holding the lock; 

-                      ## returned with F_GETLK. 

-  

-  Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final, pure.} = 

-    object ## Represents the entire floating-point environment. The

-           ## floating-point environment refers collectively to any

-           ## floating-point status flags and control modes supported

-           ## by the implementation.

-  Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final, pure.} = 

-    object ## Represents the floating-point status flags collectively, 

-           ## including any status the implementation associates with the 

-           ## flags. A floating-point status flag is a system variable 

-           ## whose value is set (but never cleared) when a floating-point

-           ## exception is raised, which occurs as a side effect of

-           ## exceptional floating-point arithmetic to provide auxiliary

-           ## information. A floating-point control mode is a system variable

-           ## whose value may be set by the user to affect the subsequent 

-           ## behavior of floating-point arithmetic.

-

-  TFTW* {.importc: "struct FTW", header: "<ftw.h>", final, pure.} = object

-    base*: cint

-    level*: cint

-    

+            header: "<fcntl.h>".} = object ## flock type
+    l_type*: cshort   ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. 
+    l_whence*: cshort ## Flag for starting offset. 
+    l_start*: Toff    ## Relative offset in bytes. 
+    l_len*: Toff      ## Size; if 0 then until EOF. 
+    l_pid*: TPid      ## Process ID of the process holding the lock; 
+                      ## returned with F_GETLK. 
+  
+  Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final, pure.} = 
+    object ## Represents the entire floating-point environment. The
+           ## floating-point environment refers collectively to any
+           ## floating-point status flags and control modes supported
+           ## by the implementation.
+  Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final, pure.} = 
+    object ## Represents the floating-point status flags collectively, 
+           ## including any status the implementation associates with the 
+           ## flags. A floating-point status flag is a system variable 
+           ## whose value is set (but never cleared) when a floating-point
+           ## exception is raised, which occurs as a side effect of
+           ## exceptional floating-point arithmetic to provide auxiliary
+           ## information. A floating-point control mode is a system variable
+           ## whose value may be set by the user to affect the subsequent 
+           ## behavior of floating-point arithmetic.
+
+  TFTW* {.importc: "struct FTW", header: "<ftw.h>", final, pure.} = object
+    base*: cint
+    level*: cint
+    
   TGlob* {.importc: "glob_t", header: "<glob.h>", 
-           final, pure.} = object ## glob_t

-    gl_pathc*: int          ## Count of paths matched by pattern. 

-    gl_pathv*: cstringArray ## Pointer to a list of matched pathnames. 

-    gl_offs*: int           ## Slots to reserve at the beginning of gl_pathv. 

-  

+           final, pure.} = object ## glob_t
+    gl_pathc*: int          ## Count of paths matched by pattern. 
+    gl_pathv*: cstringArray ## Pointer to a list of matched pathnames. 
+    gl_offs*: int           ## Slots to reserve at the beginning of gl_pathv. 
+  
   TGroup* {.importc: "struct group", header: "<grp.h>", 
-            final, pure.} = object ## struct group

-    gr_name*: cstring     ## The name of the group. 

-    gr_gid*: TGid         ## Numerical group ID. 

-    gr_mem*: cstringArray ## Pointer to a null-terminated array of character 

-                          ## pointers to member names. 

-

-  Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final, pure.} = 

-    object ## Identifies the conversion from one codeset to another.

-

-  Tlconv* {.importc: "struct lconv", header: "<locale.h>", final, pure.} = object

-    currency_symbol*: cstring

-    decimal_point*: cstring

-    frac_digits*: char

-    grouping*: cstring

-    int_curr_symbol*: cstring

-    int_frac_digits*: char

-    int_n_cs_precedes*: char

-    int_n_sep_by_space*: char

-    int_n_sign_posn*: char

-    int_p_cs_precedes*: char

-    int_p_sep_by_space*: char

-    int_p_sign_posn*: char

-    mon_decimal_point*: cstring

-    mon_grouping*: cstring

-    mon_thousands_sep*: cstring

-    negative_sign*: cstring

-    n_cs_precedes*: char

-    n_sep_by_space*: char

-    n_sign_posn*: char

-    positive_sign*: cstring

-    p_cs_precedes*: char

-    p_sep_by_space*: char

-    p_sign_posn*: char

-    thousands_sep*: cstring

-

-  TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final, pure.} = object

+            final, pure.} = object ## struct group
+    gr_name*: cstring     ## The name of the group. 
+    gr_gid*: TGid         ## Numerical group ID. 
+    gr_mem*: cstringArray ## Pointer to a null-terminated array of character 
+                          ## pointers to member names. 
+
+  Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final, pure.} = 
+    object ## Identifies the conversion from one codeset to another.
+
+  Tlconv* {.importc: "struct lconv", header: "<locale.h>", final, pure.} = object
+    currency_symbol*: cstring
+    decimal_point*: cstring
+    frac_digits*: char
+    grouping*: cstring
+    int_curr_symbol*: cstring
+    int_frac_digits*: char
+    int_n_cs_precedes*: char
+    int_n_sep_by_space*: char
+    int_n_sign_posn*: char
+    int_p_cs_precedes*: char
+    int_p_sep_by_space*: char
+    int_p_sign_posn*: char
+    mon_decimal_point*: cstring
+    mon_grouping*: cstring
+    mon_thousands_sep*: cstring
+    negative_sign*: cstring
+    n_cs_precedes*: char
+    n_sep_by_space*: char
+    n_sign_posn*: char
+    positive_sign*: cstring
+    p_cs_precedes*: char
+    p_sep_by_space*: char
+    p_sign_posn*: char
+    thousands_sep*: cstring
+
+  TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final, pure.} = object
   TMqAttr* {.importc: "struct mq_attr", 
              header: "<mqueue.h>", 
-             final, pure.} = object ## message queue attribute

-    mq_flags*: int   ## Message queue flags. 

-    mq_maxmsg*: int  ## Maximum number of messages. 

-    mq_msgsize*: int ## Maximum message size. 

-    mq_curmsgs*: int ## Number of messages currently queued. 

-

+             final, pure.} = object ## message queue attribute
+    mq_flags*: int   ## Message queue flags. 
+    mq_maxmsg*: int  ## Maximum number of messages. 
+    mq_msgsize*: int ## Maximum message size. 
+    mq_curmsgs*: int ## Number of messages currently queued. 
+
   TPasswd* {.importc: "struct passwd", header: "<pwd.h>", 
-             final, pure.} = object ## struct passwd

-    pw_name*: cstring   ## User's login name. 

-    pw_uid*: TUid       ## Numerical user ID. 

-    pw_gid*: TGid       ## Numerical group ID. 

-    pw_dir*: cstring    ## Initial working directory. 

-    pw_shell*: cstring  ## Program to use as shell. 

-

-  Tblkcnt* {.importc: "blkcnt_t", header: "<sys/types.h>".} = int

-    ## used for file block counts

-  Tblksize* {.importc: "blksize_t", header: "<sys/types.h>".} = int

-    ## used for block sizes

-  TClock* {.importc: "clock_t", header: "<sys/types.h>".} = int

-  TClockId* {.importc: "clockid_t", header: "<sys/types.h>".} = int

-  TDev* {.importc: "dev_t", header: "<sys/types.h>".} = int

-  Tfsblkcnt* {.importc: "fsblkcnt_t", header: "<sys/types.h>".} = int

-  Tfsfilcnt* {.importc: "fsfilcnt_t", header: "<sys/types.h>".} = int

-  TGid* {.importc: "gid_t", header: "<sys/types.h>".} = int

-  Tid* {.importc: "id_t", header: "<sys/types.h>".} = int

-  Tino* {.importc: "ino_t", header: "<sys/types.h>".} = int

-  TKey* {.importc: "key_t", header: "<sys/types.h>".} = int

-  TMode* {.importc: "mode_t", header: "<sys/types.h>".} = int

-  TNlink* {.importc: "nlink_t", header: "<sys/types.h>".} = int

-  TOff* {.importc: "off_t", header: "<sys/types.h>".} = int64

-  TPid* {.importc: "pid_t", header: "<sys/types.h>".} = int

-  Tpthread_attr* {.importc: "pthread_attr_t", header: "<sys/types.h>".} = int

+             final, pure.} = object ## struct passwd
+    pw_name*: cstring   ## User's login name. 
+    pw_uid*: TUid       ## Numerical user ID. 
+    pw_gid*: TGid       ## Numerical group ID. 
+    pw_dir*: cstring    ## Initial working directory. 
+    pw_shell*: cstring  ## Program to use as shell. 
+
+  Tblkcnt* {.importc: "blkcnt_t", header: "<sys/types.h>".} = int
+    ## used for file block counts
+  Tblksize* {.importc: "blksize_t", header: "<sys/types.h>".} = int
+    ## used for block sizes
+  TClock* {.importc: "clock_t", header: "<sys/types.h>".} = int
+  TClockId* {.importc: "clockid_t", header: "<sys/types.h>".} = int
+  TDev* {.importc: "dev_t", header: "<sys/types.h>".} = int
+  Tfsblkcnt* {.importc: "fsblkcnt_t", header: "<sys/types.h>".} = int
+  Tfsfilcnt* {.importc: "fsfilcnt_t", header: "<sys/types.h>".} = int
+  TGid* {.importc: "gid_t", header: "<sys/types.h>".} = int
+  Tid* {.importc: "id_t", header: "<sys/types.h>".} = int
+  Tino* {.importc: "ino_t", header: "<sys/types.h>".} = int
+  TKey* {.importc: "key_t", header: "<sys/types.h>".} = int
+  TMode* {.importc: "mode_t", header: "<sys/types.h>".} = int
+  TNlink* {.importc: "nlink_t", header: "<sys/types.h>".} = int
+  TOff* {.importc: "off_t", header: "<sys/types.h>".} = int64
+  TPid* {.importc: "pid_t", header: "<sys/types.h>".} = int
+  Tpthread_attr* {.importc: "pthread_attr_t", header: "<sys/types.h>".} = int
   Tpthread_barrier* {.importc: "pthread_barrier_t", 
-                      header: "<sys/types.h>".} = int

+                      header: "<sys/types.h>".} = int
   Tpthread_barrierattr* {.importc: "pthread_barrierattr_t", 
-                          header: "<sys/types.h>".} = int

-  Tpthread_cond* {.importc: "pthread_cond_t", header: "<sys/types.h>".} = int

+                          header: "<sys/types.h>".} = int
+  Tpthread_cond* {.importc: "pthread_cond_t", header: "<sys/types.h>".} = int
   Tpthread_condattr* {.importc: "pthread_condattr_t", 
-                       header: "<sys/types.h>".} = int

-  Tpthread_key* {.importc: "pthread_key_t", header: "<sys/types.h>".} = int

-  Tpthread_mutex* {.importc: "pthread_mutex_t", header: "<sys/types.h>".} = int

+                       header: "<sys/types.h>".} = int
+  Tpthread_key* {.importc: "pthread_key_t", header: "<sys/types.h>".} = int
+  Tpthread_mutex* {.importc: "pthread_mutex_t", header: "<sys/types.h>".} = int
   Tpthread_mutexattr* {.importc: "pthread_mutexattr_t", 
-                        header: "<sys/types.h>".} = int

-  Tpthread_once* {.importc: "pthread_once_t", header: "<sys/types.h>".} = int

-  Tpthread_rwlock* {.importc: "pthread_rwlock_t", header: "<sys/types.h>".} = int

+                        header: "<sys/types.h>".} = int
+  Tpthread_once* {.importc: "pthread_once_t", header: "<sys/types.h>".} = int
+  Tpthread_rwlock* {.importc: "pthread_rwlock_t", header: "<sys/types.h>".} = int
   Tpthread_rwlockattr* {.importc: "pthread_rwlockattr_t", 
-                         header: "<sys/types.h>".} = int

+                         header: "<sys/types.h>".} = int
   Tpthread_spinlock* {.importc: "pthread_spinlock_t", 
-                       header: "<sys/types.h>".} = int

-  Tpthread* {.importc: "pthread_t", header: "<sys/types.h>".} = int

-  Tsuseconds* {.importc: "suseconds_t", header: "<sys/types.h>".} = int

-  #Ttime* {.importc: "time_t", header: "<sys/types.h>".} = int

-  Ttimer* {.importc: "timer_t", header: "<sys/types.h>".} = int

-  Ttrace_attr* {.importc: "trace_attr_t", header: "<sys/types.h>".} = int

+                       header: "<sys/types.h>".} = int
+  Tpthread* {.importc: "pthread_t", header: "<sys/types.h>".} = int
+  Tsuseconds* {.importc: "suseconds_t", header: "<sys/types.h>".} = int
+  #Ttime* {.importc: "time_t", header: "<sys/types.h>".} = int
+  Ttimer* {.importc: "timer_t", header: "<sys/types.h>".} = int
+  Ttrace_attr* {.importc: "trace_attr_t", header: "<sys/types.h>".} = int
   Ttrace_event_id* {.importc: "trace_event_id_t", 
-                     header: "<sys/types.h>".} = int

+                     header: "<sys/types.h>".} = int
   Ttrace_event_set* {.importc: "trace_event_set_t", 
-                      header: "<sys/types.h>".} = int

-  Ttrace_id* {.importc: "trace_id_t", header: "<sys/types.h>".} = int

-  Tuid* {.importc: "uid_t", header: "<sys/types.h>".} = int

-  Tuseconds* {.importc: "useconds_t", header: "<sys/types.h>".} = int

-  

+                      header: "<sys/types.h>".} = int
+  Ttrace_id* {.importc: "trace_id_t", header: "<sys/types.h>".} = int
+  Tuid* {.importc: "uid_t", header: "<sys/types.h>".} = int
+  Tuseconds* {.importc: "useconds_t", header: "<sys/types.h>".} = int
+  
   Tutsname* {.importc: "struct utsname", 
               header: "<sys/utsname.h>", 
-              final, pure.} = object ## struct utsname

-    sysname*,      ## Name of this implementation of the operating system. 

-      nodename*,   ## Name of this node within the communications 

-                   ## network to which this node is attached, if any. 

-      release*,    ## Current release level of this implementation. 

-      version*,    ## Current version level of this release. 

-      machine*: array [0..255, char] ## Name of the hardware type on which the

-                                     ## system is running. 

-

-  TSem* {.importc: "sem_t", header: "<semaphore.h>", final, pure.} = object

+              final, pure.} = object ## struct utsname
+    sysname*,      ## Name of this implementation of the operating system. 
+      nodename*,   ## Name of this node within the communications 
+                   ## network to which this node is attached, if any. 
+      release*,    ## Current release level of this implementation. 
+      version*,    ## Current version level of this release. 
+      machine*: array [0..255, char] ## Name of the hardware type on which the
+                                     ## system is running. 
+
+  TSem* {.importc: "sem_t", header: "<semaphore.h>", final, pure.} = object
   Tipc_perm* {.importc: "struct ipc_perm", 
-               header: "<sys/ipc.h>", final, pure.} = object ## struct ipc_perm

-    uid*: tuid    ## Owner's user ID. 

-    gid*: tgid    ## Owner's group ID. 

-    cuid*: Tuid   ## Creator's user ID. 

-    cgid*: Tgid   ## Creator's group ID. 

-    mode*: TMode  ## Read/write permission. 

-  

+               header: "<sys/ipc.h>", final, pure.} = object ## struct ipc_perm
+    uid*: tuid    ## Owner's user ID. 
+    gid*: tgid    ## Owner's group ID. 
+    cuid*: Tuid   ## Creator's user ID. 
+    cgid*: Tgid   ## Creator's group ID. 
+    mode*: TMode  ## Read/write permission. 
+  
   TStat* {.importc: "struct stat", 
-           header: "<sys/stat.h>", final, pure.} = object ## struct stat

-    st_dev*: TDev          ## Device ID of device containing file. 

-    st_ino*: TIno          ## File serial number. 

-    st_mode*: TMode        ## Mode of file (see below). 

-    st_nlink*: tnlink      ## Number of hard links to the file. 

-    st_uid*: tuid          ## User ID of file. 

-    st_gid*: Tgid          ## Group ID of file. 

-    st_rdev*: TDev         ## Device ID (if file is character or block special). 

-    st_size*: TOff         ## For regular files, the file size in bytes. 

-                           ## For symbolic links, the length in bytes of the 

-                           ## pathname contained in the symbolic link. 

-                           ## For a shared memory object, the length in bytes. 

-                           ## For a typed memory object, the length in bytes. 

-                           ## For other file types, the use of this field is 

-                           ## unspecified. 

-    st_atime*: ttime       ## Time of last access. 

-    st_mtime*: ttime       ## Time of last data modification. 

-    st_ctime*: ttime       ## Time of last status change. 

-    st_blksize*: Tblksize  ## A file system-specific preferred I/O block size  

-                           ## for this object. In some file system types, this 

-                           ## may vary from file to file. 

-    st_blocks*: Tblkcnt    ## Number of blocks allocated for this object. 

-

-  

+           header: "<sys/stat.h>", final, pure.} = object ## struct stat
+    st_dev*: TDev          ## Device ID of device containing file. 
+    st_ino*: TIno          ## File serial number. 
+    st_mode*: TMode        ## Mode of file (see below). 
+    st_nlink*: tnlink      ## Number of hard links to the file. 
+    st_uid*: tuid          ## User ID of file. 
+    st_gid*: Tgid          ## Group ID of file. 
+    st_rdev*: TDev         ## Device ID (if file is character or block special). 
+    st_size*: TOff         ## For regular files, the file size in bytes. 
+                           ## For symbolic links, the length in bytes of the 
+                           ## pathname contained in the symbolic link. 
+                           ## For a shared memory object, the length in bytes. 
+                           ## For a typed memory object, the length in bytes. 
+                           ## For other file types, the use of this field is 
+                           ## unspecified. 
+    st_atime*: ttime       ## Time of last access. 
+    st_mtime*: ttime       ## Time of last data modification. 
+    st_ctime*: ttime       ## Time of last status change. 
+    st_blksize*: Tblksize  ## A file system-specific preferred I/O block size  
+                           ## for this object. In some file system types, this 
+                           ## may vary from file to file. 
+    st_blocks*: Tblkcnt    ## Number of blocks allocated for this object. 
+
+  
   TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", 
-              final, pure.} = object ## struct statvfs

-    f_bsize*: int        ## File system block size. 

-    f_frsize*: int       ## Fundamental file system block size. 

+              final, pure.} = object ## struct statvfs
+    f_bsize*: int        ## File system block size. 
+    f_frsize*: int       ## Fundamental file system block size. 
     f_blocks*: Tfsblkcnt ## Total number of blocks on file system
-                         ## in units of f_frsize. 

-    f_bfree*: Tfsblkcnt  ## Total number of free blocks. 

-    f_bavail*: Tfsblkcnt ## Number of free blocks available to 

-                         ## non-privileged process. 

-    f_files*: Tfsfilcnt  ## Total number of file serial numbers. 

-    f_ffree*: Tfsfilcnt  ## Total number of free file serial numbers. 

-    f_favail*: Tfsfilcnt ## Number of file serial numbers available to 

-                         ## non-privileged process. 

-    f_fsid*: int         ## File system ID. 

-    f_flag*: int         ## Bit mask of f_flag values. 

-    f_namemax*: int      ## Maximum filename length. 

-

-  Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", 

-                           header: "<sys/mman.h>", final, pure.} = object

-    posix_tmi_length*: int

-  

+                         ## in units of f_frsize. 
+    f_bfree*: Tfsblkcnt  ## Total number of free blocks. 
+    f_bavail*: Tfsblkcnt ## Number of free blocks available to 
+                         ## non-privileged process. 
+    f_files*: Tfsfilcnt  ## Total number of file serial numbers. 
+    f_ffree*: Tfsfilcnt  ## Total number of free file serial numbers. 
+    f_favail*: Tfsfilcnt ## Number of file serial numbers available to 
+                         ## non-privileged process. 
+    f_fsid*: int         ## File system ID. 
+    f_flag*: int         ## Bit mask of f_flag values. 
+    f_namemax*: int      ## Maximum filename length. 
+
+  Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", 
+                           header: "<sys/mman.h>", final, pure.} = object
+    posix_tmi_length*: int
+  
   Ttm* {.importc: "struct tm", header: "<time.h>", 
-         final, pure.} = object ## struct tm

-    tm_sec*: cint   ## Seconds [0,60]. 

-    tm_min*: cint   ## Minutes [0,59]. 

-    tm_hour*: cint  ## Hour [0,23]. 

-    tm_mday*: cint  ## Day of month [1,31]. 

-    tm_mon*: cint   ## Month of year [0,11]. 

-    tm_year*: cint  ## Years since 1900. 

-    tm_wday*: cint  ## Day of week [0,6] (Sunday =0). 

-    tm_yday*: cint  ## Day of year [0,365]. 

-    tm_isdst*: cint ## Daylight Savings flag. 

+         final, pure.} = object ## struct tm
+    tm_sec*: cint   ## Seconds [0,60]. 
+    tm_min*: cint   ## Minutes [0,59]. 
+    tm_hour*: cint  ## Hour [0,23]. 
+    tm_mday*: cint  ## Day of month [1,31]. 
+    tm_mon*: cint   ## Month of year [0,11]. 
+    tm_year*: cint  ## Years since 1900. 
+    tm_wday*: cint  ## Day of week [0,6] (Sunday =0). 
+    tm_yday*: cint  ## Day of year [0,365]. 
+    tm_isdst*: cint ## Daylight Savings flag. 
   Ttimespec* {.importc: "struct timespec", 
-               header: "<time.h>", final, pure.} = object ## struct timespec

-    tv_sec*: Ttime ## Seconds. 

-    tv_nsec*: int  ## Nanoseconds. 

+               header: "<time.h>", final, pure.} = object ## struct timespec
+    tv_sec*: Ttime ## Seconds. 
+    tv_nsec*: int  ## Nanoseconds. 
   titimerspec* {.importc: "struct itimerspec", header: "<time.h>", 
-                 final, pure.} = object ## struct itimerspec

-    it_interval*: ttimespec ## Timer period. 

-    it_value*: ttimespec    ## Timer expiration. 

-  

-  Tsig_atomic* {.importc: "sig_atomic_t", header: "<signal.h>".} = cint

-    ## Possibly volatile-qualified integer type of an object that can be 

-    ## accessed as an atomic entity, even in the presence of asynchronous

-    ## interrupts.

-  Tsigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object

-  

+                 final, pure.} = object ## struct itimerspec
+    it_interval*: ttimespec ## Timer period. 
+    it_value*: ttimespec    ## Timer expiration. 
+  
+  Tsig_atomic* {.importc: "sig_atomic_t", header: "<signal.h>".} = cint
+    ## Possibly volatile-qualified integer type of an object that can be 
+    ## accessed as an atomic entity, even in the presence of asynchronous
+    ## interrupts.
+  Tsigset* {.importc: "sigset_t", header: "<signal.h>", final, pure.} = object
+  
   TsigEvent* {.importc: "struct sigevent", 
-               header: "<signal.h>", final, pure.} = object ## struct sigevent

-    sigev_notify*: cint           ## Notification type. 

-    sigev_signo*: cint            ## Signal number. 

-    sigev_value*: Tsigval         ## Signal value. 

-    sigev_notify_function*: proc (x: TSigval) {.noconv.} ## Notification function. 

-    sigev_notify_attributes*: ptr Tpthreadattr ## Notification attributes.

-

+               header: "<signal.h>", final, pure.} = object ## struct sigevent
+    sigev_notify*: cint           ## Notification type. 
+    sigev_signo*: cint            ## Signal number. 
+    sigev_value*: Tsigval         ## Signal value. 
+    sigev_notify_function*: proc (x: TSigval) {.noconv.} ## Notification function. 
+    sigev_notify_attributes*: ptr Tpthreadattr ## Notification attributes.
+
   TsigVal* {.importc: "union sigval", 
-             header: "<signal.h>", final, pure.} = object ## struct sigval

-    sival_ptr*: pointer ## pointer signal value; 

-                        ## integer signal value not defined!

+             header: "<signal.h>", final, pure.} = object ## struct sigval
+    sival_ptr*: pointer ## pointer signal value; 
+                        ## integer signal value not defined!
   TSigaction* {.importc: "struct sigaction", 
-                header: "<signal.h>", final, pure.} = object ## struct sigaction

-    sa_handler*: proc (x: cint) {.noconv.}  ## Pointer to a signal-catching

-                                            ## function or one of the macros 

-                                            ## SIG_IGN or SIG_DFL. 

-    sa_mask*: TsigSet ## Set of signals to be blocked during execution of 

-                      ## the signal handling function. 

-    sa_flags*: cint   ## Special flags. 

-    sa_sigaction*: proc (x: cint, y: var TSigInfo, z: pointer) {.noconv.}

-

+                header: "<signal.h>", final, pure.} = object ## struct sigaction
+    sa_handler*: proc (x: cint) {.noconv.}  ## Pointer to a signal-catching
+                                            ## function or one of the macros 
+                                            ## SIG_IGN or SIG_DFL. 
+    sa_mask*: TsigSet ## Set of signals to be blocked during execution of 
+                      ## the signal handling function. 
+    sa_flags*: cint   ## Special flags. 
+    sa_sigaction*: proc (x: cint, y: var TSigInfo, z: pointer) {.noconv.}
+
   TStack* {.importc: "stack_t",
-            header: "<signal.h>", final, pure.} = object ## stack_t

-    ss_sp*: pointer  ## Stack base or pointer. 

-    ss_size*: int    ## Stack size. 

-    ss_flags*: cint  ## Flags. 

-

+            header: "<signal.h>", final, pure.} = object ## stack_t
+    ss_sp*: pointer  ## Stack base or pointer. 
+    ss_size*: int    ## Stack size. 
+    ss_flags*: cint  ## Flags. 
+
   TSigStack* {.importc: "struct sigstack", 
-               header: "<signal.h>", final, pure.} = object ## struct sigstack

-    ss_onstack*: cint ## Non-zero when signal stack is in use. 

-    ss_sp*: pointer   ## Signal stack pointer. 

-

+               header: "<signal.h>", final, pure.} = object ## struct sigstack
+    ss_onstack*: cint ## Non-zero when signal stack is in use. 
+    ss_sp*: pointer   ## Signal stack pointer. 
+
   TsigInfo* {.importc: "siginfo_t", 
-              header: "<signal.h>", final, pure.} = object ## siginfo_t

-    si_signo*: cint    ## Signal number. 

-    si_code*: cint     ## Signal code. 

-    si_errno*: cint    ## If non-zero, an errno value associated with 

-                       ## this signal, as defined in <errno.h>. 

-    si_pid*: tpid      ## Sending process ID. 

-    si_uid*: tuid      ## Real user ID of sending process. 

-    si_addr*: pointer  ## Address of faulting instruction. 

-    si_status*: cint   ## Exit value or signal. 

-    si_band*: int      ## Band event for SIGPOLL. 

-    si_value*: TSigval ## Signal value. 

-  

-  Tnl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint

-  Tnl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = cint

-

+              header: "<signal.h>", final, pure.} = object ## siginfo_t
+    si_signo*: cint    ## Signal number. 
+    si_code*: cint     ## Signal code. 
+    si_errno*: cint    ## If non-zero, an errno value associated with 
+                       ## this signal, as defined in <errno.h>. 
+    si_pid*: tpid      ## Sending process ID. 
+    si_uid*: tuid      ## Real user ID of sending process. 
+    si_addr*: pointer  ## Address of faulting instruction. 
+    si_status*: cint   ## Exit value or signal. 
+    si_band*: int      ## Band event for SIGPOLL. 
+    si_value*: TSigval ## Signal value. 
+  
+  Tnl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint
+  Tnl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = cint
+
   Tsched_param* {.importc: "struct sched_param", 
                   header: "<sched.h>", 
-                  final, pure.} = object ## struct sched_param

-    sched_priority*: cint

-    sched_ss_low_priority*: cint     ## Low scheduling priority for 

-                                     ## sporadic server. 

-    sched_ss_repl_period*: ttimespec ## Replenishment period for 

-                                     ## sporadic server. 

-    sched_ss_init_budget*: ttimespec ## Initial budget for sporadic server. 

-    sched_ss_max_repl*: cint         ## Maximum pending replenishments for 

-                                     ## sporadic server. 

-

+                  final, pure.} = object ## struct sched_param
+    sched_priority*: cint
+    sched_ss_low_priority*: cint     ## Low scheduling priority for 
+                                     ## sporadic server. 
+    sched_ss_repl_period*: ttimespec ## Replenishment period for 
+                                     ## sporadic server. 
+    sched_ss_init_budget*: ttimespec ## Initial budget for sporadic server. 
+    sched_ss_max_repl*: cint         ## Maximum pending replenishments for 
+                                     ## sporadic server. 
+
   Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", 
-              final, pure.} = object ## struct timeval

-    tv_sec*: ttime       ## Seconds. 

-    tv_usec*: tsuseconds ## Microseconds. 

+              final, pure.} = object ## struct timeval
+    tv_sec*: ttime       ## Seconds. 
+    tv_usec*: tsuseconds ## Microseconds. 
   Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>", 
-             final, pure.} = object

+             final, pure.} = object
   Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", 
-               final, pure.} = object

+               final, pure.} = object
   Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", 
-               final, pure.} = object ## ucontext_t

-    uc_link*: ptr Tucontext ## Pointer to the context that is resumed 

-                            ## when this context returns. 

-    uc_sigmask*: Tsigset    ## The set of signals that are blocked when this 

-                            ## context is active. 

-    uc_stack*: TStack       ## The stack used by this context. 

-    uc_mcontext*: Tmcontext ## A machine-specific representation of the saved 

-                            ## context. 

-

-when hasAioH:

-  type

+               final, pure.} = object ## ucontext_t
+    uc_link*: ptr Tucontext ## Pointer to the context that is resumed 
+                            ## when this context returns. 
+    uc_sigmask*: Tsigset    ## The set of signals that are blocked when this 
+                            ## context is active. 
+    uc_stack*: TStack       ## The stack used by this context. 
+    uc_mcontext*: Tmcontext ## A machine-specific representation of the saved 
+                            ## context. 
+
+when hasAioH:
+  type
     Taiocb* {.importc: "struct aiocb", header: "<aio.h>", 
-              final, pure.} = object ## struct aiocb

-      aio_fildes*: cint         ## File descriptor. 

-      aio_offset*: TOff         ## File offset. 

-      aio_buf*: pointer         ## Location of buffer. 

-      aio_nbytes*: int          ## Length of transfer. 

-      aio_reqprio*: cint        ## Request priority offset. 

-      aio_sigevent*: TSigEvent  ## Signal number and value. 

-      aio_lio_opcode: cint      ## Operation to be performed. 

- 

-when hasSpawnH:

-  type

+              final, pure.} = object ## struct aiocb
+      aio_fildes*: cint         ## File descriptor. 
+      aio_offset*: TOff         ## File offset. 
+      aio_buf*: pointer         ## Location of buffer. 
+      aio_nbytes*: int          ## Length of transfer. 
+      aio_reqprio*: cint        ## Request priority offset. 
+      aio_sigevent*: TSigEvent  ## Signal number and value. 
+      aio_lio_opcode: cint      ## Operation to be performed. 
+ 
+when hasSpawnH:
+  type
     Tposix_spawnattr* {.importc: "posix_spawnattr_t", 
-                        header: "<spawn.h>".} = cint

+                        header: "<spawn.h>".} = cint
     Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", 
-                                 header: "<spawn.h>".} = cint 

-

+                                 header: "<spawn.h>".} = cint 
+
 type
   TSocklen* {.importc: "socklen_t", header: "<sys/socket.h>".} = cint
   TSa_Family* {.importc: "sa_family_t", header: "<sys/socket.h>".} = cint
@@ -541,911 +541,911 @@ type
   Tnfds* {.importc: "nfds_t", header: "<poll.h>".} = cint
 
 var
-  errno* {.importc, header: "<errno.h>".}: cint ## error variable

-  daylight* {.importc, header: "<time.h>".}: cint

-  timezone* {.importc, header: "<time.h>".}: int

-  

-# Constants as variables:

-when hasAioH:

-  var

-    AIO_ALLDONE* {.importc, header: "<aio.h>".}: cint

-      ## A return value indicating that none of the requested operations 

-      ## could be canceled since they are already complete.

-    AIO_CANCELED* {.importc, header: "<aio.h>".}: cint

-      ## A return value indicating that all requested operations have

-      ## been canceled.

-    AIO_NOTCANCELED* {.importc, header: "<aio.h>".}: cint

-      ## A return value indicating that some of the requested operations could 

-      ## not be canceled since they are in progress.

-    LIO_NOP* {.importc, header: "<aio.h>".}: cint

-      ## A lio_listio() element operation option indicating that no transfer is

-      ## requested.

-    LIO_NOWAIT* {.importc, header: "<aio.h>".}: cint

-      ## A lio_listio() synchronization operation indicating that the calling 

-      ## thread is to continue execution while the lio_listio() operation is 

-      ## being performed, and no notification is given when the operation is

-      ## complete.

-    LIO_READ* {.importc, header: "<aio.h>".}: cint

-      ## A lio_listio() element operation option requesting a read.

-    LIO_WAIT* {.importc, header: "<aio.h>".}: cint

-      ## A lio_listio() synchronization operation indicating that the calling 

-      ## thread is to suspend until the lio_listio() operation is complete.

-    LIO_WRITE* {.importc, header: "<aio.h>".}: cint

-      ## A lio_listio() element operation option requesting a write.

-

-var

-  RTLD_LAZY* {.importc, header: "<dlfcn.h>".}: cint

-    ## Relocations are performed at an implementation-defined time.

-  RTLD_NOW* {.importc, header: "<dlfcn.h>".}: cint

-    ## Relocations are performed when the object is loaded.

-  RTLD_GLOBAL* {.importc, header: "<dlfcn.h>".}: cint

-    ## All symbols are available for relocation processing of other modules.

-  RTLD_LOCAL* {.importc, header: "<dlfcn.h>".}: cint

-    ## All symbols are not made available for relocation processing by 

-    ## other modules. 

-    

-  E2BIG* {.importc, header: "<errno.h>".}: cint

-      ## Argument list too long.

-  EACCES* {.importc, header: "<errno.h>".}: cint

-      ## Permission denied.

-  EADDRINUSE* {.importc, header: "<errno.h>".}: cint

-      ## Address in use.

-  EADDRNOTAVAIL* {.importc, header: "<errno.h>".}: cint

-      ## Address not available.

-  EAFNOSUPPORT* {.importc, header: "<errno.h>".}: cint

-      ## Address family not supported.

-  EAGAIN* {.importc, header: "<errno.h>".}: cint

-      ## Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).

-  EALREADY* {.importc, header: "<errno.h>".}: cint

-      ## Connection already in progress.

-  EBADF* {.importc, header: "<errno.h>".}: cint

-      ## Bad file descriptor.

-  EBADMSG* {.importc, header: "<errno.h>".}: cint

-      ## Bad message.

-  EBUSY* {.importc, header: "<errno.h>".}: cint

-      ## Device or resource busy.

-  ECANCELED* {.importc, header: "<errno.h>".}: cint

-      ## Operation canceled.

-  ECHILD* {.importc, header: "<errno.h>".}: cint

-      ## No child processes.

-  ECONNABORTED* {.importc, header: "<errno.h>".}: cint

-      ## Connection aborted.

-  ECONNREFUSED* {.importc, header: "<errno.h>".}: cint

-      ## Connection refused.

-  ECONNRESET* {.importc, header: "<errno.h>".}: cint

-      ## Connection reset.

-  EDEADLK* {.importc, header: "<errno.h>".}: cint

-      ## Resource deadlock would occur.

-  EDESTADDRREQ* {.importc, header: "<errno.h>".}: cint

-      ## Destination address required.

-  EDOM* {.importc, header: "<errno.h>".}: cint

-      ## Mathematics argument out of domain of function.

-  EDQUOT* {.importc, header: "<errno.h>".}: cint

-      ## Reserved.

-  EEXIST* {.importc, header: "<errno.h>".}: cint

-      ## File exists.

-  EFAULT* {.importc, header: "<errno.h>".}: cint

-      ## Bad address.

-  EFBIG* {.importc, header: "<errno.h>".}: cint

-      ## File too large.

-  EHOSTUNREACH* {.importc, header: "<errno.h>".}: cint

-      ## Host is unreachable.

-  EIDRM* {.importc, header: "<errno.h>".}: cint

-      ## Identifier removed.

-  EILSEQ* {.importc, header: "<errno.h>".}: cint

-      ## Illegal byte sequence.

-  EINPROGRESS* {.importc, header: "<errno.h>".}: cint

-      ## Operation in progress.

-  EINTR* {.importc, header: "<errno.h>".}: cint

-      ## Interrupted function.

-  EINVAL* {.importc, header: "<errno.h>".}: cint

-      ## Invalid argument.

-  EIO* {.importc, header: "<errno.h>".}: cint

-      ## I/O error.

-  EISCONN* {.importc, header: "<errno.h>".}: cint

-      ## Socket is connected.

-  EISDIR* {.importc, header: "<errno.h>".}: cint

-      ## Is a directory.

-  ELOOP* {.importc, header: "<errno.h>".}: cint

-      ## Too many levels of symbolic links.

-  EMFILE* {.importc, header: "<errno.h>".}: cint

-      ## Too many open files.

-  EMLINK* {.importc, header: "<errno.h>".}: cint

-      ## Too many links.

-  EMSGSIZE* {.importc, header: "<errno.h>".}: cint

-      ## Message too large.

-  EMULTIHOP* {.importc, header: "<errno.h>".}: cint

-      ## Reserved.

-  ENAMETOOLONG* {.importc, header: "<errno.h>".}: cint

-      ## Filename too long.

-  ENETDOWN* {.importc, header: "<errno.h>".}: cint

-      ## Network is down.

-  ENETRESET* {.importc, header: "<errno.h>".}: cint

-      ## Connection aborted by network.

-  ENETUNREACH* {.importc, header: "<errno.h>".}: cint

-      ## Network unreachable.

-  ENFILE* {.importc, header: "<errno.h>".}: cint

-      ## Too many files open in system.

-  ENOBUFS* {.importc, header: "<errno.h>".}: cint

-      ## No buffer space available.

-  ENODATA* {.importc, header: "<errno.h>".}: cint

-      ## No message is available on the STREAM head read queue.

-  ENODEV* {.importc, header: "<errno.h>".}: cint

-      ## No such device.

-  ENOENT* {.importc, header: "<errno.h>".}: cint

-      ## No such file or directory.

-  ENOEXEC* {.importc, header: "<errno.h>".}: cint

-      ## Executable file format error.

-  ENOLCK* {.importc, header: "<errno.h>".}: cint

-      ## No locks available.

-  ENOLINK* {.importc, header: "<errno.h>".}: cint

-      ## Reserved.

-  ENOMEM* {.importc, header: "<errno.h>".}: cint

-      ## Not enough space.

-  ENOMSG* {.importc, header: "<errno.h>".}: cint

-      ## No message of the desired type.

-  ENOPROTOOPT* {.importc, header: "<errno.h>".}: cint

-      ## Protocol not available.

-  ENOSPC* {.importc, header: "<errno.h>".}: cint

-      ## No space left on device.

-  ENOSR* {.importc, header: "<errno.h>".}: cint

-      ## No STREAM resources.

-  ENOSTR* {.importc, header: "<errno.h>".}: cint

-      ## Not a STREAM.

-  ENOSYS* {.importc, header: "<errno.h>".}: cint

-      ## Function not supported.

-  ENOTCONN* {.importc, header: "<errno.h>".}: cint

-      ## The socket is not connected.

-  ENOTDIR* {.importc, header: "<errno.h>".}: cint

-      ## Not a directory.

-  ENOTEMPTY* {.importc, header: "<errno.h>".}: cint

-      ## Directory not empty.

-  ENOTSOCK* {.importc, header: "<errno.h>".}: cint

-      ## Not a socket.

-  ENOTSUP* {.importc, header: "<errno.h>".}: cint

-      ## Not supported.

-  ENOTTY* {.importc, header: "<errno.h>".}: cint

-      ## Inappropriate I/O control operation.

-  ENXIO* {.importc, header: "<errno.h>".}: cint

-      ## No such device or address.

-  EOPNOTSUPP* {.importc, header: "<errno.h>".}: cint

-      ## Operation not supported on socket.

-  EOVERFLOW* {.importc, header: "<errno.h>".}: cint

-      ## Value too large to be stored in data type.

-  EPERM* {.importc, header: "<errno.h>".}: cint

-      ## Operation not permitted.

-  EPIPE* {.importc, header: "<errno.h>".}: cint

-      ## Broken pipe.

-  EPROTO* {.importc, header: "<errno.h>".}: cint

-      ## Protocol error.

-  EPROTONOSUPPORT* {.importc, header: "<errno.h>".}: cint

-      ## Protocol not supported.

-  EPROTOTYPE* {.importc, header: "<errno.h>".}: cint

-      ## Protocol wrong type for socket.

-  ERANGE* {.importc, header: "<errno.h>".}: cint

-      ## Result too large.

-  EROFS* {.importc, header: "<errno.h>".}: cint

-      ## Read-only file system.

-  ESPIPE* {.importc, header: "<errno.h>".}: cint

-      ## Invalid seek.

-  ESRCH* {.importc, header: "<errno.h>".}: cint

-      ## No such process.

-  ESTALE* {.importc, header: "<errno.h>".}: cint

-      ## Reserved.

-  ETIME* {.importc, header: "<errno.h>".}: cint

-      ## Stream ioctl() timeout.

-  ETIMEDOUT* {.importc, header: "<errno.h>".}: cint

-      ## Connection timed out.

-  ETXTBSY* {.importc, header: "<errno.h>".}: cint

-      ## Text file busy.

-  EWOULDBLOCK* {.importc, header: "<errno.h>".}: cint

-      ## Operation would block (may be the same value as [EAGAIN]).

-  EXDEV* {.importc, header: "<errno.h>".}: cint

-      ## Cross-device link.   

-

-  F_DUPFD* {.importc, header: "<fcntl.h>".}: cint

-    ## Duplicate file descriptor.

-  F_GETFD* {.importc, header: "<fcntl.h>".}: cint

-    ## Get file descriptor flags.

-  F_SETFD* {.importc, header: "<fcntl.h>".}: cint

-    ## Set file descriptor flags.

-  F_GETFL* {.importc, header: "<fcntl.h>".}: cint

-    ## Get file status flags and file access modes.

-  F_SETFL* {.importc, header: "<fcntl.h>".}: cint

-    ## Set file status flags.

-  F_GETLK* {.importc, header: "<fcntl.h>".}: cint

-    ## Get record locking information.

-  F_SETLK* {.importc, header: "<fcntl.h>".}: cint

-    ## Set record locking information.

-  F_SETLKW* {.importc, header: "<fcntl.h>".}: cint

-    ## Set record locking information; wait if blocked.

-  F_GETOWN* {.importc, header: "<fcntl.h>".}: cint

-    ## Get process or process group ID to receive SIGURG signals.

-  F_SETOWN* {.importc, header: "<fcntl.h>".}: cint

-    ## Set process or process group ID to receive SIGURG signals. 

-  FD_CLOEXEC* {.importc, header: "<fcntl.h>".}: cint

-    ## Close the file descriptor upon execution of an exec family function. 

-  F_RDLCK* {.importc, header: "<fcntl.h>".}: cint

-    ## Shared or read lock.

-  F_UNLCK* {.importc, header: "<fcntl.h>".}: cint

-    ## Unlock.

-  F_WRLCK* {.importc, header: "<fcntl.h>".}: cint

-    ## Exclusive or write lock. 

-  O_CREAT* {.importc, header: "<fcntl.h>".}: cint

-    ## Create file if it does not exist.

-  O_EXCL* {.importc, header: "<fcntl.h>".}: cint

-    ## Exclusive use flag.

-  O_NOCTTY* {.importc, header: "<fcntl.h>".}: cint

-    ## Do not assign controlling terminal.

-  O_TRUNC* {.importc, header: "<fcntl.h>".}: cint

-    ## Truncate flag. 

-  O_APPEND* {.importc, header: "<fcntl.h>".}: cint

-    ## Set append mode.

-  O_DSYNC* {.importc, header: "<fcntl.h>".}: cint

-    ## Write according to synchronized I/O data integrity completion.

-  O_NONBLOCK* {.importc, header: "<fcntl.h>".}: cint

-    ## Non-blocking mode.

-  O_RSYNC* {.importc, header: "<fcntl.h>".}: cint

-    ## Synchronized read I/O operations.

-  O_SYNC* {.importc, header: "<fcntl.h>".}: cint

-    ## Write according to synchronized I/O file integrity completion. 

-  O_ACCMODE* {.importc, header: "<fcntl.h>".}: cint

-    ## Mask for file access modes.      

-  O_RDONLY* {.importc, header: "<fcntl.h>".}: cint

-    ## Open for reading only.

-  O_RDWR* {.importc, header: "<fcntl.h>".}: cint

-    ## Open for reading and writing.

-  O_WRONLY* {.importc, header: "<fcntl.h>".}: cint

-    ## Open for writing only. 

-  POSIX_FADV_NORMAL* {.importc, header: "<fcntl.h>".}: cint

-    ## The application has no advice to give on its behavior with

-    ## respect to the specified data. It is the default characteristic

-    ## if no advice is given for an open file.

-  POSIX_FADV_SEQUENTIAL* {.importc, header: "<fcntl.h>".}: cint

-    ## The application expects to access the specified data 

-    # sequentially from lower offsets to higher offsets.

-  POSIX_FADV_RANDOM* {.importc, header: "<fcntl.h>".}: cint

-    ## The application expects to access the specified data in a random order.

-  POSIX_FADV_WILLNEED* {.importc, header: "<fcntl.h>".}: cint

-    ## The application expects to access the specified data in the near future.

-  POSIX_FADV_DONTNEED* {.importc, header: "<fcntl.h>".}: cint

-    ## The application expects that it will not access the specified data

-    ## in the near future.

-  POSIX_FADV_NOREUSE* {.importc, header: "<fcntl.h>".}: cint

-    ## The application expects to access the specified data once and 

-    ## then not reuse it thereafter. 

-

-  FE_DIVBYZERO* {.importc, header: "<fenv.h>".}: cint

-  FE_INEXACT* {.importc, header: "<fenv.h>".}: cint

-  FE_INVALID* {.importc, header: "<fenv.h>".}: cint

-  FE_OVERFLOW* {.importc, header: "<fenv.h>".}: cint

-  FE_UNDERFLOW* {.importc, header: "<fenv.h>".}: cint

-  FE_ALL_EXCEPT* {.importc, header: "<fenv.h>".}: cint

-  FE_DOWNWARD* {.importc, header: "<fenv.h>".}: cint

-  FE_TONEAREST* {.importc, header: "<fenv.h>".}: cint

-  FE_TOWARDZERO* {.importc, header: "<fenv.h>".}: cint

-  FE_UPWARD* {.importc, header: "<fenv.h>".}: cint

-  FE_DFL_ENV* {.importc, header: "<fenv.h>".}: cint

-

-  MM_HARD* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Source of the condition is hardware.

-  MM_SOFT* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Source of the condition is software.

-  MM_FIRM* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Source of the condition is firmware.

-  MM_APPL* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Condition detected by application.

-  MM_UTIL* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Condition detected by utility.

-  MM_OPSYS* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Condition detected by operating system.

-  MM_RECOVER* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Recoverable error.

-  MM_NRECOV* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Non-recoverable error.

-  MM_HALT* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Error causing application to halt.

-  MM_ERROR* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Application has encountered a non-fatal fault.

-  MM_WARNING* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Application has detected unusual non-error condition.

-  MM_INFO* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Informative message.

-  MM_NOSEV* {.importc, header: "<fmtmsg.h>".}: cint

-    ## No severity level provided for the message.

-  MM_PRINT* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Display message on standard error.

-  MM_CONSOLE* {.importc, header: "<fmtmsg.h>".}: cint

-    ## Display message on system console. 

-

-  MM_OK* {.importc, header: "<fmtmsg.h>".}: cint

-    ## The function succeeded.

-  MM_NOTOK* {.importc, header: "<fmtmsg.h>".}: cint

-    ## The function failed completely.

-  MM_NOMSG* {.importc, header: "<fmtmsg.h>".}: cint

-    ## The function was unable to generate a message on standard error, 

-    ## but otherwise succeeded.

-  MM_NOCON* {.importc, header: "<fmtmsg.h>".}: cint

-    ## The function was unable to generate a console message, but 

-    ## otherwise succeeded. 

-    

-  FNM_NOMATCH* {.importc, header: "<fnmatch.h>".}: cint

-    ## The string does not match the specified pattern.

-  FNM_PATHNAME* {.importc, header: "<fnmatch.h>".}: cint

-    ## Slash in string only matches slash in pattern.

-  FNM_PERIOD* {.importc, header: "<fnmatch.h>".}: cint

-    ## Leading period in string must be exactly matched by period in pattern.

-  FNM_NOESCAPE* {.importc, header: "<fnmatch.h>".}: cint

-    ## Disable backslash escaping.

-  FNM_NOSYS* {.importc, header: "<fnmatch.h>".}: cint

-    ## Reserved.

-

-  FTW_F* {.importc, header: "<ftw.h>".}: cint

-    ## File.

-  FTW_D* {.importc, header: "<ftw.h>".}: cint

-    ## Directory.

-  FTW_DNR* {.importc, header: "<ftw.h>".}: cint

-    ## Directory without read permission.

-  FTW_DP* {.importc, header: "<ftw.h>".}: cint

-    ## Directory with subdirectories visited.

-  FTW_NS* {.importc, header: "<ftw.h>".}: cint

-    ## Unknown type; stat() failed.

-  FTW_SL* {.importc, header: "<ftw.h>".}: cint

-    ## Symbolic link.

-  FTW_SLN* {.importc, header: "<ftw.h>".}: cint

-    ## Symbolic link that names a nonexistent file.

-

-  FTW_PHYS* {.importc, header: "<ftw.h>".}: cint

-    ## Physical walk, does not follow symbolic links. Otherwise, nftw() 

-    ## follows links but does not walk down any path that crosses itself.

-  FTW_MOUNT* {.importc, header: "<ftw.h>".}: cint

-    ## The walk does not cross a mount point.

-  FTW_DEPTH* {.importc, header: "<ftw.h>".}: cint

-    ## All subdirectories are visited before the directory itself.

-  FTW_CHDIR* {.importc, header: "<ftw.h>".}: cint

-    ## The walk changes to each directory before reading it. 

-

-  GLOB_APPEND* {.importc, header: "<glob.h>".}: cint

-    ## Append generated pathnames to those previously obtained.

-  GLOB_DOOFFS* {.importc, header: "<glob.h>".}: cint

-    ## Specify how many null pointers to add to the beginning of gl_pathv.

-  GLOB_ERR* {.importc, header: "<glob.h>".}: cint

-    ## Cause glob() to return on error.

-  GLOB_MARK* {.importc, header: "<glob.h>".}: cint

-    ## Each pathname that is a directory that matches pattern has a 

-    ## slash appended.

-  GLOB_NOCHECK* {.importc, header: "<glob.h>".}: cint

-    ## If pattern does not match any pathname, then return a list

-    ## consisting of only pattern.

-  GLOB_NOESCAPE* {.importc, header: "<glob.h>".}: cint

-    ## Disable backslash escaping.

-  GLOB_NOSORT* {.importc, header: "<glob.h>".}: cint

-    ## Do not sort the pathnames returned.

-  GLOB_ABORTED* {.importc, header: "<glob.h>".}: cint

-    ## The scan was stopped because GLOB_ERR was set or errfunc() 

-    ## returned non-zero.

-  GLOB_NOMATCH* {.importc, header: "<glob.h>".}: cint

-    ## The pattern does not match any existing pathname, and GLOB_NOCHECK 

-    ## was not set in flags.

-  GLOB_NOSPACE* {.importc, header: "<glob.h>".}: cint

-    ## An attempt to allocate memory failed.

-  GLOB_NOSYS* {.importc, header: "<glob.h>".}: cint

-    ## Reserved

-

-  CODESET* {.importc, header: "<langinfo.h>".}: cint

-    ## Codeset name.

-  D_T_FMT* {.importc, header: "<langinfo.h>".}: cint

-    ## String for formatting date and time.

-  D_FMT * {.importc, header: "<langinfo.h>".}: cint

-    ## Date format string.

-  T_FMT* {.importc, header: "<langinfo.h>".}: cint

-    ## Time format string.

-  T_FMT_AMPM* {.importc, header: "<langinfo.h>".}: cint

-    ## a.m. or p.m. time format string.

-  AM_STR* {.importc, header: "<langinfo.h>".}: cint

-    ## Ante-meridiem affix.

-  PM_STR* {.importc, header: "<langinfo.h>".}: cint

-    ## Post-meridiem affix.

-  DAY_1* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the first day of the week (for example, Sunday).

-  DAY_2* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the second day of the week (for example, Monday).

-  DAY_3* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the third day of the week (for example, Tuesday).

-  DAY_4* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the fourth day of the week (for example, Wednesday).

-  DAY_5* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the fifth day of the week (for example, Thursday).

-  DAY_6* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the sixth day of the week (for example, Friday).

-  DAY_7* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the seventh day of the week (for example, Saturday).

-  ABDAY_1* {.importc, header: "<langinfo.h>".}: cint

-    ## Abbreviated name of the first day of the week.

-  ABDAY_2* {.importc, header: "<langinfo.h>".}: cint

-  ABDAY_3* {.importc, header: "<langinfo.h>".}: cint

-  ABDAY_4* {.importc, header: "<langinfo.h>".}: cint

-  ABDAY_5* {.importc, header: "<langinfo.h>".}: cint

-  ABDAY_6* {.importc, header: "<langinfo.h>".}: cint

-  ABDAY_7* {.importc, header: "<langinfo.h>".}: cint

-  MON_1* {.importc, header: "<langinfo.h>".}: cint

-    ## Name of the first month of the year.

-  MON_2* {.importc, header: "<langinfo.h>".}: cint

-  MON_3* {.importc, header: "<langinfo.h>".}: cint

-  MON_4* {.importc, header: "<langinfo.h>".}: cint

-  MON_5* {.importc, header: "<langinfo.h>".}: cint

-  MON_6* {.importc, header: "<langinfo.h>".}: cint

-  MON_7* {.importc, header: "<langinfo.h>".}: cint

-  MON_8* {.importc, header: "<langinfo.h>".}: cint

-  MON_9* {.importc, header: "<langinfo.h>".}: cint

-  MON_10* {.importc, header: "<langinfo.h>".}: cint

-  MON_11* {.importc, header: "<langinfo.h>".}: cint

-  MON_12* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_1* {.importc, header: "<langinfo.h>".}: cint

-    ## Abbreviated name of the first month.

-  ABMON_2* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_3* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_4* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_5* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_6* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_7* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_8* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_9* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_10* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_11* {.importc, header: "<langinfo.h>".}: cint

-  ABMON_12* {.importc, header: "<langinfo.h>".}: cint

-  ERA* {.importc, header: "<langinfo.h>".}: cint

-    ## Era description segments.

-  ERA_D_FMT* {.importc, header: "<langinfo.h>".}: cint

-    ## Era date format string.

-  ERA_D_T_FMT* {.importc, header: "<langinfo.h>".}: cint

-    ## Era date and time format string.

-  ERA_T_FMT* {.importc, header: "<langinfo.h>".}: cint

-    ## Era time format string.

-  ALT_DIGITS* {.importc, header: "<langinfo.h>".}: cint

-    ## Alternative symbols for digits.

-  RADIXCHAR* {.importc, header: "<langinfo.h>".}: cint

-    ## Radix character.

-  THOUSEP* {.importc, header: "<langinfo.h>".}: cint

-    ## Separator for thousands.

-  YESEXPR* {.importc, header: "<langinfo.h>".}: cint

-    ## Affirmative response expression.

-  NOEXPR* {.importc, header: "<langinfo.h>".}: cint

-    ## Negative response expression.

-  CRNCYSTR* {.importc, header: "<langinfo.h>".}: cint

-    ## Local currency symbol, preceded by '-' if the symbol 

-    ## should appear before the value, '+' if the symbol should appear 

-    ## after the value, or '.' if the symbol should replace the radix

-    ## character. If the local currency symbol is the empty string, 

-    ## implementations may return the empty string ( "" ).

-

-  LC_ALL* {.importc, header: "<locale.h>".}: cint

-  LC_COLLATE* {.importc, header: "<locale.h>".}: cint

-  LC_CTYPE* {.importc, header: "<locale.h>".}: cint

-  LC_MESSAGES* {.importc, header: "<locale.h>".}: cint

-  LC_MONETARY* {.importc, header: "<locale.h>".}: cint

-  LC_NUMERIC* {.importc, header: "<locale.h>".}: cint

-  LC_TIME* {.importc, header: "<locale.h>".}: cint

-  

-  PTHREAD_BARRIER_SERIAL_THREAD* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CANCEL_ASYNCHRONOUS* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CANCEL_ENABLE* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CANCEL_DEFERRED* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CANCEL_DISABLE* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CANCELED* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_COND_INITIALIZER* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CREATE_DETACHED* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_CREATE_JOINABLE* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_EXPLICIT_SCHED* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_INHERIT_SCHED* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_MUTEX_DEFAULT* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_MUTEX_ERRORCHECK* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_MUTEX_INITIALIZER* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_MUTEX_NORMAL* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_MUTEX_RECURSIVE* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_ONCE_INIT* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_PRIO_INHERIT* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_PRIO_NONE* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_PRIO_PROTECT* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_PROCESS_SHARED* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_PROCESS_PRIVATE* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_SCOPE_PROCESS* {.importc, header: "<pthread.h>".}: cint

-  PTHREAD_SCOPE_SYSTEM* {.importc, header: "<pthread.h>".}: cint

-

-  POSIX_ASYNC_IO* {.importc: "_POSIX_ASYNC_IO", header: "<unistd.h>".}: cint

-  POSIX_PRIO_IO* {.importc: "_POSIX_PRIO_IO", header: "<unistd.h>".}: cint

-  POSIX_SYNC_IO* {.importc: "_POSIX_SYNC_IO", header: "<unistd.h>".}: cint

-  F_OK* {.importc: "F_OK", header: "<unistd.h>".}: cint

-  R_OK* {.importc: "R_OK", header: "<unistd.h>".}: cint

-  W_OK* {.importc: "W_OK", header: "<unistd.h>".}: cint

-  X_OK* {.importc: "X_OK", header: "<unistd.h>".}: cint

-

-  CS_PATH* {.importc: "_CS_PATH", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_ILP32_OFF32_CFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFF32_CFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_ILP32_OFF32_LDFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFF32_LDFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_ILP32_OFF32_LIBS* {.importc: "_CS_POSIX_V6_ILP32_OFF32_LIBS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_ILP32_OFFBIG_CFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_ILP32_OFFBIG_LIBS* {.importc: "_CS_POSIX_V6_ILP32_OFFBIG_LIBS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_LP64_OFF64_CFLAGS* {.importc: "_CS_POSIX_V6_LP64_OFF64_CFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_LP64_OFF64_LDFLAGS* {.importc: "_CS_POSIX_V6_LP64_OFF64_LDFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_LP64_OFF64_LIBS* {.importc: "_CS_POSIX_V6_LP64_OFF64_LIBS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS* {.importc: "_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS* {.importc: "_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_LPBIG_OFFBIG_LIBS* {.importc: "_CS_POSIX_V6_LPBIG_OFFBIG_LIBS", header: "<unistd.h>".}: cint

-  CS_POSIX_V6_WIDTH_RESTRICTED_ENVS* {.importc: "_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS", header: "<unistd.h>".}: cint

-  F_LOCK* {.importc: "F_LOCK", header: "<unistd.h>".}: cint

-  F_TEST* {.importc: "F_TEST", header: "<unistd.h>".}: cint

-  F_TLOCK* {.importc: "F_TLOCK", header: "<unistd.h>".}: cint

-  F_ULOCK* {.importc: "F_ULOCK", header: "<unistd.h>".}: cint

-  PC_2_SYMLINKS* {.importc: "_PC_2_SYMLINKS", header: "<unistd.h>".}: cint

-  PC_ALLOC_SIZE_MIN* {.importc: "_PC_ALLOC_SIZE_MIN", header: "<unistd.h>".}: cint

-  PC_ASYNC_IO* {.importc: "_PC_ASYNC_IO", header: "<unistd.h>".}: cint

-  PC_CHOWN_RESTRICTED* {.importc: "_PC_CHOWN_RESTRICTED", header: "<unistd.h>".}: cint

-  PC_FILESIZEBITS* {.importc: "_PC_FILESIZEBITS", header: "<unistd.h>".}: cint

-  PC_LINK_MAX* {.importc: "_PC_LINK_MAX", header: "<unistd.h>".}: cint

-  PC_MAX_CANON* {.importc: "_PC_MAX_CANON", header: "<unistd.h>".}: cint

-

-  PC_MAX_INPUT*{.importc: "_PC_MAX_INPUT", header: "<unistd.h>".}: cint

-  PC_NAME_MAX*{.importc: "_PC_NAME_MAX", header: "<unistd.h>".}: cint

-  PC_NO_TRUNC*{.importc: "_PC_NO_TRUNC", header: "<unistd.h>".}: cint

-  PC_PATH_MAX*{.importc: "_PC_PATH_MAX", header: "<unistd.h>".}: cint

-  PC_PIPE_BUF*{.importc: "_PC_PIPE_BUF", header: "<unistd.h>".}: cint

-  PC_PRIO_IO*{.importc: "_PC_PRIO_IO", header: "<unistd.h>".}: cint

-  PC_REC_INCR_XFER_SIZE*{.importc: "_PC_REC_INCR_XFER_SIZE", header: "<unistd.h>".}: cint

-  PC_REC_MIN_XFER_SIZE*{.importc: "_PC_REC_MIN_XFER_SIZE", header: "<unistd.h>".}: cint

-  PC_REC_XFER_ALIGN*{.importc: "_PC_REC_XFER_ALIGN", header: "<unistd.h>".}: cint

-  PC_SYMLINK_MAX*{.importc: "_PC_SYMLINK_MAX", header: "<unistd.h>".}: cint

-  PC_SYNC_IO*{.importc: "_PC_SYNC_IO", header: "<unistd.h>".}: cint

-  PC_VDISABLE*{.importc: "_PC_VDISABLE", header: "<unistd.h>".}: cint

-  SC_2_C_BIND*{.importc: "_SC_2_C_BIND", header: "<unistd.h>".}: cint

-  SC_2_C_DEV*{.importc: "_SC_2_C_DEV", header: "<unistd.h>".}: cint

-  SC_2_CHAR_TERM*{.importc: "_SC_2_CHAR_TERM", header: "<unistd.h>".}: cint

-  SC_2_FORT_DEV*{.importc: "_SC_2_FORT_DEV", header: "<unistd.h>".}: cint

-  SC_2_FORT_RUN*{.importc: "_SC_2_FORT_RUN", header: "<unistd.h>".}: cint

-  SC_2_LOCALEDEF*{.importc: "_SC_2_LOCALEDEF", header: "<unistd.h>".}: cint

-  SC_2_PBS*{.importc: "_SC_2_PBS", header: "<unistd.h>".}: cint

-  SC_2_PBS_ACCOUNTING*{.importc: "_SC_2_PBS_ACCOUNTING", header: "<unistd.h>".}: cint

-  SC_2_PBS_CHECKPOINT*{.importc: "_SC_2_PBS_CHECKPOINT", header: "<unistd.h>".}: cint

-  SC_2_PBS_LOCATE*{.importc: "_SC_2_PBS_LOCATE", header: "<unistd.h>".}: cint

-  SC_2_PBS_MESSAGE*{.importc: "_SC_2_PBS_MESSAGE", header: "<unistd.h>".}: cint

-  SC_2_PBS_TRACK*{.importc: "_SC_2_PBS_TRACK", header: "<unistd.h>".}: cint

-  SC_2_SW_DEV*{.importc: "_SC_2_SW_DEV", header: "<unistd.h>".}: cint

-  SC_2_UPE*{.importc: "_SC_2_UPE", header: "<unistd.h>".}: cint

-  SC_2_VERSION*{.importc: "_SC_2_VERSION", header: "<unistd.h>".}: cint

-  SC_ADVISORY_INFO*{.importc: "_SC_ADVISORY_INFO", header: "<unistd.h>".}: cint

-  SC_AIO_LISTIO_MAX*{.importc: "_SC_AIO_LISTIO_MAX", header: "<unistd.h>".}: cint

-  SC_AIO_MAX*{.importc: "_SC_AIO_MAX", header: "<unistd.h>".}: cint

-  SC_AIO_PRIO_DELTA_MAX*{.importc: "_SC_AIO_PRIO_DELTA_MAX", header: "<unistd.h>".}: cint

-  SC_ARG_MAX*{.importc: "_SC_ARG_MAX", header: "<unistd.h>".}: cint

-  SC_ASYNCHRONOUS_IO*{.importc: "_SC_ASYNCHRONOUS_IO", header: "<unistd.h>".}: cint

-  SC_ATEXIT_MAX*{.importc: "_SC_ATEXIT_MAX", header: "<unistd.h>".}: cint

-  SC_BARRIERS*{.importc: "_SC_BARRIERS", header: "<unistd.h>".}: cint

-  SC_BC_BASE_MAX*{.importc: "_SC_BC_BASE_MAX", header: "<unistd.h>".}: cint

-  SC_BC_DIM_MAX*{.importc: "_SC_BC_DIM_MAX", header: "<unistd.h>".}: cint

-  SC_BC_SCALE_MAX*{.importc: "_SC_BC_SCALE_MAX", header: "<unistd.h>".}: cint

-  SC_BC_STRING_MAX*{.importc: "_SC_BC_STRING_MAX", header: "<unistd.h>".}: cint

-  SC_CHILD_MAX*{.importc: "_SC_CHILD_MAX", header: "<unistd.h>".}: cint

-  SC_CLK_TCK*{.importc: "_SC_CLK_TCK", header: "<unistd.h>".}: cint

-  SC_CLOCK_SELECTION*{.importc: "_SC_CLOCK_SELECTION", header: "<unistd.h>".}: cint

-  SC_COLL_WEIGHTS_MAX*{.importc: "_SC_COLL_WEIGHTS_MAX", header: "<unistd.h>".}: cint

-  SC_CPUTIME*{.importc: "_SC_CPUTIME", header: "<unistd.h>".}: cint

-  SC_DELAYTIMER_MAX*{.importc: "_SC_DELAYTIMER_MAX", header: "<unistd.h>".}: cint

-  SC_EXPR_NEST_MAX*{.importc: "_SC_EXPR_NEST_MAX", header: "<unistd.h>".}: cint

-  SC_FSYNC*{.importc: "_SC_FSYNC", header: "<unistd.h>".}: cint

-  SC_GETGR_R_SIZE_MAX*{.importc: "_SC_GETGR_R_SIZE_MAX", header: "<unistd.h>".}: cint

-  SC_GETPW_R_SIZE_MAX*{.importc: "_SC_GETPW_R_SIZE_MAX", header: "<unistd.h>".}: cint

-  SC_HOST_NAME_MAX*{.importc: "_SC_HOST_NAME_MAX", header: "<unistd.h>".}: cint

-  SC_IOV_MAX*{.importc: "_SC_IOV_MAX", header: "<unistd.h>".}: cint

-  SC_IPV6*{.importc: "_SC_IPV6", header: "<unistd.h>".}: cint

-  SC_JOB_CONTROL*{.importc: "_SC_JOB_CONTROL", header: "<unistd.h>".}: cint

-  SC_LINE_MAX*{.importc: "_SC_LINE_MAX", header: "<unistd.h>".}: cint

-  SC_LOGIN_NAME_MAX*{.importc: "_SC_LOGIN_NAME_MAX", header: "<unistd.h>".}: cint

-  SC_MAPPED_FILES*{.importc: "_SC_MAPPED_FILES", header: "<unistd.h>".}: cint

-  SC_MEMLOCK*{.importc: "_SC_MEMLOCK", header: "<unistd.h>".}: cint

-  SC_MEMLOCK_RANGE*{.importc: "_SC_MEMLOCK_RANGE", header: "<unistd.h>".}: cint

-  SC_MEMORY_PROTECTION*{.importc: "_SC_MEMORY_PROTECTION", header: "<unistd.h>".}: cint

-  SC_MESSAGE_PASSING*{.importc: "_SC_MESSAGE_PASSING", header: "<unistd.h>".}: cint

-  SC_MONOTONIC_CLOCK*{.importc: "_SC_MONOTONIC_CLOCK", header: "<unistd.h>".}: cint

-  SC_MQ_OPEN_MAX*{.importc: "_SC_MQ_OPEN_MAX", header: "<unistd.h>".}: cint

-  SC_MQ_PRIO_MAX*{.importc: "_SC_MQ_PRIO_MAX", header: "<unistd.h>".}: cint

-  SC_NGROUPS_MAX*{.importc: "_SC_NGROUPS_MAX", header: "<unistd.h>".}: cint

-  SC_OPEN_MAX*{.importc: "_SC_OPEN_MAX", header: "<unistd.h>".}: cint

-  SC_PAGE_SIZE*{.importc: "_SC_PAGE_SIZE", header: "<unistd.h>".}: cint

-  SC_PRIORITIZED_IO*{.importc: "_SC_PRIORITIZED_IO", header: "<unistd.h>".}: cint

-  SC_PRIORITY_SCHEDULING*{.importc: "_SC_PRIORITY_SCHEDULING", header: "<unistd.h>".}: cint

-  SC_RAW_SOCKETS*{.importc: "_SC_RAW_SOCKETS", header: "<unistd.h>".}: cint

-  SC_RE_DUP_MAX*{.importc: "_SC_RE_DUP_MAX", header: "<unistd.h>".}: cint

-  SC_READER_WRITER_LOCKS*{.importc: "_SC_READER_WRITER_LOCKS", header: "<unistd.h>".}: cint

-  SC_REALTIME_SIGNALS*{.importc: "_SC_REALTIME_SIGNALS", header: "<unistd.h>".}: cint

-  SC_REGEXP*{.importc: "_SC_REGEXP", header: "<unistd.h>".}: cint

-  SC_RTSIG_MAX*{.importc: "_SC_RTSIG_MAX", header: "<unistd.h>".}: cint

-  SC_SAVED_IDS*{.importc: "_SC_SAVED_IDS", header: "<unistd.h>".}: cint

-  SC_SEM_NSEMS_MAX*{.importc: "_SC_SEM_NSEMS_MAX", header: "<unistd.h>".}: cint

-  SC_SEM_VALUE_MAX*{.importc: "_SC_SEM_VALUE_MAX", header: "<unistd.h>".}: cint

-  SC_SEMAPHORES*{.importc: "_SC_SEMAPHORES", header: "<unistd.h>".}: cint

-  SC_SHARED_MEMORY_OBJECTS*{.importc: "_SC_SHARED_MEMORY_OBJECTS", header: "<unistd.h>".}: cint

-  SC_SHELL*{.importc: "_SC_SHELL", header: "<unistd.h>".}: cint

-  SC_SIGQUEUE_MAX*{.importc: "_SC_SIGQUEUE_MAX", header: "<unistd.h>".}: cint

-  SC_SPAWN*{.importc: "_SC_SPAWN", header: "<unistd.h>".}: cint

-  SC_SPIN_LOCKS*{.importc: "_SC_SPIN_LOCKS", header: "<unistd.h>".}: cint

-  SC_SPORADIC_SERVER*{.importc: "_SC_SPORADIC_SERVER", header: "<unistd.h>".}: cint

-  SC_SS_REPL_MAX*{.importc: "_SC_SS_REPL_MAX", header: "<unistd.h>".}: cint

-  SC_STREAM_MAX*{.importc: "_SC_STREAM_MAX", header: "<unistd.h>".}: cint

-  SC_SYMLOOP_MAX*{.importc: "_SC_SYMLOOP_MAX", header: "<unistd.h>".}: cint

-  SC_SYNCHRONIZED_IO*{.importc: "_SC_SYNCHRONIZED_IO", header: "<unistd.h>".}: cint

-  SC_THREAD_ATTR_STACKADDR*{.importc: "_SC_THREAD_ATTR_STACKADDR", header: "<unistd.h>".}: cint

-  SC_THREAD_ATTR_STACKSIZE*{.importc: "_SC_THREAD_ATTR_STACKSIZE", header: "<unistd.h>".}: cint

-  SC_THREAD_CPUTIME*{.importc: "_SC_THREAD_CPUTIME", header: "<unistd.h>".}: cint

-  SC_THREAD_DESTRUCTOR_ITERATIONS*{.importc: "_SC_THREAD_DESTRUCTOR_ITERATIONS", header: "<unistd.h>".}: cint

-  SC_THREAD_KEYS_MAX*{.importc: "_SC_THREAD_KEYS_MAX", header: "<unistd.h>".}: cint

-  SC_THREAD_PRIO_INHERIT*{.importc: "_SC_THREAD_PRIO_INHERIT", header: "<unistd.h>".}: cint

-  SC_THREAD_PRIO_PROTECT*{.importc: "_SC_THREAD_PRIO_PROTECT", header: "<unistd.h>".}: cint

-  SC_THREAD_PRIORITY_SCHEDULING*{.importc: "_SC_THREAD_PRIORITY_SCHEDULING", header: "<unistd.h>".}: cint

-  SC_THREAD_PROCESS_SHARED*{.importc: "_SC_THREAD_PROCESS_SHARED", header: "<unistd.h>".}: cint

-  SC_THREAD_SAFE_FUNCTIONS*{.importc: "_SC_THREAD_SAFE_FUNCTIONS", header: "<unistd.h>".}: cint

-  SC_THREAD_SPORADIC_SERVER*{.importc: "_SC_THREAD_SPORADIC_SERVER", header: "<unistd.h>".}: cint

-  SC_THREAD_STACK_MIN*{.importc: "_SC_THREAD_STACK_MIN", header: "<unistd.h>".}: cint

-  SC_THREAD_THREADS_MAX*{.importc: "_SC_THREAD_THREADS_MAX", header: "<unistd.h>".}: cint

-  SC_THREADS*{.importc: "_SC_THREADS", header: "<unistd.h>".}: cint

-  SC_TIMEOUTS*{.importc: "_SC_TIMEOUTS", header: "<unistd.h>".}: cint

-  SC_TIMER_MAX*{.importc: "_SC_TIMER_MAX", header: "<unistd.h>".}: cint

-  SC_TIMERS*{.importc: "_SC_TIMERS", header: "<unistd.h>".}: cint

-  SC_TRACE*{.importc: "_SC_TRACE", header: "<unistd.h>".}: cint

-  SC_TRACE_EVENT_FILTER*{.importc: "_SC_TRACE_EVENT_FILTER", header: "<unistd.h>".}: cint

-  SC_TRACE_EVENT_NAME_MAX*{.importc: "_SC_TRACE_EVENT_NAME_MAX", header: "<unistd.h>".}: cint

-  SC_TRACE_INHERIT*{.importc: "_SC_TRACE_INHERIT", header: "<unistd.h>".}: cint

-  SC_TRACE_LOG*{.importc: "_SC_TRACE_LOG", header: "<unistd.h>".}: cint

-  SC_TRACE_NAME_MAX*{.importc: "_SC_TRACE_NAME_MAX", header: "<unistd.h>".}: cint

-  SC_TRACE_SYS_MAX*{.importc: "_SC_TRACE_SYS_MAX", header: "<unistd.h>".}: cint

-  SC_TRACE_USER_EVENT_MAX*{.importc: "_SC_TRACE_USER_EVENT_MAX", header: "<unistd.h>".}: cint

-  SC_TTY_NAME_MAX*{.importc: "_SC_TTY_NAME_MAX", header: "<unistd.h>".}: cint

-  SC_TYPED_MEMORY_OBJECTS*{.importc: "_SC_TYPED_MEMORY_OBJECTS", header: "<unistd.h>".}: cint

-  SC_TZNAME_MAX*{.importc: "_SC_TZNAME_MAX", header: "<unistd.h>".}: cint

-  SC_V6_ILP32_OFF32*{.importc: "_SC_V6_ILP32_OFF32", header: "<unistd.h>".}: cint

-  SC_V6_ILP32_OFFBIG*{.importc: "_SC_V6_ILP32_OFFBIG", header: "<unistd.h>".}: cint

-  SC_V6_LP64_OFF64*{.importc: "_SC_V6_LP64_OFF64", header: "<unistd.h>".}: cint

-  SC_V6_LPBIG_OFFBIG*{.importc: "_SC_V6_LPBIG_OFFBIG", header: "<unistd.h>".}: cint

-  SC_VERSION*{.importc: "_SC_VERSION", header: "<unistd.h>".}: cint

-  SC_XBS5_ILP32_OFF32*{.importc: "_SC_XBS5_ILP32_OFF32", header: "<unistd.h>".}: cint

-  SC_XBS5_ILP32_OFFBIG*{.importc: "_SC_XBS5_ILP32_OFFBIG", header: "<unistd.h>".}: cint

-  SC_XBS5_LP64_OFF64*{.importc: "_SC_XBS5_LP64_OFF64", header: "<unistd.h>".}: cint

+  errno* {.importc, header: "<errno.h>".}: cint ## error variable
+  daylight* {.importc, header: "<time.h>".}: cint
+  timezone* {.importc, header: "<time.h>".}: int
+  
+# Constants as variables:
+when hasAioH:
+  var
+    AIO_ALLDONE* {.importc, header: "<aio.h>".}: cint
+      ## A return value indicating that none of the requested operations 
+      ## could be canceled since they are already complete.
+    AIO_CANCELED* {.importc, header: "<aio.h>".}: cint
+      ## A return value indicating that all requested operations have
+      ## been canceled.
+    AIO_NOTCANCELED* {.importc, header: "<aio.h>".}: cint
+      ## A return value indicating that some of the requested operations could 
+      ## not be canceled since they are in progress.
+    LIO_NOP* {.importc, header: "<aio.h>".}: cint
+      ## A lio_listio() element operation option indicating that no transfer is
+      ## requested.
+    LIO_NOWAIT* {.importc, header: "<aio.h>".}: cint
+      ## A lio_listio() synchronization operation indicating that the calling 
+      ## thread is to continue execution while the lio_listio() operation is 
+      ## being performed, and no notification is given when the operation is
+      ## complete.
+    LIO_READ* {.importc, header: "<aio.h>".}: cint
+      ## A lio_listio() element operation option requesting a read.
+    LIO_WAIT* {.importc, header: "<aio.h>".}: cint
+      ## A lio_listio() synchronization operation indicating that the calling 
+      ## thread is to suspend until the lio_listio() operation is complete.
+    LIO_WRITE* {.importc, header: "<aio.h>".}: cint
+      ## A lio_listio() element operation option requesting a write.
+
+var
+  RTLD_LAZY* {.importc, header: "<dlfcn.h>".}: cint
+    ## Relocations are performed at an implementation-defined time.
+  RTLD_NOW* {.importc, header: "<dlfcn.h>".}: cint
+    ## Relocations are performed when the object is loaded.
+  RTLD_GLOBAL* {.importc, header: "<dlfcn.h>".}: cint
+    ## All symbols are available for relocation processing of other modules.
+  RTLD_LOCAL* {.importc, header: "<dlfcn.h>".}: cint
+    ## All symbols are not made available for relocation processing by 
+    ## other modules. 
+    
+  E2BIG* {.importc, header: "<errno.h>".}: cint
+      ## Argument list too long.
+  EACCES* {.importc, header: "<errno.h>".}: cint
+      ## Permission denied.
+  EADDRINUSE* {.importc, header: "<errno.h>".}: cint
+      ## Address in use.
+  EADDRNOTAVAIL* {.importc, header: "<errno.h>".}: cint
+      ## Address not available.
+  EAFNOSUPPORT* {.importc, header: "<errno.h>".}: cint
+      ## Address family not supported.
+  EAGAIN* {.importc, header: "<errno.h>".}: cint
+      ## Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).
+  EALREADY* {.importc, header: "<errno.h>".}: cint
+      ## Connection already in progress.
+  EBADF* {.importc, header: "<errno.h>".}: cint
+      ## Bad file descriptor.
+  EBADMSG* {.importc, header: "<errno.h>".}: cint
+      ## Bad message.
+  EBUSY* {.importc, header: "<errno.h>".}: cint
+      ## Device or resource busy.
+  ECANCELED* {.importc, header: "<errno.h>".}: cint
+      ## Operation canceled.
+  ECHILD* {.importc, header: "<errno.h>".}: cint
+      ## No child processes.
+  ECONNABORTED* {.importc, header: "<errno.h>".}: cint
+      ## Connection aborted.
+  ECONNREFUSED* {.importc, header: "<errno.h>".}: cint
+      ## Connection refused.
+  ECONNRESET* {.importc, header: "<errno.h>".}: cint
+      ## Connection reset.
+  EDEADLK* {.importc, header: "<errno.h>".}: cint
+      ## Resource deadlock would occur.
+  EDESTADDRREQ* {.importc, header: "<errno.h>".}: cint
+      ## Destination address required.
+  EDOM* {.importc, header: "<errno.h>".}: cint
+      ## Mathematics argument out of domain of function.
+  EDQUOT* {.importc, header: "<errno.h>".}: cint
+      ## Reserved.
+  EEXIST* {.importc, header: "<errno.h>".}: cint
+      ## File exists.
+  EFAULT* {.importc, header: "<errno.h>".}: cint
+      ## Bad address.
+  EFBIG* {.importc, header: "<errno.h>".}: cint
+      ## File too large.
+  EHOSTUNREACH* {.importc, header: "<errno.h>".}: cint
+      ## Host is unreachable.
+  EIDRM* {.importc, header: "<errno.h>".}: cint
+      ## Identifier removed.
+  EILSEQ* {.importc, header: "<errno.h>".}: cint
+      ## Illegal byte sequence.
+  EINPROGRESS* {.importc, header: "<errno.h>".}: cint
+      ## Operation in progress.
+  EINTR* {.importc, header: "<errno.h>".}: cint
+      ## Interrupted function.
+  EINVAL* {.importc, header: "<errno.h>".}: cint
+      ## Invalid argument.
+  EIO* {.importc, header: "<errno.h>".}: cint
+      ## I/O error.
+  EISCONN* {.importc, header: "<errno.h>".}: cint
+      ## Socket is connected.
+  EISDIR* {.importc, header: "<errno.h>".}: cint
+      ## Is a directory.
+  ELOOP* {.importc, header: "<errno.h>".}: cint
+      ## Too many levels of symbolic links.
+  EMFILE* {.importc, header: "<errno.h>".}: cint
+      ## Too many open files.
+  EMLINK* {.importc, header: "<errno.h>".}: cint
+      ## Too many links.
+  EMSGSIZE* {.importc, header: "<errno.h>".}: cint
+      ## Message too large.
+  EMULTIHOP* {.importc, header: "<errno.h>".}: cint
+      ## Reserved.
+  ENAMETOOLONG* {.importc, header: "<errno.h>".}: cint
+      ## Filename too long.
+  ENETDOWN* {.importc, header: "<errno.h>".}: cint
+      ## Network is down.
+  ENETRESET* {.importc, header: "<errno.h>".}: cint
+      ## Connection aborted by network.
+  ENETUNREACH* {.importc, header: "<errno.h>".}: cint
+      ## Network unreachable.
+  ENFILE* {.importc, header: "<errno.h>".}: cint
+      ## Too many files open in system.
+  ENOBUFS* {.importc, header: "<errno.h>".}: cint
+      ## No buffer space available.
+  ENODATA* {.importc, header: "<errno.h>".}: cint
+      ## No message is available on the STREAM head read queue.
+  ENODEV* {.importc, header: "<errno.h>".}: cint
+      ## No such device.
+  ENOENT* {.importc, header: "<errno.h>".}: cint
+      ## No such file or directory.
+  ENOEXEC* {.importc, header: "<errno.h>".}: cint
+      ## Executable file format error.
+  ENOLCK* {.importc, header: "<errno.h>".}: cint
+      ## No locks available.
+  ENOLINK* {.importc, header: "<errno.h>".}: cint
+      ## Reserved.
+  ENOMEM* {.importc, header: "<errno.h>".}: cint
+      ## Not enough space.
+  ENOMSG* {.importc, header: "<errno.h>".}: cint
+      ## No message of the desired type.
+  ENOPROTOOPT* {.importc, header: "<errno.h>".}: cint
+      ## Protocol not available.
+  ENOSPC* {.importc, header: "<errno.h>".}: cint
+      ## No space left on device.
+  ENOSR* {.importc, header: "<errno.h>".}: cint
+      ## No STREAM resources.
+  ENOSTR* {.importc, header: "<errno.h>".}: cint
+      ## Not a STREAM.
+  ENOSYS* {.importc, header: "<errno.h>".}: cint
+      ## Function not supported.
+  ENOTCONN* {.importc, header: "<errno.h>".}: cint
+      ## The socket is not connected.
+  ENOTDIR* {.importc, header: "<errno.h>".}: cint
+      ## Not a directory.
+  ENOTEMPTY* {.importc, header: "<errno.h>".}: cint
+      ## Directory not empty.
+  ENOTSOCK* {.importc, header: "<errno.h>".}: cint
+      ## Not a socket.
+  ENOTSUP* {.importc, header: "<errno.h>".}: cint
+      ## Not supported.
+  ENOTTY* {.importc, header: "<errno.h>".}: cint
+      ## Inappropriate I/O control operation.
+  ENXIO* {.importc, header: "<errno.h>".}: cint
+      ## No such device or address.
+  EOPNOTSUPP* {.importc, header: "<errno.h>".}: cint
+      ## Operation not supported on socket.
+  EOVERFLOW* {.importc, header: "<errno.h>".}: cint
+      ## Value too large to be stored in data type.
+  EPERM* {.importc, header: "<errno.h>".}: cint
+      ## Operation not permitted.
+  EPIPE* {.importc, header: "<errno.h>".}: cint
+      ## Broken pipe.
+  EPROTO* {.importc, header: "<errno.h>".}: cint
+      ## Protocol error.
+  EPROTONOSUPPORT* {.importc, header: "<errno.h>".}: cint
+      ## Protocol not supported.
+  EPROTOTYPE* {.importc, header: "<errno.h>".}: cint
+      ## Protocol wrong type for socket.
+  ERANGE* {.importc, header: "<errno.h>".}: cint
+      ## Result too large.
+  EROFS* {.importc, header: "<errno.h>".}: cint
+      ## Read-only file system.
+  ESPIPE* {.importc, header: "<errno.h>".}: cint
+      ## Invalid seek.
+  ESRCH* {.importc, header: "<errno.h>".}: cint
+      ## No such process.
+  ESTALE* {.importc, header: "<errno.h>".}: cint
+      ## Reserved.
+  ETIME* {.importc, header: "<errno.h>".}: cint
+      ## Stream ioctl() timeout.
+  ETIMEDOUT* {.importc, header: "<errno.h>".}: cint
+      ## Connection timed out.
+  ETXTBSY* {.importc, header: "<errno.h>".}: cint
+      ## Text file busy.
+  EWOULDBLOCK* {.importc, header: "<errno.h>".}: cint
+      ## Operation would block (may be the same value as [EAGAIN]).
+  EXDEV* {.importc, header: "<errno.h>".}: cint
+      ## Cross-device link.   
+
+  F_DUPFD* {.importc, header: "<fcntl.h>".}: cint
+    ## Duplicate file descriptor.
+  F_GETFD* {.importc, header: "<fcntl.h>".}: cint
+    ## Get file descriptor flags.
+  F_SETFD* {.importc, header: "<fcntl.h>".}: cint
+    ## Set file descriptor flags.
+  F_GETFL* {.importc, header: "<fcntl.h>".}: cint
+    ## Get file status flags and file access modes.
+  F_SETFL* {.importc, header: "<fcntl.h>".}: cint
+    ## Set file status flags.
+  F_GETLK* {.importc, header: "<fcntl.h>".}: cint
+    ## Get record locking information.
+  F_SETLK* {.importc, header: "<fcntl.h>".}: cint
+    ## Set record locking information.
+  F_SETLKW* {.importc, header: "<fcntl.h>".}: cint
+    ## Set record locking information; wait if blocked.
+  F_GETOWN* {.importc, header: "<fcntl.h>".}: cint
+    ## Get process or process group ID to receive SIGURG signals.
+  F_SETOWN* {.importc, header: "<fcntl.h>".}: cint
+    ## Set process or process group ID to receive SIGURG signals. 
+  FD_CLOEXEC* {.importc, header: "<fcntl.h>".}: cint
+    ## Close the file descriptor upon execution of an exec family function. 
+  F_RDLCK* {.importc, header: "<fcntl.h>".}: cint
+    ## Shared or read lock.
+  F_UNLCK* {.importc, header: "<fcntl.h>".}: cint
+    ## Unlock.
+  F_WRLCK* {.importc, header: "<fcntl.h>".}: cint
+    ## Exclusive or write lock. 
+  O_CREAT* {.importc, header: "<fcntl.h>".}: cint
+    ## Create file if it does not exist.
+  O_EXCL* {.importc, header: "<fcntl.h>".}: cint
+    ## Exclusive use flag.
+  O_NOCTTY* {.importc, header: "<fcntl.h>".}: cint
+    ## Do not assign controlling terminal.
+  O_TRUNC* {.importc, header: "<fcntl.h>".}: cint
+    ## Truncate flag. 
+  O_APPEND* {.importc, header: "<fcntl.h>".}: cint
+    ## Set append mode.
+  O_DSYNC* {.importc, header: "<fcntl.h>".}: cint
+    ## Write according to synchronized I/O data integrity completion.
+  O_NONBLOCK* {.importc, header: "<fcntl.h>".}: cint
+    ## Non-blocking mode.
+  O_RSYNC* {.importc, header: "<fcntl.h>".}: cint
+    ## Synchronized read I/O operations.
+  O_SYNC* {.importc, header: "<fcntl.h>".}: cint
+    ## Write according to synchronized I/O file integrity completion. 
+  O_ACCMODE* {.importc, header: "<fcntl.h>".}: cint
+    ## Mask for file access modes.      
+  O_RDONLY* {.importc, header: "<fcntl.h>".}: cint
+    ## Open for reading only.
+  O_RDWR* {.importc, header: "<fcntl.h>".}: cint
+    ## Open for reading and writing.
+  O_WRONLY* {.importc, header: "<fcntl.h>".}: cint
+    ## Open for writing only. 
+  POSIX_FADV_NORMAL* {.importc, header: "<fcntl.h>".}: cint
+    ## The application has no advice to give on its behavior with
+    ## respect to the specified data. It is the default characteristic
+    ## if no advice is given for an open file.
+  POSIX_FADV_SEQUENTIAL* {.importc, header: "<fcntl.h>".}: cint
+    ## The application expects to access the specified data 
+    # sequentially from lower offsets to higher offsets.
+  POSIX_FADV_RANDOM* {.importc, header: "<fcntl.h>".}: cint
+    ## The application expects to access the specified data in a random order.
+  POSIX_FADV_WILLNEED* {.importc, header: "<fcntl.h>".}: cint
+    ## The application expects to access the specified data in the near future.
+  POSIX_FADV_DONTNEED* {.importc, header: "<fcntl.h>".}: cint
+    ## The application expects that it will not access the specified data
+    ## in the near future.
+  POSIX_FADV_NOREUSE* {.importc, header: "<fcntl.h>".}: cint
+    ## The application expects to access the specified data once and 
+    ## then not reuse it thereafter. 
+
+  FE_DIVBYZERO* {.importc, header: "<fenv.h>".}: cint
+  FE_INEXACT* {.importc, header: "<fenv.h>".}: cint
+  FE_INVALID* {.importc, header: "<fenv.h>".}: cint
+  FE_OVERFLOW* {.importc, header: "<fenv.h>".}: cint
+  FE_UNDERFLOW* {.importc, header: "<fenv.h>".}: cint
+  FE_ALL_EXCEPT* {.importc, header: "<fenv.h>".}: cint
+  FE_DOWNWARD* {.importc, header: "<fenv.h>".}: cint
+  FE_TONEAREST* {.importc, header: "<fenv.h>".}: cint
+  FE_TOWARDZERO* {.importc, header: "<fenv.h>".}: cint
+  FE_UPWARD* {.importc, header: "<fenv.h>".}: cint
+  FE_DFL_ENV* {.importc, header: "<fenv.h>".}: cint
+
+  MM_HARD* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Source of the condition is hardware.
+  MM_SOFT* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Source of the condition is software.
+  MM_FIRM* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Source of the condition is firmware.
+  MM_APPL* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Condition detected by application.
+  MM_UTIL* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Condition detected by utility.
+  MM_OPSYS* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Condition detected by operating system.
+  MM_RECOVER* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Recoverable error.
+  MM_NRECOV* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Non-recoverable error.
+  MM_HALT* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Error causing application to halt.
+  MM_ERROR* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Application has encountered a non-fatal fault.
+  MM_WARNING* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Application has detected unusual non-error condition.
+  MM_INFO* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Informative message.
+  MM_NOSEV* {.importc, header: "<fmtmsg.h>".}: cint
+    ## No severity level provided for the message.
+  MM_PRINT* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Display message on standard error.
+  MM_CONSOLE* {.importc, header: "<fmtmsg.h>".}: cint
+    ## Display message on system console. 
+
+  MM_OK* {.importc, header: "<fmtmsg.h>".}: cint
+    ## The function succeeded.
+  MM_NOTOK* {.importc, header: "<fmtmsg.h>".}: cint
+    ## The function failed completely.
+  MM_NOMSG* {.importc, header: "<fmtmsg.h>".}: cint
+    ## The function was unable to generate a message on standard error, 
+    ## but otherwise succeeded.
+  MM_NOCON* {.importc, header: "<fmtmsg.h>".}: cint
+    ## The function was unable to generate a console message, but 
+    ## otherwise succeeded. 
+    
+  FNM_NOMATCH* {.importc, header: "<fnmatch.h>".}: cint
+    ## The string does not match the specified pattern.
+  FNM_PATHNAME* {.importc, header: "<fnmatch.h>".}: cint
+    ## Slash in string only matches slash in pattern.
+  FNM_PERIOD* {.importc, header: "<fnmatch.h>".}: cint
+    ## Leading period in string must be exactly matched by period in pattern.
+  FNM_NOESCAPE* {.importc, header: "<fnmatch.h>".}: cint
+    ## Disable backslash escaping.
+  FNM_NOSYS* {.importc, header: "<fnmatch.h>".}: cint
+    ## Reserved.
+
+  FTW_F* {.importc, header: "<ftw.h>".}: cint
+    ## File.
+  FTW_D* {.importc, header: "<ftw.h>".}: cint
+    ## Directory.
+  FTW_DNR* {.importc, header: "<ftw.h>".}: cint
+    ## Directory without read permission.
+  FTW_DP* {.importc, header: "<ftw.h>".}: cint
+    ## Directory with subdirectories visited.
+  FTW_NS* {.importc, header: "<ftw.h>".}: cint
+    ## Unknown type; stat() failed.
+  FTW_SL* {.importc, header: "<ftw.h>".}: cint
+    ## Symbolic link.
+  FTW_SLN* {.importc, header: "<ftw.h>".}: cint
+    ## Symbolic link that names a nonexistent file.
+
+  FTW_PHYS* {.importc, header: "<ftw.h>".}: cint
+    ## Physical walk, does not follow symbolic links. Otherwise, nftw() 
+    ## follows links but does not walk down any path that crosses itself.
+  FTW_MOUNT* {.importc, header: "<ftw.h>".}: cint
+    ## The walk does not cross a mount point.
+  FTW_DEPTH* {.importc, header: "<ftw.h>".}: cint
+    ## All subdirectories are visited before the directory itself.
+  FTW_CHDIR* {.importc, header: "<ftw.h>".}: cint
+    ## The walk changes to each directory before reading it. 
+
+  GLOB_APPEND* {.importc, header: "<glob.h>".}: cint
+    ## Append generated pathnames to those previously obtained.
+  GLOB_DOOFFS* {.importc, header: "<glob.h>".}: cint
+    ## Specify how many null pointers to add to the beginning of gl_pathv.
+  GLOB_ERR* {.importc, header: "<glob.h>".}: cint
+    ## Cause glob() to return on error.
+  GLOB_MARK* {.importc, header: "<glob.h>".}: cint
+    ## Each pathname that is a directory that matches pattern has a 
+    ## slash appended.
+  GLOB_NOCHECK* {.importc, header: "<glob.h>".}: cint
+    ## If pattern does not match any pathname, then return a list
+    ## consisting of only pattern.
+  GLOB_NOESCAPE* {.importc, header: "<glob.h>".}: cint
+    ## Disable backslash escaping.
+  GLOB_NOSORT* {.importc, header: "<glob.h>".}: cint
+    ## Do not sort the pathnames returned.
+  GLOB_ABORTED* {.importc, header: "<glob.h>".}: cint
+    ## The scan was stopped because GLOB_ERR was set or errfunc() 
+    ## returned non-zero.
+  GLOB_NOMATCH* {.importc, header: "<glob.h>".}: cint
+    ## The pattern does not match any existing pathname, and GLOB_NOCHECK 
+    ## was not set in flags.
+  GLOB_NOSPACE* {.importc, header: "<glob.h>".}: cint
+    ## An attempt to allocate memory failed.
+  GLOB_NOSYS* {.importc, header: "<glob.h>".}: cint
+    ## Reserved
+
+  CODESET* {.importc, header: "<langinfo.h>".}: cint
+    ## Codeset name.
+  D_T_FMT* {.importc, header: "<langinfo.h>".}: cint
+    ## String for formatting date and time.
+  D_FMT * {.importc, header: "<langinfo.h>".}: cint
+    ## Date format string.
+  T_FMT* {.importc, header: "<langinfo.h>".}: cint
+    ## Time format string.
+  T_FMT_AMPM* {.importc, header: "<langinfo.h>".}: cint
+    ## a.m. or p.m. time format string.
+  AM_STR* {.importc, header: "<langinfo.h>".}: cint
+    ## Ante-meridiem affix.
+  PM_STR* {.importc, header: "<langinfo.h>".}: cint
+    ## Post-meridiem affix.
+  DAY_1* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the first day of the week (for example, Sunday).
+  DAY_2* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the second day of the week (for example, Monday).
+  DAY_3* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the third day of the week (for example, Tuesday).
+  DAY_4* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the fourth day of the week (for example, Wednesday).
+  DAY_5* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the fifth day of the week (for example, Thursday).
+  DAY_6* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the sixth day of the week (for example, Friday).
+  DAY_7* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the seventh day of the week (for example, Saturday).
+  ABDAY_1* {.importc, header: "<langinfo.h>".}: cint
+    ## Abbreviated name of the first day of the week.
+  ABDAY_2* {.importc, header: "<langinfo.h>".}: cint
+  ABDAY_3* {.importc, header: "<langinfo.h>".}: cint
+  ABDAY_4* {.importc, header: "<langinfo.h>".}: cint
+  ABDAY_5* {.importc, header: "<langinfo.h>".}: cint
+  ABDAY_6* {.importc, header: "<langinfo.h>".}: cint
+  ABDAY_7* {.importc, header: "<langinfo.h>".}: cint
+  MON_1* {.importc, header: "<langinfo.h>".}: cint
+    ## Name of the first month of the year.
+  MON_2* {.importc, header: "<langinfo.h>".}: cint
+  MON_3* {.importc, header: "<langinfo.h>".}: cint
+  MON_4* {.importc, header: "<langinfo.h>".}: cint
+  MON_5* {.importc, header: "<langinfo.h>".}: cint
+  MON_6* {.importc, header: "<langinfo.h>".}: cint
+  MON_7* {.importc, header: "<langinfo.h>".}: cint
+  MON_8* {.importc, header: "<langinfo.h>".}: cint
+  MON_9* {.importc, header: "<langinfo.h>".}: cint
+  MON_10* {.importc, header: "<langinfo.h>".}: cint
+  MON_11* {.importc, header: "<langinfo.h>".}: cint
+  MON_12* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_1* {.importc, header: "<langinfo.h>".}: cint
+    ## Abbreviated name of the first month.
+  ABMON_2* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_3* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_4* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_5* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_6* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_7* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_8* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_9* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_10* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_11* {.importc, header: "<langinfo.h>".}: cint
+  ABMON_12* {.importc, header: "<langinfo.h>".}: cint
+  ERA* {.importc, header: "<langinfo.h>".}: cint
+    ## Era description segments.
+  ERA_D_FMT* {.importc, header: "<langinfo.h>".}: cint
+    ## Era date format string.
+  ERA_D_T_FMT* {.importc, header: "<langinfo.h>".}: cint
+    ## Era date and time format string.
+  ERA_T_FMT* {.importc, header: "<langinfo.h>".}: cint
+    ## Era time format string.
+  ALT_DIGITS* {.importc, header: "<langinfo.h>".}: cint
+    ## Alternative symbols for digits.
+  RADIXCHAR* {.importc, header: "<langinfo.h>".}: cint
+    ## Radix character.
+  THOUSEP* {.importc, header: "<langinfo.h>".}: cint
+    ## Separator for thousands.
+  YESEXPR* {.importc, header: "<langinfo.h>".}: cint
+    ## Affirmative response expression.
+  NOEXPR* {.importc, header: "<langinfo.h>".}: cint
+    ## Negative response expression.
+  CRNCYSTR* {.importc, header: "<langinfo.h>".}: cint
+    ## Local currency symbol, preceded by '-' if the symbol 
+    ## should appear before the value, '+' if the symbol should appear 
+    ## after the value, or '.' if the symbol should replace the radix
+    ## character. If the local currency symbol is the empty string, 
+    ## implementations may return the empty string ( "" ).
+
+  LC_ALL* {.importc, header: "<locale.h>".}: cint
+  LC_COLLATE* {.importc, header: "<locale.h>".}: cint
+  LC_CTYPE* {.importc, header: "<locale.h>".}: cint
+  LC_MESSAGES* {.importc, header: "<locale.h>".}: cint
+  LC_MONETARY* {.importc, header: "<locale.h>".}: cint
+  LC_NUMERIC* {.importc, header: "<locale.h>".}: cint
+  LC_TIME* {.importc, header: "<locale.h>".}: cint
+  
+  PTHREAD_BARRIER_SERIAL_THREAD* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CANCEL_ASYNCHRONOUS* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CANCEL_ENABLE* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CANCEL_DEFERRED* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CANCEL_DISABLE* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CANCELED* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_COND_INITIALIZER* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CREATE_DETACHED* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_CREATE_JOINABLE* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_EXPLICIT_SCHED* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_INHERIT_SCHED* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_MUTEX_DEFAULT* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_MUTEX_ERRORCHECK* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_MUTEX_INITIALIZER* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_MUTEX_NORMAL* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_MUTEX_RECURSIVE* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_ONCE_INIT* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_PRIO_INHERIT* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_PRIO_NONE* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_PRIO_PROTECT* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_PROCESS_SHARED* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_PROCESS_PRIVATE* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_SCOPE_PROCESS* {.importc, header: "<pthread.h>".}: cint
+  PTHREAD_SCOPE_SYSTEM* {.importc, header: "<pthread.h>".}: cint
+
+  POSIX_ASYNC_IO* {.importc: "_POSIX_ASYNC_IO", header: "<unistd.h>".}: cint
+  POSIX_PRIO_IO* {.importc: "_POSIX_PRIO_IO", header: "<unistd.h>".}: cint
+  POSIX_SYNC_IO* {.importc: "_POSIX_SYNC_IO", header: "<unistd.h>".}: cint
+  F_OK* {.importc: "F_OK", header: "<unistd.h>".}: cint
+  R_OK* {.importc: "R_OK", header: "<unistd.h>".}: cint
+  W_OK* {.importc: "W_OK", header: "<unistd.h>".}: cint
+  X_OK* {.importc: "X_OK", header: "<unistd.h>".}: cint
+
+  CS_PATH* {.importc: "_CS_PATH", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_ILP32_OFF32_CFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFF32_CFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_ILP32_OFF32_LDFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFF32_LDFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_ILP32_OFF32_LIBS* {.importc: "_CS_POSIX_V6_ILP32_OFF32_LIBS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_ILP32_OFFBIG_CFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS* {.importc: "_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_ILP32_OFFBIG_LIBS* {.importc: "_CS_POSIX_V6_ILP32_OFFBIG_LIBS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_LP64_OFF64_CFLAGS* {.importc: "_CS_POSIX_V6_LP64_OFF64_CFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_LP64_OFF64_LDFLAGS* {.importc: "_CS_POSIX_V6_LP64_OFF64_LDFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_LP64_OFF64_LIBS* {.importc: "_CS_POSIX_V6_LP64_OFF64_LIBS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS* {.importc: "_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS* {.importc: "_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_LPBIG_OFFBIG_LIBS* {.importc: "_CS_POSIX_V6_LPBIG_OFFBIG_LIBS", header: "<unistd.h>".}: cint
+  CS_POSIX_V6_WIDTH_RESTRICTED_ENVS* {.importc: "_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS", header: "<unistd.h>".}: cint
+  F_LOCK* {.importc: "F_LOCK", header: "<unistd.h>".}: cint
+  F_TEST* {.importc: "F_TEST", header: "<unistd.h>".}: cint
+  F_TLOCK* {.importc: "F_TLOCK", header: "<unistd.h>".}: cint
+  F_ULOCK* {.importc: "F_ULOCK", header: "<unistd.h>".}: cint
+  PC_2_SYMLINKS* {.importc: "_PC_2_SYMLINKS", header: "<unistd.h>".}: cint
+  PC_ALLOC_SIZE_MIN* {.importc: "_PC_ALLOC_SIZE_MIN", header: "<unistd.h>".}: cint
+  PC_ASYNC_IO* {.importc: "_PC_ASYNC_IO", header: "<unistd.h>".}: cint
+  PC_CHOWN_RESTRICTED* {.importc: "_PC_CHOWN_RESTRICTED", header: "<unistd.h>".}: cint
+  PC_FILESIZEBITS* {.importc: "_PC_FILESIZEBITS", header: "<unistd.h>".}: cint
+  PC_LINK_MAX* {.importc: "_PC_LINK_MAX", header: "<unistd.h>".}: cint
+  PC_MAX_CANON* {.importc: "_PC_MAX_CANON", header: "<unistd.h>".}: cint
+
+  PC_MAX_INPUT*{.importc: "_PC_MAX_INPUT", header: "<unistd.h>".}: cint
+  PC_NAME_MAX*{.importc: "_PC_NAME_MAX", header: "<unistd.h>".}: cint
+  PC_NO_TRUNC*{.importc: "_PC_NO_TRUNC", header: "<unistd.h>".}: cint
+  PC_PATH_MAX*{.importc: "_PC_PATH_MAX", header: "<unistd.h>".}: cint
+  PC_PIPE_BUF*{.importc: "_PC_PIPE_BUF", header: "<unistd.h>".}: cint
+  PC_PRIO_IO*{.importc: "_PC_PRIO_IO", header: "<unistd.h>".}: cint
+  PC_REC_INCR_XFER_SIZE*{.importc: "_PC_REC_INCR_XFER_SIZE", header: "<unistd.h>".}: cint
+  PC_REC_MIN_XFER_SIZE*{.importc: "_PC_REC_MIN_XFER_SIZE", header: "<unistd.h>".}: cint
+  PC_REC_XFER_ALIGN*{.importc: "_PC_REC_XFER_ALIGN", header: "<unistd.h>".}: cint
+  PC_SYMLINK_MAX*{.importc: "_PC_SYMLINK_MAX", header: "<unistd.h>".}: cint
+  PC_SYNC_IO*{.importc: "_PC_SYNC_IO", header: "<unistd.h>".}: cint
+  PC_VDISABLE*{.importc: "_PC_VDISABLE", header: "<unistd.h>".}: cint
+  SC_2_C_BIND*{.importc: "_SC_2_C_BIND", header: "<unistd.h>".}: cint
+  SC_2_C_DEV*{.importc: "_SC_2_C_DEV", header: "<unistd.h>".}: cint
+  SC_2_CHAR_TERM*{.importc: "_SC_2_CHAR_TERM", header: "<unistd.h>".}: cint
+  SC_2_FORT_DEV*{.importc: "_SC_2_FORT_DEV", header: "<unistd.h>".}: cint
+  SC_2_FORT_RUN*{.importc: "_SC_2_FORT_RUN", header: "<unistd.h>".}: cint
+  SC_2_LOCALEDEF*{.importc: "_SC_2_LOCALEDEF", header: "<unistd.h>".}: cint
+  SC_2_PBS*{.importc: "_SC_2_PBS", header: "<unistd.h>".}: cint
+  SC_2_PBS_ACCOUNTING*{.importc: "_SC_2_PBS_ACCOUNTING", header: "<unistd.h>".}: cint
+  SC_2_PBS_CHECKPOINT*{.importc: "_SC_2_PBS_CHECKPOINT", header: "<unistd.h>".}: cint
+  SC_2_PBS_LOCATE*{.importc: "_SC_2_PBS_LOCATE", header: "<unistd.h>".}: cint
+  SC_2_PBS_MESSAGE*{.importc: "_SC_2_PBS_MESSAGE", header: "<unistd.h>".}: cint
+  SC_2_PBS_TRACK*{.importc: "_SC_2_PBS_TRACK", header: "<unistd.h>".}: cint
+  SC_2_SW_DEV*{.importc: "_SC_2_SW_DEV", header: "<unistd.h>".}: cint
+  SC_2_UPE*{.importc: "_SC_2_UPE", header: "<unistd.h>".}: cint
+  SC_2_VERSION*{.importc: "_SC_2_VERSION", header: "<unistd.h>".}: cint
+  SC_ADVISORY_INFO*{.importc: "_SC_ADVISORY_INFO", header: "<unistd.h>".}: cint
+  SC_AIO_LISTIO_MAX*{.importc: "_SC_AIO_LISTIO_MAX", header: "<unistd.h>".}: cint
+  SC_AIO_MAX*{.importc: "_SC_AIO_MAX", header: "<unistd.h>".}: cint
+  SC_AIO_PRIO_DELTA_MAX*{.importc: "_SC_AIO_PRIO_DELTA_MAX", header: "<unistd.h>".}: cint
+  SC_ARG_MAX*{.importc: "_SC_ARG_MAX", header: "<unistd.h>".}: cint
+  SC_ASYNCHRONOUS_IO*{.importc: "_SC_ASYNCHRONOUS_IO", header: "<unistd.h>".}: cint
+  SC_ATEXIT_MAX*{.importc: "_SC_ATEXIT_MAX", header: "<unistd.h>".}: cint
+  SC_BARRIERS*{.importc: "_SC_BARRIERS", header: "<unistd.h>".}: cint
+  SC_BC_BASE_MAX*{.importc: "_SC_BC_BASE_MAX", header: "<unistd.h>".}: cint
+  SC_BC_DIM_MAX*{.importc: "_SC_BC_DIM_MAX", header: "<unistd.h>".}: cint
+  SC_BC_SCALE_MAX*{.importc: "_SC_BC_SCALE_MAX", header: "<unistd.h>".}: cint
+  SC_BC_STRING_MAX*{.importc: "_SC_BC_STRING_MAX", header: "<unistd.h>".}: cint
+  SC_CHILD_MAX*{.importc: "_SC_CHILD_MAX", header: "<unistd.h>".}: cint
+  SC_CLK_TCK*{.importc: "_SC_CLK_TCK", header: "<unistd.h>".}: cint
+  SC_CLOCK_SELECTION*{.importc: "_SC_CLOCK_SELECTION", header: "<unistd.h>".}: cint
+  SC_COLL_WEIGHTS_MAX*{.importc: "_SC_COLL_WEIGHTS_MAX", header: "<unistd.h>".}: cint
+  SC_CPUTIME*{.importc: "_SC_CPUTIME", header: "<unistd.h>".}: cint
+  SC_DELAYTIMER_MAX*{.importc: "_SC_DELAYTIMER_MAX", header: "<unistd.h>".}: cint
+  SC_EXPR_NEST_MAX*{.importc: "_SC_EXPR_NEST_MAX", header: "<unistd.h>".}: cint
+  SC_FSYNC*{.importc: "_SC_FSYNC", header: "<unistd.h>".}: cint
+  SC_GETGR_R_SIZE_MAX*{.importc: "_SC_GETGR_R_SIZE_MAX", header: "<unistd.h>".}: cint
+  SC_GETPW_R_SIZE_MAX*{.importc: "_SC_GETPW_R_SIZE_MAX", header: "<unistd.h>".}: cint
+  SC_HOST_NAME_MAX*{.importc: "_SC_HOST_NAME_MAX", header: "<unistd.h>".}: cint
+  SC_IOV_MAX*{.importc: "_SC_IOV_MAX", header: "<unistd.h>".}: cint
+  SC_IPV6*{.importc: "_SC_IPV6", header: "<unistd.h>".}: cint
+  SC_JOB_CONTROL*{.importc: "_SC_JOB_CONTROL", header: "<unistd.h>".}: cint
+  SC_LINE_MAX*{.importc: "_SC_LINE_MAX", header: "<unistd.h>".}: cint
+  SC_LOGIN_NAME_MAX*{.importc: "_SC_LOGIN_NAME_MAX", header: "<unistd.h>".}: cint
+  SC_MAPPED_FILES*{.importc: "_SC_MAPPED_FILES", header: "<unistd.h>".}: cint
+  SC_MEMLOCK*{.importc: "_SC_MEMLOCK", header: "<unistd.h>".}: cint
+  SC_MEMLOCK_RANGE*{.importc: "_SC_MEMLOCK_RANGE", header: "<unistd.h>".}: cint
+  SC_MEMORY_PROTECTION*{.importc: "_SC_MEMORY_PROTECTION", header: "<unistd.h>".}: cint
+  SC_MESSAGE_PASSING*{.importc: "_SC_MESSAGE_PASSING", header: "<unistd.h>".}: cint
+  SC_MONOTONIC_CLOCK*{.importc: "_SC_MONOTONIC_CLOCK", header: "<unistd.h>".}: cint
+  SC_MQ_OPEN_MAX*{.importc: "_SC_MQ_OPEN_MAX", header: "<unistd.h>".}: cint
+  SC_MQ_PRIO_MAX*{.importc: "_SC_MQ_PRIO_MAX", header: "<unistd.h>".}: cint
+  SC_NGROUPS_MAX*{.importc: "_SC_NGROUPS_MAX", header: "<unistd.h>".}: cint
+  SC_OPEN_MAX*{.importc: "_SC_OPEN_MAX", header: "<unistd.h>".}: cint
+  SC_PAGE_SIZE*{.importc: "_SC_PAGE_SIZE", header: "<unistd.h>".}: cint
+  SC_PRIORITIZED_IO*{.importc: "_SC_PRIORITIZED_IO", header: "<unistd.h>".}: cint
+  SC_PRIORITY_SCHEDULING*{.importc: "_SC_PRIORITY_SCHEDULING", header: "<unistd.h>".}: cint
+  SC_RAW_SOCKETS*{.importc: "_SC_RAW_SOCKETS", header: "<unistd.h>".}: cint
+  SC_RE_DUP_MAX*{.importc: "_SC_RE_DUP_MAX", header: "<unistd.h>".}: cint
+  SC_READER_WRITER_LOCKS*{.importc: "_SC_READER_WRITER_LOCKS", header: "<unistd.h>".}: cint
+  SC_REALTIME_SIGNALS*{.importc: "_SC_REALTIME_SIGNALS", header: "<unistd.h>".}: cint
+  SC_REGEXP*{.importc: "_SC_REGEXP", header: "<unistd.h>".}: cint
+  SC_RTSIG_MAX*{.importc: "_SC_RTSIG_MAX", header: "<unistd.h>".}: cint
+  SC_SAVED_IDS*{.importc: "_SC_SAVED_IDS", header: "<unistd.h>".}: cint
+  SC_SEM_NSEMS_MAX*{.importc: "_SC_SEM_NSEMS_MAX", header: "<unistd.h>".}: cint
+  SC_SEM_VALUE_MAX*{.importc: "_SC_SEM_VALUE_MAX", header: "<unistd.h>".}: cint
+  SC_SEMAPHORES*{.importc: "_SC_SEMAPHORES", header: "<unistd.h>".}: cint
+  SC_SHARED_MEMORY_OBJECTS*{.importc: "_SC_SHARED_MEMORY_OBJECTS", header: "<unistd.h>".}: cint
+  SC_SHELL*{.importc: "_SC_SHELL", header: "<unistd.h>".}: cint
+  SC_SIGQUEUE_MAX*{.importc: "_SC_SIGQUEUE_MAX", header: "<unistd.h>".}: cint
+  SC_SPAWN*{.importc: "_SC_SPAWN", header: "<unistd.h>".}: cint
+  SC_SPIN_LOCKS*{.importc: "_SC_SPIN_LOCKS", header: "<unistd.h>".}: cint
+  SC_SPORADIC_SERVER*{.importc: "_SC_SPORADIC_SERVER", header: "<unistd.h>".}: cint
+  SC_SS_REPL_MAX*{.importc: "_SC_SS_REPL_MAX", header: "<unistd.h>".}: cint
+  SC_STREAM_MAX*{.importc: "_SC_STREAM_MAX", header: "<unistd.h>".}: cint
+  SC_SYMLOOP_MAX*{.importc: "_SC_SYMLOOP_MAX", header: "<unistd.h>".}: cint
+  SC_SYNCHRONIZED_IO*{.importc: "_SC_SYNCHRONIZED_IO", header: "<unistd.h>".}: cint
+  SC_THREAD_ATTR_STACKADDR*{.importc: "_SC_THREAD_ATTR_STACKADDR", header: "<unistd.h>".}: cint
+  SC_THREAD_ATTR_STACKSIZE*{.importc: "_SC_THREAD_ATTR_STACKSIZE", header: "<unistd.h>".}: cint
+  SC_THREAD_CPUTIME*{.importc: "_SC_THREAD_CPUTIME", header: "<unistd.h>".}: cint
+  SC_THREAD_DESTRUCTOR_ITERATIONS*{.importc: "_SC_THREAD_DESTRUCTOR_ITERATIONS", header: "<unistd.h>".}: cint
+  SC_THREAD_KEYS_MAX*{.importc: "_SC_THREAD_KEYS_MAX", header: "<unistd.h>".}: cint
+  SC_THREAD_PRIO_INHERIT*{.importc: "_SC_THREAD_PRIO_INHERIT", header: "<unistd.h>".}: cint
+  SC_THREAD_PRIO_PROTECT*{.importc: "_SC_THREAD_PRIO_PROTECT", header: "<unistd.h>".}: cint
+  SC_THREAD_PRIORITY_SCHEDULING*{.importc: "_SC_THREAD_PRIORITY_SCHEDULING", header: "<unistd.h>".}: cint
+  SC_THREAD_PROCESS_SHARED*{.importc: "_SC_THREAD_PROCESS_SHARED", header: "<unistd.h>".}: cint
+  SC_THREAD_SAFE_FUNCTIONS*{.importc: "_SC_THREAD_SAFE_FUNCTIONS", header: "<unistd.h>".}: cint
+  SC_THREAD_SPORADIC_SERVER*{.importc: "_SC_THREAD_SPORADIC_SERVER", header: "<unistd.h>".}: cint
+  SC_THREAD_STACK_MIN*{.importc: "_SC_THREAD_STACK_MIN", header: "<unistd.h>".}: cint
+  SC_THREAD_THREADS_MAX*{.importc: "_SC_THREAD_THREADS_MAX", header: "<unistd.h>".}: cint
+  SC_THREADS*{.importc: "_SC_THREADS", header: "<unistd.h>".}: cint
+  SC_TIMEOUTS*{.importc: "_SC_TIMEOUTS", header: "<unistd.h>".}: cint
+  SC_TIMER_MAX*{.importc: "_SC_TIMER_MAX", header: "<unistd.h>".}: cint
+  SC_TIMERS*{.importc: "_SC_TIMERS", header: "<unistd.h>".}: cint
+  SC_TRACE*{.importc: "_SC_TRACE", header: "<unistd.h>".}: cint
+  SC_TRACE_EVENT_FILTER*{.importc: "_SC_TRACE_EVENT_FILTER", header: "<unistd.h>".}: cint
+  SC_TRACE_EVENT_NAME_MAX*{.importc: "_SC_TRACE_EVENT_NAME_MAX", header: "<unistd.h>".}: cint
+  SC_TRACE_INHERIT*{.importc: "_SC_TRACE_INHERIT", header: "<unistd.h>".}: cint
+  SC_TRACE_LOG*{.importc: "_SC_TRACE_LOG", header: "<unistd.h>".}: cint
+  SC_TRACE_NAME_MAX*{.importc: "_SC_TRACE_NAME_MAX", header: "<unistd.h>".}: cint
+  SC_TRACE_SYS_MAX*{.importc: "_SC_TRACE_SYS_MAX", header: "<unistd.h>".}: cint
+  SC_TRACE_USER_EVENT_MAX*{.importc: "_SC_TRACE_USER_EVENT_MAX", header: "<unistd.h>".}: cint
+  SC_TTY_NAME_MAX*{.importc: "_SC_TTY_NAME_MAX", header: "<unistd.h>".}: cint
+  SC_TYPED_MEMORY_OBJECTS*{.importc: "_SC_TYPED_MEMORY_OBJECTS", header: "<unistd.h>".}: cint
+  SC_TZNAME_MAX*{.importc: "_SC_TZNAME_MAX", header: "<unistd.h>".}: cint
+  SC_V6_ILP32_OFF32*{.importc: "_SC_V6_ILP32_OFF32", header: "<unistd.h>".}: cint
+  SC_V6_ILP32_OFFBIG*{.importc: "_SC_V6_ILP32_OFFBIG", header: "<unistd.h>".}: cint
+  SC_V6_LP64_OFF64*{.importc: "_SC_V6_LP64_OFF64", header: "<unistd.h>".}: cint
+  SC_V6_LPBIG_OFFBIG*{.importc: "_SC_V6_LPBIG_OFFBIG", header: "<unistd.h>".}: cint
+  SC_VERSION*{.importc: "_SC_VERSION", header: "<unistd.h>".}: cint
+  SC_XBS5_ILP32_OFF32*{.importc: "_SC_XBS5_ILP32_OFF32", header: "<unistd.h>".}: cint
+  SC_XBS5_ILP32_OFFBIG*{.importc: "_SC_XBS5_ILP32_OFFBIG", header: "<unistd.h>".}: cint
+  SC_XBS5_LP64_OFF64*{.importc: "_SC_XBS5_LP64_OFF64", header: "<unistd.h>".}: cint
   SC_XBS5_LPBIG_OFFBIG*{.importc: "_SC_XBS5_LPBIG_OFFBIG", 
-                         header: "<unistd.h>".}: cint

-  SC_XOPEN_CRYPT*{.importc: "_SC_XOPEN_CRYPT", header: "<unistd.h>".}: cint

-  SC_XOPEN_ENH_I18N*{.importc: "_SC_XOPEN_ENH_I18N", header: "<unistd.h>".}: cint

-  SC_XOPEN_LEGACY*{.importc: "_SC_XOPEN_LEGACY", header: "<unistd.h>".}: cint

-  SC_XOPEN_REALTIME*{.importc: "_SC_XOPEN_REALTIME", header: "<unistd.h>".}: cint

+                         header: "<unistd.h>".}: cint
+  SC_XOPEN_CRYPT*{.importc: "_SC_XOPEN_CRYPT", header: "<unistd.h>".}: cint
+  SC_XOPEN_ENH_I18N*{.importc: "_SC_XOPEN_ENH_I18N", header: "<unistd.h>".}: cint
+  SC_XOPEN_LEGACY*{.importc: "_SC_XOPEN_LEGACY", header: "<unistd.h>".}: cint
+  SC_XOPEN_REALTIME*{.importc: "_SC_XOPEN_REALTIME", header: "<unistd.h>".}: cint
   SC_XOPEN_REALTIME_THREADS*{.importc: "_SC_XOPEN_REALTIME_THREADS", 
-                              header: "<unistd.h>".}: cint

-  SC_XOPEN_SHM*{.importc: "_SC_XOPEN_SHM", header: "<unistd.h>".}: cint

-  SC_XOPEN_STREAMS*{.importc: "_SC_XOPEN_STREAMS", header: "<unistd.h>".}: cint

-  SC_XOPEN_UNIX*{.importc: "_SC_XOPEN_UNIX", header: "<unistd.h>".}: cint

-  SC_XOPEN_VERSION*{.importc: "_SC_XOPEN_VERSION", header: "<unistd.h>".}: cint

-  

-  SEM_FAILED* {.importc, header: "<semaphore.h>".}: pointer

-  IPC_CREAT* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Create entry if key does not exist.

-  IPC_EXCL* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Fail if key exists.

-  IPC_NOWAIT* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Error if request must wait.

-

-  IPC_PRIVATE* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Private key.

-

-  IPC_RMID* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Remove identifier.

-  IPC_SET* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Set options.

-  IPC_STAT* {.importc, header: "<sys/ipc.h>".}: cint

-    ## Get options. 

-

-  S_IFMT* {.importc, header: "<sys/stat.h>".}: cint

-    ## Type of file.

-  S_IFBLK* {.importc, header: "<sys/stat.h>".}: cint

-    ## Block special.

-  S_IFCHR* {.importc, header: "<sys/stat.h>".}: cint

-    ## Character special.

-  S_IFIFO* {.importc, header: "<sys/stat.h>".}: cint

-    ## FIFO special.

-  S_IFREG* {.importc, header: "<sys/stat.h>".}: cint

-    ## Regular.

-  S_IFDIR* {.importc, header: "<sys/stat.h>".}: cint

-    ## Directory.

-  S_IFLNK* {.importc, header: "<sys/stat.h>".}: cint

-    ## Symbolic link.

-  S_IFSOCK* {.importc, header: "<sys/stat.h>".}: cint

-    ## Socket.

-  S_IRWXU* {.importc, header: "<sys/stat.h>".}: cint

-    ## Read, write, execute/search by owner.

-  S_IRUSR* {.importc, header: "<sys/stat.h>".}: cint

-    ## Read permission, owner.

-  S_IWUSR* {.importc, header: "<sys/stat.h>".}: cint

-    ## Write permission, owner.

-  S_IXUSR* {.importc, header: "<sys/stat.h>".}: cint

-    ## Execute/search permission, owner.

-  S_IRWXG* {.importc, header: "<sys/stat.h>".}: cint

-    ## Read, write, execute/search by group.

-  S_IRGRP* {.importc, header: "<sys/stat.h>".}: cint

-    ## Read permission, group.

-  S_IWGRP* {.importc, header: "<sys/stat.h>".}: cint

-    ## Write permission, group.

-  S_IXGRP* {.importc, header: "<sys/stat.h>".}: cint

-    ## Execute/search permission, group.

-  S_IRWXO* {.importc, header: "<sys/stat.h>".}: cint

-    ## Read, write, execute/search by others.

-  S_IROTH* {.importc, header: "<sys/stat.h>".}: cint

-    ## Read permission, others.

-  S_IWOTH* {.importc, header: "<sys/stat.h>".}: cint

-    ## Write permission, others.

-  S_IXOTH* {.importc, header: "<sys/stat.h>".}: cint

-    ## Execute/search permission, others.

-  S_ISUID* {.importc, header: "<sys/stat.h>".}: cint

-    ## Set-user-ID on execution.

-  S_ISGID* {.importc, header: "<sys/stat.h>".}: cint

-    ## Set-group-ID on execution.

-  S_ISVTX* {.importc, header: "<sys/stat.h>".}: cint

-    ## On directories, restricted deletion flag.

-  

-  ST_RDONLY* {.importc, header: "<sys/statvfs.h>".}: cint

-    ## Read-only file system.

-  ST_NOSUID* {.importc, header: "<sys/statvfs.h>".}: cint

-    ## Does not support the semantics of the ST_ISUID and ST_ISGID file mode bits.

-       

-  PROT_READ* {.importc, header: "<sys/mman.h>".}: cint

-    ## Page can be read.

-  PROT_WRITE* {.importc, header: "<sys/mman.h>".}: cint

-    ## Page can be written.

-  PROT_EXEC* {.importc, header: "<sys/mman.h>".}: cint

-    ## Page can be executed.

-  PROT_NONE* {.importc, header: "<sys/mman.h>".}: cint

-    ## Page cannot be accessed.

-  MAP_SHARED* {.importc, header: "<sys/mman.h>".}: cint

-    ## Share changes.

-  MAP_PRIVATE* {.importc, header: "<sys/mman.h>".}: cint

-    ## Changes are private.

-  MAP_FIXED* {.importc, header: "<sys/mman.h>".}: cint

-    ## Interpret addr exactly.

-  MS_ASYNC* {.importc, header: "<sys/mman.h>".}: cint

-    ## Perform asynchronous writes.

-  MS_SYNC* {.importc, header: "<sys/mman.h>".}: cint

-    ## Perform synchronous writes.

-  MS_INVALIDATE* {.importc, header: "<sys/mman.h>".}: cint

-    ## Invalidate mappings.

-  MCL_CURRENT* {.importc, header: "<sys/mman.h>".}: cint

-    ## Lock currently mapped pages.

-  MCL_FUTURE* {.importc, header: "<sys/mman.h>".}: cint

-    ## Lock pages that become mapped.

-  MAP_FAILED* {.importc, header: "<sys/mman.h>".}: cint

-  POSIX_MADV_NORMAL* {.importc, header: "<sys/mman.h>".}: cint

+                              header: "<unistd.h>".}: cint
+  SC_XOPEN_SHM*{.importc: "_SC_XOPEN_SHM", header: "<unistd.h>".}: cint
+  SC_XOPEN_STREAMS*{.importc: "_SC_XOPEN_STREAMS", header: "<unistd.h>".}: cint
+  SC_XOPEN_UNIX*{.importc: "_SC_XOPEN_UNIX", header: "<unistd.h>".}: cint
+  SC_XOPEN_VERSION*{.importc: "_SC_XOPEN_VERSION", header: "<unistd.h>".}: cint
+  
+  SEM_FAILED* {.importc, header: "<semaphore.h>".}: pointer
+  IPC_CREAT* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Create entry if key does not exist.
+  IPC_EXCL* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Fail if key exists.
+  IPC_NOWAIT* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Error if request must wait.
+
+  IPC_PRIVATE* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Private key.
+
+  IPC_RMID* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Remove identifier.
+  IPC_SET* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Set options.
+  IPC_STAT* {.importc, header: "<sys/ipc.h>".}: cint
+    ## Get options. 
+
+  S_IFMT* {.importc, header: "<sys/stat.h>".}: cint
+    ## Type of file.
+  S_IFBLK* {.importc, header: "<sys/stat.h>".}: cint
+    ## Block special.
+  S_IFCHR* {.importc, header: "<sys/stat.h>".}: cint
+    ## Character special.
+  S_IFIFO* {.importc, header: "<sys/stat.h>".}: cint
+    ## FIFO special.
+  S_IFREG* {.importc, header: "<sys/stat.h>".}: cint
+    ## Regular.
+  S_IFDIR* {.importc, header: "<sys/stat.h>".}: cint
+    ## Directory.
+  S_IFLNK* {.importc, header: "<sys/stat.h>".}: cint
+    ## Symbolic link.
+  S_IFSOCK* {.importc, header: "<sys/stat.h>".}: cint
+    ## Socket.
+  S_IRWXU* {.importc, header: "<sys/stat.h>".}: cint
+    ## Read, write, execute/search by owner.
+  S_IRUSR* {.importc, header: "<sys/stat.h>".}: cint
+    ## Read permission, owner.
+  S_IWUSR* {.importc, header: "<sys/stat.h>".}: cint
+    ## Write permission, owner.
+  S_IXUSR* {.importc, header: "<sys/stat.h>".}: cint
+    ## Execute/search permission, owner.
+  S_IRWXG* {.importc, header: "<sys/stat.h>".}: cint
+    ## Read, write, execute/search by group.
+  S_IRGRP* {.importc, header: "<sys/stat.h>".}: cint
+    ## Read permission, group.
+  S_IWGRP* {.importc, header: "<sys/stat.h>".}: cint
+    ## Write permission, group.
+  S_IXGRP* {.importc, header: "<sys/stat.h>".}: cint
+    ## Execute/search permission, group.
+  S_IRWXO* {.importc, header: "<sys/stat.h>".}: cint
+    ## Read, write, execute/search by others.
+  S_IROTH* {.importc, header: "<sys/stat.h>".}: cint
+    ## Read permission, others.
+  S_IWOTH* {.importc, header: "<sys/stat.h>".}: cint
+    ## Write permission, others.
+  S_IXOTH* {.importc, header: "<sys/stat.h>".}: cint
+    ## Execute/search permission, others.
+  S_ISUID* {.importc, header: "<sys/stat.h>".}: cint
+    ## Set-user-ID on execution.
+  S_ISGID* {.importc, header: "<sys/stat.h>".}: cint
+    ## Set-group-ID on execution.
+  S_ISVTX* {.importc, header: "<sys/stat.h>".}: cint
+    ## On directories, restricted deletion flag.
+  
+  ST_RDONLY* {.importc, header: "<sys/statvfs.h>".}: cint
+    ## Read-only file system.
+  ST_NOSUID* {.importc, header: "<sys/statvfs.h>".}: cint
+    ## Does not support the semantics of the ST_ISUID and ST_ISGID file mode bits.
+       
+  PROT_READ* {.importc, header: "<sys/mman.h>".}: cint
+    ## Page can be read.
+  PROT_WRITE* {.importc, header: "<sys/mman.h>".}: cint
+    ## Page can be written.
+  PROT_EXEC* {.importc, header: "<sys/mman.h>".}: cint
+    ## Page can be executed.
+  PROT_NONE* {.importc, header: "<sys/mman.h>".}: cint
+    ## Page cannot be accessed.
+  MAP_SHARED* {.importc, header: "<sys/mman.h>".}: cint
+    ## Share changes.
+  MAP_PRIVATE* {.importc, header: "<sys/mman.h>".}: cint
+    ## Changes are private.
+  MAP_FIXED* {.importc, header: "<sys/mman.h>".}: cint
+    ## Interpret addr exactly.
+  MS_ASYNC* {.importc, header: "<sys/mman.h>".}: cint
+    ## Perform asynchronous writes.
+  MS_SYNC* {.importc, header: "<sys/mman.h>".}: cint
+    ## Perform synchronous writes.
+  MS_INVALIDATE* {.importc, header: "<sys/mman.h>".}: cint
+    ## Invalidate mappings.
+  MCL_CURRENT* {.importc, header: "<sys/mman.h>".}: cint
+    ## Lock currently mapped pages.
+  MCL_FUTURE* {.importc, header: "<sys/mman.h>".}: cint
+    ## Lock pages that become mapped.
+  MAP_FAILED* {.importc, header: "<sys/mman.h>".}: cint
+  POSIX_MADV_NORMAL* {.importc, header: "<sys/mman.h>".}: cint
     ## The application has no advice to give on its behavior with 
     ## respect to the specified range. It is the default characteristic 
-    ## if no advice is given for a range of memory.

-  POSIX_MADV_SEQUENTIAL* {.importc, header: "<sys/mman.h>".}: cint

+    ## if no advice is given for a range of memory.
+  POSIX_MADV_SEQUENTIAL* {.importc, header: "<sys/mman.h>".}: cint
     ## The application expects to access the specified range sequentially
-    ## from lower addresses to higher addresses.

-  POSIX_MADV_RANDOM* {.importc, header: "<sys/mman.h>".}: cint

-    ## The application expects to access the specified range in a random order.

-  POSIX_MADV_WILLNEED* {.importc, header: "<sys/mman.h>".}: cint

-    ## The application expects to access the specified range in the near future.

-  POSIX_MADV_DONTNEED* {.importc, header: "<sys/mman.h>".}: cint

-  POSIX_TYPED_MEM_ALLOCATE* {.importc, header: "<sys/mman.h>".}: cint

-  POSIX_TYPED_MEM_ALLOCATE_CONTIG* {.importc, header: "<sys/mman.h>".}: cint

-  POSIX_TYPED_MEM_MAP_ALLOCATABLE* {.importc, header: "<sys/mman.h>".}: cint

-

-

-  CLOCKS_PER_SEC* {.importc, header: "<time.h>".}: int

-    ## A number used to convert the value returned by the clock() function

-    ## into seconds.

-  CLOCK_PROCESS_CPUTIME_ID* {.importc, header: "<time.h>".}: cint

-    ## The identifier of the CPU-time clock associated with the process 

-    ## making a clock() or timer*() function call.

-  CLOCK_THREAD_CPUTIME_ID* {.importc, header: "<time.h>".}: cint

-  CLOCK_REALTIME* {.importc, header: "<time.h>".}: cint

-    ## The identifier of the system-wide realtime clock.

-  TIMER_ABSTIME* {.importc, header: "<time.h>".}: cint

+    ## from lower addresses to higher addresses.
+  POSIX_MADV_RANDOM* {.importc, header: "<sys/mman.h>".}: cint
+    ## The application expects to access the specified range in a random order.
+  POSIX_MADV_WILLNEED* {.importc, header: "<sys/mman.h>".}: cint
+    ## The application expects to access the specified range in the near future.
+  POSIX_MADV_DONTNEED* {.importc, header: "<sys/mman.h>".}: cint
+  POSIX_TYPED_MEM_ALLOCATE* {.importc, header: "<sys/mman.h>".}: cint
+  POSIX_TYPED_MEM_ALLOCATE_CONTIG* {.importc, header: "<sys/mman.h>".}: cint
+  POSIX_TYPED_MEM_MAP_ALLOCATABLE* {.importc, header: "<sys/mman.h>".}: cint
+
+
+  CLOCKS_PER_SEC* {.importc, header: "<time.h>".}: int
+    ## A number used to convert the value returned by the clock() function
+    ## into seconds.
+  CLOCK_PROCESS_CPUTIME_ID* {.importc, header: "<time.h>".}: cint
+    ## The identifier of the CPU-time clock associated with the process 
+    ## making a clock() or timer*() function call.
+  CLOCK_THREAD_CPUTIME_ID* {.importc, header: "<time.h>".}: cint
+  CLOCK_REALTIME* {.importc, header: "<time.h>".}: cint
+    ## The identifier of the system-wide realtime clock.
+  TIMER_ABSTIME* {.importc, header: "<time.h>".}: cint
     ## Flag indicating time is absolute. For functions taking timer 
-    ## objects, this refers to the clock associated with the timer.

-  CLOCK_MONOTONIC* {.importc, header: "<time.h>".}: cint

-

-  WNOHANG* {.importc, header: "<sys/wait.h>".}: cint

-    ## Do not hang if no status is available; return immediately.

-  WUNTRACED* {.importc, header: "<sys/wait.h>".}: cint

-    ## Report status of stopped child process.

-  WEXITSTATUS* {.importc, header: "<sys/wait.h>".}: cint

-    ## Return exit status.

-  WIFCONTINUED* {.importc, header: "<sys/wait.h>".}: cint

-    ## True if child has been continued.

-  WIFEXITED* {.importc, header: "<sys/wait.h>".}: cint

-    ## True if child exited normally.

-  WIFSIGNALED* {.importc, header: "<sys/wait.h>".}: cint

-    ## True if child exited due to uncaught signal.

-  WIFSTOPPED* {.importc, header: "<sys/wait.h>".}: cint

-    ## True if child is currently stopped.

-  WSTOPSIG* {.importc, header: "<sys/wait.h>".}: cint

-    ## Return signal number that caused process to stop.

-  WTERMSIG* {.importc, header: "<sys/wait.h>".}: cint

-    ## Return signal number that caused process to terminate.

-  WEXITED* {.importc, header: "<sys/wait.h>".}: cint

-    ## Wait for processes that have exited.

-  WSTOPPED* {.importc, header: "<sys/wait.h>".}: cint

-    ## Status is returned for any child that has stopped upon receipt of a signal.

-  WCONTINUED* {.importc, header: "<sys/wait.h>".}: cint

-    ## Status is returned for any child that was stopped and has been continued.

-  WNOWAIT* {.importc, header: "<sys/wait.h>".}: cint

-    ## Keep the process whose status is returned in infop in a waitable state. 

-  P_ALL* {.importc, header: "<sys/wait.h>".}: cint 

-  P_PID* {.importc, header: "<sys/wait.h>".}: cint 

-  P_PGID* {.importc, header: "<sys/wait.h>".}: cint

-       

-  SIG_DFL* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.}

-    ## Request for default signal handling.

-  SIG_ERR* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.}

-    ## Return value from signal() in case of error.

-  cSIG_HOLD* {.importc: "SIG_HOLD", header: "<signal.h>".}: proc (x: cint) {.noconv.}

-    ## Request that signal be held.

-  SIG_IGN* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.}

-    ## Request that signal be ignored. 

-

-  SIGEV_NONE* {.importc, header: "<signal.h>".}: cint

-  SIGEV_SIGNAL* {.importc, header: "<signal.h>".}: cint

-  SIGEV_THREAD* {.importc, header: "<signal.h>".}: cint

-  SIGABRT* {.importc, header: "<signal.h>".}: cint

-  SIGALRM* {.importc, header: "<signal.h>".}: cint

-  SIGBUS* {.importc, header: "<signal.h>".}: cint

-  SIGCHLD* {.importc, header: "<signal.h>".}: cint

-  SIGCONT* {.importc, header: "<signal.h>".}: cint

-  SIGFPE* {.importc, header: "<signal.h>".}: cint

-  SIGHUP* {.importc, header: "<signal.h>".}: cint

-  SIGILL* {.importc, header: "<signal.h>".}: cint

-  SIGINT* {.importc, header: "<signal.h>".}: cint

-  SIGKILL* {.importc, header: "<signal.h>".}: cint

-  SIGPIPE* {.importc, header: "<signal.h>".}: cint

-  SIGQUIT* {.importc, header: "<signal.h>".}: cint

-  SIGSEGV* {.importc, header: "<signal.h>".}: cint

-  SIGSTOP* {.importc, header: "<signal.h>".}: cint

-  SIGTERM* {.importc, header: "<signal.h>".}: cint

-  SIGTSTP* {.importc, header: "<signal.h>".}: cint

-  SIGTTIN* {.importc, header: "<signal.h>".}: cint

-  SIGTTOU* {.importc, header: "<signal.h>".}: cint

-  SIGUSR1* {.importc, header: "<signal.h>".}: cint

-  SIGUSR2* {.importc, header: "<signal.h>".}: cint

-  SIGPOLL* {.importc, header: "<signal.h>".}: cint

-  SIGPROF* {.importc, header: "<signal.h>".}: cint

-  SIGSYS* {.importc, header: "<signal.h>".}: cint

-  SIGTRAP* {.importc, header: "<signal.h>".}: cint

-  SIGURG* {.importc, header: "<signal.h>".}: cint

-  SIGVTALRM* {.importc, header: "<signal.h>".}: cint

-  SIGXCPU* {.importc, header: "<signal.h>".}: cint

-  SIGXFSZ* {.importc, header: "<signal.h>".}: cint

-  SA_NOCLDSTOP* {.importc, header: "<signal.h>".}: cint

-  SIG_BLOCK* {.importc, header: "<signal.h>".}: cint

-  SIG_UNBLOCK* {.importc, header: "<signal.h>".}: cint

-  SIG_SETMASK* {.importc, header: "<signal.h>".}: cint

-  SA_ONSTACK* {.importc, header: "<signal.h>".}: cint

-  SA_RESETHAND* {.importc, header: "<signal.h>".}: cint

-  SA_RESTART* {.importc, header: "<signal.h>".}: cint

-  SA_SIGINFO* {.importc, header: "<signal.h>".}: cint

-  SA_NOCLDWAIT* {.importc, header: "<signal.h>".}: cint

-  SA_NODEFER* {.importc, header: "<signal.h>".}: cint

-  SS_ONSTACK* {.importc, header: "<signal.h>".}: cint

-  SS_DISABLE* {.importc, header: "<signal.h>".}: cint

-  MINSIGSTKSZ* {.importc, header: "<signal.h>".}: cint

-  SIGSTKSZ* {.importc, header: "<signal.h>".}: cint

-

-  NL_SETD* {.importc, header: "<nl_types.h>".}: cint

-  NL_CAT_LOCALE* {.importc, header: "<nl_types.h>".}: cint

-

-  SCHED_FIFO* {.importc, header: "<sched.h>".}: cint

-  SCHED_RR* {.importc, header: "<sched.h>".}: cint

-  SCHED_SPORADIC* {.importc, header: "<sched.h>".}: cint

-  SCHED_OTHER* {.importc, header: "<sched.h>".}: cint

-  FD_SETSIZE* {.importc, header: "<sys/select.h>".}: cint

-

-  SEEK_SET* {.importc, header: "<unistd.h>".}: cint

-  SEEK_CUR* {.importc, header: "<unistd.h>".}: cint

-  SEEK_END* {.importc, header: "<unistd.h>".}: cint

+    ## objects, this refers to the clock associated with the timer.
+  CLOCK_MONOTONIC* {.importc, header: "<time.h>".}: cint
+
+  WNOHANG* {.importc, header: "<sys/wait.h>".}: cint
+    ## Do not hang if no status is available; return immediately.
+  WUNTRACED* {.importc, header: "<sys/wait.h>".}: cint
+    ## Report status of stopped child process.
+  WEXITSTATUS* {.importc, header: "<sys/wait.h>".}: cint
+    ## Return exit status.
+  WIFCONTINUED* {.importc, header: "<sys/wait.h>".}: cint
+    ## True if child has been continued.
+  WIFEXITED* {.importc, header: "<sys/wait.h>".}: cint
+    ## True if child exited normally.
+  WIFSIGNALED* {.importc, header: "<sys/wait.h>".}: cint
+    ## True if child exited due to uncaught signal.
+  WIFSTOPPED* {.importc, header: "<sys/wait.h>".}: cint
+    ## True if child is currently stopped.
+  WSTOPSIG* {.importc, header: "<sys/wait.h>".}: cint
+    ## Return signal number that caused process to stop.
+  WTERMSIG* {.importc, header: "<sys/wait.h>".}: cint
+    ## Return signal number that caused process to terminate.
+  WEXITED* {.importc, header: "<sys/wait.h>".}: cint
+    ## Wait for processes that have exited.
+  WSTOPPED* {.importc, header: "<sys/wait.h>".}: cint
+    ## Status is returned for any child that has stopped upon receipt of a signal.
+  WCONTINUED* {.importc, header: "<sys/wait.h>".}: cint
+    ## Status is returned for any child that was stopped and has been continued.
+  WNOWAIT* {.importc, header: "<sys/wait.h>".}: cint
+    ## Keep the process whose status is returned in infop in a waitable state. 
+  P_ALL* {.importc, header: "<sys/wait.h>".}: cint 
+  P_PID* {.importc, header: "<sys/wait.h>".}: cint 
+  P_PGID* {.importc, header: "<sys/wait.h>".}: cint
+       
+  SIG_DFL* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.}
+    ## Request for default signal handling.
+  SIG_ERR* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.}
+    ## Return value from signal() in case of error.
+  cSIG_HOLD* {.importc: "SIG_HOLD", header: "<signal.h>".}: proc (x: cint) {.noconv.}
+    ## Request that signal be held.
+  SIG_IGN* {.importc, header: "<signal.h>".}: proc (x: cint) {.noconv.}
+    ## Request that signal be ignored. 
+
+  SIGEV_NONE* {.importc, header: "<signal.h>".}: cint
+  SIGEV_SIGNAL* {.importc, header: "<signal.h>".}: cint
+  SIGEV_THREAD* {.importc, header: "<signal.h>".}: cint
+  SIGABRT* {.importc, header: "<signal.h>".}: cint
+  SIGALRM* {.importc, header: "<signal.h>".}: cint
+  SIGBUS* {.importc, header: "<signal.h>".}: cint
+  SIGCHLD* {.importc, header: "<signal.h>".}: cint
+  SIGCONT* {.importc, header: "<signal.h>".}: cint
+  SIGFPE* {.importc, header: "<signal.h>".}: cint
+  SIGHUP* {.importc, header: "<signal.h>".}: cint
+  SIGILL* {.importc, header: "<signal.h>".}: cint
+  SIGINT* {.importc, header: "<signal.h>".}: cint
+  SIGKILL* {.importc, header: "<signal.h>".}: cint
+  SIGPIPE* {.importc, header: "<signal.h>".}: cint
+  SIGQUIT* {.importc, header: "<signal.h>".}: cint
+  SIGSEGV* {.importc, header: "<signal.h>".}: cint
+  SIGSTOP* {.importc, header: "<signal.h>".}: cint
+  SIGTERM* {.importc, header: "<signal.h>".}: cint
+  SIGTSTP* {.importc, header: "<signal.h>".}: cint
+  SIGTTIN* {.importc, header: "<signal.h>".}: cint
+  SIGTTOU* {.importc, header: "<signal.h>".}: cint
+  SIGUSR1* {.importc, header: "<signal.h>".}: cint
+  SIGUSR2* {.importc, header: "<signal.h>".}: cint
+  SIGPOLL* {.importc, header: "<signal.h>".}: cint
+  SIGPROF* {.importc, header: "<signal.h>".}: cint
+  SIGSYS* {.importc, header: "<signal.h>".}: cint
+  SIGTRAP* {.importc, header: "<signal.h>".}: cint
+  SIGURG* {.importc, header: "<signal.h>".}: cint
+  SIGVTALRM* {.importc, header: "<signal.h>".}: cint
+  SIGXCPU* {.importc, header: "<signal.h>".}: cint
+  SIGXFSZ* {.importc, header: "<signal.h>".}: cint
+  SA_NOCLDSTOP* {.importc, header: "<signal.h>".}: cint
+  SIG_BLOCK* {.importc, header: "<signal.h>".}: cint
+  SIG_UNBLOCK* {.importc, header: "<signal.h>".}: cint
+  SIG_SETMASK* {.importc, header: "<signal.h>".}: cint
+  SA_ONSTACK* {.importc, header: "<signal.h>".}: cint
+  SA_RESETHAND* {.importc, header: "<signal.h>".}: cint
+  SA_RESTART* {.importc, header: "<signal.h>".}: cint
+  SA_SIGINFO* {.importc, header: "<signal.h>".}: cint
+  SA_NOCLDWAIT* {.importc, header: "<signal.h>".}: cint
+  SA_NODEFER* {.importc, header: "<signal.h>".}: cint
+  SS_ONSTACK* {.importc, header: "<signal.h>".}: cint
+  SS_DISABLE* {.importc, header: "<signal.h>".}: cint
+  MINSIGSTKSZ* {.importc, header: "<signal.h>".}: cint
+  SIGSTKSZ* {.importc, header: "<signal.h>".}: cint
+
+  NL_SETD* {.importc, header: "<nl_types.h>".}: cint
+  NL_CAT_LOCALE* {.importc, header: "<nl_types.h>".}: cint
+
+  SCHED_FIFO* {.importc, header: "<sched.h>".}: cint
+  SCHED_RR* {.importc, header: "<sched.h>".}: cint
+  SCHED_SPORADIC* {.importc, header: "<sched.h>".}: cint
+  SCHED_OTHER* {.importc, header: "<sched.h>".}: cint
+  FD_SETSIZE* {.importc, header: "<sys/select.h>".}: cint
+
+  SEEK_SET* {.importc, header: "<unistd.h>".}: cint
+  SEEK_CUR* {.importc, header: "<unistd.h>".}: cint
+  SEEK_END* {.importc, header: "<unistd.h>".}: cint
 
   SCM_RIGHTS* {.importc, header: "<sys/socket.h>".}: cint
     ## Indicates that the data array contains the access rights 
@@ -1653,38 +1653,38 @@ var
   POLLNVAL* {.importc, header: "<poll.h>".}: cshort
     ## Invalid fd member (revents only). 
 
-

-when hasSpawnh:

-  var

-    POSIX_SPAWN_RESETIDS* {.importc, header: "<spawn.h>".}: cint

-    POSIX_SPAWN_SETPGROUP* {.importc, header: "<spawn.h>".}: cint

-    POSIX_SPAWN_SETSCHEDPARAM* {.importc, header: "<spawn.h>".}: cint

-    POSIX_SPAWN_SETSCHEDULER* {.importc, header: "<spawn.h>".}: cint

-    POSIX_SPAWN_SETSIGDEF* {.importc, header: "<spawn.h>".}: cint

-    POSIX_SPAWN_SETSIGMASK* {.importc, header: "<spawn.h>".}: cint

-

-when hasAioH:

-  proc aio_cancel*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".}

-  proc aio_error*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}

-  proc aio_fsync*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".}

-  proc aio_read*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}

-  proc aio_return*(a1: ptr Taiocb): int {.importc, header: "<aio.h>".}

-  proc aio_suspend*(a1: ptr ptr Taiocb, a2: cint, a3: ptr ttimespec): cint {.

-                   importc, header: "<aio.h>".}

-  proc aio_write*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}

-  proc lio_listio*(a1: cint, a2: ptr ptr Taiocb, a3: cint,

-               a4: ptr Tsigevent): cint {.importc, header: "<aio.h>".}

-

-# arpa/inet.h

-proc htonl*(a1: int32): int32 {.importc, header: "<arpa/inet.h>".}

-proc htons*(a1: int16): int16 {.importc, header: "<arpa/inet.h>".}

-proc ntohl*(a1: int32): int32 {.importc, header: "<arpa/inet.h>".}

-proc ntohs*(a1: int16): int16 {.importc, header: "<arpa/inet.h>".}

-

-proc inet_addr*(a1: cstring): int32 {.importc, header: "<arpa/inet.h>".}

-proc inet_ntoa*(a1: int32): cstring {.importc, header: "<arpa/inet.h>".}

-proc inet_ntop*(a1: cint, a2: pointer, a3: cstring, a4: int32): cstring {.importc, header: "<arpa/inet.h>".}

-proc inet_pton*(a1: cint, a2: cstring, a3: pointer): cint {.importc, header: "<arpa/inet.h>".}

+
+when hasSpawnh:
+  var
+    POSIX_SPAWN_RESETIDS* {.importc, header: "<spawn.h>".}: cint
+    POSIX_SPAWN_SETPGROUP* {.importc, header: "<spawn.h>".}: cint
+    POSIX_SPAWN_SETSCHEDPARAM* {.importc, header: "<spawn.h>".}: cint
+    POSIX_SPAWN_SETSCHEDULER* {.importc, header: "<spawn.h>".}: cint
+    POSIX_SPAWN_SETSIGDEF* {.importc, header: "<spawn.h>".}: cint
+    POSIX_SPAWN_SETSIGMASK* {.importc, header: "<spawn.h>".}: cint
+
+when hasAioH:
+  proc aio_cancel*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".}
+  proc aio_error*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}
+  proc aio_fsync*(a1: cint, a2: ptr Taiocb): cint {.importc, header: "<aio.h>".}
+  proc aio_read*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}
+  proc aio_return*(a1: ptr Taiocb): int {.importc, header: "<aio.h>".}
+  proc aio_suspend*(a1: ptr ptr Taiocb, a2: cint, a3: ptr ttimespec): cint {.
+                   importc, header: "<aio.h>".}
+  proc aio_write*(a1: ptr Taiocb): cint {.importc, header: "<aio.h>".}
+  proc lio_listio*(a1: cint, a2: ptr ptr Taiocb, a3: cint,
+               a4: ptr Tsigevent): cint {.importc, header: "<aio.h>".}
+
+# arpa/inet.h
+proc htonl*(a1: int32): int32 {.importc, header: "<arpa/inet.h>".}
+proc htons*(a1: int16): int16 {.importc, header: "<arpa/inet.h>".}
+proc ntohl*(a1: int32): int32 {.importc, header: "<arpa/inet.h>".}
+proc ntohs*(a1: int16): int16 {.importc, header: "<arpa/inet.h>".}
+
+proc inet_addr*(a1: cstring): int32 {.importc, header: "<arpa/inet.h>".}
+proc inet_ntoa*(a1: int32): cstring {.importc, header: "<arpa/inet.h>".}
+proc inet_ntop*(a1: cint, a2: pointer, a3: cstring, a4: int32): cstring {.importc, header: "<arpa/inet.h>".}
+proc inet_pton*(a1: cint, a2: cstring, a3: pointer): cint {.importc, header: "<arpa/inet.h>".}
 
 var
   in6addr_any* {.importc, header: "<netinet/in.h>".}: TIn6Addr
@@ -1692,607 +1692,607 @@ var
 
 proc IN6ADDR_ANY_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".}
 proc IN6ADDR_LOOPBACK_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".}
-

-# dirent.h

-proc closedir*(a1: ptr TDIR): cint  {.importc, header: "<dirent.h>".}

-proc opendir*(a1: cstring): ptr TDir {.importc, header: "<dirent.h>".}

-proc readdir*(a1: ptr TDIR): ptr TDirent  {.importc, header: "<dirent.h>".}

-proc readdir_r*(a1: ptr TDIR, a2: ptr Tdirent, a3: ptr ptr TDirent): cint  {.

-                importc, header: "<dirent.h>".}

-proc rewinddir*(a1: ptr TDIR)  {.importc, header: "<dirent.h>".}

-proc seekdir*(a1: ptr TDIR, a2: int)  {.importc, header: "<dirent.h>".}

-proc telldir*(a1: ptr TDIR): int {.importc, header: "<dirent.h>".}

-

-# dlfcn.h

-proc dlclose*(a1: pointer): cint {.importc, header: "<dlfcn.h>".}

-proc dlerror*(): cstring {.importc, header: "<dlfcn.h>".}

-proc dlopen*(a1: cstring, a2: cint): pointer {.importc, header: "<dlfcn.h>".}

-proc dlsym*(a1: pointer, a2: cstring): pointer {.importc, header: "<dlfcn.h>".}

-

-proc creat*(a1: cstring, a2: Tmode): cint {.importc, header: "<fcntl.h>".}

-proc fcntl*(a1: cint, a2: cint): cint {.varargs, importc, header: "<fcntl.h>".}

-proc open*(a1: cstring, a2: cint): cint {.varargs, importc, header: "<fcntl.h>".}

-proc posix_fadvise*(a1: cint, a2, a3: Toff, a4: cint): cint {.importc, header: "<fcntl.h>".}

-proc posix_fallocate*(a1: cint, a2, a3: Toff): cint {.importc, header: "<fcntl.h>".}

-

-proc feclearexcept*(a1: cint): cint {.importc, header: "<fenv.h>".}

-proc fegetexceptflag*(a1: ptr Tfexcept, a2: cint): cint {.importc, header: "<fenv.h>".}

-proc feraiseexcept*(a1: cint): cint {.importc, header: "<fenv.h>".}

-proc fesetexceptflag*(a1: ptr Tfexcept, a2: cint): cint {.importc, header: "<fenv.h>".}

-proc fetestexcept*(a1: cint): cint {.importc, header: "<fenv.h>".}

-proc fegetround*(): cint {.importc, header: "<fenv.h>".}

-proc fesetround*(a1: cint): cint {.importc, header: "<fenv.h>".}

-proc fegetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}

-proc feholdexcept*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}

-proc fesetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}

-proc feupdateenv*(a1: ptr TFenv): cint {.importc, header: "<fenv.h>".}

-

-proc fmtmsg*(a1: int, a2: cstring, a3: cint,

-            a4, a5, a6: cstring): cint {.importc, header: "<fmtmsg.h>".}

-            

-proc fnmatch*(a1, a2: cstring, a3: cint): cint {.importc, header: "<fnmatch.h>".}

-proc ftw*(a1: cstring, 

-         a2: proc (x1: cstring, x2: ptr TStat, x3: cint): cint {.noconv.},

-         a3: cint): cint {.importc, header: "<ftw.h>".}

-proc nftw*(a1: cstring, 

-          a2: proc (x1: cstring, x2: ptr TStat, x3: cint, x4: ptr TFTW): cint {.noconv.},

-          a3: cint,

-          a4: cint): cint {.importc, header: "<ftw.h>".}

-

-proc glob*(a1: cstring, a2: cint,

-          a3: proc (x1: cstring, x2: cint): cint {.noconv.},

-          a4: ptr Tglob): cint {.importc, header: "<glob.h>".}

-proc globfree*(a1: ptr TGlob) {.importc, header: "<glob.h>".}

-

-proc getgrgid*(a1: TGid): ptr TGroup {.importc, header: "<grp.h>".}

-proc getgrnam*(a1: cstring): ptr TGroup {.importc, header: "<grp.h>".}

-proc getgrgid_r*(a1: Tgid, a2: ptr TGroup, a3: cstring, a4: int,

-                 a5: ptr ptr TGroup): cint {.importc, header: "<grp.h>".}

-proc getgrnam_r*(a1: cstring, a2: ptr TGroup, a3: cstring, 

-                  a4: int, a5: ptr ptr TGroup): cint {.importc, header: "<grp.h>".}

-proc getgrent*(): ptr TGroup {.importc, header: "<grp.h>".}

-proc endgrent*() {.importc, header: "<grp.h>".}

-proc setgrent*() {.importc, header: "<grp.h>".}

-

-

-proc iconv_open*(a1, a2: cstring): TIconv {.importc, header: "<iconv.h>".}

-proc iconv*(a1: Ticonv, a2: var cstring, a3: var int, a4: var cstring,

-            a5: var int): int {.importc, header: "<iconv.h>".}

-proc iconv_close*(a1: Ticonv): cint {.importc, header: "<iconv.h>".}

-

-proc nl_langinfo*(a1: Tnl_item): cstring {.importc, header: "<langinfo.h>".}

-

-proc basename*(a1: cstring): cstring {.importc, header: "<libgen.h>".}

-proc dirname*(a1: cstring): cstring {.importc, header: "<libgen.h>".}

-

-proc localeconv*(): ptr Tlconv {.importc, header: "<locale.h>".}

-proc setlocale*(a1: cint, a2: cstring): cstring {.

-                importc, header: "<locale.h>".}

-

-proc strfmon*(a1: cstring, a2: int, a3: cstring): int {.varargs,

-   importc, header: "<monetary.h>".}

-

-proc mq_close*(a1: Tmqd): cint {.importc, header: "<mqueue.h>".}

-proc mq_getattr*(a1: Tmqd, a2: ptr Tmq_attr): cint {.importc, header: "<mqueue.h>".}

-proc mq_notify*(a1: Tmqd, a2: ptr Tsigevent): cint {.importc, header: "<mqueue.h>".}

-proc mq_open*(a1: cstring, a2: cint): TMqd {.varargs, importc, header: "<mqueue.h>".}

-proc mq_receive*(a1: Tmqd, a2: cstring, a3: int, a4: var int): int {.importc, header: "<mqueue.h>".}

-proc mq_send*(a1: Tmqd, a2: cstring, a3: int, a4: int): cint {.importc, header: "<mqueue.h>".}

-proc mq_setattr*(a1: Tmqd, a2, a3: ptr Tmq_attr): cint {.importc, header: "<mqueue.h>".}

-

-proc mq_timedreceive*(a1: Tmqd, a2: cstring, a3: int, a4: int, 

-                      a5: ptr TTimespec): int {.importc, header: "<mqueue.h>".}

-proc mq_timedsend*(a1: Tmqd, a2: cstring, a3: int, a4: int, 

-                   a5: ptr TTimeSpec): cint {.importc, header: "<mqueue.h>".}

-proc mq_unlink*(a1: cstring): cint {.importc, header: "<mqueue.h>".}

-

-

-proc getpwnam*(a1: cstring): ptr TPasswd {.importc, header: "<pwd.h>".}

-proc getpwuid*(a1: Tuid): ptr TPasswd {.importc, header: "<pwd.h>".}

-proc getpwnam_r*(a1: cstring, a2: ptr Tpasswd, a3: cstring, a4: int,

-                 a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".}

-proc getpwuid_r*(a1: Tuid, a2: ptr Tpasswd, a3: cstring,

-      a4: int, a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".}

-proc endpwent*() {.importc, header: "<pwd.h>".}

-proc getpwent*(): ptr TPasswd {.importc, header: "<pwd.h>".}

-proc setpwent*() {.importc, header: "<pwd.h>".}

-

-proc uname*(a1: var Tutsname): cint {.importc, header: "<sys/utsname.h>".}

-

-proc pthread_atfork*(a1, a2, a3: proc {.noconv.}): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_destroy*(a1: ptr Tpthread_attr): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getdetachstate*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getguardsize*(a1: ptr Tpthread_attr, a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getinheritsched*(a1: ptr Tpthread_attr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getschedparam*(a1: ptr Tpthread_attr,

-          a2: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getschedpolicy*(a1: ptr Tpthread_attr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getscope*(a1: ptr Tpthread_attr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getstack*(a1: ptr Tpthread_attr,

-         a2: var pointer, a3: var int): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getstackaddr*(a1: ptr Tpthread_attr,

-          a2: var pointer): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_getstacksize*(a1: ptr Tpthread_attr,

-          a2: var int): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_init*(a1: ptr Tpthread_attr): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setdetachstate*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setguardsize*(a1: ptr Tpthread_attr, a2: int): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setinheritsched*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setschedparam*(a1: ptr Tpthread_attr,

-          a2: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setschedpolicy*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setscope*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setstack*(a1: ptr Tpthread_attr, a2: pointer, a3: int): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setstackaddr*(a1: ptr TPthread_attr, a2: pointer): cint {.importc, header: "<pthread.h>".}

-proc pthread_attr_setstacksize*(a1: ptr TPthread_attr, a2: int): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrier_destroy*(a1: ptr Tpthread_barrier): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrier_init*(a1: ptr Tpthread_barrier,

-         a2: ptr Tpthread_barrierattr, a3: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrier_wait*(a1: ptr Tpthread_barrier): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrierattr_destroy*(a1: ptr Tpthread_barrierattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrierattr_getpshared*(

-          a1: ptr Tpthread_barrierattr, a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrierattr_init*(a1: ptr TPthread_barrierattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_barrierattr_setpshared*(a1: ptr TPthread_barrierattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_cancel*(a1: Tpthread): cint {.importc, header: "<pthread.h>".}

-proc pthread_cleanup_push*(a1: proc (x: pointer) {.noconv.}, a2: pointer) {.importc, header: "<pthread.h>".}

-proc pthread_cleanup_pop*(a1: cint) {.importc, header: "<pthread.h>".}

-proc pthread_cond_broadcast*(a1: ptr Tpthread_cond): cint {.importc, header: "<pthread.h>".}

-proc pthread_cond_destroy*(a1: ptr Tpthread_cond): cint {.importc, header: "<pthread.h>".}

-proc pthread_cond_init*(a1: ptr Tpthread_cond,

-          a2: ptr Tpthread_condattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_cond_signal*(a1: ptr Tpthread_cond): cint {.importc, header: "<pthread.h>".}

-proc pthread_cond_timedwait*(a1: ptr Tpthread_cond,

-          a2: ptr Tpthread_mutex, a3: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_cond_wait*(a1: ptr Tpthread_cond,

-          a2: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}

-proc pthread_condattr_destroy*(a1: ptr Tpthread_condattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_condattr_getclock*(a1: ptr Tpthread_condattr,

-          a2: var Tclockid): cint {.importc, header: "<pthread.h>".}

-proc pthread_condattr_getpshared*(a1: ptr Tpthread_condattr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-          

-proc pthread_condattr_init*(a1: ptr TPthread_condattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_condattr_setclock*(a1: ptr TPthread_condattr,a2: Tclockid): cint {.importc, header: "<pthread.h>".}

-proc pthread_condattr_setpshared*(a1: ptr TPthread_condattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_create*(a1: ptr Tpthread, a2: ptr Tpthread_attr,

-          a3: proc (x: pointer): pointer {.noconv.}, a4: pointer): cint {.importc, header: "<pthread.h>".}

-proc pthread_detach*(a1: Tpthread): cint {.importc, header: "<pthread.h>".}

-proc pthread_equal*(a1, a2: Tpthread): cint {.importc, header: "<pthread.h>".}

-proc pthread_exit*(a1: pointer) {.importc, header: "<pthread.h>".}

-proc pthread_getconcurrency*(): cint {.importc, header: "<pthread.h>".}

-proc pthread_getcpuclockid*(a1: Tpthread, a2: var Tclockid): cint {.importc, header: "<pthread.h>".}

-proc pthread_getschedparam*(a1: Tpthread,  a2: var cint,

-          a3: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}

-proc pthread_getspecific*(a1: Tpthread_key): pointer {.importc, header: "<pthread.h>".}

-proc pthread_join*(a1: Tpthread, a2: ptr pointer): cint {.importc, header: "<pthread.h>".}

-proc pthread_key_create*(a1: ptr Tpthread_key, a2: proc (x: pointer) {.noconv.}): cint {.importc, header: "<pthread.h>".}

-proc pthread_key_delete*(a1: Tpthread_key): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_mutex_destroy*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_getprioceiling*(a1: ptr Tpthread_mutex,

-         a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_init*(a1: ptr Tpthread_mutex,

-          a2: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_lock*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_setprioceiling*(a1: ptr Tpthread_mutex,a2: cint,

-          a3: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_timedlock*(a1: ptr Tpthread_mutex,

-          a2: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_trylock*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutex_unlock*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_destroy*(a1: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_mutexattr_getprioceiling*(

-          a1: ptr Tpthread_mutexattr, a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_getprotocol*(a1: ptr Tpthread_mutexattr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_getpshared*(a1: ptr Tpthread_mutexattr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_gettype*(a1: ptr Tpthread_mutexattr,

-          a2: var cint): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_mutexattr_init*(a1: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_setprioceiling*(a1: ptr tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_setprotocol*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_setpshared*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_mutexattr_settype*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_once*(a1: ptr Tpthread_once, a2: proc {.noconv.}): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_rwlock_destroy*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_init*(a1: ptr Tpthread_rwlock,

-          a2: ptr Tpthread_rwlockattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_rdlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_timedrdlock*(a1: ptr Tpthread_rwlock,

-          a2: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_timedwrlock*(a1: ptr Tpthread_rwlock,

-          a2: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_rwlock_tryrdlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_trywrlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_unlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlock_wrlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlockattr_destroy*(a1: ptr Tpthread_rwlockattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlockattr_getpshared*(

-          a1: ptr Tpthread_rwlockattr, a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlockattr_init*(a1: ptr Tpthread_rwlockattr): cint {.importc, header: "<pthread.h>".}

-proc pthread_rwlockattr_setpshared*(a1: ptr Tpthread_rwlockattr, a2: cint): cint {.importc, header: "<pthread.h>".}

-

-proc pthread_self*(): Tpthread {.importc, header: "<pthread.h>".}

-proc pthread_setcancelstate*(a1: cint, a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_setcanceltype*(a1: cint, a2: var cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_setconcurrency*(a1: cint): cint {.importc, header: "<pthread.h>".}

-proc pthread_setschedparam*(a1: Tpthread, a2: cint,

-          a3: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}

-

+
+# dirent.h
+proc closedir*(a1: ptr TDIR): cint  {.importc, header: "<dirent.h>".}
+proc opendir*(a1: cstring): ptr TDir {.importc, header: "<dirent.h>".}
+proc readdir*(a1: ptr TDIR): ptr TDirent  {.importc, header: "<dirent.h>".}
+proc readdir_r*(a1: ptr TDIR, a2: ptr Tdirent, a3: ptr ptr TDirent): cint  {.
+                importc, header: "<dirent.h>".}
+proc rewinddir*(a1: ptr TDIR)  {.importc, header: "<dirent.h>".}
+proc seekdir*(a1: ptr TDIR, a2: int)  {.importc, header: "<dirent.h>".}
+proc telldir*(a1: ptr TDIR): int {.importc, header: "<dirent.h>".}
+
+# dlfcn.h
+proc dlclose*(a1: pointer): cint {.importc, header: "<dlfcn.h>".}
+proc dlerror*(): cstring {.importc, header: "<dlfcn.h>".}
+proc dlopen*(a1: cstring, a2: cint): pointer {.importc, header: "<dlfcn.h>".}
+proc dlsym*(a1: pointer, a2: cstring): pointer {.importc, header: "<dlfcn.h>".}
+
+proc creat*(a1: cstring, a2: Tmode): cint {.importc, header: "<fcntl.h>".}
+proc fcntl*(a1: cint, a2: cint): cint {.varargs, importc, header: "<fcntl.h>".}
+proc open*(a1: cstring, a2: cint): cint {.varargs, importc, header: "<fcntl.h>".}
+proc posix_fadvise*(a1: cint, a2, a3: Toff, a4: cint): cint {.importc, header: "<fcntl.h>".}
+proc posix_fallocate*(a1: cint, a2, a3: Toff): cint {.importc, header: "<fcntl.h>".}
+
+proc feclearexcept*(a1: cint): cint {.importc, header: "<fenv.h>".}
+proc fegetexceptflag*(a1: ptr Tfexcept, a2: cint): cint {.importc, header: "<fenv.h>".}
+proc feraiseexcept*(a1: cint): cint {.importc, header: "<fenv.h>".}
+proc fesetexceptflag*(a1: ptr Tfexcept, a2: cint): cint {.importc, header: "<fenv.h>".}
+proc fetestexcept*(a1: cint): cint {.importc, header: "<fenv.h>".}
+proc fegetround*(): cint {.importc, header: "<fenv.h>".}
+proc fesetround*(a1: cint): cint {.importc, header: "<fenv.h>".}
+proc fegetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
+proc feholdexcept*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
+proc fesetenv*(a1: ptr Tfenv): cint {.importc, header: "<fenv.h>".}
+proc feupdateenv*(a1: ptr TFenv): cint {.importc, header: "<fenv.h>".}
+
+proc fmtmsg*(a1: int, a2: cstring, a3: cint,
+            a4, a5, a6: cstring): cint {.importc, header: "<fmtmsg.h>".}
+            
+proc fnmatch*(a1, a2: cstring, a3: cint): cint {.importc, header: "<fnmatch.h>".}
+proc ftw*(a1: cstring, 
+         a2: proc (x1: cstring, x2: ptr TStat, x3: cint): cint {.noconv.},
+         a3: cint): cint {.importc, header: "<ftw.h>".}
+proc nftw*(a1: cstring, 
+          a2: proc (x1: cstring, x2: ptr TStat, x3: cint, x4: ptr TFTW): cint {.noconv.},
+          a3: cint,
+          a4: cint): cint {.importc, header: "<ftw.h>".}
+
+proc glob*(a1: cstring, a2: cint,
+          a3: proc (x1: cstring, x2: cint): cint {.noconv.},
+          a4: ptr Tglob): cint {.importc, header: "<glob.h>".}
+proc globfree*(a1: ptr TGlob) {.importc, header: "<glob.h>".}
+
+proc getgrgid*(a1: TGid): ptr TGroup {.importc, header: "<grp.h>".}
+proc getgrnam*(a1: cstring): ptr TGroup {.importc, header: "<grp.h>".}
+proc getgrgid_r*(a1: Tgid, a2: ptr TGroup, a3: cstring, a4: int,
+                 a5: ptr ptr TGroup): cint {.importc, header: "<grp.h>".}
+proc getgrnam_r*(a1: cstring, a2: ptr TGroup, a3: cstring, 
+                  a4: int, a5: ptr ptr TGroup): cint {.importc, header: "<grp.h>".}
+proc getgrent*(): ptr TGroup {.importc, header: "<grp.h>".}
+proc endgrent*() {.importc, header: "<grp.h>".}
+proc setgrent*() {.importc, header: "<grp.h>".}
+
+
+proc iconv_open*(a1, a2: cstring): TIconv {.importc, header: "<iconv.h>".}
+proc iconv*(a1: Ticonv, a2: var cstring, a3: var int, a4: var cstring,
+            a5: var int): int {.importc, header: "<iconv.h>".}
+proc iconv_close*(a1: Ticonv): cint {.importc, header: "<iconv.h>".}
+
+proc nl_langinfo*(a1: Tnl_item): cstring {.importc, header: "<langinfo.h>".}
+
+proc basename*(a1: cstring): cstring {.importc, header: "<libgen.h>".}
+proc dirname*(a1: cstring): cstring {.importc, header: "<libgen.h>".}
+
+proc localeconv*(): ptr Tlconv {.importc, header: "<locale.h>".}
+proc setlocale*(a1: cint, a2: cstring): cstring {.
+                importc, header: "<locale.h>".}
+
+proc strfmon*(a1: cstring, a2: int, a3: cstring): int {.varargs,
+   importc, header: "<monetary.h>".}
+
+proc mq_close*(a1: Tmqd): cint {.importc, header: "<mqueue.h>".}
+proc mq_getattr*(a1: Tmqd, a2: ptr Tmq_attr): cint {.importc, header: "<mqueue.h>".}
+proc mq_notify*(a1: Tmqd, a2: ptr Tsigevent): cint {.importc, header: "<mqueue.h>".}
+proc mq_open*(a1: cstring, a2: cint): TMqd {.varargs, importc, header: "<mqueue.h>".}
+proc mq_receive*(a1: Tmqd, a2: cstring, a3: int, a4: var int): int {.importc, header: "<mqueue.h>".}
+proc mq_send*(a1: Tmqd, a2: cstring, a3: int, a4: int): cint {.importc, header: "<mqueue.h>".}
+proc mq_setattr*(a1: Tmqd, a2, a3: ptr Tmq_attr): cint {.importc, header: "<mqueue.h>".}
+
+proc mq_timedreceive*(a1: Tmqd, a2: cstring, a3: int, a4: int, 
+                      a5: ptr TTimespec): int {.importc, header: "<mqueue.h>".}
+proc mq_timedsend*(a1: Tmqd, a2: cstring, a3: int, a4: int, 
+                   a5: ptr TTimeSpec): cint {.importc, header: "<mqueue.h>".}
+proc mq_unlink*(a1: cstring): cint {.importc, header: "<mqueue.h>".}
+
+
+proc getpwnam*(a1: cstring): ptr TPasswd {.importc, header: "<pwd.h>".}
+proc getpwuid*(a1: Tuid): ptr TPasswd {.importc, header: "<pwd.h>".}
+proc getpwnam_r*(a1: cstring, a2: ptr Tpasswd, a3: cstring, a4: int,
+                 a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".}
+proc getpwuid_r*(a1: Tuid, a2: ptr Tpasswd, a3: cstring,
+      a4: int, a5: ptr ptr Tpasswd): cint {.importc, header: "<pwd.h>".}
+proc endpwent*() {.importc, header: "<pwd.h>".}
+proc getpwent*(): ptr TPasswd {.importc, header: "<pwd.h>".}
+proc setpwent*() {.importc, header: "<pwd.h>".}
+
+proc uname*(a1: var Tutsname): cint {.importc, header: "<sys/utsname.h>".}
+
+proc pthread_atfork*(a1, a2, a3: proc {.noconv.}): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_destroy*(a1: ptr Tpthread_attr): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getdetachstate*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getguardsize*(a1: ptr Tpthread_attr, a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getinheritsched*(a1: ptr Tpthread_attr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getschedparam*(a1: ptr Tpthread_attr,
+          a2: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getschedpolicy*(a1: ptr Tpthread_attr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getscope*(a1: ptr Tpthread_attr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getstack*(a1: ptr Tpthread_attr,
+         a2: var pointer, a3: var int): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getstackaddr*(a1: ptr Tpthread_attr,
+          a2: var pointer): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_getstacksize*(a1: ptr Tpthread_attr,
+          a2: var int): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_init*(a1: ptr Tpthread_attr): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setdetachstate*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setguardsize*(a1: ptr Tpthread_attr, a2: int): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setinheritsched*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setschedparam*(a1: ptr Tpthread_attr,
+          a2: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setschedpolicy*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setscope*(a1: ptr Tpthread_attr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setstack*(a1: ptr Tpthread_attr, a2: pointer, a3: int): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setstackaddr*(a1: ptr TPthread_attr, a2: pointer): cint {.importc, header: "<pthread.h>".}
+proc pthread_attr_setstacksize*(a1: ptr TPthread_attr, a2: int): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrier_destroy*(a1: ptr Tpthread_barrier): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrier_init*(a1: ptr Tpthread_barrier,
+         a2: ptr Tpthread_barrierattr, a3: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrier_wait*(a1: ptr Tpthread_barrier): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrierattr_destroy*(a1: ptr Tpthread_barrierattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrierattr_getpshared*(
+          a1: ptr Tpthread_barrierattr, a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrierattr_init*(a1: ptr TPthread_barrierattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_barrierattr_setpshared*(a1: ptr TPthread_barrierattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_cancel*(a1: Tpthread): cint {.importc, header: "<pthread.h>".}
+proc pthread_cleanup_push*(a1: proc (x: pointer) {.noconv.}, a2: pointer) {.importc, header: "<pthread.h>".}
+proc pthread_cleanup_pop*(a1: cint) {.importc, header: "<pthread.h>".}
+proc pthread_cond_broadcast*(a1: ptr Tpthread_cond): cint {.importc, header: "<pthread.h>".}
+proc pthread_cond_destroy*(a1: ptr Tpthread_cond): cint {.importc, header: "<pthread.h>".}
+proc pthread_cond_init*(a1: ptr Tpthread_cond,
+          a2: ptr Tpthread_condattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_cond_signal*(a1: ptr Tpthread_cond): cint {.importc, header: "<pthread.h>".}
+proc pthread_cond_timedwait*(a1: ptr Tpthread_cond,
+          a2: ptr Tpthread_mutex, a3: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_cond_wait*(a1: ptr Tpthread_cond,
+          a2: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}
+proc pthread_condattr_destroy*(a1: ptr Tpthread_condattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_condattr_getclock*(a1: ptr Tpthread_condattr,
+          a2: var Tclockid): cint {.importc, header: "<pthread.h>".}
+proc pthread_condattr_getpshared*(a1: ptr Tpthread_condattr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+          
+proc pthread_condattr_init*(a1: ptr TPthread_condattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_condattr_setclock*(a1: ptr TPthread_condattr,a2: Tclockid): cint {.importc, header: "<pthread.h>".}
+proc pthread_condattr_setpshared*(a1: ptr TPthread_condattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_create*(a1: ptr Tpthread, a2: ptr Tpthread_attr,
+          a3: proc (x: pointer): pointer {.noconv.}, a4: pointer): cint {.importc, header: "<pthread.h>".}
+proc pthread_detach*(a1: Tpthread): cint {.importc, header: "<pthread.h>".}
+proc pthread_equal*(a1, a2: Tpthread): cint {.importc, header: "<pthread.h>".}
+proc pthread_exit*(a1: pointer) {.importc, header: "<pthread.h>".}
+proc pthread_getconcurrency*(): cint {.importc, header: "<pthread.h>".}
+proc pthread_getcpuclockid*(a1: Tpthread, a2: var Tclockid): cint {.importc, header: "<pthread.h>".}
+proc pthread_getschedparam*(a1: Tpthread,  a2: var cint,
+          a3: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}
+proc pthread_getspecific*(a1: Tpthread_key): pointer {.importc, header: "<pthread.h>".}
+proc pthread_join*(a1: Tpthread, a2: ptr pointer): cint {.importc, header: "<pthread.h>".}
+proc pthread_key_create*(a1: ptr Tpthread_key, a2: proc (x: pointer) {.noconv.}): cint {.importc, header: "<pthread.h>".}
+proc pthread_key_delete*(a1: Tpthread_key): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_mutex_destroy*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_getprioceiling*(a1: ptr Tpthread_mutex,
+         a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_init*(a1: ptr Tpthread_mutex,
+          a2: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_lock*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_setprioceiling*(a1: ptr Tpthread_mutex,a2: cint,
+          a3: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_timedlock*(a1: ptr Tpthread_mutex,
+          a2: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_trylock*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutex_unlock*(a1: ptr Tpthread_mutex): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_destroy*(a1: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_mutexattr_getprioceiling*(
+          a1: ptr Tpthread_mutexattr, a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_getprotocol*(a1: ptr Tpthread_mutexattr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_getpshared*(a1: ptr Tpthread_mutexattr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_gettype*(a1: ptr Tpthread_mutexattr,
+          a2: var cint): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_mutexattr_init*(a1: ptr Tpthread_mutexattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_setprioceiling*(a1: ptr tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_setprotocol*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_setpshared*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_mutexattr_settype*(a1: ptr Tpthread_mutexattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_once*(a1: ptr Tpthread_once, a2: proc {.noconv.}): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_rwlock_destroy*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_init*(a1: ptr Tpthread_rwlock,
+          a2: ptr Tpthread_rwlockattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_rdlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_timedrdlock*(a1: ptr Tpthread_rwlock,
+          a2: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_timedwrlock*(a1: ptr Tpthread_rwlock,
+          a2: ptr Ttimespec): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_rwlock_tryrdlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_trywrlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_unlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlock_wrlock*(a1: ptr Tpthread_rwlock): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlockattr_destroy*(a1: ptr Tpthread_rwlockattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlockattr_getpshared*(
+          a1: ptr Tpthread_rwlockattr, a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlockattr_init*(a1: ptr Tpthread_rwlockattr): cint {.importc, header: "<pthread.h>".}
+proc pthread_rwlockattr_setpshared*(a1: ptr Tpthread_rwlockattr, a2: cint): cint {.importc, header: "<pthread.h>".}
+
+proc pthread_self*(): Tpthread {.importc, header: "<pthread.h>".}
+proc pthread_setcancelstate*(a1: cint, a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_setcanceltype*(a1: cint, a2: var cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_setconcurrency*(a1: cint): cint {.importc, header: "<pthread.h>".}
+proc pthread_setschedparam*(a1: Tpthread, a2: cint,
+          a3: ptr Tsched_param): cint {.importc, header: "<pthread.h>".}
+
 proc pthread_setschedprio*(a1: Tpthread, a2: cint): cint {.
-  importc, header: "<pthread.h>".}

+  importc, header: "<pthread.h>".}
 proc pthread_setspecific*(a1: Tpthread_key, a2: pointer): cint {.
-  importc, header: "<pthread.h>".}

+  importc, header: "<pthread.h>".}
 proc pthread_spin_destroy*(a1: ptr Tpthread_spinlock): cint {.
-  importc, header: "<pthread.h>".}

+  importc, header: "<pthread.h>".}
 proc pthread_spin_init*(a1: ptr Tpthread_spinlock, a2: cint): cint {.
-  importc, header: "<pthread.h>".}

+  importc, header: "<pthread.h>".}
 proc pthread_spin_lock*(a1: ptr Tpthread_spinlock): cint {.
-  importc, header: "<pthread.h>".}

+  importc, header: "<pthread.h>".}
 proc pthread_spin_trylock*(a1: ptr Tpthread_spinlock): cint{.
-  importc, header: "<pthread.h>".}

+  importc, header: "<pthread.h>".}
 proc pthread_spin_unlock*(a1: ptr Tpthread_spinlock): cint {.
-  importc, header: "<pthread.h>".}

-proc pthread_testcancel*() {.importc, header: "<pthread.h>".}

-

-

-proc access*(a1: cstring, a2: cint): cint {.importc, header: "<unistd.h>".}

-proc alarm*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc chdir*(a1: cstring): cint {.importc, header: "<unistd.h>".}

-proc chown*(a1: cstring, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}

-proc close*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc confstr*(a1: cint, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}

-proc crypt*(a1, a2: cstring): cstring {.importc, header: "<unistd.h>".}

-proc ctermid*(a1: cstring): cstring {.importc, header: "<unistd.h>".}

-proc dup*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc dup2*(a1, a2: cint): cint {.importc, header: "<unistd.h>".}

-proc encrypt*(a1: array[0..63, char], a2: cint) {.importc, header: "<unistd.h>".}

-

-proc execl*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}

-proc execle*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}

-proc execlp*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}

-proc execv*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".}

+  importc, header: "<pthread.h>".}
+proc pthread_testcancel*() {.importc, header: "<pthread.h>".}
+
+
+proc access*(a1: cstring, a2: cint): cint {.importc, header: "<unistd.h>".}
+proc alarm*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc chdir*(a1: cstring): cint {.importc, header: "<unistd.h>".}
+proc chown*(a1: cstring, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}
+proc close*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc confstr*(a1: cint, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}
+proc crypt*(a1, a2: cstring): cstring {.importc, header: "<unistd.h>".}
+proc ctermid*(a1: cstring): cstring {.importc, header: "<unistd.h>".}
+proc dup*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc dup2*(a1, a2: cint): cint {.importc, header: "<unistd.h>".}
+proc encrypt*(a1: array[0..63, char], a2: cint) {.importc, header: "<unistd.h>".}
+
+proc execl*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}
+proc execle*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}
+proc execlp*(a1, a2: cstring): cint {.varargs, importc, header: "<unistd.h>".}
+proc execv*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".}
 proc execve*(a1: cstring, a2, a3: cstringArray): cint {.
-  importc, header: "<unistd.h>".}

-proc execvp*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".}

-proc fchown*(a1: cint, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}

-proc fchdir*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc fdatasync*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc fork*(): Tpid {.importc, header: "<unistd.h>".}

-proc fpathconf*(a1, a2: cint): int {.importc, header: "<unistd.h>".}

-proc fsync*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc ftruncate*(a1: cint, a2: Toff): cint {.importc, header: "<unistd.h>".}

-proc getcwd*(a1: cstring, a2: int): cstring {.importc, header: "<unistd.h>".}

-proc getegid*(): TGid {.importc, header: "<unistd.h>".}

-proc geteuid*(): TUid {.importc, header: "<unistd.h>".}

-proc getgid*(): TGid {.importc, header: "<unistd.h>".}

-

+  importc, header: "<unistd.h>".}
+proc execvp*(a1: cstring, a2: cstringArray): cint {.importc, header: "<unistd.h>".}
+proc fchown*(a1: cint, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}
+proc fchdir*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc fdatasync*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc fork*(): Tpid {.importc, header: "<unistd.h>".}
+proc fpathconf*(a1, a2: cint): int {.importc, header: "<unistd.h>".}
+proc fsync*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc ftruncate*(a1: cint, a2: Toff): cint {.importc, header: "<unistd.h>".}
+proc getcwd*(a1: cstring, a2: int): cstring {.importc, header: "<unistd.h>".}
+proc getegid*(): TGid {.importc, header: "<unistd.h>".}
+proc geteuid*(): TUid {.importc, header: "<unistd.h>".}
+proc getgid*(): TGid {.importc, header: "<unistd.h>".}
+
 proc getgroups*(a1: cint, a2: ptr array[0..255, Tgid]): cint {.
-  importc, header: "<unistd.h>".}

-proc gethostid*(): int {.importc, header: "<unistd.h>".}

-proc gethostname*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".}

-proc getlogin*(): cstring {.importc, header: "<unistd.h>".}

-proc getlogin_r*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".}

-

+  importc, header: "<unistd.h>".}
+proc gethostid*(): int {.importc, header: "<unistd.h>".}
+proc gethostname*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".}
+proc getlogin*(): cstring {.importc, header: "<unistd.h>".}
+proc getlogin_r*(a1: cstring, a2: int): cint {.importc, header: "<unistd.h>".}
+
 proc getopt*(a1: cint, a2: cstringArray, a3: cstring): cint {.
-  importc, header: "<unistd.h>".}

-proc getpgid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".}

-proc getpgrp*(): Tpid {.importc, header: "<unistd.h>".}

-proc getpid*(): Tpid {.importc, header: "<unistd.h>".}

-proc getppid*(): Tpid {.importc, header: "<unistd.h>".}

-proc getsid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".}

-proc getuid*(): Tuid {.importc, header: "<unistd.h>".}

-proc getwd*(a1: cstring): cstring {.importc, header: "<unistd.h>".}

-proc isatty*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc lchown*(a1: cstring, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}

-proc link*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}

-

-proc lockf*(a1, a2: cint, a3: Toff): cint {.importc, header: "<unistd.h>".}

-proc lseek*(a1: cint, a2: Toff, a3: cint): Toff {.importc, header: "<unistd.h>".}

-proc nice*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc pathconf*(a1: cstring, a2: cint): int {.importc, header: "<unistd.h>".}

-

-proc pause*(): cint {.importc, header: "<unistd.h>".}

-proc pipe*(a: array[0..1, cint]): cint {.importc, header: "<unistd.h>".}

+  importc, header: "<unistd.h>".}
+proc getpgid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".}
+proc getpgrp*(): Tpid {.importc, header: "<unistd.h>".}
+proc getpid*(): Tpid {.importc, header: "<unistd.h>".}
+proc getppid*(): Tpid {.importc, header: "<unistd.h>".}
+proc getsid*(a1: Tpid): Tpid {.importc, header: "<unistd.h>".}
+proc getuid*(): Tuid {.importc, header: "<unistd.h>".}
+proc getwd*(a1: cstring): cstring {.importc, header: "<unistd.h>".}
+proc isatty*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc lchown*(a1: cstring, a2: Tuid, a3: Tgid): cint {.importc, header: "<unistd.h>".}
+proc link*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}
+
+proc lockf*(a1, a2: cint, a3: Toff): cint {.importc, header: "<unistd.h>".}
+proc lseek*(a1: cint, a2: Toff, a3: cint): Toff {.importc, header: "<unistd.h>".}
+proc nice*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc pathconf*(a1: cstring, a2: cint): int {.importc, header: "<unistd.h>".}
+
+proc pause*(): cint {.importc, header: "<unistd.h>".}
+proc pipe*(a: array[0..1, cint]): cint {.importc, header: "<unistd.h>".}
 proc pread*(a1: cint, a2: pointer, a3: int, a4: Toff): int {.
-  importc, header: "<unistd.h>".}

+  importc, header: "<unistd.h>".}
 proc pwrite*(a1: cint, a2: pointer, a3: int, a4: Toff): int {.
-  importc, header: "<unistd.h>".}

-proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}

-proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}

-

-proc rmdir*(a1: cstring): cint {.importc, header: "<unistd.h>".}

-proc setegid*(a1: Tgid): cint {.importc, header: "<unistd.h>".}

-proc seteuid*(a1: Tuid): cint {.importc, header: "<unistd.h>".}

-proc setgid*(a1: Tgid): cint {.importc, header: "<unistd.h>".}

-

-proc setpgid*(a1, a2: Tpid): cint {.importc, header: "<unistd.h>".}

-proc setpgrp*(): Tpid {.importc, header: "<unistd.h>".}

-proc setregid*(a1, a2: Tgid): cint {.importc, header: "<unistd.h>".}

-proc setreuid*(a1, a2: Tuid): cint {.importc, header: "<unistd.h>".}

-proc setsid*(): Tpid {.importc, header: "<unistd.h>".}

-proc setuid*(a1: Tuid): cint {.importc, header: "<unistd.h>".}

-proc sleep*(a1: cint): cint {.importc, header: "<unistd.h>".}

-proc swab*(a1, a2: pointer, a3: int) {.importc, header: "<unistd.h>".}

-proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}

-proc sync*() {.importc, header: "<unistd.h>".}

-proc sysconf*(a1: cint): int {.importc, header: "<unistd.h>".}

-proc tcgetpgrp*(a1: cint): tpid {.importc, header: "<unistd.h>".}

-proc tcsetpgrp*(a1: cint, a2: Tpid): cint {.importc, header: "<unistd.h>".}

-proc truncate*(a1: cstring, a2: Toff): cint {.importc, header: "<unistd.h>".}

-proc ttyname*(a1: cint): cstring {.importc, header: "<unistd.h>".}

+  importc, header: "<unistd.h>".}
+proc read*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}
+proc readlink*(a1, a2: cstring, a3: int): int {.importc, header: "<unistd.h>".}
+
+proc rmdir*(a1: cstring): cint {.importc, header: "<unistd.h>".}
+proc setegid*(a1: Tgid): cint {.importc, header: "<unistd.h>".}
+proc seteuid*(a1: Tuid): cint {.importc, header: "<unistd.h>".}
+proc setgid*(a1: Tgid): cint {.importc, header: "<unistd.h>".}
+
+proc setpgid*(a1, a2: Tpid): cint {.importc, header: "<unistd.h>".}
+proc setpgrp*(): Tpid {.importc, header: "<unistd.h>".}
+proc setregid*(a1, a2: Tgid): cint {.importc, header: "<unistd.h>".}
+proc setreuid*(a1, a2: Tuid): cint {.importc, header: "<unistd.h>".}
+proc setsid*(): Tpid {.importc, header: "<unistd.h>".}
+proc setuid*(a1: Tuid): cint {.importc, header: "<unistd.h>".}
+proc sleep*(a1: cint): cint {.importc, header: "<unistd.h>".}
+proc swab*(a1, a2: pointer, a3: int) {.importc, header: "<unistd.h>".}
+proc symlink*(a1, a2: cstring): cint {.importc, header: "<unistd.h>".}
+proc sync*() {.importc, header: "<unistd.h>".}
+proc sysconf*(a1: cint): int {.importc, header: "<unistd.h>".}
+proc tcgetpgrp*(a1: cint): tpid {.importc, header: "<unistd.h>".}
+proc tcsetpgrp*(a1: cint, a2: Tpid): cint {.importc, header: "<unistd.h>".}
+proc truncate*(a1: cstring, a2: Toff): cint {.importc, header: "<unistd.h>".}
+proc ttyname*(a1: cint): cstring {.importc, header: "<unistd.h>".}
 proc ttyname_r*(a1: cint, a2: cstring, a3: int): cint {.
-  importc, header: "<unistd.h>".}

-proc ualarm*(a1, a2: Tuseconds): Tuseconds {.importc, header: "<unistd.h>".}

-proc unlink*(a1: cstring): cint {.importc, header: "<unistd.h>".}

-proc usleep*(a1: Tuseconds): cint {.importc, header: "<unistd.h>".}

-proc vfork*(): tpid {.importc, header: "<unistd.h>".}

-proc write*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}

-

-proc sem_close*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

-proc sem_destroy*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

+  importc, header: "<unistd.h>".}
+proc ualarm*(a1, a2: Tuseconds): Tuseconds {.importc, header: "<unistd.h>".}
+proc unlink*(a1: cstring): cint {.importc, header: "<unistd.h>".}
+proc usleep*(a1: Tuseconds): cint {.importc, header: "<unistd.h>".}
+proc vfork*(): tpid {.importc, header: "<unistd.h>".}
+proc write*(a1: cint, a2: pointer, a3: int): int {.importc, header: "<unistd.h>".}
+
+proc sem_close*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}
+proc sem_destroy*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}
 proc sem_getvalue*(a1: ptr Tsem, a2: var cint): cint {.
-  importc, header: "<semaphore.h>".}

+  importc, header: "<semaphore.h>".}
 proc sem_init*(a1: ptr Tsem, a2: cint, a3: cint): cint {.
-  importc, header: "<semaphore.h>".}

+  importc, header: "<semaphore.h>".}
 proc sem_open*(a1: cstring, a2: cint): ptr TSem {.
-  varargs, importc, header: "<semaphore.h>".}

-proc sem_post*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

+  varargs, importc, header: "<semaphore.h>".}
+proc sem_post*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}
 proc sem_timedwait*(a1: ptr Tsem, a2: ptr Ttimespec): cint {.
-  importc, header: "<semaphore.h>".}

-proc sem_trywait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

-proc sem_unlink*(a1: cstring): cint {.importc, header: "<semaphore.h>".}

-proc sem_wait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}

-

-proc ftok*(a1: cstring, a2: cint): Tkey {.importc, header: "<sys/ipc.h>".}

-

+  importc, header: "<semaphore.h>".}
+proc sem_trywait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}
+proc sem_unlink*(a1: cstring): cint {.importc, header: "<semaphore.h>".}
+proc sem_wait*(a1: ptr Tsem): cint {.importc, header: "<semaphore.h>".}
+
+proc ftok*(a1: cstring, a2: cint): Tkey {.importc, header: "<sys/ipc.h>".}
+
 proc statvfs*(a1: cstring, a2: var Tstatvfs): cint {.
-  importc, header: "<sys/statvfs.h>".}

+  importc, header: "<sys/statvfs.h>".}
 proc fstatvfs*(a1: cint, a2: var Tstatvfs): cint {.
-  importc, header: "<sys/statvfs.h>".}

-

-proc chmod*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

-proc fchmod*(a1: cint, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

-proc fstat*(a1: cint, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}

-proc lstat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}

-proc mkdir*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

-proc mkfifo*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}

+  importc, header: "<sys/statvfs.h>".}
+
+proc chmod*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}
+proc fchmod*(a1: cint, a2: TMode): cint {.importc, header: "<sys/stat.h>".}
+proc fstat*(a1: cint, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}
+proc lstat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}
+proc mkdir*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}
+proc mkfifo*(a1: cstring, a2: TMode): cint {.importc, header: "<sys/stat.h>".}
 proc mknod*(a1: cstring, a2: TMode, a3: Tdev): cint {.
-  importc, header: "<sys/stat.h>".}

-proc stat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}

-proc umask*(a1: Tmode): TMode {.importc, header: "<sys/stat.h>".}

-

-proc S_ISBLK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a block special file.

-proc S_ISCHR*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a character special file.

-proc S_ISDIR*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a directory.

-proc S_ISFIFO*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a pipe or FIFO special file.

-proc S_ISREG*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a regular file.

-proc S_ISLNK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a symbolic link.

-proc S_ISSOCK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a socket. 

-    

-proc S_TYPEISMQ*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a message queue.

-proc S_TYPEISSEM*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a semaphore.

-proc S_TYPEISSHM*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}

-  ## Test for a shared memory object. 

-    

-proc S_TYPEISTMO*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}

-  ## Test macro for a typed memory object. 

-  

-proc mlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}

-proc mlockall*(a1: cint): cint {.importc, header: "<sys/mman.h>".}

+  importc, header: "<sys/stat.h>".}
+proc stat*(a1: cstring, a2: var Tstat): cint {.importc, header: "<sys/stat.h>".}
+proc umask*(a1: Tmode): TMode {.importc, header: "<sys/stat.h>".}
+
+proc S_ISBLK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a block special file.
+proc S_ISCHR*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a character special file.
+proc S_ISDIR*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a directory.
+proc S_ISFIFO*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a pipe or FIFO special file.
+proc S_ISREG*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a regular file.
+proc S_ISLNK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a symbolic link.
+proc S_ISSOCK*(m: Tmode): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a socket. 
+    
+proc S_TYPEISMQ*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a message queue.
+proc S_TYPEISSEM*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a semaphore.
+proc S_TYPEISSHM*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}
+  ## Test for a shared memory object. 
+    
+proc S_TYPEISTMO*(buf: var TStat): bool {.importc, header: "<sys/stat.h>".}
+  ## Test macro for a typed memory object. 
+  
+proc mlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}
+proc mlockall*(a1: cint): cint {.importc, header: "<sys/mman.h>".}
 proc mmap*(a1: pointer, a2: int, a3, a4, a5: cint, a6: Toff): pointer {.
-  importc, header: "<sys/mman.h>".}

+  importc, header: "<sys/mman.h>".}
 proc mprotect*(a1: pointer, a2: int, a3: cint): cint {.
-  importc, header: "<sys/mman.h>".}

-proc msync*(a1: pointer, a2: int, a3: cint): cint {.importc, header: "<sys/mman.h>".}

-proc munlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}

-proc munlockall*(): cint {.importc, header: "<sys/mman.h>".}

-proc munmap*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}

+  importc, header: "<sys/mman.h>".}
+proc msync*(a1: pointer, a2: int, a3: cint): cint {.importc, header: "<sys/mman.h>".}
+proc munlock*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}
+proc munlockall*(): cint {.importc, header: "<sys/mman.h>".}
+proc munmap*(a1: pointer, a2: int): cint {.importc, header: "<sys/mman.h>".}
 proc posix_madvise*(a1: pointer, a2: int, a3: cint): cint {.
-  importc, header: "<sys/mman.h>".}

-proc posix_mem_offset*(a1: pointer, a2: int, a3: var Toff,

-           a4: var int, a5: var cint): cint {.importc, header: "<sys/mman.h>".}

+  importc, header: "<sys/mman.h>".}
+proc posix_mem_offset*(a1: pointer, a2: int, a3: var Toff,
+           a4: var int, a5: var cint): cint {.importc, header: "<sys/mman.h>".}
 proc posix_typed_mem_get_info*(a1: cint, 
-  a2: var Tposix_typed_mem_info): cint {.importc, header: "<sys/mman.h>".}

+  a2: var Tposix_typed_mem_info): cint {.importc, header: "<sys/mman.h>".}
 proc posix_typed_mem_open*(a1: cstring, a2, a3: cint): cint {.
-  importc, header: "<sys/mman.h>".}

+  importc, header: "<sys/mman.h>".}
 proc shm_open*(a1: cstring, a2: cint, a3: Tmode): cint {.
-  importc, header: "<sys/mman.h>".}

-proc shm_unlink*(a1: cstring): cint {.importc, header: "<sys/mman.h>".}

-

-proc asctime*(a1: var ttm): cstring{.importc, header: "<time.h>".}

-

-proc asctime_r*(a1: var ttm, a2: cstring): cstring {.importc, header: "<time.h>".}

-proc clock*(): Tclock {.importc, header: "<time.h>".}

+  importc, header: "<sys/mman.h>".}
+proc shm_unlink*(a1: cstring): cint {.importc, header: "<sys/mman.h>".}
+
+proc asctime*(a1: var ttm): cstring{.importc, header: "<time.h>".}
+
+proc asctime_r*(a1: var ttm, a2: cstring): cstring {.importc, header: "<time.h>".}
+proc clock*(): Tclock {.importc, header: "<time.h>".}
 proc clock_getcpuclockid*(a1: tpid, a2: var Tclockid): cint {.
-  importc, header: "<time.h>".}

+  importc, header: "<time.h>".}
 proc clock_getres*(a1: Tclockid, a2: var Ttimespec): cint {.
-  importc, header: "<time.h>".}

+  importc, header: "<time.h>".}
 proc clock_gettime*(a1: Tclockid, a2: var Ttimespec): cint {.
-  importc, header: "<time.h>".}

-proc clock_nanosleep*(a1: Tclockid, a2: cint, a3: var Ttimespec,

-               a4: var Ttimespec): cint {.importc, header: "<time.h>".}

+  importc, header: "<time.h>".}
+proc clock_nanosleep*(a1: Tclockid, a2: cint, a3: var Ttimespec,
+               a4: var Ttimespec): cint {.importc, header: "<time.h>".}
 proc clock_settime*(a1: Tclockid, a2: var Ttimespec): cint {.
-  importc, header: "<time.h>".}

-

-proc ctime*(a1: var Ttime): cstring {.importc, header: "<time.h>".}

-proc ctime_r*(a1: var Ttime, a2: cstring): cstring {.importc, header: "<time.h>".}

-proc difftime*(a1, a2: Ttime): cdouble {.importc, header: "<time.h>".}

-proc getdate*(a1: cstring): ptr ttm {.importc, header: "<time.h>".}

-

-proc gmtime*(a1: var ttime): ptr ttm {.importc, header: "<time.h>".}

-proc gmtime_r*(a1: var ttime, a2: var ttm): ptr ttm {.importc, header: "<time.h>".}

-proc localtime*(a1: var ttime): ptr ttm {.importc, header: "<time.h>".}

-proc localtime_r*(a1: var ttime, a2: var ttm): ptr ttm {.importc, header: "<time.h>".}

-proc mktime*(a1: var ttm): ttime  {.importc, header: "<time.h>".}

-proc nanosleep*(a1, a2: var Ttimespec): cint {.importc, header: "<time.h>".}

-proc strftime*(a1: cstring, a2: int, a3: cstring,

-           a4: var ttm): int {.importc, header: "<time.h>".}

-proc strptime*(a1, a2: cstring, a3: var ttm): cstring {.importc, header: "<time.h>".}

-proc time*(a1: var Ttime): ttime {.importc, header: "<time.h>".}

-proc timer_create*(a1: var Tclockid, a2: var Tsigevent,

-               a3: var Ttimer): cint {.importc, header: "<time.h>".}

-proc timer_delete*(a1: var Ttimer): cint {.importc, header: "<time.h>".}

+  importc, header: "<time.h>".}
+
+proc ctime*(a1: var Ttime): cstring {.importc, header: "<time.h>".}
+proc ctime_r*(a1: var Ttime, a2: cstring): cstring {.importc, header: "<time.h>".}
+proc difftime*(a1, a2: Ttime): cdouble {.importc, header: "<time.h>".}
+proc getdate*(a1: cstring): ptr ttm {.importc, header: "<time.h>".}
+
+proc gmtime*(a1: var ttime): ptr ttm {.importc, header: "<time.h>".}
+proc gmtime_r*(a1: var ttime, a2: var ttm): ptr ttm {.importc, header: "<time.h>".}
+proc localtime*(a1: var ttime): ptr ttm {.importc, header: "<time.h>".}
+proc localtime_r*(a1: var ttime, a2: var ttm): ptr ttm {.importc, header: "<time.h>".}
+proc mktime*(a1: var ttm): ttime  {.importc, header: "<time.h>".}
+proc nanosleep*(a1, a2: var Ttimespec): cint {.importc, header: "<time.h>".}
+proc strftime*(a1: cstring, a2: int, a3: cstring,
+           a4: var ttm): int {.importc, header: "<time.h>".}
+proc strptime*(a1, a2: cstring, a3: var ttm): cstring {.importc, header: "<time.h>".}
+proc time*(a1: var Ttime): ttime {.importc, header: "<time.h>".}
+proc timer_create*(a1: var Tclockid, a2: var Tsigevent,
+               a3: var Ttimer): cint {.importc, header: "<time.h>".}
+proc timer_delete*(a1: var Ttimer): cint {.importc, header: "<time.h>".}
 proc timer_gettime*(a1: Ttimer, a2: var Titimerspec): cint {.
-  importc, header: "<time.h>".}

-proc timer_getoverrun*(a1: Ttimer): cint {.importc, header: "<time.h>".}

-proc timer_settime*(a1: Ttimer, a2: cint, a3: var Titimerspec,

-               a4: var titimerspec): cint {.importc, header: "<time.h>".}

-proc tzset*() {.importc, header: "<time.h>".}

-

-

-proc wait*(a1: var cint): tpid {.importc, header: "<sys/wait.h>".}

+  importc, header: "<time.h>".}
+proc timer_getoverrun*(a1: Ttimer): cint {.importc, header: "<time.h>".}
+proc timer_settime*(a1: Ttimer, a2: cint, a3: var Titimerspec,
+               a4: var titimerspec): cint {.importc, header: "<time.h>".}
+proc tzset*() {.importc, header: "<time.h>".}
+
+
+proc wait*(a1: var cint): tpid {.importc, header: "<sys/wait.h>".}
 proc waitid*(a1: cint, a2: tid, a3: var Tsiginfo, a4: cint): cint {.
-  importc, header: "<sys/wait.h>".}

+  importc, header: "<sys/wait.h>".}
 proc waitpid*(a1: tpid, a2: var cint, a3: cint): tpid  {.
-  importc, header: "<sys/wait.h>".}

-

+  importc, header: "<sys/wait.h>".}
+
 proc bsd_signal*(a1: cint, a2: proc (x: pointer) {.noconv.}) {.
-  importc, header: "<signal.h>".}

-proc kill*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".}

-proc killpg*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".}

-proc pthread_kill*(a1: tpthread, a2: cint): cint {.importc, header: "<signal.h>".}

+  importc, header: "<signal.h>".}
+proc kill*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".}
+proc killpg*(a1: Tpid, a2: cint): cint {.importc, header: "<signal.h>".}
+proc pthread_kill*(a1: tpthread, a2: cint): cint {.importc, header: "<signal.h>".}
 proc pthread_sigmask*(a1: cint, a2, a3: var Tsigset): cint {.
-  importc, header: "<signal.h>".}

-proc `raise`*(a1: cint): cint {.importc, header: "<signal.h>".}

+  importc, header: "<signal.h>".}
+proc `raise`*(a1: cint): cint {.importc, header: "<signal.h>".}
 proc sigaction*(a1: cint, a2, a3: var Tsigaction): cint {.
-  importc, header: "<signal.h>".}

-proc sigaddset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}

-proc sigaltstack*(a1, a2: var Tstack): cint {.importc, header: "<signal.h>".}

-proc sigdelset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}

-proc sigemptyset*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}

-proc sigfillset*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}

-proc sighold*(a1: cint): cint {.importc, header: "<signal.h>".}

-proc sigignore*(a1: cint): cint {.importc, header: "<signal.h>".}

-proc siginterrupt*(a1, a2: cint): cint {.importc, header: "<signal.h>".}

-proc sigismember*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}

+  importc, header: "<signal.h>".}
+proc sigaddset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}
+proc sigaltstack*(a1, a2: var Tstack): cint {.importc, header: "<signal.h>".}
+proc sigdelset*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}
+proc sigemptyset*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}
+proc sigfillset*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}
+proc sighold*(a1: cint): cint {.importc, header: "<signal.h>".}
+proc sigignore*(a1: cint): cint {.importc, header: "<signal.h>".}
+proc siginterrupt*(a1, a2: cint): cint {.importc, header: "<signal.h>".}
+proc sigismember*(a1: var Tsigset, a2: cint): cint {.importc, header: "<signal.h>".}
 proc signal*(a1: cint, a2: proc (x: cint) {.noconv.}) {.
-  importc, header: "<signal.h>".}

-proc sigpause*(a1: cint): cint {.importc, header: "<signal.h>".}

-proc sigpending*(a1: var tsigset): cint {.importc, header: "<signal.h>".}

+  importc, header: "<signal.h>".}
+proc sigpause*(a1: cint): cint {.importc, header: "<signal.h>".}
+proc sigpending*(a1: var tsigset): cint {.importc, header: "<signal.h>".}
 proc sigprocmask*(a1: cint, a2, a3: var tsigset): cint {.
-  importc, header: "<signal.h>".}

+  importc, header: "<signal.h>".}
 proc sigqueue*(a1: tpid, a2: cint, a3: Tsigval): cint {.
-  importc, header: "<signal.h>".}

-proc sigrelse*(a1: cint): cint {.importc, header: "<signal.h>".}

-proc sigset*(a1: int, a2: proc (x: cint) {.noconv.}) {.importc, header: "<signal.h>".}

-proc sigsuspend*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}

+  importc, header: "<signal.h>".}
+proc sigrelse*(a1: cint): cint {.importc, header: "<signal.h>".}
+proc sigset*(a1: int, a2: proc (x: cint) {.noconv.}) {.importc, header: "<signal.h>".}
+proc sigsuspend*(a1: var Tsigset): cint {.importc, header: "<signal.h>".}
 proc sigtimedwait*(a1: var Tsigset, a2: var tsiginfo, 
-                   a3: var ttimespec): cint {.importc, header: "<signal.h>".}

-proc sigwait*(a1: var Tsigset, a2: var cint): cint {.importc, header: "<signal.h>".}

+                   a3: var ttimespec): cint {.importc, header: "<signal.h>".}
+proc sigwait*(a1: var Tsigset, a2: var cint): cint {.importc, header: "<signal.h>".}
 proc sigwaitinfo*(a1: var Tsigset, a2: var tsiginfo): cint {.
-  importc, header: "<signal.h>".}

-

-

-proc catclose*(a1: Tnl_catd): cint {.importc, header: "<nl_types.h>".}

+  importc, header: "<signal.h>".}
+
+
+proc catclose*(a1: Tnl_catd): cint {.importc, header: "<nl_types.h>".}
 proc catgets*(a1: Tnl_catd, a2, a3: cint, a4: cstring): cstring {.
-  importc, header: "<nl_types.h>".}

-proc catopen*(a1: cstring, a2: cint): Tnl_catd {.importc, header: "<nl_types.h>".}

-

-proc sched_get_priority_max*(a1: cint): cint {.importc, header: "<sched.h>".}

-proc sched_get_priority_min*(a1: cint): cint {.importc, header: "<sched.h>".}

+  importc, header: "<nl_types.h>".}
+proc catopen*(a1: cstring, a2: cint): Tnl_catd {.importc, header: "<nl_types.h>".}
+
+proc sched_get_priority_max*(a1: cint): cint {.importc, header: "<sched.h>".}
+proc sched_get_priority_min*(a1: cint): cint {.importc, header: "<sched.h>".}
 proc sched_getparam*(a1: tpid, a2: var Tsched_param): cint {.
-  importc, header: "<sched.h>".}

-proc sched_getscheduler*(a1: tpid): cint {.importc, header: "<sched.h>".}

+  importc, header: "<sched.h>".}
+proc sched_getscheduler*(a1: tpid): cint {.importc, header: "<sched.h>".}
 proc sched_rr_get_interval*(a1: tpid, a2: var Ttimespec): cint {.
-  importc, header: "<sched.h>".}

+  importc, header: "<sched.h>".}
 proc sched_setparam*(a1: tpid, a2: var Tsched_param): cint {.
-  importc, header: "<sched.h>".}

+  importc, header: "<sched.h>".}
 proc sched_setscheduler*(a1: tpid, a2: cint, a3: var tsched_param): cint {.
-  importc, header: "<sched.h>".}

-proc sched_yield*(): cint {.importc, header: "<sched.h>".}

-

-proc strerror*(errnum: cint): cstring {.importc, header: "<string.h>".}

-

-proc FD_CLR*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".}

+  importc, header: "<sched.h>".}
+proc sched_yield*(): cint {.importc, header: "<sched.h>".}
+
+proc strerror*(errnum: cint): cstring {.importc, header: "<string.h>".}
+
+proc FD_CLR*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".}
 proc FD_ISSET*(a1: cint, a2: var Tfd_set): cint {.
-  importc, header: "<sys/select.h>".}

-proc FD_SET*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".}

-proc FD_ZERO*(a1: var Tfd_set) {.importc, header: "<sys/select.h>".}

-

-proc pselect*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimespec,

-         a6: var Tsigset): cint  {.importc, header: "<sys/select.h>".}

-proc select*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimeval): cint {.

-             importc, header: "<sys/select.h>".}

-

-when hasSpawnH:

-  proc posix_spawn*(a1: var tpid, a2: cstring,

-            a3: var Tposix_spawn_file_actions,

+  importc, header: "<sys/select.h>".}
+proc FD_SET*(a1: cint, a2: var Tfd_set) {.importc, header: "<sys/select.h>".}
+proc FD_ZERO*(a1: var Tfd_set) {.importc, header: "<sys/select.h>".}
+
+proc pselect*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimespec,
+         a6: var Tsigset): cint  {.importc, header: "<sys/select.h>".}
+proc select*(a1: cint, a2, a3, a4: var Tfd_set, a5: var ttimeval): cint {.
+             importc, header: "<sys/select.h>".}
+
+when hasSpawnH:
+  proc posix_spawn*(a1: var tpid, a2: cstring,
+            a3: var Tposix_spawn_file_actions,
             a4: var Tposix_spawnattr, 
-            a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawn_file_actions_addclose*(a1: var tposix_spawn_file_actions,

-            a2: cint): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawn_file_actions_adddup2*(a1: var tposix_spawn_file_actions,

-            a2, a3: cint): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawn_file_actions_addopen*(a1: var tposix_spawn_file_actions,

+            a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawn_file_actions_addclose*(a1: var tposix_spawn_file_actions,
+            a2: cint): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawn_file_actions_adddup2*(a1: var tposix_spawn_file_actions,
+            a2, a3: cint): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawn_file_actions_addopen*(a1: var tposix_spawn_file_actions,
             a2: cint, a3: cstring, a4: cint, a5: tmode): cint {.
-            importc, header: "<spawn.h>".}

+            importc, header: "<spawn.h>".}
   proc posix_spawn_file_actions_destroy*(
-    a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}

+    a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}
   proc posix_spawn_file_actions_init*(
-    a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}

+    a1: var tposix_spawn_file_actions): cint {.importc, header: "<spawn.h>".}
   proc posix_spawnattr_destroy*(a1: var tposix_spawnattr): cint {.
-    importc, header: "<spawn.h>".}

-  proc posix_spawnattr_getsigdefault*(a1: var tposix_spawnattr,

-            a2: var Tsigset): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_getflags*(a1: var tposix_spawnattr,

-            a2: var cshort): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_getpgroup*(a1: var tposix_spawnattr,

-            a2: var tpid): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_getschedparam*(a1: var tposix_spawnattr,

-            a2: var tsched_param): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_getschedpolicy*(a1: var tposix_spawnattr,

-            a2: var cint): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnattr_getsigmask*(a1: var tposix_spawnattr,

-            a2: var tsigset): cint {.importc, header: "<spawn.h>".}

-  

+    importc, header: "<spawn.h>".}
+  proc posix_spawnattr_getsigdefault*(a1: var tposix_spawnattr,
+            a2: var Tsigset): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawnattr_getflags*(a1: var tposix_spawnattr,
+            a2: var cshort): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawnattr_getpgroup*(a1: var tposix_spawnattr,
+            a2: var tpid): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawnattr_getschedparam*(a1: var tposix_spawnattr,
+            a2: var tsched_param): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawnattr_getschedpolicy*(a1: var tposix_spawnattr,
+            a2: var cint): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawnattr_getsigmask*(a1: var tposix_spawnattr,
+            a2: var tsigset): cint {.importc, header: "<spawn.h>".}
+  
   proc posix_spawnattr_init*(a1: var tposix_spawnattr): cint {.
-    importc, header: "<spawn.h>".}

-  proc posix_spawnattr_setsigdefault*(a1: var tposix_spawnattr,

-            a2: var tsigset): cint {.importc, header: "<spawn.h>".}

+    importc, header: "<spawn.h>".}
+  proc posix_spawnattr_setsigdefault*(a1: var tposix_spawnattr,
+            a2: var tsigset): cint {.importc, header: "<spawn.h>".}
   proc posix_spawnattr_setflags*(a1: var tposix_spawnattr, a2: cshort): cint {.
-    importc, header: "<spawn.h>".}

+    importc, header: "<spawn.h>".}
   proc posix_spawnattr_setpgroup*(a1: var tposix_spawnattr, a2: tpid): cint {.
-    importc, header: "<spawn.h>".}

-  

-  proc posix_spawnattr_setschedparam*(a1: var tposix_spawnattr,

-            a2: var tsched_param): cint {.importc, header: "<spawn.h>".}

+    importc, header: "<spawn.h>".}
+  
+  proc posix_spawnattr_setschedparam*(a1: var tposix_spawnattr,
+            a2: var tsched_param): cint {.importc, header: "<spawn.h>".}
   proc posix_spawnattr_setschedpolicy*(a1: var tposix_spawnattr, 
                                        a2: cint): cint {.
-                                       importc, header: "<spawn.h>".}

-  proc posix_spawnattr_setsigmask*(a1: var tposix_spawnattr,

-            a2: var tsigset): cint {.importc, header: "<spawn.h>".}

-  proc posix_spawnp*(a1: var tpid, a2: cstring,

-            a3: var tposix_spawn_file_actions,

-            a4: var tposix_spawnattr,

-            a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}

-

-proc getcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".}

+                                       importc, header: "<spawn.h>".}
+  proc posix_spawnattr_setsigmask*(a1: var tposix_spawnattr,
+            a2: var tsigset): cint {.importc, header: "<spawn.h>".}
+  proc posix_spawnp*(a1: var tpid, a2: cstring,
+            a3: var tposix_spawn_file_actions,
+            a4: var tposix_spawnattr,
+            a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".}
+
+proc getcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".}
 proc makecontext*(a1: var Tucontext, a4: proc (){.noconv.}, a3: cint) {.
-  varargs, importc, header: "<ucontext.h>".}

-proc setcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".}

-proc swapcontext*(a1, a2: var Tucontext): cint {.importc, header: "<ucontext.h>".}

+  varargs, importc, header: "<ucontext.h>".}
+proc setcontext*(a1: var Tucontext): cint {.importc, header: "<ucontext.h>".}
+proc swapcontext*(a1, a2: var Tucontext): cint {.importc, header: "<ucontext.h>".}
 
 proc readv*(a1: cint, a2: ptr TIOVec, a3: cint): int {.
   importc, header: "<sys/uio.h>".}
@@ -2311,8 +2311,9 @@ proc CMSG_FIRSTHDR*(mhdr: ptr TMsgHdr): ptr TCMsgHdr {.
 proc accept*(a1: cint, a2: ptr Tsockaddr, a3: ptr Tsocklen): cint {.
   importc, header: "<sys/socket.h>".}
 
-proc bind*(a1: cint, a2: ptr Tsockaddr, a3: Tsocklen): cint {.
-  importc, header: "<sys/socket.h>".}
+proc bindSocket*(a1: cint, a2: ptr Tsockaddr, a3: Tsocklen): cint {.
+  importc: "bind", header: "<sys/socket.h>".}
+  ## is Posix's ``bind``, because ``bind`` is a reserved word
   
 proc connect*(a1: cint, a2: ptr Tsockaddr, a3: Tsocklen): cint {.
   importc, header: "<sys/socket.h>".}
diff --git a/lib/pure/macros.nim b/lib/pure/macros.nim
index ce026a832..644a785cf 100644
--- a/lib/pure/macros.nim
+++ b/lib/pure/macros.nim
@@ -45,27 +45,27 @@ type
     nnkCurly, nnkBracket, nnkBracketExpr, nnkPragmaExpr, 
     nnkRange, nnkDotExpr, nnkCheckedFieldExpr, nnkDerefExpr, 
     nnkIfExpr, nnkElifExpr, nnkElseExpr, nnkLambda, 
-    nnkAccQuoted, nnkHeaderQuoted, nnkTableConstr, nnkQualified, 
-    nnkHiddenStdConv, nnkHiddenSubConv, nnkHiddenCallConv, nnkConv, 
-    nnkCast, nnkAddr, nnkHiddenAddr, nnkHiddenDeref, 
-    nnkObjDownConv, nnkObjUpConv, nnkChckRangeF, nnkChckRange64, 
-    nnkChckRange, nnkStringToCString, nnkCStringToString, nnkPassAsOpenArray, 
-    nnkAsgn, nnkFastAsgn, nnkDefaultTypeParam, nnkGenericParams, 
-    nnkFormalParams, nnkOfInherit, nnkModule, nnkProcDef, 
-    nnkConverterDef, nnkMacroDef, nnkTemplateDef, nnkIteratorDef, 
-    nnkOfBranch, nnkElifBranch, nnkExceptBranch, nnkElse, 
-    nnkMacroStmt, nnkAsmStmt, nnkPragma, nnkIfStmt, 
-    nnkWhenStmt, nnkForStmt, nnkWhileStmt, nnkCaseStmt, 
-    nnkVarSection, nnkConstSection, nnkConstDef, nnkTypeSection, 
-    nnkTypeDef, nnkYieldStmt, nnkTryStmt, nnkFinally, 
-    nnkRaiseStmt, nnkReturnStmt, nnkBreakStmt, nnkContinueStmt, 
-    nnkBlockStmt, nnkDiscardStmt, nnkStmtList, nnkImportStmt, 
-    nnkFromStmt, nnkImportAs, nnkIncludeStmt, nnkCommentStmt, 
-    nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, nnkBlockType, 
-    nnkVm, nnkTypeOfExpr, nnkObjectTy, nnkTupleTy, 
-    nnkRecList, nnkRecCase, nnkRecWhen, nnkRefTy, 
-    nnkPtrTy, nnkVarTy, nnkAbstractTy, nnkProcTy, 
-    nnkEnumTy, nnkEnumFieldDef, nnkReturnToken
+    nnkAccQuoted, nnkTableConstr, nnkQualified, nnkBind, 
+    nnkSymChoice, nnkHiddenStdConv, nnkHiddenSubConv, nnkHiddenCallConv, 
+    nnkConv, nnkCast, nnkAddr, nnkHiddenAddr, 
+    nnkHiddenDeref, nnkObjDownConv, nnkObjUpConv, nnkChckRangeF, 
+    nnkChckRange64, nnkChckRange, nnkStringToCString, nnkCStringToString, 
+    nnkPassAsOpenArray, nnkAsgn, nnkFastAsgn, nnkDefaultTypeParam, 
+    nnkGenericParams, nnkFormalParams, nnkOfInherit, nnkModule, 
+    nnkProcDef, nnkConverterDef, nnkMacroDef, nnkTemplateDef, 
+    nnkIteratorDef, nnkOfBranch, nnkElifBranch, nnkExceptBranch, 
+    nnkElse, nnkMacroStmt, nnkAsmStmt, nnkPragma, 
+    nnkIfStmt, nnkWhenStmt, nnkForStmt, nnkWhileStmt, 
+    nnkCaseStmt, nnkVarSection, nnkConstSection, nnkConstDef, 
+    nnkTypeSection, nnkTypeDef, nnkYieldStmt, nnkTryStmt, 
+    nnkFinally, nnkRaiseStmt, nnkReturnStmt, nnkBreakStmt, 
+    nnkContinueStmt, nnkBlockStmt, nnkDiscardStmt, nnkStmtList, 
+    nnkImportStmt, nnkFromStmt, nnkImportAs, nnkIncludeStmt, 
+    nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, 
+    nnkBlockType, nnkVm, nnkTypeOfExpr, nnkObjectTy, 
+    nnkTupleTy, nnkRecList, nnkRecCase, nnkRecWhen, 
+    nnkRefTy, nnkPtrTy, nnkVarTy, nnkAbstractTy, 
+    nnkProcTy, nnkEnumTy, nnkEnumFieldDef, nnkReturnToken
   TNimNodeKinds* = set[TNimrodNodeKind]
   TNimrodTypeKind* = enum
     ntyNone, ntyBool, ntyChar, ntyEmpty, 
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 847117d93..a0e5565e8 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -556,9 +556,9 @@ proc sameFileContent*(path1, path2: string): bool =
     bufSize = 8192 # 8K buffer
   var
     a, b: TFile
-  if not openFile(a, path1): return false
-  if not openFile(b, path2):
-    closeFile(a)
+  if not open(a, path1): return false
+  if not open(b, path2):
+    close(a)
     return false
   var bufA = alloc(bufsize)
   var bufB = alloc(bufsize)
@@ -576,8 +576,8 @@ proc sameFileContent*(path1, path2: string): bool =
     if readA != bufSize: break # end of file
   dealloc(bufA)
   dealloc(bufB)
-  closeFile(a)
-  closeFile(b)
+  close(a)
+  close(b)
 
 proc copyFile*(dest, source: string) =
   ## Copies a file from `source` to `dest`. If this fails,
@@ -590,9 +590,9 @@ proc copyFile*(dest, source: string) =
       bufSize = 8192 # 8K buffer
     var
       d, s: TFile
-    if not openFile(s, source): OSError()
-    if not openFile(d, dest, fmWrite):
-      closeFile(s)
+    if not open(s, source): OSError()
+    if not open(d, dest, fmWrite):
+      close(s)
       OSError()
     var
       buf: Pointer = alloc(bufsize)
@@ -603,8 +603,8 @@ proc copyFile*(dest, source: string) =
       if bytesread != bufSize: break
       if bytesread != bytesWritten: OSError()
     dealloc(buf)
-    closeFile(s)
-    closeFile(d)
+    close(s)
+    close(d)
 
 proc moveFile*(dest, source: string) =
   ## Moves a file from `source` to `dest`. If this fails, `EOS` is raised.
@@ -954,7 +954,7 @@ proc getHomeDir*(): string =
   when defined(windows): return getEnv("USERPROFILE") & "\\"
   else: return getEnv("HOME") & "/"
 
-proc getConfigDir*(): string {.noSideEffect.} =
+proc getConfigDir*(): string =
   ## Returns the config directory of the current user for applications.
   when defined(windows): return getEnv("APPDATA") & "\\"
   else: return getEnv("HOME") & "/.config/"
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index 205460614..cf4d926b6 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -405,17 +405,17 @@ else:
 
   proc inputStream(p: PProcess): PStream =
     var f: TFile
-    if not openFile(f, p.inputHandle, fmWrite): OSError()
+    if not open(f, p.inputHandle, fmWrite): OSError()
     result = newFileStream(f)
 
   proc outputStream(p: PProcess): PStream =
     var f: TFile
-    if not openFile(f, p.outputHandle, fmRead): OSError()
+    if not open(f, p.outputHandle, fmRead): OSError()
     result = newFileStream(f)
 
   proc errorStream(p: PProcess): PStream =
     var f: TFile
-    if not openFile(f, p.errorHandle, fmRead): OSError()
+    if not open(f, p.errorHandle, fmRead): OSError()
     result = newFileStream(f)
 
   proc csystem(cmd: cstring): cint {.nodecl, importc: "system".}
diff --git a/lib/pure/regexprs.nim b/lib/pure/regexprs.nim
index e2aac3d17..69b35d7f0 100644
--- a/lib/pure/regexprs.nim
+++ b/lib/pure/regexprs.nim
@@ -152,3 +152,25 @@ const ## common regular expressions
   reURL* = r"\b(http(s)?|ftp|gopher|telnet|file|notes|ms\-help):" &
            r"((//)|(\\\\))+[\w\d:#@%/;$()~_?\+\-\=\\\.\&]*\b"
     ## describes an URL
+    
+proc verbose*(pattern: string): string {.noSideEffect.} = 
+  ## deletes whitespace from a pattern that is not escaped or in a character
+  ## class. This is modelled after Perl's ``/x`` modifier. 
+  result = ""
+  var i = 0
+  while i < pattern.len: 
+    case pattern[i]
+    of ' ', '\t': 
+      inc i
+    of '\\': 
+      add result, '\\'
+      add result, pattern[i+1]
+      inc i, 2
+    of '[': 
+      while pattern[i] != ']' and pattern[i] != '\0': 
+        add result, pattern[i]
+        inc i
+    else: 
+      add result, pattern[i]
+      inc i
+
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim
index 238cba4ec..0f4d4f771 100644
--- a/lib/pure/streams.nim
+++ b/lib/pure/streams.nim
@@ -144,7 +144,7 @@ type
   TFileStream* = object of TStream
     f: TFile
 
-proc fsClose(s: PFileStream) = closeFile(s.f)
+proc fsClose(s: PFileStream) = close(s.f)
 proc fsAtEnd(s: PFileStream): bool = return EndOfFile(s.f)
 proc fsSetPosition(s: PFileStream, pos: int) = setFilePos(s.f, pos)
 proc fsGetPosition(s: PFileStream): int = return int(getFilePos(s.f))
@@ -171,7 +171,7 @@ proc newFileStream*(filename: string, mode: TFileMode): PFileStream =
   ## creates a new stream from the file named `filename` with the mode `mode`.
   ## If the file cannot be opened, nil is returned.
   var f: TFile
-  if OpenFile(f, filename, mode): result = newFileStream(f)
+  if Open(f, filename, mode): result = newFileStream(f)
 
 
 when true:
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim
index a4895110b..3a9a8d0b3 100644
--- a/lib/pure/strutils.nim
+++ b/lib/pure/strutils.nim
@@ -150,15 +150,18 @@ proc find*(s: string, chars: set[char], start: int = 0): int {.noSideEffect.}
   ## Searches for `chars` in `s` starting at position `start`. If `s` contains
   ## none of the characters in `chars`, -1 is returned.
 
-proc replaceStr*(s, sub, by: string): string {.noSideEffect.}
+proc replaceStr*(s, sub, by: string): string {.noSideEffect, deprecated.}
   ## Replaces `sub` in `s` by the string `by`.
+  ## **Deprecated since version 0.8.0**: Use `replace` instead.
 
-proc replaceStr*(s: string, sub, by: char): string {.noSideEffect.}
+proc replaceStr*(s: string, sub, by: char): string {.noSideEffect, deprecated.}
   ## optimized version for characters.
+  ## **Deprecated since version 0.8.0**: Use `replace` instead.
 
-proc deleteStr*(s: var string, first, last: int)
+proc deleteStr*(s: var string, first, last: int) {.deprecated.}
   ## Deletes in `s` the characters at position `first`..`last`. This modifies
   ## `s` itself, it does not return a copy.
+  ## **Deprecated since version 0.8.0**: Use `delete` instead.
 
 proc toOctal*(c: char): string
   ## Converts a character `c` to its octal representation. The resulting
@@ -185,7 +188,7 @@ iterator split*(s: string, seps: set[char] = Whitespace): string =
   ##   for word in split(";;this;is;an;;example;;;", {';'}):
   ##     writeln(stdout, word)
   ##
-  ## produces in the same output.
+  ## produces the same output.
   var
     first: int = 0
     last: int = 0
@@ -315,17 +318,15 @@ proc intToStr*(x: int, minchars: int = 1): string
 proc ParseInt*(s: string): int {.noSideEffect.}
   ## Parses a decimal integer value contained in `s`. If `s` is not
   ## a valid integer, `EInvalidValue` is raised.
-  # XXX: make this biggestint!
 
 proc ParseBiggestInt*(s: string): biggestInt {.noSideEffect.}
   ## Parses a decimal integer value contained in `s`. If `s` is not
   ## a valid integer, `EInvalidValue` is raised.
 
-proc ParseFloat*(s: string, start = 0): float {.noSideEffect.}
+proc ParseFloat*(s: string): float {.noSideEffect.}
   ## Parses a decimal floating point value contained in `s`. If `s` is not
   ## a valid floating point number, `EInvalidValue` is raised. ``NAN``,
   ## ``INF``, ``-INF`` are also supported (case insensitive comparison).
-  # XXX: make this biggestfloat.
 
 # the stringify and format operators:
 proc toString*[Ty](x: Ty): string
@@ -439,10 +440,15 @@ proc findNormalized(x: string, inArray: openarray[string]): int =
 proc addf(s: var string, formatstr: string, a: openarray[string]) =
   const PatternChars = {'a'..'z', 'A'..'Z', '0'..'9', '\128'..'\255', '_'}
   var i = 0
+  var num = 0
   while i < len(formatstr):
     if formatstr[i] == '$':
       case formatstr[i+1] # again we use the fact that strings
                           # are zero-terminated here
+      of '#':
+        add s, a[num]
+        inc i, 2
+        inc num
       of '$':
         add s, '$'
         inc(i, 2)
@@ -452,6 +458,7 @@ proc addf(s: var string, formatstr: string, a: openarray[string]) =
         while formatstr[i] in {'0'..'9'}:
           j = j * 10 + ord(formatstr[i]) - ord('0')
           inc(i)
+        num = j
         add s, a[j - 1]
       of '{':
         var j = i+1
@@ -510,6 +517,31 @@ proc splitSeq(s: string, seps: set[char]): seq[string] =
 
 # ---------------------------------------------------------------------------
 
+proc join*(a: openArray[string], sep: string): string =
+  ## concatenates all strings in `a` separating them with `sep`.
+  if len(a) > 0:
+    var L = sep.len * (a.len-1)
+    for i in 0..high(a): inc(L, a[i].len)
+    result = newString(L)
+    setLen(result, 0)
+    add(result, a[0])
+    for i in 1..high(a):
+      add(result, sep)
+      add(result, a[i])
+  else:
+    result = ""
+  
+proc join*(a: openArray[string]): string =
+  ## concatenates all strings in `a`.
+  if len(a) > 0:
+    var L = 0
+    for i in 0..high(a): inc(L, a[i].len)
+    result = newString(L)
+    setLen(result, 0)
+    for i in 0..high(a): add(result, a[i])
+  else:
+    result = ""
+
 proc strip(s: string, leading = true, trailing = true): string =
   const
     chars: set[Char] = Whitespace
@@ -638,7 +670,8 @@ proc contains(s: string, c: char): bool =
 proc contains(s, sub: string): bool =
   return find(s, sub) >= 0
 
-proc replaceStr(s, sub, by: string): string =
+proc replace*(s, sub, by: string): string =
+  ## Replaces `sub` in `s` by the string `by`.
   var a: TSkipTable
   result = ""
   preprocessSub(sub, a)
@@ -652,7 +685,8 @@ proc replaceStr(s, sub, by: string): string =
   # copy the rest:
   add result, copy(s, i)
 
-proc replaceStr(s: string, sub, by: char): string =
+proc replace*(s: string, sub, by: char): string =
+  ## optimized version for characters.
   result = newString(s.len)
   var i = 0
   while i < s.len:
@@ -660,17 +694,23 @@ proc replaceStr(s: string, sub, by: char): string =
     else: result[i] = s[i]
     inc(i)
 
-proc deleteStr(s: var string, first, last: int) =
+proc delete*(s: var string, first, last: int) =
+  ## Deletes in `s` the characters at position `first`..`last`. This modifies
+  ## `s` itself, it does not return a copy.
+  var
+    i = first
   # example: "abc___uvwxyz\0"  (___ is to be deleted)
   # --> first == 3, last == 5
   # s[first..] = s[last+1..]
-  var
-    i = first
   while last+i+1 < len(s):
     s[i] = s[last+i+1]
     inc(i)
   setlen(s, len(s)-(last-first+1))
 
+proc replaceStr(s, sub, by: string): string = return replace(s, sub, by)
+proc replaceStr(s: string, sub, by: char): string = return replace(s, sub, by)
+proc deleteStr*(s: var string, first, last: int) = delete(s, first, last)
+
 # parsing numbers:
 
 proc toHex(x: BiggestInt, len: int): string =
@@ -734,11 +774,11 @@ proc ParseBiggestInt(s: string): biggestInt =
   if index == -1:
     raise newException(EInvalidValue, "invalid integer: " & s)
 
-proc ParseFloat(s: string, start = 0): float =
+proc ParseFloat(s: string): float =
   var
     esign = 1.0
     sign = 1.0
-    i = start
+    i = 0
     exponent: int
     flags: int
   result = 0.0
diff --git a/lib/system.nim b/lib/system.nim
index 5f7eefa45..236a8f8cc 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -69,11 +69,12 @@ proc `or`*(x, y: bool): bool {.magic: "Or", noSideEffect.}
 proc `xor`*(x, y: bool): bool {.magic: "Xor", noSideEffect.}
   ## Boolean `exclusive or`; returns true iff ``x != y``.
 
-proc new*[T](a: var ref T) {.magic: "New".}
+proc new*[T](a: var ref T) {.magic: "New", noSideEffect.}
   ## creates a new object of type ``T`` and returns a safe (traced)
   ## reference to it in ``a``.
 
-proc new*[T](a: var ref T, finalizer: proc (x: ref T)) {.magic: "NewFinalize".}
+proc new*[T](a: var ref T, finalizer: proc (x: ref T)) {.
+  magic: "NewFinalize", noSideEffect.}
   ## creates a new object of type ``T`` and returns a safe (traced)
   ## reference to it in ``a``. When the garbage collector frees the object,
   ## `finalizer` is called. The `finalizer` may not keep a reference to the
@@ -230,17 +231,17 @@ proc pred*[T](x: ordinal[T], y = 1): T {.magic: "Pred", noSideEffect.}
   ## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised
   ## or a compile time error occurs.
 
-proc inc*[T](x: var ordinal[T], y = 1) {.magic: "Inc".}
+proc inc*[T](x: var ordinal[T], y = 1) {.magic: "Inc", noSideEffect.}
   ## increments the ordinal ``x`` by ``y``. If such a value does not
   ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a
   ## short notation for: ``x = succ(x, y)``.
 
-proc dec*[T](x: var ordinal[T], y = 1) {.magic: "Dec".}
+proc dec*[T](x: var ordinal[T], y = 1) {.magic: "Dec", noSideEffect.}
   ## decrements the ordinal ``x`` by ``y``. If such a value does not
   ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a
   ## short notation for: ``x = pred(x, y)``.
   
-proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq".}
+proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq", noSideEffect.}
   ## creates a new sequence of type ``seq[T]`` with length ``len``.
   ## This is equivalent to ``s = []; setlen(s, len)``, but more
   ## efficient since no relocation is needed.
@@ -255,11 +256,11 @@ proc len*[T](x: seq[T]): int {.magic: "LengthSeq", noSideEffect.}
   ## always an int.
 
 # set routines:
-proc incl*[T](x: var set[T], y: T) {.magic: "Incl".}
+proc incl*[T](x: var set[T], y: T) {.magic: "Incl", noSideEffect.}
   ## includes element ``y`` to the set ``x``. This is the same as
   ## ``x = x + {y}``, but it might be more efficient.
 
-proc excl*[T](x: var set[T], y: T) {.magic: "Excl".}
+proc excl*[T](x: var set[T], y: T) {.magic: "Excl", noSideEffect.}
   ## excludes element ``y`` to the set ``x``. This is the same as
   ## ``x = x - {y}``, but it might be more efficient.
 
@@ -641,8 +642,8 @@ proc `&` * (x: char, y: string): string {.
   magic: "ConStrStr", noSideEffect, merge.}
   ## is the `concatenation operator`. It concatenates `x` and `y`.
 
-proc add*(x: var string, y: char) {.magic: "AppendStrCh".}
-proc add*(x: var string, y: string) {.magic: "AppendStrStr".}
+proc add*(x: var string, y: char) {.magic: "AppendStrCh", noSideEffect.}
+proc add*(x: var string, y: string) {.magic: "AppendStrStr", noSideEffect.}
 
 when not defined(ECMAScript):
   {.push overflow_checks:off}
@@ -663,8 +664,8 @@ else:
       `x`[0][len] = 0
     """
 
-proc add *[T](x: var seq[T], y: T) {.magic: "AppendSeqElem".}
-proc add *[T](x: var seq[T], y: seq[T]) {.magic: "AppendSeqSeq".}
+proc add *[T](x: var seq[T], y: T) {.magic: "AppendSeqElem", noSideEffect.}
+proc add *[T](x: var seq[T], y: seq[T]) {.magic: "AppendSeqSeq", noSideEffect.}
   ## Generic proc for adding a data item `y` to a container `x`.
   ## For containers that have an order, `add` means *append*. New generic
   ## containers should also call their adding proc `add` for consistency.
@@ -811,7 +812,8 @@ proc copy*(s: string, first, last: int): string {.
   ## the first and last characters that shall be copied. If ``last``
   ## is omitted, it is treated as ``high(s)``.
 
-proc setLen*(s: var string, newlen: int) {.magic: "SetLengthStr".}
+proc setLen*(s: var string, newlen: int) {.
+  magic: "SetLengthStr", noSideEffect.}
   ## sets the length of `s` to `newlen`.
   ## If the current length is greater than the new length,
   ## ``s`` will be truncated.
@@ -873,20 +875,21 @@ proc dealloc*(p: Pointer) {.noconv.}
   ## or other memory may be corrupted. So this procedure is really
   ## *unsafe*.
 
-proc setLen*[T](s: var seq[T], newlen: int) {.magic: "SetLengthSeq".}
+proc setLen*[T](s: var seq[T], newlen: int) {.
+  magic: "SetLengthSeq", noSideEffect.}
   ## sets the length of `s` to `newlen`.
   ## ``T`` may be any sequence type.
   ## If the current length is greater than the new length,
   ## ``s`` will be truncated.
 
-proc assert*(cond: bool) {.magic: "Assert".}
+proc assert*(cond: bool) {.magic: "Assert", noSideEffect.}
   ## provides a means to implement `programming by contracts` in Nimrod.
   ## ``assert`` evaluates expression ``cond`` and if ``cond`` is false, it
   ## raises an ``EAssertionFailure`` exception. However, the compiler may
   ## not generate any code at all for ``assert`` if it is advised to do so.
   ## Thus one should use ``assert`` for debugging purposes only.
 
-proc swap*[T](a, b: var T) {.magic: "Swap".}
+proc swap*[T](a, b: var T) {.magic: "Swap", noSideEffect.}
   ## swaps the values `a` and `b`. This is often more efficient than
   ## ``tmp = a; a = b; b = tmp``. Particularly useful for sorting algorithms.
 
@@ -934,7 +937,7 @@ proc `$` *[T](x: ordinal[T]): string {.magic: "EnumToStr", noSideEffect.}
   ## used instead. (In other words: *Overwriting* is possible.)
 
 # undocumented:
-proc getRefcount*[T](x: ref T): int {.importc: "getRefcount".}
+proc getRefcount*[T](x: ref T): int {.importc: "getRefcount", noSideEffect.}
   ## retrieves the reference count of an heap-allocated object. The
   ## value is implementation-dependant.
 
@@ -1107,18 +1110,19 @@ proc find*[T, S](a: T, item: S): int {.inline.} =
     inc(result)
   result = -1
 
-proc pop*[T](s: var seq[T]): T {.inline.} = 
+proc pop*[T](s: var seq[T]): T {.inline, noSideEffect.} = 
   ## returns the last item of `s` and decreases ``s.len`` by one. This treats
   ## `s` as a stack and implements the common *pop* operation.
   var L = s.len-1
   result = s[L]
   setLen(s, L)
 
-proc each*[T, S](data: openArray[T], op: proc (x: T): S): seq[S] = 
+proc each*[T, S](data: openArray[T], op: proc (x: T): S): seq[S] {.
+    noSideEffect.} = 
   ## The well-known ``map`` operation from functional programming. Applies
   ## `op` to every item in `data` and returns the result as a sequence.
-  result = @[]
-  for d in items(data): add(result, op(d))
+  newSeq(result, data.len)
+  for i in 0..data.len-1: result[i] = op(data[i])
 
 
 # ----------------- FPU ------------------------------------------------------
@@ -1293,7 +1297,16 @@ when not defined(EcmaScript) and not defined(NimrodVM):
       ## does not work because the program writes to ``stderr``.
 
   proc OpenFile*(f: var TFile, filename: string,
-                 mode: TFileMode = fmRead, bufSize: int = -1): Bool
+                 mode: TFileMode = fmRead, 
+                 bufSize: int = -1): Bool {.deprecated.}
+    ## **Deprecated since version 0.8.0**: Use `open` instead.
+
+  proc OpenFile*(f: var TFile, filehandle: TFileHandle,
+                 mode: TFileMode = fmRead): Bool {.deprecated.}
+    ## **Deprecated since version 0.8.0**: Use `open` instead.
+
+  proc Open*(f: var TFile, filename: string,
+             mode: TFileMode = fmRead, bufSize: int = -1): Bool
     ## Opens a file named `filename` with given `mode`.
     ##
     ## Default mode is readonly. Returns true iff the file could be opened.
@@ -1301,14 +1314,19 @@ when not defined(EcmaScript) and not defined(NimrodVM):
     ## that the programmer needs to provide an appropriate error message anyway
     ## (yes, even in scripts).
 
-  proc OpenFile*(f: var TFile, filehandle: TFileHandle,
-                 mode: TFileMode = fmRead): Bool
+  proc Open*(f: var TFile, filehandle: TFileHandle,
+             mode: TFileMode = fmRead): Bool
     ## Creates a ``TFile`` from a `filehandle` with given `mode`.
     ##
     ## Default mode is readonly. Returns true iff the file could be opened.
 
-  proc CloseFile*(f: TFile) {.importc: "fclose", nodecl.}
+  proc CloseFile*(f: TFile) {.importc: "fclose", nodecl, deprecated.}
     ## Closes the file.
+    ## **Deprecated since version 0.8.0**: Use `close` instead.
+
+  proc Close*(f: TFile) {.importc: "fclose", nodecl.}
+    ## Closes the file.
+
   proc EndOfFile*(f: TFile): Bool
     ## Returns true iff `f` is at the end.
   proc readChar*(f: TFile): char {.importc: "fgetc", nodecl.}
@@ -1394,13 +1412,13 @@ when not defined(EcmaScript) and not defined(NimrodVM):
     ## If the file does not exist `EIO` is raised.
     var
       f: TFile
-    if not openFile(f, filename):
+    if not open(f, filename):
       raise newException(EIO, "cannot open: " & filename)
     var res = ""
     while not endOfFile(f):
       rawReadLine(f, res)
       yield res
-    CloseFile(f)
+    Close(f)
 
   proc fileHandle*(f: TFile): TFileHandle {.importc: "fileno",
                                             header: "<stdio.h>"}
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim
index bdde11d50..e9300949b 100644
--- a/lib/system/ansi_c.nim
+++ b/lib/system/ansi_c.nim
@@ -13,10 +13,11 @@
 
 {.push hints:off}
 
-proc c_strcmp(a, b: CString): cint {.nodecl, importc: "strcmp".}
-proc c_memcmp(a, b: CString, size: cint): cint {.nodecl, importc: "memcmp".}
+proc c_strcmp(a, b: CString): cint {.nodecl, noSideEffect, importc: "strcmp".}
+proc c_memcmp(a, b: CString, size: cint): cint {.
+  nodecl, noSideEffect, importc: "memcmp".}
 proc c_memcpy(a, b: CString, size: cint) {.nodecl, importc: "memcpy".}
-proc c_strlen(a: CString): int {.nodecl, importc: "strlen".}
+proc c_strlen(a: CString): int {.nodecl, noSideEffect, importc: "strlen".}
 proc c_memset(p: pointer, value: cint, size: int) {.nodecl, importc: "memset".}
 
 type
diff --git a/lib/system/arithm.nim b/lib/system/arithm.nim
index a0e8e3338..f097ee794 100644
--- a/lib/system/arithm.nim
+++ b/lib/system/arithm.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2008 Andreas Rumpf
+#        (c) Copyright 2009 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -10,11 +10,11 @@
 
 # simple integer arithmetic with overflow checking
 
-proc raiseOverflow {.compilerproc, noinline.} =
+proc raiseOverflow {.compilerproc, noinline, noreturn.} =
   # a single proc to reduce code size to a minimum
   raise newException(EOverflow, "over- or underflow")
 
-proc raiseDivByZero {.compilerproc, noinline.} =
+proc raiseDivByZero {.compilerproc, noinline, noreturn.} =
   raise newException(EDivByZero, "divison by zero")
 
 proc addInt64(a, b: int64): int64 {.compilerProc, inline.} =
diff --git a/lib/system/debugger.nim b/lib/system/debugger.nim
index 73a1e4db2..1139503cb 100644
--- a/lib/system/debugger.nim
+++ b/lib/system/debugger.nim
@@ -81,7 +81,7 @@ proc ListBreakPoints() =
   write(stdout, "***\n")
 
 proc openAppend(filename: string): TFile =
-  if openFile(result, filename, fmAppend):
+  if open(result, filename, fmAppend):
     write(result, "----------------------------------------\n")
 
 proc dbgRepr(p: pointer, typ: PNimType): string =
@@ -329,7 +329,7 @@ proc dbgOut(s: string, start: int, currFrame: PExtendedFrame) =
     debugOut("[Warning] could not open or create file ")
     return
   dbgEvaluate(stream, s, i, currFrame)
-  closeFile(stream)
+  close(stream)
 
 proc dbgStackFrame(s: string, start: int, currFrame: PExtendedFrame) =
   var dbgTemp: string
@@ -343,7 +343,7 @@ proc dbgStackFrame(s: string, start: int, currFrame: PExtendedFrame) =
       debugOut("[Warning] could not open or create file ")
       return
     ListFrame(stream, currFrame)
-    closeFile(stream)
+    close(stream)
 
 proc CommandPrompt() =
   # if we return from this routine, user code executes again
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index 81746c8fb..c9db48d51 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -71,13 +71,13 @@ proc write(f: TFile, a: openArray[string]) =
 proc readFile(filename: string): string =
   var f: TFile
   try:
-    if openFile(f, filename):
+    if open(f, filename):
       var len = getFileSize(f)
       if len < high(int):
         result = newString(int(len))
         if readBuffer(f, addr(result[0]), int(len)) != len:
           result = nil
-      closeFile(f)
+      close(f)
     else:
       result = nil
   except EIO:
@@ -112,9 +112,9 @@ const
     # should not be translated.
 
 
-proc OpenFile(f: var TFile, filename: string,
-              mode: TFileMode = fmRead,
-              bufSize: int = -1): Bool =
+proc Open(f: var TFile, filename: string,
+          mode: TFileMode = fmRead,
+          bufSize: int = -1): Bool =
   var
     p: pointer
   p = fopen(filename, FormatOpen[mode])
@@ -129,10 +129,18 @@ proc OpenFile(f: var TFile, filename: string,
 proc fdopen(filehandle: TFileHandle, mode: cstring): TFile {.
   importc: pccHack & "fdopen", header: "<stdio.h>".}
 
-proc openFile(f: var TFile, filehandle: TFileHandle, mode: TFileMode): bool =
+proc open(f: var TFile, filehandle: TFileHandle, mode: TFileMode): bool =
   f = fdopen(filehandle, FormatOpen[mode])
   result = f != nil
 
+proc OpenFile(f: var TFile, filename: string,
+              mode: TFileMode = fmRead,
+              bufSize: int = -1): Bool =
+  result = open(f, filename, mode, bufSize)
+  
+proc openFile(f: var TFile, filehandle: TFileHandle, mode: TFileMode): bool =
+  result = open(f, filehandle, mode)
+
 # C routine that is used here:
 proc fread(buf: Pointer, size, n: int, f: TFile): int {.
   importc: "fread", noDecl.}
diff --git a/lib/wrappers/mysql.nim b/lib/wrappers/mysql.nim
index 60c6bd80c..20a50b814 100644
--- a/lib/wrappers/mysql.nim
+++ b/lib/wrappers/mysql.nim
@@ -786,7 +786,7 @@ type
     mem_root*: MEM_ROOT       # root allocations
     mysql*: PMYSQL            # connection handle
     params*: PMYSQL_BIND      # input parameters
-    bind*: PMYSQL_BIND        # input parameters
+    `bind`*: PMYSQL_BIND      # input parameters
     fields*: PMYSQL_FIELD     # result set metadata
     result*: MYSQL_DATA       # cached result set
     data_cursor*: PMYSQL_ROWS # current row in cached result
@@ -1042,7 +1042,7 @@ proc mysql_stmt_execute*(stmt: PMYSQL_STMT): cint{.stdcall, dynlib: mysqllib,
     importc: "mysql_stmt_execute".}
 proc mysql_stmt_fetch*(stmt: PMYSQL_STMT): cint{.stdcall, dynlib: mysqllib, 
     importc: "mysql_stmt_fetch".}
-proc mysql_stmt_fetch_column*(stmt: PMYSQL_STMT, bind: PMYSQL_BIND, 
+proc mysql_stmt_fetch_column*(stmt: PMYSQL_STMT, `bind`: PMYSQL_BIND, 
                               column: cuint, offset: int): cint{.stdcall, 
     dynlib: mysqllib, importc: "mysql_stmt_fetch_column".}
 proc mysql_stmt_store_result*(stmt: PMYSQL_STMT): cint{.stdcall, 
diff --git a/nim/ast.pas b/nim/ast.pas
index 681bf72d5..4836a860e 100644
--- a/nim/ast.pas
+++ b/nim/ast.pas
@@ -78,27 +78,27 @@ type
     nkCurly, nkBracket, nkBracketExpr, nkPragmaExpr, 
     nkRange, nkDotExpr, nkCheckedFieldExpr, nkDerefExpr, 
     nkIfExpr, nkElifExpr, nkElseExpr, nkLambda, 
-    nkAccQuoted, nkHeaderQuoted, nkTableConstr, nkQualified, 
-    nkHiddenStdConv, nkHiddenSubConv, nkHiddenCallConv, nkConv, 
-    nkCast, nkAddr, nkHiddenAddr, nkHiddenDeref, 
-    nkObjDownConv, nkObjUpConv, nkChckRangeF, nkChckRange64, 
-    nkChckRange, nkStringToCString, nkCStringToString, nkPassAsOpenArray, 
-    nkAsgn, nkFastAsgn, nkDefaultTypeParam, nkGenericParams, 
-    nkFormalParams, nkOfInherit, nkModule, nkProcDef, 
-    nkConverterDef, nkMacroDef, nkTemplateDef, nkIteratorDef, 
-    nkOfBranch, nkElifBranch, nkExceptBranch, nkElse, 
-    nkMacroStmt, nkAsmStmt, nkPragma, nkIfStmt, 
-    nkWhenStmt, nkForStmt, nkWhileStmt, nkCaseStmt, 
-    nkVarSection, nkConstSection, nkConstDef, nkTypeSection, 
-    nkTypeDef, nkYieldStmt, nkTryStmt, nkFinally, 
-    nkRaiseStmt, nkReturnStmt, nkBreakStmt, nkContinueStmt, 
-    nkBlockStmt, nkDiscardStmt, nkStmtList, nkImportStmt, 
-    nkFromStmt, nkImportAs, nkIncludeStmt, nkCommentStmt, 
-    nkStmtListExpr, nkBlockExpr, nkStmtListType, nkBlockType, 
-    nkVm, nkTypeOfExpr, nkObjectTy, nkTupleTy, 
-    nkRecList, nkRecCase, nkRecWhen, nkRefTy, 
-    nkPtrTy, nkVarTy, nkAbstractTy, nkProcTy, 
-    nkEnumTy, nkEnumFieldDef, nkReturnToken);
+    nkAccQuoted, nkTableConstr, nkQualified, nkBind, 
+    nkSymChoice, nkHiddenStdConv, nkHiddenSubConv, nkHiddenCallConv, 
+    nkConv, nkCast, nkAddr, nkHiddenAddr, 
+    nkHiddenDeref, nkObjDownConv, nkObjUpConv, nkChckRangeF, 
+    nkChckRange64, nkChckRange, nkStringToCString, nkCStringToString, 
+    nkPassAsOpenArray, nkAsgn, nkFastAsgn, nkDefaultTypeParam, 
+    nkGenericParams, nkFormalParams, nkOfInherit, nkModule, 
+    nkProcDef, nkConverterDef, nkMacroDef, nkTemplateDef, 
+    nkIteratorDef, nkOfBranch, nkElifBranch, nkExceptBranch, 
+    nkElse, nkMacroStmt, nkAsmStmt, nkPragma, 
+    nkIfStmt, nkWhenStmt, nkForStmt, nkWhileStmt, 
+    nkCaseStmt, nkVarSection, nkConstSection, nkConstDef, 
+    nkTypeSection, nkTypeDef, nkYieldStmt, nkTryStmt, 
+    nkFinally, nkRaiseStmt, nkReturnStmt, nkBreakStmt, 
+    nkContinueStmt, nkBlockStmt, nkDiscardStmt, nkStmtList, 
+    nkImportStmt, nkFromStmt, nkImportAs, nkIncludeStmt, 
+    nkCommentStmt, nkStmtListExpr, nkBlockExpr, nkStmtListType, 
+    nkBlockType, nkVm, nkTypeOfExpr, nkObjectTy, 
+    nkTupleTy, nkRecList, nkRecCase, nkRecWhen, 
+    nkRefTy, nkPtrTy, nkVarTy, nkAbstractTy, 
+    nkProcTy, nkEnumTy, nkEnumFieldDef, nkReturnToken);
   TNodeKinds = set of TNodeKind;
 const
   NodeKindToStr: array [TNodeKind] of string = (
@@ -113,48 +113,48 @@ const
     'nkCurly', 'nkBracket', 'nkBracketExpr', 'nkPragmaExpr', 
     'nkRange', 'nkDotExpr', 'nkCheckedFieldExpr', 'nkDerefExpr', 
     'nkIfExpr', 'nkElifExpr', 'nkElseExpr', 'nkLambda', 
-    'nkAccQuoted', 'nkHeaderQuoted', 'nkTableConstr', 'nkQualified', 
-    'nkHiddenStdConv', 'nkHiddenSubConv', 'nkHiddenCallConv', 'nkConv', 
-    'nkCast', 'nkAddr', 'nkHiddenAddr', 'nkHiddenDeref', 
-    'nkObjDownConv', 'nkObjUpConv', 'nkChckRangeF', 'nkChckRange64', 
-    'nkChckRange', 'nkStringToCString', 'nkCStringToString', 'nkPassAsOpenArray', 
-    'nkAsgn', 'nkFastAsgn', 'nkDefaultTypeParam', 'nkGenericParams', 
-    'nkFormalParams', 'nkOfInherit', 'nkModule', 'nkProcDef', 
-    'nkConverterDef', 'nkMacroDef', 'nkTemplateDef', 'nkIteratorDef', 
-    'nkOfBranch', 'nkElifBranch', 'nkExceptBranch', 'nkElse', 
-    'nkMacroStmt', 'nkAsmStmt', 'nkPragma', 'nkIfStmt', 
-    'nkWhenStmt', 'nkForStmt', 'nkWhileStmt', 'nkCaseStmt', 
-    'nkVarSection', 'nkConstSection', 'nkConstDef', 'nkTypeSection', 
-    'nkTypeDef', 'nkYieldStmt', 'nkTryStmt', 'nkFinally', 
-    'nkRaiseStmt', 'nkReturnStmt', 'nkBreakStmt', 'nkContinueStmt', 
-    'nkBlockStmt', 'nkDiscardStmt', 'nkStmtList', 'nkImportStmt', 
-    'nkFromStmt', 'nkImportAs', 'nkIncludeStmt', 'nkCommentStmt', 
-    'nkStmtListExpr', 'nkBlockExpr', 'nkStmtListType', 'nkBlockType', 
-    'nkVm', 'nkTypeOfExpr', 'nkObjectTy', 'nkTupleTy', 
-    'nkRecList', 'nkRecCase', 'nkRecWhen', 'nkRefTy', 
-    'nkPtrTy', 'nkVarTy', 'nkAbstractTy', 'nkProcTy', 
-    'nkEnumTy', 'nkEnumFieldDef', 'nkReturnToken');
+    'nkAccQuoted', 'nkTableConstr', 'nkQualified', 'nkBind', 
+    'nkSymChoice', 'nkHiddenStdConv', 'nkHiddenSubConv', 'nkHiddenCallConv', 
+    'nkConv', 'nkCast', 'nkAddr', 'nkHiddenAddr', 
+    'nkHiddenDeref', 'nkObjDownConv', 'nkObjUpConv', 'nkChckRangeF', 
+    'nkChckRange64', 'nkChckRange', 'nkStringToCString', 'nkCStringToString', 
+    'nkPassAsOpenArray', 'nkAsgn', 'nkFastAsgn', 'nkDefaultTypeParam', 
+    'nkGenericParams', 'nkFormalParams', 'nkOfInherit', 'nkModule', 
+    'nkProcDef', 'nkConverterDef', 'nkMacroDef', 'nkTemplateDef', 
+    'nkIteratorDef', 'nkOfBranch', 'nkElifBranch', 'nkExceptBranch', 
+    'nkElse', 'nkMacroStmt', 'nkAsmStmt', 'nkPragma', 
+    'nkIfStmt', 'nkWhenStmt', 'nkForStmt', 'nkWhileStmt', 
+    'nkCaseStmt', 'nkVarSection', 'nkConstSection', 'nkConstDef', 
+    'nkTypeSection', 'nkTypeDef', 'nkYieldStmt', 'nkTryStmt', 
+    'nkFinally', 'nkRaiseStmt', 'nkReturnStmt', 'nkBreakStmt', 
+    'nkContinueStmt', 'nkBlockStmt', 'nkDiscardStmt', 'nkStmtList', 
+    'nkImportStmt', 'nkFromStmt', 'nkImportAs', 'nkIncludeStmt', 
+    'nkCommentStmt', 'nkStmtListExpr', 'nkBlockExpr', 'nkStmtListType', 
+    'nkBlockType', 'nkVm', 'nkTypeOfExpr', 'nkObjectTy', 
+    'nkTupleTy', 'nkRecList', 'nkRecCase', 'nkRecWhen', 
+    'nkRefTy', 'nkPtrTy', 'nkVarTy', 'nkAbstractTy', 
+    'nkProcTy', 'nkEnumTy', 'nkEnumFieldDef', 'nkReturnToken');
 type
   TSymFlag = (
     sfUsed, sfStar, sfMinus, sfInInterface, 
     sfFromGeneric, sfGlobal, sfForward, sfImportc, 
     sfExportc, sfVolatile, sfRegister, sfPure, 
-    sfResult, sfNoSideEffect, sfMainModule, sfSystemModule, 
-    sfNoReturn, sfAddrTaken, sfCompilerProc, sfCppMethod, 
-    sfDiscriminant, sfDeprecated, sfInClosure, sfTypeCheck, 
-    sfCompileTime, sfThreadVar, sfMerge, sfDeadCodeElim, 
-    sfBorrow);
+    sfResult, sfNoSideEffect, sfSideEffect, sfMainModule, 
+    sfSystemModule, sfNoReturn, sfAddrTaken, sfCompilerProc, 
+    sfCppMethod, sfDiscriminant, sfDeprecated, sfInClosure, 
+    sfTypeCheck, sfCompileTime, sfThreadVar, sfMerge, 
+    sfDeadCodeElim, sfBorrow);
   TSymFlags = set of TSymFlag;
 const
   SymFlagToStr: array [TSymFlag] of string = (
     'sfUsed', 'sfStar', 'sfMinus', 'sfInInterface', 
     'sfFromGeneric', 'sfGlobal', 'sfForward', 'sfImportc', 
     'sfExportc', 'sfVolatile', 'sfRegister', 'sfPure', 
-    'sfResult', 'sfNoSideEffect', 'sfMainModule', 'sfSystemModule', 
-    'sfNoReturn', 'sfAddrTaken', 'sfCompilerProc', 'sfCppMethod', 
-    'sfDiscriminant', 'sfDeprecated', 'sfInClosure', 'sfTypeCheck', 
-    'sfCompileTime', 'sfThreadVar', 'sfMerge', 'sfDeadCodeElim', 
-    'sfBorrow');
+    'sfResult', 'sfNoSideEffect', 'sfSideEffect', 'sfMainModule', 
+    'sfSystemModule', 'sfNoReturn', 'sfAddrTaken', 'sfCompilerProc', 
+    'sfCppMethod', 'sfDiscriminant', 'sfDeprecated', 'sfInClosure', 
+    'sfTypeCheck', 'sfCompileTime', 'sfThreadVar', 'sfMerge', 
+    'sfDeadCodeElim', 'sfBorrow');
 type
   TTypeKind = (
     tyNone, tyBool, tyChar, tyEmpty, 
@@ -189,11 +189,13 @@ const
     'nfAllConst', 'nfTransf', 'nfSem');
 type
   TTypeFlag = (
-    tfVarargs, tfFinal, tfAcyclic, tfEnumHasWholes);
+    tfVarargs, tfNoSideEffect, tfFinal, tfAcyclic, 
+    tfEnumHasWholes);
   TTypeFlags = set of TTypeFlag;
 const
   TypeFlagToStr: array [TTypeFlag] of string = (
-    'tfVarargs', 'tfFinal', 'tfAcyclic', 'tfEnumHasWholes');
+    'tfVarargs', 'tfNoSideEffect', 'tfFinal', 'tfAcyclic', 
+    'tfEnumHasWholes');
 type
   TSymKind = (
     skUnknownSym, skConditional, skDynLib, skParam, 
diff --git a/nim/ccgexprs.pas b/nim/ccgexprs.pas
index bf03365cd..212017d14 100644
--- a/nim/ccgexprs.pas
+++ b/nim/ccgexprs.pas
@@ -220,8 +220,7 @@ end;
 function addrLoc(const a: TLoc): PRope;
 begin
   result := a.r;
-  if not (lfIndirect in a.flags) then
-    result := con('&'+'', result)
+  if not (lfIndirect in a.flags) then result := con('&'+'', result)
 end;
 
 function rdCharLoc(const a: TLoc): PRope;
@@ -2257,32 +2256,6 @@ begin
 end;
 
 // ---------------------- generation of complex constants ---------------------
-(*
-function transformRecordExpr(n: PNode): PNode;
-var
-  i: int;
-  t: PType;
-  field: PSym;
-begin
-  result := copyNode(n);
-  newSons(result, sonsLen(n));
-  t := getUniqueType(skipTypes(n.Typ, abstractVarRange));
-  if t.n = nil then
-    InternalError(n.info, 'transformRecordExpr: invalid type');
-  for i := 0 to sonsLen(n)-1 do begin
-    assert(n.sons[i].kind = nkExprColonExpr);
-    assert(n.sons[i].sons[0].kind = nkSym);
-    field := n.sons[i].sons[0].sym;
-    field := lookupInRecord(t.n, field.name);
-    if field = nil then
-      InternalError(n.sons[i].info, 'transformRecordExpr: unknown field');
-    if result.sons[field.position] <> nil then begin
-      InternalError(n.sons[i].info, 'transformRecordExpr: value twice: ' +
-                    renderTree(n.sons[i]));
-    end;
-    result.sons[field.position] := copyTree(n.sons[i].sons[1]);
-  end;
-end; *)
 
 function genNamedConstExpr(p: BProc; n: PNode): PRope;
 begin
diff --git a/nim/docgen.pas b/nim/docgen.pas
index 5e8ecf7a3..a72f64908 100644
--- a/nim/docgen.pas
+++ b/nim/docgen.pas
@@ -139,16 +139,22 @@ function ropeFormatNamedVars(const frmt: TFormatStr;
                              const varnames: array of string;
                              const varvalues: array of PRope): PRope;
 var
-  i, j, L, start, idx: int;
+  i, j, L, start, idx, num: int;
   id: string;
 begin
   i := strStart;
   L := length(frmt);
   result := nil;
+  num := 0;
   while i <= L + StrStart - 1 do begin
     if frmt[i] = '$' then begin
       inc(i);                 // skip '$'
       case frmt[i] of
+        '#': begin
+          app(result, varvalues[num]);
+          inc(num);
+          inc(i);
+        end;
         '$': begin
           app(result, '$'+'');
           inc(i)
@@ -162,6 +168,7 @@ begin
           end;
           if j > high(varvalues) + 1 then
             internalError('ropeFormatNamedVars');
+          num := j;
           app(result, varvalues[j - 1])
         end;
         'A'..'Z', 'a'..'z', #128..#255: begin
@@ -515,17 +522,17 @@ begin
       result := renderRstSons(d, n);
       L := ropeLen(result);
       result := ropef('$n$1$2$n$1$3', [ind, result,
-                           toRope(repeatChar(L, lvlToChar[n.level]))]);
+                      toRope(repeatChar(L, lvlToChar[n.level]))]);
     end;
     rnOverline: begin
       result := renderRstSons(d, n);
       L := ropeLen(result);
       result := ropef('$n$1$3$n$1$2$n$1$3', [ind, result,
-                           toRope(repeatChar(L, lvlToChar[n.level]))]);
+                      toRope(repeatChar(L, lvlToChar[n.level]))]);
     end;
     rnTransition:
       result := ropef('$n$n$1$2$n$n',
-                          [ind, toRope(repeatChar(78-d.indent, '-'))]);
+                     [ind, toRope(repeatChar(78-d.indent, '-'))]);
     rnParagraph: begin
       result := renderRstSons(d, n);
       result := ropef('$n$n$1$2', [ind, result]);
@@ -1003,7 +1010,4 @@ begin
   generateIndex(d);
 end;
 
-// #FFD700
-// #9f9b75
-
 end.
diff --git a/nim/evals.pas b/nim/evals.pas
index 7c443bad6..d522dfaf0 100644
--- a/nim/evals.pas
+++ b/nim/evals.pas
@@ -35,8 +35,9 @@ type
   
   TEvalContext = object(passes.TPassContext)
     module: PSym;
-    tos: PStackFrame; // top of a tos tos
+    tos: PStackFrame; // top of stack
     lastException: PNode;
+    optEval: bool; // evaluation done for optimization purposes
   end;
   PEvalContext = ^TEvalContext;
 
@@ -44,12 +45,15 @@ function newStackFrame(): PStackFrame;
 procedure pushStackFrame(c: PEvalContext; t: PStackFrame);
 procedure popStackFrame(c: PEvalContext);
 
-function newEvalContext(module: PSym; const filename: string): PEvalContext;
+function newEvalContext(module: PSym; const filename: string;
+                        optEval: bool): PEvalContext;
 
 function eval(c: PEvalContext; n: PNode): PNode; 
 // eval never returns nil! This simplifies the code a lot and
 // makes it faster too.
 
+function evalConstExpr(module: PSym; e: PNode): PNode;
+
 function evalPass(): TPass;
 
 implementation
@@ -71,13 +75,15 @@ begin
 {@emit result.params := @[];}
 end;
 
-function newEvalContext(module: PSym; const filename: string): PEvalContext;
+function newEvalContext(module: PSym; const filename: string;
+                        optEval: bool): PEvalContext;
 begin
   new(result);
 {@ignore}
   fillChar(result^, sizeof(result^), 0);
 {@emit}
   result.module := module;
+  result.optEval := optEval;
 end;
 
 procedure pushStackFrame(c: PEvalContext; t: PStackFrame);
@@ -228,32 +234,35 @@ begin
   case result.kind of
     nkBreakStmt, nkReturnToken: begin end;
     nkExceptBranch: begin
-      // exception token!
-      exc := result;
-      i := 1;
-      len := sonsLen(n);
-      while (i < len) and (n.sons[i].kind = nkExceptBranch) do begin
-        blen := sonsLen(n.sons[i]);
-        if blen = 1 then begin
-          // general except section:
-          result := evalAux(c, n.sons[i].sons[0]);
-          exc := result;
-          break
-        end
-        else begin
-          for j := 0 to blen-2 do begin
-            assert(n.sons[i].sons[j].kind = nkType);
-            if exc.typ.id = n.sons[i].sons[j].typ.id then begin
-              result := evalAux(c, n.sons[i].sons[blen-1]);
-              exc := result;
-              break
-            end
+      if sonsLen(result) >= 1 then begin
+        // creating a nkExceptBranch without sons means that it could not be
+        // evaluated
+        exc := result;
+        i := 1;
+        len := sonsLen(n);
+        while (i < len) and (n.sons[i].kind = nkExceptBranch) do begin
+          blen := sonsLen(n.sons[i]);
+          if blen = 1 then begin
+            // general except section:
+            result := evalAux(c, n.sons[i].sons[0]);
+            exc := result;
+            break
           end
+          else begin
+            for j := 0 to blen-2 do begin
+              assert(n.sons[i].sons[j].kind = nkType);
+              if exc.typ.id = n.sons[i].sons[j].typ.id then begin
+                result := evalAux(c, n.sons[i].sons[blen-1]);
+                exc := result;
+                break
+              end
+            end
+          end;
+          inc(i);
         end;
-        inc(i);
-      end;
-      result := evalFinally(c, n, exc);
-    end;
+        result := evalFinally(c, n, exc);
+      end
+    end
     else
       result := evalFinally(c, n, emptyNode);
   end
@@ -339,6 +348,7 @@ begin
   if n.typ <> nil then d.params[0] := getNullValue(n.typ, n.info);
   pushStackFrame(c, d);
   result := evalAux(c, prc);
+  if result.kind = nkExceptBranch then exit;
   if n.typ <> nil then result := d.params[0];
   popStackFrame(c);
 end;
@@ -572,13 +582,24 @@ begin
   if result.intVal <> 0 then result := evalAux(c, n.sons[2])
 end;
 
+function evalNoOpt(c: PEvalContext; n: PNode): PNode;
+begin
+  result := newNodeI(nkExceptBranch, n.info);
+  // creating a nkExceptBranch without sons means that it could not be
+  // evaluated
+end;
+
 function evalNew(c: PEvalContext; n: PNode): PNode;
 var
   t: PType;
 begin
-  t := skipTypes(n.sons[1].typ, abstractVar);
-  result := newNodeIT(nkRefTy, n.info, t);
-  addSon(result, getNullValue(t.sons[0], n.info));
+  if c.optEval then 
+    result := evalNoOpt(c, n)
+  else begin
+    t := skipTypes(n.sons[1].typ, abstractVar);
+    result := newNodeIT(nkRefTy, n.info, t);
+    addSon(result, getNullValue(t.sons[0], n.info));
+  end
 end;
 
 function evalDeref(c: PEvalContext; n: PNode): PNode;
@@ -740,6 +761,7 @@ end;
 function evalSetLengthStr(c: PEvalContext; n: PNode): PNode;
 var
   a, b: PNode;
+  oldLen, newLen: int;
 begin
   result := evalAux(c, n.sons[1]);
   if result.kind = nkExceptBranch then exit;
@@ -748,7 +770,16 @@ begin
   if result.kind = nkExceptBranch then exit;
   b := result;
   case a.kind of
-    nkStrLit..nkTripleStrLit: setLength(a.strVal, int(getOrdValue(b)));
+    nkStrLit..nkTripleStrLit: begin
+    {@ignore}
+      oldLen := length(a.strVal);
+    {@emit}
+      newLen := int(getOrdValue(b));
+      setLength(a.strVal, newLen);
+    {@ignore}
+      FillChar(a.strVal[oldLen+1], newLen-oldLen, 0);
+    {@emit}
+    end
     else InternalError(n.info, 'evalSetLengthStr')
   end;
   result := emptyNode
@@ -1241,6 +1272,7 @@ end;
 function evalAux(c: PEvalContext; n: PNode): PNode;
 var
   i: int;
+  a: PNode;
 begin
   result := emptyNode;
   dec(gNestedEvals);
@@ -1254,13 +1286,22 @@ begin
     nkCall, nkHiddenCallConv, nkMacroStmt, nkCommand: 
       result := evalMagicOrCall(c, n);
     nkCurly, nkBracket, nkRange: begin
-      result := copyNode(n);
-      for i := 0 to sonsLen(n)-1 do addSon(result, evalAux(c, n.sons[i]));
+      a := copyNode(n);
+      for i := 0 to sonsLen(n)-1 do begin
+        result := evalAux(c, n.sons[i]);
+        if result.kind = nkExceptBranch then exit;        
+        addSon(a, result);
+      end;
+      result := a
     end;
     nkPar: begin
-      result := copyTree(n);
-      for i := 0 to sonsLen(n)-1 do
-        result.sons[i].sons[1] := evalAux(c, n.sons[i].sons[1]);
+      a := copyTree(n);
+      for i := 0 to sonsLen(n)-1 do begin
+        result := evalAux(c, n.sons[i].sons[1]);
+        if result.kind = nkExceptBranch then exit;
+        a.sons[i].sons[1] := result;
+      end;
+      result := a
     end;
     nkBracketExpr: result := evalArrayAccess(c, n);
     nkDotExpr: result := evalFieldAccess(c, n);
@@ -1313,15 +1354,30 @@ begin
   gWhileCounter := evalMaxIterations;
   gNestedEvals := evalMaxRecDepth;
   result := evalAux(c, n);
-  if result.kind = nkExceptBranch then
+  if (result.kind = nkExceptBranch) and (sonsLen(result) >= 1) then
     stackTrace(c, n, errUnhandledExceptionX, typeToString(result.typ));
 end;
 
+function evalConstExpr(module: PSym; e: PNode): PNode;
+var
+  p: PEvalContext;
+  s: PStackFrame;
+begin
+  p := newEvalContext(module, '', true);
+  s := newStackFrame();
+  s.call := e;
+  pushStackFrame(p, s);
+  result := eval(p, e);
+  if (result <> nil) and (result.kind = nkExceptBranch) then 
+    result := nil;
+  popStackFrame(p);
+end;
+
 function myOpen(module: PSym; const filename: string): PPassContext;
 var
   c: PEvalContext;
 begin
-  c := newEvalContext(module, filename);
+  c := newEvalContext(module, filename, false);
   pushStackFrame(c, newStackFrame());
   result := c;
 end;
diff --git a/nim/importer.pas b/nim/importer.pas
index 5c49259c2..fdb72fd4b 100644
--- a/nim/importer.pas
+++ b/nim/importer.pas
@@ -68,8 +68,8 @@ begin
   if (check <> nil) and (check.id <> copy.id) then begin
     if not (s.kind in OverloadableSyms) then begin
       // s and check need to be qualified:
-      IntSetIncl(c.AmbigiousSymbols, copy.id);
-      IntSetIncl(c.AmbigiousSymbols, check.id);
+      IntSetIncl(c.AmbiguousSymbols, copy.id);
+      IntSetIncl(c.AmbiguousSymbols, check.id);
     end
   end;
   StrTableAdd(c.tab.stack[importTablePos], copy);
diff --git a/nim/lookups.pas b/nim/lookups.pas
index a9a4a783b..d106ef302 100644
--- a/nim/lookups.pas
+++ b/nim/lookups.pas
@@ -1,7 +1,7 @@
 //
 //
 //           The Nimrod Compiler
-//        (c) Copyright 2008 Andreas Rumpf
+//        (c) Copyright 2009 Andreas Rumpf
 //
 //    See the file "copying.txt", included in this
 //    distribution, for details about the copyright.
@@ -19,7 +19,8 @@ uses
 {$include 'config.inc'}
 
 type
-  TOverloadIterMode = (oimNoQualifier, oimSelfModule, oimOtherModule);
+  TOverloadIterMode = (oimDone, oimNoQualifier, oimSelfModule, oimOtherModule,
+                       oimSymChoice);
   TOverloadIter = record
     stackPtr: int;
     it: TIdentIter;
@@ -43,7 +44,7 @@ procedure addInterfaceOverloadableSymAt(c: PContext; sym: PSym; at: int);
 function lookUp(c: PContext; n: PNode): PSym;
 // Looks up a symbol. Generates an error in case of nil.
 
-function QualifiedLookUp(c: PContext; n: PNode; ambigiousCheck: bool): PSym;
+function QualifiedLookUp(c: PContext; n: PNode; ambiguousCheck: bool): PSym;
 
 function InitOverloadIter(out o: TOverloadIter; c: PContext; n: PNode): PSym;
 function nextOverloadIter(var o: TOverloadIter; c: PContext; n: PNode): PSym;
@@ -139,22 +140,22 @@ begin
       result := SymtabGet(c.Tab, n.sym.name);
       if result = nil then
         liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s);
-      include(result.flags, sfUsed);
+      //include(result.flags, sfUsed);
     end;
     nkIdent: begin
       result := SymtabGet(c.Tab, n.ident);
       if result = nil then
         liMessage(n.info, errUndeclaredIdentifier, n.ident.s);
-      include(result.flags, sfUsed);
+      //include(result.flags, sfUsed);
     end
     else InternalError(n.info, 'lookUp');
   end;
-  if IntSetContains(c.AmbigiousSymbols, result.id) then
+  if IntSetContains(c.AmbiguousSymbols, result.id) then
     liMessage(n.info, errUseQualifier, result.name.s);
   if result.kind = skStub then loadStub(result);
 end;
 
-function QualifiedLookUp(c: PContext; n: PNode; ambigiousCheck: bool): PSym;
+function QualifiedLookUp(c: PContext; n: PNode; ambiguousCheck: bool): PSym;
 var
   m: PSym;
   ident: PIdent;
@@ -164,16 +165,16 @@ begin
       result := SymtabGet(c.Tab, n.ident);
       if result = nil then
         liMessage(n.info, errUndeclaredIdentifier, n.ident.s)
-      else if ambigiousCheck
-          and IntSetContains(c.AmbigiousSymbols, result.id) then
+      else if ambiguousCheck
+          and IntSetContains(c.AmbiguousSymbols, result.id) then
         liMessage(n.info, errUseQualifier, n.ident.s)
     end;
     nkSym: begin
       result := SymtabGet(c.Tab, n.sym.name);
       if result = nil then
         liMessage(n.info, errUndeclaredIdentifier, n.sym.name.s)
-      else if ambigiousCheck
-          and IntSetContains(c.AmbigiousSymbols, result.id) then
+      else if ambiguousCheck
+          and IntSetContains(c.AmbiguousSymbols, result.id) then
         liMessage(n.info, errUseQualifier, n.sym.name.s)
     end;
     nkDotExpr, nkQualified: begin
@@ -200,7 +201,7 @@ begin
                     renderTree(n.sons[1]));
       end
     end;
-    nkAccQuoted: result := QualifiedLookup(c, n.sons[0], ambigiousCheck);
+    nkAccQuoted: result := QualifiedLookup(c, n.sons[0], ambiguousCheck);
     else begin
       result := nil;
       //liMessage(n.info, errIdentifierExpected, '')
@@ -224,15 +225,18 @@ begin
         result := InitIdentIter(o.it, c.tab.stack[o.stackPtr], n.ident);
       end;
     end;
-    nkSym: begin
+    nkSym: begin 
+      result := n.sym;
+      o.mode := oimDone;
+    (*
       o.stackPtr := c.tab.tos;
       o.mode := oimNoQualifier;
       while (result = nil) do begin
         dec(o.stackPtr);
         if o.stackPtr < 0 then break;
         result := InitIdentIter(o.it, c.tab.stack[o.stackPtr], n.sym.name);
-      end;
-    end;
+      end; *)
+    end; 
     nkDotExpr, nkQualified: begin
       o.mode := oimOtherModule;
       o.m := qualifiedLookUp(c, n.sons[0], false);
@@ -258,6 +262,11 @@ begin
       end
     end;
     nkAccQuoted: result := InitOverloadIter(o, c, n.sons[0]);
+    nkSymChoice: begin
+      o.mode := oimSymChoice;
+      result := n.sons[0].sym;
+      o.stackPtr := 1
+    end;
     else begin end
   end;
   if (result <> nil) and (result.kind = skStub) then loadStub(result);
@@ -266,6 +275,7 @@ end;
 function nextOverloadIter(var o: TOverloadIter; c: PContext; n: PNode): PSym;
 begin
   case o.mode of
+    oimDone: result := nil;
     oimNoQualifier: begin
       if n.kind = nkAccQuoted then 
         result := nextOverloadIter(o, c, n.sons[0]) // BUGFIX
@@ -282,6 +292,14 @@ begin
     end;
     oimSelfModule:  result := nextIdentIter(o.it, c.tab.stack[ModuleTablePos]);
     oimOtherModule: result := nextIdentIter(o.it, o.m.tab);
+    oimSymChoice: begin
+      if o.stackPtr < sonsLen(n) then begin
+        result := n.sons[o.stackPtr].sym;
+        inc(o.stackPtr);
+      end
+      else
+        result := nil
+    end;
   end;
   if (result <> nil) and (result.kind = skStub) then loadStub(result);
 end;
diff --git a/nim/msgs.pas b/nim/msgs.pas
index 48ffc9ee5..0f47695af 100644
--- a/nim/msgs.pas
+++ b/nim/msgs.pas
@@ -1,7 +1,7 @@
 //

 //

 //           The Nimrod Compiler

-//        (c) Copyright 2008 Andreas Rumpf

+//        (c) Copyright 2009 Andreas Rumpf

 //

 //    See the file "copying.txt", included in this

 //    distribution, for details about the copyright.

@@ -79,19 +79,15 @@ type
     errNoneSpeedOrSizeExpected,
     errInvalidPragma,
     errUnknownPragma,
-    errPragmaXHereNotAllowed,
     errUnknownDirective,
     errInvalidDirective,
     errAtPopWithoutPush,
     errEmptyAsm,
-    errAsgnInvalidInExpr,
     errInvalidIndentation,
     errExceptionExpected,
     errExceptionAlreadyHandled,
-    errReturnNotAllowedHere,
     errYieldNotAllowedHere,
     errInvalidNumberOfYieldExpr,
-    errReturnInvalidInIterator,
     errCannotReturnExpr,
     errAttemptToRedefine,
     errStmtInvalidAfterReturn,
@@ -116,7 +112,6 @@ type
     errExprExpected,
     errUndeclaredIdentifier,
     errUseQualifier,
-    errTwiceForwarded,
     errTypeExpected,
     errSystemNeeds,
     errExecutionOfProgramFailed,
@@ -126,8 +121,7 @@ type
     errXExpectsTypeOrValue,
     errXExpectsArrayType,
     errIteratorCannotBeInstantiated,
-    errExprWithNoTypeCannotBeConverted,
-    errExprWithNoTypeCannotBeCasted,
+    errExprXAmbiguous,
     errConstantDivisionByZero,
     errOrdinalTypeExpected,
     errOrdinalOrFloatTypeExpected,
@@ -145,21 +139,17 @@ type
     errValueOutOfSetBounds,
     errFieldInitTwice,
     errFieldNotInit,
-    errExprCannotBeCalled,
+    errExprXCannotBeCalled,
     errExprHasNoType,
     errExprXHasNoType,
     errCastNotInSafeMode,
     errExprCannotBeCastedToX,
-    errUndefinedPrefixOpr,
     errCommaOrParRiExpected,
     errCurlyLeOrParLeExpected,
     errSectionExpected,
-    errImplemenationExpected,
     errRangeExpected,
-    errInvalidTypeDescription,
     errAttemptToRedefineX,
     errMagicOnlyInSystem,
-    errUnknownOperatorX,
     errPowerOfTwoExpected,
     errStringMayNotBeEmpty,
     errCallConvExpected,
@@ -193,9 +183,8 @@ type
     errTypeMismatch,
     errButExpected,
     errButExpectedX,
-    errAmbigiousCallXYZ,
+    errAmbiguousCallXYZ,
     errWrongNumberOfTypeParams,
-    errOutParamNoDefaultValue,
     errInlineProcHasNoAddress,
     errXCannotBeInParamDecl,
     errPragmaOnlyInHeaderOfProc,
@@ -204,21 +193,15 @@ type
     errNoSymbolToBorrowFromFound,
     errDiscardValue,
     errInvalidDiscard,
-    errUnknownPrecedence,
     errIllegalConvFromXtoY,
-    errTypeMismatchExpectedXGotY,
     errCannotBindXTwice,
     errInvalidOrderInEnumX,
     errEnumXHasWholes,
     errExceptExpected,
     errInvalidTry,
-    errEofExpectedButXFound,
     errOptionExpected,
-    errCannotEvaluateForwardConst,
     errXisNoLabel,
-    errXNeedsConcreteType,
     errNotAllCasesCovered,
-    errStringRange,
     errUnkownSubstitionVar,
     errComplexStmtRequiresInd,
     errXisNotCallable,
@@ -279,6 +262,7 @@ type
     errUnhandledExceptionX,
     errCyclicTree,
     errXisNoMacroOrTemplate,
+    errXhasSideEffects,
     errUser,
     warnCannotOpenFile,
     warnOctalEscape,
@@ -338,19 +322,15 @@ const
     '''none'', ''speed'' or ''size'' expected',
     'invalid pragma',
     'unknown pragma: ''$1''',
-    'pragma ''$1'' here not allowed',
     'unknown directive: ''$1''',
     'invalid directive',
     '''pop'' without a ''push'' pragma',
     'empty asm statement makes no sense',
-    '''='' invalid in an expression; probably ''=='' meant',
     'invalid indentation',
     'exception expected',
     'exception already handled',
-    '''return'' only allowed in routine',
     '''yield'' only allowed in a loop of an iterator',
     'invalid number of ''yield'' expresions',
-    '''return'' not allowed in iterator',
     'current routine cannot return an expression',
     'attempt to redefine ''$1''',
     'statement not allowed after ''return'', ''break'' or ''raise''',
@@ -374,19 +354,17 @@ const
     ''':'' or ''='' expected, but found ''$1''',
     'expression expected, but found ''$1''',
     'undeclared identifier: ''$1''',
-    'ambigious identifier: ''$1'' -- use a qualifier',
-    '''$1'' is forwarded twice',
+    'ambiguous identifier: ''$1'' -- use a qualifier',
     'type expected',
     'system module needs ''$1''',
     'execution of an external program failed',
-    'overloaded ''$1'' leads to ambigious calls',
+    'overloaded ''$1'' leads to ambiguous calls',
     'invalid argument for ''$1''',
     'statement has no effect',
     '''$1'' expects a type or value',
     '''$1'' expects an array type',
     '''$1'' cannot be instantiated because its body has not been compiled yet',
-    'expression with no type cannot be converted',
-    'expression with no type cannot be casted',
+    'expression ''$1'' ambiguous in this context',
     'constant division by zero',
     'ordinal type expected',
     'ordinal or float type expected',
@@ -404,21 +382,17 @@ const
     'value out of set bounds',
     'field initialized twice: ''$1''',
     'field ''$1'' not initialized',
-    'expression cannot be called',
+    'expression ''$1'' cannot be called',
     'expression has no type',
-    'expression ''$1'' has no type',
+    'expression ''$1'' has no type (or is ambiguous)',
     '''cast'' not allowed in safe mode',
     'expression cannot be casted to $1',
-    'undefined prefix operator: $1',
     ''','' or '')'' expected',
     '''{'' or ''('' expected',
     'section (''type'', ''proc'', etc.) expected',
-    '''implementation'' or end of file expected',
     'range expected',
-    'invalid type description',
     'attempt to redefine ''$1''',
     '''magic'' only allowed in system module',
-    'unkown operator: ''$1''',
     'power of two expected',
     'string literal may not be empty',
     'calling convention expected',
@@ -452,9 +426,8 @@ const
     'type mismatch: got (',
     'but expected one of: ',
     'but expected ''$1''',
-    'ambigious call; both $1 and $2 match for: $3',
+    'ambiguous call; both $1 and $2 match for: $3',
     'wrong number of type parameters',
-    'out parameters cannot have default values',
     'an inline proc has no address',
     '$1 cannot be declared in parameter declaration',
     'pragmas are only in the header of a proc allowed',
@@ -463,21 +436,15 @@ const
     'no symbol to borrow from found',
     'value returned by statement has to be discarded',
     'statement returns no value that can be discarded',
-    'unknown precedence for operator; use ''infix: prec'' pragma',
     'conversion from $1 to $2 is invalid',
-    'type mismatch: expected ''$1'', but got ''$2''',
     'cannot bind parameter ''$1'' twice',
     'invalid order in enum ''$1''',
     'enum ''$1'' has wholes',
     '''except'' or ''finally'' expected',
     'after catch all ''except'' or ''finally'' no section may follow',
-    'end of file expected, but found token ''$1''',
     'option expected, but found ''$1''',
-    'cannot evaluate forwarded constant',
     '''$1'' is not a label',
-    '''$1'' needs to be of a non-generic type',
     'not all cases are covered',
-    'string range in case statement not allowed',
     'unknown substitution variable: ''$1''',
     'complex statement requires indentation',
     '''$1'' is not callable',
@@ -489,7 +456,7 @@ const
     'no return type for $1 allowed',
     'a type conversion needs exactly one argument',
     'invalid pragma: $1',
-    '$1 here not allowed',
+    '$1 not allowed here',
     'invalid control flow: $1',
     'a type has no value',
     'invalid type: ''$1''',
@@ -499,11 +466,11 @@ const
     'invalid expression: ''$1''',
     'enum has no value ''$1''',
     'named expression expected',
-    'named expression here not allowed',
+    'named expression not allowed here',
     '''$1'' expects one type parameter',
     'array expects two type parameters',
     'invalid invisibility: ''$1''',
-    'initialization here not allowed',
+    'initialization not allowed here',
     '''$1'' cannot be assigned to',
     'iterators can only be defined at the module''s top level',
     'iterator needs an implementation',
@@ -538,6 +505,7 @@ const
     'unhandled exception: $1',
     'macro returned a cyclic abstract syntax tree',
     '''$1'' is no macro or template',
+    '''$1'' can have side effects',
     '$1',
     'cannot open ''$1'' [CannotOpenFile]',
     'octal escape sequences do not exist; leading zero is ignored [OctalEscape]',
diff --git a/nim/nimsets.pas b/nim/nimsets.pas
index 7fa3dbc12..9795817b8 100644
--- a/nim/nimsets.pas
+++ b/nim/nimsets.pas
@@ -1,15 +1,14 @@
 //
 //
 //           The Nimrod Compiler
-//        (c) Copyright 2008 Andreas Rumpf
+//        (c) Copyright 2009 Andreas Rumpf
 //
 //    See the file "copying.txt", included in this
 //    distribution, for details about the copyright.
 //
 unit nimsets;
 
-// this unit handles Morpork sets; it implements symbolic sets
-// the code here should be reused in the Morpork standard library
+// this unit handles Nimrod sets; it implements symbolic sets
 
 interface
 
diff --git a/nim/pasparse.pas b/nim/pasparse.pas
index d0353fc86..73280aeca 100644
--- a/nim/pasparse.pas
+++ b/nim/pasparse.pas
@@ -40,12 +40,11 @@ const
   ImportBlackList: array [1..3] of string = (
     'nsystem', 'sysutils', 'charsets'
   );
-  stdReplacements: array [1..20] of TReplaceTuple = (
+  stdReplacements: array [1..19] of TReplaceTuple = (
     ('include',      'incl'),
     ('exclude',      'excl'),
     ('pchar',        'cstring'),
-    ('close',        'closeFile'),
-    ('assignfile',   'openFile'),
+    ('assignfile',   'open'),
     ('integer',      'int'),
     ('longword',     'int32'),
     ('cardinal',     'int'),
@@ -62,10 +61,12 @@ const
     ('len',          'length'),
     ('setlength',    'setlen')
   );
-  nimReplacements: array [1..30] of TReplaceTuple = (
+  nimReplacements: array [1..32] of TReplaceTuple = (
     ('nimread',      'read'),
     ('nimwrite',     'write'),
-    ('nimclosefile', 'closeFile'),
+    ('nimclosefile', 'close'),
+    ('closefile',    'close'),
+    ('openfile',     'open'),
     ('nsystem', 'system'),
     ('ntime', 'times'),
     ('nos', 'os'),
@@ -1972,7 +1973,7 @@ begin
         if isHandledDirective(p) then
           addSon(result, parseDirective(p))
         else
-          parMessage(p, errPragmaXHereNotAllowed, p.tok.ident.s)
+          parMessage(p, errXNotAllowedHere, p.tok.ident.s)
       end
       else addSon(result, parseStmt(p))
     end;
diff --git a/nim/pnimsyn.pas b/nim/pnimsyn.pas
index 51c0cd4f5..2ca411770 100644
--- a/nim/pnimsyn.pas
+++ b/nim/pnimsyn.pas
@@ -313,9 +313,8 @@ end;
 function accExpr(var p: TParser): PNode;
 var
   x, y: PNode;
-  info: TLineInfo;
 begin
-  info := parLineInfo(p);
+  result := newNodeP(nkAccQuoted, p);
   getTok(p); // skip `
   x := nil;
   y := nil;
@@ -343,16 +342,7 @@ begin
       end
     end;
   end;
-  if (p.tok.tokType = tkParLe) or (p.tok.tokType = tkColon) then begin
-    result := newNodeP(nkHeaderQuoted, p);
-    addSon(result, x);
-    addSon(result, parseParamList(p));
-  end
-  else begin
-    result := newNodeP(nkAccQuoted, p);
-    addSon(result, x);
-  end;
-  result.info := info;
+  addSon(result, x);
   eat(p, tkAccent);
 end;
 
@@ -665,6 +655,13 @@ begin
     optInd(p, a);
     addSon(result, primary(p));
     exit
+  end
+  else if p.tok.tokType = tkBind then begin
+    result := newNodeP(nkBind, p);
+    getTok(p);
+    optInd(p, result);
+    addSon(result, primary(p));
+    exit
   end;
   result := identOrLiteral(p);
   while true do begin
@@ -798,7 +795,7 @@ end;
 function isExprStart(const p: TParser): bool;
 begin
   case p.tok.tokType of
-    tkSymbol, tkAccent, tkOpr, tkNot, tkNil, tkCast, tkIf, tkLambda,
+    tkSymbol, tkAccent, tkOpr, tkNot, tkNil, tkCast, tkIf, tkLambda, tkBind,
     tkParLe, tkBracketLe, tkCurlyLe, tkIntLit..tkCharLit: result := true;
     else result := false;
   end;
diff --git a/nim/pragmas.pas b/nim/pragmas.pas
index 9f4a543c5..f81cdd6e2 100644
--- a/nim/pragmas.pas
+++ b/nim/pragmas.pas
@@ -499,7 +499,11 @@ begin
             // otherwise header would not make sense
             if sym.loc.r = nil then sym.loc.r := toRope(sym.name.s)
           end;
-          wNosideeffect: begin noVal(it); Include(sym.flags, sfNoSideEffect); end;
+          wNosideeffect: begin 
+            noVal(it); Include(sym.flags, sfNoSideEffect); 
+            if sym.typ <> nil then include(sym.typ.flags, tfNoSideEffect);
+          end;
+          wSideEffect: begin noVal(it); Include(sym.flags, sfSideEffect); end;
           wNoReturn: begin noVal(it); Include(sym.flags, sfNoReturn); end;
           wDynLib: processDynLib(c, it, sym);
           wCompilerProc: begin
@@ -597,7 +601,7 @@ end;
 procedure pragmaProc(c: PContext; s: PSym; n: PNode);
 begin
   pragma(c, s, n, {@set}[FirstCallConv..LastCallConv,
-    wImportc, wExportc, wNodecl, wMagic, wNosideEffect,
+    wImportc, wExportc, wNodecl, wMagic, wNosideEffect, wSideEffect,
     wNoreturn, wDynLib, wHeader, wCompilerProc, wPure,
     wCppMethod, wDeprecated, wVarargs, wCompileTime, wMerge,
     wBorrow]);
@@ -612,7 +616,8 @@ end;
 
 procedure pragmaIterator(c: PContext; s: PSym; n: PNode);
 begin
-  pragma(c, s, n, {@set}[FirstCallConv..LastCallConv,
+  pragma(c, s, n, {@set}[FirstCallConv..LastCallConv, 
+         wNosideEffect, wSideEffect,
          wImportc, wExportc, wNodecl, wMagic, wDeprecated, wBorrow]);
 end;
 
@@ -630,7 +635,7 @@ end;
 procedure pragmaLambda(c: PContext; s: PSym; n: PNode);
 begin
   pragma(c, s, n, {@set}[FirstCallConv..LastCallConv,
-    wImportc, wExportc, wNodecl, wNosideEffect,
+    wImportc, wExportc, wNodecl, wNosideEffect, wSideEffect, 
     wNoreturn, wDynLib, wHeader, wPure, wDeprecated]);
 end;
 
diff --git a/nim/rnimsyn.pas b/nim/rnimsyn.pas
index 5be10a0f3..0ed3cfcd7 100644
--- a/nim/rnimsyn.pas
+++ b/nim/rnimsyn.pas
@@ -1,7 +1,7 @@
 //
 //
 //           The Nimrod Compiler
-//        (c) Copyright 2008 Andreas Rumpf
+//        (c) Copyright 2009 Andreas Rumpf
 //
 //    See the file "copying.txt", included in this
 //    distribution, for details about the copyright.
@@ -498,8 +498,10 @@ begin
     nkCommand: result := lsub(n.sons[0])+lcomma(n, 1)+1;
     nkExprEqExpr, nkDefaultTypeParam, nkAsgn, nkFastAsgn: result := lsons(n)+3;
     nkPar, nkCurly, nkBracket: result := lcomma(n)+2;
+    nkSymChoice: result := lsons(n) + length('()') + sonsLen(n)-1;
     nkTupleTy: result := lcomma(n)+length('tuple[]');
     nkQualified, nkDotExpr: result := lsons(n)+1;
+    nkBind: result := lsons(n)+length('bind_');
     nkCheckedFieldExpr: result := lsub(n.sons[0]);
     nkLambda: result := lsons(n)+length('lambda__=_');
     nkConstDef, nkIdentDefs: begin
@@ -531,7 +533,6 @@ begin
     nkDerefExpr:      result := lsub(n.sons[0])+2;
     nkImportAs:       result := lsons(n) + length('_as_');
     nkAccQuoted:      result := lsub(n.sons[0]) + 2;
-    nkHeaderQuoted:   result := lsub(n.sons[0]) + lsub(n.sons[1]) + 2;
 
     nkIfExpr:         result := lsub(n.sons[0].sons[0])+lsub(n.sons[0].sons[1])
                               + lsons(n, 1) + length('if_:_');
@@ -1023,6 +1024,14 @@ begin
       gcomma(g, n, 1);
       put(g, tkParRi, ')'+'');
     end;
+    nkSymChoice: begin
+      put(g, tkParLe, '('+'');
+      for i := 0 to sonsLen(n)-1 do begin
+        if i > 0 then put(g, tkOpr, '|'+'');
+        gsub(g, n.sons[i], c);
+      end;
+      put(g, tkParRi, ')'+'');      
+    end;
     nkPar: begin
       put(g, tkParLe, '('+'');
       gcomma(g, n, c);
@@ -1043,6 +1052,10 @@ begin
       put(g, tkDot, '.'+'');
       gsub(g, n.sons[1]);
     end;
+    nkBind: begin
+      putWithSpace(g, tkBind, 'bind');
+      gsub(g, n.sons[0]);
+    end;
     nkCheckedFieldExpr, nkHiddenAddr, nkHiddenDeref: gsub(g, n.sons[0]);
     nkLambda: begin
       assert(n.sons[genericParamsPos] = nil);
@@ -1119,12 +1132,6 @@ begin
       gsub(g, n.sons[0]);
       put(g, tkAccent, '`'+'');
     end;
-    nkHeaderQuoted: begin
-      put(g, tkAccent, '`'+'');
-      gsub(g, n.sons[0]);
-      gsub(g, n.sons[1]);
-      put(g, tkAccent, '`'+'');
-    end;
     nkIfExpr: begin
       putWithSpace(g, tkIf, 'if');
       gsub(g, n.sons[0].sons[0]);
diff --git a/nim/ropes.pas b/nim/ropes.pas
index 6b6540c24..286f1b9e6 100644
--- a/nim/ropes.pas
+++ b/nim/ropes.pas
@@ -488,22 +488,25 @@ end;
 
 function ropef(const frmt: TFormatStr; const args: array of PRope): PRope;
 var
-  i, j, len, start: int;
+  i, j, len, start, num: int;
 begin
   i := strStart;
   len := length(frmt);
   result := nil;
+  num := 0;
   while i <= len + StrStart - 1 do begin
     if frmt[i] = '$' then begin
       inc(i); // skip '$'
       case frmt[i] of
         '$': begin app(result, '$'+''); inc(i); end;
+        '#': begin inc(i); app(result, args[num]); inc(num); end;
         '0'..'9': begin
           j := 0;
           repeat
             j := (j*10) + Ord(frmt[i]) - ord('0');
             inc(i);
           until (i > len + StrStart - 1) or not (frmt[i] in ['0'..'9']);
+          num := j;
           if j > high(args)+1 then
             internalError('ropes: invalid format string $' + toString(j));
           app(result, args[j-1]);
diff --git a/nim/scanner.pas b/nim/scanner.pas
index d1f32135c..edc9ca24a 100644
--- a/nim/scanner.pas
+++ b/nim/scanner.pas
@@ -53,10 +53,10 @@ type
     //cog.out(idents)
     //]]]
     tkAbstract, tkAddr, tkAnd, tkAs, 
-    tkAsm, tkBlock, tkBreak, tkCase, 
-    tkCast, tkConst, tkContinue, tkConverter, 
-    tkDiscard, tkDiv, tkElif, tkElse, 
-    tkEnd, tkEnum, tkExcept, tkException, 
+    tkAsm, tkBind, tkBlock, tkBreak, 
+    tkCase, tkCast, tkConst, tkContinue, 
+    tkConverter, tkDiscard, tkDiv, tkElif, 
+    tkElse, tkEnd, tkEnum, tkExcept, 
     tkFinally, tkFor, tkFrom, tkGeneric, 
     tkIf, tkImplies, tkImport, tkIn, 
     tkInclude, tkIs, tkIsnot, tkIterator, 
@@ -97,10 +97,10 @@ const
     //cog.out(strings)
     //]]]
     'abstract', 'addr', 'and', 'as', 
-    'asm', 'block', 'break', 'case', 
-    'cast', 'const', 'continue', 'converter', 
-    'discard', 'div', 'elif', 'else', 
-    'end', 'enum', 'except', 'exception', 
+    'asm', 'bind', 'block', 'break', 
+    'case', 'cast', 'const', 'continue', 
+    'converter', 'discard', 'div', 'elif', 
+    'else', 'end', 'enum', 'except', 
     'finally', 'for', 'from', 'generic', 
     'if', 'implies', 'import', 'in', 
     'include', 'is', 'isnot', 'iterator', 
diff --git a/nim/sem.pas b/nim/sem.pas
index c0826bdbe..1fd141f5a 100644
--- a/nim/sem.pas
+++ b/nim/sem.pas
@@ -90,8 +90,6 @@ end;
 function semAndEvalConstExpr(c: PContext; n: PNode): PNode;
 var
   e: PNode;
-  p: PEvalContext;
-  s: PStackFrame;
 begin
   e := semExprWithType(c, n);
   if e = nil then begin
@@ -101,12 +99,7 @@ begin
   result := getConstExpr(c.module, e);
   if result = nil then begin
     //writeln(output, renderTree(n));
-    p := newEvalContext(c.module, '');
-    s := newStackFrame();
-    s.call := e;
-    pushStackFrame(p, s);
-    result := eval(p, e);
-    popStackFrame(p);
+    result := evalConstExpr(c.module, e);
     if (result = nil) or (result.kind = nkEmpty) then
       liMessage(n.info, errConstExprExpected);
   end
@@ -135,7 +128,7 @@ var
   s: PStackFrame;
 begin
   include(sym.flags, sfUsed);
-  p := newEvalContext(c.module, '');
+  p := newEvalContext(c.module, '', false);
   s := newStackFrame();
   s.call := n;
   setLength(s.params, 2);
diff --git a/nim/semdata.pas b/nim/semdata.pas
index acca48376..acaffd3bf 100644
--- a/nim/semdata.pas
+++ b/nim/semdata.pas
@@ -45,7 +45,7 @@ type
     module: PSym;            // the module sym belonging to the context
     filename: string;        // the module's filename
     tab: TSymTab;            // each module has its own symbol table
-    AmbigiousSymbols: TIntSet; // contains ids of all ambigious symbols (cannot
+    AmbiguousSymbols: TIntSet; // contains ids of all ambiguous symbols (cannot
                                // store this info in the syms themselves!)
     generics: PNode;         // a list of the things to compile; list of
                              // nkExprEqExpr nodes which contain the generic
@@ -156,7 +156,7 @@ begin
   fillChar(result^, sizeof(result^), 0);
 {@emit}
   InitSymTab(result.tab);
-  IntSetInit(result.AmbigiousSymbols);
+  IntSetInit(result.AmbiguousSymbols);
   initLinkedList(result.optionStack);
   initLinkedList(result.libs);
   append(result.optionStack, newOptionEntry());
diff --git a/nim/semexprs.pas b/nim/semexprs.pas
index 74cd44b3d..de37295b7 100644
--- a/nim/semexprs.pas
+++ b/nim/semexprs.pas
@@ -1,6 +1,6 @@
 //
 //
-//           The Ethexor Morpork Compiler
+//           The Nimrod Compiler
 //        (c) Copyright 2009 Andreas Rumpf
 //
 //    See the file "copying.txt", included in this
@@ -110,18 +110,33 @@ begin
 end;
 
 function semConv(c: PContext; n: PNode; s: PSym): PNode;
+var
+  op: PNode;
+  i: int;
 begin
   if sonsLen(n) <> 2 then liMessage(n.info, errConvNeedsOneArg);
   result := newNodeI(nkConv, n.info);
   result.typ := semTypeNode(c, n.sons[0], nil);
   addSon(result, copyTree(n.sons[0]));
   addSon(result, semExprWithType(c, n.sons[1]));
-  checkConvertible(result.info, result.typ, result.sons[1].typ);
+  op := result.sons[1];
+  if op.kind <> nkSymChoice then 
+    checkConvertible(result.info, result.typ, op.typ)
+  else begin
+    for i := 0 to sonsLen(op)-1 do begin
+      if sameType(result.typ, op.sons[i].typ) then begin
+        include(op.sons[i].sym.flags, sfUsed);
+        result := op.sons[i]; exit
+      end
+    end;
+    liMessage(n.info, errUseQualifier, op.sons[0].sym.name.s);
+  end
 end;
 
 function semCast(c: PContext; n: PNode): PNode;
 begin
   if optSafeCode in gGlobalOptions then liMessage(n.info, errCastNotInSafeMode);
+  include(c.p.owner.flags, sfSideEffect);
   checkSonsLen(n, 2);
   result := newNodeI(nkCast, n.info);
   result.typ := semTypeNode(c, n.sons[0], nil);
@@ -354,7 +369,7 @@ function isAssignable(n: PNode): bool;
 begin
   result := false;
   case n.kind of
-    nkSym: result := n.sym.kind in [skVar, skTemp];
+    nkSym: result := (n.sym.kind in [skVar, skTemp]);
     nkDotExpr, nkQualified, nkBracketExpr: begin
       checkMinSonsLen(n, 1);
       if skipTypes(n.sons[0].typ, abstractInst).kind in [tyVar, tyPtr, tyRef] then
@@ -373,7 +388,7 @@ begin
     nkObjUpConv, nkObjDownConv, nkCheckedFieldExpr:
       result := isAssignable(n.sons[0]);
     else begin end
-  end
+  end;
 end;
 
 function newHiddenAddrTaken(c: PContext; n: PNode): PNode;
@@ -442,13 +457,31 @@ begin
       n.sons[i] := analyseIfAddressTaken(c, n.sons[i]);
 end;
 
+function semDirectCallAnalyseEffects(c: PContext; n: PNode): PNode;
+var
+  callee: PSym;
+begin
+  result := semDirectCall(c, n);
+  if result <> nil then begin
+    if result.sons[0].kind <> nkSym then 
+      InternalError('semDirectCallAnalyseEffects');
+    callee := result.sons[0].sym;
+    if not (sfNoSideEffect in callee.flags) then 
+      if (sfForward in callee.flags) 
+      or ([sfImportc, sfSideEffect] * callee.flags <> []) then 
+        include(c.p.owner.flags, sfSideEffect);
+  end
+end;
+
 function semIndirectOp(c: PContext; n: PNode): PNode;
 var
   m: TCandidate;
   msg: string;
   i: int;
+  prc: PNode;
 begin
   result := nil;
+  prc := n.sons[0];
   checkMinSonsLen(n, 1);
   case n.sons[0].kind of
     nkDotExpr, nkQualified: begin
@@ -457,8 +490,7 @@ begin
       if n.sons[0].kind = nkDotCall then begin // it is a static call!
         result := n.sons[0];
         result.kind := nkCall;
-        for i := 1 to sonsLen(n)-1 do
-          addSon(result, n.sons[i]);
+        for i := 1 to sonsLen(n)-1 do addSon(result, n.sons[i]);
         result := semExpr(c, result);
         exit
       end
@@ -475,8 +507,8 @@ begin
     if m.state <> csMatch then begin
       msg := msgKindToString(errTypeMismatch);
       for i := 1 to sonsLen(n)-1 do begin
+        if i > 1 then add(msg, ', ');
         add(msg, typeToString(n.sons[i].typ));
-        if i <> sonsLen(n)-1 then add(msg, ', ');
       end;
       add(msg, ')' +{&} nl +{&} msgKindToString(errButExpected) +{&}
              nl +{&} typeToString(n.sons[0].typ));
@@ -485,11 +517,21 @@ begin
     end
     else
       result := m.call;
+    // we assume that a procedure that calls something indirectly 
+    // has side-effects:
+    include(c.p.owner.flags, sfSideEffect);
   end
   else begin
     result := overloadedCallOpr(c, n);
-    if result = nil then result := semDirectCall(c, n);
-    if result = nil then liMessage(n.info, errExprCannotBeCalled);
+    // Now that nkSym does not imply an iteration over the proc/iterator space,
+    // the old ``prc`` (which is likely an nkIdent) has to be restored:
+    if result = nil then begin
+      n.sons[0] := prc;
+      result := semDirectCallAnalyseEffects(c, n);
+    end;
+    if result = nil then 
+      liMessage(n.info, errExprXCannotBeCalled, 
+                renderTree(n, {@set}[renderNoComments]));
   end;
   fixAbstractType(c, result);
   analyseIfAddressTakenInCall(c, result);
@@ -499,7 +541,7 @@ function semDirectOp(c: PContext; n: PNode): PNode;
 begin
   // this seems to be a hotspot in the compiler!
   semOpAux(c, n);
-  result := semDirectCall(c, n);
+  result := semDirectCallAnalyseEffects(c, n);
   if result = nil then begin
     result := overloadedCallOpr(c, n);
     if result = nil then
@@ -508,45 +550,6 @@ begin
   fixAbstractType(c, result);
   analyseIfAddressTakenInCall(c, result);
 end;
-(*
-function semIncSucc(c: PContext; n: PNode; const opr: string): PNode;
-// handles Inc, Dec, Succ and Pred
-var
-  a: PNode;
-  typ: PType;
-begin
-  checkMinSonsLen(n, 2);
-  n.sons[1] := semExprWithType(c, n.sons[1]);
-  typ := skipTypes(n.sons[1].Typ, {@set}[tyGenericInst, tyVar]);
-  if not isOrdinalType(typ) or enumHasWholes(typ) then
-    liMessage(n.sons[1].Info, errOrdinalTypeExpected);
-  if sonsLen(n) = 3 then begin
-    n.sons[2] := semExprWithType(c, n.sons[2]);
-    a := IndexTypesMatch(c, getSysType(tyInt), n.sons[2].typ, n.sons[2]);
-    if a = nil then
-      typeMismatch(n.sons[2], getSysType(tyInt), n.sons[2].typ);
-    n.sons[2] := a;
-  end
-  else if sonsLen(n) = 2 then begin // default value of 1
-    a := newIntNode(nkIntLit, 1);
-    a.info := n.info;
-    a.typ := getSysType(tyInt);
-    addSon(n, a)
-  end
-  else
-    liMessage(n.info, errInvalidArgForX, opr);
-  result := n;
-end;
-
-function semOrd(c: PContext; n: PNode): PNode;
-begin
-  checkSonsLen(n, 2);
-  n.sons[1] := semExprWithType(c, n.sons[1]);
-  if not isOrdinalType(skipTypes(n.sons[1].Typ, {@set}[tyGenericInst, tyVar])) then
-    liMessage(n.Info, errOrdinalTypeExpected);
-  n.typ := getSysType(tyInt);
-  result := n
-end; *)
 
 function semEcho(c: PContext; n: PNode): PNode;
 var
@@ -632,18 +635,6 @@ begin
     mSizeOf:  result := semSizeof(c, setMs(n, s));
     mIs:      result := semIs(c, setMs(n, s));
     mEcho:    result := semEcho(c, setMs(n, s)); 
-    (*
-    mSucc:    begin
-      result := semIncSucc(c, setMs(n, s), 'succ');
-      result.typ := n.sons[1].typ;
-    end;
-    mPred:    begin
-      result := semIncSucc(c, setMs(n, s), 'pred');
-      result.typ := n.sons[1].typ;
-    end;
-    mInc:     result := semIncSucc(c, setMs(n, s), 'inc');
-    ast.mDec: result := semIncSucc(c, setMs(n, s), 'dec');
-    mOrd:     result := semOrd(c, setMs(n, s)); *)
     else      result := semDirectOp(c, n);
   end;
 end;
@@ -655,16 +646,14 @@ end;
 
 function semSym(c: PContext; n: PNode; s: PSym; flags: TExprFlags): PNode;
 begin
-  result := newSymNode(s);
-  result.info := n.info;
-  result.typ := s.typ;
-  include(s.flags, sfUsed);
   if (s.kind = skType) and not (efAllowType in flags) then
     liMessage(n.info, errATypeHasNoValue);
   case s.kind of
-    skProc, skIterator, skConverter:
+    skProc, skIterator, skConverter: begin
       if (s.magic <> mNone) then
         liMessage(n.info, errInvalidContextForBuiltinX, s.name.s);
+      result := symChoice(c, n, s);
+    end;
     skConst: begin
       (*
         Consider::
@@ -678,20 +667,40 @@ begin
         copy `x`'s AST into each context, so that the type fixup phase can
         deal with two different ``[]``.
       *)
+      include(s.flags, sfUsed);
       if s.typ.kind in ConstAbstractTypes then begin
         result := copyTree(s.ast);
         result.info := n.info;
         result.typ := s.typ;
       end
+      else begin
+        result := newSymNode(s);
+        result.info := n.info;      
+      end
+    end;
+    skMacro: begin
+      include(s.flags, sfUsed);
+      result := semMacroExpr(c, n, s);
     end;
-    skMacro: result := semMacroExpr(c, n, s);
     skTemplate: begin
+      include(s.flags, sfUsed);
       // Templates and macros can be invoked without ``()``
       pushInfoContext(n.info);
       result := evalTemplate(c, n, s);
       popInfoContext();
     end;
-    else begin end
+    skVar: begin
+      include(s.flags, sfUsed);
+      // if a proc accesses a global variable, it is not side effect free
+      if sfGlobal in s.flags then include(c.p.owner.flags, sfSideEffect);
+      result := newSymNode(s);
+      result.info := n.info;  
+    end;
+    else begin
+      include(s.flags, sfUsed);
+      result := newSymNode(s);
+      result.info := n.info;
+    end
   end;
   checkDeprecated(n, s);
 end;
@@ -1266,6 +1275,7 @@ begin
         result := semExpr(c, result, flags)
       end;
     end;
+    nkBind: result := semExpr(c, n.sons[0], flags);
     nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand: begin
       // check if it is an expression macro:
       checkMinSonsLen(n, 1);
@@ -1326,11 +1336,7 @@ begin
     end;
     nkCurly: result := semSetConstr(c, n);
     nkBracket: result := semArrayConstr(c, n);
-    nkLambda: result := semLambda(c, n); // handled in semstmts
-    nkExprColonExpr: begin
-      internalError(n.info, 'semExpr() to implement');
-      // XXX: to implement for array constructors!
-    end;
+    nkLambda: result := semLambda(c, n);
     nkDerefExpr: begin
       checkSonsLen(n, 1);
       n.sons[0] := semExprWithType(c, n.sons[0]);
@@ -1357,11 +1363,6 @@ begin
       checkSonsLen(n, 1);
       result := semExpr(c, n.sons[0]);
     end;
-    nkHeaderQuoted: begin
-      // look up the proc:
-      internalError(n.info, 'semExpr() to implement');
-      // XXX: to implement
-    end;
     nkIfExpr: result := semIfExpr(c, n);
     nkStmtListExpr: result := semStmtListExpr(c, n);
     nkBlockExpr: result := semBlockExpr(c, n);
@@ -1374,6 +1375,11 @@ begin
       checkSonsLen(n, 3);
     nkCheckedFieldExpr:
       checkMinSonsLen(n, 2);
+    nkSymChoice: begin
+      liMessage(n.info, errExprXAmbiguous,
+                renderTree(n, {@set}[renderNoComments]));
+      result := nil
+    end
     else begin
       //InternalError(n.info, nodeKindToStr[n.kind]);
       liMessage(n.info, errInvalidExpressionX,
diff --git a/nim/semstmts.pas b/nim/semstmts.pas
index c8b942df8..686ff775d 100644
--- a/nim/semstmts.pas
+++ b/nim/semstmts.pas
@@ -257,7 +257,7 @@ begin
       addSon(result, newIdentNode(getIdent(id.s+'='), n.info));
       addSon(result, semExpr(c, a.sons[0]));
       addSon(result, semExpr(c, n.sons[1]));
-      result := semDirectCall(c, result);
+      result := semDirectCallAnalyseEffects(c, result);
       if result <> nil then begin
         fixAbstractType(c, result);
         analyseIfAddressTakenInCall(c, result);
@@ -277,7 +277,7 @@ begin
         addSonIfNotNil(result, semExpr(c, a.sons[1].sons[0]));
         addSonIfNotNil(result, semExpr(c, a.sons[1].sons[1]));
         addSon(result, semExpr(c, n.sons[1]));
-        result := semDirectCall(c, result);
+        result := semDirectCallAnalyseEffects(c, result);
         if result <> nil then begin
           fixAbstractType(c, result);
           analyseIfAddressTakenInCall(c, result);
@@ -289,7 +289,7 @@ begin
         addSon(result, semExpr(c, a.sons[0]));
         addSon(result, semExpr(c, a.sons[1]));
         addSon(result, semExpr(c, n.sons[1]));
-        result := semDirectCall(c, result);
+        result := semDirectCallAnalyseEffects(c, result);
         if result <> nil then begin
           fixAbstractType(c, result);
           analyseIfAddressTakenInCall(c, result);
@@ -322,7 +322,7 @@ begin
   result := n;
   checkSonsLen(n, 1);
   if not (c.p.owner.kind in [skConverter, skProc, skMacro]) then
-    liMessage(n.info, errReturnNotAllowedHere);
+    liMessage(n.info, errXNotAllowedHere, '''return''');
   if (n.sons[0] <> nil) then begin
     n.sons[0] := SemExprWithType(c, n.sons[0]);
     // check for type compatibility:
@@ -624,9 +624,28 @@ begin
   end
 end;
 
-function resolveGenericParams(c: PContext; n: PNode): PNode;
+function resolveGenericParams(c: PContext; n: PNode; 
+                              withinBind: bool = false): PNode;
+var
+  i: int;
+  s: PSym;
 begin
-  result := n;
+  if n = nil then begin result := nil; exit end;
+  case n.kind of
+    nkIdent: begin
+      if not withinBind then 
+        result := n
+      else
+        result := symChoice(c, n, lookup(c, n))
+    end;
+    nkSym..nkNilLit: result := n;
+    nkBind: result := resolveGenericParams(c, n.sons[0], true);
+    else begin
+      result := n;
+      for i := 0 to sonsLen(n)-1 do
+        result.sons[i] := resolveGenericParams(c, n.sons[i], withinBind);
+    end
+  end
 end;
 
 function SemTypeSection(c: PContext; n: PNode): PNode;
@@ -682,7 +701,7 @@ begin
       addSon(s.typ, nil);
       // process the type body for symbol lookup of generic params
       // we can use the same algorithm as for template parameters:
-      a.sons[2] := resolveTemplateParams(c, a.sons[2]);
+      a.sons[2] := resolveTemplateParams(c, a.sons[2], false);
       s.ast := a;
       if s.typ.containerID <> 0 then
         InternalError(a.info, 'semTypeSection: containerID');
@@ -754,6 +773,13 @@ begin
   n.sons[codePos] := newSymNode(b);
 end;
 
+procedure sideEffectsCheck(c: PContext; s: PSym);
+begin
+  if [sfNoSideEffect, sfSideEffect] * s.flags = 
+     [sfNoSideEffect, sfSideEffect] then 
+    liMessage(s.info, errXhasSideEffects, s.name.s);
+end;
+
 function semIterator(c: PContext; n: PNode): PNode;
 var
   s: PSym;
@@ -972,6 +998,7 @@ begin
     else if sfBorrow in s.flags then 
       semBorrow(c, n, s);
   end;
+  sideEffectsCheck(c, s);
   closeScope(c.tab); // close scope for parameters
   popOwner();
   c.p := oldP; // restore
diff --git a/nim/semtempl.pas b/nim/semtempl.pas
index ebc5e1ebb..b8107095f 100644
--- a/nim/semtempl.pas
+++ b/nim/semtempl.pas
@@ -1,7 +1,7 @@
 //
 //
 //           The Nimrod Compiler
-//        (c) Copyright 2008 Andreas Rumpf
+//        (c) Copyright 2009 Andreas Rumpf
 //
 //    See the file "copying.txt", included in this
 //    distribution, for details about the copyright.
@@ -90,7 +90,37 @@ begin
   dec(evalTemplateCounter);
 end;
 
-function resolveTemplateParams(c: PContext; n: PNode): PNode;
+function symChoice(c: PContext; n: PNode; s: PSym): PNode;
+var
+  a: PSym;
+  o: TOverloadIter;
+  i: int;
+begin
+  i := 0;
+  a := initOverloadIter(o, c, n);
+  while a <> nil do begin
+    a := nextOverloadIter(o, c, n);
+    inc(i);
+  end;
+  if i <= 1 then begin
+    result := newSymNode(s);
+    result.info := n.info;
+    include(s.flags, sfUsed);
+  end
+  else begin
+    // semantic checking requires a type; ``fitNode`` deal with it
+    // appropriately
+    result := newNodeIT(nkSymChoice, n.info, newTypeS(tyNone, c));
+    a := initOverloadIter(o, c, n);
+    while a <> nil do begin
+      addSon(result, newSymNode(a));
+      a := nextOverloadIter(o, c, n);
+    end
+  end
+end;
+
+function resolveTemplateParams(c: PContext; n: PNode; 
+                               withinBind: bool): PNode;
 var
   i: int;
   s: PSym;
@@ -98,20 +128,27 @@ begin
   if n = nil then begin result := nil; exit end;
   case n.kind of
     nkIdent: begin
-      s := SymTabLocalGet(c.Tab, n.ident);
-      if (s <> nil) then begin
-        result := newSymNode(s);
-        result.info := n.info
+      if not withinBind then begin
+        s := SymTabLocalGet(c.Tab, n.ident);
+        if (s <> nil) then begin
+          result := newSymNode(s);
+          result.info := n.info
+        end
+        else
+          result := n
+      end
+      else begin
+        result := symChoice(c, n, lookup(c, n))
       end
-      else
-        result := n
     end;
     nkSym..nkNilLit: // atom
       result := n;
+    nkBind: 
+      result := resolveTemplateParams(c, n.sons[0], true);
     else begin
       result := n;
       for i := 0 to sonsLen(n)-1 do
-        result.sons[i] := resolveTemplateParams(c, n.sons[i]);
+        result.sons[i] := resolveTemplateParams(c, n.sons[i], withinBind);
     end
   end
 end;
@@ -200,7 +237,7 @@ begin
   if n.sons[genericParamsPos] <> nil then
     liMessage(n.info, errNoGenericParamsAllowedForX, 'template');
   // resolve parameters:
-  n.sons[codePos] := resolveTemplateParams(c, n.sons[codePos]);
+  n.sons[codePos] := resolveTemplateParams(c, n.sons[codePos], false);
   if params.sons[0].ident.id = ord(wExpr) then
     n.sons[codePos] := transformToExpr(n.sons[codePos]);
 
diff --git a/nim/sigmatch.pas b/nim/sigmatch.pas
index d95745e0c..ccd05d413 100644
--- a/nim/sigmatch.pas
+++ b/nim/sigmatch.pas
@@ -46,6 +46,21 @@ begin
   assert(c.callee <> nil);
 end;
 
+procedure copyCandidate(var a: TCandidate; const b: TCandidate);
+begin
+  a.exactMatches := b.exactMatches;
+  a.subtypeMatches := b.subtypeMatches;
+  a.convMatches := b.convMatches;
+  a.intConvMatches := b.intConvMatches;
+  a.genericMatches := b.genericMatches;
+  a.state := b.state;
+  a.callee := b.callee;
+  a.calleeSym := b.calleeSym;
+  a.call := copyTree(b.call);
+  a.baseTypeMatch := b.baseTypeMatch;
+  copyIdTable(a.bindings, b.bindings);
+end;
+
 function cmpCandidates(const a, b: TCandidate): int;
 begin
   result := a.exactMatches - b.exactMatches;
@@ -552,8 +567,8 @@ begin
   end
 end;
 
-function ParamTypesMatch(c: PContext; var m: TCandidate; f, a: PType;
-                         arg: PNode): PNode;
+function ParamTypesMatchAux(c: PContext; var m: TCandidate; f, a: PType;
+                            arg: PNode): PNode;
 var
   r: TTypeRelation;
 begin
@@ -608,6 +623,57 @@ begin
   end
 end;
 
+function ParamTypesMatch(c: PContext; var m: TCandidate; f, a: PType;
+                         arg: PNode): PNode;
+var
+  i, cmp, best: int;
+  x, y, z: TCandidate;
+  r: TTypeRelation;
+begin
+  if (arg = nil) or (arg.kind <> nkSymChoice) then
+    result := ParamTypesMatchAux(c, m, f, a, arg)
+  else begin
+    // CAUTION: The order depends on the used hashing scheme. Thus it is
+    // incorrect to simply use the first fitting match. However, to implement
+    // this correctly is inefficient. We have to copy `m` here to be able to
+    // roll back the side effects of the unification algorithm.
+    initCandidate(x, m.callee);
+    initCandidate(y, m.callee);
+    initCandidate(z, m.callee);
+    x.calleeSym := m.calleeSym;
+    y.calleeSym := m.calleeSym;
+    z.calleeSym := m.calleeSym;
+    best := -1;
+    for i := 0 to sonsLen(arg)-1 do begin
+      copyCandidate(z, m);
+      r := typeRel(z.bindings, f, arg.sons[i].typ);
+      if r <> isNone then begin
+        case x.state of
+          csEmpty, csNoMatch: begin x := z; best := i; x.state := csMatch; end;
+          csMatch: begin
+            cmp := cmpCandidates(x, z);
+            if cmp < 0 then begin best := i; x := z end // z is better than x
+            else if cmp = 0 then y := z // z is as good as x
+            else begin end // z is worse than x
+          end
+        end
+      end
+    end;
+    if x.state = csEmpty then 
+      result := nil
+    else if (y.state = csMatch) and (cmpCandidates(x, y) = 0) then begin
+      if x.state <> csMatch then InternalError(arg.info, 'x.state is not csMatch');
+      // ambiguous: more than one symbol fits
+      result := nil
+    end
+    else begin
+      // only one valid interpretation found:
+      include(arg.sons[best].sym.flags, sfUsed);
+      result := ParamTypesMatchAux(c, m, f, arg.sons[best].typ, arg.sons[best]);
+    end
+  end
+end;
+
 function IndexTypesMatch(c: PContext; f, a: PType; arg: PNode): PNode;
 var
   m: TCandidate;
@@ -796,7 +862,7 @@ begin
     //writeMatches(x);
     //writeMatches(y);
     liMessage(n.Info, errGenerated,
-      format(msgKindToString(errAmbigiousCallXYZ),
+      format(msgKindToString(errAmbiguousCallXYZ),
         [getProcHeader(x.calleeSym),
         getProcHeader(y.calleeSym), x.calleeSym.Name.s]))
   end
diff --git a/nim/strutils.pas b/nim/strutils.pas
index 377d3abc6..f34379fcb 100644
--- a/nim/strutils.pas
+++ b/nim/strutils.pas
@@ -502,18 +502,25 @@ procedure addf(var result: string; const f: string; args: array of string);
 const
   PatternChars = ['a'..'z', 'A'..'Z', '0'..'9', '_', #128..#255];
 var
-  i, j, x: int;
+  i, j, x, num: int;
 begin
   i := 1;
+  num := 0;
   while i <= length(f) do
     if f[i] = '$' then begin
       case f[i+1] of
+        '#': begin
+          inc(i, 2);
+          add(result, args[num]);
+          inc(num);
+        end;
         '$': begin
           addChar(result, '$');
           inc(i, 2);
         end;
         '1'..'9': begin
-          add(result, args[ord(f[i+1]) - ord('0') - 1]);
+          num := ord(f[i+1]) - ord('0');
+          add(result, args[num - 1]);
           inc(i, 2);
         end;
         '{': begin
diff --git a/nim/transf.pas b/nim/transf.pas
index b1812d52c..3e3b2a611 100644
--- a/nim/transf.pas
+++ b/nim/transf.pas
@@ -15,6 +15,7 @@ unit transf;
 // * inlines constants
 // * performes contant folding
 // * introduces nkHiddenDeref, nkHiddenSubConv, etc.
+// * aggressive compile-time evaluation based on the side-effect analysis
 
 interface
 
@@ -22,7 +23,7 @@ interface
 
 uses
   sysutils, nsystem, charsets, strutils,
-  lists, options, ast, astalgo, trees, treetab, 
+  lists, options, ast, astalgo, trees, treetab, evals,
   msgs, nos, idents, rnimsyn, types, passes, semfold, magicsys;
 
 const
@@ -822,7 +823,24 @@ begin
     end;
     if sonsLen(result) = 2 then
       result := result.sons[1];
-  end;
+  end
+  (*
+  else if result.sons[0].kind = nkSym then begin
+    // optimization still too aggressive
+    op := result.sons[0].sym;
+    if (op.magic = mNone) and (op.kind = skProc) 
+    and ([sfSideEffect, sfForward, sfNoReturn, sfImportc] * op.flags = [])
+    then begin
+      for i := 1 to sonsLen(result)-1 do
+        if not isConstExpr(result.sons[i]) then exit;
+      // compile-time evaluation:
+      a := evalConstExpr(c.module, result);
+      if (a <> nil) and (a.kind <> nkEmpty) then begin
+        messageout('evaluated at compile time: ' + rendertree(result));
+        result := a
+      end
+    end
+  end *)
 end;
 
 function transform(c: PTransf; n: PNode): PNode;
diff --git a/nim/types.pas b/nim/types.pas
index b4558fe82..d2aee2413 100644
--- a/nim/types.pas
+++ b/nim/types.pas
@@ -65,16 +65,6 @@ function equalParams(a, b: PNode): TParamsEquality;
 function isOrdinalType(t: PType): Boolean;
 function enumHasWholes(t: PType): Boolean;
 
-(*
-function skipRange(t: PType): PType;
-function skipGeneric(t: PType): PType;
-function skipGenericRange(t: PType): PType;
-function skipVar(t: PType): PType;
-function skipVarGeneric(t: PType): PType;
-function skipVarGenericRange(t: PType): PType;
-function skipPtrsGeneric(t: PType): PType;
-*)
-
 const
   abstractPtrs = {@set}[tyVar, tyPtr, tyRef, tyGenericInst, tyAbstract, tyOrdinal];
   abstractVar = {@set}[tyVar, tyGenericInst, tyAbstract, tyOrdinal];
diff --git a/nim/wordrecg.pas b/nim/wordrecg.pas
index cd31a64e4..1f4513ed5 100644
--- a/nim/wordrecg.pas
+++ b/nim/wordrecg.pas
@@ -40,10 +40,10 @@ type
     //cog.out(idents)
     //]]]
     wAbstract, wAddr, wAnd, wAs, 
-    wAsm, wBlock, wBreak, wCase, 
-    wCast, wConst, wContinue, wConverter, 
-    wDiscard, wDiv, wElif, wElse, 
-    wEnd, wEnum, wExcept, wException, 
+    wAsm, wBind, wBlock, wBreak, 
+    wCase, wCast, wConst, wContinue, 
+    wConverter, wDiscard, wDiv, wElif, 
+    wElse, wEnd, wEnum, wExcept, 
     wFinally, wFor, wFrom, wGeneric, 
     wIf, wImplies, wImport, wIn, 
     wInclude, wIs, wIsnot, wIterator, 
@@ -62,7 +62,7 @@ type
     // pragmas and command line options:
     wMagic, wTypeCheck, wFinal, wProfiler,
     wObjChecks, wImportc, wExportc, wAlign, wNodecl, wPure,
-    wVolatile, wRegister, wNostatic, wHeader, wNosideeffect, wNoreturn,
+    wVolatile, wRegister, wSideeffect, wHeader, wNosideeffect, wNoreturn,
     wMerge, wLib, wDynlib, wCompilerproc, wCppmethod, wFatal,
     wError, wWarning, wHint, wLine, wPush, wPop,
     wDefine, wUndef, wLinedir, wStacktrace, wLinetrace, wPragma,
@@ -114,10 +114,10 @@ const
     //cog.out(strings)
     //]]]
     'abstract', 'addr', 'and', 'as', 
-    'asm', 'block', 'break', 'case', 
-    'cast', 'const', 'continue', 'converter', 
-    'discard', 'div', 'elif', 'else', 
-    'end', 'enum', 'except', 'exception', 
+    'asm', 'bind', 'block', 'break', 
+    'case', 'cast', 'const', 'continue', 
+    'converter', 'discard', 'div', 'elif', 
+    'else', 'end', 'enum', 'except', 
     'finally', 'for', 'from', 'generic', 
     'if', 'implies', 'import', 'in', 
     'include', 'is', 'isnot', 'iterator', 
@@ -136,7 +136,7 @@ const
     // pragmas and command line options:
     'magic', 'typecheck', 'final', 'profiler',
     'objchecks', 'importc', 'exportc', 'align', 'nodecl', 'pure',
-    'volatile', 'register', 'nostatic', 'header', 'nosideeffect', 'noreturn',
+    'volatile', 'register', 'sideeffect', 'header', 'nosideeffect', 'noreturn',
     'merge', 'lib', 'dynlib', 'compilerproc', 'cppmethod', 'fatal',
     'error', 'warning', 'hint', 'line', 'push', 'pop',
     'define', 'undef', 'linedir', 'stacktrace', 'linetrace', 'pragma',
diff --git a/pycompab.py b/pycompab.py
index 3121856ef..c6752bee3 100644
--- a/pycompab.py
+++ b/pycompab.py
@@ -68,11 +68,16 @@ def Subs(frmt, *args, **substitution):
   a = args

   result = []

   i = 0

+  num = 0

   L = len(frmt)

   while i < L:

     if frmt[i] == '$':

       i = i+1

-      if frmt[i] == '$':

+      if frmt[i] == '#':

+        result.append(a[num])

+        num = num+1

+        i = i+1

+      elif frmt[i] == '$':

         result.append('$')

         i = i+1

       elif frmt[i] == '{':

@@ -91,7 +96,8 @@ def Subs(frmt, *args, **substitution):
         while i < len(frmt) and frmt[i] in chars: i = i + 1

         x = frmt[j:i]

         if x[0] in DIGITS:

-          result.append(str(a[int(x)-1]))

+          num = int(x)

+          result.append(str(a[num-1]))

         else:

           result.append(str(d[x]))

       else:

diff --git a/tests/tambsym.nim b/tests/tambsym.nim
index 7708930df..b8eae3ba3 100644
--- a/tests/tambsym.nim
+++ b/tests/tambsym.nim
@@ -1,8 +1,8 @@
-# Test ambigious symbols

+# Test ambiguous symbols

 

 import mambsym1, mambsym2

 

 var

-  v: TExport #ERROR_MSG ambigious identifier

+  v: TExport #ERROR_MSG ambiguous identifier

 

 v = y

diff --git a/tests/tambsym3.nim b/tests/tambsym3.nim
index 5d0a5f6b2..96a5098c9 100644
--- a/tests/tambsym3.nim
+++ b/tests/tambsym3.nim
@@ -1,8 +1,8 @@
-# Test ambigious symbols

+# Test ambiguous symbols

 

 import mambsym1, times

 

 var

-  v = mDec #ERROR_MSG ambigious identifier

+  v = mDec #ERROR_MSG ambiguous identifier

 

 writeln(stdout, ord(v))

diff --git a/tests/tambsys.nim b/tests/tambsys.nim
index e6800566b..bb2622824 100644
--- a/tests/tambsys.nim
+++ b/tests/tambsys.nim
@@ -1,4 +1,4 @@
-# Test ambigious symbols

+# Test ambiguous symbols

 

 import mambsys1, mambsys2

 

diff --git a/tests/tclosure.nim b/tests/tclosure.nim
index 7242c4892..399f68463 100644
--- a/tests/tclosure.nim
+++ b/tests/tclosure.nim
@@ -1,25 +1,26 @@
 # Test the closure implementation
 
 proc map(n: var openarray[int], fn: proc (x: int): int {.closure}) =
-  for i in 0..n.len-1:
-    n[i] = fn(n[i])
+  for i in 0..n.len-1: n[i] = fn(n[i])
 
 proc foldr(n: openarray[int], fn: proc (x, y: int): int {.closure}): int =
-  result = 0
   for i in 0..n.len-1:
     result = fn(result, n[i])
 
 var
-  myData: array[0..9, int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+  myData: array[0..4, int] = [0, 1, 2, 3, 4]
 
 proc testA() =
   var p = 0
   map(myData, lambda (x: int): int =
                 result = x + 1 shl (lambda (y: int): int =
-                  return y + 1
+                  return y + p
                 )(0)
-                inc(p), 88)
+                inc(p))
 
 testA()
 for x in items(myData):
-  echo x
+  write(stout, x)
+#OUT 2 4 6 8 10
+
+
diff --git a/tests/tlibs.nim b/tests/tlibs.nim
index 9c52621aa..e3b6bd4c3 100644
--- a/tests/tlibs.nim
+++ b/tests/tlibs.nim
@@ -3,7 +3,7 @@
 import
   unicode, cgi, terminal, libcurl, web, 
   parsexml, parseopt, parsecfg,
-  osproc, zipfiles,
+  osproc,
   sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf,
   sdl_image, sdl_mixer_nosmpeg,
   cursorfont, xatom, xf86vmode, xkb, xrandr, xshm, xvlib, keysym, xcms, xi,
@@ -12,6 +12,10 @@ import
   cairowin32, cairoxlib,
   odbcsql,
   gl, glut, glu, glx, glext, wingl,
-  zlib, lua, lualib, lauxlib, mysql, sqlite3, python, tcl
+  lua, lualib, lauxlib, mysql, sqlite3, python, tcl
+  
+when defined(linux):
+  import
+    zlib, zipfiles
 
 writeln(stdout, "test compilation of binding modules")
diff --git a/tests/tnoop.nim b/tests/tnoop.nim
index 6fe53da1c..d097553e8 100644
--- a/tests/tnoop.nim
+++ b/tests/tnoop.nim
@@ -3,4 +3,4 @@
 var

   a: int

 

-a()  #ERROR_MSG expression cannot be called

+a()  #ERROR_MSG expression 'a()' cannot be called

diff --git a/tools/niminst.nim b/tools/niminst.nim
index 94ae1b041..fc7421b7c 100644
--- a/tools/niminst.nim
+++ b/tools/niminst.nim
@@ -281,9 +281,9 @@ proc buildDir(os, cpu: int): string =
 
 proc writeFile(filename, content: string) =  
   var f: TFile
-  if openFile(f, filename, fmWrite):
+  if open(f, filename, fmWrite):
     writeln(f, content)
-    closeFile(f)
+    close(f)
   else:
     quit("Cannot open for writing: " & filename)
 
@@ -296,8 +296,8 @@ proc srcdist(c: var TConfigData) =
       createDir(dir)
       var cmd = ("nimrod compile -f --symbolfiles:off --compileonly " &
                  "--gen_mapping " &
-                 " --os:$2 --cpu:$3 $1 $4") %
-                 [c.nimrodArgs, c.oses[osA-1], c.cpus[cpuA-1],
+                 " --os:$# --cpu:$# $# $#") %
+                 [c.oses[osA-1], c.cpus[cpuA-1], c.nimrodArgs, 
                  changeFileExt(c.infile, "nim")]
       echo("Executing: " & cmd)
       if executeShellCommand(cmd) != 0:
@@ -327,14 +327,13 @@ proc srcdist(c: var TConfigData) =
 # --------------------- generate inno setup -----------------------------------
 proc setupDist(c: var TConfigData) =
   var scrpt = GenerateInnoSetup(c)
-  var n = "build" / "install_$1_$2.iss" % [toLower(c.name), c.version]
+  var n = "build" / "install_$#_$#.iss" % [toLower(c.name), c.version]
   writeFile(n, scrpt)
   when defined(windows):
     if c.innoSetup.path.len == 0:
       c.innoSetup.path = "iscc.exe"
     var outcmd = if c.outdir.len == 0: "build" else: c.outdir
-    var cmd = "$1 $2 /O$3 $4" % [c.innoSetup.path, c.innoSetup.flags,
-                                 outcmd, n]
+    var cmd = "$# $# /O$# $#" % [c.innoSetup.path, c.innoSetup.flags, outcmd, n]
     Echo("Executing: " & cmd)
     if executeShellCommand(cmd) == 0:
       removeFile(n)
@@ -350,7 +349,7 @@ when haveZipLib:
       writeFile(deinstallShFile, GenerateDeinstallScript(c))
     
     var proj = toLower(c.name)
-    var n = "$1_$2.zip" % [proj, c.version]
+    var n = "$#_$#.zip" % [proj, c.version]
     if c.outdir.len == 0: n = "build" / n
     else: n = c.outdir / n
     var z: TZipArchive
diff --git a/tools/nimweb.nim b/tools/nimweb.nim
index 63f13ea25..8feec2913 100644
--- a/tools/nimweb.nim
+++ b/tools/nimweb.nim
@@ -156,11 +156,11 @@ proc Exec(cmd: string) =
 proc buildDoc(c: var TConfigData, destPath: string) =
   # call nim for the documentation:
   for d in items(c.doc):
-    Exec("nimrod rst2html $1 -o:$2 --index=$3/theindex $4" %
+    Exec("nimrod rst2html $# -o:$# --index=$#/theindex $#" %
       [c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"),
        destpath, d])
   for d in items(c.srcdoc):
-    Exec("nimrod doc $1 -o:$2 --index=$3/theindex $4" %
+    Exec("nimrod doc $# -o:$# --index=$#/theindex $#" %
       [c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"),
        destpath, d])
   Exec("nimrod rst2html $1 -o:$2/theindex.html $2/theindex" %
@@ -169,7 +169,7 @@ proc buildDoc(c: var TConfigData, destPath: string) =
 proc buildAddDoc(c: var TConfigData, destPath: string) =
   # build additional documentation (without the index):
   for d in items(c.webdoc):
-    Exec("nimrod doc $1 -o:$2 $3" %
+    Exec("nimrod doc $# -o:$# $#" %
       [c.nimrodArgs, destPath / changeFileExt(extractFileTrunk(d), "html"), d])
 
 proc main(c: var TConfigData) =
@@ -188,10 +188,10 @@ proc main(c: var TConfigData) =
     var content = readFile(temp)
     if isNil(content): quit("[Error] cannot open: " & temp)
     var f: TFile
-    var outfile = "web/upload/$1.html" % file
-    if openFile(f, outfile, fmWrite):
+    var outfile = "web/upload/$#.html" % file
+    if open(f, outfile, fmWrite):
       writeln(f, generateHTMLPage(c, file, content))
-      closeFile(f)
+      close(f)
     else:
       quit("[Error] cannot write file: " & outfile)
     removeFile(temp)