]> OCCT Git - occt-copy.git/commitdiff
0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of...
authorabv <abv@opencascade.com>
Wed, 1 Apr 2020 22:21:08 +0000 (01:21 +0300)
committerika <ika@opencascade.com>
Mon, 24 Aug 2020 12:00:41 +0000 (15:00 +0300)
Integration of ExpToCas tool ported to modern state of OCCT:
- new package Express and toolkit TKExpress for EXPRESS data structures and OCCT class generator
- executable ExpToCasExe including lax/yacc parsers, for parsing a Part 21 file and generating classes

Off-topic: genproj.tcl is improved to
- deal correctly with FILES files containing CRLF end-of-lines
- generate one project per executable unit (instead of one project per cxx file); note that this matches behaviour of CMake generator

73 files changed:
adm/MODULES
adm/UDLIST
adm/genproj.tcl
src/ExpToCasExe/ExpToCasExe.cxx [new file with mode: 0644]
src/ExpToCasExe/FILES [new file with mode: 0644]
src/ExpToCasExe/expformat.l [new file with mode: 0644]
src/ExpToCasExe/explist.l [new file with mode: 0644]
src/ExpToCasExe/expparse.cxx [new file with mode: 0644]
src/ExpToCasExe/expparse.h [new file with mode: 0644]
src/ExpToCasExe/expscan.cxx [new file with mode: 0644]
src/ExpToCasExe/exptocas.h [new file with mode: 0644]
src/ExpToCasExe/exptocas.html [new file with mode: 0644]
src/ExpToCasExe/exptocas.l [new file with mode: 0644]
src/ExpToCasExe/exptocas.y [new file with mode: 0644]
src/ExpToCasExe/lex.yy.c [new file with mode: 0644]
src/ExpToCasExe/mkexpformat [new file with mode: 0644]
src/ExpToCasExe/mkexplist [new file with mode: 0644]
src/ExpToCasExe/mkparser [new file with mode: 0644]
src/ExpToCasExe/mkscanner [new file with mode: 0644]
src/Express/Express.cxx [new file with mode: 0644]
src/Express/Express.hxx [new file with mode: 0644]
src/Express/Express_Alias.cxx [new file with mode: 0644]
src/Express/Express_Alias.hxx [new file with mode: 0644]
src/Express/Express_Array.hxx [new file with mode: 0644]
src/Express/Express_Bag.hxx [new file with mode: 0644]
src/Express/Express_Boolean.cxx [new file with mode: 0644]
src/Express/Express_Boolean.hxx [new file with mode: 0644]
src/Express/Express_ComplexType.cxx [new file with mode: 0644]
src/Express/Express_ComplexType.hxx [new file with mode: 0644]
src/Express/Express_DataMapOfAsciiStringItem.hxx [new file with mode: 0644]
src/Express/Express_Entity.cxx [new file with mode: 0644]
src/Express/Express_Entity.hxx [new file with mode: 0644]
src/Express/Express_Enum.cxx [new file with mode: 0644]
src/Express/Express_Enum.hxx [new file with mode: 0644]
src/Express/Express_Field.cxx [new file with mode: 0644]
src/Express/Express_Field.hxx [new file with mode: 0644]
src/Express/Express_HSequenceOfEntity.hxx [new file with mode: 0644]
src/Express/Express_HSequenceOfField.hxx [new file with mode: 0644]
src/Express/Express_HSequenceOfItem.hxx [new file with mode: 0644]
src/Express/Express_Integer.cxx [new file with mode: 0644]
src/Express/Express_Integer.hxx [new file with mode: 0644]
src/Express/Express_Item.cxx [new file with mode: 0644]
src/Express/Express_Item.hxx [new file with mode: 0644]
src/Express/Express_List.hxx [new file with mode: 0644]
src/Express/Express_Logical.cxx [new file with mode: 0644]
src/Express/Express_Logical.hxx [new file with mode: 0644]
src/Express/Express_NamedType.cxx [new file with mode: 0644]
src/Express/Express_NamedType.hxx [new file with mode: 0644]
src/Express/Express_Number.hxx [new file with mode: 0644]
src/Express/Express_PredefinedType.cxx [new file with mode: 0644]
src/Express/Express_PredefinedType.hxx [new file with mode: 0644]
src/Express/Express_Real.cxx [new file with mode: 0644]
src/Express/Express_Real.hxx [new file with mode: 0644]
src/Express/Express_Reference.cxx [new file with mode: 0644]
src/Express/Express_Reference.hxx [new file with mode: 0644]
src/Express/Express_Schema.cxx [new file with mode: 0644]
src/Express/Express_Schema.hxx [new file with mode: 0644]
src/Express/Express_Select.cxx [new file with mode: 0644]
src/Express/Express_Select.hxx [new file with mode: 0644]
src/Express/Express_SequenceOfEntity.hxx [new file with mode: 0644]
src/Express/Express_SequenceOfField.hxx [new file with mode: 0644]
src/Express/Express_SequenceOfItem.hxx [new file with mode: 0644]
src/Express/Express_Set.hxx [new file with mode: 0644]
src/Express/Express_String.cxx [new file with mode: 0644]
src/Express/Express_String.hxx [new file with mode: 0644]
src/Express/Express_Type.cxx [new file with mode: 0644]
src/Express/Express_Type.hxx [new file with mode: 0644]
src/Express/FILES [new file with mode: 0644]
src/OS/DataExchange.tcl
src/TKExpress/CMakeLists.txt [new file with mode: 0644]
src/TKExpress/EXTERNLIB [new file with mode: 0644]
src/TKExpress/FILES [new file with mode: 0644]
src/TKExpress/PACKAGES [new file with mode: 0644]

index 2ec6ef3029daaa1905d5a2897f2fd6887e3f037b..36fb6fcad0b160c5c02446f605f5ec95128c4fc2 100644 (file)
@@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
 ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
 Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
 ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
-DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
+DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKExpress ExpToCasExe
 Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
index 9952c018092c4e7f1b05405d71b8ed9266132966..09aad25698f9e840a0ddfb2d74ebe3da961af2a0 100644 (file)
@@ -465,3 +465,6 @@ n TreeModel
 n View
 n ViewControl
 n VInspector
+n Express
+t TKExpress
+x ExpToCasExe
index 8a077ae8d502040c76c83ee44f9eb5b0483219d2..0e4ef83424ce7a4fde80c311b5599979c8576189 100644 (file)
@@ -85,7 +85,7 @@ proc _get_used_files { pk theSrcDir {inc true} {src true} } {
   set index -1
   foreach line $FILES {
     incr index
-    if {$inc && ([regexp {([^:\s]*\.[hgl]xx)$} $line dummy name] || [regexp {([^:\s]*\.h)$} $line dummy name]) && [file exists $pk_path/$name]} {
+    if {$inc && ([regexp {([^:\s]*\.[hgl]xx)\r?$} $line dummy name] || [regexp {([^:\s]*\.h)\r?$} $line dummy name]) && [file exists $pk_path/$name]} {
       lappend lret "pubinclude $name $pk_path/$name"
       continue
     }
@@ -1228,28 +1228,31 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
       lappend aProjectsInModule($aModule) $aToolKit
       lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
     }
-    # executables, assume one project per cxx file...
+    # executables, assume one project per unit...
     foreach aUnit [OS:executable ${aModule}] {
+      set aPrjName $aUnit
       set aUnitLoc $aUnit
-      set src_files [_get_used_files $aUnit $theSrcDir false]
-      set aSrcFiles {}
-      foreach s $src_files {
-        regexp {source ([^\s]+)} $s dummy name
-        lappend aSrcFiles $name
-      }
-      foreach aSrcFile $aSrcFiles {
-        set aFileExtension [file extension $aSrcFile]
-        if { $aFileExtension == ".cxx" } {
-          set aPrjName [file rootname $aSrcFile]
+#      set src_files [_get_used_files $aUnit $theSrcDir false]
+#      set aSrcFiles {}
+#      foreach s $src_files {
+#        regexp {source ([^\s]+)} $s dummy name
+#        lappend aSrcFiles $name
+#      }
+
+#      foreach aSrcFile $aSrcFiles {
+#        set aFileExtension [file extension $aSrcFile]
+#        if { $aFileExtension == ".cxx" } {
+#          set aPrjName [file rootname $aSrcFile]
           lappend aProjects $aPrjName
           lappend aProjectsInModule($aModule) $aPrjName
           if {[file isdirectory $path/$theSrcDir/$aUnitLoc]} {
-            lappend aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] $theSrcDir $theSourceDirOther]
+            lappend aDependencies [LibToLinkX $aUnitLoc $aPrjName $theSrcDir $theSourceDirOther]
           } else {
+            puts "Error: cannot find executable unit $path/$theSrcDir/$aUnitLoc"
             lappend aDependencies {}
           }
-        }
-      }
+#        }
+#      }
     }
   }
 }
@@ -2082,10 +2085,11 @@ proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension
 # Generate Visual Studio project file for executable
 proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
   set aVcFiles {}
-  foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
+#  foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
     set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
 
-    set aProjName [file rootname [file tail $f]]
+    set aProjName $theToolKit
+#    set aProjName [file rootname [file tail $f]]
     set l_compilable [osutils:compilable wnt]
     regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
 
@@ -2111,25 +2115,31 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
 
     set aFilesSection ""
     set aVcFilesCxx(units) ""
-       set aVcFilesHxx(units) ""
+    set aVcFilesHxx(units) ""
+
+#puts "$theToolKit -> [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir]"
 
-    if { ![info exists written([file tail $f])] } {
-      set written([file tail $f]) 1
+#    if { ![info exists written([file tail $f])] } {
+#      set written([file tail $f]) 1
 
       if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
-        append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
         if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
-        lappend aVcFilesCxx($theToolKit) $f
+        foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
+          append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
+          lappend aVcFilesCxx($theToolKit) $f
+        }
       } else {
         append aFilesSection "\t\t\t<Filter\n"
         append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
         append aFilesSection "\t\t\t\t>\n"
-        append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
+        foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
+          append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
+        }
         append aFilesSection "\t\t\t</Filter>"
       }
-    } else {
-      puts "Warning : in vcproj there are more than one occurences for [file tail $f]"
-    }
+#    } else {
+#      puts "Warning : in vcproj there are more than one occurences for [file tail $f]"
+#    }
     #puts "$aProjTmpl $aFilesSection"
     set anIncPaths "..\\..\\..\\inc"
     regsub -all -- {__TKINC__}  $aProjTmpl $anIncPaths    aProjTmpl
@@ -2172,7 +2182,7 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
 
       lappend aVcFiles "$aCommonSettingsFile"
     }
-  }
+#  }
   return $aVcFiles
 }
 
@@ -3574,7 +3584,7 @@ proc osutils:checksrcfiles { theUnit theSrcDir} {
 
   if {[file exists "${anUnitAbsPath}/FILES"]} {
     set aFilesFile [open "${anUnitAbsPath}/FILES" rb]
-    set aFilesFileList [split [read ${aFilesFile}] "\n"]
+    set aFilesFileList [split [regsub -all "\r" [read ${aFilesFile}] ""] "\n"]
     close ${aFilesFile}
 
     set aFilesFileList [lsearch -inline -all -not -exact ${aFilesFileList} ""]
diff --git a/src/ExpToCasExe/ExpToCasExe.cxx b/src/ExpToCasExe/ExpToCasExe.cxx
new file mode 100644 (file)
index 0000000..427bb1b
--- /dev/null
@@ -0,0 +1,196 @@
+// File:       ExpToCasExe.cxx
+// Created:    Mon Nov  1 12:50:27 1999
+// Author:     Andrey BETENEV
+//             <abv@nordox.nnov.matra-dtv.fr>
+
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
+#include <Express_Schema.hxx>
+#include <Express_Item.hxx>
+
+Handle(Express_Schema) ec_parse ( FILE *fin ); // interface to parser
+
+// Load list of (class name, package name) from the file
+// Package names and optional mark flag are set to items in the schema
+static Standard_Boolean LoadList (const char file[], const Handle(Express_Schema) schema,
+                                 const Standard_Boolean mark)
+{
+  FILE *fd_pack = fopen ( file, "r" );
+  if ( ! fd_pack ) {
+    std::cout << "Warning: cannot open " << file << std::endl;
+    return Standard_False;
+  }
+
+  std::cout << "Loading " << file << "..";
+  char string[200];
+  while ( fgets ( string, 199, fd_pack ) ) {
+    char *s = string, *name=0;
+    Standard_Integer ind;
+    while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
+    if ( ! *s ) continue;
+    name = s;
+    name[ind] = '\0';
+    Handle(Express_Item) item = schema->Item ( name, Standard_True );
+    if ( item.IsNull() ) continue; // silently skip any class name not in schema
+    s += ind + 1;
+    while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
+    if ( ! *s ) continue;
+    s[ind] = '\0';
+    Handle(TCollection_HAsciiString) pack = new TCollection_HAsciiString ( s );
+    if ( ! item->GetPackageName().IsNull() && item->GetPackageName()->IsDifferent ( pack ) ) {
+      std::cout << "\nWarning: Package is redefined for item " << name << std::endl;
+    }
+    item->SetPackageName ( pack );
+    if ( mark ) item->SetMark ( Standard_True );
+    //gka ----------------------------------------------
+    //filling additional field shortname for item  
+    //and setting flags marked presence of methods Check and FillShared.
+    //fields in the text file situate in the next way:
+    //name package_name  shortname check_flag(0 or 1) fillshared_flag(0 or 1) 
+    
+    s += ind + 1;
+    Handle(TCollection_HAsciiString) shortname = new TCollection_HAsciiString;
+    Standard_Boolean hasShortName = Standard_False;
+    while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
+    if ( ! *s ) continue;
+    s[ind] = '\0';
+    //set CheckFlag or shortname
+    if(*s == '0' || *s == '1') {
+      Standard_Boolean hasCheck = (*s == '0' ? Standard_False : Standard_True);
+      item->SetCheckFlag(hasCheck);
+    }
+    else {
+      if(*s != '-')
+        shortname->SetValue(1,s);
+      if(shortname->Length() >0)
+      item->SetShortName(shortname);
+      hasShortName = Standard_True;
+    }
+    
+    s += ind + 1;
+    //set FillSharedFlag or shortname
+    while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
+    if ( ! *s ) continue;
+    s[ind] = '\0';
+    if(!hasShortName) {
+      if(*s == '0' || *s == '1') {
+        Standard_Boolean hasFillShared = (*s == '0' ? Standard_False : Standard_True);
+        item->SetFillSharedFlag(hasFillShared);
+      }
+      else {
+        if(*s != '-')
+          shortname->SetValue(1,s);
+        if(shortname->Length() >0)
+          item->SetShortName(shortname);
+        hasShortName = Standard_True;
+      }
+      
+      s += ind + 1;
+      //set short name
+      while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
+      if ( ! *s ) continue;
+      s[ind] = '\0';
+    }
+    if(!hasShortName) {
+      if(*s != '-')
+        shortname->SetValue(1,s);
+      if(shortname->Length() >0)
+        item->SetShortName(shortname);
+      
+      s += ind + 1;
+      //set Category
+      while ( *s && ! ( ind = strcspn ( s, " \t\r\n" ) ) ) s++;
+      if ( ! *s ) continue;
+      s[ind] = '\0';
+    }
+    Handle(TCollection_HAsciiString) category = new TCollection_HAsciiString;
+    category->SetValue(1,s);
+    if(category->Length()>0)
+      item->SetCategory(category);
+    //-----------------------------------------------------
+    
+    
+  }
+  std::cout << " Done" << std::endl;
+  
+  fclose ( fd_pack );
+  return Standard_True;
+}
+
+// MAIN program
+Standard_Integer main ( const Standard_Integer argc, const char *argv[] )
+{
+  if ( argc <2 ) {
+    std::cout << "EXPRESS -> CASCADE/XSTEP classes generator 3.0" << std::endl;
+    std::cout << "Use: ExpToCas <schema.exp> [<create.lst> [<packaging.lst>]]" << std::endl;
+    std::cout << "Where: " << std::endl;
+    std::cout << "- schema.exp is a file with EXPRESS schema " << std::endl;
+    std::cout << "- create.lst is a file with list of types to generate (all if none)" << std::endl;
+    std::cout << "  (or \"-\" for creating all entities in the schema)" << std::endl;
+    std::cout << "- packaging.lst is a file with classes distribution per package" << std::endl;
+    std::cout << "  in the form of the list (one item per line) \"<TypeName> <Package>\"" << std::endl;
+    std::cout << "  If package not defined for some type, \"StepStep\" assumed" << std::endl;
+    return 0;
+  }
+  
+  //=================================
+  // Step 1: parsing EXPRESS file
+  // open schema file
+  FILE *fin = fopen ( argv[1], "rt" );
+  if ( ! fin ) {
+    std::cout << "Error: Cannot open " << argv[1] << std::endl;
+    return 0;
+  }
+  
+  // parse
+  std::cout << "Starting parsing " << argv[1] << std::endl;
+  Handle(Express_Schema) schema = ec_parse ( fin );
+  fclose ( fin );
+
+  if ( schema.IsNull() ) {
+    std::cout << "Error: Parsing finished with no result" << std::endl;
+    return 0;
+  }
+  else std::cout << "Schema " << schema->Name()->ToCString() << " successfully parsed" << std::endl;
+
+  //=================================
+  // Step 2: Prepare data for creating classes
+  
+  // load packaging information
+  if ( argc >3 ) {
+    if ( ! LoadList ( argv[3], schema, Standard_False ) ) return 0;
+  }
+  
+  // load list of classes to generate
+  TColStd_SequenceOfInteger seq;
+  if ( argc >2 ) {
+    if ( argv[2][0] =='-' ) { // set mark for all items
+      for ( Standard_Integer num=1; num <= schema->NbItems(); num++ )
+       schema->Item ( num )->SetMark(Standard_True);
+    }
+    else if ( ! LoadList ( argv[2], schema, Standard_True ) ) return 0;
+  }
+
+  //=================================
+  // Step 3: Iterate by items and generate classes
+
+  std::cout << "Total " << schema->NbItems() << " items" << std::endl;
+  Standard_Boolean done = Standard_False;
+  Standard_Integer nbgen = 0;
+  do {
+    done = Standard_False;
+    for ( Standard_Integer num=1; num <= schema->NbItems(); num++ ) {
+      if ( ! schema->Item ( num )->GetMark() ) continue;
+      nbgen += schema->Item ( num )->Generate();
+      done = Standard_True;
+//      std::cout << num << ": " << schema->Item(num)->CPPName()->ToCString() << std::endl;
+    }
+  } while ( done );
+//  std::cout << "Finished; total " << nbgen << " classes generated" << std::endl;
+  return 1;
+}
diff --git a/src/ExpToCasExe/FILES b/src/ExpToCasExe/FILES
new file mode 100644 (file)
index 0000000..4d257e4
--- /dev/null
@@ -0,0 +1,7 @@
+exptocas.h
+expparse.h
+mkscanner
+mkparser
+ExpToCasExe.cxx
+expscan.cxx
+expparse.cxx
diff --git a/src/ExpToCasExe/expformat.l b/src/ExpToCasExe/expformat.l
new file mode 100644 (file)
index 0000000..797eeff
--- /dev/null
@@ -0,0 +1,56 @@
+%{
+
+/* This LEX scanner is intended for formatting EXPRESS definitions */
+/* in order to allow comparison with other: */
+/* - remove comments */
+/* - remove all spaces */
+/* - insert a CR (\n) after each ';' */
+/* - insert a space after each word (identifier or number) */
+
+/************************************/
+/* Section 1                        */
+/* definitions                      */
+%}
+
+
+%x COMM
+
+KEYWORD    [A-Z_]+
+NAME       [a-z_][a-z0-9_]*
+NUMBER     [0-9]+
+SPACE      [ \t\n]
+SPC        {SPACE}+
+SP         {SPACE}*
+
+%{
+
+static int fun_level=0;
+
+/************************************/
+/* Section 2                        */
+/* parsing rules                    */
+%}
+
+%%
+
+"--".*               ; /* Eat line comments */
+"(*"                 BEGIN(COMM);
+<COMM>.|\n           ; /* Eat multiline comments */
+<COMM>"*)"           BEGIN(0);
+
+;                    printf ( ";\n" );
+[A-Za-z_0-9+-]+      printf ( "%s ", yytext );
+[ \t\n]+             ; /* condense spaces */
+
+%%
+
+/************************************/
+/* Section 3                        */
+/* calling and auxiliary procedures */
+
+int main ( void )
+{
+  yylex();
+}
+
+int yywrap(void) { return 1; }
diff --git a/src/ExpToCasExe/explist.l b/src/ExpToCasExe/explist.l
new file mode 100644 (file)
index 0000000..62a1120
--- /dev/null
@@ -0,0 +1,76 @@
+%{
+
+/* This LEX scanner produces list of items included in the EXPRESS schema  */
+/* (TYPE, ENTITY, FUNCTION, RULE) */
+
+/************************************/
+/* Section 1                        */
+/* definitions                      */
+%}
+
+
+%x CONST, TYP, TYP1, ENT, ENT1, LIST, COMM, SKP, FUN, FUN1, RUL
+
+KEYWORD    [A-Z_]+
+NAME       [a-z_][a-z0-9_]*
+NUMBER     [0-9]+
+SPACE      [ \t\n]
+SPC        {SPACE}+
+SP         {SPACE}*
+
+%{
+
+static int fun_level=0;
+
+/************************************/
+/* Section 2                        */
+/* parsing rules                    */
+%}
+
+%%
+
+"--".*               ; /* Eat line comments */
+"(*"                 { printf ( "Starting multiline comment\n" ); BEGIN(COMM); }
+<COMM>.|\n           ; /* Eat multiline comments */
+<COMM>"*)"           { printf ( "End of multiline comment\n" ); BEGIN(0); }
+
+SCHEMA" "{NAME};     printf ( "Starting %s\n", yytext ); 
+END_SCHEMA;          printf ( "Schema finished\n" );
+
+TYPE                 { BEGIN(TYP); }
+<TYP>{NAME}          { printf ( "TYPE %s\n", yytext ); BEGIN(TYP1); }
+<TYP1>.|\n           ; /* eat any unrecognized data */
+<TYP,TYP1,SKP>END_TYPE  { printf ( "\n" ); BEGIN(0); }
+
+ENTITY               { BEGIN(ENT); }
+<ENT>{NAME}          { printf ( "ENTITY %s\n", yytext ); BEGIN(ENT1); }
+<ENT1>.|\n           ; /* eat any unrecognized data */
+<ENT,ENT1,SKP>END_ENTITY  BEGIN(0);
+
+<ENT,TYP>DERIVE      |
+<ENT,TYP>WHERE       BEGIN(SKP);
+<SKP>.|\n            ; /* eat contents of WHERE and DERIVE subclauses */
+
+<INITIAL,FUN1>^{SP}FUNCTION  { BEGIN(FUN); fun_level++; }
+<FUN>{NAME}          { printf ( "FUNCTION %s\n", yytext ); BEGIN(FUN1); }
+<FUN1>.|\n           ; /* eat contents of WHERE and DERIVE subclauses */
+<FUN,FUN1>END_FUNCTION  { fun_level--; if ( ! fun_level ) BEGIN(0); }
+
+RULE                 { BEGIN(RUL); }
+<RUL>{NAME}          { printf ( "RULE %s\n", yytext ); BEGIN(SKP); }
+<RUL,SKP>END_RULE        BEGIN(0);
+
+.|\n                 ; /* eat any unrecognized data */
+
+%%
+
+/************************************/
+/* Section 3                        */
+/* calling and auxiliary procedures */
+
+int main ( void )
+{
+  yylex();
+}
+
+int yywrap(void) { return 1; }
diff --git a/src/ExpToCasExe/expparse.cxx b/src/ExpToCasExe/expparse.cxx
new file mode 100644 (file)
index 0000000..7650781
--- /dev/null
@@ -0,0 +1,1316 @@
+
+# line 2 "Express.y"
+
+/* File:       Express.y                     */
+/* Created:    Thu Oct 28 12:21:16 1999       */
+/* Author:     Andrey BETENEV                 */
+/*             <abv@doomox.nnov.matra-dtv.fr> */
+/* Copyright:  Matra Datavision 1999          */
+
+/*****************************************************************************\
+
+This YACC parser implements parsing algorithm for EXPRESS -> CASCADE/XSTEP
+classes generator
+
+Input in the form of tokens is obtained from lexical analyser. Then, data 
+structure representing schema is created on the basis of grammar analysis.
+
+NOTE: The grammar currently implemented is not full. 
+FUNCTION, RULE and CONSTANT items, WHERE, INVERSE and DERIVE clauses 
+of TYPE and ENTITY items are not considered (ignored on the level of lexical 
+scanner). 
+SUPERTYPE and UNIQUE clauses of ENTITY item are recognized but ignored.
+Also, complex constructs such as using call to function in dimensions of 
+complex time or redefinition of inherited field are ignored.
+
+\*****************************************************************************/
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <Express_HSequenceOfField.hxx>
+#include <Express_HSequenceOfItem.hxx>
+#include <Express_Field.hxx>
+#include <Express_Item.hxx>
+#include <Express_Enum.hxx>
+#include <Express_Alias.hxx>
+#include <Express_Select.hxx>
+#include <Express_Entity.hxx>
+#include <Express_Type.hxx>
+#include <Express_NamedType.hxx>
+#include <Express_PredefinedType.hxx>
+#include <Express_Number.hxx>
+#include <Express_Integer.hxx>
+#include <Express_Boolean.hxx>
+#include <Express_Logical.hxx>
+#include <Express_Real.hxx>
+#include <Express_String.hxx>
+#include <Express_ComplexType.hxx>
+#include <Express_Array.hxx>
+#include <Express_List.hxx>
+#include <Express_Set.hxx>
+#include <Express_Bag.hxx>
+#include <Express_Schema.hxx>
+#include <Express_Reference.hxx>
+#include <Express.hxx>
+
+/************************************************/
+/* ERROR MESSAGE FUNCTION                       */
+
+/* external functions (from Express.l) */
+int ec_error ( char *s, char *text );
+int ec_curline ( void );
+
+#define yyerror ec_error
+void ec_error ( char *s )
+{
+  printf ( "\nParse error at line %d: %s\n", ec_curline(), s );
+}
+
+/************************************************/
+/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
+
+static Express_Schema *mkschema ( char *name, Express_HSequenceOfItem *ilist );
+static Express_HSequenceOfItem *mkilist ( Express_Item *item, Express_HSequenceOfItem *seq );
+static Express_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
+static Express_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
+static Express_Item *mkalias ( char *name, Express_Type *type );
+static Express_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
+                                Express_HSequenceOfField *field, int isabstract );
+static Express_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items);
+static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
+static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1, TColStd_HSequenceOfHAsciiString *tlist2 );
+static Express_Type *mktstd ( int keyword );
+static Express_Type *mktname ( char *name );
+static Express_Type *mktset ( int keyword, int ilow, int ihigh, Express_Type *of );
+static Express_Field *mkfield ( char *name, Express_Type *type, int optional );
+static Express_HSequenceOfField *mkflist ( Express_Field *field, Express_HSequenceOfField *seq );
+
+
+# line 91 "Express.y"
+typedef union
+#ifdef __cplusplus
+       YYSTYPE
+#endif
+ {
+  int num;
+  char *str;
+  TColStd_HSequenceOfHAsciiString *tlist;
+  Express_HSequenceOfField *flist;
+  Express_HSequenceOfItem *ilist;
+  Express_Field *field;
+  Express_Item *item;
+  Express_Type *type;
+  Express_Schema *schema;
+  Express_Reference *ref;
+} YYSTYPE;
+# define KSCHEM 257
+# define KENDS 258
+# define KTYP 259
+# define KENDT 260
+# define KENT 261
+# define KENDE 262
+# define KREF 263
+# define KFROM 264
+# define KSEL 265
+# define KENUM 266
+# define KLIST 267
+# define KARR 268
+# define KBAG 269
+# define KSET 270
+# define KOF 271
+# define KNUM 272
+# define KINT 273
+# define KDBL 274
+# define KSTR 275
+# define KLOG 276
+# define KBOOL 277
+# define KOPT 278
+# define KUNIQ 279
+# define KSELF 280
+# define KABSTR 281
+# define KSUBT 282
+# define KSPRT 283
+# define KANDOR 284
+# define K1OF 285
+# define KAND 286
+# define NUMBER 287
+# define NAME 288
+
+#ifdef __STDC__
+#include <stdlib.h>
+#include <string.h>
+#else
+#include <malloc.h>
+#include <memory.h>
+#endif
+
+#ifdef __cplusplus
+
+#ifndef yyerror
+       void yyerror(const char *);
+#endif
+
+#ifndef yylex
+#ifdef __EXTERN_C__
+       extern "C" { int yylex(void); }
+#else
+       int yylex(void);
+#endif
+#endif
+       int yyparse(void);
+
+#endif
+#define yyclearin yychar = -1
+#define yyerrok yyerrflag = 0
+extern int yychar;
+extern int yyerrflag;
+YYSTYPE yylval;
+YYSTYPE yyval;
+typedef int yytabelem;
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 150
+#endif
+#if YYMAXDEPTH > 0
+int yy_yys[YYMAXDEPTH], *yys = yy_yys;
+YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
+#else  /* user does initial allocation */
+int *yys;
+YYSTYPE *yyv;
+#endif
+static int yymaxdepth = YYMAXDEPTH;
+# define YYERRCODE 256
+
+# line 266 "Express.y"
+
+
+/************************************************/
+/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
+
+static Express_Schema *mkschema ( char *name, Express_HSequenceOfItem *ilist )
+{
+  Express_Schema *sch = new Express_Schema ( name, ilist );
+  Express::Schema() = sch;
+  return sch;
+}
+
+static Express_HSequenceOfItem *mkilist ( Express_Item *item, Express_HSequenceOfItem *seq )
+{
+  if ( ! seq ) { 
+    seq = new Express_HSequenceOfItem;
+    seq->Append ( item );
+  }
+  else seq->Prepend ( item );
+  return seq;
+}
+
+static Express_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
+{
+  return new Express_Enum ( name, tlist );
+}
+
+static Express_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
+{
+  return new Express_Select ( name, tlist );
+}
+
+static Express_Item *mkalias ( char *name, Express_Type *type )
+{
+  return new Express_Alias ( name, type );
+}
+
+static Express_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
+                                Express_HSequenceOfField *field, int isabstract )
+{
+  Express_Entity *ent = new Express_Entity ( name, inherit, field );
+  if ( isabstract ) ent->SetAbstractFlag ( Standard_True );
+  return ent;
+}
+
+static Express_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items)
+{
+  return new Express_Reference ( name, items );
+}
+
+static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
+{
+  Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString ( name );
+  if ( tlist ) tlist->Prepend ( str );
+  else {
+    tlist = new TColStd_HSequenceOfHAsciiString;
+    tlist->Append ( str );
+  }
+  return tlist;
+}
+
+static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1, 
+                                                  TColStd_HSequenceOfHAsciiString *tlist2 )
+{
+  if ( ! tlist1 ) return tlist2;
+  if ( ! tlist2 ) return tlist1;
+  for ( int i=1; i <= tlist2->Length(); i++ )
+    tlist1->Append ( tlist2->Value(i) );
+  return tlist1;
+}
+
+static Express_Type *mktstd ( int keyword )
+{
+  switch ( keyword ) {
+  case KINT : return new Express_Integer;
+  case KNUM : return new Express_Number;
+  case KDBL : return new Express_Real;
+  case KSTR : return new Express_String;
+  case KBOOL: return new Express_Boolean;
+  case KLOG : return new Express_Logical;
+  default   : ec_error ( "Predefined type not treated!", "" );
+              return NULL;
+  }
+}
+
+static Express_Type *mktname ( char *name )
+{
+  return new Express_NamedType ( name );
+}
+
+static Express_Type *mktset ( int keyword, int ilow, int ihigh, Express_Type *of )
+{
+  switch ( keyword ) {
+  case KLIST: return new Express_List  ( ilow, ihigh, of );
+  case KARR : return new Express_Array ( ilow, ihigh, of );
+  case KBAG : return new Express_Bag   ( ilow, ihigh, of );
+  case KSET : return new Express_Set   ( ilow, ihigh, of );
+  default   : ec_error ( "Complex type not treated!", "" );
+              return NULL;
+  }
+}
+
+static Express_Field *mkfield ( char *name, Express_Type *type, int optional )
+{
+  return new Express_Field ( name, type, optional );
+}
+
+static Express_HSequenceOfField *mkflist ( Express_Field *field, Express_HSequenceOfField *seq )
+{
+  if ( seq ) seq->Prepend ( field );
+  else {
+    seq = new Express_HSequenceOfField;
+    seq->Append ( field );
+  }
+  return seq;
+}
+
+/*******************************************************************/
+/* External interface to result of parsing */
+
+Handle(Express_Schema) ec_parse ( FILE *fin )
+{
+  extern FILE *yyin;
+  yyin = fin;
+  yyparse();
+  return Express::Schema();
+}
+
+/*******************************************************************/
+/* MAIN & co */
+
+/*
+void tlistfree ( struct tlist *list )
+{
+  if ( ! list ) return;
+  tlistfree ( list->next );
+  list->next = 0;
+  free ( list->str );
+  list->str = 0;
+}
+* /
+
+int printtlist ( struct ec_tlist *tl )
+{
+  int num=0;
+  while ( tl ) {
+    num++;
+    printf ( "%s\n", tl->name );
+    tl = tl->next;
+  }
+  return num;
+}
+
+int main ( void )
+{
+  int num = 0;
+  yyparse();
+
+  printf ( "\nFinished\n" );
+  if ( schema ) {
+    struct ec_item *it;
+    it = schema->items;
+    printf ( "\nSchema %s", schema->name );
+    printf ( "\nItems:" );
+    while ( it ) {
+      num++;
+      printf ( "\n%s", it->name );
+      it = it->next;
+    }
+//    num = printtlist ( res );
+    printf ( "\nTotal %d", num );
+  }
+
+/*  tlistfree ( yylval.tlist ); * /
+  return num;
+}
+*/
+static const yytabelem yyexca[] ={
+-1, 1,
+       0, -1,
+       -2, 0,
+       };
+# define YYNPROD 67
+# define YYLAST 279
+static const yytabelem yyact[]={
+
+    23,    22,    35,    36,    38,    37,    65,    29,    28,    30,
+    31,    32,    33,    56,   117,   113,   106,    61,    16,    35,
+    36,    38,    37,    34,    29,    28,    30,    31,    32,    33,
+   139,   139,    15,    75,     3,   101,   145,    21,   162,   138,
+    34,    74,    78,    20,    93,    21,    40,   115,   135,   134,
+   133,   132,    52,    43,    42,   131,   110,    11,   158,    12,
+   102,    83,    62,    13,     2,    24,   144,   116,   104,   111,
+    92,    63,   124,   123,   122,   120,   152,    97,    50,    49,
+    48,    47,    70,    71,    18,    54,   153,   150,   149,   143,
+   140,   125,   119,   103,    86,    82,    77,    59,    51,    46,
+    17,     4,   129,   127,    96,    91,    90,    89,    87,   130,
+   163,   160,   151,    85,    60,    79,    39,   121,    84,    88,
+    67,    68,    69,    44,    45,    19,     5,    -1,     1,    72,
+     6,    10,     9,    14,     8,     7,    27,    26,    25,   112,
+    73,   114,    80,    81,     0,     0,    41,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,    94,    95,    53,   105,
+    98,   107,   108,   109,    99,   100,     0,    58,     0,   118,
+     0,     0,     0,     0,     0,     0,    76,     0,     0,     0,
+   128,     0,   126,     0,     0,     0,   137,     0,     0,     0,
+     0,     0,     0,     0,     0,   141,   136,     0,   142,     0,
+   146,   147,   148,     0,     0,     0,     0,     0,     0,     0,
+   154,     0,   155,   156,   157,     0,     0,     0,     0,   161,
+   159,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    64,    66,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    57,     0,
+     0,    55,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    78 };
+static const yytabelem yypact[]={
+
+  -193,-10000000,  -254,    42,  -202,  -195,  -202,-10000000,-10000000,-10000000,
+-10000000,  -256,  -270,    41,-10000000,    23,  -238,-10000000,  -265,  -236,
+  -246,  -217,  -218,    84,    40,-10000000,-10000000,-10000000,-10000000,-10000000,
+-10000000,-10000000,-10000000,-10000000,-10000000,   -10,   -11,   -12,   -13,    39,
+  -219,  -236,   -27,    84,    38,  -271,  -198,   -57,   -57,   -57,
+   -57,  -247,    84,    37,  -242,    71,   -27,   -27,    36,  -199,
+    77,    69,    35,    50,-10000000,-10000000,    79,    49,    48,    47,
+  -235,-10000000,  -247,  -247,    46,   -15,-10000000,  -247,   -27,   -27,
+    -6,-10000000,  -200,    34,-10000000,  -271,-10000000,   -57,  -272,   -57,
+   -57,   -57,  -206,  -273,-10000000,-10000000,  -231,  -274,  -235,-10000000,
+-10000000,-10000000,    33,-10000000,-10000000,   -18,    76,   -19,   -20,   -21,
+    32,-10000000,  -273,    45,  -248,-10000000,    44,    63,  -207,-10000000,
+  -220,-10000000,  -221,  -222,  -223,-10000000,-10000000,  -249,    31,  -248,
+  -274,    30,  -243,  -243,  -243,  -243,    29,    28,    68,   -16,
+-10000000,    27,-10000000,-10000000,  -248,-10000000,  -248,  -248,  -248,-10000000,
+-10000000,  -249,  -274,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,    67,
+  -250,-10000000,    66,  -250 };
+static const yytabelem yypgo[]={
+
+     0,    71,   141,    66,   125,    85,   140,    58,    68,   123,
+   139,    69,    70,   116,    67,    65,   138,   137,   136,   135,
+   134,   132,   131,   130,   126,   129,    83,    82,   128,   127 };
+static const yytabelem yyr1[]={
+
+     0,    28,    24,    24,    23,    23,    23,    23,    19,    20,
+    21,    22,    22,    29,     8,     8,     9,    15,    15,    15,
+    16,    16,    16,    16,    16,    16,    17,    18,    18,    18,
+    18,     1,     1,     1,     3,     3,    13,    13,     4,     4,
+     4,     5,     5,     5,     5,     5,    26,    26,    26,    26,
+    27,    27,    25,     6,    14,    14,     2,     2,    10,    10,
+    11,    11,    12,    12,     7,     7,     7 };
+static const yytabelem yyr2[]={
+
+     0,    13,     3,     5,     2,     2,     2,     3,    19,    17,
+    15,    19,    21,    11,     3,     7,     7,     2,     2,     3,
+     3,     3,     3,     3,     3,     3,     3,    19,    19,    19,
+    19,     3,     3,     9,     1,     3,     1,     7,     1,     3,
+     7,     3,     7,     7,     5,     7,     3,     5,     3,     5,
+     1,     3,    11,    13,     3,     7,     1,     3,     9,     9,
+     3,     5,     1,     5,     7,    11,     7 };
+static const yytabelem yychk[]={
+
+-10000000,   -28,   257,   288,    59,   -24,   -23,   -19,   -20,   -21,
+   -22,   259,   261,   258,   -24,   288,   288,    59,    61,    -4,
+   281,   283,   266,   265,   -15,   -16,   -17,   -18,   273,   272,
+   274,   275,   276,   277,   288,   267,   268,   270,   269,   -13,
+   282,    -4,   271,   271,    -9,    40,    59,    91,    91,    91,
+    91,    59,   271,   -13,    -5,   288,    40,   285,    -9,    59,
+    -8,   288,   260,    -1,   287,    63,   288,    -1,    -1,    -1,
+   -27,   -26,   -25,    -6,   288,   280,    -9,    59,   284,    44,
+    -5,    -5,    59,   260,    41,    44,    59,    58,    40,    58,
+    58,    58,   -12,   279,   -26,   -26,    58,    92,   -27,    -5,
+    -5,    41,   260,    59,    -8,    -1,   288,    -1,    -1,    -1,
+   262,   -11,   -10,   288,    -2,   278,   -14,   288,   -12,    59,
+    93,    41,    93,    93,    93,    59,   -11,    58,   -15,    58,
+    46,   262,   271,   271,   271,   271,    -8,    -7,   288,   280,
+    59,   -15,   -14,    59,    -3,   279,    -3,    -3,    -3,    59,
+    59,    44,    92,    59,   -15,   -15,   -15,   -15,    -7,   -14,
+    44,    -7,   288,    44 };
+static const yytabelem yydef[]={
+
+     0,    -2,     0,     0,     0,     0,     2,     4,     5,     6,
+     7,     0,     0,     0,     3,     0,    38,     1,     0,    36,
+    38,    39,     0,     0,     0,    17,    18,    19,    20,    21,
+    22,    23,    24,    25,    26,     0,     0,     0,     0,     0,
+     0,    36,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,    50,     0,     0,    40,    41,     0,     0,     0,     0,
+     0,    14,     0,     0,    31,    32,     0,     0,     0,     0,
+    62,    51,    46,    48,     0,     0,    37,    50,     0,     0,
+     0,    44,     0,     0,    16,     0,    10,     0,     0,     0,
+     0,     0,     0,     0,    47,    49,    56,     0,    62,    45,
+    43,    42,     0,     9,    15,     0,     0,     0,     0,     0,
+     0,    63,    60,     0,     0,    57,     0,    54,     0,     8,
+     0,    33,     0,     0,     0,    11,    61,     0,     0,     0,
+     0,     0,    34,    34,    34,    34,     0,     0,    14,     0,
+    52,     0,    55,    12,     0,    35,     0,     0,     0,    58,
+    59,     0,     0,    53,    27,    28,    29,    30,    66,    64,
+     0,    65,     0,     0 };
+typedef struct
+#ifdef __cplusplus
+       yytoktype
+#endif
+{ char *t_name; int t_val; } yytoktype;
+#ifndef YYDEBUG
+#      define YYDEBUG  0       /* don't allow debugging */
+#endif
+
+#if YYDEBUG
+
+yytoktype yytoks[] =
+{
+       "KSCHEM",       257,
+       "KENDS",        258,
+       "KTYP", 259,
+       "KENDT",        260,
+       "KENT", 261,
+       "KENDE",        262,
+       "KREF", 263,
+       "KFROM",        264,
+       "KSEL", 265,
+       "KENUM",        266,
+       "KLIST",        267,
+       "KARR", 268,
+       "KBAG", 269,
+       "KSET", 270,
+       "KOF",  271,
+       "KNUM", 272,
+       "KINT", 273,
+       "KDBL", 274,
+       "KSTR", 275,
+       "KLOG", 276,
+       "KBOOL",        277,
+       "KOPT", 278,
+       "KUNIQ",        279,
+       "KSELF",        280,
+       "KABSTR",       281,
+       "KSUBT",        282,
+       "KSPRT",        283,
+       "KANDOR",       284,
+       "K1OF", 285,
+       "KAND", 286,
+       "NUMBER",       287,
+       "NAME", 288,
+       ",",    44,
+       "-unknown-",    -1      /* ends search */
+};
+
+char * yyreds[] =
+{
+       "-no such reduction-",
+       "SCHEMA : KSCHEM NAME ';' ILIST KENDS ';'",
+       "ILIST : ITEM",
+       "ILIST : ITEM ILIST",
+       "ITEM : ENUM",
+       "ITEM : SELECT",
+       "ITEM : ALIAS",
+       "ITEM : ENTITY",
+       "ENUM : KTYP NAME '=' KENUM KOF TLIST1 ';' KENDT ';'",
+       "SELECT : KTYP NAME '=' KSEL TLIST1 ';' KENDT ';'",
+       "ALIAS : KTYP NAME '=' TYPE ';' KENDT ';'",
+       "ENTITY : KENT NAME SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';'",
+       "ENTITY : KENT NAME KABSTR SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';'",
+       "REFERENCE : KREF KFROM NAME TLIST1 ';'",
+       "TLIST : NAME",
+       "TLIST : NAME ',' TLIST",
+       "TLIST1 : '(' TLIST ')'",
+       "TYPE : TSTD",
+       "TYPE : TNAME",
+       "TYPE : TSET",
+       "TSTD : KINT",
+       "TSTD : KNUM",
+       "TSTD : KDBL",
+       "TSTD : KSTR",
+       "TSTD : KLOG",
+       "TSTD : KBOOL",
+       "TNAME : NAME",
+       "TSET : KLIST '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE",
+       "TSET : KARR '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE",
+       "TSET : KSET '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE",
+       "TSET : KBAG '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE",
+       "INDEX : NUMBER",
+       "INDEX : '?'",
+       "INDEX : NAME '(' NAME ')'",
+       "OPTUNI : /* empty */",
+       "OPTUNI : KUNIQ",
+       "SUBT : /* empty */",
+       "SUBT : KSUBT KOF TLIST1",
+       "SUPERT : /* empty */",
+       "SUPERT : KSPRT",
+       "SUPERT : KSPRT KOF SUPLST",
+       "SUPLST : NAME",
+       "SUPLST : '(' SUPLST ')'",
+       "SUPLST : NAME ',' SUPLST",
+       "SUPLST : K1OF SUPLST",
+       "SUPLST : SUPLST KANDOR SUPLST",
+       "FLIST : FIELD",
+       "FLIST : FIELD FLIST",
+       "FLIST : REDEF",
+       "FLIST : REDEF FLIST",
+       "FLIST1 : /* empty */",
+       "FLIST1 : FLIST",
+       "FIELD : NAME ':' OPTNL TYPE ';'",
+       "REDEF : KSELF '\\' SPECIF ':' TYPE ';'",
+       "SPECIF : NAME",
+       "SPECIF : NAME '.' SPECIF",
+       "OPTNL : /* empty */",
+       "OPTNL : KOPT",
+       "UNIQIT : NAME ':' TLIST ';'",
+       "UNIQIT : NAME ':' SPCLST ';'",
+       "UNIQLS : UNIQIT",
+       "UNIQLS : UNIQIT UNIQLS",
+       "UNIQUE : /* empty */",
+       "UNIQUE : KUNIQ UNIQLS",
+       "SPCLST : KSELF '\\' SPECIF",
+       "SPCLST : KSELF '\\' SPECIF ',' SPCLST",
+       "SPCLST : NAME ',' SPCLST",
+};
+#endif /* YYDEBUG */
+# line 1 "/usr/ccs/bin/yaccpar"
+/*
+ * Copyright (c) 1993 by Sun Microsystems, Inc.
+ */
+
+#pragma ident  "@(#)yaccpar    6.14    97/01/16 SMI"
+
+/*
+** Skeleton parser driver for yacc output
+*/
+
+/*
+** yacc user known macros and defines
+*/
+#define YYERROR                goto yyerrlab
+#define YYACCEPT       return(0)
+#define YYABORT                return(1)
+#define YYBACKUP( newtoken, newvalue )\
+{\
+       if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
+       {\
+               yyerror( "syntax error - cannot backup" );\
+               goto yyerrlab;\
+       }\
+       yychar = newtoken;\
+       yystate = *yyps;\
+       yylval = newvalue;\
+       goto yynewstate;\
+}
+#define YYRECOVERING() (!!yyerrflag)
+#define YYNEW(type)    malloc(sizeof(type) * yynewmax)
+#define YYCOPY(to, from, type) \
+       (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type))
+#define YYENLARGE( from, type) \
+       (type *) realloc((char *) from, yynewmax * sizeof(type))
+#ifndef YYDEBUG
+#      define YYDEBUG  1       /* make debugging available */
+#endif
+
+/*
+** user known globals
+*/
+int yydebug;                   /* set to 1 to get debugging */
+
+/*
+** driver internal defines
+*/
+#define YYFLAG         (-10000000)
+
+/*
+** global variables used by the parser
+*/
+YYSTYPE *yypv;                 /* top of value stack */
+int *yyps;                     /* top of state stack */
+
+int yystate;                   /* current state */
+int yytmp;                     /* extra var (lasts between blocks) */
+
+int yynerrs;                   /* number of errors */
+int yyerrflag;                 /* error recovery flag */
+int yychar;                    /* current input token number */
+
+
+
+#ifdef YYNMBCHARS
+#define YYLEX()                yycvtok(yylex())
+/*
+** yycvtok - return a token if i is a wchar_t value that exceeds 255.
+**     If i<255, i itself is the token.  If i>255 but the neither 
+**     of the 30th or 31st bit is on, i is already a token.
+*/
+#if defined(__STDC__) || defined(__cplusplus)
+int yycvtok(int i)
+#else
+int yycvtok(i) int i;
+#endif
+{
+       int first = 0;
+       int last = YYNMBCHARS - 1;
+       int mid;
+       wchar_t j;
+
+       if(i&0x60000000){/*Must convert to a token. */
+               if( yymbchars[last].character < i ){
+                       return i;/*Giving up*/
+               }
+               while ((last>=first)&&(first>=0)) {/*Binary search loop*/
+                       mid = (first+last)/2;
+                       j = yymbchars[mid].character;
+                       if( j==i ){/*Found*/ 
+                               return yymbchars[mid].tvalue;
+                       }else if( j<i ){
+                               first = mid + 1;
+                       }else{
+                               last = mid -1;
+                       }
+               }
+               /*No entry in the table.*/
+               return i;/* Giving up.*/
+       }else{/* i is already a token. */
+               return i;
+       }
+}
+#else/*!YYNMBCHARS*/
+#define YYLEX()                yylex()
+#endif/*!YYNMBCHARS*/
+
+/*
+** yyparse - return 0 if worked, 1 if syntax error not recovered from
+*/
+#if defined(__STDC__) || defined(__cplusplus)
+int yyparse(void)
+#else
+int yyparse()
+#endif
+{
+       register YYSTYPE *yypvt = 0;    /* top of value stack for $vars */
+
+#if defined(__cplusplus) || defined(lint)
+/*
+       hacks to please C++ and lint - goto's inside
+       switch should never be executed
+*/
+       static int __yaccpar_lint_hack__ = 0;
+       switch (__yaccpar_lint_hack__)
+       {
+               case 1: goto yyerrlab;
+               case 2: goto yynewstate;
+       }
+#endif
+
+       /*
+       ** Initialize externals - yyparse may be called more than once
+       */
+       yypv = &yyv[-1];
+       yyps = &yys[-1];
+       yystate = 0;
+       yytmp = 0;
+       yynerrs = 0;
+       yyerrflag = 0;
+       yychar = -1;
+
+#if YYMAXDEPTH <= 0
+       if (yymaxdepth <= 0)
+       {
+               if ((yymaxdepth = YYEXPAND(0)) <= 0)
+               {
+                       yyerror("yacc initialization error");
+                       YYABORT;
+               }
+       }
+#endif
+
+       {
+               register YYSTYPE *yy_pv;        /* top of value stack */
+               register int *yy_ps;            /* top of state stack */
+               register int yy_state;          /* current state */
+               register int  yy_n;             /* internal state number info */
+       goto yystack;   /* moved from 6 lines above to here to please C++ */
+
+               /*
+               ** get globals into registers.
+               ** branch to here only if YYBACKUP was called.
+               */
+       yynewstate:
+               yy_pv = yypv;
+               yy_ps = yyps;
+               yy_state = yystate;
+               goto yy_newstate;
+
+               /*
+               ** get globals into registers.
+               ** either we just started, or we just finished a reduction
+               */
+       yystack:
+               yy_pv = yypv;
+               yy_ps = yyps;
+               yy_state = yystate;
+
+               /*
+               ** top of for (;;) loop while no reductions done
+               */
+       yy_stack:
+               /*
+               ** put a state and value onto the stacks
+               */
+#if YYDEBUG
+               /*
+               ** if debugging, look up token value in list of value vs.
+               ** name pairs.  0 and negative (-1) are special values.
+               ** Note: linear search is used since time is not a real
+               ** consideration while debugging.
+               */
+               if ( yydebug )
+               {
+                       register int yy_i;
+
+                       printf( "State %d, token ", yy_state );
+                       if ( yychar == 0 )
+                               printf( "end-of-file\n" );
+                       else if ( yychar < 0 )
+                               printf( "-none-\n" );
+                       else
+                       {
+                               for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+                                       yy_i++ )
+                               {
+                                       if ( yytoks[yy_i].t_val == yychar )
+                                               break;
+                               }
+                               printf( "%s\n", yytoks[yy_i].t_name );
+                       }
+               }
+#endif /* YYDEBUG */
+               if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
+               {
+                       /*
+                       ** reallocate and recover.  Note that pointers
+                       ** have to be reset, or bad things will happen
+                       */
+                       int yyps_index = (yy_ps - yys);
+                       int yypv_index = (yy_pv - yyv);
+                       int yypvt_index = (yypvt - yyv);
+                       int yynewmax;
+#ifdef YYEXPAND
+                       yynewmax = YYEXPAND(yymaxdepth);
+#else
+                       yynewmax = 2 * yymaxdepth;      /* double table size */
+                       if (yymaxdepth == YYMAXDEPTH)   /* first time growth */
+                       {
+                               char *newyys = (char *)YYNEW(int);
+                               char *newyyv = (char *)YYNEW(YYSTYPE);
+                               if (newyys != 0 && newyyv != 0)
+                               {
+                                       yys = YYCOPY(newyys, yys, int);
+                                       yyv = YYCOPY(newyyv, yyv, YYSTYPE);
+                               }
+                               else
+                                       yynewmax = 0;   /* failed */
+                       }
+                       else                            /* not first time */
+                       {
+                               yys = YYENLARGE(yys, int);
+                               yyv = YYENLARGE(yyv, YYSTYPE);
+                               if (yys == 0 || yyv == 0)
+                                       yynewmax = 0;   /* failed */
+                       }
+#endif
+                       if (yynewmax <= yymaxdepth)     /* tables not expanded */
+                       {
+                               yyerror( "yacc stack overflow" );
+                               YYABORT;
+                       }
+                       yymaxdepth = yynewmax;
+
+                       yy_ps = yys + yyps_index;
+                       yy_pv = yyv + yypv_index;
+                       yypvt = yyv + yypvt_index;
+               }
+               *yy_ps = yy_state;
+               *++yy_pv = yyval;
+
+               /*
+               ** we have a new state - find out what to do
+               */
+       yy_newstate:
+               if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
+                       goto yydefault;         /* simple state */
+#if YYDEBUG
+               /*
+               ** if debugging, need to mark whether new token grabbed
+               */
+               yytmp = yychar < 0;
+#endif
+               if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
+                       yychar = 0;             /* reached EOF */
+#if YYDEBUG
+               if ( yydebug && yytmp )
+               {
+                       register int yy_i;
+
+                       printf( "Received token " );
+                       if ( yychar == 0 )
+                               printf( "end-of-file\n" );
+                       else if ( yychar < 0 )
+                               printf( "-none-\n" );
+                       else
+                       {
+                               for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
+                                       yy_i++ )
+                               {
+                                       if ( yytoks[yy_i].t_val == yychar )
+                                               break;
+                               }
+                               printf( "%s\n", yytoks[yy_i].t_name );
+                       }
+               }
+#endif /* YYDEBUG */
+               if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
+                       goto yydefault;
+               if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )  /*valid shift*/
+               {
+                       yychar = -1;
+                       yyval = yylval;
+                       yy_state = yy_n;
+                       if ( yyerrflag > 0 )
+                               yyerrflag--;
+                       goto yy_stack;
+               }
+
+       yydefault:
+               if ( ( yy_n = yydef[ yy_state ] ) == -2 )
+               {
+#if YYDEBUG
+                       yytmp = yychar < 0;
+#endif
+                       if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
+                               yychar = 0;             /* reached EOF */
+#if YYDEBUG
+                       if ( yydebug && yytmp )
+                       {
+                               register int yy_i;
+
+                               printf( "Received token " );
+                               if ( yychar == 0 )
+                                       printf( "end-of-file\n" );
+                               else if ( yychar < 0 )
+                                       printf( "-none-\n" );
+                               else
+                               {
+                                       for ( yy_i = 0;
+                                               yytoks[yy_i].t_val >= 0;
+                                               yy_i++ )
+                                       {
+                                               if ( yytoks[yy_i].t_val
+                                                       == yychar )
+                                               {
+                                                       break;
+                                               }
+                                       }
+                                       printf( "%s\n", yytoks[yy_i].t_name );
+                               }
+                       }
+#endif /* YYDEBUG */
+                       /*
+                       ** look through exception table
+                       */
+                       {
+                               register const int *yyxi = yyexca;
+
+                               while ( ( *yyxi != -1 ) ||
+                                       ( yyxi[1] != yy_state ) )
+                               {
+                                       yyxi += 2;
+                               }
+                               while ( ( *(yyxi += 2) >= 0 ) &&
+                                       ( *yyxi != yychar ) )
+                                       ;
+                               if ( ( yy_n = yyxi[1] ) < 0 )
+                                       YYACCEPT;
+                       }
+               }
+
+               /*
+               ** check for syntax error
+               */
+               if ( yy_n == 0 )        /* have an error */
+               {
+                       /* no worry about speed here! */
+                       switch ( yyerrflag )
+                       {
+                       case 0:         /* new error */
+                               yyerror( "syntax error" );
+                               goto skip_init;
+                       yyerrlab:
+                               /*
+                               ** get globals into registers.
+                               ** we have a user generated syntax type error
+                               */
+                               yy_pv = yypv;
+                               yy_ps = yyps;
+                               yy_state = yystate;
+                       skip_init:
+                               yynerrs++;
+                               /* FALLTHRU */
+                       case 1:
+                       case 2:         /* incompletely recovered error */
+                                       /* try again... */
+                               yyerrflag = 3;
+                               /*
+                               ** find state where "error" is a legal
+                               ** shift action
+                               */
+                               while ( yy_ps >= yys )
+                               {
+                                       yy_n = yypact[ *yy_ps ] + YYERRCODE;
+                                       if ( yy_n >= 0 && yy_n < YYLAST &&
+                                               yychk[yyact[yy_n]] == YYERRCODE)                                        {
+                                               /*
+                                               ** simulate shift of "error"
+                                               */
+                                               yy_state = yyact[ yy_n ];
+                                               goto yy_stack;
+                                       }
+                                       /*
+                                       ** current state has no shift on
+                                       ** "error", pop stack
+                                       */
+#if YYDEBUG
+#      define _POP_ "Error recovery pops state %d, uncovers state %d\n"
+                                       if ( yydebug )
+                                               printf( _POP_, *yy_ps,
+                                                       yy_ps[-1] );
+#      undef _POP_
+#endif
+                                       yy_ps--;
+                                       yy_pv--;
+                               }
+                               /*
+                               ** there is no state on stack with "error" as
+                               ** a valid shift.  give up.
+                               */
+                               YYABORT;
+                       case 3:         /* no shift yet; eat a token */
+#if YYDEBUG
+                               /*
+                               ** if debugging, look up token in list of
+                               ** pairs.  0 and negative shouldn't occur,
+                               ** but since timing doesn't matter when
+                               ** debugging, it doesn't hurt to leave the
+                               ** tests here.
+                               */
+                               if ( yydebug )
+                               {
+                                       register int yy_i;
+
+                                       printf( "Error recovery discards " );
+                                       if ( yychar == 0 )
+                                               printf( "token end-of-file\n" );
+                                       else if ( yychar < 0 )
+                                               printf( "token -none-\n" );
+                                       else
+                                       {
+                                               for ( yy_i = 0;
+                                                       yytoks[yy_i].t_val >= 0;
+                                                       yy_i++ )
+                                               {
+                                                       if ( yytoks[yy_i].t_val
+                                                               == yychar )
+                                                       {
+                                                               break;
+                                                       }
+                                               }
+                                               printf( "token %s\n",
+                                                       yytoks[yy_i].t_name );
+                                       }
+                               }
+#endif /* YYDEBUG */
+                               if ( yychar == 0 )      /* reached EOF. quit */
+                                       YYABORT;
+                               yychar = -1;
+                               goto yy_newstate;
+                       }
+               }/* end if ( yy_n == 0 ) */
+               /*
+               ** reduction by production yy_n
+               ** put stack tops, etc. so things right after switch
+               */
+#if YYDEBUG
+               /*
+               ** if debugging, print the string that is the user's
+               ** specification of the reduction which is just about
+               ** to be done.
+               */
+               if ( yydebug )
+                       printf( "Reduce by (%d) \"%s\"\n",
+                               yy_n, yyreds[ yy_n ] );
+#endif
+               yytmp = yy_n;                   /* value to switch over */
+               yypvt = yy_pv;                  /* $vars top of value stack */
+               /*
+               ** Look in goto table for next state
+               ** Sorry about using yy_state here as temporary
+               ** register variable, but why not, if it works...
+               ** If yyr2[ yy_n ] doesn't have the low order bit
+               ** set, then there is no action to be done for
+               ** this reduction.  So, no saving & unsaving of
+               ** registers done.  The only difference between the
+               ** code just after the if and the body of the if is
+               ** the goto yy_stack in the body.  This way the test
+               ** can be made before the choice of what to do is needed.
+               */
+               {
+                       /* length of production doubled with extra bit */
+                       register int yy_len = yyr2[ yy_n ];
+
+                       if ( !( yy_len & 01 ) )
+                       {
+                               yy_len >>= 1;
+                               yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
+                               yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+                                       *( yy_ps -= yy_len ) + 1;
+                               if ( yy_state >= YYLAST ||
+                                       yychk[ yy_state =
+                                       yyact[ yy_state ] ] != -yy_n )
+                               {
+                                       yy_state = yyact[ yypgo[ yy_n ] ];
+                               }
+                               goto yy_stack;
+                       }
+                       yy_len >>= 1;
+                       yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
+                       yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
+                               *( yy_ps -= yy_len ) + 1;
+                       if ( yy_state >= YYLAST ||
+                               yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
+                       {
+                               yy_state = yyact[ yypgo[ yy_n ] ];
+                       }
+               }
+                                       /* save until reenter driver code */
+               yystate = yy_state;
+               yyps = yy_ps;
+               yypv = yy_pv;
+       }
+       /*
+       ** code supplied by user is placed in this switch
+       */
+       switch( yytmp )
+       {
+               
+case 1:
+# line 164 "Express.y"
+{ yyval.schema = mkschema ( yypvt[-4].str, yypvt[-2].ilist ); /* Root: EXPRESS schema */ } break;
+case 2:
+# line 166 "Express.y"
+{ yyval.ilist = mkilist ( yypvt[-0].item, 0 ); /* list of items for schema */ } break;
+case 3:
+# line 167 "Express.y"
+{ yyval.ilist = mkilist ( yypvt[-1].item, yypvt[-0].ilist ); } break;
+case 7:
+# line 173 "Express.y"
+{ yyval.item = yypvt[-0].item; /* item of schema (type definition) */ } break;
+case 8:
+# line 174 "Express.y"
+{ yyval.item = mkenum ( yypvt[-7].str, yypvt[-3].tlist ); /* TYPE ENUMERATION definition */ } break;
+case 9:
+# line 176 "Express.y"
+{ yyval.item = mkselect ( yypvt[-6].str, yypvt[-3].tlist ); /* TYPE SELECT definition */ } break;
+case 10:
+# line 178 "Express.y"
+{ yyval.item = mkalias ( yypvt[-5].str, yypvt[-3].type ); /* TYPE '=' definition (alias) */ } break;
+case 11:
+# line 180 "Express.y"
+{ yyval.item = mkentity ( yypvt[-7].str, yypvt[-5].tlist, yypvt[-3].flist, 0 ); /* ENTITY definition */ } break;
+case 12:
+# line 181 "Express.y"
+{ yyval.item = mkentity ( yypvt[-8].str, yypvt[-5].tlist, yypvt[-3].flist, 1 ); /* ENTITY definition */ } break;
+case 13:
+# line 184 "Express.y"
+{ yyval.ref = mkrefs ( yypvt[-2].str, yypvt[-1].tlist ); /* REFERENCE FROM definition */ } break;
+case 14:
+# line 186 "Express.y"
+{ yyval.tlist = mktlist ( yypvt[-0].str, 0 ); /* list of (type) names */ } break;
+case 15:
+# line 187 "Express.y"
+{ yyval.tlist = mktlist ( yypvt[-2].str, yypvt[-0].tlist ); } break;
+case 16:
+# line 189 "Express.y"
+{ yyval.tlist = yypvt[-1].tlist; /* TLIST in brackets */ } break;
+case 19:
+# line 194 "Express.y"
+{ yyval.type = yypvt[-0].type; /* type, simple or complex */ } break;
+case 20:
+# line 196 "Express.y"
+{ yyval.type = mktstd ( yypvt[-0].num ); /* predefined type: INTEGER */ } break;
+case 21:
+# line 197 "Express.y"
+{ yyval.type = mktstd ( yypvt[-0].num ); /* predefined type: NUMBER */ } break;
+case 22:
+# line 198 "Express.y"
+{ yyval.type = mktstd ( yypvt[-0].num ); /* predefined type: REAL */ } break;
+case 23:
+# line 199 "Express.y"
+{ yyval.type = mktstd ( yypvt[-0].num ); /* predefined type: STRING */ } break;
+case 24:
+# line 200 "Express.y"
+{ yyval.type = mktstd ( yypvt[-0].num ); /* predefined type: LOGICAL */ } break;
+case 25:
+# line 201 "Express.y"
+{ yyval.type = mktstd ( yypvt[-0].num ); /* predefined type: BOOLEAN */ } break;
+case 26:
+# line 203 "Express.y"
+{ yyval.type = mktname ( yypvt[-0].str ); /* named type */ } break;
+case 27:
+# line 205 "Express.y"
+{ yyval.type = mktset ( yypvt[-8].num, yypvt[-6].num, yypvt[-4].num, yypvt[-0].type ); /* complex type: LIST */ } break;
+case 28:
+# line 206 "Express.y"
+{ yyval.type = mktset ( yypvt[-8].num, yypvt[-6].num, yypvt[-4].num, yypvt[-0].type ); /* complex type: ARRAY */ } break;
+case 29:
+# line 207 "Express.y"
+{ yyval.type = mktset ( yypvt[-8].num, yypvt[-6].num, yypvt[-4].num, yypvt[-0].type ); /* complex type: SET */ } break;
+case 30:
+# line 208 "Express.y"
+{ yyval.type = mktset ( yypvt[-8].num, yypvt[-6].num, yypvt[-4].num, yypvt[-0].type ); /* complex type: BAG */ } break;
+case 31:
+# line 210 "Express.y"
+{ yyval.num = yypvt[-0].num; /* index for array, set, bag, list range */ } break;
+case 32:
+# line 211 "Express.y"
+{ yyval.num = -1; /* undefined */ } break;
+case 33:
+# line 212 "Express.y"
+{yyval.num = -1; printf ( "Warning at line %d: index function %s(%s) ignored\n", ec_curline(), yypvt[-3].str, yypvt[-1].str ); /* some function.. */ } break;
+case 34:
+# line 214 "Express.y"
+{ yyval.num = 0; /* UNIQUE keyword for complex type definition */ } break;
+case 35:
+# line 215 "Express.y"
+{ yyval.num = 1; } break;
+case 36:
+# line 218 "Express.y"
+{ yyval.tlist = NULL; /* no subtype clause */ } break;
+case 37:
+# line 219 "Express.y"
+{ yyval.tlist = yypvt[-0].tlist;   /* subtype clause */ } break;
+case 38:
+# line 221 "Express.y"
+{ yyval.num = 0;  /* no supertype clause */ } break;
+case 39:
+# line 222 "Express.y"
+{ yyval.num = 0;  /* supertype clause (ignored) */ } break;
+case 40:
+# line 223 "Express.y"
+{ yyval.num = 0;  /* supertype clause (ignored) */ } break;
+case 41:
+# line 225 "Express.y"
+{ yyval.num = 0; /* simple list of supertypes */ } break;
+case 42:
+# line 226 "Express.y"
+{ yyval.num = 0; /* allow bracketing */ } break;
+case 43:
+# line 227 "Express.y"
+{ yyval.num = 0; /* ... */ } break;
+case 44:
+# line 228 "Express.y"
+{ yyval.num = 0; /* ONEOF construct */ } break;
+case 45:
+# line 229 "Express.y"
+{ yyval.num = 0; /* ANDOR construct */ } break;
+case 46:
+# line 232 "Express.y"
+{ yyval.flist = mkflist ( yypvt[-0].field, 0 ); /* list of fields of ENTITY item */ } break;
+case 47:
+# line 233 "Express.y"
+{ yyval.flist = mkflist ( yypvt[-1].field, yypvt[-0].flist ); } break;
+case 48:
+# line 234 "Express.y"
+{ yyval.flist = 0;  /* redefinition of inherited field, just skip */ } break;
+case 49:
+# line 235 "Express.y"
+{ yyval.flist = 0; } break;
+case 50:
+# line 237 "Express.y"
+{ yyval.flist = NULL; /* empty list of fields */ } break;
+case 51:
+# line 238 "Express.y"
+{ yyval.flist = yypvt[-0].flist;   /* or not empty.. just to fix reduce/reduce conflict */ } break;
+case 52:
+# line 240 "Express.y"
+{ yyval.field = mkfield ( yypvt[-4].str, yypvt[-1].type, yypvt[-2].num ); } break;
+case 53:
+# line 242 "Express.y"
+{ yyval.num = NULL; printf ( "Warning at line %d: field redefinition ignored\n", ec_curline() ); /* redefinition of inherited field */ } break;
+case 54:
+# line 244 "Express.y"
+{ yyval.tlist = mktlist ( yypvt[-0].str, 0 ); /* inherited field specification */ } break;
+case 55:
+# line 245 "Express.y"
+{ yyval.tlist = mktlist ( yypvt[-2].str, yypvt[-0].tlist ); } break;
+case 56:
+# line 248 "Express.y"
+{ yyval.num = 0; } break;
+case 57:
+# line 249 "Express.y"
+{ yyval.num = 1; } break;
+case 58:
+# line 252 "Express.y"
+{ yyval.tlist = yypvt[-1].tlist;   /* UNIQUE statement */ } break;
+case 59:
+# line 253 "Express.y"
+{ yyval.tlist = NULL; /* UNIQUE statement */ } break;
+case 60:
+# line 255 "Express.y"
+{ yyval.tlist = NULL;    /* list of 1 UNIQUE statements */ } break;
+case 61:
+# line 256 "Express.y"
+{ yyval.tlist = mktlists ( yypvt[-1].tlist, yypvt[-0].tlist );/* list of UNIQUE statements */ } break;
+case 62:
+# line 258 "Express.y"
+{ yyval.tlist = NULL;    /* no UNIQUE clause in ENTITY */ } break;
+case 63:
+# line 259 "Express.y"
+{ yyval.tlist = yypvt[-0].tlist;      /* UNIQUE clause in ENTITY */ } break;
+case 64:
+# line 261 "Express.y"
+{ yyval.num = 0; /* list of specifications */ } break;
+case 65:
+# line 262 "Express.y"
+{ yyval.num = 0; } break;
+case 66:
+# line 263 "Express.y"
+{ yyval.num = 0; } break;
+# line 531 "/usr/ccs/bin/yaccpar"
+       }
+       goto yystack;           /* reset registers in driver code */
+}
+
diff --git a/src/ExpToCasExe/expparse.h b/src/ExpToCasExe/expparse.h
new file mode 100644 (file)
index 0000000..e6cd7d6
--- /dev/null
@@ -0,0 +1,50 @@
+
+typedef union
+#ifdef __cplusplus
+       YYSTYPE
+#endif
+ {
+  int num;
+  char *str;
+  TColStd_HSequenceOfHAsciiString *tlist;
+  Express_HSequenceOfField *flist;
+  Express_HSequenceOfItem *ilist;
+  Express_Field *field;
+  Express_Item *item;
+  Express_Type *type;
+  Express_Schema *schema;
+  Express_Reference *ref;
+} YYSTYPE;
+extern YYSTYPE yylval;
+# define KSCHEM 257
+# define KENDS 258
+# define KTYP 259
+# define KENDT 260
+# define KENT 261
+# define KENDE 262
+# define KREF 263
+# define KFROM 264
+# define KSEL 265
+# define KENUM 266
+# define KLIST 267
+# define KARR 268
+# define KBAG 269
+# define KSET 270
+# define KOF 271
+# define KNUM 272
+# define KINT 273
+# define KDBL 274
+# define KSTR 275
+# define KLOG 276
+# define KBOOL 277
+# define KOPT 278
+# define KUNIQ 279
+# define KSELF 280
+# define KABSTR 281
+# define KSUBT 282
+# define KSPRT 283
+# define KANDOR 284
+# define K1OF 285
+# define KAND 286
+# define NUMBER 287
+# define NAME 288
diff --git a/src/ExpToCasExe/expscan.cxx b/src/ExpToCasExe/expscan.cxx
new file mode 100644 (file)
index 0000000..3bcb1b9
--- /dev/null
@@ -0,0 +1,2912 @@
+#include <stdio.h>
+#include <stdlib.h>
+# define U(x) x
+# define NLSTATE yyprevious=YYNEWLINE
+# define BEGIN yybgin = yysvec + 1 +
+# define INITIAL 0
+# define YYLERR yysvec
+# define YYSTATE (yyestate-yysvec-1)
+# define YYOPTIM 1
+# ifndef YYLMAX 
+# define YYLMAX BUFSIZ
+# endif 
+#ifndef __cplusplus
+# define output(c) (void)putc(c,yyout)
+#else
+# define lex_output(c) (void)putc(c,yyout)
+#endif
+
+#if defined(__cplusplus) || defined(__STDC__)
+
+#if defined(__cplusplus) && defined(__EXTERN_C__)
+extern "C" {
+#endif
+       int yyback(int *, int);
+       int yyinput(void);
+       int yylook(void);
+       void yyoutput(int);
+       int yyracc(int);
+       int yyreject(void);
+       void yyunput(int);
+       int yylex(void);
+#ifdef YYLEX_E
+       void yywoutput(wchar_t);
+       wchar_t yywinput(void);
+#endif
+#ifndef yyless
+       int yyless(int);
+#endif
+#ifndef yywrap
+       int yywrap(void);
+#endif
+#ifdef LEXDEBUG
+       void allprint(char);
+       void sprint(char *);
+#endif
+#if defined(__cplusplus) && defined(__EXTERN_C__)
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+//     void exit(int);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
+# define yymore() (yymorfg=1)
+#ifndef __cplusplus
+# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+#else
+# define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+#endif
+#define ECHO fprintf(yyout, "%s",yytext)
+# define REJECT { nstr = yyreject(); goto yyfussy;}
+int yyleng;
+#define YYISARRAY
+char yytext[YYLMAX];
+int yymorfg;
+extern char *yysptr, yysbuf[];
+int yytchar;
+FILE *yyin = {stdin}, *yyout = {stdout};
+extern int yylineno;
+struct yysvf { 
+       struct yywork *yystoff;
+       struct yysvf *yyother;
+       int *yystops;};
+struct yysvf *yyestate;
+extern struct yysvf yysvec[], *yybgin;
+
+
+# line 4 "exptocas.l"
+/* File:       exptocas.l                     */
+
+# line 5 "exptocas.l"
+/* Created:    Thu Oct 28 12:21:16 1999       */
+
+# line 6 "exptocas.l"
+/* Author:     Andrey BETENEV                 */
+
+# line 7 "exptocas.l"
+/*             <abv@doomox.nnov.matra-dtv.fr> */
+
+# line 8 "exptocas.l"
+/* Copyright:  Matra Datavision 1999          */
+
+
+# line 10 "exptocas.l"
+/*****************************************************************************\
+
+This LEX scanner is performs lexical analysis of EXPRESS schema file   
+for EXPRESS -> CASCADE/XSTEP classes generator                             
+
+On the stage of lexical scanner comments (single- and multi-line),         
+definitions of CONSTANT, FUNCTION, RULE items and clauses WHERE, INVERSE
+and DERIVE of TYPE amd ENTITY items are dismissed (ignored)         
+
+Then, keywords such as ENTITY, SUPERTYPE, SET etc., names of items         
+and special symbols are identified and returned to parser (yacc) as tokens 
+
+Also, error processing and current line number tracking functions are defined
+
+\*****************************************************************************/
+
+
+# line 26 "exptocas.l"
+/************************************/
+
+# line 27 "exptocas.l"
+/* Section 1                        */
+
+# line 28 "exptocas.l"
+/* definitions                      */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <Express_HSequenceOfField.hxx>
+#include <Express_HSequenceOfItem.hxx>
+#include <Express_Field.hxx>
+#include <Express_Item.hxx>
+#include <Express_Type.hxx>
+#include <Express_Schema.hxx>
+#include <Express_Reference.hxx>
+
+#include "expparse.h"       /* define tokens */
+
+
+# line 44 "exptocas.l"
+/* Auxiliary functions */
+
+static int fun_level=0;
+static int ec_linenum=1;
+static int ec_state = 0;
+
+int yywrap(void) { return 1; }
+
+int ec_curline ( void )
+{
+  return ec_linenum;
+}
+
+int ec_error ( char *s, char *text )
+{
+  printf ( "\nError at line %d: %s \"%s\"\n", ec_curline(), s, text );
+  return 0;
+}
+
+# define TYP 2
+# define ENT 4
+# define COMM 6
+# define SKP 8
+# define RULE 10
+# define FUN 12
+
+
+# line 73 "exptocas.l"
+/************************************/
+
+# line 74 "exptocas.l"
+/* Section 2                        */
+
+# line 75 "exptocas.l"
+/* parsing rules                    */
+# define YYNEWLINE 10
+int yylex(){
+int nstr; extern int yyprevious;
+#ifdef __cplusplus
+/* to avoid CC and lint complaining yyfussy not being used ...*/
+static int __lex_hack = 0;
+if (__lex_hack) goto yyfussy;
+#endif
+while((nstr = yylook()) >= 0)
+yyfussy: switch(nstr){
+case 0:
+if(yywrap()) return(0); break;
+case 1:
+
+# line 79 "exptocas.l"
+              { /* Eat line comments */ }
+break;
+case 2:
+
+# line 80 "exptocas.l"
+                { ec_state = YYSTATE; BEGIN(COMM); }
+break;
+case 3:
+
+# line 81 "exptocas.l"
+             { /* Eat multiline comments */ }
+break;
+case 4:
+
+# line 82 "exptocas.l"
+          { BEGIN(ec_state); }
+break;
+case 5:
+
+# line 84 "exptocas.l"
+            { return yylval.num = KSCHEM; }
+break;
+case 6:
+
+# line 85 "exptocas.l"
+        { return yylval.num = KENDS; }
+break;
+case 7:
+
+# line 87 "exptocas.l"
+              { BEGIN(TYP); return yylval.num = KTYP; }
+break;
+case 8:
+
+# line 88 "exptocas.l"
+ { BEGIN(0);   return yylval.num = KENDT; }
+break;
+case 9:
+
+# line 90 "exptocas.l"
+            { BEGIN(ENT); return yylval.num = KENT; }
+break;
+case 10:
+
+# line 91 "exptocas.l"
+{ BEGIN(0);  return yylval.num = KENDE; }
+break;
+case 11:
+
+# line 93 "exptocas.l"
+      case 12:
+
+# line 94 "exptocas.l"
+       case 13:
+
+# line 95 "exptocas.l"
+    { BEGIN(SKP); }
+break;
+case 14:
+
+# line 96 "exptocas.l"
+              { /* eat contents of WHERE and DERIVE subclauses of ENTITY and TYPE */ }
+break;
+case 15:
+
+# line 98 "exptocas.l"
+            { return yylval.num = KSEL; }
+break;
+case 16:
+
+# line 99 "exptocas.l"
+       { return yylval.num = KENUM; }
+break;
+case 17:
+
+# line 100 "exptocas.l"
+              { return yylval.num = KLIST; }
+break;
+case 18:
+
+# line 101 "exptocas.l"
+             { return yylval.num = KARR; }
+break;
+case 19:
+
+# line 102 "exptocas.l"
+               { return yylval.num = KSET; }
+break;
+case 20:
+
+# line 103 "exptocas.l"
+               { return yylval.num = KBAG; }
+break;
+case 21:
+
+# line 104 "exptocas.l"
+                { return yylval.num = KOF; }
+break;
+case 22:
+
+# line 106 "exptocas.l"
+            { return yylval.num = KNUM; }
+break;
+case 23:
+
+# line 107 "exptocas.l"
+           { return yylval.num = KINT; }
+break;
+case 24:
+
+# line 108 "exptocas.l"
+              { return yylval.num = KDBL; }
+break;
+case 25:
+
+# line 109 "exptocas.l"
+            { return yylval.num = KSTR; }
+break;
+case 26:
+
+# line 110 "exptocas.l"
+           { return yylval.num = KLOG; }
+break;
+case 27:
+
+# line 111 "exptocas.l"
+           { return yylval.num = KBOOL; }
+break;
+case 28:
+
+# line 113 "exptocas.l"
+          { return yylval.num = KOPT; }
+break;
+case 29:
+
+# line 114 "exptocas.l"
+            { return yylval.num = KUNIQ; }
+break;
+case 30:
+
+# line 115 "exptocas.l"
+              { return yylval.num = KSELF; }
+break;
+case 31:
+
+# line 117 "exptocas.l"
+          { return yylval.num = KABSTR; }
+break;
+case 32:
+
+# line 118 "exptocas.l"
+           { return yylval.num = KSUBT; }
+break;
+case 33:
+
+# line 119 "exptocas.l"
+         { return yylval.num = KSPRT; }
+break;
+case 34:
+
+# line 120 "exptocas.l"
+             { return yylval.num = KANDOR; }
+break;
+case 35:
+
+# line 121 "exptocas.l"
+             { return yylval.num = K1OF; }
+break;
+case 36:
+
+# line 122 "exptocas.l"
+               { return yylval.num = KAND; }
+break;
+case 37:
+
+# line 124 "exptocas.l"
+          { yylval.str = strdup ( yytext ); return NAME; }
+break;
+case 38:
+
+# line 126 "exptocas.l"
+    { yylval.str = strdup ( yytext ); return NAME; }
+break;
+case 39:
+
+# line 128 "exptocas.l"
+              { yylval.num = atoi ( yytext ); return NUMBER; }
+break;
+case 40:
+
+# line 129 "exptocas.l"
+{ return yylval.num = yytext[0]; }
+break;
+case 41:
+
+# line 131 "exptocas.l"
+ { BEGIN(FUN); fun_level++; }
+break;
+case 42:
+
+# line 132 "exptocas.l"
+           { ec_state = YYSTATE; BEGIN(COMM); /* eat comments in functions */ }
+break;
+case 43:
+
+# line 133 "exptocas.l"
+         { /* Eat line comments in functions */ }
+break;
+case 44:
+
+# line 134 "exptocas.l"
+  { /* eat FUNCTIONs - skip IDs explicitly */ }
+break;
+case 45:
+
+# line 135 "exptocas.l"
+     { /* eat FUNCTIONs - skip strings explicitly */ }
+break;
+case 46:
+
+# line 136 "exptocas.l"
+              { /* eat FUNCTIONs - skip all other symbols in functions */ }
+break;
+case 47:
+
+# line 137 "exptocas.l"
+{ fun_level--; if ( ! fun_level ) BEGIN(0); }
+break;
+case 48:
+
+# line 139 "exptocas.l"
+              { BEGIN(RULE); /* eat RULEs */ }
+break;
+case 49:
+
+# line 140 "exptocas.l"
+             { /* eat RULEs */ }
+break;
+case 50:
+
+# line 141 "exptocas.l"
+   { BEGIN(0); }
+break;
+case 51:
+
+# line 143 "exptocas.l"
+{ /* eat CONSTANTs */
+                       char *s = yytext; /* but don't forget to count lines.. */
+                       while ( *s ) if ( *(s++) == '\n' ) ec_linenum++;
+                     }
+break;
+case 52:
+
+# line 148 "exptocas.l"
+              { /* eat spaces */ }
+break;
+case 53:
+
+# line 149 "exptocas.l"
+       { ec_error ( "unknown keyword ", yytext ); /* put unrecognized keywords to cerr */ }
+break;
+case 54:
+
+# line 150 "exptocas.l"
+                   { ec_error ( "unknown symbol ", yytext ); /* put unrecognized data to cerr */ }
+break;
+case 55:
+
+# line 152 "exptocas.l"
+ { ec_linenum++; /* count lines */ }
+break;
+case -1:
+break;
+default:
+(void)fprintf(yyout,"bad switch yylook %d",nstr);
+} return(0); }
+/* end of yylex */
+
+# line 155 "exptocas.l"
+
+/************************************/
+/* Section 3                        */
+/* auxiliary procedures             */
+
+/*
+int main ( void )
+{
+  yylex();
+}
+*/
+int yyvstop[] = {
+0,
+
+44,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+54,
+0, 
+
+52,
+54,
+0, 
+
+55,
+0, 
+
+40,
+54,
+0, 
+
+40,
+54,
+0, 
+
+54,
+0, 
+
+39,
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+38,
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+53,
+54,
+0, 
+
+3,
+0, 
+
+3,
+0, 
+
+14,
+0, 
+
+14,
+0, 
+
+49,
+0, 
+
+49,
+0, 
+
+46,
+0, 
+
+46,
+0, 
+
+46,
+0, 
+
+46,
+0, 
+
+44,
+46,
+0, 
+
+44,
+46,
+0, 
+
+44,
+46,
+0, 
+
+52,
+0, 
+
+2,
+0, 
+
+1,
+0, 
+
+39,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+21,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+38,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+4,
+0, 
+
+45,
+0, 
+
+42,
+0, 
+
+43,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+36,
+53,
+0, 
+
+53,
+0, 
+
+20,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+19,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+37,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+17,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+24,
+53,
+0, 
+
+48,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+30,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+7,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+34,
+53,
+0, 
+
+18,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+35,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+13,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+9,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+22,
+53,
+0, 
+
+53,
+0, 
+
+5,
+53,
+0, 
+
+15,
+53,
+0, 
+
+25,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+29,
+53,
+0, 
+
+53,
+0, 
+
+12,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+27,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+23,
+53,
+0, 
+
+26,
+53,
+0, 
+
+53,
+0, 
+
+32,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+11,
+53,
+0, 
+
+44,
+0, 
+
+44,
+0, 
+
+31,
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+41,
+53,
+0, 
+
+28,
+53,
+0, 
+
+53,
+0, 
+
+8,
+53,
+0, 
+
+53,
+0, 
+
+8,
+0, 
+
+44,
+0, 
+
+41,
+44,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+33,
+53,
+0, 
+
+53,
+0, 
+
+50,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+6,
+53,
+0, 
+
+53,
+0, 
+
+10,
+53,
+0, 
+
+10,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+16,
+53,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+44,
+0, 
+
+53,
+0, 
+
+47,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+53,
+0, 
+
+51,
+0, 
+0};
+# define YYTYPE int
+struct yywork { YYTYPE verify, advance; } yycrank[] = {
+0,0,   0,0,    1,15,   0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    1,16,   1,17,   
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+16,55, 0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+1,15,  1,18,   1,19,   0,0,    
+0,0,   1,19,   1,20,   16,55,  
+0,0,   1,21,   0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+43,90, 8,43,   18,56,  1,19,   
+1,19,  20,57,  1,19,   50,95,  
+51,96, 0,0,    1,22,   1,23,   
+1,24,  1,25,   1,26,   1,27,   
+1,25,  1,25,   1,28,   1,25,   
+1,25,  1,29,   1,25,   1,30,   
+1,31,  1,25,   1,25,   1,32,   
+1,33,  1,34,   1,35,   1,25,   
+1,25,  1,25,   1,25,   1,25,   
+1,19,  10,45,  1,19,   45,91,  
+1,36,  47,92,  53,98,  91,132, 
+54,99, 2,19,   25,59,  25,59,  
+25,59, 25,59,  25,59,  25,59,  
+25,59, 25,59,  25,59,  25,59,  
+92,133,        98,134, 99,135, 132,166,        
+133,167,       134,168,        2,19,   2,19,   
+135,169,       2,19,   167,197,        168,198,        
+169,199,       1,15,   2,23,   2,24,   
+2,25,  2,26,   2,27,   2,25,   
+2,25,  2,28,   2,25,   2,25,   
+2,29,  2,25,   2,30,   2,31,   
+2,25,  2,25,   2,32,   2,33,   
+2,34,  2,35,   2,25,   2,25,   
+2,25,  2,25,   2,25,   2,19,   
+195,221,       2,19,   196,222,        197,223,        
+166,195,       198,224,        199,225,        221,240,        
+3,19,  39,59,  39,59,  39,59,  
+39,59, 39,59,  39,59,  39,59,  
+39,59, 39,59,  39,59,  166,196,        
+222,241,       223,242,        224,243,        225,244,        
+240,254,       3,19,   3,19,   241,255,        
+3,19,  242,256,        39,87,  243,257,        
+2,15,  3,23,   3,24,   3,25,   
+3,37,  3,25,   3,25,   3,25,   
+3,28,  3,25,   3,25,   3,29,   
+3,25,  3,30,   3,31,   3,25,   
+3,25,  3,32,   3,33,   3,34,   
+3,35,  3,25,   3,38,   3,25,   
+3,25,  3,25,   3,19,   244,258,        
+3,19,  254,265,        256,266,        257,267,        
+265,273,       267,274,        268,275,        4,19,   
+59,59, 59,59,  59,59,  59,59,  
+59,59, 59,59,  59,59,  59,59,  
+59,59, 59,59,  274,278,        275,279,        
+278,281,       279,282,        281,284,        282,285,        
+4,19,  4,19,   285,287,        4,19,   
+287,289,       289,291,        291,293,        3,15,   
+4,23,  4,24,   4,25,   4,37,   
+4,25,  4,25,   4,25,   4,28,   
+4,25,  4,25,   4,29,   4,25,   
+4,30,  4,31,   4,25,   4,25,   
+4,32,  4,33,   4,34,   4,35,   
+4,25,  4,38,   4,25,   4,25,   
+4,25,  4,19,   293,295,        4,19,   
+295,297,       297,299,        299,301,        0,0,    
+0,0,   0,0,    5,19,   61,59,  
+61,59, 61,59,  61,59,  61,59,  
+61,59, 61,59,  61,59,  61,59,  
+61,59, 0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    5,19,   
+5,19,  0,0,    5,19,   61,101, 
+0,0,   0,0,    4,15,   5,23,   
+5,24,  5,39,   5,40,   5,25,   
+5,25,  5,25,   5,41,   5,25,   
+5,25,  5,29,   5,25,   5,30,   
+5,31,  5,25,   5,25,   5,32,   
+5,33,  5,34,   5,35,   5,25,   
+5,38,  5,25,   5,25,   5,25,   
+5,19,  0,0,    5,19,   14,48,  
+0,0,   0,0,    0,0,    0,0,    
+0,0,   6,19,   72,59,  72,59,  
+72,59, 72,59,  72,59,  72,59,  
+72,59, 72,59,  72,59,  72,59,  
+14,48, 14,48,  0,0,    14,48,  
+0,0,   0,0,    6,19,   6,19,   
+0,0,   6,19,   0,0,    14,53,  
+14,54, 5,15,   6,23,   6,24,   
+6,39,  6,40,   6,25,   6,25,   
+6,25,  6,41,   6,25,   6,25,   
+6,29,  6,25,   6,30,   6,31,   
+6,25,  6,25,   6,32,   6,33,   
+6,34,  6,35,   6,25,   6,38,   
+6,25,  6,25,   6,25,   6,19,   
+7,42,  6,19,   0,0,    0,0,    
+0,0,   0,0,    0,0,    9,44,   
+7,42,  7,17,   0,0,    0,0,    
+0,0,   0,0,    11,46,  9,44,   
+9,17,  0,0,    0,0,    0,0,    
+0,0,   0,0,    11,46,  0,0,    
+0,0,   0,0,    14,48,  0,0,    
+0,0,   12,46,  0,0,    0,0,    
+6,15,  0,0,    0,0,    0,0,    
+0,0,   12,46,  7,42,   7,42,   
+0,0,   7,43,   0,0,    7,42,   
+7,42,  9,44,   9,44,   7,42,   
+0,0,   0,0,    9,44,   9,44,   
+11,46, 11,46,  9,44,   0,0,    
+0,0,   11,46,  11,46,  0,0,    
+0,0,   11,46,  0,0,    0,0,    
+7,42,  0,0,    0,0,    12,46,  
+12,46, 0,0,    0,0,    9,44,   
+12,46, 12,46,  0,0,    9,45,   
+12,46, 13,48,  11,46,  0,0,    
+0,0,   0,0,    11,47,  0,0,    
+0,0,   13,48,  13,17,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   12,46,  7,42,   0,0,    
+0,0,   12,47,  0,0,    0,0,    
+0,0,   9,44,   0,0,    0,0,    
+49,93, 0,0,    0,0,    0,0,    
+11,46, 0,0,    0,0,    0,0,    
+49,93, 49,93,  0,0,    13,49,  
+13,50, 13,48,  0,0,    0,0,    
+13,48, 13,51,  0,0,    12,46,  
+13,52, 0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    13,48,  13,48,  
+0,0,   13,48,  0,0,    0,0,    
+0,0,   13,52,  49,94,  49,93,  
+0,0,   13,53,  13,54,  49,93,  
+49,93, 0,0,    0,0,    49,93,  
+0,0,   0,0,    0,0,    21,58,  
+21,58, 21,58,  21,58,  21,58,  
+21,58, 21,58,  21,58,  21,58,  
+21,58, 0,0,    0,0,    0,0,    
+49,93, 0,0,    0,0,    13,52,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  49,93,  0,0,    
+13,48, 0,0,    21,59,  0,0,    
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  21,59,  21,59,  
+21,59, 21,59,  22,59,  22,59,  
+22,59, 22,59,  22,59,  22,59,  
+22,59, 22,59,  22,59,  22,59,  
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+22,60, 23,59,  23,59,  23,59,  
+23,59, 23,59,  23,59,  23,59,  
+23,59, 23,59,  23,59,  0,0,    
+22,61, 0,0,    0,0,    0,0,    
+22,62, 0,0,    23,63,  24,59,  
+24,59, 24,59,  24,59,  24,59,  
+24,59, 24,59,  24,59,  24,59,  
+24,59, 0,0,    0,0,    0,0,    
+23,64, 26,59,  26,59,  26,59,  
+26,59, 26,59,  26,59,  26,59,  
+26,59, 26,59,  26,59,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    24,65,  27,59,  
+27,59, 27,59,  27,59,  27,59,  
+27,59, 27,59,  27,59,  27,59,  
+27,59, 0,0,    0,0,    26,66,  
+28,59, 28,59,  28,59,  28,59,  
+28,59, 28,59,  28,59,  28,59,  
+28,59, 28,59,  29,59,  29,59,  
+29,59, 29,59,  29,59,  29,59,  
+29,59, 29,59,  29,59,  29,59,  
+0,0,   0,0,    0,0,    0,0,    
+27,67, 0,0,    0,0,    0,0,    
+0,0,   0,0,    28,68,  0,0,    
+0,0,   0,0,    0,0,    29,69,  
+0,0,   0,0,    0,0,    0,0,    
+0,0,   29,70,  30,59,  30,59,  
+30,59, 30,59,  30,59,  30,59,  
+30,59, 30,59,  30,59,  30,59,  
+31,59, 31,59,  31,59,  31,59,  
+31,59, 31,59,  31,59,  31,59,  
+31,59, 31,59,  32,59,  32,59,  
+32,59, 32,59,  32,59,  32,59,  
+32,59, 32,59,  32,59,  32,59,  
+0,0,   0,0,    31,72,  0,0,    
+0,0,   0,0,    0,0,    30,71,  
+0,0,   0,0,    31,73,  32,75,  
+31,74, 33,59,  33,59,  33,59,  
+33,59, 33,59,  33,59,  33,59,  
+33,59, 33,59,  33,59,  0,0,    
+0,0,   0,0,    0,0,    32,76,  
+0,0,   0,0,    0,0,    0,0,    
+33,77, 0,0,    33,78,  34,59,  
+34,59, 34,59,  34,59,  34,59,  
+34,59, 34,59,  34,59,  34,59,  
+34,59, 0,0,    0,0,    0,0,    
+0,0,   33,79,  33,80,  35,59,  
+35,59, 35,59,  35,59,  35,59,  
+35,59, 35,59,  35,59,  35,59,  
+35,59, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+34,81, 0,0,    0,0,    0,0,    
+0,0,   35,82,  0,0,    0,0,    
+0,0,   35,83,  63,59,  63,59,  
+63,59, 63,59,  63,59,  63,59,  
+63,59, 63,59,  63,59,  63,59,  
+83,126,        83,126, 83,126, 83,126, 
+83,126,        83,126, 83,126, 83,126, 
+83,126,        83,126, 0,0,    0,0,    
+36,84, 63,103, 36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+36,84, 36,84,  36,84,  36,84,  
+37,59, 37,59,  37,59,  37,59,  
+37,59, 37,59,  37,59,  37,59,  
+37,59, 37,59,  38,59,  38,59,  
+38,59, 38,59,  38,59,  38,59,  
+38,59, 38,59,  38,59,  38,59,  
+40,59, 40,59,  40,59,  40,59,  
+40,59, 40,59,  40,59,  40,59,  
+40,59, 40,59,  37,85,  0,0,    
+0,0,   0,0,    38,86,  41,59,  
+41,59, 41,59,  41,59,  41,59,  
+41,59, 41,59,  41,59,  41,59,  
+41,59, 0,0,    0,0,    0,0,    
+0,0,   0,0,    40,88,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 0,0,    0,0,    0,0,    
+0,0,   41,89,  0,0,    0,0,    
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  0,0,    0,0,    
+0,0,   0,0,    52,97,  0,0,    
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  52,97,  52,97,  
+52,97, 52,97,  57,57,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    57,57,  57,0,   
+60,59, 60,59,  60,59,  60,59,  
+60,59, 60,59,  60,59,  60,59,  
+60,59, 60,59,  62,59,  62,59,  
+62,59, 62,59,  62,59,  62,59,  
+62,59, 62,59,  62,59,  62,59,  
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+57,57, 57,57,  0,0,    0,0,    
+0,0,   57,57,  57,57,  60,100, 
+0,0,   57,57,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+62,102,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    57,57,  64,59,  
+64,59, 64,59,  64,59,  64,59,  
+64,59, 64,59,  64,59,  64,59,  
+64,59, 65,59,  65,59,  65,59,  
+65,59, 65,59,  65,59,  65,59,  
+65,59, 65,59,  65,59,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+57,57, 0,0,    64,104, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    65,105, 
+66,59, 66,59,  66,59,  66,59,  
+66,59, 66,59,  66,59,  66,59,  
+66,59, 66,59,  67,59,  67,59,  
+67,59, 67,59,  67,59,  67,59,  
+67,59, 67,59,  67,59,  67,59,  
+66,106,        68,59,  68,59,  68,59,  
+68,59, 68,59,  68,59,  68,59,  
+68,59, 68,59,  68,59,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+66,107,        66,108, 0,0,    0,0,    
+67,109,        69,59,  69,59,  69,59,  
+69,59, 69,59,  69,59,  69,59,  
+69,59, 69,59,  69,59,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   68,110, 70,59,  70,59,  
+70,59, 70,59,  70,59,  70,59,  
+70,59, 70,59,  70,59,  70,59,  
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+69,111,        0,0,    0,0,    0,0,    
+0,0,   70,112, 71,59,  71,59,  
+71,59, 71,59,  71,59,  71,59,  
+71,59, 71,59,  71,59,  71,59,  
+73,59, 73,59,  73,59,  73,59,  
+73,59, 73,59,  73,59,  73,59,  
+73,59, 73,59,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    71,113, 
+0,0,   73,114, 74,59,  74,59,  
+74,59, 74,59,  74,59,  74,59,  
+74,59, 74,59,  74,59,  74,59,  
+75,59, 75,59,  75,59,  75,59,  
+75,59, 75,59,  75,59,  75,59,  
+75,59, 75,59,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   75,116, 0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    74,115, 76,59,  
+76,59, 76,59,  76,59,  76,59,  
+76,59, 76,59,  76,59,  76,59,  
+76,59, 77,59,  77,59,  77,59,  
+77,59, 77,59,  77,59,  77,59,  
+77,59, 77,59,  77,59,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    76,117, 
+0,0,   0,0,    0,0,    0,0,    
+0,0,   77,118, 78,59,  78,59,  
+78,59, 78,59,  78,59,  78,59,  
+78,59, 78,59,  78,59,  78,59,  
+79,59, 79,59,  79,59,  79,59,  
+79,59, 79,59,  79,59,  79,59,  
+79,59, 79,59,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    78,119, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    78,120, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    79,121, 80,59,  
+80,59, 80,59,  80,59,  80,59,  
+80,59, 80,59,  80,59,  80,59,  
+80,59, 0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   80,122, 81,59,  81,59,  
+81,59, 81,59,  81,59,  81,59,  
+81,59, 81,59,  81,59,  81,59,  
+0,0,   0,0,    0,0,    80,123, 
+82,59, 82,59,  82,59,  82,59,  
+82,59, 82,59,  82,59,  82,59,  
+82,59, 82,59,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    81,124, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   82,125, 84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+86,59, 86,59,  86,59,  86,59,  
+86,59, 86,59,  86,59,  86,59,  
+86,59, 86,59,  102,59, 102,59, 
+102,59,        102,59, 102,59, 102,59, 
+102,59,        102,59, 102,59, 102,59, 
+0,0,   86,128, 0,0,    0,0,    
+0,0,   0,0,    0,0,    102,138,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   84,84,  0,0,    84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 84,84,  84,84,  84,84,  
+84,84, 85,59,  85,59,  85,59,  
+85,59, 85,59,  85,59,  85,59,  
+85,59, 85,59,  85,59,  87,59,  
+87,59, 87,59,  87,59,  87,59,  
+87,59, 87,59,  87,59,  87,59,  
+87,59, 85,127, 88,59,  88,59,  
+88,59, 88,59,  88,59,  88,59,  
+88,59, 88,59,  88,59,  88,59,  
+96,96, 0,0,    0,0,    0,0,    
+0,0,   85,107, 85,108, 0,0,    
+96,96, 96,0,   88,130, 0,0,    
+0,0,   87,129, 89,59,  89,59,  
+89,59, 89,59,  89,59,  89,59,  
+89,59, 89,59,  89,59,  89,59,  
+0,0,   0,0,    88,107, 88,108, 
+103,59,        103,59, 103,59, 103,59, 
+103,59,        103,59, 103,59, 103,59, 
+103,59,        103,59, 96,96,  96,96,  
+0,0,   0,0,    0,0,    96,96,  
+96,96, 0,0,    0,0,    96,96,  
+0,0,   0,0,    89,110, 0,0,    
+89,131,        100,59, 100,59, 100,59, 
+100,59,        100,59, 100,59, 100,59, 
+100,59,        100,59, 100,59, 0,0,    
+96,96, 101,59, 101,59, 101,59, 
+101,59,        101,59, 101,59, 101,59, 
+101,59,        101,59, 101,59, 104,59, 
+104,59,        104,59, 104,59, 104,59, 
+104,59,        104,59, 104,59, 104,59, 
+104,59,        0,0,    0,0,    0,0,    
+0,0,   100,136,        0,0,    0,0,    
+0,0,   0,0,    96,96,  0,0,    
+101,137,       0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    104,139,        
+105,59,        105,59, 105,59, 105,59, 
+105,59,        105,59, 105,59, 105,59, 
+105,59,        105,59, 106,59, 106,59, 
+106,59,        106,59, 106,59, 106,59, 
+106,59,        106,59, 106,59, 106,59, 
+107,59,        107,59, 107,59, 107,59, 
+107,59,        107,59, 107,59, 107,59, 
+107,59,        107,59, 0,0,    0,0,    
+0,0,   0,0,    0,0,    105,140,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   107,142,        108,59, 108,59, 
+108,59,        108,59, 108,59, 108,59, 
+108,59,        108,59, 108,59, 108,59, 
+0,0,   106,141,        109,59, 109,59, 
+109,59,        109,59, 109,59, 109,59, 
+109,59,        109,59, 109,59, 109,59, 
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    108,143,        
+0,0,   109,144,        110,59, 110,59, 
+110,59,        110,59, 110,59, 110,59, 
+110,59,        110,59, 110,59, 110,59, 
+111,59,        111,59, 111,59, 111,59, 
+111,59,        111,59, 111,59, 111,59, 
+111,59,        111,59, 0,0,    110,145,        
+112,59,        112,59, 112,59, 112,59, 
+112,59,        112,59, 112,59, 112,59, 
+112,59,        112,59, 113,59, 113,59, 
+113,59,        113,59, 113,59, 113,59, 
+113,59,        113,59, 113,59, 113,59, 
+0,0,   0,0,    0,0,    0,0,    
+111,146,       112,147,        0,0,    0,0,    
+113,148,       114,59, 114,59, 114,59, 
+114,59,        114,59, 114,59, 114,59, 
+114,59,        114,59, 114,59, 115,59, 
+115,59,        115,59, 115,59, 115,59, 
+115,59,        115,59, 115,59, 115,59, 
+115,59,        116,59, 116,59, 116,59, 
+116,59,        116,59, 116,59, 116,59, 
+116,59,        116,59, 116,59, 0,0,    
+114,149,       0,0,    0,0,    0,0,    
+115,150,       117,59, 117,59, 117,59, 
+117,59,        117,59, 117,59, 117,59, 
+117,59,        117,59, 117,59, 0,0,    
+0,0,   116,151,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    117,152,        118,59, 
+118,59,        118,59, 118,59, 118,59, 
+118,59,        118,59, 118,59, 118,59, 
+118,59,        119,59, 119,59, 119,59, 
+119,59,        119,59, 119,59, 119,59, 
+119,59,        119,59, 119,59, 0,0,    
+118,153,       0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    119,154,        119,155,        
+120,59,        120,59, 120,59, 120,59, 
+120,59,        120,59, 120,59, 120,59, 
+120,59,        120,59, 121,59, 121,59, 
+121,59,        121,59, 121,59, 121,59, 
+121,59,        121,59, 121,59, 121,59, 
+122,59,        122,59, 122,59, 122,59, 
+122,59,        122,59, 122,59, 122,59, 
+122,59,        122,59, 0,0,    0,0,    
+0,0,   0,0,    0,0,    121,156,        
+123,59,        123,59, 123,59, 123,59, 
+123,59,        123,59, 123,59, 123,59, 
+123,59,        123,59, 124,59, 124,59, 
+124,59,        124,59, 124,59, 124,59, 
+124,59,        124,59, 124,59, 124,59, 
+122,157,       123,158,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    124,159,        
+125,59,        125,59, 125,59, 125,59, 
+125,59,        125,59, 125,59, 125,59, 
+125,59,        125,59, 126,126,        126,126,        
+126,126,       126,126,        126,126,        126,126,        
+126,126,       126,126,        126,126,        126,126,        
+127,59,        127,59, 127,59, 127,59, 
+127,59,        127,59, 127,59, 127,59, 
+127,59,        127,59, 0,0,    0,0,    
+0,0,   125,160,        128,59, 128,59, 
+128,59,        128,59, 128,59, 128,59, 
+128,59,        128,59, 128,59, 128,59, 
+129,59,        129,59, 129,59, 129,59, 
+129,59,        129,59, 129,59, 129,59, 
+129,59,        129,59, 130,59, 130,59, 
+130,59,        130,59, 130,59, 130,59, 
+130,59,        130,59, 130,59, 130,59, 
+0,0,   0,0,    0,0,    127,161,        
+128,162,       129,163,        131,59, 131,59, 
+131,59,        131,59, 131,59, 131,59, 
+131,59,        131,59, 131,59, 131,59, 
+136,59,        136,59, 136,59, 136,59, 
+136,59,        136,59, 136,59, 136,59, 
+136,59,        136,59, 0,0,    131,165,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   130,164,        137,59, 137,59, 
+137,59,        137,59, 137,59, 137,59, 
+137,59,        137,59, 137,59, 137,59, 
+0,0,   0,0,    136,170,        138,59, 
+138,59,        138,59, 138,59, 138,59, 
+138,59,        138,59, 138,59, 138,59, 
+138,59,        139,59, 139,59, 139,59, 
+139,59,        139,59, 139,59, 139,59, 
+139,59,        139,59, 139,59, 0,0,    
+137,171,       0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    139,173,        0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+138,172,       140,59, 140,59, 140,59, 
+140,59,        140,59, 140,59, 140,59, 
+140,59,        140,59, 140,59, 141,59, 
+141,59,        141,59, 141,59, 141,59, 
+141,59,        141,59, 141,59, 141,59, 
+141,59,        142,59, 142,59, 142,59, 
+142,59,        142,59, 142,59, 142,59, 
+142,59,        142,59, 142,59, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   140,174,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    141,175,        143,59, 
+143,59,        143,59, 143,59, 143,59, 
+143,59,        143,59, 143,59, 143,59, 
+143,59,        142,176,        144,59, 144,59, 
+144,59,        144,59, 144,59, 144,59, 
+144,59,        144,59, 144,59, 144,59, 
+143,177,       145,59, 145,59, 145,59, 
+145,59,        145,59, 145,59, 145,59, 
+145,59,        145,59, 145,59, 146,59, 
+146,59,        146,59, 146,59, 146,59, 
+146,59,        146,59, 146,59, 146,59, 
+146,59,        0,0,    0,0,    0,0,    
+145,179,       0,0,    144,178,        147,59, 
+147,59,        147,59, 147,59, 147,59, 
+147,59,        147,59, 147,59, 147,59, 
+147,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    147,180,        148,59, 
+148,59,        148,59, 148,59, 148,59, 
+148,59,        148,59, 148,59, 148,59, 
+148,59,        149,59, 149,59, 149,59, 
+149,59,        149,59, 149,59, 149,59, 
+149,59,        149,59, 149,59, 0,0,    
+148,181,       150,59, 150,59, 150,59, 
+150,59,        150,59, 150,59, 150,59, 
+150,59,        150,59, 150,59, 149,182,        
+151,59,        151,59, 151,59, 151,59, 
+151,59,        151,59, 151,59, 151,59, 
+151,59,        151,59, 152,59, 152,59, 
+152,59,        152,59, 152,59, 152,59, 
+152,59,        152,59, 152,59, 152,59, 
+150,183,       153,59, 153,59, 153,59, 
+153,59,        153,59, 153,59, 153,59, 
+153,59,        153,59, 153,59, 0,0,    
+154,59,        154,59, 154,59, 154,59, 
+154,59,        154,59, 154,59, 154,59, 
+154,59,        154,59, 0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    153,184,        154,185,        
+155,59,        155,59, 155,59, 155,59, 
+155,59,        155,59, 155,59, 155,59, 
+155,59,        155,59, 156,59, 156,59, 
+156,59,        156,59, 156,59, 156,59, 
+156,59,        156,59, 156,59, 156,59, 
+157,59,        157,59, 157,59, 157,59, 
+157,59,        157,59, 157,59, 157,59, 
+157,59,        157,59, 158,59, 158,59, 
+158,59,        158,59, 158,59, 158,59, 
+158,59,        158,59, 158,59, 158,59, 
+156,186,       159,59, 159,59, 159,59, 
+159,59,        159,59, 159,59, 159,59, 
+159,59,        159,59, 159,59, 160,59, 
+160,59,        160,59, 160,59, 160,59, 
+160,59,        160,59, 160,59, 160,59, 
+160,59,        157,187,        0,0,    0,0,    
+158,188,       161,59, 161,59, 161,59, 
+161,59,        161,59, 161,59, 161,59, 
+161,59,        161,59, 161,59, 162,59, 
+162,59,        162,59, 162,59, 162,59, 
+162,59,        162,59, 162,59, 162,59, 
+162,59,        0,0,    0,0,    0,0,    
+160,189,       0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+162,191,       0,0,    0,0,    0,0,    
+161,175,       161,190,        163,59, 163,59, 
+163,59,        163,59, 163,59, 163,59, 
+163,59,        163,59, 163,59, 163,59, 
+164,59,        164,59, 164,59, 164,59, 
+164,59,        164,59, 164,59, 164,59, 
+164,59,        164,59, 165,59, 165,59, 
+165,59,        165,59, 165,59, 165,59, 
+165,59,        165,59, 165,59, 165,59, 
+0,0,   164,193,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+163,192,       0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    164,175,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+165,194,       170,59, 170,59, 170,59, 
+170,59,        170,59, 170,59, 170,59, 
+170,59,        170,59, 170,59, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    170,200,        171,59, 
+171,59,        171,59, 171,59, 171,59, 
+171,59,        171,59, 171,59, 171,59, 
+171,59,        172,59, 172,59, 172,59, 
+172,59,        172,59, 172,59, 172,59, 
+172,59,        172,59, 172,59, 173,59, 
+173,59,        173,59, 173,59, 173,59, 
+173,59,        173,59, 173,59, 173,59, 
+173,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+173,201,       174,59, 174,59, 174,59, 
+174,59,        174,59, 174,59, 174,59, 
+174,59,        174,59, 174,59, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    174,202,        175,59, 
+175,59,        175,59, 175,59, 175,59, 
+175,59,        175,59, 175,59, 175,59, 
+175,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    175,203,        176,59, 
+176,59,        176,59, 176,59, 176,59, 
+176,59,        176,59, 176,59, 176,59, 
+176,59,        177,59, 177,59, 177,59, 
+177,59,        177,59, 177,59, 177,59, 
+177,59,        177,59, 177,59, 178,59, 
+178,59,        178,59, 178,59, 178,59, 
+178,59,        178,59, 178,59, 178,59, 
+178,59,        179,59, 179,59, 179,59, 
+179,59,        179,59, 179,59, 179,59, 
+179,59,        179,59, 179,59, 0,0,    
+176,204,       0,0,    0,0,    177,205,        
+178,206,       0,0,    0,0,    0,0,    
+0,0,   0,0,    179,207,        180,59, 
+180,59,        180,59, 180,59, 180,59, 
+180,59,        180,59, 180,59, 180,59, 
+180,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+180,208,       181,59, 181,59, 181,59, 
+181,59,        181,59, 181,59, 181,59, 
+181,59,        181,59, 181,59, 182,59, 
+182,59,        182,59, 182,59, 182,59, 
+182,59,        182,59, 182,59, 182,59, 
+182,59,        183,59, 183,59, 183,59, 
+183,59,        183,59, 183,59, 183,59, 
+183,59,        183,59, 183,59, 0,0,    
+0,0,   0,0,    0,0,    181,209,        
+184,59,        184,59, 184,59, 184,59, 
+184,59,        184,59, 184,59, 184,59, 
+184,59,        184,59, 0,0,    0,0,    
+0,0,   0,0,    0,0,    183,210,        
+0,0,   184,211,        185,59, 185,59, 
+185,59,        185,59, 185,59, 185,59, 
+185,59,        185,59, 185,59, 185,59, 
+186,59,        186,59, 186,59, 186,59, 
+186,59,        186,59, 186,59, 186,59, 
+186,59,        186,59, 187,59, 187,59, 
+187,59,        187,59, 187,59, 187,59, 
+187,59,        187,59, 187,59, 187,59, 
+0,0,   0,0,    0,0,    186,213,        
+0,0,   0,0,    185,212,        188,59, 
+188,59,        188,59, 188,59, 188,59, 
+188,59,        188,59, 188,59, 188,59, 
+188,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    187,214,        189,59, 
+189,59,        189,59, 189,59, 189,59, 
+189,59,        189,59, 189,59, 189,59, 
+189,59,        190,59, 190,59, 190,59, 
+190,59,        190,59, 190,59, 190,59, 
+190,59,        190,59, 190,59, 188,215,        
+189,216,       191,59, 191,59, 191,59, 
+191,59,        191,59, 191,59, 191,59, 
+191,59,        191,59, 191,59, 192,59, 
+192,59,        192,59, 192,59, 192,59, 
+192,59,        192,59, 192,59, 192,59, 
+192,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    190,217,        0,0,    
+192,218,       193,59, 193,59, 193,59, 
+193,59,        193,59, 193,59, 193,59, 
+193,59,        193,59, 193,59, 194,59, 
+194,59,        194,59, 194,59, 194,59, 
+194,59,        194,59, 194,59, 194,59, 
+194,59,        200,59, 200,59, 200,59, 
+200,59,        200,59, 200,59, 200,59, 
+200,59,        200,59, 200,59, 193,219,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+200,226,       0,0,    0,0,    0,0,    
+0,0,   0,0,    194,220,        201,59, 
+201,59,        201,59, 201,59, 201,59, 
+201,59,        201,59, 201,59, 201,59, 
+201,59,        202,59, 202,59, 202,59, 
+202,59,        202,59, 202,59, 202,59, 
+202,59,        202,59, 202,59, 203,59, 
+203,59,        203,59, 203,59, 203,59, 
+203,59,        203,59, 203,59, 203,59, 
+203,59,        201,227,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    202,228,        
+0,0,   0,0,    0,0,    203,229,        
+204,59,        204,59, 204,59, 204,59, 
+204,59,        204,59, 204,59, 204,59, 
+204,59,        204,59, 205,59, 205,59, 
+205,59,        205,59, 205,59, 205,59, 
+205,59,        205,59, 205,59, 205,59, 
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    205,230,        
+206,59,        206,59, 206,59, 206,59, 
+206,59,        206,59, 206,59, 206,59, 
+206,59,        206,59, 207,59, 207,59, 
+207,59,        207,59, 207,59, 207,59, 
+207,59,        207,59, 207,59, 207,59, 
+208,59,        208,59, 208,59, 208,59, 
+208,59,        208,59, 208,59, 208,59, 
+208,59,        208,59, 0,0,    206,231,        
+209,59,        209,59, 209,59, 209,59, 
+209,59,        209,59, 209,59, 209,59, 
+209,59,        209,59, 0,0,    0,0,    
+207,232,       0,0,    0,0,    0,0,    
+208,233,       210,59, 210,59, 210,59, 
+210,59,        210,59, 210,59, 210,59, 
+210,59,        210,59, 210,59, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    210,234,        211,59, 
+211,59,        211,59, 211,59, 211,59, 
+211,59,        211,59, 211,59, 211,59, 
+211,59,        212,59, 212,59, 212,59, 
+212,59,        212,59, 212,59, 212,59, 
+212,59,        212,59, 212,59, 213,59, 
+213,59,        213,59, 213,59, 213,59, 
+213,59,        213,59, 213,59, 213,59, 
+213,59,        214,59, 214,59, 214,59, 
+214,59,        214,59, 214,59, 214,59, 
+214,59,        214,59, 214,59, 215,59, 
+215,59,        215,59, 215,59, 215,59, 
+215,59,        215,59, 215,59, 215,59, 
+215,59,        0,0,    214,235,        216,59, 
+216,59,        216,59, 216,59, 216,59, 
+216,59,        216,59, 216,59, 216,59, 
+216,59,        217,59, 217,59, 217,59, 
+217,59,        217,59, 217,59, 217,59, 
+217,59,        217,59, 217,59, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+215,236,       218,59, 218,59, 218,59, 
+218,59,        218,59, 218,59, 218,59, 
+218,59,        218,59, 218,59, 0,0,    
+0,0,   217,237,        219,59, 219,59, 
+219,59,        219,59, 219,59, 219,59, 
+219,59,        219,59, 219,59, 219,59, 
+220,59,        220,59, 220,59, 220,59, 
+220,59,        220,59, 220,59, 220,59, 
+220,59,        220,59, 226,59, 226,59, 
+226,59,        226,59, 226,59, 226,59, 
+226,59,        226,59, 226,59, 226,59, 
+0,0,   220,239,        0,0,    0,0,    
+0,0,   0,0,    219,238,        227,59, 
+227,59,        227,59, 227,59, 227,59, 
+227,59,        227,59, 227,59, 227,59, 
+227,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    226,245,        228,59, 
+228,59,        228,59, 228,59, 228,59, 
+228,59,        228,59, 228,59, 228,59, 
+228,59,        229,59, 229,59, 229,59, 
+229,59,        229,59, 229,59, 229,59, 
+229,59,        229,59, 229,59, 230,59, 
+230,59,        230,59, 230,59, 230,59, 
+230,59,        230,59, 230,59, 230,59, 
+230,59,        0,0,    229,247,        0,0,    
+0,0,   0,0,    0,0,    228,246,        
+231,59,        231,59, 231,59, 231,59, 
+231,59,        231,59, 231,59, 231,59, 
+231,59,        231,59, 0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    230,248,        
+232,59,        232,59, 232,59, 232,59, 
+232,59,        232,59, 232,59, 232,59, 
+232,59,        232,59, 231,249,        233,59, 
+233,59,        233,59, 233,59, 233,59, 
+233,59,        233,59, 233,59, 233,59, 
+233,59,        234,59, 234,59, 234,59, 
+234,59,        234,59, 234,59, 234,59, 
+234,59,        234,59, 234,59, 235,59, 
+235,59,        235,59, 235,59, 235,59, 
+235,59,        235,59, 235,59, 235,59, 
+235,59,        0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   234,250,        236,59, 236,59, 
+236,59,        236,59, 236,59, 236,59, 
+236,59,        236,59, 236,59, 236,59, 
+237,59,        237,59, 237,59, 237,59, 
+237,59,        237,59, 237,59, 237,59, 
+237,59,        237,59, 238,59, 238,59, 
+238,59,        238,59, 238,59, 238,59, 
+238,59,        238,59, 238,59, 238,59, 
+0,0,   237,252,        236,251,        239,59, 
+239,59,        239,59, 239,59, 239,59, 
+239,59,        239,59, 239,59, 239,59, 
+239,59,        246,259,        246,259,        238,253,        
+245,59,        245,59, 245,59, 245,59, 
+245,59,        245,59, 245,59, 245,59, 
+245,59,        245,59, 248,59, 248,59, 
+248,59,        248,59, 248,59, 248,59, 
+248,59,        248,59, 248,59, 248,59, 
+246,259,       0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    246,259,        
+246,259,       246,259,        0,0,    0,0,    
+0,0,   246,259,        0,0,    248,262,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,259,        246,259,        
+0,0,   246,259,        247,59, 247,59, 
+247,59,        247,59, 247,59, 247,59, 
+247,59,        247,59, 247,59, 247,59, 
+249,59,        249,59, 249,59, 249,59, 
+249,59,        249,59, 249,59, 249,59, 
+249,59,        249,59, 0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    247,261,        
+0,0,   0,0,    0,0,    246,260,        
+0,0,   246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        246,260,        
+246,260,       246,260,        246,260,        0,0,    
+246,259,       250,59, 250,59, 250,59, 
+250,59,        250,59, 250,59, 250,59, 
+250,59,        250,59, 250,59, 251,59, 
+251,59,        251,59, 251,59, 251,59, 
+251,59,        251,59, 251,59, 251,59, 
+251,59,        252,59, 252,59, 252,59, 
+252,59,        252,59, 252,59, 252,59, 
+252,59,        252,59, 252,59, 0,0,    
+251,263,       253,59, 253,59, 253,59, 
+253,59,        253,59, 253,59, 253,59, 
+253,59,        253,59, 253,59, 259,259,        
+259,259,       261,59, 261,59, 261,59, 
+261,59,        261,59, 261,59, 261,59, 
+261,59,        261,59, 261,59, 0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    261,270,        0,0,    
+0,0,   0,0,    259,259,        0,0,    
+0,0,   253,264,        0,0,    0,0,    
+0,0,   259,259,        259,259,        259,259,        
+0,0,   0,0,    0,0,    259,259,        
+0,0,   0,0,    259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        0,0,    259,259,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    259,268,        
+263,59,        263,59, 263,59, 263,59, 
+263,59,        263,59, 263,59, 263,59, 
+263,59,        263,59, 0,0,    0,0,    
+264,59,        264,59, 264,59, 264,59, 
+264,59,        264,59, 264,59, 264,59, 
+264,59,        264,59, 0,0,    0,0,    
+0,0,   259,259,        0,0,    259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       259,259,        259,259,        259,259,        
+259,259,       264,272,        259,259,        260,259,        
+260,259,       262,59, 262,59, 262,59, 
+262,59,        262,59, 262,59, 262,59, 
+262,59,        262,59, 262,59, 270,59, 
+270,59,        270,59, 270,59, 270,59, 
+270,59,        270,59, 270,59, 270,59, 
+270,59,        0,0,    260,259,        0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   260,259,        260,259,        260,259,        
+262,271,       0,0,    0,0,    260,259,        
+0,0,   0,0,    260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,259,       260,259,        0,0,    260,259,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    260,269,        
+272,59,        272,59, 272,59, 272,59, 
+272,59,        272,59, 272,59, 272,59, 
+272,59,        272,59, 277,59, 277,59, 
+277,59,        277,59, 277,59, 277,59, 
+277,59,        277,59, 277,59, 277,59, 
+0,0,   0,0,    0,0,    0,0,    
+0,0,   260,260,        0,0,    260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       260,260,        260,260,        260,260,        
+260,260,       0,0,    260,259,        269,59, 
+269,59,        269,59, 269,59, 269,59, 
+269,59,        269,59, 269,59, 269,59, 
+269,59,        271,59, 271,59, 271,59, 
+271,59,        271,59, 271,59, 271,59, 
+271,59,        271,59, 271,59, 280,59, 
+280,59,        280,59, 280,59, 280,59, 
+280,59,        280,59, 280,59, 280,59, 
+280,59,        269,276,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    271,277,        
+276,59,        276,59, 276,59, 276,59, 
+276,59,        276,59, 276,59, 276,59, 
+276,59,        276,59, 283,59, 283,59, 
+283,59,        283,59, 283,59, 283,59, 
+283,59,        283,59, 283,59, 283,59, 
+276,280,       0,0,    0,0,    0,0,    
+0,0,   0,0,    280,283,        0,0,    
+0,0,   283,286,        286,59, 286,59, 
+286,59,        286,59, 286,59, 286,59, 
+286,59,        286,59, 286,59, 286,59, 
+288,59,        288,59, 288,59, 288,59, 
+288,59,        288,59, 288,59, 288,59, 
+288,59,        288,59, 290,59, 290,59, 
+290,59,        290,59, 290,59, 290,59, 
+290,59,        290,59, 290,59, 290,59, 
+0,0,   286,288,        0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    288,290,        292,59, 
+292,59,        292,59, 292,59, 292,59, 
+292,59,        292,59, 292,59, 292,59, 
+292,59,        0,0,    0,0,    0,0,    
+0,0,   290,292,        294,59, 294,59, 
+294,59,        294,59, 294,59, 294,59, 
+294,59,        294,59, 294,59, 294,59, 
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    294,296,        
+0,0,   0,0,    0,0,    292,294,        
+296,59,        296,59, 296,59, 296,59, 
+296,59,        296,59, 296,59, 296,59, 
+296,59,        296,59, 298,59, 298,59, 
+298,59,        298,59, 298,59, 298,59, 
+298,59,        298,59, 298,59, 298,59, 
+300,59,        300,59, 300,59, 300,59, 
+300,59,        300,59, 300,59, 300,59, 
+300,59,        300,59, 296,298,        300,301,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    298,300,        0,0,    
+0,0};
+struct yysvf yysvec[] = {
+0,     0,      0,
+yycrank+-1,    0,              yyvstop+1,
+yycrank+-60,   yysvec+1,       yyvstop+3,
+yycrank+-119,  yysvec+1,       yyvstop+5,
+yycrank+-178,  yysvec+1,       yyvstop+7,
+yycrank+-237,  yysvec+1,       yyvstop+9,
+yycrank+-296,  yysvec+1,       yyvstop+11,
+yycrank+-387,  0,              0,      
+yycrank+-15,   yysvec+7,       0,      
+yycrank+-394,  0,              0,      
+yycrank+-24,   yysvec+9,       0,      
+yycrank+-401,  yysvec+9,       0,      
+yycrank+-416,  yysvec+9,       0,      
+yycrank+-464,  0,              0,      
+yycrank+-290,  yysvec+13,      0,      
+yycrank+0,     0,              yyvstop+13,
+yycrank+15,    0,              yyvstop+15,
+yycrank+0,     0,              yyvstop+18,
+yycrank+16,    0,              yyvstop+20,
+yycrank+0,     0,              yyvstop+23,
+yycrank+16,    0,              yyvstop+26,
+yycrank+495,   0,              yyvstop+28,
+yycrank+570,   yysvec+21,      yyvstop+32,
+yycrank+589,   yysvec+21,      yyvstop+35,
+yycrank+607,   yysvec+21,      yyvstop+38,
+yycrank+54,    yysvec+21,      yyvstop+41,
+yycrank+621,   yysvec+21,      yyvstop+44,
+yycrank+639,   yysvec+21,      yyvstop+47,
+yycrank+652,   yysvec+21,      yyvstop+50,
+yycrank+662,   yysvec+21,      yyvstop+53,
+yycrank+694,   yysvec+21,      yyvstop+56,
+yycrank+704,   yysvec+21,      yyvstop+59,
+yycrank+714,   yysvec+21,      yyvstop+62,
+yycrank+737,   yysvec+21,      yyvstop+65,
+yycrank+759,   yysvec+21,      yyvstop+68,
+yycrank+775,   yysvec+21,      yyvstop+71,
+yycrank+785,   yysvec+21,      yyvstop+74,
+yycrank+860,   yysvec+21,      yyvstop+78,
+yycrank+870,   yysvec+21,      yyvstop+81,
+yycrank+113,   yysvec+21,      yyvstop+84,
+yycrank+880,   yysvec+21,      yyvstop+87,
+yycrank+895,   yysvec+21,      yyvstop+90,
+yycrank+0,     0,              yyvstop+93,
+yycrank+15,    0,              yyvstop+95,
+yycrank+0,     0,              yyvstop+97,
+yycrank+17,    0,              yyvstop+99,
+yycrank+0,     0,              yyvstop+101,
+yycrank+19,    0,              yyvstop+103,
+yycrank+0,     0,              yyvstop+105,
+yycrank+-491,  0,              yyvstop+107,
+yycrank+21,    0,              yyvstop+109,
+yycrank+19,    0,              yyvstop+111,
+yycrank+911,   0,              yyvstop+113,
+yycrank+20,    yysvec+52,      yyvstop+116,
+yycrank+15,    yysvec+52,      yyvstop+119,
+yycrank+0,     yysvec+16,      yyvstop+122,
+yycrank+0,     0,              yyvstop+124,
+yycrank+-1033, 0,              yyvstop+126,
+yycrank+0,     yysvec+21,      yyvstop+128,
+yycrank+172,   yysvec+21,      yyvstop+131,
+yycrank+996,   yysvec+21,      yyvstop+133,
+yycrank+231,   yysvec+21,      yyvstop+135,
+yycrank+1006,  yysvec+21,      yyvstop+137,
+yycrank+810,   yysvec+21,      yyvstop+139,
+yycrank+1051,  yysvec+21,      yyvstop+141,
+yycrank+1061,  yysvec+21,      yyvstop+143,
+yycrank+1092,  yysvec+21,      yyvstop+145,
+yycrank+1102,  yysvec+21,      yyvstop+147,
+yycrank+1113,  yysvec+21,      yyvstop+149,
+yycrank+1133,  yysvec+21,      yyvstop+151,
+yycrank+1150,  yysvec+21,      yyvstop+153,
+yycrank+1174,  yysvec+21,      yyvstop+155,
+yycrank+290,   yysvec+21,      yyvstop+157,
+yycrank+1184,  yysvec+21,      yyvstop+160,
+yycrank+1206,  yysvec+21,      yyvstop+162,
+yycrank+1216,  yysvec+21,      yyvstop+164,
+yycrank+1243,  yysvec+21,      yyvstop+166,
+yycrank+1253,  yysvec+21,      yyvstop+168,
+yycrank+1278,  yysvec+21,      yyvstop+170,
+yycrank+1288,  yysvec+21,      yyvstop+172,
+yycrank+1323,  yysvec+21,      yyvstop+174,
+yycrank+1342,  yysvec+21,      yyvstop+176,
+yycrank+1356,  yysvec+21,      yyvstop+178,
+yycrank+820,   yysvec+21,      yyvstop+180,
+yycrank+1382,  yysvec+21,      yyvstop+182,
+yycrank+1457,  yysvec+21,      yyvstop+185,
+yycrank+1392,  yysvec+21,      yyvstop+187,
+yycrank+1467,  yysvec+21,      yyvstop+189,
+yycrank+1478,  yysvec+21,      yyvstop+191,
+yycrank+1502,  yysvec+21,      yyvstop+193,
+yycrank+0,     0,              yyvstop+195,
+yycrank+31,    0,              0,      
+yycrank+44,    0,              0,      
+yycrank+0,     yysvec+49,      0,      
+yycrank+0,     0,              yyvstop+197,
+yycrank+0,     0,              yyvstop+199,
+yycrank+-1535, 0,              yyvstop+201,
+yycrank+0,     yysvec+52,      yyvstop+203,
+yycrank+45,    yysvec+52,      yyvstop+205,
+yycrank+36,    yysvec+52,      yyvstop+207,
+yycrank+1541,  yysvec+21,      yyvstop+209,
+yycrank+1553,  yysvec+21,      yyvstop+211,
+yycrank+1402,  yysvec+21,      yyvstop+214,
+yycrank+1516,  yysvec+21,      yyvstop+216,
+yycrank+1563,  yysvec+21,      yyvstop+219,
+yycrank+1592,  yysvec+21,      yyvstop+221,
+yycrank+1602,  yysvec+21,      yyvstop+223,
+yycrank+1612,  yysvec+21,      yyvstop+225,
+yycrank+1638,  yysvec+21,      yyvstop+227,
+yycrank+1650,  yysvec+21,      yyvstop+229,
+yycrank+1670,  yysvec+21,      yyvstop+231,
+yycrank+1680,  yysvec+21,      yyvstop+233,
+yycrank+1692,  yysvec+21,      yyvstop+235,
+yycrank+1702,  yysvec+21,      yyvstop+237,
+yycrank+1721,  yysvec+21,      yyvstop+239,
+yycrank+1731,  yysvec+21,      yyvstop+241,
+yycrank+1741,  yysvec+21,      yyvstop+243,
+yycrank+1757,  yysvec+21,      yyvstop+245,
+yycrank+1779,  yysvec+21,      yyvstop+247,
+yycrank+1789,  yysvec+21,      yyvstop+249,
+yycrank+1812,  yysvec+21,      yyvstop+251,
+yycrank+1822,  yysvec+21,      yyvstop+254,
+yycrank+1832,  yysvec+21,      yyvstop+256,
+yycrank+1848,  yysvec+21,      yyvstop+258,
+yycrank+1858,  yysvec+21,      yyvstop+260,
+yycrank+1880,  yysvec+21,      yyvstop+262,
+yycrank+1890,  yysvec+21,      yyvstop+264,
+yycrank+1900,  yysvec+21,      yyvstop+267,
+yycrank+1914,  yysvec+21,      yyvstop+269,
+yycrank+1924,  yysvec+21,      yyvstop+271,
+yycrank+1934,  yysvec+21,      yyvstop+273,
+yycrank+1950,  yysvec+21,      yyvstop+275,
+yycrank+20,    0,              0,      
+yycrank+21,    0,              0,      
+yycrank+22,    yysvec+52,      yyvstop+277,
+yycrank+53,    yysvec+52,      yyvstop+279,
+yycrank+1960,  yysvec+21,      yyvstop+281,
+yycrank+1982,  yysvec+21,      yyvstop+283,
+yycrank+1995,  yysvec+21,      yyvstop+285,
+yycrank+2005,  yysvec+21,      yyvstop+287,
+yycrank+2037,  yysvec+21,      yyvstop+289,
+yycrank+2047,  yysvec+21,      yyvstop+291,
+yycrank+2057,  yysvec+21,      yyvstop+293,
+yycrank+2083,  yysvec+21,      yyvstop+295,
+yycrank+2094,  yysvec+21,      yyvstop+297,
+yycrank+2105,  yysvec+21,      yyvstop+299,
+yycrank+2115,  yysvec+21,      yyvstop+301,
+yycrank+2131,  yysvec+21,      yyvstop+304,
+yycrank+2151,  yysvec+21,      yyvstop+306,
+yycrank+2161,  yysvec+21,      yyvstop+308,
+yycrank+2173,  yysvec+21,      yyvstop+310,
+yycrank+2184,  yysvec+21,      yyvstop+312,
+yycrank+2194,  yysvec+21,      yyvstop+315,
+yycrank+2205,  yysvec+21,      yyvstop+318,
+yycrank+2216,  yysvec+21,      yyvstop+320,
+yycrank+2236,  yysvec+21,      yyvstop+322,
+yycrank+2246,  yysvec+21,      yyvstop+325,
+yycrank+2256,  yysvec+21,      yyvstop+327,
+yycrank+2266,  yysvec+21,      yyvstop+329,
+yycrank+2277,  yysvec+21,      yyvstop+331,
+yycrank+2287,  yysvec+21,      yyvstop+334,
+yycrank+2301,  yysvec+21,      yyvstop+336,
+yycrank+2311,  yysvec+21,      yyvstop+338,
+yycrank+2338,  yysvec+21,      yyvstop+340,
+yycrank+2348,  yysvec+21,      yyvstop+342,
+yycrank+2358,  yysvec+21,      yyvstop+344,
+yycrank+87,    0,              0,      
+yycrank+40,    0,              0,      
+yycrank+53,    yysvec+52,      yyvstop+346,
+yycrank+40,    yysvec+52,      yyvstop+348,
+yycrank+2393,  yysvec+21,      yyvstop+350,
+yycrank+2411,  yysvec+21,      yyvstop+352,
+yycrank+2421,  yysvec+21,      yyvstop+355,
+yycrank+2431,  yysvec+21,      yyvstop+358,
+yycrank+2449,  yysvec+21,      yyvstop+360,
+yycrank+2467,  yysvec+21,      yyvstop+362,
+yycrank+2487,  yysvec+21,      yyvstop+364,
+yycrank+2497,  yysvec+21,      yyvstop+366,
+yycrank+2507,  yysvec+21,      yyvstop+368,
+yycrank+2517,  yysvec+21,      yyvstop+370,
+yycrank+2539,  yysvec+21,      yyvstop+372,
+yycrank+2557,  yysvec+21,      yyvstop+374,
+yycrank+2567,  yysvec+21,      yyvstop+376,
+yycrank+2577,  yysvec+21,      yyvstop+379,
+yycrank+2592,  yysvec+21,      yyvstop+381,
+yycrank+2610,  yysvec+21,      yyvstop+383,
+yycrank+2620,  yysvec+21,      yyvstop+385,
+yycrank+2630,  yysvec+21,      yyvstop+387,
+yycrank+2647,  yysvec+21,      yyvstop+389,
+yycrank+2663,  yysvec+21,      yyvstop+391,
+yycrank+2673,  yysvec+21,      yyvstop+393,
+yycrank+2685,  yysvec+21,      yyvstop+395,
+yycrank+2695,  yysvec+21,      yyvstop+398,
+yycrank+2717,  yysvec+21,      yyvstop+400,
+yycrank+2727,  yysvec+21,      yyvstop+402,
+yycrank+74,    0,              0,      
+yycrank+65,    0,              0,      
+yycrank+70,    0,              0,      
+yycrank+72,    yysvec+52,      yyvstop+404,
+yycrank+85,    yysvec+52,      yyvstop+406,
+yycrank+2737,  yysvec+21,      yyvstop+408,
+yycrank+2763,  yysvec+21,      yyvstop+410,
+yycrank+2773,  yysvec+21,      yyvstop+412,
+yycrank+2783,  yysvec+21,      yyvstop+414,
+yycrank+2808,  yysvec+21,      yyvstop+416,
+yycrank+2818,  yysvec+21,      yyvstop+419,
+yycrank+2836,  yysvec+21,      yyvstop+421,
+yycrank+2846,  yysvec+21,      yyvstop+423,
+yycrank+2856,  yysvec+21,      yyvstop+425,
+yycrank+2868,  yysvec+21,      yyvstop+427,
+yycrank+2885,  yysvec+21,      yyvstop+430,
+yycrank+2903,  yysvec+21,      yyvstop+432,
+yycrank+2913,  yysvec+21,      yyvstop+435,
+yycrank+2923,  yysvec+21,      yyvstop+438,
+yycrank+2933,  yysvec+21,      yyvstop+441,
+yycrank+2943,  yysvec+21,      yyvstop+443,
+yycrank+2955,  yysvec+21,      yyvstop+445,
+yycrank+2965,  yysvec+21,      yyvstop+448,
+yycrank+2985,  yysvec+21,      yyvstop+450,
+yycrank+2998,  yysvec+21,      yyvstop+453,
+yycrank+3008,  yysvec+21,      yyvstop+455,
+yycrank+75,    0,              0,      
+yycrank+92,    0,              0,      
+yycrank+97,    0,              0,      
+yycrank+96,    yysvec+52,      yyvstop+457,
+yycrank+96,    yysvec+52,      yyvstop+459,
+yycrank+3018,  yysvec+21,      yyvstop+461,
+yycrank+3035,  yysvec+21,      yyvstop+463,
+yycrank+3055,  yysvec+21,      yyvstop+466,
+yycrank+3065,  yysvec+21,      yyvstop+468,
+yycrank+3075,  yysvec+21,      yyvstop+470,
+yycrank+3092,  yysvec+21,      yyvstop+472,
+yycrank+3112,  yysvec+21,      yyvstop+474,
+yycrank+3123,  yysvec+21,      yyvstop+477,
+yycrank+3133,  yysvec+21,      yyvstop+480,
+yycrank+3143,  yysvec+21,      yyvstop+482,
+yycrank+3162,  yysvec+21,      yyvstop+485,
+yycrank+3172,  yysvec+21,      yyvstop+487,
+yycrank+3182,  yysvec+21,      yyvstop+489,
+yycrank+3195,  yysvec+21,      yyvstop+491,
+yycrank+103,   0,              0,      
+yycrank+110,   0,              0,      
+yycrank+112,   0,              0,      
+yycrank+116,   yysvec+52,      yyvstop+494,
+yycrank+133,   yysvec+52,      yyvstop+496,
+yycrank+3208,  yysvec+21,      yyvstop+498,
+yycrank+3244,  yysvec+21,      yyvstop+501,
+yycrank+3258,  yysvec+21,      yyvstop+503,
+yycrank+3218,  yysvec+21,      yyvstop+505,
+yycrank+3268,  yysvec+21,      yyvstop+507,
+yycrank+3321,  yysvec+21,      yyvstop+510,
+yycrank+3331,  yysvec+21,      yyvstop+513,
+yycrank+3341,  yysvec+21,      yyvstop+515,
+yycrank+3353,  yysvec+21,      yyvstop+518,
+yycrank+129,   0,              0,      
+yycrank+0,     0,              yyvstop+520,
+yycrank+155,   0,              0,      
+yycrank+131,   yysvec+52,      yyvstop+522,
+yycrank+0,     yysvec+52,      yyvstop+524,
+yycrank+3402,  0,              0,      
+yycrank+3518,  yysvec+21,      yyvstop+527,
+yycrank+3365,  yysvec+21,      yyvstop+529,
+yycrank+3481,  yysvec+21,      yyvstop+531,
+yycrank+3424,  yysvec+21,      yyvstop+533,
+yycrank+3436,  yysvec+21,      yyvstop+536,
+yycrank+127,   0,              0,      
+yycrank+0,     0,              yyvstop+538,
+yycrank+144,   yysvec+52,      yyvstop+540,
+yycrank+140,   0,              0,      
+yycrank+3595,  yysvec+21,      yyvstop+542,
+yycrank+3491,  yysvec+21,      yyvstop+544,
+yycrank+3605,  yysvec+21,      yyvstop+547,
+yycrank+3540,  yysvec+21,      yyvstop+549,
+yycrank+0,     0,              yyvstop+552,
+yycrank+151,   yysvec+52,      yyvstop+554,
+yycrank+163,   0,              0,      
+yycrank+3636,  yysvec+21,      yyvstop+556,
+yycrank+3550,  yysvec+21,      yyvstop+558,
+yycrank+154,   yysvec+52,      yyvstop+561,
+yycrank+138,   0,              0,      
+yycrank+3615,  yysvec+21,      yyvstop+563,
+yycrank+175,   yysvec+52,      yyvstop+565,
+yycrank+168,   0,              0,      
+yycrank+3646,  yysvec+21,      yyvstop+567,
+yycrank+0,     0,              yyvstop+569,
+yycrank+159,   0,              0,      
+yycrank+3666,  yysvec+21,      yyvstop+571,
+yycrank+162,   0,              0,      
+yycrank+3676,  yysvec+21,      yyvstop+573,
+yycrank+158,   0,              0,      
+yycrank+3686,  yysvec+21,      yyvstop+575,
+yycrank+158,   0,              0,      
+yycrank+3707,  yysvec+21,      yyvstop+577,
+yycrank+205,   0,              0,      
+yycrank+3722,  yysvec+21,      yyvstop+579,
+yycrank+194,   0,              0,      
+yycrank+3744,  yysvec+21,      yyvstop+581,
+yycrank+189,   0,              0,      
+yycrank+3754,  yysvec+21,      yyvstop+583,
+yycrank+215,   0,              0,      
+yycrank+3764,  yysvec+21,      yyvstop+585,
+yycrank+0,     0,              yyvstop+587,
+0,     0,      0};
+struct yywork *yytop = yycrank+3838;
+struct yysvf *yybgin = yysvec+1;
+char yymatch[] = {
+  0,   1,   1,   1,   1,   1,   1,   1, 
+  1,   9,  10,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  9,   1,   1,   1,   1,   1,   1,  39, 
+ 40,  40,   1,   1,  44,  45,  44,   1, 
+ 48,  48,  48,  48,  48,  48,  48,  48, 
+ 48,  48,  40,  40,   1,  40,   1,  44, 
+  1,  65,  65,  65,  65,  65,  65,  65, 
+ 65,  65,  65,  65,  65,  65,  65,  65, 
+ 65,  65,  65,  65,  65,  65,  65,  65, 
+ 65,  65,  65,   1,  44,   1,   1,  95, 
+  1,  95,  95,  95,  95,  95,  95,  95, 
+ 95,  95,  95,  95,  95,  95,  95,  95, 
+ 95,  95,  95,  95,  95,  95,  95,  95, 
+ 95,  95,  95,   1,  45,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+0};
+char yyextra[] = {
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0};
+/*     Copyright (c) 1989 AT&T */
+/*       All Rights Reserved   */
+
+/*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
+/*     The copyright notice above does not evidence any        */
+/*     actual or intended publication of such source code.     */
+
+#pragma ident  "@(#)ncform     6.11    97/01/06 SMI"
+
+int yylineno =1;
+# define YYU(x) x
+# define NLSTATE yyprevious=YYNEWLINE
+struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
+char yysbuf[YYLMAX];
+char *yysptr = yysbuf;
+int *yyfnd;
+extern struct yysvf *yyestate;
+int yyprevious = YYNEWLINE;
+#if defined(__cplusplus) || defined(__STDC__)
+int yylook(void)
+#else
+yylook()
+#endif
+{
+       register struct yysvf *yystate, **lsp;
+       register struct yywork *yyt;
+       struct yysvf *yyz;
+       int yych, yyfirst;
+       struct yywork *yyr;
+# ifdef LEXDEBUG
+       int debug;
+# endif
+       char *yylastch;
+       /* start off machines */
+# ifdef LEXDEBUG
+       debug = 0;
+# endif
+       yyfirst=1;
+       if (!yymorfg)
+               yylastch = yytext;
+       else {
+               yymorfg=0;
+               yylastch = yytext+yyleng;
+               }
+       for(;;){
+               lsp = yylstate;
+               yyestate = yystate = yybgin;
+               if (yyprevious==YYNEWLINE) yystate++;
+               for (;;){
+# ifdef LEXDEBUG
+                       if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
+# endif
+                       yyt = yystate->yystoff;
+                       if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
+                               yyz = yystate->yyother;
+                               if(yyz == 0)break;
+                               if(yyz->yystoff == yycrank)break;
+                               }
+#ifndef __cplusplus
+                       *yylastch++ = yych = input();
+#else
+                       *yylastch++ = yych = lex_input();
+#endif
+#ifdef YYISARRAY
+                       if(yylastch > &yytext[YYLMAX]) {
+                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                               exit(1);
+                       }
+#else
+                       if (yylastch >= &yytext[ yytextsz ]) {
+                               int     x = yylastch - yytext;
+
+                               yytextsz += YYTEXTSZINC;
+                               if (yytext == yy_tbuf) {
+                                   yytext = (char *) malloc(yytextsz);
+                                   memcpy(yytext, yy_tbuf, sizeof (yy_tbuf));
+                               }
+                               else
+                                   yytext = (char *) realloc(yytext, yytextsz);
+                               if (!yytext) {
+                                   fprintf(yyout,
+                                       "Cannot realloc yytext\n");
+                                   exit(1);
+                               }
+                               yylastch = yytext + x;
+                       }
+#endif
+                       yyfirst=0;
+               tryagain:
+# ifdef LEXDEBUG
+                       if(debug){
+                               fprintf(yyout,"char ");
+                               allprint(yych);
+                               putchar('\n');
+                               }
+# endif
+                       yyr = yyt;
+                       if ( (int)yyt > (int)yycrank){
+                               yyt = yyr + yych;
+                               if (yyt <= yytop && yyt->verify+yysvec == yystate){
+                                       if(yyt->advance+yysvec == YYLERR)       /* error transitions */
+                                               {unput(*--yylastch);break;}
+                                       *lsp++ = yystate = yyt->advance+yysvec;
+                                       if(lsp > &yylstate[YYLMAX]) {
+                                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                                               exit(1);
+                                       }
+                                       goto contin;
+                                       }
+                               }
+# ifdef YYOPTIM
+                       else if((int)yyt < (int)yycrank) {              /* r < yycrank */
+                               yyt = yyr = yycrank+(yycrank-yyt);
+# ifdef LEXDEBUG
+                               if(debug)fprintf(yyout,"compressed state\n");
+# endif
+                               yyt = yyt + yych;
+                               if(yyt <= yytop && yyt->verify+yysvec == yystate){
+                                       if(yyt->advance+yysvec == YYLERR)       /* error transitions */
+                                               {unput(*--yylastch);break;}
+                                       *lsp++ = yystate = yyt->advance+yysvec;
+                                       if(lsp > &yylstate[YYLMAX]) {
+                                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                                               exit(1);
+                                       }
+                                       goto contin;
+                                       }
+                               yyt = yyr + YYU(yymatch[yych]);
+# ifdef LEXDEBUG
+                               if(debug){
+                                       fprintf(yyout,"try fall back character ");
+                                       allprint(YYU(yymatch[yych]));
+                                       putchar('\n');
+                                       }
+# endif
+                               if(yyt <= yytop && yyt->verify+yysvec == yystate){
+                                       if(yyt->advance+yysvec == YYLERR)       /* error transition */
+                                               {unput(*--yylastch);break;}
+                                       *lsp++ = yystate = yyt->advance+yysvec;
+                                       if(lsp > &yylstate[YYLMAX]) {
+                                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                                               exit(1);
+                                       }
+                                       goto contin;
+                                       }
+                               }
+                       if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
+# ifdef LEXDEBUG
+                               if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
+# endif
+                               goto tryagain;
+                               }
+# endif
+                       else
+                               {unput(*--yylastch);break;}
+               contin:
+# ifdef LEXDEBUG
+                       if(debug){
+                               fprintf(yyout,"state %d char ",yystate-yysvec-1);
+                               allprint(yych);
+                               putchar('\n');
+                               }
+# endif
+                       ;
+                       }
+# ifdef LEXDEBUG
+               if(debug){
+                       fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
+                       allprint(yych);
+                       putchar('\n');
+                       }
+# endif
+               while (lsp-- > yylstate){
+                       *yylastch-- = 0;
+                       if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
+                               yyolsp = lsp;
+                               if(yyextra[*yyfnd]){            /* must backup */
+                                       while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
+                                               lsp--;
+                                               unput(*yylastch--);
+                                               }
+                                       }
+                               yyprevious = YYU(*yylastch);
+                               yylsp = lsp;
+                               yyleng = yylastch-yytext+1;
+                               yytext[yyleng] = 0;
+# ifdef LEXDEBUG
+                               if(debug){
+                                       fprintf(yyout,"\nmatch ");
+                                       sprint(yytext);
+                                       fprintf(yyout," action %d\n",*yyfnd);
+                                       }
+# endif
+                               return(*yyfnd++);
+                               }
+                       unput(*yylastch);
+                       }
+               if (yytext[0] == 0  /* && feof(yyin) */)
+                       {
+                       yysptr=yysbuf;
+                       return(0);
+                       }
+#ifndef __cplusplus
+               yyprevious = yytext[0] = input();
+               if (yyprevious>0)
+                       output(yyprevious);
+#else
+               yyprevious = yytext[0] = lex_input();
+               if (yyprevious>0)
+                       lex_output(yyprevious);
+#endif
+               yylastch=yytext;
+# ifdef LEXDEBUG
+               if(debug)putchar('\n');
+# endif
+               }
+       }
+#if defined(__cplusplus) || defined(__STDC__)
+int yyback(int *p, int m)
+#else
+yyback(p, m)
+       int *p;
+#endif
+{
+       if (p==0) return(0);
+       while (*p) {
+               if (*p++ == m)
+                       return(1);
+       }
+       return(0);
+}
+       /* the following are only used in the lex library */
+#if defined(__cplusplus) || defined(__STDC__)
+int yyinput(void)
+#else
+yyinput()
+#endif
+{
+#ifndef __cplusplus
+       return(input());
+#else
+       return(lex_input());
+#endif
+       }
+#if defined(__cplusplus) || defined(__STDC__)
+void yyoutput(int c)
+#else
+yyoutput(c)
+  int c; 
+#endif
+{
+#ifndef __cplusplus
+       output(c);
+#else
+       lex_output(c);
+#endif
+       }
+#if defined(__cplusplus) || defined(__STDC__)
+void yyunput(int c)
+#else
+yyunput(c)
+   int c; 
+#endif
+{
+       unput(c);
+       }
diff --git a/src/ExpToCasExe/exptocas.h b/src/ExpToCasExe/exptocas.h
new file mode 100644 (file)
index 0000000..385a582
--- /dev/null
@@ -0,0 +1,102 @@
+#ifndef EXPCAS_H
+#define EXPCAS_H
+
+#include <stdio.h>
+
+#define EC_VERSION       "2.0"
+
+struct ec_schema {       /* definition of schema */
+  char *name;            /* name */
+  struct ec_item *items; /* list of items */
+  int num;               /* total amount of items */
+  struct ec_item **array;/* array of items (indexed view of list) */
+};
+
+enum ecitem {            /* kind of schema item */
+  ECIT_ENUM,             /* TYPE ENUMERATION */
+  ECIT_SEL,              /* TYPE SELECT */
+  ECIT_ALIAS,            /* TYPE as alias */
+  ECIT_ENT               /* ENTITY */
+};
+
+struct ec_item {         /* definition of schema item */
+  char *name;            /* item (class) name */
+  char *package;         /* package name */
+  enum ecitem kind;      /* kind of item */
+  struct ec_type *alias; /* aliased type for ALIAS */
+  struct ec_tlist *types;/* supertypes for ENTITY and list for SELECT and ENUMERATION */
+  struct ec_field *field;/* fields for ENTITY */
+  struct ec_item *next;  /* pointer to next item */
+};
+
+struct ec_tlist {        /* list of (type) names, for TYPE SELECT & ENUMERATION */
+  char *name;
+  struct ec_tlist *next;
+};
+
+enum ectype {            /* Types: */
+  ECTYP_INT,             /* predefined type INTEGER */
+  ECTYP_NUM,             /* predefined type NUMBER */
+  ECTYP_DBL,             /* predefined type REAL */
+  ECTYP_STR,             /* predefined type STRING */
+  ECTYP_LOG,             /* predefined type LOGICAL */
+  ECTYP_BOOL,            /* predefined type BOOLEAN */
+  ECTYP_NAME,            /* named type (name of item in schema) */
+  ECTYP_LIST,            /* LIST [] complex type */
+  ECTYP_ARR,             /* ARRAY [] complex type */
+  ECTYP_SET,             /* SET [] complex type */
+  ECTYP_BAG              /* BAG [] complex type */
+};
+
+struct ec_type {         /* identification of type, either simple or complex */
+  enum ectype kind;      /* kind of the type */
+  char *name;            /* name for named type */
+  int index[2];          /* start and end indices (or -1 if not defined) for complex types */
+  struct ec_type *elem;  /* type of complex type elements */
+};
+
+struct ec_field {        /* field of ENTITY item */
+  char *name;            /* field name */
+  struct ec_type *type;  /* field type */
+  int optional;          /* flag */
+  struct ec_field *next; /* pointer to next field */
+};
+
+/*int yylex ( void );*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern FILE *yyin;
+
+int yyparse ( void );
+int yyerror ( char *str );
+
+/* Functions for creating schema representation structures */
+struct ec_schema *mkschema ( char *name, struct ec_item *ilist );
+struct ec_item *mkenum     ( char *name, struct ec_tlist *tlist );
+struct ec_item *mkselect   ( char *name, struct ec_tlist *tlist );
+struct ec_item *mkalias    ( char *name, struct ec_type *to );
+struct ec_item *mkentity   ( char *name, struct ec_tlist *inherit, struct ec_field *fields );
+struct ec_tlist *mktlist   ( char *name );
+struct ec_type *mktstd     ( int keyword );
+struct ec_type *mktname    ( char *name );
+struct ec_type *mktset     ( int keyword, int ilow, int ihigh, struct ec_type *of );
+struct ec_field *mkfield   ( char *name, struct ec_type *type, int optional );
+
+/* Error reporting functions */
+int ec_error ( char *s, char *text );
+int ec_curline ( void );
+
+/* Access to result of parsing */
+char *ec_schemaname ( void );           /* returns name of schema */
+int ec_nbitems ( void );                /* returns number of items in schema */
+struct ec_item *ec_getitem ( int num ); /* returns item by index */
+void ec_free ( void );                  /* frees all structures */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/ExpToCasExe/exptocas.html b/src/ExpToCasExe/exptocas.html
new file mode 100644 (file)
index 0000000..8bc7b59
--- /dev/null
@@ -0,0 +1,51 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+   <meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; I; SunOS 5.6 sun4u) [Netscape]">
+   <title>ExpToCas: Generator of STEP read/write classes from EXPRESS schema</title>
+</head>
+<body text="#000040" bgcolor="#C0C0C0" link="#0000EE" vlink="#551A8B" alink="#FF0000" background="http://info.nnov.matra-dtv.fr/~det/images/StandardBackground.gif" nosave>
+<!-- <body text="#000040" bgcolor="#C0C0FF" link="#0000EE" vlink="#551A8B" alink="#FF0000"> -->
+<h1>ExpToCas: Generator of STEP read/write classes from EXPRESS schema</h1>
+
+<hr>
+<h2>Abstract</h2>
+
+This document describes <b>ExpToCas</b>, a package defining several parsers of 
+EXPRESS schema aimed to analyse the schema and generate STEP read/write classes
+for Open CASCADE Data Exchange (XSTEP).
+
+<hr>
+<h2>Basic principles</h2>
+
+EXPRESS schema is parsed by tools based on 
+<a href="http://info.nnov.matra-dtv.fr/scriptsdet/man2html?flex">lex</a> 
+(scanner) and <a href="http://www.nnov.matra-dtv.fr/~det/bison/bison_toc.html">yacc</a>
+(parser).
+
+<p>
+
+
+<hr>
+<h2>Organisation</h2>
+
+<p>
+Physically ExpToCas is organised as two WOK units:
+
+<h4>CDL package ExpToCas</h4>
+
+Defines set of classes to represent structure of 
+EXPRESS file (more accurately to say, schema). It represents data contained 
+in EXPRESS schema as list of items (e.g. definition of ENTITY and SELECT
+types). Each item has methods to generate relevant CDL/CXX classes for 
+CASCADE.
+
+<h4>Executable ExpToCasExe</h4>
+
+Provides executable (named ExpToCas) allowing to load EXPRESS file to memory
+(to the structure of classes from ExpToCas package) and generate CDL/CXX classes
+for user-defined list of entities.
+
+</body>
+</html>
diff --git a/src/ExpToCasExe/exptocas.l b/src/ExpToCasExe/exptocas.l
new file mode 100644 (file)
index 0000000..1360f89
--- /dev/null
@@ -0,0 +1,165 @@
+%{
+
+/* File:       exptocas.l                     */
+/* Created:    Thu Oct 28 12:21:16 1999       */
+/* Author:     Andrey BETENEV                 */
+/*             <abv@doomox.nnov.matra-dtv.fr> */
+/* Copyright:  Matra Datavision 1999          */
+
+/*****************************************************************************\
+
+This LEX scanner is performs lexical analysis of EXPRESS schema file   
+for EXPRESS -> CASCADE/XSTEP classes generator                             
+
+On the stage of lexical scanner comments (single- and multi-line),         
+definitions of CONSTANT, FUNCTION, RULE items and clauses WHERE, INVERSE
+and DERIVE of TYPE amd ENTITY items are dismissed (ignored)         
+
+Then, keywords such as ENTITY, SUPERTYPE, SET etc., names of items         
+and special symbols are identified and returned to parser (yacc) as tokens 
+
+Also, error processing and current line number tracking functions are defined
+
+\*****************************************************************************/
+
+/************************************/
+/* Section 1                        */
+/* definitions                      */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <ExpToCas_HSequenceOfField.hxx>
+#include <ExpToCas_HSequenceOfItem.hxx>
+#include <ExpToCas_Field.hxx>
+#include <ExpToCas_Item.hxx>
+#include <ExpToCas_Type.hxx>
+#include <ExpToCas_Schema.hxx>
+#include <ExpToCas_Reference.hxx>
+
+#include "expparse.h"       /* define tokens */
+
+/* Auxiliary functions */
+
+static int fun_level=0;
+static int ec_linenum=1;
+static int ec_state = 0;
+
+int yywrap(void) { return 1; }
+
+int ec_curline ( void )
+{
+  return ec_linenum;
+}
+
+int ec_error ( char *s, char *text )
+{
+  printf ( "\nError at line %d: %s \"%s\"\n", ec_curline(), s, text );
+  return 0;
+}
+
+%}
+
+%s TYP ENT
+%x COMM SKP RULE FUN
+
+%a 4000
+%o 6000
+
+%{
+
+/************************************/
+/* Section 2                        */
+/* parsing rules                    */
+%}
+
+%%
+
+"--".*               { /* Eat line comments */ }
+"(*"                 { ec_state = YYSTATE; BEGIN(COMM); }
+<COMM>.              { /* Eat multiline comments */ }
+<COMM>"*)"           { BEGIN(ec_state); }
+
+"SCHEMA"             { return yylval.num = KSCHEM; }
+"END_SCHEMA"         { return yylval.num = KENDS; }
+
+"TYPE"               { BEGIN(TYP); return yylval.num = KTYP; }
+<TYP,SKP>"END_TYPE"  { BEGIN(0);   return yylval.num = KENDT; }
+
+"ENTITY"             { BEGIN(ENT); return yylval.num = KENT; }
+<ENT,SKP>"END_ENTITY" { BEGIN(0);  return yylval.num = KENDE; }
+
+<ENT>"INVERSE"       |
+<ENT>"DERIVE"        |
+<ENT,TYP>"WHERE"     { BEGIN(SKP); }
+<SKP>.               { /* eat contents of WHERE and DERIVE subclauses of ENTITY and TYPE */ }
+
+"SELECT"             { return yylval.num = KSEL; }
+"ENUMERATION"        { return yylval.num = KENUM; }
+"LIST"               { return yylval.num = KLIST; }
+"ARRAY"              { return yylval.num = KARR; }
+"SET"                { return yylval.num = KSET; }
+"BAG"                { return yylval.num = KBAG; }
+"OF"                 { return yylval.num = KOF; }
+
+"NUMBER"             { return yylval.num = KNUM; }
+"INTEGER"            { return yylval.num = KINT; }
+"REAL"               { return yylval.num = KDBL; }
+"STRING"             { return yylval.num = KSTR; }
+"LOGICAL"            { return yylval.num = KLOG; }
+"BOOLEAN"            { return yylval.num = KBOOL; }
+
+"OPTIONAL"           { return yylval.num = KOPT; }
+"UNIQUE"             { return yylval.num = KUNIQ; }
+"SELF"               { return yylval.num = KSELF; }
+
+"ABSTRACT"           { return yylval.num = KABSTR; }
+"SUBTYPE"            { return yylval.num = KSUBT; }
+"SUPERTYPE"          { return yylval.num = KSPRT; }
+"ANDOR"              { return yylval.num = KANDOR; }
+"ONEOF"              { return yylval.num = K1OF; }
+"AND"                { return yylval.num = KAND; }
+
+"UR"[0-9]+           { yylval.str = strdup ( yytext ); return NAME; }
+
+[a-z_][a-z_0-9]*     { yylval.str = strdup ( yytext ); return NAME; }
+
+[0-9]+               { yylval.num = atoi ( yytext ); return NUMBER; }
+[,=();?:.\\]|"["|"]" { return yylval.num = yytext[0]; }
+
+<INITIAL,FUN>"FUNCTION"  { BEGIN(FUN); fun_level++; }
+<FUN>"(*"            { ec_state = YYSTATE; BEGIN(COMM); /* eat comments in functions */ }
+<FUN>"--".*          { /* Eat line comments in functions */ }
+<FUN>[A-Za-z_0-9]*   { /* eat FUNCTIONs - skip IDs explicitly */ }
+<FUN>\'[^\']*\'      { /* eat FUNCTIONs - skip strings explicitly */ }
+<FUN>.               { /* eat FUNCTIONs - skip all other symbols in functions */ }
+<FUN>"END_FUNCTION;" { fun_level--; if ( ! fun_level ) BEGIN(0); }
+
+"RULE"               { BEGIN(RULE); /* eat RULEs */ }
+<RULE>.              { /* eat RULEs */ }
+<RULE>"END_RULE;"    { BEGIN(0); }
+
+"CONSTANT"[ \t\na-z_0-9:=;'()|-]+"END_CONSTANT;" { /* eat CONSTANTs */
+                       char *s = yytext; /* but don't forget to count lines.. */
+                       while ( *s ) if ( *(s++) == '\n' ) ec_linenum++;
+                     }
+
+[ \t]+               { /* eat spaces */ }
+[A-Za-z0-9_]+        { ec_error ( "unknown keyword ", yytext ); /* put unrecognized keywords to cerr */ }
+.                    { ec_error ( "unknown symbol ", yytext ); /* put unrecognized data to cerr */ }
+
+<INITIAL,COMM,SKP,RULE,ENT,TYP,FUN>\n  { ec_linenum++; /* count lines */ }
+
+%%
+
+/************************************/
+/* Section 3                        */
+/* auxiliary procedures             */
+
+/*
+int main ( void )
+{
+  yylex();
+}
+*/
diff --git a/src/ExpToCasExe/exptocas.y b/src/ExpToCasExe/exptocas.y
new file mode 100644 (file)
index 0000000..efdc9fe
--- /dev/null
@@ -0,0 +1,442 @@
+%{
+
+/* File:       exptocas.y                     */
+/* Created:    Thu Oct 28 12:21:16 1999       */
+/* Author:     Andrey BETENEV                 */
+/*             <abv@doomox.nnov.matra-dtv.fr> */
+/* Copyright:  Matra Datavision 1999          */
+
+/*****************************************************************************\
+
+This YACC parser implements parsing algorithm for EXPRESS -> CASCADE/XSTEP
+classes generator
+
+Input in the form of tokens is obtained from lexical analyser. Then, data 
+structure representing schema is created on the basis of grammar analysis.
+
+NOTE: The grammar currently implemented is not full. 
+FUNCTION, RULE and CONSTANT items, WHERE, INVERSE and DERIVE clauses 
+of TYPE and ENTITY items are not considered (ignored on the level of lexical 
+scanner). 
+SUPERTYPE and UNIQUE clauses of ENTITY item are recognized but ignored.
+Also, complex constructs such as using call to function in dimensions of 
+complex time or redefinition of inherited field are ignored.
+
+\*****************************************************************************/
+
+#include <values.h>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <ExpToCas_HSequenceOfField.hxx>
+#include <ExpToCas_HSequenceOfItem.hxx>
+#include <ExpToCas_Field.hxx>
+#include <ExpToCas_Item.hxx>
+#include <ExpToCas_Enum.hxx>
+#include <ExpToCas_Alias.hxx>
+#include <ExpToCas_Select.hxx>
+#include <ExpToCas_Entity.hxx>
+#include <ExpToCas_Type.hxx>
+#include <ExpToCas_NamedType.hxx>
+#include <ExpToCas_PredefinedType.hxx>
+#include <ExpToCas_Number.hxx>
+#include <ExpToCas_Integer.hxx>
+#include <ExpToCas_Boolean.hxx>
+#include <ExpToCas_Logical.hxx>
+#include <ExpToCas_Real.hxx>
+#include <ExpToCas_String.hxx>
+#include <ExpToCas_ComplexType.hxx>
+#include <ExpToCas_Array.hxx>
+#include <ExpToCas_List.hxx>
+#include <ExpToCas_Set.hxx>
+#include <ExpToCas_Bag.hxx>
+#include <ExpToCas_Schema.hxx>
+#include <ExpToCas_Reference.hxx>
+#include <ExpToCas.hxx>
+
+/************************************************/
+/* ERROR MESSAGE FUNCTION                       */
+
+/* external functions (from exptocas.l) */
+int ec_error ( char *s, char *text );
+int ec_curline ( void );
+
+int yyerror ( char *s )
+{
+  printf ( "\nParse error at line %d: %s\n", ec_curline(), s );
+  return 0;
+}
+
+/************************************************/
+/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
+
+static ExpToCas_Schema *mkschema ( char *name, ExpToCas_HSequenceOfItem *ilist );
+static ExpToCas_HSequenceOfItem *mkilist ( ExpToCas_Item *item, ExpToCas_HSequenceOfItem *seq );
+static ExpToCas_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
+static ExpToCas_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
+static ExpToCas_Item *mkalias ( char *name, ExpToCas_Type *type );
+static ExpToCas_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
+                                ExpToCas_HSequenceOfField *field, int isabstract );
+static ExpToCas_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items);
+static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
+static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1, TColStd_HSequenceOfHAsciiString *tlist2 );
+static ExpToCas_Type *mktstd ( int keyword );
+static ExpToCas_Type *mktname ( char *name );
+static ExpToCas_Type *mktset ( int keyword, int ilow, int ihigh, ExpToCas_Type *of );
+static ExpToCas_Field *mkfield ( char *name, ExpToCas_Type *type, int optional );
+static ExpToCas_HSequenceOfField *mkflist ( ExpToCas_Field *field, ExpToCas_HSequenceOfField *seq );
+
+%}
+
+  /* Definition of possible types of expressions */
+%union {
+  int num;
+  char *str;
+  TColStd_HSequenceOfHAsciiString *tlist;
+  ExpToCas_HSequenceOfField *flist;
+  ExpToCas_HSequenceOfItem *ilist;
+  ExpToCas_Field *field;
+  ExpToCas_Item *item;
+  ExpToCas_Type *type;
+  ExpToCas_Schema *schema;
+  ExpToCas_Reference *ref;
+}
+
+  /* Definition of keywords */
+
+%token <num> KSCHEM  /* SCHEMA keyword */
+%token <num> KENDS   /* END_SCHEMA keyword */
+%token <num> KTYP    /* TYPE keyword */
+%token <num> KENDT   /* END_TYPE keyword */
+%token <num> KENT    /* ENTITY keyword */
+%token <num> KENDE   /* END_ENTITY keyword */
+%token <num> KREF    /* REFERENCE keyword */
+%token <num> KFROM   /* FROM keyword */
+
+%token <num> KSEL    /* SELECT keyword */
+%token <num> KENUM   /* ENUMERATION keyword */
+%token <num> KLIST   /* LIST keyword */
+%token <num> KARR    /* ARRAY keyword */
+%token <num> KBAG    /* BAG keyword */
+%token <num> KSET    /* SET keyword */
+%token <num> KOF     /* OF keyword */
+
+%token <num> KNUM    /* NUMBER keyword */
+%token <num> KINT    /* INTEGER keyword */
+%token <num> KDBL    /* REAL keyword */
+%token <num> KSTR    /* STRING keyword */
+%token <num> KLOG    /* LOGICAL keyword */
+%token <num> KBOOL   /* BOOLEAN keyword */
+
+%token <num> KOPT    /* OPTIONAL keyword */
+%token <num> KUNIQ   /* UNIQUE keyword */
+%token <num> KSELF   /* SELF keyword */
+
+%token <num> KABSTR  /* ABSTRACT keyword */
+%token <num> KSUBT   /* SUBTYPE keyword */
+%token <num> KSPRT   /* SUPERTYPE keyword */
+%left  <num> KANDOR  /* ANDOR keyword (%left is for eliminating shift/reduce conflict on SUPLST) */
+%left  <num> K1OF    /* ONEOF keyword */
+%token <num> KAND    /* AND keyword */
+
+%token <num> NUMBER  /* integer value */
+%token <str> NAME    /* name of type or entity */
+
+%left ','            /* to eliminate shift/reduce conflict in SUPERTYPE */
+
+  /* Definition of expressions and their types */
+
+%type <num>    INDEX OPTNL OPTUNI SUPERT SUPLST REDEF SPCLST
+%type <tlist>  TLIST TLIST1 UNIQIT UNIQLS UNIQUE SUBT SPECIF
+%type <type>   TYPE TSTD TNAME TSET 
+%type <item>   ENUM SELECT ALIAS ENTITY ITEM
+%type <ilist>  ILIST
+%type <field>  FIELD
+%type <flist>  FLIST FLIST1
+%type <schema> SCHEMA
+%type <ref>    REFERENCE
+
+%%
+
+  /************************************************/
+  /*  Definition of parsing rules (expressions)   */
+  /************************************************/
+
+SCHEMA: KSCHEM NAME ';' ILIST KENDS ';' { $$ = mkschema ( $2, $4 ); /* Root: EXPRESS schema */ }
+      ;
+ILIST : ITEM             { $$ = mkilist ( $1, 0 ); /* list of items for schema */ }
+      | ITEM ILIST       { $$ = mkilist ( $1, $2 ); }
+      ;
+
+ITEM  : ENUM
+      | SELECT
+      | ALIAS
+      | ENTITY           { $$ = $1; /* item of schema (type definition) */ }
+ENUM  : KTYP NAME '=' KENUM KOF TLIST1 ';' KENDT ';' { $$ = mkenum ( $2, $6 ); /* TYPE ENUMERATION definition */ }
+      ;
+SELECT: KTYP NAME '=' KSEL TLIST1 ';' KENDT ';' { $$ = mkselect ( $2, $5 ); /* TYPE SELECT definition */ }
+      ;
+ALIAS : KTYP NAME '=' TYPE ';' KENDT ';' { $$ = mkalias ( $2, $4 ); /* TYPE '=' definition (alias) */ }
+      ;
+ENTITY: KENT NAME        SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';' { $$ = mkentity ( $2, $4, $6, 0 ); /* ENTITY definition */ }
+      | KENT NAME KABSTR SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';' { $$ = mkentity ( $2, $5, $7, 1 ); /* ENTITY definition */ }
+      ;
+
+REFERENCE: KREF KFROM NAME TLIST1 ';' { $$ = mkrefs ( $3, $4 ); /* REFERENCE FROM definition */ }
+
+TLIST : NAME             { $$ = mktlist ( $1, 0 ); /* list of (type) names */ }
+      | NAME ',' TLIST   { $$ = mktlist ( $1, $3 ); }
+      ;
+TLIST1: '(' TLIST ')'    { $$ = $2; /* TLIST in brackets */ }
+      ;
+
+TYPE  : TSTD
+      | TNAME
+      | TSET             { $$ = $1; /* type, simple or complex */ }
+      ;
+TSTD  : KINT             { $$ = mktstd ( $1 ); /* predefined type: INTEGER */ }
+      | KNUM             { $$ = mktstd ( $1 ); /* predefined type: NUMBER */ }
+      | KDBL             { $$ = mktstd ( $1 ); /* predefined type: REAL */ }
+      | KSTR             { $$ = mktstd ( $1 ); /* predefined type: STRING */ }
+      | KLOG             { $$ = mktstd ( $1 ); /* predefined type: LOGICAL */ }
+      | KBOOL            { $$ = mktstd ( $1 ); /* predefined type: BOOLEAN */ }
+      ;                  
+TNAME : NAME             { $$ = mktname ( $1 ); /* named type */ }
+      ;
+TSET  : KLIST '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: LIST */ }
+      | KARR  '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: ARRAY */ }
+      | KSET  '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: SET */ }
+      | KBAG  '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: BAG */ }
+      ;
+INDEX : NUMBER           { $$ = $1; /* index for array, set, bag, list range */ }
+      | '?'              { $$ = -1; /* undefined */ }
+      | NAME '(' NAME ')' {$$ = -1; printf ( "Warning at line %d: index function %s(%s) ignored\n", ec_curline(), $1, $3 ); /* some function.. */ }
+      ;
+OPTUNI: /* empty */      { $$ = 0; /* UNIQUE keyword for complex type definition */ }
+      | KUNIQ            { $$ = 1; }
+      ;
+
+SUBT  : /* empty */      { $$ = NULL; /* no subtype clause */ }
+      | KSUBT KOF TLIST1 { $$ = $3;   /* subtype clause */ }
+      ;
+SUPERT: /* empty */      { $$ = 0;  /* no supertype clause */ }
+      | KSPRT            { $$ = 0;  /* supertype clause (ignored) */ }
+      | KSPRT KOF SUPLST { $$ = 0;  /* supertype clause (ignored) */ }
+      ;
+SUPLST: NAME             { $$ = 0; /* simple list of supertypes */ }
+      | '(' SUPLST ')'   { $$ = 0; /* allow bracketing */ }
+      | NAME ',' SUPLST  { $$ = 0; /* ... */ }
+      | K1OF SUPLST      { $$ = 0; /* ONEOF construct */ }
+      | SUPLST KANDOR SUPLST { $$ = 0; /* ANDOR construct */ }
+      ;
+
+FLIST : FIELD            { $$ = mkflist ( $1, 0 ); /* list of fields of ENTITY item */ }
+      | FIELD FLIST      { $$ = mkflist ( $1, $2 ); }
+      | REDEF            { $$ = 0;  /* redefinition of inherited field, just skip */ }
+      | REDEF FLIST      { $$ = 0; }
+      ;
+FLIST1: /* empty */      { $$ = NULL; /* empty list of fields */ }
+      | FLIST            { $$ = $1;   /* or not empty.. just to fix reduce/reduce conflict */ }
+      ;
+FIELD : NAME ':' OPTNL TYPE ';' { $$ = mkfield ( $1, $4, $3 ); }
+      ;
+REDEF : KSELF '\\' SPECIF ':' TYPE ';' { $$ = NULL; printf ( "Warning at line %d: field redefinition ignored\n", ec_curline() ); /* redefinition of inherited field */ }
+      ;
+SPECIF: NAME             { $$ = mktlist ( $1, 0 ); /* inherited field specification */ } 
+      | NAME '.' SPECIF  { $$ = mktlist ( $1, $3 ); }
+      ;
+
+OPTNL : /* empty */      { $$ = 0; }
+      | KOPT             { $$ = 1; }
+      ;
+
+UNIQIT: NAME ':' TLIST ';'  { $$ = $3;   /* UNIQUE statement */ }
+      | NAME ':' SPCLST ';' { $$ = NULL; /* UNIQUE statement */ }
+      ;
+UNIQLS: UNIQIT           { $$ = NULL;    /* list of 1 UNIQUE statements */ }
+      | UNIQIT UNIQLS    { $$ = mktlists ( $1, $2 );/* list of UNIQUE statements */ }
+      ;
+UNIQUE: /* empty */      { $$ = NULL;    /* no UNIQUE clause in ENTITY */ }
+      | KUNIQ UNIQLS     { $$ = $2;      /* UNIQUE clause in ENTITY */ }
+      ;
+SPCLST: KSELF '\\' SPECIF      { $$ = 0; /* list of specifications */ }
+      | KSELF '\\' SPECIF ',' SPCLST { $$ = 0; }
+      | NAME ',' SPCLST        { $$ = 0; }
+      ;
+
+%%
+
+/************************************************/
+/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
+
+static ExpToCas_Schema *mkschema ( char *name, ExpToCas_HSequenceOfItem *ilist )
+{
+  ExpToCas_Schema *sch = new ExpToCas_Schema ( name, ilist );
+  ExpToCas::Schema() = sch;
+  return sch;
+}
+
+static ExpToCas_HSequenceOfItem *mkilist ( ExpToCas_Item *item, ExpToCas_HSequenceOfItem *seq )
+{
+  if ( ! seq ) { 
+    seq = new ExpToCas_HSequenceOfItem;
+    seq->Append ( item );
+  }
+  else seq->Prepend ( item );
+  return seq;
+}
+
+static ExpToCas_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
+{
+  return new ExpToCas_Enum ( name, tlist );
+}
+
+static ExpToCas_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
+{
+  return new ExpToCas_Select ( name, tlist );
+}
+
+static ExpToCas_Item *mkalias ( char *name, ExpToCas_Type *type )
+{
+  return new ExpToCas_Alias ( name, type );
+}
+
+static ExpToCas_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
+                                ExpToCas_HSequenceOfField *field, int isabstract )
+{
+  ExpToCas_Entity *ent = new ExpToCas_Entity ( name, inherit, field );
+  if ( isabstract ) ent->SetAbstractFlag ( Standard_True );
+  return ent;
+}
+
+static ExpToCas_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items)
+{
+  return new ExpToCas_Reference ( name, items );
+}
+
+static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
+{
+  Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString ( name );
+  if ( tlist ) tlist->Prepend ( str );
+  else {
+    tlist = new TColStd_HSequenceOfHAsciiString;
+    tlist->Append ( str );
+  }
+  return tlist;
+}
+
+static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1, 
+                                                  TColStd_HSequenceOfHAsciiString *tlist2 )
+{
+  if ( ! tlist1 ) return tlist2;
+  if ( ! tlist2 ) return tlist1;
+  for ( int i=1; i <= tlist2->Length(); i++ )
+    tlist1->Append ( tlist2->Value(i) );
+  return tlist1;
+}
+
+static ExpToCas_Type *mktstd ( int keyword )
+{
+  switch ( keyword ) {
+  case KINT : return new ExpToCas_Integer;
+  case KNUM : return new ExpToCas_Number;
+  case KDBL : return new ExpToCas_Real;
+  case KSTR : return new ExpToCas_String;
+  case KBOOL: return new ExpToCas_Boolean;
+  case KLOG : return new ExpToCas_Logical;
+  default   : ec_error ( "Predefined type not treated!", "" );
+              return NULL;
+  }
+}
+
+static ExpToCas_Type *mktname ( char *name )
+{
+  return new ExpToCas_NamedType ( name );
+}
+
+static ExpToCas_Type *mktset ( int keyword, int ilow, int ihigh, ExpToCas_Type *of )
+{
+  switch ( keyword ) {
+  case KLIST: return new ExpToCas_List  ( ilow, ihigh, of );
+  case KARR : return new ExpToCas_Array ( ilow, ihigh, of );
+  case KBAG : return new ExpToCas_Bag   ( ilow, ihigh, of );
+  case KSET : return new ExpToCas_Set   ( ilow, ihigh, of );
+  default   : ec_error ( "Complex type not treated!", "" );
+              return NULL;
+  }
+}
+
+static ExpToCas_Field *mkfield ( char *name, ExpToCas_Type *type, int optional )
+{
+  return new ExpToCas_Field ( name, type, optional );
+}
+
+static ExpToCas_HSequenceOfField *mkflist ( ExpToCas_Field *field, ExpToCas_HSequenceOfField *seq )
+{
+  if ( seq ) seq->Prepend ( field );
+  else {
+    seq = new ExpToCas_HSequenceOfField;
+    seq->Append ( field );
+  }
+  return seq;
+}
+
+/*******************************************************************/
+/* External interface to result of parsing */
+
+Handle(ExpToCas_Schema) ec_parse ( FILE *fin )
+{
+  extern FILE *yyin;
+  yyin = fin;
+  yyparse();
+  return ExpToCas::Schema();
+}
+
+/*******************************************************************/
+/* MAIN & co */
+
+/*
+void tlistfree ( struct tlist *list )
+{
+  if ( ! list ) return;
+  tlistfree ( list->next );
+  list->next = 0;
+  free ( list->str );
+  list->str = 0;
+}
+* /
+
+int printtlist ( struct ec_tlist *tl )
+{
+  int num=0;
+  while ( tl ) {
+    num++;
+    printf ( "%s\n", tl->name );
+    tl = tl->next;
+  }
+  return num;
+}
+
+int main ( void )
+{
+  int num = 0;
+  yyparse();
+
+  printf ( "\nFinished\n" );
+  if ( schema ) {
+    struct ec_item *it;
+    it = schema->items;
+    printf ( "\nSchema %s", schema->name );
+    printf ( "\nItems:" );
+    while ( it ) {
+      num++;
+      printf ( "\n%s", it->name );
+      it = it->next;
+    }
+//    num = printtlist ( res );
+    printf ( "\nTotal %d", num );
+  }
+
+/*  tlistfree ( yylval.tlist ); * /
+  return num;
+}
+*/
diff --git a/src/ExpToCasExe/lex.yy.c b/src/ExpToCasExe/lex.yy.c
new file mode 100644 (file)
index 0000000..ed53260
--- /dev/null
@@ -0,0 +1,1008 @@
+#include <stdio.h>
+#include <stdlib.h>
+# define U(x) x
+# define NLSTATE yyprevious=YYNEWLINE
+# define BEGIN yybgin = yysvec + 1 +
+# define INITIAL 0
+# define YYLERR yysvec
+# define YYSTATE (yyestate-yysvec-1)
+# define YYOPTIM 1
+# ifndef YYLMAX 
+# define YYLMAX BUFSIZ
+# endif 
+#ifndef __cplusplus
+# define output(c) (void)putc(c,yyout)
+#else
+# define lex_output(c) (void)putc(c,yyout)
+#endif
+
+#if defined(__cplusplus) || defined(__STDC__)
+
+#if defined(__cplusplus) && defined(__EXTERN_C__)
+extern "C" {
+#endif
+       int yyback(int *, int);
+       int yyinput(void);
+       int yylook(void);
+       void yyoutput(int);
+       int yyracc(int);
+       int yyreject(void);
+       void yyunput(int);
+       int yylex(void);
+#ifdef YYLEX_E
+       void yywoutput(wchar_t);
+       wchar_t yywinput(void);
+#endif
+#ifndef yyless
+       int yyless(int);
+#endif
+#ifndef yywrap
+       int yywrap(void);
+#endif
+#ifdef LEXDEBUG
+       void allprint(char);
+       void sprint(char *);
+#endif
+#if defined(__cplusplus) && defined(__EXTERN_C__)
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+       void exit(int);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
+# define yymore() (yymorfg=1)
+#ifndef __cplusplus
+# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+#else
+# define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+#endif
+#define ECHO fprintf(yyout, "%s",yytext)
+# define REJECT { nstr = yyreject(); goto yyfussy;}
+int yyleng;
+#define YYISARRAY
+char yytext[YYLMAX];
+int yymorfg;
+extern char *yysptr, yysbuf[];
+int yytchar;
+FILE *yyin = {stdin}, *yyout = {stdout};
+extern int yylineno;
+struct yysvf { 
+       struct yywork *yystoff;
+       struct yysvf *yyother;
+       int *yystops;};
+struct yysvf *yyestate;
+extern struct yysvf yysvec[], *yybgin;
+
+
+# line 4 "explist.l"
+/* This LEX scanner produces list of items included in the EXPRESS schema  */
+
+# line 5 "explist.l"
+/* (TYPE, ENTITY, FUNCTION, RULE) */
+
+
+# line 7 "explist.l"
+/************************************/
+
+# line 8 "explist.l"
+/* Section 1                        */
+
+# line 9 "explist.l"
+/* definitions                      */
+# define CONST 2
+# define TYP 4
+# define TYP1 6
+# define ENT 8
+# define ENT1 10
+# define LIST 12
+# define COMM 14
+# define SKP 16
+# define FUN 18
+# define FUN1 20
+# define RUL 22
+
+static int fun_level=0;
+
+
+# line 26 "explist.l"
+/************************************/
+
+# line 27 "explist.l"
+/* Section 2                        */
+
+# line 28 "explist.l"
+/* parsing rules                    */
+# define YYNEWLINE 10
+yylex(){
+int nstr; extern int yyprevious;
+#ifdef __cplusplus
+/* to avoid CC and lint complaining yyfussy not being used ...*/
+static int __lex_hack = 0;
+if (__lex_hack) goto yyfussy;
+#endif
+while((nstr = yylook()) >= 0)
+yyfussy: switch(nstr){
+case 0:
+if(yywrap()) return(0); break;
+case 1:
+
+# line 32 "explist.l"
+              ;
+break;
+case 2:
+
+# line 33 "explist.l"
+                { printf ( "Starting multiline comment\n" ); BEGIN(COMM); }
+break;
+case 3:
+
+# line 34 "explist.l"
+          ;
+break;
+case 4:
+
+# line 35 "explist.l"
+          { printf ( "End of multiline comment\n" ); BEGIN(0); }
+break;
+case 5:
+
+# line 37 "explist.l"
+    printf ( "Starting %s\n", yytext );
+break;
+case 6:
+
+# line 38 "explist.l"
+         printf ( "Schema finished\n" );
+break;
+case 7:
+
+# line 40 "explist.l"
+                { BEGIN(TYP); }
+break;
+case 8:
+
+# line 41 "explist.l"
+         { printf ( "TYPE %s\n", yytext ); BEGIN(TYP1); }
+break;
+case 9:
+
+# line 42 "explist.l"
+          ;
+break;
+case 10:
+
+# line 43 "explist.l"
+ { printf ( "\n" ); BEGIN(0); }
+break;
+case 11:
+
+# line 45 "explist.l"
+              { BEGIN(ENT); }
+break;
+case 12:
+
+# line 46 "explist.l"
+         { printf ( "ENTITY %s\n", yytext ); BEGIN(ENT1); }
+break;
+case 13:
+
+# line 47 "explist.l"
+          ;
+break;
+case 14:
+
+# line 48 "explist.l"
+ BEGIN(0);
+break;
+case 15:
+
+# line 50 "explist.l"
+     case 16:
+
+# line 51 "explist.l"
+      BEGIN(SKP);
+break;
+case 17:
+
+# line 52 "explist.l"
+           ;
+break;
+case 18:
+
+# line 54 "explist.l"
+ { BEGIN(FUN); fun_level++; }
+break;
+case 19:
+
+# line 55 "explist.l"
+         { printf ( "FUNCTION %s\n", yytext ); BEGIN(FUN1); }
+break;
+case 20:
+
+# line 56 "explist.l"
+          ;
+break;
+case 21:
+
+# line 57 "explist.l"
+ { fun_level--; if ( ! fun_level ) BEGIN(0); }
+break;
+case 22:
+
+# line 59 "explist.l"
+                { BEGIN(RUL); }
+break;
+case 23:
+
+# line 60 "explist.l"
+         { printf ( "RULE %s\n", yytext ); BEGIN(SKP); }
+break;
+case 24:
+
+# line 61 "explist.l"
+       BEGIN(0);
+break;
+case 25:
+
+# line 63 "explist.l"
+                ;
+break;
+case -1:
+break;
+default:
+(void)fprintf(yyout,"bad switch yylook %d",nstr);
+} return(0); }
+/* end of yylex */
+
+# line 66 "explist.l"
+
+/************************************/
+/* Section 3                        */
+/* calling and auxiliary procedures */
+
+int main ( void )
+{
+  yylex();
+}
+
+int yywrap(void) { return 1; }
+int yyvstop[] = {
+0,
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+25,
+0, 
+
+8,
+0, 
+
+9,
+0, 
+
+9,
+0, 
+
+12,
+0, 
+
+13,
+0, 
+
+13,
+0, 
+
+3,
+0, 
+
+3,
+0, 
+
+17,
+0, 
+
+17,
+0, 
+
+19,
+0, 
+
+20,
+0, 
+
+20,
+0, 
+
+20,
+0, 
+
+20,
+0, 
+
+23,
+0, 
+
+2,
+0, 
+
+1,
+0, 
+
+4,
+0, 
+
+22,
+0, 
+
+7,
+0, 
+
+16,
+0, 
+
+11,
+0, 
+
+15,
+0, 
+
+18,
+0, 
+
+10,
+0, 
+
+24,
+0, 
+
+5,
+0, 
+
+14,
+0, 
+
+6,
+0, 
+
+21,
+0, 
+0};
+# define YYTYPE unsigned char
+struct yywork { YYTYPE verify, advance; } yycrank[] = {
+0,0,   0,0,    1,25,   0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    1,25,   1,25,   
+0,0,   0,0,    2,32,   2,32,   
+0,0,   0,0,    22,52,  22,52,  
+32,62, 32,62,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   1,26,   111,119,        32,62,  
+0,0,   2,26,   1,27,   0,0,    
+45,69, 1,25,   2,27,   16,45,  
+15,44, 26,56,  27,57,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+15,44, 15,44,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    1,28,   5,34,   
+5,35,  8,39,   2,28,   2,33,   
+12,43, 18,47,  22,51,  22,53,  
+30,60, 32,63,  34,65,  1,29,   
+1,30,  1,31,   7,38,   2,29,   
+2,30,  2,31,   5,36,   28,58,  
+29,59, 15,45,  7,38,   7,38,   
+1,25,  31,61,  5,37,   15,44,  
+5,37,  5,37,   5,37,   5,37,   
+5,37,  5,37,   5,37,   5,37,   
+5,37,  5,37,   5,37,   5,37,   
+5,37,  5,37,   5,37,   5,37,   
+5,37,  5,37,   5,37,   5,37,   
+5,37,  5,37,   5,37,   5,37,   
+5,37,  5,37,   33,64,  35,66,  
+36,67, 40,68,  47,70,  48,71,  
+54,72, 7,38,   58,73,  59,75,  
+60,76, 61,77,  64,78,  65,79,  
+66,80, 67,81,  68,82,  70,83,  
+71,84, 72,85,  15,44,  73,86,  
+74,87, 75,88,  58,74,  76,89,  
+77,90, 9,40,   7,39,   78,91,  
+79,92, 80,93,  81,94,  82,95,  
+83,96, 84,97,  85,98,  86,99,  
+87,100,        89,101, 91,102, 92,103, 
+57,57, 93,104, 94,105, 95,106, 
+97,108,        98,107, 99,109, 100,110,        
+57,57, 57,0,   101,111,        9,41,   
+7,38,  9,41,   9,41,   9,41,   
+9,41,  9,41,   9,41,   9,41,   
+9,41,  9,41,   9,41,   9,41,   
+9,41,  9,41,   9,41,   9,41,   
+9,41,  9,41,   9,41,   9,41,   
+9,41,  9,41,   9,41,   9,41,   
+9,41,  9,41,   9,41,   10,40,  
+102,112,       103,113,        104,114,        106,115,        
+107,116,       96,106, 11,42,  57,57,  
+17,46, 108,117,        109,118,        112,120,        
+114,121,       115,122,        11,42,  11,42,  
+17,46, 17,46,  96,107, 116,123,        
+96,104,        117,124,        118,125,        120,127,        
+121,128,       10,41,  122,129,        10,41,  
+10,41, 10,41,  10,41,  10,41,  
+10,41, 10,41,  10,41,  10,41,  
+10,41, 10,41,  10,41,  10,41,  
+10,41, 10,41,  10,41,  10,41,  
+10,41, 10,41,  10,41,  10,41,  
+10,41, 10,41,  10,41,  10,41,  
+10,41, 11,42,  57,57,  17,46,  
+123,130,       124,131,        125,132,        126,126,        
+126,126,       126,126,        126,126,        126,126,        
+126,126,       126,126,        126,126,        126,126,        
+126,126,       129,134,        126,133,        131,135,        
+132,136,       134,137,        11,43,  19,48,  
+17,47, 135,138,        136,139,        138,140,        
+140,141,       0,0,    21,50,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    21,50,  21,50,  
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+11,42, 19,49,  17,46,  19,49,  
+19,49, 19,49,  19,49,  19,49,  
+19,49, 19,49,  19,49,  19,49,  
+19,49, 19,49,  19,49,  19,49,  
+19,49, 19,49,  19,49,  19,49,  
+19,49, 19,49,  19,49,  19,49,  
+19,49, 19,49,  19,49,  19,49,  
+19,49, 21,50,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   23,54,  21,51,  0,0,    
+0,0,   0,0,    0,0,    0,0,    
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    23,55,  
+21,50, 23,55,  23,55,  23,55,  
+23,55, 23,55,  23,55,  23,55,  
+23,55, 23,55,  23,55,  23,55,  
+23,55, 23,55,  23,55,  23,55,  
+23,55, 23,55,  23,55,  23,55,  
+23,55, 23,55,  23,55,  23,55,  
+23,55, 23,55,  23,55,  37,37,  
+0,0,   37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  37,37,  
+37,37, 37,37,  37,37,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    41,41,  0,0,    
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  41,41,  41,41,  
+41,41, 41,41,  49,49,  0,0,    
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  49,49,  49,49,  
+49,49, 49,49,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+119,126,       0,0,    119,126,        119,126,        
+119,126,       119,126,        119,126,        119,126,        
+119,126,       119,126,        119,126,        119,126,        
+119,126,       119,126,        119,126,        119,126,        
+119,126,       119,126,        119,126,        119,126,        
+119,126,       119,126,        119,126,        119,126,        
+119,126,       119,126,        119,126,        119,126,        
+0,0,   0,0,    0,0,    0,0,    
+0,0,   0,0,    0,0,    0,0,    
+0,0,   55,55,  0,0,    55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 55,55,  55,55,  55,55,  
+55,55, 0,0,    0,0,    0,0,    
+0,0};
+struct yysvf yysvec[] = {
+0,     0,      0,
+yycrank+-1,    0,              0,      
+yycrank+-5,    yysvec+1,       0,      
+yycrank+0,     0,              0,      
+yycrank+0,     0,              0,      
+yycrank+3,     0,              0,      
+yycrank+0,     yysvec+5,       0,      
+yycrank+-85,   0,              0,      
+yycrank+-4,    yysvec+7,       0,      
+yycrank+84,    yysvec+5,       0,      
+yycrank+138,   yysvec+5,       0,      
+yycrank+-213,  0,              0,      
+yycrank+-7,    yysvec+11,      0,      
+yycrank+0,     0,              0,      
+yycrank+0,     0,              0,      
+yycrank+-51,   0,              0,      
+yycrank+-9,    yysvec+15,      0,      
+yycrank+-215,  0,              0,      
+yycrank+-8,    yysvec+17,      0,      
+yycrank+214,   0,              0,      
+yycrank+0,     yysvec+19,      0,      
+yycrank+-289,  0,              0,      
+yycrank+-9,    yysvec+21,      0,      
+yycrank+288,   0,              0,      
+yycrank+0,     yysvec+23,      0,      
+yycrank+0,     0,              yyvstop+1,
+yycrank+11,    0,              yyvstop+3,
+yycrank+9,     0,              yyvstop+5,
+yycrank+13,    0,              yyvstop+7,
+yycrank+7,     0,              yyvstop+9,
+yycrank+13,    0,              yyvstop+11,
+yycrank+8,     0,              yyvstop+13,
+yycrank+11,    0,              yyvstop+15,
+yycrank+41,    0,              yyvstop+17,
+yycrank+13,    0,              0,      
+yycrank+49,    0,              0,      
+yycrank+56,    0,              0,      
+yycrank+316,   0,              yyvstop+19,
+yycrank+0,     0,              yyvstop+21,
+yycrank+0,     yysvec+35,      yyvstop+23,
+yycrank+51,    0,              0,      
+yycrank+391,   0,              yyvstop+25,
+yycrank+0,     0,              yyvstop+27,
+yycrank+0,     yysvec+40,      yyvstop+29,
+yycrank+0,     0,              yyvstop+31,
+yycrank+7,     0,              yyvstop+33,
+yycrank+0,     0,              yyvstop+35,
+yycrank+52,    0,              yyvstop+37,
+yycrank+53,    0,              0,      
+yycrank+419,   0,              yyvstop+39,
+yycrank+0,     0,              yyvstop+41,
+yycrank+0,     yysvec+48,      yyvstop+43,
+yycrank+0,     yysvec+32,      yyvstop+45,
+yycrank+0,     yysvec+33,      yyvstop+47,
+yycrank+54,    0,              0,      
+yycrank+494,   0,              yyvstop+49,
+yycrank+0,     0,              yyvstop+51,
+yycrank+-167,  0,              yyvstop+53,
+yycrank+66,    0,              0,      
+yycrank+59,    0,              0,      
+yycrank+64,    0,              0,      
+yycrank+57,    0,              0,      
+yycrank+0,     yysvec+32,      0,      
+yycrank+0,     yysvec+33,      0,      
+yycrank+60,    0,              0,      
+yycrank+57,    0,              0,      
+yycrank+72,    0,              0,      
+yycrank+72,    0,              0,      
+yycrank+74,    0,              0,      
+yycrank+0,     0,              yyvstop+55,
+yycrank+75,    0,              0,      
+yycrank+76,    0,              0,      
+yycrank+77,    0,              0,      
+yycrank+52,    0,              0,      
+yycrank+75,    0,              0,      
+yycrank+80,    0,              0,      
+yycrank+82,    0,              0,      
+yycrank+83,    0,              0,      
+yycrank+88,    0,              0,      
+yycrank+83,    0,              0,      
+yycrank+62,    0,              0,      
+yycrank+76,    0,              0,      
+yycrank+64,    0,              0,      
+yycrank+65,    0,              0,      
+yycrank+66,    0,              0,      
+yycrank+67,    0,              0,      
+yycrank+80,    0,              0,      
+yycrank+80,    0,              0,      
+yycrank+0,     0,              yyvstop+57,
+yycrank+88,    0,              0,      
+yycrank+0,     0,              yyvstop+59,
+yycrank+82,    0,              0,      
+yycrank+81,    0,              0,      
+yycrank+85,    0,              0,      
+yycrank+101,   0,              0,      
+yycrank+102,   0,              0,      
+yycrank+144,   0,              0,      
+yycrank+102,   0,              0,      
+yycrank+91,    0,              0,      
+yycrank+107,   0,              0,      
+yycrank+86,    0,              0,      
+yycrank+113,   0,              0,      
+yycrank+135,   0,              0,      
+yycrank+140,   0,              0,      
+yycrank+121,   0,              0,      
+yycrank+0,     0,              yyvstop+61,
+yycrank+133,   0,              0,      
+yycrank+127,   0,              0,      
+yycrank+132,   0,              0,      
+yycrank+146,   0,              0,      
+yycrank+0,     0,              yyvstop+63,
+yycrank+10,    0,              0,      
+yycrank+140,   0,              0,      
+yycrank+0,     0,              yyvstop+65,
+yycrank+140,   0,              0,      
+yycrank+137,   0,              0,      
+yycrank+151,   0,              0,      
+yycrank+151,   0,              0,      
+yycrank+161,   0,              0,      
+yycrank+457,   0,              0,      
+yycrank+153,   0,              0,      
+yycrank+163,   0,              0,      
+yycrank+161,   0,              0,      
+yycrank+195,   0,              0,      
+yycrank+198,   0,              0,      
+yycrank+189,   0,              0,      
+yycrank+219,   yysvec+119,     0,      
+yycrank+0,     0,              yyvstop+67,
+yycrank+0,     0,              yyvstop+69,
+yycrank+193,   0,              0,      
+yycrank+0,     0,              yyvstop+71,
+yycrank+195,   0,              0,      
+yycrank+215,   0,              0,      
+yycrank+0,     0,              yyvstop+73,
+yycrank+192,   0,              0,      
+yycrank+212,   0,              0,      
+yycrank+227,   0,              0,      
+yycrank+0,     0,              yyvstop+75,
+yycrank+208,   0,              0,      
+yycrank+0,     0,              yyvstop+77,
+yycrank+210,   0,              0,      
+yycrank+0,     0,              yyvstop+79,
+0,     0,      0};
+struct yywork *yytop = yycrank+616;
+struct yysvf *yybgin = yysvec+1;
+char yymatch[] = {
+  0,   1,   1,   1,   1,   1,   1,   1, 
+  1,   9,  10,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  9,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+ 48,  48,  48,  48,  48,  48,  48,  48, 
+ 48,  48,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,  95, 
+  1,  95,  95,  95,  95,  95,  95,  95, 
+ 95,  95,  95,  95,  95,  95,  95,  95, 
+ 95,  95,  95,  95,  95,  95,  95,  95, 
+ 95,  95,  95,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+  1,   1,   1,   1,   1,   1,   1,   1, 
+0};
+char yyextra[] = {
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0};
+/*     Copyright (c) 1989 AT&T */
+/*       All Rights Reserved   */
+
+/*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
+/*     The copyright notice above does not evidence any        */
+/*     actual or intended publication of such source code.     */
+
+#pragma ident  "@(#)ncform     6.11    97/01/06 SMI"
+
+int yylineno =1;
+# define YYU(x) x
+# define NLSTATE yyprevious=YYNEWLINE
+struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
+char yysbuf[YYLMAX];
+char *yysptr = yysbuf;
+int *yyfnd;
+extern struct yysvf *yyestate;
+int yyprevious = YYNEWLINE;
+#if defined(__cplusplus) || defined(__STDC__)
+int yylook(void)
+#else
+yylook()
+#endif
+{
+       register struct yysvf *yystate, **lsp;
+       register struct yywork *yyt;
+       struct yysvf *yyz;
+       int yych, yyfirst;
+       struct yywork *yyr;
+# ifdef LEXDEBUG
+       int debug;
+# endif
+       char *yylastch;
+       /* start off machines */
+# ifdef LEXDEBUG
+       debug = 0;
+# endif
+       yyfirst=1;
+       if (!yymorfg)
+               yylastch = yytext;
+       else {
+               yymorfg=0;
+               yylastch = yytext+yyleng;
+               }
+       for(;;){
+               lsp = yylstate;
+               yyestate = yystate = yybgin;
+               if (yyprevious==YYNEWLINE) yystate++;
+               for (;;){
+# ifdef LEXDEBUG
+                       if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
+# endif
+                       yyt = yystate->yystoff;
+                       if(yyt == yycrank && !yyfirst){  /* may not be any transitions */
+                               yyz = yystate->yyother;
+                               if(yyz == 0)break;
+                               if(yyz->yystoff == yycrank)break;
+                               }
+#ifndef __cplusplus
+                       *yylastch++ = yych = input();
+#else
+                       *yylastch++ = yych = lex_input();
+#endif
+#ifdef YYISARRAY
+                       if(yylastch > &yytext[YYLMAX]) {
+                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                               exit(1);
+                       }
+#else
+                       if (yylastch >= &yytext[ yytextsz ]) {
+                               int     x = yylastch - yytext;
+
+                               yytextsz += YYTEXTSZINC;
+                               if (yytext == yy_tbuf) {
+                                   yytext = (char *) malloc(yytextsz);
+                                   memcpy(yytext, yy_tbuf, sizeof (yy_tbuf));
+                               }
+                               else
+                                   yytext = (char *) realloc(yytext, yytextsz);
+                               if (!yytext) {
+                                   fprintf(yyout,
+                                       "Cannot realloc yytext\n");
+                                   exit(1);
+                               }
+                               yylastch = yytext + x;
+                       }
+#endif
+                       yyfirst=0;
+               tryagain:
+# ifdef LEXDEBUG
+                       if(debug){
+                               fprintf(yyout,"char ");
+                               allprint(yych);
+                               putchar('\n');
+                               }
+# endif
+                       yyr = yyt;
+                       if ( (int)yyt > (int)yycrank){
+                               yyt = yyr + yych;
+                               if (yyt <= yytop && yyt->verify+yysvec == yystate){
+                                       if(yyt->advance+yysvec == YYLERR)       /* error transitions */
+                                               {unput(*--yylastch);break;}
+                                       *lsp++ = yystate = yyt->advance+yysvec;
+                                       if(lsp > &yylstate[YYLMAX]) {
+                                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                                               exit(1);
+                                       }
+                                       goto contin;
+                                       }
+                               }
+# ifdef YYOPTIM
+                       else if((int)yyt < (int)yycrank) {              /* r < yycrank */
+                               yyt = yyr = yycrank+(yycrank-yyt);
+# ifdef LEXDEBUG
+                               if(debug)fprintf(yyout,"compressed state\n");
+# endif
+                               yyt = yyt + yych;
+                               if(yyt <= yytop && yyt->verify+yysvec == yystate){
+                                       if(yyt->advance+yysvec == YYLERR)       /* error transitions */
+                                               {unput(*--yylastch);break;}
+                                       *lsp++ = yystate = yyt->advance+yysvec;
+                                       if(lsp > &yylstate[YYLMAX]) {
+                                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                                               exit(1);
+                                       }
+                                       goto contin;
+                                       }
+                               yyt = yyr + YYU(yymatch[yych]);
+# ifdef LEXDEBUG
+                               if(debug){
+                                       fprintf(yyout,"try fall back character ");
+                                       allprint(YYU(yymatch[yych]));
+                                       putchar('\n');
+                                       }
+# endif
+                               if(yyt <= yytop && yyt->verify+yysvec == yystate){
+                                       if(yyt->advance+yysvec == YYLERR)       /* error transition */
+                                               {unput(*--yylastch);break;}
+                                       *lsp++ = yystate = yyt->advance+yysvec;
+                                       if(lsp > &yylstate[YYLMAX]) {
+                                               fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+                                               exit(1);
+                                       }
+                                       goto contin;
+                                       }
+                               }
+                       if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
+# ifdef LEXDEBUG
+                               if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
+# endif
+                               goto tryagain;
+                               }
+# endif
+                       else
+                               {unput(*--yylastch);break;}
+               contin:
+# ifdef LEXDEBUG
+                       if(debug){
+                               fprintf(yyout,"state %d char ",yystate-yysvec-1);
+                               allprint(yych);
+                               putchar('\n');
+                               }
+# endif
+                       ;
+                       }
+# ifdef LEXDEBUG
+               if(debug){
+                       fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
+                       allprint(yych);
+                       putchar('\n');
+                       }
+# endif
+               while (lsp-- > yylstate){
+                       *yylastch-- = 0;
+                       if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
+                               yyolsp = lsp;
+                               if(yyextra[*yyfnd]){            /* must backup */
+                                       while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
+                                               lsp--;
+                                               unput(*yylastch--);
+                                               }
+                                       }
+                               yyprevious = YYU(*yylastch);
+                               yylsp = lsp;
+                               yyleng = yylastch-yytext+1;
+                               yytext[yyleng] = 0;
+# ifdef LEXDEBUG
+                               if(debug){
+                                       fprintf(yyout,"\nmatch ");
+                                       sprint(yytext);
+                                       fprintf(yyout," action %d\n",*yyfnd);
+                                       }
+# endif
+                               return(*yyfnd++);
+                               }
+                       unput(*yylastch);
+                       }
+               if (yytext[0] == 0  /* && feof(yyin) */)
+                       {
+                       yysptr=yysbuf;
+                       return(0);
+                       }
+#ifndef __cplusplus
+               yyprevious = yytext[0] = input();
+               if (yyprevious>0)
+                       output(yyprevious);
+#else
+               yyprevious = yytext[0] = lex_input();
+               if (yyprevious>0)
+                       lex_output(yyprevious);
+#endif
+               yylastch=yytext;
+# ifdef LEXDEBUG
+               if(debug)putchar('\n');
+# endif
+               }
+       }
+#if defined(__cplusplus) || defined(__STDC__)
+int yyback(int *p, int m)
+#else
+yyback(p, m)
+       int *p;
+#endif
+{
+       if (p==0) return(0);
+       while (*p) {
+               if (*p++ == m)
+                       return(1);
+       }
+       return(0);
+}
+       /* the following are only used in the lex library */
+#if defined(__cplusplus) || defined(__STDC__)
+int yyinput(void)
+#else
+yyinput()
+#endif
+{
+#ifndef __cplusplus
+       return(input());
+#else
+       return(lex_input());
+#endif
+       }
+#if defined(__cplusplus) || defined(__STDC__)
+void yyoutput(int c)
+#else
+yyoutput(c)
+  int c; 
+#endif
+{
+#ifndef __cplusplus
+       output(c);
+#else
+       lex_output(c);
+#endif
+       }
+#if defined(__cplusplus) || defined(__STDC__)
+void yyunput(int c)
+#else
+yyunput(c)
+   int c; 
+#endif
+{
+       unput(c);
+       }
diff --git a/src/ExpToCasExe/mkexpformat b/src/ExpToCasExe/mkexpformat
new file mode 100644 (file)
index 0000000..2c3fc8e
--- /dev/null
@@ -0,0 +1,2 @@
+lex expformat.l
+cc lex.yy.c -o expformat
diff --git a/src/ExpToCasExe/mkexplist b/src/ExpToCasExe/mkexplist
new file mode 100644 (file)
index 0000000..6c8826a
--- /dev/null
@@ -0,0 +1,2 @@
+lex explist.l
+cc lex.yy.c -o explist
diff --git a/src/ExpToCasExe/mkparser b/src/ExpToCasExe/mkparser
new file mode 100644 (file)
index 0000000..255bd74
--- /dev/null
@@ -0,0 +1,5 @@
+rm -f yy.tab.c y.tab.h expparse.cxx expparse.h
+#yacc -v -d exptocas.y
+yacc -d exptocas.y
+mv y.tab.c expparse.cxx
+mv y.tab.h expparse.h
diff --git a/src/ExpToCasExe/mkscanner b/src/ExpToCasExe/mkscanner
new file mode 100644 (file)
index 0000000..bfcefb4
--- /dev/null
@@ -0,0 +1 @@
+lex -t exptocas.l >expscan.cxx
diff --git a/src/Express/Express.cxx b/src/Express/Express.cxx
new file mode 100644 (file)
index 0000000..eff38a2
--- /dev/null
@@ -0,0 +1,115 @@
+// Created:    Wed Nov  3 14:39:28 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express.hxx>
+#include <Express_Schema.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <OSD_Process.hxx>
+
+#include <time.h>
+//#include <pwd.h>
+
+//=======================================================================
+//function : Schema
+//purpose  : 
+//=======================================================================
+
+Handle(Express_Schema) &Express::Schema () 
+{
+  static Handle(Express_Schema) schema;
+  return schema;
+}
+                              
+//=======================================================================
+//function : WriteFileStamp
+//purpose  : 
+//=======================================================================
+
+// Write header of CDL or CXX file
+void Express::WriteFileStamp (Standard_OStream &os, 
+                              const Handle(TCollection_HAsciiString) &name,
+                              const Standard_Boolean isCDL)
+{
+  static const char *EC_VERSION = "2.0";
+
+  Standard_CString comm = ( isCDL ? "--" : "//" );
+  os << comm << " File:        " << name->ToCString();
+  os << (isCDL ? ".cdl" : ".cxx" ) << std::endl;
+
+  TCollection_AsciiString timestring;
+  if ( getenv ( "EXPTOCAS_TIME" ) ) timestring = getenv ( "EXPTOCAS_TIME" );
+  else {
+    time_t curtime;
+    time ( &curtime );
+    timestring = ctime ( &curtime );
+    timestring.ChangeAll ( '\n', ' ' );
+  }
+  os << comm << " Created:     " << timestring << std::endl;
+  
+  OSD_Process aProcess;
+  os << comm << " Author:      " << aProcess.UserName().ToCString() << std::endl;
+  
+  os << comm << " Generator:   Express (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << std::endl;
+//  if ( ! Express::Schema().IsNull() )
+//    os << comm << " Schema used:     " << Express::Schema()->Name()->ToCString() << std::endl;
+  os << comm << " Copyright:   Open CASCADE 2020" << std::endl;
+  os << std::endl;
+}
+
+//=======================================================================
+//function : WriteMethodStamp
+//purpose  : 
+//=======================================================================
+
+void Express::WriteMethodStamp (Standard_OStream &os, const Handle(TCollection_HAsciiString) &name)
+{
+  os << std::endl;
+  os << "//=======================================================================" << std::endl;
+  os << "//function : " << name->ToCString() << std::endl;
+  os << "//purpose  : " << std::endl;
+  os << "//=======================================================================" << std::endl;
+  os << std::endl;
+}
+
+//=======================================================================
+//function : ToStepName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express::ToStepName (const Handle(TCollection_HAsciiString) &name)
+{
+  Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString ( name );
+  for ( Standard_Integer i=2; i <= stepname->Length(); i++ )
+    if ( isupper ( stepname->Value(i) ) ) stepname->Insert ( i++, '_' );
+  stepname->LowerCase();
+  return stepname;
+}
+//=======================================================================
+//function : GetPrefixEnum
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express::EnumPrefix (const Handle(TCollection_HAsciiString) &name)
+{
+  Handle(TCollection_HAsciiString) stepname = new TCollection_HAsciiString; 
+  for ( Standard_Integer i=1; i <= name->Length(); i++ )
+    if ( isupper ( name->Value(i) ) ) {
+      
+      stepname->AssignCat (new TCollection_HAsciiString(name->Value(i)) );
+    }
+  stepname->LowerCase();
+  return stepname;
+}
+
diff --git a/src/Express/Express.hxx b/src/Express/Express.hxx
new file mode 100644 (file)
index 0000000..8016b6f
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_HeaderFile
+#define _Express_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Standard_OStream.hxx>
+#include <Standard_Boolean.hxx>
+
+class Express_Schema;
+class TCollection_HAsciiString;
+
+//! Provides data structures for representation of EXPRESS schema
+//! (items, types, entities etc.)
+//! and tools for generating XSTEP classes (CDL and CXX) from
+//! items of the schema
+class Express 
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  
+  //! Returns (modifiable) handle to static schema object
+  Standard_EXPORT static   Handle(Express_Schema)& Schema() ;
+  
+  //! Writes standard copyright stamp (creation date/time, user, etc.)
+  //! in CDL (if isCDL) or CXX (if ! isCDL) style to the output stream.
+  Standard_EXPORT static   void WriteFileStamp (Standard_OStream& os, const Handle(TCollection_HAsciiString)& name, const Standard_Boolean isCDL) ;
+  
+  //! Writes standard comment for method in CXX file
+  Standard_EXPORT static   void WriteMethodStamp (Standard_OStream& os, const Handle(TCollection_HAsciiString)& name) ;
+  
+  //! Converts item name from CASCADE to STEP style
+  //! e.g. BoundedCurve -> bounded_curve
+  Standard_EXPORT static   Handle(TCollection_HAsciiString) ToStepName (const Handle(TCollection_HAsciiString)& name) ;
+  
+  //! Converts item name from CASCADE to STEP style
+  //! e.g. BoundedCurve -> bounded_curve
+  Standard_EXPORT static   Handle(TCollection_HAsciiString) EnumPrefix (const Handle(TCollection_HAsciiString)& name) ;
+};
+
+#endif // _Express_HeaderFile
diff --git a/src/Express/Express_Alias.cxx b/src/Express/Express_Alias.cxx
new file mode 100644 (file)
index 0000000..d5cb35f
--- /dev/null
@@ -0,0 +1,72 @@
+// Created:    Tue Nov  2 14:40:06 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Alias.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Alias,Express_Item)
+
+//=======================================================================
+//function : Express_Alias
+//purpose  : 
+//=======================================================================
+
+Express_Alias::Express_Alias (const Standard_CString name, 
+                               const Handle(Express_Type) &type)
+     : Express_Item(name), myType(type)
+{
+}
+
+//=======================================================================
+//function : Type
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_Type) &Express_Alias::Type () const
+{
+  return myType;
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Alias::CPPName () const
+{
+  return myType->CPPName();
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Alias::CDLName () const
+{
+  return myType->CDLName();
+}
+
+//=======================================================================
+//function : GenerateClass
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Alias::GenerateClass () const
+{
+//  std::cout << "Warning: writing ALIAS is not yet implemented, cannot generate " << Name()->ToCString() << std::endl;
+  std::cout << "ALIAS " << Name()->ToCString() << " = " << Type()->CDLName()->ToCString() << " used; no generation is needed" << std::endl;
+  return Standard_False;
+}
diff --git a/src/Express/Express_Alias.hxx b/src/Express/Express_Alias.hxx
new file mode 100644 (file)
index 0000000..7b2be42
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Alias_HeaderFile
+#define _Express_Alias_HeaderFile
+
+#include <Standard_Type.hxx>
+#include <Express_Item.hxx>
+#include <Express_Type.hxx>
+
+class TCollection_HAsciiString;
+
+
+//! Implements TYPE = type (alias) item of the EXPRESS
+//! schema, with interface for deferred Item class.
+class Express_Alias : public Express_Item
+{
+
+public:
+
+  
+  //! Create ALIAS item and initialize it
+  Standard_EXPORT Express_Alias(const Standard_CString name, const Handle(Express_Type)& type);
+  
+  //! Returns aliased type
+  Standard_EXPORT  const  Handle(Express_Type)& Type()  const;
+  
+  //! Returns name of aliased type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns name of aliased type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+  
+  //! Create CDL/CXX files from item
+  Standard_EXPORT virtual   Standard_Boolean GenerateClass()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Alias,Express_Item)
+
+protected:
+
+
+
+
+private: 
+
+
+  Handle(Express_Type) myType;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Alias_HeaderFile
diff --git a/src/Express/Express_Array.hxx b/src/Express/Express_Array.hxx
new file mode 100644 (file)
index 0000000..8757064
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Array_HeaderFile
+#define _Express_Array_HeaderFile
+
+#include <Express_ComplexType.hxx>
+
+typedef Express_ComplexType Express_Array;
+
+#endif // _Express_Array_HeaderFile
diff --git a/src/Express/Express_Bag.hxx b/src/Express/Express_Bag.hxx
new file mode 100644 (file)
index 0000000..e55a2b6
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Bag_HeaderFile
+#define _Express_Bag_HeaderFile
+
+#include <Express_ComplexType.hxx>
+
+typedef Express_ComplexType Express_Bag;
+
+#endif // _Express_Bag_HeaderFile
diff --git a/src/Express/Express_Boolean.cxx b/src/Express/Express_Boolean.cxx
new file mode 100644 (file)
index 0000000..27360fa
--- /dev/null
@@ -0,0 +1,48 @@
+// Created:    Tue Nov  2 15:27:26 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Boolean.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Boolean,Express_PredefinedType)
+
+//=======================================================================
+//function : Express_Boolean
+//purpose  : 
+//=======================================================================
+
+Express_Boolean::Express_Boolean () 
+{
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Boolean::CPPName () const
+{
+  return new TCollection_HAsciiString ( "Standard_Boolean" );
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Boolean::CDLName () const
+{
+  return new TCollection_HAsciiString ( "Boolean" );
+}
diff --git a/src/Express/Express_Boolean.hxx b/src/Express/Express_Boolean.hxx
new file mode 100644 (file)
index 0000000..8737feb
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Boolean_HeaderFile
+#define _Express_Boolean_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_PredefinedType.hxx>
+class TCollection_HAsciiString;
+
+
+//! Implements EXPRESS type 'BOOLEAN'
+class Express_Boolean : public Express_PredefinedType
+{
+
+public:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_Boolean();
+  
+  //! Returns "Standard_Boolean"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns "Boolean"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Boolean,Express_PredefinedType)
+
+protected:
+
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Boolean_HeaderFile
diff --git a/src/Express/Express_ComplexType.cxx b/src/Express/Express_ComplexType.cxx
new file mode 100644 (file)
index 0000000..6763ec8
--- /dev/null
@@ -0,0 +1,125 @@
+// Created:    Tue Nov  2 15:13:31 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_ComplexType.hxx>
+#include <Express_String.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_ComplexType,Express_Type)
+
+//=======================================================================
+//function : Express_ComplexType
+//purpose  : 
+//=======================================================================
+
+Express_ComplexType::Express_ComplexType (const Standard_Integer imin,
+                                           const Standard_Integer imax,
+                                           const Handle(Express_Type) &type) 
+{
+  myMin = imin;
+  myMax = imax;
+  myType = type;
+}
+
+//=======================================================================
+//function : Type
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_Type) &Express_ComplexType::Type () const
+{
+  return myType;
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_ComplexType::CPPName () const
+{
+   // check if array 2
+  Handle(Express_Type) type = myType;
+  if ( type->IsKind ( STANDARD_TYPE(Express_ComplexType) ) ) {
+    Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast ( type );
+    type = c2->Type();
+  }
+
+  // parse name of array argument
+  Handle(TCollection_HAsciiString) name = type->CPPName();
+  Standard_Integer split = name->Location ( 1, '_', 1, name->Length() );
+  Handle(TCollection_HAsciiString) cls;
+  if ( split ) cls = name->Split ( split );
+  else cls = name;
+  Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString("TCollection");
+  Standard_Integer ind =name->Location(str,1,name->Length());
+  if(ind) 
+    name = new TCollection_HAsciiString ( "Interface_" );
+  // generate name
+  if ( type->IsStandard() || ! split ) {
+      name = new TCollection_HAsciiString ( "TColStd_" );
+  }
+  if ( type == myType ) name->AssignCat ( "HArray1Of" );
+  else                  name->AssignCat ( "HArray2Of" );
+  name->AssignCat ( cls );
+  return name;
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_ComplexType::CDLName () const
+{
+  // check if array 2
+  Handle(TCollection_HAsciiString) name;
+  Handle(Express_Type) type = myType;
+  if ( type->IsKind ( STANDARD_TYPE(Express_ComplexType) ) ) {
+    Handle(Express_ComplexType) c2 = Handle(Express_ComplexType)::DownCast ( type );
+    type = c2->Type();
+    name = new TCollection_HAsciiString ( "HArray2Of" );
+  }
+  else 
+    name = new TCollection_HAsciiString ( "HArray1Of" );
+  
+  // generate name
+  name->AssignCat ( type->CDLName() );
+  Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString("TCollection");
+  Standard_Integer ind =name->Location(str,1,name->Length());
+  if(ind) {
+    Handle(TCollection_HAsciiString) tmp = name->Split(ind-1);
+    name->AssignCat("Interface");
+  }
+  if ( type->IsStandard() ) 
+    name->AssignCat ( " from TColStd" );
+    
+  
+  return name;
+}
+
+
+//=======================================================================
+//function : Use
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_ComplexType::Use (const Handle(TCollection_HAsciiString) &pack,
+                                           const Standard_Boolean defer) const
+{
+  
+  return myType->Use ( pack, defer );
+}
diff --git a/src/Express/Express_ComplexType.hxx b/src/Express/Express_ComplexType.hxx
new file mode 100644 (file)
index 0000000..40ac870
--- /dev/null
@@ -0,0 +1,75 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_ComplexType_HeaderFile
+#define _Express_ComplexType_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Type.hxx>
+
+class TCollection_HAsciiString;
+
+
+//! Base class for complex types (ARRAY, LIST, BAG, SET)
+//! in EXPRESS schema
+//! Stores type of elements and
+class Express_ComplexType : public Express_Type
+{
+
+public:
+
+  
+  //! Creates an object and initializes fields
+  Standard_EXPORT Express_ComplexType(const Standard_Integer imin, const Standard_Integer imax, const Handle(Express_Type)& type);
+  
+  //! Returns type of complex type items
+  Standard_EXPORT  const  Handle(Express_Type)& Type()  const;
+  
+  //! Returns CPP-style name of the type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns CDL-style name of the type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+  
+  //! Declares type as used by some item being generated.
+  //! Calls Use() for type of elements
+  Standard_EXPORT virtual   Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False)  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_ComplexType,Express_Type)
+
+protected:
+
+
+
+
+private: 
+
+
+  Standard_Integer myMin;
+  Standard_Integer myMax;
+  Handle(Express_Type) myType;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_ComplexType_HeaderFile
diff --git a/src/Express/Express_DataMapOfAsciiStringItem.hxx b/src/Express/Express_DataMapOfAsciiStringItem.hxx
new file mode 100644 (file)
index 0000000..6098317
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_DataMapOfAsciiStringItem_HeaderFile
+#define Express_DataMapOfAsciiStringItem_HeaderFile
+
+#include <TCollection_AsciiString.hxx>
+#include <Express_Item.hxx>
+#include <NCollection_DataMap.hxx>
+
+typedef NCollection_DataMap<TCollection_AsciiString,Handle(Express_Item),TCollection_AsciiString> Express_DataMapOfAsciiStringItem;
+typedef NCollection_DataMap<TCollection_AsciiString,Handle(Express_Item),TCollection_AsciiString>::Iterator Express_DataMapIteratorOfDataMapOfAsciiStringItem;
+
+#endif
diff --git a/src/Express/Express_Entity.cxx b/src/Express/Express_Entity.cxx
new file mode 100644 (file)
index 0000000..59f2b3b
--- /dev/null
@@ -0,0 +1,1156 @@
+// Created:    Tue Nov  2 14:40:06 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Entity.hxx>
+#include <Express_Type.hxx>
+#include <Express_NamedType.hxx>
+#include <Express_Alias.hxx>
+#include <Express_ComplexType.hxx>
+#include <Express_String.hxx>
+#include <Express_Boolean.hxx>
+#include <Express_Logical.hxx>
+#include <Express_Number.hxx>
+#include <Express_Integer.hxx>
+#include <Express_Real.hxx>
+#include <Express_Select.hxx>
+#include <Express_Field.hxx>
+#include <Express.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <OSD_Directory.hxx>
+#include <OSD_Path.hxx>
+#include <OSD_Protection.hxx>
+#include <Express_Enum.hxx>
+#include <Express_HSequenceOfEntity.hxx>
+#include <Express_HSequenceOfField.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Entity,Express_Item)
+
+//=======================================================================
+//function : Express_Entity
+//purpose  : 
+//=======================================================================
+
+Express_Entity::Express_Entity (const Standard_CString name, 
+                                 const Handle(TColStd_HSequenceOfHAsciiString) &inherit,
+                                 const Handle(Express_HSequenceOfField) &flds)
+     : Express_Item(name), mySupers(inherit), myFields(flds)
+       
+{
+  // make empty lists to avoid checking every time
+  myInherit = new Express_HSequenceOfEntity;
+  if ( mySupers.IsNull() ) mySupers = new TColStd_HSequenceOfHAsciiString;
+  if ( myFields.IsNull() ) myFields = new Express_HSequenceOfField;
+  myisAbstract = Standard_False;
+}
+
+//=======================================================================
+//function : SuperTypes
+//purpose  : 
+//=======================================================================
+
+const Handle(TColStd_HSequenceOfHAsciiString) &Express_Entity::SuperTypes () const
+{
+  return mySupers;
+}
+
+//=======================================================================
+//function : Inherit
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_HSequenceOfEntity) &Express_Entity::Inherit () const
+{
+  return myInherit;
+}
+
+//=======================================================================
+//function : Fields
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_HSequenceOfField) &Express_Entity::Fields () const
+{
+  return myFields;
+}
+//=======================================================================
+//function : NbFields
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Express_Entity::NbFields (const Standard_Boolean inherited) const
+{
+  Standard_Integer num = myFields->Length();
+  if ( inherited ) {
+    for ( Standard_Integer i=1; i <= myInherit->Length(); i++ )
+      num += myInherit->Value(i)->NbFields ( inherited );
+  }
+  return num;
+}
+
+//=======================================================================
+//function : WriteGetMethod
+//purpose  : 
+//=======================================================================
+
+static void WriteGetMethod (Standard_OStream &os, 
+                           const Handle(TCollection_HAsciiString) name,
+                           const Handle(TCollection_HAsciiString) field,
+                           const Handle(TCollection_HAsciiString) type,
+                           const Standard_Boolean isHandle,
+                           const Standard_Boolean /*isSimple*/)
+{
+  Handle(TCollection_HAsciiString) method = field;//new TCollection_HAsciiString ( "Get" );
+//  method->AssignCat ( field );
+  Express::WriteMethodStamp ( os, method );
+  os << ( isHandle ? "Handle(" : "" ) << type->ToCString() << ( isHandle ? ") " : " " ) <<
+       name->ToCString() << "::" << method->ToCString() << " () const" << std::endl;
+  os << "{" << std::endl << "  return the" << field->ToCString() << ";\n}" << std::endl;
+}
+
+//=======================================================================
+//function : WriteSetMethod
+//purpose  : 
+//=======================================================================
+
+static void WriteSetMethod (Standard_OStream &os, 
+                           const Handle(TCollection_HAsciiString) name,
+                           const Handle(TCollection_HAsciiString) field,
+                           const Handle(TCollection_HAsciiString) type,
+                           const Standard_Boolean isHandle,
+                           const Standard_Boolean isSimple)
+{
+  Handle(TCollection_HAsciiString) method = new TCollection_HAsciiString ( "Set" );
+  method->AssignCat ( field );
+  Express::WriteMethodStamp ( os, method );
+  os << "void " << name->ToCString() << "::" << method->ToCString() << " (const " <<
+        ( isHandle ? "Handle(" : "" ) << type->ToCString() << ( isHandle ? ")" : "" ) <<
+       " " << ( isSimple ? "" : "&" ) << "a" << field->ToCString() << ")" << std::endl;
+  os << "{" << std::endl << "  the" << field->ToCString() << " = a" << field->ToCString() << ";\n}" << std::endl;
+}
+
+//=======================================================================
+//function : WriteSpaces
+//purpose  : 
+//=======================================================================
+
+static inline void WriteSpaces (Standard_OStream &os, Standard_Integer num)
+{
+  for ( Standard_Integer i=0; i < num; i++ ) os << " ";
+}
+
+//=======================================================================
+//function : GenerateClass
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Entity::GenerateClass () const
+{
+  Handle(TCollection_HAsciiString) CPPname = CPPName();
+  Handle(TCollection_HAsciiString) CDLname = CDLName();
+  std::cout << "Generating ENTITY " << CPPname->ToCString() << std::endl;
+  
+  // create a package directory (if not yet exist)
+  OSD_Protection prot ( OSD_RX, OSD_RWX, OSD_RX, OSD_RX );
+  TCollection_AsciiString pack = GetPackageName()->String();
+  OSD_Path path ( pack );
+  OSD_Directory dir ( path );
+  dir.Build ( prot );
+  pack += "/";
+  pack += CPPname->String();
+  
+  //===============================
+  // Step 1: generating CDL
+  
+  // Open CDL file 
+  std::ofstream os ( pack.Cat ( ".cdl" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, CPPname, Standard_True );
+
+  // write start of declaration (inheritance)
+  os << "class " << CDLname->ToCString() << std::endl << "inherits ";
+  if ( myInherit->Length() >0 ) { // first inherited class will be actually inherited
+    Handle(Express_Entity) it = myInherit->Value(1);
+    it->Use ( GetPackageName() );
+    os << it->CDLName()->ToCString();
+    if ( myInherit->Length() >1 ) {
+      std::cout << "Warning: ENTITY " << Name()->ToCString() << " defined with multiple inheritance;" << std::endl;
+      std::cout << "Warning: only first base class is actually inherited, others are made fields" << std::endl;
+    }
+  }
+  else os << "TShared from MMgt";
+  os << std::endl << std::endl;
+  
+  os << "    ---Purpose: Representation of STEP entity " << Name()->ToCString() << std::endl;
+  os << std::endl;
+  
+  // write "uses" section (also creates all used types)
+  DataMapOfStringInteger dict;
+  if ( ! WriteUses ( os, Standard_True, dict ) ) os << std::endl << std::endl;
+    
+  // start 'is' section
+  os << "is" << std::endl;
+  os << "    Create returns " << CDLname->ToCString() << ";" << std::endl;
+  os << "      ---Purpose: Empty constructor" << std::endl;
+  os << std::endl;
+  
+  // write Init methods
+  if ( myInherit->Length() >1 || myFields->Length() >0 ) {
+    os << "    Init (me: mutable; ";
+    MakeInit ( os, 23, Standard_True, 0 );
+    os << ");" << std::endl;
+    os << "    ---Purpose: Initialize all fields (own and inherited)" << std::endl;
+    os << std::endl;
+  }
+  
+  // write methods Get/Set
+  for ( Standard_Integer i=2; i <= myInherit->Length(); i++ ) {
+    Handle(Express_Entity) it = myInherit->Value(i);
+    Handle(TCollection_HAsciiString) name = it->Name();
+    Handle(TCollection_HAsciiString) str = it->CDLName();
+    os << "    " << name->ToCString() << " (me) returns " << str->ToCString() << ";" << std::endl;
+    os << "    ---Purpose: Returns data for supertype " << name->ToCString() << std::endl;
+    os << "    Set" << name->ToCString() << " (me: mutable; " << name->ToCString() << ": " << str->ToCString() << ");" << std::endl;
+    os << "    ---Purpose: Set data for supertype " << name->ToCString() << std::endl;
+    os << std::endl;
+  }
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value ( i );
+    Handle(TCollection_HAsciiString) str = field->Type()->CDLName();
+    os << "    " << field->Name()->ToCString() << " (me) returns " << str->ToCString() << ";" << std::endl;
+    os << "    ---Purpose: Returns field " << field->Name()->ToCString() << std::endl;
+    os << "    Set" << field->Name()->ToCString() << " (me: mutable; " << 
+          field->Name()->ToCString() << ": " << str->ToCString() << ");" << std::endl;
+    os << "    ---Purpose: Set field " << field->Name()->ToCString() << std::endl;
+    if ( field->IsOptional() ) {
+      os << "    Has" << field->Name()->ToCString() << " (me) returns Boolean;" << std::endl;
+      os << "  ---Purpose: Returns True if optional field " << field->Name()->ToCString() << " is defined" << std::endl;
+//      os << "        ---C++: return &" << std::endl;
+    }
+    os << std::endl;
+  }
+  
+  // write fields section
+  if ( myInherit->Length() >1 || myFields->Length() >0 ) {
+    os << "fields" << std::endl;
+    for (Standard_Integer i=2; i <= myInherit->Length(); i++ ) {
+      Handle(Express_Entity) it = myInherit->Value(i);
+      Handle(TCollection_HAsciiString) name = it->Name();
+      Handle(TCollection_HAsciiString) str = it->CDLName();
+      os << "    the" << it->Name()->ToCString() << ": " <<
+           it->CDLName()->ToCString() << "; -- supertype" << std::endl;
+    }
+    for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+      Handle(Express_Field) field = myFields->Value ( i );
+      os << "    the" << field->Name()->ToCString() << ": " << 
+           field->Type()->CDLName()->ToCString() << ";";
+      if ( field->IsOptional() ) os << " -- optional";
+      os << std::endl;
+    }
+    // optional fields: flag 'is field set'
+    for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+      Handle(Express_Field) field = myFields->Value ( i );
+      if ( ! field->IsOptional() ) continue;
+      os << "    def" << field->Name()->ToCString() << ": Boolean; -- flag \"is " << 
+           field->Name()->ToCString() << " defined\"" << std::endl;
+    }
+    os << std::endl;
+  }
+      
+  // write end
+  os << "end " << Name()->ToCString() << ";" << std::endl;
+  os.close();
+  
+  //===============================
+  // Step 2: generating CXX
+  
+  // Open CXX file 
+  os.open ( pack.Cat ( ".cxx" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, CPPname, Standard_False );
+
+  // write include section
+  os << "#include <" << CPPname->ToCString() << ".ixx>" << std::endl;
+  
+  // write constructor
+  Express::WriteMethodStamp ( os, CPPname );
+  os << CPPname->ToCString() << "::" << CPPname->ToCString() << " ()" << std::endl;
+  os << "{" << std::endl;
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value ( i );
+    if ( field->IsOptional() ) os << "  def" << field->Name()->ToCString() << " = Standard_False;" << std::endl;
+  }
+  os << "}" << std::endl;
+
+  // write method Init()
+  if ( myInherit->Length() >1 || myFields->Length() >0 ) {
+    Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "Init" ) );
+    os << "void " << CPPname->ToCString() << "::Init (";
+    MakeInit ( os, 13 + CPPname->Length(), Standard_True, 1 );
+    os << ")\n{";
+    MakeInit ( os, -2, Standard_True, 3 );
+    os << "\n}" << std::endl;
+  }
+  
+  // write "methods" section
+  for (Standard_Integer i=2; i <= myInherit->Length(); i++ ) {
+    Handle(Express_Entity) it = myInherit->Value(i);
+    WriteGetMethod ( os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False );
+    WriteSetMethod ( os, CPPname, it->Name(), it->CPPName(), Standard_True, Standard_False );
+  }
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value ( i );
+    Handle(Express_Type) type = field->Type();
+    WriteGetMethod ( os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple() );
+    WriteSetMethod ( os, CPPname, field->Name(), type->CPPName(), type->IsHandle(), type->IsSimple() );
+    if ( ! field->IsOptional() ) continue;
+    Handle(TCollection_HAsciiString) method = new TCollection_HAsciiString ( "Has" );
+    method->AssignCat ( field->Name() );
+    Express::WriteMethodStamp ( os, method );
+    os << "Standard_Boolean " << CPPname->ToCString() << "::" << method->ToCString() << " () const" << std::endl;
+    os << "{" << std::endl << "  return def" << field->Name()->ToCString() << ";\n}" << std::endl;
+  }
+  
+  // close
+  os.close();
+  if(AbstractFlag()) return Standard_True;  
+  //===============================
+  // Step 3: generating CDL for Reader/Writer class
+  
+  // Open CDL file 
+  Handle(TCollection_HAsciiString) RWCPPName = new TCollection_HAsciiString ( "RW" );
+  RWCPPName->AssignCat ( GetPackageName() );
+  RWCPPName->AssignCat ( "_RW" );
+  RWCPPName->AssignCat ( Name() );
+  Handle(TCollection_HAsciiString) RWCDLName = new TCollection_HAsciiString ( "RW" );
+  RWCDLName->AssignCat ( Name() );
+  RWCDLName->AssignCat ( " from RW" );
+  RWCDLName->AssignCat ( GetPackageName() );
+
+  pack = "RW";
+  pack += GetPackageName()->String();
+  OSD_Path rwpath ( pack );
+  OSD_Directory rwdir ( rwpath );
+  rwdir.Build ( prot );
+  pack += "/";
+  pack += RWCPPName->String();
+  
+  os.open ( pack.Cat ( ".cdl" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, RWCPPName, Standard_True );
+
+  // write start of declaration (inheritance)
+  os << "class " << RWCDLName->ToCString() << "  inherits RWClass from StepData" << std::endl << std::endl;
+  
+  os << "    ---Purpose: Read & Write tool for " << Name()->ToCString() << std::endl;
+  os << std::endl;
+  
+  // write "uses" section
+  os << "uses" << std::endl;
+  os << "    Check from Interface," << std::endl;
+  os << "    StepWriter from StepData," << std::endl;
+  os << "    StepReaderData from StepData," << std::endl;
+  os << "    EntityIterator from Interface," << std::endl;
+  os << "    InterfaceModel from Interface," << std::endl;
+  os << "    ShareTool from Interface," << std::endl;
+  os << "    " << CDLname->ToCString() << std::endl;
+  os << std::endl;
+
+  // write "is" section
+  os << "is" << std::endl;
+  os << "    New(me) returns Transient;"<< std::endl; // << RWCDLName->ToCString() << ";" << std::endl;
+  os << "      ---Purpose: Returns new entity " << RWCDLName->ToCString()<< std::endl;
+  os << std::endl;
+  os << "    ReadStep (me; data: StepReaderData from StepData; num: Integer;" << std::endl;
+  os << "                  ach : in out Check from Interface;" << std::endl;
+  os << "                  entt : Transient);" << std::endl;
+  os << "      ---Purpose: Reads " << Name()->ToCString() << std::endl;
+  os << std::endl;
+  os << "    WriteStep (me; SW: in out StepWriter from StepData;" << std::endl;
+  os << "                   entt: Transient);" << std::endl;
+  os << "      ---Purpose: Writes " << Name()->ToCString() << std::endl;
+  os << std::endl;
+  os << "    Share (me; entt : Transient;" << std::endl;
+  os << "               iter: in out EntityIterator from Interface);" << std::endl;
+  os << "      ---Purpose: Fills data for graph (shared items)" << std::endl;
+  if(CheckFlag()) {
+     os << "    Check (me; entt : Transient;" << std::endl;
+     os << "               shares : ShareTool from Interface;" << std::endl;
+     os << "               ach : in out Check from Interface) is redefined;" << std::endl;
+     os << "   ---Purpose: Check data for entity " << std::endl;
+    }
+  if(FillSharedFlag()) {
+     os << "    Share (me;   model : InterfaceModel from Interface;" << std::endl;
+     os << "               entt : Transient;" << std::endl;
+     os << "               iter: in out EntityIterator from Interface) is redefined;" << std::endl;
+     os << "   ---Purpose: Shared data for entity " << std::endl;
+  }
+  os << std::endl;
+
+  // write end
+  os << "end RW" << Name()->ToCString() << ";" << std::endl;
+  os.close();
+  
+  //===============================
+  // Step 4: generating CXX for Read/Write tool
+  
+  // Open CXX file 
+  os.open ( pack.Cat ( ".cxx" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, RWCPPName, Standard_False );
+
+  // write include section
+  os << "#include <" << RWCPPName->ToCString() << ".ixx>" << std::endl;
+  WriteRWInclude ( os, dict );
+  os << "#include <" << CPPname->ToCString() << ".hxx>" << std::endl;
+  // write method New
+  Express::WriteMethodStamp ( os, RWCPPName );
+  os << "Handle(Standard_Transient) " << RWCPPName->ToCString() << "::" << "New () const" << std::endl;
+  os << "{" << std::endl;
+  os << "  Handle("<<RWCPPName->ToCString()<<") newRW = new " <<RWCPPName->ToCString()<<";"<< std::endl;
+  os << "  return newRW;"<< std::endl;
+  os << "}" << std::endl;
+
+  // write method ReadStep
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "ReadStep" ) );
+  os << "void " << RWCPPName->ToCString() << "::ReadStep (const Handle(StepData_StepReaderData)& data," << std::endl;
+  WriteSpaces ( os, 17 + RWCPPName->Length() );
+  os << "const Standard_Integer num," << std::endl;
+  WriteSpaces ( os, 17 + RWCPPName->Length() );
+  os << "Interface_Check& ach," << std::endl;
+  WriteSpaces ( os, 17 + RWCPPName->Length() );
+  os << "const Handle(Standard_Transient) &entt) const" << std::endl;
+  os << "{" << std::endl;
+  Standard_Integer nbFld = NbFields ( Standard_True );
+  //DownCast entity to it's type
+  os<<"  Handle("<<CPPname->ToCString() << ") ent = Handle("<<CPPname->ToCString() <<")::DownCast(entt);"<< std::endl;
+  
+  os << "  // Check number of parameters" << std::endl;
+  os << "  if ( ! data->CheckNbParams(num," << nbFld << ",ach,\"" << 
+        Express::ToStepName ( Name() )->ToCString() << "\") ) return;" << std::endl;
+  WriteRWReadCode ( os, 1, Standard_True ); // write code for reading inherited and own fields
+  os << std::endl;
+  os << "  // Initialize entity" << std::endl;
+  os << "  ent->Init(";
+  MakeInit ( os, 12, Standard_True, 2 );
+  os << ");\n}" << std::endl;
+
+  // write method WriteStep
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "WriteStep" ) );
+  os << "void " << RWCPPName->ToCString() << "::WriteStep (StepData_StepWriter& SW," << std::endl;
+  WriteSpaces ( os, 18 + RWCPPName->Length() );
+  os << "const Handle(Standard_Transient) &entt) const" << std::endl;
+  os << "{" << std::endl;
+  //DownCast entity to it's type
+  os<<"  Handle("<<CPPname->ToCString() << ") ent = Handle("<<CPPname->ToCString() <<")::DownCast(entt);"<< std::endl;
+  
+  WriteRWWriteCode ( os, 0, Standard_True ); // write code for writing inherited and own fields
+  os << "}" << std::endl;
+
+  // write method Share
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "Share" ) );
+  os << "void " << RWCPPName->ToCString() << "::Share (const Handle(Standard_Transient) &entt," << std::endl;
+  WriteSpaces ( os, 14 + RWCPPName->Length() );
+  os << "Interface_EntityIterator& iter) const" << std::endl;
+  os << "{" << std::endl;
+  os<<"  Handle("<<CPPname->ToCString() << ") ent = Handle("<<CPPname->ToCString() <<")::DownCast(entt);"<< std::endl;
+  WriteRWShareCode ( os, 1, Standard_True ); // write code for filling graph of references
+  os << "}" << std::endl;
+  if(CheckFlag()) {
+    Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "Check" ) );
+    os << "void " << RWCPPName->ToCString() << "::Check(const Handle(Standard_Transient) &entt," << std::endl;
+    WriteSpaces ( os, 18 + RWCPPName->Length() );
+    os << "const Interface_ShareTool& shares,"<< std::endl;
+    WriteSpaces ( os, 18 + RWCPPName->Length() );
+    os << "Interface_Check& check) const"<< std::endl;
+    os << "{" << std::endl;
+    //DownCast entity to it's type
+    os<<"  Handle("<<CPPname->ToCString() << ") ent = Handle("<<CPPname->ToCString() <<")::DownCast(entt);"<< std::endl;
+    os << "}" << std::endl;
+  }
+  if(FillSharedFlag()) {
+    Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "FillShared" ) );
+    os << "void " << RWCPPName->ToCString() << "::Share(const Handle(Interface_InterfaceModel)& model," << std::endl;
+    WriteSpaces ( os, 18 + RWCPPName->Length() );
+    os << "const Handle(Standard_Transient) &entt,"<< std::endl;
+    WriteSpaces ( os, 18 + RWCPPName->Length() );
+    os << "Interface_EntityIterator& iter) const"<< std::endl;
+    os << "{" << std::endl;
+    //DownCast entity to it's type
+    os<<"  Handle("<<CPPname->ToCString() << ") ent = Handle("<<CPPname->ToCString() <<")::DownCast(entt)"<< std::endl;
+    os << "}" << std::endl;
+  }
+  
+  // close
+  os.close();
+  //adding method for registartion of entities and include in the two files
+  
+  TCollection_AsciiString packname = GetPackageName()->String();
+  OSD_Path path_reg ( packname );
+  OSD_Directory dir_reg ( packname );
+  dir_reg.Build ( prot );
+  
+  TCollection_AsciiString packname_inc = packname +".cxx_inc"; 
+  TCollection_AsciiString packname_rec = packname + ".cxx_reg";
+  packname += "/";
+  //write file with includes for registration
+  os.open(packname.Cat(packname_inc).ToCString(),std::ios::app);
+    os <<"#include <" << RWCPPName->ToCString() << ".hxx>" << std::endl;
+    os.close();
+  
+  //write file with registration
+  os.open(packname.Cat(packname_rec).ToCString(),std::ios::app);
+  os<<"  //Registration class "<<CPPname->ToCString()<< std::endl;
+  os<<"  stepname = "<<"\""<<CPPname->ToCString()<<"\""<<";"<< std::endl;
+  if(!ShortName().IsNull() && ShortName()->Length() >0) {
+    os<<"  shortname = "<<"\""<<ShortName()->ToCString()<<"\""<<";"<< std::endl;
+  }
+  if(!Category().IsNull() && Category()->Length() >0)
+    os<<"   category = "<<"Interface_Category::Number(\""<<Category()->ToCString()<<"\");"<< std::endl;
+  else 
+    os<<"   category = vcateg;"<< std::endl;
+//PDN modification of $ on handles
+//  os<<"  Handle(" << RWCPPName->ToCString()<<")& rwclass = new "<<RWCPPName->ToCString()<<";"<< std::endl;
+//  os<<"  Protocol->RegisterEntity(stepname,shortname,category,rwclass);"<< std::endl<< std::endl;
+  os<<"  Protocol->RegisterEntity(stepname,shortname,category,new "<<RWCPPName->ToCString()<<");"<< std::endl;
+  os<<"  shortname.Clear();"<< std::endl<< std::endl;
+  os.close();
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : WriteUses
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Entity::WriteUses (Standard_OStream &os, 
+                                            const Standard_Boolean start,
+                                             DataMapOfStringInteger &dict) const
+{
+  Standard_Boolean st = start;
+  for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) {
+    Handle(Express_Entity) it = myInherit->Value(i);
+    st = it->WriteUses ( os, st, dict );
+    if ( i <=1 ) continue;
+      
+    if ( dict.IsBound ( it->CDLName()->String() ) ) continue; // avoid duplicating
+    dict.Bind ( it->CDLName()->String(), 1 );
+    it->Use ( GetPackageName() );
+    os << ( st ? "uses" : "," ) << std::endl;
+    st = Standard_False;
+    os << "    ";
+    os << it->CDLName()->ToCString();
+  }
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Type) type = myFields->Value(i)->Type();
+    if ( dict.IsBound ( type->CDLName()->String() ) ) continue; // avoid duplicating
+    dict.Bind ( type->CDLName()->String(), 1 );
+    type->Use ( GetPackageName() );
+    if ( type->IsStandard() ) continue;
+    os << ( st ? "uses" : "," ) << std::endl;
+    st = Standard_False;
+    os << "    ";
+    os << type->CDLName()->ToCString();
+  }
+  return st;
+}
+
+//=======================================================================
+//function : WriteRWInclude
+//purpose  : 
+//=======================================================================
+
+void Express_Entity::WriteRWInclude (Standard_OStream &os, DataMapOfStringInteger &dict) const
+{
+  for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) {
+    Handle(Express_Entity) it = myInherit->Value(i);
+    if ( i >1 ) { // include hxx for base classes which are implemented as fields
+      os << "#include <" << it->CPPName()->ToCString() << ".hxx>" << std::endl;
+    }
+    it->WriteRWInclude ( os, dict );
+  }
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Type) type = myFields->Value(i)->Type();
+    
+    for ( Standard_Integer deep=0; deep < 10; deep++ ) {
+      if ( dict.IsBound ( type->CPPName()->String() ) ) break; // avoid duplicating
+      dict.Bind ( type->CDLName()->String(), 1 );
+    
+      Standard_Boolean iscomplex = type->IsKind(STANDARD_TYPE(Express_ComplexType));
+      if ( ! deep && ! iscomplex ) break; // only complex types and their elements need #include
+    
+      os << "#include <" << type->CPPName()->ToCString() << ".hxx>" << std::endl;
+      
+      if ( ! iscomplex ) break;
+      Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type );
+      type = complex->Type();
+    }
+  }
+}
+
+//=======================================================================
+//function : WriteRWReadField
+//purpose  : 
+//=======================================================================
+
+static Handle(TCollection_HAsciiString) TypeToSTEPName (const Handle(Express_Type) &type) 
+{
+  Handle(TCollection_HAsciiString) cppname = type->CPPName();
+  Handle(TCollection_HAsciiString) cls = cppname->Token ( "_", 2 );
+  if ( cls->Length() <1 ) cls = cppname;
+  return Express::ToStepName ( cls );
+}
+
+static void WriteRWReadField (Standard_OStream &os, 
+                             const Standard_CString index,
+                             const Standard_CString STEPName,
+                             const Standard_CString varname,
+                             const Handle(Express_Type) &vartype, 
+                             const Standard_Integer lev,
+                             const Standard_Boolean optional)
+{
+  // indent
+  TCollection_AsciiString shift ( "  " );
+  Standard_Integer level = 0;
+  for (; level < lev; level++ ) shift += "  ";
+  level += 2;
+
+  // name of variable identifying number of parameter in data
+  TCollection_AsciiString param ( "num" );
+  if ( lev >0 ) param += TCollection_AsciiString ( lev );
+  
+  // decode aliased types
+  Handle(Express_Type) type = vartype;
+  while ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    if ( ! named->Item()->IsKind(STANDARD_TYPE(Express_Alias)) ) break;
+    Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( named->Item() );
+    type = alias->Type();
+  }
+    
+  // declare variable
+  if ( type->IsHandle() ) os << shift << "Handle(" << type->CPPName()->ToCString() << ") a";
+  else os << shift << type->CPPName()->ToCString() << " a";
+  os << varname << ";" << std::endl;
+
+  if ( optional ) {
+    os << shift << "Standard_Boolean has" << varname << " = Standard_True;" << std::endl;
+    os << shift << "if ( data->IsParamDefined (" << param << "," << index << ") ) {" << std::endl;
+    shift += "  ";
+    level++;
+  }
+    
+  // read variable depending on its type
+  if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    if ( named->Item()->IsKind(STANDARD_TYPE(Express_Entity)) ) {
+      os << shift << "data->ReadEntity (" << param << ", " << index << ", \"" << STEPName <<
+                    "\", ach, STANDARD_TYPE(" << named->CPPName()->ToCString() << "), a" << 
+                    varname << ");" << std::endl;
+    }
+    else if ( named->Item()->IsKind(STANDARD_TYPE(Express_Select)) ) {
+      os << shift << "data->ReadEntity (" << param << ", " << index << ", \"" << STEPName <<
+                    "\", ach, a" << varname << ");" << std::endl;
+    }
+    else if ( named->Item()->IsKind(STANDARD_TYPE(Express_Enum)) ) {
+      os << shift << "if (data->ParamType (" << param << ", " << 
+                    index << ") == Interface_ParamEnum) {" << std::endl;
+      os << shift << "  Standard_CString text = data->ParamCValue(" << 
+                    param << ", " << index << ");" << std::endl;
+      Handle(Express_Enum) en = Handle(Express_Enum)::DownCast ( named->Item() );
+      Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(en->Name());
+      Handle(TColStd_HSequenceOfHAsciiString) names = en->Names();
+      TCollection_AsciiString enpack = en->GetPackageName()->String();
+      for ( Standard_Integer i=1; i <= names->Length(); i++ ) {
+       Handle(TCollection_HAsciiString) ename = Express::ToStepName ( names->Value(i) );
+       ename->UpperCase();
+       os << shift << ( i==1 ? "  if     " : "  else if" ) << 
+                      " (strcmp(text, \"." << ename->ToCString() << ".\")) a" << 
+                      varname << " = " << enpack.ToCString() << "_" << prefix->ToCString()<<
+                      names->Value(i)->ToCString() << ";" << std::endl;
+      }
+      os << shift << "  else ach.AddFail(\"Parameter #" << index << " (" <<
+                    STEPName << ") has not allowed value\");" << std::endl;
+      os << shift << "}" << std::endl;
+      os << shift << "else ach.AddFail(\"Parameter #" << index << " (" <<
+                    STEPName << ") is not enumeration\");" << std::endl;
+//      os << "!!! READING/WRITING ENUM NOT IMPLEMENTED !!!" << std::endl;
+//      std::cout << "Warning: Reading/Writing ENUMERATION not yet implemented (" << 
+//     STEPName << ", " << varname << ", " << type->CPPName()->ToCString() << ")" << std::endl;
+    }
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) {
+   
+    Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type );
+    os << shift << "Standard_Integer sub" << index << " = 0;" << std::endl;
+    os << shift << "if ( data->ReadSubList (" << param << ", " << index << ", \"" << 
+                   STEPName << "\", ach, sub" << index << ") ) {" << std::endl;
+    os << shift << "  Standard_Integer nb" << lev << " = data->NbParams(sub" << index << ");" << std::endl;
+    TCollection_AsciiString iter = lev;
+    iter.Prepend ( "i" );
+    TCollection_AsciiString var = lev;
+    var.Prepend("nIt");
+    if ( complex->Type()->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { // array 2
+      Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast ( complex->Type() );
+      TCollection_AsciiString jter = lev;
+      jter.Prepend ( "j" );
+      os << shift << "  Standard_Integer nbj" << lev << " = data->NbParams(data->ParamNumber(sub" << index << ",1));" << std::endl;
+      os << shift << "  a" << varname << " = new " << type->CPPName()->ToCString() << " (1, nb" << lev << ", 1, nbj" << lev << ");" << std::endl;
+      os << shift << "  for ( Standard_Integer " << iter << "=1; " << iter << " <= nb" << lev << "; " << iter << "++ ) {" << std::endl;
+      os << shift << "    Standard_Integer subj" << index << " = 0;" << std::endl;
+      os << shift << "    if ( data->ReadSubList (sub" << index << ", " << iter << ", \"sub-part(" << 
+                     STEPName << ")\", ach, subj" << index << ") ) {" << std::endl;
+      os << shift << "      Standard_Integer num" << level+2 << " = subj" << index << ";" << std::endl;
+      os << shift << "      for ( Standard_Integer " << jter << "=1; " << jter << " <= nbj" << lev << "; " << jter << "++ ) {" << std::endl;
+      Handle(TCollection_HAsciiString) subName = TypeToSTEPName ( complex2->Type() );
+      WriteRWReadField (os, jter.ToCString(), subName->ToCString(), var.ToCString(), complex2->Type(), level+2, Standard_False );
+      os << shift << "        a" << varname << "->SetValue(" << iter << "," << jter << ", a" << var << ");" << std::endl;
+      os << shift << "      }" << std::endl;
+      os << shift << "    }" << std::endl;
+    } 
+    else { // simple array
+      os << shift << "  a" << varname << " = new " << type->CPPName()->ToCString() << " (1, nb" << lev << ");" << std::endl;
+      os << shift << "  Standard_Integer num" << level << " = sub" << index << ";" << std::endl;
+      os << shift << "  for ( Standard_Integer " << iter << "=1; " << iter << " <= nb" << lev << "; " << iter << "++ ) {" << std::endl;
+      Handle(TCollection_HAsciiString) subName = TypeToSTEPName ( complex->Type() );
+      WriteRWReadField (os, iter.ToCString(), subName->ToCString(), var.ToCString(), complex->Type(), level, Standard_False );
+      os << shift << "    a" << varname << "->SetValue(" << iter << ", a" << var << ");" << std::endl;
+    }
+    os << shift << "  }" << std::endl;
+    os << shift << "}" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_String)) ) {
+    os << shift << "data->ReadString (" << param << ", " << index << ", \"" << STEPName <<
+                   "\", ach, a" << varname << ");" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_Logical)) ) {
+    os << shift << "data->ReadLogical (" << param << ", " << index << ", \"" << STEPName <<
+                   "\", ach, a" << varname << ");" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_Boolean)) ) {
+    os << shift << "data->ReadBoolean (" << param << ", " << index << ", \"" << STEPName <<
+                   "\", ach, a" << varname << ");" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_Number)) ||
+           type->IsKind(STANDARD_TYPE(Express_Integer)) ) {
+    os << shift << "data->ReadInteger (" << param << ", " << index << ", \"" << STEPName <<
+                   "\", ach, a" << varname << ");" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_Real)) ) {
+    os << shift << "data->ReadReal (" << param << ", " << index << ", \"" << STEPName <<
+                   "\", ach, a" << varname << ");" << std::endl;
+  }
+
+  if ( optional ) {
+    shift.Remove ( 1, 2 );
+    os << shift << "}" << std::endl;
+    os << shift << "else {" << std::endl;
+    os << shift << "  has" << varname << " = Standard_False;" << std::endl;
+    if ( ! type->IsHandle() ) os << shift << "  a" << varname << " = 0;" << std::endl;
+    os << shift << "}" << std::endl;
+  }
+}
+
+//=======================================================================
+//function : WriteRWReadCode
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Express_Entity::WriteRWReadCode (Standard_OStream &os, 
+                                                  const Standard_Integer start,
+                                                  const Standard_Integer own) const
+{
+  Standard_Integer num = start;
+  
+  // write code for reading inherited fields
+  for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) 
+    num = myInherit->Value(i)->WriteRWReadCode ( os, num, Standard_False );
+
+  // write code for reading own fields
+  if ( myFields->Length() >0 ) {
+    if ( num >0 ) os << std::endl;
+    os << "  // " << ( own ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl;
+  }
+  
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value(i);
+    Handle(TCollection_HAsciiString) STEPName = Express::ToStepName ( field->Name() );
+    if ( ! own ) STEPName->Prepend ( Express::ToStepName ( Name()->Cat ( "." ) ) );
+    Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString ( field->Name() );
+    if ( ! own ) varName->Prepend ( Name()->Cat ( "_" ) );
+    
+    os << std::endl;
+    WriteRWReadField ( os, TCollection_AsciiString(num).ToCString(), STEPName->ToCString(), 
+                      varName->ToCString(), field->Type(), 0, field->IsOptional() );
+    num++;
+  }
+  return num;
+}
+
+//=======================================================================
+//function : WriteRWWriteField
+//purpose  : 
+//=======================================================================
+
+static void WriteRWWriteField (Standard_OStream &os, 
+                              const Standard_CString varname,
+                              const Handle(Express_Type) &vartype, 
+                              const Standard_Integer index,
+                              const Standard_Integer lev)
+{
+  // indent
+  TCollection_AsciiString shift ( "  " );
+  Standard_Integer level = 0;
+  for (; level < lev; level++ ) shift += "  ";
+  level++;
+
+  // decode aliased types
+  Handle(Express_Type) type = vartype;
+  while ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    if ( ! named->Item()->IsKind(STANDARD_TYPE(Express_Alias)) ) break;
+    Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( named->Item() );
+    type = alias->Type();
+  }
+    
+  // write variable depending on its type
+  if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) {
+    
+    Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type );
+    type = complex->Type();
+    TCollection_AsciiString var ( lev );
+    var.Prepend ( "Var" );
+    os << shift << "SW.OpenSub();" << std::endl;
+    os << shift << "for (Standard_Integer i" << index << "=1; i" << index << " <= ";
+    if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) { // array 2 
+      Handle(Express_ComplexType) complex2 = Handle(Express_ComplexType)::DownCast ( type );
+      type = complex2->Type();
+      os << varname << "->RowLength(); i" << index << "++ ) {" << std::endl;
+      os << shift << "  SW.NewLine(Standard_False);" << std::endl;
+      os << shift << "  SW.OpenSub();" << std::endl;
+      os << shift << "  for (Standard_Integer j" << index << "=1; j" << index << " <= " <<
+            varname << "->ColLength(); j" << index << "++ ) {" << std::endl;
+      os << shift << "  " << ( type->IsHandle() ? "  Handle(" : "  " ) << type->CPPName()->ToCString() <<
+                             ( type->IsHandle() ? ") " : " " ) << var.ToCString() << " = " <<
+                 varname << "->Value(i" << index << ",j" << index << ");" << std::endl;
+      WriteRWWriteField (os, var.ToCString(), type, index+1, level+1 );
+      os << shift << "  }" << std::endl;
+      os << shift << "  SW.CloseSub();" << std::endl;
+    } 
+    else { // simple array
+      os << varname << "->Length(); i" << index << "++ ) {" << std::endl;
+      os << shift << ( type->IsHandle() ? "  Handle(" : "  " ) << type->CPPName()->ToCString() <<
+                     ( type->IsHandle() ? ") " : " " ) << var.ToCString() << " = " <<
+                    varname << "->Value(i" << index << ");" << std::endl;
+      WriteRWWriteField (os, var.ToCString(), type, index+1, level );
+    }
+    os << shift << "}" << std::endl;
+    os << shift << "SW.CloseSub();" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_Boolean)) ) {
+    os << shift << "SW.SendBoolean (" << varname << ");" << std::endl;
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_Logical)) ) {
+    os << shift << "SW.SendLogical (" << varname << ");" << std::endl;
+  }
+  else {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    if ( ! named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Enum)) ) {
+      Handle(Express_Enum) en = Handle(Express_Enum)::DownCast ( named->Item() );
+      Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(en->Name());
+      
+      Handle(TColStd_HSequenceOfHAsciiString) names = en->Names();
+      TCollection_AsciiString enpack = en->GetPackageName()->String();
+      os << shift << "switch (" << varname << ") {" << std::endl;
+      for ( Standard_Integer i=1; i <= names->Length(); i++ ) {
+       Handle(TCollection_HAsciiString) ename = Express::ToStepName ( names->Value(i) );
+       ename->UpperCase();
+       os << shift << "  case " << enpack.ToCString() << "_" << prefix->ToCString()<<
+                      names->Value(i)->ToCString() << ": SW.SendEnum (\"." << 
+                      ename->ToCString() << ".\"); break;" << std::endl;
+      }
+      os << shift << "}" << std::endl;
+    }
+    else {
+      os << shift << "SW.Send (" << varname;
+      if ( ! named.IsNull() && named->Item()->IsKind(STANDARD_TYPE(Express_Select)) ) 
+       os << ".Value()";
+      os << ");" << std::endl;
+    }
+  }
+}
+
+//=======================================================================
+//function : WriteRWWriteCode
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Express_Entity::WriteRWWriteCode (Standard_OStream &os, 
+                                                   const Standard_Integer start,
+                                                   const Standard_Integer own) const
+{
+  Standard_Integer num = start;
+  
+  // write code for writing inherited fields
+  for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) 
+    num = myInherit->Value(i)->WriteRWWriteCode ( os, num, ( i >1 ? -1 : 1 ) );
+
+  // write code for writing own fields
+  if ( myFields->Length() >0 ) {
+    os << std::endl;
+    os << "  // " << ( own == 1 ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl;
+  }
+  
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value(i);
+    TCollection_AsciiString varName ( field->Name()->String() );
+    if ( ! own ) varName.Prepend ( CPPName()->Cat ( "::" )->String() );
+    else if ( own ==-1 ) { // inherited base class implemented as field
+      varName.Prepend ( Name()->Cat ( "()->" )->String() );
+    }
+    varName.Prepend ( "ent->" );
+    varName.AssignCat ( "()" );
+    os << std::endl;
+    
+    if ( field->IsOptional() ) {
+      os << "  if ( ent->";
+      if ( ! own ) os << CPPName()->ToCString() << "::";
+      else if ( own ==-1 ) os << Name()->ToCString() << "()->";
+      os << "Has" << field->Name()->ToCString() << "() ) {" << std::endl;
+    }
+    WriteRWWriteField ( os, varName.ToCString(), field->Type(), num, ( field->IsOptional() ? 1 : 0 ) );
+    if ( field->IsOptional() ) {
+      os << "  }\n  else SW.SendUndef();" << std::endl;
+    }
+    num++;
+  }
+  
+  return num;
+}
+
+//=======================================================================
+//function : WriteRWShareField
+//purpose  : 
+//=======================================================================
+
+static Standard_Boolean WriteRWShareField (Standard_OStream &os, 
+                                          const Standard_CString varname,
+                                          const Handle(Express_Type) &vartype, 
+                                          const Standard_Integer index,
+                                          const Standard_Integer lev)
+{
+  // indent
+  TCollection_AsciiString shift ( "  " );
+  Standard_Integer level = 0;
+  for (; level < lev; level++ ) shift += "  ";
+  level++;
+
+  // decode aliased types
+  Handle(Express_Type) type = vartype;
+  while ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    if ( ! named->Item()->IsKind(STANDARD_TYPE(Express_Alias)) ) break;
+    Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( named->Item() );
+    type = alias->Type();
+  }
+    
+  // write variable depending on its type
+  if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) {
+    Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type );
+    type = complex->Type();
+    TCollection_AsciiString var ( lev );
+    var.Prepend ( "Var" );
+    std::ostringstream oos;
+    if ( ! WriteRWShareField (oos, var.ToCString(), type, index + 1, level ) ) 
+      return Standard_False;
+    os << shift << "for (Standard_Integer i" << index << "=1; i" << index << " <= " << 
+                    varname << "->Length(); i" << index << "++ ) {" << std::endl;
+    os << shift << ( type->IsHandle() ? "  Handle(" : "  " ) << type->CPPName()->ToCString() <<
+                   ( type->IsHandle() ? ") " : " " ) << var.ToCString() << " = " <<
+                  varname << "->Value(i" << index << ");" << std::endl;
+    oos << '\0';
+    os << oos.str();
+    os << shift << "}" << std::endl;
+    return Standard_True;
+  }
+  if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    if ( named->Item()->IsKind(STANDARD_TYPE(Express_Entity)) ) {
+      os << shift << "iter.AddItem (" << varname << ");" << std::endl;
+      return Standard_True;
+    }
+    if ( named->Item()->IsKind(STANDARD_TYPE(Express_Select)) ) {
+      os << shift << "iter.AddItem (" << varname << ".Value());" << std::endl;
+      return Standard_True;
+    }
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : WriteRWShareCode
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Express_Entity::WriteRWShareCode (Standard_OStream &os, 
+                                                   const Standard_Integer start,
+                                                   const Standard_Integer own) const
+{
+  Standard_Integer num = start;
+  
+  // write code for sharing inherited fields
+  for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) 
+    num = myInherit->Value(i)->WriteRWShareCode ( os, num, ( i >1 ? -1 : Standard_False ) );
+
+  // write code for sharing own fields
+  if ( myFields->Length() >0 ) {
+    os << std::endl;
+    os << "  // " << ( own == 1 ? "Own" : "Inherited" ) << " fields of " << Name()->ToCString() << std::endl;
+  }
+  
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value(i);
+    TCollection_AsciiString varName ( field->Name()->String() );
+    if ( ! own ) varName.Prepend ( CPPName()->Cat ( "::" )->String() );
+    else if ( own ==-1 ) { // inherited base class implemented as field
+      varName.Prepend ( Name()->Cat ( "()->" )->String() );
+    }
+    varName.Prepend ( "ent->" );
+    varName.AssignCat ( "()" );
+    
+    std::ostringstream oos;
+    if ( ! WriteRWShareField ( oos, varName.ToCString(), field->Type(), num,
+                              ( field->IsOptional() ? 1 : 0 ) ) ) continue;
+    num++;
+    os << std::endl;
+    if ( field->IsOptional() ) {
+      os << "  if ( ent->";
+      if ( ! own ) os << CPPName()->ToCString() << "::";
+      else if ( own ==-1 ) os << Name()->ToCString() << "()->";
+      os << "Has" << field->Name()->ToCString() << "() ) {" << std::endl;
+    }
+    oos << '\0';
+    os << oos.str();
+    if ( field->IsOptional() ) {
+      os << "  }" << std::endl;
+    }
+  }
+  return num;
+}
+
+//=======================================================================
+//function : MakeInit
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Express_Entity::MakeInit (Standard_OStream &os, 
+                                           const Standard_Integer shift,
+                                           const Standard_Integer own,
+                                           const Standard_Integer mode) const
+{
+  Standard_Integer sh = shift;
+  
+  // write code for inherited fields
+  for ( Standard_Integer i=1; i <= myInherit->Length(); i++ ) {
+    Handle(Express_Entity) ent = myInherit->Value(i);
+    if ( mode ==3 ) {
+      Standard_Integer s = 0;
+      if ( i >1 ) {
+       os << "\n  the" << ent->Name()->ToCString() << " = new " << ent->CPPName()->ToCString() << ";";
+       os << "\n  the" << ent->Name()->ToCString() << "->Init(";
+       s = 12 + ent->Name()->Length();
+      }
+      else {
+       os << "\n  " << ent->CPPName()->ToCString() << "::Init(";
+       s = 9 + ent->CPPName()->Length();
+      }
+      ent->MakeInit ( os, s, Standard_False, 2 );
+      os << ");";
+    }
+    else sh = ent->MakeInit ( os, sh, ( i >1 ? -1 : Standard_False ), mode );
+  }
+
+  // write code for own fields
+  
+  for (Standard_Integer i=1; i <= myFields->Length(); i++ ) {
+    Handle(Express_Field) field = myFields->Value(i);
+    Handle(TCollection_HAsciiString) varName = new TCollection_HAsciiString ( field->Name() );
+    if ( own != 1 ) varName->Prepend ( Name()->Cat ( "_" ) );
+
+    // make CR and indent
+    TCollection_AsciiString space = "";
+    for ( Standard_Integer sn=0; sn < abs(sh); sn++ ) space += " ";
+    Standard_Character delim = ( mode ==0 ? ';' : ( mode == 3 ? '\n' : ',' ) );
+    if ( sh <0 ) os << delim << "\n" << space;
+    else sh = -sh;
+    
+    if ( field->IsOptional() ) {
+      if ( mode ==0 ) os << "has" << varName->ToCString() << ": Boolean;\n" << space;
+      else if ( mode ==1 ) os << "const Standard_Boolean has" << varName->ToCString() << ",\n" << space;
+      else if ( mode ==2 ) os << "has" << varName->ToCString() << ",\n" << space;
+    }
+    
+    // write field
+    if ( mode ==0 ) {
+      os << "a" << varName->ToCString() << ": " << field->Type()->CDLName()->ToCString();
+    }
+    else if ( mode ==1 ) {
+      os << "const " << ( field->Type()->IsHandle() ? "Handle(" : "" ) <<
+           field->Type()->CPPName()->ToCString() << ( field->Type()->IsHandle() ? ")" : "" ) <<
+           ( field->Type()->IsSimple() ? " a" : " &a" ) << varName->ToCString();
+    }
+    else if ( mode ==2 ) {
+      os << "a" << varName->ToCString();
+    }
+    else {
+      if ( field->IsOptional() ) {
+       os << "def" << field->Name()->ToCString() << " = has" << varName->ToCString() << ";" << std::endl;
+       os << "  if (def" << field->Name()->ToCString() << ") {\n    ";
+      }
+      os << "the" << field->Name()->ToCString() << " = a" << varName->ToCString() << ";";
+      if ( field->IsOptional() ) 
+       if ( field->Type()->IsHandle() ) os << "\n  }\n  else the" << field->Name()->ToCString() << ".Nullify();";
+       else os << "\n  }\n  else the" << field->Name()->ToCString() << " = 0;";
+    }
+    if ( sh >0 ) sh = -sh;
+  }
+  
+  return sh;
+}
+//=======================================================================
+//function : SetAbstractFlag
+//purpose  : 
+//=======================================================================
+
+ void Express_Entity::SetAbstractFlag(const Standard_Boolean isAbstract) 
+{
+   myisAbstract = isAbstract;
+}
+
+//=======================================================================
+//function : AbstractFlag
+//purpose  : 
+//=======================================================================
+
+ Standard_Boolean Express_Entity::AbstractFlag() const
+{
+  return myisAbstract;
+}
+
diff --git a/src/Express/Express_Entity.hxx b/src/Express/Express_Entity.hxx
new file mode 100644 (file)
index 0000000..58ccd94
--- /dev/null
@@ -0,0 +1,113 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Entity_HeaderFile
+#define _Express_Entity_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Item.hxx>
+#include <Standard_OStream.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <NCollection_DataMap.hxx>
+
+class Express_HSequenceOfEntity;
+class Express_HSequenceOfField;
+class Dico_DictionaryOfInteger;
+
+
+//! Implements ENTITY item of the EXPRESS
+//! schema, with interface for deferred Item class.
+class Express_Entity : public Express_Item
+{
+
+public:
+
+  
+  //! Create ENTITY item and initialize it
+  //! flags hasCheck and hasFillShared mark if generated class has
+  //! methods Check and FillShared cprrespondingly.
+  Standard_EXPORT Express_Entity(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& inherit, const Handle(Express_HSequenceOfField)& flds);
+  
+  //! Returns sequence of inherited classes (names)
+  Standard_EXPORT  const  Handle(TColStd_HSequenceOfHAsciiString)& SuperTypes()  const;
+  
+  //! Returns sequence of inherited items
+  Standard_EXPORT  const  Handle(Express_HSequenceOfEntity)& Inherit()  const;
+  
+  //! Returns sequence of fields
+  Standard_EXPORT  const  Handle(Express_HSequenceOfField)& Fields()  const;
+  
+  //! Returns number of fields (only own fields if inherited is False
+  //! and including fields of all supertypes if it is True)
+  Standard_EXPORT   Standard_Integer NbFields (const Standard_Boolean inherited = Standard_False)  const;
+  
+  //! Sets abstruct flag for entity;
+  Standard_EXPORT   void SetAbstractFlag (const Standard_Boolean isAbstract) ;
+  
+  //! Returns abstract flag.
+  Standard_EXPORT   Standard_Boolean AbstractFlag()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Entity,Express_Item)
+
+protected:
+
+
+
+
+private: 
+
+  typedef NCollection_DataMap<TCollection_AsciiString,Standard_Integer,TCollection_AsciiString> DataMapOfStringInteger;
+  
+  //! Create CDL/CXX files from item
+  Standard_EXPORT virtual   Standard_Boolean GenerateClass()  const;
+  
+  //! Writes uses section of CDL
+  Standard_EXPORT   Standard_Boolean WriteUses (Standard_OStream& os, const Standard_Boolean start, DataMapOfStringInteger& dict)  const;
+  
+  //! Writes #include declarations for RW class
+  Standard_EXPORT   void WriteRWInclude (Standard_OStream& os, DataMapOfStringInteger& dict)  const;
+  
+  //! Writes code for reading all fields
+  Standard_EXPORT   Standard_Integer WriteRWReadCode (Standard_OStream& os, const Standard_Integer start, const Standard_Integer own)  const;
+  
+  //! Writes code for writing all fields
+  Standard_EXPORT   Standard_Integer WriteRWWriteCode (Standard_OStream& os, const Standard_Integer start, const Standard_Integer own)  const;
+  
+  //! Writes code for adding shared entities to the graph
+  Standard_EXPORT   Standard_Integer WriteRWShareCode (Standard_OStream& os, const Standard_Integer start, const Standard_Integer own)  const;
+  
+  //! Writes arguments and code for method Init()
+  //! Mode identifyes what code is being written:
+  //! 0 - CDL declaration
+  //! 1 - CXX declaration
+  //! 2 - call (argument list)
+  //! 3 - implementation
+  Standard_EXPORT   Standard_Integer MakeInit (Standard_OStream& os, const Standard_Integer shift, const Standard_Integer own, const Standard_Integer mode)  const;
+
+  Handle(TColStd_HSequenceOfHAsciiString) mySupers;
+  Handle(Express_HSequenceOfEntity) myInherit;
+  Handle(Express_HSequenceOfField) myFields;
+  Standard_Boolean myisAbstract;
+};
+
+
+
+
+
+
+
+#endif // _Express_Entity_HeaderFile
diff --git a/src/Express/Express_Enum.cxx b/src/Express/Express_Enum.cxx
new file mode 100644 (file)
index 0000000..f82d4e7
--- /dev/null
@@ -0,0 +1,77 @@
+// Created:    Tue Nov  2 14:40:06 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Enum.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <OSD_Protection.hxx>
+#include <OSD_Path.hxx>
+#include <OSD_Directory.hxx>
+#include <Express.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Enum,Express_Item)
+
+//=======================================================================
+//function : Express_Enum
+//purpose  : 
+//=======================================================================
+
+Express_Enum::Express_Enum (const Standard_CString name, 
+                             const Handle(TColStd_HSequenceOfHAsciiString) &names)
+     : Express_Item(name), myNames(names)
+{
+}
+
+//=======================================================================
+//function : Names
+//purpose  : 
+//=======================================================================
+
+const Handle(TColStd_HSequenceOfHAsciiString) &Express_Enum::Names () const
+{
+  return myNames;
+}
+
+//=======================================================================
+//function : GenerateClass
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Enum::GenerateClass () const
+{
+  std::cout << "Generating ENUMERATION " << CPPName()->ToCString() << std::endl;
+  
+  // create a package directory (if not yet exist)
+  OSD_Protection prot ( OSD_RX, OSD_RWX, OSD_RX, OSD_RX );
+  TCollection_AsciiString pack = GetPackageName()->String();
+  OSD_Path path ( pack );
+  OSD_Directory dir ( path );
+  dir.Build ( prot );
+  pack += "/";
+  pack += GetPackageName()->String();
+  
+  // Open CDL file 
+  std::ofstream os ( pack.Cat ( ".cdl" ).ToCString(), std::ios::out | std::ios::ate );
+
+  os << std::endl << "    enumeration " << Name()->ToCString() << " is " << std::endl;
+  Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(Name());
+  for ( Standard_Integer i=1; i <= myNames->Length(); i++ ) {
+    if ( i >1 ) os << "," << std::endl;
+    os << "    " << prefix->ToCString()<<myNames->Value(i)->ToCString();
+  }
+  os << std::endl << "    end;" << std::endl;
+  os.close();
+  
+  return Standard_False;
+}
diff --git a/src/Express/Express_Enum.hxx b/src/Express/Express_Enum.hxx
new file mode 100644 (file)
index 0000000..68fd076
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Enum_HeaderFile
+#define _Express_Enum_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Item.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+
+//! Implements TYPE ENUMERATION item of the EXPRESS
+//! schema, with interface for deferred Item class.
+class Express_Enum : public Express_Item
+{
+
+public:
+
+  
+  //! Create ENUM item and initialize it
+  Standard_EXPORT Express_Enum(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& names);
+  
+  //! Returns names of enumeration variants
+  Standard_EXPORT  const  Handle(TColStd_HSequenceOfHAsciiString)& Names()  const;
+  
+  //! Create CDL/CXX files from item
+  Standard_EXPORT virtual   Standard_Boolean GenerateClass()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Enum,Express_Item)
+
+protected:
+
+
+
+
+private: 
+
+
+  Handle(TColStd_HSequenceOfHAsciiString) myNames;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Enum_HeaderFile
diff --git a/src/Express/Express_Field.cxx b/src/Express/Express_Field.cxx
new file mode 100644 (file)
index 0000000..584a67f
--- /dev/null
@@ -0,0 +1,77 @@
+// Created:    Tue Nov  2 16:40:51 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Field.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Field,Standard_Transient)
+
+//=======================================================================
+//function : Express_Field
+//purpose  : 
+//=======================================================================
+
+Express_Field::Express_Field (const Standard_CString name,
+                               const Handle(Express_Type) &type,
+                               const Standard_Boolean opt)
+{
+  myName = new TCollection_HAsciiString ( name );
+  myType = type;
+  myOpt  = opt;
+}
+
+//=======================================================================
+//function : Express_Field
+//purpose  : 
+//=======================================================================
+
+Express_Field::Express_Field (const Handle(TCollection_HAsciiString) &name,
+                               const Handle(Express_Type) &type,
+                               const Standard_Boolean opt)
+{
+  myName = name;
+  myType = type;
+  myOpt  = opt;
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+
+const Handle(TCollection_HAsciiString) &Express_Field::Name () const 
+{
+  return myName;
+}
+
+//=======================================================================
+//function : Type
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_Type) &Express_Field::Type () const 
+{
+  return myType;
+}
+
+//=======================================================================
+//function : IsOptional
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Field::IsOptional () const 
+{
+  return myOpt;
+}
diff --git a/src/Express/Express_Field.hxx b/src/Express/Express_Field.hxx
new file mode 100644 (file)
index 0000000..05a1cea
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Field_HeaderFile
+#define _Express_Field_HeaderFile
+
+#include <Standard_Type.hxx>
+
+class TCollection_HAsciiString;
+class Express_Type;
+
+
+//! Represents field of the ENTITY item in the EXPRESS schema
+class Express_Field : public Standard_Transient
+{
+
+public:
+
+  
+  //! Create object and initialize it
+  Standard_EXPORT Express_Field(const Standard_CString name, const Handle(Express_Type)& type, const Standard_Boolean opt);
+  
+  //! Create object and initialize it
+  Standard_EXPORT Express_Field(const Handle(TCollection_HAsciiString)& name, const Handle(Express_Type)& type, const Standard_Boolean opt);
+  
+  //! Returns field name
+  Standard_EXPORT  const  Handle(TCollection_HAsciiString)& Name()  const;
+  
+  //! Returns field type
+  Standard_EXPORT  const  Handle(Express_Type)& Type()  const;
+  
+  //! Returns True if field is optional
+  Standard_EXPORT   Standard_Boolean IsOptional()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Field,Standard_Transient)
+
+protected:
+
+
+
+
+private: 
+
+
+  Handle(TCollection_HAsciiString) myName;
+  Handle(Express_Type) myType;
+  Standard_Boolean myOpt;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Field_HeaderFile
diff --git a/src/Express/Express_HSequenceOfEntity.hxx b/src/Express/Express_HSequenceOfEntity.hxx
new file mode 100644 (file)
index 0000000..4d3ad2f
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_HSequenceOfEntity_HeaderFile
+#define Express_HSequenceOfEntity_HeaderFile
+
+#include <Express_SequenceOfEntity.hxx>
+#include <NCollection_DefineHSequence.hxx>
+
+DEFINE_HSEQUENCE(Express_HSequenceOfEntity, Express_SequenceOfEntity)
+
+
+#endif
diff --git a/src/Express/Express_HSequenceOfField.hxx b/src/Express/Express_HSequenceOfField.hxx
new file mode 100644 (file)
index 0000000..46ab070
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_HSequenceOfField_HeaderFile
+#define Express_HSequenceOfField_HeaderFile
+
+#include <Express_SequenceOfField.hxx>
+#include <NCollection_DefineHSequence.hxx>
+
+DEFINE_HSEQUENCE(Express_HSequenceOfField, Express_SequenceOfField)
+
+
+#endif
diff --git a/src/Express/Express_HSequenceOfItem.hxx b/src/Express/Express_HSequenceOfItem.hxx
new file mode 100644 (file)
index 0000000..6490991
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_HSequenceOfItem_HeaderFile
+#define Express_HSequenceOfItem_HeaderFile
+
+#include <Express_SequenceOfItem.hxx>
+#include <NCollection_DefineHSequence.hxx>
+
+DEFINE_HSEQUENCE(Express_HSequenceOfItem, Express_SequenceOfItem)
+
+
+#endif
diff --git a/src/Express/Express_Integer.cxx b/src/Express/Express_Integer.cxx
new file mode 100644 (file)
index 0000000..6827069
--- /dev/null
@@ -0,0 +1,48 @@
+// Created:    Tue Nov  2 15:27:26 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Integer.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Integer,Express_PredefinedType)
+
+//=======================================================================
+//function : Express_Integer
+//purpose  : 
+//=======================================================================
+
+Express_Integer::Express_Integer () 
+{
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Integer::CPPName () const
+{
+  return new TCollection_HAsciiString ( "Standard_Integer" );
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Integer::CDLName () const
+{
+  return new TCollection_HAsciiString ( "Integer" );
+}
diff --git a/src/Express/Express_Integer.hxx b/src/Express/Express_Integer.hxx
new file mode 100644 (file)
index 0000000..1637a4a
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Integer_HeaderFile
+#define _Express_Integer_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_PredefinedType.hxx>
+class TCollection_HAsciiString;
+
+
+//! Implements EXPRESS type 'INTEGER'
+class Express_Integer : public Express_PredefinedType
+{
+
+public:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_Integer();
+  
+  //! Returns "Standard_Integer"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns "Integer"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Integer,Express_PredefinedType)
+
+protected:
+
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Integer_HeaderFile
diff --git a/src/Express/Express_Item.cxx b/src/Express/Express_Item.cxx
new file mode 100644 (file)
index 0000000..55dd571
--- /dev/null
@@ -0,0 +1,253 @@
+// Created:    Tue Nov  2 13:14:31 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Item.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Item,Standard_Transient)
+
+//=======================================================================
+//function : Express_Item
+//purpose  : 
+//=======================================================================
+
+Express_Item::Express_Item (const Standard_CString name)
+{
+  myName = new TCollection_HAsciiString ( name );
+  myMark = Standard_False;
+  myShortName = new TCollection_HAsciiString;
+  myCategory = new TCollection_HAsciiString;
+  myhasCheck = Standard_False;
+  myhasFillShared = Standard_False;
+}
+
+//=======================================================================
+//function : Express_Item
+//purpose  : 
+//=======================================================================
+
+Express_Item::Express_Item (const Handle(TCollection_HAsciiString) &name)
+{
+  myName = name;
+  myMark = Standard_False;
+  myShortName = new TCollection_HAsciiString;
+  myCategory = new TCollection_HAsciiString;
+  myhasCheck = Standard_False;
+  myhasFillShared = Standard_False;
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+
+const Handle(TCollection_HAsciiString) &Express_Item::Name () const
+{
+  return myName;
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Item::CPPName () const
+{
+  Handle(TCollection_HAsciiString) name = GetPackageName ( Standard_True )->Cat ( "_" );
+  name->AssignCat ( myName );
+  return name;
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Item::CDLName () const
+{
+  Handle(TCollection_HAsciiString) name = myName->Cat ( " from " );
+  name->AssignCat ( GetPackageName ( Standard_True ) );
+  return name;
+}
+
+//=======================================================================
+//function : SetPackageName
+//purpose  : 
+//=======================================================================
+
+void Express_Item::SetPackageName (const Handle(TCollection_HAsciiString) &pack)
+{
+  myPack = pack;
+}
+
+//=======================================================================
+//function : GetPackageName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Item::GetPackageName (const Standard_Boolean Auto) const
+{
+  if ( myPack.IsNull() && Auto ) return new TCollection_HAsciiString ( "StepStep" );
+  return myPack;
+}
+
+//=======================================================================
+//function : GetMark
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Item::GetMark () const
+{
+  return myMark;
+}
+
+//=======================================================================
+//function : SetMark
+//purpose  : 
+//=======================================================================
+
+void Express_Item::SetMark (const Standard_Boolean mark) 
+{
+  myMark = mark;
+}
+
+//=======================================================================
+//function : Generate
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Item::Generate ()
+{
+  if ( ! GetMark() ) return Standard_False;
+  if ( GetPackageName().IsNull() )
+    SetPackageName ( GetPackageName ( Standard_True ) );
+  SetMark ( Standard_False );
+  return GenerateClass();
+}
+
+//=======================================================================
+//function : Use
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Item::Use (const Handle(TCollection_HAsciiString) &pack, 
+                                    const Standard_Boolean defer) 
+{
+  if ( ! GetPackageName().IsNull() ) {
+    // issue a warning message if item from known package uses item from unknown package (StepStep)
+    if ( pack->String().IsDifferent ( "StepStep" ) &&
+         GetPackageName()->String().IsEqual ( "StepStep" ) ) {
+      std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, but used from package " << pack->ToCString() << std::endl;
+    }
+  
+    return Standard_False;
+  }
+  
+  // issue a warning message if type still does not have package assigned
+  if ( pack->String().IsDifferent ( "StepStep" ) ) {
+    std::cout << "Warning: item " << Name()->ToCString() << " has no package assigned, setting " << pack->ToCString() << std::endl;
+  }
+  
+  SetPackageName ( pack );
+  SetMark ( Standard_True );
+  if ( defer ) return Standard_False;
+  
+  // manage indent for cout in order to mark structure of calls
+  static Standard_Integer shift=0;
+  shift++;
+  for ( Standard_Integer i=0; i < shift; i++ ) std::cout << "  ";
+  Standard_Boolean res = Generate(); 
+  shift--;
+  return res;
+}
+//=======================================================================
+//function : SetCategory
+//purpose  : 
+//=======================================================================
+
+ void Express_Item::SetCategory(const Handle(TCollection_HAsciiString)& categ) 
+{
+   myCategory = categ;
+}
+
+//=======================================================================
+//function : Cartegory
+//purpose  : 
+//=======================================================================
+
+ Handle(TCollection_HAsciiString) Express_Item::Category() const
+{
+  return myCategory;
+}
+
+//=======================================================================
+//function : SetShortName
+//purpose  : 
+//=======================================================================
+
+ void Express_Item::SetShortName(const Handle(TCollection_HAsciiString)& shname) 
+{
+   myShortName = shname;
+}
+
+//=======================================================================
+//function : ShortName
+//purpose  : 
+//=======================================================================
+
+ Handle(TCollection_HAsciiString) Express_Item::ShortName() const
+{
+  return  myShortName;
+}
+//=======================================================================
+//function : SetCheckFlag
+//purpose  : 
+//=======================================================================
+
+ void Express_Item::SetCheckFlag(const Standard_Boolean checkFlag) 
+{
+  myhasCheck = checkFlag;
+}
+
+//=======================================================================
+//function : CheckFlag
+//purpose  : 
+//=======================================================================
+
+ Standard_Boolean Express_Item::CheckFlag() const
+{
+  return myhasCheck;
+}
+
+//=======================================================================
+//function : SetFillSharedFlag
+//purpose  : 
+//=======================================================================
+
+ void Express_Item::SetFillSharedFlag(const Standard_Boolean fillsharedFlag) 
+{
+  myhasFillShared = fillsharedFlag;
+}
+
+//=======================================================================
+//function : FillSharedFlag
+//purpose  : 
+//=======================================================================
+
+ Standard_Boolean Express_Item::FillSharedFlag() const
+{
+  return myhasFillShared;
+}
+
diff --git a/src/Express/Express_Item.hxx b/src/Express/Express_Item.hxx
new file mode 100644 (file)
index 0000000..4c6c480
--- /dev/null
@@ -0,0 +1,136 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Item_HeaderFile
+#define _Express_Item_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineHandle.hxx>
+
+#include <Standard_Boolean.hxx>
+#include <Standard_Transient.hxx>
+#include <Standard_CString.hxx>
+class TCollection_HAsciiString;
+
+
+//! Base class for items of the schema. Stores a name of the class,
+//! package name and flag used to mark items for generation.
+//! Provides interface for writing generated class definitions to CDL
+//! and CXX files.
+class Express_Item : public Standard_Transient
+{
+
+public:
+
+  
+  //! Returns item name
+  Standard_EXPORT  const  Handle(TCollection_HAsciiString)& Name()  const;
+  
+  //! Returns (generated) name for the item in CXX-style (Package_Class)
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns (generated) name for the item in CDL-style (Class from Package)
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+  
+  //! Returns package name
+  //! If not defined, returns NULL if auto is False (default)
+  //! or "StepStep" if auto is True
+  Standard_EXPORT   Handle(TCollection_HAsciiString) GetPackageName (const Standard_Boolean Auto = Standard_False)  const;
+  
+  //! Sets package name
+  Standard_EXPORT   void SetPackageName (const Handle(TCollection_HAsciiString)& pack) ;
+  
+  //! Returns True if item is marked for generation
+  Standard_EXPORT   Standard_Boolean GetMark()  const;
+  
+  //! Change generation mark flag
+  Standard_EXPORT   void SetMark (const Standard_Boolean mark) ;
+  
+  //! General interface for creating CDL/CXX files from item
+  Standard_EXPORT virtual   Standard_Boolean GenerateClass()  const = 0;
+  
+  //! Checks that item is marked for generation and if yes,
+  //! generate it by calling GenerateClass. But firstly define
+  //! PackageName to "StepStep" if not yet defined and drop Mark flag.
+  Standard_EXPORT   Standard_Boolean Generate() ;
+  
+  //! Declares item as used by other item being generated
+  //! Checks that item has package defined. If not, package is defined
+  //! by pack argument (supposing that it is package of item that uses
+  //! current one) and Mark flag is set. Then, if defer is False,
+  //! calls Generate().
+  Standard_EXPORT   Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False) ;
+  
+  //! Set category for item
+  Standard_EXPORT   void SetCategory (const Handle(TCollection_HAsciiString)& categ) ;
+  
+  //! Get item category
+  Standard_EXPORT   Handle(TCollection_HAsciiString) Category()  const;
+  
+  //! Set short name for item
+  Standard_EXPORT   void SetShortName (const Handle(TCollection_HAsciiString)& shname) ;
+  
+  //! Get item short name
+  Standard_EXPORT   Handle(TCollection_HAsciiString) ShortName()  const;
+  
+  //! Set flag for presence of method Check in the class
+  Standard_EXPORT   void SetCheckFlag (const Standard_Boolean checkFlag) ;
+  
+  //! Get flag resposible for  presence of method Check in the class
+  Standard_EXPORT   Standard_Boolean CheckFlag()  const;
+  
+  //! Set flag for presence of method FillShared in the class
+  Standard_EXPORT   void SetFillSharedFlag (const Standard_Boolean fillsharedFlag) ;
+  
+  //! Get flag resposible for  presence of method FillShared in the class
+  Standard_EXPORT   Standard_Boolean FillSharedFlag()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Item,Standard_Transient)
+
+protected:
+
+  
+  //! Creates object and initialises fields PackageName and
+  //! CreateFlag by 0
+  Standard_EXPORT Express_Item(const Standard_CString name);
+  
+  //! Creates object and initialises fields PackageName and
+  //! CreateFlag by 0
+  Standard_EXPORT Express_Item(const Handle(TCollection_HAsciiString)& name);
+
+
+
+private: 
+
+
+  Handle(TCollection_HAsciiString) myName;
+  Handle(TCollection_HAsciiString) myPack;
+  Standard_Boolean myMark;
+  Handle(TCollection_HAsciiString) myShortName;
+  Handle(TCollection_HAsciiString) myCategory;
+  Standard_Boolean myhasCheck;
+  Standard_Boolean myhasFillShared;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Item_HeaderFile
diff --git a/src/Express/Express_List.hxx b/src/Express/Express_List.hxx
new file mode 100644 (file)
index 0000000..ec0a961
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_List_HeaderFile
+#define _Express_List_HeaderFile
+
+#include <Express_ComplexType.hxx>
+
+typedef Express_ComplexType Express_List;
+
+#endif // _Express_List_HeaderFile
diff --git a/src/Express/Express_Logical.cxx b/src/Express/Express_Logical.cxx
new file mode 100644 (file)
index 0000000..e80cdbf
--- /dev/null
@@ -0,0 +1,79 @@
+// Created:    Tue Nov  2 15:27:26 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Logical.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Logical,Express_PredefinedType)
+
+//=======================================================================
+//function : Express_Logical
+//purpose  : 
+//=======================================================================
+
+Express_Logical::Express_Logical () 
+{
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Logical::CPPName () const
+{
+  return new TCollection_HAsciiString ( "StepData_Logical" );
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Logical::CDLName () const
+{
+  return new TCollection_HAsciiString ( "Logical from StepData" );
+}
+
+//=======================================================================
+//function : IsStandard
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Logical::IsStandard () const
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : IsSimple
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Logical::IsSimple () const
+{
+  return Standard_True;
+}
+
+//=======================================================================
+//function : IsHandle
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Logical::IsHandle () const
+{
+  return Standard_False;
+}
+
diff --git a/src/Express/Express_Logical.hxx b/src/Express/Express_Logical.hxx
new file mode 100644 (file)
index 0000000..983dbbe
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Logical_HeaderFile
+#define _Express_Logical_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_PredefinedType.hxx>
+
+class TCollection_HAsciiString;
+
+
+//! Implements EXPRESS type 'LOGICAL'
+class Express_Logical : public Express_PredefinedType
+{
+
+public:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_Logical();
+  
+  //! Returns "StepData_Logical"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns "Logical from StepData"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+  
+  //! Return False
+  Standard_EXPORT virtual   Standard_Boolean IsStandard()  const;
+  
+  //! Return False
+  Standard_EXPORT virtual   Standard_Boolean IsSimple()  const;
+  
+  //! Return False
+  Standard_EXPORT virtual   Standard_Boolean IsHandle()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Logical,Express_PredefinedType)
+
+protected:
+
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Logical_HeaderFile
diff --git a/src/Express/Express_NamedType.cxx b/src/Express/Express_NamedType.cxx
new file mode 100644 (file)
index 0000000..6b37f44
--- /dev/null
@@ -0,0 +1,147 @@
+// Created:    Tue Nov  2 15:13:31 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_NamedType.hxx>
+#include <Express_Item.hxx>
+#include <Express_Alias.hxx>
+#include <Express_Entity.hxx>
+#include <Express_Enum.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_NamedType,Express_Type)
+
+//=======================================================================
+//function : Express_NamedType
+//purpose  : 
+//=======================================================================
+
+Express_NamedType::Express_NamedType (const Standard_CString name) 
+{
+  myName = new TCollection_HAsciiString ( name );
+}
+
+//=======================================================================
+//function : Express_NamedType
+//purpose  : 
+//=======================================================================
+
+Express_NamedType::Express_NamedType (const Handle(TCollection_HAsciiString) &name) 
+{
+  myName = name;
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+
+const Handle(TCollection_HAsciiString) &Express_NamedType::Name () const
+{
+  return myName;
+}
+
+//=======================================================================
+//function : Item
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_Item) &Express_NamedType::Item () const
+{
+  return myItem;
+}
+
+//=======================================================================
+//function : SetItem
+//purpose  : 
+//=======================================================================
+
+void Express_NamedType::SetItem (const Handle(Express_Item) &it) 
+{
+  myItem = it;
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_NamedType::CPPName () const
+{
+  return myItem->CPPName();
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_NamedType::CDLName () const
+{
+  return myItem->CDLName();
+}
+
+//=======================================================================
+//function : IsStandard
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_NamedType::IsStandard () const
+{
+  if ( myItem->IsKind(STANDARD_TYPE(Express_Alias)) ) {
+    Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( myItem );
+    return alias->Type()->IsStandard();
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : IsSimple
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_NamedType::IsSimple () const
+{
+  if ( myItem->IsKind(STANDARD_TYPE(Express_Alias)) ) {
+    Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( myItem );
+    return alias->Type()->IsSimple();
+  }
+  if ( myItem->IsKind(STANDARD_TYPE(Express_Enum)) ) return Standard_True;
+  return Standard_False; // SELECT & ENTITY
+}
+
+//=======================================================================
+//function : IsHandle
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_NamedType::IsHandle () const
+{
+  if ( myItem->IsKind(STANDARD_TYPE(Express_Alias)) ) {
+    Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( myItem );
+    return alias->Type()->IsHandle();
+  }
+  if ( myItem->IsKind(STANDARD_TYPE(Express_Entity)) ) return Standard_True;
+  return Standard_False; // SELECT & ENUMERATION
+}
+
+//=======================================================================
+//function : Use
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_NamedType::Use (const Handle(TCollection_HAsciiString) &pack,
+                                         const Standard_Boolean defer) const
+{
+  return myItem->Use ( pack, defer );
+}
diff --git a/src/Express/Express_NamedType.hxx b/src/Express/Express_NamedType.hxx
new file mode 100644 (file)
index 0000000..87c9f71
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_NamedType_HeaderFile
+#define _Express_NamedType_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Type.hxx>
+
+class TCollection_HAsciiString;
+class Express_Item;
+
+
+//! Base class for complex types (ARRAY, LIST, BAG, SET)
+//! in EXPRESS schema
+//! Stores type of elements and
+class Express_NamedType : public Express_Type
+{
+
+public:
+
+  
+  //! Creates an object and initializes by name
+  Standard_EXPORT Express_NamedType(const Standard_CString name);
+  
+  //! Creates an object and initializes by name
+  Standard_EXPORT Express_NamedType(const Handle(TCollection_HAsciiString)& name);
+  
+  //! Returns name of type (item in schema)
+  Standard_EXPORT  const  Handle(TCollection_HAsciiString)& Name()  const;
+  
+  //! Returns handle to referred item in schema
+  Standard_EXPORT  const  Handle(Express_Item)& Item()  const;
+  
+  //! Sets handle to referred item in schema
+  Standard_EXPORT   void SetItem (const Handle(Express_Item)& it) ;
+  
+  //! Returns CPP-style name of the type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns CDL-style name of the type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+  
+  //! Return True if type is defined in package Standard
+  Standard_EXPORT virtual   Standard_Boolean IsStandard()  const;
+  
+  //! Return True if type is simple (not a class)
+  Standard_EXPORT virtual   Standard_Boolean IsSimple()  const;
+  
+  //! Return True if type is inherited from Transient
+  Standard_EXPORT virtual   Standard_Boolean IsHandle()  const;
+  
+  //! Declares type as used by some item being generated.
+  //! Calls Use() for referred item (found by name).
+  Standard_EXPORT virtual   Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False)  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_NamedType,Express_Type)
+
+protected:
+
+
+
+
+private: 
+
+
+  Handle(TCollection_HAsciiString) myName;
+  Handle(Express_Item) myItem;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_NamedType_HeaderFile
diff --git a/src/Express/Express_Number.hxx b/src/Express/Express_Number.hxx
new file mode 100644 (file)
index 0000000..7094c0e
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Number_HeaderFile
+#define _Express_Number_HeaderFile
+
+#include <Express_Integer.hxx>
+
+typedef Express_Integer Express_Number;
+
+#endif // _Express_Number_HeaderFile
diff --git a/src/Express/Express_PredefinedType.cxx b/src/Express/Express_PredefinedType.cxx
new file mode 100644 (file)
index 0000000..34d8251
--- /dev/null
@@ -0,0 +1,38 @@
+// Created:    Tue Nov  2 15:13:31 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_PredefinedType.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_PredefinedType,Express_Type)
+
+//=======================================================================
+//function : Express_PredefinedType
+//purpose  : 
+//=======================================================================
+
+Express_PredefinedType::Express_PredefinedType () 
+{
+}
+
+//=======================================================================
+//function : IsStandard
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_PredefinedType::IsStandard () const
+{
+  return Standard_True;
+}
+
diff --git a/src/Express/Express_PredefinedType.hxx b/src/Express/Express_PredefinedType.hxx
new file mode 100644 (file)
index 0000000..98e06c0
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_PredefinedType_HeaderFile
+#define _Express_PredefinedType_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Type.hxx>
+
+//! Base class for predefined types (like NUMBER or STRING)
+//! in EXPRESS schema
+class Express_PredefinedType : public Express_Type
+{
+
+public:
+
+  
+  //! Returns True
+  Standard_EXPORT virtual   Standard_Boolean IsStandard()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_PredefinedType,Express_Type)
+
+protected:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_PredefinedType();
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_PredefinedType_HeaderFile
diff --git a/src/Express/Express_Real.cxx b/src/Express/Express_Real.cxx
new file mode 100644 (file)
index 0000000..255e40f
--- /dev/null
@@ -0,0 +1,48 @@
+// Created:    Tue Nov  2 15:27:26 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Real.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Real,Express_PredefinedType)
+
+//=======================================================================
+//function : Express_Real
+//purpose  : 
+//=======================================================================
+
+Express_Real::Express_Real () 
+{
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Real::CPPName () const
+{
+  return new TCollection_HAsciiString ( "Standard_Real" );
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_Real::CDLName () const
+{
+  return new TCollection_HAsciiString ( "Real" );
+}
diff --git a/src/Express/Express_Real.hxx b/src/Express/Express_Real.hxx
new file mode 100644 (file)
index 0000000..21d1195
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Real_HeaderFile
+#define _Express_Real_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_PredefinedType.hxx>
+class TCollection_HAsciiString;
+
+
+//! Implements EXPRESS type 'REAL'
+class Express_Real : public Express_PredefinedType
+{
+
+public:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_Real();
+  
+  //! Returns "Standard_Real"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns "Real"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Real,Express_PredefinedType)
+
+protected:
+
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Real_HeaderFile
diff --git a/src/Express/Express_Reference.cxx b/src/Express/Express_Reference.cxx
new file mode 100644 (file)
index 0000000..5671b21
--- /dev/null
@@ -0,0 +1,40 @@
+// Created:    Fri Nov 22 13:32:26 2002
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Reference.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Reference,Express_Item)
+
+//=======================================================================
+//function : Express_Reference
+//purpose  : 
+//=======================================================================
+
+Express_Reference::Express_Reference (const Standard_CString name,
+                                        const Handle(TColStd_HSequenceOfHAsciiString) &types)
+     : Express_Item ( name )
+{
+  myTypes = types;
+}
+
+//=======================================================================
+//function : GenerateClass
+//purpose  : dummy method
+//=======================================================================
+
+Standard_Boolean Express_Reference::GenerateClass () const
+{
+  return Standard_False;
+}
diff --git a/src/Express/Express_Reference.hxx b/src/Express/Express_Reference.hxx
new file mode 100644 (file)
index 0000000..7adefbf
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Reference_HeaderFile
+#define _Express_Reference_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Item.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+class Express_HSequenceOfItem;
+
+
+//! Implements REFERENCE FROM (list of types used from other schema)
+//! item of the EXPRESS schema, with interface for Item class.
+class Express_Reference : public Express_Item
+{
+
+public:
+
+  
+  //! Create Reference item and initialize it
+  Standard_EXPORT Express_Reference(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& types);
+  
+  //! Returns list of types referenced
+  const  Handle(TColStd_HSequenceOfHAsciiString)& Types() const { return myTypes; }
+
+  //! Returns handle to sequence of items corresponding to
+  //! listed types
+  const  Handle(Express_HSequenceOfItem)& Items() const { return myItems; }
+  
+  //! Redefined to empty (in order to be able to instantiate)
+  //! Returna False
+  Standard_EXPORT virtual   Standard_Boolean GenerateClass()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Reference,Express_Item)
+
+protected:
+
+
+
+
+private: 
+
+
+  Handle(TColStd_HSequenceOfHAsciiString) myTypes;
+  Handle(Express_HSequenceOfItem) myItems;
+
+
+};
+
+
+#endif // _Express_Reference_HeaderFile
diff --git a/src/Express/Express_Schema.cxx b/src/Express/Express_Schema.cxx
new file mode 100644 (file)
index 0000000..8a1e6a7
--- /dev/null
@@ -0,0 +1,282 @@
+// Created:    Tue Nov  2 12:29:06 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Schema.hxx>
+
+#include <Express_Type.hxx>
+#include <Express_NamedType.hxx>
+#include <Express_ComplexType.hxx>
+#include <Express_Alias.hxx>
+#include <Express_Select.hxx>
+#include <Express_Enum.hxx>
+#include <Express_Entity.hxx>
+#include <Express_Field.hxx>
+#include <Express_HSequenceOfField.hxx>
+#include <Express_HSequenceOfEntity.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Schema,Standard_Transient)
+
+//=======================================================================
+//function : Express_Schema
+//purpose  : 
+//=======================================================================
+
+Express_Schema::Express_Schema (const Standard_CString name,
+                                 const Handle(Express_HSequenceOfItem) &items)
+{
+  myName = new TCollection_HAsciiString ( name );
+  myItems = items;
+  Prepare();
+}
+
+//=======================================================================
+//function : Express_Schema
+//purpose  : 
+//=======================================================================
+
+Express_Schema::Express_Schema (const Handle(TCollection_HAsciiString) &name,
+                                 const Handle(Express_HSequenceOfItem) &items)
+{
+  myName = name;
+  myItems = items;
+  Prepare();
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+
+const Handle(TCollection_HAsciiString) &Express_Schema::Name () const
+{
+  return myName;
+}
+
+//=======================================================================
+//function : Items
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_HSequenceOfItem) &Express_Schema::Items () const
+{
+  return myItems;
+}
+
+//=======================================================================
+//function : NbItems
+//purpose  : 
+//=======================================================================
+
+Standard_Integer Express_Schema::NbItems () const
+{
+  return myItems->Length();
+}
+
+//=======================================================================
+//function : Item
+//purpose  : 
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item (const Standard_Integer num) const
+{
+  return myItems->Value(num);
+}
+
+//=======================================================================
+//function : Item
+//purpose  : 
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item (const Standard_CString name, 
+                                            const Standard_Boolean silent) const
+{
+  if ( ! myDict.IsBound ( name ) ) {
+    if ( ! silent )
+      std::cout << "Error: attempt to access unknown item by name " << name << std::endl;
+    return 0;
+  }
+  return myDict.Find (name);
+}
+
+//=======================================================================
+//function : Item
+//purpose  : 
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item (const TCollection_AsciiString &name) const
+{
+  return Item ( name.ToCString() );
+}
+
+//=======================================================================
+//function : Item
+//purpose  : 
+//=======================================================================
+
+Handle(Express_Item) Express_Schema::Item (const Handle(TCollection_HAsciiString) &name) const
+{
+  return Item ( name->ToCString() );
+}
+
+//=======================================================================
+//function : Prepare
+//purpose  : 
+//=======================================================================
+
+// Convert STEP-style name (lowercase, with underscores)
+// to CASCADE-style name (each word starts with uppercase, no intervals)
+static void NameToCasCade (const Handle(TCollection_HAsciiString) &name)
+{
+  if ( name.IsNull() ) return;
+  for ( Standard_Integer i=1; i <= name->Length(); i++ ) {
+    if ( name->Value(i) == '_' ) {
+      name->Remove ( i );
+    }
+    else if ( i >1 ) continue;
+    name->SetValue ( i, UpperCase ( name->Value(i) ) );
+  }
+}
+
+// Convert names for Type object
+static void NameToCasCade (const Handle(Express_Type) &type)
+{
+  if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    const Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    NameToCasCade ( named->Name() );
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) {
+    const Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type );
+    NameToCasCade ( complex->Type() );
+  }
+}
+
+// Prepare data: convert names to CasCade, fill dictionary of typenames
+// and set handles to items where they are referenced by names
+void Express_Schema::Prepare ()
+{
+  myDict.Clear();
+  if ( myItems.IsNull() ) return;
+  
+  Standard_Integer nbItems = NbItems();
+  
+  // convert names annd fill dictionary
+  for ( Standard_Integer num=1; num <= nbItems; num++ ) {
+    // get item
+    const Handle(Express_Item) item = Item(num);
+
+    // change item name
+    NameToCasCade ( item->Name() );
+
+    // change names of referred types and other names
+    if ( item->IsKind(STANDARD_TYPE(Express_Alias)) ) {
+      const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( item );
+      NameToCasCade ( alias->Type() );
+    }
+    else if ( item->IsKind(STANDARD_TYPE(Express_Select)) ) {
+      const Handle(Express_Select) select = Handle(Express_Select)::DownCast ( item );
+      for ( Standard_Integer i=1; i <= select->Names()->Length(); i++ )
+       NameToCasCade ( select->Names()->Value(i) );
+    }
+    else if ( item->IsKind(STANDARD_TYPE(Express_Enum)) ) {
+      const Handle(Express_Enum) en = Handle(Express_Enum)::DownCast ( item );
+      for ( Standard_Integer i=1; i <= en->Names()->Length(); i++ )
+       NameToCasCade ( en->Names()->Value(i) );
+    }
+    else if ( item->IsKind(STANDARD_TYPE(Express_Entity)) ) {
+      const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast ( item );
+      for ( Standard_Integer i=1; i <= ent->SuperTypes()->Length(); i++ )
+       NameToCasCade ( ent->SuperTypes()->Value(i) );
+      const Handle(Express_HSequenceOfField) fields = ent->Fields();
+      for (Standard_Integer i=1; i <= fields->Length(); i++ ) {
+       NameToCasCade ( fields->Value(i)->Name() );
+       NameToCasCade ( fields->Value(i)->Type() );
+      }
+    }
+
+    // add to dictionary
+    myDict.Bind (item->Name()->String(), item);
+  }
+
+  // set references to items from other items and types
+  for (Standard_Integer num=1; num <= nbItems; num++ ) {
+    const Handle(Express_Item) item = Item(num);
+
+    if ( item->IsKind(STANDARD_TYPE(Express_Alias)) ) {
+      const Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast ( item );
+      PrepareType ( alias->Type() );
+      // for aliases, define package to avoid warnings
+      alias->SetPackageName ( new TCollection_HAsciiString ( "Standard" ) );
+      continue;
+    }
+    else if ( item->IsKind(STANDARD_TYPE(Express_Select)) ) {
+      const Handle(Express_Select) select = Handle(Express_Select)::DownCast ( item );
+      Handle(TColStd_HSequenceOfHAsciiString) names = select->Names();
+      Handle(Express_HSequenceOfItem) items = select->Items();
+      for ( Standard_Integer i=1; i <= names->Length(); i++ ) {
+       Handle(Express_Item) it = Item ( names->Value(i) );
+       // if select refers to another select, expand it
+       if ( it->IsKind(STANDARD_TYPE(Express_Select)) ) {
+         std::cout << "Info: SELECT " << item->Name()->ToCString() << " refers to another SELECT " << 
+                      it->Name()->ToCString() << "; expanded" << std::endl;
+         const Handle(Express_Select) sel = Handle(Express_Select)::DownCast ( it );
+          Standard_Integer j = 1;
+         for ( ; j <= sel->Names()->Length(); j++ )
+           names->InsertBefore ( i+j-1, sel->Names()->Value(j) );
+         names->Remove ( i+j-1 );
+         i--;
+         continue;
+       }
+       items->Append ( it );
+      }
+    }
+    else if ( item->IsKind(STANDARD_TYPE(Express_Entity)) ) {
+      const Handle(Express_Entity) ent = Handle(Express_Entity)::DownCast ( item );
+      Handle(TColStd_HSequenceOfHAsciiString) names = ent->SuperTypes();
+      Handle(Express_HSequenceOfEntity) inh = ent->Inherit();
+      for ( Standard_Integer i=1; i <= names->Length(); i++ ) {
+       Handle(Express_Entity) subent = Handle(Express_Entity)::DownCast ( Item ( names->Value(i) ) );
+       if ( ! subent.IsNull() ) inh->Append ( subent );
+       else 
+        {
+          std::cout << "Error in " << item->Name()->ToCString() << ": supertype " << 
+                       names->Value(i)->ToCString() << " is not an ENTITY; ignored" << std::endl;
+        }
+      }
+      const Handle(Express_HSequenceOfField) fields = ent->Fields();
+      for (Standard_Integer i=1; i <= fields->Length(); i++ )
+       PrepareType ( fields->Value(i)->Type() );
+    }
+  }
+
+}
+
+//=======================================================================
+//function : PrepareType
+//purpose  : 
+//=======================================================================
+
+void Express_Schema::PrepareType (const Handle(Express_Type) &type) const
+{
+  if ( type->IsKind(STANDARD_TYPE(Express_NamedType)) ) {
+    Handle(Express_NamedType) named = Handle(Express_NamedType)::DownCast ( type );
+    named->SetItem ( Item ( named->Name() ) );
+  }
+  else if ( type->IsKind(STANDARD_TYPE(Express_ComplexType)) ) {
+    Handle(Express_ComplexType) complex = Handle(Express_ComplexType)::DownCast ( type );
+    PrepareType ( complex->Type() );
+  }
+}
diff --git a/src/Express/Express_Schema.hxx b/src/Express/Express_Schema.hxx
new file mode 100644 (file)
index 0000000..d5c8c13
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Schema_HeaderFile
+#define _Express_Schema_HeaderFile
+
+#include <Standard_Type.hxx>
+#include <Express_DataMapOfAsciiStringItem.hxx>
+#include <Express_HSequenceOfItem.hxx>
+
+class TCollection_HAsciiString;
+class Express_HSequenceOfItem;
+class Express_Item;
+class TCollection_AsciiString;
+class Express_Type;
+
+
+//! Represents a schema as a list of items and provides general
+//! tools for generating CDL/CXX files (including dictionary of
+//! item names)
+class Express_Schema : public Standard_Transient
+{
+
+public:
+
+  
+  //! Creates a schema with given name and given set of items
+  //! and calls Prepare()
+  Standard_EXPORT Express_Schema(const Standard_CString Name, const Handle(Express_HSequenceOfItem)& items);
+  
+  //! Creates a schema with given name and given set of items
+  //! and calls Prepare()
+  Standard_EXPORT Express_Schema(const Handle(TCollection_HAsciiString)& Name, const Handle(Express_HSequenceOfItem)& items);
+  
+  //! Returns schema name
+  Standard_EXPORT  const  Handle(TCollection_HAsciiString)& Name()  const;
+  
+  //! Returns sequence of items
+  Standard_EXPORT  const  Handle(Express_HSequenceOfItem)& Items()  const;
+  
+  //! Returns number of items
+  Standard_EXPORT   Standard_Integer NbItems()  const;
+  
+  //! Returns item by index
+  Standard_EXPORT   Handle(Express_Item) Item (const Standard_Integer num)  const;
+  
+  //! Returns item by name
+  Standard_EXPORT   Handle(Express_Item) Item (const Standard_CString name, const Standard_Boolean silent = Standard_False)  const;
+  
+  //! Returns item by name
+  Standard_EXPORT   Handle(Express_Item) Item (const TCollection_AsciiString& name)  const;
+  
+  //! Returns item by name
+  Standard_EXPORT   Handle(Express_Item) Item (const Handle(TCollection_HAsciiString)& name)  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Schema,Standard_Transient)
+
+protected:
+
+
+
+
+private: 
+
+  
+  //! Prepares data for further work. Converts all item names
+  //! from EXPRESS style (aaa_bb) to CASCADE style (AaaBb).
+  //! Then, makes a dictionary of item names and sets handles
+  //! to all items referred initially by name
+  Standard_EXPORT   void Prepare() ;
+  
+  //! Prepares type for work by setting its handle to item in the
+  //! schema according to dictionary (for types which refer items
+  //! by name)
+  Standard_EXPORT   void PrepareType (const Handle(Express_Type)& type)  const;
+
+  Handle(TCollection_HAsciiString) myName;
+  Handle(Express_HSequenceOfItem) myItems;
+  Express_DataMapOfAsciiStringItem myDict;
+};
+
+#endif // _Express_Schema_HeaderFile
diff --git a/src/Express/Express_Select.cxx b/src/Express/Express_Select.cxx
new file mode 100644 (file)
index 0000000..66f63e0
--- /dev/null
@@ -0,0 +1,530 @@
+// Created:    Tue Nov  2 14:40:06 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Select.hxx>
+#include <Express.hxx>
+
+#include <OSD_Protection.hxx>
+#include <OSD_Directory.hxx>
+#include <OSD_Path.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <Express_Enum.hxx>
+#include <Express_Entity.hxx>
+#include <Express_Alias.hxx>
+#include <Express_PredefinedType.hxx>
+#include <Express_Type.hxx>
+#include <Express_HSequenceOfItem.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Select,Express_Item)
+
+//=======================================================================
+//function : Express_Select
+//purpose  : 
+//=======================================================================
+
+Express_Select::Express_Select (const Standard_CString name, 
+                                 const Handle(TColStd_HSequenceOfHAsciiString) &names)
+     : Express_Item(name), myNames(names)
+{
+  myItems = new Express_HSequenceOfItem;
+}
+
+//=======================================================================
+//function : Names
+//purpose  : 
+//=======================================================================
+
+const Handle(TColStd_HSequenceOfHAsciiString) &Express_Select::Names () const
+{
+  return myNames;
+}
+
+//=======================================================================
+//function : Items
+//purpose  : 
+//=======================================================================
+
+const Handle(Express_HSequenceOfItem) &Express_Select::Items () const
+{
+  return myItems;
+}
+
+//=======================================================================
+//function : GenerateClass
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Select::GenerateClass () const
+{
+  Handle(TCollection_HAsciiString) CPPname = CPPName();
+  Handle(TCollection_HAsciiString) CDLname = CDLName();
+  
+  Handle(TColStd_HSequenceOfInteger) seqMember = new TColStd_HSequenceOfInteger;
+  Handle(TColStd_HSequenceOfInteger) seqEntities = new TColStd_HSequenceOfInteger;
+  for ( Standard_Integer i=1; i <= myItems->Length(); i++ ) {
+    Handle(Express_Item) item = myItems->Value(i);
+    if (item->IsKind(STANDARD_TYPE(Express_Entity)) || item->IsKind(STANDARD_TYPE(Express_Select))) 
+       seqEntities->Append(i);
+    else seqMember->Append(i);
+    
+  }
+  //if(!seqEntities->IsEmpty())
+    std::cout << "Generating SELECT " << CPPname->ToCString() << std::endl;
+  if(!seqMember->IsEmpty()) {
+    std::cout << "Generating SELECTMember " << CPPname->ToCString() << "Member"<< std::endl;
+    GenerateSelectMember(seqMember);
+  }
+  // create a package directory (if not yet exist)
+  OSD_Protection prot ( OSD_RX, OSD_RWX, OSD_RX, OSD_RX );
+  TCollection_AsciiString pack = GetPackageName()->String();
+  OSD_Path path ( pack );
+  OSD_Directory dir ( path );
+  dir.Build ( prot );
+  pack += "/";
+  pack += CPPname->String();
+  
+  //===============================
+  // Step 1: generating CDL
+  
+  // Open CDL file 
+  std::ofstream os ( pack.Cat ( ".cdl" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, CPPname, Standard_True );
+
+  // write start of declaration (inheritance)
+  os << "class " << CDLname->ToCString() << std::endl << "inherits SelectType from StepData";
+  os << std::endl << std::endl;
+  
+  os << "    ---Purpose: Representation of STEP SELECT type " << Name()->ToCString() << std::endl;
+  os << std::endl;
+  
+  // write "uses" section (also creates all used types)
+  os << "uses" << std::endl;
+  os << "    SelectMember from StepData";
+  Standard_Integer jj =1;
+  for (Standard_Integer i=1; i <= myItems->Length(); i++ ) {
+    Handle(Express_Item) item = myItems->Value(i);
+    item->Use ( GetPackageName() );
+    if(item->IsKind(STANDARD_TYPE(Express_Alias))) {
+      Handle(Express_Type) type = Handle(Express_Alias)::DownCast(item )->Type();
+      TCollection_AsciiString ats = type->CPPName()->String();
+      if(type->IsStandard()) //(STANDARD_TYPE(Express_PredefinedType)))
+       continue;
+     }
+    os << "," << std::endl;
+    os << "    ";
+    os << item->CDLName()->ToCString();
+    jj++;
+  }
+  os << std::endl << std::endl;
+    
+  // write "is" section
+  os << "is" << std::endl;
+  os << "    Create returns " << CDLname->ToCString() << ";" << std::endl;
+  os << "      ---Purpose: Empty constructor" << std::endl;
+  os << std::endl;
+  os << "    CaseNum (me; ent: Transient) returns Integer;" << std::endl;
+  os << "      ---Purpose: Recognizes a kind of " << Name()->ToCString() << " select type" << std::endl;
+  Standard_Integer j =1;
+  if(seqEntities->Length()) {
+    for( j =1; j <= seqEntities->Length(); j++) {
+      Standard_Integer ind = seqEntities->Value(j);
+      os << "  --          " << j << " -> " << myNames->Value(ind)->ToCString() << std::endl;
+    }
+    
+    os << "    --          0 else" << std::endl << std::endl;
+  }
+  else os << " --          return 0 " << std::endl << std::endl;
+  
+  if(!seqMember->IsEmpty()) {
+    os << "    CaseMem (me; ent: SelectMember from StepData) returns Integer is redefined;" << std::endl;
+    os << "    ---Purpose: Recognizes a items of select member " << Name()->ToCString()<<"Member" << std::endl;
+    for (Standard_Integer i=1; i <= seqMember->Length(); i++ ) {
+      Standard_Integer ind = seqMember->Value(i);
+      os << "  --          " << i << " -> " << myNames->Value(ind)->ToCString() << std::endl;
+    }
+    os << "    --          0 else" << std::endl << std::endl;
+    os << std::endl;
+    os << "     NewMember(me) returns SelectMember from StepData is redefined;" << std::endl;
+    os << "    ---Purpose: Returns a new select member the type " <<Name()->ToCString()<<"Member" << std::endl;
+    os << std::endl;
+  }
+  //write method get for entities
+  for (Standard_Integer i=1; i <= seqEntities->Length(); i++ ) {
+    Standard_Integer ind = seqEntities->Value(i);
+    Handle(Express_Item) item = myItems->Value(ind);
+    Handle(TCollection_HAsciiString) name = item->Name();
+    os << "    " << name->ToCString() << " (me) returns " << item->CDLName()->ToCString() << ";" << std::endl;
+    os << "    ---Purpose: Returns Value as " << name->ToCString() << " (or Null if another type)" << std::endl;
+    os << std::endl;
+  }
+  //writes method set and get for enum , integer, real and string.
+  for (Standard_Integer i = 1; i <= seqMember->Length(); i++) {
+    Standard_Integer ind = seqMember->Value(i);
+    Handle(Express_Item) item = myItems->Value(ind);
+    Handle(TCollection_HAsciiString) name = item->Name();
+    os << "    Set" << name->ToCString() << "(me: in out; aVal :" << item->CDLName()->ToCString()<<");"<< std::endl;
+    os << "    ---Purpose: Set Value for " << name->ToCString() << std::endl;
+    os << std::endl;
+    os << "    " << name->ToCString() << " (me) returns " << item->CDLName()->ToCString() << ";" << std::endl;
+    os << "    ---Purpose: Returns Value as " << name->ToCString() << " (or Null if another type)" << std::endl;
+    os << std::endl;
+  }
+  
+  // write end
+  os << "end " << Name()->ToCString() << ";" << std::endl;
+  os.close();
+  
+  //===============================
+  // Step 2: generating CXX
+  
+  // Open CXX file 
+  os.open ( pack.Cat ( ".cxx" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, CPPname, Standard_False );
+
+  // write include section
+  os << "#include <" << CPPname->ToCString() << ".ixx>" << std::endl;
+  if(!seqMember->IsEmpty()) {
+    os << "#include <"<<CPPName()->ToCString()<<"Member.hxx>"<< std::endl;
+    os << "#include <TCollection_HAsciiString.hxx>"<< std::endl;
+    
+  }
+  // write constructor
+  Express::WriteMethodStamp ( os, CPPname );
+  os << CPPname->ToCString() << "::" << CPPname->ToCString() << " ()" << std::endl;
+  os << "{" << std::endl << "}" << std::endl;
+
+  // write CaseNum method
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "CaseNum" ) );
+  os << "Standard_Integer " << CPPname->ToCString() << "::CaseNum (const Handle(Standard_Transient)& ent) const" << std::endl;
+  os << "{" << std::endl;
+  
+  if(!seqEntities->IsEmpty()) {
+    os << "  if (ent.IsNull()) return 0;" << std::endl;
+    for (Standard_Integer i=1; i <= seqEntities->Length(); i++ )  {
+      Standard_Integer ind = seqEntities->Value(i);
+      os << "  if (ent->IsKind(STANDARD_TYPE(" << 
+        myItems->Value(ind)->CPPName()->ToCString() << "))) return " << i << ";" << std::endl;
+    }
+    os << "  return 0;\n}" << std::endl;
+  }
+  else os << "  return 0;\n}" << std::endl;
+  if(!seqMember->IsEmpty()) { //gka for AP209
+    
+    //write CaseMem method
+    Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "CaseMem" ) );
+    os<<"Standard_Integer "<<CPPname->ToCString()<<"::CaseMem (const Handle(StepData_SelectMember)& ent) const"<< std::endl;
+    os<<"{"<< std::endl;
+    os<<" if(ent.IsNull()) return 0;"<< std::endl;
+    //os<<" Handle("<< CPPName()->ToCString()<<"Member sm = Handle("<<CPPName()->ToCString()<<"Member)::DownCast(ent);"<< std::endl; 
+    //os<<" if(sm.IsNull()) return 0;"<< std::endl;
+    //os<<" Handle(TCollection_HAsciiString) name;"<< std::endl;
+    for( j = 1; j<= seqMember->Length(); j++) {
+      Standard_Integer ind = seqMember->Value(j);
+      //os<<"  name = new TCollection_HAsciiString(\""<<myNames->Value(ind)->ToCString()<<"\");"<< std::endl;
+      if(j ==1)
+        os<<" if(ent->Matches(\""<<myNames->Value(ind)->ToCString()<< "\")) return "<<j<<";"<< std::endl;
+      else os<<" else if(ent->Matches(\""<<myNames->Value(ind)->ToCString()<< "\")) return "<<j<<";"<< std::endl;
+    }
+    os<<" else return 0;"<< std::endl;
+    os<<"}"<< std::endl;
+    
+    //write NewMember method
+     Express::WriteMethodStamp ( os, new TCollection_HAsciiString ( "NewMember" ) );
+    os<<"Handle(StepData_SelectMember) "<<CPPname->ToCString()<<"::NewMember() const"<< std::endl;
+    os<<"{"<< std::endl;
+    os<<" return new "<<CPPname->ToCString()<<"Member;"<< std::endl;
+    os<<"}"<< std::endl;
+    
+  }
+  
+  
+  // write methods Get for entities.
+  for (Standard_Integer i=1; i <= seqEntities->Length(); i++ ) {
+    Standard_Integer ind = seqEntities->Value(i);
+    Handle(Express_Item) item = myItems->Value(ind);
+    Express::WriteMethodStamp ( os, item->Name() );
+    os << "Handle(" << item->CPPName()->ToCString() << ") " << CPPname->ToCString() <<
+          "::" << item->Name()->ToCString() << " () const" << std::endl;
+    os << "{\n  return Handle(" << item->CPPName()->ToCString() << ")::DownCast(Value());\n}" << std::endl;
+  }
+  
+  //write methods Set and Get for Integer, Real, String and Enum
+  for (Standard_Integer i=1; i <= seqMember->Length(); i++ ) {
+    Standard_Integer ind = seqMember->Value(i);
+    Handle(Express_Item) item = myItems->Value(ind);
+    Handle(TCollection_HAsciiString) stamp = new TCollection_HAsciiString("Set");
+    stamp->AssignCat(item->Name());
+    Express::WriteMethodStamp ( os, stamp );
+    
+    Standard_Boolean isString = (item->CPPName()->String().Location("HAsciiString",1,item->CPPName()->Length()) > 0);
+    Handle(TCollection_HAsciiString) nameFunc = new TCollection_HAsciiString;
+    Handle(TCollection_HAsciiString) Func = new TCollection_HAsciiString;
+    Standard_Boolean isEnum = item->IsKind(STANDARD_TYPE(Express_Enum));
+    if(!isEnum) {
+      if(isString)
+        Func->AssignCat("String");
+      else {
+        nameFunc->AssignCat(item->CPPName());
+        Func = nameFunc;
+        Standard_Integer splitind = nameFunc->String().Location("_",1,item->CPPName()->Length());
+        if(splitind)
+          Func = nameFunc->Split(splitind);
+      }
+    }
+    
+    //write method set
+    if(isString) {
+      os <<  "void "<<CPPname->ToCString() <<
+        "::" << "Set"<<item->Name()->ToCString() << " (const Handle("<<item->CPPName()->ToCString() << ") &val)" << std::endl;
+    }
+    else  
+      os <<  "void "<<CPPname->ToCString() <<
+          "::" << "Set"<<item->Name()->ToCString() << " (const "<<item->CPPName()->ToCString() << " val)" << std::endl;
+
+    os<<"{"<< std::endl;
+    
+    os<< "  Handle("<<CPPname->ToCString()<<"Member) SelMem = Handle(" << CPPname->ToCString()<<"Member)::DownCast(Value());"<< std::endl;
+    os<<"  if(SelMem.IsNull()) return;"<< std::endl;
+    os<<" Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(\""<<item->Name()->ToCString()<<"\");"<< std::endl;
+    os<<" SelMem->SetName(name->ToCString());"<< std::endl;
+    if(isEnum) 
+      os<<" SelMem->SetEnum((Standard_Integer)val);"<< std::endl;
+    else if(isString)
+      os<<" SelMem->Set"<<Func->ToCString()<<"(val->ToCString());"<< std::endl;
+    else 
+      os<<" SelMem->Set"<<Func->ToCString()<<"(val);"<< std::endl;
+    
+    os<<"}"<< std::endl;
+    
+    //write method get
+    Express::WriteMethodStamp ( os, item->Name() );
+    if(isString)
+       os << "Handle("<<item->CPPName()->ToCString() << ") "<<CPPname->ToCString() <<
+      "::" << item->Name()->ToCString() << " () const" << std::endl;
+    else 
+      os << item->CPPName()->ToCString() << " "<<CPPname->ToCString() <<
+      "::" << item->Name()->ToCString() << " () const" << std::endl;
+    
+    os<<"{"<< std::endl;
+    os<< "  Handle("<<CPPname->ToCString()<<"Member) SelMem = Handle(" << CPPname->ToCString()<<"Member)::DownCast(Value());"<< std::endl;
+    os<<"  if(SelMem.IsNull()) return 0;"<< std::endl;
+    os<<" Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString;"<< std::endl;
+    os<<" name->AssignCat(SelMem->Name());"<< std::endl;
+    os<<" Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString(\""<<item->Name()->ToCString()<<"\");"<< std::endl;
+    os<<" if(name->IsDifferent(nameitem)) return 0;"<< std::endl;
+    if(isEnum) {
+      //nameFunc.AssignCat(item->Name()->ToCString());
+      os<<" Standard_Integer numit = SelMem->Enum();"<< std::endl;
+      os<<"  "<<item->CPPName()->ToCString()<<" val;"<< std::endl;
+      os<<" switch(numit) {"<< std::endl;
+      Handle(Express_Enum) Enum = Handle(Express_Enum)::DownCast(item);
+      Handle(TColStd_HSequenceOfHAsciiString) enitems =  Enum->Names();
+      Handle(TCollection_HAsciiString) prefix = Express::EnumPrefix(item->Name());
+      for(Standard_Integer k = 1; k <= enitems->Length(); k++)
+        os<<"    case "<<k<<" : val = "<<item->Name()->ToCString()<<"_"<<prefix->ToCString()<<enitems->Value(k)->ToCString()<<"; break;"<< std::endl;
+      os<<"    default : return 0;break;"<< std::endl;
+      os<<"  }"<< std::endl;
+    }
+    else if(isString) {
+      os<<" Handle(TCollection_HAsciiString) val = new TCollection_HAsciiString;"<< std::endl;
+      os<<" val->AssignCat(SelMem->String());"<< std::endl;
+    }
+    
+    else 
+      os<<" "<<item->CPPName()->ToCString()<<" val = SelMem->"<<Func->ToCString()<<"();"<< std::endl;
+      
+    
+    os<<" return val;"<< std::endl;
+    os<<"}"<< std::endl;
+      
+  }
+  // close CXX
+  os.close();
+    
+  return Standard_True;
+}
+//=======================================================================
+//function : GenerateSelectMember
+//purpose  : 
+//=======================================================================
+
+ Standard_Boolean Express_Select::GenerateSelectMember(const Handle(TColStd_HSequenceOfInteger)& seqMember) const
+{
+  Handle(TCollection_HAsciiString) CPPname = new TCollection_HAsciiString;
+  CPPname->AssignCat(CPPName());
+  CPPname->AssignCat("Member");
+    
+  Handle(TCollection_HAsciiString) MemberName = new TCollection_HAsciiString;
+  MemberName->AssignCat(Name());
+  MemberName->AssignCat("Member");
+  Handle(TCollection_HAsciiString) CDLname = new TCollection_HAsciiString;
+  CDLname->AssignCat(MemberName);
+  CDLname->AssignCat(" from ");
+  CDLname-> AssignCat(GetPackageName());
+   // create a package directory (if not yet exist)
+  OSD_Protection prot ( OSD_RX, OSD_RWX, OSD_RX, OSD_RX );
+  TCollection_AsciiString pack = GetPackageName()->String();
+  OSD_Path path ( pack );
+  OSD_Directory dir ( path );
+  dir.Build ( prot );
+  pack += "/";
+  pack += CPPname->String();
+  ///pack += "Member";
+  // Step 1: generating CDL
+  
+  // Open CDL file 
+  std::ofstream os ( pack.Cat ( ".cdl" ).ToCString() );
+  // write header
+  Express::WriteFileStamp ( os, CPPname, Standard_True );
+  
+  // write start of declaration (inheritance)
+  os << "class " << CDLname->ToCString() << std::endl << "inherits SelectNamed from StepData";
+  os << std::endl << std::endl;
+  
+  os << "    ---Purpose: Representation of member for  STEP SELECT type " << Name()->ToCString() << std::endl;
+  os << std::endl;
+  
+   // write "is" section
+  os << "is" << std::endl;
+  os << "    Create returns " << CDLname->ToCString() << ";" << std::endl;
+  os << "      ---Purpose: Empty constructor" << std::endl;
+  os << std::endl;
+  
+  os << "    HasName (me) returns Boolean  is redefined;"<< std::endl;
+  os << "      ---Purpose: Returns True if has name"<< std::endl;
+  os << std::endl;
+  os << "    Name (me) returns CString  is redefined;"<< std::endl;
+  os << "      ---Purpose: Returns set name "<< std::endl;
+  os << std::endl;
+  os << "    SetName (me : mutable; name : CString)  returns Boolean  is redefined;"<< std::endl;
+  os << "      ---Purpose: Set name "<< std::endl;
+  os << std::endl;
+  os << "    Matches (me; name : CString) returns Boolean  is redefined;"<< std::endl;
+  os << "      ---Purpose : Tells if the name of a SelectMember matches a given one;"<< std::endl;
+  os << std::endl;
+  //write fields
+  os<<"fields"<< std::endl<< std::endl;
+  os << "    mycase : Integer;"<< std::endl<< std::endl;
+  // write end
+  os << "end " << MemberName->ToCString()<< ";" << std::endl;
+  os.close();
+
+  //===============================
+  // Step 2: generating CXX
+   // Open CXX file 
+  os.open ( pack.Cat ( ".cxx" ).ToCString() );
+
+  // write header
+  Express::WriteFileStamp ( os, CPPname, Standard_False );
+
+  // write include section
+  os << "#include <" << CPPname->ToCString() << ".ixx>" << std::endl;
+   os << "#include <TCollection_HAsciiString.hxx>"<< std::endl;
+  // write constructor
+  Express::WriteMethodStamp ( os, CPPname );
+  os << CPPname->ToCString() << "::" << CPPname->ToCString() << " () : mycase(0) " << std::endl;
+  os << "{" << std::endl << "}" << std::endl;
+  
+  //write method HasName
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("HasName") );
+  os<<"Standard_Boolean "<<CPPname->ToCString()<<"::HasName() const"<< std::endl;
+  os << "{" << std::endl;
+  os<< " return mycase >0;"<< std::endl;
+  os<< "}" << std::endl;
+  
+  Standard_Boolean hasEnum = Standard_False;
+  //write method Name
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("Name") );
+  os<<"Standard_CString "<<CPPname->ToCString()<<"::Name() const"<< std::endl;
+  os << "{" << std::endl;
+  os << "  Handle(TCollection_HAsciiString) aname = new TCollection_HAsciiString;"<< std::endl;
+  os << "  switch(mycase)  {"<< std::endl;
+  Standard_Integer i = 1;
+  for( i = 1; i <= seqMember->Length(); i++) {
+    Standard_Integer ind = seqMember->Value(i);
+    Handle(Express_Item) item = myItems->Value(ind);
+    if(item->IsKind(STANDARD_TYPE(Express_Enum)))
+      hasEnum = Standard_True;
+    os << "    case "<<i<<"  : aname->AssignCat(\""<<myNames->Value(ind)->ToCString()<<"\"); break;"<< std::endl;
+  }
+  os << "    default : break;"<< std::endl;
+  os<<"  }"<< std::endl;
+  os<<"  return aname->ToCString();"<< std::endl;
+  os<< "}" << std::endl;
+  
+  //write static method for compare name
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("CompareNames") );
+  os<<"static Standard_Integer CompareNames(const Standard_CString name";
+  if(hasEnum)
+    os<<",Standard_Integer &numen) "<< std::endl;
+  else
+    os<<")"<< std::endl;
+  os << "{" << std::endl;
+  os << "  Standard_Integer thecase =0;"<< std::endl;
+  os << "  if (!name || name[0] == \'/0\') thecase = 0;"<< std::endl;
+  for( i = 1; i <= seqMember->Length(); i++) {
+    Standard_Integer ind = seqMember->Value(i);
+    Handle(Express_Item) item = myItems->Value(ind);
+    if(item->IsKind(STANDARD_TYPE(Express_Enum))) {
+      Handle(Express_Enum) en = Handle(Express_Enum)::DownCast(item);
+      for(Standard_Integer k =1 ; k <= en->Names()->Length();k++) {
+         os<<"   else if(!strcmp (name,\""<<en->Names()->Value(k)->ToCString()<<"\")) { "<< std::endl;
+         os<<"     thecase = "<<i<<";"<< std::endl;
+         os<<"     numen =  "<<k<<";"<< std::endl;
+         os<<"   }"<< std::endl; 
+         
+      }
+    }
+    else
+      os<<"   else if(!strcmp (name,\""<<myNames->Value(ind)->ToCString()<<"\")) thecase = "<<i<<";"<< std::endl;  
+  }
+  os << "  return thecase;"<< std::endl;
+  os << "}" << std::endl;
+  
+  //write method SetName
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("SetName") );
+  os<<"Standard_Boolean "<<CPPname->ToCString()<<"::SetName(const Standard_CString name) "<< std::endl;
+  os << "{" << std::endl;
+  if(hasEnum) {
+    os << "  Standard_Integer numit =0;"<< std::endl;
+    os << "  mycase = CompareNames(name,numit);"<< std::endl;
+  
+    os << "  if(numit) SetInteger(numit);"<< std::endl;
+  }
+  else
+    os << "  mycase = CompareNames(name);"<< std::endl;
+  os << "  return (mycase >0);"<< std::endl;
+  
+  os<< "}" << std::endl;
+  //write method Matches
+  Express::WriteMethodStamp ( os, new TCollection_HAsciiString ("Matches") );
+  os<<"Standard_Boolean "<<CPPname->ToCString()<<"::Matches(const Standard_CString name) const"<< std::endl;
+  os << "{" << std::endl;
+  if(hasEnum) {
+    os << "  Standard_Integer numit =0;"<< std::endl;
+    os<< " Standard_Integer thecase =CompareNames(name,numit);"<< std::endl;
+  }
+  else
+    os<< " Standard_Integer thecase =CompareNames(name);"<< std::endl;
+  os << "  return (thecase >0);"<< std::endl;
+  os << "}" << std::endl;
+  return Standard_True;
+}
diff --git a/src/Express/Express_Select.hxx b/src/Express/Express_Select.hxx
new file mode 100644 (file)
index 0000000..f224359
--- /dev/null
@@ -0,0 +1,74 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Select_HeaderFile
+#define _Express_Select_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_Item.hxx>
+#include <Standard_CString.hxx>
+#include <Standard_Boolean.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+class Express_HSequenceOfItem;
+
+//! Implements TYPE SELECT item of the EXPRESS
+//! schema, with interface for deferred Item class.
+class Express_Select : public Express_Item
+{
+
+public:
+
+  
+  //! Create SELECT item and initialize it
+  Standard_EXPORT Express_Select(const Standard_CString name, const Handle(TColStd_HSequenceOfHAsciiString)& names);
+  
+  //! Returns names of types included in this SELECT
+  Standard_EXPORT  const  Handle(TColStd_HSequenceOfHAsciiString)& Names()  const;
+  
+  //! Returns sequence of items corresponding to typenames
+  Standard_EXPORT  const  Handle(Express_HSequenceOfItem)& Items()  const;
+  
+  //! Create CDL/CXX files from item
+  Standard_EXPORT virtual   Standard_Boolean GenerateClass()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Select,Express_Item)
+
+protected:
+
+
+
+
+private: 
+
+  
+  Standard_EXPORT   Standard_Boolean GenerateSelectMember (const Handle(TColStd_HSequenceOfInteger)& seqMember)  const;
+
+  Handle(TColStd_HSequenceOfHAsciiString) myNames;
+  Handle(Express_HSequenceOfItem) myItems;
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Select_HeaderFile
diff --git a/src/Express/Express_SequenceOfEntity.hxx b/src/Express/Express_SequenceOfEntity.hxx
new file mode 100644 (file)
index 0000000..42e4d71
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_SequenceOfEntity_HeaderFile
+#define Express_SequenceOfEntity_HeaderFile
+
+#include <Express_Entity.hxx>
+#include <NCollection_Sequence.hxx>
+
+typedef NCollection_Sequence<Handle(Express_Entity)> Express_SequenceOfEntity;
+
+
+#endif
diff --git a/src/Express/Express_SequenceOfField.hxx b/src/Express/Express_SequenceOfField.hxx
new file mode 100644 (file)
index 0000000..69e67a9
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_SequenceOfField_HeaderFile
+#define Express_SequenceOfField_HeaderFile
+
+#include <Express_Field.hxx>
+#include <NCollection_Sequence.hxx>
+
+typedef NCollection_Sequence<Handle(Express_Field)> Express_SequenceOfField;
+
+
+#endif
diff --git a/src/Express/Express_SequenceOfItem.hxx b/src/Express/Express_SequenceOfItem.hxx
new file mode 100644 (file)
index 0000000..66ad4d5
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Express_SequenceOfItem_HeaderFile
+#define Express_SequenceOfItem_HeaderFile
+
+#include <Express_Item.hxx>
+#include <NCollection_Sequence.hxx>
+
+typedef NCollection_Sequence<Handle(Express_Item)> Express_SequenceOfItem;
+
+
+#endif
diff --git a/src/Express/Express_Set.hxx b/src/Express/Express_Set.hxx
new file mode 100644 (file)
index 0000000..686115d
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Set_HeaderFile
+#define _Express_Set_HeaderFile
+
+#include <Express_ComplexType.hxx>
+
+typedef Express_ComplexType Express_Set;
+
+#endif // _Express_Set_HeaderFile
diff --git a/src/Express/Express_String.cxx b/src/Express/Express_String.cxx
new file mode 100644 (file)
index 0000000..e7c6447
--- /dev/null
@@ -0,0 +1,59 @@
+// Created:    Tue Nov  2 15:27:26 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_String.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_String,Express_PredefinedType)
+
+//=======================================================================
+//function : Express_String
+//purpose  : 
+//=======================================================================
+
+Express_String::Express_String () 
+{
+}
+
+//=======================================================================
+//function : CPPName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_String::CPPName () const
+{
+  return new TCollection_HAsciiString ( "TCollection_HAsciiString" );
+}
+
+//=======================================================================
+//function : CDLName
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) Express_String::CDLName () const
+{
+  return new TCollection_HAsciiString ( "HAsciiString from TCollection" );
+}
+
+//=======================================================================
+//function : IsStandard
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_String::IsStandard () const
+{
+  return Standard_False;
+}
+
diff --git a/src/Express/Express_String.hxx b/src/Express/Express_String.hxx
new file mode 100644 (file)
index 0000000..f3b4ccd
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_String_HeaderFile
+#define _Express_String_HeaderFile
+
+#include <Standard_Type.hxx>
+
+#include <Express_PredefinedType.hxx>
+
+class TCollection_HAsciiString;
+
+
+//! Implements EXPRESS type 'STRING'
+class Express_String : public Express_PredefinedType
+{
+
+public:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_String();
+  
+  //! Returns "Handle(TCollection_HAsciiString)"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const;
+  
+  //! Returns "HAsciiString from TCollection"
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const;
+  
+  //! Returns False
+  Standard_EXPORT virtual   Standard_Boolean IsStandard()  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_String,Express_PredefinedType)
+
+protected:
+
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_String_HeaderFile
diff --git a/src/Express/Express_Type.cxx b/src/Express/Express_Type.cxx
new file mode 100644 (file)
index 0000000..77a7db8
--- /dev/null
@@ -0,0 +1,68 @@
+// Created:    Tue Nov  2 15:11:36 1999
+// Author:     Andrey BETENEV
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Express_Type.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Express_Type,Standard_Transient)
+
+//=======================================================================
+//function : Express_Type
+//purpose  : 
+//=======================================================================
+
+Express_Type::Express_Type ()
+{
+}
+
+//=======================================================================
+//function : IsStandard
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Type::IsStandard () const
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : IsSimple
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Type::IsSimple () const
+{
+  return IsStandard();
+}
+
+//=======================================================================
+//function : IsHandle
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Type::IsHandle () const
+{
+  return ! IsSimple();
+}
+
+//=======================================================================
+//function : Use
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Express_Type::Use (const Handle(TCollection_HAsciiString) &,
+                                    const Standard_Boolean ) const
+{
+  return Standard_False;
+}
diff --git a/src/Express/Express_Type.hxx b/src/Express/Express_Type.hxx
new file mode 100644 (file)
index 0000000..88c7b01
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (c) 1999-2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Express_Type_HeaderFile
+#define _Express_Type_HeaderFile
+
+#include <Standard_Type.hxx>
+
+class TCollection_HAsciiString;
+
+//! Provides basis for identification (reference) to some type
+//! in express schema
+class Express_Type : public Standard_Transient
+{
+
+public:
+
+  
+  //! Returns CPP-style name of the type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CPPName()  const = 0;
+  
+  //! Returns CDL-style name of the type
+  Standard_EXPORT virtual   Handle(TCollection_HAsciiString) CDLName()  const = 0;
+  
+  //! Return True if type is defined in package Standard (False by default)
+  Standard_EXPORT virtual   Standard_Boolean IsStandard()  const;
+  
+  //! Return True if type is simple (not a class)
+  //! (by default returns IsStandard())
+  Standard_EXPORT virtual   Standard_Boolean IsSimple()  const;
+  
+  //! Return True if type is Transient
+  //! (by default returns ! IsSimple())
+  Standard_EXPORT virtual   Standard_Boolean IsHandle()  const;
+  
+  //! Declares type as used by some item being generated.
+  //! Calls Use() for all referred types and schema items.
+  //! Default instantiation does nothing
+  Standard_EXPORT virtual   Standard_Boolean Use (const Handle(TCollection_HAsciiString)& pack, const Standard_Boolean defer = Standard_False)  const;
+
+
+
+
+  DEFINE_STANDARD_RTTIEXT(Express_Type,Standard_Transient)
+
+protected:
+
+  
+  //! Empty constructor
+  Standard_EXPORT Express_Type();
+
+
+
+private: 
+
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _Express_Type_HeaderFile
diff --git a/src/Express/FILES b/src/Express/FILES
new file mode 100644 (file)
index 0000000..3f35ed5
--- /dev/null
@@ -0,0 +1,48 @@
+Express.cxx
+Express.hxx
+Express_Alias.cxx
+Express_Alias.hxx
+Express_Array.hxx
+Express_Bag.hxx
+Express_Boolean.cxx
+Express_Boolean.hxx
+Express_ComplexType.cxx
+Express_ComplexType.hxx
+Express_DataMapOfAsciiStringItem.hxx
+Express_Entity.cxx
+Express_Entity.hxx
+Express_Enum.cxx
+Express_Enum.hxx
+Express_Field.cxx
+Express_Field.hxx
+Express_HSequenceOfEntity.hxx
+Express_HSequenceOfField.hxx
+Express_HSequenceOfItem.hxx
+Express_Integer.cxx
+Express_Integer.hxx
+Express_Item.cxx
+Express_Item.hxx
+Express_List.hxx
+Express_Logical.cxx
+Express_Logical.hxx
+Express_NamedType.cxx
+Express_NamedType.hxx
+Express_Number.hxx
+Express_PredefinedType.cxx
+Express_PredefinedType.hxx
+Express_Real.cxx
+Express_Real.hxx
+Express_Reference.cxx
+Express_Reference.hxx
+Express_Schema.cxx
+Express_Schema.hxx
+Express_Select.cxx
+Express_Select.hxx
+Express_SequenceOfEntity.hxx
+Express_SequenceOfField.hxx
+Express_SequenceOfItem.hxx
+Express_Set.hxx
+Express_String.cxx
+Express_String.hxx
+Express_Type.cxx
+Express_Type.hxx
index 25c823990cd57d1336d5626b5b320a6d281336f8..5de367d7625e268dadc28897909263a8231bccb4 100644 (file)
@@ -17,7 +17,7 @@
 proc DataExchange:toolkits { } {
     return [list TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES \
                TKXCAF TKXDEIGES TKXDESTEP \
-               TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh]
+               TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKExpress]
 }
 ;#
 ;# Autres UDs a prendre.
@@ -27,6 +27,7 @@ proc DataExchange:ressources { } {
            [list both r XSMessage {} ] \
            [list both r SHMessage {} ] \
            [list both r XSTEPResource {} ] \
+           [list both x ExpToCasExe {} ] \
            ]
 }
 ;#
diff --git a/src/TKExpress/CMakeLists.txt b/src/TKExpress/CMakeLists.txt
new file mode 100644 (file)
index 0000000..078099e
--- /dev/null
@@ -0,0 +1,3 @@
+project(TKExpress)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
diff --git a/src/TKExpress/EXTERNLIB b/src/TKExpress/EXTERNLIB
new file mode 100644 (file)
index 0000000..799bf4a
--- /dev/null
@@ -0,0 +1,2 @@
+TKernel
+CSF_TBB
\ No newline at end of file
diff --git a/src/TKExpress/FILES b/src/TKExpress/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKExpress/PACKAGES b/src/TKExpress/PACKAGES
new file mode 100644 (file)
index 0000000..8e20741
--- /dev/null
@@ -0,0 +1 @@
+Express