3 Copyright (C) 1989-1995 Alan R. Baldwin
4 721 Berkeley St., Kent, Ohio 44240
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 * The module lkhead.c contains the function newhead() which
26 * creates a head structure and the function module() which
27 * loads the module name into the current head structure.
29 * lkhead.c contains the following functions:
33 * lkhead.c contains no local variables.
36 /*)Function VOID newhead()
38 * The function newhead() creates a head structure. All head
39 * structures are linked to form a linked list of head structures
40 * with the current head structure at the tail of the list.
43 * int i evaluation value
44 * head * thp temporary pointer
45 * to a header structure
48 * area *ap Pointer to the current
50 * lfile *cfp The pointer *cfp points to the
51 * current lfile structure
52 * head *headp The pointer to the first
53 * head structure of a linked list
54 * head *hp Pointer to the current
58 * Addr_T expr() lkeval.c
59 * VOID * new() lksym.c
60 * VOID lkparea() lkarea.c
63 * A new head structure is created and linked to any
64 * existing linked head structure. The head structure
65 * parameters of file handle, number of areas, and number
66 * of global symbols are loaded into the structure.
67 * The default area "_abs_" is created when the first
68 * head structure is created and an areax structure is
69 * created for every head structure called.
73 * Create a new header entry.
75 * H n areas n global symbols
78 * `------------ hp->h_narea
87 hp = (struct head *) new (sizeof(struct head));
101 * Evaluate and build Area pointer list
103 i = hp->h_narea = eval();
105 hp->a_list = (struct areax **) new (i*sizeof(struct areax *));
107 * Evaluate and build Global symbol pointer list
110 i = hp->h_nglob = eval();
112 hp->s_list = (struct sym **) new (i*sizeof(struct sym *));
114 * Setup Absolute DEF linkage.
121 /*)Function VOID module()
123 * The function module() copies the module name into
124 * the current head structure.
127 * char id[] module id string
130 * head *headp The pointer to the first
131 * head structure of a linked list
132 * head *hp Pointer to the current
134 * int lkerr error flag
135 * FILE * stderr c_library
138 * int fprintf() c_library
139 * VOID getid() lklex.c
140 * char * strncpy() c_library
143 * The module name is copied into the head structure.
156 strncpy(hp->m_id, id, NCPS);
158 fprintf(stderr, "No header defined\n");