xref: /csrg-svn/usr.bin/pascal/pdx/defs.h (revision 46290)
122569Sdist /*
222569Sdist  * Copyright (c) 1980 Regents of the University of California.
322569Sdist  * All rights reserved.  The Berkeley software License Agreement
422569Sdist  * specifies the terms and conditions for redistribution.
522569Sdist  *
6*46290Storek  *	@(#)defs.h	5.4 (Berkeley) 02/05/91
722569Sdist  */
85450Slinton 
95450Slinton /*
105450Slinton  * Global debugger defines.
115450Slinton  *
125450Slinton  * All files include this header.
135450Slinton  */
145450Slinton 
155450Slinton #include <stdio.h>
16*46290Storek #include <stdlib.h>
17*46290Storek #include <string.h>
185450Slinton 
195450Slinton /*
205450Slinton  * Since C does not allow forward referencing of types,
215450Slinton  * all the global types are declared here.
225450Slinton  */
235450Slinton 
245450Slinton #define LOCAL static
255450Slinton #define NIL 0
265450Slinton 
275450Slinton typedef int BOOLEAN;
285450Slinton 
295450Slinton #define FALSE 0
305450Slinton #define TRUE 1
315450Slinton 
325450Slinton typedef unsigned int ADDRESS;		/* object code addresses */
335450Slinton typedef short LINENO;			/* source file line numbers */
345450Slinton typedef struct sym SYM;			/* symbol information structure */
355450Slinton typedef struct symtab SYMTAB;		/* symbol table */
365450Slinton typedef struct node NODE;		/* expression tree node */
375450Slinton typedef short OP;			/* tree operator */
385450Slinton typedef struct opinfo OPINFO;		/* tree operator information table */
395450Slinton typedef unsigned int WORD;		/* machine word */
405450Slinton typedef unsigned char BYTE;		/* machine byte */
415450Slinton typedef struct frame FRAME;		/* runtime activation record */
425450Slinton 
435450Slinton /*
445450Slinton  * Definitions of standard C library routines that aren't in the
455450Slinton  * standard I/O library, but which are generally useful.
465450Slinton  */
475450Slinton 
485450Slinton extern char *mktemp();		/* make a temporary file name */
495450Slinton 
505450Slinton /*
515450Slinton  * Definitions of library routines.
525450Slinton  */
535450Slinton 
545450Slinton char *cmdname;			/* name of command for error messages */
555450Slinton char *errfilename;		/* current file associated with error */
565450Slinton short errlineno;		/* line number associated with error */
575450Slinton 
5833243Sbostic int error();			/* print an error message */
5933243Sbostic int panic();			/* print error message and exit */
605450Slinton short numerrors();		/* return number of errors since last call */
615450Slinton 
625450Slinton /*
635450Slinton  * defintions for doing memory allocation
645450Slinton  */
655450Slinton 
665450Slinton #define alloc(n, type)	((type *) malloc((unsigned) (n) * sizeof(type)))
675450Slinton #define dispose(p)	{ free((char *) p); p = NIL; }
685450Slinton 
695450Slinton /*
7030842Smckusick  * macro for doing freads
715450Slinton  */
725450Slinton 
735450Slinton #define get(fp, var)	fread((char *) &(var), sizeof(var), 1, fp)
745450Slinton 
755450Slinton /*
765450Slinton  * string definitions
775450Slinton  */
785450Slinton 
795450Slinton #define streq(s1, s2)	(strcmp(s1, s2) == 0)
80