diff options
author | Araq <rumpf_a@web.de> | 2011-04-11 23:28:53 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-04-11 23:28:53 +0200 |
commit | 46c41e43690cba9bc1caff6a994bb6915df8a1b7 (patch) | |
tree | c96be792eceb1d189cdb5bcff6e1a06f9b51e76c | |
parent | 3d696c3da53e5c41d839d8265fbc94f1c64980bb (diff) | |
download | Nim-46c41e43690cba9bc1caff6a994bb6915df8a1b7.tar.gz |
p[] instead of p^
32 files changed, 242 insertions, 346 deletions
diff --git a/examples/tclex.nim b/examples/tclex.nim index 8abdb7d9c..83e4bed00 100755 --- a/examples/tclex.nim +++ b/examples/tclex.nim @@ -14,7 +14,7 @@ bind .e <Return> { } """ -FindExecutable(getApplicationFilename()) +FindExecutable(getAppFilename()) var interp = CreateInterp() if interp == nil: quit("cannot create TCL interpreter") if Init(interp) != TCL_OK: diff --git a/install.sh b/install.sh index 60ec70ca1..4e3fec989 100755 --- a/install.sh +++ b/install.sh @@ -140,120 +140,6 @@ if [ $# -eq 1 ] ; then chmod 644 $docdir/tut1.txt cp doc/tut2.txt $docdir/tut2.txt || exit 1 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 chmod 644 $docdir/mytest.cfg cp doc/c2nim.pdf $docdir/c2nim.pdf || exit 1 diff --git a/lib/core/marshal.nim b/lib/core/marshal.nim index 1a06e5c37..26264b1a8 100755 --- a/lib/core/marshal.nim +++ b/lib/core/marshal.nim @@ -101,10 +101,10 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) = add result, "{" var u: int64 case typ.size - of 1: u = ze64(cast[ptr int8](p)^) - of 2: u = ze64(cast[ptr int16](p)^) - of 4: u = ze64(cast[ptr int32](p)^) - of 8: u = cast[ptr int64](p)^ + of 1: u = ze64(cast[ptr int8](p)[]) + of 2: u = ze64(cast[ptr int16](p)[]) + of 4: u = ze64(cast[ptr int32](p)[]) + of 8: u = cast[ptr int64](p)[] else: var a = cast[pbyteArray](p) for i in 0 .. typ.size*8-1: @@ -217,31 +217,31 @@ when not defined(useNimRtl): of tyArray: reprArray(result, p, typ, cl) of tyTuple, tyPureObject: reprRecord(result, p, typ, cl) of tyObject: - var t = cast[ptr PNimType](p)^ + var t = cast[ptr PNimType](p)[] reprRecord(result, p, t, cl) of tyRef, tyPtr: assert(p != nil) - if cast[ppointer](p)^ == nil: add result, "nil" - else: reprRef(result, cast[ppointer](p)^, typ, cl) + if cast[ppointer](p)[] == nil: add result, "nil" + else: reprRef(result, cast[ppointer](p)[], typ, cl) of tySequence: - reprSequence(result, cast[ppointer](p)^, typ, cl) - of tyInt: add result, $(cast[ptr int](p)^) - of tyInt8: add result, $int(cast[ptr Int8](p)^) - of tyInt16: add result, $int(cast[ptr Int16](p)^) - of tyInt32: add result, $int(cast[ptr Int32](p)^) - of tyInt64: add result, $(cast[ptr Int64](p)^) - of tyFloat: add result, $(cast[ptr float](p)^) - of tyFloat32: add result, $(cast[ptr float32](p)^) - of tyFloat64: add result, $(cast[ptr float64](p)^) - of tyEnum: add result, reprEnum(cast[ptr int](p)^, typ) - of tyBool: add result, reprBool(cast[ptr bool](p)^) - of tyChar: add result, reprChar(cast[ptr char](p)^) - of tyString: reprStrAux(result, cast[ptr string](p)^) - of tyCString: reprStrAux(result, $(cast[ptr cstring](p)^)) + reprSequence(result, cast[ppointer](p)[], typ, cl) + of tyInt: add result, $(cast[ptr int](p)[]) + of tyInt8: add result, $int(cast[ptr Int8](p)[]) + of tyInt16: add result, $int(cast[ptr Int16](p)[]) + of tyInt32: add result, $int(cast[ptr Int32](p)[]) + of tyInt64: add result, $(cast[ptr Int64](p)[]) + of tyFloat: add result, $(cast[ptr float](p)[]) + of tyFloat32: add result, $(cast[ptr float32](p)[]) + of tyFloat64: add result, $(cast[ptr float64](p)[]) + of tyEnum: add result, reprEnum(cast[ptr int](p)[], typ) + of tyBool: add result, reprBool(cast[ptr bool](p)[]) + of tyChar: add result, reprChar(cast[ptr char](p)[]) + of tyString: reprStrAux(result, cast[ptr string](p)[]) + of tyCString: reprStrAux(result, $(cast[ptr cstring](p)[])) of tyRange: reprAux(result, p, typ.base, cl) of tyProc, tyPointer: - if cast[ppointer](p)^ == nil: add result, "nil" - else: add result, reprPointer(cast[ppointer](p)^) + if cast[ppointer](p)[] == nil: add result, "nil" + else: add result, reprPointer(cast[ppointer](p)[]) else: add result, "(invalid data!)" inc(cl.recdepth) diff --git a/lib/pure/os.nim b/lib/pure/os.nim index d9b81365f..67435667a 100755 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -720,7 +720,7 @@ else: # retrieves the variables of char** env of C's main proc if not envComputed: when useNSGetEnviron: - var gEnv = NSGetEnviron()^ + var gEnv = NSGetEnviron()[] var i = 0 while True: if gEnv[i] == nil: break diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index 2e1d0f0ad..9b2606b33 100755 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -120,7 +120,7 @@ proc charSet*(s: set[char]): TPeg {.nosideEffect, rtl, extern: "npegs$1".} = assert '\0' notin s result.kind = pkCharChoice new(result.charChoice) - result.charChoice^ = s + result.charChoice[] = s proc len(a: TPeg): int {.inline.} = return a.sons.len 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! case elem.kind of pkCharChoice: - dest.sons[L] = charSet(dest.sons[L].charChoice^ + elem.charChoice^) + dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[]) 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) @@ -435,7 +435,7 @@ proc toStrAux(r: TPeg, res: var string) = add(res, 'y') add(res, singleQuoteEsc(r.term)) 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 pkSequence: add(res, '(') @@ -458,7 +458,7 @@ proc toStrAux(r: TPeg, res: var string) = add(res, singleQuoteEsc(r.ch)) add(res, '*') of pkGreedyRepSet: - add(res, charSetEsc(r.charChoice^)) + add(res, charSetEsc(r.charChoice[])) add(res, '*') of pkGreedyAny: 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 else: result = -1 of pkCharChoice: - if contains(p.charChoice^, s[start]): result = 1 + if contains(p.charChoice[], s[start]): result = 1 else: result = -1 of pkNonTerminal: 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) of pkGreedyRepSet: result = 0 - while contains(p.charChoice^, s[start+result]): inc(result) + while contains(p.charChoice[], s[start+result]): inc(result) of pkOption: result = max(0, rawMatch(s, p.sons[0], start, c)) of pkAndPredicate: diff --git a/lib/pure/times.nim b/lib/pure/times.nim index f428a33b3..eddaf7e3c 100755 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -246,13 +246,13 @@ when not defined(ECMAScript): proc getTime(): TTime = return timec(nil) proc getLocalTime(t: TTime): TTimeInfo = var a = t - result = tmToTimeInfo(localtime(addr(a))^) + result = tmToTimeInfo(localtime(addr(a))[]) # copying is needed anyway to provide reentrancity; thus # the convertion is not expensive proc getGMTime(t: TTime): TTimeInfo = var a = t - result = tmToTimeInfo(gmtime(addr(a))^) + result = tmToTimeInfo(gmtime(addr(a))[]) # copying is needed anyway to provide reentrancity; thus # the convertion is not expensive diff --git a/lib/system.nim b/lib/system.nim index c786e8355..8fc4493dd 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -1641,9 +1641,9 @@ when not defined(EcmaScript) and not defined(NimrodVM): var d: int var a = cast[TAddress](aa) case n.typ.size - of 1: d = ze(cast[ptr int8](a +% n.offset)^) - of 2: d = ze(cast[ptr int16](a +% n.offset)^) - of 4: d = int(cast[ptr int32](a +% n.offset)^) + of 1: d = ze(cast[ptr int8](a +% n.offset)[]) + of 2: d = ze(cast[ptr int16](a +% n.offset)[]) + of 4: d = int(cast[ptr int32](a +% n.offset)[]) else: assert(false) return d diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index 0e0b450b4..c385aa6fe 100755 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -195,7 +195,7 @@ proc IntSetGet(t: TIntSet, key: int): PTrunk = proc IntSetPut(t: var TIntSet, key: int): PTrunk = result = IntSetGet(t, key) 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)] t.data[key and high(t.data)] = result result.key = key diff --git a/lib/system/assign.nim b/lib/system/assign.nim index 9ac00434e..c71525a12 100755 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -34,13 +34,13 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) = case mt.Kind of tyString: var x = cast[ppointer](dest) - var s2 = cast[ppointer](s)^ + var s2 = cast[ppointer](s)[] if s2 == nil or shallow: unsureAsgnRef(x, s2) else: unsureAsgnRef(x, copyString(cast[NimString](s2))) of tySequence: - var s2 = cast[ppointer](src)^ + var s2 = cast[ppointer](src)[] var seq = cast[PGenericSeq](s2) var x = cast[ppointer](dest) if s2 == nil or shallow: @@ -49,7 +49,7 @@ proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) = return assert(dest != nil) 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: genericAssignAux( 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), cast[pointer](s +% i*% mt.base.size), mt.base, shallow) of tyRef: - unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)^) + unsureAsgnRef(cast[ppointer](dest), cast[ppointer](s)[]) else: copyMem(dest, src, mt.size) # copy raw bits @@ -116,7 +116,7 @@ proc objectInit(dest: Pointer, typ: PNimType) = # iterate over any structural type # here we have to init the type field: var pint = cast[ptr PNimType](dest) - pint^ = typ + pint[] = typ objectInitAux(dest, typ.node) of tyTuple, tyPureObject: objectInitAux(dest, typ.node) diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 882825f5e..eb4811bf5 100755 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -244,8 +244,8 @@ proc asgnRef(dest: ppointer, src: pointer) {.compilerProc, inline.} = assert(not isOnStack(dest)) # BUGFIX: first incRef then decRef! if src != nil: incRef(usrToCell(src)) - if dest^ != nil: decRef(usrToCell(dest^)) - dest^ = src + if dest[] != nil: decRef(usrToCell(dest[])) + dest[] = src proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerProc, inline.} = # 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: var c = usrToCell(src) discard atomicInc(c.refcount, rcIncrement) - if dest^ != nil: - var c = usrToCell(dest^) + if dest[] != nil: + var c = usrToCell(dest[]) if atomicDec(c.refcount, rcIncrement) <% rcIncrement: rtlAddZCT(c) - dest^ = src + dest[] = src proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerProc.} = # 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! # the test for '!= nil' is correct, but I got tired of the segfaults # resulting from the crappy stack checking: - if cast[int](dest^) >=% PageSize: decRef(usrToCell(dest^)) - dest^ = src + if cast[int](dest[]) >=% PageSize: decRef(usrToCell(dest[])) + dest[] = src proc initGC() = 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: forAllChildrenAux(cast[pointer](d +% i *% mt.base.size), mt.base, op) of tyRef, tyString, tySequence: # leaf: - doOperation(cast[ppointer](d)^, op) + doOperation(cast[ppointer](d)[], op) of tyObject, tyTuple, tyPureObject: forAllSlotsAux(dest, mt.node, op) else: nil @@ -545,7 +545,7 @@ when defined(sparc): # For SPARC architecture. sp = addr(stackTop[0]) # Addresses decrease as the stack grows. while sp <= max: - gcMark(sp^) + gcMark(sp[]) sp = cast[ppointer](cast[TAddress](sp) +% sizeof(pointer)) elif defined(ELATE): @@ -575,7 +575,7 @@ elif stackIncreases: # sp will traverse the JMP_BUF as well (jmp_buf size is added, # otherwise sp would be below the registers structure). while sp >=% max: - gcMark(cast[ppointer](sp)^) + gcMark(cast[ppointer](sp)[]) sp = sp -% sizeof(pointer) else: @@ -598,7 +598,7 @@ else: var max = cast[TAddress](stackBottom) var sp = cast[TAddress](addr(registers)) while sp <=% max: - gcMark(cast[ppointer](sp)^) + gcMark(cast[ppointer](sp)[]) 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. # This is performance critical! var L = addr(gch.zct.len) - while L^ > 0: + while L[] > 0: var c = gch.zct.d[0] # remove from ZCT: assert((c.refcount and colorMask) == rcZct) c.refcount = c.refcount and not colorMask - gch.zct.d[0] = gch.zct.d[L^ - 1] - dec(L^) + gch.zct.d[0] = gch.zct.d[L[] - 1] + dec(L[]) if c.refcount <% rcIncrement: # 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 diff --git a/lib/system/repr.nim b/lib/system/repr.nim index b597cb0ce..a70989cad 100755 --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -78,10 +78,10 @@ proc reprSetAux(result: var string, p: pointer, typ: PNimType) = add result, "{" var u: int64 case typ.size - of 1: u = ze64(cast[ptr int8](p)^) - of 2: u = ze64(cast[ptr int16](p)^) - of 4: u = ze64(cast[ptr int32](p)^) - of 8: u = cast[ptr int64](p)^ + of 1: u = ze64(cast[ptr int8](p)[]) + of 2: u = ze64(cast[ptr int16](p)[]) + of 4: u = ze64(cast[ptr int32](p)[]) + of 8: u = cast[ptr int64](p)[] else: var a = cast[pbyteArray](p) for i in 0 .. typ.size*8-1: @@ -194,31 +194,31 @@ when not defined(useNimRtl): of tyArray: reprArray(result, p, typ, cl) of tyTuple, tyPureObject: reprRecord(result, p, typ, cl) of tyObject: - var t = cast[ptr PNimType](p)^ + var t = cast[ptr PNimType](p)[] reprRecord(result, p, t, cl) of tyRef, tyPtr: assert(p != nil) - if cast[ppointer](p)^ == nil: add result, "nil" - else: reprRef(result, cast[ppointer](p)^, typ, cl) + if cast[ppointer](p)[] == nil: add result, "nil" + else: reprRef(result, cast[ppointer](p)[], typ, cl) of tySequence: - reprSequence(result, cast[ppointer](p)^, typ, cl) - of tyInt: add result, $(cast[ptr int](p)^) - of tyInt8: add result, $int(cast[ptr Int8](p)^) - of tyInt16: add result, $int(cast[ptr Int16](p)^) - of tyInt32: add result, $int(cast[ptr Int32](p)^) - of tyInt64: add result, $(cast[ptr Int64](p)^) - of tyFloat: add result, $(cast[ptr float](p)^) - of tyFloat32: add result, $(cast[ptr float32](p)^) - of tyFloat64: add result, $(cast[ptr float64](p)^) - of tyEnum: add result, reprEnum(cast[ptr int](p)^, typ) - of tyBool: add result, reprBool(cast[ptr bool](p)^) - of tyChar: add result, reprChar(cast[ptr char](p)^) - of tyString: reprStrAux(result, cast[ptr string](p)^) - of tyCString: reprStrAux(result, $(cast[ptr cstring](p)^)) + reprSequence(result, cast[ppointer](p)[], typ, cl) + of tyInt: add result, $(cast[ptr int](p)[]) + of tyInt8: add result, $int(cast[ptr Int8](p)[]) + of tyInt16: add result, $int(cast[ptr Int16](p)[]) + of tyInt32: add result, $int(cast[ptr Int32](p)[]) + of tyInt64: add result, $(cast[ptr Int64](p)[]) + of tyFloat: add result, $(cast[ptr float](p)[]) + of tyFloat32: add result, $(cast[ptr float32](p)[]) + of tyFloat64: add result, $(cast[ptr float64](p)[]) + of tyEnum: add result, reprEnum(cast[ptr int](p)[], typ) + of tyBool: add result, reprBool(cast[ptr bool](p)[]) + of tyChar: add result, reprChar(cast[ptr char](p)[]) + of tyString: reprStrAux(result, cast[ptr string](p)[]) + of tyCString: reprStrAux(result, $(cast[ptr cstring](p)[])) of tyRange: reprAux(result, p, typ.base, cl) of tyProc, tyPointer: - if cast[ppointer](p)^ == nil: add result, "nil" - else: add result, reprPointer(cast[ppointer](p)^) + if cast[ppointer](p)[] == nil: add result, "nil" + else: add result, reprPointer(cast[ppointer](p)[]) else: add result, "(invalid data!)" inc(cl.recdepth) diff --git a/lib/wrappers/expat.nim b/lib/wrappers/expat.nim index 940d50ed6..3400dfdf7 100755 --- a/lib/wrappers/expat.nim +++ b/lib/wrappers/expat.nim @@ -564,7 +564,7 @@ proc SetUserData*(parser: PParser, userData: pointer){.cdecl, # Returns the last value set by XML_SetUserData or NULL. template GetUserData*(parser: expr): expr = - (cast[ptr pointer]((parser))^ ) + (cast[ptr pointer]((parser))[] ) # This is equivalent to supplying an encoding argument to # XML_ParserCreate. On success XML_SetEncoding returns non-zero, diff --git a/lib/wrappers/gtk/glib2.nim b/lib/wrappers/gtk/glib2.nim index a8fa6412d..3b40cd48f 100755 --- a/lib/wrappers/gtk/glib2.nim +++ b/lib/wrappers/gtk/glib2.nim @@ -3468,8 +3468,8 @@ when false: result = g_array_insert_vals(a, i, addr(v), 1) proc g_ptr_array_index*(parray: PGPtrArray, index: guint): gpointer = - result = cast[PGPointer](cast[int](parray ^. pdata) + - index * SizeOf(GPointer))^ + result = cast[PGPointer](cast[int](parray []. pdata) + + index * SizeOf(GPointer))[] proc G_THREAD_ERROR*(): TGQuark = result = g_thread_error_quark() @@ -3754,7 +3754,7 @@ proc TGIOChannel_set_is_seekable*(a: PGIOChannel, `is_seekable`: guint) = bm_TGIOChannel_is_seekable) 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: proc GLIB_CHECK_VERSION*(major, minor, micro: guint): bool = diff --git a/lib/wrappers/gtk/gtk2.nim b/lib/wrappers/gtk/gtk2.nim index f1e4ec13f..747ab4840 100755 --- a/lib/wrappers/gtk/gtk2.nim +++ b/lib/wrappers/gtk/gtk2.nim @@ -10892,127 +10892,127 @@ proc FUNDAMENTAL_TYPE*(thetype: GType): GType = proc VALUE_CHAR*(a: TArg): gchar = var a = a - Result = cast[ptr gchar](addr(a.d))^ + Result = cast[ptr gchar](addr(a.d))[] proc VALUE_UCHAR*(a: TArg): guchar = var a = a - Result = cast[ptr guchar](addr(a.d))^ + Result = cast[ptr guchar](addr(a.d))[] proc VALUE_BOOL*(a: TArg): gboolean = var a = a - Result = cast[ptr gboolean](addr(a.d))^ + Result = cast[ptr gboolean](addr(a.d))[] proc VALUE_INT*(a: TArg): gint = var a = a - Result = cast[ptr gint](addr(a.d))^ + Result = cast[ptr gint](addr(a.d))[] proc VALUE_UINT*(a: TArg): guint = var a = a - Result = cast[ptr guint](addr(a.d))^ + Result = cast[ptr guint](addr(a.d))[] proc VALUE_LONG*(a: TArg): glong = var a = a - Result = cast[ptr glong](addr(a.d))^ + Result = cast[ptr glong](addr(a.d))[] proc VALUE_ULONG*(a: TArg): gulong = var a = a - Result = cast[ptr gulong](addr(a.d))^ + Result = cast[ptr gulong](addr(a.d))[] proc VALUE_FLOAT*(a: TArg): gfloat = var a = a - Result = cast[ptr gfloat](addr(a.d))^ + Result = cast[ptr gfloat](addr(a.d))[] proc VALUE_DOUBLE*(a: TArg): gdouble = var a = a - Result = cast[ptr gdouble](addr(a.d))^ + Result = cast[ptr gdouble](addr(a.d))[] proc VALUE_STRING*(a: TArg): cstring = var a = a - Result = cast[ptr cstring](addr(a.d))^ + Result = cast[ptr cstring](addr(a.d))[] proc VALUE_ENUM*(a: TArg): gint = var a = a - Result = cast[ptr gint](addr(a.d))^ + Result = cast[ptr gint](addr(a.d))[] proc VALUE_FLAGS*(a: TArg): guint = var a = a - Result = cast[ptr guint](addr(a.d))^ + Result = cast[ptr guint](addr(a.d))[] proc VALUE_BOXED*(a: TArg): gpointer = var a = a - Result = cast[ptr gpointer](addr(a.d))^ + Result = cast[ptr gpointer](addr(a.d))[] proc VALUE_OBJECT*(a: TArg): PObject = var a = a - Result = cast[ptr PObject](addr(a.d))^ + Result = cast[ptr PObject](addr(a.d))[] proc VALUE_POINTER*(a: TArg): GPointer = var a = a - Result = cast[ptr gpointer](addr(a.d))^ + Result = cast[ptr gpointer](addr(a.d))[] proc VALUE_SIGNAL*(a: TArg): TArgSignalData = var a = a - Result = cast[ptr TArgSignalData](addr(a.d))^ + Result = cast[ptr TArgSignalData](addr(a.d))[] proc RETLOC_CHAR*(a: TArg): cstring = var a = a - Result = cast[ptr cstring](addr(a.d))^ + Result = cast[ptr cstring](addr(a.d))[] proc RETLOC_UCHAR*(a: TArg): Pguchar = var a = a - Result = cast[ptr pguchar](addr(a.d))^ + Result = cast[ptr pguchar](addr(a.d))[] proc RETLOC_BOOL*(a: TArg): Pgboolean = var a = a - Result = cast[ptr pgboolean](addr(a.d))^ + Result = cast[ptr pgboolean](addr(a.d))[] proc RETLOC_INT*(a: TArg): Pgint = var a = a - Result = cast[ptr pgint](addr(a.d))^ + Result = cast[ptr pgint](addr(a.d))[] proc RETLOC_UINT*(a: TArg): Pguint = var a = a - Result = cast[ptr pguint](addr(a.d))^ + Result = cast[ptr pguint](addr(a.d))[] proc RETLOC_LONG*(a: TArg): Pglong = var a = a - Result = cast[ptr pglong](addr(a.d))^ + Result = cast[ptr pglong](addr(a.d))[] proc RETLOC_ULONG*(a: TArg): Pgulong = var a = a - Result = cast[ptr pgulong](addr(a.d))^ + Result = cast[ptr pgulong](addr(a.d))[] proc RETLOC_FLOAT*(a: TArg): Pgfloat = var a = a - Result = cast[ptr pgfloat](addr(a.d))^ + Result = cast[ptr pgfloat](addr(a.d))[] proc RETLOC_DOUBLE*(a: TArg): Pgdouble = var a = a - Result = cast[ptr pgdouble](addr(a.d))^ + Result = cast[ptr pgdouble](addr(a.d))[] proc RETLOC_STRING*(a: TArg): Ppgchar = var a = a - Result = cast[ptr Ppgchar](addr(a.d))^ + Result = cast[ptr Ppgchar](addr(a.d))[] proc RETLOC_ENUM*(a: TArg): Pgint = var a = a - Result = cast[ptr Pgint](addr(a.d))^ + Result = cast[ptr Pgint](addr(a.d))[] proc RETLOC_FLAGS*(a: TArg): Pguint = var a = a - Result = cast[ptr pguint](addr(a.d))^ + Result = cast[ptr pguint](addr(a.d))[] proc RETLOC_BOXED*(a: TArg): Pgpointer = var a = a - Result = cast[ptr pgpointer](addr(a.d))^ + Result = cast[ptr pgpointer](addr(a.d))[] proc RETLOC_OBJECT*(a: TArg): PPGtkObject = var a = a - Result = cast[ptr ppgtkobject](addr(a.d))^ + Result = cast[ptr ppgtkobject](addr(a.d))[] proc RETLOC_POINTER*(a: TArg): Pgpointer = var a = a - Result = cast[ptr pgpointer](addr(a.d))^ + Result = cast[ptr pgpointer](addr(a.d))[] proc TYPE_WIDGET*(): GType = result = widget_get_type() diff --git a/lib/wrappers/python.nim b/lib/wrappers/python.nim index ea9ef1fd5..0801b1ae5 100755 --- a/lib/wrappers/python.nim +++ b/lib/wrappers/python.nim @@ -1337,7 +1337,7 @@ proc PyImport_ExecCodeModule(name: string, codeobject: PPyObject): PPyObject = Py_XDECREF(v) modules = PyImport_GetModuleDict() 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")) return nil Py_XINCREF(m) @@ -1371,37 +1371,37 @@ proc PyTuple_Check(obj: PPyObject): bool = Result = PyObject_TypeCheck(obj, PyTuple_Type) 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 = - Result = (obj != nil) and (obj^ .ob_type == PyInstance_Type) + Result = (obj != nil) and (obj[].ob_type == PyInstance_Type) 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 = - Result = (obj != nil) and (obj^ .ob_type == PyMethod_Type) + Result = (obj != nil) and (obj[].ob_type == PyMethod_Type) proc PyList_Check(obj: PPyObject): bool = Result = PyObject_TypeCheck(obj, PyList_Type) 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 = Result = PyObject_TypeCheck(obj, PyDict_Type) 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 = Result = PyObject_TypeCheck(obj, PyModule_Type) 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 = - Result = (obj != nil) and (obj^ .ob_type == PySlice_Type) + Result = (obj != nil) and (obj[].ob_type == PySlice_Type) proc PyFunction_Check(obj: PPyObject): bool = Result = (obj != nil) and diff --git a/lib/wrappers/sdl/sdl.nim b/lib/wrappers/sdl/sdl.nim index 51dbfb3c1..8ddab49dd 100755 --- a/lib/wrappers/sdl/sdl.nim +++ b/lib/wrappers/sdl/sdl.nim @@ -2525,8 +2525,8 @@ proc AllocSurface(flags: int32, width, height, depth: int, AMask) proc MustLock(Surface: PSurface): bool = - Result = ((surface^ .offset != 0) or - ((surface^ .flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0)) + Result = ((surface[] .offset != 0) or + ((surface[] .flags and (HWSURFACE or ASYNCBLIT or RLEACCEL)) != 0)) proc LockMutex(mutex: Pmutex): int = Result = mutexP(mutex) diff --git a/lib/wrappers/x11/xlib.nim b/lib/wrappers/x11/xlib.nim index 19ebda9e0..f915f0eae 100755 --- a/lib/wrappers/x11/xlib.nim +++ b/lib/wrappers/x11/xlib.nim @@ -2065,154 +2065,154 @@ when defined(MACROS): when defined(MACROS): proc ConnectionNumber(dpy: PDisplay): cint = - ConnectionNumber = (PXPrivDisplay(dpy))^ .fd + ConnectionNumber = (PXPrivDisplay(dpy))[] .fd proc RootWindow(dpy: PDisplay, scr: cint): TWindow = - RootWindow = (ScreenOfDisplay(dpy, scr))^ .root + RootWindow = (ScreenOfDisplay(dpy, scr))[] .root proc DefaultScreen(dpy: PDisplay): cint = - DefaultScreen = (PXPrivDisplay(dpy))^ .default_screen + DefaultScreen = (PXPrivDisplay(dpy))[] .default_screen proc DefaultRootWindow(dpy: PDisplay): TWindow = - DefaultRootWindow = (ScreenOfDisplay(dpy, DefaultScreen(dpy)))^ .root + DefaultRootWindow = (ScreenOfDisplay(dpy, DefaultScreen(dpy)))[] .root 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 = - DefaultGC = (ScreenOfDisplay(dpy, scr))^ .default_gc + DefaultGC = (ScreenOfDisplay(dpy, scr))[] .default_gc 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 = - WhitePixel = (ScreenOfDisplay(dpy, scr))^ .white_pixel + WhitePixel = (ScreenOfDisplay(dpy, scr))[] .white_pixel proc QLength(dpy: PDisplay): cint = - QLength = (PXPrivDisplay(dpy))^ .qlen + QLength = (PXPrivDisplay(dpy))[] .qlen proc DisplayWidth(dpy: PDisplay, scr: cint): cint = - DisplayWidth = (ScreenOfDisplay(dpy, scr))^ .width + DisplayWidth = (ScreenOfDisplay(dpy, scr))[] .width proc DisplayHeight(dpy: PDisplay, scr: cint): cint = - DisplayHeight = (ScreenOfDisplay(dpy, scr))^ .height + DisplayHeight = (ScreenOfDisplay(dpy, scr))[] .height proc DisplayWidthMM(dpy: PDisplay, scr: cint): cint = - DisplayWidthMM = (ScreenOfDisplay(dpy, scr))^ .mwidth + DisplayWidthMM = (ScreenOfDisplay(dpy, scr))[] .mwidth proc DisplayHeightMM(dpy: PDisplay, scr: cint): cint = - DisplayHeightMM = (ScreenOfDisplay(dpy, scr))^ .mheight + DisplayHeightMM = (ScreenOfDisplay(dpy, scr))[] .mheight 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 = - DisplayCells = (DefaultVisual(dpy, scr))^ .map_entries + DisplayCells = (DefaultVisual(dpy, scr))[] .map_entries proc ScreenCount(dpy: PDisplay): cint = - ScreenCount = (PXPrivDisplay(dpy))^ .nscreens + ScreenCount = (PXPrivDisplay(dpy))[] .nscreens proc ServerVendor(dpy: PDisplay): cstring = - ServerVendor = (PXPrivDisplay(dpy))^ .vendor + ServerVendor = (PXPrivDisplay(dpy))[] .vendor proc ProtocolVersion(dpy: PDisplay): cint = - ProtocolVersion = (PXPrivDisplay(dpy))^ .proto_major_version + ProtocolVersion = (PXPrivDisplay(dpy))[] .proto_major_version proc ProtocolRevision(dpy: PDisplay): cint = - ProtocolRevision = (PXPrivDisplay(dpy))^ .proto_minor_version + ProtocolRevision = (PXPrivDisplay(dpy))[] .proto_minor_version proc VendorRelease(dpy: PDisplay): cint = - VendorRelease = (PXPrivDisplay(dpy))^ .release + VendorRelease = (PXPrivDisplay(dpy))[] .release proc DisplayString(dpy: PDisplay): cstring = - DisplayString = (PXPrivDisplay(dpy))^ .display_name + DisplayString = (PXPrivDisplay(dpy))[] .display_name 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 = - DefaultColormap = (ScreenOfDisplay(dpy, scr))^ .cmap + DefaultColormap = (ScreenOfDisplay(dpy, scr))[] .cmap proc BitmapUnit(dpy: PDisplay): cint = - BitmapUnit = (PXPrivDisplay(dpy))^ .bitmap_unit + BitmapUnit = (PXPrivDisplay(dpy))[] .bitmap_unit proc BitmapBitOrder(dpy: PDisplay): cint = - BitmapBitOrder = (PXPrivDisplay(dpy))^ .bitmap_bit_order + BitmapBitOrder = (PXPrivDisplay(dpy))[] .bitmap_bit_order proc BitmapPad(dpy: PDisplay): cint = - BitmapPad = (PXPrivDisplay(dpy))^ .bitmap_pad + BitmapPad = (PXPrivDisplay(dpy))[] .bitmap_pad proc ImageByteOrder(dpy: PDisplay): cint = - ImageByteOrder = (PXPrivDisplay(dpy))^ .byte_order + ImageByteOrder = (PXPrivDisplay(dpy))[] .byte_order proc NextRequest(dpy: PDisplay): culong = - NextRequest = ((PXPrivDisplay(dpy))^ .request) + 1 + NextRequest = ((PXPrivDisplay(dpy))[] .request) + 1 proc LastKnownRequestProcessed(dpy: PDisplay): culong = - LastKnownRequestProcessed = (PXPrivDisplay(dpy))^ .last_request_read + LastKnownRequestProcessed = (PXPrivDisplay(dpy))[] .last_request_read proc ScreenOfDisplay(dpy: PDisplay, scr: cint): PScreen = - ScreenOfDisplay = addr((((PXPrivDisplay(dpy))^ .screens)[scr])) + ScreenOfDisplay = addr((((PXPrivDisplay(dpy))[] .screens)[scr])) proc DefaultScreenOfDisplay(dpy: PDisplay): PScreen = DefaultScreenOfDisplay = ScreenOfDisplay(dpy, DefaultScreen(dpy)) proc DisplayOfScreen(s: PScreen): PDisplay = - DisplayOfScreen = s^ .display + DisplayOfScreen = s[] .display proc RootWindowOfScreen(s: PScreen): TWindow = - RootWindowOfScreen = s^ .root + RootWindowOfScreen = s[] .root proc BlackPixelOfScreen(s: PScreen): culong = - BlackPixelOfScreen = s^ .black_pixel + BlackPixelOfScreen = s[] .black_pixel proc WhitePixelOfScreen(s: PScreen): culong = - WhitePixelOfScreen = s^ .white_pixel + WhitePixelOfScreen = s[] .white_pixel proc DefaultColormapOfScreen(s: PScreen): TColormap = - DefaultColormapOfScreen = s^ .cmap + DefaultColormapOfScreen = s[] .cmap proc DefaultDepthOfScreen(s: PScreen): cint = - DefaultDepthOfScreen = s^ .root_depth + DefaultDepthOfScreen = s[] .root_depth proc DefaultGCOfScreen(s: PScreen): TGC = - DefaultGCOfScreen = s^ .default_gc + DefaultGCOfScreen = s[] .default_gc proc DefaultVisualOfScreen(s: PScreen): PVisual = - DefaultVisualOfScreen = s^ .root_visual + DefaultVisualOfScreen = s[] .root_visual proc WidthOfScreen(s: PScreen): cint = - WidthOfScreen = s^ .width + WidthOfScreen = s[] .width proc HeightOfScreen(s: PScreen): cint = - HeightOfScreen = s^ .height + HeightOfScreen = s[] .height proc WidthMMOfScreen(s: PScreen): cint = - WidthMMOfScreen = s^ .mwidth + WidthMMOfScreen = s[] .mwidth proc HeightMMOfScreen(s: PScreen): cint = - HeightMMOfScreen = s^ .mheight + HeightMMOfScreen = s[] .mheight proc PlanesOfScreen(s: PScreen): cint = - PlanesOfScreen = s^ .root_depth + PlanesOfScreen = s[] .root_depth proc CellsOfScreen(s: PScreen): cint = - CellsOfScreen = (DefaultVisualOfScreen(s))^ .map_entries + CellsOfScreen = (DefaultVisualOfScreen(s))[] .map_entries proc MinCmapsOfScreen(s: PScreen): cint = - MinCmapsOfScreen = s^ .min_maps + MinCmapsOfScreen = s[] .min_maps proc MaxCmapsOfScreen(s: PScreen): cint = - MaxCmapsOfScreen = s^ .max_maps + MaxCmapsOfScreen = s[] .max_maps proc DoesSaveUnders(s: PScreen): TBool = - DoesSaveUnders = s^ .save_unders + DoesSaveUnders = s[] .save_unders proc DoesBackingStore(s: PScreen): cint = - DoesBackingStore = s^ .backing_store + DoesBackingStore = s[] .backing_store proc EventMaskOfScreen(s: PScreen): clong = - EventMaskOfScreen = s^ .root_input_mask + EventMaskOfScreen = s[] .root_input_mask proc XAllocID(dpy: PDisplay): TXID = - XAllocID = (PXPrivDisplay(dpy))^ .resource_alloc(dpy) + XAllocID = (PXPrivDisplay(dpy))[] .resource_alloc(dpy) diff --git a/lib/wrappers/x11/xutil.nim b/lib/wrappers/x11/xutil.nim index 563702123..b66955927 100755 --- a/lib/wrappers/x11/xutil.nim +++ b/lib/wrappers/x11/xutil.nim @@ -375,19 +375,19 @@ when defined(MACROS): when defined(MACROS): 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 = - 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 = - 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 = - 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 = - XAddPixel = ximage^ .f.add_pixel(ximage, value) + XAddPixel = ximage[] .f.add_pixel(ximage, value) proc IsKeypadKey(keysym: TKeySym): bool = IsKeypadKey = (keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal) diff --git a/rod/c2nim/cparse.nim b/rod/c2nim/cparse.nim index 3f788c691..ce9caf7f5 100755 --- a/rod/c2nim/cparse.nim +++ b/rod/c2nim/cparse.nim @@ -107,13 +107,13 @@ proc rawGetTok(p: var TParser) = p.tok = p.tok.next elif p.backtrack.len == 0: p.tok.next = nil - getTok(p.lex, p.tok^) + getTok(p.lex, p.tok[]) else: # We need the next token and must be able to backtrack. So we need to # allocate a new token. var t: ref TToken new(t) - getTok(p.lex, t^) + getTok(p.lex, t[]) p.tok.next = t p.tok = t @@ -217,7 +217,7 @@ proc getTok(p: var TParser, n: PNode) = skipCom(p, n) 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) = if p.tok.xkind == xkind: getTok(p, n) diff --git a/rod/evals.nim b/rod/evals.nim index 5aee1612c..7d0f9c801 100755 --- a/rod/evals.nim +++ b/rod/evals.nim @@ -99,7 +99,7 @@ proc isSpecial(n: PNode): bool {.inline.} = # few programs proc myreset(n: PNode) {.inline.} = - when defined(system.reset): reset(n^) + when defined(system.reset): reset(n[]) proc evalIf(c: PEvalContext, n: PNode): PNode = var i = 0 diff --git a/rod/main.nim b/rod/main.nim index 79059a874..11a139144 100755 --- a/rod/main.nim +++ b/rod/main.nim @@ -169,7 +169,7 @@ proc CommandScan(filename: string) = new(tok) openLexer(L, f, stream) while true: - rawGetTok(L, tok^) + rawGetTok(L, tok[]) PrintTok(tok) if tok.tokType == tkEof: break CloseLexer(L) diff --git a/rod/nimconf.nim b/rod/nimconf.nim index 231377978..c41417fb1 100755 --- a/rod/nimconf.nim +++ b/rod/nimconf.nim @@ -21,10 +21,10 @@ proc LoadSpecialConfig*(configfilename: string) proc ppGetTok(L: var TLexer, tok: PToken) = # simple filter - rawGetTok(L, tok^ ) + rawGetTok(L, tok[] ) while (tok.tokType == tkInd) or (tok.tokType == tkSad) or (tok.tokType == tkDed) or (tok.tokType == tkComment): - rawGetTok(L, tok^ ) + rawGetTok(L, tok[] ) proc parseExpr(L: var TLexer, tok: PToken): bool proc parseAtom(L: var TLexer, tok: PToken): bool = diff --git a/rod/pbraces.nim b/rod/pbraces.nim index dc1ddb292..45d38e342 100755 --- a/rod/pbraces.nim +++ b/rod/pbraces.nim @@ -843,7 +843,7 @@ proc parseSection(p: var TParser, kind: TNodeKind, defparser: TDefParser): PNode skipComment(p, result) case p.tok.tokType of tkInd: - pushInd(p.lex^ , p.tok.indent) + pushInd(p.lex[] , p.tok.indent) getTok(p) skipComment(p, result) while true: @@ -866,7 +866,7 @@ proc parseSection(p: var TParser, kind: TNodeKind, defparser: TDefParser): PNode else: parMessage(p, errIdentifierExpected, tokToStr(p.tok)) break - popInd(p.lex^ ) + popInd(p.lex[] ) of tkSymbol, tkAccent, tkParLe: # tkParLe is allowed for ``var (x, y) = ...`` tuple parsing addSon(result, defparser(p)) @@ -985,7 +985,7 @@ proc parseObjectPart(p: var TParser): PNode = case p.tok.tokType of tkInd: result = newNodeP(nkRecList, p) - pushInd(p.lex^ , p.tok.indent) + pushInd(p.lex[] , p.tok.indent) getTok(p) skipComment(p, result) while true: @@ -1002,7 +1002,7 @@ proc parseObjectPart(p: var TParser): PNode = else: parMessage(p, errIdentifierExpected, tokToStr(p.tok)) break - popInd(p.lex^ ) + popInd(p.lex[] ) of tkWhen: result = parseObjectWhen(p) of tkCase: diff --git a/rod/pnimsyn.nim b/rod/pnimsyn.nim index a894f2723..990ca543d 100755 --- a/rod/pnimsyn.nim +++ b/rod/pnimsyn.nim @@ -61,18 +61,18 @@ proc initParser(p: var TParser) = new(p.tok) proc getTok(p: var TParser) = - rawGetTok(p.lex^, p.tok^) + rawGetTok(p.lex[], p.tok[]) proc OpenParser(p: var TParser, filename: string, inputStream: PLLStream) = initParser(p) - OpenLexer(p.lex^, filename, inputstream) + OpenLexer(p.lex[], filename, inputstream) getTok(p) # read the first token proc CloseParser(p: var TParser) = - CloseLexer(p.lex^) + CloseLexer(p.lex[]) 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) = if p.tok.tokType == tkComment: @@ -95,22 +95,22 @@ proc optInd(p: var TParser, n: PNode) = proc expectIdentOrKeyw(p: TParser) = 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) = if p.tok.tokType != tkSymbol: - lexMessage(p.lex^, errIdentifierExpected, tokToStr(p.tok)) + lexMessage(p.lex[], errIdentifierExpected, tokToStr(p.tok)) proc expectIdentOrOpr(p: TParser) = 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) = 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 = - result = getLineInfo(p.lex^) + result = getLineInfo(p.lex[]) proc indAndComment(p: var TParser, n: PNode) = if p.tok.tokType == tkInd: @@ -122,7 +122,7 @@ proc indAndComment(p: var TParser, n: PNode) = skipComment(p, n) 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 = result = newNodeP(kind, p) @@ -1124,7 +1124,7 @@ proc parseSection(p: var TParser, kind: TNodeKind, skipComment(p, result) case p.tok.tokType of tkInd: - pushInd(p.lex^, p.tok.indent) + pushInd(p.lex[], p.tok.indent) getTok(p) skipComment(p, result) while true: @@ -1147,7 +1147,7 @@ proc parseSection(p: var TParser, kind: TNodeKind, else: parMessage(p, errIdentifierExpected, tokToStr(p.tok)) break - popInd(p.lex^) + popInd(p.lex[]) of tkSymbol, tkAccent, tkParLe: # tkParLe is allowed for ``var (x, y) = ...`` tuple parsing addSon(result, defparser(p)) @@ -1252,7 +1252,7 @@ proc parseObjectPart(p: var TParser): PNode = case p.tok.tokType of tkInd: result = newNodeP(nkRecList, p) - pushInd(p.lex^, p.tok.indent) + pushInd(p.lex[], p.tok.indent) getTok(p) skipComment(p, result) while true: @@ -1269,7 +1269,7 @@ proc parseObjectPart(p: var TParser): PNode = else: parMessage(p, errIdentifierExpected, tokToStr(p.tok)) break - popInd(p.lex^) + popInd(p.lex[]) of tkWhen: result = parseObjectWhen(p) of tkCase: @@ -1386,7 +1386,7 @@ proc complexOrSimpleStmt(p: var TParser): PNode = proc parseStmt(p: var TParser): PNode = if p.tok.tokType == tkInd: result = newNodeP(nkStmtList, p) - pushInd(p.lex^, p.tok.indent) + pushInd(p.lex[], p.tok.indent) getTok(p) while true: case p.tok.tokType @@ -1399,7 +1399,7 @@ proc parseStmt(p: var TParser): PNode = var a = complexOrSimpleStmt(p) if a.kind == nkEmpty: break addSon(result, a) - popInd(p.lex^ ) + popInd(p.lex[] ) else: # the case statement is only needed for better error messages: case p.tok.tokType diff --git a/rod/rnimsyn.nim b/rod/rnimsyn.nim index 01d3e066c..4436467fa 100755 --- a/rod/rnimsyn.nim +++ b/rod/rnimsyn.nim @@ -289,18 +289,18 @@ proc atom(n: PNode): string = of nkInt64Lit: result = litAux(n, n.intVal, 8) & "\'i64" of nkFloatLit: 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: if n.flags * {nfBase2, nfBase8, nfBase16} == {}: result = $(n.floatVal) & "\'f32" else: f = n.floatVal - result = litAux(n, (cast[PInt32](addr(f)))^ , 4) & "\'f32" + result = litAux(n, (cast[PInt32](addr(f)))[] , 4) & "\'f32" of nkFloat64Lit: if n.flags * {nfBase2, nfBase8, nfBase16} == {}: result = $(n.floatVal) & "\'f64" 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 nkType: if (n.typ != nil) and (n.typ.sym != nil): result = n.typ.sym.name.s diff --git a/rod/scanner.nim b/rod/scanner.nim index 1e1105dad..a14773773 100755 --- a/rod/scanner.nim +++ b/rod/scanner.nim @@ -382,10 +382,10 @@ proc GetNumber(L: var TLexer): TToken = of tkInt16Lit: result.iNumber = biggestInt(toU16(int(xi))) of tkInt32Lit: result.iNumber = biggestInt(toU32(xi)) of tkFloat32Lit: - result.fNumber = (cast[PFloat32](addr(xi)))^ + result.fNumber = (cast[PFloat32](addr(xi)))[] # note: this code is endian neutral! # 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") elif isFloatLiteral(result.literal) or (result.tokType == tkFloat32Lit) or (result.tokType == tkFloat64Lit): diff --git a/rod/semtypes.nim b/rod/semtypes.nim index 1689d7570..bb0bcdf93 100755 --- a/rod/semtypes.nim +++ b/rod/semtypes.nim @@ -183,7 +183,7 @@ proc semTypeIdent(c: PContext, n: PNode): PSym = if result.kind != skType: GlobalError(n.info, errTypeExpected) if result.typ.kind != tyGenericParam: # XXX get rid of this hack! - reset(n^) + reset(n[]) n.kind = nkSym n.sym = result else: diff --git a/tests/accept/compile/trepr.nim b/tests/accept/compile/trepr.nim index 4a56842f6..b15081e48 100755 --- a/tests/accept/compile/trepr.nim +++ b/tests/accept/compile/trepr.nim @@ -22,7 +22,7 @@ p.s[1] = "xyz" p.e = en6 new(q) -q^ = p +q[] = p s = @[q, q, q, q] diff --git a/tests/accept/compile/tstrace.nim b/tests/accept/compile/tstrace.nim index 56f20a0dd..3032a34a3 100755 --- a/tests/accept/compile/tstrace.nim +++ b/tests/accept/compile/tstrace.nim @@ -8,7 +8,7 @@ proc recTest(i: int) = recTest(i+1) else: # should printStackTrace() var p: ptr int = nil - p^ = 12 + p[] = 12 # leave {.pop.} diff --git a/tests/accept/run/tnewderef.nim b/tests/accept/run/tnewderef.nim new file mode 100644 index 000000000..89dc4c8d1 --- /dev/null +++ b/tests/accept/run/tnewderef.nim @@ -0,0 +1,11 @@ +discard """ + output: 3 + +""" + +var x: ref int +new(x) +x[] = 3 + +echo x[] + diff --git a/tests/accept/run/tpegs.nim b/tests/accept/run/tpegs.nim index c127f6fec..c3ca7c9ab 100755 --- a/tests/accept/run/tpegs.nim +++ b/tests/accept/run/tpegs.nim @@ -115,7 +115,7 @@ proc charSet*(s: set[char]): TPeg {.rtl, extern: "npegs$1".} = assert '\0' notin s result.kind = pkCharChoice new(result.charChoice) - result.charChoice^ = s + result.charChoice[] = s proc len(a: TPeg): int {.inline.} = return a.sons.len 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 of pkCharChoice, pkGreedyRepSet: new(result.charChoice) - result.charChoice^ = a.charChoice^ + result.charChoice[] = a.charChoice[] of pkNonTerminal: result.nt = a.nt of pkBackRef..pkBackRefIgnoreStyle: result.index = a.index @@ -143,9 +143,9 @@ proc addChoice(dest: var TPeg, elem: TPeg) = # caution! Do not introduce false aliasing here! case elem.kind of pkCharChoice: - dest.sons[L] = charSet(dest.sons[L].charChoice^ + elem.charChoice^) + dest.sons[L] = charSet(dest.sons[L].charChoice[] + elem.charChoice[]) 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) @@ -447,7 +447,7 @@ proc toStrAux(r: TPeg, res: var string) = add(res, 'y') add(res, singleQuoteEsc(r.term)) 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 pkSequence: add(res, '(') @@ -470,7 +470,7 @@ proc toStrAux(r: TPeg, res: var string) = add(res, singleQuoteEsc(r.ch)) add(res, '*') of pkGreedyRepSet: - add(res, charSetEsc(r.charChoice^)) + add(res, charSetEsc(r.charChoice[])) add(res, '*') of pkGreedyAny: 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 else: result = -1 of pkCharChoice: - if contains(p.charChoice^, s[start]): result = 1 + if contains(p.charChoice[], s[start]): result = 1 else: result = -1 of pkNonTerminal: 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) of pkGreedyRepSet: result = 0 - while contains(p.charChoice^, s[start+result]): inc(result) + while contains(p.charChoice[], s[start+result]): inc(result) of pkOption: result = max(0, rawMatch(s, p.sons[0], start, c)) of pkAndPredicate: diff --git a/todo.txt b/todo.txt index 2108dbe33..e26f613f9 100755 --- a/todo.txt +++ b/todo.txt @@ -1,8 +1,4 @@ - 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) @@ -12,7 +8,7 @@ High priority (version 0.9.0) - fix the streams implementation so that it uses methods - fix overloading resolution - wrong co-/contravariance -- deprecate ^ and make it available as operator; new other notation: p[] +- make ^ available as operator Bugs @@ -35,7 +31,10 @@ To implement * constant sequences * 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 |