NASM 0.98.08
[nasm.git] / rdoff / ldsegs.h
blob8b516faab15526a708c6c2a3dcbf80e5af9211aa
1 /*
2 * ldsegs.h Data for 'ldrdf' to determine what to do with different
3 * types of segment. This may be useful in other contexts also.
4 */
6 #ifndef UI16
7 #define UI16 unsigned short
8 #endif
10 struct segconfig {
11 UI16 typelow, typehi;/* range of seg nos for which this is valid */
12 char * typedesc; /* a description of the segment type */
13 UI16 dowhat; /* one of the SEG_xxxx values below */
14 UI16 mergetype; /* if SEG_MERGE what type segment do we merge with?
15 0 -> same type of segment. This type is also
16 used with SEG_NEWSEG. */
19 #define SEG_IGNORE 0
20 #define SEG_NEWSEG 1
21 #define SEG_MERGE 2
23 #define SEGCONFIGMAX 11
25 struct segconfig sconft[SEGCONFIGMAX] = {
26 {0x0000, 0x0000, "NULL segment", 0, 0},
27 {0x0001, 0x0001, "text", 2, 0},
28 {0x0002, 0x0002, "data", 2, 0},
29 {0x0003, 0x0003, "comment(ignored)", 0, 0},
30 {0x0004, 0x0005, "comment(kept)", 2, 0},
31 {0x0006, 0x0007, "debug information", 2, 0},
32 {0x0008, 0x001F, "reserved(general extensions)", 1, 0},
33 {0x0020, 0x0FFF, "reserved(MOSCOW)", 1, 0},
34 {0x1000, 0x7FFF, "reserved(system dependant)", 1, 0},
35 {0x8000, 0xFFFE, "reserved(other)", 1, 0},
36 {0xFFFF, 0xFFFF, "invalid segment", 0, 0}};
38 #define getsegconfig(target,number) \
39 { \
40 int _i; \
41 int _t = number; \
42 for (_i = 0; _i < SEGCONFIGMAX; _i++) \
43 if (_t >= sconft[_i].typelow && _t <= sconft[_i].typehi) \
44 { \
45 target = sconft[_i]; \
46 if (target.mergetype == 0) target.mergetype = _t; \
47 break; \
48 } \
49 if (_i == SEGCONFIGMAX) \
50 { \
51 fprintf(stderr, "PANIC: can't find segment %04X in segconfig\n",\
52 _t); \
53 exit(1); \
54 } \