From 7063670a2cfc9cccfa9078f2dc479cccd16f526e Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 15 Dec 2009 01:50:26 +0100 Subject: variable dynamic lib names --- rod/ast.nim | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'rod/ast.nim') diff --git a/rod/ast.nim b/rod/ast.nim index 0de61f467..89fadf375 100755 --- a/rod/ast.nim +++ b/rod/ast.nim @@ -409,7 +409,8 @@ type kind*: TLibKind generated*: bool # needed for the backends: name*: PRope - path*: string + path*: PNode # can be a string literal! + PLib* = ref TLib TSym* = object of TIdObj @@ -949,6 +950,35 @@ proc sonsNotNil(n: PNode): bool = proc addSonIfNotNil(father, n: PNode) = if n != nil: addSon(father, n) +proc getInt*(a: PNode): biggestInt = + case a.kind + of nkIntLit..nkInt64Lit: result = a.intVal + else: + internalError(a.info, "getInt") + result = 0 + +proc getFloat*(a: PNode): biggestFloat = + case a.kind + of nkFloatLit..nkFloat64Lit: result = a.floatVal + else: + internalError(a.info, "getFloat") + result = 0.0 + +proc getStr*(a: PNode): string = + case a.kind + of nkStrLit..nkTripleStrLit: result = a.strVal + else: + internalError(a.info, "getStr") + result = "" + +proc getStrOrChar*(a: PNode): string = + case a.kind + of nkStrLit..nkTripleStrLit: result = a.strVal + of nkCharLit: result = chr(int(a.intVal)) & "" + else: + internalError(a.info, "getStrOrChar") + result = "" + proc mustRehash(length, counter: int): bool = assert(length > counter) result = (length * 2 < counter * 3) or (length - counter < 4) -- cgit 1.4.1-2-gfad0