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