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