p[] instead of p^
This commit is contained in:
parent
3d696c3da5
commit
46c41e4369
32 changed files with 242 additions and 346 deletions
|
|
@ -14,7 +14,7 @@ bind .e <Return> {
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
FindExecutable(getApplicationFilename())
|
FindExecutable(getAppFilename())
|
||||||
var interp = CreateInterp()
|
var interp = CreateInterp()
|
||||||
if interp == nil: quit("cannot create TCL interpreter")
|
if interp == nil: quit("cannot create TCL interpreter")
|
||||||
if Init(interp) != TCL_OK:
|
if Init(interp) != TCL_OK:
|
||||||
|
|
|
||||||
114
install.sh
114
install.sh
|
|
@ -140,120 +140,6 @@ if [ $# -eq 1 ] ; then
|
||||||
chmod 644 $docdir/tut1.txt
|
chmod 644 $docdir/tut1.txt
|
||||||
cp doc/tut2.txt $docdir/tut2.txt || exit 1
|
cp doc/tut2.txt $docdir/tut2.txt || exit 1
|
||||||
chmod 644 $docdir/tut2.txt
|
chmod 644 $docdir/tut2.txt
|
||||||
cp doc/apis.html $docdir/apis.html || exit 1
|
|
||||||
chmod 644 $docdir/apis.html
|
|
||||||
cp doc/browsers.html $docdir/browsers.html || exit 1
|
|
||||||
chmod 644 $docdir/browsers.html
|
|
||||||
cp doc/c2nim.html $docdir/c2nim.html || exit 1
|
|
||||||
chmod 644 $docdir/c2nim.html
|
|
||||||
cp doc/cgi.html $docdir/cgi.html || exit 1
|
|
||||||
chmod 644 $docdir/cgi.html
|
|
||||||
cp doc/colors.html $docdir/colors.html || exit 1
|
|
||||||
chmod 644 $docdir/colors.html
|
|
||||||
cp doc/complex.html $docdir/complex.html || exit 1
|
|
||||||
chmod 644 $docdir/complex.html
|
|
||||||
cp doc/db_mysql.html $docdir/db_mysql.html || exit 1
|
|
||||||
chmod 644 $docdir/db_mysql.html
|
|
||||||
cp doc/db_postgres.html $docdir/db_postgres.html || exit 1
|
|
||||||
chmod 644 $docdir/db_postgres.html
|
|
||||||
cp doc/db_sqlite.html $docdir/db_sqlite.html || exit 1
|
|
||||||
chmod 644 $docdir/db_sqlite.html
|
|
||||||
cp doc/dynlib.html $docdir/dynlib.html || exit 1
|
|
||||||
chmod 644 $docdir/dynlib.html
|
|
||||||
cp doc/endb.html $docdir/endb.html || exit 1
|
|
||||||
chmod 644 $docdir/endb.html
|
|
||||||
cp doc/graphics.html $docdir/graphics.html || exit 1
|
|
||||||
chmod 644 $docdir/graphics.html
|
|
||||||
cp doc/hashes.html $docdir/hashes.html || exit 1
|
|
||||||
chmod 644 $docdir/hashes.html
|
|
||||||
cp doc/htmlparser.html $docdir/htmlparser.html || exit 1
|
|
||||||
chmod 644 $docdir/htmlparser.html
|
|
||||||
cp doc/httpclient.html $docdir/httpclient.html || exit 1
|
|
||||||
chmod 644 $docdir/httpclient.html
|
|
||||||
cp doc/httpserver.html $docdir/httpserver.html || exit 1
|
|
||||||
chmod 644 $docdir/httpserver.html
|
|
||||||
cp doc/intern.html $docdir/intern.html || exit 1
|
|
||||||
chmod 644 $docdir/intern.html
|
|
||||||
cp doc/json.html $docdir/json.html || exit 1
|
|
||||||
chmod 644 $docdir/json.html
|
|
||||||
cp doc/lexbase.html $docdir/lexbase.html || exit 1
|
|
||||||
chmod 644 $docdir/lexbase.html
|
|
||||||
cp doc/lib.html $docdir/lib.html || exit 1
|
|
||||||
chmod 644 $docdir/lib.html
|
|
||||||
cp doc/macros.html $docdir/macros.html || exit 1
|
|
||||||
chmod 644 $docdir/macros.html
|
|
||||||
cp doc/manual.html $docdir/manual.html || exit 1
|
|
||||||
chmod 644 $docdir/manual.html
|
|
||||||
cp doc/math.html $docdir/math.html || exit 1
|
|
||||||
chmod 644 $docdir/math.html
|
|
||||||
cp doc/niminst.html $docdir/niminst.html || exit 1
|
|
||||||
chmod 644 $docdir/niminst.html
|
|
||||||
cp doc/nimrodc.html $docdir/nimrodc.html || exit 1
|
|
||||||
chmod 644 $docdir/nimrodc.html
|
|
||||||
cp doc/os.html $docdir/os.html || exit 1
|
|
||||||
chmod 644 $docdir/os.html
|
|
||||||
cp doc/osproc.html $docdir/osproc.html || exit 1
|
|
||||||
chmod 644 $docdir/osproc.html
|
|
||||||
cp doc/overview.html $docdir/overview.html || exit 1
|
|
||||||
chmod 644 $docdir/overview.html
|
|
||||||
cp doc/parsecfg.html $docdir/parsecfg.html || exit 1
|
|
||||||
chmod 644 $docdir/parsecfg.html
|
|
||||||
cp doc/parsecsv.html $docdir/parsecsv.html || exit 1
|
|
||||||
chmod 644 $docdir/parsecsv.html
|
|
||||||
cp doc/parseopt.html $docdir/parseopt.html || exit 1
|
|
||||||
chmod 644 $docdir/parseopt.html
|
|
||||||
cp doc/parsesql.html $docdir/parsesql.html || exit 1
|
|
||||||
chmod 644 $docdir/parsesql.html
|
|
||||||
cp doc/parseutils.html $docdir/parseutils.html || exit 1
|
|
||||||
chmod 644 $docdir/parseutils.html
|
|
||||||
cp doc/parsexml.html $docdir/parsexml.html || exit 1
|
|
||||||
chmod 644 $docdir/parsexml.html
|
|
||||||
cp doc/pegs.html $docdir/pegs.html || exit 1
|
|
||||||
chmod 644 $docdir/pegs.html
|
|
||||||
cp doc/re.html $docdir/re.html || exit 1
|
|
||||||
chmod 644 $docdir/re.html
|
|
||||||
cp doc/ropes.html $docdir/ropes.html || exit 1
|
|
||||||
chmod 644 $docdir/ropes.html
|
|
||||||
cp doc/sockets.html $docdir/sockets.html || exit 1
|
|
||||||
chmod 644 $docdir/sockets.html
|
|
||||||
cp doc/streams.html $docdir/streams.html || exit 1
|
|
||||||
chmod 644 $docdir/streams.html
|
|
||||||
cp doc/strtabs.html $docdir/strtabs.html || exit 1
|
|
||||||
chmod 644 $docdir/strtabs.html
|
|
||||||
cp doc/strutils.html $docdir/strutils.html || exit 1
|
|
||||||
chmod 644 $docdir/strutils.html
|
|
||||||
cp doc/system.html $docdir/system.html || exit 1
|
|
||||||
chmod 644 $docdir/system.html
|
|
||||||
cp doc/terminal.html $docdir/terminal.html || exit 1
|
|
||||||
chmod 644 $docdir/terminal.html
|
|
||||||
cp doc/theindex.html $docdir/theindex.html || exit 1
|
|
||||||
chmod 644 $docdir/theindex.html
|
|
||||||
cp doc/times.html $docdir/times.html || exit 1
|
|
||||||
chmod 644 $docdir/times.html
|
|
||||||
cp doc/tools.html $docdir/tools.html || exit 1
|
|
||||||
chmod 644 $docdir/tools.html
|
|
||||||
cp doc/tut1.html $docdir/tut1.html || exit 1
|
|
||||||
chmod 644 $docdir/tut1.html
|
|
||||||
cp doc/tut2.html $docdir/tut2.html || exit 1
|
|
||||||
chmod 644 $docdir/tut2.html
|
|
||||||
cp doc/unicode.html $docdir/unicode.html || exit 1
|
|
||||||
chmod 644 $docdir/unicode.html
|
|
||||||
cp doc/unidecode.html $docdir/unidecode.html || exit 1
|
|
||||||
chmod 644 $docdir/unidecode.html
|
|
||||||
cp doc/web.html $docdir/web.html || exit 1
|
|
||||||
chmod 644 $docdir/web.html
|
|
||||||
cp doc/xmldom.html $docdir/xmldom.html || exit 1
|
|
||||||
chmod 644 $docdir/xmldom.html
|
|
||||||
cp doc/xmldomparser.html $docdir/xmldomparser.html || exit 1
|
|
||||||
chmod 644 $docdir/xmldomparser.html
|
|
||||||
cp doc/xmlgen.html $docdir/xmlgen.html || exit 1
|
|
||||||
chmod 644 $docdir/xmlgen.html
|
|
||||||
cp doc/xmlparser.html $docdir/xmlparser.html || exit 1
|
|
||||||
chmod 644 $docdir/xmlparser.html
|
|
||||||
cp doc/xmltree.html $docdir/xmltree.html || exit 1
|
|
||||||
chmod 644 $docdir/xmltree.html
|
|
||||||
cp doc/zipfiles.html $docdir/zipfiles.html || exit 1
|
|
||||||
chmod 644 $docdir/zipfiles.html
|
|
||||||
cp doc/mytest.cfg $docdir/mytest.cfg || exit 1
|
cp doc/mytest.cfg $docdir/mytest.cfg || exit 1
|
||||||
chmod 644 $docdir/mytest.cfg
|
chmod 644 $docdir/mytest.cfg
|
||||||
cp doc/c2nim.pdf $docdir/c2nim.pdf || exit 1
|
cp doc/c2nim.pdf $docdir/c2nim.pdf || exit 1
|
||||||
|
|
|
||||||
|
|
@ -101,10 +101,10 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) =
|
||||||
add result, "{"
|
add result, "{"
|
||||||
var u: int64
|
var u: int64
|
||||||
case typ.size
|
case typ.size
|
||||||
of 1: u = ze64(cast[ptr int8](p)^)
|
of 1: u = ze64(cast[ptr int8](p)[])
|
||||||
of 2: u = ze64(cast[ptr int16](p)^)
|
of 2: u = ze64(cast[ptr int16](p)[])
|
||||||
of 4: u = ze64(cast[ptr int32](p)^)
|
of 4: u = ze64(cast[ptr int32](p)[])
|
||||||
of 8: u = cast[ptr int64](p)^
|
of 8: u = cast[ptr int64](p)[]
|
||||||
else:
|
else:
|
||||||
var a = cast[pbyteArray](p)
|
var a = cast[pbyteArray](p)
|
||||||
for i in 0 .. typ.size*8-1:
|
for i in 0 .. typ.size*8-1:
|
||||||
|
|
@ -217,31 +217,31 @@ when not defined(useNimRtl):
|
||||||
of tyArray: reprArray(result, p, typ, cl)
|
of tyArray: reprArray(result, p, typ, cl)
|
||||||
of tyTuple, tyPureObject: reprRecord(result, p, typ, cl)
|
of tyTuple, tyPureObject: reprRecord(result, p, typ, cl)
|
||||||
of tyObject:
|
of tyObject:
|
||||||
var t = cast[ptr PNimType](p)^
|
var t = cast[ptr PNimType](p)[]
|
||||||
reprRecord(result, p, t, cl)
|
reprRecord(result, p, t, cl)
|
||||||
of tyRef, tyPtr:
|
of tyRef, tyPtr:
|
||||||
assert(p != nil)
|
assert(p != nil)
|
||||||
if cast[ppointer](p)^ == nil: add result, "nil"
|
if cast[ppointer](p)[] == nil: add result, "nil"
|
||||||
else: reprRef(result, cast[ppointer](p)^, typ, cl)
|
else: reprRef(result, cast[ppointer](p)[], typ, cl)
|
||||||
of tySequence:
|
of tySequence:
|
||||||
reprSequence(result, cast[ppointer](p)^, typ, cl)
|
reprSequence(result, cast[ppointer](p)[], typ, cl)
|
||||||
of tyInt: add result, $(cast[ptr int](p)^)
|
of tyInt: add result, $(cast[ptr int](p)[])
|
||||||
of tyInt8: add result, $int(cast[ptr Int8](p)^)
|
of tyInt8: add result, $int(cast[ptr Int8](p)[])
|
||||||
of tyInt16: add result, $int(cast[ptr Int16](p)^)
|
of tyInt16: add result, $int(cast[ptr Int16](p)[])
|
||||||
of tyInt32: add result, $int(cast[ptr Int32](p)^)
|
of tyInt32: add result, $int(cast[ptr Int32](p)[])
|
||||||
of tyInt64: add result, $(cast[ptr Int64](p)^)
|
of tyInt64: add result, $(cast[ptr Int64](p)[])
|
||||||
of tyFloat: add result, $(cast[ptr float](p)^)
|
of tyFloat: add result, $(cast[ptr float](p)[])
|
||||||
of tyFloat32: add result, $(cast[ptr float32](p)^)
|
of tyFloat32: add result, $(cast[ptr float32](p)[])
|
||||||
of tyFloat64: add result, $(cast[ptr float64](p)^)
|
of tyFloat64: add result, $(cast[ptr float64](p)[])
|
||||||
of tyEnum: add result, reprEnum(cast[ptr int](p)^, typ)
|
of tyEnum: add result, reprEnum(cast[ptr int](p)[], typ)
|
||||||
of tyBool: add result, reprBool(cast[ptr bool](p)^)
|
of tyBool: add result, reprBool(cast[ptr bool](p)[])
|
||||||
of tyChar: add result, reprChar(cast[ptr char](p)^)
|
of tyChar: add result, reprChar(cast[ptr char](p)[])
|
||||||
of tyString: reprStrAux(result, cast[ptr string](p)^)
|
of tyString: reprStrAux(result, cast[ptr string](p)[])
|
||||||
of tyCString: reprStrAux(result, $(cast[ptr cstring](p)^))
|
of tyCString: reprStrAux(result, $(cast[ptr cstring](p)[]))
|
||||||
of tyRange: reprAux(result, p, typ.base, cl)
|
of tyRange: reprAux(result, p, typ.base, cl)
|
||||||
of tyProc, tyPointer:
|
of tyProc, tyPointer:
|
||||||
if cast[ppointer](p)^ == nil: add result, "nil"
|
if cast[ppointer](p)[] == nil: add result, "nil"
|
||||||
else: add result, reprPointer(cast[ppointer](p)^)
|
else: add result, reprPointer(cast[ppointer](p)[])
|
||||||
else:
|
else:
|
||||||
add result, "(invalid data!)"
|
add result, "(invalid data!)"
|
||||||
inc(cl.recdepth)
|
inc(cl.recdepth)
|
||||||
|
|
|
||||||
|
|
@ -720,7 +720,7 @@ else:
|
||||||
# retrieves the variables of char** env of C's main proc
|
# retrieves the variables of char** env of C's main proc
|
||||||
if not envComputed:
|
if not envComputed:
|
||||||
when useNSGetEnviron:
|
when useNSGetEnviron:
|
||||||
var gEnv = NSGetEnviron()^
|
var gEnv = NSGetEnviron()[]
|
||||||
var i = 0
|
var i = 0
|
||||||
while True:
|
while True:
|
||||||
if gEnv[i] == nil: break
|
if gEnv[i] == nil: break
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ proc charSet*(s: set[char]): TPeg {.nosideEffect, rtl, extern: "npegs$1".} =
|
||||||
assert '\0' notin s
|
assert '\0' notin s
|
||||||
result.kind = pkCharChoice
|
result.kind = pkCharChoice
|
||||||
new(result.charChoice)
|
new(result.charChoice)
|
||||||
result.charChoice^ = s
|
result.charChoice[] = s
|
||||||
|
|
||||||
proc len(a: TPeg): int {.inline.} = return a.sons.len
|
proc len(a: TPeg): int {.inline.} = return a.sons.len
|
||||||
proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s)
|
proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s)
|
||||||
|
|
@ -131,9 +131,9 @@ proc addChoice(dest: var TPeg, elem: TPeg) =
|
||||||
# caution! Do not introduce false aliasing here!
|
# caution! Do not introduce false aliasing here!
|
||||||
case elem.kind
|
case elem.kind
|
||||||
of pkCharChoice:
|
of pkCharChoice:
|
||||||
dest.sons[L] = charSet(dest.sons[L].charChoice^ + elem.charChoice^)
|
dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[])
|
||||||
of pkChar:
|
of pkChar:
|
||||||
dest.sons[L] = charSet(dest.sons[L].charChoice^ + {elem.ch})
|
dest.sons[L] = charSet(dest.sons[L].charChoice[] + {elem.ch})
|
||||||
else: add(dest, elem)
|
else: add(dest, elem)
|
||||||
else: add(dest, elem)
|
else: add(dest, elem)
|
||||||
|
|
||||||
|
|
@ -435,7 +435,7 @@ proc toStrAux(r: TPeg, res: var string) =
|
||||||
add(res, 'y')
|
add(res, 'y')
|
||||||
add(res, singleQuoteEsc(r.term))
|
add(res, singleQuoteEsc(r.term))
|
||||||
of pkChar: add(res, singleQuoteEsc(r.ch))
|
of pkChar: add(res, singleQuoteEsc(r.ch))
|
||||||
of pkCharChoice: add(res, charSetEsc(r.charChoice^))
|
of pkCharChoice: add(res, charSetEsc(r.charChoice[]))
|
||||||
of pkNonTerminal: add(res, r.nt.name)
|
of pkNonTerminal: add(res, r.nt.name)
|
||||||
of pkSequence:
|
of pkSequence:
|
||||||
add(res, '(')
|
add(res, '(')
|
||||||
|
|
@ -458,7 +458,7 @@ proc toStrAux(r: TPeg, res: var string) =
|
||||||
add(res, singleQuoteEsc(r.ch))
|
add(res, singleQuoteEsc(r.ch))
|
||||||
add(res, '*')
|
add(res, '*')
|
||||||
of pkGreedyRepSet:
|
of pkGreedyRepSet:
|
||||||
add(res, charSetEsc(r.charChoice^))
|
add(res, charSetEsc(r.charChoice[]))
|
||||||
add(res, '*')
|
add(res, '*')
|
||||||
of pkGreedyAny:
|
of pkGreedyAny:
|
||||||
add(res, ".*")
|
add(res, ".*")
|
||||||
|
|
@ -640,7 +640,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
|
||||||
if p.ch == s[start]: result = 1
|
if p.ch == s[start]: result = 1
|
||||||
else: result = -1
|
else: result = -1
|
||||||
of pkCharChoice:
|
of pkCharChoice:
|
||||||
if contains(p.charChoice^, s[start]): result = 1
|
if contains(p.charChoice[], s[start]): result = 1
|
||||||
else: result = -1
|
else: result = -1
|
||||||
of pkNonTerminal:
|
of pkNonTerminal:
|
||||||
var oldMl = c.ml
|
var oldMl = c.ml
|
||||||
|
|
@ -706,7 +706,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
|
||||||
while ch == s[start+result]: inc(result)
|
while ch == s[start+result]: inc(result)
|
||||||
of pkGreedyRepSet:
|
of pkGreedyRepSet:
|
||||||
result = 0
|
result = 0
|
||||||
while contains(p.charChoice^, s[start+result]): inc(result)
|
while contains(p.charChoice[], s[start+result]): inc(result)
|
||||||
of pkOption:
|
of pkOption:
|
||||||
result = max(0, rawMatch(s, p.sons[0], start, c))
|
result = max(0, rawMatch(s, p.sons[0], start, c))
|
||||||
of pkAndPredicate:
|
of pkAndPredicate:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod's Runtime Library
|
# Nimrod's Runtime Library
|
||||||
# (c) Copyright 2010 Andreas Rumpf
|
# (c) Copyright 2011 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -246,13 +246,13 @@ when not defined(ECMAScript):
|
||||||
proc getTime(): TTime = return timec(nil)
|
proc getTime(): TTime = return timec(nil)
|
||||||
proc getLocalTime(t: TTime): TTimeInfo =
|
proc getLocalTime(t: TTime): TTimeInfo =
|
||||||
var a = t
|
var a = t
|
||||||
result = tmToTimeInfo(localtime(addr(a))^)
|
result = tmToTimeInfo(localtime(addr(a))[])
|
||||||
# copying is needed anyway to provide reentrancity; thus
|
# copying is needed anyway to provide reentrancity; thus
|
||||||
# the convertion is not expensive
|
# the convertion is not expensive
|
||||||
|
|
||||||
proc getGMTime(t: TTime): TTimeInfo =
|
proc getGMTime(t: TTime): TTimeInfo =
|
||||||
var a = t
|
var a = t
|
||||||
result = tmToTimeInfo(gmtime(addr(a))^)
|
result = tmToTimeInfo(gmtime(addr(a))[])
|
||||||
# copying is needed anyway to provide reentrancity; thus
|
# copying is needed anyway to provide reentrancity; thus
|
||||||
# the convertion is not expensive
|
# the convertion is not expensive
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1641,9 +1641,9 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||||
var d: int
|
var d: int
|
||||||
var a = cast[TAddress](aa)
|
var a = cast[TAddress](aa)
|
||||||
case n.typ.size
|
case n.typ.size
|
||||||
of 1: d = ze(cast[ptr int8](a +% n.offset)^)
|
of 1: d = ze(cast[ptr int8](a +% n.offset)[])
|
||||||
of 2: d = ze(cast[ptr int16](a +% n.offset)^)
|
of 2: d = ze(cast[ptr int16](a +% n.offset)[])
|
||||||
of 4: d = int(cast[ptr int32](a +% n.offset)^)
|
of 4: d = int(cast[ptr int32](a +% n.offset)[])
|
||||||
else: assert(false)
|
else: assert(false)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ proc IntSetGet(t: TIntSet, key: int): PTrunk =
|
||||||
proc IntSetPut(t: var TIntSet, key: int): PTrunk =
|
proc IntSetPut(t: var TIntSet, key: int): PTrunk =
|
||||||
result = IntSetGet(t, key)
|
result = IntSetGet(t, key)
|
||||||
if result == nil:
|
if result == nil:
|
||||||
result = cast[PTrunk](llAlloc(allocator, sizeof(result^)))
|
result = cast[PTrunk](llAlloc(allocator, sizeof(result[])))
|
||||||
result.next = t.data[key and high(t.data)]
|
result.next = t.data[key and high(t.data)]
|
||||||
t.data[key and high(t.data)] = result
|
t.data[key and high(t.data)] = result
|
||||||
result.key = key
|
result.key = key
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
|
||||||
case mt.Kind
|
case mt.Kind
|
||||||
of tyString:
|
of tyString:
|
||||||
var x = cast[ppointer](dest)
|
var x = cast[ppointer](dest)
|
||||||
var s2 = cast[ppointer](s)^
|
var s2 = cast[ppointer](s)[]
|
||||||
if s2 == nil or shallow:
|
if s2 == nil or shallow:
|
||||||
unsureAsgnRef(x, s2)
|
unsureAsgnRef(x, s2)
|
||||||
else:
|
else:
|
||||||
unsureAsgnRef(x, copyString(cast[NimString](s2)))
|
unsureAsgnRef(x, copyString(cast[NimString](s2)))
|
||||||
of tySequence:
|
of tySequence:
|
||||||
var s2 = cast[ppointer](src)^
|
var s2 = cast[ppointer](src)[]
|
||||||
var seq = cast[PGenericSeq](s2)
|
var seq = cast[PGenericSeq](s2)
|
||||||
var x = cast[ppointer](dest)
|
var x = cast[ppointer](dest)
|
||||||
if s2 == nil or shallow:
|
if s2 == nil or shallow:
|
||||||
|
|
@ -49,7 +49,7 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
|
||||||
return
|
return
|
||||||
assert(dest != nil)
|
assert(dest != nil)
|
||||||
unsureAsgnRef(x, newObj(mt, seq.len * mt.base.size + GenericSeqSize))
|
unsureAsgnRef(x, newObj(mt, seq.len * mt.base.size + GenericSeqSize))
|
||||||
var dst = cast[taddress](cast[ppointer](dest)^)
|
var dst = cast[taddress](cast[ppointer](dest)[])
|
||||||
for i in 0..seq.len-1:
|
for i in 0..seq.len-1:
|
||||||
genericAssignAux(
|
genericAssignAux(
|
||||||
cast[pointer](dst +% i*% mt.base.size +% GenericSeqSize),
|
cast[pointer](dst +% i*% mt.base.size +% GenericSeqSize),
|
||||||
|
|
@ -67,7 +67,7 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
|
||||||
genericAssignAux(cast[pointer](d +% i*% mt.base.size),
|
genericAssignAux(cast[pointer](d +% i*% mt.base.size),
|
||||||
cast[pointer](s +% i*% mt.base.size), mt.base, shallow)
|
cast[pointer](s +% i*% mt.base.size), mt.base, shallow)
|
||||||
of tyRef:
|
of tyRef:
|
||||||
unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)^)
|
unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)[])
|
||||||
else:
|
else:
|
||||||
copyMem(dest, src, mt.size) # copy raw bits
|
copyMem(dest, src, mt.size) # copy raw bits
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ proc objectInit(dest: Pointer, typ: PNimType) =
|
||||||
# iterate over any structural type
|
# iterate over any structural type
|
||||||
# here we have to init the type field:
|
# here we have to init the type field:
|
||||||
var pint = cast[ptr PNimType](dest)
|
var pint = cast[ptr PNimType](dest)
|
||||||
pint^ = typ
|
pint[] = typ
|
||||||
objectInitAux(dest, typ.node)
|
objectInitAux(dest, typ.node)
|
||||||
of tyTuple, tyPureObject:
|
of tyTuple, tyPureObject:
|
||||||
objectInitAux(dest, typ.node)
|
objectInitAux(dest, typ.node)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod's Runtime Library
|
# Nimrod's Runtime Library
|
||||||
# (c) Copyright 2010 Andreas Rumpf
|
# (c) Copyright 2011 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -244,8 +244,8 @@ proc asgnRef(dest: ppointer, src: pointer) {.compilerProc, inline.} =
|
||||||
assert(not isOnStack(dest))
|
assert(not isOnStack(dest))
|
||||||
# BUGFIX: first incRef then decRef!
|
# BUGFIX: first incRef then decRef!
|
||||||
if src != nil: incRef(usrToCell(src))
|
if src != nil: incRef(usrToCell(src))
|
||||||
if dest^ != nil: decRef(usrToCell(dest^))
|
if dest[] != nil: decRef(usrToCell(dest[]))
|
||||||
dest^ = src
|
dest[] = src
|
||||||
|
|
||||||
proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerProc, inline.} =
|
proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerProc, inline.} =
|
||||||
# the code generator calls this proc if it is known at compile time that no
|
# the code generator calls this proc if it is known at compile time that no
|
||||||
|
|
@ -253,11 +253,11 @@ proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerProc, inline.} =
|
||||||
if src != nil:
|
if src != nil:
|
||||||
var c = usrToCell(src)
|
var c = usrToCell(src)
|
||||||
discard atomicInc(c.refcount, rcIncrement)
|
discard atomicInc(c.refcount, rcIncrement)
|
||||||
if dest^ != nil:
|
if dest[] != nil:
|
||||||
var c = usrToCell(dest^)
|
var c = usrToCell(dest[])
|
||||||
if atomicDec(c.refcount, rcIncrement) <% rcIncrement:
|
if atomicDec(c.refcount, rcIncrement) <% rcIncrement:
|
||||||
rtlAddZCT(c)
|
rtlAddZCT(c)
|
||||||
dest^ = src
|
dest[] = src
|
||||||
|
|
||||||
proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerProc.} =
|
proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerProc.} =
|
||||||
# unsureAsgnRef updates the reference counters only if dest is not on the
|
# unsureAsgnRef updates the reference counters only if dest is not on the
|
||||||
|
|
@ -268,8 +268,8 @@ proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerProc.} =
|
||||||
# XXX finally use assembler for the stack checking instead!
|
# XXX finally use assembler for the stack checking instead!
|
||||||
# the test for '!= nil' is correct, but I got tired of the segfaults
|
# the test for '!= nil' is correct, but I got tired of the segfaults
|
||||||
# resulting from the crappy stack checking:
|
# resulting from the crappy stack checking:
|
||||||
if cast[int](dest^) >=% PageSize: decRef(usrToCell(dest^))
|
if cast[int](dest[]) >=% PageSize: decRef(usrToCell(dest[]))
|
||||||
dest^ = src
|
dest[] = src
|
||||||
|
|
||||||
proc initGC() =
|
proc initGC() =
|
||||||
when not defined(useNimRtl):
|
when not defined(useNimRtl):
|
||||||
|
|
@ -311,7 +311,7 @@ proc forAllChildrenAux(dest: Pointer, mt: PNimType, op: TWalkOp) =
|
||||||
for i in 0..(mt.size div mt.base.size)-1:
|
for i in 0..(mt.size div mt.base.size)-1:
|
||||||
forAllChildrenAux(cast[pointer](d +% i *% mt.base.size), mt.base, op)
|
forAllChildrenAux(cast[pointer](d +% i *% mt.base.size), mt.base, op)
|
||||||
of tyRef, tyString, tySequence: # leaf:
|
of tyRef, tyString, tySequence: # leaf:
|
||||||
doOperation(cast[ppointer](d)^, op)
|
doOperation(cast[ppointer](d)[], op)
|
||||||
of tyObject, tyTuple, tyPureObject:
|
of tyObject, tyTuple, tyPureObject:
|
||||||
forAllSlotsAux(dest, mt.node, op)
|
forAllSlotsAux(dest, mt.node, op)
|
||||||
else: nil
|
else: nil
|
||||||
|
|
@ -545,7 +545,7 @@ when defined(sparc): # For SPARC architecture.
|
||||||
sp = addr(stackTop[0])
|
sp = addr(stackTop[0])
|
||||||
# Addresses decrease as the stack grows.
|
# Addresses decrease as the stack grows.
|
||||||
while sp <= max:
|
while sp <= max:
|
||||||
gcMark(sp^)
|
gcMark(sp[])
|
||||||
sp = cast[ppointer](cast[TAddress](sp) +% sizeof(pointer))
|
sp = cast[ppointer](cast[TAddress](sp) +% sizeof(pointer))
|
||||||
|
|
||||||
elif defined(ELATE):
|
elif defined(ELATE):
|
||||||
|
|
@ -575,7 +575,7 @@ elif stackIncreases:
|
||||||
# sp will traverse the JMP_BUF as well (jmp_buf size is added,
|
# sp will traverse the JMP_BUF as well (jmp_buf size is added,
|
||||||
# otherwise sp would be below the registers structure).
|
# otherwise sp would be below the registers structure).
|
||||||
while sp >=% max:
|
while sp >=% max:
|
||||||
gcMark(cast[ppointer](sp)^)
|
gcMark(cast[ppointer](sp)[])
|
||||||
sp = sp -% sizeof(pointer)
|
sp = sp -% sizeof(pointer)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
@ -598,7 +598,7 @@ else:
|
||||||
var max = cast[TAddress](stackBottom)
|
var max = cast[TAddress](stackBottom)
|
||||||
var sp = cast[TAddress](addr(registers))
|
var sp = cast[TAddress](addr(registers))
|
||||||
while sp <=% max:
|
while sp <=% max:
|
||||||
gcMark(cast[ppointer](sp)^)
|
gcMark(cast[ppointer](sp)[])
|
||||||
sp = sp +% sizeof(pointer)
|
sp = sp +% sizeof(pointer)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
|
@ -611,13 +611,13 @@ proc CollectZCT(gch: var TGcHeap) =
|
||||||
# avoid a deep stack, we move objects to keep the ZCT small.
|
# avoid a deep stack, we move objects to keep the ZCT small.
|
||||||
# This is performance critical!
|
# This is performance critical!
|
||||||
var L = addr(gch.zct.len)
|
var L = addr(gch.zct.len)
|
||||||
while L^ > 0:
|
while L[] > 0:
|
||||||
var c = gch.zct.d[0]
|
var c = gch.zct.d[0]
|
||||||
# remove from ZCT:
|
# remove from ZCT:
|
||||||
assert((c.refcount and colorMask) == rcZct)
|
assert((c.refcount and colorMask) == rcZct)
|
||||||
c.refcount = c.refcount and not colorMask
|
c.refcount = c.refcount and not colorMask
|
||||||
gch.zct.d[0] = gch.zct.d[L^ - 1]
|
gch.zct.d[0] = gch.zct.d[L[] - 1]
|
||||||
dec(L^)
|
dec(L[])
|
||||||
if c.refcount <% rcIncrement:
|
if c.refcount <% rcIncrement:
|
||||||
# It may have a RC > 0, if it is in the hardware stack or
|
# It may have a RC > 0, if it is in the hardware stack or
|
||||||
# it has not been removed yet from the ZCT. This is because
|
# it has not been removed yet from the ZCT. This is because
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,10 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) =
|
||||||
add result, "{"
|
add result, "{"
|
||||||
var u: int64
|
var u: int64
|
||||||
case typ.size
|
case typ.size
|
||||||
of 1: u = ze64(cast[ptr int8](p)^)
|
of 1: u = ze64(cast[ptr int8](p)[])
|
||||||
of 2: u = ze64(cast[ptr int16](p)^)
|
of 2: u = ze64(cast[ptr int16](p)[])
|
||||||
of 4: u = ze64(cast[ptr int32](p)^)
|
of 4: u = ze64(cast[ptr int32](p)[])
|
||||||
of 8: u = cast[ptr int64](p)^
|
of 8: u = cast[ptr int64](p)[]
|
||||||
else:
|
else:
|
||||||
var a = cast[pbyteArray](p)
|
var a = cast[pbyteArray](p)
|
||||||
for i in 0 .. typ.size*8-1:
|
for i in 0 .. typ.size*8-1:
|
||||||
|
|
@ -194,31 +194,31 @@ when not defined(useNimRtl):
|
||||||
of tyArray: reprArray(result, p, typ, cl)
|
of tyArray: reprArray(result, p, typ, cl)
|
||||||
of tyTuple, tyPureObject: reprRecord(result, p, typ, cl)
|
of tyTuple, tyPureObject: reprRecord(result, p, typ, cl)
|
||||||
of tyObject:
|
of tyObject:
|
||||||
var t = cast[ptr PNimType](p)^
|
var t = cast[ptr PNimType](p)[]
|
||||||
reprRecord(result, p, t, cl)
|
reprRecord(result, p, t, cl)
|
||||||
of tyRef, tyPtr:
|
of tyRef, tyPtr:
|
||||||
assert(p != nil)
|
assert(p != nil)
|
||||||
if cast[ppointer](p)^ == nil: add result, "nil"
|
if cast[ppointer](p)[] == nil: add result, "nil"
|
||||||
else: reprRef(result, cast[ppointer](p)^, typ, cl)
|
else: reprRef(result, cast[ppointer](p)[], typ, cl)
|
||||||
of tySequence:
|
of tySequence:
|
||||||
reprSequence(result, cast[ppointer](p)^, typ, cl)
|
reprSequence(result, cast[ppointer](p)[], typ, cl)
|
||||||
of tyInt: add result, $(cast[ptr int](p)^)
|
of tyInt: add result, $(cast[ptr int](p)[])
|
||||||
of tyInt8: add result, $int(cast[ptr Int8](p)^)
|
of tyInt8: add result, $int(cast[ptr Int8](p)[])
|
||||||
of tyInt16: add result, $int(cast[ptr Int16](p)^)
|
of tyInt16: add result, $int(cast[ptr Int16](p)[])
|
||||||
of tyInt32: add result, $int(cast[ptr Int32](p)^)
|
of tyInt32: add result, $int(cast[ptr Int32](p)[])
|
||||||
of tyInt64: add result, $(cast[ptr Int64](p)^)
|
of tyInt64: add result, $(cast[ptr Int64](p)[])
|
||||||
of tyFloat: add result, $(cast[ptr float](p)^)
|
of tyFloat: add result, $(cast[ptr float](p)[])
|
||||||
of tyFloat32: add result, $(cast[ptr float32](p)^)
|
of tyFloat32: add result, $(cast[ptr float32](p)[])
|
||||||
of tyFloat64: add result, $(cast[ptr float64](p)^)
|
of tyFloat64: add result, $(cast[ptr float64](p)[])
|
||||||
of tyEnum: add result, reprEnum(cast[ptr int](p)^, typ)
|
of tyEnum: add result, reprEnum(cast[ptr int](p)[], typ)
|
||||||
of tyBool: add result, reprBool(cast[ptr bool](p)^)
|
of tyBool: add result, reprBool(cast[ptr bool](p)[])
|
||||||
of tyChar: add result, reprChar(cast[ptr char](p)^)
|
of tyChar: add result, reprChar(cast[ptr char](p)[])
|
||||||
of tyString: reprStrAux(result, cast[ptr string](p)^)
|
of tyString: reprStrAux(result, cast[ptr string](p)[])
|
||||||
of tyCString: reprStrAux(result, $(cast[ptr cstring](p)^))
|
of tyCString: reprStrAux(result, $(cast[ptr cstring](p)[]))
|
||||||
of tyRange: reprAux(result, p, typ.base, cl)
|
of tyRange: reprAux(result, p, typ.base, cl)
|
||||||
of tyProc, tyPointer:
|
of tyProc, tyPointer:
|
||||||
if cast[ppointer](p)^ == nil: add result, "nil"
|
if cast[ppointer](p)[] == nil: add result, "nil"
|
||||||
else: add result, reprPointer(cast[ppointer](p)^)
|
else: add result, reprPointer(cast[ppointer](p)[])
|
||||||
else:
|
else:
|
||||||
add result, "(invalid data!)"
|
add result, "(invalid data!)"
|
||||||
inc(cl.recdepth)
|
inc(cl.recdepth)
|
||||||
|
|
|
||||||
|
|
@ -564,7 +564,7 @@ proc SetUserData*(parser: PParser, userData: pointer){.cdecl,
|
||||||
# Returns the last value set by XML_SetUserData or NULL.
|
# Returns the last value set by XML_SetUserData or NULL.
|
||||||
|
|
||||||
template GetUserData*(parser: expr): expr =
|
template GetUserData*(parser: expr): expr =
|
||||||
(cast[ptr pointer]((parser))^ )
|
(cast[ptr pointer]((parser))[] )
|
||||||
|
|
||||||
# This is equivalent to supplying an encoding argument to
|
# This is equivalent to supplying an encoding argument to
|
||||||
# XML_ParserCreate. On success XML_SetEncoding returns non-zero,
|
# XML_ParserCreate. On success XML_SetEncoding returns non-zero,
|
||||||
|
|
|
||||||
|
|
@ -3468,8 +3468,8 @@ when false:
|
||||||
result = g_array_insert_vals(a, i, addr(v), 1)
|
result = g_array_insert_vals(a, i, addr(v), 1)
|
||||||
|
|
||||||
proc g_ptr_array_index*(parray: PGPtrArray, index: guint): gpointer =
|
proc g_ptr_array_index*(parray: PGPtrArray, index: guint): gpointer =
|
||||||
result = cast[PGPointer](cast[int](parray ^. pdata) +
|
result = cast[PGPointer](cast[int](parray []. pdata) +
|
||||||
index * SizeOf(GPointer))^
|
index * SizeOf(GPointer))[]
|
||||||
|
|
||||||
proc G_THREAD_ERROR*(): TGQuark =
|
proc G_THREAD_ERROR*(): TGQuark =
|
||||||
result = g_thread_error_quark()
|
result = g_thread_error_quark()
|
||||||
|
|
@ -3754,7 +3754,7 @@ proc TGIOChannel_set_is_seekable*(a: PGIOChannel, `is_seekable`: guint) =
|
||||||
bm_TGIOChannel_is_seekable)
|
bm_TGIOChannel_is_seekable)
|
||||||
|
|
||||||
proc utf8_next_char*(p: pguchar): pguchar =
|
proc utf8_next_char*(p: pguchar): pguchar =
|
||||||
result = cast[pguchar](cast[TAddress](p) + 1) # p + ord((g_utf8_skip + p^ )^ )
|
result = cast[pguchar](cast[TAddress](p) + 1) # p + ord((g_utf8_skip + p[] )[] )
|
||||||
|
|
||||||
when false:
|
when false:
|
||||||
proc GLIB_CHECK_VERSION*(major, minor, micro: guint): bool =
|
proc GLIB_CHECK_VERSION*(major, minor, micro: guint): bool =
|
||||||
|
|
|
||||||
|
|
@ -10892,127 +10892,127 @@ proc FUNDAMENTAL_TYPE*(thetype: GType): GType =
|
||||||
|
|
||||||
proc VALUE_CHAR*(a: TArg): gchar =
|
proc VALUE_CHAR*(a: TArg): gchar =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gchar](addr(a.d))^
|
Result = cast[ptr gchar](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_UCHAR*(a: TArg): guchar =
|
proc VALUE_UCHAR*(a: TArg): guchar =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr guchar](addr(a.d))^
|
Result = cast[ptr guchar](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_BOOL*(a: TArg): gboolean =
|
proc VALUE_BOOL*(a: TArg): gboolean =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gboolean](addr(a.d))^
|
Result = cast[ptr gboolean](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_INT*(a: TArg): gint =
|
proc VALUE_INT*(a: TArg): gint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gint](addr(a.d))^
|
Result = cast[ptr gint](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_UINT*(a: TArg): guint =
|
proc VALUE_UINT*(a: TArg): guint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr guint](addr(a.d))^
|
Result = cast[ptr guint](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_LONG*(a: TArg): glong =
|
proc VALUE_LONG*(a: TArg): glong =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr glong](addr(a.d))^
|
Result = cast[ptr glong](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_ULONG*(a: TArg): gulong =
|
proc VALUE_ULONG*(a: TArg): gulong =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gulong](addr(a.d))^
|
Result = cast[ptr gulong](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_FLOAT*(a: TArg): gfloat =
|
proc VALUE_FLOAT*(a: TArg): gfloat =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gfloat](addr(a.d))^
|
Result = cast[ptr gfloat](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_DOUBLE*(a: TArg): gdouble =
|
proc VALUE_DOUBLE*(a: TArg): gdouble =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gdouble](addr(a.d))^
|
Result = cast[ptr gdouble](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_STRING*(a: TArg): cstring =
|
proc VALUE_STRING*(a: TArg): cstring =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr cstring](addr(a.d))^
|
Result = cast[ptr cstring](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_ENUM*(a: TArg): gint =
|
proc VALUE_ENUM*(a: TArg): gint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gint](addr(a.d))^
|
Result = cast[ptr gint](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_FLAGS*(a: TArg): guint =
|
proc VALUE_FLAGS*(a: TArg): guint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr guint](addr(a.d))^
|
Result = cast[ptr guint](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_BOXED*(a: TArg): gpointer =
|
proc VALUE_BOXED*(a: TArg): gpointer =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gpointer](addr(a.d))^
|
Result = cast[ptr gpointer](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_OBJECT*(a: TArg): PObject =
|
proc VALUE_OBJECT*(a: TArg): PObject =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr PObject](addr(a.d))^
|
Result = cast[ptr PObject](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_POINTER*(a: TArg): GPointer =
|
proc VALUE_POINTER*(a: TArg): GPointer =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr gpointer](addr(a.d))^
|
Result = cast[ptr gpointer](addr(a.d))[]
|
||||||
|
|
||||||
proc VALUE_SIGNAL*(a: TArg): TArgSignalData =
|
proc VALUE_SIGNAL*(a: TArg): TArgSignalData =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr TArgSignalData](addr(a.d))^
|
Result = cast[ptr TArgSignalData](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_CHAR*(a: TArg): cstring =
|
proc RETLOC_CHAR*(a: TArg): cstring =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr cstring](addr(a.d))^
|
Result = cast[ptr cstring](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_UCHAR*(a: TArg): Pguchar =
|
proc RETLOC_UCHAR*(a: TArg): Pguchar =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pguchar](addr(a.d))^
|
Result = cast[ptr pguchar](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_BOOL*(a: TArg): Pgboolean =
|
proc RETLOC_BOOL*(a: TArg): Pgboolean =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgboolean](addr(a.d))^
|
Result = cast[ptr pgboolean](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_INT*(a: TArg): Pgint =
|
proc RETLOC_INT*(a: TArg): Pgint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgint](addr(a.d))^
|
Result = cast[ptr pgint](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_UINT*(a: TArg): Pguint =
|
proc RETLOC_UINT*(a: TArg): Pguint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pguint](addr(a.d))^
|
Result = cast[ptr pguint](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_LONG*(a: TArg): Pglong =
|
proc RETLOC_LONG*(a: TArg): Pglong =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pglong](addr(a.d))^
|
Result = cast[ptr pglong](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_ULONG*(a: TArg): Pgulong =
|
proc RETLOC_ULONG*(a: TArg): Pgulong =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgulong](addr(a.d))^
|
Result = cast[ptr pgulong](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_FLOAT*(a: TArg): Pgfloat =
|
proc RETLOC_FLOAT*(a: TArg): Pgfloat =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgfloat](addr(a.d))^
|
Result = cast[ptr pgfloat](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_DOUBLE*(a: TArg): Pgdouble =
|
proc RETLOC_DOUBLE*(a: TArg): Pgdouble =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgdouble](addr(a.d))^
|
Result = cast[ptr pgdouble](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_STRING*(a: TArg): Ppgchar =
|
proc RETLOC_STRING*(a: TArg): Ppgchar =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr Ppgchar](addr(a.d))^
|
Result = cast[ptr Ppgchar](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_ENUM*(a: TArg): Pgint =
|
proc RETLOC_ENUM*(a: TArg): Pgint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr Pgint](addr(a.d))^
|
Result = cast[ptr Pgint](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_FLAGS*(a: TArg): Pguint =
|
proc RETLOC_FLAGS*(a: TArg): Pguint =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pguint](addr(a.d))^
|
Result = cast[ptr pguint](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_BOXED*(a: TArg): Pgpointer =
|
proc RETLOC_BOXED*(a: TArg): Pgpointer =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgpointer](addr(a.d))^
|
Result = cast[ptr pgpointer](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_OBJECT*(a: TArg): PPGtkObject =
|
proc RETLOC_OBJECT*(a: TArg): PPGtkObject =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr ppgtkobject](addr(a.d))^
|
Result = cast[ptr ppgtkobject](addr(a.d))[]
|
||||||
|
|
||||||
proc RETLOC_POINTER*(a: TArg): Pgpointer =
|
proc RETLOC_POINTER*(a: TArg): Pgpointer =
|
||||||
var a = a
|
var a = a
|
||||||
Result = cast[ptr pgpointer](addr(a.d))^
|
Result = cast[ptr pgpointer](addr(a.d))[]
|
||||||
|
|
||||||
proc TYPE_WIDGET*(): GType =
|
proc TYPE_WIDGET*(): GType =
|
||||||
result = widget_get_type()
|
result = widget_get_type()
|
||||||
|
|
|
||||||
|
|
@ -1337,7 +1337,7 @@ proc PyImport_ExecCodeModule(name: string, codeobject: PPyObject): PPyObject =
|
||||||
Py_XDECREF(v)
|
Py_XDECREF(v)
|
||||||
modules = PyImport_GetModuleDict()
|
modules = PyImport_GetModuleDict()
|
||||||
if PyDict_GetItemString(modules, cstring(name)) == nil:
|
if PyDict_GetItemString(modules, cstring(name)) == nil:
|
||||||
PyErr_SetString(PyExc_ImportError^ , cstring(
|
PyErr_SetString(PyExc_ImportError[] , cstring(
|
||||||
"Loaded module " & name & "not found in sys.modules"))
|
"Loaded module " & name & "not found in sys.modules"))
|
||||||
return nil
|
return nil
|
||||||
Py_XINCREF(m)
|
Py_XINCREF(m)
|
||||||
|
|
@ -1371,37 +1371,37 @@ proc PyTuple_Check(obj: PPyObject): bool =
|
||||||
Result = PyObject_TypeCheck(obj, PyTuple_Type)
|
Result = PyObject_TypeCheck(obj, PyTuple_Type)
|
||||||
|
|
||||||
proc PyTuple_CheckExact(obj: PPyObject): bool =
|
proc PyTuple_CheckExact(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyTuple_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyTuple_Type)
|
||||||
|
|
||||||
proc PyInstance_Check(obj: PPyObject): bool =
|
proc PyInstance_Check(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyInstance_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyInstance_Type)
|
||||||
|
|
||||||
proc PyClass_Check(obj: PPyObject): bool =
|
proc PyClass_Check(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyClass_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyClass_Type)
|
||||||
|
|
||||||
proc PyMethod_Check(obj: PPyObject): bool =
|
proc PyMethod_Check(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyMethod_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyMethod_Type)
|
||||||
|
|
||||||
proc PyList_Check(obj: PPyObject): bool =
|
proc PyList_Check(obj: PPyObject): bool =
|
||||||
Result = PyObject_TypeCheck(obj, PyList_Type)
|
Result = PyObject_TypeCheck(obj, PyList_Type)
|
||||||
|
|
||||||
proc PyList_CheckExact(obj: PPyObject): bool =
|
proc PyList_CheckExact(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyList_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyList_Type)
|
||||||
|
|
||||||
proc PyDict_Check(obj: PPyObject): bool =
|
proc PyDict_Check(obj: PPyObject): bool =
|
||||||
Result = PyObject_TypeCheck(obj, PyDict_Type)
|
Result = PyObject_TypeCheck(obj, PyDict_Type)
|
||||||
|
|
||||||
proc PyDict_CheckExact(obj: PPyObject): bool =
|
proc PyDict_CheckExact(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyDict_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyDict_Type)
|
||||||
|
|
||||||
proc PyModule_Check(obj: PPyObject): bool =
|
proc PyModule_Check(obj: PPyObject): bool =
|
||||||
Result = PyObject_TypeCheck(obj, PyModule_Type)
|
Result = PyObject_TypeCheck(obj, PyModule_Type)
|
||||||
|
|
||||||
proc PyModule_CheckExact(obj: PPyObject): bool =
|
proc PyModule_CheckExact(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PyModule_Type)
|
Result = (obj != nil) and (obj[].ob_type == PyModule_Type)
|
||||||
|
|
||||||
proc PySlice_Check(obj: PPyObject): bool =
|
proc PySlice_Check(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and (obj^ .ob_type == PySlice_Type)
|
Result = (obj != nil) and (obj[].ob_type == PySlice_Type)
|
||||||
|
|
||||||
proc PyFunction_Check(obj: PPyObject): bool =
|
proc PyFunction_Check(obj: PPyObject): bool =
|
||||||
Result = (obj != nil) and
|
Result = (obj != nil) and
|
||||||
|
|
|
||||||
|
|
@ -2525,8 +2525,8 @@ proc AllocSurface(flags: int32, width, height, depth: int,
|
||||||
AMask)
|
AMask)
|
||||||
|
|
||||||
proc MustLock(Surface: PSurface): bool =
|
proc MustLock(Surface: PSurface): bool =
|
||||||
Result = ((surface^ .offset != 0) or
|
Result = ((surface[] .offset != 0) or
|
||||||
((surface^ .flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0))
|
((surface[] .flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0))
|
||||||
|
|
||||||
proc LockMutex(mutex: Pmutex): int =
|
proc LockMutex(mutex: Pmutex): int =
|
||||||
Result = mutexP(mutex)
|
Result = mutexP(mutex)
|
||||||
|
|
|
||||||
|
|
@ -2065,154 +2065,154 @@ when defined(MACROS):
|
||||||
|
|
||||||
when defined(MACROS):
|
when defined(MACROS):
|
||||||
proc ConnectionNumber(dpy: PDisplay): cint =
|
proc ConnectionNumber(dpy: PDisplay): cint =
|
||||||
ConnectionNumber = (PXPrivDisplay(dpy))^ .fd
|
ConnectionNumber = (PXPrivDisplay(dpy))[] .fd
|
||||||
|
|
||||||
proc RootWindow(dpy: PDisplay, scr: cint): TWindow =
|
proc RootWindow(dpy: PDisplay, scr: cint): TWindow =
|
||||||
RootWindow = (ScreenOfDisplay(dpy, scr))^ .root
|
RootWindow = (ScreenOfDisplay(dpy, scr))[] .root
|
||||||
|
|
||||||
proc DefaultScreen(dpy: PDisplay): cint =
|
proc DefaultScreen(dpy: PDisplay): cint =
|
||||||
DefaultScreen = (PXPrivDisplay(dpy))^ .default_screen
|
DefaultScreen = (PXPrivDisplay(dpy))[] .default_screen
|
||||||
|
|
||||||
proc DefaultRootWindow(dpy: PDisplay): TWindow =
|
proc DefaultRootWindow(dpy: PDisplay): TWindow =
|
||||||
DefaultRootWindow = (ScreenOfDisplay(dpy, DefaultScreen(dpy)))^ .root
|
DefaultRootWindow = (ScreenOfDisplay(dpy, DefaultScreen(dpy)))[] .root
|
||||||
|
|
||||||
proc DefaultVisual(dpy: PDisplay, scr: cint): PVisual =
|
proc DefaultVisual(dpy: PDisplay, scr: cint): PVisual =
|
||||||
DefaultVisual = (ScreenOfDisplay(dpy, scr))^ .root_visual
|
DefaultVisual = (ScreenOfDisplay(dpy, scr))[] .root_visual
|
||||||
|
|
||||||
proc DefaultGC(dpy: PDisplay, scr: cint): TGC =
|
proc DefaultGC(dpy: PDisplay, scr: cint): TGC =
|
||||||
DefaultGC = (ScreenOfDisplay(dpy, scr))^ .default_gc
|
DefaultGC = (ScreenOfDisplay(dpy, scr))[] .default_gc
|
||||||
|
|
||||||
proc BlackPixel(dpy: PDisplay, scr: cint): culong =
|
proc BlackPixel(dpy: PDisplay, scr: cint): culong =
|
||||||
BlackPixel = (ScreenOfDisplay(dpy, scr))^ .black_pixel
|
BlackPixel = (ScreenOfDisplay(dpy, scr))[] .black_pixel
|
||||||
|
|
||||||
proc WhitePixel(dpy: PDisplay, scr: cint): culong =
|
proc WhitePixel(dpy: PDisplay, scr: cint): culong =
|
||||||
WhitePixel = (ScreenOfDisplay(dpy, scr))^ .white_pixel
|
WhitePixel = (ScreenOfDisplay(dpy, scr))[] .white_pixel
|
||||||
|
|
||||||
proc QLength(dpy: PDisplay): cint =
|
proc QLength(dpy: PDisplay): cint =
|
||||||
QLength = (PXPrivDisplay(dpy))^ .qlen
|
QLength = (PXPrivDisplay(dpy))[] .qlen
|
||||||
|
|
||||||
proc DisplayWidth(dpy: PDisplay, scr: cint): cint =
|
proc DisplayWidth(dpy: PDisplay, scr: cint): cint =
|
||||||
DisplayWidth = (ScreenOfDisplay(dpy, scr))^ .width
|
DisplayWidth = (ScreenOfDisplay(dpy, scr))[] .width
|
||||||
|
|
||||||
proc DisplayHeight(dpy: PDisplay, scr: cint): cint =
|
proc DisplayHeight(dpy: PDisplay, scr: cint): cint =
|
||||||
DisplayHeight = (ScreenOfDisplay(dpy, scr))^ .height
|
DisplayHeight = (ScreenOfDisplay(dpy, scr))[] .height
|
||||||
|
|
||||||
proc DisplayWidthMM(dpy: PDisplay, scr: cint): cint =
|
proc DisplayWidthMM(dpy: PDisplay, scr: cint): cint =
|
||||||
DisplayWidthMM = (ScreenOfDisplay(dpy, scr))^ .mwidth
|
DisplayWidthMM = (ScreenOfDisplay(dpy, scr))[] .mwidth
|
||||||
|
|
||||||
proc DisplayHeightMM(dpy: PDisplay, scr: cint): cint =
|
proc DisplayHeightMM(dpy: PDisplay, scr: cint): cint =
|
||||||
DisplayHeightMM = (ScreenOfDisplay(dpy, scr))^ .mheight
|
DisplayHeightMM = (ScreenOfDisplay(dpy, scr))[] .mheight
|
||||||
|
|
||||||
proc DisplayPlanes(dpy: PDisplay, scr: cint): cint =
|
proc DisplayPlanes(dpy: PDisplay, scr: cint): cint =
|
||||||
DisplayPlanes = (ScreenOfDisplay(dpy, scr))^ .root_depth
|
DisplayPlanes = (ScreenOfDisplay(dpy, scr))[] .root_depth
|
||||||
|
|
||||||
proc DisplayCells(dpy: PDisplay, scr: cint): cint =
|
proc DisplayCells(dpy: PDisplay, scr: cint): cint =
|
||||||
DisplayCells = (DefaultVisual(dpy, scr))^ .map_entries
|
DisplayCells = (DefaultVisual(dpy, scr))[] .map_entries
|
||||||
|
|
||||||
proc ScreenCount(dpy: PDisplay): cint =
|
proc ScreenCount(dpy: PDisplay): cint =
|
||||||
ScreenCount = (PXPrivDisplay(dpy))^ .nscreens
|
ScreenCount = (PXPrivDisplay(dpy))[] .nscreens
|
||||||
|
|
||||||
proc ServerVendor(dpy: PDisplay): cstring =
|
proc ServerVendor(dpy: PDisplay): cstring =
|
||||||
ServerVendor = (PXPrivDisplay(dpy))^ .vendor
|
ServerVendor = (PXPrivDisplay(dpy))[] .vendor
|
||||||
|
|
||||||
proc ProtocolVersion(dpy: PDisplay): cint =
|
proc ProtocolVersion(dpy: PDisplay): cint =
|
||||||
ProtocolVersion = (PXPrivDisplay(dpy))^ .proto_major_version
|
ProtocolVersion = (PXPrivDisplay(dpy))[] .proto_major_version
|
||||||
|
|
||||||
proc ProtocolRevision(dpy: PDisplay): cint =
|
proc ProtocolRevision(dpy: PDisplay): cint =
|
||||||
ProtocolRevision = (PXPrivDisplay(dpy))^ .proto_minor_version
|
ProtocolRevision = (PXPrivDisplay(dpy))[] .proto_minor_version
|
||||||
|
|
||||||
proc VendorRelease(dpy: PDisplay): cint =
|
proc VendorRelease(dpy: PDisplay): cint =
|
||||||
VendorRelease = (PXPrivDisplay(dpy))^ .release
|
VendorRelease = (PXPrivDisplay(dpy))[] .release
|
||||||
|
|
||||||
proc DisplayString(dpy: PDisplay): cstring =
|
proc DisplayString(dpy: PDisplay): cstring =
|
||||||
DisplayString = (PXPrivDisplay(dpy))^ .display_name
|
DisplayString = (PXPrivDisplay(dpy))[] .display_name
|
||||||
|
|
||||||
proc DefaultDepth(dpy: PDisplay, scr: cint): cint =
|
proc DefaultDepth(dpy: PDisplay, scr: cint): cint =
|
||||||
DefaultDepth = (ScreenOfDisplay(dpy, scr))^ .root_depth
|
DefaultDepth = (ScreenOfDisplay(dpy, scr))[] .root_depth
|
||||||
|
|
||||||
proc DefaultColormap(dpy: PDisplay, scr: cint): TColormap =
|
proc DefaultColormap(dpy: PDisplay, scr: cint): TColormap =
|
||||||
DefaultColormap = (ScreenOfDisplay(dpy, scr))^ .cmap
|
DefaultColormap = (ScreenOfDisplay(dpy, scr))[] .cmap
|
||||||
|
|
||||||
proc BitmapUnit(dpy: PDisplay): cint =
|
proc BitmapUnit(dpy: PDisplay): cint =
|
||||||
BitmapUnit = (PXPrivDisplay(dpy))^ .bitmap_unit
|
BitmapUnit = (PXPrivDisplay(dpy))[] .bitmap_unit
|
||||||
|
|
||||||
proc BitmapBitOrder(dpy: PDisplay): cint =
|
proc BitmapBitOrder(dpy: PDisplay): cint =
|
||||||
BitmapBitOrder = (PXPrivDisplay(dpy))^ .bitmap_bit_order
|
BitmapBitOrder = (PXPrivDisplay(dpy))[] .bitmap_bit_order
|
||||||
|
|
||||||
proc BitmapPad(dpy: PDisplay): cint =
|
proc BitmapPad(dpy: PDisplay): cint =
|
||||||
BitmapPad = (PXPrivDisplay(dpy))^ .bitmap_pad
|
BitmapPad = (PXPrivDisplay(dpy))[] .bitmap_pad
|
||||||
|
|
||||||
proc ImageByteOrder(dpy: PDisplay): cint =
|
proc ImageByteOrder(dpy: PDisplay): cint =
|
||||||
ImageByteOrder = (PXPrivDisplay(dpy))^ .byte_order
|
ImageByteOrder = (PXPrivDisplay(dpy))[] .byte_order
|
||||||
|
|
||||||
proc NextRequest(dpy: PDisplay): culong =
|
proc NextRequest(dpy: PDisplay): culong =
|
||||||
NextRequest = ((PXPrivDisplay(dpy))^ .request) + 1
|
NextRequest = ((PXPrivDisplay(dpy))[] .request) + 1
|
||||||
|
|
||||||
proc LastKnownRequestProcessed(dpy: PDisplay): culong =
|
proc LastKnownRequestProcessed(dpy: PDisplay): culong =
|
||||||
LastKnownRequestProcessed = (PXPrivDisplay(dpy))^ .last_request_read
|
LastKnownRequestProcessed = (PXPrivDisplay(dpy))[] .last_request_read
|
||||||
|
|
||||||
proc ScreenOfDisplay(dpy: PDisplay, scr: cint): PScreen =
|
proc ScreenOfDisplay(dpy: PDisplay, scr: cint): PScreen =
|
||||||
ScreenOfDisplay = addr((((PXPrivDisplay(dpy))^ .screens)[scr]))
|
ScreenOfDisplay = addr((((PXPrivDisplay(dpy))[] .screens)[scr]))
|
||||||
|
|
||||||
proc DefaultScreenOfDisplay(dpy: PDisplay): PScreen =
|
proc DefaultScreenOfDisplay(dpy: PDisplay): PScreen =
|
||||||
DefaultScreenOfDisplay = ScreenOfDisplay(dpy, DefaultScreen(dpy))
|
DefaultScreenOfDisplay = ScreenOfDisplay(dpy, DefaultScreen(dpy))
|
||||||
|
|
||||||
proc DisplayOfScreen(s: PScreen): PDisplay =
|
proc DisplayOfScreen(s: PScreen): PDisplay =
|
||||||
DisplayOfScreen = s^ .display
|
DisplayOfScreen = s[] .display
|
||||||
|
|
||||||
proc RootWindowOfScreen(s: PScreen): TWindow =
|
proc RootWindowOfScreen(s: PScreen): TWindow =
|
||||||
RootWindowOfScreen = s^ .root
|
RootWindowOfScreen = s[] .root
|
||||||
|
|
||||||
proc BlackPixelOfScreen(s: PScreen): culong =
|
proc BlackPixelOfScreen(s: PScreen): culong =
|
||||||
BlackPixelOfScreen = s^ .black_pixel
|
BlackPixelOfScreen = s[] .black_pixel
|
||||||
|
|
||||||
proc WhitePixelOfScreen(s: PScreen): culong =
|
proc WhitePixelOfScreen(s: PScreen): culong =
|
||||||
WhitePixelOfScreen = s^ .white_pixel
|
WhitePixelOfScreen = s[] .white_pixel
|
||||||
|
|
||||||
proc DefaultColormapOfScreen(s: PScreen): TColormap =
|
proc DefaultColormapOfScreen(s: PScreen): TColormap =
|
||||||
DefaultColormapOfScreen = s^ .cmap
|
DefaultColormapOfScreen = s[] .cmap
|
||||||
|
|
||||||
proc DefaultDepthOfScreen(s: PScreen): cint =
|
proc DefaultDepthOfScreen(s: PScreen): cint =
|
||||||
DefaultDepthOfScreen = s^ .root_depth
|
DefaultDepthOfScreen = s[] .root_depth
|
||||||
|
|
||||||
proc DefaultGCOfScreen(s: PScreen): TGC =
|
proc DefaultGCOfScreen(s: PScreen): TGC =
|
||||||
DefaultGCOfScreen = s^ .default_gc
|
DefaultGCOfScreen = s[] .default_gc
|
||||||
|
|
||||||
proc DefaultVisualOfScreen(s: PScreen): PVisual =
|
proc DefaultVisualOfScreen(s: PScreen): PVisual =
|
||||||
DefaultVisualOfScreen = s^ .root_visual
|
DefaultVisualOfScreen = s[] .root_visual
|
||||||
|
|
||||||
proc WidthOfScreen(s: PScreen): cint =
|
proc WidthOfScreen(s: PScreen): cint =
|
||||||
WidthOfScreen = s^ .width
|
WidthOfScreen = s[] .width
|
||||||
|
|
||||||
proc HeightOfScreen(s: PScreen): cint =
|
proc HeightOfScreen(s: PScreen): cint =
|
||||||
HeightOfScreen = s^ .height
|
HeightOfScreen = s[] .height
|
||||||
|
|
||||||
proc WidthMMOfScreen(s: PScreen): cint =
|
proc WidthMMOfScreen(s: PScreen): cint =
|
||||||
WidthMMOfScreen = s^ .mwidth
|
WidthMMOfScreen = s[] .mwidth
|
||||||
|
|
||||||
proc HeightMMOfScreen(s: PScreen): cint =
|
proc HeightMMOfScreen(s: PScreen): cint =
|
||||||
HeightMMOfScreen = s^ .mheight
|
HeightMMOfScreen = s[] .mheight
|
||||||
|
|
||||||
proc PlanesOfScreen(s: PScreen): cint =
|
proc PlanesOfScreen(s: PScreen): cint =
|
||||||
PlanesOfScreen = s^ .root_depth
|
PlanesOfScreen = s[] .root_depth
|
||||||
|
|
||||||
proc CellsOfScreen(s: PScreen): cint =
|
proc CellsOfScreen(s: PScreen): cint =
|
||||||
CellsOfScreen = (DefaultVisualOfScreen(s))^ .map_entries
|
CellsOfScreen = (DefaultVisualOfScreen(s))[] .map_entries
|
||||||
|
|
||||||
proc MinCmapsOfScreen(s: PScreen): cint =
|
proc MinCmapsOfScreen(s: PScreen): cint =
|
||||||
MinCmapsOfScreen = s^ .min_maps
|
MinCmapsOfScreen = s[] .min_maps
|
||||||
|
|
||||||
proc MaxCmapsOfScreen(s: PScreen): cint =
|
proc MaxCmapsOfScreen(s: PScreen): cint =
|
||||||
MaxCmapsOfScreen = s^ .max_maps
|
MaxCmapsOfScreen = s[] .max_maps
|
||||||
|
|
||||||
proc DoesSaveUnders(s: PScreen): TBool =
|
proc DoesSaveUnders(s: PScreen): TBool =
|
||||||
DoesSaveUnders = s^ .save_unders
|
DoesSaveUnders = s[] .save_unders
|
||||||
|
|
||||||
proc DoesBackingStore(s: PScreen): cint =
|
proc DoesBackingStore(s: PScreen): cint =
|
||||||
DoesBackingStore = s^ .backing_store
|
DoesBackingStore = s[] .backing_store
|
||||||
|
|
||||||
proc EventMaskOfScreen(s: PScreen): clong =
|
proc EventMaskOfScreen(s: PScreen): clong =
|
||||||
EventMaskOfScreen = s^ .root_input_mask
|
EventMaskOfScreen = s[] .root_input_mask
|
||||||
|
|
||||||
proc XAllocID(dpy: PDisplay): TXID =
|
proc XAllocID(dpy: PDisplay): TXID =
|
||||||
XAllocID = (PXPrivDisplay(dpy))^ .resource_alloc(dpy)
|
XAllocID = (PXPrivDisplay(dpy))[] .resource_alloc(dpy)
|
||||||
|
|
|
||||||
|
|
@ -375,19 +375,19 @@ when defined(MACROS):
|
||||||
|
|
||||||
when defined(MACROS):
|
when defined(MACROS):
|
||||||
proc XDestroyImage(ximage: PXImage): cint =
|
proc XDestroyImage(ximage: PXImage): cint =
|
||||||
XDestroyImage = ximage^ .f.destroy_image(ximage)
|
XDestroyImage = ximage[] .f.destroy_image(ximage)
|
||||||
|
|
||||||
proc XGetPixel(ximage: PXImage, x, y: cint): culong =
|
proc XGetPixel(ximage: PXImage, x, y: cint): culong =
|
||||||
XGetPixel = ximage^ .f.get_pixel(ximage, x, y)
|
XGetPixel = ximage[] .f.get_pixel(ximage, x, y)
|
||||||
|
|
||||||
proc XPutPixel(ximage: PXImage, x, y: cint, pixel: culong): cint =
|
proc XPutPixel(ximage: PXImage, x, y: cint, pixel: culong): cint =
|
||||||
XPutPixel = ximage^ .f.put_pixel(ximage, x, y, pixel)
|
XPutPixel = ximage[] .f.put_pixel(ximage, x, y, pixel)
|
||||||
|
|
||||||
proc XSubImage(ximage: PXImage, x, y: cint, width, height: cuint): PXImage =
|
proc XSubImage(ximage: PXImage, x, y: cint, width, height: cuint): PXImage =
|
||||||
XSubImage = ximage^ .f.sub_image(ximage, x, y, width, height)
|
XSubImage = ximage[] .f.sub_image(ximage, x, y, width, height)
|
||||||
|
|
||||||
proc XAddPixel(ximage: PXImage, value: clong): cint =
|
proc XAddPixel(ximage: PXImage, value: clong): cint =
|
||||||
XAddPixel = ximage^ .f.add_pixel(ximage, value)
|
XAddPixel = ximage[] .f.add_pixel(ximage, value)
|
||||||
|
|
||||||
proc IsKeypadKey(keysym: TKeySym): bool =
|
proc IsKeypadKey(keysym: TKeySym): bool =
|
||||||
IsKeypadKey = (keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal)
|
IsKeypadKey = (keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal)
|
||||||
|
|
|
||||||
|
|
@ -107,13 +107,13 @@ proc rawGetTok(p: var TParser) =
|
||||||
p.tok = p.tok.next
|
p.tok = p.tok.next
|
||||||
elif p.backtrack.len == 0:
|
elif p.backtrack.len == 0:
|
||||||
p.tok.next = nil
|
p.tok.next = nil
|
||||||
getTok(p.lex, p.tok^)
|
getTok(p.lex, p.tok[])
|
||||||
else:
|
else:
|
||||||
# We need the next token and must be able to backtrack. So we need to
|
# We need the next token and must be able to backtrack. So we need to
|
||||||
# allocate a new token.
|
# allocate a new token.
|
||||||
var t: ref TToken
|
var t: ref TToken
|
||||||
new(t)
|
new(t)
|
||||||
getTok(p.lex, t^)
|
getTok(p.lex, t[])
|
||||||
p.tok.next = t
|
p.tok.next = t
|
||||||
p.tok = t
|
p.tok = t
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ proc getTok(p: var TParser, n: PNode) =
|
||||||
skipCom(p, n)
|
skipCom(p, n)
|
||||||
|
|
||||||
proc ExpectIdent(p: TParser) =
|
proc ExpectIdent(p: TParser) =
|
||||||
if p.tok.xkind != pxSymbol: parMessage(p, errIdentifierExpected, $(p.tok^))
|
if p.tok.xkind != pxSymbol: parMessage(p, errIdentifierExpected, $(p.tok[]))
|
||||||
|
|
||||||
proc Eat(p: var TParser, xkind: TTokKind, n: PNode) =
|
proc Eat(p: var TParser, xkind: TTokKind, n: PNode) =
|
||||||
if p.tok.xkind == xkind: getTok(p, n)
|
if p.tok.xkind == xkind: getTok(p, n)
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ proc isSpecial(n: PNode): bool {.inline.} =
|
||||||
# few programs
|
# few programs
|
||||||
|
|
||||||
proc myreset(n: PNode) {.inline.} =
|
proc myreset(n: PNode) {.inline.} =
|
||||||
when defined(system.reset): reset(n^)
|
when defined(system.reset): reset(n[])
|
||||||
|
|
||||||
proc evalIf(c: PEvalContext, n: PNode): PNode =
|
proc evalIf(c: PEvalContext, n: PNode): PNode =
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ proc CommandScan(filename: string) =
|
||||||
new(tok)
|
new(tok)
|
||||||
openLexer(L, f, stream)
|
openLexer(L, f, stream)
|
||||||
while true:
|
while true:
|
||||||
rawGetTok(L, tok^)
|
rawGetTok(L, tok[])
|
||||||
PrintTok(tok)
|
PrintTok(tok)
|
||||||
if tok.tokType == tkEof: break
|
if tok.tokType == tkEof: break
|
||||||
CloseLexer(L)
|
CloseLexer(L)
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ proc LoadSpecialConfig*(configfilename: string)
|
||||||
|
|
||||||
proc ppGetTok(L: var TLexer, tok: PToken) =
|
proc ppGetTok(L: var TLexer, tok: PToken) =
|
||||||
# simple filter
|
# simple filter
|
||||||
rawGetTok(L, tok^ )
|
rawGetTok(L, tok[] )
|
||||||
while (tok.tokType == tkInd) or (tok.tokType == tkSad) or
|
while (tok.tokType == tkInd) or (tok.tokType == tkSad) or
|
||||||
(tok.tokType == tkDed) or (tok.tokType == tkComment):
|
(tok.tokType == tkDed) or (tok.tokType == tkComment):
|
||||||
rawGetTok(L, tok^ )
|
rawGetTok(L, tok[] )
|
||||||
|
|
||||||
proc parseExpr(L: var TLexer, tok: PToken): bool
|
proc parseExpr(L: var TLexer, tok: PToken): bool
|
||||||
proc parseAtom(L: var TLexer, tok: PToken): bool =
|
proc parseAtom(L: var TLexer, tok: PToken): bool =
|
||||||
|
|
|
||||||
|
|
@ -843,7 +843,7 @@ proc parseSection(p: var TParser, kind: TNodeKind, defparser: TDefParser): PNode
|
||||||
skipComment(p, result)
|
skipComment(p, result)
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkInd:
|
of tkInd:
|
||||||
pushInd(p.lex^ , p.tok.indent)
|
pushInd(p.lex[] , p.tok.indent)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
skipComment(p, result)
|
skipComment(p, result)
|
||||||
while true:
|
while true:
|
||||||
|
|
@ -866,7 +866,7 @@ proc parseSection(p: var TParser, kind: TNodeKind, defparser: TDefParser): PNode
|
||||||
else:
|
else:
|
||||||
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
||||||
break
|
break
|
||||||
popInd(p.lex^ )
|
popInd(p.lex[] )
|
||||||
of tkSymbol, tkAccent, tkParLe:
|
of tkSymbol, tkAccent, tkParLe:
|
||||||
# tkParLe is allowed for ``var (x, y) = ...`` tuple parsing
|
# tkParLe is allowed for ``var (x, y) = ...`` tuple parsing
|
||||||
addSon(result, defparser(p))
|
addSon(result, defparser(p))
|
||||||
|
|
@ -985,7 +985,7 @@ proc parseObjectPart(p: var TParser): PNode =
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkInd:
|
of tkInd:
|
||||||
result = newNodeP(nkRecList, p)
|
result = newNodeP(nkRecList, p)
|
||||||
pushInd(p.lex^ , p.tok.indent)
|
pushInd(p.lex[] , p.tok.indent)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
skipComment(p, result)
|
skipComment(p, result)
|
||||||
while true:
|
while true:
|
||||||
|
|
@ -1002,7 +1002,7 @@ proc parseObjectPart(p: var TParser): PNode =
|
||||||
else:
|
else:
|
||||||
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
||||||
break
|
break
|
||||||
popInd(p.lex^ )
|
popInd(p.lex[] )
|
||||||
of tkWhen:
|
of tkWhen:
|
||||||
result = parseObjectWhen(p)
|
result = parseObjectWhen(p)
|
||||||
of tkCase:
|
of tkCase:
|
||||||
|
|
|
||||||
|
|
@ -61,18 +61,18 @@ proc initParser(p: var TParser) =
|
||||||
new(p.tok)
|
new(p.tok)
|
||||||
|
|
||||||
proc getTok(p: var TParser) =
|
proc getTok(p: var TParser) =
|
||||||
rawGetTok(p.lex^, p.tok^)
|
rawGetTok(p.lex[], p.tok[])
|
||||||
|
|
||||||
proc OpenParser(p: var TParser, filename: string, inputStream: PLLStream) =
|
proc OpenParser(p: var TParser, filename: string, inputStream: PLLStream) =
|
||||||
initParser(p)
|
initParser(p)
|
||||||
OpenLexer(p.lex^, filename, inputstream)
|
OpenLexer(p.lex[], filename, inputstream)
|
||||||
getTok(p) # read the first token
|
getTok(p) # read the first token
|
||||||
|
|
||||||
proc CloseParser(p: var TParser) =
|
proc CloseParser(p: var TParser) =
|
||||||
CloseLexer(p.lex^)
|
CloseLexer(p.lex[])
|
||||||
|
|
||||||
proc parMessage(p: TParser, msg: TMsgKind, arg: string = "") =
|
proc parMessage(p: TParser, msg: TMsgKind, arg: string = "") =
|
||||||
lexMessage(p.lex^, msg, arg)
|
lexMessage(p.lex[], msg, arg)
|
||||||
|
|
||||||
proc skipComment(p: var TParser, node: PNode) =
|
proc skipComment(p: var TParser, node: PNode) =
|
||||||
if p.tok.tokType == tkComment:
|
if p.tok.tokType == tkComment:
|
||||||
|
|
@ -95,22 +95,22 @@ proc optInd(p: var TParser, n: PNode) =
|
||||||
|
|
||||||
proc expectIdentOrKeyw(p: TParser) =
|
proc expectIdentOrKeyw(p: TParser) =
|
||||||
if p.tok.tokType != tkSymbol and not isKeyword(p.tok.tokType):
|
if p.tok.tokType != tkSymbol and not isKeyword(p.tok.tokType):
|
||||||
lexMessage(p.lex^, errIdentifierExpected, tokToStr(p.tok))
|
lexMessage(p.lex[], errIdentifierExpected, tokToStr(p.tok))
|
||||||
|
|
||||||
proc ExpectIdent(p: TParser) =
|
proc ExpectIdent(p: TParser) =
|
||||||
if p.tok.tokType != tkSymbol:
|
if p.tok.tokType != tkSymbol:
|
||||||
lexMessage(p.lex^, errIdentifierExpected, tokToStr(p.tok))
|
lexMessage(p.lex[], errIdentifierExpected, tokToStr(p.tok))
|
||||||
|
|
||||||
proc expectIdentOrOpr(p: TParser) =
|
proc expectIdentOrOpr(p: TParser) =
|
||||||
if not (p.tok.tokType in tokOperators):
|
if not (p.tok.tokType in tokOperators):
|
||||||
lexMessage(p.lex^, errOperatorExpected, tokToStr(p.tok))
|
lexMessage(p.lex[], errOperatorExpected, tokToStr(p.tok))
|
||||||
|
|
||||||
proc Eat(p: var TParser, TokType: TTokType) =
|
proc Eat(p: var TParser, TokType: TTokType) =
|
||||||
if p.tok.TokType == TokType: getTok(p)
|
if p.tok.TokType == TokType: getTok(p)
|
||||||
else: lexMessage(p.lex^, errTokenExpected, TokTypeToStr[tokType])
|
else: lexMessage(p.lex[], errTokenExpected, TokTypeToStr[tokType])
|
||||||
|
|
||||||
proc parLineInfo(p: TParser): TLineInfo =
|
proc parLineInfo(p: TParser): TLineInfo =
|
||||||
result = getLineInfo(p.lex^)
|
result = getLineInfo(p.lex[])
|
||||||
|
|
||||||
proc indAndComment(p: var TParser, n: PNode) =
|
proc indAndComment(p: var TParser, n: PNode) =
|
||||||
if p.tok.tokType == tkInd:
|
if p.tok.tokType == tkInd:
|
||||||
|
|
@ -122,7 +122,7 @@ proc indAndComment(p: var TParser, n: PNode) =
|
||||||
skipComment(p, n)
|
skipComment(p, n)
|
||||||
|
|
||||||
proc newNodeP(kind: TNodeKind, p: TParser): PNode =
|
proc newNodeP(kind: TNodeKind, p: TParser): PNode =
|
||||||
result = newNodeI(kind, getLineInfo(p.lex^))
|
result = newNodeI(kind, getLineInfo(p.lex[]))
|
||||||
|
|
||||||
proc newIntNodeP(kind: TNodeKind, intVal: BiggestInt, p: TParser): PNode =
|
proc newIntNodeP(kind: TNodeKind, intVal: BiggestInt, p: TParser): PNode =
|
||||||
result = newNodeP(kind, p)
|
result = newNodeP(kind, p)
|
||||||
|
|
@ -1124,7 +1124,7 @@ proc parseSection(p: var TParser, kind: TNodeKind,
|
||||||
skipComment(p, result)
|
skipComment(p, result)
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkInd:
|
of tkInd:
|
||||||
pushInd(p.lex^, p.tok.indent)
|
pushInd(p.lex[], p.tok.indent)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
skipComment(p, result)
|
skipComment(p, result)
|
||||||
while true:
|
while true:
|
||||||
|
|
@ -1147,7 +1147,7 @@ proc parseSection(p: var TParser, kind: TNodeKind,
|
||||||
else:
|
else:
|
||||||
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
||||||
break
|
break
|
||||||
popInd(p.lex^)
|
popInd(p.lex[])
|
||||||
of tkSymbol, tkAccent, tkParLe:
|
of tkSymbol, tkAccent, tkParLe:
|
||||||
# tkParLe is allowed for ``var (x, y) = ...`` tuple parsing
|
# tkParLe is allowed for ``var (x, y) = ...`` tuple parsing
|
||||||
addSon(result, defparser(p))
|
addSon(result, defparser(p))
|
||||||
|
|
@ -1252,7 +1252,7 @@ proc parseObjectPart(p: var TParser): PNode =
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
of tkInd:
|
of tkInd:
|
||||||
result = newNodeP(nkRecList, p)
|
result = newNodeP(nkRecList, p)
|
||||||
pushInd(p.lex^, p.tok.indent)
|
pushInd(p.lex[], p.tok.indent)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
skipComment(p, result)
|
skipComment(p, result)
|
||||||
while true:
|
while true:
|
||||||
|
|
@ -1269,7 +1269,7 @@ proc parseObjectPart(p: var TParser): PNode =
|
||||||
else:
|
else:
|
||||||
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
parMessage(p, errIdentifierExpected, tokToStr(p.tok))
|
||||||
break
|
break
|
||||||
popInd(p.lex^)
|
popInd(p.lex[])
|
||||||
of tkWhen:
|
of tkWhen:
|
||||||
result = parseObjectWhen(p)
|
result = parseObjectWhen(p)
|
||||||
of tkCase:
|
of tkCase:
|
||||||
|
|
@ -1386,7 +1386,7 @@ proc complexOrSimpleStmt(p: var TParser): PNode =
|
||||||
proc parseStmt(p: var TParser): PNode =
|
proc parseStmt(p: var TParser): PNode =
|
||||||
if p.tok.tokType == tkInd:
|
if p.tok.tokType == tkInd:
|
||||||
result = newNodeP(nkStmtList, p)
|
result = newNodeP(nkStmtList, p)
|
||||||
pushInd(p.lex^, p.tok.indent)
|
pushInd(p.lex[], p.tok.indent)
|
||||||
getTok(p)
|
getTok(p)
|
||||||
while true:
|
while true:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
|
|
@ -1399,7 +1399,7 @@ proc parseStmt(p: var TParser): PNode =
|
||||||
var a = complexOrSimpleStmt(p)
|
var a = complexOrSimpleStmt(p)
|
||||||
if a.kind == nkEmpty: break
|
if a.kind == nkEmpty: break
|
||||||
addSon(result, a)
|
addSon(result, a)
|
||||||
popInd(p.lex^ )
|
popInd(p.lex[] )
|
||||||
else:
|
else:
|
||||||
# the case statement is only needed for better error messages:
|
# the case statement is only needed for better error messages:
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
|
|
|
||||||
|
|
@ -289,18 +289,18 @@ proc atom(n: PNode): string =
|
||||||
of nkInt64Lit: result = litAux(n, n.intVal, 8) & "\'i64"
|
of nkInt64Lit: result = litAux(n, n.intVal, 8) & "\'i64"
|
||||||
of nkFloatLit:
|
of nkFloatLit:
|
||||||
if n.flags * {nfBase2, nfBase8, nfBase16} == {}: result = $(n.floatVal)
|
if n.flags * {nfBase2, nfBase8, nfBase16} == {}: result = $(n.floatVal)
|
||||||
else: result = litAux(n, (cast[PInt64](addr(n.floatVal)))^ , 8)
|
else: result = litAux(n, (cast[PInt64](addr(n.floatVal)))[] , 8)
|
||||||
of nkFloat32Lit:
|
of nkFloat32Lit:
|
||||||
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
||||||
result = $(n.floatVal) & "\'f32"
|
result = $(n.floatVal) & "\'f32"
|
||||||
else:
|
else:
|
||||||
f = n.floatVal
|
f = n.floatVal
|
||||||
result = litAux(n, (cast[PInt32](addr(f)))^ , 4) & "\'f32"
|
result = litAux(n, (cast[PInt32](addr(f)))[] , 4) & "\'f32"
|
||||||
of nkFloat64Lit:
|
of nkFloat64Lit:
|
||||||
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
if n.flags * {nfBase2, nfBase8, nfBase16} == {}:
|
||||||
result = $(n.floatVal) & "\'f64"
|
result = $(n.floatVal) & "\'f64"
|
||||||
else:
|
else:
|
||||||
result = litAux(n, (cast[PInt64](addr(n.floatVal)))^ , 8) & "\'f64"
|
result = litAux(n, (cast[PInt64](addr(n.floatVal)))[] , 8) & "\'f64"
|
||||||
of nkNilLit: result = "nil"
|
of nkNilLit: result = "nil"
|
||||||
of nkType:
|
of nkType:
|
||||||
if (n.typ != nil) and (n.typ.sym != nil): result = n.typ.sym.name.s
|
if (n.typ != nil) and (n.typ.sym != nil): result = n.typ.sym.name.s
|
||||||
|
|
|
||||||
|
|
@ -382,10 +382,10 @@ proc GetNumber(L: var TLexer): TToken =
|
||||||
of tkInt16Lit: result.iNumber = biggestInt(toU16(int(xi)))
|
of tkInt16Lit: result.iNumber = biggestInt(toU16(int(xi)))
|
||||||
of tkInt32Lit: result.iNumber = biggestInt(toU32(xi))
|
of tkInt32Lit: result.iNumber = biggestInt(toU32(xi))
|
||||||
of tkFloat32Lit:
|
of tkFloat32Lit:
|
||||||
result.fNumber = (cast[PFloat32](addr(xi)))^
|
result.fNumber = (cast[PFloat32](addr(xi)))[]
|
||||||
# note: this code is endian neutral!
|
# note: this code is endian neutral!
|
||||||
# XXX: Test this on big endian machine!
|
# XXX: Test this on big endian machine!
|
||||||
of tkFloat64Lit: result.fNumber = (cast[PFloat64](addr(xi)))^
|
of tkFloat64Lit: result.fNumber = (cast[PFloat64](addr(xi)))[]
|
||||||
else: InternalError(getLineInfo(L), "getNumber")
|
else: InternalError(getLineInfo(L), "getNumber")
|
||||||
elif isFloatLiteral(result.literal) or (result.tokType == tkFloat32Lit) or
|
elif isFloatLiteral(result.literal) or (result.tokType == tkFloat32Lit) or
|
||||||
(result.tokType == tkFloat64Lit):
|
(result.tokType == tkFloat64Lit):
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ proc semTypeIdent(c: PContext, n: PNode): PSym =
|
||||||
if result.kind != skType: GlobalError(n.info, errTypeExpected)
|
if result.kind != skType: GlobalError(n.info, errTypeExpected)
|
||||||
if result.typ.kind != tyGenericParam:
|
if result.typ.kind != tyGenericParam:
|
||||||
# XXX get rid of this hack!
|
# XXX get rid of this hack!
|
||||||
reset(n^)
|
reset(n[])
|
||||||
n.kind = nkSym
|
n.kind = nkSym
|
||||||
n.sym = result
|
n.sym = result
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ p.s[1] = "xyz"
|
||||||
p.e = en6
|
p.e = en6
|
||||||
|
|
||||||
new(q)
|
new(q)
|
||||||
q^ = p
|
q[] = p
|
||||||
|
|
||||||
s = @[q, q, q, q]
|
s = @[q, q, q, q]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ proc recTest(i: int) =
|
||||||
recTest(i+1)
|
recTest(i+1)
|
||||||
else: # should printStackTrace()
|
else: # should printStackTrace()
|
||||||
var p: ptr int = nil
|
var p: ptr int = nil
|
||||||
p^ = 12
|
p[] = 12
|
||||||
# leave
|
# leave
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
|
||||||
11
tests/accept/run/tnewderef.nim
Normal file
11
tests/accept/run/tnewderef.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
discard """
|
||||||
|
output: 3
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
var x: ref int
|
||||||
|
new(x)
|
||||||
|
x[] = 3
|
||||||
|
|
||||||
|
echo x[]
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ proc charSet*(s: set[char]): TPeg {.rtl, extern: "npegs$1".} =
|
||||||
assert '\0' notin s
|
assert '\0' notin s
|
||||||
result.kind = pkCharChoice
|
result.kind = pkCharChoice
|
||||||
new(result.charChoice)
|
new(result.charChoice)
|
||||||
result.charChoice^ = s
|
result.charChoice[] = s
|
||||||
|
|
||||||
proc len(a: TPeg): int {.inline.} = return a.sons.len
|
proc len(a: TPeg): int {.inline.} = return a.sons.len
|
||||||
proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s)
|
proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s)
|
||||||
|
|
@ -130,7 +130,7 @@ proc copyPeg(a: TPeg): TPeg =
|
||||||
result.ch = a.ch
|
result.ch = a.ch
|
||||||
of pkCharChoice, pkGreedyRepSet:
|
of pkCharChoice, pkGreedyRepSet:
|
||||||
new(result.charChoice)
|
new(result.charChoice)
|
||||||
result.charChoice^ = a.charChoice^
|
result.charChoice[] = a.charChoice[]
|
||||||
of pkNonTerminal: result.nt = a.nt
|
of pkNonTerminal: result.nt = a.nt
|
||||||
of pkBackRef..pkBackRefIgnoreStyle:
|
of pkBackRef..pkBackRefIgnoreStyle:
|
||||||
result.index = a.index
|
result.index = a.index
|
||||||
|
|
@ -143,9 +143,9 @@ proc addChoice(dest: var TPeg, elem: TPeg) =
|
||||||
# caution! Do not introduce false aliasing here!
|
# caution! Do not introduce false aliasing here!
|
||||||
case elem.kind
|
case elem.kind
|
||||||
of pkCharChoice:
|
of pkCharChoice:
|
||||||
dest.sons[L] = charSet(dest.sons[L].charChoice^ + elem.charChoice^)
|
dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[])
|
||||||
of pkChar:
|
of pkChar:
|
||||||
dest.sons[L] = charSet(dest.sons[L].charChoice^ + {elem.ch})
|
dest.sons[L] = charSet(dest.sons[L].charChoice[] + {elem.ch})
|
||||||
else: add(dest, elem)
|
else: add(dest, elem)
|
||||||
else: add(dest, elem)
|
else: add(dest, elem)
|
||||||
|
|
||||||
|
|
@ -447,7 +447,7 @@ proc toStrAux(r: TPeg, res: var string) =
|
||||||
add(res, 'y')
|
add(res, 'y')
|
||||||
add(res, singleQuoteEsc(r.term))
|
add(res, singleQuoteEsc(r.term))
|
||||||
of pkChar: add(res, singleQuoteEsc(r.ch))
|
of pkChar: add(res, singleQuoteEsc(r.ch))
|
||||||
of pkCharChoice: add(res, charSetEsc(r.charChoice^))
|
of pkCharChoice: add(res, charSetEsc(r.charChoice[]))
|
||||||
of pkNonTerminal: add(res, r.nt.name)
|
of pkNonTerminal: add(res, r.nt.name)
|
||||||
of pkSequence:
|
of pkSequence:
|
||||||
add(res, '(')
|
add(res, '(')
|
||||||
|
|
@ -470,7 +470,7 @@ proc toStrAux(r: TPeg, res: var string) =
|
||||||
add(res, singleQuoteEsc(r.ch))
|
add(res, singleQuoteEsc(r.ch))
|
||||||
add(res, '*')
|
add(res, '*')
|
||||||
of pkGreedyRepSet:
|
of pkGreedyRepSet:
|
||||||
add(res, charSetEsc(r.charChoice^))
|
add(res, charSetEsc(r.charChoice[]))
|
||||||
add(res, '*')
|
add(res, '*')
|
||||||
of pkGreedyAny:
|
of pkGreedyAny:
|
||||||
add(res, ".*")
|
add(res, ".*")
|
||||||
|
|
@ -652,7 +652,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
|
||||||
if p.ch == s[start]: result = 1
|
if p.ch == s[start]: result = 1
|
||||||
else: result = -1
|
else: result = -1
|
||||||
of pkCharChoice:
|
of pkCharChoice:
|
||||||
if contains(p.charChoice^, s[start]): result = 1
|
if contains(p.charChoice[], s[start]): result = 1
|
||||||
else: result = -1
|
else: result = -1
|
||||||
of pkNonTerminal:
|
of pkNonTerminal:
|
||||||
var oldMl = c.ml
|
var oldMl = c.ml
|
||||||
|
|
@ -719,7 +719,7 @@ proc rawMatch*(s: string, p: TPeg, start: int, c: var TCaptures): int {.
|
||||||
while ch == s[start+result]: inc(result)
|
while ch == s[start+result]: inc(result)
|
||||||
of pkGreedyRepSet:
|
of pkGreedyRepSet:
|
||||||
result = 0
|
result = 0
|
||||||
while contains(p.charChoice^, s[start+result]): inc(result)
|
while contains(p.charChoice[], s[start+result]): inc(result)
|
||||||
of pkOption:
|
of pkOption:
|
||||||
result = max(0, rawMatch(s, p.sons[0], start, c))
|
result = max(0, rawMatch(s, p.sons[0], start, c))
|
||||||
of pkAndPredicate:
|
of pkAndPredicate:
|
||||||
|
|
|
||||||
11
todo.txt
11
todo.txt
|
|
@ -1,8 +1,4 @@
|
||||||
- clean up the tests!
|
- clean up the tests!
|
||||||
- GC: marker procs for native Nimrod GC and Boehm GC
|
|
||||||
- thread support: threadvar on Windows seems broken;
|
|
||||||
add --deadlock_prevention:on|off switch
|
|
||||||
- built-in serialization
|
|
||||||
|
|
||||||
|
|
||||||
High priority (version 0.9.0)
|
High priority (version 0.9.0)
|
||||||
|
|
@ -12,7 +8,7 @@ High priority (version 0.9.0)
|
||||||
- fix the streams implementation so that it uses methods
|
- fix the streams implementation so that it uses methods
|
||||||
- fix overloading resolution
|
- fix overloading resolution
|
||||||
- wrong co-/contravariance
|
- wrong co-/contravariance
|
||||||
- deprecate ^ and make it available as operator; new other notation: p[]
|
- make ^ available as operator
|
||||||
|
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
|
|
@ -35,7 +31,10 @@ To implement
|
||||||
* constant sequences
|
* constant sequences
|
||||||
|
|
||||||
* implement closures for the C code generator
|
* implement closures for the C code generator
|
||||||
|
* GC: marker procs for native Nimrod GC and Boehm GC
|
||||||
|
* thread support: threadvar on Windows seems broken;
|
||||||
|
add --deadlock_prevention:on|off switch
|
||||||
|
* built-in serialization
|
||||||
|
|
||||||
|
|
||||||
Low priority
|
Low priority
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue