sslparser.h

Go to the documentation of this file.
00001 #ifndef YY_SSLParser_h_included
00002 #define YY_SSLParser_h_included
00003 
00004 #line 1 "/usr/local/lib/bison.h"
00005 /* before anything */
00006 #ifdef c_plusplus
00007 #ifndef __cplusplus
00008 #define __cplusplus
00009 #endif
00010 #endif
00011 #ifdef __cplusplus
00012 #ifndef YY_USE_CLASS
00013 #define YY_USE_CLASS
00014 #endif
00015 #else
00016 #endif
00017 #include <stdio.h>
00018 
00019 /* #line 14 "/usr/local/lib/bison.h" */
00020 #line 21 "sslparser.h"
00021 #line 41 "sslparser.y"
00022 
00023 #include "gc.h"
00024 #include <assert.h>
00025 #if defined(_MSC_VER) && _MSC_VER <= 1200
00026 #pragma warning(disable:4786)
00027 #endif 
00028 
00029 #include <sstream>
00030 #include "types.h"
00031 #include "rtl.h"
00032 #include "table.h"
00033 #include "insnameelem.h"
00034 #include "util.h"           // E.g. str()
00035 #include "statement.h"
00036 
00037 #ifdef WIN32
00038 #include <malloc.h>
00039 #endif
00040 
00041 class SSLScanner;
00042 
00043 #line 68 "sslparser.y"
00044 typedef union {
00045     Exp*            exp;
00046     char*           str;
00047     int             num;
00048     double          dbl;
00049     Statement*      regtransfer;
00050     Type*           typ;
00051     
00052     Table*          tab;
00053     InsNameElem*    insel;
00054     std::list<std::string>*   parmlist;
00055     std::list<std::string>*   strlist;
00056     std::deque<Exp*>*    exprlist;
00057     std::deque<std::string>*  namelist;
00058     std::list<Exp*>*     explist;
00059     RTL*            rtlist;
00060 } yy_SSLParser_stype;
00061 #define YY_SSLParser_STYPE yy_SSLParser_stype
00062 #define YY_SSLParser_DEBUG  1 
00063 #define YY_SSLParser_PARSE_PARAM  \
00064     RTLInstDict& Dict
00065 #define YY_SSLParser_CONSTRUCTOR_PARAM  \
00066     const std::string& sslFile, \
00067     bool trace
00068 #define YY_SSLParser_CONSTRUCTOR_INIT  : \
00069    sslFile(sslFile), bFloat(false)
00070 #define YY_SSLParser_CONSTRUCTOR_CODE  \
00071     std::fstream *fin = new std::fstream(sslFile.c_str(), std::ios::in); \
00072     theScanner = NULL; \
00073     if (!*fin) { \
00074         std::cerr << "can't open `" << sslFile << "' for reading\n"; \
00075     return; \
00076     } \
00077     theScanner = new SSLScanner(*fin, trace); \
00078     if (trace) yydebug = 1;
00079 #define YY_SSLParser_MEMBERS  \
00080 public: \
00081         SSLParser(std::istream &in, bool trace); \
00082         virtual ~SSLParser(); \
00083 OPER    strToOper(const char*s); /* Convert string to an operator */ \
00084 static  Statement* parseExp(const char *str); /* Parse an expression or assignment from a string */ \
00085 /* The code for expanding tables and saving to the dictionary */ \
00086 void    expandTables(InsNameElem* iname, std::list<std::string>* params, RTL* o_rtlist, RTLInstDict& Dict); \
00087 Exp*    makeSuccessor(Exp* e);  /* Get successor (of register expression) */ \
00088 \
00089     /* \
00090      * The scanner. \
00091      */ \
00092     SSLScanner* theScanner; \
00093 protected: \
00094 \
00095     /* \
00096      * The file from which the SSL spec is read. \
00097      */ \
00098     std::string sslFile; \
00099 \
00100     /* \
00101      * Result for parsing an assignment. \
00102      */ \
00103     Statement *the_asgn; \
00104 \
00105     /* \
00106      * Maps SSL constants to their values. \
00107      */ \
00108     std::map<std::string,int> ConstTable; \
00109 \
00110     /* \
00111      * maps index names to instruction name-elements \
00112      */ \
00113     std::map<std::string, InsNameElem*> indexrefmap; \
00114 \
00115     /* \
00116      * Maps table names to Table's.\
00117      */ \
00118     std::map<std::string, Table*> TableDict; \
00119 \
00120     /* \
00121      * True when FLOAT keyword seen; false when INTEGER keyword seen \
00122      * (in @REGISTER section) \
00123      */ \
00124     bool bFloat;
00125 
00126 #line 14 "/usr/local/lib/bison.h"
00127  /* %{ and %header{ and %union, during decl */
00128 #ifndef YY_SSLParser_COMPATIBILITY
00129 #ifndef YY_USE_CLASS
00130 #define  YY_SSLParser_COMPATIBILITY 1
00131 #else
00132 #define  YY_SSLParser_COMPATIBILITY 0
00133 #endif
00134 #endif
00135 
00136 #if YY_SSLParser_COMPATIBILITY != 0
00137 /* backward compatibility */
00138 #ifdef YYLTYPE
00139 #ifndef YY_SSLParser_LTYPE
00140 #define YY_SSLParser_LTYPE YYLTYPE
00141 /* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
00142 /* use %define LTYPE */
00143 #endif
00144 #endif
00145 #ifdef YYSTYPE
00146 #ifndef YY_SSLParser_STYPE 
00147 #define YY_SSLParser_STYPE YYSTYPE
00148 /* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
00149 /* use %define STYPE */
00150 #endif
00151 #endif
00152 #ifdef YYDEBUG
00153 #ifndef YY_SSLParser_DEBUG
00154 #define  YY_SSLParser_DEBUG YYDEBUG
00155 /* WARNING obsolete !!! user defined YYDEBUG not reported into generated header */
00156 /* use %define DEBUG */
00157 #endif
00158 #endif
00159 #ifdef YY_SSLParser_STYPE
00160 #ifndef yystype
00161 #define yystype YY_SSLParser_STYPE
00162 #endif
00163 #endif
00164 /* use goto to be compatible */
00165 #ifndef YY_SSLParser_USE_GOTO
00166 #define YY_SSLParser_USE_GOTO 1
00167 #endif
00168 #endif
00169 
00170 /* use no goto to be clean in C++ */
00171 #ifndef YY_SSLParser_USE_GOTO
00172 #define YY_SSLParser_USE_GOTO 0
00173 #endif
00174 
00175 #ifndef YY_SSLParser_PURE
00176 
00177 /* #line 63 "/usr/local/lib/bison.h" */
00178 #line 179 "sslparser.h"
00179 
00180 #line 63 "/usr/local/lib/bison.h"
00181 /* YY_SSLParser_PURE */
00182 #endif
00183 
00184 /* #line 65 "/usr/local/lib/bison.h" */
00185 #line 186 "sslparser.h"
00186 
00187 #line 65 "/usr/local/lib/bison.h"
00188 /* prefix */
00189 #ifndef YY_SSLParser_DEBUG
00190 
00191 /* #line 67 "/usr/local/lib/bison.h" */
00192 #line 193 "sslparser.h"
00193 
00194 #line 67 "/usr/local/lib/bison.h"
00195 /* YY_SSLParser_DEBUG */
00196 #endif
00197 #ifndef YY_SSLParser_LSP_NEEDED
00198 
00199 /* #line 70 "/usr/local/lib/bison.h" */
00200 #line 201 "sslparser.h"
00201 
00202 #line 70 "/usr/local/lib/bison.h"
00203  /* YY_SSLParser_LSP_NEEDED*/
00204 #endif
00205 /* DEFAULT LTYPE*/
00206 #ifdef YY_SSLParser_LSP_NEEDED
00207 #ifndef YY_SSLParser_LTYPE
00208 typedef
00209   struct yyltype
00210     {
00211       int timestamp;
00212       int first_line;
00213       int first_column;
00214       int last_line;
00215       int last_column;
00216       char *text;
00217    }
00218   yyltype;
00219 
00220 #define YY_SSLParser_LTYPE yyltype
00221 #endif
00222 #endif
00223 /* DEFAULT STYPE*/
00224 #ifndef YY_SSLParser_STYPE
00225 #define YY_SSLParser_STYPE int
00226 #endif
00227 /* DEFAULT MISCELANEOUS */
00228 #ifndef YY_SSLParser_PARSE
00229 #define YY_SSLParser_PARSE yyparse
00230 #endif
00231 #ifndef YY_SSLParser_LEX
00232 #define YY_SSLParser_LEX yylex
00233 #endif
00234 #ifndef YY_SSLParser_LVAL
00235 #define YY_SSLParser_LVAL yylval
00236 #endif
00237 #ifndef YY_SSLParser_LLOC
00238 #define YY_SSLParser_LLOC yylloc
00239 #endif
00240 #ifndef YY_SSLParser_CHAR
00241 #define YY_SSLParser_CHAR yychar
00242 #endif
00243 #ifndef YY_SSLParser_NERRS
00244 #define YY_SSLParser_NERRS yynerrs
00245 #endif
00246 #ifndef YY_SSLParser_DEBUG_FLAG
00247 #define YY_SSLParser_DEBUG_FLAG yydebug
00248 #endif
00249 #ifndef YY_SSLParser_ERROR
00250 #define YY_SSLParser_ERROR yyerror
00251 #endif
00252 
00253 #ifndef YY_SSLParser_PARSE_PARAM
00254 #ifndef __STDC__
00255 #ifndef __cplusplus
00256 #ifndef YY_USE_CLASS
00257 #define YY_SSLParser_PARSE_PARAM
00258 #ifndef YY_SSLParser_PARSE_PARAM_DEF
00259 #define YY_SSLParser_PARSE_PARAM_DEF
00260 #endif
00261 #endif
00262 #endif
00263 #endif
00264 #ifndef YY_SSLParser_PARSE_PARAM
00265 #define YY_SSLParser_PARSE_PARAM void
00266 #endif
00267 #endif
00268 
00269 /* TOKEN C */
00270 #ifndef YY_USE_CLASS
00271 
00272 #ifndef YY_SSLParser_PURE
00273 extern YY_SSLParser_STYPE YY_SSLParser_LVAL;
00274 #endif
00275 
00276 
00277 /* #line 143 "/usr/local/lib/bison.h" */
00278 #line 279 "sslparser.h"
00279 #define COND_OP 258
00280 #define BIT_OP  259
00281 #define ARITH_OP    260
00282 #define LOG_OP  261
00283 #define NAME    262
00284 #define ASSIGNTYPE  263
00285 #define REG_ID  264
00286 #define REG_NUM 265
00287 #define COND_TNAME  266
00288 #define DECOR   267
00289 #define FARITH_OP   268
00290 #define FPUSH   269
00291 #define FPOP    270
00292 #define TEMP    271
00293 #define SHARES  272
00294 #define CONV_FUNC   273
00295 #define TRUNC_FUNC  274
00296 #define TRANSCEND   275
00297 #define FABS_FUNC   276
00298 #define BIG 277
00299 #define LITTLE  278
00300 #define NAME_CALL   279
00301 #define NAME_LOOKUP 280
00302 #define ENDIANNESS  281
00303 #define COVERS  282
00304 #define INDEX   283
00305 #define NOT 284
00306 #define LNOT    285
00307 #define FNEG    286
00308 #define THEN    287
00309 #define LOOKUP_RDC  288
00310 #define BOGUS   289
00311 #define ASSIGN  290
00312 #define TO  291
00313 #define COLON   292
00314 #define S_E 293
00315 #define AT  294
00316 #define ADDR    295
00317 #define REG_IDX 296
00318 #define EQUATE  297
00319 #define MEM_IDX 298
00320 #define TOK_INTEGER 299
00321 #define TOK_FLOAT   300
00322 #define FAST    301
00323 #define OPERAND 302
00324 #define FETCHEXEC   303
00325 #define CAST_OP 304
00326 #define FLAGMACRO   305
00327 #define SUCCESSOR   306
00328 #define NUM 307
00329 #define FLOATNUM    308
00330 #define FCHS    309
00331 
00332 
00333 #line 143 "/usr/local/lib/bison.h"
00334  /* #defines token */
00335 /* after #define tokens, before const tokens S5*/
00336 #else
00337 #ifndef YY_SSLParser_CLASS
00338 #define YY_SSLParser_CLASS SSLParser
00339 #endif
00340 
00341 #ifndef YY_SSLParser_INHERIT
00342 #define YY_SSLParser_INHERIT
00343 #endif
00344 #ifndef YY_SSLParser_MEMBERS
00345 #define YY_SSLParser_MEMBERS 
00346 #endif
00347 #ifndef YY_SSLParser_LEX_BODY
00348 #define YY_SSLParser_LEX_BODY  
00349 #endif
00350 #ifndef YY_SSLParser_ERROR_BODY
00351 #define YY_SSLParser_ERROR_BODY  
00352 #endif
00353 #ifndef YY_SSLParser_CONSTRUCTOR_PARAM
00354 #define YY_SSLParser_CONSTRUCTOR_PARAM
00355 #endif
00356 /* choose between enum and const */
00357 #ifndef YY_SSLParser_USE_CONST_TOKEN
00358 #define YY_SSLParser_USE_CONST_TOKEN 0
00359 /* yes enum is more compatible with flex,  */
00360 /* so by default we use it */ 
00361 #endif
00362 #if YY_SSLParser_USE_CONST_TOKEN != 0
00363 #ifndef YY_SSLParser_ENUM_TOKEN
00364 #define YY_SSLParser_ENUM_TOKEN yy_SSLParser_enum_token
00365 #endif
00366 #endif
00367 
00368 class YY_SSLParser_CLASS YY_SSLParser_INHERIT
00369 {
00370 public: 
00371 #if YY_SSLParser_USE_CONST_TOKEN != 0
00372 /* static const int token ... */
00373 
00374 /* #line 182 "/usr/local/lib/bison.h" */
00375 #line 376 "sslparser.h"
00376 static const int COND_OP;
00377 static const int BIT_OP;
00378 static const int ARITH_OP;
00379 static const int LOG_OP;
00380 static const int NAME;
00381 static const int ASSIGNTYPE;
00382 static const int REG_ID;
00383 static const int REG_NUM;
00384 static const int COND_TNAME;
00385 static const int DECOR;
00386 static const int FARITH_OP;
00387 static const int FPUSH;
00388 static const int FPOP;
00389 static const int TEMP;
00390 static const int SHARES;
00391 static const int CONV_FUNC;
00392 static const int TRUNC_FUNC;
00393 static const int TRANSCEND;
00394 static const int FABS_FUNC;
00395 static const int BIG;
00396 static const int LITTLE;
00397 static const int NAME_CALL;
00398 static const int NAME_LOOKUP;
00399 static const int ENDIANNESS;
00400 static const int COVERS;
00401 static const int INDEX;
00402 static const int NOT;
00403 static const int LNOT;
00404 static const int FNEG;
00405 static const int THEN;
00406 static const int LOOKUP_RDC;
00407 static const int BOGUS;
00408 static const int ASSIGN;
00409 static const int TO;
00410 static const int COLON;
00411 static const int S_E;
00412 static const int AT;
00413 static const int ADDR;
00414 static const int REG_IDX;
00415 static const int EQUATE;
00416 static const int MEM_IDX;
00417 static const int TOK_INTEGER;
00418 static const int TOK_FLOAT;
00419 static const int FAST;
00420 static const int OPERAND;
00421 static const int FETCHEXEC;
00422 static const int CAST_OP;
00423 static const int FLAGMACRO;
00424 static const int SUCCESSOR;
00425 static const int NUM;
00426 static const int FLOATNUM;
00427 static const int FCHS;
00428 
00429 
00430 #line 182 "/usr/local/lib/bison.h"
00431  /* decl const */
00432 #else
00433 enum YY_SSLParser_ENUM_TOKEN { YY_SSLParser_NULL_TOKEN=0
00434 
00435 /* #line 185 "/usr/local/lib/bison.h" */
00436 #line 437 "sslparser.h"
00437     ,COND_OP=258
00438     ,BIT_OP=259
00439     ,ARITH_OP=260
00440     ,LOG_OP=261
00441     ,NAME=262
00442     ,ASSIGNTYPE=263
00443     ,REG_ID=264
00444     ,REG_NUM=265
00445     ,COND_TNAME=266
00446     ,DECOR=267
00447     ,FARITH_OP=268
00448     ,FPUSH=269
00449     ,FPOP=270
00450     ,TEMP=271
00451     ,SHARES=272
00452     ,CONV_FUNC=273
00453     ,TRUNC_FUNC=274
00454     ,TRANSCEND=275
00455     ,FABS_FUNC=276
00456     ,BIG=277
00457     ,LITTLE=278
00458     ,NAME_CALL=279
00459     ,NAME_LOOKUP=280
00460     ,ENDIANNESS=281
00461     ,COVERS=282
00462     ,INDEX=283
00463     ,NOT=284
00464     ,LNOT=285
00465     ,FNEG=286
00466     ,THEN=287
00467     ,LOOKUP_RDC=288
00468     ,BOGUS=289
00469     ,ASSIGN=290
00470     ,TO=291
00471     ,COLON=292
00472     ,S_E=293
00473     ,AT=294
00474     ,ADDR=295
00475     ,REG_IDX=296
00476     ,EQUATE=297
00477     ,MEM_IDX=298
00478     ,TOK_INTEGER=299
00479     ,TOK_FLOAT=300
00480     ,FAST=301
00481     ,OPERAND=302
00482     ,FETCHEXEC=303
00483     ,CAST_OP=304
00484     ,FLAGMACRO=305
00485     ,SUCCESSOR=306
00486     ,NUM=307
00487     ,FLOATNUM=308
00488     ,FCHS=309
00489 
00490 
00491 #line 185 "/usr/local/lib/bison.h"
00492  /* enum token */
00493      }; /* end of enum declaration */
00494 #endif
00495 public:
00496  int YY_SSLParser_PARSE(YY_SSLParser_PARSE_PARAM);
00497  virtual void YY_SSLParser_ERROR(char *msg) YY_SSLParser_ERROR_BODY;
00498 #ifdef YY_SSLParser_PURE
00499 #ifdef YY_SSLParser_LSP_NEEDED
00500  virtual int  YY_SSLParser_LEX(YY_SSLParser_STYPE *YY_SSLParser_LVAL,YY_SSLParser_LTYPE *YY_SSLParser_LLOC) YY_SSLParser_LEX_BODY;
00501 #else
00502  virtual int  YY_SSLParser_LEX(YY_SSLParser_STYPE *YY_SSLParser_LVAL) YY_SSLParser_LEX_BODY;
00503 #endif
00504 #else
00505  virtual int YY_SSLParser_LEX() YY_SSLParser_LEX_BODY;
00506  YY_SSLParser_STYPE YY_SSLParser_LVAL;
00507 #ifdef YY_SSLParser_LSP_NEEDED
00508  YY_SSLParser_LTYPE YY_SSLParser_LLOC;
00509 #endif
00510  int YY_SSLParser_NERRS;
00511  int YY_SSLParser_CHAR;
00512 #endif
00513 #if YY_SSLParser_DEBUG != 0
00514 public:
00515  int YY_SSLParser_DEBUG_FLAG;   /*  nonzero means print parse trace */
00516 #endif
00517 public:
00518  YY_SSLParser_CLASS(YY_SSLParser_CONSTRUCTOR_PARAM);
00519 public:
00520  YY_SSLParser_MEMBERS 
00521 };
00522 /* other declare folow */
00523 #endif
00524 
00525 
00526 #if YY_SSLParser_COMPATIBILITY != 0
00527 /* backward compatibility */
00528 #ifndef YYSTYPE
00529 #define YYSTYPE YY_SSLParser_STYPE
00530 #endif
00531 
00532 #ifndef YYLTYPE
00533 #define YYLTYPE YY_SSLParser_LTYPE
00534 #endif
00535 #ifndef YYDEBUG
00536 #ifdef YY_SSLParser_DEBUG 
00537 #define YYDEBUG YY_SSLParser_DEBUG
00538 #endif
00539 #endif
00540 
00541 #endif
00542 /* END */
00543 
00544 /* #line 236 "/usr/local/lib/bison.h" */
00545 #line 546 "sslparser.h"
00546 #endif

Generated on Tue Sep 19 21:18:33 2006 for Boomerang by  doxygen 1.4.6