further adaptations
This commit is contained in:
parent
cd2c6128d1
commit
c6034277fc
52 changed files with 87 additions and 87 deletions
|
|
@ -25,7 +25,7 @@ proc launchSwarm(port: TPort) {.async.} =
|
||||||
await sendMessages(sock)
|
await sendMessages(sock)
|
||||||
closeSocket(sock)
|
closeSocket(sock)
|
||||||
else:
|
else:
|
||||||
# Issue #932: https://github.com/Araq/Nimrod/issues/932
|
# Issue #932: https://github.com/Araq/Nim/issues/932
|
||||||
var msgFut = sendMessages(sock)
|
var msgFut = sendMessages(sock)
|
||||||
msgFut.callback =
|
msgFut.callback =
|
||||||
proc () =
|
proc () =
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasynciossl.nim"
|
file: "tasynciossl.nim"
|
||||||
cmd: "nimrod $target --hints:on --define:ssl $options $file"
|
cmd: "nim $target --hints:on --define:ssl $options $file"
|
||||||
output: "20000"
|
output: "20000"
|
||||||
"""
|
"""
|
||||||
import sockets, asyncio, strutils, times
|
import sockets, asyncio, strutils, times
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ proc `$`*(status: TStatusEnum): string =
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
||||||
proc makeCommitPath*(platform, hash: string): string =
|
proc makeCommitPath*(platform, hash: string): string =
|
||||||
return platform / "nimrod_" & hash.substr(0, 11) # 11 Chars.
|
return platform / "nim_" & hash.substr(0, 11) # 11 Chars.
|
||||||
|
|
||||||
type
|
type
|
||||||
TFlag = enum
|
TFlag = enum
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
outputsub: "101"
|
outputsub: "101"
|
||||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, locks
|
import os, locks
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: "Done"
|
output: "Done"
|
||||||
cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl $options $file"
|
cmd: "nim $target --debuginfo --hints:on --define:useNimRtl $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file"
|
cmd: "nim $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tfloat3.nim"
|
file: "tfloat3.nim"
|
||||||
output: "Nimrod 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
|
output: "Nim 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math, strutils
|
import math, strutils
|
||||||
|
|
@ -17,7 +17,7 @@ proc c_printf(frmt: CString) {.importc: "printf", header: "<stdio.h>", varargs.}
|
||||||
proc printFloats {.importc, nodecl.}
|
proc printFloats {.importc, nodecl.}
|
||||||
|
|
||||||
var x: float = 1.234567890123456789
|
var x: float = 1.234567890123456789
|
||||||
c_printf("Nimrod %.10f, %.10f ", exp(x), cos(x))
|
c_printf("Nim %.10f, %.10f ", exp(x), cos(x))
|
||||||
printFloats()
|
printFloats()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# -*- nimrod -*-
|
# -*- nim -*-
|
||||||
|
|
||||||
import os, strutils
|
import os, strutils
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
##
|
##
|
||||||
## can_alias_generic Nimrod Module
|
## can_alias_generic Nim Module
|
||||||
##
|
##
|
||||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||||
## Copyright (c) 2011 FWA. All rights reserved.
|
## Copyright (c) 2011 FWA. All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ discard """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
##
|
##
|
||||||
## can_alias_specialised_generic Nimrod Module
|
## can_alias_specialised_generic Nim Module
|
||||||
##
|
##
|
||||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||||
## Copyright (c) 2011 FWA. All rights reserved.
|
## Copyright (c) 2011 FWA. All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
##
|
##
|
||||||
## can_inherit_generic Nimrod Module
|
## can_inherit_generic Nim Module
|
||||||
##
|
##
|
||||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||||
## Copyright (c) 2011 FWA. All rights reserved.
|
## Copyright (c) 2011 FWA. All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
##
|
##
|
||||||
## can_specialise_generic Nimrod Module
|
## can_specialise_generic Nim Module
|
||||||
##
|
##
|
||||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||||
## Copyright (c) 2011 FWA. All rights reserved.
|
## Copyright (c) 2011 FWA. All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ discard """
|
||||||
3'''
|
3'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# https://github.com/Araq/Nimrod/issues/797
|
# https://github.com/Araq/Nim/issues/797
|
||||||
proc foo[T](s:T):string = $s
|
proc foo[T](s:T):string = $s
|
||||||
|
|
||||||
type IntStringProc = proc(x: int): string
|
type IntStringProc = proc(x: int): string
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod check $options $file"
|
cmd: "nim check $options $file"
|
||||||
errormsg: "'proc' is not a concrete type"
|
errormsg: "'proc' is not a concrete type"
|
||||||
errormsg: "'Foo' is not a concrete type."
|
errormsg: "'Foo' is not a concrete type."
|
||||||
errormsg: "invalid type: 'TBaseMed'"
|
errormsg: "invalid type: 'TBaseMed'"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
##
|
##
|
||||||
## specialised_is_equivalent Nimrod Module
|
## specialised_is_equivalent Nim Module
|
||||||
##
|
##
|
||||||
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
## Created by Eric Doughty-Papassideris on 2011-02-16.
|
||||||
## Copyright (c) 2011 FWA. All rights reserved.
|
## Copyright (c) 2011 FWA. All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
cmd: "nimrod $target --gc:none --hints:on --warnings:off $options $file"
|
cmd: "nim $target --gc:none --hints:on --warnings:off $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashes
|
import hashes
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ x: some string'''
|
||||||
import macros
|
import macros
|
||||||
|
|
||||||
macro debug(n: varargs[expr]): stmt =
|
macro debug(n: varargs[expr]): stmt =
|
||||||
# `n` is a Nimrod AST that contains the whole macro invocation
|
# `n` is a Nim AST that contains the whole macro invocation
|
||||||
# this macro returns a list of statements:
|
# this macro returns a list of statements:
|
||||||
result = newNimNode(nnkStmtList, n)
|
result = newNimNode(nnkStmtList, n)
|
||||||
# iterate over any argument that is passed to this macro:
|
# iterate over any argument that is passed to this macro:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
## Command line parsing module for Nimrod.
|
## Command line parsing module for Nimrod.
|
||||||
##
|
##
|
||||||
## `Nimrod <http://nimrod-code.org>`_ provides the `parseopt module
|
## `Nim <http://nim-code.org>`_ provides the `parseopt module
|
||||||
## <http://nimrod-code.org/parseopt.html>`_ to parse options from the
|
## <http://nim-code.org/parseopt.html>`_ to parse options from the
|
||||||
## commandline. This module tries to provide functionality to prevent you from
|
## commandline. This module tries to provide functionality to prevent you from
|
||||||
## writing commandline parsing and let you concentrate on providing the best
|
## writing commandline parsing and let you concentrate on providing the best
|
||||||
## possible experience for your users.
|
## possible experience for your users.
|
||||||
|
|
@ -169,7 +169,7 @@ template new_parsed_parameter*(tkind: Tparam_kind, expr): Tparsed_parameter =
|
||||||
## assign the variable to, and thus you reduce code clutter and may use this
|
## assign the variable to, and thus you reduce code clutter and may use this
|
||||||
## to initialise single assignments variables in `let` blocks. Example:
|
## to initialise single assignments variables in `let` blocks. Example:
|
||||||
##
|
##
|
||||||
## .. code-block:: nimrod
|
## .. code-block:: nim
|
||||||
## let
|
## let
|
||||||
## parsed_param1 = new_parsed_parameter(PK_FLOAT, 3.41)
|
## parsed_param1 = new_parsed_parameter(PK_FLOAT, 3.41)
|
||||||
## parsed_param2 = new_parsed_parameter(PK_BIGGEST_INT, 2358123 * 23123)
|
## parsed_param2 = new_parsed_parameter(PK_BIGGEST_INT, 2358123 * 23123)
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
const Lib = "libchipmunk.so.6.1.1"
|
const Lib = "libchipmunk.so.6.1.1"
|
||||||
|
|
||||||
when defined(MoreNimrod):
|
when defined(MoreNim):
|
||||||
{.hint: "MoreNimrod defined; some Chipmunk functions replaced in Nimrod".}
|
{.hint: "MoreNim defined; some Chipmunk functions replaced in Nim".}
|
||||||
{.deadCodeElim: on.}
|
{.deadCodeElim: on.}
|
||||||
from math import sqrt, sin, cos, arctan2
|
from math import sqrt, sin, cos, arctan2
|
||||||
when defined(CpUseFloat):
|
when defined(CpUseFloat):
|
||||||
|
|
@ -729,7 +729,7 @@ proc isRogue*(body: PBody): Bool {.inline.} =
|
||||||
|
|
||||||
defGetter(PBody, CpFloat, m, Mass)
|
defGetter(PBody, CpFloat, m, Mass)
|
||||||
#/ Set the mass of a body.
|
#/ Set the mass of a body.
|
||||||
when defined(MoreNimrod):
|
when defined(MoreNim):
|
||||||
defSetter(PBody, CpFloat, m, Mass)
|
defSetter(PBody, CpFloat, m, Mass)
|
||||||
else:
|
else:
|
||||||
proc setMass*(body: PBody; m: CpFloat){.
|
proc setMass*(body: PBody; m: CpFloat){.
|
||||||
|
|
@ -738,7 +738,7 @@ else:
|
||||||
#/ Get the moment of a body.
|
#/ Get the moment of a body.
|
||||||
defGetter(PBody, CpFloat, i, Moment)
|
defGetter(PBody, CpFloat, i, Moment)
|
||||||
#/ Set the moment of a body.
|
#/ Set the moment of a body.
|
||||||
when defined(MoreNimrod):
|
when defined(MoreNim):
|
||||||
defSetter(PBody, CpFloat, i, Moment)
|
defSetter(PBody, CpFloat, i, Moment)
|
||||||
else:
|
else:
|
||||||
proc SetMoment*(body: PBody; i: CpFloat) {.
|
proc SetMoment*(body: PBody; i: CpFloat) {.
|
||||||
|
|
@ -747,7 +747,7 @@ else:
|
||||||
#/ Get the position of a body.
|
#/ Get the position of a body.
|
||||||
defGetter(PBody, TVector, p, Pos)
|
defGetter(PBody, TVector, p, Pos)
|
||||||
#/ Set the position of a body.
|
#/ Set the position of a body.
|
||||||
when defined(MoreNimrod):
|
when defined(MoreNim):
|
||||||
defSetter(PBody, TVector, p, Pos)
|
defSetter(PBody, TVector, p, Pos)
|
||||||
else:
|
else:
|
||||||
proc setPos*(body: PBody; pos: TVector) {.
|
proc setPos*(body: PBody; pos: TVector) {.
|
||||||
|
|
@ -1088,7 +1088,7 @@ proc getSegmentRadius*(shape: PShape): CpFloat {.
|
||||||
#var VersionString*{.importc: "cpVersionString", dynlib: Lib.}: cstring
|
#var VersionString*{.importc: "cpVersionString", dynlib: Lib.}: cstring
|
||||||
#/ Calculate the moment of inertia for a circle.
|
#/ Calculate the moment of inertia for a circle.
|
||||||
#/ @c r1 and @c r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.
|
#/ @c r1 and @c r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.
|
||||||
when defined(MoreNimrod):
|
when defined(MoreNim):
|
||||||
proc momentForCircle*(m, r1, r2: CpFloat; offset: TVector): CpFloat {.cdecl.} =
|
proc momentForCircle*(m, r1, r2: CpFloat; offset: TVector): CpFloat {.cdecl.} =
|
||||||
result = m * (0.5 * (r1 * r1 + r2 * r2) + lenSq(offset))
|
result = m * (0.5 * (r1 * r1 + r2 * r2) + lenSq(offset))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ when isMainModule:
|
||||||
for i in 1..paramCount():
|
for i in 1..paramCount():
|
||||||
args.add paramStr(i)
|
args.add paramStr(i)
|
||||||
args.add " "
|
args.add " "
|
||||||
quit(shell("nimrod", "c", "-r", "nakefile.nim", args))
|
quit(shell("nim", "c", "-r", "nakefile.nim", args))
|
||||||
else:
|
else:
|
||||||
addQuitProc(proc() {.noconv.} =
|
addQuitProc(proc() {.noconv.} =
|
||||||
var
|
var
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import nake
|
||||||
nakeImports
|
nakeImports
|
||||||
|
|
||||||
task "install", "compile and install nake binary":
|
task "install", "compile and install nake binary":
|
||||||
if shell("nimrod", "c", "nake") == 0:
|
if shell("nim", "c", "nake") == 0:
|
||||||
let path = getEnv("PATH").split(PathSep)
|
let path = getEnv("PATH").split(PathSep)
|
||||||
for index, dir in pairs(path):
|
for index, dir in pairs(path):
|
||||||
echo " ", index, ". ", dir
|
echo " ", index, ". ", dir
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ const
|
||||||
ServerDefines = "-d:NoSFML --forceBuild"
|
ServerDefines = "-d:NoSFML --forceBuild"
|
||||||
|
|
||||||
task "server", "build the server":
|
task "server", "build the server":
|
||||||
if shell("nimrod", ServerDefines, "-r", "compile", "enet_server") != 0:
|
if shell("nim", ServerDefines, "-r", "compile", "enet_server") != 0:
|
||||||
quit "Failed to build"
|
quit "Failed to build"
|
||||||
task "gui", "build the server GUI mode":
|
task "gui", "build the server GUI mode":
|
||||||
if shell("nimrod", "--app:gui", ServerDefines, "-r", "compile", "enet_server") != 0:
|
if shell("nim", "--app:gui", ServerDefines, "-r", "compile", "enet_server") != 0:
|
||||||
quit "Failed to build"
|
quit "Failed to build"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ when isMainModule:
|
||||||
for i in 1..paramCount():
|
for i in 1..paramCount():
|
||||||
args.add paramStr(i)
|
args.add paramStr(i)
|
||||||
args.add " "
|
args.add " "
|
||||||
quit(shell("nimrod", "c", "-r", "nakefile.nim", args))
|
quit(shell("nim", "c", "-r", "nakefile.nim", args))
|
||||||
else:
|
else:
|
||||||
addQuitProc(proc() {.noconv.} =
|
addQuitProc(proc() {.noconv.} =
|
||||||
var
|
var
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,16 @@ const
|
||||||
BinLibs = "http://dl.dropbox.com/u/37533467/libs-2012-09-12.zip"
|
BinLibs = "http://dl.dropbox.com/u/37533467/libs-2012-09-12.zip"
|
||||||
ExeName = "keineschweine"
|
ExeName = "keineschweine"
|
||||||
ServerDefines = "-d:NoSFML -d:NoChipmunk"
|
ServerDefines = "-d:NoSFML -d:NoChipmunk"
|
||||||
TestBuildDefines = "-d:escapeMenuTest -d:debugWeps -d:showFPS -d:moreNimrod -d:debugKeys -d:foo -d:recordMode --forceBuild"
|
TestBuildDefines = "-d:escapeMenuTest -d:debugWeps -d:showFPS -d:moreNim -d:debugKeys -d:foo -d:recordMode --forceBuild"
|
||||||
ReleaseDefines = "-d:release --deadCodeElim:on"
|
ReleaseDefines = "-d:release --deadCodeElim:on"
|
||||||
ReleaseTestDefines = "-d:debugWeps -d:debugKeys --forceBuild"
|
ReleaseTestDefines = "-d:debugWeps -d:debugKeys --forceBuild"
|
||||||
|
|
||||||
task "testprofile", "..":
|
task "testprofile", "..":
|
||||||
if shell("nimrod", TestBuildDefines, "--profiler:on", "--stacktrace:on", "compile", ExeName) == 0:
|
if shell("nim", TestBuildDefines, "--profiler:on", "--stacktrace:on", "compile", ExeName) == 0:
|
||||||
shell "."/ExeName, "offline"
|
shell "."/ExeName, "offline"
|
||||||
|
|
||||||
task "test", "Build with test defines":
|
task "test", "Build with test defines":
|
||||||
if shell("nimrod", TestBuildDefines, "compile", ExeName) != 0:
|
if shell("nim", TestBuildDefines, "compile", ExeName) != 0:
|
||||||
quit "The build failed."
|
quit "The build failed."
|
||||||
|
|
||||||
task "testrun", "Build with test defines and run":
|
task "testrun", "Build with test defines and run":
|
||||||
|
|
@ -26,22 +26,22 @@ task "testrun", "Build with test defines and run":
|
||||||
shell "."/ExeName
|
shell "."/ExeName
|
||||||
|
|
||||||
task "test2", "Build release test build test release build":
|
task "test2", "Build release test build test release build":
|
||||||
if shell("nimrod", ReleaseDefines, ReleaseTestDefines, "compile", ExeName) == 0:
|
if shell("nim", ReleaseDefines, ReleaseTestDefines, "compile", ExeName) == 0:
|
||||||
shell "."/ExeName
|
shell "."/ExeName
|
||||||
|
|
||||||
discard """task "dirserver", "build the directory server":
|
discard """task "dirserver", "build the directory server":
|
||||||
withDir "server":
|
withDir "server":
|
||||||
if shell("nimrod", ServerDefines, "compile", "dirserver") != 0:
|
if shell("nim", ServerDefines, "compile", "dirserver") != 0:
|
||||||
echo "Failed to build the dirserver"
|
echo "Failed to build the dirserver"
|
||||||
quit 1"""
|
quit 1"""
|
||||||
|
|
||||||
task "zoneserver", "build the zone server":
|
task "zoneserver", "build the zone server":
|
||||||
withDir "enet_server":
|
withDir "enet_server":
|
||||||
if shell("nimrod", ServerDefines, "compile", "enet_server") != 0:
|
if shell("nim", ServerDefines, "compile", "enet_server") != 0:
|
||||||
quit "Failed to build the zoneserver"
|
quit "Failed to build the zoneserver"
|
||||||
task "zoneserver-gui", "build the zone server, with gui!":
|
task "zoneserver-gui", "build the zone server, with gui!":
|
||||||
withDir "enet_server":
|
withDir "enet_server":
|
||||||
if shell("nimrod", ServerDefines, "--app:gui", "compile", "enet_server") != 0:
|
if shell("nim", ServerDefines, "--app:gui", "compile", "enet_server") != 0:
|
||||||
quit "Failed to build the zoneserver"
|
quit "Failed to build the zoneserver"
|
||||||
|
|
||||||
task "servers", "build the server and directory server":
|
task "servers", "build the server and directory server":
|
||||||
|
|
@ -54,7 +54,7 @@ task "all", "run SERVERS and TEST tasks":
|
||||||
runTask "test"
|
runTask "test"
|
||||||
|
|
||||||
task "release", "release build":
|
task "release", "release build":
|
||||||
let res = shell("nimrod", ReleaseDefines, "compile", ExeName)
|
let res = shell("nim", ReleaseDefines, "compile", ExeName)
|
||||||
if res != 0:
|
if res != 0:
|
||||||
echo "The build failed."
|
echo "The build failed."
|
||||||
quit 1
|
quit 1
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ accept baz(vbaz)
|
||||||
reject baz(vnotbaz)
|
reject baz(vnotbaz)
|
||||||
reject bar(vfoo)
|
reject bar(vfoo)
|
||||||
|
|
||||||
# https://github.com/Araq/Nimrod/issues/517
|
# https://github.com/Araq/Nim/issues/517
|
||||||
type
|
type
|
||||||
TVecT*[T] = array[0..1, T]|array[0..2, T]|array[0..3, T]
|
TVecT*[T] = array[0..1, T]|array[0..2, T]|array[0..3, T]
|
||||||
TVec2* = array[0..1, float32]
|
TVec2* = array[0..1, float32]
|
||||||
|
|
@ -43,7 +43,7 @@ proc f[T](a: TVecT[T], b: TVecT[T]): T = discard
|
||||||
var x: float = f([0.0'f32, 0.0'f32], [0.0'f32, 0.0'f32])
|
var x: float = f([0.0'f32, 0.0'f32], [0.0'f32, 0.0'f32])
|
||||||
var y = f(TVec2([0.0'f32, 0.0'f32]), TVec2([0.0'f32, 0.0'f32]))
|
var y = f(TVec2([0.0'f32, 0.0'f32]), TVec2([0.0'f32, 0.0'f32]))
|
||||||
|
|
||||||
# https://github.com/Araq/Nimrod/issues/602
|
# https://github.com/Araq/Nim/issues/602
|
||||||
type
|
type
|
||||||
TTest = object
|
TTest = object
|
||||||
TTest2* = object
|
TTest2* = object
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ discard """
|
||||||
"""
|
"""
|
||||||
## 99 Bottles of Beer
|
## 99 Bottles of Beer
|
||||||
## http://www.99-bottles-of-beer.net/
|
## http://www.99-bottles-of-beer.net/
|
||||||
## Nimrod version
|
## Nim version
|
||||||
|
|
||||||
## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
|
## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
|
||||||
# 2012-11-25
|
# 2012-11-25
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ static int cvariable = 420;
|
||||||
""".}
|
""".}
|
||||||
|
|
||||||
proc embedsC() =
|
proc embedsC() =
|
||||||
var nimrodVar = 89
|
var nimVar = 89
|
||||||
{.emit: """printf("%d\n", cvariable + (int)`nimrodVar`);""".}
|
{.emit: """printf("%d\n", cvariable + (int)`nimVar`);""".}
|
||||||
|
|
||||||
embedsC()
|
embedsC()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ macrotest(stdout)
|
||||||
|
|
||||||
#GC_disable()
|
#GC_disable()
|
||||||
|
|
||||||
echo("This was compiled by Nimrod version " & system.nimrodVersion)
|
echo("This was compiled by Nim version " & system.nimVersion)
|
||||||
writeln(stdout, "Hello", " World", "!")
|
writeln(stdout, "Hello", " World", "!")
|
||||||
|
|
||||||
echo(["a", "b", "c", "d"].len)
|
echo(["a", "b", "c", "d"].len)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod $target --hints:on -d:release $options $file"
|
cmd: "nim $target --hints:on -d:release $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# -*- nimrod -*-
|
# -*- nim -*-
|
||||||
|
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ type
|
||||||
proc ap(x: var TA) = x.a = -1
|
proc ap(x: var TA) = x.a = -1
|
||||||
proc bp(x: var TB) = x.b[high(x.b)] = -1
|
proc bp(x: var TB) = x.b[high(x.b)] = -1
|
||||||
|
|
||||||
# in Nimrod proc (x: TB) is compatible to proc (x: TA),
|
# in Nim proc (x: TB) is compatible to proc (x: TA),
|
||||||
# but this is not type safe:
|
# but this is not type safe:
|
||||||
var f = cast[proc (x: var TA) {.nimcall.}](bp)
|
var f = cast[proc (x: var TA) {.nimcall.}](bp)
|
||||||
var a: TA
|
var a: TA
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
file: "toverflw.nim"
|
file: "toverflw.nim"
|
||||||
output: "the computation overflowed"
|
output: "the computation overflowed"
|
||||||
"""
|
"""
|
||||||
# Tests nimrod's ability to detect overflows
|
# Tests nim's ability to detect overflows
|
||||||
|
|
||||||
{.push overflowChecks: on.}
|
{.push overflowChecks: on.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
output: '''foobarfoobar
|
output: '''foobarfoobar
|
||||||
bazbearbazbear
|
bazbearbazbear
|
||||||
1'''
|
1'''
|
||||||
cmd: "nimrod $target --threads:on $options $file"
|
cmd: "nim $target --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import threadpool
|
import threadpool
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''4
|
output: '''4
|
||||||
8'''
|
8'''
|
||||||
cmd: "nimrod $target --threads:on $options $file"
|
cmd: "nim $target --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import threadpool
|
import threadpool
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
line: 9
|
line: 9
|
||||||
errormsg: "'spawn' takes a call expression"
|
errormsg: "'spawn' takes a call expression"
|
||||||
cmd: "nimrod $target --threads:on $options $file"
|
cmd: "nim $target --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import threadpool
|
import threadpool
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
output: "<html><head><title>now look at this</title></head><body><ul><li>Nimrod is quite capable</li></ul></body></html>"
|
output: "<html><head><title>now look at this</title></head><body><ul><li>Nim is quite capable</li></ul></body></html>"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import strutils
|
import strutils
|
||||||
|
|
@ -32,6 +32,6 @@ html mainPage:
|
||||||
title "now look at this"
|
title "now look at this"
|
||||||
body:
|
body:
|
||||||
ul:
|
ul:
|
||||||
li "Nimrod is quite capable"
|
li "Nim is quite capable"
|
||||||
|
|
||||||
echo mainPage()
|
echo mainPage()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# Simplest Nimrod program
|
# Simplest Nim program
|
||||||
|
|
||||||
echo "Hello, World!"
|
echo "Hello, World!"
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ type
|
||||||
|
|
||||||
const
|
const
|
||||||
ircServer = "irc.freenode.net"
|
ircServer = "irc.freenode.net"
|
||||||
joinChans = @["#nimrod"]
|
joinChans = @["#nim"]
|
||||||
botNickname = "NimBot"
|
botNickname = "NimBot"
|
||||||
|
|
||||||
proc setSeen(d: TDb, s: TSeen) =
|
proc setSeen(d: TDb, s: TSeen) =
|
||||||
|
|
@ -271,7 +271,7 @@ proc handleWebMessage(state: PState, line: string) =
|
||||||
message.add("-" & $commit["removed"].len & "]: ")
|
message.add("-" & $commit["removed"].len & "]: ")
|
||||||
message.add(limitCommitMsg(commit["message"].str))
|
message.add(limitCommitMsg(commit["message"].str))
|
||||||
|
|
||||||
# Send message to #nimrod.
|
# Send message to #nim.
|
||||||
state.ircClient.privmsg(joinChans[0], message)
|
state.ircClient.privmsg(joinChans[0], message)
|
||||||
elif json.hasKey("redisinfo"):
|
elif json.hasKey("redisinfo"):
|
||||||
assert json["redisinfo"].hasKey("port")
|
assert json["redisinfo"].hasKey("port")
|
||||||
|
|
@ -420,7 +420,7 @@ proc handleIrc(irc: PAsyncIRC, event: TIRCEvent, state: PState) =
|
||||||
seenNick.msg = msg
|
seenNick.msg = msg
|
||||||
state.database.setSeen(seenNick)
|
state.database.setSeen(seenNick)
|
||||||
of MNick:
|
of MNick:
|
||||||
createSeen(PSeenNick, event.nick, "#nimrod")
|
createSeen(PSeenNick, event.nick, "#nim")
|
||||||
seenNick.newNick = event.params[0]
|
seenNick.newNick = event.params[0]
|
||||||
state.database.setSeen(seenNick)
|
state.database.setSeen(seenNick)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,7 @@ template `=~`*(s: string, pattern: TPeg): expr =
|
||||||
## This calls ``match`` with an implicit declared ``matches`` array that
|
## This calls ``match`` with an implicit declared ``matches`` array that
|
||||||
## can be used in the scope of the ``=~`` call:
|
## can be used in the scope of the ``=~`` call:
|
||||||
##
|
##
|
||||||
## .. code-block:: nimrod
|
## .. code-block:: nim
|
||||||
##
|
##
|
||||||
## if line =~ peg"\s* {\w+} \s* '=' \s* {\w+}":
|
## if line =~ peg"\s* {\w+} \s* '=' \s* {\w+}":
|
||||||
## # matches a key=value pair:
|
## # matches a key=value pair:
|
||||||
|
|
@ -897,12 +897,12 @@ proc replacef*(s: string, sub: TPeg, by: string): string {.
|
||||||
## Replaces `sub` in `s` by the string `by`. Captures can be accessed in `by`
|
## Replaces `sub` in `s` by the string `by`. Captures can be accessed in `by`
|
||||||
## with the notation ``$i`` and ``$#`` (see strutils.`%`). Examples:
|
## with the notation ``$i`` and ``$#`` (see strutils.`%`). Examples:
|
||||||
##
|
##
|
||||||
## .. code-block:: nimrod
|
## .. code-block:: nim
|
||||||
## "var1=key; var2=key2".replace(peg"{\ident}'='{\ident}", "$1<-$2$2")
|
## "var1=key; var2=key2".replace(peg"{\ident}'='{\ident}", "$1<-$2$2")
|
||||||
##
|
##
|
||||||
## Results in:
|
## Results in:
|
||||||
##
|
##
|
||||||
## .. code-block:: nimrod
|
## .. code-block:: nim
|
||||||
##
|
##
|
||||||
## "var1<-keykey; val2<-key2key2"
|
## "var1<-keykey; val2<-key2key2"
|
||||||
result = ""
|
result = ""
|
||||||
|
|
@ -979,13 +979,13 @@ iterator split*(s: string, sep: TPeg): string =
|
||||||
## Substrings are separated by the PEG `sep`.
|
## Substrings are separated by the PEG `sep`.
|
||||||
## Examples:
|
## Examples:
|
||||||
##
|
##
|
||||||
## .. code-block:: nimrod
|
## .. code-block:: nim
|
||||||
## for word in split("00232this02939is39an22example111", peg"\d+"):
|
## for word in split("00232this02939is39an22example111", peg"\d+"):
|
||||||
## writeln(stdout, word)
|
## writeln(stdout, word)
|
||||||
##
|
##
|
||||||
## Results in:
|
## Results in:
|
||||||
##
|
##
|
||||||
## .. code-block:: nimrod
|
## .. code-block:: nim
|
||||||
## "this"
|
## "this"
|
||||||
## "is"
|
## "is"
|
||||||
## "an"
|
## "an"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod $target --hints:on -d:embedUnidecodeTable $options $file"
|
cmd: "nim $target --hints:on -d:embedUnidecodeTable $options $file"
|
||||||
output: "Ausserst"
|
output: "Ausserst"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
discard """
|
discard """
|
||||||
file: "txmlgen.nim"
|
file: "txmlgen.nim"
|
||||||
output: "<h1><a href=\"http://force7.de/nimrod\">Nimrod</a></h1>"
|
output: "<h1><a href=\"http://force7.de/nim\">Nim</a></h1>"
|
||||||
"""
|
"""
|
||||||
import htmlgen
|
import htmlgen
|
||||||
|
|
||||||
var nim = "Nimrod"
|
var nim = "Nim"
|
||||||
echo h1(a(href="http://force7.de/nimrod", nim))
|
echo h1(a(href="http://force7.de/nim", nim))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ discard """
|
||||||
|
|
||||||
import xmltree, strtabs
|
import xmltree, strtabs
|
||||||
|
|
||||||
var x = <>a(href="nimrod.de", newText("www.nimrod-test.de"))
|
var x = <>a(href="nim.de", newText("www.nim-test.de"))
|
||||||
|
|
||||||
echo($x == "<a href=\"nimrod.de\">www.nimrod-test.de</a>")
|
echo($x == "<a href=\"nim.de\">www.nim-test.de</a>")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ discard """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Ref:
|
# Ref:
|
||||||
# http://nimrod-lang.org/macros.html
|
# http://nim-lang.org/macros.html
|
||||||
# http://nimrod-lang.org/parseutils.html
|
# http://nim-lang.org/parseutils.html
|
||||||
|
|
||||||
|
|
||||||
# Imports
|
# Imports
|
||||||
|
|
@ -313,7 +313,7 @@ proc parse_until_symbol(node: PNimrodNode, value: string, index: var int): bool
|
||||||
|
|
||||||
proc parse_template(node: PNimrodNode, value: string) =
|
proc parse_template(node: PNimrodNode, value: string) =
|
||||||
## Parses through entire template, outputing valid
|
## Parses through entire template, outputing valid
|
||||||
## Nimrod code into the input `node` AST.
|
## Nim code into the input `node` AST.
|
||||||
var index = 0
|
var index = 0
|
||||||
while index < value.len and
|
while index < value.len and
|
||||||
parse_until_symbol(node, value, index): nil
|
parse_until_symbol(node, value, index): nil
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ proc replaceVars(session: var NimSession, text: string): string =
|
||||||
result = result.replace(moduleReplaceVar, session.modname)
|
result = result.replace(moduleReplaceVar, session.modname)
|
||||||
result = result.replace(silentReplaceVar, silentReplaceText)
|
result = result.replace(silentReplaceVar, silentReplaceText)
|
||||||
|
|
||||||
proc startNimrodSession(project, script: string, mode: TRunMode):
|
proc startNimSession(project, script: string, mode: TRunMode):
|
||||||
NimSession =
|
NimSession =
|
||||||
let (dir, name, ext) = project.splitFile
|
let (dir, name, ext) = project.splitFile
|
||||||
result.mode = mode
|
result.mode = mode
|
||||||
|
|
@ -114,7 +114,7 @@ proc doScenario(script: string, output: PStream, mode: TRunMode, verbose: bool):
|
||||||
|
|
||||||
if f.readLine(project):
|
if f.readLine(project):
|
||||||
var
|
var
|
||||||
s = startNimrodSession(script.parentDir / project.string, script, mode)
|
s = startNimSession(script.parentDir / project.string, script, mode)
|
||||||
tline = TaintedString("")
|
tline = TaintedString("")
|
||||||
ln = 1
|
ln = 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod Tester
|
# Nim Tester
|
||||||
# (c) Copyright 2014 Andreas Rumpf
|
# (c) Copyright 2014 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ type
|
||||||
actionRun = "run"
|
actionRun = "run"
|
||||||
actionReject = "reject"
|
actionReject = "reject"
|
||||||
TResultEnum* = enum
|
TResultEnum* = enum
|
||||||
reNimrodcCrash, # nim compiler seems to have crashed
|
reNimcCrash, # nim compiler seems to have crashed
|
||||||
reMsgsDiffer, # error messages differ
|
reMsgsDiffer, # error messages differ
|
||||||
reFilesDiffer, # expected and given filenames differ
|
reFilesDiffer, # expected and given filenames differ
|
||||||
reLinesDiffer, # expected and given line numbers differ
|
reLinesDiffer, # expected and given line numbers differ
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
outputsub: "101"
|
outputsub: "101"
|
||||||
errormsg: "'threadFunc' is not GC-safe"
|
errormsg: "'threadFunc' is not GC-safe"
|
||||||
line: 39
|
line: 39
|
||||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
file: "tthreadanalysis2.nim"
|
file: "tthreadanalysis2.nim"
|
||||||
line: 37
|
line: 37
|
||||||
errormsg: "'threadFunc' is not GC-safe"
|
errormsg: "'threadFunc' is not GC-safe"
|
||||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
line: 11
|
line: 11
|
||||||
errormsg: "'horrible' is not GC-safe"
|
errormsg: "'horrible' is not GC-safe"
|
||||||
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
cmd: "nim $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod $target --threads:on $options $file"
|
cmd: "nim $target --threads:on $options $file"
|
||||||
errormsg: "illegal recursion in type 'TIRC'"
|
errormsg: "illegal recursion in type 'TIRC'"
|
||||||
line: 16
|
line: 16
|
||||||
"""
|
"""
|
||||||
|
|
@ -62,5 +62,5 @@ proc Connect*(irc: var TIRC, nick: string, host: string, port: int = 6667) =
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var irc = initIRC()
|
var irc = initIRC()
|
||||||
irc.Connect("AmryBot[Nim]","irc.freenode.net",6667)
|
irc.Connect("AmryBot[Nim]","irc.freenode.net",6667)
|
||||||
irc.sendRaw("JOIN #nimrod")
|
irc.sendRaw("JOIN #nim")
|
||||||
os.Sleep(4000)
|
os.Sleep(4000)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import
|
||||||
# This macro mimics the using statement from C#
|
# This macro mimics the using statement from C#
|
||||||
#
|
#
|
||||||
# It's kept only as a test for the macro system
|
# It's kept only as a test for the macro system
|
||||||
# Nimrod's destructors offer a mechanism for automatic
|
# Nim's destructors offer a mechanism for automatic
|
||||||
# disposal of resources.
|
# disposal of resources.
|
||||||
#
|
#
|
||||||
macro autoClose(e: expr): stmt {.immediate.} =
|
macro autoClose(e: expr): stmt {.immediate.} =
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import strutils
|
||||||
const
|
const
|
||||||
HelpText = """
|
HelpText = """
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
| Maintenance program for Nimrod |
|
| Maintenance program for Nim |
|
||||||
| Version $1|
|
| Version $1|
|
||||||
| (c) 2012 Andreas Rumpf |
|
| (c) 2012 Andreas Rumpf |
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
|
|
@ -19,12 +19,12 @@ Options:
|
||||||
--help, -h shows this help and quits
|
--help, -h shows this help and quits
|
||||||
Possible Commands:
|
Possible Commands:
|
||||||
boot [options] bootstraps with given command line options
|
boot [options] bootstraps with given command line options
|
||||||
clean cleans Nimrod project; removes generated files
|
clean cleans Nim project; removes generated files
|
||||||
web generates the website
|
web generates the website
|
||||||
csource [options] builds the C sources for installation
|
csource [options] builds the C sources for installation
|
||||||
zip builds the installation ZIP package
|
zip builds the installation ZIP package
|
||||||
inno builds the Inno Setup installer
|
inno builds the Inno Setup installer
|
||||||
""" % [NimrodVersion & repeatChar(44-len(NimrodVersion)),
|
""" % [NimVersion & repeatChar(44-len(NimVersion)),
|
||||||
CompileDate, CompileTime]
|
CompileDate, CompileTime]
|
||||||
|
|
||||||
echo helpText
|
echo helpText
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue