Charj: add some infrastructure for extern types and pre-define a few
authorAaron Becker <akbecker@gmail.com>
Thu, 15 Jul 2010 19:40:58 +0000 (14:40 -0500)
committerAaron Becker <akbecker@gmail.com>
Thu, 15 Jul 2010 19:40:58 +0000 (14:40 -0500)
src/langs/charj/src/charj/translator/ExternalSymbol.java [new file with mode: 0644]
src/langs/charj/src/charj/translator/MethodSymbol.java
src/langs/charj/src/charj/translator/SymbolTable.java

diff --git a/src/langs/charj/src/charj/translator/ExternalSymbol.java b/src/langs/charj/src/charj/translator/ExternalSymbol.java
new file mode 100644 (file)
index 0000000..dc98e90
--- /dev/null
@@ -0,0 +1,9 @@
+
+package charj.translator;
+
+public class ExternalSymbol extends ClassSymbol implements Scope, Type {
+    
+    public ExternalSymbol(SymbolTable symtab, String name) {
+        super(symtab, name);
+    }
+}
index 4e4059b4e504503544b5227787bc595a21457872..c195b12dad46e22c16a025c18beac0229b12c2b1 100644 (file)
@@ -24,11 +24,14 @@ public class MethodSymbol
     public boolean isCtor = false;
     public boolean isTraced = false;
 
-    public MethodSymbol(SymbolTable symtab)
-    {
+    public MethodSymbol(SymbolTable symtab) {
         super(symtab);
     }
 
+    public MethodSymbol(SymbolTable symtab, String name) {
+        super(symtab, name);
+    }
+
     public MethodSymbol(
             SymbolTable symtab,
             String name,
index 83e3bb5edbdf20df1333b061334e853f081d0380..72b8e84ed1bc5009d870348e55107281d8128fa5 100644 (file)
@@ -74,6 +74,13 @@ public class SymbolTable {
             lang.define(entry.getKey(), c);
             c.isPrimitive = true;
         }
+
+        defaultPkg.define("CkArgMsg", new ExternalSymbol(this, "CkArgMsg"));
+        defaultPkg.define("CkPrintf", new MethodSymbol(this, "CkPrintf"));
+        defaultPkg.define("CkNumPes", new MethodSymbol(this, "CkNumPes"));
+        defaultPkg.define("CkMyPe", new MethodSymbol(this, "CkMyPe"));
+        defaultPkg.define("CkExit", new MethodSymbol(this, "CkExit"));
+        defaultPkg.define("CmiWallTimer", new MethodSymbol(this, "CmiWallTimer"));
     }
 
     public ClassSymbol resolveBuiltinType(String type) {