gawk.h (973B)
1 #ifndef _gawk_h 2 #define _gawk_h 3 4 #define LEN(X) (sizeof(X) / sizeof(*X)) 5 #define MAX(A,B) (A > B ? A : B) 6 7 /* arbitrary limits */ 8 #define MY_ARGV_MAX 8 9 #define MY_CHUNK_MAX 512 /* for slurping data, not recursive */ 10 #define MY_INPUT_MAX 64 11 #define MY_LINE_MAX 256 /* only used for gopher items currently */ 12 #define MY_PATH_MAX 128 13 #define MY_PIPE_MAX 4 14 #define MY_PROMPT_MAX 64 15 #define MY_URL_MAX 64 16 17 /* array ordering */ 18 /* NOTE: before changing address order see itemtoaddr and sgoto */ 19 enum address { AR_PATH, AR_HOST, AR_PORT, AR_NULL }; 20 enum gphitem { GI_INFO, GI_PATH, GI_HOST, GI_PORT, GI_PLUS, GI_NULL }; 21 22 /* command and pipeline status */ 23 enum cstatus { ERROR = -1, OK, UNWIND }; 24 enum pstatus { FAIL = -2, NEXT, PASS }; 25 26 typedef int (command)(int, char **, int, char **); 27 28 struct command { 29 char *argv[MY_ARGV_MAX]; 30 command *f; 31 int argc; 32 int negate; 33 }; 34 35 struct bind { 36 int c; 37 command *f; 38 }; 39 40 int gawk(char **); 41 42 extern int const timeout; 43 44 #endif /* _gawk_h */