From 300430fbba28b408f7ac86ca46b03d9d50839399 Mon Sep 17 00:00:00 2001
From: Andreas Rumpf
Date: Wed, 24 Jun 2009 17:13:22 +0200
Subject: [PATCH] overload resolution for proc vars
---
data/ast.yml | 7 +-
data/keywords.txt | 4 +-
data/messages.yml | 38 +-
doc/grammar.txt | 6 +-
doc/manual.txt | 98 +-
doc/theindex.txt | 76 +-
doc/tut1.txt | 17 +-
doc/tut2.txt | 13 +-
install.txt | 4 +-
koch.py | 4 +-
lib/posix/posix.nim | 3675 ++++++++++++++++++++-------------------
lib/pure/macros.nim | 42 +-
lib/pure/os.nim | 22 +-
lib/pure/osproc.nim | 6 +-
lib/pure/regexprs.nim | 22 +
lib/pure/streams.nim | 4 +-
lib/pure/strutils.nim | 68 +-
lib/system.nim | 70 +-
lib/system/ansi_c.nim | 7 +-
lib/system/arithm.nim | 6 +-
lib/system/debugger.nim | 6 +-
lib/system/sysio.nim | 20 +-
lib/wrappers/mysql.nim | 4 +-
nim/ast.pas | 110 +-
nim/ccgexprs.pas | 29 +-
nim/docgen.pas | 18 +-
nim/evals.pas | 132 +-
nim/importer.pas | 4 +-
nim/lookups.pas | 48 +-
nim/msgs.pas | 62 +-
nim/nimsets.pas | 5 +-
nim/pasparse.pas | 13 +-
nim/pnimsyn.pas | 23 +-
nim/pragmas.pas | 13 +-
nim/rnimsyn.pas | 23 +-
nim/ropes.pas | 5 +-
nim/scanner.pas | 16 +-
nim/sem.pas | 11 +-
nim/semdata.pas | 4 +-
nim/semexprs.pas | 162 +-
nim/semstmts.pas | 41 +-
nim/semtempl.pas | 57 +-
nim/sigmatch.pas | 72 +-
nim/strutils.pas | 11 +-
nim/transf.pas | 22 +-
nim/types.pas | 10 -
nim/wordrecg.pas | 20 +-
pycompab.py | 10 +-
tests/tambsym.nim | 4 +-
tests/tambsym3.nim | 4 +-
tests/tambsys.nim | 2 +-
tests/tclosure.nim | 15 +-
tests/tlibs.nim | 8 +-
tests/tnoop.nim | 2 +-
tools/niminst.nim | 15 +-
tools/nimweb.nim | 12 +-
56 files changed, 2772 insertions(+), 2430 deletions(-)
diff --git a/data/ast.yml b/data/ast.yml
index 82776a8f94..cedc039a0a 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 d6cba0635c..5d20e8aebd 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 5cbfe60a78..83f591e0f7 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 91ce6a9114..8c39663874 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 8b7e264add..1c7eb01b78 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 b5650e1bea..81bcf9c679 100644
--- a/doc/theindex.txt
+++ b/doc/theindex.txt
@@ -154,6 +154,9 @@ Index
* `system.html#313 `_
* `system.html#314 `_
+ `<=`:idx:
+ `times.html#115 `_
+
`<=`:idx:
* `system.html#253 `_
* `system.html#254 `_
@@ -169,9 +172,6 @@ Index
* `system.html#345 `_
* `system.html#346 `_
- `<=`:idx:
- `times.html#115 `_
-
`<=%`:idx:
* `system.html#305 `_
* `system.html#306 `_
@@ -201,7 +201,7 @@ Index
* `macros.html#117 `_
`=~`:idx:
- `regexprs.html#111 `_
+ `regexprs.html#108 `_
`>`:idx:
`system.html#357 `_
@@ -218,18 +218,18 @@ Index
`@`:idx:
`system.html#365 `_
- `[]`:idx:
- `strtabs.html#107 `_
-
`[]`:idx:
`macros.html#113 `_
- `[]=`:idx:
- `macros.html#114 `_
+ `[]`:idx:
+ `strtabs.html#107 `_
`[]=`:idx:
`strtabs.html#106 `_
+ `[]=`:idx:
+ `macros.html#114 `_
+
`[ESC]`:idx:
`manual.html#134 `_
@@ -366,8 +366,7 @@ Index
`xmlgen.html#111 `_
`backslash`:idx:
- * `manual.html#127 `_
- * `regexprs.html#101 `_
+ `manual.html#127 `_
`backspace`:idx:
`manual.html#132 `_
@@ -1228,7 +1227,7 @@ Index
`system.html#156 `_
`EInvalidRegEx`:idx:
- `regexprs.html#104 `_
+ `regexprs.html#101 `_
`EInvalidValue`:idx:
`system.html#148 `_
@@ -1265,12 +1264,12 @@ Index
`enum_cursor_type`:idx:
`mysql.html#237 `_
- `Enumeration`:idx:
- `manual.html#148 `_
-
`enumeration`:idx:
`tut1.html#113 `_
+ `Enumeration`:idx:
+ `manual.html#148 `_
+
`enum_field_types`:idx:
`mysql.html#202 `_
@@ -1546,8 +1545,8 @@ Index
* `strutils.html#124 `_
* `strutils.html#125 `_
* `strutils.html#126 `_
- * `regexprs.html#109 `_
- * `regexprs.html#110 `_
+ * `regexprs.html#106 `_
+ * `regexprs.html#107 `_
`findChars`:idx:
`strutils.html#123 `_
@@ -1631,9 +1630,6 @@ Index
* `system.html#478 `_
* `system.html#479 `_
- `generic character types`:idx:
- `regexprs.html#102 `_
-
`Generics`:idx:
* `manual.html#207 `_
* `tut2.html#108 `_
@@ -2258,11 +2254,11 @@ Index
`xmlgen.html#150 `_
`match`:idx:
- * `regexprs.html#106 `_
- * `regexprs.html#107 `_
+ * `regexprs.html#103 `_
+ * `regexprs.html#104 `_
`matchLen`:idx:
- `regexprs.html#108 `_
+ `regexprs.html#105 `_
`math`:idx:
`nimrodc.html#118 `_
@@ -2301,7 +2297,7 @@ Index
`mysql.html#191 `_
`MaxSubpatterns`:idx:
- `regexprs.html#105 `_
+ `regexprs.html#102 `_
`MAX_TINYINT_WIDTH`:idx:
`mysql.html#190 `_
@@ -3095,12 +3091,12 @@ Index
`ord`:idx:
`system.html#172 `_
- `ordinal`:idx:
- `tut1.html#114 `_
-
`Ordinal`:idx:
`system.html#114 `_
+ `ordinal`:idx:
+ `tut1.html#114 `_
+
`Ordinal types`:idx:
`manual.html#141 `_
@@ -3623,16 +3619,16 @@ Index
`system.html#419 `_
`reBinary`:idx:
- `regexprs.html#116 `_
+ `regexprs.html#113 `_
`Recursive module dependancies`:idx:
`manual.html#216 `_
`reEmail`:idx:
- `regexprs.html#119 `_
+ `regexprs.html#116 `_
`reFloat`:idx:
- `regexprs.html#118 `_
+ `regexprs.html#115 `_
`REFRESH_DES_KEY_FILE`:idx:
`mysql.html#154 `_
@@ -3680,13 +3676,13 @@ Index
`nimrodc.html#112 `_
`reHex`:idx:
- `regexprs.html#115 `_
-
- `reIdentifier`:idx:
`regexprs.html#112 `_
+ `reIdentifier`:idx:
+ `regexprs.html#109 `_
+
`reInteger`:idx:
- `regexprs.html#114 `_
+ `regexprs.html#111 `_
`removeDir`:idx:
`os.html#150 `_
@@ -3695,10 +3691,10 @@ Index
`os.html#141 `_
`reNatural`:idx:
- `regexprs.html#113 `_
+ `regexprs.html#110 `_
`reOctal`:idx:
- `regexprs.html#117 `_
+ `regexprs.html#114 `_
`repeatChar`:idx:
`strutils.html#148 `_
@@ -3724,7 +3720,7 @@ Index
`manual.html#189 `_
`reURL`:idx:
- `regexprs.html#120 `_
+ `regexprs.html#117 `_
`round`:idx:
`math.html#121 `_
@@ -3889,9 +3885,6 @@ Index
* `system.html#226 `_
* `system.html#227 `_
- `simple assertions`:idx:
- `regexprs.html#103 `_
-
`simple statements`:idx:
`manual.html#174 `_
@@ -5154,6 +5147,9 @@ Index
* `manual.html#156 `_
* `tut2.html#103 `_
+ `verbose`:idx:
+ `regexprs.html#118 `_
+
`vertical tabulator`:idx:
`manual.html#126 `_
diff --git a/doc/tut1.txt b/doc/tut1.txt
index 237663cdcd..bf744b885a 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 bb0949659e..df6cc1b51e 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 `_ module.
diff --git a/install.txt b/install.txt
index 520b399350..d06236e246 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 364a71d8a5..593ee4984c 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 42cbbba75c..5c8103b9a1 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 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 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.
- C_ISSOCK = 0c140000 ## Socket.
+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.
+ 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: "", final, pure.} = object
+ ## A type representing a directory stream.
-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: "", final, pure.} = object
- ## A type representing a directory stream.
-
Tdirent* {.importc: "struct dirent",
- header: "", final, pure.} = object ## dirent_t struct
- d_ino*: TIno ## File serial number.
- d_name*: array [0..255, char] ## Name of entry.
-
+ header: "", 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: "".} = 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: "", 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: "", 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: "", final, pure.} = object
- base*: cint
- level*: cint
-
+ header: "".} = 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: "", 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: "", 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: "", final, pure.} = object
+ base*: cint
+ level*: cint
+
TGlob* {.importc: "glob_t", header: "",
- 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: "",
- 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: "", final, pure.} =
- object ## Identifies the conversion from one codeset to another.
-
- Tlconv* {.importc: "struct lconv", header: "", 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: "", 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: "", final, pure.} =
+ object ## Identifies the conversion from one codeset to another.
+
+ Tlconv* {.importc: "struct lconv", header: "", 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: "", final, pure.} = object
TMqAttr* {.importc: "struct mq_attr",
header: "",
- 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: "",
- 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: "".} = int
- ## used for file block counts
- Tblksize* {.importc: "blksize_t", header: "".} = int
- ## used for block sizes
- TClock* {.importc: "clock_t", header: "".} = int
- TClockId* {.importc: "clockid_t", header: "".} = int
- TDev* {.importc: "dev_t", header: "".} = int
- Tfsblkcnt* {.importc: "fsblkcnt_t", header: "".} = int
- Tfsfilcnt* {.importc: "fsfilcnt_t", header: "".} = int
- TGid* {.importc: "gid_t", header: "".} = int
- Tid* {.importc: "id_t", header: "".} = int
- Tino* {.importc: "ino_t", header: "".} = int
- TKey* {.importc: "key_t", header: "".} = int
- TMode* {.importc: "mode_t", header: "".} = int
- TNlink* {.importc: "nlink_t", header: "".} = int
- TOff* {.importc: "off_t", header: "".} = int64
- TPid* {.importc: "pid_t", header: "".} = int
- Tpthread_attr* {.importc: "pthread_attr_t", header: "".} = 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: "".} = int
+ ## used for file block counts
+ Tblksize* {.importc: "blksize_t", header: "".} = int
+ ## used for block sizes
+ TClock* {.importc: "clock_t", header: "".} = int
+ TClockId* {.importc: "clockid_t", header: "".} = int
+ TDev* {.importc: "dev_t", header: "".} = int
+ Tfsblkcnt* {.importc: "fsblkcnt_t", header: "".} = int
+ Tfsfilcnt* {.importc: "fsfilcnt_t", header: "".} = int
+ TGid* {.importc: "gid_t", header: "".} = int
+ Tid* {.importc: "id_t", header: "".} = int
+ Tino* {.importc: "ino_t", header: "".} = int
+ TKey* {.importc: "key_t", header: "".} = int
+ TMode* {.importc: "mode_t", header: "".} = int
+ TNlink* {.importc: "nlink_t", header: "".} = int
+ TOff* {.importc: "off_t", header: "".} = int64
+ TPid* {.importc: "pid_t", header: "".} = int
+ Tpthread_attr* {.importc: "pthread_attr_t", header: "".} = int
Tpthread_barrier* {.importc: "pthread_barrier_t",
- header: "".} = int
+ header: "".} = int
Tpthread_barrierattr* {.importc: "pthread_barrierattr_t",
- header: "".} = int
- Tpthread_cond* {.importc: "pthread_cond_t", header: "".} = int
+ header: "".} = int
+ Tpthread_cond* {.importc: "pthread_cond_t", header: "".} = int
Tpthread_condattr* {.importc: "pthread_condattr_t",
- header: "".} = int
- Tpthread_key* {.importc: "pthread_key_t", header: "".} = int
- Tpthread_mutex* {.importc: "pthread_mutex_t", header: "".} = int
+ header: "".} = int
+ Tpthread_key* {.importc: "pthread_key_t", header: "".} = int
+ Tpthread_mutex* {.importc: "pthread_mutex_t", header: "".} = int
Tpthread_mutexattr* {.importc: "pthread_mutexattr_t",
- header: "".} = int
- Tpthread_once* {.importc: "pthread_once_t", header: "".} = int
- Tpthread_rwlock* {.importc: "pthread_rwlock_t", header: "".} = int
+ header: "".} = int
+ Tpthread_once* {.importc: "pthread_once_t", header: "".} = int
+ Tpthread_rwlock* {.importc: "pthread_rwlock_t", header: "".} = int
Tpthread_rwlockattr* {.importc: "pthread_rwlockattr_t",
- header: "".} = int
+ header: "".} = int
Tpthread_spinlock* {.importc: "pthread_spinlock_t",
- header: "".} = int
- Tpthread* {.importc: "pthread_t", header: "".} = int
- Tsuseconds* {.importc: "suseconds_t", header: "".} = int
- #Ttime* {.importc: "time_t", header: "".} = int
- Ttimer* {.importc: "timer_t", header: "".} = int
- Ttrace_attr* {.importc: "trace_attr_t", header: "".} = int
+ header: "".} = int
+ Tpthread* {.importc: "pthread_t", header: "".} = int
+ Tsuseconds* {.importc: "suseconds_t", header: "".} = int
+ #Ttime* {.importc: "time_t", header: "".} = int
+ Ttimer* {.importc: "timer_t", header: "".} = int
+ Ttrace_attr* {.importc: "trace_attr_t", header: "".} = int
Ttrace_event_id* {.importc: "trace_event_id_t",
- header: "".} = int
+ header: "".} = int
Ttrace_event_set* {.importc: "trace_event_set_t",
- header: "".} = int
- Ttrace_id* {.importc: "trace_id_t", header: "".} = int
- Tuid* {.importc: "uid_t", header: "".} = int
- Tuseconds* {.importc: "useconds_t", header: "".} = int
-
+ header: "".} = int
+ Ttrace_id* {.importc: "trace_id_t", header: "".} = int
+ Tuid* {.importc: "uid_t", header: "".} = int
+ Tuseconds* {.importc: "useconds_t", header: "".} = int
+
Tutsname* {.importc: "struct utsname",
header: "",
- 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: "", 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: "", final, pure.} = object
Tipc_perm* {.importc: "struct ipc_perm",
- header: "", 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: "", 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: "", 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: "", 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: "",
- 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: "", 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: "", final, pure.} = object
+ posix_tmi_length*: int
+
Ttm* {.importc: "struct tm", header: "",
- 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: "", final, pure.} = object ## struct timespec
- tv_sec*: Ttime ## Seconds.
- tv_nsec*: int ## Nanoseconds.
+ header: "", final, pure.} = object ## struct timespec
+ tv_sec*: Ttime ## Seconds.
+ tv_nsec*: int ## Nanoseconds.
titimerspec* {.importc: "struct itimerspec", header: "",
- final, pure.} = object ## struct itimerspec
- it_interval*: ttimespec ## Timer period.
- it_value*: ttimespec ## Timer expiration.
-
- Tsig_atomic* {.importc: "sig_atomic_t", header: "".} = 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: "", 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: "".} = 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: "", final, pure.} = object
+
TsigEvent* {.importc: "struct sigevent",
- header: "", 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: "", 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: "", final, pure.} = object ## struct sigval
- sival_ptr*: pointer ## pointer signal value;
- ## integer signal value not defined!
+ header: "", final, pure.} = object ## struct sigval
+ sival_ptr*: pointer ## pointer signal value;
+ ## integer signal value not defined!
TSigaction* {.importc: "struct sigaction",
- header: "", 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: "", 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: "", final, pure.} = object ## stack_t
- ss_sp*: pointer ## Stack base or pointer.
- ss_size*: int ## Stack size.
- ss_flags*: cint ## Flags.
-
+ header: "", 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: "", final, pure.} = object ## struct sigstack
- ss_onstack*: cint ## Non-zero when signal stack is in use.
- ss_sp*: pointer ## Signal stack pointer.
-
+ header: "", 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: "", 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 .
- 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: "".} = cint
- Tnl_catd* {.importc: "nl_catd", header: "".} = cint
-
+ header: "", 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 .
+ 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: "".} = cint
+ Tnl_catd* {.importc: "nl_catd", header: "".} = cint
+
Tsched_param* {.importc: "struct sched_param",
header: "",
- 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: "",
- 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: "",
- final, pure.} = object
+ final, pure.} = object
Tmcontext* {.importc: "mcontext_t", header: "",
- final, pure.} = object
+ final, pure.} = object
Tucontext* {.importc: "ucontext_t", header: "",
- 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: "",
- 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: "".} = cint
+ header: "".} = cint
Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t",
- header: "".} = cint
-
+ header: "".} = cint
+
type
TSocklen* {.importc: "socklen_t", header: "".} = cint
TSa_Family* {.importc: "sa_family_t", header: "".} = cint
@@ -541,911 +541,911 @@ type
Tnfds* {.importc: "nfds_t", header: "".} = cint
var
- errno* {.importc, header: "".}: cint ## error variable
- daylight* {.importc, header: "".}: cint
- timezone* {.importc, header: "".}: int
-
-# Constants as variables:
-when hasAioH:
- var
- AIO_ALLDONE* {.importc, header: "".}: cint
- ## A return value indicating that none of the requested operations
- ## could be canceled since they are already complete.
- AIO_CANCELED* {.importc, header: "".}: cint
- ## A return value indicating that all requested operations have
- ## been canceled.
- AIO_NOTCANCELED* {.importc, header: "".}: cint
- ## A return value indicating that some of the requested operations could
- ## not be canceled since they are in progress.
- LIO_NOP* {.importc, header: "".}: cint
- ## A lio_listio() element operation option indicating that no transfer is
- ## requested.
- LIO_NOWAIT* {.importc, header: "".}: 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: "".}: cint
- ## A lio_listio() element operation option requesting a read.
- LIO_WAIT* {.importc, header: "".}: 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: "".}: cint
- ## A lio_listio() element operation option requesting a write.
-
-var
- RTLD_LAZY* {.importc, header: "".}: cint
- ## Relocations are performed at an implementation-defined time.
- RTLD_NOW* {.importc, header: "".}: cint
- ## Relocations are performed when the object is loaded.
- RTLD_GLOBAL* {.importc, header: "".}: cint
- ## All symbols are available for relocation processing of other modules.
- RTLD_LOCAL* {.importc, header: "".}: cint
- ## All symbols are not made available for relocation processing by
- ## other modules.
-
- E2BIG* {.importc, header: "".}: cint
- ## Argument list too long.
- EACCES* {.importc, header: "".}: cint
- ## Permission denied.
- EADDRINUSE* {.importc, header: "".}: cint
- ## Address in use.
- EADDRNOTAVAIL* {.importc, header: "".}: cint
- ## Address not available.
- EAFNOSUPPORT* {.importc, header: "".}: cint
- ## Address family not supported.
- EAGAIN* {.importc, header: "".}: cint
- ## Resource unavailable, try again (may be the same value as [EWOULDBLOCK]).
- EALREADY* {.importc, header: "".}: cint
- ## Connection already in progress.
- EBADF* {.importc, header: "".}: cint
- ## Bad file descriptor.
- EBADMSG* {.importc, header: "".}: cint
- ## Bad message.
- EBUSY* {.importc, header: "".}: cint
- ## Device or resource busy.
- ECANCELED* {.importc, header: "".}: cint
- ## Operation canceled.
- ECHILD* {.importc, header: "".}: cint
- ## No child processes.
- ECONNABORTED* {.importc, header: "".}: cint
- ## Connection aborted.
- ECONNREFUSED* {.importc, header: "".}: cint
- ## Connection refused.
- ECONNRESET* {.importc, header: "".}: cint
- ## Connection reset.
- EDEADLK* {.importc, header: "".}: cint
- ## Resource deadlock would occur.
- EDESTADDRREQ* {.importc, header: "".}: cint
- ## Destination address required.
- EDOM* {.importc, header: "".}: cint
- ## Mathematics argument out of domain of function.
- EDQUOT* {.importc, header: "".}: cint
- ## Reserved.
- EEXIST* {.importc, header: "".}: cint
- ## File exists.
- EFAULT* {.importc, header: "".}: cint
- ## Bad address.
- EFBIG* {.importc, header: "".}: cint
- ## File too large.
- EHOSTUNREACH* {.importc, header: "".}: cint
- ## Host is unreachable.
- EIDRM* {.importc, header: "".}: cint
- ## Identifier removed.
- EILSEQ* {.importc, header: "".}: cint
- ## Illegal byte sequence.
- EINPROGRESS* {.importc, header: "".}: cint
- ## Operation in progress.
- EINTR* {.importc, header: "".}: cint
- ## Interrupted function.
- EINVAL* {.importc, header: "".}: cint
- ## Invalid argument.
- EIO* {.importc, header: "".}: cint
- ## I/O error.
- EISCONN* {.importc, header: "".}: cint
- ## Socket is connected.
- EISDIR* {.importc, header: "".}: cint
- ## Is a directory.
- ELOOP* {.importc, header: "".}: cint
- ## Too many levels of symbolic links.
- EMFILE* {.importc, header: "".}: cint
- ## Too many open files.
- EMLINK* {.importc, header: "".}: cint
- ## Too many links.
- EMSGSIZE* {.importc, header: "".}: cint
- ## Message too large.
- EMULTIHOP* {.importc, header: "".}: cint
- ## Reserved.
- ENAMETOOLONG* {.importc, header: "".}: cint
- ## Filename too long.
- ENETDOWN* {.importc, header: "".}: cint
- ## Network is down.
- ENETRESET* {.importc, header: "".}: cint
- ## Connection aborted by network.
- ENETUNREACH* {.importc, header: "".}: cint
- ## Network unreachable.
- ENFILE* {.importc, header: "".}: cint
- ## Too many files open in system.
- ENOBUFS* {.importc, header: "".}: cint
- ## No buffer space available.
- ENODATA* {.importc, header: "".}: cint
- ## No message is available on the STREAM head read queue.
- ENODEV* {.importc, header: "".}: cint
- ## No such device.
- ENOENT* {.importc, header: "".}: cint
- ## No such file or directory.
- ENOEXEC* {.importc, header: "".}: cint
- ## Executable file format error.
- ENOLCK* {.importc, header: "".}: cint
- ## No locks available.
- ENOLINK* {.importc, header: "".}: cint
- ## Reserved.
- ENOMEM* {.importc, header: "".}: cint
- ## Not enough space.
- ENOMSG* {.importc, header: "".}: cint
- ## No message of the desired type.
- ENOPROTOOPT* {.importc, header: "".}: cint
- ## Protocol not available.
- ENOSPC* {.importc, header: "".}: cint
- ## No space left on device.
- ENOSR* {.importc, header: "".}: cint
- ## No STREAM resources.
- ENOSTR* {.importc, header: "".}: cint
- ## Not a STREAM.
- ENOSYS* {.importc, header: "".}: cint
- ## Function not supported.
- ENOTCONN* {.importc, header: "".}: cint
- ## The socket is not connected.
- ENOTDIR* {.importc, header: "".}: cint
- ## Not a directory.
- ENOTEMPTY* {.importc, header: "".}: cint
- ## Directory not empty.
- ENOTSOCK* {.importc, header: "".}: cint
- ## Not a socket.
- ENOTSUP* {.importc, header: "".}: cint
- ## Not supported.
- ENOTTY* {.importc, header: "".}: cint
- ## Inappropriate I/O control operation.
- ENXIO* {.importc, header: "".}: cint
- ## No such device or address.
- EOPNOTSUPP* {.importc, header: "".}: cint
- ## Operation not supported on socket.
- EOVERFLOW* {.importc, header: "".}: cint
- ## Value too large to be stored in data type.
- EPERM* {.importc, header: "".}: cint
- ## Operation not permitted.
- EPIPE* {.importc, header: "".}: cint
- ## Broken pipe.
- EPROTO* {.importc, header: "".}: cint
- ## Protocol error.
- EPROTONOSUPPORT* {.importc, header: "".}: cint
- ## Protocol not supported.
- EPROTOTYPE* {.importc, header: "".}: cint
- ## Protocol wrong type for socket.
- ERANGE* {.importc, header: "".}: cint
- ## Result too large.
- EROFS* {.importc, header: "".}: cint
- ## Read-only file system.
- ESPIPE* {.importc, header: "".}: cint
- ## Invalid seek.
- ESRCH* {.importc, header: "".}: cint
- ## No such process.
- ESTALE* {.importc, header: "".}: cint
- ## Reserved.
- ETIME* {.importc, header: "".}: cint
- ## Stream ioctl() timeout.
- ETIMEDOUT* {.importc, header: "".}: cint
- ## Connection timed out.
- ETXTBSY* {.importc, header: "".}: cint
- ## Text file busy.
- EWOULDBLOCK* {.importc, header: "".}: cint
- ## Operation would block (may be the same value as [EAGAIN]).
- EXDEV* {.importc, header: "".}: cint
- ## Cross-device link.
-
- F_DUPFD* {.importc, header: "".}: cint
- ## Duplicate file descriptor.
- F_GETFD* {.importc, header: "".}: cint
- ## Get file descriptor flags.
- F_SETFD* {.importc, header: "".}: cint
- ## Set file descriptor flags.
- F_GETFL* {.importc, header: "".}: cint
- ## Get file status flags and file access modes.
- F_SETFL* {.importc, header: "".}: cint
- ## Set file status flags.
- F_GETLK* {.importc, header: "".}: cint
- ## Get record locking information.
- F_SETLK* {.importc, header: "".}: cint
- ## Set record locking information.
- F_SETLKW* {.importc, header: "".}: cint
- ## Set record locking information; wait if blocked.
- F_GETOWN* {.importc, header: "".}: cint
- ## Get process or process group ID to receive SIGURG signals.
- F_SETOWN* {.importc, header: "".}: cint
- ## Set process or process group ID to receive SIGURG signals.
- FD_CLOEXEC* {.importc, header: "".}: cint
- ## Close the file descriptor upon execution of an exec family function.
- F_RDLCK* {.importc, header: "".}: cint
- ## Shared or read lock.
- F_UNLCK* {.importc, header: "".}: cint
- ## Unlock.
- F_WRLCK* {.importc, header: "".}: cint
- ## Exclusive or write lock.
- O_CREAT* {.importc, header: "