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