Fix typos

This commit is contained in:
Federico Ceratto 2015-02-15 16:20:32 +00:00
commit 657dca5c3b
81 changed files with 126 additions and 126 deletions

View file

@ -395,7 +395,7 @@ proc localVarDecl(p: BProc; s: PSym): PRope =
proc assignLocalVar(p: BProc, s: PSym) = proc assignLocalVar(p: BProc, s: PSym) =
#assert(s.loc.k == locNone) # not yet assigned #assert(s.loc.k == locNone) # not yet assigned
# this need not be fullfilled for inline procs; they are regenerated # this need not be fulfilled for inline procs; they are regenerated
# for each module that uses them! # for each module that uses them!
let decl = localVarDecl(p, s).con(";" & tnl) let decl = localVarDecl(p, s).con(";" & tnl)
line(p, cpsLocals, decl) line(p, cpsLocals, decl)

View file

@ -272,7 +272,7 @@ proc complexName(k: TSymKind, n: PNode, baseName: string): string =
## type)?(,param type)*``. The callable type part will be added only if the ## type)?(,param type)*``. The callable type part will be added only if the
## node is not a proc, as those are the common ones. The suffix will be a dot ## node is not a proc, as those are the common ones. The suffix will be a dot
## and a single letter representing the type of the callable. The parameter ## and a single letter representing the type of the callable. The parameter
## types will be added with a preceeding dash. Return types won't be added. ## types will be added with a preceding dash. Return types won't be added.
## ##
## If you modify the output of this proc, please update the anchor generation ## If you modify the output of this proc, please update the anchor generation
## section of ``doc/docgen.txt``. ## section of ``doc/docgen.txt``.

View file

@ -999,7 +999,7 @@ proc liftForLoop*(body: PNode): PNode =
# proc invoke(iter: iterator(): int) = # proc invoke(iter: iterator(): int) =
# for x in iter(): echo x # for x in iter(): echo x
# #
# --> When to create the closure? --> for the (count) occurence! # --> When to create the closure? --> for the (count) occurrence!
discard """ discard """
for i in foo(): ... for i in foo(): ...

View file

@ -107,7 +107,7 @@ type
TToken* = object # a Nim token TToken* = object # a Nim token
tokType*: TTokType # the type of the token tokType*: TTokType # the type of the token
indent*: int # the indentation; != -1 if the token has been indent*: int # the indentation; != -1 if the token has been
# preceeded with indentation # preceded with indentation
ident*: PIdent # the parsed identifier ident*: PIdent # the parsed identifier
iNumber*: BiggestInt # the parsed integer literal iNumber*: BiggestInt # the parsed integer literal
fNumber*: BiggestFloat # the parsed floating point literal fNumber*: BiggestFloat # the parsed floating point literal
@ -679,7 +679,7 @@ proc getOperator(L: var TLexer, tok: var TToken) =
inc(pos) inc(pos)
endOperator(L, tok, pos, h) endOperator(L, tok, pos, h)
# advance pos but don't store it in L.bufpos so the next token (which might # advance pos but don't store it in L.bufpos so the next token (which might
# be an operator too) gets the preceeding spaces: # be an operator too) gets the preceding spaces:
tok.strongSpaceB = 0 tok.strongSpaceB = 0
while buf[pos] == ' ': while buf[pos] == ' ':
inc pos inc pos

View file

@ -359,7 +359,7 @@ const
errCannotInferReturnType: "cannot infer the return type of the proc", errCannotInferReturnType: "cannot infer the return type of the proc",
errGenericLambdaNotAllowed: "A nested proc can have generic parameters only when " & errGenericLambdaNotAllowed: "A nested proc can have generic parameters only when " &
"it is used as an operand to another routine and the types " & "it is used as an operand to another routine and the types " &
"of the generic paramers can be infered from the expected signature.", "of the generic paramers can be inferred from the expected signature.",
errCompilerDoesntSupportTarget: "The current compiler \'$1\' doesn't support the requested compilation target", errCompilerDoesntSupportTarget: "The current compiler \'$1\' doesn't support the requested compilation target",
errUser: "$1", errUser: "$1",
warnCannotOpenFile: "cannot open \'$1\' [CannotOpenFile]", warnCannotOpenFile: "cannot open \'$1\' [CannotOpenFile]",

View file

@ -33,7 +33,7 @@ proc `<.`(a, b: string): bool =
while true: while true:
let ii = parseInt(a, verA, i) let ii = parseInt(a, verA, i)
let jj = parseInt(b, verB, j) let jj = parseInt(b, verB, j)
# if A has no number left, but B has, B is prefered: 0.8 vs 0.8.3 # if A has no number left, but B has, B is preferred: 0.8 vs 0.8.3
if ii <= 0 or jj <= 0: return jj > 0 if ii <= 0 or jj <= 0: return jj > 0
if verA < verB: return true if verA < verB: return true
elif verA > verB: return false elif verA > verB: return false

View file

@ -275,7 +275,7 @@ proc applyRule*(c: PContext, s: PSym, n: PNode): PNode =
if arg != rs and aliases.isPartOf(rs, arg) == arYes: if arg != rs and aliases.isPartOf(rs, arg) == arYes:
ok = true ok = true
break break
# constraint not fullfilled: # constraint not fulfilled:
if not ok: return nil if not ok: return nil
of aqNoAlias: of aqNoAlias:
# it MUST not alias with any other param: # it MUST not alias with any other param:
@ -284,7 +284,7 @@ proc applyRule*(c: PContext, s: PSym, n: PNode): PNode =
if arg != rs and aliases.isPartOf(rs, arg) != arNo: if arg != rs and aliases.isPartOf(rs, arg) != arNo:
ok = false ok = false
break break
# constraint not fullfilled: # constraint not fulfilled:
if not ok: return nil if not ok: return nil
markUsed(n.info, s) markUsed(n.info, s)

View file

@ -200,7 +200,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) =
return return
# we need no surrounding [] here because the type is in a line of its own # we need no surrounding [] here because the type is in a line of its own
if t.kind == tyForward: internalError("encodeType: tyForward") if t.kind == tyForward: internalError("encodeType: tyForward")
# for the new rodfile viewer we use a preceeding [ so that the data section # for the new rodfile viewer we use a preceding [ so that the data section
# can easily be disambiguated: # can easily be disambiguated:
add(result, '[') add(result, '[')
encodeVInt(ord(t.kind), result) encodeVInt(ord(t.kind), result)

View file

@ -52,7 +52,7 @@
# Note that the left and right pointers are not needed for leaves. # Note that the left and right pointers are not needed for leaves.
# Leaves have relatively high memory overhead (~30 bytes on a 32 # Leaves have relatively high memory overhead (~30 bytes on a 32
# bit machines) and we produce many of them. This is why we cache and # bit machines) and we produce many of them. This is why we cache and
# share leaves accross different rope trees. # share leaves across different rope trees.
# To cache them they are inserted in a `cache` array. # To cache them they are inserted in a `cache` array.
import import

View file

@ -264,7 +264,7 @@ proc inferWithMetatype(c: PContext, formal: PType,
instGenericConvertersArg(c, result, m) instGenericConvertersArg(c, result, m)
if result != nil: if result != nil:
# This almost exactly replicates the steps taken by the compiler during # This almost exactly replicates the steps taken by the compiler during
# param matching. It performs an embarassing ammount of back-and-forth # param matching. It performs an embarrassing amount of back-and-forth
# type jugling, but it's the price to pay for consistency and correctness # type jugling, but it's the price to pay for consistency and correctness
result.typ = generateTypeInstance(c, m.bindings, arg.info, result.typ = generateTypeInstance(c, m.bindings, arg.info,
formal.skipTypes({tyCompositeTypeClass})) formal.skipTypes({tyCompositeTypeClass}))

View file

@ -1917,7 +1917,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
it.sons[0] = newSymNode(f) it.sons[0] = newSymNode(f)
e = fitNode(c, f.typ, e) e = fitNode(c, f.typ, e)
# small hack here in a nkObjConstr the ``nkExprColonExpr`` node can have # small hack here in a nkObjConstr the ``nkExprColonExpr`` node can have
# 3 childen the last being the field check # 3 children the last being the field check
if check != nil: if check != nil:
check.sons[0] = it.sons[0] check.sons[0] = it.sons[0]
it.add(check) it.add(check)

View file

@ -369,7 +369,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
typ = def.typ typ = def.typ
else: else:
# BUGFIX: ``fitNode`` is needed here! # BUGFIX: ``fitNode`` is needed here!
# check type compability between def.typ and typ # check type compatibility between def.typ and typ
def = fitNode(c, typ, def) def = fitNode(c, typ, def)
#changeType(def.skipConv, typ, check=true) #changeType(def.skipConv, typ, check=true)
else: else:

View file

@ -494,7 +494,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
semParamList(c, n.sons[paramsPos], gp, s) semParamList(c, n.sons[paramsPos], gp, s)
# a template's parameters are not gensym'ed even if that was originally the # a template's parameters are not gensym'ed even if that was originally the
# case as we determine whether it's a template parameter in the template # case as we determine whether it's a template parameter in the template
# body by the absense of the skGenSym flag: # body by the absence of the skGenSym flag:
for i in 1 .. s.typ.n.len-1: for i in 1 .. s.typ.n.len-1:
s.typ.n.sons[i].sym.flags.excl sfGenSym s.typ.n.sons[i].sym.flags.excl sfGenSym
if sonsLen(gp) > 0: if sonsLen(gp) > 0:

View file

@ -900,7 +900,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
if hasDefault: if hasDefault:
def = semExprWithType(c, a.sons[length-1]) def = semExprWithType(c, a.sons[length-1])
# check type compability between def.typ and typ: # check type compatibility between def.typ and typ:
if typ == nil: if typ == nil:
typ = def.typ typ = def.typ
elif def != nil: elif def != nil:

View file

@ -649,7 +649,7 @@ proc lengthOrd(t: PType): BiggestInt =
type type
TDistinctCompare* = enum ## how distinct types are to be compared TDistinctCompare* = enum ## how distinct types are to be compared
dcEq, ## a and b should be the same type dcEq, ## a and b should be the same type
dcEqIgnoreDistinct, ## compare symetrically: (distinct a) == b, a == b dcEqIgnoreDistinct, ## compare symmetrically: (distinct a) == b, a == b
## or a == (distinct b) ## or a == (distinct b)
dcEqOrDistinctOf ## a equals b or a is distinct of b dcEqOrDistinctOf ## a equals b or a is distinct of b

View file

@ -1246,7 +1246,7 @@ proc genGlobalInit(c: PCtx; n: PNode; s: PSym) =
c.globals.add(getNullValue(s.typ, n.info)) c.globals.add(getNullValue(s.typ, n.info))
s.position = c.globals.len s.position = c.globals.len
# This is rather hard to support, due to the laziness of the VM code # This is rather hard to support, due to the laziness of the VM code
# generator. See tests/compile/tmacro2 for why this is necesary: # generator. See tests/compile/tmacro2 for why this is necessary:
# var decls{.compileTime.}: seq[PNimrodNode] = @[] # var decls{.compileTime.}: seq[PNimrodNode] = @[]
let dest = c.getTemp(s.typ) let dest = c.getTemp(s.typ)
c.gABx(n, opcLdGlobal, dest, s.position) c.gABx(n, opcLdGlobal, dest, s.position)

View file

@ -24,7 +24,7 @@ doc.section.toc = """
</li> </li>
""" """
# Chunk of HTML emmited for each entry in the HTML table of contents. # Chunk of HTML emitted for each entry in the HTML table of contents.
# Available variables are: # Available variables are:
# * $desc: the actual docstring of the item. # * $desc: the actual docstring of the item.
# * $header: the full version of name, including types, pragmas, tags, etc. # * $header: the full version of name, including types, pragmas, tags, etc.
@ -45,7 +45,7 @@ $seeSrc
</dd> </dd>
""" """
# Chunk of HTML emmited for each entry in the HTML table of contents. # Chunk of HTML emitted for each entry in the HTML table of contents.
# See doc.item for available substitution variables. # See doc.item for available substitution variables.
doc.item.toc = """ doc.item.toc = """
<li><a class="reference" href="#$itemSymOrID" <li><a class="reference" href="#$itemSymOrID"

View file

@ -225,7 +225,7 @@ The JavaScript target doesn't have any further interfacing considerations
since it also has garbage collection, but the C targets require you to since it also has garbage collection, but the C targets require you to
initialize Nim's internals, which is done calling a ``NimMain`` function. initialize Nim's internals, which is done calling a ``NimMain`` function.
Also, C code requires you to specify a forward declaration for functions or Also, C code requires you to specify a forward declaration for functions or
the compiler will asume certain types for the return value and parameters the compiler will assume certain types for the return value and parameters
which will likely make your program crash at runtime. which will likely make your program crash at runtime.
The Nim compiler can generate a C interface header through the ``--header`` The Nim compiler can generate a C interface header through the ``--header``
@ -427,7 +427,7 @@ Custom data types
----------------- -----------------
Just like strings, custom data types that are to be shared between Nim and Just like strings, custom data types that are to be shared between Nim and
the backend will need careful consideration of who controlls who. If you want the backend will need careful consideration of who controls who. If you want
to hand a Nim reference to C code, you will need to use `GC_ref to hand a Nim reference to C code, you will need to use `GC_ref
<system.html#GC_ref>`_ to mark the reference as used, so it does not get <system.html#GC_ref>`_ to mark the reference as used, so it does not get
freed. And for the C backend you will need to expose the `GC_unref freed. And for the C backend you will need to expose the `GC_unref

View file

@ -163,7 +163,7 @@ running/debugged user project.
Compiler as a service (CAAS) Compiler as a service (CAAS)
============================ ============================
The ocasional use of idetools is acceptable for things like The occasional use of idetools is acceptable for things like
definitions, where the user puts the cursor on a symbol or double definitions, where the user puts the cursor on a symbol or double
clicks it and after a second or two the IDE displays where that clicks it and after a second or two the IDE displays where that
symbol is defined. Such latencies would be terrible for features symbol is defined. Such latencies would be terrible for features
@ -533,10 +533,10 @@ run it manually. First you have to compile the tester::
Running the ``caasdriver`` without parameters will attempt to process Running the ``caasdriver`` without parameters will attempt to process
all the test cases in all three operation modes. If a test succeeds all the test cases in all three operation modes. If a test succeeds
nothing will be printed and the process will exit with zero. If any nothing will be printed and the process will exit with zero. If any
test fails, the specific line of the test preceeding the failure test fails, the specific line of the test preceding the failure
and the failure itself will be dumped to stdout, along with a final and the failure itself will be dumped to stdout, along with a final
indicator of the success state and operation mode. You can pass the indicator of the success state and operation mode. You can pass the
parameter ``verbose`` to force all output even on successfull tests. parameter ``verbose`` to force all output even on successful tests.
The normal operation mode is called ``ProcRun`` and it involves The normal operation mode is called ``ProcRun`` and it involves
starting a process for each command or query, similar to running starting a process for each command or query, similar to running

View file

@ -370,7 +370,7 @@ needed as the data structures needs to be rebuilt periodically anyway.
Complete traversal is done in this way:: Complete traversal is done in this way::
for each page decriptor d: for each page descriptor d:
for each bit in d: for each bit in d:
if bit == 1: if bit == 1:
traverse the pointer belonging to this bit traverse the pointer belonging to this bit
@ -406,7 +406,7 @@ The generated code looks roughly like this:
setRef(&r->left) setRef(&r->left)
} }
Note that for systems with a continous stack (which most systems have) Note that for systems with a continuous stack (which most systems have)
the check whether the ref is on the stack is very cheap (only two the check whether the ref is on the stack is very cheap (only two
comparisons). comparisons).

View file

@ -370,7 +370,7 @@ Miscellaneous
------------- -------------
* `events <events.html>`_ * `events <events.html>`_
This module implements an event system that is not dependant on external This module implements an event system that is not dependent on external
graphical toolkits. graphical toolkits.
* `oids <oids.html>`_ * `oids <oids.html>`_

View file

@ -25,9 +25,9 @@ with ``'``. An example::
ifStmt = 'if' expr ':' stmts ('elif' expr ':' stmts)* ('else' stmts)? ifStmt = 'if' expr ':' stmts ('elif' expr ':' stmts)* ('else' stmts)?
The binary ``^*`` operator is used as a shorthand for 0 or more occurances The binary ``^*`` operator is used as a shorthand for 0 or more occurrences
separated by its second argument; likewise ``^+`` means 1 or more separated by its second argument; likewise ``^+`` means 1 or more
occurances: ``a ^+ b`` is short for ``a (b a)*`` occurrences: ``a ^+ b`` is short for ``a (b a)*``
and ``a ^* b`` is short for ``(a (b a)*)?``. Example:: and ``a ^* b`` is short for ``(a (b a)*)?``. Example::
arrayConstructor = '[' expr ^* ',' ']' arrayConstructor = '[' expr ^* ',' ']'

View file

@ -59,7 +59,7 @@ Precedence level Operators First charact
Strong spaces Strong spaces
------------- -------------
The number of spaces preceeding a non-keyword operator affects precedence The number of spaces preceding a non-keyword operator affects precedence
if the experimental parser directive ``#!strongSpaces`` is used. Indentation if the experimental parser directive ``#!strongSpaces`` is used. Indentation
is not used to determine the number of spaces. If 2 or more operators have the is not used to determine the number of spaces. If 2 or more operators have the
same number of preceding spaces the precedence table applies, so ``1 + 3 * 4`` same number of preceding spaces the precedence table applies, so ``1 + 3 * 4``

View file

@ -1142,7 +1142,7 @@ modules like `db_sqlite <db_sqlite.html>`_.
Void type Void type
--------- ---------
The ``void`` type denotes the absense of any type. Parameters of The ``void`` type denotes the absence of any type. Parameters of
type ``void`` are treated as non-existent, ``void`` as a return type means that type ``void`` are treated as non-existent, ``void`` as a return type means that
the procedure does not return a value: the procedure does not return a value:

View file

@ -134,7 +134,7 @@ found an ambiguity error is produced.
``nim dump`` shows the contents of the PATH. ``nim dump`` shows the contents of the PATH.
However before the PATH is used the current directory is checked for the However before the PATH is used the current directory is checked for the
file's existance. So if PATH contains ``$lib`` and ``$lib/bar`` and the file's existence. So if PATH contains ``$lib`` and ``$lib/bar`` and the
directory structure looks like this:: directory structure looks like this::
$lib/x.nim $lib/x.nim

View file

@ -25,9 +25,9 @@ Compile nimgrep with the command::
And copy the executable somewhere in your ``$PATH``. And copy the executable somewhere in your ``$PATH``.
Command line switches Command line switches
===================== =====================
Usage: Usage:
nimgrep [options] [pattern] [replacement] (file/directory)* nimgrep [options] [pattern] [replacement] (file/directory)*
Options: Options:
@ -37,7 +37,7 @@ Options:
--re pattern is a regular expression (default); extended --re pattern is a regular expression (default); extended
syntax for the regular expression is always turned on syntax for the regular expression is always turned on
--recursive process directories recursively --recursive process directories recursively
--confirm confirm each occurence/replacement; there is a chance --confirm confirm each occurrence/replacement; there is a chance
to abort any time without touching the file to abort any time without touching the file
--stdin read pattern from stdin (to avoid the shell's confusing --stdin read pattern from stdin (to avoid the shell's confusing
quoting rules) quoting rules)

View file

@ -37,7 +37,7 @@ Object Oriented Programming
While Nim's support for object oriented programming (OOP) is minimalistic, While Nim's support for object oriented programming (OOP) is minimalistic,
powerful OOP techniques can be used. OOP is seen as *one* way to design a powerful OOP techniques can be used. OOP is seen as *one* way to design a
program, not *the only* way. Often a procedural approach leads to simpler program, not *the only* way. Often a procedural approach leads to simpler
and more efficient code. In particular, prefering composition over inheritance and more efficient code. In particular, preferring composition over inheritance
is often the better design. is often the better design.
@ -142,7 +142,7 @@ An example:
.. code-block:: nim .. code-block:: nim
# This is an example how an abstract syntax tree could be modeled in Nim # This is an example how an abstract syntax tree could be modelled in Nim
type type
NodeKind = enum # the different node types NodeKind = enum # the different node types
nkInt, # a leaf with an integer value nkInt, # a leaf with an integer value
@ -335,7 +335,7 @@ As the example demonstrates, invocation of a multi-method cannot be ambiguous:
Collide 2 is preferred over collide 1 because the resolution works from left to Collide 2 is preferred over collide 1 because the resolution works from left to
right. Thus ``Unit, Thing`` is preferred over ``Thing, Unit``. right. Thus ``Unit, Thing`` is preferred over ``Thing, Unit``.
**Perfomance note**: Nim does not produce a virtual method table, but **Performance note**: Nim does not produce a virtual method table, but
generates dispatch trees. This avoids the expensive indirect branch for method generates dispatch trees. This avoids the expensive indirect branch for method
calls and enables inlining. However, other optimizations like compile time calls and enables inlining. However, other optimizations like compile time
evaluation or dead code elimination do not work with methods. evaluation or dead code elimination do not work with methods.

View file

@ -10,7 +10,7 @@ just declared as a native method which will be resolved at runtime. The scripts
nimbuild.sh and jnibuild.sh are in charge of building the Nim code and nimbuild.sh and jnibuild.sh are in charge of building the Nim code and
generating the jni bridge from the java code respectively. Finally, the generating the jni bridge from the java code respectively. Finally, the
ndk-build command from the android ndk tools has to be run to build the binary ndk-build command from the android ndk tools has to be run to build the binary
libary which will be installed along the final apk. library which will be installed along the final apk.
All these steps are wrapped in the ant build script through the customization All these steps are wrapped in the ant build script through the customization
of the -post-compile rule. If you have the android ndk tools installed and you of the -post-compile rule. If you have the android ndk tools installed and you

View file

@ -55,7 +55,7 @@
[self.bText resignFirstResponder]; [self.bText resignFirstResponder];
} }
/** Custom loadView method for backwards compatiblity. /** Custom loadView method for backwards compatibility.
* Unfortunately I've been unable to coerce Xcode 4.4 to generate nib files * Unfortunately I've been unable to coerce Xcode 4.4 to generate nib files
* which are compatible with my trusty iOS 3.0 ipod touch so in order to be * which are compatible with my trusty iOS 3.0 ipod touch so in order to be
* fully compatible for all devices we have to build the interface manually in * fully compatible for all devices we have to build the interface manually in

View file

@ -91,7 +91,7 @@ proc update*(todo: var TTodo; conn: TDbConn): bool =
## ##
## Use this method if you (or another entity) have modified the database and ## Use this method if you (or another entity) have modified the database and
## want to update the object you have with whatever the database has stored. ## want to update the object you have with whatever the database has stored.
## Returns true if the update suceeded, or false if the object was not found ## Returns true if the update succeeded, or false if the object was not found
## in the database any more, in which case you should probably get rid of the ## in the database any more, in which case you should probably get rid of the
## TTodo object. ## TTodo object.
assert(todo.id >= 0, "The identifier of the todo entry can't be negative") assert(todo.id >= 0, "The identifier of the todo entry can't be negative")

View file

@ -21,7 +21,7 @@ type
## is performed. Deprecated, do not use anymore! ## is performed. Deprecated, do not use anymore!
AquireEffect* {.deprecated.} = object of LockEffect ## \ AquireEffect* {.deprecated.} = object of LockEffect ## \
## effect that denotes that some lock is ## effect that denotes that some lock is
## aquired. Deprecated, do not use anymore! ## acquired. Deprecated, do not use anymore!
ReleaseEffect* {.deprecated.} = object of LockEffect ## \ ReleaseEffect* {.deprecated.} = object of LockEffect ## \
## effect that denotes that some lock is ## effect that denotes that some lock is
## released. Deprecated, do not use anymore! ## released. Deprecated, do not use anymore!

View file

@ -1145,7 +1145,7 @@ proc formatNamedVars*(frmt: string, varnames: openArray[string],
proc defaultConfig*(): StringTableRef = proc defaultConfig*(): StringTableRef =
## Returns a default configuration for embedded HTML generation. ## Returns a default configuration for embedded HTML generation.
## ##
## The returned ``StringTableRef`` contains the paramters used by the HTML ## The returned ``StringTableRef`` contains the parameters used by the HTML
## engine to build the final output. For information on what these parameters ## engine to build the final output. For information on what these parameters
## are and their purpose, please look up the file ``config/nimdoc.cfg`` ## are and their purpose, please look up the file ``config/nimdoc.cfg``
## bundled with the compiler. ## bundled with the compiler.

View file

@ -606,7 +606,7 @@ when defined(windows) or defined(nimdoc):
retFuture.fail(newException(OSError, osErrorMsg(err))) retFuture.fail(newException(OSError, osErrorMsg(err)))
elif ret == 0 and bytesReceived == 0 and dataBuf.buf[0] == '\0': elif ret == 0 and bytesReceived == 0 and dataBuf.buf[0] == '\0':
# We have to ensure that the buffer is empty because WSARecv will tell # We have to ensure that the buffer is empty because WSARecv will tell
# us immediatelly when it was disconnected, even when there is still # us immediately when it was disconnected, even when there is still
# data in the buffer. # data in the buffer.
# We want to give the user as much data as we can. So we only return # We want to give the user as much data as we can. So we only return
# the empty string (which signals a disconnection) when there is # the empty string (which signals a disconnection) when there is

View file

@ -18,7 +18,7 @@ import strutils
## ##
## Quick start example: ## Quick start example:
## ##
## # Create a matrix wich first rotates, then scales and at last translates ## # Create a matrix which first rotates, then scales and at last translates
## ##
## var m:TMatrix2d=rotate(DEG90) & scale(2.0) & move(100.0,200.0) ## var m:TMatrix2d=rotate(DEG90) & scale(2.0) & move(100.0,200.0)
## ##
@ -256,7 +256,7 @@ proc `$`* (t:TMatrix2d):string {.noInit.} =
proc isUniform*(t:TMatrix2d,tol=1.0e-6):bool= proc isUniform*(t:TMatrix2d,tol=1.0e-6):bool=
## Checks if the transform is uniform, that is ## Checks if the transform is uniform, that is
## perpendicular axes of equal lenght, which means (for example) ## perpendicular axes of equal length, which means (for example)
## it cannot transform a circle into an ellipse. ## it cannot transform a circle into an ellipse.
## `tol` is used as tolerance for both equal length comparison ## `tol` is used as tolerance for both equal length comparison
## and perp. comparison. ## and perp. comparison.
@ -305,7 +305,7 @@ proc equals*(m1:TMatrix2d,m2:TMatrix2d,tol=1.0e-6):bool=
abs(m1.ty-m2.ty)<=tol abs(m1.ty-m2.ty)<=tol
proc `=~`*(m1,m2:TMatrix2d):bool= proc `=~`*(m1,m2:TMatrix2d):bool=
## Checks if `m1`and `m2` is aproximately equal, using a ## Checks if `m1`and `m2` is approximately equal, using a
## tolerance of 1e-6. ## tolerance of 1e-6.
equals(m1,m2) equals(m1,m2)

View file

@ -23,7 +23,7 @@ import times
## ##
## Quick start example: ## Quick start example:
## ##
## # Create a matrix wich first rotates, then scales and at last translates ## # Create a matrix which first rotates, then scales and at last translates
## ##
## var m:TMatrix3d=rotate(PI,vector3d(1,1,2.5)) & scale(2.0) & move(100.0,200.0,300.0) ## var m:TMatrix3d=rotate(PI,vector3d(1,1,2.5)) & scale(2.0) & move(100.0,200.0,300.0)
## ##
@ -320,7 +320,7 @@ proc rotateZ*(angle:float):TMatrix3d {.noInit.}=
proc isUniform*(m:TMatrix3d,tol=1.0e-6):bool= proc isUniform*(m:TMatrix3d,tol=1.0e-6):bool=
## Checks if the transform is uniform, that is ## Checks if the transform is uniform, that is
## perpendicular axes of equal lenght, which means (for example) ## perpendicular axes of equal length, which means (for example)
## it cannot transform a sphere into an ellipsoid. ## it cannot transform a sphere into an ellipsoid.
## `tol` is used as tolerance for both equal length comparison ## `tol` is used as tolerance for both equal length comparison
## and perpendicular comparison. ## and perpendicular comparison.
@ -483,7 +483,7 @@ proc equals*(m1:TMatrix3d,m2:TMatrix3d,tol=1.0e-6):bool=
abs(m1.tw-m2.tw)<=tol abs(m1.tw-m2.tw)<=tol
proc `=~`*(m1,m2:TMatrix3d):bool= proc `=~`*(m1,m2:TMatrix3d):bool=
## Checks if `m1` and `m2` is aproximately equal, using a ## Checks if `m1` and `m2` is approximately equal, using a
## tolerance of 1e-6. ## tolerance of 1e-6.
equals(m1,m2) equals(m1,m2)
@ -788,7 +788,7 @@ proc angleTo*(v1,v2:TVector3d):float=
proc arbitraryAxis*(norm:TVector3d):TMatrix3d {.noInit.}= proc arbitraryAxis*(norm:TVector3d):TMatrix3d {.noInit.}=
## Computes the rotation matrix that would transform ## Computes the rotation matrix that would transform
## world z vector into `norm`. The inverse of this matrix ## world z vector into `norm`. The inverse of this matrix
## is useful to tranform a planar 3d object to 2d space. ## is useful to transform a planar 3d object to 2d space.
## This is the same algorithm used to interpret DXF and DWG files. ## This is the same algorithm used to interpret DXF and DWG files.
const lim=1.0/64.0 const lim=1.0/64.0
var ax,ay,az:TVector3d var ax,ay,az:TVector3d

View file

@ -404,7 +404,7 @@ proc setVal[K,V](table: var PConcTable[K,V], key: int, val: int,
#echo("tomb old slot then set in new table") #echo("tomb old slot then set in new table")
nextTable = copySlotAndCheck(table,idx) nextTable = copySlotAndCheck(table,idx)
return setVal(nextTable, key, val, expVal, match) return setVal(nextTable, key, val, expVal, match)
# Finaly ready to add new val to table # Finally ready to add new val to table
while true: while true:
if match and oldVal != expVal: if match and oldVal != expVal:
#echo("set failed, no match oldVal= " & $oldVal & " expVal= " & $expVal) #echo("set failed, no match oldVal= " & $oldVal & " expVal= " & $expVal)

View file

@ -174,7 +174,7 @@ proc excl*[T](c: var CritBitTree[T], key: string) =
iterator leaves[T](n: Node[T]): Node[T] = iterator leaves[T](n: Node[T]): Node[T] =
if n != nil: if n != nil:
# XXX actually we could compute the necessary stack size in advance: # XXX actually we could compute the necessary stack size in advance:
# it's rougly log2(c.count). # it's roughly log2(c.count).
var stack = @[n] var stack = @[n]
while stack.len > 0: while stack.len > 0:
var it = stack.pop var it = stack.pop

View file

@ -333,7 +333,7 @@ template foldl*(sequence, operation: expr): expr =
## words = @["nim", "is", "cool"] ## words = @["nim", "is", "cool"]
## concatenation = foldl(words, a & b) ## concatenation = foldl(words, a & b)
## assert addition == 25, "Addition is (((5)+9)+11)" ## assert addition == 25, "Addition is (((5)+9)+11)"
## assert subtraction == -15, "Substraction is (((5)-9)-11)" ## assert subtraction == -15, "Subtraction is (((5)-9)-11)"
## assert multiplication == 495, "Multiplication is (((5)*9)*11)" ## assert multiplication == 495, "Multiplication is (((5)*9)*11)"
## assert concatenation == "nimiscool" ## assert concatenation == "nimiscool"
assert sequence.len > 0, "Can't fold empty sequences" assert sequence.len > 0, "Can't fold empty sequences"
@ -369,7 +369,7 @@ template foldr*(sequence, operation: expr): expr =
## words = @["nim", "is", "cool"] ## words = @["nim", "is", "cool"]
## concatenation = foldr(words, a & b) ## concatenation = foldr(words, a & b)
## assert addition == 25, "Addition is (5+(9+(11)))" ## assert addition == 25, "Addition is (5+(9+(11)))"
## assert subtraction == 7, "Substraction is (5-(9-(11)))" ## assert subtraction == 7, "Subtraction is (5-(9-(11)))"
## assert multiplication == 495, "Multiplication is (5*(9*(11)))" ## assert multiplication == 495, "Multiplication is (5*(9*(11)))"
## assert concatenation == "nimiscool" ## assert concatenation == "nimiscool"
assert sequence.len > 0, "Can't fold empty sequences" assert sequence.len > 0, "Can't fold empty sequences"
@ -512,7 +512,7 @@ when isMainModule:
words = @["nim", "is", "cool"] words = @["nim", "is", "cool"]
concatenation = foldl(words, a & b) concatenation = foldl(words, a & b)
assert addition == 25, "Addition is (((5)+9)+11)" assert addition == 25, "Addition is (((5)+9)+11)"
assert subtraction == -15, "Substraction is (((5)-9)-11)" assert subtraction == -15, "Subtraction is (((5)-9)-11)"
assert multiplication == 495, "Multiplication is (((5)*9)*11)" assert multiplication == 495, "Multiplication is (((5)*9)*11)"
assert concatenation == "nimiscool" assert concatenation == "nimiscool"
@ -525,7 +525,7 @@ when isMainModule:
words = @["nim", "is", "cool"] words = @["nim", "is", "cool"]
concatenation = foldr(words, a & b) concatenation = foldr(words, a & b)
assert addition == 25, "Addition is (5+(9+(11)))" assert addition == 25, "Addition is (5+(9+(11)))"
assert subtraction == 7, "Substraction is (5-(9-(11)))" assert subtraction == 7, "Subtraction is (5-(9-(11)))"
assert multiplication == 495, "Multiplication is (5*(9*(11)))" assert multiplication == 495, "Multiplication is (5*(9*(11)))"
assert concatenation == "nimiscool" assert concatenation == "nimiscool"

View file

@ -11,7 +11,7 @@
## (also often named `dictionary`:idx: in other programming languages) that is ## (also often named `dictionary`:idx: in other programming languages) that is
## a mapping from keys to values. ``Table`` is the usual hash table, ## a mapping from keys to values. ``Table`` is the usual hash table,
## ``OrderedTable`` is like ``Table`` but remembers insertion order ## ``OrderedTable`` is like ``Table`` but remembers insertion order
## and ``CountTable`` is a mapping from a key to its number of occurances. ## and ``CountTable`` is a mapping from a key to its number of occurrences.
## For consistency with every other data type in Nim these have **value** ## For consistency with every other data type in Nim these have **value**
## semantics, this means that ``=`` performs a copy of the hash table. ## semantics, this means that ``=`` performs a copy of the hash table.
## For **reference** semantics use the ``Ref`` variant: ``TableRef``, ## For **reference** semantics use the ``Ref`` variant: ``TableRef``,

View file

@ -46,7 +46,7 @@ proc `+`*(a, b: Color): Color =
colorOp(satPlus) colorOp(satPlus)
proc `-`*(a, b: Color): Color = proc `-`*(a, b: Color): Color =
## substracts two colors: This uses saturated artithmetic, so that each color ## subtracts two colors: This uses saturated artithmetic, so that each color
## component cannot overflow (255 is used as a maximum). ## component cannot overflow (255 is used as a maximum).
colorOp(satMinus) colorOp(satMinus)

View file

@ -301,7 +301,7 @@ proc getCurrentEncoding*(): string =
proc open*(destEncoding = "UTF-8", srcEncoding = "CP1252"): EncodingConverter = proc open*(destEncoding = "UTF-8", srcEncoding = "CP1252"): EncodingConverter =
## opens a converter that can convert from `srcEncoding` to `destEncoding`. ## opens a converter that can convert from `srcEncoding` to `destEncoding`.
## Raises `EIO` if it cannot fullfill the request. ## Raises `EIO` if it cannot fulfill the request.
when not defined(windows): when not defined(windows):
result = iconvOpen(destEncoding, srcEncoding) result = iconvOpen(destEncoding, srcEncoding)
if result == nil: if result == nil:

View file

@ -9,7 +9,7 @@
## :Author: Alex Mitchell ## :Author: Alex Mitchell
## ##
## This module implements an event system that is not dependant on external ## This module implements an event system that is not dependent on external
## graphical toolkits. It was originally called ``NimEE`` because ## graphical toolkits. It was originally called ``NimEE`` because
## it was inspired by Python's PyEE module. There are two ways you can use ## it was inspired by Python's PyEE module. There are two ways you can use
## events: one is a python-inspired way; the other is more of a C-style way. ## events: one is a python-inspired way; the other is more of a C-style way.

View file

@ -385,7 +385,7 @@ proc request*(url: string, httpMethod: string, extraHeaders = "",
userAgent = defUserAgent, proxy: Proxy = nil): Response = userAgent = defUserAgent, proxy: Proxy = nil): Response =
## | Requests ``url`` with the custom method string specified by the ## | Requests ``url`` with the custom method string specified by the
## | ``httpMethod`` parameter. ## | ``httpMethod`` parameter.
## | Extra headers can be specified and must be seperated by ``\c\L`` ## | Extra headers can be specified and must be separated by ``\c\L``
## | An optional timeout can be specified in miliseconds, if reading from the ## | An optional timeout can be specified in miliseconds, if reading from the
## server takes longer than specified an ETimeout exception will be raised. ## server takes longer than specified an ETimeout exception will be raised.
var r = if proxy == nil: parseUri(url) else: proxy.url var r = if proxy == nil: parseUri(url) else: proxy.url
@ -436,7 +436,7 @@ proc request*(url: string, httpMethod = httpGET, extraHeaders = "",
body = "", sslContext = defaultSSLContext, timeout = -1, body = "", sslContext = defaultSSLContext, timeout = -1,
userAgent = defUserAgent, proxy: Proxy = nil): Response = userAgent = defUserAgent, proxy: Proxy = nil): Response =
## | Requests ``url`` with the specified ``httpMethod``. ## | Requests ``url`` with the specified ``httpMethod``.
## | Extra headers can be specified and must be seperated by ``\c\L`` ## | Extra headers can be specified and must be separated by ``\c\L``
## | An optional timeout can be specified in miliseconds, if reading from the ## | An optional timeout can be specified in miliseconds, if reading from the
## server takes longer than specified an ETimeout exception will be raised. ## server takes longer than specified an ETimeout exception will be raised.
result = request(url, $httpMethod, extraHeaders, body, sslContext, timeout, result = request(url, $httpMethod, extraHeaders, body, sslContext, timeout,

View file

@ -8,7 +8,7 @@
# #
## This module implements a simple logger. It has been designed to be as simple ## This module implements a simple logger. It has been designed to be as simple
## as possible to avoid bloat, if this library does not fullfill your needs, ## as possible to avoid bloat, if this library does not fulfill your needs,
## write your own. ## write your own.
## ##
## Format strings support the following variables which must be prefixed with ## Format strings support the following variables which must be prefixed with

View file

@ -887,7 +887,7 @@ proc connectAsync(socket: Socket, name: string, port = Port(0),
af: Domain = AF_INET) {.tags: [ReadIOEffect].} = af: Domain = AF_INET) {.tags: [ReadIOEffect].} =
## A variant of ``connect`` for non-blocking sockets. ## A variant of ``connect`` for non-blocking sockets.
## ##
## This procedure will immediatelly return, it will not block until a connection ## This procedure will immediately return, it will not block until a connection
## is made. It is up to the caller to make sure the connection has been established ## is made. It is up to the caller to make sure the connection has been established
## by checking (using ``select``) whether the socket is writeable. ## by checking (using ``select``) whether the socket is writeable.
## ##

View file

@ -1182,7 +1182,7 @@ proc putEnv*(key, val: string) {.tags: [WriteEnvEffect].} =
## If an error occurs, `EInvalidEnvVar` is raised. ## If an error occurs, `EInvalidEnvVar` is raised.
# Note: by storing the string in the environment sequence, # Note: by storing the string in the environment sequence,
# we gurantee that we don't free the memory before the program # we guarantee that we don't free the memory before the program
# ends (this is needed for POSIX compliance). It is also needed so that # ends (this is needed for POSIX compliance). It is also needed so that
# the process itself may access its modified environment variables! # the process itself may access its modified environment variables!
var indx = findEnvVar(key) var indx = findEnvVar(key)
@ -1454,7 +1454,7 @@ proc createHardlink*(src, dest: string) =
proc parseCmdLine*(c: string): seq[string] {. proc parseCmdLine*(c: string): seq[string] {.
noSideEffect, rtl, extern: "nos$1".} = noSideEffect, rtl, extern: "nos$1".} =
## Splits a command line into several components; ## Splits a command line into several components;
## This proc is only occassionally useful, better use the `parseopt` module. ## This proc is only occasionally useful, better use the `parseopt` module.
## ##
## On Windows, it uses the following parsing rules ## On Windows, it uses the following parsing rules
## (see http://msdn.microsoft.com/en-us/library/17w5ykft.aspx ): ## (see http://msdn.microsoft.com/en-us/library/17w5ykft.aspx ):

View file

@ -60,7 +60,7 @@ proc initOptParser*(cmdline: string): OptParser {.rtl, deprecated.} =
## Initalizes option parses with cmdline. Splits cmdline in on spaces ## Initalizes option parses with cmdline. Splits cmdline in on spaces
## and calls initOptParser(openarray[string]) ## and calls initOptParser(openarray[string])
## Do not use. ## Do not use.
if cmdline == "": # backward compatibilty if cmdline == "": # backward compatibility
return initOptParser(seq[string](nil)) return initOptParser(seq[string](nil))
else: else:
return initOptParser(cmdline.split) return initOptParser(cmdline.split)

View file

@ -181,7 +181,7 @@ proc parseWhile*(s: string, token: var string, validChars: set[char],
token = substr(s, start, i-1) token = substr(s, start, i-1)
proc captureBetween*(s: string, first: char, second = '\0', start = 0): string = proc captureBetween*(s: string, first: char, second = '\0', start = 0): string =
## Finds the first occurence of ``first``, then returns everything from there ## Finds the first occurrence of ``first``, then returns everything from there
## up to ``second``(if ``second`` is '\0', then ``first`` is used). ## up to ``second``(if ``second`` is '\0', then ``first`` is used).
var i = skipUntil(s, first, start)+1+start var i = skipUntil(s, first, start)+1+start
result = "" result = ""

View file

@ -43,7 +43,7 @@ proc isConc(r: Rope): bool {.inline.} = return isNil(r.data)
# Note that the left and right pointers are not needed for leafs. # Note that the left and right pointers are not needed for leafs.
# Leaves have relatively high memory overhead (~30 bytes on a 32 # Leaves have relatively high memory overhead (~30 bytes on a 32
# bit machine) and we produce many of them. This is why we cache and # bit machine) and we produce many of them. This is why we cache and
# share leafs accross different rope trees. # share leafs across different rope trees.
# To cache them they are inserted in another tree, a splay tree for best # To cache them they are inserted in another tree, a splay tree for best
# performance. But for the caching tree we use the leaf's left and right # performance. But for the caching tree we use the leaf's left and right
# pointers. # pointers.

View file

@ -35,7 +35,7 @@ type
when defined(nimdoc): when defined(nimdoc):
type type
Selector* = ref object Selector* = ref object
## An object which holds file descripters to be checked for read/write ## An object which holds file descriptors to be checked for read/write
## status. ## status.
fds: Table[SocketHandle, SelectorKey] fds: Table[SocketHandle, SelectorKey]

View file

@ -851,7 +851,7 @@ proc connectAsync*(socket: Socket, name: string, port = Port(0),
af: Domain = AF_INET) {.tags: [ReadIOEffect].} = af: Domain = AF_INET) {.tags: [ReadIOEffect].} =
## A variant of ``connect`` for non-blocking sockets. ## A variant of ``connect`` for non-blocking sockets.
## ##
## This procedure will immediatelly return, it will not block until a connection ## This procedure will immediately return, it will not block until a connection
## is made. It is up to the caller to make sure the connection has been established ## is made. It is up to the caller to make sure the connection has been established
## by checking (using ``select``) whether the socket is writeable. ## by checking (using ``select``) whether the socket is writeable.
## ##

View file

@ -815,8 +815,8 @@ proc rfind*(s: string, sub: char, start: int = -1): int {.noSideEffect,
proc count*(s: string, sub: string, overlapping: bool = false): int {.noSideEffect, proc count*(s: string, sub: string, overlapping: bool = false): int {.noSideEffect,
rtl, extern: "nsuCountString".} = rtl, extern: "nsuCountString".} =
## Count the occurences of a substring `sub` in the string `s`. ## Count the occurrences of a substring `sub` in the string `s`.
## Overlapping occurences of `sub` only count when `overlapping` ## Overlapping occurrences of `sub` only count when `overlapping`
## is set to true. ## is set to true.
var i = 0 var i = 0
while true: while true:
@ -831,14 +831,14 @@ proc count*(s: string, sub: string, overlapping: bool = false): int {.noSideEffe
proc count*(s: string, sub: char): int {.noSideEffect, proc count*(s: string, sub: char): int {.noSideEffect,
rtl, extern: "nsuCountChar".} = rtl, extern: "nsuCountChar".} =
## Count the occurences of the character `sub` in the string `s`. ## Count the occurrences of the character `sub` in the string `s`.
for c in s: for c in s:
if c == sub: if c == sub:
inc result inc result
proc count*(s: string, subs: set[char]): int {.noSideEffect, proc count*(s: string, subs: set[char]): int {.noSideEffect,
rtl, extern: "nsuCountCharSet".} = rtl, extern: "nsuCountCharSet".} =
## Count the occurences of the group of character `subs` in the string `s`. ## Count the occurrences of the group of character `subs` in the string `s`.
for c in s: for c in s:
if c in subs: if c in subs:
inc result inc result
@ -898,7 +898,7 @@ proc replaceWord*(s, sub: string, by = ""): string {.noSideEffect,
rtl, extern: "nsuReplaceWord".} = rtl, extern: "nsuReplaceWord".} =
## Replaces `sub` in `s` by the string `by`. ## Replaces `sub` in `s` by the string `by`.
## ##
## Each occurance of `sub` has to be surrounded by word boundaries ## Each occurrence of `sub` has to be surrounded by word boundaries
## (comparable to ``\\w`` in regular expressions), otherwise it is not ## (comparable to ``\\w`` in regular expressions), otherwise it is not
## replaced. ## replaced.
const wordChars = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\128'..'\255'} const wordChars = {'a'..'z', 'A'..'Z', '0'..'9', '_', '\128'..'\255'}

View file

@ -642,7 +642,7 @@ proc isEmpty(s: string): bool =
return true return true
proc normalize*(n: PNode) = proc normalize*(n: PNode) =
## Merges all seperated TextNodes together, and removes any empty TextNodes ## Merges all separated TextNodes together, and removes any empty TextNodes
var curTextNode: PNode = nil var curTextNode: PNode = nil
var i: int = 0 var i: int = 0

View file

@ -73,7 +73,7 @@ type
expr* {.magic: Expr.} ## meta type to denote an expression (for templates) expr* {.magic: Expr.} ## meta type to denote an expression (for templates)
stmt* {.magic: Stmt.} ## meta type to denote a statement (for templates) stmt* {.magic: Stmt.} ## meta type to denote a statement (for templates)
typedesc* {.magic: TypeDesc.} ## meta type to denote a type description typedesc* {.magic: TypeDesc.} ## meta type to denote a type description
void* {.magic: "VoidType".} ## meta type to denote the absense of any type void* {.magic: "VoidType".} ## meta type to denote the absence of any type
auto* = expr auto* = expr
any* = distinct auto any* = distinct auto
@ -370,7 +370,7 @@ type
## ##
## See the full `exception hierarchy`_. ## See the full `exception hierarchy`_.
ResourceExhaustedError* = object of SystemError ## \ ResourceExhaustedError* = object of SystemError ## \
## Raised if a resource request could not be fullfilled. ## Raised if a resource request could not be fulfilled.
## ##
## See the full `exception hierarchy`_. ## See the full `exception hierarchy`_.
ArithmeticError* = object of Exception ## \ ArithmeticError* = object of Exception ## \
@ -578,7 +578,7 @@ proc len*(x: cstring): int {.magic: "LengthStr", noSideEffect.}
proc len*[I, T](x: array[I, T]): int {.magic: "LengthArray", noSideEffect.} proc len*[I, T](x: array[I, T]): int {.magic: "LengthArray", noSideEffect.}
proc len*[T](x: seq[T]): int {.magic: "LengthSeq", noSideEffect.} proc len*[T](x: seq[T]): int {.magic: "LengthSeq", noSideEffect.}
## returns the length of an array, an openarray, a sequence or a string. ## returns the length of an array, an openarray, a sequence or a string.
## This is rougly the same as ``high(T)-low(T)+1``, but its resulting type is ## This is roughly the same as ``high(T)-low(T)+1``, but its resulting type is
## always an int. ## always an int.
# set routines: # set routines:
@ -865,7 +865,7 @@ proc contains*[T](x: set[T], y: T): bool {.magic: "InSet", noSideEffect.}
## passes its arguments in reverse order. ## passes its arguments in reverse order.
proc contains*[T](s: Slice[T], value: T): bool {.noSideEffect, inline.} = proc contains*[T](s: Slice[T], value: T): bool {.noSideEffect, inline.} =
## Checks if `value` is withing the range of `s`; returns true iff ## Checks if `value` is within the range of `s`; returns true iff
## `value >= s.a and value <= s.b` ## `value >= s.a and value <= s.b`
## ##
## .. code-block:: Nim ## .. code-block:: Nim

View file

@ -15,7 +15,7 @@ proc raiseOverflow {.compilerproc, noinline, noreturn.} =
sysFatal(OverflowError, "over- or underflow") sysFatal(OverflowError, "over- or underflow")
proc raiseDivByZero {.compilerproc, noinline, noreturn.} = proc raiseDivByZero {.compilerproc, noinline, noreturn.} =
sysFatal(DivByZeroError, "divison by zero") sysFatal(DivByZeroError, "division by zero")
proc addInt64(a, b: int64): int64 {.compilerProc, inline.} = proc addInt64(a, b: int64): int64 {.compilerProc, inline.} =
result = a +% b result = a +% b

View file

@ -13,7 +13,7 @@ proc addChar(s: NimString, c: char): NimString {.compilerProc, benign.}
type type
TLibHandle = pointer # private type TLibHandle = pointer # private type
TProcAddr = pointer # libary loading and loading of procs: TProcAddr = pointer # library loading and loading of procs:
proc nimLoadLibrary(path: string): TLibHandle {.compilerproc.} proc nimLoadLibrary(path: string): TLibHandle {.compilerproc.}
proc nimUnloadLibrary(lib: TLibHandle) {.compilerproc.} proc nimUnloadLibrary(lib: TLibHandle) {.compilerproc.}

View file

@ -8,7 +8,7 @@
# #
# This file implements the ability to call native procs from libraries. # This file implements the ability to call native procs from libraries.
# It is not possible to do this in a platform independant way, unfortunately. # It is not possible to do this in a platform independent way, unfortunately.
# However, the interface has been designed to take platform differences into # However, the interface has been designed to take platform differences into
# account and been ported to all major platforms. # account and been ported to all major platforms.

View file

@ -884,7 +884,7 @@ elif stackIncreases:
var var
jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int
# a little hack to get the size of a TJmpBuf in the generated C code # a little hack to get the size of a TJmpBuf in the generated C code
# in a platform independant way # in a platform independent way
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} = template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
var registers: C_JmpBuf var registers: C_JmpBuf

View file

@ -1067,7 +1067,7 @@ proc stackSize(): int {.noinline.} =
var var
jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int
# a little hack to get the size of a TJmpBuf in the generated C code # a little hack to get the size of a TJmpBuf in the generated C code
# in a platform independant way # in a platform independent way
when defined(sparc): # For SPARC architecture. when defined(sparc): # For SPARC architecture.
proc isOnStack(p: pointer): bool = proc isOnStack(p: pointer): bool =
@ -1263,7 +1263,7 @@ proc unmarkStackAndRegisters(gch: var TGcHeap) =
# XXX no need for an atomic dec here: # XXX no need for an atomic dec here:
if c.refcount--(LocalHeap): if c.refcount--(LocalHeap):
# the object survived only because of a stack reference # the object survived only because of a stack reference
# it still doesn't have heap refernces # it still doesn't have heap references
addZCT(gch.zct, c) addZCT(gch.zct, c)
if canbeCycleRoot(c): if canbeCycleRoot(c):

View file

@ -476,7 +476,7 @@ elif stackIncreases:
var var
jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int jmpbufSize {.importc: "sizeof(jmp_buf)", nodecl.}: int
# a little hack to get the size of a TJmpBuf in the generated C code # a little hack to get the size of a TJmpBuf in the generated C code
# in a platform independant way # in a platform independent way
proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} = proc markStackAndRegisters(gch: var TGcHeap) {.noinline, cdecl.} =
var registers: C_JmpBuf var registers: C_JmpBuf

View file

@ -128,7 +128,7 @@ proc raiseOverflow {.exportc: "raiseOverflow", noreturn.} =
raise newException(OverflowError, "over- or underflow") raise newException(OverflowError, "over- or underflow")
proc raiseDivByZero {.exportc: "raiseDivByZero", noreturn.} = proc raiseDivByZero {.exportc: "raiseDivByZero", noreturn.} =
raise newException(DivByZeroError, "divison by zero") raise newException(DivByZeroError, "division by zero")
proc raiseRangeError() {.compilerproc, noreturn.} = proc raiseRangeError() {.compilerproc, noreturn.} =
raise newException(RangeError, "value out of range") raise newException(RangeError, "value out of range")

View file

@ -132,7 +132,7 @@ proc rawFileSize(file: File): int =
discard fseek(file, clong(oldPos), 0) discard fseek(file, clong(oldPos), 0)
proc readAllFile(file: File, len: int): string = proc readAllFile(file: File, len: int): string =
# We aquire the filesize beforehand and hope it doesn't change. # We acquire the filesize beforehand and hope it doesn't change.
# Speeds things up. # Speeds things up.
result = newString(int(len)) result = newString(int(len))
if readBuffer(file, addr(result[0]), int(len)) != len: if readBuffer(file, addr(result[0]), int(len)) != len:

View file

@ -222,9 +222,9 @@ proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
extGetCellType(result).base, waZctDecRef) extGetCellType(result).base, waZctDecRef)
# XXX: zeroing out the memory can still result in crashes if a wiped-out # XXX: zeroing out the memory can still result in crashes if a wiped-out
# cell is aliased by another pointer (ie proc paramter or a let variable). # cell is aliased by another pointer (ie proc parameter or a let variable).
# This is a tought problem, because even if we don't zeroMem here, in the # This is a tought problem, because even if we don't zeroMem here, in the
# presense of user defined destructors, the user will expect the cell to be # presence of user defined destructors, the user will expect the cell to be
# "destroyed" thus creating the same problem. We can destoy the cell in the # "destroyed" thus creating the same problem. We can destoy the cell in the
# finalizer of the sequence, but this makes destruction non-deterministic. # finalizer of the sequence, but this makes destruction non-deterministic.
zeroMem(cast[pointer](cast[ByteAddress](result) +% GenericSeqSize +% zeroMem(cast[pointer](cast[ByteAddress](result) +% GenericSeqSize +%

View file

@ -63,9 +63,9 @@ type
const const
SCRAMBLE_LENGTH* = 20 # Length of random string sent by server on handshake; SCRAMBLE_LENGTH* = 20 # Length of random string sent by server on handshake;
# this is also length of obfuscated password, # this is also length of obfuscated password,
# recieved from client # received from client
SCRAMBLE_LENGTH_323* = 8 # length of password stored in the db: SCRAMBLE_LENGTH_323* = 8 # length of password stored in the db:
# new passwords are preceeded with '*' # new passwords are preceded with '*'
SCRAMBLED_PASSWORD_CHAR_LENGTH* = SCRAMBLE_LENGTH * 2 + 1 SCRAMBLED_PASSWORD_CHAR_LENGTH* = SCRAMBLE_LENGTH * 2 + 1
SCRAMBLED_PASSWORD_CHAR_LENGTH_323* = SCRAMBLE_LENGTH_323 * 2 SCRAMBLED_PASSWORD_CHAR_LENGTH_323* = SCRAMBLE_LENGTH_323 * 2
NOT_NULL_FLAG* = 1 # Field can't be NULL NOT_NULL_FLAG* = 1 # Field can't be NULL
@ -146,7 +146,7 @@ const
MAX_MEDIUMINT_WIDTH* = 8 # Max width for a INT24 w.o. sign MAX_MEDIUMINT_WIDTH* = 8 # Max width for a INT24 w.o. sign
MAX_INT_WIDTH* = 10 # Max width for a LONG w.o. sign MAX_INT_WIDTH* = 10 # Max width for a LONG w.o. sign
MAX_BIGINT_WIDTH* = 20 # Max width for a LONGLONG MAX_BIGINT_WIDTH* = 20 # Max width for a LONGLONG
MAX_CHAR_WIDTH* = 255 # Max length for a CHAR colum MAX_CHAR_WIDTH* = 255 # Max length for a CHAR column
MAX_BLOB_WIDTH* = 8192 # Default width for blob MAX_BLOB_WIDTH* = 8192 # Default width for blob
type type
@ -558,7 +558,7 @@ type
Tstatus* = enum Tstatus* = enum
STATUS_READY, STATUS_GET_RESULT, STATUS_USE_RESULT STATUS_READY, STATUS_GET_RESULT, STATUS_USE_RESULT
Tprotocol_type* = enum # There are three types of queries - the ones that have to go to Tprotocol_type* = enum # There are three types of queries - the ones that have to go to
# the master, the ones that go to a slave, and the adminstrative # the master, the ones that go to a slave, and the administrative
# type which must happen on the pivot connectioin # type which must happen on the pivot connectioin
PROTOCOL_DEFAULT, PROTOCOL_TCP, PROTOCOL_SOCKET, PROTOCOL_PIPE, PROTOCOL_DEFAULT, PROTOCOL_TCP, PROTOCOL_SOCKET, PROTOCOL_PIPE,
PROTOCOL_MEMORY PROTOCOL_MEMORY

View file

@ -89,7 +89,7 @@
# As most games will need it. # As most games will need it.
# #
# April 02 2001 - DL : Added SDL_getenv.h definitions and tested version # April 02 2001 - DL : Added SDL_getenv.h definitions and tested version
# 1.2.0 compatability. # 1.2.0 compatibility.
# #
# March 13 2001 - MT : Added Linux compatibility. # March 13 2001 - MT : Added Linux compatibility.
# #
@ -118,7 +118,7 @@
# #
# November 30 2001 - DL : SDL_NOFRAME added as pointed out by Simon Rushton. # November 30 2001 - DL : SDL_NOFRAME added as pointed out by Simon Rushton.
# #
# December 11 2001 - DL : Added $WEAKPACKAGEUNIT ON to facilitate useage in # December 11 2001 - DL : Added $WEAKPACKAGEUNIT ON to facilitate usage in
# Components # Components
# #
# January 05 2002 - DL : Added SDL_Swap32 function as suggested by Matthias # January 05 2002 - DL : Added SDL_Swap32 function as suggested by Matthias
@ -209,7 +209,7 @@
# forgot to apply Michalis Kamburelis' patch to the implementation section. now fixed # forgot to apply Michalis Kamburelis' patch to the implementation section. now fixed
# #
# Revision 1.14 2004/12/23 23:42:18 savage # Revision 1.14 2004/12/23 23:42:18 savage
# Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatability. # Applied Patches supplied by Michalis Kamburelis ( THANKS! ), for greater FreePascal compatibility.
# #
# Revision 1.13 2004/09/30 22:31:59 savage # Revision 1.13 2004/09/30 22:31:59 savage
# Updated with slightly different header comments # Updated with slightly different header comments
@ -221,7 +221,7 @@
# Updated so that Library name defines are correctly defined for MacOS X. # Updated so that Library name defines are correctly defined for MacOS X.
# #
# Revision 1.10 2004/07/20 23:57:33 savage # Revision 1.10 2004/07/20 23:57:33 savage
# Thanks to Paul Toth for spotting an error in the SDL Audio Convertion structures. # Thanks to Paul Toth for spotting an error in the SDL Audio Conversion structures.
# In TSDL_AudioCVT the filters variable should point to and array of pointers and not what I had there previously. # In TSDL_AudioCVT the filters variable should point to and array of pointers and not what I had there previously.
# #
# Revision 1.9 2004/07/03 22:07:22 savage # Revision 1.9 2004/07/03 22:07:22 savage
@ -243,7 +243,7 @@
# SDL_GetEnv Fix so that it is not define twice for FPC. Thanks to Rene Hugentobler for pointing out this bug, # SDL_GetEnv Fix so that it is not define twice for FPC. Thanks to Rene Hugentobler for pointing out this bug,
# #
# Revision 1.3 2004/02/18 22:35:51 savage # Revision 1.3 2004/02/18 22:35:51 savage
# Brought sdl.pas up to 1.2.7 compatability # Brought sdl.pas up to 1.2.7 compatibility
# Thus... # Thus...
# Added SDL_GL_STEREO, # Added SDL_GL_STEREO,
# SDL_GL_MULTISAMPLEBUFFERS, # SDL_GL_MULTISAMPLEBUFFERS,

View file

@ -136,7 +136,7 @@
# Windows unit not used in this file, so it was removed to keep the code tidy. # Windows unit not used in this file, so it was removed to keep the code tidy.
# #
# Revision 1.3 2004/03/31 10:05:08 savage # Revision 1.3 2004/03/31 10:05:08 savage
# Better defines for Endianess under FreePascal and Borland compilers. # Better defines for Endianness under FreePascal and Borland compilers.
# #
# Revision 1.2 2004/03/30 20:23:28 savage # Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive. # Tidied up use of UNIX compiler directive.

View file

@ -6,7 +6,7 @@ def\tskType\tsystem.string\tstring
> idetools --track:$TESTNIM,12,35 --def $SILENT > idetools --track:$TESTNIM,12,35 --def $SILENT
def\tskLet\t$MODULE.failtest.input\tTaintedString def\tskLet\t$MODULE.failtest.input\tTaintedString
# The following fail because they seem shifted one colum to the right. # The following fail because they seem shifted one column to the right.
> idetools --track:$TESTNIM,12,16 --def $SILENT > idetools --track:$TESTNIM,12,16 --def $SILENT
def\tskTemplate\tsequtils.toSeq\tproc \(expr\): expr def\tskTemplate\tsequtils.toSeq\tproc \(expr\): expr
> idetools --track:$TESTNIM,12,22 --def $SILENT > idetools --track:$TESTNIM,12,22 --def $SILENT

View file

@ -2,7 +2,7 @@ import unicode, sequtils
# This example shows that idetools returns proc as signature for everything # This example shows that idetools returns proc as signature for everything
# which can be called. While a clever person would use the second column to # which can be called. While a clever person would use the second column to
# differentiate betwen procs, methods and others, why does the output contain # differentiate between procs, methods and others, why does the output contain
# incorrect information? # incorrect information?
type type

View file

@ -1506,7 +1506,7 @@ void gen_opf(int op)
case TOK_UGE: case TOK_UGE:
case TOK_ULE: case TOK_ULE:
case TOK_UGT: case TOK_UGT:
error("unsigned comparision on floats?"); error("unsigned comparison on floats?");
break; break;
case TOK_LT: case TOK_LT:
op=TOK_Nset; op=TOK_Nset;

View file

@ -235,7 +235,7 @@ void gsym(int t)
} }
// these are regs that tcc doesn't really know about, // these are regs that tcc doesn't really know about,
// but asign them unique values so the mapping routines // but assign them unique values so the mapping routines
// can distinquish them // can distinquish them
#define C67_A0 105 #define C67_A0 105

View file

@ -1105,7 +1105,7 @@ static void subst_asm_operand(CString *add_str,
} }
} }
/* generate prolog and epilog code for asm statment */ /* generate prolog and epilog code for asm statement */
static void asm_gen_code(ASMOperand *operands, int nb_operands, static void asm_gen_code(ASMOperand *operands, int nb_operands,
int nb_outputs, int is_output, int nb_outputs, int is_output,
uint8_t *clobber_regs, uint8_t *clobber_regs,

View file

@ -628,7 +628,7 @@ int __bound_delete_region(void *p)
} }
/* return the size of the region starting at p, or EMPTY_SIZE if non /* return the size of the region starting at p, or EMPTY_SIZE if non
existant region. */ existent region. */
static unsigned long get_region_size(void *p) static unsigned long get_region_size(void *p)
{ {
unsigned long addr = (unsigned long)p; unsigned long addr = (unsigned long)p;

View file

@ -927,7 +927,7 @@ They can be defined several times in the same source. Use 'b'
</tr></table> </tr></table>
<h2 class="section"> 4.4 Directives </h2> <h2 class="section"> 4.4 Directives </h2>
<p>All directives are preceeded by a '.'. The following directives are <p>All directives are preceded by a '.'. The following directives are
supported: supported:
</p> </p>
<ul class="toc"> <ul class="toc">
@ -1365,7 +1365,7 @@ reverse order, a first pass is done to reverse the argument order.
</tr></table> </tr></table>
<h2 class="section"> 8.4 Types </h2> <h2 class="section"> 8.4 Types </h2>
<p>The types are stored in a single 'int' variable. It was choosen in the <p>The types are stored in a single 'int' variable. It was chosen in the
first stages of development when tcc was much simpler. Now, it may not first stages of development when tcc was much simpler. Now, it may not
be the best solution. be the best solution.
</p> </p>
@ -1531,7 +1531,7 @@ current position in the code section.
</dd> </dd>
<dt> <code>stab_section</code></dt> <dt> <code>stab_section</code></dt>
<dt> <code>stabstr_section</code></dt> <dt> <code>stabstr_section</code></dt>
<dd><p>are used when debugging is actived to store debug information <dd><p>are used when debugging is activated to store debug information
</p> </p>
</dd> </dd>
<dt> <code>symtab_section</code></dt> <dt> <code>symtab_section</code></dt>

View file

@ -673,7 +673,7 @@ They can be defined several times in the same source. Use 'b'
@cindex asciz directive @cindex asciz directive
@cindex ascii directive @cindex ascii directive
All directives are preceeded by a '.'. The following directives are All directives are preceded by a '.'. The following directives are
supported: supported:
@itemize @itemize
@ -892,7 +892,7 @@ reverse order, a first pass is done to reverse the argument order.
@section Types @section Types
The types are stored in a single 'int' variable. It was choosen in the The types are stored in a single 'int' variable. It was chosen in the
first stages of development when tcc was much simpler. Now, it may not first stages of development when tcc was much simpler. Now, it may not
be the best solution. be the best solution.
@ -1017,7 +1017,7 @@ are used when bound checking is activated
@item stab_section @item stab_section
@itemx stabstr_section @itemx stabstr_section
are used when debugging is actived to store debug information are used when debugging is activated to store debug information
@item symtab_section @item symtab_section
@itemx strtab_section @itemx strtab_section

View file

@ -229,7 +229,7 @@ static inline void asm_expr_sum(TCCState *s1, ExprValue *pe)
} else { } else {
goto cannot_relocate; goto cannot_relocate;
} }
pe->sym = NULL; /* same symbols can be substracted to NULL */ pe->sym = NULL; /* same symbols can be subtracted to NULL */
} else { } else {
cannot_relocate: cannot_relocate:
error("invalid operation with label"); error("invalid operation with label");

View file

@ -4686,7 +4686,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
if (sym->type.t & VT_EXTERN) { if (sym->type.t & VT_EXTERN) {
/* if the variable is extern, it was not allocated */ /* if the variable is extern, it was not allocated */
sym->type.t &= ~VT_EXTERN; sym->type.t &= ~VT_EXTERN;
/* set array size if it was ommited in extern /* set array size if it was omitted in extern
declaration */ declaration */
if ((sym->type.t & VT_ARRAY) && if ((sym->type.t & VT_ARRAY) &&
sym->type.ref->c < 0 && sym->type.ref->c < 0 &&

View file

@ -422,7 +422,7 @@
DEF_FP(mul) DEF_FP(mul)
DEF_ASM(fcom) DEF_ASM(fcom)
DEF_ASM(fcom_1) /* non existant op, just to have a regular table */ DEF_ASM(fcom_1) /* non existent op, just to have a regular table */
DEF_FP1(com) DEF_FP1(com)
DEF_FP(comp) DEF_FP(comp)

View file

@ -50,7 +50,7 @@
#define _O_RANDOM 0x0010 #define _O_RANDOM 0x0010
#define _O_SEQUENTIAL 0x0020 #define _O_SEQUENTIAL 0x0020
#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing. #define _O_TEMPORARY 0x0040 /* Make the file disappear after closing.
* WARNING: Even if not created by _open! */ * WARNING: Even if not created by _open! */
#define _O_NOINHERIT 0x0080 #define _O_NOINHERIT 0x0080

View file

@ -24,7 +24,7 @@ Options:
--re pattern is a regular expression (default); extended --re pattern is a regular expression (default); extended
syntax for the regular expression is always turned on syntax for the regular expression is always turned on
--recursive process directories recursively --recursive process directories recursively
--confirm confirm each occurence/replacement; there is a chance --confirm confirm each occurrence/replacement; there is a chance
to abort any time without touching the file to abort any time without touching the file
--stdin read pattern from stdin (to avoid the shell's confusing --stdin read pattern from stdin (to avoid the shell's confusing
quoting rules) quoting rules)

View file

@ -130,7 +130,7 @@ proc initControls() =
pack_start(MainBox, TopMenu, False, False, 0) pack_start(MainBox, TopMenu, False, False, 0)
# VPaned - Seperates the InputTextView and the OutputTextView # VPaned - Separates the InputTextView and the OutputTextView
var paned = vpaned_new() var paned = vpaned_new()
set_position(paned, 450) set_position(paned, 450)
pack_start(MainBox, paned, True, True, 0) pack_start(MainBox, paned, True, True, 0)

View file

@ -331,7 +331,7 @@ Library Additions
The Nimrod development community is proud to announce the release of version The Nimrod development community is proud to announce the release of version
0.9.4 of the Nimrod compiler and tools. **Note: This release has to be 0.9.4 of the Nimrod compiler and tools. **Note: This release has to be
considered beta quality! Lots of new features have been implemented but considered beta quality! Lots of new features have been implemented but
unfortunately some do not fullfill our quality standards yet.** unfortunately some do not fulfill our quality standards yet.**
Prebuilt binaries and instructions for building from source are available Prebuilt binaries and instructions for building from source are available
on the `download page <download.html>`_. on the `download page <download.html>`_.
@ -756,7 +756,7 @@ Changes affecting backwards compatibility
- The default calling convention for a procedural **type** is now ``closure``, - The default calling convention for a procedural **type** is now ``closure``,
for procs it remains ``nimcall`` (which is compatible to ``closure``). for procs it remains ``nimcall`` (which is compatible to ``closure``).
Activate the warning ``ImplicitClosure`` to make the compiler list the Activate the warning ``ImplicitClosure`` to make the compiler list the
occurances of proc types which are affected. occurrences of proc types which are affected.
- The Nimrod type system now distinguishes ``openarray`` from ``varargs``. - The Nimrod type system now distinguishes ``openarray`` from ``varargs``.
- Templates are now ``hygienic``. Use the ``dirty`` pragma to get the old - Templates are now ``hygienic``. Use the ``dirty`` pragma to get the old
behaviour. behaviour.
@ -884,7 +884,7 @@ Language Additions
------------------ ------------------
- Added new ``is`` and ``of`` operators. - Added new ``is`` and ``of`` operators.
- The built-in type ``void`` can be used to denote the absense of any type. - The built-in type ``void`` can be used to denote the absence of any type.
This is useful in generic code. This is useful in generic code.
- Return types may be of the type ``var T`` to return an l-value. - Return types may be of the type ``var T`` to return an l-value.
- The error pragma can now be used to mark symbols whose *usage* should trigger - The error pragma can now be used to mark symbols whose *usage* should trigger