<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -34,6 +34,7 @@ obj SYM2OBJ (char * s){ /* Find a symbol, or save it if it's the first time */
   syms[nsyms]        = malloc (sizeof(symbol)); /* Symbols never go away, then can be malloc-ed */
   syms[nsyms]-&gt;type  = T_SYM;
   syms[nsyms]-&gt;value = (char *) malloc (strlen (s) + 1);
+  syms[nsyms]-&gt;global = NULL; //let eval handle this
   strcpy (syms[nsyms]-&gt;value, s);
 
   return (obj) syms[nsyms++];</diff>
      <filename>a2c.c</filename>
    </modified>
    <modified>
      <diff>@@ -30,6 +30,7 @@ typedef struct {
 typedef struct {
   long type; /* T_SYM */
   char * value; /* UTF-8 chars */
+  obj * global; /*value assigned to global*/
 } symbol;
 
 typedef struct {
@@ -91,6 +92,10 @@ int AFN(obj o){
 obj DBL2OBJ (double d);
 obj SYM2OBJ (char * s); /* Find a symbol, or save it if it's the first time */
 
+#define SYMEVAL()\
+	{obj y = TOS();\
+	TOS() = ((symbol*) y)-&gt;global ? *(((symbol*) y)-&gt;global) : NILOBJ; }
+
 #define GLOBAL(i) global[i]
 #define LOCAL(i) stack[i]
 #define CLOSURE_REF(self,i) ((obj *)(self))[i+2]</diff>
      <filename>a2c.h</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,8 @@
                        (++ constant-count)]
      code-gen nil
      compile-all-lambdas nil
-     compile-constants nil)
+     compile-constants nil
+     is-symeval-used nil)
 
   ; make sure global-vars includes call*
   (unless (some [is _!id _!uid 'call*]
@@ -73,6 +74,9 @@
           (aprim ast)
             (let args ast!subx
               (if
+                (is ast!op '%symeval)
+                  (do (assert is-symeval-used)
+                    (list (cg-args args stack-env) &quot; SYMEVAL();&quot;))
                 (is ast!op '%apply)
                   (list (cg-args args stack-env) &quot; APPLY();&quot;)
                 (is ast!op '%string-ref)
@@ -209,6 +213,18 @@
               &quot;}\n&quot;)
         ; no constants; dummy initialize
         &quot;\n#define init_constants()\n&quot;)
+      (if is-symeval-used
+          (list &quot;void init_symeval(void){\nstruct symbol* symp;\n&quot;
+                (let i -1
+                  (mapeach var global-vars
+                    (++ i)
+                    (list
+                      &quot;symp = (struct symbol*) SYM2OBJ(&quot;
+                         (tostring:write (coerce var!uid 'string)) &quot;);\n&quot;
+                      &quot;symp-&gt;global = &amp;GLOBAL(&quot; i &quot;);\n&quot;)))
+                &quot;}\n&quot;)
+          ; no symeval; dummy initialize
+          &quot;\n#define init_symeval()\n&quot;)
       code-prefix*
       code-execute*
       code</diff>
      <filename>codegen.arc</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a5d645abcf32468e63e64ef9feeb3a32f6d2abd8</id>
    </parent>
  </parents>
  <author>
    <name>Alan Manuel K. Gloria</name>
    <email>almkglor@gmail.com</email>
  </author>
  <url>http://github.com/sacado/arc2c/commit/0588c7649571c61f62cec1afc5f90d314d23aa31</url>
  <id>0588c7649571c61f62cec1afc5f90d314d23aa31</id>
  <committed-date>2008-07-31T04:20:55-07:00</committed-date>
  <authored-date>2008-07-31T04:20:55-07:00</authored-date>
  <message>a2c.h, a2c.c, codegen: added support in the target for 'symeval</message>
  <tree>bd7125042fe29aad8813c2c1aa112abb18cd7cce</tree>
  <committer>
    <name>Alan Manuel K. Gloria</name>
    <email>almkglor@gmail.com</email>
  </committer>
</commit>
