/* dbm.h */
/*
* Header for the TeenyMUD database manager. Of course.
*/
/* Atom types */
#define AND -1
#define OR -2
#define NOT -3
#define STOP -4
/*
* These aren't strictly atom types. We use them as token types to indicate
* open parens and close parens respectively, in the parse phase Also, bad
* tokens. The expression parser should die when it gets a BADTOK back.
*/
#define OPEN -5
#define CLOSE -6
#define BADTOK -7
/* More atom types */
#define DBM_NAME 0
#define DBM_FLAG 1
#define DBM_TIME 2
#define DBM_OWNER 3
#define DBM_NUMBER 4
#define DBM_TYPE 5
/*
* These are atoms. We fill an array up with a list of these to form an RPN
* expression which we evaluate for every item in the DB.
*/
struct atom {
int type;
union {
char *name;
int flag;
int time;
int owner;
int number;
} data;
};
typedef struct atom atom;
/* The biggest an expression can be. (Number of atoms) */
#define MAXEXPR 256
/*
* Flags for DB lookup. A bit vector tells us what elements from each object
* to retrieve from the DB for the given expression.
*/
#define REQ_FLAG 0x0001
#define REQ_TIME 0x0002
#define REQ_OWNER 0x0004
#define REQ_NUMBER 0x0008
#define REQ_NAME 0x0010
char *malloc();