515 lines
12 KiB
C++
515 lines
12 KiB
C++
#ifndef YY_CParse_h_included
|
|
#define YY_CParse_h_included
|
|
/* before anything */
|
|
#ifdef c_plusplus
|
|
#ifndef __cplusplus
|
|
#define __cplusplus
|
|
#endif
|
|
#endif
|
|
#ifdef __cplusplus
|
|
#ifndef YY_USE_CLASS
|
|
#define YY_USE_CLASS
|
|
#endif
|
|
#else
|
|
#endif
|
|
#include <stdio.h>
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "EdIRICLs.hpp"
|
|
|
|
struct stReturn
|
|
{
|
|
CString csInitial;
|
|
CString csType;
|
|
CString csSubType; //for array
|
|
CPA_EdIR_IntermediateCodeList clIntermediateCodeList;
|
|
};
|
|
|
|
/*********/
|
|
/* Enums */
|
|
/*********/
|
|
|
|
typedef enum tdeTypeText_
|
|
{
|
|
IntelligenceText,
|
|
ReflexText,
|
|
DsgVarText,
|
|
MacroText,
|
|
// BEGIN ROMTEAM CPA2 Cristi Petrescu 98-04-
|
|
// this is used for the new style of defining macros...
|
|
Macro_2_Text,
|
|
SubrText,
|
|
// END ROMTEAM CPA2 Cristi Petrescu 98-04-
|
|
CRRGeneration,
|
|
} tdeTypeText;
|
|
|
|
/*************/
|
|
/* Variables */
|
|
/*************/
|
|
|
|
class CParse;
|
|
class CLex;
|
|
class CPA_EdIR_DesignerVariableList;
|
|
class CPA_EdIR_MacroList;
|
|
// BEGIN CPA2 Cristi Petrescu 98-03-
|
|
class CPA_EdIR_MainBehaviourList;
|
|
// END CPA2 Cristi Petrescu 98-03-
|
|
class CPA_Actor;
|
|
|
|
extern CParse g_clParse;
|
|
extern CLex g_clLex;
|
|
extern CPA_EdIR_DesignerVariableList g_clDsgVarList;
|
|
extern CPA_EdIR_MacroList g_clMacroList;
|
|
// BEGIN CPA2 Cristi Petrescu 98-03-
|
|
extern CPA_EdIR_MainBehaviourList *g_pclListOfSubrs;
|
|
// END CPA2 Cristi Petrescu 98-03-
|
|
extern CPA_Actor *g_pclCurrentModel;
|
|
extern char gcGenerateOneRule ;
|
|
/*************/
|
|
/* Functions */
|
|
/*************/
|
|
|
|
//exports fn_bAnalysesText()
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-05-
|
|
BOOL fn_bAnalysesText(CString,tdeTypeText,long &,CPA_EdIR_IntermediateCodeList *, CString csBehaviourName);
|
|
//END ROMTEAM Cristi Petrescu 98-05-
|
|
|
|
//KeyWord
|
|
CString fn_csGetKeyWordParams(long);
|
|
CString fn_csGetKeyWordType(long);
|
|
|
|
//MetaAction
|
|
CString fn_csGetMetaActionParams(long);
|
|
|
|
//Condition
|
|
CString fn_csGetConditionParams(long);
|
|
BOOL fn_bIsConditionUsableWithUltraOperator(long);
|
|
|
|
//Designer Variable
|
|
#define C_NOT_A_DSG_VAR -1
|
|
void fn_vGetDesignerVariableType(stReturn *,long);
|
|
void fn_vGetDesignerVariableTypeFromEngineType(stReturn *,long);
|
|
void fn_vGetDesignerVariableTypeForThisModel(stReturn *,CPA_Actor *,long);
|
|
long fn_lIsADsgVarForThisModel(CPA_Actor *,CString);
|
|
void fn_vGetDesignerVariableTypeForThisPerso(stReturn *,long,long);
|
|
long fn_lIsADsgVarForThisPerso(long,CString);
|
|
|
|
//Field
|
|
CString fn_csGetFieldType(long);
|
|
|
|
//Type
|
|
BOOL fn_bIsTypeCompatible(CString,stReturn *,long,BOOL bIsOperator=FALSE);
|
|
#define C_NOT_COMPATIBLE -1
|
|
long fn_lIsTypeCompatibleForArithmOp(long lIndex,stReturn *st1,stReturn *st2=NULL);
|
|
BOOL fn_bIsTypeCompatibleForBinaryOp(long lIndex,stReturn *st1,stReturn *st2);
|
|
BOOL fn_bIsTypeCompatibleForInitialization(CString,stReturn *);
|
|
//Stefan Dumitrean 21-05-98
|
|
BOOL fn_bIsParmsCompatible(CString,stReturn *,CString,CString &);
|
|
//End Stefan Dumitrean 21-05-98
|
|
BOOL fn_bIsStringCompatible(CString,CString);
|
|
BOOL fn_bIsStringCompatibleForAffect(CString,CString);
|
|
|
|
//Function
|
|
CString fn_csGetFunctionParams(long);
|
|
CString fn_csGetFunctionType(long);
|
|
BOOL fn_bIsFunctionUsableWithUltraOperator(long);
|
|
|
|
//Procedure
|
|
CString fn_csGetProcedureParams(long);
|
|
BOOL fn_bIsProcedureUsableWithUltraOperator(long);
|
|
|
|
//Operator
|
|
CString fn_csGetOperatorParams(long);
|
|
CString fn_csGetOperatorType(long,CString csParm1="",CString csParm2="");
|
|
|
|
//Perso
|
|
long fn_lGetHandleOfPerso(stReturn *);
|
|
|
|
//BEGIN ROMTEAM Cristi Petrescu 98-06-
|
|
BOOL fn_bIsDsgVarQualifier(CString csQualifier);
|
|
//END ROMTEAM Cristi Petrescu 98-06-
|
|
#define YY_CParse_STYPE stReturn
|
|
#define YY_CParse_MEMBERS CString m_csMsgError; \
|
|
BOOL m_bNoError; \
|
|
long m_lIndexError; \
|
|
BOOL m_bIsInITRules; \
|
|
stReturn * m_pstMyStack; \
|
|
CPA_EdIR_IntermediateCodeList m_clIntermediateCodeList;
|
|
/* %{ and %header{ and %union, during decl */
|
|
#ifndef YY_CParse_COMPATIBILITY
|
|
#ifndef YY_USE_CLASS
|
|
#define YY_CParse_COMPATIBILITY 1
|
|
#else
|
|
#define YY_CParse_COMPATIBILITY 0
|
|
#endif
|
|
#endif
|
|
|
|
#if YY_CParse_COMPATIBILITY != 0
|
|
/* backward compatibility */
|
|
#ifdef YYLTYPE
|
|
#ifndef YY_CParse_LTYPE
|
|
#define YY_CParse_LTYPE YYLTYPE
|
|
/* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
|
|
/* use %define LTYPE */
|
|
#endif
|
|
#endif
|
|
#ifdef YYSTYPE
|
|
#ifndef YY_CParse_STYPE
|
|
#define YY_CParse_STYPE YYSTYPE
|
|
/* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
|
|
/* use %define STYPE */
|
|
#endif
|
|
#endif
|
|
#ifdef YYDEBUG
|
|
#ifndef YY_CParse_DEBUG
|
|
#define YY_CParse_DEBUG YYDEBUG
|
|
/* WARNING obsolete !!! user defined YYDEBUG not reported into generated header */
|
|
/* use %define DEBUG */
|
|
#endif
|
|
#endif
|
|
#ifdef YY_CParse_STYPE
|
|
#ifndef yystype
|
|
#define yystype YY_CParse_STYPE
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef YY_CParse_PURE
|
|
/* YY_CParse_PURE */
|
|
#endif
|
|
/* prefix */
|
|
#ifndef YY_CParse_DEBUG
|
|
#define YY_CParse_DEBUG 1
|
|
/* YY_CParse_DEBUG */
|
|
#endif
|
|
#ifndef YY_CParse_LSP_NEEDED
|
|
/* YY_CParse_LSP_NEEDED*/
|
|
#endif
|
|
/* DEFAULT LTYPE*/
|
|
#ifdef YY_CParse_LSP_NEEDED
|
|
#ifndef YY_CParse_LTYPE
|
|
typedef
|
|
struct yyltype
|
|
{
|
|
int timestamp;
|
|
int first_line;
|
|
int first_column;
|
|
int last_line;
|
|
int last_column;
|
|
char *text;
|
|
}
|
|
yyltype;
|
|
|
|
#define YY_CParse_LTYPE yyltype
|
|
#endif
|
|
#endif
|
|
/* DEFAULT STYPE*/
|
|
#ifndef YY_CParse_STYPE
|
|
#define YY_CParse_STYPE int
|
|
#endif
|
|
/* DEFAULT MISCELANEOUS */
|
|
#ifndef YY_CParse_PARSE
|
|
#define YY_CParse_PARSE yyparse
|
|
#endif
|
|
#ifndef YY_CParse_LEX
|
|
#define YY_CParse_LEX yylex
|
|
#endif
|
|
#ifndef YY_CParse_LVAL
|
|
#define YY_CParse_LVAL yylval
|
|
#endif
|
|
#ifndef YY_CParse_LLOC
|
|
#define YY_CParse_LLOC yylloc
|
|
#endif
|
|
#ifndef YY_CParse_CHAR
|
|
#define YY_CParse_CHAR yychar
|
|
#endif
|
|
#ifndef YY_CParse_NERRS
|
|
#define YY_CParse_NERRS yynerrs
|
|
#endif
|
|
#ifndef YY_CParse_DEBUG_FLAG
|
|
#define YY_CParse_DEBUG_FLAG yydebug
|
|
#endif
|
|
#ifndef YY_CParse_ERROR
|
|
#define YY_CParse_ERROR yyerror
|
|
#endif
|
|
|
|
#ifndef YY_CParse_PARSE_PARAM
|
|
#ifndef __STDC__
|
|
#ifndef __cplusplus
|
|
#ifndef YY_USE_CLASS
|
|
#define YY_CParse_PARSE_PARAM
|
|
#ifndef YY_CParse_PARSE_PARAM_DEF
|
|
#define YY_CParse_PARSE_PARAM_DEF
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#ifndef YY_CParse_PARSE_PARAM
|
|
#define YY_CParse_PARSE_PARAM void
|
|
#endif
|
|
#endif
|
|
|
|
/* TOKEN C */
|
|
#ifndef YY_USE_CLASS
|
|
|
|
#ifndef YY_CParse_PURE
|
|
extern YY_CParse_STYPE YY_CParse_LVAL;
|
|
#endif
|
|
|
|
#define STRING 258
|
|
#define TEXT 259
|
|
#define BOOLEAN 260
|
|
#define INT 261
|
|
#define REAL 262
|
|
#define PERSO 263
|
|
#define ZDD 264
|
|
#define ZDE 265
|
|
#define ZDM 266
|
|
#define ZDR 267
|
|
#define ACTION 268
|
|
#define WAYPOINT 269
|
|
#define CHANNEL 270
|
|
#define SURFACE 271
|
|
#define ENVIRONMENT 272
|
|
#define SECTOR 273
|
|
#define SUPEROBJECT 274
|
|
#define LIPSYNCHRO 275
|
|
#define OBJECTTABLE 276
|
|
#define FAMILY 277
|
|
#define MODEL 278
|
|
#define SOUNDEVENT 279
|
|
#define GAMEMATERIAL 280
|
|
#define LIGHT 281
|
|
#define CAPS 282
|
|
#define GRAPH 283
|
|
#define MYREFLEX 284
|
|
#define MYBEHAV 285
|
|
#define REFLEX 286
|
|
#define BEHAV 287
|
|
#define KEYBUTTON 288
|
|
#define PARTGEN 289
|
|
#define STATE 290
|
|
#define METAACTION 291
|
|
#define CONDITION 292
|
|
#define DESVAR 293
|
|
#define CONSTANTINT 294
|
|
#define CONSTANTREAL 295
|
|
#define DVTYPE 296
|
|
#define FUNCTION 297
|
|
#define PROCEDURE 298
|
|
#define FIELD 299
|
|
#define DVQUALIFIER 300
|
|
#define SUBRREF 301
|
|
#define OPWITH1PARM 302
|
|
#define OPWITH2PARMS 303
|
|
#define OPCOND 304
|
|
#define OPGETCOMPO 305
|
|
#define VECTOR 306
|
|
#define MASKTYPE 307
|
|
#define CONSTVECTOR 308
|
|
#define POWER 309
|
|
#define MACRO 310
|
|
#define BEGINMACRO 311
|
|
#define ENDMACRO 312
|
|
#define SCHEDULE 313
|
|
#define ITRULES 314
|
|
#define SUBROUTINE 315
|
|
#define IF 316
|
|
#define IF2 317
|
|
#define IF4 318
|
|
#define IF8 319
|
|
#define IF16 320
|
|
#define IFDEBUG 321
|
|
#define IFNOTU64 322
|
|
#define IFNOT 323
|
|
#define THEN 324
|
|
#define ELSE 325
|
|
#define ENDIF 326
|
|
#define ME 327
|
|
#define MAINACTOR 328
|
|
#define NOBODY 329
|
|
#define NOWHERE 330
|
|
#define NOCOMPORT 331
|
|
#define NOACTION 332
|
|
#define EMPTYTEXT 333
|
|
#define NOSUPEROBJECT 334
|
|
#define CAPSNULL 335
|
|
#define NOGRAPH 336
|
|
#define STOPENGINE 337
|
|
#define STOPRULE 338
|
|
#define NONSTOP 339
|
|
#define NOT 340
|
|
#define AND 341
|
|
#define OR 342
|
|
#define XOR 343
|
|
#define SYNTAXERROR 344
|
|
#define NEG 345
|
|
|
|
/* #defines token */
|
|
/* after #define tokens, before const tokens S5*/
|
|
#else
|
|
#ifndef YY_CParse_CLASS
|
|
#define YY_CParse_CLASS CParse
|
|
#endif
|
|
|
|
#ifndef YY_CParse_INHERIT
|
|
#define YY_CParse_INHERIT
|
|
#endif
|
|
#ifndef YY_CParse_MEMBERS
|
|
#define YY_CParse_MEMBERS
|
|
#endif
|
|
#ifndef YY_CParse_LEX_BODY
|
|
#define YY_CParse_LEX_BODY
|
|
#endif
|
|
#ifndef YY_CParse_ERROR_BODY
|
|
#define YY_CParse_ERROR_BODY
|
|
#endif
|
|
#ifndef YY_CParse_CONSTRUCTOR_PARAM
|
|
#define YY_CParse_CONSTRUCTOR_PARAM
|
|
#endif
|
|
|
|
class YY_CParse_CLASS YY_CParse_INHERIT
|
|
{
|
|
public: /* static const int token ... */
|
|
static const int STRING;
|
|
static const int TEXT;
|
|
static const int BOOLEAN;
|
|
static const int INT;
|
|
static const int REAL;
|
|
static const int PERSO;
|
|
static const int ZDD;
|
|
static const int ZDE;
|
|
static const int ZDM;
|
|
static const int ZDR;
|
|
static const int ACTION;
|
|
static const int WAYPOINT;
|
|
static const int CHANNEL;
|
|
static const int SURFACE;
|
|
static const int ENVIRONMENT;
|
|
static const int SECTOR;
|
|
static const int SUPEROBJECT;
|
|
static const int LIPSYNCHRO;
|
|
static const int OBJECTTABLE;
|
|
static const int FAMILY;
|
|
static const int MODEL;
|
|
static const int SOUNDEVENT;
|
|
static const int GAMEMATERIAL;
|
|
static const int LIGHT;
|
|
static const int CAPS;
|
|
static const int GRAPH;
|
|
static const int MYREFLEX;
|
|
static const int MYBEHAV;
|
|
static const int REFLEX;
|
|
static const int BEHAV;
|
|
static const int KEYBUTTON;
|
|
static const int PARTGEN;
|
|
static const int STATE;
|
|
static const int METAACTION;
|
|
static const int CONDITION;
|
|
static const int DESVAR;
|
|
static const int CONSTANTINT;
|
|
static const int CONSTANTREAL;
|
|
static const int DVTYPE;
|
|
static const int FUNCTION;
|
|
static const int PROCEDURE;
|
|
static const int FIELD;
|
|
static const int DVQUALIFIER;
|
|
static const int SUBRREF;
|
|
static const int OPWITH1PARM;
|
|
static const int OPWITH2PARMS;
|
|
static const int OPCOND;
|
|
static const int OPGETCOMPO;
|
|
static const int VECTOR;
|
|
static const int MASKTYPE;
|
|
static const int CONSTVECTOR;
|
|
static const int POWER;
|
|
static const int MACRO;
|
|
static const int BEGINMACRO;
|
|
static const int ENDMACRO;
|
|
static const int SCHEDULE;
|
|
static const int ITRULES;
|
|
static const int SUBROUTINE;
|
|
static const int IF;
|
|
static const int IF2;
|
|
static const int IF4;
|
|
static const int IF8;
|
|
static const int IF16;
|
|
static const int IFDEBUG;
|
|
static const int IFNOTU64;
|
|
static const int IFNOT;
|
|
static const int THEN;
|
|
static const int ELSE;
|
|
static const int ENDIF;
|
|
static const int ME;
|
|
static const int MAINACTOR;
|
|
static const int NOBODY;
|
|
static const int NOWHERE;
|
|
static const int NOCOMPORT;
|
|
static const int NOACTION;
|
|
static const int EMPTYTEXT;
|
|
static const int NOSUPEROBJECT;
|
|
static const int CAPSNULL;
|
|
static const int NOGRAPH;
|
|
static const int STOPENGINE;
|
|
static const int STOPRULE;
|
|
static const int NONSTOP;
|
|
static const int NOT;
|
|
static const int AND;
|
|
static const int OR;
|
|
static const int XOR;
|
|
static const int SYNTAXERROR;
|
|
static const int NEG;
|
|
|
|
/* decl const */
|
|
public:
|
|
int YY_CParse_PARSE(YY_CParse_PARSE_PARAM);
|
|
virtual void YY_CParse_ERROR(char *) YY_CParse_ERROR_BODY;
|
|
#ifdef YY_CParse_PURE
|
|
#ifdef YY_CParse_LSP_NEEDED
|
|
virtual int YY_CParse_LEX(YY_CParse_STYPE *YY_CParse_LVAL,YY_CParse_LTYPE *YY_CParse_LLOC) YY_CParse_LEX_BODY;
|
|
#else
|
|
virtual int YY_CParse_LEX(YY_CParse_STYPE *YY_CParse_LVAL) YY_CParse_LEX_BODY;
|
|
#endif
|
|
#else
|
|
virtual int YY_CParse_LEX() YY_CParse_LEX_BODY;
|
|
YY_CParse_STYPE YY_CParse_LVAL;
|
|
#ifdef YY_CParse_LSP_NEEDED
|
|
YY_CParse_LTYPE YY_CParse_LLOC;
|
|
#endif
|
|
int YY_CParse_NERRS;
|
|
int YY_CParse_CHAR;
|
|
#endif
|
|
#if YY_CParse_DEBUG != 0
|
|
public:
|
|
int YY_CParse_DEBUG_FLAG; /* nonzero means print parse trace */
|
|
#endif
|
|
public:
|
|
YY_CParse_CLASS(YY_CParse_CONSTRUCTOR_PARAM);
|
|
public:
|
|
YY_CParse_MEMBERS
|
|
};
|
|
/* other declare folow */
|
|
#endif
|
|
|
|
|
|
#if YY_CParse_COMPATIBILITY != 0
|
|
/* backward compatibility */
|
|
#ifndef YYSTYPE
|
|
#define YYSTYPE YY_CParse_STYPE
|
|
#endif
|
|
|
|
#ifndef YYLTYPE
|
|
#define YYLTYPE YY_CParse_LTYPE
|
|
#endif
|
|
#ifndef YYDEBUG
|
|
#ifdef YY_CParse_DEBUG
|
|
#define YYDEBUG YY_CParse_DEBUG
|
|
#endif
|
|
#endif
|
|
|
|
#endif
|
|
/* END */
|
|
#endif
|