summary refs log tree commit diff stats
path: root/rod/ast.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-desktop>2009-12-15 01:50:26 +0100
committerAndreas Rumpf <andreas@andreas-desktop>2009-12-15 01:50:26 +0100
commit7063670a2cfc9cccfa9078f2dc479cccd16f526e (patch)
tree5e60f18aa4ed24beb14356a7ecdd2b5ba8c032c4 /rod/ast.nim
parent3b7ef2288f60bc5c355ad9aeaa127431ec3aee7b (diff)
downloadNim-7063670a2cfc9cccfa9078f2dc479cccd16f526e.tar.gz
variable dynamic lib names
Diffstat (limited to 'rod/ast.nim')
-rwxr-xr-xrod/ast.nim32
1 files changed, 31 insertions, 1 deletions
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)