| 121 |
|
|
| 122 |
int push_ref(stackitem** stack_head, hashtbl in_hash, const char* in_string) |
int push_ref(stackitem** stack_head, hashtbl in_hash, const char* in_string) |
| 123 |
{ |
{ |
| 124 |
void* handle; |
static void* handle= NULL; |
| 125 |
void* symbol; |
void* symbol; |
| 126 |
|
|
| 127 |
stackitem* new_item= malloc(sizeof(stackitem)); |
stackitem* new_item= malloc(sizeof(stackitem)); |
| 128 |
new_item->content.ptr= *hash(in_hash, in_string); |
new_item->content.ptr= *hash(in_hash, in_string); |
| 129 |
new_item->type= ref; |
new_item->type= ref; |
| 130 |
|
|
| 131 |
if(new_item->content.ptr==NULL) { |
if(handle==NULL) |
| 132 |
handle= dlopen(NULL, RTLD_LAZY); |
handle= dlopen(NULL, RTLD_LAZY); |
| 133 |
|
|
| 134 |
|
if(new_item->content.ptr==NULL) { |
| 135 |
symbol= dlsym(handle, in_string); |
symbol= dlsym(handle, in_string); |
| 136 |
if(dlerror()==NULL) |
if(dlerror()==NULL) |
| 137 |
def_func(in_hash, symbol, in_string); |
def_func(in_hash, symbol, in_string); |
| 169 |
printf("%ld: \"%s\"\n", counter, (char*)stack_head->content.ptr); |
printf("%ld: \"%s\"\n", counter, (char*)stack_head->content.ptr); |
| 170 |
break; |
break; |
| 171 |
case ref: |
case ref: |
| 172 |
|
printf("%ld: %s\n", counter, ((stackitem*)stack_head->content.ptr)->id); |
| 173 |
|
break; |
| 174 |
case func: |
case func: |
| 175 |
case symbol: |
case symbol: |
| 176 |
printf("%ld: %p\n", counter, stack_head->content.ptr); |
printf("%ld: %p\n", counter, stack_head->content.ptr); |
| 247 |
case string: |
case string: |
| 248 |
printf("%s", (char*)(*stack_head)->content.ptr); |
printf("%s", (char*)(*stack_head)->content.ptr); |
| 249 |
break; |
break; |
|
case symbol: |
|
|
printf("%s", (*stack_head)->id); |
|
| 250 |
case ref: |
case ref: |
| 251 |
|
printf("%s", ((stackitem*)(*stack_head)->content.ptr)->id); |
| 252 |
|
break; |
| 253 |
|
case symbol: |
| 254 |
default: |
default: |
| 255 |
printf("%p", (*stack_head)->content.ptr); |
printf("%p", (*stack_head)->content.ptr); |
| 256 |
break; |
break; |