/[cvs]/stack/stack.c
ViewVC logotype

Diff of /stack/stack.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.80 by teddy, Thu Feb 14 12:20:09 2002 UTC revision 1.81 by masse, Thu Feb 14 19:20:28 2002 UTC
# Line 58  typedef struct { Line 58  typedef struct {
58    stackitem *head;              /* Head of the stack */    stackitem *head;              /* Head of the stack */
59    hashtbl symbols;              /* Hash table of all variable bindings */    hashtbl symbols;              /* Hash table of all variable bindings */
60    int err;                      /* Error flag */    int err;                      /* Error flag */
   int non_eval_flag;  
61    char *in_string;              /* Input pending to be read */    char *in_string;              /* Input pending to be read */
62    char *free_string;            /* Free this string when all input is    char *free_string;            /* Free this string when all input is
63                                     read from in_string */                                     read from in_string */
# Line 75  void init_env(environment *env) Line 74  void init_env(environment *env)
74    
75    env->in_string= NULL;    env->in_string= NULL;
76    env->err= 0;    env->err= 0;
   env->non_eval_flag= 0;  
77    for(i= 0; i<HASHTBLSIZE; i++)    for(i= 0; i<HASHTBLSIZE; i++)
78      env->symbols[i]= NULL;      env->symbols[i]= NULL;
79  }  }
# Line 102  void free_val(value *val){ Line 100  void free_val(value *val){
100          free(item);             /* free the stackitem */          free(item);             /* free the stackitem */
101          item=temp;              /* go to next stackitem */          item=temp;              /* go to next stackitem */
102        }        }
       free(val);                /* Free the actual list value */  
103        break;        break;
104      case integer:      case integer:
105      case func:      case func:
106      case symb:      case symb:
107        break;        break;
108      }      }
109        if(val->id!=NULL)
110          free(val->id);
111        free(val);          /* Free the actual list value */
112    }    }
113  }  }
114    
# Line 174  void push_int(environment *env, int in_v Line 174  void push_int(environment *env, int in_v
174        
175    new_value->content.val= in_val;    new_value->content.val= in_val;
176    new_value->type= integer;    new_value->type= integer;
177    new_value->refcount=1;    new_value->refcount= 1;
178      new_value->id= NULL;
179    
180    push_val(env, new_value);    push_val(env, new_value);
181  }  }
# Line 187  void push_cstring(environment *env, cons Line 188  void push_cstring(environment *env, cons
188    new_value->content.ptr= malloc(strlen(in_string)+1);    new_value->content.ptr= malloc(strlen(in_string)+1);
189    strcpy(new_value->content.ptr, in_string);    strcpy(new_value->content.ptr, in_string);
190    new_value->type= string;    new_value->type= string;
191    new_value->refcount=1;    new_value->refcount= 1;
192      new_value->id= NULL;
193    
194    push_val(env, new_value);    push_val(env, new_value);
195  }  }
# Line 213  char *mangle_str(const char *old_string) Line 215  char *mangle_str(const char *old_string)
215  }  }
216    
217  extern void mangle(environment *env){  extern void mangle(environment *env){
   value *new_value;  
218    char *new_string;    char *new_string;
219    
220    if((env->head)==NULL) {    if((env->head)==NULL) {
# Line 233  extern void mangle(environment *env){ Line 234  extern void mangle(environment *env){
234    toss(env);    toss(env);
235    if(env->err) return;    if(env->err) return;
236    
237    new_value= malloc(sizeof(value));    push_cstring(env, new_string);
   new_value->content.ptr= new_string;  
   new_value->type= string;  
   new_value->refcount=1;  
   
   push_val(env, new_value);  
238  }  }
239    
240  /* Push a symbol onto the stack. */  /* Push a symbol onto the stack. */

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.81

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26