1 |
/* RCSid: $Id: trans.h,v 2.2 2003/02/22 02:07:23 greg Exp $ */ |
2 |
/* |
3 |
* Translator definitions |
4 |
* |
5 |
* Greg Ward |
6 |
*/ |
7 |
#ifndef _RAD_TRANS_H_ |
8 |
#define _RAD_TRANS_H_ |
9 |
#ifdef __cplusplus |
10 |
extern "C" { |
11 |
#endif |
12 |
|
13 |
|
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 |
|
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 |
|
57 |
|
58 |
#ifdef __cplusplus |
59 |
} |
60 |
#endif |
61 |
#endif /* _RAD_TRANS_H_ */ |
62 |
|