diff --git a/SamTFE/Sources/Ecc/Parser.y b/SamTFE/Sources/Ecc/Parser.y index 3315f977..f672f0e0 100644 --- a/SamTFE/Sources/Ecc/Parser.y +++ b/SamTFE/Sources/Ecc/Parser.y @@ -1,1435 +1,1450 @@ -%{ -// rcg10042001 Changed to specify Ecc directory... -#include "Ecc/StdH.h" -#include "Ecc/Main.h" - -// turn off over-helpful bit of bison... --ryan. -#ifdef __GNUC__ -#define __attribute__(x) -#endif - -#define YYINITDEPTH 1000 - -static const char *_strCurrentClass; -static int _iCurrentClassID; -static const char *_strCurrentBase; -static const char *_strCurrentDescription; -static const char *_strCurrentThumbnail; -static const char *_strCurrentEnum; -static int _bClassIsExported = 0; - -static const char *_strCurrentPropertyID; -static const char *_strCurrentPropertyIdentifier; -static const char *_strCurrentPropertyPropertyType; -static const char *_strCurrentPropertyEnumType; -static const char *_strCurrentPropertyDataType; -static const char *_strCurrentPropertyName; -static const char *_strCurrentPropertyShortcut; -static const char *_strCurrentPropertyColor; -static const char *_strCurrentPropertyFlags; -static const char *_strCurrentPropertyDefaultCode; - -static const char *_strCurrentComponentIdentifier; -static const char *_strCurrentComponentType; -static const char *_strCurrentComponentID; -static const char *_strCurrentComponentFileName; - -static int _ctInProcedureHandler = 0; -static char _strLastProcedureName[256]; - -static char _strInWaitName[256]; -static char _strAfterWaitName[256]; -static char _strInWaitID[256]; -static char _strAfterWaitID[256]; - -static char _strInLoopName[256]; -static char _strAfterLoopName[256]; -static char _strInLoopID[256]; -static char _strAfterLoopID[256]; -static char _strCurrentStateID[256]; - -static int _bInProcedure; // set if currently compiling a procedure -static int _bInHandler; -static int _bHasOtherwise; // set if current 'wait' block has an 'otherwise' statement - -static const char *_strCurrentEvent; -static int _bFeature_AbstractBaseClass; -static int _bFeature_ImplementsOnInitClass; -static int _bFeature_ImplementsOnEndClass; -static int _bFeature_ImplementsOnPrecache; -static int _bFeature_ImplementsOnWorldInit; -static int _bFeature_ImplementsOnWorldEnd; -static int _bFeature_ImplementsOnWorldTick; -static int _bFeature_ImplementsOnWorldRender; -static int _bFeature_CanBePredictable; - -static int _iNextFreeID; -inline int CreateID(void) { - return _iNextFreeID++; -} - -static int _ctBraces = 0; -void OpenBrace(void) { - _ctBraces++; -} -void CloseBrace(void) { - _ctBraces--; -} -SType Braces(int iBraces) { - static char strBraces[50]; - memset(strBraces, '}', sizeof(strBraces)); - strBraces[iBraces] = 0; - return SType(strBraces); -} -char *RemoveLineDirective(char *str) -{ - if (str[0]=='\n' && str[1]=='#') { - return strchr(str+2, '\n')+1; - } else { - return str; - } -} -const char *GetLineDirective(SType &st) -{ - char *str = st.strString; - if (str[0]=='\n' && str[1]=='#' && str[2]=='l') { - char *strResult = strdup(str); - strchr(strResult+3,'\n')[1] = 0; - return strResult; - } else { - return ""; - } -} -void AddHandlerFunction(char *strProcedureName, int iStateID) -{ - fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); - fprintf(_fTables, " {0x%08x, -1, CEntity::pEventHandler(&%s::%s), " - "DEBUGSTRING(\"%s::%s\")},\n", - iStateID, _strCurrentClass, strProcedureName, _strCurrentClass, strProcedureName); -} - - -void AddHandlerFunction(char *strProcedureName, char *strStateID, char *strBaseStateID) -{ - fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); - fprintf(_fTables, " {%s, %s, CEntity::pEventHandler(&%s::%s)," - "DEBUGSTRING(\"%s::%s\")},\n", - strStateID, strBaseStateID, _strCurrentClass, strProcedureName, - _strCurrentClass, RemoveLineDirective(strProcedureName)); - strcpy(_strLastProcedureName, RemoveLineDirective(strProcedureName)); - _ctInProcedureHandler = 0; -} - -void CreateInternalHandlerFunction(char *strFunctionName, char *strID) -{ - int iID = CreateID(); - _ctInProcedureHandler++; - sprintf(strID, "0x%08x", iID); - sprintf(strFunctionName, "H0x%08x_%s_%02d", iID, _strLastProcedureName, _ctInProcedureHandler); - AddHandlerFunction(strFunctionName, iID); -} - -void DeclareFeatureProperties(void) -{ - if (_bFeature_CanBePredictable) { - fprintf(_fTables, " CEntityProperty(CEntityProperty::EPT_ENTITYPTR, NULL, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", - _iCurrentClassID, - "255", - _strCurrentClass, - "m_penPrediction", - "\"\"", - "0", - "0", - "0"); - fprintf(_fDeclaration, " %s %s;\n", - "CEntityPointer", - "m_penPrediction" - ); - fprintf(_fImplementation, " m_penPrediction = NULL;\n"); - } -} - -#define YYERROR_VERBOSE 1 - -%} - -/* BISON Declarations */ - -/* different type of constants */ -%token c_char -%token c_int -%token c_float -%token c_bool -%token c_string - -/* the standard cpp identifier */ -%token identifier - -/* specially bracketed cpp blocks */ -%token cppblock - -/* standard cpp-keywords */ -%token k_while -%token k_for -%token k_if -%token k_else -%token k_enum -%token k_switch -%token k_case -%token k_class -%token k_do -%token k_void -%token k_const -%token k_inline -%token k_static -%token k_virtual -%token k_return -%token k_autowait -%token k_autocall -%token k_waitevent - -/* aditional keywords */ -%token k_event -%token k_name -%token k_thumbnail -%token k_features -%token k_uses -%token k_export - -%token k_texture -%token k_sound -%token k_model - -%token k_properties -%token k_components -%token k_functions -%token k_procedures - -%token k_wait -%token k_on -%token k_otherwise - -%token k_call -%token k_jump -%token k_stop -%token k_resume -%token k_pass - -/* special data types */ -%token k_CTString -%token k_CTStringTrans -%token k_CTFileName -%token k_CTFileNameNoDep -%token k_BOOL -%token k_COLOR -%token k_FLOAT -%token k_INDEX -%token k_RANGE -%token k_CEntityPointer -%token k_CModelObject -%token k_CModelInstance -%token k_CAnimObject -%token k_CSoundObject -%token k_CPlacement3D -%token k_FLOATaabbox3D -%token k_FLOATmatrix3D -%token k_FLOATquat3D -%token k_ANGLE -%token k_FLOAT3D -%token k_ANGLE3D -%token k_FLOATplane3D -%token k_ANIMATION -%token k_ILLUMINATIONTYPE -%token k_FLAGS - -%start program - -%% - -/*///////////////////////////////////////////////////////// - * Global structure of the source file. - */ -program - : /* empty file */ {} - | c_int { - int iID = atoi($1.strString); - if(iID>32767) { - yyerror("Maximum allowed id for entity source file is 32767"); - } - _iCurrentClassID = iID; - _iNextFreeID = iID<<16; - fprintf(_fDeclaration, "#ifndef _%s_INCLUDED\n", _strFileNameBaseIdentifier); - fprintf(_fDeclaration, "#define _%s_INCLUDED 1\n", _strFileNameBaseIdentifier); - - } opt_global_cppblock { - - //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllimport)\n"); - } uses_list { - //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllexport)\n"); - - fprintf(_fImplementation, "#include <%s.h>\n", _strFileNameBase); - fprintf(_fImplementation, "#include <%s_tables.h>\n", _strFileNameBase); - } enum_and_event_declarations_list { - } opt_global_cppblock { - } opt_class_declaration { - fprintf(_fDeclaration, "#endif // _%s_INCLUDED\n", _strFileNameBaseIdentifier); - } - ; - - -/* - * Prolog cpp code. - */ -opt_global_cppblock - : /* null */ - | cppblock { fprintf(_fImplementation, "%s\n", $1.strString); } - ; - -uses_list - : /* null */ - | uses_list uses_statement - ; -uses_statement - : k_uses c_string ';' { - char *strUsedFileName = strdup($2.strString); - strUsedFileName[strlen(strUsedFileName)-1] = 0; - fprintf(_fDeclaration, "#include <%s.h>\n", strUsedFileName+1); - } - ; - - -enum_and_event_declarations_list - : /* null */ - | enum_and_event_declarations_list enum_declaration - | enum_and_event_declarations_list event_declaration - ; -/*///////////////////////////////////////////////////////// - * Enum types declarations - */ -enum_declaration - : k_enum identifier { - _strCurrentEnum = $2.strString; - fprintf(_fTables, "EP_ENUMBEG(%s)\n", _strCurrentEnum ); - fprintf(_fDeclaration, "extern DECL_DLL CEntityPropertyEnumType %s_enum;\n", _strCurrentEnum ); - fprintf(_fDeclaration, "enum %s {\n", _strCurrentEnum ); - } '{' enum_values_list opt_comma '}' ';' { - fprintf(_fTables, "EP_ENUMEND(%s);\n\n", _strCurrentEnum); - fprintf(_fDeclaration, "};\n"); - fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = (%s)0; } ;\n", _strCurrentEnum, _strCurrentEnum); - } - ; -opt_comma : /*null*/ | ','; -enum_values_list - : enum_value - | enum_values_list ',' enum_value - ; - -enum_value - : c_int identifier c_string { - fprintf(_fTables, " EP_ENUMVALUE(%s, %s),\n", $2.strString, $3.strString); - fprintf(_fDeclaration, " %s = %s,\n", $2.strString, $1.strString); - } - ; - -/*///////////////////////////////////////////////////////// - * Event declarations - */ -event_declaration - : k_event identifier { - _strCurrentEvent = $2.strString; - int iID = CreateID(); - fprintf(_fDeclaration, "#define EVENTCODE_%s 0x%08x\n", _strCurrentEvent, iID); - fprintf(_fDeclaration, "class DECL_DLL %s : public CEntityEvent {\npublic:\n", - _strCurrentEvent); - fprintf(_fDeclaration, "%s();\n", _strCurrentEvent ); - fprintf(_fDeclaration, "CEntityEvent *MakeCopy(void);\n"); - fprintf(_fImplementation, - "CEntityEvent *%s::MakeCopy(void) { " - "CEntityEvent *peeCopy = new %s(*this); " - "return peeCopy;}\n", - _strCurrentEvent, _strCurrentEvent); - fprintf(_fImplementation, "%s::%s() : CEntityEvent(EVENTCODE_%s) {;\n", - _strCurrentEvent, _strCurrentEvent, _strCurrentEvent); - } '{' event_members_list opt_comma '}' ';' { - fprintf(_fImplementation, "};\n"); - fprintf(_fDeclaration, "};\n"); - fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = %s(); } ;\n", _strCurrentEvent, _strCurrentEvent); - } - ; - -event_members_list - : /* null */ - | non_empty_event_members_list - ; - -non_empty_event_members_list - : event_member - | event_members_list ',' event_member - ; - -event_member - : any_type identifier { - fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); - fprintf(_fImplementation, " ClearToDefault(%s);\n", $2.strString); - } - ; - -/*///////////////////////////////////////////////////////// - * The class declaration structure. - */ -opt_class_declaration - : /* null */ - | class_declaration - ; - -class_declaration - : /* null */ - | class_optexport identifier ':' identifier '{' - k_name c_string ';' - k_thumbnail c_string ';' { - _strCurrentClass = $2.strString; - _strCurrentBase = $4.strString; - _strCurrentDescription = $7.strString; - _strCurrentThumbnail = $10.strString; - - fprintf(_fTables, "#define ENTITYCLASS %s\n\n", _strCurrentClass); - fprintf(_fDeclaration, "extern \"C\" DECL_DLL CDLLEntityClass %s_DLLClass;\n", - _strCurrentClass); - fprintf(_fDeclaration, "%s %s : public %s {\npublic:\n", - $1.strString, _strCurrentClass, _strCurrentBase); - - } opt_features { - fprintf(_fDeclaration, " %s virtual void SetDefaultProperties(void);\n", _bClassIsExported?"":"DECL_DLL"); - fprintf(_fImplementation, "void %s::SetDefaultProperties(void) {\n", _strCurrentClass); - fprintf(_fTables, "CEntityProperty %s_properties[] = {\n", _strCurrentClass); - - } k_properties ':' property_declaration_list { - fprintf(_fImplementation, " %s::SetDefaultProperties();\n}\n", _strCurrentBase); - - fprintf(_fTables, "CEntityComponent %s_components[] = {\n", _strCurrentClass); - } opt_internal_properties { - } k_components ':' component_declaration_list { - _bTrackLineInformation = 1; - fprintf(_fTables, "CEventHandlerEntry %s_handlers[] = {\n", _strCurrentClass); - - _bInProcedure = 0; - _bInHandler = 0; - } k_functions ':' function_list { - - _bInProcedure = 1; - } k_procedures ':' procedure_list { - } '}' ';' { - fprintf(_fTables, "};\n#define %s_handlersct ARRAYCOUNT(%s_handlers)\n", - _strCurrentClass, _strCurrentClass); - fprintf(_fTables, "\n"); - - if (_bFeature_AbstractBaseClass) { - fprintf(_fTables, "CEntity *%s_New(void) { return NULL; };\n", - _strCurrentClass); - } else { - fprintf(_fTables, "CEntity *%s_New(void) { return new %s; };\n", - _strCurrentClass, _strCurrentClass); - } - - if (!_bFeature_ImplementsOnInitClass) { - fprintf(_fTables, "void %s_OnInitClass(void) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnInitClass(void);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnEndClass) { - fprintf(_fTables, "void %s_OnEndClass(void) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnEndClass(void);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnPrecache) { - fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldEnd) { - fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldInit) { - fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldTick) { - fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldRender) { - fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo);\n", _strCurrentClass); - } - - fprintf(_fTables, "ENTITY_CLASSDEFINITION(%s, %s, %s, %s, 0x%08x);\n", - _strCurrentClass, _strCurrentBase, - _strCurrentDescription, _strCurrentThumbnail, _iCurrentClassID); - fprintf(_fTables, "DECLARE_CTFILENAME(_fnm%s_tbn, %s);\n", _strCurrentClass, _strCurrentThumbnail); - - fprintf(_fDeclaration, "};\n"); - } - ; - -class_optexport - : k_class { $$ = $1; _bClassIsExported = 0; } - | k_class k_export { $$ = $1+" DECL_DLL "; _bClassIsExported = 1; } - ; - -opt_features - : /*null */ - | k_features { - _bFeature_ImplementsOnWorldInit = 0; - _bFeature_ImplementsOnWorldEnd = 0; - _bFeature_ImplementsOnWorldTick = 0; - _bFeature_ImplementsOnWorldRender = 0; - _bFeature_ImplementsOnInitClass = 0; - _bFeature_ImplementsOnEndClass = 0; - _bFeature_ImplementsOnPrecache = 0; - _bFeature_AbstractBaseClass = 0; - _bFeature_CanBePredictable = 0; - }features_list ';' - ; -features_list - : feature - | features_list ',' feature - ; -feature - : c_string { - if (strcmp($1.strString, "\"AbstractBaseClass\"")==0) { - _bFeature_AbstractBaseClass = 1; - } else if (strcmp($1.strString, "\"IsTargetable\"")==0) { - fprintf(_fDeclaration, "virtual BOOL IsTargetable(void) const { return TRUE; };\n"); - } else if (strcmp($1.strString, "\"IsImportant\"")==0) { - fprintf(_fDeclaration, "virtual BOOL IsImportant(void) const { return TRUE; };\n"); - } else if (strcmp($1.strString, "\"HasName\"")==0) { - fprintf(_fDeclaration, - "virtual const CTString &GetName(void) const { return m_strName; };\n"); - } else if (strcmp($1.strString, "\"CanBePredictable\"")==0) { - fprintf(_fDeclaration, - "virtual CEntity *GetPredictionPair(void) { return m_penPrediction; };\n"); - fprintf(_fDeclaration, - "virtual void SetPredictionPair(CEntity *penPair) { m_penPrediction = penPair; };\n"); - _bFeature_CanBePredictable = 1; - } else if (strcmp($1.strString, "\"HasDescription\"")==0) { - fprintf(_fDeclaration, - "virtual const CTString &GetDescription(void) const { return m_strDescription; };\n"); - } else if (strcmp($1.strString, "\"HasTarget\"")==0) { - fprintf(_fDeclaration, - "virtual CEntity *GetTarget(void) const { return m_penTarget; };\n"); - } else if (strcmp($1.strString, "\"ImplementsOnInitClass\"")==0) { - _bFeature_ImplementsOnInitClass = 1; - } else if (strcmp($1.strString, "\"ImplementsOnEndClass\"")==0) { - _bFeature_ImplementsOnEndClass = 1; - } else if (strcmp($1.strString, "\"ImplementsOnPrecache\"")==0) { - _bFeature_ImplementsOnPrecache = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldInit\"")==0) { - _bFeature_ImplementsOnWorldInit = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldEnd\"")==0) { - _bFeature_ImplementsOnWorldEnd = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldTick\"")==0) { - _bFeature_ImplementsOnWorldTick = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldRender\"")==0) { - _bFeature_ImplementsOnWorldRender = 1; - } else { - yyerror((SType("Unknown feature: ")+$1).strString); - } - } - ; - -opt_internal_properties - : /* null */ - | '{' internal_property_list '}' - ; -internal_property_list - : /* null */ - | internal_property_list internal_property - ; -internal_property - : any_type identifier ';' { - fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); - } - ; - -/*///////////////////////////////////////////////////////// - * Property declarations - */ - -property_declaration_list - : empty_property_declaration_list { - DeclareFeatureProperties(); // this won't work, but at least it will generate an error!!!! - fprintf(_fTables, " CEntityProperty()\n};\n"); - fprintf(_fTables, "#define %s_propertiesct 0\n", _strCurrentClass); - fprintf(_fTables, "\n"); - fprintf(_fTables, "\n"); - } - | nonempty_property_declaration_list opt_comma { - DeclareFeatureProperties(); - fprintf(_fTables, "};\n"); - fprintf(_fTables, "#define %s_propertiesct ARRAYCOUNT(%s_properties)\n", - _strCurrentClass, _strCurrentClass); - fprintf(_fTables, "\n"); - } - ; -nonempty_property_declaration_list - : property_declaration - | nonempty_property_declaration_list ',' property_declaration - ; -empty_property_declaration_list - : /* null */ - ; - -property_declaration - : property_id property_type property_identifier property_wed_name_opt property_default_opt property_flags_opt { - fprintf(_fTables, " CEntityProperty(%s, %s, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", - _strCurrentPropertyPropertyType, - _strCurrentPropertyEnumType, - _iCurrentClassID, - _strCurrentPropertyID, - _strCurrentClass, - _strCurrentPropertyIdentifier, - _strCurrentPropertyName, - _strCurrentPropertyShortcut, - _strCurrentPropertyColor, - _strCurrentPropertyFlags); - fprintf(_fDeclaration, " %s %s;\n", - _strCurrentPropertyDataType, - _strCurrentPropertyIdentifier - ); - - if (strlen(_strCurrentPropertyDefaultCode)>0) { - fprintf(_fImplementation, " %s\n", _strCurrentPropertyDefaultCode); - } - } - ; - -property_id : c_int { _strCurrentPropertyID = $1.strString; }; -property_identifier : identifier { _strCurrentPropertyIdentifier = $1.strString; }; - -property_type - : k_enum identifier { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENUM"; - _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; - _strCurrentPropertyDataType = (SType("enum ")+$2.strString).strString; - } - | k_FLAGS identifier { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLAGS"; - _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; - _strCurrentPropertyDataType = "ULONG"; - } - | k_CTString { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRING"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTString"; - } - | k_CTStringTrans { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRINGTRANS"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTStringTrans"; - } - | k_CTFileName { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAME"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTFileName"; - } - | k_CTFileNameNoDep { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAMENODEP"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTFileNameNoDep"; - } - | k_BOOL { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_BOOL"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "BOOL"; - } - | k_COLOR { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_COLOR"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "COLOR"; - } - | k_FLOAT { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOAT"; - } - | k_INDEX { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_INDEX"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "INDEX"; - } - | k_RANGE { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_RANGE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "RANGE"; - } - | k_CEntityPointer { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENTITYPTR"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CEntityPointer"; - } - | k_CModelObject { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELOBJECT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CModelObject"; - } - | k_CModelInstance { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELINSTANCE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CModelInstance"; - } - | k_CAnimObject { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMOBJECT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CAnimObject"; - } - | k_CSoundObject { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_SOUNDOBJECT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CSoundObject"; - } - | k_CPlacement3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_PLACEMENT3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CPlacement3D"; - } - | k_FLOATaabbox3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATAABBOX3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATaabbox3D"; - } - | k_FLOATmatrix3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATMATRIX3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATmatrix3D"; - } - | k_FLOATquat3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATQUAT3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATquat3D"; - } - | k_ANGLE { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ANGLE"; - } - | k_ANGLE3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ANGLE3D"; - } - | k_FLOAT3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOAT3D"; - } - | k_FLOATplane3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATplane3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATplane3D"; - } - | k_ILLUMINATIONTYPE { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ILLUMINATIONTYPE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ILLUMINATIONTYPE"; - } - | k_ANIMATION { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMATION"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ANIMATION"; - } - ; - -property_wed_name_opt - : /* null */ { - _strCurrentPropertyName = "\"\""; - _strCurrentPropertyShortcut = "0"; - _strCurrentPropertyColor = "0"; // this won't be rendered anyway - } - | c_string property_shortcut_opt property_color_opt { - _strCurrentPropertyName = $1.strString; - } - ; -property_shortcut_opt - : /* null */ { - _strCurrentPropertyShortcut = "0"; - } - | c_char { - _strCurrentPropertyShortcut = $1.strString; - } - -property_color_opt - : /* null */ { - _strCurrentPropertyColor = "0x7F0000FFUL"; // dark red - } - | k_COLOR '(' expression ')' { - _strCurrentPropertyColor = $3.strString; - } -property_flags_opt - : /* null */ { - _strCurrentPropertyFlags = "0"; // dark red - } - | k_features '(' expression ')' { - _strCurrentPropertyFlags = $3.strString; - } - -property_default_opt - : /* null */ { - if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { - _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = NULL;").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CModelObject")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n"+ - _strCurrentPropertyIdentifier+".mo_toTexture.SetData(NULL);").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CModelInstance")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".Clear();\n").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CAnimObject")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CSoundObject")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".SetOwner(this);\n"+ - _strCurrentPropertyIdentifier+".Stop_internal();").strString; - } else { - yyerror("this kind of property must have default value"); - _strCurrentPropertyDefaultCode = ""; - } - } - | '=' property_default_expression { - if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { - yyerror("CEntityPointer type properties always default to NULL"); - } else { - _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = "+$2.strString+";").strString; - } - } - ; -property_default_expression - : c_int|c_float|c_bool|c_char|c_string - | identifier {$$ = $1 + " ";} - | identifier '(' expression ')' {$$ = $1+$2+$3+$4;} - | type_keyword '(' expression ')' {$$ = $1+$2+$3+$4;} - | '-' property_default_expression {$$ = $1+$2;} - | '(' expression ')' {$$ = $1+$2+$3;} - ; - -/*///////////////////////////////////////////////////////// - * Component declarations - */ -component_declaration_list - : empty_component_declaration_list { - fprintf(_fTables, " CEntityComponent()\n};\n"); - fprintf(_fTables, "#define %s_componentsct 0\n", _strCurrentClass); - fprintf(_fTables, "\n"); - fprintf(_fTables, "\n"); - } - | nonempty_component_declaration_list opt_comma { - fprintf(_fTables, "};\n"); - fprintf(_fTables, "#define %s_componentsct ARRAYCOUNT(%s_components)\n", - _strCurrentClass, _strCurrentClass); - fprintf(_fTables, "\n"); - } - ; -nonempty_component_declaration_list - : component_declaration - | nonempty_component_declaration_list ',' component_declaration - ; -empty_component_declaration_list - : /* null */ - ; - -component_declaration - : component_id component_type component_identifier component_filename { - fprintf(_fTables, "#define %s ((0x%08x<<8)+%s)\n", - _strCurrentComponentIdentifier, - _iCurrentClassID, - _strCurrentComponentID); - fprintf(_fTables, " CEntityComponent(%s, %s, \"%s%s\" %s),\n", - _strCurrentComponentType, - _strCurrentComponentIdentifier, - "EF","NM", - _strCurrentComponentFileName); - } - ; - -component_id : c_int { _strCurrentComponentID = $1.strString; }; -component_identifier : identifier { _strCurrentComponentIdentifier = $1.strString; }; -component_filename : c_string { _strCurrentComponentFileName = $1.strString; }; - -component_type - : k_model { _strCurrentComponentType = "ECT_MODEL"; } - | k_texture { _strCurrentComponentType = "ECT_TEXTURE"; } - | k_sound { _strCurrentComponentType = "ECT_SOUND"; } - | k_class { _strCurrentComponentType = "ECT_CLASS"; } - ; - -/*///////////////////////////////////////////////////////// - * Functions - */ -function_list - : { $$ = "";} - | function_list function_implementation {$$ = $1+$2;} - ; - -function_implementation - : opt_export opt_virtual return_type opt_tilde identifier '(' parameters_list ')' opt_const - '{' statements '}' opt_semicolon { - const char *strReturnType = $3.strString; - const char *strFunctionHeader = ($4+$5+$6+$7+$8+$9).strString; - const char *strFunctionBody = ($10+$11+$12).strString; - if (strcmp($5.strString, _strCurrentClass)==0) { - if (strcmp(strReturnType+strlen(strReturnType)-4, "void")==0 ) { - strReturnType = ""; - } else { - yyerror("use 'void' as return type for constructors"); - } - } - fprintf(_fDeclaration, " %s %s %s %s;\n", - $1.strString, $2.strString, strReturnType, strFunctionHeader); - fprintf(_fImplementation, " %s %s::%s %s\n", - strReturnType, _strCurrentClass, strFunctionHeader, strFunctionBody); - } - ; -opt_tilde - : { $$ = "";} - | '~' { $$ = " ~ "; } - ; - -opt_export - : { $$ = "";} - | k_export { - if (_bClassIsExported) { - $$ = ""; - } else { - $$ = " DECL_DLL "; - } - } - ; - -opt_const - : { $$ = "";} - | k_const { $$ = $1; } - ; -opt_virtual - : { $$ = "";} - | k_virtual { $$ = $1; } - ; -opt_semicolon - : /* null */ - | ';' - ; -parameters_list - : { $$ = "";} - | k_void - | non_void_parameters_list - ; -non_void_parameters_list - : parameter_declaration - | non_void_parameters_list ',' parameter_declaration {$$ = $1+$2+$3;} - ; -parameter_declaration - : any_type identifier { $$=$1+" "+$2; } - ; - -return_type - : any_type - | k_void - ; - -any_type - : type_keyword - | identifier - | k_enum identifier { $$=$1+" "+$2; } - | any_type '*' { $$=$1+" "+$2; } - | any_type '&' { $$=$1+" "+$2; } - | k_void '*' { $$=$1+" "+$2; } - | k_const any_type { $$=$1+" "+$2; } - | k_inline any_type { $$=$1+" "+$2; } - | k_static any_type { $$=$1+" "+$2; } - | k_class any_type { $$=$1+" "+$2; } - | identifier '<' any_type '>' { $$=$1+" "+$2+" "+$3+" "+$4; } - ; - - -/*///////////////////////////////////////////////////////// - * Procedures - */ -procedure_list - : { $$ = "";} - | procedure_list procedure_implementation {$$ = $1+$2;} - ; - -opt_override - : { $$ = "-1"; } - | ':' identifier ':' ':' identifier { - $$ = SType("STATE_")+$2+"_"+$5; - } - ; - -procedure_implementation - : identifier '(' event_specification ')' opt_override { - char *strProcedureName = $1.strString; - char strInputEventType[80]; - char strInputEventName[80]; - sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); - - char strStateID[256]; - const char *strBaseStateID = "-1"; - if(strcmp(RemoveLineDirective(strProcedureName), "Main")==0){ - strcpy(strStateID, "1"); - if(strncmp(strInputEventType, "EVoid", 4)!=0 && _strCurrentThumbnail[2]!=0) { - yyerror("procedure 'Main' can take input parameters only in classes without thumbnails"); - } - } else { - sprintf(strStateID, "0x%08x", CreateID()); - } - - sprintf(_strCurrentStateID, "STATE_%s_%s", - _strCurrentClass, RemoveLineDirective(strProcedureName)); - fprintf(_fDeclaration, "#define %s %s\n", _strCurrentStateID, strStateID); - AddHandlerFunction(strProcedureName, strStateID, $5.strString); - fprintf(_fImplementation, - "BOOL %s::%s(const CEntityEvent &__eeInput) {\n#undef STATE_CURRENT\n#define STATE_CURRENT %s\n", - _strCurrentClass, strProcedureName, _strCurrentStateID); - fprintf(_fImplementation, - " ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_%s, \"%s::%s expects '%s' as input!\");", - strInputEventType, _strCurrentClass, RemoveLineDirective(strProcedureName), - strInputEventType); - fprintf(_fImplementation, " const %s &%s = (const %s &)__eeInput;", - strInputEventType, strInputEventName, strInputEventType); - - } '{' statements '}' opt_semicolon { - char *strFunctionBody = $8.strString; - fprintf(_fImplementation, "%s ASSERT(FALSE); return TRUE;};", strFunctionBody); - } - ; - -event_specification - : { - $$="EVoid e"; - } - | identifier { - $$=$1+" e"; - } - | identifier identifier { - $$=$1+" "+$2; - } - ; - -expression - : c_int|c_float|c_bool|c_char|c_string - | identifier {$$ = $1 + " ";} - | type_keyword - | '='|'+'|'-'|'<'|'>'|'!'|'|'|'&'|'*'|'/'|'%'|'^'|'['|']'|':'|','|'.'|'?'|'~' - | '(' ')' {$$=$1+$2;} - | '+' '+' {$$=$1+$2;} - | '-' '-' {$$=$1+$2;} - | '-' '>' {$$=$1+$2;} - | ':' ':' {$$=$1+$2;} - | '&' '&' {$$=$1+$2;} - | '|' '|' {$$=$1+$2;} - | '^' '^' {$$=$1+$2;} - | '>' '>' {$$=$1+$2;} - | '<' '<' {$$=$1+$2;} - | '=' '=' {$$=$1+$2;} - | '!' '=' {$$=$1+$2;} - | '>' '=' {$$=$1+$2;} - | '<' '=' {$$=$1+$2;} - | '&' '=' {$$=$1+$2;} - | '|' '=' {$$=$1+$2;} - | '^' '=' {$$=$1+$2;} - | '+' '=' {$$=$1+$2;} - | '-' '=' {$$=$1+$2;} - | '/' '=' {$$=$1+$2;} - | '%' '=' {$$=$1+$2;} - | '*' '=' {$$=$1+$2;} - | '>' '>' '=' {$$=$1+$2+$3;} - | '<' '<' '=' {$$=$1+$2+$3;} - | '(' expression ')' {$$ = $1+$2+$3;} - | expression expression {$$ = $1+" "+$2;} - ; -type_keyword - : k_CTString|k_CTStringTrans|k_CTFileName|k_CTFileNameNoDep - | k_BOOL|k_COLOR|k_FLOAT|k_INDEX|k_RANGE - | k_CEntityPointer|k_CModelObject|k_CModelInstance|k_CAnimObject|k_CSoundObject - | k_CPlacement3D | k_FLOATaabbox3D|k_FLOATmatrix3D| k_FLOATquat3D|k_ANGLE|k_ANIMATION|k_ILLUMINATIONTYPE - | k_ANGLE3D|k_FLOAT3D|k_FLOATplane3D - | k_const - | k_static - ; -case_constant_expression - : c_int|c_float|c_bool|c_char|c_string - | identifier {$$ = $1 + " ";} - ; - - -/* Simple statements: - */ -statements - : { $$ = "";} - | statements statement { $$ = $1+$2; } - ; -statement - : expression ';' {$$=$1+$2;} - | k_switch '(' expression ')' '{' statements '}' {$$=$1+$2+$3+$4+$5+$6+$7;} - | k_case case_constant_expression ':' {$$=$1+" "+$2+$3+" ";} - | '{' statements '}' {$$=$1+$2+$3;} - | expression '{' statements '}' {$$=$1+$2+$3+$4;} - | statement_while - | statement_dowhile - | statement_for - | statement_if - | statement_if_else - | statement_wait - | statement_autowait - | statement_waitevent - | statement_call - | statement_autocall - | statement_stop - | statement_resume - | statement_pass - | statement_return - | statement_jump - | ';' - ; - - -statement_if - : k_if '(' expression ')' '{' statements '}' { - if ($6.bCrossesStates) { - char strAfterIfName[80], strAfterIfID[11]; - CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); - $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+$6+ - "Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; - } else { - $$ = $1+$2+$3+$4+$5+$6+$7; - } - } - ; - -statement_if_else - : k_if '(' expression ')' '{' statements '}' k_else statement { - if ($6.bCrossesStates || $9.bCrossesStates) { - char strAfterIfName[80], strAfterIfID[11]; - char strElseName[80], strElseID[11]; - CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); - CreateInternalHandlerFunction(strElseName, strElseID); - $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strElseID+", FALSE, EInternal());return TRUE;}"+ - $6+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+strElseName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strElseID+"\n"+ - $9+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}\n"+ - "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; - } else { - $$ = $1+$2+$3+$4+$5+$6+$7+$8+" "+$9; - } - } - ; - -statement_while - : k_while '(' expression ')' { - if (strlen(_strInLoopName)>0) { - yyerror("Nested loops are not implemented yet"); - } - } '{' statements '}' { - if ($7.bCrossesStates) { - CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); - CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); - $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$6+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+ - "if(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ - $7+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$8+ - "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; - } else { - $$ = $1+$2+$3+$4+$6+$7+$8; - } - _strInLoopName[0] = 0; - } - ; - -statement_dowhile - : k_do '{' statements '}' { - if (strlen(_strInLoopName)>0) { - yyerror("Nested loops are not implemented yet"); - } - _strInLoopName[0] = 0; - } k_while '(' expression ')' ';' { - if ($3.bCrossesStates) { - CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); - CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); - $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$2+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+$3+ - "if(!"+$7+$8+$9+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ - "Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$4+ - "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; - } else { - $$ = $1+$2+$3+$4+$6+$7+$8+$9+$10; - } - _strInLoopName[0] = 0; - } - ; - -statement_for - : k_for '(' expression ';' expression ';' expression ')' { - if (strlen(_strInLoopName)>0) { - yyerror("Nested loops are not implemented yet"); - } - } '{' statements '}' { - if ($11.bCrossesStates) { - CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); - CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); - yyerror("For loops across states are not supported"); - } else { - $$ = $1+$2+$3+$4+$5+$6+$7+$8+$10+$11+$12; - } - _strInLoopName[0] = 0; - } - ; - -statement_wait - : k_wait wait_expression { - if (!_bInProcedure) { - yyerror("Cannot have 'wait' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - _bInHandler = 1; - } '{' handlers_list '}' { - if ($5.bCrossesStates) { - yyerror("'wait' statements must not be nested"); - $$ = ""; - } else { - SType stDefault; - if (!_bHasOtherwise) { - stDefault = SType("default: return FALSE; break;"); - } else { - stDefault = SType(""); - } - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent)"+$4+$5+stDefault+$6+ - "return TRUE;}BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"; - $$.bCrossesStates = 1; - _bInHandler = 0; - } - } - ; -statement_autowait - : k_autowait wait_expression ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'autowait' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent) {"+ - "case EVENTCODE_EBegin: return TRUE;"+ - "case EVENTCODE_ETimer: Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, EInternal()); return TRUE;"+ - "default: return FALSE; }}"+ - "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+$3; - $$.bCrossesStates = 1; - } - ; - -statement_waitevent - : k_waitevent wait_expression identifier opt_eventvar ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'autocall' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent) {"+ - "case EVENTCODE_EBegin: return TRUE;"+ - "case EVENTCODE_"+$3+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ - "default: return FALSE; }}"+ - "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ - "const "+$3+"&"+$4+"= ("+$3+"&)__eeInput;\n"+$5; - $$.bCrossesStates = 1; - } - ; - - -opt_eventvar - : { - $$ = SType("__e"); - } - | identifier { - $$ = $1; - } - -statement_autocall - : k_autocall jumptarget '(' event_expression ')' identifier opt_eventvar ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'autocall' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent) {"+ - "case EVENTCODE_EBegin: Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"+ - "case EVENTCODE_"+$6+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ - "default: return FALSE; }}"+ - "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ - "const "+$6+"&"+$7+"= ("+$6+"&)__eeInput;\n"+$8; - $$.bCrossesStates = 1; - } - ; - -wait_expression - : '(' ')' { - $$ = SType("SetTimerAt(THINKTIME_NEVER)"); - } - | '(' expression ')' { - $$ = SType("SetTimerAfter")+$1+$2+$3; - } - ; - -statement_jump - : k_jump jumptarget '(' event_expression ')' ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'jump' in functions"); - } - $$ = SType(GetLineDirective($1))+"Jump"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; - } - ; - -statement_call - : k_call jumptarget '(' event_expression')' ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'call' in functions"); - } - if (!_bInHandler) { - yyerror("'call' must be inside a 'wait' statement"); - } - $$ = SType(GetLineDirective($1))+"Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; - } - ; - -event_expression - : expression { - $$ = $1; - } - | { - $$ = SType("EVoid()"); - } - ; - -jumptarget - : identifier { - $$ = SType("STATE_")+_strCurrentClass+"_"+$1+", TRUE"; - } - | identifier ':' ':' identifier { - $$ = SType("STATE_")+$1+"_"+$4+", FALSE"; - } - ; - -statement_stop - : k_stop ';' { - $$ = SType(GetLineDirective($1))+"UnsetTimer();Jump(STATE_CURRENT," - +_strAfterWaitID+", FALSE, EInternal());"+"return TRUE"+$2; - } - ; -statement_resume - : k_resume ';' { - $$ = SType(GetLineDirective($1))+"return TRUE"+$2; - } - ; -statement_pass - : k_pass ';' { - $$ = SType(GetLineDirective($1))+"return FALSE"+$2; - } - ; -statement_return - : k_return opt_expression ';' { - if (!_bInProcedure) { - $$ = $1+" "+$2+$3; - } else { - if (strlen($2.strString)==0) { - $2 = SType("EVoid()"); - } - $$ = SType(GetLineDirective($1)) - +"Return(STATE_CURRENT,"+$2+");" - +$1+" TRUE"+$3; - } - } - ; -opt_expression - : {$$ = "";} - | expression - ; - -handler - : k_on '(' event_specification ')' ':' '{' statements '}' opt_semicolon { - char strInputEventType[80]; - char strInputEventName[80]; - sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); - - $$ = SType("case")+$2+"EVENTCODE_"+strInputEventType+$4+$5+$6+ - "const "+strInputEventType+"&"+strInputEventName+"= ("+ - strInputEventType+"&)__eeInput;\n"+$7+$8+"ASSERT(FALSE);break;"; - } - | k_otherwise '(' event_specification ')' ':' '{' statements '}' opt_semicolon { - char strInputEventType[80]; - char strInputEventName[80]; - sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); - - $$ = SType("default")+$5+$6+$7+$8+"ASSERT(FALSE);break;"; - _bHasOtherwise = 1; - } - ; -handlers_list - : { $$ = "";} - | handlers_list handler { $$ = $1+$2; } - ; - -%% +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// rcg10042001 Changed to specify Ecc directory... +#include "Ecc/StdH.h" +#include "Ecc/Main.h" + +// turn off over-helpful bit of bison... --ryan. +#ifdef __GNUC__ +#define __attribute__(x) +#endif + +#define YYINITDEPTH 1000 + +static const char *_strCurrentClass; +static int _iCurrentClassID; +static const char *_strCurrentBase; +static const char *_strCurrentDescription; +static const char *_strCurrentThumbnail; +static const char *_strCurrentEnum; +static int _bClassIsExported = 0; + +static const char *_strCurrentPropertyID; +static const char *_strCurrentPropertyIdentifier; +static const char *_strCurrentPropertyPropertyType; +static const char *_strCurrentPropertyEnumType; +static const char *_strCurrentPropertyDataType; +static const char *_strCurrentPropertyName; +static const char *_strCurrentPropertyShortcut; +static const char *_strCurrentPropertyColor; +static const char *_strCurrentPropertyFlags; +static const char *_strCurrentPropertyDefaultCode; + +static const char *_strCurrentComponentIdentifier; +static const char *_strCurrentComponentType; +static const char *_strCurrentComponentID; +static const char *_strCurrentComponentFileName; + +static int _ctInProcedureHandler = 0; +static char _strLastProcedureName[256]; + +static char _strInWaitName[256]; +static char _strAfterWaitName[256]; +static char _strInWaitID[256]; +static char _strAfterWaitID[256]; + +static char _strInLoopName[256]; +static char _strAfterLoopName[256]; +static char _strInLoopID[256]; +static char _strAfterLoopID[256]; +static char _strCurrentStateID[256]; + +static int _bInProcedure; // set if currently compiling a procedure +static int _bInHandler; +static int _bHasOtherwise; // set if current 'wait' block has an 'otherwise' statement + +static const char *_strCurrentEvent; +static int _bFeature_AbstractBaseClass; +static int _bFeature_ImplementsOnInitClass; +static int _bFeature_ImplementsOnEndClass; +static int _bFeature_ImplementsOnPrecache; +static int _bFeature_ImplementsOnWorldInit; +static int _bFeature_ImplementsOnWorldEnd; +static int _bFeature_ImplementsOnWorldTick; +static int _bFeature_ImplementsOnWorldRender; +static int _bFeature_CanBePredictable; + +static int _iNextFreeID; +inline int CreateID(void) { + return _iNextFreeID++; +} + +static int _ctBraces = 0; +void OpenBrace(void) { + _ctBraces++; +} +void CloseBrace(void) { + _ctBraces--; +} +SType Braces(int iBraces) { + static char strBraces[50]; + memset(strBraces, '}', sizeof(strBraces)); + strBraces[iBraces] = 0; + return SType(strBraces); +} +char *RemoveLineDirective(char *str) +{ + if (str[0]=='\n' && str[1]=='#') { + return strchr(str+2, '\n')+1; + } else { + return str; + } +} +const char *GetLineDirective(SType &st) +{ + char *str = st.strString; + if (str[0]=='\n' && str[1]=='#' && str[2]=='l') { + char *strResult = strdup(str); + strchr(strResult+3,'\n')[1] = 0; + return strResult; + } else { + return ""; + } +} +void AddHandlerFunction(char *strProcedureName, int iStateID) +{ + fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); + fprintf(_fTables, " {0x%08x, -1, CEntity::pEventHandler(&%s::%s), " + "DEBUGSTRING(\"%s::%s\")},\n", + iStateID, _strCurrentClass, strProcedureName, _strCurrentClass, strProcedureName); +} + + +void AddHandlerFunction(char *strProcedureName, char *strStateID, char *strBaseStateID) +{ + fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); + fprintf(_fTables, " {%s, %s, CEntity::pEventHandler(&%s::%s)," + "DEBUGSTRING(\"%s::%s\")},\n", + strStateID, strBaseStateID, _strCurrentClass, strProcedureName, + _strCurrentClass, RemoveLineDirective(strProcedureName)); + strcpy(_strLastProcedureName, RemoveLineDirective(strProcedureName)); + _ctInProcedureHandler = 0; +} + +void CreateInternalHandlerFunction(char *strFunctionName, char *strID) +{ + int iID = CreateID(); + _ctInProcedureHandler++; + sprintf(strID, "0x%08x", iID); + sprintf(strFunctionName, "H0x%08x_%s_%02d", iID, _strLastProcedureName, _ctInProcedureHandler); + AddHandlerFunction(strFunctionName, iID); +} + +void DeclareFeatureProperties(void) +{ + if (_bFeature_CanBePredictable) { + fprintf(_fTables, " CEntityProperty(CEntityProperty::EPT_ENTITYPTR, NULL, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", + _iCurrentClassID, + "255", + _strCurrentClass, + "m_penPrediction", + "\"\"", + "0", + "0", + "0"); + fprintf(_fDeclaration, " %s %s;\n", + "CEntityPointer", + "m_penPrediction" + ); + fprintf(_fImplementation, " m_penPrediction = NULL;\n"); + } +} + +#define YYERROR_VERBOSE 1 + +%} + +/* BISON Declarations */ + +/* different type of constants */ +%token c_char +%token c_int +%token c_float +%token c_bool +%token c_string + +/* the standard cpp identifier */ +%token identifier + +/* specially bracketed cpp blocks */ +%token cppblock + +/* standard cpp-keywords */ +%token k_while +%token k_for +%token k_if +%token k_else +%token k_enum +%token k_switch +%token k_case +%token k_class +%token k_do +%token k_void +%token k_const +%token k_inline +%token k_static +%token k_virtual +%token k_return +%token k_autowait +%token k_autocall +%token k_waitevent + +/* aditional keywords */ +%token k_event +%token k_name +%token k_thumbnail +%token k_features +%token k_uses +%token k_export + +%token k_texture +%token k_sound +%token k_model + +%token k_properties +%token k_components +%token k_functions +%token k_procedures + +%token k_wait +%token k_on +%token k_otherwise + +%token k_call +%token k_jump +%token k_stop +%token k_resume +%token k_pass + +/* special data types */ +%token k_CTString +%token k_CTStringTrans +%token k_CTFileName +%token k_CTFileNameNoDep +%token k_BOOL +%token k_COLOR +%token k_FLOAT +%token k_INDEX +%token k_RANGE +%token k_CEntityPointer +%token k_CModelObject +%token k_CModelInstance +%token k_CAnimObject +%token k_CSoundObject +%token k_CPlacement3D +%token k_FLOATaabbox3D +%token k_FLOATmatrix3D +%token k_FLOATquat3D +%token k_ANGLE +%token k_FLOAT3D +%token k_ANGLE3D +%token k_FLOATplane3D +%token k_ANIMATION +%token k_ILLUMINATIONTYPE +%token k_FLAGS + +%start program + +%% + +/*///////////////////////////////////////////////////////// + * Global structure of the source file. + */ +program + : /* empty file */ {} + | c_int { + int iID = atoi($1.strString); + if(iID>32767) { + yyerror("Maximum allowed id for entity source file is 32767"); + } + _iCurrentClassID = iID; + _iNextFreeID = iID<<16; + fprintf(_fDeclaration, "#ifndef _%s_INCLUDED\n", _strFileNameBaseIdentifier); + fprintf(_fDeclaration, "#define _%s_INCLUDED 1\n", _strFileNameBaseIdentifier); + + } opt_global_cppblock { + + //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllimport)\n"); + } uses_list { + //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllexport)\n"); + + fprintf(_fImplementation, "#include <%s.h>\n", _strFileNameBase); + fprintf(_fImplementation, "#include <%s_tables.h>\n", _strFileNameBase); + } enum_and_event_declarations_list { + } opt_global_cppblock { + } opt_class_declaration { + fprintf(_fDeclaration, "#endif // _%s_INCLUDED\n", _strFileNameBaseIdentifier); + } + ; + + +/* + * Prolog cpp code. + */ +opt_global_cppblock + : /* null */ + | cppblock { fprintf(_fImplementation, "%s\n", $1.strString); } + ; + +uses_list + : /* null */ + | uses_list uses_statement + ; +uses_statement + : k_uses c_string ';' { + char *strUsedFileName = strdup($2.strString); + strUsedFileName[strlen(strUsedFileName)-1] = 0; + fprintf(_fDeclaration, "#include <%s.h>\n", strUsedFileName+1); + } + ; + + +enum_and_event_declarations_list + : /* null */ + | enum_and_event_declarations_list enum_declaration + | enum_and_event_declarations_list event_declaration + ; +/*///////////////////////////////////////////////////////// + * Enum types declarations + */ +enum_declaration + : k_enum identifier { + _strCurrentEnum = $2.strString; + fprintf(_fTables, "EP_ENUMBEG(%s)\n", _strCurrentEnum ); + fprintf(_fDeclaration, "extern DECL_DLL CEntityPropertyEnumType %s_enum;\n", _strCurrentEnum ); + fprintf(_fDeclaration, "enum %s {\n", _strCurrentEnum ); + } '{' enum_values_list opt_comma '}' ';' { + fprintf(_fTables, "EP_ENUMEND(%s);\n\n", _strCurrentEnum); + fprintf(_fDeclaration, "};\n"); + fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = (%s)0; } ;\n", _strCurrentEnum, _strCurrentEnum); + } + ; +opt_comma : /*null*/ | ','; +enum_values_list + : enum_value + | enum_values_list ',' enum_value + ; + +enum_value + : c_int identifier c_string { + fprintf(_fTables, " EP_ENUMVALUE(%s, %s),\n", $2.strString, $3.strString); + fprintf(_fDeclaration, " %s = %s,\n", $2.strString, $1.strString); + } + ; + +/*///////////////////////////////////////////////////////// + * Event declarations + */ +event_declaration + : k_event identifier { + _strCurrentEvent = $2.strString; + int iID = CreateID(); + fprintf(_fDeclaration, "#define EVENTCODE_%s 0x%08x\n", _strCurrentEvent, iID); + fprintf(_fDeclaration, "class DECL_DLL %s : public CEntityEvent {\npublic:\n", + _strCurrentEvent); + fprintf(_fDeclaration, "%s();\n", _strCurrentEvent ); + fprintf(_fDeclaration, "CEntityEvent *MakeCopy(void);\n"); + fprintf(_fImplementation, + "CEntityEvent *%s::MakeCopy(void) { " + "CEntityEvent *peeCopy = new %s(*this); " + "return peeCopy;}\n", + _strCurrentEvent, _strCurrentEvent); + fprintf(_fImplementation, "%s::%s() : CEntityEvent(EVENTCODE_%s) {;\n", + _strCurrentEvent, _strCurrentEvent, _strCurrentEvent); + } '{' event_members_list opt_comma '}' ';' { + fprintf(_fImplementation, "};\n"); + fprintf(_fDeclaration, "};\n"); + fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = %s(); } ;\n", _strCurrentEvent, _strCurrentEvent); + } + ; + +event_members_list + : /* null */ + | non_empty_event_members_list + ; + +non_empty_event_members_list + : event_member + | event_members_list ',' event_member + ; + +event_member + : any_type identifier { + fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); + fprintf(_fImplementation, " ClearToDefault(%s);\n", $2.strString); + } + ; + +/*///////////////////////////////////////////////////////// + * The class declaration structure. + */ +opt_class_declaration + : /* null */ + | class_declaration + ; + +class_declaration + : /* null */ + | class_optexport identifier ':' identifier '{' + k_name c_string ';' + k_thumbnail c_string ';' { + _strCurrentClass = $2.strString; + _strCurrentBase = $4.strString; + _strCurrentDescription = $7.strString; + _strCurrentThumbnail = $10.strString; + + fprintf(_fTables, "#define ENTITYCLASS %s\n\n", _strCurrentClass); + fprintf(_fDeclaration, "extern \"C\" DECL_DLL CDLLEntityClass %s_DLLClass;\n", + _strCurrentClass); + fprintf(_fDeclaration, "%s %s : public %s {\npublic:\n", + $1.strString, _strCurrentClass, _strCurrentBase); + + } opt_features { + fprintf(_fDeclaration, " %s virtual void SetDefaultProperties(void);\n", _bClassIsExported?"":"DECL_DLL"); + fprintf(_fImplementation, "void %s::SetDefaultProperties(void) {\n", _strCurrentClass); + fprintf(_fTables, "CEntityProperty %s_properties[] = {\n", _strCurrentClass); + + } k_properties ':' property_declaration_list { + fprintf(_fImplementation, " %s::SetDefaultProperties();\n}\n", _strCurrentBase); + + fprintf(_fTables, "CEntityComponent %s_components[] = {\n", _strCurrentClass); + } opt_internal_properties { + } k_components ':' component_declaration_list { + _bTrackLineInformation = 1; + fprintf(_fTables, "CEventHandlerEntry %s_handlers[] = {\n", _strCurrentClass); + + _bInProcedure = 0; + _bInHandler = 0; + } k_functions ':' function_list { + + _bInProcedure = 1; + } k_procedures ':' procedure_list { + } '}' ';' { + fprintf(_fTables, "};\n#define %s_handlersct ARRAYCOUNT(%s_handlers)\n", + _strCurrentClass, _strCurrentClass); + fprintf(_fTables, "\n"); + + if (_bFeature_AbstractBaseClass) { + fprintf(_fTables, "CEntity *%s_New(void) { return NULL; };\n", + _strCurrentClass); + } else { + fprintf(_fTables, "CEntity *%s_New(void) { return new %s; };\n", + _strCurrentClass, _strCurrentClass); + } + + if (!_bFeature_ImplementsOnInitClass) { + fprintf(_fTables, "void %s_OnInitClass(void) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnInitClass(void);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnEndClass) { + fprintf(_fTables, "void %s_OnEndClass(void) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnEndClass(void);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnPrecache) { + fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldEnd) { + fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldInit) { + fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldTick) { + fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldRender) { + fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo);\n", _strCurrentClass); + } + + fprintf(_fTables, "ENTITY_CLASSDEFINITION(%s, %s, %s, %s, 0x%08x);\n", + _strCurrentClass, _strCurrentBase, + _strCurrentDescription, _strCurrentThumbnail, _iCurrentClassID); + fprintf(_fTables, "DECLARE_CTFILENAME(_fnm%s_tbn, %s);\n", _strCurrentClass, _strCurrentThumbnail); + + fprintf(_fDeclaration, "};\n"); + } + ; + +class_optexport + : k_class { $$ = $1; _bClassIsExported = 0; } + | k_class k_export { $$ = $1+" DECL_DLL "; _bClassIsExported = 1; } + ; + +opt_features + : /*null */ + | k_features { + _bFeature_ImplementsOnWorldInit = 0; + _bFeature_ImplementsOnWorldEnd = 0; + _bFeature_ImplementsOnWorldTick = 0; + _bFeature_ImplementsOnWorldRender = 0; + _bFeature_ImplementsOnInitClass = 0; + _bFeature_ImplementsOnEndClass = 0; + _bFeature_ImplementsOnPrecache = 0; + _bFeature_AbstractBaseClass = 0; + _bFeature_CanBePredictable = 0; + }features_list ';' + ; +features_list + : feature + | features_list ',' feature + ; +feature + : c_string { + if (strcmp($1.strString, "\"AbstractBaseClass\"")==0) { + _bFeature_AbstractBaseClass = 1; + } else if (strcmp($1.strString, "\"IsTargetable\"")==0) { + fprintf(_fDeclaration, "virtual BOOL IsTargetable(void) const { return TRUE; };\n"); + } else if (strcmp($1.strString, "\"IsImportant\"")==0) { + fprintf(_fDeclaration, "virtual BOOL IsImportant(void) const { return TRUE; };\n"); + } else if (strcmp($1.strString, "\"HasName\"")==0) { + fprintf(_fDeclaration, + "virtual const CTString &GetName(void) const { return m_strName; };\n"); + } else if (strcmp($1.strString, "\"CanBePredictable\"")==0) { + fprintf(_fDeclaration, + "virtual CEntity *GetPredictionPair(void) { return m_penPrediction; };\n"); + fprintf(_fDeclaration, + "virtual void SetPredictionPair(CEntity *penPair) { m_penPrediction = penPair; };\n"); + _bFeature_CanBePredictable = 1; + } else if (strcmp($1.strString, "\"HasDescription\"")==0) { + fprintf(_fDeclaration, + "virtual const CTString &GetDescription(void) const { return m_strDescription; };\n"); + } else if (strcmp($1.strString, "\"HasTarget\"")==0) { + fprintf(_fDeclaration, + "virtual CEntity *GetTarget(void) const { return m_penTarget; };\n"); + } else if (strcmp($1.strString, "\"ImplementsOnInitClass\"")==0) { + _bFeature_ImplementsOnInitClass = 1; + } else if (strcmp($1.strString, "\"ImplementsOnEndClass\"")==0) { + _bFeature_ImplementsOnEndClass = 1; + } else if (strcmp($1.strString, "\"ImplementsOnPrecache\"")==0) { + _bFeature_ImplementsOnPrecache = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldInit\"")==0) { + _bFeature_ImplementsOnWorldInit = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldEnd\"")==0) { + _bFeature_ImplementsOnWorldEnd = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldTick\"")==0) { + _bFeature_ImplementsOnWorldTick = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldRender\"")==0) { + _bFeature_ImplementsOnWorldRender = 1; + } else { + yyerror((SType("Unknown feature: ")+$1).strString); + } + } + ; + +opt_internal_properties + : /* null */ + | '{' internal_property_list '}' + ; +internal_property_list + : /* null */ + | internal_property_list internal_property + ; +internal_property + : any_type identifier ';' { + fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); + } + ; + +/*///////////////////////////////////////////////////////// + * Property declarations + */ + +property_declaration_list + : empty_property_declaration_list { + DeclareFeatureProperties(); // this won't work, but at least it will generate an error!!!! + fprintf(_fTables, " CEntityProperty()\n};\n"); + fprintf(_fTables, "#define %s_propertiesct 0\n", _strCurrentClass); + fprintf(_fTables, "\n"); + fprintf(_fTables, "\n"); + } + | nonempty_property_declaration_list opt_comma { + DeclareFeatureProperties(); + fprintf(_fTables, "};\n"); + fprintf(_fTables, "#define %s_propertiesct ARRAYCOUNT(%s_properties)\n", + _strCurrentClass, _strCurrentClass); + fprintf(_fTables, "\n"); + } + ; +nonempty_property_declaration_list + : property_declaration + | nonempty_property_declaration_list ',' property_declaration + ; +empty_property_declaration_list + : /* null */ + ; + +property_declaration + : property_id property_type property_identifier property_wed_name_opt property_default_opt property_flags_opt { + fprintf(_fTables, " CEntityProperty(%s, %s, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", + _strCurrentPropertyPropertyType, + _strCurrentPropertyEnumType, + _iCurrentClassID, + _strCurrentPropertyID, + _strCurrentClass, + _strCurrentPropertyIdentifier, + _strCurrentPropertyName, + _strCurrentPropertyShortcut, + _strCurrentPropertyColor, + _strCurrentPropertyFlags); + fprintf(_fDeclaration, " %s %s;\n", + _strCurrentPropertyDataType, + _strCurrentPropertyIdentifier + ); + + if (strlen(_strCurrentPropertyDefaultCode)>0) { + fprintf(_fImplementation, " %s\n", _strCurrentPropertyDefaultCode); + } + } + ; + +property_id : c_int { _strCurrentPropertyID = $1.strString; }; +property_identifier : identifier { _strCurrentPropertyIdentifier = $1.strString; }; + +property_type + : k_enum identifier { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENUM"; + _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; + _strCurrentPropertyDataType = (SType("enum ")+$2.strString).strString; + } + | k_FLAGS identifier { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLAGS"; + _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; + _strCurrentPropertyDataType = "ULONG"; + } + | k_CTString { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRING"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTString"; + } + | k_CTStringTrans { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRINGTRANS"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTStringTrans"; + } + | k_CTFileName { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAME"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTFileName"; + } + | k_CTFileNameNoDep { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAMENODEP"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTFileNameNoDep"; + } + | k_BOOL { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_BOOL"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "BOOL"; + } + | k_COLOR { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_COLOR"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "COLOR"; + } + | k_FLOAT { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOAT"; + } + | k_INDEX { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_INDEX"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "INDEX"; + } + | k_RANGE { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_RANGE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "RANGE"; + } + | k_CEntityPointer { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENTITYPTR"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CEntityPointer"; + } + | k_CModelObject { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELOBJECT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CModelObject"; + } + | k_CModelInstance { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELINSTANCE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CModelInstance"; + } + | k_CAnimObject { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMOBJECT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CAnimObject"; + } + | k_CSoundObject { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_SOUNDOBJECT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CSoundObject"; + } + | k_CPlacement3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_PLACEMENT3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CPlacement3D"; + } + | k_FLOATaabbox3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATAABBOX3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATaabbox3D"; + } + | k_FLOATmatrix3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATMATRIX3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATmatrix3D"; + } + | k_FLOATquat3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATQUAT3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATquat3D"; + } + | k_ANGLE { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ANGLE"; + } + | k_ANGLE3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ANGLE3D"; + } + | k_FLOAT3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOAT3D"; + } + | k_FLOATplane3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATplane3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATplane3D"; + } + | k_ILLUMINATIONTYPE { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ILLUMINATIONTYPE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ILLUMINATIONTYPE"; + } + | k_ANIMATION { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMATION"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ANIMATION"; + } + ; + +property_wed_name_opt + : /* null */ { + _strCurrentPropertyName = "\"\""; + _strCurrentPropertyShortcut = "0"; + _strCurrentPropertyColor = "0"; // this won't be rendered anyway + } + | c_string property_shortcut_opt property_color_opt { + _strCurrentPropertyName = $1.strString; + } + ; +property_shortcut_opt + : /* null */ { + _strCurrentPropertyShortcut = "0"; + } + | c_char { + _strCurrentPropertyShortcut = $1.strString; + } + +property_color_opt + : /* null */ { + _strCurrentPropertyColor = "0x7F0000FFUL"; // dark red + } + | k_COLOR '(' expression ')' { + _strCurrentPropertyColor = $3.strString; + } +property_flags_opt + : /* null */ { + _strCurrentPropertyFlags = "0"; // dark red + } + | k_features '(' expression ')' { + _strCurrentPropertyFlags = $3.strString; + } + +property_default_opt + : /* null */ { + if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { + _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = NULL;").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CModelObject")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n"+ + _strCurrentPropertyIdentifier+".mo_toTexture.SetData(NULL);").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CModelInstance")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".Clear();\n").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CAnimObject")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CSoundObject")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".SetOwner(this);\n"+ + _strCurrentPropertyIdentifier+".Stop_internal();").strString; + } else { + yyerror("this kind of property must have default value"); + _strCurrentPropertyDefaultCode = ""; + } + } + | '=' property_default_expression { + if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { + yyerror("CEntityPointer type properties always default to NULL"); + } else { + _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = "+$2.strString+";").strString; + } + } + ; +property_default_expression + : c_int|c_float|c_bool|c_char|c_string + | identifier {$$ = $1 + " ";} + | identifier '(' expression ')' {$$ = $1+$2+$3+$4;} + | type_keyword '(' expression ')' {$$ = $1+$2+$3+$4;} + | '-' property_default_expression {$$ = $1+$2;} + | '(' expression ')' {$$ = $1+$2+$3;} + ; + +/*///////////////////////////////////////////////////////// + * Component declarations + */ +component_declaration_list + : empty_component_declaration_list { + fprintf(_fTables, " CEntityComponent()\n};\n"); + fprintf(_fTables, "#define %s_componentsct 0\n", _strCurrentClass); + fprintf(_fTables, "\n"); + fprintf(_fTables, "\n"); + } + | nonempty_component_declaration_list opt_comma { + fprintf(_fTables, "};\n"); + fprintf(_fTables, "#define %s_componentsct ARRAYCOUNT(%s_components)\n", + _strCurrentClass, _strCurrentClass); + fprintf(_fTables, "\n"); + } + ; +nonempty_component_declaration_list + : component_declaration + | nonempty_component_declaration_list ',' component_declaration + ; +empty_component_declaration_list + : /* null */ + ; + +component_declaration + : component_id component_type component_identifier component_filename { + fprintf(_fTables, "#define %s ((0x%08x<<8)+%s)\n", + _strCurrentComponentIdentifier, + _iCurrentClassID, + _strCurrentComponentID); + fprintf(_fTables, " CEntityComponent(%s, %s, \"%s%s\" %s),\n", + _strCurrentComponentType, + _strCurrentComponentIdentifier, + "EF","NM", + _strCurrentComponentFileName); + } + ; + +component_id : c_int { _strCurrentComponentID = $1.strString; }; +component_identifier : identifier { _strCurrentComponentIdentifier = $1.strString; }; +component_filename : c_string { _strCurrentComponentFileName = $1.strString; }; + +component_type + : k_model { _strCurrentComponentType = "ECT_MODEL"; } + | k_texture { _strCurrentComponentType = "ECT_TEXTURE"; } + | k_sound { _strCurrentComponentType = "ECT_SOUND"; } + | k_class { _strCurrentComponentType = "ECT_CLASS"; } + ; + +/*///////////////////////////////////////////////////////// + * Functions + */ +function_list + : { $$ = "";} + | function_list function_implementation {$$ = $1+$2;} + ; + +function_implementation + : opt_export opt_virtual return_type opt_tilde identifier '(' parameters_list ')' opt_const + '{' statements '}' opt_semicolon { + const char *strReturnType = $3.strString; + const char *strFunctionHeader = ($4+$5+$6+$7+$8+$9).strString; + const char *strFunctionBody = ($10+$11+$12).strString; + if (strcmp($5.strString, _strCurrentClass)==0) { + if (strcmp(strReturnType+strlen(strReturnType)-4, "void")==0 ) { + strReturnType = ""; + } else { + yyerror("use 'void' as return type for constructors"); + } + } + fprintf(_fDeclaration, " %s %s %s %s;\n", + $1.strString, $2.strString, strReturnType, strFunctionHeader); + fprintf(_fImplementation, " %s %s::%s %s\n", + strReturnType, _strCurrentClass, strFunctionHeader, strFunctionBody); + } + ; +opt_tilde + : { $$ = "";} + | '~' { $$ = " ~ "; } + ; + +opt_export + : { $$ = "";} + | k_export { + if (_bClassIsExported) { + $$ = ""; + } else { + $$ = " DECL_DLL "; + } + } + ; + +opt_const + : { $$ = "";} + | k_const { $$ = $1; } + ; +opt_virtual + : { $$ = "";} + | k_virtual { $$ = $1; } + ; +opt_semicolon + : /* null */ + | ';' + ; +parameters_list + : { $$ = "";} + | k_void + | non_void_parameters_list + ; +non_void_parameters_list + : parameter_declaration + | non_void_parameters_list ',' parameter_declaration {$$ = $1+$2+$3;} + ; +parameter_declaration + : any_type identifier { $$=$1+" "+$2; } + ; + +return_type + : any_type + | k_void + ; + +any_type + : type_keyword + | identifier + | k_enum identifier { $$=$1+" "+$2; } + | any_type '*' { $$=$1+" "+$2; } + | any_type '&' { $$=$1+" "+$2; } + | k_void '*' { $$=$1+" "+$2; } + | k_const any_type { $$=$1+" "+$2; } + | k_inline any_type { $$=$1+" "+$2; } + | k_static any_type { $$=$1+" "+$2; } + | k_class any_type { $$=$1+" "+$2; } + | identifier '<' any_type '>' { $$=$1+" "+$2+" "+$3+" "+$4; } + ; + + +/*///////////////////////////////////////////////////////// + * Procedures + */ +procedure_list + : { $$ = "";} + | procedure_list procedure_implementation {$$ = $1+$2;} + ; + +opt_override + : { $$ = "-1"; } + | ':' identifier ':' ':' identifier { + $$ = SType("STATE_")+$2+"_"+$5; + } + ; + +procedure_implementation + : identifier '(' event_specification ')' opt_override { + char *strProcedureName = $1.strString; + char strInputEventType[80]; + char strInputEventName[80]; + sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); + + char strStateID[256]; + const char *strBaseStateID = "-1"; + if(strcmp(RemoveLineDirective(strProcedureName), "Main")==0){ + strcpy(strStateID, "1"); + if(strncmp(strInputEventType, "EVoid", 4)!=0 && _strCurrentThumbnail[2]!=0) { + yyerror("procedure 'Main' can take input parameters only in classes without thumbnails"); + } + } else { + sprintf(strStateID, "0x%08x", CreateID()); + } + + sprintf(_strCurrentStateID, "STATE_%s_%s", + _strCurrentClass, RemoveLineDirective(strProcedureName)); + fprintf(_fDeclaration, "#define %s %s\n", _strCurrentStateID, strStateID); + AddHandlerFunction(strProcedureName, strStateID, $5.strString); + fprintf(_fImplementation, + "BOOL %s::%s(const CEntityEvent &__eeInput) {\n#undef STATE_CURRENT\n#define STATE_CURRENT %s\n", + _strCurrentClass, strProcedureName, _strCurrentStateID); + fprintf(_fImplementation, + " ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_%s, \"%s::%s expects '%s' as input!\");", + strInputEventType, _strCurrentClass, RemoveLineDirective(strProcedureName), + strInputEventType); + fprintf(_fImplementation, " const %s &%s = (const %s &)__eeInput;", + strInputEventType, strInputEventName, strInputEventType); + + } '{' statements '}' opt_semicolon { + char *strFunctionBody = $8.strString; + fprintf(_fImplementation, "%s ASSERT(FALSE); return TRUE;};", strFunctionBody); + } + ; + +event_specification + : { + $$="EVoid e"; + } + | identifier { + $$=$1+" e"; + } + | identifier identifier { + $$=$1+" "+$2; + } + ; + +expression + : c_int|c_float|c_bool|c_char|c_string + | identifier {$$ = $1 + " ";} + | type_keyword + | '='|'+'|'-'|'<'|'>'|'!'|'|'|'&'|'*'|'/'|'%'|'^'|'['|']'|':'|','|'.'|'?'|'~' + | '(' ')' {$$=$1+$2;} + | '+' '+' {$$=$1+$2;} + | '-' '-' {$$=$1+$2;} + | '-' '>' {$$=$1+$2;} + | ':' ':' {$$=$1+$2;} + | '&' '&' {$$=$1+$2;} + | '|' '|' {$$=$1+$2;} + | '^' '^' {$$=$1+$2;} + | '>' '>' {$$=$1+$2;} + | '<' '<' {$$=$1+$2;} + | '=' '=' {$$=$1+$2;} + | '!' '=' {$$=$1+$2;} + | '>' '=' {$$=$1+$2;} + | '<' '=' {$$=$1+$2;} + | '&' '=' {$$=$1+$2;} + | '|' '=' {$$=$1+$2;} + | '^' '=' {$$=$1+$2;} + | '+' '=' {$$=$1+$2;} + | '-' '=' {$$=$1+$2;} + | '/' '=' {$$=$1+$2;} + | '%' '=' {$$=$1+$2;} + | '*' '=' {$$=$1+$2;} + | '>' '>' '=' {$$=$1+$2+$3;} + | '<' '<' '=' {$$=$1+$2+$3;} + | '(' expression ')' {$$ = $1+$2+$3;} + | expression expression {$$ = $1+" "+$2;} + ; +type_keyword + : k_CTString|k_CTStringTrans|k_CTFileName|k_CTFileNameNoDep + | k_BOOL|k_COLOR|k_FLOAT|k_INDEX|k_RANGE + | k_CEntityPointer|k_CModelObject|k_CModelInstance|k_CAnimObject|k_CSoundObject + | k_CPlacement3D | k_FLOATaabbox3D|k_FLOATmatrix3D| k_FLOATquat3D|k_ANGLE|k_ANIMATION|k_ILLUMINATIONTYPE + | k_ANGLE3D|k_FLOAT3D|k_FLOATplane3D + | k_const + | k_static + ; +case_constant_expression + : c_int|c_float|c_bool|c_char|c_string + | identifier {$$ = $1 + " ";} + ; + + +/* Simple statements: + */ +statements + : { $$ = "";} + | statements statement { $$ = $1+$2; } + ; +statement + : expression ';' {$$=$1+$2;} + | k_switch '(' expression ')' '{' statements '}' {$$=$1+$2+$3+$4+$5+$6+$7;} + | k_case case_constant_expression ':' {$$=$1+" "+$2+$3+" ";} + | '{' statements '}' {$$=$1+$2+$3;} + | expression '{' statements '}' {$$=$1+$2+$3+$4;} + | statement_while + | statement_dowhile + | statement_for + | statement_if + | statement_if_else + | statement_wait + | statement_autowait + | statement_waitevent + | statement_call + | statement_autocall + | statement_stop + | statement_resume + | statement_pass + | statement_return + | statement_jump + | ';' + ; + + +statement_if + : k_if '(' expression ')' '{' statements '}' { + if ($6.bCrossesStates) { + char strAfterIfName[80], strAfterIfID[11]; + CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); + $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+$6+ + "Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; + } else { + $$ = $1+$2+$3+$4+$5+$6+$7; + } + } + ; + +statement_if_else + : k_if '(' expression ')' '{' statements '}' k_else statement { + if ($6.bCrossesStates || $9.bCrossesStates) { + char strAfterIfName[80], strAfterIfID[11]; + char strElseName[80], strElseID[11]; + CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); + CreateInternalHandlerFunction(strElseName, strElseID); + $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strElseID+", FALSE, EInternal());return TRUE;}"+ + $6+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+strElseName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strElseID+"\n"+ + $9+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}\n"+ + "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; + } else { + $$ = $1+$2+$3+$4+$5+$6+$7+$8+" "+$9; + } + } + ; + +statement_while + : k_while '(' expression ')' { + if (strlen(_strInLoopName)>0) { + yyerror("Nested loops are not implemented yet"); + } + } '{' statements '}' { + if ($7.bCrossesStates) { + CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); + CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); + $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$6+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+ + "if(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ + $7+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$8+ + "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; + } else { + $$ = $1+$2+$3+$4+$6+$7+$8; + } + _strInLoopName[0] = 0; + } + ; + +statement_dowhile + : k_do '{' statements '}' { + if (strlen(_strInLoopName)>0) { + yyerror("Nested loops are not implemented yet"); + } + _strInLoopName[0] = 0; + } k_while '(' expression ')' ';' { + if ($3.bCrossesStates) { + CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); + CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); + $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$2+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+$3+ + "if(!"+$7+$8+$9+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ + "Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$4+ + "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; + } else { + $$ = $1+$2+$3+$4+$6+$7+$8+$9+$10; + } + _strInLoopName[0] = 0; + } + ; + +statement_for + : k_for '(' expression ';' expression ';' expression ')' { + if (strlen(_strInLoopName)>0) { + yyerror("Nested loops are not implemented yet"); + } + } '{' statements '}' { + if ($11.bCrossesStates) { + CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); + CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); + yyerror("For loops across states are not supported"); + } else { + $$ = $1+$2+$3+$4+$5+$6+$7+$8+$10+$11+$12; + } + _strInLoopName[0] = 0; + } + ; + +statement_wait + : k_wait wait_expression { + if (!_bInProcedure) { + yyerror("Cannot have 'wait' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + _bInHandler = 1; + } '{' handlers_list '}' { + if ($5.bCrossesStates) { + yyerror("'wait' statements must not be nested"); + $$ = ""; + } else { + SType stDefault; + if (!_bHasOtherwise) { + stDefault = SType("default: return FALSE; break;"); + } else { + stDefault = SType(""); + } + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent)"+$4+$5+stDefault+$6+ + "return TRUE;}BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"; + $$.bCrossesStates = 1; + _bInHandler = 0; + } + } + ; +statement_autowait + : k_autowait wait_expression ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'autowait' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent) {"+ + "case EVENTCODE_EBegin: return TRUE;"+ + "case EVENTCODE_ETimer: Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, EInternal()); return TRUE;"+ + "default: return FALSE; }}"+ + "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+$3; + $$.bCrossesStates = 1; + } + ; + +statement_waitevent + : k_waitevent wait_expression identifier opt_eventvar ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'autocall' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent) {"+ + "case EVENTCODE_EBegin: return TRUE;"+ + "case EVENTCODE_"+$3+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ + "default: return FALSE; }}"+ + "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ + "const "+$3+"&"+$4+"= ("+$3+"&)__eeInput;\n"+$5; + $$.bCrossesStates = 1; + } + ; + + +opt_eventvar + : { + $$ = SType("__e"); + } + | identifier { + $$ = $1; + } + +statement_autocall + : k_autocall jumptarget '(' event_expression ')' identifier opt_eventvar ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'autocall' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent) {"+ + "case EVENTCODE_EBegin: Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"+ + "case EVENTCODE_"+$6+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ + "default: return FALSE; }}"+ + "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ + "const "+$6+"&"+$7+"= ("+$6+"&)__eeInput;\n"+$8; + $$.bCrossesStates = 1; + } + ; + +wait_expression + : '(' ')' { + $$ = SType("SetTimerAt(THINKTIME_NEVER)"); + } + | '(' expression ')' { + $$ = SType("SetTimerAfter")+$1+$2+$3; + } + ; + +statement_jump + : k_jump jumptarget '(' event_expression ')' ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'jump' in functions"); + } + $$ = SType(GetLineDirective($1))+"Jump"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; + } + ; + +statement_call + : k_call jumptarget '(' event_expression')' ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'call' in functions"); + } + if (!_bInHandler) { + yyerror("'call' must be inside a 'wait' statement"); + } + $$ = SType(GetLineDirective($1))+"Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; + } + ; + +event_expression + : expression { + $$ = $1; + } + | { + $$ = SType("EVoid()"); + } + ; + +jumptarget + : identifier { + $$ = SType("STATE_")+_strCurrentClass+"_"+$1+", TRUE"; + } + | identifier ':' ':' identifier { + $$ = SType("STATE_")+$1+"_"+$4+", FALSE"; + } + ; + +statement_stop + : k_stop ';' { + $$ = SType(GetLineDirective($1))+"UnsetTimer();Jump(STATE_CURRENT," + +_strAfterWaitID+", FALSE, EInternal());"+"return TRUE"+$2; + } + ; +statement_resume + : k_resume ';' { + $$ = SType(GetLineDirective($1))+"return TRUE"+$2; + } + ; +statement_pass + : k_pass ';' { + $$ = SType(GetLineDirective($1))+"return FALSE"+$2; + } + ; +statement_return + : k_return opt_expression ';' { + if (!_bInProcedure) { + $$ = $1+" "+$2+$3; + } else { + if (strlen($2.strString)==0) { + $2 = SType("EVoid()"); + } + $$ = SType(GetLineDirective($1)) + +"Return(STATE_CURRENT,"+$2+");" + +$1+" TRUE"+$3; + } + } + ; +opt_expression + : {$$ = "";} + | expression + ; + +handler + : k_on '(' event_specification ')' ':' '{' statements '}' opt_semicolon { + char strInputEventType[80]; + char strInputEventName[80]; + sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); + + $$ = SType("case")+$2+"EVENTCODE_"+strInputEventType+$4+$5+$6+ + "const "+strInputEventType+"&"+strInputEventName+"= ("+ + strInputEventType+"&)__eeInput;\n"+$7+$8+"ASSERT(FALSE);break;"; + } + | k_otherwise '(' event_specification ')' ':' '{' statements '}' opt_semicolon { + char strInputEventType[80]; + char strInputEventName[80]; + sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); + + $$ = SType("default")+$5+$6+$7+$8+"ASSERT(FALSE);break;"; + _bHasOtherwise = 1; + } + ; +handlers_list + : { $$ = "";} + | handlers_list handler { $$ = $1+$2; } + ; + +%% diff --git a/SamTFE/Sources/Ecc/Scanner.l b/SamTFE/Sources/Ecc/Scanner.l index 554b7e6b..6bd38345 100644 --- a/SamTFE/Sources/Ecc/Scanner.l +++ b/SamTFE/Sources/Ecc/Scanner.l @@ -1,172 +1,187 @@ -%{ -// rcg10042001 Changed to specify Ecc directory... -#include "Ecc/StdH.h" -#include "Ecc/Main.h" -#include "Ecc/Parser.h" - -#define YY_NEVER_INTERACTIVE 1 - - -int iLastLine = -1; - -#define RETURN(symbolname) \ - if (iLastLine==_iLinesCt || !_bTrackLineInformation){\ - yylval = yytext; \ - } else { \ - char strLine[512]; \ - sprintf(strLine, "\n#line %d \"%s\"\n", _iLinesCt, _strInputFileName);\ - yylval = SType(strLine)+yytext; \ - iLastLine=_iLinesCt; \ - } \ - return symbolname; - -char *_strCppBlock; - -%} - -%x COMMENT -%x CPPBLOCK - -DIGIT [0-9] -HEXDIGIT [0-9A-Fa-f] -IDENTIFIERFIRST [A-Za-z_] -IDENTIFIEROTHER [A-Za-z0-9_] -DOUBLEQUOTE \" -NONEXP_FLT ({DIGIT}+"."{DIGIT}*) -EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) - -%% - - /* standard cpp-keywords */ -"while" {RETURN(k_while);} -"switch" {RETURN(k_switch);} -"case" {RETURN(k_case);} -"for" {RETURN(k_for);} -"if" {RETURN(k_if);} -"else" {RETURN(k_else);} -"enum" {RETURN(k_enum);} -"class" {RETURN(k_class);} -"do" {RETURN(k_do);} -"void" {RETURN(k_void);} -"const" {RETURN(k_const);} -"inline" {RETURN(k_inline);} -"static" {RETURN(k_static);} -"virtual" {RETURN(k_virtual);} -"return" {RETURN(k_return);} -"autowait" {RETURN(k_autowait);} -"autocall" {RETURN(k_autocall);} -"waitevent" {RETURN(k_waitevent);} - - /* aditional keywords */ -"event" {RETURN(k_event);} -"name" {RETURN(k_name);} -"thumbnail" {RETURN(k_thumbnail);} -"features" {RETURN(k_features);} -"uses" {RETURN(k_uses);} -"export" {RETURN(k_export);} - -"texture" {RETURN(k_texture);} -"sound" {RETURN(k_sound);} -"model" {RETURN(k_model);} - -"properties" {RETURN(k_properties);} -"components" {RETURN(k_components);} -"functions" {RETURN(k_functions);} -"procedures" {RETURN(k_procedures);} - -"wait" {RETURN(k_wait );} -"on" {RETURN(k_on );} -"otherwise" {RETURN(k_otherwise);} - -"call" {RETURN(k_call );} -"jump" {RETURN(k_jump );} -"stop" {RETURN(k_stop );} -"resume" {RETURN(k_resume );} -"pass" {RETURN(k_pass );} - - /* special data types */ -"CTString" {RETURN(k_CTString);} -"CTStringTrans" {RETURN(k_CTStringTrans);} -"CTFileName" {RETURN(k_CTFileName);} -"CTFileNameNoDep" {RETURN(k_CTFileNameNoDep);} -"BOOL" {RETURN(k_BOOL);} -"COLOR" {RETURN(k_COLOR);} -"FLOAT" {RETURN(k_FLOAT);} -"INDEX" {RETURN(k_INDEX);} -"RANGE" {RETURN(k_RANGE);} -"CEntityPointer" {RETURN(k_CEntityPointer);} -"CModelObject" {RETURN(k_CModelObject);} -"CModelInstance" {RETURN(k_CModelInstance);} -"CAnimObject" {RETURN(k_CAnimObject);} -"CSoundObject" {RETURN(k_CSoundObject);} -"CPlacement3D" {RETURN(k_CPlacement3D);} -"FLOATaabbox3D" {RETURN(k_FLOATaabbox3D);} -"FLOATmatrix3D" {RETURN(k_FLOATmatrix3D);} -"FLOATquat3D" {RETURN(k_FLOATquat3D);} -"ANGLE" {RETURN(k_ANGLE);}; -"ANIMATION" {RETURN(k_ANIMATION);}; -"ILLUMINATIONTYPE" {RETURN(k_ILLUMINATIONTYPE);}; -"FLOAT3D" {RETURN(k_FLOAT3D);}; -"ANGLE3D" {RETURN(k_ANGLE3D);}; -"FLOATplane3D" {RETURN(k_FLOATplane3D);}; -"flags" {RETURN(k_FLAGS);}; - - /* single character operators and punctuations */ -";"|"("|")"|"{"|"}"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { - RETURN(yytext[0]);} - - /* constants */ -{DIGIT}+ { RETURN(c_int); } -"0x"{HEXDIGIT}+ { RETURN(c_int)}; -{NONEXP_FLT}("f"|"F")? { RETURN(c_int); } -{EXP_FLT}("f"|"F")? { RETURN(c_int); } -(\"[^\n"]+\")|(\"\") { RETURN(c_string); } -(\'[^\n']+\')|(\'\') { RETURN(c_char); } - - /* identifier */ -{IDENTIFIERFIRST}{IDENTIFIEROTHER}* {RETURN(identifier);} - - /* specially bracketed cpp blocks */ -"%{" { - char strLine[512]; - sprintf(strLine, "#line %d \"%s\"\n", _iLinesCt, _strInputFileName ); - _strCppBlock = strdup(strLine); - BEGIN(CPPBLOCK); -} -"%}" { - BEGIN(INITIAL); - yylval = SType(_strCppBlock); - return cppblock; -} -\n { - _iLinesCt++; - _strCppBlock = (SType(_strCppBlock)+yytext).strString; - } -.* { - _strCppBlock = (SType(_strCppBlock)+yytext).strString; -} - - /* eat up comments */ -"/*" { BEGIN(COMMENT); } -"*/" { BEGIN(INITIAL); } -. {} -"//"[^\n]*\n { _iLinesCt++; } - - /* eat up whitespace */ -[ \t]+ { -} - /* eat up linefeeds and count lines in all conditions */ -<*>\n { - _iLinesCt++; - } - /* for all unrecognized characters */ -. { - // report an error - char strError[80]; - sprintf(strError, "Unrecognized character '%c' (ASCII 0x%02x)\n", - yytext[0], yytext[0] ); - yyerror(strError); -} - -%% - +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// rcg10042001 Changed to specify Ecc directory... +#include "Ecc/StdH.h" +#include "Ecc/Main.h" +#include "Ecc/Parser.h" + +#define YY_NEVER_INTERACTIVE 1 + + +int iLastLine = -1; + +#define RETURN(symbolname) \ + if (iLastLine==_iLinesCt || !_bTrackLineInformation){\ + yylval = yytext; \ + } else { \ + char strLine[512]; \ + sprintf(strLine, "\n#line %d \"%s\"\n", _iLinesCt, _strInputFileName);\ + yylval = SType(strLine)+yytext; \ + iLastLine=_iLinesCt; \ + } \ + return symbolname; + +char *_strCppBlock; + +%} + +%x COMMENT +%x CPPBLOCK + +DIGIT [0-9] +HEXDIGIT [0-9A-Fa-f] +IDENTIFIERFIRST [A-Za-z_] +IDENTIFIEROTHER [A-Za-z0-9_] +DOUBLEQUOTE \" +NONEXP_FLT ({DIGIT}+"."{DIGIT}*) +EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) + +%% + + /* standard cpp-keywords */ +"while" {RETURN(k_while);} +"switch" {RETURN(k_switch);} +"case" {RETURN(k_case);} +"for" {RETURN(k_for);} +"if" {RETURN(k_if);} +"else" {RETURN(k_else);} +"enum" {RETURN(k_enum);} +"class" {RETURN(k_class);} +"do" {RETURN(k_do);} +"void" {RETURN(k_void);} +"const" {RETURN(k_const);} +"inline" {RETURN(k_inline);} +"static" {RETURN(k_static);} +"virtual" {RETURN(k_virtual);} +"return" {RETURN(k_return);} +"autowait" {RETURN(k_autowait);} +"autocall" {RETURN(k_autocall);} +"waitevent" {RETURN(k_waitevent);} + + /* aditional keywords */ +"event" {RETURN(k_event);} +"name" {RETURN(k_name);} +"thumbnail" {RETURN(k_thumbnail);} +"features" {RETURN(k_features);} +"uses" {RETURN(k_uses);} +"export" {RETURN(k_export);} + +"texture" {RETURN(k_texture);} +"sound" {RETURN(k_sound);} +"model" {RETURN(k_model);} + +"properties" {RETURN(k_properties);} +"components" {RETURN(k_components);} +"functions" {RETURN(k_functions);} +"procedures" {RETURN(k_procedures);} + +"wait" {RETURN(k_wait );} +"on" {RETURN(k_on );} +"otherwise" {RETURN(k_otherwise);} + +"call" {RETURN(k_call );} +"jump" {RETURN(k_jump );} +"stop" {RETURN(k_stop );} +"resume" {RETURN(k_resume );} +"pass" {RETURN(k_pass );} + + /* special data types */ +"CTString" {RETURN(k_CTString);} +"CTStringTrans" {RETURN(k_CTStringTrans);} +"CTFileName" {RETURN(k_CTFileName);} +"CTFileNameNoDep" {RETURN(k_CTFileNameNoDep);} +"BOOL" {RETURN(k_BOOL);} +"COLOR" {RETURN(k_COLOR);} +"FLOAT" {RETURN(k_FLOAT);} +"INDEX" {RETURN(k_INDEX);} +"RANGE" {RETURN(k_RANGE);} +"CEntityPointer" {RETURN(k_CEntityPointer);} +"CModelObject" {RETURN(k_CModelObject);} +"CModelInstance" {RETURN(k_CModelInstance);} +"CAnimObject" {RETURN(k_CAnimObject);} +"CSoundObject" {RETURN(k_CSoundObject);} +"CPlacement3D" {RETURN(k_CPlacement3D);} +"FLOATaabbox3D" {RETURN(k_FLOATaabbox3D);} +"FLOATmatrix3D" {RETURN(k_FLOATmatrix3D);} +"FLOATquat3D" {RETURN(k_FLOATquat3D);} +"ANGLE" {RETURN(k_ANGLE);}; +"ANIMATION" {RETURN(k_ANIMATION);}; +"ILLUMINATIONTYPE" {RETURN(k_ILLUMINATIONTYPE);}; +"FLOAT3D" {RETURN(k_FLOAT3D);}; +"ANGLE3D" {RETURN(k_ANGLE3D);}; +"FLOATplane3D" {RETURN(k_FLOATplane3D);}; +"flags" {RETURN(k_FLAGS);}; + + /* single character operators and punctuations */ +";"|"("|")"|"{"|"}"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { + RETURN(yytext[0]);} + + /* constants */ +{DIGIT}+ { RETURN(c_int); } +"0x"{HEXDIGIT}+ { RETURN(c_int)}; +{NONEXP_FLT}("f"|"F")? { RETURN(c_int); } +{EXP_FLT}("f"|"F")? { RETURN(c_int); } +(\"[^\n"]+\")|(\"\") { RETURN(c_string); } +(\'[^\n']+\')|(\'\') { RETURN(c_char); } + + /* identifier */ +{IDENTIFIERFIRST}{IDENTIFIEROTHER}* {RETURN(identifier);} + + /* specially bracketed cpp blocks */ +"%{" { + char strLine[512]; + sprintf(strLine, "#line %d \"%s\"\n", _iLinesCt, _strInputFileName ); + _strCppBlock = strdup(strLine); + BEGIN(CPPBLOCK); +} +"%}" { + BEGIN(INITIAL); + yylval = SType(_strCppBlock); + return cppblock; +} +\n { + _iLinesCt++; + _strCppBlock = (SType(_strCppBlock)+yytext).strString; + } +.* { + _strCppBlock = (SType(_strCppBlock)+yytext).strString; +} + + /* eat up comments */ +"/*" { BEGIN(COMMENT); } +"*/" { BEGIN(INITIAL); } +. {} +"//"[^\n]*\n { _iLinesCt++; } + + /* eat up whitespace */ +[ \t]+ { +} + /* eat up linefeeds and count lines in all conditions */ +<*>\n { + _iLinesCt++; + } + /* for all unrecognized characters */ +. { + // report an error + char strError[80]; + sprintf(strError, "Unrecognized character '%c' (ASCII 0x%02x)\n", + yytext[0], yytext[0] ); + yyerror(strError); +} + +%% + diff --git a/SamTFE/Sources/Engine/Base/CTString.inl b/SamTFE/Sources/Engine/Base/CTString.inl index 1a1ee4ef..6e8059cb 100644 --- a/SamTFE/Sources/Engine/Base/CTString.inl +++ b/SamTFE/Sources/Engine/Base/CTString.inl @@ -1,119 +1,134 @@ -#ifndef SE_INCL_CTSTRING_INL -#define SE_INCL_CTSTRING_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -#include -#include - -/* - * Default constructor. - */ -ENGINE_API CTString::CTString(void) -{ - str_String = StringDuplicate(""); -} - -/* - * Copy constructor. - */ -ENGINE_API CTString::CTString(const CTString &strOriginal) -{ - ASSERT(strOriginal.IsValid()); - - // make string duplicate - str_String = StringDuplicate(strOriginal.str_String); -} - -/* - * Constructor from character string. - */ -ENGINE_API CTString::CTString( const char *strCharString) -{ - ASSERT(strCharString!=NULL); - - // make string duplicate - str_String = StringDuplicate( strCharString); -} - -/* Constructor with formatting. */ -ENGINE_API CTString::CTString(INDEX iDummy, const char *strFormat, ...) -{ - str_String = StringDuplicate(""); - va_list arg; - va_start(arg, strFormat); - VPrintF(strFormat, arg); - va_end(arg); -} - -/* - * Destructor. - */ -ENGINE_API CTString::~CTString() -{ - // check that it is valid - ASSERT(IsValid()); - // free memory - FreeMemory(str_String); -} - -/* - * Clear the object. - */ -ENGINE_API void CTString::Clear(void) -{ - operator=(""); -} - -/* - * Conversion into character string. - */ -ENGINE_API CTString::operator const char*() const -{ - ASSERT(IsValid()); - - return str_String; -} - -/* - * Assignment. - */ -ENGINE_API CTString &CTString::operator=(const char *strCharString) -{ - ASSERT(IsValid()); - ASSERT(strCharString!=NULL); - - /* The other string must be copied _before_ this memory is freed, since it could be same - pointer! - */ - // make a copy of character string - char *strCopy = StringDuplicate(strCharString); - // empty this string - FreeMemory(str_String); - // assign it the copy of the character string - str_String = strCopy; - - return *this; -} -ENGINE_API CTString &CTString::operator=(const CTString &strOther) -{ - ASSERT(IsValid()); - ASSERT(strOther.IsValid()); - - /* The other string must be copied _before_ this memory is freed, since it could be same - pointer! - */ - // make a copy of character string - char *strCopy = StringDuplicate(strOther.str_String); - // empty this string - FreeMemory(str_String); - // assign it the copy of the character string - str_String = strCopy; - - return *this; -} - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_CTSTRING_INL +#define SE_INCL_CTSTRING_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +#include +#include + +/* + * Default constructor. + */ +ENGINE_API CTString::CTString(void) +{ + str_String = StringDuplicate(""); +} + +/* + * Copy constructor. + */ +ENGINE_API CTString::CTString(const CTString &strOriginal) +{ + ASSERT(strOriginal.IsValid()); + + // make string duplicate + str_String = StringDuplicate(strOriginal.str_String); +} + +/* + * Constructor from character string. + */ +ENGINE_API CTString::CTString( const char *strCharString) +{ + ASSERT(strCharString!=NULL); + + // make string duplicate + str_String = StringDuplicate( strCharString); +} + +/* Constructor with formatting. */ +ENGINE_API CTString::CTString(INDEX iDummy, const char *strFormat, ...) +{ + str_String = StringDuplicate(""); + va_list arg; + va_start(arg, strFormat); + VPrintF(strFormat, arg); + va_end(arg); +} + +/* + * Destructor. + */ +ENGINE_API CTString::~CTString() +{ + // check that it is valid + ASSERT(IsValid()); + // free memory + FreeMemory(str_String); +} + +/* + * Clear the object. + */ +ENGINE_API void CTString::Clear(void) +{ + operator=(""); +} + +/* + * Conversion into character string. + */ +ENGINE_API CTString::operator const char*() const +{ + ASSERT(IsValid()); + + return str_String; +} + +/* + * Assignment. + */ +ENGINE_API CTString &CTString::operator=(const char *strCharString) +{ + ASSERT(IsValid()); + ASSERT(strCharString!=NULL); + + /* The other string must be copied _before_ this memory is freed, since it could be same + pointer! + */ + // make a copy of character string + char *strCopy = StringDuplicate(strCharString); + // empty this string + FreeMemory(str_String); + // assign it the copy of the character string + str_String = strCopy; + + return *this; +} +ENGINE_API CTString &CTString::operator=(const CTString &strOther) +{ + ASSERT(IsValid()); + ASSERT(strOther.IsValid()); + + /* The other string must be copied _before_ this memory is freed, since it could be same + pointer! + */ + // make a copy of character string + char *strCopy = StringDuplicate(strOther.str_String); + // empty this string + FreeMemory(str_String); + // assign it the copy of the character string + str_String = strCopy; + + return *this; +} + + +#endif /* include-once check. */ + diff --git a/SamTFE/Sources/Engine/Base/FLEX.skl b/SamTFE/Sources/Engine/Base/FLEX.skl index 6571aff9..e60be9c3 100644 --- a/SamTFE/Sources/Engine/Base/FLEX.skl +++ b/SamTFE/Sources/Engine/Base/FLEX.skl @@ -1,1496 +1,1511 @@ -#include "Engine/StdH.h" - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -//#ifdef c_plusplus -//#ifndef __cplusplus -//#define __cplusplus -//#endif -//#endif - -#if 1 //def __cplusplus - - #include -%+ - class istream; -%* - - /* Use prototypes in function declarations. */ - #define YY_USE_PROTOS - - /* The "const" storage-class-modifier is valid. */ - #define YY_USE_CONST - -#else /* ! __cplusplus */ - - #if __STDC__ - - #define YY_USE_PROTOS - #define YY_USE_CONST - - #endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -extern FILE *yyin, *yyout; -%* - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - FILE *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -static YY_BUFFER_STATE yy_current_buffer = 0; -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -//static - void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -%* -#endif - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( const char msg[] )); -%* - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifdef YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) -%- - yyin = stdin; -%+ - yyin = &cin; -%* - - if ( ! yyout ) -%- - yyout = stdout; -%+ - yyout = &cout; -%* - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( yy_current_buffer ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; - } - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif - { - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) yyout->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer() -%+ -int yyFlexLexer::yy_get_next_buffer() -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state() -%+ -yy_state_type yyFlexLexer::yy_get_previous_state() -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifdef YY_USE_PROTOS -//static - void yyunput( int c, register char *yy_bp ) -#else -//static - void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } - - -%- -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif -%+ -int yyFlexLexer::yyinput() -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%* - { - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) -%* - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#ifdef YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#ifdef YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif -%+ - b->yy_is_interactive = 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%* - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( const char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -const char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -const char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state() -%+ -void yyFlexLexer::yy_pop_state() -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state() -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( const char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( const char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, const char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -const char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - return (void *) realloc( ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#ifdef YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include "Engine/StdH.h" + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +%- +#include +%* + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +//#ifdef c_plusplus +//#ifndef __cplusplus +//#define __cplusplus +//#endif +//#endif + +#if 1 //def __cplusplus + + #include +%+ + class istream; +%* + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +#else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +%- +extern FILE *yyin, *yyout; +%* + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { +%- + FILE *yy_input_file; +%+ + istream* yy_input_file; +%* + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +%- Standard (non-C++) definition +static YY_BUFFER_STATE yy_current_buffer = 0; +%* + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +%- Standard (non-C++) definition +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); +%* + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +//static + void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); +#endif + +#ifndef YY_NO_INPUT +%- Standard (non-C++) definition +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +%* +#endif + +%- Standard (non-C++) definition +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( const char msg[] )); +%* + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ +%% code to fiddle yytext and yyleng for yymore() goes here + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ +%% code to copy yytext_ptr to yytext[] goes here, if %array + yy_c_buf_p = yy_cp; + +%% data tables for the DFA and the user's section 1 definitions go here + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifdef YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +%- Standard (non-C++) definition +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +%+ C++ definition +#define ECHO LexerOutput( yytext, yyleng ) +%* +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ +%+ C++ definition + if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +%* +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +%- +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +%+ +#define YY_FATAL_ERROR(msg) LexerError( msg ) +%* +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +%- Standard (non-C++) definition +#define YY_DECL int yylex YY_PROTO(( void )) +%+ C++ definition +#define YY_DECL int yyFlexLexer::yylex() +%* +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +%% YY_RULE_SETUP definition goes here + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +%% user's declarations go here + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) +%- + yyin = stdin; +%+ + yyin = &cin; +%* + + if ( ! yyout ) +%- + yyout = stdout; +%+ + yyout = &cout; +%* + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +%% yymore()-related code goes here + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +%% code to set up and find next match goes here + +yy_find_action: +%% code to find the action number goes here + + YY_DO_BEFORE_ACTION; + +%% code for yylineno update goes here + +do_action: /* This label is used only to access EOF actions. */ + +%% debug code goes here + + switch ( yy_act ) + { /* beginning of action switch */ +%% actions go here + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +%% code to do back-up for compressed tables and set up yy_cp goes here + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + +%+ +yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) + { + yyin = arg_yyin; + yyout = arg_yyout; + yy_c_buf_p = 0; + yy_init = 1; + yy_start = 0; + yy_flex_debug = 0; + yylineno = 1; // this will only get updated if %option yylineno + + yy_did_buffer_switch_on_eof = 0; + + yy_looking_for_trail_begin = 0; + yy_more_flag = 0; + yy_more_len = 0; + + yy_start_stack_ptr = yy_start_stack_depth = 0; + yy_start_stack = 0; + + yy_current_buffer = 0; + +#ifdef YY_USES_REJECT + yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; +#else + yy_state_buf = 0; +#endif + } + +yyFlexLexer::~yyFlexLexer() + { + delete yy_state_buf; + yy_delete_buffer( yy_current_buffer ); + } + +void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) + { + if ( new_in ) + { + yy_delete_buffer( yy_current_buffer ); + yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); + } + + if ( new_out ) + yyout = new_out; + } + +#ifdef YY_INTERACTIVE +int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) +#else +int yyFlexLexer::LexerInput( char* buf, int max_size ) +#endif + { + if ( yyin->eof() || yyin->fail() ) + return 0; + +#ifdef YY_INTERACTIVE + yyin->get( buf[0] ); + + if ( yyin->eof() ) + return 0; + + if ( yyin->bad() ) + return -1; + + return 1; + +#else + (void) yyin->read( buf, max_size ); + + if ( yyin->bad() ) + return -1; + else + return yyin->gcount(); +#endif + } + +void yyFlexLexer::LexerOutput( const char* buf, int size ) + { + (void) yyout->write( buf, size ); + } +%* + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +%- +static int yy_get_next_buffer() +%+ +int yyFlexLexer::yy_get_next_buffer() +%* + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +%- +static yy_state_type yy_get_previous_state() +%+ +yy_state_type yyFlexLexer::yy_get_previous_state() +%* + { + register yy_state_type yy_current_state; + register char *yy_cp; + +%% code to get the start state into yy_current_state goes here + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { +%% code to find the next state goes here + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +%- +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif +%+ +yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +%* + { + register int yy_is_jam; +%% code to find the next state, and perhaps do backing up, goes here + + return yy_is_jam ? 0 : yy_current_state; + } + + +%- +#ifdef YY_USE_PROTOS +//static + void yyunput( int c, register char *yy_bp ) +#else +//static + void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif +%+ +void yyFlexLexer::yyunput( int c, register char* yy_bp ) +%* + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +%% update yylineno here + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + + +%- +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif +%+ +int yyFlexLexer::yyinput() +%* + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + +%% update BOL and yylineno + + return c; + } + + +%- +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif +%+ +void yyFlexLexer::yyrestart( istream* input_file ) +%* + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +%- +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif +%+ +void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +%* + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif +%+ +void yyFlexLexer::yy_load_buffer_state() +%* + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif +%+ +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) +%* + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif +%+ +void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +%* + { + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +%- +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + +%+ +extern "C" int isatty YY_PROTO(( int )); +void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) +%* + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +%- +#ifdef YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#ifdef YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif +%+ + b->yy_is_interactive = 0; +%* + } + + +%- +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + +%+ +void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +%* + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } +%* + + +#ifndef YY_NO_SCAN_BUFFER +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +%* +#endif + + +#ifndef YY_NO_SCAN_STRING +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( const char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +const char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +%* +#endif + + +#ifndef YY_NO_SCAN_BYTES +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +const char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +%* +#endif + + +#ifndef YY_NO_PUSH_STATE +%- +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif +%+ +void yyFlexLexer::yy_push_state( int new_state ) +%* + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +%- +static void yy_pop_state() +%+ +void yyFlexLexer::yy_pop_state() +%* + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +%- +static int yy_top_state() +%+ +int yyFlexLexer::yy_top_state() +%* + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +%- +#ifdef YY_USE_PROTOS +static void yy_fatal_error( const char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + +%+ + +void yyFlexLexer::LexerError( const char msg[] ) + { + cerr << msg << '\n'; + exit( YY_EXIT_FAILURE ); + } +%* + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, const char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +const char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + return (void *) realloc( ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#ifdef YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif diff --git a/SamTFE/Sources/Engine/Base/ListIterator.inl b/SamTFE/Sources/Engine/Base/ListIterator.inl index 7ce551c6..4a8a55ee 100644 --- a/SamTFE/Sources/Engine/Base/ListIterator.inl +++ b/SamTFE/Sources/Engine/Base/ListIterator.inl @@ -1,105 +1,119 @@ - -#ifndef SE_INCL_LISTITERATOR_INL -#define SE_INCL_LISTITERATOR_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -/* simple list iterator: 4 bytes structure, all functions are inline */ -template -class CListIter { -private: - CListNode *li_CurrentNode; -public: - /* default constructor - no list attached */ - CListIter(void) { - li_CurrentNode = NULL; - }; - /* constructor with list attaching */ - CListIter(const CListHead &lhHead) { - li_CurrentNode = &lhHead.IterationHead(); - }; - /* constructor to start from given node */ - CListIter(CListNode &lnNode) { - ASSERT(lnNode.IsLinked()); - li_CurrentNode = &lnNode; - }; - /* start iterating */ - void Reset(const CListHead &lhHead) { - li_CurrentNode = &lhHead.IterationHead(); - }; - /* move to next node */ - void MoveToNext(void) { - li_CurrentNode = &li_CurrentNode->IterationSucc(); - }; - /* move to previous node */ - void MoveToPrev(void) { - li_CurrentNode = &li_CurrentNode->IterationPred(); - }; - /* check if finished */ - BOOL IsPastEnd(void) { - return li_CurrentNode->IsTailMarker(); - }; - /* Insert a node after current one. */ - inline void InsertAfterCurrent(CListNode &lnNew) { - li_CurrentNode->IterationInsertAfter(lnNew); - }; - /* Insert a node before current one. */ - inline void InsertBeforeCurrent(CListNode &lnNew) { - li_CurrentNode->IterationInsertBefore(lnNew); - }; - - /* Get current element. */ - Cbase &Current(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } - Cbase &operator*(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } - operator Cbase *(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } - Cbase *operator->(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } -}; - -// taken from stddef.h -//#ifndef offsetof -//#define offsetof(s,m) (size_t)&(((s *)0)->m) -//#endif - -// declare a list iterator for a class with a CListNode member -#define LISTITER(baseclass, member) CListIter - -// make 'for' construct for walking a list -#define FOREACHINLIST(baseclass, member, head, iter) \ - for ( LISTITER(baseclass, member) iter(head); !iter.IsPastEnd(); iter.MoveToNext() ) - -// make 'for' construct for walking a list, keeping the iterator for later use -#define FOREACHINLISTKEEP(baseclass, member, head, iter) \ - LISTITER(baseclass, member) iter(head); \ - for (; !iter.IsPastEnd(); iter.MoveToNext() ) - -// make 'for' construct for deleting a list -#define FORDELETELIST(baseclass, member, head, iter) \ - for ( LISTITER(baseclass, member) iter(head), iter##next; \ - iter##next=iter, iter##next.IsPastEnd() || (iter##next.MoveToNext(),1), !iter.IsPastEnd(); \ - iter = iter##next) - -#ifdef PLATFORM_OPENBSD -#ifdef LIST_HEAD - #undef LIST_HEAD -#endif -#endif - -// get the pointer to the first element in the list -#define LIST_HEAD(listhead, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) -// get the pointer to the last element in the list -#define LIST_TAIL(listhead, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(listhead).Tail())) - _offsetof(baseclass, member) ) ) - -// get the pointer to the predecessor of the element -#define LIST_PRED(element, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(element).member.Pred())) - _offsetof(baseclass, member) ) ) -// get the pointer to the successor of the element -#define LIST_SUCC(element, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(element).member.Succ())) - _offsetof(baseclass, member) ) ) - - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_LISTITERATOR_INL +#define SE_INCL_LISTITERATOR_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +/* simple list iterator: 4 bytes structure, all functions are inline */ +template +class CListIter { +private: + CListNode *li_CurrentNode; +public: + /* default constructor - no list attached */ + CListIter(void) { + li_CurrentNode = NULL; + }; + /* constructor with list attaching */ + CListIter(const CListHead &lhHead) { + li_CurrentNode = &lhHead.IterationHead(); + }; + /* constructor to start from given node */ + CListIter(CListNode &lnNode) { + ASSERT(lnNode.IsLinked()); + li_CurrentNode = &lnNode; + }; + /* start iterating */ + void Reset(const CListHead &lhHead) { + li_CurrentNode = &lhHead.IterationHead(); + }; + /* move to next node */ + void MoveToNext(void) { + li_CurrentNode = &li_CurrentNode->IterationSucc(); + }; + /* move to previous node */ + void MoveToPrev(void) { + li_CurrentNode = &li_CurrentNode->IterationPred(); + }; + /* check if finished */ + BOOL IsPastEnd(void) { + return li_CurrentNode->IsTailMarker(); + }; + /* Insert a node after current one. */ + inline void InsertAfterCurrent(CListNode &lnNew) { + li_CurrentNode->IterationInsertAfter(lnNew); + }; + /* Insert a node before current one. */ + inline void InsertBeforeCurrent(CListNode &lnNew) { + li_CurrentNode->IterationInsertBefore(lnNew); + }; + + /* Get current element. */ + Cbase &Current(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } + Cbase &operator*(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } + operator Cbase *(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } + Cbase *operator->(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } +}; + +// taken from stddef.h +//#ifndef offsetof +//#define offsetof(s,m) (size_t)&(((s *)0)->m) +//#endif + +// declare a list iterator for a class with a CListNode member +#define LISTITER(baseclass, member) CListIter + +// make 'for' construct for walking a list +#define FOREACHINLIST(baseclass, member, head, iter) \ + for ( LISTITER(baseclass, member) iter(head); !iter.IsPastEnd(); iter.MoveToNext() ) + +// make 'for' construct for walking a list, keeping the iterator for later use +#define FOREACHINLISTKEEP(baseclass, member, head, iter) \ + LISTITER(baseclass, member) iter(head); \ + for (; !iter.IsPastEnd(); iter.MoveToNext() ) + +// make 'for' construct for deleting a list +#define FORDELETELIST(baseclass, member, head, iter) \ + for ( LISTITER(baseclass, member) iter(head), iter##next; \ + iter##next=iter, iter##next.IsPastEnd() || (iter##next.MoveToNext(),1), !iter.IsPastEnd(); \ + iter = iter##next) + +#ifdef PLATFORM_OPENBSD +#ifdef LIST_HEAD + #undef LIST_HEAD +#endif +#endif + +// get the pointer to the first element in the list +#define LIST_HEAD(listhead, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) +// get the pointer to the last element in the list +#define LIST_TAIL(listhead, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(listhead).Tail())) - _offsetof(baseclass, member) ) ) + +// get the pointer to the predecessor of the element +#define LIST_PRED(element, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(element).member.Pred())) - _offsetof(baseclass, member) ) ) +// get the pointer to the successor of the element +#define LIST_SUCC(element, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(element).member.Succ())) - _offsetof(baseclass, member) ) ) + + + +#endif /* include-once check. */ + diff --git a/SamTFE/Sources/Engine/Base/Lists.inl b/SamTFE/Sources/Engine/Base/Lists.inl index 88d37aaf..293c06a5 100644 --- a/SamTFE/Sources/Engine/Base/Lists.inl +++ b/SamTFE/Sources/Engine/Base/Lists.inl @@ -1,163 +1,178 @@ -#ifndef SE_INCL_LISTS_INL -#define SE_INCL_LISTS_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -/* Default constructor */ -inline CListNode::CListNode(void) -{ - // make a non-linked node - ln_Succ = NULL; - ln_Pred = NULL; -} -/* Copy constructor */ -inline CListNode::CListNode(const CListNode &lnOriginal) -{ - (void) lnOriginal; - // make a non-linked node - ln_Succ = NULL; - ln_Pred = NULL; -} -/* Destructor */ -inline CListNode::~CListNode(void) -{ - // if node is linked - if (IsLinked()) { - // remove it from list - Remove(); - } -} -/* Assignment. */ -inline CListNode &CListNode::operator=(const CListNode &lnOriginal) -{ - (void) lnOriginal; - // make a non-linked node - ln_Succ = NULL; - ln_Pred = NULL; - return *this; -} -/* Get successor of this node. */ -inline CListNode &CListNode::Succ(void) const -{ - ASSERT(IsLinked() && ln_Succ->IsLinked()); - return *ln_Succ; -} -/* Get predeccessor of this node. */ -inline CListNode &CListNode::Pred(void) const -{ - ASSERT(IsLinked() && ln_Pred->IsLinked()); - return *ln_Pred; -} -/* Get successor of this node for iteration. */ -inline CListNode &CListNode::IterationSucc(void) const -{ - ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); - return *ln_Succ; -} -/* Get predecessor of this node for iteration. */ -inline CListNode &CListNode::IterationPred(void) const -{ - ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); - return *ln_Pred; -} -/* Insert a node after current one during iteration. */ -inline void CListNode::IterationInsertAfter(CListNode &lnNew) -{ - ASSERT(!lnNew.IsLinked()); - ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); - ln_Succ->ln_Pred = &lnNew; - lnNew.ln_Succ = ln_Succ; - lnNew.ln_Pred = this; - ln_Succ = &lnNew; -} -/* Insert a node before current one during iteration. */ -inline void CListNode::IterationInsertBefore(CListNode &lnNew) -{ - ASSERT(!lnNew.IsLinked()); - ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); - ln_Pred->ln_Succ = &lnNew; - lnNew.ln_Pred = ln_Pred; - lnNew.ln_Succ = this; - ln_Pred = &lnNew; -} - -/* Check that this list node is head marker of list. */ -inline BOOL CListNode::IsHeadMarker(void) const -{ - // if this is in fact pointer to list.lh_Head - if (ln_Pred == NULL ) { - // it is end marker - return TRUE; - // otherwise - } else { - // it must be somewhere inside the list - ASSERT(IsLinked()); - return FALSE; - } -} - -/* Check that this list node is tail marker of list. */ -inline BOOL CListNode::IsTailMarker(void) const -{ - // if this is in fact pointer to list.lh_NULL - if (ln_Succ == NULL ) { - // it is end marker - return TRUE; - // otherwise - } else { - // it must be somewhere inside the list - ASSERT(IsLinked()); - return FALSE; - } -} - -/* Check if this list node is head of list. */ -inline BOOL CListNode::IsHead(void) const -{ - // it must be somewhere inside the list - ASSERT(IsLinked()); - - // if previous is list.lh_Head - return ln_Pred->ln_Pred == NULL; -} - -/* Check that this list node is tail of list. */ -inline BOOL CListNode::IsTail(void) const -{ - // it must be somewhere inside the list - ASSERT(IsLinked()); - - // if next is list.lh_NULL - return ln_Succ->ln_Succ == NULL; -} -///////////////////////////////////////////////////////////////////// -// CListHead implementations -/* Get list head. */ -inline CListNode &CListHead::Head(void) const -{ - ASSERT(IsValid() && lh_Head->IsLinked()); - return *lh_Head; -} -/* Get list tail. */ -inline CListNode &CListHead::Tail(void) const -{ - ASSERT(IsValid() && lh_Tail->IsLinked()); - return *lh_Tail; -} -/* Get list head for iteration. */ -inline CListNode &CListHead::IterationHead(void) const -{ - ASSERT(IsValid() && (lh_Head->IsTailMarker() || lh_Head->IsLinked())); - return *lh_Head; -} -/* Get list tail for iteration. */ -inline CListNode &CListHead::IterationTail(void) const -{ - ASSERT(IsValid() && (lh_Tail->IsHeadMarker() || lh_Tail->IsLinked())); - return *lh_Tail; -} - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_LISTS_INL +#define SE_INCL_LISTS_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +/* Default constructor */ +inline CListNode::CListNode(void) +{ + // make a non-linked node + ln_Succ = NULL; + ln_Pred = NULL; +} +/* Copy constructor */ +inline CListNode::CListNode(const CListNode &lnOriginal) +{ + (void) lnOriginal; + // make a non-linked node + ln_Succ = NULL; + ln_Pred = NULL; +} +/* Destructor */ +inline CListNode::~CListNode(void) +{ + // if node is linked + if (IsLinked()) { + // remove it from list + Remove(); + } +} +/* Assignment. */ +inline CListNode &CListNode::operator=(const CListNode &lnOriginal) +{ + (void) lnOriginal; + // make a non-linked node + ln_Succ = NULL; + ln_Pred = NULL; + return *this; +} +/* Get successor of this node. */ +inline CListNode &CListNode::Succ(void) const +{ + ASSERT(IsLinked() && ln_Succ->IsLinked()); + return *ln_Succ; +} +/* Get predeccessor of this node. */ +inline CListNode &CListNode::Pred(void) const +{ + ASSERT(IsLinked() && ln_Pred->IsLinked()); + return *ln_Pred; +} +/* Get successor of this node for iteration. */ +inline CListNode &CListNode::IterationSucc(void) const +{ + ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); + return *ln_Succ; +} +/* Get predecessor of this node for iteration. */ +inline CListNode &CListNode::IterationPred(void) const +{ + ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); + return *ln_Pred; +} +/* Insert a node after current one during iteration. */ +inline void CListNode::IterationInsertAfter(CListNode &lnNew) +{ + ASSERT(!lnNew.IsLinked()); + ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); + ln_Succ->ln_Pred = &lnNew; + lnNew.ln_Succ = ln_Succ; + lnNew.ln_Pred = this; + ln_Succ = &lnNew; +} +/* Insert a node before current one during iteration. */ +inline void CListNode::IterationInsertBefore(CListNode &lnNew) +{ + ASSERT(!lnNew.IsLinked()); + ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); + ln_Pred->ln_Succ = &lnNew; + lnNew.ln_Pred = ln_Pred; + lnNew.ln_Succ = this; + ln_Pred = &lnNew; +} + +/* Check that this list node is head marker of list. */ +inline BOOL CListNode::IsHeadMarker(void) const +{ + // if this is in fact pointer to list.lh_Head + if (ln_Pred == NULL ) { + // it is end marker + return TRUE; + // otherwise + } else { + // it must be somewhere inside the list + ASSERT(IsLinked()); + return FALSE; + } +} + +/* Check that this list node is tail marker of list. */ +inline BOOL CListNode::IsTailMarker(void) const +{ + // if this is in fact pointer to list.lh_NULL + if (ln_Succ == NULL ) { + // it is end marker + return TRUE; + // otherwise + } else { + // it must be somewhere inside the list + ASSERT(IsLinked()); + return FALSE; + } +} + +/* Check if this list node is head of list. */ +inline BOOL CListNode::IsHead(void) const +{ + // it must be somewhere inside the list + ASSERT(IsLinked()); + + // if previous is list.lh_Head + return ln_Pred->ln_Pred == NULL; +} + +/* Check that this list node is tail of list. */ +inline BOOL CListNode::IsTail(void) const +{ + // it must be somewhere inside the list + ASSERT(IsLinked()); + + // if next is list.lh_NULL + return ln_Succ->ln_Succ == NULL; +} +///////////////////////////////////////////////////////////////////// +// CListHead implementations +/* Get list head. */ +inline CListNode &CListHead::Head(void) const +{ + ASSERT(IsValid() && lh_Head->IsLinked()); + return *lh_Head; +} +/* Get list tail. */ +inline CListNode &CListHead::Tail(void) const +{ + ASSERT(IsValid() && lh_Tail->IsLinked()); + return *lh_Tail; +} +/* Get list head for iteration. */ +inline CListNode &CListHead::IterationHead(void) const +{ + ASSERT(IsValid() && (lh_Head->IsTailMarker() || lh_Head->IsLinked())); + return *lh_Head; +} +/* Get list tail for iteration. */ +inline CListNode &CListHead::IterationTail(void) const +{ + ASSERT(IsValid() && (lh_Tail->IsHeadMarker() || lh_Tail->IsLinked())); + return *lh_Tail; +} + + +#endif /* include-once check. */ + diff --git a/SamTFE/Sources/Engine/Base/NullSynchronization.cpp b/SamTFE/Sources/Engine/Base/NullSynchronization.cpp index 5c68c048..fe56fb30 100644 --- a/SamTFE/Sources/Engine/Base/NullSynchronization.cpp +++ b/SamTFE/Sources/Engine/Base/NullSynchronization.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "Engine/StdH.h" #include diff --git a/SamTFE/Sources/Engine/Base/Parser.y b/SamTFE/Sources/Engine/Base/Parser.y index d4e3f6ec..6784a9fd 100644 --- a/SamTFE/Sources/Engine/Base/Parser.y +++ b/SamTFE/Sources/Engine/Base/Parser.y @@ -1,1080 +1,1095 @@ -%{ -#include - -#include -#include -#include "ParsingSymbols.h" - -#include -#include - -%} - -%{ -// turn off over-helpful bit of bison... --ryan. -#ifdef __GNUC__ -#define __attribute__(x) -#endif - -#define YYERROR_VERBOSE 1 -// if error occurs in parsing -void yyerror(const char *str) -{ - // just report the string - _pShell->ErrorF("%s", str); -}; - -static BOOL _bExecNextElse = FALSE; -FLOAT fDummy = -666.0f; - -static INDEX _iStack = 0; -static UBYTE _ubStack[1024]; - -INDEX PushExpression(value &v) -{ - if (v.sttType==STT_FLOAT) { - FLOAT f = v.fFloat; - memcpy(_ubStack+_iStack, &f, sizeof(f)); - _iStack+=sizeof(f); - return sizeof(f); - } else if (v.sttType==STT_INDEX) { - INDEX i = v.iIndex; - memcpy(_ubStack+_iStack, &i, sizeof(i)); - _iStack+=sizeof(i); - return sizeof(i); - } else if (v.sttType==STT_STRING) { - CTString &str = _shell_astrTempStrings.Push(); - str = v.strString; - CTString *pstr = &str; - memcpy(_ubStack+_iStack, &pstr, sizeof(pstr)); - _iStack+=sizeof(pstr); - return sizeof(pstr); - } else { - return 0; - } -} - -BOOL MatchTypes(value &v1, value &v2) -{ - if (v1.sttType==STT_FLOAT && v2.sttType==STT_FLOAT) { - return TRUE; - } else if (v1.sttType==STT_STRING && v2.sttType==STT_STRING) { - return TRUE; - } else if (v1.sttType==STT_INDEX && v2.sttType==STT_INDEX) { - return TRUE; - } else { - v1.sttType = STT_ILLEGAL; - v2.sttType = STT_ILLEGAL; - _pShell->ErrorF("Type mismatch"); - return FALSE; - } -} - -void Declaration( - ULONG ulQualifiers, INDEX istType, CShellSymbol &ssNew, - INDEX (*pPreFunc)(INDEX), void (*pPostFunc)(INDEX)) -{ - // if external - if (ulQualifiers&SSF_EXTERNAL) { - // get it a new value - if (_shell_ast[istType].st_sttType==STT_INDEX - ||_shell_ast[istType].st_sttType==STT_FLOAT) { - _pvNextToDeclare = &_shell_afExtFloats.Push(); - } else if (_shell_ast[istType].st_sttType==STT_STRING) { - _pvNextToDeclare = &_shell_astrExtStrings.Push(); - } else { - NOTHING; - } - } - - // if not parsing an external declaration - if (_pvNextToDeclare==NULL) { - // error - _pShell->ErrorF("Only external declarations are supported"); - return; - } - - // if the symbol is declared already - if (ssNew.IsDeclared()) { - // if the declaration is not identical - if (!ShellTypeIsSame(ssNew.ss_istType, istType) || - ((ssNew.ss_ulFlags&SSF_CONSTANT)!=(ulQualifiers&SSF_CONSTANT))) { - // error - _pShell->ErrorF("Symbol '%s' is already declared diferrently", (const char *) ssNew.ss_strName); - return; - } - - // copy its value - if (_shell_ast[ssNew.ss_istType].st_sttType==STT_INDEX) { - *(INDEX*)_pvNextToDeclare = *(INDEX*)ssNew.ss_pvValue; - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FLOAT) { - *(FLOAT*)_pvNextToDeclare = *(FLOAT*)ssNew.ss_pvValue; - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_STRING) { - *(CTString*)_pvNextToDeclare = *(CTString*)ssNew.ss_pvValue; - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_ARRAY) { - NOTHING; // array values are not retained - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FUNCTION) { - NOTHING; // function values are not retained - } else { - // error - _pShell->ErrorF("'%s': old value couldn't be retained", (const char *) ssNew.ss_strName); - return; - } - } - - // set the type to given type - if (!ssNew.IsDeclared()) { - ssNew.ss_istType = ShellTypeMakeDuplicate(istType); - } - // set the value for the external symbol if not already set - if (ssNew.ss_pvValue==NULL || !(ulQualifiers&SSF_EXTERNAL)) { - ssNew.ss_pvValue = _pvNextToDeclare; - } - // remember qualifiers (if already predeclared - keep old flags) - ssNew.ss_ulFlags |= ulQualifiers; - // remember pre and post functions - if (ssNew.ss_pPreFunc==NULL) { - ssNew.ss_pPreFunc = (BOOL (*)(void *))pPreFunc; - } - if (ssNew.ss_pPostFunc==NULL) { - ssNew.ss_pPostFunc = (void (*)(void *))pPostFunc; - } -} - -void DoComparison(value &vRes, value &v0, value &v1, int token) -{ - MatchTypes(v0, v1); - - vRes.sttType = STT_INDEX; - if (v0.sttType == STT_FLOAT) { - switch (token) { - case '<': vRes.iIndex = v0.fFloat ': vRes.iIndex = v0.fFloat >v1.fFloat; break; - case '=': vRes.iIndex = v0.fFloat==v1.fFloat; break; - case '!': vRes.iIndex = v0.fFloat!=v1.fFloat; break; - case '}': vRes.iIndex = v0.fFloat>=v1.fFloat; break; - case '{': vRes.iIndex = v0.fFloat<=v1.fFloat; break; - default: ASSERT(FALSE); - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } - } else if (v0.sttType == STT_INDEX) { - switch (token) { - case '<': vRes.iIndex = v0.iIndex ': vRes.iIndex = v0.iIndex >v1.iIndex; break; - case '=': vRes.iIndex = v0.iIndex==v1.iIndex; break; - case '!': vRes.iIndex = v0.iIndex!=v1.iIndex; break; - case '}': vRes.iIndex = v0.iIndex>=v1.iIndex; break; - case '{': vRes.iIndex = v0.iIndex<=v1.iIndex; break; - default: ASSERT(FALSE); - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } - } else if (v0.sttType == STT_STRING) { - switch (token) { - case '<': vRes.iIndex = stricmp(v0.strString, v1.strString) < 0; break; - case '>': vRes.iIndex = stricmp(v0.strString, v1.strString) > 0; break; - case '=': vRes.iIndex = stricmp(v0.strString, v1.strString) == 0; break; - case '!': vRes.iIndex = stricmp(v0.strString, v1.strString) != 0; break; - case '}': vRes.iIndex = stricmp(v0.strString, v1.strString) >= 0; break; - case '{': vRes.iIndex = stricmp(v0.strString, v1.strString) <= 0; break; - default: ASSERT(FALSE); - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } - } else { - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } -} -%} - -/* BISON Declarations */ - -// we need to be reentrant! -%pure_parser - -%union { - value val; // for constants and expressions - arguments arg; // for function input arguments - ULONG ulFlags; // for declaration qualifiers - INDEX istType; // for types - CShellSymbol *pssSymbol; // for symbols - struct LValue lvLValue; - INDEX (*pPreFunc)(INDEX); // pre-set function for a variable - void (*pPostFunc)(INDEX); // post-set function for a variable -} - -%{ - extern int yylex(YYSTYPE *lvalp); -%} - -%token c_float -%token c_int -%token c_string -%token c_char - -%token identifier - -%token k_INDEX -%token k_FLOAT -%token k_CTString -%token k_void -%token k_const -%token k_user -%token k_persistent -%token k_extern -%token k_pre -%token k_post -%token k_help -%token k_if -%token k_else -%token k_else_if -%token SHL -%token SHR -%token EQ -%token NEQ -%token GEQ -%token LEQ -%token LOGAND -%token LOGOR -%token block_beg -%token block_end - -%type lvalue -%type expression -%type declaration_qualifiers -%type opt_string -%type type_specifier -%type parameter_list -%type parameter_list_opt -%type pre_func_opt -%type post_func_opt -%type argument_expression_list_opt -%type argument_expression_list - -%right '=' -%left LOGAND LOGOR -%left '&' '^' '|' -%left '<' '>' EQ NEQ LEQ GEQ -%left SHL -%left SHR -%left '-' '+' -%left '*' '/' '%' -%left TYPECAST -%left SIGN '!' - -%start program - -%% - -/*///////////////////////////////////////////////////////// - * Global structure of the source file. - */ -program -: declaration -| statements -; - -block -: block_beg statements block_end -| block_beg statements block_end -; - -statements -: /* null */ -| statement statements -; - -declaration_qualifiers -: /* nothing */ { - $$ = 0; -} -| declaration_qualifiers k_const { - $$ = $1 | SSF_CONSTANT; -} -| declaration_qualifiers k_user { - $$ = $1 | SSF_USER; -} -| declaration_qualifiers k_persistent { - $$ = $1 | SSF_PERSISTENT; -} -| declaration_qualifiers k_extern { - $$ = $1 | SSF_EXTERNAL; -} - -opt_string -: /* nothing */ { - $$.strString = ""; -} -| c_string { - // !!!! remove this option - //_pShell->ErrorF("Warning: symbol comments are not supported"); - $$.strString = $1.strString; -} - -type_specifier -: k_FLOAT { - $$ = ShellTypeNewFloat(); -} -| k_INDEX { - $$ = ShellTypeNewIndex(); -} -| k_CTString { - $$ = ShellTypeNewString(); -} -| k_void { - $$ = ShellTypeNewVoid(); -} - -pre_func_opt -: { - $$ = NULL; -} -| k_pre ':' identifier { - if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION - ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_INDEX - ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument - ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { - _pShell->ErrorF("'%s' must return 'INDEX' and take 'INDEX' as input", (const char *) $3->ss_strName); - } else { - void *pv = $3->ss_pvValue; - $$ = (INDEX(*)(INDEX))$3->ss_pvValue; - } -} - -post_func_opt -: { - $$ = NULL; -} -| k_post ':' identifier { - if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION - ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_VOID - ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument - ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { - _pShell->ErrorF("'%s' must return 'void' and take 'INDEX' as input", (const char *) $3->ss_strName); - } else { - $$ = (void(*)(INDEX))$3->ss_pvValue; - } -} -; - -parameter_list_opt -: /* nothing */ { - $$ = ShellTypeNewFunction(0); - ShellTypeAddFunctionArgument($$, ShellTypeNewVoid()); -} -| parameter_list { - $$ = $1; -} -; - -parameter_list -: type_specifier { - $$ = ShellTypeNewFunction(0); - ShellTypeAddFunctionArgument($$, $1); -} -/*| identifier type_specifier { - $$ = ShellTypeNewFunction(0); - ShellTypeAddFunctionArgument($$, $2); -}*/ -| parameter_list ',' type_specifier { - $$ = $1; - ShellTypeAddFunctionArgument($$, $3); -} -/*| parameter_list ',' identifier type_specifier { - $$ = $1; - ShellTypeAddFunctionArgument($$, $4); -} */ -; - -declaration -: declaration_qualifiers type_specifier identifier pre_func_opt post_func_opt opt_string ';' { - Declaration($1, $2, *$3, $4, $5); - ShellTypeDelete($2); -} -| declaration_qualifiers type_specifier identifier '(' parameter_list_opt ')' opt_string ';' { - // take function from the parameter list and set its return type - _shell_ast[$5].st_istBaseType = $2; - $2 = $5; - // declare it - Declaration($1, $2, *$3, NULL, NULL); - // free the type (declaration will make a copy) - ShellTypeDelete($2); -} -| declaration_qualifiers type_specifier identifier '[' expression ']' pre_func_opt post_func_opt opt_string ';' { - if ($5.sttType!=STT_INDEX) { - _pShell->ErrorF("Array size is not integral"); - } - $2 = ShellTypeNewArray($2, $5.iIndex); - Declaration($1, $2, *$3, NULL, NULL); - ShellTypeDelete($2); -} - -statement -: ';' { - // dummy -} -| block { - // dummy -} -| expression ';' { - // print its value - if ($1.sttType == STT_VOID) { - NOTHING; - } else if ($1.sttType == STT_FLOAT) { - CPrintF("%g\n", $1.fFloat); - } else if ($1.sttType == STT_STRING) { - CPrintF("\"%s\"\n", $1.strString); - } else if ($1.sttType == STT_INDEX) { - CPrintF("%d(0x%08X)\n", $1.iIndex, $1.iIndex); - } else { - _pShell->ErrorF("Expression cannot be printed"); - } -} -| lvalue '=' expression ';' { - // if it is constant - if ($1.lv_pssSymbol->ss_ulFlags&SSF_CONSTANT) { - _pShell->ErrorF("Symbol '%s' is a constant", (const char *) $1.lv_pssSymbol->ss_strName); - // if it is not constant - } else { - // if it can be changed - if ($1.lv_pssSymbol->ss_pPreFunc==NULL || $1.lv_pssSymbol->ss_pPreFunc($1.lv_pvAddress)) { - // if floats - if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_FLOAT) { - // assign value - *(FLOAT*)$1.lv_pvAddress = $3.fFloat; - // if indices - } else if ($1.lv_sttType == STT_INDEX && $3.sttType==STT_INDEX) { - // assign value - *(INDEX*)$1.lv_pvAddress = $3.iIndex; - - // if strings - } else if ($1.lv_sttType == STT_STRING && $3.sttType==STT_STRING) { - // assign value - *(CTString*)$1.lv_pvAddress = $3.strString; - - // if assigning index to float - } else if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_INDEX) { - *(FLOAT*)$1.lv_pvAddress = $3.iIndex; - // otherwise - } else { - // error - _pShell->ErrorF("Cannot assign: different types"); - } - - // call post-change function - if ($1.lv_pssSymbol->ss_pPostFunc!=NULL) { - $1.lv_pssSymbol->ss_pPostFunc($1.lv_pvAddress); - } - } - } -} -| declaration_qualifiers type_specifier identifier '=' expression ';' { - Declaration($1, $2, *$3, NULL, NULL); - ShellTypeDelete($2); - - CShellSymbol &ssSymbol = *$3; - // if it is constant - if (ssSymbol.ss_ulFlags&SSF_CONSTANT) { - // error - _pShell->ErrorF("Symbol '%s' is a constant", (const char *) ssSymbol.ss_strName); - } - - // get symbol type - ShellTypeType stt = _shell_ast[$2].st_sttType; - - // if floats - if (stt == STT_FLOAT && $5.sttType==STT_FLOAT) { - // assign value - *(FLOAT*)ssSymbol.ss_pvValue = $5.fFloat; - // if indices - } else if (stt == STT_INDEX && $5.sttType==STT_INDEX) { - // assign value - *(INDEX*)ssSymbol.ss_pvValue = $5.iIndex; - // if strings - } else if (stt == STT_STRING && $5.sttType==STT_STRING) { - // assign value - *(CTString*)ssSymbol.ss_pvValue = $5.strString; - // !!!! remove this conversion - } else if (stt == STT_FLOAT && $5.sttType==STT_INDEX) { - _pShell->ErrorF("Warning: assigning INDEX to FLOAT!"); - *(FLOAT*)ssSymbol.ss_pvValue = $5.iIndex; - } else { - _pShell->ErrorF("Symbol '%s' and its initializer have different types", (const char *) ssSymbol.ss_strName); - } -} -| k_help identifier { -extern void PrintShellSymbolHelp(const CTString &strSymbol); - PrintShellSymbolHelp($2->ss_strName); -} -| k_help identifier '(' ')' { -extern void PrintShellSymbolHelp(const CTString &strSymbol); - PrintShellSymbolHelp($2->ss_strName); -} -| k_help identifier '[' ']' { -extern void PrintShellSymbolHelp(const CTString &strSymbol); - PrintShellSymbolHelp($2->ss_strName); -} -| k_if '(' expression ')' { - _bExecNextBlock = FALSE; - if ($3.sttType == STT_INDEX) { - _bExecNextBlock = $3.iIndex!=0; - } else if ($3.sttType == STT_FLOAT) { - _bExecNextBlock = $3.fFloat!=0; - } else { - _pShell->ErrorF("If expression is not integral"); - } - $1 = _bExecNextBlock; -} block { - _bExecNextElse = !$1; - _bExecNextBlock = TRUE; -} opt_else -; - -opt_else -: /* nothing */ - -| k_else_if '(' expression ')' { - if (_bExecNextElse) { - _bExecNextBlock = FALSE; - if ($3.sttType == STT_INDEX) { - _bExecNextBlock = $3.iIndex!=0; - } else if ($3.sttType == STT_FLOAT) { - _bExecNextBlock = $3.fFloat!=0; - } else { - _pShell->ErrorF("If expression is not integral"); - } - $1 = _bExecNextBlock; - } else { - _bExecNextBlock = FALSE; - _bExecNextElse = FALSE; - $1 = TRUE; - } -} block { - _bExecNextElse = !$1; - _bExecNextBlock = TRUE; -} opt_else - -| k_else { - _bExecNextBlock = _bExecNextElse; -} block { - _bExecNextBlock = TRUE; -} -; - -lvalue -: identifier { - CShellSymbol &ssSymbol = *$1; - const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; - - $$.lv_pssSymbol = &ssSymbol; - if (!ssSymbol.IsDeclared()) { - // error - _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); - fDummy = -666; - $$.lv_sttType = STT_VOID; - $$.lv_pvAddress = &fDummy; - // if the identifier is a float, int or string - } else if (stType.st_sttType==STT_FLOAT || stType.st_sttType==STT_INDEX || stType.st_sttType==STT_STRING) { - // get its value and type - $$.lv_sttType = stType.st_sttType; - $$.lv_pvAddress = ssSymbol.ss_pvValue; - // if the identifier is something else - } else { - // error - _pShell->ErrorF("'%s' doesn't have a value", (const char *) $1->ss_strName); - fDummy = -666.0f; - $$.lv_sttType = STT_VOID; - $$.lv_pvAddress = &fDummy; - } -} -| identifier '[' expression ']' { - CShellSymbol &ssSymbol = *$1; - const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; - $$.lv_pssSymbol = &ssSymbol; - - int iIndex = 0; - // if subscript is index - if ($3.sttType==STT_INDEX) { - // get the index - iIndex = $3.iIndex; - // if subscript is not index - } else { - // error - _pShell->ErrorF("Array subscript is not integral"); - } - // if the symbol is array - if (stType.st_sttType==STT_ARRAY) { - const ShellType &stBase = _shell_ast[stType.st_istBaseType]; - // if it is float or int array - if (stBase.st_sttType==STT_FLOAT || stBase.st_sttType==STT_INDEX) { - // if the index is out of range - if (iIndex<0 || iIndex>=stType.st_ctArraySize) { - _pShell->ErrorF("Array member out of range"); - fDummy = -666.0f; - $$.lv_pvAddress = &fDummy; - } else { - // get its value and type - $$.lv_sttType = stBase.st_sttType; - $$.lv_pvAddress = (FLOAT*)ssSymbol.ss_pvValue+iIndex; - } - } - } else { - _pShell->ErrorF("'%s[]' doesn't have a value", (const char *) $1->ss_strName); - fDummy = -666.0f; - $$.lv_pvAddress = &fDummy; - } -} -; - -argument_expression_list_opt -: /* nothing */ { - $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); - ShellTypeAddFunctionArgument($$.istType, ShellTypeNewVoid()); - $$.ctBytes = 0; -} -| argument_expression_list { - $$ = $1; -} -; - -argument_expression_list -: expression { - $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); - ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($1.sttType)); - $$.ctBytes = PushExpression($1); -} -| argument_expression_list ',' expression { - $$ = $1; - ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($3.sttType)); - $$.ctBytes += PushExpression($3); -} - -expression -: c_float { - $$.sttType = STT_FLOAT; - $$.fFloat = $1.fFloat; -} -| c_int { - $$.sttType = STT_INDEX; - $$.iIndex = $1.iIndex; -} -| c_string { - $$.sttType = STT_STRING; - $$.strString = $1.strString; -} -| lvalue { - // get its value - $$.sttType = $1.lv_sttType; - if ($1.lv_sttType==STT_VOID) { - NOTHING; - } else if ($1.lv_sttType==STT_FLOAT) { - $$.fFloat = *(FLOAT*)$1.lv_pvAddress; - } else if ($1.lv_sttType==STT_INDEX) { - $$.iIndex = *(INDEX*)$1.lv_pvAddress; - } else if ($1.lv_sttType==STT_STRING) { - $$.strString = (const char*)*(CTString*)$1.lv_pvAddress; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - _pShell->ErrorF("'%s' is of wrong type", (const char *) $1.lv_pssSymbol->ss_strName); - } -} -/* shift */ -| expression SHL expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex<<$3.iIndex; - } else { - _pShell->ErrorF("Wrong arguments for '<<'"); - $$.sttType = STT_INDEX; - $$.iIndex = -666; - } -} -| expression SHR expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex>>$3.iIndex; - } else { - _pShell->ErrorF("Wrong arguments for '>>'"); - $$.sttType = STT_INDEX; - $$.iIndex = -666; - } -} -/* bitwise operators */ -| expression '&' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'&' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex&$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -| expression '|' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'|' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex|$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -| expression '^' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'^' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex^$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -/* logical operators */ -| expression LOGAND expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'&&' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex&&$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -| expression LOGOR expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'||' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex||$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -/* addition */ -| expression '+' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat+$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex+$3.iIndex; - } else if ($1.sttType == STT_STRING) { - CTString &strNew = _shell_astrTempStrings.Push(); - strNew = CTString($1.strString)+$3.strString; - $$.strString = (const char*)strNew; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -/* substraction */ -| expression '-' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat-$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex-$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -/* multiplication */ -| expression '*' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat*$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex*$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - -} -/* division */ -| expression '/' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat/$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - if ($3.iIndex==0) { - _pShell->ErrorF("Division by zero!\n"); - $$.iIndex = 0; - } else { - $$.iIndex = $1.iIndex/$3.iIndex; - } - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - -} - -/* modulo */ -| expression '%' expression { - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'%' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex%$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - -} - -/* comparisons */ -| expression '<' expression { - DoComparison($$, $1, $3, '<'); -} -| expression '>' expression { - DoComparison($$, $1, $3, '>'); -} -| expression EQ expression { - DoComparison($$, $1, $3, '='); -} -| expression NEQ expression { - DoComparison($$, $1, $3, '!'); -} -| expression GEQ expression { - DoComparison($$, $1, $3, '}'); -} -| expression LEQ expression { - DoComparison($$, $1, $3, '{'); -} - -// unary minus - -| '-' expression %prec SIGN { - $$.sttType = $2.sttType; - if ($2.sttType == STT_FLOAT) { - $$.fFloat = -$2.fFloat; - } else if ($2.sttType == STT_INDEX) { - $$.iIndex = -$2.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -// unary plus - -| '+' expression %prec SIGN { - $$.sttType = $2.sttType; - if ($2.sttType == STT_FLOAT) { - $$.fFloat = $2.fFloat; - } else if ($2.sttType == STT_INDEX) { - $$.iIndex = $2.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -| '!' expression %prec SIGN { - $$.sttType = $2.sttType; - if ($2.sttType == STT_FLOAT) { - _pShell->ErrorF("'!' is illegal for FLOAT values"); - $$.fFloat = $2.fFloat; - } else if ($2.sttType == STT_INDEX) { - $$.iIndex = !$2.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -| '(' k_FLOAT ')' expression %prec TYPECAST { - $$.sttType = STT_FLOAT; - if ($4.sttType == STT_FLOAT) { - $$.fFloat = $4.fFloat; - } else if ($4.sttType == STT_INDEX) { - $$.fFloat = FLOAT($4.iIndex); - } else if ($4.sttType == STT_STRING) { - $$.fFloat = atof($4.strString); - } else { - _pShell->ErrorF("Cannot convert to FLOAT"); - $$.sttType = STT_VOID; - } -} - -| '(' k_INDEX ')' expression %prec TYPECAST { - $$.sttType = STT_INDEX; - if ($4.sttType == STT_FLOAT) { - $$.iIndex = INDEX($4.fFloat); - } else if ($4.sttType == STT_INDEX) { - $$.iIndex = $4.iIndex; - } else if ($4.sttType == STT_STRING) { - $$.iIndex = atol($4.strString); - } else { - _pShell->ErrorF("Cannot convert to INDEX"); - $$.sttType = STT_VOID; - } -} - -| '(' k_CTString ')' expression %prec TYPECAST { - CTString &strNew = _shell_astrTempStrings.Push(); - $$.sttType = STT_STRING; - if ($4.sttType == STT_FLOAT) { - strNew.PrintF("%g", $4.fFloat); - } else if ($4.sttType == STT_INDEX) { - strNew.PrintF("%d", $4.iIndex); - } else if ($4.sttType == STT_STRING) { - strNew = $4.strString; - } else { - _pShell->ErrorF("Cannot convert to CTString"); - $$.sttType = STT_VOID; - } - $$.strString = (const char*)strNew; -} - -// function call -| identifier '(' argument_expression_list_opt ')' { - // if the identifier is not declared - if (!$1->IsDeclared()) { - // error - _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); - // if the identifier is declared - } else { - // get its type - ShellType &stFunc = _shell_ast[$1->ss_istType]; - - // if the identifier is a function - if (stFunc.st_sttType==STT_FUNCTION) { - // determine result type - ShellType &stResult = _shell_ast[stFunc.st_istBaseType]; - // match argument list result to that result - _shell_ast[_shell_ast[$3.istType].st_istBaseType].st_sttType = stResult.st_sttType; - // if types are same - if (ShellTypeIsSame($3.istType, $1->ss_istType)) { - bool callfunc = true; - -// !!! FIXME: maybe just dump the win32 codepath here? This will break on Win64, and maybe break on different compilers/compiler versions, etc. -#ifdef PLATFORM_WIN32 - #define CALLPARAMS - #define FUNCSIG void - #define PUSHPARAMS memcpy(_alloca($3.ctBytes), _ubStack+_iStack-$3.ctBytes, $3.ctBytes); -#else - // This is possibly more portable, but no less scary than the alloca hack. - #define MAXSCRIPTFUNCARGS 5 - void *ARG[MAXSCRIPTFUNCARGS]; - if (($3.ctBytes > (int32_t)sizeof (ARG))) - { - _pShell->ErrorF("Function '%s' has too many arguments!", (const char *) $1->ss_strName); - callfunc = false; - } - else - { - memcpy(ARG, _ubStack+_iStack-$3.ctBytes, $3.ctBytes); - memset(((char *) ARG) + $3.ctBytes, '\0', sizeof (ARG) - $3.ctBytes); - } - #define PUSHPARAMS - #define FUNCSIG void*, void*, void*, void*, void* - #define CALLPARAMS ARG[0], ARG[1], ARG[2], ARG[3], ARG[4] -#endif - - if (callfunc) { - // if void - if (stResult.st_sttType==STT_VOID) { - // just call the function - $$.sttType = STT_VOID; - PUSHPARAMS; - ((void (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - // if index - } else if (stResult.st_sttType==STT_INDEX) { - // call the function and return result - $$.sttType = STT_INDEX; - PUSHPARAMS; - $$.iIndex = ((INDEX (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - // if float - } else if (stResult.st_sttType==STT_FLOAT) { - // call the function and return result - $$.sttType = STT_FLOAT; - PUSHPARAMS; - $$.fFloat = ((FLOAT (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - // if string - } else if (stResult.st_sttType==STT_STRING) { - // call the function and return result - $$.sttType = STT_STRING; - CTString &strNew = _shell_astrTempStrings.Push(); - PUSHPARAMS; - strNew = ((CTString (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - $$.strString = (const char*)strNew; - } else { - ASSERT(FALSE); - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - } - // if types are different - } else { - // error - $$.sttType = STT_VOID; - _pShell->ErrorF("Wrong parameters for '%s'", (const char *) $1->ss_strName); - } - // if the identifier is something else - } else { - // error - $$.sttType = STT_VOID; - _pShell->ErrorF("Can't call '%s'", (const char *) $1->ss_strName); - } - } - - // pop arguments and free type info - _iStack-=$3.ctBytes; - ShellTypeDelete($3.istType); -} -// brackets -| '(' expression ')' { - $$ = $2; -} -; - -%% +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include + +#include +#include +#include "ParsingSymbols.h" + +#include +#include + +%} + +%{ +// turn off over-helpful bit of bison... --ryan. +#ifdef __GNUC__ +#define __attribute__(x) +#endif + +#define YYERROR_VERBOSE 1 +// if error occurs in parsing +void yyerror(const char *str) +{ + // just report the string + _pShell->ErrorF("%s", str); +}; + +static BOOL _bExecNextElse = FALSE; +FLOAT fDummy = -666.0f; + +static INDEX _iStack = 0; +static UBYTE _ubStack[1024]; + +INDEX PushExpression(value &v) +{ + if (v.sttType==STT_FLOAT) { + FLOAT f = v.fFloat; + memcpy(_ubStack+_iStack, &f, sizeof(f)); + _iStack+=sizeof(f); + return sizeof(f); + } else if (v.sttType==STT_INDEX) { + INDEX i = v.iIndex; + memcpy(_ubStack+_iStack, &i, sizeof(i)); + _iStack+=sizeof(i); + return sizeof(i); + } else if (v.sttType==STT_STRING) { + CTString &str = _shell_astrTempStrings.Push(); + str = v.strString; + CTString *pstr = &str; + memcpy(_ubStack+_iStack, &pstr, sizeof(pstr)); + _iStack+=sizeof(pstr); + return sizeof(pstr); + } else { + return 0; + } +} + +BOOL MatchTypes(value &v1, value &v2) +{ + if (v1.sttType==STT_FLOAT && v2.sttType==STT_FLOAT) { + return TRUE; + } else if (v1.sttType==STT_STRING && v2.sttType==STT_STRING) { + return TRUE; + } else if (v1.sttType==STT_INDEX && v2.sttType==STT_INDEX) { + return TRUE; + } else { + v1.sttType = STT_ILLEGAL; + v2.sttType = STT_ILLEGAL; + _pShell->ErrorF("Type mismatch"); + return FALSE; + } +} + +void Declaration( + ULONG ulQualifiers, INDEX istType, CShellSymbol &ssNew, + INDEX (*pPreFunc)(INDEX), void (*pPostFunc)(INDEX)) +{ + // if external + if (ulQualifiers&SSF_EXTERNAL) { + // get it a new value + if (_shell_ast[istType].st_sttType==STT_INDEX + ||_shell_ast[istType].st_sttType==STT_FLOAT) { + _pvNextToDeclare = &_shell_afExtFloats.Push(); + } else if (_shell_ast[istType].st_sttType==STT_STRING) { + _pvNextToDeclare = &_shell_astrExtStrings.Push(); + } else { + NOTHING; + } + } + + // if not parsing an external declaration + if (_pvNextToDeclare==NULL) { + // error + _pShell->ErrorF("Only external declarations are supported"); + return; + } + + // if the symbol is declared already + if (ssNew.IsDeclared()) { + // if the declaration is not identical + if (!ShellTypeIsSame(ssNew.ss_istType, istType) || + ((ssNew.ss_ulFlags&SSF_CONSTANT)!=(ulQualifiers&SSF_CONSTANT))) { + // error + _pShell->ErrorF("Symbol '%s' is already declared diferrently", (const char *) ssNew.ss_strName); + return; + } + + // copy its value + if (_shell_ast[ssNew.ss_istType].st_sttType==STT_INDEX) { + *(INDEX*)_pvNextToDeclare = *(INDEX*)ssNew.ss_pvValue; + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FLOAT) { + *(FLOAT*)_pvNextToDeclare = *(FLOAT*)ssNew.ss_pvValue; + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_STRING) { + *(CTString*)_pvNextToDeclare = *(CTString*)ssNew.ss_pvValue; + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_ARRAY) { + NOTHING; // array values are not retained + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FUNCTION) { + NOTHING; // function values are not retained + } else { + // error + _pShell->ErrorF("'%s': old value couldn't be retained", (const char *) ssNew.ss_strName); + return; + } + } + + // set the type to given type + if (!ssNew.IsDeclared()) { + ssNew.ss_istType = ShellTypeMakeDuplicate(istType); + } + // set the value for the external symbol if not already set + if (ssNew.ss_pvValue==NULL || !(ulQualifiers&SSF_EXTERNAL)) { + ssNew.ss_pvValue = _pvNextToDeclare; + } + // remember qualifiers (if already predeclared - keep old flags) + ssNew.ss_ulFlags |= ulQualifiers; + // remember pre and post functions + if (ssNew.ss_pPreFunc==NULL) { + ssNew.ss_pPreFunc = (BOOL (*)(void *))pPreFunc; + } + if (ssNew.ss_pPostFunc==NULL) { + ssNew.ss_pPostFunc = (void (*)(void *))pPostFunc; + } +} + +void DoComparison(value &vRes, value &v0, value &v1, int token) +{ + MatchTypes(v0, v1); + + vRes.sttType = STT_INDEX; + if (v0.sttType == STT_FLOAT) { + switch (token) { + case '<': vRes.iIndex = v0.fFloat ': vRes.iIndex = v0.fFloat >v1.fFloat; break; + case '=': vRes.iIndex = v0.fFloat==v1.fFloat; break; + case '!': vRes.iIndex = v0.fFloat!=v1.fFloat; break; + case '}': vRes.iIndex = v0.fFloat>=v1.fFloat; break; + case '{': vRes.iIndex = v0.fFloat<=v1.fFloat; break; + default: ASSERT(FALSE); + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } + } else if (v0.sttType == STT_INDEX) { + switch (token) { + case '<': vRes.iIndex = v0.iIndex ': vRes.iIndex = v0.iIndex >v1.iIndex; break; + case '=': vRes.iIndex = v0.iIndex==v1.iIndex; break; + case '!': vRes.iIndex = v0.iIndex!=v1.iIndex; break; + case '}': vRes.iIndex = v0.iIndex>=v1.iIndex; break; + case '{': vRes.iIndex = v0.iIndex<=v1.iIndex; break; + default: ASSERT(FALSE); + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } + } else if (v0.sttType == STT_STRING) { + switch (token) { + case '<': vRes.iIndex = stricmp(v0.strString, v1.strString) < 0; break; + case '>': vRes.iIndex = stricmp(v0.strString, v1.strString) > 0; break; + case '=': vRes.iIndex = stricmp(v0.strString, v1.strString) == 0; break; + case '!': vRes.iIndex = stricmp(v0.strString, v1.strString) != 0; break; + case '}': vRes.iIndex = stricmp(v0.strString, v1.strString) >= 0; break; + case '{': vRes.iIndex = stricmp(v0.strString, v1.strString) <= 0; break; + default: ASSERT(FALSE); + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } + } else { + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } +} +%} + +/* BISON Declarations */ + +// we need to be reentrant! +%pure_parser + +%union { + value val; // for constants and expressions + arguments arg; // for function input arguments + ULONG ulFlags; // for declaration qualifiers + INDEX istType; // for types + CShellSymbol *pssSymbol; // for symbols + struct LValue lvLValue; + INDEX (*pPreFunc)(INDEX); // pre-set function for a variable + void (*pPostFunc)(INDEX); // post-set function for a variable +} + +%{ + extern int yylex(YYSTYPE *lvalp); +%} + +%token c_float +%token c_int +%token c_string +%token c_char + +%token identifier + +%token k_INDEX +%token k_FLOAT +%token k_CTString +%token k_void +%token k_const +%token k_user +%token k_persistent +%token k_extern +%token k_pre +%token k_post +%token k_help +%token k_if +%token k_else +%token k_else_if +%token SHL +%token SHR +%token EQ +%token NEQ +%token GEQ +%token LEQ +%token LOGAND +%token LOGOR +%token block_beg +%token block_end + +%type lvalue +%type expression +%type declaration_qualifiers +%type opt_string +%type type_specifier +%type parameter_list +%type parameter_list_opt +%type pre_func_opt +%type post_func_opt +%type argument_expression_list_opt +%type argument_expression_list + +%right '=' +%left LOGAND LOGOR +%left '&' '^' '|' +%left '<' '>' EQ NEQ LEQ GEQ +%left SHL +%left SHR +%left '-' '+' +%left '*' '/' '%' +%left TYPECAST +%left SIGN '!' + +%start program + +%% + +/*///////////////////////////////////////////////////////// + * Global structure of the source file. + */ +program +: declaration +| statements +; + +block +: block_beg statements block_end +| block_beg statements block_end +; + +statements +: /* null */ +| statement statements +; + +declaration_qualifiers +: /* nothing */ { + $$ = 0; +} +| declaration_qualifiers k_const { + $$ = $1 | SSF_CONSTANT; +} +| declaration_qualifiers k_user { + $$ = $1 | SSF_USER; +} +| declaration_qualifiers k_persistent { + $$ = $1 | SSF_PERSISTENT; +} +| declaration_qualifiers k_extern { + $$ = $1 | SSF_EXTERNAL; +} + +opt_string +: /* nothing */ { + $$.strString = ""; +} +| c_string { + // !!!! remove this option + //_pShell->ErrorF("Warning: symbol comments are not supported"); + $$.strString = $1.strString; +} + +type_specifier +: k_FLOAT { + $$ = ShellTypeNewFloat(); +} +| k_INDEX { + $$ = ShellTypeNewIndex(); +} +| k_CTString { + $$ = ShellTypeNewString(); +} +| k_void { + $$ = ShellTypeNewVoid(); +} + +pre_func_opt +: { + $$ = NULL; +} +| k_pre ':' identifier { + if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION + ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_INDEX + ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument + ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { + _pShell->ErrorF("'%s' must return 'INDEX' and take 'INDEX' as input", (const char *) $3->ss_strName); + } else { + void *pv = $3->ss_pvValue; + $$ = (INDEX(*)(INDEX))$3->ss_pvValue; + } +} + +post_func_opt +: { + $$ = NULL; +} +| k_post ':' identifier { + if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION + ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_VOID + ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument + ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { + _pShell->ErrorF("'%s' must return 'void' and take 'INDEX' as input", (const char *) $3->ss_strName); + } else { + $$ = (void(*)(INDEX))$3->ss_pvValue; + } +} +; + +parameter_list_opt +: /* nothing */ { + $$ = ShellTypeNewFunction(0); + ShellTypeAddFunctionArgument($$, ShellTypeNewVoid()); +} +| parameter_list { + $$ = $1; +} +; + +parameter_list +: type_specifier { + $$ = ShellTypeNewFunction(0); + ShellTypeAddFunctionArgument($$, $1); +} +/*| identifier type_specifier { + $$ = ShellTypeNewFunction(0); + ShellTypeAddFunctionArgument($$, $2); +}*/ +| parameter_list ',' type_specifier { + $$ = $1; + ShellTypeAddFunctionArgument($$, $3); +} +/*| parameter_list ',' identifier type_specifier { + $$ = $1; + ShellTypeAddFunctionArgument($$, $4); +} */ +; + +declaration +: declaration_qualifiers type_specifier identifier pre_func_opt post_func_opt opt_string ';' { + Declaration($1, $2, *$3, $4, $5); + ShellTypeDelete($2); +} +| declaration_qualifiers type_specifier identifier '(' parameter_list_opt ')' opt_string ';' { + // take function from the parameter list and set its return type + _shell_ast[$5].st_istBaseType = $2; + $2 = $5; + // declare it + Declaration($1, $2, *$3, NULL, NULL); + // free the type (declaration will make a copy) + ShellTypeDelete($2); +} +| declaration_qualifiers type_specifier identifier '[' expression ']' pre_func_opt post_func_opt opt_string ';' { + if ($5.sttType!=STT_INDEX) { + _pShell->ErrorF("Array size is not integral"); + } + $2 = ShellTypeNewArray($2, $5.iIndex); + Declaration($1, $2, *$3, NULL, NULL); + ShellTypeDelete($2); +} + +statement +: ';' { + // dummy +} +| block { + // dummy +} +| expression ';' { + // print its value + if ($1.sttType == STT_VOID) { + NOTHING; + } else if ($1.sttType == STT_FLOAT) { + CPrintF("%g\n", $1.fFloat); + } else if ($1.sttType == STT_STRING) { + CPrintF("\"%s\"\n", $1.strString); + } else if ($1.sttType == STT_INDEX) { + CPrintF("%d(0x%08X)\n", $1.iIndex, $1.iIndex); + } else { + _pShell->ErrorF("Expression cannot be printed"); + } +} +| lvalue '=' expression ';' { + // if it is constant + if ($1.lv_pssSymbol->ss_ulFlags&SSF_CONSTANT) { + _pShell->ErrorF("Symbol '%s' is a constant", (const char *) $1.lv_pssSymbol->ss_strName); + // if it is not constant + } else { + // if it can be changed + if ($1.lv_pssSymbol->ss_pPreFunc==NULL || $1.lv_pssSymbol->ss_pPreFunc($1.lv_pvAddress)) { + // if floats + if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_FLOAT) { + // assign value + *(FLOAT*)$1.lv_pvAddress = $3.fFloat; + // if indices + } else if ($1.lv_sttType == STT_INDEX && $3.sttType==STT_INDEX) { + // assign value + *(INDEX*)$1.lv_pvAddress = $3.iIndex; + + // if strings + } else if ($1.lv_sttType == STT_STRING && $3.sttType==STT_STRING) { + // assign value + *(CTString*)$1.lv_pvAddress = $3.strString; + + // if assigning index to float + } else if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_INDEX) { + *(FLOAT*)$1.lv_pvAddress = $3.iIndex; + // otherwise + } else { + // error + _pShell->ErrorF("Cannot assign: different types"); + } + + // call post-change function + if ($1.lv_pssSymbol->ss_pPostFunc!=NULL) { + $1.lv_pssSymbol->ss_pPostFunc($1.lv_pvAddress); + } + } + } +} +| declaration_qualifiers type_specifier identifier '=' expression ';' { + Declaration($1, $2, *$3, NULL, NULL); + ShellTypeDelete($2); + + CShellSymbol &ssSymbol = *$3; + // if it is constant + if (ssSymbol.ss_ulFlags&SSF_CONSTANT) { + // error + _pShell->ErrorF("Symbol '%s' is a constant", (const char *) ssSymbol.ss_strName); + } + + // get symbol type + ShellTypeType stt = _shell_ast[$2].st_sttType; + + // if floats + if (stt == STT_FLOAT && $5.sttType==STT_FLOAT) { + // assign value + *(FLOAT*)ssSymbol.ss_pvValue = $5.fFloat; + // if indices + } else if (stt == STT_INDEX && $5.sttType==STT_INDEX) { + // assign value + *(INDEX*)ssSymbol.ss_pvValue = $5.iIndex; + // if strings + } else if (stt == STT_STRING && $5.sttType==STT_STRING) { + // assign value + *(CTString*)ssSymbol.ss_pvValue = $5.strString; + // !!!! remove this conversion + } else if (stt == STT_FLOAT && $5.sttType==STT_INDEX) { + _pShell->ErrorF("Warning: assigning INDEX to FLOAT!"); + *(FLOAT*)ssSymbol.ss_pvValue = $5.iIndex; + } else { + _pShell->ErrorF("Symbol '%s' and its initializer have different types", (const char *) ssSymbol.ss_strName); + } +} +| k_help identifier { +extern void PrintShellSymbolHelp(const CTString &strSymbol); + PrintShellSymbolHelp($2->ss_strName); +} +| k_help identifier '(' ')' { +extern void PrintShellSymbolHelp(const CTString &strSymbol); + PrintShellSymbolHelp($2->ss_strName); +} +| k_help identifier '[' ']' { +extern void PrintShellSymbolHelp(const CTString &strSymbol); + PrintShellSymbolHelp($2->ss_strName); +} +| k_if '(' expression ')' { + _bExecNextBlock = FALSE; + if ($3.sttType == STT_INDEX) { + _bExecNextBlock = $3.iIndex!=0; + } else if ($3.sttType == STT_FLOAT) { + _bExecNextBlock = $3.fFloat!=0; + } else { + _pShell->ErrorF("If expression is not integral"); + } + $1 = _bExecNextBlock; +} block { + _bExecNextElse = !$1; + _bExecNextBlock = TRUE; +} opt_else +; + +opt_else +: /* nothing */ + +| k_else_if '(' expression ')' { + if (_bExecNextElse) { + _bExecNextBlock = FALSE; + if ($3.sttType == STT_INDEX) { + _bExecNextBlock = $3.iIndex!=0; + } else if ($3.sttType == STT_FLOAT) { + _bExecNextBlock = $3.fFloat!=0; + } else { + _pShell->ErrorF("If expression is not integral"); + } + $1 = _bExecNextBlock; + } else { + _bExecNextBlock = FALSE; + _bExecNextElse = FALSE; + $1 = TRUE; + } +} block { + _bExecNextElse = !$1; + _bExecNextBlock = TRUE; +} opt_else + +| k_else { + _bExecNextBlock = _bExecNextElse; +} block { + _bExecNextBlock = TRUE; +} +; + +lvalue +: identifier { + CShellSymbol &ssSymbol = *$1; + const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; + + $$.lv_pssSymbol = &ssSymbol; + if (!ssSymbol.IsDeclared()) { + // error + _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); + fDummy = -666; + $$.lv_sttType = STT_VOID; + $$.lv_pvAddress = &fDummy; + // if the identifier is a float, int or string + } else if (stType.st_sttType==STT_FLOAT || stType.st_sttType==STT_INDEX || stType.st_sttType==STT_STRING) { + // get its value and type + $$.lv_sttType = stType.st_sttType; + $$.lv_pvAddress = ssSymbol.ss_pvValue; + // if the identifier is something else + } else { + // error + _pShell->ErrorF("'%s' doesn't have a value", (const char *) $1->ss_strName); + fDummy = -666.0f; + $$.lv_sttType = STT_VOID; + $$.lv_pvAddress = &fDummy; + } +} +| identifier '[' expression ']' { + CShellSymbol &ssSymbol = *$1; + const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; + $$.lv_pssSymbol = &ssSymbol; + + int iIndex = 0; + // if subscript is index + if ($3.sttType==STT_INDEX) { + // get the index + iIndex = $3.iIndex; + // if subscript is not index + } else { + // error + _pShell->ErrorF("Array subscript is not integral"); + } + // if the symbol is array + if (stType.st_sttType==STT_ARRAY) { + const ShellType &stBase = _shell_ast[stType.st_istBaseType]; + // if it is float or int array + if (stBase.st_sttType==STT_FLOAT || stBase.st_sttType==STT_INDEX) { + // if the index is out of range + if (iIndex<0 || iIndex>=stType.st_ctArraySize) { + _pShell->ErrorF("Array member out of range"); + fDummy = -666.0f; + $$.lv_pvAddress = &fDummy; + } else { + // get its value and type + $$.lv_sttType = stBase.st_sttType; + $$.lv_pvAddress = (FLOAT*)ssSymbol.ss_pvValue+iIndex; + } + } + } else { + _pShell->ErrorF("'%s[]' doesn't have a value", (const char *) $1->ss_strName); + fDummy = -666.0f; + $$.lv_pvAddress = &fDummy; + } +} +; + +argument_expression_list_opt +: /* nothing */ { + $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); + ShellTypeAddFunctionArgument($$.istType, ShellTypeNewVoid()); + $$.ctBytes = 0; +} +| argument_expression_list { + $$ = $1; +} +; + +argument_expression_list +: expression { + $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); + ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($1.sttType)); + $$.ctBytes = PushExpression($1); +} +| argument_expression_list ',' expression { + $$ = $1; + ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($3.sttType)); + $$.ctBytes += PushExpression($3); +} + +expression +: c_float { + $$.sttType = STT_FLOAT; + $$.fFloat = $1.fFloat; +} +| c_int { + $$.sttType = STT_INDEX; + $$.iIndex = $1.iIndex; +} +| c_string { + $$.sttType = STT_STRING; + $$.strString = $1.strString; +} +| lvalue { + // get its value + $$.sttType = $1.lv_sttType; + if ($1.lv_sttType==STT_VOID) { + NOTHING; + } else if ($1.lv_sttType==STT_FLOAT) { + $$.fFloat = *(FLOAT*)$1.lv_pvAddress; + } else if ($1.lv_sttType==STT_INDEX) { + $$.iIndex = *(INDEX*)$1.lv_pvAddress; + } else if ($1.lv_sttType==STT_STRING) { + $$.strString = (const char*)*(CTString*)$1.lv_pvAddress; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + _pShell->ErrorF("'%s' is of wrong type", (const char *) $1.lv_pssSymbol->ss_strName); + } +} +/* shift */ +| expression SHL expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex<<$3.iIndex; + } else { + _pShell->ErrorF("Wrong arguments for '<<'"); + $$.sttType = STT_INDEX; + $$.iIndex = -666; + } +} +| expression SHR expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex>>$3.iIndex; + } else { + _pShell->ErrorF("Wrong arguments for '>>'"); + $$.sttType = STT_INDEX; + $$.iIndex = -666; + } +} +/* bitwise operators */ +| expression '&' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'&' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex&$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +| expression '|' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'|' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex|$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +| expression '^' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'^' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex^$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +/* logical operators */ +| expression LOGAND expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'&&' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex&&$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +| expression LOGOR expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'||' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex||$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +/* addition */ +| expression '+' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat+$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex+$3.iIndex; + } else if ($1.sttType == STT_STRING) { + CTString &strNew = _shell_astrTempStrings.Push(); + strNew = CTString($1.strString)+$3.strString; + $$.strString = (const char*)strNew; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +/* substraction */ +| expression '-' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat-$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex-$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +/* multiplication */ +| expression '*' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat*$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex*$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + +} +/* division */ +| expression '/' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat/$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + if ($3.iIndex==0) { + _pShell->ErrorF("Division by zero!\n"); + $$.iIndex = 0; + } else { + $$.iIndex = $1.iIndex/$3.iIndex; + } + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + +} + +/* modulo */ +| expression '%' expression { + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'%' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex%$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + +} + +/* comparisons */ +| expression '<' expression { + DoComparison($$, $1, $3, '<'); +} +| expression '>' expression { + DoComparison($$, $1, $3, '>'); +} +| expression EQ expression { + DoComparison($$, $1, $3, '='); +} +| expression NEQ expression { + DoComparison($$, $1, $3, '!'); +} +| expression GEQ expression { + DoComparison($$, $1, $3, '}'); +} +| expression LEQ expression { + DoComparison($$, $1, $3, '{'); +} + +// unary minus + +| '-' expression %prec SIGN { + $$.sttType = $2.sttType; + if ($2.sttType == STT_FLOAT) { + $$.fFloat = -$2.fFloat; + } else if ($2.sttType == STT_INDEX) { + $$.iIndex = -$2.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +// unary plus + +| '+' expression %prec SIGN { + $$.sttType = $2.sttType; + if ($2.sttType == STT_FLOAT) { + $$.fFloat = $2.fFloat; + } else if ($2.sttType == STT_INDEX) { + $$.iIndex = $2.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +| '!' expression %prec SIGN { + $$.sttType = $2.sttType; + if ($2.sttType == STT_FLOAT) { + _pShell->ErrorF("'!' is illegal for FLOAT values"); + $$.fFloat = $2.fFloat; + } else if ($2.sttType == STT_INDEX) { + $$.iIndex = !$2.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +| '(' k_FLOAT ')' expression %prec TYPECAST { + $$.sttType = STT_FLOAT; + if ($4.sttType == STT_FLOAT) { + $$.fFloat = $4.fFloat; + } else if ($4.sttType == STT_INDEX) { + $$.fFloat = FLOAT($4.iIndex); + } else if ($4.sttType == STT_STRING) { + $$.fFloat = atof($4.strString); + } else { + _pShell->ErrorF("Cannot convert to FLOAT"); + $$.sttType = STT_VOID; + } +} + +| '(' k_INDEX ')' expression %prec TYPECAST { + $$.sttType = STT_INDEX; + if ($4.sttType == STT_FLOAT) { + $$.iIndex = INDEX($4.fFloat); + } else if ($4.sttType == STT_INDEX) { + $$.iIndex = $4.iIndex; + } else if ($4.sttType == STT_STRING) { + $$.iIndex = atol($4.strString); + } else { + _pShell->ErrorF("Cannot convert to INDEX"); + $$.sttType = STT_VOID; + } +} + +| '(' k_CTString ')' expression %prec TYPECAST { + CTString &strNew = _shell_astrTempStrings.Push(); + $$.sttType = STT_STRING; + if ($4.sttType == STT_FLOAT) { + strNew.PrintF("%g", $4.fFloat); + } else if ($4.sttType == STT_INDEX) { + strNew.PrintF("%d", $4.iIndex); + } else if ($4.sttType == STT_STRING) { + strNew = $4.strString; + } else { + _pShell->ErrorF("Cannot convert to CTString"); + $$.sttType = STT_VOID; + } + $$.strString = (const char*)strNew; +} + +// function call +| identifier '(' argument_expression_list_opt ')' { + // if the identifier is not declared + if (!$1->IsDeclared()) { + // error + _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); + // if the identifier is declared + } else { + // get its type + ShellType &stFunc = _shell_ast[$1->ss_istType]; + + // if the identifier is a function + if (stFunc.st_sttType==STT_FUNCTION) { + // determine result type + ShellType &stResult = _shell_ast[stFunc.st_istBaseType]; + // match argument list result to that result + _shell_ast[_shell_ast[$3.istType].st_istBaseType].st_sttType = stResult.st_sttType; + // if types are same + if (ShellTypeIsSame($3.istType, $1->ss_istType)) { + bool callfunc = true; + +// !!! FIXME: maybe just dump the win32 codepath here? This will break on Win64, and maybe break on different compilers/compiler versions, etc. +#ifdef PLATFORM_WIN32 + #define CALLPARAMS + #define FUNCSIG void + #define PUSHPARAMS memcpy(_alloca($3.ctBytes), _ubStack+_iStack-$3.ctBytes, $3.ctBytes); +#else + // This is possibly more portable, but no less scary than the alloca hack. + #define MAXSCRIPTFUNCARGS 5 + void *ARG[MAXSCRIPTFUNCARGS]; + if (($3.ctBytes > sizeof (ARG))) + { + _pShell->ErrorF("Function '%s' has too many arguments!", (const char *) $1->ss_strName); + callfunc = false; + } + else + { + memcpy(ARG, _ubStack+_iStack-$3.ctBytes, $3.ctBytes); + memset(((char *) ARG) + $3.ctBytes, '\0', sizeof (ARG) - $3.ctBytes); + } + #define PUSHPARAMS + #define FUNCSIG void*, void*, void*, void*, void* + #define CALLPARAMS ARG[0], ARG[1], ARG[2], ARG[3], ARG[4] +#endif + + if (callfunc) { + // if void + if (stResult.st_sttType==STT_VOID) { + // just call the function + $$.sttType = STT_VOID; + PUSHPARAMS; + ((void (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + // if index + } else if (stResult.st_sttType==STT_INDEX) { + // call the function and return result + $$.sttType = STT_INDEX; + PUSHPARAMS; + $$.iIndex = ((INDEX (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + // if float + } else if (stResult.st_sttType==STT_FLOAT) { + // call the function and return result + $$.sttType = STT_FLOAT; + PUSHPARAMS; + $$.fFloat = ((FLOAT (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + // if string + } else if (stResult.st_sttType==STT_STRING) { + // call the function and return result + $$.sttType = STT_STRING; + CTString &strNew = _shell_astrTempStrings.Push(); + PUSHPARAMS; + strNew = ((CTString (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + $$.strString = (const char*)strNew; + } else { + ASSERT(FALSE); + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + } + // if types are different + } else { + // error + $$.sttType = STT_VOID; + _pShell->ErrorF("Wrong parameters for '%s'", (const char *) $1->ss_strName); + } + // if the identifier is something else + } else { + // error + $$.sttType = STT_VOID; + _pShell->ErrorF("Can't call '%s'", (const char *) $1->ss_strName); + } + } + + // pop arguments and free type info + _iStack-=$3.ctBytes; + ShellTypeDelete($3.istType); +} +// brackets +| '(' expression ')' { + $$ = $2; +} +; + +%% diff --git a/SamTFE/Sources/Engine/Base/Priority.inl b/SamTFE/Sources/Engine/Base/Priority.inl index c75fe6fe..73166637 100644 --- a/SamTFE/Sources/Engine/Base/Priority.inl +++ b/SamTFE/Sources/Engine/Base/Priority.inl @@ -1,42 +1,56 @@ - -#ifndef SE_INCL_PRIORITY_INL -#define SE_INCL_PRIORITY_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -class CSetPriority { -public: -#ifdef PLATFORM_WIN32 - DWORD sp_dwProcessOld; - int sp_iThreadOld; - HANDLE sp_hThread; - HANDLE sp_hProcess; - CSetPriority(DWORD dwProcess, int iThread) - { - sp_hProcess = GetCurrentProcess(); - sp_hThread = GetCurrentThread(); - - sp_dwProcessOld = GetPriorityClass(sp_hProcess); - sp_iThreadOld = GetThreadPriority(sp_hThread); - BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, dwProcess); - BOOL bSuccessThread = SetThreadPriority(sp_hThread, iThread); - ASSERT(bSuccessProcess && bSuccessThread); - } - ~CSetPriority(void) - { - BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, sp_dwProcessOld); - BOOL bSuccessThread = SetThreadPriority(sp_hThread, sp_iThreadOld); - ASSERT(bSuccessProcess && bSuccessThread); - } - -#else - - CSetPriority(DWORD dwProcess, int iThread) { STUBBED(""); } - ~CSetPriority(void) { STUBBED(""); } - -#endif -}; - -#endif /* include-once blocker. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_PRIORITY_INL +#define SE_INCL_PRIORITY_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +class CSetPriority { +public: +#ifdef PLATFORM_WIN32 + DWORD sp_dwProcessOld; + int sp_iThreadOld; + HANDLE sp_hThread; + HANDLE sp_hProcess; + CSetPriority(DWORD dwProcess, int iThread) + { + sp_hProcess = GetCurrentProcess(); + sp_hThread = GetCurrentThread(); + + sp_dwProcessOld = GetPriorityClass(sp_hProcess); + sp_iThreadOld = GetThreadPriority(sp_hThread); + BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, dwProcess); + BOOL bSuccessThread = SetThreadPriority(sp_hThread, iThread); + ASSERT(bSuccessProcess && bSuccessThread); + } + ~CSetPriority(void) + { + BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, sp_dwProcessOld); + BOOL bSuccessThread = SetThreadPriority(sp_hThread, sp_iThreadOld); + ASSERT(bSuccessProcess && bSuccessThread); + } + +#else + + CSetPriority(DWORD dwProcess, int iThread) { STUBBED(""); } + ~CSetPriority(void) { STUBBED(""); } + +#endif +}; + +#endif /* include-once blocker. */ + diff --git a/SamTFE/Sources/Engine/Base/Scanner.l b/SamTFE/Sources/Engine/Base/Scanner.l index 4444464a..e4411d0e 100644 --- a/SamTFE/Sources/Engine/Base/Scanner.l +++ b/SamTFE/Sources/Engine/Base/Scanner.l @@ -1,280 +1,295 @@ -%{ -#include "ParsingSymbols.h" -#include "Parser.h" - -#include -#include -#include -#include -#include - -#include - -#define YY_DECL int yylex (YYSTYPE *lvalp) -#define yylval (*lvalp) - -#ifdef __cplusplus -extern "C" { int yywrap(void); } -#endif - -int yywrap(void) -{ - // no more bufers - return 1; -}; - -static int _iBlockDepth = 0; -static int _iDummyDepth = 0; -static CTString _strCmd = ""; // currently parsed command -static int _ctCmdParam = 1; // current parameter index -static BOOL _bCmdParamCountErrorReported = FALSE; - -void TranscriptEsc(CTString &str) -{ - char *pchSrc = (char *)(const char *)str; - char *pchDst = (char *)(const char *)str; - // if quoted - if (pchDst[0] == '"') { - int len = strlen(pchDst); - pchDst[len-1] = 0; - memmove(pchDst, pchDst+1, len-1); - } - for (;;pchSrc++, pchDst++) { - if (*pchSrc==0) { - break; - } - if (*pchSrc!='\\') { - *pchDst = *pchSrc; - continue; - } - pchSrc++; - switch(*pchSrc) { - case 'n': *pchDst = 10; break; - case 'r': *pchDst = 13; break; - default: *pchDst = *pchSrc; break; - } - } - *pchDst=0; -} - -%} - -%x COMMENT -%x DUMMYBLOCK -%x INCLUDE -%x COMMAND - -DIGIT [0-9] -HEXDIGIT [0-9A-Fa-f] -IDENTIFIERFIRST [A-Za-z_] -IDENTIFIEROTHER [A-Za-z0-9_] -DOUBLEQUOTE \" -STRINGCONTENT ([^\"]|(\\\")) -CHARCONTENT ([^\']|(\\\')) -NONEXP_FLT ({DIGIT}+"."{DIGIT}*) -EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) - -PARAMCONTENT ([^\ \n\";]|(\\\ )) - -%% - - /*\0 yyterminate();*/ - - /* Include file parsing. */ -"include" BEGIN(INCLUDE); - -[ \t]*"\"" /* eat the whitespace until first quote */ -[^"\""]*"\"" { /* get the include file name until second quote */ - if (ShellGetBufferStackDepth() >= SHELL_MAX_INCLUDE_LEVEL) { - _pShell->ErrorF("Script files nested too deeply"); - } - char strFileName[256]; - strcpy(strFileName, yytext); - strFileName[strlen(strFileName)-1] = 0; - - CTString strIncludeFile; - try { - strIncludeFile.Load_t(CTString(strFileName)); - ShellPushBuffer(strFileName, strIncludeFile, FALSE); - - } catch (const char *strError) { - _pShell->ErrorF("Cannot load script file '%s': %s", yytext, strError); - } - BEGIN(INITIAL); -} -. { /* something unrecognized inside include statement */ - _pShell->ErrorF("Wrong syntax for include statement"); - BEGIN(INITIAL); -} - - /* command parsing */ -{PARAMCONTENT}*|"\""{STRINGCONTENT}*"\"" { // for each parameter - _ctCmdParam++; - CTString strParam = yytext; - TranscriptEsc(strParam); - // insert the parameter in the command string - CTString strParamNo = CTString(1, "%%%d", _ctCmdParam); - if (strParam.FindSubstr(strParamNo)!=-1) { - _pShell->ErrorF("Parameter substitution recursion detected!"); - } else { - INDEX ctFound; - for(ctFound=0;; ctFound++) { - if (!_strCmd.ReplaceSubstr(strParamNo, strParam)) { - break; - } - } - // if not found and parameter count error not reported yet - if (ctFound==0 && !_bCmdParamCountErrorReported) { - // report error - _bCmdParamCountErrorReported = TRUE; - _pShell->ErrorF("Too many parameters for command expansion"); - } - } -} -\n|; { - // at the end of the command - - // switch to the new input buffer with that command - ShellPushBuffer(ShellGetBufferName(), _strCmd, FALSE); - BEGIN(INITIAL); -} - -<> { - if (ShellPopBuffer()) { - yyterminate(); - } -} - - /* special data types */ -"FLOAT" { return(k_FLOAT);} -"INDEX" { return(k_INDEX);} -"CTString" { return(k_CTString);} - - /* keywords */ -"void" { return(k_void); } -"const" { return(k_const); } -"user" { return(k_user); } -"persistent" { return(k_persistent); } -"extern" { return(k_extern); } -"pre" { return(k_pre); } -"post" { return(k_post); } -"help" { return(k_help); } -"if" { return(k_if); } -"else" { return(k_else); } -"else"" "*"if" { return(k_else_if); } - -"<=" { return (LEQ); } -">=" { return (GEQ); } -"==" { return (EQ); } -"!=" { return (NEQ); } - -">>" { return (SHR); } -"<<" { return (SHL); } - -"&&" { return (LOGAND); } -"||" { return (LOGOR); } - - /* single character operators and punctuations */ -";"|"("|")"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { - return(yytext[0]);} - - /* constants */ -{DIGIT}+ { yylval.val.iIndex = atoi(yytext); return(c_int); } -"0x"{HEXDIGIT}+ { yylval.val.iIndex = strtoul(yytext+2, NULL, 16); return(c_int); } -{NONEXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } -{EXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } -"\""{STRINGCONTENT}*"\"" { - CTString &strNew = _shell_astrTempStrings.Push(); - // remove double-quotes - strNew = yytext; - // parse escape symbols and remove double quotes - TranscriptEsc(strNew); - yylval.val.strString = (const char*)strNew; - return(c_string); -} -"'"{CHARCONTENT}"'" { return(c_char); } - - /* identifier */ -{IDENTIFIERFIRST}{IDENTIFIEROTHER}* { - // get the symbol - yylval.pssSymbol = _pShell->GetSymbol(yytext, FALSE); - BOOL bCommand = FALSE; - // if it is string - if (_shell_ast[yylval.pssSymbol->ss_istType].st_sttType==STT_STRING) { - // get the value - CTString str = *(CTString*)yylval.pssSymbol->ss_pvValue; - // if the value tells that it is a command - if (str.RemovePrefix("!command ")) { - // parse the command - bCommand = TRUE; - _strCmd = str; - _ctCmdParam = 0; - _bCmdParamCountErrorReported = FALSE; - BEGIN(COMMAND); - } - } - // normally, just return the identifier - if (!bCommand) { - return(identifier); - } -} -${IDENTIFIERFIRST}{IDENTIFIEROTHER}* { // special case of identifier, used to bypass command parsing - // get the symbol - yylval.pssSymbol = _pShell->GetSymbol(yytext+1, FALSE); - return(identifier); -} - - /* eat up or execute blocks */ -"{" { - _iBlockDepth++; - if (!_bExecNextBlock) { - _iDummyDepth++; - BEGIN(DUMMYBLOCK); - } - return block_beg; -} - -"}" { - _iBlockDepth--; - if (_iBlockDepth<0) { - _pShell->ErrorF("Mismatched '}'"); - } - return block_end; -} -"{" { - _iBlockDepth++; - _iDummyDepth++; -} -"}" { - _iBlockDepth--; - _iDummyDepth--; - if (_iDummyDepth==0) { - BEGIN(INITIAL); - return block_end; - } -} -. {} - - /* eat up comments */ -"/*" { BEGIN(COMMENT); } -"*/" { BEGIN(INITIAL); } -. {} -"//"[^\n]*\n { ShellCountOneLine(); } - - - /* eat up whitespace */ -[ \t]+ { -} - /* eat up linefeeds and count lines in all conditions */ -<*>\n { - ShellCountOneLine(); -} - - /* for all unrecognized characters */ -. { - // report an error - _pShell->ErrorF("Unrecognized character '%c' (ASCII 0x%02x)", yytext[0], yytext[0] ); -} - -%% - +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include "ParsingSymbols.h" +#include "Parser.h" + +#include +#include +#include +#include +#include + +#include + +#define YY_DECL int yylex (YYSTYPE *lvalp) +#define yylval (*lvalp) + +#ifdef __cplusplus +extern "C" { int yywrap(void); } +#endif + +int yywrap(void) +{ + // no more bufers + return 1; +}; + +static int _iBlockDepth = 0; +static int _iDummyDepth = 0; +static CTString _strCmd = ""; // currently parsed command +static int _ctCmdParam = 1; // current parameter index +static BOOL _bCmdParamCountErrorReported = FALSE; + +void TranscriptEsc(CTString &str) +{ + char *pchSrc = (char *)(const char *)str; + char *pchDst = (char *)(const char *)str; + // if quoted + if (pchDst[0] == '"') { + int len = strlen(pchDst); + pchDst[len-1] = 0; + memmove(pchDst, pchDst+1, len-1); + } + for (;;pchSrc++, pchDst++) { + if (*pchSrc==0) { + break; + } + if (*pchSrc!='\\') { + *pchDst = *pchSrc; + continue; + } + pchSrc++; + switch(*pchSrc) { + case 'n': *pchDst = 10; break; + case 'r': *pchDst = 13; break; + default: *pchDst = *pchSrc; break; + } + } + *pchDst=0; +} + +%} + +%x COMMENT +%x DUMMYBLOCK +%x INCLUDE +%x COMMAND + +DIGIT [0-9] +HEXDIGIT [0-9A-Fa-f] +IDENTIFIERFIRST [A-Za-z_] +IDENTIFIEROTHER [A-Za-z0-9_] +DOUBLEQUOTE \" +STRINGCONTENT ([^\"]|(\\\")) +CHARCONTENT ([^\']|(\\\')) +NONEXP_FLT ({DIGIT}+"."{DIGIT}*) +EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) + +PARAMCONTENT ([^\ \n\";]|(\\\ )) + +%% + + /*\0 yyterminate();*/ + + /* Include file parsing. */ +"include" BEGIN(INCLUDE); + +[ \t]*"\"" /* eat the whitespace until first quote */ +[^"\""]*"\"" { /* get the include file name until second quote */ + if (ShellGetBufferStackDepth() >= SHELL_MAX_INCLUDE_LEVEL) { + _pShell->ErrorF("Script files nested too deeply"); + } + char strFileName[256]; + strcpy(strFileName, yytext); + strFileName[strlen(strFileName)-1] = 0; + + CTString strIncludeFile; + try { + strIncludeFile.Load_t(CTString(strFileName)); + ShellPushBuffer(strFileName, strIncludeFile, FALSE); + + } catch (const char *strError) { + _pShell->ErrorF("Cannot load script file '%s': %s", yytext, strError); + } + BEGIN(INITIAL); +} +. { /* something unrecognized inside include statement */ + _pShell->ErrorF("Wrong syntax for include statement"); + BEGIN(INITIAL); +} + + /* command parsing */ +{PARAMCONTENT}*|"\""{STRINGCONTENT}*"\"" { // for each parameter + _ctCmdParam++; + CTString strParam = yytext; + TranscriptEsc(strParam); + // insert the parameter in the command string + CTString strParamNo = CTString(1, "%%%d", _ctCmdParam); + if (strParam.FindSubstr(strParamNo)!=-1) { + _pShell->ErrorF("Parameter substitution recursion detected!"); + } else { + INDEX ctFound; + for(ctFound=0;; ctFound++) { + if (!_strCmd.ReplaceSubstr(strParamNo, strParam)) { + break; + } + } + // if not found and parameter count error not reported yet + if (ctFound==0 && !_bCmdParamCountErrorReported) { + // report error + _bCmdParamCountErrorReported = TRUE; + _pShell->ErrorF("Too many parameters for command expansion"); + } + } +} +\n|; { + // at the end of the command + + // switch to the new input buffer with that command + ShellPushBuffer(ShellGetBufferName(), _strCmd, FALSE); + BEGIN(INITIAL); +} + +<> { + if (ShellPopBuffer()) { + yyterminate(); + } +} + + /* special data types */ +"FLOAT" { return(k_FLOAT);} +"INDEX" { return(k_INDEX);} +"CTString" { return(k_CTString);} + + /* keywords */ +"void" { return(k_void); } +"const" { return(k_const); } +"user" { return(k_user); } +"persistent" { return(k_persistent); } +"extern" { return(k_extern); } +"pre" { return(k_pre); } +"post" { return(k_post); } +"help" { return(k_help); } +"if" { return(k_if); } +"else" { return(k_else); } +"else"" "*"if" { return(k_else_if); } + +"<=" { return (LEQ); } +">=" { return (GEQ); } +"==" { return (EQ); } +"!=" { return (NEQ); } + +">>" { return (SHR); } +"<<" { return (SHL); } + +"&&" { return (LOGAND); } +"||" { return (LOGOR); } + + /* single character operators and punctuations */ +";"|"("|")"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { + return(yytext[0]);} + + /* constants */ +{DIGIT}+ { yylval.val.iIndex = atoi(yytext); return(c_int); } +"0x"{HEXDIGIT}+ { yylval.val.iIndex = strtoul(yytext+2, NULL, 16); return(c_int); } +{NONEXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } +{EXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } +"\""{STRINGCONTENT}*"\"" { + CTString &strNew = _shell_astrTempStrings.Push(); + // remove double-quotes + strNew = yytext; + // parse escape symbols and remove double quotes + TranscriptEsc(strNew); + yylval.val.strString = (const char*)strNew; + return(c_string); +} +"'"{CHARCONTENT}"'" { return(c_char); } + + /* identifier */ +{IDENTIFIERFIRST}{IDENTIFIEROTHER}* { + // get the symbol + yylval.pssSymbol = _pShell->GetSymbol(yytext, FALSE); + BOOL bCommand = FALSE; + // if it is string + if (_shell_ast[yylval.pssSymbol->ss_istType].st_sttType==STT_STRING) { + // get the value + CTString str = *(CTString*)yylval.pssSymbol->ss_pvValue; + // if the value tells that it is a command + if (str.RemovePrefix("!command ")) { + // parse the command + bCommand = TRUE; + _strCmd = str; + _ctCmdParam = 0; + _bCmdParamCountErrorReported = FALSE; + BEGIN(COMMAND); + } + } + // normally, just return the identifier + if (!bCommand) { + return(identifier); + } +} +${IDENTIFIERFIRST}{IDENTIFIEROTHER}* { // special case of identifier, used to bypass command parsing + // get the symbol + yylval.pssSymbol = _pShell->GetSymbol(yytext+1, FALSE); + return(identifier); +} + + /* eat up or execute blocks */ +"{" { + _iBlockDepth++; + if (!_bExecNextBlock) { + _iDummyDepth++; + BEGIN(DUMMYBLOCK); + } + return block_beg; +} + +"}" { + _iBlockDepth--; + if (_iBlockDepth<0) { + _pShell->ErrorF("Mismatched '}'"); + } + return block_end; +} +"{" { + _iBlockDepth++; + _iDummyDepth++; +} +"}" { + _iBlockDepth--; + _iDummyDepth--; + if (_iDummyDepth==0) { + BEGIN(INITIAL); + return block_end; + } +} +. {} + + /* eat up comments */ +"/*" { BEGIN(COMMENT); } +"*/" { BEGIN(INITIAL); } +. {} +"//"[^\n]*\n { ShellCountOneLine(); } + + + /* eat up whitespace */ +[ \t]+ { +} + /* eat up linefeeds and count lines in all conditions */ +<*>\n { + ShellCountOneLine(); +} + + /* for all unrecognized characters */ +. { + // report an error + _pShell->ErrorF("Unrecognized character '%c' (ASCII 0x%02x)", yytext[0], yytext[0] ); +} + +%% + diff --git a/SamTFE/Sources/Engine/Base/Timer.inl b/SamTFE/Sources/Engine/Base/Timer.inl index d9c28de1..13a87523 100644 --- a/SamTFE/Sources/Engine/Base/Timer.inl +++ b/SamTFE/Sources/Engine/Base/Timer.inl @@ -1,57 +1,72 @@ -#ifndef SE_INCL_TIMER_INL -#define SE_INCL_TIMER_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -/* Constructor from seconds. */ -inline CTimerValue::CTimerValue(double fSeconds) -{ - tv_llValue = (__int64) (fSeconds*_pTimer->tm_llPerformanceCounterFrequency); -} -/* Clear timer value (set it to zero). */ -inline void CTimerValue::Clear(void) -{ - tv_llValue = 0; -} -/* Addition. */ -inline CTimerValue &CTimerValue::operator+=(const CTimerValue &tvOther) { - tv_llValue+=tvOther.tv_llValue; - return *this; -}; -inline CTimerValue CTimerValue::operator+(const CTimerValue &tvOther) const { - return CTimerValue(*this)+=tvOther; -}; -/* Substraction. */ -inline CTimerValue &CTimerValue::operator-=(const CTimerValue &tvOther) { - tv_llValue-=tvOther.tv_llValue; - return *this; -}; -inline CTimerValue CTimerValue::operator-(const CTimerValue &tvOther) const { - return CTimerValue(*this)-=tvOther; -}; -/* Comparisons. */ -inline BOOL CTimerValue::operator<(const CTimerValue &tvOther) const { - return tv_llValue(const CTimerValue &tvOther) const { - return tv_llValue>tvOther.tv_llValue; -} -inline BOOL CTimerValue::operator<=(const CTimerValue &tvOther) const { - return tv_llValue<=tvOther.tv_llValue; -} -inline BOOL CTimerValue::operator>=(const CTimerValue &tvOther) const { - return tv_llValue>=tvOther.tv_llValue; -} -/* Get the timer value in seconds. - use for time spans only! */ -inline double CTimerValue::GetSeconds(void) { - return ((double)tv_llValue)/_pTimer->tm_llPerformanceCounterFrequency; -}; -/* Get the timer value in milliseconds as integral value. */ -inline __int64 CTimerValue::GetMilliseconds(void) { - return tv_llValue/(_pTimer->tm_llPerformanceCounterFrequency/1000); -}; - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_TIMER_INL +#define SE_INCL_TIMER_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +/* Constructor from seconds. */ +inline CTimerValue::CTimerValue(double fSeconds) +{ + tv_llValue = (__int64) (fSeconds*_pTimer->tm_llPerformanceCounterFrequency); +} +/* Clear timer value (set it to zero). */ +inline void CTimerValue::Clear(void) +{ + tv_llValue = 0; +} +/* Addition. */ +inline CTimerValue &CTimerValue::operator+=(const CTimerValue &tvOther) { + tv_llValue+=tvOther.tv_llValue; + return *this; +}; +inline CTimerValue CTimerValue::operator+(const CTimerValue &tvOther) const { + return CTimerValue(*this)+=tvOther; +}; +/* Substraction. */ +inline CTimerValue &CTimerValue::operator-=(const CTimerValue &tvOther) { + tv_llValue-=tvOther.tv_llValue; + return *this; +}; +inline CTimerValue CTimerValue::operator-(const CTimerValue &tvOther) const { + return CTimerValue(*this)-=tvOther; +}; +/* Comparisons. */ +inline BOOL CTimerValue::operator<(const CTimerValue &tvOther) const { + return tv_llValue(const CTimerValue &tvOther) const { + return tv_llValue>tvOther.tv_llValue; +} +inline BOOL CTimerValue::operator<=(const CTimerValue &tvOther) const { + return tv_llValue<=tvOther.tv_llValue; +} +inline BOOL CTimerValue::operator>=(const CTimerValue &tvOther) const { + return tv_llValue>=tvOther.tv_llValue; +} +/* Get the timer value in seconds. - use for time spans only! */ +inline double CTimerValue::GetSeconds(void) { + return ((double)tv_llValue)/_pTimer->tm_llPerformanceCounterFrequency; +}; +/* Get the timer value in milliseconds as integral value. */ +inline __int64 CTimerValue::GetMilliseconds(void) { + return tv_llValue/(_pTimer->tm_llPerformanceCounterFrequency/1000); +}; + + +#endif /* include-once check. */ + diff --git a/SamTFE/Sources/Engine/Base/Unix/UnixSynchronization.h b/SamTFE/Sources/Engine/Base/Unix/UnixSynchronization.h index 41602829..d525841a 100644 --- a/SamTFE/Sources/Engine/Base/Unix/UnixSynchronization.h +++ b/SamTFE/Sources/Engine/Base/Unix/UnixSynchronization.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #define WAIT_OBJECT_0 0 diff --git a/SamTFE/Sources/Engine/Base/iconvlite.cpp b/SamTFE/Sources/Engine/Base/iconvlite.cpp index f70cfdfc..dbb89733 100644 --- a/SamTFE/Sources/Engine/Base/iconvlite.cpp +++ b/SamTFE/Sources/Engine/Base/iconvlite.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "Engine/StdH.h" #include "iconvlite.h" diff --git a/SamTFE/Sources/Engine/Base/iconvlite.h b/SamTFE/Sources/Engine/Base/iconvlite.h index 90a61075..aa1cf166 100644 --- a/SamTFE/Sources/Engine/Base/iconvlite.h +++ b/SamTFE/Sources/Engine/Base/iconvlite.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* iconvlite.h Iconv Lite diff --git a/SamTFE/Sources/Engine/GameAgent/MSLegacy.h b/SamTFE/Sources/Engine/GameAgent/MSLegacy.h index 21ced210..474a970b 100644 --- a/SamTFE/Sources/Engine/GameAgent/MSLegacy.h +++ b/SamTFE/Sources/Engine/GameAgent/MSLegacy.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2004-2008 Luigi Auriemma. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* GSMSALG 0.3.3 by Luigi Auriemma @@ -55,21 +70,6 @@ EXAMPLE LICENSE ======= - Copyright 2004,2005,2006,2007,2008 Luigi Auriemma - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.gnu.org/licenses/gpl.txt */ diff --git a/SamTFE/Sources/Engine/Graphics/Gfx_OpenGL.h b/SamTFE/Sources/Engine/Graphics/Gfx_OpenGL.h index 9a26d847..2bc76eb5 100644 --- a/SamTFE/Sources/Engine/Graphics/Gfx_OpenGL.h +++ b/SamTFE/Sources/Engine/Graphics/Gfx_OpenGL.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* TODO External vars */ extern int aiAttribList[]; diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h index de2d708a..079a3e69 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char OcclusionCheckFrag_Spirv[] = { diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h index 69ad4c53..8c35dc48 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char OcclusionCheckVert_Spirv[] = { diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h index 4b6bb50c..bd72ba15 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char TexturedAlphaFrag_Spirv[] = { diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h index 0720e152..342d2346 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char TexturedFrag_Spirv[] = { diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h index daf9484a..479c67ce 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char TexturedVert_Spirv[] = { diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMain.h b/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMain.h index f786e89f..369ee8e0 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMain.h +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMain.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once #ifndef SE_INCL_SVKMAIN_H diff --git a/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp b/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp index 1c52db0e..4a2a78cd 100644 --- a/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp +++ b/SamTFE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "Engine/StdH.h" #include "SvkMemoryPool.h" diff --git a/SamTFE/Sources/Engine/Math/Clipping.inl b/SamTFE/Sources/Engine/Math/Clipping.inl index d75ee4ef..537dd9d0 100644 --- a/SamTFE/Sources/Engine/Math/Clipping.inl +++ b/SamTFE/Sources/Engine/Math/Clipping.inl @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_CLIPPING_INL #define SE_INCL_CLIPPING_INL #ifdef PRAGMA_ONCE diff --git a/SamTFE/Sources/Engine/Math/Geometry.inl b/SamTFE/Sources/Engine/Math/Geometry.inl index 3fec2653..dd1a3440 100644 --- a/SamTFE/Sources/Engine/Math/Geometry.inl +++ b/SamTFE/Sources/Engine/Math/Geometry.inl @@ -1,138 +1,153 @@ -#ifndef SE_INCL_GEOMETRY_INL -#define SE_INCL_GEOMETRY_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -// mirror a position vector by a given plane -inline void ReflectPositionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vPoint) -{ - vPoint-=((FLOAT3D &)plPlane)*(2*plPlane.PointDistance(vPoint)); -} -// mirror a direction vector by a given plane -inline void ReflectDirectionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vDirection) -{ - vDirection-=((FLOAT3D &)plPlane)*(2*(((FLOAT3D &)plPlane)%vDirection)); -} -// mirror a rotation matrix by a given plane -inline void ReflectRotationMatrixByPlane_cols(const FLOATplane3D &plPlane, FLOATmatrix3D &m) -{ // reflect columns vectors - FLOAT3D vX(m(1,1),m(2,1),m(3,1)); - FLOAT3D vY(m(1,2),m(2,2),m(3,2)); - FLOAT3D vZ(m(1,3),m(2,3),m(3,3)); - - ReflectDirectionVectorByPlane(plPlane, vX); - ReflectDirectionVectorByPlane(plPlane, vY); - ReflectDirectionVectorByPlane(plPlane, vZ); - - m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); - m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); - m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); -} -inline void ReflectRotationMatrixByPlane_rows(const FLOATplane3D &plPlane, FLOATmatrix3D &m) -{ // reflect row vectors - FLOAT3D vX(m(1,1),m(1,2),m(1,3)); - FLOAT3D vY(m(2,1),m(2,2),m(2,3)); - FLOAT3D vZ(m(3,1),m(3,2),m(3,3)); - - ReflectDirectionVectorByPlane(plPlane, vX); - ReflectDirectionVectorByPlane(plPlane, vY); - ReflectDirectionVectorByPlane(plPlane, vZ); - - m(1,1) = vX(1); m(2,1) = vY(1); m(3,1) = vZ(1); - m(1,2) = vX(2); m(2,2) = vY(2); m(3,2) = vZ(2); - m(1,3) = vX(3); m(2,3) = vY(3); m(3,3) = vZ(3); -} - -// get component of a vector parallel to given reference vector -static inline void GetParallelComponent( - const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel) -{ - vParallel = vReference*(vFull%vReference); -} - -// get component of a vector normal to given reference vector -static inline void GetNormalComponent( - const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vNormal) -{ - vNormal = vFull-vReference*(vFull%vReference); -} - -// get components of a vector parallel and normal to given reference vector -static inline void GetParallelAndNormalComponents( - const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel, FLOAT3D &vNormal) -{ - vParallel = vReference*(vFull%vReference); - vNormal = vFull-vParallel; -} - -// get measure of validity of a rotation matrix (should be around zero) -static inline FLOAT RotationMatrixValidity(const FLOATmatrix3D &m) -{ - FLOATmatrix3D mSqr; - mSqr(1,1) = m(1,1)*m(1,1); - mSqr(1,2) = m(1,2)*m(1,2); - mSqr(1,3) = m(1,3)*m(1,3); - mSqr(2,1) = m(2,1)*m(2,1); - mSqr(2,2) = m(2,2)*m(2,2); - mSqr(2,3) = m(2,3)*m(2,3); - mSqr(3,1) = m(3,1)*m(3,1); - mSqr(3,2) = m(3,2)*m(3,2); - mSqr(3,3) = m(3,3)*m(3,3); - - FLOAT3D vH; - vH(1) = Sqrt(mSqr(1,1)+mSqr(1,2)+mSqr(1,3))-1; - vH(2) = Sqrt(mSqr(2,1)+mSqr(2,2)+mSqr(2,3))-1; - vH(3) = Sqrt(mSqr(3,1)+mSqr(3,2)+mSqr(3,3))-1; - FLOAT3D vV; - vV(1) = Sqrt(mSqr(1,1)+mSqr(2,1)+mSqr(3,1))-1; - vV(2) = Sqrt(mSqr(1,2)+mSqr(2,2)+mSqr(3,2))-1; - vV(3) = Sqrt(mSqr(1,3)+mSqr(2,3)+mSqr(3,3))-1; - - return Sqrt( - vH(1)*vH(1)+vH(2)*vH(2)+vH(3)*vH(3)+ - vV(1)*vV(1)+vV(2)*vV(2)+vV(3)*vV(3)); -} - -// normalize rotation matrix to be special orthogonal -static inline void OrthonormalizeRotationMatrix( FLOATmatrix3D &m) -{ - FLOAT3D vX(m(1,1),m(2,1),m(3,1)); - FLOAT3D vY(m(1,2),m(2,2),m(3,2)); - FLOAT3D vZ; - - vX.Normalize(); - vZ = vX*vY; - vZ.Normalize(); - vY = vZ*vX; - vY.Normalize(); - - m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); - m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); - m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); -} - -inline void GetMajorAxesForPlane( - const FLOATplane3D &plPlane, INDEX &iMajorAxis1, INDEX &iMajorAxis2) -{ - // get maximum normal axis - INDEX iMaxNormalAxis = plPlane.GetMaxNormal(); - // the major axes are the other two axes - switch (iMaxNormalAxis) { - case 1: iMajorAxis1 = 2; iMajorAxis2 = 3; - break; - case 2: iMajorAxis1 = 3; iMajorAxis2 = 1; - break; - case 3: iMajorAxis1 = 1; iMajorAxis2 = 2; - break; - default: - ASSERT(FALSE); - iMajorAxis1 = 2; - iMajorAxis2 = 3; - } - ASSERT(Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis1)) - &&Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis2))); -} - -#endif /* include-once checker ... */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_GEOMETRY_INL +#define SE_INCL_GEOMETRY_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +// mirror a position vector by a given plane +inline void ReflectPositionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vPoint) +{ + vPoint-=((FLOAT3D &)plPlane)*(2*plPlane.PointDistance(vPoint)); +} +// mirror a direction vector by a given plane +inline void ReflectDirectionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vDirection) +{ + vDirection-=((FLOAT3D &)plPlane)*(2*(((FLOAT3D &)plPlane)%vDirection)); +} +// mirror a rotation matrix by a given plane +inline void ReflectRotationMatrixByPlane_cols(const FLOATplane3D &plPlane, FLOATmatrix3D &m) +{ // reflect columns vectors + FLOAT3D vX(m(1,1),m(2,1),m(3,1)); + FLOAT3D vY(m(1,2),m(2,2),m(3,2)); + FLOAT3D vZ(m(1,3),m(2,3),m(3,3)); + + ReflectDirectionVectorByPlane(plPlane, vX); + ReflectDirectionVectorByPlane(plPlane, vY); + ReflectDirectionVectorByPlane(plPlane, vZ); + + m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); + m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); + m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); +} +inline void ReflectRotationMatrixByPlane_rows(const FLOATplane3D &plPlane, FLOATmatrix3D &m) +{ // reflect row vectors + FLOAT3D vX(m(1,1),m(1,2),m(1,3)); + FLOAT3D vY(m(2,1),m(2,2),m(2,3)); + FLOAT3D vZ(m(3,1),m(3,2),m(3,3)); + + ReflectDirectionVectorByPlane(plPlane, vX); + ReflectDirectionVectorByPlane(plPlane, vY); + ReflectDirectionVectorByPlane(plPlane, vZ); + + m(1,1) = vX(1); m(2,1) = vY(1); m(3,1) = vZ(1); + m(1,2) = vX(2); m(2,2) = vY(2); m(3,2) = vZ(2); + m(1,3) = vX(3); m(2,3) = vY(3); m(3,3) = vZ(3); +} + +// get component of a vector parallel to given reference vector +static inline void GetParallelComponent( + const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel) +{ + vParallel = vReference*(vFull%vReference); +} + +// get component of a vector normal to given reference vector +static inline void GetNormalComponent( + const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vNormal) +{ + vNormal = vFull-vReference*(vFull%vReference); +} + +// get components of a vector parallel and normal to given reference vector +static inline void GetParallelAndNormalComponents( + const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel, FLOAT3D &vNormal) +{ + vParallel = vReference*(vFull%vReference); + vNormal = vFull-vParallel; +} + +// get measure of validity of a rotation matrix (should be around zero) +static inline FLOAT RotationMatrixValidity(const FLOATmatrix3D &m) +{ + FLOATmatrix3D mSqr; + mSqr(1,1) = m(1,1)*m(1,1); + mSqr(1,2) = m(1,2)*m(1,2); + mSqr(1,3) = m(1,3)*m(1,3); + mSqr(2,1) = m(2,1)*m(2,1); + mSqr(2,2) = m(2,2)*m(2,2); + mSqr(2,3) = m(2,3)*m(2,3); + mSqr(3,1) = m(3,1)*m(3,1); + mSqr(3,2) = m(3,2)*m(3,2); + mSqr(3,3) = m(3,3)*m(3,3); + + FLOAT3D vH; + vH(1) = Sqrt(mSqr(1,1)+mSqr(1,2)+mSqr(1,3))-1; + vH(2) = Sqrt(mSqr(2,1)+mSqr(2,2)+mSqr(2,3))-1; + vH(3) = Sqrt(mSqr(3,1)+mSqr(3,2)+mSqr(3,3))-1; + FLOAT3D vV; + vV(1) = Sqrt(mSqr(1,1)+mSqr(2,1)+mSqr(3,1))-1; + vV(2) = Sqrt(mSqr(1,2)+mSqr(2,2)+mSqr(3,2))-1; + vV(3) = Sqrt(mSqr(1,3)+mSqr(2,3)+mSqr(3,3))-1; + + return Sqrt( + vH(1)*vH(1)+vH(2)*vH(2)+vH(3)*vH(3)+ + vV(1)*vV(1)+vV(2)*vV(2)+vV(3)*vV(3)); +} + +// normalize rotation matrix to be special orthogonal +static inline void OrthonormalizeRotationMatrix( FLOATmatrix3D &m) +{ + FLOAT3D vX(m(1,1),m(2,1),m(3,1)); + FLOAT3D vY(m(1,2),m(2,2),m(3,2)); + FLOAT3D vZ; + + vX.Normalize(); + vZ = vX*vY; + vZ.Normalize(); + vY = vZ*vX; + vY.Normalize(); + + m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); + m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); + m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); +} + +inline void GetMajorAxesForPlane( + const FLOATplane3D &plPlane, INDEX &iMajorAxis1, INDEX &iMajorAxis2) +{ + // get maximum normal axis + INDEX iMaxNormalAxis = plPlane.GetMaxNormal(); + // the major axes are the other two axes + switch (iMaxNormalAxis) { + case 1: iMajorAxis1 = 2; iMajorAxis2 = 3; + break; + case 2: iMajorAxis1 = 3; iMajorAxis2 = 1; + break; + case 3: iMajorAxis1 = 1; iMajorAxis2 = 2; + break; + default: + ASSERT(FALSE); + iMajorAxis1 = 2; + iMajorAxis2 = 3; + } + ASSERT(Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis1)) + &&Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis2))); +} + +#endif /* include-once checker ... */ + diff --git a/SamTFE/Sources/Engine/Ska/smcFlex.skl b/SamTFE/Sources/Engine/Ska/smcFlex.skl index 23fac9ce..f71b0e7e 100644 --- a/SamTFE/Sources/Engine/Ska/smcFlex.skl +++ b/SamTFE/Sources/Engine/Ska/smcFlex.skl @@ -1,1496 +1,1511 @@ -#include - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -//#ifdef c_plusplus -//#ifndef __cplusplus -//#define __cplusplus -//#endif -//#endif - -#if 1 //def __cplusplus - - #include -%+ - class istream; -%* - - /* Use prototypes in function declarations. */ - #define YY_USE_PROTOS - - /* The "const" storage-class-modifier is valid. */ - #define YY_USE_CONST - -#else /* ! __cplusplus */ - - #if __STDC__ - - #define YY_USE_PROTOS - #define YY_USE_CONST - - #endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -extern FILE *yyin, *yyout; -%* - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) syyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - FILE *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -static YY_BUFFER_STATE yy_current_buffer = 0; -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -//static - void syyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -%* -#endif - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( const char msg[] )); -%* - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifdef YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) -%- - yyin = stdin; -%+ - yyin = &cin; -%* - - if ( ! yyout ) -%- - yyout = stdout; -%+ - yyout = &cout; -%* - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( yy_current_buffer ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; - } - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif - { - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) yyout->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer() -%+ -int yyFlexLexer::yy_get_next_buffer() -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state() -%+ -yy_state_type yyFlexLexer::yy_get_previous_state() -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifdef YY_USE_PROTOS -//static - void syyunput( int c, register char *yy_bp ) -#else -//static - void syyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } - - -%- -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif -%+ -int yyFlexLexer::yyinput() -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%* - { - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) -%* - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#ifdef YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#ifdef YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif -%+ - b->yy_is_interactive = 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%* - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( const char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -const char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -const char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state() -%+ -void yyFlexLexer::yy_pop_state() -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state() -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( const char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( const char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, const char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -const char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - return (void *) realloc( ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#ifdef YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +%- +#include +%* + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +//#ifdef c_plusplus +//#ifndef __cplusplus +//#define __cplusplus +//#endif +//#endif + +#if 1 //def __cplusplus + + #include +%+ + class istream; +%* + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +#else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +%- +extern FILE *yyin, *yyout; +%* + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) syyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { +%- + FILE *yy_input_file; +%+ + istream* yy_input_file; +%* + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +%- Standard (non-C++) definition +static YY_BUFFER_STATE yy_current_buffer = 0; +%* + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +%- Standard (non-C++) definition +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); +%* + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +//static + void syyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); +#endif + +#ifndef YY_NO_INPUT +%- Standard (non-C++) definition +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +%* +#endif + +%- Standard (non-C++) definition +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( const char msg[] )); +%* + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ +%% code to fiddle yytext and yyleng for yymore() goes here + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ +%% code to copy yytext_ptr to yytext[] goes here, if %array + yy_c_buf_p = yy_cp; + +%% data tables for the DFA and the user's section 1 definitions go here + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifdef YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +%- Standard (non-C++) definition +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +%+ C++ definition +#define ECHO LexerOutput( yytext, yyleng ) +%* +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ +%+ C++ definition + if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +%* +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +%- +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +%+ +#define YY_FATAL_ERROR(msg) LexerError( msg ) +%* +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +%- Standard (non-C++) definition +#define YY_DECL int yylex YY_PROTO(( void )) +%+ C++ definition +#define YY_DECL int yyFlexLexer::yylex() +%* +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +%% YY_RULE_SETUP definition goes here + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +%% user's declarations go here + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) +%- + yyin = stdin; +%+ + yyin = &cin; +%* + + if ( ! yyout ) +%- + yyout = stdout; +%+ + yyout = &cout; +%* + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +%% yymore()-related code goes here + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +%% code to set up and find next match goes here + +yy_find_action: +%% code to find the action number goes here + + YY_DO_BEFORE_ACTION; + +%% code for yylineno update goes here + +do_action: /* This label is used only to access EOF actions. */ + +%% debug code goes here + + switch ( yy_act ) + { /* beginning of action switch */ +%% actions go here + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +%% code to do back-up for compressed tables and set up yy_cp goes here + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + +%+ +yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) + { + yyin = arg_yyin; + yyout = arg_yyout; + yy_c_buf_p = 0; + yy_init = 1; + yy_start = 0; + yy_flex_debug = 0; + yylineno = 1; // this will only get updated if %option yylineno + + yy_did_buffer_switch_on_eof = 0; + + yy_looking_for_trail_begin = 0; + yy_more_flag = 0; + yy_more_len = 0; + + yy_start_stack_ptr = yy_start_stack_depth = 0; + yy_start_stack = 0; + + yy_current_buffer = 0; + +#ifdef YY_USES_REJECT + yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; +#else + yy_state_buf = 0; +#endif + } + +yyFlexLexer::~yyFlexLexer() + { + delete yy_state_buf; + yy_delete_buffer( yy_current_buffer ); + } + +void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) + { + if ( new_in ) + { + yy_delete_buffer( yy_current_buffer ); + yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); + } + + if ( new_out ) + yyout = new_out; + } + +#ifdef YY_INTERACTIVE +int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) +#else +int yyFlexLexer::LexerInput( char* buf, int max_size ) +#endif + { + if ( yyin->eof() || yyin->fail() ) + return 0; + +#ifdef YY_INTERACTIVE + yyin->get( buf[0] ); + + if ( yyin->eof() ) + return 0; + + if ( yyin->bad() ) + return -1; + + return 1; + +#else + (void) yyin->read( buf, max_size ); + + if ( yyin->bad() ) + return -1; + else + return yyin->gcount(); +#endif + } + +void yyFlexLexer::LexerOutput( const char* buf, int size ) + { + (void) yyout->write( buf, size ); + } +%* + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +%- +static int yy_get_next_buffer() +%+ +int yyFlexLexer::yy_get_next_buffer() +%* + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +%- +static yy_state_type yy_get_previous_state() +%+ +yy_state_type yyFlexLexer::yy_get_previous_state() +%* + { + register yy_state_type yy_current_state; + register char *yy_cp; + +%% code to get the start state into yy_current_state goes here + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { +%% code to find the next state goes here + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +%- +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif +%+ +yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +%* + { + register int yy_is_jam; +%% code to find the next state, and perhaps do backing up, goes here + + return yy_is_jam ? 0 : yy_current_state; + } + + +%- +#ifdef YY_USE_PROTOS +//static + void syyunput( int c, register char *yy_bp ) +#else +//static + void syyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif +%+ +void yyFlexLexer::yyunput( int c, register char* yy_bp ) +%* + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +%% update yylineno here + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + + +%- +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif +%+ +int yyFlexLexer::yyinput() +%* + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + +%% update BOL and yylineno + + return c; + } + + +%- +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif +%+ +void yyFlexLexer::yyrestart( istream* input_file ) +%* + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +%- +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif +%+ +void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +%* + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif +%+ +void yyFlexLexer::yy_load_buffer_state() +%* + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif +%+ +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) +%* + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif +%+ +void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +%* + { + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +%- +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + +%+ +extern "C" int isatty YY_PROTO(( int )); +void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) +%* + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +%- +#ifdef YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#ifdef YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif +%+ + b->yy_is_interactive = 0; +%* + } + + +%- +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + +%+ +void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +%* + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } +%* + + +#ifndef YY_NO_SCAN_BUFFER +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +%* +#endif + + +#ifndef YY_NO_SCAN_STRING +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( const char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +const char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +%* +#endif + + +#ifndef YY_NO_SCAN_BYTES +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +const char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +%* +#endif + + +#ifndef YY_NO_PUSH_STATE +%- +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif +%+ +void yyFlexLexer::yy_push_state( int new_state ) +%* + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +%- +static void yy_pop_state() +%+ +void yyFlexLexer::yy_pop_state() +%* + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +%- +static int yy_top_state() +%+ +int yyFlexLexer::yy_top_state() +%* + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +%- +#ifdef YY_USE_PROTOS +static void yy_fatal_error( const char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + +%+ + +void yyFlexLexer::LexerError( const char msg[] ) + { + cerr << msg << '\n'; + exit( YY_EXIT_FAILURE ); + } +%* + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, const char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +const char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + return (void *) realloc( ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#ifdef YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif diff --git a/SamTFE/Sources/Engine/Ska/smcPars.y b/SamTFE/Sources/Engine/Ska/smcPars.y index 711cd5e0..903e7e5e 100644 --- a/SamTFE/Sources/Engine/Ska/smcPars.y +++ b/SamTFE/Sources/Engine/Ska/smcPars.y @@ -1,4 +1,19 @@ %{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #include #include diff --git a/SamTFE/Sources/Engine/Ska/smcScan.l b/SamTFE/Sources/Engine/Ska/smcScan.l index 4be51486..08c97cf7 100644 --- a/SamTFE/Sources/Engine/Ska/smcScan.l +++ b/SamTFE/Sources/Engine/Ska/smcScan.l @@ -1,5 +1,20 @@ %option prefix="engine_ska_yy" %{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #include #include diff --git a/SamTFE/Sources/Engine/Ska/smcScwin.l b/SamTFE/Sources/Engine/Ska/smcScwin.l index 759907c5..ced0bbed 100644 --- a/SamTFE/Sources/Engine/Ska/smcScwin.l +++ b/SamTFE/Sources/Engine/Ska/smcScwin.l @@ -1,5 +1,20 @@ %option prefix="syy" %{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "ParsingSmbs.h" #include "smcPars.h" diff --git a/SamTFE/Sources/Entities/Acid.es b/SamTFE/Sources/Entities/Acid.es index c9b0f313..b7192ed6 100644 --- a/SamTFE/Sources/Entities/Acid.es +++ b/SamTFE/Sources/Entities/Acid.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 509 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/AirWave.es b/SamTFE/Sources/Entities/AirWave.es index dbfbd46c..3ff3a036 100644 --- a/SamTFE/Sources/Entities/AirWave.es +++ b/SamTFE/Sources/Entities/AirWave.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 510 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/AmmoItem.es b/SamTFE/Sources/Entities/AmmoItem.es index b05369e6..87b92de1 100644 --- a/SamTFE/Sources/Entities/AmmoItem.es +++ b/SamTFE/Sources/Entities/AmmoItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 803 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/AmmoPack.es b/SamTFE/Sources/Entities/AmmoPack.es index 59170b1c..a46be86b 100644 --- a/SamTFE/Sources/Entities/AmmoPack.es +++ b/SamTFE/Sources/Entities/AmmoPack.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 806 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/AnimationChanger.es b/SamTFE/Sources/Entities/AnimationChanger.es index bfa99ea2..2f9a7acb 100644 --- a/SamTFE/Sources/Entities/AnimationChanger.es +++ b/SamTFE/Sources/Entities/AnimationChanger.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 218 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/AnimationHub.es b/SamTFE/Sources/Entities/AnimationHub.es index ad945a06..52b15c33 100644 --- a/SamTFE/Sources/Entities/AnimationHub.es +++ b/SamTFE/Sources/Entities/AnimationHub.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 228 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/ArmorItem.es b/SamTFE/Sources/Entities/ArmorItem.es index bbe05b9c..516a970d 100644 --- a/SamTFE/Sources/Entities/ArmorItem.es +++ b/SamTFE/Sources/Entities/ArmorItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 804 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/BackgroundViewer.es b/SamTFE/Sources/Entities/BackgroundViewer.es index 5ad58902..9fee9f9f 100644 --- a/SamTFE/Sources/Entities/BackgroundViewer.es +++ b/SamTFE/Sources/Entities/BackgroundViewer.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 211 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/BasicEffects.es b/SamTFE/Sources/Entities/BasicEffects.es index 7b886749..30f63c6b 100644 --- a/SamTFE/Sources/Entities/BasicEffects.es +++ b/SamTFE/Sources/Entities/BasicEffects.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 601 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Beast.es b/SamTFE/Sources/Entities/Beast.es index e0a1bdd9..408832e8 100644 --- a/SamTFE/Sources/Entities/Beast.es +++ b/SamTFE/Sources/Entities/Beast.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 336 %{ diff --git a/SamTFE/Sources/Entities/BigHead.es b/SamTFE/Sources/Entities/BigHead.es index 69738835..0b3c02f5 100644 --- a/SamTFE/Sources/Entities/BigHead.es +++ b/SamTFE/Sources/Entities/BigHead.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 340 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/BlendController.es b/SamTFE/Sources/Entities/BlendController.es index 43a17701..a92c87dc 100644 --- a/SamTFE/Sources/Entities/BlendController.es +++ b/SamTFE/Sources/Entities/BlendController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 612 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/BloodSpray.es b/SamTFE/Sources/Entities/BloodSpray.es index 12d27236..776206ee 100644 --- a/SamTFE/Sources/Entities/BloodSpray.es +++ b/SamTFE/Sources/Entities/BloodSpray.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 603 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Boneman.es b/SamTFE/Sources/Entities/Boneman.es index 1e19e16d..b4f4e9ba 100644 --- a/SamTFE/Sources/Entities/Boneman.es +++ b/SamTFE/Sources/Entities/Boneman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 305 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Bouncer.es b/SamTFE/Sources/Entities/Bouncer.es index eda4a2a7..1fec1a93 100644 --- a/SamTFE/Sources/Entities/Bouncer.es +++ b/SamTFE/Sources/Entities/Bouncer.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 105 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Bullet.es b/SamTFE/Sources/Entities/Bullet.es index 84b115a8..a7bbc510 100644 --- a/SamTFE/Sources/Entities/Bullet.es +++ b/SamTFE/Sources/Entities/Bullet.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 502 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Camera.es b/SamTFE/Sources/Entities/Camera.es index a9431874..24f627dd 100644 --- a/SamTFE/Sources/Entities/Camera.es +++ b/SamTFE/Sources/Entities/Camera.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 220 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/CameraMarker.es b/SamTFE/Sources/Entities/CameraMarker.es index f6b540d8..d1331b51 100644 --- a/SamTFE/Sources/Entities/CameraMarker.es +++ b/SamTFE/Sources/Entities/CameraMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 224 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/CannonBall.es b/SamTFE/Sources/Entities/CannonBall.es index 510802ba..f919d8c7 100644 --- a/SamTFE/Sources/Entities/CannonBall.es +++ b/SamTFE/Sources/Entities/CannonBall.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 506 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Catman.es b/SamTFE/Sources/Entities/Catman.es index 657f0c18..5661d83b 100644 --- a/SamTFE/Sources/Entities/Catman.es +++ b/SamTFE/Sources/Entities/Catman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 301 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Common/Common.cpp b/SamTFE/Sources/Entities/Common/Common.cpp index 7c2f9c87..c5f3b74f 100644 --- a/SamTFE/Sources/Entities/Common/Common.cpp +++ b/SamTFE/Sources/Entities/Common/Common.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" #include "Entities/Reminder.h" //#include "Entities/Flame.h" diff --git a/SamTFE/Sources/Entities/Common/Common.h b/SamTFE/Sources/Entities/Common/Common.h index 4d8321d1..40c2d0b1 100644 --- a/SamTFE/Sources/Entities/Common/Common.h +++ b/SamTFE/Sources/Entities/Common/Common.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // common headers for flesh entity classes #include /* rcg10062001 need enum definition... */ diff --git a/SamTFE/Sources/Entities/Common/Debris.cpp b/SamTFE/Sources/Entities/Common/Debris.cpp index e69de29b..d70515e2 100644 --- a/SamTFE/Sources/Entities/Common/Debris.cpp +++ b/SamTFE/Sources/Entities/Common/Debris.cpp @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTFE/Sources/Entities/Common/Flags.h b/SamTFE/Sources/Entities/Common/Flags.h index afee7566..cdaacd47 100644 --- a/SamTFE/Sources/Entities/Common/Flags.h +++ b/SamTFE/Sources/Entities/Common/Flags.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_FLAGS_H #define SE_INCL_FLAGS_H #ifdef PRAGMA_ONCE diff --git a/SamTFE/Sources/Entities/Common/GameInterface.h b/SamTFE/Sources/Entities/Common/GameInterface.h index 4c772396..cb91c328 100644 --- a/SamTFE/Sources/Entities/Common/GameInterface.h +++ b/SamTFE/Sources/Entities/Common/GameInterface.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // interfacing between CGame and entities #ifndef SE_INCL_GAMEINTERFACE_H #define SE_INCL_GAMEINTERFACE_H diff --git a/SamTFE/Sources/Entities/Common/HUD.cpp b/SamTFE/Sources/Entities/Common/HUD.cpp index b859c5ac..3fef6363 100644 --- a/SamTFE/Sources/Entities/Common/HUD.cpp +++ b/SamTFE/Sources/Entities/Common/HUD.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Common/HUD.h b/SamTFE/Sources/Entities/Common/HUD.h index e69de29b..d70515e2 100644 --- a/SamTFE/Sources/Entities/Common/HUD.h +++ b/SamTFE/Sources/Entities/Common/HUD.h @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTFE/Sources/Entities/Common/LightFixes.h b/SamTFE/Sources/Entities/Common/LightFixes.h index 4430d6c9..eb5483b4 100644 --- a/SamTFE/Sources/Entities/Common/LightFixes.h +++ b/SamTFE/Sources/Entities/Common/LightFixes.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_LIGHTFIXES_H #define SE_INCL_LIGHTFIXES_H // ******************************************************************************************** diff --git a/SamTFE/Sources/Entities/Common/Particles.cpp b/SamTFE/Sources/Entities/Common/Particles.cpp index 9ff1f5cd..d7f0f6e3 100644 --- a/SamTFE/Sources/Entities/Common/Particles.cpp +++ b/SamTFE/Sources/Entities/Common/Particles.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" #include "Entities/BloodSpray.h" #include "Entities/PlayerWeapons.h" diff --git a/SamTFE/Sources/Entities/Common/Particles.h b/SamTFE/Sources/Entities/Common/Particles.h index 2f413f24..10513298 100644 --- a/SamTFE/Sources/Entities/Common/Particles.h +++ b/SamTFE/Sources/Entities/Common/Particles.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // init particle effects void DECL_DLL InitParticles(void); diff --git a/SamTFE/Sources/Entities/Common/PathFinding.cpp b/SamTFE/Sources/Entities/Common/PathFinding.cpp index 654c1e10..17abf1d5 100644 --- a/SamTFE/Sources/Entities/Common/PathFinding.cpp +++ b/SamTFE/Sources/Entities/Common/PathFinding.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" #include "Entities/Common/PathFinding.h" #include "Entities/NavigationMarker.h" diff --git a/SamTFE/Sources/Entities/Common/PathFinding.h b/SamTFE/Sources/Entities/Common/PathFinding.h index 8fa4e277..85a45630 100644 --- a/SamTFE/Sources/Entities/Common/PathFinding.h +++ b/SamTFE/Sources/Entities/Common/PathFinding.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_PATHFINDING_H #define SE_INCL_PATHFINDING_H #ifdef PRAGMA_ONCE diff --git a/SamTFE/Sources/Entities/Common/Stats.cpp b/SamTFE/Sources/Entities/Common/Stats.cpp index e69de29b..d70515e2 100644 --- a/SamTFE/Sources/Entities/Common/Stats.cpp +++ b/SamTFE/Sources/Entities/Common/Stats.cpp @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTFE/Sources/Entities/Common/WeaponPositions.h b/SamTFE/Sources/Entities/Common/WeaponPositions.h index e17ca2d1..6f9dcc1b 100644 --- a/SamTFE/Sources/Entities/Common/WeaponPositions.h +++ b/SamTFE/Sources/Entities/Common/WeaponPositions.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #if 0 // use this part when manually setting weapon positions diff --git a/SamTFE/Sources/Entities/Copier.es b/SamTFE/Sources/Entities/Copier.es index 7de96fab..97d1d5ef 100644 --- a/SamTFE/Sources/Entities/Copier.es +++ b/SamTFE/Sources/Entities/Copier.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 225 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Counter.es b/SamTFE/Sources/Entities/Counter.es index e84443e0..9153b47c 100644 --- a/SamTFE/Sources/Entities/Counter.es +++ b/SamTFE/Sources/Entities/Counter.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 232 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/CrateRider.es b/SamTFE/Sources/Entities/CrateRider.es index d9f43424..dc5a35b6 100644 --- a/SamTFE/Sources/Entities/CrateRider.es +++ b/SamTFE/Sources/Entities/CrateRider.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 341 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Cyborg.es b/SamTFE/Sources/Entities/Cyborg.es index 385a08be..cb8fe19f 100644 --- a/SamTFE/Sources/Entities/Cyborg.es +++ b/SamTFE/Sources/Entities/Cyborg.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 330 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/CyborgBike.es b/SamTFE/Sources/Entities/CyborgBike.es index 1930ebc4..a6629347 100644 --- a/SamTFE/Sources/Entities/CyborgBike.es +++ b/SamTFE/Sources/Entities/CyborgBike.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 331 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Damager.es b/SamTFE/Sources/Entities/Damager.es index 6eb06747..8e74b29c 100644 --- a/SamTFE/Sources/Entities/Damager.es +++ b/SamTFE/Sources/Entities/Damager.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 229 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Debris.es b/SamTFE/Sources/Entities/Debris.es index 03be50e6..74088606 100644 --- a/SamTFE/Sources/Entities/Debris.es +++ b/SamTFE/Sources/Entities/Debris.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 602 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/DestroyableArchitecture.es b/SamTFE/Sources/Entities/DestroyableArchitecture.es index 9a19805b..88a6b074 100644 --- a/SamTFE/Sources/Entities/DestroyableArchitecture.es +++ b/SamTFE/Sources/Entities/DestroyableArchitecture.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 107 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Devil.es b/SamTFE/Sources/Entities/Devil.es index 4368a3d5..87b5e810 100644 --- a/SamTFE/Sources/Entities/Devil.es +++ b/SamTFE/Sources/Entities/Devil.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 332 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/DevilMarker.es b/SamTFE/Sources/Entities/DevilMarker.es index ae6bc881..62794ef1 100644 --- a/SamTFE/Sources/Entities/DevilMarker.es +++ b/SamTFE/Sources/Entities/DevilMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 338 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/DevilProjectile.es b/SamTFE/Sources/Entities/DevilProjectile.es index 261bed91..88ef72ea 100644 --- a/SamTFE/Sources/Entities/DevilProjectile.es +++ b/SamTFE/Sources/Entities/DevilProjectile.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 511 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/DoorController.es b/SamTFE/Sources/Entities/DoorController.es index e0a1b6cc..5d98c356 100644 --- a/SamTFE/Sources/Entities/DoorController.es +++ b/SamTFE/Sources/Entities/DoorController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 221 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Dragonman.es b/SamTFE/Sources/Entities/Dragonman.es index 5788adec..13f3e246 100644 --- a/SamTFE/Sources/Entities/Dragonman.es +++ b/SamTFE/Sources/Entities/Dragonman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 321 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EffectMarker.es b/SamTFE/Sources/Entities/EffectMarker.es index 3b739c94..78803531 100644 --- a/SamTFE/Sources/Entities/EffectMarker.es +++ b/SamTFE/Sources/Entities/EffectMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 611 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Effector.es b/SamTFE/Sources/Entities/Effector.es index 18c7d1d4..ecf10a64 100644 --- a/SamTFE/Sources/Entities/Effector.es +++ b/SamTFE/Sources/Entities/Effector.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 608 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Elemental.es b/SamTFE/Sources/Entities/Elemental.es index 56ff61dc..03036474 100644 --- a/SamTFE/Sources/Entities/Elemental.es +++ b/SamTFE/Sources/Entities/Elemental.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 322 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemyBase.es b/SamTFE/Sources/Entities/EnemyBase.es index f1b1df4c..f6760338 100644 --- a/SamTFE/Sources/Entities/EnemyBase.es +++ b/SamTFE/Sources/Entities/EnemyBase.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 310 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemyCounter.es b/SamTFE/Sources/Entities/EnemyCounter.es index 0ccf18d4..0a3811d7 100644 --- a/SamTFE/Sources/Entities/EnemyCounter.es +++ b/SamTFE/Sources/Entities/EnemyCounter.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 339 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemyDive.es b/SamTFE/Sources/Entities/EnemyDive.es index 42547135..fe62c091 100644 --- a/SamTFE/Sources/Entities/EnemyDive.es +++ b/SamTFE/Sources/Entities/EnemyDive.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 313 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemyFly.es b/SamTFE/Sources/Entities/EnemyFly.es index 7d09d926..1ea0c32e 100644 --- a/SamTFE/Sources/Entities/EnemyFly.es +++ b/SamTFE/Sources/Entities/EnemyFly.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 311 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemyMarker.es b/SamTFE/Sources/Entities/EnemyMarker.es index 07797213..0cb0579e 100644 --- a/SamTFE/Sources/Entities/EnemyMarker.es +++ b/SamTFE/Sources/Entities/EnemyMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 302 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemyRunInto.es b/SamTFE/Sources/Entities/EnemyRunInto.es index e5793fdd..9b678921 100644 --- a/SamTFE/Sources/Entities/EnemyRunInto.es +++ b/SamTFE/Sources/Entities/EnemyRunInto.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 312 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnemySpawner.es b/SamTFE/Sources/Entities/EnemySpawner.es index 2ce56668..93896275 100644 --- a/SamTFE/Sources/Entities/EnemySpawner.es +++ b/SamTFE/Sources/Entities/EnemySpawner.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 304 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnvironmentBase.es b/SamTFE/Sources/Entities/EnvironmentBase.es index 82df8707..b186f12e 100644 --- a/SamTFE/Sources/Entities/EnvironmentBase.es +++ b/SamTFE/Sources/Entities/EnvironmentBase.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 900 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/EnvironmentMarker.es b/SamTFE/Sources/Entities/EnvironmentMarker.es index a86c599f..18d4c22a 100644 --- a/SamTFE/Sources/Entities/EnvironmentMarker.es +++ b/SamTFE/Sources/Entities/EnvironmentMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 901 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Eruptor.es b/SamTFE/Sources/Entities/Eruptor.es index e33288f8..efc45c02 100644 --- a/SamTFE/Sources/Entities/Eruptor.es +++ b/SamTFE/Sources/Entities/Eruptor.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 213 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Eyeman.es b/SamTFE/Sources/Entities/Eyeman.es index e20d0eac..5fd1d7fc 100644 --- a/SamTFE/Sources/Entities/Eyeman.es +++ b/SamTFE/Sources/Entities/Eyeman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 323 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Fish.es b/SamTFE/Sources/Entities/Fish.es index 849b05cf..022d7198 100644 --- a/SamTFE/Sources/Entities/Fish.es +++ b/SamTFE/Sources/Entities/Fish.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 337 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Fishman.es b/SamTFE/Sources/Entities/Fishman.es index b2b2dbdf..cf4025ac 100644 --- a/SamTFE/Sources/Entities/Fishman.es +++ b/SamTFE/Sources/Entities/Fishman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 328 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Flame.es b/SamTFE/Sources/Entities/Flame.es index c66c9658..94fd793a 100644 --- a/SamTFE/Sources/Entities/Flame.es +++ b/SamTFE/Sources/Entities/Flame.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 504 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/FogMarker.es b/SamTFE/Sources/Entities/FogMarker.es index 78280008..de4c3dfe 100644 --- a/SamTFE/Sources/Entities/FogMarker.es +++ b/SamTFE/Sources/Entities/FogMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 215 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/GhostBusterRay.es b/SamTFE/Sources/Entities/GhostBusterRay.es index ec934405..37c245e3 100644 --- a/SamTFE/Sources/Entities/GhostBusterRay.es +++ b/SamTFE/Sources/Entities/GhostBusterRay.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 505 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Gizmo.es b/SamTFE/Sources/Entities/Gizmo.es index b985db7c..2d72c870 100644 --- a/SamTFE/Sources/Entities/Gizmo.es +++ b/SamTFE/Sources/Entities/Gizmo.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 335 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Global.es b/SamTFE/Sources/Entities/Global.es index 3b016c7f..6b828143 100644 --- a/SamTFE/Sources/Entities/Global.es +++ b/SamTFE/Sources/Entities/Global.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 0 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/GradientMarker.es b/SamTFE/Sources/Entities/GradientMarker.es index 7c6a88e4..a2757862 100644 --- a/SamTFE/Sources/Entities/GradientMarker.es +++ b/SamTFE/Sources/Entities/GradientMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 230 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/GravityMarker.es b/SamTFE/Sources/Entities/GravityMarker.es index 5a57be04..91dc613a 100644 --- a/SamTFE/Sources/Entities/GravityMarker.es +++ b/SamTFE/Sources/Entities/GravityMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 212 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/GravityRouter.es b/SamTFE/Sources/Entities/GravityRouter.es index 34e785a8..1ce7f086 100644 --- a/SamTFE/Sources/Entities/GravityRouter.es +++ b/SamTFE/Sources/Entities/GravityRouter.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 227 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/HazeMarker.es b/SamTFE/Sources/Entities/HazeMarker.es index 23edcdbd..932d1231 100644 --- a/SamTFE/Sources/Entities/HazeMarker.es +++ b/SamTFE/Sources/Entities/HazeMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 216 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Headman.es b/SamTFE/Sources/Entities/Headman.es index 1293edd4..b0f9c821 100644 --- a/SamTFE/Sources/Entities/Headman.es +++ b/SamTFE/Sources/Entities/Headman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 303 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/HealthItem.es b/SamTFE/Sources/Entities/HealthItem.es index 71bd4aa5..486e811a 100644 --- a/SamTFE/Sources/Entities/HealthItem.es +++ b/SamTFE/Sources/Entities/HealthItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 801 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Huanman.es b/SamTFE/Sources/Entities/Huanman.es index 559aa795..4fdff237 100644 --- a/SamTFE/Sources/Entities/Huanman.es +++ b/SamTFE/Sources/Entities/Huanman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 325 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Item.es b/SamTFE/Sources/Entities/Item.es index f0bc1496..251723d7 100644 --- a/SamTFE/Sources/Entities/Item.es +++ b/SamTFE/Sources/Entities/Item.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 800 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/KeyItem.es b/SamTFE/Sources/Entities/KeyItem.es index 5269cc4a..501025c5 100644 --- a/SamTFE/Sources/Entities/KeyItem.es +++ b/SamTFE/Sources/Entities/KeyItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 805 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Light.es b/SamTFE/Sources/Entities/Light.es index b25c8f8d..7427f6a2 100644 --- a/SamTFE/Sources/Entities/Light.es +++ b/SamTFE/Sources/Entities/Light.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 200 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/LightStyle.es b/SamTFE/Sources/Entities/LightStyle.es index 03b80416..87bedeb2 100644 --- a/SamTFE/Sources/Entities/LightStyle.es +++ b/SamTFE/Sources/Entities/LightStyle.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 201 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Lightning.es b/SamTFE/Sources/Entities/Lightning.es index 3cc7433d..a391f5cc 100644 --- a/SamTFE/Sources/Entities/Lightning.es +++ b/SamTFE/Sources/Entities/Lightning.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 607 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Mamut.es b/SamTFE/Sources/Entities/Mamut.es index f63825b1..998aa240 100644 --- a/SamTFE/Sources/Entities/Mamut.es +++ b/SamTFE/Sources/Entities/Mamut.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 327 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Mamutman.es b/SamTFE/Sources/Entities/Mamutman.es index c97f4881..6d3ba8f7 100644 --- a/SamTFE/Sources/Entities/Mamutman.es +++ b/SamTFE/Sources/Entities/Mamutman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 326 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Mantaman.es b/SamTFE/Sources/Entities/Mantaman.es index dbb6d0a0..8aaa77b1 100644 --- a/SamTFE/Sources/Entities/Mantaman.es +++ b/SamTFE/Sources/Entities/Mantaman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 329 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Marker.es b/SamTFE/Sources/Entities/Marker.es index 8549edb8..93d0250c 100644 --- a/SamTFE/Sources/Entities/Marker.es +++ b/SamTFE/Sources/Entities/Marker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 202 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MessageHolder.es b/SamTFE/Sources/Entities/MessageHolder.es index d103ef02..d22f1f6d 100644 --- a/SamTFE/Sources/Entities/MessageHolder.es +++ b/SamTFE/Sources/Entities/MessageHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 226 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MessageItem.es b/SamTFE/Sources/Entities/MessageItem.es index 5973ec86..2a35d51e 100644 --- a/SamTFE/Sources/Entities/MessageItem.es +++ b/SamTFE/Sources/Entities/MessageItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 807 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MirrorMarker.es b/SamTFE/Sources/Entities/MirrorMarker.es index 5cc754cc..7dac88e3 100644 --- a/SamTFE/Sources/Entities/MirrorMarker.es +++ b/SamTFE/Sources/Entities/MirrorMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 218 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/ModelDestruction.es b/SamTFE/Sources/Entities/ModelDestruction.es index 162b5c74..43efe49b 100644 --- a/SamTFE/Sources/Entities/ModelDestruction.es +++ b/SamTFE/Sources/Entities/ModelDestruction.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 217 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/ModelHolder.es b/SamTFE/Sources/Entities/ModelHolder.es index add1c6c9..be26ccec 100644 --- a/SamTFE/Sources/Entities/ModelHolder.es +++ b/SamTFE/Sources/Entities/ModelHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 203 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/ModelHolder2.es b/SamTFE/Sources/Entities/ModelHolder2.es index fbb8d3ba..857af014 100644 --- a/SamTFE/Sources/Entities/ModelHolder2.es +++ b/SamTFE/Sources/Entities/ModelHolder2.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 210 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MovingBrush.es b/SamTFE/Sources/Entities/MovingBrush.es index edc859c5..a8f6938b 100644 --- a/SamTFE/Sources/Entities/MovingBrush.es +++ b/SamTFE/Sources/Entities/MovingBrush.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 101 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MovingBrushMarker.es b/SamTFE/Sources/Entities/MovingBrushMarker.es index b1711e37..f3c8b510 100644 --- a/SamTFE/Sources/Entities/MovingBrushMarker.es +++ b/SamTFE/Sources/Entities/MovingBrushMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 102 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MusicChanger.es b/SamTFE/Sources/Entities/MusicChanger.es index 69c90f59..d4f72e03 100644 --- a/SamTFE/Sources/Entities/MusicChanger.es +++ b/SamTFE/Sources/Entities/MusicChanger.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 225 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/MusicHolder.es b/SamTFE/Sources/Entities/MusicHolder.es index f4ba8b81..dccea54c 100644 --- a/SamTFE/Sources/Entities/MusicHolder.es +++ b/SamTFE/Sources/Entities/MusicHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 222 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/NavigationMarker.es b/SamTFE/Sources/Entities/NavigationMarker.es index 468d85e2..979e96ea 100644 --- a/SamTFE/Sources/Entities/NavigationMarker.es +++ b/SamTFE/Sources/Entities/NavigationMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 704 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/ParticlesHolder.es b/SamTFE/Sources/Entities/ParticlesHolder.es index ad29aca1..ee79e021 100644 --- a/SamTFE/Sources/Entities/ParticlesHolder.es +++ b/SamTFE/Sources/Entities/ParticlesHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 223 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Pendulum.es b/SamTFE/Sources/Entities/Pendulum.es index d6afe941..f1cef3ff 100644 --- a/SamTFE/Sources/Entities/Pendulum.es +++ b/SamTFE/Sources/Entities/Pendulum.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 106 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Pipebomb.es b/SamTFE/Sources/Entities/Pipebomb.es index 753eb032..a9d4b2fb 100644 --- a/SamTFE/Sources/Entities/Pipebomb.es +++ b/SamTFE/Sources/Entities/Pipebomb.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 503 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Player.es b/SamTFE/Sources/Entities/Player.es index 450c701b..b7b3fbbb 100644 --- a/SamTFE/Sources/Entities/Player.es +++ b/SamTFE/Sources/Entities/Player.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 401 %{ diff --git a/SamTFE/Sources/Entities/PlayerActionMarker.es b/SamTFE/Sources/Entities/PlayerActionMarker.es index 34e6609d..8cb7a974 100644 --- a/SamTFE/Sources/Entities/PlayerActionMarker.es +++ b/SamTFE/Sources/Entities/PlayerActionMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 407 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerAnimator.es b/SamTFE/Sources/Entities/PlayerAnimator.es index 7481797d..c0a515d0 100644 --- a/SamTFE/Sources/Entities/PlayerAnimator.es +++ b/SamTFE/Sources/Entities/PlayerAnimator.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 406 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerMarker.es b/SamTFE/Sources/Entities/PlayerMarker.es index e6f314e7..68fe174d 100644 --- a/SamTFE/Sources/Entities/PlayerMarker.es +++ b/SamTFE/Sources/Entities/PlayerMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 404 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerView.es b/SamTFE/Sources/Entities/PlayerView.es index 289327f2..b3375ded 100644 --- a/SamTFE/Sources/Entities/PlayerView.es +++ b/SamTFE/Sources/Entities/PlayerView.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 403 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerWeapons.es b/SamTFE/Sources/Entities/PlayerWeapons.es index 20145cab..5f0a29aa 100644 --- a/SamTFE/Sources/Entities/PlayerWeapons.es +++ b/SamTFE/Sources/Entities/PlayerWeapons.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 402 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerWeaponsEffects.es b/SamTFE/Sources/Entities/PlayerWeaponsEffects.es index 32a194a8..b59bec97 100644 --- a/SamTFE/Sources/Entities/PlayerWeaponsEffects.es +++ b/SamTFE/Sources/Entities/PlayerWeaponsEffects.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 405 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerWeaponsHD.es b/SamTFE/Sources/Entities/PlayerWeaponsHD.es index a4ec565b..8347c1f4 100644 --- a/SamTFE/Sources/Entities/PlayerWeaponsHD.es +++ b/SamTFE/Sources/Entities/PlayerWeaponsHD.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 402 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PlayerWeapons_old.es b/SamTFE/Sources/Entities/PlayerWeapons_old.es index 20145cab..5f0a29aa 100644 --- a/SamTFE/Sources/Entities/PlayerWeapons_old.es +++ b/SamTFE/Sources/Entities/PlayerWeapons_old.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 402 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Projectile.es b/SamTFE/Sources/Entities/Projectile.es index 819e08ed..88041e00 100644 --- a/SamTFE/Sources/Entities/Projectile.es +++ b/SamTFE/Sources/Entities/Projectile.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 501 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PyramidSpaceShip.es b/SamTFE/Sources/Entities/PyramidSpaceShip.es index 7ff69e9b..d36382fe 100644 --- a/SamTFE/Sources/Entities/PyramidSpaceShip.es +++ b/SamTFE/Sources/Entities/PyramidSpaceShip.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 609 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/PyramidSpaceShipMarker.es b/SamTFE/Sources/Entities/PyramidSpaceShipMarker.es index 8bbe09ec..a04cb9ef 100644 --- a/SamTFE/Sources/Entities/PyramidSpaceShipMarker.es +++ b/SamTFE/Sources/Entities/PyramidSpaceShipMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 610 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Reminder.es b/SamTFE/Sources/Entities/Reminder.es index e527adda..f1f03fb0 100644 --- a/SamTFE/Sources/Entities/Reminder.es +++ b/SamTFE/Sources/Entities/Reminder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 703 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/RobotDriving.es b/SamTFE/Sources/Entities/RobotDriving.es index 1abfbacd..de93d891 100644 --- a/SamTFE/Sources/Entities/RobotDriving.es +++ b/SamTFE/Sources/Entities/RobotDriving.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 333 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/RobotFixed.es b/SamTFE/Sources/Entities/RobotFixed.es index e69de29b..d70515e2 100644 --- a/SamTFE/Sources/Entities/RobotFixed.es +++ b/SamTFE/Sources/Entities/RobotFixed.es @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTFE/Sources/Entities/RobotFlying.es b/SamTFE/Sources/Entities/RobotFlying.es index 22c93c59..d09641c0 100644 --- a/SamTFE/Sources/Entities/RobotFlying.es +++ b/SamTFE/Sources/Entities/RobotFlying.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 334 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/RollingStone.es b/SamTFE/Sources/Entities/RollingStone.es index 0775a1bf..817801f7 100644 --- a/SamTFE/Sources/Entities/RollingStone.es +++ b/SamTFE/Sources/Entities/RollingStone.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 604 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Scorpman.es b/SamTFE/Sources/Entities/Scorpman.es index 29832d42..0adac631 100644 --- a/SamTFE/Sources/Entities/Scorpman.es +++ b/SamTFE/Sources/Entities/Scorpman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 306 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Ship.es b/SamTFE/Sources/Entities/Ship.es index ae87dbfe..3e46897b 100644 --- a/SamTFE/Sources/Entities/Ship.es +++ b/SamTFE/Sources/Entities/Ship.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 103 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/ShipMarker.es b/SamTFE/Sources/Entities/ShipMarker.es index d89dda6a..0ea84f0a 100644 --- a/SamTFE/Sources/Entities/ShipMarker.es +++ b/SamTFE/Sources/Entities/ShipMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 104 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/SoundHolder.es b/SamTFE/Sources/Entities/SoundHolder.es index 210c05f6..e804477a 100644 --- a/SamTFE/Sources/Entities/SoundHolder.es +++ b/SamTFE/Sources/Entities/SoundHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* * Sound Holder. */ diff --git a/SamTFE/Sources/Entities/StormController.es b/SamTFE/Sources/Entities/StormController.es index a9006f70..e5bd78d0 100644 --- a/SamTFE/Sources/Entities/StormController.es +++ b/SamTFE/Sources/Entities/StormController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 606 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Switch.es b/SamTFE/Sources/Entities/Switch.es index f756f467..c5368605 100644 --- a/SamTFE/Sources/Entities/Switch.es +++ b/SamTFE/Sources/Entities/Switch.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 209 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Teleport.es b/SamTFE/Sources/Entities/Teleport.es index 74fa93ae..b1654400 100644 --- a/SamTFE/Sources/Entities/Teleport.es +++ b/SamTFE/Sources/Entities/Teleport.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 219 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/TouchField.es b/SamTFE/Sources/Entities/TouchField.es index 458a102d..e9a985a9 100644 --- a/SamTFE/Sources/Entities/TouchField.es +++ b/SamTFE/Sources/Entities/TouchField.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 206 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Trigger.es b/SamTFE/Sources/Entities/Trigger.es index f09cb218..6987fe24 100644 --- a/SamTFE/Sources/Entities/Trigger.es +++ b/SamTFE/Sources/Entities/Trigger.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 205 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Twister.es b/SamTFE/Sources/Entities/Twister.es index 2a584035..24e45c88 100644 --- a/SamTFE/Sources/Entities/Twister.es +++ b/SamTFE/Sources/Entities/Twister.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 507 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/VoiceHolder.es b/SamTFE/Sources/Entities/VoiceHolder.es index 208d9501..6bef6cfe 100644 --- a/SamTFE/Sources/Entities/VoiceHolder.es +++ b/SamTFE/Sources/Entities/VoiceHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 231 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Walker.es b/SamTFE/Sources/Entities/Walker.es index 80e61089..1d3a9d94 100644 --- a/SamTFE/Sources/Entities/Walker.es +++ b/SamTFE/Sources/Entities/Walker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 324 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/WatchPlayers.es b/SamTFE/Sources/Entities/WatchPlayers.es index 19679b9c..0875e59a 100644 --- a/SamTFE/Sources/Entities/WatchPlayers.es +++ b/SamTFE/Sources/Entities/WatchPlayers.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 702 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Watcher.es b/SamTFE/Sources/Entities/Watcher.es index a37c4965..5c378b57 100644 --- a/SamTFE/Sources/Entities/Watcher.es +++ b/SamTFE/Sources/Entities/Watcher.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 700 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Water.es b/SamTFE/Sources/Entities/Water.es index f59c9d00..2b7d3841 100644 --- a/SamTFE/Sources/Entities/Water.es +++ b/SamTFE/Sources/Entities/Water.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 508 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/WeaponItem.es b/SamTFE/Sources/Entities/WeaponItem.es index 08071f3f..b573cd5b 100644 --- a/SamTFE/Sources/Entities/WeaponItem.es +++ b/SamTFE/Sources/Entities/WeaponItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 802 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Werebull.es b/SamTFE/Sources/Entities/Werebull.es index 8b0efc84..49b51d7a 100644 --- a/SamTFE/Sources/Entities/Werebull.es +++ b/SamTFE/Sources/Entities/Werebull.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 307 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/Woman.es b/SamTFE/Sources/Entities/Woman.es index b9c9e99f..7dd4bf37 100644 --- a/SamTFE/Sources/Entities/Woman.es +++ b/SamTFE/Sources/Entities/Woman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 320 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/WorldBase.es b/SamTFE/Sources/Entities/WorldBase.es index 7f8ca634..b3ffa2f2 100644 --- a/SamTFE/Sources/Entities/WorldBase.es +++ b/SamTFE/Sources/Entities/WorldBase.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 100 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/WorldLink.es b/SamTFE/Sources/Entities/WorldLink.es index f01f0f70..cfb3124c 100644 --- a/SamTFE/Sources/Entities/WorldLink.es +++ b/SamTFE/Sources/Entities/WorldLink.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 214 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Entities/WorldSettingsController.es b/SamTFE/Sources/Entities/WorldSettingsController.es index 14fc9af1..a863ca18 100644 --- a/SamTFE/Sources/Entities/WorldSettingsController.es +++ b/SamTFE/Sources/Entities/WorldSettingsController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 605 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTFE/Sources/Models/Enemies/Mamut/MAMUT.H b/SamTFE/Sources/Models/Enemies/Mamut/MAMUT.H index b6a67b13..d026b884 100644 --- a/SamTFE/Sources/Models/Enemies/Mamut/MAMUT.H +++ b/SamTFE/Sources/Models/Enemies/Mamut/MAMUT.H @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define MAMUT_ANIM_DEFAULT_ANIMATION 0 #define MAMUT_ANIM_ATTACK01 1 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h index eabd5958..ab096970 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define BERRETTA01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h index 24ef491c..d99e5ff6 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define CAP01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h index d7d0fdd9..5a14386d 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define HAT01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h index 660afb5a..ed7d189a 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define HELMET01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h index d850220c..2d6ac0d0 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNAPSACK01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h index 48cfa1a0..4287faf0 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNAPSACK04_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h index bfe42519..b5d503d2 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNAPSACK05_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h index 8a014f51..f27afa82 100644 --- a/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h +++ b/SamTFE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNIFE01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTFE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h b/SamTFE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h index 2ee62e00..4e62b733 100644 --- a/SamTFE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h +++ b/SamTFE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define LASERPROJECTILE_ANIM_DEFAULT 0 diff --git a/SamTFE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h b/SamTFE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h index 07b1f479..78bf1d18 100644 --- a/SamTFE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h +++ b/SamTFE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define ROCKET_ANIM_DEFAULT 0 #define ROCKET_ANIM_ITEM 1 diff --git a/SamTFE/Sources/Models/headers/Enemies/Mamut/MAMUT.H b/SamTFE/Sources/Models/headers/Enemies/Mamut/MAMUT.H index b6a67b13..d026b884 100644 --- a/SamTFE/Sources/Models/headers/Enemies/Mamut/MAMUT.H +++ b/SamTFE/Sources/Models/headers/Enemies/Mamut/MAMUT.H @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define MAMUT_ANIM_DEFAULT_ANIMATION 0 #define MAMUT_ANIM_ATTACK01 1 diff --git a/SamTFE/Sources/amp11lib/amp11lib.cpp b/SamTFE/Sources/amp11lib/amp11lib.cpp index 8a785000..a06defb7 100644 --- a/SamTFE/Sources/amp11lib/amp11lib.cpp +++ b/SamTFE/Sources/amp11lib/amp11lib.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11lib - library interface layer and asynchronious player -// Copyright (c) 1999-2000 Alen Ladavac -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTFE/Sources/amp11lib/amp11lib.h b/SamTFE/Sources/amp11lib/amp11lib.h index 047257da..702390c5 100644 --- a/SamTFE/Sources/amp11lib/amp11lib.h +++ b/SamTFE/Sources/amp11lib/amp11lib.h @@ -1,3 +1,17 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // AMP11LIB_EXPORTS should be defined when compiling the DLL, and not defined otherwise #ifdef _WIN32 diff --git a/SamTFE/Sources/amp11lib/amp1dec.cpp b/SamTFE/Sources/amp11lib/amp1dec.cpp index f4349eda..4cc58ead 100644 --- a/SamTFE/Sources/amp11lib/amp1dec.cpp +++ b/SamTFE/Sources/amp11lib/amp1dec.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11 - an Audio-MPEG decoder - layer 1 decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include "ampdec.h" diff --git a/SamTFE/Sources/amp11lib/amp2dec.cpp b/SamTFE/Sources/amp11lib/amp2dec.cpp index 2cdfc3bd..2f1657bf 100644 --- a/SamTFE/Sources/amp11lib/amp2dec.cpp +++ b/SamTFE/Sources/amp11lib/amp2dec.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11 - an Audio-MPEG decoder - layer 2 decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include "ampdec.h" diff --git a/SamTFE/Sources/amp11lib/amp3dec.cpp b/SamTFE/Sources/amp11lib/amp3dec.cpp index c9025d84..94fbe1f8 100644 --- a/SamTFE/Sources/amp11lib/amp3dec.cpp +++ b/SamTFE/Sources/amp11lib/amp3dec.cpp @@ -1,7 +1,19 @@ -// amp11 - an Audio-MPEG decoder - layer 3 decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// amp11 - an Audio-MPEG decoder - layer 3 decoder // huffman tables were taken from mpg123 by Michael Hipp #include @@ -1058,7 +1070,6 @@ void ampegdecoder::jointstereo(grsistruct &si, float (*xr)[576], int *scalefacl) ispos[i]=v; } - int msstereo=hdrmodeext&2; for (i=0; i #include diff --git a/SamTFE/Sources/amp11lib/ampdec.h b/SamTFE/Sources/amp11lib/ampdec.h index 9e8a7bc3..2dfefd21 100644 --- a/SamTFE/Sources/amp11lib/ampdec.h +++ b/SamTFE/Sources/amp11lib/ampdec.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __MPDECODE_H #define __MPDECODE_H diff --git a/SamTFE/Sources/amp11lib/ampsynth.cpp b/SamTFE/Sources/amp11lib/ampsynth.cpp index 34429ef3..507540c1 100644 --- a/SamTFE/Sources/amp11lib/ampsynth.cpp +++ b/SamTFE/Sources/amp11lib/ampsynth.cpp @@ -1,7 +1,19 @@ -// amp11 - an Audio-MPEG decoder - synthesizer -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// amp11 - an Audio-MPEG decoder - synthesizer // some ideas regarding optimization of the subband synthesis // were taken from mpg123 by Michael Hipp diff --git a/SamTFE/Sources/amp11lib/binfile/binfarc.cpp b/SamTFE/Sources/amp11lib/binfile/binfarc.cpp index 2c406971..b5ba7574 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfarc.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfarc.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - archive files -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "binfarc.h" diff --git a/SamTFE/Sources/amp11lib/binfile/binfarc.h b/SamTFE/Sources/amp11lib/binfile/binfarc.h index 6b827aea..a0b732e9 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfarc.h +++ b/SamTFE/Sources/amp11lib/binfile/binfarc.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFARC_H #define __BINFARC_H diff --git a/SamTFE/Sources/amp11lib/binfile/binfcon.cpp b/SamTFE/Sources/amp11lib/binfile/binfcon.cpp index deb7b450..09100f15 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfcon.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfcon.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - console io -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef NOUNISTD #if defined(WIN32)||defined(DOS) diff --git a/SamTFE/Sources/amp11lib/binfile/binfcon.h b/SamTFE/Sources/amp11lib/binfile/binfcon.h index bb4d1f42..91189103 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfcon.h +++ b/SamTFE/Sources/amp11lib/binfile/binfcon.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFCON_H #define __BINFCON_H diff --git a/SamTFE/Sources/amp11lib/binfile/binfhttp.cpp b/SamTFE/Sources/amp11lib/binfile/binfhttp.cpp index 0846ffc5..76cc4f32 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfhttp.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfhttp.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - http receiver -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTFE/Sources/amp11lib/binfile/binfhttp.h b/SamTFE/Sources/amp11lib/binfile/binfhttp.h index d021de4c..aade2b94 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfhttp.h +++ b/SamTFE/Sources/amp11lib/binfile/binfhttp.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFHTTP_H #define __BINFHTTP_H diff --git a/SamTFE/Sources/amp11lib/binfile/binfile.cpp b/SamTFE/Sources/amp11lib/binfile/binfile.cpp index 81f22ff3..64325a86 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfile.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfile.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - base class -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include "binfile.h" diff --git a/SamTFE/Sources/amp11lib/binfile/binfile.h b/SamTFE/Sources/amp11lib/binfile/binfile.h index d81d9e71..79e7fab8 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfile.h +++ b/SamTFE/Sources/amp11lib/binfile/binfile.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFILE_H #define __BINFILE_H diff --git a/SamTFE/Sources/amp11lib/binfile/binfilef.cpp b/SamTFE/Sources/amp11lib/binfile/binfilef.cpp index b3fd0a98..f1c9fe1a 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfilef.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfilef.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - float functions -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "binfile.h" diff --git a/SamTFE/Sources/amp11lib/binfile/binfmem.cpp b/SamTFE/Sources/amp11lib/binfile/binfmem.cpp index f4d8f8cb..f324b5cf 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfmem.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfmem.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - memory files -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTFE/Sources/amp11lib/binfile/binfmem.h b/SamTFE/Sources/amp11lib/binfile/binfmem.h index 939410eb..51518af8 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfmem.h +++ b/SamTFE/Sources/amp11lib/binfile/binfmem.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFMEM_H #define __BINFMEM_H diff --git a/SamTFE/Sources/amp11lib/binfile/binfpllx.cpp b/SamTFE/Sources/amp11lib/binfile/binfpllx.cpp index b9419ce4..86650807 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfpllx.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfpllx.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - linux sound playback -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef LINUX #error must compile for LINUX diff --git a/SamTFE/Sources/amp11lib/binfile/binfpllx.h b/SamTFE/Sources/amp11lib/binfile/binfpllx.h index 484afc58..69638ed0 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfpllx.h +++ b/SamTFE/Sources/amp11lib/binfile/binfpllx.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef LINUX #error must compile for LINUX #endif diff --git a/SamTFE/Sources/amp11lib/binfile/binfplnt.cpp b/SamTFE/Sources/amp11lib/binfile/binfplnt.cpp index 571a8e01..06ba1968 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfplnt.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfplnt.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - windows nt/95 sound playback -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef WIN32 #error must compile for WIN32 diff --git a/SamTFE/Sources/amp11lib/binfile/binfplnt.h b/SamTFE/Sources/amp11lib/binfile/binfplnt.h index 1688a602..2f7bf5dc 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfplnt.h +++ b/SamTFE/Sources/amp11lib/binfile/binfplnt.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef WIN32 #error must compile for NT #endif diff --git a/SamTFE/Sources/amp11lib/binfile/binfplsb.cpp b/SamTFE/Sources/amp11lib/binfile/binfplsb.cpp index cbd9a32a..b41a38bf 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfplsb.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfplsb.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - DOS/SB16 sound playback -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTFE/Sources/amp11lib/binfile/binfplsb.h b/SamTFE/Sources/amp11lib/binfile/binfplsb.h index 177a68fb..9ac95ba6 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfplsb.h +++ b/SamTFE/Sources/amp11lib/binfile/binfplsb.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef DOS #error must compile for DOS4G or DJGPP #endif diff --git a/SamTFE/Sources/amp11lib/binfile/binfplwv.cpp b/SamTFE/Sources/amp11lib/binfile/binfplwv.cpp index 22089050..3aa0b578 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfplwv.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfplwv.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - WAV format writer -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "binfplwv.h" diff --git a/SamTFE/Sources/amp11lib/binfile/binfplwv.h b/SamTFE/Sources/amp11lib/binfile/binfplwv.h index 07a9865e..6e3d7bb3 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfplwv.h +++ b/SamTFE/Sources/amp11lib/binfile/binfplwv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __WAVPLAYBINFILE_H #define __WAVPLAYBINFILE_H diff --git a/SamTFE/Sources/amp11lib/binfile/binfstd.cpp b/SamTFE/Sources/amp11lib/binfile/binfstd.cpp index 3aa4cacb..4deca850 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfstd.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binfstd.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - standard disk files -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef NOUNISTD #include diff --git a/SamTFE/Sources/amp11lib/binfile/binfstd.h b/SamTFE/Sources/amp11lib/binfile/binfstd.h index f4c705ca..ec289039 100644 --- a/SamTFE/Sources/amp11lib/binfile/binfstd.h +++ b/SamTFE/Sources/amp11lib/binfile/binfstd.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFSTD_H #define __BINFSTD_H diff --git a/SamTFE/Sources/amp11lib/binfile/binftcp.cpp b/SamTFE/Sources/amp11lib/binfile/binftcp.cpp index 8afab9b0..276f8765 100644 --- a/SamTFE/Sources/amp11lib/binfile/binftcp.cpp +++ b/SamTFE/Sources/amp11lib/binfile/binftcp.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - tcp io -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #if defined(WIN32)||defined(UNIX) diff --git a/SamTFE/Sources/amp11lib/binfile/binftcp.h b/SamTFE/Sources/amp11lib/binfile/binftcp.h index 4c922f91..5e693459 100644 --- a/SamTFE/Sources/amp11lib/binfile/binftcp.h +++ b/SamTFE/Sources/amp11lib/binfile/binftcp.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFTCP_H #define __BINFTCP_H diff --git a/SamTFE/Sources/amp11lib/binfile/ptypes.h b/SamTFE/Sources/amp11lib/binfile/ptypes.h index 214ed5db..c0380e51 100644 --- a/SamTFE/Sources/amp11lib/binfile/ptypes.h +++ b/SamTFE/Sources/amp11lib/binfile/ptypes.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __PTYPES_H #define __PTYPES_H diff --git a/SamTFE/Sources/amp11lib/mpgsplit.cpp b/SamTFE/Sources/amp11lib/mpgsplit.cpp index 7c724299..832e21ff 100644 --- a/SamTFE/Sources/amp11lib/mpgsplit.cpp +++ b/SamTFE/Sources/amp11lib/mpgsplit.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // MPEG stream splitter -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "mpgsplit.h" diff --git a/SamTFE/Sources/amp11lib/mpgsplit.h b/SamTFE/Sources/amp11lib/mpgsplit.h index b6f91f2e..39faf798 100644 --- a/SamTFE/Sources/amp11lib/mpgsplit.h +++ b/SamTFE/Sources/amp11lib/mpgsplit.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "binfile.h" class mpegsplitstream : public binfile diff --git a/SamTFE/Sources/amp11lib/timer.cpp b/SamTFE/Sources/amp11lib/timer.cpp index a23e1015..0529a45d 100644 --- a/SamTFE/Sources/amp11lib/timer.cpp +++ b/SamTFE/Sources/amp11lib/timer.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // just a timer for WC/DOS4G -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTFE/Sources/amp11lib/timer.h b/SamTFE/Sources/amp11lib/timer.h index fae3d1a6..7a0e8ded 100644 --- a/SamTFE/Sources/amp11lib/timer.h +++ b/SamTFE/Sources/amp11lib/timer.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __DOS4G__ #error must compile for DOS4G #endif diff --git a/SamTSE/Sources/Ecc/Parser.y b/SamTSE/Sources/Ecc/Parser.y index 3315f977..f672f0e0 100644 --- a/SamTSE/Sources/Ecc/Parser.y +++ b/SamTSE/Sources/Ecc/Parser.y @@ -1,1435 +1,1450 @@ -%{ -// rcg10042001 Changed to specify Ecc directory... -#include "Ecc/StdH.h" -#include "Ecc/Main.h" - -// turn off over-helpful bit of bison... --ryan. -#ifdef __GNUC__ -#define __attribute__(x) -#endif - -#define YYINITDEPTH 1000 - -static const char *_strCurrentClass; -static int _iCurrentClassID; -static const char *_strCurrentBase; -static const char *_strCurrentDescription; -static const char *_strCurrentThumbnail; -static const char *_strCurrentEnum; -static int _bClassIsExported = 0; - -static const char *_strCurrentPropertyID; -static const char *_strCurrentPropertyIdentifier; -static const char *_strCurrentPropertyPropertyType; -static const char *_strCurrentPropertyEnumType; -static const char *_strCurrentPropertyDataType; -static const char *_strCurrentPropertyName; -static const char *_strCurrentPropertyShortcut; -static const char *_strCurrentPropertyColor; -static const char *_strCurrentPropertyFlags; -static const char *_strCurrentPropertyDefaultCode; - -static const char *_strCurrentComponentIdentifier; -static const char *_strCurrentComponentType; -static const char *_strCurrentComponentID; -static const char *_strCurrentComponentFileName; - -static int _ctInProcedureHandler = 0; -static char _strLastProcedureName[256]; - -static char _strInWaitName[256]; -static char _strAfterWaitName[256]; -static char _strInWaitID[256]; -static char _strAfterWaitID[256]; - -static char _strInLoopName[256]; -static char _strAfterLoopName[256]; -static char _strInLoopID[256]; -static char _strAfterLoopID[256]; -static char _strCurrentStateID[256]; - -static int _bInProcedure; // set if currently compiling a procedure -static int _bInHandler; -static int _bHasOtherwise; // set if current 'wait' block has an 'otherwise' statement - -static const char *_strCurrentEvent; -static int _bFeature_AbstractBaseClass; -static int _bFeature_ImplementsOnInitClass; -static int _bFeature_ImplementsOnEndClass; -static int _bFeature_ImplementsOnPrecache; -static int _bFeature_ImplementsOnWorldInit; -static int _bFeature_ImplementsOnWorldEnd; -static int _bFeature_ImplementsOnWorldTick; -static int _bFeature_ImplementsOnWorldRender; -static int _bFeature_CanBePredictable; - -static int _iNextFreeID; -inline int CreateID(void) { - return _iNextFreeID++; -} - -static int _ctBraces = 0; -void OpenBrace(void) { - _ctBraces++; -} -void CloseBrace(void) { - _ctBraces--; -} -SType Braces(int iBraces) { - static char strBraces[50]; - memset(strBraces, '}', sizeof(strBraces)); - strBraces[iBraces] = 0; - return SType(strBraces); -} -char *RemoveLineDirective(char *str) -{ - if (str[0]=='\n' && str[1]=='#') { - return strchr(str+2, '\n')+1; - } else { - return str; - } -} -const char *GetLineDirective(SType &st) -{ - char *str = st.strString; - if (str[0]=='\n' && str[1]=='#' && str[2]=='l') { - char *strResult = strdup(str); - strchr(strResult+3,'\n')[1] = 0; - return strResult; - } else { - return ""; - } -} -void AddHandlerFunction(char *strProcedureName, int iStateID) -{ - fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); - fprintf(_fTables, " {0x%08x, -1, CEntity::pEventHandler(&%s::%s), " - "DEBUGSTRING(\"%s::%s\")},\n", - iStateID, _strCurrentClass, strProcedureName, _strCurrentClass, strProcedureName); -} - - -void AddHandlerFunction(char *strProcedureName, char *strStateID, char *strBaseStateID) -{ - fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); - fprintf(_fTables, " {%s, %s, CEntity::pEventHandler(&%s::%s)," - "DEBUGSTRING(\"%s::%s\")},\n", - strStateID, strBaseStateID, _strCurrentClass, strProcedureName, - _strCurrentClass, RemoveLineDirective(strProcedureName)); - strcpy(_strLastProcedureName, RemoveLineDirective(strProcedureName)); - _ctInProcedureHandler = 0; -} - -void CreateInternalHandlerFunction(char *strFunctionName, char *strID) -{ - int iID = CreateID(); - _ctInProcedureHandler++; - sprintf(strID, "0x%08x", iID); - sprintf(strFunctionName, "H0x%08x_%s_%02d", iID, _strLastProcedureName, _ctInProcedureHandler); - AddHandlerFunction(strFunctionName, iID); -} - -void DeclareFeatureProperties(void) -{ - if (_bFeature_CanBePredictable) { - fprintf(_fTables, " CEntityProperty(CEntityProperty::EPT_ENTITYPTR, NULL, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", - _iCurrentClassID, - "255", - _strCurrentClass, - "m_penPrediction", - "\"\"", - "0", - "0", - "0"); - fprintf(_fDeclaration, " %s %s;\n", - "CEntityPointer", - "m_penPrediction" - ); - fprintf(_fImplementation, " m_penPrediction = NULL;\n"); - } -} - -#define YYERROR_VERBOSE 1 - -%} - -/* BISON Declarations */ - -/* different type of constants */ -%token c_char -%token c_int -%token c_float -%token c_bool -%token c_string - -/* the standard cpp identifier */ -%token identifier - -/* specially bracketed cpp blocks */ -%token cppblock - -/* standard cpp-keywords */ -%token k_while -%token k_for -%token k_if -%token k_else -%token k_enum -%token k_switch -%token k_case -%token k_class -%token k_do -%token k_void -%token k_const -%token k_inline -%token k_static -%token k_virtual -%token k_return -%token k_autowait -%token k_autocall -%token k_waitevent - -/* aditional keywords */ -%token k_event -%token k_name -%token k_thumbnail -%token k_features -%token k_uses -%token k_export - -%token k_texture -%token k_sound -%token k_model - -%token k_properties -%token k_components -%token k_functions -%token k_procedures - -%token k_wait -%token k_on -%token k_otherwise - -%token k_call -%token k_jump -%token k_stop -%token k_resume -%token k_pass - -/* special data types */ -%token k_CTString -%token k_CTStringTrans -%token k_CTFileName -%token k_CTFileNameNoDep -%token k_BOOL -%token k_COLOR -%token k_FLOAT -%token k_INDEX -%token k_RANGE -%token k_CEntityPointer -%token k_CModelObject -%token k_CModelInstance -%token k_CAnimObject -%token k_CSoundObject -%token k_CPlacement3D -%token k_FLOATaabbox3D -%token k_FLOATmatrix3D -%token k_FLOATquat3D -%token k_ANGLE -%token k_FLOAT3D -%token k_ANGLE3D -%token k_FLOATplane3D -%token k_ANIMATION -%token k_ILLUMINATIONTYPE -%token k_FLAGS - -%start program - -%% - -/*///////////////////////////////////////////////////////// - * Global structure of the source file. - */ -program - : /* empty file */ {} - | c_int { - int iID = atoi($1.strString); - if(iID>32767) { - yyerror("Maximum allowed id for entity source file is 32767"); - } - _iCurrentClassID = iID; - _iNextFreeID = iID<<16; - fprintf(_fDeclaration, "#ifndef _%s_INCLUDED\n", _strFileNameBaseIdentifier); - fprintf(_fDeclaration, "#define _%s_INCLUDED 1\n", _strFileNameBaseIdentifier); - - } opt_global_cppblock { - - //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllimport)\n"); - } uses_list { - //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllexport)\n"); - - fprintf(_fImplementation, "#include <%s.h>\n", _strFileNameBase); - fprintf(_fImplementation, "#include <%s_tables.h>\n", _strFileNameBase); - } enum_and_event_declarations_list { - } opt_global_cppblock { - } opt_class_declaration { - fprintf(_fDeclaration, "#endif // _%s_INCLUDED\n", _strFileNameBaseIdentifier); - } - ; - - -/* - * Prolog cpp code. - */ -opt_global_cppblock - : /* null */ - | cppblock { fprintf(_fImplementation, "%s\n", $1.strString); } - ; - -uses_list - : /* null */ - | uses_list uses_statement - ; -uses_statement - : k_uses c_string ';' { - char *strUsedFileName = strdup($2.strString); - strUsedFileName[strlen(strUsedFileName)-1] = 0; - fprintf(_fDeclaration, "#include <%s.h>\n", strUsedFileName+1); - } - ; - - -enum_and_event_declarations_list - : /* null */ - | enum_and_event_declarations_list enum_declaration - | enum_and_event_declarations_list event_declaration - ; -/*///////////////////////////////////////////////////////// - * Enum types declarations - */ -enum_declaration - : k_enum identifier { - _strCurrentEnum = $2.strString; - fprintf(_fTables, "EP_ENUMBEG(%s)\n", _strCurrentEnum ); - fprintf(_fDeclaration, "extern DECL_DLL CEntityPropertyEnumType %s_enum;\n", _strCurrentEnum ); - fprintf(_fDeclaration, "enum %s {\n", _strCurrentEnum ); - } '{' enum_values_list opt_comma '}' ';' { - fprintf(_fTables, "EP_ENUMEND(%s);\n\n", _strCurrentEnum); - fprintf(_fDeclaration, "};\n"); - fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = (%s)0; } ;\n", _strCurrentEnum, _strCurrentEnum); - } - ; -opt_comma : /*null*/ | ','; -enum_values_list - : enum_value - | enum_values_list ',' enum_value - ; - -enum_value - : c_int identifier c_string { - fprintf(_fTables, " EP_ENUMVALUE(%s, %s),\n", $2.strString, $3.strString); - fprintf(_fDeclaration, " %s = %s,\n", $2.strString, $1.strString); - } - ; - -/*///////////////////////////////////////////////////////// - * Event declarations - */ -event_declaration - : k_event identifier { - _strCurrentEvent = $2.strString; - int iID = CreateID(); - fprintf(_fDeclaration, "#define EVENTCODE_%s 0x%08x\n", _strCurrentEvent, iID); - fprintf(_fDeclaration, "class DECL_DLL %s : public CEntityEvent {\npublic:\n", - _strCurrentEvent); - fprintf(_fDeclaration, "%s();\n", _strCurrentEvent ); - fprintf(_fDeclaration, "CEntityEvent *MakeCopy(void);\n"); - fprintf(_fImplementation, - "CEntityEvent *%s::MakeCopy(void) { " - "CEntityEvent *peeCopy = new %s(*this); " - "return peeCopy;}\n", - _strCurrentEvent, _strCurrentEvent); - fprintf(_fImplementation, "%s::%s() : CEntityEvent(EVENTCODE_%s) {;\n", - _strCurrentEvent, _strCurrentEvent, _strCurrentEvent); - } '{' event_members_list opt_comma '}' ';' { - fprintf(_fImplementation, "};\n"); - fprintf(_fDeclaration, "};\n"); - fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = %s(); } ;\n", _strCurrentEvent, _strCurrentEvent); - } - ; - -event_members_list - : /* null */ - | non_empty_event_members_list - ; - -non_empty_event_members_list - : event_member - | event_members_list ',' event_member - ; - -event_member - : any_type identifier { - fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); - fprintf(_fImplementation, " ClearToDefault(%s);\n", $2.strString); - } - ; - -/*///////////////////////////////////////////////////////// - * The class declaration structure. - */ -opt_class_declaration - : /* null */ - | class_declaration - ; - -class_declaration - : /* null */ - | class_optexport identifier ':' identifier '{' - k_name c_string ';' - k_thumbnail c_string ';' { - _strCurrentClass = $2.strString; - _strCurrentBase = $4.strString; - _strCurrentDescription = $7.strString; - _strCurrentThumbnail = $10.strString; - - fprintf(_fTables, "#define ENTITYCLASS %s\n\n", _strCurrentClass); - fprintf(_fDeclaration, "extern \"C\" DECL_DLL CDLLEntityClass %s_DLLClass;\n", - _strCurrentClass); - fprintf(_fDeclaration, "%s %s : public %s {\npublic:\n", - $1.strString, _strCurrentClass, _strCurrentBase); - - } opt_features { - fprintf(_fDeclaration, " %s virtual void SetDefaultProperties(void);\n", _bClassIsExported?"":"DECL_DLL"); - fprintf(_fImplementation, "void %s::SetDefaultProperties(void) {\n", _strCurrentClass); - fprintf(_fTables, "CEntityProperty %s_properties[] = {\n", _strCurrentClass); - - } k_properties ':' property_declaration_list { - fprintf(_fImplementation, " %s::SetDefaultProperties();\n}\n", _strCurrentBase); - - fprintf(_fTables, "CEntityComponent %s_components[] = {\n", _strCurrentClass); - } opt_internal_properties { - } k_components ':' component_declaration_list { - _bTrackLineInformation = 1; - fprintf(_fTables, "CEventHandlerEntry %s_handlers[] = {\n", _strCurrentClass); - - _bInProcedure = 0; - _bInHandler = 0; - } k_functions ':' function_list { - - _bInProcedure = 1; - } k_procedures ':' procedure_list { - } '}' ';' { - fprintf(_fTables, "};\n#define %s_handlersct ARRAYCOUNT(%s_handlers)\n", - _strCurrentClass, _strCurrentClass); - fprintf(_fTables, "\n"); - - if (_bFeature_AbstractBaseClass) { - fprintf(_fTables, "CEntity *%s_New(void) { return NULL; };\n", - _strCurrentClass); - } else { - fprintf(_fTables, "CEntity *%s_New(void) { return new %s; };\n", - _strCurrentClass, _strCurrentClass); - } - - if (!_bFeature_ImplementsOnInitClass) { - fprintf(_fTables, "void %s_OnInitClass(void) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnInitClass(void);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnEndClass) { - fprintf(_fTables, "void %s_OnEndClass(void) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnEndClass(void);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnPrecache) { - fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldEnd) { - fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldInit) { - fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldTick) { - fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo);\n", _strCurrentClass); - } - - if (!_bFeature_ImplementsOnWorldRender) { - fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo) {};\n", _strCurrentClass); - } else { - fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo);\n", _strCurrentClass); - } - - fprintf(_fTables, "ENTITY_CLASSDEFINITION(%s, %s, %s, %s, 0x%08x);\n", - _strCurrentClass, _strCurrentBase, - _strCurrentDescription, _strCurrentThumbnail, _iCurrentClassID); - fprintf(_fTables, "DECLARE_CTFILENAME(_fnm%s_tbn, %s);\n", _strCurrentClass, _strCurrentThumbnail); - - fprintf(_fDeclaration, "};\n"); - } - ; - -class_optexport - : k_class { $$ = $1; _bClassIsExported = 0; } - | k_class k_export { $$ = $1+" DECL_DLL "; _bClassIsExported = 1; } - ; - -opt_features - : /*null */ - | k_features { - _bFeature_ImplementsOnWorldInit = 0; - _bFeature_ImplementsOnWorldEnd = 0; - _bFeature_ImplementsOnWorldTick = 0; - _bFeature_ImplementsOnWorldRender = 0; - _bFeature_ImplementsOnInitClass = 0; - _bFeature_ImplementsOnEndClass = 0; - _bFeature_ImplementsOnPrecache = 0; - _bFeature_AbstractBaseClass = 0; - _bFeature_CanBePredictable = 0; - }features_list ';' - ; -features_list - : feature - | features_list ',' feature - ; -feature - : c_string { - if (strcmp($1.strString, "\"AbstractBaseClass\"")==0) { - _bFeature_AbstractBaseClass = 1; - } else if (strcmp($1.strString, "\"IsTargetable\"")==0) { - fprintf(_fDeclaration, "virtual BOOL IsTargetable(void) const { return TRUE; };\n"); - } else if (strcmp($1.strString, "\"IsImportant\"")==0) { - fprintf(_fDeclaration, "virtual BOOL IsImportant(void) const { return TRUE; };\n"); - } else if (strcmp($1.strString, "\"HasName\"")==0) { - fprintf(_fDeclaration, - "virtual const CTString &GetName(void) const { return m_strName; };\n"); - } else if (strcmp($1.strString, "\"CanBePredictable\"")==0) { - fprintf(_fDeclaration, - "virtual CEntity *GetPredictionPair(void) { return m_penPrediction; };\n"); - fprintf(_fDeclaration, - "virtual void SetPredictionPair(CEntity *penPair) { m_penPrediction = penPair; };\n"); - _bFeature_CanBePredictable = 1; - } else if (strcmp($1.strString, "\"HasDescription\"")==0) { - fprintf(_fDeclaration, - "virtual const CTString &GetDescription(void) const { return m_strDescription; };\n"); - } else if (strcmp($1.strString, "\"HasTarget\"")==0) { - fprintf(_fDeclaration, - "virtual CEntity *GetTarget(void) const { return m_penTarget; };\n"); - } else if (strcmp($1.strString, "\"ImplementsOnInitClass\"")==0) { - _bFeature_ImplementsOnInitClass = 1; - } else if (strcmp($1.strString, "\"ImplementsOnEndClass\"")==0) { - _bFeature_ImplementsOnEndClass = 1; - } else if (strcmp($1.strString, "\"ImplementsOnPrecache\"")==0) { - _bFeature_ImplementsOnPrecache = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldInit\"")==0) { - _bFeature_ImplementsOnWorldInit = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldEnd\"")==0) { - _bFeature_ImplementsOnWorldEnd = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldTick\"")==0) { - _bFeature_ImplementsOnWorldTick = 1; - } else if (strcmp($1.strString, "\"ImplementsOnWorldRender\"")==0) { - _bFeature_ImplementsOnWorldRender = 1; - } else { - yyerror((SType("Unknown feature: ")+$1).strString); - } - } - ; - -opt_internal_properties - : /* null */ - | '{' internal_property_list '}' - ; -internal_property_list - : /* null */ - | internal_property_list internal_property - ; -internal_property - : any_type identifier ';' { - fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); - } - ; - -/*///////////////////////////////////////////////////////// - * Property declarations - */ - -property_declaration_list - : empty_property_declaration_list { - DeclareFeatureProperties(); // this won't work, but at least it will generate an error!!!! - fprintf(_fTables, " CEntityProperty()\n};\n"); - fprintf(_fTables, "#define %s_propertiesct 0\n", _strCurrentClass); - fprintf(_fTables, "\n"); - fprintf(_fTables, "\n"); - } - | nonempty_property_declaration_list opt_comma { - DeclareFeatureProperties(); - fprintf(_fTables, "};\n"); - fprintf(_fTables, "#define %s_propertiesct ARRAYCOUNT(%s_properties)\n", - _strCurrentClass, _strCurrentClass); - fprintf(_fTables, "\n"); - } - ; -nonempty_property_declaration_list - : property_declaration - | nonempty_property_declaration_list ',' property_declaration - ; -empty_property_declaration_list - : /* null */ - ; - -property_declaration - : property_id property_type property_identifier property_wed_name_opt property_default_opt property_flags_opt { - fprintf(_fTables, " CEntityProperty(%s, %s, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", - _strCurrentPropertyPropertyType, - _strCurrentPropertyEnumType, - _iCurrentClassID, - _strCurrentPropertyID, - _strCurrentClass, - _strCurrentPropertyIdentifier, - _strCurrentPropertyName, - _strCurrentPropertyShortcut, - _strCurrentPropertyColor, - _strCurrentPropertyFlags); - fprintf(_fDeclaration, " %s %s;\n", - _strCurrentPropertyDataType, - _strCurrentPropertyIdentifier - ); - - if (strlen(_strCurrentPropertyDefaultCode)>0) { - fprintf(_fImplementation, " %s\n", _strCurrentPropertyDefaultCode); - } - } - ; - -property_id : c_int { _strCurrentPropertyID = $1.strString; }; -property_identifier : identifier { _strCurrentPropertyIdentifier = $1.strString; }; - -property_type - : k_enum identifier { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENUM"; - _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; - _strCurrentPropertyDataType = (SType("enum ")+$2.strString).strString; - } - | k_FLAGS identifier { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLAGS"; - _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; - _strCurrentPropertyDataType = "ULONG"; - } - | k_CTString { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRING"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTString"; - } - | k_CTStringTrans { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRINGTRANS"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTStringTrans"; - } - | k_CTFileName { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAME"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTFileName"; - } - | k_CTFileNameNoDep { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAMENODEP"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CTFileNameNoDep"; - } - | k_BOOL { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_BOOL"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "BOOL"; - } - | k_COLOR { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_COLOR"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "COLOR"; - } - | k_FLOAT { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOAT"; - } - | k_INDEX { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_INDEX"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "INDEX"; - } - | k_RANGE { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_RANGE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "RANGE"; - } - | k_CEntityPointer { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENTITYPTR"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CEntityPointer"; - } - | k_CModelObject { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELOBJECT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CModelObject"; - } - | k_CModelInstance { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELINSTANCE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CModelInstance"; - } - | k_CAnimObject { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMOBJECT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CAnimObject"; - } - | k_CSoundObject { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_SOUNDOBJECT"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CSoundObject"; - } - | k_CPlacement3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_PLACEMENT3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "CPlacement3D"; - } - | k_FLOATaabbox3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATAABBOX3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATaabbox3D"; - } - | k_FLOATmatrix3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATMATRIX3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATmatrix3D"; - } - | k_FLOATquat3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATQUAT3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATquat3D"; - } - | k_ANGLE { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ANGLE"; - } - | k_ANGLE3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ANGLE3D"; - } - | k_FLOAT3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOAT3D"; - } - | k_FLOATplane3D { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATplane3D"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "FLOATplane3D"; - } - | k_ILLUMINATIONTYPE { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ILLUMINATIONTYPE"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ILLUMINATIONTYPE"; - } - | k_ANIMATION { - _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMATION"; - _strCurrentPropertyEnumType = "NULL"; - _strCurrentPropertyDataType = "ANIMATION"; - } - ; - -property_wed_name_opt - : /* null */ { - _strCurrentPropertyName = "\"\""; - _strCurrentPropertyShortcut = "0"; - _strCurrentPropertyColor = "0"; // this won't be rendered anyway - } - | c_string property_shortcut_opt property_color_opt { - _strCurrentPropertyName = $1.strString; - } - ; -property_shortcut_opt - : /* null */ { - _strCurrentPropertyShortcut = "0"; - } - | c_char { - _strCurrentPropertyShortcut = $1.strString; - } - -property_color_opt - : /* null */ { - _strCurrentPropertyColor = "0x7F0000FFUL"; // dark red - } - | k_COLOR '(' expression ')' { - _strCurrentPropertyColor = $3.strString; - } -property_flags_opt - : /* null */ { - _strCurrentPropertyFlags = "0"; // dark red - } - | k_features '(' expression ')' { - _strCurrentPropertyFlags = $3.strString; - } - -property_default_opt - : /* null */ { - if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { - _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = NULL;").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CModelObject")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n"+ - _strCurrentPropertyIdentifier+".mo_toTexture.SetData(NULL);").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CModelInstance")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".Clear();\n").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CAnimObject")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n").strString; - } else if (strcmp(_strCurrentPropertyDataType,"CSoundObject")==0) { - _strCurrentPropertyDefaultCode = - (SType(_strCurrentPropertyIdentifier)+".SetOwner(this);\n"+ - _strCurrentPropertyIdentifier+".Stop_internal();").strString; - } else { - yyerror("this kind of property must have default value"); - _strCurrentPropertyDefaultCode = ""; - } - } - | '=' property_default_expression { - if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { - yyerror("CEntityPointer type properties always default to NULL"); - } else { - _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = "+$2.strString+";").strString; - } - } - ; -property_default_expression - : c_int|c_float|c_bool|c_char|c_string - | identifier {$$ = $1 + " ";} - | identifier '(' expression ')' {$$ = $1+$2+$3+$4;} - | type_keyword '(' expression ')' {$$ = $1+$2+$3+$4;} - | '-' property_default_expression {$$ = $1+$2;} - | '(' expression ')' {$$ = $1+$2+$3;} - ; - -/*///////////////////////////////////////////////////////// - * Component declarations - */ -component_declaration_list - : empty_component_declaration_list { - fprintf(_fTables, " CEntityComponent()\n};\n"); - fprintf(_fTables, "#define %s_componentsct 0\n", _strCurrentClass); - fprintf(_fTables, "\n"); - fprintf(_fTables, "\n"); - } - | nonempty_component_declaration_list opt_comma { - fprintf(_fTables, "};\n"); - fprintf(_fTables, "#define %s_componentsct ARRAYCOUNT(%s_components)\n", - _strCurrentClass, _strCurrentClass); - fprintf(_fTables, "\n"); - } - ; -nonempty_component_declaration_list - : component_declaration - | nonempty_component_declaration_list ',' component_declaration - ; -empty_component_declaration_list - : /* null */ - ; - -component_declaration - : component_id component_type component_identifier component_filename { - fprintf(_fTables, "#define %s ((0x%08x<<8)+%s)\n", - _strCurrentComponentIdentifier, - _iCurrentClassID, - _strCurrentComponentID); - fprintf(_fTables, " CEntityComponent(%s, %s, \"%s%s\" %s),\n", - _strCurrentComponentType, - _strCurrentComponentIdentifier, - "EF","NM", - _strCurrentComponentFileName); - } - ; - -component_id : c_int { _strCurrentComponentID = $1.strString; }; -component_identifier : identifier { _strCurrentComponentIdentifier = $1.strString; }; -component_filename : c_string { _strCurrentComponentFileName = $1.strString; }; - -component_type - : k_model { _strCurrentComponentType = "ECT_MODEL"; } - | k_texture { _strCurrentComponentType = "ECT_TEXTURE"; } - | k_sound { _strCurrentComponentType = "ECT_SOUND"; } - | k_class { _strCurrentComponentType = "ECT_CLASS"; } - ; - -/*///////////////////////////////////////////////////////// - * Functions - */ -function_list - : { $$ = "";} - | function_list function_implementation {$$ = $1+$2;} - ; - -function_implementation - : opt_export opt_virtual return_type opt_tilde identifier '(' parameters_list ')' opt_const - '{' statements '}' opt_semicolon { - const char *strReturnType = $3.strString; - const char *strFunctionHeader = ($4+$5+$6+$7+$8+$9).strString; - const char *strFunctionBody = ($10+$11+$12).strString; - if (strcmp($5.strString, _strCurrentClass)==0) { - if (strcmp(strReturnType+strlen(strReturnType)-4, "void")==0 ) { - strReturnType = ""; - } else { - yyerror("use 'void' as return type for constructors"); - } - } - fprintf(_fDeclaration, " %s %s %s %s;\n", - $1.strString, $2.strString, strReturnType, strFunctionHeader); - fprintf(_fImplementation, " %s %s::%s %s\n", - strReturnType, _strCurrentClass, strFunctionHeader, strFunctionBody); - } - ; -opt_tilde - : { $$ = "";} - | '~' { $$ = " ~ "; } - ; - -opt_export - : { $$ = "";} - | k_export { - if (_bClassIsExported) { - $$ = ""; - } else { - $$ = " DECL_DLL "; - } - } - ; - -opt_const - : { $$ = "";} - | k_const { $$ = $1; } - ; -opt_virtual - : { $$ = "";} - | k_virtual { $$ = $1; } - ; -opt_semicolon - : /* null */ - | ';' - ; -parameters_list - : { $$ = "";} - | k_void - | non_void_parameters_list - ; -non_void_parameters_list - : parameter_declaration - | non_void_parameters_list ',' parameter_declaration {$$ = $1+$2+$3;} - ; -parameter_declaration - : any_type identifier { $$=$1+" "+$2; } - ; - -return_type - : any_type - | k_void - ; - -any_type - : type_keyword - | identifier - | k_enum identifier { $$=$1+" "+$2; } - | any_type '*' { $$=$1+" "+$2; } - | any_type '&' { $$=$1+" "+$2; } - | k_void '*' { $$=$1+" "+$2; } - | k_const any_type { $$=$1+" "+$2; } - | k_inline any_type { $$=$1+" "+$2; } - | k_static any_type { $$=$1+" "+$2; } - | k_class any_type { $$=$1+" "+$2; } - | identifier '<' any_type '>' { $$=$1+" "+$2+" "+$3+" "+$4; } - ; - - -/*///////////////////////////////////////////////////////// - * Procedures - */ -procedure_list - : { $$ = "";} - | procedure_list procedure_implementation {$$ = $1+$2;} - ; - -opt_override - : { $$ = "-1"; } - | ':' identifier ':' ':' identifier { - $$ = SType("STATE_")+$2+"_"+$5; - } - ; - -procedure_implementation - : identifier '(' event_specification ')' opt_override { - char *strProcedureName = $1.strString; - char strInputEventType[80]; - char strInputEventName[80]; - sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); - - char strStateID[256]; - const char *strBaseStateID = "-1"; - if(strcmp(RemoveLineDirective(strProcedureName), "Main")==0){ - strcpy(strStateID, "1"); - if(strncmp(strInputEventType, "EVoid", 4)!=0 && _strCurrentThumbnail[2]!=0) { - yyerror("procedure 'Main' can take input parameters only in classes without thumbnails"); - } - } else { - sprintf(strStateID, "0x%08x", CreateID()); - } - - sprintf(_strCurrentStateID, "STATE_%s_%s", - _strCurrentClass, RemoveLineDirective(strProcedureName)); - fprintf(_fDeclaration, "#define %s %s\n", _strCurrentStateID, strStateID); - AddHandlerFunction(strProcedureName, strStateID, $5.strString); - fprintf(_fImplementation, - "BOOL %s::%s(const CEntityEvent &__eeInput) {\n#undef STATE_CURRENT\n#define STATE_CURRENT %s\n", - _strCurrentClass, strProcedureName, _strCurrentStateID); - fprintf(_fImplementation, - " ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_%s, \"%s::%s expects '%s' as input!\");", - strInputEventType, _strCurrentClass, RemoveLineDirective(strProcedureName), - strInputEventType); - fprintf(_fImplementation, " const %s &%s = (const %s &)__eeInput;", - strInputEventType, strInputEventName, strInputEventType); - - } '{' statements '}' opt_semicolon { - char *strFunctionBody = $8.strString; - fprintf(_fImplementation, "%s ASSERT(FALSE); return TRUE;};", strFunctionBody); - } - ; - -event_specification - : { - $$="EVoid e"; - } - | identifier { - $$=$1+" e"; - } - | identifier identifier { - $$=$1+" "+$2; - } - ; - -expression - : c_int|c_float|c_bool|c_char|c_string - | identifier {$$ = $1 + " ";} - | type_keyword - | '='|'+'|'-'|'<'|'>'|'!'|'|'|'&'|'*'|'/'|'%'|'^'|'['|']'|':'|','|'.'|'?'|'~' - | '(' ')' {$$=$1+$2;} - | '+' '+' {$$=$1+$2;} - | '-' '-' {$$=$1+$2;} - | '-' '>' {$$=$1+$2;} - | ':' ':' {$$=$1+$2;} - | '&' '&' {$$=$1+$2;} - | '|' '|' {$$=$1+$2;} - | '^' '^' {$$=$1+$2;} - | '>' '>' {$$=$1+$2;} - | '<' '<' {$$=$1+$2;} - | '=' '=' {$$=$1+$2;} - | '!' '=' {$$=$1+$2;} - | '>' '=' {$$=$1+$2;} - | '<' '=' {$$=$1+$2;} - | '&' '=' {$$=$1+$2;} - | '|' '=' {$$=$1+$2;} - | '^' '=' {$$=$1+$2;} - | '+' '=' {$$=$1+$2;} - | '-' '=' {$$=$1+$2;} - | '/' '=' {$$=$1+$2;} - | '%' '=' {$$=$1+$2;} - | '*' '=' {$$=$1+$2;} - | '>' '>' '=' {$$=$1+$2+$3;} - | '<' '<' '=' {$$=$1+$2+$3;} - | '(' expression ')' {$$ = $1+$2+$3;} - | expression expression {$$ = $1+" "+$2;} - ; -type_keyword - : k_CTString|k_CTStringTrans|k_CTFileName|k_CTFileNameNoDep - | k_BOOL|k_COLOR|k_FLOAT|k_INDEX|k_RANGE - | k_CEntityPointer|k_CModelObject|k_CModelInstance|k_CAnimObject|k_CSoundObject - | k_CPlacement3D | k_FLOATaabbox3D|k_FLOATmatrix3D| k_FLOATquat3D|k_ANGLE|k_ANIMATION|k_ILLUMINATIONTYPE - | k_ANGLE3D|k_FLOAT3D|k_FLOATplane3D - | k_const - | k_static - ; -case_constant_expression - : c_int|c_float|c_bool|c_char|c_string - | identifier {$$ = $1 + " ";} - ; - - -/* Simple statements: - */ -statements - : { $$ = "";} - | statements statement { $$ = $1+$2; } - ; -statement - : expression ';' {$$=$1+$2;} - | k_switch '(' expression ')' '{' statements '}' {$$=$1+$2+$3+$4+$5+$6+$7;} - | k_case case_constant_expression ':' {$$=$1+" "+$2+$3+" ";} - | '{' statements '}' {$$=$1+$2+$3;} - | expression '{' statements '}' {$$=$1+$2+$3+$4;} - | statement_while - | statement_dowhile - | statement_for - | statement_if - | statement_if_else - | statement_wait - | statement_autowait - | statement_waitevent - | statement_call - | statement_autocall - | statement_stop - | statement_resume - | statement_pass - | statement_return - | statement_jump - | ';' - ; - - -statement_if - : k_if '(' expression ')' '{' statements '}' { - if ($6.bCrossesStates) { - char strAfterIfName[80], strAfterIfID[11]; - CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); - $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+$6+ - "Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; - } else { - $$ = $1+$2+$3+$4+$5+$6+$7; - } - } - ; - -statement_if_else - : k_if '(' expression ')' '{' statements '}' k_else statement { - if ($6.bCrossesStates || $9.bCrossesStates) { - char strAfterIfName[80], strAfterIfID[11]; - char strElseName[80], strElseID[11]; - CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); - CreateInternalHandlerFunction(strElseName, strElseID); - $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strElseID+", FALSE, EInternal());return TRUE;}"+ - $6+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+strElseName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strElseID+"\n"+ - $9+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}\n"+ - "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; - } else { - $$ = $1+$2+$3+$4+$5+$6+$7+$8+" "+$9; - } - } - ; - -statement_while - : k_while '(' expression ')' { - if (strlen(_strInLoopName)>0) { - yyerror("Nested loops are not implemented yet"); - } - } '{' statements '}' { - if ($7.bCrossesStates) { - CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); - CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); - $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$6+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+ - "if(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ - $7+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$8+ - "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; - } else { - $$ = $1+$2+$3+$4+$6+$7+$8; - } - _strInLoopName[0] = 0; - } - ; - -statement_dowhile - : k_do '{' statements '}' { - if (strlen(_strInLoopName)>0) { - yyerror("Nested loops are not implemented yet"); - } - _strInLoopName[0] = 0; - } k_while '(' expression ')' ';' { - if ($3.bCrossesStates) { - CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); - CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); - $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$2+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+$3+ - "if(!"+$7+$8+$9+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ - "Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$4+ - "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; - } else { - $$ = $1+$2+$3+$4+$6+$7+$8+$9+$10; - } - _strInLoopName[0] = 0; - } - ; - -statement_for - : k_for '(' expression ';' expression ';' expression ')' { - if (strlen(_strInLoopName)>0) { - yyerror("Nested loops are not implemented yet"); - } - } '{' statements '}' { - if ($11.bCrossesStates) { - CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); - CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); - yyerror("For loops across states are not supported"); - } else { - $$ = $1+$2+$3+$4+$5+$6+$7+$8+$10+$11+$12; - } - _strInLoopName[0] = 0; - } - ; - -statement_wait - : k_wait wait_expression { - if (!_bInProcedure) { - yyerror("Cannot have 'wait' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - _bInHandler = 1; - } '{' handlers_list '}' { - if ($5.bCrossesStates) { - yyerror("'wait' statements must not be nested"); - $$ = ""; - } else { - SType stDefault; - if (!_bHasOtherwise) { - stDefault = SType("default: return FALSE; break;"); - } else { - stDefault = SType(""); - } - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent)"+$4+$5+stDefault+$6+ - "return TRUE;}BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"; - $$.bCrossesStates = 1; - _bInHandler = 0; - } - } - ; -statement_autowait - : k_autowait wait_expression ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'autowait' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent) {"+ - "case EVENTCODE_EBegin: return TRUE;"+ - "case EVENTCODE_ETimer: Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, EInternal()); return TRUE;"+ - "default: return FALSE; }}"+ - "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+$3; - $$.bCrossesStates = 1; - } - ; - -statement_waitevent - : k_waitevent wait_expression identifier opt_eventvar ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'autocall' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent) {"+ - "case EVENTCODE_EBegin: return TRUE;"+ - "case EVENTCODE_"+$3+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ - "default: return FALSE; }}"+ - "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ - "const "+$3+"&"+$4+"= ("+$3+"&)__eeInput;\n"+$5; - $$.bCrossesStates = 1; - } - ; - - -opt_eventvar - : { - $$ = SType("__e"); - } - | identifier { - $$ = $1; - } - -statement_autocall - : k_autocall jumptarget '(' event_expression ')' identifier opt_eventvar ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'autocall' in functions"); - } - CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); - CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); - _bHasOtherwise = 0; - - $$ = SType(GetLineDirective($1))+$2+";\n"+ - "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ - "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ - "switch(__eeInput.ee_slEvent) {"+ - "case EVENTCODE_EBegin: Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"+ - "case EVENTCODE_"+$6+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ - "default: return FALSE; }}"+ - "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ - "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ - "const "+$6+"&"+$7+"= ("+$6+"&)__eeInput;\n"+$8; - $$.bCrossesStates = 1; - } - ; - -wait_expression - : '(' ')' { - $$ = SType("SetTimerAt(THINKTIME_NEVER)"); - } - | '(' expression ')' { - $$ = SType("SetTimerAfter")+$1+$2+$3; - } - ; - -statement_jump - : k_jump jumptarget '(' event_expression ')' ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'jump' in functions"); - } - $$ = SType(GetLineDirective($1))+"Jump"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; - } - ; - -statement_call - : k_call jumptarget '(' event_expression')' ';' { - if (!_bInProcedure) { - yyerror("Cannot have 'call' in functions"); - } - if (!_bInHandler) { - yyerror("'call' must be inside a 'wait' statement"); - } - $$ = SType(GetLineDirective($1))+"Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; - } - ; - -event_expression - : expression { - $$ = $1; - } - | { - $$ = SType("EVoid()"); - } - ; - -jumptarget - : identifier { - $$ = SType("STATE_")+_strCurrentClass+"_"+$1+", TRUE"; - } - | identifier ':' ':' identifier { - $$ = SType("STATE_")+$1+"_"+$4+", FALSE"; - } - ; - -statement_stop - : k_stop ';' { - $$ = SType(GetLineDirective($1))+"UnsetTimer();Jump(STATE_CURRENT," - +_strAfterWaitID+", FALSE, EInternal());"+"return TRUE"+$2; - } - ; -statement_resume - : k_resume ';' { - $$ = SType(GetLineDirective($1))+"return TRUE"+$2; - } - ; -statement_pass - : k_pass ';' { - $$ = SType(GetLineDirective($1))+"return FALSE"+$2; - } - ; -statement_return - : k_return opt_expression ';' { - if (!_bInProcedure) { - $$ = $1+" "+$2+$3; - } else { - if (strlen($2.strString)==0) { - $2 = SType("EVoid()"); - } - $$ = SType(GetLineDirective($1)) - +"Return(STATE_CURRENT,"+$2+");" - +$1+" TRUE"+$3; - } - } - ; -opt_expression - : {$$ = "";} - | expression - ; - -handler - : k_on '(' event_specification ')' ':' '{' statements '}' opt_semicolon { - char strInputEventType[80]; - char strInputEventName[80]; - sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); - - $$ = SType("case")+$2+"EVENTCODE_"+strInputEventType+$4+$5+$6+ - "const "+strInputEventType+"&"+strInputEventName+"= ("+ - strInputEventType+"&)__eeInput;\n"+$7+$8+"ASSERT(FALSE);break;"; - } - | k_otherwise '(' event_specification ')' ':' '{' statements '}' opt_semicolon { - char strInputEventType[80]; - char strInputEventName[80]; - sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); - - $$ = SType("default")+$5+$6+$7+$8+"ASSERT(FALSE);break;"; - _bHasOtherwise = 1; - } - ; -handlers_list - : { $$ = "";} - | handlers_list handler { $$ = $1+$2; } - ; - -%% +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// rcg10042001 Changed to specify Ecc directory... +#include "Ecc/StdH.h" +#include "Ecc/Main.h" + +// turn off over-helpful bit of bison... --ryan. +#ifdef __GNUC__ +#define __attribute__(x) +#endif + +#define YYINITDEPTH 1000 + +static const char *_strCurrentClass; +static int _iCurrentClassID; +static const char *_strCurrentBase; +static const char *_strCurrentDescription; +static const char *_strCurrentThumbnail; +static const char *_strCurrentEnum; +static int _bClassIsExported = 0; + +static const char *_strCurrentPropertyID; +static const char *_strCurrentPropertyIdentifier; +static const char *_strCurrentPropertyPropertyType; +static const char *_strCurrentPropertyEnumType; +static const char *_strCurrentPropertyDataType; +static const char *_strCurrentPropertyName; +static const char *_strCurrentPropertyShortcut; +static const char *_strCurrentPropertyColor; +static const char *_strCurrentPropertyFlags; +static const char *_strCurrentPropertyDefaultCode; + +static const char *_strCurrentComponentIdentifier; +static const char *_strCurrentComponentType; +static const char *_strCurrentComponentID; +static const char *_strCurrentComponentFileName; + +static int _ctInProcedureHandler = 0; +static char _strLastProcedureName[256]; + +static char _strInWaitName[256]; +static char _strAfterWaitName[256]; +static char _strInWaitID[256]; +static char _strAfterWaitID[256]; + +static char _strInLoopName[256]; +static char _strAfterLoopName[256]; +static char _strInLoopID[256]; +static char _strAfterLoopID[256]; +static char _strCurrentStateID[256]; + +static int _bInProcedure; // set if currently compiling a procedure +static int _bInHandler; +static int _bHasOtherwise; // set if current 'wait' block has an 'otherwise' statement + +static const char *_strCurrentEvent; +static int _bFeature_AbstractBaseClass; +static int _bFeature_ImplementsOnInitClass; +static int _bFeature_ImplementsOnEndClass; +static int _bFeature_ImplementsOnPrecache; +static int _bFeature_ImplementsOnWorldInit; +static int _bFeature_ImplementsOnWorldEnd; +static int _bFeature_ImplementsOnWorldTick; +static int _bFeature_ImplementsOnWorldRender; +static int _bFeature_CanBePredictable; + +static int _iNextFreeID; +inline int CreateID(void) { + return _iNextFreeID++; +} + +static int _ctBraces = 0; +void OpenBrace(void) { + _ctBraces++; +} +void CloseBrace(void) { + _ctBraces--; +} +SType Braces(int iBraces) { + static char strBraces[50]; + memset(strBraces, '}', sizeof(strBraces)); + strBraces[iBraces] = 0; + return SType(strBraces); +} +char *RemoveLineDirective(char *str) +{ + if (str[0]=='\n' && str[1]=='#') { + return strchr(str+2, '\n')+1; + } else { + return str; + } +} +const char *GetLineDirective(SType &st) +{ + char *str = st.strString; + if (str[0]=='\n' && str[1]=='#' && str[2]=='l') { + char *strResult = strdup(str); + strchr(strResult+3,'\n')[1] = 0; + return strResult; + } else { + return ""; + } +} +void AddHandlerFunction(char *strProcedureName, int iStateID) +{ + fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); + fprintf(_fTables, " {0x%08x, -1, CEntity::pEventHandler(&%s::%s), " + "DEBUGSTRING(\"%s::%s\")},\n", + iStateID, _strCurrentClass, strProcedureName, _strCurrentClass, strProcedureName); +} + + +void AddHandlerFunction(char *strProcedureName, char *strStateID, char *strBaseStateID) +{ + fprintf(_fDeclaration, " BOOL %s(const CEntityEvent &__eeInput);\n", strProcedureName); + fprintf(_fTables, " {%s, %s, CEntity::pEventHandler(&%s::%s)," + "DEBUGSTRING(\"%s::%s\")},\n", + strStateID, strBaseStateID, _strCurrentClass, strProcedureName, + _strCurrentClass, RemoveLineDirective(strProcedureName)); + strcpy(_strLastProcedureName, RemoveLineDirective(strProcedureName)); + _ctInProcedureHandler = 0; +} + +void CreateInternalHandlerFunction(char *strFunctionName, char *strID) +{ + int iID = CreateID(); + _ctInProcedureHandler++; + sprintf(strID, "0x%08x", iID); + sprintf(strFunctionName, "H0x%08x_%s_%02d", iID, _strLastProcedureName, _ctInProcedureHandler); + AddHandlerFunction(strFunctionName, iID); +} + +void DeclareFeatureProperties(void) +{ + if (_bFeature_CanBePredictable) { + fprintf(_fTables, " CEntityProperty(CEntityProperty::EPT_ENTITYPTR, NULL, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", + _iCurrentClassID, + "255", + _strCurrentClass, + "m_penPrediction", + "\"\"", + "0", + "0", + "0"); + fprintf(_fDeclaration, " %s %s;\n", + "CEntityPointer", + "m_penPrediction" + ); + fprintf(_fImplementation, " m_penPrediction = NULL;\n"); + } +} + +#define YYERROR_VERBOSE 1 + +%} + +/* BISON Declarations */ + +/* different type of constants */ +%token c_char +%token c_int +%token c_float +%token c_bool +%token c_string + +/* the standard cpp identifier */ +%token identifier + +/* specially bracketed cpp blocks */ +%token cppblock + +/* standard cpp-keywords */ +%token k_while +%token k_for +%token k_if +%token k_else +%token k_enum +%token k_switch +%token k_case +%token k_class +%token k_do +%token k_void +%token k_const +%token k_inline +%token k_static +%token k_virtual +%token k_return +%token k_autowait +%token k_autocall +%token k_waitevent + +/* aditional keywords */ +%token k_event +%token k_name +%token k_thumbnail +%token k_features +%token k_uses +%token k_export + +%token k_texture +%token k_sound +%token k_model + +%token k_properties +%token k_components +%token k_functions +%token k_procedures + +%token k_wait +%token k_on +%token k_otherwise + +%token k_call +%token k_jump +%token k_stop +%token k_resume +%token k_pass + +/* special data types */ +%token k_CTString +%token k_CTStringTrans +%token k_CTFileName +%token k_CTFileNameNoDep +%token k_BOOL +%token k_COLOR +%token k_FLOAT +%token k_INDEX +%token k_RANGE +%token k_CEntityPointer +%token k_CModelObject +%token k_CModelInstance +%token k_CAnimObject +%token k_CSoundObject +%token k_CPlacement3D +%token k_FLOATaabbox3D +%token k_FLOATmatrix3D +%token k_FLOATquat3D +%token k_ANGLE +%token k_FLOAT3D +%token k_ANGLE3D +%token k_FLOATplane3D +%token k_ANIMATION +%token k_ILLUMINATIONTYPE +%token k_FLAGS + +%start program + +%% + +/*///////////////////////////////////////////////////////// + * Global structure of the source file. + */ +program + : /* empty file */ {} + | c_int { + int iID = atoi($1.strString); + if(iID>32767) { + yyerror("Maximum allowed id for entity source file is 32767"); + } + _iCurrentClassID = iID; + _iNextFreeID = iID<<16; + fprintf(_fDeclaration, "#ifndef _%s_INCLUDED\n", _strFileNameBaseIdentifier); + fprintf(_fDeclaration, "#define _%s_INCLUDED 1\n", _strFileNameBaseIdentifier); + + } opt_global_cppblock { + + //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllimport)\n"); + } uses_list { + //fprintf(_fImplementation, "\n#undef DECL_DLL\n#define DECL_DLL _declspec(dllexport)\n"); + + fprintf(_fImplementation, "#include <%s.h>\n", _strFileNameBase); + fprintf(_fImplementation, "#include <%s_tables.h>\n", _strFileNameBase); + } enum_and_event_declarations_list { + } opt_global_cppblock { + } opt_class_declaration { + fprintf(_fDeclaration, "#endif // _%s_INCLUDED\n", _strFileNameBaseIdentifier); + } + ; + + +/* + * Prolog cpp code. + */ +opt_global_cppblock + : /* null */ + | cppblock { fprintf(_fImplementation, "%s\n", $1.strString); } + ; + +uses_list + : /* null */ + | uses_list uses_statement + ; +uses_statement + : k_uses c_string ';' { + char *strUsedFileName = strdup($2.strString); + strUsedFileName[strlen(strUsedFileName)-1] = 0; + fprintf(_fDeclaration, "#include <%s.h>\n", strUsedFileName+1); + } + ; + + +enum_and_event_declarations_list + : /* null */ + | enum_and_event_declarations_list enum_declaration + | enum_and_event_declarations_list event_declaration + ; +/*///////////////////////////////////////////////////////// + * Enum types declarations + */ +enum_declaration + : k_enum identifier { + _strCurrentEnum = $2.strString; + fprintf(_fTables, "EP_ENUMBEG(%s)\n", _strCurrentEnum ); + fprintf(_fDeclaration, "extern DECL_DLL CEntityPropertyEnumType %s_enum;\n", _strCurrentEnum ); + fprintf(_fDeclaration, "enum %s {\n", _strCurrentEnum ); + } '{' enum_values_list opt_comma '}' ';' { + fprintf(_fTables, "EP_ENUMEND(%s);\n\n", _strCurrentEnum); + fprintf(_fDeclaration, "};\n"); + fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = (%s)0; } ;\n", _strCurrentEnum, _strCurrentEnum); + } + ; +opt_comma : /*null*/ | ','; +enum_values_list + : enum_value + | enum_values_list ',' enum_value + ; + +enum_value + : c_int identifier c_string { + fprintf(_fTables, " EP_ENUMVALUE(%s, %s),\n", $2.strString, $3.strString); + fprintf(_fDeclaration, " %s = %s,\n", $2.strString, $1.strString); + } + ; + +/*///////////////////////////////////////////////////////// + * Event declarations + */ +event_declaration + : k_event identifier { + _strCurrentEvent = $2.strString; + int iID = CreateID(); + fprintf(_fDeclaration, "#define EVENTCODE_%s 0x%08x\n", _strCurrentEvent, iID); + fprintf(_fDeclaration, "class DECL_DLL %s : public CEntityEvent {\npublic:\n", + _strCurrentEvent); + fprintf(_fDeclaration, "%s();\n", _strCurrentEvent ); + fprintf(_fDeclaration, "CEntityEvent *MakeCopy(void);\n"); + fprintf(_fImplementation, + "CEntityEvent *%s::MakeCopy(void) { " + "CEntityEvent *peeCopy = new %s(*this); " + "return peeCopy;}\n", + _strCurrentEvent, _strCurrentEvent); + fprintf(_fImplementation, "%s::%s() : CEntityEvent(EVENTCODE_%s) {;\n", + _strCurrentEvent, _strCurrentEvent, _strCurrentEvent); + } '{' event_members_list opt_comma '}' ';' { + fprintf(_fImplementation, "};\n"); + fprintf(_fDeclaration, "};\n"); + fprintf(_fDeclaration, "DECL_DLL inline void ClearToDefault(%s &e) { e = %s(); } ;\n", _strCurrentEvent, _strCurrentEvent); + } + ; + +event_members_list + : /* null */ + | non_empty_event_members_list + ; + +non_empty_event_members_list + : event_member + | event_members_list ',' event_member + ; + +event_member + : any_type identifier { + fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); + fprintf(_fImplementation, " ClearToDefault(%s);\n", $2.strString); + } + ; + +/*///////////////////////////////////////////////////////// + * The class declaration structure. + */ +opt_class_declaration + : /* null */ + | class_declaration + ; + +class_declaration + : /* null */ + | class_optexport identifier ':' identifier '{' + k_name c_string ';' + k_thumbnail c_string ';' { + _strCurrentClass = $2.strString; + _strCurrentBase = $4.strString; + _strCurrentDescription = $7.strString; + _strCurrentThumbnail = $10.strString; + + fprintf(_fTables, "#define ENTITYCLASS %s\n\n", _strCurrentClass); + fprintf(_fDeclaration, "extern \"C\" DECL_DLL CDLLEntityClass %s_DLLClass;\n", + _strCurrentClass); + fprintf(_fDeclaration, "%s %s : public %s {\npublic:\n", + $1.strString, _strCurrentClass, _strCurrentBase); + + } opt_features { + fprintf(_fDeclaration, " %s virtual void SetDefaultProperties(void);\n", _bClassIsExported?"":"DECL_DLL"); + fprintf(_fImplementation, "void %s::SetDefaultProperties(void) {\n", _strCurrentClass); + fprintf(_fTables, "CEntityProperty %s_properties[] = {\n", _strCurrentClass); + + } k_properties ':' property_declaration_list { + fprintf(_fImplementation, " %s::SetDefaultProperties();\n}\n", _strCurrentBase); + + fprintf(_fTables, "CEntityComponent %s_components[] = {\n", _strCurrentClass); + } opt_internal_properties { + } k_components ':' component_declaration_list { + _bTrackLineInformation = 1; + fprintf(_fTables, "CEventHandlerEntry %s_handlers[] = {\n", _strCurrentClass); + + _bInProcedure = 0; + _bInHandler = 0; + } k_functions ':' function_list { + + _bInProcedure = 1; + } k_procedures ':' procedure_list { + } '}' ';' { + fprintf(_fTables, "};\n#define %s_handlersct ARRAYCOUNT(%s_handlers)\n", + _strCurrentClass, _strCurrentClass); + fprintf(_fTables, "\n"); + + if (_bFeature_AbstractBaseClass) { + fprintf(_fTables, "CEntity *%s_New(void) { return NULL; };\n", + _strCurrentClass); + } else { + fprintf(_fTables, "CEntity *%s_New(void) { return new %s; };\n", + _strCurrentClass, _strCurrentClass); + } + + if (!_bFeature_ImplementsOnInitClass) { + fprintf(_fTables, "void %s_OnInitClass(void) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnInitClass(void);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnEndClass) { + fprintf(_fTables, "void %s_OnEndClass(void) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnEndClass(void);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnPrecache) { + fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnPrecache(CDLLEntityClass *pdec, INDEX iUser);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldEnd) { + fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldEnd(CWorld *pwo);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldInit) { + fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldInit(CWorld *pwo);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldTick) { + fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldTick(CWorld *pwo);\n", _strCurrentClass); + } + + if (!_bFeature_ImplementsOnWorldRender) { + fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo) {};\n", _strCurrentClass); + } else { + fprintf(_fTables, "void %s_OnWorldRender(CWorld *pwo);\n", _strCurrentClass); + } + + fprintf(_fTables, "ENTITY_CLASSDEFINITION(%s, %s, %s, %s, 0x%08x);\n", + _strCurrentClass, _strCurrentBase, + _strCurrentDescription, _strCurrentThumbnail, _iCurrentClassID); + fprintf(_fTables, "DECLARE_CTFILENAME(_fnm%s_tbn, %s);\n", _strCurrentClass, _strCurrentThumbnail); + + fprintf(_fDeclaration, "};\n"); + } + ; + +class_optexport + : k_class { $$ = $1; _bClassIsExported = 0; } + | k_class k_export { $$ = $1+" DECL_DLL "; _bClassIsExported = 1; } + ; + +opt_features + : /*null */ + | k_features { + _bFeature_ImplementsOnWorldInit = 0; + _bFeature_ImplementsOnWorldEnd = 0; + _bFeature_ImplementsOnWorldTick = 0; + _bFeature_ImplementsOnWorldRender = 0; + _bFeature_ImplementsOnInitClass = 0; + _bFeature_ImplementsOnEndClass = 0; + _bFeature_ImplementsOnPrecache = 0; + _bFeature_AbstractBaseClass = 0; + _bFeature_CanBePredictable = 0; + }features_list ';' + ; +features_list + : feature + | features_list ',' feature + ; +feature + : c_string { + if (strcmp($1.strString, "\"AbstractBaseClass\"")==0) { + _bFeature_AbstractBaseClass = 1; + } else if (strcmp($1.strString, "\"IsTargetable\"")==0) { + fprintf(_fDeclaration, "virtual BOOL IsTargetable(void) const { return TRUE; };\n"); + } else if (strcmp($1.strString, "\"IsImportant\"")==0) { + fprintf(_fDeclaration, "virtual BOOL IsImportant(void) const { return TRUE; };\n"); + } else if (strcmp($1.strString, "\"HasName\"")==0) { + fprintf(_fDeclaration, + "virtual const CTString &GetName(void) const { return m_strName; };\n"); + } else if (strcmp($1.strString, "\"CanBePredictable\"")==0) { + fprintf(_fDeclaration, + "virtual CEntity *GetPredictionPair(void) { return m_penPrediction; };\n"); + fprintf(_fDeclaration, + "virtual void SetPredictionPair(CEntity *penPair) { m_penPrediction = penPair; };\n"); + _bFeature_CanBePredictable = 1; + } else if (strcmp($1.strString, "\"HasDescription\"")==0) { + fprintf(_fDeclaration, + "virtual const CTString &GetDescription(void) const { return m_strDescription; };\n"); + } else if (strcmp($1.strString, "\"HasTarget\"")==0) { + fprintf(_fDeclaration, + "virtual CEntity *GetTarget(void) const { return m_penTarget; };\n"); + } else if (strcmp($1.strString, "\"ImplementsOnInitClass\"")==0) { + _bFeature_ImplementsOnInitClass = 1; + } else if (strcmp($1.strString, "\"ImplementsOnEndClass\"")==0) { + _bFeature_ImplementsOnEndClass = 1; + } else if (strcmp($1.strString, "\"ImplementsOnPrecache\"")==0) { + _bFeature_ImplementsOnPrecache = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldInit\"")==0) { + _bFeature_ImplementsOnWorldInit = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldEnd\"")==0) { + _bFeature_ImplementsOnWorldEnd = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldTick\"")==0) { + _bFeature_ImplementsOnWorldTick = 1; + } else if (strcmp($1.strString, "\"ImplementsOnWorldRender\"")==0) { + _bFeature_ImplementsOnWorldRender = 1; + } else { + yyerror((SType("Unknown feature: ")+$1).strString); + } + } + ; + +opt_internal_properties + : /* null */ + | '{' internal_property_list '}' + ; +internal_property_list + : /* null */ + | internal_property_list internal_property + ; +internal_property + : any_type identifier ';' { + fprintf(_fDeclaration, "%s %s;\n", $1.strString, $2.strString); + } + ; + +/*///////////////////////////////////////////////////////// + * Property declarations + */ + +property_declaration_list + : empty_property_declaration_list { + DeclareFeatureProperties(); // this won't work, but at least it will generate an error!!!! + fprintf(_fTables, " CEntityProperty()\n};\n"); + fprintf(_fTables, "#define %s_propertiesct 0\n", _strCurrentClass); + fprintf(_fTables, "\n"); + fprintf(_fTables, "\n"); + } + | nonempty_property_declaration_list opt_comma { + DeclareFeatureProperties(); + fprintf(_fTables, "};\n"); + fprintf(_fTables, "#define %s_propertiesct ARRAYCOUNT(%s_properties)\n", + _strCurrentClass, _strCurrentClass); + fprintf(_fTables, "\n"); + } + ; +nonempty_property_declaration_list + : property_declaration + | nonempty_property_declaration_list ',' property_declaration + ; +empty_property_declaration_list + : /* null */ + ; + +property_declaration + : property_id property_type property_identifier property_wed_name_opt property_default_opt property_flags_opt { + fprintf(_fTables, " CEntityProperty(%s, %s, (0x%08x<<8)+%s, _offsetof(%s, %s), %s, %s, %s, %s),\n", + _strCurrentPropertyPropertyType, + _strCurrentPropertyEnumType, + _iCurrentClassID, + _strCurrentPropertyID, + _strCurrentClass, + _strCurrentPropertyIdentifier, + _strCurrentPropertyName, + _strCurrentPropertyShortcut, + _strCurrentPropertyColor, + _strCurrentPropertyFlags); + fprintf(_fDeclaration, " %s %s;\n", + _strCurrentPropertyDataType, + _strCurrentPropertyIdentifier + ); + + if (strlen(_strCurrentPropertyDefaultCode)>0) { + fprintf(_fImplementation, " %s\n", _strCurrentPropertyDefaultCode); + } + } + ; + +property_id : c_int { _strCurrentPropertyID = $1.strString; }; +property_identifier : identifier { _strCurrentPropertyIdentifier = $1.strString; }; + +property_type + : k_enum identifier { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENUM"; + _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; + _strCurrentPropertyDataType = (SType("enum ")+$2.strString).strString; + } + | k_FLAGS identifier { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLAGS"; + _strCurrentPropertyEnumType = (SType("&")+$2+"_enum").strString; + _strCurrentPropertyDataType = "ULONG"; + } + | k_CTString { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRING"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTString"; + } + | k_CTStringTrans { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_STRINGTRANS"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTStringTrans"; + } + | k_CTFileName { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAME"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTFileName"; + } + | k_CTFileNameNoDep { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FILENAMENODEP"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CTFileNameNoDep"; + } + | k_BOOL { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_BOOL"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "BOOL"; + } + | k_COLOR { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_COLOR"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "COLOR"; + } + | k_FLOAT { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOAT"; + } + | k_INDEX { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_INDEX"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "INDEX"; + } + | k_RANGE { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_RANGE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "RANGE"; + } + | k_CEntityPointer { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ENTITYPTR"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CEntityPointer"; + } + | k_CModelObject { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELOBJECT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CModelObject"; + } + | k_CModelInstance { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_MODELINSTANCE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CModelInstance"; + } + | k_CAnimObject { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMOBJECT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CAnimObject"; + } + | k_CSoundObject { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_SOUNDOBJECT"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CSoundObject"; + } + | k_CPlacement3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_PLACEMENT3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "CPlacement3D"; + } + | k_FLOATaabbox3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATAABBOX3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATaabbox3D"; + } + | k_FLOATmatrix3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATMATRIX3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATmatrix3D"; + } + | k_FLOATquat3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATQUAT3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATquat3D"; + } + | k_ANGLE { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ANGLE"; + } + | k_ANGLE3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANGLE3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ANGLE3D"; + } + | k_FLOAT3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOAT3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOAT3D"; + } + | k_FLOATplane3D { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_FLOATplane3D"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "FLOATplane3D"; + } + | k_ILLUMINATIONTYPE { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ILLUMINATIONTYPE"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ILLUMINATIONTYPE"; + } + | k_ANIMATION { + _strCurrentPropertyPropertyType = "CEntityProperty::EPT_ANIMATION"; + _strCurrentPropertyEnumType = "NULL"; + _strCurrentPropertyDataType = "ANIMATION"; + } + ; + +property_wed_name_opt + : /* null */ { + _strCurrentPropertyName = "\"\""; + _strCurrentPropertyShortcut = "0"; + _strCurrentPropertyColor = "0"; // this won't be rendered anyway + } + | c_string property_shortcut_opt property_color_opt { + _strCurrentPropertyName = $1.strString; + } + ; +property_shortcut_opt + : /* null */ { + _strCurrentPropertyShortcut = "0"; + } + | c_char { + _strCurrentPropertyShortcut = $1.strString; + } + +property_color_opt + : /* null */ { + _strCurrentPropertyColor = "0x7F0000FFUL"; // dark red + } + | k_COLOR '(' expression ')' { + _strCurrentPropertyColor = $3.strString; + } +property_flags_opt + : /* null */ { + _strCurrentPropertyFlags = "0"; // dark red + } + | k_features '(' expression ')' { + _strCurrentPropertyFlags = $3.strString; + } + +property_default_opt + : /* null */ { + if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { + _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = NULL;").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CModelObject")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n"+ + _strCurrentPropertyIdentifier+".mo_toTexture.SetData(NULL);").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CModelInstance")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".Clear();\n").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CAnimObject")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".SetData(NULL);\n").strString; + } else if (strcmp(_strCurrentPropertyDataType,"CSoundObject")==0) { + _strCurrentPropertyDefaultCode = + (SType(_strCurrentPropertyIdentifier)+".SetOwner(this);\n"+ + _strCurrentPropertyIdentifier+".Stop_internal();").strString; + } else { + yyerror("this kind of property must have default value"); + _strCurrentPropertyDefaultCode = ""; + } + } + | '=' property_default_expression { + if (strcmp(_strCurrentPropertyDataType,"CEntityPointer")==0) { + yyerror("CEntityPointer type properties always default to NULL"); + } else { + _strCurrentPropertyDefaultCode = (SType(_strCurrentPropertyIdentifier)+" = "+$2.strString+";").strString; + } + } + ; +property_default_expression + : c_int|c_float|c_bool|c_char|c_string + | identifier {$$ = $1 + " ";} + | identifier '(' expression ')' {$$ = $1+$2+$3+$4;} + | type_keyword '(' expression ')' {$$ = $1+$2+$3+$4;} + | '-' property_default_expression {$$ = $1+$2;} + | '(' expression ')' {$$ = $1+$2+$3;} + ; + +/*///////////////////////////////////////////////////////// + * Component declarations + */ +component_declaration_list + : empty_component_declaration_list { + fprintf(_fTables, " CEntityComponent()\n};\n"); + fprintf(_fTables, "#define %s_componentsct 0\n", _strCurrentClass); + fprintf(_fTables, "\n"); + fprintf(_fTables, "\n"); + } + | nonempty_component_declaration_list opt_comma { + fprintf(_fTables, "};\n"); + fprintf(_fTables, "#define %s_componentsct ARRAYCOUNT(%s_components)\n", + _strCurrentClass, _strCurrentClass); + fprintf(_fTables, "\n"); + } + ; +nonempty_component_declaration_list + : component_declaration + | nonempty_component_declaration_list ',' component_declaration + ; +empty_component_declaration_list + : /* null */ + ; + +component_declaration + : component_id component_type component_identifier component_filename { + fprintf(_fTables, "#define %s ((0x%08x<<8)+%s)\n", + _strCurrentComponentIdentifier, + _iCurrentClassID, + _strCurrentComponentID); + fprintf(_fTables, " CEntityComponent(%s, %s, \"%s%s\" %s),\n", + _strCurrentComponentType, + _strCurrentComponentIdentifier, + "EF","NM", + _strCurrentComponentFileName); + } + ; + +component_id : c_int { _strCurrentComponentID = $1.strString; }; +component_identifier : identifier { _strCurrentComponentIdentifier = $1.strString; }; +component_filename : c_string { _strCurrentComponentFileName = $1.strString; }; + +component_type + : k_model { _strCurrentComponentType = "ECT_MODEL"; } + | k_texture { _strCurrentComponentType = "ECT_TEXTURE"; } + | k_sound { _strCurrentComponentType = "ECT_SOUND"; } + | k_class { _strCurrentComponentType = "ECT_CLASS"; } + ; + +/*///////////////////////////////////////////////////////// + * Functions + */ +function_list + : { $$ = "";} + | function_list function_implementation {$$ = $1+$2;} + ; + +function_implementation + : opt_export opt_virtual return_type opt_tilde identifier '(' parameters_list ')' opt_const + '{' statements '}' opt_semicolon { + const char *strReturnType = $3.strString; + const char *strFunctionHeader = ($4+$5+$6+$7+$8+$9).strString; + const char *strFunctionBody = ($10+$11+$12).strString; + if (strcmp($5.strString, _strCurrentClass)==0) { + if (strcmp(strReturnType+strlen(strReturnType)-4, "void")==0 ) { + strReturnType = ""; + } else { + yyerror("use 'void' as return type for constructors"); + } + } + fprintf(_fDeclaration, " %s %s %s %s;\n", + $1.strString, $2.strString, strReturnType, strFunctionHeader); + fprintf(_fImplementation, " %s %s::%s %s\n", + strReturnType, _strCurrentClass, strFunctionHeader, strFunctionBody); + } + ; +opt_tilde + : { $$ = "";} + | '~' { $$ = " ~ "; } + ; + +opt_export + : { $$ = "";} + | k_export { + if (_bClassIsExported) { + $$ = ""; + } else { + $$ = " DECL_DLL "; + } + } + ; + +opt_const + : { $$ = "";} + | k_const { $$ = $1; } + ; +opt_virtual + : { $$ = "";} + | k_virtual { $$ = $1; } + ; +opt_semicolon + : /* null */ + | ';' + ; +parameters_list + : { $$ = "";} + | k_void + | non_void_parameters_list + ; +non_void_parameters_list + : parameter_declaration + | non_void_parameters_list ',' parameter_declaration {$$ = $1+$2+$3;} + ; +parameter_declaration + : any_type identifier { $$=$1+" "+$2; } + ; + +return_type + : any_type + | k_void + ; + +any_type + : type_keyword + | identifier + | k_enum identifier { $$=$1+" "+$2; } + | any_type '*' { $$=$1+" "+$2; } + | any_type '&' { $$=$1+" "+$2; } + | k_void '*' { $$=$1+" "+$2; } + | k_const any_type { $$=$1+" "+$2; } + | k_inline any_type { $$=$1+" "+$2; } + | k_static any_type { $$=$1+" "+$2; } + | k_class any_type { $$=$1+" "+$2; } + | identifier '<' any_type '>' { $$=$1+" "+$2+" "+$3+" "+$4; } + ; + + +/*///////////////////////////////////////////////////////// + * Procedures + */ +procedure_list + : { $$ = "";} + | procedure_list procedure_implementation {$$ = $1+$2;} + ; + +opt_override + : { $$ = "-1"; } + | ':' identifier ':' ':' identifier { + $$ = SType("STATE_")+$2+"_"+$5; + } + ; + +procedure_implementation + : identifier '(' event_specification ')' opt_override { + char *strProcedureName = $1.strString; + char strInputEventType[80]; + char strInputEventName[80]; + sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); + + char strStateID[256]; + const char *strBaseStateID = "-1"; + if(strcmp(RemoveLineDirective(strProcedureName), "Main")==0){ + strcpy(strStateID, "1"); + if(strncmp(strInputEventType, "EVoid", 4)!=0 && _strCurrentThumbnail[2]!=0) { + yyerror("procedure 'Main' can take input parameters only in classes without thumbnails"); + } + } else { + sprintf(strStateID, "0x%08x", CreateID()); + } + + sprintf(_strCurrentStateID, "STATE_%s_%s", + _strCurrentClass, RemoveLineDirective(strProcedureName)); + fprintf(_fDeclaration, "#define %s %s\n", _strCurrentStateID, strStateID); + AddHandlerFunction(strProcedureName, strStateID, $5.strString); + fprintf(_fImplementation, + "BOOL %s::%s(const CEntityEvent &__eeInput) {\n#undef STATE_CURRENT\n#define STATE_CURRENT %s\n", + _strCurrentClass, strProcedureName, _strCurrentStateID); + fprintf(_fImplementation, + " ASSERTMSG(__eeInput.ee_slEvent==EVENTCODE_%s, \"%s::%s expects '%s' as input!\");", + strInputEventType, _strCurrentClass, RemoveLineDirective(strProcedureName), + strInputEventType); + fprintf(_fImplementation, " const %s &%s = (const %s &)__eeInput;", + strInputEventType, strInputEventName, strInputEventType); + + } '{' statements '}' opt_semicolon { + char *strFunctionBody = $8.strString; + fprintf(_fImplementation, "%s ASSERT(FALSE); return TRUE;};", strFunctionBody); + } + ; + +event_specification + : { + $$="EVoid e"; + } + | identifier { + $$=$1+" e"; + } + | identifier identifier { + $$=$1+" "+$2; + } + ; + +expression + : c_int|c_float|c_bool|c_char|c_string + | identifier {$$ = $1 + " ";} + | type_keyword + | '='|'+'|'-'|'<'|'>'|'!'|'|'|'&'|'*'|'/'|'%'|'^'|'['|']'|':'|','|'.'|'?'|'~' + | '(' ')' {$$=$1+$2;} + | '+' '+' {$$=$1+$2;} + | '-' '-' {$$=$1+$2;} + | '-' '>' {$$=$1+$2;} + | ':' ':' {$$=$1+$2;} + | '&' '&' {$$=$1+$2;} + | '|' '|' {$$=$1+$2;} + | '^' '^' {$$=$1+$2;} + | '>' '>' {$$=$1+$2;} + | '<' '<' {$$=$1+$2;} + | '=' '=' {$$=$1+$2;} + | '!' '=' {$$=$1+$2;} + | '>' '=' {$$=$1+$2;} + | '<' '=' {$$=$1+$2;} + | '&' '=' {$$=$1+$2;} + | '|' '=' {$$=$1+$2;} + | '^' '=' {$$=$1+$2;} + | '+' '=' {$$=$1+$2;} + | '-' '=' {$$=$1+$2;} + | '/' '=' {$$=$1+$2;} + | '%' '=' {$$=$1+$2;} + | '*' '=' {$$=$1+$2;} + | '>' '>' '=' {$$=$1+$2+$3;} + | '<' '<' '=' {$$=$1+$2+$3;} + | '(' expression ')' {$$ = $1+$2+$3;} + | expression expression {$$ = $1+" "+$2;} + ; +type_keyword + : k_CTString|k_CTStringTrans|k_CTFileName|k_CTFileNameNoDep + | k_BOOL|k_COLOR|k_FLOAT|k_INDEX|k_RANGE + | k_CEntityPointer|k_CModelObject|k_CModelInstance|k_CAnimObject|k_CSoundObject + | k_CPlacement3D | k_FLOATaabbox3D|k_FLOATmatrix3D| k_FLOATquat3D|k_ANGLE|k_ANIMATION|k_ILLUMINATIONTYPE + | k_ANGLE3D|k_FLOAT3D|k_FLOATplane3D + | k_const + | k_static + ; +case_constant_expression + : c_int|c_float|c_bool|c_char|c_string + | identifier {$$ = $1 + " ";} + ; + + +/* Simple statements: + */ +statements + : { $$ = "";} + | statements statement { $$ = $1+$2; } + ; +statement + : expression ';' {$$=$1+$2;} + | k_switch '(' expression ')' '{' statements '}' {$$=$1+$2+$3+$4+$5+$6+$7;} + | k_case case_constant_expression ':' {$$=$1+" "+$2+$3+" ";} + | '{' statements '}' {$$=$1+$2+$3;} + | expression '{' statements '}' {$$=$1+$2+$3+$4;} + | statement_while + | statement_dowhile + | statement_for + | statement_if + | statement_if_else + | statement_wait + | statement_autowait + | statement_waitevent + | statement_call + | statement_autocall + | statement_stop + | statement_resume + | statement_pass + | statement_return + | statement_jump + | ';' + ; + + +statement_if + : k_if '(' expression ')' '{' statements '}' { + if ($6.bCrossesStates) { + char strAfterIfName[80], strAfterIfID[11]; + CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); + $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+$6+ + "Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; + } else { + $$ = $1+$2+$3+$4+$5+$6+$7; + } + } + ; + +statement_if_else + : k_if '(' expression ')' '{' statements '}' k_else statement { + if ($6.bCrossesStates || $9.bCrossesStates) { + char strAfterIfName[80], strAfterIfID[11]; + char strElseName[80], strElseID[11]; + CreateInternalHandlerFunction(strAfterIfName, strAfterIfID); + CreateInternalHandlerFunction(strElseName, strElseID); + $$ = $1+"(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+strElseID+", FALSE, EInternal());return TRUE;}"+ + $6+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+strElseName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strElseID+"\n"+ + $9+"Jump(STATE_CURRENT,"+strAfterIfID+", FALSE, EInternal());return TRUE;}\n"+ + "BOOL "+_strCurrentClass+"::"+strAfterIfName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+strAfterIfID+"\n"; + } else { + $$ = $1+$2+$3+$4+$5+$6+$7+$8+" "+$9; + } + } + ; + +statement_while + : k_while '(' expression ')' { + if (strlen(_strInLoopName)>0) { + yyerror("Nested loops are not implemented yet"); + } + } '{' statements '}' { + if ($7.bCrossesStates) { + CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); + CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); + $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$6+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+ + "if(!"+$2+$3+$4+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ + $7+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$8+ + "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; + } else { + $$ = $1+$2+$3+$4+$6+$7+$8; + } + _strInLoopName[0] = 0; + } + ; + +statement_dowhile + : k_do '{' statements '}' { + if (strlen(_strInLoopName)>0) { + yyerror("Nested loops are not implemented yet"); + } + _strInLoopName[0] = 0; + } k_while '(' expression ')' ';' { + if ($3.bCrossesStates) { + CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); + CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); + $$ = SType(GetLineDirective($1))+"Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInLoopName+"(const CEntityEvent &__eeInput)"+$2+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInLoopID+"\n"+$3+ + "if(!"+$7+$8+$9+"){ Jump(STATE_CURRENT,"+_strAfterLoopID+", FALSE, EInternal());return TRUE;}"+ + "Jump(STATE_CURRENT,"+_strInLoopID+", FALSE, EInternal());return TRUE;"+$4+ + "BOOL "+_strCurrentClass+"::"+_strAfterLoopName+"(const CEntityEvent &__eeInput) {"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterLoopID+"\n"; + } else { + $$ = $1+$2+$3+$4+$6+$7+$8+$9+$10; + } + _strInLoopName[0] = 0; + } + ; + +statement_for + : k_for '(' expression ';' expression ';' expression ')' { + if (strlen(_strInLoopName)>0) { + yyerror("Nested loops are not implemented yet"); + } + } '{' statements '}' { + if ($11.bCrossesStates) { + CreateInternalHandlerFunction(_strInLoopName, _strInLoopID); + CreateInternalHandlerFunction(_strAfterLoopName, _strAfterLoopID); + yyerror("For loops across states are not supported"); + } else { + $$ = $1+$2+$3+$4+$5+$6+$7+$8+$10+$11+$12; + } + _strInLoopName[0] = 0; + } + ; + +statement_wait + : k_wait wait_expression { + if (!_bInProcedure) { + yyerror("Cannot have 'wait' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + _bInHandler = 1; + } '{' handlers_list '}' { + if ($5.bCrossesStates) { + yyerror("'wait' statements must not be nested"); + $$ = ""; + } else { + SType stDefault; + if (!_bHasOtherwise) { + stDefault = SType("default: return FALSE; break;"); + } else { + stDefault = SType(""); + } + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent)"+$4+$5+stDefault+$6+ + "return TRUE;}BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"; + $$.bCrossesStates = 1; + _bInHandler = 0; + } + } + ; +statement_autowait + : k_autowait wait_expression ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'autowait' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent) {"+ + "case EVENTCODE_EBegin: return TRUE;"+ + "case EVENTCODE_ETimer: Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, EInternal()); return TRUE;"+ + "default: return FALSE; }}"+ + "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\nASSERT(__eeInput.ee_slEvent==EVENTCODE_EInternal);"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+$3; + $$.bCrossesStates = 1; + } + ; + +statement_waitevent + : k_waitevent wait_expression identifier opt_eventvar ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'autocall' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent) {"+ + "case EVENTCODE_EBegin: return TRUE;"+ + "case EVENTCODE_"+$3+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ + "default: return FALSE; }}"+ + "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ + "const "+$3+"&"+$4+"= ("+$3+"&)__eeInput;\n"+$5; + $$.bCrossesStates = 1; + } + ; + + +opt_eventvar + : { + $$ = SType("__e"); + } + | identifier { + $$ = $1; + } + +statement_autocall + : k_autocall jumptarget '(' event_expression ')' identifier opt_eventvar ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'autocall' in functions"); + } + CreateInternalHandlerFunction(_strInWaitName, _strInWaitID); + CreateInternalHandlerFunction(_strAfterWaitName, _strAfterWaitID); + _bHasOtherwise = 0; + + $$ = SType(GetLineDirective($1))+$2+";\n"+ + "Jump(STATE_CURRENT, "+_strInWaitID+", FALSE, EBegin());return TRUE;}"+ + "BOOL "+_strCurrentClass+"::"+_strInWaitName+"(const CEntityEvent &__eeInput) {"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strInWaitID+"\n"+ + "switch(__eeInput.ee_slEvent) {"+ + "case EVENTCODE_EBegin: Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"+ + "case EVENTCODE_"+$6+": Jump(STATE_CURRENT,"+_strAfterWaitID+", FALSE, __eeInput); return TRUE;"+ + "default: return FALSE; }}"+ + "BOOL "+_strCurrentClass+"::"+_strAfterWaitName+"(const CEntityEvent &__eeInput){"+ + "\n#undef STATE_CURRENT\n#define STATE_CURRENT "+_strAfterWaitID+"\n"+ + "const "+$6+"&"+$7+"= ("+$6+"&)__eeInput;\n"+$8; + $$.bCrossesStates = 1; + } + ; + +wait_expression + : '(' ')' { + $$ = SType("SetTimerAt(THINKTIME_NEVER)"); + } + | '(' expression ')' { + $$ = SType("SetTimerAfter")+$1+$2+$3; + } + ; + +statement_jump + : k_jump jumptarget '(' event_expression ')' ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'jump' in functions"); + } + $$ = SType(GetLineDirective($1))+"Jump"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; + } + ; + +statement_call + : k_call jumptarget '(' event_expression')' ';' { + if (!_bInProcedure) { + yyerror("Cannot have 'call' in functions"); + } + if (!_bInHandler) { + yyerror("'call' must be inside a 'wait' statement"); + } + $$ = SType(GetLineDirective($1))+"Call"+$3+"STATE_CURRENT, "+$2+", "+$4+$5+";return TRUE;"; + } + ; + +event_expression + : expression { + $$ = $1; + } + | { + $$ = SType("EVoid()"); + } + ; + +jumptarget + : identifier { + $$ = SType("STATE_")+_strCurrentClass+"_"+$1+", TRUE"; + } + | identifier ':' ':' identifier { + $$ = SType("STATE_")+$1+"_"+$4+", FALSE"; + } + ; + +statement_stop + : k_stop ';' { + $$ = SType(GetLineDirective($1))+"UnsetTimer();Jump(STATE_CURRENT," + +_strAfterWaitID+", FALSE, EInternal());"+"return TRUE"+$2; + } + ; +statement_resume + : k_resume ';' { + $$ = SType(GetLineDirective($1))+"return TRUE"+$2; + } + ; +statement_pass + : k_pass ';' { + $$ = SType(GetLineDirective($1))+"return FALSE"+$2; + } + ; +statement_return + : k_return opt_expression ';' { + if (!_bInProcedure) { + $$ = $1+" "+$2+$3; + } else { + if (strlen($2.strString)==0) { + $2 = SType("EVoid()"); + } + $$ = SType(GetLineDirective($1)) + +"Return(STATE_CURRENT,"+$2+");" + +$1+" TRUE"+$3; + } + } + ; +opt_expression + : {$$ = "";} + | expression + ; + +handler + : k_on '(' event_specification ')' ':' '{' statements '}' opt_semicolon { + char strInputEventType[80]; + char strInputEventName[80]; + sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); + + $$ = SType("case")+$2+"EVENTCODE_"+strInputEventType+$4+$5+$6+ + "const "+strInputEventType+"&"+strInputEventName+"= ("+ + strInputEventType+"&)__eeInput;\n"+$7+$8+"ASSERT(FALSE);break;"; + } + | k_otherwise '(' event_specification ')' ':' '{' statements '}' opt_semicolon { + char strInputEventType[80]; + char strInputEventName[80]; + sscanf($3.strString, "%s %s", strInputEventType, strInputEventName); + + $$ = SType("default")+$5+$6+$7+$8+"ASSERT(FALSE);break;"; + _bHasOtherwise = 1; + } + ; +handlers_list + : { $$ = "";} + | handlers_list handler { $$ = $1+$2; } + ; + +%% diff --git a/SamTSE/Sources/Ecc/Scanner.l b/SamTSE/Sources/Ecc/Scanner.l index 554b7e6b..6bd38345 100644 --- a/SamTSE/Sources/Ecc/Scanner.l +++ b/SamTSE/Sources/Ecc/Scanner.l @@ -1,172 +1,187 @@ -%{ -// rcg10042001 Changed to specify Ecc directory... -#include "Ecc/StdH.h" -#include "Ecc/Main.h" -#include "Ecc/Parser.h" - -#define YY_NEVER_INTERACTIVE 1 - - -int iLastLine = -1; - -#define RETURN(symbolname) \ - if (iLastLine==_iLinesCt || !_bTrackLineInformation){\ - yylval = yytext; \ - } else { \ - char strLine[512]; \ - sprintf(strLine, "\n#line %d \"%s\"\n", _iLinesCt, _strInputFileName);\ - yylval = SType(strLine)+yytext; \ - iLastLine=_iLinesCt; \ - } \ - return symbolname; - -char *_strCppBlock; - -%} - -%x COMMENT -%x CPPBLOCK - -DIGIT [0-9] -HEXDIGIT [0-9A-Fa-f] -IDENTIFIERFIRST [A-Za-z_] -IDENTIFIEROTHER [A-Za-z0-9_] -DOUBLEQUOTE \" -NONEXP_FLT ({DIGIT}+"."{DIGIT}*) -EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) - -%% - - /* standard cpp-keywords */ -"while" {RETURN(k_while);} -"switch" {RETURN(k_switch);} -"case" {RETURN(k_case);} -"for" {RETURN(k_for);} -"if" {RETURN(k_if);} -"else" {RETURN(k_else);} -"enum" {RETURN(k_enum);} -"class" {RETURN(k_class);} -"do" {RETURN(k_do);} -"void" {RETURN(k_void);} -"const" {RETURN(k_const);} -"inline" {RETURN(k_inline);} -"static" {RETURN(k_static);} -"virtual" {RETURN(k_virtual);} -"return" {RETURN(k_return);} -"autowait" {RETURN(k_autowait);} -"autocall" {RETURN(k_autocall);} -"waitevent" {RETURN(k_waitevent);} - - /* aditional keywords */ -"event" {RETURN(k_event);} -"name" {RETURN(k_name);} -"thumbnail" {RETURN(k_thumbnail);} -"features" {RETURN(k_features);} -"uses" {RETURN(k_uses);} -"export" {RETURN(k_export);} - -"texture" {RETURN(k_texture);} -"sound" {RETURN(k_sound);} -"model" {RETURN(k_model);} - -"properties" {RETURN(k_properties);} -"components" {RETURN(k_components);} -"functions" {RETURN(k_functions);} -"procedures" {RETURN(k_procedures);} - -"wait" {RETURN(k_wait );} -"on" {RETURN(k_on );} -"otherwise" {RETURN(k_otherwise);} - -"call" {RETURN(k_call );} -"jump" {RETURN(k_jump );} -"stop" {RETURN(k_stop );} -"resume" {RETURN(k_resume );} -"pass" {RETURN(k_pass );} - - /* special data types */ -"CTString" {RETURN(k_CTString);} -"CTStringTrans" {RETURN(k_CTStringTrans);} -"CTFileName" {RETURN(k_CTFileName);} -"CTFileNameNoDep" {RETURN(k_CTFileNameNoDep);} -"BOOL" {RETURN(k_BOOL);} -"COLOR" {RETURN(k_COLOR);} -"FLOAT" {RETURN(k_FLOAT);} -"INDEX" {RETURN(k_INDEX);} -"RANGE" {RETURN(k_RANGE);} -"CEntityPointer" {RETURN(k_CEntityPointer);} -"CModelObject" {RETURN(k_CModelObject);} -"CModelInstance" {RETURN(k_CModelInstance);} -"CAnimObject" {RETURN(k_CAnimObject);} -"CSoundObject" {RETURN(k_CSoundObject);} -"CPlacement3D" {RETURN(k_CPlacement3D);} -"FLOATaabbox3D" {RETURN(k_FLOATaabbox3D);} -"FLOATmatrix3D" {RETURN(k_FLOATmatrix3D);} -"FLOATquat3D" {RETURN(k_FLOATquat3D);} -"ANGLE" {RETURN(k_ANGLE);}; -"ANIMATION" {RETURN(k_ANIMATION);}; -"ILLUMINATIONTYPE" {RETURN(k_ILLUMINATIONTYPE);}; -"FLOAT3D" {RETURN(k_FLOAT3D);}; -"ANGLE3D" {RETURN(k_ANGLE3D);}; -"FLOATplane3D" {RETURN(k_FLOATplane3D);}; -"flags" {RETURN(k_FLAGS);}; - - /* single character operators and punctuations */ -";"|"("|")"|"{"|"}"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { - RETURN(yytext[0]);} - - /* constants */ -{DIGIT}+ { RETURN(c_int); } -"0x"{HEXDIGIT}+ { RETURN(c_int)}; -{NONEXP_FLT}("f"|"F")? { RETURN(c_int); } -{EXP_FLT}("f"|"F")? { RETURN(c_int); } -(\"[^\n"]+\")|(\"\") { RETURN(c_string); } -(\'[^\n']+\')|(\'\') { RETURN(c_char); } - - /* identifier */ -{IDENTIFIERFIRST}{IDENTIFIEROTHER}* {RETURN(identifier);} - - /* specially bracketed cpp blocks */ -"%{" { - char strLine[512]; - sprintf(strLine, "#line %d \"%s\"\n", _iLinesCt, _strInputFileName ); - _strCppBlock = strdup(strLine); - BEGIN(CPPBLOCK); -} -"%}" { - BEGIN(INITIAL); - yylval = SType(_strCppBlock); - return cppblock; -} -\n { - _iLinesCt++; - _strCppBlock = (SType(_strCppBlock)+yytext).strString; - } -.* { - _strCppBlock = (SType(_strCppBlock)+yytext).strString; -} - - /* eat up comments */ -"/*" { BEGIN(COMMENT); } -"*/" { BEGIN(INITIAL); } -. {} -"//"[^\n]*\n { _iLinesCt++; } - - /* eat up whitespace */ -[ \t]+ { -} - /* eat up linefeeds and count lines in all conditions */ -<*>\n { - _iLinesCt++; - } - /* for all unrecognized characters */ -. { - // report an error - char strError[80]; - sprintf(strError, "Unrecognized character '%c' (ASCII 0x%02x)\n", - yytext[0], yytext[0] ); - yyerror(strError); -} - -%% - +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// rcg10042001 Changed to specify Ecc directory... +#include "Ecc/StdH.h" +#include "Ecc/Main.h" +#include "Ecc/Parser.h" + +#define YY_NEVER_INTERACTIVE 1 + + +int iLastLine = -1; + +#define RETURN(symbolname) \ + if (iLastLine==_iLinesCt || !_bTrackLineInformation){\ + yylval = yytext; \ + } else { \ + char strLine[512]; \ + sprintf(strLine, "\n#line %d \"%s\"\n", _iLinesCt, _strInputFileName);\ + yylval = SType(strLine)+yytext; \ + iLastLine=_iLinesCt; \ + } \ + return symbolname; + +char *_strCppBlock; + +%} + +%x COMMENT +%x CPPBLOCK + +DIGIT [0-9] +HEXDIGIT [0-9A-Fa-f] +IDENTIFIERFIRST [A-Za-z_] +IDENTIFIEROTHER [A-Za-z0-9_] +DOUBLEQUOTE \" +NONEXP_FLT ({DIGIT}+"."{DIGIT}*) +EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) + +%% + + /* standard cpp-keywords */ +"while" {RETURN(k_while);} +"switch" {RETURN(k_switch);} +"case" {RETURN(k_case);} +"for" {RETURN(k_for);} +"if" {RETURN(k_if);} +"else" {RETURN(k_else);} +"enum" {RETURN(k_enum);} +"class" {RETURN(k_class);} +"do" {RETURN(k_do);} +"void" {RETURN(k_void);} +"const" {RETURN(k_const);} +"inline" {RETURN(k_inline);} +"static" {RETURN(k_static);} +"virtual" {RETURN(k_virtual);} +"return" {RETURN(k_return);} +"autowait" {RETURN(k_autowait);} +"autocall" {RETURN(k_autocall);} +"waitevent" {RETURN(k_waitevent);} + + /* aditional keywords */ +"event" {RETURN(k_event);} +"name" {RETURN(k_name);} +"thumbnail" {RETURN(k_thumbnail);} +"features" {RETURN(k_features);} +"uses" {RETURN(k_uses);} +"export" {RETURN(k_export);} + +"texture" {RETURN(k_texture);} +"sound" {RETURN(k_sound);} +"model" {RETURN(k_model);} + +"properties" {RETURN(k_properties);} +"components" {RETURN(k_components);} +"functions" {RETURN(k_functions);} +"procedures" {RETURN(k_procedures);} + +"wait" {RETURN(k_wait );} +"on" {RETURN(k_on );} +"otherwise" {RETURN(k_otherwise);} + +"call" {RETURN(k_call );} +"jump" {RETURN(k_jump );} +"stop" {RETURN(k_stop );} +"resume" {RETURN(k_resume );} +"pass" {RETURN(k_pass );} + + /* special data types */ +"CTString" {RETURN(k_CTString);} +"CTStringTrans" {RETURN(k_CTStringTrans);} +"CTFileName" {RETURN(k_CTFileName);} +"CTFileNameNoDep" {RETURN(k_CTFileNameNoDep);} +"BOOL" {RETURN(k_BOOL);} +"COLOR" {RETURN(k_COLOR);} +"FLOAT" {RETURN(k_FLOAT);} +"INDEX" {RETURN(k_INDEX);} +"RANGE" {RETURN(k_RANGE);} +"CEntityPointer" {RETURN(k_CEntityPointer);} +"CModelObject" {RETURN(k_CModelObject);} +"CModelInstance" {RETURN(k_CModelInstance);} +"CAnimObject" {RETURN(k_CAnimObject);} +"CSoundObject" {RETURN(k_CSoundObject);} +"CPlacement3D" {RETURN(k_CPlacement3D);} +"FLOATaabbox3D" {RETURN(k_FLOATaabbox3D);} +"FLOATmatrix3D" {RETURN(k_FLOATmatrix3D);} +"FLOATquat3D" {RETURN(k_FLOATquat3D);} +"ANGLE" {RETURN(k_ANGLE);}; +"ANIMATION" {RETURN(k_ANIMATION);}; +"ILLUMINATIONTYPE" {RETURN(k_ILLUMINATIONTYPE);}; +"FLOAT3D" {RETURN(k_FLOAT3D);}; +"ANGLE3D" {RETURN(k_ANGLE3D);}; +"FLOATplane3D" {RETURN(k_FLOATplane3D);}; +"flags" {RETURN(k_FLAGS);}; + + /* single character operators and punctuations */ +";"|"("|")"|"{"|"}"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { + RETURN(yytext[0]);} + + /* constants */ +{DIGIT}+ { RETURN(c_int); } +"0x"{HEXDIGIT}+ { RETURN(c_int)}; +{NONEXP_FLT}("f"|"F")? { RETURN(c_int); } +{EXP_FLT}("f"|"F")? { RETURN(c_int); } +(\"[^\n"]+\")|(\"\") { RETURN(c_string); } +(\'[^\n']+\')|(\'\') { RETURN(c_char); } + + /* identifier */ +{IDENTIFIERFIRST}{IDENTIFIEROTHER}* {RETURN(identifier);} + + /* specially bracketed cpp blocks */ +"%{" { + char strLine[512]; + sprintf(strLine, "#line %d \"%s\"\n", _iLinesCt, _strInputFileName ); + _strCppBlock = strdup(strLine); + BEGIN(CPPBLOCK); +} +"%}" { + BEGIN(INITIAL); + yylval = SType(_strCppBlock); + return cppblock; +} +\n { + _iLinesCt++; + _strCppBlock = (SType(_strCppBlock)+yytext).strString; + } +.* { + _strCppBlock = (SType(_strCppBlock)+yytext).strString; +} + + /* eat up comments */ +"/*" { BEGIN(COMMENT); } +"*/" { BEGIN(INITIAL); } +. {} +"//"[^\n]*\n { _iLinesCt++; } + + /* eat up whitespace */ +[ \t]+ { +} + /* eat up linefeeds and count lines in all conditions */ +<*>\n { + _iLinesCt++; + } + /* for all unrecognized characters */ +. { + // report an error + char strError[80]; + sprintf(strError, "Unrecognized character '%c' (ASCII 0x%02x)\n", + yytext[0], yytext[0] ); + yyerror(strError); +} + +%% + diff --git a/SamTSE/Sources/Engine/Base/CTString.inl b/SamTSE/Sources/Engine/Base/CTString.inl index 1a1ee4ef..6e8059cb 100644 --- a/SamTSE/Sources/Engine/Base/CTString.inl +++ b/SamTSE/Sources/Engine/Base/CTString.inl @@ -1,119 +1,134 @@ -#ifndef SE_INCL_CTSTRING_INL -#define SE_INCL_CTSTRING_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -#include -#include - -/* - * Default constructor. - */ -ENGINE_API CTString::CTString(void) -{ - str_String = StringDuplicate(""); -} - -/* - * Copy constructor. - */ -ENGINE_API CTString::CTString(const CTString &strOriginal) -{ - ASSERT(strOriginal.IsValid()); - - // make string duplicate - str_String = StringDuplicate(strOriginal.str_String); -} - -/* - * Constructor from character string. - */ -ENGINE_API CTString::CTString( const char *strCharString) -{ - ASSERT(strCharString!=NULL); - - // make string duplicate - str_String = StringDuplicate( strCharString); -} - -/* Constructor with formatting. */ -ENGINE_API CTString::CTString(INDEX iDummy, const char *strFormat, ...) -{ - str_String = StringDuplicate(""); - va_list arg; - va_start(arg, strFormat); - VPrintF(strFormat, arg); - va_end(arg); -} - -/* - * Destructor. - */ -ENGINE_API CTString::~CTString() -{ - // check that it is valid - ASSERT(IsValid()); - // free memory - FreeMemory(str_String); -} - -/* - * Clear the object. - */ -ENGINE_API void CTString::Clear(void) -{ - operator=(""); -} - -/* - * Conversion into character string. - */ -ENGINE_API CTString::operator const char*() const -{ - ASSERT(IsValid()); - - return str_String; -} - -/* - * Assignment. - */ -ENGINE_API CTString &CTString::operator=(const char *strCharString) -{ - ASSERT(IsValid()); - ASSERT(strCharString!=NULL); - - /* The other string must be copied _before_ this memory is freed, since it could be same - pointer! - */ - // make a copy of character string - char *strCopy = StringDuplicate(strCharString); - // empty this string - FreeMemory(str_String); - // assign it the copy of the character string - str_String = strCopy; - - return *this; -} -ENGINE_API CTString &CTString::operator=(const CTString &strOther) -{ - ASSERT(IsValid()); - ASSERT(strOther.IsValid()); - - /* The other string must be copied _before_ this memory is freed, since it could be same - pointer! - */ - // make a copy of character string - char *strCopy = StringDuplicate(strOther.str_String); - // empty this string - FreeMemory(str_String); - // assign it the copy of the character string - str_String = strCopy; - - return *this; -} - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_CTSTRING_INL +#define SE_INCL_CTSTRING_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +#include +#include + +/* + * Default constructor. + */ +ENGINE_API CTString::CTString(void) +{ + str_String = StringDuplicate(""); +} + +/* + * Copy constructor. + */ +ENGINE_API CTString::CTString(const CTString &strOriginal) +{ + ASSERT(strOriginal.IsValid()); + + // make string duplicate + str_String = StringDuplicate(strOriginal.str_String); +} + +/* + * Constructor from character string. + */ +ENGINE_API CTString::CTString( const char *strCharString) +{ + ASSERT(strCharString!=NULL); + + // make string duplicate + str_String = StringDuplicate( strCharString); +} + +/* Constructor with formatting. */ +ENGINE_API CTString::CTString(INDEX iDummy, const char *strFormat, ...) +{ + str_String = StringDuplicate(""); + va_list arg; + va_start(arg, strFormat); + VPrintF(strFormat, arg); + va_end(arg); +} + +/* + * Destructor. + */ +ENGINE_API CTString::~CTString() +{ + // check that it is valid + ASSERT(IsValid()); + // free memory + FreeMemory(str_String); +} + +/* + * Clear the object. + */ +ENGINE_API void CTString::Clear(void) +{ + operator=(""); +} + +/* + * Conversion into character string. + */ +ENGINE_API CTString::operator const char*() const +{ + ASSERT(IsValid()); + + return str_String; +} + +/* + * Assignment. + */ +ENGINE_API CTString &CTString::operator=(const char *strCharString) +{ + ASSERT(IsValid()); + ASSERT(strCharString!=NULL); + + /* The other string must be copied _before_ this memory is freed, since it could be same + pointer! + */ + // make a copy of character string + char *strCopy = StringDuplicate(strCharString); + // empty this string + FreeMemory(str_String); + // assign it the copy of the character string + str_String = strCopy; + + return *this; +} +ENGINE_API CTString &CTString::operator=(const CTString &strOther) +{ + ASSERT(IsValid()); + ASSERT(strOther.IsValid()); + + /* The other string must be copied _before_ this memory is freed, since it could be same + pointer! + */ + // make a copy of character string + char *strCopy = StringDuplicate(strOther.str_String); + // empty this string + FreeMemory(str_String); + // assign it the copy of the character string + str_String = strCopy; + + return *this; +} + + +#endif /* include-once check. */ + diff --git a/SamTSE/Sources/Engine/Base/FLEX.skl b/SamTSE/Sources/Engine/Base/FLEX.skl index 6571aff9..e60be9c3 100644 --- a/SamTSE/Sources/Engine/Base/FLEX.skl +++ b/SamTSE/Sources/Engine/Base/FLEX.skl @@ -1,1496 +1,1511 @@ -#include "Engine/StdH.h" - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -//#ifdef c_plusplus -//#ifndef __cplusplus -//#define __cplusplus -//#endif -//#endif - -#if 1 //def __cplusplus - - #include -%+ - class istream; -%* - - /* Use prototypes in function declarations. */ - #define YY_USE_PROTOS - - /* The "const" storage-class-modifier is valid. */ - #define YY_USE_CONST - -#else /* ! __cplusplus */ - - #if __STDC__ - - #define YY_USE_PROTOS - #define YY_USE_CONST - - #endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -extern FILE *yyin, *yyout; -%* - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - FILE *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -static YY_BUFFER_STATE yy_current_buffer = 0; -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -//static - void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -%* -#endif - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( const char msg[] )); -%* - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifdef YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) -%- - yyin = stdin; -%+ - yyin = &cin; -%* - - if ( ! yyout ) -%- - yyout = stdout; -%+ - yyout = &cout; -%* - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( yy_current_buffer ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; - } - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif - { - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) yyout->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer() -%+ -int yyFlexLexer::yy_get_next_buffer() -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state() -%+ -yy_state_type yyFlexLexer::yy_get_previous_state() -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifdef YY_USE_PROTOS -//static - void yyunput( int c, register char *yy_bp ) -#else -//static - void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } - - -%- -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif -%+ -int yyFlexLexer::yyinput() -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%* - { - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) -%* - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#ifdef YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#ifdef YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif -%+ - b->yy_is_interactive = 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%* - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( const char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -const char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -const char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state() -%+ -void yyFlexLexer::yy_pop_state() -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state() -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( const char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( const char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, const char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -const char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - return (void *) realloc( ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#ifdef YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include "Engine/StdH.h" + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +%- +#include +%* + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +//#ifdef c_plusplus +//#ifndef __cplusplus +//#define __cplusplus +//#endif +//#endif + +#if 1 //def __cplusplus + + #include +%+ + class istream; +%* + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +#else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +%- +extern FILE *yyin, *yyout; +%* + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { +%- + FILE *yy_input_file; +%+ + istream* yy_input_file; +%* + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +%- Standard (non-C++) definition +static YY_BUFFER_STATE yy_current_buffer = 0; +%* + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +%- Standard (non-C++) definition +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); +%* + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +//static + void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); +#endif + +#ifndef YY_NO_INPUT +%- Standard (non-C++) definition +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +%* +#endif + +%- Standard (non-C++) definition +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( const char msg[] )); +%* + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ +%% code to fiddle yytext and yyleng for yymore() goes here + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ +%% code to copy yytext_ptr to yytext[] goes here, if %array + yy_c_buf_p = yy_cp; + +%% data tables for the DFA and the user's section 1 definitions go here + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifdef YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +%- Standard (non-C++) definition +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +%+ C++ definition +#define ECHO LexerOutput( yytext, yyleng ) +%* +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ +%+ C++ definition + if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +%* +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +%- +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +%+ +#define YY_FATAL_ERROR(msg) LexerError( msg ) +%* +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +%- Standard (non-C++) definition +#define YY_DECL int yylex YY_PROTO(( void )) +%+ C++ definition +#define YY_DECL int yyFlexLexer::yylex() +%* +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +%% YY_RULE_SETUP definition goes here + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +%% user's declarations go here + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) +%- + yyin = stdin; +%+ + yyin = &cin; +%* + + if ( ! yyout ) +%- + yyout = stdout; +%+ + yyout = &cout; +%* + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +%% yymore()-related code goes here + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +%% code to set up and find next match goes here + +yy_find_action: +%% code to find the action number goes here + + YY_DO_BEFORE_ACTION; + +%% code for yylineno update goes here + +do_action: /* This label is used only to access EOF actions. */ + +%% debug code goes here + + switch ( yy_act ) + { /* beginning of action switch */ +%% actions go here + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +%% code to do back-up for compressed tables and set up yy_cp goes here + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + +%+ +yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) + { + yyin = arg_yyin; + yyout = arg_yyout; + yy_c_buf_p = 0; + yy_init = 1; + yy_start = 0; + yy_flex_debug = 0; + yylineno = 1; // this will only get updated if %option yylineno + + yy_did_buffer_switch_on_eof = 0; + + yy_looking_for_trail_begin = 0; + yy_more_flag = 0; + yy_more_len = 0; + + yy_start_stack_ptr = yy_start_stack_depth = 0; + yy_start_stack = 0; + + yy_current_buffer = 0; + +#ifdef YY_USES_REJECT + yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; +#else + yy_state_buf = 0; +#endif + } + +yyFlexLexer::~yyFlexLexer() + { + delete yy_state_buf; + yy_delete_buffer( yy_current_buffer ); + } + +void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) + { + if ( new_in ) + { + yy_delete_buffer( yy_current_buffer ); + yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); + } + + if ( new_out ) + yyout = new_out; + } + +#ifdef YY_INTERACTIVE +int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) +#else +int yyFlexLexer::LexerInput( char* buf, int max_size ) +#endif + { + if ( yyin->eof() || yyin->fail() ) + return 0; + +#ifdef YY_INTERACTIVE + yyin->get( buf[0] ); + + if ( yyin->eof() ) + return 0; + + if ( yyin->bad() ) + return -1; + + return 1; + +#else + (void) yyin->read( buf, max_size ); + + if ( yyin->bad() ) + return -1; + else + return yyin->gcount(); +#endif + } + +void yyFlexLexer::LexerOutput( const char* buf, int size ) + { + (void) yyout->write( buf, size ); + } +%* + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +%- +static int yy_get_next_buffer() +%+ +int yyFlexLexer::yy_get_next_buffer() +%* + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +%- +static yy_state_type yy_get_previous_state() +%+ +yy_state_type yyFlexLexer::yy_get_previous_state() +%* + { + register yy_state_type yy_current_state; + register char *yy_cp; + +%% code to get the start state into yy_current_state goes here + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { +%% code to find the next state goes here + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +%- +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif +%+ +yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +%* + { + register int yy_is_jam; +%% code to find the next state, and perhaps do backing up, goes here + + return yy_is_jam ? 0 : yy_current_state; + } + + +%- +#ifdef YY_USE_PROTOS +//static + void yyunput( int c, register char *yy_bp ) +#else +//static + void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif +%+ +void yyFlexLexer::yyunput( int c, register char* yy_bp ) +%* + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +%% update yylineno here + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + + +%- +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif +%+ +int yyFlexLexer::yyinput() +%* + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + +%% update BOL and yylineno + + return c; + } + + +%- +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif +%+ +void yyFlexLexer::yyrestart( istream* input_file ) +%* + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +%- +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif +%+ +void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +%* + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif +%+ +void yyFlexLexer::yy_load_buffer_state() +%* + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif +%+ +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) +%* + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif +%+ +void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +%* + { + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +%- +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + +%+ +extern "C" int isatty YY_PROTO(( int )); +void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) +%* + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +%- +#ifdef YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#ifdef YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif +%+ + b->yy_is_interactive = 0; +%* + } + + +%- +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + +%+ +void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +%* + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } +%* + + +#ifndef YY_NO_SCAN_BUFFER +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +%* +#endif + + +#ifndef YY_NO_SCAN_STRING +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( const char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +const char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +%* +#endif + + +#ifndef YY_NO_SCAN_BYTES +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +const char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +%* +#endif + + +#ifndef YY_NO_PUSH_STATE +%- +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif +%+ +void yyFlexLexer::yy_push_state( int new_state ) +%* + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +%- +static void yy_pop_state() +%+ +void yyFlexLexer::yy_pop_state() +%* + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +%- +static int yy_top_state() +%+ +int yyFlexLexer::yy_top_state() +%* + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +%- +#ifdef YY_USE_PROTOS +static void yy_fatal_error( const char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + +%+ + +void yyFlexLexer::LexerError( const char msg[] ) + { + cerr << msg << '\n'; + exit( YY_EXIT_FAILURE ); + } +%* + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, const char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +const char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + return (void *) realloc( ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#ifdef YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif diff --git a/SamTSE/Sources/Engine/Base/ListIterator.inl b/SamTSE/Sources/Engine/Base/ListIterator.inl index 7ce551c6..4a8a55ee 100644 --- a/SamTSE/Sources/Engine/Base/ListIterator.inl +++ b/SamTSE/Sources/Engine/Base/ListIterator.inl @@ -1,105 +1,119 @@ - -#ifndef SE_INCL_LISTITERATOR_INL -#define SE_INCL_LISTITERATOR_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -/* simple list iterator: 4 bytes structure, all functions are inline */ -template -class CListIter { -private: - CListNode *li_CurrentNode; -public: - /* default constructor - no list attached */ - CListIter(void) { - li_CurrentNode = NULL; - }; - /* constructor with list attaching */ - CListIter(const CListHead &lhHead) { - li_CurrentNode = &lhHead.IterationHead(); - }; - /* constructor to start from given node */ - CListIter(CListNode &lnNode) { - ASSERT(lnNode.IsLinked()); - li_CurrentNode = &lnNode; - }; - /* start iterating */ - void Reset(const CListHead &lhHead) { - li_CurrentNode = &lhHead.IterationHead(); - }; - /* move to next node */ - void MoveToNext(void) { - li_CurrentNode = &li_CurrentNode->IterationSucc(); - }; - /* move to previous node */ - void MoveToPrev(void) { - li_CurrentNode = &li_CurrentNode->IterationPred(); - }; - /* check if finished */ - BOOL IsPastEnd(void) { - return li_CurrentNode->IsTailMarker(); - }; - /* Insert a node after current one. */ - inline void InsertAfterCurrent(CListNode &lnNew) { - li_CurrentNode->IterationInsertAfter(lnNew); - }; - /* Insert a node before current one. */ - inline void InsertBeforeCurrent(CListNode &lnNew) { - li_CurrentNode->IterationInsertBefore(lnNew); - }; - - /* Get current element. */ - Cbase &Current(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } - Cbase &operator*(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } - operator Cbase *(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } - Cbase *operator->(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } -}; - -// taken from stddef.h -//#ifndef offsetof -//#define offsetof(s,m) (size_t)&(((s *)0)->m) -//#endif - -// declare a list iterator for a class with a CListNode member -#define LISTITER(baseclass, member) CListIter - -// make 'for' construct for walking a list -#define FOREACHINLIST(baseclass, member, head, iter) \ - for ( LISTITER(baseclass, member) iter(head); !iter.IsPastEnd(); iter.MoveToNext() ) - -// make 'for' construct for walking a list, keeping the iterator for later use -#define FOREACHINLISTKEEP(baseclass, member, head, iter) \ - LISTITER(baseclass, member) iter(head); \ - for (; !iter.IsPastEnd(); iter.MoveToNext() ) - -// make 'for' construct for deleting a list -#define FORDELETELIST(baseclass, member, head, iter) \ - for ( LISTITER(baseclass, member) iter(head), iter##next; \ - iter##next=iter, iter##next.IsPastEnd() || (iter##next.MoveToNext(),1), !iter.IsPastEnd(); \ - iter = iter##next) - -#ifdef PLATFORM_OPENBSD -#ifdef LIST_HEAD - #undef LIST_HEAD -#endif -#endif - -// get the pointer to the first element in the list -#define LIST_HEAD(listhead, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) -// get the pointer to the last element in the list -#define LIST_TAIL(listhead, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(listhead).Tail())) - _offsetof(baseclass, member) ) ) - -// get the pointer to the predecessor of the element -#define LIST_PRED(element, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(element).member.Pred())) - _offsetof(baseclass, member) ) ) -// get the pointer to the successor of the element -#define LIST_SUCC(element, baseclass, member) \ - ( (baseclass *) ( ((UBYTE *)(&(element).member.Succ())) - _offsetof(baseclass, member) ) ) - - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_LISTITERATOR_INL +#define SE_INCL_LISTITERATOR_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +/* simple list iterator: 4 bytes structure, all functions are inline */ +template +class CListIter { +private: + CListNode *li_CurrentNode; +public: + /* default constructor - no list attached */ + CListIter(void) { + li_CurrentNode = NULL; + }; + /* constructor with list attaching */ + CListIter(const CListHead &lhHead) { + li_CurrentNode = &lhHead.IterationHead(); + }; + /* constructor to start from given node */ + CListIter(CListNode &lnNode) { + ASSERT(lnNode.IsLinked()); + li_CurrentNode = &lnNode; + }; + /* start iterating */ + void Reset(const CListHead &lhHead) { + li_CurrentNode = &lhHead.IterationHead(); + }; + /* move to next node */ + void MoveToNext(void) { + li_CurrentNode = &li_CurrentNode->IterationSucc(); + }; + /* move to previous node */ + void MoveToPrev(void) { + li_CurrentNode = &li_CurrentNode->IterationPred(); + }; + /* check if finished */ + BOOL IsPastEnd(void) { + return li_CurrentNode->IsTailMarker(); + }; + /* Insert a node after current one. */ + inline void InsertAfterCurrent(CListNode &lnNew) { + li_CurrentNode->IterationInsertAfter(lnNew); + }; + /* Insert a node before current one. */ + inline void InsertBeforeCurrent(CListNode &lnNew) { + li_CurrentNode->IterationInsertBefore(lnNew); + }; + + /* Get current element. */ + Cbase &Current(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } + Cbase &operator*(void) { return *((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } + operator Cbase *(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } + Cbase *operator->(void) { return ((Cbase*)((UBYTE *)li_CurrentNode - iOffset)); } +}; + +// taken from stddef.h +//#ifndef offsetof +//#define offsetof(s,m) (size_t)&(((s *)0)->m) +//#endif + +// declare a list iterator for a class with a CListNode member +#define LISTITER(baseclass, member) CListIter + +// make 'for' construct for walking a list +#define FOREACHINLIST(baseclass, member, head, iter) \ + for ( LISTITER(baseclass, member) iter(head); !iter.IsPastEnd(); iter.MoveToNext() ) + +// make 'for' construct for walking a list, keeping the iterator for later use +#define FOREACHINLISTKEEP(baseclass, member, head, iter) \ + LISTITER(baseclass, member) iter(head); \ + for (; !iter.IsPastEnd(); iter.MoveToNext() ) + +// make 'for' construct for deleting a list +#define FORDELETELIST(baseclass, member, head, iter) \ + for ( LISTITER(baseclass, member) iter(head), iter##next; \ + iter##next=iter, iter##next.IsPastEnd() || (iter##next.MoveToNext(),1), !iter.IsPastEnd(); \ + iter = iter##next) + +#ifdef PLATFORM_OPENBSD +#ifdef LIST_HEAD + #undef LIST_HEAD +#endif +#endif + +// get the pointer to the first element in the list +#define LIST_HEAD(listhead, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) +// get the pointer to the last element in the list +#define LIST_TAIL(listhead, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(listhead).Tail())) - _offsetof(baseclass, member) ) ) + +// get the pointer to the predecessor of the element +#define LIST_PRED(element, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(element).member.Pred())) - _offsetof(baseclass, member) ) ) +// get the pointer to the successor of the element +#define LIST_SUCC(element, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(element).member.Succ())) - _offsetof(baseclass, member) ) ) + + + +#endif /* include-once check. */ + diff --git a/SamTSE/Sources/Engine/Base/Lists.inl b/SamTSE/Sources/Engine/Base/Lists.inl index 88d37aaf..293c06a5 100644 --- a/SamTSE/Sources/Engine/Base/Lists.inl +++ b/SamTSE/Sources/Engine/Base/Lists.inl @@ -1,163 +1,178 @@ -#ifndef SE_INCL_LISTS_INL -#define SE_INCL_LISTS_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -/* Default constructor */ -inline CListNode::CListNode(void) -{ - // make a non-linked node - ln_Succ = NULL; - ln_Pred = NULL; -} -/* Copy constructor */ -inline CListNode::CListNode(const CListNode &lnOriginal) -{ - (void) lnOriginal; - // make a non-linked node - ln_Succ = NULL; - ln_Pred = NULL; -} -/* Destructor */ -inline CListNode::~CListNode(void) -{ - // if node is linked - if (IsLinked()) { - // remove it from list - Remove(); - } -} -/* Assignment. */ -inline CListNode &CListNode::operator=(const CListNode &lnOriginal) -{ - (void) lnOriginal; - // make a non-linked node - ln_Succ = NULL; - ln_Pred = NULL; - return *this; -} -/* Get successor of this node. */ -inline CListNode &CListNode::Succ(void) const -{ - ASSERT(IsLinked() && ln_Succ->IsLinked()); - return *ln_Succ; -} -/* Get predeccessor of this node. */ -inline CListNode &CListNode::Pred(void) const -{ - ASSERT(IsLinked() && ln_Pred->IsLinked()); - return *ln_Pred; -} -/* Get successor of this node for iteration. */ -inline CListNode &CListNode::IterationSucc(void) const -{ - ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); - return *ln_Succ; -} -/* Get predecessor of this node for iteration. */ -inline CListNode &CListNode::IterationPred(void) const -{ - ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); - return *ln_Pred; -} -/* Insert a node after current one during iteration. */ -inline void CListNode::IterationInsertAfter(CListNode &lnNew) -{ - ASSERT(!lnNew.IsLinked()); - ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); - ln_Succ->ln_Pred = &lnNew; - lnNew.ln_Succ = ln_Succ; - lnNew.ln_Pred = this; - ln_Succ = &lnNew; -} -/* Insert a node before current one during iteration. */ -inline void CListNode::IterationInsertBefore(CListNode &lnNew) -{ - ASSERT(!lnNew.IsLinked()); - ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); - ln_Pred->ln_Succ = &lnNew; - lnNew.ln_Pred = ln_Pred; - lnNew.ln_Succ = this; - ln_Pred = &lnNew; -} - -/* Check that this list node is head marker of list. */ -inline BOOL CListNode::IsHeadMarker(void) const -{ - // if this is in fact pointer to list.lh_Head - if (ln_Pred == NULL ) { - // it is end marker - return TRUE; - // otherwise - } else { - // it must be somewhere inside the list - ASSERT(IsLinked()); - return FALSE; - } -} - -/* Check that this list node is tail marker of list. */ -inline BOOL CListNode::IsTailMarker(void) const -{ - // if this is in fact pointer to list.lh_NULL - if (ln_Succ == NULL ) { - // it is end marker - return TRUE; - // otherwise - } else { - // it must be somewhere inside the list - ASSERT(IsLinked()); - return FALSE; - } -} - -/* Check if this list node is head of list. */ -inline BOOL CListNode::IsHead(void) const -{ - // it must be somewhere inside the list - ASSERT(IsLinked()); - - // if previous is list.lh_Head - return ln_Pred->ln_Pred == NULL; -} - -/* Check that this list node is tail of list. */ -inline BOOL CListNode::IsTail(void) const -{ - // it must be somewhere inside the list - ASSERT(IsLinked()); - - // if next is list.lh_NULL - return ln_Succ->ln_Succ == NULL; -} -///////////////////////////////////////////////////////////////////// -// CListHead implementations -/* Get list head. */ -inline CListNode &CListHead::Head(void) const -{ - ASSERT(IsValid() && lh_Head->IsLinked()); - return *lh_Head; -} -/* Get list tail. */ -inline CListNode &CListHead::Tail(void) const -{ - ASSERT(IsValid() && lh_Tail->IsLinked()); - return *lh_Tail; -} -/* Get list head for iteration. */ -inline CListNode &CListHead::IterationHead(void) const -{ - ASSERT(IsValid() && (lh_Head->IsTailMarker() || lh_Head->IsLinked())); - return *lh_Head; -} -/* Get list tail for iteration. */ -inline CListNode &CListHead::IterationTail(void) const -{ - ASSERT(IsValid() && (lh_Tail->IsHeadMarker() || lh_Tail->IsLinked())); - return *lh_Tail; -} - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_LISTS_INL +#define SE_INCL_LISTS_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +/* Default constructor */ +inline CListNode::CListNode(void) +{ + // make a non-linked node + ln_Succ = NULL; + ln_Pred = NULL; +} +/* Copy constructor */ +inline CListNode::CListNode(const CListNode &lnOriginal) +{ + (void) lnOriginal; + // make a non-linked node + ln_Succ = NULL; + ln_Pred = NULL; +} +/* Destructor */ +inline CListNode::~CListNode(void) +{ + // if node is linked + if (IsLinked()) { + // remove it from list + Remove(); + } +} +/* Assignment. */ +inline CListNode &CListNode::operator=(const CListNode &lnOriginal) +{ + (void) lnOriginal; + // make a non-linked node + ln_Succ = NULL; + ln_Pred = NULL; + return *this; +} +/* Get successor of this node. */ +inline CListNode &CListNode::Succ(void) const +{ + ASSERT(IsLinked() && ln_Succ->IsLinked()); + return *ln_Succ; +} +/* Get predeccessor of this node. */ +inline CListNode &CListNode::Pred(void) const +{ + ASSERT(IsLinked() && ln_Pred->IsLinked()); + return *ln_Pred; +} +/* Get successor of this node for iteration. */ +inline CListNode &CListNode::IterationSucc(void) const +{ + ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); + return *ln_Succ; +} +/* Get predecessor of this node for iteration. */ +inline CListNode &CListNode::IterationPred(void) const +{ + ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); + return *ln_Pred; +} +/* Insert a node after current one during iteration. */ +inline void CListNode::IterationInsertAfter(CListNode &lnNew) +{ + ASSERT(!lnNew.IsLinked()); + ASSERT(ln_Succ->IsTailMarker() || ln_Succ->IsLinked()); + ln_Succ->ln_Pred = &lnNew; + lnNew.ln_Succ = ln_Succ; + lnNew.ln_Pred = this; + ln_Succ = &lnNew; +} +/* Insert a node before current one during iteration. */ +inline void CListNode::IterationInsertBefore(CListNode &lnNew) +{ + ASSERT(!lnNew.IsLinked()); + ASSERT(ln_Pred->IsHeadMarker() || ln_Pred->IsLinked()); + ln_Pred->ln_Succ = &lnNew; + lnNew.ln_Pred = ln_Pred; + lnNew.ln_Succ = this; + ln_Pred = &lnNew; +} + +/* Check that this list node is head marker of list. */ +inline BOOL CListNode::IsHeadMarker(void) const +{ + // if this is in fact pointer to list.lh_Head + if (ln_Pred == NULL ) { + // it is end marker + return TRUE; + // otherwise + } else { + // it must be somewhere inside the list + ASSERT(IsLinked()); + return FALSE; + } +} + +/* Check that this list node is tail marker of list. */ +inline BOOL CListNode::IsTailMarker(void) const +{ + // if this is in fact pointer to list.lh_NULL + if (ln_Succ == NULL ) { + // it is end marker + return TRUE; + // otherwise + } else { + // it must be somewhere inside the list + ASSERT(IsLinked()); + return FALSE; + } +} + +/* Check if this list node is head of list. */ +inline BOOL CListNode::IsHead(void) const +{ + // it must be somewhere inside the list + ASSERT(IsLinked()); + + // if previous is list.lh_Head + return ln_Pred->ln_Pred == NULL; +} + +/* Check that this list node is tail of list. */ +inline BOOL CListNode::IsTail(void) const +{ + // it must be somewhere inside the list + ASSERT(IsLinked()); + + // if next is list.lh_NULL + return ln_Succ->ln_Succ == NULL; +} +///////////////////////////////////////////////////////////////////// +// CListHead implementations +/* Get list head. */ +inline CListNode &CListHead::Head(void) const +{ + ASSERT(IsValid() && lh_Head->IsLinked()); + return *lh_Head; +} +/* Get list tail. */ +inline CListNode &CListHead::Tail(void) const +{ + ASSERT(IsValid() && lh_Tail->IsLinked()); + return *lh_Tail; +} +/* Get list head for iteration. */ +inline CListNode &CListHead::IterationHead(void) const +{ + ASSERT(IsValid() && (lh_Head->IsTailMarker() || lh_Head->IsLinked())); + return *lh_Head; +} +/* Get list tail for iteration. */ +inline CListNode &CListHead::IterationTail(void) const +{ + ASSERT(IsValid() && (lh_Tail->IsHeadMarker() || lh_Tail->IsLinked())); + return *lh_Tail; +} + + +#endif /* include-once check. */ + diff --git a/SamTSE/Sources/Engine/Base/NullSynchronization.cpp b/SamTSE/Sources/Engine/Base/NullSynchronization.cpp index 5c68c048..fe56fb30 100644 --- a/SamTSE/Sources/Engine/Base/NullSynchronization.cpp +++ b/SamTSE/Sources/Engine/Base/NullSynchronization.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "Engine/StdH.h" #include diff --git a/SamTSE/Sources/Engine/Base/Parser.y b/SamTSE/Sources/Engine/Base/Parser.y index d4e3f6ec..6784a9fd 100644 --- a/SamTSE/Sources/Engine/Base/Parser.y +++ b/SamTSE/Sources/Engine/Base/Parser.y @@ -1,1080 +1,1095 @@ -%{ -#include - -#include -#include -#include "ParsingSymbols.h" - -#include -#include - -%} - -%{ -// turn off over-helpful bit of bison... --ryan. -#ifdef __GNUC__ -#define __attribute__(x) -#endif - -#define YYERROR_VERBOSE 1 -// if error occurs in parsing -void yyerror(const char *str) -{ - // just report the string - _pShell->ErrorF("%s", str); -}; - -static BOOL _bExecNextElse = FALSE; -FLOAT fDummy = -666.0f; - -static INDEX _iStack = 0; -static UBYTE _ubStack[1024]; - -INDEX PushExpression(value &v) -{ - if (v.sttType==STT_FLOAT) { - FLOAT f = v.fFloat; - memcpy(_ubStack+_iStack, &f, sizeof(f)); - _iStack+=sizeof(f); - return sizeof(f); - } else if (v.sttType==STT_INDEX) { - INDEX i = v.iIndex; - memcpy(_ubStack+_iStack, &i, sizeof(i)); - _iStack+=sizeof(i); - return sizeof(i); - } else if (v.sttType==STT_STRING) { - CTString &str = _shell_astrTempStrings.Push(); - str = v.strString; - CTString *pstr = &str; - memcpy(_ubStack+_iStack, &pstr, sizeof(pstr)); - _iStack+=sizeof(pstr); - return sizeof(pstr); - } else { - return 0; - } -} - -BOOL MatchTypes(value &v1, value &v2) -{ - if (v1.sttType==STT_FLOAT && v2.sttType==STT_FLOAT) { - return TRUE; - } else if (v1.sttType==STT_STRING && v2.sttType==STT_STRING) { - return TRUE; - } else if (v1.sttType==STT_INDEX && v2.sttType==STT_INDEX) { - return TRUE; - } else { - v1.sttType = STT_ILLEGAL; - v2.sttType = STT_ILLEGAL; - _pShell->ErrorF("Type mismatch"); - return FALSE; - } -} - -void Declaration( - ULONG ulQualifiers, INDEX istType, CShellSymbol &ssNew, - INDEX (*pPreFunc)(INDEX), void (*pPostFunc)(INDEX)) -{ - // if external - if (ulQualifiers&SSF_EXTERNAL) { - // get it a new value - if (_shell_ast[istType].st_sttType==STT_INDEX - ||_shell_ast[istType].st_sttType==STT_FLOAT) { - _pvNextToDeclare = &_shell_afExtFloats.Push(); - } else if (_shell_ast[istType].st_sttType==STT_STRING) { - _pvNextToDeclare = &_shell_astrExtStrings.Push(); - } else { - NOTHING; - } - } - - // if not parsing an external declaration - if (_pvNextToDeclare==NULL) { - // error - _pShell->ErrorF("Only external declarations are supported"); - return; - } - - // if the symbol is declared already - if (ssNew.IsDeclared()) { - // if the declaration is not identical - if (!ShellTypeIsSame(ssNew.ss_istType, istType) || - ((ssNew.ss_ulFlags&SSF_CONSTANT)!=(ulQualifiers&SSF_CONSTANT))) { - // error - _pShell->ErrorF("Symbol '%s' is already declared diferrently", (const char *) ssNew.ss_strName); - return; - } - - // copy its value - if (_shell_ast[ssNew.ss_istType].st_sttType==STT_INDEX) { - *(INDEX*)_pvNextToDeclare = *(INDEX*)ssNew.ss_pvValue; - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FLOAT) { - *(FLOAT*)_pvNextToDeclare = *(FLOAT*)ssNew.ss_pvValue; - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_STRING) { - *(CTString*)_pvNextToDeclare = *(CTString*)ssNew.ss_pvValue; - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_ARRAY) { - NOTHING; // array values are not retained - } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FUNCTION) { - NOTHING; // function values are not retained - } else { - // error - _pShell->ErrorF("'%s': old value couldn't be retained", (const char *) ssNew.ss_strName); - return; - } - } - - // set the type to given type - if (!ssNew.IsDeclared()) { - ssNew.ss_istType = ShellTypeMakeDuplicate(istType); - } - // set the value for the external symbol if not already set - if (ssNew.ss_pvValue==NULL || !(ulQualifiers&SSF_EXTERNAL)) { - ssNew.ss_pvValue = _pvNextToDeclare; - } - // remember qualifiers (if already predeclared - keep old flags) - ssNew.ss_ulFlags |= ulQualifiers; - // remember pre and post functions - if (ssNew.ss_pPreFunc==NULL) { - ssNew.ss_pPreFunc = (BOOL (*)(void *))pPreFunc; - } - if (ssNew.ss_pPostFunc==NULL) { - ssNew.ss_pPostFunc = (void (*)(void *))pPostFunc; - } -} - -void DoComparison(value &vRes, value &v0, value &v1, int token) -{ - MatchTypes(v0, v1); - - vRes.sttType = STT_INDEX; - if (v0.sttType == STT_FLOAT) { - switch (token) { - case '<': vRes.iIndex = v0.fFloat ': vRes.iIndex = v0.fFloat >v1.fFloat; break; - case '=': vRes.iIndex = v0.fFloat==v1.fFloat; break; - case '!': vRes.iIndex = v0.fFloat!=v1.fFloat; break; - case '}': vRes.iIndex = v0.fFloat>=v1.fFloat; break; - case '{': vRes.iIndex = v0.fFloat<=v1.fFloat; break; - default: ASSERT(FALSE); - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } - } else if (v0.sttType == STT_INDEX) { - switch (token) { - case '<': vRes.iIndex = v0.iIndex ': vRes.iIndex = v0.iIndex >v1.iIndex; break; - case '=': vRes.iIndex = v0.iIndex==v1.iIndex; break; - case '!': vRes.iIndex = v0.iIndex!=v1.iIndex; break; - case '}': vRes.iIndex = v0.iIndex>=v1.iIndex; break; - case '{': vRes.iIndex = v0.iIndex<=v1.iIndex; break; - default: ASSERT(FALSE); - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } - } else if (v0.sttType == STT_STRING) { - switch (token) { - case '<': vRes.iIndex = stricmp(v0.strString, v1.strString) < 0; break; - case '>': vRes.iIndex = stricmp(v0.strString, v1.strString) > 0; break; - case '=': vRes.iIndex = stricmp(v0.strString, v1.strString) == 0; break; - case '!': vRes.iIndex = stricmp(v0.strString, v1.strString) != 0; break; - case '}': vRes.iIndex = stricmp(v0.strString, v1.strString) >= 0; break; - case '{': vRes.iIndex = stricmp(v0.strString, v1.strString) <= 0; break; - default: ASSERT(FALSE); - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } - } else { - vRes.sttType = STT_INDEX; - vRes.iIndex = 0; - } -} -%} - -/* BISON Declarations */ - -// we need to be reentrant! -%pure_parser - -%union { - value val; // for constants and expressions - arguments arg; // for function input arguments - ULONG ulFlags; // for declaration qualifiers - INDEX istType; // for types - CShellSymbol *pssSymbol; // for symbols - struct LValue lvLValue; - INDEX (*pPreFunc)(INDEX); // pre-set function for a variable - void (*pPostFunc)(INDEX); // post-set function for a variable -} - -%{ - extern int yylex(YYSTYPE *lvalp); -%} - -%token c_float -%token c_int -%token c_string -%token c_char - -%token identifier - -%token k_INDEX -%token k_FLOAT -%token k_CTString -%token k_void -%token k_const -%token k_user -%token k_persistent -%token k_extern -%token k_pre -%token k_post -%token k_help -%token k_if -%token k_else -%token k_else_if -%token SHL -%token SHR -%token EQ -%token NEQ -%token GEQ -%token LEQ -%token LOGAND -%token LOGOR -%token block_beg -%token block_end - -%type lvalue -%type expression -%type declaration_qualifiers -%type opt_string -%type type_specifier -%type parameter_list -%type parameter_list_opt -%type pre_func_opt -%type post_func_opt -%type argument_expression_list_opt -%type argument_expression_list - -%right '=' -%left LOGAND LOGOR -%left '&' '^' '|' -%left '<' '>' EQ NEQ LEQ GEQ -%left SHL -%left SHR -%left '-' '+' -%left '*' '/' '%' -%left TYPECAST -%left SIGN '!' - -%start program - -%% - -/*///////////////////////////////////////////////////////// - * Global structure of the source file. - */ -program -: declaration -| statements -; - -block -: block_beg statements block_end -| block_beg statements block_end -; - -statements -: /* null */ -| statement statements -; - -declaration_qualifiers -: /* nothing */ { - $$ = 0; -} -| declaration_qualifiers k_const { - $$ = $1 | SSF_CONSTANT; -} -| declaration_qualifiers k_user { - $$ = $1 | SSF_USER; -} -| declaration_qualifiers k_persistent { - $$ = $1 | SSF_PERSISTENT; -} -| declaration_qualifiers k_extern { - $$ = $1 | SSF_EXTERNAL; -} - -opt_string -: /* nothing */ { - $$.strString = ""; -} -| c_string { - // !!!! remove this option - //_pShell->ErrorF("Warning: symbol comments are not supported"); - $$.strString = $1.strString; -} - -type_specifier -: k_FLOAT { - $$ = ShellTypeNewFloat(); -} -| k_INDEX { - $$ = ShellTypeNewIndex(); -} -| k_CTString { - $$ = ShellTypeNewString(); -} -| k_void { - $$ = ShellTypeNewVoid(); -} - -pre_func_opt -: { - $$ = NULL; -} -| k_pre ':' identifier { - if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION - ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_INDEX - ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument - ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { - _pShell->ErrorF("'%s' must return 'INDEX' and take 'INDEX' as input", (const char *) $3->ss_strName); - } else { - void *pv = $3->ss_pvValue; - $$ = (INDEX(*)(INDEX))$3->ss_pvValue; - } -} - -post_func_opt -: { - $$ = NULL; -} -| k_post ':' identifier { - if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION - ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_VOID - ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument - ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { - _pShell->ErrorF("'%s' must return 'void' and take 'INDEX' as input", (const char *) $3->ss_strName); - } else { - $$ = (void(*)(INDEX))$3->ss_pvValue; - } -} -; - -parameter_list_opt -: /* nothing */ { - $$ = ShellTypeNewFunction(0); - ShellTypeAddFunctionArgument($$, ShellTypeNewVoid()); -} -| parameter_list { - $$ = $1; -} -; - -parameter_list -: type_specifier { - $$ = ShellTypeNewFunction(0); - ShellTypeAddFunctionArgument($$, $1); -} -/*| identifier type_specifier { - $$ = ShellTypeNewFunction(0); - ShellTypeAddFunctionArgument($$, $2); -}*/ -| parameter_list ',' type_specifier { - $$ = $1; - ShellTypeAddFunctionArgument($$, $3); -} -/*| parameter_list ',' identifier type_specifier { - $$ = $1; - ShellTypeAddFunctionArgument($$, $4); -} */ -; - -declaration -: declaration_qualifiers type_specifier identifier pre_func_opt post_func_opt opt_string ';' { - Declaration($1, $2, *$3, $4, $5); - ShellTypeDelete($2); -} -| declaration_qualifiers type_specifier identifier '(' parameter_list_opt ')' opt_string ';' { - // take function from the parameter list and set its return type - _shell_ast[$5].st_istBaseType = $2; - $2 = $5; - // declare it - Declaration($1, $2, *$3, NULL, NULL); - // free the type (declaration will make a copy) - ShellTypeDelete($2); -} -| declaration_qualifiers type_specifier identifier '[' expression ']' pre_func_opt post_func_opt opt_string ';' { - if ($5.sttType!=STT_INDEX) { - _pShell->ErrorF("Array size is not integral"); - } - $2 = ShellTypeNewArray($2, $5.iIndex); - Declaration($1, $2, *$3, NULL, NULL); - ShellTypeDelete($2); -} - -statement -: ';' { - // dummy -} -| block { - // dummy -} -| expression ';' { - // print its value - if ($1.sttType == STT_VOID) { - NOTHING; - } else if ($1.sttType == STT_FLOAT) { - CPrintF("%g\n", $1.fFloat); - } else if ($1.sttType == STT_STRING) { - CPrintF("\"%s\"\n", $1.strString); - } else if ($1.sttType == STT_INDEX) { - CPrintF("%d(0x%08X)\n", $1.iIndex, $1.iIndex); - } else { - _pShell->ErrorF("Expression cannot be printed"); - } -} -| lvalue '=' expression ';' { - // if it is constant - if ($1.lv_pssSymbol->ss_ulFlags&SSF_CONSTANT) { - _pShell->ErrorF("Symbol '%s' is a constant", (const char *) $1.lv_pssSymbol->ss_strName); - // if it is not constant - } else { - // if it can be changed - if ($1.lv_pssSymbol->ss_pPreFunc==NULL || $1.lv_pssSymbol->ss_pPreFunc($1.lv_pvAddress)) { - // if floats - if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_FLOAT) { - // assign value - *(FLOAT*)$1.lv_pvAddress = $3.fFloat; - // if indices - } else if ($1.lv_sttType == STT_INDEX && $3.sttType==STT_INDEX) { - // assign value - *(INDEX*)$1.lv_pvAddress = $3.iIndex; - - // if strings - } else if ($1.lv_sttType == STT_STRING && $3.sttType==STT_STRING) { - // assign value - *(CTString*)$1.lv_pvAddress = $3.strString; - - // if assigning index to float - } else if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_INDEX) { - *(FLOAT*)$1.lv_pvAddress = $3.iIndex; - // otherwise - } else { - // error - _pShell->ErrorF("Cannot assign: different types"); - } - - // call post-change function - if ($1.lv_pssSymbol->ss_pPostFunc!=NULL) { - $1.lv_pssSymbol->ss_pPostFunc($1.lv_pvAddress); - } - } - } -} -| declaration_qualifiers type_specifier identifier '=' expression ';' { - Declaration($1, $2, *$3, NULL, NULL); - ShellTypeDelete($2); - - CShellSymbol &ssSymbol = *$3; - // if it is constant - if (ssSymbol.ss_ulFlags&SSF_CONSTANT) { - // error - _pShell->ErrorF("Symbol '%s' is a constant", (const char *) ssSymbol.ss_strName); - } - - // get symbol type - ShellTypeType stt = _shell_ast[$2].st_sttType; - - // if floats - if (stt == STT_FLOAT && $5.sttType==STT_FLOAT) { - // assign value - *(FLOAT*)ssSymbol.ss_pvValue = $5.fFloat; - // if indices - } else if (stt == STT_INDEX && $5.sttType==STT_INDEX) { - // assign value - *(INDEX*)ssSymbol.ss_pvValue = $5.iIndex; - // if strings - } else if (stt == STT_STRING && $5.sttType==STT_STRING) { - // assign value - *(CTString*)ssSymbol.ss_pvValue = $5.strString; - // !!!! remove this conversion - } else if (stt == STT_FLOAT && $5.sttType==STT_INDEX) { - _pShell->ErrorF("Warning: assigning INDEX to FLOAT!"); - *(FLOAT*)ssSymbol.ss_pvValue = $5.iIndex; - } else { - _pShell->ErrorF("Symbol '%s' and its initializer have different types", (const char *) ssSymbol.ss_strName); - } -} -| k_help identifier { -extern void PrintShellSymbolHelp(const CTString &strSymbol); - PrintShellSymbolHelp($2->ss_strName); -} -| k_help identifier '(' ')' { -extern void PrintShellSymbolHelp(const CTString &strSymbol); - PrintShellSymbolHelp($2->ss_strName); -} -| k_help identifier '[' ']' { -extern void PrintShellSymbolHelp(const CTString &strSymbol); - PrintShellSymbolHelp($2->ss_strName); -} -| k_if '(' expression ')' { - _bExecNextBlock = FALSE; - if ($3.sttType == STT_INDEX) { - _bExecNextBlock = $3.iIndex!=0; - } else if ($3.sttType == STT_FLOAT) { - _bExecNextBlock = $3.fFloat!=0; - } else { - _pShell->ErrorF("If expression is not integral"); - } - $1 = _bExecNextBlock; -} block { - _bExecNextElse = !$1; - _bExecNextBlock = TRUE; -} opt_else -; - -opt_else -: /* nothing */ - -| k_else_if '(' expression ')' { - if (_bExecNextElse) { - _bExecNextBlock = FALSE; - if ($3.sttType == STT_INDEX) { - _bExecNextBlock = $3.iIndex!=0; - } else if ($3.sttType == STT_FLOAT) { - _bExecNextBlock = $3.fFloat!=0; - } else { - _pShell->ErrorF("If expression is not integral"); - } - $1 = _bExecNextBlock; - } else { - _bExecNextBlock = FALSE; - _bExecNextElse = FALSE; - $1 = TRUE; - } -} block { - _bExecNextElse = !$1; - _bExecNextBlock = TRUE; -} opt_else - -| k_else { - _bExecNextBlock = _bExecNextElse; -} block { - _bExecNextBlock = TRUE; -} -; - -lvalue -: identifier { - CShellSymbol &ssSymbol = *$1; - const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; - - $$.lv_pssSymbol = &ssSymbol; - if (!ssSymbol.IsDeclared()) { - // error - _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); - fDummy = -666; - $$.lv_sttType = STT_VOID; - $$.lv_pvAddress = &fDummy; - // if the identifier is a float, int or string - } else if (stType.st_sttType==STT_FLOAT || stType.st_sttType==STT_INDEX || stType.st_sttType==STT_STRING) { - // get its value and type - $$.lv_sttType = stType.st_sttType; - $$.lv_pvAddress = ssSymbol.ss_pvValue; - // if the identifier is something else - } else { - // error - _pShell->ErrorF("'%s' doesn't have a value", (const char *) $1->ss_strName); - fDummy = -666.0f; - $$.lv_sttType = STT_VOID; - $$.lv_pvAddress = &fDummy; - } -} -| identifier '[' expression ']' { - CShellSymbol &ssSymbol = *$1; - const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; - $$.lv_pssSymbol = &ssSymbol; - - int iIndex = 0; - // if subscript is index - if ($3.sttType==STT_INDEX) { - // get the index - iIndex = $3.iIndex; - // if subscript is not index - } else { - // error - _pShell->ErrorF("Array subscript is not integral"); - } - // if the symbol is array - if (stType.st_sttType==STT_ARRAY) { - const ShellType &stBase = _shell_ast[stType.st_istBaseType]; - // if it is float or int array - if (stBase.st_sttType==STT_FLOAT || stBase.st_sttType==STT_INDEX) { - // if the index is out of range - if (iIndex<0 || iIndex>=stType.st_ctArraySize) { - _pShell->ErrorF("Array member out of range"); - fDummy = -666.0f; - $$.lv_pvAddress = &fDummy; - } else { - // get its value and type - $$.lv_sttType = stBase.st_sttType; - $$.lv_pvAddress = (FLOAT*)ssSymbol.ss_pvValue+iIndex; - } - } - } else { - _pShell->ErrorF("'%s[]' doesn't have a value", (const char *) $1->ss_strName); - fDummy = -666.0f; - $$.lv_pvAddress = &fDummy; - } -} -; - -argument_expression_list_opt -: /* nothing */ { - $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); - ShellTypeAddFunctionArgument($$.istType, ShellTypeNewVoid()); - $$.ctBytes = 0; -} -| argument_expression_list { - $$ = $1; -} -; - -argument_expression_list -: expression { - $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); - ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($1.sttType)); - $$.ctBytes = PushExpression($1); -} -| argument_expression_list ',' expression { - $$ = $1; - ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($3.sttType)); - $$.ctBytes += PushExpression($3); -} - -expression -: c_float { - $$.sttType = STT_FLOAT; - $$.fFloat = $1.fFloat; -} -| c_int { - $$.sttType = STT_INDEX; - $$.iIndex = $1.iIndex; -} -| c_string { - $$.sttType = STT_STRING; - $$.strString = $1.strString; -} -| lvalue { - // get its value - $$.sttType = $1.lv_sttType; - if ($1.lv_sttType==STT_VOID) { - NOTHING; - } else if ($1.lv_sttType==STT_FLOAT) { - $$.fFloat = *(FLOAT*)$1.lv_pvAddress; - } else if ($1.lv_sttType==STT_INDEX) { - $$.iIndex = *(INDEX*)$1.lv_pvAddress; - } else if ($1.lv_sttType==STT_STRING) { - $$.strString = (const char*)*(CTString*)$1.lv_pvAddress; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - _pShell->ErrorF("'%s' is of wrong type", (const char *) $1.lv_pssSymbol->ss_strName); - } -} -/* shift */ -| expression SHL expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex<<$3.iIndex; - } else { - _pShell->ErrorF("Wrong arguments for '<<'"); - $$.sttType = STT_INDEX; - $$.iIndex = -666; - } -} -| expression SHR expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex>>$3.iIndex; - } else { - _pShell->ErrorF("Wrong arguments for '>>'"); - $$.sttType = STT_INDEX; - $$.iIndex = -666; - } -} -/* bitwise operators */ -| expression '&' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'&' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex&$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -| expression '|' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'|' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex|$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -| expression '^' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'^' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex^$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -/* logical operators */ -| expression LOGAND expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'&&' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex&&$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -| expression LOGOR expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'||' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex||$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -/* addition */ -| expression '+' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat+$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex+$3.iIndex; - } else if ($1.sttType == STT_STRING) { - CTString &strNew = _shell_astrTempStrings.Push(); - strNew = CTString($1.strString)+$3.strString; - $$.strString = (const char*)strNew; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} -/* substraction */ -| expression '-' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat-$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex-$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -/* multiplication */ -| expression '*' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat*$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex*$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - -} -/* division */ -| expression '/' expression { - - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - $$.fFloat = $1.fFloat/$3.fFloat; - } else if ($1.sttType == STT_INDEX) { - if ($3.iIndex==0) { - _pShell->ErrorF("Division by zero!\n"); - $$.iIndex = 0; - } else { - $$.iIndex = $1.iIndex/$3.iIndex; - } - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - -} - -/* modulo */ -| expression '%' expression { - MatchTypes($1, $3); - - $$.sttType = $1.sttType; - if ($1.sttType == STT_FLOAT) { - _pShell->ErrorF("'%' is illegal for FLOAT values"); - } else if ($1.sttType == STT_INDEX) { - $$.iIndex = $1.iIndex%$3.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - -} - -/* comparisons */ -| expression '<' expression { - DoComparison($$, $1, $3, '<'); -} -| expression '>' expression { - DoComparison($$, $1, $3, '>'); -} -| expression EQ expression { - DoComparison($$, $1, $3, '='); -} -| expression NEQ expression { - DoComparison($$, $1, $3, '!'); -} -| expression GEQ expression { - DoComparison($$, $1, $3, '}'); -} -| expression LEQ expression { - DoComparison($$, $1, $3, '{'); -} - -// unary minus - -| '-' expression %prec SIGN { - $$.sttType = $2.sttType; - if ($2.sttType == STT_FLOAT) { - $$.fFloat = -$2.fFloat; - } else if ($2.sttType == STT_INDEX) { - $$.iIndex = -$2.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -// unary plus - -| '+' expression %prec SIGN { - $$.sttType = $2.sttType; - if ($2.sttType == STT_FLOAT) { - $$.fFloat = $2.fFloat; - } else if ($2.sttType == STT_INDEX) { - $$.iIndex = $2.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -| '!' expression %prec SIGN { - $$.sttType = $2.sttType; - if ($2.sttType == STT_FLOAT) { - _pShell->ErrorF("'!' is illegal for FLOAT values"); - $$.fFloat = $2.fFloat; - } else if ($2.sttType == STT_INDEX) { - $$.iIndex = !$2.iIndex; - } else { - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } -} - -| '(' k_FLOAT ')' expression %prec TYPECAST { - $$.sttType = STT_FLOAT; - if ($4.sttType == STT_FLOAT) { - $$.fFloat = $4.fFloat; - } else if ($4.sttType == STT_INDEX) { - $$.fFloat = FLOAT($4.iIndex); - } else if ($4.sttType == STT_STRING) { - $$.fFloat = atof($4.strString); - } else { - _pShell->ErrorF("Cannot convert to FLOAT"); - $$.sttType = STT_VOID; - } -} - -| '(' k_INDEX ')' expression %prec TYPECAST { - $$.sttType = STT_INDEX; - if ($4.sttType == STT_FLOAT) { - $$.iIndex = INDEX($4.fFloat); - } else if ($4.sttType == STT_INDEX) { - $$.iIndex = $4.iIndex; - } else if ($4.sttType == STT_STRING) { - $$.iIndex = atol($4.strString); - } else { - _pShell->ErrorF("Cannot convert to INDEX"); - $$.sttType = STT_VOID; - } -} - -| '(' k_CTString ')' expression %prec TYPECAST { - CTString &strNew = _shell_astrTempStrings.Push(); - $$.sttType = STT_STRING; - if ($4.sttType == STT_FLOAT) { - strNew.PrintF("%g", $4.fFloat); - } else if ($4.sttType == STT_INDEX) { - strNew.PrintF("%d", $4.iIndex); - } else if ($4.sttType == STT_STRING) { - strNew = $4.strString; - } else { - _pShell->ErrorF("Cannot convert to CTString"); - $$.sttType = STT_VOID; - } - $$.strString = (const char*)strNew; -} - -// function call -| identifier '(' argument_expression_list_opt ')' { - // if the identifier is not declared - if (!$1->IsDeclared()) { - // error - _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); - // if the identifier is declared - } else { - // get its type - ShellType &stFunc = _shell_ast[$1->ss_istType]; - - // if the identifier is a function - if (stFunc.st_sttType==STT_FUNCTION) { - // determine result type - ShellType &stResult = _shell_ast[stFunc.st_istBaseType]; - // match argument list result to that result - _shell_ast[_shell_ast[$3.istType].st_istBaseType].st_sttType = stResult.st_sttType; - // if types are same - if (ShellTypeIsSame($3.istType, $1->ss_istType)) { - bool callfunc = true; - -// !!! FIXME: maybe just dump the win32 codepath here? This will break on Win64, and maybe break on different compilers/compiler versions, etc. -#ifdef PLATFORM_WIN32 - #define CALLPARAMS - #define FUNCSIG void - #define PUSHPARAMS memcpy(_alloca($3.ctBytes), _ubStack+_iStack-$3.ctBytes, $3.ctBytes); -#else - // This is possibly more portable, but no less scary than the alloca hack. - #define MAXSCRIPTFUNCARGS 5 - void *ARG[MAXSCRIPTFUNCARGS]; - if (($3.ctBytes > (int32_t)sizeof (ARG))) - { - _pShell->ErrorF("Function '%s' has too many arguments!", (const char *) $1->ss_strName); - callfunc = false; - } - else - { - memcpy(ARG, _ubStack+_iStack-$3.ctBytes, $3.ctBytes); - memset(((char *) ARG) + $3.ctBytes, '\0', sizeof (ARG) - $3.ctBytes); - } - #define PUSHPARAMS - #define FUNCSIG void*, void*, void*, void*, void* - #define CALLPARAMS ARG[0], ARG[1], ARG[2], ARG[3], ARG[4] -#endif - - if (callfunc) { - // if void - if (stResult.st_sttType==STT_VOID) { - // just call the function - $$.sttType = STT_VOID; - PUSHPARAMS; - ((void (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - // if index - } else if (stResult.st_sttType==STT_INDEX) { - // call the function and return result - $$.sttType = STT_INDEX; - PUSHPARAMS; - $$.iIndex = ((INDEX (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - // if float - } else if (stResult.st_sttType==STT_FLOAT) { - // call the function and return result - $$.sttType = STT_FLOAT; - PUSHPARAMS; - $$.fFloat = ((FLOAT (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - // if string - } else if (stResult.st_sttType==STT_STRING) { - // call the function and return result - $$.sttType = STT_STRING; - CTString &strNew = _shell_astrTempStrings.Push(); - PUSHPARAMS; - strNew = ((CTString (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); - $$.strString = (const char*)strNew; - } else { - ASSERT(FALSE); - $$.sttType = STT_FLOAT; - $$.fFloat = -666.0f; - } - } - // if types are different - } else { - // error - $$.sttType = STT_VOID; - _pShell->ErrorF("Wrong parameters for '%s'", (const char *) $1->ss_strName); - } - // if the identifier is something else - } else { - // error - $$.sttType = STT_VOID; - _pShell->ErrorF("Can't call '%s'", (const char *) $1->ss_strName); - } - } - - // pop arguments and free type info - _iStack-=$3.ctBytes; - ShellTypeDelete($3.istType); -} -// brackets -| '(' expression ')' { - $$ = $2; -} -; - -%% +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include + +#include +#include +#include "ParsingSymbols.h" + +#include +#include + +%} + +%{ +// turn off over-helpful bit of bison... --ryan. +#ifdef __GNUC__ +#define __attribute__(x) +#endif + +#define YYERROR_VERBOSE 1 +// if error occurs in parsing +void yyerror(const char *str) +{ + // just report the string + _pShell->ErrorF("%s", str); +}; + +static BOOL _bExecNextElse = FALSE; +FLOAT fDummy = -666.0f; + +static INDEX _iStack = 0; +static UBYTE _ubStack[1024]; + +INDEX PushExpression(value &v) +{ + if (v.sttType==STT_FLOAT) { + FLOAT f = v.fFloat; + memcpy(_ubStack+_iStack, &f, sizeof(f)); + _iStack+=sizeof(f); + return sizeof(f); + } else if (v.sttType==STT_INDEX) { + INDEX i = v.iIndex; + memcpy(_ubStack+_iStack, &i, sizeof(i)); + _iStack+=sizeof(i); + return sizeof(i); + } else if (v.sttType==STT_STRING) { + CTString &str = _shell_astrTempStrings.Push(); + str = v.strString; + CTString *pstr = &str; + memcpy(_ubStack+_iStack, &pstr, sizeof(pstr)); + _iStack+=sizeof(pstr); + return sizeof(pstr); + } else { + return 0; + } +} + +BOOL MatchTypes(value &v1, value &v2) +{ + if (v1.sttType==STT_FLOAT && v2.sttType==STT_FLOAT) { + return TRUE; + } else if (v1.sttType==STT_STRING && v2.sttType==STT_STRING) { + return TRUE; + } else if (v1.sttType==STT_INDEX && v2.sttType==STT_INDEX) { + return TRUE; + } else { + v1.sttType = STT_ILLEGAL; + v2.sttType = STT_ILLEGAL; + _pShell->ErrorF("Type mismatch"); + return FALSE; + } +} + +void Declaration( + ULONG ulQualifiers, INDEX istType, CShellSymbol &ssNew, + INDEX (*pPreFunc)(INDEX), void (*pPostFunc)(INDEX)) +{ + // if external + if (ulQualifiers&SSF_EXTERNAL) { + // get it a new value + if (_shell_ast[istType].st_sttType==STT_INDEX + ||_shell_ast[istType].st_sttType==STT_FLOAT) { + _pvNextToDeclare = &_shell_afExtFloats.Push(); + } else if (_shell_ast[istType].st_sttType==STT_STRING) { + _pvNextToDeclare = &_shell_astrExtStrings.Push(); + } else { + NOTHING; + } + } + + // if not parsing an external declaration + if (_pvNextToDeclare==NULL) { + // error + _pShell->ErrorF("Only external declarations are supported"); + return; + } + + // if the symbol is declared already + if (ssNew.IsDeclared()) { + // if the declaration is not identical + if (!ShellTypeIsSame(ssNew.ss_istType, istType) || + ((ssNew.ss_ulFlags&SSF_CONSTANT)!=(ulQualifiers&SSF_CONSTANT))) { + // error + _pShell->ErrorF("Symbol '%s' is already declared diferrently", (const char *) ssNew.ss_strName); + return; + } + + // copy its value + if (_shell_ast[ssNew.ss_istType].st_sttType==STT_INDEX) { + *(INDEX*)_pvNextToDeclare = *(INDEX*)ssNew.ss_pvValue; + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FLOAT) { + *(FLOAT*)_pvNextToDeclare = *(FLOAT*)ssNew.ss_pvValue; + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_STRING) { + *(CTString*)_pvNextToDeclare = *(CTString*)ssNew.ss_pvValue; + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_ARRAY) { + NOTHING; // array values are not retained + } else if (_shell_ast[ssNew.ss_istType].st_sttType==STT_FUNCTION) { + NOTHING; // function values are not retained + } else { + // error + _pShell->ErrorF("'%s': old value couldn't be retained", (const char *) ssNew.ss_strName); + return; + } + } + + // set the type to given type + if (!ssNew.IsDeclared()) { + ssNew.ss_istType = ShellTypeMakeDuplicate(istType); + } + // set the value for the external symbol if not already set + if (ssNew.ss_pvValue==NULL || !(ulQualifiers&SSF_EXTERNAL)) { + ssNew.ss_pvValue = _pvNextToDeclare; + } + // remember qualifiers (if already predeclared - keep old flags) + ssNew.ss_ulFlags |= ulQualifiers; + // remember pre and post functions + if (ssNew.ss_pPreFunc==NULL) { + ssNew.ss_pPreFunc = (BOOL (*)(void *))pPreFunc; + } + if (ssNew.ss_pPostFunc==NULL) { + ssNew.ss_pPostFunc = (void (*)(void *))pPostFunc; + } +} + +void DoComparison(value &vRes, value &v0, value &v1, int token) +{ + MatchTypes(v0, v1); + + vRes.sttType = STT_INDEX; + if (v0.sttType == STT_FLOAT) { + switch (token) { + case '<': vRes.iIndex = v0.fFloat ': vRes.iIndex = v0.fFloat >v1.fFloat; break; + case '=': vRes.iIndex = v0.fFloat==v1.fFloat; break; + case '!': vRes.iIndex = v0.fFloat!=v1.fFloat; break; + case '}': vRes.iIndex = v0.fFloat>=v1.fFloat; break; + case '{': vRes.iIndex = v0.fFloat<=v1.fFloat; break; + default: ASSERT(FALSE); + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } + } else if (v0.sttType == STT_INDEX) { + switch (token) { + case '<': vRes.iIndex = v0.iIndex ': vRes.iIndex = v0.iIndex >v1.iIndex; break; + case '=': vRes.iIndex = v0.iIndex==v1.iIndex; break; + case '!': vRes.iIndex = v0.iIndex!=v1.iIndex; break; + case '}': vRes.iIndex = v0.iIndex>=v1.iIndex; break; + case '{': vRes.iIndex = v0.iIndex<=v1.iIndex; break; + default: ASSERT(FALSE); + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } + } else if (v0.sttType == STT_STRING) { + switch (token) { + case '<': vRes.iIndex = stricmp(v0.strString, v1.strString) < 0; break; + case '>': vRes.iIndex = stricmp(v0.strString, v1.strString) > 0; break; + case '=': vRes.iIndex = stricmp(v0.strString, v1.strString) == 0; break; + case '!': vRes.iIndex = stricmp(v0.strString, v1.strString) != 0; break; + case '}': vRes.iIndex = stricmp(v0.strString, v1.strString) >= 0; break; + case '{': vRes.iIndex = stricmp(v0.strString, v1.strString) <= 0; break; + default: ASSERT(FALSE); + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } + } else { + vRes.sttType = STT_INDEX; + vRes.iIndex = 0; + } +} +%} + +/* BISON Declarations */ + +// we need to be reentrant! +%pure_parser + +%union { + value val; // for constants and expressions + arguments arg; // for function input arguments + ULONG ulFlags; // for declaration qualifiers + INDEX istType; // for types + CShellSymbol *pssSymbol; // for symbols + struct LValue lvLValue; + INDEX (*pPreFunc)(INDEX); // pre-set function for a variable + void (*pPostFunc)(INDEX); // post-set function for a variable +} + +%{ + extern int yylex(YYSTYPE *lvalp); +%} + +%token c_float +%token c_int +%token c_string +%token c_char + +%token identifier + +%token k_INDEX +%token k_FLOAT +%token k_CTString +%token k_void +%token k_const +%token k_user +%token k_persistent +%token k_extern +%token k_pre +%token k_post +%token k_help +%token k_if +%token k_else +%token k_else_if +%token SHL +%token SHR +%token EQ +%token NEQ +%token GEQ +%token LEQ +%token LOGAND +%token LOGOR +%token block_beg +%token block_end + +%type lvalue +%type expression +%type declaration_qualifiers +%type opt_string +%type type_specifier +%type parameter_list +%type parameter_list_opt +%type pre_func_opt +%type post_func_opt +%type argument_expression_list_opt +%type argument_expression_list + +%right '=' +%left LOGAND LOGOR +%left '&' '^' '|' +%left '<' '>' EQ NEQ LEQ GEQ +%left SHL +%left SHR +%left '-' '+' +%left '*' '/' '%' +%left TYPECAST +%left SIGN '!' + +%start program + +%% + +/*///////////////////////////////////////////////////////// + * Global structure of the source file. + */ +program +: declaration +| statements +; + +block +: block_beg statements block_end +| block_beg statements block_end +; + +statements +: /* null */ +| statement statements +; + +declaration_qualifiers +: /* nothing */ { + $$ = 0; +} +| declaration_qualifiers k_const { + $$ = $1 | SSF_CONSTANT; +} +| declaration_qualifiers k_user { + $$ = $1 | SSF_USER; +} +| declaration_qualifiers k_persistent { + $$ = $1 | SSF_PERSISTENT; +} +| declaration_qualifiers k_extern { + $$ = $1 | SSF_EXTERNAL; +} + +opt_string +: /* nothing */ { + $$.strString = ""; +} +| c_string { + // !!!! remove this option + //_pShell->ErrorF("Warning: symbol comments are not supported"); + $$.strString = $1.strString; +} + +type_specifier +: k_FLOAT { + $$ = ShellTypeNewFloat(); +} +| k_INDEX { + $$ = ShellTypeNewIndex(); +} +| k_CTString { + $$ = ShellTypeNewString(); +} +| k_void { + $$ = ShellTypeNewVoid(); +} + +pre_func_opt +: { + $$ = NULL; +} +| k_pre ':' identifier { + if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION + ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_INDEX + ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument + ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { + _pShell->ErrorF("'%s' must return 'INDEX' and take 'INDEX' as input", (const char *) $3->ss_strName); + } else { + void *pv = $3->ss_pvValue; + $$ = (INDEX(*)(INDEX))$3->ss_pvValue; + } +} + +post_func_opt +: { + $$ = NULL; +} +| k_post ':' identifier { + if (_shell_ast[$3->ss_istType].st_sttType!=STT_FUNCTION + ||_shell_ast[_shell_ast[$3->ss_istType].st_istBaseType].st_sttType!=STT_VOID + ||_shell_ast[$3->ss_istType].st_istFirstArgument!=_shell_ast[$3->ss_istType].st_istLastArgument + ||_shell_ast[_shell_ast[$3->ss_istType].st_istFirstArgument].st_sttType!=STT_INDEX) { + _pShell->ErrorF("'%s' must return 'void' and take 'INDEX' as input", (const char *) $3->ss_strName); + } else { + $$ = (void(*)(INDEX))$3->ss_pvValue; + } +} +; + +parameter_list_opt +: /* nothing */ { + $$ = ShellTypeNewFunction(0); + ShellTypeAddFunctionArgument($$, ShellTypeNewVoid()); +} +| parameter_list { + $$ = $1; +} +; + +parameter_list +: type_specifier { + $$ = ShellTypeNewFunction(0); + ShellTypeAddFunctionArgument($$, $1); +} +/*| identifier type_specifier { + $$ = ShellTypeNewFunction(0); + ShellTypeAddFunctionArgument($$, $2); +}*/ +| parameter_list ',' type_specifier { + $$ = $1; + ShellTypeAddFunctionArgument($$, $3); +} +/*| parameter_list ',' identifier type_specifier { + $$ = $1; + ShellTypeAddFunctionArgument($$, $4); +} */ +; + +declaration +: declaration_qualifiers type_specifier identifier pre_func_opt post_func_opt opt_string ';' { + Declaration($1, $2, *$3, $4, $5); + ShellTypeDelete($2); +} +| declaration_qualifiers type_specifier identifier '(' parameter_list_opt ')' opt_string ';' { + // take function from the parameter list and set its return type + _shell_ast[$5].st_istBaseType = $2; + $2 = $5; + // declare it + Declaration($1, $2, *$3, NULL, NULL); + // free the type (declaration will make a copy) + ShellTypeDelete($2); +} +| declaration_qualifiers type_specifier identifier '[' expression ']' pre_func_opt post_func_opt opt_string ';' { + if ($5.sttType!=STT_INDEX) { + _pShell->ErrorF("Array size is not integral"); + } + $2 = ShellTypeNewArray($2, $5.iIndex); + Declaration($1, $2, *$3, NULL, NULL); + ShellTypeDelete($2); +} + +statement +: ';' { + // dummy +} +| block { + // dummy +} +| expression ';' { + // print its value + if ($1.sttType == STT_VOID) { + NOTHING; + } else if ($1.sttType == STT_FLOAT) { + CPrintF("%g\n", $1.fFloat); + } else if ($1.sttType == STT_STRING) { + CPrintF("\"%s\"\n", $1.strString); + } else if ($1.sttType == STT_INDEX) { + CPrintF("%d(0x%08X)\n", $1.iIndex, $1.iIndex); + } else { + _pShell->ErrorF("Expression cannot be printed"); + } +} +| lvalue '=' expression ';' { + // if it is constant + if ($1.lv_pssSymbol->ss_ulFlags&SSF_CONSTANT) { + _pShell->ErrorF("Symbol '%s' is a constant", (const char *) $1.lv_pssSymbol->ss_strName); + // if it is not constant + } else { + // if it can be changed + if ($1.lv_pssSymbol->ss_pPreFunc==NULL || $1.lv_pssSymbol->ss_pPreFunc($1.lv_pvAddress)) { + // if floats + if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_FLOAT) { + // assign value + *(FLOAT*)$1.lv_pvAddress = $3.fFloat; + // if indices + } else if ($1.lv_sttType == STT_INDEX && $3.sttType==STT_INDEX) { + // assign value + *(INDEX*)$1.lv_pvAddress = $3.iIndex; + + // if strings + } else if ($1.lv_sttType == STT_STRING && $3.sttType==STT_STRING) { + // assign value + *(CTString*)$1.lv_pvAddress = $3.strString; + + // if assigning index to float + } else if ($1.lv_sttType == STT_FLOAT && $3.sttType==STT_INDEX) { + *(FLOAT*)$1.lv_pvAddress = $3.iIndex; + // otherwise + } else { + // error + _pShell->ErrorF("Cannot assign: different types"); + } + + // call post-change function + if ($1.lv_pssSymbol->ss_pPostFunc!=NULL) { + $1.lv_pssSymbol->ss_pPostFunc($1.lv_pvAddress); + } + } + } +} +| declaration_qualifiers type_specifier identifier '=' expression ';' { + Declaration($1, $2, *$3, NULL, NULL); + ShellTypeDelete($2); + + CShellSymbol &ssSymbol = *$3; + // if it is constant + if (ssSymbol.ss_ulFlags&SSF_CONSTANT) { + // error + _pShell->ErrorF("Symbol '%s' is a constant", (const char *) ssSymbol.ss_strName); + } + + // get symbol type + ShellTypeType stt = _shell_ast[$2].st_sttType; + + // if floats + if (stt == STT_FLOAT && $5.sttType==STT_FLOAT) { + // assign value + *(FLOAT*)ssSymbol.ss_pvValue = $5.fFloat; + // if indices + } else if (stt == STT_INDEX && $5.sttType==STT_INDEX) { + // assign value + *(INDEX*)ssSymbol.ss_pvValue = $5.iIndex; + // if strings + } else if (stt == STT_STRING && $5.sttType==STT_STRING) { + // assign value + *(CTString*)ssSymbol.ss_pvValue = $5.strString; + // !!!! remove this conversion + } else if (stt == STT_FLOAT && $5.sttType==STT_INDEX) { + _pShell->ErrorF("Warning: assigning INDEX to FLOAT!"); + *(FLOAT*)ssSymbol.ss_pvValue = $5.iIndex; + } else { + _pShell->ErrorF("Symbol '%s' and its initializer have different types", (const char *) ssSymbol.ss_strName); + } +} +| k_help identifier { +extern void PrintShellSymbolHelp(const CTString &strSymbol); + PrintShellSymbolHelp($2->ss_strName); +} +| k_help identifier '(' ')' { +extern void PrintShellSymbolHelp(const CTString &strSymbol); + PrintShellSymbolHelp($2->ss_strName); +} +| k_help identifier '[' ']' { +extern void PrintShellSymbolHelp(const CTString &strSymbol); + PrintShellSymbolHelp($2->ss_strName); +} +| k_if '(' expression ')' { + _bExecNextBlock = FALSE; + if ($3.sttType == STT_INDEX) { + _bExecNextBlock = $3.iIndex!=0; + } else if ($3.sttType == STT_FLOAT) { + _bExecNextBlock = $3.fFloat!=0; + } else { + _pShell->ErrorF("If expression is not integral"); + } + $1 = _bExecNextBlock; +} block { + _bExecNextElse = !$1; + _bExecNextBlock = TRUE; +} opt_else +; + +opt_else +: /* nothing */ + +| k_else_if '(' expression ')' { + if (_bExecNextElse) { + _bExecNextBlock = FALSE; + if ($3.sttType == STT_INDEX) { + _bExecNextBlock = $3.iIndex!=0; + } else if ($3.sttType == STT_FLOAT) { + _bExecNextBlock = $3.fFloat!=0; + } else { + _pShell->ErrorF("If expression is not integral"); + } + $1 = _bExecNextBlock; + } else { + _bExecNextBlock = FALSE; + _bExecNextElse = FALSE; + $1 = TRUE; + } +} block { + _bExecNextElse = !$1; + _bExecNextBlock = TRUE; +} opt_else + +| k_else { + _bExecNextBlock = _bExecNextElse; +} block { + _bExecNextBlock = TRUE; +} +; + +lvalue +: identifier { + CShellSymbol &ssSymbol = *$1; + const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; + + $$.lv_pssSymbol = &ssSymbol; + if (!ssSymbol.IsDeclared()) { + // error + _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); + fDummy = -666; + $$.lv_sttType = STT_VOID; + $$.lv_pvAddress = &fDummy; + // if the identifier is a float, int or string + } else if (stType.st_sttType==STT_FLOAT || stType.st_sttType==STT_INDEX || stType.st_sttType==STT_STRING) { + // get its value and type + $$.lv_sttType = stType.st_sttType; + $$.lv_pvAddress = ssSymbol.ss_pvValue; + // if the identifier is something else + } else { + // error + _pShell->ErrorF("'%s' doesn't have a value", (const char *) $1->ss_strName); + fDummy = -666.0f; + $$.lv_sttType = STT_VOID; + $$.lv_pvAddress = &fDummy; + } +} +| identifier '[' expression ']' { + CShellSymbol &ssSymbol = *$1; + const ShellType &stType = _shell_ast[ssSymbol.ss_istType]; + $$.lv_pssSymbol = &ssSymbol; + + int iIndex = 0; + // if subscript is index + if ($3.sttType==STT_INDEX) { + // get the index + iIndex = $3.iIndex; + // if subscript is not index + } else { + // error + _pShell->ErrorF("Array subscript is not integral"); + } + // if the symbol is array + if (stType.st_sttType==STT_ARRAY) { + const ShellType &stBase = _shell_ast[stType.st_istBaseType]; + // if it is float or int array + if (stBase.st_sttType==STT_FLOAT || stBase.st_sttType==STT_INDEX) { + // if the index is out of range + if (iIndex<0 || iIndex>=stType.st_ctArraySize) { + _pShell->ErrorF("Array member out of range"); + fDummy = -666.0f; + $$.lv_pvAddress = &fDummy; + } else { + // get its value and type + $$.lv_sttType = stBase.st_sttType; + $$.lv_pvAddress = (FLOAT*)ssSymbol.ss_pvValue+iIndex; + } + } + } else { + _pShell->ErrorF("'%s[]' doesn't have a value", (const char *) $1->ss_strName); + fDummy = -666.0f; + $$.lv_pvAddress = &fDummy; + } +} +; + +argument_expression_list_opt +: /* nothing */ { + $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); + ShellTypeAddFunctionArgument($$.istType, ShellTypeNewVoid()); + $$.ctBytes = 0; +} +| argument_expression_list { + $$ = $1; +} +; + +argument_expression_list +: expression { + $$.istType = ShellTypeNewFunction(ShellTypeNewVoid()); + ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($1.sttType)); + $$.ctBytes = PushExpression($1); +} +| argument_expression_list ',' expression { + $$ = $1; + ShellTypeAddFunctionArgument($$.istType, ShellTypeNewByType($3.sttType)); + $$.ctBytes += PushExpression($3); +} + +expression +: c_float { + $$.sttType = STT_FLOAT; + $$.fFloat = $1.fFloat; +} +| c_int { + $$.sttType = STT_INDEX; + $$.iIndex = $1.iIndex; +} +| c_string { + $$.sttType = STT_STRING; + $$.strString = $1.strString; +} +| lvalue { + // get its value + $$.sttType = $1.lv_sttType; + if ($1.lv_sttType==STT_VOID) { + NOTHING; + } else if ($1.lv_sttType==STT_FLOAT) { + $$.fFloat = *(FLOAT*)$1.lv_pvAddress; + } else if ($1.lv_sttType==STT_INDEX) { + $$.iIndex = *(INDEX*)$1.lv_pvAddress; + } else if ($1.lv_sttType==STT_STRING) { + $$.strString = (const char*)*(CTString*)$1.lv_pvAddress; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + _pShell->ErrorF("'%s' is of wrong type", (const char *) $1.lv_pssSymbol->ss_strName); + } +} +/* shift */ +| expression SHL expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex<<$3.iIndex; + } else { + _pShell->ErrorF("Wrong arguments for '<<'"); + $$.sttType = STT_INDEX; + $$.iIndex = -666; + } +} +| expression SHR expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex>>$3.iIndex; + } else { + _pShell->ErrorF("Wrong arguments for '>>'"); + $$.sttType = STT_INDEX; + $$.iIndex = -666; + } +} +/* bitwise operators */ +| expression '&' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'&' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex&$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +| expression '|' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'|' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex|$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +| expression '^' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'^' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex^$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +/* logical operators */ +| expression LOGAND expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'&&' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex&&$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +| expression LOGOR expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'||' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex||$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +/* addition */ +| expression '+' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat+$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex+$3.iIndex; + } else if ($1.sttType == STT_STRING) { + CTString &strNew = _shell_astrTempStrings.Push(); + strNew = CTString($1.strString)+$3.strString; + $$.strString = (const char*)strNew; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} +/* substraction */ +| expression '-' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat-$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex-$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +/* multiplication */ +| expression '*' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat*$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex*$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + +} +/* division */ +| expression '/' expression { + + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + $$.fFloat = $1.fFloat/$3.fFloat; + } else if ($1.sttType == STT_INDEX) { + if ($3.iIndex==0) { + _pShell->ErrorF("Division by zero!\n"); + $$.iIndex = 0; + } else { + $$.iIndex = $1.iIndex/$3.iIndex; + } + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + +} + +/* modulo */ +| expression '%' expression { + MatchTypes($1, $3); + + $$.sttType = $1.sttType; + if ($1.sttType == STT_FLOAT) { + _pShell->ErrorF("'%' is illegal for FLOAT values"); + } else if ($1.sttType == STT_INDEX) { + $$.iIndex = $1.iIndex%$3.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + +} + +/* comparisons */ +| expression '<' expression { + DoComparison($$, $1, $3, '<'); +} +| expression '>' expression { + DoComparison($$, $1, $3, '>'); +} +| expression EQ expression { + DoComparison($$, $1, $3, '='); +} +| expression NEQ expression { + DoComparison($$, $1, $3, '!'); +} +| expression GEQ expression { + DoComparison($$, $1, $3, '}'); +} +| expression LEQ expression { + DoComparison($$, $1, $3, '{'); +} + +// unary minus + +| '-' expression %prec SIGN { + $$.sttType = $2.sttType; + if ($2.sttType == STT_FLOAT) { + $$.fFloat = -$2.fFloat; + } else if ($2.sttType == STT_INDEX) { + $$.iIndex = -$2.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +// unary plus + +| '+' expression %prec SIGN { + $$.sttType = $2.sttType; + if ($2.sttType == STT_FLOAT) { + $$.fFloat = $2.fFloat; + } else if ($2.sttType == STT_INDEX) { + $$.iIndex = $2.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +| '!' expression %prec SIGN { + $$.sttType = $2.sttType; + if ($2.sttType == STT_FLOAT) { + _pShell->ErrorF("'!' is illegal for FLOAT values"); + $$.fFloat = $2.fFloat; + } else if ($2.sttType == STT_INDEX) { + $$.iIndex = !$2.iIndex; + } else { + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } +} + +| '(' k_FLOAT ')' expression %prec TYPECAST { + $$.sttType = STT_FLOAT; + if ($4.sttType == STT_FLOAT) { + $$.fFloat = $4.fFloat; + } else if ($4.sttType == STT_INDEX) { + $$.fFloat = FLOAT($4.iIndex); + } else if ($4.sttType == STT_STRING) { + $$.fFloat = atof($4.strString); + } else { + _pShell->ErrorF("Cannot convert to FLOAT"); + $$.sttType = STT_VOID; + } +} + +| '(' k_INDEX ')' expression %prec TYPECAST { + $$.sttType = STT_INDEX; + if ($4.sttType == STT_FLOAT) { + $$.iIndex = INDEX($4.fFloat); + } else if ($4.sttType == STT_INDEX) { + $$.iIndex = $4.iIndex; + } else if ($4.sttType == STT_STRING) { + $$.iIndex = atol($4.strString); + } else { + _pShell->ErrorF("Cannot convert to INDEX"); + $$.sttType = STT_VOID; + } +} + +| '(' k_CTString ')' expression %prec TYPECAST { + CTString &strNew = _shell_astrTempStrings.Push(); + $$.sttType = STT_STRING; + if ($4.sttType == STT_FLOAT) { + strNew.PrintF("%g", $4.fFloat); + } else if ($4.sttType == STT_INDEX) { + strNew.PrintF("%d", $4.iIndex); + } else if ($4.sttType == STT_STRING) { + strNew = $4.strString; + } else { + _pShell->ErrorF("Cannot convert to CTString"); + $$.sttType = STT_VOID; + } + $$.strString = (const char*)strNew; +} + +// function call +| identifier '(' argument_expression_list_opt ')' { + // if the identifier is not declared + if (!$1->IsDeclared()) { + // error + _pShell->ErrorF("Identifier '%s' is not declared", (const char *) $1->ss_strName); + // if the identifier is declared + } else { + // get its type + ShellType &stFunc = _shell_ast[$1->ss_istType]; + + // if the identifier is a function + if (stFunc.st_sttType==STT_FUNCTION) { + // determine result type + ShellType &stResult = _shell_ast[stFunc.st_istBaseType]; + // match argument list result to that result + _shell_ast[_shell_ast[$3.istType].st_istBaseType].st_sttType = stResult.st_sttType; + // if types are same + if (ShellTypeIsSame($3.istType, $1->ss_istType)) { + bool callfunc = true; + +// !!! FIXME: maybe just dump the win32 codepath here? This will break on Win64, and maybe break on different compilers/compiler versions, etc. +#ifdef PLATFORM_WIN32 + #define CALLPARAMS + #define FUNCSIG void + #define PUSHPARAMS memcpy(_alloca($3.ctBytes), _ubStack+_iStack-$3.ctBytes, $3.ctBytes); +#else + // This is possibly more portable, but no less scary than the alloca hack. + #define MAXSCRIPTFUNCARGS 5 + void *ARG[MAXSCRIPTFUNCARGS]; + if (($3.ctBytes > sizeof (ARG))) + { + _pShell->ErrorF("Function '%s' has too many arguments!", (const char *) $1->ss_strName); + callfunc = false; + } + else + { + memcpy(ARG, _ubStack+_iStack-$3.ctBytes, $3.ctBytes); + memset(((char *) ARG) + $3.ctBytes, '\0', sizeof (ARG) - $3.ctBytes); + } + #define PUSHPARAMS + #define FUNCSIG void*, void*, void*, void*, void* + #define CALLPARAMS ARG[0], ARG[1], ARG[2], ARG[3], ARG[4] +#endif + + if (callfunc) { + // if void + if (stResult.st_sttType==STT_VOID) { + // just call the function + $$.sttType = STT_VOID; + PUSHPARAMS; + ((void (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + // if index + } else if (stResult.st_sttType==STT_INDEX) { + // call the function and return result + $$.sttType = STT_INDEX; + PUSHPARAMS; + $$.iIndex = ((INDEX (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + // if float + } else if (stResult.st_sttType==STT_FLOAT) { + // call the function and return result + $$.sttType = STT_FLOAT; + PUSHPARAMS; + $$.fFloat = ((FLOAT (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + // if string + } else if (stResult.st_sttType==STT_STRING) { + // call the function and return result + $$.sttType = STT_STRING; + CTString &strNew = _shell_astrTempStrings.Push(); + PUSHPARAMS; + strNew = ((CTString (*)(FUNCSIG))$1->ss_pvValue)(CALLPARAMS); + $$.strString = (const char*)strNew; + } else { + ASSERT(FALSE); + $$.sttType = STT_FLOAT; + $$.fFloat = -666.0f; + } + } + // if types are different + } else { + // error + $$.sttType = STT_VOID; + _pShell->ErrorF("Wrong parameters for '%s'", (const char *) $1->ss_strName); + } + // if the identifier is something else + } else { + // error + $$.sttType = STT_VOID; + _pShell->ErrorF("Can't call '%s'", (const char *) $1->ss_strName); + } + } + + // pop arguments and free type info + _iStack-=$3.ctBytes; + ShellTypeDelete($3.istType); +} +// brackets +| '(' expression ')' { + $$ = $2; +} +; + +%% diff --git a/SamTSE/Sources/Engine/Base/Priority.inl b/SamTSE/Sources/Engine/Base/Priority.inl index c75fe6fe..73166637 100644 --- a/SamTSE/Sources/Engine/Base/Priority.inl +++ b/SamTSE/Sources/Engine/Base/Priority.inl @@ -1,42 +1,56 @@ - -#ifndef SE_INCL_PRIORITY_INL -#define SE_INCL_PRIORITY_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -class CSetPriority { -public: -#ifdef PLATFORM_WIN32 - DWORD sp_dwProcessOld; - int sp_iThreadOld; - HANDLE sp_hThread; - HANDLE sp_hProcess; - CSetPriority(DWORD dwProcess, int iThread) - { - sp_hProcess = GetCurrentProcess(); - sp_hThread = GetCurrentThread(); - - sp_dwProcessOld = GetPriorityClass(sp_hProcess); - sp_iThreadOld = GetThreadPriority(sp_hThread); - BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, dwProcess); - BOOL bSuccessThread = SetThreadPriority(sp_hThread, iThread); - ASSERT(bSuccessProcess && bSuccessThread); - } - ~CSetPriority(void) - { - BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, sp_dwProcessOld); - BOOL bSuccessThread = SetThreadPriority(sp_hThread, sp_iThreadOld); - ASSERT(bSuccessProcess && bSuccessThread); - } - -#else - - CSetPriority(DWORD dwProcess, int iThread) { STUBBED(""); } - ~CSetPriority(void) { STUBBED(""); } - -#endif -}; - -#endif /* include-once blocker. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_PRIORITY_INL +#define SE_INCL_PRIORITY_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +class CSetPriority { +public: +#ifdef PLATFORM_WIN32 + DWORD sp_dwProcessOld; + int sp_iThreadOld; + HANDLE sp_hThread; + HANDLE sp_hProcess; + CSetPriority(DWORD dwProcess, int iThread) + { + sp_hProcess = GetCurrentProcess(); + sp_hThread = GetCurrentThread(); + + sp_dwProcessOld = GetPriorityClass(sp_hProcess); + sp_iThreadOld = GetThreadPriority(sp_hThread); + BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, dwProcess); + BOOL bSuccessThread = SetThreadPriority(sp_hThread, iThread); + ASSERT(bSuccessProcess && bSuccessThread); + } + ~CSetPriority(void) + { + BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, sp_dwProcessOld); + BOOL bSuccessThread = SetThreadPriority(sp_hThread, sp_iThreadOld); + ASSERT(bSuccessProcess && bSuccessThread); + } + +#else + + CSetPriority(DWORD dwProcess, int iThread) { STUBBED(""); } + ~CSetPriority(void) { STUBBED(""); } + +#endif +}; + +#endif /* include-once blocker. */ + diff --git a/SamTSE/Sources/Engine/Base/SDL/SDLEvents.cpp b/SamTSE/Sources/Engine/Base/SDL/SDLEvents.cpp index 9d69ef1e..d9bd2bb9 100644 --- a/SamTSE/Sources/Engine/Base/SDL/SDLEvents.cpp +++ b/SamTSE/Sources/Engine/Base/SDL/SDLEvents.cpp @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include diff --git a/SamTSE/Sources/Engine/Base/SDL/SDLEvents.h b/SamTSE/Sources/Engine/Base/SDL/SDLEvents.h index cdc7a816..297af56d 100644 --- a/SamTSE/Sources/Engine/Base/SDL/SDLEvents.h +++ b/SamTSE/Sources/Engine/Base/SDL/SDLEvents.h @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef SE_INCL_SDLEVENTS_H #define SE_INCL_SDLEVENTS_H diff --git a/SamTSE/Sources/Engine/Base/SDL/SDLInput.cpp b/SamTSE/Sources/Engine/Base/SDL/SDLInput.cpp index d8bba524..703786f6 100644 --- a/SamTSE/Sources/Engine/Base/SDL/SDLInput.cpp +++ b/SamTSE/Sources/Engine/Base/SDL/SDLInput.cpp @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* rcg10072001 Moved stuff into this file. */ diff --git a/SamTSE/Sources/Engine/Base/SDL/SDLSynchronization.cpp b/SamTSE/Sources/Engine/Base/SDL/SDLSynchronization.cpp index a4c91f11..3dd06b1d 100644 --- a/SamTSE/Sources/Engine/Base/SDL/SDLSynchronization.cpp +++ b/SamTSE/Sources/Engine/Base/SDL/SDLSynchronization.cpp @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "SDL.h" #include "SDL_thread.h" diff --git a/SamTSE/Sources/Engine/Base/SDL/SDLTimer.cpp b/SamTSE/Sources/Engine/Base/SDL/SDLTimer.cpp index ab5a1b28..97c86452 100644 --- a/SamTSE/Sources/Engine/Base/SDL/SDLTimer.cpp +++ b/SamTSE/Sources/Engine/Base/SDL/SDLTimer.cpp @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* rcg10072001 Moved stuff into this file. */ #define __STDC_LIMIT_MACROS 1 diff --git a/SamTSE/Sources/Engine/Base/Scanner.l b/SamTSE/Sources/Engine/Base/Scanner.l index 4444464a..e4411d0e 100644 --- a/SamTSE/Sources/Engine/Base/Scanner.l +++ b/SamTSE/Sources/Engine/Base/Scanner.l @@ -1,280 +1,295 @@ -%{ -#include "ParsingSymbols.h" -#include "Parser.h" - -#include -#include -#include -#include -#include - -#include - -#define YY_DECL int yylex (YYSTYPE *lvalp) -#define yylval (*lvalp) - -#ifdef __cplusplus -extern "C" { int yywrap(void); } -#endif - -int yywrap(void) -{ - // no more bufers - return 1; -}; - -static int _iBlockDepth = 0; -static int _iDummyDepth = 0; -static CTString _strCmd = ""; // currently parsed command -static int _ctCmdParam = 1; // current parameter index -static BOOL _bCmdParamCountErrorReported = FALSE; - -void TranscriptEsc(CTString &str) -{ - char *pchSrc = (char *)(const char *)str; - char *pchDst = (char *)(const char *)str; - // if quoted - if (pchDst[0] == '"') { - int len = strlen(pchDst); - pchDst[len-1] = 0; - memmove(pchDst, pchDst+1, len-1); - } - for (;;pchSrc++, pchDst++) { - if (*pchSrc==0) { - break; - } - if (*pchSrc!='\\') { - *pchDst = *pchSrc; - continue; - } - pchSrc++; - switch(*pchSrc) { - case 'n': *pchDst = 10; break; - case 'r': *pchDst = 13; break; - default: *pchDst = *pchSrc; break; - } - } - *pchDst=0; -} - -%} - -%x COMMENT -%x DUMMYBLOCK -%x INCLUDE -%x COMMAND - -DIGIT [0-9] -HEXDIGIT [0-9A-Fa-f] -IDENTIFIERFIRST [A-Za-z_] -IDENTIFIEROTHER [A-Za-z0-9_] -DOUBLEQUOTE \" -STRINGCONTENT ([^\"]|(\\\")) -CHARCONTENT ([^\']|(\\\')) -NONEXP_FLT ({DIGIT}+"."{DIGIT}*) -EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) - -PARAMCONTENT ([^\ \n\";]|(\\\ )) - -%% - - /*\0 yyterminate();*/ - - /* Include file parsing. */ -"include" BEGIN(INCLUDE); - -[ \t]*"\"" /* eat the whitespace until first quote */ -[^"\""]*"\"" { /* get the include file name until second quote */ - if (ShellGetBufferStackDepth() >= SHELL_MAX_INCLUDE_LEVEL) { - _pShell->ErrorF("Script files nested too deeply"); - } - char strFileName[256]; - strcpy(strFileName, yytext); - strFileName[strlen(strFileName)-1] = 0; - - CTString strIncludeFile; - try { - strIncludeFile.Load_t(CTString(strFileName)); - ShellPushBuffer(strFileName, strIncludeFile, FALSE); - - } catch (const char *strError) { - _pShell->ErrorF("Cannot load script file '%s': %s", yytext, strError); - } - BEGIN(INITIAL); -} -. { /* something unrecognized inside include statement */ - _pShell->ErrorF("Wrong syntax for include statement"); - BEGIN(INITIAL); -} - - /* command parsing */ -{PARAMCONTENT}*|"\""{STRINGCONTENT}*"\"" { // for each parameter - _ctCmdParam++; - CTString strParam = yytext; - TranscriptEsc(strParam); - // insert the parameter in the command string - CTString strParamNo = CTString(1, "%%%d", _ctCmdParam); - if (strParam.FindSubstr(strParamNo)!=-1) { - _pShell->ErrorF("Parameter substitution recursion detected!"); - } else { - INDEX ctFound; - for(ctFound=0;; ctFound++) { - if (!_strCmd.ReplaceSubstr(strParamNo, strParam)) { - break; - } - } - // if not found and parameter count error not reported yet - if (ctFound==0 && !_bCmdParamCountErrorReported) { - // report error - _bCmdParamCountErrorReported = TRUE; - _pShell->ErrorF("Too many parameters for command expansion"); - } - } -} -\n|; { - // at the end of the command - - // switch to the new input buffer with that command - ShellPushBuffer(ShellGetBufferName(), _strCmd, FALSE); - BEGIN(INITIAL); -} - -<> { - if (ShellPopBuffer()) { - yyterminate(); - } -} - - /* special data types */ -"FLOAT" { return(k_FLOAT);} -"INDEX" { return(k_INDEX);} -"CTString" { return(k_CTString);} - - /* keywords */ -"void" { return(k_void); } -"const" { return(k_const); } -"user" { return(k_user); } -"persistent" { return(k_persistent); } -"extern" { return(k_extern); } -"pre" { return(k_pre); } -"post" { return(k_post); } -"help" { return(k_help); } -"if" { return(k_if); } -"else" { return(k_else); } -"else"" "*"if" { return(k_else_if); } - -"<=" { return (LEQ); } -">=" { return (GEQ); } -"==" { return (EQ); } -"!=" { return (NEQ); } - -">>" { return (SHR); } -"<<" { return (SHL); } - -"&&" { return (LOGAND); } -"||" { return (LOGOR); } - - /* single character operators and punctuations */ -";"|"("|")"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { - return(yytext[0]);} - - /* constants */ -{DIGIT}+ { yylval.val.iIndex = atoi(yytext); return(c_int); } -"0x"{HEXDIGIT}+ { yylval.val.iIndex = strtoul(yytext+2, NULL, 16); return(c_int); } -{NONEXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } -{EXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } -"\""{STRINGCONTENT}*"\"" { - CTString &strNew = _shell_astrTempStrings.Push(); - // remove double-quotes - strNew = yytext; - // parse escape symbols and remove double quotes - TranscriptEsc(strNew); - yylval.val.strString = (const char*)strNew; - return(c_string); -} -"'"{CHARCONTENT}"'" { return(c_char); } - - /* identifier */ -{IDENTIFIERFIRST}{IDENTIFIEROTHER}* { - // get the symbol - yylval.pssSymbol = _pShell->GetSymbol(yytext, FALSE); - BOOL bCommand = FALSE; - // if it is string - if (_shell_ast[yylval.pssSymbol->ss_istType].st_sttType==STT_STRING) { - // get the value - CTString str = *(CTString*)yylval.pssSymbol->ss_pvValue; - // if the value tells that it is a command - if (str.RemovePrefix("!command ")) { - // parse the command - bCommand = TRUE; - _strCmd = str; - _ctCmdParam = 0; - _bCmdParamCountErrorReported = FALSE; - BEGIN(COMMAND); - } - } - // normally, just return the identifier - if (!bCommand) { - return(identifier); - } -} -${IDENTIFIERFIRST}{IDENTIFIEROTHER}* { // special case of identifier, used to bypass command parsing - // get the symbol - yylval.pssSymbol = _pShell->GetSymbol(yytext+1, FALSE); - return(identifier); -} - - /* eat up or execute blocks */ -"{" { - _iBlockDepth++; - if (!_bExecNextBlock) { - _iDummyDepth++; - BEGIN(DUMMYBLOCK); - } - return block_beg; -} - -"}" { - _iBlockDepth--; - if (_iBlockDepth<0) { - _pShell->ErrorF("Mismatched '}'"); - } - return block_end; -} -"{" { - _iBlockDepth++; - _iDummyDepth++; -} -"}" { - _iBlockDepth--; - _iDummyDepth--; - if (_iDummyDepth==0) { - BEGIN(INITIAL); - return block_end; - } -} -. {} - - /* eat up comments */ -"/*" { BEGIN(COMMENT); } -"*/" { BEGIN(INITIAL); } -. {} -"//"[^\n]*\n { ShellCountOneLine(); } - - - /* eat up whitespace */ -[ \t]+ { -} - /* eat up linefeeds and count lines in all conditions */ -<*>\n { - ShellCountOneLine(); -} - - /* for all unrecognized characters */ -. { - // report an error - _pShell->ErrorF("Unrecognized character '%c' (ASCII 0x%02x)", yytext[0], yytext[0] ); -} - -%% - +%{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include "ParsingSymbols.h" +#include "Parser.h" + +#include +#include +#include +#include +#include + +#include + +#define YY_DECL int yylex (YYSTYPE *lvalp) +#define yylval (*lvalp) + +#ifdef __cplusplus +extern "C" { int yywrap(void); } +#endif + +int yywrap(void) +{ + // no more bufers + return 1; +}; + +static int _iBlockDepth = 0; +static int _iDummyDepth = 0; +static CTString _strCmd = ""; // currently parsed command +static int _ctCmdParam = 1; // current parameter index +static BOOL _bCmdParamCountErrorReported = FALSE; + +void TranscriptEsc(CTString &str) +{ + char *pchSrc = (char *)(const char *)str; + char *pchDst = (char *)(const char *)str; + // if quoted + if (pchDst[0] == '"') { + int len = strlen(pchDst); + pchDst[len-1] = 0; + memmove(pchDst, pchDst+1, len-1); + } + for (;;pchSrc++, pchDst++) { + if (*pchSrc==0) { + break; + } + if (*pchSrc!='\\') { + *pchDst = *pchSrc; + continue; + } + pchSrc++; + switch(*pchSrc) { + case 'n': *pchDst = 10; break; + case 'r': *pchDst = 13; break; + default: *pchDst = *pchSrc; break; + } + } + *pchDst=0; +} + +%} + +%x COMMENT +%x DUMMYBLOCK +%x INCLUDE +%x COMMAND + +DIGIT [0-9] +HEXDIGIT [0-9A-Fa-f] +IDENTIFIERFIRST [A-Za-z_] +IDENTIFIEROTHER [A-Za-z0-9_] +DOUBLEQUOTE \" +STRINGCONTENT ([^\"]|(\\\")) +CHARCONTENT ([^\']|(\\\')) +NONEXP_FLT ({DIGIT}+"."{DIGIT}*) +EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) + +PARAMCONTENT ([^\ \n\";]|(\\\ )) + +%% + + /*\0 yyterminate();*/ + + /* Include file parsing. */ +"include" BEGIN(INCLUDE); + +[ \t]*"\"" /* eat the whitespace until first quote */ +[^"\""]*"\"" { /* get the include file name until second quote */ + if (ShellGetBufferStackDepth() >= SHELL_MAX_INCLUDE_LEVEL) { + _pShell->ErrorF("Script files nested too deeply"); + } + char strFileName[256]; + strcpy(strFileName, yytext); + strFileName[strlen(strFileName)-1] = 0; + + CTString strIncludeFile; + try { + strIncludeFile.Load_t(CTString(strFileName)); + ShellPushBuffer(strFileName, strIncludeFile, FALSE); + + } catch (const char *strError) { + _pShell->ErrorF("Cannot load script file '%s': %s", yytext, strError); + } + BEGIN(INITIAL); +} +. { /* something unrecognized inside include statement */ + _pShell->ErrorF("Wrong syntax for include statement"); + BEGIN(INITIAL); +} + + /* command parsing */ +{PARAMCONTENT}*|"\""{STRINGCONTENT}*"\"" { // for each parameter + _ctCmdParam++; + CTString strParam = yytext; + TranscriptEsc(strParam); + // insert the parameter in the command string + CTString strParamNo = CTString(1, "%%%d", _ctCmdParam); + if (strParam.FindSubstr(strParamNo)!=-1) { + _pShell->ErrorF("Parameter substitution recursion detected!"); + } else { + INDEX ctFound; + for(ctFound=0;; ctFound++) { + if (!_strCmd.ReplaceSubstr(strParamNo, strParam)) { + break; + } + } + // if not found and parameter count error not reported yet + if (ctFound==0 && !_bCmdParamCountErrorReported) { + // report error + _bCmdParamCountErrorReported = TRUE; + _pShell->ErrorF("Too many parameters for command expansion"); + } + } +} +\n|; { + // at the end of the command + + // switch to the new input buffer with that command + ShellPushBuffer(ShellGetBufferName(), _strCmd, FALSE); + BEGIN(INITIAL); +} + +<> { + if (ShellPopBuffer()) { + yyterminate(); + } +} + + /* special data types */ +"FLOAT" { return(k_FLOAT);} +"INDEX" { return(k_INDEX);} +"CTString" { return(k_CTString);} + + /* keywords */ +"void" { return(k_void); } +"const" { return(k_const); } +"user" { return(k_user); } +"persistent" { return(k_persistent); } +"extern" { return(k_extern); } +"pre" { return(k_pre); } +"post" { return(k_post); } +"help" { return(k_help); } +"if" { return(k_if); } +"else" { return(k_else); } +"else"" "*"if" { return(k_else_if); } + +"<=" { return (LEQ); } +">=" { return (GEQ); } +"==" { return (EQ); } +"!=" { return (NEQ); } + +">>" { return (SHR); } +"<<" { return (SHL); } + +"&&" { return (LOGAND); } +"||" { return (LOGOR); } + + /* single character operators and punctuations */ +";"|"("|")"|"="|"+"|"-"|"<"|">"|"!"|"|"|"&"|"*"|"/"|"%"|"^"|"["|"]"|":"|","|"."|"?"|"~" { + return(yytext[0]);} + + /* constants */ +{DIGIT}+ { yylval.val.iIndex = atoi(yytext); return(c_int); } +"0x"{HEXDIGIT}+ { yylval.val.iIndex = strtoul(yytext+2, NULL, 16); return(c_int); } +{NONEXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } +{EXP_FLT}("f"|"F")? { yylval.val.fFloat = (float) atof(yytext); return(c_float); } +"\""{STRINGCONTENT}*"\"" { + CTString &strNew = _shell_astrTempStrings.Push(); + // remove double-quotes + strNew = yytext; + // parse escape symbols and remove double quotes + TranscriptEsc(strNew); + yylval.val.strString = (const char*)strNew; + return(c_string); +} +"'"{CHARCONTENT}"'" { return(c_char); } + + /* identifier */ +{IDENTIFIERFIRST}{IDENTIFIEROTHER}* { + // get the symbol + yylval.pssSymbol = _pShell->GetSymbol(yytext, FALSE); + BOOL bCommand = FALSE; + // if it is string + if (_shell_ast[yylval.pssSymbol->ss_istType].st_sttType==STT_STRING) { + // get the value + CTString str = *(CTString*)yylval.pssSymbol->ss_pvValue; + // if the value tells that it is a command + if (str.RemovePrefix("!command ")) { + // parse the command + bCommand = TRUE; + _strCmd = str; + _ctCmdParam = 0; + _bCmdParamCountErrorReported = FALSE; + BEGIN(COMMAND); + } + } + // normally, just return the identifier + if (!bCommand) { + return(identifier); + } +} +${IDENTIFIERFIRST}{IDENTIFIEROTHER}* { // special case of identifier, used to bypass command parsing + // get the symbol + yylval.pssSymbol = _pShell->GetSymbol(yytext+1, FALSE); + return(identifier); +} + + /* eat up or execute blocks */ +"{" { + _iBlockDepth++; + if (!_bExecNextBlock) { + _iDummyDepth++; + BEGIN(DUMMYBLOCK); + } + return block_beg; +} + +"}" { + _iBlockDepth--; + if (_iBlockDepth<0) { + _pShell->ErrorF("Mismatched '}'"); + } + return block_end; +} +"{" { + _iBlockDepth++; + _iDummyDepth++; +} +"}" { + _iBlockDepth--; + _iDummyDepth--; + if (_iDummyDepth==0) { + BEGIN(INITIAL); + return block_end; + } +} +. {} + + /* eat up comments */ +"/*" { BEGIN(COMMENT); } +"*/" { BEGIN(INITIAL); } +. {} +"//"[^\n]*\n { ShellCountOneLine(); } + + + /* eat up whitespace */ +[ \t]+ { +} + /* eat up linefeeds and count lines in all conditions */ +<*>\n { + ShellCountOneLine(); +} + + /* for all unrecognized characters */ +. { + // report an error + _pShell->ErrorF("Unrecognized character '%c' (ASCII 0x%02x)", yytext[0], yytext[0] ); +} + +%% + diff --git a/SamTSE/Sources/Engine/Base/Timer.inl b/SamTSE/Sources/Engine/Base/Timer.inl index d9c28de1..13a87523 100644 --- a/SamTSE/Sources/Engine/Base/Timer.inl +++ b/SamTSE/Sources/Engine/Base/Timer.inl @@ -1,57 +1,72 @@ -#ifndef SE_INCL_TIMER_INL -#define SE_INCL_TIMER_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -/* Constructor from seconds. */ -inline CTimerValue::CTimerValue(double fSeconds) -{ - tv_llValue = (__int64) (fSeconds*_pTimer->tm_llPerformanceCounterFrequency); -} -/* Clear timer value (set it to zero). */ -inline void CTimerValue::Clear(void) -{ - tv_llValue = 0; -} -/* Addition. */ -inline CTimerValue &CTimerValue::operator+=(const CTimerValue &tvOther) { - tv_llValue+=tvOther.tv_llValue; - return *this; -}; -inline CTimerValue CTimerValue::operator+(const CTimerValue &tvOther) const { - return CTimerValue(*this)+=tvOther; -}; -/* Substraction. */ -inline CTimerValue &CTimerValue::operator-=(const CTimerValue &tvOther) { - tv_llValue-=tvOther.tv_llValue; - return *this; -}; -inline CTimerValue CTimerValue::operator-(const CTimerValue &tvOther) const { - return CTimerValue(*this)-=tvOther; -}; -/* Comparisons. */ -inline BOOL CTimerValue::operator<(const CTimerValue &tvOther) const { - return tv_llValue(const CTimerValue &tvOther) const { - return tv_llValue>tvOther.tv_llValue; -} -inline BOOL CTimerValue::operator<=(const CTimerValue &tvOther) const { - return tv_llValue<=tvOther.tv_llValue; -} -inline BOOL CTimerValue::operator>=(const CTimerValue &tvOther) const { - return tv_llValue>=tvOther.tv_llValue; -} -/* Get the timer value in seconds. - use for time spans only! */ -inline double CTimerValue::GetSeconds(void) { - return ((double)tv_llValue)/_pTimer->tm_llPerformanceCounterFrequency; -}; -/* Get the timer value in milliseconds as integral value. */ -inline __int64 CTimerValue::GetMilliseconds(void) { - return tv_llValue/(_pTimer->tm_llPerformanceCounterFrequency/1000); -}; - - -#endif /* include-once check. */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_TIMER_INL +#define SE_INCL_TIMER_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +/* Constructor from seconds. */ +inline CTimerValue::CTimerValue(double fSeconds) +{ + tv_llValue = (__int64) (fSeconds*_pTimer->tm_llPerformanceCounterFrequency); +} +/* Clear timer value (set it to zero). */ +inline void CTimerValue::Clear(void) +{ + tv_llValue = 0; +} +/* Addition. */ +inline CTimerValue &CTimerValue::operator+=(const CTimerValue &tvOther) { + tv_llValue+=tvOther.tv_llValue; + return *this; +}; +inline CTimerValue CTimerValue::operator+(const CTimerValue &tvOther) const { + return CTimerValue(*this)+=tvOther; +}; +/* Substraction. */ +inline CTimerValue &CTimerValue::operator-=(const CTimerValue &tvOther) { + tv_llValue-=tvOther.tv_llValue; + return *this; +}; +inline CTimerValue CTimerValue::operator-(const CTimerValue &tvOther) const { + return CTimerValue(*this)-=tvOther; +}; +/* Comparisons. */ +inline BOOL CTimerValue::operator<(const CTimerValue &tvOther) const { + return tv_llValue(const CTimerValue &tvOther) const { + return tv_llValue>tvOther.tv_llValue; +} +inline BOOL CTimerValue::operator<=(const CTimerValue &tvOther) const { + return tv_llValue<=tvOther.tv_llValue; +} +inline BOOL CTimerValue::operator>=(const CTimerValue &tvOther) const { + return tv_llValue>=tvOther.tv_llValue; +} +/* Get the timer value in seconds. - use for time spans only! */ +inline double CTimerValue::GetSeconds(void) { + return ((double)tv_llValue)/_pTimer->tm_llPerformanceCounterFrequency; +}; +/* Get the timer value in milliseconds as integral value. */ +inline __int64 CTimerValue::GetMilliseconds(void) { + return tv_llValue/(_pTimer->tm_llPerformanceCounterFrequency/1000); +}; + + +#endif /* include-once check. */ + diff --git a/SamTSE/Sources/Engine/Base/Unix/UnixDynamicLoader.cpp b/SamTSE/Sources/Engine/Base/Unix/UnixDynamicLoader.cpp index 301ec82a..11fa4ed5 100644 --- a/SamTSE/Sources/Engine/Base/Unix/UnixDynamicLoader.cpp +++ b/SamTSE/Sources/Engine/Base/Unix/UnixDynamicLoader.cpp @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* rcg10072001 Implemented. */ diff --git a/SamTSE/Sources/Engine/Base/Unix/UnixFileSystem.cpp b/SamTSE/Sources/Engine/Base/Unix/UnixFileSystem.cpp index 6bf7d995..d8656353 100644 --- a/SamTSE/Sources/Engine/Base/Unix/UnixFileSystem.cpp +++ b/SamTSE/Sources/Engine/Base/Unix/UnixFileSystem.cpp @@ -1,4 +1,17 @@ -/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* rcg10142001 Implemented. */ diff --git a/SamTSE/Sources/Engine/Base/Unix/UnixSynchronization.h b/SamTSE/Sources/Engine/Base/Unix/UnixSynchronization.h index 41602829..d525841a 100644 --- a/SamTSE/Sources/Engine/Base/Unix/UnixSynchronization.h +++ b/SamTSE/Sources/Engine/Base/Unix/UnixSynchronization.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #define WAIT_OBJECT_0 0 diff --git a/SamTSE/Sources/Engine/Base/iconvlite.cpp b/SamTSE/Sources/Engine/Base/iconvlite.cpp index f70cfdfc..dbb89733 100644 --- a/SamTSE/Sources/Engine/Base/iconvlite.cpp +++ b/SamTSE/Sources/Engine/Base/iconvlite.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "Engine/StdH.h" #include "iconvlite.h" diff --git a/SamTSE/Sources/Engine/Base/iconvlite.h b/SamTSE/Sources/Engine/Base/iconvlite.h index 90a61075..aa1cf166 100644 --- a/SamTSE/Sources/Engine/Base/iconvlite.h +++ b/SamTSE/Sources/Engine/Base/iconvlite.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* iconvlite.h Iconv Lite diff --git a/SamTSE/Sources/Engine/GameAgent/MSLegacy.h b/SamTSE/Sources/Engine/GameAgent/MSLegacy.h index 21ced210..474a970b 100644 --- a/SamTSE/Sources/Engine/GameAgent/MSLegacy.h +++ b/SamTSE/Sources/Engine/GameAgent/MSLegacy.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2004-2008 Luigi Auriemma. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* GSMSALG 0.3.3 by Luigi Auriemma @@ -55,21 +70,6 @@ EXAMPLE LICENSE ======= - Copyright 2004,2005,2006,2007,2008 Luigi Auriemma - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.gnu.org/licenses/gpl.txt */ diff --git a/SamTSE/Sources/Engine/Graphics/Gfx_OpenGL.h b/SamTSE/Sources/Engine/Graphics/Gfx_OpenGL.h index 9a26d847..2bc76eb5 100644 --- a/SamTSE/Sources/Engine/Graphics/Gfx_OpenGL.h +++ b/SamTSE/Sources/Engine/Graphics/Gfx_OpenGL.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* TODO External vars */ extern int aiAttribList[]; diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h index de2d708a..079a3e69 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckFragSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char OcclusionCheckFrag_Spirv[] = { diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h index 69ad4c53..8c35dc48 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/OcclusionCheckVertSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char OcclusionCheckVert_Spirv[] = { diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h index 4b6bb50c..bd72ba15 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedAlphaFragSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char TexturedAlphaFrag_Spirv[] = { diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h index 0720e152..342d2346 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedFragSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char TexturedFrag_Spirv[] = { diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h index daf9484a..479c67ce 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/Compiled/TexturedVertSpv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once unsigned char TexturedVert_Spirv[] = { diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMain.h b/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMain.h index f786e89f..369ee8e0 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMain.h +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMain.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #pragma once #ifndef SE_INCL_SVKMAIN_H diff --git a/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp b/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp index 1c52db0e..4a2a78cd 100644 --- a/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp +++ b/SamTSE/Sources/Engine/Graphics/Vulkan/SvkMemoryPool.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2020 Sultim Tsyrendashiev +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "Engine/StdH.h" #include "SvkMemoryPool.h" diff --git a/SamTSE/Sources/Engine/Math/Clipping.inl b/SamTSE/Sources/Engine/Math/Clipping.inl index d75ee4ef..537dd9d0 100644 --- a/SamTSE/Sources/Engine/Math/Clipping.inl +++ b/SamTSE/Sources/Engine/Math/Clipping.inl @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_CLIPPING_INL #define SE_INCL_CLIPPING_INL #ifdef PRAGMA_ONCE diff --git a/SamTSE/Sources/Engine/Math/Geometry.inl b/SamTSE/Sources/Engine/Math/Geometry.inl index 3fec2653..dd1a3440 100644 --- a/SamTSE/Sources/Engine/Math/Geometry.inl +++ b/SamTSE/Sources/Engine/Math/Geometry.inl @@ -1,138 +1,153 @@ -#ifndef SE_INCL_GEOMETRY_INL -#define SE_INCL_GEOMETRY_INL -#ifdef PRAGMA_ONCE - #pragma once -#endif - -// mirror a position vector by a given plane -inline void ReflectPositionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vPoint) -{ - vPoint-=((FLOAT3D &)plPlane)*(2*plPlane.PointDistance(vPoint)); -} -// mirror a direction vector by a given plane -inline void ReflectDirectionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vDirection) -{ - vDirection-=((FLOAT3D &)plPlane)*(2*(((FLOAT3D &)plPlane)%vDirection)); -} -// mirror a rotation matrix by a given plane -inline void ReflectRotationMatrixByPlane_cols(const FLOATplane3D &plPlane, FLOATmatrix3D &m) -{ // reflect columns vectors - FLOAT3D vX(m(1,1),m(2,1),m(3,1)); - FLOAT3D vY(m(1,2),m(2,2),m(3,2)); - FLOAT3D vZ(m(1,3),m(2,3),m(3,3)); - - ReflectDirectionVectorByPlane(plPlane, vX); - ReflectDirectionVectorByPlane(plPlane, vY); - ReflectDirectionVectorByPlane(plPlane, vZ); - - m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); - m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); - m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); -} -inline void ReflectRotationMatrixByPlane_rows(const FLOATplane3D &plPlane, FLOATmatrix3D &m) -{ // reflect row vectors - FLOAT3D vX(m(1,1),m(1,2),m(1,3)); - FLOAT3D vY(m(2,1),m(2,2),m(2,3)); - FLOAT3D vZ(m(3,1),m(3,2),m(3,3)); - - ReflectDirectionVectorByPlane(plPlane, vX); - ReflectDirectionVectorByPlane(plPlane, vY); - ReflectDirectionVectorByPlane(plPlane, vZ); - - m(1,1) = vX(1); m(2,1) = vY(1); m(3,1) = vZ(1); - m(1,2) = vX(2); m(2,2) = vY(2); m(3,2) = vZ(2); - m(1,3) = vX(3); m(2,3) = vY(3); m(3,3) = vZ(3); -} - -// get component of a vector parallel to given reference vector -static inline void GetParallelComponent( - const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel) -{ - vParallel = vReference*(vFull%vReference); -} - -// get component of a vector normal to given reference vector -static inline void GetNormalComponent( - const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vNormal) -{ - vNormal = vFull-vReference*(vFull%vReference); -} - -// get components of a vector parallel and normal to given reference vector -static inline void GetParallelAndNormalComponents( - const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel, FLOAT3D &vNormal) -{ - vParallel = vReference*(vFull%vReference); - vNormal = vFull-vParallel; -} - -// get measure of validity of a rotation matrix (should be around zero) -static inline FLOAT RotationMatrixValidity(const FLOATmatrix3D &m) -{ - FLOATmatrix3D mSqr; - mSqr(1,1) = m(1,1)*m(1,1); - mSqr(1,2) = m(1,2)*m(1,2); - mSqr(1,3) = m(1,3)*m(1,3); - mSqr(2,1) = m(2,1)*m(2,1); - mSqr(2,2) = m(2,2)*m(2,2); - mSqr(2,3) = m(2,3)*m(2,3); - mSqr(3,1) = m(3,1)*m(3,1); - mSqr(3,2) = m(3,2)*m(3,2); - mSqr(3,3) = m(3,3)*m(3,3); - - FLOAT3D vH; - vH(1) = Sqrt(mSqr(1,1)+mSqr(1,2)+mSqr(1,3))-1; - vH(2) = Sqrt(mSqr(2,1)+mSqr(2,2)+mSqr(2,3))-1; - vH(3) = Sqrt(mSqr(3,1)+mSqr(3,2)+mSqr(3,3))-1; - FLOAT3D vV; - vV(1) = Sqrt(mSqr(1,1)+mSqr(2,1)+mSqr(3,1))-1; - vV(2) = Sqrt(mSqr(1,2)+mSqr(2,2)+mSqr(3,2))-1; - vV(3) = Sqrt(mSqr(1,3)+mSqr(2,3)+mSqr(3,3))-1; - - return Sqrt( - vH(1)*vH(1)+vH(2)*vH(2)+vH(3)*vH(3)+ - vV(1)*vV(1)+vV(2)*vV(2)+vV(3)*vV(3)); -} - -// normalize rotation matrix to be special orthogonal -static inline void OrthonormalizeRotationMatrix( FLOATmatrix3D &m) -{ - FLOAT3D vX(m(1,1),m(2,1),m(3,1)); - FLOAT3D vY(m(1,2),m(2,2),m(3,2)); - FLOAT3D vZ; - - vX.Normalize(); - vZ = vX*vY; - vZ.Normalize(); - vY = vZ*vX; - vY.Normalize(); - - m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); - m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); - m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); -} - -inline void GetMajorAxesForPlane( - const FLOATplane3D &plPlane, INDEX &iMajorAxis1, INDEX &iMajorAxis2) -{ - // get maximum normal axis - INDEX iMaxNormalAxis = plPlane.GetMaxNormal(); - // the major axes are the other two axes - switch (iMaxNormalAxis) { - case 1: iMajorAxis1 = 2; iMajorAxis2 = 3; - break; - case 2: iMajorAxis1 = 3; iMajorAxis2 = 1; - break; - case 3: iMajorAxis1 = 1; iMajorAxis2 = 2; - break; - default: - ASSERT(FALSE); - iMajorAxis1 = 2; - iMajorAxis2 = 3; - } - ASSERT(Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis1)) - &&Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis2))); -} - -#endif /* include-once checker ... */ - +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#ifndef SE_INCL_GEOMETRY_INL +#define SE_INCL_GEOMETRY_INL +#ifdef PRAGMA_ONCE + #pragma once +#endif + +// mirror a position vector by a given plane +inline void ReflectPositionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vPoint) +{ + vPoint-=((FLOAT3D &)plPlane)*(2*plPlane.PointDistance(vPoint)); +} +// mirror a direction vector by a given plane +inline void ReflectDirectionVectorByPlane(const FLOATplane3D &plPlane, FLOAT3D &vDirection) +{ + vDirection-=((FLOAT3D &)plPlane)*(2*(((FLOAT3D &)plPlane)%vDirection)); +} +// mirror a rotation matrix by a given plane +inline void ReflectRotationMatrixByPlane_cols(const FLOATplane3D &plPlane, FLOATmatrix3D &m) +{ // reflect columns vectors + FLOAT3D vX(m(1,1),m(2,1),m(3,1)); + FLOAT3D vY(m(1,2),m(2,2),m(3,2)); + FLOAT3D vZ(m(1,3),m(2,3),m(3,3)); + + ReflectDirectionVectorByPlane(plPlane, vX); + ReflectDirectionVectorByPlane(plPlane, vY); + ReflectDirectionVectorByPlane(plPlane, vZ); + + m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); + m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); + m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); +} +inline void ReflectRotationMatrixByPlane_rows(const FLOATplane3D &plPlane, FLOATmatrix3D &m) +{ // reflect row vectors + FLOAT3D vX(m(1,1),m(1,2),m(1,3)); + FLOAT3D vY(m(2,1),m(2,2),m(2,3)); + FLOAT3D vZ(m(3,1),m(3,2),m(3,3)); + + ReflectDirectionVectorByPlane(plPlane, vX); + ReflectDirectionVectorByPlane(plPlane, vY); + ReflectDirectionVectorByPlane(plPlane, vZ); + + m(1,1) = vX(1); m(2,1) = vY(1); m(3,1) = vZ(1); + m(1,2) = vX(2); m(2,2) = vY(2); m(3,2) = vZ(2); + m(1,3) = vX(3); m(2,3) = vY(3); m(3,3) = vZ(3); +} + +// get component of a vector parallel to given reference vector +static inline void GetParallelComponent( + const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel) +{ + vParallel = vReference*(vFull%vReference); +} + +// get component of a vector normal to given reference vector +static inline void GetNormalComponent( + const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vNormal) +{ + vNormal = vFull-vReference*(vFull%vReference); +} + +// get components of a vector parallel and normal to given reference vector +static inline void GetParallelAndNormalComponents( + const FLOAT3D &vFull, const FLOAT3D &vReference, FLOAT3D &vParallel, FLOAT3D &vNormal) +{ + vParallel = vReference*(vFull%vReference); + vNormal = vFull-vParallel; +} + +// get measure of validity of a rotation matrix (should be around zero) +static inline FLOAT RotationMatrixValidity(const FLOATmatrix3D &m) +{ + FLOATmatrix3D mSqr; + mSqr(1,1) = m(1,1)*m(1,1); + mSqr(1,2) = m(1,2)*m(1,2); + mSqr(1,3) = m(1,3)*m(1,3); + mSqr(2,1) = m(2,1)*m(2,1); + mSqr(2,2) = m(2,2)*m(2,2); + mSqr(2,3) = m(2,3)*m(2,3); + mSqr(3,1) = m(3,1)*m(3,1); + mSqr(3,2) = m(3,2)*m(3,2); + mSqr(3,3) = m(3,3)*m(3,3); + + FLOAT3D vH; + vH(1) = Sqrt(mSqr(1,1)+mSqr(1,2)+mSqr(1,3))-1; + vH(2) = Sqrt(mSqr(2,1)+mSqr(2,2)+mSqr(2,3))-1; + vH(3) = Sqrt(mSqr(3,1)+mSqr(3,2)+mSqr(3,3))-1; + FLOAT3D vV; + vV(1) = Sqrt(mSqr(1,1)+mSqr(2,1)+mSqr(3,1))-1; + vV(2) = Sqrt(mSqr(1,2)+mSqr(2,2)+mSqr(3,2))-1; + vV(3) = Sqrt(mSqr(1,3)+mSqr(2,3)+mSqr(3,3))-1; + + return Sqrt( + vH(1)*vH(1)+vH(2)*vH(2)+vH(3)*vH(3)+ + vV(1)*vV(1)+vV(2)*vV(2)+vV(3)*vV(3)); +} + +// normalize rotation matrix to be special orthogonal +static inline void OrthonormalizeRotationMatrix( FLOATmatrix3D &m) +{ + FLOAT3D vX(m(1,1),m(2,1),m(3,1)); + FLOAT3D vY(m(1,2),m(2,2),m(3,2)); + FLOAT3D vZ; + + vX.Normalize(); + vZ = vX*vY; + vZ.Normalize(); + vY = vZ*vX; + vY.Normalize(); + + m(1,1) = vX(1); m(1,2) = vY(1); m(1,3) = vZ(1); + m(2,1) = vX(2); m(2,2) = vY(2); m(2,3) = vZ(2); + m(3,1) = vX(3); m(3,2) = vY(3); m(3,3) = vZ(3); +} + +inline void GetMajorAxesForPlane( + const FLOATplane3D &plPlane, INDEX &iMajorAxis1, INDEX &iMajorAxis2) +{ + // get maximum normal axis + INDEX iMaxNormalAxis = plPlane.GetMaxNormal(); + // the major axes are the other two axes + switch (iMaxNormalAxis) { + case 1: iMajorAxis1 = 2; iMajorAxis2 = 3; + break; + case 2: iMajorAxis1 = 3; iMajorAxis2 = 1; + break; + case 3: iMajorAxis1 = 1; iMajorAxis2 = 2; + break; + default: + ASSERT(FALSE); + iMajorAxis1 = 2; + iMajorAxis2 = 3; + } + ASSERT(Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis1)) + &&Abs(plPlane(iMaxNormalAxis))>=Abs(plPlane(iMajorAxis2))); +} + +#endif /* include-once checker ... */ + diff --git a/SamTSE/Sources/Engine/Ska/smcFlex.skl b/SamTSE/Sources/Engine/Ska/smcFlex.skl index 23fac9ce..f71b0e7e 100644 --- a/SamTSE/Sources/Engine/Ska/smcFlex.skl +++ b/SamTSE/Sources/Engine/Ska/smcFlex.skl @@ -1,1496 +1,1511 @@ -#include - -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -//#ifdef c_plusplus -//#ifndef __cplusplus -//#define __cplusplus -//#endif -//#endif - -#if 1 //def __cplusplus - - #include -%+ - class istream; -%* - - /* Use prototypes in function declarations. */ - #define YY_USE_PROTOS - - /* The "const" storage-class-modifier is valid. */ - #define YY_USE_CONST - -#else /* ! __cplusplus */ - - #if __STDC__ - - #define YY_USE_PROTOS - #define YY_USE_CONST - - #endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -extern FILE *yyin, *yyout; -%* - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) syyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - FILE *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -static YY_BUFFER_STATE yy_current_buffer = 0; -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -//static - void syyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -%* -#endif - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( const char msg[] )); -%* - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifdef YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) -%- - yyin = stdin; -%+ - yyin = &cin; -%* - - if ( ! yyout ) -%- - yyout = stdout; -%+ - yyout = &cout; -%* - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( yy_current_buffer ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; - } - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif - { - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) yyout->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer() -%+ -int yyFlexLexer::yy_get_next_buffer() -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state() -%+ -yy_state_type yyFlexLexer::yy_get_previous_state() -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifdef YY_USE_PROTOS -//static - void syyunput( int c, register char *yy_bp ) -#else -//static - void syyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } - - -%- -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif -%+ -int yyFlexLexer::yyinput() -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%* - { - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) -%* - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#ifdef YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#ifdef YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif -%+ - b->yy_is_interactive = 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%* - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( const char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -const char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -const char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state() -%+ -void yyFlexLexer::yy_pop_state() -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state() -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( const char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( const char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, const char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -const char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - return (void *) realloc( ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#ifdef YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +#include + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +%- +#include +%* + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +//#ifdef c_plusplus +//#ifndef __cplusplus +//#define __cplusplus +//#endif +//#endif + +#if 1 //def __cplusplus + + #include +%+ + class istream; +%* + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + +#else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +%- +extern FILE *yyin, *yyout; +%* + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) syyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { +%- + FILE *yy_input_file; +%+ + istream* yy_input_file; +%* + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +%- Standard (non-C++) definition +static YY_BUFFER_STATE yy_current_buffer = 0; +%* + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +%- Standard (non-C++) definition +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); +%* + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +//static + void syyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); +#endif + +#ifndef YY_NO_INPUT +%- Standard (non-C++) definition +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +%* +#endif + +%- Standard (non-C++) definition +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( const char msg[] )); +%* + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ +%% code to fiddle yytext and yyleng for yymore() goes here + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ +%% code to copy yytext_ptr to yytext[] goes here, if %array + yy_c_buf_p = yy_cp; + +%% data tables for the DFA and the user's section 1 definitions go here + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifdef YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +%- Standard (non-C++) definition +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +%+ C++ definition +#define ECHO LexerOutput( yytext, yyleng ) +%* +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ +%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ +%+ C++ definition + if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +%* +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +%- +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +%+ +#define YY_FATAL_ERROR(msg) LexerError( msg ) +%* +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +%- Standard (non-C++) definition +#define YY_DECL int yylex YY_PROTO(( void )) +%+ C++ definition +#define YY_DECL int yyFlexLexer::yylex() +%* +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +%% YY_RULE_SETUP definition goes here + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +%% user's declarations go here + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) +%- + yyin = stdin; +%+ + yyin = &cin; +%* + + if ( ! yyout ) +%- + yyout = stdout; +%+ + yyout = &cout; +%* + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { +%% yymore()-related code goes here + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + +%% code to set up and find next match goes here + +yy_find_action: +%% code to find the action number goes here + + YY_DO_BEFORE_ACTION; + +%% code for yylineno update goes here + +do_action: /* This label is used only to access EOF actions. */ + +%% debug code goes here + + switch ( yy_act ) + { /* beginning of action switch */ +%% actions go here + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { +%% code to do back-up for compressed tables and set up yy_cp goes here + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + +%+ +yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) + { + yyin = arg_yyin; + yyout = arg_yyout; + yy_c_buf_p = 0; + yy_init = 1; + yy_start = 0; + yy_flex_debug = 0; + yylineno = 1; // this will only get updated if %option yylineno + + yy_did_buffer_switch_on_eof = 0; + + yy_looking_for_trail_begin = 0; + yy_more_flag = 0; + yy_more_len = 0; + + yy_start_stack_ptr = yy_start_stack_depth = 0; + yy_start_stack = 0; + + yy_current_buffer = 0; + +#ifdef YY_USES_REJECT + yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; +#else + yy_state_buf = 0; +#endif + } + +yyFlexLexer::~yyFlexLexer() + { + delete yy_state_buf; + yy_delete_buffer( yy_current_buffer ); + } + +void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) + { + if ( new_in ) + { + yy_delete_buffer( yy_current_buffer ); + yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); + } + + if ( new_out ) + yyout = new_out; + } + +#ifdef YY_INTERACTIVE +int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) +#else +int yyFlexLexer::LexerInput( char* buf, int max_size ) +#endif + { + if ( yyin->eof() || yyin->fail() ) + return 0; + +#ifdef YY_INTERACTIVE + yyin->get( buf[0] ); + + if ( yyin->eof() ) + return 0; + + if ( yyin->bad() ) + return -1; + + return 1; + +#else + (void) yyin->read( buf, max_size ); + + if ( yyin->bad() ) + return -1; + else + return yyin->gcount(); +#endif + } + +void yyFlexLexer::LexerOutput( const char* buf, int size ) + { + (void) yyout->write( buf, size ); + } +%* + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +%- +static int yy_get_next_buffer() +%+ +int yyFlexLexer::yy_get_next_buffer() +%* + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +%- +static yy_state_type yy_get_previous_state() +%+ +yy_state_type yyFlexLexer::yy_get_previous_state() +%* + { + register yy_state_type yy_current_state; + register char *yy_cp; + +%% code to get the start state into yy_current_state goes here + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { +%% code to find the next state goes here + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +%- +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif +%+ +yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +%* + { + register int yy_is_jam; +%% code to find the next state, and perhaps do backing up, goes here + + return yy_is_jam ? 0 : yy_current_state; + } + + +%- +#ifdef YY_USE_PROTOS +//static + void syyunput( int c, register char *yy_bp ) +#else +//static + void syyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif +%+ +void yyFlexLexer::yyunput( int c, register char* yy_bp ) +%* + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + +%% update yylineno here + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + + +%- +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif +%+ +int yyFlexLexer::yyinput() +%* + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; + + case EOB_ACT_LAST_MATCH: +#ifdef __cplusplus + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); +#else + YY_FATAL_ERROR( + "unexpected last match in input()" ); +#endif + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + +%% update BOL and yylineno + + return c; + } + + +%- +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif +%+ +void yyFlexLexer::yyrestart( istream* input_file ) +%* + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +%- +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif +%+ +void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +%* + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif +%+ +void yyFlexLexer::yy_load_buffer_state() +%* + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif +%+ +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) +%* + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +%- +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif +%+ +void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +%* + { + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +%- +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + +%+ +extern "C" int isatty YY_PROTO(( int )); +void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) +%* + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +%- +#ifdef YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#ifdef YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif +%+ + b->yy_is_interactive = 0; +%* + } + + +%- +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + +%+ +void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +%* + { + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } +%* + + +#ifndef YY_NO_SCAN_BUFFER +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +%* +#endif + + +#ifndef YY_NO_SCAN_STRING +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( const char *str ) +#else +YY_BUFFER_STATE yy_scan_string( str ) +const char *str; +#endif + { + int len; + for ( len = 0; str[len]; ++len ) + ; + + return yy_scan_bytes( str, len ); + } +%* +#endif + + +#ifndef YY_NO_SCAN_BYTES +%- +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +const char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +%* +#endif + + +#ifndef YY_NO_PUSH_STATE +%- +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif +%+ +void yyFlexLexer::yy_push_state( int new_state ) +%* + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +%- +static void yy_pop_state() +%+ +void yyFlexLexer::yy_pop_state() +%* + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +%- +static int yy_top_state() +%+ +int yyFlexLexer::yy_top_state() +%* + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +%- +#ifdef YY_USE_PROTOS +static void yy_fatal_error( const char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + +%+ + +void yyFlexLexer::LexerError( const char msg[] ) + { + cerr << msg << '\n'; + exit( YY_EXIT_FAILURE ); + } +%* + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, const char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +const char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + return (void *) realloc( ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#ifdef YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif diff --git a/SamTSE/Sources/Engine/Ska/smcPars.y b/SamTSE/Sources/Engine/Ska/smcPars.y index 711cd5e0..903e7e5e 100644 --- a/SamTSE/Sources/Engine/Ska/smcPars.y +++ b/SamTSE/Sources/Engine/Ska/smcPars.y @@ -1,4 +1,19 @@ %{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #include #include diff --git a/SamTSE/Sources/Engine/Ska/smcScan.l b/SamTSE/Sources/Engine/Ska/smcScan.l index 4be51486..08c97cf7 100644 --- a/SamTSE/Sources/Engine/Ska/smcScan.l +++ b/SamTSE/Sources/Engine/Ska/smcScan.l @@ -1,5 +1,20 @@ %option prefix="engine_ska_yy" %{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #include #include diff --git a/SamTSE/Sources/Engine/Ska/smcScwin.l b/SamTSE/Sources/Engine/Ska/smcScwin.l index 759907c5..ced0bbed 100644 --- a/SamTSE/Sources/Engine/Ska/smcScwin.l +++ b/SamTSE/Sources/Engine/Ska/smcScwin.l @@ -1,5 +1,20 @@ %option prefix="syy" %{ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "ParsingSmbs.h" #include "smcPars.h" diff --git a/SamTSE/Sources/Entities/Acid.es b/SamTSE/Sources/Entities/Acid.es index c9b0f313..b7192ed6 100644 --- a/SamTSE/Sources/Entities/Acid.es +++ b/SamTSE/Sources/Entities/Acid.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 509 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/AirWave.es b/SamTSE/Sources/Entities/AirWave.es index dbfbd46c..3ff3a036 100644 --- a/SamTSE/Sources/Entities/AirWave.es +++ b/SamTSE/Sources/Entities/AirWave.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 510 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/AmmoItem.es b/SamTSE/Sources/Entities/AmmoItem.es index b05369e6..87b92de1 100644 --- a/SamTSE/Sources/Entities/AmmoItem.es +++ b/SamTSE/Sources/Entities/AmmoItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 803 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/AmmoPack.es b/SamTSE/Sources/Entities/AmmoPack.es index 59170b1c..a46be86b 100644 --- a/SamTSE/Sources/Entities/AmmoPack.es +++ b/SamTSE/Sources/Entities/AmmoPack.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 806 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/AnimationChanger.es b/SamTSE/Sources/Entities/AnimationChanger.es index bfa99ea2..2f9a7acb 100644 --- a/SamTSE/Sources/Entities/AnimationChanger.es +++ b/SamTSE/Sources/Entities/AnimationChanger.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 218 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/AnimationHub.es b/SamTSE/Sources/Entities/AnimationHub.es index ad945a06..52b15c33 100644 --- a/SamTSE/Sources/Entities/AnimationHub.es +++ b/SamTSE/Sources/Entities/AnimationHub.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 228 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/ArmorItem.es b/SamTSE/Sources/Entities/ArmorItem.es index bbe05b9c..516a970d 100644 --- a/SamTSE/Sources/Entities/ArmorItem.es +++ b/SamTSE/Sources/Entities/ArmorItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 804 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/BackgroundViewer.es b/SamTSE/Sources/Entities/BackgroundViewer.es index 5ad58902..9fee9f9f 100644 --- a/SamTSE/Sources/Entities/BackgroundViewer.es +++ b/SamTSE/Sources/Entities/BackgroundViewer.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 211 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/BasicEffects.es b/SamTSE/Sources/Entities/BasicEffects.es index 7b886749..30f63c6b 100644 --- a/SamTSE/Sources/Entities/BasicEffects.es +++ b/SamTSE/Sources/Entities/BasicEffects.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 601 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Beast.es b/SamTSE/Sources/Entities/Beast.es index e0a1bdd9..408832e8 100644 --- a/SamTSE/Sources/Entities/Beast.es +++ b/SamTSE/Sources/Entities/Beast.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 336 %{ diff --git a/SamTSE/Sources/Entities/BigHead.es b/SamTSE/Sources/Entities/BigHead.es index 69738835..0b3c02f5 100644 --- a/SamTSE/Sources/Entities/BigHead.es +++ b/SamTSE/Sources/Entities/BigHead.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 340 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/BlendController.es b/SamTSE/Sources/Entities/BlendController.es index 43a17701..a92c87dc 100644 --- a/SamTSE/Sources/Entities/BlendController.es +++ b/SamTSE/Sources/Entities/BlendController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 612 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/BloodSpray.es b/SamTSE/Sources/Entities/BloodSpray.es index 12d27236..776206ee 100644 --- a/SamTSE/Sources/Entities/BloodSpray.es +++ b/SamTSE/Sources/Entities/BloodSpray.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 603 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Boneman.es b/SamTSE/Sources/Entities/Boneman.es index 1e19e16d..b4f4e9ba 100644 --- a/SamTSE/Sources/Entities/Boneman.es +++ b/SamTSE/Sources/Entities/Boneman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 305 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Bouncer.es b/SamTSE/Sources/Entities/Bouncer.es index eda4a2a7..1fec1a93 100644 --- a/SamTSE/Sources/Entities/Bouncer.es +++ b/SamTSE/Sources/Entities/Bouncer.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 105 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Bullet.es b/SamTSE/Sources/Entities/Bullet.es index 84b115a8..a7bbc510 100644 --- a/SamTSE/Sources/Entities/Bullet.es +++ b/SamTSE/Sources/Entities/Bullet.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 502 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Camera.es b/SamTSE/Sources/Entities/Camera.es index a9431874..24f627dd 100644 --- a/SamTSE/Sources/Entities/Camera.es +++ b/SamTSE/Sources/Entities/Camera.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 220 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/CameraMarker.es b/SamTSE/Sources/Entities/CameraMarker.es index f6b540d8..d1331b51 100644 --- a/SamTSE/Sources/Entities/CameraMarker.es +++ b/SamTSE/Sources/Entities/CameraMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 224 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/CannonBall.es b/SamTSE/Sources/Entities/CannonBall.es index 510802ba..f919d8c7 100644 --- a/SamTSE/Sources/Entities/CannonBall.es +++ b/SamTSE/Sources/Entities/CannonBall.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 506 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Catman.es b/SamTSE/Sources/Entities/Catman.es index 657f0c18..5661d83b 100644 --- a/SamTSE/Sources/Entities/Catman.es +++ b/SamTSE/Sources/Entities/Catman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 301 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Common/Common.cpp b/SamTSE/Sources/Entities/Common/Common.cpp index 7c2f9c87..c5f3b74f 100644 --- a/SamTSE/Sources/Entities/Common/Common.cpp +++ b/SamTSE/Sources/Entities/Common/Common.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" #include "Entities/Reminder.h" //#include "Entities/Flame.h" diff --git a/SamTSE/Sources/Entities/Common/Common.h b/SamTSE/Sources/Entities/Common/Common.h index 4d8321d1..40c2d0b1 100644 --- a/SamTSE/Sources/Entities/Common/Common.h +++ b/SamTSE/Sources/Entities/Common/Common.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // common headers for flesh entity classes #include /* rcg10062001 need enum definition... */ diff --git a/SamTSE/Sources/Entities/Common/Debris.cpp b/SamTSE/Sources/Entities/Common/Debris.cpp index e69de29b..d70515e2 100644 --- a/SamTSE/Sources/Entities/Common/Debris.cpp +++ b/SamTSE/Sources/Entities/Common/Debris.cpp @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTSE/Sources/Entities/Common/Flags.h b/SamTSE/Sources/Entities/Common/Flags.h index afee7566..cdaacd47 100644 --- a/SamTSE/Sources/Entities/Common/Flags.h +++ b/SamTSE/Sources/Entities/Common/Flags.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_FLAGS_H #define SE_INCL_FLAGS_H #ifdef PRAGMA_ONCE diff --git a/SamTSE/Sources/Entities/Common/GameInterface.h b/SamTSE/Sources/Entities/Common/GameInterface.h index 4c772396..cb91c328 100644 --- a/SamTSE/Sources/Entities/Common/GameInterface.h +++ b/SamTSE/Sources/Entities/Common/GameInterface.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // interfacing between CGame and entities #ifndef SE_INCL_GAMEINTERFACE_H #define SE_INCL_GAMEINTERFACE_H diff --git a/SamTSE/Sources/Entities/Common/HUD.cpp b/SamTSE/Sources/Entities/Common/HUD.cpp index b859c5ac..3fef6363 100644 --- a/SamTSE/Sources/Entities/Common/HUD.cpp +++ b/SamTSE/Sources/Entities/Common/HUD.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Common/HUD.h b/SamTSE/Sources/Entities/Common/HUD.h index e69de29b..d70515e2 100644 --- a/SamTSE/Sources/Entities/Common/HUD.h +++ b/SamTSE/Sources/Entities/Common/HUD.h @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTSE/Sources/Entities/Common/Particles.cpp b/SamTSE/Sources/Entities/Common/Particles.cpp index 9ff1f5cd..d7f0f6e3 100644 --- a/SamTSE/Sources/Entities/Common/Particles.cpp +++ b/SamTSE/Sources/Entities/Common/Particles.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" #include "Entities/BloodSpray.h" #include "Entities/PlayerWeapons.h" diff --git a/SamTSE/Sources/Entities/Common/Particles.h b/SamTSE/Sources/Entities/Common/Particles.h index 2f413f24..10513298 100644 --- a/SamTSE/Sources/Entities/Common/Particles.h +++ b/SamTSE/Sources/Entities/Common/Particles.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // init particle effects void DECL_DLL InitParticles(void); diff --git a/SamTSE/Sources/Entities/Common/PathFinding.cpp b/SamTSE/Sources/Entities/Common/PathFinding.cpp index 654c1e10..17abf1d5 100644 --- a/SamTSE/Sources/Entities/Common/PathFinding.cpp +++ b/SamTSE/Sources/Entities/Common/PathFinding.cpp @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "../StdH/StdH.h" #include "Entities/Common/PathFinding.h" #include "Entities/NavigationMarker.h" diff --git a/SamTSE/Sources/Entities/Common/PathFinding.h b/SamTSE/Sources/Entities/Common/PathFinding.h index 8fa4e277..85a45630 100644 --- a/SamTSE/Sources/Entities/Common/PathFinding.h +++ b/SamTSE/Sources/Entities/Common/PathFinding.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef SE_INCL_PATHFINDING_H #define SE_INCL_PATHFINDING_H #ifdef PRAGMA_ONCE diff --git a/SamTSE/Sources/Entities/Common/Stats.cpp b/SamTSE/Sources/Entities/Common/Stats.cpp index e69de29b..d70515e2 100644 --- a/SamTSE/Sources/Entities/Common/Stats.cpp +++ b/SamTSE/Sources/Entities/Common/Stats.cpp @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTSE/Sources/Entities/Common/WeaponPositions.h b/SamTSE/Sources/Entities/Common/WeaponPositions.h index e17ca2d1..6f9dcc1b 100644 --- a/SamTSE/Sources/Entities/Common/WeaponPositions.h +++ b/SamTSE/Sources/Entities/Common/WeaponPositions.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #if 0 // use this part when manually setting weapon positions diff --git a/SamTSE/Sources/Entities/Copier.es b/SamTSE/Sources/Entities/Copier.es index 7de96fab..97d1d5ef 100644 --- a/SamTSE/Sources/Entities/Copier.es +++ b/SamTSE/Sources/Entities/Copier.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 225 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Counter.es b/SamTSE/Sources/Entities/Counter.es index e84443e0..9153b47c 100644 --- a/SamTSE/Sources/Entities/Counter.es +++ b/SamTSE/Sources/Entities/Counter.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 232 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/CrateRider.es b/SamTSE/Sources/Entities/CrateRider.es index d9f43424..dc5a35b6 100644 --- a/SamTSE/Sources/Entities/CrateRider.es +++ b/SamTSE/Sources/Entities/CrateRider.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 341 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Cyborg.es b/SamTSE/Sources/Entities/Cyborg.es index 385a08be..cb8fe19f 100644 --- a/SamTSE/Sources/Entities/Cyborg.es +++ b/SamTSE/Sources/Entities/Cyborg.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 330 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/CyborgBike.es b/SamTSE/Sources/Entities/CyborgBike.es index 1930ebc4..a6629347 100644 --- a/SamTSE/Sources/Entities/CyborgBike.es +++ b/SamTSE/Sources/Entities/CyborgBike.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 331 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Damager.es b/SamTSE/Sources/Entities/Damager.es index 6eb06747..8e74b29c 100644 --- a/SamTSE/Sources/Entities/Damager.es +++ b/SamTSE/Sources/Entities/Damager.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 229 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Debris.es b/SamTSE/Sources/Entities/Debris.es index 03be50e6..74088606 100644 --- a/SamTSE/Sources/Entities/Debris.es +++ b/SamTSE/Sources/Entities/Debris.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 602 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/DestroyableArchitecture.es b/SamTSE/Sources/Entities/DestroyableArchitecture.es index 9a19805b..88a6b074 100644 --- a/SamTSE/Sources/Entities/DestroyableArchitecture.es +++ b/SamTSE/Sources/Entities/DestroyableArchitecture.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 107 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Devil.es b/SamTSE/Sources/Entities/Devil.es index 4368a3d5..87b5e810 100644 --- a/SamTSE/Sources/Entities/Devil.es +++ b/SamTSE/Sources/Entities/Devil.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 332 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/DevilMarker.es b/SamTSE/Sources/Entities/DevilMarker.es index ae6bc881..62794ef1 100644 --- a/SamTSE/Sources/Entities/DevilMarker.es +++ b/SamTSE/Sources/Entities/DevilMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 338 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/DevilProjectile.es b/SamTSE/Sources/Entities/DevilProjectile.es index 261bed91..88ef72ea 100644 --- a/SamTSE/Sources/Entities/DevilProjectile.es +++ b/SamTSE/Sources/Entities/DevilProjectile.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 511 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/DoorController.es b/SamTSE/Sources/Entities/DoorController.es index e0a1b6cc..5d98c356 100644 --- a/SamTSE/Sources/Entities/DoorController.es +++ b/SamTSE/Sources/Entities/DoorController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 221 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Dragonman.es b/SamTSE/Sources/Entities/Dragonman.es index 5788adec..13f3e246 100644 --- a/SamTSE/Sources/Entities/Dragonman.es +++ b/SamTSE/Sources/Entities/Dragonman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 321 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EffectMarker.es b/SamTSE/Sources/Entities/EffectMarker.es index 3b739c94..78803531 100644 --- a/SamTSE/Sources/Entities/EffectMarker.es +++ b/SamTSE/Sources/Entities/EffectMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 611 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Effector.es b/SamTSE/Sources/Entities/Effector.es index 18c7d1d4..ecf10a64 100644 --- a/SamTSE/Sources/Entities/Effector.es +++ b/SamTSE/Sources/Entities/Effector.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 608 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Elemental.es b/SamTSE/Sources/Entities/Elemental.es index 56ff61dc..03036474 100644 --- a/SamTSE/Sources/Entities/Elemental.es +++ b/SamTSE/Sources/Entities/Elemental.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 322 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemyBase.es b/SamTSE/Sources/Entities/EnemyBase.es index f1b1df4c..f6760338 100644 --- a/SamTSE/Sources/Entities/EnemyBase.es +++ b/SamTSE/Sources/Entities/EnemyBase.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 310 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemyCounter.es b/SamTSE/Sources/Entities/EnemyCounter.es index 0ccf18d4..0a3811d7 100644 --- a/SamTSE/Sources/Entities/EnemyCounter.es +++ b/SamTSE/Sources/Entities/EnemyCounter.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 339 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemyDive.es b/SamTSE/Sources/Entities/EnemyDive.es index 42547135..fe62c091 100644 --- a/SamTSE/Sources/Entities/EnemyDive.es +++ b/SamTSE/Sources/Entities/EnemyDive.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 313 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemyFly.es b/SamTSE/Sources/Entities/EnemyFly.es index 7d09d926..1ea0c32e 100644 --- a/SamTSE/Sources/Entities/EnemyFly.es +++ b/SamTSE/Sources/Entities/EnemyFly.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 311 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemyMarker.es b/SamTSE/Sources/Entities/EnemyMarker.es index 07797213..0cb0579e 100644 --- a/SamTSE/Sources/Entities/EnemyMarker.es +++ b/SamTSE/Sources/Entities/EnemyMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 302 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemyRunInto.es b/SamTSE/Sources/Entities/EnemyRunInto.es index e5793fdd..9b678921 100644 --- a/SamTSE/Sources/Entities/EnemyRunInto.es +++ b/SamTSE/Sources/Entities/EnemyRunInto.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 312 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnemySpawner.es b/SamTSE/Sources/Entities/EnemySpawner.es index 2ce56668..93896275 100644 --- a/SamTSE/Sources/Entities/EnemySpawner.es +++ b/SamTSE/Sources/Entities/EnemySpawner.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 304 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnvironmentBase.es b/SamTSE/Sources/Entities/EnvironmentBase.es index 82df8707..b186f12e 100644 --- a/SamTSE/Sources/Entities/EnvironmentBase.es +++ b/SamTSE/Sources/Entities/EnvironmentBase.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 900 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/EnvironmentMarker.es b/SamTSE/Sources/Entities/EnvironmentMarker.es index a86c599f..18d4c22a 100644 --- a/SamTSE/Sources/Entities/EnvironmentMarker.es +++ b/SamTSE/Sources/Entities/EnvironmentMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 901 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Eruptor.es b/SamTSE/Sources/Entities/Eruptor.es index e33288f8..efc45c02 100644 --- a/SamTSE/Sources/Entities/Eruptor.es +++ b/SamTSE/Sources/Entities/Eruptor.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 213 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Eyeman.es b/SamTSE/Sources/Entities/Eyeman.es index e20d0eac..5fd1d7fc 100644 --- a/SamTSE/Sources/Entities/Eyeman.es +++ b/SamTSE/Sources/Entities/Eyeman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 323 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Fish.es b/SamTSE/Sources/Entities/Fish.es index 849b05cf..022d7198 100644 --- a/SamTSE/Sources/Entities/Fish.es +++ b/SamTSE/Sources/Entities/Fish.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 337 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Fishman.es b/SamTSE/Sources/Entities/Fishman.es index b2b2dbdf..cf4025ac 100644 --- a/SamTSE/Sources/Entities/Fishman.es +++ b/SamTSE/Sources/Entities/Fishman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 328 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Flame.es b/SamTSE/Sources/Entities/Flame.es index c66c9658..94fd793a 100644 --- a/SamTSE/Sources/Entities/Flame.es +++ b/SamTSE/Sources/Entities/Flame.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 504 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/FogMarker.es b/SamTSE/Sources/Entities/FogMarker.es index 78280008..de4c3dfe 100644 --- a/SamTSE/Sources/Entities/FogMarker.es +++ b/SamTSE/Sources/Entities/FogMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 215 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/GhostBusterRay.es b/SamTSE/Sources/Entities/GhostBusterRay.es index ec934405..37c245e3 100644 --- a/SamTSE/Sources/Entities/GhostBusterRay.es +++ b/SamTSE/Sources/Entities/GhostBusterRay.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 505 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Gizmo.es b/SamTSE/Sources/Entities/Gizmo.es index b985db7c..2d72c870 100644 --- a/SamTSE/Sources/Entities/Gizmo.es +++ b/SamTSE/Sources/Entities/Gizmo.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 335 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Global.es b/SamTSE/Sources/Entities/Global.es index 3b016c7f..6b828143 100644 --- a/SamTSE/Sources/Entities/Global.es +++ b/SamTSE/Sources/Entities/Global.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 0 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/GradientMarker.es b/SamTSE/Sources/Entities/GradientMarker.es index 7c6a88e4..a2757862 100644 --- a/SamTSE/Sources/Entities/GradientMarker.es +++ b/SamTSE/Sources/Entities/GradientMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 230 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/GravityMarker.es b/SamTSE/Sources/Entities/GravityMarker.es index 5a57be04..91dc613a 100644 --- a/SamTSE/Sources/Entities/GravityMarker.es +++ b/SamTSE/Sources/Entities/GravityMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 212 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/GravityRouter.es b/SamTSE/Sources/Entities/GravityRouter.es index 34e785a8..1ce7f086 100644 --- a/SamTSE/Sources/Entities/GravityRouter.es +++ b/SamTSE/Sources/Entities/GravityRouter.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 227 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/HazeMarker.es b/SamTSE/Sources/Entities/HazeMarker.es index 23edcdbd..932d1231 100644 --- a/SamTSE/Sources/Entities/HazeMarker.es +++ b/SamTSE/Sources/Entities/HazeMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 216 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Headman.es b/SamTSE/Sources/Entities/Headman.es index 1293edd4..b0f9c821 100644 --- a/SamTSE/Sources/Entities/Headman.es +++ b/SamTSE/Sources/Entities/Headman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 303 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/HealthItem.es b/SamTSE/Sources/Entities/HealthItem.es index 71bd4aa5..486e811a 100644 --- a/SamTSE/Sources/Entities/HealthItem.es +++ b/SamTSE/Sources/Entities/HealthItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 801 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Huanman.es b/SamTSE/Sources/Entities/Huanman.es index 559aa795..4fdff237 100644 --- a/SamTSE/Sources/Entities/Huanman.es +++ b/SamTSE/Sources/Entities/Huanman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 325 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Item.es b/SamTSE/Sources/Entities/Item.es index f0bc1496..251723d7 100644 --- a/SamTSE/Sources/Entities/Item.es +++ b/SamTSE/Sources/Entities/Item.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 800 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/KeyItem.es b/SamTSE/Sources/Entities/KeyItem.es index 5269cc4a..501025c5 100644 --- a/SamTSE/Sources/Entities/KeyItem.es +++ b/SamTSE/Sources/Entities/KeyItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 805 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Light.es b/SamTSE/Sources/Entities/Light.es index b25c8f8d..7427f6a2 100644 --- a/SamTSE/Sources/Entities/Light.es +++ b/SamTSE/Sources/Entities/Light.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 200 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/LightStyle.es b/SamTSE/Sources/Entities/LightStyle.es index 03b80416..87bedeb2 100644 --- a/SamTSE/Sources/Entities/LightStyle.es +++ b/SamTSE/Sources/Entities/LightStyle.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 201 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Lightning.es b/SamTSE/Sources/Entities/Lightning.es index 3cc7433d..a391f5cc 100644 --- a/SamTSE/Sources/Entities/Lightning.es +++ b/SamTSE/Sources/Entities/Lightning.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 607 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Mamut.es b/SamTSE/Sources/Entities/Mamut.es index f63825b1..998aa240 100644 --- a/SamTSE/Sources/Entities/Mamut.es +++ b/SamTSE/Sources/Entities/Mamut.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 327 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Mamutman.es b/SamTSE/Sources/Entities/Mamutman.es index c97f4881..6d3ba8f7 100644 --- a/SamTSE/Sources/Entities/Mamutman.es +++ b/SamTSE/Sources/Entities/Mamutman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 326 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Mantaman.es b/SamTSE/Sources/Entities/Mantaman.es index dbb6d0a0..8aaa77b1 100644 --- a/SamTSE/Sources/Entities/Mantaman.es +++ b/SamTSE/Sources/Entities/Mantaman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 329 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Marker.es b/SamTSE/Sources/Entities/Marker.es index 8549edb8..93d0250c 100644 --- a/SamTSE/Sources/Entities/Marker.es +++ b/SamTSE/Sources/Entities/Marker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 202 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MessageHolder.es b/SamTSE/Sources/Entities/MessageHolder.es index d103ef02..d22f1f6d 100644 --- a/SamTSE/Sources/Entities/MessageHolder.es +++ b/SamTSE/Sources/Entities/MessageHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 226 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MessageItem.es b/SamTSE/Sources/Entities/MessageItem.es index 5973ec86..2a35d51e 100644 --- a/SamTSE/Sources/Entities/MessageItem.es +++ b/SamTSE/Sources/Entities/MessageItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 807 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MirrorMarker.es b/SamTSE/Sources/Entities/MirrorMarker.es index 5cc754cc..7dac88e3 100644 --- a/SamTSE/Sources/Entities/MirrorMarker.es +++ b/SamTSE/Sources/Entities/MirrorMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 218 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/ModelDestruction.es b/SamTSE/Sources/Entities/ModelDestruction.es index 162b5c74..43efe49b 100644 --- a/SamTSE/Sources/Entities/ModelDestruction.es +++ b/SamTSE/Sources/Entities/ModelDestruction.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 217 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/ModelHolder.es b/SamTSE/Sources/Entities/ModelHolder.es index add1c6c9..be26ccec 100644 --- a/SamTSE/Sources/Entities/ModelHolder.es +++ b/SamTSE/Sources/Entities/ModelHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 203 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/ModelHolder2.es b/SamTSE/Sources/Entities/ModelHolder2.es index fbb8d3ba..857af014 100644 --- a/SamTSE/Sources/Entities/ModelHolder2.es +++ b/SamTSE/Sources/Entities/ModelHolder2.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 210 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MovingBrush.es b/SamTSE/Sources/Entities/MovingBrush.es index edc859c5..a8f6938b 100644 --- a/SamTSE/Sources/Entities/MovingBrush.es +++ b/SamTSE/Sources/Entities/MovingBrush.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 101 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MovingBrushMarker.es b/SamTSE/Sources/Entities/MovingBrushMarker.es index b1711e37..f3c8b510 100644 --- a/SamTSE/Sources/Entities/MovingBrushMarker.es +++ b/SamTSE/Sources/Entities/MovingBrushMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 102 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MusicChanger.es b/SamTSE/Sources/Entities/MusicChanger.es index 69c90f59..d4f72e03 100644 --- a/SamTSE/Sources/Entities/MusicChanger.es +++ b/SamTSE/Sources/Entities/MusicChanger.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 225 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/MusicHolder.es b/SamTSE/Sources/Entities/MusicHolder.es index 0f82aebb..01a0682f 100644 --- a/SamTSE/Sources/Entities/MusicHolder.es +++ b/SamTSE/Sources/Entities/MusicHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 222 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/NavigationMarker.es b/SamTSE/Sources/Entities/NavigationMarker.es index 468d85e2..979e96ea 100644 --- a/SamTSE/Sources/Entities/NavigationMarker.es +++ b/SamTSE/Sources/Entities/NavigationMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 704 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/ParticlesHolder.es b/SamTSE/Sources/Entities/ParticlesHolder.es index ad29aca1..ee79e021 100644 --- a/SamTSE/Sources/Entities/ParticlesHolder.es +++ b/SamTSE/Sources/Entities/ParticlesHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 223 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Pendulum.es b/SamTSE/Sources/Entities/Pendulum.es index d6afe941..f1cef3ff 100644 --- a/SamTSE/Sources/Entities/Pendulum.es +++ b/SamTSE/Sources/Entities/Pendulum.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 106 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Pipebomb.es b/SamTSE/Sources/Entities/Pipebomb.es index 753eb032..a9d4b2fb 100644 --- a/SamTSE/Sources/Entities/Pipebomb.es +++ b/SamTSE/Sources/Entities/Pipebomb.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 503 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Player.es b/SamTSE/Sources/Entities/Player.es index db4c1939..7ba5d5e5 100644 --- a/SamTSE/Sources/Entities/Player.es +++ b/SamTSE/Sources/Entities/Player.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 401 %{ diff --git a/SamTSE/Sources/Entities/PlayerActionMarker.es b/SamTSE/Sources/Entities/PlayerActionMarker.es index 34e6609d..8cb7a974 100644 --- a/SamTSE/Sources/Entities/PlayerActionMarker.es +++ b/SamTSE/Sources/Entities/PlayerActionMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 407 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerAnimator.es b/SamTSE/Sources/Entities/PlayerAnimator.es index 7481797d..c0a515d0 100644 --- a/SamTSE/Sources/Entities/PlayerAnimator.es +++ b/SamTSE/Sources/Entities/PlayerAnimator.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 406 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerMarker.es b/SamTSE/Sources/Entities/PlayerMarker.es index e6f314e7..68fe174d 100644 --- a/SamTSE/Sources/Entities/PlayerMarker.es +++ b/SamTSE/Sources/Entities/PlayerMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 404 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerView.es b/SamTSE/Sources/Entities/PlayerView.es index 289327f2..b3375ded 100644 --- a/SamTSE/Sources/Entities/PlayerView.es +++ b/SamTSE/Sources/Entities/PlayerView.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 403 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerWeapons.es b/SamTSE/Sources/Entities/PlayerWeapons.es index 20145cab..5f0a29aa 100644 --- a/SamTSE/Sources/Entities/PlayerWeapons.es +++ b/SamTSE/Sources/Entities/PlayerWeapons.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 402 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerWeaponsEffects.es b/SamTSE/Sources/Entities/PlayerWeaponsEffects.es index 32a194a8..b59bec97 100644 --- a/SamTSE/Sources/Entities/PlayerWeaponsEffects.es +++ b/SamTSE/Sources/Entities/PlayerWeaponsEffects.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 405 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerWeaponsHD.es b/SamTSE/Sources/Entities/PlayerWeaponsHD.es index a4ec565b..8347c1f4 100644 --- a/SamTSE/Sources/Entities/PlayerWeaponsHD.es +++ b/SamTSE/Sources/Entities/PlayerWeaponsHD.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 402 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PlayerWeapons_old.es b/SamTSE/Sources/Entities/PlayerWeapons_old.es index 20145cab..5f0a29aa 100644 --- a/SamTSE/Sources/Entities/PlayerWeapons_old.es +++ b/SamTSE/Sources/Entities/PlayerWeapons_old.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 402 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Projectile.es b/SamTSE/Sources/Entities/Projectile.es index 819e08ed..88041e00 100644 --- a/SamTSE/Sources/Entities/Projectile.es +++ b/SamTSE/Sources/Entities/Projectile.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 501 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PyramidSpaceShip.es b/SamTSE/Sources/Entities/PyramidSpaceShip.es index 7ff69e9b..d36382fe 100644 --- a/SamTSE/Sources/Entities/PyramidSpaceShip.es +++ b/SamTSE/Sources/Entities/PyramidSpaceShip.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 609 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/PyramidSpaceShipMarker.es b/SamTSE/Sources/Entities/PyramidSpaceShipMarker.es index 8bbe09ec..a04cb9ef 100644 --- a/SamTSE/Sources/Entities/PyramidSpaceShipMarker.es +++ b/SamTSE/Sources/Entities/PyramidSpaceShipMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 610 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Reminder.es b/SamTSE/Sources/Entities/Reminder.es index e527adda..f1f03fb0 100644 --- a/SamTSE/Sources/Entities/Reminder.es +++ b/SamTSE/Sources/Entities/Reminder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 703 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/RobotDriving.es b/SamTSE/Sources/Entities/RobotDriving.es index 1abfbacd..de93d891 100644 --- a/SamTSE/Sources/Entities/RobotDriving.es +++ b/SamTSE/Sources/Entities/RobotDriving.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 333 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/RobotFixed.es b/SamTSE/Sources/Entities/RobotFixed.es index e69de29b..d70515e2 100644 --- a/SamTSE/Sources/Entities/RobotFixed.es +++ b/SamTSE/Sources/Entities/RobotFixed.es @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + diff --git a/SamTSE/Sources/Entities/RobotFlying.es b/SamTSE/Sources/Entities/RobotFlying.es index 22c93c59..d09641c0 100644 --- a/SamTSE/Sources/Entities/RobotFlying.es +++ b/SamTSE/Sources/Entities/RobotFlying.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 334 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/RollingStone.es b/SamTSE/Sources/Entities/RollingStone.es index 0775a1bf..817801f7 100644 --- a/SamTSE/Sources/Entities/RollingStone.es +++ b/SamTSE/Sources/Entities/RollingStone.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 604 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Scorpman.es b/SamTSE/Sources/Entities/Scorpman.es index 29832d42..0adac631 100644 --- a/SamTSE/Sources/Entities/Scorpman.es +++ b/SamTSE/Sources/Entities/Scorpman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 306 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Ship.es b/SamTSE/Sources/Entities/Ship.es index ae87dbfe..3e46897b 100644 --- a/SamTSE/Sources/Entities/Ship.es +++ b/SamTSE/Sources/Entities/Ship.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 103 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/ShipMarker.es b/SamTSE/Sources/Entities/ShipMarker.es index d89dda6a..0ea84f0a 100644 --- a/SamTSE/Sources/Entities/ShipMarker.es +++ b/SamTSE/Sources/Entities/ShipMarker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 104 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/SoundHolder.es b/SamTSE/Sources/Entities/SoundHolder.es index 210c05f6..e804477a 100644 --- a/SamTSE/Sources/Entities/SoundHolder.es +++ b/SamTSE/Sources/Entities/SoundHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + /* * Sound Holder. */ diff --git a/SamTSE/Sources/Entities/StormController.es b/SamTSE/Sources/Entities/StormController.es index a9006f70..e5bd78d0 100644 --- a/SamTSE/Sources/Entities/StormController.es +++ b/SamTSE/Sources/Entities/StormController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 606 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Switch.es b/SamTSE/Sources/Entities/Switch.es index f756f467..c5368605 100644 --- a/SamTSE/Sources/Entities/Switch.es +++ b/SamTSE/Sources/Entities/Switch.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 209 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Teleport.es b/SamTSE/Sources/Entities/Teleport.es index 74fa93ae..b1654400 100644 --- a/SamTSE/Sources/Entities/Teleport.es +++ b/SamTSE/Sources/Entities/Teleport.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 219 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/TouchField.es b/SamTSE/Sources/Entities/TouchField.es index 458a102d..e9a985a9 100644 --- a/SamTSE/Sources/Entities/TouchField.es +++ b/SamTSE/Sources/Entities/TouchField.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 206 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Trigger.es b/SamTSE/Sources/Entities/Trigger.es index f09cb218..6987fe24 100644 --- a/SamTSE/Sources/Entities/Trigger.es +++ b/SamTSE/Sources/Entities/Trigger.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 205 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Twister.es b/SamTSE/Sources/Entities/Twister.es index 2a584035..24e45c88 100644 --- a/SamTSE/Sources/Entities/Twister.es +++ b/SamTSE/Sources/Entities/Twister.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 507 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/VoiceHolder.es b/SamTSE/Sources/Entities/VoiceHolder.es index 208d9501..6bef6cfe 100644 --- a/SamTSE/Sources/Entities/VoiceHolder.es +++ b/SamTSE/Sources/Entities/VoiceHolder.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 231 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Walker.es b/SamTSE/Sources/Entities/Walker.es index 80e61089..1d3a9d94 100644 --- a/SamTSE/Sources/Entities/Walker.es +++ b/SamTSE/Sources/Entities/Walker.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 324 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/WatchPlayers.es b/SamTSE/Sources/Entities/WatchPlayers.es index 19679b9c..0875e59a 100644 --- a/SamTSE/Sources/Entities/WatchPlayers.es +++ b/SamTSE/Sources/Entities/WatchPlayers.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 702 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Watcher.es b/SamTSE/Sources/Entities/Watcher.es index a37c4965..5c378b57 100644 --- a/SamTSE/Sources/Entities/Watcher.es +++ b/SamTSE/Sources/Entities/Watcher.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 700 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Water.es b/SamTSE/Sources/Entities/Water.es index f59c9d00..2b7d3841 100644 --- a/SamTSE/Sources/Entities/Water.es +++ b/SamTSE/Sources/Entities/Water.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 508 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/WeaponItem.es b/SamTSE/Sources/Entities/WeaponItem.es index 08071f3f..b573cd5b 100644 --- a/SamTSE/Sources/Entities/WeaponItem.es +++ b/SamTSE/Sources/Entities/WeaponItem.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 802 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Werebull.es b/SamTSE/Sources/Entities/Werebull.es index 8b0efc84..49b51d7a 100644 --- a/SamTSE/Sources/Entities/Werebull.es +++ b/SamTSE/Sources/Entities/Werebull.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 307 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/Woman.es b/SamTSE/Sources/Entities/Woman.es index b9c9e99f..7dd4bf37 100644 --- a/SamTSE/Sources/Entities/Woman.es +++ b/SamTSE/Sources/Entities/Woman.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 320 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/WorldBase.es b/SamTSE/Sources/Entities/WorldBase.es index 7f8ca634..b3ffa2f2 100644 --- a/SamTSE/Sources/Entities/WorldBase.es +++ b/SamTSE/Sources/Entities/WorldBase.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 100 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/WorldLink.es b/SamTSE/Sources/Entities/WorldLink.es index f01f0f70..cfb3124c 100644 --- a/SamTSE/Sources/Entities/WorldLink.es +++ b/SamTSE/Sources/Entities/WorldLink.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 214 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Entities/WorldSettingsController.es b/SamTSE/Sources/Entities/WorldSettingsController.es index 14fc9af1..a863ca18 100644 --- a/SamTSE/Sources/Entities/WorldSettingsController.es +++ b/SamTSE/Sources/Entities/WorldSettingsController.es @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + 605 %{ #include "Entities/StdH/StdH.h" diff --git a/SamTSE/Sources/Models/Enemies/Mamut/MAMUT.H b/SamTSE/Sources/Models/Enemies/Mamut/MAMUT.H index b6a67b13..d026b884 100644 --- a/SamTSE/Sources/Models/Enemies/Mamut/MAMUT.H +++ b/SamTSE/Sources/Models/Enemies/Mamut/MAMUT.H @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define MAMUT_ANIM_DEFAULT_ANIMATION 0 #define MAMUT_ANIM_ATTACK01 1 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h index eabd5958..ab096970 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Berretta01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define BERRETTA01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h index 24ef491c..d99e5ff6 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Cap01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define CAP01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h index d7d0fdd9..5a14386d 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Hat01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define HAT01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h index 660afb5a..ed7d189a 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Helmet01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define HELMET01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h index d850220c..2d6ac0d0 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNAPSACK01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h index 48cfa1a0..4287faf0 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack04.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNAPSACK04_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h index bfe42519..b5d503d2 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/KnapSack05.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNAPSACK05_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h index 8a014f51..f27afa82 100644 --- a/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h +++ b/SamTSE/Sources/Models/Player_old/SeriousSamOld/Misc/Knife01.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define KNIFE01_ANIM_DEFAULT_ANIMATION 0 diff --git a/SamTSE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h b/SamTSE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h index 2ee62e00..4e62b733 100644 --- a/SamTSE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h +++ b/SamTSE/Sources/Models/WeaponsHD/Laser/Projectile/LaserProjectile.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define LASERPROJECTILE_ANIM_DEFAULT 0 diff --git a/SamTSE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h b/SamTSE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h index 07b1f479..78bf1d18 100644 --- a/SamTSE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h +++ b/SamTSE/Sources/Models/WeaponsHD/RocketLauncher/Projectile/Rocket.h @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define ROCKET_ANIM_DEFAULT 0 #define ROCKET_ANIM_ITEM 1 diff --git a/SamTSE/Sources/Models/headers/Enemies/Mamut/MAMUT.H b/SamTSE/Sources/Models/headers/Enemies/Mamut/MAMUT.H index b6a67b13..d026b884 100644 --- a/SamTSE/Sources/Models/headers/Enemies/Mamut/MAMUT.H +++ b/SamTSE/Sources/Models/headers/Enemies/Mamut/MAMUT.H @@ -1,3 +1,18 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // Animation names #define MAMUT_ANIM_DEFAULT_ANIMATION 0 #define MAMUT_ANIM_ATTACK01 1 diff --git a/SamTSE/Sources/amp11lib/amp11lib.cpp b/SamTSE/Sources/amp11lib/amp11lib.cpp index 8a785000..a06defb7 100644 --- a/SamTSE/Sources/amp11lib/amp11lib.cpp +++ b/SamTSE/Sources/amp11lib/amp11lib.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11lib - library interface layer and asynchronious player -// Copyright (c) 1999-2000 Alen Ladavac -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTSE/Sources/amp11lib/amp11lib.h b/SamTSE/Sources/amp11lib/amp11lib.h index 047257da..702390c5 100644 --- a/SamTSE/Sources/amp11lib/amp11lib.h +++ b/SamTSE/Sources/amp11lib/amp11lib.h @@ -1,3 +1,17 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // AMP11LIB_EXPORTS should be defined when compiling the DLL, and not defined otherwise #ifdef _WIN32 diff --git a/SamTSE/Sources/amp11lib/amp1dec.cpp b/SamTSE/Sources/amp11lib/amp1dec.cpp index f4349eda..4cc58ead 100644 --- a/SamTSE/Sources/amp11lib/amp1dec.cpp +++ b/SamTSE/Sources/amp11lib/amp1dec.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11 - an Audio-MPEG decoder - layer 1 decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include "ampdec.h" diff --git a/SamTSE/Sources/amp11lib/amp2dec.cpp b/SamTSE/Sources/amp11lib/amp2dec.cpp index 2cdfc3bd..2f1657bf 100644 --- a/SamTSE/Sources/amp11lib/amp2dec.cpp +++ b/SamTSE/Sources/amp11lib/amp2dec.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11 - an Audio-MPEG decoder - layer 2 decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include "ampdec.h" diff --git a/SamTSE/Sources/amp11lib/amp3dec.cpp b/SamTSE/Sources/amp11lib/amp3dec.cpp index 7c1431e9..94fbe1f8 100644 --- a/SamTSE/Sources/amp11lib/amp3dec.cpp +++ b/SamTSE/Sources/amp11lib/amp3dec.cpp @@ -1,7 +1,19 @@ -// amp11 - an Audio-MPEG decoder - layer 3 decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// amp11 - an Audio-MPEG decoder - layer 3 decoder // huffman tables were taken from mpg123 by Michael Hipp #include diff --git a/SamTSE/Sources/amp11lib/ampdec.cpp b/SamTSE/Sources/amp11lib/ampdec.cpp index bf5e9062..16bbd743 100644 --- a/SamTSE/Sources/amp11lib/ampdec.cpp +++ b/SamTSE/Sources/amp11lib/ampdec.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // amp11 - an Audio-MPEG decoder - decoder -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTSE/Sources/amp11lib/ampdec.h b/SamTSE/Sources/amp11lib/ampdec.h index 9e8a7bc3..2dfefd21 100644 --- a/SamTSE/Sources/amp11lib/ampdec.h +++ b/SamTSE/Sources/amp11lib/ampdec.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __MPDECODE_H #define __MPDECODE_H diff --git a/SamTSE/Sources/amp11lib/ampsynth.cpp b/SamTSE/Sources/amp11lib/ampsynth.cpp index 34429ef3..507540c1 100644 --- a/SamTSE/Sources/amp11lib/ampsynth.cpp +++ b/SamTSE/Sources/amp11lib/ampsynth.cpp @@ -1,7 +1,19 @@ -// amp11 - an Audio-MPEG decoder - synthesizer -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +// amp11 - an Audio-MPEG decoder - synthesizer // some ideas regarding optimization of the subband synthesis // were taken from mpg123 by Michael Hipp diff --git a/SamTSE/Sources/amp11lib/binfile/binfarc.cpp b/SamTSE/Sources/amp11lib/binfile/binfarc.cpp index 2c406971..b5ba7574 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfarc.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfarc.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - archive files -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "binfarc.h" diff --git a/SamTSE/Sources/amp11lib/binfile/binfarc.h b/SamTSE/Sources/amp11lib/binfile/binfarc.h index 6b827aea..a0b732e9 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfarc.h +++ b/SamTSE/Sources/amp11lib/binfile/binfarc.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFARC_H #define __BINFARC_H diff --git a/SamTSE/Sources/amp11lib/binfile/binfcon.cpp b/SamTSE/Sources/amp11lib/binfile/binfcon.cpp index deb7b450..09100f15 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfcon.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfcon.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - console io -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef NOUNISTD #if defined(WIN32)||defined(DOS) diff --git a/SamTSE/Sources/amp11lib/binfile/binfcon.h b/SamTSE/Sources/amp11lib/binfile/binfcon.h index bb4d1f42..91189103 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfcon.h +++ b/SamTSE/Sources/amp11lib/binfile/binfcon.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFCON_H #define __BINFCON_H diff --git a/SamTSE/Sources/amp11lib/binfile/binfhttp.cpp b/SamTSE/Sources/amp11lib/binfile/binfhttp.cpp index 0846ffc5..76cc4f32 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfhttp.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfhttp.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - http receiver -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTSE/Sources/amp11lib/binfile/binfhttp.h b/SamTSE/Sources/amp11lib/binfile/binfhttp.h index d021de4c..aade2b94 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfhttp.h +++ b/SamTSE/Sources/amp11lib/binfile/binfhttp.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFHTTP_H #define __BINFHTTP_H diff --git a/SamTSE/Sources/amp11lib/binfile/binfile.cpp b/SamTSE/Sources/amp11lib/binfile/binfile.cpp index 81f22ff3..64325a86 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfile.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfile.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - base class -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include "binfile.h" diff --git a/SamTSE/Sources/amp11lib/binfile/binfile.h b/SamTSE/Sources/amp11lib/binfile/binfile.h index d81d9e71..79e7fab8 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfile.h +++ b/SamTSE/Sources/amp11lib/binfile/binfile.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFILE_H #define __BINFILE_H diff --git a/SamTSE/Sources/amp11lib/binfile/binfilef.cpp b/SamTSE/Sources/amp11lib/binfile/binfilef.cpp index b3fd0a98..f1c9fe1a 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfilef.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfilef.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - float functions -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "binfile.h" diff --git a/SamTSE/Sources/amp11lib/binfile/binfmem.cpp b/SamTSE/Sources/amp11lib/binfile/binfmem.cpp index f4d8f8cb..f324b5cf 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfmem.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfmem.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - memory files -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTSE/Sources/amp11lib/binfile/binfmem.h b/SamTSE/Sources/amp11lib/binfile/binfmem.h index 939410eb..51518af8 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfmem.h +++ b/SamTSE/Sources/amp11lib/binfile/binfmem.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFMEM_H #define __BINFMEM_H diff --git a/SamTSE/Sources/amp11lib/binfile/binfpllx.cpp b/SamTSE/Sources/amp11lib/binfile/binfpllx.cpp index b9419ce4..86650807 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfpllx.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfpllx.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - linux sound playback -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef LINUX #error must compile for LINUX diff --git a/SamTSE/Sources/amp11lib/binfile/binfpllx.h b/SamTSE/Sources/amp11lib/binfile/binfpllx.h index 484afc58..69638ed0 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfpllx.h +++ b/SamTSE/Sources/amp11lib/binfile/binfpllx.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef LINUX #error must compile for LINUX #endif diff --git a/SamTSE/Sources/amp11lib/binfile/binfplnt.cpp b/SamTSE/Sources/amp11lib/binfile/binfplnt.cpp index 571a8e01..06ba1968 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfplnt.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfplnt.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - windows nt/95 sound playback -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef WIN32 #error must compile for WIN32 diff --git a/SamTSE/Sources/amp11lib/binfile/binfplnt.h b/SamTSE/Sources/amp11lib/binfile/binfplnt.h index 1688a602..2f7bf5dc 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfplnt.h +++ b/SamTSE/Sources/amp11lib/binfile/binfplnt.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef WIN32 #error must compile for NT #endif diff --git a/SamTSE/Sources/amp11lib/binfile/binfplsb.cpp b/SamTSE/Sources/amp11lib/binfile/binfplsb.cpp index cbd9a32a..b41a38bf 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfplsb.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfplsb.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - DOS/SB16 sound playback -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTSE/Sources/amp11lib/binfile/binfplsb.h b/SamTSE/Sources/amp11lib/binfile/binfplsb.h index 177a68fb..9ac95ba6 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfplsb.h +++ b/SamTSE/Sources/amp11lib/binfile/binfplsb.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef DOS #error must compile for DOS4G or DJGPP #endif diff --git a/SamTSE/Sources/amp11lib/binfile/binfplwv.cpp b/SamTSE/Sources/amp11lib/binfile/binfplwv.cpp index 22089050..3aa0b578 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfplwv.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfplwv.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - WAV format writer -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "binfplwv.h" diff --git a/SamTSE/Sources/amp11lib/binfile/binfplwv.h b/SamTSE/Sources/amp11lib/binfile/binfplwv.h index 07a9865e..6e3d7bb3 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfplwv.h +++ b/SamTSE/Sources/amp11lib/binfile/binfplwv.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __WAVPLAYBINFILE_H #define __WAVPLAYBINFILE_H diff --git a/SamTSE/Sources/amp11lib/binfile/binfstd.cpp b/SamTSE/Sources/amp11lib/binfile/binfstd.cpp index 3aa4cacb..4deca850 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfstd.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binfstd.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - standard disk files -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #ifndef NOUNISTD #include diff --git a/SamTSE/Sources/amp11lib/binfile/binfstd.h b/SamTSE/Sources/amp11lib/binfile/binfstd.h index f4c705ca..ec289039 100644 --- a/SamTSE/Sources/amp11lib/binfile/binfstd.h +++ b/SamTSE/Sources/amp11lib/binfile/binfstd.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFSTD_H #define __BINFSTD_H diff --git a/SamTSE/Sources/amp11lib/binfile/binftcp.cpp b/SamTSE/Sources/amp11lib/binfile/binftcp.cpp index 8afab9b0..276f8765 100644 --- a/SamTSE/Sources/amp11lib/binfile/binftcp.cpp +++ b/SamTSE/Sources/amp11lib/binfile/binftcp.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // binfile - class library for files/streams - tcp io -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #if defined(WIN32)||defined(UNIX) diff --git a/SamTSE/Sources/amp11lib/binfile/binftcp.h b/SamTSE/Sources/amp11lib/binfile/binftcp.h index 4c922f91..5e693459 100644 --- a/SamTSE/Sources/amp11lib/binfile/binftcp.h +++ b/SamTSE/Sources/amp11lib/binfile/binftcp.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __BINFTCP_H #define __BINFTCP_H diff --git a/SamTSE/Sources/amp11lib/binfile/ptypes.h b/SamTSE/Sources/amp11lib/binfile/ptypes.h index 214ed5db..c0380e51 100644 --- a/SamTSE/Sources/amp11lib/binfile/ptypes.h +++ b/SamTSE/Sources/amp11lib/binfile/ptypes.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __PTYPES_H #define __PTYPES_H diff --git a/SamTSE/Sources/amp11lib/mpgsplit.cpp b/SamTSE/Sources/amp11lib/mpgsplit.cpp index 7c724299..832e21ff 100644 --- a/SamTSE/Sources/amp11lib/mpgsplit.cpp +++ b/SamTSE/Sources/amp11lib/mpgsplit.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // MPEG stream splitter -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include "mpgsplit.h" diff --git a/SamTSE/Sources/amp11lib/mpgsplit.h b/SamTSE/Sources/amp11lib/mpgsplit.h index b6f91f2e..39faf798 100644 --- a/SamTSE/Sources/amp11lib/mpgsplit.h +++ b/SamTSE/Sources/amp11lib/mpgsplit.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include "binfile.h" class mpegsplitstream : public binfile diff --git a/SamTSE/Sources/amp11lib/timer.cpp b/SamTSE/Sources/amp11lib/timer.cpp index a23e1015..0529a45d 100644 --- a/SamTSE/Sources/amp11lib/timer.cpp +++ b/SamTSE/Sources/amp11lib/timer.cpp @@ -1,6 +1,19 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + // just a timer for WC/DOS4G -// Copyright (c) 1997-99 Niklas Beisert -// See COPYING (GNU Library General Public License 2) for license #include #include diff --git a/SamTSE/Sources/amp11lib/timer.h b/SamTSE/Sources/amp11lib/timer.h index fae3d1a6..7a0e8ded 100644 --- a/SamTSE/Sources/amp11lib/timer.h +++ b/SamTSE/Sources/amp11lib/timer.h @@ -1,3 +1,18 @@ +/* Copyright (c) 1997-2001 Niklas Beisert, Alen Ladavac. +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #ifndef __DOS4G__ #error must compile for DOS4G #endif diff --git a/debian/README.Debian b/debian/README.Debian index 1a4acd13..9f9c15b8 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -59,7 +59,6 @@ In accordance with the naming convention, we get the following location of the e /usr/games/serioussam-vk-ded /usr/games/serioussam-vk-mkfont /usr/games/serioussam-vk-texconv -/usr/lib/games/serioussam-vk/libEngine.so /usr/lib/games/serioussam-vk/libShaders.so /usr/lib/games/serioussam-vk/libGame.so /usr/lib/games/serioussam-vk/libEntities.so @@ -68,7 +67,6 @@ In accordance with the naming convention, we get the following location of the e /usr/games/serioussamse-vk-ded /usr/games/serioussamse-vk-mkfont /usr/games/serioussamse-vk-texconv -/usr/lib/games/serioussam-vk-se/libEngineMP.so /usr/lib/games/serioussam-vk-se/libShaders.so /usr/lib/games/serioussam-vk-se/libGameMP.so /usr/lib/games/serioussam-vk-se/libEntitiesMP.so @@ -140,6 +138,43 @@ If you bought a physical copy of the game and you have an ISO of your disk, you Game resources are located in the Install directory of the disk. Just copy all the *.gro files from there, as well as the Levels directory to directories ~/.serioussam-vk and ~/.serioussamse-vk, respectively, for games Serious Sam: The First Encounter and Serious Sam: The Second Encounter. +Demo version +============= + +This implementation of the engine supports the use of content from the demo version of the game. When the game starts, +the engine determines the installed game content, and if it finds content from the demo version, it turns on the mode for using the demo version of the content. +A demo version of the game can be obtained from many places. For example: + +https://www.moddb.com/downloads/serious-sam-the-first-encounter-demo +https://www.moddb.com/downloads/serious-sam-the-second-encounter +https://www.gamefront.com/games/serious-sam/file/serioussamdemo-exe +https://www.gamefront.com/games/serious-sam-the-second-encounter/file/serious-sam-the-second-encounter-demo + +The most convenient way is to download using the wget from the WebArchive. +To install content from the demo version of the game, open a terminal and run the following commands: + +sudo apt install p7zip + +wget https://archive.org/download/SeriousSamDemo/SeriousSamDemo.exe +wget https://archive.org/download/SeriousSamPatches/serioussampatch105_usa.exe +7z x SeriousSamDemo.exe +7z x -y serioussampatch105_usa.exe +mkdir ~/.serioussam-vk +cp -ax Disk1/* ~/.serioussam-vk +rm -fr Disk1 + +wget https://archive.org/download/serioussamsedemo/SeriousSamSEDemo.exe +wget https://archive.org/download/SeriousSamPatches/secondencounterpatch107_usa.exe +7z x SeriousSamSEDemo.exe +7z x -y secondencounterpatch107_usa.exe +mkdir ~/.serioussamse-vk +cp -ax Disk1/* ~/.serioussamse-vk +rm -fr Disk1 + +When you first launch the game, goto Menu -> Options -> Execute Addons and select the default option. +The demo version uses old settings scripts. New ones you can take here: https://github.com/tx00100xt/SeriousSamClassic-VK +Just rewrite the Scripts directory replacing the files + Launching the game ================== diff --git a/debian/README.source b/debian/README.source index 1a4acd13..08bba8d3 100644 --- a/debian/README.source +++ b/debian/README.source @@ -59,7 +59,6 @@ In accordance with the naming convention, we get the following location of the e /usr/games/serioussam-vk-ded /usr/games/serioussam-vk-mkfont /usr/games/serioussam-vk-texconv -/usr/lib/games/serioussam-vk/libEngine.so /usr/lib/games/serioussam-vk/libShaders.so /usr/lib/games/serioussam-vk/libGame.so /usr/lib/games/serioussam-vk/libEntities.so @@ -68,7 +67,6 @@ In accordance with the naming convention, we get the following location of the e /usr/games/serioussamse-vk-ded /usr/games/serioussamse-vk-mkfont /usr/games/serioussamse-vk-texconv -/usr/lib/games/serioussam-vk-se/libEngineMP.so /usr/lib/games/serioussam-vk-se/libShaders.so /usr/lib/games/serioussam-vk-se/libGameMP.so /usr/lib/games/serioussam-vk-se/libEntitiesMP.so @@ -140,6 +138,42 @@ If you bought a physical copy of the game and you have an ISO of your disk, you Game resources are located in the Install directory of the disk. Just copy all the *.gro files from there, as well as the Levels directory to directories ~/.serioussam-vk and ~/.serioussamse-vk, respectively, for games Serious Sam: The First Encounter and Serious Sam: The Second Encounter. +============= + +This implementation of the engine supports the use of content from the demo version of the game. When the game starts, +the engine determines the installed game content, and if it finds content from the demo version, it turns on the mode for using the demo version of the content. +A demo version of the game can be obtained from many places. For example: + +https://www.moddb.com/downloads/serious-sam-the-first-encounter-demo +https://www.moddb.com/downloads/serious-sam-the-second-encounter +https://www.gamefront.com/games/serious-sam/file/serioussamdemo-exe +https://www.gamefront.com/games/serious-sam-the-second-encounter/file/serious-sam-the-second-encounter-demo + +The most convenient way is to download using the wget from the WebArchive. +To install content from the demo version of the game, open a terminal and run the following commands: + +sudo apt install p7zip + +wget https://archive.org/download/SeriousSamDemo/SeriousSamDemo.exe +wget https://archive.org/download/SeriousSamPatches/serioussampatch105_usa.exe +7z x SeriousSamDemo.exe +7z x -y serioussampatch105_usa.exe +mkdir ~/.serioussam-vk +cp -ax Disk1/* ~/.serioussam-vk +rm -fr Disk1 + +wget https://archive.org/download/serioussamsedemo/SeriousSamSEDemo.exe +wget https://archive.org/download/SeriousSamPatches/secondencounterpatch107_usa.exe +7z x SeriousSamSEDemo.exe +7z x -y secondencounterpatch107_usa.exe +mkdir ~/.serioussamse-vk +cp -ax Disk1/* ~/.serioussamse-vk +rm -fr Disk1 + +When you first launch the game, goto Menu -> Options -> Execute Addons and select the default option. +The demo version uses old settings scripts. New ones you can take here: https://github.com/tx00100xt/SeriousSamClassic-VK +Just rewrite the Scripts directory replacing the files + Launching the game ================== diff --git a/debian/copyright b/debian/copyright index 9b502a23..1fcc6d99 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,18 +3,30 @@ Upstream-Name: serioussam-vk Upstream-Contact: https://github.com/tx00100xt/SeriousSamClassic-VK/issues/ Alexander Pavlov Source: https://github.com/tx00100xt/SeriousSamClassic-VK -Files-Excluded: appimage +Files-Excluded: .github + appimage + debian flatpak Images man templates + build-appimage.sh + build-linux32demo.sh + build-linux64demo.sh + run_game.sh + run_game_hud.sh + run_server.sh SamTFE/Bin SamTFE/Controls SamTFE/Data SamTFE/Demos + SamTFE/GameAgent SamTFE/Help SamTFE/Levels + SamTFE/Mods + SamTFE/ModEXT.txt SamTFE/Players + SamTFE/SaveGame SamTFE/Scripts SamTFE/Sources/***/*.ini SamTFE/Sources/Engine/zlib @@ -29,6 +41,56 @@ Files-Excluded: appimage SamTFE/Sources/SeriousSam/SplashMask.bmp SamTFE/Sources/SeriousSkaStudio SamTFE/Sources/WorldEditor + SamTFE/Sources/MakeFONT/MakeFONT.vcxproj.user + SamTFE/Sources/MakeFONT/MakeFONT.vcxproj + SamTFE/Sources/MakeFONT/MakeFONT.vcxproj.filters + SamTFE/Sources/amp11lib/amp11lib.vcxproj.filters + SamTFE/Sources/amp11lib/amp11lib.vcxproj.user + SamTFE/Sources/amp11lib/amp11lib.vcxproj + SamTFE/Sources/Engine/Engine.vcxproj + SamTFE/Sources/Engine/Sound/DSOUND.H + SamTFE/Sources/Engine/Engine.vcxproj.user + SamTFE/Sources/Engine/Engine.vcxproj.filters + SamTFE/Sources/SeriousSam/nocursor.cur + SamTFE/Sources/SeriousSam/SeriousSam.vcxproj + SamTFE/Sources/SeriousSam/SeriousSam.vcxproj.user + SamTFE/Sources/SeriousSam/SeriousSam.rc + SamTFE/Sources/SeriousSam/SeriousSam.vcxproj.filters + SamTFE/Sources/SeriousSam/res + SamTFE/Sources/build-linux64.sh + SamTFE/Sources/DecodeReport/DecodeReport.vcxproj.user + SamTFE/Sources/DecodeReport/DecodeReport.vcxproj.filters + SamTFE/Sources/DecodeReport/DecodeReport.vcxproj + SamTFE/Sources/GameMP/Game.vcxproj.user + SamTFE/Sources/GameMP/Game.vcxproj + SamTFE/Sources/GameMP/Game.user + SamTFE/Sources/TEXConv/TEXConv.vcxproj.filters + SamTFE/Sources/TEXConv/TEXConv.vcxproj + SamTFE/Sources/TEXConv/TEXConv.vcxproj.user + SamTFE/Sources/Shaders/Shaders.vcxproj.user + SamTFE/Sources/Shaders/Shaders.vcxproj.filters + SamTFE/Sources/Shaders/Shaders.vcxproj + SamTFE/Sources/DedicatedServer/DedicatedServer.vcxproj.filters + SamTFE/Sources/DedicatedServer/DedicatedServer.vcxproj.user + SamTFE/Sources/DedicatedServer/icon1.ico + SamTFE/Sources/DedicatedServer/DedicatedServer.rc + SamTFE/Sources/DedicatedServer/DedicatedServer.vcxproj + SamTFE/Sources/DedicatedServer/ReadMe.txt + SamTFE/Sources/build-linux32.sh + SamTFE/Sources/Ecc/Ecc.vcxproj + SamTFE/Sources/Ecc/Ecc.vcxproj.user + SamTFE/Sources/Ecc/Ecc.vcxproj.filters + SamTFE/Sources/Entities/Entities.vcxproj.filters + SamTFE/Sources/Entities/Entities.vcxproj + SamTFE/Sources/Entities/LastFileID.txt + SamTFE/Sources/Entities/Entities.vcxproj.user + SamTFE/Sources/Depend/Depend.vcxproj + SamTFE/Sources/Depend/Depend.vcxproj.user + SamTFE/Sources/Depend/Depend.vcxproj.filters + SamTFE/Sources/EntitiesMP/EntitiesMP.vcxproj + SamTFE/Sources/EntitiesMP/EntitiesMP.vcxproj.filters + SamTFE/Sources/EntitiesMP/LastFileID.txt + SamTFE/Sources/EntitiesMP/EntitiesMP.vcxproj.user SamTFE/Temp SamTFE/Tools.Win32 SamTFE/VirtualTrees @@ -38,13 +100,19 @@ Files-Excluded: appimage SamTFE/Mods/SeriousSamTbn.tex SamTFE/Mods/XPLUSTbn.tex SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/CompiledSpirv + SamTFE/Sources/Models/Enemies/Robots + SamTFE/SE1_10b.gro SamTSE/Bin SamTSE/Controls SamTSE/Data SamTSE/Demos + SamTSE/GameAgent SamTSE/Help SamTSE/Levels + SamTSE/Mods + SamTSE/ModEXT.txt SamTSE/Players + SamTSE/SaveGame SamTSE/Scripts SamTSE/Sources/***/*.ini SamTSE/Sources/Engine/zlib @@ -59,6 +127,59 @@ Files-Excluded: appimage SamTSE/Sources/SeriousSam/SplashMask.bmp SamTSE/Sources/SeriousSkaStudio SamTSE/Sources/WorldEditor + SamTSE/Sources/MakeFONT/MakeFONT.vcxproj.user + SamTSE/Sources/MakeFONT/MakeFONT.vcxproj + SamTSE/Sources/MakeFONT/MakeFONT.vcxproj.filters + SamTSE/Sources/amp11lib/amp11lib.vcxproj.filters + SamTSE/Sources/amp11lib/amp11lib.vcxproj.user + SamTSE/Sources/amp11lib/amp11lib.vcxproj + SamTSE/Sources/Engine/Engine.vcxproj + SamTSE/Sources/Engine/Sound/DSOUND.H + SamTSE/Sources/Engine/Engine.vcxproj.user + SamTSE/Sources/Engine/Engine.vcxproj.filters + SamTSE/Sources/SeriousSam/nocursor.cur + SamTSE/Sources/SeriousSam/SeriousSam.vcxproj + SamTSE/Sources/SeriousSam/SeriousSam.vcxproj.user + SamTSE/Sources/SeriousSam/SeriousSam.rc + SamTSE/Sources/SeriousSam/SeriousSam.vcxproj.filters + SamTSE/Sources/SeriousSam/res + SamTSE/Sources/build-linux64.sh + SamTSE/Sources/DecodeReport/DecodeReport.vcxproj.user + SamTSE/Sources/DecodeReport/DecodeReport.vcxproj.filters + SamTSE/Sources/DecodeReport/DecodeReport.vcxproj + SamTSE/Sources/GameMP/GameMP.vcxproj.filters + SamTSE/Sources/GameMP/GameMP.vcxproj + SamTSE/Sources/GameMP/Game.vcxproj.user + SamTSE/Sources/GameMP/Game.vcxproj + SamTSE/Sources/GameMP/Game.user + SamTSE/Sources/GameMP/GameMP.vcxproj.user + SamTSE/Sources/TEXConv/TEXConv.vcxproj.filters + SamTSE/Sources/TEXConv/TEXConv.vcxproj + SamTSE/Sources/TEXConv/TEXConv.vcxproj.user + SamTSE/Sources/Shaders/Shaders.vcxproj.user + SamTSE/Sources/Shaders/Shaders.vcxproj.filters + SamTSE/Sources/Shaders/Shaders.vcxproj + SamTSE/Sources/DedicatedServer/DedicatedServer.vcxproj.filters + SamTSE/Sources/DedicatedServer/DedicatedServer.vcxproj.user + SamTSE/Sources/DedicatedServer/icon1.ico + SamTSE/Sources/DedicatedServer/DedicatedServer.rc + SamTSE/Sources/DedicatedServer/DedicatedServer.vcxproj + SamTSE/Sources/DedicatedServer/ReadMe.txt + SamTSE/Sources/build-linux32.sh + SamTSE/Sources/Ecc/Ecc.vcxproj + SamTSE/Sources/Ecc/Ecc.vcxproj.user + SamTSE/Sources/Ecc/Ecc.vcxproj.filters + SamTSE/Sources/Entities/Entities.vcxproj + SamTSE/Sources/Entities/Entities.vcxproj.filters + SamTSE/Sources/Entities/LastFileID.txt + SamTSE/Sources/Entities/Entities.vcxproj.user + SamTSE/Sources/Depend/Depend.vcxproj + SamTSE/Sources/Depend/Depend.vcxproj.user + SamTSE/Sources/Depend/Depend.vcxproj.filters + SamTSE/Sources/EntitiesMP/EntitiesMP.vcxproj + SamTSE/Sources/EntitiesMP/EntitiesMP.vcxproj.filters + SamTSE/Sources/EntitiesMP/LastFileID.txt + SamTSE/Sources/EntitiesMP/EntitiesMP.vcxproj.user SamTSE/Temp SamTSE/Tools.Win32 SamTSE/VirtualTrees @@ -68,13 +189,17 @@ Files-Excluded: appimage SamTSE/Mods/SecondEncounterTbn.tex SamTSE/Mods/XPLUSTbn.tex SamTSE/Sources/Engine/Graphics/Vulkan/Shaders/CompiledSpirv + SamTSE/Sources/Models/Enemies/Robots + SamTSE/SE1_10b.gro Disclaimer: This package is in the contrib archive area, which is not part of Debian. The engine itself is free software, but it is only useful when combined with proprietary game data. Files: * -Copyright: 2002-2012 Croteam +Copyright: 1997-2001 Niklas Beisert, Alen Ladavac + 2002-2012 Croteam + 2004-2008 Luigi Auriemma 2012-2016 Ryan C. Gordon 2020 Sultim Tsyrendashiev 2021-2024 Alexander Pavlov diff --git a/debian/patches/0002-CMakeLists.txt.patch b/debian/patches/0002-CMakeLists.txt.patch index 013721ff..de3e1d05 100644 --- a/debian/patches/0002-CMakeLists.txt.patch +++ b/debian/patches/0002-CMakeLists.txt.patch @@ -70,7 +70,117 @@ Forwarded: not-needed endif() endif() endif() -@@ -1677,10 +1650,10 @@ +@@ -1472,56 +1445,8 @@ + ) + endif() + +-set(ENGINELIB "Engine${MP}${DEBUGSUFFIX}") +-add_library(${ENGINELIB} SHARED +- ${ENGINE_SRCS} +-) +-if(MACOSX) +- target_link_libraries(${ENGINELIB} "-undefined dynamic_lookup") +-endif() +-add_dependencies(${ENGINELIB} ParseEntities${MP}) +-target_link_libraries(${ENGINELIB} engine_safemath${MP}) +-if(FREEBSD) +- target_link_libraries(${ENGINELIB} ${SDL2_LIBRARY}) +- target_link_libraries(${ENGINELIB} ${ZLIB_LIBRARIES}) +- if(USE_SYSTEM_VULKAN) +- target_link_libraries(${ENGINELIB} ${Vulkan_LIBRARY}) +- endif() +-endif() +- +-if(MACOSX) +- if(USE_SYSTEM_SDL2) # use sdl2 framework on system +- target_link_libraries(${ENGINELIB} ${SDL2_LIBRARY}) +- else() # use local libsdl2 +- find_library(COCOA_FRAMEWORK Cocoa) +- target_link_libraries(${ENGINELIB} "${COCOA_FRAMEWORK}") +- target_link_libraries(${ENGINELIB} "${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/libSDL2-2.0.0.dylib") +- endif() +- target_link_libraries(${ENGINELIB} ${ZLIB_LIBRARIES}) +- if(USE_SYSTEM_VULKAN) +- target_link_libraries(${ENGINELIB} Vulkan::Vulkan) +- endif() +-endif() +-if(PANDORA) +- target_link_libraries(${ENGINELIB} "rt") +-endif() +-if(RPI4) +- target_link_libraries(${ENGINELIB} "rt") +-endif() +- +-if(FREEBSD OR MACOSX) +- set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,${RPATH_SETTINGS}") +-else() +- if(USE_SYSTEM_VULKAN) +- target_link_libraries(${ENGINELIB} vulkan) +- set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-lvulkan,${RPATH_SETTINGS}") +- else() +- set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,${RPATH_SETTINGS}") +- endif() +-endif() +- + add_executable(SeriousSam${MP} +- #${ENGINE_SRCS} ++ ${ENGINE_SRCS} + SeriousSam/LevelInfo.cpp + SeriousSam/CmdLine.cpp + SeriousSam/SeriousSam.cpp +@@ -1535,10 +1460,10 @@ + SeriousSam/MenuGadgets.cpp + SeriousSam/MenuPrinting.cpp + ) +-target_link_libraries(SeriousSam${MP} ${ENGINELIB}) ++target_link_libraries(SeriousSam${MP} engine_safemath vulkan) + add_dependencies(SeriousSam${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +-set_target_properties(SeriousSam${MP} PROPERTIES ENABLE_EXPORTS ON) ++set_target_properties(SeriousSam${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + + + # !!! FIXME: this is an option because you have to recompile the entire engine twice. +@@ -1546,29 +1471,29 @@ + # !!! FIXME: that's a better plan and we can remove the toggle here. + option(BUILD_DEDICATED_SERVER "Compile the dedicated server, too" TRUE) + if(BUILD_DEDICATED_SERVER) +- add_executable(DedicatedServer${MP} DedicatedServer/DedicatedServer.cpp) +- target_link_libraries(DedicatedServer${MP} ${ENGINELIB}) ++ add_executable(DedicatedServer${MP} ${ENGINE_SRCS} DedicatedServer/DedicatedServer.cpp) ++ target_link_libraries(DedicatedServer${MP} engine_safemath vulkan) + add_dependencies(DedicatedServer${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +- set_target_properties(DedicatedServer${MP} PROPERTIES ENABLE_EXPORTS ON) ++ set_target_properties(DedicatedServer${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + endif() + + option(BUILD_MAKEFONT "Compile the MakeFONT, too" TRUE) + if(BUILD_MAKEFONT) +- add_executable(MakeFONT${MP} MakeFONT/MakeFONT.cpp) +- target_link_libraries(MakeFONT${MP} ${ENGINELIB}) ++ add_executable(MakeFONT${MP} ${ENGINE_SRCS} MakeFONT/MakeFONT.cpp) ++ target_link_libraries(MakeFONT${MP} engine_safemath vulkan) + add_dependencies(MakeFONT${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +- set_target_properties(MakeFONT${MP} PROPERTIES ENABLE_EXPORTS ON) ++ set_target_properties(MakeFONT${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + endif() + + option(BUILD_TEXConv "Compile the TEXConv, too" TRUE) + if(BUILD_TEXConv) +- add_executable(TEXConv${MP} TEXConv/TEXConv.cpp) +- target_link_libraries(TEXConv${MP} ${ENGINELIB}) ++ add_executable(TEXConv${MP} ${ENGINE_SRCS} TEXConv/TEXConv.cpp) ++ target_link_libraries(TEXConv${MP} engine_safemath vulkan) + add_dependencies(TEXConv${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +- set_target_properties(TEXConv${MP} PROPERTIES ENABLE_EXPORTS ON) ++ set_target_properties(TEXConv${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + endif() + + option(BUILD_AMP11LIB "Compile the AMP11LIB, too" TRUE) +@@ -1677,10 +1602,10 @@ set_target_properties(amp11lib${MP} PROPERTIES OUTPUT_NAME "amp11lib${DEBUGSUFFIX}") set_target_properties(${SHADERSLIBSE} PROPERTIES OUTPUT_NAME "Shaders${DEBUGSUFFIX}") else() @@ -85,17 +195,25 @@ Forwarded: not-needed set_target_properties(amp11lib${MP} PROPERTIES OUTPUT_NAME "amp11lib") set_target_properties(${SHADERSLIB} PROPERTIES OUTPUT_NAME "Shaders") endif() -@@ -1775,36 +1748,36 @@ +@@ -1749,7 +1674,7 @@ + # NOT LOCAL INSTALL + elseif(NOT LOCAL_INSTALL AND NOT XPLUS) + if(DEBUG) # RAKE! Will this work with TFE? +- install(TARGETS SeriousSam${MP} ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} ${ENGINELIB} ++ install(TARGETS SeriousSam${MP} ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} + RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/Bin" + LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/Bin/Debug" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +@@ -1775,47 +1700,45 @@ endif() else() install(TARGETS SeriousSam${MP} ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} - RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${INTERNAL_NAME}" -+ RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/games" -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${INTERNAL_NAME}-vk" - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - install(TARGETS ${ENGINELIB} +- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +- install(TARGETS ${ENGINELIB} - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/games" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${INTERNAL_NAME}-vk" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) if(BUILD_DEDICATED_SERVER) @@ -130,25 +248,23 @@ Forwarded: not-needed PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif() -@@ -1812,10 +1785,14 @@ + # RAKE! If CMAKE_INSTALL_PREFIX was set during config then its not a local install # and SE1_10.gro needs to be installed to Games root dir. if(NOT LOCAL_INSTALL AND NOT XPLUS) - install(FILES ${CMAKE_ADD_TARGET_DIR}/../SE1_10b.gro +- install(FILES ${CMAKE_ADD_TARGET_DIR}/../SE1_10b.gro - DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${INTERNAL_NAME}" -+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/games/${INTERNAL_NAME}-vk" - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -- install(FILES "${CMAKE_ADD_TARGET_DIR}/../${INTERNAL_NAME}.desktop" -- DESTINATION "${CMAKE_INSTALL_PREFIX}//share/applications" + if(INTERNAL_NAME STREQUAL "serioussam") + install(FILES "${CMAKE_ADD_TARGET_DIR}/../${INTERNAL_NAME}.desktop" RENAME "io.github.tx00100xt.serioussam-vk.desktop" + DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications" -+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +- install(FILES "${CMAKE_ADD_TARGET_DIR}/../${INTERNAL_NAME}.desktop" +- DESTINATION "${CMAKE_INSTALL_PREFIX}//share/applications" + install(FILES "${CMAKE_ADD_TARGET_DIR}/../../debian/io.github.tx00100xt.serioussam-vk.appdata.xml" + DESTINATION "${CMAKE_INSTALL_PREFIX}/share/metainfo" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) set(A 16) set(B 32) -@@ -1829,9 +1806,14 @@ +@@ -1829,9 +1752,14 @@ OUTPUT_VARIABLE outVar ) install(FILES ${CMAKE_ADD_TARGET_DIR}/../${X}.png @@ -234,7 +350,117 @@ Forwarded: not-needed endif() endif() endif() -@@ -1677,10 +1650,10 @@ +@@ -1472,56 +1445,8 @@ + ) + endif() + +-set(ENGINELIB "Engine${MP}${DEBUGSUFFIX}") +-add_library(${ENGINELIB} SHARED +- ${ENGINE_SRCS} +-) +-if(MACOSX) +- target_link_libraries(${ENGINELIB} "-undefined dynamic_lookup") +-endif() +-add_dependencies(${ENGINELIB} ParseEntities${MP}) +-target_link_libraries(${ENGINELIB} engine_safemath${MP}) +-if(FREEBSD) +- target_link_libraries(${ENGINELIB} ${SDL2_LIBRARY}) +- target_link_libraries(${ENGINELIB} ${ZLIB_LIBRARIES}) +- if(USE_SYSTEM_VULKAN) +- target_link_libraries(${ENGINELIB} ${Vulkan_LIBRARY}) +- endif() +-endif() +- +-if(MACOSX) +- if(USE_SYSTEM_SDL2) # use sdl2 framework on system +- target_link_libraries(${ENGINELIB} ${SDL2_LIBRARY}) +- else() # use local libsdl2 +- find_library(COCOA_FRAMEWORK Cocoa) +- target_link_libraries(${ENGINELIB} "${COCOA_FRAMEWORK}") +- target_link_libraries(${ENGINELIB} "${CMAKE_CURRENT_SOURCE_DIR}/lib/macosx/libSDL2-2.0.0.dylib") +- endif() +- target_link_libraries(${ENGINELIB} ${ZLIB_LIBRARIES}) +- if(USE_SYSTEM_VULKAN) +- target_link_libraries(${ENGINELIB} Vulkan::Vulkan) +- endif() +-endif() +-if(PANDORA) +- target_link_libraries(${ENGINELIB} "rt") +-endif() +-if(RPI4) +- target_link_libraries(${ENGINELIB} "rt") +-endif() +- +-if(FREEBSD OR MACOSX) +- set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,${RPATH_SETTINGS}") +-else() +- if(USE_SYSTEM_VULKAN) +- target_link_libraries(${ENGINELIB} vulkan) +- set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-lvulkan,${RPATH_SETTINGS}") +- else() +- set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,${RPATH_SETTINGS}") +- endif() +-endif() +- + add_executable(SeriousSam${MP} +- #${ENGINE_SRCS} ++ ${ENGINE_SRCS} + SeriousSam/LevelInfo.cpp + SeriousSam/CmdLine.cpp + SeriousSam/SeriousSam.cpp +@@ -1535,10 +1460,10 @@ + SeriousSam/MenuGadgets.cpp + SeriousSam/MenuPrinting.cpp + ) +-target_link_libraries(SeriousSam${MP} ${ENGINELIB}) ++target_link_libraries(SeriousSam${MP} engine_safemath vulkan) + add_dependencies(SeriousSam${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +-set_target_properties(SeriousSam${MP} PROPERTIES ENABLE_EXPORTS ON) ++set_target_properties(SeriousSam${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + + + # !!! FIXME: this is an option because you have to recompile the entire engine twice. +@@ -1546,29 +1471,29 @@ + # !!! FIXME: that's a better plan and we can remove the toggle here. + option(BUILD_DEDICATED_SERVER "Compile the dedicated server, too" TRUE) + if(BUILD_DEDICATED_SERVER) +- add_executable(DedicatedServer${MP} DedicatedServer/DedicatedServer.cpp) +- target_link_libraries(DedicatedServer${MP} ${ENGINELIB}) ++ add_executable(DedicatedServer${MP} ${ENGINE_SRCS} DedicatedServer/DedicatedServer.cpp) ++ target_link_libraries(DedicatedServer${MP} engine_safemath vulkan) + add_dependencies(DedicatedServer${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +- set_target_properties(DedicatedServer${MP} PROPERTIES ENABLE_EXPORTS ON) ++ set_target_properties(DedicatedServer${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + endif() + + option(BUILD_MAKEFONT "Compile the MakeFONT, too" TRUE) + if(BUILD_MAKEFONT) +- add_executable(MakeFONT${MP} MakeFONT/MakeFONT.cpp) +- target_link_libraries(MakeFONT${MP} ${ENGINELIB}) ++ add_executable(MakeFONT${MP} ${ENGINE_SRCS} MakeFONT/MakeFONT.cpp) ++ target_link_libraries(MakeFONT${MP} engine_safemath vulkan) + add_dependencies(MakeFONT${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +- set_target_properties(MakeFONT${MP} PROPERTIES ENABLE_EXPORTS ON) ++ set_target_properties(MakeFONT${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + endif() + + option(BUILD_TEXConv "Compile the TEXConv, too" TRUE) + if(BUILD_TEXConv) +- add_executable(TEXConv${MP} TEXConv/TEXConv.cpp) +- target_link_libraries(TEXConv${MP} ${ENGINELIB}) ++ add_executable(TEXConv${MP} ${ENGINE_SRCS} TEXConv/TEXConv.cpp) ++ target_link_libraries(TEXConv${MP} engine_safemath vulkan) + add_dependencies(TEXConv${MP} ParseEntities${MP}) + # Make symbols in the main executable available to dynamic objects +- set_target_properties(TEXConv${MP} PROPERTIES ENABLE_EXPORTS ON) ++ set_target_properties(TEXConv${MP} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-lvulkan") + endif() + + option(BUILD_AMP11LIB "Compile the AMP11LIB, too" TRUE) +@@ -1677,10 +1602,10 @@ set_target_properties(amp11lib${MP} PROPERTIES OUTPUT_NAME "amp11lib${DEBUGSUFFIX}") set_target_properties(${SHADERSLIBSE} PROPERTIES OUTPUT_NAME "Shaders${DEBUGSUFFIX}") else() @@ -249,17 +475,25 @@ Forwarded: not-needed set_target_properties(amp11lib${MP} PROPERTIES OUTPUT_NAME "amp11lib") set_target_properties(${SHADERSLIB} PROPERTIES OUTPUT_NAME "Shaders") endif() -@@ -1775,36 +1748,36 @@ +@@ -1749,7 +1674,7 @@ + # NOT LOCAL INSTALL + elseif(NOT LOCAL_INSTALL AND NOT XPLUS) + if(DEBUG) # RAKE! Will this work with TFE? +- install(TARGETS SeriousSam${MP} ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} ${ENGINELIB} ++ install(TARGETS SeriousSam${MP} ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} + RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/Bin" + LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/Bin/Debug" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +@@ -1775,47 +1700,45 @@ endif() else() install(TARGETS SeriousSam${MP} ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} - RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/${INTERNAL_NAME}" -+ RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/games" -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/serioussam-vk-se" - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - install(TARGETS ${ENGINELIB} +- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +- install(TARGETS ${ENGINELIB} - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/games" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/serioussam-vk-se" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) if(BUILD_DEDICATED_SERVER) @@ -294,25 +528,23 @@ Forwarded: not-needed PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif() -@@ -1812,10 +1785,14 @@ + # RAKE! If CMAKE_INSTALL_PREFIX was set during config then its not a local install # and SE1_10.gro needs to be installed to Games root dir. if(NOT LOCAL_INSTALL AND NOT XPLUS) - install(FILES ${CMAKE_ADD_TARGET_DIR}/../SE1_10b.gro +- install(FILES ${CMAKE_ADD_TARGET_DIR}/../SE1_10b.gro - DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${INTERNAL_NAME}" -+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/games/${INTERNAL_NAME}-vk" - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -- install(FILES "${CMAKE_ADD_TARGET_DIR}/../${INTERNAL_NAME}.desktop" -- DESTINATION "${CMAKE_INSTALL_PREFIX}//share/applications" + if(INTERNAL_NAME STREQUAL "serioussam") + install(FILES "${CMAKE_ADD_TARGET_DIR}/../${INTERNAL_NAME}.desktop" RENAME "io.github.tx00100xt.serioussam-vk.desktop" + DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications" -+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +- install(FILES "${CMAKE_ADD_TARGET_DIR}/../${INTERNAL_NAME}.desktop" +- DESTINATION "${CMAKE_INSTALL_PREFIX}//share/applications" + install(FILES "${CMAKE_ADD_TARGET_DIR}/../../debian/io.github.tx00100xt.serioussam-vk.appdata.xml" + DESTINATION "${CMAKE_INSTALL_PREFIX}/share/metainfo" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) set(A 16) set(B 32) -@@ -1829,9 +1806,14 @@ +@@ -1829,9 +1752,14 @@ OUTPUT_VARIABLE outVar ) install(FILES ${CMAKE_ADD_TARGET_DIR}/../${X}.png diff --git a/debian/patches/0003-Engine.cpp.patch b/debian/patches/0003-Engine.cpp.patch index e1fa34be..17e4e526 100644 --- a/debian/patches/0003-Engine.cpp.patch +++ b/debian/patches/0003-Engine.cpp.patch @@ -1,8 +1,28 @@ Description: Set Debian specific paths: https://wiki.debian.org/Games/Checklist +. +Added support for the content of the demo version of the game. Forwarded: not-needed --- a/SamTFE/Sources/Engine/Engine.cpp 2023-11-28 16:51:55.989955484 +0300 +++ b/SamTFE/Sources/Engine/Engine.cpp 2024-01-25 12:59:40.376276525 +0300 -@@ -676,10 +676,19 @@ +@@ -115,6 +115,7 @@ + // Path vars + static INDEX sys_iGameBits = 0; + ENGINE_API INDEX sys_iSysPath = 0; ++ENGINE_API INDEX sys_iGameDemoMode = 0; + + // Entities Adjesters + ENGINE_API FLOAT _fPlayerFOVAdjuster = 1.0f; +@@ -172,7 +173,8 @@ + } else { + if( strGameID == "serioussamse") { + int _testfile = strncmp((const char *)entry->d_name, (const char *) "SE1_00_Levels.gro", (size_t) 13 ); +- if( _testfile == 0) { ++ int _testfile_demo = strncmp((const char *)entry->d_name, (const char *) "SEDemo1_00.gro", (size_t) 10 ); ++ if( _testfile == 0 || _testfile_demo == 0) { + memcpy(_path, name, 2047); + CPrintF("Found: %s/%s\n", name, entry->d_name); + _testfiledone = 1; +@@ -676,10 +678,19 @@ _fnmApplicationPath = CTString(strDirPath); _fnmApplicationExe = CTString(strExePath); #ifdef PLATFORM_UNIX @@ -25,7 +45,7 @@ Forwarded: not-needed #endif try { _fnmApplicationExe.RemoveApplicationPath_t(); -@@ -747,13 +748,10 @@ +@@ -747,13 +758,10 @@ #elif defined(__NetBSD__) int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/pkg/bin/", (size_t) 13 ); #else @@ -42,7 +62,7 @@ Forwarded: not-needed // get library path for mods _fnmModLibPath = ""; -@@ -764,24 +762,7 @@ +@@ -764,35 +772,19 @@ if( sys_iSysPath == 1 ) { _fnmModLibPath = "/usr/pkg/lib/" + strGameID + "/"; #else @@ -68,16 +88,56 @@ Forwarded: not-needed #endif } else if( sys_iSysPath == 0 ) { _fnmModLibPath = _fnmApplicationPath; -@@ -806,7 +806,7 @@ + } else { + CPrintF(TRANSV("ERROR: Game libraries not ound!\n")); +- FatalError(TRANSV("Failed to search game libraries installed!\nPlease reinstall the game.\nSee the log for more details.\nGame log is here: ~/.local/share/Serious-Engine/%s/SeriousSam.log"),(const char *) strGameID); ++ FatalError(TRANSV("Failed to search game libraries installed!\nPlease reinstall the game.\nSee the log for more details.\nGame log is here: ~/.%s-vk/SeriousSam.log"),(const char *) strGameID); + } + + if( sys_iSysPath == 1 ) { // search game data + CTFileName _fnm_usr_TestFile, _fnm_local_TestFile, _fnm_home_TestFile; +- CTString _fnmUserDataPath, _fnm_TestFile; ++ CTFileName _fnm_usr_TestDemoFile, _fnm_local_TestDemoFile, _fnm_home_TestDemoFile; ++ CTString _fnmUserDataPath, _fnm_TestFile, _fnm_TestDemoFile; + int _fd; + + if( access((const char *) _fnmUserDir+_strLogFile+".cfg", F_OK) == 0 ) { +@@ -808,35 +800,48 @@ + // set testing files + if( strGameID == "serioussamse") { + _fnm_TestFile = "SE1_00_Levels.gro"; ++ _fnm_TestDemoFile = "SEDemo1_00.gro"; + } else { + _fnm_TestFile = "1_00_music.gro"; ++ _fnm_TestDemoFile = "1_00_music_demo.gro"; + } + CPrintF(TRANSV("Testing file: %s\n"), (const char *) _fnm_TestFile); + #if defined(__OpenBSD__) || defined(__FreeBSD__) + _fnm_usr_TestFile = "/usr/local/share/" + strGameID + "/" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestDemoFile = "/usr/local/share/" + strGameID + "/" + _fnm_TestDemoFile; // data in usr #elif defined(__NetBSD__) _fnm_usr_TestFile = "/usr/pkg/share/" + strGameID + "/" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestDemoFile = "/usr/pkg/share/" + strGameID + "/" + _fnm_TestDemoFile; // data in usr #else - _fnm_usr_TestFile = "/usr/share/" + strGameID + "/" + _fnm_TestFile; // data in usr + _fnm_usr_TestFile = "/usr/share/games/" + strGameID + "-vk/" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestDemoFile = "/usr/share/games/" + strGameID + "-vk/" + _fnm_TestDemoFile; // data in usr #endif _fnm_local_TestFile = _fnmUserDir + _fnm_TestFile; // data in home .local ++ _fnm_local_TestDemoFile = _fnmUserDir + _fnm_TestDemoFile; _fnm_home_TestFile = (const char *)_fnmUserDataPath + _fnm_TestFile; -@@ -831,7 +812,7 @@ ++ _fnm_home_TestDemoFile = (const char *)_fnmUserDataPath + _fnm_TestDemoFile; + // test +- if( access((const char *) _fnm_home_TestFile, F_OK) != 0 ) { +- CPrintF(TRANSV("Testing system path: %s\n"), (const char *) _fnm_usr_TestFile); +- CPrintF(TRANSV("Testing local path: %s\n"), (const char *) _fnm_local_TestFile); +- if( access((const char *) _fnm_usr_TestFile, F_OK) == 0 ) { ++ if( access((const char *) _fnm_home_TestFile, F_OK) != 0 && access((const char *) _fnm_home_TestDemoFile, F_OK) != 0 ) { ++ CPrintF(TRANSV("Testing system path1: %s\nTesting system path2: %s\n"), (const char *) _fnm_usr_TestFile, (const char *) _fnm_usr_TestDemoFile); ++ CPrintF(TRANSV("Testing local path1: %s\nTesting local path2: %s\n"), (const char *) _fnm_local_TestFile, (const char *) _fnm_local_TestDemoFile); ++ if( access((const char *) _fnm_usr_TestFile, F_OK) == 0 || access((const char *) _fnm_usr_TestDemoFile, F_OK) == 0 ) { + #if defined(__OpenBSD__) || defined(__FreeBSD__) + _fnmApplicationPath = "/usr/local/share/" + strGameID + "/"; // all game data #elif defined(__NetBSD__) _fnmApplicationPath = "/usr/pkg/share/" + strGameID + "/"; // all game data #else @@ -85,8 +145,20 @@ Forwarded: not-needed + _fnmApplicationPath = "/usr/share/games/" + strGameID + "-vk/"; // all game data #endif CPrintF(TRANSV("Found usr path: %s\n"), (const char *) _fnmUserDataPath); - } else if( access((const char *) _fnm_local_TestFile, F_OK) == 0 ) { -@@ -845,7 +826,7 @@ +- } else if( access((const char *) _fnm_local_TestFile, F_OK) == 0 ) { ++ if( access((const char *) _fnm_usr_TestDemoFile, F_OK) == 0 ) { ++ sys_iGameDemoMode = 1; ++ } ++ } else if( access((const char *) _fnm_local_TestFile, F_OK) == 0 || access((const char *) _fnm_local_TestDemoFile, F_OK) == 0 ) { + _fnmApplicationPath = _fnmUserDir; // all game data + CPrintF(TRANSV("Found local path: %s\n"), (const char *) _fnmUserDataPath); ++ if( access((const char *) _fnm_local_TestDemoFile, F_OK) == 0 ) { ++ sys_iGameDemoMode = 1; ++ } + } else { + // search in home dir + // BOOL YesNoMessage(const char *strFormat, ...) +@@ -845,7 +850,7 @@ #elif defined(__NetBSD__) InfoMessage(TRANS("No game files were found in /usr/pkg/share/%s/\n or %s\nThe home directory will be searched."),(const char *) strGameID,(const char *) _fnmUserDir); #else @@ -95,7 +167,28 @@ Forwarded: not-needed #endif struct passwd *pw = getpwuid(getuid()); const char *_homedir = pw->pw_dir; -@@ -869,7 +850,7 @@ +@@ -855,12 +860,20 @@ + _PATH = (CTString)_path; + _fnmApplicationPath = (CTFileName) _PATH + "/"; + _fnm_home_TestFile = (CTFileName) _PATH + "/" + _fnm_TestFile; ++ _fnm_home_TestDemoFile = (CTFileName) _PATH + "/" + _fnm_TestDemoFile; + if( access((const char *) _fnm_home_TestFile, F_OK) == 0 ) { + //_fnmApplicationPath = (CTFileName) _PATH + "/"; + CPrintF(TRANSV("Found home path: %s\n"), (const char *) _fnm_home_TestFile); + _fd = open((const char *) _fnmUserDir+_strLogFile+".cfg", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); + size_t x = write(_fd, _path, 2048); + close(_fd); ++ } else if( access((const char *) _fnm_home_TestDemoFile, F_OK) == 0 ) { ++ //_fnmApplicationPath = (CTFileName) _PATH + "/"; ++ CPrintF(TRANSV("Found home path: %s\n"), (const char *) _fnm_home_TestDemoFile); ++ _fd = open((const char *) _fnmUserDir+_strLogFile+".cfg", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); ++ size_t x = write(_fd, _path, 2048); ++ close(_fd); ++ sys_iGameDemoMode = 1; + } else { + CPrintF(TRANSV("ERROR: Game data not ound!\n")); + _fnmUserDataPath = ""; +@@ -869,11 +882,14 @@ #elif defined(__NetBSD__) FatalError(TRANSV("Failed to search game data!\nPlease put the game data in the paths:\n/usr/pkg/share/%s/\n or %s\n or somewhere in your home directory\nSee the log for more details.\nGame log is here: ~/.local/share/Serious-Engine/%s/SeriousSam.log"),(const char *) strGameID,(const char *) _fnmUserDir,(const char *) strGameID); #else @@ -104,17 +197,47 @@ Forwarded: not-needed #endif } } -@@ -883,6 +864,7 @@ + } else { ++ if( access((const char *) _fnm_home_TestDemoFile, F_OK) == 0 ) { ++ sys_iGameDemoMode = 1; ++ } + CPrintF(TRANSV("Found path: %s\n"), (const char *) _fnmUserDataPath); + _fnmApplicationPath = _fnmUserDataPath; // all game data + } +@@ -883,6 +899,12 @@ CPrintF(TRANSV("Executable: %s\n"), (const char *) strExePath); CPrintF(TRANSV("Assumed engine data directory: %s\n"), (const char *) _fnmApplicationPath); CPrintF(TRANSV("Assumed mods library directory: %s\n"), (const char *) _fnmModLibPath); + CPrintF(TRANSV("Assumed additional data directory: %s\n"), (const char *) _fnmAdditionalDirPath); ++ if( sys_iGameDemoMode == 1 ) { ++ CPrintF(TRANSV("Found Demo data. Demo mode Enabled.\n")); ++ } else { ++ CPrintF(TRANSV("Found Original data. Demo mode Disabled.\n")); ++ } #endif CPrintF("\n"); --- a/SamTSE/Sources/Engine/Engine.cpp 2023-11-28 16:51:55.989955484 +0300 +++ b/SamTSE/Sources/Engine/Engine.cpp 2024-01-25 12:59:40.376276525 +0300 -@@ -676,10 +676,19 @@ +@@ -115,6 +115,7 @@ + // Path vars + static INDEX sys_iGameBits = 0; + ENGINE_API INDEX sys_iSysPath = 0; ++ENGINE_API INDEX sys_iGameDemoMode = 0; + + // Entities Adjesters + ENGINE_API FLOAT _fPlayerFOVAdjuster = 1.0f; +@@ -172,7 +173,8 @@ + } else { + if( strGameID == "serioussamse") { + int _testfile = strncmp((const char *)entry->d_name, (const char *) "SE1_00_Levels.gro", (size_t) 13 ); +- if( _testfile == 0) { ++ int _testfile_demo = strncmp((const char *)entry->d_name, (const char *) "SEDemo1_00.gro", (size_t) 10 ); ++ if( _testfile == 0 || _testfile_demo == 0) { + memcpy(_path, name, 2047); + CPrintF("Found: %s/%s\n", name, entry->d_name); + _testfiledone = 1; +@@ -676,10 +678,19 @@ _fnmApplicationPath = CTString(strDirPath); _fnmApplicationExe = CTString(strExePath); #ifdef PLATFORM_UNIX @@ -137,7 +260,7 @@ Forwarded: not-needed #endif try { _fnmApplicationExe.RemoveApplicationPath_t(); -@@ -747,16 +756,13 @@ +@@ -747,16 +758,13 @@ #elif defined(__NetBSD__) int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/pkg/bin/", (size_t) 13 ); #else @@ -154,11 +277,11 @@ Forwarded: not-needed // get library path for mods - _fnmModLibPath = ""; -+ _fnmModLibPath = "/usr/lib/games/serioussam-vk/"; ++ _fnmModLibPath = (CTString)"/usr/lib/games/serioussam-vk-se/"; #if defined(__OpenBSD__) || defined(__FreeBSD__) if( sys_iSysPath == 1 ) { _fnmModLibPath = "/usr/local/lib/" + strGameID + "/"; -@@ -764,24 +770,7 @@ +@@ -764,35 +772,19 @@ if( sys_iSysPath == 1 ) { _fnmModLibPath = "/usr/pkg/lib/" + strGameID + "/"; #else @@ -180,20 +303,60 @@ Forwarded: not-needed - _fnmModLibPath = "/usr/lib64/" + strGameID + "/"; - } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib//" + strGameID)) { - _fnmModLibPath = "/usr/lib/" + strGameID + "/"; -+ if( strGameID == "serioussamse" ) { _fnmModLibPath = "/usr/lib/games/serioussam-vk-se/"; ++ if( sys_iSysPath == 1 ) { CPrintF(TRANSV("Bind mods library directory: %s\n"), (const char *) _fnmModLibPath); #endif } else if( sys_iSysPath == 0 ) { _fnmModLibPath = _fnmApplicationPath; -@@ -806,7 +806,7 @@ + } else { + CPrintF(TRANSV("ERROR: Game libraries not ound!\n")); +- FatalError(TRANSV("Failed to search game libraries installed!\nPlease reinstall the game.\nSee the log for more details.\nGame log is here: ~/.local/share/Serious-Engine/%s/SeriousSam.log"),(const char *) strGameID); ++ FatalError(TRANSV("Failed to search game libraries installed!\nPlease reinstall the game.\nSee the log for more details.\nGame log is here: ~/.%s-vk/SeriousSam.log"),(const char *) strGameID); + } + + if( sys_iSysPath == 1 ) { // search game data + CTFileName _fnm_usr_TestFile, _fnm_local_TestFile, _fnm_home_TestFile; +- CTString _fnmUserDataPath, _fnm_TestFile; ++ CTFileName _fnm_usr_TestDemoFile, _fnm_local_TestDemoFile, _fnm_home_TestDemoFile; ++ CTString _fnmUserDataPath, _fnm_TestFile, _fnm_TestDemoFile; + int _fd; + + if( access((const char *) _fnmUserDir+_strLogFile+".cfg", F_OK) == 0 ) { +@@ -808,35 +800,48 @@ + // set testing files + if( strGameID == "serioussamse") { + _fnm_TestFile = "SE1_00_Levels.gro"; ++ _fnm_TestDemoFile = "SEDemo1_00.gro"; + } else { + _fnm_TestFile = "1_00_music.gro"; ++ _fnm_TestDemoFile = "1_00_music_demo.gro"; + } + CPrintF(TRANSV("Testing file: %s\n"), (const char *) _fnm_TestFile); + #if defined(__OpenBSD__) || defined(__FreeBSD__) + _fnm_usr_TestFile = "/usr/local/share/" + strGameID + "/" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestDemoFile = "/usr/local/share/" + strGameID + "/" + _fnm_TestDemoFile; // data in usr #elif defined(__NetBSD__) _fnm_usr_TestFile = "/usr/pkg/share/" + strGameID + "/" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestDemoFile = "/usr/pkg/share/" + strGameID + "/" + _fnm_TestDemoFile; // data in usr #else - _fnm_usr_TestFile = "/usr/share/" + strGameID + "/" + _fnm_TestFile; // data in usr -+ _fnm_usr_TestFile = "/usr/share/games/" + strGameID + "-vk" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestFile = "/usr/share/games/" + strGameID + "-vk/" + _fnm_TestFile; // data in usr ++ _fnm_usr_TestDemoFile = "/usr/share/games/" + strGameID + "-vk/" + _fnm_TestDemoFile; // data in usr #endif _fnm_local_TestFile = _fnmUserDir + _fnm_TestFile; // data in home .local ++ _fnm_local_TestDemoFile = _fnmUserDir + _fnm_TestDemoFile; _fnm_home_TestFile = (const char *)_fnmUserDataPath + _fnm_TestFile; -@@ -831,7 +812,7 @@ ++ _fnm_home_TestDemoFile = (const char *)_fnmUserDataPath + _fnm_TestDemoFile; + // test +- if( access((const char *) _fnm_home_TestFile, F_OK) != 0 ) { +- CPrintF(TRANSV("Testing system path: %s\n"), (const char *) _fnm_usr_TestFile); +- CPrintF(TRANSV("Testing local path: %s\n"), (const char *) _fnm_local_TestFile); +- if( access((const char *) _fnm_usr_TestFile, F_OK) == 0 ) { ++ if( access((const char *) _fnm_home_TestFile, F_OK) != 0 && access((const char *) _fnm_home_TestDemoFile, F_OK) != 0 ) { ++ CPrintF(TRANSV("Testing system path1: %s\nTesting system path2: %s\n"), (const char *) _fnm_usr_TestFile, (const char *) _fnm_usr_TestDemoFile); ++ CPrintF(TRANSV("Testing local path1: %s\nTesting local path2: %s\n"), (const char *) _fnm_local_TestFile, (const char *) _fnm_local_TestDemoFile); ++ if( access((const char *) _fnm_usr_TestFile, F_OK) == 0 || access((const char *) _fnm_usr_TestDemoFile, F_OK) == 0 ) { + #if defined(__OpenBSD__) || defined(__FreeBSD__) + _fnmApplicationPath = "/usr/local/share/" + strGameID + "/"; // all game data #elif defined(__NetBSD__) _fnmApplicationPath = "/usr/pkg/share/" + strGameID + "/"; // all game data #else @@ -201,8 +364,20 @@ Forwarded: not-needed + _fnmApplicationPath = "/usr/share/games/" + strGameID + "-vk/"; // all game data #endif CPrintF(TRANSV("Found usr path: %s\n"), (const char *) _fnmUserDataPath); - } else if( access((const char *) _fnm_local_TestFile, F_OK) == 0 ) { -@@ -845,7 +826,7 @@ +- } else if( access((const char *) _fnm_local_TestFile, F_OK) == 0 ) { ++ if( access((const char *) _fnm_usr_TestDemoFile, F_OK) == 0 ) { ++ sys_iGameDemoMode = 1; ++ } ++ } else if( access((const char *) _fnm_local_TestFile, F_OK) == 0 || access((const char *) _fnm_local_TestDemoFile, F_OK) == 0 ) { + _fnmApplicationPath = _fnmUserDir; // all game data + CPrintF(TRANSV("Found local path: %s\n"), (const char *) _fnmUserDataPath); ++ if( access((const char *) _fnm_local_TestDemoFile, F_OK) == 0 ) { ++ sys_iGameDemoMode = 1; ++ } + } else { + // search in home dir + // BOOL YesNoMessage(const char *strFormat, ...) +@@ -845,7 +850,7 @@ #elif defined(__NetBSD__) InfoMessage(TRANS("No game files were found in /usr/pkg/share/%s/\n or %s\nThe home directory will be searched."),(const char *) strGameID,(const char *) _fnmUserDir); #else @@ -211,7 +386,28 @@ Forwarded: not-needed #endif struct passwd *pw = getpwuid(getuid()); const char *_homedir = pw->pw_dir; -@@ -869,7 +850,7 @@ +@@ -855,12 +860,20 @@ + _PATH = (CTString)_path; + _fnmApplicationPath = (CTFileName) _PATH + "/"; + _fnm_home_TestFile = (CTFileName) _PATH + "/" + _fnm_TestFile; ++ _fnm_home_TestDemoFile = (CTFileName) _PATH + "/" + _fnm_TestDemoFile; + if( access((const char *) _fnm_home_TestFile, F_OK) == 0 ) { + //_fnmApplicationPath = (CTFileName) _PATH + "/"; + CPrintF(TRANSV("Found home path: %s\n"), (const char *) _fnm_home_TestFile); + _fd = open((const char *) _fnmUserDir+_strLogFile+".cfg", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); + size_t x = write(_fd, _path, 2048); + close(_fd); ++ } else if( access((const char *) _fnm_home_TestDemoFile, F_OK) == 0 ) { ++ //_fnmApplicationPath = (CTFileName) _PATH + "/"; ++ CPrintF(TRANSV("Found home path: %s\n"), (const char *) _fnm_home_TestDemoFile); ++ _fd = open((const char *) _fnmUserDir+_strLogFile+".cfg", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); ++ size_t x = write(_fd, _path, 2048); ++ close(_fd); ++ sys_iGameDemoMode = 1; + } else { + CPrintF(TRANSV("ERROR: Game data not ound!\n")); + _fnmUserDataPath = ""; +@@ -869,11 +882,14 @@ #elif defined(__NetBSD__) FatalError(TRANSV("Failed to search game data!\nPlease put the game data in the paths:\n/usr/pkg/share/%s/\n or %s\n or somewhere in your home directory\nSee the log for more details.\nGame log is here: ~/.local/share/Serious-Engine/%s/SeriousSam.log"),(const char *) strGameID,(const char *) _fnmUserDir,(const char *) strGameID); #else @@ -220,11 +416,23 @@ Forwarded: not-needed #endif } } -@@ -883,6 +864,7 @@ + } else { ++ if( access((const char *) _fnm_home_TestDemoFile, F_OK) == 0 ) { ++ sys_iGameDemoMode = 1; ++ } + CPrintF(TRANSV("Found path: %s\n"), (const char *) _fnmUserDataPath); + _fnmApplicationPath = _fnmUserDataPath; // all game data + } +@@ -883,6 +899,12 @@ CPrintF(TRANSV("Executable: %s\n"), (const char *) strExePath); CPrintF(TRANSV("Assumed engine data directory: %s\n"), (const char *) _fnmApplicationPath); CPrintF(TRANSV("Assumed mods library directory: %s\n"), (const char *) _fnmModLibPath); + CPrintF(TRANSV("Assumed additional data directory: %s\n"), (const char *) _fnmAdditionalDirPath); ++ if( sys_iGameDemoMode == 1 ) { ++ CPrintF(TRANSV("Found Demo data. Demo mode Enabled.\n")); ++ } else { ++ CPrintF(TRANSV("Found Original data. Demo mode Disabled.\n")); ++ } #endif CPrintF("\n"); diff --git a/debian/patches/0004-Stream.patch b/debian/patches/0004-Stream.patch deleted file mode 100644 index d7ff1112..00000000 --- a/debian/patches/0004-Stream.patch +++ /dev/null @@ -1,107 +0,0 @@ -Description: Add additional data path /usr/share/games/-vk -Forwarded: not-needed ---- a/SamTFE/Sources/Engine/Base/Stream.h 2024-02-15 12:44:53.057345383 +0300 -+++ b/SamTFE/Sources/Engine/Base/Stream.h 2024-02-15 13:17:01.634702073 +0300 -@@ -391,6 +391,10 @@ - - // global string with application path - ENGINE_API extern CTFileName _fnmApplicationPath; -+#ifdef PLATFORM_UNIX -+// global string with additional search path -+ENGINE_API extern CTFileName _fnmAdditionalDirPath; -+#endif - // global string with user-specific writable directory. - ENGINE_API extern CTFileName _fnmUserDir; - // global string with current MOD path ---- a/SamTFE/Sources/Engine/Base/Stream.cpp 2024-02-15 12:44:53.057345383 +0300 -+++ b/SamTFE/Sources/Engine/Base/Stream.cpp 2024-02-15 13:17:01.634702073 +0300 -@@ -78,7 +78,9 @@ - // global string with application path (utf-8) - CTFileName _fnmApplicationPath; - CTFileName _fnmApplicationPathTMP; // home dir or application path -- -+#ifdef PLATFORM_UNIX -+CTFileName _fnmAdditionalDirPath; // additional search path -+#endif - // global string with filename of the started application - CTFileName _fnmApplicationExe; - // global string with user-specific writable directory. -@@ -220,6 +222,16 @@ - } - delete files; - -+#ifdef PLATFORM_UNIX -+ // additional search path -+ files = _pFileSystem->FindFiles(_fnmAdditionalDirPath, "*.gro"); -+ max = files->Count(); -+ for (i = 0; i < max; i++) { -+ UNZIPAddArchive( _fnmAdditionalDirPath + ((*files)[i]) ); -+ } -+ delete files; -+#endif -+ - // if there is a mod active - if (_fnmMod!="") { - // for each group file in mod directory ---- a/SamTSE/Sources/Engine/Base/Stream.h 2024-02-15 12:44:53.057345383 +0300 -+++ b/SamTSE/Sources/Engine/Base/Stream.h 2024-02-15 13:17:01.634702073 +0300 -@@ -391,6 +391,10 @@ - - // global string with application path - ENGINE_API extern CTFileName _fnmApplicationPath; -+#ifdef PLATFORM_UNIX -+// global string with additional search path -+ENGINE_API extern CTFileName _fnmAdditionalDirPath; -+#endif - // global string with user-specific writable directory. - ENGINE_API extern CTFileName _fnmUserDir; - // global string with current MOD path ---- a/SamTSE/Sources/Engine/Base/Stream.cpp 2024-02-15 12:44:53.057345383 +0300 -+++ b/SamTSE/Sources/Engine/Base/Stream.cpp 2024-02-15 13:17:01.634702073 +0300 -@@ -78,7 +78,9 @@ - // global string with application path (utf-8) - CTFileName _fnmApplicationPath; - CTFileName _fnmApplicationPathTMP; // home dir or application path -- -+#ifdef PLATFORM_UNIX -+CTFileName _fnmAdditionalDirPath; // additional search path -+#endif - // global string with filename of the started application - CTFileName _fnmApplicationExe; - // global string with user-specific writable directory. -@@ -194,15 +194,16 @@ - } - } - // find eventual extension for the mod's dlls -- _strModExt = ""; -+ _strModExt = "MP"; - // DG: apparently both ModEXT.txt and ModExt.txt exist in the wild. -+/* - CTFileName tmp; - if(ExpandFilePath(EFP_READ, CTString("ModEXT.txt"), tmp) != EFP_NONE) { - LoadStringVar(CTString("ModEXT.txt"), _strModExt); - } else { - LoadStringVar(CTString("ModExt.txt"), _strModExt); - } -- -+*/ - - CPrintF(TRANSV("Loading group files...\n")); - -@@ -220,6 +222,16 @@ - } - delete files; - -+#ifdef PLATFORM_UNIX -+ // additional search path -+ files = _pFileSystem->FindFiles(_fnmAdditionalDirPath, "*.gro"); -+ max = files->Count(); -+ for (i = 0; i < max; i++) { -+ UNZIPAddArchive( _fnmAdditionalDirPath + ((*files)[i]) ); -+ } -+ delete files; -+#endif -+ - // if there is a mod active - if (_fnmMod!="") { - // for each group file in mod directory diff --git a/debian/patches/0005-SeriousSam.cpp.patch b/debian/patches/0005-SeriousSam.cpp.patch deleted file mode 100644 index a665470c..00000000 --- a/debian/patches/0005-SeriousSam.cpp.patch +++ /dev/null @@ -1,42 +0,0 @@ -Description: Set OpenGL render to default -Forwarded: not-needed ---- a/SamTFE/Sources/SeriousSam/SeriousSam.cpp 2024-02-14 22:53:00.349090113 +0300 -+++ b/SamTFE/Sources/SeriousSam/SeriousSam.cpp 2024-02-14 23:08:49.377669933 +0300 -@@ -110,7 +110,7 @@ - __extern INDEX sam_iDisplayDepth = 0; // 0==default, 1==16bit, 2==32bit - __extern INDEX sam_iDisplayAdapter = 0; - #ifdef SE1_VULKAN --__extern INDEX sam_iGfxAPI = 1; // default opengl //1; // 1==Vulkan -+__extern INDEX sam_iGfxAPI = 0; // default opengl //1; // 1==Vulkan - #else - __extern INDEX sam_iGfxAPI = 0; // 0==OpenGL - #endif // SE1_VULKAN -@@ -1586,7 +1586,7 @@ - #else - CTString strCommand; - if (sys_iSysPath == 1) { -- strCommand = sam_strGameName; -+ strCommand = sam_strGameName + "-vk"; - } else { - strCommand = "SeriousSam"; - } ---- a/SamTSE/Sources/SeriousSam/SeriousSam.cpp 2024-02-14 22:53:00.349090113 +0300 -+++ b/SamTSE/Sources/SeriousSam/SeriousSam.cpp 2024-02-14 23:08:49.377669933 +0300 -@@ -110,7 +110,7 @@ - __extern INDEX sam_iDisplayDepth = 0; // 0==default, 1==16bit, 2==32bit - __extern INDEX sam_iDisplayAdapter = 0; - #ifdef SE1_VULKAN --__extern INDEX sam_iGfxAPI = 1; // default opengl //1; // 1==Vulkan -+__extern INDEX sam_iGfxAPI = 0; // default opengl //1; // 1==Vulkan - #else - __extern INDEX sam_iGfxAPI = 0; // 0==OpenGL - #endif // SE1_VULKAN -@@ -1586,7 +1586,7 @@ - #else - CTString strCommand; - if (sys_iSysPath == 1) { -- strCommand = sam_strGameName; -+ strCommand = sam_strGameName + "-vk"; - } else { - strCommand = "SeriousSam"; - } diff --git a/debian/patches/0006-Adapter.cpp.patch b/debian/patches/0006-Adapter.cpp.patch deleted file mode 100644 index 20dd72ae..00000000 --- a/debian/patches/0006-Adapter.cpp.patch +++ /dev/null @@ -1,26 +0,0 @@ -Description: Return if cannot create Vulkan instance -Forwarded: not-needed ---- a/SamTFE/Sources/Engine/Graphics/Adapter.cpp 2024-02-17 16:25:45.236555000 +0300 -+++ b/SamTFE/Sources/Engine/Graphics/Adapter.cpp 2024-02-17 18:49:49.526304125 +0300 -@@ -414,7 +414,8 @@ - VkResult r = vkCreateInstance(&instanceInfo, nullptr, &tempVkInstance); - if (r != VK_SUCCESS) - { -- ASSERT(FALSE); -+ CPrintF("Cannot create Vulkan instance.\n"); -+ return;; - } - - // get all physical devices ---- a/SamTSE/Sources/Engine/Graphics/Adapter.cpp 2024-02-17 16:25:45.236555000 +0300 -+++ b/SamTSE/Sources/Engine/Graphics/Adapter.cpp 2024-02-17 18:49:49.526304125 +0300 -@@ -414,7 +414,8 @@ - VkResult r = vkCreateInstance(&instanceInfo, nullptr, &tempVkInstance); - if (r != VK_SUCCESS) - { -- ASSERT(FALSE); -+ CPrintF("Cannot create Vulkan instance.\n"); -+ return;; - } - - // get all physical devices diff --git a/debian/patches/0007-Gfx_Vulkan.cpp.patch b/debian/patches/0007-Gfx_Vulkan.cpp.patch deleted file mode 100644 index 7d7ab456..00000000 --- a/debian/patches/0007-Gfx_Vulkan.cpp.patch +++ /dev/null @@ -1,24 +0,0 @@ -Description: Change VK_API_VERSION_1_2 to VK_API_VERSION_1_0 -Forwarded: not-needed ---- a/SamTFE/Sources/Engine/Graphics/Gfx_Vulkan.cpp 2024-02-14 23:09:04.922212716 +0300 -+++ b/SamTFE/Sources/Engine/Graphics/Gfx_Vulkan.cpp 2024-02-14 23:09:16.938635079 +0300 -@@ -169,7 +169,7 @@ - appInfo.applicationVersion = VK_MAKE_VERSION(1, 10, 6); - appInfo.pEngineName = "Serious Engine 1"; - appInfo.engineVersion = VK_MAKE_VERSION(1, 10, 6); -- appInfo.apiVersion = VK_API_VERSION_1_2; -+ appInfo.apiVersion = VK_API_VERSION_1_0; - - - VkInstanceCreateInfo instanceInfo = {}; ---- a/SamTSE/Sources/Engine/Graphics/Gfx_Vulkan.cpp 2024-02-14 23:09:04.922212716 +0300 -+++ b/SamTSE/Sources/Engine/Graphics/Gfx_Vulkan.cpp 2024-02-14 23:09:16.938635079 +0300 -@@ -169,7 +169,7 @@ - appInfo.applicationVersion = VK_MAKE_VERSION(1, 10, 6); - appInfo.pEngineName = "Serious Engine 1"; - appInfo.engineVersion = VK_MAKE_VERSION(1, 10, 6); -- appInfo.apiVersion = VK_API_VERSION_1_2; -+ appInfo.apiVersion = VK_API_VERSION_1_0; - - - VkInstanceCreateInfo instanceInfo = {}; diff --git a/debian/patches/series b/debian/patches/series index d324e16a..008125e2 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,7 +1,11 @@ 0001-desktop-file.patch 0002-CMakeLists.txt.patch 0003-Engine.cpp.patch -0004-Stream.patch -0005-SeriousSam.cpp.patch -0006-Adapter.cpp.patch -0007-Gfx_Vulkan.cpp.patch +0004-Engine.h.patch +0005-Stream.patch +0006-Fix-spelling-error-in-binary.patch +0007-SeriousSam.cpp.patch +0008-Menu.cpp.patch +0009-Game.cpp.patch +0010-Adapter.cpp.patch +0011-Gfx_Vulkan.cpp.patch diff --git a/debian/serioussam-vk.6 b/debian/serioussam-vk.6 index 83415d0e..c106320b 100644 --- a/debian/serioussam-vk.6 +++ b/debian/serioussam-vk.6 @@ -211,7 +211,6 @@ and Serious Sam The Second Encounter for Debian/Ubuntu: \fB /usr/games/serioussam-vk-ded\fR \fB /usr/games/serioussam-vk-mkfont\fR \fB /usr/games/serioussam-vk-texconv\fR -\fB /usr/lib/games/serioussam-vk/libEngine.so\fR \fB /usr/lib/games/serioussam-vk/libShaders.so\fR \fB /usr/lib/games/serioussam-vk/libGame.so\fR \fB /usr/lib/games/serioussam-vk/libEntities.so\fR @@ -220,7 +219,6 @@ and Serious Sam The Second Encounter for Debian/Ubuntu: \fB /usr/games/serioussamse-vk-ded\fR \fB /usr/games/serioussamse-vk-mkfont\fR \fB /usr/games/serioussamse-vk-texconv\fR -\fB /usr/lib/games/serioussam-vk-se/libEngineMP.so\fR \fB /usr/lib/games/serioussam-vk-se/libShaders.so\fR \fB /usr/lib/games/serioussam-vk-se/libGameMP.so\fR \fB /usr/lib/games/serioussam-vk-se/libEntitiesMP.so\fR @@ -303,6 +301,32 @@ from there, as well as the Levels directory to directories \fB ~/.serioussamse-vk\fR, respectively, for games Serious Sam: The First Encounter and Serious Sam: The Second Encounter. .PP +.SS Demo version +.PP +This implementation of the engine supports the use of content from the demo version of the game. When the game starts, +the engine determines the installed game content, and if it finds content from the demo version, it turns on the mode for using the demo version of the content. +A demo version of the game can be obtained from many places. For example: +.PP +\fB https://www.moddb.com/downloads/serious-sam-the-first-encounter-demo\fR +.PP +\fB https://www.gamefront.com/games/serious-sam/file/serioussamdemo-exe/download\fR +.PP +The most convenient way is to download using the wget from the WebArchive. +To install content from the demo version of the game, open a terminal and run the following commands: +.PP +\fB sudo apt install p7zip\fR +\fB wget https://archive.org/download/SeriousSamDemo/SeriousSamDemo.exe\fR +\fB wget https://archive.org/download/SeriousSamPatches/serioussampatch105_usa.exe\fR +\fB 7z x SeriousSamDemo.exe\fR +\fB 7z x -y serioussampatch105_usa.exe\fR +\fB mkdir ~/.serioussam-vk\fR +\fB cp -ax Disk1/* ~/.serioussam-vk\fR +\fB rm -fr Disk1\fR +.PP +When you first launch the game, goto Menu -> Options -> Execute Addons and select the default option. +The demo version uses old settings scripts. New ones you can take here: https://github.com/tx00100xt/SeriousSamClassic-VK +Just rewrite the Scripts directory replacing the files +.PP .SS Launching the game To start the game type in console: \fB serioussam-vk\fR or \fB serioussamse-vk\fR. You can also use the launch of the game through the menu. After installing the packages and copying all the data, you can check what we got. diff --git a/debian/serioussamse-vk.6 b/debian/serioussamse-vk.6 index 05f91961..e4826dad 100644 --- a/debian/serioussamse-vk.6 +++ b/debian/serioussamse-vk.6 @@ -211,7 +211,6 @@ and Serious Sam The Second Encounter for Debian/Ubuntu: \fB /usr/games/serioussam-vk-ded\fR \fB /usr/games/serioussam-vk-mkfont\fR \fB /usr/games/serioussam-vk-texconv\fR -\fB /usr/lib/games/serioussam-vk/libEngine.so\fR \fB /usr/lib/games/serioussam-vk/libShaders.so\fR \fB /usr/lib/games/serioussam-vk/libGame.so\fR \fB /usr/lib/games/serioussam-vk/libEntities.so\fR @@ -220,7 +219,6 @@ and Serious Sam The Second Encounter for Debian/Ubuntu: \fB /usr/games/serioussamse-vk-ded\fR \fB /usr/games/serioussamse-vk-mkfont\fR \fB /usr/games/serioussamse-vk-texconv\fR -\fB /usr/lib/games/serioussam-vk-se/libEngineMP.so\fR \fB /usr/lib/games/serioussam-vk-se/libShaders.so\fR \fB /usr/lib/games/serioussam-vk-se/libGameMP.so\fR \fB /usr/lib/games/serioussam-vk-se/libEntitiesMP.so\fR @@ -303,6 +301,32 @@ from there, as well as the Levels directory to directories \fB ~/.serioussamse-vk\fR, respectively, for games Serious Sam: The First Encounter and Serious Sam: The Second Encounter. .PP +.SS Demo version +.PP +This implementation of the engine supports the use of content from the demo version of the game. When the game starts, +the engine determines the installed game content, and if it finds content from the demo version, it turns on the mode for using the demo version of the content. +A demo version of the game can be obtained from many places. For example: +.PP +\fB https://www.moddb.com/downloads/serious-sam-the-second-encounter\fR +.PP +\fB https://www.gamefront.com/games/serious-sam-the-second-encounter/file/serious-sam-the-second-encounter-demo\fR +.PP +The most convenient way is to download using the wget from the WebArchive. +To install content from the demo version of the game, open a terminal and run the following commands: +.PP +\fB sudo apt install p7zip\fR +\fB wget https://archive.org/download/serioussamsedemo/SeriousSamSEDemo.exe\fR +\fB wget https://archive.org/download/SeriousSamPatches/secondencounterpatch107_usa.exe\fR +\fB 7z x SeriousSamSEDemo.exe\fR +\fB 7z x -y secondencounterpatch107_usa.exe\fR +\fB mkdir ~/.serioussamse-vk\fR +\fB cp -ax Disk1/* ~/.serioussamse-vk\fR +\fB rm -fr Disk1\fR +.PP +When you first launch the game, goto Menu -> Options -> Execute Addons and select the default option. +The demo version uses old settings scripts. New ones you can take here: https://github.com/tx00100xt/SeriousSamClassic-VK +Just rewrite the Scripts directory replacing the files +.PP .SS Launching the game To start the game type in console: \fB serioussam-vk\fR or \fB serioussamse-vk\fR. You can also use the launch of the game through the menu. After installing the packages and copying all the data, you can check what we got. diff --git a/debian/source/include-binaries b/debian/source/include-binaries deleted file mode 100644 index bf7d0f9c..00000000 --- a/debian/source/include-binaries +++ /dev/null @@ -1,2 +0,0 @@ -SamTFE/SE1_10b.gro -SamTSE/SE1_10b.gro diff --git a/debian/source/options b/debian/source/options deleted file mode 100644 index b1d3dd56..00000000 --- a/debian/source/options +++ /dev/null @@ -1,67 +0,0 @@ -tar-ignore ".git" -tar-ignore ".github" -tar-ignore "appimage" -tar-ignore "flatpak" -tar-ignore "Images" -tar-ignore "man" -tar-ignore "templates" -tar-ignore "SamTFE/Bin" -tar-ignore "SamTFE/Controls" -tar-ignore "SamTFE/Data" -tar-ignore "SamTFE/Demos" -tar-ignore "SamTFE/Help" -tar-ignore "SamTFE/Levels" -tar-ignore "SamTFE/Players" -tar-ignore "SamTFE/Scripts" -tar-ignore "SamTFE/Sources/***/*.ini" -tar-ignore "SamTFE/Sources/Engine/zlib" -tar-ignore "SamTFE/Sources/EngineGui" -tar-ignore "SamTFE/Sources/External" -tar-ignore "SamTFE/Sources/GameGUIMP" -tar-ignore "SamTFE/Sources/LWSkaExporter" -tar-ignore "SamTFE/Sources/Modeler" -tar-ignore "SamTFE/Sources/RCon" -tar-ignore "SamTFE/Sources/SeriousSam/SeriousSam.aps" -tar-ignore "SamTFE/Sources/SeriousSam/Splash.bmp" -tar-ignore "SamTFE/Sources/SeriousSam/SplashMask.bmp" -tar-ignore "SamTFE/Sources/SeriousSkaStudio" -tar-ignore "SamTFE/Sources/WorldEditor" -tar-ignore "SamTFE/Temp" -tar-ignore "SamTFE/Tools.Win32" -tar-ignore "SamTFE/VirtualTrees" -tar-ignore "SamTFE/Sources/libvorbis" -tar-ignore "SamTFE/Sources/libogg" -tar-ignore "SamTFE/Sources/SamTFE.sln" -tar-ignore "SamTFE/Mods/SeriousSamTbn.tex" -tar-ignore "SamTFE/Mods/XPLUSTbn.tex" -tar-ignore "SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/CompiledSpirv" -tar-ignore "SamTSE/Bin" -tar-ignore "SamTSE/Controls" -tar-ignore "SamTSE/Data" -tar-ignore "SamTSE/Demos" -tar-ignore "SamTSE/Help" -tar-ignore "SamTSE/Levels" -tar-ignore "SamTSE/Players" -tar-ignore "SamTSE/Scripts" -tar-ignore "SamTSE/Sources/***/*.ini" -tar-ignore "SamTSE/Sources/Engine/zlib" -tar-ignore "SamTSE/Sources/EngineGui" -tar-ignore "SamTSE/Sources/External" -tar-ignore "SamTSE/Sources/GameGUIMP" -tar-ignore "SamTSE/Sources/LWSkaExporter" -tar-ignore "SamTSE/Sources/Modeler" -tar-ignore "SamTSE/Sources/RCon" -tar-ignore "SamTSE/Sources/SeriousSam/SeriousSam.aps" -tar-ignore "SamTSE/Sources/SeriousSam/Splash.bmp" -tar-ignore "SamTSE/Sources/SeriousSam/SplashMask.bmp" -tar-ignore "SamTSE/Sources/SeriousSkaStudio" -tar-ignore "SamTSE/Sources/WorldEditor" -tar-ignore "SamTSE/Temp" -tar-ignore "SamTSE/Tools.Win32" -tar-ignore "SamTSE/VirtualTrees" -tar-ignore "SamTSE/Sources/libvorbis" -tar-ignore "SamTSE/Sources/libogg" -tar-ignore "SamTSE/Sources/SamTSE.sln" -tar-ignore "SamTSE/Mods/SecondEncounterTbn.tex" -tar-ignore "SamTSE/Mods/XPLUSTbn.tex" -tar-ignore "SamTFE/Sources/Engine/Graphics/Vulkan/Shaders/CompiledSpirv"