* configure, configure.in, config.dsp, config_vc.awk,
[fw/sdcc] / as / link / aslink.h
1 /* aslink.h */
2
3 /*
4  * (C) Copyright 1989-1996
5  * All Rights Reserved
6  *
7  * Alan R. Baldwin
8  * 721 Berkeley St.
9  * Kent, Ohio  44240
10  *
11  * 28-Oct-97 JLH:
12  *           - add proto for StoreString
13  *           - change s_id from [NCPS] to pointer
14  *           - change NCPS to 80
15  *           - case sensitive
16  *           - add R_J11 for 8051 assembler
17  * 31-Oct-97 JLH:
18  *           - add jflag and jfp for NoICE output
19  * 30-Jan-98 JLH:
20  *           - add memory space flags to a_flag for 8051
21  *
22  * Extensions: P. Felber
23  */
24
25 #include "getline.h"
26 #include "asxxxx_config.h"
27
28 #define VERSION "V01.75 + NoICE + SDCC Feb 1999"
29
30 /*
31  * Case Sensitivity Flag
32  */
33 #define CASE_SENSITIVE  1
34
35 /*)Module       asmlnk.h
36  *
37  *      The module asmlnk.h contains the definitions for constants,
38  *      structures, global variables, and LKxxxx functions
39  *      contained in the LKxxxx.c files.
40  */
41
42 /*)BUILD
43         $(PROGRAM) =    ASLINK
44         $(INCLUDE) =    ASLINK.H
45         $(FILES) = {
46                 LKMAIN.C
47                 LKLEX.C
48                 LKAREA.C
49                 LKHEAD.C
50                 LKSYM.C
51                 LKEVAL.C
52                 LKDATA.C
53                 LKLIST.C
54                 LKRLOC.C
55                 LKLIBR.C
56                 LKS19.C
57                 LKIHX.C
58         }
59         $(STACK) = 2000
60 */
61
62 #if defined  decus
63 /* DECUS C void definition */
64 /* File/extension seperator */
65
66 #define VOID        char
67 #define FSEPX       '.'
68
69 #elif defined  PDOS
70 /* PDOS C void definition */
71 /* File/extension seperator */
72
73 #define VOID        char
74 #define FSEPX       ':'
75
76 #elif defined UNIX
77 /* UNIX void definition */
78 /* File/extension seperator */
79
80 #define VOID        void
81 #define FSEPX       '.'
82 #define LKDIRSEP    '/'
83 #define LKDIRSEPSTR "/"
84 #define OTHERSYSTEM
85
86 #else
87 /* DOS/WINDOWS void definition */
88 /* File/extension seperator */
89
90 #define VOID        void
91 #define FSEPX       '.'
92 #define LKDIRSEP    '\\'
93 #define LKDIRSEPSTR "\\"
94 #define OTHERSYSTEM
95
96 #endif
97
98 /*
99  * PATH_MAX
100  */
101 #include <limits.h>
102 #ifndef PATH_MAX                /* POSIX, but not required   */
103  #if defined(__BORLANDC__) || defined(_MSC_VER)
104   #include <stdlib.h>
105   #define PATH_MAX      _MAX_PATH
106  #else
107   #define PATH_MAX      255     /* define a reasonable value */
108  #endif
109 #endif
110
111 #ifdef SDK
112     #define LKOBJEXT "o"
113 #else /* SDK */
114     #define LKOBJEXT "rel"
115 #endif /* SDK */
116
117 /*
118  * This file defines the format of the
119  * relocatable binary file.
120  */
121
122 #define NCPS    80              /* characters per symbol (JLH: change from 8) */
123 #define NDATA   16              /* actual data */
124 #define NINPUT  PATH_MAX        /* Input buffer size */
125 #define NHASH   64              /* Buckets in hash table */
126 #define HMASK   077             /* Hash mask */
127 #define NLPP    60              /* Lines per page */
128 #define NTXT    16              /* T values */
129
130 /*
131  *      The "R_" relocation constants define values used in
132  *      generating the assembler relocation output data for
133  *      areas, symbols, and code.
134  *
135  *
136  *      Relocation types.
137  *
138  *             7     6     5     4     3     2     1     0
139  *          +-----+-----+-----+-----+-----+-----+-----+-----+
140  *          | MSB | PAGn| PAG0| USGN| BYT2| PCR | SYM | BYT |
141  *          +-----+-----+-----+-----+-----+-----+-----+-----+
142  */
143
144 #define R_WORD  0x00            /* 16 bit */
145 #define R_BYTE  0x01            /*  8 bit */
146
147 #define R_AREA  0x00            /* Base type */
148 #define R_SYM   0x02
149
150 #define R_NORM  0x00            /* PC adjust */
151 #define R_PCR   0x04
152
153 #define R_BYT1  0x00            /* Byte count for R_BYTE = 1 */
154 #define R_BYT2  0x08            /* Byte count for R_BYTE = 2 */
155
156 #define R_SGND  0x00            /* Signed Byte */
157 #define R_USGN  0x10            /* Unsigned Byte */
158
159 #define R_NOPAG 0x00            /* Page Mode */
160 #define R_PAG0  0x20            /* Page '0' */
161 #define R_PAG   0x40            /* Page 'nnn' */
162
163 #define R_LSB   0x00            /* low byte */
164 #define R_MSB   0x80            /* high byte */
165
166 #define R_BYT3  0x100           /* if R_BYTE is set, this is a
167                                  * 3 byte address, of which
168                                  * the linker must select one byte.
169                                  */
170 #define R_HIB   0x200           /* If R_BYTE & R_BYT3 are set, linker
171                                  * will select byte 3 of the relocated
172                                  * 24 bit address.
173                                  */
174
175 #define R_BIT   0x400           /* Linker will convert from byte-addressable
176                                  * space to bit-addressable space.
177                                  */
178
179 #define R_J11   (R_WORD|R_BYT2) /* JLH: 11 bit JMP and CALL (8051) */
180 #define R_J19   (R_WORD|R_BYT2|R_MSB) /* 19 bit JMP/CALL (DS80C390) */
181 #define R_C24   (R_WORD|R_BYT1|R_MSB) /* 24 bit address (DS80C390) */
182 #define R_J19_MASK (R_BYTE|R_BYT2|R_MSB)
183
184 #define IS_R_J19(x) (((x) & R_J19_MASK) == R_J19)
185 #define IS_R_J11(x) (((x) & R_J19_MASK) == R_J11)
186 #define IS_C24(x) (((x) & R_J19_MASK) == R_C24)
187
188 #define R_ESCAPE_MASK   0xf0    /* Used to escape relocation modes
189                                  * greater than 0xff in the .rel
190                                  * file.
191                                  */
192
193 /*
194  * Global symbol types.
195  */
196 #define S_REF   1               /* referenced */
197 #define S_DEF   2               /* defined */
198
199 /*
200  * Area type flags
201  */
202 #define A_CON     0000          /* concatenate */
203 #define A_OVR     0004          /* overlay */
204 #define A_REL     0000          /* relocatable */
205 #define A_ABS     0010          /* absolute */
206 #define A_NOPAG   0000          /* non-paged */
207 #define A_PAG     0020          /* paged */
208
209 /* Additional flags for 8051 address spaces */
210 #define A_DATA    0000          /* data space (default)*/
211 #define A_CODE    0040          /* code space */
212 #define A_XDATA   0100          /* external data space */
213 #define A_BIT     0200          /* bit addressable space */
214
215 /* Additional flags for hc08 */
216 #define A_NOLOAD  0400          /* nonloadable */
217 #define A_LOAD    0000          /* loadable (default) */
218
219 /*
220  * File types
221  */
222 #define F_INV   0               /* invalid */
223 #define F_STD   1               /* stdin */
224 #define F_LNK   2               /* File.lnk */
225 #define F_REL   3               /* File.rel */
226 #define F_CMD   4               /* Command line */
227
228 #ifdef GAMEBOY
229 /*
230  * Multiple banks support
231  */
232 extern int nb_rom_banks;
233 extern int nb_ram_banks;
234 extern int current_rom_bank;
235 extern int mbc_type;
236 extern char cart_name[];
237 /*
238  * ROM patching support
239  */
240 typedef struct _patch {
241   unsigned int addr;
242   unsigned char value;
243   struct _patch *next;
244 } patch;
245 extern patch* patches;
246 #endif /* GAMEBOY */
247
248 /*
249  *      General assembler address type
250  */
251 typedef unsigned int Addr_T;
252
253 /*
254  *      The structures of head, area, areax, and sym are created
255  *      as the REL files are read during the first pass of the
256  *      linker.  The struct head is created upon encountering a
257  *      H directive in the REL file.  The structure contains a
258  *      link to a link file structure (struct lfile) which describes
259  *      the file containing the H directive, the number of data/code
260  *      areas contained in this header segment, the number of
261  *      symbols referenced/defined in this header segment, a pointer
262  *      to an array of pointers to areax structures (struct areax)
263  *      created as each A directive is read, and a pointer to an
264  *      array of pointers to symbol structures (struct sym) for
265  *      all referenced/defined symbols.  As H directives are read
266  *      from the REL files a linked list of head structures is
267  *      created by placing a link to the new head structure
268  *      in the previous head structure.
269  */
270 struct  head
271 {
272         struct  head   *h_hp;   /* Header link */
273         struct  lfile  *h_lfile;/* Associated file */
274         int     h_narea;        /* # of areas */
275         struct  areax **a_list; /* Area list */
276         int     h_nglob;        /* # of global symbols */
277         struct  sym   **s_list; /* Globle symbol list */
278         char    m_id[NCPS];     /* Module name */
279 };
280
281 /*
282  *      A structure area is created for each 'unique' data/code
283  *      area definition found as the REL files are read.  The
284  *      struct area contains the name of the area, a flag byte
285  *      which contains the area attributes (REL/CON/OVR/ABS),
286  *      an area subtype (not used in this assembler), and the
287  *      area base address and total size which will be filled
288  *      in at the end of the first pass through the REL files.
289  *      As A directives are read from the REL files a linked
290  *      list of unique area structures is created by placing a
291  *      link to the new area structure in the previous area structure.
292  */
293 struct  area
294 {
295         struct  area    *a_ap;  /* Area link */
296         struct  areax   *a_axp; /* Area extension link */
297         Addr_T  a_addr;         /* Beginning address of area */
298         Addr_T  a_size;         /* Total size of the area */
299         Addr_T  a_unaloc;       /* Total number of unallocated bytes, for error reporting */
300         char    a_type;         /* Area subtype */
301         int     a_flag;         /* Flag byte */
302         char    a_id[NCPS];     /* Name */
303         char    *a_image;       /* Something for hc08/lkelf */
304         char    *a_used;        /* Something for hc08/lkelf */
305 };
306
307 /*
308  *      An areax structure is created for every A directive found
309  *      while reading the REL files.  The struct areax contains a
310  *      link to the 'unique' area structure referenced by the A
311  *      directive and to the head structure this area segment is
312  *      a part of.  The size of this area segment as read from the
313  *      A directive is placed in the areax structure.  The beginning
314  *      address of this segment will be filled in at the end of the
315  *      first pass through the REL files.  As A directives are read
316  *      from the REL files a linked list of areax structures is
317  *      created for each unique area.  The final areax linked
318  *      list has at its head the 'unique' area structure linked
319  *      to the linked areax structures (one areax structure for
320  *      each A directive for this area).
321  */
322 struct  areax
323 {
324         struct  areax   *a_axp; /* Area extension link */
325         struct  area    *a_bap; /* Base area link */
326         struct  head    *a_bhp; /* Base header link */
327         Addr_T  a_addr;         /* Beginning address of section */
328         Addr_T  a_size;         /* Size of the area in section */
329 };
330
331 /*
332  *      A sym structure is created for every unique symbol
333  *      referenced/defined while reading the REL files.  The
334  *      struct sym contains the symbol's name, a flag value
335  *      (not used in this linker), a symbol type denoting
336  *      referenced/defined, and an address which is loaded
337  *      with the relative address within the area in which
338  *      the symbol was defined.  The sym structure also
339  *      contains a link to the area where the symbol was defined.
340  *      The sym structures are linked into linked lists using
341  *      the symbol link element.
342  */
343 struct  sym
344 {
345         struct  sym     *s_sp;  /* Symbol link */
346         struct  areax   *s_axp; /* Symbol area link */
347         char    s_type;         /* Symbol subtype */
348         char    s_flag;         /* Flag byte */
349         Addr_T  s_addr;         /* Address */
350         char    *s_id;          /* Name: JLH change from [NCPS] */
351 };
352
353 /*
354  *      The structure lfile contains a pointer to a
355  *      file specification string, the file type, and
356  *      a link to the next lfile structure.
357  */
358 struct  lfile
359 {
360         struct  lfile   *f_flp; /* lfile link */
361         int     f_type;         /* File type */
362         char    *f_idp;         /* Pointer to file spec */
363 };
364
365 /*
366  *      The struct base contains a pointer to a
367  *      base definition string and a link to the next
368  *      base structure.
369  */
370 struct  base
371 {
372         struct  base  *b_base;  /* Base link */
373         char          *b_strp;  /* String pointer */
374 };
375
376 /*
377  *      The struct globl contains a pointer to a
378  *      global definition string and a link to the next
379  *      global structure.
380  */
381 struct  globl
382 {
383         struct  globl *g_globl; /* Global link */
384         char          *g_strp;  /* String pointer */
385 };
386
387 /*
388  *      A structure sdp is created for each 'unique' paged
389  *      area definition found as the REL files are read.
390  *      As P directives are read from the REL files a linked
391  *      list of unique sdp structures is created by placing a
392  *      link to the new sdp structure in the previous area structure.
393  */
394 struct  sdp
395 {
396         struct  area  *s_area;  /* Paged Area link */
397         struct  areax *s_areax; /* Paged Area Extension Link */
398         Addr_T  s_addr;         /* Page address offset */
399 };
400
401 /*
402  *      The structure rerr is loaded with the information
403  *      required to report an error during the linking
404  *      process.  The structure contains an index value
405  *      which selects the areax structure from the header
406  *      areax structure list, a mode value which selects
407  *      symbol or area relocation, the base address in the
408  *      area section, an area/symbol list index value, and
409  *      an area/symbol offset value.
410  */
411 struct  rerr
412 {
413         int     aindex;         /* Linking area */
414         int     mode;           /* Relocation mode */
415         Addr_T  rtbase;         /* Base address in section */
416         int     rindex;         /* Area/Symbol reloaction index */
417         Addr_T  rval;           /* Area/Symbol offset value */
418 };
419
420 /*
421  *      The structure lbpath is created for each library
422  *      path specification input by the -k option.  The
423  *      lbpath structures are linked into a list using
424  *      the next link element.
425  */
426 struct lbpath {
427         struct  lbpath  *next;
428         char            *path;
429 };
430
431 /*
432  *      The structure lbname is created for all combinations of the
433  *      library path specifications (input by the -k option) and the
434  *      library file specifications (input by the -l option) that
435  *      lead to an existing file.  The element path points to
436  *      the path string, element libfil points to the library
437  *      file string, and the element libspc is the concatenation
438  *      of the valid path and libfil strings.
439  *
440  *      The lbpath structures are linked into a list
441  *      using the next link element.
442  *
443  *      Each library file contains a list of object files
444  *      that are contained in the particular library. e.g.:
445  *
446  *              \iolib\termio
447  *              \inilib\termio
448  *
449  *      Only one specification per line is allowed.
450  */
451 struct lbname {
452         struct  lbname  *next;
453         char            *path;
454         char            *libfil;
455         char            *libspc;
456 };
457
458 /*
459  *      The function fndsym() searches through all combinations of the
460  *      library path specifications (input by the -k option) and the
461  *      library file specifications (input by the -l option) that
462  *      lead to an existing file for a symbol definition.
463  *
464  *      The structure lbfile is created for the first library
465  *      object file which contains the definition for the
466  *      specified undefined symbol.
467  *
468  *      The element libspc points to the library file path specification
469  *      and element relfil points to the object file specification string.
470  *      The element filspc is the complete path/file specification for
471  *      the library file to be imported into the linker.  The
472  *      file specicifation may be formed in one of two ways:
473  *
474  *      (1)     If the library file contained an absolute
475  *              path/file specification then this becomes filspc.
476  *              (i.e. C:\...)
477  *
478  *      (2)     If the library file contains a relative path/file
479  *              specification then the concatenation of the path
480  *              and this file specification becomes filspc.
481  *              (i.e. \...)
482  *
483  *      The lbpath structures are linked into a list
484  *      using the next link element.
485  */
486 struct lbfile {
487         struct  lbfile  *next;
488         char            *libspc;
489         char            *relfil;
490         char            *filspc;
491         long            offset; /*>=0 if rel file is embedded in a lib file at this offset*/
492 };
493
494 /*
495  *      External Definitions for all Global Variables
496  */
497
498 extern  char    *_abs_;         /*      = { ".  .ABS." };
499                                  */
500 extern  int     lkerr;          /*      ASLink error flag
501                                  */
502 extern  char    *ip;            /*      pointer into the REL file
503                                  *      text line in ib[]
504                                  */
505 extern  char    ib[NINPUT];     /*      REL file text line
506                                  */
507 extern  char    *rp;            /*      pointer into the LST file
508                                  *      text line in rb[]
509                                  */
510 extern  char    rb[NINPUT];     /*      LST file text line being
511                                  *      address relocated
512                                  */
513 extern  unsigned char   ctype[];        /*      array of character types, one per
514                                  *      ASCII character
515                                  */
516
517 extern char sdccopt[NINPUT];
518 extern char sdccopt_module[NINPUT];
519 extern char curr_module[NINPUT];
520
521 /*
522  *      Character Type Definitions
523  */
524 #define SPACE   0000
525 #define ETC     0000
526 #define LETTER  0001
527 #define DIGIT   0002
528 #define BINOP   0004
529 #define RAD2    0010
530 #define RAD8    0020
531 #define RAD10   0040
532 #define RAD16   0100
533 #define ILL     0200
534
535 #define DGT2    DIGIT|RAD16|RAD10|RAD8|RAD2
536 #define DGT8    DIGIT|RAD16|RAD10|RAD8
537 #define DGT10   DIGIT|RAD16|RAD10
538 #define LTR16   LETTER|RAD16
539
540 #if     CASE_SENSITIVE
541 #else
542 extern  char    ccase[];        /*      an array of characters which
543                                  *      perform the case translation function
544                                  */
545 #endif
546
547 extern  struct  lfile   *filep; /*      The pointers (lfile *) filep,
548                                  *      (lfile *) cfp, and (FILE *) sfp
549                                  *      are used in conjunction with
550                                  *      the routine lk_getline() to read
551                                  *      asmlnk commands from
552                                  *      (1) the standard input or
553                                  *      (2) or a command file
554                                  *      and to read the REL files
555                                  *      sequentially as defined by the
556                                  *      asmlnk input commands.
557                                  *
558                                  *      The pointer *filep points to the
559                                  *      beginning of a linked list of
560                                  *      lfile structures.
561                                  */
562 extern  struct  lfile   *cfp;   /*      The pointer *cfp points to the
563                                  *      current lfile structure
564                                  */
565 extern  struct  lfile   *startp;/*      asmlnk startup file structure
566                                  */
567 extern  struct  lfile   *linkp; /*      pointer to first lfile structure
568                                  *      containing an input REL file
569                                  *      specification
570                                  */
571 extern  struct  lfile   *lfp;   /*      pointer to current lfile structure
572                                  *      being processed by parse()
573                                  */
574 extern  struct  head    *headp; /*      The pointer to the first
575                                  *      head structure of a linked list
576                                  */
577 extern  struct  head    *hp;    /*      Pointer to the current
578                                  *      head structure
579                                  */
580 extern  struct  area    *areap; /*      The pointer to the first
581                                  *      area structure of a linked list
582                                  */
583 extern  struct  area    *ap;    /*      Pointer to the current
584                                  *      area structure
585                                  */
586 extern  struct  areax   *axp;   /*      Pointer to the current
587                                  *      areax structure
588                                  */
589 extern  struct  sym *symhash[NHASH]; /* array of pointers to NHASH
590                                       * linked symbol lists
591                                       */
592 extern  struct  base    *basep; /*      The pointer to the first
593                                  *      base structure
594                                  */
595 extern  struct  base    *bsp;   /*      Pointer to the current
596                                  *      base structure
597                                  */
598 extern  struct  globl   *globlp;/*      The pointer to the first
599                                  *      globl structure
600                                  */
601 extern  struct  globl   *gsp;   /*      Pointer to the current
602                                  *      globl structure
603                                  */
604 extern  struct  sdp     sdp;    /*      Base Paged structure
605                                  */
606 extern  struct  rerr    rerr;   /*      Structure containing the
607                                  *      linker error information
608                                  */
609 extern  FILE    *ofp;           /*      Linker Output file handle
610                                  */
611 extern  FILE    *mfp;           /*      Map output file handle
612                                  */
613 extern  FILE    *jfp;           /*      NoICE output file handle
614                                  */
615 extern  FILE    *rfp;           /*      File handle for output
616                                  *      address relocated ASxxxx
617                                  *      listing file
618                                  */
619 extern  FILE    *sfp;           /*      The file handle sfp points to the
620                                  *      currently open file
621                                  */
622 extern  FILE    *tfp;           /*      File handle for input
623                                  *      ASxxxx listing file
624                                  */
625 extern  FILE    *dfp;           /*      File handle for debug info output
626                                  */
627 extern  int     dflag;          /*      Output debug information flag
628                                  */
629 extern  int     oflag;          /*      Output file type flag
630                                  */
631 extern  int     mflag;          /*      Map output flag
632                                  */
633 extern  int     sflag;          /*      JCF: Memory usage output flag
634                                  */
635 extern  int     packflag;       /*      Pack data memory flag
636                                  */
637 extern  int     stacksize;      /*      Pack data memory flag
638                                  */
639 extern  int     jflag;          /*      NoICE output flag
640                                  */
641 extern  int     symflag;        /*      no$gmb .sym output flag
642                                  */
643 extern  int     xflag;          /*      Map file radix type flag
644                                  */
645 extern  int     pflag;          /*      print linker command file flag
646                                  */
647 extern  int     uflag;          /*      Listing relocation flag
648                                  */
649 extern int      rflag;          /*      Extended linear address record flag.
650                                 */
651 extern  int     radix;          /*      current number conversion radix:
652                                  *      2 (binary), 8 (octal), 10 (decimal),
653                                  *      16 (hexadecimal)
654                                  */
655 extern  int     line;           /*      current line number
656                                  */
657 extern  int     page;           /*      current page number
658                                  */
659 extern  int     lop;            /*      current line number on page
660                                  */
661 extern  int     pass;           /*      linker pass number
662                                  */
663 extern  int     rtcnt;          /*      count of elements in the
664                                  *      rtval[] and rtflg[] arrays
665                                  */
666 extern  Addr_T  rtval[];        /*      data associated with relocation
667                                  */
668 extern  int     rtflg[];        /*      indicates if rtval[] value is
669                                  *      to be sent to the output file.
670                                  *      (always set in this linker)
671                                  */
672 extern  int     hilo;           /*      REL file byte ordering
673                                  */
674 extern  int     gline;          /*      LST file relocation active
675                                  *      for current line
676                                  */
677 extern  int     gcntr;          /*      LST file relocation active
678                                  *      counter
679                                  */
680 extern  struct lbpath *lbphead; /*      pointer to the first
681                                  *      library path structure
682                                  */
683 extern  struct lbname *lbnhead; /*      pointer to the first
684                                  *      library name structure
685                                  */
686 extern  struct lbfile *lbfhead; /*      pointer to the first
687                                  *      library file structure
688                                  */
689 extern  Addr_T iram_size;       /*      internal ram size
690                                  */
691 extern  long xram_size;         /*      external ram size
692                                  */
693 extern  long code_size;         /*      code size
694                                  */
695
696
697 /* C Library function definitions */
698 /* for reference only
699 extern  VOID            exit();
700 extern  int             fclose();
701 extern  char *          fgets();
702 extern  FILE *          fopen();
703 extern  int             fprintf();
704 extern  VOID            free();
705 extern  VOID *          malloc();
706 extern  char            putc();
707 extern  char *          strcpy();
708 extern  int             strlen();
709 extern  char *          strncpy();
710 */
711
712 /* Program function definitions */
713
714 /* lkmain.c */
715 extern  FILE *          afile();
716 extern  VOID            bassav();
717 extern  VOID            gblsav();
718 extern  VOID            iramsav();
719 extern  VOID            xramsav();
720 extern  VOID            codesav();
721 extern  VOID            iramcheck();
722 extern  VOID            link_main();
723 extern  VOID            lkexit();
724 extern  int             main();
725 extern  VOID            map();
726 extern  VOID            sym();
727 extern  int             parse();
728 extern  VOID            setbas();
729 extern  VOID            setgbl();
730 extern  VOID            usage();
731 extern  VOID            copyfile();
732
733 /* lklex.c */
734 extern  char            endline();
735 extern  char            get();
736 extern  VOID            getfid();
737 extern  VOID            getid();
738 extern  VOID            getSid(char *id);
739 extern  int             lk_getline();
740 extern  int             getmap();
741 extern  char            getnb();
742 extern  int             more();
743 extern  VOID            skip();
744 extern  VOID            unget();
745 extern  VOID            chop_crlf();
746
747 /* lkarea.c */
748 extern  VOID            lkparea();
749 extern  VOID            lnkarea();
750 extern  VOID            lnkarea2();
751 extern  VOID            newarea();
752
753 /* lkhead.c */
754 extern  VOID            module();
755 extern  VOID            newhead();
756
757 /* lksym.c */
758 extern  int             hash();
759 extern  struct  sym *   lkpsym();
760 extern  VOID *          new();
761 extern  struct  sym *   newsym();
762 extern  VOID            symdef();
763 extern  int             symeq();
764 extern  VOID            syminit();
765 extern  VOID            symmod();
766 extern  Addr_T          symval();
767
768 /* lkeval.c */
769 extern  int             digit();
770 extern  Addr_T          eval();
771 extern  Addr_T          expr();
772 extern  int             oprio();
773 extern  Addr_T          term();
774
775 /* lklist.c */
776 extern  int             dgt();
777 extern  VOID            lkulist();
778 extern  VOID            lkalist();
779 extern  VOID            lkglist();
780 extern  VOID            lstarea();
781 extern  VOID            newpag();
782 extern  VOID            slew();
783
784 /* lkrloc.c */
785 extern  Addr_T          adb_b(register Addr_T v, register int i);
786 extern  Addr_T          adb_bit(register Addr_T v, register int i);
787 extern  Addr_T          adb_hi(Addr_T  v, int i);
788 extern  Addr_T          adb_lo(Addr_T  v, int i);
789 extern  Addr_T          adb_24_bit(register Addr_T v, register int i);
790 extern  Addr_T          adb_24_hi(Addr_T v, int i);
791 extern  Addr_T          adb_24_mid(Addr_T v, int i);
792 extern  Addr_T          adb_24_lo(Addr_T v, int i);
793 extern  Addr_T          adw_w(register Addr_T v, register int i);
794 extern  Addr_T          adw_24(Addr_T v, int i);
795 extern  Addr_T          adw_hi(Addr_T  v, int i);
796 extern  Addr_T          adw_lo(Addr_T  v, int i);
797 extern  Addr_T          evword(VOID);
798 extern  VOID            rele(VOID);
799 extern  VOID            reloc(char c);
800 extern  VOID            relt(VOID);
801 extern  VOID            relr(VOID);
802 extern  VOID            relp(VOID);
803 extern  VOID            relerr(char *str);
804 extern  char *          errmsg[];
805 extern  VOID            errdmp(FILE *fptr, char *str);
806 extern  VOID            relerp(char *str);
807 extern  VOID            erpdmp(FILE *fptr, char *str);
808 extern  VOID            prntval(FILE *fptr, Addr_T v);
809 extern  int             lastExtendedAddress;
810
811 /* lklibr.c */
812 extern  int             addfile();
813 extern  VOID            addlib();
814 extern  VOID            addpath();
815 extern  int             fndsym();
816 extern  VOID            library();
817 extern  VOID            loadfile();
818 extern  VOID            search();
819
820 /* lks19.c */
821 extern  VOID            s19();
822
823 /* lkihx.c */
824 extern  VOID            ihx();
825 extern  VOID            ihxExtendedLinearAddress(Addr_T);
826 extern  VOID            ihxNewArea();
827
828 /* lkstore.c */
829 extern  char *          StoreString( char *str );
830
831 /* lknoice.c */
832 extern  void            DefineNoICE( char *name, Addr_T value, int page );
833
834 /* EEP: lkelf.c */
835 extern  VOID            elf();
836
837 /* JCF: lkmem.c */
838 extern int summary(struct area * xp);
839 extern int summary2(struct area * xp);
840
841 /* JCF: lkaomf51.c */
842 extern void SaveLinkedFilePath(char * filepath);
843 extern void CreateAOMF51(void);
844
845 /* lkgb.h */
846 VOID gb(int in);
847 VOID gg(int in);
848
849 /* strcmpi.h */
850 extern int as_strcmpi(const char *s1, const char *s2);
851 extern int as_strncmpi(const char *s1, const char *s2, size_t n);