00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef wfe_util_INCLUDED
00045 #define wfe_util_INCLUDED
00046
00047
00048 #ifndef __cplusplus
00049 typedef int INT;
00050 typedef signed int INT32;
00051 typedef unsigned long long UINT64;
00052 typedef int BOOL;
00053 typedef struct wn WN;
00054 #endif
00055
00056 #ifdef __cplusplus
00057 extern "C" {
00058 #endif
00059
00060 extern int WFE_Keep_Zero_Length_Structs;
00061
00062 extern void WFE_Init (INT argc, char **arrgv, char **envp);
00063 extern void WFE_Finish (void);
00064 extern void WFE_File_Init (INT argc, char **argv);
00065 extern void WFE_File_Finish (void);
00066 extern void WFE_Check_Errors (int *error_count, int *warning_count, BOOL *need_inliner);
00067 extern int warnings_are_errors;
00068
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072
00073 #ifdef __cplusplus
00074
00075 #include "wn.h"
00076 #include "srcpos.h"
00077
00078 typedef enum {
00079 wfe_stmk_unknown,
00080 wfe_stmk_func_entry,
00081 wfe_stmk_func_pragmas,
00082 wfe_stmk_func_body,
00083 wfe_stmk_region_pragmas,
00084 wfe_stmk_scope,
00085 wfe_stmk_if_cond,
00086 wfe_stmk_if_then,
00087 wfe_stmk_if_else,
00088 wfe_stmk_while_cond,
00089 wfe_stmk_while_body,
00090 wfe_stmk_dowhile_cond,
00091 wfe_stmk_dowhile_body,
00092 wfe_stmk_for_cond,
00093 wfe_stmk_for_body,
00094 wfe_stmk_switch,
00095 wfe_stmk_comma,
00096 wfe_stmk_rcomma,
00097 #ifdef KEY
00098 wfe_stmk_dummy,
00099 #endif // KEY
00100 wfe_stmk_last
00101 } WFE_STMT_KIND;
00102
00103 extern void WFE_Stmt_Push (WN* wn, WFE_STMT_KIND kind, SRCPOS srcpos);
00104 extern WN* WFE_Stmt_Top (void);
00105 extern void WFE_Stmt_Append (WN* wn, SRCPOS srcpos);
00106 #ifdef KEY
00107 extern void WFE_Stmt_Prepend_Last (WN* wn, SRCPOS srcpos);
00108 #endif
00109 extern WN* WFE_Stmt_Last (void);
00110 extern WN* WFE_Stmt_Pop (WFE_STMT_KIND kind);
00111
00112 #ifdef KEY
00113 void WFE_Stmt_Append_Before (WN* wn, SRCPOS srcpos);
00114 WFE_STMT_KIND WFE_Stmt_Top_Kind (void);
00115 extern WN * WFE_Find_Stmt_In_Stack (WFE_STMT_KIND);
00116 #endif
00117
00118 extern UINT current_file;
00119 extern int lineno;
00120
00121 extern int wfe_invoke_inliner;
00122
00123
00124 inline SRCPOS
00125 Get_Srcpos (void)
00126 {
00127 SRCPOS s;
00128 SRCPOS_clear(s);
00129 SRCPOS_filenum(s) = current_file;
00130 SRCPOS_linenum(s) = lineno;
00131 return s;
00132 }
00133
00134 #endif
00135
00136 #endif