1 |
schorsch |
2.4 |
/* RCSid: $Id: trans.h,v 2.3 2003/06/07 01:10:23 schorsch Exp $ */ |
2 |
greg |
1.1 |
/* |
3 |
|
|
* Translator definitions |
4 |
|
|
* |
5 |
|
|
* Greg Ward |
6 |
|
|
*/ |
7 |
schorsch |
2.3 |
#ifndef _RAD_TRANS_H_ |
8 |
|
|
#define _RAD_TRANS_H_ |
9 |
|
|
#ifdef __cplusplus |
10 |
|
|
extern "C" { |
11 |
|
|
#endif |
12 |
|
|
|
13 |
greg |
1.1 |
|
14 |
|
|
#define MAXSTR 128 /* maximum input string length */ |
15 |
|
|
|
16 |
|
|
#define VOIDID "void" /* null modifier */ |
17 |
|
|
|
18 |
|
|
/* qualifier list */ |
19 |
|
|
typedef struct { |
20 |
|
|
int nquals; /* number of qualifiers */ |
21 |
|
|
char **qual; /* qualifier array */ |
22 |
|
|
} QLIST; |
23 |
|
|
/* identifier */ |
24 |
|
|
typedef struct { |
25 |
|
|
char *name; /* string, NULL if number */ |
26 |
|
|
int number; |
27 |
|
|
} ID; |
28 |
|
|
/* identifier list */ |
29 |
|
|
typedef struct { |
30 |
|
|
int nids; /* number of ids */ |
31 |
|
|
ID *id; /* id array */ |
32 |
|
|
} IDLIST; |
33 |
|
|
/* identifier range */ |
34 |
|
|
typedef struct { |
35 |
|
|
char *nam; /* string, NULL if range */ |
36 |
|
|
int min, max; /* accepted range */ |
37 |
|
|
} IDMATCH; |
38 |
|
|
/* mapping rule */ |
39 |
|
|
typedef struct rule { |
40 |
|
|
char *mnam; /* material name */ |
41 |
|
|
long qflg; /* qualifier condition flags */ |
42 |
|
|
struct rule *next; /* next rule in mapping */ |
43 |
|
|
/* followed by the IDMATCH array */ |
44 |
|
|
} RULEHD; |
45 |
|
|
/* useful macros */ |
46 |
|
|
#define doneid(idp) if ((idp)->name != NULL) freestr((idp)->name) |
47 |
|
|
#define FL(qn) (1L<<(qn)) |
48 |
|
|
#define rulsiz(nq) (sizeof(RULEHD)+(nq)*sizeof(IDMATCH)) |
49 |
|
|
#define idm(rp) ((IDMATCH *)((rp)+1)) |
50 |
|
|
|
51 |
schorsch |
2.3 |
|
52 |
|
|
/* defined in common/savestr.c - XXX one of several declarations */ |
53 |
|
|
char *savestr(char *str); |
54 |
|
|
/* defined in trans.c */ |
55 |
|
|
RULEHD *getmapping(char *file, QLIST *qlp); |
56 |
schorsch |
2.4 |
|
57 |
|
|
extern int fgetid(ID *idp, char *dls, FILE *fp); |
58 |
|
|
extern int findid(IDLIST *idl, ID *idp, int insert); |
59 |
|
|
extern int matchid(ID *it, IDMATCH *im); |
60 |
|
|
extern void write_quals(QLIST *qlp, IDLIST idl[], FILE *fp); |
61 |
schorsch |
2.3 |
|
62 |
|
|
|
63 |
|
|
#ifdef __cplusplus |
64 |
|
|
} |
65 |
|
|
#endif |
66 |
|
|
#endif /* _RAD_TRANS_H_ */ |
67 |
|
|
|