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