]> OCCT Git - occt-wok.git/commitdiff
Initial revision
authorcas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
committercas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
76 files changed:
src/MS/FILES [new file with mode: 0755]
src/MS/MS.cdl [new file with mode: 0755]
src/MS/MS.cxx [new file with mode: 0755]
src/MS/MS_AccessMode.hxx [new file with mode: 0755]
src/MS/MS_Alias.cdl [new file with mode: 0755]
src/MS/MS_Alias.cxx [new file with mode: 0755]
src/MS/MS_Class.cdl [new file with mode: 0755]
src/MS/MS_Class.cxx [new file with mode: 0755]
src/MS/MS_ClassMet.cdl [new file with mode: 0755]
src/MS/MS_ClassMet.cxx [new file with mode: 0755]
src/MS/MS_Client.cdl [new file with mode: 0755]
src/MS/MS_Client.cxx [new file with mode: 0755]
src/MS/MS_Common.cdl [new file with mode: 0755]
src/MS/MS_Common.cxx [new file with mode: 0755]
src/MS/MS_Component.cdl [new file with mode: 0755]
src/MS/MS_Component.cxx [new file with mode: 0755]
src/MS/MS_Construc.cdl [new file with mode: 0755]
src/MS/MS_Construc.cxx [new file with mode: 0755]
src/MS/MS_Defines.hxx [new file with mode: 0755]
src/MS/MS_Engine.cdl [new file with mode: 0755]
src/MS/MS_Engine.cxx [new file with mode: 0755]
src/MS/MS_Enum.cdl [new file with mode: 0755]
src/MS/MS_Enum.cxx [new file with mode: 0755]
src/MS/MS_Error.cdl [new file with mode: 0755]
src/MS/MS_Error.cxx [new file with mode: 0755]
src/MS/MS_Errors.hxx [new file with mode: 0755]
src/MS/MS_Exec.cdl [new file with mode: 0755]
src/MS/MS_Exec.cxx [new file with mode: 0755]
src/MS/MS_ExecFile.cdl [new file with mode: 0755]
src/MS/MS_ExecFile.cxx [new file with mode: 0755]
src/MS/MS_ExecPart.cdl [new file with mode: 0755]
src/MS/MS_ExecPart.cxx [new file with mode: 0755]
src/MS/MS_Executable.cdl [new file with mode: 0755]
src/MS/MS_Executable.cxx [new file with mode: 0755]
src/MS/MS_ExternMet.cdl [new file with mode: 0755]
src/MS/MS_ExternMet.cxx [new file with mode: 0755]
src/MS/MS_Field.cdl [new file with mode: 0755]
src/MS/MS_Field.cxx [new file with mode: 0755]
src/MS/MS_GenClass.cdl [new file with mode: 0755]
src/MS/MS_GenClass.cxx [new file with mode: 0755]
src/MS/MS_GenType.cdl [new file with mode: 0755]
src/MS/MS_GenType.cxx [new file with mode: 0755]
src/MS/MS_GlobalEntity.cdl [new file with mode: 0755]
src/MS/MS_GlobalEntity.cxx [new file with mode: 0755]
src/MS/MS_Imported.cdl [new file with mode: 0755]
src/MS/MS_Imported.cxx [new file with mode: 0755]
src/MS/MS_InstClass.cdl [new file with mode: 0755]
src/MS/MS_InstClass.cxx [new file with mode: 0755]
src/MS/MS_InstMet.cdl [new file with mode: 0755]
src/MS/MS_InstMet.cxx [new file with mode: 0755]
src/MS/MS_Interface.cdl [new file with mode: 0755]
src/MS/MS_Interface.cxx [new file with mode: 0755]
src/MS/MS_MemberMet.cdl [new file with mode: 0755]
src/MS/MS_MemberMet.cxx [new file with mode: 0755]
src/MS/MS_MetaSchema.cdl [new file with mode: 0755]
src/MS/MS_MetaSchema.cxx [new file with mode: 0755]
src/MS/MS_Method.cdl [new file with mode: 0755]
src/MS/MS_Method.cxx [new file with mode: 0755]
src/MS/MS_NatType.cdl [new file with mode: 0755]
src/MS/MS_NatType.cxx [new file with mode: 0755]
src/MS/MS_Package.cdl [new file with mode: 0755]
src/MS/MS_Package.cxx [new file with mode: 0755]
src/MS/MS_Param.cdl [new file with mode: 0755]
src/MS/MS_Param.cxx [new file with mode: 0755]
src/MS/MS_ParamWithValue.cdl [new file with mode: 0755]
src/MS/MS_ParamWithValue.cxx [new file with mode: 0755]
src/MS/MS_Pointer.cdl [new file with mode: 0755]
src/MS/MS_Pointer.cxx [new file with mode: 0755]
src/MS/MS_PrimType.cdl [new file with mode: 0755]
src/MS/MS_PrimType.cxx [new file with mode: 0755]
src/MS/MS_Schema.cdl [new file with mode: 0755]
src/MS/MS_Schema.cxx [new file with mode: 0755]
src/MS/MS_StdClass.cdl [new file with mode: 0755]
src/MS/MS_StdClass.cxx [new file with mode: 0755]
src/MS/MS_Type.cdl [new file with mode: 0755]
src/MS/MS_Type.cxx [new file with mode: 0755]

diff --git a/src/MS/FILES b/src/MS/FILES
new file mode 100755 (executable)
index 0000000..4753308
--- /dev/null
@@ -0,0 +1,4 @@
+MS_Errors.hxx
+MS_Defines.hxx
+MS_AccessMode.hxx
+
diff --git a/src/MS/MS.cdl b/src/MS/MS.cdl
new file mode 100755 (executable)
index 0000000..6d957d1
--- /dev/null
@@ -0,0 +1,613 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS.cdl 1.1
+-- File:       MS.cdl
+-- Created:    Thu Jan 24 14:44:08 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+package MS 
+
+       ---Purpose: Meta Schema Package for MDTV Dev. Tools.
+       --          
+
+uses MMgt,
+     TCollection,
+     TColStd,
+     WOKTools
+    
+is
+
+    -- ============================================================
+    -- ======== The translater implementation =====================
+    -- =======
+    -- =======      class MetaSchema;
+    -- =======      class ExecFile;
+    -- =======      deferred class Common;
+    -- =======          class Field;
+    -- =======          class Param;
+    -- =======              class ParamWithValue;
+    -- =======          deferred class GlobalEntity
+    -- =======             class Schema;
+    -- =======             class Interface;
+    -- =======             class Package;
+    -- =======             deferred class Exec;
+    -- =======                 class Engine;
+    -- =======                 class Component;
+    -- =======                 class Executable;
+    -- =======                  class ExecPart;
+    -- =======          deferred class Method;
+    -- =======             class ExternMet;
+    -- =======             deferred class MemberMet;
+    -- =======                 class Construc;
+    -- =======                 class ClassMet;
+    -- =======                 class InstMet;
+    -- =======         deferred class Type;
+    -- =======             class GenType;
+    -- =======             deferred class NatType;
+    -- =======                 class Alias;
+    -- =======                 class Pointer;
+    -- =======                 class Enum;
+    -- =======                 class Imported;
+    -- =======                 class PrimType;
+    -- =======             deferred class Class;
+    -- =======                 class GenClass;
+    -- =======                 class InstClass;
+    -- =======                 class StdClass;
+    -- =======                     class Error;
+    -- =======
+    -- =======      enumeration Mutable is MUtable, Immutable, Any;
+    -- ============================================================
+
+
+    exception TraductionError inherits Failure from Standard;
+
+    class ExecFile;
+         
+    class MetaSchema;
+          -- This class provides the methods and the informations for managing
+          -- the packages, and the types used by MS.
+          --     a) All The packages used by MS.
+          --          1) A package can be created when analyzing a "cdl" text.
+          --     b) All the types used by MS.
+          --          1) A type can be created when analyzing a "cdl" text.
+
+    deferred class Common;
+            -- The root of the other class of this package.
+            --    It contains the "common" information:
+            --       a) The Name of Object.
+            --       b) If it has been loaded.
+            --       d) The comment associated to the object.
+
+        class Field;
+              -- The informations for a field.
+              --     a) Its Class.
+              --     b) The Type of field.
+              --     c) Its Dimensions.
+              --     d) If it is protected.
+
+        class Param;
+              -- The informations for a method parameter.
+              --     a) Its Method.
+              --     b) If it is a 'In' parameter.
+              --     c) If it is a 'Out' parameter.
+              --     d) If it has a Mutable attribut
+              --     e) If it is mutable or immutable or any.
+              --     f) If it is like anothe parameter.
+              --     g) If it is like, then the like parameter.
+              --     h) If it is not like, then the Type of parameter.
+              --     i) The default value.
+
+       class ParamWithValue;
+             -- Like Param with a default value
+       
+       deferred class GlobalEntity;
+             -- The abstract class, root of Package, Interface, Schema,
+             -- Engine and Executable.
+
+       deferred class Exec;
+             -- The abstract class, root of Engine and Executable.
+
+       class Schema;
+             -- The informations about a Schema.
+             --    a) The used package.
+
+       class Executable;
+             -- The informations about an executable.
+             --    a) The used Schema..
+             --    b) The used packages.
+
+       class ExecPart;
+       
+       class Engine;
+             -- The informations about an engine.
+             --    a) The used Schema..
+              --    b) The used engine.
+              --    c) The used Interfaces.
+
+       class Component;
+
+
+       class Interface;
+             -- The informations about an interface.
+             --    a) The used packages.
+              --    b) The elements of Interface.
+             --        The Packages.
+             --        The Classes.
+             --        The Methods.
+
+
+       class Client;
+             -- The informations about a C++ client.
+              --    a) The interfaces used.
+              --    b) The methods with asynchronous execution.
+
+       class Package;
+             -- The informations a bout a package.
+             --    a) The used package.
+              --    b) The elements of package.
+             --        The Classes.
+             --        The Enumerations.
+             --        The Exceptions.
+             --        The Extern Methods.
+
+        deferred class Method;
+                 -- The Informations for a method.
+                 --     a) The Parameters.
+                 --     b) The Returned type.  
+                 --     c) The Raises.
+                 --     d) The post conditions.
+                 --     e) If it is private.
+
+          class ExternMet;
+                 -- The informations for a package method.
+                 --     a) Its Package.
+
+          deferred class MemberMet;
+                   -- The informations for the class methods.
+                   --     a) The Class of method.
+                   --     b) If it is protected.
+               class Construc;
+                      -- The Constructor.
+               class ClassMet;
+                      -- The class method.
+               class InstMet;
+                      -- The information for a instance
+                      -- method.
+                      --     a) The Instance parameter.
+                      --     b) If it is static.
+                      --     c) If it is deferred.
+                      --     d) If it is redefined.
+
+       deferred class Type;
+                        -- The informations for a Type.
+                        --   a) Its Package.
+
+           class GenType;
+                 -- The informations for a generic type.
+                 --     a) Its generic class.
+                 --     b) If It can be any type.
+                 --     c) Its type. (If any is true, the type is Null.)
+                            
+                   
+           deferred class NatType;
+                    -- The informations for a natural type.
+                    --       a)If it is private.
+                class Alias;
+                      -- The informations for an 
+                      -- alias
+                      --      a) Its type
+                class Pointer;
+                      -- The informations for a 
+                      -- pointer
+                      --      a) Its type
+                class Enum;
+                      -- The informations for a 
+                      -- enumeration
+                      --      a) Its elements.
+                class Imported;
+                      -- The informations for an 
+                      -- imported type
+                class PrimType;
+                      -- A Primary Type.
+
+           deferred class Class;
+                    -- The informations for a Class.
+                    --     a) If it is complete or just declared.
+                    --     b) If it is deferred.
+                    --     c) If it is private.
+
+                class GenClass;
+                      -- The informations for a Generic class
+                      --   a) The generique types.
+                      --   b) The Nesting classes.
+                      --   c) The Descreption class.
+                      --   d) if it has a Mother (a Nesting Class).
+
+                class InstClass;
+                      -- The informations for a Instanciated class
+                      --    a) Its generic class.
+                      --    b) The Instanciated types.
+                      --    c) Its Nesting class.
+                      --    d) The generic class associated, if there is any.
+                                             
+                class StdClass;
+                      -- The informations for a Standard class:
+                      --    a) The Ancestors
+                      --    b) The Used types.
+                      --    c) The Raises.
+                      --    d) The Verifies.
+                      --    e) The Methods.
+                      --    f) The Fields.
+                      --    g) The Redefined fields.
+                      --    h) The Friend methods.
+                      --    i) The Friend class.
+                      --    j) The generic class associated, if there is any.
+
+                    class Error;
+                          -- The information for a Exception.
+                          --     a) The Ancestors.
+
+
+    
+    -- ============================================================
+    -- ============ The enumerations ==============================
+    -- ============================================================
+
+
+    enumeration Language is
+       FORTRAN,
+       CPP,
+       C,
+       OBJECT
+    end Language;
+    
+    -- type of default value of a parameter
+    -- 
+    enumeration TypeOfValue is
+       NONE,
+       REAL,
+       INTEGER,
+       STRING,
+       CHAR,
+       ENUM
+    end TypeOfValue;
+    
+    -- ============================================================
+    -- ============ The sequences for management ==========
+    -- ============================================================
+
+    class MapOfType instantiates DataMap from WOKTools(HAsciiString from TCollection, 
+                                                         Type from MS, 
+                                                         HAsciiStringHasher from WOKTools);
+
+    class MapOfGlobalEntity instantiates DataMap from WOKTools(HAsciiString from TCollection, 
+                                                         GlobalEntity from MS, 
+                                                         HAsciiStringHasher from WOKTools);
+                                                         
+    class MapOfMethod instantiates DataMap from WOKTools(HAsciiString from TCollection, 
+                                                           Method from MS, 
+                                                           HAsciiStringHasher from WOKTools);                                                                                                   
+
+    class SequenceOfType instantiates 
+           Sequence  from TCollection(Type from MS);
+
+    class SequenceOfGenType instantiates 
+           Sequence  from TCollection(GenType from MS);
+
+    class SequenceOfExternMet instantiates 
+           Sequence  from TCollection(ExternMet from MS);
+
+    class SequenceOfMethod instantiates
+           Sequence from TCollection (Method from MS);
+
+    class SequenceOfMemberMet instantiates
+           Sequence  from TCollection(MemberMet from MS);
+
+    class SequenceOfField instantiates
+           Sequence  from TCollection(Field from MS);
+
+    class SequenceOfParam instantiates
+           Sequence  from TCollection(Param from MS);
+
+    class Array1OfParam instantiates
+           Array1    from TCollection(Param from MS);
+
+    class SequenceOfClass instantiates
+           Sequence  from TCollection(Class from MS);
+
+    class SequenceOfError instantiates
+           Sequence  from TCollection(Error from MS);
+
+    class SequenceOfPackage instantiates
+           Sequence  from TCollection(Package from MS);
+           
+    class SequenceOfInstClass instantiates
+           Sequence  from TCollection(InstClass from MS);
+
+    class SequenceOfGenClass instantiates
+           Sequence  from TCollection(GenClass from MS);
+
+    class SequenceOfGlobalEntity instantiates
+           Sequence  from TCollection(GlobalEntity from MS);
+
+    class SequenceOfInterface instantiates
+           Sequence  from TCollection(Interface from MS);
+
+    class SequenceOfSchema instantiates
+           Sequence  from TCollection(Schema from MS);
+
+    class SequenceOfEngine instantiates
+           Sequence  from TCollection(Engine from MS);
+
+    class SequenceOfComponent instantiates
+           Sequence  from TCollection(Component from MS);
+
+    class SequenceOfExecutable instantiates
+           Sequence  from TCollection(Executable from MS);
+
+           
+    class HSequenceOfType instantiates 
+           HSequence  from TCollection(Type from MS, SequenceOfType);
+
+    class HSequenceOfGenType instantiates 
+           HSequence  from TCollection(GenType from MS, SequenceOfGenType);
+
+    class HSequenceOfExternMet instantiates 
+           HSequence  from TCollection(ExternMet from MS, SequenceOfExternMet);
+
+    class HSequenceOfMethod instantiates
+           HSequence  from TCollection(Method from MS, SequenceOfMethod);
+
+    class HSequenceOfMemberMet instantiates
+           HSequence  from TCollection(MemberMet from MS, SequenceOfMemberMet);
+
+    class HSequenceOfField instantiates
+           HSequence  from TCollection(Field from MS, SequenceOfField);
+
+    class HSequenceOfParam instantiates
+           HSequence  from TCollection(Param from MS, SequenceOfParam);
+
+    class HArray1OfParam instantiates
+           HArray1 from TCollection  (  Param from MS, Array1OfParam from MS );
+
+    class HSequenceOfClass instantiates
+           HSequence  from TCollection(Class from MS, SequenceOfClass);
+
+    class HSequenceOfError instantiates
+           HSequence  from TCollection(Error from MS, SequenceOfError);
+
+    class HSequenceOfPackage instantiates
+           HSequence  from TCollection(Package from MS, SequenceOfPackage);
+
+    class HSequenceOfInstClass instantiates
+           HSequence  from TCollection(InstClass from MS, SequenceOfInstClass);
+
+    class HSequenceOfGenClass instantiates
+           HSequence  from TCollection(GenClass from MS, SequenceOfGenClass);
+
+
+    class HSequenceOfGlobalEntity instantiates
+           HSequence  from TCollection(GlobalEntity from MS, SequenceOfGlobalEntity);
+
+    class HSequenceOfInterface instantiates
+           HSequence  from TCollection(Interface from MS, SequenceOfInterface);
+
+    class HSequenceOfSchema instantiates
+           HSequence  from TCollection(Schema from MS, SequenceOfSchema);
+
+    class HSequenceOfEngine instantiates
+           HSequence  from TCollection(Engine from MS, SequenceOfEngine);
+
+    class HSequenceOfComponent instantiates
+           HSequence  from TCollection(Component from MS, SequenceOfComponent);
+
+    class HSequenceOfExecutable instantiates
+           HSequence  from TCollection(Executable from MS, SequenceOfExecutable);
+
+
+    -- For executable description
+    --  
+    class SequenceOfExecFile instantiates
+           Sequence  from TCollection(ExecFile from MS);           
+    class HSequenceOfExecFile instantiates 
+           HSequence  from TCollection(ExecFile from MS, SequenceOfExecFile from MS);
+
+    class SequenceOfExecPart instantiates
+           Sequence  from TCollection(ExecPart from MS);           
+    class HSequenceOfExecPart instantiates 
+           HSequence  from TCollection(ExecPart from MS, SequenceOfExecPart from MS);
+
+    pointer MetaSchemaPtr to MetaSchema from MS;
+    pointer MethodPtr     to Method     from MS;
+    ---Purpose: define a pointer for a MetaSchema (usefull for memory management).
+
+    -- ----------------------
+    -- Methods for everybody
+    -- ----------------------
+
+    GetPersistentRootName 
+       returns HAsciiString from TCollection;
+
+    GetStorableRootName 
+       returns HAsciiString from TCollection;
+       
+    GetTransientRootName 
+       returns HAsciiString from TCollection;
+       
+    GetPackageRootName 
+       returns HAsciiString from TCollection;
+
+    GetVArrayRootName
+       returns HAsciiString from TCollection;
+    ---Purpose: Warning this method is obsolete
+    ---Level: Internal
+               
+    BuildFullName(aGEName : HAsciiString from TCollection;
+                 aEName  : HAsciiString from TCollection)
+       returns mutable HAsciiString from TCollection;
+    ---Purpose: build a full name from a global entity name and an entity name 
+
+    BuildComplexName(MyName  : HAsciiString from TCollection;
+                    aEName : HAsciiString from TCollection;
+                    aGEName  : HAsciiString from TCollection)
+       returns mutable HAsciiString from TCollection;
+    ---Purpose: build a complex name for nested classes
+    --          <MyName> : the name of the containing class
+    --          <aEName> : the name of the nested class
+    --          <aGEName> : the name of the generic class
+
+    
+    GetEntityNameFromMethodName(methodName : HAsciiString from TCollection)
+       returns mutable HAsciiString from TCollection;
+  
+    GetMethodFromFriendName(aMeta : MetaSchema from MS; methodName : HAsciiString from TCollection)
+       returns mutable Method from MS;
+    ---Purpose: find a method with a short name.
+    --          short names are those that comes from the interface or friend method's list 
+
+    IsExportedType(aMeta     : MetaSchema from MS;
+                  aType     : Type from MS)
+       returns Boolean from Standard;
+    ---Purpose: Checks if a basic type is exportable (used by IsExportableMethod and IsExportableClass).     
+        
+    IsExportableMethod(aMeta     : MetaSchema from MS;
+                      aMethod   : Method from MS)
+       returns Boolean from Standard;
+    ---Purpose: for interface, engine or stubs extractor some types cannot be exported like pointer or imported
+    --          so this function returns False if one of these type is used by the method <aMethod>
+
+    IsExportableClass(aMeta          : MetaSchema from MS;
+                     aClass         : Class from MS;
+                     mustCheckField : Boolean from Standard;
+                     mustCheckMethods : Boolean from Standard)
+       returns Boolean from Standard;
+    ---Purpose: as <IsExportableMethod>, but this method checks if the class is not generic and checks methods.
+    --          If <mustCheckField> == Standard_True -> fields are checked.
+    --          If <mustCheckMethods> == Standard_True -> methods are checked.
+    
+    DispatchUsedType(aMeta     : MetaSchema from MS;
+                    aType     : Type from MS;
+                    aList     : HSequenceOfHAsciiString from TColStd;
+                    aIncList  : HSequenceOfHAsciiString from TColStd;
+                    notusedwithref : Boolean from Standard);
+    ---Purpose: we test the type and dispatch it in the different lists
+    --          <aFullList>      : list of all the type used
+    --          <aList>          : list of complete types used 
+    --          <aIncp>          : list of incomplete types used
+    --          <notusedwithref> : type are assumed to be used with reference if TRUE
+    
+    MethodUsedTypes(aMeta     : MetaSchema from MS;
+                   aMethod   : Method from MS;
+                   aList     : HSequenceOfHAsciiString from TColStd;
+                   aIncList  : HSequenceOfHAsciiString from TColStd);
+    ---Purpose: sort the method used types :
+    --          <aFullList>      : list of all the type used
+    --          <aList>          : list of complete types used 
+    --          <aIncp>          : list of incomplete types used
+     
+    ClassUsedTypes(aMeta     : MetaSchema from MS;
+                  aClass    : Class from MS;
+                  aList     : HSequenceOfHAsciiString from TColStd;
+                  aIncList  : HSequenceOfHAsciiString from TColStd);
+    ---Purpose: sort the class used types :
+    --          <aFullList>      : list of all the type used
+    --          <aList>          : list of complete types used 
+    --          <aIncp>          : list of incomplete types used
+
+
+   
+    -- -----------------------------------------
+    -- INTERNAL PART : CAUTION - RESTRICTED AREA
+    -- -----------------------------------------       
+
+    StubClassesToExtract(aMeta               : MetaSchema from MS; 
+                        aListOfInterClasses : HSequenceOfHAsciiString from TColStd;
+                        CompleteMap         : in out MapOfHAsciiString from WOKTools;
+                        IncompleteMap       : in out MapOfHAsciiString from WOKTools;
+                        SemiCompleteMap     : in out MapOfHAsciiString from WOKTools);
+    ---Level: Internal
+
+    StubPackagesToExtract(aMeta              : MetaSchema from MS; 
+                        Inter               : Interface from MS;
+                        CompleteMap         : in out MapOfHAsciiString from WOKTools;
+                        IncompleteMap       : in out MapOfHAsciiString from WOKTools;
+                        SemiCompleteMap     : in out MapOfHAsciiString from WOKTools);
+    ---Level: Internal
+
+    StubMethodsToExtract(aMeta               : MetaSchema from MS; 
+                        Inter               : Interface from MS;
+                        SeqOfExternMet      : HSequenceOfExternMet from MS;
+                        SeqOfMemberMet      : HSequenceOfMemberMet from MS;
+                        CompleteMap         : in out MapOfHAsciiString from WOKTools;
+                        IncompleteMap       : in out MapOfHAsciiString from WOKTools;
+                        SemiCompleteMap     : in out MapOfHAsciiString from WOKTools);
+    ---Level: Internal
+
+    StubMethodTypesToExtract(aMeta               : MetaSchema from MS; 
+                            met                 : Method from MS;
+                            CompleteMap         : in out MapOfHAsciiString from WOKTools;
+                            IncompleteMap       : in out MapOfHAsciiString from WOKTools;
+                            SemiCompleteMap     : in out MapOfHAsciiString from WOKTools);
+    ---Level: Internal
+    
+    StubMethodsTypesToExtract(aMeta               : MetaSchema from MS; 
+                             com                 : Common from MS;
+                             CompleteMap         : in out MapOfHAsciiString from WOKTools;
+                             IncompleteMap       : in out MapOfHAsciiString from WOKTools;
+                             SemiCompleteMap     : in out MapOfHAsciiString from WOKTools);
+    ---Level: Internal
+
+    BuildInstClass(aClass  : Class from MS;
+                 aName    : HAsciiString from TCollection;
+                 aPackage : HAsciiString from TCollection;
+                  aSeqGen  : HSequenceOfHAsciiString from TColStd;
+                 aSeqType : HSequenceOfHAsciiString from TColStd)
+       returns mutable InstClass from MS;
+    ---Purpose: Transform an InstClass to a StdClass (for instantiation phase)     
+    --          Don't use this method if you are not the MS's writer
+    ---Level: Internal
+               
+    BuildStdClass(aClass   : Class from MS;
+                 aName    : HAsciiString from TCollection;
+                 aPackage : HAsciiString from TCollection;
+                  aSeqGen  : HSequenceOfHAsciiString from TColStd;
+                 aSeqType : HSequenceOfHAsciiString from TColStd)
+       returns mutable StdClass from MS;
+    ---Purpose: Tranform a StdClass with generic parameter in a full StdClass
+    --          Don't use this method if you are not the MS's writer
+    ---Level: Internal
+    
+    BuildStdMethod(aMethod  : MemberMet from MS;
+                   aClass   : Class from MS;
+                  aSeqGen  : HSequenceOfHAsciiString from TColStd;
+                  aSeqType : HSequenceOfHAsciiString from TColStd)
+       returns mutable MemberMet from MS;
+    ---Purpose: Transform a method with generic parameter in a normal method
+    --          Don't use this method if you are not the MS's writer
+    ---Level: Internal
+  
+    BuildStdParam(aParam   : Param from MS;
+                 aMethod  : Method from MS;
+                 aSeqGen  : HSequenceOfHAsciiString from TColStd;
+                 aSeqType : HSequenceOfHAsciiString from TColStd)
+        returns mutable Param from MS;
+    ---Level: Internal
+    --          Don't use this method if you are not the MS's writer
+    
+    BuildStdField(aField   : Field from MS;
+                 aClass   : Class from MS;
+                 aSeqGen  : HSequenceOfHAsciiString from TColStd;
+                 aSeqType : HSequenceOfHAsciiString from TColStd)
+        returns mutable Field from MS;
+    ---Level: Internal
+    --          Don't use this method if you are not the MS's writer
+
+    AddOnce(aSeq : HSequenceOfHAsciiString from TColStd;
+           Item : HAsciiString from TCollection);
+    ---Purpose: to add an item only once in a sequence
+    --          WARNING : cursed code (use with care)
+    
+end MS;
+
+
diff --git a/src/MS/MS.cxx b/src/MS/MS.cxx
new file mode 100755 (executable)
index 0000000..188f9f8
--- /dev/null
@@ -0,0 +1,1247 @@
+#include <MS.ixx>
+#include <MS_MemberMet.hxx>
+#include <MS_ClassMet.hxx>
+#include <MS_Param.hxx>
+#include <MS_ParamWithValue.hxx>
+#include <MS_Package.hxx>
+#include <MS_InstMet.hxx>
+#include <MS_ExternMet.hxx>
+#include <MS_Construc.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_Enum.hxx>
+#include <MS_Pointer.hxx>
+#include <MS_NatType.hxx>
+#include <MS_Error.hxx>
+#include <MS_Imported.hxx>
+#include <MS_Alias.hxx>
+#include <MS_HArray1OfParam.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfType.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <Standard_NullObject.hxx>
+#include <WOKTools_Messages.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <WOKTools_DataMapOfHAsciiStringOfHAsciiString.hxx>
+
+WOKTools_DataMapOfHAsciiStringOfHAsciiString globMapOfName;
+#define NAME_STATS 1
+
+
+#ifdef NAME_STATS
+Standard_Integer economised = 0;
+Standard_Integer allocated  = 0;
+#endif
+
+Standard_EXPORT const Handle(TCollection_HAsciiString)&  MS_GetName(const Handle(TCollection_HAsciiString)&aname)
+{
+  if(!globMapOfName.IsBound(aname))
+    {
+       globMapOfName.Bind(aname,aname);
+    }
+  return globMapOfName.Find(aname);
+}
+
+Standard_EXPORT void  MS_ClearMapOfName()
+{
+  globMapOfName.Clear();
+}
+
+Handle(TCollection_HAsciiString) MS::BuildFullName(const Handle(TCollection_HAsciiString)& aGEName,
+                                                  const Handle(TCollection_HAsciiString)& aName)
+{
+  Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString(aGEName);
+
+  aFullName->AssignCat("_");
+  aFullName->AssignCat(aName);
+
+  return MS_GetName(aFullName);
+}
+
+Handle(TCollection_HAsciiString) MS::BuildComplexName(const Handle(TCollection_HAsciiString)& MyName,
+                                                     const Handle(TCollection_HAsciiString)& aGEName,
+                                                     const Handle(TCollection_HAsciiString)& aName)
+{
+  Standard_Integer                 Locate,Length;
+  Handle(TCollection_HAsciiString) theComplexName = new TCollection_HAsciiString(aGEName);
+  
+  theComplexName = new TCollection_HAsciiString(aGEName);
+  
+  Locate = 0;
+  
+  if (theComplexName->Length() > aName->Length()) {
+    Length = theComplexName->Length();
+    Locate = theComplexName->Location(aName,Length - aName->Length(),Length);
+  }
+    
+  if (Locate) {
+    theComplexName->Remove(Locate, Length - Locate + 1);
+  } 
+  else {
+    theComplexName->AssignCat("Of");
+  }
+  
+  theComplexName->AssignCat(MyName);
+  return MS_GetName(theComplexName);
+}
+
+Handle(MS_InstClass) MS::BuildInstClass(const Handle(MS_Class)& aClass,
+                                       const Handle(TCollection_HAsciiString)& aName,
+                                       const Handle(TCollection_HAsciiString)& aPackage,
+                                       const Handle(TColStd_HSequenceOfHAsciiString)& aSeqGen,
+                                       const Handle(TColStd_HSequenceOfHAsciiString)& aSeqType)
+{
+  Handle(MS_InstClass) aNewInst;
+
+  if (!aClass.IsNull()) {
+    Standard_Integer                        i;
+    Handle(TColStd_HSequenceOfHAsciiString) aSeqStr;
+    Handle(MS_InstClass)                    anInst;
+
+    anInst   = *((Handle(MS_InstClass)*)&aClass);
+    aNewInst = new MS_InstClass(aName,aPackage);
+
+    aSeqStr = anInst->BasicInstTypes();
+    
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewInst->BasicInstType(aSeqStr->Value(i));
+    }
+
+    aSeqStr = anInst->InstTypes();
+    
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewInst->InstType(aSeqStr->Value(i));
+    }
+
+    aSeqStr = anInst->GenTypes();
+
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewInst->GenType(aSeqStr->Value(i));
+    }
+
+    for (i = 1; i <= aSeqType->Length(); i++) {
+      aNewInst->ResolveInstType(aSeqGen->Value(i),aSeqType->Value(i));
+    }
+
+    aNewInst->Private(anInst->Private());
+    aNewInst->GenClass(anInst->GenClass());
+    aNewInst->Mother(anInst->GetMother());
+    aNewInst->MetaSchema(anInst->GetMetaSchema());
+    aNewInst->Package(aPackage);
+    aNewInst->Incomplete(Standard_False);
+    aNewInst->NestingClass(anInst->GetNestingClass());
+  }
+  else {
+    cerr << "Error : MS::BuildInstClass - aClass is NULL" << endl;
+    Standard_NullObject::Raise();
+  }
+
+  return aNewInst;
+}
+
+Handle(MS_StdClass) MS::BuildStdClass(const Handle(MS_Class)& aClass,
+                                     const Handle(TCollection_HAsciiString)& aName,
+                                     const Handle(TCollection_HAsciiString)& aPackage,
+                                     const Handle(TColStd_HSequenceOfHAsciiString)& aSeqGen,
+                                     const Handle(TColStd_HSequenceOfHAsciiString)& aSeqType)
+{
+  Handle(MS_StdClass) aNewClass;
+  
+  if (!aClass.IsNull()) {
+    Standard_Integer                        i,j;
+    Standard_Boolean                        IsFound = Standard_False;
+    Handle(TColStd_HSequenceOfHAsciiString) aSeqStr = aClass->GetInheritsNames();
+    
+    aNewClass = new MS_StdClass(aName,aPackage);
+    aNewClass->MetaSchema(aClass->GetMetaSchema());
+    aNewClass->Package(aPackage);
+    aNewClass->Deferred(aClass->Deferred());
+    aNewClass->Private(aClass->Private());
+    aNewClass->Mother(aClass->FullName());
+    aNewClass->NestingClass(aClass->GetNestingClass());
+
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewClass->Inherit(aSeqStr->Value(i));
+    }
+    
+    aSeqStr = aClass->GetUsesNames();
+    
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewClass->Use(aSeqStr->Value(i));
+    }
+
+    // adding the use of inst types
+    //
+    for (i = 1; i <= aSeqType->Length(); i++) {
+      for (j = 1; j <= aSeqStr->Length() && !IsFound; j++) {
+       if (aSeqType->Value(i)->IsSameString(aSeqStr->Value(j))) {
+         IsFound = Standard_True;
+       }
+      }
+
+      if (!IsFound) {
+       aNewClass->Use(aSeqType->Value(i));
+       IsFound = Standard_False;
+      }
+    }
+
+    // for Type conversion 
+    //     ex :  a generic copy constructor
+    //                 Create ( T from p) returns T
+    //              -> Create ( TOfA from p') returns TOfA
+    //
+    aSeqGen->Append(aClass->FullName());
+    aSeqType->Append(aNewClass->FullName());
+
+    Handle(MS_HSequenceOfField) aSeqField = aClass->GetFields();
+    
+    for (i = 1; i <= aSeqField->Length(); i++) {
+      aNewClass->Field(MS::BuildStdField(aSeqField->Value(i),aNewClass,aSeqGen,aSeqType));
+    }
+    
+    aSeqStr = aClass->GetFriendMets();
+    
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewClass->FriendMet(aSeqStr->Value(i));
+    }
+    
+    Handle(MS_HSequenceOfMemberMet) aSeqMet = aClass->GetMethods();
+    
+    for (i = 1; i <= aSeqMet->Length(); i++) {
+      aNewClass->Method(MS::BuildStdMethod(aSeqMet->Value(i),aNewClass,aSeqGen,aSeqType));
+    }
+
+    aSeqGen->Remove(aSeqGen->Length());
+    aSeqType->Remove(aSeqType->Length());
+    
+    aSeqStr = aClass->GetRaises();
+    
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      aNewClass->Raises(aSeqStr->Value(i));
+    }
+    
+    aSeqStr = aClass->GetFriendsNames();
+
+    for (i = 1; i <= aSeqStr->Length(); i++) {
+      IsFound = Standard_False;
+
+      for (j = 1; j <= aSeqGen->Length() && !IsFound; j++) {
+       if (aSeqGen->Value(j)->IsSameString(aSeqStr->Value(i))) {
+         aNewClass->Friend(aSeqType->Value(j));
+         IsFound = Standard_True;
+       }
+      }
+      
+      if (!IsFound) {
+       aNewClass->Friend(aSeqStr->Value(i));
+      }
+    }
+    
+    aNewClass->Incomplete(Standard_False);
+  }
+  else {
+    cerr << "Error : MS::BuildStdClass - aClass is NULL" << endl;
+    Standard_NullObject::Raise();
+  }
+  
+  return aNewClass;
+}
+
+Handle(MS_MemberMet) MS::BuildStdMethod(const Handle(MS_MemberMet)& aMethod,
+                                       const Handle(MS_Class)& aClass,
+                                       const Handle(TColStd_HSequenceOfHAsciiString)& aSeqGen,
+                                       const Handle(TColStd_HSequenceOfHAsciiString)& aSeqType)
+{
+  Handle(MS_MemberMet) aNewMethod;
+  
+  if (!aMethod.IsNull() && !aClass.IsNull()) {
+    Standard_Integer    i; 
+    Handle(MS_InstMet)  aNewInst;
+    Handle(MS_Construc) aNewCons;
+    Handle(MS_ClassMet) aNewCmet;
+    MS_InstMet          *anInst = 0l;
+
+    if (aMethod->IsKind(STANDARD_TYPE(MS_InstMet))) {
+      anInst     = (MS_InstMet *)aMethod.operator->();
+      aNewInst   = new MS_InstMet(aMethod->Name(),aClass->FullName());
+      aNewMethod = aNewInst;
+
+      aNewInst->Mode(anInst->GetMode());
+    }
+    else if (aMethod->IsKind(STANDARD_TYPE(MS_Construc))) {
+      aNewCons   = new MS_Construc(aMethod->Name(),aClass->FullName());
+      aNewMethod = aNewCons;
+    }
+    else {
+      aNewCmet   = new MS_ClassMet(aMethod->Name(),aClass->FullName());
+      aNewMethod = aNewCmet;
+    }
+
+    // Parameters
+    //
+    Handle(MS_HArray1OfParam)   aSeqParam = aMethod->Params();
+    Handle(MS_HSequenceOfParam) tmpParamSeq = new MS_HSequenceOfParam;
+    if(!aSeqParam.IsNull()) {
+      for (i = 1; i <= aSeqParam->Length(); i++) {
+       tmpParamSeq->Append(MS::BuildStdParam(aSeqParam->Value(i),aNewMethod,aSeqGen,aSeqType));
+       //aNewMethod->Param(MS::BuildStdParam(aSeqParam->Value(i),aNewMethod,aSeqGen,aSeqType));
+      }
+      aNewMethod->Params(tmpParamSeq);
+    }
+    // Some attributes
+    //
+    aNewMethod->Private(aMethod->Private());
+    aNewMethod->Inline(aMethod->IsInline());
+    aNewMethod->ConstReturn(aMethod->IsConstReturn());
+    aNewMethod->RefReturn(aMethod->IsRefReturn());
+    aNewMethod->Alias(aMethod->IsAlias());
+    aNewMethod->Destructor(aMethod->IsDestructor());
+    aNewMethod->Protected(aMethod->IsProtected());
+    aNewMethod->FunctionCall(aMethod->IsFunctionCall());
+    aNewMethod->SetAliasType(aMethod->IsOperator());
+
+    if (!aMethod->Returns().IsNull()) {
+      aNewMethod->Returns(MS::BuildStdParam(aMethod->Returns(),aNewMethod,aSeqGen,aSeqType));
+    }
+
+    aNewMethod->CreateFullName();
+    aNewMethod->MetaSchema(aClass->GetMetaSchema());
+    aClass->GetMetaSchema()->AddMethod(aNewMethod);
+
+    // Raises
+    //
+    Handle(TColStd_HSequenceOfHAsciiString) aRaiseSeq  = aMethod->GetRaisesName();
+    Handle(MS_Method)                       aSimpleMet = aNewMethod;
+
+    if(!aRaiseSeq.IsNull()) {
+      for (i = 1; i <= aRaiseSeq->Length(); i++) {
+       aSimpleMet->Raises(aRaiseSeq->Value(i));
+      }
+    }
+  }
+  else {
+    cerr << "Error : MS::BuildStdMethod - aMethod or aClass are NULL" << endl;
+    Standard_NullObject::Raise();
+  }
+
+  return aNewMethod;
+}
+
+// WARNING (to do) : LikeParam is not copied 
+//
+Handle(MS_Param) MS::BuildStdParam(const Handle(MS_Param)& aParam,
+                                  const Handle(MS_Method)& aMethod,
+                                  const Handle(TColStd_HSequenceOfHAsciiString)& aSeqGen,
+                                  const Handle(TColStd_HSequenceOfHAsciiString)& aSeqType)
+{
+  Handle(MS_Param) aNewParam;
+
+  if (!aParam.IsNull() && !aMethod.IsNull()) {
+    Standard_Integer i;
+    Standard_Boolean IsFound = Standard_False;
+
+    if (aParam->GetValueType() == MS_NONE) {
+      aNewParam = new MS_Param(aMethod,aParam->Name());
+    }
+    else {
+      MS_ParamWithValue *pwv = (MS_ParamWithValue *)aParam.operator->();
+      MS_ParamWithValue *npwv;
+
+      aNewParam = new MS_ParamWithValue(aMethod,aParam->Name());
+
+      npwv = (MS_ParamWithValue *)aNewParam.operator->();
+      npwv->Value(pwv->GetValue(),pwv->GetValueType());
+    }
+
+    aNewParam->AccessMode(aParam->GetAccessMode());
+
+    for (i = 1; i <= aSeqGen->Length() && !IsFound; i++) {
+      if (aSeqGen->Value(i)->IsSameString(aParam->TypeName())) {
+       aNewParam->Type(aSeqType->Value(i));
+       aNewParam->ItsItem();
+       IsFound = Standard_True;
+      }
+    }
+
+    if (!IsFound) {
+      aNewParam->Type(aParam->TypeName());
+      aNewParam->ItsNotItem();
+    }
+    
+    aNewParam->MetaSchema(aParam->GetMetaSchema());
+  }
+  else {
+    cerr << "Error : MS::BuildStdParam - aParam or aMethod are NULL" << endl;
+    Standard_NullObject::Raise();
+  }
+
+  return aNewParam;
+}
+
+
+Handle(MS_Field) MS::BuildStdField(const Handle(MS_Field)& aField,
+                                  const Handle(MS_Class)& aClass,
+                                  const Handle(TColStd_HSequenceOfHAsciiString)& aSeqGen,
+                                  const Handle(TColStd_HSequenceOfHAsciiString)& aSeqType)
+{
+  Handle(MS_Field) aNewField;
+
+  if (!aField.IsNull() && !aClass.IsNull()) {
+    Standard_Integer i;
+    Standard_Boolean IsFound = Standard_False;
+
+    aNewField = new MS_Field(aClass,aField->Name());
+
+    aNewField->Protected(aField->Protected());
+    aNewField->MetaSchema(aField->GetMetaSchema());
+
+    for (i = 1; i <= aField->Dimensions()->Length(); i++) {
+      aNewField->Dimension(aField->Dimensions()->Value(i));
+    }
+
+    for (i = 1; i <= aSeqGen->Length() && !IsFound; i++) {
+      if (aSeqGen->Value(i)->IsSameString(aField->TYpe())) {
+       aNewField->TYpe(aSeqType->Value(i));
+       IsFound = Standard_True;
+      }
+    }
+
+    if (!IsFound) {
+      aNewField->TYpe(aField->TYpe());
+    }
+  }
+  else {
+    cerr << "Error : MS::BuildStdField - aField or aClass are NULL" << endl;
+    Standard_NullObject::Raise();
+  }
+
+  return aNewField;
+}
+
+Handle(TCollection_HAsciiString) MS::GetPersistentRootName()
+{
+  static Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(MS::GetPackageRootName(),new TCollection_HAsciiString("Persistent"));
+
+  return aFullName;
+}
+
+Handle(TCollection_HAsciiString) MS::GetStorableRootName() 
+{
+  static Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(MS::GetPackageRootName(),new TCollection_HAsciiString("Storable"));
+
+  return aFullName;
+}
+
+
+Handle(TCollection_HAsciiString) MS::GetTransientRootName()
+{
+  static Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(MS::GetPackageRootName(), new TCollection_HAsciiString("Transient"));
+
+  return aFullName;
+}
+
+Handle(TCollection_HAsciiString) MS::GetPackageRootName()
+{
+  static Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString("Standard");
+
+  return aFullName;
+}
+
+Handle(TCollection_HAsciiString) MS::GetVArrayRootName()
+{
+  static Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString("DBC_VArray");
+
+  return aFullName;
+}
+Handle(TCollection_HAsciiString) MS::GetEntityNameFromMethodName(const Handle(TCollection_HAsciiString)& methodName)
+{
+  Handle(TCollection_HAsciiString) aname = methodName->Token(":");
+
+  return aname;
+}
+
+Handle(MS_Method) MS::GetMethodFromFriendName(const Handle(MS_MetaSchema)& aMeta,
+                                             const Handle(TCollection_HAsciiString)& methodName)
+{
+  Handle(TCollection_HAsciiString) aname = methodName->Token(":");
+  Standard_Boolean                 IsFound = Standard_False;
+  Standard_Integer                 i;
+  Handle(MS_Method)                result;
+
+  if (!aname.IsNull()) {
+    if (aMeta->IsPackage(aname)) {
+      Handle(MS_Package)              apack  = aMeta->GetPackage(aname);
+      Handle(MS_HSequenceOfExternMet) seqmet = apack->Methods();
+
+      for (i = 1; i <= seqmet->Length() && !IsFound; i++) {
+       if (seqmet->Value(i)->FullName()->Search(methodName->ToCString()) >= 0) {
+         IsFound = Standard_True;
+         result = seqmet->Value(i);
+       }
+      }
+    }
+    else if (aMeta->IsDefined(aname)) {
+      Handle(MS_Type)  ftype = aMeta->GetType(aname);
+      Handle(MS_Class) aclass = *((Handle(MS_Class)*)&ftype);
+      Handle(MS_HSequenceOfMemberMet) seqmet = aclass->GetMethods();
+
+      for (i = 1; i <= seqmet->Length() && !IsFound; i++) {
+       if (seqmet->Value(i)->FullName()->Search(methodName->ToCString()) >= 0) {
+         IsFound = Standard_True;
+         result = seqmet->Value(i);
+       }
+      }
+    }
+  }
+
+  return result;
+}
+
+
+Standard_Boolean MS::IsExportedType(const Handle(MS_MetaSchema)& aMeta,const Handle(MS_Type)& aType)
+{ 
+  if (aType->IsKind(STANDARD_TYPE(MS_Imported)) || 
+      aType->IsKind(STANDARD_TYPE(MS_GenType))  ||
+      aType->IsKind(STANDARD_TYPE(MS_Pointer)))
+    return Standard_False;
+  else 
+    return Standard_True;
+}
+
+Standard_Boolean MS::IsExportableMethod(const Handle(MS_MetaSchema)& aMeta,const Handle(MS_Method)& aMethod)
+{ 
+  Standard_Integer            i;
+  Handle(MS_HArray1OfParam)   par  = aMethod->Params();
+  Handle(MS_Param)            apar = aMethod->Returns();
+  Standard_Boolean            result = Standard_True;
+
+  if(!par.IsNull()) {
+    for (i = 1; i <= par->Length(); i++) {
+      if (!IsExportedType(aMeta,aMeta->GetType(par->Value(i)->TypeName())))
+       return Standard_False;
+    }
+  }
+
+  if (!apar.IsNull()) {
+    if (!IsExportedType(aMeta,aMeta->GetType(apar->TypeName())))
+      return Standard_False;
+  }
+
+  return result;
+}
+
+Standard_Boolean MS::IsExportableClass(const Handle(MS_MetaSchema)& aMeta,const Handle(MS_Class)& aClass, const Standard_Boolean mustCheckField, const Standard_Boolean mustCheckMethods)
+{ 
+  Standard_Boolean IsExtractable = Standard_True;
+  Standard_Integer i;
+
+  if (aClass->IsKind(STANDARD_TYPE(MS_GenClass)) || !aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+    return Standard_False;
+  }
+  else if (aClass->IsKind(STANDARD_TYPE(MS_StdClass)) && !aClass->IsKind(STANDARD_TYPE(MS_Error))) {
+    MS_StdClass* astdClass = (MS_StdClass *)aClass.operator->();
+    
+    if (astdClass->IsGeneric()) {
+      return Standard_False;
+    }
+  }
+  else {
+    return Standard_False;
+  }
+  
+  if (mustCheckMethods) {
+    Handle(MS_HSequenceOfMemberMet) aseqmet = aClass->GetMethods();
+    
+    for (i = 1; i <= aseqmet->Length(); i++) {
+      if (!IsExportableMethod(aMeta,aseqmet->Value(i)))
+       return Standard_False;
+    }  
+  }
+
+  if (mustCheckField) {
+    Handle(MS_HSequenceOfField) aseqfield = aClass->GetFields();
+
+    for (i = 1; i <= aseqfield->Length(); i++) {
+      if (IsExportedType(aMeta,aMeta->GetType(aseqfield->Value(i)->TYpe())))
+       return Standard_False;
+    }
+  }
+
+  return IsExtractable;
+}
+
+// add an element in a sequence only if it s not already 
+// here
+//
+void MS::AddOnce(const Handle(TColStd_HSequenceOfHAsciiString)& aSeq, 
+                const Handle(TCollection_HAsciiString)& item)
+{
+  Standard_Integer i;
+  Standard_Boolean IsFound = Standard_False;
+
+  for (i = 1; i <= aSeq->Length() && !IsFound; i++) {
+    if (aSeq->Value(i)->IsSameString(item)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  if (!IsFound) {
+    aSeq->Append(item);
+  }
+}
+
+// we test the type and dispatch it in the different lists
+//
+void MS::DispatchUsedType(const Handle(MS_MetaSchema)& aMeta,
+                         const Handle(MS_Type)& thetype,
+                         const Handle(TColStd_HSequenceOfHAsciiString)& List,
+                         const Handle(TColStd_HSequenceOfHAsciiString)& Incp,
+                         const Standard_Boolean notusedwithref)
+{
+  if (thetype->IsKind(STANDARD_TYPE(MS_Class))) {
+    Handle(MS_Class)                 theclass = *((Handle(MS_Class)*)&thetype);
+    Handle(TCollection_HAsciiString) handlename;
+
+    if (theclass->IsTransient() || theclass->IsPersistent()) {
+      handlename = new TCollection_HAsciiString("Handle_");
+
+      handlename->AssignCat(thetype->FullName());
+      MS::AddOnce(List,handlename);
+      MS::AddOnce(Incp,thetype->FullName());
+    }
+    else {
+      if (notusedwithref) {
+       MS::AddOnce(List,thetype->FullName());
+      }
+      else {
+       MS::AddOnce(Incp,thetype->FullName());
+      }
+    }
+  }
+  else if (thetype->IsKind(STANDARD_TYPE(MS_NatType))) {
+    MS::AddOnce(List,thetype->FullName());
+  }      
+}
+
+// sort the method used types :
+//
+//    List     : the types that must have a full definition
+//    Incp     : the types that only have to be declared
+//
+void MS::MethodUsedTypes(const Handle(MS_MetaSchema)& aMeta,
+                        const Handle(MS_Method)& aMethod,
+                        const Handle(TColStd_HSequenceOfHAsciiString)& List,
+                        const Handle(TColStd_HSequenceOfHAsciiString)& Incp)
+{
+  Standard_Integer                 i;
+  Handle(MS_Param)                 aParam;
+  Handle(MS_Type)                  thetype;
+  Handle(TCollection_HAsciiString) aName;
+
+  if (aMethod->IsKind(STANDARD_TYPE(MS_MemberMet))) {
+    Handle(MS_MemberMet) aMM = *((Handle(MS_MemberMet)*)&aMethod);
+
+    aName = aMM->Class();
+  }
+  else if (aMethod->IsKind(STANDARD_TYPE(MS_ExternMet))) {
+    Handle(MS_ExternMet) aMM = *((Handle(MS_ExternMet)*)&aMethod);
+
+    aName = aMM->Package();
+  }
+
+  aParam = aMethod->Returns();
+
+  if (!aParam.IsNull()) {
+    if (aMeta->IsDefined(aParam->TypeName())) {
+      thetype = aParam->Type();
+      if (!aParam->TypeName()->IsSameString(aName)) {
+       if (aMethod->IsInline() || aMethod->IsFunctionCall() || aMethod->IsOperator()) {
+         MS::DispatchUsedType(aMeta,thetype,List,Incp,!aMethod->IsRefReturn());
+       }
+       else {
+         MS::DispatchUsedType(aMeta,thetype,List,Incp,Standard_False);
+       }
+      }
+    }
+  }
+
+  Handle(MS_HArray1OfParam)      seqparam = aMethod->Params();
+  
+  if(!seqparam.IsNull()) {
+    for (i = 1; i <= seqparam->Length(); i++) {
+      if (!seqparam->Value(i)->TypeName()->IsSameString(aName)) {
+       if (aMeta->IsDefined(seqparam->Value(i)->TypeName())) {
+         thetype = seqparam->Value(i)->Type();
+
+         // parametre avec valeur par defaut manipule par valeur
+         //
+         if (seqparam->Value(i)->IsKind(STANDARD_TYPE(MS_ParamWithValue))) {
+           MS::DispatchUsedType(aMeta,thetype,List,Incp,Standard_True);
+         }
+         else {
+           MS::DispatchUsedType(aMeta,thetype,List,Incp,Standard_False);
+         }
+       }
+      }
+    }
+  }
+}
+
+// sort the class used types :
+//
+//    List     : the types that must have a full definition
+//    Incp     : the types that only have to be declared
+//
+void MS::ClassUsedTypes(const Handle(MS_MetaSchema)& aMeta,
+                       const Handle(MS_Class)& aClass,
+                       const Handle(TColStd_HSequenceOfHAsciiString)& List,
+                       const Handle(TColStd_HSequenceOfHAsciiString)& Incp)
+{
+  Standard_Integer                        i;
+  Handle(MS_HSequenceOfField)             fields = aClass->GetFields();
+  Handle(TColStd_HSequenceOfHAsciiString) asciiseq;
+  Handle(TCollection_HAsciiString)        str;
+
+  for (i = 1; i <= fields->Length(); i++) {
+    if (aMeta->IsDefined(fields->Value(i)->TYpe())) {
+      MS::DispatchUsedType(aMeta,aMeta->GetType(fields->Value(i)->TYpe()),List,Incp,Standard_True);
+    }
+  }
+  
+  asciiseq = aClass->GetRaises();
+
+  for (i = 1; i <= asciiseq->Length(); i++) {
+    MS::AddOnce(Incp,asciiseq->Value(i));
+  }
+
+  asciiseq = aClass->GetInheritsNames();
+
+  for (i = 1; i <= asciiseq->Length(); i++) {
+    MS::AddOnce(List,asciiseq->Value(i));
+  }
+
+  asciiseq = aClass->GetFriendsNames();
+
+  for (i = 1; i <= asciiseq->Length(); i++) {
+    MS::AddOnce(Incp,asciiseq->Value(i));
+  }
+
+  Handle(TCollection_HAsciiString) aname;
+
+  asciiseq = aClass->GetFriendMets();
+  Handle(MS_Method) friendmethod;
+
+  for (i = 1; i <= asciiseq->Length(); i++) {
+    friendmethod = MS::GetMethodFromFriendName(aMeta,asciiseq->Value(i));
+    MS::MethodUsedTypes(aMeta,friendmethod,List,Incp);
+    aname = asciiseq->Value(i)->Token(":");
+    MS::AddOnce(List,aname);
+  }
+
+  Handle(MS_StdClass) aStdClass = Handle(MS_StdClass)::DownCast(aClass);
+
+  if (!aStdClass.IsNull()) {
+    if (!aStdClass->GetMyCreator().IsNull()) {
+      asciiseq = aStdClass->GetMyCreator()->InstTypes();
+      
+      for (i = 1; i <= asciiseq->Length(); i++) {
+       if (!aClass->FullName()->IsSameString(asciiseq->Value(i))) {
+         MS::DispatchUsedType(aMeta,aMeta->GetType(asciiseq->Value(i)),List,Incp,Standard_False);
+       }
+      }
+    }
+  }
+
+  Handle(MS_HSequenceOfMemberMet) metseq = aClass->GetMethods();
+
+  for (i = 1; i <= metseq->Length(); i++) {
+    MS::MethodUsedTypes(aMeta,metseq->Value(i),List,Incp);
+  }
+}
+
+// we look for classes that must be extracted
+//
+void MS::StubClassesToExtract(const Handle(MS_MetaSchema)& aMeta,
+                             const Handle(TColStd_HSequenceOfHAsciiString)& aSeq,
+                             WOKTools_MapOfHAsciiString& ExtractionMap,
+                             WOKTools_MapOfHAsciiString& ExtractionIncpMap,
+                             WOKTools_MapOfHAsciiString& ExtractionSemiMap)
+{
+  Standard_Integer                        i,
+                                          j;
+  Handle(TColStd_HSequenceOfHAsciiString) aSeqInh;    // inherits sequence
+  Standard_Boolean                        IsExtractable;
+  
+  for (i = 1; i <= aSeq->Length(); i++) {
+    IsExtractable = Standard_False;
+
+    if (aMeta->IsDefined(aSeq->Value(i))) {
+      Handle(MS_Type) tt = aMeta->GetType(aSeq->Value(i));
+
+      if (tt->IsKind(STANDARD_TYPE(MS_GenClass)) || !tt->IsKind(STANDARD_TYPE(MS_StdClass))) {
+       IsExtractable = Standard_False;
+      }
+      else if (tt->IsKind(STANDARD_TYPE(MS_StdClass)) && !tt->IsKind(STANDARD_TYPE(MS_Error))) {
+       Handle(MS_StdClass) aClass = *((Handle(MS_StdClass)*)&tt);
+
+       if (aClass->IsGeneric()) {
+         IsExtractable = Standard_False;
+       }
+       else {
+         IsExtractable = Standard_True;
+       }
+      }
+      else {
+       IsExtractable = Standard_False;
+      }
+    }
+    
+    if (!ExtractionMap.Contains(aSeq->Value(i)) && IsExtractable) {
+      ExtractionMap.Add(aSeq->Value(i));
+      //cout << "ExtractionMap ADD : " << aSeq->Value(i)->ToCString() << endl;
+      if (ExtractionSemiMap.Contains(aSeq->Value(i))) {
+       ExtractionSemiMap.Remove(aSeq->Value(i));
+       //cout << "ExtractionSemiMap DELETE : " << aSeq->Value(i)->ToCString() << endl;
+      }
+
+      if (ExtractionIncpMap.Contains(aSeq->Value(i))) {
+       ExtractionIncpMap.Remove(aSeq->Value(i));
+       //cout << "ExtractionIncpMap DELETE : " << aSeq->Value(i)->ToCString() << endl;
+      }
+
+      
+      if (!aMeta->IsDefined(aSeq->Value(i))) {
+       ErrorMsg << "MS" << "Class " << aSeq->Value(i) << " not defined..." << endm;
+       Standard_NoSuchObject::Raise();
+      }
+
+      if (aMeta->GetType(aSeq->Value(i))->IsKind(STANDARD_TYPE(MS_StdClass)) && !aMeta->GetType(aSeq->Value(i))->IsKind(STANDARD_TYPE(MS_Error))) {
+       Handle(MS_Type)     tmpType = aMeta->GetType(aSeq->Value(i));
+       Handle(MS_StdClass) aClass = *((Handle(MS_StdClass)*)&tmpType);
+         
+       MS::StubMethodsTypesToExtract(aMeta,aClass,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+
+       aSeqInh = aClass->GetFullInheritsNames();
+       
+       for (j = 1; j <= aSeqInh->Length(); j++) {
+         if (!ExtractionMap.Contains(aSeqInh->Value(j))) {
+           Handle(MS_Type) tmpTypej = aMeta->GetType(aSeqInh->Value(j));
+
+           ExtractionMap.Add(aSeqInh->Value(j));
+           
+           aClass = *((Handle(MS_StdClass)*)&tmpTypej);
+
+           MS::StubMethodsTypesToExtract(aMeta,aClass,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+
+           if (ExtractionIncpMap.Contains(aSeqInh->Value(j))) {
+             ExtractionIncpMap.Remove(aSeqInh->Value(j));
+             //cout << "ExtractionIncpMap DELETE : " << aSeqInh->Value(j)->ToCString() << endl;
+           }
+
+           if (ExtractionSemiMap.Contains(aSeqInh->Value(j))) {
+             ExtractionSemiMap.Remove(aSeqInh->Value(j));
+             //cout << "ExtractionSemiMap DELETE : " << aSeqInh->Value(j)->ToCString() << endl;
+           }
+           
+         }
+       }
+       
+      }
+    }
+  }
+}
+
+
+void MS::StubPackagesToExtract(const Handle(MS_MetaSchema)& aMeta,
+                              const Handle(MS_Interface)& anInterface,
+                              WOKTools_MapOfHAsciiString& ExtractionMap,
+                              WOKTools_MapOfHAsciiString& ExtractionIncpMap,
+                              WOKTools_MapOfHAsciiString& ExtractionSemiMap)
+{
+  Standard_Integer                        i,j;
+  Handle(TColStd_HSequenceOfHAsciiString) aSeq,    // packages sequence
+                                          aSeqClasses;
+  Handle(MS_Package)                      aPackage;
+
+  aSeq        = anInterface->Packages();
+  aSeqClasses = new TColStd_HSequenceOfHAsciiString();
+
+  for (i = 1; i <= aSeq->Length(); i++) {
+    if (aMeta->IsPackage(aSeq->Value(i))) {
+      aPackage = aMeta->GetPackage(aSeq->Value(i));
+
+      if (!ExtractionMap.Contains(aSeq->Value(i))) {
+        ExtractionMap.Add(aSeq->Value(i));
+        for (j = 1; j <= aPackage->Enums()->Length(); j++) {
+          ExtractionMap.Add(MS::BuildFullName(aPackage->FullName(),aPackage->Enums()->Value(j)));
+        }
+        //cout << "ExtractionMap ADD : " << aSeq->Value(i)->ToCString() << endl;
+      }
+
+      aSeqClasses->Clear();
+
+      for (j = 1; j <= aPackage->Classes()->Length(); j++) {
+       aSeqClasses->Append(MS::BuildFullName(aPackage->FullName(),aPackage->Classes()->Value(j)));
+      }
+
+      MS::StubClassesToExtract(aMeta,aSeqClasses,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+      MS::StubMethodsTypesToExtract(aMeta,aPackage,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+    }
+    else {
+      ErrorMsg << "MS" << "Package " << aSeq->Value(i) << " not defined..." << endm;
+      Standard_NoSuchObject::Raise();
+    }
+
+  }
+} 
+
+void MS::StubMethodsToExtract(const Handle(MS_MetaSchema)& aMeta,
+                             const Handle(MS_Interface)& anInterface,
+                             const Handle(MS_HSequenceOfExternMet)& SeqOfExternMet,
+                             const Handle(MS_HSequenceOfMemberMet)& SeqOfMemberMet,
+                             WOKTools_MapOfHAsciiString& ExtractionMap,
+                             WOKTools_MapOfHAsciiString& ExtractionIncpMap,
+                             WOKTools_MapOfHAsciiString& ExtractionSemiMap)
+{
+  Standard_Integer                        i,j;
+  Handle(TColStd_HSequenceOfHAsciiString) aseq = anInterface->Methods();
+  Handle(MS_Method)                       amet;
+  
+  for (i = 1; i <= aseq->Length(); i++) {
+    amet = MS::GetMethodFromFriendName(aMeta,aseq->Value(i));
+
+    if (!amet.IsNull()) {
+      if (amet->IsKind(STANDARD_TYPE(MS_ExternMet))) {
+       Handle(MS_ExternMet) aemet = *((Handle(MS_ExternMet)*)&amet);
+
+       if (!ExtractionMap.Contains(aemet->Package())) {
+         if (ExtractionIncpMap.Contains(aemet->Package())) {
+           ExtractionIncpMap.Remove(aemet->Package());
+           //cout << "ExtractionIncpMap DELETE : " << aemet->Package()->ToCString() << endl;
+         }
+
+         if (!ExtractionSemiMap.Contains(aemet->Package())) {
+           ExtractionSemiMap.Add(aemet->Package());
+           //cout << "ExtractionSemiMap ADD : " << aemet->Package()->ToCString() << endl;
+         }
+         
+         SeqOfExternMet->Append(aemet);
+         MS::StubMethodTypesToExtract(aMeta,aemet,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+       }
+      }
+      else {
+       Handle(MS_MemberMet) ammet = *((Handle(MS_MemberMet)*)&amet);
+
+       if (!ExtractionMap.Contains(ammet->Class())) {
+         if (ExtractionIncpMap.Contains(ammet->Class())) {
+           ExtractionIncpMap.Remove(ammet->Class());
+           //cout << "ExtractionIncpMap DELETE : " << ammet->Class()->ToCString() << endl;
+         }
+
+         if (!ExtractionSemiMap.Contains(ammet->Class())) {
+           ExtractionSemiMap.Add(ammet->Class());
+           //cout << "ExtractionSemiMap ADD : " << ammet->Class()->ToCString() << endl;
+         }
+
+         SeqOfMemberMet->Append(ammet);
+         MS::StubMethodTypesToExtract(aMeta,ammet,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+         Handle(MS_Type)                         tmpTypejj = aMeta->GetType(ammet->Class());
+         Handle(MS_StdClass)                     aClass = *((Handle(MS_StdClass)*)&tmpTypejj);
+         Handle(TColStd_HSequenceOfHAsciiString) aSeqInh; 
+
+         aSeqInh = aClass->GetFullInheritsNames();
+
+         for (j = 1; j <= aSeqInh->Length(); j++) {
+           if (!ExtractionSemiMap.Contains(aSeqInh->Value(j)) && 
+               !ExtractionMap.Contains(aSeqInh->Value(j)) && 
+               !ExtractionIncpMap.Contains(aSeqInh->Value(j)))
+             {
+               ExtractionIncpMap.Add(aSeqInh->Value(j));
+               //cout << "ExtractionIncpMap ADD : " << aSeqInh->Value(j)->ToCString() << endl;
+             }
+         }
+       }
+      }
+    }
+    else {
+      ErrorMsg << "MS" << "Method " << aseq->Value(i) << " not defined..." << endm;
+      Standard_NoSuchObject::Raise();
+    }
+  }
+}
+
+void MS::StubMethodTypesToExtract(const Handle(MS_MetaSchema)& aMeta,
+                                 const Handle(MS_Method)&     aMethod,
+                                 WOKTools_MapOfHAsciiString&  ExtractionMap,
+                                 WOKTools_MapOfHAsciiString&  ExtractionIncpMap,
+                                 WOKTools_MapOfHAsciiString&  ExtractionSemiMap)
+{
+  Standard_Integer                 j,k;
+  Handle(MS_HArray1OfParam)        params;
+  Handle(TCollection_HAsciiString) parname;
+  Handle(MS_Type)                  type;
+  Handle(MS_Class)                 aClass;
+  Handle(MS_Package)               aPackage;
+  Handle(MS_Param)                 returnType;
+
+  params     = aMethod->Params();
+  returnType = aMethod->Returns();
+
+  if(!params.IsNull()) {
+    for (j = 1; j <= params->Length(); j++) {
+      parname = params->Value(j)->TypeName();
+      
+      if (aMeta->IsDefined(parname)) {
+       type = aMeta->GetType(parname);
+
+       if (type->IsKind(STANDARD_TYPE(MS_Alias))) {
+         Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&type);
+         
+         parname = analias->DeepType();
+         
+         if (aMeta->IsDefined(parname)) {
+           type = aMeta->GetType(parname);
+         }
+         else {
+           ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+           Standard_NoSuchObject::Raise();
+         }
+       }
+       
+       
+       if (type->IsKind(STANDARD_TYPE(MS_StdClass)) && !type->IsKind(STANDARD_TYPE(MS_Error))) {
+         Handle(MS_StdClass) stdclass = *((Handle(MS_StdClass)*)&type);
+         
+         if (!ExtractionIncpMap.Contains(parname) && !ExtractionMap.Contains(parname) && !ExtractionSemiMap.Contains(parname)) {
+           ExtractionIncpMap.Add(parname);
+           //cout << "ExtractionIncpMap ADD : " << parname->ToCString() << endl;
+           Handle(TColStd_HSequenceOfHAsciiString) inh = stdclass->GetFullInheritsNames();
+
+           for (k = 1; k <= inh->Length(); k++) {
+             if (!ExtractionIncpMap.Contains(inh->Value(k)) && 
+                 !ExtractionMap.Contains(inh->Value(k)) && 
+                 !ExtractionSemiMap.Contains(inh->Value(k))) {
+               ExtractionIncpMap.Add(inh->Value(k));
+               //cout << "ExtractionIncpMap ADD : " << inh->Value(k)->ToCString() << endl;
+             }
+           }
+         }
+       }
+       else if (type->IsKind(STANDARD_TYPE(MS_Enum))) {
+         if (!ExtractionMap.Contains(type->FullName())) {
+           ExtractionMap.Add(type->FullName());
+         }
+       }
+      }
+      else {
+       ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+       Standard_NoSuchObject::Raise();
+      }
+    }
+  }
+  
+  if (!returnType.IsNull()) {
+    parname = returnType->TypeName();
+
+    if (aMeta->IsDefined(parname)) {
+      type = aMeta->GetType(parname);
+      
+      if (type->IsKind(STANDARD_TYPE(MS_Alias))) {
+       Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&type);
+       
+       parname = analias->DeepType();
+       
+       if (aMeta->IsDefined(parname)) {
+         type = aMeta->GetType(parname);
+       }
+       else {
+         ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+         Standard_NoSuchObject::Raise();
+       }
+      }
+      
+      if (type->IsKind(STANDARD_TYPE(MS_StdClass)) && !type->IsKind(STANDARD_TYPE(MS_Error))) {
+       Handle(MS_StdClass) stdclass = *((Handle(MS_StdClass)*)&type);
+       
+       if (!ExtractionIncpMap.Contains(type->FullName()) && 
+           !ExtractionMap.Contains(type->FullName()) && 
+           !ExtractionSemiMap.Contains(type->FullName())) {
+         ExtractionIncpMap.Add(type->FullName());
+         //cout << "ExtractionIncpMap ADD : " << type->FullName()->ToCString() << endl;
+         Handle(TColStd_HSequenceOfHAsciiString) inh = stdclass->GetFullInheritsNames();
+
+         for (k = 1; k <= inh->Length(); k++) {
+           if (!ExtractionIncpMap.Contains(inh->Value(k)) && !ExtractionMap.Contains(inh->Value(k)) && !ExtractionSemiMap.Contains(inh->Value(k))) {
+             ExtractionIncpMap.Add(inh->Value(k));
+             //cout << "ExtractionIncpMap ADD : " << inh->Value(k)->ToCString() << endl;
+           }
+         }
+       }
+      }
+      else if (type->IsKind(STANDARD_TYPE(MS_Enum))) {
+       if (!ExtractionMap.Contains(type->FullName())) {
+         ExtractionMap.Add(type->FullName());
+       }
+      }
+    }
+    else {
+      ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+      Standard_NoSuchObject::Raise();
+    }
+  }
+}
+
+// we look for parameters types that must be extracted
+//
+void MS::StubMethodsTypesToExtract(const Handle(MS_MetaSchema)& aMeta,
+                                  const Handle(MS_Common)&     aCommon,
+                                  WOKTools_MapOfHAsciiString&  ExtractionMap,
+                                  WOKTools_MapOfHAsciiString&  ExtractionIncpMap,
+                                  WOKTools_MapOfHAsciiString& ExtractionSemiMap)
+{
+  Standard_Integer                 i,j,k,len;
+  Handle(MS_HSequenceOfMemberMet)  aSeqMM;
+  Handle(MS_HSequenceOfExternMet)  aSeqEM;
+  Handle(MS_HArray1OfParam)      params;
+  Handle(TCollection_HAsciiString) parname;
+  Handle(MS_Type)                  type;
+  Handle(MS_Class)                 aClass;
+  Handle(MS_Package)               aPackage;
+  Standard_Boolean                 IsClass;
+  Handle(MS_Param)                 returnType;
+
+  if (aCommon->IsKind(STANDARD_TYPE(MS_Class))) {
+    IsClass = Standard_True;
+    aClass  = *((Handle(MS_Class)*)&aCommon);
+    aSeqMM  = aClass->GetMethods();
+    len     = aSeqMM->Length();
+  }
+  else {
+    IsClass  = Standard_False;
+    aPackage = *((Handle(MS_Package)*)&aCommon);
+    aSeqEM   = aPackage->Methods();
+    len      = aSeqEM->Length();
+  }
+
+
+  for (i = 1; i <= len; i++) {
+    if (IsClass) {
+      params = aSeqMM->Value(i)->Params();
+      returnType = aSeqMM->Value(i)->Returns();
+    }
+    else {
+      //cout << "StubMethodsTypesToExtract :: " << aSeqEM->Value(i)->FullName()->ToCString();
+      params = aSeqEM->Value(i)->Params();
+      returnType = aSeqEM->Value(i)->Returns();
+    }
+    
+    if(!params.IsNull()) {
+      for (j = 1; j <= params->Length(); j++) {
+       parname = params->Value(j)->TypeName();
+
+       if (aMeta->IsDefined(parname)) {
+         type = aMeta->GetType(parname);
+
+         if (type->IsKind(STANDARD_TYPE(MS_Alias))) {
+           Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&type);
+
+           parname = analias->DeepType();
+
+           if (aMeta->IsDefined(parname)) {
+             type = aMeta->GetType(parname);
+           }
+           else {
+             ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+             Standard_NoSuchObject::Raise();
+           }
+         }
+
+         if (type->IsKind(STANDARD_TYPE(MS_StdClass)) && !type->IsKind(STANDARD_TYPE(MS_Error))) {
+           Handle(MS_StdClass) stdclass = *((Handle(MS_StdClass)*)&type);
+
+           if (!ExtractionIncpMap.Contains(parname) && !ExtractionMap.Contains(parname) && !ExtractionSemiMap.Contains(parname)) {
+             ExtractionIncpMap.Add(parname);
+             //cout << "ExtractionIncpMap ADD : " << parname->ToCString() << endl;
+             Handle(TColStd_HSequenceOfHAsciiString) inh = stdclass->GetFullInheritsNames();
+
+             for (k = 1; k <= inh->Length(); k++) {
+               if (!ExtractionIncpMap.Contains(inh->Value(k)) && !ExtractionMap.Contains(inh->Value(k)) && !ExtractionSemiMap.Contains(inh->Value(k))) {
+                 ExtractionIncpMap.Add(inh->Value(k));
+                 //cout << "ExtractionIncpMap ADD : " << inh->Value(k)->ToCString() << endl;
+               }
+             }
+           }
+         }
+         else if (type->IsKind(STANDARD_TYPE(MS_Enum))) {
+           if (!ExtractionMap.Contains(type->FullName())) {
+             ExtractionMap.Add(type->FullName());
+           }
+         }
+       }
+       else {
+         ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+         Standard_NoSuchObject::Raise();
+       }
+      }
+    }
+    
+    if (!returnType.IsNull()) {
+      parname = returnType->TypeName();
+
+      if (aMeta->IsDefined(parname)) {
+       type = aMeta->GetType(parname);
+
+       if (type->IsKind(STANDARD_TYPE(MS_Alias))) {
+         Handle(MS_Alias) analias = *((Handle(MS_Alias)*)&type);
+         
+         parname = analias->DeepType();
+         
+         if (aMeta->IsDefined(parname)) {
+           type = aMeta->GetType(parname);
+         }
+         else {
+           ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+           Standard_NoSuchObject::Raise();
+         }
+       }
+
+       if (type->IsKind(STANDARD_TYPE(MS_StdClass)) && !type->IsKind(STANDARD_TYPE(MS_Error))) {
+         Handle(MS_StdClass) stdclass = *((Handle(MS_StdClass)*)&type);
+
+         if (!ExtractionIncpMap.Contains(type->FullName()) && 
+             !ExtractionMap.Contains(type->FullName()) && 
+             !ExtractionSemiMap.Contains(type->FullName())) {
+           ExtractionIncpMap.Add(type->FullName());
+           //cout << "ExtractionIncpMap ADD : " << type->FullName()->ToCString() << endl;
+           Handle(TColStd_HSequenceOfHAsciiString) inh = stdclass->GetFullInheritsNames();
+
+           for (k = 1; k <= inh->Length(); k++) {
+             if (!ExtractionIncpMap.Contains(inh->Value(k)) && 
+                 !ExtractionMap.Contains(inh->Value(k)) && 
+                 !ExtractionSemiMap.Contains(inh->Value(k))) {
+               ExtractionIncpMap.Add(inh->Value(k));
+               //cout << "ExtractionIncpMap ADD : " << inh->Value(k)->ToCString() << endl;
+             }
+           }
+         }
+       }
+       else if (type->IsKind(STANDARD_TYPE(MS_Enum))) {
+         if (!ExtractionMap.Contains(type->FullName())) {
+           ExtractionMap.Add(type->FullName());
+         }
+       }
+      }
+      else {
+       ErrorMsg << "MS" << "Type " << parname << " not defined..." << endm;
+       Standard_NoSuchObject::Raise();
+      }
+    }
+  }
+
+  //cout << "StubMethodsTypesToExtract :: END" << endl;
+}
diff --git a/src/MS/MS_AccessMode.hxx b/src/MS/MS_AccessMode.hxx
new file mode 100755 (executable)
index 0000000..dbffd23
--- /dev/null
@@ -0,0 +1,15 @@
+#define MS_MUTABLE   0x01
+#define MS_IMMUTABLE 0x02
+#define MS_IN        0x04
+#define MS_OUT       0x08
+#define MS_OUT       0x08
+#define MS_INOUT     0x10
+#define MS_ANY       0x20
+#define MS_LIKE      0x40
+#define MS_GENITEM   0x80
+
+#define MSINSTMET_STATIC    0x01
+#define MSINSTMET_DEFERRED  0x02
+#define MSINSTMET_REDEFINED 0x04
+#define MSINSTMET_MUTABLE   0x08
+#define MSINSTMET_OUT       0x10
diff --git a/src/MS/MS_Alias.cdl b/src/MS/MS_Alias.cdl
new file mode 100755 (executable)
index 0000000..0226544
--- /dev/null
@@ -0,0 +1,35 @@
+-- File:       MS_Alias.cdl
+-- Created:    Mon Aug 23 18:46:43 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+class Alias 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits NatType from MS
+    uses 
+       Type   from MS,
+       HAsciiString from TCollection
+
+is
+
+    Create(aName, aPackage, aContainer: HAsciiString; aPrivate: Boolean) 
+       returns mutable Alias from MS;
+    
+    Type(me: mutable; aType: HAsciiString; aPackage: HAsciiString);
+    Type(me)
+       returns mutable HAsciiString from TCollection;
+    ---C++:return const &
+
+    DeepType(me)
+       returns mutable HAsciiString from TCollection;   
+    ---Purpose: returns the real type of the alias (used if the alias type is already an alias).
+    
+fields
+
+    myType         : HAsciiString from TCollection;
+
+end Alias from MS;
diff --git a/src/MS/MS_Alias.cxx b/src/MS/MS_Alias.cxx
new file mode 100755 (executable)
index 0000000..a990b54
--- /dev/null
@@ -0,0 +1,53 @@
+#include <MS_Alias.ixx>
+#include <Standard_NullObject.hxx>
+#include <MS.hxx>
+#include <MS_MetaSchema.hxx>
+
+MS_Alias::MS_Alias(const Handle(TCollection_HAsciiString)& aName, 
+                  const Handle(TCollection_HAsciiString)& aPackage, 
+                  const Handle(TCollection_HAsciiString)& aContainer, 
+                  const Standard_Boolean aPrivate) : MS_NatType(aName,aPackage,aContainer,aPrivate)
+{
+}
+
+void MS_Alias::Type(const Handle(TCollection_HAsciiString)& aType, 
+                   const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (aType.IsNull()) {
+    Standard_NullObject::Raise("MS_Alias::Type - aType is NULL");
+  }
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Alias::Type - aPackage is NULL");
+  }
+
+  myType = MS::BuildFullName(aPackage,aType);
+}
+
+const Handle(TCollection_HAsciiString)& MS_Alias::Type() const 
+{
+  return myType;
+}
+
+
+Handle(TCollection_HAsciiString) MS_Alias::DeepType() const
+{
+  Handle(MS_Alias)                 alias; 
+  Handle(TCollection_HAsciiString) realType = myType;
+  Standard_Boolean                 mustGoDown = Standard_False;
+  if (GetMetaSchema()->IsDefined(realType)) {
+    mustGoDown = GetMetaSchema()->GetType(realType)->IsKind(STANDARD_TYPE(MS_Alias));
+  }
+
+  while (mustGoDown) {
+    alias = Handle(MS_Alias)::DownCast(GetMetaSchema()->GetType(realType));
+    realType = alias->Type();
+
+    if (GetMetaSchema()->IsDefined(realType)) {
+      mustGoDown = GetMetaSchema()->GetType(realType)->IsKind(STANDARD_TYPE(MS_Alias));
+    }
+  }
+
+  return realType;
+} 
diff --git a/src/MS/MS_Class.cdl b/src/MS/MS_Class.cdl
new file mode 100755 (executable)
index 0000000..53bfca0
--- /dev/null
@@ -0,0 +1,137 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Class.cdl   1.1
+-- File:       MS_Class.cdl
+-- Created:    Tue Jan 29 11:41:42 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class Class 
+
+    from MS 
+    inherits Type from MS
+
+       ---Purpose: 
+
+    uses 
+       GenClass             from MS,
+       Package              from MS,
+       Field                from MS,
+       Method               from MS,
+       MemberMet            from MS,
+       HAsciiString         from TCollection,
+       HSequenceOfHAsciiString from TColStd,
+        HSequenceOfClass     from MS,
+       HSequenceOfType      from MS,
+       HSequenceOfField     from MS,
+       HSequenceOfMemberMet from MS,
+       HSequenceOfError     from MS,
+       HSequenceOfMethod    from MS
+
+is
+
+    Initialize(aName: HAsciiString; aPackage: HAsciiString);
+    Initialize(aName, aPackage : HAsciiString;
+              Mother : HAsciiString from TCollection; 
+              aPrivate, aDeferred, aInComplete: Boolean);
+              
+    Validity(me; aName: HAsciiString; aPackage: HAsciiString)
+       is deferred;
+    
+    Deferred(me: mutable; aDeferred: Boolean);
+    Deferred(me)
+       returns Boolean;
+    
+    Private(me: mutable; aPrivate: Boolean);
+    Private(me)
+       returns Boolean;
+
+    Check(me; aName: HAsciiString; aPackage: HAsciiString);
+    
+    Inherit(me : mutable; aClass : HAsciiString from TCollection);
+    Inherit(me : mutable; aClass : Class from MS);
+    Inherit(me : mutable; aClass : HAsciiString; aPackage: HAsciiString);
+    GetInherits(me)
+       returns HSequenceOfClass from MS;
+    GetInheritsNames(me)     
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    ---Purpose: returns the first ancestors
+  
+    GetFullInheritsNames(me : mutable)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    ---Purpose: returns the full inheritance of <me>
+  
+    Use(me: mutable; aClass: HAsciiString from TCollection);
+    Use(me: mutable; aClass: HAsciiString; aPackage: HAsciiString);
+    GetUses(me)
+       returns mutable HSequenceOfType from MS;
+    GetUsesNames(me)
+       returns HSequenceOfHAsciiString from TColStd;
+       
+    Field(me: mutable; aField: Field from MS);
+    GetFields(me)
+       returns mutable HSequenceOfField from MS;
+
+    Method(me: mutable; aMethod: MemberMet from MS);
+    GetMethods(me)
+       returns mutable HSequenceOfMemberMet from MS; 
+
+    Raises(me: mutable; aExcept: HAsciiString from TCollection);
+    Raises(me: mutable; aExcept: HAsciiString; aPackage: HAsciiString);
+    GetRaises(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+
+    FriendMet(me: mutable; aMethod: HAsciiString from TCollection);
+    GetFriendMets(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+
+    Friend(me: mutable; aClass: HAsciiString from TCollection);
+    Friend(me: mutable; aClass: HAsciiString; aPackage: HAsciiString);
+    Friend(me: mutable; aClass: Class from MS);
+    GetFriendsNames(me)
+       returns HSequenceOfHAsciiString from TColStd;
+
+    Incomplete(me: mutable; aIncomplete: Boolean) is virtual;
+    Incomplete(me)
+       returns Boolean is virtual;
+
+    Mother(me : mutable; aMother : HAsciiString from TCollection);
+    GetMother(me)
+       returns HAsciiString from TCollection;
+    ---Level: Internal
+    
+    IsNested(me)
+       returns Boolean from Standard;  
+    NestingClass(me : mutable; aNesting  : HAsciiString from TCollection);
+    GetNestingClass(me)
+       returns HAsciiString from TCollection;
+    
+    IsPersistent(me : mutable)
+       returns Boolean from Standard;
+       
+    IsTransient(me : mutable)
+       returns Boolean from Standard;
+       
+    IsStorable(me : mutable)
+       returns Boolean from Standard;
+       
+fields
+
+    myIncomplete : Boolean                 from Standard;
+    myDeferred   : Boolean                 from Standard;
+    myPrivate    : Boolean                 from Standard;
+    myInherits   : HSequenceOfHAsciiString from TColStd;
+    myUses       : HSequenceOfHAsciiString from TColStd;
+    myFields     : HSequenceOfField        from MS;
+    myMethods    : HSequenceOfMemberMet    from MS;
+    myRaises     : HSequenceOfHAsciiString from TColStd;
+    myFriendMets : HSequenceOfHAsciiString from TColStd;
+    myFriends    : HSequenceOfHAsciiString from TColStd;
+    myMother     : HAsciiString            from TCollection;
+    myNestingClass : HAsciiString            from TCollection;
+    
+end Class from MS;
+
+
+
diff --git a/src/MS/MS_Class.cxx b/src/MS/MS_Class.cxx
new file mode 100755 (executable)
index 0000000..fa91ff1
--- /dev/null
@@ -0,0 +1,410 @@
+#include <MS_Class.ixx>
+#include <MS_MetaSchema.hxx>
+#include <MS_StdClass.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <MS.hxx>
+
+MS_Class::MS_Class(const Handle(TCollection_HAsciiString)& aName, 
+       const Handle(TCollection_HAsciiString)& aPackage) : MS_Type(aName)
+{
+  if (!aPackage.IsNull()) {
+    Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aName);
+    
+    Package(aPackage);
+    
+    FullName(aFullName);
+    myInherits       = new TColStd_HSequenceOfHAsciiString;
+    myUses           = new TColStd_HSequenceOfHAsciiString;
+    myRaises         = new TColStd_HSequenceOfHAsciiString;
+    myMethods        = new MS_HSequenceOfMemberMet;
+    myFields         = new MS_HSequenceOfField;
+    myFriendMets     = new TColStd_HSequenceOfHAsciiString;
+    myFriends        = new TColStd_HSequenceOfHAsciiString;
+    myIncomplete     = Standard_True;
+    myPrivate        = Standard_False;
+    myDeferred       = Standard_False;
+  }
+  else {
+    Standard_NullObject::Raise("MS_Class::MS_Class - aPakage is NULL");
+  }
+}
+
+MS_Class::MS_Class(const Handle(TCollection_HAsciiString)& aName, 
+                  const Handle(TCollection_HAsciiString)& aPackage, 
+                  const Handle(TCollection_HAsciiString)& Mother, 
+                  const Standard_Boolean aPrivate, 
+                  const Standard_Boolean aDeferred, 
+                  const Standard_Boolean aInComplete) : MS_Type(aName)
+{
+  if (!aPackage.IsNull()) {
+    Handle(TCollection_HAsciiString) aFullName =  MS::BuildFullName(aPackage,aName);
+    
+    if (GetMetaSchema() != (MS_MetaSchemaPtr)UndefinedHandleAddress) {
+      Package(aPackage);
+    }
+    
+    myIncomplete     = aInComplete;
+    myPrivate        = aPrivate;
+    myDeferred       = aDeferred;
+    myMother         = Mother;
+    myInherits       = new TColStd_HSequenceOfHAsciiString;
+    myUses           = new TColStd_HSequenceOfHAsciiString;
+    myRaises         = new TColStd_HSequenceOfHAsciiString;
+    myMethods        = new MS_HSequenceOfMemberMet;
+    myFields         = new MS_HSequenceOfField;
+    myFriendMets     = new TColStd_HSequenceOfHAsciiString;
+    myFriends        = new TColStd_HSequenceOfHAsciiString;
+    
+    FullName(aFullName);
+  }
+  else {
+    Standard_NullObject::Raise("MS_Class::MS_Class - aPakage is NULL");
+  }
+}
+
+void MS_Class::Deferred(const Standard_Boolean aDeferred)
+{
+  myDeferred = aDeferred;
+}
+
+Standard_Boolean MS_Class::Deferred() const 
+{
+  return myDeferred;
+}
+
+void MS_Class::Private(const Standard_Boolean aPrivate)
+{
+  myPrivate = aPrivate;
+}
+
+Standard_Boolean MS_Class::Private() const 
+{
+  return myPrivate;
+}
+
+void MS_Class::Check(const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+}
+
+void MS_Class::Inherit(const Handle(MS_Class)& aClass)
+{
+  if (!aClass.IsNull()) {
+    myInherits->Append(aClass->FullName());
+  }
+  else {
+    Standard_NullObject::Raise("MS_Class::MS_Inherit - aClass is NULL");
+  }
+}
+
+void MS_Class::Inherit(const Handle(TCollection_HAsciiString)& aClass, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aClass);
+  
+  myInherits->Append(aFullName);
+}
+
+void MS_Class::Inherit(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myInherits->Append(aClass);
+}
+
+Handle(MS_HSequenceOfClass) MS_Class::GetInherits() const 
+{
+  Handle(MS_HSequenceOfClass) aClassSeq;
+  
+  if (GetMetaSchema() != UndefinedHandleAddress) {    
+    Standard_Integer i;
+    
+    for (i = 1; i <= myInherits->Length(); i++) {
+      if (GetMetaSchema()->IsDefined(myInherits->Value(i))) {
+       Standard_Boolean WrongAncestor = Standard_False;
+       Handle(MS_Type)  aType         = GetMetaSchema()->GetType(myInherits->Value(i));
+       Handle(MS_Class) aClass        = Handle(MS_Class)::DownCast(aType);
+       
+       if (!aClass.IsNull()) {
+         if (aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+           aClassSeq->Append(aClass);
+         }
+         else {
+           WrongAncestor = Standard_True;
+         }
+       }
+       else {
+         WrongAncestor = Standard_True;
+       }
+       
+       if (WrongAncestor) {
+         Handle(TCollection_HAsciiString) ErrorMsg = new TCollection_HAsciiString;
+         
+         ErrorMsg->AssignCat("Error : Class : ");
+         ErrorMsg->AssignCat(FullName());
+         ErrorMsg->AssignCat(" must inherits from a normal class (not generic, nor from a primitive type).");
+         Standard_NoSuchObject::Raise(ErrorMsg->ToCString());
+       }
+      }
+      else {
+       Handle(TCollection_HAsciiString) ErrorMsg = new TCollection_HAsciiString;
+       
+       ErrorMsg->AssignCat("Error : Type ");
+       ErrorMsg->AssignCat(myInherits->Value(i));
+       ErrorMsg->AssignCat(" is not defined.");
+       Standard_NoSuchObject::Raise(ErrorMsg->ToCString());
+      }
+    }
+  }
+  
+  return aClassSeq;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Class::GetFullInheritsNames()
+{
+  Standard_Integer i;
+  Handle(MS_Type)  aType;
+  MS_Class*        aClass = 0l;
+
+  if (GetMetaSchema() == UndefinedHandleAddress) {
+    cerr << "Error : MS_Class::GetFullInheritsNames - Cannot compute inheritance tree without MetaSchema : " << 
+         FullName()->ToCString() << endl;
+    Standard_NoSuchObject::Raise();
+  }
+
+  Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString) listAncestor;
+  Standard_Boolean                        End = Standard_False;
+
+  listAncestor = myInherits;
+
+  if (listAncestor->Length() == 0) {
+    End = Standard_True;
+  }
+
+  while(!End) {
+    for (i = 1; i <= listAncestor->Length(); i++) {
+      result->Append(listAncestor->Value(i));
+    }
+
+    aType        = GetMetaSchema()->GetType(result->Value(result->Length()));
+    aClass       = (MS_Class*)aType.operator->();
+    listAncestor = aClass->GetInheritsNames();
+
+    if (listAncestor->Length() == 0) {
+      End = Standard_True;
+    }
+  }
+
+  return result;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Class::GetInheritsNames() const 
+{
+  return myInherits;
+}
+
+void MS_Class::Use(const Handle(TCollection_HAsciiString)& aClass, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aClass);
+  
+  myUses->Append(aFullName);
+}
+
+void MS_Class::Use(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myUses->Append(aClass);
+}
+
+Handle(MS_HSequenceOfType) MS_Class::GetUses() const 
+{
+  Handle(MS_HSequenceOfType) aTypeSeq;
+  
+  if (GetMetaSchema() != UndefinedHandleAddress) {
+    Standard_Integer           i;
+    
+    aTypeSeq = new MS_HSequenceOfType;
+    
+    for (i = 1; i <= myUses->Length(); i++) {
+      if (GetMetaSchema()->IsDefined(myUses->Value(i))) {
+       aTypeSeq->Append(GetMetaSchema()->GetType(myUses->Value(i)));
+      }
+      else {
+       Handle(TCollection_HAsciiString) aStr = new TCollection_HAsciiString("Error : The type ");
+       
+       aStr->AssignCat(myUses->Value(i));
+       aStr->AssignCat(" is not defined.");
+       Standard_NoSuchObject::Raise(aStr->ToCString());
+      }
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_Class::GetUses - The MetaSchema is NULL.");
+  }
+  
+  return aTypeSeq;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Class::GetUsesNames() const 
+{
+  return myUses;
+}
+
+void MS_Class::Field(const Handle(MS_Field)& aField)
+{
+  if (!aField.IsNull()) {
+    myFields->Append(aField);
+  }
+  else {
+    Standard_NullObject::Raise("MS_Class::MS_Field - aField is NULL");
+  }
+}
+
+Handle(MS_HSequenceOfField) MS_Class::GetFields() const 
+{
+  return myFields;
+}
+
+void MS_Class::Method(const Handle(MS_MemberMet)& aMethod)
+{
+  myMethods->Append(aMethod);
+}
+
+Handle(MS_HSequenceOfMemberMet) MS_Class::GetMethods() const 
+{
+  return myMethods;
+}
+
+void MS_Class::Raises(const Handle(TCollection_HAsciiString)& aExcept, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aExcept);
+  
+  myRaises->Append(aFullName);
+}
+
+void MS_Class::Raises(const Handle(TCollection_HAsciiString)& aExcept)
+{
+  myRaises->Append(aExcept);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Class::GetRaises() const 
+{
+  return myRaises;
+}
+
+void MS_Class::FriendMet(const Handle(TCollection_HAsciiString)& aMethod)
+{
+  myFriendMets->Append(aMethod);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Class::GetFriendMets() const 
+{
+  return myFriendMets;
+}
+
+void MS_Class::Friend(const Handle(TCollection_HAsciiString)& aClass, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aClass);
+  
+  myFriends->Append(aFullName);
+}
+
+void MS_Class::Friend(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString(aClass);
+  
+  myFriends->Append(aFullName);
+}
+
+void MS_Class::Friend(const Handle(MS_Class)& aClass)
+{
+  myFriends->Append(aClass->FullName());
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Class::GetFriendsNames() const 
+{
+  return myFriends;
+}
+
+void MS_Class::Incomplete(const Standard_Boolean aIncomplete)
+{
+  myIncomplete = aIncomplete;
+}
+
+Standard_Boolean MS_Class::Incomplete() const 
+{
+  return myIncomplete;
+}
+
+void MS_Class::Mother(const Handle(TCollection_HAsciiString)& aMother)
+{
+  myMother = aMother;
+}
+
+Handle(TCollection_HAsciiString) MS_Class::GetMother() const 
+{
+  return myMother;
+}
+
+Standard_Boolean MS_Class::IsNested() const
+{
+  return !myNestingClass.IsNull();
+}
+
+void MS_Class::NestingClass(const Handle(TCollection_HAsciiString)& aNesting)
+{
+  myNestingClass = aNesting;
+}
+
+Handle(TCollection_HAsciiString) MS_Class::GetNestingClass() const 
+{
+  return myNestingClass;
+}
+
+Standard_Boolean MS_Class::IsPersistent()
+{
+  Handle(TColStd_HSequenceOfHAsciiString) Ancestors = GetFullInheritsNames();
+  Handle(TCollection_HAsciiString)        Root      = MS::GetPersistentRootName();
+  Standard_Integer                        i;
+
+  if (FullName()->IsSameString(Root))
+    return Standard_True;
+
+  if (Ancestors->Length() == 0) return Standard_False;
+
+  for (i = 1; i <= Ancestors->Length(); i++) {
+    if (Ancestors->Value(i)->IsSameString(Root))
+      return Standard_True;
+  }
+
+  return Standard_False;
+}
+
+Standard_Boolean MS_Class::IsTransient()
+{
+  Handle(TColStd_HSequenceOfHAsciiString) Ancestors = GetFullInheritsNames();
+  Handle(TCollection_HAsciiString)        Root      = MS::GetTransientRootName();
+
+  if (FullName()->IsSameString(Root))
+    return Standard_True;
+
+  if (Ancestors->Length() == 0) return Standard_False;
+
+  if (Ancestors->Value(Ancestors->Length())->IsSameString(Root))
+    return Standard_True;
+  else return Standard_False;
+}
+
+Standard_Boolean MS_Class::IsStorable()
+{
+  Handle(TColStd_HSequenceOfHAsciiString) Ancestors = GetFullInheritsNames();
+  Handle(TCollection_HAsciiString)        Root      = MS::GetStorableRootName();
+
+  if (FullName()->IsSameString(Root))
+    return Standard_True;
+
+  if (Ancestors->Length() == 0) return Standard_False;
+
+  if (Ancestors->Value(Ancestors->Length())->IsSameString(Root))
+    return Standard_True;
+  else return Standard_False;
+}
+
+
diff --git a/src/MS/MS_ClassMet.cdl b/src/MS/MS_ClassMet.cdl
new file mode 100755 (executable)
index 0000000..96a38b7
--- /dev/null
@@ -0,0 +1,25 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_ClassMet.cdl        1.1
+-- File:       MS_ClassMet.cdl
+-- Created:    Wed Jan 30 16:08:59 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class ClassMet 
+
+    from 
+       MS 
+    inherits MemberMet from MS
+    uses
+       HAsciiString from TCollection
+
+       ---Purpose: 
+is
+
+
+    Create (aName: HAsciiString from TCollection; aClass: HAsciiString from TCollection) 
+       returns mutable ClassMet from MS;
+
+end ClassMet from MS;
diff --git a/src/MS/MS_ClassMet.cxx b/src/MS/MS_ClassMet.cxx
new file mode 100755 (executable)
index 0000000..7c3e899
--- /dev/null
@@ -0,0 +1,8 @@
+#include <MS_ClassMet.ixx>
+
+MS_ClassMet::MS_ClassMet(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aClass) : MS_MemberMet(aName,aClass)
+{
+}
+
+
diff --git a/src/MS/MS_Client.cdl b/src/MS/MS_Client.cdl
new file mode 100755 (executable)
index 0000000..42e5789
--- /dev/null
@@ -0,0 +1,45 @@
+-- File:       MS_Client.cdl
+-- Created:    Mon Aug 23 18:07:23 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+class Client
+
+    from 
+       MS 
+    inherits GlobalEntity from MS 
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HSequenceOfExternMet from MS,
+       HSequenceOfMemberMet from MS,
+       MapOfHAsciiString from WOKTools,
+       HAsciiString            from TCollection
+
+is
+
+    Create(aInterface : HAsciiString from TCollection) 
+       returns mutable Client from MS;
+    
+    Interface(me : mutable; anInterface : HAsciiString from TCollection);
+    Interfaces(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+       
+    Method(me : mutable; aMethod : HAsciiString from TCollection);
+    Methods(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    ---Purpose: The methods declared here will have an asynchronous execution
+    --          mode. The 'Create' methods are not allowd here.
+
+    ComputeTypes(me; SeqOfExternMet      : HSequenceOfExternMet from MS;
+                SeqOfMemberMet      : HSequenceOfMemberMet from MS;
+                CompleteMap         : in out MapOfHAsciiString from WOKTools;
+                IncompleteMap       : in out MapOfHAsciiString from WOKTools;
+                SemiCompleteMap     : in out MapOfHAsciiString from WOKTools);
+                
+fields
+    myInterfaces  : HSequenceOfHAsciiString from TColStd;
+    myMethods     : HSequenceOfHAsciiString from TColStd;
+
+end Client from MS;
+
diff --git a/src/MS/MS_Client.cxx b/src/MS/MS_Client.cxx
new file mode 100755 (executable)
index 0000000..2d615e1
--- /dev/null
@@ -0,0 +1,69 @@
+#include <MS_Client.ixx>
+#include <MS.hxx>
+#include <MS_Interface.hxx>
+#include <MS_MetaSchema.hxx>
+
+MS_Client::MS_Client(const Handle(TCollection_HAsciiString)& aClient) : MS_GlobalEntity(aClient)
+{
+  myInterfaces = new TColStd_HSequenceOfHAsciiString;
+  myMethods    = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_Client::Interface(const Handle(TCollection_HAsciiString)& anInter)
+{
+  myInterfaces->Append(anInter);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Client::Interfaces() const 
+{
+  return myInterfaces;
+}
+
+void MS_Client::Method(const Handle(TCollection_HAsciiString)& aMethod)
+{
+  myMethods->Append(aMethod);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Client::Methods() const 
+{
+  return myMethods;
+}
+
+
+void MS_Client::ComputeTypes(const Handle(MS_HSequenceOfExternMet)& SeqOfExternMet,
+                            const Handle(MS_HSequenceOfMemberMet)& SeqOfMemberMet,
+                            WOKTools_MapOfHAsciiString& ExtractionMap,
+                            WOKTools_MapOfHAsciiString& ExtractionIncpMap,
+                            WOKTools_MapOfHAsciiString& ExtractionSemiMap) const
+{
+  Standard_Integer      i,len = myInterfaces->Length();
+  Handle(MS_Interface)  anInterface;
+  Handle(TCollection_HAsciiString) aName;
+
+  for(i = 1; i <= len; i++) {
+    aName = myInterfaces->Value(i);
+    if (GetMetaSchema()->IsInterface(aName)) {
+      anInterface = GetMetaSchema()->GetInterface(aName);
+    
+      MS::StubClassesToExtract(GetMetaSchema(),anInterface->Classes(),ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+    }
+  }
+
+  for(i = 1; i <= len; i++) {
+    aName = myInterfaces->Value(i);
+    if (GetMetaSchema()->IsInterface(aName)) {
+      anInterface = GetMetaSchema()->GetInterface(aName);
+
+      MS::StubPackagesToExtract(GetMetaSchema(),anInterface,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+    }
+  }
+
+  for(i = 1; i <= len; i++) {
+    aName = myInterfaces->Value(i);
+    if (GetMetaSchema()->IsInterface(aName)) {
+      anInterface = GetMetaSchema()->GetInterface(aName);
+      
+      MS::StubMethodsToExtract(GetMetaSchema(),anInterface,SeqOfExternMet,SeqOfMemberMet,ExtractionMap,ExtractionIncpMap,ExtractionSemiMap);
+    }
+  }
+}
diff --git a/src/MS/MS_Common.cdl b/src/MS/MS_Common.cdl
new file mode 100755 (executable)
index 0000000..e2eb0c5
--- /dev/null
@@ -0,0 +1,46 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Common.cdl  1.1
+-- File:       Common.cdl
+-- Created:    Tue Jan 29 09:59:14 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class Common 
+       ---Purpose:
+
+    from 
+       MS 
+    inherits TShared from MMgt
+    uses 
+       HAsciiString from TCollection,
+       MetaSchemaPtr from MS,
+       MetaSchema from MS
+     
+
+is
+    Initialize(aName: HAsciiString);
+    Initialize(aName: HAsciiString; aMetaSchema : MetaSchema from MS);
+
+    Name(me: mutable; aName:HAsciiString) is virtual;
+    Name(me) returns mutable HAsciiString is virtual;
+    ---C++:return const &
+    --            
+    FullName(me: mutable; aName:HAsciiString) is virtual;
+    FullName(me) returns mutable HAsciiString is virtual;
+    ---C++:return const &
+    
+    MetaSchema(me : mutable; aMetaSchema : MetaSchema from MS);
+    ---Purpose: set the workspace for <me>.
+    
+    GetMetaSchema(me) returns MetaSchemaPtr from MS;
+    ---Purpose: get the workspace of <me>.
+fields
+
+    myName         : HAsciiString from TCollection;
+    myFullName     : HAsciiString from TCollection;
+    myMetaSchema   : MetaSchemaPtr from MS;
+
+end Common from MS;
diff --git a/src/MS/MS_Common.cxx b/src/MS/MS_Common.cxx
new file mode 100755 (executable)
index 0000000..3e37942
--- /dev/null
@@ -0,0 +1,50 @@
+#include <MS_Common.ixx>
+#include <Standard_NullObject.hxx>
+
+MS_Common::MS_Common(const Handle(TCollection_HAsciiString)& aName) : myName(aName),myFullName(aName),myMetaSchema((MS_MetaSchemaPtr)UndefinedHandleAddress)
+{
+}
+
+MS_Common::MS_Common(const Handle(TCollection_HAsciiString)& aName, const Handle(MS_MetaSchema)& aMetaSchema) : myName(aName),myFullName(aName),myMetaSchema(aMetaSchema.operator->())
+{
+}
+
+void MS_Common::Name(const Handle(TCollection_HAsciiString)& aName)
+{
+  if (!aName.IsNull()) {
+    myName       = aName;
+  }
+  else {
+    Standard_NullObject::Raise("MS_Common::Name - aName is NULL");
+  }
+}
+
+const Handle(TCollection_HAsciiString)& MS_Common::Name() const 
+{
+  return myName;
+}
+
+void MS_Common::FullName(const Handle(TCollection_HAsciiString)& aName)
+{
+  if (!aName.IsNull()) {
+    myFullName       = aName;
+  }
+  else {
+    Standard_NullObject::Raise("MS_Common::FullName - aName is NULL");
+  }
+}
+
+const Handle(TCollection_HAsciiString)& MS_Common::FullName() const 
+{
+  return myFullName;
+}
+
+void MS_Common::MetaSchema(const Handle(MS_MetaSchema)& aMetaSchema)
+{
+  myMetaSchema = aMetaSchema.operator->();
+}
+
+MS_MetaSchemaPtr MS_Common::GetMetaSchema() const 
+{
+  return myMetaSchema;
+}
diff --git a/src/MS/MS_Component.cdl b/src/MS/MS_Component.cdl
new file mode 100755 (executable)
index 0000000..91fe878
--- /dev/null
@@ -0,0 +1,35 @@
+-- File:       MS_Component.cdl
+-- Created:    Mon Aug 23 18:19:49 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+class Component 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Exec from MS 
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString from TCollection
+
+is
+
+    Create(anComponent :HAsciiString) 
+       returns mutable Component from MS;
+    
+    Use(me: mutable; aComponent: HAsciiString);
+    Uses(me) returns mutable HSequenceOfHAsciiString from TColStd;
+          
+    Interface(me: mutable; aInterface: HAsciiString);
+    Interfaces(me) returns mutable HSequenceOfHAsciiString from TColStd;
+
+fields
+
+    myUses       : HSequenceOfHAsciiString from TColStd;
+    myInterfaces : HSequenceOfHAsciiString from TColStd;
+
+end Component from MS;
+
+
diff --git a/src/MS/MS_Component.cxx b/src/MS/MS_Component.cxx
new file mode 100755 (executable)
index 0000000..09b12e8
--- /dev/null
@@ -0,0 +1,29 @@
+#include <MS_Component.ixx>
+
+MS_Component::MS_Component(const Handle(TCollection_HAsciiString)& anComponent) : MS_Exec(anComponent)
+{
+  myUses = new TColStd_HSequenceOfHAsciiString;
+  myInterfaces = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_Component::Use(const Handle(TCollection_HAsciiString)& aComponent)
+{
+  myUses->Append(aComponent);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Component::Uses() const 
+{
+  return myUses;
+}
+
+void MS_Component::Interface(const Handle(TCollection_HAsciiString)& aInterface)
+{
+  myInterfaces->Append(aInterface);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Component::Interfaces() const 
+{
+  return myInterfaces;
+}
+
+
diff --git a/src/MS/MS_Construc.cdl b/src/MS/MS_Construc.cdl
new file mode 100755 (executable)
index 0000000..2bd4b09
--- /dev/null
@@ -0,0 +1,26 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Construc.cdl        1.1
+-- File:       MS_Construc.cdl
+-- Created:    Wed Jan 30 16:08:59 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class Construc 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits MemberMet from MS
+
+    uses 
+       HAsciiString from TCollection
+       
+is
+    Create (aName: HAsciiString from TCollection; aClass: HAsciiString from TCollection) 
+       returns mutable Construc from MS;
+
+end Construc from MS;
+
+
diff --git a/src/MS/MS_Construc.cxx b/src/MS/MS_Construc.cxx
new file mode 100755 (executable)
index 0000000..c35733c
--- /dev/null
@@ -0,0 +1,8 @@
+#include <MS_Construc.ixx>
+
+MS_Construc::MS_Construc(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aClass) : MS_MemberMet(aName,aClass)
+{
+}
+
+
diff --git a/src/MS/MS_Defines.hxx b/src/MS/MS_Defines.hxx
new file mode 100755 (executable)
index 0000000..5e02c0f
--- /dev/null
@@ -0,0 +1,13 @@
+// PACKAGEROOTNAME    Standard
+// EXCEPTIONROOTNAME  Failure
+// MMGTROOTNAME       MMgt
+// PERSISTENTROOTNAME Persistent
+// TRANSIENTROOTNAME  Transient
+// STORABLEROOTNAME   Storable
+
+extern  Handle(TCollection_HAsciiString) PackageRootName;
+extern  Handle(TCollection_HAsciiString) ExceptionRootName;
+extern  Handle(TCollection_HAsciiString) MMgtRootName;
+extern  Handle(TCollection_HAsciiString) PersistentRootName;
+extern  Handle(TCollection_HAsciiString) TransientRootName;
+extern  Handle(TCollection_HAsciiString) StorableRootName;
diff --git a/src/MS/MS_Engine.cdl b/src/MS/MS_Engine.cdl
new file mode 100755 (executable)
index 0000000..edd410a
--- /dev/null
@@ -0,0 +1,35 @@
+-- File:       MS_Engine.cdl
+-- Created:    Mon Aug 23 18:19:49 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+class Engine 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Exec from MS 
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString from TCollection
+
+is
+
+    Create(anEngine :HAsciiString) 
+       returns mutable Engine from MS;
+    
+    Use(me: mutable; aEngine: HAsciiString);
+    Uses(me) returns mutable HSequenceOfHAsciiString from TColStd;
+          
+    Interface(me: mutable; aInterface: HAsciiString);
+    Interfaces(me) returns mutable HSequenceOfHAsciiString from TColStd;
+
+fields
+
+    myUses       : HSequenceOfHAsciiString from TColStd;
+    myInterfaces : HSequenceOfHAsciiString from TColStd;
+
+end Engine from MS;
+
+
diff --git a/src/MS/MS_Engine.cxx b/src/MS/MS_Engine.cxx
new file mode 100755 (executable)
index 0000000..e63f4f0
--- /dev/null
@@ -0,0 +1,29 @@
+#include <MS_Engine.ixx>
+
+MS_Engine::MS_Engine(const Handle(TCollection_HAsciiString)& anEngine) : MS_Exec(anEngine)
+{
+  myUses = new TColStd_HSequenceOfHAsciiString;
+  myInterfaces = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_Engine::Use(const Handle(TCollection_HAsciiString)& aEngine)
+{
+  myUses->Append(aEngine);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Engine::Uses() const 
+{
+  return myUses;
+}
+
+void MS_Engine::Interface(const Handle(TCollection_HAsciiString)& aInterface)
+{
+  myInterfaces->Append(aInterface);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Engine::Interfaces() const 
+{
+  return myInterfaces;
+}
+
+
diff --git a/src/MS/MS_Enum.cdl b/src/MS/MS_Enum.cdl
new file mode 100755 (executable)
index 0000000..2040696
--- /dev/null
@@ -0,0 +1,43 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Enum.cdl    1.1
+-- File:       MS_Enum.cdl
+-- Created:    Wed Jan 30 12:38:17 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class Enum 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits NatType from MS
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString from TCollection
+
+is
+
+    Create(aName, aPackage, aContainer: HAsciiString; aPrivate: Boolean) 
+       returns mutable Enum from MS;
+    
+    Enum(me: mutable; aEnum: HAsciiString);
+    Enums(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+       
+    Check(me);
+
+fields
+
+    myEnums        : HSequenceOfHAsciiString from TColStd;
+
+end Enum from MS;
+
+
+
+
+
+
+
+
diff --git a/src/MS/MS_Enum.cxx b/src/MS/MS_Enum.cxx
new file mode 100755 (executable)
index 0000000..37def79
--- /dev/null
@@ -0,0 +1,45 @@
+#include <MS_Enum.ixx>
+#include <Standard_NullObject.hxx>
+#include <MS.hxx>
+#include <MS_Package.hxx>
+
+MS_Enum::MS_Enum(const Handle(TCollection_HAsciiString)& aName, 
+                const Handle(TCollection_HAsciiString)& aPackage, 
+                const Handle(TCollection_HAsciiString)& aContainer, 
+                const Standard_Boolean aPrivate) : MS_NatType(aName,aPackage,aContainer,aPrivate) 
+{
+  myEnums = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_Enum::Enum(const Handle(TCollection_HAsciiString)& anEnum)
+{
+  if (anEnum.IsNull()) {
+    Standard_NullObject::Raise("MS_Enum::Enum - anEnum is NULL");
+  }
+
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(Package()->Name(),anEnum);
+
+  myEnums->Append(aFullName);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Enum::Enums() const 
+{
+  return myEnums;
+}
+
+void MS_Enum::Check() const 
+{
+  Standard_Integer len = myEnums->Length();
+  Standard_Integer i,j;
+  for (i = 1; i <= len; i++) {
+     for (j = i + 1; j <= len; j++) {
+       if (myEnums->Value(i)->IsSameString(myEnums->Value(j))) {
+        cout << "Error : Value " << myEnums->Value(j)->ToCString() 
+              << " is defined twice in enumeration " << FullName()->ToCString() << endl;
+        Standard_NullObject::Raise("");
+       }
+     }
+  }
+}
+
diff --git a/src/MS/MS_Error.cdl b/src/MS/MS_Error.cdl
new file mode 100755 (executable)
index 0000000..5db967c
--- /dev/null
@@ -0,0 +1,29 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Error.cdl   1.1
+-- File:       MS_Error.cdl
+-- Created:    Wed Jan 30 11:32:05 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class Error 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits StdClass from MS
+    uses HAsciiString     from TCollection,
+        GenClass         from MS
+
+is
+    Create(aName: HAsciiString; aPackage: HAsciiString)
+       returns mutable Error from MS;
+
+    Create(aName, aPackage, Mother : HAsciiString;
+          aPrivate, aDeferred, aInComplete: Boolean)
+       returns mutable Error from MS;
+              
+    Validity(me; aName: HAsciiString; aPackage: HAsciiString) is redefined;
+    
+end Error from MS;
+
diff --git a/src/MS/MS_Error.cxx b/src/MS/MS_Error.cxx
new file mode 100755 (executable)
index 0000000..17cddfe
--- /dev/null
@@ -0,0 +1,23 @@
+#include <MS_Error.ixx>
+#include <Standard_NullObject.hxx>
+
+MS_Error::MS_Error(const Handle(TCollection_HAsciiString)& aName, 
+                  const Handle(TCollection_HAsciiString)& aPackage) : MS_StdClass(aName,aPackage)
+{
+  Incomplete(Standard_False);
+}
+
+MS_Error::MS_Error(const Handle(TCollection_HAsciiString)& aName, 
+                  const Handle(TCollection_HAsciiString)& aPackage, 
+                  const Handle(TCollection_HAsciiString)& Mother, 
+                  const Standard_Boolean aPrivate, 
+                  const Standard_Boolean aDeferred, 
+                  const Standard_Boolean aInComplete) : MS_StdClass(aName,aPackage,Mother,aPrivate,aDeferred,aInComplete)
+{
+  Incomplete(Standard_False);
+}
+
+void MS_Error::Validity(const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+}
+
diff --git a/src/MS/MS_Errors.hxx b/src/MS/MS_Errors.hxx
new file mode 100755 (executable)
index 0000000..593a123
--- /dev/null
@@ -0,0 +1,83 @@
+
+// SCCS        Date: 10/23/91
+//             Information: @(#)MS_Errors.hxx  1.1
+// File: MS_Errors.hxx
+//
+
+#define VERBOSE 0
+#define WARNING 1
+#define ERROR   2
+#define FATAL   3
+
+
+#ifndef MS_Errors_HEADER_
+#define MS_Errors_HEADER_
+
+#include <TCollection_HAsciiString.hxx>
+#include <MS.hxx>
+
+void MS_Errors(Standard_Integer, Standard_CString, Standard_Integer = 0);
+
+static   Handle(TCollection_HAsciiString) MsgErr;
+
+//============================================================================
+inline Handle(TCollection_HAsciiString)& operator+(const Handle(TCollection_HAsciiString)& S1
+                                          ,const Handle(TCollection_HAsciiString)& S2
+                                          )
+{
+  //==== If the S1 is not the same as MsgErr, we initialize MsgErr.
+  if(MsgErr.IsNull())
+    MsgErr = new TCollection_HAsciiString("");
+
+  if (S1 != MsgErr){
+    MsgErr->Remove(1,MsgErr->Length());
+    MsgErr->AssignCat(S1);
+  }
+
+  MsgErr->AssignCat(S2);
+  return(MsgErr);
+}
+
+//============================================================================
+
+inline Handle(TCollection_HAsciiString)& operator+(const Handle(TCollection_HAsciiString)& S1
+                                          ,const Standard_CString S2
+                                          )
+{
+  //==== If the S1 is not the same as MsgErr, we initialize MsgErr.
+  if(MsgErr.IsNull())
+    MsgErr = new TCollection_HAsciiString("");
+
+  if (S1 != MsgErr){
+    MsgErr->Remove(1,MsgErr->Length());
+    MsgErr->AssignCat(S1);
+  }
+
+  MsgErr->AssignCat(new TCollection_HAsciiString(S2));
+
+  return(MsgErr);
+}
+
+
+//============================================================================
+inline void MS_Errors(Standard_Integer Severity, 
+                      Handle(TCollection_HAsciiString)& S1, 
+                      Standard_Integer Code = 0)
+{
+  char Msg[256];
+
+  Standard_Integer size = S1->Length();
+
+  for(int i=0; i< size && i < 256; i++)
+    Msg[i] = S1->Value(i+1);
+
+  Msg[i] = 0;
+  MS_Errors(Severity, Msg, Code);
+  S1->Remove(1,size);
+}
+
+#endif 
+
+
+
+
diff --git a/src/MS/MS_Exec.cdl b/src/MS/MS_Exec.cdl
new file mode 100755 (executable)
index 0000000..b744465
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       MS_Exec.cdl
+
+
+deferred class Exec 
+
+from MS 
+
+inherits GlobalEntity from MS 
+
+uses HAsciiString from TCollection
+
+is
+
+    Initialize(anExec : HAsciiString from TCollection);
+    
+    Schema(me : mutable; aSchema : HAsciiString from TCollection);
+    Schema(me) returns mutable HAsciiString from TCollection;
+
+fields
+
+    mySchema  : HAsciiString from TCollection;
+
+end Exec from MS;
+
diff --git a/src/MS/MS_Exec.cxx b/src/MS/MS_Exec.cxx
new file mode 100755 (executable)
index 0000000..c37076b
--- /dev/null
@@ -0,0 +1,16 @@
+#include <MS_Exec.ixx>
+
+MS_Exec::MS_Exec(const Handle(TCollection_HAsciiString)& anExec) : MS_GlobalEntity(anExec)
+{
+}
+
+void MS_Exec::Schema(const Handle(TCollection_HAsciiString)& aSchema)
+{
+  mySchema = aSchema;
+}
+
+Handle(TCollection_HAsciiString) MS_Exec::Schema() const 
+{
+  return mySchema;
+}
+
diff --git a/src/MS/MS_ExecFile.cdl b/src/MS/MS_ExecFile.cdl
new file mode 100755 (executable)
index 0000000..a459829
--- /dev/null
@@ -0,0 +1,29 @@
+-- File:       MS_ExecFile.cdl
+-- Created:    Mon Feb  5 09:17:58 1996
+-- Author:     Kernel
+--             <kernel@ilebon>
+---Copyright:   Matra Datavision 1996
+
+
+class ExecFile from MS
+
+inherits TShared from MMgt
+
+uses Language     from MS,
+     HAsciiString from TCollection
+
+is
+    Create(aName : HAsciiString from TCollection) returns mutable ExecFile from MS;
+    
+    SetName(me : mutable; aName : HAsciiString from TCollection);
+    Name(me) returns mutable HAsciiString from TCollection;
+    
+    SetLanguage(me : mutable; aLang : Language from MS);
+    Language(me) returns Language from MS;
+    
+    fields
+    
+       myName     : HAsciiString from TCollection;
+       myLanguage : Language     from MS;
+    
+end;
diff --git a/src/MS/MS_ExecFile.cxx b/src/MS/MS_ExecFile.cxx
new file mode 100755 (executable)
index 0000000..99f0033
--- /dev/null
@@ -0,0 +1,28 @@
+#include <MS_ExecFile.ixx>
+
+MS_ExecFile::MS_ExecFile(const Handle(TCollection_HAsciiString)& aName)
+{
+  myName     = aName;
+  myLanguage = MS_CPP;
+}
+
+void MS_ExecFile::SetName(const Handle(TCollection_HAsciiString)& aName)
+{
+  myName     = aName;
+}
+
+Handle(TCollection_HAsciiString) MS_ExecFile::Name() const 
+{
+  return myName;
+}
+
+void MS_ExecFile::SetLanguage(const MS_Language aLang)
+{
+  myLanguage = aLang;
+}
+
+MS_Language MS_ExecFile::Language() const 
+{
+  return myLanguage;
+}
+
diff --git a/src/MS/MS_ExecPart.cdl b/src/MS/MS_ExecPart.cdl
new file mode 100755 (executable)
index 0000000..bca65c4
--- /dev/null
@@ -0,0 +1,35 @@
+-- File:       MS_ExecPart.cdl
+-- Created:    Tue Feb  6 09:04:39 1996
+-- Author:     Kernel
+--             <kernel@ilebon>
+---Copyright:   Matra Datavision 1996
+
+
+class ExecPart from MS
+
+inherits Exec from MS 
+
+uses HSequenceOfHAsciiString from TColStd,
+     HAsciiString            from TCollection,
+     HSequenceOfExecFile     from MS,
+     ExecFile                from MS
+
+is
+
+    Create(anExecutable : HAsciiString from TCollection) returns mutable ExecPart from MS;
+    
+    AddFile(me : mutable; aFile : ExecFile from MS);
+    AddLibrary(me : mutable; aName : HAsciiString from TCollection);
+    AddExternal(me : mutable; aName : HAsciiString from TCollection);
+    
+    Files(me) returns mutable HSequenceOfExecFile from MS;
+    Libraries(me) returns mutable HSequenceOfHAsciiString from TColStd;
+    Externals(me) returns mutable HSequenceOfHAsciiString from TColStd;
+    
+fields
+    myFiles : HSequenceOfExecFile from MS;
+    myLib   : HSequenceOfHAsciiString from TColStd;         
+    myExt   : HSequenceOfHAsciiString from TColStd;
+    
+end ExecPart from MS;
+
diff --git a/src/MS/MS_ExecPart.cxx b/src/MS/MS_ExecPart.cxx
new file mode 100755 (executable)
index 0000000..ad88930
--- /dev/null
@@ -0,0 +1,39 @@
+#include <MS_ExecPart.ixx>
+
+MS_ExecPart::MS_ExecPart(const Handle(TCollection_HAsciiString)& anExecPart) : MS_Exec(anExecPart)
+{
+  myFiles = new MS_HSequenceOfExecFile;
+  myLib   = new TColStd_HSequenceOfHAsciiString;
+  myExt   = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_ExecPart::AddFile(const Handle(MS_ExecFile)& aFile)
+{
+  myFiles->Append(aFile);
+}
+
+void MS_ExecPart::AddLibrary(const Handle(TCollection_HAsciiString)& aName)
+{
+  myLib->Append(aName);
+}
+
+void MS_ExecPart::AddExternal(const Handle(TCollection_HAsciiString)& aName)
+{
+  myExt->Append(aName);
+}
+
+Handle(MS_HSequenceOfExecFile) MS_ExecPart::Files() const 
+{
+  return myFiles;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_ExecPart::Libraries() const 
+{
+  return myLib;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_ExecPart::Externals() const 
+{
+  return myExt;
+}
+
diff --git a/src/MS/MS_Executable.cdl b/src/MS/MS_Executable.cdl
new file mode 100755 (executable)
index 0000000..4b119b5
--- /dev/null
@@ -0,0 +1,26 @@
+-- File:       MS_Executable.cdl
+-- Created:    Mon Feb  5 09:17:58 1996
+-- Author:     Kernel
+--             <kernel@ilebon>
+---Copyright:   Matra Datavision 1996
+
+class Executable from MS
+
+inherits Exec from MS 
+
+uses HSequenceOfHAsciiString from TColStd,
+     HAsciiString            from TCollection,
+     HSequenceOfExecPart     from MS
+
+is
+
+    Create(anExecutable : HAsciiString from TCollection) returns mutable Executable from MS;
+    
+    AddParts(me : mutable; theParts : HSequenceOfExecPart from MS);    
+    Parts(me) returns mutable HSequenceOfExecPart from MS;
+    
+fields
+    myParts   : HSequenceOfExecPart from MS;
+    
+end Executable from MS;
+
diff --git a/src/MS/MS_Executable.cxx b/src/MS/MS_Executable.cxx
new file mode 100755 (executable)
index 0000000..992196c
--- /dev/null
@@ -0,0 +1,16 @@
+#include <MS_Executable.ixx>
+
+MS_Executable::MS_Executable(const Handle(TCollection_HAsciiString)& anExecutable) : MS_Exec(anExecutable)
+{
+}
+
+void MS_Executable::AddParts(const Handle(MS_HSequenceOfExecPart)& theParts)
+{
+  myParts = theParts;
+}
+
+Handle(MS_HSequenceOfExecPart) MS_Executable::Parts() const 
+{
+  return myParts;
+}
+
diff --git a/src/MS/MS_ExternMet.cdl b/src/MS/MS_ExternMet.cdl
new file mode 100755 (executable)
index 0000000..ddce43b
--- /dev/null
@@ -0,0 +1,40 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_ExternMet.cdl       1.1
+-- File:       MS_ExternMet.cdl
+-- Created:    Wed Jan 30 16:08:59 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class ExternMet 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Method from MS
+    uses 
+       Package from MS,
+       MemberMet from MS,
+       Type from MS,
+       HAsciiString from TCollection
+
+is
+    Create(aName: HAsciiString) 
+       returns mutable ExternMet from MS;
+    Create(aName: HAsciiString; aPackage: HAsciiString)
+       returns mutable ExternMet from MS;
+       
+    CreateFullName(me : mutable) is redefined;
+    
+    Package(me: mutable; aPack: HAsciiString from TCollection);
+    Package(me)
+       returns mutable HAsciiString from TCollection;
+       
+    Raises(me: mutable; aExcept: HAsciiString; aPackage: HAsciiString);
+
+fields
+
+    myPackage : HAsciiString from TCollection;
+    
+end ExternMet from MS;
diff --git a/src/MS/MS_ExternMet.cxx b/src/MS/MS_ExternMet.cxx
new file mode 100755 (executable)
index 0000000..5234afa
--- /dev/null
@@ -0,0 +1,42 @@
+#include <MS_ExternMet.ixx>
+
+MS_ExternMet::MS_ExternMet(const Handle(TCollection_HAsciiString)& aName) : MS_Method(aName)
+{
+}
+
+MS_ExternMet::MS_ExternMet(const Handle(TCollection_HAsciiString)& aName, 
+                          const Handle(TCollection_HAsciiString)& aPackage) : MS_Method(aName)
+{
+  myPackage = aPackage;
+}
+
+void MS_ExternMet::CreateFullName() 
+{
+  Handle(TCollection_HAsciiString) myIdName;
+
+  MS_Method::CreateFullName();
+
+  if (!myPackage.IsNull()) {
+    myIdName = new TCollection_HAsciiString(myPackage);
+    myIdName->AssignCat("::");
+    myIdName->AssignCat(FullName());
+    FullName(myIdName);
+  }
+}
+
+void MS_ExternMet::Package(const Handle(TCollection_HAsciiString)& aPack)
+{
+  myPackage = aPack;
+}
+
+Handle(TCollection_HAsciiString) MS_ExternMet::Package() const 
+{
+  return myPackage;
+}
+
+void MS_ExternMet::Raises(const Handle(TCollection_HAsciiString)& aExcept, const Handle(TCollection_HAsciiString)& aPackage)
+{
+}
+
+
+
diff --git a/src/MS/MS_Field.cdl b/src/MS/MS_Field.cdl
new file mode 100755 (executable)
index 0000000..7e499c2
--- /dev/null
@@ -0,0 +1,51 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Field.cdl   1.1
+-- File:       MS_Field.cdl
+-- Created:    Wed Jan 30 16:28:32 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class Field 
+       ---Purpose:
+
+    from 
+       MS 
+    inherits Common from MS
+    uses 
+       Class from MS,
+       HAsciiString from TCollection,
+       HSequenceOfInteger from TColStd
+
+is
+    Create(aClass: Class from MS; aName: HAsciiString) 
+       returns mutable Field from MS;
+    
+    Class(me: mutable; aClass: Class from MS);
+    Class(me)
+       returns mutable Class from MS;
+       
+    TYpe(me : mutable;         aType: HAsciiString from TCollection);
+    TYpe(me: mutable; aType: HAsciiString; aPackage: HAsciiString);
+    TYpe(me)
+       returns mutable HAsciiString from TCollection;
+    ---C++:return const &
+
+    Dimension(me: mutable; aDimension: Integer);
+    Dimensions(me)
+       returns mutable HSequenceOfInteger from TColStd;
+    ---C++:return const &
+
+    Protected(me: mutable; aProtected: Boolean);
+    Protected(me)
+       returns Integer;
+       
+fields
+
+    myClass     : HAsciiString       from TCollection;
+    myType      : HAsciiString       from TCollection;
+    myDimension : HSequenceOfInteger from TColStd;
+    myProtected : Boolean; 
+
+end Field from MS;
diff --git a/src/MS/MS_Field.cxx b/src/MS/MS_Field.cxx
new file mode 100755 (executable)
index 0000000..6020c90
--- /dev/null
@@ -0,0 +1,63 @@
+#include <MS_Field.ixx>
+#include <MS.hxx>
+#include <MS_MetaSchema.hxx>
+
+MS_Field::MS_Field(const Handle(MS_Class)& aClass, 
+                  const Handle(TCollection_HAsciiString)& aName) : myClass(aClass->FullName()),myDimension(new TColStd_HSequenceOfInteger),myProtected(Standard_False),MS_Common(aName)
+{
+}
+
+void MS_Field::Class(const Handle(MS_Class)& aClass)
+{
+  myClass     = aClass->FullName();
+}
+
+Handle(MS_Class) MS_Field::Class() const 
+{
+  Handle(MS_Class) aClass = Handle(MS_Class)::DownCast(GetMetaSchema()->GetType(myClass));
+
+  return aClass;
+}
+
+void MS_Field::TYpe(const Handle(TCollection_HAsciiString)& aType)
+{
+  myType = aType;
+}
+
+void MS_Field::TYpe(const Handle(TCollection_HAsciiString)& aType, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage->IsEmpty()) {
+    myType = MS::BuildFullName(aPackage,aType);
+  }
+  // for generic type
+  //
+  else {
+    myType = aType;
+  }
+}
+
+const Handle(TCollection_HAsciiString)& MS_Field::TYpe() const 
+{
+  return myType;
+}
+
+void MS_Field::Dimension(const Standard_Integer aDimension)
+{
+  myDimension->Append(aDimension);
+}
+
+const Handle(TColStd_HSequenceOfInteger)& MS_Field::Dimensions() const 
+{
+  return myDimension;
+}
+
+void MS_Field::Protected(const Standard_Boolean aProtected)
+{
+  myProtected = aProtected;
+}
+
+Standard_Integer MS_Field::Protected() const 
+{
+  return myProtected;
+}
+
diff --git a/src/MS/MS_GenClass.cdl b/src/MS/MS_GenClass.cdl
new file mode 100755 (executable)
index 0000000..f43e8a9
--- /dev/null
@@ -0,0 +1,65 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_GenClass.cdl        1.1
+-- File:       MS_GenClass.cdl
+-- Created:    Wed Jan 30 11:41:21 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class GenClass 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Class from  MS
+    uses 
+       GenType                 from MS,
+       HSequenceOfGenType      from MS,
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString            from TCollection
+
+is
+    Create(aName: HAsciiString from TCollection; aPackage: HAsciiString from TCollection)
+       returns mutable GenClass from MS;
+    
+    Create(aName, aPackage : HAsciiString from TCollection;
+          aPrivate, aDeferred, aInComplete: Boolean)
+       returns mutable GenClass from MS;
+              
+    NestedStdClass(me: mutable; aClass : HAsciiString from TCollection);
+    NestedInsClass(me: mutable; aClass : HAsciiString from TCollection);
+    GetNestedStdClassesName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    GetNestedInsClassesName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    ---Purpose: these nested are created when the corresponding class is 
+    --          translated, before they are in the Nested group.
+    --          It s only because in the package.cdl we dont know
+    --          if the nested classes of a generic are "standard" or "instantiation".
+
+    AddNested(me : mutable; aClass : HAsciiString from TCollection);
+    RemoveNested(me : mutable; aClass : HAsciiString from TCollection);
+    GetNestedName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    CheckNested(me);
+    ---Purpose: Nested group : each time the definition of a nested class of <me>
+    --          is translated, the class is moved from this group to the "NestStd" or
+    --          "NestedIns".
+    
+    Validity(me; aName: HAsciiString from TCollection; aPackage: HAsciiString from TCollection);
+    
+    GenType(me: mutable; aItem: HAsciiString from TCollection); 
+    GenType(me: mutable; aItem: HAsciiString from TCollection; aConstraint: HAsciiString from TCollection);
+    GenType(me: mutable; aItem: GenType from MS);
+    GenTypes(me)
+       returns mutable HSequenceOfGenType from MS;
+       
+fields
+
+    myGenTypes : HSequenceOfGenType from MS;
+    myNestStd  : HSequenceOfHAsciiString from TColStd;
+    myNestIns  : HSequenceOfHAsciiString from TColStd;
+    myNested   : HSequenceOfHAsciiString from TColStd;
+    
+end GenClass from MS;
+
diff --git a/src/MS/MS_GenClass.cxx b/src/MS/MS_GenClass.cxx
new file mode 100755 (executable)
index 0000000..1490527
--- /dev/null
@@ -0,0 +1,214 @@
+#include <MS_GenClass.ixx>
+#include <MS_TraductionError.hxx>
+#include <MS_GenType.hxx>
+#include <MS_MetaSchema.hxx>
+#include <Standard_NullObject.hxx>
+
+MS_GenClass::MS_GenClass(const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aPackage) 
+: MS_Class(aName,aPackage)
+{
+  myGenTypes = new MS_HSequenceOfGenType; 
+  myNestStd  = new TColStd_HSequenceOfHAsciiString;
+  myNestIns  = new TColStd_HSequenceOfHAsciiString;
+  myNested   = new TColStd_HSequenceOfHAsciiString;
+}
+
+MS_GenClass::MS_GenClass(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aPackage, 
+                        const Standard_Boolean aPrivate, 
+                        const Standard_Boolean aDeferred, 
+                        const Standard_Boolean aInComplete) : MS_Class(aName,aPackage)
+{
+  myGenTypes = new MS_HSequenceOfGenType; 
+  myNestStd  = new TColStd_HSequenceOfHAsciiString;
+  myNestIns  = new TColStd_HSequenceOfHAsciiString;
+  myNested   = new TColStd_HSequenceOfHAsciiString;
+  Private(aPrivate);
+  Deferred(aDeferred);
+  Incomplete(aInComplete);
+}
+
+void MS_GenClass::NestedStdClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Boolean alreadyHere = Standard_False;
+  
+  for (Standard_Integer i = 1; i <= myNestStd->Length() && !alreadyHere; i++) {
+    if (myNestStd->Value(i)->IsSameString(aClass)) {
+      alreadyHere = Standard_True;
+    }
+  }
+  
+  if (!alreadyHere) {
+    myNestStd->Append(aClass);
+  }
+}
+
+void MS_GenClass::NestedInsClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Boolean alreadyHere = Standard_False;
+  
+  for (Standard_Integer i = 1; i <= myNestIns->Length() && !alreadyHere; i++) {
+    if (myNestIns->Value(i)->IsSameString(aClass)) {
+      alreadyHere = Standard_True;
+    }
+  }
+  
+  if (!alreadyHere) {
+    myNestIns->Append(aClass);
+  }
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_GenClass::GetNestedStdClassesName() const 
+{
+  return myNestStd;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_GenClass::GetNestedInsClassesName() const 
+{
+  return myNestIns;
+}
+
+void MS_GenClass::RemoveNested(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Boolean alreadyHere = Standard_False;
+  
+  for (Standard_Integer i = 1; i <= myNested->Length() && !alreadyHere; i++) {
+    if (myNested->Value(i)->IsSameString(aClass)) {
+      alreadyHere = Standard_True;
+      myNested->Remove(i);
+    }
+  }
+}
+
+void MS_GenClass::AddNested(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myNested->Append(aClass);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_GenClass::GetNestedName() const 
+{
+  return myNested;
+}
+
+void MS_GenClass::Validity(const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+}
+
+void MS_GenClass::GenType(const Handle(TCollection_HAsciiString)& anItem)
+{
+  Handle(MS_Type)    tmpType;
+  Handle(MS_GenType) tmpGenType;
+  Standard_Integer   size,i;
+  
+  if (anItem->IsSameString(Name(), Standard_True)) {
+    cout << "Error : MS_GenClass::GenType - the generic type " 
+      << anItem->ToCString() << " and his generic class have the same name." << endl;
+    MS_TraductionError::Raise();
+  }
+  
+  size = myNestStd->Length();
+  
+  for(i = 1; i <= size; i++) {
+    if (anItem->IsSameString(myNestStd->Value(i), Standard_True)) {
+      cout << "Error : MS_GenClass::GenType - the generic type "  << anItem->ToCString() 
+       << " has the same name that a nested standard class." << endl;
+      MS_TraductionError::Raise();
+    }
+  }
+
+  size = myNestIns->Length();
+  
+  for(i = 1; i <= size; i++) {
+    if (anItem->IsSameString(myNestIns->Value(i), Standard_True)) {
+      cout << "Error : MS_GenClass::GenType - the generic type "  << anItem->ToCString() 
+       << " has the same name that a nested instantiated class." << endl;
+      MS_TraductionError::Raise();
+    }
+  }
+
+  size = myGenTypes->Length();
+  
+  for (i = 1; i <= size; i++) {
+    tmpType = myGenTypes->Value(i);
+    
+    if(anItem->IsSameString(tmpType->Name(),Standard_True)) {
+      cout << "Error : MS_GenClass::GenType - the generic type " << anItem->ToCString() 
+       << " is yet defined." << endl;
+      MS_TraductionError::Raise();
+    }
+  }
+  
+  tmpGenType = new MS_GenType(this, anItem);
+  myGenTypes->Append(tmpGenType); 
+}
+
+void MS_GenClass::GenType(const Handle(TCollection_HAsciiString)& anItem, const Handle(TCollection_HAsciiString)& aConstraint)
+{
+  Handle(MS_Type)    tmpType;
+  Handle(MS_GenType) tmpGenType;
+  Standard_Integer   size,i;
+  
+  if (anItem->IsSameString(Name(), Standard_True)) {
+    cout << "Error : MS_GenClass::GenType - the generic type " 
+      << anItem->ToCString() << " and his generic class have the same name." << endl;
+    MS_TraductionError::Raise();
+  }
+  
+  size = myNestStd->Length();
+  
+  for(i = 1; i <= size; i++) {
+    if (anItem->IsSameString(myNestStd->Value(i), Standard_True)) {
+      cout << "Error : MS_GenClass::GenType - the generic type "  << anItem->ToCString() 
+       << " has the same name that a nested standard class." << endl;
+      MS_TraductionError::Raise();
+    }
+  }
+
+  size = myNestIns->Length();
+  
+  for(i = 1; i <= size; i++) {
+    if (anItem->IsSameString(myNestIns->Value(i), Standard_True)) {
+      cout << "Error : MS_GenClass::GenType - the generic type "  << anItem->ToCString() 
+       << " has the same name that a nested instantiated class." << endl;
+      MS_TraductionError::Raise();
+    }
+  }
+
+  size = myGenTypes->Length();
+  
+  for (i = 1; i <= size; i++) {
+    tmpType = myGenTypes->Value(i);
+    
+    if(anItem->IsSameString(tmpType->Name(),Standard_True)) {
+      cout << "Error : MS_GenClass::GenType - the generic type " << anItem->ToCString() 
+       << " is yet defined." << endl;
+      MS_TraductionError::Raise();
+    }
+  }
+  
+  tmpGenType = new MS_GenType(this, anItem, aConstraint);
+  tmpGenType->MetaSchema(GetMetaSchema());
+  
+  myGenTypes->Append(tmpGenType); 
+}
+
+void MS_GenClass::GenType(const Handle(MS_GenType)& anItem)
+{
+  if (!anItem.IsNull()) {
+    myGenTypes->Append(anItem);
+  }
+  else {
+    Standard_NullObject::Raise("MS_GenClass::GenType - anItem is NULL.");
+  }
+}
+
+Handle(MS_HSequenceOfGenType) MS_GenClass::GenTypes() const 
+{
+  return myGenTypes;
+}
+
+void MS_GenClass::CheckNested() const 
+{
+}
+
+
diff --git a/src/MS/MS_GenType.cdl b/src/MS/MS_GenType.cdl
new file mode 100755 (executable)
index 0000000..2f83449
--- /dev/null
@@ -0,0 +1,73 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_GenType.cdl 1.1
+-- File:       MS_GenType.cdl
+-- Created:    Wed Jan 30 12:12:08 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class GenType 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Type from MS
+    uses 
+       Type                    from MS,
+       Class                   from MS,
+       Package                 from MS,
+       HAsciiString            from TCollection,
+       HSequenceOfHAsciiString from TColStd
+
+is
+    Create(aClass: Class from MS; aName: HAsciiString from TCollection; aConstraint : HAsciiString from TCollection)
+     returns mutable GenType from MS;
+    ---Purpose: create a type with a type constraint
+   
+    Create(aClass: Class from MS; aName: HAsciiString from TCollection)
+     returns mutable GenType from MS;
+    ---Purpose: create a type with an any constraint   
+        
+    TYpe(me)
+     returns mutable Type from MS;
+    ---Purpose: return the constraint's type
+    
+    TYpeName(me)
+     returns mutable HAsciiString from TCollection;
+    ---Purpose: returns the constraint type's name
+     
+    InstType(me : mutable; aTypeName : HAsciiString from TCollection);
+    ---Purpose: If the constraint type is generic, we set the instantiation types here
+    --          ex. :  G (item0;
+    --                    item1 as Sequence from TCollection(item0))
+    --                    
+    --                 InsType are for type item1 -> item0
+    
+    GetInstTypes(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+          
+    SetAny(me : mutable);
+    ---Purpose: set no constraint checking
+    Any(me)
+     returns Boolean;
+    ---Purpose: ask if the this type has a constraint checking
+     
+    Package(me: mutable; aPackage: HAsciiString from TCollection)
+       is redefined;
+    Package(me)
+       returns mutable Package from MS
+       is redefined;
+
+    Private(me)
+       returns Boolean;
+    
+fields
+
+    myClass   : HAsciiString            from TCollection;
+    myAny     : Boolean                 from Standard;
+    myType    : HAsciiString            from TCollection;
+    myInsType : HSequenceOfHAsciiString from TColStd;
+    myPrivate : Boolean                 from Standard;
+    
+end GenType from MS;
diff --git a/src/MS/MS_GenType.cxx b/src/MS/MS_GenType.cxx
new file mode 100755 (executable)
index 0000000..041cb9f
--- /dev/null
@@ -0,0 +1,83 @@
+#include <MS_GenType.ixx>
+#include <MS_MetaSchema.hxx>
+
+MS_GenType::MS_GenType(const Handle(MS_Class)& aClass, 
+                      const Handle(TCollection_HAsciiString)& aName, 
+                      const Handle(TCollection_HAsciiString)& aType) : MS_Type(aName)
+{
+  if (aType.IsNull()) {
+    myAny  = Standard_True;
+  }
+  else {
+    myAny  = Standard_False;
+    myType = aType;
+  }
+
+  myClass   = aClass->FullName();
+  myPrivate = aClass->Private();
+  myInsType = new TColStd_HSequenceOfHAsciiString;
+}
+
+MS_GenType::MS_GenType(const Handle(MS_Class)& aClass, 
+                      const Handle(TCollection_HAsciiString)& aName) : MS_Type(aName)
+{
+  myClass   = aClass->FullName();
+  myAny     = Standard_True;
+  myPrivate = aClass->Private();
+  myInsType = new TColStd_HSequenceOfHAsciiString;
+}
+
+Handle(MS_Type) MS_GenType::TYpe() const 
+{
+  Handle(MS_Type) tmpType;
+
+  if (GetMetaSchema() != UndefinedHandleAddress) {    
+    if (GetMetaSchema()->IsDefined(myType)) {
+      tmpType = GetMetaSchema()->GetType(myType);
+    }
+  }
+
+  return tmpType;
+}
+
+Handle(TCollection_HAsciiString) MS_GenType::TYpeName() const 
+{
+  return myType;
+}
+
+void MS_GenType::InstType(const Handle(TCollection_HAsciiString)& aTypeName)
+{
+  myInsType->Append(aTypeName);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_GenType::GetInstTypes() const
+{
+  return myInsType;
+}
+
+void MS_GenType::SetAny()
+{
+  myAny = Standard_True;
+}
+
+Standard_Boolean MS_GenType::Any() const 
+{
+  return myAny;
+}
+
+void MS_GenType::Package(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  MS_Type::Package(aPackage);
+}
+
+Handle(MS_Package) MS_GenType::Package() const 
+{
+  return MS_Type::Package();
+}
+
+Standard_Boolean MS_GenType::Private() const 
+{
+  return myPrivate;
+}
+
+
diff --git a/src/MS/MS_GlobalEntity.cdl b/src/MS/MS_GlobalEntity.cdl
new file mode 100755 (executable)
index 0000000..3cda1ef
--- /dev/null
@@ -0,0 +1,18 @@
+-- File:       MS_GlobalEntity.cdl
+-- Created:    Mon Aug 23 18:06:58 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+deferred class GlobalEntity 
+
+    from 
+       MS 
+    inherits Common from MS 
+    uses
+       HAsciiString from TCollection
+    
+is
+    Initialize(aName :HAsciiString); 
+    
+end;
diff --git a/src/MS/MS_GlobalEntity.cxx b/src/MS/MS_GlobalEntity.cxx
new file mode 100755 (executable)
index 0000000..503f4de
--- /dev/null
@@ -0,0 +1,6 @@
+#include <MS_GlobalEntity.ixx>
+
+MS_GlobalEntity::MS_GlobalEntity(const Handle(TCollection_HAsciiString)& aName) : MS_Common(aName)
+{
+}
+
diff --git a/src/MS/MS_Imported.cdl b/src/MS/MS_Imported.cdl
new file mode 100755 (executable)
index 0000000..6657646
--- /dev/null
@@ -0,0 +1,22 @@
+-- File:       MS_Imported.cdl
+-- Created:    Mon Aug 23 18:44:03 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+class Imported 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits NatType from MS
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString from TCollection
+
+is
+
+    Create(aName, aPackage, aContainer: HAsciiString; aPrivate: Boolean) 
+       returns mutable Imported from MS;
+    
+end Imported from MS;
diff --git a/src/MS/MS_Imported.cxx b/src/MS/MS_Imported.cxx
new file mode 100755 (executable)
index 0000000..5c6c7ca
--- /dev/null
@@ -0,0 +1,9 @@
+#include <MS_Imported.ixx>
+
+MS_Imported::MS_Imported(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aPackage, 
+                        const Handle(TCollection_HAsciiString)& aContainer, 
+                        const Standard_Boolean aPrivate) : MS_NatType(aName,aPackage,aContainer,aPrivate)
+{
+}
+
diff --git a/src/MS/MS_InstClass.cdl b/src/MS/MS_InstClass.cdl
new file mode 100755 (executable)
index 0000000..796167c
--- /dev/null
@@ -0,0 +1,112 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_InstClass.cdl       1.1
+-- File:       MS_InstClass.cdl
+-- Created:    Wed Jan 30 12:19:55 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class InstClass 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Class from MS
+    uses 
+       Type                    from MS,
+       Class                   from MS,
+       GenClass                from MS,
+       HAsciiString            from TCollection,
+       HSequenceOfHAsciiString from TColStd
+
+is
+     
+    Create(aName: HAsciiString from TCollection; aPackage: HAsciiString from TCollection) 
+       returns mutable InstClass from MS;
+    
+    Create(aName, aPackage : HAsciiString from TCollection;
+          Mother: HAsciiString from TCollection; 
+          aPrivate, aDeferred, aInComplete: Boolean) 
+       returns mutable InstClass from MS;
+              
+    Validity(me; aName: HAsciiString from TCollection; aPackage: HAsciiString from TCollection);
+           
+    InstType(me : mutable; aType: HAsciiString from TCollection; aPackage: HAsciiString from TCollection);
+    InstType(me : mutable;  aType: HAsciiString from TCollection);
+    InstTypes(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    InstType(me : mutable; aType: Type from MS);
+    
+    BasicInstType(me : mutable;  aType: HAsciiString from TCollection);
+    BasicInstTypes(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    ---Purpose: manage the inst types save buffer.
+    
+    RemoveInstType(me : mutable;  aType: HAsciiString from TCollection);
+    ResolveInstType(me : mutable; aType: HAsciiString from TCollection; aTypeConv : HAsciiString from TCollection);
+    ---Purpose: the type used to instantiates the generic class
+       
+    GenType(me: mutable; aType: HAsciiString from TCollection);
+    GenTypes(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    ---Purpose: the type used to instantiates if the class is nested
+    --          they are transformed to inst types when the
+    --          method "Instantiates" is called
+
+    GenClass(me: mutable; aName: HAsciiString from TCollection);
+    GenClass(me: mutable; aName: HAsciiString from TCollection; aPackage: HAsciiString from TCollection);
+    GenClass(me)
+       returns mutable HAsciiString from TCollection;
+    ---Purpose: the corresponding generic class.     
+
+    NestedStdClass(me: mutable; aClass : HAsciiString from TCollection);
+    NestedInsClass(me: mutable; aClass : HAsciiString from TCollection);
+    RemoveNestedStdClass(me: mutable; aClass : HAsciiString from TCollection);
+    RemoveNestedInsClass(me: mutable; aClass : HAsciiString from TCollection);
+    NestedNeuClass(me: mutable; aClass : HAsciiString from TCollection);
+    RemoveNestedNeuClass(me: mutable; aClass : HAsciiString from TCollection);
+    ---Purpose: the classes generated by instantiation of a generic
+    --          class. 
+    --          these classes may contains generics types but
+    --          the resolution will occur with a call to the
+    --          method "Instantiates"
+   
+    GetNestedStdClassesName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    GetNestedInsClassesName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    GetNestedNeuClassesName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+               
+    Instantiates(me: mutable);
+    ---Purpose: First phase of instantiation
+    --          Name and types are created in the metaschema
+    --          this is a declaration of all types created by the instantiate command.
+   
+    InstToStd(me : mutable);
+    ---Purpose: Second phase of instantiation.
+    --          we create full types
+    --          the InstClasses are transformed in StdClasses.
+    --          All the generic classes used must be in the MetaSchema    
+
+    IsAlreadyDone(me)
+       returns Boolean from Standard;
+    AlreadyDone(me : mutable; flag : Boolean from Standard);
+    ---Purpose: test or set the flag when the instantiation has been done
+
+    Initialize(me : mutable);
+    ---Purpose: Prepare a instclass for a second instantiates pass 
+      
+fields
+
+     myGenClass      : HAsciiString            from TCollection;
+     myBasicInsType  : HSequenceOfHAsciiString from TColStd;     -- myInstType save buffer
+     myInstType      : HSequenceOfHAsciiString from TColStd;     -- because here we add several inst types during instantiation
+     myGenType       : HSequenceOfHAsciiString from TColStd;
+     myNestStd       : HSequenceOfHAsciiString from TColStd;
+     myNestIns       : HSequenceOfHAsciiString from TColStd;
+     myNestNeu       : HSequenceOfHAsciiString from TColStd;
+     myInstFlag      : Boolean from Standard;
+     
+end InstClass from MS;
diff --git a/src/MS/MS_InstClass.cxx b/src/MS/MS_InstClass.cxx
new file mode 100755 (executable)
index 0000000..0e0ab09
--- /dev/null
@@ -0,0 +1,434 @@
+#include <MS_InstClass.ixx>
+#include <MS_TraductionError.hxx>
+#include <MS.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_GenType.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS_Package.hxx>
+
+MS_InstClass::MS_InstClass(const Handle(TCollection_HAsciiString)& aName, 
+                          const Handle(TCollection_HAsciiString)& aPackage) 
+: myGenClass(new TCollection_HAsciiString),myBasicInsType(new TColStd_HSequenceOfHAsciiString),myInstType(new TColStd_HSequenceOfHAsciiString),
+  myGenType(new TColStd_HSequenceOfHAsciiString),myNestStd(new TColStd_HSequenceOfHAsciiString),
+  myNestIns(new TColStd_HSequenceOfHAsciiString),myNestNeu(new TColStd_HSequenceOfHAsciiString),myInstFlag(Standard_False),MS_Class(aName,aPackage)
+{
+}
+
+MS_InstClass::MS_InstClass(const Handle(TCollection_HAsciiString)& aName, 
+                          const Handle(TCollection_HAsciiString)& aPackage, 
+                          const Handle(TCollection_HAsciiString)& Mother, 
+                          const Standard_Boolean aPrivate, 
+                          const Standard_Boolean aDeferred, 
+                          const Standard_Boolean aInComplete) 
+: myGenClass(new TCollection_HAsciiString),myBasicInsType(new TColStd_HSequenceOfHAsciiString),myInstType(new TColStd_HSequenceOfHAsciiString),
+  myGenType(new TColStd_HSequenceOfHAsciiString),myNestStd(new TColStd_HSequenceOfHAsciiString),
+  myNestIns(new TColStd_HSequenceOfHAsciiString),myNestNeu(new TColStd_HSequenceOfHAsciiString),myInstFlag(Standard_False),MS_Class(aName,aPackage,Mother,aPrivate,aDeferred,aInComplete)
+{
+}
+
+void MS_InstClass::Validity(const Handle(TCollection_HAsciiString)& aName, 
+                           const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+  
+}
+
+void MS_InstClass::InstType(const Handle(TCollection_HAsciiString)& aType, 
+                           const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aFullName;
+
+  if (aPackage->IsEmpty()) {
+    aFullName = aType;
+  }
+  else {
+    aFullName = MS::BuildFullName(aPackage,aType);
+  }
+
+  myInstType->Append(aFullName);
+}
+
+void MS_InstClass::InstType(const Handle(TCollection_HAsciiString)& aType)
+{
+  myInstType->Append(aType);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_InstClass::InstTypes() const 
+{
+  return myInstType;
+}
+
+void MS_InstClass::BasicInstType(const Handle(TCollection_HAsciiString)& aType)
+{
+  myBasicInsType->Append(aType);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_InstClass::BasicInstTypes() const 
+{
+  return myBasicInsType;
+}
+
+void MS_InstClass::InstType(const Handle(MS_Type)& aType)
+{
+  myInstType->Append(aType->FullName());
+}
+
+void MS_InstClass::RemoveInstType(const Handle(TCollection_HAsciiString)& aType)
+{
+  Standard_Integer i;
+  Standard_Boolean IsNotFound = Standard_False;
+
+  for (i = 1; i <= myInstType->Length() && !IsNotFound; i++) {
+    if (myInstType->Value(i)->IsSameString(aType)) {
+      myInstType->Remove(i);
+      IsNotFound = Standard_True;
+    }
+  }
+}
+
+void MS_InstClass::ResolveInstType(const Handle(TCollection_HAsciiString)& aType,
+                                  const Handle(TCollection_HAsciiString)& aTypeConv)
+{
+  Standard_Integer i;
+
+  for (i = 1; i <= myInstType->Length(); i++) {
+    if (myInstType->Value(i)->IsSameString(aType)) {
+      myInstType->SetValue(i,aTypeConv);
+    }
+  }
+}
+
+void MS_InstClass::GenType(const Handle(TCollection_HAsciiString)& aType)
+{
+  myGenType->Append(aType);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_InstClass::GenTypes() const 
+{
+  return myGenType;
+}
+
+void MS_InstClass::GenClass(const Handle(TCollection_HAsciiString)& aName, 
+                           const Handle(TCollection_HAsciiString)& aPackage)
+{
+  myGenClass = MS::BuildFullName(aPackage,aName);
+}
+
+void MS_InstClass::GenClass(const Handle(TCollection_HAsciiString)& aName)
+{
+  myGenClass = aName;
+}
+
+Handle(TCollection_HAsciiString) MS_InstClass::GenClass() const 
+{
+  return myGenClass;
+}
+
+void MS_InstClass::NestedStdClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myNestStd->Append(aClass);
+}
+
+void MS_InstClass::RemoveNestedStdClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Integer i;
+  Standard_Boolean IsNotFound = Standard_False;
+
+  for (i = 1; i <= myNestStd->Length() && !IsNotFound; i++) {
+    if (myNestStd->Value(i)->IsSameString(aClass)) {
+      myNestStd->Remove(i);
+      IsNotFound = Standard_True;
+    }
+  }
+}
+
+void MS_InstClass::NestedNeuClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myNestNeu->Append(aClass);
+}
+
+void MS_InstClass::RemoveNestedNeuClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Integer i;
+  Standard_Boolean IsNotFound = Standard_False;
+
+  for (i = 1; i <= myNestNeu->Length() && !IsNotFound; i++) {
+    if (myNestNeu->Value(i)->IsSameString(aClass)) {
+      myNestNeu->Remove(i);
+      IsNotFound = Standard_True;
+    }
+  }
+}
+
+
+void MS_InstClass::NestedInsClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myNestIns->Append(aClass);
+}
+
+void MS_InstClass::RemoveNestedInsClass(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Standard_Integer i;
+  Standard_Boolean IsNotFound = Standard_False;
+
+  for (i = 1; i <= myNestIns->Length() && !IsNotFound; i++) {
+    if (myNestIns->Value(i)->IsSameString(aClass)) {
+      myNestIns->Remove(i);
+      IsNotFound = Standard_True;
+    }
+  }
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_InstClass::GetNestedStdClassesName() const 
+{
+  return myNestStd;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_InstClass::GetNestedInsClassesName() const 
+{
+  return myNestIns;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_InstClass::GetNestedNeuClassesName() const 
+{
+  return myNestIns;
+}
+
+// here we make the first phase of instantiation
+// we explode the class and create the name of the nested in the metaschema
+//
+void MS_InstClass::Instantiates()
+{
+  if (myInstFlag) return;
+
+  Handle(MS_GenClass)                     theGenClass;
+  Handle(TColStd_HSequenceOfHAsciiString) theInstOfGenclass,
+                                          theStdOfGenclass;
+  Standard_Integer                        i;
+  Standard_Boolean                        GenClassNotDefined = Standard_False;
+
+  if (GetMetaSchema() == UndefinedHandleAddress) {
+    MS_TraductionError::Raise("Error : Instantiation without MetaSchemna...");
+  }
+
+  // we look for the generic class of me
+  //
+  if (GetMetaSchema()->IsDefined(myGenClass)) {
+    Handle(MS_Type) aType = GetMetaSchema()->GetType(myGenClass);
+    
+    theGenClass = Handle(MS_GenClass)::DownCast(aType);
+
+    if (theGenClass.IsNull()) GenClassNotDefined = Standard_True;
+  }
+  else GenClassNotDefined = Standard_True;
+  
+  // by now, only a warning, but wait...
+  //
+  if (GenClassNotDefined) {
+    cout << "Error : Generic class " << myGenClass->ToCString() << " not defined for instantiation" << endl;
+    MS_TraductionError::Raise("Error : Instantiation generic class...");
+  }
+
+  // we init save buffer
+  //
+  if (myBasicInsType->IsEmpty()) {
+    for (i = 1; i <= myInstType->Length(); i++) {
+      myBasicInsType->Append(myInstType->Value(i));
+    }
+  }
+
+  if ((theGenClass->GenTypes()->Length() != myBasicInsType->Length()) &&  !theGenClass->Incomplete()) {
+    cout << "Warning : The instantiation types have been modified in the generic class : " << myGenClass->ToCString() 
+         << " used by " << FullName()->ToCString() << endl;
+  }
+
+  Handle(TCollection_HAsciiString) theComplexName;
+  Handle(MS_StdClass)              theNewStdClass;
+
+  // for neutral nested group
+  //
+  if (myNestNeu->Length() == 0) {
+    theStdOfGenclass = theGenClass->GetNestedName();
+    
+    for (i = 1; i <= theStdOfGenclass->Length(); i++) {
+      theComplexName = MS::BuildComplexName(Name(),theStdOfGenclass->Value(i),theGenClass->Name());
+      theNewStdClass = new MS_StdClass(theComplexName,Package()->Name());
+      theNewStdClass->Mother(MS::BuildFullName(theGenClass->Package()->Name(),theStdOfGenclass->Value(i)));
+      theNewStdClass->MetaSchema(GetMetaSchema());
+      theNewStdClass->NestingClass(FullName());
+      myNestNeu->Append(theComplexName);
+
+      if (!GetMetaSchema()->AddType(theNewStdClass)) {
+//     cout << "WARNING : neutral class " << theNewStdClass->FullName()->ToCString() << " already here..." << endl;
+       GetMetaSchema()->RemoveType(theNewStdClass->FullName());
+       GetMetaSchema()->AddType(theNewStdClass);
+      }
+    }
+  }
+  
+  myInstFlag = Standard_True;
+}
+void MS_InstClass::InstToStd()
+{
+  Standard_Integer                 i,j;
+  Handle(MS_Type)                  aType;
+  Handle(MS_StdClass)              aNewStdClass;
+  MS_StdClass*                     aPartial;
+  Handle(MS_StdClass)              aGenerator;
+  Handle(MS_InstClass)             aInstClass;
+  Handle(TCollection_HAsciiString) aFullName;
+  Handle(MS_GenClass)              aGenClass;
+  Handle(MS_HSequenceOfGenType)    theGenTypes;
+
+  aType       = GetMetaSchema()->GetType(myGenClass);
+  aGenClass   = *((Handle(MS_GenClass)*)&aType);
+  theGenTypes = aGenClass->GenTypes();
+
+  myGenType->Clear();
+  
+  for (i = 1; i <= theGenTypes->Length(); i++) {
+    GenType(theGenTypes->Value(i)->Name());
+  }
+
+  GenType(myGenClass);
+  InstType(FullName());
+
+  myNestIns->Clear();
+  myNestStd->Clear();
+  for (i = 1; i <= myNestNeu->Length(); i++) {
+    aFullName = MS::BuildFullName(Package()->Name(),myNestNeu->Value(i));
+    aType     = GetMetaSchema()->GetType(aFullName);
+    aPartial  = (MS_StdClass*)aType.operator->();
+    aType     = GetMetaSchema()->GetType(aPartial->GetMother());
+
+    if (aType->IsKind(STANDARD_TYPE(MS_InstClass))) {
+      myNestIns->Append(myNestNeu->Value(i));
+    }
+    else if (aType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+      myNestStd->Append(myNestNeu->Value(i));
+    }
+    else {
+      cerr << "WARNING : MS_InstClass::InstToStd - neutral nested class with unknown type " << myNestNeu->Value(i)->ToCString() << endl;
+    }
+  }
+  
+  myNestNeu->Clear();
+
+  for (i = 1; i <= myNestIns->Length(); i++) {
+    Handle(TCollection_HAsciiString) aname,nestedName;
+    
+    aFullName = MS::BuildFullName(Package()->Name(),myNestIns->Value(i));
+    aType     = GetMetaSchema()->GetType(aFullName);
+    aPartial  = (MS_StdClass*)aType.operator->();
+    aType     = GetMetaSchema()->GetType(aPartial->GetMother());
+
+    MS_InstClass* instt = (MS_InstClass*)aType.operator->();
+    MS_GenClass*  genn  = (MS_GenClass*)GetMetaSchema()->GetType(instt->GenClass()).operator->();
+
+    GenType(aPartial->GetMother());
+    InstType(aFullName);
+
+    for (j = 1; j <= genn->GetNestedInsClassesName()->Length(); j++) {
+      nestedName = genn->GetNestedInsClassesName()->Value(j);
+      aname = MS::BuildComplexName(aType->Name(),nestedName,genn->Name());
+      GenType(MS::BuildFullName(aType->Package()->Name(),aname));
+      aname = MS::BuildComplexName(myNestIns->Value(i),nestedName,genn->Name());
+      InstType(MS::BuildFullName(Package()->Name(),aname));
+    }
+    for (j = 1; j <= genn->GetNestedStdClassesName()->Length(); j++) {
+      nestedName = genn->GetNestedStdClassesName()->Value(j);
+      aname = MS::BuildComplexName(aType->Name(),nestedName,genn->Name());
+      GenType(MS::BuildFullName(aType->Package()->Name(),aname));
+      aname = MS::BuildComplexName(myNestIns->Value(i),nestedName,genn->Name());
+      InstType(MS::BuildFullName(Package()->Name(),aname));
+    }
+    for (j = 1; j <= genn->GetNestedName()->Length(); j++) {
+      nestedName = genn->GetNestedName()->Value(j);
+      aname = MS::BuildComplexName(aType->Name(),nestedName,genn->Name());
+      GenType(MS::BuildFullName(aType->Package()->Name(),aname));
+      aname = MS::BuildComplexName(myNestIns->Value(i),nestedName,genn->Name());
+      InstType(MS::BuildFullName(Package()->Name(),aname));
+    }
+  }
+
+  for (i = 1; i <= myNestStd->Length(); i++) {
+    aFullName = MS::BuildFullName(Package()->Name(),myNestStd->Value(i));
+    aType     = GetMetaSchema()->GetType(aFullName);
+    aPartial  = (MS_StdClass*)aType.operator->();
+    GenType(aPartial->GetMother());
+    InstType(aFullName);
+  }
+
+
+  for (i = 1; i <= myNestIns->Length(); i++) {
+    aFullName  = MS::BuildFullName(Package()->Name(),myNestIns->Value(i));
+    aType      = GetMetaSchema()->GetType(aFullName);
+    aPartial   = (MS_StdClass*)aType.operator->();
+    aType      = GetMetaSchema()->GetType(aPartial->GetMother());    
+    aInstClass = *((Handle(MS_InstClass)*)&aType);
+    aInstClass = MS::BuildInstClass(aInstClass,myNestIns->Value(i),Package()->Name(),myGenType,myInstType);
+    aInstClass->NestingClass(FullName());
+    if (Private()) aInstClass->Private(Private());
+    aInstClass->Instantiates();
+    aInstClass->InstToStd();
+    if (!aInstClass->Package()->HasClass(aInstClass->Name())) {
+      aInstClass->Package()->Class(aInstClass->Name());
+    }
+  }
+
+  for (i = 1; i <= myNestStd->Length(); i++) {
+    aFullName    = MS::BuildFullName(Package()->Name(),myNestStd->Value(i));
+    aType        = GetMetaSchema()->GetType(aFullName);
+    aPartial     = (MS_StdClass*)aType.operator->();
+    aType        = GetMetaSchema()->GetType(aPartial->GetMother());
+    aGenerator   = *((Handle(MS_StdClass)*)&aType);
+    aNewStdClass = MS::BuildStdClass(aGenerator,aPartial->Name(),Package()->Name(),myGenType,myInstType);
+    
+    aNewStdClass->NestingClass(FullName());
+
+    GetMetaSchema()->RemoveType(aPartial->FullName(),Standard_False);
+    aNewStdClass->MetaSchema(GetMetaSchema());
+    GetMetaSchema()->AddType(aNewStdClass);
+    aNewStdClass->CreatedBy(this);
+    if (Private()) aNewStdClass->Private(Private());
+    if (!aNewStdClass->Package()->HasClass(aNewStdClass->Name())) {
+      aNewStdClass->Package()->Class(aNewStdClass->Name());
+    }
+  }
+
+  aNewStdClass = MS::BuildStdClass(aGenClass,Name(),Package()->Name(),myGenType,myInstType);
+  aNewStdClass->Private(Private());
+  aNewStdClass->CreatedBy(this);
+  aNewStdClass->NestingClass(GetNestingClass());
+
+  GetMetaSchema()->RemoveType(FullName(),Standard_False);
+  aNewStdClass->MetaSchema(GetMetaSchema());
+  GetMetaSchema()->AddType(aNewStdClass);
+}
+
+Standard_Boolean MS_InstClass::IsAlreadyDone() const 
+{
+  return myInstFlag;
+}
+
+void MS_InstClass::AlreadyDone(const Standard_Boolean flag)
+{
+  myInstFlag = flag;
+}
+
+void MS_InstClass::Initialize() 
+{
+  Standard_Integer i;
+
+  myInstFlag = Standard_False;
+  // we init save buffer
+  //
+  myInstType->Clear();
+
+  for (i = 1; i <= myBasicInsType->Length(); i++) {
+    myInstType->Append(myBasicInsType->Value(i));
+  }
+}
diff --git a/src/MS/MS_InstMet.cdl b/src/MS/MS_InstMet.cdl
new file mode 100755 (executable)
index 0000000..b6efead
--- /dev/null
@@ -0,0 +1,60 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_InstMet.cdl 1.1
+-- File:       MS_InstMet.cdl
+-- Created:    Wed Jan 30 16:08:59 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class InstMet 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits MemberMet from MS
+    uses 
+       HAsciiString from TCollection
+       
+is
+    Create (aName: HAsciiString from TCollection; aClass: HAsciiString from TCollection) 
+       returns mutable InstMet from MS;
+
+    Static(me: mutable; aStatic: Boolean);
+    IsStatic(me)
+        returns Boolean;
+
+    Deferred(me: mutable; aDeferred: Boolean);
+    IsDeferred(me)
+       returns Boolean;
+       
+    Redefined(me: mutable; aRedefined: Boolean);
+    IsRedefined(me)
+       returns Boolean;
+
+    ConstMode(me : mutable; aMode : Integer from Standard);
+    ---Purpose: set the mode to MSINSTMET_OUT or MSINSTMET_MUTABLE
+    ---Level: Internal
+
+    Const(me : mutable; aConst : Boolean from Standard);
+    ---Purpose: set the method to be out or mutable (undefined but const)
+
+    IsConst(me)
+       returns Boolean from Standard;
+    ---Purpose: the method is not mutable and not out
+    
+    IsMutable(me) 
+       returns Boolean from Standard;
+       
+    IsOut(me) 
+       returns Boolean from Standard;
+
+    Mode(me : mutable; aMode : Integer from Standard);
+    GetMode(me) returns Integer from Standard; 
+    ---Level: Internal
+
+fields
+
+    myMode : Integer from Standard;
+
+end InstMet from MS;
diff --git a/src/MS/MS_InstMet.cxx b/src/MS/MS_InstMet.cxx
new file mode 100755 (executable)
index 0000000..20fb703
--- /dev/null
@@ -0,0 +1,97 @@
+#include <MS_InstMet.ixx>
+#include <MS_AccessMode.hxx>
+
+MS_InstMet::MS_InstMet(const Handle(TCollection_HAsciiString)& aName, 
+                      const Handle(TCollection_HAsciiString)& aClass) : myMode(0), MS_MemberMet(aName,aClass)
+{
+}
+
+void MS_InstMet::Static(const Standard_Boolean aStatic)
+{
+  if (aStatic) {
+    myMode |= MSINSTMET_STATIC;
+  }
+  else {
+    myMode &= (myMode ^ MSINSTMET_STATIC);
+  }
+}
+
+Standard_Boolean MS_InstMet::IsStatic() const 
+{
+  return (myMode & MSINSTMET_STATIC);
+}
+
+void MS_InstMet::Deferred(const Standard_Boolean aDeferred)
+{
+  if (aDeferred) {
+    myMode |= MSINSTMET_DEFERRED;
+  }
+  else {
+    myMode &= (myMode ^ MSINSTMET_DEFERRED);
+  }
+}
+
+Standard_Boolean MS_InstMet::IsDeferred() const 
+{
+  return (myMode & MSINSTMET_DEFERRED);
+}
+
+void MS_InstMet::Redefined(const Standard_Boolean aRedefined)
+{
+  if (aRedefined) {
+    myMode |= MSINSTMET_REDEFINED;
+  }
+  else {
+    myMode &= (myMode ^ MSINSTMET_REDEFINED);
+  }
+}
+
+Standard_Boolean MS_InstMet::IsRedefined() const 
+{
+  return (myMode & MSINSTMET_REDEFINED);
+}
+
+void MS_InstMet::Const(const Standard_Boolean aConst)
+{
+  if (!aConst) {
+    myMode |= MSINSTMET_OUT;
+  }
+  else {
+    myMode &= (myMode ^ MSINSTMET_OUT);
+    myMode &= (myMode ^ MSINSTMET_MUTABLE);
+  }
+}
+
+Standard_Boolean MS_InstMet::IsConst() const
+{
+  return (!(myMode & MSINSTMET_OUT) && !(myMode & MSINSTMET_MUTABLE));
+}
+
+
+Standard_Boolean MS_InstMet::IsMutable() const
+{
+  return (myMode & MSINSTMET_MUTABLE);
+}
+
+Standard_Boolean MS_InstMet::IsOut() const
+{
+  return (myMode & MSINSTMET_OUT);
+}
+
+void MS_InstMet::ConstMode(const Standard_Integer aMode)
+{
+  myMode |= aMode;
+}
+
+void MS_InstMet::Mode(const Standard_Integer aMode)
+{
+  myMode = aMode;
+}
+
+Standard_Integer MS_InstMet::GetMode() const
+{
+  return myMode;
+}
+
+
+
diff --git a/src/MS/MS_Interface.cdl b/src/MS/MS_Interface.cdl
new file mode 100755 (executable)
index 0000000..6bcd699
--- /dev/null
@@ -0,0 +1,49 @@
+-- File:       MS_Interface.cdl
+-- Created:    Mon Aug 23 18:07:23 1993
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1993
+
+class Interface 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits GlobalEntity from MS 
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString            from TCollection
+
+is
+
+    Create(aInterface : HAsciiString from TCollection) 
+       returns mutable Interface from MS;
+    
+    Use(me : mutable; aInterface : HAsciiString from TCollection);
+    Uses(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+          
+    Class(me : mutable; aClass : HAsciiString from TCollection; aPackage : HAsciiString from TCollection);
+    Class(me : mutable; aClass : HAsciiString from TCollection);
+    Classes(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+
+     
+    Package(me : mutable; aPackage : HAsciiString from TCollection);
+    Packages(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+
+     
+    Method(me : mutable; aMethod : HAsciiString from TCollection);
+    Methods(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+       
+fields
+
+    myUses        : HSequenceOfHAsciiString from TColStd;
+    myPackages    : HSequenceOfHAsciiString from TColStd;
+    myClasses     : HSequenceOfHAsciiString from TColStd;
+    myMethods     : HSequenceOfHAsciiString from TColStd;
+
+end Interface from MS;
+
diff --git a/src/MS/MS_Interface.cxx b/src/MS/MS_Interface.cxx
new file mode 100755 (executable)
index 0000000..4cc18f6
--- /dev/null
@@ -0,0 +1,86 @@
+#include <MS_Interface.ixx>
+#include <MS.hxx>
+#include <Standard_NullObject.hxx>
+
+MS_Interface::MS_Interface(const Handle(TCollection_HAsciiString)& aInterface) : MS_GlobalEntity(aInterface)
+{
+  myUses     = new TColStd_HSequenceOfHAsciiString;
+  myPackages = new TColStd_HSequenceOfHAsciiString;
+  myClasses  = new TColStd_HSequenceOfHAsciiString;
+  myMethods  = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_Interface::Use(const Handle(TCollection_HAsciiString)& anInterface)
+{
+  Standard_Integer len     = myUses->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+   if (anInterface.IsNull()) {
+    Standard_NullObject::Raise("MS_Interface::Use - anInterface is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  if (!anInterface->IsSameString(Name())) {
+    for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+      if (myUses->Value(i)->IsSameString(anInterface)) {
+       IsFound = Standard_True;
+      }
+    }
+  }
+  else {
+    IsFound = Standard_True;
+  }
+
+  if (!IsFound) {
+    myUses->Append(anInterface);
+  }
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Interface::Uses() const 
+{
+  return myUses;
+}
+
+void MS_Interface::Class(const Handle(TCollection_HAsciiString)& aClass, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aClass);
+
+  myClasses->Append(aFullName);
+}
+
+void MS_Interface::Class(const Handle(TCollection_HAsciiString)& aClass)
+{
+  Handle(TCollection_HAsciiString) aFullName = new TCollection_HAsciiString(aClass);
+
+  myClasses->Append(aFullName);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Interface::Classes() const 
+{
+  return myClasses;
+}
+
+void MS_Interface::Package(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  myPackages->Append(aPackage);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Interface::Packages() const 
+{
+  return myPackages;
+}
+
+void MS_Interface::Method(const Handle(TCollection_HAsciiString)& aMethod)
+{
+  myMethods->Append(aMethod);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Interface::Methods() const 
+{
+  return myMethods;
+}
+
+
+
+
diff --git a/src/MS/MS_MemberMet.cdl b/src/MS/MS_MemberMet.cdl
new file mode 100755 (executable)
index 0000000..e221d80
--- /dev/null
@@ -0,0 +1,42 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_MemberMet.cdl       1.1
+-- File:       MS_MemberMet.cdl
+-- Created:    Wed Jan 30 16:04:13 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class MemberMet 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Method from MS
+    uses HAsciiString from TCollection
+    
+is
+    Initialize(aName: HAsciiString; aClass: HAsciiString from TCollection);
+
+    Class(me: mutable; aClass: HAsciiString from TCollection);
+    Class(me: mutable; aClass: HAsciiString; aPackage: HAsciiString);
+    Class(me)
+       returns mutable HAsciiString from TCollection;
+
+    CreateFullName(me : mutable) is redefined;
+    
+    Protected(me: mutable; aProtected: Boolean);
+    IsProtected(me)
+       returns Boolean;
+
+    -- Raises(me : mutable; aExcept: HAsciiString from TCollection);
+    Raises(me: mutable; aExcept: HAsciiString from TCollection; aPackage: HAsciiString from TCollection);
+
+fields
+
+    
+    myClass     : HAsciiString from TCollection;
+    myProtected : Boolean from Standard;
+    
+end MemberMet from MS;
+
diff --git a/src/MS/MS_MemberMet.cxx b/src/MS/MS_MemberMet.cxx
new file mode 100755 (executable)
index 0000000..c3a609f
--- /dev/null
@@ -0,0 +1,59 @@
+#include <MS_MemberMet.ixx>
+#include <MS.hxx>
+
+MS_MemberMet::MS_MemberMet(const Handle(TCollection_HAsciiString)& aName, 
+                          const Handle(TCollection_HAsciiString)& aClass) : MS_Method(aName)
+{
+  myClass = aClass;
+}
+
+void MS_MemberMet::Class(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myClass = aClass;
+}
+
+void MS_MemberMet::Class(const Handle(TCollection_HAsciiString)& aClass, const Handle(TCollection_HAsciiString)& aPackage)
+{
+}
+
+Handle(TCollection_HAsciiString) MS_MemberMet::Class() const 
+{
+  return myClass;
+}
+
+void MS_MemberMet::CreateFullName() 
+{
+  Handle(TCollection_HAsciiString) myIdName;
+
+  MS_Method::CreateFullName();
+
+  if (!myClass.IsNull()) {
+    myIdName = new TCollection_HAsciiString(myClass);
+    myIdName->AssignCat("::");
+    myIdName->AssignCat(FullName());
+    FullName(myIdName);
+  }
+}
+
+void MS_MemberMet::Protected(const Standard_Boolean aProtected)
+{
+  myProtected = aProtected;
+}
+
+Standard_Boolean MS_MemberMet::IsProtected() const 
+{
+  return myProtected;
+}
+
+//void MS_MemberMet::Raises(const Handle(TCollection_HAsciiString)& aExcept)
+//{
+//  MS_Method::Raises(aExcept);
+//}
+
+void MS_MemberMet::Raises(const Handle(TCollection_HAsciiString)& aExcept, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(TCollection_HAsciiString) aRaise = MS::BuildFullName(aPackage,aExcept);
+
+  MS_Method::Raises(aRaise);
+}
+
diff --git a/src/MS/MS_MetaSchema.cdl b/src/MS/MS_MetaSchema.cdl
new file mode 100755 (executable)
index 0000000..d416f19
--- /dev/null
@@ -0,0 +1,227 @@
+-- File:       MS_MetaSchema.cdl
+-- Created:    1995
+-- Author:      CLE
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class MetaSchema 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits TShared from MMgt
+    uses 
+       Class                 from MS,
+       Field                 from MS,
+       Type                  from MS,
+       Package               from MS,
+       Schema                from MS,
+       Interface             from MS,
+       Engine                from MS,
+       Component             from MS,
+       Client                from MS,
+       Executable            from MS,
+       HSequenceOfInstClass  from MS,
+       HAsciiString          from TCollection,
+       MapOfType             from MS,
+       MapOfGlobalEntity     from MS,
+       MapOfMethod           from MS,
+       Method                from MS,
+       Common                from MS,
+       InstClass             from MS,
+       ExternMet             from MS,
+       MemberMet             from MS,
+       DataMapIteratorOfMapOfGlobalEntity from MS,
+       DataMapIteratorOfMapOfMethod       from MS,
+       DataMapIteratorOfMapOfType         from MS,
+       HSequenceOfHAsciiString            from TColStd
+            
+is
+    Create returns mutable MetaSchema;
+    ---Purpose: create an empry workspace.
+        
+    AddPackage(me : mutable; aCommon : Package from MS) returns Boolean;
+    ---Purpose: add a object (if not defined) in the scope of the workspace.
+    --             Executable 
+    --             Engine
+    --             Schemas
+    --             Interface
+    --             Package
+    --             Classe
+    --             and all other types...
+    -- if result : 
+    --             True  : Ok
+    --             False : already defined.
+    
+    AddEngine(me : mutable; aCommon : Engine from MS) returns Boolean;     
+    
+    AddComponent(me : mutable; aCommon : Component from MS) returns Boolean;     
+     
+    AddSchema(me : mutable; aCommon : Schema from MS) returns Boolean;
+    
+    AddExecutable(me : mutable; aCommon : Executable from MS) returns Boolean;
+    
+    AddInterface(me : mutable; aCommon : Interface from MS) returns Boolean;
+
+    AddClient(me : mutable; aCommon : Client from MS) returns Boolean;
+    
+    AddType(me : mutable; aCommon : Type from MS) returns Boolean;
+    
+    AddMethod(me : mutable; aCommon : Method from MS) returns Boolean;
+    
+    Executables(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the executables defined in the workspace.
+    
+    Engines(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the engines defined in the workspace.
+
+    Components(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the components defined in the workspace.
+    
+    Schemas(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the schemas defined in the workspace.
+    
+    Interfaces(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the interfaces defined in the workspace.
+    
+    Clients(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the clients defined in the workspace.
+
+    Packages(me) returns DataMapIteratorOfMapOfGlobalEntity from MS;
+    ---Purpose: returns the list of the packages defined in the workspace.
+    
+    Types(me) returns DataMapIteratorOfMapOfType from MS;    
+    ---Purpose: returns the list of the classes defined in the workspace.
+
+    Methods(me) returns DataMapIteratorOfMapOfMethod from MS;
+    
+    GetExecutable(me; anExecutable : HAsciiString from TCollection) returns mutable Executable;
+    ---C++: return const &
+    ---Purpose: returns the Executable named anExecutable
+    
+    GetEngine(me; anEngine: HAsciiString from TCollection) returns mutable Engine;
+    ---C++: return const &    
+    ---Purpose: returns the Engine named anEngine
+
+    GetComponent(me; aComponent: HAsciiString from TCollection) returns mutable Component;
+    ---C++: return const &
+    ---Purpose: returns the Component named aComponent
+    
+    GetSchema(me; aSchema: HAsciiString from TCollection) returns mutable Schema;
+    ---C++: return const &
+    ---Purpose: returns the Schema named aSchema
+    
+    GetInterface(me; anInterface: HAsciiString from TCollection) returns mutable Interface;
+    ---C++: return const &
+    ---Purpose: returns the Interface named anInterface
+
+    GetClient(me; aClient : HAsciiString from TCollection) returns mutable Client;
+    ---C++: return const &
+    ---Purpose: returns the client named aClient
+
+    GetPackage(me; aPackage: HAsciiString from TCollection) returns mutable Package;
+    ---C++: return const &
+    ---Purpose: returns the list of the packages defined in the workspace.
+    
+    RemovePackage(me : mutable; aPackage : HAsciiString from TCollection);
+    RemoveExecutable(me : mutable; anExec : HAsciiString from TCollection);
+    RemoveEngine(me : mutable; aEngine : HAsciiString from TCollection);
+    RemoveComponent(me : mutable; aComponent : HAsciiString from TCollection);
+    RemoveSchema(me : mutable; aSchema : HAsciiString from TCollection);
+    RemoveInterface(me : mutable; anInterface : HAsciiString from TCollection);
+    RemoveClient(me : mutable; aClient : HAsciiString from TCollection);
+    
+    GetType(me; aType : HAsciiString from TCollection) returns mutable Type from MS;    
+    ---C++: return const &
+    ---Purpose: returns the list of the classes defined in the workspace.
+    
+    RemoveType(me : mutable; aType : HAsciiString from TCollection; 
+                            mustUpdatePackage : Boolean from Standard = Standard_True);
+
+    GetMethod(me; aMethod : HAsciiString from TCollection) returns mutable Method from MS;   
+     ---C++: return const &
+   
+    RemoveMethod(me : mutable; aMethod : HAsciiString from TCollection);
+    
+    IsExecutable(me; anExecutable : HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <anExecutable> is an executable.
+    
+    IsEngine(me; anEngine: HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <anEngine> is an engine.
+
+    IsComponent(me; aComponent : HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <aComponent> is a component.
+   
+    IsSchema(me; aSchema: HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <aSchema> is a schema.
+    
+    IsInterface(me; anInterface: HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <anInterface> is an interface.
+    
+    IsClient(me; aClient : HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <aClient> is a client.
+
+    IsPackage(me; aPackage: HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <aPackage> is a package.
+    
+    IsDefined(me; aType: HAsciiString from TCollection; aPackage: HAsciiString from TCollection) 
+       returns Boolean;
+    ---Purpose: returns Standard_True if <aType> is a type defined in the package <aPackage>.
+
+    IsDefined(me; aType: HAsciiString from TCollection) returns Boolean;
+    ---Purpose: returns Standard_True if <aType> is a type defined.
+    
+    IsMethod(me; aMethod :  HAsciiString from TCollection) returns Boolean;
+
+    GetInstantiations(me; aGenClass  :  HAsciiString from TCollection) 
+       returns HSequenceOfInstClass from MS;
+    ---Purpose: Returns the list of instantiations using <aGenClass>
+
+    GetPersistentClassesFromSchema(me; aSchema  :  HAsciiString from TCollection;  withStorable : Boolean from Standard = Standard_False) 
+       returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Returns the list of persistent classes listed into the schema <aSchema>  
+    
+    GetPersistentClassesFromClasses(me; aClassList  : HSequenceOfHAsciiString from TColStd; withStorable : Boolean from Standard = Standard_False)
+       returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Returns the list of persistent classes used by the classes listed into <aClassList> and not
+    --          present in <aClassList>
+
+    Check(me; aName : HAsciiString from TCollection) 
+       returns Boolean from Standard;
+    ---Purpose: Check the entity named <aName>
+    --          Returns Standard_False if checking failed 
+    --          otherwise Standard_True
+
+    --
+    -- PRIVATE METHODS
+    --
+
+    CheckClass(me; aClass : Class from MS) 
+       returns Boolean from Standard is private;
+
+    CheckMemberMethod(me; aMeth : MemberMet from MS) 
+       returns Boolean from Standard is private;
+    
+    CheckExternMethod(me; aMeth : ExternMet from MS) 
+       returns Boolean from Standard is private;
+    
+    CheckField(me; aField : Field from MS)
+       returns Boolean from Standard is private;    
+
+    CheckInstClass(me; anInst : InstClass from MS)
+       returns Boolean from Standard is private;
+       
+fields
+
+    myTypes       : MapOfType from MS;
+    myPackages    : MapOfGlobalEntity from MS;
+    mySchemas     : MapOfGlobalEntity from MS;
+    myExecutables : MapOfGlobalEntity from MS;
+    myInterfaces  : MapOfGlobalEntity from MS;
+    myClients     : MapOfGlobalEntity from MS;
+    myEngines     : MapOfGlobalEntity from MS;
+    myComponents  : MapOfGlobalEntity from MS;
+    myMethods     : MapOfMethod       from MS;
+    
+end MetaSchema from MS;
+
diff --git a/src/MS/MS_MetaSchema.cxx b/src/MS/MS_MetaSchema.cxx
new file mode 100755 (executable)
index 0000000..dc226a8
--- /dev/null
@@ -0,0 +1,2219 @@
+#include <MS_MetaSchema.ixx>
+#include <MS.hxx>
+
+#include <MS_Package.hxx>
+
+#include <MS_Class.hxx>
+#include <MS_Method.hxx>
+#include <MS_ExternMet.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_StdClass.hxx>
+#include <MS_InstClass.hxx>
+#include <MS_InstMet.hxx>
+#include <MS_Pointer.hxx>
+#include <MS_Field.hxx>
+#include <MS_PrimType.hxx>
+#include <MS_GenType.hxx>
+#include <MS_GenClass.hxx>
+#include <MS_Param.hxx>
+#include <MS_Enum.hxx>
+#include <MS_Alias.hxx>
+#include <MS_Imported.hxx>
+
+#include <MS_DataMapIteratorOfMapOfGlobalEntity.hxx>
+#include <MS_DataMapIteratorOfMapOfType.hxx>
+#include <MS_DataMapIteratorOfMapOfMethod.hxx>
+
+#include <MS_HSequenceOfField.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfExternMet.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <MS_HSequenceOfGenType.hxx>
+#include <MS_HSequenceOfParam.hxx>
+#include <MS_HArray1OfParam.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <Standard_NullObject.hxx>
+
+#include <WOKTools_MapOfHAsciiString.hxx>
+
+#define CHECKERROR "Check"
+
+MS_MetaSchema::MS_MetaSchema()
+{
+}
+
+Standard_Boolean MS_MetaSchema::AddPackage(const Handle(MS_Package)& aCommon)
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myPackages.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myPackages.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema:AddPackage: - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddEngine(const Handle(MS_Engine)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myEngines.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myEngines.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema:AddEngine: - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddComponent(const Handle(MS_Component)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myComponents.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myComponents.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema:AddComponent: - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddSchema(const Handle(MS_Schema)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!mySchemas.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      mySchemas.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::AddSchemas - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddExecutable(const Handle(MS_Executable)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myExecutables.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myExecutables.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::AddExecutable - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddInterface(const Handle(MS_Interface)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myInterfaces.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myInterfaces.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::AddInterface - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddType(const Handle(MS_Type)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!aCommon.IsNull()) {
+    if (!myTypes.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myTypes.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::AddType - aCommon is NULL");
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddMethod(const Handle(MS_Method)& aCommon)
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myMethods.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myMethods.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::AddMethod - aCommon is NULL");
+  }
+
+  return result;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Executables() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(myExecutables);
+
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Components() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(myComponents);
+
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Engines() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(myEngines);
+
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Schemas() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(mySchemas);
+
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Interfaces() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(myInterfaces);
+
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Packages() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(myPackages);
+  
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfType MS_MetaSchema::Types() const 
+{
+  MS_DataMapIteratorOfMapOfType anIterator(myTypes);
+  
+  return anIterator;
+}
+
+MS_DataMapIteratorOfMapOfMethod MS_MetaSchema::Methods() const 
+{
+  MS_DataMapIteratorOfMapOfMethod anIterator(myMethods);
+
+  return anIterator;
+}
+
+const Handle(MS_Executable)& MS_MetaSchema::GetExecutable(const Handle(TCollection_HAsciiString)& anExecutable) const 
+{
+  static Handle(MS_Executable) NULLRESULT;
+
+  if (!anExecutable.IsNull()) {
+    return *((Handle(MS_Executable) *) &(myExecutables.Find(anExecutable)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetExecutable - anExecutable is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+const Handle(MS_Engine)& MS_MetaSchema::GetEngine(const Handle(TCollection_HAsciiString)& anEngine) const 
+{
+  static Handle(MS_Engine) NULLRESULT;
+
+  if (!anEngine.IsNull()) {
+    return *((Handle(MS_Engine) *) &(myEngines.Find(anEngine)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetEngine - anEngine is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+const Handle(MS_Component)& MS_MetaSchema::GetComponent(const Handle(TCollection_HAsciiString)& anComponent) const 
+{
+  static Handle(MS_Component) NULLRESULT;
+
+  if (!anComponent.IsNull()) {
+    return *((Handle(MS_Component) *) &(myComponents.Find(anComponent)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetComponent - anComponent is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+const Handle(MS_Schema)& MS_MetaSchema::GetSchema(const Handle(TCollection_HAsciiString)& aSchema) const 
+{
+  static Handle(MS_Schema) NULLRESULT;
+
+  if (!aSchema.IsNull()) {
+    return *((Handle(MS_Schema) *) &(mySchemas.Find(aSchema)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetSchema - aSchema is NULL");
+  }
+
+  return NULLRESULT; 
+}
+
+const Handle(MS_Interface)& MS_MetaSchema::GetInterface(const Handle(TCollection_HAsciiString)& anInterface) const 
+{
+  static Handle(MS_Interface) NULLRESULT;
+
+  if (!anInterface.IsNull()) {
+    return *((Handle(MS_Interface) *) &(myInterfaces.Find(anInterface)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetInterface - anInterface is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+const Handle(MS_Package)& MS_MetaSchema::GetPackage(const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+  static Handle(MS_Package) NULLRESULT;
+
+  if (!aPackage.IsNull()) {
+    return  *((Handle(MS_Package) *) &(myPackages.Find(aPackage)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetPackage - aPackage is NULL");
+  }
+  
+  return NULLRESULT;
+}
+
+void MS_MetaSchema::RemoveExecutable(const Handle(TCollection_HAsciiString)& aPackage)
+{
+   if (!aPackage.IsNull()) {
+     if (myExecutables.IsBound(aPackage))
+       myExecutables.UnBind(aPackage);
+   }
+}
+
+void MS_MetaSchema::RemoveEngine(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage.IsNull()) {
+    if (myEngines.IsBound(aPackage))
+      myEngines.UnBind(aPackage);
+  }
+}
+void MS_MetaSchema::RemoveComponent(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage.IsNull()) {
+    if (myComponents.IsBound(aPackage))
+      myComponents.UnBind(aPackage);
+  }
+}
+
+void MS_MetaSchema::RemoveSchema(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage.IsNull()) {
+    if (mySchemas.IsBound(aPackage))
+    mySchemas.UnBind(aPackage);
+  }
+}
+
+void MS_MetaSchema::RemoveInterface(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage.IsNull()) {
+    if (myInterfaces.IsBound(aPackage))
+      myInterfaces.UnBind(aPackage);
+  }
+}
+
+void MS_MetaSchema::RemovePackage(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  Handle(MS_Package)                      result;
+  Handle(TColStd_HSequenceOfHAsciiString) aSeq;
+  Handle(MS_HSequenceOfExternMet)         aSeqMet;
+
+  if (!aPackage.IsNull()) {
+    Standard_Integer i;
+
+    result = GetPackage(aPackage);
+
+    aSeq = result->Classes();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeq = result->Enums();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeq = result->Excepts();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeq = result->Aliases();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeq = result->Pointers();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeq = result->Importeds();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeq = result->Primitives();
+
+    for(i = 1; i <= aSeq->Length(); i++) {
+      RemoveType(MS::BuildFullName(aPackage,aSeq->Value(i)),Standard_False);
+    }
+
+    aSeqMet = result->Methods();
+
+    for(i = 1; i <= aSeqMet->Length(); i++) {
+      RemoveMethod(aSeqMet->Value(i)->FullName());
+    }
+
+    myPackages.UnBind(aPackage);
+  }
+}
+
+const Handle(MS_Type)& MS_MetaSchema::GetType(const Handle(TCollection_HAsciiString)& aType) const 
+{
+  static Handle(MS_Type) NULLRESULT;
+
+  if (!aType.IsNull()) {
+    return (*((Handle(MS_Type)*)&myTypes.Find(aType)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetType - aType is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+void MS_MetaSchema::RemoveType(const Handle(TCollection_HAsciiString)& aType,
+                              const Standard_Boolean mustUpdatePackage)
+{
+  Handle(MS_Type)    aMSType;
+  Handle(MS_Package) aPackage;
+
+  if (!aType.IsNull()) {
+    if (!IsDefined(aType)) {
+      return;
+    }
+//    cout << "--> KILL " << aType->ToCString() << endl;
+    aMSType = GetType(aType);
+
+    if (aMSType->IsKind(STANDARD_TYPE(MS_Class))) {
+      Handle(MS_Class)                aClass = *((Handle(MS_Class)*)&aMSType);
+      Handle(MS_HSequenceOfMemberMet) aMetSeq = aClass->GetMethods();
+      Standard_Integer                i;
+      
+      if (mustUpdatePackage) {
+       Handle(TColStd_HSequenceOfHAsciiString) aSeq;
+       Standard_Integer                        i;
+
+       aPackage = aClass->Package();
+       aSeq = aPackage->Classes();
+
+       for(i = 1; i <= aSeq->Length(); i++) {
+         if (aType->IsSameString(MS::BuildFullName(aPackage->Name(),aSeq->Value(i)))) {
+           aSeq->Remove(i);
+           break;
+         }
+       }
+      }
+
+      for (i = 1; i <= aMetSeq->Length(); i++) {
+       RemoveMethod(aMetSeq->Value(i)->FullName());
+      }
+
+      myTypes.UnBind(aType);
+
+      if (aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+       Handle(MS_StdClass) stdclass = *((Handle(MS_StdClass)*)&aClass);
+
+       if (!stdclass->GetMyCreator().IsNull()){
+         Handle(MS_InstClass) insclass = stdclass->GetMyCreator();
+
+         for (i = 1; i <= insclass->GetNestedStdClassesName()->Length(); i++) {
+           RemoveType(MS::BuildFullName(insclass->Package()->Name(),insclass->GetNestedStdClassesName()->Value(i)));
+         }
+         insclass->GetNestedStdClassesName()->Clear();
+
+         for (i = 1; i <= insclass->GetNestedInsClassesName()->Length(); i++) {
+           RemoveType(MS::BuildFullName(insclass->Package()->Name(),insclass->GetNestedInsClassesName()->Value(i)));
+         }
+         insclass->GetNestedInsClassesName()->Clear();
+
+         for (i = 1; i <= insclass->GetNestedNeuClassesName()->Length(); i++) {
+           RemoveType(MS::BuildFullName(insclass->Package()->Name(),insclass->GetNestedNeuClassesName()->Value(i)));
+         }
+         insclass->GetNestedNeuClassesName()->Clear();
+       }
+      } 
+      else if (aClass->IsKind(STANDARD_TYPE(MS_GenClass))) {
+       Handle(MS_GenClass) genclass = *((Handle(MS_GenClass)*)&aClass);
+
+       for (i = 1; i <= genclass->GetNestedStdClassesName()->Length(); i++) {
+//       cout << "NestedStdClassesName :" << genclass->GetNestedStdClassesName()->Value(i)->ToCString() << endl;
+         RemoveType(MS::BuildFullName(genclass->Package()->Name(),genclass->GetNestedStdClassesName()->Value(i)),Standard_False);
+       }
+
+       for (i = 1; i <= genclass->GetNestedName()->Length(); i++) {
+//       cout << "NestedName :" << genclass->GetNestedName()->Value(i)->ToCString() << endl;
+         RemoveType(MS::BuildFullName(genclass->Package()->Name(),genclass->GetNestedName()->Value(i)));
+       }
+
+       for (i = 1; i <= genclass->GetNestedInsClassesName()->Length(); i++) {
+//       cout << "NestedInsClassesName :" << genclass->GetNestedInsClassesName()->Value(i)->ToCString() << endl;
+         RemoveType(MS::BuildFullName(genclass->Package()->Name(),genclass->GetNestedInsClassesName()->Value(i)));
+       }
+      }
+    }
+    else {
+      myTypes.UnBind(aType);
+    }
+  }
+}
+
+const Handle(MS_Method)& MS_MetaSchema::GetMethod(const Handle(TCollection_HAsciiString)& aMethod) const 
+{
+  static Handle(MS_Method) NULLRESULT;
+
+  if (!aMethod.IsNull()) {
+    return *((Handle(MS_Method)*)&myMethods.Find(aMethod));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetMethod - aType is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+void MS_MetaSchema::RemoveMethod(const Handle(TCollection_HAsciiString)& aMethod)
+{
+  if (!aMethod.IsNull()) {
+    myMethods.UnBind(aMethod);
+  }
+}
+
+Standard_Boolean MS_MetaSchema::IsExecutable(const Handle(TCollection_HAsciiString)& anExecutable) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!anExecutable.IsNull()) {
+    result = myExecutables.IsBound(anExecutable);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsExecutable - anExecutable is NULL");
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsEngine(const Handle(TCollection_HAsciiString)& anEngine) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!anEngine.IsNull()) {
+    result = myEngines.IsBound(anEngine);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsEngine - anEngine is NULL");
+  }
+  
+  return result;
+}
+Standard_Boolean MS_MetaSchema::IsComponent(const Handle(TCollection_HAsciiString)& anComponent) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!anComponent.IsNull()) {
+    result = myComponents.IsBound(anComponent);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsComponent - anComponent is NULL");
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsSchema(const Handle(TCollection_HAsciiString)& aSchema) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!aSchema.IsNull()) {
+    result = mySchemas.IsBound(aSchema);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsSchema - aSchema is NULL");
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsInterface(const Handle(TCollection_HAsciiString)& anInterface) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!anInterface.IsNull()) {
+    result = myInterfaces.IsBound(anInterface);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsInterface - anInterface is NULL");
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsPackage(const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aPackage.IsNull()) {
+    result = myPackages.IsBound(aPackage);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsPackage - aPackage is NULL");
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsDefined(const Handle(TCollection_HAsciiString)& aType, const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+  Standard_Boolean                 result = Standard_False;
+  Handle(TCollection_HAsciiString) FullName = new TCollection_HAsciiString(aPackage);
+
+  FullName->AssignCat("_");
+  FullName->AssignCat(aType);
+
+  result = IsDefined(FullName);
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsDefined(const Handle(TCollection_HAsciiString)& aType) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!aType.IsNull()) {
+    result = myTypes.IsBound(aType);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsDefined - aType is NULL");
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::IsMethod(const Handle(TCollection_HAsciiString)& aMethod) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!aMethod.IsNull()) {
+    result = myMethods.IsBound(aMethod);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsMethod - aMethod is NULL");
+  }
+  
+  return result;
+}
+
+
+Handle(MS_HSequenceOfInstClass) MS_MetaSchema::GetInstantiations(const Handle(TCollection_HAsciiString)& aGenClass) const
+{
+  Handle(MS_HSequenceOfInstClass) aSeq = new MS_HSequenceOfInstClass;
+  Handle(MS_Type)                 anEntity;
+  MS_DataMapIteratorOfMapOfType   anIterator(myTypes);
+  Handle(MS_StdClass)             aClass;
+  Handle(MS_InstClass)            anInst;
+
+  while(anIterator.More()) {
+    anEntity = anIterator.Value();
+    aClass   = Handle(MS_StdClass)::DownCast(anEntity);
+
+    if (!aClass.IsNull()) {
+      if (!aClass->GetMyCreator().IsNull()) {
+       anInst = aClass->GetMyCreator();
+
+       if (anInst->GenClass()->IsSameString(aGenClass)) {
+         aSeq->Append(anInst);
+       }
+      }
+    }
+    anIterator.Next();
+  }
+
+  return aSeq;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_MetaSchema::GetPersistentClassesFromSchema(const Handle(TCollection_HAsciiString)& aSchema, const Standard_Boolean withStorable) const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+
+  if (IsSchema(aSchema)) {
+    WOKTools_MapOfHAsciiString              aMap;
+    Standard_Integer                        i,j,k;
+    Handle(MS_Schema)                       theSchema;
+    Handle(MS_Type)                         theType;
+    Handle(MS_StdClass)                     theStdClass,anOther;
+    Handle(TColStd_HSequenceOfHAsciiString) classList,
+                                            packageList;
+
+    theSchema = GetSchema(aSchema);
+
+    classList = theSchema->GetClasses();
+
+    for (i = 1; i <= classList->Length(); i++) {
+      if (!aMap.Contains(classList->Value(i))) {
+//     cout << "MS_MetaSchema::GetPersistentClassesFromSchema : " << classList->Value(i)->ToCString() << endl;
+
+       if (IsDefined(classList->Value(i))) {
+         theType = GetType(classList->Value(i));
+
+         if (theType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+           theStdClass = Handle(MS_StdClass)::DownCast(theType);
+
+           if ((theStdClass->IsPersistent() || (withStorable && theStdClass->IsStorable())) && !theStdClass->IsGeneric()) {
+             aMap.Add(classList->Value(i));
+             result->Append(classList->Value(i));
+           }
+
+           if (!theStdClass->GetMyCreator().IsNull()) {
+             Handle(MS_InstClass)                    anInst = theStdClass->GetMyCreator();
+             Handle(TColStd_HSequenceOfHAsciiString) inslist;
+
+             inslist = anInst->GetNestedStdClassesName();
+             
+             for (k = 1; k <= inslist->Length(); k++) {
+               theType = GetType(MS::BuildFullName(theStdClass->Package()->Name(),inslist->Value(k)));
+               anOther = Handle(MS_StdClass)::DownCast(theType);
+
+               if ((anOther->IsPersistent() || (withStorable && anOther->IsStorable())) && !anOther->IsGeneric()) {
+                 aMap.Add(theType->FullName());
+                 result->Append(theType->FullName());
+//               cout << "MS_MetaSchema::GetPersistentClassesFromSchema : " << inslist->Value(k)->ToCString() << endl;
+               }
+             }
+
+             inslist = anInst->GetNestedInsClassesName();
+             
+             for (k = 1; k <= inslist->Length(); k++) {
+               theType = GetType(MS::BuildFullName(theStdClass->Package()->Name(),inslist->Value(k)));
+               anOther = Handle(MS_StdClass)::DownCast(theType);
+               
+               if (!anOther.IsNull()) {
+                 if ((anOther->IsPersistent() || (withStorable && anOther->IsStorable())) && !anOther->IsGeneric()) {
+                   aMap.Add(theType->FullName());
+                   result->Append(theType->FullName());
+//                 cout << "MS_MetaSchema::GetPersistentClassesFromSchema : " << inslist->Value(k)->ToCString() << endl;
+                 }
+               }
+             }
+      
+           }
+         }
+       }
+      }
+    }
+
+    packageList = theSchema->GetPackages();
+
+    Handle(MS_Package)               thePackage;
+    Handle(TCollection_HAsciiString) className;
+
+    for (j = 1; j <=  packageList->Length(); j++) {
+      if (IsPackage(packageList->Value(j))) {
+       thePackage = GetPackage(packageList->Value(j));
+       
+       classList = thePackage->Classes();
+
+        for (i = 1; i <= classList->Length(); i++) {
+          className = MS::BuildFullName(packageList->Value(j),classList->Value(i));
+
+          if (!aMap.Contains(className)) {
+//          cout << "MS_MetaSchema::GetPersistentClassesFromSchema : " << className->ToCString() << endl;
+            if (IsDefined(className)) {
+              theType = GetType(className);
+              
+              if (theType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+                theStdClass = Handle(MS_StdClass)::DownCast(theType);
+                
+                if ((theStdClass->IsPersistent() || (withStorable && theStdClass->IsStorable())) && !theStdClass->IsGeneric()) {
+                  aMap.Add(className);
+                  result->Append(className);
+                }
+
+                if (!theStdClass->GetMyCreator().IsNull()) {
+                  Handle(MS_InstClass)                    anInst = theStdClass->GetMyCreator();
+                  Handle(TColStd_HSequenceOfHAsciiString) inslist;
+                  
+                  inslist = anInst->GetNestedStdClassesName();
+                  
+                  for (k = 1; k <= inslist->Length(); k++) {
+                    theType = GetType(MS::BuildFullName(theStdClass->Package()->Name(),inslist->Value(k)));
+
+                    if (!aMap.Contains(theType->FullName())) {
+                      anOther = Handle(MS_StdClass)::DownCast(theType);
+                      
+                      if ((anOther->IsPersistent() || (withStorable && anOther->IsStorable())) && !anOther->IsGeneric()) {
+                        aMap.Add(theType->FullName());
+                        result->Append(theType->FullName());
+//                      cout << "MS_MetaSchema::GetPersistentClassesFromSchema : " << theType->FullName()->ToCString() << endl;
+                      }
+                    }
+                  }
+                  
+                  inslist = anInst->GetNestedInsClassesName();
+                  
+                  for (k = 1; k <= inslist->Length(); k++) {
+                    theType = GetType(MS::BuildFullName(theStdClass->Package()->Name(),inslist->Value(k)));
+
+                    if (!aMap.Contains(theType->FullName())) {
+                      anOther = Handle(MS_StdClass)::DownCast(theType);
+                      
+                      if (!anOther.IsNull()) {
+                        if ((anOther->IsPersistent() || (withStorable && anOther->IsStorable())) && !anOther->IsGeneric()) {
+                          aMap.Add(theType->FullName());
+                          result->Append(theType->FullName());
+//                        cout << "MS_MetaSchema::GetPersistentClassesFromSchema : " << theType->FullName()->ToCString() << endl;
+                        }
+                      }
+                    }
+                  }
+                  
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  return result;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_MetaSchema::GetPersistentClassesFromClasses(const Handle(TColStd_HSequenceOfHAsciiString)& aClassList, const Standard_Boolean withStorable) const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+  
+  if (!aClassList.IsNull()) {
+    WOKTools_MapOfHAsciiString              aMap,
+                                            alreadyProcMap;
+    Handle(MS_StdClass)                     theStdClass,
+                                            theLocalClass;
+    Standard_Integer                        i,
+                                            lenList,
+                                            j,
+                                            k;
+    Handle(TColStd_HSequenceOfHAsciiString) ascSeq,
+                                            tmpClassList,
+                                            tmpResult = new TColStd_HSequenceOfHAsciiString;
+    Standard_Boolean                        isEnd        = Standard_False;
+    Handle(MS_Type)                         theType;
+
+    lenList = aClassList->Length();
+
+    for (i = 1; i <= lenList; i++) {
+      if (!aMap.Contains(aClassList->Value(i))) {
+       aMap.Add(aClassList->Value(i));
+//     cout << "MS_MetaSchema::GetPersistentClassesFromClasses : " << aClassList->Value(i)->ToCString() << endl;
+      }
+    }
+
+    tmpClassList = aClassList;
+
+    while(!isEnd) {
+      isEnd = Standard_True;
+
+      for (i = 1; i <= lenList; i++) {
+       
+       if (!alreadyProcMap.Contains(tmpClassList->Value(i))) {
+         alreadyProcMap.Add(tmpClassList->Value(i));
+
+         if (IsDefined(tmpClassList->Value(i))) {
+           theStdClass = Handle(MS_StdClass)::DownCast(GetType(tmpClassList->Value(i)));
+           
+           if (!theStdClass.IsNull()) {
+             ascSeq = theStdClass->GetFullInheritsNames();
+             
+             // Inherits
+             //
+             for (j = 1; j <= ascSeq->Length(); j++) {
+               if (IsDefined(ascSeq->Value(j))) {
+//               cout << "MS_MetaSchema::GetPersistentClassesFromClasses : " << ascSeq->Value(j)->ToCString() << endl;
+                 theLocalClass = Handle(MS_StdClass)::DownCast(GetType(ascSeq->Value(j)));
+                 
+                 if (!theLocalClass.IsNull() && !aMap.Contains(ascSeq->Value(j))) {
+                   if (theLocalClass->IsPersistent() || theLocalClass->IsStorable()) {
+                     tmpResult->Append(ascSeq->Value(j));
+                     if (theLocalClass->IsPersistent() || (withStorable && theLocalClass->IsStorable())) {
+                       result->Append(ascSeq->Value(j));
+//                     cout << "MS_MetaSchema::GetPersistentClassesFromClasses : ADD " << ascSeq->Value(j)->ToCString() << endl;
+                     }
+                     aMap.Add(ascSeq->Value(j));
+                     isEnd = Standard_False;
+                   } 
+                 }
+               }
+             }
+
+             ascSeq = theStdClass->GetUsesNames();
+             
+             // Used Classes
+             //
+             for (j = 1; j <= ascSeq->Length(); j++) {
+               if (IsDefined(ascSeq->Value(j))) {
+                 theLocalClass = Handle(MS_StdClass)::DownCast(GetType(ascSeq->Value(j)));
+                 
+                 if (!theLocalClass.IsNull() && !aMap.Contains(ascSeq->Value(j))) {
+                   if (theLocalClass->IsPersistent() || theLocalClass->IsStorable()) {
+                     tmpResult->Append(ascSeq->Value(j));
+                     if (theLocalClass->IsPersistent() || (withStorable && theLocalClass->IsStorable())) {
+                       result->Append(ascSeq->Value(j));
+//                     cout << "MS_MetaSchema::GetPersistentClassesFromClasses : ADD " << ascSeq->Value(j)->ToCString() << endl;
+                     }
+                     aMap.Add(ascSeq->Value(j));
+                     isEnd = Standard_False;
+                   }
+                 }
+               }
+             }
+
+             if (!theStdClass->GetMyCreator().IsNull()) {
+               Handle(MS_InstClass)                    anInst = theStdClass->GetMyCreator();
+               Handle(TColStd_HSequenceOfHAsciiString) inslist;
+
+               inslist = anInst->GetNestedStdClassesName();
+               
+               for (k = 1; k <= inslist->Length(); k++) {
+                 theType = GetType(MS::BuildFullName(theStdClass->Package()->Name(),inslist->Value(k)));
+                 theLocalClass = Handle(MS_StdClass)::DownCast(theType);
+
+                 if (!theLocalClass.IsNull() && !aMap.Contains(theLocalClass->FullName())) {
+                   if (theLocalClass->IsPersistent() || theLocalClass->IsStorable()) {
+                     tmpResult->Append(theLocalClass->FullName());      
+                     if ((theLocalClass->IsPersistent() || (withStorable && theLocalClass->IsStorable())) && !theLocalClass->IsGeneric()) {
+                       result->Append(theLocalClass->FullName());
+//                     cout << "MS_MetaSchema::GetPersistentClassesFromClasses : " << theLocalClass->FullName()->ToCString() << endl;
+                     }
+                     aMap.Add(theLocalClass->FullName());
+                     isEnd = Standard_False;
+                   }
+                 }
+               }
+
+               inslist = anInst->GetNestedInsClassesName();
+               
+               for (k = 1; k <= inslist->Length(); k++) {
+                 theType = GetType(MS::BuildFullName(theStdClass->Package()->Name(),inslist->Value(k)));
+                 theLocalClass = Handle(MS_StdClass)::DownCast(theType);
+                 
+                 if (!theLocalClass.IsNull() && !aMap.Contains(theLocalClass->FullName())) {
+                   if (theLocalClass->IsPersistent() || theLocalClass->IsStorable()) {
+                     tmpResult->Append(theLocalClass->FullName());      
+                     if ((theLocalClass->IsPersistent() || (withStorable && theLocalClass->IsStorable())) && !theLocalClass->IsGeneric()) {
+                       result->Append(theLocalClass->FullName());
+//                     cout << "MS_MetaSchema::GetPersistentClassesFromClasses : " << theLocalClass->FullName()->ToCString() << endl;
+                     }
+                     aMap.Add(theLocalClass->FullName());
+                     isEnd = Standard_False;
+                   }
+                 }
+               }
+             }
+
+           }
+         }
+       }
+
+      }
+      
+      tmpClassList = tmpResult;
+      tmpResult    = new TColStd_HSequenceOfHAsciiString;
+      lenList      = tmpClassList->Length();
+    }   
+  }     
+  
+  return result;
+}
+
+// Check consistency of a GlobalEntity
+//
+Standard_Boolean MS_MetaSchema::Check(const Handle(TCollection_HAsciiString)& aName) const
+{
+  Standard_Boolean result = Standard_True,locRes;
+  
+  if (IsPackage(aName)) {
+    Handle(MS_Package)                      aPack = GetPackage(aName);
+    Handle(TColStd_HSequenceOfHAsciiString) aASeq;
+    Standard_Integer                        i;
+
+    aASeq = aPack->Classes();
+
+    Handle(MS_Class)                 aClass;
+    Handle(TCollection_HAsciiString) fullName;
+
+    for (i = 1; i <= aASeq->Length(); i++) {
+      fullName = MS::BuildFullName(aName,aASeq->Value(i));
+
+      aClass = Handle(MS_Class)::DownCast(GetType(fullName));
+
+      locRes = CheckClass(aClass);
+      result = result && locRes;
+    }
+
+    Handle(MS_HSequenceOfExternMet) met = aPack->Methods();
+
+    for (i = 1; i <= met->Length(); i++) {
+      locRes = CheckExternMethod(met->Value(i));
+      result = result && locRes;
+    }
+  }
+  else if (IsSchema(aName)) {
+    Handle(MS_Schema) sch = GetSchema(aName);
+    Handle(TColStd_HSequenceOfHAsciiString) aSeq = sch->GetClasses();
+    Standard_Integer                        i;
+
+    for (i = 1; i <= aSeq->Length(); i++) {
+      if (!IsDefined(aSeq->Value(i))) {
+       ErrorMsg << CHECKERROR << "the class " << aSeq->Value(i)->ToCString() << " used in schema is not defined in a package." << endm;
+       result = Standard_False;
+      }
+    }
+
+    aSeq = sch->GetPackages();
+
+    for (i = 1; i <= aSeq->Length(); i++) {
+      if (!IsPackage(aSeq->Value(i))) {
+       ErrorMsg << CHECKERROR << "the package " << aSeq->Value(i)->ToCString() << " used in schema does not exist." << endm;
+       result = Standard_False;
+      }
+    }
+  }
+  else if (IsClient(aName)) {
+    Handle(MS_Client)                       client = GetClient(aName);
+    Handle(TColStd_HSequenceOfHAsciiString) aASeq;
+    Standard_Integer                        i;
+    Handle(MS_Method)                       met;
+
+    aASeq = client->Methods();
+
+    for (i = 1; i <= aASeq->Length(); i++) {
+      met = MS::GetMethodFromFriendName(this,aASeq->Value(i));
+
+      if (met.IsNull()) {
+       ErrorMsg << CHECKERROR << "the method " << aASeq->Value(i)->ToCString() << " is not defined." << endm;
+       result = Standard_False;
+      }
+    }
+
+    aASeq = client->Interfaces();
+
+    for (i = 1; i <= aASeq->Length(); i++) {
+      if (IsInterface(aASeq->Value(i))) {
+       locRes = Check(aASeq->Value(i));
+       result = result && locRes;
+      }
+      else {
+       ErrorMsg << CHECKERROR << "in client " << aName->ToCString() << ", the interface " << aASeq->Value(i)->ToCString() << " is not defined." << endm;
+       result = Standard_False;
+      }
+    }
+  }
+  else if (IsEngine(aName)) {
+    Handle(MS_Engine)                       engine = GetEngine(aName);
+    Handle(TColStd_HSequenceOfHAsciiString) aASeq;
+    Standard_Integer                        i;
+
+    aASeq = engine->Interfaces();
+
+    for (i = 1; i <= aASeq->Length(); i++) {
+      if (IsInterface(aASeq->Value(i))) {
+       locRes = Check(aASeq->Value(i));
+       result = result && locRes;
+      }
+      else {
+       ErrorMsg << CHECKERROR << "in engine " << aName->ToCString() << ", the interface " << aASeq->Value(i)->ToCString() << " is not defined." << endm;
+       result = Standard_False;
+      }
+    }
+  }
+  else if (IsInterface(aName)) {
+    Handle(MS_Interface)                    anInter = GetInterface(aName);
+    Handle(TColStd_HSequenceOfHAsciiString) aASeq;
+    Standard_Integer                        i;
+
+    aASeq = anInter->Classes();
+
+    Handle(MS_Type)                  aType;
+    Handle(TCollection_HAsciiString) fullName;
+
+    for (i = 1; i <= aASeq->Length(); i++) {
+      fullName = aASeq->Value(i);
+      if (IsDefined(fullName)) {
+       aType = GetType(fullName);
+       
+       locRes = aType->IsKind(STANDARD_TYPE(MS_Class));
+       
+       if (!locRes) {
+         ErrorMsg << CHECKERROR << "the type " << fullName->ToCString() << " is not a class." << endm;
+         result = Standard_False;
+       }
+       
+       if (aType->IsKind(STANDARD_TYPE(MS_GenClass))) {
+         ErrorMsg << CHECKERROR << "the type " << fullName->ToCString() << " is a generic class, it cannot be exported." << endm;
+         result = Standard_False;
+       }
+      }
+      else {
+       ErrorMsg << CHECKERROR << "the type " << fullName->ToCString() << " is not defined." << endm;
+       result = Standard_False;
+      }
+    }   
+    
+    aASeq = anInter->Methods();
+    Handle(MS_Method)                       amet;
+    
+    for (i = 1; i <= aASeq->Length(); i++) {
+      amet = MS::GetMethodFromFriendName(this,aASeq->Value(i));
+      
+      if (amet.IsNull()) {
+       ErrorMsg << CHECKERROR << "the method " << aASeq->Value(i)->ToCString() << " is not defined." << endm;
+       result = Standard_False;
+      }
+    }
+  }
+  else if (IsDefined(aName)) {
+    Handle(MS_Type) type = GetType(aName);
+    if (type->IsKind(STANDARD_TYPE(MS_Class))) {
+      Handle(MS_Class) aClass = *((Handle(MS_Class)*)&type);
+
+      locRes = CheckClass(aClass);
+      result = result && locRes;
+    }
+  }
+  
+  return result;
+}
+
+// WARNING : do not modify this part unless you understand it
+//
+Standard_Boolean MS_MetaSchema::CheckClass(const Handle(MS_Class)& aClass) const
+{
+  Standard_Boolean                        result        = Standard_True,
+                                          isFound,
+                                          locRes;
+  Standard_Integer                        i,j,k;
+  Handle(MS_HSequenceOfField)             aSeqField     = aClass->GetFields();
+  Handle(TColStd_HSequenceOfHAsciiString) uses;
+  Handle(MS_Type)                         theType;
+
+  // Check uses
+  //
+  uses = aClass->GetUsesNames();
+  
+  for (i = 1; i <= uses->Length(); i++) {
+    locRes = IsDefined(uses->Value(i));
+    
+    if (!locRes) {
+       ErrorMsg << CHECKERROR << "the type " << uses->Value(i)->ToCString() << " is not defined." << endm;
+       ErrorMsg << CHECKERROR << "first reference in 'uses' clause of " << aClass->FullName()->ToCString() << endm;
+    }
+    else {
+      theType = GetType(uses->Value(i));
+
+      if (theType->IsKind(STANDARD_TYPE(MS_GenClass))) {
+       ErrorMsg << CHECKERROR << "the generic class " << uses->Value(i)->ToCString() << " cannot be" << endm;
+       ErrorMsg << CHECKERROR << "in 'uses' clause of " << aClass->FullName()->ToCString() << endm;
+       locRes = Standard_False;
+      }
+    }
+
+    result = result && locRes;
+  }    
+  
+  // Check inherits 
+  //
+  uses = aClass->GetFullInheritsNames();
+
+  Handle(MS_HSequenceOfMemberMet)  aSeqM,
+                                   aSeqM_i_1,
+                                   aSeqM_i;
+  Handle(MS_StdClass)              aInhClass;
+  Standard_Boolean                 starTestDeferred = Standard_False,
+                                   beginTestDeferred = Standard_False;
+
+  for (i = uses->Length(); i >= 1; i--) {
+    locRes = IsDefined(uses->Value(i));
+    
+    if (!locRes) {
+       ErrorMsg << CHECKERROR << "the type " << uses->Value(i)->ToCString() << " is not defined." << endm;
+       ErrorMsg << CHECKERROR << "first reference in 'inherits' clause of ";
+
+       if (i == 1) {
+        ErrorMsg << aClass->FullName()->ToCString() << endm;
+       }
+       else {
+        ErrorMsg << uses->Value(i-1)->ToCString() << endm;
+       }
+    }
+    else {
+      theType = GetType(uses->Value(i));
+
+      if (theType->IsKind(STANDARD_TYPE(MS_GenClass))) {
+       ErrorMsg << CHECKERROR << "the generic class " << uses->Value(i)->ToCString() << " cannot be" << endm;
+       ErrorMsg << CHECKERROR << "in 'inherits' clause of ";
+
+       if (i == 1) {
+         ErrorMsg << aClass->FullName()->ToCString() << endm;
+       }
+       else {
+         ErrorMsg << uses->Value(i-1)->ToCString() << endm;
+       }
+
+       locRes = Standard_False;
+      }
+    }
+
+    // Check deferred methods
+    //
+    if (locRes) {
+      theType = GetType(uses->Value(i));
+
+      if (theType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+       aInhClass    = *((Handle(MS_StdClass)*)&theType);
+
+       // WARNING : This code is valid only because these Standard classes have no deferred methods
+       //
+       if (!starTestDeferred &&
+           !aInhClass->FullName()->IsSameString(MS::GetPersistentRootName()) &&
+           !aInhClass->FullName()->IsSameString(MS::GetStorableRootName()) &&
+           !aInhClass->FullName()->IsSameString(MS::GetTransientRootName()) &&
+           aInhClass->Deferred()) {
+         starTestDeferred = Standard_True;
+         beginTestDeferred = Standard_True;
+       }
+
+       if (starTestDeferred) {
+         aSeqM_i_1 = aSeqM_i;
+         aSeqM     = aInhClass->GetMethods();
+         aSeqM_i   = new MS_HSequenceOfMemberMet;
+         
+         if (i == uses->Length() || beginTestDeferred) {
+           beginTestDeferred = Standard_False;
+           aSeqM             = aInhClass->GetMethods();
+           aSeqM_i           = new MS_HSequenceOfMemberMet;
+           
+           for(j = 1; j <= aSeqM->Length(); j++) {
+             if (aSeqM->Value(j)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+               Handle(MS_InstMet) im = *((Handle(MS_InstMet)*)&aSeqM->Value(j));
+               
+               if (im->IsDeferred()) {
+                 aSeqM_i->Append(im);
+               }
+             }
+           }
+         }
+         else {
+           for(j = 1; j <= aSeqM->Length(); j++) {
+             if (aSeqM->Value(j)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+               Handle(MS_InstMet) im = *((Handle(MS_InstMet)*)&aSeqM->Value(j));
+               
+               isFound = Standard_False;
+               
+               for (k = 1; k <= aSeqM_i_1->Length() && !isFound; k++) {
+                 if (im->IsSameSignature(aSeqM_i_1->Value(k)->FullName())) {
+                   aSeqM_i_1->Remove(k);
+                   isFound = Standard_True;
+                 }
+               }
+               
+               if (im->IsDeferred()) {
+                 aSeqM_i->Append(im);
+               }
+             }
+           }
+           
+           if (aInhClass->Deferred()) {
+             aSeqM_i->Append(aSeqM_i_1);
+             aSeqM_i_1->Clear();
+           }
+           
+           if (aSeqM_i_1->Length() > 0) {
+             for (k = 1; k <= aSeqM_i_1->Length(); k++) {
+               ErrorMsg << CHECKERROR << "the deferred method " << aSeqM_i_1->Value(k)->FullName()->ToCString() << " must" << endm;
+               ErrorMsg << CHECKERROR << "have an implementation in class ";
+               
+               if (i == 1) {
+                 ErrorMsg << aClass->FullName()->ToCString() << endm;
+               }
+               else {
+                 ErrorMsg << uses->Value(i)->ToCString() << endm;
+               }
+             }
+             
+             locRes = Standard_False;
+           }
+         }
+       }
+      }
+    }
+    
+    result = result && locRes;
+  }  
+
+  if (starTestDeferred && (uses->Length() > 0) && aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+    aSeqM     = aClass->GetMethods();
+    aSeqM_i_1 = aSeqM_i;
+
+    for(j = 1; j <= aSeqM->Length(); j++) {
+      if (aSeqM->Value(j)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+       Handle(MS_InstMet) im = *((Handle(MS_InstMet)*)&aSeqM->Value(j));
+       
+       isFound = Standard_False;
+       
+       for (k = 1; k <= aSeqM_i_1->Length() && !isFound; k++) {
+         if (im->IsSameSignature(aSeqM_i_1->Value(k)->FullName())) {
+           aSeqM_i_1->Remove(k);
+           isFound = Standard_True;
+         }
+       }
+      }
+    }
+
+    if (aClass->Deferred()) {
+      aSeqM_i_1->Clear();
+    }
+    
+    if (aSeqM_i_1->Length() > 0) {
+      for (k = 1; k <= aSeqM_i_1->Length(); k++) {
+       ErrorMsg << CHECKERROR << "the deferred method " << aSeqM_i_1->Value(k)->FullName()->ToCString() << " must" << endm;
+       ErrorMsg << CHECKERROR << "have an implementation in class " << aClass->FullName()->ToCString() << endm;
+      }
+      
+      locRes = Standard_False;
+    }
+
+    result = result && locRes;
+  }
+
+  // Check fields
+  //
+  for (i = 1; i <= aSeqField->Length(); i++) {
+    locRes = CheckField(aSeqField->Value(i));
+    result = result && locRes;
+  }    
+    
+  // Check friends methods
+  //
+  Handle(MS_Method)                       met;
+  
+  uses = aClass->GetFriendMets();
+  
+  for (i = 1; i <= uses->Length(); i++) {
+    met = MS::GetMethodFromFriendName(this,uses->Value(i));
+    
+    if (met.IsNull()) {
+      ErrorMsg << CHECKERROR << "the friend method '" << uses->Value(i)->ToCString() << "' in 'friend' clause of the class '" << aClass->FullName()->ToCString() << "' is not defined." << endm;
+      result = Standard_False;
+    }
+  }
+
+  // Check methods
+  //
+  aSeqM = aClass->GetMethods();
+  
+  for (i = 1; i <= aSeqM->Length(); i++) {
+    locRes = CheckMemberMethod(aSeqM->Value(i));
+    result = locRes && result;
+  }
+  
+  if (aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+    Handle(MS_StdClass) aStdClass = *((Handle(MS_StdClass)*)&aClass);
+
+    if (!aStdClass->GetMyCreator().IsNull() && !aStdClass->IsGeneric()) {
+      Handle(MS_InstClass) anInstClass = aStdClass->GetMyCreator();
+
+      locRes = CheckInstClass(anInstClass);
+      result = locRes && result;
+    }
+  }
+
+  
+  return result;
+}
+
+// WARNING : do not modify this part unless you understand it
+//
+Standard_Boolean MS_MetaSchema::CheckMemberMethod(const Handle(MS_MemberMet)& aMeth) const
+{
+  Standard_Boolean                        result = Standard_True;
+  Handle(MS_Type)                         gettyperes = GetType(aMeth->Class());
+  Handle(MS_Class)                        aClass = *((Handle(MS_Class)*)&gettyperes);
+  Handle(TColStd_HSequenceOfHAsciiString) aSeqAncestors = aClass->GetFullInheritsNames();
+  Standard_Integer                        j,
+                                          len;
+  Handle(TCollection_HAsciiString)        whoStopRedefinition;
+  Handle(MS_Param)                        returnValue;
+
+  //    cout << "METHOD : " <<  aMeth->FullName()->ToCString() << endl;
+  
+  if (aMeth->IsKind(STANDARD_TYPE(MS_InstMet))) {
+    Handle(MS_InstMet) anInst = *((Handle(MS_InstMet)*)&aMeth),
+                       anOther;
+    Standard_Boolean   IsVirtual,
+                       IsDeferred,
+                       StopRedefinition;
+    Standard_Integer   whoIsDeferred,
+                       IsFound;
+    Standard_Boolean   myclassishandled = aClass->IsPersistent() || aClass->IsTransient();
+      
+    if (anInst->IsDeferred() && !aClass->Deferred()) {
+      ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have the keyword 'deferred' in a class without keyword 'deferred'." << endm;
+      result = Standard_False;
+    }
+
+    if (myclassishandled) {
+      if (anInst->IsOut()) {
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have the keyword 'out' but 'mutable' because it's comes from a Persistent or a Transient class." << endm;
+       result = Standard_False;
+      }
+    }
+    else {
+      if (anInst->IsMutable()) {
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have the keyword 'mutable' but 'out' because it does not comes from a Persistent or a Transient class." << endm;
+       result = Standard_False;
+      }
+    }
+
+    returnValue      = anInst->Returns();
+    IsVirtual        = Standard_False;
+    IsDeferred       = Standard_False;
+    StopRedefinition = Standard_False;
+    whoIsDeferred    = 0;
+    IsFound          = 0;
+    
+    for (j = 1; j <= aSeqAncestors->Length(); j++) {
+      Handle(MS_Class)                 anAncestor = Handle(MS_Class)::DownCast(GetType(aSeqAncestors->Value(j)));
+      Handle(MS_HSequenceOfMemberMet)  aSeqMA     = anAncestor->GetMethods();
+      
+      for (len = aSeqMA->Length(); len >= 1; len--) {
+       if (aSeqMA->Value(len)->IsKind(STANDARD_TYPE(MS_InstMet))) {
+         if (anInst->IsSameSignature(aSeqMA->Value(len)->FullName())) {
+           anOther = *((Handle(MS_InstMet)*)&aSeqMA->Value(len));
+           
+           IsFound = j;
+           
+           if (!returnValue.IsNull()) {
+             if (!anOther->Returns().IsNull()) {
+               if ((anOther->IsConstReturn() != anInst->IsConstReturn()) || (anOther->IsRefReturn() != anInst->IsRefReturn())) {
+                 result = Standard_False;
+                 ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have a different C++ return mode than" << endm;
+                 ErrorMsg << CHECKERROR << "the redefined super method : " << anOther->FullName()->ToCString() << endm;
+               }
+               
+               if (!anOther->Returns()->TypeName()->IsSameString(returnValue->TypeName())) {
+                 result = Standard_False;
+                 ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have a different return value than" << endm;
+                 ErrorMsg << CHECKERROR << "the redefined super method : " << anOther->FullName()->ToCString() << endm;
+               }
+             }
+             else {
+               result = Standard_False;
+               ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " have a return value but" << endm;
+               ErrorMsg << CHECKERROR << "not the super method " << anOther->FullName()->ToCString() << endm;
+             }
+           } 
+           else if (!anOther->Returns().IsNull()) {
+             result = Standard_False;
+             ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have a return value because" << endm;
+             ErrorMsg << CHECKERROR << "the super method " << anOther->FullName()->ToCString() << " does not have one" << endm;
+           }
+           
+           if (!IsDeferred && !StopRedefinition) {
+             IsDeferred = anOther->IsDeferred();
+             
+             if (IsDeferred) {
+               whoIsDeferred = j;
+             }
+           }
+           
+           if (!IsVirtual && !StopRedefinition) {
+             IsVirtual  = !anOther->IsStatic();
+           }
+           
+           if (anOther->IsRedefined() && !anOther->IsDeferred() && anOther->IsStatic()) {
+             IsVirtual  = Standard_False;
+             IsDeferred = Standard_False;
+             StopRedefinition       = Standard_True;
+             whoStopRedefinition = aSeqAncestors->Value(j);
+           }
+         }
+       }
+      }
+    }
+    
+    // the ancestors methods are not virtual or deferred but they are redefined here
+    // it's strange so we must take a look
+    //
+    if (!IsVirtual && !IsDeferred && IsFound != 0) {
+      
+      if (anInst->IsRedefined()) {
+       result = Standard_False;
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have the 'redefined' keyword" << endm;
+       
+       if (StopRedefinition) {
+         ErrorMsg << CHECKERROR << "the redefinition was stopped in class " << whoStopRedefinition->ToCString() << endm;
+       }
+       else {
+         ErrorMsg << CHECKERROR << "to be able to make this redefinition, the keyword 'is virtual' must be set at the end of the method of the class " << aSeqAncestors->Value(IsFound)->ToCString() << endm;
+       }
+      }
+      else if (!anInst->IsStatic() && StopRedefinition) {
+       result = Standard_False;
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have the 'virtual' keyword because redefinition" << endm;
+       ErrorMsg << CHECKERROR << "was stopped in class " << whoStopRedefinition->ToCString() << endm;
+      }
+      else if (anInst->IsDeferred() && StopRedefinition) {
+       result = Standard_False;
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot have the 'deferred' keyword because redefinition" << endm;
+       ErrorMsg << CHECKERROR << "was stopped in class " << whoStopRedefinition->ToCString() << endm;
+      }
+      else if (!anInst->IsDeferred() && anInst->IsStatic()) {
+       result = Standard_False;
+       
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " cannot redefine the same method than class "
+         << aSeqAncestors->Value(IsFound)->ToCString() << endm;
+       
+       if (StopRedefinition) {
+         ErrorMsg << "the redefinition was stopped in class " << whoStopRedefinition->ToCString() << endm;
+       }
+       else {
+         ErrorMsg << CHECKERROR <<"to be able to make this redefinition, the keyword 'is virtual' must be set at the end of the method of the class "
+           << aSeqAncestors->Value(IsFound)->ToCString() << endm;
+       }
+      }
+      
+    }
+    else if ((IsVirtual || IsDeferred) && IsFound != 0) {
+      if ((IsDeferred && !anInst->IsRedefined() && (whoIsDeferred > IsFound)) || (!IsDeferred && IsVirtual && !anInst->IsRedefined())) {
+       result = Standard_False;
+       ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " must have the 'redefined' keyword." << endm;
+      }
+    }
+    else if ((IsFound == 0 ) && anInst->IsRedefined()) {
+      result = Standard_False;
+      ErrorMsg << CHECKERROR << "the method " << anInst->FullName()->ToCString() << " must have been declared in an ancestor class" << endm;
+      ErrorMsg << CHECKERROR << "to be redefined." << endm;
+    }
+  }
+
+  Handle(MS_HArray1OfParam) parSeq = aMeth->Params();
+  Standard_Boolean            locRes = Standard_True;
+  
+  whoStopRedefinition = aMeth->Class();
+  
+  if(!parSeq.IsNull()) {
+    for (j = 1; j <= parSeq->Length(); j++) {
+      Handle(MS_Param) p = parSeq->Value(j);
+      if (IsDefined(p->TypeName())) {
+       Handle(MS_Type)  t = p->Type();
+       
+       if (t->IsKind(STANDARD_TYPE(MS_Alias))) {
+         MS_Alias *deepType = (MS_Alias *)(t.operator->());
+         t = GetType(deepType->DeepType());
+       }
+
+
+       if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+         MS_Class      *pclass;
+
+         if (t->IsKind(STANDARD_TYPE(MS_InstClass))) {
+           MS_InstClass    *iclass = (MS_InstClass*)(t.operator->());
+           Handle(MS_Type) gtype   = GetType(iclass->GenClass());
+           
+           pclass = (MS_Class*)(gtype.operator->());
+         }
+         else {
+           pclass = (MS_Class*)(t.operator->());
+         }
+
+         Standard_Boolean  handleclass = pclass->IsPersistent() || pclass->IsTransient();
+         
+         if (!handleclass) {
+           if (p->IsMutable() || p->IsImmutable()) {
+             ErrorMsg << CHECKERROR << "the parameter " << p->Name()->ToCString() << " from method " << aMeth->FullName()->ToCString() << " must be set 'in' or 'out' , but not 'mutable' or 'immutable' because class " << t->FullName()->ToCString() << " is not persistent or transient." << endm;
+             result = Standard_False;
+           }
+         }
+       }
+       else {
+         if (p->IsMutable() || p->IsImmutable()) {
+           ErrorMsg << CHECKERROR <<  "the parameter " << p->Name()->ToCString() << " from method " << aMeth->FullName()->ToCString() << " cannot be 'mutable' or 'immutable' because " << t->FullName()->ToCString() << " is not a class." << endm;
+           result = Standard_False;
+         }
+       }
+
+       if (t->Private()) {
+         if (!t->Package()->FullName()->IsSameString(aClass->Package()->FullName())) {
+           ErrorMsg << CHECKERROR << "the private type " << t->FullName()->ToCString() << " cannot be used in method " << aMeth->FullName()->ToCString() << endm;
+           locRes = Standard_False;
+         }
+         else if (!aClass->Private() && !aMeth->Private() && !whoStopRedefinition->IsSameString(p->TypeName())) {
+           Standard_Boolean cankill = Standard_True;
+           
+           if (aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+             Handle(MS_StdClass) stdClass = *((Handle(MS_StdClass)*)&aClass);
+             
+             if (!stdClass->GetMyCreator().IsNull()) {
+               if (stdClass->GetMyCreator()->FullName()->IsSameString(p->TypeName())) {
+                 cankill = Standard_False;
+               }
+             }
+           }
+           if (cankill) {
+             ErrorMsg << CHECKERROR << "the non private method " << aMeth->FullName()->ToCString() << " cannot use a private type as parameter." << endm;
+             locRes = Standard_False;
+           }
+         }
+       }
+       result = result && locRes;
+      }
+    }
+  }
+
+  Handle(MS_Param) p = aMeth->Returns(); 
+
+  if (!p.IsNull()) {
+    if (IsDefined(p->TypeName())) {
+      Handle(MS_Type)  t = p->Type();
+      
+      if (t->IsKind(STANDARD_TYPE(MS_Alias))) {
+       MS_Alias *deepType = (MS_Alias *)(t.operator->());
+       t = GetType(deepType->DeepType());
+      }
+
+      if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+       MS_Class      *pclass;
+
+       if (t->IsKind(STANDARD_TYPE(MS_InstClass))) {
+         MS_InstClass    *iclass = (MS_InstClass*)(t.operator->());
+         Handle(MS_Type) gtype   = GetType(iclass->GenClass());
+         
+         pclass = (MS_Class*)(gtype.operator->());
+       }
+       else {
+         pclass = (MS_Class*)(t.operator->());
+       }
+
+       Standard_Boolean  handleclass = pclass->IsPersistent() || pclass->IsTransient();
+       
+       if (!handleclass) {
+         if (p->IsMutable() || p->IsImmutable()) {
+           ErrorMsg << CHECKERROR << "the return's type from method " << aMeth->FullName()->ToCString() << " cannot be 'mutable' or 'immutable' because class " << t->FullName()->ToCString() << " is not persistent or transient." << endm;
+           result = Standard_False;
+         }
+       }
+      }   
+      else {
+       if (p->IsMutable() || p->IsImmutable()) {
+         ErrorMsg << CHECKERROR << "the return's type from method " << aMeth->FullName()->ToCString() << " cannot be 'mutable' or 'immutable' because " << t->FullName()->ToCString() << " is not a class." << endm;
+         result = Standard_False;
+       }
+      }
+
+      if (t->Private()) {
+       if (!t->Package()->FullName()->IsSameString(aClass->Package()->FullName())) {
+         ErrorMsg << CHECKERROR << "the private type " << t->FullName()->ToCString() << " cannot be used in 'returns' clause of " << aMeth->FullName()->ToCString() << endm;
+         locRes = Standard_False;
+       }
+       else if (!aClass->Private() && !aMeth->Private() && !whoStopRedefinition->IsSameString(p->TypeName())) {
+         Standard_Boolean cankill = Standard_True;
+         
+         if (aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+           MS_StdClass *stdClass = (MS_StdClass*)aClass.operator->();
+           
+           if (!stdClass->GetMyCreator().IsNull()) {
+             if (stdClass->GetMyCreator()->FullName()->IsSameString(p->TypeName())) {
+               cankill = Standard_False;
+             }
+           }
+         }
+         if (cankill) {
+           ErrorMsg << CHECKERROR << "the non private method " << aMeth->FullName()->ToCString() << " cannot return a private type." << endm;
+           result = Standard_False;
+         }
+       }
+      }
+    }
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::CheckExternMethod(const Handle(MS_ExternMet)& aMeth) const
+{
+  Standard_Boolean result = Standard_True;
+
+  Handle(MS_HArray1OfParam)      parSeq = aMeth->Params();
+  Standard_Boolean                 locRes = Standard_True;
+  Handle(TCollection_HAsciiString) packname = aMeth->Package();
+  Standard_Integer                 j;
+  Handle(TColStd_HSequenceOfHAsciiString) raisesseq = aMeth->GetRaisesName();
+
+  for (j = 1; j <= raisesseq->Length(); j++) {
+    if (!IsDefined(raisesseq->Value(j))) {
+      ErrorMsg << CHECKERROR << "the exception " << raisesseq->Value(j)->ToCString() << ", used in package method " << aMeth->Name()->ToCString() << ", is not defined." << endm;
+      result = Standard_False;
+    }
+  }
+
+  if(!parSeq.IsNull()) {
+    for (j = 1; j <= parSeq->Length(); j++) {
+      Handle(MS_Param) p = parSeq->Value(j);
+
+      if (IsDefined(p->TypeName())) {
+       Handle(MS_Type)  t = p->Type();
+
+       if (t->IsKind(STANDARD_TYPE(MS_Alias))) {
+         MS_Alias *deepType = (MS_Alias *)(t.operator->());
+         t = GetType(deepType->DeepType());
+       }
+
+       if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+         MS_Class          *pclass;
+
+         if (t->IsKind(STANDARD_TYPE(MS_InstClass))) {
+           MS_InstClass    *iclass = (MS_InstClass*)(t.operator->());
+           Handle(MS_Type) gtype   = GetType(iclass->GenClass());
+
+           pclass = (MS_Class*)(gtype.operator->());
+         }
+         else {
+           pclass = (MS_Class*)(t.operator->());
+         }
+
+         Standard_Boolean  handleclass = pclass->IsPersistent() || pclass->IsTransient();
+         
+         if (!handleclass) {
+           if (p->IsMutable() || p->IsImmutable()) {
+             ErrorMsg << CHECKERROR << "the parameter " << p->Name()->ToCString() << " from method " << aMeth->FullName()->ToCString() << " must be set 'in' or 'out' , but not 'mutable' or 'immutable' because class " << t->FullName()->ToCString() << " is not persistent or transient." << endm;
+             result = Standard_False;
+           }
+         }
+       }
+       else {
+         if (p->IsMutable() || p->IsImmutable()) {
+           ErrorMsg << CHECKERROR <<  "the parameter " << p->Name()->ToCString() << " from method " << aMeth->FullName()->ToCString() << " cannot be 'mutable' or 'immutable' because " << t->FullName()->ToCString() << " is not a class." << endm;
+           result = Standard_False;
+         }
+       }
+
+       if (t->Private()) {
+         if (!t->Package()->FullName()->IsSameString(packname)) {
+           ErrorMsg << CHECKERROR << "the private type " << t->FullName()->ToCString() << " cannot be used in package method " << aMeth->FullName()->ToCString() << endm;
+           locRes = Standard_False;
+         }
+         else if (!aMeth->Private()) {
+           ErrorMsg << CHECKERROR << "the non private package method " << aMeth->FullName()->ToCString() << " cannot use a private type as parameter." << endm;
+           locRes = Standard_False;
+         }
+       }
+       
+       result = result && locRes;
+      }
+    }
+  }
+
+  Handle(MS_Param) p = aMeth->Returns(); 
+
+  if (!p.IsNull()) {
+    if (IsDefined(p->TypeName())) {
+      Handle(MS_Type)  t = p->Type();
+
+      if (t->IsKind(STANDARD_TYPE(MS_Alias))) {
+       MS_Alias *deepType = (MS_Alias *)(t.operator->());
+       t = GetType(deepType->DeepType());
+      }
+      
+      if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+       MS_Class      *pclass;
+
+       if (t->IsKind(STANDARD_TYPE(MS_InstClass))) {
+         MS_InstClass    *iclass = (MS_InstClass*)(t.operator->());
+         Handle(MS_Type) gtype   = GetType(iclass->GenClass());
+         
+         pclass = (MS_Class*)(gtype.operator->());
+       }
+       else {
+         pclass = (MS_Class*)(t.operator->());
+       }
+
+       Standard_Boolean  handleclass = pclass->IsPersistent() || pclass->IsTransient();
+       
+       if (!handleclass) {
+         if (p->IsMutable() || p->IsImmutable()) {
+           ErrorMsg << CHECKERROR << "the return's type from method " << aMeth->FullName()->ToCString() << " cannot be 'mutable' or 'immutable' because class " << t->FullName()->ToCString() << " is not persistent or transient." << endm;
+           result = Standard_False;
+         }
+       }
+      }   
+      else {
+       if (p->IsMutable() || p->IsImmutable()) {
+         ErrorMsg << CHECKERROR << "the return's type from method " << aMeth->FullName()->ToCString() << " cannot be 'mutable' or 'immutable' because " << t->FullName()->ToCString() << " is not a class." << endm;
+         result = Standard_False;
+       }
+      }
+
+      if (t->Private()) {
+       if (!t->Package()->FullName()->IsSameString(packname)) {
+         ErrorMsg << CHECKERROR << "the private type " << t->FullName()->ToCString() << " cannot be used in 'returns' clause of " << aMeth->FullName()->ToCString() << endm;
+         locRes = Standard_False;
+       }
+       else if (!aMeth->Private()) {
+         ErrorMsg << CHECKERROR << "the non private method " << aMeth->FullName()->ToCString() << " cannot return a private type." << endm;
+         result = Standard_False;
+       }
+      }
+    }
+  }
+
+  return result;
+}
+
+// WARNING : do not modify this part unless you understand it
+//
+Standard_Boolean MS_MetaSchema::CheckInstClass(const Handle(MS_InstClass)& anInst) const
+{
+  Standard_Boolean                        result = Standard_True,
+                                          locRes;
+  Handle(MS_Type)                         gettyperes = GetType(anInst->GenClass());
+  Handle(MS_GenClass)                     aGenClass = *((Handle(MS_GenClass)*)&gettyperes);
+  Handle(MS_HSequenceOfGenType)           aSeqGType = aGenClass->GenTypes();
+  Standard_Integer                        i;
+
+  Handle(TColStd_HSequenceOfHAsciiString) aSeqIType = anInst->InstTypes();
+  
+  for (i = 1; i <= aSeqGType->Length(); i++) {
+
+    if (!aSeqGType->Value(i)->Any()) {
+      Handle(TColStd_HSequenceOfHAsciiString) aSeqCont = aSeqGType->Value(i)->GetInstTypes();
+
+
+      if (aSeqCont->Length() == 0) {
+       if (!aSeqGType->Value(i)->TYpeName()->IsSameString(aSeqIType->Value(i))) {
+         Handle(MS_Type) aType = GetType(aSeqIType->Value(i));
+         
+         if (aType->IsKind(STANDARD_TYPE(MS_NatType))) {
+           if (aType->IsKind(STANDARD_TYPE(MS_Alias))) {
+             Handle(MS_Alias)                 alias    = *((Handle(MS_Alias)*)&aType);
+             Handle(TCollection_HAsciiString) realType = alias->Type();
+             Handle(MS_Type)                  gettyper;
+
+             locRes   = realType->IsSameString(aSeqGType->Value(i)->TYpeName());
+             gettyper = GetType(realType);
+
+             while (gettyper->IsKind(STANDARD_TYPE(MS_Alias)) && !locRes) {
+               alias      = *((Handle(MS_Alias)*)&gettyper);
+               realType   = alias->Type();
+               locRes     = realType->IsSameString(aSeqGType->Value(i)->TYpeName());
+               gettyper = GetType(realType);
+             }
+
+             result = result && locRes;
+           }
+           else if (aType->IsKind(STANDARD_TYPE(MS_Enum))) {
+             if (!aSeqGType->Value(i)->TYpeName()->IsSameString(MS::GetStorableRootName())) {
+               result = Standard_False;
+               ErrorMsg << CHECKERROR << "the instantiation type " << aSeqIType->Value(i)->ToCString() << " is not compatible with the constraint type " <<  aSeqGType->Value(i)->TYpeName()->ToCString() << " in the class " << anInst->FullName()->ToCString() << endm;
+             }
+           }
+           else if (aType->IsKind(STANDARD_TYPE(MS_Imported))) {
+             if (aSeqGType->Value(i)->TYpeName()->IsSameString(MS::GetStorableRootName())) {
+               result = Standard_False;
+               ErrorMsg << CHECKERROR << "the instantiation type " << aSeqIType->Value(i)->ToCString() << " is not compatible with the constraint type " <<  aSeqGType->Value(i)->TYpeName()->ToCString() << " in the class " << anInst->FullName()->ToCString() << endm;
+             }
+           }
+           else if (aType->IsKind(STANDARD_TYPE(MS_PrimType))) {
+             Handle(MS_PrimType) aPrim = *((Handle(MS_PrimType)*)&aType);
+
+             if (aSeqGType->Value(i)->TYpeName()->IsSameString(MS::GetStorableRootName())) {
+               result = aPrim->IsStorable();
+               if (!result) {
+                 ErrorMsg << CHECKERROR << "the instantiation type " << aSeqIType->Value(i)->ToCString() << " is not compatible with the constraint type " <<  aSeqGType->Value(i)->TYpeName()->ToCString() << " in the class " << anInst->FullName()->ToCString() << endm;
+               }
+             }
+           }
+         }
+         else if (aType->IsKind(STANDARD_TYPE(MS_StdClass))) {
+           Handle(MS_StdClass)                     theClass      = *((Handle(MS_StdClass)*)&aType);
+           Handle(TColStd_HSequenceOfHAsciiString) aSeqAncestors = theClass->GetFullInheritsNames();
+           Standard_Integer                        j,k;
+           Handle(MS_InstClass)                    anNestInst;
+
+           locRes = Standard_False;
+
+           if (!theClass->GetMyCreator().IsNull()) {
+             anNestInst  = theClass->GetMyCreator();
+             
+             if (anNestInst->GenClass()->IsSameString(aSeqGType->Value(i)->TYpeName())) {
+               locRes = Standard_True;
+             }
+           }
+             
+           for (j = 1; j <= aSeqAncestors->Length() && !locRes; j++) {
+             //              cout << aSeqAncestors->Value(j)->ToCString() << " == " << aSeqGType->Value(i)->TYpeName()->ToCString() << endl;
+             if (aSeqAncestors->Value(j)->IsSameString(aSeqGType->Value(i)->TYpeName())) {
+               locRes = Standard_True;
+             }
+             else {
+               Handle(MS_StdClass) tt = Handle(MS_StdClass)::DownCast(GetType(aSeqAncestors->Value(j)));
+
+               if (!tt.IsNull()) {
+                 if (!tt->GetMyCreator().IsNull()) {
+                   anNestInst  = tt->GetMyCreator();
+                   
+                   if (anNestInst->GenClass()->IsSameString(aSeqGType->Value(i)->TYpeName())) {
+                     locRes = Standard_True;
+                   }
+                 }
+               }
+             }
+           }
+           
+           if (!locRes) {
+              ErrorMsg << CHECKERROR << "the instantiation type " << aSeqIType->Value(i)->ToCString() << " is not compatible with the constraint type " <<  aSeqGType->Value(i)->TYpeName()->ToCString() << " in the class " << anInst->FullName()->ToCString() << endm;
+           }
+           result = result && locRes;
+         }
+       }
+      }
+      else {
+       Standard_Boolean ItsAClass = Standard_True;
+       
+       if (GetType(aSeqIType->Value(i))->IsKind(STANDARD_TYPE(MS_StdClass))) { 
+         Handle(MS_Type)                         gettypeper1 = GetType(aSeqIType->Value(i));
+         Handle(MS_StdClass)                     aStdClass = *((Handle(MS_StdClass)*)&gettypeper1);
+         Handle(TColStd_HSequenceOfHAsciiString) aSeqAncestors = aStdClass->GetFullInheritsNames();
+         Standard_Integer                        j;
+         Handle(MS_InstClass)                    anNestInst;
+         Handle(MS_GenClass)                     theGenClass;
+         
+         locRes = Standard_False;
+
+         // look for a generic class : our constraint is an instantiation
+         // 
+         if (!aStdClass->GetMyCreator().IsNull()) {
+           anNestInst  = aStdClass->GetMyCreator();
+//         cout << "G " << anNestInst->GenClass()->ToCString() << " = " << "GI " << aSeqGType->Value(i)->TYpeName()->ToCString() << endl;
+           if (anNestInst->GenClass()->IsSameString(aSeqGType->Value(i)->TYpeName())) {
+             locRes = Standard_True;
+           }
+         }
+
+         for (j = 1; j <= aSeqAncestors->Length() && !locRes; j++) {
+           gettypeper1 = GetType(aSeqAncestors->Value(j));
+           aStdClass = *((Handle(MS_StdClass)*)&gettypeper1);
+           
+           if (!aStdClass->GetMyCreator().IsNull()) {
+             anNestInst = aStdClass->GetMyCreator();
+
+             if (anNestInst->GenClass()->IsSameString(aSeqGType->Value(i)->TYpeName())) {
+               locRes = Standard_True;
+             }
+           }
+         }
+
+         if (locRes) {  
+           Handle(TCollection_HAsciiString) typeName;
+           Standard_Integer                 pos;
+
+           gettypeper1 = GetType(anNestInst->GenClass());
+           theGenClass = *((Handle(MS_GenClass)*)&gettypeper1);
+
+           for (j = 1; j <= aSeqCont->Length(); j++) {
+//           cout << "Contrainte Defined : " << aSeqCont->Value(j)->ToCString() << endl;
+
+             if (IsDefined(aSeqCont->Value(j))) {
+               typeName = aSeqIType->Value(j);
+               pos = j;
+             }
+             else {
+               Standard_Integer k;
+
+               typeName.Nullify();
+               
+               for (k = 1; k <= aSeqGType->Length() && typeName.IsNull(); k++) {
+//               cout << "C " << aSeqCont->Value(j)->ToCString() << " = " << "GI " << aSeqGType->Value(k)->Name()->ToCString() << endl;
+                 if (aSeqGType->Value(k)->Name()->IsSameString(aSeqCont->Value(j))) {
+                   typeName = aSeqIType->Value(k);
+                   pos = k;
+                 }
+               }
+             }   
+           }
+
+           if (typeName.IsNull()) {
+             locRes = Standard_False;
+             ItsAClass = Standard_True;
+             ErrorMsg << CHECKERROR << "the constraint of generic type " << aSeqGType->Value(i)->Name()->ToCString() << " does not have an instantiation parameter of the type " << aSeqCont->Value(pos) << " as required." << endm;
+           }
+         }
+         else {
+           ErrorMsg << CHECKERROR << "in class " << anInst->FullName()->ToCString() << ", the instantiation parameter " << aSeqGType->Value(i)->Name()->ToCString() << " must be an instantiation not the type " <<  aSeqIType->Value(i)->ToCString() << endm;
+           locRes    = Standard_False;
+           ItsAClass = Standard_False;
+         }
+
+       }
+       else {
+         ErrorMsg << CHECKERROR << "in class " << anInst->FullName()->ToCString() << ", the instantiation parameter " << aSeqGType->Value(i)->Name()->ToCString() << " must be a class not the type " <<  aSeqIType->Value(i)->ToCString() << endm;
+         locRes    = Standard_False;
+         ItsAClass = Standard_False;
+       }
+
+       result = result && locRes;
+      }
+    }
+  }
+
+  return result;
+}
+
+// WARNING : do not modify this part unless you understand it
+//
+Standard_Boolean MS_MetaSchema::CheckField(const Handle(MS_Field)& aField) const
+{
+  Handle(MS_Class) aClass = aField->Class();
+  Standard_Boolean result = Standard_True;
+
+
+
+  // for generic class, we test if all fields are defined types or generic items
+  //
+  if (!IsDefined(aField->TYpe()) && aClass->IsKind(STANDARD_TYPE(MS_GenClass))) {
+    Handle(MS_GenClass)           aGenClass = *((Handle(MS_GenClass)*)&aClass);
+    Handle(MS_HSequenceOfGenType) gTypes    = aGenClass->GenTypes();
+    Standard_Integer              nbType;
+    Standard_Boolean              IHaveTheType = Standard_False;
+    
+    for (nbType = 1; nbType <= gTypes->Length() && !IHaveTheType; nbType++) {
+      if (aField->TYpe()->IsSameString(gTypes->Value(nbType)->Name())) {
+       IHaveTheType = Standard_True;
+      }
+    }
+    
+    if (!IHaveTheType) {
+      result = Standard_False;
+      ErrorMsg << CHECKERROR << "the field " << aField->Name()->ToCString() 
+          << " from generic class " << aClass->FullName()->ToCString()
+          << " has an unknown type or an undeclared generic item : " << aField->TYpe()->ToCString() << endm;
+    }
+  }
+  else if (IsDefined(aField->TYpe())) {
+    Handle(MS_Type)    t     = GetType(aField->TYpe());
+    Handle(MS_NatType) aType = Handle(MS_NatType)::DownCast(t);
+    Handle(MS_Class)   aCl   = Handle(MS_Class)::DownCast(t);
+
+    if (t->Private()) {
+      if (!t->Package()->FullName()->IsSameString(aClass->Package()->FullName())) {
+       Standard_Boolean cankill = Standard_True;
+
+       if (aClass->IsKind(STANDARD_TYPE(MS_StdClass))) {
+         Handle(MS_StdClass) stdClass = Handle(MS_StdClass)::DownCast(aClass);
+
+         if (!stdClass->GetMyCreator().IsNull()) {
+           if (stdClass->GetMyCreator()->FullName()->IsSameString(aField->TYpe())) {
+             cankill = Standard_False;
+           }
+         }
+       }
+       if (cankill) {
+         ErrorMsg << CHECKERROR << "the private type " << t->FullName()->ToCString() << " cannot be used in field " << aField->Name()->ToCString() << " of class " << aClass->FullName()->ToCString() << endm;
+         result = Standard_False;
+       }
+      }
+    }
+
+    if (aClass->IsStorable() || aClass->IsPersistent()) {
+      
+      if (!aCl.IsNull()) {
+       if (aCl->IsKind(STANDARD_TYPE(MS_InstClass))) {
+         Handle(MS_InstClass) inst = *((Handle(MS_InstClass)*)&aCl);
+         Handle(MS_Type)      gettypeloc = GetType(inst->GenClass());
+
+         aCl = *((Handle(MS_Class)*)&gettypeloc);
+       }
+       
+       if (!(aCl->IsStorable() || aCl->IsPersistent())) {
+         result = Standard_False;
+         ErrorMsg << CHECKERROR << "the field " << aField->Name()->ToCString() << " from class " << aClass->FullName()->ToCString()
+              << " must be Storable or Persistent." << endm;
+       }
+      }
+      else if (!aType.IsNull()) {
+       if (aType->IsKind(STANDARD_TYPE(MS_Pointer))) {
+         result = Standard_False;
+         ErrorMsg << CHECKERROR << "the field " << aField->Name()->ToCString() << " from class " << aClass->FullName()->ToCString()
+              << " has a pointer type : " << aField->TYpe()->ToCString() << endm;
+       }
+       else if (aType->IsKind(STANDARD_TYPE(MS_PrimType))) {
+         Handle(MS_PrimType) aPType = *((Handle(MS_PrimType)*)&aType);
+         
+         if (!aPType->IsStorable()) {
+           result = Standard_False;
+           ErrorMsg << CHECKERROR << "the field " << aField->Name()->ToCString() << " from class " << aClass->FullName()->ToCString()
+                << " has a non storable type : " << aField->TYpe()->ToCString() << endm;
+         }
+       }
+      } 
+    }
+    
+    if (IsDefined(aField->Name())) {
+      result = Standard_False;
+      ErrorMsg << CHECKERROR << "the field " << aField->Name()->ToCString() << " from class " << aClass->FullName()->ToCString()
+          << " must not have the same name than a type." << endm;
+    }
+  }
+  
+  return result;
+}
+
+Standard_Boolean MS_MetaSchema::AddClient(const Handle(MS_Client)& aCommon) 
+{
+  Standard_Boolean result = Standard_False;
+
+  if (!aCommon.IsNull()) {
+    if (!myClients.IsBound(aCommon->FullName())) {
+      result = Standard_True;
+      myClients.Bind(aCommon->FullName(),aCommon);
+    }
+    else {
+      result = Standard_False;
+    }
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::AddClient - aCommon is NULL");
+  }
+
+  return result;
+}
+
+MS_DataMapIteratorOfMapOfGlobalEntity MS_MetaSchema::Clients() const 
+{
+  MS_DataMapIteratorOfMapOfGlobalEntity anIterator(myClients);
+
+  return anIterator;
+}
+
+const Handle(MS_Client)& MS_MetaSchema::GetClient(const Handle(TCollection_HAsciiString)& anClient) const 
+{
+  static Handle(MS_Client) NULLRESULT;
+
+  if (!anClient.IsNull()) {
+    return  *((Handle(MS_Client) *) &(myClients.Find(anClient)));
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::GetClient - anClient is NULL");
+  }
+
+  return NULLRESULT;
+}
+
+void MS_MetaSchema::RemoveClient(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage.IsNull()) {
+    if (myClients.IsBound(aPackage))
+      myClients.UnBind(aPackage);
+  }
+}
+
+Standard_Boolean MS_MetaSchema::IsClient(const Handle(TCollection_HAsciiString)& anClient) const 
+{
+  Standard_Boolean result = Standard_False;
+  
+  if (!anClient.IsNull()) {
+    result = myClients.IsBound(anClient);
+  }
+  else {
+    Standard_NullObject::Raise("MS_MetaSchema::IsClient - anClient is NULL");
+  }
+  
+  return result;
+}
diff --git a/src/MS/MS_Method.cdl b/src/MS/MS_Method.cdl
new file mode 100755 (executable)
index 0000000..878619c
--- /dev/null
@@ -0,0 +1,88 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Method.cdl  1.1
+-- File:       MS_Method.cdl
+-- Created:    Wed Jan 30 15:51:42 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class Method 
+       ---Purpose: 
+
+    from MS 
+    inherits Common from MS
+    uses 
+       Param                   from MS,
+       HSequenceOfHAsciiString from TColStd,
+       HSequenceOfError        from MS,
+       HArray1OfParam          from MS,
+       HSequenceOfParam        from MS,
+       Type                    from MS,
+       HAsciiString            from TCollection
+       
+is
+    Initialize(aName: HAsciiString);
+
+    CreateFullName(me : mutable) is virtual;
+       
+    Params(me: mutable; params: HSequenceOfParam from MS);
+    Params(me)
+        returns mutable HArray1OfParam from MS;
+       
+    Private(me: mutable; aPrivate: Boolean);
+    Private(me)
+       returns Boolean;
+       
+    Returns(me: mutable; aParam: Param from MS);
+    Returns(me)
+       returns mutable Param from MS;
+       
+    Raises(me: mutable; aExcept: HAsciiString from TCollection) is static;
+    GetRaisesName(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+       
+    Inline(me : mutable; anInline : Boolean from Standard);
+    IsInline(me) 
+       returns Boolean from Standard;
+       
+    ConstReturn(me : mutable; aConst : Boolean from Standard);
+    IsConstReturn(me) 
+       returns Boolean from Standard;
+       
+    Alias(me : mutable; anAlias : HAsciiString from TCollection);
+    IsAlias(me)
+       returns HAsciiString from TCollection;
+       
+    SetAliasType(me : mutable; aType : Boolean from Standard);
+    
+    IsOperator(me) 
+       returns Boolean from Standard;
+    IsQuotedAlias(me)
+       returns Boolean from Standard;
+       
+    RefReturn(me : mutable; aRef : Boolean from Standard);
+    IsRefReturn(me) 
+       returns Boolean from Standard;              
+
+    Destructor(me : mutable; aDestructor : Boolean from Standard);
+    IsDestructor(me)
+       returns Boolean from Standard;
+       
+    FunctionCall(me : mutable; aFunctionCall  : Boolean from Standard);
+    IsFunctionCall(me) 
+       returns Boolean from Standard;
+           
+    IsSameSignature(me; aMetName : HAsciiString from TCollection)
+       returns Boolean;
+    
+fields
+
+    myParam     : HArray1OfParam from MS;        -- list of parameters
+    myAttribute : Integer;
+    myReturns   : Param from MS;                   -- return parameter
+    myRaises    : HSequenceOfHAsciiString from TColStd;        -- list of exceptions it raises
+    myAlias     : HAsciiString from TCollection;   -- alias method of me
+    
+end Method from MS;
+
diff --git a/src/MS/MS_Method.cxx b/src/MS/MS_Method.cxx
new file mode 100755 (executable)
index 0000000..54036a1
--- /dev/null
@@ -0,0 +1,343 @@
+#include <MS_Method.ixx>
+#include <MS_MetaSchema.hxx>
+#include <MS_InstMet.hxx>
+
+#define MET_DESTROY  0x01
+#define MET_PRIVATE  0x02
+#define MET_CONST    0x04
+#define MET_REF      0x08
+#define MET_INLINE   0x10
+#define MET_OPERATOR 0x20
+#define MET_FUNCCALL 0x40
+
+MS_Method::MS_Method(const Handle(TCollection_HAsciiString)& aName) : myAttribute(0),MS_Common(aName),myRaises(new TColStd_HSequenceOfHAsciiString)
+{
+}
+
+void MS_Method::CreateFullName() 
+{
+  Standard_Integer                 i;
+  Handle(TCollection_HAsciiString) myIdName;
+
+  myIdName = new TCollection_HAsciiString;
+  myIdName->AssignCat(Name());
+  myIdName->AssignCat("(");
+
+  if (!myParam.IsNull()) {
+    if (myParam->Value(1)->IsLike()) {
+      myIdName->AssignCat("LikeMe");
+    }
+    else {
+      myIdName->AssignCat(myParam->Value(1)->TypeName());
+    }
+  }
+
+  if(!myParam.IsNull()) {
+    for(i = 2; i <= myParam->Length(); i++) {
+      myIdName->AssignCat(",");
+      if (myParam->Value(i)->IsLike()) {
+       myIdName->AssignCat("LikeMe");
+      }
+      else {
+       myIdName->AssignCat(myParam->Value(i)->TypeName());
+      }
+    }
+  }
+
+  myIdName->AssignCat(")");
+
+  if (!myReturns.IsNull()) {
+    myIdName->AssignCat("=");
+
+    if (myReturns->IsLike()) {
+      myIdName->AssignCat("LikeMe");
+    }
+    else {
+      myIdName->AssignCat(myReturns->TypeName());
+    }
+  }
+
+  FullName(myIdName);
+}
+
+void MS_Method::Params(const Handle(MS_HSequenceOfParam)& params)
+{
+  if(!params.IsNull()) {
+    myParam = new MS_HArray1OfParam(1, params->Length());
+    for(Standard_Integer i=1; i<=params->Length(); i++)
+      myParam->ChangeValue(i) = params->Value(i);
+  }
+  //myParam->Append(aParam);
+}
+
+Handle(MS_HArray1OfParam) MS_Method::Params() const 
+{
+  return myParam;
+}
+
+void MS_Method::Private(const Standard_Boolean aPrivate)
+{
+  if (aPrivate) {
+    myAttribute |= MET_PRIVATE;
+  }
+  else {
+    myAttribute &= (myAttribute ^ MET_PRIVATE);
+  }
+}
+
+Standard_Boolean MS_Method::Private() const 
+{
+  if (myAttribute & MET_PRIVATE) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  }
+}
+
+void MS_Method::Returns(const Handle(MS_Param)& aParam)
+{
+  myReturns = aParam;
+}
+
+Handle(MS_Param) MS_Method::Returns() const 
+{
+  return myReturns;
+}
+
+void MS_Method::Raises(const Handle(TCollection_HAsciiString)& aRaise)
+{
+  if(myRaises.IsNull()) myRaises = new TColStd_HSequenceOfHAsciiString;
+  myRaises->Append(aRaise);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Method::GetRaisesName() const 
+{
+  return myRaises;
+}
+
+void MS_Method::Inline(const Standard_Boolean anInline)
+{
+  if (anInline) {
+    myAttribute |= MET_INLINE;
+  }
+  else {
+    myAttribute &= (MET_INLINE ^ myAttribute);
+  }    
+}
+
+Standard_Boolean MS_Method::IsInline() const 
+{
+  if (myAttribute & MET_INLINE) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  }
+}
+
+void MS_Method::ConstReturn(const Standard_Boolean aConst)
+{
+  if (aConst) {
+    myAttribute |= MET_CONST;
+  }
+  else {
+    myAttribute &= (MET_CONST ^ myAttribute);
+  }   
+}
+
+Standard_Boolean MS_Method::IsConstReturn() const 
+{
+  if (myAttribute & MET_CONST) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  }
+}
+
+void MS_Method::Alias(const Handle(TCollection_HAsciiString)& anAlias)
+{
+  myAlias = anAlias;
+}
+
+Handle(TCollection_HAsciiString) MS_Method::IsAlias() const 
+{
+  return myAlias;
+}
+
+void MS_Method::RefReturn(const Standard_Boolean aRef)
+{
+  if (aRef) {
+    myAttribute |= MET_REF;
+  }
+  else {
+    myAttribute &= (MET_REF ^ myAttribute);
+  }   
+}
+
+Standard_Boolean MS_Method::IsRefReturn() const 
+{
+  if (myAttribute & MET_REF) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  }
+}
+
+void MS_Method::Destructor(const Standard_Boolean aDestructor)
+{
+  if (aDestructor) {
+    myAttribute |= MET_DESTROY;
+  }
+  else {
+    myAttribute &= (MET_DESTROY ^ myAttribute);
+  }   
+}
+
+Standard_Boolean MS_Method::IsDestructor() const 
+{
+ if (myAttribute & MET_DESTROY) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  } 
+}
+
+void MS_Method::FunctionCall(const Standard_Boolean aFunctionCall)
+{
+  if (aFunctionCall) {
+    myAttribute |= MET_FUNCCALL;
+  }
+  else {
+    myAttribute &= (MET_FUNCCALL ^ myAttribute);
+  }   
+}
+
+Standard_Boolean MS_Method::IsFunctionCall() const 
+{
+  if (myAttribute & MET_FUNCCALL) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  } 
+}
+
+Standard_Boolean MS_Method::IsSameSignature(const Handle(TCollection_HAsciiString)& aMetName2) const
+{
+  Handle(TCollection_HAsciiString) aMetName1;
+  Standard_Boolean result = Standard_False;
+
+  
+  if (!aMetName2.IsNull() ) {
+    aMetName1 = FullName();
+
+    Standard_CString aname1 = strchr(aMetName1->ToCString(), ':');
+    Standard_CString aname2 = strchr(aMetName2->ToCString(), ':');
+
+    Standard_CString fin1 = strchr(aname1, '=');
+    Standard_CString fin2 = strchr(aname2, '=');
+
+    if(fin1) *fin1 = '\0';
+    if(fin2) *fin2 = '\0';
+
+    //cout << "aname1 : " << aname1 << endl;
+    //cout << "aname2 : " << aname2 << endl;
+
+    result = !strcmp(aname1, aname2);
+
+    //cout << "result : " << result << endl;
+
+    if(fin1) *fin1 = '=';
+    if(fin2) *fin2 = '=';
+
+//     Handle(TCollection_HAsciiString) aname1 = aMetName1->Token(":",2),
+//                                      aname2 = aMetName2->Token(":",2);
+  
+//     aname1 = aname1->Token("=");
+//     aname2 = aname2->Token("=");
+//     result = aname1->IsSameString(aname2);
+
+    if (result) {
+      Handle(MS_Method)           m1,m2;
+      Handle(MS_HArray1OfParam) p1,p2;
+
+      m1 = this;
+      m2 = GetMetaSchema()->GetMethod(aMetName2);
+
+      if (m1->IsKind(STANDARD_TYPE(MS_InstMet)) && m2->IsKind(STANDARD_TYPE(MS_InstMet))) {
+        Handle(MS_InstMet)           im1,im2;
+
+        result = Standard_False;
+        im1 = *((Handle_MS_InstMet*)&m1);
+        im2 = *((Handle_MS_InstMet*)&m2);
+
+        if (im1->IsConst() == im2->IsConst()) {
+           result = Standard_True;
+        }
+      }
+
+      // DEBUG PRO7950   N3       Fun.=UNK  Res.=CLE 
+      //       Pas de check de la signature "in out mutable" dans une methode redefinie 
+      //
+      if (result) {
+        p1 = m1->Params();
+        p2 = m2->Params();
+
+       if (!p1.IsNull()) {
+         result = Standard_False;
+         Standard_Integer i;
+         Handle(MS_Param) pa1,pa2;
+         
+         for (i = 1; i <= p1->Length(); i++) {
+           pa1 = p1->Value(i);
+           pa2 = p2->Value(i);
+           
+           if (pa1->IsOut() == pa2->IsOut()) {
+             if (pa1->IsIn() == pa2->IsIn()) {
+               if (pa1->IsAny() == pa2->IsAny()) {
+                 if (pa1->IsMutable() == pa2->IsMutable()) {
+                   result = Standard_True;
+                 }
+               }
+             }
+           }
+         } 
+       }
+      }
+      else result = Standard_True; // if (!p1.IsNull()) {
+    }
+  }
+
+  return result;
+}
+
+void MS_Method::SetAliasType(const Standard_Boolean aType)
+{
+  if (aType) {
+    myAttribute |= MET_OPERATOR;
+  }
+  else {
+    myAttribute &= (MET_OPERATOR ^ myAttribute);
+  }  
+}
+
+Standard_Boolean MS_Method::IsOperator() const 
+{
+  if (myAttribute & MET_OPERATOR) {
+    return Standard_True;
+  }
+  else {
+    return Standard_False;
+  } 
+}
+
+Standard_Boolean MS_Method::IsQuotedAlias() const 
+{
+  return (!myAlias.IsNull() && !IsOperator());
+}
+
+
diff --git a/src/MS/MS_NatType.cdl b/src/MS/MS_NatType.cdl
new file mode 100755 (executable)
index 0000000..ec315f3
--- /dev/null
@@ -0,0 +1,30 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_NatType.cdl 1.1
+-- File:       MS_NatType.cdl
+-- Created:    Tue Sep 17 17:35:27 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+deferred class NatType 
+
+    from 
+       MS 
+    inherits Type from MS
+    uses
+       HAsciiString from TCollection
+
+is
+
+    Initialize(aName, aPackage, aContainer: HAsciiString; aPrivate: Boolean); 
+
+    Private(me: mutable; aPrivate: Boolean);
+    Private(me)
+       returns Boolean;
+
+fields
+
+    myPrivate : Boolean;
+    
+end NatType from MS;
+
diff --git a/src/MS/MS_NatType.cxx b/src/MS/MS_NatType.cxx
new file mode 100755 (executable)
index 0000000..db0d818
--- /dev/null
@@ -0,0 +1,27 @@
+#include <MS_NatType.ixx>
+#include <MS.hxx>
+
+MS_NatType::MS_NatType(const Handle(TCollection_HAsciiString)& aName, 
+                      const Handle(TCollection_HAsciiString)& aPackage, 
+                      const Handle(TCollection_HAsciiString)& aContainer, 
+                      const Standard_Boolean aPrivate) : MS_Type(aName,aPackage, aContainer, Standard_True)
+{
+  Handle(TCollection_HAsciiString) aFullName;
+
+  myPrivate = aPrivate;
+
+  aFullName = MS::BuildFullName(aPackage,aName);
+
+  FullName(aFullName);
+}
+
+void MS_NatType::Private(const Standard_Boolean aPrivate)
+{
+  myPrivate = aPrivate;
+}
+
+Standard_Boolean MS_NatType::Private() const 
+{
+  return myPrivate;
+}
+
diff --git a/src/MS/MS_Package.cdl b/src/MS/MS_Package.cdl
new file mode 100755 (executable)
index 0000000..7736fa1
--- /dev/null
@@ -0,0 +1,95 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Package.cdl 1.1
+-- File:       MS_Package.cdl
+-- Created:    Tue Jan 29 04:41:14 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class Package 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits GlobalEntity from MS 
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       ExternMet from MS,
+       HSequenceOfExternMet from MS,
+       Type from MS,
+       HAsciiString from TCollection
+
+is
+
+    Create(aPackage :HAsciiString) 
+       returns mutable Package from MS;
+    
+    Use(me: mutable; aPackage: HAsciiString);
+    Uses(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    
+    IsUsed(me; aPackage: HAsciiString)
+       returns Boolean from Standard;
+         
+    Class(me: mutable; aClass: HAsciiString);
+    Classes(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasClass(me;  aClass: HAsciiString)
+       returns Boolean from Standard;
+
+    Except(me: mutable; aExcept: HAsciiString);
+    Excepts(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasExcept(me;  anExcept : HAsciiString)
+       returns Boolean from Standard;
+
+
+    Enum(me: mutable; aEnum: HAsciiString);
+    Enums(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasEnum(me;  anEnum: HAsciiString)
+       returns Boolean from Standard;
+
+    Alias(me: mutable; anAlias: HAsciiString);
+    Aliases(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasAlias(me;  anEnum: HAsciiString)
+       returns Boolean from Standard;
+     
+    Pointer(me: mutable; aPointer: HAsciiString);
+    Pointers(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasPointer(me;  anEnum: HAsciiString)
+       returns Boolean from Standard;
+     
+    Imported(me: mutable; anImported: HAsciiString);
+    Importeds(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasImported(me;  anEnum: HAsciiString)
+       returns Boolean from Standard;
+     
+    Primitive(me: mutable; anPrimitive: HAsciiString);
+    Primitives(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    HasPrimitive(me;  anEnum: HAsciiString)
+       returns Boolean from Standard;
+     
+    Method(me: mutable; aMethod: ExternMet from MS);
+    Methods(me) 
+       returns mutable HSequenceOfExternMet from MS;
+       
+fields
+
+    myUses     : HSequenceOfHAsciiString from TColStd;
+    myClasses  : HSequenceOfHAsciiString from TColStd;
+    myExcepts  : HSequenceOfHAsciiString from TColStd;
+    myEnums    : HSequenceOfHAsciiString from TColStd;
+    myAliases  : HSequenceOfHAsciiString from TColStd;
+    myPointers : HSequenceOfHAsciiString from TColStd;
+    myImports  : HSequenceOfHAsciiString from TColStd;
+    myPrims    : HSequenceOfHAsciiString from TColStd;
+    
+    myMethods : HSequenceOfExternMet from MS;
+
+end Package from MS;
+
diff --git a/src/MS/MS_Package.cxx b/src/MS/MS_Package.cxx
new file mode 100755 (executable)
index 0000000..8dc622e
--- /dev/null
@@ -0,0 +1,290 @@
+#include <MS_Package.ixx>
+#include <Standard_NullObject.hxx>
+#include <Standard_OStream.hxx>
+
+MS_Package::MS_Package(const Handle(TCollection_HAsciiString)& aPackage) : MS_GlobalEntity(aPackage)
+{
+  myUses     = new TColStd_HSequenceOfHAsciiString;
+  myClasses  = new TColStd_HSequenceOfHAsciiString;
+  myExcepts  = new TColStd_HSequenceOfHAsciiString;
+  myEnums    = new TColStd_HSequenceOfHAsciiString;
+  myAliases  = new TColStd_HSequenceOfHAsciiString;
+  myPointers = new TColStd_HSequenceOfHAsciiString;
+  myImports  = new TColStd_HSequenceOfHAsciiString;
+  myPrims    = new TColStd_HSequenceOfHAsciiString;
+
+  myMethods  = new MS_HSequenceOfExternMet;
+
+  myUses->Append(Name());
+}
+
+void MS_Package::Use(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::Use - aPackage is NULL");
+  }
+
+  if (!IsUsed(aPackage)) {
+    myUses->Append(aPackage);
+  }
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Uses() const 
+{
+  return myUses;
+}
+
+Standard_Boolean MS_Package::IsUsed(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myUses->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::IsUsed - aPackage is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  if (!aPackage->IsSameString(Name())) {
+    for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+      if (myUses->Value(i)->IsSameString(aPackage)) {
+       IsFound = Standard_True;
+      }
+    }
+  }
+  else {
+    IsFound = Standard_True;
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Class(const Handle(TCollection_HAsciiString)& aClass)
+{
+  myClasses->Append(aClass);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Classes() const 
+{
+  return myClasses;
+}
+
+Standard_Boolean MS_Package::HasClass(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myClasses->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasClass - aClass is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myClasses->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Except(const Handle(TCollection_HAsciiString)& anExcept)
+{
+  myExcepts->Append(anExcept);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Excepts() const 
+{
+  return myExcepts;
+}
+
+Standard_Boolean MS_Package::HasExcept(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myExcepts->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasExcept - aExcept is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myExcepts->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Enum(const Handle(TCollection_HAsciiString)& anEnum)
+{
+  myEnums->Append(anEnum);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Enums() const 
+{
+  return myEnums;
+}
+
+Standard_Boolean MS_Package::HasEnum(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myEnums->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasEnum - aEnum is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myEnums->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Alias(const Handle(TCollection_HAsciiString)& anAlias)
+{
+  myAliases->Append(anAlias);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Aliases() const 
+{
+  return myAliases;
+}
+
+Standard_Boolean MS_Package::HasAlias(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myAliases->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasAlias - aAlias is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myAliases->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Pointer(const Handle(TCollection_HAsciiString)& aPointer)
+{
+  myPointers->Append(aPointer);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Pointers() const 
+{
+  return myPointers;
+}
+
+Standard_Boolean MS_Package::HasPointer(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myPointers->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasPointer - aPointer is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myPointers->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Imported(const Handle(TCollection_HAsciiString)& anImported)
+{
+  myImports->Append(anImported);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Importeds() const 
+{
+  return myImports;
+}
+
+Standard_Boolean MS_Package::HasImported(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myImports->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasImport - aImport is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myImports->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Primitive(const Handle(TCollection_HAsciiString)& aPrimitive)
+{
+  myPrims->Append(aPrimitive);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Package::Primitives() const 
+{
+  return myPrims;
+}
+
+Standard_Boolean MS_Package::HasPrimitive(const Handle(TCollection_HAsciiString)& aPackage) const
+{
+  Standard_Integer len     = myPrims->Length();
+  Standard_Boolean IsFound = Standard_False;
+
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Package::HasPrimitive - aPrim is NULL");
+  }
+
+  // we look if the package is defined
+  //
+  for (Standard_Integer i = 1; i <= len && !IsFound; i++) {
+    if (myPrims->Value(i)->IsSameString(aPackage)) {
+      IsFound = Standard_True;
+    }
+  }
+
+  return IsFound;
+}
+
+void MS_Package::Method(const Handle(MS_ExternMet)& aMethod)
+{
+  myMethods->Append(aMethod);
+}
+
+Handle(MS_HSequenceOfExternMet) MS_Package::Methods() const 
+{
+  return myMethods;
+}
+
+
diff --git a/src/MS/MS_Param.cdl b/src/MS/MS_Param.cdl
new file mode 100755 (executable)
index 0000000..e7c24c7
--- /dev/null
@@ -0,0 +1,63 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Param.cdl   1.1
+-- File:       MS_Param.cdl
+-- Created:    Wed Jan 30 16:39:12 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class Param 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Common from MS
+    uses 
+       Type         from MS,
+       Method       from MS,
+       MethodPtr    from MS,
+       HAsciiString from TCollection,
+       TypeOfValue  from MS
+is
+    
+    Create(aMethod: Method from MS; aName: HAsciiString) 
+       returns mutable Param from MS;
+           
+    Method(me: mutable; aMethod: Method from MS);
+
+    IsIn(me) returns Boolean;
+    IsOut(me) returns Boolean;
+    IsImmutable(me) returns Boolean;
+    IsMutable(me) returns Boolean;
+    IsAny(me) returns Boolean;
+
+    AccessMode(me: mutable; aMode : Integer from Standard);
+    GetAccessMode(me) returns Integer from Standard;
+
+    Type(me : mutable; aTypeName : HAsciiString from TCollection);
+    Type(me : mutable; aTypeName : HAsciiString from TCollection; 
+                      aPackName : HAsciiString from TCollection);
+    Type(me)
+       returns mutable Type from MS;
+    TypeName(me)
+       returns mutable HAsciiString from TCollection;
+       
+    Like(me: mutable; aLike: Boolean);
+    IsLike(me)
+       returns Boolean;
+       
+    ItsItem(me : mutable);
+    ItsNotItem(me : mutable);
+    IsItem(me) returns Boolean from Standard;
+
+    GetValueType(me)
+       returns TypeOfValue from MS is virtual;
+       
+fields
+
+    myMethod    : MethodPtr    from MS;
+    myAccessMode : Integer from Standard;
+    myType      : HAsciiString from TCollection;
+
+end Param from MS;
diff --git a/src/MS/MS_Param.cxx b/src/MS/MS_Param.cxx
new file mode 100755 (executable)
index 0000000..5778d72
--- /dev/null
@@ -0,0 +1,185 @@
+#include <MS_Param.ixx>
+#include <Standard_NoSuchObject.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_Class.hxx>
+
+#include <MS_AccessMode.hxx>
+
+MS_Param::MS_Param(const Handle(MS_Method)& aMethod, 
+                  const Handle(TCollection_HAsciiString)& aName) : myMethod(aMethod.operator->()),myAccessMode(0),myType(new TCollection_HAsciiString), MS_Common(aName)
+{
+}
+
+void MS_Param::Method(const Handle(MS_Method)& aMethod)
+{
+  myMethod = aMethod.operator->();
+}
+
+Standard_Boolean MS_Param::IsIn() const 
+{
+  return ((myAccessMode & MS_IN) || (myAccessMode & MS_INOUT));
+}
+
+Standard_Boolean MS_Param::IsOut() const 
+{
+  return ((myAccessMode & MS_OUT) || (myAccessMode & MS_INOUT));
+}
+
+Standard_Boolean MS_Param::IsImmutable() const 
+{
+  Standard_Boolean                 result = Standard_False;
+  Handle(TCollection_HAsciiString) tname  = TypeName();
+
+  if (GetMetaSchema()->IsDefined(tname)) {
+    Handle(MS_Type) t = GetMetaSchema()->GetType(tname);
+
+    if (t->IsKind(STANDARD_TYPE(MS_Class))) {
+      MS_Class *c = (MS_Class *)t.operator->();
+
+      if ((c->IsPersistent() || c->IsTransient()) && !(myAccessMode & MS_MUTABLE)) {
+       result = Standard_True;
+      }
+    }
+    else result = (myAccessMode & MS_IMMUTABLE);
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_Param::IsMutable() const 
+{
+  return (myAccessMode & MS_MUTABLE);
+}
+
+Standard_Boolean MS_Param::IsAny() const 
+{
+  return (myAccessMode & MS_ANY);
+}
+
+void MS_Param::AccessMode(const Standard_Integer aMode)
+{
+  myAccessMode |= aMode;
+}
+
+Standard_Integer MS_Param::GetAccessMode() const 
+{
+  return myAccessMode;
+}
+
+void MS_Param::Type(const Handle(TCollection_HAsciiString)& aTypeName,
+                   const Handle(TCollection_HAsciiString)& aPackName)
+{
+  if (!aPackName->IsEmpty()) {
+    myType = MS::BuildFullName(aPackName,aTypeName);
+  }
+  // it s a generic type
+  //
+  else {
+    myType = aTypeName;
+  }
+}
+
+
+void MS_Param::Type(const Handle(TCollection_HAsciiString)& aTypeName)
+{
+  myType = aTypeName;
+}
+
+Handle(MS_Type) MS_Param::Type() const 
+{
+  Handle(MS_Type) aType;
+
+  if (GetMetaSchema() != UndefinedHandleAddress) {
+    Handle(TCollection_HAsciiString) TheTypeName = TypeName();
+
+    if (GetMetaSchema()->IsDefined(TheTypeName)) {
+      aType = GetMetaSchema()->GetType(TheTypeName);
+    }
+    else {
+      Handle(TCollection_HAsciiString) aMsg = new TCollection_HAsciiString("Error : MS_Param::Type - Type ");
+
+      aMsg->AssignCat(TheTypeName);
+      aMsg->AssignCat(" not found.");
+
+      Standard_NoSuchObject::Raise(aMsg->ToCString());
+    }
+  }
+
+  return aType;
+}
+
+// for type param we must do a complex computation 
+// if its a like type
+//
+Handle(TCollection_HAsciiString) MS_Param::TypeName() const 
+{
+  if (IsLike()) {
+    if (myMethod->IsKind(STANDARD_TYPE(MS_MemberMet))) {
+      Handle(MS_MemberMet)                    ammet     = Handle(MS_MemberMet)::DownCast(myMethod);
+      Handle(TCollection_HAsciiString)        metname   = myMethod->FullName(),
+                                              TheTypeName  = ammet->Class();
+      Handle(MS_Class)                        aClass    = Handle(MS_Class)::DownCast(GetMetaSchema()->GetType(ammet->Class()));
+      Handle(TColStd_HSequenceOfHAsciiString) ancestors = aClass->GetFullInheritsNames();
+      Handle(MS_HSequenceOfMemberMet)         metseq;
+      Standard_Integer                        i,j;
+      Standard_Boolean                        IsFound;
+
+      for (i = 1; i <= ancestors->Length(); i++) {
+       aClass  =  Handle(MS_Class)::DownCast(GetMetaSchema()->GetType(ancestors->Value(i)));
+       metseq  = aClass->GetMethods();
+       IsFound = Standard_False;
+
+       for (j = 1; j <= metseq->Length() && !IsFound; j++) {
+         if (metseq->Value(j)->IsSameSignature(metname)) {
+           IsFound = Standard_True;
+           TheTypeName  = aClass->FullName();
+         }
+       }
+      }
+
+      return TheTypeName;
+    }
+  }
+
+  return myType;
+}
+
+void MS_Param::Like(const Standard_Boolean aLike)
+{
+  if (aLike) {
+    myAccessMode |= MS_LIKE;
+  }
+  else {
+    myAccessMode &= (myAccessMode ^ MS_LIKE);
+  }
+}
+
+Standard_Boolean MS_Param::IsLike() const 
+{
+  return (myAccessMode & MS_LIKE);
+}
+
+
+void MS_Param::ItsItem()
+{
+  myAccessMode |= MS_GENITEM;
+}
+
+void MS_Param::ItsNotItem()
+{
+  myAccessMode &= (myAccessMode ^ MS_GENITEM);
+}
+
+Standard_Boolean MS_Param::IsItem() const
+{
+  return (myAccessMode & MS_GENITEM);
+}
+
+MS_TypeOfValue MS_Param::GetValueType() const 
+{
+  return MS_NONE;
+}
diff --git a/src/MS/MS_ParamWithValue.cdl b/src/MS/MS_ParamWithValue.cdl
new file mode 100755 (executable)
index 0000000..2d00369
--- /dev/null
@@ -0,0 +1,38 @@
+-- File:       MS_ParamWithValue.cdl
+-- Created:    Fri Dec  6 14:48:29 1996
+-- Author:     Christophe LEYNADIER
+--             <cle@parigox.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1996
+
+class ParamWithValue from MS 
+
+inherits Param from MS
+
+uses 
+       Type         from MS,
+       Method       from MS,
+       MethodPtr    from MS,
+       HAsciiString from TCollection,
+       TypeOfValue  from MS
+       
+is
+    Create(aMethod: Method from MS; aName: HAsciiString) 
+       returns mutable ParamWithValue from MS;
+
+    IntegerValue(me: mutable; aInteger: HAsciiString);
+    RealValue(me: mutable; aReal: HAsciiString);
+    StringValue(me: mutable; aString: HAsciiString);
+    EnumValue(me: mutable; aEnum: HAsciiString);
+
+    Value(me: mutable; aValue: HAsciiString; TypeVal : TypeOfValue from MS);
+    GetValue(me) returns mutable HAsciiString;
+    GetValueType(me)
+       returns TypeOfValue from MS is redefined;
+          
+    
+   fields
+    
+    myValue     : HAsciiString from TCollection;
+    myTypeVal   : TypeOfValue  from MS;
+    
+end;
diff --git a/src/MS/MS_ParamWithValue.cxx b/src/MS/MS_ParamWithValue.cxx
new file mode 100755 (executable)
index 0000000..e0975fc
--- /dev/null
@@ -0,0 +1,53 @@
+#include <MS_ParamWithValue.ixx>
+#include <Standard_NoSuchObject.hxx>
+#include <MS_MetaSchema.hxx>
+#include <MS.hxx>
+#include <MS_HSequenceOfMemberMet.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <MS_MemberMet.hxx>
+#include <MS_Class.hxx>
+
+MS_ParamWithValue::MS_ParamWithValue(const Handle(MS_Method)& aMethod, 
+                  const Handle(TCollection_HAsciiString)& aName) : myTypeVal(MS_NONE),MS_Param(aMethod,aName)
+{
+}
+
+void MS_ParamWithValue::IntegerValue(const Handle(TCollection_HAsciiString)& anInteger)
+{
+  myValue     = anInteger;
+  myTypeVal = MS_INTEGER;
+}
+
+void MS_ParamWithValue::RealValue(const Handle(TCollection_HAsciiString)& aReal)
+{
+  myValue = aReal;
+  myTypeVal = MS_REAL;
+}
+
+void MS_ParamWithValue::StringValue(const Handle(TCollection_HAsciiString)& aString)
+{
+  myValue = aString;
+  myTypeVal = MS_STRING;
+}
+
+void MS_ParamWithValue::EnumValue(const Handle(TCollection_HAsciiString)& anEnum)
+{
+  myValue = anEnum;
+  myTypeVal = MS_ENUM;
+}
+
+void MS_ParamWithValue::Value(const Handle(TCollection_HAsciiString)& aValue, const MS_TypeOfValue TypeVal)
+{
+  myValue = aValue;
+  myTypeVal = TypeVal;
+}
+
+Handle(TCollection_HAsciiString) MS_ParamWithValue::GetValue() const 
+{
+  return myValue;
+}
+
+MS_TypeOfValue MS_ParamWithValue::GetValueType() const 
+{
+  return myTypeVal;
+}
diff --git a/src/MS/MS_Pointer.cdl b/src/MS/MS_Pointer.cdl
new file mode 100755 (executable)
index 0000000..fd80e40
--- /dev/null
@@ -0,0 +1,38 @@
+-- File:       MS_Pointer.cdl
+-- Created:    Thu Nov 24 14:46:26 1994
+-- Author:     Kernel
+--             <kernel@espadon>
+---Copyright:   Matra Datavision 1994
+
+
+class Pointer 
+       ---Purpose: Description of the "Pointer" type (Method or Class pointers).
+
+
+    from 
+       MS 
+    inherits NatType from MS
+    uses 
+       Common       from MS,
+       HAsciiString from TCollection
+
+is
+
+    Create(aName, aPackage, aContainer: HAsciiString from TCollection; 
+           aPrivate: Boolean from Standard) 
+       returns mutable Pointer from MS;
+    
+    Type(me: mutable; aType: HAsciiString from TCollection; 
+         aPackage: HAsciiString from TCollection);
+    ---Purpose: Sets the type of the pointer.
+
+    Type(me)
+       returns mutable HAsciiString from TCollection;
+    ---Purpose: Returns the type of the pointer.
+    ---C++:return const &
+       
+fields
+
+    myType : HAsciiString from TCollection;
+
+end Pointer from MS;
diff --git a/src/MS/MS_Pointer.cxx b/src/MS/MS_Pointer.cxx
new file mode 100755 (executable)
index 0000000..171e90b
--- /dev/null
@@ -0,0 +1,32 @@
+#include <MS_Pointer.ixx>
+#include <Standard_NullObject.hxx>
+#include <MS.hxx>
+
+MS_Pointer::MS_Pointer(const Handle(TCollection_HAsciiString)& aName, 
+                      const Handle(TCollection_HAsciiString)& aPackage, 
+                      const Handle(TCollection_HAsciiString)& aContainer, 
+                      const Standard_Boolean aPrivate) : MS_NatType(aName,aPackage,aContainer,aPrivate)
+{
+  
+}
+
+void MS_Pointer::Type(const Handle(TCollection_HAsciiString)& aType, const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (aType.IsNull()) {
+    Standard_NullObject::Raise("MS_Pointer::Type - aType is NULL");
+  }
+  
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_Pointer::Type - aPackage is NULL");
+  }
+
+  myType = MS::BuildFullName(aPackage,aType);
+}
+
+const Handle(TCollection_HAsciiString)& MS_Pointer::Type() const 
+{
+  return myType;
+}
+
+
+
diff --git a/src/MS/MS_PrimType.cdl b/src/MS/MS_PrimType.cdl
new file mode 100755 (executable)
index 0000000..41cf2f2
--- /dev/null
@@ -0,0 +1,44 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_PrimType.cdl        1.1
+-- File:       MS_PrimType.cdl
+-- Created:    Tue Sep 17 18:09:02 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class PrimType 
+
+    from 
+       MS 
+    inherits NatType from MS
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HSequenceOfClass from MS,
+       HAsciiString from TCollection,
+       MetaSchemaPtr from MS
+
+is  
+
+    Create(aName, aPackage, aContainer: HAsciiString; aPrivate: Boolean) 
+       returns mutable PrimType  from MS;
+       
+    Inherit(me: mutable; aClass: HAsciiString; aPackage: HAsciiString);
+    GetInheritsNames(me) 
+       returns mutable HSequenceOfHAsciiString from TColStd;
+    GetFullInheritsNames(me)
+       returns mutable HSequenceOfHAsciiString from TColStd;
+       
+    IsPersistent(me)
+       returns Boolean from Standard;
+       
+    IsTransient(me)
+       returns Boolean from Standard;
+       
+    IsStorable(me)
+       returns Boolean from Standard;
+       
+fields
+
+    myInherits       : HSequenceOfHAsciiString from TColStd;
+
+end PrimType from MS;
diff --git a/src/MS/MS_PrimType.cxx b/src/MS/MS_PrimType.cxx
new file mode 100755 (executable)
index 0000000..ffa6037
--- /dev/null
@@ -0,0 +1,123 @@
+#include <MS_PrimType.ixx>
+#include <Standard_NullObject.hxx>
+#include <MS.hxx>
+#include <MS_MetaSchema.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <MS_Class.hxx>
+#include <MS.hxx>
+
+MS_PrimType::MS_PrimType(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aPackage, 
+                        const Handle(TCollection_HAsciiString)& aContainer, 
+                        const Standard_Boolean aPrivate) : MS_NatType(aName,aPackage,aContainer,aPrivate)
+{
+  myInherits = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_PrimType::Inherit(const Handle(TCollection_HAsciiString)& aClass,
+                         const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (aClass.IsNull()) {
+    Standard_NullObject::Raise("MS_PrimType::Inherit - aClass is NULL");
+  }
+
+  if (aPackage.IsNull()) {
+    Standard_NullObject::Raise("MS_PrimType::Inherit - aPackage is NULL");
+  }
+
+  Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(aPackage,aClass);
+
+  myInherits->Append(aFullName);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_PrimType::GetInheritsNames() const 
+{
+  return myInherits;
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_PrimType::GetFullInheritsNames() const 
+{
+  Standard_Integer                        i;
+  Handle(MS_Type)                         aType;
+  Handle(MS_Class)                        aClass;
+
+  if (GetMetaSchema() == UndefinedHandleAddress) {
+    cerr << "Error : MS_Class::GetFullInheritsNames - Cannot compute inheritance tree without MetaSchema" << endl;
+    Standard_NoSuchObject::Raise();
+  }
+
+  Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString) listAncestor;
+  Standard_Boolean                        End = Standard_False;
+
+  listAncestor = myInherits;
+
+  if (listAncestor->Length() == 0) {
+    End = Standard_True;
+  }
+  
+  while(!End) {
+    for (i = 1; i <= listAncestor->Length(); i++) {
+      result->Append(listAncestor->Value(i));
+    }
+
+    aType        = GetMetaSchema()->GetType(result->Value(result->Length()));
+    aClass       = Handle(MS_Class)::DownCast(aType);
+    listAncestor = aClass->GetInheritsNames();
+
+    if (listAncestor->Length() == 0) {
+      End = Standard_True;
+    }
+  }
+
+  return result;
+}
+
+Standard_Boolean MS_PrimType::IsPersistent() const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) Ancestors = GetFullInheritsNames();
+  Handle(TCollection_HAsciiString)        Root      = MS::GetPersistentRootName();
+  Standard_Integer                        i;
+
+  if (FullName()->IsSameString(Root))
+    return Standard_True;
+
+  if (Ancestors->Length() == 0) return Standard_False;
+
+  for (i = 1; i <= Ancestors->Length(); i++) {
+    if (Ancestors->Value(i)->IsSameString(Root))
+      return Standard_True;
+  }
+
+  return Standard_False;
+}
+
+Standard_Boolean MS_PrimType::IsTransient() const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) Ancestors = GetFullInheritsNames();
+  Handle(TCollection_HAsciiString)        Root      = MS::GetTransientRootName();
+
+  if (FullName()->IsSameString(Root))
+    return Standard_True;
+
+  if (Ancestors->Length() == 0) return Standard_False;
+
+  if (Ancestors->Value(Ancestors->Length())->IsSameString(Root))
+    return Standard_True;
+  else return Standard_False;
+}
+
+Standard_Boolean MS_PrimType::IsStorable() const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) Ancestors = GetFullInheritsNames();
+  Handle(TCollection_HAsciiString)        Root      = MS::GetStorableRootName();
+
+  if (FullName()->IsSameString(Root))
+    return Standard_True;
+
+  if (Ancestors->Length() == 0) return Standard_False;
+
+  if (Ancestors->Value(Ancestors->Length())->IsSameString(Root))
+    return Standard_True;
+  else return Standard_False;
+}
diff --git a/src/MS/MS_Schema.cdl b/src/MS/MS_Schema.cdl
new file mode 100755 (executable)
index 0000000..89e9a4d
--- /dev/null
@@ -0,0 +1,33 @@
+-- File:       MS_Schema.cdl
+-- Created:    Mon Aug 23 18:17:24 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+class Schema 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits GlobalEntity from MS 
+    uses 
+       HSequenceOfHAsciiString from TColStd,
+       HAsciiString            from TCollection
+
+is
+
+    Create(aSchema : HAsciiString from TCollection) returns mutable Schema from MS;
+    
+    Package(me : mutable; aPackage : HAsciiString from TCollection);
+    GetPackages(me) returns mutable HSequenceOfHAsciiString from TColStd;
+       
+    Class(me : mutable; aClass : HAsciiString from TCollection);
+    GetClasses(me) returns HSequenceOfHAsciiString from TColStd;
+    
+fields
+
+    myPackages    : HSequenceOfHAsciiString from TColStd;
+    myClasses     : HSequenceOfHAsciiString from TColStd;
+    
+end Schema from MS;
+
diff --git a/src/MS/MS_Schema.cxx b/src/MS/MS_Schema.cxx
new file mode 100755 (executable)
index 0000000..b9a1927
--- /dev/null
@@ -0,0 +1,30 @@
+#include <MS_Schema.ixx>
+#include <MS.hxx>
+
+MS_Schema::MS_Schema(const Handle(TCollection_HAsciiString)& aSchema) : MS_GlobalEntity(aSchema)
+{
+  myPackages = new TColStd_HSequenceOfHAsciiString;
+  myClasses  = new TColStd_HSequenceOfHAsciiString;
+}
+
+void MS_Schema::Package(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  MS::AddOnce(myPackages,aPackage);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Schema::GetPackages() const 
+{
+  return myPackages;
+}
+
+void MS_Schema::Class(const Handle(TCollection_HAsciiString)& aClass)
+{
+  MS::AddOnce(myClasses,aClass);
+}
+
+Handle(TColStd_HSequenceOfHAsciiString) MS_Schema::GetClasses() const 
+{
+  return myClasses;
+}
+
+
diff --git a/src/MS/MS_StdClass.cdl b/src/MS/MS_StdClass.cdl
new file mode 100755 (executable)
index 0000000..797735d
--- /dev/null
@@ -0,0 +1,45 @@
+-- File:       MS_StdClass.cdl
+-- Created:    Tue Jan 29 12:06:46 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+class StdClass 
+    from 
+       MS 
+    inherits Class from MS
+    uses
+       InstClass                 from MS,
+       HAsciiString              from TCollection     
+       
+is
+
+    Create(aName: HAsciiString; aPackage: HAsciiString) 
+       returns mutable StdClass from MS;
+    
+    Create(aName, aPackage, Mother: HAsciiString; 
+          aPrivate, aDeferred, aInComplete: Boolean) 
+       returns mutable StdClass from MS;
+              
+    Validity(me; aName: HAsciiString; aPackage: HAsciiString) is virtual;
+               
+    CreatedBy(me : mutable; anInstClass : InstClass from MS);
+    ---Purpose: If a class was created by an instantiation, this 
+    --          method is called.
+    GetMyCreator(me) 
+       returns mutable InstClass from MS;
+       
+    SetGenericState(me : mutable; aNestingState   : Boolean from Standard);
+    IsGeneric(me)
+       returns Boolean from Standard;
+    ---Purpose: if <me> has not been instantiated return True
+    --          Because <me> may be defined in a generic class.
+    
+fields
+    myInstClass      : InstClass                 from MS;
+    myNestingState   : Boolean from Standard;   -- True if <me> is a generic stdclass (not created by insttostd - see InstClass)
+    
+end StdClass from MS;
+
+
diff --git a/src/MS/MS_StdClass.cxx b/src/MS/MS_StdClass.cxx
new file mode 100755 (executable)
index 0000000..eb1bd95
--- /dev/null
@@ -0,0 +1,44 @@
+#include <MS_StdClass.ixx>
+#include <MS_MetaSchema.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+MS_StdClass::MS_StdClass(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aPackage) : myNestingState(Standard_False),MS_Class(aName,aPackage)
+{
+}
+
+MS_StdClass::MS_StdClass(const Handle(TCollection_HAsciiString)& aName, 
+                        const Handle(TCollection_HAsciiString)& aPackage, 
+                        const Handle(TCollection_HAsciiString)& Mother, 
+                        const Standard_Boolean aPrivate, 
+                        const Standard_Boolean aDeferred, 
+                        const Standard_Boolean aInComplete) 
+: myNestingState(Standard_False),MS_Class(aName,aPackage,Mother,aPrivate,aDeferred,aInComplete)
+{
+}
+
+void MS_StdClass::Validity(const Handle(TCollection_HAsciiString)& aName, 
+                          const Handle(TCollection_HAsciiString)& aPackage) const 
+{
+}
+
+void MS_StdClass::CreatedBy(const Handle(MS_InstClass)& anInstClass) 
+{
+  myInstClass = anInstClass;
+}
+
+Handle(MS_InstClass) MS_StdClass::GetMyCreator() const
+{
+  return myInstClass;
+}
+
+void MS_StdClass::SetGenericState(const Standard_Boolean aNestingState) 
+{
+  myNestingState = aNestingState;
+}
+
+Standard_Boolean MS_StdClass::IsGeneric() const
+{
+  return myNestingState;
+}
diff --git a/src/MS/MS_Type.cdl b/src/MS/MS_Type.cdl
new file mode 100755 (executable)
index 0000000..a9e8089
--- /dev/null
@@ -0,0 +1,35 @@
+-- SCCS                Date: 04/23/95
+--             Information: @(#)MS_Type.cdl    1.1
+-- File:       MS_Type.cdl
+-- Created:    Thu Mar 14 12:24:39 1995
+-- Author:     Christophe LEYNADIER
+--             <cle@ilebon>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class Type 
+       ---Purpose: 
+
+    from 
+       MS 
+    inherits Common from MS 
+    uses
+       Package from MS,
+       HAsciiString from TCollection
+
+is
+    Initialize(aName: HAsciiString);
+    Initialize(aName, aPackage, Container: HAsciiString; InPackage: Boolean);
+              
+    Private(me) returns Boolean is deferred;
+       
+    Package(me: mutable; aPackage: HAsciiString) is virtual;
+    Package(me) returns mutable Package from MS is virtual;
+    
+fields
+
+    myPackage     : HAsciiString from TCollection;
+    
+end Type from MS;
+
+
diff --git a/src/MS/MS_Type.cxx b/src/MS/MS_Type.cxx
new file mode 100755 (executable)
index 0000000..bb20a57
--- /dev/null
@@ -0,0 +1,47 @@
+#include <MS_Type.ixx>
+#include <Standard_NullObject.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <MS_MetaSchema.hxx>
+
+MS_Type::MS_Type(const Handle(TCollection_HAsciiString)& aName) : MS_Common(aName)
+{
+}
+
+MS_Type::MS_Type(const Handle(TCollection_HAsciiString)& aName, 
+                const Handle(TCollection_HAsciiString)& aPackage, 
+                const Handle(TCollection_HAsciiString)& Container, 
+                const Standard_Boolean InPackage) : MS_Common(aName)
+{
+  if (aName.IsNull()) {
+    Standard_NullObject::Raise("MS_Type::MS_Type - aName is NULL");
+  }
+
+  myPackage = aPackage;
+}
+
+void MS_Type::Package(const Handle(TCollection_HAsciiString)& aPackage)
+{
+  if (!aPackage.IsNull()) {
+    myPackage = aPackage;
+  }
+  else {
+    Standard_NullObject::Raise("MS_Type::Package - aPackage is NULL");
+  }
+}
+
+Handle(MS_Package) MS_Type::Package() const 
+{
+  if (GetMetaSchema() != UndefinedHandleAddress) {
+    return GetMetaSchema()->GetPackage(myPackage);
+  }
+  else {
+    Handle(TCollection_HAsciiString) aString = new TCollection_HAsciiString("MS_Type::Package - No MetaSchema for this object: ");
+    
+    aString->AssignCat(Name());
+    Standard_NoSuchObject::Raise(aString->ToCString());
+  }
+    return GetMetaSchema()->GetPackage(myPackage);
+}
+
+
+