1 |
greg |
2.2 |
/* RCSid: $Id$ */ |
2 |
greg |
1.1 |
/* |
3 |
|
|
* Translator definitions |
4 |
|
|
* |
5 |
|
|
* Greg Ward |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#define MAXSTR 128 /* maximum input string length */ |
9 |
|
|
|
10 |
|
|
#define VOIDID "void" /* null modifier */ |
11 |
|
|
|
12 |
|
|
/* qualifier list */ |
13 |
|
|
typedef struct { |
14 |
|
|
int nquals; /* number of qualifiers */ |
15 |
|
|
char **qual; /* qualifier array */ |
16 |
|
|
} QLIST; |
17 |
|
|
/* identifier */ |
18 |
|
|
typedef struct { |
19 |
|
|
char *name; /* string, NULL if number */ |
20 |
|
|
int number; |
21 |
|
|
} ID; |
22 |
|
|
/* identifier list */ |
23 |
|
|
typedef struct { |
24 |
|
|
int nids; /* number of ids */ |
25 |
|
|
ID *id; /* id array */ |
26 |
|
|
} IDLIST; |
27 |
|
|
/* identifier range */ |
28 |
|
|
typedef struct { |
29 |
|
|
char *nam; /* string, NULL if range */ |
30 |
|
|
int min, max; /* accepted range */ |
31 |
|
|
} IDMATCH; |
32 |
|
|
/* mapping rule */ |
33 |
|
|
typedef struct rule { |
34 |
|
|
char *mnam; /* material name */ |
35 |
|
|
long qflg; /* qualifier condition flags */ |
36 |
|
|
struct rule *next; /* next rule in mapping */ |
37 |
|
|
/* followed by the IDMATCH array */ |
38 |
|
|
} RULEHD; |
39 |
|
|
/* useful macros */ |
40 |
|
|
#define doneid(idp) if ((idp)->name != NULL) freestr((idp)->name) |
41 |
|
|
#define FL(qn) (1L<<(qn)) |
42 |
|
|
#define rulsiz(nq) (sizeof(RULEHD)+(nq)*sizeof(IDMATCH)) |
43 |
|
|
#define idm(rp) ((IDMATCH *)((rp)+1)) |
44 |
|
|
|
45 |
|
|
char *savestr(); |
46 |
|
|
RULEHD *getmapping(); |