it's the year 2014
This commit is contained in:
parent
6df259f15b
commit
a59939d295
8 changed files with 24 additions and 26 deletions
|
|
@ -455,18 +455,18 @@ proc nextTry(h, maxHash: THash): THash =
|
||||||
# generates each int in range(maxHash) exactly once (see any text on
|
# generates each int in range(maxHash) exactly once (see any text on
|
||||||
# random-number generation for proof).
|
# random-number generation for proof).
|
||||||
|
|
||||||
proc objectSetContains(t: TObjectSet, obj: PObject): bool =
|
proc objectSetContains(t: TObjectSet, obj: PObject): bool =
|
||||||
# returns true whether n is in t
|
# returns true whether n is in t
|
||||||
var h: THash = hashNode(obj) and high(t.data) # start with real hash value
|
var h: THash = hashNode(obj) and high(t.data) # start with real hash value
|
||||||
while t.data[h] != nil:
|
while t.data[h] != nil:
|
||||||
if (t.data[h] == obj):
|
if t.data[h] == obj:
|
||||||
return true
|
return true
|
||||||
h = nextTry(h, high(t.data))
|
h = nextTry(h, high(t.data))
|
||||||
result = false
|
result = false
|
||||||
|
|
||||||
proc objectSetRawInsert(data: var TObjectSeq, obj: PObject) =
|
proc objectSetRawInsert(data: var TObjectSeq, obj: PObject) =
|
||||||
var h: THash = hashNode(obj) and high(data)
|
var h: THash = hashNode(obj) and high(data)
|
||||||
while data[h] != nil:
|
while data[h] != nil:
|
||||||
assert(data[h] != obj)
|
assert(data[h] != obj)
|
||||||
h = nextTry(h, high(data))
|
h = nextTry(h, high(data))
|
||||||
assert(data[h] == nil)
|
assert(data[h] == nil)
|
||||||
|
|
@ -475,7 +475,7 @@ proc objectSetRawInsert(data: var TObjectSeq, obj: PObject) =
|
||||||
proc objectSetEnlarge(t: var TObjectSet) =
|
proc objectSetEnlarge(t: var TObjectSet) =
|
||||||
var n: TObjectSeq
|
var n: TObjectSeq
|
||||||
newSeq(n, len(t.data) * GrowthFactor)
|
newSeq(n, len(t.data) * GrowthFactor)
|
||||||
for i in countup(0, high(t.data)):
|
for i in countup(0, high(t.data)):
|
||||||
if t.data[i] != nil: objectSetRawInsert(n, t.data[i])
|
if t.data[i] != nil: objectSetRawInsert(n, t.data[i])
|
||||||
swap(t.data, n)
|
swap(t.data, n)
|
||||||
|
|
||||||
|
|
@ -699,7 +699,7 @@ proc idTableRawGet(t: TIdTable, key: int): int =
|
||||||
var h: THash
|
var h: THash
|
||||||
h = key and high(t.data) # start with real hash value
|
h = key and high(t.data) # start with real hash value
|
||||||
while t.data[h].key != nil:
|
while t.data[h].key != nil:
|
||||||
if (t.data[h].key.id == key):
|
if t.data[h].key.id == key:
|
||||||
return h
|
return h
|
||||||
h = nextTry(h, high(t.data))
|
h = nextTry(h, high(t.data))
|
||||||
result = - 1
|
result = - 1
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2013 Andreas Rumpf
|
# (c) Copyright 2014 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.
|
||||||
|
|
@ -914,18 +914,18 @@ proc addIntTypes(result: var PRope) {.inline.} =
|
||||||
proc getCopyright(cfilenoext: string): PRope =
|
proc getCopyright(cfilenoext: string): PRope =
|
||||||
if optCompileOnly in gGlobalOptions:
|
if optCompileOnly in gGlobalOptions:
|
||||||
result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" &
|
result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" &
|
||||||
"/* (c) 2012 Andreas Rumpf */$n" &
|
"/* (c) 2014 Andreas Rumpf */$n" &
|
||||||
"/* The generated code is subject to the original license. */$n",
|
"/* The generated code is subject to the original license. */$n",
|
||||||
"; Generated by Nimrod Compiler v$1$n" &
|
"; Generated by Nimrod Compiler v$1$n" &
|
||||||
"; (c) 2012 Andreas Rumpf$n", [toRope(VersionAsString)])
|
"; (c) 2012 Andreas Rumpf$n", [toRope(VersionAsString)])
|
||||||
else:
|
else:
|
||||||
result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" &
|
result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" &
|
||||||
"/* (c) 2012 Andreas Rumpf */$n" &
|
"/* (c) 2014 Andreas Rumpf */$n" &
|
||||||
"/* The generated code is subject to the original license. */$n" &
|
"/* The generated code is subject to the original license. */$n" &
|
||||||
"/* Compiled for: $2, $3, $4 */$n" &
|
"/* Compiled for: $2, $3, $4 */$n" &
|
||||||
"/* Command for C compiler:$n $5 */$n",
|
"/* Command for C compiler:$n $5 */$n",
|
||||||
"; Generated by Nimrod Compiler v$1$n" &
|
"; Generated by Nimrod Compiler v$1$n" &
|
||||||
"; (c) 2012 Andreas Rumpf$n" &
|
"; (c) 2014 Andreas Rumpf$n" &
|
||||||
"; Compiled for: $2, $3, $4$n" &
|
"; Compiled for: $2, $3, $4$n" &
|
||||||
"; Command for LLVM compiler:$n $5$n", [toRope(VersionAsString),
|
"; Command for LLVM compiler:$n $5$n", [toRope(VersionAsString),
|
||||||
toRope(platform.OS[targetOS].name),
|
toRope(platform.OS[targetOS].name),
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo)
|
||||||
|
|
||||||
const
|
const
|
||||||
HelpMessage = "Nimrod Compiler Version $1 (" & CompileDate & ") [$2: $3]\n" &
|
HelpMessage = "Nimrod Compiler Version $1 (" & CompileDate & ") [$2: $3]\n" &
|
||||||
"Copyright (c) 2004-2013 by Andreas Rumpf\n"
|
"Copyright (c) 2006-2014 by Andreas Rumpf\n"
|
||||||
|
|
||||||
const
|
const
|
||||||
Usage = slurp"doc/basicopt.txt".replace("//", "")
|
Usage = slurp"doc/basicopt.txt".replace("//", "")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2013 Andreas Rumpf
|
# (c) Copyright 2014 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.
|
||||||
|
|
@ -1652,7 +1652,7 @@ proc newModule(module: PSym): BModule =
|
||||||
|
|
||||||
proc genHeader(): PRope =
|
proc genHeader(): PRope =
|
||||||
result = ropef("/* Generated by the Nimrod Compiler v$1 */$n" &
|
result = ropef("/* Generated by the Nimrod Compiler v$1 */$n" &
|
||||||
"/* (c) 2013 Andreas Rumpf */$n$n" &
|
"/* (c) 2014 Andreas Rumpf */$n$n" &
|
||||||
"$nvar Globals = this;$n" &
|
"$nvar Globals = this;$n" &
|
||||||
"var framePtr = null;$n" &
|
"var framePtr = null;$n" &
|
||||||
"var excHandler = null;$n",
|
"var excHandler = null;$n",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2013 Andreas Rumpf
|
# (c) Copyright 2014 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.
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ proc semGenericStmt(c: PContext, n: PNode,
|
||||||
# not work. Copying the symbol does not work either because we're already
|
# not work. Copying the symbol does not work either because we're already
|
||||||
# the owner of the symbol! What we need to do is to copy the symbol
|
# the owner of the symbol! What we need to do is to copy the symbol
|
||||||
# in the generic instantiation process...
|
# in the generic instantiation process...
|
||||||
nil
|
discard
|
||||||
of nkBind:
|
of nkBind:
|
||||||
result = semGenericStmt(c, n.sons[0], flags+{withinBind}, ctx)
|
result = semGenericStmt(c, n.sons[0], flags+{withinBind}, ctx)
|
||||||
of nkMixinStmt:
|
of nkMixinStmt:
|
||||||
|
|
@ -271,7 +271,7 @@ proc semGenericStmt(c: PContext, n: PNode,
|
||||||
else: illFormedAst(n)
|
else: illFormedAst(n)
|
||||||
addDecl(c, newSymS(skUnknown, getIdentNode(a.sons[i]), c))
|
addDecl(c, newSymS(skUnknown, getIdentNode(a.sons[i]), c))
|
||||||
of nkObjectTy, nkTupleTy:
|
of nkObjectTy, nkTupleTy:
|
||||||
nil
|
discard
|
||||||
of nkFormalParams:
|
of nkFormalParams:
|
||||||
checkMinSonsLen(n, 1)
|
checkMinSonsLen(n, 1)
|
||||||
if n.sons[0].kind != nkEmpty:
|
if n.sons[0].kind != nkEmpty:
|
||||||
|
|
@ -304,7 +304,7 @@ proc semGenericStmt(c: PContext, n: PNode,
|
||||||
else: body = n.sons[bodyPos]
|
else: body = n.sons[bodyPos]
|
||||||
n.sons[bodyPos] = semGenericStmtScope(c, body, flags, ctx)
|
n.sons[bodyPos] = semGenericStmtScope(c, body, flags, ctx)
|
||||||
closeScope(c)
|
closeScope(c)
|
||||||
of nkPragma, nkPragmaExpr: nil
|
of nkPragma, nkPragmaExpr: discard
|
||||||
of nkExprColonExpr, nkExprEqExpr:
|
of nkExprColonExpr, nkExprEqExpr:
|
||||||
checkMinSonsLen(n, 2)
|
checkMinSonsLen(n, 2)
|
||||||
result.sons[1] = semGenericStmt(c, n.sons[1], flags, ctx)
|
result.sons[1] = semGenericStmt(c, n.sons[1], flags, ctx)
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ proc writeAccess(c: PProcCtx, n: PNode, owner: TThreadOwner) =
|
||||||
# we could not backtrack to a concrete symbol, but that's fine:
|
# we could not backtrack to a concrete symbol, but that's fine:
|
||||||
var lastOwner = analyse(c, n)
|
var lastOwner = analyse(c, n)
|
||||||
case lastOwner
|
case lastOwner
|
||||||
of toNil: nil # fine, toNil can be overwritten
|
of toNil: discard # fine, toNil can be overwritten
|
||||||
of toVoid, toUndefined: internalError(n.info, "writeAccess")
|
of toVoid, toUndefined: internalError(n.info, "writeAccess")
|
||||||
of toTheirs: message(n.info, warnWriteToForeignHeap)
|
of toTheirs: message(n.info, warnWriteToForeignHeap)
|
||||||
of toMine:
|
of toMine:
|
||||||
|
|
@ -369,7 +369,7 @@ proc analyse(c: PProcCtx, n: PNode): TThreadOwner =
|
||||||
result = toMine
|
result = toMine
|
||||||
of nkAsmStmt, nkPragma, nkIteratorDef, nkProcDef, nkMethodDef,
|
of nkAsmStmt, nkPragma, nkIteratorDef, nkProcDef, nkMethodDef,
|
||||||
nkConverterDef, nkMacroDef, nkTemplateDef,
|
nkConverterDef, nkMacroDef, nkTemplateDef,
|
||||||
nkGotoState, nkState, nkBreakState, nkType:
|
nkGotoState, nkState, nkBreakState, nkType, nkIdent:
|
||||||
result = toVoid
|
result = toVoid
|
||||||
of nkExprColonExpr:
|
of nkExprColonExpr:
|
||||||
result = analyse(c, n.sons[1])
|
result = analyse(c, n.sons[1])
|
||||||
|
|
|
||||||
10
todo.txt
10
todo.txt
|
|
@ -1,13 +1,12 @@
|
||||||
version 0.9.4
|
version 0.9.4
|
||||||
=============
|
=============
|
||||||
|
|
||||||
- ``--gc:none`` should complain about when you use the GC
|
|
||||||
- ensure (ref T)(a, b) works as a type conversion and type constructor
|
|
||||||
- Aporia doesn't compile under devel
|
|
||||||
- document new templating symbol binding rules
|
|
||||||
- make '--implicitStatic:on' the default
|
|
||||||
- test&finish first class iterators:
|
- test&finish first class iterators:
|
||||||
* nested iterators
|
* nested iterators
|
||||||
|
- ``--gc:none`` should complain about when you use the GC
|
||||||
|
- ensure (ref T)(a, b) works as a type conversion and type constructor
|
||||||
|
- document new templating symbol binding rules
|
||||||
|
- make '--implicitStatic:on' the default
|
||||||
|
|
||||||
- special rule for ``[]=``
|
- special rule for ``[]=``
|
||||||
- ``=`` should be overloadable; requires specialization for ``=``; general
|
- ``=`` should be overloadable; requires specialization for ``=``; general
|
||||||
|
|
@ -34,7 +33,6 @@ Bugs
|
||||||
- blocks can "export" an identifier but the CCG generates {} for them ...
|
- blocks can "export" an identifier but the CCG generates {} for them ...
|
||||||
- osproc execProcesses can deadlock if all processes fail (as experienced
|
- osproc execProcesses can deadlock if all processes fail (as experienced
|
||||||
in c++ mode)
|
in c++ mode)
|
||||||
- result = result shr 8 for the "system()" wrapper
|
|
||||||
|
|
||||||
|
|
||||||
version 0.9.x
|
version 0.9.x
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue