4 * (C) Copyright 1989-1995
19 * The module lkhead.c contains the function newhead() which
20 * creates a head structure and the function module() which
21 * loads the module name into the current head structure.
23 * lkhead.c contains the following functions:
27 * lkhead.c contains no local variables.
30 /*)Function VOID newhead()
32 * The function newhead() creates a head structure. All head
33 * structures are linked to form a linked list of head structures
34 * with the current head structure at the tail of the list.
37 * int i evaluation value
38 * head * thp temporary pointer
39 * to a header structure
42 * area *ap Pointer to the current
44 * lfile *cfp The pointer *cfp points to the
45 * current lfile structure
46 * head *headp The pointer to the first
47 * head structure of a linked list
48 * head *hp Pointer to the current
52 * addr_t expr() lkeval.c
53 * VOID * new() lksym.c
54 * VOID lkparea() lkarea.c
57 * A new head structure is created and linked to any
58 * existing linked head structure. The head structure
59 * parameters of file handle, number of areas, and number
60 * of global symbols are loaded into the structure.
61 * The default area "_abs_" is created when the first
62 * head structure is created and an areax structure is
63 * created for every head structure called.
67 * Create a new header entry.
69 * H n areas n global symbols
72 * `------------ hp->h_narea
81 hp = (struct head *) new (sizeof(struct head));
95 * Evaluate and build Area pointer list
97 i = hp->h_narea = eval();
99 hp->a_list = (struct areax **) new (i*sizeof(struct areax *));
101 * Evaluate and build Global symbol pointer list
104 i = hp->h_nglob = eval();
106 hp->s_list = (struct sym **) new (i*sizeof(struct sym *));
108 * Setup Absolute DEF linkage.
111 ap->a_flag = A_ABS|A_OVR;
114 /*)Function VOID module()
116 * The function module() copies the module name into
117 * the current head structure.
120 * char id[] module id string
123 * head *headp The pointer to the first
124 * head structure of a linked list
125 * head *hp Pointer to the current
127 * int lkerr error flag
128 * FILE * stderr c_library
131 * int fprintf() c_library
132 * VOID getid() lklex.c
133 * char * strncpy() c_library
136 * The module name is copied into the head structure.
149 strncpy(hp->m_id, id, NCPS);
151 fprintf(stderr, "No header defined\n");