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

Diff of /stack/symbols.c

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

revision 1.2 by masse, Mon Aug 4 14:13:16 2003 UTC revision 1.4 by masse, Tue Aug 5 09:09:51 2003 UTC
# Line 1  Line 1 
 #include <stdio.h>  
1  #include "stack.h"  #include "stack.h"
2    
3  /* Print newline. */  /* Print newline. */
# Line 294  extern void def(environment *env) Line 293  extern void def(environment *env)
293    }    }
294    
295    /* long names are a pain */    /* long names are a pain */
296    sym= CAR(env->head)->content.ptr;    sym= CAR(env->head)->content.sym;
297    
298    /* Bind the symbol to the value */    /* Bind the symbol to the value */
299    sym->val= CAR(CDR(env->head));    sym->val= CAR(CDR(env->head));
# Line 360  extern void sx_2b(environment *env) Line 359  extern void sx_2b(environment *env)
359      protect(a_val); protect(b_val);      protect(a_val); protect(b_val);
360      toss(env); if(env->err) return;      toss(env); if(env->err) return;
361      toss(env); if(env->err) return;      toss(env); if(env->err) return;
362      len= strlen(a_val->content.ptr)+strlen(b_val->content.ptr)+1;      len= strlen(a_val->content.string)+strlen(b_val->content.string)+1;
363      new_string= malloc(len);      new_string= malloc(len);
364      assert(new_string != NULL);      assert(new_string != NULL);
365      strcpy(new_string, b_val->content.ptr);      strcpy(new_string, b_val->content.string);
366      strcat(new_string, a_val->content.ptr);      strcat(new_string, a_val->content.string);
367      push_cstring(env, new_string);      push_cstring(env, new_string);
368      unprotect(a_val); unprotect(b_val);      unprotect(a_val); unprotect(b_val);
369      free(new_string);      free(new_string);
# Line 1439  extern void sx_636c6f7365(environment *e Line 1438  extern void sx_636c6f7365(environment *e
1438    
1439    toss(env);    toss(env);
1440  }  }
1441    
1442    extern void mangle(environment *env)
1443    {
1444      char *new_string;
1445    
1446      if(env->head->type==empty) {
1447        printerr("Too Few Arguments");
1448        env->err= 1;
1449        return;
1450      }
1451    
1452      if(CAR(env->head)->type!=string) {
1453        printerr("Bad Argument Type");
1454        env->err= 2;
1455        return;
1456      }
1457    
1458      new_string= mangle_str(CAR(env->head)->content.string);
1459    
1460      toss(env);
1461      if(env->err) return;
1462    
1463      push_cstring(env, new_string);
1464    }
1465    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26