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

Diff of /stack/stack.c

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

revision 1.5 by teddy, Tue Jan 8 00:03:16 2002 UTC revision 1.6 by masse, Tue Jan 8 12:33:57 2002 UTC
# Line 121  void def_sym(hashtbl in_hashtbl, const c Line 121  void def_sym(hashtbl in_hashtbl, const c
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);
# Line 167  void print_st(stackitem* stack_head, lon Line 169  void print_st(stackitem* stack_head, lon
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);
# Line 243  extern void print(stackitem** stack_head Line 247  extern void print(stackitem** stack_head
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;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26