1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)defs.h 5.4 (Berkeley) 02/05/91 7 */ 8 9 /* 10 * Global debugger defines. 11 * 12 * All files include this header. 13 */ 14 15 #include <stdio.h> 16 #include <stdlib.h> 17 #include <string.h> 18 19 /* 20 * Since C does not allow forward referencing of types, 21 * all the global types are declared here. 22 */ 23 24 #define LOCAL static 25 #define NIL 0 26 27 typedef int BOOLEAN; 28 29 #define FALSE 0 30 #define TRUE 1 31 32 typedef unsigned int ADDRESS; /* object code addresses */ 33 typedef short LINENO; /* source file line numbers */ 34 typedef struct sym SYM; /* symbol information structure */ 35 typedef struct symtab SYMTAB; /* symbol table */ 36 typedef struct node NODE; /* expression tree node */ 37 typedef short OP; /* tree operator */ 38 typedef struct opinfo OPINFO; /* tree operator information table */ 39 typedef unsigned int WORD; /* machine word */ 40 typedef unsigned char BYTE; /* machine byte */ 41 typedef struct frame FRAME; /* runtime activation record */ 42 43 /* 44 * Definitions of standard C library routines that aren't in the 45 * standard I/O library, but which are generally useful. 46 */ 47 48 extern char *mktemp(); /* make a temporary file name */ 49 50 /* 51 * Definitions of library routines. 52 */ 53 54 char *cmdname; /* name of command for error messages */ 55 char *errfilename; /* current file associated with error */ 56 short errlineno; /* line number associated with error */ 57 58 int error(); /* print an error message */ 59 int panic(); /* print error message and exit */ 60 short numerrors(); /* return number of errors since last call */ 61 62 /* 63 * defintions for doing memory allocation 64 */ 65 66 #define alloc(n, type) ((type *) malloc((unsigned) (n) * sizeof(type))) 67 #define dispose(p) { free((char *) p); p = NIL; } 68 69 /* 70 * macro for doing freads 71 */ 72 73 #define get(fp, var) fread((char *) &(var), sizeof(var), 1, fp) 74 75 /* 76 * string definitions 77 */ 78 79 #define streq(s1, s2) (strcmp(s1, s2) == 0) 80