Mercurial > hg > CbC > old > device
view mc-parse.h @ 856:d9dd3e6e7c5f
macro compatibility
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Nov 2011 05:44:49 +0900 |
parents | a5f9e5a4db1b |
children | 5313ed059cee |
line wrap: on
line source
/* for mc-parse.c */ /************************************************************************ ** Copyright (C) 2006 Shinji Kono ** 連絡先: 琉球大学情報工学科 河野 真治 ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp) ** ** このソースのいかなる複写,改変,修正も許諾します。ただし、 ** その際には、誰が貢献したを示すこの部分を残すこと。 ** 再配布や雑誌の付録などの問い合わせも必要ありません。 ** 営利利用も上記に反しない範囲で許可します。 ** バイナリの配布の際にはversion messageを保存することを条件とします。 ** このプログラムについては特に何の保証もしない、悪しからず。 ** ** Everyone is permitted to do anything on this program ** including copying, modifying, improving, ** as long as you don't try to pretend that you wrote it. ** i.e., the above copyright notice has to appear in all copies. ** Binary distribution requires original version messages. ** You don't have to ask before copying, redistribution or publishing. ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. ***********************************************************************/ extern int sym; /* next symbol */ extern int type; /* current type */ extern int mode; /* grammer mode (STAT,ADECL) */ extern int stmode; /* storage mode (STATIC,EXTRN) */ extern int ctmode; /* constant mode */ extern int inmode; /* inline mode */ extern int labelno; /* label number */ extern int gpc; /* global variable size (unused?) */ extern int disp; /* local variable offset */ extern int args; /* function arguments */ extern int init_vars; /* variable initialize list in local decl */ extern int cslabel; /* case label */ extern int cslist; /* case list */ extern int clabel; /* continue label */ extern int control; /* control is reached */ extern NMTBL *nptr; /* current name table */ extern NMTBL *gnptr; /* currrent global name table (unsed?) */ extern NMTBL *fnptr; /* current function name table */ extern NMTBL *local_nptr; /* initialzing local variable nptr */ extern int retlabel; /* return label */ extern int retpending; /* jump to return label suspended */ extern int retcont; /* continuation label */ extern int pending_jmp; /* suspended jump label */ extern int chk; /* no code generation */ extern int bit_field_disp; /* bit field bit offset */ extern int fields; /* struct field */ extern int struct_return; /* temporal return structure variable */ extern int lastexp; /* last expression in statement expressoin */ extern int debug; /* debug flag */ extern int decl_str_init; /* partial structure initializer */ extern int inline_funcs; /* inline function list */ extern int parse; /* parse tree */ extern int attribute; /* attribute list (in __attribute()) */ /* STRING nptr MACRO nptr FMACRO nptr RESERVE nptr TAG nptr FIELD nptr TYPE nptr */ /* memory pool structure */ /* extendable */ typedef struct cheap { char *ptr; /* current pointer */ char *last; char *first; struct cheap *next; /* previous cheap */ } CHEAP; /* used in mc-macro.c */ extern int asmf; /* assembler generating mode (old) */ extern int ch; /* current character */ extern int chptrsave; /* nested character pointer */ extern int chsave; /* saved current character */ extern char linebuf[LBUFSIZE]; /* line buffer */ extern char *chptr; /* current character pointer */ extern int glineno; /* total lineno */ extern int in_comment; /* tokenizer mode */ extern int in_quote; /* tokenizer mode */ extern int lfree; /* local free heap top */ extern int lineno; /* lineno in current file */ extern int lsrc; /* source listing flag */ extern char *include_path[MAX_INCLUDE_PATH_COUNT]; /* used in mc-code-* */ extern NMTBL null_nptr; extern int parse_mode; extern char * make_filename_with_extension(char *filename,char *ext); /* used in mc-switch */ extern void free_glist3(int e1); extern void free_glist3_a(int e1); extern void free_glist2s(int e1); extern int csvalue1; /* current switch variable */ extern int blabel; /* break label in switch */ extern int dlabel; /* default label in switch */ /* used in mc-tree.c */ extern int gtypedefed; /* global typedef list */ extern int typedefed; /* accumlated typedef name */ /* global variable end */ extern void free_glist2(int e1); /* used in mc-codegen.c */ extern NMTBL * anonymous_nptr(); extern int append4(int p,int a1,int a2,int a3); extern void display_ntable(NMTBL *n, char *s); extern NMTBL * lsearch(char *name,int sc); #if FLOAT_CODE extern int dlist2(int e1, double d1); #endif extern void error(int n); extern int glist2(int e1,int e2); extern int glist2s(int e1,char * e2); extern int glist3s(int e1,int e2, char * e3); extern int glist3(int e1,int e2,int e3); extern int glist4(int e1,int e2,int e3,int e4); extern int glist5(int e1,int e2,int e3,int e4,int e5); extern int insert_ascend(int p,int e,int eq()); extern int length(int list); extern int list2(int e1, int e2); extern int list3(int e1, int e2, int e3); extern int list3s(int e1, int e2, char * e3); extern int list4(int e1, int e2, int e3, int e4); extern NMTBL * extern_define(char *s,int d,int type,int use); extern void set_lfree(int save); extern int has_attr(NMTBL *n,int attr); extern int attr_value(NMTBL *n,int attr); extern void set_attr(NMTBL *n,int attr,int value); extern int set_type_attr(int type,int attr); extern int gset_type_attr(int type,int attr); extern int get_type_attr(int type); extern int type_value(int type); extern int set_type_with_attr(int type,int type_with_attr); extern int gset_type_with_attr(int type,int type_with_attr); extern int gfree; /* local free heap top */ #if LONGLONG_CODE extern int llist2(int e1, long long d1); #endif extern int neqname(char *p,char *q); extern NMTBL *new_static_name(char *name,int delimit); extern int reverse0(int t1); extern NMTBL *reversen(NMTBL* t1); extern int size(int t); extern void set_attributes(NMTBL *n, int attr); extern int attr_value_in_list(int list,int attr); /* used in mc-macro.c */ typedef union { double d; float f; int i; long l; long long ll; char c; } Value, *ValuePtr; extern struct cheap *cheap; extern struct cheap *st_cheap, *cheap1; // for ST_COMMENT extern NMTBL *get_name(char *name,int *i,int mode); extern NMTBL * get_data(ValuePtr name,int len, int mode); extern int get_data_label(ValuePtr name,int len, void emit(ValuePtr, int , void *), void *arg); #define DEF 1 #define NONDEF 2 extern NMTBL * get_name_from_chptr(); extern NMTBL *name_space_search(NMTBL *ns,int sc); extern int getsym(int sc); extern int getch(void); extern int skipspc(void); extern void copy_current_file_dir(char *name); extern int expr(int noconv); extern int alpha(int c); extern int digit(int c); extern void enter_scope(); extern void leave_scope(); extern NMTBL *make_local_scope(); extern struct cheap * increment_cheap(struct cheap *cheap,char **save); extern void save_cheap(struct cheap *scheap,struct cheap *cheap); extern struct cheap * reset_cheap(struct cheap *scheap); extern struct cheap * new_cheap(); extern void pfdecl(NMTBL *nptr); extern void pcode_decl(NMTBL *nptr); #if CASE_CODE extern int docase_eq(); #endif extern NMTBL *l_top_search(char *name,int sc); /* end */