Mercurial > hg > CbC > old > device
view mc.h @ 195:c193120ee2a6
*** empty log message ***
author | kono |
---|---|
date | Sun, 04 Apr 2004 21:17:10 +0900 |
parents | 114e9d64b5cc |
children | 5f70abd9453d |
line wrap: on
line source
/* Micro-C header file */ #define DEBUG error(-1) /*#include "CCLIB.TXT" */ #ifdef __micro_c__ #include "stdio.h" #else #include <stdio.h> #include <stdlib.h> #endif #define FLOAT_CODE 1 #define LONGLONG_CODE 1 #define SIZE_INT 4 /* reserved word start */ #define INT (-1) #define UNSIGNED (-2) #define CHAR (-3) #define UCHAR (-4) #define POINTER (-5) #define ARRAY (-6) #define STRUCT (-7) #define UNION (-8) #define FUNCTION (-9) #define STATIC (-10) #define GOTO (-11) #define RETURN (-12) #define BREAK (-13) #define CONTINUE (-14) #define IF (-15) #define ELSE (-16) #define FOR (-17) #define DO (-18) #define WHILE (-19) #define SWITCH (-20) #define CASE (-21) #define DEFAULT (-22) #define RESERVE (-23) #define TAG (-24) #define FIELD (-25) #define IDENT (-26) #define MACRO (-27) #define BLABEL (-28) #define FLABEL (-29) #define TYPEDEF (-30) #define SIZEOF (-31) #define TYPE (-32) #define LONG (-33) #define SHORT (-34) #define USHORT (-35) #define EXTRN (-36) #define EXTRN1 (-37) #define VOID (-38) #define INLINE (-39) #define REGISTER (-40) #define FREGISTER (-41) #define DREGISTER (-42) #define LREGISTER (-43) #define CODE (-44) #define ENVIRONMENT (-45) #define DEFINED (-46) #define ENUM (-47) #define KONST (-48) #define FMACRO (-49) #define LMACRO (-50) #define SIGNED (-51) #define DOTS (-52) #define FLOAT (-53) #define DOUBLE (-54) #define LONGLONG (-55) #define ULONGLONG (-56) #define VOLATILE (-57) /* reserved word end */ #define EMPTY (-99) /* mode start */ #define TOP 0 #define GDECL 1 #define GSDECL 2 #define GUDECL 3 #define ADECL 4 #define LDECL 5 #define LSDECL 6 #define LUDECL 7 #define STADECL 8 #define STAT 9 #define GTDECL 10 #define LTDECL 11 #define IFDEF 12 #define MDECL 13 #define GEDECL 14 #define LEDECL 15 /* mode end */ #define US 1 #define AS 1000 #define SOP 200 #define DOP 400 #define FOP 600 #define LOP 800 /* tree node tags start */ #define LIST_ARGS(i) (i==FUNCTION||i==CODE) /* nullary argments */ #define GVAR 1 #define RGVAR 2 #define CRGVAR 3 #define CURGVAR 4 #define LVAR 5 #define RLVAR 6 #define CRLVAR 7 #define CURLVAR 8 #define FRGVAR (FOP+RGVAR) #define FRLVAR (FOP+RLVAR) #define DRGVAR (DOP+RGVAR) #define DRLVAR (DOP+RLVAR) #define SRGVAR (SOP+CRGVAR) #define SRLVAR (SOP+CRLVAR) #define SURGVAR (SOP+CURGVAR) #define SURLVAR (SOP+CURLVAR) #define LRGVAR (LOP+CRGVAR) #define LRLVAR (LOP+CRLVAR) #define LURGVAR (LOP+CURGVAR) #define LURLVAR (LOP+CURLVAR) #define CONST 9 #define DCONST (DOP+CONST) #define FCONST (FOP+CONST) #define LCONST (LOP+CONST) #define STRING 10 #define FNAME 11 #define NULLARY_ARGS(i) (i==REGISTER||i==DREGISTER||i==FREGISTER||(GVAR<=(i%SOP)&&(i%SOP)<=FNAME)) /* unary argments */ #define ADDRESS 12 #define MINUS 13 #define LNOT 14 #define BNOT 15 #define INC 16 #define POSTINC 17 #define UPOSTINC 18 #define PREINC 19 #define UPREINC 20 #define DEC 21 #define CPOSTINC 22 #define CPREINC 23 #define CPOSTDEC 24 #define CPREDEC 25 #define CUPOSTINC 26 #define CUPREINC 27 #define CUPOSTDEC 28 #define CUPREDEC 29 #define SPOSTINC (SOP+CPOSTINC) #define SPREINC (SOP+CPREINC) #define SPOSTDEC (SOP+CPOSTDEC) #define SPREDEC (SOP+CPREDEC) #define SUPOSTINC (SOP+CUPOSTINC) #define SUPREINC (SOP+CUPREINC) #define SUPOSTDEC (SOP+CUPOSTDEC) #define SUPREDEC (SOP+CUPREDEC) #define FPOSTINC (FOP+POSTINC) #define FPREINC (FOP+PREINC) #define DPOSTINC (DOP+POSTINC) #define DPREINC (DOP+PREINC) #define LPOSTINC (LOP+CPOSTINC) #define LPREINC (LOP+CPREINC) #define LUPOSTINC (LOP+CUPOSTINC) #define LUPREINC (LOP+CUPREINC) #define INDIRECT 30 #define RINDIRECT 31 #define CRINDIRECT 32 #define CURINDIRECT 33 #define SRINDIRECT (SOP+CRINDIRECT) #define SURINDIRECT (SOP+CURINDIRECT) #define FRINDIRECT (FOP+RINDIRECT) #define DRINDIRECT (DOP+RINDIRECT) #define LRINDIRECT (LOP+CRINDIRECT) #define LURINDIRECT (LOP+CURINDIRECT) #define RSTRUCT 34 #define CONV 35 #define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV) /* binary argments */ #define MUL 36 #define UMUL 37 #define DIV 38 #define UDIV 39 #define MOD 40 #define UMOD 41 #define ADD 42 #define SUB 43 #define CMP 44 #define RSHIFT 45 #define URSHIFT 46 #define LSHIFT 47 #define ULSHIFT 48 #define GT 49 #define UGT 50 #define GE 51 #define UGE 52 #define LT 53 #define ULT 54 #define LE 55 #define ULE 56 #define EQ 57 #define NEQ 58 #define BAND 59 #define EOR 60 #define BOR 61 #define LAND 62 #define LOR 63 #define ASS 64 #define CMPGE 65 #define ASSOP 66 #define COMMA 67 #define CASS 68 #define CASSOP 69 #define CUASSOP 70 #define SASS (SOP+CASS) #define SASSOP (SOP+CASSOP) #define SUASSOP (SOP+CUASSOP) #define DASS (DOP+ASS) #define DCMPGE (DOP+CMPGE) #define DASSOP (DOP+ASSOP) #define DCMP (DOP+CMP) #define DMINUS (DOP+MINUS) #define DMUL (DOP+MUL) #define DDIV (DOP+DIV) #define DADD (DOP+ADD) #define DSUB (DOP+SUB) #define FASS (FOP+ASS) #define FCMPGE (FOP+CMPGE) #define FASSOP (FOP+ASSOP) #define FCMP (FOP+CMP) #define FMINUS (FOP+MINUS) #define FMUL (FOP+MUL) #define FDIV (FOP+DIV) #define FADD (FOP+ADD) #define FSUB (FOP+SUB) #define LASS (LOP+CASS) #define LCMPGE (LOP+CMPGE) #define LASSOP (LOP+CASSOP) #define LUASSOP (LOP+CUASSOP) #define LCMP (LOP+CMP) #define LMINUS (LOP+MINUS) #define LMUL (LOP+MUL) #define LDIV (LOP+DIV) #define LUMUL (LOP+UMUL) #define LUDIV (LOP+UDIV) #define LADD (LOP+ADD) #define LSUB (LOP+SUB) #define LMOD (LOP+MOD) #define LUMOD (LOP+UMOD) #define LLSHIFT (LOP+LSHIFT) #define LULSHIFT (LOP+ULSHIFT) #define LRSHIFT (LOP+RSHIFT) #define LURSHIFT (LOP+URSHIFT) #define LBAND (LOP+BAND) #define LEOR (LOP+EOR) #define LBOR (LOP+BOR) #define STASS 71 #define BINARY_ARGS(i) (MUL<=(i%SOP)&&(i%SOP)<=STASS) /* tarnary argments */ #define COND 72 #define SCOND (SOP+COND) #define DCOND (DOP+COND) #define FCOND (FOP+COND) #define LCOND (LOP+COND) #define TARNARY_ARGS(i) (COND==(i%SOP)) /* not appeared as tags */ #define I2I 73 #define I2U 74 #define I2D 75 #define I2F 76 #define I2LL 77 #define I2ULL 78 #define U2I 79 #define U2U 80 #define U2D 81 #define U2F 82 #define U2LL 83 #define U2ULL 84 #define D2I (DOP+I2I) #define D2U (DOP+I2U) #define D2D (DOP+I2D) #define D2F (DOP+I2F) #define D2LL (DOP+I2LL) #define D2ULL (DOP+I2ULL) #define F2I (FOP+I2I) #define F2U (FOP+I2U) #define F2D (FOP+I2D) #define F2F (FOP+I2F) #define F2LL (FOP+I2LL) #define F2ULL (FOP+I2ULL) #define LL2I (LOP+I2I) #define LL2U (LOP+I2U) #define LL2D (LOP+I2D) #define LL2F (LOP+I2F) #define LL2LL (LOP+I2LL) #define LL2ULL (LOP+I2ULL) #define ULL2I (LOP+U2I) #define ULL2U (LOP+U2U) #define ULL2D (LOP+U2D) #define ULL2F (LOP+U2F) #define ULL2LL (LOP+U2LL) #define ULL2ULL (LOP+U2ULL) #define LPAR 85 #define RPAR 86 #define LBRA 87 #define RBRA 88 #define LC 89 #define RC 90 #define COLON 91 #define SM 92 #define PERIOD 93 #define ARROW 94 #define CNAME 95 /* tree node tags end */ /* error number start */ #define FILERR 1 #define DCERR 2 #define STERR 3 #define EXERR 4 #define CNERR 5 #define CHERR 6 #define GSERR 7 #define LSERR 8 #define STRERR 9 #define LNERR 10 #define EOFERR 11 #define MCERR 12 #define INCERR 13 #define HPERR 14 #define TYERR 15 #define LVERR 16 #define UDERR 17 #define OPTION 18 #define REG_ERR 19 #define CODE_ERR 20 #define MSERR 21 /* error number end */ #define GSYMS 9000 #define LSYMS 500 #define MSYMS 3000 #define HEAPSIZE 30000 /* #define CHEAPSIZE 3000 */ #define CHEAPSIZE 356000 #define LBUFSIZE 4096 #define MACROSIZE 16000 #define FILES 10 #define OUTPUT_FILE_NAME "mcout.s" EXTERN int sym,ch,type,mode,stmode,gfree,lfree,mflag,lineno,glineno; EXTERN int labelno,gpc,disp,reg_var,debug; EXTERN int symval,args,init_vars,heap[HEAPSIZE]; EXTERN int blabel,clabel,dlabel,cslabel,ilabel,control,ac,ac2,lsrc,chk,asmf; EXTERN int MAX_REGISTER_VAR; EXTERN unsigned hash; EXTERN int chsave; EXTERN int chptrsave; EXTERN char linebuf[LBUFSIZE],namebuf[LBUFSIZE],*chptr; EXTERN char *name,*cheapp,**av,/*obuf[320],*/*sptr,escape(void); EXTERN int arg_offset,stat_no,size_of_int,size_of_short,disp_offset,endian,csvalue1; EXTERN int code_arg_offset; EXTERN int size_of_double,size_of_float,size_of_longlong; EXTERN int retlabel,retpending,retcont; EXTERN int arglist; EXTERN FILE *obuf; #if 1 typedef struct nametable { char *nm; int sc,ty,dsp; } NMTBL; #else typedef struct nametable { char *nm; int sc; int ty; int dsp; } NMTBL; #endif EXTERN NMTBL mtable[MSYMS]; EXTERN NMTBL ntable[GSYMS+LSYMS]; EXTERN NMTBL *nptr,*gnptr; EXTERN NMTBL *fnptr; EXTERN NMTBL null_nptr; EXTERN int typedefed,gtypedefed; EXTERN struct {int fd,ln;char *name0;int inc;FILE *fcb;} *filep,filestack[FILES]; EXTERN char cheap[CHEAPSIZE]; EXTERN char *macropp,macro_buf[MACROSIZE]; extern void macro_define(char *n); extern void error(int n); extern int size(int t); extern int scalar(int t); #if FLOAT_CODE EXTERN double dsymval; extern int dlist2(int e1, double e2); #endif #if LONGLONG_CODE EXTERN long long lsymval; extern int llist2(int e1, long long e2); #endif extern int list2(int e1, int e2); extern int list3(int e1, int e2, int e3); extern int list4(int e1, int e2, int e3,int e4); extern int reverse0(int t1); extern int assign_data(int e, int t, NMTBL *n,int offset); extern int assign_expr0(int e1,int e2,int t,int type) ; extern int assign_expr(int e1,int e2,int t,int type) ; extern int append4(int p,int a1,int a2,int a3); #define car(e) (heap[(int)(e)]) #define cadr(e) (heap[((int)(e))+1]) #define caddr(e) (heap[((int)(e))+2]) #define cadddr(e) (heap[((int)(e))+3]) #if FLOAT_CODE #define dcadr(e) (*(double*)&heap[((int)(e))+1]) #define dcaddr(e) (*(double*)&heap[((int)(e))+2]) #endif #if LONGLONG_CODE #define lcadr(e) (*(long long*)&heap[((int)(e))+1]) #define lcaddr(e) (*(long long*)&heap[((int)(e))+2]) #endif #include "conv/conv.h" /* #include "conv/c2cbc.h" #include "conv/cbc2c.h" */ extern Converter *conv; EXTERN void extern_define(char *s,int dsp,int type,int use); EXTERN void error(int n); EXTERN int append4(int p,int a1,int a2,int a3); EXTERN int assign_expr(int e1,int e2,int t,int type); EXTERN int assign_expr0(int e1,int e2,int t,int type); EXTERN int backdef(void); EXTERN int fwdlabel(void); EXTERN int glist2(int e1,int e2); EXTERN int glist3(int e1,int e2,int e3); EXTERN void free_glist2(int e1); EXTERN void free_glist3(int e1); EXTERN int integral(int t); EXTERN int integral(int t); EXTERN int list2(int e1, int e2); EXTERN int list3(int e1, int e2, int e3); EXTERN int list4(int e1, int e2, int e3, int e4); EXTERN int reverse0(int t1); /* EXTERN int rplacad(int e, int n); EXTERN int rplacadd(int e, int n); */ EXTERN int rvalue_t(int e,int type); EXTERN int scalar(int t); EXTERN void bexpr(int e1, char cond, int l1); EXTERN void def_label(int cslabel, int dlabel); EXTERN void display_ntable(NMTBL *n, char *s); EXTERN void exit(int l); EXTERN void fwddef(int l); EXTERN int new_lvar(int size); EXTERN void free_lvar(int lvar); EXTERN void init_free_lvar_list(); /* end */