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