/* mc.h : stuff for Mutt compiler */ /* Craig Durland Public Domain * Distributed "as is", without warranties of any kind, but comments, * suggestions and bug reports are welcome. */ #define MAXSTRLEN 255 /* max length of a string (MUST be < RSIZ!) */ #define MAXDIM 2 /* max dimensions for an array */ typedef struct { char *name; short int token; } MuttCmd; typedef struct { char *name; /* of member */ int offset; /* from blob base */ unsigned int type; int dims, dim[MAXDIM]; /* if its an array */ } VBlob; typedef struct { char *name; short int token; unsigned short int class; } oMuttCmd; #define NIL 0 /* var types */ #define LOCAL 1 #define GLOBAL 2 /* pgm modifiers */ #define HIDDEN 0x01 #define MAIN 0x02 #define LEAR 0x04 /* additional token classes returned by get_token() * these MUST NOT overlap val types (in mm.h) */ /* OR'able values */ #define POINTER 0x0100 /* Can't OR the following. Use low byte for value. */ #define MCTYPE 0x4000 #define TOKEN 0x4001 #define DELIMITER 0x4002 #define SEOF 0x4003 #define VAROK 0x4004 #define PUSHEDARGS 0x4005 #define UNKNOWN 0x4006 #define ARRAY 0x4007 #define EMPTY 0x4008 #if 0 /* Some interesting macros I don't use anymore */ /* ******************************************************************** */ /* ********************* TABLES *************************************** */ /* ******************************************************************** */ extern char *malloc(), *realloc(); #define DYNO(type,table,n,initial_size,step) \ { \ static int table_max = 0; \ if (n==table_max) /* table not big enough */ \ { \ if (table_max==0) /* table not allocated yet */ \ { \ table_max = initial_size; \ if ((table = (type *)malloc(table_max*sizeof(type)))==NULL) \ bitch("Can't malloc table"); \ } \ else /* table full, make bigger */ \ { \ table_max += step; \ if ((table = (type *)realloc( \ (char *)table,table_max*sizeof(type)))==NULL) \ bitch("Can't realloc table"); \ } \ } \ } #define DYNAMO(type,table,n,bump,initial_size,step) \ { \ static int table_max = 0; \ if (n+bump>=table_max) /* table not big enough */ \ { \ if (table_max==0) /* table not allocated yet */ \ { \ table_max = initial_size; \ if ((table = (type *)malloc(table_max*sizeof(type)))==NULL) \ bitch("Can't malloc table"); \ } \ else /* table full, make bigger */ \ { \ table_max += imax(n+bump-table_max,step); \ if ((table = (type *)realloc( \ (char *)table,table_max*sizeof(type)))==NULL) \ bitch("Can't realloc table"); \ } \ } \ } #endif