/* defines.h */
#ifndef DEFINES_H
#define DEFINES_H

#include 

/* Note: gcc typesizes in bytes..
** char		1
** short int	2
** int		4
** ptr		4
** long		4
** double	8
*/

/******************************************************
*
*		small-c compiler
*
*		  by Ron Cain
*
******************************************************/

#define BANNER  "* * *  Small-C  V1.1  * * *"

#define VERSION "Based on Version N: July 17, 1980"

#define AUTHOR "       By Ron Cain"

/*	Define system dependent parameters	*/
/** #define CR 13 ** for pcDos text NL, see deblank **/

/*	UNIX definitions (if not stand-alone)	*/

#define EOL 10
#define CR 10

/*-----------------------------------------------------------------------75
** pertains to stack ops re parameter size, define as constant instead of
** decimal number of bytes in size.
*/
#define INT_SZ 4 /** Sat 13 Aug 2011 04:02:40 PM CDT **/

/**--------------------------------------------**/
#define	FALSE	0
#define	TRUE	1
#define	NO	0
#define	YES	1

/**--------------------------------------------**/
/*    Define the symbol table parameters        */

#define SYMB_SIZE	20  /** +2, struc len increased **/
#define SYMTBSZ		7200	/** orig. 5040 **/
			/** added 30Jun2010 s_d v.2r8 **/

#define NUMBSTATICS	300	/** 300 * 20 = 6000 **/

/** #def numautos 60 * 20 = 1200 + 6000 = 7200 **/

#define startstatic	symtab
#define endstatics	startstatic+NUMBSTATICS*SYMB_SIZE
#define startauto	endstatics+SYMB_SIZE
#define endautos	symtab+SYMTBSZ-SYMB_SIZE

/* Define symbol table entry format, size is SYMB_SIZE */

#define NAME	0    /** length 13 {0..12}      **/
                       /** namemax + null = 13    **/
#define IDENT	13   /** len 1 (indirection ndx)**/
#define TYPE	14   /** length 1               **/
#define STORAGE	15   /** length 1               **/
#define OFFSET	16   /** length 4 {16..19}      **/
	/** SYMB_SIZE must match tbl len **/

/*	System wide name size (for symbols)	*/
#define NAMESIZE 13   /** array size with null **/
#define NAMEMAX  12   /** truncate if needed   **/
/**--------------------------------------------**/

/*	Define possible entries for "ident"	*/
#define	VARIABLE 1
#define	ARRAY    2
#define	POINTER  3
#define	FUNCTION 4

/*** TYPES ***/
/*	Define possible entries for "type"	*/
#define	CCHAR	1	/** 1 byte **/
#define	CINT	2	/** 4 bytes **/

/** added 30Jun2010 s_d v.2r8 **/
#define	CLONG	4	/** 4 bytes **/

/** added Tue 26 Jul 2011 04:14:30 PM CDT **/
#define CSHORT	3	/** 2 bytes **/
#define CDOUBLE 5	/** 8 bytes **/
/*** eo TYPES ***/

/*	Define possible entries for "storage"	*/
#define	C_STATIC	1
#define	C_AUTO	2

/*	Define the "while" statement stack	*/
#define	WSTBLSZ	100
#define	WS_SZ		5
#define	WS_MAX	ws+WSTBLSZ-WS_SZ

/*	Define entry offsets in while stack	*/
/** indexes of int elements **/
#define	WS_SYMS 0
#define	WS_SP   1
#define	WS_LOOP 2
#define	WS_LBL  3
#define	WS_LBL2 4

/** ucc **/
/* entry offsets in "do"/"for"/"while"/"switch" stack */

#define	WSSYM	0
#define	WSSP	1
#define	WSTYP	2
#define	WSCASEP	3
#define	WSTEST	3
#define	WSINCR	4
#define	WSDEF	4
#define	WSBODY	5
#define	WSTAB	5
#define	WSEXIT	6

/* possible entries for "wstyp" */

#define	WSWHILE		0
#define	WSFOR		1
#define	WSDO		2
#define	WSSWITCH	3

/* "switch" label stack */

#define	SWSTSZ	100

/*	Define the literal pool			*/
#define	LITABSZ	1000
#define	LITMAX	LITABSZ-1

/*	Define the input line			*/
#define	LINESIZE	80
#define	LINEMAX	LINESIZE-1
#define	MP_MAX	LINEMAX

/*	Define the macro (define) pool		*/
#define	MACQ_SZ 2176  /** was 1000 **/
#define	MAC_MAX	MACQ_SZ-1

/*	Define statement types (tokens)		*/
#define	ST_IF     1
#define	ST_WHILE  2
#define	ST_RETURN 3
#define	ST_BREAK  4
#define	ST_CONT   5
#define	ST_ASM    6
#define	ST_EXPR   7
/** ucc **/
#define	ST_DO		8
#define	ST_FOR		9
#define	ST_SWITCH	10

/* Define how to carve up a name too long for the assembler */
/** originally 7,7 **/
#define asmpref	11
#define asmsuff	3

#endif /* DEFINES_H */