From aaf110d4cc231dd0b61d1f9e1b80f4223308e28d Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 18 Mar 2014 13:40:08 +0400 Subject: [PATCH] 0024724: NT file routines in WOK use OSD_File::myFileChannel instead of myFileHandle Propagate #0024259 "Clean up OSD_File implementation" to WOK. CDLFront - cosmetics --- src/CDLFront/CDL.lex | 2 +- src/CDLFront/CDL.tab.c | 2 +- src/CDLFront/CDL.yacc | 2 +- src/CDLFront/CDLFront.cxx | 3628 +++++++++++++++--------------- src/CPPExt/CPPExt_Standard.edl | 24 +- src/WOKNT/WOKNT_MixedOutput.cdl | 6 +- src/WOKNT/WOKNT_MixedOutput.cxx | 118 +- src/WOKNT/WOKNT_OutErrOutput.cdl | 6 +- src/WOKNT/WOKNT_OutErrOutput.cxx | 52 +- src/WOKNT/WOKNT_ShellOutput.cdl | 4 +- src/WOKNT/WOKNT_ShellOutput.cxx | 2 +- 11 files changed, 1893 insertions(+), 1953 deletions(-) diff --git a/src/CDLFront/CDL.lex b/src/CDLFront/CDL.lex index 11b7130..0275657 100755 --- a/src/CDLFront/CDL.lex +++ b/src/CDLFront/CDL.lex @@ -25,7 +25,7 @@ int CDLlineno; # define YY_NO_UNPUT #endif /* YY_NO_UNPUT */ -extern void CDLerror ( char* ); +extern void CDLerror ( const char* ); %} diff --git a/src/CDLFront/CDL.tab.c b/src/CDLFront/CDL.tab.c index 429c25b..1ab2a67 100755 --- a/src/CDLFront/CDL.tab.c +++ b/src/CDLFront/CDL.tab.c @@ -97,7 +97,7 @@ #include #include -extern void CDLerror ( char* ); +extern void CDLerror ( const char* ); extern int CDLlex ( void ); diff --git a/src/CDLFront/CDL.yacc b/src/CDLFront/CDL.yacc index 9d49eab..5f423aa 100755 --- a/src/CDLFront/CDL.yacc +++ b/src/CDLFront/CDL.yacc @@ -34,7 +34,7 @@ #include #include -extern void CDLerror ( char* ); +extern void CDLerror ( const char* ); extern int CDLlex ( void ); %} diff --git a/src/CDLFront/CDLFront.cxx b/src/CDLFront/CDLFront.cxx index 6510a06..3207d64 100755 --- a/src/CDLFront/CDLFront.cxx +++ b/src/CDLFront/CDLFront.cxx @@ -1,61 +1,42 @@ // CDLFront.cxx Version 1.1 -// -// Date: 06/04/1995 -// -// -// -#include -#include -// Standard includes -// -#include +// Date: 06/04/1995 -// MS includes -// -#include -#include -#include +#include +#include +#include +#include #include - -#include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include #include +#include #include -#include -#include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include - -#include - -#include - -#include -#include - -// instantiations -// +#include +#include +#include +#include +#include #include #include #include @@ -64,568 +45,324 @@ #include #include #include - -// Collections includes -// +#include #include #include #include -// CDLFront include -#include +#include +#include // lex and yacc glue includes -// -extern "C" { -#include +extern "C" +{ + #include } #include #include -void CDL_InitVariable(); - -static int YY_nb_error; -static int YY_nb_warning; -static Handle(TCollection_HAsciiString)& CDLFileName() { - static Handle(TCollection_HAsciiString) CDLFileName; - return CDLFileName; -} - -//======================================================================= -//function : CDLerror -//purpose : -//======================================================================= -extern "C" { - void CDLerror(char* text) { - extern int CDLlineno; - // - // The unix like error declaration - // - if (text == NULL) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" \ - << ", line " << CDLlineno << ": syntax error..." << endm; - CDL_InitVariable(); - MS_TraductionError::Raise("Syntax error"); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << CDLlineno << ": " << text << endm; - YY_nb_error++; - } - } -// int yyparse(); -#ifdef YYDEBUG - extern int yydebug = 1; -#endif -} - -// line number of method definition (for C++ directive error) -// -static Standard_Integer methodlineno = 0; +#include +#include -#define MAX_CHAR 256 +#define THE_MAX_CHAR 256 // type of the current entity -// -#define CDL_NULL 0 -#define CDL_PACKAGE 1 -#define CDL_STDCLASS 2 -#define CDL_GENCLASS 3 -#define CDL_NESCLASS 4 -#define CDL_INCDECL 5 -#define CDL_GENTYPE 6 -#define CDL_INTERFACE 7 -#define CDL_EXECUTABLE 8 -#define CDL_CLIENT 9 - -#define CDL_CPP 1 -#define CDL_FOR 2 -#define CDL_C 3 -#define CDL_OBJ 4 -#define CDL_LIBRARY 5 -#define CDL_EXTERNAL 6 - -#define CDL_MUSTNOTCHECKUSES 0 -#define CDL_MUSTCHECKUSES 1 - -// because we don't check uses for friends -// -static Standard_Integer CheckUsesForClasses = CDL_MUSTCHECKUSES; - -static Standard_Integer Current_Entity = CDL_NULL; -static Standard_Integer SaveState = CDL_NULL; +enum +{ + CDL_NULL = 0, + CDL_PACKAGE = 1, + CDL_STDCLASS = 2, + CDL_GENCLASS = 3, + CDL_NESCLASS = 4, + CDL_INCDECL = 5, + CDL_GENTYPE = 6, + CDL_INTERFACE = 7, + CDL_EXECUTABLE = 8, + CDL_CLIENT = 9 +}; + +enum +{ + CDL_CPP = 1, + CDL_FOR = 2, + CDL_C = 3, + CDL_OBJ = 4, + CDL_LIBRARY = 5, + CDL_EXTERNAL = 6 +}; + +enum +{ + CDL_MUSTNOTCHECKUSES = 0, + CDL_MUSTCHECKUSES = 1 +}; // lex variable // line number -// -#ifndef WNT -extern int CDLlineno; -#else -extern "C" int CDLlineno; -#endif // WNT - -#ifndef WNT -extern FILE *CDLin; +#ifndef _WIN32 + extern int CDLlineno; + extern FILE* CDLin; #else -extern "C" FILE *CDLin; -#endif // WNT - -// The Flags -// -static Standard_Boolean Private = Standard_False, - Protected = Standard_False, - Static = Standard_True, - Deferred = Standard_False, - Redefined = Standard_False, - Like = Standard_False, - Any = Standard_False, - CPPReturnRef = Standard_False, - CPPReturnConst = Standard_False, - CPPOperator = Standard_False, - CPPAlias = Standard_False, - CPPInline = Standard_False; - -static Standard_Boolean DynaType = Standard_False; - - -// The Identifiers -// -static char thetypename [MAX_CHAR + 1], // The name of the current type - Pack_Name [MAX_CHAR + 1]; // The Name of package - -// The Classes -// -static Standard_Integer Mutable = 0, - InOrOut = MS_IN; - -// Container : an entity where type are declared or defined -// ex.: a package, an interface,... -// - -static Handle(TCollection_HAsciiString)& Container() { - static Handle(TCollection_HAsciiString) Container = new TCollection_HAsciiString; - return Container; -} -// The variables representing the analyze of current object -// The Conventions: -// Begining of analyse: a new object is creating. -// End of analyse: the variable is nullified -// - -// The Schema variables -// -static Handle(MS_Schema)& Schema() { - static Handle(MS_Schema) Schema; // The current Schema - return Schema; -} - -// The Engine variables -// -static Handle(MS_Engine)& Engine() { - static Handle(MS_Engine) Engine; // The current Engine - return Engine; -} - -// The Component variables -// -static Handle(MS_Component)& Component() { - static Handle(MS_Component) Component; // The current Component - return Component; -} - -// The Executable variables -// -static Handle(MS_Executable)& Executable() { - static Handle(MS_Executable) Executable; // The current Executable - return Executable; -} - -static Handle(MS_ExecPart)& ExecPart() { - static Handle(MS_ExecPart) ExecPart; // The current ExePart - return ExecPart; -} - -static Handle(MS_HSequenceOfExecPart)& ExecTable() { - static Handle(MS_HSequenceOfExecPart) ExecTable; - return ExecTable; -} - -static int ExecutableLanguage; -static int ExecutableUseType; - -// The Client variables -// -static Handle(MS_Client)& Client() { - static Handle(MS_Client) Client; // The current Client - return Client; -} - -// The Interface variables -// -static Handle(MS_Interface)& Interface() { - static Handle(MS_Interface) Interface; // The current Interface - return Interface; -} - -// The Package variables -// -static Handle(MS_Package)& Package() { - static Handle(MS_Package) Package; // The current package - return Package; -} - -// The Alias variables -// -static Handle(MS_Alias)& Alias() { - static Handle(MS_Alias) Alias; // The current Alias - return Alias; -} - -// The Pointer variables -// -static Handle(MS_Pointer)& Pointer() { - static Handle(MS_Pointer) Pointer; // The current Pointer - return Pointer; -} - -// The Imported variables -// -static Handle(MS_Imported)& Imported() { - static Handle(MS_Imported) Imported; // The current Imported - return Imported; -} - -// The primitive variables -// -static Handle(MS_PrimType)& Primitive() { - static Handle(MS_PrimType) Primitive; // The current Primitive - return Primitive; -} - -// The Enum variables -// -static Handle(MS_Enum)& Enum() { - static Handle(MS_Enum) Enum; // The current enum - return Enum; -} - -// The Error (exception) class -// -static Handle(MS_Error)& Exception() { - static Handle(MS_Error) Exception; - return Exception; -} - -// For dynamic generic instantiation like -// generic class toto (item1, this one --> item2 as list from TCollection(item1)) -// -static Handle(MS_GenType)& DynType() { - static Handle(MS_GenType) DynType; - return DynType; -} - -// The Class variables -// -static Handle(MS_Class)& SimpleClass() { - static Handle(MS_Class) SimpleClass; - return SimpleClass; -} - -static Handle(MS_StdClass)& Class() { - static Handle(MS_StdClass) Class; // The current class - return Class; -} - -static Handle(MS_StdClass)& StdClass() { - static Handle(MS_StdClass) StdClass; // The current class is - return StdClass; // a Standard Class -} - -static Handle(MS_StdClass)& GenStdClass() { - static Handle(MS_StdClass) GenStdClass;// The current class - return GenStdClass; // descipt a Generic Class -} - -static Handle(MS_Error)& Error() { - static Handle(MS_Error) Error; // The current class is - return Error; // a Exception -} - -static Handle(MS_GenClass)& GenClass() { - static Handle(MS_GenClass) GenClass; // The current class is - return GenClass; // a Generic class - -} - -static Handle(MS_InstClass)& InstClass() { - static Handle(MS_InstClass) InstClass; // The current class is - return InstClass; // a instanciated class -} - -static Handle(MS_GenClass)& Embeded() { -static Handle(MS_GenClass) Embeded; // The current class is - return Embeded; // embeded class -} - -// The Method variables -// -static Handle(TCollection_HAsciiString)& MethodName() { - static Handle(TCollection_HAsciiString) MethodName = new TCollection_HAsciiString; - return MethodName; -} - -static Handle(MS_Method)& Method() { - static Handle(MS_Method) Method; // The current method - return Method; -} - -static Handle(MS_MemberMet)& MemberMet() { - static Handle(MS_MemberMet) MemberMet; // The Membermethod - return MemberMet; -} - -static Handle(MS_ExternMet)& ExternMet() { - static Handle(MS_ExternMet) ExternMet; // The current metod is - return ExternMet; // a method of package -} - -static Handle(MS_Construc)& Construc() { - static Handle(MS_Construc) Construc; // The current metod is - return Construc; // a constructeur -} - -static Handle(MS_InstMet)& InstMet() { - static Handle(MS_InstMet) InstMet; // The current metod is - return InstMet; // a method of instance -} - -static Handle(MS_ClassMet)& ClassMet() { - static Handle(MS_ClassMet) ClassMet; // The current metod is - return ClassMet; // a method of class -} - -static Handle(MS_HSequenceOfParam)& MethodParams() { - static Handle(MS_HSequenceOfParam) MethodParams; // The current method parameters - return MethodParams; -} - -// The most important : the meta-schema -// -static Handle(MS_MetaSchema)& theMetaSchema() { - static Handle(MS_MetaSchema) theMetaSchema; - return theMetaSchema; -} - -// The Field variables -// -static Handle(MS_Field)& Field() { - static Handle(MS_Field) Field; - return Field; -} - -static Handle(TCollection_HAsciiString)& DefCons() { - static Handle(TCollection_HAsciiString) DefCons = new TCollection_HAsciiString("Initialize"); - return DefCons; -} - -static Handle(TCollection_HAsciiString)& NorCons() { - static Handle(TCollection_HAsciiString) NorCons = new TCollection_HAsciiString("Create"); - return NorCons; -} - -// The Parameter variables -// -static Handle(MS_Param)& Param() { - static Handle(MS_Param) Param; - return Param; -} - -static Standard_Integer ParamType = 0; - -static Handle(TCollection_HAsciiString)& ParamValue() { - static Handle(TCollection_HAsciiString) ParamValue; - return ParamValue; -} - -// for clause like : type1,type2,type3, ... ,typen -// -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfTypes() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfTypes = new TColStd_HSequenceOfHAsciiString; - return ListOfTypes; -} - -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfPackages() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfPackages = new TColStd_HSequenceOfHAsciiString; - return ListOfPackages; -} - -// for generic classes (generic item1, ... ,generic itemn) -// -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfItem() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfItem = new TColStd_HSequenceOfHAsciiString; - return ListOfItem; -} - -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfName() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfName = new TColStd_HSequenceOfHAsciiString; - return ListOfName; -} - -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfCplusplus() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfCplusplus = new TColStd_HSequenceOfHAsciiString; - return ListOfCplusplus; -} - -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfComments() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfComments = new TColStd_HSequenceOfHAsciiString; - return ListOfComments; -} - -static Handle(TColStd_HSequenceOfInteger)& ListOfCPPType() { - static Handle(TColStd_HSequenceOfInteger) ListOfCPPType = new TColStd_HSequenceOfInteger; - return ListOfCPPType; -} - -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfInteger() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfInteger = new TColStd_HSequenceOfHAsciiString; - return ListOfInteger; -} - -// this is a dummy package name for generic type (item, etc...) -// -const char *aDummyPackageName = "___D"; -const char *theRootPack = "Standard"; -char thePackNameFound[128]; - -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfGlobalUsed() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfGlobalUsed; - return ListOfGlobalUsed; -} + extern "C" int CDLlineno; + extern "C" FILE* CDLin; +#endif -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfTypeUsed() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfTypeUsed; - return ListOfTypeUsed; -} +namespace +{ + static int YY_nb_error; + static int YY_nb_warning; + static Handle(TCollection_HAsciiString) TheCDLFileName; + + // line number of method definition (for C++ directive error) + static Standard_Integer TheMethodLineNo = 0; + + // because we don't check uses for friends + static Standard_Integer TheCheckUsesForClasses = CDL_MUSTCHECKUSES; + static Standard_Integer TheCurrentEntity = CDL_NULL; + static Standard_Integer TheSaveState = CDL_NULL; + + // The Flags + static Standard_Boolean TheIsPrivate = Standard_False, + TheIsProtected = Standard_False, + TheIsStatic = Standard_True, + TheIsDeferred = Standard_False, + TheIsRedefined = Standard_False, + TheIsLike = Standard_False, + TheIsAny = Standard_False, + TheIsCPPReturnRef = Standard_False, + TheIsCPPReturnConst = Standard_False, + TheIsCPPOperator = Standard_False, + TheIsCPPAlias = Standard_False, + TheIsCPPInline = Standard_False; + + // The Identifiers + static char TheTypeName[THE_MAX_CHAR + 1], //!< The name of the current type + ThePackName[THE_MAX_CHAR + 1]; //!< The Name of package + + // The Classes + static Standard_Integer TheMutable = 0, + TheInOrOut = MS_IN; + + // Container : an entity where type are declared or defined + // ex.: a package, an interface,... + static Handle(TCollection_HAsciiString) TheContainer = new TCollection_HAsciiString(); + + // The variables representing the analyze of current object + // The Conventions: + // Beginning of analysis: a new object is creating + // End of analysis: the variable is nullified + // + static Handle(MS_Schema) TheSchema; //!< The current Schema + static Handle(MS_Engine) TheEngine; //!< The current Engine + static Handle(MS_Component) TheComponent; //!< The current Component + + static Handle(MS_Executable) TheExecutable; //!< The current Executable + static Handle(MS_ExecPart) TheExecPart; //!< The current ExePart + static Handle(MS_HSequenceOfExecPart) TheExecTable; + + static int TheExecutableLanguage = CDL_CPP; + static int TheExecutableUseType = 0; + + static Handle(MS_Client) TheClient; //!< The current Client + static Handle(MS_Interface) TheInterface; //!< The current Interface + static Handle(MS_Package) ThePackage; //!< The current package + static Handle(MS_Alias) TheAlias; //!< The current Alias + static Handle(MS_Pointer) ThePointer; //!< The current Pointer + static Handle(MS_Imported) TheImported; //!< The current Imported + static Handle(MS_PrimType) ThePrimitive; //!< The current Primitive + static Handle(MS_Enum) TheEnum; //!< The current enum + static Handle(MS_Error) TheException; //!< The Error (exception) class + //! For dynamic generic instantiation like + //! generic class toto (item1, this one --> item2 as list from TCollection(item1)) + static Handle(MS_GenType) TheDynType; + static Handle(MS_Class) TheSimpleClass; + static Handle(MS_StdClass) TheClass; //!< The current class + static Handle(MS_StdClass) TheStdClass; //!< The current class is a Standard Class + static Handle(MS_StdClass) TheGenStdClass; //!< The current class descipt a Generic Class + static Handle(MS_Error) TheError; //!< The current class is a Exception + static Handle(MS_GenClass) TheGenClass; //!< The current class is a Generic class + static Handle(MS_InstClass) TheInstClass; //!< The current class is a instantiated class + static Handle(MS_GenClass) TheEmbeded; //!< The current class is embedded class + static Handle(TCollection_HAsciiString) TheMethodName = new TCollection_HAsciiString(); + static Handle(MS_Method) TheMethod; //!< The current method + static Handle(MS_MemberMet) TheMemberMet; //!< The Member method + static Handle(MS_ExternMet) TheExternMet; //!< The current method is a method of package + static Handle(MS_Construc) TheConstruc; //!< The current method is a constructor + static Handle(MS_InstMet) TheInstMet; //!< The current method is a method of instance + static Handle(MS_ClassMet) TheClassMet; //!< The current method is a method of class + static Handle(MS_HSequenceOfParam) TheMethodParams; //!< The current method parameters + static Handle(MS_MetaSchema) TheMetaSchema; //!< The most important : the meta-schema + static Handle(MS_Field) TheField; //!< The Field variables + static Handle(TCollection_HAsciiString) TheDefCons = new TCollection_HAsciiString ("Initialize"); + static Handle(TCollection_HAsciiString) TheNorCons = new TCollection_HAsciiString ("Create"); + + // The Parameter variables + static Handle(MS_Param) TheParam; + static Standard_Integer TheParamType = 0; + static Handle(TCollection_HAsciiString) TheParamValue; + // for clause like : type1,type2,type3, ... ,typen + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfTypes = new TColStd_HSequenceOfHAsciiString(); + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfPackages = new TColStd_HSequenceOfHAsciiString(); + + // for generic classes (generic item1, ... ,generic itemn) + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfItem = new TColStd_HSequenceOfHAsciiString(); + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfName = new TColStd_HSequenceOfHAsciiString(); + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfCplusplus = new TColStd_HSequenceOfHAsciiString(); + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfComments = new TColStd_HSequenceOfHAsciiString(); + + static Handle(TColStd_HSequenceOfInteger) TheListOfCPPType = new TColStd_HSequenceOfInteger(); + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfInteger = new TColStd_HSequenceOfHAsciiString(); + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfGlobalUsed; + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfTypeUsed; + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfInst; + static Handle(TColStd_HSequenceOfHAsciiString) TheListOfGen; + + // this is a dummy package name for generic type (item, etc...) + // + static const char* THE_DUMMY_PACKAGE_NAME = "___D"; + static const char* THE_ROOT_PACKAGE = "Standard"; + static char ThePackNameFound[THE_MAX_CHAR + 1]; -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfInst() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfInst; - return ListOfInst; -} +} // namespace -static Handle(TColStd_HSequenceOfHAsciiString)& ListOfGen() { - static Handle(TColStd_HSequenceOfHAsciiString) ListOfGen; - return ListOfGen; +void CDL_MustNotCheckUses() +{ + TheCheckUsesForClasses = CDL_MUSTNOTCHECKUSES; } -void CDL_MustNotCheckUses() +void CDL_MustCheckUses() { - CheckUsesForClasses = CDL_MUSTNOTCHECKUSES; + TheCheckUsesForClasses = CDL_MUSTCHECKUSES; } -void CDL_MustCheckUses() +void CDL_InitVariable() { - CheckUsesForClasses = CDL_MUSTCHECKUSES; + TheCheckUsesForClasses = CDL_MUSTCHECKUSES; + TheCurrentEntity = CDL_NULL; + TheSaveState = CDL_NULL; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; + TheIsAny = Standard_False; + TheIsCPPReturnRef = Standard_False; + TheIsCPPReturnConst = Standard_False; + TheIsCPPOperator = Standard_False; + TheIsCPPAlias = Standard_False; + TheIsCPPInline = Standard_False; + YY_nb_error = 0; + YY_nb_warning = 0; + + TheMutable = 0; + TheInOrOut = MS_IN; + TheContainer = new TCollection_HAsciiString; + TheSchema.Nullify(); + TheEngine.Nullify(); + TheComponent.Nullify(); + TheExecutable.Nullify(); + TheExecPart.Nullify(); + TheExecTable.Nullify(); + TheExecutableLanguage = CDL_CPP; + TheExecutableUseType = CDL_LIBRARY; + TheInterface.Nullify(); + ThePackage.Nullify(); + TheAlias.Nullify(); + ThePointer.Nullify(); + TheImported.Nullify(); + ThePrimitive.Nullify(); + TheEnum.Nullify(); + TheException.Nullify(); + TheDynType.Nullify(); + TheSimpleClass.Nullify(); + TheClass.Nullify(); + TheStdClass.Nullify(); + TheGenStdClass.Nullify(); + TheError.Nullify(); + TheGenClass.Nullify(); + TheInstClass.Nullify(); + TheEmbeded.Nullify(); + TheMethodName = new TCollection_HAsciiString; + TheMethod.Nullify(); + TheMemberMet.Nullify(); + TheExternMet.Nullify(); + TheConstruc.Nullify(); + TheMethodParams.Nullify(); + TheInstMet.Nullify(); + TheClassMet.Nullify(); + TheMetaSchema.Nullify(); + TheField.Nullify(); + TheParam.Nullify(); + TheParamType = 0; + TheParamValue.Nullify(); + TheClient.Nullify(); + TheListOfTypes = new TColStd_HSequenceOfHAsciiString(); + TheListOfPackages = new TColStd_HSequenceOfHAsciiString(); + TheListOfItem = new TColStd_HSequenceOfHAsciiString(); + TheListOfName = new TColStd_HSequenceOfHAsciiString(); + TheListOfCplusplus = new TColStd_HSequenceOfHAsciiString(); + TheListOfComments = new TColStd_HSequenceOfHAsciiString(); + TheListOfCPPType = new TColStd_HSequenceOfInteger(); + TheListOfInteger = new TColStd_HSequenceOfHAsciiString(); + TheListOfGlobalUsed.Nullify(); + TheListOfGlobalUsed.Nullify(); + TheListOfInst.Nullify(); + TheListOfGen.Nullify(); } -void CDL_InitVariable() +//======================================================================= +//function : CDLerror +//purpose : +//======================================================================= +extern "C" { - CheckUsesForClasses = CDL_MUSTCHECKUSES; - Current_Entity = CDL_NULL; - SaveState = CDL_NULL; - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; - Any = Standard_False; - CPPReturnRef = Standard_False; - CPPReturnConst = Standard_False; - CPPOperator = Standard_False; - CPPAlias = Standard_False; - CPPInline = Standard_False; - YY_nb_error = 0; - YY_nb_warning = 0; - - DynaType = Standard_False; - Mutable = 0; - InOrOut = MS_IN; - Container() = new TCollection_HAsciiString; - Schema().Nullify(); - Engine().Nullify(); - Component().Nullify(); - Executable().Nullify(); - ExecPart().Nullify(); - ExecTable().Nullify(); - ExecutableLanguage = CDL_CPP; - ExecutableUseType = CDL_LIBRARY; - Interface().Nullify(); - Package().Nullify(); - Alias().Nullify(); - Pointer().Nullify(); - Imported().Nullify(); - Primitive().Nullify(); - Enum().Nullify(); - Exception().Nullify(); - DynType().Nullify(); - SimpleClass().Nullify(); - Class().Nullify(); - StdClass().Nullify(); - GenStdClass().Nullify(); - Error().Nullify(); - GenClass().Nullify(); - InstClass().Nullify(); - Embeded().Nullify(); - MethodName() = new TCollection_HAsciiString; - Method().Nullify(); - MemberMet().Nullify(); - ExternMet().Nullify(); - Construc().Nullify(); - MethodParams().Nullify(); - InstMet().Nullify(); - ClassMet().Nullify(); - theMetaSchema().Nullify(); - Field().Nullify(); - Param().Nullify(); - ParamType = 0; - ParamValue().Nullify(); - Client().Nullify(); - ListOfTypes() = new TColStd_HSequenceOfHAsciiString; - ListOfPackages() = new TColStd_HSequenceOfHAsciiString; - ListOfItem() = new TColStd_HSequenceOfHAsciiString; - ListOfName() = new TColStd_HSequenceOfHAsciiString; - ListOfCplusplus() = new TColStd_HSequenceOfHAsciiString; - ListOfComments() = new TColStd_HSequenceOfHAsciiString; - ListOfCPPType() = new TColStd_HSequenceOfInteger; - ListOfInteger() = new TColStd_HSequenceOfHAsciiString; - ListOfGlobalUsed().Nullify(); - ListOfTypeUsed().Nullify(); - ListOfInst().Nullify(); - ListOfGen().Nullify(); + void CDLerror (const char* theText) + { + extern int CDLlineno; + // + // The unix like error declaration + // + if (theText == NULL) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": syntax error..." << endm; + CDL_InitVariable(); + MS_TraductionError::Raise("Syntax error"); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << theText << endm; + YY_nb_error++; + } + } +// int yyparse(); +#ifdef YYDEBUG + extern int yydebug = 1; +#endif } // //////////////////////////////////////// // Implementation // // //////////////////////////////////////// -void Clear_ListOfItem() +void Clear_ListOfItem() { - ListOfItem()->Clear(); + TheListOfItem->Clear(); } -void set_inc_state() +void set_inc_state() { - SaveState = Current_Entity; - Current_Entity = CDL_INCDECL; + TheSaveState = TheCurrentEntity; + TheCurrentEntity = CDL_INCDECL; } -void restore_state() +void restore_state() { - Current_Entity = SaveState; + TheCurrentEntity = TheSaveState; } -void Type_Name(char *aName) +void Type_Name(char* aName) { - strncpy(thetypename,aName,MAX_CHAR); + strncpy(TheTypeName,aName,THE_MAX_CHAR); } //======================================================================= @@ -634,15 +371,15 @@ void Type_Name(char *aName) //======================================================================= void CheckCommentListIsEmpty (const char* /*theFunctionName*/) { - if (ListOfComments()->IsEmpty()) + if (TheListOfComments->IsEmpty()) { return; } TCollection_AsciiString aMsg; - for (Standard_Integer aCommentIter = 1; aCommentIter <= ListOfComments()->Length(); ++aCommentIter) + for (Standard_Integer aCommentIter = 1; aCommentIter <= TheListOfComments->Length(); ++aCommentIter) { - Handle(TCollection_HAsciiString)& aComment = ListOfComments()->ChangeValue (aCommentIter); + Handle(TCollection_HAsciiString)& aComment = TheListOfComments->ChangeValue (aCommentIter); aComment->RightAdjust(); aComment->LeftAdjust(); aMsg += aComment->String(); @@ -658,83 +395,97 @@ void CheckCommentListIsEmpty (const char* /*theFunctionName*/) // //======================================================================= //function : VerifyClassUses -//purpose : +//purpose : //======================================================================= -Standard_Boolean VerifyClassUses(const Handle(TCollection_HAsciiString)& theTypeName) +Standard_Boolean VerifyClassUses(const Handle(TCollection_HAsciiString)& theTypeName) { - if ((Current_Entity == CDL_STDCLASS || - Current_Entity == CDL_GENCLASS) && - CheckUsesForClasses == CDL_MUSTCHECKUSES) { + if ((TheCurrentEntity == CDL_STDCLASS || + TheCurrentEntity == CDL_GENCLASS) && + TheCheckUsesForClasses == CDL_MUSTCHECKUSES) + { // WARNING : dirty code -> here is !!! (sorry for future hacker, guilty : CLE) // - if (strncmp("Standard_",theTypeName->ToCString(),9) == 0) { - if (theMetaSchema()->IsDefined(theTypeName)) { - ListOfTypeUsed()->Append(theTypeName); + if (strncmp("Standard_",theTypeName->ToCString(),9) == 0) + { + if (TheMetaSchema->IsDefined(theTypeName)) + { + TheListOfGlobalUsed->Append(theTypeName); - return Standard_True; + return Standard_True; } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << CDLlineno << ": " \ - << "The package Standard has no declaration of " \ - << "'" << theTypeName << "'" << endm; - YY_nb_error++; - return Standard_True; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << CDLlineno << ": " + << "The package Standard has no declaration of " + << "'" << theTypeName << "'" << endm; + YY_nb_error++; + return Standard_True; } } - if (theTypeName->IsSameString(SimpleClass()->FullName())) return Standard_True; + if (theTypeName->IsSameString(TheSimpleClass->FullName())) return Standard_True; - if (Current_Entity == CDL_GENCLASS) { - if (theTypeName->IsSameString(GenClass()->FullName())) return Standard_True; + if (TheCurrentEntity == CDL_GENCLASS) + { + if (theTypeName->IsSameString(TheGenClass->FullName())) return Standard_True; Standard_Integer i; - Handle(TColStd_HSequenceOfHAsciiString) seqascii = GenClass()->GetNestedName(); + Handle(TColStd_HSequenceOfHAsciiString) seqascii = TheGenClass->GetNestedName(); Handle(TCollection_HAsciiString) nestname, - nestnestname = new TCollection_HAsciiString; - - if (theMetaSchema()->IsDefined(theTypeName)) { - Handle(MS_Type) theType = theMetaSchema()->GetType(theTypeName); - - if (theType->IsKind(STANDARD_TYPE(MS_Class))) { - Handle(MS_Class) inst = *((Handle(MS_Class)*)&theType); - - if (!inst->GetNestingClass().IsNull()) { - if (GenClass()->FullName()->IsSameString(inst->GetNestingClass())) return Standard_True; - nestnestname = inst->GetNestingClass(); - } - } + nestnestname = new TCollection_HAsciiString(); + + if (TheMetaSchema->IsDefined(theTypeName)) + { + Handle(MS_Type) theType = TheMetaSchema->GetType(theTypeName); + + if (theType->IsKind(STANDARD_TYPE(MS_Class))) + { + Handle(MS_Class) inst = *((Handle(MS_Class)*)&theType); + + if (!inst->GetNestingClass().IsNull()) + { + if (TheGenClass->FullName()->IsSameString(inst->GetNestingClass())) return Standard_True; + nestnestname = inst->GetNestingClass(); + } + } } - for (i = 1; i <= seqascii->Length(); i++) { - nestname = MS::BuildFullName(Container(),seqascii->Value(i)); + for (i = 1; i <= seqascii->Length(); i++) + { + nestname = MS::BuildFullName(TheContainer,seqascii->Value(i)); - if (theTypeName->IsSameString(nestname) || nestnestname->IsSameString(nestname)) { - return Standard_True; - } + if (theTypeName->IsSameString(nestname) || nestnestname->IsSameString(nestname)) + { + return Standard_True; + } } - Handle(MS_HSequenceOfGenType) genericitems = GenClass()->GenTypes(); + Handle(MS_HSequenceOfGenType) genericitems = TheGenClass->GenTypes(); - for (i = 1; i <= genericitems->Length(); i++) { - if (genericitems->Value(i)->Name()->IsSameString(theTypeName)) { - return Standard_True; - } + for (i = 1; i <= genericitems->Length(); i++) + { + if (genericitems->Value(i)->Name()->IsSameString(theTypeName)) + { + return Standard_True; + } } } - Handle(TColStd_HSequenceOfHAsciiString) seqOfType = SimpleClass()->GetUsesNames(); + Handle(TColStd_HSequenceOfHAsciiString) seqOfType = TheSimpleClass->GetUsesNames(); - for (Standard_Integer i = 1; i <= seqOfType->Length(); i++) { - if (seqOfType->Value(i)->IsSameString(theTypeName)) { - return Standard_True; - } - } + for (Standard_Integer i = 1; i <= seqOfType->Length(); i++) + { + if (seqOfType->Value(i)->IsSameString(theTypeName)) + { + return Standard_True; + } + } - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString()\ - << "\"" << ", line " << CDLlineno << ": " \ - << "The 'uses' statement of your class has no declaration of : " \ - << theTypeName << endm; + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << CDLlineno << ": " + << "The 'uses' statement of your class has no declaration of : " + << theTypeName << endm; YY_nb_error++; } else return Standard_True; @@ -744,13 +495,14 @@ Standard_Boolean VerifyClassUses(const Handle(TCollection_HAsciiString)& theType //======================================================================= //function : VerifyUses -//purpose : +//purpose : //======================================================================= Standard_Boolean VerifyUses(char* used) { - if (Current_Entity == CDL_PACKAGE || - Current_Entity == CDL_INTERFACE || - Current_Entity == CDL_EXECUTABLE) { + if (TheCurrentEntity == CDL_PACKAGE || + TheCurrentEntity == CDL_INTERFACE || + TheCurrentEntity == CDL_EXECUTABLE) + { Handle(TColStd_HSequenceOfHAsciiString) aSeqOfPackage; Handle(MS_Package) aPackage; Handle(MS_Interface) anInterface; @@ -759,181 +511,210 @@ Standard_Boolean VerifyUses(char* used) Standard_Boolean status = Standard_False; Standard_Integer i; - if (theMetaSchema()->IsPackage(Container())) { - aPackage = theMetaSchema()->GetPackage(Container()); + if (TheMetaSchema->IsPackage(TheContainer)) + { + aPackage = TheMetaSchema->GetPackage(TheContainer); aSeqOfPackage = aPackage->Uses(); - } - else if (theMetaSchema()->IsInterface(Container())) { - anInterface = theMetaSchema()->GetInterface(Container()); + } + else if (TheMetaSchema->IsInterface(TheContainer)) + { + anInterface = TheMetaSchema->GetInterface(TheContainer); aSeqOfPackage = anInterface->Uses(); } - else if (theMetaSchema()->IsEngine(Container())) { - anEngine = theMetaSchema()->GetEngine(Container()); + else if (TheMetaSchema->IsEngine(TheContainer)) + { + anEngine = TheMetaSchema->GetEngine(TheContainer); aSeqOfPackage = anEngine->Uses(); } - else if (theMetaSchema()->IsComponent(Container())) { - aComponent = theMetaSchema()->GetComponent(Container()); + else if (TheMetaSchema->IsComponent(TheContainer)) + { + aComponent = TheMetaSchema->GetComponent(TheContainer); aSeqOfPackage = aComponent->Uses(); } - - for (i = 1; i <= aSeqOfPackage->Length() && (status == 0); i++) { - if (strcmp(aSeqOfPackage->Value(i)->ToCString(),used) == 0) { - status = Standard_True; + + for (i = 1; i <= aSeqOfPackage->Length() && (status == 0); i++) + { + if (strcmp(aSeqOfPackage->Value(i)->ToCString(),used) == 0) + { + status = Standard_True; } } - + return status; } else return Standard_True; } -void Type_Pack(char *aName) +void Type_Pack(char* aName) { - if (!VerifyUses(aName)) { + if (!VerifyUses(aName)) + { Handle(TCollection_HAsciiString) msg = new TCollection_HAsciiString("the entity : "); msg->AssignCat(aName); msg->AssignCat(" is not in the 'uses' clause of "); - msg->AssignCat(Container()); + msg->AssignCat(TheContainer); CDLerror((char*)msg->ToCString()); } - strncpy(Pack_Name,aName,MAX_CHAR); + strncpy(ThePackName,aName,THE_MAX_CHAR); } -char *TypeCompletion(char *aName) +char* TypeCompletion(char* aName) { - Handle(TColStd_HSequenceOfHAsciiString) aSeqOfPackage; - Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString; - Standard_Integer i; - - if (Current_Entity == CDL_GENCLASS || Current_Entity == CDL_STDCLASS) { - Handle(TCollection_HAsciiString) aPackageName, thethetypename = new TCollection_HAsciiString(aName); - + Handle(TColStd_HSequenceOfHAsciiString) aSeqOfPackage; + Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString(); + Standard_Integer i; - if (SimpleClass()->Name()->IsSameString(thethetypename)) { - return (char *)Container()->ToCString(); + if (TheCurrentEntity == CDL_GENCLASS || TheCurrentEntity == CDL_STDCLASS) + { + Handle(TCollection_HAsciiString) aPackageName, thethetypename = new TCollection_HAsciiString (aName); + + + if (TheSimpleClass->Name()->IsSameString(thethetypename)) + { + return (char*)TheContainer->ToCString(); } - aSeqOfPackage = SimpleClass()->GetUsesNames(); - for (i = 1; i <= aSeqOfPackage->Length(); i++) { + aSeqOfPackage = TheSimpleClass->GetUsesNames(); + for (i = 1; i <= aSeqOfPackage->Length(); i++) + { aPackageName = aSeqOfPackage->Value(i)->Token("_"); - if (aSeqOfPackage->Value(i)->IsSameString(MS::BuildFullName(aPackageName,thethetypename))) { - strcpy(thePackNameFound,aPackageName->ToCString()); - return thePackNameFound; + if (aSeqOfPackage->Value(i)->IsSameString(MS::BuildFullName(aPackageName,thethetypename))) + { + strcpy (ThePackNameFound, aPackageName->ToCString()); + return ThePackNameFound; } } - if (theMetaSchema()->IsDefined(MS::BuildFullName(MS::GetPackageRootName(),thethetypename))) return (char *)theRootPack; + if (TheMetaSchema->IsDefined (MS::BuildFullName (MS::GetPackageRootName(), thethetypename))) + { + return (char* )THE_ROOT_PACKAGE; + } - if (Current_Entity == CDL_GENCLASS) { - for (i = 1; i <= ListOfItem()->Length(); i++) { - if (strcmp(ListOfItem()->Value(i)->ToCString(),aName) == 0) { - return (char *)aDummyPackageName; - } + if (TheCurrentEntity == CDL_GENCLASS) + { + for (i = 1; i <= TheListOfItem->Length(); i++) + { + if (strcmp(TheListOfItem->Value(i)->ToCString(),aName) == 0) + { + return (char*)THE_DUMMY_PACKAGE_NAME; + } } - } + } } - Handle(MS_Package) aPackage; - Handle(MS_Interface) anInterface; - Handle(MS_Engine) anEngine; - Handle(MS_Component) aComponent; - - if (theMetaSchema()->IsPackage(Container())) { - aPackage = theMetaSchema()->GetPackage(Container()); + Handle(MS_Package) aPackage; + Handle(MS_Interface) anInterface; + Handle(MS_Engine) anEngine; + Handle(MS_Component) aComponent; + + if (TheMetaSchema->IsPackage(TheContainer)) + { + aPackage = TheMetaSchema->GetPackage(TheContainer); aSeqOfPackage = aPackage->Uses(); - } - else if (theMetaSchema()->IsInterface(Container())) { - anInterface = theMetaSchema()->GetInterface(Container()); + } + else if (TheMetaSchema->IsInterface(TheContainer)) + { + anInterface = TheMetaSchema->GetInterface(TheContainer); aSeqOfPackage = anInterface->Uses(); } - else if (theMetaSchema()->IsEngine(Container())) { - anEngine = theMetaSchema()->GetEngine(Container()); + else if (TheMetaSchema->IsEngine(TheContainer)) + { + anEngine = TheMetaSchema->GetEngine(TheContainer); aSeqOfPackage = anEngine->Uses(); } - else if (theMetaSchema()->IsComponent(Container())) { - aComponent = theMetaSchema()->GetComponent(Container()); + else if (TheMetaSchema->IsComponent(TheContainer)) + { + aComponent = TheMetaSchema->GetComponent(TheContainer); aSeqOfPackage = aComponent->Uses(); } - else { + else + { aSeqOfPackage = new TColStd_HSequenceOfHAsciiString; aSeqOfPackage->Append(MS::GetPackageRootName()); } - - for (i = 1; i <= aSeqOfPackage->Length(); i++) { + + for (i = 1; i <= aSeqOfPackage->Length(); i++) + { aFullName->AssignCat(aSeqOfPackage->Value(i)); aFullName->AssignCat("_"); aFullName->AssignCat(aName); - - if (theMetaSchema()->IsDefined(aFullName)) { + + if (TheMetaSchema->IsDefined(aFullName)) + { return (char*)(aSeqOfPackage->Value(i)->ToCString()); } - + aFullName->Clear(); } - - return NULL; } -void Type_Pack_Blanc() +void Type_Pack_Blanc() { - char *thePackName; + char* thePackName; // we check if we are able to use incomplete declaration // - if (Current_Entity == CDL_PACKAGE || - Current_Entity == CDL_INTERFACE || - Current_Entity == CDL_EXECUTABLE || - Current_Entity == CDL_CLIENT) { + if (TheCurrentEntity == CDL_PACKAGE || + TheCurrentEntity == CDL_INTERFACE || + TheCurrentEntity == CDL_EXECUTABLE || + TheCurrentEntity == CDL_CLIENT) + { Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString; - aFullName->AssignCat(Container()); + aFullName->AssignCat(TheContainer); aFullName->AssignCat("_"); - aFullName->AssignCat(thetypename); - - if (!theMetaSchema()->IsDefined(aFullName)) { + aFullName->AssignCat(TheTypeName); + + if (!TheMetaSchema->IsDefined(aFullName)) + { aFullName->Clear(); aFullName->AssignCat(MS::GetPackageRootName()); aFullName->AssignCat("_"); - aFullName->AssignCat(thetypename); - - if (!theMetaSchema()->IsDefined(aFullName)) { - Handle(TCollection_HAsciiString) msg = new TCollection_HAsciiString("the type '"); - msg->AssignCat(thetypename); - msg->AssignCat("' must be followed by a package name."); - CDLerror((char *)(msg->ToCString())); + aFullName->AssignCat(TheTypeName); + + if (!TheMetaSchema->IsDefined(aFullName)) + { + Handle(TCollection_HAsciiString) msg = new TCollection_HAsciiString("the type '"); + msg->AssignCat(TheTypeName); + msg->AssignCat("' must be followed by a package name."); + CDLerror((char*)(msg->ToCString())); } } } - if (Current_Entity != CDL_INCDECL && Current_Entity != CDL_GENTYPE) { - thePackName = TypeCompletion(thetypename); - - if (thePackName == NULL) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "the type '" << thetypename << "' is not defined." << endm; + if (TheCurrentEntity != CDL_INCDECL && TheCurrentEntity != CDL_GENTYPE) + { + thePackName = TypeCompletion(TheTypeName); + + if (thePackName == NULL) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "the type '" << TheTypeName << "' is not defined." << endm; YY_nb_error++; } - else { + else + { Type_Pack(thePackName); } } - else { - Type_Pack((char *)(Container()->ToCString())); + else + { + Type_Pack((char*)(TheContainer->ToCString())); } } -void Add_Type() +void Add_Type() { - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); - Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); + Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(TheTypeName); - ListOfTypes()->Append(athetypename); - ListOfPackages()->Append(aPackName); + TheListOfTypes->Append(athetypename); + TheListOfPackages->Append(aPackName); } -void add_documentation(char *comment) -{ +void add_documentation(char* comment) +{ Handle(TCollection_HAsciiString) aComment; Handle(TCollection_HAsciiString) aRealComment; Standard_Integer pos; @@ -941,15 +722,16 @@ void add_documentation(char *comment) pos = aComment->Location(1,':',1,aComment->Length()); aRealComment = aComment->SubString(pos + 1, aComment->Length()); aRealComment->RightAdjust(); - if (!aRealComment->IsEmpty()) { + if (!aRealComment->IsEmpty()) + { aRealComment->AssignCat ("
"); aRealComment->Insert(1,"//!"); - ListOfComments()->Append(aRealComment); + TheListOfComments->Append(aRealComment); } } -void add_documentation1(char *comment) -{ +void add_documentation1(char* comment) +{ while ( *comment && IsSpace(*comment)) comment++; while ( *comment == '-' ) comment++; if ( ! *comment ) return; @@ -959,635 +741,654 @@ void add_documentation1(char *comment) aRealComment->RightAdjust(); aRealComment->AssignCat ("
"); aRealComment->Insert(1,"\n//!"); - ListOfComments()->Append(aRealComment); + TheListOfComments->Append(aRealComment); } //======================================================================= //function : add_cpp_comment -//purpose : +//purpose : //======================================================================= -void add_cpp_comment(int cpptype, char *comment) +void add_cpp_comment(int cpptype, char* comment) { Handle(TCollection_HAsciiString) aComment; Handle(TCollection_HAsciiString) aRealComment; - if (Method().IsNull()) { + if (TheMethod.IsNull()) + { WarningMsg() << "CDL" << "line " << CDLlineno \ - << " : " << "C++ directive outside method definition : "\ - << comment << endm; + << " : " << "C++ directive outside method definition : "\ + << comment << endm; YY_nb_warning++; } - else { - if (cpptype == CDL_HARDALIAS || cpptype == CDL_OPERATOR) { + else + { + if (cpptype == CDL_HARDALIAS || cpptype == CDL_OPERATOR) + { Standard_Integer pos; aComment = new TCollection_HAsciiString(comment); - + pos = aComment->Location(1,':',1,aComment->Length()); aRealComment = aComment->SubString(pos + 1,aComment->Length()); aRealComment->LeftAdjust(); } - - ListOfCplusplus()->Append(aRealComment); - ListOfCPPType()->Append(cpptype); + + TheListOfCplusplus->Append(aRealComment); + TheListOfCPPType->Append(cpptype); } } //======================================================================= //function : add_name_to_list -//purpose : +//purpose : //======================================================================= -void add_name_to_list(char *name) +void add_name_to_list(char* name) { - Handle(TCollection_HAsciiString) aName = + Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(name); - ListOfName()->Append(aName); + TheListOfName->Append(aName); } //======================================================================= //function : Begin_List_Int -//purpose : +//purpose : //======================================================================= -void Begin_List_Int(char *anInt) +void Begin_List_Int(char* anInt) { Handle(TCollection_HAsciiString) Int = new TCollection_HAsciiString(anInt); - ListOfInteger()->Clear(); - ListOfInteger()->Append(Int); + TheListOfInteger->Clear(); + TheListOfInteger->Append(Int); } -void Make_List_Int(char *anInt) +void Make_List_Int(char* anInt) { Handle(TCollection_HAsciiString) Int = new TCollection_HAsciiString(anInt); - ListOfInteger()->Append(Int); + TheListOfInteger->Append(Int); } // The actions for the Schema // -void Schema_Begin(char *name) +void Schema_Begin(char* name) { Handle(TCollection_HAsciiString) aSchemaName = new TCollection_HAsciiString(name); - Schema() = new MS_Schema(aSchemaName); - Schema()->MetaSchema(theMetaSchema()); - Container() = aSchemaName; + TheSchema = new MS_Schema(aSchemaName); + TheSchema->MetaSchema(TheMetaSchema); + TheContainer = aSchemaName; - if (!theMetaSchema()->AddSchema(Schema())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Schema : " << aSchemaName << " is already defined." << endm; + if (!TheMetaSchema->AddSchema(TheSchema)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Schema : " << aSchemaName << " is already defined." << endm; YY_nb_error++; } CheckCommentListIsEmpty("Schema_Begin"); - ListOfComments()->Clear(); + TheListOfComments->Clear(); } -void Schema_Package(char *name) +void Schema_Package(char* name) { Standard_Integer i; Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(name); - Schema()->Package(aName); - for(i = 1; i <= ListOfComments()->Length(); i++) { - Schema()->SetComment(ListOfComments()->Value(i)); + TheSchema->Package(aName); + for(i = 1; i <= TheListOfComments->Length(); i++) + { + TheSchema->SetComment(TheListOfComments->Value(i)); } - ListOfComments()->Clear(); + TheListOfComments->Clear(); } void Schema_Class() { - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(ThePackName); - Schema()->Class(MS::BuildFullName(aPackageName,aClassName)); + TheSchema->Class(MS::BuildFullName(aPackageName,aClassName)); } void Schema_End() { - Schema().Nullify(); - Container().Nullify(); + TheSchema.Nullify(); + TheContainer.Nullify(); } // The actions for the Engine // -void Engine_Begin(char *engineName) +void Engine_Begin(char* engineName) { Handle(TCollection_HAsciiString) anEngineName = new TCollection_HAsciiString(engineName); - - Engine() = new MS_Engine(anEngineName); - Engine()->MetaSchema(theMetaSchema()); - Container() = anEngineName; - if (!theMetaSchema()->AddEngine(Engine())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Engine : " << anEngineName << " is already defined." << endm; + TheEngine = new MS_Engine(anEngineName); + TheEngine->MetaSchema(TheMetaSchema); + TheContainer = anEngineName; + + if (!TheMetaSchema->AddEngine(TheEngine)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Engine : " << anEngineName << " is already defined." << endm; YY_nb_error++; } - Engine()->Use(MS::GetPackageRootName()); + TheEngine->Use(MS::GetPackageRootName()); } -void Engine_Schema(char *name) +void Engine_Schema(char* name) { Handle(TCollection_HAsciiString) sname = new TCollection_HAsciiString(name); - Engine()->Schema(sname); - ListOfGlobalUsed()->Append(sname); + TheEngine->Schema(sname); + TheListOfGlobalUsed->Append(sname); } -void Engine_Interface(char *inter) +void Engine_Interface(char* inter) { Handle(TCollection_HAsciiString) sname = new TCollection_HAsciiString(inter); - Engine()->Interface(sname); - ListOfGlobalUsed()->Append(sname); + TheEngine->Interface(sname); + TheListOfGlobalUsed->Append(sname); } void Engine_End() { - Engine().Nullify(); - Container().Nullify(); + TheEngine.Nullify(); + TheContainer.Nullify(); } // The actions for the Component // -void Component_Begin(char *ComponentName) +void Component_Begin(char* ComponentName) { Handle(TCollection_HAsciiString) anComponentName = new TCollection_HAsciiString(ComponentName); - - Component() = new MS_Component(anComponentName); - Component()->MetaSchema(theMetaSchema()); - Container() = anComponentName; - if (!theMetaSchema()->AddComponent(Component())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Component : " << anComponentName << " is already defined." << endm; + TheComponent = new MS_Component(anComponentName); + TheComponent->MetaSchema(TheMetaSchema); + TheContainer = anComponentName; + + if (!TheMetaSchema->AddComponent(TheComponent)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Component : " << anComponentName << " is already defined." << endm; YY_nb_error++; } - Component()->Use(MS::GetPackageRootName()); + TheComponent->Use(MS::GetPackageRootName()); } -void Component_Interface(char *inter, char *udname) +void Component_Interface(char* inter, char* udname) { Handle(TCollection_HAsciiString) uname = new TCollection_HAsciiString(udname); Handle(TCollection_HAsciiString) sname = new TCollection_HAsciiString(inter); sname = MS::BuildFullName(uname,sname); - Component()->Interface(sname); - ListOfGlobalUsed()->Append(sname); + TheComponent->Interface(sname); + TheListOfGlobalUsed->Append(sname); } void Component_End() { - Component().Nullify(); - Container().Nullify(); + TheComponent.Nullify(); + TheContainer.Nullify(); } // UD : stub client // -void Client_Begin(char *clientName) +void Client_Begin(char* clientName) { Handle(TCollection_HAsciiString) aClientName = new TCollection_HAsciiString(clientName); - - Client() = new MS_Client(aClientName); - Client()->MetaSchema(theMetaSchema()); - Container() = aClientName; - - if (!theMetaSchema()->AddClient(Client())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Client : " << clientName << " is already defined." << endm; + + TheClient = new MS_Client(aClientName); + TheClient->MetaSchema(TheMetaSchema); + TheContainer = aClientName; + + if (!TheMetaSchema->AddClient(TheClient)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Client : " << clientName << " is already defined." << endm; YY_nb_error++; } - - Current_Entity = CDL_CLIENT; + + TheCurrentEntity = CDL_CLIENT; } -void Client_Interface(char *inter) +void Client_Interface(char* inter) { Handle(TCollection_HAsciiString) aIName = new TCollection_HAsciiString(inter); - Client()->Interface(aIName); + TheClient->Interface(aIName); } -void Client_Method(char *entity, int execmode) +void Client_Method(char* entity, int execmode) { - if (execmode == 1) { - if (entity != NULL && !ExternMet().IsNull()) { - ExternMet()->Package(new TCollection_HAsciiString(entity)); + if (execmode == 1) + { + if (entity != NULL && !TheExternMet.IsNull()) + { + TheExternMet->Package(new TCollection_HAsciiString(entity)); } - Method()->Params(MethodParams()); - MethodParams().Nullify(); - Method()->CreateFullName(); - - Client()->Method(Method()->FullName()); + TheMethod->Params(TheMethodParams); + TheMethodParams.Nullify(); + TheMethod->CreateFullName(); + + TheClient->Method(TheMethod->FullName()); } - else if (execmode < 0) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "constructor cannot have the asynchronous execution mode." << endm; + else if (execmode < 0) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "constructor cannot have the asynchronous execution mode." << endm; YY_nb_error++; } - Method().Nullify(); - MemberMet().Nullify(); - ExternMet().Nullify(); - Construc().Nullify(); - InstMet().Nullify(); - ClassMet().Nullify(); + TheMethod.Nullify(); + TheMemberMet.Nullify(); + TheExternMet.Nullify(); + TheConstruc.Nullify(); + TheInstMet.Nullify(); + TheClassMet.Nullify(); } -void Client_End() +void Client_End() { - Method().Nullify(); - MemberMet().Nullify(); - ExternMet().Nullify(); - Construc().Nullify(); - InstMet().Nullify(); - ClassMet().Nullify(); - Interface().Nullify(); - Container().Nullify(); - Client().Nullify(); + TheMethod.Nullify(); + TheMemberMet.Nullify(); + TheExternMet.Nullify(); + TheConstruc.Nullify(); + TheInstMet.Nullify(); + TheClassMet.Nullify(); + TheInterface.Nullify(); + TheContainer.Nullify(); + TheClient.Nullify(); - Current_Entity = CDL_NULL; - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheCurrentEntity = CDL_NULL; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; } // The actions for the Executable -void Executable_Begin(char *name) +void Executable_Begin(char* name) { - ExecutableLanguage = CDL_CPP; - ExecutableUseType = 0; + TheExecutableLanguage = CDL_CPP; + TheExecutableUseType = 0; Handle(TCollection_HAsciiString) anExecName = new TCollection_HAsciiString(name); - Executable() = new MS_Executable(anExecName); - Executable()->MetaSchema(theMetaSchema()); + TheExecutable = new MS_Executable(anExecName); + TheExecutable->MetaSchema(TheMetaSchema); - if (!theMetaSchema()->AddExecutable(Executable())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Executable : " << anExecName << " is already defined." << endm; + if (!TheMetaSchema->AddExecutable(TheExecutable)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Executable : " << anExecName << " is already defined." << endm; YY_nb_error++; } - ExecTable() = new MS_HSequenceOfExecPart; + TheExecTable = new MS_HSequenceOfExecPart; - Current_Entity = CDL_EXECUTABLE; + TheCurrentEntity = CDL_EXECUTABLE; } -void ExecFile_Begin(char *name) +void ExecFile_Begin(char* name) { - ExecutableLanguage = CDL_CPP; - ExecutableUseType = 0; + TheExecutableLanguage = CDL_CPP; + TheExecutableUseType = 0; Handle(TCollection_HAsciiString) anExecName = new TCollection_HAsciiString(name); - ExecPart() = new MS_ExecPart(anExecName); - ExecPart()->MetaSchema(theMetaSchema()); - ExecTable()->Append(ExecPart()); + TheExecPart = new MS_ExecPart(anExecName); + TheExecPart->MetaSchema(TheMetaSchema); + TheExecTable->Append(TheExecPart); } -void ExecFile_Schema(char *name) +void ExecFile_Schema(char* name) { Handle(TCollection_HAsciiString) a = new TCollection_HAsciiString(name); - ExecPart()->Schema(a); + TheExecPart->Schema(a); } -void ExecFile_AddUse(char *name) +void ExecFile_AddUse(char* name) { Handle(TCollection_HAsciiString) a = new TCollection_HAsciiString(name); - if (ExecutableUseType == CDL_LIBRARY) { - ExecPart()->AddLibrary(a); + if (TheExecutableUseType == CDL_LIBRARY) + { + TheExecPart->AddLibrary(a); } - else { - ExecPart()->AddExternal(a); + else + { + TheExecPart->AddExternal(a); } } void ExecFile_SetUseType(int t) { - ExecutableUseType = t; + TheExecutableUseType = t; } -void ExecFile_AddComponent(char *name) +void ExecFile_AddComponent(char* name) { Handle(TCollection_HAsciiString) a = new TCollection_HAsciiString(name); Handle(MS_ExecFile) aFile; aFile = new MS_ExecFile(a); - switch (ExecutableLanguage) { - case CDL_CPP : aFile->SetLanguage(MS_CPP); - break; - case CDL_FOR : aFile->SetLanguage(MS_FORTRAN); - break; - case CDL_C : aFile->SetLanguage(MS_C); - break; - case CDL_OBJ : aFile->SetLanguage(MS_OBJECT); - break; - default : aFile->SetLanguage(MS_CPP); - break; + switch (TheExecutableLanguage) + { + case CDL_CPP: + default: + aFile->SetLanguage(MS_CPP); + break; + case CDL_FOR: + aFile->SetLanguage(MS_FORTRAN); + break; + case CDL_C: + aFile->SetLanguage(MS_C); + break; + case CDL_OBJ: + aFile->SetLanguage(MS_OBJECT); + break; } - ExecPart()->AddFile(aFile); + TheExecPart->AddFile(aFile); } void ExecFile_SetLang(int l) { - ExecutableLanguage = l; + TheExecutableLanguage = l; } void ExecFile_End() { - ExecPart().Nullify(); + TheExecPart.Nullify(); } void Executable_End() { - Executable()->AddParts(ExecTable()); + TheExecutable->AddParts(TheExecTable); - ExecTable().Nullify(); - Method().Nullify(); - MemberMet().Nullify(); - ExternMet().Nullify(); - Construc().Nullify(); - InstMet().Nullify(); - ClassMet().Nullify(); - Interface().Nullify(); - Executable().Nullify(); - Client().Nullify(); + TheExecTable.Nullify(); + TheMethod.Nullify(); + TheMemberMet.Nullify(); + TheExternMet.Nullify(); + TheConstruc.Nullify(); + TheInstMet.Nullify(); + TheClassMet.Nullify(); + TheInterface.Nullify(); + TheExecutable.Nullify(); + TheClient.Nullify(); - Current_Entity = CDL_NULL; - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheCurrentEntity = CDL_NULL; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; } // The actions for the Interface -void Interface_Begin(char *anInterName) +void Interface_Begin(char* anInterName) { Handle(TCollection_HAsciiString) anInterfaceName = new TCollection_HAsciiString(anInterName); - Interface() = new MS_Interface(anInterfaceName); - Interface()->MetaSchema(theMetaSchema()); - Container() = anInterfaceName; + TheInterface = new MS_Interface(anInterfaceName); + TheInterface->MetaSchema(TheMetaSchema); + TheContainer = anInterfaceName; - if (!theMetaSchema()->AddInterface(Interface())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Interface : " << anInterName << " is already defined." << endm; + if (!TheMetaSchema->AddInterface(TheInterface)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Interface : " << anInterName << " is already defined." << endm; YY_nb_error++; } - Interface()->Use(MS::GetPackageRootName()); - Current_Entity = CDL_INTERFACE; + TheInterface->Use(MS::GetPackageRootName()); + TheCurrentEntity = CDL_INTERFACE; } -void Interface_Use(char*aPackageName) +void Interface_Use(char* aPackageName) { Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(aPackageName); - ListOfGlobalUsed()->Append(aPackName); - Interface()->Use(aPackName); + TheListOfGlobalUsed->Append(aPackName); + TheInterface->Use(aPackName); } -void Client_Use ( char* aClientName ) { +void Client_Use ( char* aClientName ) +{ - Handle( TCollection_HAsciiString ) aCltName = - new TCollection_HAsciiString ( aClientName ); + Handle( TCollection_HAsciiString ) aCltName = + new TCollection_HAsciiString ( aClientName ); - Client() -> Use ( aCltName ); + TheClient -> Use ( aCltName ); } // end Client_Use -void Interface_Package(char *aPackageName) +void Interface_Package(char* aPackageName) { Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(aPackageName); - Interface()->Package(aPackName); + TheInterface->Package(aPackName); } void Interface_Class() { - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(ThePackName); - Interface()->Class(MS::BuildFullName(aPackageName,aClassName)); - ListOfTypeUsed()->Append(MS::BuildFullName(aPackageName,aClassName)); + TheInterface->Class(MS::BuildFullName(aPackageName,aClassName)); + TheListOfGlobalUsed->Append(MS::BuildFullName(aPackageName,aClassName)); } void Method_TypeName() { - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(ThePackName); - ListOfTypeUsed()->Append(MS::BuildFullName(aPackageName,aClassName)); + TheListOfGlobalUsed->Append(MS::BuildFullName(aPackageName,aClassName)); } -void Interface_Method(char *entityName) +void Interface_Method(char* entityName) { - if (entityName != NULL && !ExternMet().IsNull()) { - ExternMet()->Package(new TCollection_HAsciiString(entityName)); + if (entityName != NULL && !TheExternMet.IsNull()) + { + TheExternMet->Package(new TCollection_HAsciiString(entityName)); } - Method()->Params(MethodParams()); - MethodParams().Nullify(); - Method()->CreateFullName(); - Interface()->Method(Method()->FullName()); + TheMethod->Params(TheMethodParams); + TheMethodParams.Nullify(); + TheMethod->CreateFullName(); + TheInterface->Method(TheMethod->FullName()); - Method().Nullify(); - MemberMet().Nullify(); - ExternMet().Nullify(); - Construc().Nullify(); - InstMet().Nullify(); - ClassMet().Nullify(); + TheMethod.Nullify(); + TheMemberMet.Nullify(); + TheExternMet.Nullify(); + TheConstruc.Nullify(); + TheInstMet.Nullify(); + TheClassMet.Nullify(); } void Interface_End() { - Method().Nullify(); - MemberMet().Nullify(); - ExternMet().Nullify(); - Construc().Nullify(); - InstMet().Nullify(); - ClassMet().Nullify(); - Interface().Nullify(); - Container().Nullify(); - Client().Nullify(); - - Current_Entity = CDL_NULL; - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheMethod.Nullify(); + TheMemberMet.Nullify(); + TheExternMet.Nullify(); + TheConstruc.Nullify(); + TheInstMet.Nullify(); + TheClassMet.Nullify(); + TheInterface.Nullify(); + TheContainer.Nullify(); + TheClient.Nullify(); + + TheCurrentEntity = CDL_NULL; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; } // The actions for the Package // -void Pack_Begin(char *aPackageName) +void Pack_Begin(char* aPackageName) { - - Standard_Integer i; - - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(aPackageName); - - Container() = aPackName; + const Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString (aPackageName); + TheContainer = aPackName; - Package() = new MS_Package(aPackName); - - Package()->MetaSchema(theMetaSchema()); - - for (i = 1; i <= ListOfComments()->Length(); i++) { - Package()->SetComment(ListOfComments()->Value(i)); - } + ThePackage = new MS_Package (aPackName); + ThePackage->MetaSchema (TheMetaSchema); + for (Standard_Integer i = 1; i <= TheListOfComments->Length(); i++) + { + ThePackage->SetComment(TheListOfComments->Value (i)); + } - if (!theMetaSchema()->AddPackage(Package())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Package : " << aPackageName << " is already defined." << endm; + if (!TheMetaSchema->AddPackage (ThePackage)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Package : " << aPackageName << " is already defined." << endm; YY_nb_error++; } - Package()->Use(MS::GetPackageRootName()); + ThePackage->Use(MS::GetPackageRootName()); - - Current_Entity = CDL_PACKAGE; - ListOfComments()->Clear(); + TheCurrentEntity = CDL_PACKAGE; + TheListOfComments->Clear(); } -void Pack_Use(char *aPackageName) +void Pack_Use(char* aPackageName) { - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(aPackageName); - for (Standard_Integer i = 1; i <= ListOfComments()->Length(); i++) { - Package()->SetComment(ListOfComments()->Value(i)); - } - - ListOfGlobalUsed()->Append(aPackName); - Package()->Use(aPackName); - ListOfComments()->Clear(); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString (aPackageName); + for (Standard_Integer i = 1; i <= TheListOfComments->Length(); i++) + { + ThePackage->SetComment (TheListOfComments->Value (i)); + } + TheListOfGlobalUsed->Append (aPackName); + ThePackage->Use (aPackName); + TheListOfComments->Clear(); } void Pack_End() { add_cpp_comment_to_method(); - Package().Nullify(); - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + ThePackage.Nullify(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); CheckCommentListIsEmpty("Pack_End"); - ListOfComments()->Clear(); - + TheListOfComments->Clear(); } // The actions for the classes void Alias_Begin() { - Handle(TCollection_HAsciiString) anAliasName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) anAliasName = new TCollection_HAsciiString(TheTypeName); - Alias() = new MS_Alias(anAliasName,Container(),Container(),Private); + TheAlias = new MS_Alias(anAliasName,TheContainer,TheContainer,TheIsPrivate); - Alias()->MetaSchema(theMetaSchema()); - - if (!theMetaSchema()->AddType(Alias())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Alias : " << Alias()->FullName() << " is already defined." << endm; + TheAlias->MetaSchema(TheMetaSchema); + + if (!TheMetaSchema->AddType(TheAlias)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Alias : " << TheAlias->FullName() << " is already defined." << endm; YY_nb_error++; } - Private = Standard_False; + TheIsPrivate = Standard_False; } void Alias_Type() { - Handle(TCollection_HAsciiString) anAliasName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) anAliasName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(ThePackName); - Alias()->Type(anAliasName,aPackageName); - ListOfTypeUsed()->Append(Alias()->Type()); + TheAlias->Type(anAliasName,aPackageName); + TheListOfGlobalUsed->Append(TheAlias->Type()); } void Alias_End() { - Package()->Alias(Alias()->Name()); - Alias().Nullify(); + ThePackage->Alias (TheAlias->Name()); + TheAlias.Nullify(); } // Pointer type // void Pointer_Begin() { - Handle(TCollection_HAsciiString) aPointerName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) aPointerName = new TCollection_HAsciiString(TheTypeName); - Pointer() = new MS_Pointer(aPointerName,Container(),Container(),Private); + ThePointer = new MS_Pointer(aPointerName,TheContainer,TheContainer,TheIsPrivate); - Pointer()->MetaSchema(theMetaSchema()); - - if (!theMetaSchema()->AddType(Pointer())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Pointer : " << Pointer()->FullName() << " is already defined." << endm; + ThePointer->MetaSchema(TheMetaSchema); + + if (!TheMetaSchema->AddType(ThePointer)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Pointer : " << ThePointer->FullName() << " is already defined." << endm; YY_nb_error++; } - Private = Standard_False; + TheIsPrivate = Standard_False; } void Pointer_Type() { - Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackageName = new TCollection_HAsciiString(ThePackName); - Pointer()->Type(athetypename,aPackageName); - ListOfTypeUsed()->Append(Pointer()->Type()); + ThePointer->Type(athetypename,aPackageName); + TheListOfGlobalUsed->Append(ThePointer->Type()); } void Pointer_End() { - Package()->Pointer(Pointer()->Name()); - Pointer().Nullify(); + ThePackage->Pointer (ThePointer->Name()); + ThePointer.Nullify(); } void Imported_Begin() { - Handle(TCollection_HAsciiString) anImportedName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) anImportedName = new TCollection_HAsciiString(TheTypeName); - Imported() = new MS_Imported(anImportedName,Container(),Container(),Private); + TheImported = new MS_Imported(anImportedName,TheContainer,TheContainer,TheIsPrivate); - Imported()->MetaSchema(theMetaSchema()); + TheImported->MetaSchema(TheMetaSchema); - if (!theMetaSchema()->AddType(Imported())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Imported : " << Imported()->FullName() << " is already defined." << endm; + if (!TheMetaSchema->AddType(TheImported)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Imported : " << TheImported->FullName() << " is already defined." << endm; YY_nb_error++; } - Private = Standard_False; + TheIsPrivate = Standard_False; } void Imported_End() { - Package()->Imported(Imported()->Name()); - Imported().Nullify(); + ThePackage->Imported (TheImported->Name()); + TheImported.Nullify(); } void Prim_Begin() -{ - Handle(TCollection_HAsciiString) aPrimName = new TCollection_HAsciiString(thetypename); +{ + Handle(TCollection_HAsciiString) aPrimName = new TCollection_HAsciiString(TheTypeName); - Primitive() = new MS_PrimType(aPrimName,Container(),Container(),Private); + ThePrimitive = new MS_PrimType(aPrimName,TheContainer,TheContainer,TheIsPrivate); - Primitive()->MetaSchema(theMetaSchema()); + ThePrimitive->MetaSchema(TheMetaSchema); - if (!theMetaSchema()->AddType(Primitive())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Primitive : " << Primitive()->FullName() << " is already defined." << endm; + if (!TheMetaSchema->AddType(ThePrimitive)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Primitive : " << ThePrimitive->FullName() << " is already defined." << endm; YY_nb_error++; } - Private = Standard_False; + TheIsPrivate = Standard_False; } void Prim_End() @@ -1595,40 +1396,45 @@ void Prim_End() Standard_Integer i; Handle(TCollection_HAsciiString) iName; - for (i = 1; i <= ListOfTypes()->Length(); i++) { - iName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + iName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); - if (i > 1) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Type " << Primitive()->FullName() << " uses multiple inheritance." << endm; + if (i > 1) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Type " << ThePrimitive->FullName() << " uses multiple inheritance." << endm; YY_nb_error++; } - else if (!iName->IsSameString(Primitive()->FullName())) { - Primitive()->Inherit(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); + else if (!iName->IsSameString(ThePrimitive->FullName())) + { + ThePrimitive->Inherit(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Primitive : " << Primitive()->FullName() << " can not inherits from itself." << endm; - YY_nb_error++; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Primitive : " << ThePrimitive->FullName() << " can not inherits from itself." << endm; + YY_nb_error++; } } - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); - Package()->Primitive(Primitive()->Name()); - Primitive().Nullify(); + ThePackage->Primitive(ThePrimitive->Name()); + ThePrimitive.Nullify(); } void Except_Begin() { - Handle(TCollection_HAsciiString) anExceptName = new TCollection_HAsciiString(thetypename); - - Exception() = new MS_Error(anExceptName,Container()); + Handle(TCollection_HAsciiString) anExceptName = new TCollection_HAsciiString(TheTypeName); + + TheException = new MS_Error(anExceptName,TheContainer); - Exception()->MetaSchema(theMetaSchema()); + TheException->MetaSchema(TheMetaSchema); - if (!theMetaSchema()->AddType(Exception())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Exception : " << Exception()->FullName() << " is already defined." << endm; + if (!TheMetaSchema->AddType(TheException)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Exception : " << TheException->FullName() << " is already defined." << endm; YY_nb_error++; } } @@ -1638,60 +1444,65 @@ void Except_End() Standard_Integer i; Handle(TCollection_HAsciiString) iName; - for (i = 1; i <= ListOfTypes()->Length(); i++) { - iName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); - - if (i > 1) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Exception " << Exception()->FullName() << " uses multiple inheritance." << endm; + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + iName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); + + if (i > 1) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Exception " << TheException->FullName() << " uses multiple inheritance." << endm; YY_nb_error++; } - else if (!iName->IsSameString(Exception()->FullName())) { - Exception()->Inherit(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); + else if (!iName->IsSameString(TheException->FullName())) + { + TheException->Inherit(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Exception : " << Exception()->FullName() << " can not inherits from itself." << endm; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Exception : " << TheException->FullName() << " can not inherits from itself." << endm; YY_nb_error++; } } - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); - Package()->Except(Exception()->Name()); - Exception().Nullify(); + ThePackage->Except (TheException->Name()); + TheException.Nullify(); } void Inc_Class_Dec() { - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); - StdClass() = new MS_StdClass(aClassName,Container()); + TheStdClass = new MS_StdClass(aClassName,TheContainer); - StdClass()->MetaSchema(theMetaSchema()); + TheStdClass->MetaSchema(TheMetaSchema); - if (!theMetaSchema()->AddType(StdClass())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class : " << StdClass()->FullName() << " is already defined." << endm; + if (!TheMetaSchema->AddType(TheStdClass)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class : " << TheStdClass->FullName() << " is already defined." << endm; YY_nb_error++; } - StdClass()->Private(Private); - StdClass()->Deferred(Deferred); - StdClass()->Incomplete(Standard_True); - Package()->Class(StdClass()->Name()); - StdClass()->Package(Package()->FullName()); - - ListOfTypeUsed()->Append(StdClass()->FullName()); + TheStdClass->Private (TheIsPrivate); + TheStdClass->Deferred (TheIsDeferred); + TheStdClass->Incomplete (Standard_True); + ThePackage->Class (TheStdClass->Name()); + TheStdClass->Package (ThePackage->FullName()); + + TheListOfGlobalUsed->Append(TheStdClass->FullName()); - StdClass().Nullify(); + TheStdClass.Nullify(); - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; CheckCommentListIsEmpty("Inc_Class_Dec"); - ListOfComments()->Clear(); + TheListOfComments->Clear(); } void Inc_GenClass_Dec() @@ -1699,44 +1510,48 @@ void Inc_GenClass_Dec() Standard_Integer i; Handle(MS_GenClass) theClass; - for (i = 1; i <= ListOfTypes()->Length(); i++) { - GenClass() = new MS_GenClass(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); - GenClass()->MetaSchema(theMetaSchema()); + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + TheGenClass = new MS_GenClass(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); + TheGenClass->MetaSchema(TheMetaSchema); - if (i == 1) { - theClass = GenClass(); + if (i == 1) + { + theClass = TheGenClass; } - else { - theClass->AddNested(GenClass()->Name()); - GenClass()->Mother(theClass->FullName()); - GenClass()->NestingClass(theClass->FullName()); + else + { + theClass->AddNested(TheGenClass->Name()); + TheGenClass->Mother(theClass->FullName()); + TheGenClass->NestingClass(theClass->FullName()); } - if (!theMetaSchema()->AddType(GenClass())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Generic class : " << GenClass()->FullName() << " is already defined." << endm; + if (!TheMetaSchema->AddType(TheGenClass)) + { + ErrorMsg() << "CDL" << "\"" << TheCDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Generic class : " << TheGenClass->FullName() << " is already defined." << endm; YY_nb_error++; } - - GenClass()->Private(Private); - GenClass()->Deferred(Deferred); - GenClass()->Incomplete(Standard_True); - Package()->Class(GenClass()->Name()); - GenClass()->Package(Package()->FullName()); + TheGenClass->Private (TheIsPrivate); + TheGenClass->Deferred (TheIsDeferred); + TheGenClass->Incomplete(Standard_True); + + ThePackage->Class (TheGenClass->Name()); + TheGenClass->Package (ThePackage->FullName()); } - ListOfGen()->Append(theClass->FullName()); - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheListOfGen->Append(theClass->FullName()); + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); - GenClass().Nullify(); + TheGenClass.Nullify(); } // Generic type processing @@ -1744,209 +1559,233 @@ void Inc_GenClass_Dec() void GenClass_Begin() { Handle(MS_Package) aPackage; - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); Handle(MS_Type) aType; - if (Current_Entity == CDL_GENCLASS) { - aPackName = GenClass()->Package()->Name(); + if (TheCurrentEntity == CDL_GENCLASS) + { + aPackName = TheGenClass->Package()->Name(); } - else { - Container() = aPackName; + else + { + TheContainer = aPackName; } - if (!theMetaSchema()->IsPackage(Container())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Unknown package " << Container() << endm; + if (!TheMetaSchema->IsPackage(TheContainer)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Unknown package " << TheContainer << endm; YY_nb_error++; CDL_InitVariable(); MS_TraductionError::Raise("Unknown package."); } - - GenClass() = new MS_GenClass(aClassName,aPackName); - - if (!theMetaSchema()->IsDefined(GenClass()->FullName())) { - GenClass()->MetaSchema(theMetaSchema()); - - GenClass()->Private(Private); - GenClass()->Deferred(Deferred); - GenClass()->Incomplete(Standard_False); - theMetaSchema()->AddType(GenClass()); + TheGenClass = new MS_GenClass(aClassName,aPackName); + + if (!TheMetaSchema->IsDefined(TheGenClass->FullName())) + { + TheGenClass->MetaSchema(TheMetaSchema); + + TheGenClass->Private (TheIsPrivate); + TheGenClass->Deferred (TheIsDeferred); + TheGenClass->Incomplete(Standard_False); + + TheMetaSchema->AddType (TheGenClass); } - else { - GenClass() = Handle(MS_GenClass)::DownCast(theMetaSchema()->GetType(GenClass()->FullName())); + else + { + TheGenClass = Handle(MS_GenClass)::DownCast(TheMetaSchema->GetType(TheGenClass->FullName())); - if (GenClass().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class : " << GenClass()->FullName() << " already declared but not as a generic class." << endm; + if (TheGenClass.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class : " << TheGenClass->FullName() << " already declared but not as a generic class." << endm; CDL_InitVariable(); MS_TraductionError::Raise("Class already defined but as generic."); } - if (Private != GenClass()->Private()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << GenClass()->FullName() << " has not the same visibility keyword in package declaration and in class definition." << endm; + if (TheIsPrivate != TheGenClass->Private()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheGenClass->FullName() << " has not the same visibility keyword in package declaration and in class definition." << endm; YY_nb_error++; } - if (Deferred != GenClass()->Deferred()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << GenClass()->FullName() << " is "; + if (TheIsDeferred != TheGenClass->Deferred()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheGenClass->FullName() << " is "; - if (Deferred) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << GenClass()->FullName() << " is declared 'deferred' in class definition but not in package declaration." << endm; + if (TheIsDeferred) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheGenClass->FullName() << " is declared 'deferred' in class definition but not in package declaration." << endm; } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << GenClass()->FullName() << " is declared 'deferred' in package declaration but not in class definition." << endm; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheGenClass->FullName() << " is declared 'deferred' in package declaration but not in class definition." << endm; } YY_nb_error++; } - GenClass()->GetNestedName()->Clear(); + TheGenClass->GetNestedName()->Clear(); } - GenClass()->Package(aPackName); + TheGenClass->Package(aPackName); + + TheCurrentEntity = CDL_GENCLASS; - Current_Entity = CDL_GENCLASS; - - SimpleClass() = GenClass(); + TheSimpleClass = TheGenClass; - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; CheckCommentListIsEmpty("GenClass_Begin"); - ListOfComments()->Clear(); + TheListOfComments->Clear(); } void Add_GenType() { - if (Any) { - GenClass()->GenType(ListOfItem()->Value(ListOfItem()->Length())); - Any = Standard_False; + if (TheIsAny) + { + TheGenClass->GenType(TheListOfItem->Value(TheListOfItem->Length())); + TheIsAny = Standard_False; } - else { - Handle(TCollection_HAsciiString) aTName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPName = new TCollection_HAsciiString(Pack_Name); + else + { + Handle(TCollection_HAsciiString) aTName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPName = new TCollection_HAsciiString(ThePackName); - GenClass()->GenType(ListOfItem()->Value(ListOfItem()->Length()),MS::BuildFullName(aPName,aTName)); + TheGenClass->GenType(TheListOfItem->Value(TheListOfItem->Length()),MS::BuildFullName(aPName,aTName)); } } void Add_DynaGenType() { - GenClass()->GenType(DynType()); + TheGenClass->GenType(TheDynType); - DynType().Nullify(); - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheDynType.Nullify(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); } void Add_Embeded() { - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); } void GenClass_End() { - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); Clear_ListOfItem(); - GenClass()->Incomplete(Standard_False); + TheGenClass->Incomplete(Standard_False); - if (!StdClass().IsNull()) { - StdClass()->Incomplete(Standard_False); + if (!TheStdClass.IsNull()) + { + TheStdClass->Incomplete(Standard_False); } - GenClass().Nullify(); - StdClass().Nullify(); + TheGenClass.Nullify(); + TheStdClass.Nullify(); - Current_Entity = CDL_NULL; + TheCurrentEntity = CDL_NULL; } void InstClass_Begin() { - Handle(TCollection_HAsciiString) aPackName = Container(); - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) aPackName = TheContainer; + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); //Standard_Integer i; - if (Current_Entity == CDL_GENCLASS) { - aPackName = GenClass()->Package()->Name(); + if (TheCurrentEntity == CDL_GENCLASS) + { + aPackName = TheGenClass->Package()->Name(); } - if (Current_Entity != CDL_PACKAGE) { - if (!theMetaSchema()->IsPackage(aPackName)) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Package : " << Pack_Name << " is not defined." << endm; - CDL_InitVariable(); - MS_TraductionError::Raise("Package not defined."); + if (TheCurrentEntity != CDL_PACKAGE) + { + if (!TheMetaSchema->IsPackage(aPackName)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Package : " << ThePackName << " is not defined." << endm; + CDL_InitVariable(); + MS_TraductionError::Raise("Package not defined."); } } - InstClass() = new MS_InstClass(aClassName,aPackName); + TheInstClass = new MS_InstClass(aClassName,aPackName); - if (theMetaSchema()->IsDefined(InstClass()->FullName()) && Current_Entity == CDL_PACKAGE) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Instantiation class " << InstClass()->Name() << " is already declared in package " << aPackName << endm; + if (TheMetaSchema->IsDefined(TheInstClass->FullName()) && TheCurrentEntity == CDL_PACKAGE) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Instantiation class " << TheInstClass->Name() << " is already declared in package " << aPackName << endm; YY_nb_error++; } - - InstClass()->MetaSchema(theMetaSchema()); - if (!theMetaSchema()->IsDefined(InstClass()->FullName()) || Current_Entity == CDL_GENCLASS) { - if (Current_Entity == CDL_GENCLASS && theMetaSchema()->IsDefined(InstClass()->FullName())) { - theMetaSchema()->RemoveType(InstClass()->FullName(),Standard_False); - GenClass()->NestedInsClass(InstClass()->Name()); - InstClass()->Mother(GenClass()->FullName()); - } - else if (Current_Entity == CDL_GENCLASS) { - Handle(MS_Package) aPackage = theMetaSchema()->GetPackage(aPackName); + TheInstClass->MetaSchema(TheMetaSchema); - if (!aPackage->HasClass(aClassName)) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Nested instantiation class : " << InstClass()->Name() << " is not declared in package " << aPackName << endm; - YY_nb_error++; - CDL_InitVariable(); - MS_TraductionError::Raise("Instantiation not defined."); + if (!TheMetaSchema->IsDefined(TheInstClass->FullName()) || TheCurrentEntity == CDL_GENCLASS) + { + if (TheCurrentEntity == CDL_GENCLASS && TheMetaSchema->IsDefined(TheInstClass->FullName())) + { + TheMetaSchema->RemoveType(TheInstClass->FullName(),Standard_False); + TheGenClass->NestedInsClass(TheInstClass->Name()); + TheInstClass->Mother(TheGenClass->FullName()); + } + else if (TheCurrentEntity == CDL_GENCLASS) + { + Handle(MS_Package) aPackage = TheMetaSchema->GetPackage(aPackName); + + if (!aPackage->HasClass(aClassName)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Nested instantiation class : " << TheInstClass->Name() << " is not declared in package " << aPackName << endm; + YY_nb_error++; + CDL_InitVariable(); + MS_TraductionError::Raise("Instantiation not defined."); } } - - if (Current_Entity == CDL_GENCLASS) { - InstClass()->NestingClass(GenClass()->FullName()); - GenClass()->AddNested(InstClass()->Name()); + + if (TheCurrentEntity == CDL_GENCLASS) + { + TheInstClass->NestingClass(TheGenClass->FullName()); + TheGenClass->AddNested(TheInstClass->Name()); } - InstClass()->MetaSchema(theMetaSchema()); - InstClass()->Package(aPackName); - InstClass()->Private(Private); + TheInstClass->MetaSchema(TheMetaSchema); + TheInstClass->Package (aPackName); + TheInstClass->Private (TheIsPrivate); - theMetaSchema()->AddType(InstClass()); - Private = Standard_False; + TheMetaSchema->AddType (TheInstClass); + TheIsPrivate = Standard_False; } - else { - Handle(MS_Type) aType = theMetaSchema()->GetType(InstClass()->FullName()); - - InstClass() = Handle(MS_InstClass)::DownCast(aType); + else + { + Handle(MS_Type) aType = TheMetaSchema->GetType(TheInstClass->FullName()); - if (InstClass().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "The instantiation " << aClassName << " was not declared..." << endm; + TheInstClass = Handle(MS_InstClass)::DownCast(aType); + + if (TheInstClass.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "The instantiation " << aClassName << " was not declared..." << endm; YY_nb_error++; CDL_InitVariable(); MS_TraductionError::Raise("Instantiation not defined."); } } - - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); CheckCommentListIsEmpty("InstClass_Begin"); - ListOfComments()->Clear(); + TheListOfComments->Clear(); } void Add_Gen_Class() { - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); - InstClass()->GenClass(aClassName,aPackName); + TheInstClass->GenClass(aClassName,aPackName); } void Add_InstType() @@ -1954,71 +1793,82 @@ void Add_InstType() Standard_Integer i; Handle(MS_Type) aType; Handle(TCollection_HAsciiString) aFullName; - Standard_Boolean ComeFromDynaType = Standard_False; + Standard_Boolean ComeFromDynaType = Standard_False; - if (Current_Entity == CDL_GENTYPE) { + if (TheCurrentEntity == CDL_GENTYPE) + { ComeFromDynaType = Standard_True; restore_state(); } - for (i = 1; i <= ListOfTypes()->Length(); i++) { - aFullName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); - - if (theMetaSchema()->IsDefined(aFullName)) { - aType = theMetaSchema()->GetType(aFullName); - } - else { - char *athetypename = TypeCompletion((char *)(ListOfTypes()->Value(i)->ToCString())); - - if (athetypename == aDummyPackageName) { - ListOfPackages()->Value(i)->Clear(); + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + aFullName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); + + if (TheMetaSchema->IsDefined(aFullName)) + { + aType = TheMetaSchema->GetType(aFullName); + } + else + { + char* aTypeName = TypeCompletion ((char*)(TheListOfTypes->Value(i)->ToCString())); + if (aTypeName == THE_DUMMY_PACKAGE_NAME) + { + TheListOfPackages->Value (i)->Clear(); } } - if (!ComeFromDynaType) { - InstClass()->InstType(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); + if (!ComeFromDynaType) + { + TheInstClass->InstType(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); } - else { - if (ListOfPackages()->Value(i)->IsEmpty()) { - DynType()->InstType(ListOfTypes()->Value(i)); + else + { + if (TheListOfPackages->Value(i)->IsEmpty()) + { + TheDynType->InstType(TheListOfTypes->Value(i)); } - else { - DynType()->InstType(MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i))); + else + { + TheDynType->InstType(MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i))); } } } - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); } void InstClass_End() { - if (Current_Entity == CDL_GENCLASS) { - InstClass()->Instantiates(); + if (TheCurrentEntity == CDL_GENCLASS) + { + TheInstClass->Instantiates(); } - else if (Current_Entity == CDL_PACKAGE) { - Package()->Class(InstClass()->Name()); + else if (TheCurrentEntity == CDL_PACKAGE) + { + ThePackage->Class(TheInstClass->Name()); } - if (Current_Entity != CDL_GENCLASS) { - ListOfInst()->Append(InstClass()->FullName()); + if (TheCurrentEntity != CDL_GENCLASS) + { + TheListOfInst->Append(TheInstClass->FullName()); } - InstClass()->Incomplete(Standard_False); - ListOfGen()->Append(InstClass()->GenClass()); - InstClass().Nullify(); - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheInstClass->Incomplete(Standard_False); + TheListOfGen->Append (TheInstClass->GenClass()); + TheInstClass.Nullify(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; } void DynaType_Begin() @@ -2026,193 +1876,219 @@ void DynaType_Begin() Handle(MS_Package) aPackage; Handle(TColStd_HSequenceOfHAsciiString) aSeqOfPackage; - SaveState = Current_Entity; - Current_Entity = CDL_GENTYPE; - - if (! ListOfItem()->IsEmpty()) { + TheSaveState = TheCurrentEntity; + TheCurrentEntity = CDL_GENTYPE; + + if (!TheListOfItem->IsEmpty()) + { Standard_Integer i; Handle(TCollection_HAsciiString) aPackName; - Handle(TCollection_HAsciiString) aGenName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) aGenName = new TCollection_HAsciiString(TheTypeName); - if (strcmp(aDummyPackageName,Pack_Name)) { - aPackName = new TCollection_HAsciiString(Pack_Name); + if (strcmp (THE_DUMMY_PACKAGE_NAME, ThePackName)) + { + aPackName = new TCollection_HAsciiString (ThePackName); } - else { - aPackage = theMetaSchema()->GetPackage(Container()); + else + { + aPackage = TheMetaSchema->GetPackage (TheContainer); aSeqOfPackage = aPackage->Uses(); - - for (i = 1; i <= aSeqOfPackage->Length(); i++) { - if (theMetaSchema()->IsDefined(MS::BuildFullName(aSeqOfPackage->Value(i),aGenName))) { - aPackName = aSeqOfPackage->Value(i); - } + + for (i = 1; i <= aSeqOfPackage->Length(); i++) + { + if (TheMetaSchema->IsDefined(MS::BuildFullName(aSeqOfPackage->Value(i),aGenName))) + { + aPackName = aSeqOfPackage->Value(i); + } } - if (aPackName.IsNull()) { - aPackName = new TCollection_HAsciiString; - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "constraint type " << thetypename << " comes from a package not declared in 'uses' clause of the package " << Container() << endm; - YY_nb_error++; + if (aPackName.IsNull()) + { + aPackName = new TCollection_HAsciiString(); + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "constraint type " << TheTypeName << " comes from a package not declared in 'uses' clause of the package " << TheContainer << endm; + YY_nb_error++; } } - DynType() = new MS_GenType(GenClass(),ListOfItem()->Value(ListOfItem()->Length()),MS::BuildFullName(aPackName,aGenName)); + TheDynType = new MS_GenType(TheGenClass,TheListOfItem->Value(TheListOfItem->Length()),MS::BuildFullName(aPackName,aGenName)); } - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); } void StdClass_Begin() { - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); Standard_Integer i; - if (Current_Entity == CDL_GENCLASS) { - aPackName = GenClass()->Package()->Name(); + if (TheCurrentEntity == CDL_GENCLASS) + { + aPackName = TheGenClass->Package()->Name(); } - Container() = aPackName; + TheContainer = aPackName; - if (!theMetaSchema()->IsPackage(Container())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Unknown package " << Container() << endm; + if (!TheMetaSchema->IsPackage(TheContainer)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Unknown package " << TheContainer << endm; YY_nb_error++; CDL_InitVariable(); MS_TraductionError::Raise("Unknown package."); } // si la classe n a pas ete cree par une dec incomplete // - StdClass() = new MS_StdClass(aClassName,aPackName); - StdClass()->MetaSchema(theMetaSchema()); - - if (!theMetaSchema()->IsDefined(StdClass()->FullName()) || Current_Entity == CDL_GENCLASS) { - if (Current_Entity == CDL_GENCLASS && theMetaSchema()->IsDefined(StdClass()->FullName())) { - theMetaSchema()->RemoveType(StdClass()->FullName(),Standard_False); - GenClass()->NestedStdClass(StdClass()->Name()); - StdClass()->Mother(GenClass()->FullName()); - } - else if (Current_Entity == CDL_GENCLASS) { - Handle(MS_Package) aPackage = theMetaSchema()->GetPackage(aPackName); - - if (!aPackage->HasClass(aClassName)) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class : " << StdClass()->Name() << " is not declared in package " << aPackName << endm; - YY_nb_error++; - CDL_InitVariable(); - MS_TraductionError::Raise("Class not defined."); + TheStdClass = new MS_StdClass(aClassName,aPackName); + TheStdClass->MetaSchema(TheMetaSchema); + + if (!TheMetaSchema->IsDefined(TheStdClass->FullName()) || TheCurrentEntity == CDL_GENCLASS) + { + if (TheCurrentEntity == CDL_GENCLASS && TheMetaSchema->IsDefined(TheStdClass->FullName())) + { + TheMetaSchema->RemoveType(TheStdClass->FullName(),Standard_False); + TheGenClass->NestedStdClass(TheStdClass->Name()); + TheStdClass->Mother(TheGenClass->FullName()); + } + else if (TheCurrentEntity == CDL_GENCLASS) + { + Handle(MS_Package) aPackage = TheMetaSchema->GetPackage(aPackName); + + if (!aPackage->HasClass(aClassName)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class : " << TheStdClass->Name() << " is not declared in package " << aPackName << endm; + YY_nb_error++; + CDL_InitVariable(); + MS_TraductionError::Raise("Class not defined."); } - GenClass()->NestedStdClass(StdClass()->Name()); - StdClass()->Mother(GenClass()->FullName()); - } - - if (Current_Entity == CDL_GENCLASS) { - StdClass()->SetGenericState(Standard_True); - StdClass()->NestingClass(GenClass()->FullName()); - GenClass()->AddNested(StdClass()->Name()); - } - - StdClass()->MetaSchema(theMetaSchema()); - - StdClass()->Private(Private); - StdClass()->Deferred(Deferred); - StdClass()->Incomplete(Standard_False); - - theMetaSchema()->AddType(StdClass()); - - StdClass()->Package(aPackName); - } - else { - Handle(MS_Type) aType = theMetaSchema()->GetType(StdClass()->FullName()); - - StdClass() = Handle(MS_StdClass)::DownCast(aType); - - if (StdClass().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "The class " << aClassName << " was not declared..." << endm; + TheGenClass->NestedStdClass(TheStdClass->Name()); + TheStdClass->Mother(TheGenClass->FullName()); + } + + if (TheCurrentEntity == CDL_GENCLASS) + { + TheStdClass->SetGenericState(Standard_True); + TheStdClass->NestingClass(TheGenClass->FullName()); + TheGenClass->AddNested(TheStdClass->Name()); + } + + TheStdClass->MetaSchema (TheMetaSchema); + TheStdClass->Private (TheIsPrivate); + TheStdClass->Deferred (TheIsDeferred); + TheStdClass->Incomplete (Standard_False); + + TheMetaSchema->AddType (TheStdClass); + + TheStdClass->Package (aPackName); + } + else + { + Handle(MS_Type) aType = TheMetaSchema->GetType(TheStdClass->FullName()); + + TheStdClass = Handle(MS_StdClass)::DownCast(aType); + + if (TheStdClass.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "The class " << aClassName << " was not declared..." << endm; CDL_InitVariable(); MS_TraductionError::Raise("Class not defined."); } - if (Private != StdClass()->Private()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << StdClass()->FullName() << " has not the same visibility keyword in package declaration and in class definition." << endm; + if (TheIsPrivate != TheStdClass->Private()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheStdClass->FullName() << " has not the same visibility keyword in package declaration and in class definition." << endm; YY_nb_error++; } - - if (Deferred != StdClass()->Deferred()) { - if (Deferred) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << StdClass()->FullName() << " is declared 'deferred' in class definition but not in package declaration." << endm; + + if (TheIsDeferred != TheStdClass->Deferred()) + { + if (TheIsDeferred) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheStdClass->FullName() << " is declared 'deferred' in class definition but not in package declaration." << endm; } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << StdClass()->FullName() << " is declared 'deferred' in package declaration but not in class definition." << endm; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheStdClass->FullName() << " is declared 'deferred' in package declaration but not in class definition." << endm; } YY_nb_error++; } } - - if (Current_Entity != CDL_GENCLASS) { - Current_Entity = CDL_STDCLASS; + + if (TheCurrentEntity != CDL_GENCLASS) + { + TheCurrentEntity = CDL_STDCLASS; } - for (i =1; i <= ListOfComments()->Length(); i++) { - StdClass()->SetComment(ListOfComments()->Value(i)); + for (i =1; i <= TheListOfComments->Length(); i++) + { + TheStdClass->SetComment(TheListOfComments->Value(i)); } - SimpleClass() = StdClass(); + TheSimpleClass = TheStdClass; - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); - ListOfComments()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); + TheListOfComments->Clear(); } void Add_Std_Ancestors() -{ - Standard_Integer i; +{ Handle(TCollection_HAsciiString) aFullName; + for (Standard_Integer i = 1; i <= TheListOfTypes->Length(); i++) + { + aFullName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); + + if (TheMetaSchema->IsDefined(aFullName)) + { + Handle(MS_Class) aClass = Handle(MS_Class)::DownCast(TheMetaSchema->GetType(aFullName)); + if (aClass.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class : " << aFullName << " must not be a normal class." << endm; + YY_nb_error++; + } - for (i = 1; i <= ListOfTypes()->Length(); i++) { - aFullName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); - - if (theMetaSchema()->IsDefined(aFullName)) { - Handle(MS_Class) aClass = Handle(MS_Class)::DownCast(theMetaSchema()->GetType(aFullName)); - if (aClass.IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class : " << aFullName << " must not be a normal class." << endm; - YY_nb_error++; - } - - if (i > 1) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << SimpleClass()->FullName() << " uses multiple inheritance." << endm; - YY_nb_error++; + if (i > 1) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheSimpleClass->FullName() << " uses multiple inheritance." << endm; + YY_nb_error++; } - else if (!SimpleClass()->FullName()->IsSameString(aClass->FullName())) { - SimpleClass()->Inherit(aClass); + else if (!TheSimpleClass->FullName()->IsSameString(aClass->FullName())) + { + TheSimpleClass->Inherit(aClass); } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class " << SimpleClass()->FullName() << " can not inherits from itself." << endm; - YY_nb_error++; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class " << TheSimpleClass->FullName() << " can not inherits from itself." << endm; + YY_nb_error++; } - SimpleClass()->Use(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); - - ListOfTypeUsed()->Append(aFullName); + TheSimpleClass->Use(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); + + TheListOfGlobalUsed->Append(aFullName); } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class : " << aFullName << " not defined, can't be in inherits clause." << endm; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Class : " << aFullName << " not defined, can't be in inherits clause." << endm; YY_nb_error++; } } - //SimpleClass()->MetaSchema(theMetaSchema()); - for (i =1; i <= ListOfComments()->Length(); i++) { - SimpleClass()->SetComment(ListOfComments()->Value(i)); + //TheSimpleClass->MetaSchema(TheMetaSchema); + for (Standard_Integer i = 1; i <= TheListOfComments->Length(); i++) + { + TheSimpleClass->SetComment(TheListOfComments->Value(i)); } - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); - ListOfComments()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); + TheListOfComments->Clear(); } void Add_Std_Uses() @@ -2220,47 +2096,53 @@ void Add_Std_Uses() Standard_Integer i; - //SimpleClass()->MetaSchema(theMetaSchema()); - for (i =1; i <= ListOfComments()->Length(); i++) { - SimpleClass()->SetComment(ListOfComments()->Value(i)); + //TheSimpleClass->MetaSchema(TheMetaSchema); + for (i =1; i <= TheListOfComments->Length(); i++) + { + TheSimpleClass->SetComment(TheListOfComments->Value(i)); } - for (i = 1; i <= ListOfTypes()->Length(); i++) { - Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); - if (Current_Entity != CDL_GENCLASS && !theMetaSchema()->IsDefined(aFullName)) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "The 'uses' statement of your class has a type : " << aFullName << " from a package not declared in the 'uses' statement of the package " << Container() << endm; + if (TheCurrentEntity != CDL_GENCLASS && !TheMetaSchema->IsDefined(aFullName)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "The 'uses' statement of your class has a type : " << aFullName << " from a package not declared in the 'uses' statement of the package " << TheContainer << endm; YY_nb_error++; } - else if (Current_Entity != CDL_GENCLASS) { - if (!SimpleClass()->Package()->IsUsed(ListOfPackages()->Value(i))) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "The 'uses' statement of your class has a type : " << aFullName << " from a package not declared in the 'uses' statement of the package " << Container() << endm; - YY_nb_error++; + else if (TheCurrentEntity != CDL_GENCLASS) + { + if (!TheSimpleClass->Package()->IsUsed(TheListOfPackages->Value(i))) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "The 'uses' statement of your class has a type : " << aFullName << " from a package not declared in the 'uses' statement of the package " << TheContainer << endm; + YY_nb_error++; } } - - SimpleClass()->Use(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); - ListOfTypeUsed()->Append(aFullName); + TheSimpleClass->Use(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); + + TheListOfGlobalUsed->Append(aFullName); } - ListOfComments()->Clear(); - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfComments->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); } void StdClass_End() { - if (Current_Entity == CDL_GENCLASS) { - SimpleClass() = GenClass(); + if (TheCurrentEntity == CDL_GENCLASS) + { + TheSimpleClass = TheGenClass; } - StdClass()->Incomplete(Standard_False); + TheStdClass->Incomplete(Standard_False); - StdClass().Nullify(); - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); - ListOfComments()->Clear(); + TheStdClass.Nullify(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); + TheListOfComments->Clear(); } @@ -2268,98 +2150,107 @@ void Add_Raises() { Standard_Integer i; - for (i = 1; i <= ListOfTypes()->Length(); i++) { - Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); - if (theMetaSchema()->IsDefined(aFullName)) { - SimpleClass()->Raises(ListOfTypes()->Value(i),ListOfPackages()->Value(i)); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "the exception " << "'" << aFullName << "'" << " is not defined." << endm; + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); + if (TheMetaSchema->IsDefined(aFullName)) + { + TheSimpleClass->Raises(TheListOfTypes->Value(i),TheListOfPackages->Value(i)); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "the exception " << "'" << aFullName << "'" << " is not defined." << endm; YY_nb_error++; } } - ListOfTypes()->Clear(); - ListOfPackages()->Clear(); + TheListOfTypes->Clear(); + TheListOfPackages->Clear(); } void Add_Field() { Standard_Integer i,j; - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); - for (i = 1; i <= ListOfName()->Length(); i++) { - Field() = new MS_Field(SimpleClass(),ListOfName()->Value(i)); + for (i = 1; i <= TheListOfName->Length(); i++) + { + TheField = new MS_Field(TheSimpleClass,TheListOfName->Value(i)); - Field()->MetaSchema(theMetaSchema()); + TheField->MetaSchema(TheMetaSchema); - for (j = 1; j <= ListOfInteger()->Length(); j++) { - Field()->Dimension(ListOfInteger()->Value(j)->IntegerValue()); + for (j = 1; j <= TheListOfInteger->Length(); j++) + { + TheField->Dimension(TheListOfInteger->Value(j)->IntegerValue()); } - if (strcmp(Pack_Name,aDummyPackageName) == 0) { + if (strcmp (ThePackName, THE_DUMMY_PACKAGE_NAME) == 0) + { aPackName->Clear(); } - else { + else + { VerifyClassUses(MS::BuildFullName(aPackName,aClassName)); } - Field()->TYpe(aClassName,aPackName); + TheField->TYpe (aClassName, aPackName); + + TheField->Protected (TheIsProtected); - Field()->Protected(Protected); - - SimpleClass()->Field(Field()); + TheSimpleClass->Field (TheField); } - Private = Standard_False; - Protected = Standard_False; - ListOfInteger()->Clear(); - ListOfName()->Clear(); + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheListOfInteger->Clear(); + TheListOfName->Clear(); } void Add_RedefField() { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Fields redefinition no more supported..." << endm; + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Fields redefinition no more supported..." << endm; YY_nb_error++; } void Add_FriendMet() { - Method()->Params(MethodParams()); - MethodParams().Nullify(); - Method()->CreateFullName(); - SimpleClass()->FriendMet(Method()->FullName()); + TheMethod->Params(TheMethodParams); + TheMethodParams.Nullify(); + TheMethod->CreateFullName(); + TheSimpleClass->FriendMet(TheMethod->FullName()); } -void Add_FriendExtMet(char *aPackName) +void Add_FriendExtMet(char* aPackName) { Handle(TCollection_HAsciiString) apack = new TCollection_HAsciiString(aPackName); - ExternMet()->Package(apack); - Method()->Params(MethodParams()); - MethodParams().Nullify(); - Method()->CreateFullName(); - SimpleClass()->FriendMet(Method()->FullName()); + TheExternMet->Package(apack); + TheMethod->Params(TheMethodParams); + TheMethodParams.Nullify(); + TheMethod->CreateFullName(); + TheSimpleClass->FriendMet(TheMethod->FullName()); } //======================================================================= //function : Add_Friend_Class -//purpose : +//purpose : //======================================================================= void Add_Friend_Class() { - Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); Handle(TCollection_HAsciiString) theTypeName = MS::BuildFullName(aPackName,aClassName); - if (theMetaSchema()->IsDefined(theTypeName)) { - SimpleClass()->Friend(aClassName,aPackName); - ListOfTypeUsed()->Append(theTypeName); + if (TheMetaSchema->IsDefined(theTypeName)) + { + TheSimpleClass->Friend(aClassName,aPackName); + TheListOfGlobalUsed->Append(theTypeName); } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "friend class " << theTypeName->ToCString() << " is not defined." << endm; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "friend class " << theTypeName->ToCString() << " is not defined." << endm; YY_nb_error++; } } @@ -2370,43 +2261,47 @@ WOKTools_MapOfHAsciiString anEnumMap; // //======================================================================= //function : Enum_Begin -//purpose : +//purpose : //======================================================================= void Enum_Begin() { - Handle(TCollection_HAsciiString) anEnumName = new TCollection_HAsciiString(thetypename); + Handle(TCollection_HAsciiString) anEnumName = new TCollection_HAsciiString(TheTypeName); anEnumMap.Clear(); - Enum() = new MS_Enum(anEnumName,Container(),Container(),Private); + TheEnum = new MS_Enum(anEnumName,TheContainer,TheContainer,TheIsPrivate); - Enum()->MetaSchema(theMetaSchema()); - Enum()->Package(Package()->FullName()); + TheEnum->MetaSchema(TheMetaSchema); + TheEnum->Package (ThePackage->FullName()); CheckCommentListIsEmpty("Enum_Begin"); - ListOfComments()->Clear(); + TheListOfComments->Clear(); - if (!theMetaSchema()->AddType(Enum())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Enumeration : " << Enum()->FullName() << " is already defined." << endm; + if (!TheMetaSchema->AddType(TheEnum)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Enumeration : " << TheEnum->FullName() << " is already defined." << endm; YY_nb_error++; } } -void Add_Enum(char *aValue) +void Add_Enum(char* aValue) { Handle(TCollection_HAsciiString) anEnumValue = new TCollection_HAsciiString(aValue); - for(Standard_Integer i = 1; i <= ListOfComments()->Length(); i++) { - Enum()->SetComment(ListOfComments()->Value(i)); - } - ListOfComments()->Clear(); + for(Standard_Integer i = 1; i <= TheListOfComments->Length(); i++) + { + TheEnum->SetComment(TheListOfComments->Value(i)); + } + TheListOfComments->Clear(); - if (!anEnumMap.Contains(anEnumValue)) { + if (!anEnumMap.Contains(anEnumValue)) + { anEnumMap.Add(anEnumValue); - Enum()->Enum(anEnumValue); + TheEnum->Enum(anEnumValue); } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Enumeration value " << aValue << " in " << Enum()->FullName() << " is already defined." << endm; + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "Enumeration value " << aValue << " in " << TheEnum->FullName() << " is already defined." << endm; YY_nb_error++; } } @@ -2414,15 +2309,16 @@ void Add_Enum(char *aValue) void Enum_End() { //Enum->Check(); - Package()->Enum(Enum()->Name()); - for(Standard_Integer i = 1; i <= ListOfComments()->Length(); i++) { - Enum()->SetComment(ListOfComments()->Value(i)); - } - ListOfComments()->Clear(); - Enum().Nullify(); + ThePackage->Enum(TheEnum->Name()); + for(Standard_Integer i = 1; i <= TheListOfComments->Length(); i++) + { + TheEnum->SetComment(TheListOfComments->Value(i)); + } + TheListOfComments->Clear(); + TheEnum.Nullify(); anEnumMap.Clear(); - Private = Standard_False; + TheIsPrivate = Standard_False; } // The actions for the Methods @@ -2430,7 +2326,7 @@ void Enum_End() void get_cpp_commentalias(const Handle(TCollection_HAsciiString)& aComment) { Handle(TCollection_HAsciiString) aToken1, - aToken2; + aToken2; aToken1 = aComment->Token(); @@ -2444,250 +2340,280 @@ void get_cpp_commentalias(const Handle(TCollection_HAsciiString)& aComment) //======================================================================= //function : add_cpp_comment_to_method -//purpose : +//purpose : //======================================================================= void add_cpp_comment_to_method() { - if (Method().IsNull()) { - if (ListOfCplusplus()->Length() > 0) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << CDLlineno << ": " \ - << "C++ directive outside method definition." << endm; + if (TheMethod.IsNull()) + { + if (TheListOfCplusplus->Length() > 0) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << CDLlineno << ": " + << "C++ directive outside method definition." << endm; YY_nb_error++; } } - else { + else + { int aCommentType; Standard_Integer i, aNbCPP; Handle(TCollection_HAsciiString) aCP; - for(i = 1; i <= ListOfComments()->Length(); ++i) { - Method()->SetComment(ListOfComments()->Value(i)); + for(i = 1; i <= TheListOfComments->Length(); ++i) + { + TheMethod->SetComment(TheListOfComments->Value(i)); } - ListOfComments()->Clear(); - - aNbCPP=ListOfCplusplus()->Length(); - for(i = 1; i <= aNbCPP; ++i) { - aCommentType = ListOfCPPType()->Value(i); + TheListOfComments->Clear(); + + aNbCPP=TheListOfCplusplus->Length(); + for(i = 1; i <= aNbCPP; ++i) + { + aCommentType = TheListOfCPPType->Value(i); // - switch (aCommentType) { - case CDL_HARDALIAS: - get_cpp_commentalias(ListOfCplusplus()->Value(i)); - Method()->Alias(ListOfCplusplus()->Value(i)); - Method()->SetAliasType(Standard_False); - break; - case CDL_OPERATOR: - get_cpp_commentalias(ListOfCplusplus()->Value(i)); - Method()->Alias(ListOfCplusplus()->Value(i)); - Method()->SetAliasType(Standard_True); - break; - case CDL_INLINE: - Method()->Inline(Standard_True); - break; - case CDL_DESTRUCTOR: - if (Method()->IsFunctionCall()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << methodlineno << ": "\ - << "C++ directive 'alias ~' cannot be used with 'function call'." \ - << endm; - YY_nb_error++; - } - Method()->Destructor(Standard_True); - break; - - case CDL_CONSTREF: - if (!Method()->Returns().IsNull()) { - Method()->ConstReturn(Standard_True); - Method()->RefReturn(Standard_True); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << methodlineno << ": " \ - << "C++ directive 'return const &' cannot be used without 'returns' clause."\ - << endm; - YY_nb_error++; - } - break; - case CDL_REF: - if (!Method()->Returns().IsNull()) { - Method()->RefReturn(Standard_True); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString()\ - << "\"" << ", line " << methodlineno << ": "\ - << "C++ directive 'return &' cannot be used without 'returns' clause."\ - << endm; - YY_nb_error++; - } - break; - //===f - case CDL_CONSTPTR: - if (!Method()->Returns().IsNull()) { - Method()->ConstReturn(Standard_True); - Method()->PtrReturn(Standard_True); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << methodlineno << ": " \ - << "C++ directive 'return const &' cannot be used without 'returns' clause."\ - << endm; - YY_nb_error++; - } - break; - case CDL_PTR: - if (!Method()->Returns().IsNull()) { - Method()->PtrReturn(Standard_True); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString()\ - << "\"" << ", line " << methodlineno << ": "\ - << "C++ directive 'return &' cannot be used without 'returns' clause." << endm; - YY_nb_error++; - } - break; - //===t - case CDL_CONSTRET: - if (!Method()->Returns().IsNull()) { - Method()->ConstReturn(Standard_True); - } - else { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() \ - << "\"" << ", line " << methodlineno << ": "\ - << "C++ directive 'return const' cannot be used without 'returns' clause." << endm; - YY_nb_error++; - } - break; - case CDL_FUNCTIONCALL: - if (Method()->IsDestructor()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString()\ - << "\"" << ", line " << methodlineno << ": "\ - << "C++ directive 'function call' cannot be used with 'alias ~'." << endm; - YY_nb_error++; - } - Method()->FunctionCall(Standard_True); - break; - default: - break; - }//switch (aCommentType) { - }//for(i = 1; i <= aNbCPP; ++i) { + switch (aCommentType) + { + case CDL_HARDALIAS: + get_cpp_commentalias(TheListOfCplusplus->Value(i)); + TheMethod->Alias(TheListOfCplusplus->Value(i)); + TheMethod->SetAliasType(Standard_False); + break; + case CDL_OPERATOR: + get_cpp_commentalias(TheListOfCplusplus->Value(i)); + TheMethod->Alias(TheListOfCplusplus->Value(i)); + TheMethod->SetAliasType(Standard_True); + break; + case CDL_INLINE: + TheMethod->Inline(Standard_True); + break; + case CDL_DESTRUCTOR: + if (TheMethod->IsFunctionCall()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'alias ~' cannot be used with 'function call'." + << endm; + YY_nb_error++; + } + TheMethod->Destructor(Standard_True); + break; + + case CDL_CONSTREF: + if (!TheMethod->Returns().IsNull()) + { + TheMethod->ConstReturn(Standard_True); + TheMethod->RefReturn(Standard_True); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'return const &' cannot be used without 'returns' clause." + << endm; + YY_nb_error++; + } + break; + case CDL_REF: + if (!TheMethod->Returns().IsNull()) + { + TheMethod->RefReturn(Standard_True); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'return &' cannot be used without 'returns' clause." + << endm; + YY_nb_error++; + } + break; + //===f + case CDL_CONSTPTR: + if (!TheMethod->Returns().IsNull()) + { + TheMethod->ConstReturn(Standard_True); + TheMethod->PtrReturn(Standard_True); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'return const &' cannot be used without 'returns' clause." + << endm; + YY_nb_error++; + } + break; + case CDL_PTR: + if (!TheMethod->Returns().IsNull()) + { + TheMethod->PtrReturn(Standard_True); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'return &' cannot be used without 'returns' clause." << endm; + YY_nb_error++; + } + break; + //===t + case CDL_CONSTRET: + if (!TheMethod->Returns().IsNull()) + { + TheMethod->ConstReturn(Standard_True); + } + else + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'return const' cannot be used without 'returns' clause." << endm; + YY_nb_error++; + } + break; + case CDL_FUNCTIONCALL: + if (TheMethod->IsDestructor()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() + << "\", line " << TheMethodLineNo << ": " + << "C++ directive 'function call' cannot be used with 'alias ~'." << endm; + YY_nb_error++; + } + TheMethod->FunctionCall(Standard_True); + break; + default: + break; + } + } + // CheckCommentListIsEmpty("add_cpp_comment_to_method"); - ListOfComments()->Clear(); - ListOfCplusplus()->Clear(); - ListOfCPPType()->Clear(); - theMetaSchema()->AddMethod(Method()); + TheListOfComments->Clear(); + TheListOfCplusplus->Clear(); + TheListOfCPPType->Clear(); + TheMetaSchema->AddMethod(TheMethod); } } //======================================================================= //function : Construct_Begin -//purpose : +//purpose : //======================================================================= void Construct_Begin() { - if (SimpleClass()->Deferred()) { - if (!MethodName()->IsSameString(DefCons())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "A deferred class must not have a constructor with name 'Create' or no 'me' or 'myclass' present for the method." << endm; + if (TheSimpleClass->Deferred()) + { + if (!TheMethodName->IsSameString(TheDefCons)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "A deferred class must not have a constructor with name 'Create' or no 'me' or 'myclass' present for the method." << endm; YY_nb_error++; } } - else { - if (!MethodName()->IsSameString(NorCons())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "A class must have a constructor with name 'Create' or no 'me' or 'myclass' present for the method." << endm; + else + { + if (!TheMethodName->IsSameString(TheNorCons)) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "A class must have a constructor with name 'Create' or no 'me' or 'myclass' present for the method." << endm; YY_nb_error++; } } - if (!Method().IsNull()) { + if (!TheMethod.IsNull()) + { add_cpp_comment_to_method(); } - methodlineno = CDLlineno; - Construc() = new MS_Construc(MethodName(),SimpleClass()->FullName()); - Method() = Construc(); - MemberMet() = Construc(); - Method()->MetaSchema(theMetaSchema()); + TheMethodLineNo = CDLlineno; + TheConstruc = new MS_Construc(TheMethodName,TheSimpleClass->FullName()); + TheMethod = TheConstruc; + TheMemberMet = TheConstruc; + TheMethod->MetaSchema(TheMetaSchema); } void Friend_Construct_Begin() { - Construc() = new MS_Construc(MethodName(),ListOfTypeUsed()->Value(ListOfTypeUsed()->Length())); - Method() = Construc(); - MemberMet() = Construc(); - Method()->MetaSchema(theMetaSchema()); + TheConstruc = new MS_Construc(TheMethodName,TheListOfGlobalUsed->Value(TheListOfGlobalUsed->Length())); + TheMethod = TheConstruc; + TheMemberMet = TheConstruc; + TheMethod->MetaSchema(TheMetaSchema); } void InstMet_Begin() { - if (!Method().IsNull()) { + if (!TheMethod.IsNull()) + { add_cpp_comment_to_method(); } - methodlineno = CDLlineno; - InstMet() = new MS_InstMet(MethodName(),SimpleClass()->FullName()); - Method() = InstMet(); - Method()->MetaSchema(theMetaSchema()); - MemberMet() = InstMet(); + TheMethodLineNo = CDLlineno; + TheInstMet = new MS_InstMet(TheMethodName,TheSimpleClass->FullName()); + TheMethod = TheInstMet; + TheMethod->MetaSchema(TheMetaSchema); + TheMemberMet = TheInstMet; } void Friend_InstMet_Begin() { - InstMet() = new MS_InstMet(MethodName(),ListOfTypeUsed()->Value(ListOfTypeUsed()->Length())); - Method() = InstMet(); - MemberMet() = InstMet(); - Method()->MetaSchema(theMetaSchema()); + TheInstMet = new MS_InstMet(TheMethodName,TheListOfGlobalUsed->Value(TheListOfGlobalUsed->Length())); + TheMethod = TheInstMet; + TheMemberMet = TheInstMet; + TheMethod->MetaSchema(TheMetaSchema); } void ClassMet_Begin() { - if (!Method().IsNull()) { + if (!TheMethod.IsNull()) + { add_cpp_comment_to_method(); } - methodlineno = CDLlineno; - ClassMet() = new MS_ClassMet(MethodName(),SimpleClass()->FullName()); - Method() = ClassMet(); - Method()->MetaSchema(theMetaSchema()); - MemberMet() = ClassMet(); + TheMethodLineNo = CDLlineno; + TheClassMet = new MS_ClassMet(TheMethodName,TheSimpleClass->FullName()); + TheMethod = TheClassMet; + TheMethod->MetaSchema(TheMetaSchema); + TheMemberMet = TheClassMet; } void Friend_ClassMet_Begin() { - ClassMet() = new MS_ClassMet(MethodName(),ListOfTypeUsed()->Value(ListOfTypeUsed()->Length())); - Method() = ClassMet(); - MemberMet() = ClassMet(); - Method()->MetaSchema(theMetaSchema()); + TheClassMet = new MS_ClassMet(TheMethodName,TheListOfGlobalUsed->Value(TheListOfGlobalUsed->Length())); + TheMethod = TheClassMet; + TheMemberMet = TheClassMet; + TheMethod->MetaSchema(TheMetaSchema); } void ExtMet_Begin() { - if (!Method().IsNull()) { + if (!TheMethod.IsNull()) + { add_cpp_comment_to_method(); } - methodlineno = CDLlineno; - ExternMet() = new MS_ExternMet(MethodName(),Package()->Name()); - Method() = ExternMet(); - Method()->MetaSchema(theMetaSchema()); + TheMethodLineNo = CDLlineno; + TheExternMet = new MS_ExternMet (TheMethodName, ThePackage->Name()); + TheMethod = TheExternMet; + TheMethod->MetaSchema(TheMetaSchema); } void Friend_ExtMet_Begin() { - ExternMet() = new MS_ExternMet(MethodName()); - Method() = ExternMet(); - Method()->MetaSchema(theMetaSchema()); + TheExternMet = new MS_ExternMet(TheMethodName); + TheMethod = TheExternMet; + TheMethod->MetaSchema(TheMetaSchema); } void Add_Me() { - if (Mutable == MS_MUTABLE) { - InstMet()->ConstMode(MSINSTMET_MUTABLE); + if (TheMutable == MS_MUTABLE) + { + TheInstMet->ConstMode(MSINSTMET_MUTABLE); } - else if (InOrOut == MS_INOUT || InOrOut == MS_OUT) { - InstMet()->ConstMode(MSINSTMET_OUT); + else if (TheInOrOut == MS_INOUT || TheInOrOut == MS_OUT) + { + TheInstMet->ConstMode(MSINSTMET_OUT); } - else { - InstMet()->Const(Standard_True); + else + { + TheInstMet->Const(Standard_True); } - Mutable = 0; - InOrOut = MS_IN; + TheMutable = 0; + TheInOrOut = MS_IN; } void Add_MetRaises() @@ -2695,131 +2621,147 @@ void Add_MetRaises() Standard_Integer i,j; Handle(TCollection_HAsciiString) aName; - for (i = 1; i <= ListOfTypes()->Length(); i++) { - aName = MS::BuildFullName(ListOfPackages()->Value(i),ListOfTypes()->Value(i)); - if (theMetaSchema()->IsDefined(aName)) { - if (Current_Entity == CDL_STDCLASS || Current_Entity == CDL_GENCLASS) { - Handle(TColStd_HSequenceOfHAsciiString) seq = SimpleClass()->GetRaises(); - Standard_Boolean isFound = Standard_False; - - for (j = 1; j <= seq->Length() && !isFound; j++) { - if (seq->Value(j)->IsSameString(aName)) { - isFound = Standard_True; - } - } - - if (!isFound) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "the exception " << "'" << aName << "'" << " is not declared in 'raises' clause of the class: " << SimpleClass()->FullName() << endm; - YY_nb_error++; - } - else { - Method()->Raises(aName); - } + for (i = 1; i <= TheListOfTypes->Length(); i++) + { + aName = MS::BuildFullName(TheListOfPackages->Value(i),TheListOfTypes->Value(i)); + if (TheMetaSchema->IsDefined(aName)) + { + if (TheCurrentEntity == CDL_STDCLASS || TheCurrentEntity == CDL_GENCLASS) + { + Handle(TColStd_HSequenceOfHAsciiString) seq = TheSimpleClass->GetRaises(); + Standard_Boolean isFound = Standard_False; + + for (j = 1; j <= seq->Length() && !isFound; j++) + { + if (seq->Value(j)->IsSameString(aName)) + { + isFound = Standard_True; + } + } + + if (!isFound) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "the exception " << "'" << aName << "'" << " is not declared in 'raises' clause of the class: " << TheSimpleClass->FullName() << endm; + YY_nb_error++; + } + else + { + TheMethod->Raises(aName); + } } - else { - Method()->Raises(aName); + else + { + TheMethod->Raises(aName); } } - else { + else + { // si on est dans les methodes de package on ne verifie pas les raises // - if (ExternMet().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "the exception " << "'" << aName << "'" << " is not defined." << endm; - YY_nb_error++; + if (TheExternMet.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "the exception " << "'" << aName << "'" << " is not defined." << endm; + YY_nb_error++; } - else { - Method()->Raises(aName); + else + { + TheMethod->Raises(aName); } } } - ListOfPackages()->Clear(); - ListOfTypes()->Clear(); + TheListOfPackages->Clear(); + TheListOfTypes->Clear(); } void Add_Returns() { - Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); Handle(MS_Param) aParam; Standard_Boolean isGenType = Standard_False; - aParam = new MS_Param(Method(),athetypename); - - aParam->Like(Like); - aParam->AccessMode(Mutable); - aParam->AccessMode(InOrOut); - aParam->MetaSchema(theMetaSchema()); + aParam = new MS_Param(TheMethod,athetypename); - if (strcmp(Pack_Name,aDummyPackageName) == 0) { + aParam->Like (TheIsLike); + aParam->AccessMode (TheMutable); + aParam->AccessMode (TheInOrOut); + aParam->MetaSchema (TheMetaSchema); + + if (strcmp (ThePackName, THE_DUMMY_PACKAGE_NAME) == 0) + { aPackName->Clear(); isGenType = Standard_True; } - else { + else + { VerifyClassUses(MS::BuildFullName(aPackName,athetypename)); } aParam->Type(athetypename,aPackName); - if (!Construc().IsNull()) { - if (!aParam->TypeName()->IsSameString(Construc()->Class())) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "The constructor must return " << Construc()->Class() << " not " << aParam->TypeName() << endm; + if (!TheConstruc.IsNull()) + { + if (!aParam->TypeName()->IsSameString(TheConstruc->Class())) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "The constructor must return " << TheConstruc->Class() << " not " << aParam->TypeName() << endm; YY_nb_error++; } } - Method()->Returns(aParam); - - Mutable = 0; - InOrOut = MS_IN; - Like = Standard_False; + TheMethod->Returns(aParam); - ListOfName()->Clear(); + TheMutable = 0; + TheInOrOut = MS_IN; + TheIsLike = Standard_False; + + TheListOfName->Clear(); } -void MemberMet_End() +void MemberMet_End() { - SimpleClass()->Method(MemberMet()); - Method()->Params(MethodParams()); - MethodParams().Nullify(); - MemberMet()->CreateFullName(); - MemberMet()->Private(Private); - MemberMet()->Protected(Protected); + TheSimpleClass->Method(TheMemberMet); + TheMethod->Params(TheMethodParams); + TheMethodParams.Nullify(); + TheMemberMet->CreateFullName(); + TheMemberMet->Private (TheIsPrivate); + TheMemberMet->Protected(TheIsProtected); - if (!InstMet().IsNull()) { - InstMet()->Deferred(Deferred); - InstMet()->Redefined(Redefined); - InstMet()->Static(Static); + if (!TheInstMet.IsNull()) + { + TheInstMet->Deferred (TheIsDeferred); + TheInstMet->Redefined(TheIsRedefined); + TheInstMet->Static (TheIsStatic); } - MemberMet().Nullify(); - InstMet().Nullify(); - Construc().Nullify(); - ClassMet().Nullify(); + TheMemberMet.Nullify(); + TheInstMet.Nullify(); + TheConstruc.Nullify(); + TheClassMet.Nullify(); - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; } -void ExternMet_End() +void ExternMet_End() { - Package()->Method(ExternMet()); - Method()->Params(MethodParams()); - MethodParams().Nullify(); - ExternMet()->CreateFullName(); - ExternMet()->Private(Private); - ExternMet().Nullify(); - Private = Standard_False; - Protected = Standard_False; - Static = Standard_True; - Deferred = Standard_False; - Redefined = Standard_False; - Like = Standard_False; + ThePackage->Method (TheExternMet); + TheMethod->Params(TheMethodParams); + TheMethodParams.Nullify(); + TheExternMet->CreateFullName(); + TheExternMet->Private (TheIsPrivate); + TheExternMet.Nullify(); + TheIsPrivate = Standard_False; + TheIsProtected = Standard_False; + TheIsStatic = Standard_True; + TheIsDeferred = Standard_False; + TheIsRedefined = Standard_False; + TheIsLike = Standard_False; } // The actions for Parameters @@ -2828,74 +2770,86 @@ void Param_Begin() { Standard_Integer i; Handle(MS_Param) aParam; - Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(thetypename); - Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name); + Handle(TCollection_HAsciiString) athetypename = new TCollection_HAsciiString(TheTypeName); + Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(ThePackName); Standard_Boolean isGenType = Standard_False; - - for (i = 1; i <= ListOfName()->Length(); i++) { - if (ParamValue().IsNull()) { - aParam = new MS_Param(Method(),ListOfName()->Value(i)); + + for (i = 1; i <= TheListOfName->Length(); i++) + { + if (TheParamValue.IsNull()) + { + aParam = new MS_Param(TheMethod,TheListOfName->Value(i)); } - else { - aParam = new MS_ParamWithValue(Method(),ListOfName()->Value(i)); + else + { + aParam = new MS_ParamWithValue(TheMethod,TheListOfName->Value(i)); } - aParam->AccessMode(Mutable); - aParam->AccessMode(InOrOut); - aParam->MetaSchema(theMetaSchema()); + aParam->AccessMode(TheMutable); + aParam->AccessMode(TheInOrOut); + aParam->MetaSchema(TheMetaSchema); - if (strcmp(Pack_Name,aDummyPackageName) == 0) { + if (strcmp (ThePackName, THE_DUMMY_PACKAGE_NAME) == 0) + { aPackName->Clear(); isGenType = Standard_True; } - else { + else + { VerifyClassUses(MS::BuildFullName(aPackName,athetypename)); } - aParam->Like(Like); - aParam->Type(athetypename,aPackName); + aParam->Like (TheIsLike); + aParam->Type (athetypename, aPackName); - if (!ParamValue().IsNull()) { + if (!TheParamValue.IsNull()) + { MS_TypeOfValue pt = MS_INTEGER; - MS_ParamWithValue *pwv; - - switch (ParamType) { - case INTEGER: - break; - case REAL: pt = MS_REAL; - break; - case STRING: pt = MS_STRING; - break; - case LITERAL: pt = MS_CHAR; - break; - case IDENTIFIER: pt = MS_ENUM; - break; - default: ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Type of default value unknown." << endm; - YY_nb_error++; - break; + MS_ParamWithValue* pwv; + + switch (TheParamType) + { + case INTEGER: + break; + case REAL: + pt = MS_REAL; + break; + case STRING: + pt = MS_STRING; + break; + case LITERAL: + pt = MS_CHAR; + break; + case IDENTIFIER: + pt = MS_ENUM; + break; + default: + ErrorMsg() << "CDL" << "\"" << TheCDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Type of default value unknown." << endm; + YY_nb_error++; + break; } - - pwv = (MS_ParamWithValue *)aParam.operator->(); - pwv->Value(ParamValue(),pt); + + pwv = (MS_ParamWithValue*)aParam.operator->(); + pwv->Value(TheParamValue,pt); } - //Method()->Param(aParam); - if(MethodParams().IsNull()) MethodParams() = new MS_HSequenceOfParam; - MethodParams()->Append(aParam); + //TheMethod->Param(aParam); + if(TheMethodParams.IsNull()) TheMethodParams = new MS_HSequenceOfParam; + TheMethodParams->Append(aParam); } - ParamValue().Nullify(); - Mutable = 0; - InOrOut = MS_IN; - Like = Standard_False; + TheParamValue.Nullify(); + TheMutable = 0; + TheInOrOut = MS_IN; + TheIsLike = Standard_False; - ListOfName()->Clear(); + TheListOfName->Clear(); } -void Add_Value(char *str,int type) +void Add_Value(char* str,int type) { - ParamValue() = new TCollection_HAsciiString(str); - ParamType = type; + TheParamValue = new TCollection_HAsciiString(str); + TheParamType = type; } @@ -2908,111 +2862,115 @@ void End() void Set_In() { - InOrOut = MS_IN; + TheInOrOut = MS_IN; } void Set_Out() { - InOrOut = MS_OUT; + TheInOrOut = MS_OUT; } void Set_InOut() { - InOrOut = MS_INOUT; + TheInOrOut = MS_INOUT; } void Set_Mutable() { - Mutable = MS_MUTABLE; + TheMutable = MS_MUTABLE; } void Set_Mutable_Any() { - Mutable = MS_ANY; + TheMutable = MS_ANY; } void Set_Immutable() { - Mutable = MS_IMMUTABLE; + TheMutable = MS_IMMUTABLE; } void Set_Priv() { - Private = Standard_True; + TheIsPrivate = Standard_True; } void Set_Defe() { - Deferred = Standard_True; + TheIsDeferred = Standard_True; } void Set_Redefined() { - if (!Construc().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "A constructor cannot be redefined." << endm; + if (!TheConstruc.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "A constructor cannot be redefined." << endm; YY_nb_error++; } - if (!ClassMet().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "A class method cannot be redefined." << endm; + if (!TheClassMet.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "A class method cannot be redefined." << endm; YY_nb_error++; } - Redefined = Standard_True; - Static = Standard_False; + TheIsRedefined = Standard_True; + TheIsStatic = Standard_False; } void Set_Prot() { - Protected = Standard_True; - Private = Standard_False; + TheIsProtected = Standard_True; + TheIsPrivate = Standard_False; } void Set_Static() { - Static = Standard_True; + TheIsStatic = Standard_True; } void Set_Virtual() { - if (!ClassMet().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "A class method cannot be redefined, so the 'virtual' keyword cannot be applied to " << ClassMet()->Name() << endm; + if (!TheClassMet.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "A class method cannot be redefined, so the 'virtual' keyword cannot be applied to " << TheClassMet->Name() << endm; YY_nb_error++; } - if (!Construc().IsNull()) { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": " << "A constructor cannot be redefined, so the 'virtual' keyword cannot be applied to it." << endm; + if (!TheConstruc.IsNull()) + { + ErrorMsg() << "CDL\"" << TheCDLFileName->ToCString() << "\", line " << CDLlineno << ": " << "A constructor cannot be redefined, so the 'virtual' keyword cannot be applied to it." << endm; YY_nb_error++; } - Static = Standard_False; + TheIsStatic = Standard_False; } -void Set_Method(char *name) +void Set_Method(char* name) { - MethodName() = new TCollection_HAsciiString(name); + TheMethodName = new TCollection_HAsciiString(name); } void Set_Like_Me() { - Like = Standard_True; + TheIsLike = Standard_True; - strncpy(thetypename,SimpleClass()->Name()->ToCString(),MAX_CHAR); - strncpy(Pack_Name,Container()->ToCString(),MAX_CHAR); + strncpy(TheTypeName,TheSimpleClass->Name()->ToCString(),THE_MAX_CHAR); + strncpy(ThePackName,TheContainer->ToCString(),THE_MAX_CHAR); } void Set_Like_Type() { - ErrorMsg() << "CDL" << "\"" << CDLFileName()->ToCString() << "\"" << ", line " << CDLlineno << ": Obsolete syntaxe : like " << endm; + ErrorMsg() << "CDL" << "\"" << TheCDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": Obsolete syntaxe : like " << endm; YY_nb_error++; } -void Set_Item(char *Item) +void Set_Item(char* Item) { Handle(TCollection_HAsciiString) anItem = new TCollection_HAsciiString(Item); - ListOfItem()->Append(anItem); + TheListOfItem->Append(anItem); } void Set_Any() { - Any = Standard_True; + TheIsAny = Standard_True; } @@ -3023,20 +2981,21 @@ void CDL_Main() { YY_nb_error = 0; CDLparse(); -} +} extern "C" { -void CDLrestart(FILE*); + void CDLrestart(FILE*); } -int TraductionMain(char *FileName) +int TraductionMain(char* FileName) { CDLin = fopen(FileName,"r"); - if (CDLin == NULL) { + if (CDLin == NULL) + { CDL_InitVariable(); ErrorMsg() << "CDL" << " File not found : " << FileName << endm; MS_TraductionError::Raise("File not found."); @@ -3049,11 +3008,13 @@ int TraductionMain(char *FileName) fclose(CDLin); - if (YY_nb_error > 0) { + if (YY_nb_error > 0) + { ErrorMsg() << "CDL" << YY_nb_error << " errors." << endm; - } - - if (YY_nb_warning > 0) { + } + + if (YY_nb_warning > 0) + { WarningMsg() << "CDL" << YY_nb_warning << " warnings." << endm; } @@ -3062,47 +3023,48 @@ int TraductionMain(char *FileName) -int CDLTranslate(const Handle(MS_MetaSchema)& aMetaSchema, - const Handle(TCollection_HAsciiString)& aFileName, - const Handle(TColStd_HSequenceOfHAsciiString)& aGlobalList, - const Handle(TColStd_HSequenceOfHAsciiString)& aTypeList, - const Handle(TColStd_HSequenceOfHAsciiString)& anInstList, - const Handle(TColStd_HSequenceOfHAsciiString)& anGenList) +int CDLTranslate(const Handle(MS_MetaSchema)& aMetaSchema, + const Handle(TCollection_HAsciiString)& aFileName, + const Handle(TColStd_HSequenceOfHAsciiString)& aGlobalList, + const Handle(TColStd_HSequenceOfHAsciiString)& aTypeList, + const Handle(TColStd_HSequenceOfHAsciiString)& anInstList, + const Handle(TColStd_HSequenceOfHAsciiString)& anGenList) { volatile Standard_Integer ErrorLevel = 0; CDL_InitVariable(); - theMetaSchema() = aMetaSchema; - ListOfGlobalUsed() = aGlobalList; - ListOfTypeUsed() = aTypeList; - ListOfInst() = anInstList; - ListOfGen() = anGenList; + TheMetaSchema = aMetaSchema; + TheListOfGlobalUsed = aGlobalList; + TheListOfGlobalUsed = aTypeList; + TheListOfInst = anInstList; + TheListOfGen = anGenList; - if (!aFileName.IsNull()) { + if (!aFileName.IsNull()) + { CDLlineno = 1; - CDLFileName() = aFileName; + TheCDLFileName = aFileName; try { OCC_CATCH_SIGNALS - ErrorLevel = TraductionMain((char *)(aFileName->ToCString())); + ErrorLevel = TraductionMain((char*)(aFileName->ToCString())); } - catch(Standard_Failure) { + catch(Standard_Failure) + { fclose(CDLin); ErrorLevel = 1; } } - else { + else + { ErrorLevel = 1; } - theMetaSchema().Nullify(); - ListOfGlobalUsed().Nullify(); - ListOfTypeUsed().Nullify(); - ListOfInst().Nullify(); - ListOfGen().Nullify(); - ListOfComments().Nullify(); + TheMetaSchema.Nullify(); + TheListOfGlobalUsed.Nullify(); + TheListOfGlobalUsed.Nullify(); + TheListOfInst.Nullify(); + TheListOfGen.Nullify(); + TheListOfComments.Nullify(); return ErrorLevel; } - - diff --git a/src/CPPExt/CPPExt_Standard.edl b/src/CPPExt/CPPExt_Standard.edl index 4c837fc..e1e90e2 100755 --- a/src/CPPExt/CPPExt_Standard.edl +++ b/src/CPPExt/CPPExt_Standard.edl @@ -17,14 +17,6 @@ $#ifndef _Standard_Transient_proto_HeaderFile $#include $#endif $ -$#ifndef UndefinedHandleAddress -$#ifdef DECOSF1 -$#define UndefinedHandleAddress ((Standard_Transient *)0xfefdfefdfefd0000) -$#else -$#define UndefinedHandleAddress ((Standard_Transient *)0xfefd0000) -$#endif -$#endif -$ $class Standard_Transient; $class Handle_Standard_Type; $ @@ -40,17 +32,17 @@ $ void RaiseNullObject(const Standard_CString S) const; $ $ void BeginScope() const $ { -$ if (entity != UndefinedHandleAddress) entity->count++; +$ if (entity != 0) entity->count++; $ } $ $ void EndScope() $ { -$ if (entity != UndefinedHandleAddress) +$ if (entity != 0) $ { $ entity->count--; $ if (entity->count == 0) { $ entity->Delete(); -$ entity = UndefinedHandleAddress ; +$ entity = 0; $ } $ } $ } @@ -60,7 +52,7 @@ $ public: $ $ Handle(Standard_Transient)() $ { -$ entity = UndefinedHandleAddress ; +$ entity = 0; $ } $ $ Handle(Standard_Transient)(const Handle(Standard_Transient)& aTid) @@ -72,7 +64,7 @@ $ $ Handle(Standard_Transient)(const Standard_Transient *anItem) $ { $ if (!anItem) -$ entity = UndefinedHandleAddress ; +$ entity = 0; $ else $ entity = (Standard_Transient *)anItem; $ BeginScope(); @@ -115,12 +107,12 @@ $ $ void Nullify() $ { $ EndScope(); -$ entity = UndefinedHandleAddress ; +$ entity = 0; $ } $ $ Standard_Boolean IsNull() const $ { -$ return entity == UndefinedHandleAddress ; +$ return entity == 0; $ } $ $ protected: @@ -139,7 +131,7 @@ $ void Assign(const Standard_Transient *anItem) $ { $ EndScope(); $ if (!anItem) -$ entity = UndefinedHandleAddress ; +$ entity = 0; $ else $ entity = (Standard_Transient *)anItem; $ entity = (Standard_Transient *)anItem; diff --git a/src/WOKNT/WOKNT_MixedOutput.cdl b/src/WOKNT/WOKNT_MixedOutput.cdl index 18d5660..75e7962 100755 --- a/src/WOKNT/WOKNT_MixedOutput.cdl +++ b/src/WOKNT/WOKNT_MixedOutput.cdl @@ -22,7 +22,7 @@ private class MixedOutput from WOKNT inherits ShellOutput from WOKNT ---Purpose: dummy method to be used in derived class ---C++: alias ~ - OpenStdOut ( me : out ) returns Integer from Standard is redefined static; + OpenStdOut ( me : out ) returns Address from Standard is redefined static; ---Purpose: creates a pipe for reading a standard output of sub-process -- and returns a pipe handle. -- Warning: returns INVALID_HANDLE_VALUE in case of failure @@ -30,7 +30,7 @@ private class MixedOutput from WOKNT inherits ShellOutput from WOKNT CloseStdOut ( me : out ) is redefined static; ---Purpose: closes write end of the 'STDOUT' pipe - OpenStdErr ( me : out ) returns Integer from Standard is virtual; + OpenStdErr ( me : out ) returns Address from Standard is virtual; ---Purpose: creates a pipe for reading a standard error output of sub-process -- and returns a pipe handle -- Warning: this method is simply calling 'OpenStdOut' method @@ -63,7 +63,7 @@ private class MixedOutput from WOKNT inherits ShellOutput from WOKNT fields - myOutHandle : Integer from Standard is protected; + myOutHandle : Address from Standard is protected; myStdOut : HSequenceOfHAsciiString from TColStd is protected; end MixedOutput; diff --git a/src/WOKNT/WOKNT_MixedOutput.cxx b/src/WOKNT/WOKNT_MixedOutput.cxx index 806aec2..63743e7 100755 --- a/src/WOKNT/WOKNT_MixedOutput.cxx +++ b/src/WOKNT/WOKNT_MixedOutput.cxx @@ -13,13 +13,13 @@ void __fastcall _WOKNT_clear_pipe ( HANDLE ); DWORD __fastcall _WOKNT_nb_to_read ( HANDLE ); Handle( TColStd_HSequenceOfHAsciiString ) __fastcall _WOKNT_read_pipe ( OSD_File*, HANDLE ); -void __fastcall _WOKNT_create_pipe ( - Standard_Integer*, Standard_Integer* - ); +void __fastcall _WOKNT_create_pipe (Standard_Address* , Standard_Address* ); -WOKNT_MixedOutput :: WOKNT_MixedOutput () { - -} // end constructor +WOKNT_MixedOutput::WOKNT_MixedOutput() +: myOutHandle (INVALID_HANDLE_VALUE) +{ + // +} void WOKNT_MixedOutput :: Cleanup () { @@ -28,32 +28,26 @@ void WOKNT_MixedOutput :: Cleanup () { } // end WOKNT_MixedOutput :: Cleanup -Standard_Integer WOKNT_MixedOutput :: OpenStdOut () { - - _WOKNT_create_pipe ( &myFileChannel, &myOutHandle ); - myIO |= ( FLAG_PIPE | FLAG_READ_PIPE ); - - return myOutHandle; - -} // end WOKNT_MixedOutput :: OpenStdOut - -void WOKNT_MixedOutput :: CloseStdOut () { - - if ( ( HANDLE )myOutHandle != INVALID_HANDLE_VALUE ) { - - CloseHandle ( ( HANDLE )myOutHandle ); - myOutHandle = ( Standard_Integer )INVALID_HANDLE_VALUE; - - } // end if - -} // end WOKNT_MixedOutput :: CloseStdOut - -Standard_Integer WOKNT_MixedOutput :: OpenStdErr () { - - return ( ( HANDLE )myOutHandle == INVALID_HANDLE_VALUE ) ? - OpenStdOut () : myOutHandle; - -} // end WOKNT_MixedOutput :: OpenStdErr +Standard_Address WOKNT_MixedOutput::OpenStdOut() +{ + _WOKNT_create_pipe (&myFileHandle, &myOutHandle); + myIO |= (FLAG_PIPE | FLAG_READ_PIPE); + return myOutHandle; +} + +void WOKNT_MixedOutput::CloseStdOut() +{ + if ((HANDLE )myOutHandle != INVALID_HANDLE_VALUE) + { + CloseHandle ((HANDLE )myOutHandle); + myOutHandle = INVALID_HANDLE_VALUE; + } +} + +Standard_Address WOKNT_MixedOutput::OpenStdErr() +{ + return ((HANDLE )myOutHandle == INVALID_HANDLE_VALUE) ? OpenStdOut() : myOutHandle; +} void WOKNT_MixedOutput :: CloseStdErr () { @@ -61,17 +55,15 @@ void WOKNT_MixedOutput :: CloseStdErr () { } // end WOKNT_MixedOutput :: CloseStdErr -void WOKNT_MixedOutput :: Clear () { - - _WOKNT_clear_pipe ( ( HANDLE )myFileChannel ); +void WOKNT_MixedOutput::Clear() +{ + _WOKNT_clear_pipe ((HANDLE )myFileHandle); +} -} // end WOKNT_MixedOutput :: Clear - -Handle( TColStd_HSequenceOfHAsciiString ) WOKNT_MixedOutput :: Echo () { - - return _WOKNT_read_pipe ( this, ( HANDLE )myFileChannel ); - -} // end WOKNT_MixedOutput :: Echo +Handle(TColStd_HSequenceOfHAsciiString) WOKNT_MixedOutput::Echo() +{ + return _WOKNT_read_pipe (this, (HANDLE )myFileHandle); +} Handle( TColStd_HSequenceOfHAsciiString ) WOKNT_MixedOutput :: Errors () { @@ -84,9 +76,11 @@ Handle( TColStd_HSequenceOfHAsciiString ) WOKNT_MixedOutput :: SyncStdOut () { DWORD dummy; Handle( TColStd_HSequenceOfHAsciiString ) retVal; - if ( ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE ) { + if ((HANDLE )myFileHandle != INVALID_HANDLE_VALUE) + { - while ( ReadFile ( ( HANDLE )myFileChannel, NULL, 0, ( LPDWORD )&dummy, NULL ) ) { + while (ReadFile ((HANDLE )myFileHandle, NULL, 0, (LPDWORD )&dummy, NULL)) + { if ( retVal.IsNull () ) @@ -171,23 +165,21 @@ Handle( TColStd_HSequenceOfHAsciiString ) __fastcall _WOKNT_read_pipe ( } // end _WOKNT_read_pipe -void __fastcall _WOKNT_create_pipe ( - Standard_Integer* readPipe, Standard_Integer* writePipe - ) { - - SECURITY_ATTRIBUTES sa; - - sa.nLength = sizeof ( SECURITY_DESCRIPTOR ); // structure size - sa.lpSecurityDescriptor = NULL; // default protection - sa.bInheritHandle = TRUE; // inheritable handle - - if ( !CreatePipe ( - ( PHANDLE )readPipe, // read end of the pipe - ( PHANDLE )writePipe, // write end of the pipe - &sa, // protection/inheritance - 4096 // buffer size - ) - ) *writePipe = ( Standard_Integer )INVALID_HANDLE_VALUE; - -} // end _WOKNT_create_pipe +void __fastcall _WOKNT_create_pipe (Standard_Address* readPipe, + Standard_Address* writePipe) +{ + SECURITY_ATTRIBUTES sa; + sa.nLength = sizeof(SECURITY_DESCRIPTOR); // structure size + sa.lpSecurityDescriptor = NULL; // default protection + sa.bInheritHandle = TRUE; // inheritable handle + + if (!CreatePipe ((PHANDLE )readPipe, // read end of the pipe + (PHANDLE )writePipe, // write end of the pipe + &sa, // protection/inheritance + 4096)) // buffer size + { + *writePipe = INVALID_HANDLE_VALUE; + } +} + #endif diff --git a/src/WOKNT/WOKNT_OutErrOutput.cdl b/src/WOKNT/WOKNT_OutErrOutput.cdl index 3ac8983..d3638ce 100755 --- a/src/WOKNT/WOKNT_OutErrOutput.cdl +++ b/src/WOKNT/WOKNT_OutErrOutput.cdl @@ -22,7 +22,7 @@ private class OutErrOutput from WOKNT inherits MixedOutput from WOKNT ---Purpose: closes read end of the 'STDERR' handle ---C++: alias ~ - OpenStdErr ( me : out ) returns Integer from Standard is redefined static; + OpenStdErr ( me : out ) returns Address from Standard is redefined static; ---Purpose: creates a pipe for reading a standard error output of sub-process -- and returns a pipe handle -- Warning: returns INVALID_HANDLE_VALUE in case of failure @@ -46,8 +46,8 @@ private class OutErrOutput from WOKNT inherits MixedOutput from WOKNT fields - myErrHandleR : Integer from Standard; - myErrHandleW : Integer from Standard; + myErrHandleR : Address from Standard; + myErrHandleW : Address from Standard; myStdErr : HSequenceOfHAsciiString from TColStd; end OutErrOutput; diff --git a/src/WOKNT/WOKNT_OutErrOutput.cxx b/src/WOKNT/WOKNT_OutErrOutput.cxx index f862bb2..b165b52 100755 --- a/src/WOKNT/WOKNT_OutErrOutput.cxx +++ b/src/WOKNT/WOKNT_OutErrOutput.cxx @@ -10,13 +10,14 @@ void __fastcall _WOKNT_clear_pipe ( HANDLE ); DWORD __fastcall _WOKNT_nb_to_read ( HANDLE ); Handle( TColStd_HSequenceOfHAsciiString ) __fastcall _WOKNT_read_pipe ( OSD_File*, HANDLE ); -void __fastcall _WOKNT_create_pipe ( - Standard_Integer*, Standard_Integer* - ); +void __fastcall _WOKNT_create_pipe (Standard_Address* , Standard_Address* ); -WOKNT_OutErrOutput :: WOKNT_OutErrOutput () { - -} // end constructor +WOKNT_OutErrOutput::WOKNT_OutErrOutput() +: myErrHandleR (INVALID_HANDLE_VALUE), + myErrHandleW (INVALID_HANDLE_VALUE) +{ + // +} void WOKNT_OutErrOutput :: Cleanup () { @@ -26,7 +27,7 @@ void WOKNT_OutErrOutput :: Cleanup () { if ( ( HANDLE )myErrHandleR != INVALID_HANDLE_VALUE ) { CloseHandle ( ( HANDLE )myErrHandleR ); - myErrHandleR = ( Standard_Integer )INVALID_HANDLE_VALUE; + myErrHandleR = INVALID_HANDLE_VALUE; } // end if @@ -34,21 +35,19 @@ void WOKNT_OutErrOutput :: Cleanup () { } // end WOKNT_OutErrOutput :: Cleanup -Standard_Integer WOKNT_OutErrOutput :: OpenStdErr () { - - _WOKNT_create_pipe ( &myErrHandleR, &myErrHandleW ); - myIO |= ( FLAG_PIPE | FLAG_READ_PIPE ); - - return myErrHandleW; - -} // end WOKNT_OutErrOutput :: OpenStdErr +Standard_Address WOKNT_OutErrOutput::OpenStdErr() +{ + _WOKNT_create_pipe (&myErrHandleR, &myErrHandleW); + myIO |= (FLAG_PIPE | FLAG_READ_PIPE); + return myErrHandleW; +} void WOKNT_OutErrOutput :: CloseStdErr () { if ( ( HANDLE )myErrHandleW != INVALID_HANDLE_VALUE ) { CloseHandle ( ( HANDLE )myErrHandleW ); - myErrHandleW = ( Standard_Integer )INVALID_HANDLE_VALUE; + myErrHandleW = INVALID_HANDLE_VALUE; } // end if @@ -62,21 +61,16 @@ void WOKNT_OutErrOutput :: Clear () { } // end WOKNT_OutErrOutput :: Clear -Handle( TColStd_HSequenceOfHAsciiString ) WOKNT_OutErrOutput :: Errors () { - - Handle( TColStd_HSequenceOfHAsciiString ) retVal; - Standard_Integer handle; - - handle = myFileChannel; - myFileChannel = myErrHandleR; - - retVal = _WOKNT_read_pipe ( this, ( HANDLE )myFileChannel ); +Handle(TColStd_HSequenceOfHAsciiString) WOKNT_OutErrOutput::Errors() +{ + const Standard_Address aHandle = myFileHandle; + myFileHandle = myErrHandleR; - myFileChannel = handle; - - return retVal; + Handle(TColStd_HSequenceOfHAsciiString) retVal = _WOKNT_read_pipe (this, (HANDLE )myFileHandle); -} // end WOKNT_OutErrOutput :: Errors + myFileHandle = aHandle; + return retVal; +} Handle( TColStd_HSequenceOfHAsciiString ) WOKNT_OutErrOutput :: SyncStdErr () { diff --git a/src/WOKNT/WOKNT_ShellOutput.cdl b/src/WOKNT/WOKNT_ShellOutput.cdl index c385792..38bd77e 100755 --- a/src/WOKNT/WOKNT_ShellOutput.cdl +++ b/src/WOKNT/WOKNT_ShellOutput.cdl @@ -30,7 +30,7 @@ private deferred class ShellOutput from WOKNT inherits File from OSD Errors ( me : out ) returns HSequenceOfHAsciiString from TColStd is deferred; ---Purpose: returns standard error output of sub-process - OpenStdOut ( me : out ) returns Integer from Standard is deferred; + OpenStdOut ( me : out ) returns Address from Standard is deferred; ---Purpose: creates an I/O object for reading a standard output of sub-process -- and returns this object handle. -- Warning: returns INVALID_HANDLE_VALUE in case of failure @@ -38,7 +38,7 @@ private deferred class ShellOutput from WOKNT inherits File from OSD CloseStdOut ( me : out ) is deferred; ---Purpose: closes an I/O object's handle opened by 'OpenStdOut' method - OpenStdErr ( me : out ) returns Integer from Standard is deferred; + OpenStdErr ( me : out ) returns Address from Standard is deferred; ---Purpose: creates an I/O object for reading a standard error output of sub-process -- and returns this object handle -- Warning: returns INVALID_HANDLE_VALUE in case of failure diff --git a/src/WOKNT/WOKNT_ShellOutput.cxx b/src/WOKNT/WOKNT_ShellOutput.cxx index cb5e596..ef990b0 100755 --- a/src/WOKNT/WOKNT_ShellOutput.cxx +++ b/src/WOKNT/WOKNT_ShellOutput.cxx @@ -10,7 +10,7 @@ WOKNT_ShellOutput :: WOKNT_ShellOutput () { void WOKNT_ShellOutput :: Cleanup () { - if ( ( HANDLE )myFileChannel != INVALID_HANDLE_VALUE ) Close (); + if ( ( HANDLE )myFileHandle != INVALID_HANDLE_VALUE ) Close (); } // end WOKNT_ShellOutput :: Cleanup #endif -- 2.39.5