123 |
value *nval= malloc(sizeof(value)); |
value *nval= malloc(sizeof(value)); |
124 |
stackitem *nitem= malloc(sizeof(stackitem)); |
stackitem *nitem= malloc(sizeof(stackitem)); |
125 |
|
|
126 |
|
assert(nval != NULL); |
127 |
|
assert(nitem != NULL); |
128 |
|
|
129 |
nval->content.ptr= NULL; |
nval->content.ptr= NULL; |
130 |
nval->type= empty; |
nval->type= empty; |
131 |
|
|
338 |
int length= strlen(in_string)+1; |
int length= strlen(in_string)+1; |
339 |
|
|
340 |
new_value->content.ptr= malloc(length); |
new_value->content.ptr= malloc(length); |
341 |
|
assert(new_value != NULL); |
342 |
env->gc_count += length; |
env->gc_count += length; |
343 |
strcpy(new_value->content.ptr, in_string); |
strcpy(new_value->content.ptr, in_string); |
344 |
new_value->type= string; |
new_value->type= string; |
353 |
char *new_string, *current; |
char *new_string, *current; |
354 |
|
|
355 |
new_string= malloc((strlen(old_string)*2)+4); |
new_string= malloc((strlen(old_string)*2)+4); |
356 |
|
assert(new_string != NULL); |
357 |
strcpy(new_string, "sx_"); /* Stack eXternal */ |
strcpy(new_string, "sx_"); /* Stack eXternal */ |
358 |
current= new_string+3; |
current= new_string+3; |
359 |
while(old_string[0] != '\0'){ |
while(old_string[0] != '\0'){ |
423 |
|
|
424 |
/* Create a new symbol */ |
/* Create a new symbol */ |
425 |
(*new_symbol)= malloc(sizeof(symbol)); |
(*new_symbol)= malloc(sizeof(symbol)); |
426 |
|
assert((*new_symbol) != NULL); |
427 |
(*new_symbol)->val= NULL; /* undefined value */ |
(*new_symbol)->val= NULL; /* undefined value */ |
428 |
(*new_symbol)->next= NULL; |
(*new_symbol)->next= NULL; |
429 |
(*new_symbol)->id= malloc(strlen(in_string)+1); |
(*new_symbol)->id= malloc(strlen(in_string)+1); |
430 |
|
assert((*new_symbol)->id != NULL); |
431 |
strcpy((*new_symbol)->id, in_string); |
strcpy((*new_symbol)->id, in_string); |
432 |
|
|
433 |
/* Intern the new symbol in the hash table */ |
/* Intern the new symbol in the hash table */ |
537 |
tstack= stack; |
tstack= stack; |
538 |
do { |
do { |
539 |
titem=malloc(sizeof(stackitem)); |
titem=malloc(sizeof(stackitem)); |
540 |
|
assert(titem != NULL); |
541 |
titem->item=val; |
titem->item=val; |
542 |
titem->next=tstack; |
titem->next=tstack; |
543 |
tstack=titem; /* Put it on the stack */ |
tstack=titem; /* Put it on the stack */ |
1169 |
toss(env); if(env->err) return; |
toss(env); if(env->err) return; |
1170 |
len= strlen(a_val->content.ptr)+strlen(b_val->content.ptr)+1; |
len= strlen(a_val->content.ptr)+strlen(b_val->content.ptr)+1; |
1171 |
new_string= malloc(len); |
new_string= malloc(len); |
1172 |
|
assert(new_string != NULL); |
1173 |
strcpy(new_string, b_val->content.ptr); |
strcpy(new_string, b_val->content.ptr); |
1174 |
strcat(new_string, a_val->content.ptr); |
strcat(new_string, a_val->content.ptr); |
1175 |
push_cstring(env, new_string); |
push_cstring(env, new_string); |
1769 |
} |
} |
1770 |
|
|
1771 |
env->in_string= malloc(strlen(CAR(env->head)->content.ptr)+1); |
env->in_string= malloc(strlen(CAR(env->head)->content.ptr)+1); |
1772 |
|
assert(env->in_string != NULL); |
1773 |
env->free_string= env->in_string; /* Save the original pointer */ |
env->free_string= env->in_string; /* Save the original pointer */ |
1774 |
strcpy(env->in_string, CAR(env->head)->content.ptr); |
strcpy(env->in_string, CAR(env->head)->content.ptr); |
1775 |
toss(env); if(env->err) return; |
toss(env); if(env->err) return; |
1777 |
|
|
1778 |
inlength= strlen(env->in_string)+1; |
inlength= strlen(env->in_string)+1; |
1779 |
match= malloc(inlength); |
match= malloc(inlength); |
1780 |
|
assert(match != NULL); |
1781 |
|
|
1782 |
if(sscanf(env->in_string, blankform, &readlength) != EOF |
if(sscanf(env->in_string, blankform, &readlength) != EOF |
1783 |
&& readlength != -1) { |
&& readlength != -1) { |