* asranlib/asranlib.c, link/lkar.h, link/lkar.c:
[fw/sdcc] / as / link / lklibr.h
1 /* lklibr.h
2
3    Copyright (C) 1989-1995 Alan R. Baldwin
4    721 Berkeley St., Kent, Ohio 44240
5    Copyright (C) 2008 Borut Razem, borut dot razem at siol dot net
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3, or (at your option) any
10 later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
19
20 /*
21  * With contributions for the
22  * object libraries from
23  * Ken Hornstein
24  * kenh@cmf.nrl.navy.mil
25  *
26  */
27
28 /*
29  * Extensions: P. Felber
30  */
31
32 #ifndef __LKLIBR_H
33 #define __LKLIBR_H
34
35 #include <stdio.h>
36
37 #ifdef INDEXLIB
38 typedef struct slibrarysymbol mlibrarysymbol;
39 typedef struct slibrarysymbol *pmlibrarysymbol;
40
41 struct slibrarysymbol
42 {
43   char *name;                   /* Warning: allocate memory before using */
44   pmlibrarysymbol next;
45 };
46
47 typedef struct slibraryfile mlibraryfile;
48 typedef struct slibraryfile *pmlibraryfile;
49
50 struct slibraryfile
51 {
52   int loaded;
53   char *libspc;
54   char *relfil;                 /* Warning: allocate memory before using */
55   char *filspc;                 /* Warning: allocate memory before using */
56   long offset;                  /* The embedded file offset in the library file libspc */
57   unsigned int type;
58   pmlibrarysymbol symbols;
59   pmlibraryfile next;
60 };
61
62 extern pmlibraryfile libr;
63
64 pmlibrarysymbol add_rel_index (FILE * fp, long size, pmlibraryfile This);
65 #else
66 int is_module_loaded (const char *filspc);
67 int add_rel_file (const char *name, struct lbname *lbnh, const char *relfil,
68                   const char *filspc, int offset, FILE * fp, long size, int type);
69 #endif
70
71 struct aslib_target
72 {
73   int (*is_lib) (FILE * libfp);
74 #ifdef INDEXLIB
75     pmlibraryfile (*buildlibraryindex) (struct lbname * lbnh, FILE * libfp, pmlibraryfile This, int type);
76 #else
77   int (*fndsym) (const char *name, struct lbname * lbnh, FILE * libfp, int type);
78 #endif
79   void (*loadfile) (struct lbfile * lbfh);
80 };
81
82 extern struct aslib_target aslib_target_sdcclib;
83 extern struct aslib_target aslib_target_ar;
84 extern struct aslib_target aslib_target_lib;
85
86 ////
87 //#define DEBUG_PRINT
88
89 #ifdef DEBUG_PRINT
90 # define D  printf
91 #else
92 # define D  1 ? (void)0 : (*(void (*)(const char *, ...))0)
93 #endif
94
95 #endif /* __LKLIBR_H */