4 * (C) Copyright 1989-1995
18 * The module lkhead.c contains the function newhead() which
19 * creates a head structure and the function module() which
20 * loads the module name into the current head structure.
22 * lkhead.c contains the following functions:
26 * lkhead.c contains no local variables.
29 /*)Function VOID newhead()
31 * The function newhead() creates a head structure. All head
32 * structures are linked to form a linked list of head structures
33 * with the current head structure at the tail of the list.
36 * int i evaluation value
37 * head * thp temporary pointer
38 * to a header structure
41 * area *ap Pointer to the current
43 * lfile *cfp The pointer *cfp points to the
44 * current lfile structure
45 * head *headp The pointer to the first
46 * head structure of a linked list
47 * head *hp Pointer to the current
51 * Addr_T expr() lkeval.c
52 * VOID * new() lksym.c
53 * VOID lkparea() lkarea.c
56 * A new head structure is created and linked to any
57 * existing linked head structure. The head structure
58 * parameters of file handle, number of areas, and number
59 * of global symbols are loaded into the structure.
60 * The default area "_abs_" is created when the first
61 * head structure is created and an areax structure is
62 * created for every head structure called.
66 * Create a new header entry.
68 * H n areas n global symbols
71 * `------------ hp->h_narea
80 hp = (struct head *) new (sizeof(struct head));
94 * Evaluate and build Area pointer list
96 i = hp->h_narea = eval();
98 hp->a_list = (struct areax **) new (i*sizeof(struct areax *));
100 * Evaluate and build Global symbol pointer list
103 i = hp->h_nglob = eval();
105 hp->s_list = (struct sym **) new (i*sizeof(struct sym *));
107 * Setup Absolute DEF linkage.
110 ap->a_flag = A_ABS|A_OVR;
113 /*)Function VOID module()
115 * The function module() copies the module name into
116 * the current head structure.
119 * char id[] module id string
122 * head *headp The pointer to the first
123 * head structure of a linked list
124 * head *hp Pointer to the current
126 * int lkerr error flag
127 * FILE * stderr c_library
130 * int fprintf() c_library
131 * VOID getid() lklex.c
132 * char * strncpy() c_library
135 * The module name is copied into the head structure.
148 strncpy(hp->m_id, id, NCPS);
150 fprintf(stderr, "No header defined\n");