numparam, entry_type, #2/5, use a type-checked enum for 'nupa_type'
This commit is contained in:
parent
6a1c9f934c
commit
09d92ba692
|
|
@ -19,15 +19,25 @@ typedef enum {Psp = '{'} _nPsp; /* Ps expression */
|
|||
* I believe the entry_t should be a union of type but I need more info.
|
||||
* ----------------------------------------------------------------- */
|
||||
|
||||
#define NUPA_REAL 'R'
|
||||
#define NUPA_STRING 'S'
|
||||
#define NUPA_POINTER 'P'
|
||||
#define NUPA_SUBCKT 'U'
|
||||
#define NUPA_SPACE ' '
|
||||
#define NUPA_UNKNOWN '?'
|
||||
#define NUPA_MODEL 'O'
|
||||
struct nupa_type;
|
||||
|
||||
typedef char nupa_type;
|
||||
extern const struct nupa_type S_nupa_real;
|
||||
extern const struct nupa_type S_nupa_string;
|
||||
extern const struct nupa_type S_nupa_pointer;
|
||||
extern const struct nupa_type S_nupa_subckt;
|
||||
extern const struct nupa_type S_nupa_space;
|
||||
extern const struct nupa_type S_nupa_unknown;
|
||||
extern const struct nupa_type S_nupa_model;
|
||||
|
||||
#define NUPA_REAL (&S_nupa_real)
|
||||
#define NUPA_STRING (&S_nupa_string)
|
||||
#define NUPA_POINTER (&S_nupa_pointer)
|
||||
#define NUPA_SUBCKT (&S_nupa_subckt)
|
||||
#define NUPA_SPACE (&S_nupa_space)
|
||||
#define NUPA_UNKNOWN (&S_nupa_unknown)
|
||||
#define NUPA_MODEL (&S_nupa_model)
|
||||
|
||||
typedef const struct nupa_type *nupa_type;
|
||||
|
||||
|
||||
typedef struct entry_s {
|
||||
|
|
|
|||
|
|
@ -1779,3 +1779,16 @@ nupa_subcktexit(dico_t *dico)
|
|||
{
|
||||
dicostack_pop(dico);
|
||||
}
|
||||
|
||||
|
||||
struct nupa_type { /* used as a type-checked enum */
|
||||
const char *name;
|
||||
};
|
||||
|
||||
const struct nupa_type S_nupa_real = { "NUPA_REAL" };
|
||||
const struct nupa_type S_nupa_string = { "NUPA_STRING" };
|
||||
const struct nupa_type S_nupa_pointer = { "NUPA_POINTER" };
|
||||
const struct nupa_type S_nupa_subckt = { "NUPA_SUBCKT" };
|
||||
const struct nupa_type S_nupa_unknown = { "NUPA_UNKNOWN" };
|
||||
const struct nupa_type S_nupa_model = { "NUPA_MODEL" };
|
||||
const struct nupa_type S_nupa_space = { "NUPA_SPACE" };
|
||||
|
|
|
|||
Loading…
Reference in New Issue