file.hh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* $Id$ */
  2. /* Structure for information about files. This information consists of three
  3. parts:
  4. - file name and directory
  5. - mapping of line numbers to offsets in file
  6. - mapping of object adresses to lines in file and vice versa
  7. */
  8. #define LOGHSIZ 6 /* make sure HSIZ is a power of 2 */
  9. #define HSIZ (1 << LOGHSIZ)
  10. #define HASH(line) ((line) & (HSIZ-1))
  11. typedef struct file {
  12. struct symbol *f_sym;
  13. struct symbol *f_base;
  14. char *f_fullname; /* name including directory */
  15. struct scope *f_scope; /* reference to scope of this file */
  16. t_lineno f_nlines; /* number of lines in file */
  17. union {
  18. long *ff_linepos; /* positions of lines in file */
  19. struct file *ff_next; /* only for BINCL, EINCL */
  20. } f_x;
  21. #define f_linepos f_x.ff_linepos
  22. #define f_next f_x.ff_next
  23. struct outname *f_line_addr[HSIZ];
  24. /* hash table, mapping line numbers to
  25. outname structures. Collisions are
  26. resolved by chaining:
  27. */
  28. #define next_outname(n) ((struct outname *) ((n)->on_mptr))
  29. #define setnext_outname(n,m) ((n)->on_mptr = (char *) (m))
  30. } t_file, *p_file;
  31. /* ALLOCDEF "file" 10 */