Nimrod renamed to Nim
This commit is contained in:
parent
d05df2173b
commit
4523b29d7a
23 changed files with 90 additions and 90 deletions
|
|
@ -13,7 +13,7 @@
|
|||
##
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## var
|
||||
## a: TActorPool[int, void]
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ proc sort*[T](a: var openArray[T],
|
|||
## sensible default argument for ``cmp``, so you have to provide one
|
||||
## of your own. However, the ``system.cmp`` procs can be used:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## sort(myIntArray, system.cmp[int])
|
||||
##
|
||||
|
|
@ -170,7 +170,7 @@ proc sort*[T](a: var openArray[T],
|
|||
## You can inline adhoc comparison procs with the `do notation
|
||||
## <manual.html#do-notation>`_. Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## people.sort do (x, y: Person) -> int:
|
||||
## result = cmp(x.surname, y.surname)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
##
|
||||
## The following example demonstrates a simple chat server.
|
||||
##
|
||||
## .. code-block::nimrod
|
||||
## .. code-block::nim
|
||||
##
|
||||
## import asyncnet, asyncdispatch
|
||||
##
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#nimrod c -t:-march=i686 --cpu:amd64 --threads:on -d:release lockfreehash.nim
|
||||
#nim c -t:-march=i686 --cpu:amd64 --threads:on -d:release lockfreehash.nim
|
||||
|
||||
import unsigned, math, hashes
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ proc createProcType(p, b: PNimrodNode): PNimrodNode {.compileTime.} =
|
|||
macro `=>`*(p, b: expr): expr {.immediate.} =
|
||||
## Syntax sugar for anonymous procedures.
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## proc passTwoAndTwo(f: (int, int) -> int): int =
|
||||
## f(2, 2)
|
||||
|
|
@ -104,7 +104,7 @@ macro `=>`*(p, b: expr): expr {.immediate.} =
|
|||
macro `->`*(p, b: expr): expr {.immediate.} =
|
||||
## Syntax sugar for procedure types.
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## proc pass2(f: (float, float) -> float): float =
|
||||
## f(2, 2)
|
||||
|
|
|
|||
|
|
@ -656,17 +656,17 @@ when isMainModule:
|
|||
resp = await client.request("http://picheta.me/aboutme.html")
|
||||
echo("Got response: ", resp.status)
|
||||
|
||||
resp = await client.request("http://nimrod-lang.org/")
|
||||
resp = await client.request("http://nim-lang.org/")
|
||||
echo("Got response: ", resp.status)
|
||||
|
||||
resp = await client.request("http://nimrod-lang.org/download.html")
|
||||
resp = await client.request("http://nim-lang.org/download.html")
|
||||
echo("Got response: ", resp.status)
|
||||
|
||||
asyncCheck main()
|
||||
runForever()
|
||||
|
||||
else:
|
||||
#downloadFile("http://force7.de/nimrod/index.html", "nimrodindex.html")
|
||||
#downloadFile("http://force7.de/nim/index.html", "nimindex.html")
|
||||
#downloadFile("http://www.httpwatch.com/", "ChunkTest.html")
|
||||
#downloadFile("http://validator.w3.org/check?uri=http%3A%2F%2Fgoogle.com",
|
||||
# "validator.html")
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
##
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## import strutils, sockets, httpserver
|
||||
##
|
||||
## var counter = 0
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
##
|
||||
## Usage example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## let
|
||||
## small_json = """{"test": 1.3, "key2": true}"""
|
||||
## jobj = parseJson(small_json)
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
##
|
||||
## Results in:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## 1.3000000000000000e+00
|
||||
## true
|
||||
|
|
|
|||
|
|
@ -514,12 +514,12 @@ proc joinPath*(head, tail: string): string {.
|
|||
##
|
||||
## For example on Unix:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## joinPath("usr", "lib")
|
||||
##
|
||||
## results in:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## "usr/lib"
|
||||
##
|
||||
## If head is the empty string, tail is returned. If tail is the empty
|
||||
|
|
@ -528,7 +528,7 @@ proc joinPath*(head, tail: string): string {.
|
|||
## path separators not located on boundaries won't be modified. More
|
||||
## examples on Unix:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## assert joinPath("usr", "") == "usr/"
|
||||
## assert joinPath("", "lib") == "lib"
|
||||
## assert joinPath("", "/lib") == "/lib"
|
||||
|
|
@ -560,7 +560,7 @@ proc `/` * (head, tail: string): string {.noSideEffect.} =
|
|||
##
|
||||
## Here are some examples for Unix:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## assert "usr" / "" == "usr/"
|
||||
## assert "" / "lib" == "lib"
|
||||
## assert "" / "/lib" == "/lib"
|
||||
|
|
@ -574,7 +574,7 @@ proc splitPath*(path: string): tuple[head, tail: string] {.
|
|||
##
|
||||
## Examples:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## splitPath("usr/local/bin") -> ("usr/local", "bin")
|
||||
## splitPath("usr/local/bin/") -> ("usr/local/bin", "")
|
||||
## splitPath("bin") -> ("", "bin")
|
||||
|
|
@ -674,10 +674,10 @@ proc splitFile*(path: string): tuple[dir, name, ext: string] {.
|
|||
##
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## var (dir, name, ext) = splitFile("usr/local/nimrodc.html")
|
||||
## .. code-block:: nim
|
||||
## var (dir, name, ext) = splitFile("usr/local/nimc.html")
|
||||
## assert dir == "usr/local"
|
||||
## assert name == "nimrodc"
|
||||
## assert name == "nimc"
|
||||
## assert ext == ".html"
|
||||
##
|
||||
## If `path` has no extension, `ext` is the empty string.
|
||||
|
|
@ -1579,7 +1579,7 @@ proc inclFilePermissions*(filename: string,
|
|||
rtl, extern: "nos$1", tags: [ReadDirEffect, WriteDirEffect].} =
|
||||
## a convenience procedure for:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## setFilePermissions(filename, getFilePermissions(filename)+permissions)
|
||||
setFilePermissions(filename, getFilePermissions(filename)+permissions)
|
||||
|
||||
|
|
@ -1588,7 +1588,7 @@ proc exclFilePermissions*(filename: string,
|
|||
rtl, extern: "nos$1", tags: [ReadDirEffect, WriteDirEffect].} =
|
||||
## a convenience procedure for:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## setFilePermissions(filename, getFilePermissions(filename)-permissions)
|
||||
setFilePermissions(filename, getFilePermissions(filename)-permissions)
|
||||
|
||||
|
|
@ -1627,7 +1627,7 @@ when defined(nimdoc):
|
|||
## can test for its availability with `declared() <system.html#declared>`_.
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## when declared(paramCount):
|
||||
## # Use paramCount() here
|
||||
## else:
|
||||
|
|
@ -1650,7 +1650,7 @@ when defined(nimdoc):
|
|||
## can test for its availability with `declared() <system.html#declared>`_.
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## when declared(paramStr):
|
||||
## # Use paramStr() here
|
||||
## else:
|
||||
|
|
@ -1703,7 +1703,7 @@ when declared(paramCount) or defined(nimdoc):
|
|||
## can test for its availability with `declared() <system.html#declared>`_.
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## when declared(commandLineParams):
|
||||
## # Use commandLineParams() here
|
||||
## else:
|
||||
|
|
@ -1858,7 +1858,7 @@ proc expandTilde*(path: string): string =
|
|||
## The behaviour of this proc is the same on the Windows platform despite not
|
||||
## having this convention. Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## let configFile = expandTilde("~" / "appname.cfg")
|
||||
## echo configFile
|
||||
## # --> C:\Users\amber\appname.cfg
|
||||
|
|
@ -1889,7 +1889,7 @@ type
|
|||
creationTime*: Time # Time file was created. Not supported on all systems!
|
||||
|
||||
template rawToFormalFileInfo(rawInfo, formalInfo): expr =
|
||||
## Transforms the native file info structure into the one nimrod uses.
|
||||
## Transforms the native file info structure into the one nim uses.
|
||||
## 'rawInfo' is either a 'TBY_HANDLE_FILE_INFORMATION' structure on Windows,
|
||||
## or a 'TStat' structure on posix
|
||||
when defined(Windows):
|
||||
|
|
|
|||
|
|
@ -771,7 +771,7 @@ elif not defined(useNimRtl):
|
|||
|
||||
proc startProcessAfterFork(data: ptr TStartProcessData) =
|
||||
# Warning: no GC here!
|
||||
# Or anything that touches global structures - all called nimrod procs
|
||||
# Or anything that touches global structures - all called nim procs
|
||||
# must be marked with stackTrace:off. Inspect C code after making changes.
|
||||
if not data.optionPoParentStreams:
|
||||
discard close(data.pStdin[writeIdx])
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ when declared(initOptParser):
|
|||
## This is an convenience iterator for iterating over the command line.
|
||||
## This uses the TOptParser object. Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## var
|
||||
## filename = ""
|
||||
## for kind, key, val in getopt():
|
||||
|
|
|
|||
|
|
@ -348,13 +348,13 @@ iterator interpolatedFragments*(s: string): tuple[kind: InterpolatedKind,
|
|||
##
|
||||
## Example:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## for k, v in interpolatedFragments(" $this is ${an example} $$"):
|
||||
## echo "(", k, ", \"", v, "\")"
|
||||
##
|
||||
## Results in:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## (ikString, " ")
|
||||
## (ikExpr, "this")
|
||||
## (ikString, " is ")
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
## XML parser to accomplish a simple task: To determine the title of an HTML
|
||||
## document.
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## :file: examples/htmltitle.nim
|
||||
##
|
||||
##
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
## XML parser to accomplish another simple task: To determine all the links
|
||||
## an HTML document contains.
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## :file: examples/htmlrefs.nim
|
||||
##
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ when not defined(JS):
|
|||
## To generate useful timing values, take the difference between
|
||||
## the results of two ``cpuTime`` calls:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## .. code-block:: nim
|
||||
## var t0 = cpuTime()
|
||||
## doWork()
|
||||
## echo "CPU time [s] ", cpuTime() - t0
|
||||
|
|
|
|||
|
|
@ -275,12 +275,12 @@ proc xmlConstructor(e: PNimrodNode): PNimrodNode {.compileTime.} =
|
|||
macro `<>`*(x: expr): expr {.immediate.} =
|
||||
## Constructor macro for XML. Example usage:
|
||||
##
|
||||
## .. code-block:: nimrod
|
||||
## <>a(href="http://nimrod-code.org", newText("Nim rules."))
|
||||
## .. code-block:: nim
|
||||
## <>a(href="http://nim-code.org", newText("Nim rules."))
|
||||
##
|
||||
## Produces an XML tree for::
|
||||
##
|
||||
## <a href="http://nimrod-code.org">Nim rules.</a>
|
||||
## <a href="http://nim-code.org">Nim rules.</a>
|
||||
##
|
||||
let x = callsite()
|
||||
result = xmlConstructor(x)
|
||||
|
|
@ -339,5 +339,5 @@ proc findAll*(n: XmlNode, tag: string): seq[XmlNode] =
|
|||
findAll(n, tag, result)
|
||||
|
||||
when isMainModule:
|
||||
assert """<a href="http://nimrod-code.org">Nim rules.</a>""" ==
|
||||
$(<>a(href="http://nimrod-code.org", newText("Nim rules.")))
|
||||
assert """<a href="http://nim-code.org">Nim rules.</a>""" ==
|
||||
$(<>a(href="http://nim-code.org", newText("Nim rules.")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue