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