home *** CD-ROM | disk | FTP | other *** search
- /*
- C* -- Main header file.
-
- Source: cstar.h
- Started: September 20, 1985
- Version:
- January 28, 1987
- February 19, 1989
- include sherlock.h instead of bug.h
- always include enum.h, never cpptok.h
- March 7, 1989
- Eliminate CPMEOF, YES, NO.
-
- PUBLIC DOMAIN SOFTWARE
-
- The CSTAR program was placed in the public domain on June 15, 1991,
- by its author and sole owner,
-
- Edward K. Ream
- 1617 Monroe Street
- Madison, WI 53711
- (608) 257-0802
-
- CSTAR may be used for any commercial or non-commercial purpose.
-
- DISCLAIMER OF WARRANTIES
-
- Edward K. Ream (Ream) specifically disclaims all warranties,
- expressed or implied, with respect to this computer software,
- including but not limited to implied warranties of merchantability
- and fitness for a particular purpose. In no event shall Ream be
- liable for any loss of profit or any commercial damage, including
- but not limited to special, incidental consequential or other damages.
- */
-
- /*
- System interface characteristics compiler is to be compiled for.
- These should be defined on the compiler command line.
-
- MICRO_SOFT use MicroSoft C V5.1
- TURBOC use Turbo C V1.5
-
- DO_STATS Gather statistics at run time.
- DEBUG Make run-time checks.
- STD_DIR Name of first standard directory.
- */
- #define DEBUG 1
-
- /*
- Memory management characteristics; use multiples of long size!
-
- DATA_SIZE Size in bytes of data portion of allocation blocks
-
- IDATA_SIZE Size in bytes of data portion of largest initializer
- block. Setting too small proliferates blocks;
- setting too large may cause incomplete
- initializers to chew up memory.
- */
- #define DATA_SIZE 2048
- #define IDATA_SIZE 10
-
- /*
- Properties of compiler under which this is to be compiled:
-
- INT_DIGITS number of digits in an int, plus 5
- LONG_DIGITS
- CHAR_SIZE bytes in a char, as supported by compiler
- SHORT_SIZE
- INT_SIZE
- LONG_SIZE
- POINTER_SIZE
- */
- #define INT_DIGITS 10
- #define LONG_DIGITS 15
- #define CHAR_SIZE 1
- #define SHORT_SIZE 2
- #define INT_SIZE 2
- #define INT_MAX 32767
- #define UINT_MAX 65535
- #define LONG_SIZE 4
- #define POINTER_SIZE 4
-
- /*
-
- ASCRATCH highest scratch register that is saved when a
- DSCRATCH function is called; set to -1 if no registers
- are saved and functions are totally responsible
- for preserving registers
-
- A_ALLOC lowest register that may be allocated as a local
- D_ALLOC register variable. this ought not to overlap
- with the SCRATCH designation.
-
- D0_ONLY define this to use d0 only as the function
- return interface; otherwise a0 is for non-integers
-
- EXCESSLENOK 0 or 1
-
- 0: register variables treated strictly as to length
- This will sometimes cause extra moves to be done
- to avoid clobbering upper portions, as in
- multiplication, and will prevent the use of, for
- example, moveq.l, which is faster and more
- compact, when move.w # is what is literally meant.
-
- 1: upper portions of register variables may be
- clobbered as a result of C-language operations.
- (pseudo functions always do whatever they do.)
- For example, a5w *= 30 may be done in a5
- even though this clobbers the upper half of a5.
- This is certainly the recommended setting,
- since under circumstances where it is obligatory
- to preserve the upper half, the pseudo operations
- usually are better documentation of what is
- going on, and in general it produces better code.
-
- SC_STICKY: 0 or 1
-
- 0: const and volatile do not stick to structure/
- union tags, although they do stick to typedefs and
- individual structure/union elements
-
- 1: const and volatile do stick to structure/union
- tags as well as typedefs and elements
- */
-
- #define ASCRATCH 1
- #define DSCRATCH 2
- #define A_ALLOC 2
- #define D_ALLOC 3
- #define D0_ONLY 1
- #define SC_STICKY 0
- #define EXCESSLENOK 1
-
-
- /*
- Maximum number of search paths. Should not be here??
- */
- #define MAX_PATHS 20
-
- /*
- Miscellaneous global constants.
- */
- #define ZERO 0
- #define TRUE (1)
- #define FALSE (0)
- #define END_FILE 0x1a
- #define ERROR -1
-
- #define CAST(type) (type)
-
- #define FALL_THROUGH 0L
- #define LOCAL_LAB 1
- #define GLOBAL_LAB 2
-
- /* definitions for OBJECTS IN THE COMPILER (as opposed to in the target code) */
- typedef int bool;
- typedef char byte; /* object such that sizeof(object) is 1 */
- typedef short int word; /* object such that sizeof(object) is 2 */
- /* long is widely assumed to have size 4; anything
- shorter won't function for many reasons */
- typedef long folded; /* see lint.doc */
-
- #ifdef MICRO_SOFT
- #define FAR far
- #else
- #define FAR
- #endif
-
- #include "sl.h"
- #include "enum.h"
- #include "node.h"
- #include "glb.h"
- #include "tmp.h"
- #include "stdio.h"
- #include "stdlib.h"
-
- /*
- ---------- PREPROCESSOR ----------
- */
- #define isdigit(c) (c <= '9' && c >= '0')
- #define isalpha(c) (c >= 'A' && (c <= 'Z' || (c >= 'a' && c <= 'z')))
- #define ishex(c) (isdigit(c) || (c >= 'A' && (c <= 'F' || (c>='a' && c<='f')))
- #define isid1(c) (isalpha(c) || c == '_')
- #define isid2(c) (isalpha(c) || isdigit(c) || c == '_')
-