Merge ../Nim into devel
This commit is contained in:
commit
7cb9f363d6
2 changed files with 15 additions and 6 deletions
|
|
@ -719,10 +719,13 @@ proc `$`*(node: NimNode): string {.compileTime.} =
|
||||||
proc ident*(name: string): NimNode {.compileTime,inline.} = newIdentNode(name)
|
proc ident*(name: string): NimNode {.compileTime,inline.} = newIdentNode(name)
|
||||||
## Create a new ident node from a string
|
## Create a new ident node from a string
|
||||||
|
|
||||||
iterator children*(n: NimNode): NimNode {.inline.}=
|
iterator items*(n: NimNode): NimNode {.inline.} =
|
||||||
|
## Iterates over the children of the NimNode ``n``.
|
||||||
for i in 0 ..< n.len:
|
for i in 0 ..< n.len:
|
||||||
yield n[i]
|
yield n[i]
|
||||||
|
|
||||||
|
iterator children*(n: NimNode): NimNode {.inline.} = items
|
||||||
|
|
||||||
template findChild*(n: NimNode; cond: expr): NimNode {.
|
template findChild*(n: NimNode; cond: expr): NimNode {.
|
||||||
immediate, dirty.} =
|
immediate, dirty.} =
|
||||||
## Find the first child node matching condition (or nil).
|
## Find the first child node matching condition (or nil).
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,6 @@ type
|
||||||
WeekDay* = enum ## represents a weekday
|
WeekDay* = enum ## represents a weekday
|
||||||
dMon, dTue, dWed, dThu, dFri, dSat, dSun
|
dMon, dTue, dWed, dThu, dFri, dSat, dSun
|
||||||
|
|
||||||
when not defined(JS):
|
|
||||||
var
|
|
||||||
timezone {.importc, header: "<time.h>".}: int
|
|
||||||
tzname {.importc, header: "<time.h>" .}: array[0..1, cstring]
|
|
||||||
|
|
||||||
when defined(posix) and not defined(JS):
|
when defined(posix) and not defined(JS):
|
||||||
type
|
type
|
||||||
TimeImpl {.importc: "time_t", header: "<time.h>".} = int
|
TimeImpl {.importc: "time_t", header: "<time.h>".} = int
|
||||||
|
|
@ -49,6 +44,9 @@ when defined(posix) and not defined(JS):
|
||||||
proc posix_gettimeofday(tp: var Timeval, unused: pointer = nil) {.
|
proc posix_gettimeofday(tp: var Timeval, unused: pointer = nil) {.
|
||||||
importc: "gettimeofday", header: "<sys/time.h>".}
|
importc: "gettimeofday", header: "<sys/time.h>".}
|
||||||
|
|
||||||
|
var
|
||||||
|
timezone {.importc, header: "<time.h>".}: int
|
||||||
|
tzname {.importc, header: "<time.h>" .}: array[0..1, cstring]
|
||||||
# we also need tzset() to make sure that tzname is initialized
|
# we also need tzset() to make sure that tzname is initialized
|
||||||
proc tzset() {.importc, header: "<time.h>".}
|
proc tzset() {.importc, header: "<time.h>".}
|
||||||
# calling tzset() implicitly to initialize tzname data.
|
# calling tzset() implicitly to initialize tzname data.
|
||||||
|
|
@ -60,11 +58,19 @@ elif defined(windows):
|
||||||
when defined(vcc):
|
when defined(vcc):
|
||||||
# newest version of Visual C++ defines time_t to be of 64 bits
|
# newest version of Visual C++ defines time_t to be of 64 bits
|
||||||
type TimeImpl {.importc: "time_t", header: "<time.h>".} = int64
|
type TimeImpl {.importc: "time_t", header: "<time.h>".} = int64
|
||||||
|
# visual c's c runtime exposes these under a different name
|
||||||
|
var
|
||||||
|
timezone {.importc: "_timezone", header: "<time.h>".}: int
|
||||||
|
tzname {.importc: "_tzname", header: "<time.h>"}: array[0..1, cstring]
|
||||||
else:
|
else:
|
||||||
type TimeImpl {.importc: "time_t", header: "<time.h>".} = int32
|
type TimeImpl {.importc: "time_t", header: "<time.h>".} = int32
|
||||||
|
var
|
||||||
|
timezone {.importc, header: "<time.h>".}: int
|
||||||
|
tzname {.importc, header: "<time.h>" .}: array[0..1, cstring]
|
||||||
|
|
||||||
type
|
type
|
||||||
Time* = distinct TimeImpl
|
Time* = distinct TimeImpl
|
||||||
|
|
||||||
|
|
||||||
elif defined(JS):
|
elif defined(JS):
|
||||||
type
|
type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue