/[gcl]/gcl/o/fat_string.c
ViewVC logotype

Diff of /gcl/o/fat_string.c

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

revision 1.3 by camm, Tue Dec 18 20:46:00 2001 UTC revision 1.4 by camm, Wed Jun 12 23:56:59 2002 UTC
# Line 2  Line 2 
2  (c) Copyright W. Schelter 1988, All rights reserved.  (c) Copyright W. Schelter 1988, All rights reserved.
3  */  */
4    
   
5  #include "include.h"  #include "include.h"
6  #include "page.h"  #include "page.h"
7  #define FAT_STRING  #define FAT_STRING
# Line 65  object funobj; Line 64  object funobj;
64  char *data_load_addr =0;  char *data_load_addr =0;
65  #endif  #endif
66    
67    
68    #ifdef SPECIAL_RSYM
69    
70  read_special_symbols(symfile)  read_special_symbols(symfile)
71  char *symfile;  char *symfile;
72  {FILE *symin;  {FILE *symin;
# Line 132  object x0; Line 134  object x0;
134   (void) strncpy(str,x->st.st_self,n);   (void) strncpy(str,x->st.st_self,n);
135   read_special_symbols(str);   read_special_symbols(str);
136    /* we sort them since these are used by the sfasl loader too */    /* we sort them since these are used by the sfasl loader too */
137  qsort((char*)(c_table.ptable),(int)(c_table.length),sizeof(struct node),node_compare);   qsort((char*)(c_table.ptable),(int)(c_table.length),sizeof(struct node),node_compare);
138    free(str);}    free(str);}
139   RETURN1(x0);   RETURN1(x0);
140  }  }
141    
142    #endif /* special_rsym */
143    
144  #define CFUN_LIM 10000  #define CFUN_LIM 10000
145    
146  int maxpage;  int maxpage;
# Line 204  char *node1, *node2; Line 208  char *node1, *node2;
208  }  }
209    
210    
211    #if defined(HAVE_LIBBFD) && ! defined(SPECIAL_RSYM)
212    
213    boolean
214    bfd_combined_table_update(struct bfd_link_hash_entry *h,PTR ct) {
215    
216      if (ct!=&combined_table)
217        return false;
218    
219      if (h->type!=bfd_link_hash_defined)
220        return true;
221    
222      if (!h->u.def.section) {
223        FEerror("Symbol without section");
224        return false;
225      }
226    
227      SYM_ADDRESS(combined_table,combined_table.length)=h->u.def.value+h->u.def.section->vma;
228      SYM_STRING(combined_table,combined_table.length)=(char *)h->root.string;
229      
230      combined_table.length++;
231    
232      return true;
233    
234    }
235    #endif
236    
237    
238  DEFUNO("SET-UP-COMBINED",object,fSset_up_combined,SI  DEFUNO("SET-UP-COMBINED",object,fSset_up_combined,SI
239     ,0,1,NONE,OO,OO,OO,OO,siLset_up_combined,"")(va_alist)     ,0,1,NONE,OO,OO,OO,OO,siLset_up_combined,"")(va_alist)
240  va_dcl  va_dcl
241  {       int nargs=VFUN_NARGS;  {
242          unsigned int n;    int nargs=VFUN_NARGS;
243          object siz;    unsigned int n;
244          va_list ap;    object siz;
245          { va_start(ap);    va_list ap;
246            if (nargs>=1) siz=va_arg(ap,object);  
247            else goto LDEFAULT1;    {
248            goto LEND_VARARG;      va_start(ap);
249          LDEFAULT1: siz = small_fixnum(0);      if (nargs>=1)
250          LEND_VARARG: va_end(ap);}        siz=va_arg(ap,object);
251          CHECK_ARG_RANGE(0,1);      else
252          n = (unsigned int) fix(siz);        goto LDEFAULT1;
253   cfuns_to_combined_table(n);      
254   if (c_table.ptable)      goto LEND_VARARG;
255     {int j,k;          
256      LDEFAULT1:
257        siz = small_fixnum(0);
258      LEND_VARARG:
259        va_end(ap);
260      }
261    
262      CHECK_ARG_RANGE(0,1);
263      n = (unsigned int) fix(siz);
264      cfuns_to_combined_table(n);
265    
266    #if !defined(HAVE_LIBBFD) && !defined(SPECIAL_RSYM)
267    #error Need either BFD or SPECIAL_RSYM
268    #endif
269    
270    #if defined(SPECIAL_RSYM)
271      if (c_table.ptable) {
272    
273        int j,k;
274    
275      if((k=combined_table.length)+c_table.length >=      if((k=combined_table.length)+c_table.length >=
276         combined_table.alloc_length)         combined_table.alloc_length)
277        cfuns_to_combined_table(combined_table.length+c_table.length +20);        cfuns_to_combined_table(combined_table.length+c_table.length +20);
278      for(j = 0; j < c_table.length;)  
279      { SYM_ADDRESS(combined_table,k) =SYM_ADDRESS(c_table,j);      for(j = 0; j < c_table.length;) {
280          SYM_ADDRESS(combined_table,k) =SYM_ADDRESS(c_table,j);
281        SYM_STRING(combined_table,k) =SYM_STRING(c_table,j);        SYM_STRING(combined_table,k) =SYM_STRING(c_table,j);
282        k++;j++;        k++;
283      };        j++;
284        }
285      combined_table.length += c_table.length ;}      combined_table.length += c_table.length ;}
286   qsort((char*)combined_table.ptable,(int)combined_table.length,  
287         sizeof(struct node),address_node_compare);  #else
288          RETURN1(siz);  #if defined(HAVE_LIBBFD)
289      if (link_info.hash) {
290    
291        if (combined_table.length+link_info.hash->table.size >=
292            combined_table.alloc_length)
293          cfuns_to_combined_table(combined_table.length+link_info.hash->table.size+20);
294    
295        bfd_link_hash_traverse(link_info.hash,
296                                     bfd_combined_table_update,&combined_table);
297    
298      }
299    #endif
300    #endif
301    
302      qsort((char*)combined_table.ptable,(int)combined_table.length,
303            sizeof(struct node),address_node_compare);
304      RETURN1(siz);
305    
306  }  }
307    
308  static int  prof_start;  static int  prof_start;

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

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26